From f7f94b33d0e7e2ddd4bb8f8ca44ebeb0f4cb9fd4 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Fri, 4 Apr 2014 18:48:38 +0900 Subject: [PATCH 001/178] Fix axis transition when transform --- c3.js | 69 +++++++++++++++++++++++++++---------------------------- c3.min.js | 4 ++-- 2 files changed, 36 insertions(+), 37 deletions(-) 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 From 51f2776a56f98a2cef91a853dea8119c854d06e5 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Sat, 5 Apr 2014 17:21:11 +0900 Subject: [PATCH 002/178] Fix xgrid focus length when reized - #124 --- c3.js | 16 +++++++++++----- c3.min.js | 4 ++-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/c3.js b/c3.js index fb7ab37..6d9f87d 100644 --- a/c3.js +++ b/c3.js @@ -402,6 +402,13 @@ margin3.left = width / 2 + radiusExpanded; } } + function updateXgridFocus() { + main.select('line.' + CLASS.xgridFocus) + .attr("x1", __axis_rotated ? 0 : -10) + .attr("x2", __axis_rotated ? width : -10) + .attr("y1", __axis_rotated ? -10 : margin.top) + .attr("y2", __axis_rotated ? -10 : height); + } function updateRadius() { radiusExpanded = height / 2; radius = radiusExpanded * 0.95; @@ -2431,11 +2438,7 @@ grid.append('g') .attr("class", CLASS.xgridFocus) .append('line') - .attr('class', CLASS.xgridFocus) - .attr("x1", __axis_rotated ? 0 : -10) - .attr("x2", __axis_rotated ? width : -10) - .attr("y1", __axis_rotated ? -10 : margin.top) - .attr("y2", __axis_rotated ? -10 : height); + .attr('class', CLASS.xgridFocus); } // Y-Grid @@ -2947,6 +2950,9 @@ // tooltip tooltip.style("display", "none"); + // xgrid focus + updateXgridFocus(); + // grid main.select('line.' + CLASS.xgridFocus).style("visibility", "hidden"); if (__grid_x_show) { diff --git a/c3.min.js b/c3.min.js index 7f0c758..466d20b 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;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 +!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;ckf&&(kf=0),0>mf&&(mf=0),hf={top:ug?gf.top:pf-og-(Zh?0:qf),right:0/0,bottom:20+(Zh?0:qf),left:ug?bi:gf.left},lf=ug?gf.left-bi-ci:kf,nf=ug?mf:pf-hf.top-hf.bottom,0>lf&&(lf=0),0>nf&&(nf=0),jf={top:Zh?0:pf-qf,right:0/0,bottom:0,left:Zh?of-rf:0},p(),Zh&&Jd(Ve.data.targets)&&(jf.left=kf/2+tf)}function o(){li.select("line."+f.xgridFocus).attr("x1",ug?0:-10).attr("x2",ug?kf:-10).attr("y1",ug?-10:gf.top).attr("y2",ug?-10:mf)}function p(){tf=mf/2,sf=.95*tf,uf=Id(Ve.data.targets)?.6*sf:0}function q(){var a=ug?f.axisX:f.axisY,b=Ue.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Ue.select(Xe).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Ye?Ye:x()}function s(){var a=Ze?Ze:y();return a>0?a:320}function t(){return Jd(Ve.data.targets)?0:$e?$e:ug||!Hg||Mg?1:v("y")}function u(){var a=1;return Jd(Ve.data.targets)?0:_e?_e:Zh?rf+(Qg&&!ug?v("y2"):a):Qg?Vg||ug?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||Hg?"y2"!==a||Qg?(gb(a).isInner?30:40)+("y2"===a?-10:0):di:qg&&!Zh?10:1}function x(){return+Ue.select(Xe).style("width").replace("px","")}function y(){return+Ue.select(Xe).style("height").replace("px","")}function z(a){return a?-5:-(gf.left-1)}function A(a){return a?-20:-1}function B(){return z(!ug)}function C(){return A(!ug)}function D(){return z(ug)}function E(){return A(ug)}function F(a){return a?kf+2+4:gf.left+20}function G(a){return a?80:mf+2}function H(){return F(!ug)}function I(){return G(!ug)}function J(){return F(ug)}function K(){return G(ug)}function L(){var a=ug?mf:kf,b=tc(),c=Vb()*(Fd(Ve.data.targets)?(b-(Lh?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){$h=a}function N(a){_h=a}function O(a){ai=a}function P(){return qg?Zh?_h*($h+1):of:0}function Q(){return qg?Zh?pf:ai*($h+1):0}function R(){var a,b=!Hf;zf=ug?1:0,Af=ug?mf:kf,Bf=ug?0:mf,Cf=ug?kf:1,Df=zf,Ef=Af,Ff=ug?0:nf,Gf=ug?lf:1,Hf=T(zf,Af,b?void 0:Hf.domain(),function(){return Nf.tickOffset()}),If=U(Bf,Cf),Jf=U(Bf,Cf),Kf=T(zf,Af,qi,function(a){return a%1?0:Qf.tickOffset()}),Lf=U(Ff,Gf),Mf=U(Ff,Gf),a=$(),Nf=X(Hf,Uh,a),Qf=X(Kf,Xh,a),Of=Y(If,Vh,Ng,Pg),Pf=Y(Jf,Wh,Wg,Yg),b||(ei.scale(Kf),af&&ii.scale(Hf)),S()}function S(){vf=Db(),wf=Eb(),xf=Eb(.98)}function T(a,b,e,f){var g=(Kh?Ue.time.scale():Ue.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),Lh){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return Ue.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?Jf:If}function W(a){return"y2"===Z(a)?Mf:Lf}function X(a,b,c){var d=(Lh?Bb():Ue.svg.axis()).scale(a).orient(b);return d.tickFormat(c),Lh?d.tickCentered(xg):d.tickOffset=function(){var a=ug?mf:kf;return a*Vb()/tc()/2},Lh&&d.categories(wg),d}function Y(a,b,c,d){return Ue.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Xf?Xf[a]:"y"}function $(){var a=Kh?Sh:Lh?Ic:function(a){return 0>a?a.toFixed(0):a};return yg&&("function"==typeof yg?a=yg:Kh&&(a=function(a){return Ue.time.format(yg)(a)})),a}function _(a){var b;return"y"===a?b=Lg:"y2"===a?b=Ug:"x"===a&&(b=Gg),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Lg=b:"y2"===a?Ug=b:"x"===a&&(Gg=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",ug?"inner-top":"inner-right")}function eb(){return cb("y",ug?"inner-right":"inner-top")}function fb(){return cb("y2",ug?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?kf/2:kf:b.isBottom?-mf:b.isMiddle?-mf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!ug,db())}function ob(){return kb(ug,eb())}function pb(){return kb(ug,fb())}function qb(){return lb(!ug,db())}function rb(){return lb(ug,eb())}function sb(){return lb(ug,fb())}function tb(){var a=db();return ug?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return ug?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return ug?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!ug,db())}function xb(){return mb(ug,eb())}function yb(){return mb(ug,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return Ue.selectAll("."+c+" .tick text").each(function(){var a=this.getBBox();bb?20:b}function Ab(){li.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),li.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),li.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=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]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return Ue.min(Object.keys(i).map(function(a){return Ue.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=vc(a),i=Ec(a);if(Wf.length>0)for(g=Hc(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 Ue.max(Object.keys(i).map(function(a){return Ue.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Sg:Jg,n="y2"===c?Rg:Ig,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?Tg:Kg,r=bd()&&ug;return 0===l.length?"y2"===c?Jf.domain():If.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&&Og&&(f=b(Og.top)?Og.top:e,g=b(Og.bottom)?Og.bottom:e),"y2"===c&&Xg&&(f=b(Xg.top)?Xg.top:e,g=b(Xg.bottom)?Xg.bottom:e),r&&(i=cd(o,p),j=$b(If.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]))),Fd(l)&&!Gc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(qi),c=$b(Hf.domain());return a||0===c?1:b/c}function Wb(a){return Eg?Eg:Ue.min(a,function(a){return Ue.min(a.values,function(a){return a.x})})}function Xb(a){return Dg?Dg:Ue.max(a,function(a){return Ue.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return Lh?d=0:Fd(a)?(c=tc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=Kh?new Date(c.getTime()-e):c-e,g=Kh?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return Rf&&a===Rf||Zd(Sf)&&$d(Sf,a)}function fc(a){return!ec(a)}function gc(a){return Rf?Rf:Zd(Sf)?Sf[a]:null}function hc(a,b){return a in Ve.data.x&&Ve.data.x[a]&&Ve.data.x[a][b]?Ve.data.x[a][b]:b}function ic(a){Object.keys(a).forEach(function(b){Sf[b]=a[b]})}function jc(a){var b;return a&&(b=Vf[a.id],a.name=b?b:a.id),a}function kc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=mc(b[d],a.id,d)}),Ve.data.x[a.id]=b})}function lc(a,b){a.forEach(function(a){b[a.id]&&kc([a],b[a.id])})}function mc(a,b,c){var d;return d=Kh?a?a instanceof Date?a:Vd(a):Vd(hc(b,c)):Mh&&!Lh?a?+a:hc(b,c):c}function nc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0&&(Ve.data.x[b]=a.map(function(a){return a[c]})):Ve.data.x[b]=a.map(function(a,b){return b})}),c.forEach(function(a){if(!Ve.data.x[a])throw new Error('x is not defined for id = "'+a+'".')}),b=c.map(function(b,c){var d=Uf(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=mc(g,b,e);return Mh&&Lh&&0===c&&g&&(0===e&&(wg=[]),wg.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++})}),Yf&&Dd(vc(b).filter(function(a){return!(a in Zf)}),Yf),b.forEach(function(a){ac(a.id_org,a)}),b}function qc(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 rc(a){return a>0&&Ve.data.targets[0].values[a-1]?Ve.data.targets[0].values[a-1].x:void 0}function sc(a){return a1?Ve.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?Ve.data.targets[0]:null,a}function vc(a){return a=c(a)?Ve.data.targets:a,a.map(function(a){return a.id})}function wc(a){var b,c=vc();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(Kh?new Date(h):h);i.push(d)}return i}function Cc(a){Th=Th.concat(a)}function Dc(a){Th=Th.filter(function(b){return a.indexOf(b)<0})}function Ec(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Fc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Hc(a){return Fc(a,function(a){return a>0})}function Ic(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(kd(a,f))),a[g].x&&(e=e.concat(kd(a,g))),nd(e,b)):ld(a,b,f,g)}function md(a,b){var c;return c=a.map(function(a){return ld(a.values,b)}),nd(c,b)}function nd(a,b){var c,d;return a.forEach(function(a){var e=_d(a,b);(c>e||!c)&&(c=e,d=a)}),d}function od(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 pd(){return _f&&"desc"===_f.toLowerCase()}function qd(){return _f&&"asc"===_f.toLowerCase()}function rd(a){var b=qd(),c=pd();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 sd(a,c){var d,e,f,g,h,i,j,k=Jd(Ve.data.targets),l=k?ed:dd,m=a.filter(function(a){return a&&b(a.value)});xh&&0!==m.length&&(oi.html(Ah(a,$(),l,Rh)).style("display","block"),d=oi.property("offsetWidth"),e=oi.property("offsetHeight"),k?(g=kf/2+c[0],i=mf/2+c[1]+20):(ug?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Hf(m[0].x)+20):(f=q(),g=f+t()+Hf(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),oi.style("top",i+"px").style("left",g+"px"))}function td(){oi.style("display","none")}function ud(a){var c=a.filter(function(a){return a&&b(a.value)});xh&&(Gd(Ve.data.targets)||Jd(Ve.data.targets)||li.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(ug?"y1":"x1",gd).attr(ug?"y2":"x2",gd))}function vd(){li.select("line."+f.xgridFocus).style("visibility","hidden")}function wd(a){return a.x||0===a.x?Hf(a.x):null}function xd(a){return V(a.id)(a.value)}function yd(){var a,b,d={},e=0;return zc(xc(Md)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Cd(a,b){return jh?jh:b?2*a.tickOffset()*kh/b:0}function Dd(a,b){var c,d=a?"string"==typeof a?[a]:a:vc();for(c=0;c0}function $d(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(Hf(a.x)-b[0],2)+Math.pow(If(a.value)-b[1],2)}function ae(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function be(a,b,c){jg(b,a.node()),li.select("."+f.selectedCircles+Xc(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Jc(f.selectedCircle,c)}).attr("cx",ug?xd:wd).attr("cy",ug?wd:xd).attr("stroke",function(){return Rh(b.id)}).attr("r",1.4*ih).transition().duration(100).attr("r",ih)}function ce(a,b,c){kg(b,a.node()),li.select("."+f.selectedCircles+Xc(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function de(a,b,c,d){a?be(b,c,d):ce(b,c,d)}function ee(a,b){jg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ue.rgb(Rh(b.id)).darker(1)})}function fe(a,b){kg(b,a.node()),a.transition().duration(100).style("fill",function(){return Rh(b.id)})}function ge(a,b,c,d){a?ee(b,c,d):fe(b,c,d)}function he(a){return a.filter(function(a){return b(a.value)})}function ie(a,c){return(c?li.selectAll("."+f.circles+Xc(c)):li).selectAll("."+f.circle+(b(a)?"-"+a:""))}function je(a,b){ie(a,b).classed(f.EXPANDED,!0).attr("r",hh)}function ke(a){ie(a).filter(function(){return Ue.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",eh)}function le(a){return li.selectAll("."+f.bar+(b(a)?"-"+a:""))}function me(a){le(a).classed(f.EXPANDED,!0)}function ne(a){le(a).classed(f.EXPANDED,!1)}function oe(a,b){var c=se(a,b);return function(a,b){var d=c(a,b),e=ug?1:0,f=ug?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function pe(a,b){var c=se(a,!1),d=b?qe:re;return function(a,b){return d(c(a,b),a,this)}}function qe(a,b){var c;return ug?(c=Md(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function re(a,b,c){var d=c.getBBox();return ug?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:Md(b)?-3:-6)}function se(a,b){var c=a.__max__+1,d=Cd(Nf,c),e=zd(d,c,a,!!b),f=Ad(!!b),g=Bd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return ug&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function te(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 ue(b){var c,d,e;if(pi=Ue.select(Xe),pi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(pi.html(""),pi.classed("c3",!0),Ve.data.x={},Ve.data.targets=pc(b),n(),R(),Hf.domain(Ue.extent(Zb(Ve.data.targets))),If.domain(Ub(Ve.data.targets,"y")),Jf.domain(Ub(Ve.data.targets,"y2")),Kf.domain(Hf.domain()),Lf.domain(If.domain()),Mf.domain(Jf.domain()),qi=Hf.domain(),ei.scale(Kf),af&&ii.scale(Hf),ji=pi.append("svg").attr("width",kf+gf.left+gf.right).attr("height",mf+gf.top+gf.bottom).on("mouseenter",df).on("mouseleave",ef),ki=ji.append("defs"),ki.append("clipPath").attr("id",Eh).append("rect").attr("width",kf).attr("height",mf),ki.append("clipPath").attr("id",Fh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),ki.append("clipPath").attr("id",Gh).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),li=ji.append("g").attr("transform",Yh.main),mi=ng?ji.append("g").attr("transform",Yh.context):null,ni=qg?ji.append("g").attr("transform",Yh.legend):null,oi=Ue.select(Xe).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),li.append("g").attr("class",f.axisX).attr("clip-path",ug?"":Ih).attr("transform",Yh.x).append("text").attr("class",f.axisXLabel).attr("transform",ug?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),Hg&&li.append("g").attr("class",f.axisY).attr("clip-path",ug?Jh:"").append("text").attr("class",f.axisYLabel).attr("transform",ug?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),Qg&&li.append("g").attr("class",f.axisY2).attr("transform",Yh.y2).append("text").attr("class",f.axisY2Label).attr("transform",ug?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=li.append("g").attr("clip-path",Hh).attr("class",f.grid),Zg&&d.append("g").attr("class",f.xgrids),Zd(_g)&&d.append("g").attr("class",f.xgridLines),fh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),ah&&d.append("g").attr("class",f.ygrids),Zd(bh)&&d.append("g").attr("class",f.ygridLines),li.append("g").attr("clip-path",Hh).attr("class",f.regions),li.append("g").attr("clip-path",Hh).attr("class",f.chart),c=li.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",af?ug?"ns-resize":"ew-resize":null),li.select("."+f.chart).append("g").attr("class",f.chartBars),li.select("."+f.chart).append("g").attr("class",f.chartLines),li.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Yh.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),li.select("."+f.chart).append("g").attr("class",f.chartTexts),af&&li.insert("rect",cf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",kf).attr("height",mf).style("opacity",0).style("cursor",ug?"ns-resize":"ew-resize").call(ii).on("dblclick.zoom",null),Fg&&ei.extent("function"!=typeof Fg?Fg:Fg(Zb())),ng&&(mi.append("g").attr("clip-path",Hh).attr("class",f.chart),mi.select("."+f.chart).append("g").attr("class",f.chartBars),mi.select("."+f.chart).append("g").attr("class",f.chartLines),mi.append("g").attr("clip-path",Hh).attr("class",f.brush).call(ei).selectAll("rect").attr(ug?"width":"height",ug?lf:nf),mi.append("g").attr("class",f.axisX).attr("transform",Yh.subx).attr("clip-path",ug?"":Ih)),He(Ve.data.targets),ug?li.select("."+f.axisX).style("opacity",0).call(Nf):(li.select("."+f.axisY).style("opacity",0).call(Of),li.select("."+f.axisY2).style("opacity",0).call(Pf)),Ge({withTransform:!0,withLegend:!0,withTransitionForAxis:!1}),Bh){if(Kh&&"string"==typeof Ch){for(Ch=Vd(Ch),e=0;e0){d=[];for(var g in Vf)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=od(this),c=m.x,d=m.y,e=m.width,k=m.height,l=ge,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 ze(a){Jd(Ve.data.targets)||cg&&(Nh=a,li.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Oh=!0,lg())}function Ae(){Jd(Ve.data.targets)||cg&&(li.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),li.selectAll("."+f.shape).classed(f.INCLUDED,!1),Oh=!1,mg())}function Be(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P=yd(),Q=Jd(Ve.data.targets),R=zc(Ve.data.targets);if(0!==R.length){if(a=d(a)?a:{},v=d(a.withY)?a.withY:!0,w=d(a.withSubchart)?a.withSubchart:!0,x=d(a.withTransition)?a.withTransition:!0,A=d(a.withTransform)?a.withTransform:!1,B=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,C=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,D=d(a.withLegend)?a.withLegend:!1,y=d(a.withTransitionForExit)?a.withTransitionForExit:x,z=d(a.withTransitionForAxis)?a.withTransitionForAxis:x,I=x?ff:0,J=y?I:0,K=z?I:0,D&&qg&&Pe(Ve.data.targets,a),C&&(Hf.domain(Ue.extent(Zb(R))),qi=Hf.domain(),af&&ii.scale(Hf).updateScaleExtent(),Kf.domain(Hf.domain()),ei.scale(Kf)),B&&(Hf.domain(ei.empty()?qi:ei.extent()),af&&ii.scale(Hf).updateScaleExtent(),Gd(R)||(M=Bc(Ac(R)),Nf.tickValues(M),Qf.tickValues(M))),If.domain(Ub(R,"y")),Jf.domain(Ub(R,"y2")),li.select("."+f.axisX).style("opacity",Q?0:1).transition().duration(K).call(Nf),li.select("."+f.axisY).style("opacity",Q?0:1).transition().duration(K).call(Of),li.select("."+f.axisY2).style("opacity",Q?0:1).transition().duration(K).call(Pf),B&&zg&&M){for(N=1;N=V;V++)e.push(new Date(V+"-01-01 00:00:00"))}else e=Hf.ticks(10);c=li.select("."+f.xgrids).selectAll("."+f.xgrid).data(e),c.enter().append("line").attr("class",f.xgrid),c.attr("x1",ug?0:function(a){return Hf(a)-Nf.tickOffset()}).attr("x2",ug?kf:function(a){return Hf(a)-Nf.tickOffset()}).attr("y1",ug?function(a){return Hf(a)-Nf.tickOffset()}:gf.top).attr("y2",ug?function(a){return Hf(a)-Nf.tickOffset()}:mf).style("opacity",function(){return+Ue.select(this).attr(ug?"y1":"x1")===(ug?mf:0)?0:1}),c.exit().remove()}Zd(_g)&&(g=li.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",ug?"":"rotate(-90)").attr("dx",ug?0:-gf.top).attr("dy",-5).style("opacity",0),g.select("line").transition().duration(I).attr("x1",ug?0:hd).attr("x2",ug?kf:hd).attr("y1",ug?hd:gf.top).attr("y2",ug?hd:mf).style("opacity",1),g.select("text").transition().duration(I).attr("x",ug?kf:0).attr("y",hd).text(function(a){return a.text}).style("opacity",1),g.exit().transition().duration(I).style("opacity",0).remove()),v&&ah&&(i=li.select("."+f.ygrids).selectAll("."+f.ygrid).data(If.ticks(ch)),i.enter().append("line").attr("class",f.ygrid),i.attr("x1",ug?If:0).attr("x2",ug?If:kf).attr("y1",ug?0:If).attr("y2",ug?mf:If),i.exit().remove()),v&&Zd(bh)&&(j=li.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(bh),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",ug?"rotate(-90)":"").attr("dx",ug?0:-gf.top).attr("dy",-5).style("opacity",0),j.select("line").transition().duration(I).attr("x1",ug?id:0).attr("x2",ug?id:kf).attr("y1",ug?0:id).attr("y2",ug?mf:id).style("opacity",1),j.select("text").transition().duration(I).attr("x",ug?0:kf).attr("y",id).text(function(a){return a.text}).style("opacity",1),j.exit().transition().duration(I).style("opacity",0).remove()),m=li.selectAll("."+f.bars).selectAll("."+f.bar).data(Rd),m.enter().append("path").attr("d",E).style("stroke","none").style("opacity",0).style("fill",function(a){return Rh(a.id)}).attr("class",Rc),m.style("opacity",Zc).transition().duration(I).attr("d",E).style("opacity",1),m.exit().transition().duration(J).style("opacity",0).remove(),p=li.selectAll("."+f.texts).selectAll("."+f.text).data(Td),p.enter().append("text").attr("class",Kc).attr("text-anchor",function(a){return ug?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),p.text(function(a){return fd(a.id)(a.value)}).style("fill-opacity",$c).transition().duration(I).attr("x",G).attr("y",H).style("fill-opacity",ad),p.exit().transition().duration(J).style("fill-opacity",0).remove(),li.selectAll("."+f.line).style("opacity",Zc).transition().duration(I).attr("d",fi).style("opacity",1),li.selectAll("."+f.area).style("opacity",0).transition().duration(I).attr("d",gi).style("opacity",ri),l=li.selectAll("."+f.circles).selectAll("."+f.circle).data(Sd),l.enter().append("circle").attr("class",Pc).style("opacity",0).attr("r",eh),l.style("opacity",Zc).transition().duration(I).style("opacity",_c).attr("cx",ug?xd:wd).attr("cy",ug?wd:xd),l.exit().remove(),li.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",A?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(I).attrTween("d",function(a){var b,c=Cb(a);return c?(b=Ue.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",A?"scale(1)":"").style("opacity",1),li.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(I).text(Jb).style("opacity",function(a){return yc(a.data.id)&&Qd(a.data)?1:0}),li.select("."+f.chartArcsTitle).style("opacity",Id(Ve.data.targets)?1:0),ng&&(null!==Ue.event&&"zoom"===Ue.event.type&&ei.extent(Hf.orgDomain()).update(),w&&(mi.select("."+f.axisX).style("opacity",Q?0:1).transition().duration(I).call(Qf),ei.empty()||ei.extent(Hf.orgDomain()).update(),F=oe(P,!0),q=mi.selectAll("."+f.bars).selectAll("."+f.bar).data(Rd),q.enter().append("path").attr("d",F).style("stroke","none").style("fill",function(a){return Rh(a.id)}).attr("class",Rc),q.style("opacity",Zc).transition().duration(I).attr("d",F).style("opacity",1),q.exit().transition().duration(I).style("opacity",0).remove(),mi.selectAll("."+f.line).style("opacity",Zc).transition().duration(I).attr("d",hi).style("opacity",1))),li.selectAll("."+f.selectedCircles).filter(function(a){return Md(a)}).selectAll("circle").remove(),li.selectAll("."+f.selectedCircle).transition().duration(I).attr("cx",ug?xd:wd).attr("cy",ug?wd:xd),Zd(Sf)?(r=li.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),we(r.enter()),r.attr("x",0).attr("y",0).attr("width",kf).attr("height",mf)):(Mh&&!Lh?(u=function(a,b){var c=rc(b),d=sc(b),e=Ve.data.x[a.id][b];return(Hf(d?d:e+50)-Hf(c?c:e-50))/2},t=function(a,b){var c=rc(b),d=Ve.data.x[a.id][b];return(Hf(d)+Hf(c?c:d-50))/2}):(u=L(),t=function(a){return Hf(a.x)-u/2}),s=uc(),li.select("."+f.eventRects).datum(s?s.values:[]),r=li.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),ve(r.enter()),r.attr("class",Wc).attr("x",ug?0:t).attr("y",ug?t:0).attr("width",ug?kf:u).attr("height",ug?u:mf),r.exit().remove()),n=li.select("."+f.regions).selectAll("rect."+f.region).data(wh),n.enter().append("rect").style("fill-opacity",0),n.attr("class",Vc).attr("x",ug?0:cc).attr("y",ug?cc:gf.top).attr("width",ug?kf:dc).attr("height",ug?dc:mf).transition().duration(I).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),n.exit().transition().duration(I).style("fill-opacity",0).remove(),vc().forEach(function(a){si[a]=!0})}}function Ce(){Be({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function De(){return"mousemove"===Ue.event.sourceEvent.type&&ii.altDomain?(Hf.domain(ii.altDomain),void ii.scale(Hf).updateScaleExtent()):(Lh&&Hf.orgDomain()[0]===qi[0]&&Hf.domain([qi[0]-1e-10,Hf.orgDomain()[1]]),Be({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Ue.event.sourceEvent.type&&(Ph=!0)))}function Ee(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Fe(){ji.attr("width",of).attr("height",pf),ji.select("#"+Eh).select("rect").attr("width",kf).attr("height",mf),ji.select("#"+Fh).select("rect").attr("width",H),ji.select("#"+Gh).select("rect").attr("width",J),ji.select("."+f.zoomRect).attr("width",kf).attr("height",mf)}function Ge(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(),R(),Fe(),m(a.withTransition),Be(a)}function He(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=li.select("."+f.chartTexts).selectAll("."+f.chartText).data(a),j=i.enter().append("g").attr("class",function(a){return f.chartText+Jc(f.target,a.id)}).style("pointer-events","none"),j.append("g").attr("class",Lc).style("fill",function(a){return Rh(a.id)}),e=li.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),d=e.enter().append("g").attr("class",function(a){return f.chartBar+Jc(f.target,a.id)}).style("pointer-events","none"),d.append("g").attr("class",Sc).style("fill",function(a){return Rh(a.id)}).style("stroke","none").style("cursor",function(a){return eg(a)?"pointer":null}),c=li.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),b=c.enter().append("g").attr("class",function(a){return f.chartLine+Jc(f.target,a.id)}).style("pointer-events","none"),b.append("path").attr("class",Oc).style("opacity",0).style("stroke",function(a){return Rh(a.id)}),b.append("path").attr("class",Uc).style("opacity",function(){return ri=+Ue.select(this).style("opacity"),0}).style("fill",function(a){return Rh(a.id)}),b.append("g").attr("class",function(a){return Jc(f.selectedCircles,a.id)}),b.append("g").attr("class",Qc).style("fill",function(a){return Rh(a.id)}).style("cursor",function(a){return eg(a)?"pointer":null}),a.forEach(function(a){li.selectAll("."+f.selectedCircles+Xc(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=li.select("."+f.chartArcs).selectAll("."+f.chartArc).data(yf(a)),g=h.enter().append("g").attr("class",function(a){return f.chartArc+Jc(f.target,a.data.id)}),g.append("path").attr("class",Tc).style("opacity",0).style("fill",function(a){return Rh(a.data.id)}).style("cursor",function(a){return eg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),Me(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];sd(c,Ue.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),Oe(),td(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),ng&&(n=mi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),m=n.enter().append("g").attr("class",function(a){return f.chartBar+Jc(f.target,a.id)}),m.append("g").attr("class",Sc).style("fill",function(a){return Rh(a.id)}),l=mi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),k=l.enter().append("g").attr("class",function(a){return f.chartLine+Jc(f.target,a.id)}),k.append("path").attr("class",Oc).style("opacity",0).style("stroke",function(a){return Rh(a.id)})),ji.selectAll("."+f.target).filter(function(a){return yc(a.id)}).transition().style("opacity",1)}function Ie(a,b){Ve.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=Zh?i:h,k=Zh?qf:rf;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=Zh?u:t,tg?(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=vc(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,Zh?(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=ni.selectAll("."+f.legendItem).data(q).enter().append("g").attr("class",function(a){return Jc(f.legendItem,a)}).style("cursor","pointer").on("click",function(a){"function"==typeof sg?sg(a):Ve.toggle(a)}).on("mouseover",function(a){Ve.focus(a)}).on("mouseout",function(){Ve.revert()}),g.append("text").text(function(a){return d(Vf[a])?Vf[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Zh?i:-200).attr("y",Zh?-200:l),g.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Zh?j:-200).attr("y",Zh?-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 Rh(a)}).attr("x",Zh?i:-200).attr("y",Zh?-200:k).attr("width",10).attr("height",10),ni.selectAll("text").data(q).text(function(a){return d(Vf[a])?Vf[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",i).attr("y",l),ni.selectAll("rect."+f.legendItemEvent).data(q).transition().duration(p?250:0).attr("x",j).attr("y",o),ni.selectAll("rect."+f.legendItemTile).data(q).transition().duration(p?250:0).attr("x",h).attr("y",k),N(t),O(u),M(C),n(),R(),Fe(),m(!1)}function Qe(a){return wc(a.id)}function Re(a){return"data"in a&&wc(a.data.id)}function Se(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 Te(a,b,c){var d=!Jd(Ve.data.targets);Dd(a,b),Ge(c?c:{withTransitionForAxis:d})}var Ue=a.d3?a.d3:a.require?a.require("d3"):void 0,Ve={data:{},axis:{}},We={},Xe=h(["bindto"],"#chart"),Ye=h(["size","width"]),Ze=h(["size","height"]),$e=h(["padding","left"]),_e=h(["padding","right"]),af=h(["zoom","enabled"],!1),bf=h(["zoom","extent"]),cf=h(["zoom","privileged"],!1),df=h(["onenter"],function(){}),ef=h(["onleave"],function(){}),ff=h(["transition","duration"],350);g("data","data is required in config");var 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,Rf=h(["data","x"]),Sf=h(["data","xs"],{}),Tf=h(["data","x_format"]),Uf=h(["data","id_converter"],function(a){return a}),Vf=h(["data","names"],{}),Wf=h(["data","groups"],[]),Xf=h(["data","axes"],{}),Yf=h(["data","type"]),Zf=h(["data","types"],{}),$f=h(["data","labels"],{}),_f=h(["data","order"]),ag=h(["data","regions"],{}),bg=h(["data","colors"],{}),cg=h(["data","selection","enabled"],!1),dg=h(["data","selection","grouped"],!1),eg=h(["data","selection","isselectable"],function(){return!0}),fg=h(["data","selection","multiple"],!0),gg=h(["data","onclick"],function(){}),hg=h(["data","onenter"],function(){}),ig=h(["data","onleave"],function(){}),jg=h(["data","onselected"],function(){}),kg=h(["data","onunselected"],function(){}),lg=h(["data","ondragstart"],function(){}),mg=h(["data","ondragend"],function(){}),ng=h(["subchart","show"],!1),og=ng?h(["subchart","size","height"],60):0,pg=h(["color","pattern"],[]),qg=h(["legend","show"],!0),rg=h(["legend","position"],"bottom"),sg=h(["legend","item","onclick"]),tg=h(["legend","equally"],!1),ug=h(["axis","rotated"],!1),vg=h(["axis","x","type"],"indexed"),wg=h(["axis","x","categories"],[]),xg=h(["axis","x","tick","centered"],!1),yg=h(["axis","x","tick","format"]),zg=h(["axis","x","tick","culling"],{}),Ag=h(["axis","x","tick","culling","max"],"categorized"===vg?1/0:10),Bg=h(["axis","x","tick","count"]),Cg=h(["axis","x","tick","fit"],!1),Dg=h(["axis","x","max"]),Eg=h(["axis","x","min"]),Fg=h(["axis","x","default"]),Gg=h(["axis","x","label"],{}),Hg=h(["axis","y","show"],!0),Ig=h(["axis","y","max"]),Jg=h(["axis","y","min"]),Kg=h(["axis","y","center"]),Lg=h(["axis","y","label"],{}),Mg=h(["axis","y","inner"],!1),Ng=h(["axis","y","tick","format"]),Og=h(["axis","y","padding"]),Pg=h(["axis","y","ticks"],10),Qg=h(["axis","y2","show"],!1),Rg=h(["axis","y2","max"]),Sg=h(["axis","y2","min"]),Tg=h(["axis","y2","center"]),Ug=h(["axis","y2","label"],{}),Vg=h(["axis","y2","inner"],!1),Wg=h(["axis","y2","tick","format"]),Xg=h(["axis","y2","padding"]),Yg=h(["axis","y2","ticks"],10),Zg=h(["grid","x","show"],!1),$g=h(["grid","x","type"],"tick"),_g=h(["grid","x","lines"],[]),ah=h(["grid","y","show"],!1),bh=h(["grid","y","lines"],[]),ch=h(["grid","y","ticks"],10),dh=h(["point","show"],!0),eh=dh?h(["point","r"],2.5):0,fh=h(["point","focus","line","enabled"],!0),gh=h(["point","focus","expand","enabled"],!0),hh=h(["point","focus","expand","r"],gh?4:eh),ih=h(["point","focus","select","r"],8),jh=h(["bar","width"]),kh=h(["bar","width","ratio"],.6),lh=h(["pie","label","show"],!0),mh=h(["pie","label","format"]),nh=h(["pie","onclick"],function(){}),oh=h(["pie","onmouseover"],function(){}),ph=h(["pie","onmouseout"],function(){}),qh=h(["donut","label","show"],!0),rh=h(["donut","label","format"]),sh=h(["donut","title"],""),th=h(["donut","onclick"],function(){}),uh=h(["donut","onmouseover"],function(){}),vh=h(["donut","onmouseout"],function(){}),wh=h(["regions"],[]),xh=h(["tooltip","show"],!0),yh=h(["tooltip","format","title"]),zh=h(["tooltip","format","value"]),Ah=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=yh?yh:b,l=zh?zh: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+""}),Bh=h(["tooltip","init","show"],!1),Ch=h(["tooltip","init","x"],0),Dh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Eh=("string"==typeof Xe?Xe.replace("#",""):Xe.id)+"-clip",Fh=Eh+"-xaxis",Gh=Eh+"-yaxis",Hh=i(Eh),Ih=i(Ih),Jh=i(Jh),Kh="timeseries"===vg,Lh="categorized"===vg,Mh=!Kh&&(Rf||Zd(Sf)),Nh=null,Oh=!1,Ph=!1,Qh=!1,Rh=Ud(bg,pg),Sh=function(){var a=[[Ue.time.format("%Y/%-m/%-d"),function(){return!0}],[Ue.time.format("%-m/%-d"),function(a){return a.getMonth()}],[Ue.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ue.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ue.time.format("%I %p"),function(a){return a.getHours()}],[Ue.time.format("%I:%M"),function(a){return a.getMinutes()}],[Ue.time.format(":%S"),function(a){return a.getSeconds()}],[Ue.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)}}(),Th=[],Uh=ug?"left":"bottom",Vh=ug?Mg?"top":"bottom":Mg?"right":"left",Wh=ug?Vg?"bottom":"top":Vg?"left":"right",Xh=ug?"left":"bottom",Yh={main:function(){return"translate("+gf.left+","+gf.top+")"},context:function(){return"translate("+hf.left+","+hf.top+")"},legend:function(){return"translate("+jf.left+","+jf.top+")"},x:function(){return"translate(0,"+(ug?0:mf)+")"},y:function(){return"translate(0,"+(ug?mf:0)+")"},y2:function(){return"translate("+(ug?0:kf)+","+(ug?1:0)+")"},subx:function(){return"translate(0,"+(ug?0:nf)+")"},arc:function(){return"translate("+kf/2+","+mf/2+")"}},Zh="right"===rg,$h=0,_h=0,ai=0,bi=30,ci=30,di=5;yf=Ue.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var ei,fi=function(){var a=Ue.svg.line().x(ug?function(a){return V(a.id)(a.value)}:gd).y(ug?gd:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=he(b.values);return Kd(b)?(a.interpolate(Ld(b)?"cardinal":"linear"),ag[b.id]?te(e,Hf,V(b.id),ag[b.id]):a(e)):(c=Hf(e[0].x),d=V(b.id)(e[0].value),ug?"M "+d+" "+c:"M "+c+" "+d)}}(),gi=function(){var a;return a=ug?Ue.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(gd):Ue.svg.area().x(gd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=he(b.values);return Ed([b],"area")||Ed([b],"area-spline")?(a.interpolate(Ld(b)?"cardinal":"linear"),a(e)):(c=Hf(e[0].x),d=V(b.id)(e[0].value),ug?"M "+d+" "+c:"M "+c+" "+d)}}(),hi=function(){var a=Ue.svg.line().x(ug?function(a){return W(a.id)(a.value)}:jd).y(ug?jd:function(a){return W(a.id)(a.value)});return function(b){var c=he(b.values);return Kd(b)?a(c):"M "+Kf(c[0].x)+" "+W(b.id)(c[0].value)}}(),ii=function(){};ei=Ue.svg.brush().on("brush",Ce),ei.update=function(){return mi&&mi.select("."+f.brush).call(this),this},ei.scale=function(a){return ug?this.y(a):this.x(a)},af&&(ii=Ue.behavior.zoom().on("zoomstart",function(){ii.altDomain=Ue.event.sourceEvent.altKey?Hf.orgDomain():null}).on("zoom",af?De:null),ii.scale=function(a){return ug?this.y(a):this.x(a)},ii.orgScaleExtent=function(){var a=bf?bf:[1,10];return[a[0],Math.max(tc()/a[1],a[1])]},ii.updateScaleExtent=function(){var a=$b(Hf.orgDomain())/$b(qi),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var ji,ki,li,mi,ni,oi,pi,qi,ri,si={};if(Ve.focus=function(a){function b(a){zc(a).transition().duration(100).style("opacity",1)}var c=ji.selectAll(Yc(a)),d=c.filter(Qe),e=c.filter(Re);Ve.revert(),Ve.defocus(),b(d.classed(f.focused,!0)),b(e),Jd(Ve.data.targets)&&Kb(a,!0),Me(a)},Ve.defocus=function(a){function b(a){zc(a).transition().duration(100).style("opacity",.3)}var c=ji.selectAll(Yc(a)),d=c.filter(Qe),e=c.filter(Re);Ve.revert(),b(d.classed(f.focused,!1)),b(e),Jd(Ve.data.targets)&&Lb(a),Ne(a)},Ve.revert=function(a){function b(a){zc(a).transition().duration(100).style("opacity",1)}var c=ji.selectAll(Yc(a)),d=c.filter(Qe),e=c.filter(Re);b(d.classed(f.focused,!1)),b(e),Jd(Ve.data.targets)&&Lb(a),Oe()},Ve.show=function(a){Dc(a),ji.selectAll(Yc(a)).transition().style("opacity",1),Be({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!1})},Ve.hide=function(a){Cc(a),ji.selectAll(Yc(a)).transition().style("opacity",0),Be({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!1})},Ve.toggle=function(a){yc(a)?Ve.hide(a):Ve.show(a)},Ve.unzoom=function(){ei.clear().update(),Be({withUpdateXDomain:!0})},Ve.load=function(a){return a.xs&&ic(a.xs),"categories"in a&&Lh&&(wg=a.categories,Nf.categories(wg)),"cacheIds"in a&&_b(a.cacheIds)?void Ie(bc(a.cacheIds),a.done):void("unload"in a?Ke("string"==typeof a.unload?[a.unload]:"boolean"==typeof a.unload&&a.unload?vc():a.unload,function(){Je(a)}):Je(a))},Ve.unload=function(a){Ke(a?"string"==typeof a?[a]:a:vc(),function(){Be({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},Ve.selected=function(a){return Ue.merge(li.selectAll("."+f.shapes+Xc(a)).selectAll("."+f.shape).filter(function(){return Ue.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},Ve.select=function(a,b,c){cg&&li.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=Ue.select(this),i="circle"===this.nodeName?be:ee,j="circle"===this.nodeName?ce:fe,k=dg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?eg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},Ve.unselect=function(a,b){cg&&li.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=Ue.select(this),g="circle"===this.nodeName?ce:fe,h=dg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&eg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},Ve.toLine=function(a){Te(a,"line")},Ve.toSpline=function(a){Te(a,"spline")},Ve.toBar=function(a){Te(a,"bar")},Ve.toScatter=function(a){Te(a,"scatter")},Ve.toArea=function(a){Te(a,"area")},Ve.toAreaSpline=function(a){Te(a,"area-spline")},Ve.toPie=function(a){Te(a,"pie",{withTransform:!0})},Ve.toDonut=function(a){Te(a,"donut",{withTransform:!0})},Ve.groups=function(a){return c(a)?Wf:(Wf=a,Be(),Wf)},Ve.xgrids=function(a){return a?(_g=a,Be(),_g):_g},Ve.xgrids.add=function(a){return a?Ve.xgrids(_g.concat(a)):void 0},Ve.xgrids.remove=function(a){var b=Se(a);return Ve.xgrids(_g.filter(b))},Ve.ygrids=function(a){return a?(bh=a,Be(),bh):bh},Ve.ygrids.add=function(a){return a?Ve.ygrids(bh.concat(a)):void 0},Ve.ygrids.remove=function(a){var b=Se(a);return Ve.ygrids(bh.filter(b))},Ve.regions=function(a){return c(a)?wh:(wh=a,Be(),wh)},Ve.regions.add=function(a){return c(a)?wh:(wh=wh.concat(a),Be(),wh)},Ve.regions.remove=function(a,c){var e=[].concat(a);return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;ji.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),wh=wh.filter(function(b){return b.classes.indexOf(a)<0})}),wh},Ve.data.get=function(a){var b=Ve.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Ve.data.getAsTarget=function(a){var b=xc(function(b){return b.id===a});return b.length>0?b[0]:void 0},Ve.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Vf[b]=a[b]}),Pe(Ve.data.targets,{withTransition:!0}),Vf):Vf},Ve.x=function(a){return arguments.length&&(kc(Ve.data.targets,a),Be({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ve.data.x},Ve.xs=function(a){return arguments.length&&(lc(Ve.data.targets,a),Be({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ve.data.x},Ve.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},Ve.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Ig=+a.y),b(a.y2)&&(Rg=+a.y2)):Ig=Rg=+a,Be())},Ve.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Jg=+a.y),b(a.y2)&&(Sg=+a.y2)):Jg=Sg=+a,Be())},Ve.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Ve.axis.max(a.max),"undefined"!=typeof a.min&&Ve.axis.min(a.min))},Ve.resize=function(a){Ye=a?a.width:null,Ze=a?a.height:null,Ge({withLegend:!0,withTransition:!1})},Ve.destroy=function(){Ve.data.targets=void 0,Ve.data.x={},pi.html(""),a.onresize=null},"url"in e.data)Ue.csv(e.data.url,function(a,b){ue(b)});else if("rows"in e.data)ue(nc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");ue(oc(e.data.columns))}return Ve},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 7a2da29482f2c79c6e097669595c4375e3c10670 Mon Sep 17 00:00:00 2001 From: Josh Purvis Date: Sat, 5 Apr 2014 05:35:10 -0400 Subject: [PATCH 003/178] Add conditional colors with callback. Implements #120 --- c3.js | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/c3.js b/c3.js index f649430..7dcdea3 100644 --- a/c3.js +++ b/c3.js @@ -1916,9 +1916,14 @@ colors = _colors, pattern = notEmpty(_pattern) ? _pattern : ['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd', '#8c564b', '#e377c2', '#7f7f7f', '#bcbd22', '#17becf']; //same as d3.scale.category10() - return function (id) { + return function (d) { + var id = d.id || d; + + // if callback function is provided + if (_colors[id] instanceof Function) { return colors[id](d); } + // if specified, choose that color - if (id in colors) { return _colors[id]; } + if (id in colors) { return colors[id]; } // if not specified, choose from pattern if (ids.indexOf(id) === -1) { @@ -1998,7 +2003,7 @@ .attr("class", function () { return generateClass(CLASS.selectedCircle, i); }) .attr("cx", __axis_rotated ? circleY : circleX) .attr("cy", __axis_rotated ? circleX : circleY) - .attr("stroke", function () { return color(d.id); }) + .attr("stroke", function () { return color(d); }) .attr("r", __point_select_r * 1.4) .transition().duration(100) .attr("r", __point_select_r); @@ -2016,11 +2021,11 @@ function selectBar(target, d) { __data_onselected(d, target.node()); - target.transition().duration(100).style("fill", function () { return d3.rgb(color(d.id)).darker(1); }); + target.transition().duration(100).style("fill", function () { return d3.rgb(color(d)).darker(1); }); } function unselectBar(target, d) { __data_onunselected(d, target.node()); - target.transition().duration(100).style("fill", function () { return color(d.id); }); + target.transition().duration(100).style("fill", function () { return color(d); }); } function toggleBar(selected, target, d, i) { selected ? selectBar(target, d, i) : unselectBar(target, d, i); @@ -3056,7 +3061,7 @@ .attr('d', drawBar) .style("stroke", 'none') .style("opacity", 0) - .style("fill", function (d) { return color(d.id); }) + .style("fill", function (d) { return color(d); }) .attr("class", classBar); mainBar .style("opacity", initialOpacity) @@ -3166,7 +3171,7 @@ contextBar.enter().append('path') .attr('d', drawBarOnSub) .style("stroke", 'none') - .style("fill", function (d) { return color(d.id); }) + .style("fill", function (d) { return color(d); }) .attr("class", classBar); contextBar .style("opacity", initialOpacity) @@ -3347,7 +3352,7 @@ .style("pointer-events", "none"); mainTextEnter.append('g') .attr('class', classTexts) - .style("fill", function (d) { return color(d.id); }); + .style("fill", function (d) { return color(d); }); //-- Bar --// mainBarUpdate = main.select('.' + CLASS.chartBars) @@ -3359,7 +3364,7 @@ // Bars for each data mainBarEnter.append('g') .attr("class", classBars) - .style("fill", function (d) { return color(d.id); }) + .style("fill", function (d) { return color(d); }) .style("stroke", "none") .style("cursor", function (d) { return __data_selection_isselectable(d) ? "pointer" : null; }); @@ -3374,18 +3379,18 @@ mainLineEnter.append("path") .attr("class", classLine) .style("opacity", 0) - .style("stroke", function (d) { return color(d.id); }); + .style("stroke", function (d) { return color(d); }); // Areas mainLineEnter.append("path") .attr("class", classArea) .style("opacity", function () { orgAreaOpacity = +d3.select(this).style('opacity'); return 0; }) - .style("fill", function (d) { return color(d.id); }); + .style("fill", function (d) { return color(d); }); // Circles for each data point on lines mainLineEnter.append('g') .attr("class", function (d) { return generateClass(CLASS.selectedCircles, d.id); }); mainLineEnter.append('g') .attr("class", classCircles) - .style("fill", function (d) { return color(d.id); }) + .style("fill", function (d) { return color(d); }) .style("cursor", function (d) { return __data_selection_isselectable(d) ? "pointer" : null; }); // Update date for selected circles targets.forEach(function (t) { @@ -3405,7 +3410,7 @@ mainPieEnter.append("path") .attr("class", classArc) .style("opacity", 0) - .style("fill", function (d) { return color(d.data.id); }) + .style("fill", function (d) { return color(d.data); }) .style("cursor", function (d) { return __data_selection_isselectable(d) ? "pointer" : null; }) .each(function (d) { this._current = d; }) .on('mouseover', function (d, i) { @@ -3449,7 +3454,7 @@ // Bars for each data contextBarEnter.append('g') .attr("class", classBars) - .style("fill", function (d) { return color(d.id); }); + .style("fill", function (d) { return color(d); }); //-- Line --// contextLineUpdate = context.select('.' + CLASS.chartLines) @@ -3461,7 +3466,7 @@ contextLineEnter.append("path") .attr("class", classLine) .style("opacity", 0) - .style("stroke", function (d) { return color(d.id); }); + .style("stroke", function (d) { return color(d); }); } /*-- Show --*/ From 9beb0d4a70166986e2364874f61acd986adf1886 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Sat, 5 Apr 2014 21:09:05 +0900 Subject: [PATCH 004/178] Fix same x on multiple xs - #125 --- c3.js | 14 +++++++++++--- c3.min.js | 4 ++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/c3.js b/c3.js index 6d9f87d..ded8642 100644 --- a/c3.js +++ b/c3.js @@ -1677,6 +1677,9 @@ }); return closest; } + function filterSameX(targets, x) { + return d3.merge(targets.map(function (t) { return t.values; })).filter(function (v) { return v.x === x; }); + } function getPathBox(path) { var box = path.getBoundingClientRect(), @@ -1981,7 +1984,8 @@ } function dist(data, pos) { - return Math.pow(x(data.x) - pos[0], 2) + Math.pow(y(data.value) - pos[1], 2); + var yScale = getAxisId(data.id) === 'y' ? y : y2; + return Math.pow(x(data.x) - pos[0], 2) + Math.pow(yScale(data.value) - pos[1], 2); } function endall(transition, callback) { @@ -2695,7 +2699,7 @@ unexpandCircles(); }) .on('mousemove', function () { - var mouse, closest, selectedData; + var mouse, closest, sameXData, selectedData; if (dragging) { return; } // do nothing when dragging if (hasArcType(c3.data.targets)) { return; } @@ -2703,8 +2707,12 @@ mouse = d3.mouse(this); closest = findClosestFromTargets(c3.data.targets, mouse); + sameXData = filterSameX(c3.data.targets, closest.x); + // show tooltip when cursor is close to some point - selectedData = [addName(closest)]; + selectedData = sameXData.map(function (d) { + return addName(d); + }); showTooltip(selectedData, mouse); // expand points diff --git a/c3.min.js b/c3.min.js index 466d20b..2813586 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;ckf&&(kf=0),0>mf&&(mf=0),hf={top:ug?gf.top:pf-og-(Zh?0:qf),right:0/0,bottom:20+(Zh?0:qf),left:ug?bi:gf.left},lf=ug?gf.left-bi-ci:kf,nf=ug?mf:pf-hf.top-hf.bottom,0>lf&&(lf=0),0>nf&&(nf=0),jf={top:Zh?0:pf-qf,right:0/0,bottom:0,left:Zh?of-rf:0},p(),Zh&&Jd(Ve.data.targets)&&(jf.left=kf/2+tf)}function o(){li.select("line."+f.xgridFocus).attr("x1",ug?0:-10).attr("x2",ug?kf:-10).attr("y1",ug?-10:gf.top).attr("y2",ug?-10:mf)}function p(){tf=mf/2,sf=.95*tf,uf=Id(Ve.data.targets)?.6*sf:0}function q(){var a=ug?f.axisX:f.axisY,b=Ue.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Ue.select(Xe).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Ye?Ye:x()}function s(){var a=Ze?Ze:y();return a>0?a:320}function t(){return Jd(Ve.data.targets)?0:$e?$e:ug||!Hg||Mg?1:v("y")}function u(){var a=1;return Jd(Ve.data.targets)?0:_e?_e:Zh?rf+(Qg&&!ug?v("y2"):a):Qg?Vg||ug?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||Hg?"y2"!==a||Qg?(gb(a).isInner?30:40)+("y2"===a?-10:0):di:qg&&!Zh?10:1}function x(){return+Ue.select(Xe).style("width").replace("px","")}function y(){return+Ue.select(Xe).style("height").replace("px","")}function z(a){return a?-5:-(gf.left-1)}function A(a){return a?-20:-1}function B(){return z(!ug)}function C(){return A(!ug)}function D(){return z(ug)}function E(){return A(ug)}function F(a){return a?kf+2+4:gf.left+20}function G(a){return a?80:mf+2}function H(){return F(!ug)}function I(){return G(!ug)}function J(){return F(ug)}function K(){return G(ug)}function L(){var a=ug?mf:kf,b=tc(),c=Vb()*(Fd(Ve.data.targets)?(b-(Lh?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){$h=a}function N(a){_h=a}function O(a){ai=a}function P(){return qg?Zh?_h*($h+1):of:0}function Q(){return qg?Zh?pf:ai*($h+1):0}function R(){var a,b=!Hf;zf=ug?1:0,Af=ug?mf:kf,Bf=ug?0:mf,Cf=ug?kf:1,Df=zf,Ef=Af,Ff=ug?0:nf,Gf=ug?lf:1,Hf=T(zf,Af,b?void 0:Hf.domain(),function(){return Nf.tickOffset()}),If=U(Bf,Cf),Jf=U(Bf,Cf),Kf=T(zf,Af,qi,function(a){return a%1?0:Qf.tickOffset()}),Lf=U(Ff,Gf),Mf=U(Ff,Gf),a=$(),Nf=X(Hf,Uh,a),Qf=X(Kf,Xh,a),Of=Y(If,Vh,Ng,Pg),Pf=Y(Jf,Wh,Wg,Yg),b||(ei.scale(Kf),af&&ii.scale(Hf)),S()}function S(){vf=Db(),wf=Eb(),xf=Eb(.98)}function T(a,b,e,f){var g=(Kh?Ue.time.scale():Ue.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),Lh){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return Ue.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?Jf:If}function W(a){return"y2"===Z(a)?Mf:Lf}function X(a,b,c){var d=(Lh?Bb():Ue.svg.axis()).scale(a).orient(b);return d.tickFormat(c),Lh?d.tickCentered(xg):d.tickOffset=function(){var a=ug?mf:kf;return a*Vb()/tc()/2},Lh&&d.categories(wg),d}function Y(a,b,c,d){return Ue.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Xf?Xf[a]:"y"}function $(){var a=Kh?Sh:Lh?Ic:function(a){return 0>a?a.toFixed(0):a};return yg&&("function"==typeof yg?a=yg:Kh&&(a=function(a){return Ue.time.format(yg)(a)})),a}function _(a){var b;return"y"===a?b=Lg:"y2"===a?b=Ug:"x"===a&&(b=Gg),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Lg=b:"y2"===a?Ug=b:"x"===a&&(Gg=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",ug?"inner-top":"inner-right")}function eb(){return cb("y",ug?"inner-right":"inner-top")}function fb(){return cb("y2",ug?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?kf/2:kf:b.isBottom?-mf:b.isMiddle?-mf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!ug,db())}function ob(){return kb(ug,eb())}function pb(){return kb(ug,fb())}function qb(){return lb(!ug,db())}function rb(){return lb(ug,eb())}function sb(){return lb(ug,fb())}function tb(){var a=db();return ug?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return ug?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return ug?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!ug,db())}function xb(){return mb(ug,eb())}function yb(){return mb(ug,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return Ue.selectAll("."+c+" .tick text").each(function(){var a=this.getBBox();bb?20:b}function Ab(){li.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),li.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),li.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=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]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return Ue.min(Object.keys(i).map(function(a){return Ue.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=vc(a),i=Ec(a);if(Wf.length>0)for(g=Hc(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 Ue.max(Object.keys(i).map(function(a){return Ue.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Sg:Jg,n="y2"===c?Rg:Ig,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?Tg:Kg,r=bd()&&ug;return 0===l.length?"y2"===c?Jf.domain():If.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&&Og&&(f=b(Og.top)?Og.top:e,g=b(Og.bottom)?Og.bottom:e),"y2"===c&&Xg&&(f=b(Xg.top)?Xg.top:e,g=b(Xg.bottom)?Xg.bottom:e),r&&(i=cd(o,p),j=$b(If.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]))),Fd(l)&&!Gc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(qi),c=$b(Hf.domain());return a||0===c?1:b/c}function Wb(a){return Eg?Eg:Ue.min(a,function(a){return Ue.min(a.values,function(a){return a.x})})}function Xb(a){return Dg?Dg:Ue.max(a,function(a){return Ue.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return Lh?d=0:Fd(a)?(c=tc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=Kh?new Date(c.getTime()-e):c-e,g=Kh?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return Rf&&a===Rf||Zd(Sf)&&$d(Sf,a)}function fc(a){return!ec(a)}function gc(a){return Rf?Rf:Zd(Sf)?Sf[a]:null}function hc(a,b){return a in Ve.data.x&&Ve.data.x[a]&&Ve.data.x[a][b]?Ve.data.x[a][b]:b}function ic(a){Object.keys(a).forEach(function(b){Sf[b]=a[b]})}function jc(a){var b;return a&&(b=Vf[a.id],a.name=b?b:a.id),a}function kc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=mc(b[d],a.id,d)}),Ve.data.x[a.id]=b})}function lc(a,b){a.forEach(function(a){b[a.id]&&kc([a],b[a.id])})}function mc(a,b,c){var d;return d=Kh?a?a instanceof Date?a:Vd(a):Vd(hc(b,c)):Mh&&!Lh?a?+a:hc(b,c):c}function nc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0&&(Ve.data.x[b]=a.map(function(a){return a[c]})):Ve.data.x[b]=a.map(function(a,b){return b})}),c.forEach(function(a){if(!Ve.data.x[a])throw new Error('x is not defined for id = "'+a+'".')}),b=c.map(function(b,c){var d=Uf(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=mc(g,b,e);return Mh&&Lh&&0===c&&g&&(0===e&&(wg=[]),wg.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++})}),Yf&&Dd(vc(b).filter(function(a){return!(a in Zf)}),Yf),b.forEach(function(a){ac(a.id_org,a)}),b}function qc(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 rc(a){return a>0&&Ve.data.targets[0].values[a-1]?Ve.data.targets[0].values[a-1].x:void 0}function sc(a){return a1?Ve.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?Ve.data.targets[0]:null,a}function vc(a){return a=c(a)?Ve.data.targets:a,a.map(function(a){return a.id})}function wc(a){var b,c=vc();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(Kh?new Date(h):h);i.push(d)}return i}function Cc(a){Th=Th.concat(a)}function Dc(a){Th=Th.filter(function(b){return a.indexOf(b)<0})}function Ec(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Fc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Hc(a){return Fc(a,function(a){return a>0})}function Ic(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(kd(a,f))),a[g].x&&(e=e.concat(kd(a,g))),nd(e,b)):ld(a,b,f,g)}function md(a,b){var c;return c=a.map(function(a){return ld(a.values,b)}),nd(c,b)}function nd(a,b){var c,d;return a.forEach(function(a){var e=_d(a,b);(c>e||!c)&&(c=e,d=a)}),d}function od(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 pd(){return _f&&"desc"===_f.toLowerCase()}function qd(){return _f&&"asc"===_f.toLowerCase()}function rd(a){var b=qd(),c=pd();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 sd(a,c){var d,e,f,g,h,i,j,k=Jd(Ve.data.targets),l=k?ed:dd,m=a.filter(function(a){return a&&b(a.value)});xh&&0!==m.length&&(oi.html(Ah(a,$(),l,Rh)).style("display","block"),d=oi.property("offsetWidth"),e=oi.property("offsetHeight"),k?(g=kf/2+c[0],i=mf/2+c[1]+20):(ug?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Hf(m[0].x)+20):(f=q(),g=f+t()+Hf(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),oi.style("top",i+"px").style("left",g+"px"))}function td(){oi.style("display","none")}function ud(a){var c=a.filter(function(a){return a&&b(a.value)});xh&&(Gd(Ve.data.targets)||Jd(Ve.data.targets)||li.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(ug?"y1":"x1",gd).attr(ug?"y2":"x2",gd))}function vd(){li.select("line."+f.xgridFocus).style("visibility","hidden")}function wd(a){return a.x||0===a.x?Hf(a.x):null}function xd(a){return V(a.id)(a.value)}function yd(){var a,b,d={},e=0;return zc(xc(Md)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Cd(a,b){return jh?jh:b?2*a.tickOffset()*kh/b:0}function Dd(a,b){var c,d=a?"string"==typeof a?[a]:a:vc();for(c=0;c0}function $d(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(Hf(a.x)-b[0],2)+Math.pow(If(a.value)-b[1],2)}function ae(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function be(a,b,c){jg(b,a.node()),li.select("."+f.selectedCircles+Xc(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Jc(f.selectedCircle,c)}).attr("cx",ug?xd:wd).attr("cy",ug?wd:xd).attr("stroke",function(){return Rh(b.id)}).attr("r",1.4*ih).transition().duration(100).attr("r",ih)}function ce(a,b,c){kg(b,a.node()),li.select("."+f.selectedCircles+Xc(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function de(a,b,c,d){a?be(b,c,d):ce(b,c,d)}function ee(a,b){jg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ue.rgb(Rh(b.id)).darker(1)})}function fe(a,b){kg(b,a.node()),a.transition().duration(100).style("fill",function(){return Rh(b.id)})}function ge(a,b,c,d){a?ee(b,c,d):fe(b,c,d)}function he(a){return a.filter(function(a){return b(a.value)})}function ie(a,c){return(c?li.selectAll("."+f.circles+Xc(c)):li).selectAll("."+f.circle+(b(a)?"-"+a:""))}function je(a,b){ie(a,b).classed(f.EXPANDED,!0).attr("r",hh)}function ke(a){ie(a).filter(function(){return Ue.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",eh)}function le(a){return li.selectAll("."+f.bar+(b(a)?"-"+a:""))}function me(a){le(a).classed(f.EXPANDED,!0)}function ne(a){le(a).classed(f.EXPANDED,!1)}function oe(a,b){var c=se(a,b);return function(a,b){var d=c(a,b),e=ug?1:0,f=ug?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function pe(a,b){var c=se(a,!1),d=b?qe:re;return function(a,b){return d(c(a,b),a,this)}}function qe(a,b){var c;return ug?(c=Md(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function re(a,b,c){var d=c.getBBox();return ug?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:Md(b)?-3:-6)}function se(a,b){var c=a.__max__+1,d=Cd(Nf,c),e=zd(d,c,a,!!b),f=Ad(!!b),g=Bd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return ug&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function te(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 ue(b){var c,d,e;if(pi=Ue.select(Xe),pi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(pi.html(""),pi.classed("c3",!0),Ve.data.x={},Ve.data.targets=pc(b),n(),R(),Hf.domain(Ue.extent(Zb(Ve.data.targets))),If.domain(Ub(Ve.data.targets,"y")),Jf.domain(Ub(Ve.data.targets,"y2")),Kf.domain(Hf.domain()),Lf.domain(If.domain()),Mf.domain(Jf.domain()),qi=Hf.domain(),ei.scale(Kf),af&&ii.scale(Hf),ji=pi.append("svg").attr("width",kf+gf.left+gf.right).attr("height",mf+gf.top+gf.bottom).on("mouseenter",df).on("mouseleave",ef),ki=ji.append("defs"),ki.append("clipPath").attr("id",Eh).append("rect").attr("width",kf).attr("height",mf),ki.append("clipPath").attr("id",Fh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),ki.append("clipPath").attr("id",Gh).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),li=ji.append("g").attr("transform",Yh.main),mi=ng?ji.append("g").attr("transform",Yh.context):null,ni=qg?ji.append("g").attr("transform",Yh.legend):null,oi=Ue.select(Xe).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),li.append("g").attr("class",f.axisX).attr("clip-path",ug?"":Ih).attr("transform",Yh.x).append("text").attr("class",f.axisXLabel).attr("transform",ug?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),Hg&&li.append("g").attr("class",f.axisY).attr("clip-path",ug?Jh:"").append("text").attr("class",f.axisYLabel).attr("transform",ug?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),Qg&&li.append("g").attr("class",f.axisY2).attr("transform",Yh.y2).append("text").attr("class",f.axisY2Label).attr("transform",ug?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=li.append("g").attr("clip-path",Hh).attr("class",f.grid),Zg&&d.append("g").attr("class",f.xgrids),Zd(_g)&&d.append("g").attr("class",f.xgridLines),fh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),ah&&d.append("g").attr("class",f.ygrids),Zd(bh)&&d.append("g").attr("class",f.ygridLines),li.append("g").attr("clip-path",Hh).attr("class",f.regions),li.append("g").attr("clip-path",Hh).attr("class",f.chart),c=li.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",af?ug?"ns-resize":"ew-resize":null),li.select("."+f.chart).append("g").attr("class",f.chartBars),li.select("."+f.chart).append("g").attr("class",f.chartLines),li.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Yh.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),li.select("."+f.chart).append("g").attr("class",f.chartTexts),af&&li.insert("rect",cf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",kf).attr("height",mf).style("opacity",0).style("cursor",ug?"ns-resize":"ew-resize").call(ii).on("dblclick.zoom",null),Fg&&ei.extent("function"!=typeof Fg?Fg:Fg(Zb())),ng&&(mi.append("g").attr("clip-path",Hh).attr("class",f.chart),mi.select("."+f.chart).append("g").attr("class",f.chartBars),mi.select("."+f.chart).append("g").attr("class",f.chartLines),mi.append("g").attr("clip-path",Hh).attr("class",f.brush).call(ei).selectAll("rect").attr(ug?"width":"height",ug?lf:nf),mi.append("g").attr("class",f.axisX).attr("transform",Yh.subx).attr("clip-path",ug?"":Ih)),He(Ve.data.targets),ug?li.select("."+f.axisX).style("opacity",0).call(Nf):(li.select("."+f.axisY).style("opacity",0).call(Of),li.select("."+f.axisY2).style("opacity",0).call(Pf)),Ge({withTransform:!0,withLegend:!0,withTransitionForAxis:!1}),Bh){if(Kh&&"string"==typeof Ch){for(Ch=Vd(Ch),e=0;e0){d=[];for(var g in Vf)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=od(this),c=m.x,d=m.y,e=m.width,k=m.height,l=ge,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 ze(a){Jd(Ve.data.targets)||cg&&(Nh=a,li.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Oh=!0,lg())}function Ae(){Jd(Ve.data.targets)||cg&&(li.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),li.selectAll("."+f.shape).classed(f.INCLUDED,!1),Oh=!1,mg())}function Be(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P=yd(),Q=Jd(Ve.data.targets),R=zc(Ve.data.targets);if(0!==R.length){if(a=d(a)?a:{},v=d(a.withY)?a.withY:!0,w=d(a.withSubchart)?a.withSubchart:!0,x=d(a.withTransition)?a.withTransition:!0,A=d(a.withTransform)?a.withTransform:!1,B=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,C=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,D=d(a.withLegend)?a.withLegend:!1,y=d(a.withTransitionForExit)?a.withTransitionForExit:x,z=d(a.withTransitionForAxis)?a.withTransitionForAxis:x,I=x?ff:0,J=y?I:0,K=z?I:0,D&&qg&&Pe(Ve.data.targets,a),C&&(Hf.domain(Ue.extent(Zb(R))),qi=Hf.domain(),af&&ii.scale(Hf).updateScaleExtent(),Kf.domain(Hf.domain()),ei.scale(Kf)),B&&(Hf.domain(ei.empty()?qi:ei.extent()),af&&ii.scale(Hf).updateScaleExtent(),Gd(R)||(M=Bc(Ac(R)),Nf.tickValues(M),Qf.tickValues(M))),If.domain(Ub(R,"y")),Jf.domain(Ub(R,"y2")),li.select("."+f.axisX).style("opacity",Q?0:1).transition().duration(K).call(Nf),li.select("."+f.axisY).style("opacity",Q?0:1).transition().duration(K).call(Of),li.select("."+f.axisY2).style("opacity",Q?0:1).transition().duration(K).call(Pf),B&&zg&&M){for(N=1;N=V;V++)e.push(new Date(V+"-01-01 00:00:00"))}else e=Hf.ticks(10);c=li.select("."+f.xgrids).selectAll("."+f.xgrid).data(e),c.enter().append("line").attr("class",f.xgrid),c.attr("x1",ug?0:function(a){return Hf(a)-Nf.tickOffset()}).attr("x2",ug?kf:function(a){return Hf(a)-Nf.tickOffset()}).attr("y1",ug?function(a){return Hf(a)-Nf.tickOffset()}:gf.top).attr("y2",ug?function(a){return Hf(a)-Nf.tickOffset()}:mf).style("opacity",function(){return+Ue.select(this).attr(ug?"y1":"x1")===(ug?mf:0)?0:1}),c.exit().remove()}Zd(_g)&&(g=li.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",ug?"":"rotate(-90)").attr("dx",ug?0:-gf.top).attr("dy",-5).style("opacity",0),g.select("line").transition().duration(I).attr("x1",ug?0:hd).attr("x2",ug?kf:hd).attr("y1",ug?hd:gf.top).attr("y2",ug?hd:mf).style("opacity",1),g.select("text").transition().duration(I).attr("x",ug?kf:0).attr("y",hd).text(function(a){return a.text}).style("opacity",1),g.exit().transition().duration(I).style("opacity",0).remove()),v&&ah&&(i=li.select("."+f.ygrids).selectAll("."+f.ygrid).data(If.ticks(ch)),i.enter().append("line").attr("class",f.ygrid),i.attr("x1",ug?If:0).attr("x2",ug?If:kf).attr("y1",ug?0:If).attr("y2",ug?mf:If),i.exit().remove()),v&&Zd(bh)&&(j=li.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(bh),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",ug?"rotate(-90)":"").attr("dx",ug?0:-gf.top).attr("dy",-5).style("opacity",0),j.select("line").transition().duration(I).attr("x1",ug?id:0).attr("x2",ug?id:kf).attr("y1",ug?0:id).attr("y2",ug?mf:id).style("opacity",1),j.select("text").transition().duration(I).attr("x",ug?0:kf).attr("y",id).text(function(a){return a.text}).style("opacity",1),j.exit().transition().duration(I).style("opacity",0).remove()),m=li.selectAll("."+f.bars).selectAll("."+f.bar).data(Rd),m.enter().append("path").attr("d",E).style("stroke","none").style("opacity",0).style("fill",function(a){return Rh(a.id)}).attr("class",Rc),m.style("opacity",Zc).transition().duration(I).attr("d",E).style("opacity",1),m.exit().transition().duration(J).style("opacity",0).remove(),p=li.selectAll("."+f.texts).selectAll("."+f.text).data(Td),p.enter().append("text").attr("class",Kc).attr("text-anchor",function(a){return ug?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),p.text(function(a){return fd(a.id)(a.value)}).style("fill-opacity",$c).transition().duration(I).attr("x",G).attr("y",H).style("fill-opacity",ad),p.exit().transition().duration(J).style("fill-opacity",0).remove(),li.selectAll("."+f.line).style("opacity",Zc).transition().duration(I).attr("d",fi).style("opacity",1),li.selectAll("."+f.area).style("opacity",0).transition().duration(I).attr("d",gi).style("opacity",ri),l=li.selectAll("."+f.circles).selectAll("."+f.circle).data(Sd),l.enter().append("circle").attr("class",Pc).style("opacity",0).attr("r",eh),l.style("opacity",Zc).transition().duration(I).style("opacity",_c).attr("cx",ug?xd:wd).attr("cy",ug?wd:xd),l.exit().remove(),li.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",A?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(I).attrTween("d",function(a){var b,c=Cb(a);return c?(b=Ue.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",A?"scale(1)":"").style("opacity",1),li.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(I).text(Jb).style("opacity",function(a){return yc(a.data.id)&&Qd(a.data)?1:0}),li.select("."+f.chartArcsTitle).style("opacity",Id(Ve.data.targets)?1:0),ng&&(null!==Ue.event&&"zoom"===Ue.event.type&&ei.extent(Hf.orgDomain()).update(),w&&(mi.select("."+f.axisX).style("opacity",Q?0:1).transition().duration(I).call(Qf),ei.empty()||ei.extent(Hf.orgDomain()).update(),F=oe(P,!0),q=mi.selectAll("."+f.bars).selectAll("."+f.bar).data(Rd),q.enter().append("path").attr("d",F).style("stroke","none").style("fill",function(a){return Rh(a.id)}).attr("class",Rc),q.style("opacity",Zc).transition().duration(I).attr("d",F).style("opacity",1),q.exit().transition().duration(I).style("opacity",0).remove(),mi.selectAll("."+f.line).style("opacity",Zc).transition().duration(I).attr("d",hi).style("opacity",1))),li.selectAll("."+f.selectedCircles).filter(function(a){return Md(a)}).selectAll("circle").remove(),li.selectAll("."+f.selectedCircle).transition().duration(I).attr("cx",ug?xd:wd).attr("cy",ug?wd:xd),Zd(Sf)?(r=li.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),we(r.enter()),r.attr("x",0).attr("y",0).attr("width",kf).attr("height",mf)):(Mh&&!Lh?(u=function(a,b){var c=rc(b),d=sc(b),e=Ve.data.x[a.id][b];return(Hf(d?d:e+50)-Hf(c?c:e-50))/2},t=function(a,b){var c=rc(b),d=Ve.data.x[a.id][b];return(Hf(d)+Hf(c?c:d-50))/2}):(u=L(),t=function(a){return Hf(a.x)-u/2}),s=uc(),li.select("."+f.eventRects).datum(s?s.values:[]),r=li.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),ve(r.enter()),r.attr("class",Wc).attr("x",ug?0:t).attr("y",ug?t:0).attr("width",ug?kf:u).attr("height",ug?u:mf),r.exit().remove()),n=li.select("."+f.regions).selectAll("rect."+f.region).data(wh),n.enter().append("rect").style("fill-opacity",0),n.attr("class",Vc).attr("x",ug?0:cc).attr("y",ug?cc:gf.top).attr("width",ug?kf:dc).attr("height",ug?dc:mf).transition().duration(I).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),n.exit().transition().duration(I).style("fill-opacity",0).remove(),vc().forEach(function(a){si[a]=!0})}}function Ce(){Be({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function De(){return"mousemove"===Ue.event.sourceEvent.type&&ii.altDomain?(Hf.domain(ii.altDomain),void ii.scale(Hf).updateScaleExtent()):(Lh&&Hf.orgDomain()[0]===qi[0]&&Hf.domain([qi[0]-1e-10,Hf.orgDomain()[1]]),Be({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Ue.event.sourceEvent.type&&(Ph=!0)))}function Ee(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Fe(){ji.attr("width",of).attr("height",pf),ji.select("#"+Eh).select("rect").attr("width",kf).attr("height",mf),ji.select("#"+Fh).select("rect").attr("width",H),ji.select("#"+Gh).select("rect").attr("width",J),ji.select("."+f.zoomRect).attr("width",kf).attr("height",mf)}function Ge(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(),R(),Fe(),m(a.withTransition),Be(a)}function He(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=li.select("."+f.chartTexts).selectAll("."+f.chartText).data(a),j=i.enter().append("g").attr("class",function(a){return f.chartText+Jc(f.target,a.id)}).style("pointer-events","none"),j.append("g").attr("class",Lc).style("fill",function(a){return Rh(a.id)}),e=li.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),d=e.enter().append("g").attr("class",function(a){return f.chartBar+Jc(f.target,a.id)}).style("pointer-events","none"),d.append("g").attr("class",Sc).style("fill",function(a){return Rh(a.id)}).style("stroke","none").style("cursor",function(a){return eg(a)?"pointer":null}),c=li.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),b=c.enter().append("g").attr("class",function(a){return f.chartLine+Jc(f.target,a.id)}).style("pointer-events","none"),b.append("path").attr("class",Oc).style("opacity",0).style("stroke",function(a){return Rh(a.id)}),b.append("path").attr("class",Uc).style("opacity",function(){return ri=+Ue.select(this).style("opacity"),0}).style("fill",function(a){return Rh(a.id)}),b.append("g").attr("class",function(a){return Jc(f.selectedCircles,a.id)}),b.append("g").attr("class",Qc).style("fill",function(a){return Rh(a.id)}).style("cursor",function(a){return eg(a)?"pointer":null}),a.forEach(function(a){li.selectAll("."+f.selectedCircles+Xc(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=li.select("."+f.chartArcs).selectAll("."+f.chartArc).data(yf(a)),g=h.enter().append("g").attr("class",function(a){return f.chartArc+Jc(f.target,a.data.id)}),g.append("path").attr("class",Tc).style("opacity",0).style("fill",function(a){return Rh(a.data.id)}).style("cursor",function(a){return eg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),Me(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];sd(c,Ue.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),Oe(),td(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),ng&&(n=mi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),m=n.enter().append("g").attr("class",function(a){return f.chartBar+Jc(f.target,a.id)}),m.append("g").attr("class",Sc).style("fill",function(a){return Rh(a.id)}),l=mi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),k=l.enter().append("g").attr("class",function(a){return f.chartLine+Jc(f.target,a.id)}),k.append("path").attr("class",Oc).style("opacity",0).style("stroke",function(a){return Rh(a.id)})),ji.selectAll("."+f.target).filter(function(a){return yc(a.id)}).transition().style("opacity",1)}function Ie(a,b){Ve.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=Zh?i:h,k=Zh?qf:rf;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=Zh?u:t,tg?(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=vc(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,Zh?(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=ni.selectAll("."+f.legendItem).data(q).enter().append("g").attr("class",function(a){return Jc(f.legendItem,a)}).style("cursor","pointer").on("click",function(a){"function"==typeof sg?sg(a):Ve.toggle(a)}).on("mouseover",function(a){Ve.focus(a)}).on("mouseout",function(){Ve.revert()}),g.append("text").text(function(a){return d(Vf[a])?Vf[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Zh?i:-200).attr("y",Zh?-200:l),g.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Zh?j:-200).attr("y",Zh?-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 Rh(a)}).attr("x",Zh?i:-200).attr("y",Zh?-200:k).attr("width",10).attr("height",10),ni.selectAll("text").data(q).text(function(a){return d(Vf[a])?Vf[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",i).attr("y",l),ni.selectAll("rect."+f.legendItemEvent).data(q).transition().duration(p?250:0).attr("x",j).attr("y",o),ni.selectAll("rect."+f.legendItemTile).data(q).transition().duration(p?250:0).attr("x",h).attr("y",k),N(t),O(u),M(C),n(),R(),Fe(),m(!1)}function Qe(a){return wc(a.id)}function Re(a){return"data"in a&&wc(a.data.id)}function Se(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 Te(a,b,c){var d=!Jd(Ve.data.targets);Dd(a,b),Ge(c?c:{withTransitionForAxis:d})}var Ue=a.d3?a.d3:a.require?a.require("d3"):void 0,Ve={data:{},axis:{}},We={},Xe=h(["bindto"],"#chart"),Ye=h(["size","width"]),Ze=h(["size","height"]),$e=h(["padding","left"]),_e=h(["padding","right"]),af=h(["zoom","enabled"],!1),bf=h(["zoom","extent"]),cf=h(["zoom","privileged"],!1),df=h(["onenter"],function(){}),ef=h(["onleave"],function(){}),ff=h(["transition","duration"],350);g("data","data is required in config");var 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,Rf=h(["data","x"]),Sf=h(["data","xs"],{}),Tf=h(["data","x_format"]),Uf=h(["data","id_converter"],function(a){return a}),Vf=h(["data","names"],{}),Wf=h(["data","groups"],[]),Xf=h(["data","axes"],{}),Yf=h(["data","type"]),Zf=h(["data","types"],{}),$f=h(["data","labels"],{}),_f=h(["data","order"]),ag=h(["data","regions"],{}),bg=h(["data","colors"],{}),cg=h(["data","selection","enabled"],!1),dg=h(["data","selection","grouped"],!1),eg=h(["data","selection","isselectable"],function(){return!0}),fg=h(["data","selection","multiple"],!0),gg=h(["data","onclick"],function(){}),hg=h(["data","onenter"],function(){}),ig=h(["data","onleave"],function(){}),jg=h(["data","onselected"],function(){}),kg=h(["data","onunselected"],function(){}),lg=h(["data","ondragstart"],function(){}),mg=h(["data","ondragend"],function(){}),ng=h(["subchart","show"],!1),og=ng?h(["subchart","size","height"],60):0,pg=h(["color","pattern"],[]),qg=h(["legend","show"],!0),rg=h(["legend","position"],"bottom"),sg=h(["legend","item","onclick"]),tg=h(["legend","equally"],!1),ug=h(["axis","rotated"],!1),vg=h(["axis","x","type"],"indexed"),wg=h(["axis","x","categories"],[]),xg=h(["axis","x","tick","centered"],!1),yg=h(["axis","x","tick","format"]),zg=h(["axis","x","tick","culling"],{}),Ag=h(["axis","x","tick","culling","max"],"categorized"===vg?1/0:10),Bg=h(["axis","x","tick","count"]),Cg=h(["axis","x","tick","fit"],!1),Dg=h(["axis","x","max"]),Eg=h(["axis","x","min"]),Fg=h(["axis","x","default"]),Gg=h(["axis","x","label"],{}),Hg=h(["axis","y","show"],!0),Ig=h(["axis","y","max"]),Jg=h(["axis","y","min"]),Kg=h(["axis","y","center"]),Lg=h(["axis","y","label"],{}),Mg=h(["axis","y","inner"],!1),Ng=h(["axis","y","tick","format"]),Og=h(["axis","y","padding"]),Pg=h(["axis","y","ticks"],10),Qg=h(["axis","y2","show"],!1),Rg=h(["axis","y2","max"]),Sg=h(["axis","y2","min"]),Tg=h(["axis","y2","center"]),Ug=h(["axis","y2","label"],{}),Vg=h(["axis","y2","inner"],!1),Wg=h(["axis","y2","tick","format"]),Xg=h(["axis","y2","padding"]),Yg=h(["axis","y2","ticks"],10),Zg=h(["grid","x","show"],!1),$g=h(["grid","x","type"],"tick"),_g=h(["grid","x","lines"],[]),ah=h(["grid","y","show"],!1),bh=h(["grid","y","lines"],[]),ch=h(["grid","y","ticks"],10),dh=h(["point","show"],!0),eh=dh?h(["point","r"],2.5):0,fh=h(["point","focus","line","enabled"],!0),gh=h(["point","focus","expand","enabled"],!0),hh=h(["point","focus","expand","r"],gh?4:eh),ih=h(["point","focus","select","r"],8),jh=h(["bar","width"]),kh=h(["bar","width","ratio"],.6),lh=h(["pie","label","show"],!0),mh=h(["pie","label","format"]),nh=h(["pie","onclick"],function(){}),oh=h(["pie","onmouseover"],function(){}),ph=h(["pie","onmouseout"],function(){}),qh=h(["donut","label","show"],!0),rh=h(["donut","label","format"]),sh=h(["donut","title"],""),th=h(["donut","onclick"],function(){}),uh=h(["donut","onmouseover"],function(){}),vh=h(["donut","onmouseout"],function(){}),wh=h(["regions"],[]),xh=h(["tooltip","show"],!0),yh=h(["tooltip","format","title"]),zh=h(["tooltip","format","value"]),Ah=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=yh?yh:b,l=zh?zh: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+""}),Bh=h(["tooltip","init","show"],!1),Ch=h(["tooltip","init","x"],0),Dh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Eh=("string"==typeof Xe?Xe.replace("#",""):Xe.id)+"-clip",Fh=Eh+"-xaxis",Gh=Eh+"-yaxis",Hh=i(Eh),Ih=i(Ih),Jh=i(Jh),Kh="timeseries"===vg,Lh="categorized"===vg,Mh=!Kh&&(Rf||Zd(Sf)),Nh=null,Oh=!1,Ph=!1,Qh=!1,Rh=Ud(bg,pg),Sh=function(){var a=[[Ue.time.format("%Y/%-m/%-d"),function(){return!0}],[Ue.time.format("%-m/%-d"),function(a){return a.getMonth()}],[Ue.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ue.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ue.time.format("%I %p"),function(a){return a.getHours()}],[Ue.time.format("%I:%M"),function(a){return a.getMinutes()}],[Ue.time.format(":%S"),function(a){return a.getSeconds()}],[Ue.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)}}(),Th=[],Uh=ug?"left":"bottom",Vh=ug?Mg?"top":"bottom":Mg?"right":"left",Wh=ug?Vg?"bottom":"top":Vg?"left":"right",Xh=ug?"left":"bottom",Yh={main:function(){return"translate("+gf.left+","+gf.top+")"},context:function(){return"translate("+hf.left+","+hf.top+")"},legend:function(){return"translate("+jf.left+","+jf.top+")"},x:function(){return"translate(0,"+(ug?0:mf)+")"},y:function(){return"translate(0,"+(ug?mf:0)+")"},y2:function(){return"translate("+(ug?0:kf)+","+(ug?1:0)+")"},subx:function(){return"translate(0,"+(ug?0:nf)+")"},arc:function(){return"translate("+kf/2+","+mf/2+")"}},Zh="right"===rg,$h=0,_h=0,ai=0,bi=30,ci=30,di=5;yf=Ue.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var ei,fi=function(){var a=Ue.svg.line().x(ug?function(a){return V(a.id)(a.value)}:gd).y(ug?gd:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=he(b.values);return Kd(b)?(a.interpolate(Ld(b)?"cardinal":"linear"),ag[b.id]?te(e,Hf,V(b.id),ag[b.id]):a(e)):(c=Hf(e[0].x),d=V(b.id)(e[0].value),ug?"M "+d+" "+c:"M "+c+" "+d)}}(),gi=function(){var a;return a=ug?Ue.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(gd):Ue.svg.area().x(gd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=he(b.values);return Ed([b],"area")||Ed([b],"area-spline")?(a.interpolate(Ld(b)?"cardinal":"linear"),a(e)):(c=Hf(e[0].x),d=V(b.id)(e[0].value),ug?"M "+d+" "+c:"M "+c+" "+d)}}(),hi=function(){var a=Ue.svg.line().x(ug?function(a){return W(a.id)(a.value)}:jd).y(ug?jd:function(a){return W(a.id)(a.value)});return function(b){var c=he(b.values);return Kd(b)?a(c):"M "+Kf(c[0].x)+" "+W(b.id)(c[0].value)}}(),ii=function(){};ei=Ue.svg.brush().on("brush",Ce),ei.update=function(){return mi&&mi.select("."+f.brush).call(this),this},ei.scale=function(a){return ug?this.y(a):this.x(a)},af&&(ii=Ue.behavior.zoom().on("zoomstart",function(){ii.altDomain=Ue.event.sourceEvent.altKey?Hf.orgDomain():null}).on("zoom",af?De:null),ii.scale=function(a){return ug?this.y(a):this.x(a)},ii.orgScaleExtent=function(){var a=bf?bf:[1,10];return[a[0],Math.max(tc()/a[1],a[1])]},ii.updateScaleExtent=function(){var a=$b(Hf.orgDomain())/$b(qi),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var ji,ki,li,mi,ni,oi,pi,qi,ri,si={};if(Ve.focus=function(a){function b(a){zc(a).transition().duration(100).style("opacity",1)}var c=ji.selectAll(Yc(a)),d=c.filter(Qe),e=c.filter(Re);Ve.revert(),Ve.defocus(),b(d.classed(f.focused,!0)),b(e),Jd(Ve.data.targets)&&Kb(a,!0),Me(a)},Ve.defocus=function(a){function b(a){zc(a).transition().duration(100).style("opacity",.3)}var c=ji.selectAll(Yc(a)),d=c.filter(Qe),e=c.filter(Re);Ve.revert(),b(d.classed(f.focused,!1)),b(e),Jd(Ve.data.targets)&&Lb(a),Ne(a)},Ve.revert=function(a){function b(a){zc(a).transition().duration(100).style("opacity",1)}var c=ji.selectAll(Yc(a)),d=c.filter(Qe),e=c.filter(Re);b(d.classed(f.focused,!1)),b(e),Jd(Ve.data.targets)&&Lb(a),Oe()},Ve.show=function(a){Dc(a),ji.selectAll(Yc(a)).transition().style("opacity",1),Be({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!1})},Ve.hide=function(a){Cc(a),ji.selectAll(Yc(a)).transition().style("opacity",0),Be({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!1})},Ve.toggle=function(a){yc(a)?Ve.hide(a):Ve.show(a)},Ve.unzoom=function(){ei.clear().update(),Be({withUpdateXDomain:!0})},Ve.load=function(a){return a.xs&&ic(a.xs),"categories"in a&&Lh&&(wg=a.categories,Nf.categories(wg)),"cacheIds"in a&&_b(a.cacheIds)?void Ie(bc(a.cacheIds),a.done):void("unload"in a?Ke("string"==typeof a.unload?[a.unload]:"boolean"==typeof a.unload&&a.unload?vc():a.unload,function(){Je(a)}):Je(a))},Ve.unload=function(a){Ke(a?"string"==typeof a?[a]:a:vc(),function(){Be({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},Ve.selected=function(a){return Ue.merge(li.selectAll("."+f.shapes+Xc(a)).selectAll("."+f.shape).filter(function(){return Ue.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},Ve.select=function(a,b,c){cg&&li.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=Ue.select(this),i="circle"===this.nodeName?be:ee,j="circle"===this.nodeName?ce:fe,k=dg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?eg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},Ve.unselect=function(a,b){cg&&li.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=Ue.select(this),g="circle"===this.nodeName?ce:fe,h=dg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&eg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},Ve.toLine=function(a){Te(a,"line")},Ve.toSpline=function(a){Te(a,"spline")},Ve.toBar=function(a){Te(a,"bar")},Ve.toScatter=function(a){Te(a,"scatter")},Ve.toArea=function(a){Te(a,"area")},Ve.toAreaSpline=function(a){Te(a,"area-spline")},Ve.toPie=function(a){Te(a,"pie",{withTransform:!0})},Ve.toDonut=function(a){Te(a,"donut",{withTransform:!0})},Ve.groups=function(a){return c(a)?Wf:(Wf=a,Be(),Wf)},Ve.xgrids=function(a){return a?(_g=a,Be(),_g):_g},Ve.xgrids.add=function(a){return a?Ve.xgrids(_g.concat(a)):void 0},Ve.xgrids.remove=function(a){var b=Se(a);return Ve.xgrids(_g.filter(b))},Ve.ygrids=function(a){return a?(bh=a,Be(),bh):bh},Ve.ygrids.add=function(a){return a?Ve.ygrids(bh.concat(a)):void 0},Ve.ygrids.remove=function(a){var b=Se(a);return Ve.ygrids(bh.filter(b))},Ve.regions=function(a){return c(a)?wh:(wh=a,Be(),wh)},Ve.regions.add=function(a){return c(a)?wh:(wh=wh.concat(a),Be(),wh)},Ve.regions.remove=function(a,c){var e=[].concat(a);return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;ji.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),wh=wh.filter(function(b){return b.classes.indexOf(a)<0})}),wh},Ve.data.get=function(a){var b=Ve.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Ve.data.getAsTarget=function(a){var b=xc(function(b){return b.id===a});return b.length>0?b[0]:void 0},Ve.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Vf[b]=a[b]}),Pe(Ve.data.targets,{withTransition:!0}),Vf):Vf},Ve.x=function(a){return arguments.length&&(kc(Ve.data.targets,a),Be({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ve.data.x},Ve.xs=function(a){return arguments.length&&(lc(Ve.data.targets,a),Be({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ve.data.x},Ve.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},Ve.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Ig=+a.y),b(a.y2)&&(Rg=+a.y2)):Ig=Rg=+a,Be())},Ve.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Jg=+a.y),b(a.y2)&&(Sg=+a.y2)):Jg=Sg=+a,Be())},Ve.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Ve.axis.max(a.max),"undefined"!=typeof a.min&&Ve.axis.min(a.min))},Ve.resize=function(a){Ye=a?a.width:null,Ze=a?a.height:null,Ge({withLegend:!0,withTransition:!1})},Ve.destroy=function(){Ve.data.targets=void 0,Ve.data.x={},pi.html(""),a.onresize=null},"url"in e.data)Ue.csv(e.data.url,function(a,b){ue(b)});else if("rows"in e.data)ue(nc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");ue(oc(e.data.columns))}return Ve},"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;clf&&(lf=0),0>nf&&(nf=0),jf={top:vg?hf.top:qf-pg-($h?0:rf),right:0/0,bottom:20+($h?0:rf),left:vg?ci:hf.left},mf=vg?hf.left-ci-di:lf,of=vg?nf:qf-jf.top-jf.bottom,0>mf&&(mf=0),0>of&&(of=0),kf={top:$h?0:qf-rf,right:0/0,bottom:0,left:$h?pf-sf:0},p(),$h&&Kd(We.data.targets)&&(kf.left=lf/2+uf)}function o(){mi.select("line."+f.xgridFocus).attr("x1",vg?0:-10).attr("x2",vg?lf:-10).attr("y1",vg?-10:hf.top).attr("y2",vg?-10:nf)}function p(){uf=nf/2,tf=.95*uf,vf=Jd(We.data.targets)?.6*tf:0}function q(){var a=vg?f.axisX:f.axisY,b=Ve.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Ve.select(Ye).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Ze?Ze:x()}function s(){var a=$e?$e:y();return a>0?a:320}function t(){return Kd(We.data.targets)?0:_e?_e:vg||!Ig||Ng?1:v("y")}function u(){var a=1;return Kd(We.data.targets)?0:af?af:$h?sf+(Rg&&!vg?v("y2"):a):Rg?Wg||vg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||Ig?"y2"!==a||Rg?(gb(a).isInner?30:40)+("y2"===a?-10:0):ei:rg&&!$h?10:1}function x(){return+Ve.select(Ye).style("width").replace("px","")}function y(){return+Ve.select(Ye).style("height").replace("px","")}function z(a){return a?-5:-(hf.left-1)}function A(a){return a?-20:-1}function B(){return z(!vg)}function C(){return A(!vg)}function D(){return z(vg)}function E(){return A(vg)}function F(a){return a?lf+2+4:hf.left+20}function G(a){return a?80:nf+2}function H(){return F(!vg)}function I(){return G(!vg)}function J(){return F(vg)}function K(){return G(vg)}function L(){var a=vg?nf:lf,b=tc(),c=Vb()*(Gd(We.data.targets)?(b-(Mh?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){_h=a}function N(a){ai=a}function O(a){bi=a}function P(){return rg?$h?ai*(_h+1):pf:0}function Q(){return rg?$h?qf:bi*(_h+1):0}function R(){var a,b=!If;Af=vg?1:0,Bf=vg?nf:lf,Cf=vg?0:nf,Df=vg?lf:1,Ef=Af,Ff=Bf,Gf=vg?0:of,Hf=vg?mf:1,If=T(Af,Bf,b?void 0:If.domain(),function(){return Of.tickOffset()}),Jf=U(Cf,Df),Kf=U(Cf,Df),Lf=T(Af,Bf,ri,function(a){return a%1?0:Rf.tickOffset()}),Mf=U(Gf,Hf),Nf=U(Gf,Hf),a=$(),Of=X(If,Vh,a),Rf=X(Lf,Yh,a),Pf=Y(Jf,Wh,Og,Qg),Qf=Y(Kf,Xh,Xg,Zg),b||(fi.scale(Lf),bf&&ji.scale(If)),S()}function S(){wf=Db(),xf=Eb(),yf=Eb(.98)}function T(a,b,e,f){var g=(Lh?Ve.time.scale():Ve.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),Mh){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return Ve.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?Kf:Jf}function W(a){return"y2"===Z(a)?Nf:Mf}function X(a,b,c){var d=(Mh?Bb():Ve.svg.axis()).scale(a).orient(b);return d.tickFormat(c),Mh?d.tickCentered(yg):d.tickOffset=function(){var a=vg?nf:lf;return a*Vb()/tc()/2},Mh&&d.categories(xg),d}function Y(a,b,c,d){return Ve.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Yf?Yf[a]:"y"}function $(){var a=Lh?Th:Mh?Ic:function(a){return 0>a?a.toFixed(0):a};return zg&&("function"==typeof zg?a=zg:Lh&&(a=function(a){return Ve.time.format(zg)(a)})),a}function _(a){var b;return"y"===a?b=Mg:"y2"===a?b=Vg:"x"===a&&(b=Hg),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Mg=b:"y2"===a?Vg=b:"x"===a&&(Hg=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",vg?"inner-top":"inner-right")}function eb(){return cb("y",vg?"inner-right":"inner-top")}function fb(){return cb("y2",vg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?lf/2:lf:b.isBottom?-nf:b.isMiddle?-nf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!vg,db())}function ob(){return kb(vg,eb())}function pb(){return kb(vg,fb())}function qb(){return lb(!vg,db())}function rb(){return lb(vg,eb())}function sb(){return lb(vg,fb())}function tb(){var a=db();return vg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return vg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return vg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!vg,db())}function xb(){return mb(vg,eb())}function yb(){return mb(vg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return Ve.selectAll("."+c+" .tick text").each(function(){var a=this.getBBox();bb?20:b}function Ab(){mi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),mi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),mi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+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=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]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return Ve.min(Object.keys(i).map(function(a){return Ve.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=vc(a),i=Ec(a);if(Xf.length>0)for(g=Hc(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 Ve.max(Object.keys(i).map(function(a){return Ve.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Tg:Kg,n="y2"===c?Sg:Jg,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?Ug:Lg,r=bd()&&vg;return 0===l.length?"y2"===c?Kf.domain():Jf.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&&Pg&&(f=b(Pg.top)?Pg.top:e,g=b(Pg.bottom)?Pg.bottom:e),"y2"===c&&Yg&&(f=b(Yg.top)?Yg.top:e,g=b(Yg.bottom)?Yg.bottom:e),r&&(i=cd(o,p),j=$b(Jf.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]))),Gd(l)&&!Gc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(ri),c=$b(If.domain());return a||0===c?1:b/c}function Wb(a){return Fg?Fg:Ve.min(a,function(a){return Ve.min(a.values,function(a){return a.x})})}function Xb(a){return Eg?Eg:Ve.max(a,function(a){return Ve.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return Mh?d=0:Gd(a)?(c=tc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=Lh?new Date(c.getTime()-e):c-e,g=Lh?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return Sf&&a===Sf||$d(Tf)&&_d(Tf,a)}function fc(a){return!ec(a)}function gc(a){return Sf?Sf:$d(Tf)?Tf[a]:null}function hc(a,b){return a in We.data.x&&We.data.x[a]&&We.data.x[a][b]?We.data.x[a][b]:b}function ic(a){Object.keys(a).forEach(function(b){Tf[b]=a[b]})}function jc(a){var b;return a&&(b=Wf[a.id],a.name=b?b:a.id),a}function kc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=mc(b[d],a.id,d)}),We.data.x[a.id]=b})}function lc(a,b){a.forEach(function(a){b[a.id]&&kc([a],b[a.id])})}function mc(a,b,c){var d;return d=Lh?a?a instanceof Date?a:Wd(a):Wd(hc(b,c)):Nh&&!Mh?a?+a:hc(b,c):c}function nc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0&&(We.data.x[b]=a.map(function(a){return a[c]})):We.data.x[b]=a.map(function(a,b){return b})}),c.forEach(function(a){if(!We.data.x[a])throw new Error('x is not defined for id = "'+a+'".')}),b=c.map(function(b,c){var d=Vf(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=mc(g,b,e);return Nh&&Mh&&0===c&&g&&(0===e&&(xg=[]),xg.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++})}),Zf&&Ed(vc(b).filter(function(a){return!(a in $f)}),Zf),b.forEach(function(a){ac(a.id_org,a)}),b}function qc(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 rc(a){return a>0&&We.data.targets[0].values[a-1]?We.data.targets[0].values[a-1].x:void 0}function sc(a){return a1?We.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?We.data.targets[0]:null,a}function vc(a){return a=c(a)?We.data.targets:a,a.map(function(a){return a.id})}function wc(a){var b,c=vc();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(Lh?new Date(h):h);i.push(d)}return i}function Cc(a){Uh=Uh.concat(a)}function Dc(a){Uh=Uh.filter(function(b){return a.indexOf(b)<0})}function Ec(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Fc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Hc(a){return Fc(a,function(a){return a>0})}function Ic(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(kd(a,f))),a[g].x&&(e=e.concat(kd(a,g))),nd(e,b)):ld(a,b,f,g)}function md(a,b){var c;return c=a.map(function(a){return ld(a.values,b)}),nd(c,b)}function nd(a,b){var c,d;return a.forEach(function(a){var e=ae(a,b);(c>e||!c)&&(c=e,d=a)}),d}function od(a,b){return Ve.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function pd(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 qd(){return ag&&"desc"===ag.toLowerCase()}function rd(){return ag&&"asc"===ag.toLowerCase()}function sd(a){var b=rd(),c=qd();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 ag&&a.sort(ag),a}function td(a,c){var d,e,f,g,h,i,j,k=Kd(We.data.targets),l=k?ed:dd,m=a.filter(function(a){return a&&b(a.value)});yh&&0!==m.length&&(pi.html(Bh(a,$(),l,Sh)).style("display","block"),d=pi.property("offsetWidth"),e=pi.property("offsetHeight"),k?(g=lf/2+c[0],i=nf/2+c[1]+20):(vg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=If(m[0].x)+20):(f=q(),g=f+t()+If(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),pi.style("top",i+"px").style("left",g+"px"))}function ud(){pi.style("display","none")}function vd(a){var c=a.filter(function(a){return a&&b(a.value)});yh&&(Hd(We.data.targets)||Kd(We.data.targets)||mi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(vg?"y1":"x1",gd).attr(vg?"y2":"x2",gd))}function wd(){mi.select("line."+f.xgridFocus).style("visibility","hidden")}function xd(a){return a.x||0===a.x?If(a.x):null}function yd(a){return V(a.id)(a.value)}function zd(){var a,b,d={},e=0;return zc(xc(Nd)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Dd(a,b){return kh?kh:b?2*a.tickOffset()*lh/b:0}function Ed(a,b){var c,d=a?"string"==typeof a?[a]:a:vc();for(c=0;c0}function _d(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ae(a,b){var c="y"===Z(a.id)?Jf:Kf;return Math.pow(If(a.x)-b[0],2)+Math.pow(c(a.value)-b[1],2)}function be(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function ce(a,b,c){kg(b,a.node()),mi.select("."+f.selectedCircles+Xc(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Jc(f.selectedCircle,c)}).attr("cx",vg?yd:xd).attr("cy",vg?xd:yd).attr("stroke",function(){return Sh(b.id)}).attr("r",1.4*jh).transition().duration(100).attr("r",jh)}function de(a,b,c){lg(b,a.node()),mi.select("."+f.selectedCircles+Xc(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ee(a,b,c,d){a?ce(b,c,d):de(b,c,d)}function fe(a,b){kg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ve.rgb(Sh(b.id)).darker(1)})}function ge(a,b){lg(b,a.node()),a.transition().duration(100).style("fill",function(){return Sh(b.id)})}function he(a,b,c,d){a?fe(b,c,d):ge(b,c,d)}function ie(a){return a.filter(function(a){return b(a.value)})}function je(a,c){return(c?mi.selectAll("."+f.circles+Xc(c)):mi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ke(a,b){je(a,b).classed(f.EXPANDED,!0).attr("r",ih)}function le(a){je(a).filter(function(){return Ve.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",fh)}function me(a){return mi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function ne(a){me(a).classed(f.EXPANDED,!0)}function oe(a){me(a).classed(f.EXPANDED,!1)}function pe(a,b){var c=te(a,b);return function(a,b){var d=c(a,b),e=vg?1:0,f=vg?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 qe(a,b){var c=te(a,!1),d=b?re:se;return function(a,b){return d(c(a,b),a,this)}}function re(a,b){var c;return vg?(c=Nd(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function se(a,b,c){var d=c.getBBox();return vg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:Nd(b)?-3:-6)}function te(a,b){var c=a.__max__+1,d=Dd(Of,c),e=Ad(d,c,a,!!b),f=Bd(!!b),g=Cd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return vg&&(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 ue(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 ve(b){var c,d,e;if(qi=Ve.select(Ye),qi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(qi.html(""),qi.classed("c3",!0),We.data.x={},We.data.targets=pc(b),n(),R(),If.domain(Ve.extent(Zb(We.data.targets))),Jf.domain(Ub(We.data.targets,"y")),Kf.domain(Ub(We.data.targets,"y2")),Lf.domain(If.domain()),Mf.domain(Jf.domain()),Nf.domain(Kf.domain()),ri=If.domain(),fi.scale(Lf),bf&&ji.scale(If),ki=qi.append("svg").attr("width",lf+hf.left+hf.right).attr("height",nf+hf.top+hf.bottom).on("mouseenter",ef).on("mouseleave",ff),li=ki.append("defs"),li.append("clipPath").attr("id",Fh).append("rect").attr("width",lf).attr("height",nf),li.append("clipPath").attr("id",Gh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),li.append("clipPath").attr("id",Hh).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),mi=ki.append("g").attr("transform",Zh.main),ni=og?ki.append("g").attr("transform",Zh.context):null,oi=rg?ki.append("g").attr("transform",Zh.legend):null,pi=Ve.select(Ye).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),mi.append("g").attr("class",f.axisX).attr("clip-path",vg?"":Jh).attr("transform",Zh.x).append("text").attr("class",f.axisXLabel).attr("transform",vg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),Ig&&mi.append("g").attr("class",f.axisY).attr("clip-path",vg?Kh:"").append("text").attr("class",f.axisYLabel).attr("transform",vg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),Rg&&mi.append("g").attr("class",f.axisY2).attr("transform",Zh.y2).append("text").attr("class",f.axisY2Label).attr("transform",vg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=mi.append("g").attr("clip-path",Ih).attr("class",f.grid),$g&&d.append("g").attr("class",f.xgrids),$d(ah)&&d.append("g").attr("class",f.xgridLines),gh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),bh&&d.append("g").attr("class",f.ygrids),$d(ch)&&d.append("g").attr("class",f.ygridLines),mi.append("g").attr("clip-path",Ih).attr("class",f.regions),mi.append("g").attr("clip-path",Ih).attr("class",f.chart),c=mi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",bf?vg?"ns-resize":"ew-resize":null),mi.select("."+f.chart).append("g").attr("class",f.chartBars),mi.select("."+f.chart).append("g").attr("class",f.chartLines),mi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Zh.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),mi.select("."+f.chart).append("g").attr("class",f.chartTexts),bf&&mi.insert("rect",df?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",lf).attr("height",nf).style("opacity",0).style("cursor",vg?"ns-resize":"ew-resize").call(ji).on("dblclick.zoom",null),Gg&&fi.extent("function"!=typeof Gg?Gg:Gg(Zb())),og&&(ni.append("g").attr("clip-path",Ih).attr("class",f.chart),ni.select("."+f.chart).append("g").attr("class",f.chartBars),ni.select("."+f.chart).append("g").attr("class",f.chartLines),ni.append("g").attr("clip-path",Ih).attr("class",f.brush).call(fi).selectAll("rect").attr(vg?"width":"height",vg?mf:of),ni.append("g").attr("class",f.axisX).attr("transform",Zh.subx).attr("clip-path",vg?"":Jh)),Ie(We.data.targets),vg?mi.select("."+f.axisX).style("opacity",0).call(Of):(mi.select("."+f.axisY).style("opacity",0).call(Pf),mi.select("."+f.axisY2).style("opacity",0).call(Qf)),He({withTransform:!0,withLegend:!0,withTransitionForAxis:!1}),Ch){if(Lh&&"string"==typeof Dh){for(Dh=Wd(Dh),e=0;e0){d=[];for(var g in Wf)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=pd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=he,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 Ae(a){Kd(We.data.targets)||dg&&(Oh=a,mi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ph=!0,mg())}function Be(){Kd(We.data.targets)||dg&&(mi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),mi.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ph=!1,ng())}function Ce(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P=zd(),Q=Kd(We.data.targets),R=zc(We.data.targets);if(0!==R.length){if(a=d(a)?a:{},v=d(a.withY)?a.withY:!0,w=d(a.withSubchart)?a.withSubchart:!0,x=d(a.withTransition)?a.withTransition:!0,A=d(a.withTransform)?a.withTransform:!1,B=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,C=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,D=d(a.withLegend)?a.withLegend:!1,y=d(a.withTransitionForExit)?a.withTransitionForExit:x,z=d(a.withTransitionForAxis)?a.withTransitionForAxis:x,I=x?gf:0,J=y?I:0,K=z?I:0,D&&rg&&Qe(We.data.targets,a),C&&(If.domain(Ve.extent(Zb(R))),ri=If.domain(),bf&&ji.scale(If).updateScaleExtent(),Lf.domain(If.domain()),fi.scale(Lf)),B&&(If.domain(fi.empty()?ri:fi.extent()),bf&&ji.scale(If).updateScaleExtent(),Hd(R)||(M=Bc(Ac(R)),Of.tickValues(M),Rf.tickValues(M))),Jf.domain(Ub(R,"y")),Kf.domain(Ub(R,"y2")),mi.select("."+f.axisX).style("opacity",Q?0:1).transition().duration(K).call(Of),mi.select("."+f.axisY).style("opacity",Q?0:1).transition().duration(K).call(Pf),mi.select("."+f.axisY2).style("opacity",Q?0:1).transition().duration(K).call(Qf),B&&Ag&&M){for(N=1;N=V;V++)e.push(new Date(V+"-01-01 00:00:00"))}else e=If.ticks(10);c=mi.select("."+f.xgrids).selectAll("."+f.xgrid).data(e),c.enter().append("line").attr("class",f.xgrid),c.attr("x1",vg?0:function(a){return If(a)-Of.tickOffset()}).attr("x2",vg?lf:function(a){return If(a)-Of.tickOffset()}).attr("y1",vg?function(a){return If(a)-Of.tickOffset()}:hf.top).attr("y2",vg?function(a){return If(a)-Of.tickOffset()}:nf).style("opacity",function(){return+Ve.select(this).attr(vg?"y1":"x1")===(vg?nf:0)?0:1}),c.exit().remove()}$d(ah)&&(g=mi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(ah),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",vg?"":"rotate(-90)").attr("dx",vg?0:-hf.top).attr("dy",-5).style("opacity",0),g.select("line").transition().duration(I).attr("x1",vg?0:hd).attr("x2",vg?lf:hd).attr("y1",vg?hd:hf.top).attr("y2",vg?hd:nf).style("opacity",1),g.select("text").transition().duration(I).attr("x",vg?lf:0).attr("y",hd).text(function(a){return a.text}).style("opacity",1),g.exit().transition().duration(I).style("opacity",0).remove()),v&&bh&&(i=mi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Jf.ticks(dh)),i.enter().append("line").attr("class",f.ygrid),i.attr("x1",vg?Jf:0).attr("x2",vg?Jf:lf).attr("y1",vg?0:Jf).attr("y2",vg?nf:Jf),i.exit().remove()),v&&$d(ch)&&(j=mi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(ch),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",vg?"rotate(-90)":"").attr("dx",vg?0:-hf.top).attr("dy",-5).style("opacity",0),j.select("line").transition().duration(I).attr("x1",vg?id:0).attr("x2",vg?id:lf).attr("y1",vg?0:id).attr("y2",vg?nf:id).style("opacity",1),j.select("text").transition().duration(I).attr("x",vg?0:lf).attr("y",id).text(function(a){return a.text}).style("opacity",1),j.exit().transition().duration(I).style("opacity",0).remove()),m=mi.selectAll("."+f.bars).selectAll("."+f.bar).data(Sd),m.enter().append("path").attr("d",E).style("stroke","none").style("opacity",0).style("fill",function(a){return Sh(a.id)}).attr("class",Rc),m.style("opacity",Zc).transition().duration(I).attr("d",E).style("opacity",1),m.exit().transition().duration(J).style("opacity",0).remove(),p=mi.selectAll("."+f.texts).selectAll("."+f.text).data(Ud),p.enter().append("text").attr("class",Kc).attr("text-anchor",function(a){return vg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),p.text(function(a){return fd(a.id)(a.value)}).style("fill-opacity",$c).transition().duration(I).attr("x",G).attr("y",H).style("fill-opacity",ad),p.exit().transition().duration(J).style("fill-opacity",0).remove(),mi.selectAll("."+f.line).style("opacity",Zc).transition().duration(I).attr("d",gi).style("opacity",1),mi.selectAll("."+f.area).style("opacity",0).transition().duration(I).attr("d",hi).style("opacity",si),l=mi.selectAll("."+f.circles).selectAll("."+f.circle).data(Td),l.enter().append("circle").attr("class",Pc).style("opacity",0).attr("r",fh),l.style("opacity",Zc).transition().duration(I).style("opacity",_c).attr("cx",vg?yd:xd).attr("cy",vg?xd:yd),l.exit().remove(),mi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",A?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(I).attrTween("d",function(a){var b,c=Cb(a);return c?(b=Ve.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",A?"scale(1)":"").style("opacity",1),mi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(I).text(Jb).style("opacity",function(a){return yc(a.data.id)&&Rd(a.data)?1:0}),mi.select("."+f.chartArcsTitle).style("opacity",Jd(We.data.targets)?1:0),og&&(null!==Ve.event&&"zoom"===Ve.event.type&&fi.extent(If.orgDomain()).update(),w&&(ni.select("."+f.axisX).style("opacity",Q?0:1).transition().duration(I).call(Rf),fi.empty()||fi.extent(If.orgDomain()).update(),F=pe(P,!0),q=ni.selectAll("."+f.bars).selectAll("."+f.bar).data(Sd),q.enter().append("path").attr("d",F).style("stroke","none").style("fill",function(a){return Sh(a.id)}).attr("class",Rc),q.style("opacity",Zc).transition().duration(I).attr("d",F).style("opacity",1),q.exit().transition().duration(I).style("opacity",0).remove(),ni.selectAll("."+f.line).style("opacity",Zc).transition().duration(I).attr("d",ii).style("opacity",1))),mi.selectAll("."+f.selectedCircles).filter(function(a){return Nd(a)}).selectAll("circle").remove(),mi.selectAll("."+f.selectedCircle).transition().duration(I).attr("cx",vg?yd:xd).attr("cy",vg?xd:yd),$d(Tf)?(r=mi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),xe(r.enter()),r.attr("x",0).attr("y",0).attr("width",lf).attr("height",nf)):(Nh&&!Mh?(u=function(a,b){var c=rc(b),d=sc(b),e=We.data.x[a.id][b];return(If(d?d:e+50)-If(c?c:e-50))/2},t=function(a,b){var c=rc(b),d=We.data.x[a.id][b];return(If(d)+If(c?c:d-50))/2}):(u=L(),t=function(a){return If(a.x)-u/2}),s=uc(),mi.select("."+f.eventRects).datum(s?s.values:[]),r=mi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),we(r.enter()),r.attr("class",Wc).attr("x",vg?0:t).attr("y",vg?t:0).attr("width",vg?lf:u).attr("height",vg?u:nf),r.exit().remove()),n=mi.select("."+f.regions).selectAll("rect."+f.region).data(xh),n.enter().append("rect").style("fill-opacity",0),n.attr("class",Vc).attr("x",vg?0:cc).attr("y",vg?cc:hf.top).attr("width",vg?lf:dc).attr("height",vg?dc:nf).transition().duration(I).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),n.exit().transition().duration(I).style("fill-opacity",0).remove(),vc().forEach(function(a){ti[a]=!0})}}function De(){Ce({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ee(){return"mousemove"===Ve.event.sourceEvent.type&&ji.altDomain?(If.domain(ji.altDomain),void ji.scale(If).updateScaleExtent()):(Mh&&If.orgDomain()[0]===ri[0]&&If.domain([ri[0]-1e-10,If.orgDomain()[1]]),Ce({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Ve.event.sourceEvent.type&&(Qh=!0)))}function Fe(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ge(){ki.attr("width",pf).attr("height",qf),ki.select("#"+Fh).select("rect").attr("width",lf).attr("height",nf),ki.select("#"+Gh).select("rect").attr("width",H),ki.select("#"+Hh).select("rect").attr("width",J),ki.select("."+f.zoomRect).attr("width",lf).attr("height",nf)}function He(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(),R(),Ge(),m(a.withTransition),Ce(a)}function Ie(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=mi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a),j=i.enter().append("g").attr("class",function(a){return f.chartText+Jc(f.target,a.id)}).style("pointer-events","none"),j.append("g").attr("class",Lc).style("fill",function(a){return Sh(a.id)}),e=mi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),d=e.enter().append("g").attr("class",function(a){return f.chartBar+Jc(f.target,a.id)}).style("pointer-events","none"),d.append("g").attr("class",Sc).style("fill",function(a){return Sh(a.id)}).style("stroke","none").style("cursor",function(a){return fg(a)?"pointer":null}),c=mi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),b=c.enter().append("g").attr("class",function(a){return f.chartLine+Jc(f.target,a.id)}).style("pointer-events","none"),b.append("path").attr("class",Oc).style("opacity",0).style("stroke",function(a){return Sh(a.id)}),b.append("path").attr("class",Uc).style("opacity",function(){return si=+Ve.select(this).style("opacity"),0}).style("fill",function(a){return Sh(a.id)}),b.append("g").attr("class",function(a){return Jc(f.selectedCircles,a.id)}),b.append("g").attr("class",Qc).style("fill",function(a){return Sh(a.id)}).style("cursor",function(a){return fg(a)?"pointer":null}),a.forEach(function(a){mi.selectAll("."+f.selectedCircles+Xc(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=mi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(zf(a)),g=h.enter().append("g").attr("class",function(a){return f.chartArc+Jc(f.target,a.data.id)}),g.append("path").attr("class",Tc).style("opacity",0).style("fill",function(a){return Sh(a.data.id)}).style("cursor",function(a){return fg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),Ne(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];td(c,Ve.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),Pe(),ud(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),og&&(n=ni.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),m=n.enter().append("g").attr("class",function(a){return f.chartBar+Jc(f.target,a.id)}),m.append("g").attr("class",Sc).style("fill",function(a){return Sh(a.id)}),l=ni.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),k=l.enter().append("g").attr("class",function(a){return f.chartLine+Jc(f.target,a.id)}),k.append("path").attr("class",Oc).style("opacity",0).style("stroke",function(a){return Sh(a.id)})),ki.selectAll("."+f.target).filter(function(a){return yc(a.id)}).transition().style("opacity",1)}function Je(a,b){We.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=$h?i:h,k=$h?rf:sf;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=$h?u:t,ug?(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=vc(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,$h?(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=oi.selectAll("."+f.legendItem).data(q).enter().append("g").attr("class",function(a){return Jc(f.legendItem,a)}).style("cursor","pointer").on("click",function(a){"function"==typeof tg?tg(a):We.toggle(a)}).on("mouseover",function(a){We.focus(a)}).on("mouseout",function(){We.revert()}),g.append("text").text(function(a){return d(Wf[a])?Wf[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",$h?i:-200).attr("y",$h?-200:l),g.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",$h?j:-200).attr("y",$h?-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 Sh(a)}).attr("x",$h?i:-200).attr("y",$h?-200:k).attr("width",10).attr("height",10),oi.selectAll("text").data(q).text(function(a){return d(Wf[a])?Wf[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",i).attr("y",l),oi.selectAll("rect."+f.legendItemEvent).data(q).transition().duration(p?250:0).attr("x",j).attr("y",o),oi.selectAll("rect."+f.legendItemTile).data(q).transition().duration(p?250:0).attr("x",h).attr("y",k),N(t),O(u),M(C),n(),R(),Ge(),m(!1)}function Re(a){return wc(a.id)}function Se(a){return"data"in a&&wc(a.data.id)}function Te(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 Ue(a,b,c){var d=!Kd(We.data.targets);Ed(a,b),He(c?c:{withTransitionForAxis:d})}var Ve=a.d3?a.d3:a.require?a.require("d3"):void 0,We={data:{},axis:{}},Xe={},Ye=h(["bindto"],"#chart"),Ze=h(["size","width"]),$e=h(["size","height"]),_e=h(["padding","left"]),af=h(["padding","right"]),bf=h(["zoom","enabled"],!1),cf=h(["zoom","extent"]),df=h(["zoom","privileged"],!1),ef=h(["onenter"],function(){}),ff=h(["onleave"],function(){}),gf=h(["transition","duration"],350);g("data","data is required in config");var 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,Rf,Sf=h(["data","x"]),Tf=h(["data","xs"],{}),Uf=h(["data","x_format"]),Vf=h(["data","id_converter"],function(a){return a}),Wf=h(["data","names"],{}),Xf=h(["data","groups"],[]),Yf=h(["data","axes"],{}),Zf=h(["data","type"]),$f=h(["data","types"],{}),_f=h(["data","labels"],{}),ag=h(["data","order"]),bg=h(["data","regions"],{}),cg=h(["data","colors"],{}),dg=h(["data","selection","enabled"],!1),eg=h(["data","selection","grouped"],!1),fg=h(["data","selection","isselectable"],function(){return!0}),gg=h(["data","selection","multiple"],!0),hg=h(["data","onclick"],function(){}),ig=h(["data","onenter"],function(){}),jg=h(["data","onleave"],function(){}),kg=h(["data","onselected"],function(){}),lg=h(["data","onunselected"],function(){}),mg=h(["data","ondragstart"],function(){}),ng=h(["data","ondragend"],function(){}),og=h(["subchart","show"],!1),pg=og?h(["subchart","size","height"],60):0,qg=h(["color","pattern"],[]),rg=h(["legend","show"],!0),sg=h(["legend","position"],"bottom"),tg=h(["legend","item","onclick"]),ug=h(["legend","equally"],!1),vg=h(["axis","rotated"],!1),wg=h(["axis","x","type"],"indexed"),xg=h(["axis","x","categories"],[]),yg=h(["axis","x","tick","centered"],!1),zg=h(["axis","x","tick","format"]),Ag=h(["axis","x","tick","culling"],{}),Bg=h(["axis","x","tick","culling","max"],"categorized"===wg?1/0:10),Cg=h(["axis","x","tick","count"]),Dg=h(["axis","x","tick","fit"],!1),Eg=h(["axis","x","max"]),Fg=h(["axis","x","min"]),Gg=h(["axis","x","default"]),Hg=h(["axis","x","label"],{}),Ig=h(["axis","y","show"],!0),Jg=h(["axis","y","max"]),Kg=h(["axis","y","min"]),Lg=h(["axis","y","center"]),Mg=h(["axis","y","label"],{}),Ng=h(["axis","y","inner"],!1),Og=h(["axis","y","tick","format"]),Pg=h(["axis","y","padding"]),Qg=h(["axis","y","ticks"],10),Rg=h(["axis","y2","show"],!1),Sg=h(["axis","y2","max"]),Tg=h(["axis","y2","min"]),Ug=h(["axis","y2","center"]),Vg=h(["axis","y2","label"],{}),Wg=h(["axis","y2","inner"],!1),Xg=h(["axis","y2","tick","format"]),Yg=h(["axis","y2","padding"]),Zg=h(["axis","y2","ticks"],10),$g=h(["grid","x","show"],!1),_g=h(["grid","x","type"],"tick"),ah=h(["grid","x","lines"],[]),bh=h(["grid","y","show"],!1),ch=h(["grid","y","lines"],[]),dh=h(["grid","y","ticks"],10),eh=h(["point","show"],!0),fh=eh?h(["point","r"],2.5):0,gh=h(["point","focus","line","enabled"],!0),hh=h(["point","focus","expand","enabled"],!0),ih=h(["point","focus","expand","r"],hh?4:fh),jh=h(["point","focus","select","r"],8),kh=h(["bar","width"]),lh=h(["bar","width","ratio"],.6),mh=h(["pie","label","show"],!0),nh=h(["pie","label","format"]),oh=h(["pie","onclick"],function(){}),ph=h(["pie","onmouseover"],function(){}),qh=h(["pie","onmouseout"],function(){}),rh=h(["donut","label","show"],!0),sh=h(["donut","label","format"]),th=h(["donut","title"],""),uh=h(["donut","onclick"],function(){}),vh=h(["donut","onmouseover"],function(){}),wh=h(["donut","onmouseout"],function(){}),xh=h(["regions"],[]),yh=h(["tooltip","show"],!0),zh=h(["tooltip","format","title"]),Ah=h(["tooltip","format","value"]),Bh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=zh?zh:b,l=Ah?Ah: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+""}),Ch=h(["tooltip","init","show"],!1),Dh=h(["tooltip","init","x"],0),Eh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Fh=("string"==typeof Ye?Ye.replace("#",""):Ye.id)+"-clip",Gh=Fh+"-xaxis",Hh=Fh+"-yaxis",Ih=i(Fh),Jh=i(Jh),Kh=i(Kh),Lh="timeseries"===wg,Mh="categorized"===wg,Nh=!Lh&&(Sf||$d(Tf)),Oh=null,Ph=!1,Qh=!1,Rh=!1,Sh=Vd(cg,qg),Th=function(){var a=[[Ve.time.format("%Y/%-m/%-d"),function(){return!0}],[Ve.time.format("%-m/%-d"),function(a){return a.getMonth()}],[Ve.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ve.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ve.time.format("%I %p"),function(a){return a.getHours()}],[Ve.time.format("%I:%M"),function(a){return a.getMinutes()}],[Ve.time.format(":%S"),function(a){return a.getSeconds()}],[Ve.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)}}(),Uh=[],Vh=vg?"left":"bottom",Wh=vg?Ng?"top":"bottom":Ng?"right":"left",Xh=vg?Wg?"bottom":"top":Wg?"left":"right",Yh=vg?"left":"bottom",Zh={main:function(){return"translate("+hf.left+","+hf.top+")"},context:function(){return"translate("+jf.left+","+jf.top+")"},legend:function(){return"translate("+kf.left+","+kf.top+")"},x:function(){return"translate(0,"+(vg?0:nf)+")"},y:function(){return"translate(0,"+(vg?nf:0)+")"},y2:function(){return"translate("+(vg?0:lf)+","+(vg?1:0)+")"},subx:function(){return"translate(0,"+(vg?0:of)+")"},arc:function(){return"translate("+lf/2+","+nf/2+")"}},$h="right"===sg,_h=0,ai=0,bi=0,ci=30,di=30,ei=5;zf=Ve.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var fi,gi=function(){var a=Ve.svg.line().x(vg?function(a){return V(a.id)(a.value)}:gd).y(vg?gd:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=ie(b.values);return Ld(b)?(a.interpolate(Md(b)?"cardinal":"linear"),bg[b.id]?ue(e,If,V(b.id),bg[b.id]):a(e)):(c=If(e[0].x),d=V(b.id)(e[0].value),vg?"M "+d+" "+c:"M "+c+" "+d)}}(),hi=function(){var a;return a=vg?Ve.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(gd):Ve.svg.area().x(gd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=ie(b.values);return Fd([b],"area")||Fd([b],"area-spline")?(a.interpolate(Md(b)?"cardinal":"linear"),a(e)):(c=If(e[0].x),d=V(b.id)(e[0].value),vg?"M "+d+" "+c:"M "+c+" "+d)}}(),ii=function(){var a=Ve.svg.line().x(vg?function(a){return W(a.id)(a.value)}:jd).y(vg?jd:function(a){return W(a.id)(a.value)});return function(b){var c=ie(b.values);return Ld(b)?a(c):"M "+Lf(c[0].x)+" "+W(b.id)(c[0].value)}}(),ji=function(){};fi=Ve.svg.brush().on("brush",De),fi.update=function(){return ni&&ni.select("."+f.brush).call(this),this},fi.scale=function(a){return vg?this.y(a):this.x(a)},bf&&(ji=Ve.behavior.zoom().on("zoomstart",function(){ji.altDomain=Ve.event.sourceEvent.altKey?If.orgDomain():null}).on("zoom",bf?Ee:null),ji.scale=function(a){return vg?this.y(a):this.x(a)},ji.orgScaleExtent=function(){var a=cf?cf:[1,10];return[a[0],Math.max(tc()/a[1],a[1])]},ji.updateScaleExtent=function(){var a=$b(If.orgDomain())/$b(ri),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var ki,li,mi,ni,oi,pi,qi,ri,si,ti={};if(We.focus=function(a){function b(a){zc(a).transition().duration(100).style("opacity",1)}var c=ki.selectAll(Yc(a)),d=c.filter(Re),e=c.filter(Se);We.revert(),We.defocus(),b(d.classed(f.focused,!0)),b(e),Kd(We.data.targets)&&Kb(a,!0),Ne(a)},We.defocus=function(a){function b(a){zc(a).transition().duration(100).style("opacity",.3)}var c=ki.selectAll(Yc(a)),d=c.filter(Re),e=c.filter(Se);We.revert(),b(d.classed(f.focused,!1)),b(e),Kd(We.data.targets)&&Lb(a),Oe(a)},We.revert=function(a){function b(a){zc(a).transition().duration(100).style("opacity",1)}var c=ki.selectAll(Yc(a)),d=c.filter(Re),e=c.filter(Se);b(d.classed(f.focused,!1)),b(e),Kd(We.data.targets)&&Lb(a),Pe()},We.show=function(a){Dc(a),ki.selectAll(Yc(a)).transition().style("opacity",1),Ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!1})},We.hide=function(a){Cc(a),ki.selectAll(Yc(a)).transition().style("opacity",0),Ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!1})},We.toggle=function(a){yc(a)?We.hide(a):We.show(a)},We.unzoom=function(){fi.clear().update(),Ce({withUpdateXDomain:!0})},We.load=function(a){return a.xs&&ic(a.xs),"categories"in a&&Mh&&(xg=a.categories,Of.categories(xg)),"cacheIds"in a&&_b(a.cacheIds)?void Je(bc(a.cacheIds),a.done):void("unload"in a?Le("string"==typeof a.unload?[a.unload]:"boolean"==typeof a.unload&&a.unload?vc():a.unload,function(){Ke(a)}):Ke(a))},We.unload=function(a){Le(a?"string"==typeof a?[a]:a:vc(),function(){Ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},We.selected=function(a){return Ve.merge(mi.selectAll("."+f.shapes+Xc(a)).selectAll("."+f.shape).filter(function(){return Ve.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},We.select=function(a,b,c){dg&&mi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=Ve.select(this),i="circle"===this.nodeName?ce:fe,j="circle"===this.nodeName?de:ge,k=eg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?fg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},We.unselect=function(a,b){dg&&mi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=Ve.select(this),g="circle"===this.nodeName?de:ge,h=eg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&fg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},We.toLine=function(a){Ue(a,"line")},We.toSpline=function(a){Ue(a,"spline")},We.toBar=function(a){Ue(a,"bar")},We.toScatter=function(a){Ue(a,"scatter")},We.toArea=function(a){Ue(a,"area")},We.toAreaSpline=function(a){Ue(a,"area-spline")},We.toPie=function(a){Ue(a,"pie",{withTransform:!0})},We.toDonut=function(a){Ue(a,"donut",{withTransform:!0})},We.groups=function(a){return c(a)?Xf:(Xf=a,Ce(),Xf)},We.xgrids=function(a){return a?(ah=a,Ce(),ah):ah},We.xgrids.add=function(a){return a?We.xgrids(ah.concat(a)):void 0},We.xgrids.remove=function(a){var b=Te(a);return We.xgrids(ah.filter(b))},We.ygrids=function(a){return a?(ch=a,Ce(),ch):ch},We.ygrids.add=function(a){return a?We.ygrids(ch.concat(a)):void 0},We.ygrids.remove=function(a){var b=Te(a);return We.ygrids(ch.filter(b))},We.regions=function(a){return c(a)?xh:(xh=a,Ce(),xh)},We.regions.add=function(a){return c(a)?xh:(xh=xh.concat(a),Ce(),xh)},We.regions.remove=function(a,c){var e=[].concat(a);return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;ki.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),xh=xh.filter(function(b){return b.classes.indexOf(a)<0})}),xh},We.data.get=function(a){var b=We.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},We.data.getAsTarget=function(a){var b=xc(function(b){return b.id===a});return b.length>0?b[0]:void 0},We.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Wf[b]=a[b]}),Qe(We.data.targets,{withTransition:!0}),Wf):Wf},We.x=function(a){return arguments.length&&(kc(We.data.targets,a),Ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),We.data.x},We.xs=function(a){return arguments.length&&(lc(We.data.targets,a),Ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),We.data.x},We.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},We.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Jg=+a.y),b(a.y2)&&(Sg=+a.y2)):Jg=Sg=+a,Ce())},We.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Kg=+a.y),b(a.y2)&&(Tg=+a.y2)):Kg=Tg=+a,Ce())},We.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&We.axis.max(a.max),"undefined"!=typeof a.min&&We.axis.min(a.min))},We.resize=function(a){Ze=a?a.width:null,$e=a?a.height:null,He({withLegend:!0,withTransition:!1})},We.destroy=function(){We.data.targets=void 0,We.data.x={},qi.html(""),a.onresize=null},"url"in e.data)Ve.csv(e.data.url,function(a,b){ve(b)});else if("rows"in e.data)ve(nc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");ve(oc(e.data.columns))}return We},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From cf29e8f7f6b7c21b3e899d04713de1c1ee04b077 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Sat, 5 Apr 2014 21:38:49 +0900 Subject: [PATCH 005/178] Fix y axis padding - #126 --- c3.js | 24 ++++++++++++------------ c3.min.js | 4 ++-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/c3.js b/c3.js index ded8642..346a3cc 100644 --- a/c3.js +++ b/c3.js @@ -176,7 +176,7 @@ __axis_y_label = getConfig(['axis', 'y', 'label'], {}), __axis_y_inner = getConfig(['axis', 'y', 'inner'], false), __axis_y_tick_format = getConfig(['axis', 'y', 'tick', 'format']), - __axis_y_padding = getConfig(['axis', 'y', 'padding']), + __axis_y_padding = getConfig(['axis', 'y', 'padding'], {}), __axis_y_ticks = getConfig(['axis', 'y', 'ticks'], 10), __axis_y2_show = getConfig(['axis', 'y2', 'show'], false), __axis_y2_max = getConfig(['axis', 'y2', 'max']), @@ -185,7 +185,7 @@ __axis_y2_label = getConfig(['axis', 'y2', 'label'], {}), __axis_y2_inner = getConfig(['axis', 'y2', 'inner'], false), __axis_y2_tick_format = getConfig(['axis', 'y2', 'tick', 'format']), - __axis_y2_padding = getConfig(['axis', 'y2', 'padding']), + __axis_y2_padding = getConfig(['axis', 'y2', 'padding'], {}), __axis_y2_ticks = getConfig(['axis', 'y2', 'ticks'], 10); // grid @@ -1149,7 +1149,7 @@ domainLength, padding, padding_top, padding_bottom, center = axisId === 'y2' ? __axis_y2_center : __axis_y_center, yDomainAbs, widths, diff, ratio, - showDataLabel = hasDataLabel() && __axis_rotated; + showHorizontalDataLabel = hasDataLabel() && __axis_rotated; if (yTargets.length === 0) { // use current domain if target of axisId is none return axisId === 'y2' ? y2.domain() : y.domain(); } @@ -1157,12 +1157,20 @@ yDomainMin < 0 ? yDomainMax = 0 : yDomainMin = 0; } domainLength = Math.abs(yDomainMax - yDomainMin); - padding = padding_top = padding_bottom = showDataLabel ? 0 : domainLength * 0.1; + padding = padding_top = padding_bottom = showHorizontalDataLabel ? 0 : domainLength * 0.1; if (center) { yDomainAbs = Math.max(Math.abs(yDomainMin), Math.abs(yDomainMax)); yDomainMax = yDomainAbs - center; yDomainMin = center - yDomainAbs; } + // add padding for data label + if (showHorizontalDataLabel) { + widths = getDataLabelWidth(yDomainMin, yDomainMax); + diff = diffDomain(y.range()); + ratio = [widths[0] / diff, widths[1] / diff]; + padding_top += domainLength * (ratio[1] / (1 - ratio[0] - ratio[1])); + padding_bottom += domainLength * (ratio[0] / (1 - ratio[0] - ratio[1])); + } if (axisId === 'y' && __axis_y_padding) { padding_top = isValue(__axis_y_padding.top) ? __axis_y_padding.top : padding; padding_bottom = isValue(__axis_y_padding.bottom) ? __axis_y_padding.bottom : padding; @@ -1171,14 +1179,6 @@ padding_top = isValue(__axis_y2_padding.top) ? __axis_y2_padding.top : padding; padding_bottom = isValue(__axis_y2_padding.bottom) ? __axis_y2_padding.bottom : padding; } - // add padding for data label - if (showDataLabel) { - widths = getDataLabelWidth(yDomainMin, yDomainMax); - diff = diffDomain(y.range()); - ratio = [widths[0] / diff, widths[1] / diff]; - padding_top += domainLength * (ratio[1] / (1 - ratio[0] - ratio[1])); - padding_bottom += domainLength * (ratio[0] / (1 - ratio[0] - ratio[1])); - } // Bar chart with only positive values should be 0-based if (hasBarType(yTargets) && !hasNegativeValueInTargets(yTargets)) { padding_bottom = yDomainMin; diff --git a/c3.min.js b/c3.min.js index 2813586..e0421c1 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;clf&&(lf=0),0>nf&&(nf=0),jf={top:vg?hf.top:qf-pg-($h?0:rf),right:0/0,bottom:20+($h?0:rf),left:vg?ci:hf.left},mf=vg?hf.left-ci-di:lf,of=vg?nf:qf-jf.top-jf.bottom,0>mf&&(mf=0),0>of&&(of=0),kf={top:$h?0:qf-rf,right:0/0,bottom:0,left:$h?pf-sf:0},p(),$h&&Kd(We.data.targets)&&(kf.left=lf/2+uf)}function o(){mi.select("line."+f.xgridFocus).attr("x1",vg?0:-10).attr("x2",vg?lf:-10).attr("y1",vg?-10:hf.top).attr("y2",vg?-10:nf)}function p(){uf=nf/2,tf=.95*uf,vf=Jd(We.data.targets)?.6*tf:0}function q(){var a=vg?f.axisX:f.axisY,b=Ve.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Ve.select(Ye).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Ze?Ze:x()}function s(){var a=$e?$e:y();return a>0?a:320}function t(){return Kd(We.data.targets)?0:_e?_e:vg||!Ig||Ng?1:v("y")}function u(){var a=1;return Kd(We.data.targets)?0:af?af:$h?sf+(Rg&&!vg?v("y2"):a):Rg?Wg||vg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||Ig?"y2"!==a||Rg?(gb(a).isInner?30:40)+("y2"===a?-10:0):ei:rg&&!$h?10:1}function x(){return+Ve.select(Ye).style("width").replace("px","")}function y(){return+Ve.select(Ye).style("height").replace("px","")}function z(a){return a?-5:-(hf.left-1)}function A(a){return a?-20:-1}function B(){return z(!vg)}function C(){return A(!vg)}function D(){return z(vg)}function E(){return A(vg)}function F(a){return a?lf+2+4:hf.left+20}function G(a){return a?80:nf+2}function H(){return F(!vg)}function I(){return G(!vg)}function J(){return F(vg)}function K(){return G(vg)}function L(){var a=vg?nf:lf,b=tc(),c=Vb()*(Gd(We.data.targets)?(b-(Mh?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){_h=a}function N(a){ai=a}function O(a){bi=a}function P(){return rg?$h?ai*(_h+1):pf:0}function Q(){return rg?$h?qf:bi*(_h+1):0}function R(){var a,b=!If;Af=vg?1:0,Bf=vg?nf:lf,Cf=vg?0:nf,Df=vg?lf:1,Ef=Af,Ff=Bf,Gf=vg?0:of,Hf=vg?mf:1,If=T(Af,Bf,b?void 0:If.domain(),function(){return Of.tickOffset()}),Jf=U(Cf,Df),Kf=U(Cf,Df),Lf=T(Af,Bf,ri,function(a){return a%1?0:Rf.tickOffset()}),Mf=U(Gf,Hf),Nf=U(Gf,Hf),a=$(),Of=X(If,Vh,a),Rf=X(Lf,Yh,a),Pf=Y(Jf,Wh,Og,Qg),Qf=Y(Kf,Xh,Xg,Zg),b||(fi.scale(Lf),bf&&ji.scale(If)),S()}function S(){wf=Db(),xf=Eb(),yf=Eb(.98)}function T(a,b,e,f){var g=(Lh?Ve.time.scale():Ve.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),Mh){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return Ve.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?Kf:Jf}function W(a){return"y2"===Z(a)?Nf:Mf}function X(a,b,c){var d=(Mh?Bb():Ve.svg.axis()).scale(a).orient(b);return d.tickFormat(c),Mh?d.tickCentered(yg):d.tickOffset=function(){var a=vg?nf:lf;return a*Vb()/tc()/2},Mh&&d.categories(xg),d}function Y(a,b,c,d){return Ve.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Yf?Yf[a]:"y"}function $(){var a=Lh?Th:Mh?Ic:function(a){return 0>a?a.toFixed(0):a};return zg&&("function"==typeof zg?a=zg:Lh&&(a=function(a){return Ve.time.format(zg)(a)})),a}function _(a){var b;return"y"===a?b=Mg:"y2"===a?b=Vg:"x"===a&&(b=Hg),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Mg=b:"y2"===a?Vg=b:"x"===a&&(Hg=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",vg?"inner-top":"inner-right")}function eb(){return cb("y",vg?"inner-right":"inner-top")}function fb(){return cb("y2",vg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?lf/2:lf:b.isBottom?-nf:b.isMiddle?-nf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!vg,db())}function ob(){return kb(vg,eb())}function pb(){return kb(vg,fb())}function qb(){return lb(!vg,db())}function rb(){return lb(vg,eb())}function sb(){return lb(vg,fb())}function tb(){var a=db();return vg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return vg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return vg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!vg,db())}function xb(){return mb(vg,eb())}function yb(){return mb(vg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return Ve.selectAll("."+c+" .tick text").each(function(){var a=this.getBBox();bb?20:b}function Ab(){mi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),mi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),mi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+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=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]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return Ve.min(Object.keys(i).map(function(a){return Ve.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=vc(a),i=Ec(a);if(Xf.length>0)for(g=Hc(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 Ve.max(Object.keys(i).map(function(a){return Ve.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Tg:Kg,n="y2"===c?Sg:Jg,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?Ug:Lg,r=bd()&&vg;return 0===l.length?"y2"===c?Kf.domain():Jf.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&&Pg&&(f=b(Pg.top)?Pg.top:e,g=b(Pg.bottom)?Pg.bottom:e),"y2"===c&&Yg&&(f=b(Yg.top)?Yg.top:e,g=b(Yg.bottom)?Yg.bottom:e),r&&(i=cd(o,p),j=$b(Jf.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]))),Gd(l)&&!Gc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(ri),c=$b(If.domain());return a||0===c?1:b/c}function Wb(a){return Fg?Fg:Ve.min(a,function(a){return Ve.min(a.values,function(a){return a.x})})}function Xb(a){return Eg?Eg:Ve.max(a,function(a){return Ve.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return Mh?d=0:Gd(a)?(c=tc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=Lh?new Date(c.getTime()-e):c-e,g=Lh?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return Sf&&a===Sf||$d(Tf)&&_d(Tf,a)}function fc(a){return!ec(a)}function gc(a){return Sf?Sf:$d(Tf)?Tf[a]:null}function hc(a,b){return a in We.data.x&&We.data.x[a]&&We.data.x[a][b]?We.data.x[a][b]:b}function ic(a){Object.keys(a).forEach(function(b){Tf[b]=a[b]})}function jc(a){var b;return a&&(b=Wf[a.id],a.name=b?b:a.id),a}function kc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=mc(b[d],a.id,d)}),We.data.x[a.id]=b})}function lc(a,b){a.forEach(function(a){b[a.id]&&kc([a],b[a.id])})}function mc(a,b,c){var d;return d=Lh?a?a instanceof Date?a:Wd(a):Wd(hc(b,c)):Nh&&!Mh?a?+a:hc(b,c):c}function nc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0&&(We.data.x[b]=a.map(function(a){return a[c]})):We.data.x[b]=a.map(function(a,b){return b})}),c.forEach(function(a){if(!We.data.x[a])throw new Error('x is not defined for id = "'+a+'".')}),b=c.map(function(b,c){var d=Vf(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=mc(g,b,e);return Nh&&Mh&&0===c&&g&&(0===e&&(xg=[]),xg.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++})}),Zf&&Ed(vc(b).filter(function(a){return!(a in $f)}),Zf),b.forEach(function(a){ac(a.id_org,a)}),b}function qc(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 rc(a){return a>0&&We.data.targets[0].values[a-1]?We.data.targets[0].values[a-1].x:void 0}function sc(a){return a1?We.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?We.data.targets[0]:null,a}function vc(a){return a=c(a)?We.data.targets:a,a.map(function(a){return a.id})}function wc(a){var b,c=vc();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(Lh?new Date(h):h);i.push(d)}return i}function Cc(a){Uh=Uh.concat(a)}function Dc(a){Uh=Uh.filter(function(b){return a.indexOf(b)<0})}function Ec(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Fc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Hc(a){return Fc(a,function(a){return a>0})}function Ic(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(kd(a,f))),a[g].x&&(e=e.concat(kd(a,g))),nd(e,b)):ld(a,b,f,g)}function md(a,b){var c;return c=a.map(function(a){return ld(a.values,b)}),nd(c,b)}function nd(a,b){var c,d;return a.forEach(function(a){var e=ae(a,b);(c>e||!c)&&(c=e,d=a)}),d}function od(a,b){return Ve.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function pd(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 qd(){return ag&&"desc"===ag.toLowerCase()}function rd(){return ag&&"asc"===ag.toLowerCase()}function sd(a){var b=rd(),c=qd();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 ag&&a.sort(ag),a}function td(a,c){var d,e,f,g,h,i,j,k=Kd(We.data.targets),l=k?ed:dd,m=a.filter(function(a){return a&&b(a.value)});yh&&0!==m.length&&(pi.html(Bh(a,$(),l,Sh)).style("display","block"),d=pi.property("offsetWidth"),e=pi.property("offsetHeight"),k?(g=lf/2+c[0],i=nf/2+c[1]+20):(vg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=If(m[0].x)+20):(f=q(),g=f+t()+If(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),pi.style("top",i+"px").style("left",g+"px"))}function ud(){pi.style("display","none")}function vd(a){var c=a.filter(function(a){return a&&b(a.value)});yh&&(Hd(We.data.targets)||Kd(We.data.targets)||mi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(vg?"y1":"x1",gd).attr(vg?"y2":"x2",gd))}function wd(){mi.select("line."+f.xgridFocus).style("visibility","hidden")}function xd(a){return a.x||0===a.x?If(a.x):null}function yd(a){return V(a.id)(a.value)}function zd(){var a,b,d={},e=0;return zc(xc(Nd)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Dd(a,b){return kh?kh:b?2*a.tickOffset()*lh/b:0}function Ed(a,b){var c,d=a?"string"==typeof a?[a]:a:vc();for(c=0;c0}function _d(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ae(a,b){var c="y"===Z(a.id)?Jf:Kf;return Math.pow(If(a.x)-b[0],2)+Math.pow(c(a.value)-b[1],2)}function be(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function ce(a,b,c){kg(b,a.node()),mi.select("."+f.selectedCircles+Xc(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Jc(f.selectedCircle,c)}).attr("cx",vg?yd:xd).attr("cy",vg?xd:yd).attr("stroke",function(){return Sh(b.id)}).attr("r",1.4*jh).transition().duration(100).attr("r",jh)}function de(a,b,c){lg(b,a.node()),mi.select("."+f.selectedCircles+Xc(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ee(a,b,c,d){a?ce(b,c,d):de(b,c,d)}function fe(a,b){kg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ve.rgb(Sh(b.id)).darker(1)})}function ge(a,b){lg(b,a.node()),a.transition().duration(100).style("fill",function(){return Sh(b.id)})}function he(a,b,c,d){a?fe(b,c,d):ge(b,c,d)}function ie(a){return a.filter(function(a){return b(a.value)})}function je(a,c){return(c?mi.selectAll("."+f.circles+Xc(c)):mi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ke(a,b){je(a,b).classed(f.EXPANDED,!0).attr("r",ih)}function le(a){je(a).filter(function(){return Ve.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",fh)}function me(a){return mi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function ne(a){me(a).classed(f.EXPANDED,!0)}function oe(a){me(a).classed(f.EXPANDED,!1)}function pe(a,b){var c=te(a,b);return function(a,b){var d=c(a,b),e=vg?1:0,f=vg?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 qe(a,b){var c=te(a,!1),d=b?re:se;return function(a,b){return d(c(a,b),a,this)}}function re(a,b){var c;return vg?(c=Nd(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function se(a,b,c){var d=c.getBBox();return vg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:Nd(b)?-3:-6)}function te(a,b){var c=a.__max__+1,d=Dd(Of,c),e=Ad(d,c,a,!!b),f=Bd(!!b),g=Cd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return vg&&(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 ue(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 ve(b){var c,d,e;if(qi=Ve.select(Ye),qi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(qi.html(""),qi.classed("c3",!0),We.data.x={},We.data.targets=pc(b),n(),R(),If.domain(Ve.extent(Zb(We.data.targets))),Jf.domain(Ub(We.data.targets,"y")),Kf.domain(Ub(We.data.targets,"y2")),Lf.domain(If.domain()),Mf.domain(Jf.domain()),Nf.domain(Kf.domain()),ri=If.domain(),fi.scale(Lf),bf&&ji.scale(If),ki=qi.append("svg").attr("width",lf+hf.left+hf.right).attr("height",nf+hf.top+hf.bottom).on("mouseenter",ef).on("mouseleave",ff),li=ki.append("defs"),li.append("clipPath").attr("id",Fh).append("rect").attr("width",lf).attr("height",nf),li.append("clipPath").attr("id",Gh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),li.append("clipPath").attr("id",Hh).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),mi=ki.append("g").attr("transform",Zh.main),ni=og?ki.append("g").attr("transform",Zh.context):null,oi=rg?ki.append("g").attr("transform",Zh.legend):null,pi=Ve.select(Ye).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),mi.append("g").attr("class",f.axisX).attr("clip-path",vg?"":Jh).attr("transform",Zh.x).append("text").attr("class",f.axisXLabel).attr("transform",vg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),Ig&&mi.append("g").attr("class",f.axisY).attr("clip-path",vg?Kh:"").append("text").attr("class",f.axisYLabel).attr("transform",vg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),Rg&&mi.append("g").attr("class",f.axisY2).attr("transform",Zh.y2).append("text").attr("class",f.axisY2Label).attr("transform",vg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=mi.append("g").attr("clip-path",Ih).attr("class",f.grid),$g&&d.append("g").attr("class",f.xgrids),$d(ah)&&d.append("g").attr("class",f.xgridLines),gh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),bh&&d.append("g").attr("class",f.ygrids),$d(ch)&&d.append("g").attr("class",f.ygridLines),mi.append("g").attr("clip-path",Ih).attr("class",f.regions),mi.append("g").attr("clip-path",Ih).attr("class",f.chart),c=mi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",bf?vg?"ns-resize":"ew-resize":null),mi.select("."+f.chart).append("g").attr("class",f.chartBars),mi.select("."+f.chart).append("g").attr("class",f.chartLines),mi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Zh.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),mi.select("."+f.chart).append("g").attr("class",f.chartTexts),bf&&mi.insert("rect",df?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",lf).attr("height",nf).style("opacity",0).style("cursor",vg?"ns-resize":"ew-resize").call(ji).on("dblclick.zoom",null),Gg&&fi.extent("function"!=typeof Gg?Gg:Gg(Zb())),og&&(ni.append("g").attr("clip-path",Ih).attr("class",f.chart),ni.select("."+f.chart).append("g").attr("class",f.chartBars),ni.select("."+f.chart).append("g").attr("class",f.chartLines),ni.append("g").attr("clip-path",Ih).attr("class",f.brush).call(fi).selectAll("rect").attr(vg?"width":"height",vg?mf:of),ni.append("g").attr("class",f.axisX).attr("transform",Zh.subx).attr("clip-path",vg?"":Jh)),Ie(We.data.targets),vg?mi.select("."+f.axisX).style("opacity",0).call(Of):(mi.select("."+f.axisY).style("opacity",0).call(Pf),mi.select("."+f.axisY2).style("opacity",0).call(Qf)),He({withTransform:!0,withLegend:!0,withTransitionForAxis:!1}),Ch){if(Lh&&"string"==typeof Dh){for(Dh=Wd(Dh),e=0;e0){d=[];for(var g in Wf)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=pd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=he,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 Ae(a){Kd(We.data.targets)||dg&&(Oh=a,mi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ph=!0,mg())}function Be(){Kd(We.data.targets)||dg&&(mi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),mi.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ph=!1,ng())}function Ce(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P=zd(),Q=Kd(We.data.targets),R=zc(We.data.targets);if(0!==R.length){if(a=d(a)?a:{},v=d(a.withY)?a.withY:!0,w=d(a.withSubchart)?a.withSubchart:!0,x=d(a.withTransition)?a.withTransition:!0,A=d(a.withTransform)?a.withTransform:!1,B=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,C=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,D=d(a.withLegend)?a.withLegend:!1,y=d(a.withTransitionForExit)?a.withTransitionForExit:x,z=d(a.withTransitionForAxis)?a.withTransitionForAxis:x,I=x?gf:0,J=y?I:0,K=z?I:0,D&&rg&&Qe(We.data.targets,a),C&&(If.domain(Ve.extent(Zb(R))),ri=If.domain(),bf&&ji.scale(If).updateScaleExtent(),Lf.domain(If.domain()),fi.scale(Lf)),B&&(If.domain(fi.empty()?ri:fi.extent()),bf&&ji.scale(If).updateScaleExtent(),Hd(R)||(M=Bc(Ac(R)),Of.tickValues(M),Rf.tickValues(M))),Jf.domain(Ub(R,"y")),Kf.domain(Ub(R,"y2")),mi.select("."+f.axisX).style("opacity",Q?0:1).transition().duration(K).call(Of),mi.select("."+f.axisY).style("opacity",Q?0:1).transition().duration(K).call(Pf),mi.select("."+f.axisY2).style("opacity",Q?0:1).transition().duration(K).call(Qf),B&&Ag&&M){for(N=1;N=V;V++)e.push(new Date(V+"-01-01 00:00:00"))}else e=If.ticks(10);c=mi.select("."+f.xgrids).selectAll("."+f.xgrid).data(e),c.enter().append("line").attr("class",f.xgrid),c.attr("x1",vg?0:function(a){return If(a)-Of.tickOffset()}).attr("x2",vg?lf:function(a){return If(a)-Of.tickOffset()}).attr("y1",vg?function(a){return If(a)-Of.tickOffset()}:hf.top).attr("y2",vg?function(a){return If(a)-Of.tickOffset()}:nf).style("opacity",function(){return+Ve.select(this).attr(vg?"y1":"x1")===(vg?nf:0)?0:1}),c.exit().remove()}$d(ah)&&(g=mi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(ah),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",vg?"":"rotate(-90)").attr("dx",vg?0:-hf.top).attr("dy",-5).style("opacity",0),g.select("line").transition().duration(I).attr("x1",vg?0:hd).attr("x2",vg?lf:hd).attr("y1",vg?hd:hf.top).attr("y2",vg?hd:nf).style("opacity",1),g.select("text").transition().duration(I).attr("x",vg?lf:0).attr("y",hd).text(function(a){return a.text}).style("opacity",1),g.exit().transition().duration(I).style("opacity",0).remove()),v&&bh&&(i=mi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Jf.ticks(dh)),i.enter().append("line").attr("class",f.ygrid),i.attr("x1",vg?Jf:0).attr("x2",vg?Jf:lf).attr("y1",vg?0:Jf).attr("y2",vg?nf:Jf),i.exit().remove()),v&&$d(ch)&&(j=mi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(ch),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",vg?"rotate(-90)":"").attr("dx",vg?0:-hf.top).attr("dy",-5).style("opacity",0),j.select("line").transition().duration(I).attr("x1",vg?id:0).attr("x2",vg?id:lf).attr("y1",vg?0:id).attr("y2",vg?nf:id).style("opacity",1),j.select("text").transition().duration(I).attr("x",vg?0:lf).attr("y",id).text(function(a){return a.text}).style("opacity",1),j.exit().transition().duration(I).style("opacity",0).remove()),m=mi.selectAll("."+f.bars).selectAll("."+f.bar).data(Sd),m.enter().append("path").attr("d",E).style("stroke","none").style("opacity",0).style("fill",function(a){return Sh(a.id)}).attr("class",Rc),m.style("opacity",Zc).transition().duration(I).attr("d",E).style("opacity",1),m.exit().transition().duration(J).style("opacity",0).remove(),p=mi.selectAll("."+f.texts).selectAll("."+f.text).data(Ud),p.enter().append("text").attr("class",Kc).attr("text-anchor",function(a){return vg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),p.text(function(a){return fd(a.id)(a.value)}).style("fill-opacity",$c).transition().duration(I).attr("x",G).attr("y",H).style("fill-opacity",ad),p.exit().transition().duration(J).style("fill-opacity",0).remove(),mi.selectAll("."+f.line).style("opacity",Zc).transition().duration(I).attr("d",gi).style("opacity",1),mi.selectAll("."+f.area).style("opacity",0).transition().duration(I).attr("d",hi).style("opacity",si),l=mi.selectAll("."+f.circles).selectAll("."+f.circle).data(Td),l.enter().append("circle").attr("class",Pc).style("opacity",0).attr("r",fh),l.style("opacity",Zc).transition().duration(I).style("opacity",_c).attr("cx",vg?yd:xd).attr("cy",vg?xd:yd),l.exit().remove(),mi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",A?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(I).attrTween("d",function(a){var b,c=Cb(a);return c?(b=Ve.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",A?"scale(1)":"").style("opacity",1),mi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(I).text(Jb).style("opacity",function(a){return yc(a.data.id)&&Rd(a.data)?1:0}),mi.select("."+f.chartArcsTitle).style("opacity",Jd(We.data.targets)?1:0),og&&(null!==Ve.event&&"zoom"===Ve.event.type&&fi.extent(If.orgDomain()).update(),w&&(ni.select("."+f.axisX).style("opacity",Q?0:1).transition().duration(I).call(Rf),fi.empty()||fi.extent(If.orgDomain()).update(),F=pe(P,!0),q=ni.selectAll("."+f.bars).selectAll("."+f.bar).data(Sd),q.enter().append("path").attr("d",F).style("stroke","none").style("fill",function(a){return Sh(a.id)}).attr("class",Rc),q.style("opacity",Zc).transition().duration(I).attr("d",F).style("opacity",1),q.exit().transition().duration(I).style("opacity",0).remove(),ni.selectAll("."+f.line).style("opacity",Zc).transition().duration(I).attr("d",ii).style("opacity",1))),mi.selectAll("."+f.selectedCircles).filter(function(a){return Nd(a)}).selectAll("circle").remove(),mi.selectAll("."+f.selectedCircle).transition().duration(I).attr("cx",vg?yd:xd).attr("cy",vg?xd:yd),$d(Tf)?(r=mi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),xe(r.enter()),r.attr("x",0).attr("y",0).attr("width",lf).attr("height",nf)):(Nh&&!Mh?(u=function(a,b){var c=rc(b),d=sc(b),e=We.data.x[a.id][b];return(If(d?d:e+50)-If(c?c:e-50))/2},t=function(a,b){var c=rc(b),d=We.data.x[a.id][b];return(If(d)+If(c?c:d-50))/2}):(u=L(),t=function(a){return If(a.x)-u/2}),s=uc(),mi.select("."+f.eventRects).datum(s?s.values:[]),r=mi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),we(r.enter()),r.attr("class",Wc).attr("x",vg?0:t).attr("y",vg?t:0).attr("width",vg?lf:u).attr("height",vg?u:nf),r.exit().remove()),n=mi.select("."+f.regions).selectAll("rect."+f.region).data(xh),n.enter().append("rect").style("fill-opacity",0),n.attr("class",Vc).attr("x",vg?0:cc).attr("y",vg?cc:hf.top).attr("width",vg?lf:dc).attr("height",vg?dc:nf).transition().duration(I).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),n.exit().transition().duration(I).style("fill-opacity",0).remove(),vc().forEach(function(a){ti[a]=!0})}}function De(){Ce({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ee(){return"mousemove"===Ve.event.sourceEvent.type&&ji.altDomain?(If.domain(ji.altDomain),void ji.scale(If).updateScaleExtent()):(Mh&&If.orgDomain()[0]===ri[0]&&If.domain([ri[0]-1e-10,If.orgDomain()[1]]),Ce({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Ve.event.sourceEvent.type&&(Qh=!0)))}function Fe(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ge(){ki.attr("width",pf).attr("height",qf),ki.select("#"+Fh).select("rect").attr("width",lf).attr("height",nf),ki.select("#"+Gh).select("rect").attr("width",H),ki.select("#"+Hh).select("rect").attr("width",J),ki.select("."+f.zoomRect).attr("width",lf).attr("height",nf)}function He(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(),R(),Ge(),m(a.withTransition),Ce(a)}function Ie(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=mi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a),j=i.enter().append("g").attr("class",function(a){return f.chartText+Jc(f.target,a.id)}).style("pointer-events","none"),j.append("g").attr("class",Lc).style("fill",function(a){return Sh(a.id)}),e=mi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),d=e.enter().append("g").attr("class",function(a){return f.chartBar+Jc(f.target,a.id)}).style("pointer-events","none"),d.append("g").attr("class",Sc).style("fill",function(a){return Sh(a.id)}).style("stroke","none").style("cursor",function(a){return fg(a)?"pointer":null}),c=mi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),b=c.enter().append("g").attr("class",function(a){return f.chartLine+Jc(f.target,a.id)}).style("pointer-events","none"),b.append("path").attr("class",Oc).style("opacity",0).style("stroke",function(a){return Sh(a.id)}),b.append("path").attr("class",Uc).style("opacity",function(){return si=+Ve.select(this).style("opacity"),0}).style("fill",function(a){return Sh(a.id)}),b.append("g").attr("class",function(a){return Jc(f.selectedCircles,a.id)}),b.append("g").attr("class",Qc).style("fill",function(a){return Sh(a.id)}).style("cursor",function(a){return fg(a)?"pointer":null}),a.forEach(function(a){mi.selectAll("."+f.selectedCircles+Xc(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=mi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(zf(a)),g=h.enter().append("g").attr("class",function(a){return f.chartArc+Jc(f.target,a.data.id)}),g.append("path").attr("class",Tc).style("opacity",0).style("fill",function(a){return Sh(a.data.id)}).style("cursor",function(a){return fg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),Ne(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];td(c,Ve.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),Pe(),ud(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),og&&(n=ni.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),m=n.enter().append("g").attr("class",function(a){return f.chartBar+Jc(f.target,a.id)}),m.append("g").attr("class",Sc).style("fill",function(a){return Sh(a.id)}),l=ni.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),k=l.enter().append("g").attr("class",function(a){return f.chartLine+Jc(f.target,a.id)}),k.append("path").attr("class",Oc).style("opacity",0).style("stroke",function(a){return Sh(a.id)})),ki.selectAll("."+f.target).filter(function(a){return yc(a.id)}).transition().style("opacity",1)}function Je(a,b){We.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=$h?i:h,k=$h?rf:sf;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=$h?u:t,ug?(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=vc(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,$h?(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=oi.selectAll("."+f.legendItem).data(q).enter().append("g").attr("class",function(a){return Jc(f.legendItem,a)}).style("cursor","pointer").on("click",function(a){"function"==typeof tg?tg(a):We.toggle(a)}).on("mouseover",function(a){We.focus(a)}).on("mouseout",function(){We.revert()}),g.append("text").text(function(a){return d(Wf[a])?Wf[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",$h?i:-200).attr("y",$h?-200:l),g.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",$h?j:-200).attr("y",$h?-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 Sh(a)}).attr("x",$h?i:-200).attr("y",$h?-200:k).attr("width",10).attr("height",10),oi.selectAll("text").data(q).text(function(a){return d(Wf[a])?Wf[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",i).attr("y",l),oi.selectAll("rect."+f.legendItemEvent).data(q).transition().duration(p?250:0).attr("x",j).attr("y",o),oi.selectAll("rect."+f.legendItemTile).data(q).transition().duration(p?250:0).attr("x",h).attr("y",k),N(t),O(u),M(C),n(),R(),Ge(),m(!1)}function Re(a){return wc(a.id)}function Se(a){return"data"in a&&wc(a.data.id)}function Te(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 Ue(a,b,c){var d=!Kd(We.data.targets);Ed(a,b),He(c?c:{withTransitionForAxis:d})}var Ve=a.d3?a.d3:a.require?a.require("d3"):void 0,We={data:{},axis:{}},Xe={},Ye=h(["bindto"],"#chart"),Ze=h(["size","width"]),$e=h(["size","height"]),_e=h(["padding","left"]),af=h(["padding","right"]),bf=h(["zoom","enabled"],!1),cf=h(["zoom","extent"]),df=h(["zoom","privileged"],!1),ef=h(["onenter"],function(){}),ff=h(["onleave"],function(){}),gf=h(["transition","duration"],350);g("data","data is required in config");var 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,Rf,Sf=h(["data","x"]),Tf=h(["data","xs"],{}),Uf=h(["data","x_format"]),Vf=h(["data","id_converter"],function(a){return a}),Wf=h(["data","names"],{}),Xf=h(["data","groups"],[]),Yf=h(["data","axes"],{}),Zf=h(["data","type"]),$f=h(["data","types"],{}),_f=h(["data","labels"],{}),ag=h(["data","order"]),bg=h(["data","regions"],{}),cg=h(["data","colors"],{}),dg=h(["data","selection","enabled"],!1),eg=h(["data","selection","grouped"],!1),fg=h(["data","selection","isselectable"],function(){return!0}),gg=h(["data","selection","multiple"],!0),hg=h(["data","onclick"],function(){}),ig=h(["data","onenter"],function(){}),jg=h(["data","onleave"],function(){}),kg=h(["data","onselected"],function(){}),lg=h(["data","onunselected"],function(){}),mg=h(["data","ondragstart"],function(){}),ng=h(["data","ondragend"],function(){}),og=h(["subchart","show"],!1),pg=og?h(["subchart","size","height"],60):0,qg=h(["color","pattern"],[]),rg=h(["legend","show"],!0),sg=h(["legend","position"],"bottom"),tg=h(["legend","item","onclick"]),ug=h(["legend","equally"],!1),vg=h(["axis","rotated"],!1),wg=h(["axis","x","type"],"indexed"),xg=h(["axis","x","categories"],[]),yg=h(["axis","x","tick","centered"],!1),zg=h(["axis","x","tick","format"]),Ag=h(["axis","x","tick","culling"],{}),Bg=h(["axis","x","tick","culling","max"],"categorized"===wg?1/0:10),Cg=h(["axis","x","tick","count"]),Dg=h(["axis","x","tick","fit"],!1),Eg=h(["axis","x","max"]),Fg=h(["axis","x","min"]),Gg=h(["axis","x","default"]),Hg=h(["axis","x","label"],{}),Ig=h(["axis","y","show"],!0),Jg=h(["axis","y","max"]),Kg=h(["axis","y","min"]),Lg=h(["axis","y","center"]),Mg=h(["axis","y","label"],{}),Ng=h(["axis","y","inner"],!1),Og=h(["axis","y","tick","format"]),Pg=h(["axis","y","padding"]),Qg=h(["axis","y","ticks"],10),Rg=h(["axis","y2","show"],!1),Sg=h(["axis","y2","max"]),Tg=h(["axis","y2","min"]),Ug=h(["axis","y2","center"]),Vg=h(["axis","y2","label"],{}),Wg=h(["axis","y2","inner"],!1),Xg=h(["axis","y2","tick","format"]),Yg=h(["axis","y2","padding"]),Zg=h(["axis","y2","ticks"],10),$g=h(["grid","x","show"],!1),_g=h(["grid","x","type"],"tick"),ah=h(["grid","x","lines"],[]),bh=h(["grid","y","show"],!1),ch=h(["grid","y","lines"],[]),dh=h(["grid","y","ticks"],10),eh=h(["point","show"],!0),fh=eh?h(["point","r"],2.5):0,gh=h(["point","focus","line","enabled"],!0),hh=h(["point","focus","expand","enabled"],!0),ih=h(["point","focus","expand","r"],hh?4:fh),jh=h(["point","focus","select","r"],8),kh=h(["bar","width"]),lh=h(["bar","width","ratio"],.6),mh=h(["pie","label","show"],!0),nh=h(["pie","label","format"]),oh=h(["pie","onclick"],function(){}),ph=h(["pie","onmouseover"],function(){}),qh=h(["pie","onmouseout"],function(){}),rh=h(["donut","label","show"],!0),sh=h(["donut","label","format"]),th=h(["donut","title"],""),uh=h(["donut","onclick"],function(){}),vh=h(["donut","onmouseover"],function(){}),wh=h(["donut","onmouseout"],function(){}),xh=h(["regions"],[]),yh=h(["tooltip","show"],!0),zh=h(["tooltip","format","title"]),Ah=h(["tooltip","format","value"]),Bh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=zh?zh:b,l=Ah?Ah: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+""}),Ch=h(["tooltip","init","show"],!1),Dh=h(["tooltip","init","x"],0),Eh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Fh=("string"==typeof Ye?Ye.replace("#",""):Ye.id)+"-clip",Gh=Fh+"-xaxis",Hh=Fh+"-yaxis",Ih=i(Fh),Jh=i(Jh),Kh=i(Kh),Lh="timeseries"===wg,Mh="categorized"===wg,Nh=!Lh&&(Sf||$d(Tf)),Oh=null,Ph=!1,Qh=!1,Rh=!1,Sh=Vd(cg,qg),Th=function(){var a=[[Ve.time.format("%Y/%-m/%-d"),function(){return!0}],[Ve.time.format("%-m/%-d"),function(a){return a.getMonth()}],[Ve.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ve.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ve.time.format("%I %p"),function(a){return a.getHours()}],[Ve.time.format("%I:%M"),function(a){return a.getMinutes()}],[Ve.time.format(":%S"),function(a){return a.getSeconds()}],[Ve.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)}}(),Uh=[],Vh=vg?"left":"bottom",Wh=vg?Ng?"top":"bottom":Ng?"right":"left",Xh=vg?Wg?"bottom":"top":Wg?"left":"right",Yh=vg?"left":"bottom",Zh={main:function(){return"translate("+hf.left+","+hf.top+")"},context:function(){return"translate("+jf.left+","+jf.top+")"},legend:function(){return"translate("+kf.left+","+kf.top+")"},x:function(){return"translate(0,"+(vg?0:nf)+")"},y:function(){return"translate(0,"+(vg?nf:0)+")"},y2:function(){return"translate("+(vg?0:lf)+","+(vg?1:0)+")"},subx:function(){return"translate(0,"+(vg?0:of)+")"},arc:function(){return"translate("+lf/2+","+nf/2+")"}},$h="right"===sg,_h=0,ai=0,bi=0,ci=30,di=30,ei=5;zf=Ve.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var fi,gi=function(){var a=Ve.svg.line().x(vg?function(a){return V(a.id)(a.value)}:gd).y(vg?gd:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=ie(b.values);return Ld(b)?(a.interpolate(Md(b)?"cardinal":"linear"),bg[b.id]?ue(e,If,V(b.id),bg[b.id]):a(e)):(c=If(e[0].x),d=V(b.id)(e[0].value),vg?"M "+d+" "+c:"M "+c+" "+d)}}(),hi=function(){var a;return a=vg?Ve.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(gd):Ve.svg.area().x(gd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=ie(b.values);return Fd([b],"area")||Fd([b],"area-spline")?(a.interpolate(Md(b)?"cardinal":"linear"),a(e)):(c=If(e[0].x),d=V(b.id)(e[0].value),vg?"M "+d+" "+c:"M "+c+" "+d)}}(),ii=function(){var a=Ve.svg.line().x(vg?function(a){return W(a.id)(a.value)}:jd).y(vg?jd:function(a){return W(a.id)(a.value)});return function(b){var c=ie(b.values);return Ld(b)?a(c):"M "+Lf(c[0].x)+" "+W(b.id)(c[0].value)}}(),ji=function(){};fi=Ve.svg.brush().on("brush",De),fi.update=function(){return ni&&ni.select("."+f.brush).call(this),this},fi.scale=function(a){return vg?this.y(a):this.x(a)},bf&&(ji=Ve.behavior.zoom().on("zoomstart",function(){ji.altDomain=Ve.event.sourceEvent.altKey?If.orgDomain():null}).on("zoom",bf?Ee:null),ji.scale=function(a){return vg?this.y(a):this.x(a)},ji.orgScaleExtent=function(){var a=cf?cf:[1,10];return[a[0],Math.max(tc()/a[1],a[1])]},ji.updateScaleExtent=function(){var a=$b(If.orgDomain())/$b(ri),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var ki,li,mi,ni,oi,pi,qi,ri,si,ti={};if(We.focus=function(a){function b(a){zc(a).transition().duration(100).style("opacity",1)}var c=ki.selectAll(Yc(a)),d=c.filter(Re),e=c.filter(Se);We.revert(),We.defocus(),b(d.classed(f.focused,!0)),b(e),Kd(We.data.targets)&&Kb(a,!0),Ne(a)},We.defocus=function(a){function b(a){zc(a).transition().duration(100).style("opacity",.3)}var c=ki.selectAll(Yc(a)),d=c.filter(Re),e=c.filter(Se);We.revert(),b(d.classed(f.focused,!1)),b(e),Kd(We.data.targets)&&Lb(a),Oe(a)},We.revert=function(a){function b(a){zc(a).transition().duration(100).style("opacity",1)}var c=ki.selectAll(Yc(a)),d=c.filter(Re),e=c.filter(Se);b(d.classed(f.focused,!1)),b(e),Kd(We.data.targets)&&Lb(a),Pe()},We.show=function(a){Dc(a),ki.selectAll(Yc(a)).transition().style("opacity",1),Ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!1})},We.hide=function(a){Cc(a),ki.selectAll(Yc(a)).transition().style("opacity",0),Ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!1})},We.toggle=function(a){yc(a)?We.hide(a):We.show(a)},We.unzoom=function(){fi.clear().update(),Ce({withUpdateXDomain:!0})},We.load=function(a){return a.xs&&ic(a.xs),"categories"in a&&Mh&&(xg=a.categories,Of.categories(xg)),"cacheIds"in a&&_b(a.cacheIds)?void Je(bc(a.cacheIds),a.done):void("unload"in a?Le("string"==typeof a.unload?[a.unload]:"boolean"==typeof a.unload&&a.unload?vc():a.unload,function(){Ke(a)}):Ke(a))},We.unload=function(a){Le(a?"string"==typeof a?[a]:a:vc(),function(){Ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},We.selected=function(a){return Ve.merge(mi.selectAll("."+f.shapes+Xc(a)).selectAll("."+f.shape).filter(function(){return Ve.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},We.select=function(a,b,c){dg&&mi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=Ve.select(this),i="circle"===this.nodeName?ce:fe,j="circle"===this.nodeName?de:ge,k=eg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?fg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},We.unselect=function(a,b){dg&&mi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=Ve.select(this),g="circle"===this.nodeName?de:ge,h=eg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&fg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},We.toLine=function(a){Ue(a,"line")},We.toSpline=function(a){Ue(a,"spline")},We.toBar=function(a){Ue(a,"bar")},We.toScatter=function(a){Ue(a,"scatter")},We.toArea=function(a){Ue(a,"area")},We.toAreaSpline=function(a){Ue(a,"area-spline")},We.toPie=function(a){Ue(a,"pie",{withTransform:!0})},We.toDonut=function(a){Ue(a,"donut",{withTransform:!0})},We.groups=function(a){return c(a)?Xf:(Xf=a,Ce(),Xf)},We.xgrids=function(a){return a?(ah=a,Ce(),ah):ah},We.xgrids.add=function(a){return a?We.xgrids(ah.concat(a)):void 0},We.xgrids.remove=function(a){var b=Te(a);return We.xgrids(ah.filter(b))},We.ygrids=function(a){return a?(ch=a,Ce(),ch):ch},We.ygrids.add=function(a){return a?We.ygrids(ch.concat(a)):void 0},We.ygrids.remove=function(a){var b=Te(a);return We.ygrids(ch.filter(b))},We.regions=function(a){return c(a)?xh:(xh=a,Ce(),xh)},We.regions.add=function(a){return c(a)?xh:(xh=xh.concat(a),Ce(),xh)},We.regions.remove=function(a,c){var e=[].concat(a);return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;ki.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),xh=xh.filter(function(b){return b.classes.indexOf(a)<0})}),xh},We.data.get=function(a){var b=We.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},We.data.getAsTarget=function(a){var b=xc(function(b){return b.id===a});return b.length>0?b[0]:void 0},We.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Wf[b]=a[b]}),Qe(We.data.targets,{withTransition:!0}),Wf):Wf},We.x=function(a){return arguments.length&&(kc(We.data.targets,a),Ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),We.data.x},We.xs=function(a){return arguments.length&&(lc(We.data.targets,a),Ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),We.data.x},We.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},We.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Jg=+a.y),b(a.y2)&&(Sg=+a.y2)):Jg=Sg=+a,Ce())},We.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Kg=+a.y),b(a.y2)&&(Tg=+a.y2)):Kg=Tg=+a,Ce())},We.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&We.axis.max(a.max),"undefined"!=typeof a.min&&We.axis.min(a.min))},We.resize=function(a){Ze=a?a.width:null,$e=a?a.height:null,He({withLegend:!0,withTransition:!1})},We.destroy=function(){We.data.targets=void 0,We.data.x={},qi.html(""),a.onresize=null},"url"in e.data)Ve.csv(e.data.url,function(a,b){ve(b)});else if("rows"in e.data)ve(nc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");ve(oc(e.data.columns))}return We},"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;clf&&(lf=0),0>nf&&(nf=0),jf={top:vg?hf.top:qf-pg-($h?0:rf),right:0/0,bottom:20+($h?0:rf),left:vg?ci:hf.left},mf=vg?hf.left-ci-di:lf,of=vg?nf:qf-jf.top-jf.bottom,0>mf&&(mf=0),0>of&&(of=0),kf={top:$h?0:qf-rf,right:0/0,bottom:0,left:$h?pf-sf:0},p(),$h&&Kd(We.data.targets)&&(kf.left=lf/2+uf)}function o(){mi.select("line."+f.xgridFocus).attr("x1",vg?0:-10).attr("x2",vg?lf:-10).attr("y1",vg?-10:hf.top).attr("y2",vg?-10:nf)}function p(){uf=nf/2,tf=.95*uf,vf=Jd(We.data.targets)?.6*tf:0}function q(){var a=vg?f.axisX:f.axisY,b=Ve.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Ve.select(Ye).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Ze?Ze:x()}function s(){var a=$e?$e:y();return a>0?a:320}function t(){return Kd(We.data.targets)?0:_e?_e:vg||!Ig||Ng?1:v("y")}function u(){var a=1;return Kd(We.data.targets)?0:af?af:$h?sf+(Rg&&!vg?v("y2"):a):Rg?Wg||vg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||Ig?"y2"!==a||Rg?(gb(a).isInner?30:40)+("y2"===a?-10:0):ei:rg&&!$h?10:1}function x(){return+Ve.select(Ye).style("width").replace("px","")}function y(){return+Ve.select(Ye).style("height").replace("px","")}function z(a){return a?-5:-(hf.left-1)}function A(a){return a?-20:-1}function B(){return z(!vg)}function C(){return A(!vg)}function D(){return z(vg)}function E(){return A(vg)}function F(a){return a?lf+2+4:hf.left+20}function G(a){return a?80:nf+2}function H(){return F(!vg)}function I(){return G(!vg)}function J(){return F(vg)}function K(){return G(vg)}function L(){var a=vg?nf:lf,b=tc(),c=Vb()*(Gd(We.data.targets)?(b-(Mh?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){_h=a}function N(a){ai=a}function O(a){bi=a}function P(){return rg?$h?ai*(_h+1):pf:0}function Q(){return rg?$h?qf:bi*(_h+1):0}function R(){var a,b=!If;Af=vg?1:0,Bf=vg?nf:lf,Cf=vg?0:nf,Df=vg?lf:1,Ef=Af,Ff=Bf,Gf=vg?0:of,Hf=vg?mf:1,If=T(Af,Bf,b?void 0:If.domain(),function(){return Of.tickOffset()}),Jf=U(Cf,Df),Kf=U(Cf,Df),Lf=T(Af,Bf,ri,function(a){return a%1?0:Rf.tickOffset()}),Mf=U(Gf,Hf),Nf=U(Gf,Hf),a=$(),Of=X(If,Vh,a),Rf=X(Lf,Yh,a),Pf=Y(Jf,Wh,Og,Qg),Qf=Y(Kf,Xh,Xg,Zg),b||(fi.scale(Lf),bf&&ji.scale(If)),S()}function S(){wf=Db(),xf=Eb(),yf=Eb(.98)}function T(a,b,e,f){var g=(Lh?Ve.time.scale():Ve.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),Mh){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return Ve.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?Kf:Jf}function W(a){return"y2"===Z(a)?Nf:Mf}function X(a,b,c){var d=(Mh?Bb():Ve.svg.axis()).scale(a).orient(b);return d.tickFormat(c),Mh?d.tickCentered(yg):d.tickOffset=function(){var a=vg?nf:lf;return a*Vb()/tc()/2},Mh&&d.categories(xg),d}function Y(a,b,c,d){return Ve.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Yf?Yf[a]:"y"}function $(){var a=Lh?Th:Mh?Ic:function(a){return 0>a?a.toFixed(0):a};return zg&&("function"==typeof zg?a=zg:Lh&&(a=function(a){return Ve.time.format(zg)(a)})),a}function _(a){var b;return"y"===a?b=Mg:"y2"===a?b=Vg:"x"===a&&(b=Hg),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Mg=b:"y2"===a?Vg=b:"x"===a&&(Hg=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",vg?"inner-top":"inner-right")}function eb(){return cb("y",vg?"inner-right":"inner-top")}function fb(){return cb("y2",vg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?lf/2:lf:b.isBottom?-nf:b.isMiddle?-nf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!vg,db())}function ob(){return kb(vg,eb())}function pb(){return kb(vg,fb())}function qb(){return lb(!vg,db())}function rb(){return lb(vg,eb())}function sb(){return lb(vg,fb())}function tb(){var a=db();return vg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return vg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return vg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!vg,db())}function xb(){return mb(vg,eb())}function yb(){return mb(vg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return Ve.selectAll("."+c+" .tick text").each(function(){var a=this.getBBox();bb?20:b}function Ab(){mi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),mi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),mi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+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=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]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return Ve.min(Object.keys(i).map(function(a){return Ve.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=vc(a),i=Ec(a);if(Xf.length>0)for(g=Hc(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 Ve.max(Object.keys(i).map(function(a){return Ve.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Tg:Kg,n="y2"===c?Sg:Jg,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?Ug:Lg,r=bd()&&vg;return 0===l.length?"y2"===c?Kf.domain():Jf.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=cd(o,p),j=$b(Jf.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Pg&&(f=b(Pg.top)?Pg.top:e,g=b(Pg.bottom)?Pg.bottom:e),"y2"===c&&Yg&&(f=b(Yg.top)?Yg.top:e,g=b(Yg.bottom)?Yg.bottom:e),Gd(l)&&!Gc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(ri),c=$b(If.domain());return a||0===c?1:b/c}function Wb(a){return Fg?Fg:Ve.min(a,function(a){return Ve.min(a.values,function(a){return a.x})})}function Xb(a){return Eg?Eg:Ve.max(a,function(a){return Ve.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return Mh?d=0:Gd(a)?(c=tc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=Lh?new Date(c.getTime()-e):c-e,g=Lh?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return Sf&&a===Sf||$d(Tf)&&_d(Tf,a)}function fc(a){return!ec(a)}function gc(a){return Sf?Sf:$d(Tf)?Tf[a]:null}function hc(a,b){return a in We.data.x&&We.data.x[a]&&We.data.x[a][b]?We.data.x[a][b]:b}function ic(a){Object.keys(a).forEach(function(b){Tf[b]=a[b]})}function jc(a){var b;return a&&(b=Wf[a.id],a.name=b?b:a.id),a}function kc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=mc(b[d],a.id,d)}),We.data.x[a.id]=b})}function lc(a,b){a.forEach(function(a){b[a.id]&&kc([a],b[a.id])})}function mc(a,b,c){var d;return d=Lh?a?a instanceof Date?a:Wd(a):Wd(hc(b,c)):Nh&&!Mh?a?+a:hc(b,c):c}function nc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0&&(We.data.x[b]=a.map(function(a){return a[c]})):We.data.x[b]=a.map(function(a,b){return b})}),c.forEach(function(a){if(!We.data.x[a])throw new Error('x is not defined for id = "'+a+'".')}),b=c.map(function(b,c){var d=Vf(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=mc(g,b,e);return Nh&&Mh&&0===c&&g&&(0===e&&(xg=[]),xg.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++})}),Zf&&Ed(vc(b).filter(function(a){return!(a in $f)}),Zf),b.forEach(function(a){ac(a.id_org,a)}),b}function qc(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 rc(a){return a>0&&We.data.targets[0].values[a-1]?We.data.targets[0].values[a-1].x:void 0}function sc(a){return a1?We.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?We.data.targets[0]:null,a}function vc(a){return a=c(a)?We.data.targets:a,a.map(function(a){return a.id})}function wc(a){var b,c=vc();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(Lh?new Date(h):h);i.push(d)}return i}function Cc(a){Uh=Uh.concat(a)}function Dc(a){Uh=Uh.filter(function(b){return a.indexOf(b)<0})}function Ec(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Fc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Hc(a){return Fc(a,function(a){return a>0})}function Ic(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(kd(a,f))),a[g].x&&(e=e.concat(kd(a,g))),nd(e,b)):ld(a,b,f,g)}function md(a,b){var c;return c=a.map(function(a){return ld(a.values,b)}),nd(c,b)}function nd(a,b){var c,d;return a.forEach(function(a){var e=ae(a,b);(c>e||!c)&&(c=e,d=a)}),d}function od(a,b){return Ve.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function pd(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 qd(){return ag&&"desc"===ag.toLowerCase()}function rd(){return ag&&"asc"===ag.toLowerCase()}function sd(a){var b=rd(),c=qd();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 ag&&a.sort(ag),a}function td(a,c){var d,e,f,g,h,i,j,k=Kd(We.data.targets),l=k?ed:dd,m=a.filter(function(a){return a&&b(a.value)});yh&&0!==m.length&&(pi.html(Bh(a,$(),l,Sh)).style("display","block"),d=pi.property("offsetWidth"),e=pi.property("offsetHeight"),k?(g=lf/2+c[0],i=nf/2+c[1]+20):(vg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=If(m[0].x)+20):(f=q(),g=f+t()+If(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),pi.style("top",i+"px").style("left",g+"px"))}function ud(){pi.style("display","none")}function vd(a){var c=a.filter(function(a){return a&&b(a.value)});yh&&(Hd(We.data.targets)||Kd(We.data.targets)||mi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(vg?"y1":"x1",gd).attr(vg?"y2":"x2",gd))}function wd(){mi.select("line."+f.xgridFocus).style("visibility","hidden")}function xd(a){return a.x||0===a.x?If(a.x):null}function yd(a){return V(a.id)(a.value)}function zd(){var a,b,d={},e=0;return zc(xc(Nd)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Dd(a,b){return kh?kh:b?2*a.tickOffset()*lh/b:0}function Ed(a,b){var c,d=a?"string"==typeof a?[a]:a:vc();for(c=0;c0}function _d(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ae(a,b){var c="y"===Z(a.id)?Jf:Kf;return Math.pow(If(a.x)-b[0],2)+Math.pow(c(a.value)-b[1],2)}function be(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function ce(a,b,c){kg(b,a.node()),mi.select("."+f.selectedCircles+Xc(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Jc(f.selectedCircle,c)}).attr("cx",vg?yd:xd).attr("cy",vg?xd:yd).attr("stroke",function(){return Sh(b.id)}).attr("r",1.4*jh).transition().duration(100).attr("r",jh)}function de(a,b,c){lg(b,a.node()),mi.select("."+f.selectedCircles+Xc(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ee(a,b,c,d){a?ce(b,c,d):de(b,c,d)}function fe(a,b){kg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ve.rgb(Sh(b.id)).darker(1)})}function ge(a,b){lg(b,a.node()),a.transition().duration(100).style("fill",function(){return Sh(b.id)})}function he(a,b,c,d){a?fe(b,c,d):ge(b,c,d)}function ie(a){return a.filter(function(a){return b(a.value)})}function je(a,c){return(c?mi.selectAll("."+f.circles+Xc(c)):mi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ke(a,b){je(a,b).classed(f.EXPANDED,!0).attr("r",ih)}function le(a){je(a).filter(function(){return Ve.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",fh)}function me(a){return mi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function ne(a){me(a).classed(f.EXPANDED,!0)}function oe(a){me(a).classed(f.EXPANDED,!1)}function pe(a,b){var c=te(a,b);return function(a,b){var d=c(a,b),e=vg?1:0,f=vg?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 qe(a,b){var c=te(a,!1),d=b?re:se;return function(a,b){return d(c(a,b),a,this)}}function re(a,b){var c;return vg?(c=Nd(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function se(a,b,c){var d=c.getBBox();return vg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:Nd(b)?-3:-6)}function te(a,b){var c=a.__max__+1,d=Dd(Of,c),e=Ad(d,c,a,!!b),f=Bd(!!b),g=Cd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return vg&&(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 ue(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 ve(b){var c,d,e;if(qi=Ve.select(Ye),qi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(qi.html(""),qi.classed("c3",!0),We.data.x={},We.data.targets=pc(b),n(),R(),If.domain(Ve.extent(Zb(We.data.targets))),Jf.domain(Ub(We.data.targets,"y")),Kf.domain(Ub(We.data.targets,"y2")),Lf.domain(If.domain()),Mf.domain(Jf.domain()),Nf.domain(Kf.domain()),ri=If.domain(),fi.scale(Lf),bf&&ji.scale(If),ki=qi.append("svg").attr("width",lf+hf.left+hf.right).attr("height",nf+hf.top+hf.bottom).on("mouseenter",ef).on("mouseleave",ff),li=ki.append("defs"),li.append("clipPath").attr("id",Fh).append("rect").attr("width",lf).attr("height",nf),li.append("clipPath").attr("id",Gh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),li.append("clipPath").attr("id",Hh).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),mi=ki.append("g").attr("transform",Zh.main),ni=og?ki.append("g").attr("transform",Zh.context):null,oi=rg?ki.append("g").attr("transform",Zh.legend):null,pi=Ve.select(Ye).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),mi.append("g").attr("class",f.axisX).attr("clip-path",vg?"":Jh).attr("transform",Zh.x).append("text").attr("class",f.axisXLabel).attr("transform",vg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),Ig&&mi.append("g").attr("class",f.axisY).attr("clip-path",vg?Kh:"").append("text").attr("class",f.axisYLabel).attr("transform",vg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),Rg&&mi.append("g").attr("class",f.axisY2).attr("transform",Zh.y2).append("text").attr("class",f.axisY2Label).attr("transform",vg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=mi.append("g").attr("clip-path",Ih).attr("class",f.grid),$g&&d.append("g").attr("class",f.xgrids),$d(ah)&&d.append("g").attr("class",f.xgridLines),gh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),bh&&d.append("g").attr("class",f.ygrids),$d(ch)&&d.append("g").attr("class",f.ygridLines),mi.append("g").attr("clip-path",Ih).attr("class",f.regions),mi.append("g").attr("clip-path",Ih).attr("class",f.chart),c=mi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",bf?vg?"ns-resize":"ew-resize":null),mi.select("."+f.chart).append("g").attr("class",f.chartBars),mi.select("."+f.chart).append("g").attr("class",f.chartLines),mi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Zh.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),mi.select("."+f.chart).append("g").attr("class",f.chartTexts),bf&&mi.insert("rect",df?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",lf).attr("height",nf).style("opacity",0).style("cursor",vg?"ns-resize":"ew-resize").call(ji).on("dblclick.zoom",null),Gg&&fi.extent("function"!=typeof Gg?Gg:Gg(Zb())),og&&(ni.append("g").attr("clip-path",Ih).attr("class",f.chart),ni.select("."+f.chart).append("g").attr("class",f.chartBars),ni.select("."+f.chart).append("g").attr("class",f.chartLines),ni.append("g").attr("clip-path",Ih).attr("class",f.brush).call(fi).selectAll("rect").attr(vg?"width":"height",vg?mf:of),ni.append("g").attr("class",f.axisX).attr("transform",Zh.subx).attr("clip-path",vg?"":Jh)),Ie(We.data.targets),vg?mi.select("."+f.axisX).style("opacity",0).call(Of):(mi.select("."+f.axisY).style("opacity",0).call(Pf),mi.select("."+f.axisY2).style("opacity",0).call(Qf)),He({withTransform:!0,withLegend:!0,withTransitionForAxis:!1}),Ch){if(Lh&&"string"==typeof Dh){for(Dh=Wd(Dh),e=0;e0){d=[];for(var g in Wf)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=pd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=he,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 Ae(a){Kd(We.data.targets)||dg&&(Oh=a,mi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ph=!0,mg())}function Be(){Kd(We.data.targets)||dg&&(mi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),mi.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ph=!1,ng())}function Ce(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P=zd(),Q=Kd(We.data.targets),R=zc(We.data.targets);if(0!==R.length){if(a=d(a)?a:{},v=d(a.withY)?a.withY:!0,w=d(a.withSubchart)?a.withSubchart:!0,x=d(a.withTransition)?a.withTransition:!0,A=d(a.withTransform)?a.withTransform:!1,B=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,C=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,D=d(a.withLegend)?a.withLegend:!1,y=d(a.withTransitionForExit)?a.withTransitionForExit:x,z=d(a.withTransitionForAxis)?a.withTransitionForAxis:x,I=x?gf:0,J=y?I:0,K=z?I:0,D&&rg&&Qe(We.data.targets,a),C&&(If.domain(Ve.extent(Zb(R))),ri=If.domain(),bf&&ji.scale(If).updateScaleExtent(),Lf.domain(If.domain()),fi.scale(Lf)),B&&(If.domain(fi.empty()?ri:fi.extent()),bf&&ji.scale(If).updateScaleExtent(),Hd(R)||(M=Bc(Ac(R)),Of.tickValues(M),Rf.tickValues(M))),Jf.domain(Ub(R,"y")),Kf.domain(Ub(R,"y2")),mi.select("."+f.axisX).style("opacity",Q?0:1).transition().duration(K).call(Of),mi.select("."+f.axisY).style("opacity",Q?0:1).transition().duration(K).call(Pf),mi.select("."+f.axisY2).style("opacity",Q?0:1).transition().duration(K).call(Qf),B&&Ag&&M){for(N=1;N=V;V++)e.push(new Date(V+"-01-01 00:00:00"))}else e=If.ticks(10);c=mi.select("."+f.xgrids).selectAll("."+f.xgrid).data(e),c.enter().append("line").attr("class",f.xgrid),c.attr("x1",vg?0:function(a){return If(a)-Of.tickOffset()}).attr("x2",vg?lf:function(a){return If(a)-Of.tickOffset()}).attr("y1",vg?function(a){return If(a)-Of.tickOffset()}:hf.top).attr("y2",vg?function(a){return If(a)-Of.tickOffset()}:nf).style("opacity",function(){return+Ve.select(this).attr(vg?"y1":"x1")===(vg?nf:0)?0:1}),c.exit().remove()}$d(ah)&&(g=mi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(ah),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",vg?"":"rotate(-90)").attr("dx",vg?0:-hf.top).attr("dy",-5).style("opacity",0),g.select("line").transition().duration(I).attr("x1",vg?0:hd).attr("x2",vg?lf:hd).attr("y1",vg?hd:hf.top).attr("y2",vg?hd:nf).style("opacity",1),g.select("text").transition().duration(I).attr("x",vg?lf:0).attr("y",hd).text(function(a){return a.text}).style("opacity",1),g.exit().transition().duration(I).style("opacity",0).remove()),v&&bh&&(i=mi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Jf.ticks(dh)),i.enter().append("line").attr("class",f.ygrid),i.attr("x1",vg?Jf:0).attr("x2",vg?Jf:lf).attr("y1",vg?0:Jf).attr("y2",vg?nf:Jf),i.exit().remove()),v&&$d(ch)&&(j=mi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(ch),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",vg?"rotate(-90)":"").attr("dx",vg?0:-hf.top).attr("dy",-5).style("opacity",0),j.select("line").transition().duration(I).attr("x1",vg?id:0).attr("x2",vg?id:lf).attr("y1",vg?0:id).attr("y2",vg?nf:id).style("opacity",1),j.select("text").transition().duration(I).attr("x",vg?0:lf).attr("y",id).text(function(a){return a.text}).style("opacity",1),j.exit().transition().duration(I).style("opacity",0).remove()),m=mi.selectAll("."+f.bars).selectAll("."+f.bar).data(Sd),m.enter().append("path").attr("d",E).style("stroke","none").style("opacity",0).style("fill",function(a){return Sh(a.id)}).attr("class",Rc),m.style("opacity",Zc).transition().duration(I).attr("d",E).style("opacity",1),m.exit().transition().duration(J).style("opacity",0).remove(),p=mi.selectAll("."+f.texts).selectAll("."+f.text).data(Ud),p.enter().append("text").attr("class",Kc).attr("text-anchor",function(a){return vg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),p.text(function(a){return fd(a.id)(a.value)}).style("fill-opacity",$c).transition().duration(I).attr("x",G).attr("y",H).style("fill-opacity",ad),p.exit().transition().duration(J).style("fill-opacity",0).remove(),mi.selectAll("."+f.line).style("opacity",Zc).transition().duration(I).attr("d",gi).style("opacity",1),mi.selectAll("."+f.area).style("opacity",0).transition().duration(I).attr("d",hi).style("opacity",si),l=mi.selectAll("."+f.circles).selectAll("."+f.circle).data(Td),l.enter().append("circle").attr("class",Pc).style("opacity",0).attr("r",fh),l.style("opacity",Zc).transition().duration(I).style("opacity",_c).attr("cx",vg?yd:xd).attr("cy",vg?xd:yd),l.exit().remove(),mi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",A?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(I).attrTween("d",function(a){var b,c=Cb(a);return c?(b=Ve.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",A?"scale(1)":"").style("opacity",1),mi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(I).text(Jb).style("opacity",function(a){return yc(a.data.id)&&Rd(a.data)?1:0}),mi.select("."+f.chartArcsTitle).style("opacity",Jd(We.data.targets)?1:0),og&&(null!==Ve.event&&"zoom"===Ve.event.type&&fi.extent(If.orgDomain()).update(),w&&(ni.select("."+f.axisX).style("opacity",Q?0:1).transition().duration(I).call(Rf),fi.empty()||fi.extent(If.orgDomain()).update(),F=pe(P,!0),q=ni.selectAll("."+f.bars).selectAll("."+f.bar).data(Sd),q.enter().append("path").attr("d",F).style("stroke","none").style("fill",function(a){return Sh(a.id)}).attr("class",Rc),q.style("opacity",Zc).transition().duration(I).attr("d",F).style("opacity",1),q.exit().transition().duration(I).style("opacity",0).remove(),ni.selectAll("."+f.line).style("opacity",Zc).transition().duration(I).attr("d",ii).style("opacity",1))),mi.selectAll("."+f.selectedCircles).filter(function(a){return Nd(a)}).selectAll("circle").remove(),mi.selectAll("."+f.selectedCircle).transition().duration(I).attr("cx",vg?yd:xd).attr("cy",vg?xd:yd),$d(Tf)?(r=mi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),xe(r.enter()),r.attr("x",0).attr("y",0).attr("width",lf).attr("height",nf)):(Nh&&!Mh?(u=function(a,b){var c=rc(b),d=sc(b),e=We.data.x[a.id][b];return(If(d?d:e+50)-If(c?c:e-50))/2},t=function(a,b){var c=rc(b),d=We.data.x[a.id][b];return(If(d)+If(c?c:d-50))/2}):(u=L(),t=function(a){return If(a.x)-u/2}),s=uc(),mi.select("."+f.eventRects).datum(s?s.values:[]),r=mi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),we(r.enter()),r.attr("class",Wc).attr("x",vg?0:t).attr("y",vg?t:0).attr("width",vg?lf:u).attr("height",vg?u:nf),r.exit().remove()),n=mi.select("."+f.regions).selectAll("rect."+f.region).data(xh),n.enter().append("rect").style("fill-opacity",0),n.attr("class",Vc).attr("x",vg?0:cc).attr("y",vg?cc:hf.top).attr("width",vg?lf:dc).attr("height",vg?dc:nf).transition().duration(I).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),n.exit().transition().duration(I).style("fill-opacity",0).remove(),vc().forEach(function(a){ti[a]=!0})}}function De(){Ce({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ee(){return"mousemove"===Ve.event.sourceEvent.type&&ji.altDomain?(If.domain(ji.altDomain),void ji.scale(If).updateScaleExtent()):(Mh&&If.orgDomain()[0]===ri[0]&&If.domain([ri[0]-1e-10,If.orgDomain()[1]]),Ce({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Ve.event.sourceEvent.type&&(Qh=!0)))}function Fe(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ge(){ki.attr("width",pf).attr("height",qf),ki.select("#"+Fh).select("rect").attr("width",lf).attr("height",nf),ki.select("#"+Gh).select("rect").attr("width",H),ki.select("#"+Hh).select("rect").attr("width",J),ki.select("."+f.zoomRect).attr("width",lf).attr("height",nf)}function He(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(),R(),Ge(),m(a.withTransition),Ce(a)}function Ie(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=mi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a),j=i.enter().append("g").attr("class",function(a){return f.chartText+Jc(f.target,a.id)}).style("pointer-events","none"),j.append("g").attr("class",Lc).style("fill",function(a){return Sh(a.id)}),e=mi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),d=e.enter().append("g").attr("class",function(a){return f.chartBar+Jc(f.target,a.id)}).style("pointer-events","none"),d.append("g").attr("class",Sc).style("fill",function(a){return Sh(a.id)}).style("stroke","none").style("cursor",function(a){return fg(a)?"pointer":null}),c=mi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),b=c.enter().append("g").attr("class",function(a){return f.chartLine+Jc(f.target,a.id)}).style("pointer-events","none"),b.append("path").attr("class",Oc).style("opacity",0).style("stroke",function(a){return Sh(a.id)}),b.append("path").attr("class",Uc).style("opacity",function(){return si=+Ve.select(this).style("opacity"),0}).style("fill",function(a){return Sh(a.id)}),b.append("g").attr("class",function(a){return Jc(f.selectedCircles,a.id)}),b.append("g").attr("class",Qc).style("fill",function(a){return Sh(a.id)}).style("cursor",function(a){return fg(a)?"pointer":null}),a.forEach(function(a){mi.selectAll("."+f.selectedCircles+Xc(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=mi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(zf(a)),g=h.enter().append("g").attr("class",function(a){return f.chartArc+Jc(f.target,a.data.id)}),g.append("path").attr("class",Tc).style("opacity",0).style("fill",function(a){return Sh(a.data.id)}).style("cursor",function(a){return fg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),Ne(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];td(c,Ve.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),Pe(),ud(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),og&&(n=ni.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),m=n.enter().append("g").attr("class",function(a){return f.chartBar+Jc(f.target,a.id)}),m.append("g").attr("class",Sc).style("fill",function(a){return Sh(a.id)}),l=ni.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),k=l.enter().append("g").attr("class",function(a){return f.chartLine+Jc(f.target,a.id)}),k.append("path").attr("class",Oc).style("opacity",0).style("stroke",function(a){return Sh(a.id)})),ki.selectAll("."+f.target).filter(function(a){return yc(a.id)}).transition().style("opacity",1)}function Je(a,b){We.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=$h?i:h,k=$h?rf:sf;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=$h?u:t,ug?(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=vc(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,$h?(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=oi.selectAll("."+f.legendItem).data(q).enter().append("g").attr("class",function(a){return Jc(f.legendItem,a)}).style("cursor","pointer").on("click",function(a){"function"==typeof tg?tg(a):We.toggle(a)}).on("mouseover",function(a){We.focus(a)}).on("mouseout",function(){We.revert()}),g.append("text").text(function(a){return d(Wf[a])?Wf[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",$h?i:-200).attr("y",$h?-200:l),g.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",$h?j:-200).attr("y",$h?-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 Sh(a)}).attr("x",$h?i:-200).attr("y",$h?-200:k).attr("width",10).attr("height",10),oi.selectAll("text").data(q).text(function(a){return d(Wf[a])?Wf[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",i).attr("y",l),oi.selectAll("rect."+f.legendItemEvent).data(q).transition().duration(p?250:0).attr("x",j).attr("y",o),oi.selectAll("rect."+f.legendItemTile).data(q).transition().duration(p?250:0).attr("x",h).attr("y",k),N(t),O(u),M(C),n(),R(),Ge(),m(!1)}function Re(a){return wc(a.id)}function Se(a){return"data"in a&&wc(a.data.id)}function Te(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 Ue(a,b,c){var d=!Kd(We.data.targets);Ed(a,b),He(c?c:{withTransitionForAxis:d})}var Ve=a.d3?a.d3:a.require?a.require("d3"):void 0,We={data:{},axis:{}},Xe={},Ye=h(["bindto"],"#chart"),Ze=h(["size","width"]),$e=h(["size","height"]),_e=h(["padding","left"]),af=h(["padding","right"]),bf=h(["zoom","enabled"],!1),cf=h(["zoom","extent"]),df=h(["zoom","privileged"],!1),ef=h(["onenter"],function(){}),ff=h(["onleave"],function(){}),gf=h(["transition","duration"],350);g("data","data is required in config");var 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,Rf,Sf=h(["data","x"]),Tf=h(["data","xs"],{}),Uf=h(["data","x_format"]),Vf=h(["data","id_converter"],function(a){return a}),Wf=h(["data","names"],{}),Xf=h(["data","groups"],[]),Yf=h(["data","axes"],{}),Zf=h(["data","type"]),$f=h(["data","types"],{}),_f=h(["data","labels"],{}),ag=h(["data","order"]),bg=h(["data","regions"],{}),cg=h(["data","colors"],{}),dg=h(["data","selection","enabled"],!1),eg=h(["data","selection","grouped"],!1),fg=h(["data","selection","isselectable"],function(){return!0}),gg=h(["data","selection","multiple"],!0),hg=h(["data","onclick"],function(){}),ig=h(["data","onenter"],function(){}),jg=h(["data","onleave"],function(){}),kg=h(["data","onselected"],function(){}),lg=h(["data","onunselected"],function(){}),mg=h(["data","ondragstart"],function(){}),ng=h(["data","ondragend"],function(){}),og=h(["subchart","show"],!1),pg=og?h(["subchart","size","height"],60):0,qg=h(["color","pattern"],[]),rg=h(["legend","show"],!0),sg=h(["legend","position"],"bottom"),tg=h(["legend","item","onclick"]),ug=h(["legend","equally"],!1),vg=h(["axis","rotated"],!1),wg=h(["axis","x","type"],"indexed"),xg=h(["axis","x","categories"],[]),yg=h(["axis","x","tick","centered"],!1),zg=h(["axis","x","tick","format"]),Ag=h(["axis","x","tick","culling"],{}),Bg=h(["axis","x","tick","culling","max"],"categorized"===wg?1/0:10),Cg=h(["axis","x","tick","count"]),Dg=h(["axis","x","tick","fit"],!1),Eg=h(["axis","x","max"]),Fg=h(["axis","x","min"]),Gg=h(["axis","x","default"]),Hg=h(["axis","x","label"],{}),Ig=h(["axis","y","show"],!0),Jg=h(["axis","y","max"]),Kg=h(["axis","y","min"]),Lg=h(["axis","y","center"]),Mg=h(["axis","y","label"],{}),Ng=h(["axis","y","inner"],!1),Og=h(["axis","y","tick","format"]),Pg=h(["axis","y","padding"],{}),Qg=h(["axis","y","ticks"],10),Rg=h(["axis","y2","show"],!1),Sg=h(["axis","y2","max"]),Tg=h(["axis","y2","min"]),Ug=h(["axis","y2","center"]),Vg=h(["axis","y2","label"],{}),Wg=h(["axis","y2","inner"],!1),Xg=h(["axis","y2","tick","format"]),Yg=h(["axis","y2","padding"],{}),Zg=h(["axis","y2","ticks"],10),$g=h(["grid","x","show"],!1),_g=h(["grid","x","type"],"tick"),ah=h(["grid","x","lines"],[]),bh=h(["grid","y","show"],!1),ch=h(["grid","y","lines"],[]),dh=h(["grid","y","ticks"],10),eh=h(["point","show"],!0),fh=eh?h(["point","r"],2.5):0,gh=h(["point","focus","line","enabled"],!0),hh=h(["point","focus","expand","enabled"],!0),ih=h(["point","focus","expand","r"],hh?4:fh),jh=h(["point","focus","select","r"],8),kh=h(["bar","width"]),lh=h(["bar","width","ratio"],.6),mh=h(["pie","label","show"],!0),nh=h(["pie","label","format"]),oh=h(["pie","onclick"],function(){}),ph=h(["pie","onmouseover"],function(){}),qh=h(["pie","onmouseout"],function(){}),rh=h(["donut","label","show"],!0),sh=h(["donut","label","format"]),th=h(["donut","title"],""),uh=h(["donut","onclick"],function(){}),vh=h(["donut","onmouseover"],function(){}),wh=h(["donut","onmouseout"],function(){}),xh=h(["regions"],[]),yh=h(["tooltip","show"],!0),zh=h(["tooltip","format","title"]),Ah=h(["tooltip","format","value"]),Bh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=zh?zh:b,l=Ah?Ah: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+""}),Ch=h(["tooltip","init","show"],!1),Dh=h(["tooltip","init","x"],0),Eh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Fh=("string"==typeof Ye?Ye.replace("#",""):Ye.id)+"-clip",Gh=Fh+"-xaxis",Hh=Fh+"-yaxis",Ih=i(Fh),Jh=i(Jh),Kh=i(Kh),Lh="timeseries"===wg,Mh="categorized"===wg,Nh=!Lh&&(Sf||$d(Tf)),Oh=null,Ph=!1,Qh=!1,Rh=!1,Sh=Vd(cg,qg),Th=function(){var a=[[Ve.time.format("%Y/%-m/%-d"),function(){return!0}],[Ve.time.format("%-m/%-d"),function(a){return a.getMonth()}],[Ve.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ve.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ve.time.format("%I %p"),function(a){return a.getHours()}],[Ve.time.format("%I:%M"),function(a){return a.getMinutes()}],[Ve.time.format(":%S"),function(a){return a.getSeconds()}],[Ve.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)}}(),Uh=[],Vh=vg?"left":"bottom",Wh=vg?Ng?"top":"bottom":Ng?"right":"left",Xh=vg?Wg?"bottom":"top":Wg?"left":"right",Yh=vg?"left":"bottom",Zh={main:function(){return"translate("+hf.left+","+hf.top+")"},context:function(){return"translate("+jf.left+","+jf.top+")"},legend:function(){return"translate("+kf.left+","+kf.top+")"},x:function(){return"translate(0,"+(vg?0:nf)+")"},y:function(){return"translate(0,"+(vg?nf:0)+")"},y2:function(){return"translate("+(vg?0:lf)+","+(vg?1:0)+")"},subx:function(){return"translate(0,"+(vg?0:of)+")"},arc:function(){return"translate("+lf/2+","+nf/2+")"}},$h="right"===sg,_h=0,ai=0,bi=0,ci=30,di=30,ei=5;zf=Ve.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var fi,gi=function(){var a=Ve.svg.line().x(vg?function(a){return V(a.id)(a.value)}:gd).y(vg?gd:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=ie(b.values);return Ld(b)?(a.interpolate(Md(b)?"cardinal":"linear"),bg[b.id]?ue(e,If,V(b.id),bg[b.id]):a(e)):(c=If(e[0].x),d=V(b.id)(e[0].value),vg?"M "+d+" "+c:"M "+c+" "+d)}}(),hi=function(){var a;return a=vg?Ve.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(gd):Ve.svg.area().x(gd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=ie(b.values);return Fd([b],"area")||Fd([b],"area-spline")?(a.interpolate(Md(b)?"cardinal":"linear"),a(e)):(c=If(e[0].x),d=V(b.id)(e[0].value),vg?"M "+d+" "+c:"M "+c+" "+d)}}(),ii=function(){var a=Ve.svg.line().x(vg?function(a){return W(a.id)(a.value)}:jd).y(vg?jd:function(a){return W(a.id)(a.value)});return function(b){var c=ie(b.values);return Ld(b)?a(c):"M "+Lf(c[0].x)+" "+W(b.id)(c[0].value)}}(),ji=function(){};fi=Ve.svg.brush().on("brush",De),fi.update=function(){return ni&&ni.select("."+f.brush).call(this),this},fi.scale=function(a){return vg?this.y(a):this.x(a)},bf&&(ji=Ve.behavior.zoom().on("zoomstart",function(){ji.altDomain=Ve.event.sourceEvent.altKey?If.orgDomain():null}).on("zoom",bf?Ee:null),ji.scale=function(a){return vg?this.y(a):this.x(a)},ji.orgScaleExtent=function(){var a=cf?cf:[1,10];return[a[0],Math.max(tc()/a[1],a[1])]},ji.updateScaleExtent=function(){var a=$b(If.orgDomain())/$b(ri),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var ki,li,mi,ni,oi,pi,qi,ri,si,ti={};if(We.focus=function(a){function b(a){zc(a).transition().duration(100).style("opacity",1)}var c=ki.selectAll(Yc(a)),d=c.filter(Re),e=c.filter(Se);We.revert(),We.defocus(),b(d.classed(f.focused,!0)),b(e),Kd(We.data.targets)&&Kb(a,!0),Ne(a)},We.defocus=function(a){function b(a){zc(a).transition().duration(100).style("opacity",.3)}var c=ki.selectAll(Yc(a)),d=c.filter(Re),e=c.filter(Se);We.revert(),b(d.classed(f.focused,!1)),b(e),Kd(We.data.targets)&&Lb(a),Oe(a)},We.revert=function(a){function b(a){zc(a).transition().duration(100).style("opacity",1)}var c=ki.selectAll(Yc(a)),d=c.filter(Re),e=c.filter(Se);b(d.classed(f.focused,!1)),b(e),Kd(We.data.targets)&&Lb(a),Pe()},We.show=function(a){Dc(a),ki.selectAll(Yc(a)).transition().style("opacity",1),Ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!1})},We.hide=function(a){Cc(a),ki.selectAll(Yc(a)).transition().style("opacity",0),Ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!1})},We.toggle=function(a){yc(a)?We.hide(a):We.show(a)},We.unzoom=function(){fi.clear().update(),Ce({withUpdateXDomain:!0})},We.load=function(a){return a.xs&&ic(a.xs),"categories"in a&&Mh&&(xg=a.categories,Of.categories(xg)),"cacheIds"in a&&_b(a.cacheIds)?void Je(bc(a.cacheIds),a.done):void("unload"in a?Le("string"==typeof a.unload?[a.unload]:"boolean"==typeof a.unload&&a.unload?vc():a.unload,function(){Ke(a)}):Ke(a))},We.unload=function(a){Le(a?"string"==typeof a?[a]:a:vc(),function(){Ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},We.selected=function(a){return Ve.merge(mi.selectAll("."+f.shapes+Xc(a)).selectAll("."+f.shape).filter(function(){return Ve.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},We.select=function(a,b,c){dg&&mi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=Ve.select(this),i="circle"===this.nodeName?ce:fe,j="circle"===this.nodeName?de:ge,k=eg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?fg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},We.unselect=function(a,b){dg&&mi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=Ve.select(this),g="circle"===this.nodeName?de:ge,h=eg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&fg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},We.toLine=function(a){Ue(a,"line")},We.toSpline=function(a){Ue(a,"spline")},We.toBar=function(a){Ue(a,"bar")},We.toScatter=function(a){Ue(a,"scatter")},We.toArea=function(a){Ue(a,"area")},We.toAreaSpline=function(a){Ue(a,"area-spline")},We.toPie=function(a){Ue(a,"pie",{withTransform:!0})},We.toDonut=function(a){Ue(a,"donut",{withTransform:!0})},We.groups=function(a){return c(a)?Xf:(Xf=a,Ce(),Xf)},We.xgrids=function(a){return a?(ah=a,Ce(),ah):ah},We.xgrids.add=function(a){return a?We.xgrids(ah.concat(a)):void 0},We.xgrids.remove=function(a){var b=Te(a);return We.xgrids(ah.filter(b))},We.ygrids=function(a){return a?(ch=a,Ce(),ch):ch},We.ygrids.add=function(a){return a?We.ygrids(ch.concat(a)):void 0},We.ygrids.remove=function(a){var b=Te(a);return We.ygrids(ch.filter(b))},We.regions=function(a){return c(a)?xh:(xh=a,Ce(),xh)},We.regions.add=function(a){return c(a)?xh:(xh=xh.concat(a),Ce(),xh)},We.regions.remove=function(a,c){var e=[].concat(a);return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;ki.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),xh=xh.filter(function(b){return b.classes.indexOf(a)<0})}),xh},We.data.get=function(a){var b=We.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},We.data.getAsTarget=function(a){var b=xc(function(b){return b.id===a});return b.length>0?b[0]:void 0},We.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Wf[b]=a[b]}),Qe(We.data.targets,{withTransition:!0}),Wf):Wf},We.x=function(a){return arguments.length&&(kc(We.data.targets,a),Ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),We.data.x},We.xs=function(a){return arguments.length&&(lc(We.data.targets,a),Ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),We.data.x},We.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},We.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Jg=+a.y),b(a.y2)&&(Sg=+a.y2)):Jg=Sg=+a,Ce())},We.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Kg=+a.y),b(a.y2)&&(Tg=+a.y2)):Kg=Tg=+a,Ce())},We.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&We.axis.max(a.max),"undefined"!=typeof a.min&&We.axis.min(a.min))},We.resize=function(a){Ze=a?a.width:null,$e=a?a.height:null,He({withLegend:!0,withTransition:!1})},We.destroy=function(){We.data.targets=void 0,We.data.x={},qi.html(""),a.onresize=null},"url"in e.data)Ve.csv(e.data.url,function(a,b){ve(b)});else if("rows"in e.data)ve(nc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");ve(oc(e.data.columns))}return We},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From c14a6df61a826fdd3d042b597ee65471b911fed9 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Sun, 6 Apr 2014 00:09:57 +0900 Subject: [PATCH 006/178] Update version --- bower.json | 2 +- c3.js | 2 +- c3.min.js | 2 +- package.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bower.json b/bower.json index 3875dcf..156da9c 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "c3", "main": "c3.min.js", - "version": "0.1.27", + "version": "0.1.28", "homepage": "https://github.com/masayuki0812/c3", "authors": [ "Masayuki Tanaka " diff --git a/c3.js b/c3.js index 346a3cc..67ea8c0 100644 --- a/c3.js +++ b/c3.js @@ -2,7 +2,7 @@ 'use strict'; var c3 = { - version: "0.1.27" + version: "0.1.28" }; var CLASS = { diff --git a/c3.min.js b/c3.min.js index e0421c1..dbfe7fb 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;clf&&(lf=0),0>nf&&(nf=0),jf={top:vg?hf.top:qf-pg-($h?0:rf),right:0/0,bottom:20+($h?0:rf),left:vg?ci:hf.left},mf=vg?hf.left-ci-di:lf,of=vg?nf:qf-jf.top-jf.bottom,0>mf&&(mf=0),0>of&&(of=0),kf={top:$h?0:qf-rf,right:0/0,bottom:0,left:$h?pf-sf:0},p(),$h&&Kd(We.data.targets)&&(kf.left=lf/2+uf)}function o(){mi.select("line."+f.xgridFocus).attr("x1",vg?0:-10).attr("x2",vg?lf:-10).attr("y1",vg?-10:hf.top).attr("y2",vg?-10:nf)}function p(){uf=nf/2,tf=.95*uf,vf=Jd(We.data.targets)?.6*tf:0}function q(){var a=vg?f.axisX:f.axisY,b=Ve.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Ve.select(Ye).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Ze?Ze:x()}function s(){var a=$e?$e:y();return a>0?a:320}function t(){return Kd(We.data.targets)?0:_e?_e:vg||!Ig||Ng?1:v("y")}function u(){var a=1;return Kd(We.data.targets)?0:af?af:$h?sf+(Rg&&!vg?v("y2"):a):Rg?Wg||vg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||Ig?"y2"!==a||Rg?(gb(a).isInner?30:40)+("y2"===a?-10:0):ei:rg&&!$h?10:1}function x(){return+Ve.select(Ye).style("width").replace("px","")}function y(){return+Ve.select(Ye).style("height").replace("px","")}function z(a){return a?-5:-(hf.left-1)}function A(a){return a?-20:-1}function B(){return z(!vg)}function C(){return A(!vg)}function D(){return z(vg)}function E(){return A(vg)}function F(a){return a?lf+2+4:hf.left+20}function G(a){return a?80:nf+2}function H(){return F(!vg)}function I(){return G(!vg)}function J(){return F(vg)}function K(){return G(vg)}function L(){var a=vg?nf:lf,b=tc(),c=Vb()*(Gd(We.data.targets)?(b-(Mh?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){_h=a}function N(a){ai=a}function O(a){bi=a}function P(){return rg?$h?ai*(_h+1):pf:0}function Q(){return rg?$h?qf:bi*(_h+1):0}function R(){var a,b=!If;Af=vg?1:0,Bf=vg?nf:lf,Cf=vg?0:nf,Df=vg?lf:1,Ef=Af,Ff=Bf,Gf=vg?0:of,Hf=vg?mf:1,If=T(Af,Bf,b?void 0:If.domain(),function(){return Of.tickOffset()}),Jf=U(Cf,Df),Kf=U(Cf,Df),Lf=T(Af,Bf,ri,function(a){return a%1?0:Rf.tickOffset()}),Mf=U(Gf,Hf),Nf=U(Gf,Hf),a=$(),Of=X(If,Vh,a),Rf=X(Lf,Yh,a),Pf=Y(Jf,Wh,Og,Qg),Qf=Y(Kf,Xh,Xg,Zg),b||(fi.scale(Lf),bf&&ji.scale(If)),S()}function S(){wf=Db(),xf=Eb(),yf=Eb(.98)}function T(a,b,e,f){var g=(Lh?Ve.time.scale():Ve.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),Mh){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return Ve.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?Kf:Jf}function W(a){return"y2"===Z(a)?Nf:Mf}function X(a,b,c){var d=(Mh?Bb():Ve.svg.axis()).scale(a).orient(b);return d.tickFormat(c),Mh?d.tickCentered(yg):d.tickOffset=function(){var a=vg?nf:lf;return a*Vb()/tc()/2},Mh&&d.categories(xg),d}function Y(a,b,c,d){return Ve.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Yf?Yf[a]:"y"}function $(){var a=Lh?Th:Mh?Ic:function(a){return 0>a?a.toFixed(0):a};return zg&&("function"==typeof zg?a=zg:Lh&&(a=function(a){return Ve.time.format(zg)(a)})),a}function _(a){var b;return"y"===a?b=Mg:"y2"===a?b=Vg:"x"===a&&(b=Hg),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Mg=b:"y2"===a?Vg=b:"x"===a&&(Hg=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",vg?"inner-top":"inner-right")}function eb(){return cb("y",vg?"inner-right":"inner-top")}function fb(){return cb("y2",vg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?lf/2:lf:b.isBottom?-nf:b.isMiddle?-nf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!vg,db())}function ob(){return kb(vg,eb())}function pb(){return kb(vg,fb())}function qb(){return lb(!vg,db())}function rb(){return lb(vg,eb())}function sb(){return lb(vg,fb())}function tb(){var a=db();return vg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return vg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return vg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!vg,db())}function xb(){return mb(vg,eb())}function yb(){return mb(vg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return Ve.selectAll("."+c+" .tick text").each(function(){var a=this.getBBox();bb?20:b}function Ab(){mi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),mi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),mi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+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=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]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return Ve.min(Object.keys(i).map(function(a){return Ve.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=vc(a),i=Ec(a);if(Xf.length>0)for(g=Hc(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 Ve.max(Object.keys(i).map(function(a){return Ve.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Tg:Kg,n="y2"===c?Sg:Jg,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?Ug:Lg,r=bd()&&vg;return 0===l.length?"y2"===c?Kf.domain():Jf.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=cd(o,p),j=$b(Jf.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Pg&&(f=b(Pg.top)?Pg.top:e,g=b(Pg.bottom)?Pg.bottom:e),"y2"===c&&Yg&&(f=b(Yg.top)?Yg.top:e,g=b(Yg.bottom)?Yg.bottom:e),Gd(l)&&!Gc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(ri),c=$b(If.domain());return a||0===c?1:b/c}function Wb(a){return Fg?Fg:Ve.min(a,function(a){return Ve.min(a.values,function(a){return a.x})})}function Xb(a){return Eg?Eg:Ve.max(a,function(a){return Ve.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return Mh?d=0:Gd(a)?(c=tc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=Lh?new Date(c.getTime()-e):c-e,g=Lh?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return Sf&&a===Sf||$d(Tf)&&_d(Tf,a)}function fc(a){return!ec(a)}function gc(a){return Sf?Sf:$d(Tf)?Tf[a]:null}function hc(a,b){return a in We.data.x&&We.data.x[a]&&We.data.x[a][b]?We.data.x[a][b]:b}function ic(a){Object.keys(a).forEach(function(b){Tf[b]=a[b]})}function jc(a){var b;return a&&(b=Wf[a.id],a.name=b?b:a.id),a}function kc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=mc(b[d],a.id,d)}),We.data.x[a.id]=b})}function lc(a,b){a.forEach(function(a){b[a.id]&&kc([a],b[a.id])})}function mc(a,b,c){var d;return d=Lh?a?a instanceof Date?a:Wd(a):Wd(hc(b,c)):Nh&&!Mh?a?+a:hc(b,c):c}function nc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0&&(We.data.x[b]=a.map(function(a){return a[c]})):We.data.x[b]=a.map(function(a,b){return b})}),c.forEach(function(a){if(!We.data.x[a])throw new Error('x is not defined for id = "'+a+'".')}),b=c.map(function(b,c){var d=Vf(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=mc(g,b,e);return Nh&&Mh&&0===c&&g&&(0===e&&(xg=[]),xg.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++})}),Zf&&Ed(vc(b).filter(function(a){return!(a in $f)}),Zf),b.forEach(function(a){ac(a.id_org,a)}),b}function qc(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 rc(a){return a>0&&We.data.targets[0].values[a-1]?We.data.targets[0].values[a-1].x:void 0}function sc(a){return a1?We.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?We.data.targets[0]:null,a}function vc(a){return a=c(a)?We.data.targets:a,a.map(function(a){return a.id})}function wc(a){var b,c=vc();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(Lh?new Date(h):h);i.push(d)}return i}function Cc(a){Uh=Uh.concat(a)}function Dc(a){Uh=Uh.filter(function(b){return a.indexOf(b)<0})}function Ec(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Fc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Hc(a){return Fc(a,function(a){return a>0})}function Ic(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(kd(a,f))),a[g].x&&(e=e.concat(kd(a,g))),nd(e,b)):ld(a,b,f,g)}function md(a,b){var c;return c=a.map(function(a){return ld(a.values,b)}),nd(c,b)}function nd(a,b){var c,d;return a.forEach(function(a){var e=ae(a,b);(c>e||!c)&&(c=e,d=a)}),d}function od(a,b){return Ve.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function pd(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 qd(){return ag&&"desc"===ag.toLowerCase()}function rd(){return ag&&"asc"===ag.toLowerCase()}function sd(a){var b=rd(),c=qd();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 ag&&a.sort(ag),a}function td(a,c){var d,e,f,g,h,i,j,k=Kd(We.data.targets),l=k?ed:dd,m=a.filter(function(a){return a&&b(a.value)});yh&&0!==m.length&&(pi.html(Bh(a,$(),l,Sh)).style("display","block"),d=pi.property("offsetWidth"),e=pi.property("offsetHeight"),k?(g=lf/2+c[0],i=nf/2+c[1]+20):(vg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=If(m[0].x)+20):(f=q(),g=f+t()+If(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),pi.style("top",i+"px").style("left",g+"px"))}function ud(){pi.style("display","none")}function vd(a){var c=a.filter(function(a){return a&&b(a.value)});yh&&(Hd(We.data.targets)||Kd(We.data.targets)||mi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(vg?"y1":"x1",gd).attr(vg?"y2":"x2",gd))}function wd(){mi.select("line."+f.xgridFocus).style("visibility","hidden")}function xd(a){return a.x||0===a.x?If(a.x):null}function yd(a){return V(a.id)(a.value)}function zd(){var a,b,d={},e=0;return zc(xc(Nd)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Dd(a,b){return kh?kh:b?2*a.tickOffset()*lh/b:0}function Ed(a,b){var c,d=a?"string"==typeof a?[a]:a:vc();for(c=0;c0}function _d(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ae(a,b){var c="y"===Z(a.id)?Jf:Kf;return Math.pow(If(a.x)-b[0],2)+Math.pow(c(a.value)-b[1],2)}function be(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function ce(a,b,c){kg(b,a.node()),mi.select("."+f.selectedCircles+Xc(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Jc(f.selectedCircle,c)}).attr("cx",vg?yd:xd).attr("cy",vg?xd:yd).attr("stroke",function(){return Sh(b.id)}).attr("r",1.4*jh).transition().duration(100).attr("r",jh)}function de(a,b,c){lg(b,a.node()),mi.select("."+f.selectedCircles+Xc(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ee(a,b,c,d){a?ce(b,c,d):de(b,c,d)}function fe(a,b){kg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ve.rgb(Sh(b.id)).darker(1)})}function ge(a,b){lg(b,a.node()),a.transition().duration(100).style("fill",function(){return Sh(b.id)})}function he(a,b,c,d){a?fe(b,c,d):ge(b,c,d)}function ie(a){return a.filter(function(a){return b(a.value)})}function je(a,c){return(c?mi.selectAll("."+f.circles+Xc(c)):mi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ke(a,b){je(a,b).classed(f.EXPANDED,!0).attr("r",ih)}function le(a){je(a).filter(function(){return Ve.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",fh)}function me(a){return mi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function ne(a){me(a).classed(f.EXPANDED,!0)}function oe(a){me(a).classed(f.EXPANDED,!1)}function pe(a,b){var c=te(a,b);return function(a,b){var d=c(a,b),e=vg?1:0,f=vg?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 qe(a,b){var c=te(a,!1),d=b?re:se;return function(a,b){return d(c(a,b),a,this)}}function re(a,b){var c;return vg?(c=Nd(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function se(a,b,c){var d=c.getBBox();return vg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:Nd(b)?-3:-6)}function te(a,b){var c=a.__max__+1,d=Dd(Of,c),e=Ad(d,c,a,!!b),f=Bd(!!b),g=Cd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return vg&&(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 ue(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 ve(b){var c,d,e;if(qi=Ve.select(Ye),qi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(qi.html(""),qi.classed("c3",!0),We.data.x={},We.data.targets=pc(b),n(),R(),If.domain(Ve.extent(Zb(We.data.targets))),Jf.domain(Ub(We.data.targets,"y")),Kf.domain(Ub(We.data.targets,"y2")),Lf.domain(If.domain()),Mf.domain(Jf.domain()),Nf.domain(Kf.domain()),ri=If.domain(),fi.scale(Lf),bf&&ji.scale(If),ki=qi.append("svg").attr("width",lf+hf.left+hf.right).attr("height",nf+hf.top+hf.bottom).on("mouseenter",ef).on("mouseleave",ff),li=ki.append("defs"),li.append("clipPath").attr("id",Fh).append("rect").attr("width",lf).attr("height",nf),li.append("clipPath").attr("id",Gh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),li.append("clipPath").attr("id",Hh).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),mi=ki.append("g").attr("transform",Zh.main),ni=og?ki.append("g").attr("transform",Zh.context):null,oi=rg?ki.append("g").attr("transform",Zh.legend):null,pi=Ve.select(Ye).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),mi.append("g").attr("class",f.axisX).attr("clip-path",vg?"":Jh).attr("transform",Zh.x).append("text").attr("class",f.axisXLabel).attr("transform",vg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),Ig&&mi.append("g").attr("class",f.axisY).attr("clip-path",vg?Kh:"").append("text").attr("class",f.axisYLabel).attr("transform",vg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),Rg&&mi.append("g").attr("class",f.axisY2).attr("transform",Zh.y2).append("text").attr("class",f.axisY2Label).attr("transform",vg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=mi.append("g").attr("clip-path",Ih).attr("class",f.grid),$g&&d.append("g").attr("class",f.xgrids),$d(ah)&&d.append("g").attr("class",f.xgridLines),gh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),bh&&d.append("g").attr("class",f.ygrids),$d(ch)&&d.append("g").attr("class",f.ygridLines),mi.append("g").attr("clip-path",Ih).attr("class",f.regions),mi.append("g").attr("clip-path",Ih).attr("class",f.chart),c=mi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",bf?vg?"ns-resize":"ew-resize":null),mi.select("."+f.chart).append("g").attr("class",f.chartBars),mi.select("."+f.chart).append("g").attr("class",f.chartLines),mi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Zh.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),mi.select("."+f.chart).append("g").attr("class",f.chartTexts),bf&&mi.insert("rect",df?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",lf).attr("height",nf).style("opacity",0).style("cursor",vg?"ns-resize":"ew-resize").call(ji).on("dblclick.zoom",null),Gg&&fi.extent("function"!=typeof Gg?Gg:Gg(Zb())),og&&(ni.append("g").attr("clip-path",Ih).attr("class",f.chart),ni.select("."+f.chart).append("g").attr("class",f.chartBars),ni.select("."+f.chart).append("g").attr("class",f.chartLines),ni.append("g").attr("clip-path",Ih).attr("class",f.brush).call(fi).selectAll("rect").attr(vg?"width":"height",vg?mf:of),ni.append("g").attr("class",f.axisX).attr("transform",Zh.subx).attr("clip-path",vg?"":Jh)),Ie(We.data.targets),vg?mi.select("."+f.axisX).style("opacity",0).call(Of):(mi.select("."+f.axisY).style("opacity",0).call(Pf),mi.select("."+f.axisY2).style("opacity",0).call(Qf)),He({withTransform:!0,withLegend:!0,withTransitionForAxis:!1}),Ch){if(Lh&&"string"==typeof Dh){for(Dh=Wd(Dh),e=0;elf&&(lf=0),0>nf&&(nf=0),jf={top:vg?hf.top:qf-pg-($h?0:rf),right:0/0,bottom:20+($h?0:rf),left:vg?ci:hf.left},mf=vg?hf.left-ci-di:lf,of=vg?nf:qf-jf.top-jf.bottom,0>mf&&(mf=0),0>of&&(of=0),kf={top:$h?0:qf-rf,right:0/0,bottom:0,left:$h?pf-sf:0},p(),$h&&Kd(We.data.targets)&&(kf.left=lf/2+uf)}function o(){mi.select("line."+f.xgridFocus).attr("x1",vg?0:-10).attr("x2",vg?lf:-10).attr("y1",vg?-10:hf.top).attr("y2",vg?-10:nf)}function p(){uf=nf/2,tf=.95*uf,vf=Jd(We.data.targets)?.6*tf:0}function q(){var a=vg?f.axisX:f.axisY,b=Ve.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Ve.select(Ye).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Ze?Ze:x()}function s(){var a=$e?$e:y();return a>0?a:320}function t(){return Kd(We.data.targets)?0:_e?_e:vg||!Ig||Ng?1:v("y")}function u(){var a=1;return Kd(We.data.targets)?0:af?af:$h?sf+(Rg&&!vg?v("y2"):a):Rg?Wg||vg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||Ig?"y2"!==a||Rg?(gb(a).isInner?30:40)+("y2"===a?-10:0):ei:rg&&!$h?10:1}function x(){return+Ve.select(Ye).style("width").replace("px","")}function y(){return+Ve.select(Ye).style("height").replace("px","")}function z(a){return a?-5:-(hf.left-1)}function A(a){return a?-20:-1}function B(){return z(!vg)}function C(){return A(!vg)}function D(){return z(vg)}function E(){return A(vg)}function F(a){return a?lf+2+4:hf.left+20}function G(a){return a?80:nf+2}function H(){return F(!vg)}function I(){return G(!vg)}function J(){return F(vg)}function K(){return G(vg)}function L(){var a=vg?nf:lf,b=tc(),c=Vb()*(Gd(We.data.targets)?(b-(Mh?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){_h=a}function N(a){ai=a}function O(a){bi=a}function P(){return rg?$h?ai*(_h+1):pf:0}function Q(){return rg?$h?qf:bi*(_h+1):0}function R(){var a,b=!If;Af=vg?1:0,Bf=vg?nf:lf,Cf=vg?0:nf,Df=vg?lf:1,Ef=Af,Ff=Bf,Gf=vg?0:of,Hf=vg?mf:1,If=T(Af,Bf,b?void 0:If.domain(),function(){return Of.tickOffset()}),Jf=U(Cf,Df),Kf=U(Cf,Df),Lf=T(Af,Bf,ri,function(a){return a%1?0:Rf.tickOffset()}),Mf=U(Gf,Hf),Nf=U(Gf,Hf),a=$(),Of=X(If,Vh,a),Rf=X(Lf,Yh,a),Pf=Y(Jf,Wh,Og,Qg),Qf=Y(Kf,Xh,Xg,Zg),b||(fi.scale(Lf),bf&&ji.scale(If)),S()}function S(){wf=Db(),xf=Eb(),yf=Eb(.98)}function T(a,b,e,f){var g=(Lh?Ve.time.scale():Ve.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),Mh){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return Ve.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?Kf:Jf}function W(a){return"y2"===Z(a)?Nf:Mf}function X(a,b,c){var d=(Mh?Bb():Ve.svg.axis()).scale(a).orient(b);return d.tickFormat(c),Mh?d.tickCentered(yg):d.tickOffset=function(){var a=vg?nf:lf;return a*Vb()/tc()/2},Mh&&d.categories(xg),d}function Y(a,b,c,d){return Ve.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Yf?Yf[a]:"y"}function $(){var a=Lh?Th:Mh?Ic:function(a){return 0>a?a.toFixed(0):a};return zg&&("function"==typeof zg?a=zg:Lh&&(a=function(a){return Ve.time.format(zg)(a)})),a}function _(a){var b;return"y"===a?b=Mg:"y2"===a?b=Vg:"x"===a&&(b=Hg),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Mg=b:"y2"===a?Vg=b:"x"===a&&(Hg=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",vg?"inner-top":"inner-right")}function eb(){return cb("y",vg?"inner-right":"inner-top")}function fb(){return cb("y2",vg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?lf/2:lf:b.isBottom?-nf:b.isMiddle?-nf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!vg,db())}function ob(){return kb(vg,eb())}function pb(){return kb(vg,fb())}function qb(){return lb(!vg,db())}function rb(){return lb(vg,eb())}function sb(){return lb(vg,fb())}function tb(){var a=db();return vg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return vg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return vg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!vg,db())}function xb(){return mb(vg,eb())}function yb(){return mb(vg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return Ve.selectAll("."+c+" .tick text").each(function(){var a=this.getBBox();bb?20:b}function Ab(){mi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),mi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),mi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+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=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]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return Ve.min(Object.keys(i).map(function(a){return Ve.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=vc(a),i=Ec(a);if(Xf.length>0)for(g=Hc(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 Ve.max(Object.keys(i).map(function(a){return Ve.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Tg:Kg,n="y2"===c?Sg:Jg,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?Ug:Lg,r=bd()&&vg;return 0===l.length?"y2"===c?Kf.domain():Jf.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=cd(o,p),j=$b(Jf.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Pg&&(f=b(Pg.top)?Pg.top:e,g=b(Pg.bottom)?Pg.bottom:e),"y2"===c&&Yg&&(f=b(Yg.top)?Yg.top:e,g=b(Yg.bottom)?Yg.bottom:e),Gd(l)&&!Gc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(ri),c=$b(If.domain());return a||0===c?1:b/c}function Wb(a){return Fg?Fg:Ve.min(a,function(a){return Ve.min(a.values,function(a){return a.x})})}function Xb(a){return Eg?Eg:Ve.max(a,function(a){return Ve.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return Mh?d=0:Gd(a)?(c=tc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=Lh?new Date(c.getTime()-e):c-e,g=Lh?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return Sf&&a===Sf||$d(Tf)&&_d(Tf,a)}function fc(a){return!ec(a)}function gc(a){return Sf?Sf:$d(Tf)?Tf[a]:null}function hc(a,b){return a in We.data.x&&We.data.x[a]&&We.data.x[a][b]?We.data.x[a][b]:b}function ic(a){Object.keys(a).forEach(function(b){Tf[b]=a[b]})}function jc(a){var b;return a&&(b=Wf[a.id],a.name=b?b:a.id),a}function kc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=mc(b[d],a.id,d)}),We.data.x[a.id]=b})}function lc(a,b){a.forEach(function(a){b[a.id]&&kc([a],b[a.id])})}function mc(a,b,c){var d;return d=Lh?a?a instanceof Date?a:Wd(a):Wd(hc(b,c)):Nh&&!Mh?a?+a:hc(b,c):c}function nc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0&&(We.data.x[b]=a.map(function(a){return a[c]})):We.data.x[b]=a.map(function(a,b){return b})}),c.forEach(function(a){if(!We.data.x[a])throw new Error('x is not defined for id = "'+a+'".')}),b=c.map(function(b,c){var d=Vf(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=mc(g,b,e);return Nh&&Mh&&0===c&&g&&(0===e&&(xg=[]),xg.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++})}),Zf&&Ed(vc(b).filter(function(a){return!(a in $f)}),Zf),b.forEach(function(a){ac(a.id_org,a)}),b}function qc(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 rc(a){return a>0&&We.data.targets[0].values[a-1]?We.data.targets[0].values[a-1].x:void 0}function sc(a){return a1?We.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?We.data.targets[0]:null,a}function vc(a){return a=c(a)?We.data.targets:a,a.map(function(a){return a.id})}function wc(a){var b,c=vc();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(Lh?new Date(h):h);i.push(d)}return i}function Cc(a){Uh=Uh.concat(a)}function Dc(a){Uh=Uh.filter(function(b){return a.indexOf(b)<0})}function Ec(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Fc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Hc(a){return Fc(a,function(a){return a>0})}function Ic(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(kd(a,f))),a[g].x&&(e=e.concat(kd(a,g))),nd(e,b)):ld(a,b,f,g)}function md(a,b){var c;return c=a.map(function(a){return ld(a.values,b)}),nd(c,b)}function nd(a,b){var c,d;return a.forEach(function(a){var e=ae(a,b);(c>e||!c)&&(c=e,d=a)}),d}function od(a,b){return Ve.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function pd(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 qd(){return ag&&"desc"===ag.toLowerCase()}function rd(){return ag&&"asc"===ag.toLowerCase()}function sd(a){var b=rd(),c=qd();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 ag&&a.sort(ag),a}function td(a,c){var d,e,f,g,h,i,j,k=Kd(We.data.targets),l=k?ed:dd,m=a.filter(function(a){return a&&b(a.value)});yh&&0!==m.length&&(pi.html(Bh(a,$(),l,Sh)).style("display","block"),d=pi.property("offsetWidth"),e=pi.property("offsetHeight"),k?(g=lf/2+c[0],i=nf/2+c[1]+20):(vg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=If(m[0].x)+20):(f=q(),g=f+t()+If(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),pi.style("top",i+"px").style("left",g+"px"))}function ud(){pi.style("display","none")}function vd(a){var c=a.filter(function(a){return a&&b(a.value)});yh&&(Hd(We.data.targets)||Kd(We.data.targets)||mi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(vg?"y1":"x1",gd).attr(vg?"y2":"x2",gd))}function wd(){mi.select("line."+f.xgridFocus).style("visibility","hidden")}function xd(a){return a.x||0===a.x?If(a.x):null}function yd(a){return V(a.id)(a.value)}function zd(){var a,b,d={},e=0;return zc(xc(Nd)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Dd(a,b){return kh?kh:b?2*a.tickOffset()*lh/b:0}function Ed(a,b){var c,d=a?"string"==typeof a?[a]:a:vc();for(c=0;c0}function _d(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ae(a,b){var c="y"===Z(a.id)?Jf:Kf;return Math.pow(If(a.x)-b[0],2)+Math.pow(c(a.value)-b[1],2)}function be(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function ce(a,b,c){kg(b,a.node()),mi.select("."+f.selectedCircles+Xc(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Jc(f.selectedCircle,c)}).attr("cx",vg?yd:xd).attr("cy",vg?xd:yd).attr("stroke",function(){return Sh(b.id)}).attr("r",1.4*jh).transition().duration(100).attr("r",jh)}function de(a,b,c){lg(b,a.node()),mi.select("."+f.selectedCircles+Xc(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ee(a,b,c,d){a?ce(b,c,d):de(b,c,d)}function fe(a,b){kg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ve.rgb(Sh(b.id)).darker(1)})}function ge(a,b){lg(b,a.node()),a.transition().duration(100).style("fill",function(){return Sh(b.id)})}function he(a,b,c,d){a?fe(b,c,d):ge(b,c,d)}function ie(a){return a.filter(function(a){return b(a.value)})}function je(a,c){return(c?mi.selectAll("."+f.circles+Xc(c)):mi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ke(a,b){je(a,b).classed(f.EXPANDED,!0).attr("r",ih)}function le(a){je(a).filter(function(){return Ve.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",fh)}function me(a){return mi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function ne(a){me(a).classed(f.EXPANDED,!0)}function oe(a){me(a).classed(f.EXPANDED,!1)}function pe(a,b){var c=te(a,b);return function(a,b){var d=c(a,b),e=vg?1:0,f=vg?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 qe(a,b){var c=te(a,!1),d=b?re:se;return function(a,b){return d(c(a,b),a,this)}}function re(a,b){var c;return vg?(c=Nd(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function se(a,b,c){var d=c.getBBox();return vg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:Nd(b)?-3:-6)}function te(a,b){var c=a.__max__+1,d=Dd(Of,c),e=Ad(d,c,a,!!b),f=Bd(!!b),g=Cd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return vg&&(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 ue(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 ve(b){var c,d,e;if(qi=Ve.select(Ye),qi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(qi.html(""),qi.classed("c3",!0),We.data.x={},We.data.targets=pc(b),n(),R(),If.domain(Ve.extent(Zb(We.data.targets))),Jf.domain(Ub(We.data.targets,"y")),Kf.domain(Ub(We.data.targets,"y2")),Lf.domain(If.domain()),Mf.domain(Jf.domain()),Nf.domain(Kf.domain()),ri=If.domain(),fi.scale(Lf),bf&&ji.scale(If),ki=qi.append("svg").attr("width",lf+hf.left+hf.right).attr("height",nf+hf.top+hf.bottom).on("mouseenter",ef).on("mouseleave",ff),li=ki.append("defs"),li.append("clipPath").attr("id",Fh).append("rect").attr("width",lf).attr("height",nf),li.append("clipPath").attr("id",Gh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),li.append("clipPath").attr("id",Hh).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),mi=ki.append("g").attr("transform",Zh.main),ni=og?ki.append("g").attr("transform",Zh.context):null,oi=rg?ki.append("g").attr("transform",Zh.legend):null,pi=Ve.select(Ye).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),mi.append("g").attr("class",f.axisX).attr("clip-path",vg?"":Jh).attr("transform",Zh.x).append("text").attr("class",f.axisXLabel).attr("transform",vg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),Ig&&mi.append("g").attr("class",f.axisY).attr("clip-path",vg?Kh:"").append("text").attr("class",f.axisYLabel).attr("transform",vg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),Rg&&mi.append("g").attr("class",f.axisY2).attr("transform",Zh.y2).append("text").attr("class",f.axisY2Label).attr("transform",vg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=mi.append("g").attr("clip-path",Ih).attr("class",f.grid),$g&&d.append("g").attr("class",f.xgrids),$d(ah)&&d.append("g").attr("class",f.xgridLines),gh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),bh&&d.append("g").attr("class",f.ygrids),$d(ch)&&d.append("g").attr("class",f.ygridLines),mi.append("g").attr("clip-path",Ih).attr("class",f.regions),mi.append("g").attr("clip-path",Ih).attr("class",f.chart),c=mi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",bf?vg?"ns-resize":"ew-resize":null),mi.select("."+f.chart).append("g").attr("class",f.chartBars),mi.select("."+f.chart).append("g").attr("class",f.chartLines),mi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Zh.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),mi.select("."+f.chart).append("g").attr("class",f.chartTexts),bf&&mi.insert("rect",df?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",lf).attr("height",nf).style("opacity",0).style("cursor",vg?"ns-resize":"ew-resize").call(ji).on("dblclick.zoom",null),Gg&&fi.extent("function"!=typeof Gg?Gg:Gg(Zb())),og&&(ni.append("g").attr("clip-path",Ih).attr("class",f.chart),ni.select("."+f.chart).append("g").attr("class",f.chartBars),ni.select("."+f.chart).append("g").attr("class",f.chartLines),ni.append("g").attr("clip-path",Ih).attr("class",f.brush).call(fi).selectAll("rect").attr(vg?"width":"height",vg?mf:of),ni.append("g").attr("class",f.axisX).attr("transform",Zh.subx).attr("clip-path",vg?"":Jh)),Ie(We.data.targets),vg?mi.select("."+f.axisX).style("opacity",0).call(Of):(mi.select("."+f.axisY).style("opacity",0).call(Pf),mi.select("."+f.axisY2).style("opacity",0).call(Qf)),He({withTransform:!0,withLegend:!0,withTransitionForAxis:!1}),Ch){if(Lh&&"string"==typeof Dh){for(Dh=Wd(Dh),e=0;e0){d=[];for(var g in Wf)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=pd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=he,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 Ae(a){Kd(We.data.targets)||dg&&(Oh=a,mi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ph=!0,mg())}function Be(){Kd(We.data.targets)||dg&&(mi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),mi.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ph=!1,ng())}function Ce(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P=zd(),Q=Kd(We.data.targets),R=zc(We.data.targets);if(0!==R.length){if(a=d(a)?a:{},v=d(a.withY)?a.withY:!0,w=d(a.withSubchart)?a.withSubchart:!0,x=d(a.withTransition)?a.withTransition:!0,A=d(a.withTransform)?a.withTransform:!1,B=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,C=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,D=d(a.withLegend)?a.withLegend:!1,y=d(a.withTransitionForExit)?a.withTransitionForExit:x,z=d(a.withTransitionForAxis)?a.withTransitionForAxis:x,I=x?gf:0,J=y?I:0,K=z?I:0,D&&rg&&Qe(We.data.targets,a),C&&(If.domain(Ve.extent(Zb(R))),ri=If.domain(),bf&&ji.scale(If).updateScaleExtent(),Lf.domain(If.domain()),fi.scale(Lf)),B&&(If.domain(fi.empty()?ri:fi.extent()),bf&&ji.scale(If).updateScaleExtent(),Hd(R)||(M=Bc(Ac(R)),Of.tickValues(M),Rf.tickValues(M))),Jf.domain(Ub(R,"y")),Kf.domain(Ub(R,"y2")),mi.select("."+f.axisX).style("opacity",Q?0:1).transition().duration(K).call(Of),mi.select("."+f.axisY).style("opacity",Q?0:1).transition().duration(K).call(Pf),mi.select("."+f.axisY2).style("opacity",Q?0:1).transition().duration(K).call(Qf),B&&Ag&&M){for(N=1;N=V;V++)e.push(new Date(V+"-01-01 00:00:00"))}else e=If.ticks(10);c=mi.select("."+f.xgrids).selectAll("."+f.xgrid).data(e),c.enter().append("line").attr("class",f.xgrid),c.attr("x1",vg?0:function(a){return If(a)-Of.tickOffset()}).attr("x2",vg?lf:function(a){return If(a)-Of.tickOffset()}).attr("y1",vg?function(a){return If(a)-Of.tickOffset()}:hf.top).attr("y2",vg?function(a){return If(a)-Of.tickOffset()}:nf).style("opacity",function(){return+Ve.select(this).attr(vg?"y1":"x1")===(vg?nf:0)?0:1}),c.exit().remove()}$d(ah)&&(g=mi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(ah),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",vg?"":"rotate(-90)").attr("dx",vg?0:-hf.top).attr("dy",-5).style("opacity",0),g.select("line").transition().duration(I).attr("x1",vg?0:hd).attr("x2",vg?lf:hd).attr("y1",vg?hd:hf.top).attr("y2",vg?hd:nf).style("opacity",1),g.select("text").transition().duration(I).attr("x",vg?lf:0).attr("y",hd).text(function(a){return a.text}).style("opacity",1),g.exit().transition().duration(I).style("opacity",0).remove()),v&&bh&&(i=mi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Jf.ticks(dh)),i.enter().append("line").attr("class",f.ygrid),i.attr("x1",vg?Jf:0).attr("x2",vg?Jf:lf).attr("y1",vg?0:Jf).attr("y2",vg?nf:Jf),i.exit().remove()),v&&$d(ch)&&(j=mi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(ch),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",vg?"rotate(-90)":"").attr("dx",vg?0:-hf.top).attr("dy",-5).style("opacity",0),j.select("line").transition().duration(I).attr("x1",vg?id:0).attr("x2",vg?id:lf).attr("y1",vg?0:id).attr("y2",vg?nf:id).style("opacity",1),j.select("text").transition().duration(I).attr("x",vg?0:lf).attr("y",id).text(function(a){return a.text}).style("opacity",1),j.exit().transition().duration(I).style("opacity",0).remove()),m=mi.selectAll("."+f.bars).selectAll("."+f.bar).data(Sd),m.enter().append("path").attr("d",E).style("stroke","none").style("opacity",0).style("fill",function(a){return Sh(a.id)}).attr("class",Rc),m.style("opacity",Zc).transition().duration(I).attr("d",E).style("opacity",1),m.exit().transition().duration(J).style("opacity",0).remove(),p=mi.selectAll("."+f.texts).selectAll("."+f.text).data(Ud),p.enter().append("text").attr("class",Kc).attr("text-anchor",function(a){return vg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),p.text(function(a){return fd(a.id)(a.value)}).style("fill-opacity",$c).transition().duration(I).attr("x",G).attr("y",H).style("fill-opacity",ad),p.exit().transition().duration(J).style("fill-opacity",0).remove(),mi.selectAll("."+f.line).style("opacity",Zc).transition().duration(I).attr("d",gi).style("opacity",1),mi.selectAll("."+f.area).style("opacity",0).transition().duration(I).attr("d",hi).style("opacity",si),l=mi.selectAll("."+f.circles).selectAll("."+f.circle).data(Td),l.enter().append("circle").attr("class",Pc).style("opacity",0).attr("r",fh),l.style("opacity",Zc).transition().duration(I).style("opacity",_c).attr("cx",vg?yd:xd).attr("cy",vg?xd:yd),l.exit().remove(),mi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",A?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(I).attrTween("d",function(a){var b,c=Cb(a);return c?(b=Ve.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",A?"scale(1)":"").style("opacity",1),mi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(I).text(Jb).style("opacity",function(a){return yc(a.data.id)&&Rd(a.data)?1:0}),mi.select("."+f.chartArcsTitle).style("opacity",Jd(We.data.targets)?1:0),og&&(null!==Ve.event&&"zoom"===Ve.event.type&&fi.extent(If.orgDomain()).update(),w&&(ni.select("."+f.axisX).style("opacity",Q?0:1).transition().duration(I).call(Rf),fi.empty()||fi.extent(If.orgDomain()).update(),F=pe(P,!0),q=ni.selectAll("."+f.bars).selectAll("."+f.bar).data(Sd),q.enter().append("path").attr("d",F).style("stroke","none").style("fill",function(a){return Sh(a.id)}).attr("class",Rc),q.style("opacity",Zc).transition().duration(I).attr("d",F).style("opacity",1),q.exit().transition().duration(I).style("opacity",0).remove(),ni.selectAll("."+f.line).style("opacity",Zc).transition().duration(I).attr("d",ii).style("opacity",1))),mi.selectAll("."+f.selectedCircles).filter(function(a){return Nd(a)}).selectAll("circle").remove(),mi.selectAll("."+f.selectedCircle).transition().duration(I).attr("cx",vg?yd:xd).attr("cy",vg?xd:yd),$d(Tf)?(r=mi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),xe(r.enter()),r.attr("x",0).attr("y",0).attr("width",lf).attr("height",nf)):(Nh&&!Mh?(u=function(a,b){var c=rc(b),d=sc(b),e=We.data.x[a.id][b];return(If(d?d:e+50)-If(c?c:e-50))/2},t=function(a,b){var c=rc(b),d=We.data.x[a.id][b];return(If(d)+If(c?c:d-50))/2}):(u=L(),t=function(a){return If(a.x)-u/2}),s=uc(),mi.select("."+f.eventRects).datum(s?s.values:[]),r=mi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),we(r.enter()),r.attr("class",Wc).attr("x",vg?0:t).attr("y",vg?t:0).attr("width",vg?lf:u).attr("height",vg?u:nf),r.exit().remove()),n=mi.select("."+f.regions).selectAll("rect."+f.region).data(xh),n.enter().append("rect").style("fill-opacity",0),n.attr("class",Vc).attr("x",vg?0:cc).attr("y",vg?cc:hf.top).attr("width",vg?lf:dc).attr("height",vg?dc:nf).transition().duration(I).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),n.exit().transition().duration(I).style("fill-opacity",0).remove(),vc().forEach(function(a){ti[a]=!0})}}function De(){Ce({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ee(){return"mousemove"===Ve.event.sourceEvent.type&&ji.altDomain?(If.domain(ji.altDomain),void ji.scale(If).updateScaleExtent()):(Mh&&If.orgDomain()[0]===ri[0]&&If.domain([ri[0]-1e-10,If.orgDomain()[1]]),Ce({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Ve.event.sourceEvent.type&&(Qh=!0)))}function Fe(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ge(){ki.attr("width",pf).attr("height",qf),ki.select("#"+Fh).select("rect").attr("width",lf).attr("height",nf),ki.select("#"+Gh).select("rect").attr("width",H),ki.select("#"+Hh).select("rect").attr("width",J),ki.select("."+f.zoomRect).attr("width",lf).attr("height",nf)}function He(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(),R(),Ge(),m(a.withTransition),Ce(a)}function Ie(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=mi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a),j=i.enter().append("g").attr("class",function(a){return f.chartText+Jc(f.target,a.id)}).style("pointer-events","none"),j.append("g").attr("class",Lc).style("fill",function(a){return Sh(a.id)}),e=mi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),d=e.enter().append("g").attr("class",function(a){return f.chartBar+Jc(f.target,a.id)}).style("pointer-events","none"),d.append("g").attr("class",Sc).style("fill",function(a){return Sh(a.id)}).style("stroke","none").style("cursor",function(a){return fg(a)?"pointer":null}),c=mi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),b=c.enter().append("g").attr("class",function(a){return f.chartLine+Jc(f.target,a.id)}).style("pointer-events","none"),b.append("path").attr("class",Oc).style("opacity",0).style("stroke",function(a){return Sh(a.id)}),b.append("path").attr("class",Uc).style("opacity",function(){return si=+Ve.select(this).style("opacity"),0}).style("fill",function(a){return Sh(a.id)}),b.append("g").attr("class",function(a){return Jc(f.selectedCircles,a.id)}),b.append("g").attr("class",Qc).style("fill",function(a){return Sh(a.id)}).style("cursor",function(a){return fg(a)?"pointer":null}),a.forEach(function(a){mi.selectAll("."+f.selectedCircles+Xc(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=mi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(zf(a)),g=h.enter().append("g").attr("class",function(a){return f.chartArc+Jc(f.target,a.data.id)}),g.append("path").attr("class",Tc).style("opacity",0).style("fill",function(a){return Sh(a.data.id)}).style("cursor",function(a){return fg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),Ne(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];td(c,Ve.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),Pe(),ud(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),og&&(n=ni.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),m=n.enter().append("g").attr("class",function(a){return f.chartBar+Jc(f.target,a.id)}),m.append("g").attr("class",Sc).style("fill",function(a){return Sh(a.id)}),l=ni.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),k=l.enter().append("g").attr("class",function(a){return f.chartLine+Jc(f.target,a.id)}),k.append("path").attr("class",Oc).style("opacity",0).style("stroke",function(a){return Sh(a.id)})),ki.selectAll("."+f.target).filter(function(a){return yc(a.id)}).transition().style("opacity",1)}function Je(a,b){We.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=$h?i:h,k=$h?rf:sf;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=$h?u:t,ug?(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=vc(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,$h?(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=oi.selectAll("."+f.legendItem).data(q).enter().append("g").attr("class",function(a){return Jc(f.legendItem,a)}).style("cursor","pointer").on("click",function(a){"function"==typeof tg?tg(a):We.toggle(a)}).on("mouseover",function(a){We.focus(a)}).on("mouseout",function(){We.revert()}),g.append("text").text(function(a){return d(Wf[a])?Wf[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",$h?i:-200).attr("y",$h?-200:l),g.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",$h?j:-200).attr("y",$h?-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 Sh(a)}).attr("x",$h?i:-200).attr("y",$h?-200:k).attr("width",10).attr("height",10),oi.selectAll("text").data(q).text(function(a){return d(Wf[a])?Wf[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",i).attr("y",l),oi.selectAll("rect."+f.legendItemEvent).data(q).transition().duration(p?250:0).attr("x",j).attr("y",o),oi.selectAll("rect."+f.legendItemTile).data(q).transition().duration(p?250:0).attr("x",h).attr("y",k),N(t),O(u),M(C),n(),R(),Ge(),m(!1)}function Re(a){return wc(a.id)}function Se(a){return"data"in a&&wc(a.data.id)}function Te(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 Ue(a,b,c){var d=!Kd(We.data.targets);Ed(a,b),He(c?c:{withTransitionForAxis:d})}var Ve=a.d3?a.d3:a.require?a.require("d3"):void 0,We={data:{},axis:{}},Xe={},Ye=h(["bindto"],"#chart"),Ze=h(["size","width"]),$e=h(["size","height"]),_e=h(["padding","left"]),af=h(["padding","right"]),bf=h(["zoom","enabled"],!1),cf=h(["zoom","extent"]),df=h(["zoom","privileged"],!1),ef=h(["onenter"],function(){}),ff=h(["onleave"],function(){}),gf=h(["transition","duration"],350);g("data","data is required in config");var 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,Rf,Sf=h(["data","x"]),Tf=h(["data","xs"],{}),Uf=h(["data","x_format"]),Vf=h(["data","id_converter"],function(a){return a}),Wf=h(["data","names"],{}),Xf=h(["data","groups"],[]),Yf=h(["data","axes"],{}),Zf=h(["data","type"]),$f=h(["data","types"],{}),_f=h(["data","labels"],{}),ag=h(["data","order"]),bg=h(["data","regions"],{}),cg=h(["data","colors"],{}),dg=h(["data","selection","enabled"],!1),eg=h(["data","selection","grouped"],!1),fg=h(["data","selection","isselectable"],function(){return!0}),gg=h(["data","selection","multiple"],!0),hg=h(["data","onclick"],function(){}),ig=h(["data","onenter"],function(){}),jg=h(["data","onleave"],function(){}),kg=h(["data","onselected"],function(){}),lg=h(["data","onunselected"],function(){}),mg=h(["data","ondragstart"],function(){}),ng=h(["data","ondragend"],function(){}),og=h(["subchart","show"],!1),pg=og?h(["subchart","size","height"],60):0,qg=h(["color","pattern"],[]),rg=h(["legend","show"],!0),sg=h(["legend","position"],"bottom"),tg=h(["legend","item","onclick"]),ug=h(["legend","equally"],!1),vg=h(["axis","rotated"],!1),wg=h(["axis","x","type"],"indexed"),xg=h(["axis","x","categories"],[]),yg=h(["axis","x","tick","centered"],!1),zg=h(["axis","x","tick","format"]),Ag=h(["axis","x","tick","culling"],{}),Bg=h(["axis","x","tick","culling","max"],"categorized"===wg?1/0:10),Cg=h(["axis","x","tick","count"]),Dg=h(["axis","x","tick","fit"],!1),Eg=h(["axis","x","max"]),Fg=h(["axis","x","min"]),Gg=h(["axis","x","default"]),Hg=h(["axis","x","label"],{}),Ig=h(["axis","y","show"],!0),Jg=h(["axis","y","max"]),Kg=h(["axis","y","min"]),Lg=h(["axis","y","center"]),Mg=h(["axis","y","label"],{}),Ng=h(["axis","y","inner"],!1),Og=h(["axis","y","tick","format"]),Pg=h(["axis","y","padding"],{}),Qg=h(["axis","y","ticks"],10),Rg=h(["axis","y2","show"],!1),Sg=h(["axis","y2","max"]),Tg=h(["axis","y2","min"]),Ug=h(["axis","y2","center"]),Vg=h(["axis","y2","label"],{}),Wg=h(["axis","y2","inner"],!1),Xg=h(["axis","y2","tick","format"]),Yg=h(["axis","y2","padding"],{}),Zg=h(["axis","y2","ticks"],10),$g=h(["grid","x","show"],!1),_g=h(["grid","x","type"],"tick"),ah=h(["grid","x","lines"],[]),bh=h(["grid","y","show"],!1),ch=h(["grid","y","lines"],[]),dh=h(["grid","y","ticks"],10),eh=h(["point","show"],!0),fh=eh?h(["point","r"],2.5):0,gh=h(["point","focus","line","enabled"],!0),hh=h(["point","focus","expand","enabled"],!0),ih=h(["point","focus","expand","r"],hh?4:fh),jh=h(["point","focus","select","r"],8),kh=h(["bar","width"]),lh=h(["bar","width","ratio"],.6),mh=h(["pie","label","show"],!0),nh=h(["pie","label","format"]),oh=h(["pie","onclick"],function(){}),ph=h(["pie","onmouseover"],function(){}),qh=h(["pie","onmouseout"],function(){}),rh=h(["donut","label","show"],!0),sh=h(["donut","label","format"]),th=h(["donut","title"],""),uh=h(["donut","onclick"],function(){}),vh=h(["donut","onmouseover"],function(){}),wh=h(["donut","onmouseout"],function(){}),xh=h(["regions"],[]),yh=h(["tooltip","show"],!0),zh=h(["tooltip","format","title"]),Ah=h(["tooltip","format","value"]),Bh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=zh?zh:b,l=Ah?Ah: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+""}),Ch=h(["tooltip","init","show"],!1),Dh=h(["tooltip","init","x"],0),Eh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Fh=("string"==typeof Ye?Ye.replace("#",""):Ye.id)+"-clip",Gh=Fh+"-xaxis",Hh=Fh+"-yaxis",Ih=i(Fh),Jh=i(Jh),Kh=i(Kh),Lh="timeseries"===wg,Mh="categorized"===wg,Nh=!Lh&&(Sf||$d(Tf)),Oh=null,Ph=!1,Qh=!1,Rh=!1,Sh=Vd(cg,qg),Th=function(){var a=[[Ve.time.format("%Y/%-m/%-d"),function(){return!0}],[Ve.time.format("%-m/%-d"),function(a){return a.getMonth()}],[Ve.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ve.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ve.time.format("%I %p"),function(a){return a.getHours()}],[Ve.time.format("%I:%M"),function(a){return a.getMinutes()}],[Ve.time.format(":%S"),function(a){return a.getSeconds()}],[Ve.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)}}(),Uh=[],Vh=vg?"left":"bottom",Wh=vg?Ng?"top":"bottom":Ng?"right":"left",Xh=vg?Wg?"bottom":"top":Wg?"left":"right",Yh=vg?"left":"bottom",Zh={main:function(){return"translate("+hf.left+","+hf.top+")"},context:function(){return"translate("+jf.left+","+jf.top+")"},legend:function(){return"translate("+kf.left+","+kf.top+")"},x:function(){return"translate(0,"+(vg?0:nf)+")"},y:function(){return"translate(0,"+(vg?nf:0)+")"},y2:function(){return"translate("+(vg?0:lf)+","+(vg?1:0)+")"},subx:function(){return"translate(0,"+(vg?0:of)+")"},arc:function(){return"translate("+lf/2+","+nf/2+")"}},$h="right"===sg,_h=0,ai=0,bi=0,ci=30,di=30,ei=5;zf=Ve.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var fi,gi=function(){var a=Ve.svg.line().x(vg?function(a){return V(a.id)(a.value)}:gd).y(vg?gd:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=ie(b.values);return Ld(b)?(a.interpolate(Md(b)?"cardinal":"linear"),bg[b.id]?ue(e,If,V(b.id),bg[b.id]):a(e)):(c=If(e[0].x),d=V(b.id)(e[0].value),vg?"M "+d+" "+c:"M "+c+" "+d)}}(),hi=function(){var a;return a=vg?Ve.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(gd):Ve.svg.area().x(gd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=ie(b.values);return Fd([b],"area")||Fd([b],"area-spline")?(a.interpolate(Md(b)?"cardinal":"linear"),a(e)):(c=If(e[0].x),d=V(b.id)(e[0].value),vg?"M "+d+" "+c:"M "+c+" "+d)}}(),ii=function(){var a=Ve.svg.line().x(vg?function(a){return W(a.id)(a.value)}:jd).y(vg?jd:function(a){return W(a.id)(a.value)});return function(b){var c=ie(b.values);return Ld(b)?a(c):"M "+Lf(c[0].x)+" "+W(b.id)(c[0].value)}}(),ji=function(){};fi=Ve.svg.brush().on("brush",De),fi.update=function(){return ni&&ni.select("."+f.brush).call(this),this},fi.scale=function(a){return vg?this.y(a):this.x(a)},bf&&(ji=Ve.behavior.zoom().on("zoomstart",function(){ji.altDomain=Ve.event.sourceEvent.altKey?If.orgDomain():null}).on("zoom",bf?Ee:null),ji.scale=function(a){return vg?this.y(a):this.x(a)},ji.orgScaleExtent=function(){var a=cf?cf:[1,10];return[a[0],Math.max(tc()/a[1],a[1])]},ji.updateScaleExtent=function(){var a=$b(If.orgDomain())/$b(ri),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var ki,li,mi,ni,oi,pi,qi,ri,si,ti={};if(We.focus=function(a){function b(a){zc(a).transition().duration(100).style("opacity",1)}var c=ki.selectAll(Yc(a)),d=c.filter(Re),e=c.filter(Se);We.revert(),We.defocus(),b(d.classed(f.focused,!0)),b(e),Kd(We.data.targets)&&Kb(a,!0),Ne(a)},We.defocus=function(a){function b(a){zc(a).transition().duration(100).style("opacity",.3)}var c=ki.selectAll(Yc(a)),d=c.filter(Re),e=c.filter(Se);We.revert(),b(d.classed(f.focused,!1)),b(e),Kd(We.data.targets)&&Lb(a),Oe(a)},We.revert=function(a){function b(a){zc(a).transition().duration(100).style("opacity",1)}var c=ki.selectAll(Yc(a)),d=c.filter(Re),e=c.filter(Se);b(d.classed(f.focused,!1)),b(e),Kd(We.data.targets)&&Lb(a),Pe()},We.show=function(a){Dc(a),ki.selectAll(Yc(a)).transition().style("opacity",1),Ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!1})},We.hide=function(a){Cc(a),ki.selectAll(Yc(a)).transition().style("opacity",0),Ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!1})},We.toggle=function(a){yc(a)?We.hide(a):We.show(a)},We.unzoom=function(){fi.clear().update(),Ce({withUpdateXDomain:!0})},We.load=function(a){return a.xs&&ic(a.xs),"categories"in a&&Mh&&(xg=a.categories,Of.categories(xg)),"cacheIds"in a&&_b(a.cacheIds)?void Je(bc(a.cacheIds),a.done):void("unload"in a?Le("string"==typeof a.unload?[a.unload]:"boolean"==typeof a.unload&&a.unload?vc():a.unload,function(){Ke(a)}):Ke(a))},We.unload=function(a){Le(a?"string"==typeof a?[a]:a:vc(),function(){Ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},We.selected=function(a){return Ve.merge(mi.selectAll("."+f.shapes+Xc(a)).selectAll("."+f.shape).filter(function(){return Ve.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},We.select=function(a,b,c){dg&&mi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=Ve.select(this),i="circle"===this.nodeName?ce:fe,j="circle"===this.nodeName?de:ge,k=eg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?fg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},We.unselect=function(a,b){dg&&mi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=Ve.select(this),g="circle"===this.nodeName?de:ge,h=eg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&fg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},We.toLine=function(a){Ue(a,"line")},We.toSpline=function(a){Ue(a,"spline")},We.toBar=function(a){Ue(a,"bar")},We.toScatter=function(a){Ue(a,"scatter")},We.toArea=function(a){Ue(a,"area")},We.toAreaSpline=function(a){Ue(a,"area-spline")},We.toPie=function(a){Ue(a,"pie",{withTransform:!0})},We.toDonut=function(a){Ue(a,"donut",{withTransform:!0})},We.groups=function(a){return c(a)?Xf:(Xf=a,Ce(),Xf)},We.xgrids=function(a){return a?(ah=a,Ce(),ah):ah},We.xgrids.add=function(a){return a?We.xgrids(ah.concat(a)):void 0},We.xgrids.remove=function(a){var b=Te(a);return We.xgrids(ah.filter(b))},We.ygrids=function(a){return a?(ch=a,Ce(),ch):ch},We.ygrids.add=function(a){return a?We.ygrids(ch.concat(a)):void 0},We.ygrids.remove=function(a){var b=Te(a);return We.ygrids(ch.filter(b))},We.regions=function(a){return c(a)?xh:(xh=a,Ce(),xh)},We.regions.add=function(a){return c(a)?xh:(xh=xh.concat(a),Ce(),xh)},We.regions.remove=function(a,c){var e=[].concat(a);return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;ki.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),xh=xh.filter(function(b){return b.classes.indexOf(a)<0})}),xh},We.data.get=function(a){var b=We.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},We.data.getAsTarget=function(a){var b=xc(function(b){return b.id===a});return b.length>0?b[0]:void 0},We.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Wf[b]=a[b]}),Qe(We.data.targets,{withTransition:!0}),Wf):Wf},We.x=function(a){return arguments.length&&(kc(We.data.targets,a),Ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),We.data.x},We.xs=function(a){return arguments.length&&(lc(We.data.targets,a),Ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),We.data.x},We.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},We.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Jg=+a.y),b(a.y2)&&(Sg=+a.y2)):Jg=Sg=+a,Ce())},We.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Kg=+a.y),b(a.y2)&&(Tg=+a.y2)):Kg=Tg=+a,Ce())},We.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&We.axis.max(a.max),"undefined"!=typeof a.min&&We.axis.min(a.min))},We.resize=function(a){Ze=a?a.width:null,$e=a?a.height:null,He({withLegend:!0,withTransition:!1})},We.destroy=function(){We.data.targets=void 0,We.data.x={},qi.html(""),a.onresize=null},"url"in e.data)Ve.csv(e.data.url,function(a,b){ve(b)});else if("rows"in e.data)ve(nc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");ve(oc(e.data.columns))}return We},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file diff --git a/package.json b/package.json index b679294..5d200cd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "c3", - "version": "0.1.27", + "version": "0.1.28", "description": "D3-based reusable chart library", "main": "c3.js", "scripts": { From ef71ad5fda2695d4b3ffe2c071cdc8b76914552b Mon Sep 17 00:00:00 2001 From: Josh Purvis Date: Sat, 5 Apr 2014 13:46:58 -0400 Subject: [PATCH 007/178] Changed var to be consistent with others --- c3.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c3.js b/c3.js index 7dcdea3..41349fe 100644 --- a/c3.js +++ b/c3.js @@ -1920,7 +1920,7 @@ var id = d.id || d; // if callback function is provided - if (_colors[id] instanceof Function) { return colors[id](d); } + if (colors[id] instanceof Function) { return colors[id](d); } // if specified, choose that color if (id in colors) { return colors[id]; } From 821f07361da02cfdea0aeac355cd54ee0c397703 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Sun, 6 Apr 2014 17:27:04 +0900 Subject: [PATCH 008/178] Update gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index ff6f150..501448a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ # npm modules node_modules bower_components +d3.js +d3.min.js \ No newline at end of file From 9bc8e18556079eb0a88e6da4b4a4be542efc6d82 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Sun, 6 Apr 2014 17:51:06 +0900 Subject: [PATCH 009/178] Add data.color option - #127 --- c3.js | 29 ++++++++++++++++------------- c3.min.js | 4 ++-- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/c3.js b/c3.js index 5917b51..1e6171f 100644 --- a/c3.js +++ b/c3.js @@ -129,6 +129,7 @@ __data_labels = getConfig(['data', 'labels'], {}), __data_order = getConfig(['data', 'order']), __data_regions = getConfig(['data', 'regions'], {}), + __data_color = getConfig(['data', 'color']), __data_colors = getConfig(['data', 'colors'], {}), __data_selection_enabled = getConfig(['data', 'selection', 'enabled'], false), __data_selection_grouped = getConfig(['data', 'selection', 'grouped'], false), @@ -273,7 +274,8 @@ var dragStart = null, dragging = false, cancelClick = false, mouseover = false; - var color = generateColor(__data_colors, __color_pattern); + var defaultColorPattern = ['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd', '#8c564b', '#e377c2', '#7f7f7f', '#bcbd22', '#17becf'], //same as d3.scale.category10() + color = generateColor(__data_colors, notEmpty(__color_pattern) ? __color_pattern : defaultColorPattern, __data_color); var defaultTimeFormat = (function () { var formats = [ @@ -1920,25 +1922,26 @@ //-- Color --// - function generateColor(_colors, _pattern) { - var ids = [], - colors = _colors, - pattern = notEmpty(_pattern) ? _pattern : ['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd', '#8c564b', '#e377c2', '#7f7f7f', '#bcbd22', '#17becf']; //same as d3.scale.category10() + function generateColor(colors, pattern, callback) { + var ids = []; return function (d) { - var id = d.id || d; + var id = d.id || d, color; // if callback function is provided - if (colors[id] instanceof Function) { return colors[id](d); } - + if (colors[id] instanceof Function) { + color = colors[id](d); + } // if specified, choose that color - if (id in colors) { return colors[id]; } - + else if (id in colors) { + color = colors[id]; + } // if not specified, choose from pattern - if (ids.indexOf(id) === -1) { - ids.push(id); + else { + if (ids.indexOf(id) < 0) { ids.push(id); } + color = pattern[ids.indexOf(id) % pattern.length]; } - return pattern[ids.indexOf(id) % pattern.length]; + return callback instanceof Function ? callback(color, d) : color; }; } diff --git a/c3.min.js b/c3.min.js index dbfe7fb..00ec425 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.28"},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;clf&&(lf=0),0>nf&&(nf=0),jf={top:vg?hf.top:qf-pg-($h?0:rf),right:0/0,bottom:20+($h?0:rf),left:vg?ci:hf.left},mf=vg?hf.left-ci-di:lf,of=vg?nf:qf-jf.top-jf.bottom,0>mf&&(mf=0),0>of&&(of=0),kf={top:$h?0:qf-rf,right:0/0,bottom:0,left:$h?pf-sf:0},p(),$h&&Kd(We.data.targets)&&(kf.left=lf/2+uf)}function o(){mi.select("line."+f.xgridFocus).attr("x1",vg?0:-10).attr("x2",vg?lf:-10).attr("y1",vg?-10:hf.top).attr("y2",vg?-10:nf)}function p(){uf=nf/2,tf=.95*uf,vf=Jd(We.data.targets)?.6*tf:0}function q(){var a=vg?f.axisX:f.axisY,b=Ve.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Ve.select(Ye).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Ze?Ze:x()}function s(){var a=$e?$e:y();return a>0?a:320}function t(){return Kd(We.data.targets)?0:_e?_e:vg||!Ig||Ng?1:v("y")}function u(){var a=1;return Kd(We.data.targets)?0:af?af:$h?sf+(Rg&&!vg?v("y2"):a):Rg?Wg||vg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||Ig?"y2"!==a||Rg?(gb(a).isInner?30:40)+("y2"===a?-10:0):ei:rg&&!$h?10:1}function x(){return+Ve.select(Ye).style("width").replace("px","")}function y(){return+Ve.select(Ye).style("height").replace("px","")}function z(a){return a?-5:-(hf.left-1)}function A(a){return a?-20:-1}function B(){return z(!vg)}function C(){return A(!vg)}function D(){return z(vg)}function E(){return A(vg)}function F(a){return a?lf+2+4:hf.left+20}function G(a){return a?80:nf+2}function H(){return F(!vg)}function I(){return G(!vg)}function J(){return F(vg)}function K(){return G(vg)}function L(){var a=vg?nf:lf,b=tc(),c=Vb()*(Gd(We.data.targets)?(b-(Mh?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){_h=a}function N(a){ai=a}function O(a){bi=a}function P(){return rg?$h?ai*(_h+1):pf:0}function Q(){return rg?$h?qf:bi*(_h+1):0}function R(){var a,b=!If;Af=vg?1:0,Bf=vg?nf:lf,Cf=vg?0:nf,Df=vg?lf:1,Ef=Af,Ff=Bf,Gf=vg?0:of,Hf=vg?mf:1,If=T(Af,Bf,b?void 0:If.domain(),function(){return Of.tickOffset()}),Jf=U(Cf,Df),Kf=U(Cf,Df),Lf=T(Af,Bf,ri,function(a){return a%1?0:Rf.tickOffset()}),Mf=U(Gf,Hf),Nf=U(Gf,Hf),a=$(),Of=X(If,Vh,a),Rf=X(Lf,Yh,a),Pf=Y(Jf,Wh,Og,Qg),Qf=Y(Kf,Xh,Xg,Zg),b||(fi.scale(Lf),bf&&ji.scale(If)),S()}function S(){wf=Db(),xf=Eb(),yf=Eb(.98)}function T(a,b,e,f){var g=(Lh?Ve.time.scale():Ve.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),Mh){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return Ve.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?Kf:Jf}function W(a){return"y2"===Z(a)?Nf:Mf}function X(a,b,c){var d=(Mh?Bb():Ve.svg.axis()).scale(a).orient(b);return d.tickFormat(c),Mh?d.tickCentered(yg):d.tickOffset=function(){var a=vg?nf:lf;return a*Vb()/tc()/2},Mh&&d.categories(xg),d}function Y(a,b,c,d){return Ve.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Yf?Yf[a]:"y"}function $(){var a=Lh?Th:Mh?Ic:function(a){return 0>a?a.toFixed(0):a};return zg&&("function"==typeof zg?a=zg:Lh&&(a=function(a){return Ve.time.format(zg)(a)})),a}function _(a){var b;return"y"===a?b=Mg:"y2"===a?b=Vg:"x"===a&&(b=Hg),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Mg=b:"y2"===a?Vg=b:"x"===a&&(Hg=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",vg?"inner-top":"inner-right")}function eb(){return cb("y",vg?"inner-right":"inner-top")}function fb(){return cb("y2",vg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?lf/2:lf:b.isBottom?-nf:b.isMiddle?-nf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!vg,db())}function ob(){return kb(vg,eb())}function pb(){return kb(vg,fb())}function qb(){return lb(!vg,db())}function rb(){return lb(vg,eb())}function sb(){return lb(vg,fb())}function tb(){var a=db();return vg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return vg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return vg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!vg,db())}function xb(){return mb(vg,eb())}function yb(){return mb(vg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return Ve.selectAll("."+c+" .tick text").each(function(){var a=this.getBBox();bb?20:b}function Ab(){mi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),mi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),mi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+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=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]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return Ve.min(Object.keys(i).map(function(a){return Ve.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=vc(a),i=Ec(a);if(Xf.length>0)for(g=Hc(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 Ve.max(Object.keys(i).map(function(a){return Ve.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Tg:Kg,n="y2"===c?Sg:Jg,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?Ug:Lg,r=bd()&&vg;return 0===l.length?"y2"===c?Kf.domain():Jf.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=cd(o,p),j=$b(Jf.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Pg&&(f=b(Pg.top)?Pg.top:e,g=b(Pg.bottom)?Pg.bottom:e),"y2"===c&&Yg&&(f=b(Yg.top)?Yg.top:e,g=b(Yg.bottom)?Yg.bottom:e),Gd(l)&&!Gc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(ri),c=$b(If.domain());return a||0===c?1:b/c}function Wb(a){return Fg?Fg:Ve.min(a,function(a){return Ve.min(a.values,function(a){return a.x})})}function Xb(a){return Eg?Eg:Ve.max(a,function(a){return Ve.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return Mh?d=0:Gd(a)?(c=tc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=Lh?new Date(c.getTime()-e):c-e,g=Lh?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return Sf&&a===Sf||$d(Tf)&&_d(Tf,a)}function fc(a){return!ec(a)}function gc(a){return Sf?Sf:$d(Tf)?Tf[a]:null}function hc(a,b){return a in We.data.x&&We.data.x[a]&&We.data.x[a][b]?We.data.x[a][b]:b}function ic(a){Object.keys(a).forEach(function(b){Tf[b]=a[b]})}function jc(a){var b;return a&&(b=Wf[a.id],a.name=b?b:a.id),a}function kc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=mc(b[d],a.id,d)}),We.data.x[a.id]=b})}function lc(a,b){a.forEach(function(a){b[a.id]&&kc([a],b[a.id])})}function mc(a,b,c){var d;return d=Lh?a?a instanceof Date?a:Wd(a):Wd(hc(b,c)):Nh&&!Mh?a?+a:hc(b,c):c}function nc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0&&(We.data.x[b]=a.map(function(a){return a[c]})):We.data.x[b]=a.map(function(a,b){return b})}),c.forEach(function(a){if(!We.data.x[a])throw new Error('x is not defined for id = "'+a+'".')}),b=c.map(function(b,c){var d=Vf(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=mc(g,b,e);return Nh&&Mh&&0===c&&g&&(0===e&&(xg=[]),xg.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++})}),Zf&&Ed(vc(b).filter(function(a){return!(a in $f)}),Zf),b.forEach(function(a){ac(a.id_org,a)}),b}function qc(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 rc(a){return a>0&&We.data.targets[0].values[a-1]?We.data.targets[0].values[a-1].x:void 0}function sc(a){return a1?We.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?We.data.targets[0]:null,a}function vc(a){return a=c(a)?We.data.targets:a,a.map(function(a){return a.id})}function wc(a){var b,c=vc();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(Lh?new Date(h):h);i.push(d)}return i}function Cc(a){Uh=Uh.concat(a)}function Dc(a){Uh=Uh.filter(function(b){return a.indexOf(b)<0})}function Ec(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Fc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Hc(a){return Fc(a,function(a){return a>0})}function Ic(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(kd(a,f))),a[g].x&&(e=e.concat(kd(a,g))),nd(e,b)):ld(a,b,f,g)}function md(a,b){var c;return c=a.map(function(a){return ld(a.values,b)}),nd(c,b)}function nd(a,b){var c,d;return a.forEach(function(a){var e=ae(a,b);(c>e||!c)&&(c=e,d=a)}),d}function od(a,b){return Ve.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function pd(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 qd(){return ag&&"desc"===ag.toLowerCase()}function rd(){return ag&&"asc"===ag.toLowerCase()}function sd(a){var b=rd(),c=qd();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 ag&&a.sort(ag),a}function td(a,c){var d,e,f,g,h,i,j,k=Kd(We.data.targets),l=k?ed:dd,m=a.filter(function(a){return a&&b(a.value)});yh&&0!==m.length&&(pi.html(Bh(a,$(),l,Sh)).style("display","block"),d=pi.property("offsetWidth"),e=pi.property("offsetHeight"),k?(g=lf/2+c[0],i=nf/2+c[1]+20):(vg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=If(m[0].x)+20):(f=q(),g=f+t()+If(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),pi.style("top",i+"px").style("left",g+"px"))}function ud(){pi.style("display","none")}function vd(a){var c=a.filter(function(a){return a&&b(a.value)});yh&&(Hd(We.data.targets)||Kd(We.data.targets)||mi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(vg?"y1":"x1",gd).attr(vg?"y2":"x2",gd))}function wd(){mi.select("line."+f.xgridFocus).style("visibility","hidden")}function xd(a){return a.x||0===a.x?If(a.x):null}function yd(a){return V(a.id)(a.value)}function zd(){var a,b,d={},e=0;return zc(xc(Nd)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Dd(a,b){return kh?kh:b?2*a.tickOffset()*lh/b:0}function Ed(a,b){var c,d=a?"string"==typeof a?[a]:a:vc();for(c=0;c0}function _d(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ae(a,b){var c="y"===Z(a.id)?Jf:Kf;return Math.pow(If(a.x)-b[0],2)+Math.pow(c(a.value)-b[1],2)}function be(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function ce(a,b,c){kg(b,a.node()),mi.select("."+f.selectedCircles+Xc(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Jc(f.selectedCircle,c)}).attr("cx",vg?yd:xd).attr("cy",vg?xd:yd).attr("stroke",function(){return Sh(b.id)}).attr("r",1.4*jh).transition().duration(100).attr("r",jh)}function de(a,b,c){lg(b,a.node()),mi.select("."+f.selectedCircles+Xc(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ee(a,b,c,d){a?ce(b,c,d):de(b,c,d)}function fe(a,b){kg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ve.rgb(Sh(b.id)).darker(1)})}function ge(a,b){lg(b,a.node()),a.transition().duration(100).style("fill",function(){return Sh(b.id)})}function he(a,b,c,d){a?fe(b,c,d):ge(b,c,d)}function ie(a){return a.filter(function(a){return b(a.value)})}function je(a,c){return(c?mi.selectAll("."+f.circles+Xc(c)):mi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ke(a,b){je(a,b).classed(f.EXPANDED,!0).attr("r",ih)}function le(a){je(a).filter(function(){return Ve.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",fh)}function me(a){return mi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function ne(a){me(a).classed(f.EXPANDED,!0)}function oe(a){me(a).classed(f.EXPANDED,!1)}function pe(a,b){var c=te(a,b);return function(a,b){var d=c(a,b),e=vg?1:0,f=vg?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 qe(a,b){var c=te(a,!1),d=b?re:se;return function(a,b){return d(c(a,b),a,this)}}function re(a,b){var c;return vg?(c=Nd(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function se(a,b,c){var d=c.getBBox();return vg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:Nd(b)?-3:-6)}function te(a,b){var c=a.__max__+1,d=Dd(Of,c),e=Ad(d,c,a,!!b),f=Bd(!!b),g=Cd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return vg&&(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 ue(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 ve(b){var c,d,e;if(qi=Ve.select(Ye),qi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(qi.html(""),qi.classed("c3",!0),We.data.x={},We.data.targets=pc(b),n(),R(),If.domain(Ve.extent(Zb(We.data.targets))),Jf.domain(Ub(We.data.targets,"y")),Kf.domain(Ub(We.data.targets,"y2")),Lf.domain(If.domain()),Mf.domain(Jf.domain()),Nf.domain(Kf.domain()),ri=If.domain(),fi.scale(Lf),bf&&ji.scale(If),ki=qi.append("svg").attr("width",lf+hf.left+hf.right).attr("height",nf+hf.top+hf.bottom).on("mouseenter",ef).on("mouseleave",ff),li=ki.append("defs"),li.append("clipPath").attr("id",Fh).append("rect").attr("width",lf).attr("height",nf),li.append("clipPath").attr("id",Gh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),li.append("clipPath").attr("id",Hh).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),mi=ki.append("g").attr("transform",Zh.main),ni=og?ki.append("g").attr("transform",Zh.context):null,oi=rg?ki.append("g").attr("transform",Zh.legend):null,pi=Ve.select(Ye).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),mi.append("g").attr("class",f.axisX).attr("clip-path",vg?"":Jh).attr("transform",Zh.x).append("text").attr("class",f.axisXLabel).attr("transform",vg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),Ig&&mi.append("g").attr("class",f.axisY).attr("clip-path",vg?Kh:"").append("text").attr("class",f.axisYLabel).attr("transform",vg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),Rg&&mi.append("g").attr("class",f.axisY2).attr("transform",Zh.y2).append("text").attr("class",f.axisY2Label).attr("transform",vg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=mi.append("g").attr("clip-path",Ih).attr("class",f.grid),$g&&d.append("g").attr("class",f.xgrids),$d(ah)&&d.append("g").attr("class",f.xgridLines),gh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),bh&&d.append("g").attr("class",f.ygrids),$d(ch)&&d.append("g").attr("class",f.ygridLines),mi.append("g").attr("clip-path",Ih).attr("class",f.regions),mi.append("g").attr("clip-path",Ih).attr("class",f.chart),c=mi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",bf?vg?"ns-resize":"ew-resize":null),mi.select("."+f.chart).append("g").attr("class",f.chartBars),mi.select("."+f.chart).append("g").attr("class",f.chartLines),mi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Zh.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),mi.select("."+f.chart).append("g").attr("class",f.chartTexts),bf&&mi.insert("rect",df?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",lf).attr("height",nf).style("opacity",0).style("cursor",vg?"ns-resize":"ew-resize").call(ji).on("dblclick.zoom",null),Gg&&fi.extent("function"!=typeof Gg?Gg:Gg(Zb())),og&&(ni.append("g").attr("clip-path",Ih).attr("class",f.chart),ni.select("."+f.chart).append("g").attr("class",f.chartBars),ni.select("."+f.chart).append("g").attr("class",f.chartLines),ni.append("g").attr("clip-path",Ih).attr("class",f.brush).call(fi).selectAll("rect").attr(vg?"width":"height",vg?mf:of),ni.append("g").attr("class",f.axisX).attr("transform",Zh.subx).attr("clip-path",vg?"":Jh)),Ie(We.data.targets),vg?mi.select("."+f.axisX).style("opacity",0).call(Of):(mi.select("."+f.axisY).style("opacity",0).call(Pf),mi.select("."+f.axisY2).style("opacity",0).call(Qf)),He({withTransform:!0,withLegend:!0,withTransitionForAxis:!1}),Ch){if(Lh&&"string"==typeof Dh){for(Dh=Wd(Dh),e=0;e0){d=[];for(var g in Wf)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=pd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=he,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 Ae(a){Kd(We.data.targets)||dg&&(Oh=a,mi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ph=!0,mg())}function Be(){Kd(We.data.targets)||dg&&(mi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),mi.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ph=!1,ng())}function Ce(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P=zd(),Q=Kd(We.data.targets),R=zc(We.data.targets);if(0!==R.length){if(a=d(a)?a:{},v=d(a.withY)?a.withY:!0,w=d(a.withSubchart)?a.withSubchart:!0,x=d(a.withTransition)?a.withTransition:!0,A=d(a.withTransform)?a.withTransform:!1,B=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,C=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,D=d(a.withLegend)?a.withLegend:!1,y=d(a.withTransitionForExit)?a.withTransitionForExit:x,z=d(a.withTransitionForAxis)?a.withTransitionForAxis:x,I=x?gf:0,J=y?I:0,K=z?I:0,D&&rg&&Qe(We.data.targets,a),C&&(If.domain(Ve.extent(Zb(R))),ri=If.domain(),bf&&ji.scale(If).updateScaleExtent(),Lf.domain(If.domain()),fi.scale(Lf)),B&&(If.domain(fi.empty()?ri:fi.extent()),bf&&ji.scale(If).updateScaleExtent(),Hd(R)||(M=Bc(Ac(R)),Of.tickValues(M),Rf.tickValues(M))),Jf.domain(Ub(R,"y")),Kf.domain(Ub(R,"y2")),mi.select("."+f.axisX).style("opacity",Q?0:1).transition().duration(K).call(Of),mi.select("."+f.axisY).style("opacity",Q?0:1).transition().duration(K).call(Pf),mi.select("."+f.axisY2).style("opacity",Q?0:1).transition().duration(K).call(Qf),B&&Ag&&M){for(N=1;N=V;V++)e.push(new Date(V+"-01-01 00:00:00"))}else e=If.ticks(10);c=mi.select("."+f.xgrids).selectAll("."+f.xgrid).data(e),c.enter().append("line").attr("class",f.xgrid),c.attr("x1",vg?0:function(a){return If(a)-Of.tickOffset()}).attr("x2",vg?lf:function(a){return If(a)-Of.tickOffset()}).attr("y1",vg?function(a){return If(a)-Of.tickOffset()}:hf.top).attr("y2",vg?function(a){return If(a)-Of.tickOffset()}:nf).style("opacity",function(){return+Ve.select(this).attr(vg?"y1":"x1")===(vg?nf:0)?0:1}),c.exit().remove()}$d(ah)&&(g=mi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(ah),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",vg?"":"rotate(-90)").attr("dx",vg?0:-hf.top).attr("dy",-5).style("opacity",0),g.select("line").transition().duration(I).attr("x1",vg?0:hd).attr("x2",vg?lf:hd).attr("y1",vg?hd:hf.top).attr("y2",vg?hd:nf).style("opacity",1),g.select("text").transition().duration(I).attr("x",vg?lf:0).attr("y",hd).text(function(a){return a.text}).style("opacity",1),g.exit().transition().duration(I).style("opacity",0).remove()),v&&bh&&(i=mi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Jf.ticks(dh)),i.enter().append("line").attr("class",f.ygrid),i.attr("x1",vg?Jf:0).attr("x2",vg?Jf:lf).attr("y1",vg?0:Jf).attr("y2",vg?nf:Jf),i.exit().remove()),v&&$d(ch)&&(j=mi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(ch),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",vg?"rotate(-90)":"").attr("dx",vg?0:-hf.top).attr("dy",-5).style("opacity",0),j.select("line").transition().duration(I).attr("x1",vg?id:0).attr("x2",vg?id:lf).attr("y1",vg?0:id).attr("y2",vg?nf:id).style("opacity",1),j.select("text").transition().duration(I).attr("x",vg?0:lf).attr("y",id).text(function(a){return a.text}).style("opacity",1),j.exit().transition().duration(I).style("opacity",0).remove()),m=mi.selectAll("."+f.bars).selectAll("."+f.bar).data(Sd),m.enter().append("path").attr("d",E).style("stroke","none").style("opacity",0).style("fill",function(a){return Sh(a.id)}).attr("class",Rc),m.style("opacity",Zc).transition().duration(I).attr("d",E).style("opacity",1),m.exit().transition().duration(J).style("opacity",0).remove(),p=mi.selectAll("."+f.texts).selectAll("."+f.text).data(Ud),p.enter().append("text").attr("class",Kc).attr("text-anchor",function(a){return vg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),p.text(function(a){return fd(a.id)(a.value)}).style("fill-opacity",$c).transition().duration(I).attr("x",G).attr("y",H).style("fill-opacity",ad),p.exit().transition().duration(J).style("fill-opacity",0).remove(),mi.selectAll("."+f.line).style("opacity",Zc).transition().duration(I).attr("d",gi).style("opacity",1),mi.selectAll("."+f.area).style("opacity",0).transition().duration(I).attr("d",hi).style("opacity",si),l=mi.selectAll("."+f.circles).selectAll("."+f.circle).data(Td),l.enter().append("circle").attr("class",Pc).style("opacity",0).attr("r",fh),l.style("opacity",Zc).transition().duration(I).style("opacity",_c).attr("cx",vg?yd:xd).attr("cy",vg?xd:yd),l.exit().remove(),mi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",A?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(I).attrTween("d",function(a){var b,c=Cb(a);return c?(b=Ve.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",A?"scale(1)":"").style("opacity",1),mi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(I).text(Jb).style("opacity",function(a){return yc(a.data.id)&&Rd(a.data)?1:0}),mi.select("."+f.chartArcsTitle).style("opacity",Jd(We.data.targets)?1:0),og&&(null!==Ve.event&&"zoom"===Ve.event.type&&fi.extent(If.orgDomain()).update(),w&&(ni.select("."+f.axisX).style("opacity",Q?0:1).transition().duration(I).call(Rf),fi.empty()||fi.extent(If.orgDomain()).update(),F=pe(P,!0),q=ni.selectAll("."+f.bars).selectAll("."+f.bar).data(Sd),q.enter().append("path").attr("d",F).style("stroke","none").style("fill",function(a){return Sh(a.id)}).attr("class",Rc),q.style("opacity",Zc).transition().duration(I).attr("d",F).style("opacity",1),q.exit().transition().duration(I).style("opacity",0).remove(),ni.selectAll("."+f.line).style("opacity",Zc).transition().duration(I).attr("d",ii).style("opacity",1))),mi.selectAll("."+f.selectedCircles).filter(function(a){return Nd(a)}).selectAll("circle").remove(),mi.selectAll("."+f.selectedCircle).transition().duration(I).attr("cx",vg?yd:xd).attr("cy",vg?xd:yd),$d(Tf)?(r=mi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),xe(r.enter()),r.attr("x",0).attr("y",0).attr("width",lf).attr("height",nf)):(Nh&&!Mh?(u=function(a,b){var c=rc(b),d=sc(b),e=We.data.x[a.id][b];return(If(d?d:e+50)-If(c?c:e-50))/2},t=function(a,b){var c=rc(b),d=We.data.x[a.id][b];return(If(d)+If(c?c:d-50))/2}):(u=L(),t=function(a){return If(a.x)-u/2}),s=uc(),mi.select("."+f.eventRects).datum(s?s.values:[]),r=mi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),we(r.enter()),r.attr("class",Wc).attr("x",vg?0:t).attr("y",vg?t:0).attr("width",vg?lf:u).attr("height",vg?u:nf),r.exit().remove()),n=mi.select("."+f.regions).selectAll("rect."+f.region).data(xh),n.enter().append("rect").style("fill-opacity",0),n.attr("class",Vc).attr("x",vg?0:cc).attr("y",vg?cc:hf.top).attr("width",vg?lf:dc).attr("height",vg?dc:nf).transition().duration(I).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),n.exit().transition().duration(I).style("fill-opacity",0).remove(),vc().forEach(function(a){ti[a]=!0})}}function De(){Ce({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ee(){return"mousemove"===Ve.event.sourceEvent.type&&ji.altDomain?(If.domain(ji.altDomain),void ji.scale(If).updateScaleExtent()):(Mh&&If.orgDomain()[0]===ri[0]&&If.domain([ri[0]-1e-10,If.orgDomain()[1]]),Ce({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Ve.event.sourceEvent.type&&(Qh=!0)))}function Fe(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ge(){ki.attr("width",pf).attr("height",qf),ki.select("#"+Fh).select("rect").attr("width",lf).attr("height",nf),ki.select("#"+Gh).select("rect").attr("width",H),ki.select("#"+Hh).select("rect").attr("width",J),ki.select("."+f.zoomRect).attr("width",lf).attr("height",nf)}function He(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(),R(),Ge(),m(a.withTransition),Ce(a)}function Ie(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=mi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a),j=i.enter().append("g").attr("class",function(a){return f.chartText+Jc(f.target,a.id)}).style("pointer-events","none"),j.append("g").attr("class",Lc).style("fill",function(a){return Sh(a.id)}),e=mi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),d=e.enter().append("g").attr("class",function(a){return f.chartBar+Jc(f.target,a.id)}).style("pointer-events","none"),d.append("g").attr("class",Sc).style("fill",function(a){return Sh(a.id)}).style("stroke","none").style("cursor",function(a){return fg(a)?"pointer":null}),c=mi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),b=c.enter().append("g").attr("class",function(a){return f.chartLine+Jc(f.target,a.id)}).style("pointer-events","none"),b.append("path").attr("class",Oc).style("opacity",0).style("stroke",function(a){return Sh(a.id)}),b.append("path").attr("class",Uc).style("opacity",function(){return si=+Ve.select(this).style("opacity"),0}).style("fill",function(a){return Sh(a.id)}),b.append("g").attr("class",function(a){return Jc(f.selectedCircles,a.id)}),b.append("g").attr("class",Qc).style("fill",function(a){return Sh(a.id)}).style("cursor",function(a){return fg(a)?"pointer":null}),a.forEach(function(a){mi.selectAll("."+f.selectedCircles+Xc(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=mi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(zf(a)),g=h.enter().append("g").attr("class",function(a){return f.chartArc+Jc(f.target,a.data.id)}),g.append("path").attr("class",Tc).style("opacity",0).style("fill",function(a){return Sh(a.data.id)}).style("cursor",function(a){return fg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),Ne(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];td(c,Ve.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),Pe(),ud(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),og&&(n=ni.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),m=n.enter().append("g").attr("class",function(a){return f.chartBar+Jc(f.target,a.id)}),m.append("g").attr("class",Sc).style("fill",function(a){return Sh(a.id)}),l=ni.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),k=l.enter().append("g").attr("class",function(a){return f.chartLine+Jc(f.target,a.id)}),k.append("path").attr("class",Oc).style("opacity",0).style("stroke",function(a){return Sh(a.id)})),ki.selectAll("."+f.target).filter(function(a){return yc(a.id)}).transition().style("opacity",1)}function Je(a,b){We.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=$h?i:h,k=$h?rf:sf;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=$h?u:t,ug?(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=vc(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,$h?(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=oi.selectAll("."+f.legendItem).data(q).enter().append("g").attr("class",function(a){return Jc(f.legendItem,a)}).style("cursor","pointer").on("click",function(a){"function"==typeof tg?tg(a):We.toggle(a)}).on("mouseover",function(a){We.focus(a)}).on("mouseout",function(){We.revert()}),g.append("text").text(function(a){return d(Wf[a])?Wf[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",$h?i:-200).attr("y",$h?-200:l),g.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",$h?j:-200).attr("y",$h?-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 Sh(a)}).attr("x",$h?i:-200).attr("y",$h?-200:k).attr("width",10).attr("height",10),oi.selectAll("text").data(q).text(function(a){return d(Wf[a])?Wf[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",i).attr("y",l),oi.selectAll("rect."+f.legendItemEvent).data(q).transition().duration(p?250:0).attr("x",j).attr("y",o),oi.selectAll("rect."+f.legendItemTile).data(q).transition().duration(p?250:0).attr("x",h).attr("y",k),N(t),O(u),M(C),n(),R(),Ge(),m(!1)}function Re(a){return wc(a.id)}function Se(a){return"data"in a&&wc(a.data.id)}function Te(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 Ue(a,b,c){var d=!Kd(We.data.targets);Ed(a,b),He(c?c:{withTransitionForAxis:d})}var Ve=a.d3?a.d3:a.require?a.require("d3"):void 0,We={data:{},axis:{}},Xe={},Ye=h(["bindto"],"#chart"),Ze=h(["size","width"]),$e=h(["size","height"]),_e=h(["padding","left"]),af=h(["padding","right"]),bf=h(["zoom","enabled"],!1),cf=h(["zoom","extent"]),df=h(["zoom","privileged"],!1),ef=h(["onenter"],function(){}),ff=h(["onleave"],function(){}),gf=h(["transition","duration"],350);g("data","data is required in config");var 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,Rf,Sf=h(["data","x"]),Tf=h(["data","xs"],{}),Uf=h(["data","x_format"]),Vf=h(["data","id_converter"],function(a){return a}),Wf=h(["data","names"],{}),Xf=h(["data","groups"],[]),Yf=h(["data","axes"],{}),Zf=h(["data","type"]),$f=h(["data","types"],{}),_f=h(["data","labels"],{}),ag=h(["data","order"]),bg=h(["data","regions"],{}),cg=h(["data","colors"],{}),dg=h(["data","selection","enabled"],!1),eg=h(["data","selection","grouped"],!1),fg=h(["data","selection","isselectable"],function(){return!0}),gg=h(["data","selection","multiple"],!0),hg=h(["data","onclick"],function(){}),ig=h(["data","onenter"],function(){}),jg=h(["data","onleave"],function(){}),kg=h(["data","onselected"],function(){}),lg=h(["data","onunselected"],function(){}),mg=h(["data","ondragstart"],function(){}),ng=h(["data","ondragend"],function(){}),og=h(["subchart","show"],!1),pg=og?h(["subchart","size","height"],60):0,qg=h(["color","pattern"],[]),rg=h(["legend","show"],!0),sg=h(["legend","position"],"bottom"),tg=h(["legend","item","onclick"]),ug=h(["legend","equally"],!1),vg=h(["axis","rotated"],!1),wg=h(["axis","x","type"],"indexed"),xg=h(["axis","x","categories"],[]),yg=h(["axis","x","tick","centered"],!1),zg=h(["axis","x","tick","format"]),Ag=h(["axis","x","tick","culling"],{}),Bg=h(["axis","x","tick","culling","max"],"categorized"===wg?1/0:10),Cg=h(["axis","x","tick","count"]),Dg=h(["axis","x","tick","fit"],!1),Eg=h(["axis","x","max"]),Fg=h(["axis","x","min"]),Gg=h(["axis","x","default"]),Hg=h(["axis","x","label"],{}),Ig=h(["axis","y","show"],!0),Jg=h(["axis","y","max"]),Kg=h(["axis","y","min"]),Lg=h(["axis","y","center"]),Mg=h(["axis","y","label"],{}),Ng=h(["axis","y","inner"],!1),Og=h(["axis","y","tick","format"]),Pg=h(["axis","y","padding"],{}),Qg=h(["axis","y","ticks"],10),Rg=h(["axis","y2","show"],!1),Sg=h(["axis","y2","max"]),Tg=h(["axis","y2","min"]),Ug=h(["axis","y2","center"]),Vg=h(["axis","y2","label"],{}),Wg=h(["axis","y2","inner"],!1),Xg=h(["axis","y2","tick","format"]),Yg=h(["axis","y2","padding"],{}),Zg=h(["axis","y2","ticks"],10),$g=h(["grid","x","show"],!1),_g=h(["grid","x","type"],"tick"),ah=h(["grid","x","lines"],[]),bh=h(["grid","y","show"],!1),ch=h(["grid","y","lines"],[]),dh=h(["grid","y","ticks"],10),eh=h(["point","show"],!0),fh=eh?h(["point","r"],2.5):0,gh=h(["point","focus","line","enabled"],!0),hh=h(["point","focus","expand","enabled"],!0),ih=h(["point","focus","expand","r"],hh?4:fh),jh=h(["point","focus","select","r"],8),kh=h(["bar","width"]),lh=h(["bar","width","ratio"],.6),mh=h(["pie","label","show"],!0),nh=h(["pie","label","format"]),oh=h(["pie","onclick"],function(){}),ph=h(["pie","onmouseover"],function(){}),qh=h(["pie","onmouseout"],function(){}),rh=h(["donut","label","show"],!0),sh=h(["donut","label","format"]),th=h(["donut","title"],""),uh=h(["donut","onclick"],function(){}),vh=h(["donut","onmouseover"],function(){}),wh=h(["donut","onmouseout"],function(){}),xh=h(["regions"],[]),yh=h(["tooltip","show"],!0),zh=h(["tooltip","format","title"]),Ah=h(["tooltip","format","value"]),Bh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=zh?zh:b,l=Ah?Ah: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+""}),Ch=h(["tooltip","init","show"],!1),Dh=h(["tooltip","init","x"],0),Eh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Fh=("string"==typeof Ye?Ye.replace("#",""):Ye.id)+"-clip",Gh=Fh+"-xaxis",Hh=Fh+"-yaxis",Ih=i(Fh),Jh=i(Jh),Kh=i(Kh),Lh="timeseries"===wg,Mh="categorized"===wg,Nh=!Lh&&(Sf||$d(Tf)),Oh=null,Ph=!1,Qh=!1,Rh=!1,Sh=Vd(cg,qg),Th=function(){var a=[[Ve.time.format("%Y/%-m/%-d"),function(){return!0}],[Ve.time.format("%-m/%-d"),function(a){return a.getMonth()}],[Ve.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ve.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ve.time.format("%I %p"),function(a){return a.getHours()}],[Ve.time.format("%I:%M"),function(a){return a.getMinutes()}],[Ve.time.format(":%S"),function(a){return a.getSeconds()}],[Ve.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)}}(),Uh=[],Vh=vg?"left":"bottom",Wh=vg?Ng?"top":"bottom":Ng?"right":"left",Xh=vg?Wg?"bottom":"top":Wg?"left":"right",Yh=vg?"left":"bottom",Zh={main:function(){return"translate("+hf.left+","+hf.top+")"},context:function(){return"translate("+jf.left+","+jf.top+")"},legend:function(){return"translate("+kf.left+","+kf.top+")"},x:function(){return"translate(0,"+(vg?0:nf)+")"},y:function(){return"translate(0,"+(vg?nf:0)+")"},y2:function(){return"translate("+(vg?0:lf)+","+(vg?1:0)+")"},subx:function(){return"translate(0,"+(vg?0:of)+")"},arc:function(){return"translate("+lf/2+","+nf/2+")"}},$h="right"===sg,_h=0,ai=0,bi=0,ci=30,di=30,ei=5;zf=Ve.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var fi,gi=function(){var a=Ve.svg.line().x(vg?function(a){return V(a.id)(a.value)}:gd).y(vg?gd:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=ie(b.values);return Ld(b)?(a.interpolate(Md(b)?"cardinal":"linear"),bg[b.id]?ue(e,If,V(b.id),bg[b.id]):a(e)):(c=If(e[0].x),d=V(b.id)(e[0].value),vg?"M "+d+" "+c:"M "+c+" "+d)}}(),hi=function(){var a;return a=vg?Ve.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(gd):Ve.svg.area().x(gd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=ie(b.values);return Fd([b],"area")||Fd([b],"area-spline")?(a.interpolate(Md(b)?"cardinal":"linear"),a(e)):(c=If(e[0].x),d=V(b.id)(e[0].value),vg?"M "+d+" "+c:"M "+c+" "+d)}}(),ii=function(){var a=Ve.svg.line().x(vg?function(a){return W(a.id)(a.value)}:jd).y(vg?jd:function(a){return W(a.id)(a.value)});return function(b){var c=ie(b.values);return Ld(b)?a(c):"M "+Lf(c[0].x)+" "+W(b.id)(c[0].value)}}(),ji=function(){};fi=Ve.svg.brush().on("brush",De),fi.update=function(){return ni&&ni.select("."+f.brush).call(this),this},fi.scale=function(a){return vg?this.y(a):this.x(a)},bf&&(ji=Ve.behavior.zoom().on("zoomstart",function(){ji.altDomain=Ve.event.sourceEvent.altKey?If.orgDomain():null}).on("zoom",bf?Ee:null),ji.scale=function(a){return vg?this.y(a):this.x(a)},ji.orgScaleExtent=function(){var a=cf?cf:[1,10];return[a[0],Math.max(tc()/a[1],a[1])]},ji.updateScaleExtent=function(){var a=$b(If.orgDomain())/$b(ri),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var ki,li,mi,ni,oi,pi,qi,ri,si,ti={};if(We.focus=function(a){function b(a){zc(a).transition().duration(100).style("opacity",1)}var c=ki.selectAll(Yc(a)),d=c.filter(Re),e=c.filter(Se);We.revert(),We.defocus(),b(d.classed(f.focused,!0)),b(e),Kd(We.data.targets)&&Kb(a,!0),Ne(a)},We.defocus=function(a){function b(a){zc(a).transition().duration(100).style("opacity",.3)}var c=ki.selectAll(Yc(a)),d=c.filter(Re),e=c.filter(Se);We.revert(),b(d.classed(f.focused,!1)),b(e),Kd(We.data.targets)&&Lb(a),Oe(a)},We.revert=function(a){function b(a){zc(a).transition().duration(100).style("opacity",1)}var c=ki.selectAll(Yc(a)),d=c.filter(Re),e=c.filter(Se);b(d.classed(f.focused,!1)),b(e),Kd(We.data.targets)&&Lb(a),Pe()},We.show=function(a){Dc(a),ki.selectAll(Yc(a)).transition().style("opacity",1),Ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!1})},We.hide=function(a){Cc(a),ki.selectAll(Yc(a)).transition().style("opacity",0),Ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!1})},We.toggle=function(a){yc(a)?We.hide(a):We.show(a)},We.unzoom=function(){fi.clear().update(),Ce({withUpdateXDomain:!0})},We.load=function(a){return a.xs&&ic(a.xs),"categories"in a&&Mh&&(xg=a.categories,Of.categories(xg)),"cacheIds"in a&&_b(a.cacheIds)?void Je(bc(a.cacheIds),a.done):void("unload"in a?Le("string"==typeof a.unload?[a.unload]:"boolean"==typeof a.unload&&a.unload?vc():a.unload,function(){Ke(a)}):Ke(a))},We.unload=function(a){Le(a?"string"==typeof a?[a]:a:vc(),function(){Ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},We.selected=function(a){return Ve.merge(mi.selectAll("."+f.shapes+Xc(a)).selectAll("."+f.shape).filter(function(){return Ve.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},We.select=function(a,b,c){dg&&mi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=Ve.select(this),i="circle"===this.nodeName?ce:fe,j="circle"===this.nodeName?de:ge,k=eg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?fg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},We.unselect=function(a,b){dg&&mi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=Ve.select(this),g="circle"===this.nodeName?de:ge,h=eg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&fg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},We.toLine=function(a){Ue(a,"line")},We.toSpline=function(a){Ue(a,"spline")},We.toBar=function(a){Ue(a,"bar")},We.toScatter=function(a){Ue(a,"scatter")},We.toArea=function(a){Ue(a,"area")},We.toAreaSpline=function(a){Ue(a,"area-spline")},We.toPie=function(a){Ue(a,"pie",{withTransform:!0})},We.toDonut=function(a){Ue(a,"donut",{withTransform:!0})},We.groups=function(a){return c(a)?Xf:(Xf=a,Ce(),Xf)},We.xgrids=function(a){return a?(ah=a,Ce(),ah):ah},We.xgrids.add=function(a){return a?We.xgrids(ah.concat(a)):void 0},We.xgrids.remove=function(a){var b=Te(a);return We.xgrids(ah.filter(b))},We.ygrids=function(a){return a?(ch=a,Ce(),ch):ch},We.ygrids.add=function(a){return a?We.ygrids(ch.concat(a)):void 0},We.ygrids.remove=function(a){var b=Te(a);return We.ygrids(ch.filter(b))},We.regions=function(a){return c(a)?xh:(xh=a,Ce(),xh)},We.regions.add=function(a){return c(a)?xh:(xh=xh.concat(a),Ce(),xh)},We.regions.remove=function(a,c){var e=[].concat(a);return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;ki.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),xh=xh.filter(function(b){return b.classes.indexOf(a)<0})}),xh},We.data.get=function(a){var b=We.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},We.data.getAsTarget=function(a){var b=xc(function(b){return b.id===a});return b.length>0?b[0]:void 0},We.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Wf[b]=a[b]}),Qe(We.data.targets,{withTransition:!0}),Wf):Wf},We.x=function(a){return arguments.length&&(kc(We.data.targets,a),Ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),We.data.x},We.xs=function(a){return arguments.length&&(lc(We.data.targets,a),Ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),We.data.x},We.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},We.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Jg=+a.y),b(a.y2)&&(Sg=+a.y2)):Jg=Sg=+a,Ce())},We.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Kg=+a.y),b(a.y2)&&(Tg=+a.y2)):Kg=Tg=+a,Ce())},We.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&We.axis.max(a.max),"undefined"!=typeof a.min&&We.axis.min(a.min))},We.resize=function(a){Ze=a?a.width:null,$e=a?a.height:null,He({withLegend:!0,withTransition:!1})},We.destroy=function(){We.data.targets=void 0,We.data.x={},qi.html(""),a.onresize=null},"url"in e.data)Ve.csv(e.data.url,function(a,b){ve(b)});else if("rows"in e.data)ve(nc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");ve(oc(e.data.columns))}return We},"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.28"},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;clf&&(lf=0),0>nf&&(nf=0),jf={top:wg?hf.top:qf-qg-(ai?0:rf),right:0/0,bottom:20+(ai?0:rf),left:wg?ei:hf.left},mf=wg?hf.left-ei-fi:lf,of=wg?nf:qf-jf.top-jf.bottom,0>mf&&(mf=0),0>of&&(of=0),kf={top:ai?0:qf-rf,right:0/0,bottom:0,left:ai?pf-sf:0},p(),ai&&Kd(We.data.targets)&&(kf.left=lf/2+uf)}function o(){oi.select("line."+f.xgridFocus).attr("x1",wg?0:-10).attr("x2",wg?lf:-10).attr("y1",wg?-10:hf.top).attr("y2",wg?-10:nf)}function p(){uf=nf/2,tf=.95*uf,vf=Jd(We.data.targets)?.6*tf:0}function q(){var a=wg?f.axisX:f.axisY,b=Ve.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Ve.select(Ye).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Ze?Ze:x()}function s(){var a=$e?$e:y();return a>0?a:320}function t(){return Kd(We.data.targets)?0:_e?_e:wg||!Jg||Og?1:v("y")}function u(){var a=1;return Kd(We.data.targets)?0:af?af:ai?sf+(Sg&&!wg?v("y2"):a):Sg?Xg||wg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||Jg?"y2"!==a||Sg?(gb(a).isInner?30:40)+("y2"===a?-10:0):gi:sg&&!ai?10:1}function x(){return+Ve.select(Ye).style("width").replace("px","")}function y(){return+Ve.select(Ye).style("height").replace("px","")}function z(a){return a?-5:-(hf.left-1)}function A(a){return a?-20:-1}function B(){return z(!wg)}function C(){return A(!wg)}function D(){return z(wg)}function E(){return A(wg)}function F(a){return a?lf+2+4:hf.left+20}function G(a){return a?80:nf+2}function H(){return F(!wg)}function I(){return G(!wg)}function J(){return F(wg)}function K(){return G(wg)}function L(){var a=wg?nf:lf,b=tc(),c=Vb()*(Gd(We.data.targets)?(b-(Nh?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){bi=a}function N(a){ci=a}function O(a){di=a}function P(){return sg?ai?ci*(bi+1):pf:0}function Q(){return sg?ai?qf:di*(bi+1):0}function R(){var a,b=!If;Af=wg?1:0,Bf=wg?nf:lf,Cf=wg?0:nf,Df=wg?lf:1,Ef=Af,Ff=Bf,Gf=wg?0:of,Hf=wg?mf:1,If=T(Af,Bf,b?void 0:If.domain(),function(){return Of.tickOffset()}),Jf=U(Cf,Df),Kf=U(Cf,Df),Lf=T(Af,Bf,ti,function(a){return a%1?0:Rf.tickOffset()}),Mf=U(Gf,Hf),Nf=U(Gf,Hf),a=$(),Of=X(If,Xh,a),Rf=X(Lf,$h,a),Pf=Y(Jf,Yh,Pg,Rg),Qf=Y(Kf,Zh,Yg,$g),b||(hi.scale(Lf),bf&&li.scale(If)),S()}function S(){wf=Db(),xf=Eb(),yf=Eb(.98)}function T(a,b,e,f){var g=(Mh?Ve.time.scale():Ve.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),Nh){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return Ve.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?Kf:Jf}function W(a){return"y2"===Z(a)?Nf:Mf}function X(a,b,c){var d=(Nh?Bb():Ve.svg.axis()).scale(a).orient(b);return d.tickFormat(c),Nh?d.tickCentered(zg):d.tickOffset=function(){var a=wg?nf:lf;return a*Vb()/tc()/2},Nh&&d.categories(yg),d}function Y(a,b,c,d){return Ve.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Yf?Yf[a]:"y"}function $(){var a=Mh?Vh:Nh?Ic:function(a){return 0>a?a.toFixed(0):a};return Ag&&("function"==typeof Ag?a=Ag:Mh&&(a=function(a){return Ve.time.format(Ag)(a)})),a}function _(a){var b;return"y"===a?b=Ng:"y2"===a?b=Wg:"x"===a&&(b=Ig),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Ng=b:"y2"===a?Wg=b:"x"===a&&(Ig=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",wg?"inner-top":"inner-right")}function eb(){return cb("y",wg?"inner-right":"inner-top")}function fb(){return cb("y2",wg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?lf/2:lf:b.isBottom?-nf:b.isMiddle?-nf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!wg,db())}function ob(){return kb(wg,eb())}function pb(){return kb(wg,fb())}function qb(){return lb(!wg,db())}function rb(){return lb(wg,eb())}function sb(){return lb(wg,fb())}function tb(){var a=db();return wg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return wg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return wg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!wg,db())}function xb(){return mb(wg,eb())}function yb(){return mb(wg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return Ve.selectAll("."+c+" .tick text").each(function(){var a=this.getBBox();bb?20:b}function Ab(){oi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),oi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),oi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=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]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return Ve.min(Object.keys(i).map(function(a){return Ve.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=vc(a),i=Ec(a);if(Xf.length>0)for(g=Hc(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 Ve.max(Object.keys(i).map(function(a){return Ve.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Ug:Lg,n="y2"===c?Tg:Kg,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?Vg:Mg,r=bd()&&wg;return 0===l.length?"y2"===c?Kf.domain():Jf.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=cd(o,p),j=$b(Jf.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Qg&&(f=b(Qg.top)?Qg.top:e,g=b(Qg.bottom)?Qg.bottom:e),"y2"===c&&Zg&&(f=b(Zg.top)?Zg.top:e,g=b(Zg.bottom)?Zg.bottom:e),Gd(l)&&!Gc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(ti),c=$b(If.domain());return a||0===c?1:b/c}function Wb(a){return Gg?Gg:Ve.min(a,function(a){return Ve.min(a.values,function(a){return a.x})})}function Xb(a){return Fg?Fg:Ve.max(a,function(a){return Ve.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return Nh?d=0:Gd(a)?(c=tc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=Mh?new Date(c.getTime()-e):c-e,g=Mh?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return Sf&&a===Sf||$d(Tf)&&_d(Tf,a)}function fc(a){return!ec(a)}function gc(a){return Sf?Sf:$d(Tf)?Tf[a]:null}function hc(a,b){return a in We.data.x&&We.data.x[a]&&We.data.x[a][b]?We.data.x[a][b]:b}function ic(a){Object.keys(a).forEach(function(b){Tf[b]=a[b]})}function jc(a){var b;return a&&(b=Wf[a.id],a.name=b?b:a.id),a}function kc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=mc(b[d],a.id,d)}),We.data.x[a.id]=b})}function lc(a,b){a.forEach(function(a){b[a.id]&&kc([a],b[a.id])})}function mc(a,b,c){var d;return d=Mh?a?a instanceof Date?a:Wd(a):Wd(hc(b,c)):Oh&&!Nh?a?+a:hc(b,c):c}function nc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0&&(We.data.x[b]=a.map(function(a){return a[c]})):We.data.x[b]=a.map(function(a,b){return b})}),c.forEach(function(a){if(!We.data.x[a])throw new Error('x is not defined for id = "'+a+'".')}),b=c.map(function(b,c){var d=Vf(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=mc(g,b,e);return Oh&&Nh&&0===c&&g&&(0===e&&(yg=[]),yg.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++})}),Zf&&Ed(vc(b).filter(function(a){return!(a in $f)}),Zf),b.forEach(function(a){ac(a.id_org,a)}),b}function qc(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 rc(a){return a>0&&We.data.targets[0].values[a-1]?We.data.targets[0].values[a-1].x:void 0}function sc(a){return a1?We.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?We.data.targets[0]:null,a}function vc(a){return a=c(a)?We.data.targets:a,a.map(function(a){return a.id})}function wc(a){var b,c=vc();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(Mh?new Date(h):h);i.push(d)}return i}function Cc(a){Wh=Wh.concat(a)}function Dc(a){Wh=Wh.filter(function(b){return a.indexOf(b)<0})}function Ec(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Fc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Hc(a){return Fc(a,function(a){return a>0})}function Ic(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(kd(a,f))),a[g].x&&(e=e.concat(kd(a,g))),nd(e,b)):ld(a,b,f,g)}function md(a,b){var c;return c=a.map(function(a){return ld(a.values,b)}),nd(c,b)}function nd(a,b){var c,d;return a.forEach(function(a){var e=ae(a,b);(c>e||!c)&&(c=e,d=a)}),d}function od(a,b){return Ve.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function pd(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 qd(){return ag&&"desc"===ag.toLowerCase()}function rd(){return ag&&"asc"===ag.toLowerCase()}function sd(a){var b=rd(),c=qd();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 ag&&a.sort(ag),a}function td(a,c){var d,e,f,g,h,i,j,k=Kd(We.data.targets),l=k?ed:dd,m=a.filter(function(a){return a&&b(a.value)});zh&&0!==m.length&&(ri.html(Ch(a,$(),l,Uh)).style("display","block"),d=ri.property("offsetWidth"),e=ri.property("offsetHeight"),k?(g=lf/2+c[0],i=nf/2+c[1]+20):(wg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=If(m[0].x)+20):(f=q(),g=f+t()+If(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),ri.style("top",i+"px").style("left",g+"px"))}function ud(){ri.style("display","none")}function vd(a){var c=a.filter(function(a){return a&&b(a.value)});zh&&(Hd(We.data.targets)||Kd(We.data.targets)||oi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(wg?"y1":"x1",gd).attr(wg?"y2":"x2",gd))}function wd(){oi.select("line."+f.xgridFocus).style("visibility","hidden")}function xd(a){return a.x||0===a.x?If(a.x):null}function yd(a){return V(a.id)(a.value)}function zd(){var a,b,d={},e=0;return zc(xc(Nd)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Dd(a,b){return lh?lh:b?2*a.tickOffset()*mh/b:0}function Ed(a,b){var c,d=a?"string"==typeof a?[a]:a:vc();for(c=0;c0}function _d(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ae(a,b){var c="y"===Z(a.id)?Jf:Kf;return Math.pow(If(a.x)-b[0],2)+Math.pow(c(a.value)-b[1],2)}function be(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function ce(a,b,c){lg(b,a.node()),oi.select("."+f.selectedCircles+Xc(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Jc(f.selectedCircle,c)}).attr("cx",wg?yd:xd).attr("cy",wg?xd:yd).attr("stroke",function(){return Uh(b)}).attr("r",1.4*kh).transition().duration(100).attr("r",kh)}function de(a,b,c){mg(b,a.node()),oi.select("."+f.selectedCircles+Xc(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ee(a,b,c,d){a?ce(b,c,d):de(b,c,d)}function fe(a,b){lg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ve.rgb(Uh(b)).darker(1)})}function ge(a,b){mg(b,a.node()),a.transition().duration(100).style("fill",function(){return Uh(b)})}function he(a,b,c,d){a?fe(b,c,d):ge(b,c,d)}function ie(a){return a.filter(function(a){return b(a.value)})}function je(a,c){return(c?oi.selectAll("."+f.circles+Xc(c)):oi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ke(a,b){je(a,b).classed(f.EXPANDED,!0).attr("r",jh)}function le(a){je(a).filter(function(){return Ve.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",gh)}function me(a){return oi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function ne(a){me(a).classed(f.EXPANDED,!0)}function oe(a){me(a).classed(f.EXPANDED,!1)}function pe(a,b){var c=te(a,b);return function(a,b){var d=c(a,b),e=wg?1:0,f=wg?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 qe(a,b){var c=te(a,!1),d=b?re:se;return function(a,b){return d(c(a,b),a,this)}}function re(a,b){var c;return wg?(c=Nd(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function se(a,b,c){var d=c.getBBox();return wg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:Nd(b)?-3:-6)}function te(a,b){var c=a.__max__+1,d=Dd(Of,c),e=Ad(d,c,a,!!b),f=Bd(!!b),g=Cd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return wg&&(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 ue(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 ve(b){var c,d,e;if(si=Ve.select(Ye),si.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(si.html(""),si.classed("c3",!0),We.data.x={},We.data.targets=pc(b),n(),R(),If.domain(Ve.extent(Zb(We.data.targets))),Jf.domain(Ub(We.data.targets,"y")),Kf.domain(Ub(We.data.targets,"y2")),Lf.domain(If.domain()),Mf.domain(Jf.domain()),Nf.domain(Kf.domain()),ti=If.domain(),hi.scale(Lf),bf&&li.scale(If),mi=si.append("svg").attr("width",lf+hf.left+hf.right).attr("height",nf+hf.top+hf.bottom).on("mouseenter",ef).on("mouseleave",ff),ni=mi.append("defs"),ni.append("clipPath").attr("id",Gh).append("rect").attr("width",lf).attr("height",nf),ni.append("clipPath").attr("id",Hh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),ni.append("clipPath").attr("id",Ih).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),oi=mi.append("g").attr("transform",_h.main),pi=pg?mi.append("g").attr("transform",_h.context):null,qi=sg?mi.append("g").attr("transform",_h.legend):null,ri=Ve.select(Ye).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),oi.append("g").attr("class",f.axisX).attr("clip-path",wg?"":Kh).attr("transform",_h.x).append("text").attr("class",f.axisXLabel).attr("transform",wg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),Jg&&oi.append("g").attr("class",f.axisY).attr("clip-path",wg?Lh:"").append("text").attr("class",f.axisYLabel).attr("transform",wg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),Sg&&oi.append("g").attr("class",f.axisY2).attr("transform",_h.y2).append("text").attr("class",f.axisY2Label).attr("transform",wg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=oi.append("g").attr("clip-path",Jh).attr("class",f.grid),_g&&d.append("g").attr("class",f.xgrids),$d(bh)&&d.append("g").attr("class",f.xgridLines),hh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),ch&&d.append("g").attr("class",f.ygrids),$d(dh)&&d.append("g").attr("class",f.ygridLines),oi.append("g").attr("clip-path",Jh).attr("class",f.regions),oi.append("g").attr("clip-path",Jh).attr("class",f.chart),c=oi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",bf?wg?"ns-resize":"ew-resize":null),oi.select("."+f.chart).append("g").attr("class",f.chartBars),oi.select("."+f.chart).append("g").attr("class",f.chartLines),oi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",_h.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),oi.select("."+f.chart).append("g").attr("class",f.chartTexts),bf&&oi.insert("rect",df?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",lf).attr("height",nf).style("opacity",0).style("cursor",wg?"ns-resize":"ew-resize").call(li).on("dblclick.zoom",null),Hg&&hi.extent("function"!=typeof Hg?Hg:Hg(Zb())),pg&&(pi.append("g").attr("clip-path",Jh).attr("class",f.chart),pi.select("."+f.chart).append("g").attr("class",f.chartBars),pi.select("."+f.chart).append("g").attr("class",f.chartLines),pi.append("g").attr("clip-path",Jh).attr("class",f.brush).call(hi).selectAll("rect").attr(wg?"width":"height",wg?mf:of),pi.append("g").attr("class",f.axisX).attr("transform",_h.subx).attr("clip-path",wg?"":Kh)),Ie(We.data.targets),wg?oi.select("."+f.axisX).style("opacity",0).call(Of):(oi.select("."+f.axisY).style("opacity",0).call(Pf),oi.select("."+f.axisY2).style("opacity",0).call(Qf)),He({withTransform:!0,withLegend:!0,withTransitionForAxis:!1}),Dh){if(Mh&&"string"==typeof Eh){for(Eh=Wd(Eh),e=0;e0){d=[];for(var g in Wf)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=pd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=he,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 Ae(a){Kd(We.data.targets)||eg&&(Ph=a,oi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Qh=!0,ng())}function Be(){Kd(We.data.targets)||eg&&(oi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),oi.selectAll("."+f.shape).classed(f.INCLUDED,!1),Qh=!1,og())}function Ce(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P=zd(),Q=Kd(We.data.targets),R=zc(We.data.targets);if(0!==R.length){if(a=d(a)?a:{},v=d(a.withY)?a.withY:!0,w=d(a.withSubchart)?a.withSubchart:!0,x=d(a.withTransition)?a.withTransition:!0,A=d(a.withTransform)?a.withTransform:!1,B=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,C=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,D=d(a.withLegend)?a.withLegend:!1,y=d(a.withTransitionForExit)?a.withTransitionForExit:x,z=d(a.withTransitionForAxis)?a.withTransitionForAxis:x,I=x?gf:0,J=y?I:0,K=z?I:0,D&&sg&&Qe(We.data.targets,a),C&&(If.domain(Ve.extent(Zb(R))),ti=If.domain(),bf&&li.scale(If).updateScaleExtent(),Lf.domain(If.domain()),hi.scale(Lf)),B&&(If.domain(hi.empty()?ti:hi.extent()),bf&&li.scale(If).updateScaleExtent(),Hd(R)||(M=Bc(Ac(R)),Of.tickValues(M),Rf.tickValues(M))),Jf.domain(Ub(R,"y")),Kf.domain(Ub(R,"y2")),oi.select("."+f.axisX).style("opacity",Q?0:1).transition().duration(K).call(Of),oi.select("."+f.axisY).style("opacity",Q?0:1).transition().duration(K).call(Pf),oi.select("."+f.axisY2).style("opacity",Q?0:1).transition().duration(K).call(Qf),B&&Bg&&M){for(N=1;N=V;V++)e.push(new Date(V+"-01-01 00:00:00"))}else e=If.ticks(10);c=oi.select("."+f.xgrids).selectAll("."+f.xgrid).data(e),c.enter().append("line").attr("class",f.xgrid),c.attr("x1",wg?0:function(a){return If(a)-Of.tickOffset()}).attr("x2",wg?lf:function(a){return If(a)-Of.tickOffset()}).attr("y1",wg?function(a){return If(a)-Of.tickOffset()}:hf.top).attr("y2",wg?function(a){return If(a)-Of.tickOffset()}:nf).style("opacity",function(){return+Ve.select(this).attr(wg?"y1":"x1")===(wg?nf:0)?0:1}),c.exit().remove()}$d(bh)&&(g=oi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(bh),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",wg?"":"rotate(-90)").attr("dx",wg?0:-hf.top).attr("dy",-5).style("opacity",0),g.select("line").transition().duration(I).attr("x1",wg?0:hd).attr("x2",wg?lf:hd).attr("y1",wg?hd:hf.top).attr("y2",wg?hd:nf).style("opacity",1),g.select("text").transition().duration(I).attr("x",wg?lf:0).attr("y",hd).text(function(a){return a.text}).style("opacity",1),g.exit().transition().duration(I).style("opacity",0).remove()),v&&ch&&(i=oi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Jf.ticks(eh)),i.enter().append("line").attr("class",f.ygrid),i.attr("x1",wg?Jf:0).attr("x2",wg?Jf:lf).attr("y1",wg?0:Jf).attr("y2",wg?nf:Jf),i.exit().remove()),v&&$d(dh)&&(j=oi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(dh),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",wg?"rotate(-90)":"").attr("dx",wg?0:-hf.top).attr("dy",-5).style("opacity",0),j.select("line").transition().duration(I).attr("x1",wg?id:0).attr("x2",wg?id:lf).attr("y1",wg?0:id).attr("y2",wg?nf:id).style("opacity",1),j.select("text").transition().duration(I).attr("x",wg?0:lf).attr("y",id).text(function(a){return a.text}).style("opacity",1),j.exit().transition().duration(I).style("opacity",0).remove()),m=oi.selectAll("."+f.bars).selectAll("."+f.bar).data(Sd),m.enter().append("path").attr("d",E).style("stroke","none").style("opacity",0).style("fill",function(a){return Uh(a)}).attr("class",Rc),m.style("opacity",Zc).transition().duration(I).attr("d",E).style("opacity",1),m.exit().transition().duration(J).style("opacity",0).remove(),p=oi.selectAll("."+f.texts).selectAll("."+f.text).data(Ud),p.enter().append("text").attr("class",Kc).attr("text-anchor",function(a){return wg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),p.text(function(a){return fd(a.id)(a.value)}).style("fill-opacity",$c).transition().duration(I).attr("x",G).attr("y",H).style("fill-opacity",ad),p.exit().transition().duration(J).style("fill-opacity",0).remove(),oi.selectAll("."+f.line).style("opacity",Zc).transition().duration(I).attr("d",ii).style("opacity",1),oi.selectAll("."+f.area).style("opacity",0).transition().duration(I).attr("d",ji).style("opacity",ui),l=oi.selectAll("."+f.circles).selectAll("."+f.circle).data(Td),l.enter().append("circle").attr("class",Pc).style("opacity",0).attr("r",gh),l.style("opacity",Zc).transition().duration(I).style("opacity",_c).attr("cx",wg?yd:xd).attr("cy",wg?xd:yd),l.exit().remove(),oi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",A?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(I).attrTween("d",function(a){var b,c=Cb(a);return c?(b=Ve.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",A?"scale(1)":"").style("opacity",1),oi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(I).text(Jb).style("opacity",function(a){return yc(a.data.id)&&Rd(a.data)?1:0}),oi.select("."+f.chartArcsTitle).style("opacity",Jd(We.data.targets)?1:0),pg&&(null!==Ve.event&&"zoom"===Ve.event.type&&hi.extent(If.orgDomain()).update(),w&&(pi.select("."+f.axisX).style("opacity",Q?0:1).transition().duration(I).call(Rf),hi.empty()||hi.extent(If.orgDomain()).update(),F=pe(P,!0),q=pi.selectAll("."+f.bars).selectAll("."+f.bar).data(Sd),q.enter().append("path").attr("d",F).style("stroke","none").style("fill",function(a){return Uh(a)}).attr("class",Rc),q.style("opacity",Zc).transition().duration(I).attr("d",F).style("opacity",1),q.exit().transition().duration(I).style("opacity",0).remove(),pi.selectAll("."+f.line).style("opacity",Zc).transition().duration(I).attr("d",ki).style("opacity",1))),oi.selectAll("."+f.selectedCircles).filter(function(a){return Nd(a)}).selectAll("circle").remove(),oi.selectAll("."+f.selectedCircle).transition().duration(I).attr("cx",wg?yd:xd).attr("cy",wg?xd:yd),$d(Tf)?(r=oi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),xe(r.enter()),r.attr("x",0).attr("y",0).attr("width",lf).attr("height",nf)):(Oh&&!Nh?(u=function(a,b){var c=rc(b),d=sc(b),e=We.data.x[a.id][b];return(If(d?d:e+50)-If(c?c:e-50))/2},t=function(a,b){var c=rc(b),d=We.data.x[a.id][b];return(If(d)+If(c?c:d-50))/2}):(u=L(),t=function(a){return If(a.x)-u/2}),s=uc(),oi.select("."+f.eventRects).datum(s?s.values:[]),r=oi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),we(r.enter()),r.attr("class",Wc).attr("x",wg?0:t).attr("y",wg?t:0).attr("width",wg?lf:u).attr("height",wg?u:nf),r.exit().remove()),n=oi.select("."+f.regions).selectAll("rect."+f.region).data(yh),n.enter().append("rect").style("fill-opacity",0),n.attr("class",Vc).attr("x",wg?0:cc).attr("y",wg?cc:hf.top).attr("width",wg?lf:dc).attr("height",wg?dc:nf).transition().duration(I).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),n.exit().transition().duration(I).style("fill-opacity",0).remove(),vc().forEach(function(a){vi[a]=!0})}}function De(){Ce({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ee(){return"mousemove"===Ve.event.sourceEvent.type&&li.altDomain?(If.domain(li.altDomain),void li.scale(If).updateScaleExtent()):(Nh&&If.orgDomain()[0]===ti[0]&&If.domain([ti[0]-1e-10,If.orgDomain()[1]]),Ce({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Ve.event.sourceEvent.type&&(Rh=!0)))}function Fe(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ge(){mi.attr("width",pf).attr("height",qf),mi.select("#"+Gh).select("rect").attr("width",lf).attr("height",nf),mi.select("#"+Hh).select("rect").attr("width",H),mi.select("#"+Ih).select("rect").attr("width",J),mi.select("."+f.zoomRect).attr("width",lf).attr("height",nf)}function He(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(),R(),Ge(),m(a.withTransition),Ce(a)}function Ie(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=oi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a),j=i.enter().append("g").attr("class",function(a){return f.chartText+Jc(f.target,a.id)}).style("pointer-events","none"),j.append("g").attr("class",Lc).style("fill",function(a){return Uh(a)}),e=oi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),d=e.enter().append("g").attr("class",function(a){return f.chartBar+Jc(f.target,a.id)}).style("pointer-events","none"),d.append("g").attr("class",Sc).style("fill",function(a){return Uh(a)}).style("stroke","none").style("cursor",function(a){return gg(a)?"pointer":null}),c=oi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),b=c.enter().append("g").attr("class",function(a){return f.chartLine+Jc(f.target,a.id)}).style("pointer-events","none"),b.append("path").attr("class",Oc).style("opacity",0).style("stroke",function(a){return Uh(a)}),b.append("path").attr("class",Uc).style("opacity",function(){return ui=+Ve.select(this).style("opacity"),0}).style("fill",function(a){return Uh(a)}),b.append("g").attr("class",function(a){return Jc(f.selectedCircles,a.id)}),b.append("g").attr("class",Qc).style("fill",function(a){return Uh(a)}).style("cursor",function(a){return gg(a)?"pointer":null}),a.forEach(function(a){oi.selectAll("."+f.selectedCircles+Xc(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=oi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(zf(a)),g=h.enter().append("g").attr("class",function(a){return f.chartArc+Jc(f.target,a.data.id)}),g.append("path").attr("class",Tc).style("opacity",0).style("fill",function(a){return Uh(a.data)}).style("cursor",function(a){return gg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),Ne(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];td(c,Ve.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),Pe(),ud(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),pg&&(n=pi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),m=n.enter().append("g").attr("class",function(a){return f.chartBar+Jc(f.target,a.id)}),m.append("g").attr("class",Sc).style("fill",function(a){return Uh(a)}),l=pi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),k=l.enter().append("g").attr("class",function(a){return f.chartLine+Jc(f.target,a.id)}),k.append("path").attr("class",Oc).style("opacity",0).style("stroke",function(a){return Uh(a)})),mi.selectAll("."+f.target).filter(function(a){return yc(a.id)}).transition().style("opacity",1)}function Je(a,b){We.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=ai?i:h,k=ai?rf:sf;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=ai?u:t,vg?(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=vc(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,ai?(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=qi.selectAll("."+f.legendItem).data(q).enter().append("g").attr("class",function(a){return Jc(f.legendItem,a)}).style("cursor","pointer").on("click",function(a){"function"==typeof ug?ug(a):We.toggle(a)}).on("mouseover",function(a){We.focus(a)}).on("mouseout",function(){We.revert()}),g.append("text").text(function(a){return d(Wf[a])?Wf[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",ai?i:-200).attr("y",ai?-200:l),g.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",ai?j:-200).attr("y",ai?-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 Uh(a)}).attr("x",ai?i:-200).attr("y",ai?-200:k).attr("width",10).attr("height",10),qi.selectAll("text").data(q).text(function(a){return d(Wf[a])?Wf[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",i).attr("y",l),qi.selectAll("rect."+f.legendItemEvent).data(q).transition().duration(p?250:0).attr("x",j).attr("y",o),qi.selectAll("rect."+f.legendItemTile).data(q).transition().duration(p?250:0).attr("x",h).attr("y",k),N(t),O(u),M(C),n(),R(),Ge(),m(!1)}function Re(a){return wc(a.id)}function Se(a){return"data"in a&&wc(a.data.id)}function Te(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 Ue(a,b,c){var d=!Kd(We.data.targets);Ed(a,b),He(c?c:{withTransitionForAxis:d})}var Ve=a.d3?a.d3:a.require?a.require("d3"):void 0,We={data:{},axis:{}},Xe={},Ye=h(["bindto"],"#chart"),Ze=h(["size","width"]),$e=h(["size","height"]),_e=h(["padding","left"]),af=h(["padding","right"]),bf=h(["zoom","enabled"],!1),cf=h(["zoom","extent"]),df=h(["zoom","privileged"],!1),ef=h(["onenter"],function(){}),ff=h(["onleave"],function(){}),gf=h(["transition","duration"],350);g("data","data is required in config");var 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,Rf,Sf=h(["data","x"]),Tf=h(["data","xs"],{}),Uf=h(["data","x_format"]),Vf=h(["data","id_converter"],function(a){return a}),Wf=h(["data","names"],{}),Xf=h(["data","groups"],[]),Yf=h(["data","axes"],{}),Zf=h(["data","type"]),$f=h(["data","types"],{}),_f=h(["data","labels"],{}),ag=h(["data","order"]),bg=h(["data","regions"],{}),cg=h(["data","color"]),dg=h(["data","colors"],{}),eg=h(["data","selection","enabled"],!1),fg=h(["data","selection","grouped"],!1),gg=h(["data","selection","isselectable"],function(){return!0}),hg=h(["data","selection","multiple"],!0),ig=h(["data","onclick"],function(){}),jg=h(["data","onenter"],function(){}),kg=h(["data","onleave"],function(){}),lg=h(["data","onselected"],function(){}),mg=h(["data","onunselected"],function(){}),ng=h(["data","ondragstart"],function(){}),og=h(["data","ondragend"],function(){}),pg=h(["subchart","show"],!1),qg=pg?h(["subchart","size","height"],60):0,rg=h(["color","pattern"],[]),sg=h(["legend","show"],!0),tg=h(["legend","position"],"bottom"),ug=h(["legend","item","onclick"]),vg=h(["legend","equally"],!1),wg=h(["axis","rotated"],!1),xg=h(["axis","x","type"],"indexed"),yg=h(["axis","x","categories"],[]),zg=h(["axis","x","tick","centered"],!1),Ag=h(["axis","x","tick","format"]),Bg=h(["axis","x","tick","culling"],{}),Cg=h(["axis","x","tick","culling","max"],"categorized"===xg?1/0:10),Dg=h(["axis","x","tick","count"]),Eg=h(["axis","x","tick","fit"],!1),Fg=h(["axis","x","max"]),Gg=h(["axis","x","min"]),Hg=h(["axis","x","default"]),Ig=h(["axis","x","label"],{}),Jg=h(["axis","y","show"],!0),Kg=h(["axis","y","max"]),Lg=h(["axis","y","min"]),Mg=h(["axis","y","center"]),Ng=h(["axis","y","label"],{}),Og=h(["axis","y","inner"],!1),Pg=h(["axis","y","tick","format"]),Qg=h(["axis","y","padding"],{}),Rg=h(["axis","y","ticks"],10),Sg=h(["axis","y2","show"],!1),Tg=h(["axis","y2","max"]),Ug=h(["axis","y2","min"]),Vg=h(["axis","y2","center"]),Wg=h(["axis","y2","label"],{}),Xg=h(["axis","y2","inner"],!1),Yg=h(["axis","y2","tick","format"]),Zg=h(["axis","y2","padding"],{}),$g=h(["axis","y2","ticks"],10),_g=h(["grid","x","show"],!1),ah=h(["grid","x","type"],"tick"),bh=h(["grid","x","lines"],[]),ch=h(["grid","y","show"],!1),dh=h(["grid","y","lines"],[]),eh=h(["grid","y","ticks"],10),fh=h(["point","show"],!0),gh=fh?h(["point","r"],2.5):0,hh=h(["point","focus","line","enabled"],!0),ih=h(["point","focus","expand","enabled"],!0),jh=h(["point","focus","expand","r"],ih?4:gh),kh=h(["point","focus","select","r"],8),lh=h(["bar","width"]),mh=h(["bar","width","ratio"],.6),nh=h(["pie","label","show"],!0),oh=h(["pie","label","format"]),ph=h(["pie","onclick"],function(){}),qh=h(["pie","onmouseover"],function(){}),rh=h(["pie","onmouseout"],function(){}),sh=h(["donut","label","show"],!0),th=h(["donut","label","format"]),uh=h(["donut","title"],""),vh=h(["donut","onclick"],function(){}),wh=h(["donut","onmouseover"],function(){}),xh=h(["donut","onmouseout"],function(){}),yh=h(["regions"],[]),zh=h(["tooltip","show"],!0),Ah=h(["tooltip","format","title"]),Bh=h(["tooltip","format","value"]),Ch=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Ah?Ah:b,l=Bh?Bh: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+""}),Dh=h(["tooltip","init","show"],!1),Eh=h(["tooltip","init","x"],0),Fh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Gh=("string"==typeof Ye?Ye.replace("#",""):Ye.id)+"-clip",Hh=Gh+"-xaxis",Ih=Gh+"-yaxis",Jh=i(Gh),Kh=i(Kh),Lh=i(Lh),Mh="timeseries"===xg,Nh="categorized"===xg,Oh=!Mh&&(Sf||$d(Tf)),Ph=null,Qh=!1,Rh=!1,Sh=!1,Th=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Uh=Vd(dg,$d(rg)?rg:Th,cg),Vh=function(){var a=[[Ve.time.format("%Y/%-m/%-d"),function(){return!0}],[Ve.time.format("%-m/%-d"),function(a){return a.getMonth()}],[Ve.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ve.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ve.time.format("%I %p"),function(a){return a.getHours()}],[Ve.time.format("%I:%M"),function(a){return a.getMinutes()}],[Ve.time.format(":%S"),function(a){return a.getSeconds()}],[Ve.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)}}(),Wh=[],Xh=wg?"left":"bottom",Yh=wg?Og?"top":"bottom":Og?"right":"left",Zh=wg?Xg?"bottom":"top":Xg?"left":"right",$h=wg?"left":"bottom",_h={main:function(){return"translate("+hf.left+","+hf.top+")"},context:function(){return"translate("+jf.left+","+jf.top+")"},legend:function(){return"translate("+kf.left+","+kf.top+")"},x:function(){return"translate(0,"+(wg?0:nf)+")"},y:function(){return"translate(0,"+(wg?nf:0)+")"},y2:function(){return"translate("+(wg?0:lf)+","+(wg?1:0)+")"},subx:function(){return"translate(0,"+(wg?0:of)+")"},arc:function(){return"translate("+lf/2+","+nf/2+")"}},ai="right"===tg,bi=0,ci=0,di=0,ei=30,fi=30,gi=5;zf=Ve.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var hi,ii=function(){var a=Ve.svg.line().x(wg?function(a){return V(a.id)(a.value)}:gd).y(wg?gd:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=ie(b.values);return Ld(b)?(a.interpolate(Md(b)?"cardinal":"linear"),bg[b.id]?ue(e,If,V(b.id),bg[b.id]):a(e)):(c=If(e[0].x),d=V(b.id)(e[0].value),wg?"M "+d+" "+c:"M "+c+" "+d)}}(),ji=function(){var a;return a=wg?Ve.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(gd):Ve.svg.area().x(gd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=ie(b.values);return Fd([b],"area")||Fd([b],"area-spline")?(a.interpolate(Md(b)?"cardinal":"linear"),a(e)):(c=If(e[0].x),d=V(b.id)(e[0].value),wg?"M "+d+" "+c:"M "+c+" "+d)}}(),ki=function(){var a=Ve.svg.line().x(wg?function(a){return W(a.id)(a.value)}:jd).y(wg?jd:function(a){return W(a.id)(a.value)});return function(b){var c=ie(b.values);return Ld(b)?a(c):"M "+Lf(c[0].x)+" "+W(b.id)(c[0].value)}}(),li=function(){};hi=Ve.svg.brush().on("brush",De),hi.update=function(){return pi&&pi.select("."+f.brush).call(this),this},hi.scale=function(a){return wg?this.y(a):this.x(a)},bf&&(li=Ve.behavior.zoom().on("zoomstart",function(){li.altDomain=Ve.event.sourceEvent.altKey?If.orgDomain():null}).on("zoom",bf?Ee:null),li.scale=function(a){return wg?this.y(a):this.x(a)},li.orgScaleExtent=function(){var a=cf?cf:[1,10];return[a[0],Math.max(tc()/a[1],a[1])]},li.updateScaleExtent=function(){var a=$b(If.orgDomain())/$b(ti),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var mi,ni,oi,pi,qi,ri,si,ti,ui,vi={};if(We.focus=function(a){function b(a){zc(a).transition().duration(100).style("opacity",1)}var c=mi.selectAll(Yc(a)),d=c.filter(Re),e=c.filter(Se);We.revert(),We.defocus(),b(d.classed(f.focused,!0)),b(e),Kd(We.data.targets)&&Kb(a,!0),Ne(a)},We.defocus=function(a){function b(a){zc(a).transition().duration(100).style("opacity",.3)}var c=mi.selectAll(Yc(a)),d=c.filter(Re),e=c.filter(Se);We.revert(),b(d.classed(f.focused,!1)),b(e),Kd(We.data.targets)&&Lb(a),Oe(a)},We.revert=function(a){function b(a){zc(a).transition().duration(100).style("opacity",1)}var c=mi.selectAll(Yc(a)),d=c.filter(Re),e=c.filter(Se);b(d.classed(f.focused,!1)),b(e),Kd(We.data.targets)&&Lb(a),Pe()},We.show=function(a){Dc(a),mi.selectAll(Yc(a)).transition().style("opacity",1),Ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!1})},We.hide=function(a){Cc(a),mi.selectAll(Yc(a)).transition().style("opacity",0),Ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!1})},We.toggle=function(a){yc(a)?We.hide(a):We.show(a)},We.unzoom=function(){hi.clear().update(),Ce({withUpdateXDomain:!0})},We.load=function(a){return a.xs&&ic(a.xs),"categories"in a&&Nh&&(yg=a.categories,Of.categories(yg)),"cacheIds"in a&&_b(a.cacheIds)?void Je(bc(a.cacheIds),a.done):void("unload"in a?Le("string"==typeof a.unload?[a.unload]:"boolean"==typeof a.unload&&a.unload?vc():a.unload,function(){Ke(a)}):Ke(a))},We.unload=function(a){Le(a?"string"==typeof a?[a]:a:vc(),function(){Ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},We.selected=function(a){return Ve.merge(oi.selectAll("."+f.shapes+Xc(a)).selectAll("."+f.shape).filter(function(){return Ve.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},We.select=function(a,b,c){eg&&oi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=Ve.select(this),i="circle"===this.nodeName?ce:fe,j="circle"===this.nodeName?de:ge,k=fg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?gg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},We.unselect=function(a,b){eg&&oi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=Ve.select(this),g="circle"===this.nodeName?de:ge,h=fg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&gg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},We.toLine=function(a){Ue(a,"line")},We.toSpline=function(a){Ue(a,"spline")},We.toBar=function(a){Ue(a,"bar")},We.toScatter=function(a){Ue(a,"scatter")},We.toArea=function(a){Ue(a,"area")},We.toAreaSpline=function(a){Ue(a,"area-spline")},We.toPie=function(a){Ue(a,"pie",{withTransform:!0})},We.toDonut=function(a){Ue(a,"donut",{withTransform:!0})},We.groups=function(a){return c(a)?Xf:(Xf=a,Ce(),Xf)},We.xgrids=function(a){return a?(bh=a,Ce(),bh):bh},We.xgrids.add=function(a){return a?We.xgrids(bh.concat(a)):void 0},We.xgrids.remove=function(a){var b=Te(a);return We.xgrids(bh.filter(b))},We.ygrids=function(a){return a?(dh=a,Ce(),dh):dh},We.ygrids.add=function(a){return a?We.ygrids(dh.concat(a)):void 0},We.ygrids.remove=function(a){var b=Te(a);return We.ygrids(dh.filter(b))},We.regions=function(a){return c(a)?yh:(yh=a,Ce(),yh)},We.regions.add=function(a){return c(a)?yh:(yh=yh.concat(a),Ce(),yh)},We.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;mi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),yh=yh.filter(function(b){return b.classes.indexOf(a)<0})}),yh},We.data.get=function(a){var b=We.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},We.data.getAsTarget=function(a){var b=xc(function(b){return b.id===a});return b.length>0?b[0]:void 0},We.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Wf[b]=a[b]}),Qe(We.data.targets,{withTransition:!0}),Wf):Wf},We.x=function(a){return arguments.length&&(kc(We.data.targets,a),Ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),We.data.x},We.xs=function(a){return arguments.length&&(lc(We.data.targets,a),Ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),We.data.x},We.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},We.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Kg=+a.y),b(a.y2)&&(Tg=+a.y2)):Kg=Tg=+a,Ce())},We.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Lg=+a.y),b(a.y2)&&(Ug=+a.y2)):Lg=Ug=+a,Ce())},We.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&We.axis.max(a.max),"undefined"!=typeof a.min&&We.axis.min(a.min))},We.resize=function(a){Ze=a?a.width:null,$e=a?a.height:null,He({withLegend:!0,withTransition:!1})},We.destroy=function(){We.data.targets=void 0,We.data.x={},si.html(""),a.onresize=null},"url"in e.data)Ve.csv(e.data.url,function(a,b){ve(b)});else if("rows"in e.data)ve(nc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");ve(oc(e.data.columns))}return We},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From cfa41d1e2c98967f22e9a4df301f32655a13d55f Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Sun, 6 Apr 2014 18:01:50 +0900 Subject: [PATCH 010/178] Fix ticks when multiple xs --- c3.js | 2 +- c3.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/c3.js b/c3.js index 1e6171f..f37f43f 100644 --- a/c3.js +++ b/c3.js @@ -2925,7 +2925,7 @@ if (__zoom_enabled) { zoom.scale(x).updateScaleExtent(); } // update axis tick values according to options, except for scatter plot if (! hasScatterType(targetsToShow)) { // TODO: fix this - tickValues = generateTickValues(mapTargetsToUniqueXs(targetsToShow)); + tickValues = generateTickValues(mapTargetsToUniqueXs(targetsToShow)).sort(); xAxis.tickValues(tickValues); subXAxis.tickValues(tickValues); } diff --git a/c3.min.js b/c3.min.js index 00ec425..3d55dcb 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.28"},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;clf&&(lf=0),0>nf&&(nf=0),jf={top:wg?hf.top:qf-qg-(ai?0:rf),right:0/0,bottom:20+(ai?0:rf),left:wg?ei:hf.left},mf=wg?hf.left-ei-fi:lf,of=wg?nf:qf-jf.top-jf.bottom,0>mf&&(mf=0),0>of&&(of=0),kf={top:ai?0:qf-rf,right:0/0,bottom:0,left:ai?pf-sf:0},p(),ai&&Kd(We.data.targets)&&(kf.left=lf/2+uf)}function o(){oi.select("line."+f.xgridFocus).attr("x1",wg?0:-10).attr("x2",wg?lf:-10).attr("y1",wg?-10:hf.top).attr("y2",wg?-10:nf)}function p(){uf=nf/2,tf=.95*uf,vf=Jd(We.data.targets)?.6*tf:0}function q(){var a=wg?f.axisX:f.axisY,b=Ve.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Ve.select(Ye).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Ze?Ze:x()}function s(){var a=$e?$e:y();return a>0?a:320}function t(){return Kd(We.data.targets)?0:_e?_e:wg||!Jg||Og?1:v("y")}function u(){var a=1;return Kd(We.data.targets)?0:af?af:ai?sf+(Sg&&!wg?v("y2"):a):Sg?Xg||wg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||Jg?"y2"!==a||Sg?(gb(a).isInner?30:40)+("y2"===a?-10:0):gi:sg&&!ai?10:1}function x(){return+Ve.select(Ye).style("width").replace("px","")}function y(){return+Ve.select(Ye).style("height").replace("px","")}function z(a){return a?-5:-(hf.left-1)}function A(a){return a?-20:-1}function B(){return z(!wg)}function C(){return A(!wg)}function D(){return z(wg)}function E(){return A(wg)}function F(a){return a?lf+2+4:hf.left+20}function G(a){return a?80:nf+2}function H(){return F(!wg)}function I(){return G(!wg)}function J(){return F(wg)}function K(){return G(wg)}function L(){var a=wg?nf:lf,b=tc(),c=Vb()*(Gd(We.data.targets)?(b-(Nh?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){bi=a}function N(a){ci=a}function O(a){di=a}function P(){return sg?ai?ci*(bi+1):pf:0}function Q(){return sg?ai?qf:di*(bi+1):0}function R(){var a,b=!If;Af=wg?1:0,Bf=wg?nf:lf,Cf=wg?0:nf,Df=wg?lf:1,Ef=Af,Ff=Bf,Gf=wg?0:of,Hf=wg?mf:1,If=T(Af,Bf,b?void 0:If.domain(),function(){return Of.tickOffset()}),Jf=U(Cf,Df),Kf=U(Cf,Df),Lf=T(Af,Bf,ti,function(a){return a%1?0:Rf.tickOffset()}),Mf=U(Gf,Hf),Nf=U(Gf,Hf),a=$(),Of=X(If,Xh,a),Rf=X(Lf,$h,a),Pf=Y(Jf,Yh,Pg,Rg),Qf=Y(Kf,Zh,Yg,$g),b||(hi.scale(Lf),bf&&li.scale(If)),S()}function S(){wf=Db(),xf=Eb(),yf=Eb(.98)}function T(a,b,e,f){var g=(Mh?Ve.time.scale():Ve.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),Nh){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return Ve.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?Kf:Jf}function W(a){return"y2"===Z(a)?Nf:Mf}function X(a,b,c){var d=(Nh?Bb():Ve.svg.axis()).scale(a).orient(b);return d.tickFormat(c),Nh?d.tickCentered(zg):d.tickOffset=function(){var a=wg?nf:lf;return a*Vb()/tc()/2},Nh&&d.categories(yg),d}function Y(a,b,c,d){return Ve.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Yf?Yf[a]:"y"}function $(){var a=Mh?Vh:Nh?Ic:function(a){return 0>a?a.toFixed(0):a};return Ag&&("function"==typeof Ag?a=Ag:Mh&&(a=function(a){return Ve.time.format(Ag)(a)})),a}function _(a){var b;return"y"===a?b=Ng:"y2"===a?b=Wg:"x"===a&&(b=Ig),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Ng=b:"y2"===a?Wg=b:"x"===a&&(Ig=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",wg?"inner-top":"inner-right")}function eb(){return cb("y",wg?"inner-right":"inner-top")}function fb(){return cb("y2",wg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?lf/2:lf:b.isBottom?-nf:b.isMiddle?-nf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!wg,db())}function ob(){return kb(wg,eb())}function pb(){return kb(wg,fb())}function qb(){return lb(!wg,db())}function rb(){return lb(wg,eb())}function sb(){return lb(wg,fb())}function tb(){var a=db();return wg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return wg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return wg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!wg,db())}function xb(){return mb(wg,eb())}function yb(){return mb(wg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return Ve.selectAll("."+c+" .tick text").each(function(){var a=this.getBBox();bb?20:b}function Ab(){oi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),oi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),oi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=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]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return Ve.min(Object.keys(i).map(function(a){return Ve.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=vc(a),i=Ec(a);if(Xf.length>0)for(g=Hc(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 Ve.max(Object.keys(i).map(function(a){return Ve.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Ug:Lg,n="y2"===c?Tg:Kg,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?Vg:Mg,r=bd()&&wg;return 0===l.length?"y2"===c?Kf.domain():Jf.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=cd(o,p),j=$b(Jf.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Qg&&(f=b(Qg.top)?Qg.top:e,g=b(Qg.bottom)?Qg.bottom:e),"y2"===c&&Zg&&(f=b(Zg.top)?Zg.top:e,g=b(Zg.bottom)?Zg.bottom:e),Gd(l)&&!Gc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(ti),c=$b(If.domain());return a||0===c?1:b/c}function Wb(a){return Gg?Gg:Ve.min(a,function(a){return Ve.min(a.values,function(a){return a.x})})}function Xb(a){return Fg?Fg:Ve.max(a,function(a){return Ve.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return Nh?d=0:Gd(a)?(c=tc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=Mh?new Date(c.getTime()-e):c-e,g=Mh?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return Sf&&a===Sf||$d(Tf)&&_d(Tf,a)}function fc(a){return!ec(a)}function gc(a){return Sf?Sf:$d(Tf)?Tf[a]:null}function hc(a,b){return a in We.data.x&&We.data.x[a]&&We.data.x[a][b]?We.data.x[a][b]:b}function ic(a){Object.keys(a).forEach(function(b){Tf[b]=a[b]})}function jc(a){var b;return a&&(b=Wf[a.id],a.name=b?b:a.id),a}function kc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=mc(b[d],a.id,d)}),We.data.x[a.id]=b})}function lc(a,b){a.forEach(function(a){b[a.id]&&kc([a],b[a.id])})}function mc(a,b,c){var d;return d=Mh?a?a instanceof Date?a:Wd(a):Wd(hc(b,c)):Oh&&!Nh?a?+a:hc(b,c):c}function nc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0&&(We.data.x[b]=a.map(function(a){return a[c]})):We.data.x[b]=a.map(function(a,b){return b})}),c.forEach(function(a){if(!We.data.x[a])throw new Error('x is not defined for id = "'+a+'".')}),b=c.map(function(b,c){var d=Vf(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=mc(g,b,e);return Oh&&Nh&&0===c&&g&&(0===e&&(yg=[]),yg.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++})}),Zf&&Ed(vc(b).filter(function(a){return!(a in $f)}),Zf),b.forEach(function(a){ac(a.id_org,a)}),b}function qc(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 rc(a){return a>0&&We.data.targets[0].values[a-1]?We.data.targets[0].values[a-1].x:void 0}function sc(a){return a1?We.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?We.data.targets[0]:null,a}function vc(a){return a=c(a)?We.data.targets:a,a.map(function(a){return a.id})}function wc(a){var b,c=vc();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(Mh?new Date(h):h);i.push(d)}return i}function Cc(a){Wh=Wh.concat(a)}function Dc(a){Wh=Wh.filter(function(b){return a.indexOf(b)<0})}function Ec(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Fc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Hc(a){return Fc(a,function(a){return a>0})}function Ic(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(kd(a,f))),a[g].x&&(e=e.concat(kd(a,g))),nd(e,b)):ld(a,b,f,g)}function md(a,b){var c;return c=a.map(function(a){return ld(a.values,b)}),nd(c,b)}function nd(a,b){var c,d;return a.forEach(function(a){var e=ae(a,b);(c>e||!c)&&(c=e,d=a)}),d}function od(a,b){return Ve.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function pd(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 qd(){return ag&&"desc"===ag.toLowerCase()}function rd(){return ag&&"asc"===ag.toLowerCase()}function sd(a){var b=rd(),c=qd();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 ag&&a.sort(ag),a}function td(a,c){var d,e,f,g,h,i,j,k=Kd(We.data.targets),l=k?ed:dd,m=a.filter(function(a){return a&&b(a.value)});zh&&0!==m.length&&(ri.html(Ch(a,$(),l,Uh)).style("display","block"),d=ri.property("offsetWidth"),e=ri.property("offsetHeight"),k?(g=lf/2+c[0],i=nf/2+c[1]+20):(wg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=If(m[0].x)+20):(f=q(),g=f+t()+If(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),ri.style("top",i+"px").style("left",g+"px"))}function ud(){ri.style("display","none")}function vd(a){var c=a.filter(function(a){return a&&b(a.value)});zh&&(Hd(We.data.targets)||Kd(We.data.targets)||oi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(wg?"y1":"x1",gd).attr(wg?"y2":"x2",gd))}function wd(){oi.select("line."+f.xgridFocus).style("visibility","hidden")}function xd(a){return a.x||0===a.x?If(a.x):null}function yd(a){return V(a.id)(a.value)}function zd(){var a,b,d={},e=0;return zc(xc(Nd)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Dd(a,b){return lh?lh:b?2*a.tickOffset()*mh/b:0}function Ed(a,b){var c,d=a?"string"==typeof a?[a]:a:vc();for(c=0;c0}function _d(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ae(a,b){var c="y"===Z(a.id)?Jf:Kf;return Math.pow(If(a.x)-b[0],2)+Math.pow(c(a.value)-b[1],2)}function be(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function ce(a,b,c){lg(b,a.node()),oi.select("."+f.selectedCircles+Xc(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Jc(f.selectedCircle,c)}).attr("cx",wg?yd:xd).attr("cy",wg?xd:yd).attr("stroke",function(){return Uh(b)}).attr("r",1.4*kh).transition().duration(100).attr("r",kh)}function de(a,b,c){mg(b,a.node()),oi.select("."+f.selectedCircles+Xc(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ee(a,b,c,d){a?ce(b,c,d):de(b,c,d)}function fe(a,b){lg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ve.rgb(Uh(b)).darker(1)})}function ge(a,b){mg(b,a.node()),a.transition().duration(100).style("fill",function(){return Uh(b)})}function he(a,b,c,d){a?fe(b,c,d):ge(b,c,d)}function ie(a){return a.filter(function(a){return b(a.value)})}function je(a,c){return(c?oi.selectAll("."+f.circles+Xc(c)):oi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ke(a,b){je(a,b).classed(f.EXPANDED,!0).attr("r",jh)}function le(a){je(a).filter(function(){return Ve.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",gh)}function me(a){return oi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function ne(a){me(a).classed(f.EXPANDED,!0)}function oe(a){me(a).classed(f.EXPANDED,!1)}function pe(a,b){var c=te(a,b);return function(a,b){var d=c(a,b),e=wg?1:0,f=wg?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 qe(a,b){var c=te(a,!1),d=b?re:se;return function(a,b){return d(c(a,b),a,this)}}function re(a,b){var c;return wg?(c=Nd(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function se(a,b,c){var d=c.getBBox();return wg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:Nd(b)?-3:-6)}function te(a,b){var c=a.__max__+1,d=Dd(Of,c),e=Ad(d,c,a,!!b),f=Bd(!!b),g=Cd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return wg&&(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 ue(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 ve(b){var c,d,e;if(si=Ve.select(Ye),si.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(si.html(""),si.classed("c3",!0),We.data.x={},We.data.targets=pc(b),n(),R(),If.domain(Ve.extent(Zb(We.data.targets))),Jf.domain(Ub(We.data.targets,"y")),Kf.domain(Ub(We.data.targets,"y2")),Lf.domain(If.domain()),Mf.domain(Jf.domain()),Nf.domain(Kf.domain()),ti=If.domain(),hi.scale(Lf),bf&&li.scale(If),mi=si.append("svg").attr("width",lf+hf.left+hf.right).attr("height",nf+hf.top+hf.bottom).on("mouseenter",ef).on("mouseleave",ff),ni=mi.append("defs"),ni.append("clipPath").attr("id",Gh).append("rect").attr("width",lf).attr("height",nf),ni.append("clipPath").attr("id",Hh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),ni.append("clipPath").attr("id",Ih).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),oi=mi.append("g").attr("transform",_h.main),pi=pg?mi.append("g").attr("transform",_h.context):null,qi=sg?mi.append("g").attr("transform",_h.legend):null,ri=Ve.select(Ye).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),oi.append("g").attr("class",f.axisX).attr("clip-path",wg?"":Kh).attr("transform",_h.x).append("text").attr("class",f.axisXLabel).attr("transform",wg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),Jg&&oi.append("g").attr("class",f.axisY).attr("clip-path",wg?Lh:"").append("text").attr("class",f.axisYLabel).attr("transform",wg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),Sg&&oi.append("g").attr("class",f.axisY2).attr("transform",_h.y2).append("text").attr("class",f.axisY2Label).attr("transform",wg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=oi.append("g").attr("clip-path",Jh).attr("class",f.grid),_g&&d.append("g").attr("class",f.xgrids),$d(bh)&&d.append("g").attr("class",f.xgridLines),hh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),ch&&d.append("g").attr("class",f.ygrids),$d(dh)&&d.append("g").attr("class",f.ygridLines),oi.append("g").attr("clip-path",Jh).attr("class",f.regions),oi.append("g").attr("clip-path",Jh).attr("class",f.chart),c=oi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",bf?wg?"ns-resize":"ew-resize":null),oi.select("."+f.chart).append("g").attr("class",f.chartBars),oi.select("."+f.chart).append("g").attr("class",f.chartLines),oi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",_h.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),oi.select("."+f.chart).append("g").attr("class",f.chartTexts),bf&&oi.insert("rect",df?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",lf).attr("height",nf).style("opacity",0).style("cursor",wg?"ns-resize":"ew-resize").call(li).on("dblclick.zoom",null),Hg&&hi.extent("function"!=typeof Hg?Hg:Hg(Zb())),pg&&(pi.append("g").attr("clip-path",Jh).attr("class",f.chart),pi.select("."+f.chart).append("g").attr("class",f.chartBars),pi.select("."+f.chart).append("g").attr("class",f.chartLines),pi.append("g").attr("clip-path",Jh).attr("class",f.brush).call(hi).selectAll("rect").attr(wg?"width":"height",wg?mf:of),pi.append("g").attr("class",f.axisX).attr("transform",_h.subx).attr("clip-path",wg?"":Kh)),Ie(We.data.targets),wg?oi.select("."+f.axisX).style("opacity",0).call(Of):(oi.select("."+f.axisY).style("opacity",0).call(Pf),oi.select("."+f.axisY2).style("opacity",0).call(Qf)),He({withTransform:!0,withLegend:!0,withTransitionForAxis:!1}),Dh){if(Mh&&"string"==typeof Eh){for(Eh=Wd(Eh),e=0;e0){d=[];for(var g in Wf)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=pd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=he,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 Ae(a){Kd(We.data.targets)||eg&&(Ph=a,oi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Qh=!0,ng())}function Be(){Kd(We.data.targets)||eg&&(oi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),oi.selectAll("."+f.shape).classed(f.INCLUDED,!1),Qh=!1,og())}function Ce(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P=zd(),Q=Kd(We.data.targets),R=zc(We.data.targets);if(0!==R.length){if(a=d(a)?a:{},v=d(a.withY)?a.withY:!0,w=d(a.withSubchart)?a.withSubchart:!0,x=d(a.withTransition)?a.withTransition:!0,A=d(a.withTransform)?a.withTransform:!1,B=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,C=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,D=d(a.withLegend)?a.withLegend:!1,y=d(a.withTransitionForExit)?a.withTransitionForExit:x,z=d(a.withTransitionForAxis)?a.withTransitionForAxis:x,I=x?gf:0,J=y?I:0,K=z?I:0,D&&sg&&Qe(We.data.targets,a),C&&(If.domain(Ve.extent(Zb(R))),ti=If.domain(),bf&&li.scale(If).updateScaleExtent(),Lf.domain(If.domain()),hi.scale(Lf)),B&&(If.domain(hi.empty()?ti:hi.extent()),bf&&li.scale(If).updateScaleExtent(),Hd(R)||(M=Bc(Ac(R)),Of.tickValues(M),Rf.tickValues(M))),Jf.domain(Ub(R,"y")),Kf.domain(Ub(R,"y2")),oi.select("."+f.axisX).style("opacity",Q?0:1).transition().duration(K).call(Of),oi.select("."+f.axisY).style("opacity",Q?0:1).transition().duration(K).call(Pf),oi.select("."+f.axisY2).style("opacity",Q?0:1).transition().duration(K).call(Qf),B&&Bg&&M){for(N=1;N=V;V++)e.push(new Date(V+"-01-01 00:00:00"))}else e=If.ticks(10);c=oi.select("."+f.xgrids).selectAll("."+f.xgrid).data(e),c.enter().append("line").attr("class",f.xgrid),c.attr("x1",wg?0:function(a){return If(a)-Of.tickOffset()}).attr("x2",wg?lf:function(a){return If(a)-Of.tickOffset()}).attr("y1",wg?function(a){return If(a)-Of.tickOffset()}:hf.top).attr("y2",wg?function(a){return If(a)-Of.tickOffset()}:nf).style("opacity",function(){return+Ve.select(this).attr(wg?"y1":"x1")===(wg?nf:0)?0:1}),c.exit().remove()}$d(bh)&&(g=oi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(bh),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",wg?"":"rotate(-90)").attr("dx",wg?0:-hf.top).attr("dy",-5).style("opacity",0),g.select("line").transition().duration(I).attr("x1",wg?0:hd).attr("x2",wg?lf:hd).attr("y1",wg?hd:hf.top).attr("y2",wg?hd:nf).style("opacity",1),g.select("text").transition().duration(I).attr("x",wg?lf:0).attr("y",hd).text(function(a){return a.text}).style("opacity",1),g.exit().transition().duration(I).style("opacity",0).remove()),v&&ch&&(i=oi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Jf.ticks(eh)),i.enter().append("line").attr("class",f.ygrid),i.attr("x1",wg?Jf:0).attr("x2",wg?Jf:lf).attr("y1",wg?0:Jf).attr("y2",wg?nf:Jf),i.exit().remove()),v&&$d(dh)&&(j=oi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(dh),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",wg?"rotate(-90)":"").attr("dx",wg?0:-hf.top).attr("dy",-5).style("opacity",0),j.select("line").transition().duration(I).attr("x1",wg?id:0).attr("x2",wg?id:lf).attr("y1",wg?0:id).attr("y2",wg?nf:id).style("opacity",1),j.select("text").transition().duration(I).attr("x",wg?0:lf).attr("y",id).text(function(a){return a.text}).style("opacity",1),j.exit().transition().duration(I).style("opacity",0).remove()),m=oi.selectAll("."+f.bars).selectAll("."+f.bar).data(Sd),m.enter().append("path").attr("d",E).style("stroke","none").style("opacity",0).style("fill",function(a){return Uh(a)}).attr("class",Rc),m.style("opacity",Zc).transition().duration(I).attr("d",E).style("opacity",1),m.exit().transition().duration(J).style("opacity",0).remove(),p=oi.selectAll("."+f.texts).selectAll("."+f.text).data(Ud),p.enter().append("text").attr("class",Kc).attr("text-anchor",function(a){return wg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),p.text(function(a){return fd(a.id)(a.value)}).style("fill-opacity",$c).transition().duration(I).attr("x",G).attr("y",H).style("fill-opacity",ad),p.exit().transition().duration(J).style("fill-opacity",0).remove(),oi.selectAll("."+f.line).style("opacity",Zc).transition().duration(I).attr("d",ii).style("opacity",1),oi.selectAll("."+f.area).style("opacity",0).transition().duration(I).attr("d",ji).style("opacity",ui),l=oi.selectAll("."+f.circles).selectAll("."+f.circle).data(Td),l.enter().append("circle").attr("class",Pc).style("opacity",0).attr("r",gh),l.style("opacity",Zc).transition().duration(I).style("opacity",_c).attr("cx",wg?yd:xd).attr("cy",wg?xd:yd),l.exit().remove(),oi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",A?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(I).attrTween("d",function(a){var b,c=Cb(a);return c?(b=Ve.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",A?"scale(1)":"").style("opacity",1),oi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(I).text(Jb).style("opacity",function(a){return yc(a.data.id)&&Rd(a.data)?1:0}),oi.select("."+f.chartArcsTitle).style("opacity",Jd(We.data.targets)?1:0),pg&&(null!==Ve.event&&"zoom"===Ve.event.type&&hi.extent(If.orgDomain()).update(),w&&(pi.select("."+f.axisX).style("opacity",Q?0:1).transition().duration(I).call(Rf),hi.empty()||hi.extent(If.orgDomain()).update(),F=pe(P,!0),q=pi.selectAll("."+f.bars).selectAll("."+f.bar).data(Sd),q.enter().append("path").attr("d",F).style("stroke","none").style("fill",function(a){return Uh(a)}).attr("class",Rc),q.style("opacity",Zc).transition().duration(I).attr("d",F).style("opacity",1),q.exit().transition().duration(I).style("opacity",0).remove(),pi.selectAll("."+f.line).style("opacity",Zc).transition().duration(I).attr("d",ki).style("opacity",1))),oi.selectAll("."+f.selectedCircles).filter(function(a){return Nd(a)}).selectAll("circle").remove(),oi.selectAll("."+f.selectedCircle).transition().duration(I).attr("cx",wg?yd:xd).attr("cy",wg?xd:yd),$d(Tf)?(r=oi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),xe(r.enter()),r.attr("x",0).attr("y",0).attr("width",lf).attr("height",nf)):(Oh&&!Nh?(u=function(a,b){var c=rc(b),d=sc(b),e=We.data.x[a.id][b];return(If(d?d:e+50)-If(c?c:e-50))/2},t=function(a,b){var c=rc(b),d=We.data.x[a.id][b];return(If(d)+If(c?c:d-50))/2}):(u=L(),t=function(a){return If(a.x)-u/2}),s=uc(),oi.select("."+f.eventRects).datum(s?s.values:[]),r=oi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),we(r.enter()),r.attr("class",Wc).attr("x",wg?0:t).attr("y",wg?t:0).attr("width",wg?lf:u).attr("height",wg?u:nf),r.exit().remove()),n=oi.select("."+f.regions).selectAll("rect."+f.region).data(yh),n.enter().append("rect").style("fill-opacity",0),n.attr("class",Vc).attr("x",wg?0:cc).attr("y",wg?cc:hf.top).attr("width",wg?lf:dc).attr("height",wg?dc:nf).transition().duration(I).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),n.exit().transition().duration(I).style("fill-opacity",0).remove(),vc().forEach(function(a){vi[a]=!0})}}function De(){Ce({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ee(){return"mousemove"===Ve.event.sourceEvent.type&&li.altDomain?(If.domain(li.altDomain),void li.scale(If).updateScaleExtent()):(Nh&&If.orgDomain()[0]===ti[0]&&If.domain([ti[0]-1e-10,If.orgDomain()[1]]),Ce({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Ve.event.sourceEvent.type&&(Rh=!0)))}function Fe(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ge(){mi.attr("width",pf).attr("height",qf),mi.select("#"+Gh).select("rect").attr("width",lf).attr("height",nf),mi.select("#"+Hh).select("rect").attr("width",H),mi.select("#"+Ih).select("rect").attr("width",J),mi.select("."+f.zoomRect).attr("width",lf).attr("height",nf)}function He(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(),R(),Ge(),m(a.withTransition),Ce(a)}function Ie(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=oi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a),j=i.enter().append("g").attr("class",function(a){return f.chartText+Jc(f.target,a.id)}).style("pointer-events","none"),j.append("g").attr("class",Lc).style("fill",function(a){return Uh(a)}),e=oi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),d=e.enter().append("g").attr("class",function(a){return f.chartBar+Jc(f.target,a.id)}).style("pointer-events","none"),d.append("g").attr("class",Sc).style("fill",function(a){return Uh(a)}).style("stroke","none").style("cursor",function(a){return gg(a)?"pointer":null}),c=oi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),b=c.enter().append("g").attr("class",function(a){return f.chartLine+Jc(f.target,a.id)}).style("pointer-events","none"),b.append("path").attr("class",Oc).style("opacity",0).style("stroke",function(a){return Uh(a)}),b.append("path").attr("class",Uc).style("opacity",function(){return ui=+Ve.select(this).style("opacity"),0}).style("fill",function(a){return Uh(a)}),b.append("g").attr("class",function(a){return Jc(f.selectedCircles,a.id)}),b.append("g").attr("class",Qc).style("fill",function(a){return Uh(a)}).style("cursor",function(a){return gg(a)?"pointer":null}),a.forEach(function(a){oi.selectAll("."+f.selectedCircles+Xc(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=oi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(zf(a)),g=h.enter().append("g").attr("class",function(a){return f.chartArc+Jc(f.target,a.data.id)}),g.append("path").attr("class",Tc).style("opacity",0).style("fill",function(a){return Uh(a.data)}).style("cursor",function(a){return gg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),Ne(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];td(c,Ve.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),Pe(),ud(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),pg&&(n=pi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),m=n.enter().append("g").attr("class",function(a){return f.chartBar+Jc(f.target,a.id)}),m.append("g").attr("class",Sc).style("fill",function(a){return Uh(a)}),l=pi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),k=l.enter().append("g").attr("class",function(a){return f.chartLine+Jc(f.target,a.id)}),k.append("path").attr("class",Oc).style("opacity",0).style("stroke",function(a){return Uh(a)})),mi.selectAll("."+f.target).filter(function(a){return yc(a.id)}).transition().style("opacity",1)}function Je(a,b){We.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=ai?i:h,k=ai?rf:sf;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=ai?u:t,vg?(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=vc(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,ai?(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=qi.selectAll("."+f.legendItem).data(q).enter().append("g").attr("class",function(a){return Jc(f.legendItem,a)}).style("cursor","pointer").on("click",function(a){"function"==typeof ug?ug(a):We.toggle(a)}).on("mouseover",function(a){We.focus(a)}).on("mouseout",function(){We.revert()}),g.append("text").text(function(a){return d(Wf[a])?Wf[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",ai?i:-200).attr("y",ai?-200:l),g.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",ai?j:-200).attr("y",ai?-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 Uh(a)}).attr("x",ai?i:-200).attr("y",ai?-200:k).attr("width",10).attr("height",10),qi.selectAll("text").data(q).text(function(a){return d(Wf[a])?Wf[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",i).attr("y",l),qi.selectAll("rect."+f.legendItemEvent).data(q).transition().duration(p?250:0).attr("x",j).attr("y",o),qi.selectAll("rect."+f.legendItemTile).data(q).transition().duration(p?250:0).attr("x",h).attr("y",k),N(t),O(u),M(C),n(),R(),Ge(),m(!1)}function Re(a){return wc(a.id)}function Se(a){return"data"in a&&wc(a.data.id)}function Te(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 Ue(a,b,c){var d=!Kd(We.data.targets);Ed(a,b),He(c?c:{withTransitionForAxis:d})}var Ve=a.d3?a.d3:a.require?a.require("d3"):void 0,We={data:{},axis:{}},Xe={},Ye=h(["bindto"],"#chart"),Ze=h(["size","width"]),$e=h(["size","height"]),_e=h(["padding","left"]),af=h(["padding","right"]),bf=h(["zoom","enabled"],!1),cf=h(["zoom","extent"]),df=h(["zoom","privileged"],!1),ef=h(["onenter"],function(){}),ff=h(["onleave"],function(){}),gf=h(["transition","duration"],350);g("data","data is required in config");var 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,Rf,Sf=h(["data","x"]),Tf=h(["data","xs"],{}),Uf=h(["data","x_format"]),Vf=h(["data","id_converter"],function(a){return a}),Wf=h(["data","names"],{}),Xf=h(["data","groups"],[]),Yf=h(["data","axes"],{}),Zf=h(["data","type"]),$f=h(["data","types"],{}),_f=h(["data","labels"],{}),ag=h(["data","order"]),bg=h(["data","regions"],{}),cg=h(["data","color"]),dg=h(["data","colors"],{}),eg=h(["data","selection","enabled"],!1),fg=h(["data","selection","grouped"],!1),gg=h(["data","selection","isselectable"],function(){return!0}),hg=h(["data","selection","multiple"],!0),ig=h(["data","onclick"],function(){}),jg=h(["data","onenter"],function(){}),kg=h(["data","onleave"],function(){}),lg=h(["data","onselected"],function(){}),mg=h(["data","onunselected"],function(){}),ng=h(["data","ondragstart"],function(){}),og=h(["data","ondragend"],function(){}),pg=h(["subchart","show"],!1),qg=pg?h(["subchart","size","height"],60):0,rg=h(["color","pattern"],[]),sg=h(["legend","show"],!0),tg=h(["legend","position"],"bottom"),ug=h(["legend","item","onclick"]),vg=h(["legend","equally"],!1),wg=h(["axis","rotated"],!1),xg=h(["axis","x","type"],"indexed"),yg=h(["axis","x","categories"],[]),zg=h(["axis","x","tick","centered"],!1),Ag=h(["axis","x","tick","format"]),Bg=h(["axis","x","tick","culling"],{}),Cg=h(["axis","x","tick","culling","max"],"categorized"===xg?1/0:10),Dg=h(["axis","x","tick","count"]),Eg=h(["axis","x","tick","fit"],!1),Fg=h(["axis","x","max"]),Gg=h(["axis","x","min"]),Hg=h(["axis","x","default"]),Ig=h(["axis","x","label"],{}),Jg=h(["axis","y","show"],!0),Kg=h(["axis","y","max"]),Lg=h(["axis","y","min"]),Mg=h(["axis","y","center"]),Ng=h(["axis","y","label"],{}),Og=h(["axis","y","inner"],!1),Pg=h(["axis","y","tick","format"]),Qg=h(["axis","y","padding"],{}),Rg=h(["axis","y","ticks"],10),Sg=h(["axis","y2","show"],!1),Tg=h(["axis","y2","max"]),Ug=h(["axis","y2","min"]),Vg=h(["axis","y2","center"]),Wg=h(["axis","y2","label"],{}),Xg=h(["axis","y2","inner"],!1),Yg=h(["axis","y2","tick","format"]),Zg=h(["axis","y2","padding"],{}),$g=h(["axis","y2","ticks"],10),_g=h(["grid","x","show"],!1),ah=h(["grid","x","type"],"tick"),bh=h(["grid","x","lines"],[]),ch=h(["grid","y","show"],!1),dh=h(["grid","y","lines"],[]),eh=h(["grid","y","ticks"],10),fh=h(["point","show"],!0),gh=fh?h(["point","r"],2.5):0,hh=h(["point","focus","line","enabled"],!0),ih=h(["point","focus","expand","enabled"],!0),jh=h(["point","focus","expand","r"],ih?4:gh),kh=h(["point","focus","select","r"],8),lh=h(["bar","width"]),mh=h(["bar","width","ratio"],.6),nh=h(["pie","label","show"],!0),oh=h(["pie","label","format"]),ph=h(["pie","onclick"],function(){}),qh=h(["pie","onmouseover"],function(){}),rh=h(["pie","onmouseout"],function(){}),sh=h(["donut","label","show"],!0),th=h(["donut","label","format"]),uh=h(["donut","title"],""),vh=h(["donut","onclick"],function(){}),wh=h(["donut","onmouseover"],function(){}),xh=h(["donut","onmouseout"],function(){}),yh=h(["regions"],[]),zh=h(["tooltip","show"],!0),Ah=h(["tooltip","format","title"]),Bh=h(["tooltip","format","value"]),Ch=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Ah?Ah:b,l=Bh?Bh: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+""}),Dh=h(["tooltip","init","show"],!1),Eh=h(["tooltip","init","x"],0),Fh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Gh=("string"==typeof Ye?Ye.replace("#",""):Ye.id)+"-clip",Hh=Gh+"-xaxis",Ih=Gh+"-yaxis",Jh=i(Gh),Kh=i(Kh),Lh=i(Lh),Mh="timeseries"===xg,Nh="categorized"===xg,Oh=!Mh&&(Sf||$d(Tf)),Ph=null,Qh=!1,Rh=!1,Sh=!1,Th=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Uh=Vd(dg,$d(rg)?rg:Th,cg),Vh=function(){var a=[[Ve.time.format("%Y/%-m/%-d"),function(){return!0}],[Ve.time.format("%-m/%-d"),function(a){return a.getMonth()}],[Ve.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ve.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ve.time.format("%I %p"),function(a){return a.getHours()}],[Ve.time.format("%I:%M"),function(a){return a.getMinutes()}],[Ve.time.format(":%S"),function(a){return a.getSeconds()}],[Ve.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)}}(),Wh=[],Xh=wg?"left":"bottom",Yh=wg?Og?"top":"bottom":Og?"right":"left",Zh=wg?Xg?"bottom":"top":Xg?"left":"right",$h=wg?"left":"bottom",_h={main:function(){return"translate("+hf.left+","+hf.top+")"},context:function(){return"translate("+jf.left+","+jf.top+")"},legend:function(){return"translate("+kf.left+","+kf.top+")"},x:function(){return"translate(0,"+(wg?0:nf)+")"},y:function(){return"translate(0,"+(wg?nf:0)+")"},y2:function(){return"translate("+(wg?0:lf)+","+(wg?1:0)+")"},subx:function(){return"translate(0,"+(wg?0:of)+")"},arc:function(){return"translate("+lf/2+","+nf/2+")"}},ai="right"===tg,bi=0,ci=0,di=0,ei=30,fi=30,gi=5;zf=Ve.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var hi,ii=function(){var a=Ve.svg.line().x(wg?function(a){return V(a.id)(a.value)}:gd).y(wg?gd:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=ie(b.values);return Ld(b)?(a.interpolate(Md(b)?"cardinal":"linear"),bg[b.id]?ue(e,If,V(b.id),bg[b.id]):a(e)):(c=If(e[0].x),d=V(b.id)(e[0].value),wg?"M "+d+" "+c:"M "+c+" "+d)}}(),ji=function(){var a;return a=wg?Ve.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(gd):Ve.svg.area().x(gd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=ie(b.values);return Fd([b],"area")||Fd([b],"area-spline")?(a.interpolate(Md(b)?"cardinal":"linear"),a(e)):(c=If(e[0].x),d=V(b.id)(e[0].value),wg?"M "+d+" "+c:"M "+c+" "+d)}}(),ki=function(){var a=Ve.svg.line().x(wg?function(a){return W(a.id)(a.value)}:jd).y(wg?jd:function(a){return W(a.id)(a.value)});return function(b){var c=ie(b.values);return Ld(b)?a(c):"M "+Lf(c[0].x)+" "+W(b.id)(c[0].value)}}(),li=function(){};hi=Ve.svg.brush().on("brush",De),hi.update=function(){return pi&&pi.select("."+f.brush).call(this),this},hi.scale=function(a){return wg?this.y(a):this.x(a)},bf&&(li=Ve.behavior.zoom().on("zoomstart",function(){li.altDomain=Ve.event.sourceEvent.altKey?If.orgDomain():null}).on("zoom",bf?Ee:null),li.scale=function(a){return wg?this.y(a):this.x(a)},li.orgScaleExtent=function(){var a=cf?cf:[1,10];return[a[0],Math.max(tc()/a[1],a[1])]},li.updateScaleExtent=function(){var a=$b(If.orgDomain())/$b(ti),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var mi,ni,oi,pi,qi,ri,si,ti,ui,vi={};if(We.focus=function(a){function b(a){zc(a).transition().duration(100).style("opacity",1)}var c=mi.selectAll(Yc(a)),d=c.filter(Re),e=c.filter(Se);We.revert(),We.defocus(),b(d.classed(f.focused,!0)),b(e),Kd(We.data.targets)&&Kb(a,!0),Ne(a)},We.defocus=function(a){function b(a){zc(a).transition().duration(100).style("opacity",.3)}var c=mi.selectAll(Yc(a)),d=c.filter(Re),e=c.filter(Se);We.revert(),b(d.classed(f.focused,!1)),b(e),Kd(We.data.targets)&&Lb(a),Oe(a)},We.revert=function(a){function b(a){zc(a).transition().duration(100).style("opacity",1)}var c=mi.selectAll(Yc(a)),d=c.filter(Re),e=c.filter(Se);b(d.classed(f.focused,!1)),b(e),Kd(We.data.targets)&&Lb(a),Pe()},We.show=function(a){Dc(a),mi.selectAll(Yc(a)).transition().style("opacity",1),Ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!1})},We.hide=function(a){Cc(a),mi.selectAll(Yc(a)).transition().style("opacity",0),Ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!1})},We.toggle=function(a){yc(a)?We.hide(a):We.show(a)},We.unzoom=function(){hi.clear().update(),Ce({withUpdateXDomain:!0})},We.load=function(a){return a.xs&&ic(a.xs),"categories"in a&&Nh&&(yg=a.categories,Of.categories(yg)),"cacheIds"in a&&_b(a.cacheIds)?void Je(bc(a.cacheIds),a.done):void("unload"in a?Le("string"==typeof a.unload?[a.unload]:"boolean"==typeof a.unload&&a.unload?vc():a.unload,function(){Ke(a)}):Ke(a))},We.unload=function(a){Le(a?"string"==typeof a?[a]:a:vc(),function(){Ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},We.selected=function(a){return Ve.merge(oi.selectAll("."+f.shapes+Xc(a)).selectAll("."+f.shape).filter(function(){return Ve.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},We.select=function(a,b,c){eg&&oi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=Ve.select(this),i="circle"===this.nodeName?ce:fe,j="circle"===this.nodeName?de:ge,k=fg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?gg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},We.unselect=function(a,b){eg&&oi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=Ve.select(this),g="circle"===this.nodeName?de:ge,h=fg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&gg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},We.toLine=function(a){Ue(a,"line")},We.toSpline=function(a){Ue(a,"spline")},We.toBar=function(a){Ue(a,"bar")},We.toScatter=function(a){Ue(a,"scatter")},We.toArea=function(a){Ue(a,"area")},We.toAreaSpline=function(a){Ue(a,"area-spline")},We.toPie=function(a){Ue(a,"pie",{withTransform:!0})},We.toDonut=function(a){Ue(a,"donut",{withTransform:!0})},We.groups=function(a){return c(a)?Xf:(Xf=a,Ce(),Xf)},We.xgrids=function(a){return a?(bh=a,Ce(),bh):bh},We.xgrids.add=function(a){return a?We.xgrids(bh.concat(a)):void 0},We.xgrids.remove=function(a){var b=Te(a);return We.xgrids(bh.filter(b))},We.ygrids=function(a){return a?(dh=a,Ce(),dh):dh},We.ygrids.add=function(a){return a?We.ygrids(dh.concat(a)):void 0},We.ygrids.remove=function(a){var b=Te(a);return We.ygrids(dh.filter(b))},We.regions=function(a){return c(a)?yh:(yh=a,Ce(),yh)},We.regions.add=function(a){return c(a)?yh:(yh=yh.concat(a),Ce(),yh)},We.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;mi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),yh=yh.filter(function(b){return b.classes.indexOf(a)<0})}),yh},We.data.get=function(a){var b=We.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},We.data.getAsTarget=function(a){var b=xc(function(b){return b.id===a});return b.length>0?b[0]:void 0},We.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Wf[b]=a[b]}),Qe(We.data.targets,{withTransition:!0}),Wf):Wf},We.x=function(a){return arguments.length&&(kc(We.data.targets,a),Ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),We.data.x},We.xs=function(a){return arguments.length&&(lc(We.data.targets,a),Ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),We.data.x},We.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},We.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Kg=+a.y),b(a.y2)&&(Tg=+a.y2)):Kg=Tg=+a,Ce())},We.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Lg=+a.y),b(a.y2)&&(Ug=+a.y2)):Lg=Ug=+a,Ce())},We.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&We.axis.max(a.max),"undefined"!=typeof a.min&&We.axis.min(a.min))},We.resize=function(a){Ze=a?a.width:null,$e=a?a.height:null,He({withLegend:!0,withTransition:!1})},We.destroy=function(){We.data.targets=void 0,We.data.x={},si.html(""),a.onresize=null},"url"in e.data)Ve.csv(e.data.url,function(a,b){ve(b)});else if("rows"in e.data)ve(nc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");ve(oc(e.data.columns))}return We},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file +});if(Object.keys(Wf).length>0){d=[];for(var g in Wf)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=pd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=he,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 Ae(a){Kd(We.data.targets)||eg&&(Ph=a,oi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Qh=!0,ng())}function Be(){Kd(We.data.targets)||eg&&(oi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),oi.selectAll("."+f.shape).classed(f.INCLUDED,!1),Qh=!1,og())}function Ce(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P=zd(),Q=Kd(We.data.targets),R=zc(We.data.targets);if(0!==R.length){if(a=d(a)?a:{},v=d(a.withY)?a.withY:!0,w=d(a.withSubchart)?a.withSubchart:!0,x=d(a.withTransition)?a.withTransition:!0,A=d(a.withTransform)?a.withTransform:!1,B=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,C=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,D=d(a.withLegend)?a.withLegend:!1,y=d(a.withTransitionForExit)?a.withTransitionForExit:x,z=d(a.withTransitionForAxis)?a.withTransitionForAxis:x,I=x?gf:0,J=y?I:0,K=z?I:0,D&&sg&&Qe(We.data.targets,a),C&&(If.domain(Ve.extent(Zb(R))),ti=If.domain(),bf&&li.scale(If).updateScaleExtent(),Lf.domain(If.domain()),hi.scale(Lf)),B&&(If.domain(hi.empty()?ti:hi.extent()),bf&&li.scale(If).updateScaleExtent(),Hd(R)||(M=Bc(Ac(R)).sort(),Of.tickValues(M),Rf.tickValues(M))),Jf.domain(Ub(R,"y")),Kf.domain(Ub(R,"y2")),oi.select("."+f.axisX).style("opacity",Q?0:1).transition().duration(K).call(Of),oi.select("."+f.axisY).style("opacity",Q?0:1).transition().duration(K).call(Pf),oi.select("."+f.axisY2).style("opacity",Q?0:1).transition().duration(K).call(Qf),B&&Bg&&M){for(N=1;N=V;V++)e.push(new Date(V+"-01-01 00:00:00"))}else e=If.ticks(10);c=oi.select("."+f.xgrids).selectAll("."+f.xgrid).data(e),c.enter().append("line").attr("class",f.xgrid),c.attr("x1",wg?0:function(a){return If(a)-Of.tickOffset()}).attr("x2",wg?lf:function(a){return If(a)-Of.tickOffset()}).attr("y1",wg?function(a){return If(a)-Of.tickOffset()}:hf.top).attr("y2",wg?function(a){return If(a)-Of.tickOffset()}:nf).style("opacity",function(){return+Ve.select(this).attr(wg?"y1":"x1")===(wg?nf:0)?0:1}),c.exit().remove()}$d(bh)&&(g=oi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(bh),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",wg?"":"rotate(-90)").attr("dx",wg?0:-hf.top).attr("dy",-5).style("opacity",0),g.select("line").transition().duration(I).attr("x1",wg?0:hd).attr("x2",wg?lf:hd).attr("y1",wg?hd:hf.top).attr("y2",wg?hd:nf).style("opacity",1),g.select("text").transition().duration(I).attr("x",wg?lf:0).attr("y",hd).text(function(a){return a.text}).style("opacity",1),g.exit().transition().duration(I).style("opacity",0).remove()),v&&ch&&(i=oi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Jf.ticks(eh)),i.enter().append("line").attr("class",f.ygrid),i.attr("x1",wg?Jf:0).attr("x2",wg?Jf:lf).attr("y1",wg?0:Jf).attr("y2",wg?nf:Jf),i.exit().remove()),v&&$d(dh)&&(j=oi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(dh),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",wg?"rotate(-90)":"").attr("dx",wg?0:-hf.top).attr("dy",-5).style("opacity",0),j.select("line").transition().duration(I).attr("x1",wg?id:0).attr("x2",wg?id:lf).attr("y1",wg?0:id).attr("y2",wg?nf:id).style("opacity",1),j.select("text").transition().duration(I).attr("x",wg?0:lf).attr("y",id).text(function(a){return a.text}).style("opacity",1),j.exit().transition().duration(I).style("opacity",0).remove()),m=oi.selectAll("."+f.bars).selectAll("."+f.bar).data(Sd),m.enter().append("path").attr("d",E).style("stroke","none").style("opacity",0).style("fill",function(a){return Uh(a)}).attr("class",Rc),m.style("opacity",Zc).transition().duration(I).attr("d",E).style("opacity",1),m.exit().transition().duration(J).style("opacity",0).remove(),p=oi.selectAll("."+f.texts).selectAll("."+f.text).data(Ud),p.enter().append("text").attr("class",Kc).attr("text-anchor",function(a){return wg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),p.text(function(a){return fd(a.id)(a.value)}).style("fill-opacity",$c).transition().duration(I).attr("x",G).attr("y",H).style("fill-opacity",ad),p.exit().transition().duration(J).style("fill-opacity",0).remove(),oi.selectAll("."+f.line).style("opacity",Zc).transition().duration(I).attr("d",ii).style("opacity",1),oi.selectAll("."+f.area).style("opacity",0).transition().duration(I).attr("d",ji).style("opacity",ui),l=oi.selectAll("."+f.circles).selectAll("."+f.circle).data(Td),l.enter().append("circle").attr("class",Pc).style("opacity",0).attr("r",gh),l.style("opacity",Zc).transition().duration(I).style("opacity",_c).attr("cx",wg?yd:xd).attr("cy",wg?xd:yd),l.exit().remove(),oi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",A?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(I).attrTween("d",function(a){var b,c=Cb(a);return c?(b=Ve.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",A?"scale(1)":"").style("opacity",1),oi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(I).text(Jb).style("opacity",function(a){return yc(a.data.id)&&Rd(a.data)?1:0}),oi.select("."+f.chartArcsTitle).style("opacity",Jd(We.data.targets)?1:0),pg&&(null!==Ve.event&&"zoom"===Ve.event.type&&hi.extent(If.orgDomain()).update(),w&&(pi.select("."+f.axisX).style("opacity",Q?0:1).transition().duration(I).call(Rf),hi.empty()||hi.extent(If.orgDomain()).update(),F=pe(P,!0),q=pi.selectAll("."+f.bars).selectAll("."+f.bar).data(Sd),q.enter().append("path").attr("d",F).style("stroke","none").style("fill",function(a){return Uh(a)}).attr("class",Rc),q.style("opacity",Zc).transition().duration(I).attr("d",F).style("opacity",1),q.exit().transition().duration(I).style("opacity",0).remove(),pi.selectAll("."+f.line).style("opacity",Zc).transition().duration(I).attr("d",ki).style("opacity",1))),oi.selectAll("."+f.selectedCircles).filter(function(a){return Nd(a)}).selectAll("circle").remove(),oi.selectAll("."+f.selectedCircle).transition().duration(I).attr("cx",wg?yd:xd).attr("cy",wg?xd:yd),$d(Tf)?(r=oi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),xe(r.enter()),r.attr("x",0).attr("y",0).attr("width",lf).attr("height",nf)):(Oh&&!Nh?(u=function(a,b){var c=rc(b),d=sc(b),e=We.data.x[a.id][b];return(If(d?d:e+50)-If(c?c:e-50))/2},t=function(a,b){var c=rc(b),d=We.data.x[a.id][b];return(If(d)+If(c?c:d-50))/2}):(u=L(),t=function(a){return If(a.x)-u/2}),s=uc(),oi.select("."+f.eventRects).datum(s?s.values:[]),r=oi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),we(r.enter()),r.attr("class",Wc).attr("x",wg?0:t).attr("y",wg?t:0).attr("width",wg?lf:u).attr("height",wg?u:nf),r.exit().remove()),n=oi.select("."+f.regions).selectAll("rect."+f.region).data(yh),n.enter().append("rect").style("fill-opacity",0),n.attr("class",Vc).attr("x",wg?0:cc).attr("y",wg?cc:hf.top).attr("width",wg?lf:dc).attr("height",wg?dc:nf).transition().duration(I).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),n.exit().transition().duration(I).style("fill-opacity",0).remove(),vc().forEach(function(a){vi[a]=!0})}}function De(){Ce({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ee(){return"mousemove"===Ve.event.sourceEvent.type&&li.altDomain?(If.domain(li.altDomain),void li.scale(If).updateScaleExtent()):(Nh&&If.orgDomain()[0]===ti[0]&&If.domain([ti[0]-1e-10,If.orgDomain()[1]]),Ce({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Ve.event.sourceEvent.type&&(Rh=!0)))}function Fe(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ge(){mi.attr("width",pf).attr("height",qf),mi.select("#"+Gh).select("rect").attr("width",lf).attr("height",nf),mi.select("#"+Hh).select("rect").attr("width",H),mi.select("#"+Ih).select("rect").attr("width",J),mi.select("."+f.zoomRect).attr("width",lf).attr("height",nf)}function He(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(),R(),Ge(),m(a.withTransition),Ce(a)}function Ie(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=oi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a),j=i.enter().append("g").attr("class",function(a){return f.chartText+Jc(f.target,a.id)}).style("pointer-events","none"),j.append("g").attr("class",Lc).style("fill",function(a){return Uh(a)}),e=oi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),d=e.enter().append("g").attr("class",function(a){return f.chartBar+Jc(f.target,a.id)}).style("pointer-events","none"),d.append("g").attr("class",Sc).style("fill",function(a){return Uh(a)}).style("stroke","none").style("cursor",function(a){return gg(a)?"pointer":null}),c=oi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),b=c.enter().append("g").attr("class",function(a){return f.chartLine+Jc(f.target,a.id)}).style("pointer-events","none"),b.append("path").attr("class",Oc).style("opacity",0).style("stroke",function(a){return Uh(a)}),b.append("path").attr("class",Uc).style("opacity",function(){return ui=+Ve.select(this).style("opacity"),0}).style("fill",function(a){return Uh(a)}),b.append("g").attr("class",function(a){return Jc(f.selectedCircles,a.id)}),b.append("g").attr("class",Qc).style("fill",function(a){return Uh(a)}).style("cursor",function(a){return gg(a)?"pointer":null}),a.forEach(function(a){oi.selectAll("."+f.selectedCircles+Xc(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=oi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(zf(a)),g=h.enter().append("g").attr("class",function(a){return f.chartArc+Jc(f.target,a.data.id)}),g.append("path").attr("class",Tc).style("opacity",0).style("fill",function(a){return Uh(a.data)}).style("cursor",function(a){return gg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),Ne(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];td(c,Ve.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),Pe(),ud(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),pg&&(n=pi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),m=n.enter().append("g").attr("class",function(a){return f.chartBar+Jc(f.target,a.id)}),m.append("g").attr("class",Sc).style("fill",function(a){return Uh(a)}),l=pi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),k=l.enter().append("g").attr("class",function(a){return f.chartLine+Jc(f.target,a.id)}),k.append("path").attr("class",Oc).style("opacity",0).style("stroke",function(a){return Uh(a)})),mi.selectAll("."+f.target).filter(function(a){return yc(a.id)}).transition().style("opacity",1)}function Je(a,b){We.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=ai?i:h,k=ai?rf:sf;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=ai?u:t,vg?(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=vc(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,ai?(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=qi.selectAll("."+f.legendItem).data(q).enter().append("g").attr("class",function(a){return Jc(f.legendItem,a)}).style("cursor","pointer").on("click",function(a){"function"==typeof ug?ug(a):We.toggle(a)}).on("mouseover",function(a){We.focus(a)}).on("mouseout",function(){We.revert()}),g.append("text").text(function(a){return d(Wf[a])?Wf[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",ai?i:-200).attr("y",ai?-200:l),g.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",ai?j:-200).attr("y",ai?-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 Uh(a)}).attr("x",ai?i:-200).attr("y",ai?-200:k).attr("width",10).attr("height",10),qi.selectAll("text").data(q).text(function(a){return d(Wf[a])?Wf[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",i).attr("y",l),qi.selectAll("rect."+f.legendItemEvent).data(q).transition().duration(p?250:0).attr("x",j).attr("y",o),qi.selectAll("rect."+f.legendItemTile).data(q).transition().duration(p?250:0).attr("x",h).attr("y",k),N(t),O(u),M(C),n(),R(),Ge(),m(!1)}function Re(a){return wc(a.id)}function Se(a){return"data"in a&&wc(a.data.id)}function Te(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 Ue(a,b,c){var d=!Kd(We.data.targets);Ed(a,b),He(c?c:{withTransitionForAxis:d})}var Ve=a.d3?a.d3:a.require?a.require("d3"):void 0,We={data:{},axis:{}},Xe={},Ye=h(["bindto"],"#chart"),Ze=h(["size","width"]),$e=h(["size","height"]),_e=h(["padding","left"]),af=h(["padding","right"]),bf=h(["zoom","enabled"],!1),cf=h(["zoom","extent"]),df=h(["zoom","privileged"],!1),ef=h(["onenter"],function(){}),ff=h(["onleave"],function(){}),gf=h(["transition","duration"],350);g("data","data is required in config");var 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,Rf,Sf=h(["data","x"]),Tf=h(["data","xs"],{}),Uf=h(["data","x_format"]),Vf=h(["data","id_converter"],function(a){return a}),Wf=h(["data","names"],{}),Xf=h(["data","groups"],[]),Yf=h(["data","axes"],{}),Zf=h(["data","type"]),$f=h(["data","types"],{}),_f=h(["data","labels"],{}),ag=h(["data","order"]),bg=h(["data","regions"],{}),cg=h(["data","color"]),dg=h(["data","colors"],{}),eg=h(["data","selection","enabled"],!1),fg=h(["data","selection","grouped"],!1),gg=h(["data","selection","isselectable"],function(){return!0}),hg=h(["data","selection","multiple"],!0),ig=h(["data","onclick"],function(){}),jg=h(["data","onenter"],function(){}),kg=h(["data","onleave"],function(){}),lg=h(["data","onselected"],function(){}),mg=h(["data","onunselected"],function(){}),ng=h(["data","ondragstart"],function(){}),og=h(["data","ondragend"],function(){}),pg=h(["subchart","show"],!1),qg=pg?h(["subchart","size","height"],60):0,rg=h(["color","pattern"],[]),sg=h(["legend","show"],!0),tg=h(["legend","position"],"bottom"),ug=h(["legend","item","onclick"]),vg=h(["legend","equally"],!1),wg=h(["axis","rotated"],!1),xg=h(["axis","x","type"],"indexed"),yg=h(["axis","x","categories"],[]),zg=h(["axis","x","tick","centered"],!1),Ag=h(["axis","x","tick","format"]),Bg=h(["axis","x","tick","culling"],{}),Cg=h(["axis","x","tick","culling","max"],"categorized"===xg?1/0:10),Dg=h(["axis","x","tick","count"]),Eg=h(["axis","x","tick","fit"],!1),Fg=h(["axis","x","max"]),Gg=h(["axis","x","min"]),Hg=h(["axis","x","default"]),Ig=h(["axis","x","label"],{}),Jg=h(["axis","y","show"],!0),Kg=h(["axis","y","max"]),Lg=h(["axis","y","min"]),Mg=h(["axis","y","center"]),Ng=h(["axis","y","label"],{}),Og=h(["axis","y","inner"],!1),Pg=h(["axis","y","tick","format"]),Qg=h(["axis","y","padding"],{}),Rg=h(["axis","y","ticks"],10),Sg=h(["axis","y2","show"],!1),Tg=h(["axis","y2","max"]),Ug=h(["axis","y2","min"]),Vg=h(["axis","y2","center"]),Wg=h(["axis","y2","label"],{}),Xg=h(["axis","y2","inner"],!1),Yg=h(["axis","y2","tick","format"]),Zg=h(["axis","y2","padding"],{}),$g=h(["axis","y2","ticks"],10),_g=h(["grid","x","show"],!1),ah=h(["grid","x","type"],"tick"),bh=h(["grid","x","lines"],[]),ch=h(["grid","y","show"],!1),dh=h(["grid","y","lines"],[]),eh=h(["grid","y","ticks"],10),fh=h(["point","show"],!0),gh=fh?h(["point","r"],2.5):0,hh=h(["point","focus","line","enabled"],!0),ih=h(["point","focus","expand","enabled"],!0),jh=h(["point","focus","expand","r"],ih?4:gh),kh=h(["point","focus","select","r"],8),lh=h(["bar","width"]),mh=h(["bar","width","ratio"],.6),nh=h(["pie","label","show"],!0),oh=h(["pie","label","format"]),ph=h(["pie","onclick"],function(){}),qh=h(["pie","onmouseover"],function(){}),rh=h(["pie","onmouseout"],function(){}),sh=h(["donut","label","show"],!0),th=h(["donut","label","format"]),uh=h(["donut","title"],""),vh=h(["donut","onclick"],function(){}),wh=h(["donut","onmouseover"],function(){}),xh=h(["donut","onmouseout"],function(){}),yh=h(["regions"],[]),zh=h(["tooltip","show"],!0),Ah=h(["tooltip","format","title"]),Bh=h(["tooltip","format","value"]),Ch=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Ah?Ah:b,l=Bh?Bh: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+""}),Dh=h(["tooltip","init","show"],!1),Eh=h(["tooltip","init","x"],0),Fh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Gh=("string"==typeof Ye?Ye.replace("#",""):Ye.id)+"-clip",Hh=Gh+"-xaxis",Ih=Gh+"-yaxis",Jh=i(Gh),Kh=i(Kh),Lh=i(Lh),Mh="timeseries"===xg,Nh="categorized"===xg,Oh=!Mh&&(Sf||$d(Tf)),Ph=null,Qh=!1,Rh=!1,Sh=!1,Th=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Uh=Vd(dg,$d(rg)?rg:Th,cg),Vh=function(){var a=[[Ve.time.format("%Y/%-m/%-d"),function(){return!0}],[Ve.time.format("%-m/%-d"),function(a){return a.getMonth()}],[Ve.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ve.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ve.time.format("%I %p"),function(a){return a.getHours()}],[Ve.time.format("%I:%M"),function(a){return a.getMinutes()}],[Ve.time.format(":%S"),function(a){return a.getSeconds()}],[Ve.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)}}(),Wh=[],Xh=wg?"left":"bottom",Yh=wg?Og?"top":"bottom":Og?"right":"left",Zh=wg?Xg?"bottom":"top":Xg?"left":"right",$h=wg?"left":"bottom",_h={main:function(){return"translate("+hf.left+","+hf.top+")"},context:function(){return"translate("+jf.left+","+jf.top+")"},legend:function(){return"translate("+kf.left+","+kf.top+")"},x:function(){return"translate(0,"+(wg?0:nf)+")"},y:function(){return"translate(0,"+(wg?nf:0)+")"},y2:function(){return"translate("+(wg?0:lf)+","+(wg?1:0)+")"},subx:function(){return"translate(0,"+(wg?0:of)+")"},arc:function(){return"translate("+lf/2+","+nf/2+")"}},ai="right"===tg,bi=0,ci=0,di=0,ei=30,fi=30,gi=5;zf=Ve.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var hi,ii=function(){var a=Ve.svg.line().x(wg?function(a){return V(a.id)(a.value)}:gd).y(wg?gd:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=ie(b.values);return Ld(b)?(a.interpolate(Md(b)?"cardinal":"linear"),bg[b.id]?ue(e,If,V(b.id),bg[b.id]):a(e)):(c=If(e[0].x),d=V(b.id)(e[0].value),wg?"M "+d+" "+c:"M "+c+" "+d)}}(),ji=function(){var a;return a=wg?Ve.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(gd):Ve.svg.area().x(gd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=ie(b.values);return Fd([b],"area")||Fd([b],"area-spline")?(a.interpolate(Md(b)?"cardinal":"linear"),a(e)):(c=If(e[0].x),d=V(b.id)(e[0].value),wg?"M "+d+" "+c:"M "+c+" "+d)}}(),ki=function(){var a=Ve.svg.line().x(wg?function(a){return W(a.id)(a.value)}:jd).y(wg?jd:function(a){return W(a.id)(a.value)});return function(b){var c=ie(b.values);return Ld(b)?a(c):"M "+Lf(c[0].x)+" "+W(b.id)(c[0].value)}}(),li=function(){};hi=Ve.svg.brush().on("brush",De),hi.update=function(){return pi&&pi.select("."+f.brush).call(this),this},hi.scale=function(a){return wg?this.y(a):this.x(a)},bf&&(li=Ve.behavior.zoom().on("zoomstart",function(){li.altDomain=Ve.event.sourceEvent.altKey?If.orgDomain():null}).on("zoom",bf?Ee:null),li.scale=function(a){return wg?this.y(a):this.x(a)},li.orgScaleExtent=function(){var a=cf?cf:[1,10];return[a[0],Math.max(tc()/a[1],a[1])]},li.updateScaleExtent=function(){var a=$b(If.orgDomain())/$b(ti),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var mi,ni,oi,pi,qi,ri,si,ti,ui,vi={};if(We.focus=function(a){function b(a){zc(a).transition().duration(100).style("opacity",1)}var c=mi.selectAll(Yc(a)),d=c.filter(Re),e=c.filter(Se);We.revert(),We.defocus(),b(d.classed(f.focused,!0)),b(e),Kd(We.data.targets)&&Kb(a,!0),Ne(a)},We.defocus=function(a){function b(a){zc(a).transition().duration(100).style("opacity",.3)}var c=mi.selectAll(Yc(a)),d=c.filter(Re),e=c.filter(Se);We.revert(),b(d.classed(f.focused,!1)),b(e),Kd(We.data.targets)&&Lb(a),Oe(a)},We.revert=function(a){function b(a){zc(a).transition().duration(100).style("opacity",1)}var c=mi.selectAll(Yc(a)),d=c.filter(Re),e=c.filter(Se);b(d.classed(f.focused,!1)),b(e),Kd(We.data.targets)&&Lb(a),Pe()},We.show=function(a){Dc(a),mi.selectAll(Yc(a)).transition().style("opacity",1),Ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!1})},We.hide=function(a){Cc(a),mi.selectAll(Yc(a)).transition().style("opacity",0),Ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!1})},We.toggle=function(a){yc(a)?We.hide(a):We.show(a)},We.unzoom=function(){hi.clear().update(),Ce({withUpdateXDomain:!0})},We.load=function(a){return a.xs&&ic(a.xs),"categories"in a&&Nh&&(yg=a.categories,Of.categories(yg)),"cacheIds"in a&&_b(a.cacheIds)?void Je(bc(a.cacheIds),a.done):void("unload"in a?Le("string"==typeof a.unload?[a.unload]:"boolean"==typeof a.unload&&a.unload?vc():a.unload,function(){Ke(a)}):Ke(a))},We.unload=function(a){Le(a?"string"==typeof a?[a]:a:vc(),function(){Ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},We.selected=function(a){return Ve.merge(oi.selectAll("."+f.shapes+Xc(a)).selectAll("."+f.shape).filter(function(){return Ve.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},We.select=function(a,b,c){eg&&oi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=Ve.select(this),i="circle"===this.nodeName?ce:fe,j="circle"===this.nodeName?de:ge,k=fg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?gg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},We.unselect=function(a,b){eg&&oi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=Ve.select(this),g="circle"===this.nodeName?de:ge,h=fg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&gg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},We.toLine=function(a){Ue(a,"line")},We.toSpline=function(a){Ue(a,"spline")},We.toBar=function(a){Ue(a,"bar")},We.toScatter=function(a){Ue(a,"scatter")},We.toArea=function(a){Ue(a,"area")},We.toAreaSpline=function(a){Ue(a,"area-spline")},We.toPie=function(a){Ue(a,"pie",{withTransform:!0})},We.toDonut=function(a){Ue(a,"donut",{withTransform:!0})},We.groups=function(a){return c(a)?Xf:(Xf=a,Ce(),Xf)},We.xgrids=function(a){return a?(bh=a,Ce(),bh):bh},We.xgrids.add=function(a){return a?We.xgrids(bh.concat(a)):void 0},We.xgrids.remove=function(a){var b=Te(a);return We.xgrids(bh.filter(b))},We.ygrids=function(a){return a?(dh=a,Ce(),dh):dh},We.ygrids.add=function(a){return a?We.ygrids(dh.concat(a)):void 0},We.ygrids.remove=function(a){var b=Te(a);return We.ygrids(dh.filter(b))},We.regions=function(a){return c(a)?yh:(yh=a,Ce(),yh)},We.regions.add=function(a){return c(a)?yh:(yh=yh.concat(a),Ce(),yh)},We.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;mi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),yh=yh.filter(function(b){return b.classes.indexOf(a)<0})}),yh},We.data.get=function(a){var b=We.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},We.data.getAsTarget=function(a){var b=xc(function(b){return b.id===a});return b.length>0?b[0]:void 0},We.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Wf[b]=a[b]}),Qe(We.data.targets,{withTransition:!0}),Wf):Wf},We.x=function(a){return arguments.length&&(kc(We.data.targets,a),Ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),We.data.x},We.xs=function(a){return arguments.length&&(lc(We.data.targets,a),Ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),We.data.x},We.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},We.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Kg=+a.y),b(a.y2)&&(Tg=+a.y2)):Kg=Tg=+a,Ce())},We.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Lg=+a.y),b(a.y2)&&(Ug=+a.y2)):Lg=Ug=+a,Ce())},We.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&We.axis.max(a.max),"undefined"!=typeof a.min&&We.axis.min(a.min))},We.resize=function(a){Ze=a?a.width:null,$e=a?a.height:null,He({withLegend:!0,withTransition:!1})},We.destroy=function(){We.data.targets=void 0,We.data.x={},si.html(""),a.onresize=null},"url"in e.data)Ve.csv(e.data.url,function(a,b){ve(b)});else if("rows"in e.data)ve(nc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");ve(oc(e.data.columns))}return We},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 8fd122c457f216b27f0def133ba5c9e39e6dcfc8 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Sun, 6 Apr 2014 18:29:07 +0900 Subject: [PATCH 011/178] Fix rotated when multiple xs --- c3.js | 8 +++++--- c3.min.js | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/c3.js b/c3.js index f37f43f..d1f90cd 100644 --- a/c3.js +++ b/c3.js @@ -1633,7 +1633,7 @@ max = _max ? _max : values.length - 1, med = Math.floor((max - min) / 2) + min, value = values[med], - diff = x(value.x) - pos[0], + diff = x(value.x) - pos[__axis_rotated ? 1 : 0], candidates; // Update range for search @@ -1992,8 +1992,10 @@ } function dist(data, pos) { - var yScale = getAxisId(data.id) === 'y' ? y : y2; - return Math.pow(x(data.x) - pos[0], 2) + Math.pow(yScale(data.value) - pos[1], 2); + var yScale = getAxisId(data.id) === 'y' ? y : y2, + xIndex = __axis_rotated ? 1 : 0, + yIndex = __axis_rotated ? 0 : 1; + return Math.pow(x(data.x) - pos[xIndex], 2) + Math.pow(yScale(data.value) - pos[yIndex], 2); } function endall(transition, callback) { diff --git a/c3.min.js b/c3.min.js index 3d55dcb..0eb62e7 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.28"},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;clf&&(lf=0),0>nf&&(nf=0),jf={top:wg?hf.top:qf-qg-(ai?0:rf),right:0/0,bottom:20+(ai?0:rf),left:wg?ei:hf.left},mf=wg?hf.left-ei-fi:lf,of=wg?nf:qf-jf.top-jf.bottom,0>mf&&(mf=0),0>of&&(of=0),kf={top:ai?0:qf-rf,right:0/0,bottom:0,left:ai?pf-sf:0},p(),ai&&Kd(We.data.targets)&&(kf.left=lf/2+uf)}function o(){oi.select("line."+f.xgridFocus).attr("x1",wg?0:-10).attr("x2",wg?lf:-10).attr("y1",wg?-10:hf.top).attr("y2",wg?-10:nf)}function p(){uf=nf/2,tf=.95*uf,vf=Jd(We.data.targets)?.6*tf:0}function q(){var a=wg?f.axisX:f.axisY,b=Ve.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Ve.select(Ye).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Ze?Ze:x()}function s(){var a=$e?$e:y();return a>0?a:320}function t(){return Kd(We.data.targets)?0:_e?_e:wg||!Jg||Og?1:v("y")}function u(){var a=1;return Kd(We.data.targets)?0:af?af:ai?sf+(Sg&&!wg?v("y2"):a):Sg?Xg||wg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||Jg?"y2"!==a||Sg?(gb(a).isInner?30:40)+("y2"===a?-10:0):gi:sg&&!ai?10:1}function x(){return+Ve.select(Ye).style("width").replace("px","")}function y(){return+Ve.select(Ye).style("height").replace("px","")}function z(a){return a?-5:-(hf.left-1)}function A(a){return a?-20:-1}function B(){return z(!wg)}function C(){return A(!wg)}function D(){return z(wg)}function E(){return A(wg)}function F(a){return a?lf+2+4:hf.left+20}function G(a){return a?80:nf+2}function H(){return F(!wg)}function I(){return G(!wg)}function J(){return F(wg)}function K(){return G(wg)}function L(){var a=wg?nf:lf,b=tc(),c=Vb()*(Gd(We.data.targets)?(b-(Nh?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){bi=a}function N(a){ci=a}function O(a){di=a}function P(){return sg?ai?ci*(bi+1):pf:0}function Q(){return sg?ai?qf:di*(bi+1):0}function R(){var a,b=!If;Af=wg?1:0,Bf=wg?nf:lf,Cf=wg?0:nf,Df=wg?lf:1,Ef=Af,Ff=Bf,Gf=wg?0:of,Hf=wg?mf:1,If=T(Af,Bf,b?void 0:If.domain(),function(){return Of.tickOffset()}),Jf=U(Cf,Df),Kf=U(Cf,Df),Lf=T(Af,Bf,ti,function(a){return a%1?0:Rf.tickOffset()}),Mf=U(Gf,Hf),Nf=U(Gf,Hf),a=$(),Of=X(If,Xh,a),Rf=X(Lf,$h,a),Pf=Y(Jf,Yh,Pg,Rg),Qf=Y(Kf,Zh,Yg,$g),b||(hi.scale(Lf),bf&&li.scale(If)),S()}function S(){wf=Db(),xf=Eb(),yf=Eb(.98)}function T(a,b,e,f){var g=(Mh?Ve.time.scale():Ve.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),Nh){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return Ve.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?Kf:Jf}function W(a){return"y2"===Z(a)?Nf:Mf}function X(a,b,c){var d=(Nh?Bb():Ve.svg.axis()).scale(a).orient(b);return d.tickFormat(c),Nh?d.tickCentered(zg):d.tickOffset=function(){var a=wg?nf:lf;return a*Vb()/tc()/2},Nh&&d.categories(yg),d}function Y(a,b,c,d){return Ve.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Yf?Yf[a]:"y"}function $(){var a=Mh?Vh:Nh?Ic:function(a){return 0>a?a.toFixed(0):a};return Ag&&("function"==typeof Ag?a=Ag:Mh&&(a=function(a){return Ve.time.format(Ag)(a)})),a}function _(a){var b;return"y"===a?b=Ng:"y2"===a?b=Wg:"x"===a&&(b=Ig),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Ng=b:"y2"===a?Wg=b:"x"===a&&(Ig=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",wg?"inner-top":"inner-right")}function eb(){return cb("y",wg?"inner-right":"inner-top")}function fb(){return cb("y2",wg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?lf/2:lf:b.isBottom?-nf:b.isMiddle?-nf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!wg,db())}function ob(){return kb(wg,eb())}function pb(){return kb(wg,fb())}function qb(){return lb(!wg,db())}function rb(){return lb(wg,eb())}function sb(){return lb(wg,fb())}function tb(){var a=db();return wg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return wg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return wg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!wg,db())}function xb(){return mb(wg,eb())}function yb(){return mb(wg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return Ve.selectAll("."+c+" .tick text").each(function(){var a=this.getBBox();bb?20:b}function Ab(){oi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),oi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),oi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=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]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return Ve.min(Object.keys(i).map(function(a){return Ve.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=vc(a),i=Ec(a);if(Xf.length>0)for(g=Hc(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 Ve.max(Object.keys(i).map(function(a){return Ve.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Ug:Lg,n="y2"===c?Tg:Kg,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?Vg:Mg,r=bd()&&wg;return 0===l.length?"y2"===c?Kf.domain():Jf.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=cd(o,p),j=$b(Jf.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Qg&&(f=b(Qg.top)?Qg.top:e,g=b(Qg.bottom)?Qg.bottom:e),"y2"===c&&Zg&&(f=b(Zg.top)?Zg.top:e,g=b(Zg.bottom)?Zg.bottom:e),Gd(l)&&!Gc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(ti),c=$b(If.domain());return a||0===c?1:b/c}function Wb(a){return Gg?Gg:Ve.min(a,function(a){return Ve.min(a.values,function(a){return a.x})})}function Xb(a){return Fg?Fg:Ve.max(a,function(a){return Ve.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return Nh?d=0:Gd(a)?(c=tc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=Mh?new Date(c.getTime()-e):c-e,g=Mh?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return Sf&&a===Sf||$d(Tf)&&_d(Tf,a)}function fc(a){return!ec(a)}function gc(a){return Sf?Sf:$d(Tf)?Tf[a]:null}function hc(a,b){return a in We.data.x&&We.data.x[a]&&We.data.x[a][b]?We.data.x[a][b]:b}function ic(a){Object.keys(a).forEach(function(b){Tf[b]=a[b]})}function jc(a){var b;return a&&(b=Wf[a.id],a.name=b?b:a.id),a}function kc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=mc(b[d],a.id,d)}),We.data.x[a.id]=b})}function lc(a,b){a.forEach(function(a){b[a.id]&&kc([a],b[a.id])})}function mc(a,b,c){var d;return d=Mh?a?a instanceof Date?a:Wd(a):Wd(hc(b,c)):Oh&&!Nh?a?+a:hc(b,c):c}function nc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0&&(We.data.x[b]=a.map(function(a){return a[c]})):We.data.x[b]=a.map(function(a,b){return b})}),c.forEach(function(a){if(!We.data.x[a])throw new Error('x is not defined for id = "'+a+'".')}),b=c.map(function(b,c){var d=Vf(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=mc(g,b,e);return Oh&&Nh&&0===c&&g&&(0===e&&(yg=[]),yg.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++})}),Zf&&Ed(vc(b).filter(function(a){return!(a in $f)}),Zf),b.forEach(function(a){ac(a.id_org,a)}),b}function qc(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 rc(a){return a>0&&We.data.targets[0].values[a-1]?We.data.targets[0].values[a-1].x:void 0}function sc(a){return a1?We.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?We.data.targets[0]:null,a}function vc(a){return a=c(a)?We.data.targets:a,a.map(function(a){return a.id})}function wc(a){var b,c=vc();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(Mh?new Date(h):h);i.push(d)}return i}function Cc(a){Wh=Wh.concat(a)}function Dc(a){Wh=Wh.filter(function(b){return a.indexOf(b)<0})}function Ec(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Fc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Hc(a){return Fc(a,function(a){return a>0})}function Ic(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(kd(a,f))),a[g].x&&(e=e.concat(kd(a,g))),nd(e,b)):ld(a,b,f,g)}function md(a,b){var c;return c=a.map(function(a){return ld(a.values,b)}),nd(c,b)}function nd(a,b){var c,d;return a.forEach(function(a){var e=ae(a,b);(c>e||!c)&&(c=e,d=a)}),d}function od(a,b){return Ve.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function pd(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 qd(){return ag&&"desc"===ag.toLowerCase()}function rd(){return ag&&"asc"===ag.toLowerCase()}function sd(a){var b=rd(),c=qd();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 ag&&a.sort(ag),a}function td(a,c){var d,e,f,g,h,i,j,k=Kd(We.data.targets),l=k?ed:dd,m=a.filter(function(a){return a&&b(a.value)});zh&&0!==m.length&&(ri.html(Ch(a,$(),l,Uh)).style("display","block"),d=ri.property("offsetWidth"),e=ri.property("offsetHeight"),k?(g=lf/2+c[0],i=nf/2+c[1]+20):(wg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=If(m[0].x)+20):(f=q(),g=f+t()+If(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),ri.style("top",i+"px").style("left",g+"px"))}function ud(){ri.style("display","none")}function vd(a){var c=a.filter(function(a){return a&&b(a.value)});zh&&(Hd(We.data.targets)||Kd(We.data.targets)||oi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(wg?"y1":"x1",gd).attr(wg?"y2":"x2",gd))}function wd(){oi.select("line."+f.xgridFocus).style("visibility","hidden")}function xd(a){return a.x||0===a.x?If(a.x):null}function yd(a){return V(a.id)(a.value)}function zd(){var a,b,d={},e=0;return zc(xc(Nd)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Dd(a,b){return lh?lh:b?2*a.tickOffset()*mh/b:0}function Ed(a,b){var c,d=a?"string"==typeof a?[a]:a:vc();for(c=0;c0}function _d(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ae(a,b){var c="y"===Z(a.id)?Jf:Kf;return Math.pow(If(a.x)-b[0],2)+Math.pow(c(a.value)-b[1],2)}function be(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function ce(a,b,c){lg(b,a.node()),oi.select("."+f.selectedCircles+Xc(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Jc(f.selectedCircle,c)}).attr("cx",wg?yd:xd).attr("cy",wg?xd:yd).attr("stroke",function(){return Uh(b)}).attr("r",1.4*kh).transition().duration(100).attr("r",kh)}function de(a,b,c){mg(b,a.node()),oi.select("."+f.selectedCircles+Xc(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ee(a,b,c,d){a?ce(b,c,d):de(b,c,d)}function fe(a,b){lg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ve.rgb(Uh(b)).darker(1)})}function ge(a,b){mg(b,a.node()),a.transition().duration(100).style("fill",function(){return Uh(b)})}function he(a,b,c,d){a?fe(b,c,d):ge(b,c,d)}function ie(a){return a.filter(function(a){return b(a.value)})}function je(a,c){return(c?oi.selectAll("."+f.circles+Xc(c)):oi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ke(a,b){je(a,b).classed(f.EXPANDED,!0).attr("r",jh)}function le(a){je(a).filter(function(){return Ve.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",gh)}function me(a){return oi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function ne(a){me(a).classed(f.EXPANDED,!0)}function oe(a){me(a).classed(f.EXPANDED,!1)}function pe(a,b){var c=te(a,b);return function(a,b){var d=c(a,b),e=wg?1:0,f=wg?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 qe(a,b){var c=te(a,!1),d=b?re:se;return function(a,b){return d(c(a,b),a,this)}}function re(a,b){var c;return wg?(c=Nd(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function se(a,b,c){var d=c.getBBox();return wg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:Nd(b)?-3:-6)}function te(a,b){var c=a.__max__+1,d=Dd(Of,c),e=Ad(d,c,a,!!b),f=Bd(!!b),g=Cd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return wg&&(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 ue(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 ve(b){var c,d,e;if(si=Ve.select(Ye),si.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(si.html(""),si.classed("c3",!0),We.data.x={},We.data.targets=pc(b),n(),R(),If.domain(Ve.extent(Zb(We.data.targets))),Jf.domain(Ub(We.data.targets,"y")),Kf.domain(Ub(We.data.targets,"y2")),Lf.domain(If.domain()),Mf.domain(Jf.domain()),Nf.domain(Kf.domain()),ti=If.domain(),hi.scale(Lf),bf&&li.scale(If),mi=si.append("svg").attr("width",lf+hf.left+hf.right).attr("height",nf+hf.top+hf.bottom).on("mouseenter",ef).on("mouseleave",ff),ni=mi.append("defs"),ni.append("clipPath").attr("id",Gh).append("rect").attr("width",lf).attr("height",nf),ni.append("clipPath").attr("id",Hh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),ni.append("clipPath").attr("id",Ih).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),oi=mi.append("g").attr("transform",_h.main),pi=pg?mi.append("g").attr("transform",_h.context):null,qi=sg?mi.append("g").attr("transform",_h.legend):null,ri=Ve.select(Ye).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),oi.append("g").attr("class",f.axisX).attr("clip-path",wg?"":Kh).attr("transform",_h.x).append("text").attr("class",f.axisXLabel).attr("transform",wg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),Jg&&oi.append("g").attr("class",f.axisY).attr("clip-path",wg?Lh:"").append("text").attr("class",f.axisYLabel).attr("transform",wg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),Sg&&oi.append("g").attr("class",f.axisY2).attr("transform",_h.y2).append("text").attr("class",f.axisY2Label).attr("transform",wg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=oi.append("g").attr("clip-path",Jh).attr("class",f.grid),_g&&d.append("g").attr("class",f.xgrids),$d(bh)&&d.append("g").attr("class",f.xgridLines),hh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),ch&&d.append("g").attr("class",f.ygrids),$d(dh)&&d.append("g").attr("class",f.ygridLines),oi.append("g").attr("clip-path",Jh).attr("class",f.regions),oi.append("g").attr("clip-path",Jh).attr("class",f.chart),c=oi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",bf?wg?"ns-resize":"ew-resize":null),oi.select("."+f.chart).append("g").attr("class",f.chartBars),oi.select("."+f.chart).append("g").attr("class",f.chartLines),oi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",_h.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),oi.select("."+f.chart).append("g").attr("class",f.chartTexts),bf&&oi.insert("rect",df?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",lf).attr("height",nf).style("opacity",0).style("cursor",wg?"ns-resize":"ew-resize").call(li).on("dblclick.zoom",null),Hg&&hi.extent("function"!=typeof Hg?Hg:Hg(Zb())),pg&&(pi.append("g").attr("clip-path",Jh).attr("class",f.chart),pi.select("."+f.chart).append("g").attr("class",f.chartBars),pi.select("."+f.chart).append("g").attr("class",f.chartLines),pi.append("g").attr("clip-path",Jh).attr("class",f.brush).call(hi).selectAll("rect").attr(wg?"width":"height",wg?mf:of),pi.append("g").attr("class",f.axisX).attr("transform",_h.subx).attr("clip-path",wg?"":Kh)),Ie(We.data.targets),wg?oi.select("."+f.axisX).style("opacity",0).call(Of):(oi.select("."+f.axisY).style("opacity",0).call(Pf),oi.select("."+f.axisY2).style("opacity",0).call(Qf)),He({withTransform:!0,withLegend:!0,withTransitionForAxis:!1}),Dh){if(Mh&&"string"==typeof Eh){for(Eh=Wd(Eh),e=0;elf&&(lf=0),0>nf&&(nf=0),jf={top:wg?hf.top:qf-qg-(ai?0:rf),right:0/0,bottom:20+(ai?0:rf),left:wg?ei:hf.left},mf=wg?hf.left-ei-fi:lf,of=wg?nf:qf-jf.top-jf.bottom,0>mf&&(mf=0),0>of&&(of=0),kf={top:ai?0:qf-rf,right:0/0,bottom:0,left:ai?pf-sf:0},p(),ai&&Kd(We.data.targets)&&(kf.left=lf/2+uf)}function o(){oi.select("line."+f.xgridFocus).attr("x1",wg?0:-10).attr("x2",wg?lf:-10).attr("y1",wg?-10:hf.top).attr("y2",wg?-10:nf)}function p(){uf=nf/2,tf=.95*uf,vf=Jd(We.data.targets)?.6*tf:0}function q(){var a=wg?f.axisX:f.axisY,b=Ve.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Ve.select(Ye).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Ze?Ze:x()}function s(){var a=$e?$e:y();return a>0?a:320}function t(){return Kd(We.data.targets)?0:_e?_e:wg||!Jg||Og?1:v("y")}function u(){var a=1;return Kd(We.data.targets)?0:af?af:ai?sf+(Sg&&!wg?v("y2"):a):Sg?Xg||wg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||Jg?"y2"!==a||Sg?(gb(a).isInner?30:40)+("y2"===a?-10:0):gi:sg&&!ai?10:1}function x(){return+Ve.select(Ye).style("width").replace("px","")}function y(){return+Ve.select(Ye).style("height").replace("px","")}function z(a){return a?-5:-(hf.left-1)}function A(a){return a?-20:-1}function B(){return z(!wg)}function C(){return A(!wg)}function D(){return z(wg)}function E(){return A(wg)}function F(a){return a?lf+2+4:hf.left+20}function G(a){return a?80:nf+2}function H(){return F(!wg)}function I(){return G(!wg)}function J(){return F(wg)}function K(){return G(wg)}function L(){var a=wg?nf:lf,b=tc(),c=Vb()*(Gd(We.data.targets)?(b-(Nh?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){bi=a}function N(a){ci=a}function O(a){di=a}function P(){return sg?ai?ci*(bi+1):pf:0}function Q(){return sg?ai?qf:di*(bi+1):0}function R(){var a,b=!If;Af=wg?1:0,Bf=wg?nf:lf,Cf=wg?0:nf,Df=wg?lf:1,Ef=Af,Ff=Bf,Gf=wg?0:of,Hf=wg?mf:1,If=T(Af,Bf,b?void 0:If.domain(),function(){return Of.tickOffset()}),Jf=U(Cf,Df),Kf=U(Cf,Df),Lf=T(Af,Bf,ti,function(a){return a%1?0:Rf.tickOffset()}),Mf=U(Gf,Hf),Nf=U(Gf,Hf),a=$(),Of=X(If,Xh,a),Rf=X(Lf,$h,a),Pf=Y(Jf,Yh,Pg,Rg),Qf=Y(Kf,Zh,Yg,$g),b||(hi.scale(Lf),bf&&li.scale(If)),S()}function S(){wf=Db(),xf=Eb(),yf=Eb(.98)}function T(a,b,e,f){var g=(Mh?Ve.time.scale():Ve.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),Nh){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return Ve.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?Kf:Jf}function W(a){return"y2"===Z(a)?Nf:Mf}function X(a,b,c){var d=(Nh?Bb():Ve.svg.axis()).scale(a).orient(b);return d.tickFormat(c),Nh?d.tickCentered(zg):d.tickOffset=function(){var a=wg?nf:lf;return a*Vb()/tc()/2},Nh&&d.categories(yg),d}function Y(a,b,c,d){return Ve.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Yf?Yf[a]:"y"}function $(){var a=Mh?Vh:Nh?Ic:function(a){return 0>a?a.toFixed(0):a};return Ag&&("function"==typeof Ag?a=Ag:Mh&&(a=function(a){return Ve.time.format(Ag)(a)})),a}function _(a){var b;return"y"===a?b=Ng:"y2"===a?b=Wg:"x"===a&&(b=Ig),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Ng=b:"y2"===a?Wg=b:"x"===a&&(Ig=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",wg?"inner-top":"inner-right")}function eb(){return cb("y",wg?"inner-right":"inner-top")}function fb(){return cb("y2",wg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?lf/2:lf:b.isBottom?-nf:b.isMiddle?-nf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!wg,db())}function ob(){return kb(wg,eb())}function pb(){return kb(wg,fb())}function qb(){return lb(!wg,db())}function rb(){return lb(wg,eb())}function sb(){return lb(wg,fb())}function tb(){var a=db();return wg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return wg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return wg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!wg,db())}function xb(){return mb(wg,eb())}function yb(){return mb(wg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return Ve.selectAll("."+c+" .tick text").each(function(){var a=this.getBBox();bb?20:b}function Ab(){oi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),oi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),oi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=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]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return Ve.min(Object.keys(i).map(function(a){return Ve.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=vc(a),i=Ec(a);if(Xf.length>0)for(g=Hc(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 Ve.max(Object.keys(i).map(function(a){return Ve.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Ug:Lg,n="y2"===c?Tg:Kg,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?Vg:Mg,r=bd()&&wg;return 0===l.length?"y2"===c?Kf.domain():Jf.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=cd(o,p),j=$b(Jf.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Qg&&(f=b(Qg.top)?Qg.top:e,g=b(Qg.bottom)?Qg.bottom:e),"y2"===c&&Zg&&(f=b(Zg.top)?Zg.top:e,g=b(Zg.bottom)?Zg.bottom:e),Gd(l)&&!Gc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(ti),c=$b(If.domain());return a||0===c?1:b/c}function Wb(a){return Gg?Gg:Ve.min(a,function(a){return Ve.min(a.values,function(a){return a.x})})}function Xb(a){return Fg?Fg:Ve.max(a,function(a){return Ve.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return Nh?d=0:Gd(a)?(c=tc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=Mh?new Date(c.getTime()-e):c-e,g=Mh?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return Sf&&a===Sf||$d(Tf)&&_d(Tf,a)}function fc(a){return!ec(a)}function gc(a){return Sf?Sf:$d(Tf)?Tf[a]:null}function hc(a,b){return a in We.data.x&&We.data.x[a]&&We.data.x[a][b]?We.data.x[a][b]:b}function ic(a){Object.keys(a).forEach(function(b){Tf[b]=a[b]})}function jc(a){var b;return a&&(b=Wf[a.id],a.name=b?b:a.id),a}function kc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=mc(b[d],a.id,d)}),We.data.x[a.id]=b})}function lc(a,b){a.forEach(function(a){b[a.id]&&kc([a],b[a.id])})}function mc(a,b,c){var d;return d=Mh?a?a instanceof Date?a:Wd(a):Wd(hc(b,c)):Oh&&!Nh?a?+a:hc(b,c):c}function nc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0&&(We.data.x[b]=a.map(function(a){return a[c]})):We.data.x[b]=a.map(function(a,b){return b})}),c.forEach(function(a){if(!We.data.x[a])throw new Error('x is not defined for id = "'+a+'".')}),b=c.map(function(b,c){var d=Vf(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=mc(g,b,e);return Oh&&Nh&&0===c&&g&&(0===e&&(yg=[]),yg.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++})}),Zf&&Ed(vc(b).filter(function(a){return!(a in $f)}),Zf),b.forEach(function(a){ac(a.id_org,a)}),b}function qc(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 rc(a){return a>0&&We.data.targets[0].values[a-1]?We.data.targets[0].values[a-1].x:void 0}function sc(a){return a1?We.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?We.data.targets[0]:null,a}function vc(a){return a=c(a)?We.data.targets:a,a.map(function(a){return a.id})}function wc(a){var b,c=vc();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(Mh?new Date(h):h);i.push(d)}return i}function Cc(a){Wh=Wh.concat(a)}function Dc(a){Wh=Wh.filter(function(b){return a.indexOf(b)<0})}function Ec(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Fc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Hc(a){return Fc(a,function(a){return a>0})}function Ic(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(kd(a,f))),a[g].x&&(e=e.concat(kd(a,g))),nd(e,b)):ld(a,b,f,g)}function md(a,b){var c;return c=a.map(function(a){return ld(a.values,b)}),nd(c,b)}function nd(a,b){var c,d;return a.forEach(function(a){var e=ae(a,b);(c>e||!c)&&(c=e,d=a)}),d}function od(a,b){return Ve.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function pd(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 qd(){return ag&&"desc"===ag.toLowerCase()}function rd(){return ag&&"asc"===ag.toLowerCase()}function sd(a){var b=rd(),c=qd();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 ag&&a.sort(ag),a}function td(a,c){var d,e,f,g,h,i,j,k=Kd(We.data.targets),l=k?ed:dd,m=a.filter(function(a){return a&&b(a.value)});zh&&0!==m.length&&(ri.html(Ch(a,$(),l,Uh)).style("display","block"),d=ri.property("offsetWidth"),e=ri.property("offsetHeight"),k?(g=lf/2+c[0],i=nf/2+c[1]+20):(wg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=If(m[0].x)+20):(f=q(),g=f+t()+If(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),ri.style("top",i+"px").style("left",g+"px"))}function ud(){ri.style("display","none")}function vd(a){var c=a.filter(function(a){return a&&b(a.value)});zh&&(Hd(We.data.targets)||Kd(We.data.targets)||oi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(wg?"y1":"x1",gd).attr(wg?"y2":"x2",gd))}function wd(){oi.select("line."+f.xgridFocus).style("visibility","hidden")}function xd(a){return a.x||0===a.x?If(a.x):null}function yd(a){return V(a.id)(a.value)}function zd(){var a,b,d={},e=0;return zc(xc(Nd)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Dd(a,b){return lh?lh:b?2*a.tickOffset()*mh/b:0}function Ed(a,b){var c,d=a?"string"==typeof a?[a]:a:vc();for(c=0;c0}function _d(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ae(a,b){var c="y"===Z(a.id)?Jf:Kf,d=wg?1:0,e=wg?0:1;return Math.pow(If(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function be(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function ce(a,b,c){lg(b,a.node()),oi.select("."+f.selectedCircles+Xc(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Jc(f.selectedCircle,c)}).attr("cx",wg?yd:xd).attr("cy",wg?xd:yd).attr("stroke",function(){return Uh(b)}).attr("r",1.4*kh).transition().duration(100).attr("r",kh)}function de(a,b,c){mg(b,a.node()),oi.select("."+f.selectedCircles+Xc(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ee(a,b,c,d){a?ce(b,c,d):de(b,c,d)}function fe(a,b){lg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ve.rgb(Uh(b)).darker(1)})}function ge(a,b){mg(b,a.node()),a.transition().duration(100).style("fill",function(){return Uh(b)})}function he(a,b,c,d){a?fe(b,c,d):ge(b,c,d)}function ie(a){return a.filter(function(a){return b(a.value)})}function je(a,c){return(c?oi.selectAll("."+f.circles+Xc(c)):oi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ke(a,b){je(a,b).classed(f.EXPANDED,!0).attr("r",jh)}function le(a){je(a).filter(function(){return Ve.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",gh)}function me(a){return oi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function ne(a){me(a).classed(f.EXPANDED,!0)}function oe(a){me(a).classed(f.EXPANDED,!1)}function pe(a,b){var c=te(a,b);return function(a,b){var d=c(a,b),e=wg?1:0,f=wg?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 qe(a,b){var c=te(a,!1),d=b?re:se;return function(a,b){return d(c(a,b),a,this)}}function re(a,b){var c;return wg?(c=Nd(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function se(a,b,c){var d=c.getBBox();return wg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:Nd(b)?-3:-6)}function te(a,b){var c=a.__max__+1,d=Dd(Of,c),e=Ad(d,c,a,!!b),f=Bd(!!b),g=Cd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return wg&&(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 ue(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 ve(b){var c,d,e;if(si=Ve.select(Ye),si.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(si.html(""),si.classed("c3",!0),We.data.x={},We.data.targets=pc(b),n(),R(),If.domain(Ve.extent(Zb(We.data.targets))),Jf.domain(Ub(We.data.targets,"y")),Kf.domain(Ub(We.data.targets,"y2")),Lf.domain(If.domain()),Mf.domain(Jf.domain()),Nf.domain(Kf.domain()),ti=If.domain(),hi.scale(Lf),bf&&li.scale(If),mi=si.append("svg").attr("width",lf+hf.left+hf.right).attr("height",nf+hf.top+hf.bottom).on("mouseenter",ef).on("mouseleave",ff),ni=mi.append("defs"),ni.append("clipPath").attr("id",Gh).append("rect").attr("width",lf).attr("height",nf),ni.append("clipPath").attr("id",Hh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),ni.append("clipPath").attr("id",Ih).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),oi=mi.append("g").attr("transform",_h.main),pi=pg?mi.append("g").attr("transform",_h.context):null,qi=sg?mi.append("g").attr("transform",_h.legend):null,ri=Ve.select(Ye).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),oi.append("g").attr("class",f.axisX).attr("clip-path",wg?"":Kh).attr("transform",_h.x).append("text").attr("class",f.axisXLabel).attr("transform",wg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),Jg&&oi.append("g").attr("class",f.axisY).attr("clip-path",wg?Lh:"").append("text").attr("class",f.axisYLabel).attr("transform",wg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),Sg&&oi.append("g").attr("class",f.axisY2).attr("transform",_h.y2).append("text").attr("class",f.axisY2Label).attr("transform",wg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=oi.append("g").attr("clip-path",Jh).attr("class",f.grid),_g&&d.append("g").attr("class",f.xgrids),$d(bh)&&d.append("g").attr("class",f.xgridLines),hh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),ch&&d.append("g").attr("class",f.ygrids),$d(dh)&&d.append("g").attr("class",f.ygridLines),oi.append("g").attr("clip-path",Jh).attr("class",f.regions),oi.append("g").attr("clip-path",Jh).attr("class",f.chart),c=oi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",bf?wg?"ns-resize":"ew-resize":null),oi.select("."+f.chart).append("g").attr("class",f.chartBars),oi.select("."+f.chart).append("g").attr("class",f.chartLines),oi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",_h.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),oi.select("."+f.chart).append("g").attr("class",f.chartTexts),bf&&oi.insert("rect",df?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",lf).attr("height",nf).style("opacity",0).style("cursor",wg?"ns-resize":"ew-resize").call(li).on("dblclick.zoom",null),Hg&&hi.extent("function"!=typeof Hg?Hg:Hg(Zb())),pg&&(pi.append("g").attr("clip-path",Jh).attr("class",f.chart),pi.select("."+f.chart).append("g").attr("class",f.chartBars),pi.select("."+f.chart).append("g").attr("class",f.chartLines),pi.append("g").attr("clip-path",Jh).attr("class",f.brush).call(hi).selectAll("rect").attr(wg?"width":"height",wg?mf:of),pi.append("g").attr("class",f.axisX).attr("transform",_h.subx).attr("clip-path",wg?"":Kh)),Ie(We.data.targets),wg?oi.select("."+f.axisX).style("opacity",0).call(Of):(oi.select("."+f.axisY).style("opacity",0).call(Pf),oi.select("."+f.axisY2).style("opacity",0).call(Qf)),He({withTransform:!0,withLegend:!0,withTransitionForAxis:!1}),Dh){if(Mh&&"string"==typeof Eh){for(Eh=Wd(Eh),e=0;e0){d=[];for(var g in Wf)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=pd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=he,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 Ae(a){Kd(We.data.targets)||eg&&(Ph=a,oi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Qh=!0,ng())}function Be(){Kd(We.data.targets)||eg&&(oi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),oi.selectAll("."+f.shape).classed(f.INCLUDED,!1),Qh=!1,og())}function Ce(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P=zd(),Q=Kd(We.data.targets),R=zc(We.data.targets);if(0!==R.length){if(a=d(a)?a:{},v=d(a.withY)?a.withY:!0,w=d(a.withSubchart)?a.withSubchart:!0,x=d(a.withTransition)?a.withTransition:!0,A=d(a.withTransform)?a.withTransform:!1,B=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,C=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,D=d(a.withLegend)?a.withLegend:!1,y=d(a.withTransitionForExit)?a.withTransitionForExit:x,z=d(a.withTransitionForAxis)?a.withTransitionForAxis:x,I=x?gf:0,J=y?I:0,K=z?I:0,D&&sg&&Qe(We.data.targets,a),C&&(If.domain(Ve.extent(Zb(R))),ti=If.domain(),bf&&li.scale(If).updateScaleExtent(),Lf.domain(If.domain()),hi.scale(Lf)),B&&(If.domain(hi.empty()?ti:hi.extent()),bf&&li.scale(If).updateScaleExtent(),Hd(R)||(M=Bc(Ac(R)).sort(),Of.tickValues(M),Rf.tickValues(M))),Jf.domain(Ub(R,"y")),Kf.domain(Ub(R,"y2")),oi.select("."+f.axisX).style("opacity",Q?0:1).transition().duration(K).call(Of),oi.select("."+f.axisY).style("opacity",Q?0:1).transition().duration(K).call(Pf),oi.select("."+f.axisY2).style("opacity",Q?0:1).transition().duration(K).call(Qf),B&&Bg&&M){for(N=1;N=V;V++)e.push(new Date(V+"-01-01 00:00:00"))}else e=If.ticks(10);c=oi.select("."+f.xgrids).selectAll("."+f.xgrid).data(e),c.enter().append("line").attr("class",f.xgrid),c.attr("x1",wg?0:function(a){return If(a)-Of.tickOffset()}).attr("x2",wg?lf:function(a){return If(a)-Of.tickOffset()}).attr("y1",wg?function(a){return If(a)-Of.tickOffset()}:hf.top).attr("y2",wg?function(a){return If(a)-Of.tickOffset()}:nf).style("opacity",function(){return+Ve.select(this).attr(wg?"y1":"x1")===(wg?nf:0)?0:1}),c.exit().remove()}$d(bh)&&(g=oi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(bh),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",wg?"":"rotate(-90)").attr("dx",wg?0:-hf.top).attr("dy",-5).style("opacity",0),g.select("line").transition().duration(I).attr("x1",wg?0:hd).attr("x2",wg?lf:hd).attr("y1",wg?hd:hf.top).attr("y2",wg?hd:nf).style("opacity",1),g.select("text").transition().duration(I).attr("x",wg?lf:0).attr("y",hd).text(function(a){return a.text}).style("opacity",1),g.exit().transition().duration(I).style("opacity",0).remove()),v&&ch&&(i=oi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Jf.ticks(eh)),i.enter().append("line").attr("class",f.ygrid),i.attr("x1",wg?Jf:0).attr("x2",wg?Jf:lf).attr("y1",wg?0:Jf).attr("y2",wg?nf:Jf),i.exit().remove()),v&&$d(dh)&&(j=oi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(dh),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",wg?"rotate(-90)":"").attr("dx",wg?0:-hf.top).attr("dy",-5).style("opacity",0),j.select("line").transition().duration(I).attr("x1",wg?id:0).attr("x2",wg?id:lf).attr("y1",wg?0:id).attr("y2",wg?nf:id).style("opacity",1),j.select("text").transition().duration(I).attr("x",wg?0:lf).attr("y",id).text(function(a){return a.text}).style("opacity",1),j.exit().transition().duration(I).style("opacity",0).remove()),m=oi.selectAll("."+f.bars).selectAll("."+f.bar).data(Sd),m.enter().append("path").attr("d",E).style("stroke","none").style("opacity",0).style("fill",function(a){return Uh(a)}).attr("class",Rc),m.style("opacity",Zc).transition().duration(I).attr("d",E).style("opacity",1),m.exit().transition().duration(J).style("opacity",0).remove(),p=oi.selectAll("."+f.texts).selectAll("."+f.text).data(Ud),p.enter().append("text").attr("class",Kc).attr("text-anchor",function(a){return wg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),p.text(function(a){return fd(a.id)(a.value)}).style("fill-opacity",$c).transition().duration(I).attr("x",G).attr("y",H).style("fill-opacity",ad),p.exit().transition().duration(J).style("fill-opacity",0).remove(),oi.selectAll("."+f.line).style("opacity",Zc).transition().duration(I).attr("d",ii).style("opacity",1),oi.selectAll("."+f.area).style("opacity",0).transition().duration(I).attr("d",ji).style("opacity",ui),l=oi.selectAll("."+f.circles).selectAll("."+f.circle).data(Td),l.enter().append("circle").attr("class",Pc).style("opacity",0).attr("r",gh),l.style("opacity",Zc).transition().duration(I).style("opacity",_c).attr("cx",wg?yd:xd).attr("cy",wg?xd:yd),l.exit().remove(),oi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",A?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(I).attrTween("d",function(a){var b,c=Cb(a);return c?(b=Ve.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",A?"scale(1)":"").style("opacity",1),oi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(I).text(Jb).style("opacity",function(a){return yc(a.data.id)&&Rd(a.data)?1:0}),oi.select("."+f.chartArcsTitle).style("opacity",Jd(We.data.targets)?1:0),pg&&(null!==Ve.event&&"zoom"===Ve.event.type&&hi.extent(If.orgDomain()).update(),w&&(pi.select("."+f.axisX).style("opacity",Q?0:1).transition().duration(I).call(Rf),hi.empty()||hi.extent(If.orgDomain()).update(),F=pe(P,!0),q=pi.selectAll("."+f.bars).selectAll("."+f.bar).data(Sd),q.enter().append("path").attr("d",F).style("stroke","none").style("fill",function(a){return Uh(a)}).attr("class",Rc),q.style("opacity",Zc).transition().duration(I).attr("d",F).style("opacity",1),q.exit().transition().duration(I).style("opacity",0).remove(),pi.selectAll("."+f.line).style("opacity",Zc).transition().duration(I).attr("d",ki).style("opacity",1))),oi.selectAll("."+f.selectedCircles).filter(function(a){return Nd(a)}).selectAll("circle").remove(),oi.selectAll("."+f.selectedCircle).transition().duration(I).attr("cx",wg?yd:xd).attr("cy",wg?xd:yd),$d(Tf)?(r=oi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),xe(r.enter()),r.attr("x",0).attr("y",0).attr("width",lf).attr("height",nf)):(Oh&&!Nh?(u=function(a,b){var c=rc(b),d=sc(b),e=We.data.x[a.id][b];return(If(d?d:e+50)-If(c?c:e-50))/2},t=function(a,b){var c=rc(b),d=We.data.x[a.id][b];return(If(d)+If(c?c:d-50))/2}):(u=L(),t=function(a){return If(a.x)-u/2}),s=uc(),oi.select("."+f.eventRects).datum(s?s.values:[]),r=oi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),we(r.enter()),r.attr("class",Wc).attr("x",wg?0:t).attr("y",wg?t:0).attr("width",wg?lf:u).attr("height",wg?u:nf),r.exit().remove()),n=oi.select("."+f.regions).selectAll("rect."+f.region).data(yh),n.enter().append("rect").style("fill-opacity",0),n.attr("class",Vc).attr("x",wg?0:cc).attr("y",wg?cc:hf.top).attr("width",wg?lf:dc).attr("height",wg?dc:nf).transition().duration(I).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),n.exit().transition().duration(I).style("fill-opacity",0).remove(),vc().forEach(function(a){vi[a]=!0})}}function De(){Ce({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ee(){return"mousemove"===Ve.event.sourceEvent.type&&li.altDomain?(If.domain(li.altDomain),void li.scale(If).updateScaleExtent()):(Nh&&If.orgDomain()[0]===ti[0]&&If.domain([ti[0]-1e-10,If.orgDomain()[1]]),Ce({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Ve.event.sourceEvent.type&&(Rh=!0)))}function Fe(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ge(){mi.attr("width",pf).attr("height",qf),mi.select("#"+Gh).select("rect").attr("width",lf).attr("height",nf),mi.select("#"+Hh).select("rect").attr("width",H),mi.select("#"+Ih).select("rect").attr("width",J),mi.select("."+f.zoomRect).attr("width",lf).attr("height",nf)}function He(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(),R(),Ge(),m(a.withTransition),Ce(a)}function Ie(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=oi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a),j=i.enter().append("g").attr("class",function(a){return f.chartText+Jc(f.target,a.id)}).style("pointer-events","none"),j.append("g").attr("class",Lc).style("fill",function(a){return Uh(a)}),e=oi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),d=e.enter().append("g").attr("class",function(a){return f.chartBar+Jc(f.target,a.id)}).style("pointer-events","none"),d.append("g").attr("class",Sc).style("fill",function(a){return Uh(a)}).style("stroke","none").style("cursor",function(a){return gg(a)?"pointer":null}),c=oi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),b=c.enter().append("g").attr("class",function(a){return f.chartLine+Jc(f.target,a.id)}).style("pointer-events","none"),b.append("path").attr("class",Oc).style("opacity",0).style("stroke",function(a){return Uh(a)}),b.append("path").attr("class",Uc).style("opacity",function(){return ui=+Ve.select(this).style("opacity"),0}).style("fill",function(a){return Uh(a)}),b.append("g").attr("class",function(a){return Jc(f.selectedCircles,a.id)}),b.append("g").attr("class",Qc).style("fill",function(a){return Uh(a)}).style("cursor",function(a){return gg(a)?"pointer":null}),a.forEach(function(a){oi.selectAll("."+f.selectedCircles+Xc(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=oi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(zf(a)),g=h.enter().append("g").attr("class",function(a){return f.chartArc+Jc(f.target,a.data.id)}),g.append("path").attr("class",Tc).style("opacity",0).style("fill",function(a){return Uh(a.data)}).style("cursor",function(a){return gg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),Ne(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];td(c,Ve.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),Pe(),ud(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),pg&&(n=pi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),m=n.enter().append("g").attr("class",function(a){return f.chartBar+Jc(f.target,a.id)}),m.append("g").attr("class",Sc).style("fill",function(a){return Uh(a)}),l=pi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),k=l.enter().append("g").attr("class",function(a){return f.chartLine+Jc(f.target,a.id)}),k.append("path").attr("class",Oc).style("opacity",0).style("stroke",function(a){return Uh(a)})),mi.selectAll("."+f.target).filter(function(a){return yc(a.id)}).transition().style("opacity",1)}function Je(a,b){We.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=ai?i:h,k=ai?rf:sf;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=ai?u:t,vg?(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=vc(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,ai?(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=qi.selectAll("."+f.legendItem).data(q).enter().append("g").attr("class",function(a){return Jc(f.legendItem,a)}).style("cursor","pointer").on("click",function(a){"function"==typeof ug?ug(a):We.toggle(a)}).on("mouseover",function(a){We.focus(a)}).on("mouseout",function(){We.revert()}),g.append("text").text(function(a){return d(Wf[a])?Wf[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",ai?i:-200).attr("y",ai?-200:l),g.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",ai?j:-200).attr("y",ai?-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 Uh(a)}).attr("x",ai?i:-200).attr("y",ai?-200:k).attr("width",10).attr("height",10),qi.selectAll("text").data(q).text(function(a){return d(Wf[a])?Wf[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",i).attr("y",l),qi.selectAll("rect."+f.legendItemEvent).data(q).transition().duration(p?250:0).attr("x",j).attr("y",o),qi.selectAll("rect."+f.legendItemTile).data(q).transition().duration(p?250:0).attr("x",h).attr("y",k),N(t),O(u),M(C),n(),R(),Ge(),m(!1)}function Re(a){return wc(a.id)}function Se(a){return"data"in a&&wc(a.data.id)}function Te(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 Ue(a,b,c){var d=!Kd(We.data.targets);Ed(a,b),He(c?c:{withTransitionForAxis:d})}var Ve=a.d3?a.d3:a.require?a.require("d3"):void 0,We={data:{},axis:{}},Xe={},Ye=h(["bindto"],"#chart"),Ze=h(["size","width"]),$e=h(["size","height"]),_e=h(["padding","left"]),af=h(["padding","right"]),bf=h(["zoom","enabled"],!1),cf=h(["zoom","extent"]),df=h(["zoom","privileged"],!1),ef=h(["onenter"],function(){}),ff=h(["onleave"],function(){}),gf=h(["transition","duration"],350);g("data","data is required in config");var 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,Rf,Sf=h(["data","x"]),Tf=h(["data","xs"],{}),Uf=h(["data","x_format"]),Vf=h(["data","id_converter"],function(a){return a}),Wf=h(["data","names"],{}),Xf=h(["data","groups"],[]),Yf=h(["data","axes"],{}),Zf=h(["data","type"]),$f=h(["data","types"],{}),_f=h(["data","labels"],{}),ag=h(["data","order"]),bg=h(["data","regions"],{}),cg=h(["data","color"]),dg=h(["data","colors"],{}),eg=h(["data","selection","enabled"],!1),fg=h(["data","selection","grouped"],!1),gg=h(["data","selection","isselectable"],function(){return!0}),hg=h(["data","selection","multiple"],!0),ig=h(["data","onclick"],function(){}),jg=h(["data","onenter"],function(){}),kg=h(["data","onleave"],function(){}),lg=h(["data","onselected"],function(){}),mg=h(["data","onunselected"],function(){}),ng=h(["data","ondragstart"],function(){}),og=h(["data","ondragend"],function(){}),pg=h(["subchart","show"],!1),qg=pg?h(["subchart","size","height"],60):0,rg=h(["color","pattern"],[]),sg=h(["legend","show"],!0),tg=h(["legend","position"],"bottom"),ug=h(["legend","item","onclick"]),vg=h(["legend","equally"],!1),wg=h(["axis","rotated"],!1),xg=h(["axis","x","type"],"indexed"),yg=h(["axis","x","categories"],[]),zg=h(["axis","x","tick","centered"],!1),Ag=h(["axis","x","tick","format"]),Bg=h(["axis","x","tick","culling"],{}),Cg=h(["axis","x","tick","culling","max"],"categorized"===xg?1/0:10),Dg=h(["axis","x","tick","count"]),Eg=h(["axis","x","tick","fit"],!1),Fg=h(["axis","x","max"]),Gg=h(["axis","x","min"]),Hg=h(["axis","x","default"]),Ig=h(["axis","x","label"],{}),Jg=h(["axis","y","show"],!0),Kg=h(["axis","y","max"]),Lg=h(["axis","y","min"]),Mg=h(["axis","y","center"]),Ng=h(["axis","y","label"],{}),Og=h(["axis","y","inner"],!1),Pg=h(["axis","y","tick","format"]),Qg=h(["axis","y","padding"],{}),Rg=h(["axis","y","ticks"],10),Sg=h(["axis","y2","show"],!1),Tg=h(["axis","y2","max"]),Ug=h(["axis","y2","min"]),Vg=h(["axis","y2","center"]),Wg=h(["axis","y2","label"],{}),Xg=h(["axis","y2","inner"],!1),Yg=h(["axis","y2","tick","format"]),Zg=h(["axis","y2","padding"],{}),$g=h(["axis","y2","ticks"],10),_g=h(["grid","x","show"],!1),ah=h(["grid","x","type"],"tick"),bh=h(["grid","x","lines"],[]),ch=h(["grid","y","show"],!1),dh=h(["grid","y","lines"],[]),eh=h(["grid","y","ticks"],10),fh=h(["point","show"],!0),gh=fh?h(["point","r"],2.5):0,hh=h(["point","focus","line","enabled"],!0),ih=h(["point","focus","expand","enabled"],!0),jh=h(["point","focus","expand","r"],ih?4:gh),kh=h(["point","focus","select","r"],8),lh=h(["bar","width"]),mh=h(["bar","width","ratio"],.6),nh=h(["pie","label","show"],!0),oh=h(["pie","label","format"]),ph=h(["pie","onclick"],function(){}),qh=h(["pie","onmouseover"],function(){}),rh=h(["pie","onmouseout"],function(){}),sh=h(["donut","label","show"],!0),th=h(["donut","label","format"]),uh=h(["donut","title"],""),vh=h(["donut","onclick"],function(){}),wh=h(["donut","onmouseover"],function(){}),xh=h(["donut","onmouseout"],function(){}),yh=h(["regions"],[]),zh=h(["tooltip","show"],!0),Ah=h(["tooltip","format","title"]),Bh=h(["tooltip","format","value"]),Ch=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Ah?Ah:b,l=Bh?Bh: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+""}),Dh=h(["tooltip","init","show"],!1),Eh=h(["tooltip","init","x"],0),Fh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Gh=("string"==typeof Ye?Ye.replace("#",""):Ye.id)+"-clip",Hh=Gh+"-xaxis",Ih=Gh+"-yaxis",Jh=i(Gh),Kh=i(Kh),Lh=i(Lh),Mh="timeseries"===xg,Nh="categorized"===xg,Oh=!Mh&&(Sf||$d(Tf)),Ph=null,Qh=!1,Rh=!1,Sh=!1,Th=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Uh=Vd(dg,$d(rg)?rg:Th,cg),Vh=function(){var a=[[Ve.time.format("%Y/%-m/%-d"),function(){return!0}],[Ve.time.format("%-m/%-d"),function(a){return a.getMonth()}],[Ve.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ve.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ve.time.format("%I %p"),function(a){return a.getHours()}],[Ve.time.format("%I:%M"),function(a){return a.getMinutes()}],[Ve.time.format(":%S"),function(a){return a.getSeconds()}],[Ve.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)}}(),Wh=[],Xh=wg?"left":"bottom",Yh=wg?Og?"top":"bottom":Og?"right":"left",Zh=wg?Xg?"bottom":"top":Xg?"left":"right",$h=wg?"left":"bottom",_h={main:function(){return"translate("+hf.left+","+hf.top+")"},context:function(){return"translate("+jf.left+","+jf.top+")"},legend:function(){return"translate("+kf.left+","+kf.top+")"},x:function(){return"translate(0,"+(wg?0:nf)+")"},y:function(){return"translate(0,"+(wg?nf:0)+")"},y2:function(){return"translate("+(wg?0:lf)+","+(wg?1:0)+")"},subx:function(){return"translate(0,"+(wg?0:of)+")"},arc:function(){return"translate("+lf/2+","+nf/2+")"}},ai="right"===tg,bi=0,ci=0,di=0,ei=30,fi=30,gi=5;zf=Ve.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var hi,ii=function(){var a=Ve.svg.line().x(wg?function(a){return V(a.id)(a.value)}:gd).y(wg?gd:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=ie(b.values);return Ld(b)?(a.interpolate(Md(b)?"cardinal":"linear"),bg[b.id]?ue(e,If,V(b.id),bg[b.id]):a(e)):(c=If(e[0].x),d=V(b.id)(e[0].value),wg?"M "+d+" "+c:"M "+c+" "+d)}}(),ji=function(){var a;return a=wg?Ve.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(gd):Ve.svg.area().x(gd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=ie(b.values);return Fd([b],"area")||Fd([b],"area-spline")?(a.interpolate(Md(b)?"cardinal":"linear"),a(e)):(c=If(e[0].x),d=V(b.id)(e[0].value),wg?"M "+d+" "+c:"M "+c+" "+d)}}(),ki=function(){var a=Ve.svg.line().x(wg?function(a){return W(a.id)(a.value)}:jd).y(wg?jd:function(a){return W(a.id)(a.value)});return function(b){var c=ie(b.values);return Ld(b)?a(c):"M "+Lf(c[0].x)+" "+W(b.id)(c[0].value)}}(),li=function(){};hi=Ve.svg.brush().on("brush",De),hi.update=function(){return pi&&pi.select("."+f.brush).call(this),this},hi.scale=function(a){return wg?this.y(a):this.x(a)},bf&&(li=Ve.behavior.zoom().on("zoomstart",function(){li.altDomain=Ve.event.sourceEvent.altKey?If.orgDomain():null}).on("zoom",bf?Ee:null),li.scale=function(a){return wg?this.y(a):this.x(a)},li.orgScaleExtent=function(){var a=cf?cf:[1,10];return[a[0],Math.max(tc()/a[1],a[1])]},li.updateScaleExtent=function(){var a=$b(If.orgDomain())/$b(ti),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var mi,ni,oi,pi,qi,ri,si,ti,ui,vi={};if(We.focus=function(a){function b(a){zc(a).transition().duration(100).style("opacity",1)}var c=mi.selectAll(Yc(a)),d=c.filter(Re),e=c.filter(Se);We.revert(),We.defocus(),b(d.classed(f.focused,!0)),b(e),Kd(We.data.targets)&&Kb(a,!0),Ne(a)},We.defocus=function(a){function b(a){zc(a).transition().duration(100).style("opacity",.3)}var c=mi.selectAll(Yc(a)),d=c.filter(Re),e=c.filter(Se);We.revert(),b(d.classed(f.focused,!1)),b(e),Kd(We.data.targets)&&Lb(a),Oe(a)},We.revert=function(a){function b(a){zc(a).transition().duration(100).style("opacity",1)}var c=mi.selectAll(Yc(a)),d=c.filter(Re),e=c.filter(Se);b(d.classed(f.focused,!1)),b(e),Kd(We.data.targets)&&Lb(a),Pe()},We.show=function(a){Dc(a),mi.selectAll(Yc(a)).transition().style("opacity",1),Ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!1})},We.hide=function(a){Cc(a),mi.selectAll(Yc(a)).transition().style("opacity",0),Ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!1})},We.toggle=function(a){yc(a)?We.hide(a):We.show(a)},We.unzoom=function(){hi.clear().update(),Ce({withUpdateXDomain:!0})},We.load=function(a){return a.xs&&ic(a.xs),"categories"in a&&Nh&&(yg=a.categories,Of.categories(yg)),"cacheIds"in a&&_b(a.cacheIds)?void Je(bc(a.cacheIds),a.done):void("unload"in a?Le("string"==typeof a.unload?[a.unload]:"boolean"==typeof a.unload&&a.unload?vc():a.unload,function(){Ke(a)}):Ke(a))},We.unload=function(a){Le(a?"string"==typeof a?[a]:a:vc(),function(){Ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},We.selected=function(a){return Ve.merge(oi.selectAll("."+f.shapes+Xc(a)).selectAll("."+f.shape).filter(function(){return Ve.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},We.select=function(a,b,c){eg&&oi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=Ve.select(this),i="circle"===this.nodeName?ce:fe,j="circle"===this.nodeName?de:ge,k=fg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?gg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},We.unselect=function(a,b){eg&&oi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=Ve.select(this),g="circle"===this.nodeName?de:ge,h=fg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&gg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},We.toLine=function(a){Ue(a,"line")},We.toSpline=function(a){Ue(a,"spline")},We.toBar=function(a){Ue(a,"bar")},We.toScatter=function(a){Ue(a,"scatter")},We.toArea=function(a){Ue(a,"area")},We.toAreaSpline=function(a){Ue(a,"area-spline")},We.toPie=function(a){Ue(a,"pie",{withTransform:!0})},We.toDonut=function(a){Ue(a,"donut",{withTransform:!0})},We.groups=function(a){return c(a)?Xf:(Xf=a,Ce(),Xf)},We.xgrids=function(a){return a?(bh=a,Ce(),bh):bh},We.xgrids.add=function(a){return a?We.xgrids(bh.concat(a)):void 0},We.xgrids.remove=function(a){var b=Te(a);return We.xgrids(bh.filter(b))},We.ygrids=function(a){return a?(dh=a,Ce(),dh):dh},We.ygrids.add=function(a){return a?We.ygrids(dh.concat(a)):void 0},We.ygrids.remove=function(a){var b=Te(a);return We.ygrids(dh.filter(b))},We.regions=function(a){return c(a)?yh:(yh=a,Ce(),yh)},We.regions.add=function(a){return c(a)?yh:(yh=yh.concat(a),Ce(),yh)},We.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;mi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),yh=yh.filter(function(b){return b.classes.indexOf(a)<0})}),yh},We.data.get=function(a){var b=We.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},We.data.getAsTarget=function(a){var b=xc(function(b){return b.id===a});return b.length>0?b[0]:void 0},We.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Wf[b]=a[b]}),Qe(We.data.targets,{withTransition:!0}),Wf):Wf},We.x=function(a){return arguments.length&&(kc(We.data.targets,a),Ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),We.data.x},We.xs=function(a){return arguments.length&&(lc(We.data.targets,a),Ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),We.data.x},We.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},We.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Kg=+a.y),b(a.y2)&&(Tg=+a.y2)):Kg=Tg=+a,Ce())},We.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Lg=+a.y),b(a.y2)&&(Ug=+a.y2)):Lg=Ug=+a,Ce())},We.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&We.axis.max(a.max),"undefined"!=typeof a.min&&We.axis.min(a.min))},We.resize=function(a){Ze=a?a.width:null,$e=a?a.height:null,He({withLegend:!0,withTransition:!1})},We.destroy=function(){We.data.targets=void 0,We.data.x={},si.html(""),a.onresize=null},"url"in e.data)Ve.csv(e.data.url,function(a,b){ve(b)});else if("rows"in e.data)ve(nc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");ve(oc(e.data.columns))}return We},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 0a3333bd1e89c49786e5d4dd3d15d105eac23764 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Sun, 6 Apr 2014 21:00:59 +0900 Subject: [PATCH 012/178] Fix show/hide API and refactor target ids --- c3.js | 54 +++++++++++++++++++++++++++++------------------------- c3.min.js | 4 ++-- 2 files changed, 31 insertions(+), 27 deletions(-) diff --git a/c3.js b/c3.js index d1f90cd..84ce3cd 100644 --- a/c3.js +++ b/c3.js @@ -1085,7 +1085,7 @@ //-- Domain --// function getYDomainMin(targets) { - var ids = getTargetIds(targets), ys = getValuesAsIdKeyed(targets), j, k, baseId, idsInGroup, id, hasNegativeValue; + var ids = mapToIds(targets), ys = getValuesAsIdKeyed(targets), j, k, baseId, idsInGroup, id, hasNegativeValue; if (__data_groups.length > 0) { hasNegativeValue = hasNegativeValueInTargets(targets); for (j = 0; j < __data_groups.length; j++) { @@ -1114,7 +1114,7 @@ return d3.min(Object.keys(ys).map(function (key) { return d3.min(ys[key]); })); } function getYDomainMax(targets) { - var ids = getTargetIds(targets), ys = getValuesAsIdKeyed(targets), j, k, baseId, idsInGroup, id, hasPositiveValue; + var ids = mapToIds(targets), ys = getValuesAsIdKeyed(targets), j, k, baseId, idsInGroup, id, hasPositiveValue; if (__data_groups.length > 0) { hasPositiveValue = hasPositiveValueInTargets(targets); for (j = 0; j < __data_groups.length; j++) { @@ -1397,7 +1397,7 @@ // set target types if (__data_type) { - setTargetType(getTargetIds(targets).filter(function (id) { return ! (id in __data_types); }), __data_type); + setTargetType(mapToIds(targets).filter(function (id) { return ! (id in __data_types); }), __data_type); } // cache as original id keyed @@ -1439,12 +1439,14 @@ } return maxTarget; } - function getTargetIds(targets) { - targets = isUndefined(targets) ? c3.data.targets : targets; + function mapToIds(targets) { return targets.map(function (d) { return d.id; }); } - function hasTarget(id) { - var ids = getTargetIds(), i; + function mapToTargetIds(ids) { + return ids ? (typeof ids === 'string' ? [ids] : ids) : mapToIds(c3.data.targets); + } + function hasTarget(targets, id) { + var ids = mapToIds(targets), i; for (i = 0; i < ids.length; i++) { if (ids[i] === id) { return true; @@ -1549,6 +1551,7 @@ return targetId || targetId === 0 ? '-' + (targetId.replace ? targetId.replace(/([^a-zA-Z0-9-_])/g, '-') : targetId) : ''; } function selectorTarget(id) { return '.' + CLASS.target + getTargetSelectorSuffix(id); } + function selectorTargets(ids) { return ids.map(function (id) { return selectorTarget(id); }); } function initialOpacity(d) { return d.value !== null && withoutFadeIn[d.id] ? 1 : 0; @@ -1840,11 +1843,10 @@ //-- 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; - } + mapToTargetIds(targetIds).forEach(function (id) { + withoutFadeIn[id] = (type === __data_types[id]); + __data_types[id] = type; + }); } function hasType(targets, type) { var has = false; @@ -3288,7 +3290,7 @@ .remove(); // update fadein condition - getTargetIds().forEach(function (id) { + mapToIds(c3.data.targets).forEach(function (id) { withoutFadeIn[id] = true; }); } @@ -3545,7 +3547,7 @@ done = function () {}; } // filter existing target - targetIds = targetIds.filter(function (id) { return hasTarget(id); }); + targetIds = targetIds.filter(function (id) { return hasTarget(c3.data.targets, id); }); // If no target, call done and return if (!targetIds || targetIds.length === 0) { done(); @@ -3595,7 +3597,7 @@ } function updateLegend(targets, options) { - var ids = getTargetIds(targets), l; + var ids = mapToIds(targets), l; var xForLegend, xForLegendText, xForLegendRect, yForLegend, yForLegendText, yForLegendRect; var paddingTop = 4, paddingRight = 26, maxWidth = 0, maxHeight = 0, posMin = 10; var totalLength = 0, offsets = {}, widths = {}, heights = {}, margins = {}, steps = {}, step = 0; @@ -3743,10 +3745,10 @@ /*-- Event Handling --*/ function isNoneArc(d) { - return hasTarget(d.id); + return hasTarget(c3.data.targets, d.id); } function isArc(d) { - return 'data' in d && hasTarget(d.data.id); + return 'data' in d && hasTarget(c3.data.targets, d.data.id); } function getGridFilter(params) { var value = params && params.value ? params.value : null, @@ -3807,17 +3809,19 @@ revertLegend(); }; - c3.show = function (targetId) { - removeHiddenTargetIds(targetId); - svg.selectAll(selectorTarget(targetId)) + c3.show = function (targetIds) { + targetIds = mapToTargetIds(targetIds); + removeHiddenTargetIds(targetIds); + svg.selectAll(selectorTargets(targetIds)) .transition() .style('opacity', 1); redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: false}); }; - c3.hide = function (targetId) { - addHiddenTargetIds(targetId); - svg.selectAll(selectorTarget(targetId)) + c3.hide = function (targetIds) { + targetIds = mapToTargetIds(targetIds); + addHiddenTargetIds(targetIds); + svg.selectAll(selectorTargets(targetIds)) .transition() .style('opacity', 0); redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: false}); @@ -3850,7 +3854,7 @@ // unload if needed if ('unload' in args) { // TODO: do not unload if target will load (included in url/rows/columns) - unload(typeof args.unload === 'string' ? [args.unload] : typeof args.unload === 'boolean' && args.unload ? getTargetIds() : args.unload, function () { + unload(mapToTargetIds((typeof args.unload === 'boolean' && args.unload) ? null : args.unload), function () { loadFromArgs(args); }); } else { @@ -3859,7 +3863,7 @@ }; c3.unload = function (targetIds) { - unload(targetIds ? typeof targetIds === 'string' ? [targetIds] : targetIds : getTargetIds(), function () { + unload(mapToTargetIds(targetIds), function () { redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: true}); }); }; diff --git a/c3.min.js b/c3.min.js index 0eb62e7..ba6055a 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.28"},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;clf&&(lf=0),0>nf&&(nf=0),jf={top:wg?hf.top:qf-qg-(ai?0:rf),right:0/0,bottom:20+(ai?0:rf),left:wg?ei:hf.left},mf=wg?hf.left-ei-fi:lf,of=wg?nf:qf-jf.top-jf.bottom,0>mf&&(mf=0),0>of&&(of=0),kf={top:ai?0:qf-rf,right:0/0,bottom:0,left:ai?pf-sf:0},p(),ai&&Kd(We.data.targets)&&(kf.left=lf/2+uf)}function o(){oi.select("line."+f.xgridFocus).attr("x1",wg?0:-10).attr("x2",wg?lf:-10).attr("y1",wg?-10:hf.top).attr("y2",wg?-10:nf)}function p(){uf=nf/2,tf=.95*uf,vf=Jd(We.data.targets)?.6*tf:0}function q(){var a=wg?f.axisX:f.axisY,b=Ve.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Ve.select(Ye).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Ze?Ze:x()}function s(){var a=$e?$e:y();return a>0?a:320}function t(){return Kd(We.data.targets)?0:_e?_e:wg||!Jg||Og?1:v("y")}function u(){var a=1;return Kd(We.data.targets)?0:af?af:ai?sf+(Sg&&!wg?v("y2"):a):Sg?Xg||wg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||Jg?"y2"!==a||Sg?(gb(a).isInner?30:40)+("y2"===a?-10:0):gi:sg&&!ai?10:1}function x(){return+Ve.select(Ye).style("width").replace("px","")}function y(){return+Ve.select(Ye).style("height").replace("px","")}function z(a){return a?-5:-(hf.left-1)}function A(a){return a?-20:-1}function B(){return z(!wg)}function C(){return A(!wg)}function D(){return z(wg)}function E(){return A(wg)}function F(a){return a?lf+2+4:hf.left+20}function G(a){return a?80:nf+2}function H(){return F(!wg)}function I(){return G(!wg)}function J(){return F(wg)}function K(){return G(wg)}function L(){var a=wg?nf:lf,b=tc(),c=Vb()*(Gd(We.data.targets)?(b-(Nh?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){bi=a}function N(a){ci=a}function O(a){di=a}function P(){return sg?ai?ci*(bi+1):pf:0}function Q(){return sg?ai?qf:di*(bi+1):0}function R(){var a,b=!If;Af=wg?1:0,Bf=wg?nf:lf,Cf=wg?0:nf,Df=wg?lf:1,Ef=Af,Ff=Bf,Gf=wg?0:of,Hf=wg?mf:1,If=T(Af,Bf,b?void 0:If.domain(),function(){return Of.tickOffset()}),Jf=U(Cf,Df),Kf=U(Cf,Df),Lf=T(Af,Bf,ti,function(a){return a%1?0:Rf.tickOffset()}),Mf=U(Gf,Hf),Nf=U(Gf,Hf),a=$(),Of=X(If,Xh,a),Rf=X(Lf,$h,a),Pf=Y(Jf,Yh,Pg,Rg),Qf=Y(Kf,Zh,Yg,$g),b||(hi.scale(Lf),bf&&li.scale(If)),S()}function S(){wf=Db(),xf=Eb(),yf=Eb(.98)}function T(a,b,e,f){var g=(Mh?Ve.time.scale():Ve.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),Nh){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return Ve.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?Kf:Jf}function W(a){return"y2"===Z(a)?Nf:Mf}function X(a,b,c){var d=(Nh?Bb():Ve.svg.axis()).scale(a).orient(b);return d.tickFormat(c),Nh?d.tickCentered(zg):d.tickOffset=function(){var a=wg?nf:lf;return a*Vb()/tc()/2},Nh&&d.categories(yg),d}function Y(a,b,c,d){return Ve.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Yf?Yf[a]:"y"}function $(){var a=Mh?Vh:Nh?Ic:function(a){return 0>a?a.toFixed(0):a};return Ag&&("function"==typeof Ag?a=Ag:Mh&&(a=function(a){return Ve.time.format(Ag)(a)})),a}function _(a){var b;return"y"===a?b=Ng:"y2"===a?b=Wg:"x"===a&&(b=Ig),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Ng=b:"y2"===a?Wg=b:"x"===a&&(Ig=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",wg?"inner-top":"inner-right")}function eb(){return cb("y",wg?"inner-right":"inner-top")}function fb(){return cb("y2",wg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?lf/2:lf:b.isBottom?-nf:b.isMiddle?-nf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!wg,db())}function ob(){return kb(wg,eb())}function pb(){return kb(wg,fb())}function qb(){return lb(!wg,db())}function rb(){return lb(wg,eb())}function sb(){return lb(wg,fb())}function tb(){var a=db();return wg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return wg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return wg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!wg,db())}function xb(){return mb(wg,eb())}function yb(){return mb(wg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return Ve.selectAll("."+c+" .tick text").each(function(){var a=this.getBBox();bb?20:b}function Ab(){oi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),oi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),oi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=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]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return Ve.min(Object.keys(i).map(function(a){return Ve.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=vc(a),i=Ec(a);if(Xf.length>0)for(g=Hc(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 Ve.max(Object.keys(i).map(function(a){return Ve.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Ug:Lg,n="y2"===c?Tg:Kg,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?Vg:Mg,r=bd()&&wg;return 0===l.length?"y2"===c?Kf.domain():Jf.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=cd(o,p),j=$b(Jf.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Qg&&(f=b(Qg.top)?Qg.top:e,g=b(Qg.bottom)?Qg.bottom:e),"y2"===c&&Zg&&(f=b(Zg.top)?Zg.top:e,g=b(Zg.bottom)?Zg.bottom:e),Gd(l)&&!Gc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(ti),c=$b(If.domain());return a||0===c?1:b/c}function Wb(a){return Gg?Gg:Ve.min(a,function(a){return Ve.min(a.values,function(a){return a.x})})}function Xb(a){return Fg?Fg:Ve.max(a,function(a){return Ve.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return Nh?d=0:Gd(a)?(c=tc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=Mh?new Date(c.getTime()-e):c-e,g=Mh?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return Sf&&a===Sf||$d(Tf)&&_d(Tf,a)}function fc(a){return!ec(a)}function gc(a){return Sf?Sf:$d(Tf)?Tf[a]:null}function hc(a,b){return a in We.data.x&&We.data.x[a]&&We.data.x[a][b]?We.data.x[a][b]:b}function ic(a){Object.keys(a).forEach(function(b){Tf[b]=a[b]})}function jc(a){var b;return a&&(b=Wf[a.id],a.name=b?b:a.id),a}function kc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=mc(b[d],a.id,d)}),We.data.x[a.id]=b})}function lc(a,b){a.forEach(function(a){b[a.id]&&kc([a],b[a.id])})}function mc(a,b,c){var d;return d=Mh?a?a instanceof Date?a:Wd(a):Wd(hc(b,c)):Oh&&!Nh?a?+a:hc(b,c):c}function nc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0&&(We.data.x[b]=a.map(function(a){return a[c]})):We.data.x[b]=a.map(function(a,b){return b})}),c.forEach(function(a){if(!We.data.x[a])throw new Error('x is not defined for id = "'+a+'".')}),b=c.map(function(b,c){var d=Vf(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=mc(g,b,e);return Oh&&Nh&&0===c&&g&&(0===e&&(yg=[]),yg.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++})}),Zf&&Ed(vc(b).filter(function(a){return!(a in $f)}),Zf),b.forEach(function(a){ac(a.id_org,a)}),b}function qc(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 rc(a){return a>0&&We.data.targets[0].values[a-1]?We.data.targets[0].values[a-1].x:void 0}function sc(a){return a1?We.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?We.data.targets[0]:null,a}function vc(a){return a=c(a)?We.data.targets:a,a.map(function(a){return a.id})}function wc(a){var b,c=vc();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(Mh?new Date(h):h);i.push(d)}return i}function Cc(a){Wh=Wh.concat(a)}function Dc(a){Wh=Wh.filter(function(b){return a.indexOf(b)<0})}function Ec(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Fc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Hc(a){return Fc(a,function(a){return a>0})}function Ic(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(kd(a,f))),a[g].x&&(e=e.concat(kd(a,g))),nd(e,b)):ld(a,b,f,g)}function md(a,b){var c;return c=a.map(function(a){return ld(a.values,b)}),nd(c,b)}function nd(a,b){var c,d;return a.forEach(function(a){var e=ae(a,b);(c>e||!c)&&(c=e,d=a)}),d}function od(a,b){return Ve.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function pd(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 qd(){return ag&&"desc"===ag.toLowerCase()}function rd(){return ag&&"asc"===ag.toLowerCase()}function sd(a){var b=rd(),c=qd();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 ag&&a.sort(ag),a}function td(a,c){var d,e,f,g,h,i,j,k=Kd(We.data.targets),l=k?ed:dd,m=a.filter(function(a){return a&&b(a.value)});zh&&0!==m.length&&(ri.html(Ch(a,$(),l,Uh)).style("display","block"),d=ri.property("offsetWidth"),e=ri.property("offsetHeight"),k?(g=lf/2+c[0],i=nf/2+c[1]+20):(wg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=If(m[0].x)+20):(f=q(),g=f+t()+If(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),ri.style("top",i+"px").style("left",g+"px"))}function ud(){ri.style("display","none")}function vd(a){var c=a.filter(function(a){return a&&b(a.value)});zh&&(Hd(We.data.targets)||Kd(We.data.targets)||oi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(wg?"y1":"x1",gd).attr(wg?"y2":"x2",gd))}function wd(){oi.select("line."+f.xgridFocus).style("visibility","hidden")}function xd(a){return a.x||0===a.x?If(a.x):null}function yd(a){return V(a.id)(a.value)}function zd(){var a,b,d={},e=0;return zc(xc(Nd)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Dd(a,b){return lh?lh:b?2*a.tickOffset()*mh/b:0}function Ed(a,b){var c,d=a?"string"==typeof a?[a]:a:vc();for(c=0;c0}function _d(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ae(a,b){var c="y"===Z(a.id)?Jf:Kf,d=wg?1:0,e=wg?0:1;return Math.pow(If(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function be(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function ce(a,b,c){lg(b,a.node()),oi.select("."+f.selectedCircles+Xc(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Jc(f.selectedCircle,c)}).attr("cx",wg?yd:xd).attr("cy",wg?xd:yd).attr("stroke",function(){return Uh(b)}).attr("r",1.4*kh).transition().duration(100).attr("r",kh)}function de(a,b,c){mg(b,a.node()),oi.select("."+f.selectedCircles+Xc(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ee(a,b,c,d){a?ce(b,c,d):de(b,c,d)}function fe(a,b){lg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ve.rgb(Uh(b)).darker(1)})}function ge(a,b){mg(b,a.node()),a.transition().duration(100).style("fill",function(){return Uh(b)})}function he(a,b,c,d){a?fe(b,c,d):ge(b,c,d)}function ie(a){return a.filter(function(a){return b(a.value)})}function je(a,c){return(c?oi.selectAll("."+f.circles+Xc(c)):oi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ke(a,b){je(a,b).classed(f.EXPANDED,!0).attr("r",jh)}function le(a){je(a).filter(function(){return Ve.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",gh)}function me(a){return oi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function ne(a){me(a).classed(f.EXPANDED,!0)}function oe(a){me(a).classed(f.EXPANDED,!1)}function pe(a,b){var c=te(a,b);return function(a,b){var d=c(a,b),e=wg?1:0,f=wg?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 qe(a,b){var c=te(a,!1),d=b?re:se;return function(a,b){return d(c(a,b),a,this)}}function re(a,b){var c;return wg?(c=Nd(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function se(a,b,c){var d=c.getBBox();return wg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:Nd(b)?-3:-6)}function te(a,b){var c=a.__max__+1,d=Dd(Of,c),e=Ad(d,c,a,!!b),f=Bd(!!b),g=Cd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return wg&&(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 ue(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 ve(b){var c,d,e;if(si=Ve.select(Ye),si.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(si.html(""),si.classed("c3",!0),We.data.x={},We.data.targets=pc(b),n(),R(),If.domain(Ve.extent(Zb(We.data.targets))),Jf.domain(Ub(We.data.targets,"y")),Kf.domain(Ub(We.data.targets,"y2")),Lf.domain(If.domain()),Mf.domain(Jf.domain()),Nf.domain(Kf.domain()),ti=If.domain(),hi.scale(Lf),bf&&li.scale(If),mi=si.append("svg").attr("width",lf+hf.left+hf.right).attr("height",nf+hf.top+hf.bottom).on("mouseenter",ef).on("mouseleave",ff),ni=mi.append("defs"),ni.append("clipPath").attr("id",Gh).append("rect").attr("width",lf).attr("height",nf),ni.append("clipPath").attr("id",Hh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),ni.append("clipPath").attr("id",Ih).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),oi=mi.append("g").attr("transform",_h.main),pi=pg?mi.append("g").attr("transform",_h.context):null,qi=sg?mi.append("g").attr("transform",_h.legend):null,ri=Ve.select(Ye).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),oi.append("g").attr("class",f.axisX).attr("clip-path",wg?"":Kh).attr("transform",_h.x).append("text").attr("class",f.axisXLabel).attr("transform",wg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),Jg&&oi.append("g").attr("class",f.axisY).attr("clip-path",wg?Lh:"").append("text").attr("class",f.axisYLabel).attr("transform",wg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),Sg&&oi.append("g").attr("class",f.axisY2).attr("transform",_h.y2).append("text").attr("class",f.axisY2Label).attr("transform",wg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=oi.append("g").attr("clip-path",Jh).attr("class",f.grid),_g&&d.append("g").attr("class",f.xgrids),$d(bh)&&d.append("g").attr("class",f.xgridLines),hh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),ch&&d.append("g").attr("class",f.ygrids),$d(dh)&&d.append("g").attr("class",f.ygridLines),oi.append("g").attr("clip-path",Jh).attr("class",f.regions),oi.append("g").attr("clip-path",Jh).attr("class",f.chart),c=oi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",bf?wg?"ns-resize":"ew-resize":null),oi.select("."+f.chart).append("g").attr("class",f.chartBars),oi.select("."+f.chart).append("g").attr("class",f.chartLines),oi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",_h.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),oi.select("."+f.chart).append("g").attr("class",f.chartTexts),bf&&oi.insert("rect",df?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",lf).attr("height",nf).style("opacity",0).style("cursor",wg?"ns-resize":"ew-resize").call(li).on("dblclick.zoom",null),Hg&&hi.extent("function"!=typeof Hg?Hg:Hg(Zb())),pg&&(pi.append("g").attr("clip-path",Jh).attr("class",f.chart),pi.select("."+f.chart).append("g").attr("class",f.chartBars),pi.select("."+f.chart).append("g").attr("class",f.chartLines),pi.append("g").attr("clip-path",Jh).attr("class",f.brush).call(hi).selectAll("rect").attr(wg?"width":"height",wg?mf:of),pi.append("g").attr("class",f.axisX).attr("transform",_h.subx).attr("clip-path",wg?"":Kh)),Ie(We.data.targets),wg?oi.select("."+f.axisX).style("opacity",0).call(Of):(oi.select("."+f.axisY).style("opacity",0).call(Pf),oi.select("."+f.axisY2).style("opacity",0).call(Qf)),He({withTransform:!0,withLegend:!0,withTransitionForAxis:!1}),Dh){if(Mh&&"string"==typeof Eh){for(Eh=Wd(Eh),e=0;e0){d=[];for(var g in Wf)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=pd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=he,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 Ae(a){Kd(We.data.targets)||eg&&(Ph=a,oi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Qh=!0,ng())}function Be(){Kd(We.data.targets)||eg&&(oi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),oi.selectAll("."+f.shape).classed(f.INCLUDED,!1),Qh=!1,og())}function Ce(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P=zd(),Q=Kd(We.data.targets),R=zc(We.data.targets);if(0!==R.length){if(a=d(a)?a:{},v=d(a.withY)?a.withY:!0,w=d(a.withSubchart)?a.withSubchart:!0,x=d(a.withTransition)?a.withTransition:!0,A=d(a.withTransform)?a.withTransform:!1,B=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,C=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,D=d(a.withLegend)?a.withLegend:!1,y=d(a.withTransitionForExit)?a.withTransitionForExit:x,z=d(a.withTransitionForAxis)?a.withTransitionForAxis:x,I=x?gf:0,J=y?I:0,K=z?I:0,D&&sg&&Qe(We.data.targets,a),C&&(If.domain(Ve.extent(Zb(R))),ti=If.domain(),bf&&li.scale(If).updateScaleExtent(),Lf.domain(If.domain()),hi.scale(Lf)),B&&(If.domain(hi.empty()?ti:hi.extent()),bf&&li.scale(If).updateScaleExtent(),Hd(R)||(M=Bc(Ac(R)).sort(),Of.tickValues(M),Rf.tickValues(M))),Jf.domain(Ub(R,"y")),Kf.domain(Ub(R,"y2")),oi.select("."+f.axisX).style("opacity",Q?0:1).transition().duration(K).call(Of),oi.select("."+f.axisY).style("opacity",Q?0:1).transition().duration(K).call(Pf),oi.select("."+f.axisY2).style("opacity",Q?0:1).transition().duration(K).call(Qf),B&&Bg&&M){for(N=1;N=V;V++)e.push(new Date(V+"-01-01 00:00:00"))}else e=If.ticks(10);c=oi.select("."+f.xgrids).selectAll("."+f.xgrid).data(e),c.enter().append("line").attr("class",f.xgrid),c.attr("x1",wg?0:function(a){return If(a)-Of.tickOffset()}).attr("x2",wg?lf:function(a){return If(a)-Of.tickOffset()}).attr("y1",wg?function(a){return If(a)-Of.tickOffset()}:hf.top).attr("y2",wg?function(a){return If(a)-Of.tickOffset()}:nf).style("opacity",function(){return+Ve.select(this).attr(wg?"y1":"x1")===(wg?nf:0)?0:1}),c.exit().remove()}$d(bh)&&(g=oi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(bh),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",wg?"":"rotate(-90)").attr("dx",wg?0:-hf.top).attr("dy",-5).style("opacity",0),g.select("line").transition().duration(I).attr("x1",wg?0:hd).attr("x2",wg?lf:hd).attr("y1",wg?hd:hf.top).attr("y2",wg?hd:nf).style("opacity",1),g.select("text").transition().duration(I).attr("x",wg?lf:0).attr("y",hd).text(function(a){return a.text}).style("opacity",1),g.exit().transition().duration(I).style("opacity",0).remove()),v&&ch&&(i=oi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Jf.ticks(eh)),i.enter().append("line").attr("class",f.ygrid),i.attr("x1",wg?Jf:0).attr("x2",wg?Jf:lf).attr("y1",wg?0:Jf).attr("y2",wg?nf:Jf),i.exit().remove()),v&&$d(dh)&&(j=oi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(dh),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",wg?"rotate(-90)":"").attr("dx",wg?0:-hf.top).attr("dy",-5).style("opacity",0),j.select("line").transition().duration(I).attr("x1",wg?id:0).attr("x2",wg?id:lf).attr("y1",wg?0:id).attr("y2",wg?nf:id).style("opacity",1),j.select("text").transition().duration(I).attr("x",wg?0:lf).attr("y",id).text(function(a){return a.text}).style("opacity",1),j.exit().transition().duration(I).style("opacity",0).remove()),m=oi.selectAll("."+f.bars).selectAll("."+f.bar).data(Sd),m.enter().append("path").attr("d",E).style("stroke","none").style("opacity",0).style("fill",function(a){return Uh(a)}).attr("class",Rc),m.style("opacity",Zc).transition().duration(I).attr("d",E).style("opacity",1),m.exit().transition().duration(J).style("opacity",0).remove(),p=oi.selectAll("."+f.texts).selectAll("."+f.text).data(Ud),p.enter().append("text").attr("class",Kc).attr("text-anchor",function(a){return wg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),p.text(function(a){return fd(a.id)(a.value)}).style("fill-opacity",$c).transition().duration(I).attr("x",G).attr("y",H).style("fill-opacity",ad),p.exit().transition().duration(J).style("fill-opacity",0).remove(),oi.selectAll("."+f.line).style("opacity",Zc).transition().duration(I).attr("d",ii).style("opacity",1),oi.selectAll("."+f.area).style("opacity",0).transition().duration(I).attr("d",ji).style("opacity",ui),l=oi.selectAll("."+f.circles).selectAll("."+f.circle).data(Td),l.enter().append("circle").attr("class",Pc).style("opacity",0).attr("r",gh),l.style("opacity",Zc).transition().duration(I).style("opacity",_c).attr("cx",wg?yd:xd).attr("cy",wg?xd:yd),l.exit().remove(),oi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",A?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(I).attrTween("d",function(a){var b,c=Cb(a);return c?(b=Ve.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",A?"scale(1)":"").style("opacity",1),oi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(I).text(Jb).style("opacity",function(a){return yc(a.data.id)&&Rd(a.data)?1:0}),oi.select("."+f.chartArcsTitle).style("opacity",Jd(We.data.targets)?1:0),pg&&(null!==Ve.event&&"zoom"===Ve.event.type&&hi.extent(If.orgDomain()).update(),w&&(pi.select("."+f.axisX).style("opacity",Q?0:1).transition().duration(I).call(Rf),hi.empty()||hi.extent(If.orgDomain()).update(),F=pe(P,!0),q=pi.selectAll("."+f.bars).selectAll("."+f.bar).data(Sd),q.enter().append("path").attr("d",F).style("stroke","none").style("fill",function(a){return Uh(a)}).attr("class",Rc),q.style("opacity",Zc).transition().duration(I).attr("d",F).style("opacity",1),q.exit().transition().duration(I).style("opacity",0).remove(),pi.selectAll("."+f.line).style("opacity",Zc).transition().duration(I).attr("d",ki).style("opacity",1))),oi.selectAll("."+f.selectedCircles).filter(function(a){return Nd(a)}).selectAll("circle").remove(),oi.selectAll("."+f.selectedCircle).transition().duration(I).attr("cx",wg?yd:xd).attr("cy",wg?xd:yd),$d(Tf)?(r=oi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),xe(r.enter()),r.attr("x",0).attr("y",0).attr("width",lf).attr("height",nf)):(Oh&&!Nh?(u=function(a,b){var c=rc(b),d=sc(b),e=We.data.x[a.id][b];return(If(d?d:e+50)-If(c?c:e-50))/2},t=function(a,b){var c=rc(b),d=We.data.x[a.id][b];return(If(d)+If(c?c:d-50))/2}):(u=L(),t=function(a){return If(a.x)-u/2}),s=uc(),oi.select("."+f.eventRects).datum(s?s.values:[]),r=oi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),we(r.enter()),r.attr("class",Wc).attr("x",wg?0:t).attr("y",wg?t:0).attr("width",wg?lf:u).attr("height",wg?u:nf),r.exit().remove()),n=oi.select("."+f.regions).selectAll("rect."+f.region).data(yh),n.enter().append("rect").style("fill-opacity",0),n.attr("class",Vc).attr("x",wg?0:cc).attr("y",wg?cc:hf.top).attr("width",wg?lf:dc).attr("height",wg?dc:nf).transition().duration(I).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),n.exit().transition().duration(I).style("fill-opacity",0).remove(),vc().forEach(function(a){vi[a]=!0})}}function De(){Ce({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ee(){return"mousemove"===Ve.event.sourceEvent.type&&li.altDomain?(If.domain(li.altDomain),void li.scale(If).updateScaleExtent()):(Nh&&If.orgDomain()[0]===ti[0]&&If.domain([ti[0]-1e-10,If.orgDomain()[1]]),Ce({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Ve.event.sourceEvent.type&&(Rh=!0)))}function Fe(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ge(){mi.attr("width",pf).attr("height",qf),mi.select("#"+Gh).select("rect").attr("width",lf).attr("height",nf),mi.select("#"+Hh).select("rect").attr("width",H),mi.select("#"+Ih).select("rect").attr("width",J),mi.select("."+f.zoomRect).attr("width",lf).attr("height",nf)}function He(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(),R(),Ge(),m(a.withTransition),Ce(a)}function Ie(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=oi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a),j=i.enter().append("g").attr("class",function(a){return f.chartText+Jc(f.target,a.id)}).style("pointer-events","none"),j.append("g").attr("class",Lc).style("fill",function(a){return Uh(a)}),e=oi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),d=e.enter().append("g").attr("class",function(a){return f.chartBar+Jc(f.target,a.id)}).style("pointer-events","none"),d.append("g").attr("class",Sc).style("fill",function(a){return Uh(a)}).style("stroke","none").style("cursor",function(a){return gg(a)?"pointer":null}),c=oi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),b=c.enter().append("g").attr("class",function(a){return f.chartLine+Jc(f.target,a.id)}).style("pointer-events","none"),b.append("path").attr("class",Oc).style("opacity",0).style("stroke",function(a){return Uh(a)}),b.append("path").attr("class",Uc).style("opacity",function(){return ui=+Ve.select(this).style("opacity"),0}).style("fill",function(a){return Uh(a)}),b.append("g").attr("class",function(a){return Jc(f.selectedCircles,a.id)}),b.append("g").attr("class",Qc).style("fill",function(a){return Uh(a)}).style("cursor",function(a){return gg(a)?"pointer":null}),a.forEach(function(a){oi.selectAll("."+f.selectedCircles+Xc(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=oi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(zf(a)),g=h.enter().append("g").attr("class",function(a){return f.chartArc+Jc(f.target,a.data.id)}),g.append("path").attr("class",Tc).style("opacity",0).style("fill",function(a){return Uh(a.data)}).style("cursor",function(a){return gg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),Ne(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];td(c,Ve.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),Pe(),ud(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),pg&&(n=pi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),m=n.enter().append("g").attr("class",function(a){return f.chartBar+Jc(f.target,a.id)}),m.append("g").attr("class",Sc).style("fill",function(a){return Uh(a)}),l=pi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),k=l.enter().append("g").attr("class",function(a){return f.chartLine+Jc(f.target,a.id)}),k.append("path").attr("class",Oc).style("opacity",0).style("stroke",function(a){return Uh(a)})),mi.selectAll("."+f.target).filter(function(a){return yc(a.id)}).transition().style("opacity",1)}function Je(a,b){We.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=ai?i:h,k=ai?rf:sf;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=ai?u:t,vg?(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=vc(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,ai?(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=qi.selectAll("."+f.legendItem).data(q).enter().append("g").attr("class",function(a){return Jc(f.legendItem,a)}).style("cursor","pointer").on("click",function(a){"function"==typeof ug?ug(a):We.toggle(a)}).on("mouseover",function(a){We.focus(a)}).on("mouseout",function(){We.revert()}),g.append("text").text(function(a){return d(Wf[a])?Wf[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",ai?i:-200).attr("y",ai?-200:l),g.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",ai?j:-200).attr("y",ai?-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 Uh(a)}).attr("x",ai?i:-200).attr("y",ai?-200:k).attr("width",10).attr("height",10),qi.selectAll("text").data(q).text(function(a){return d(Wf[a])?Wf[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",i).attr("y",l),qi.selectAll("rect."+f.legendItemEvent).data(q).transition().duration(p?250:0).attr("x",j).attr("y",o),qi.selectAll("rect."+f.legendItemTile).data(q).transition().duration(p?250:0).attr("x",h).attr("y",k),N(t),O(u),M(C),n(),R(),Ge(),m(!1)}function Re(a){return wc(a.id)}function Se(a){return"data"in a&&wc(a.data.id)}function Te(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 Ue(a,b,c){var d=!Kd(We.data.targets);Ed(a,b),He(c?c:{withTransitionForAxis:d})}var Ve=a.d3?a.d3:a.require?a.require("d3"):void 0,We={data:{},axis:{}},Xe={},Ye=h(["bindto"],"#chart"),Ze=h(["size","width"]),$e=h(["size","height"]),_e=h(["padding","left"]),af=h(["padding","right"]),bf=h(["zoom","enabled"],!1),cf=h(["zoom","extent"]),df=h(["zoom","privileged"],!1),ef=h(["onenter"],function(){}),ff=h(["onleave"],function(){}),gf=h(["transition","duration"],350);g("data","data is required in config");var 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,Rf,Sf=h(["data","x"]),Tf=h(["data","xs"],{}),Uf=h(["data","x_format"]),Vf=h(["data","id_converter"],function(a){return a}),Wf=h(["data","names"],{}),Xf=h(["data","groups"],[]),Yf=h(["data","axes"],{}),Zf=h(["data","type"]),$f=h(["data","types"],{}),_f=h(["data","labels"],{}),ag=h(["data","order"]),bg=h(["data","regions"],{}),cg=h(["data","color"]),dg=h(["data","colors"],{}),eg=h(["data","selection","enabled"],!1),fg=h(["data","selection","grouped"],!1),gg=h(["data","selection","isselectable"],function(){return!0}),hg=h(["data","selection","multiple"],!0),ig=h(["data","onclick"],function(){}),jg=h(["data","onenter"],function(){}),kg=h(["data","onleave"],function(){}),lg=h(["data","onselected"],function(){}),mg=h(["data","onunselected"],function(){}),ng=h(["data","ondragstart"],function(){}),og=h(["data","ondragend"],function(){}),pg=h(["subchart","show"],!1),qg=pg?h(["subchart","size","height"],60):0,rg=h(["color","pattern"],[]),sg=h(["legend","show"],!0),tg=h(["legend","position"],"bottom"),ug=h(["legend","item","onclick"]),vg=h(["legend","equally"],!1),wg=h(["axis","rotated"],!1),xg=h(["axis","x","type"],"indexed"),yg=h(["axis","x","categories"],[]),zg=h(["axis","x","tick","centered"],!1),Ag=h(["axis","x","tick","format"]),Bg=h(["axis","x","tick","culling"],{}),Cg=h(["axis","x","tick","culling","max"],"categorized"===xg?1/0:10),Dg=h(["axis","x","tick","count"]),Eg=h(["axis","x","tick","fit"],!1),Fg=h(["axis","x","max"]),Gg=h(["axis","x","min"]),Hg=h(["axis","x","default"]),Ig=h(["axis","x","label"],{}),Jg=h(["axis","y","show"],!0),Kg=h(["axis","y","max"]),Lg=h(["axis","y","min"]),Mg=h(["axis","y","center"]),Ng=h(["axis","y","label"],{}),Og=h(["axis","y","inner"],!1),Pg=h(["axis","y","tick","format"]),Qg=h(["axis","y","padding"],{}),Rg=h(["axis","y","ticks"],10),Sg=h(["axis","y2","show"],!1),Tg=h(["axis","y2","max"]),Ug=h(["axis","y2","min"]),Vg=h(["axis","y2","center"]),Wg=h(["axis","y2","label"],{}),Xg=h(["axis","y2","inner"],!1),Yg=h(["axis","y2","tick","format"]),Zg=h(["axis","y2","padding"],{}),$g=h(["axis","y2","ticks"],10),_g=h(["grid","x","show"],!1),ah=h(["grid","x","type"],"tick"),bh=h(["grid","x","lines"],[]),ch=h(["grid","y","show"],!1),dh=h(["grid","y","lines"],[]),eh=h(["grid","y","ticks"],10),fh=h(["point","show"],!0),gh=fh?h(["point","r"],2.5):0,hh=h(["point","focus","line","enabled"],!0),ih=h(["point","focus","expand","enabled"],!0),jh=h(["point","focus","expand","r"],ih?4:gh),kh=h(["point","focus","select","r"],8),lh=h(["bar","width"]),mh=h(["bar","width","ratio"],.6),nh=h(["pie","label","show"],!0),oh=h(["pie","label","format"]),ph=h(["pie","onclick"],function(){}),qh=h(["pie","onmouseover"],function(){}),rh=h(["pie","onmouseout"],function(){}),sh=h(["donut","label","show"],!0),th=h(["donut","label","format"]),uh=h(["donut","title"],""),vh=h(["donut","onclick"],function(){}),wh=h(["donut","onmouseover"],function(){}),xh=h(["donut","onmouseout"],function(){}),yh=h(["regions"],[]),zh=h(["tooltip","show"],!0),Ah=h(["tooltip","format","title"]),Bh=h(["tooltip","format","value"]),Ch=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Ah?Ah:b,l=Bh?Bh: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+""}),Dh=h(["tooltip","init","show"],!1),Eh=h(["tooltip","init","x"],0),Fh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Gh=("string"==typeof Ye?Ye.replace("#",""):Ye.id)+"-clip",Hh=Gh+"-xaxis",Ih=Gh+"-yaxis",Jh=i(Gh),Kh=i(Kh),Lh=i(Lh),Mh="timeseries"===xg,Nh="categorized"===xg,Oh=!Mh&&(Sf||$d(Tf)),Ph=null,Qh=!1,Rh=!1,Sh=!1,Th=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Uh=Vd(dg,$d(rg)?rg:Th,cg),Vh=function(){var a=[[Ve.time.format("%Y/%-m/%-d"),function(){return!0}],[Ve.time.format("%-m/%-d"),function(a){return a.getMonth()}],[Ve.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ve.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ve.time.format("%I %p"),function(a){return a.getHours()}],[Ve.time.format("%I:%M"),function(a){return a.getMinutes()}],[Ve.time.format(":%S"),function(a){return a.getSeconds()}],[Ve.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)}}(),Wh=[],Xh=wg?"left":"bottom",Yh=wg?Og?"top":"bottom":Og?"right":"left",Zh=wg?Xg?"bottom":"top":Xg?"left":"right",$h=wg?"left":"bottom",_h={main:function(){return"translate("+hf.left+","+hf.top+")"},context:function(){return"translate("+jf.left+","+jf.top+")"},legend:function(){return"translate("+kf.left+","+kf.top+")"},x:function(){return"translate(0,"+(wg?0:nf)+")"},y:function(){return"translate(0,"+(wg?nf:0)+")"},y2:function(){return"translate("+(wg?0:lf)+","+(wg?1:0)+")"},subx:function(){return"translate(0,"+(wg?0:of)+")"},arc:function(){return"translate("+lf/2+","+nf/2+")"}},ai="right"===tg,bi=0,ci=0,di=0,ei=30,fi=30,gi=5;zf=Ve.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var hi,ii=function(){var a=Ve.svg.line().x(wg?function(a){return V(a.id)(a.value)}:gd).y(wg?gd:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=ie(b.values);return Ld(b)?(a.interpolate(Md(b)?"cardinal":"linear"),bg[b.id]?ue(e,If,V(b.id),bg[b.id]):a(e)):(c=If(e[0].x),d=V(b.id)(e[0].value),wg?"M "+d+" "+c:"M "+c+" "+d)}}(),ji=function(){var a;return a=wg?Ve.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(gd):Ve.svg.area().x(gd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=ie(b.values);return Fd([b],"area")||Fd([b],"area-spline")?(a.interpolate(Md(b)?"cardinal":"linear"),a(e)):(c=If(e[0].x),d=V(b.id)(e[0].value),wg?"M "+d+" "+c:"M "+c+" "+d)}}(),ki=function(){var a=Ve.svg.line().x(wg?function(a){return W(a.id)(a.value)}:jd).y(wg?jd:function(a){return W(a.id)(a.value)});return function(b){var c=ie(b.values);return Ld(b)?a(c):"M "+Lf(c[0].x)+" "+W(b.id)(c[0].value)}}(),li=function(){};hi=Ve.svg.brush().on("brush",De),hi.update=function(){return pi&&pi.select("."+f.brush).call(this),this},hi.scale=function(a){return wg?this.y(a):this.x(a)},bf&&(li=Ve.behavior.zoom().on("zoomstart",function(){li.altDomain=Ve.event.sourceEvent.altKey?If.orgDomain():null}).on("zoom",bf?Ee:null),li.scale=function(a){return wg?this.y(a):this.x(a)},li.orgScaleExtent=function(){var a=cf?cf:[1,10];return[a[0],Math.max(tc()/a[1],a[1])]},li.updateScaleExtent=function(){var a=$b(If.orgDomain())/$b(ti),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var mi,ni,oi,pi,qi,ri,si,ti,ui,vi={};if(We.focus=function(a){function b(a){zc(a).transition().duration(100).style("opacity",1)}var c=mi.selectAll(Yc(a)),d=c.filter(Re),e=c.filter(Se);We.revert(),We.defocus(),b(d.classed(f.focused,!0)),b(e),Kd(We.data.targets)&&Kb(a,!0),Ne(a)},We.defocus=function(a){function b(a){zc(a).transition().duration(100).style("opacity",.3)}var c=mi.selectAll(Yc(a)),d=c.filter(Re),e=c.filter(Se);We.revert(),b(d.classed(f.focused,!1)),b(e),Kd(We.data.targets)&&Lb(a),Oe(a)},We.revert=function(a){function b(a){zc(a).transition().duration(100).style("opacity",1)}var c=mi.selectAll(Yc(a)),d=c.filter(Re),e=c.filter(Se);b(d.classed(f.focused,!1)),b(e),Kd(We.data.targets)&&Lb(a),Pe()},We.show=function(a){Dc(a),mi.selectAll(Yc(a)).transition().style("opacity",1),Ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!1})},We.hide=function(a){Cc(a),mi.selectAll(Yc(a)).transition().style("opacity",0),Ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!1})},We.toggle=function(a){yc(a)?We.hide(a):We.show(a)},We.unzoom=function(){hi.clear().update(),Ce({withUpdateXDomain:!0})},We.load=function(a){return a.xs&&ic(a.xs),"categories"in a&&Nh&&(yg=a.categories,Of.categories(yg)),"cacheIds"in a&&_b(a.cacheIds)?void Je(bc(a.cacheIds),a.done):void("unload"in a?Le("string"==typeof a.unload?[a.unload]:"boolean"==typeof a.unload&&a.unload?vc():a.unload,function(){Ke(a)}):Ke(a))},We.unload=function(a){Le(a?"string"==typeof a?[a]:a:vc(),function(){Ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},We.selected=function(a){return Ve.merge(oi.selectAll("."+f.shapes+Xc(a)).selectAll("."+f.shape).filter(function(){return Ve.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},We.select=function(a,b,c){eg&&oi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=Ve.select(this),i="circle"===this.nodeName?ce:fe,j="circle"===this.nodeName?de:ge,k=fg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?gg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},We.unselect=function(a,b){eg&&oi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=Ve.select(this),g="circle"===this.nodeName?de:ge,h=fg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&gg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},We.toLine=function(a){Ue(a,"line")},We.toSpline=function(a){Ue(a,"spline")},We.toBar=function(a){Ue(a,"bar")},We.toScatter=function(a){Ue(a,"scatter")},We.toArea=function(a){Ue(a,"area")},We.toAreaSpline=function(a){Ue(a,"area-spline")},We.toPie=function(a){Ue(a,"pie",{withTransform:!0})},We.toDonut=function(a){Ue(a,"donut",{withTransform:!0})},We.groups=function(a){return c(a)?Xf:(Xf=a,Ce(),Xf)},We.xgrids=function(a){return a?(bh=a,Ce(),bh):bh},We.xgrids.add=function(a){return a?We.xgrids(bh.concat(a)):void 0},We.xgrids.remove=function(a){var b=Te(a);return We.xgrids(bh.filter(b))},We.ygrids=function(a){return a?(dh=a,Ce(),dh):dh},We.ygrids.add=function(a){return a?We.ygrids(dh.concat(a)):void 0},We.ygrids.remove=function(a){var b=Te(a);return We.ygrids(dh.filter(b))},We.regions=function(a){return c(a)?yh:(yh=a,Ce(),yh)},We.regions.add=function(a){return c(a)?yh:(yh=yh.concat(a),Ce(),yh)},We.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;mi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),yh=yh.filter(function(b){return b.classes.indexOf(a)<0})}),yh},We.data.get=function(a){var b=We.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},We.data.getAsTarget=function(a){var b=xc(function(b){return b.id===a});return b.length>0?b[0]:void 0},We.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Wf[b]=a[b]}),Qe(We.data.targets,{withTransition:!0}),Wf):Wf},We.x=function(a){return arguments.length&&(kc(We.data.targets,a),Ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),We.data.x},We.xs=function(a){return arguments.length&&(lc(We.data.targets,a),Ce({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),We.data.x},We.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},We.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Kg=+a.y),b(a.y2)&&(Tg=+a.y2)):Kg=Tg=+a,Ce())},We.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Lg=+a.y),b(a.y2)&&(Ug=+a.y2)):Lg=Ug=+a,Ce())},We.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&We.axis.max(a.max),"undefined"!=typeof a.min&&We.axis.min(a.min))},We.resize=function(a){Ze=a?a.width:null,$e=a?a.height:null,He({withLegend:!0,withTransition:!1})},We.destroy=function(){We.data.targets=void 0,We.data.x={},si.html(""),a.onresize=null},"url"in e.data)Ve.csv(e.data.url,function(a,b){ve(b)});else if("rows"in e.data)ve(nc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");ve(oc(e.data.columns))}return We},"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.28"},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;cnf&&(nf=0),0>pf&&(pf=0),lf={top:yg?kf.top:sf-sg-(ci?0:tf),right:0/0,bottom:20+(ci?0:tf),left:yg?gi:kf.left},of=yg?kf.left-gi-hi:nf,qf=yg?pf:sf-lf.top-lf.bottom,0>of&&(of=0),0>qf&&(qf=0),mf={top:ci?0:sf-tf,right:0/0,bottom:0,left:ci?rf-uf:0},p(),ci&&Md(Ye.data.targets)&&(mf.left=nf/2+wf)}function o(){qi.select("line."+f.xgridFocus).attr("x1",yg?0:-10).attr("x2",yg?nf:-10).attr("y1",yg?-10:kf.top).attr("y2",yg?-10:pf)}function p(){wf=pf/2,vf=.95*wf,xf=Ld(Ye.data.targets)?.6*vf:0}function q(){var a=yg?f.axisX:f.axisY,b=Xe.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Xe.select($e).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return _e?_e:x()}function s(){var a=af?af:y();return a>0?a:320}function t(){return Md(Ye.data.targets)?0:bf?bf:yg||!Lg||Qg?1:v("y")}function u(){var a=1;return Md(Ye.data.targets)?0:cf?cf:ci?uf+(Ug&&!yg?v("y2"):a):Ug?Zg||yg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||Lg?"y2"!==a||Ug?(gb(a).isInner?30:40)+("y2"===a?-10:0):ii:ug&&!ci?10:1}function x(){return+Xe.select($e).style("width").replace("px","")}function y(){return+Xe.select($e).style("height").replace("px","")}function z(a){return a?-5:-(kf.left-1)}function A(a){return a?-20:-1}function B(){return z(!yg)}function C(){return A(!yg)}function D(){return z(yg)}function E(){return A(yg)}function F(a){return a?nf+2+4:kf.left+20}function G(a){return a?80:pf+2}function H(){return F(!yg)}function I(){return G(!yg)}function J(){return F(yg)}function K(){return G(yg)}function L(){var a=yg?pf:nf,b=tc(),c=Vb()*(Id(Ye.data.targets)?(b-(Ph?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){di=a}function N(a){ei=a}function O(a){fi=a}function P(){return ug?ci?ei*(di+1):rf:0}function Q(){return ug?ci?sf:fi*(di+1):0}function R(){var a,b=!Kf;Cf=yg?1:0,Df=yg?pf:nf,Ef=yg?0:pf,Ff=yg?nf:1,Gf=Cf,Hf=Df,If=yg?0:qf,Jf=yg?of:1,Kf=T(Cf,Df,b?void 0:Kf.domain(),function(){return Qf.tickOffset()}),Lf=U(Ef,Ff),Mf=U(Ef,Ff),Nf=T(Cf,Df,vi,function(a){return a%1?0:Tf.tickOffset()}),Of=U(If,Jf),Pf=U(If,Jf),a=$(),Qf=X(Kf,Zh,a),Tf=X(Nf,ai,a),Rf=Y(Lf,$h,Rg,Tg),Sf=Y(Mf,_h,$g,ah),b||(ji.scale(Nf),df&&ni.scale(Kf)),S()}function S(){yf=Db(),zf=Eb(),Af=Eb(.98)}function T(a,b,e,f){var g=(Oh?Xe.time.scale():Xe.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),Ph){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return Xe.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?Mf:Lf}function W(a){return"y2"===Z(a)?Pf:Of}function X(a,b,c){var d=(Ph?Bb():Xe.svg.axis()).scale(a).orient(b);return d.tickFormat(c),Ph?d.tickCentered(Bg):d.tickOffset=function(){var a=yg?pf:nf;return a*Vb()/tc()/2},Ph&&d.categories(Ag),d}function Y(a,b,c,d){return Xe.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in $f?$f[a]:"y"}function $(){var a=Oh?Xh:Ph?Jc:function(a){return 0>a?a.toFixed(0):a};return Cg&&("function"==typeof Cg?a=Cg:Oh&&(a=function(a){return Xe.time.format(Cg)(a)})),a}function _(a){var b;return"y"===a?b=Pg:"y2"===a?b=Yg:"x"===a&&(b=Kg),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Pg=b:"y2"===a?Yg=b:"x"===a&&(Kg=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",yg?"inner-top":"inner-right")}function eb(){return cb("y",yg?"inner-right":"inner-top")}function fb(){return cb("y2",yg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?nf/2:nf:b.isBottom?-pf:b.isMiddle?-pf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!yg,db())}function ob(){return kb(yg,eb())}function pb(){return kb(yg,fb())}function qb(){return lb(!yg,db())}function rb(){return lb(yg,eb())}function sb(){return lb(yg,fb())}function tb(){var a=db();return yg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return yg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return yg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!yg,db())}function xb(){return mb(yg,eb())}function yb(){return mb(yg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return Xe.selectAll("."+c+" .tick text").each(function(){var a=this.getBBox();bb?20:b}function Ab(){qi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),qi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),qi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Hc(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 Xe.min(Object.keys(i).map(function(a){return Xe.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=vc(a),i=Fc(a);if(Zf.length>0)for(g=Ic(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 Xe.max(Object.keys(i).map(function(a){return Xe.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Wg:Ng,n="y2"===c?Vg:Mg,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?Xg:Og,r=dd()&&yg;return 0===l.length?"y2"===c?Mf.domain():Lf.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=ed(o,p),j=$b(Lf.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Sg&&(f=b(Sg.top)?Sg.top:e,g=b(Sg.bottom)?Sg.bottom:e),"y2"===c&&_g&&(f=b(_g.top)?_g.top:e,g=b(_g.bottom)?_g.bottom:e),Id(l)&&!Hc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(vi),c=$b(Kf.domain());return a||0===c?1:b/c}function Wb(a){return Ig?Ig:Xe.min(a,function(a){return Xe.min(a.values,function(a){return a.x})})}function Xb(a){return Hg?Hg:Xe.max(a,function(a){return Xe.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return Ph?d=0:Id(a)?(c=tc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=Oh?new Date(c.getTime()-e):c-e,g=Oh?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return Uf&&a===Uf||ae(Vf)&&be(Vf,a)}function fc(a){return!ec(a)}function gc(a){return Uf?Uf:ae(Vf)?Vf[a]:null}function hc(a,b){return a in Ye.data.x&&Ye.data.x[a]&&Ye.data.x[a][b]?Ye.data.x[a][b]:b}function ic(a){Object.keys(a).forEach(function(b){Vf[b]=a[b]})}function jc(a){var b;return a&&(b=Yf[a.id],a.name=b?b:a.id),a}function kc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=mc(b[d],a.id,d)}),Ye.data.x[a.id]=b})}function lc(a,b){a.forEach(function(a){b[a.id]&&kc([a],b[a.id])})}function mc(a,b,c){var d;return d=Oh?a?a instanceof Date?a:Yd(a):Yd(hc(b,c)):Qh&&!Ph?a?+a:hc(b,c):c}function nc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0&&(Ye.data.x[b]=a.map(function(a){return a[c]})):Ye.data.x[b]=a.map(function(a,b){return b})}),c.forEach(function(a){if(!Ye.data.x[a])throw new Error('x is not defined for id = "'+a+'".')}),b=c.map(function(b,c){var d=Xf(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=mc(g,b,e);return Qh&&Ph&&0===c&&g&&(0===e&&(Ag=[]),Ag.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++})}),_f&&Gd(vc(b).filter(function(a){return!(a in ag)}),_f),b.forEach(function(a){ac(a.id_org,a)}),b}function qc(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 rc(a){return a>0&&Ye.data.targets[0].values[a-1]?Ye.data.targets[0].values[a-1].x:void 0}function sc(a){return a1?Ye.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?Ye.data.targets[0]:null,a}function vc(a){return a.map(function(a){return a.id})}function wc(a){return a?"string"==typeof a?[a]:a:vc(Ye.data.targets)}function xc(a,b){var c,d=vc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(Oh?new Date(h):h);i.push(d)}return i}function Dc(a){Yh=Yh.concat(a)}function Ec(a){Yh=Yh.filter(function(b){return a.indexOf(b)<0})}function Fc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Gc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Ic(a){return Gc(a,function(a){return a>0})}function Jc(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(md(a,f))),a[g].x&&(e=e.concat(md(a,g))),pd(e,b)):nd(a,b,f,g)}function od(a,b){var c;return c=a.map(function(a){return nd(a.values,b)}),pd(c,b)}function pd(a,b){var c,d;return a.forEach(function(a){var e=ce(a,b);(c>e||!c)&&(c=e,d=a)}),d}function qd(a,b){return Xe.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function rd(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 sd(){return cg&&"desc"===cg.toLowerCase()}function td(){return cg&&"asc"===cg.toLowerCase()}function ud(a){var b=td(),c=sd();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 cg&&a.sort(cg),a}function vd(a,c){var d,e,f,g,h,i,j,k=Md(Ye.data.targets),l=k?gd:fd,m=a.filter(function(a){return a&&b(a.value)});Bh&&0!==m.length&&(ti.html(Eh(a,$(),l,Wh)).style("display","block"),d=ti.property("offsetWidth"),e=ti.property("offsetHeight"),k?(g=nf/2+c[0],i=pf/2+c[1]+20):(yg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Kf(m[0].x)+20):(f=q(),g=f+t()+Kf(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),ti.style("top",i+"px").style("left",g+"px"))}function wd(){ti.style("display","none")}function xd(a){var c=a.filter(function(a){return a&&b(a.value)});Bh&&(Jd(Ye.data.targets)||Md(Ye.data.targets)||qi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(yg?"y1":"x1",id).attr(yg?"y2":"x2",id))}function yd(){qi.select("line."+f.xgridFocus).style("visibility","hidden")}function zd(a){return a.x||0===a.x?Kf(a.x):null}function Ad(a){return V(a.id)(a.value)}function Bd(){var a,b,d={},e=0;return Ac(yc(Pd)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Fd(a,b){return nh?nh:b?2*a.tickOffset()*oh/b:0}function Gd(a,b){wc(a).forEach(function(a){xi[a]=b===ag[a],ag[a]=b})}function Hd(a,b){var c=!1;return a.forEach(function(a){ag[a.id]===b&&(c=!0),a.id in ag||"line"!==b||(c=!0)}),c}function Id(a){return Hd(a,"bar")}function Jd(a){return Hd(a,"scatter")}function Kd(a){return Hd(a,"pie")}function Ld(a){return Hd(a,"donut")}function Md(a){return Kd(a)||Ld(a)}function Nd(a){var b="string"==typeof a?a:a.id;return!(b in ag)||"line"===ag[b]||"spline"===ag[b]||"area"===ag[b]||"area-spline"===ag[b]}function Od(a){var b="string"==typeof a?a:a.id;return"spline"===ag[b]||"area-spline"===ag[b]}function Pd(a){var b="string"==typeof a?a:a.id;return"bar"===ag[b]}function Qd(a){var b="string"==typeof a?a:a.id;return"scatter"===ag[b]}function Rd(a){var b="string"==typeof a?a:a.id;return"pie"===ag[b]}function Sd(a){var b="string"==typeof a?a:a.id;return"donut"===ag[b]}function Td(a){return Rd(a)||Sd(a)}function Ud(a){return Pd(a)?a.values:[]}function Vd(a){return Nd(a)||Qd(a)?a.values:[]}function Wd(a){return Pd(a)||Nd(a)?a.values:[]}function Xd(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function Yd(b){var c;if(!b)throw Error(b+" can not be parsed as d3.time with format "+Wf+". Maybe 'x' of this data is not defined. See data.x or data.xs option.");try{c=Wf?Xe.time.format(Wf).parse(b):new Date(b)}catch(d){c=void 0}return c||a.console.error("Failed to parse x '"+b+"' to Date with format "+Wf),c}function Zd(a,b){var c=Xe.mouse(a),d=Xe.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function be(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ce(a,b){var c="y"===Z(a.id)?Lf:Mf,d=yg?1:0,e=yg?0:1;return Math.pow(Kf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function de(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function ee(a,b,c){ng(b,a.node()),qi.select("."+f.selectedCircles+Yc(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Kc(f.selectedCircle,c)}).attr("cx",yg?Ad:zd).attr("cy",yg?zd:Ad).attr("stroke",function(){return Wh(b)}).attr("r",1.4*mh).transition().duration(100).attr("r",mh)}function fe(a,b,c){og(b,a.node()),qi.select("."+f.selectedCircles+Yc(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ge(a,b,c,d){a?ee(b,c,d):fe(b,c,d)}function he(a,b){ng(b,a.node()),a.transition().duration(100).style("fill",function(){return Xe.rgb(Wh(b)).darker(1)})}function ie(a,b){og(b,a.node()),a.transition().duration(100).style("fill",function(){return Wh(b)})}function je(a,b,c,d){a?he(b,c,d):ie(b,c,d)}function ke(a){return a.filter(function(a){return b(a.value)})}function le(a,c){return(c?qi.selectAll("."+f.circles+Yc(c)):qi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function me(a,b){le(a,b).classed(f.EXPANDED,!0).attr("r",lh)}function ne(a){le(a).filter(function(){return Xe.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",ih)}function oe(a){return qi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function pe(a){oe(a).classed(f.EXPANDED,!0)}function qe(a){oe(a).classed(f.EXPANDED,!1)}function re(a,b){var c=ve(a,b);return function(a,b){var d=c(a,b),e=yg?1:0,f=yg?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 se(a,b){var c=ve(a,!1),d=b?te:ue;return function(a,b){return d(c(a,b),a,this)}}function te(a,b){var c;return yg?(c=Pd(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function ue(a,b,c){var d=c.getBBox();return yg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:Pd(b)?-3:-6)}function ve(a,b){var c=a.__max__+1,d=Fd(Qf,c),e=Cd(d,c,a,!!b),f=Dd(!!b),g=Ed(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return yg&&(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 we(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 xe(b){var c,d,e;if(ui=Xe.select($e),ui.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ui.html(""),ui.classed("c3",!0),Ye.data.x={},Ye.data.targets=pc(b),n(),R(),Kf.domain(Xe.extent(Zb(Ye.data.targets))),Lf.domain(Ub(Ye.data.targets,"y")),Mf.domain(Ub(Ye.data.targets,"y2")),Nf.domain(Kf.domain()),Of.domain(Lf.domain()),Pf.domain(Mf.domain()),vi=Kf.domain(),ji.scale(Nf),df&&ni.scale(Kf),oi=ui.append("svg").attr("width",nf+kf.left+kf.right).attr("height",pf+kf.top+kf.bottom).on("mouseenter",gf).on("mouseleave",hf),pi=oi.append("defs"),pi.append("clipPath").attr("id",Ih).append("rect").attr("width",nf).attr("height",pf),pi.append("clipPath").attr("id",Jh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),pi.append("clipPath").attr("id",Kh).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),qi=oi.append("g").attr("transform",bi.main),ri=rg?oi.append("g").attr("transform",bi.context):null,si=ug?oi.append("g").attr("transform",bi.legend):null,ti=Xe.select($e).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),qi.append("g").attr("class",f.axisX).attr("clip-path",yg?"":Mh).attr("transform",bi.x).append("text").attr("class",f.axisXLabel).attr("transform",yg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),Lg&&qi.append("g").attr("class",f.axisY).attr("clip-path",yg?Nh:"").append("text").attr("class",f.axisYLabel).attr("transform",yg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),Ug&&qi.append("g").attr("class",f.axisY2).attr("transform",bi.y2).append("text").attr("class",f.axisY2Label).attr("transform",yg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=qi.append("g").attr("clip-path",Lh).attr("class",f.grid),bh&&d.append("g").attr("class",f.xgrids),ae(dh)&&d.append("g").attr("class",f.xgridLines),jh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),eh&&d.append("g").attr("class",f.ygrids),ae(fh)&&d.append("g").attr("class",f.ygridLines),qi.append("g").attr("clip-path",Lh).attr("class",f.regions),qi.append("g").attr("clip-path",Lh).attr("class",f.chart),c=qi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",df?yg?"ns-resize":"ew-resize":null),qi.select("."+f.chart).append("g").attr("class",f.chartBars),qi.select("."+f.chart).append("g").attr("class",f.chartLines),qi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",bi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),qi.select("."+f.chart).append("g").attr("class",f.chartTexts),df&&qi.insert("rect",ff?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",nf).attr("height",pf).style("opacity",0).style("cursor",yg?"ns-resize":"ew-resize").call(ni).on("dblclick.zoom",null),Jg&&ji.extent("function"!=typeof Jg?Jg:Jg(Zb())),rg&&(ri.append("g").attr("clip-path",Lh).attr("class",f.chart),ri.select("."+f.chart).append("g").attr("class",f.chartBars),ri.select("."+f.chart).append("g").attr("class",f.chartLines),ri.append("g").attr("clip-path",Lh).attr("class",f.brush).call(ji).selectAll("rect").attr(yg?"width":"height",yg?of:qf),ri.append("g").attr("class",f.axisX).attr("transform",bi.subx).attr("clip-path",yg?"":Mh)),Ke(Ye.data.targets),yg?qi.select("."+f.axisX).style("opacity",0).call(Qf):(qi.select("."+f.axisY).style("opacity",0).call(Rf),qi.select("."+f.axisY2).style("opacity",0).call(Sf)),Je({withTransform:!0,withLegend:!0,withTransitionForAxis:!1}),Fh){if(Oh&&"string"==typeof Gh){for(Gh=Yd(Gh),e=0;e0){d=[];for(var g in Yf)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=rd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=je,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 Ce(a){Md(Ye.data.targets)||gg&&(Rh=a,qi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Sh=!0,pg())}function De(){Md(Ye.data.targets)||gg&&(qi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),qi.selectAll("."+f.shape).classed(f.INCLUDED,!1),Sh=!1,qg())}function Ee(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P=Bd(),Q=Md(Ye.data.targets),R=Ac(Ye.data.targets);if(0!==R.length){if(a=d(a)?a:{},v=d(a.withY)?a.withY:!0,w=d(a.withSubchart)?a.withSubchart:!0,x=d(a.withTransition)?a.withTransition:!0,A=d(a.withTransform)?a.withTransform:!1,B=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,C=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,D=d(a.withLegend)?a.withLegend:!1,y=d(a.withTransitionForExit)?a.withTransitionForExit:x,z=d(a.withTransitionForAxis)?a.withTransitionForAxis:x,I=x?jf:0,J=y?I:0,K=z?I:0,D&&ug&&Se(Ye.data.targets,a),C&&(Kf.domain(Xe.extent(Zb(R))),vi=Kf.domain(),df&&ni.scale(Kf).updateScaleExtent(),Nf.domain(Kf.domain()),ji.scale(Nf)),B&&(Kf.domain(ji.empty()?vi:ji.extent()),df&&ni.scale(Kf).updateScaleExtent(),Jd(R)||(M=Cc(Bc(R)).sort(),Qf.tickValues(M),Tf.tickValues(M))),Lf.domain(Ub(R,"y")),Mf.domain(Ub(R,"y2")),qi.select("."+f.axisX).style("opacity",Q?0:1).transition().duration(K).call(Qf),qi.select("."+f.axisY).style("opacity",Q?0:1).transition().duration(K).call(Rf),qi.select("."+f.axisY2).style("opacity",Q?0:1).transition().duration(K).call(Sf),B&&Dg&&M){for(N=1;N=V;V++)e.push(new Date(V+"-01-01 00:00:00"))}else e=Kf.ticks(10);c=qi.select("."+f.xgrids).selectAll("."+f.xgrid).data(e),c.enter().append("line").attr("class",f.xgrid),c.attr("x1",yg?0:function(a){return Kf(a)-Qf.tickOffset()}).attr("x2",yg?nf:function(a){return Kf(a)-Qf.tickOffset()}).attr("y1",yg?function(a){return Kf(a)-Qf.tickOffset()}:kf.top).attr("y2",yg?function(a){return Kf(a)-Qf.tickOffset()}:pf).style("opacity",function(){return+Xe.select(this).attr(yg?"y1":"x1")===(yg?pf:0)?0:1}),c.exit().remove()}ae(dh)&&(g=qi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(dh),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",yg?"":"rotate(-90)").attr("dx",yg?0:-kf.top).attr("dy",-5).style("opacity",0),g.select("line").transition().duration(I).attr("x1",yg?0:jd).attr("x2",yg?nf:jd).attr("y1",yg?jd:kf.top).attr("y2",yg?jd:pf).style("opacity",1),g.select("text").transition().duration(I).attr("x",yg?nf:0).attr("y",jd).text(function(a){return a.text}).style("opacity",1),g.exit().transition().duration(I).style("opacity",0).remove()),v&&eh&&(i=qi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Lf.ticks(gh)),i.enter().append("line").attr("class",f.ygrid),i.attr("x1",yg?Lf:0).attr("x2",yg?Lf:nf).attr("y1",yg?0:Lf).attr("y2",yg?pf:Lf),i.exit().remove()),v&&ae(fh)&&(j=qi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(fh),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",yg?"rotate(-90)":"").attr("dx",yg?0:-kf.top).attr("dy",-5).style("opacity",0),j.select("line").transition().duration(I).attr("x1",yg?kd:0).attr("x2",yg?kd:nf).attr("y1",yg?0:kd).attr("y2",yg?pf:kd).style("opacity",1),j.select("text").transition().duration(I).attr("x",yg?0:nf).attr("y",kd).text(function(a){return a.text}).style("opacity",1),j.exit().transition().duration(I).style("opacity",0).remove()),m=qi.selectAll("."+f.bars).selectAll("."+f.bar).data(Ud),m.enter().append("path").attr("d",E).style("stroke","none").style("opacity",0).style("fill",function(a){return Wh(a)}).attr("class",Sc),m.style("opacity",_c).transition().duration(I).attr("d",E).style("opacity",1),m.exit().transition().duration(J).style("opacity",0).remove(),p=qi.selectAll("."+f.texts).selectAll("."+f.text).data(Wd),p.enter().append("text").attr("class",Lc).attr("text-anchor",function(a){return yg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),p.text(function(a){return hd(a.id)(a.value)}).style("fill-opacity",ad).transition().duration(I).attr("x",G).attr("y",H).style("fill-opacity",cd),p.exit().transition().duration(J).style("fill-opacity",0).remove(),qi.selectAll("."+f.line).style("opacity",_c).transition().duration(I).attr("d",ki).style("opacity",1),qi.selectAll("."+f.area).style("opacity",0).transition().duration(I).attr("d",li).style("opacity",wi),l=qi.selectAll("."+f.circles).selectAll("."+f.circle).data(Vd),l.enter().append("circle").attr("class",Qc).style("opacity",0).attr("r",ih),l.style("opacity",_c).transition().duration(I).style("opacity",bd).attr("cx",yg?Ad:zd).attr("cy",yg?zd:Ad),l.exit().remove(),qi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",A?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(I).attrTween("d",function(a){var b,c=Cb(a);return c?(b=Xe.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",A?"scale(1)":"").style("opacity",1),qi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(I).text(Jb).style("opacity",function(a){return zc(a.data.id)&&Td(a.data)?1:0}),qi.select("."+f.chartArcsTitle).style("opacity",Ld(Ye.data.targets)?1:0),rg&&(null!==Xe.event&&"zoom"===Xe.event.type&&ji.extent(Kf.orgDomain()).update(),w&&(ri.select("."+f.axisX).style("opacity",Q?0:1).transition().duration(I).call(Tf),ji.empty()||ji.extent(Kf.orgDomain()).update(),F=re(P,!0),q=ri.selectAll("."+f.bars).selectAll("."+f.bar).data(Ud),q.enter().append("path").attr("d",F).style("stroke","none").style("fill",function(a){return Wh(a)}).attr("class",Sc),q.style("opacity",_c).transition().duration(I).attr("d",F).style("opacity",1),q.exit().transition().duration(I).style("opacity",0).remove(),ri.selectAll("."+f.line).style("opacity",_c).transition().duration(I).attr("d",mi).style("opacity",1))),qi.selectAll("."+f.selectedCircles).filter(function(a){return Pd(a)}).selectAll("circle").remove(),qi.selectAll("."+f.selectedCircle).transition().duration(I).attr("cx",yg?Ad:zd).attr("cy",yg?zd:Ad),ae(Vf)?(r=qi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),ze(r.enter()),r.attr("x",0).attr("y",0).attr("width",nf).attr("height",pf)):(Qh&&!Ph?(u=function(a,b){var c=rc(b),d=sc(b),e=Ye.data.x[a.id][b];return(Kf(d?d:e+50)-Kf(c?c:e-50))/2},t=function(a,b){var c=rc(b),d=Ye.data.x[a.id][b];return(Kf(d)+Kf(c?c:d-50))/2}):(u=L(),t=function(a){return Kf(a.x)-u/2}),s=uc(),qi.select("."+f.eventRects).datum(s?s.values:[]),r=qi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),ye(r.enter()),r.attr("class",Xc).attr("x",yg?0:t).attr("y",yg?t:0).attr("width",yg?nf:u).attr("height",yg?u:pf),r.exit().remove()),n=qi.select("."+f.regions).selectAll("rect."+f.region).data(Ah),n.enter().append("rect").style("fill-opacity",0),n.attr("class",Wc).attr("x",yg?0:cc).attr("y",yg?cc:kf.top).attr("width",yg?nf:dc).attr("height",yg?dc:pf).transition().duration(I).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),n.exit().transition().duration(I).style("fill-opacity",0).remove(),vc(Ye.data.targets).forEach(function(a){xi[a]=!0})}}function Fe(){Ee({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ge(){return"mousemove"===Xe.event.sourceEvent.type&&ni.altDomain?(Kf.domain(ni.altDomain),void ni.scale(Kf).updateScaleExtent()):(Ph&&Kf.orgDomain()[0]===vi[0]&&Kf.domain([vi[0]-1e-10,Kf.orgDomain()[1]]),Ee({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Xe.event.sourceEvent.type&&(Th=!0)))}function He(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ie(){oi.attr("width",rf).attr("height",sf),oi.select("#"+Ih).select("rect").attr("width",nf).attr("height",pf),oi.select("#"+Jh).select("rect").attr("width",H),oi.select("#"+Kh).select("rect").attr("width",J),oi.select("."+f.zoomRect).attr("width",nf).attr("height",pf)}function Je(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(),R(),Ie(),m(a.withTransition),Ee(a)}function Ke(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=qi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a),j=i.enter().append("g").attr("class",function(a){return f.chartText+Kc(f.target,a.id)}).style("pointer-events","none"),j.append("g").attr("class",Mc).style("fill",function(a){return Wh(a)}),e=qi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),d=e.enter().append("g").attr("class",function(a){return f.chartBar+Kc(f.target,a.id)}).style("pointer-events","none"),d.append("g").attr("class",Tc).style("fill",function(a){return Wh(a)}).style("stroke","none").style("cursor",function(a){return ig(a)?"pointer":null}),c=qi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),b=c.enter().append("g").attr("class",function(a){return f.chartLine+Kc(f.target,a.id)}).style("pointer-events","none"),b.append("path").attr("class",Pc).style("opacity",0).style("stroke",function(a){return Wh(a)}),b.append("path").attr("class",Vc).style("opacity",function(){return wi=+Xe.select(this).style("opacity"),0}).style("fill",function(a){return Wh(a)}),b.append("g").attr("class",function(a){return Kc(f.selectedCircles,a.id)}),b.append("g").attr("class",Rc).style("fill",function(a){return Wh(a)}).style("cursor",function(a){return ig(a)?"pointer":null}),a.forEach(function(a){qi.selectAll("."+f.selectedCircles+Yc(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=qi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Bf(a)),g=h.enter().append("g").attr("class",function(a){return f.chartArc+Kc(f.target,a.data.id)}),g.append("path").attr("class",Uc).style("opacity",0).style("fill",function(a){return Wh(a.data)}).style("cursor",function(a){return ig(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),Pe(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];vd(c,Xe.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),Re(),wd(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),rg&&(n=ri.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),m=n.enter().append("g").attr("class",function(a){return f.chartBar+Kc(f.target,a.id)}),m.append("g").attr("class",Tc).style("fill",function(a){return Wh(a)}),l=ri.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),k=l.enter().append("g").attr("class",function(a){return f.chartLine+Kc(f.target,a.id)}),k.append("path").attr("class",Pc).style("opacity",0).style("stroke",function(a){return Wh(a)})),oi.selectAll("."+f.target).filter(function(a){return zc(a.id)}).transition().style("opacity",1)}function Le(a,b){Ye.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=ci?i:h,k=ci?tf:uf;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=ci?u:t,xg?(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=vc(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,ci?(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=si.selectAll("."+f.legendItem).data(q).enter().append("g").attr("class",function(a){return Kc(f.legendItem,a)}).style("cursor","pointer").on("click",function(a){"function"==typeof wg?wg(a):Ye.toggle(a)}).on("mouseover",function(a){Ye.focus(a)}).on("mouseout",function(){Ye.revert()}),g.append("text").text(function(a){return d(Yf[a])?Yf[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",ci?i:-200).attr("y",ci?-200:l),g.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",ci?j:-200).attr("y",ci?-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 Wh(a)}).attr("x",ci?i:-200).attr("y",ci?-200:k).attr("width",10).attr("height",10),si.selectAll("text").data(q).text(function(a){return d(Yf[a])?Yf[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",i).attr("y",l),si.selectAll("rect."+f.legendItemEvent).data(q).transition().duration(p?250:0).attr("x",j).attr("y",o),si.selectAll("rect."+f.legendItemTile).data(q).transition().duration(p?250:0).attr("x",h).attr("y",k),N(t),O(u),M(C),n(),R(),Ie(),m(!1)}function Te(a){return xc(Ye.data.targets,a.id)}function Ue(a){return"data"in a&&xc(Ye.data.targets,a.data.id)}function Ve(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 We(a,b,c){var d=!Md(Ye.data.targets);Gd(a,b),Je(c?c:{withTransitionForAxis:d})}var Xe=a.d3?a.d3:a.require?a.require("d3"):void 0,Ye={data:{},axis:{}},Ze={},$e=h(["bindto"],"#chart"),_e=h(["size","width"]),af=h(["size","height"]),bf=h(["padding","left"]),cf=h(["padding","right"]),df=h(["zoom","enabled"],!1),ef=h(["zoom","extent"]),ff=h(["zoom","privileged"],!1),gf=h(["onenter"],function(){}),hf=h(["onleave"],function(){}),jf=h(["transition","duration"],350);g("data","data is required in config");var 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,Rf,Sf,Tf,Uf=h(["data","x"]),Vf=h(["data","xs"],{}),Wf=h(["data","x_format"]),Xf=h(["data","id_converter"],function(a){return a}),Yf=h(["data","names"],{}),Zf=h(["data","groups"],[]),$f=h(["data","axes"],{}),_f=h(["data","type"]),ag=h(["data","types"],{}),bg=h(["data","labels"],{}),cg=h(["data","order"]),dg=h(["data","regions"],{}),eg=h(["data","color"]),fg=h(["data","colors"],{}),gg=h(["data","selection","enabled"],!1),hg=h(["data","selection","grouped"],!1),ig=h(["data","selection","isselectable"],function(){return!0}),jg=h(["data","selection","multiple"],!0),kg=h(["data","onclick"],function(){}),lg=h(["data","onenter"],function(){}),mg=h(["data","onleave"],function(){}),ng=h(["data","onselected"],function(){}),og=h(["data","onunselected"],function(){}),pg=h(["data","ondragstart"],function(){}),qg=h(["data","ondragend"],function(){}),rg=h(["subchart","show"],!1),sg=rg?h(["subchart","size","height"],60):0,tg=h(["color","pattern"],[]),ug=h(["legend","show"],!0),vg=h(["legend","position"],"bottom"),wg=h(["legend","item","onclick"]),xg=h(["legend","equally"],!1),yg=h(["axis","rotated"],!1),zg=h(["axis","x","type"],"indexed"),Ag=h(["axis","x","categories"],[]),Bg=h(["axis","x","tick","centered"],!1),Cg=h(["axis","x","tick","format"]),Dg=h(["axis","x","tick","culling"],{}),Eg=h(["axis","x","tick","culling","max"],"categorized"===zg?1/0:10),Fg=h(["axis","x","tick","count"]),Gg=h(["axis","x","tick","fit"],!1),Hg=h(["axis","x","max"]),Ig=h(["axis","x","min"]),Jg=h(["axis","x","default"]),Kg=h(["axis","x","label"],{}),Lg=h(["axis","y","show"],!0),Mg=h(["axis","y","max"]),Ng=h(["axis","y","min"]),Og=h(["axis","y","center"]),Pg=h(["axis","y","label"],{}),Qg=h(["axis","y","inner"],!1),Rg=h(["axis","y","tick","format"]),Sg=h(["axis","y","padding"],{}),Tg=h(["axis","y","ticks"],10),Ug=h(["axis","y2","show"],!1),Vg=h(["axis","y2","max"]),Wg=h(["axis","y2","min"]),Xg=h(["axis","y2","center"]),Yg=h(["axis","y2","label"],{}),Zg=h(["axis","y2","inner"],!1),$g=h(["axis","y2","tick","format"]),_g=h(["axis","y2","padding"],{}),ah=h(["axis","y2","ticks"],10),bh=h(["grid","x","show"],!1),ch=h(["grid","x","type"],"tick"),dh=h(["grid","x","lines"],[]),eh=h(["grid","y","show"],!1),fh=h(["grid","y","lines"],[]),gh=h(["grid","y","ticks"],10),hh=h(["point","show"],!0),ih=hh?h(["point","r"],2.5):0,jh=h(["point","focus","line","enabled"],!0),kh=h(["point","focus","expand","enabled"],!0),lh=h(["point","focus","expand","r"],kh?4:ih),mh=h(["point","focus","select","r"],8),nh=h(["bar","width"]),oh=h(["bar","width","ratio"],.6),ph=h(["pie","label","show"],!0),qh=h(["pie","label","format"]),rh=h(["pie","onclick"],function(){}),sh=h(["pie","onmouseover"],function(){}),th=h(["pie","onmouseout"],function(){}),uh=h(["donut","label","show"],!0),vh=h(["donut","label","format"]),wh=h(["donut","title"],""),xh=h(["donut","onclick"],function(){}),yh=h(["donut","onmouseover"],function(){}),zh=h(["donut","onmouseout"],function(){}),Ah=h(["regions"],[]),Bh=h(["tooltip","show"],!0),Ch=h(["tooltip","format","title"]),Dh=h(["tooltip","format","value"]),Eh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Ch?Ch:b,l=Dh?Dh: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+""}),Fh=h(["tooltip","init","show"],!1),Gh=h(["tooltip","init","x"],0),Hh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Ih=("string"==typeof $e?$e.replace("#",""):$e.id)+"-clip",Jh=Ih+"-xaxis",Kh=Ih+"-yaxis",Lh=i(Ih),Mh=i(Mh),Nh=i(Nh),Oh="timeseries"===zg,Ph="categorized"===zg,Qh=!Oh&&(Uf||ae(Vf)),Rh=null,Sh=!1,Th=!1,Uh=!1,Vh=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Wh=Xd(fg,ae(tg)?tg:Vh,eg),Xh=function(){var a=[[Xe.time.format("%Y/%-m/%-d"),function(){return!0}],[Xe.time.format("%-m/%-d"),function(a){return a.getMonth()}],[Xe.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[Xe.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Xe.time.format("%I %p"),function(a){return a.getHours()}],[Xe.time.format("%I:%M"),function(a){return a.getMinutes()}],[Xe.time.format(":%S"),function(a){return a.getSeconds()}],[Xe.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)}}(),Yh=[],Zh=yg?"left":"bottom",$h=yg?Qg?"top":"bottom":Qg?"right":"left",_h=yg?Zg?"bottom":"top":Zg?"left":"right",ai=yg?"left":"bottom",bi={main:function(){return"translate("+kf.left+","+kf.top+")"},context:function(){return"translate("+lf.left+","+lf.top+")"},legend:function(){return"translate("+mf.left+","+mf.top+")"},x:function(){return"translate(0,"+(yg?0:pf)+")"},y:function(){return"translate(0,"+(yg?pf:0)+")"},y2:function(){return"translate("+(yg?0:nf)+","+(yg?1:0)+")"},subx:function(){return"translate(0,"+(yg?0:qf)+")"},arc:function(){return"translate("+nf/2+","+pf/2+")"}},ci="right"===vg,di=0,ei=0,fi=0,gi=30,hi=30,ii=5;Bf=Xe.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var ji,ki=function(){var a=Xe.svg.line().x(yg?function(a){return V(a.id)(a.value)}:id).y(yg?id:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=ke(b.values);return Nd(b)?(a.interpolate(Od(b)?"cardinal":"linear"),dg[b.id]?we(e,Kf,V(b.id),dg[b.id]):a(e)):(c=Kf(e[0].x),d=V(b.id)(e[0].value),yg?"M "+d+" "+c:"M "+c+" "+d)}}(),li=function(){var a;return a=yg?Xe.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(id):Xe.svg.area().x(id).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=ke(b.values);return Hd([b],"area")||Hd([b],"area-spline")?(a.interpolate(Od(b)?"cardinal":"linear"),a(e)):(c=Kf(e[0].x),d=V(b.id)(e[0].value),yg?"M "+d+" "+c:"M "+c+" "+d)}}(),mi=function(){var a=Xe.svg.line().x(yg?function(a){return W(a.id)(a.value)}:ld).y(yg?ld:function(a){return W(a.id)(a.value)});return function(b){var c=ke(b.values);return Nd(b)?a(c):"M "+Nf(c[0].x)+" "+W(b.id)(c[0].value)}}(),ni=function(){};ji=Xe.svg.brush().on("brush",Fe),ji.update=function(){return ri&&ri.select("."+f.brush).call(this),this},ji.scale=function(a){return yg?this.y(a):this.x(a)},df&&(ni=Xe.behavior.zoom().on("zoomstart",function(){ni.altDomain=Xe.event.sourceEvent.altKey?Kf.orgDomain():null}).on("zoom",df?Ge:null),ni.scale=function(a){return yg?this.y(a):this.x(a)},ni.orgScaleExtent=function(){var a=ef?ef:[1,10];return[a[0],Math.max(tc()/a[1],a[1])]},ni.updateScaleExtent=function(){var a=$b(Kf.orgDomain())/$b(vi),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var oi,pi,qi,ri,si,ti,ui,vi,wi,xi={};if(Ye.focus=function(a){function b(a){Ac(a).transition().duration(100).style("opacity",1)}var c=oi.selectAll(Zc(a)),d=c.filter(Te),e=c.filter(Ue);Ye.revert(),Ye.defocus(),b(d.classed(f.focused,!0)),b(e),Md(Ye.data.targets)&&Kb(a,!0),Pe(a)},Ye.defocus=function(a){function b(a){Ac(a).transition().duration(100).style("opacity",.3)}var c=oi.selectAll(Zc(a)),d=c.filter(Te),e=c.filter(Ue);Ye.revert(),b(d.classed(f.focused,!1)),b(e),Md(Ye.data.targets)&&Lb(a),Qe(a)},Ye.revert=function(a){function b(a){Ac(a).transition().duration(100).style("opacity",1)}var c=oi.selectAll(Zc(a)),d=c.filter(Te),e=c.filter(Ue);b(d.classed(f.focused,!1)),b(e),Md(Ye.data.targets)&&Lb(a),Re()},Ye.show=function(a){a=wc(a),Ec(a),oi.selectAll($c(a)).transition().style("opacity",1),Ee({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!1})},Ye.hide=function(a){a=wc(a),Dc(a),oi.selectAll($c(a)).transition().style("opacity",0),Ee({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!1})},Ye.toggle=function(a){zc(a)?Ye.hide(a):Ye.show(a)},Ye.unzoom=function(){ji.clear().update(),Ee({withUpdateXDomain:!0})},Ye.load=function(a){return a.xs&&ic(a.xs),"categories"in a&&Ph&&(Ag=a.categories,Qf.categories(Ag)),"cacheIds"in a&&_b(a.cacheIds)?void Le(bc(a.cacheIds),a.done):void("unload"in a?Ne(wc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Me(a)}):Me(a))},Ye.unload=function(a){Ne(wc(a),function(){Ee({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},Ye.selected=function(a){return Xe.merge(qi.selectAll("."+f.shapes+Yc(a)).selectAll("."+f.shape).filter(function(){return Xe.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},Ye.select=function(a,b,c){gg&&qi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=Xe.select(this),i="circle"===this.nodeName?ee:he,j="circle"===this.nodeName?fe:ie,k=hg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?ig(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},Ye.unselect=function(a,b){gg&&qi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=Xe.select(this),g="circle"===this.nodeName?fe:ie,h=hg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&ig(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},Ye.toLine=function(a){We(a,"line")},Ye.toSpline=function(a){We(a,"spline")},Ye.toBar=function(a){We(a,"bar")},Ye.toScatter=function(a){We(a,"scatter")},Ye.toArea=function(a){We(a,"area")},Ye.toAreaSpline=function(a){We(a,"area-spline")},Ye.toPie=function(a){We(a,"pie",{withTransform:!0})},Ye.toDonut=function(a){We(a,"donut",{withTransform:!0})},Ye.groups=function(a){return c(a)?Zf:(Zf=a,Ee(),Zf)},Ye.xgrids=function(a){return a?(dh=a,Ee(),dh):dh},Ye.xgrids.add=function(a){return a?Ye.xgrids(dh.concat(a)):void 0},Ye.xgrids.remove=function(a){var b=Ve(a);return Ye.xgrids(dh.filter(b))},Ye.ygrids=function(a){return a?(fh=a,Ee(),fh):fh},Ye.ygrids.add=function(a){return a?Ye.ygrids(fh.concat(a)):void 0},Ye.ygrids.remove=function(a){var b=Ve(a);return Ye.ygrids(fh.filter(b))},Ye.regions=function(a){return c(a)?Ah:(Ah=a,Ee(),Ah)},Ye.regions.add=function(a){return c(a)?Ah:(Ah=Ah.concat(a),Ee(),Ah)},Ye.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;oi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Ah=Ah.filter(function(b){return b.classes.indexOf(a)<0})}),Ah},Ye.data.get=function(a){var b=Ye.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Ye.data.getAsTarget=function(a){var b=yc(function(b){return b.id===a});return b.length>0?b[0]:void 0},Ye.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Yf[b]=a[b]}),Se(Ye.data.targets,{withTransition:!0}),Yf):Yf},Ye.x=function(a){return arguments.length&&(kc(Ye.data.targets,a),Ee({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ye.data.x},Ye.xs=function(a){return arguments.length&&(lc(Ye.data.targets,a),Ee({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ye.data.x},Ye.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},Ye.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Mg=+a.y),b(a.y2)&&(Vg=+a.y2)):Mg=Vg=+a,Ee())},Ye.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Ng=+a.y),b(a.y2)&&(Wg=+a.y2)):Ng=Wg=+a,Ee())},Ye.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Ye.axis.max(a.max),"undefined"!=typeof a.min&&Ye.axis.min(a.min))},Ye.resize=function(a){_e=a?a.width:null,af=a?a.height:null,Je({withLegend:!0,withTransition:!1})},Ye.destroy=function(){Ye.data.targets=void 0,Ye.data.x={},ui.html(""),a.onresize=null},"url"in e.data)Xe.csv(e.data.url,function(a,b){xe(b)});else if("rows"in e.data)xe(nc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");xe(oc(e.data.columns))}return Ye},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From a3096bda8400ccadf0ddfa77c5db51df5d0c97ae Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Mon, 7 Apr 2014 02:09:06 +0900 Subject: [PATCH 013/178] Add APIs to show/hide legends - #118 --- c3.js | 151 +++++++++++++++++++++++++++++++++++++++++------------- c3.min.js | 5 +- 2 files changed, 118 insertions(+), 38 deletions(-) diff --git a/c3.js b/c3.js index 84ce3cd..38a4353 100644 --- a/c3.js +++ b/c3.js @@ -71,7 +71,7 @@ var d3 = window.d3 ? window.d3 : window.require ? window.require("d3") : undefined; - var c3 = { data : {}, axis: {} }, + var c3 = { data : {}, axis: {}, legend: {} }, cache = {}; /*-- Handle Config --*/ @@ -295,7 +295,7 @@ }; })(); - var hiddenTargetIds = []; + var hiddenTargetIds = [], hiddenLegendIds = []; /*-- Set Chart Params --*/ @@ -329,10 +329,11 @@ return "url(" + document.URL.split('#')[0] + "#" + id + ")"; } - function transformMain() { + function transformMain(withTransition) { + var duration = withTransition !== false ? 250 : 0; main.attr("transform", translate.main); - main.select('.' + CLASS.axisX).attr("transform", translate.x); - main.select('.' + CLASS.axisY).attr("transform", translate.y); + main.select('.' + CLASS.axisX).transition().duration(duration).attr("transform", translate.x); + main.select('.' + CLASS.axisY).transition().duration(duration).attr("transform", translate.y); main.select('.' + CLASS.axisY2).attr("transform", translate.y2); main.select('.' + CLASS.chartArcs).attr("transform", translate.arc); } @@ -1460,6 +1461,9 @@ function isTargetToShow(targetId) { return hiddenTargetIds.indexOf(targetId) < 0; } + function isLegendToShow(targetId) { + return hiddenLegendIds.indexOf(targetId) < 0; + } function filterTargetsToShow(targets) { return targets.filter(function (t) { return isTargetToShow(t.id); }); } @@ -1499,6 +1503,12 @@ function removeHiddenTargetIds(targetIds) { hiddenTargetIds = hiddenTargetIds.filter(function (id) { return targetIds.indexOf(id) < 0; }); } + function addHiddenLegendIds(targetIds) { + hiddenLegendIds = hiddenLegendIds.concat(targetIds); + } + function removeHiddenLegendIds(targetIds) { + hiddenLegendIds = hiddenLegendIds.filter(function (id) { return targetIds.indexOf(id) < 0; }); + } function getValuesAsIdKeyed(targets) { var ys = {}; targets.forEach(function (t) { @@ -1552,6 +1562,8 @@ } function selectorTarget(id) { return '.' + CLASS.target + getTargetSelectorSuffix(id); } function selectorTargets(ids) { return ids.map(function (id) { return selectorTarget(id); }); } + function selectorLegend(id) { return '.' + CLASS.legendItem + getTargetSelectorSuffix(id); } + function selectorLegends(ids) { return ids.map(function (id) { return selectorLegend(id); }); } function initialOpacity(d) { return d.value !== null && withoutFadeIn[d.id] ? 1 : 0; @@ -2400,6 +2412,10 @@ .style("z-index", "10") .style("display", "none"); + // MEMO: call here to update legend box and tranlate for all + // MEMO: translate will be upated by this, so transform not needed in updateLegend() + updateLegend(mapToIds(c3.data.targets), {withTransform: false, withTransitionForTransform: false}); + /*-- Main Region --*/ // Add Axis @@ -2418,6 +2434,7 @@ main.append("g") .attr("class", CLASS.axisY) .attr("clip-path", __axis_rotated ? clipPathForYAxis : "") + .attr("transform", translate.y) .append("text") .attr("class", CLASS.axisYLabel) .attr("transform", __axis_rotated ? "" : "rotate(-90)") @@ -2561,7 +2578,7 @@ } // Draw with targets - updateAndRedraw({withTransform: true, withLegend: true, withTransitionForAxis: false}); + redraw({withTransform: true, withUpdateXDomain: true, withUpdateOrgXDomain: true, withTransitionForAxis: false}); // Show tooltip if needed if (__tooltip_init_show) { @@ -2879,11 +2896,11 @@ } function redraw(options) { - var xgrid, xgridData, xgridLines, xgridLine, ygrid, ygridLines, ygridLine; + var xaxis, yaxis, xgrid, xgridData, xgridLines, xgridLine, ygrid, ygridLines, ygridLine; var mainCircle, mainBar, mainRegion, mainText, contextBar, eventRectUpdate; var barIndices = getBarIndices(), maxDataCountTarget; var rectX, rectW; - var withY, withSubchart, withTransition, withTransitionForExit, withTransitionForAxis, withTransform, withUpdateXDomain, withUpdateOrgXDomain, withLegend; + var withY, withSubchart, withTransition, withTransitionForExit, withTransitionForAxis, withTransitionForHorizontalAxis, withTransform, withUpdateXDomain, withUpdateOrgXDomain, withLegend; var hideAxis = hasArcType(c3.data.targets); var drawBar, drawBarOnSub, xForText, yForText; var duration, durationForExit, durationForAxis; @@ -2905,6 +2922,7 @@ withTransitionForExit = isDefined(options.withTransitionForExit) ? options.withTransitionForExit : withTransition; withTransitionForAxis = isDefined(options.withTransitionForAxis) ? options.withTransitionForAxis : withTransition; + withTransitionForHorizontalAxis = isDefined(options.withTransitionForHorizontalAxis) ? options.withTransitionForHorizontalAxis : withTransition; duration = withTransition ? __transition_duration : 0; durationForExit = withTransitionForExit ? duration : 0; @@ -2912,7 +2930,7 @@ // update legend and transform each g if (withLegend && __legend_show) { - updateLegend(c3.data.targets, options); + updateLegend(mapToIds(c3.data.targets), options); } if (withUpdateOrgXDomain) { @@ -2927,19 +2945,30 @@ if (withUpdateXDomain) { x.domain(brush.empty() ? orgXDomain : brush.extent()); if (__zoom_enabled) { zoom.scale(x).updateScaleExtent(); } - // update axis tick values according to options, except for scatter plot - if (! hasScatterType(targetsToShow)) { // TODO: fix this - tickValues = generateTickValues(mapTargetsToUniqueXs(targetsToShow)).sort(); - xAxis.tickValues(tickValues); - subXAxis.tickValues(tickValues); - } } y.domain(getYDomain(targetsToShow, 'y')); y2.domain(getYDomain(targetsToShow, 'y2')); - // axis - main.select('.' + CLASS.axisX).style("opacity", hideAxis ? 0 : 1).transition().duration(durationForAxis).call(xAxis); - main.select('.' + CLASS.axisY).style("opacity", hideAxis ? 0 : 1).transition().duration(durationForAxis).call(yAxis); + // update axis tick values according to options, except for scatter plot + if (! hasScatterType(targetsToShow)) { // TODO: fix this + tickValues = generateTickValues(mapTargetsToUniqueXs(targetsToShow)).sort(); + xAxis.tickValues(tickValues); + subXAxis.tickValues(tickValues); + } + + // x axis + xaxis = main.select('.' + CLASS.axisX).style("opacity", hideAxis ? 0 : 1); + if (__axis_rotated || withTransitionForHorizontalAxis) { + xaxis = xaxis.transition().duration(durationForAxis); + } + xaxis.call(xAxis); + // y axis + yaxis = main.select('.' + CLASS.axisY).style("opacity", hideAxis ? 0 : 1); + if (!__axis_rotated || withTransitionForHorizontalAxis) { + yaxis = yaxis.transition().duration(durationForAxis); + } + yaxis.call(yAxis); + // y2 axis main.select('.' + CLASS.axisY2).style("opacity", hideAxis ? 0 : 1).transition().duration(durationForAxis).call(yAxis2); // show/hide if manual culling needed @@ -3343,10 +3372,12 @@ } function updateAndRedraw(options) { - options = isDefined(options) ? options : {}; + options = options || {}; + // same with redraw options.withTransition = isDefined(options.withTransition) ? options.withTransition : true; options.withTransform = isDefined(options.withTransform) ? options.withTransform : false; options.withLegend = isDefined(options.withLegend) ? options.withLegend : false; + // NOT same with redraw options.withUpdateXDomain = true; options.withUpdateOrgXDomain = true; options.withTransitionForExit = false; @@ -3578,7 +3609,7 @@ var legendItem, isTarget, notTarget; if (!__legend_show) { return; } legendItem = legend.selectAll('.' + CLASS.legendItem); - isTarget = function (d) { return !id || d === id; }; + isTarget = function (d) { return (!id || d === id); }; notTarget = function (d) { return !isTarget(d); }; legendItem.filter(notTarget).transition().duration(100).style('opacity', focus ? 0.3 : 1); legendItem.filter(isTarget).transition().duration(100).style('opacity', focus ? 1 : 0.3); @@ -3595,16 +3626,32 @@ .transition().duration(100) .style('opacity', 1); } + function showLegend(targetIds) { + removeHiddenLegendIds(targetIds); + legend.selectAll(selectorLegends(targetIds)) + .style('visibility', 'visible') + .transition() + .style('opacity', 1); + updateLegend(mapToIds(c3.data.targets)); + } + function hideLegend(targetIds) { + addHiddenLegendIds(targetIds); + legend.selectAll(selectorLegends(targetIds)) + .style('opacity', 0) + .style('visibility', 'hidden'); + updateLegend(mapToIds(c3.data.targets)); + } - function updateLegend(targets, options) { - var ids = mapToIds(targets), l; + function updateLegend(targetIds, options) { var xForLegend, xForLegendText, xForLegendRect, yForLegend, yForLegendText, yForLegendRect; var paddingTop = 4, paddingRight = 26, maxWidth = 0, maxHeight = 0, posMin = 10; - var totalLength = 0, offsets = {}, widths = {}, heights = {}, margins = {}, steps = {}, step = 0; - var withTransition; + var l, totalLength = 0, offsets = {}, widths = {}, heights = {}, margins = [0], steps = {}, step = 0; + var withTransition, withTransitionForTransform, withTransformAll; options = isUndefined(options) ? {} : options; withTransition = isDefined(options.withTransition) ? options.withTransition : true; + withTransitionForTransform = isDefined(options.withTransitionForTransform) ? options.withTransitionForTransform : true; + withTransformAll = isDefined(options.withTransformAll) ? options.withTransformAll : true; function updatePositions(textElement, id, reset) { var box = textElement.getBBox(), @@ -3637,6 +3684,11 @@ maxHeight = 0; } + if (!isLegendToShow(id)) { + widths[id] = heights[id] = steps[id] = offsets[id] = 0; + return; + } + widths[id] = itemWidth; heights[id] = itemHeight; @@ -3647,11 +3699,11 @@ if (__legend_equally) { Object.keys(widths).forEach(function (id) { widths[id] = maxWidth; }); Object.keys(heights).forEach(function (id) { heights[id] = maxHeight; }); - margin = (areaLength - maxLength * ids.length) / 2; + margin = (areaLength - maxLength * targetIds.length) / 2; if (margin < posMin) { totalLength = 0; step = 0; - ids.forEach(function (id) { updateValues(id); }); + targetIds.forEach(function (id) { updateValues(id); }); } else { updateValues(id, true); @@ -3675,7 +3727,7 @@ // Define g for legend area l = legend.selectAll('.' + CLASS.legendItem) - .data(ids) + .data(targetIds) .enter().append('g') .attr('class', function (id) { return generateClass(CLASS.legendItem, id); }) .style('cursor', 'pointer') @@ -3711,7 +3763,7 @@ .attr('height', 10); legend.selectAll('text') - .data(ids) + .data(targetIds) .text(function (id) { return isDefined(__data_names[id]) ? __data_names[id] : id; }) // MEMO: needed for update .each(function (id, i) { updatePositions(this, id, i === 0); }) .transition().duration(withTransition ? 250 : 0) @@ -3719,13 +3771,13 @@ .attr('y', yForLegendText); legend.selectAll('rect.' + CLASS.legendItemEvent) - .data(ids) + .data(targetIds) .transition().duration(withTransition ? 250 : 0) .attr('x', xForLegendRect) .attr('y', yForLegendRect); legend.selectAll('rect.' + CLASS.legendItemTile) - .data(ids) + .data(targetIds) .transition().duration(withTransition ? 250 : 0) .attr('x', xForLegend) .attr('y', yForLegend); @@ -3739,7 +3791,9 @@ updateScales(); updateSvgSize(); // Update g positions - transformAll(false); + if (withTransformAll) { + transformAll(withTransitionForTransform); + } } /*-- Event Handling --*/ @@ -3809,22 +3863,36 @@ revertLegend(); }; - c3.show = function (targetIds) { + c3.show = function (targetIds, options) { targetIds = mapToTargetIds(targetIds); + options = options || {}; + removeHiddenTargetIds(targetIds); svg.selectAll(selectorTargets(targetIds)) .transition() .style('opacity', 1); - redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: false}); + + if (options.withLegend) { + showLegend(targetIds); + } + + redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withTransitionForHorizontalAxis: false}); }; - c3.hide = function (targetIds) { + c3.hide = function (targetIds, options) { targetIds = mapToTargetIds(targetIds); + options = options || {}; + addHiddenTargetIds(targetIds); svg.selectAll(selectorTargets(targetIds)) .transition() .style('opacity', 0); - redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: false}); + + if (options.withLegend) { + hideLegend(targetIds); + } + + redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withTransitionForHorizontalAxis: false}); }; c3.toggle = function (targetId) { @@ -4025,7 +4093,7 @@ Object.keys(names).forEach(function (id) { __data_names[id] = names[id]; }); - updateLegend(c3.data.targets, {withTransition: true}); + updateLegend(mapToIds(c3.data.targets), {withTransition: true}); return __data_names; }; @@ -4082,6 +4150,17 @@ } }; + c3.legend.show = function (targetIds) { + if (!__legend_show) { return; } + showLegend(mapToTargetIds(targetIds)); + redraw({withTransitionForHorizontalAxis: false}); + }; + c3.legend.hide = function (targetIds) { + if (!__legend_show) { return; } + hideLegend(mapToTargetIds(targetIds)); + redraw({withTransitionForHorizontalAxis: false}); + }; + c3.resize = function (size) { __size_width = size ? size.width : null; __size_height = size ? size.height : null; diff --git a/c3.min.js b/c3.min.js index ba6055a..d34dd25 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,2 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.28"},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;cnf&&(nf=0),0>pf&&(pf=0),lf={top:yg?kf.top:sf-sg-(ci?0:tf),right:0/0,bottom:20+(ci?0:tf),left:yg?gi:kf.left},of=yg?kf.left-gi-hi:nf,qf=yg?pf:sf-lf.top-lf.bottom,0>of&&(of=0),0>qf&&(qf=0),mf={top:ci?0:sf-tf,right:0/0,bottom:0,left:ci?rf-uf:0},p(),ci&&Md(Ye.data.targets)&&(mf.left=nf/2+wf)}function o(){qi.select("line."+f.xgridFocus).attr("x1",yg?0:-10).attr("x2",yg?nf:-10).attr("y1",yg?-10:kf.top).attr("y2",yg?-10:pf)}function p(){wf=pf/2,vf=.95*wf,xf=Ld(Ye.data.targets)?.6*vf:0}function q(){var a=yg?f.axisX:f.axisY,b=Xe.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Xe.select($e).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return _e?_e:x()}function s(){var a=af?af:y();return a>0?a:320}function t(){return Md(Ye.data.targets)?0:bf?bf:yg||!Lg||Qg?1:v("y")}function u(){var a=1;return Md(Ye.data.targets)?0:cf?cf:ci?uf+(Ug&&!yg?v("y2"):a):Ug?Zg||yg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||Lg?"y2"!==a||Ug?(gb(a).isInner?30:40)+("y2"===a?-10:0):ii:ug&&!ci?10:1}function x(){return+Xe.select($e).style("width").replace("px","")}function y(){return+Xe.select($e).style("height").replace("px","")}function z(a){return a?-5:-(kf.left-1)}function A(a){return a?-20:-1}function B(){return z(!yg)}function C(){return A(!yg)}function D(){return z(yg)}function E(){return A(yg)}function F(a){return a?nf+2+4:kf.left+20}function G(a){return a?80:pf+2}function H(){return F(!yg)}function I(){return G(!yg)}function J(){return F(yg)}function K(){return G(yg)}function L(){var a=yg?pf:nf,b=tc(),c=Vb()*(Id(Ye.data.targets)?(b-(Ph?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){di=a}function N(a){ei=a}function O(a){fi=a}function P(){return ug?ci?ei*(di+1):rf:0}function Q(){return ug?ci?sf:fi*(di+1):0}function R(){var a,b=!Kf;Cf=yg?1:0,Df=yg?pf:nf,Ef=yg?0:pf,Ff=yg?nf:1,Gf=Cf,Hf=Df,If=yg?0:qf,Jf=yg?of:1,Kf=T(Cf,Df,b?void 0:Kf.domain(),function(){return Qf.tickOffset()}),Lf=U(Ef,Ff),Mf=U(Ef,Ff),Nf=T(Cf,Df,vi,function(a){return a%1?0:Tf.tickOffset()}),Of=U(If,Jf),Pf=U(If,Jf),a=$(),Qf=X(Kf,Zh,a),Tf=X(Nf,ai,a),Rf=Y(Lf,$h,Rg,Tg),Sf=Y(Mf,_h,$g,ah),b||(ji.scale(Nf),df&&ni.scale(Kf)),S()}function S(){yf=Db(),zf=Eb(),Af=Eb(.98)}function T(a,b,e,f){var g=(Oh?Xe.time.scale():Xe.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),Ph){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return Xe.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?Mf:Lf}function W(a){return"y2"===Z(a)?Pf:Of}function X(a,b,c){var d=(Ph?Bb():Xe.svg.axis()).scale(a).orient(b);return d.tickFormat(c),Ph?d.tickCentered(Bg):d.tickOffset=function(){var a=yg?pf:nf;return a*Vb()/tc()/2},Ph&&d.categories(Ag),d}function Y(a,b,c,d){return Xe.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in $f?$f[a]:"y"}function $(){var a=Oh?Xh:Ph?Jc:function(a){return 0>a?a.toFixed(0):a};return Cg&&("function"==typeof Cg?a=Cg:Oh&&(a=function(a){return Xe.time.format(Cg)(a)})),a}function _(a){var b;return"y"===a?b=Pg:"y2"===a?b=Yg:"x"===a&&(b=Kg),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Pg=b:"y2"===a?Yg=b:"x"===a&&(Kg=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",yg?"inner-top":"inner-right")}function eb(){return cb("y",yg?"inner-right":"inner-top")}function fb(){return cb("y2",yg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?nf/2:nf:b.isBottom?-pf:b.isMiddle?-pf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!yg,db())}function ob(){return kb(yg,eb())}function pb(){return kb(yg,fb())}function qb(){return lb(!yg,db())}function rb(){return lb(yg,eb())}function sb(){return lb(yg,fb())}function tb(){var a=db();return yg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return yg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return yg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!yg,db())}function xb(){return mb(yg,eb())}function yb(){return mb(yg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return Xe.selectAll("."+c+" .tick text").each(function(){var a=this.getBBox();bb?20:b}function Ab(){qi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),qi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),qi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Hc(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 Xe.min(Object.keys(i).map(function(a){return Xe.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=vc(a),i=Fc(a);if(Zf.length>0)for(g=Ic(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 Xe.max(Object.keys(i).map(function(a){return Xe.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Wg:Ng,n="y2"===c?Vg:Mg,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?Xg:Og,r=dd()&&yg;return 0===l.length?"y2"===c?Mf.domain():Lf.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=ed(o,p),j=$b(Lf.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Sg&&(f=b(Sg.top)?Sg.top:e,g=b(Sg.bottom)?Sg.bottom:e),"y2"===c&&_g&&(f=b(_g.top)?_g.top:e,g=b(_g.bottom)?_g.bottom:e),Id(l)&&!Hc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(vi),c=$b(Kf.domain());return a||0===c?1:b/c}function Wb(a){return Ig?Ig:Xe.min(a,function(a){return Xe.min(a.values,function(a){return a.x})})}function Xb(a){return Hg?Hg:Xe.max(a,function(a){return Xe.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return Ph?d=0:Id(a)?(c=tc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=Oh?new Date(c.getTime()-e):c-e,g=Oh?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return Uf&&a===Uf||ae(Vf)&&be(Vf,a)}function fc(a){return!ec(a)}function gc(a){return Uf?Uf:ae(Vf)?Vf[a]:null}function hc(a,b){return a in Ye.data.x&&Ye.data.x[a]&&Ye.data.x[a][b]?Ye.data.x[a][b]:b}function ic(a){Object.keys(a).forEach(function(b){Vf[b]=a[b]})}function jc(a){var b;return a&&(b=Yf[a.id],a.name=b?b:a.id),a}function kc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=mc(b[d],a.id,d)}),Ye.data.x[a.id]=b})}function lc(a,b){a.forEach(function(a){b[a.id]&&kc([a],b[a.id])})}function mc(a,b,c){var d;return d=Oh?a?a instanceof Date?a:Yd(a):Yd(hc(b,c)):Qh&&!Ph?a?+a:hc(b,c):c}function nc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0&&(Ye.data.x[b]=a.map(function(a){return a[c]})):Ye.data.x[b]=a.map(function(a,b){return b})}),c.forEach(function(a){if(!Ye.data.x[a])throw new Error('x is not defined for id = "'+a+'".')}),b=c.map(function(b,c){var d=Xf(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=mc(g,b,e);return Qh&&Ph&&0===c&&g&&(0===e&&(Ag=[]),Ag.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++})}),_f&&Gd(vc(b).filter(function(a){return!(a in ag)}),_f),b.forEach(function(a){ac(a.id_org,a)}),b}function qc(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 rc(a){return a>0&&Ye.data.targets[0].values[a-1]?Ye.data.targets[0].values[a-1].x:void 0}function sc(a){return a1?Ye.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?Ye.data.targets[0]:null,a}function vc(a){return a.map(function(a){return a.id})}function wc(a){return a?"string"==typeof a?[a]:a:vc(Ye.data.targets)}function xc(a,b){var c,d=vc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(Oh?new Date(h):h);i.push(d)}return i}function Dc(a){Yh=Yh.concat(a)}function Ec(a){Yh=Yh.filter(function(b){return a.indexOf(b)<0})}function Fc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Gc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Ic(a){return Gc(a,function(a){return a>0})}function Jc(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(md(a,f))),a[g].x&&(e=e.concat(md(a,g))),pd(e,b)):nd(a,b,f,g)}function od(a,b){var c;return c=a.map(function(a){return nd(a.values,b)}),pd(c,b)}function pd(a,b){var c,d;return a.forEach(function(a){var e=ce(a,b);(c>e||!c)&&(c=e,d=a)}),d}function qd(a,b){return Xe.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function rd(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 sd(){return cg&&"desc"===cg.toLowerCase()}function td(){return cg&&"asc"===cg.toLowerCase()}function ud(a){var b=td(),c=sd();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 cg&&a.sort(cg),a}function vd(a,c){var d,e,f,g,h,i,j,k=Md(Ye.data.targets),l=k?gd:fd,m=a.filter(function(a){return a&&b(a.value)});Bh&&0!==m.length&&(ti.html(Eh(a,$(),l,Wh)).style("display","block"),d=ti.property("offsetWidth"),e=ti.property("offsetHeight"),k?(g=nf/2+c[0],i=pf/2+c[1]+20):(yg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Kf(m[0].x)+20):(f=q(),g=f+t()+Kf(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),ti.style("top",i+"px").style("left",g+"px"))}function wd(){ti.style("display","none")}function xd(a){var c=a.filter(function(a){return a&&b(a.value)});Bh&&(Jd(Ye.data.targets)||Md(Ye.data.targets)||qi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(yg?"y1":"x1",id).attr(yg?"y2":"x2",id))}function yd(){qi.select("line."+f.xgridFocus).style("visibility","hidden")}function zd(a){return a.x||0===a.x?Kf(a.x):null}function Ad(a){return V(a.id)(a.value)}function Bd(){var a,b,d={},e=0;return Ac(yc(Pd)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Fd(a,b){return nh?nh:b?2*a.tickOffset()*oh/b:0}function Gd(a,b){wc(a).forEach(function(a){xi[a]=b===ag[a],ag[a]=b})}function Hd(a,b){var c=!1;return a.forEach(function(a){ag[a.id]===b&&(c=!0),a.id in ag||"line"!==b||(c=!0)}),c}function Id(a){return Hd(a,"bar")}function Jd(a){return Hd(a,"scatter")}function Kd(a){return Hd(a,"pie")}function Ld(a){return Hd(a,"donut")}function Md(a){return Kd(a)||Ld(a)}function Nd(a){var b="string"==typeof a?a:a.id;return!(b in ag)||"line"===ag[b]||"spline"===ag[b]||"area"===ag[b]||"area-spline"===ag[b]}function Od(a){var b="string"==typeof a?a:a.id;return"spline"===ag[b]||"area-spline"===ag[b]}function Pd(a){var b="string"==typeof a?a:a.id;return"bar"===ag[b]}function Qd(a){var b="string"==typeof a?a:a.id;return"scatter"===ag[b]}function Rd(a){var b="string"==typeof a?a:a.id;return"pie"===ag[b]}function Sd(a){var b="string"==typeof a?a:a.id;return"donut"===ag[b]}function Td(a){return Rd(a)||Sd(a)}function Ud(a){return Pd(a)?a.values:[]}function Vd(a){return Nd(a)||Qd(a)?a.values:[]}function Wd(a){return Pd(a)||Nd(a)?a.values:[]}function Xd(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function Yd(b){var c;if(!b)throw Error(b+" can not be parsed as d3.time with format "+Wf+". Maybe 'x' of this data is not defined. See data.x or data.xs option.");try{c=Wf?Xe.time.format(Wf).parse(b):new Date(b)}catch(d){c=void 0}return c||a.console.error("Failed to parse x '"+b+"' to Date with format "+Wf),c}function Zd(a,b){var c=Xe.mouse(a),d=Xe.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function be(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ce(a,b){var c="y"===Z(a.id)?Lf:Mf,d=yg?1:0,e=yg?0:1;return Math.pow(Kf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function de(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function ee(a,b,c){ng(b,a.node()),qi.select("."+f.selectedCircles+Yc(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Kc(f.selectedCircle,c)}).attr("cx",yg?Ad:zd).attr("cy",yg?zd:Ad).attr("stroke",function(){return Wh(b)}).attr("r",1.4*mh).transition().duration(100).attr("r",mh)}function fe(a,b,c){og(b,a.node()),qi.select("."+f.selectedCircles+Yc(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ge(a,b,c,d){a?ee(b,c,d):fe(b,c,d)}function he(a,b){ng(b,a.node()),a.transition().duration(100).style("fill",function(){return Xe.rgb(Wh(b)).darker(1)})}function ie(a,b){og(b,a.node()),a.transition().duration(100).style("fill",function(){return Wh(b)})}function je(a,b,c,d){a?he(b,c,d):ie(b,c,d)}function ke(a){return a.filter(function(a){return b(a.value)})}function le(a,c){return(c?qi.selectAll("."+f.circles+Yc(c)):qi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function me(a,b){le(a,b).classed(f.EXPANDED,!0).attr("r",lh)}function ne(a){le(a).filter(function(){return Xe.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",ih)}function oe(a){return qi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function pe(a){oe(a).classed(f.EXPANDED,!0)}function qe(a){oe(a).classed(f.EXPANDED,!1)}function re(a,b){var c=ve(a,b);return function(a,b){var d=c(a,b),e=yg?1:0,f=yg?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 se(a,b){var c=ve(a,!1),d=b?te:ue;return function(a,b){return d(c(a,b),a,this)}}function te(a,b){var c;return yg?(c=Pd(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function ue(a,b,c){var d=c.getBBox();return yg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:Pd(b)?-3:-6)}function ve(a,b){var c=a.__max__+1,d=Fd(Qf,c),e=Cd(d,c,a,!!b),f=Dd(!!b),g=Ed(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return yg&&(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 we(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 xe(b){var c,d,e;if(ui=Xe.select($e),ui.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ui.html(""),ui.classed("c3",!0),Ye.data.x={},Ye.data.targets=pc(b),n(),R(),Kf.domain(Xe.extent(Zb(Ye.data.targets))),Lf.domain(Ub(Ye.data.targets,"y")),Mf.domain(Ub(Ye.data.targets,"y2")),Nf.domain(Kf.domain()),Of.domain(Lf.domain()),Pf.domain(Mf.domain()),vi=Kf.domain(),ji.scale(Nf),df&&ni.scale(Kf),oi=ui.append("svg").attr("width",nf+kf.left+kf.right).attr("height",pf+kf.top+kf.bottom).on("mouseenter",gf).on("mouseleave",hf),pi=oi.append("defs"),pi.append("clipPath").attr("id",Ih).append("rect").attr("width",nf).attr("height",pf),pi.append("clipPath").attr("id",Jh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),pi.append("clipPath").attr("id",Kh).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),qi=oi.append("g").attr("transform",bi.main),ri=rg?oi.append("g").attr("transform",bi.context):null,si=ug?oi.append("g").attr("transform",bi.legend):null,ti=Xe.select($e).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),qi.append("g").attr("class",f.axisX).attr("clip-path",yg?"":Mh).attr("transform",bi.x).append("text").attr("class",f.axisXLabel).attr("transform",yg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),Lg&&qi.append("g").attr("class",f.axisY).attr("clip-path",yg?Nh:"").append("text").attr("class",f.axisYLabel).attr("transform",yg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),Ug&&qi.append("g").attr("class",f.axisY2).attr("transform",bi.y2).append("text").attr("class",f.axisY2Label).attr("transform",yg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=qi.append("g").attr("clip-path",Lh).attr("class",f.grid),bh&&d.append("g").attr("class",f.xgrids),ae(dh)&&d.append("g").attr("class",f.xgridLines),jh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),eh&&d.append("g").attr("class",f.ygrids),ae(fh)&&d.append("g").attr("class",f.ygridLines),qi.append("g").attr("clip-path",Lh).attr("class",f.regions),qi.append("g").attr("clip-path",Lh).attr("class",f.chart),c=qi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",df?yg?"ns-resize":"ew-resize":null),qi.select("."+f.chart).append("g").attr("class",f.chartBars),qi.select("."+f.chart).append("g").attr("class",f.chartLines),qi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",bi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),qi.select("."+f.chart).append("g").attr("class",f.chartTexts),df&&qi.insert("rect",ff?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",nf).attr("height",pf).style("opacity",0).style("cursor",yg?"ns-resize":"ew-resize").call(ni).on("dblclick.zoom",null),Jg&&ji.extent("function"!=typeof Jg?Jg:Jg(Zb())),rg&&(ri.append("g").attr("clip-path",Lh).attr("class",f.chart),ri.select("."+f.chart).append("g").attr("class",f.chartBars),ri.select("."+f.chart).append("g").attr("class",f.chartLines),ri.append("g").attr("clip-path",Lh).attr("class",f.brush).call(ji).selectAll("rect").attr(yg?"width":"height",yg?of:qf),ri.append("g").attr("class",f.axisX).attr("transform",bi.subx).attr("clip-path",yg?"":Mh)),Ke(Ye.data.targets),yg?qi.select("."+f.axisX).style("opacity",0).call(Qf):(qi.select("."+f.axisY).style("opacity",0).call(Rf),qi.select("."+f.axisY2).style("opacity",0).call(Sf)),Je({withTransform:!0,withLegend:!0,withTransitionForAxis:!1}),Fh){if(Oh&&"string"==typeof Gh){for(Gh=Yd(Gh),e=0;e0){d=[];for(var g in Yf)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=rd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=je,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 Ce(a){Md(Ye.data.targets)||gg&&(Rh=a,qi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Sh=!0,pg())}function De(){Md(Ye.data.targets)||gg&&(qi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),qi.selectAll("."+f.shape).classed(f.INCLUDED,!1),Sh=!1,qg())}function Ee(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P=Bd(),Q=Md(Ye.data.targets),R=Ac(Ye.data.targets);if(0!==R.length){if(a=d(a)?a:{},v=d(a.withY)?a.withY:!0,w=d(a.withSubchart)?a.withSubchart:!0,x=d(a.withTransition)?a.withTransition:!0,A=d(a.withTransform)?a.withTransform:!1,B=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,C=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,D=d(a.withLegend)?a.withLegend:!1,y=d(a.withTransitionForExit)?a.withTransitionForExit:x,z=d(a.withTransitionForAxis)?a.withTransitionForAxis:x,I=x?jf:0,J=y?I:0,K=z?I:0,D&&ug&&Se(Ye.data.targets,a),C&&(Kf.domain(Xe.extent(Zb(R))),vi=Kf.domain(),df&&ni.scale(Kf).updateScaleExtent(),Nf.domain(Kf.domain()),ji.scale(Nf)),B&&(Kf.domain(ji.empty()?vi:ji.extent()),df&&ni.scale(Kf).updateScaleExtent(),Jd(R)||(M=Cc(Bc(R)).sort(),Qf.tickValues(M),Tf.tickValues(M))),Lf.domain(Ub(R,"y")),Mf.domain(Ub(R,"y2")),qi.select("."+f.axisX).style("opacity",Q?0:1).transition().duration(K).call(Qf),qi.select("."+f.axisY).style("opacity",Q?0:1).transition().duration(K).call(Rf),qi.select("."+f.axisY2).style("opacity",Q?0:1).transition().duration(K).call(Sf),B&&Dg&&M){for(N=1;N=V;V++)e.push(new Date(V+"-01-01 00:00:00"))}else e=Kf.ticks(10);c=qi.select("."+f.xgrids).selectAll("."+f.xgrid).data(e),c.enter().append("line").attr("class",f.xgrid),c.attr("x1",yg?0:function(a){return Kf(a)-Qf.tickOffset()}).attr("x2",yg?nf:function(a){return Kf(a)-Qf.tickOffset()}).attr("y1",yg?function(a){return Kf(a)-Qf.tickOffset()}:kf.top).attr("y2",yg?function(a){return Kf(a)-Qf.tickOffset()}:pf).style("opacity",function(){return+Xe.select(this).attr(yg?"y1":"x1")===(yg?pf:0)?0:1}),c.exit().remove()}ae(dh)&&(g=qi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(dh),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",yg?"":"rotate(-90)").attr("dx",yg?0:-kf.top).attr("dy",-5).style("opacity",0),g.select("line").transition().duration(I).attr("x1",yg?0:jd).attr("x2",yg?nf:jd).attr("y1",yg?jd:kf.top).attr("y2",yg?jd:pf).style("opacity",1),g.select("text").transition().duration(I).attr("x",yg?nf:0).attr("y",jd).text(function(a){return a.text}).style("opacity",1),g.exit().transition().duration(I).style("opacity",0).remove()),v&&eh&&(i=qi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Lf.ticks(gh)),i.enter().append("line").attr("class",f.ygrid),i.attr("x1",yg?Lf:0).attr("x2",yg?Lf:nf).attr("y1",yg?0:Lf).attr("y2",yg?pf:Lf),i.exit().remove()),v&&ae(fh)&&(j=qi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(fh),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",yg?"rotate(-90)":"").attr("dx",yg?0:-kf.top).attr("dy",-5).style("opacity",0),j.select("line").transition().duration(I).attr("x1",yg?kd:0).attr("x2",yg?kd:nf).attr("y1",yg?0:kd).attr("y2",yg?pf:kd).style("opacity",1),j.select("text").transition().duration(I).attr("x",yg?0:nf).attr("y",kd).text(function(a){return a.text}).style("opacity",1),j.exit().transition().duration(I).style("opacity",0).remove()),m=qi.selectAll("."+f.bars).selectAll("."+f.bar).data(Ud),m.enter().append("path").attr("d",E).style("stroke","none").style("opacity",0).style("fill",function(a){return Wh(a)}).attr("class",Sc),m.style("opacity",_c).transition().duration(I).attr("d",E).style("opacity",1),m.exit().transition().duration(J).style("opacity",0).remove(),p=qi.selectAll("."+f.texts).selectAll("."+f.text).data(Wd),p.enter().append("text").attr("class",Lc).attr("text-anchor",function(a){return yg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),p.text(function(a){return hd(a.id)(a.value)}).style("fill-opacity",ad).transition().duration(I).attr("x",G).attr("y",H).style("fill-opacity",cd),p.exit().transition().duration(J).style("fill-opacity",0).remove(),qi.selectAll("."+f.line).style("opacity",_c).transition().duration(I).attr("d",ki).style("opacity",1),qi.selectAll("."+f.area).style("opacity",0).transition().duration(I).attr("d",li).style("opacity",wi),l=qi.selectAll("."+f.circles).selectAll("."+f.circle).data(Vd),l.enter().append("circle").attr("class",Qc).style("opacity",0).attr("r",ih),l.style("opacity",_c).transition().duration(I).style("opacity",bd).attr("cx",yg?Ad:zd).attr("cy",yg?zd:Ad),l.exit().remove(),qi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",A?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(I).attrTween("d",function(a){var b,c=Cb(a);return c?(b=Xe.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",A?"scale(1)":"").style("opacity",1),qi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(I).text(Jb).style("opacity",function(a){return zc(a.data.id)&&Td(a.data)?1:0}),qi.select("."+f.chartArcsTitle).style("opacity",Ld(Ye.data.targets)?1:0),rg&&(null!==Xe.event&&"zoom"===Xe.event.type&&ji.extent(Kf.orgDomain()).update(),w&&(ri.select("."+f.axisX).style("opacity",Q?0:1).transition().duration(I).call(Tf),ji.empty()||ji.extent(Kf.orgDomain()).update(),F=re(P,!0),q=ri.selectAll("."+f.bars).selectAll("."+f.bar).data(Ud),q.enter().append("path").attr("d",F).style("stroke","none").style("fill",function(a){return Wh(a)}).attr("class",Sc),q.style("opacity",_c).transition().duration(I).attr("d",F).style("opacity",1),q.exit().transition().duration(I).style("opacity",0).remove(),ri.selectAll("."+f.line).style("opacity",_c).transition().duration(I).attr("d",mi).style("opacity",1))),qi.selectAll("."+f.selectedCircles).filter(function(a){return Pd(a)}).selectAll("circle").remove(),qi.selectAll("."+f.selectedCircle).transition().duration(I).attr("cx",yg?Ad:zd).attr("cy",yg?zd:Ad),ae(Vf)?(r=qi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),ze(r.enter()),r.attr("x",0).attr("y",0).attr("width",nf).attr("height",pf)):(Qh&&!Ph?(u=function(a,b){var c=rc(b),d=sc(b),e=Ye.data.x[a.id][b];return(Kf(d?d:e+50)-Kf(c?c:e-50))/2},t=function(a,b){var c=rc(b),d=Ye.data.x[a.id][b];return(Kf(d)+Kf(c?c:d-50))/2}):(u=L(),t=function(a){return Kf(a.x)-u/2}),s=uc(),qi.select("."+f.eventRects).datum(s?s.values:[]),r=qi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),ye(r.enter()),r.attr("class",Xc).attr("x",yg?0:t).attr("y",yg?t:0).attr("width",yg?nf:u).attr("height",yg?u:pf),r.exit().remove()),n=qi.select("."+f.regions).selectAll("rect."+f.region).data(Ah),n.enter().append("rect").style("fill-opacity",0),n.attr("class",Wc).attr("x",yg?0:cc).attr("y",yg?cc:kf.top).attr("width",yg?nf:dc).attr("height",yg?dc:pf).transition().duration(I).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),n.exit().transition().duration(I).style("fill-opacity",0).remove(),vc(Ye.data.targets).forEach(function(a){xi[a]=!0})}}function Fe(){Ee({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ge(){return"mousemove"===Xe.event.sourceEvent.type&&ni.altDomain?(Kf.domain(ni.altDomain),void ni.scale(Kf).updateScaleExtent()):(Ph&&Kf.orgDomain()[0]===vi[0]&&Kf.domain([vi[0]-1e-10,Kf.orgDomain()[1]]),Ee({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Xe.event.sourceEvent.type&&(Th=!0)))}function He(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ie(){oi.attr("width",rf).attr("height",sf),oi.select("#"+Ih).select("rect").attr("width",nf).attr("height",pf),oi.select("#"+Jh).select("rect").attr("width",H),oi.select("#"+Kh).select("rect").attr("width",J),oi.select("."+f.zoomRect).attr("width",nf).attr("height",pf)}function Je(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(),R(),Ie(),m(a.withTransition),Ee(a)}function Ke(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=qi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a),j=i.enter().append("g").attr("class",function(a){return f.chartText+Kc(f.target,a.id)}).style("pointer-events","none"),j.append("g").attr("class",Mc).style("fill",function(a){return Wh(a)}),e=qi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),d=e.enter().append("g").attr("class",function(a){return f.chartBar+Kc(f.target,a.id)}).style("pointer-events","none"),d.append("g").attr("class",Tc).style("fill",function(a){return Wh(a)}).style("stroke","none").style("cursor",function(a){return ig(a)?"pointer":null}),c=qi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),b=c.enter().append("g").attr("class",function(a){return f.chartLine+Kc(f.target,a.id)}).style("pointer-events","none"),b.append("path").attr("class",Pc).style("opacity",0).style("stroke",function(a){return Wh(a)}),b.append("path").attr("class",Vc).style("opacity",function(){return wi=+Xe.select(this).style("opacity"),0}).style("fill",function(a){return Wh(a)}),b.append("g").attr("class",function(a){return Kc(f.selectedCircles,a.id)}),b.append("g").attr("class",Rc).style("fill",function(a){return Wh(a)}).style("cursor",function(a){return ig(a)?"pointer":null}),a.forEach(function(a){qi.selectAll("."+f.selectedCircles+Yc(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=qi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Bf(a)),g=h.enter().append("g").attr("class",function(a){return f.chartArc+Kc(f.target,a.data.id)}),g.append("path").attr("class",Uc).style("opacity",0).style("fill",function(a){return Wh(a.data)}).style("cursor",function(a){return ig(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),Pe(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];vd(c,Xe.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),Re(),wd(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),rg&&(n=ri.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),m=n.enter().append("g").attr("class",function(a){return f.chartBar+Kc(f.target,a.id)}),m.append("g").attr("class",Tc).style("fill",function(a){return Wh(a)}),l=ri.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),k=l.enter().append("g").attr("class",function(a){return f.chartLine+Kc(f.target,a.id)}),k.append("path").attr("class",Pc).style("opacity",0).style("stroke",function(a){return Wh(a)})),oi.selectAll("."+f.target).filter(function(a){return zc(a.id)}).transition().style("opacity",1)}function Le(a,b){Ye.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=ci?i:h,k=ci?tf:uf;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=ci?u:t,xg?(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=vc(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,ci?(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=si.selectAll("."+f.legendItem).data(q).enter().append("g").attr("class",function(a){return Kc(f.legendItem,a)}).style("cursor","pointer").on("click",function(a){"function"==typeof wg?wg(a):Ye.toggle(a)}).on("mouseover",function(a){Ye.focus(a)}).on("mouseout",function(){Ye.revert()}),g.append("text").text(function(a){return d(Yf[a])?Yf[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",ci?i:-200).attr("y",ci?-200:l),g.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",ci?j:-200).attr("y",ci?-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 Wh(a)}).attr("x",ci?i:-200).attr("y",ci?-200:k).attr("width",10).attr("height",10),si.selectAll("text").data(q).text(function(a){return d(Yf[a])?Yf[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",i).attr("y",l),si.selectAll("rect."+f.legendItemEvent).data(q).transition().duration(p?250:0).attr("x",j).attr("y",o),si.selectAll("rect."+f.legendItemTile).data(q).transition().duration(p?250:0).attr("x",h).attr("y",k),N(t),O(u),M(C),n(),R(),Ie(),m(!1)}function Te(a){return xc(Ye.data.targets,a.id)}function Ue(a){return"data"in a&&xc(Ye.data.targets,a.data.id)}function Ve(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 We(a,b,c){var d=!Md(Ye.data.targets);Gd(a,b),Je(c?c:{withTransitionForAxis:d})}var Xe=a.d3?a.d3:a.require?a.require("d3"):void 0,Ye={data:{},axis:{}},Ze={},$e=h(["bindto"],"#chart"),_e=h(["size","width"]),af=h(["size","height"]),bf=h(["padding","left"]),cf=h(["padding","right"]),df=h(["zoom","enabled"],!1),ef=h(["zoom","extent"]),ff=h(["zoom","privileged"],!1),gf=h(["onenter"],function(){}),hf=h(["onleave"],function(){}),jf=h(["transition","duration"],350);g("data","data is required in config");var 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,Rf,Sf,Tf,Uf=h(["data","x"]),Vf=h(["data","xs"],{}),Wf=h(["data","x_format"]),Xf=h(["data","id_converter"],function(a){return a}),Yf=h(["data","names"],{}),Zf=h(["data","groups"],[]),$f=h(["data","axes"],{}),_f=h(["data","type"]),ag=h(["data","types"],{}),bg=h(["data","labels"],{}),cg=h(["data","order"]),dg=h(["data","regions"],{}),eg=h(["data","color"]),fg=h(["data","colors"],{}),gg=h(["data","selection","enabled"],!1),hg=h(["data","selection","grouped"],!1),ig=h(["data","selection","isselectable"],function(){return!0}),jg=h(["data","selection","multiple"],!0),kg=h(["data","onclick"],function(){}),lg=h(["data","onenter"],function(){}),mg=h(["data","onleave"],function(){}),ng=h(["data","onselected"],function(){}),og=h(["data","onunselected"],function(){}),pg=h(["data","ondragstart"],function(){}),qg=h(["data","ondragend"],function(){}),rg=h(["subchart","show"],!1),sg=rg?h(["subchart","size","height"],60):0,tg=h(["color","pattern"],[]),ug=h(["legend","show"],!0),vg=h(["legend","position"],"bottom"),wg=h(["legend","item","onclick"]),xg=h(["legend","equally"],!1),yg=h(["axis","rotated"],!1),zg=h(["axis","x","type"],"indexed"),Ag=h(["axis","x","categories"],[]),Bg=h(["axis","x","tick","centered"],!1),Cg=h(["axis","x","tick","format"]),Dg=h(["axis","x","tick","culling"],{}),Eg=h(["axis","x","tick","culling","max"],"categorized"===zg?1/0:10),Fg=h(["axis","x","tick","count"]),Gg=h(["axis","x","tick","fit"],!1),Hg=h(["axis","x","max"]),Ig=h(["axis","x","min"]),Jg=h(["axis","x","default"]),Kg=h(["axis","x","label"],{}),Lg=h(["axis","y","show"],!0),Mg=h(["axis","y","max"]),Ng=h(["axis","y","min"]),Og=h(["axis","y","center"]),Pg=h(["axis","y","label"],{}),Qg=h(["axis","y","inner"],!1),Rg=h(["axis","y","tick","format"]),Sg=h(["axis","y","padding"],{}),Tg=h(["axis","y","ticks"],10),Ug=h(["axis","y2","show"],!1),Vg=h(["axis","y2","max"]),Wg=h(["axis","y2","min"]),Xg=h(["axis","y2","center"]),Yg=h(["axis","y2","label"],{}),Zg=h(["axis","y2","inner"],!1),$g=h(["axis","y2","tick","format"]),_g=h(["axis","y2","padding"],{}),ah=h(["axis","y2","ticks"],10),bh=h(["grid","x","show"],!1),ch=h(["grid","x","type"],"tick"),dh=h(["grid","x","lines"],[]),eh=h(["grid","y","show"],!1),fh=h(["grid","y","lines"],[]),gh=h(["grid","y","ticks"],10),hh=h(["point","show"],!0),ih=hh?h(["point","r"],2.5):0,jh=h(["point","focus","line","enabled"],!0),kh=h(["point","focus","expand","enabled"],!0),lh=h(["point","focus","expand","r"],kh?4:ih),mh=h(["point","focus","select","r"],8),nh=h(["bar","width"]),oh=h(["bar","width","ratio"],.6),ph=h(["pie","label","show"],!0),qh=h(["pie","label","format"]),rh=h(["pie","onclick"],function(){}),sh=h(["pie","onmouseover"],function(){}),th=h(["pie","onmouseout"],function(){}),uh=h(["donut","label","show"],!0),vh=h(["donut","label","format"]),wh=h(["donut","title"],""),xh=h(["donut","onclick"],function(){}),yh=h(["donut","onmouseover"],function(){}),zh=h(["donut","onmouseout"],function(){}),Ah=h(["regions"],[]),Bh=h(["tooltip","show"],!0),Ch=h(["tooltip","format","title"]),Dh=h(["tooltip","format","value"]),Eh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Ch?Ch:b,l=Dh?Dh: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+""}),Fh=h(["tooltip","init","show"],!1),Gh=h(["tooltip","init","x"],0),Hh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Ih=("string"==typeof $e?$e.replace("#",""):$e.id)+"-clip",Jh=Ih+"-xaxis",Kh=Ih+"-yaxis",Lh=i(Ih),Mh=i(Mh),Nh=i(Nh),Oh="timeseries"===zg,Ph="categorized"===zg,Qh=!Oh&&(Uf||ae(Vf)),Rh=null,Sh=!1,Th=!1,Uh=!1,Vh=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Wh=Xd(fg,ae(tg)?tg:Vh,eg),Xh=function(){var a=[[Xe.time.format("%Y/%-m/%-d"),function(){return!0}],[Xe.time.format("%-m/%-d"),function(a){return a.getMonth()}],[Xe.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[Xe.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Xe.time.format("%I %p"),function(a){return a.getHours()}],[Xe.time.format("%I:%M"),function(a){return a.getMinutes()}],[Xe.time.format(":%S"),function(a){return a.getSeconds()}],[Xe.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)}}(),Yh=[],Zh=yg?"left":"bottom",$h=yg?Qg?"top":"bottom":Qg?"right":"left",_h=yg?Zg?"bottom":"top":Zg?"left":"right",ai=yg?"left":"bottom",bi={main:function(){return"translate("+kf.left+","+kf.top+")"},context:function(){return"translate("+lf.left+","+lf.top+")"},legend:function(){return"translate("+mf.left+","+mf.top+")"},x:function(){return"translate(0,"+(yg?0:pf)+")"},y:function(){return"translate(0,"+(yg?pf:0)+")"},y2:function(){return"translate("+(yg?0:nf)+","+(yg?1:0)+")"},subx:function(){return"translate(0,"+(yg?0:qf)+")"},arc:function(){return"translate("+nf/2+","+pf/2+")"}},ci="right"===vg,di=0,ei=0,fi=0,gi=30,hi=30,ii=5;Bf=Xe.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var ji,ki=function(){var a=Xe.svg.line().x(yg?function(a){return V(a.id)(a.value)}:id).y(yg?id:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=ke(b.values);return Nd(b)?(a.interpolate(Od(b)?"cardinal":"linear"),dg[b.id]?we(e,Kf,V(b.id),dg[b.id]):a(e)):(c=Kf(e[0].x),d=V(b.id)(e[0].value),yg?"M "+d+" "+c:"M "+c+" "+d)}}(),li=function(){var a;return a=yg?Xe.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(id):Xe.svg.area().x(id).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=ke(b.values);return Hd([b],"area")||Hd([b],"area-spline")?(a.interpolate(Od(b)?"cardinal":"linear"),a(e)):(c=Kf(e[0].x),d=V(b.id)(e[0].value),yg?"M "+d+" "+c:"M "+c+" "+d)}}(),mi=function(){var a=Xe.svg.line().x(yg?function(a){return W(a.id)(a.value)}:ld).y(yg?ld:function(a){return W(a.id)(a.value)});return function(b){var c=ke(b.values);return Nd(b)?a(c):"M "+Nf(c[0].x)+" "+W(b.id)(c[0].value)}}(),ni=function(){};ji=Xe.svg.brush().on("brush",Fe),ji.update=function(){return ri&&ri.select("."+f.brush).call(this),this},ji.scale=function(a){return yg?this.y(a):this.x(a)},df&&(ni=Xe.behavior.zoom().on("zoomstart",function(){ni.altDomain=Xe.event.sourceEvent.altKey?Kf.orgDomain():null}).on("zoom",df?Ge:null),ni.scale=function(a){return yg?this.y(a):this.x(a)},ni.orgScaleExtent=function(){var a=ef?ef:[1,10];return[a[0],Math.max(tc()/a[1],a[1])]},ni.updateScaleExtent=function(){var a=$b(Kf.orgDomain())/$b(vi),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var oi,pi,qi,ri,si,ti,ui,vi,wi,xi={};if(Ye.focus=function(a){function b(a){Ac(a).transition().duration(100).style("opacity",1)}var c=oi.selectAll(Zc(a)),d=c.filter(Te),e=c.filter(Ue);Ye.revert(),Ye.defocus(),b(d.classed(f.focused,!0)),b(e),Md(Ye.data.targets)&&Kb(a,!0),Pe(a)},Ye.defocus=function(a){function b(a){Ac(a).transition().duration(100).style("opacity",.3)}var c=oi.selectAll(Zc(a)),d=c.filter(Te),e=c.filter(Ue);Ye.revert(),b(d.classed(f.focused,!1)),b(e),Md(Ye.data.targets)&&Lb(a),Qe(a)},Ye.revert=function(a){function b(a){Ac(a).transition().duration(100).style("opacity",1)}var c=oi.selectAll(Zc(a)),d=c.filter(Te),e=c.filter(Ue);b(d.classed(f.focused,!1)),b(e),Md(Ye.data.targets)&&Lb(a),Re()},Ye.show=function(a){a=wc(a),Ec(a),oi.selectAll($c(a)).transition().style("opacity",1),Ee({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!1})},Ye.hide=function(a){a=wc(a),Dc(a),oi.selectAll($c(a)).transition().style("opacity",0),Ee({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!1})},Ye.toggle=function(a){zc(a)?Ye.hide(a):Ye.show(a)},Ye.unzoom=function(){ji.clear().update(),Ee({withUpdateXDomain:!0})},Ye.load=function(a){return a.xs&&ic(a.xs),"categories"in a&&Ph&&(Ag=a.categories,Qf.categories(Ag)),"cacheIds"in a&&_b(a.cacheIds)?void Le(bc(a.cacheIds),a.done):void("unload"in a?Ne(wc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Me(a)}):Me(a))},Ye.unload=function(a){Ne(wc(a),function(){Ee({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},Ye.selected=function(a){return Xe.merge(qi.selectAll("."+f.shapes+Yc(a)).selectAll("."+f.shape).filter(function(){return Xe.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},Ye.select=function(a,b,c){gg&&qi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=Xe.select(this),i="circle"===this.nodeName?ee:he,j="circle"===this.nodeName?fe:ie,k=hg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?ig(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},Ye.unselect=function(a,b){gg&&qi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=Xe.select(this),g="circle"===this.nodeName?fe:ie,h=hg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&ig(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},Ye.toLine=function(a){We(a,"line")},Ye.toSpline=function(a){We(a,"spline")},Ye.toBar=function(a){We(a,"bar")},Ye.toScatter=function(a){We(a,"scatter")},Ye.toArea=function(a){We(a,"area")},Ye.toAreaSpline=function(a){We(a,"area-spline")},Ye.toPie=function(a){We(a,"pie",{withTransform:!0})},Ye.toDonut=function(a){We(a,"donut",{withTransform:!0})},Ye.groups=function(a){return c(a)?Zf:(Zf=a,Ee(),Zf)},Ye.xgrids=function(a){return a?(dh=a,Ee(),dh):dh},Ye.xgrids.add=function(a){return a?Ye.xgrids(dh.concat(a)):void 0},Ye.xgrids.remove=function(a){var b=Ve(a);return Ye.xgrids(dh.filter(b))},Ye.ygrids=function(a){return a?(fh=a,Ee(),fh):fh},Ye.ygrids.add=function(a){return a?Ye.ygrids(fh.concat(a)):void 0},Ye.ygrids.remove=function(a){var b=Ve(a);return Ye.ygrids(fh.filter(b))},Ye.regions=function(a){return c(a)?Ah:(Ah=a,Ee(),Ah)},Ye.regions.add=function(a){return c(a)?Ah:(Ah=Ah.concat(a),Ee(),Ah)},Ye.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;oi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Ah=Ah.filter(function(b){return b.classes.indexOf(a)<0})}),Ah},Ye.data.get=function(a){var b=Ye.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Ye.data.getAsTarget=function(a){var b=yc(function(b){return b.id===a});return b.length>0?b[0]:void 0},Ye.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Yf[b]=a[b]}),Se(Ye.data.targets,{withTransition:!0}),Yf):Yf},Ye.x=function(a){return arguments.length&&(kc(Ye.data.targets,a),Ee({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ye.data.x},Ye.xs=function(a){return arguments.length&&(lc(Ye.data.targets,a),Ee({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ye.data.x},Ye.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},Ye.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Mg=+a.y),b(a.y2)&&(Vg=+a.y2)):Mg=Vg=+a,Ee())},Ye.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Ng=+a.y),b(a.y2)&&(Wg=+a.y2)):Ng=Wg=+a,Ee())},Ye.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Ye.axis.max(a.max),"undefined"!=typeof a.min&&Ye.axis.min(a.min))},Ye.resize=function(a){_e=a?a.width:null,af=a?a.height:null,Je({withLegend:!0,withTransition:!1})},Ye.destroy=function(){Ye.data.targets=void 0,Ye.data.x={},ui.html(""),a.onresize=null},"url"in e.data)Xe.csv(e.data.url,function(a,b){xe(b)});else if("rows"in e.data)xe(nc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");xe(oc(e.data.columns))}return Ye},"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.28"},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;cuf&&(uf=0),0>wf&&(wf=0),sf={top:Fg?rf.top:zf-zg-(ki?0:Af),right:0/0,bottom:20+(ki?0:Af),left:Fg?oi:rf.left},vf=Fg?rf.left-oi-pi:uf,xf=Fg?wf:zf-sf.top-sf.bottom,0>vf&&(vf=0),0>xf&&(xf=0),tf={top:ki?0:zf-Af,right:0/0,bottom:0,left:ki?yf-Bf:0},p(),ki&&Rd(df.data.targets)&&(tf.left=uf/2+Df)}function o(){yi.select("line."+f.xgridFocus).attr("x1",Fg?0:-10).attr("x2",Fg?uf:-10).attr("y1",Fg?-10:rf.top).attr("y2",Fg?-10:wf)}function p(){Df=wf/2,Cf=.95*Df,Ef=Qd(df.data.targets)?.6*Cf:0}function q(){var a=Fg?f.axisX:f.axisY,b=cf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=cf.select(ff).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return gf?gf:x()}function s(){var a=hf?hf:y();return a>0?a:320}function t(){return Rd(df.data.targets)?0:jf?jf:Fg||!Sg||Xg?1:v("y")}function u(){var a=1;return Rd(df.data.targets)?0:kf?kf:ki?Bf+(_g&&!Fg?v("y2"):a):_g?eh||Fg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||Sg?"y2"!==a||_g?(gb(a).isInner?30:40)+("y2"===a?-10:0):qi:Bg&&!ki?10:1}function x(){return+cf.select(ff).style("width").replace("px","")}function y(){return+cf.select(ff).style("height").replace("px","")}function z(a){return a?-5:-(rf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Fg)}function C(){return A(!Fg)}function D(){return z(Fg)}function E(){return A(Fg)}function F(a){return a?uf+2+4:rf.left+20}function G(a){return a?80:wf+2}function H(){return F(!Fg)}function I(){return G(!Fg)}function J(){return F(Fg)}function K(){return G(Fg)}function L(){var a=Fg?wf:uf,b=tc(),c=Vb()*(Nd(df.data.targets)?(b-(Wh?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){li=a}function N(a){mi=a}function O(a){ni=a}function P(){return Bg?ki?mi*(li+1):yf:0}function Q(){return Bg?ki?zf:ni*(li+1):0}function R(){var a,b=!Rf;Jf=Fg?1:0,Kf=Fg?wf:uf,Lf=Fg?0:wf,Mf=Fg?uf:1,Nf=Jf,Of=Kf,Pf=Fg?0:xf,Qf=Fg?vf:1,Rf=T(Jf,Kf,b?void 0:Rf.domain(),function(){return Xf.tickOffset()}),Sf=U(Lf,Mf),Tf=U(Lf,Mf),Uf=T(Jf,Kf,Di,function(a){return a%1?0:$f.tickOffset()}),Vf=U(Pf,Qf),Wf=U(Pf,Qf),a=$(),Xf=X(Rf,fi,a),$f=X(Uf,ii,a),Yf=Y(Sf,gi,Yg,$g),Zf=Y(Tf,hi,fh,hh),b||(ri.scale(Uf),lf&&vi.scale(Rf)),S()}function S(){Ff=Db(),Gf=Eb(),Hf=Eb(.98)}function T(a,b,e,f){var g=(Vh?cf.time.scale():cf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),Wh){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return cf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?Tf:Sf}function W(a){return"y2"===Z(a)?Wf:Vf}function X(a,b,c){var d=(Wh?Bb():cf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),Wh?d.tickCentered(Ig):d.tickOffset=function(){var a=Fg?wf:uf;return a*Vb()/tc()/2},Wh&&d.categories(Hg),d}function Y(a,b,c,d){return cf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in fg?fg[a]:"y"}function $(){var a=Vh?ci:Wh?Mc:function(a){return 0>a?a.toFixed(0):a};return Jg&&("function"==typeof Jg?a=Jg:Vh&&(a=function(a){return cf.time.format(Jg)(a)})),a}function _(a){var b;return"y"===a?b=Wg:"y2"===a?b=dh:"x"===a&&(b=Rg),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Wg=b:"y2"===a?dh=b:"x"===a&&(Rg=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Fg?"inner-top":"inner-right")}function eb(){return cb("y",Fg?"inner-right":"inner-top")}function fb(){return cb("y2",Fg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?uf/2:uf:b.isBottom?-wf:b.isMiddle?-wf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Fg,db())}function ob(){return kb(Fg,eb())}function pb(){return kb(Fg,fb())}function qb(){return lb(!Fg,db())}function rb(){return lb(Fg,eb())}function sb(){return lb(Fg,fb())}function tb(){var a=db();return Fg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Fg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Fg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Fg,db())}function xb(){return mb(Fg,eb())}function yb(){return mb(Fg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return cf.selectAll("."+c+" .tick text").each(function(){var a=this.getBBox();bb?20:b}function Ab(){yi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),yi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),yi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Kc(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 cf.min(Object.keys(i).map(function(a){return cf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=vc(a),i=Ic(a);if(eg.length>0)for(g=Lc(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 cf.max(Object.keys(i).map(function(a){return cf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?bh:Ug,n="y2"===c?ah:Tg,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?ch:Vg,r=id()&&Fg;return 0===l.length?"y2"===c?Tf.domain():Sf.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=jd(o,p),j=$b(Sf.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Zg&&(f=b(Zg.top)?Zg.top:e,g=b(Zg.bottom)?Zg.bottom:e),"y2"===c&&gh&&(f=b(gh.top)?gh.top:e,g=b(gh.bottom)?gh.bottom:e),Nd(l)&&!Kc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Di),c=$b(Rf.domain());return a||0===c?1:b/c}function Wb(a){return Pg?Pg:cf.min(a,function(a){return cf.min(a.values,function(a){return a.x})})}function Xb(a){return Og?Og:cf.max(a,function(a){return cf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return Wh?d=0:Nd(a)?(c=tc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=Vh?new Date(c.getTime()-e):c-e,g=Vh?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return _f&&a===_f||fe(ag)&&ge(ag,a)}function fc(a){return!ec(a)}function gc(a){return _f?_f:fe(ag)?ag[a]:null}function hc(a,b){return a in df.data.x&&df.data.x[a]&&df.data.x[a][b]?df.data.x[a][b]:b}function ic(a){Object.keys(a).forEach(function(b){ag[b]=a[b]})}function jc(a){var b;return a&&(b=dg[a.id],a.name=b?b:a.id),a}function kc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=mc(b[d],a.id,d)}),df.data.x[a.id]=b})}function lc(a,b){a.forEach(function(a){b[a.id]&&kc([a],b[a.id])})}function mc(a,b,c){var d;return d=Vh?a?a instanceof Date?a:be(a):be(hc(b,c)):Xh&&!Wh?a?+a:hc(b,c):c}function nc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0&&(df.data.x[b]=a.map(function(a){return a[c]})):df.data.x[b]=a.map(function(a,b){return b})}),c.forEach(function(a){if(!df.data.x[a])throw new Error('x is not defined for id = "'+a+'".')}),b=c.map(function(b,c){var d=cg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=mc(g,b,e);return Xh&&Wh&&0===c&&g&&(0===e&&(Hg=[]),Hg.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++})}),gg&&Ld(vc(b).filter(function(a){return!(a in hg)}),gg),b.forEach(function(a){ac(a.id_org,a)}),b}function qc(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 rc(a){return a>0&&df.data.targets[0].values[a-1]?df.data.targets[0].values[a-1].x:void 0}function sc(a){return a1?df.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?df.data.targets[0]:null,a}function vc(a){return a.map(function(a){return a.id})}function wc(a){return a?"string"==typeof a?[a]:a:vc(df.data.targets)}function xc(a,b){var c,d=vc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(Vh?new Date(h):h);i.push(d)}return i}function Ec(a){di=di.concat(a)}function Fc(a){di=di.filter(function(b){return a.indexOf(b)<0})}function Gc(a){ei=ei.concat(a)}function Hc(a){ei=ei.filter(function(b){return a.indexOf(b)<0})}function Ic(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Jc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Lc(a){return Jc(a,function(a){return a>0})}function Mc(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(rd(a,f))),a[g].x&&(e=e.concat(rd(a,g))),ud(e,b)):sd(a,b,f,g)}function td(a,b){var c;return c=a.map(function(a){return sd(a.values,b)}),ud(c,b)}function ud(a,b){var c,d;return a.forEach(function(a){var e=he(a,b);(c>e||!c)&&(c=e,d=a)}),d}function vd(a,b){return cf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function wd(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 xd(){return jg&&"desc"===jg.toLowerCase()}function yd(){return jg&&"asc"===jg.toLowerCase()}function zd(a){var b=yd(),c=xd();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 jg&&a.sort(jg),a}function Ad(a,c){var d,e,f,g,h,i,j,k=Rd(df.data.targets),l=k?ld:kd,m=a.filter(function(a){return a&&b(a.value)});Ih&&0!==m.length&&(Bi.html(Lh(a,$(),l,bi)).style("display","block"),d=Bi.property("offsetWidth"),e=Bi.property("offsetHeight"),k?(g=uf/2+c[0],i=wf/2+c[1]+20):(Fg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Rf(m[0].x)+20):(f=q(),g=f+t()+Rf(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Bi.style("top",i+"px").style("left",g+"px"))}function Bd(){Bi.style("display","none")}function Cd(a){var c=a.filter(function(a){return a&&b(a.value)});Ih&&(Od(df.data.targets)||Rd(df.data.targets)||yi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Fg?"y1":"x1",nd).attr(Fg?"y2":"x2",nd))}function Dd(){yi.select("line."+f.xgridFocus).style("visibility","hidden")}function Ed(a){return a.x||0===a.x?Rf(a.x):null}function Fd(a){return V(a.id)(a.value)}function Gd(){var a,b,d={},e=0;return Bc(yc(Ud)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Kd(a,b){return uh?uh:b?2*a.tickOffset()*vh/b:0}function Ld(a,b){wc(a).forEach(function(a){Fi[a]=b===hg[a],hg[a]=b})}function Md(a,b){var c=!1;return a.forEach(function(a){hg[a.id]===b&&(c=!0),a.id in hg||"line"!==b||(c=!0)}),c}function Nd(a){return Md(a,"bar")}function Od(a){return Md(a,"scatter")}function Pd(a){return Md(a,"pie")}function Qd(a){return Md(a,"donut")}function Rd(a){return Pd(a)||Qd(a)}function Sd(a){var b="string"==typeof a?a:a.id;return!(b in hg)||"line"===hg[b]||"spline"===hg[b]||"area"===hg[b]||"area-spline"===hg[b]}function Td(a){var b="string"==typeof a?a:a.id;return"spline"===hg[b]||"area-spline"===hg[b]}function Ud(a){var b="string"==typeof a?a:a.id;return"bar"===hg[b]}function Vd(a){var b="string"==typeof a?a:a.id;return"scatter"===hg[b]}function Wd(a){var b="string"==typeof a?a:a.id;return"pie"===hg[b]}function Xd(a){var b="string"==typeof a?a:a.id;return"donut"===hg[b]}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){return Ud(a)?a.values:[]}function $d(a){return Sd(a)||Vd(a)?a.values:[]}function _d(a){return Ud(a)||Sd(a)?a.values:[]}function ae(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function be(b){var c;if(!b)throw Error(b+" can not be parsed as d3.time with format "+bg+". Maybe 'x' of this data is not defined. See data.x or data.xs option.");try{c=bg?cf.time.format(bg).parse(b):new Date(b)}catch(d){c=void 0}return c||a.console.error("Failed to parse x '"+b+"' to Date with format "+bg),c}function ce(a,b){var c=cf.mouse(a),d=cf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function ge(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function he(a,b){var c="y"===Z(a.id)?Sf:Tf,d=Fg?1:0,e=Fg?0:1;return Math.pow(Rf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ie(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function je(a,b,c){ug(b,a.node()),yi.select("."+f.selectedCircles+_c(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Nc(f.selectedCircle,c)}).attr("cx",Fg?Fd:Ed).attr("cy",Fg?Ed:Fd).attr("stroke",function(){return bi(b)}).attr("r",1.4*th).transition().duration(100).attr("r",th)}function ke(a,b,c){vg(b,a.node()),yi.select("."+f.selectedCircles+_c(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function le(a,b,c,d){a?je(b,c,d):ke(b,c,d)}function me(a,b){ug(b,a.node()),a.transition().duration(100).style("fill",function(){return cf.rgb(bi(b)).darker(1)})}function ne(a,b){vg(b,a.node()),a.transition().duration(100).style("fill",function(){return bi(b)})}function oe(a,b,c,d){a?me(b,c,d):ne(b,c,d)}function pe(a){return a.filter(function(a){return b(a.value)})}function qe(a,c){return(c?yi.selectAll("."+f.circles+_c(c)):yi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function re(a,b){qe(a,b).classed(f.EXPANDED,!0).attr("r",sh)}function se(a){qe(a).filter(function(){return cf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",ph)}function te(a){return yi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function ue(a){te(a).classed(f.EXPANDED,!0)}function ve(a){te(a).classed(f.EXPANDED,!1)}function we(a,b){var c=Ae(a,b);return function(a,b){var d=c(a,b),e=Fg?1:0,f=Fg?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 xe(a,b){var c=Ae(a,!1),d=b?ye:ze;return function(a,b){return d(c(a,b),a,this)}}function ye(a,b){var c;return Fg?(c=Ud(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function ze(a,b,c){var d=c.getBBox();return Fg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:Ud(b)?-3:-6)}function Ae(a,b){var c=a.__max__+1,d=Kd(Xf,c),e=Hd(d,c,a,!!b),f=Id(!!b),g=Jd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Fg&&(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 Be(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function Ce(b){var c,d,e;if(Ci=cf.select(ff),Ci.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Ci.html(""),Ci.classed("c3",!0),df.data.x={},df.data.targets=pc(b),n(),R(),Rf.domain(cf.extent(Zb(df.data.targets))),Sf.domain(Ub(df.data.targets,"y")),Tf.domain(Ub(df.data.targets,"y2")),Uf.domain(Rf.domain()),Vf.domain(Sf.domain()),Wf.domain(Tf.domain()),Di=Rf.domain(),ri.scale(Uf),lf&&vi.scale(Rf),wi=Ci.append("svg").attr("width",uf+rf.left+rf.right).attr("height",wf+rf.top+rf.bottom).on("mouseenter",of).on("mouseleave",pf),xi=wi.append("defs"),xi.append("clipPath").attr("id",Ph).append("rect").attr("width",uf).attr("height",wf),xi.append("clipPath").attr("id",Qh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),xi.append("clipPath").attr("id",Rh).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),yi=wi.append("g").attr("transform",ji.main),zi=yg?wi.append("g").attr("transform",ji.context):null,Ai=Bg?wi.append("g").attr("transform",ji.legend):null,Bi=cf.select(ff).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Ze(vc(df.data.targets),{withTransform:!1,withTransitionForTransform:!1}),yi.append("g").attr("class",f.axisX).attr("clip-path",Fg?"":Th).attr("transform",ji.x).append("text").attr("class",f.axisXLabel).attr("transform",Fg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),Sg&&yi.append("g").attr("class",f.axisY).attr("clip-path",Fg?Uh:"").attr("transform",ji.y).append("text").attr("class",f.axisYLabel).attr("transform",Fg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),_g&&yi.append("g").attr("class",f.axisY2).attr("transform",ji.y2).append("text").attr("class",f.axisY2Label).attr("transform",Fg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=yi.append("g").attr("clip-path",Sh).attr("class",f.grid),ih&&d.append("g").attr("class",f.xgrids),fe(kh)&&d.append("g").attr("class",f.xgridLines),qh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),lh&&d.append("g").attr("class",f.ygrids),fe(mh)&&d.append("g").attr("class",f.ygridLines),yi.append("g").attr("clip-path",Sh).attr("class",f.regions),yi.append("g").attr("clip-path",Sh).attr("class",f.chart),c=yi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",lf?Fg?"ns-resize":"ew-resize":null),yi.select("."+f.chart).append("g").attr("class",f.chartBars),yi.select("."+f.chart).append("g").attr("class",f.chartLines),yi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",ji.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),yi.select("."+f.chart).append("g").attr("class",f.chartTexts),lf&&yi.insert("rect",nf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",uf).attr("height",wf).style("opacity",0).style("cursor",Fg?"ns-resize":"ew-resize").call(vi).on("dblclick.zoom",null),Qg&&ri.extent("function"!=typeof Qg?Qg:Qg(Zb())),yg&&(zi.append("g").attr("clip-path",Sh).attr("class",f.chart),zi.select("."+f.chart).append("g").attr("class",f.chartBars),zi.select("."+f.chart).append("g").attr("class",f.chartLines),zi.append("g").attr("clip-path",Sh).attr("class",f.brush).call(ri).selectAll("rect").attr(Fg?"width":"height",Fg?vf:xf),zi.append("g").attr("class",f.axisX).attr("transform",ji.subx).attr("clip-path",Fg?"":Th)),Pe(df.data.targets),Fg?yi.select("."+f.axisX).style("opacity",0).call(Xf):(yi.select("."+f.axisY).style("opacity",0).call(Yf),yi.select("."+f.axisY2).style("opacity",0).call(Zf)),Je({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Mh){if(Vh&&"string"==typeof Nh){for(Nh=be(Nh),e=0;e0){d=[];for(var g in dg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=wd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=oe,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 He(a){Rd(df.data.targets)||ng&&(Yh=a,yi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Zh=!0,wg())}function Ie(){Rd(df.data.targets)||ng&&(yi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),yi.selectAll("."+f.shape).classed(f.INCLUDED,!1),Zh=!1,xg())}function Je(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S=Gd(),T=Rd(df.data.targets),U=Bc(df.data.targets);if(0!==U.length){if(a=d(a)?a:{},x=d(a.withY)?a.withY:!0,y=d(a.withSubchart)?a.withSubchart:!0,z=d(a.withTransition)?a.withTransition:!0,D=d(a.withTransform)?a.withTransform:!1,E=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,F=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,G=d(a.withLegend)?a.withLegend:!1,A=d(a.withTransitionForExit)?a.withTransitionForExit:z,B=d(a.withTransitionForAxis)?a.withTransitionForAxis:z,C=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:z,M=z?qf:0,N=A?M:0,O=B?M:0,G&&Bg&&Ze(vc(df.data.targets),a),F&&(Rf.domain(cf.extent(Zb(U))),Di=Rf.domain(),lf&&vi.scale(Rf).updateScaleExtent(),Uf.domain(Rf.domain()),ri.scale(Uf)),E&&(Rf.domain(ri.empty()?Di:ri.extent()),lf&&vi.scale(Rf).updateScaleExtent()),Sf.domain(Ub(U,"y")),Tf.domain(Ub(U,"y2")),Od(U)||(P=Dc(Cc(U)).sort(),Xf.tickValues(P),$f.tickValues(P)),c=yi.select("."+f.axisX).style("opacity",T?0:1),(Fg||C)&&(c=c.transition().duration(O)),c.call(Xf),e=yi.select("."+f.axisY).style("opacity",T?0:1),(!Fg||C)&&(e=e.transition().duration(O)),e.call(Yf),yi.select("."+f.axisY2).style("opacity",T?0:1).transition().duration(O).call(Zf),E&&Kg&&P){for(Q=1;Q=Y;Y++)h.push(new Date(Y+"-01-01 00:00:00"))}else h=Rf.ticks(10);g=yi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Fg?0:function(a){return Rf(a)-Xf.tickOffset()}).attr("x2",Fg?uf:function(a){return Rf(a)-Xf.tickOffset()}).attr("y1",Fg?function(a){return Rf(a)-Xf.tickOffset()}:rf.top).attr("y2",Fg?function(a){return Rf(a)-Xf.tickOffset()}:wf).style("opacity",function(){return+cf.select(this).attr(Fg?"y1":"x1")===(Fg?wf:0)?0:1}),g.exit().remove()}fe(kh)&&(i=yi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(kh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Fg?"":"rotate(-90)").attr("dx",Fg?0:-rf.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(M).attr("x1",Fg?0:od).attr("x2",Fg?uf:od).attr("y1",Fg?od:rf.top).attr("y2",Fg?od:wf).style("opacity",1),i.select("text").transition().duration(M).attr("x",Fg?uf:0).attr("y",od).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(M).style("opacity",0).remove()),x&&lh&&(k=yi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Sf.ticks(nh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Fg?Sf:0).attr("x2",Fg?Sf:uf).attr("y1",Fg?0:Sf).attr("y2",Fg?wf:Sf),k.exit().remove()),x&&fe(mh)&&(l=yi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(mh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Fg?"rotate(-90)":"").attr("dx",Fg?0:-rf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(M).attr("x1",Fg?pd:0).attr("x2",Fg?pd:uf).attr("y1",Fg?0:pd).attr("y2",Fg?wf:pd).style("opacity",1),l.select("text").transition().duration(M).attr("x",Fg?0:uf).attr("y",pd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(M).style("opacity",0).remove()),p=yi.selectAll("."+f.bars).selectAll("."+f.bar).data(Zd),p.enter().append("path").attr("d",H).style("stroke","none").style("opacity",0).style("fill",function(a){return bi(a)}).attr("class",Vc),p.style("opacity",ed).transition().duration(M).attr("d",H).style("opacity",1),p.exit().transition().duration(N).style("opacity",0).remove(),r=yi.selectAll("."+f.texts).selectAll("."+f.text).data(_d),r.enter().append("text").attr("class",Oc).attr("text-anchor",function(a){return Fg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return md(a.id)(a.value)}).style("fill-opacity",fd).transition().duration(M).attr("x",J).attr("y",K).style("fill-opacity",hd),r.exit().transition().duration(N).style("fill-opacity",0).remove(),yi.selectAll("."+f.line).style("opacity",ed).transition().duration(M).attr("d",si).style("opacity",1),yi.selectAll("."+f.area).style("opacity",0).transition().duration(M).attr("d",ti).style("opacity",Ei),n=yi.selectAll("."+f.circles).selectAll("."+f.circle).data($d),n.enter().append("circle").attr("class",Tc).style("opacity",0).attr("r",ph),n.style("opacity",ed).transition().duration(M).style("opacity",gd).attr("cx",Fg?Fd:Ed).attr("cy",Fg?Ed:Fd),n.exit().remove(),yi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",D?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(M).attrTween("d",function(a){var b,c=Cb(a);return c?(b=cf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",D?"scale(1)":"").style("opacity",1),yi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(M).text(Jb).style("opacity",function(a){return zc(a.data.id)&&Yd(a.data)?1:0}),yi.select("."+f.chartArcsTitle).style("opacity",Qd(df.data.targets)?1:0),yg&&(null!==cf.event&&"zoom"===cf.event.type&&ri.extent(Rf.orgDomain()).update(),y&&(zi.select("."+f.axisX).style("opacity",T?0:1).transition().duration(M).call($f),ri.empty()||ri.extent(Rf.orgDomain()).update(),I=we(S,!0),s=zi.selectAll("."+f.bars).selectAll("."+f.bar).data(Zd),s.enter().append("path").attr("d",I).style("stroke","none").style("fill",function(a){return bi(a)}).attr("class",Vc),s.style("opacity",ed).transition().duration(M).attr("d",I).style("opacity",1),s.exit().transition().duration(M).style("opacity",0).remove(),zi.selectAll("."+f.line).style("opacity",ed).transition().duration(M).attr("d",ui).style("opacity",1))),yi.selectAll("."+f.selectedCircles).filter(function(a){return Ud(a)}).selectAll("circle").remove(),yi.selectAll("."+f.selectedCircle).transition().duration(M).attr("cx",Fg?Fd:Ed).attr("cy",Fg?Ed:Fd),fe(ag)?(t=yi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ee(t.enter()),t.attr("x",0).attr("y",0).attr("width",uf).attr("height",wf)):(Xh&&!Wh?(w=function(a,b){var c=rc(b),d=sc(b),e=df.data.x[a.id][b];return(Rf(d?d:e+50)-Rf(c?c:e-50))/2},v=function(a,b){var c=rc(b),d=df.data.x[a.id][b];return(Rf(d)+Rf(c?c:d-50))/2}):(w=L(),v=function(a){return Rf(a.x)-w/2}),u=uc(),yi.select("."+f.eventRects).datum(u?u.values:[]),t=yi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),De(t.enter()),t.attr("class",$c).attr("x",Fg?0:v).attr("y",Fg?v:0).attr("width",Fg?uf:w).attr("height",Fg?w:wf),t.exit().remove()),q=yi.select("."+f.regions).selectAll("rect."+f.region).data(Hh),q.enter().append("rect").style("fill-opacity",0),q.attr("class",Zc).attr("x",Fg?0:cc).attr("y",Fg?cc:rf.top).attr("width",Fg?uf:dc).attr("height",Fg?dc:wf).transition().duration(M).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(M).style("fill-opacity",0).remove(),vc(df.data.targets).forEach(function(a){Fi[a]=!0})}}function Ke(){Je({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Le(){return"mousemove"===cf.event.sourceEvent.type&&vi.altDomain?(Rf.domain(vi.altDomain),void vi.scale(Rf).updateScaleExtent()):(Wh&&Rf.orgDomain()[0]===Di[0]&&Rf.domain([Di[0]-1e-10,Rf.orgDomain()[1]]),Je({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===cf.event.sourceEvent.type&&($h=!0)))}function Me(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ne(){wi.attr("width",yf).attr("height",zf),wi.select("#"+Ph).select("rect").attr("width",uf).attr("height",wf),wi.select("#"+Qh).select("rect").attr("width",H),wi.select("#"+Rh).select("rect").attr("width",J),wi.select("."+f.zoomRect).attr("width",uf).attr("height",wf)}function Oe(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Ne(),m(a.withTransition),Je(a)}function Pe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=yi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a),j=i.enter().append("g").attr("class",function(a){return f.chartText+Nc(f.target,a.id)}).style("pointer-events","none"),j.append("g").attr("class",Pc).style("fill",function(a){return bi(a)}),e=yi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),d=e.enter().append("g").attr("class",function(a){return f.chartBar+Nc(f.target,a.id)}).style("pointer-events","none"),d.append("g").attr("class",Wc).style("fill",function(a){return bi(a)}).style("stroke","none").style("cursor",function(a){return pg(a)?"pointer":null}),c=yi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),b=c.enter().append("g").attr("class",function(a){return f.chartLine+Nc(f.target,a.id)}).style("pointer-events","none"),b.append("path").attr("class",Sc).style("opacity",0).style("stroke",function(a){return bi(a)}),b.append("path").attr("class",Yc).style("opacity",function(){return Ei=+cf.select(this).style("opacity"),0}).style("fill",function(a){return bi(a)}),b.append("g").attr("class",function(a){return Nc(f.selectedCircles,a.id)}),b.append("g").attr("class",Uc).style("fill",function(a){return bi(a)}).style("cursor",function(a){return pg(a)?"pointer":null}),a.forEach(function(a){yi.selectAll("."+f.selectedCircles+_c(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=yi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(If(a)),g=h.enter().append("g").attr("class",function(a){return f.chartArc+Nc(f.target,a.data.id)}),g.append("path").attr("class",Xc).style("opacity",0).style("fill",function(a){return bi(a.data)}).style("cursor",function(a){return pg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),Ue(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Ad(c,cf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),We(),Bd(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),yg&&(n=zi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),m=n.enter().append("g").attr("class",function(a){return f.chartBar+Nc(f.target,a.id)}),m.append("g").attr("class",Wc).style("fill",function(a){return bi(a)}),l=zi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),k=l.enter().append("g").attr("class",function(a){return f.chartLine+Nc(f.target,a.id)}),k.append("path").attr("class",Sc).style("opacity",0).style("stroke",function(a){return bi(a)})),wi.selectAll("."+f.target).filter(function(a){return zc(a.id)}).transition().style("opacity",1)}function Qe(a,b){df.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBBox(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=ki?j:i,l=ki?Af:Bf;return d&&(x=0,D=0,u=0,v=0),Ac(c)?(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=ki?v:u,void(Eg?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c))):void(z[c]=A[c]=C[c]=y[c]=0)}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=c(b)?{}:b,p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,ki?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=Ai.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Nc(f.legendItem,a)}).style("cursor","pointer").on("click",function(a){"function"==typeof Dg?Dg(a):df.toggle(a)}).on("mouseover",function(a){df.focus(a)}).on("mouseout",function(){df.revert()}),o.append("text").text(function(a){return d(dg[a])?dg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",ki?h:-200).attr("y",ki?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",ki?i:-200).attr("y",ki?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return bi(a)}).attr("x",ki?h:-200).attr("y",ki?-200:j).attr("width",10).attr("height",10),Ai.selectAll("text").data(a).text(function(a){return d(dg[a])?dg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),Ai.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),Ai.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),N(u),O(v),M(D),n(),R(),Ne(),r&&m(q)}function $e(a){return xc(df.data.targets,a.id)}function _e(a){return"data"in a&&xc(df.data.targets,a.data.id)}function af(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 bf(a,b,c){var d=!Rd(df.data.targets);Ld(a,b),Oe(c?c:{withTransitionForAxis:d})}var cf=a.d3?a.d3:a.require?a.require("d3"):void 0,df={data:{},axis:{},legend:{}},ef={},ff=h(["bindto"],"#chart"),gf=h(["size","width"]),hf=h(["size","height"]),jf=h(["padding","left"]),kf=h(["padding","right"]),lf=h(["zoom","enabled"],!1),mf=h(["zoom","extent"]),nf=h(["zoom","privileged"],!1),of=h(["onenter"],function(){}),pf=h(["onleave"],function(){}),qf=h(["transition","duration"],350);g("data","data is required in config");var 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,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f=h(["data","x"]),ag=h(["data","xs"],{}),bg=h(["data","x_format"]),cg=h(["data","id_converter"],function(a){return a}),dg=h(["data","names"],{}),eg=h(["data","groups"],[]),fg=h(["data","axes"],{}),gg=h(["data","type"]),hg=h(["data","types"],{}),ig=h(["data","labels"],{}),jg=h(["data","order"]),kg=h(["data","regions"],{}),lg=h(["data","color"]),mg=h(["data","colors"],{}),ng=h(["data","selection","enabled"],!1),og=h(["data","selection","grouped"],!1),pg=h(["data","selection","isselectable"],function(){return!0}),qg=h(["data","selection","multiple"],!0),rg=h(["data","onclick"],function(){}),sg=h(["data","onenter"],function(){}),tg=h(["data","onleave"],function(){}),ug=h(["data","onselected"],function(){}),vg=h(["data","onunselected"],function(){}),wg=h(["data","ondragstart"],function(){}),xg=h(["data","ondragend"],function(){}),yg=h(["subchart","show"],!1),zg=yg?h(["subchart","size","height"],60):0,Ag=h(["color","pattern"],[]),Bg=h(["legend","show"],!0),Cg=h(["legend","position"],"bottom"),Dg=h(["legend","item","onclick"]),Eg=h(["legend","equally"],!1),Fg=h(["axis","rotated"],!1),Gg=h(["axis","x","type"],"indexed"),Hg=h(["axis","x","categories"],[]),Ig=h(["axis","x","tick","centered"],!1),Jg=h(["axis","x","tick","format"]),Kg=h(["axis","x","tick","culling"],{}),Lg=h(["axis","x","tick","culling","max"],"categorized"===Gg?1/0:10),Mg=h(["axis","x","tick","count"]),Ng=h(["axis","x","tick","fit"],!1),Og=h(["axis","x","max"]),Pg=h(["axis","x","min"]),Qg=h(["axis","x","default"]),Rg=h(["axis","x","label"],{}),Sg=h(["axis","y","show"],!0),Tg=h(["axis","y","max"]),Ug=h(["axis","y","min"]),Vg=h(["axis","y","center"]),Wg=h(["axis","y","label"],{}),Xg=h(["axis","y","inner"],!1),Yg=h(["axis","y","tick","format"]),Zg=h(["axis","y","padding"],{}),$g=h(["axis","y","ticks"],10),_g=h(["axis","y2","show"],!1),ah=h(["axis","y2","max"]),bh=h(["axis","y2","min"]),ch=h(["axis","y2","center"]),dh=h(["axis","y2","label"],{}),eh=h(["axis","y2","inner"],!1),fh=h(["axis","y2","tick","format"]),gh=h(["axis","y2","padding"],{}),hh=h(["axis","y2","ticks"],10),ih=h(["grid","x","show"],!1),jh=h(["grid","x","type"],"tick"),kh=h(["grid","x","lines"],[]),lh=h(["grid","y","show"],!1),mh=h(["grid","y","lines"],[]),nh=h(["grid","y","ticks"],10),oh=h(["point","show"],!0),ph=oh?h(["point","r"],2.5):0,qh=h(["point","focus","line","enabled"],!0),rh=h(["point","focus","expand","enabled"],!0),sh=h(["point","focus","expand","r"],rh?4:ph),th=h(["point","focus","select","r"],8),uh=h(["bar","width"]),vh=h(["bar","width","ratio"],.6),wh=h(["pie","label","show"],!0),xh=h(["pie","label","format"]),yh=h(["pie","onclick"],function(){}),zh=h(["pie","onmouseover"],function(){}),Ah=h(["pie","onmouseout"],function(){}),Bh=h(["donut","label","show"],!0),Ch=h(["donut","label","format"]),Dh=h(["donut","title"],""),Eh=h(["donut","onclick"],function(){}),Fh=h(["donut","onmouseover"],function(){}),Gh=h(["donut","onmouseout"],function(){}),Hh=h(["regions"],[]),Ih=h(["tooltip","show"],!0),Jh=h(["tooltip","format","title"]),Kh=h(["tooltip","format","value"]),Lh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Jh?Jh:b,l=Kh?Kh: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+""}),Mh=h(["tooltip","init","show"],!1),Nh=h(["tooltip","init","x"],0),Oh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Ph=("string"==typeof ff?ff.replace("#",""):ff.id)+"-clip",Qh=Ph+"-xaxis",Rh=Ph+"-yaxis",Sh=i(Ph),Th=i(Th),Uh=i(Uh),Vh="timeseries"===Gg,Wh="categorized"===Gg,Xh=!Vh&&(_f||fe(ag)),Yh=null,Zh=!1,$h=!1,_h=!1,ai=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],bi=ae(mg,fe(Ag)?Ag:ai,lg),ci=function(){var a=[[cf.time.format("%Y/%-m/%-d"),function(){return!0}],[cf.time.format("%-m/%-d"),function(a){return a.getMonth()}],[cf.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[cf.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[cf.time.format("%I %p"),function(a){return a.getHours()}],[cf.time.format("%I:%M"),function(a){return a.getMinutes()}],[cf.time.format(":%S"),function(a){return a.getSeconds()}],[cf.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)}}(),di=[],ei=[],fi=Fg?"left":"bottom",gi=Fg?Xg?"top":"bottom":Xg?"right":"left",hi=Fg?eh?"bottom":"top":eh?"left":"right",ii=Fg?"left":"bottom",ji={main:function(){return"translate("+rf.left+","+rf.top+")"},context:function(){return"translate("+sf.left+","+sf.top+")"},legend:function(){return"translate("+tf.left+","+tf.top+")"},x:function(){return"translate(0,"+(Fg?0:wf)+")"},y:function(){return"translate(0,"+(Fg?wf:0)+")"},y2:function(){return"translate("+(Fg?0:uf)+","+(Fg?1:0)+")"},subx:function(){return"translate(0,"+(Fg?0:xf)+")"},arc:function(){return"translate("+uf/2+","+wf/2+")"}},ki="right"===Cg,li=0,mi=0,ni=0,oi=30,pi=30,qi=5;If=cf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var ri,si=function(){var a=cf.svg.line().x(Fg?function(a){return V(a.id)(a.value)}:nd).y(Fg?nd:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=pe(b.values);return Sd(b)?(a.interpolate(Td(b)?"cardinal":"linear"),kg[b.id]?Be(e,Rf,V(b.id),kg[b.id]):a(e)):(c=Rf(e[0].x),d=V(b.id)(e[0].value),Fg?"M "+d+" "+c:"M "+c+" "+d)}}(),ti=function(){var a;return a=Fg?cf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(nd):cf.svg.area().x(nd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=pe(b.values);return Md([b],"area")||Md([b],"area-spline")?(a.interpolate(Td(b)?"cardinal":"linear"),a(e)):(c=Rf(e[0].x),d=V(b.id)(e[0].value),Fg?"M "+d+" "+c:"M "+c+" "+d)}}(),ui=function(){var a=cf.svg.line().x(Fg?function(a){return W(a.id)(a.value)}:qd).y(Fg?qd:function(a){return W(a.id)(a.value)});return function(b){var c=pe(b.values);return Sd(b)?a(c):"M "+Uf(c[0].x)+" "+W(b.id)(c[0].value)}}(),vi=function(){};ri=cf.svg.brush().on("brush",Ke),ri.update=function(){return zi&&zi.select("."+f.brush).call(this),this},ri.scale=function(a){return Fg?this.y(a):this.x(a)},lf&&(vi=cf.behavior.zoom().on("zoomstart",function(){vi.altDomain=cf.event.sourceEvent.altKey?Rf.orgDomain():null}).on("zoom",lf?Le:null),vi.scale=function(a){return Fg?this.y(a):this.x(a)},vi.orgScaleExtent=function(){var a=mf?mf:[1,10];return[a[0],Math.max(tc()/a[1],a[1])]},vi.updateScaleExtent=function(){var a=$b(Rf.orgDomain())/$b(Di),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var wi,xi,yi,zi,Ai,Bi,Ci,Di,Ei,Fi={};if(df.focus=function(a){function b(a){Bc(a).transition().duration(100).style("opacity",1)}var c=wi.selectAll(ad(a)),d=c.filter($e),e=c.filter(_e);df.revert(),df.defocus(),b(d.classed(f.focused,!0)),b(e),Rd(df.data.targets)&&Kb(a,!0),Ue(a)},df.defocus=function(a){function b(a){Bc(a).transition().duration(100).style("opacity",.3)}var c=wi.selectAll(ad(a)),d=c.filter($e),e=c.filter(_e);df.revert(),b(d.classed(f.focused,!1)),b(e),Rd(df.data.targets)&&Lb(a),Ve(a)},df.revert=function(a){function b(a){Bc(a).transition().duration(100).style("opacity",1)}var c=wi.selectAll(ad(a)),d=c.filter($e),e=c.filter(_e);b(d.classed(f.focused,!1)),b(e),Rd(df.data.targets)&&Lb(a),We()},df.show=function(a,b){a=wc(a),b=b||{},Fc(a),wi.selectAll(bd(a)).transition().style("opacity",1),b.withLegend&&Ye(a),Je({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},df.hide=function(a,b){a=wc(a),b=b||{},Ec(a),wi.selectAll(bd(a)).transition().style("opacity",0),b.withLegend&&Ye(a),Je({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},df.toggle=function(a){zc(a)?df.hide(a):df.show(a)},df.unzoom=function(){ri.clear().update(),Je({withUpdateXDomain:!0})},df.load=function(a){return a.xs&&ic(a.xs),"categories"in a&&Wh&&(Hg=a.categories,Xf.categories(Hg)),"cacheIds"in a&&_b(a.cacheIds)?void Qe(bc(a.cacheIds),a.done):void("unload"in a?Se(wc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Re(a)}):Re(a))},df.unload=function(a){Se(wc(a),function(){Je({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},df.selected=function(a){return cf.merge(yi.selectAll("."+f.shapes+_c(a)).selectAll("."+f.shape).filter(function(){return cf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},df.select=function(a,b,c){ng&&yi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=cf.select(this),i="circle"===this.nodeName?je:me,j="circle"===this.nodeName?ke:ne,k=og||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?pg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},df.unselect=function(a,b){ng&&yi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=cf.select(this),g="circle"===this.nodeName?ke:ne,h=og||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&pg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},df.toLine=function(a){bf(a,"line")},df.toSpline=function(a){bf(a,"spline")},df.toBar=function(a){bf(a,"bar")},df.toScatter=function(a){bf(a,"scatter")},df.toArea=function(a){bf(a,"area")},df.toAreaSpline=function(a){bf(a,"area-spline")},df.toPie=function(a){bf(a,"pie",{withTransform:!0})},df.toDonut=function(a){bf(a,"donut",{withTransform:!0})},df.groups=function(a){return c(a)?eg:(eg=a,Je(),eg)},df.xgrids=function(a){return a?(kh=a,Je(),kh):kh},df.xgrids.add=function(a){return a?df.xgrids(kh.concat(a)):void 0},df.xgrids.remove=function(a){var b=af(a);return df.xgrids(kh.filter(b))},df.ygrids=function(a){return a?(mh=a,Je(),mh):mh},df.ygrids.add=function(a){return a?df.ygrids(mh.concat(a)):void 0},df.ygrids.remove=function(a){var b=af(a);return df.ygrids(mh.filter(b))},df.regions=function(a){return c(a)?Hh:(Hh=a,Je(),Hh)},df.regions.add=function(a){return c(a)?Hh:(Hh=Hh.concat(a),Je(),Hh)},df.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;wi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Hh=Hh.filter(function(b){return b.classes.indexOf(a)<0})}),Hh},df.data.get=function(a){var b=df.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},df.data.getAsTarget=function(a){var b=yc(function(b){return b.id===a});return b.length>0?b[0]:void 0},df.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){dg[b]=a[b]}),Ze(vc(df.data.targets),{withTransition:!0}),dg):dg},df.x=function(a){return arguments.length&&(kc(df.data.targets,a),Je({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),df.data.x},df.xs=function(a){return arguments.length&&(lc(df.data.targets,a),Je({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),df.data.x},df.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},df.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Tg=+a.y),b(a.y2)&&(ah=+a.y2)):Tg=ah=+a,Je())},df.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Ug=+a.y),b(a.y2)&&(bh=+a.y2)):Ug=bh=+a,Je())},df.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&df.axis.max(a.max),"undefined"!=typeof a.min&&df.axis.min(a.min)) +},df.legend.show=function(a){Bg&&(Xe(wc(a)),Je({withTransitionForHorizontalAxis:!1}))},df.legend.hide=function(a){Bg&&(Ye(wc(a)),Je({withTransitionForHorizontalAxis:!1}))},df.resize=function(a){gf=a?a.width:null,hf=a?a.height:null,Oe({withLegend:!0,withTransition:!1})},df.destroy=function(){df.data.targets=void 0,df.data.x={},Ci.html(""),a.onresize=null},"url"in e.data)cf.csv(e.data.url,function(a,b){Ce(b)});else if("rows"in e.data)Ce(nc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ce(oc(e.data.columns))}return df},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 3c8a8c4b9b029c01a589e6288c95172bedf25e6f Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Mon, 7 Apr 2014 15:12:04 +0900 Subject: [PATCH 014/178] Refactor legend show/hide --- c3.js | 56 +++++++++++++++++++++++++++++++------------------------ c3.min.js | 6 +++--- 2 files changed, 35 insertions(+), 27 deletions(-) diff --git a/c3.js b/c3.js index 38a4353..cd4a6b0 100644 --- a/c3.js +++ b/c3.js @@ -299,7 +299,7 @@ /*-- Set Chart Params --*/ - var margin, margin2, margin3, width, width2, height, height2, currentWidth, currentHeight, legendHeight, legendWidth; + var margin, margin2, margin3, width, width2, height, height2, currentWidth, currentHeight; var radius, radiusExpanded, innerRadius, svgArc, svgArcExpanded, svgArcExpandedSub, pie; var xMin, xMax, yMin, yMax, subXMin, subXMax, subYMin, subYMax; var x, y, y2, subX, subY, subY2, xAxis, yAxis, yAxis2, subXAxis; @@ -345,9 +345,7 @@ } function transformLegend(withTransition) { var duration = withTransition !== false ? 250 : 0; - if (__legend_show) { - legend.transition().duration(duration).attr("transform", translate.legend); - } + legend.transition().duration(duration).attr("transform", translate.legend); } function transformAll(withTransition) { transformMain(withTransition); @@ -361,10 +359,10 @@ var rotated_padding_left = 30, rotated_padding_right = 30, rotated_padding_top = 5; function updateSizes() { + var legendHeight = getLegendHeight(), legendWidth = getLegendWidth(); + currentWidth = getCurrentWidth(); currentHeight = getCurrentHeight(); - legendHeight = getLegendHeight(); - legendWidth = getLegendWidth(); // for main margin = { @@ -448,7 +446,7 @@ } else if (__padding_right) { return __padding_right; } else if (isLegendRight) { - return legendWidth + (__axis_y2_show && !__axis_rotated ? getAxisWidthByAxisId('y2') : defaultPadding); + return getLegendWidth() + (__axis_y2_show && !__axis_rotated ? getAxisWidthByAxisId('y2') : defaultPadding); } else if (__axis_y2_show) { return __axis_y2_inner || __axis_rotated ? defaultPadding : getAxisWidthByAxisId('y2'); } else { @@ -1994,6 +1992,9 @@ return false; } + function isEmpty(o) { + return !o || (typeof o === 'string' && o.length === 0) || (typeof o === 'object' && Object.keys(o).length === 0); + } function notEmpty(o) { return Object.keys(o).length > 0; } @@ -2401,7 +2402,12 @@ // Define regions main = svg.append("g").attr("transform", translate.main); context = __subchart_show ? svg.append("g").attr("transform", translate.context) : null; - legend = __legend_show ? svg.append("g").attr("transform", translate.legend) : null; + legend = svg.append("g").attr("transform", translate.legend); + + if (!__legend_show) { + legend.style('visibility', 'hidden'); + hiddenLegendIds = mapToIds(c3.data.targets); + } // Define tooltip tooltip = d3.select(__bindto) @@ -2603,7 +2609,7 @@ } if (window.onresize.add) { window.onresize.add(function () { - updateAndRedraw({withTransition: false, withLegend: true}); + updateAndRedraw({withLegend: true, withTransition: false, withTransitionForTransform: false}); }); } } @@ -3593,9 +3599,7 @@ // Reset fadein for future load withoutFadeIn[id] = false; // Remove target's elements - if (__legend_show) { - legend.selectAll('.' + CLASS.legendItem + getTargetSelectorSuffix(id)).remove(); - } + legend.selectAll('.' + CLASS.legendItem + getTargetSelectorSuffix(id)).remove(); // Remove target c3.data.targets = c3.data.targets.filter(function (t) { return t.id !== id; @@ -3606,11 +3610,9 @@ /*-- Draw Legend --*/ function toggleFocusLegend(id, focus) { - var legendItem, isTarget, notTarget; - if (!__legend_show) { return; } - legendItem = legend.selectAll('.' + CLASS.legendItem); - isTarget = function (d) { return (!id || d === id); }; - notTarget = function (d) { return !isTarget(d); }; + var legendItem = legend.selectAll('.' + CLASS.legendItem), + isTarget = function (d) { return (!id || d === id); }, + notTarget = function (d) { return !isTarget(d); }; legendItem.filter(notTarget).transition().duration(100).style('opacity', focus ? 0.3 : 1); legendItem.filter(isTarget).transition().duration(100).style('opacity', focus ? 1 : 0.3); } @@ -3621,7 +3623,6 @@ toggleFocusLegend(id, false); } function revertLegend() { - if (!__legend_show) { return; } legend.selectAll('.' + CLASS.legendItem) .transition().duration(100) .style('opacity', 1); @@ -3648,7 +3649,7 @@ var l, totalLength = 0, offsets = {}, widths = {}, heights = {}, margins = [0], steps = {}, step = 0; var withTransition, withTransitionForTransform, withTransformAll; - options = isUndefined(options) ? {} : options; + options = options || {}; withTransition = isDefined(options.withTransition) ? options.withTransition : true; withTransitionForTransform = isDefined(options.withTransitionForTransform) ? options.withTransitionForTransform : true; withTransformAll = isDefined(options.withTransformAll) ? options.withTransformAll : true; @@ -3658,7 +3659,7 @@ itemWidth = Math.ceil((box.width + paddingRight) / 10) * 10, itemHeight = Math.ceil((box.height + paddingTop) / 10) * 10, itemLength = isLegendRight ? itemHeight : itemWidth, - areaLength = isLegendRight ? legendHeight : legendWidth, + areaLength = isLegendRight ? getLegendHeight() : getLegendWidth(), margin, maxLength; // MEMO: care about condifion of step, totalLength @@ -3684,7 +3685,7 @@ maxHeight = 0; } - if (!isLegendToShow(id)) { + if (__legend_show && !isLegendToShow(id)) { widths[id] = heights[id] = steps[id] = offsets[id] = 0; return; } @@ -3730,6 +3731,7 @@ .data(targetIds) .enter().append('g') .attr('class', function (id) { return generateClass(CLASS.legendItem, id); }) + .style('visibility', function (id) { return isLegendToShow(id) ? 'visible' : 'hidden'; }) .style('cursor', 'pointer') .on('click', function (id) { typeof __legend_item_onclick === 'function' ? __legend_item_onclick(id) : c3.toggle(id); @@ -4151,12 +4153,18 @@ }; c3.legend.show = function (targetIds) { - if (!__legend_show) { return; } + if (!__legend_show) { + __legend_show = true; + legend.style('visibility', 'visible'); + } showLegend(mapToTargetIds(targetIds)); redraw({withTransitionForHorizontalAxis: false}); }; c3.legend.hide = function (targetIds) { - if (!__legend_show) { return; } + if (__legend_show && isEmpty(targetIds)) { + __legend_show = false; + legend.style('visibility', 'hidden'); + } hideLegend(mapToTargetIds(targetIds)); redraw({withTransitionForHorizontalAxis: false}); }; @@ -4164,7 +4172,7 @@ c3.resize = function (size) { __size_width = size ? size.width : null; __size_height = size ? size.height : null; - updateAndRedraw({withLegend: true, withTransition: false}); + updateAndRedraw({withLegend: true, withTransition: false, withTransitionForTransform: false}); }; c3.destroy = function () { diff --git a/c3.min.js b/c3.min.js index d34dd25..9fd02a3 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.28"},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;cuf&&(uf=0),0>wf&&(wf=0),sf={top:Fg?rf.top:zf-zg-(ki?0:Af),right:0/0,bottom:20+(ki?0:Af),left:Fg?oi:rf.left},vf=Fg?rf.left-oi-pi:uf,xf=Fg?wf:zf-sf.top-sf.bottom,0>vf&&(vf=0),0>xf&&(xf=0),tf={top:ki?0:zf-Af,right:0/0,bottom:0,left:ki?yf-Bf:0},p(),ki&&Rd(df.data.targets)&&(tf.left=uf/2+Df)}function o(){yi.select("line."+f.xgridFocus).attr("x1",Fg?0:-10).attr("x2",Fg?uf:-10).attr("y1",Fg?-10:rf.top).attr("y2",Fg?-10:wf)}function p(){Df=wf/2,Cf=.95*Df,Ef=Qd(df.data.targets)?.6*Cf:0}function q(){var a=Fg?f.axisX:f.axisY,b=cf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=cf.select(ff).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return gf?gf:x()}function s(){var a=hf?hf:y();return a>0?a:320}function t(){return Rd(df.data.targets)?0:jf?jf:Fg||!Sg||Xg?1:v("y")}function u(){var a=1;return Rd(df.data.targets)?0:kf?kf:ki?Bf+(_g&&!Fg?v("y2"):a):_g?eh||Fg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||Sg?"y2"!==a||_g?(gb(a).isInner?30:40)+("y2"===a?-10:0):qi:Bg&&!ki?10:1}function x(){return+cf.select(ff).style("width").replace("px","")}function y(){return+cf.select(ff).style("height").replace("px","")}function z(a){return a?-5:-(rf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Fg)}function C(){return A(!Fg)}function D(){return z(Fg)}function E(){return A(Fg)}function F(a){return a?uf+2+4:rf.left+20}function G(a){return a?80:wf+2}function H(){return F(!Fg)}function I(){return G(!Fg)}function J(){return F(Fg)}function K(){return G(Fg)}function L(){var a=Fg?wf:uf,b=tc(),c=Vb()*(Nd(df.data.targets)?(b-(Wh?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){li=a}function N(a){mi=a}function O(a){ni=a}function P(){return Bg?ki?mi*(li+1):yf:0}function Q(){return Bg?ki?zf:ni*(li+1):0}function R(){var a,b=!Rf;Jf=Fg?1:0,Kf=Fg?wf:uf,Lf=Fg?0:wf,Mf=Fg?uf:1,Nf=Jf,Of=Kf,Pf=Fg?0:xf,Qf=Fg?vf:1,Rf=T(Jf,Kf,b?void 0:Rf.domain(),function(){return Xf.tickOffset()}),Sf=U(Lf,Mf),Tf=U(Lf,Mf),Uf=T(Jf,Kf,Di,function(a){return a%1?0:$f.tickOffset()}),Vf=U(Pf,Qf),Wf=U(Pf,Qf),a=$(),Xf=X(Rf,fi,a),$f=X(Uf,ii,a),Yf=Y(Sf,gi,Yg,$g),Zf=Y(Tf,hi,fh,hh),b||(ri.scale(Uf),lf&&vi.scale(Rf)),S()}function S(){Ff=Db(),Gf=Eb(),Hf=Eb(.98)}function T(a,b,e,f){var g=(Vh?cf.time.scale():cf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),Wh){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return cf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?Tf:Sf}function W(a){return"y2"===Z(a)?Wf:Vf}function X(a,b,c){var d=(Wh?Bb():cf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),Wh?d.tickCentered(Ig):d.tickOffset=function(){var a=Fg?wf:uf;return a*Vb()/tc()/2},Wh&&d.categories(Hg),d}function Y(a,b,c,d){return cf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in fg?fg[a]:"y"}function $(){var a=Vh?ci:Wh?Mc:function(a){return 0>a?a.toFixed(0):a};return Jg&&("function"==typeof Jg?a=Jg:Vh&&(a=function(a){return cf.time.format(Jg)(a)})),a}function _(a){var b;return"y"===a?b=Wg:"y2"===a?b=dh:"x"===a&&(b=Rg),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Wg=b:"y2"===a?dh=b:"x"===a&&(Rg=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Fg?"inner-top":"inner-right")}function eb(){return cb("y",Fg?"inner-right":"inner-top")}function fb(){return cb("y2",Fg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?uf/2:uf:b.isBottom?-wf:b.isMiddle?-wf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Fg,db())}function ob(){return kb(Fg,eb())}function pb(){return kb(Fg,fb())}function qb(){return lb(!Fg,db())}function rb(){return lb(Fg,eb())}function sb(){return lb(Fg,fb())}function tb(){var a=db();return Fg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Fg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Fg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Fg,db())}function xb(){return mb(Fg,eb())}function yb(){return mb(Fg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return cf.selectAll("."+c+" .tick text").each(function(){var a=this.getBBox();bb?20:b}function Ab(){yi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),yi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),yi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Kc(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 cf.min(Object.keys(i).map(function(a){return cf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=vc(a),i=Ic(a);if(eg.length>0)for(g=Lc(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 cf.max(Object.keys(i).map(function(a){return cf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?bh:Ug,n="y2"===c?ah:Tg,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?ch:Vg,r=id()&&Fg;return 0===l.length?"y2"===c?Tf.domain():Sf.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=jd(o,p),j=$b(Sf.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Zg&&(f=b(Zg.top)?Zg.top:e,g=b(Zg.bottom)?Zg.bottom:e),"y2"===c&&gh&&(f=b(gh.top)?gh.top:e,g=b(gh.bottom)?gh.bottom:e),Nd(l)&&!Kc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Di),c=$b(Rf.domain());return a||0===c?1:b/c}function Wb(a){return Pg?Pg:cf.min(a,function(a){return cf.min(a.values,function(a){return a.x})})}function Xb(a){return Og?Og:cf.max(a,function(a){return cf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return Wh?d=0:Nd(a)?(c=tc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=Vh?new Date(c.getTime()-e):c-e,g=Vh?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return _f&&a===_f||fe(ag)&&ge(ag,a)}function fc(a){return!ec(a)}function gc(a){return _f?_f:fe(ag)?ag[a]:null}function hc(a,b){return a in df.data.x&&df.data.x[a]&&df.data.x[a][b]?df.data.x[a][b]:b}function ic(a){Object.keys(a).forEach(function(b){ag[b]=a[b]})}function jc(a){var b;return a&&(b=dg[a.id],a.name=b?b:a.id),a}function kc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=mc(b[d],a.id,d)}),df.data.x[a.id]=b})}function lc(a,b){a.forEach(function(a){b[a.id]&&kc([a],b[a.id])})}function mc(a,b,c){var d;return d=Vh?a?a instanceof Date?a:be(a):be(hc(b,c)):Xh&&!Wh?a?+a:hc(b,c):c}function nc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0&&(df.data.x[b]=a.map(function(a){return a[c]})):df.data.x[b]=a.map(function(a,b){return b})}),c.forEach(function(a){if(!df.data.x[a])throw new Error('x is not defined for id = "'+a+'".')}),b=c.map(function(b,c){var d=cg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=mc(g,b,e);return Xh&&Wh&&0===c&&g&&(0===e&&(Hg=[]),Hg.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++})}),gg&&Ld(vc(b).filter(function(a){return!(a in hg)}),gg),b.forEach(function(a){ac(a.id_org,a)}),b}function qc(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 rc(a){return a>0&&df.data.targets[0].values[a-1]?df.data.targets[0].values[a-1].x:void 0}function sc(a){return a1?df.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?df.data.targets[0]:null,a}function vc(a){return a.map(function(a){return a.id})}function wc(a){return a?"string"==typeof a?[a]:a:vc(df.data.targets)}function xc(a,b){var c,d=vc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(Vh?new Date(h):h);i.push(d)}return i}function Ec(a){di=di.concat(a)}function Fc(a){di=di.filter(function(b){return a.indexOf(b)<0})}function Gc(a){ei=ei.concat(a)}function Hc(a){ei=ei.filter(function(b){return a.indexOf(b)<0})}function Ic(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Jc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Lc(a){return Jc(a,function(a){return a>0})}function Mc(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(rd(a,f))),a[g].x&&(e=e.concat(rd(a,g))),ud(e,b)):sd(a,b,f,g)}function td(a,b){var c;return c=a.map(function(a){return sd(a.values,b)}),ud(c,b)}function ud(a,b){var c,d;return a.forEach(function(a){var e=he(a,b);(c>e||!c)&&(c=e,d=a)}),d}function vd(a,b){return cf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function wd(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 xd(){return jg&&"desc"===jg.toLowerCase()}function yd(){return jg&&"asc"===jg.toLowerCase()}function zd(a){var b=yd(),c=xd();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 jg&&a.sort(jg),a}function Ad(a,c){var d,e,f,g,h,i,j,k=Rd(df.data.targets),l=k?ld:kd,m=a.filter(function(a){return a&&b(a.value)});Ih&&0!==m.length&&(Bi.html(Lh(a,$(),l,bi)).style("display","block"),d=Bi.property("offsetWidth"),e=Bi.property("offsetHeight"),k?(g=uf/2+c[0],i=wf/2+c[1]+20):(Fg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Rf(m[0].x)+20):(f=q(),g=f+t()+Rf(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Bi.style("top",i+"px").style("left",g+"px"))}function Bd(){Bi.style("display","none")}function Cd(a){var c=a.filter(function(a){return a&&b(a.value)});Ih&&(Od(df.data.targets)||Rd(df.data.targets)||yi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Fg?"y1":"x1",nd).attr(Fg?"y2":"x2",nd))}function Dd(){yi.select("line."+f.xgridFocus).style("visibility","hidden")}function Ed(a){return a.x||0===a.x?Rf(a.x):null}function Fd(a){return V(a.id)(a.value)}function Gd(){var a,b,d={},e=0;return Bc(yc(Ud)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Kd(a,b){return uh?uh:b?2*a.tickOffset()*vh/b:0}function Ld(a,b){wc(a).forEach(function(a){Fi[a]=b===hg[a],hg[a]=b})}function Md(a,b){var c=!1;return a.forEach(function(a){hg[a.id]===b&&(c=!0),a.id in hg||"line"!==b||(c=!0)}),c}function Nd(a){return Md(a,"bar")}function Od(a){return Md(a,"scatter")}function Pd(a){return Md(a,"pie")}function Qd(a){return Md(a,"donut")}function Rd(a){return Pd(a)||Qd(a)}function Sd(a){var b="string"==typeof a?a:a.id;return!(b in hg)||"line"===hg[b]||"spline"===hg[b]||"area"===hg[b]||"area-spline"===hg[b]}function Td(a){var b="string"==typeof a?a:a.id;return"spline"===hg[b]||"area-spline"===hg[b]}function Ud(a){var b="string"==typeof a?a:a.id;return"bar"===hg[b]}function Vd(a){var b="string"==typeof a?a:a.id;return"scatter"===hg[b]}function Wd(a){var b="string"==typeof a?a:a.id;return"pie"===hg[b]}function Xd(a){var b="string"==typeof a?a:a.id;return"donut"===hg[b]}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){return Ud(a)?a.values:[]}function $d(a){return Sd(a)||Vd(a)?a.values:[]}function _d(a){return Ud(a)||Sd(a)?a.values:[]}function ae(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function be(b){var c;if(!b)throw Error(b+" can not be parsed as d3.time with format "+bg+". Maybe 'x' of this data is not defined. See data.x or data.xs option.");try{c=bg?cf.time.format(bg).parse(b):new Date(b)}catch(d){c=void 0}return c||a.console.error("Failed to parse x '"+b+"' to Date with format "+bg),c}function ce(a,b){var c=cf.mouse(a),d=cf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function ge(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function he(a,b){var c="y"===Z(a.id)?Sf:Tf,d=Fg?1:0,e=Fg?0:1;return Math.pow(Rf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ie(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function je(a,b,c){ug(b,a.node()),yi.select("."+f.selectedCircles+_c(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Nc(f.selectedCircle,c)}).attr("cx",Fg?Fd:Ed).attr("cy",Fg?Ed:Fd).attr("stroke",function(){return bi(b)}).attr("r",1.4*th).transition().duration(100).attr("r",th)}function ke(a,b,c){vg(b,a.node()),yi.select("."+f.selectedCircles+_c(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function le(a,b,c,d){a?je(b,c,d):ke(b,c,d)}function me(a,b){ug(b,a.node()),a.transition().duration(100).style("fill",function(){return cf.rgb(bi(b)).darker(1)})}function ne(a,b){vg(b,a.node()),a.transition().duration(100).style("fill",function(){return bi(b)})}function oe(a,b,c,d){a?me(b,c,d):ne(b,c,d)}function pe(a){return a.filter(function(a){return b(a.value)})}function qe(a,c){return(c?yi.selectAll("."+f.circles+_c(c)):yi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function re(a,b){qe(a,b).classed(f.EXPANDED,!0).attr("r",sh)}function se(a){qe(a).filter(function(){return cf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",ph)}function te(a){return yi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function ue(a){te(a).classed(f.EXPANDED,!0)}function ve(a){te(a).classed(f.EXPANDED,!1)}function we(a,b){var c=Ae(a,b);return function(a,b){var d=c(a,b),e=Fg?1:0,f=Fg?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 xe(a,b){var c=Ae(a,!1),d=b?ye:ze;return function(a,b){return d(c(a,b),a,this)}}function ye(a,b){var c;return Fg?(c=Ud(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function ze(a,b,c){var d=c.getBBox();return Fg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:Ud(b)?-3:-6)}function Ae(a,b){var c=a.__max__+1,d=Kd(Xf,c),e=Hd(d,c,a,!!b),f=Id(!!b),g=Jd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Fg&&(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 Be(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function Ce(b){var c,d,e;if(Ci=cf.select(ff),Ci.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Ci.html(""),Ci.classed("c3",!0),df.data.x={},df.data.targets=pc(b),n(),R(),Rf.domain(cf.extent(Zb(df.data.targets))),Sf.domain(Ub(df.data.targets,"y")),Tf.domain(Ub(df.data.targets,"y2")),Uf.domain(Rf.domain()),Vf.domain(Sf.domain()),Wf.domain(Tf.domain()),Di=Rf.domain(),ri.scale(Uf),lf&&vi.scale(Rf),wi=Ci.append("svg").attr("width",uf+rf.left+rf.right).attr("height",wf+rf.top+rf.bottom).on("mouseenter",of).on("mouseleave",pf),xi=wi.append("defs"),xi.append("clipPath").attr("id",Ph).append("rect").attr("width",uf).attr("height",wf),xi.append("clipPath").attr("id",Qh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),xi.append("clipPath").attr("id",Rh).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),yi=wi.append("g").attr("transform",ji.main),zi=yg?wi.append("g").attr("transform",ji.context):null,Ai=Bg?wi.append("g").attr("transform",ji.legend):null,Bi=cf.select(ff).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Ze(vc(df.data.targets),{withTransform:!1,withTransitionForTransform:!1}),yi.append("g").attr("class",f.axisX).attr("clip-path",Fg?"":Th).attr("transform",ji.x).append("text").attr("class",f.axisXLabel).attr("transform",Fg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),Sg&&yi.append("g").attr("class",f.axisY).attr("clip-path",Fg?Uh:"").attr("transform",ji.y).append("text").attr("class",f.axisYLabel).attr("transform",Fg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),_g&&yi.append("g").attr("class",f.axisY2).attr("transform",ji.y2).append("text").attr("class",f.axisY2Label).attr("transform",Fg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=yi.append("g").attr("clip-path",Sh).attr("class",f.grid),ih&&d.append("g").attr("class",f.xgrids),fe(kh)&&d.append("g").attr("class",f.xgridLines),qh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),lh&&d.append("g").attr("class",f.ygrids),fe(mh)&&d.append("g").attr("class",f.ygridLines),yi.append("g").attr("clip-path",Sh).attr("class",f.regions),yi.append("g").attr("clip-path",Sh).attr("class",f.chart),c=yi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",lf?Fg?"ns-resize":"ew-resize":null),yi.select("."+f.chart).append("g").attr("class",f.chartBars),yi.select("."+f.chart).append("g").attr("class",f.chartLines),yi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",ji.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),yi.select("."+f.chart).append("g").attr("class",f.chartTexts),lf&&yi.insert("rect",nf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",uf).attr("height",wf).style("opacity",0).style("cursor",Fg?"ns-resize":"ew-resize").call(vi).on("dblclick.zoom",null),Qg&&ri.extent("function"!=typeof Qg?Qg:Qg(Zb())),yg&&(zi.append("g").attr("clip-path",Sh).attr("class",f.chart),zi.select("."+f.chart).append("g").attr("class",f.chartBars),zi.select("."+f.chart).append("g").attr("class",f.chartLines),zi.append("g").attr("clip-path",Sh).attr("class",f.brush).call(ri).selectAll("rect").attr(Fg?"width":"height",Fg?vf:xf),zi.append("g").attr("class",f.axisX).attr("transform",ji.subx).attr("clip-path",Fg?"":Th)),Pe(df.data.targets),Fg?yi.select("."+f.axisX).style("opacity",0).call(Xf):(yi.select("."+f.axisY).style("opacity",0).call(Yf),yi.select("."+f.axisY2).style("opacity",0).call(Zf)),Je({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Mh){if(Vh&&"string"==typeof Nh){for(Nh=be(Nh),e=0;e0){d=[];for(var g in dg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=wd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=oe,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 He(a){Rd(df.data.targets)||ng&&(Yh=a,yi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Zh=!0,wg())}function Ie(){Rd(df.data.targets)||ng&&(yi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),yi.selectAll("."+f.shape).classed(f.INCLUDED,!1),Zh=!1,xg())}function Je(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S=Gd(),T=Rd(df.data.targets),U=Bc(df.data.targets);if(0!==U.length){if(a=d(a)?a:{},x=d(a.withY)?a.withY:!0,y=d(a.withSubchart)?a.withSubchart:!0,z=d(a.withTransition)?a.withTransition:!0,D=d(a.withTransform)?a.withTransform:!1,E=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,F=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,G=d(a.withLegend)?a.withLegend:!1,A=d(a.withTransitionForExit)?a.withTransitionForExit:z,B=d(a.withTransitionForAxis)?a.withTransitionForAxis:z,C=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:z,M=z?qf:0,N=A?M:0,O=B?M:0,G&&Bg&&Ze(vc(df.data.targets),a),F&&(Rf.domain(cf.extent(Zb(U))),Di=Rf.domain(),lf&&vi.scale(Rf).updateScaleExtent(),Uf.domain(Rf.domain()),ri.scale(Uf)),E&&(Rf.domain(ri.empty()?Di:ri.extent()),lf&&vi.scale(Rf).updateScaleExtent()),Sf.domain(Ub(U,"y")),Tf.domain(Ub(U,"y2")),Od(U)||(P=Dc(Cc(U)).sort(),Xf.tickValues(P),$f.tickValues(P)),c=yi.select("."+f.axisX).style("opacity",T?0:1),(Fg||C)&&(c=c.transition().duration(O)),c.call(Xf),e=yi.select("."+f.axisY).style("opacity",T?0:1),(!Fg||C)&&(e=e.transition().duration(O)),e.call(Yf),yi.select("."+f.axisY2).style("opacity",T?0:1).transition().duration(O).call(Zf),E&&Kg&&P){for(Q=1;Q=Y;Y++)h.push(new Date(Y+"-01-01 00:00:00"))}else h=Rf.ticks(10);g=yi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Fg?0:function(a){return Rf(a)-Xf.tickOffset()}).attr("x2",Fg?uf:function(a){return Rf(a)-Xf.tickOffset()}).attr("y1",Fg?function(a){return Rf(a)-Xf.tickOffset()}:rf.top).attr("y2",Fg?function(a){return Rf(a)-Xf.tickOffset()}:wf).style("opacity",function(){return+cf.select(this).attr(Fg?"y1":"x1")===(Fg?wf:0)?0:1}),g.exit().remove()}fe(kh)&&(i=yi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(kh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Fg?"":"rotate(-90)").attr("dx",Fg?0:-rf.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(M).attr("x1",Fg?0:od).attr("x2",Fg?uf:od).attr("y1",Fg?od:rf.top).attr("y2",Fg?od:wf).style("opacity",1),i.select("text").transition().duration(M).attr("x",Fg?uf:0).attr("y",od).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(M).style("opacity",0).remove()),x&&lh&&(k=yi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Sf.ticks(nh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Fg?Sf:0).attr("x2",Fg?Sf:uf).attr("y1",Fg?0:Sf).attr("y2",Fg?wf:Sf),k.exit().remove()),x&&fe(mh)&&(l=yi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(mh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Fg?"rotate(-90)":"").attr("dx",Fg?0:-rf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(M).attr("x1",Fg?pd:0).attr("x2",Fg?pd:uf).attr("y1",Fg?0:pd).attr("y2",Fg?wf:pd).style("opacity",1),l.select("text").transition().duration(M).attr("x",Fg?0:uf).attr("y",pd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(M).style("opacity",0).remove()),p=yi.selectAll("."+f.bars).selectAll("."+f.bar).data(Zd),p.enter().append("path").attr("d",H).style("stroke","none").style("opacity",0).style("fill",function(a){return bi(a)}).attr("class",Vc),p.style("opacity",ed).transition().duration(M).attr("d",H).style("opacity",1),p.exit().transition().duration(N).style("opacity",0).remove(),r=yi.selectAll("."+f.texts).selectAll("."+f.text).data(_d),r.enter().append("text").attr("class",Oc).attr("text-anchor",function(a){return Fg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return md(a.id)(a.value)}).style("fill-opacity",fd).transition().duration(M).attr("x",J).attr("y",K).style("fill-opacity",hd),r.exit().transition().duration(N).style("fill-opacity",0).remove(),yi.selectAll("."+f.line).style("opacity",ed).transition().duration(M).attr("d",si).style("opacity",1),yi.selectAll("."+f.area).style("opacity",0).transition().duration(M).attr("d",ti).style("opacity",Ei),n=yi.selectAll("."+f.circles).selectAll("."+f.circle).data($d),n.enter().append("circle").attr("class",Tc).style("opacity",0).attr("r",ph),n.style("opacity",ed).transition().duration(M).style("opacity",gd).attr("cx",Fg?Fd:Ed).attr("cy",Fg?Ed:Fd),n.exit().remove(),yi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",D?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(M).attrTween("d",function(a){var b,c=Cb(a);return c?(b=cf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",D?"scale(1)":"").style("opacity",1),yi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(M).text(Jb).style("opacity",function(a){return zc(a.data.id)&&Yd(a.data)?1:0}),yi.select("."+f.chartArcsTitle).style("opacity",Qd(df.data.targets)?1:0),yg&&(null!==cf.event&&"zoom"===cf.event.type&&ri.extent(Rf.orgDomain()).update(),y&&(zi.select("."+f.axisX).style("opacity",T?0:1).transition().duration(M).call($f),ri.empty()||ri.extent(Rf.orgDomain()).update(),I=we(S,!0),s=zi.selectAll("."+f.bars).selectAll("."+f.bar).data(Zd),s.enter().append("path").attr("d",I).style("stroke","none").style("fill",function(a){return bi(a)}).attr("class",Vc),s.style("opacity",ed).transition().duration(M).attr("d",I).style("opacity",1),s.exit().transition().duration(M).style("opacity",0).remove(),zi.selectAll("."+f.line).style("opacity",ed).transition().duration(M).attr("d",ui).style("opacity",1))),yi.selectAll("."+f.selectedCircles).filter(function(a){return Ud(a)}).selectAll("circle").remove(),yi.selectAll("."+f.selectedCircle).transition().duration(M).attr("cx",Fg?Fd:Ed).attr("cy",Fg?Ed:Fd),fe(ag)?(t=yi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ee(t.enter()),t.attr("x",0).attr("y",0).attr("width",uf).attr("height",wf)):(Xh&&!Wh?(w=function(a,b){var c=rc(b),d=sc(b),e=df.data.x[a.id][b];return(Rf(d?d:e+50)-Rf(c?c:e-50))/2},v=function(a,b){var c=rc(b),d=df.data.x[a.id][b];return(Rf(d)+Rf(c?c:d-50))/2}):(w=L(),v=function(a){return Rf(a.x)-w/2}),u=uc(),yi.select("."+f.eventRects).datum(u?u.values:[]),t=yi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),De(t.enter()),t.attr("class",$c).attr("x",Fg?0:v).attr("y",Fg?v:0).attr("width",Fg?uf:w).attr("height",Fg?w:wf),t.exit().remove()),q=yi.select("."+f.regions).selectAll("rect."+f.region).data(Hh),q.enter().append("rect").style("fill-opacity",0),q.attr("class",Zc).attr("x",Fg?0:cc).attr("y",Fg?cc:rf.top).attr("width",Fg?uf:dc).attr("height",Fg?dc:wf).transition().duration(M).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(M).style("fill-opacity",0).remove(),vc(df.data.targets).forEach(function(a){Fi[a]=!0})}}function Ke(){Je({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Le(){return"mousemove"===cf.event.sourceEvent.type&&vi.altDomain?(Rf.domain(vi.altDomain),void vi.scale(Rf).updateScaleExtent()):(Wh&&Rf.orgDomain()[0]===Di[0]&&Rf.domain([Di[0]-1e-10,Rf.orgDomain()[1]]),Je({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===cf.event.sourceEvent.type&&($h=!0)))}function Me(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ne(){wi.attr("width",yf).attr("height",zf),wi.select("#"+Ph).select("rect").attr("width",uf).attr("height",wf),wi.select("#"+Qh).select("rect").attr("width",H),wi.select("#"+Rh).select("rect").attr("width",J),wi.select("."+f.zoomRect).attr("width",uf).attr("height",wf)}function Oe(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Ne(),m(a.withTransition),Je(a)}function Pe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=yi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a),j=i.enter().append("g").attr("class",function(a){return f.chartText+Nc(f.target,a.id)}).style("pointer-events","none"),j.append("g").attr("class",Pc).style("fill",function(a){return bi(a)}),e=yi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),d=e.enter().append("g").attr("class",function(a){return f.chartBar+Nc(f.target,a.id)}).style("pointer-events","none"),d.append("g").attr("class",Wc).style("fill",function(a){return bi(a)}).style("stroke","none").style("cursor",function(a){return pg(a)?"pointer":null}),c=yi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),b=c.enter().append("g").attr("class",function(a){return f.chartLine+Nc(f.target,a.id)}).style("pointer-events","none"),b.append("path").attr("class",Sc).style("opacity",0).style("stroke",function(a){return bi(a)}),b.append("path").attr("class",Yc).style("opacity",function(){return Ei=+cf.select(this).style("opacity"),0}).style("fill",function(a){return bi(a)}),b.append("g").attr("class",function(a){return Nc(f.selectedCircles,a.id)}),b.append("g").attr("class",Uc).style("fill",function(a){return bi(a)}).style("cursor",function(a){return pg(a)?"pointer":null}),a.forEach(function(a){yi.selectAll("."+f.selectedCircles+_c(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=yi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(If(a)),g=h.enter().append("g").attr("class",function(a){return f.chartArc+Nc(f.target,a.data.id)}),g.append("path").attr("class",Xc).style("opacity",0).style("fill",function(a){return bi(a.data)}).style("cursor",function(a){return pg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),Ue(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Ad(c,cf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),We(),Bd(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),yg&&(n=zi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),m=n.enter().append("g").attr("class",function(a){return f.chartBar+Nc(f.target,a.id)}),m.append("g").attr("class",Wc).style("fill",function(a){return bi(a)}),l=zi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),k=l.enter().append("g").attr("class",function(a){return f.chartLine+Nc(f.target,a.id)}),k.append("path").attr("class",Sc).style("opacity",0).style("stroke",function(a){return bi(a)})),wi.selectAll("."+f.target).filter(function(a){return zc(a.id)}).transition().style("opacity",1)}function Qe(a,b){df.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBBox(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=ki?j:i,l=ki?Af:Bf;return d&&(x=0,D=0,u=0,v=0),Ac(c)?(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=ki?v:u,void(Eg?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c))):void(z[c]=A[c]=C[c]=y[c]=0)}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=c(b)?{}:b,p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,ki?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=Ai.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Nc(f.legendItem,a)}).style("cursor","pointer").on("click",function(a){"function"==typeof Dg?Dg(a):df.toggle(a)}).on("mouseover",function(a){df.focus(a)}).on("mouseout",function(){df.revert()}),o.append("text").text(function(a){return d(dg[a])?dg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",ki?h:-200).attr("y",ki?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",ki?i:-200).attr("y",ki?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return bi(a)}).attr("x",ki?h:-200).attr("y",ki?-200:j).attr("width",10).attr("height",10),Ai.selectAll("text").data(a).text(function(a){return d(dg[a])?dg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),Ai.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),Ai.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),N(u),O(v),M(D),n(),R(),Ne(),r&&m(q)}function $e(a){return xc(df.data.targets,a.id)}function _e(a){return"data"in a&&xc(df.data.targets,a.data.id)}function af(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 bf(a,b,c){var d=!Rd(df.data.targets);Ld(a,b),Oe(c?c:{withTransitionForAxis:d})}var cf=a.d3?a.d3:a.require?a.require("d3"):void 0,df={data:{},axis:{},legend:{}},ef={},ff=h(["bindto"],"#chart"),gf=h(["size","width"]),hf=h(["size","height"]),jf=h(["padding","left"]),kf=h(["padding","right"]),lf=h(["zoom","enabled"],!1),mf=h(["zoom","extent"]),nf=h(["zoom","privileged"],!1),of=h(["onenter"],function(){}),pf=h(["onleave"],function(){}),qf=h(["transition","duration"],350);g("data","data is required in config");var 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,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f=h(["data","x"]),ag=h(["data","xs"],{}),bg=h(["data","x_format"]),cg=h(["data","id_converter"],function(a){return a}),dg=h(["data","names"],{}),eg=h(["data","groups"],[]),fg=h(["data","axes"],{}),gg=h(["data","type"]),hg=h(["data","types"],{}),ig=h(["data","labels"],{}),jg=h(["data","order"]),kg=h(["data","regions"],{}),lg=h(["data","color"]),mg=h(["data","colors"],{}),ng=h(["data","selection","enabled"],!1),og=h(["data","selection","grouped"],!1),pg=h(["data","selection","isselectable"],function(){return!0}),qg=h(["data","selection","multiple"],!0),rg=h(["data","onclick"],function(){}),sg=h(["data","onenter"],function(){}),tg=h(["data","onleave"],function(){}),ug=h(["data","onselected"],function(){}),vg=h(["data","onunselected"],function(){}),wg=h(["data","ondragstart"],function(){}),xg=h(["data","ondragend"],function(){}),yg=h(["subchart","show"],!1),zg=yg?h(["subchart","size","height"],60):0,Ag=h(["color","pattern"],[]),Bg=h(["legend","show"],!0),Cg=h(["legend","position"],"bottom"),Dg=h(["legend","item","onclick"]),Eg=h(["legend","equally"],!1),Fg=h(["axis","rotated"],!1),Gg=h(["axis","x","type"],"indexed"),Hg=h(["axis","x","categories"],[]),Ig=h(["axis","x","tick","centered"],!1),Jg=h(["axis","x","tick","format"]),Kg=h(["axis","x","tick","culling"],{}),Lg=h(["axis","x","tick","culling","max"],"categorized"===Gg?1/0:10),Mg=h(["axis","x","tick","count"]),Ng=h(["axis","x","tick","fit"],!1),Og=h(["axis","x","max"]),Pg=h(["axis","x","min"]),Qg=h(["axis","x","default"]),Rg=h(["axis","x","label"],{}),Sg=h(["axis","y","show"],!0),Tg=h(["axis","y","max"]),Ug=h(["axis","y","min"]),Vg=h(["axis","y","center"]),Wg=h(["axis","y","label"],{}),Xg=h(["axis","y","inner"],!1),Yg=h(["axis","y","tick","format"]),Zg=h(["axis","y","padding"],{}),$g=h(["axis","y","ticks"],10),_g=h(["axis","y2","show"],!1),ah=h(["axis","y2","max"]),bh=h(["axis","y2","min"]),ch=h(["axis","y2","center"]),dh=h(["axis","y2","label"],{}),eh=h(["axis","y2","inner"],!1),fh=h(["axis","y2","tick","format"]),gh=h(["axis","y2","padding"],{}),hh=h(["axis","y2","ticks"],10),ih=h(["grid","x","show"],!1),jh=h(["grid","x","type"],"tick"),kh=h(["grid","x","lines"],[]),lh=h(["grid","y","show"],!1),mh=h(["grid","y","lines"],[]),nh=h(["grid","y","ticks"],10),oh=h(["point","show"],!0),ph=oh?h(["point","r"],2.5):0,qh=h(["point","focus","line","enabled"],!0),rh=h(["point","focus","expand","enabled"],!0),sh=h(["point","focus","expand","r"],rh?4:ph),th=h(["point","focus","select","r"],8),uh=h(["bar","width"]),vh=h(["bar","width","ratio"],.6),wh=h(["pie","label","show"],!0),xh=h(["pie","label","format"]),yh=h(["pie","onclick"],function(){}),zh=h(["pie","onmouseover"],function(){}),Ah=h(["pie","onmouseout"],function(){}),Bh=h(["donut","label","show"],!0),Ch=h(["donut","label","format"]),Dh=h(["donut","title"],""),Eh=h(["donut","onclick"],function(){}),Fh=h(["donut","onmouseover"],function(){}),Gh=h(["donut","onmouseout"],function(){}),Hh=h(["regions"],[]),Ih=h(["tooltip","show"],!0),Jh=h(["tooltip","format","title"]),Kh=h(["tooltip","format","value"]),Lh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Jh?Jh:b,l=Kh?Kh: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+""}),Mh=h(["tooltip","init","show"],!1),Nh=h(["tooltip","init","x"],0),Oh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Ph=("string"==typeof ff?ff.replace("#",""):ff.id)+"-clip",Qh=Ph+"-xaxis",Rh=Ph+"-yaxis",Sh=i(Ph),Th=i(Th),Uh=i(Uh),Vh="timeseries"===Gg,Wh="categorized"===Gg,Xh=!Vh&&(_f||fe(ag)),Yh=null,Zh=!1,$h=!1,_h=!1,ai=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],bi=ae(mg,fe(Ag)?Ag:ai,lg),ci=function(){var a=[[cf.time.format("%Y/%-m/%-d"),function(){return!0}],[cf.time.format("%-m/%-d"),function(a){return a.getMonth()}],[cf.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[cf.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[cf.time.format("%I %p"),function(a){return a.getHours()}],[cf.time.format("%I:%M"),function(a){return a.getMinutes()}],[cf.time.format(":%S"),function(a){return a.getSeconds()}],[cf.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)}}(),di=[],ei=[],fi=Fg?"left":"bottom",gi=Fg?Xg?"top":"bottom":Xg?"right":"left",hi=Fg?eh?"bottom":"top":eh?"left":"right",ii=Fg?"left":"bottom",ji={main:function(){return"translate("+rf.left+","+rf.top+")"},context:function(){return"translate("+sf.left+","+sf.top+")"},legend:function(){return"translate("+tf.left+","+tf.top+")"},x:function(){return"translate(0,"+(Fg?0:wf)+")"},y:function(){return"translate(0,"+(Fg?wf:0)+")"},y2:function(){return"translate("+(Fg?0:uf)+","+(Fg?1:0)+")"},subx:function(){return"translate(0,"+(Fg?0:xf)+")"},arc:function(){return"translate("+uf/2+","+wf/2+")"}},ki="right"===Cg,li=0,mi=0,ni=0,oi=30,pi=30,qi=5;If=cf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var ri,si=function(){var a=cf.svg.line().x(Fg?function(a){return V(a.id)(a.value)}:nd).y(Fg?nd:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=pe(b.values);return Sd(b)?(a.interpolate(Td(b)?"cardinal":"linear"),kg[b.id]?Be(e,Rf,V(b.id),kg[b.id]):a(e)):(c=Rf(e[0].x),d=V(b.id)(e[0].value),Fg?"M "+d+" "+c:"M "+c+" "+d)}}(),ti=function(){var a;return a=Fg?cf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(nd):cf.svg.area().x(nd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=pe(b.values);return Md([b],"area")||Md([b],"area-spline")?(a.interpolate(Td(b)?"cardinal":"linear"),a(e)):(c=Rf(e[0].x),d=V(b.id)(e[0].value),Fg?"M "+d+" "+c:"M "+c+" "+d)}}(),ui=function(){var a=cf.svg.line().x(Fg?function(a){return W(a.id)(a.value)}:qd).y(Fg?qd:function(a){return W(a.id)(a.value)});return function(b){var c=pe(b.values);return Sd(b)?a(c):"M "+Uf(c[0].x)+" "+W(b.id)(c[0].value)}}(),vi=function(){};ri=cf.svg.brush().on("brush",Ke),ri.update=function(){return zi&&zi.select("."+f.brush).call(this),this},ri.scale=function(a){return Fg?this.y(a):this.x(a)},lf&&(vi=cf.behavior.zoom().on("zoomstart",function(){vi.altDomain=cf.event.sourceEvent.altKey?Rf.orgDomain():null}).on("zoom",lf?Le:null),vi.scale=function(a){return Fg?this.y(a):this.x(a)},vi.orgScaleExtent=function(){var a=mf?mf:[1,10];return[a[0],Math.max(tc()/a[1],a[1])]},vi.updateScaleExtent=function(){var a=$b(Rf.orgDomain())/$b(Di),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var wi,xi,yi,zi,Ai,Bi,Ci,Di,Ei,Fi={};if(df.focus=function(a){function b(a){Bc(a).transition().duration(100).style("opacity",1)}var c=wi.selectAll(ad(a)),d=c.filter($e),e=c.filter(_e);df.revert(),df.defocus(),b(d.classed(f.focused,!0)),b(e),Rd(df.data.targets)&&Kb(a,!0),Ue(a)},df.defocus=function(a){function b(a){Bc(a).transition().duration(100).style("opacity",.3)}var c=wi.selectAll(ad(a)),d=c.filter($e),e=c.filter(_e);df.revert(),b(d.classed(f.focused,!1)),b(e),Rd(df.data.targets)&&Lb(a),Ve(a)},df.revert=function(a){function b(a){Bc(a).transition().duration(100).style("opacity",1)}var c=wi.selectAll(ad(a)),d=c.filter($e),e=c.filter(_e);b(d.classed(f.focused,!1)),b(e),Rd(df.data.targets)&&Lb(a),We()},df.show=function(a,b){a=wc(a),b=b||{},Fc(a),wi.selectAll(bd(a)).transition().style("opacity",1),b.withLegend&&Ye(a),Je({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},df.hide=function(a,b){a=wc(a),b=b||{},Ec(a),wi.selectAll(bd(a)).transition().style("opacity",0),b.withLegend&&Ye(a),Je({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},df.toggle=function(a){zc(a)?df.hide(a):df.show(a)},df.unzoom=function(){ri.clear().update(),Je({withUpdateXDomain:!0})},df.load=function(a){return a.xs&&ic(a.xs),"categories"in a&&Wh&&(Hg=a.categories,Xf.categories(Hg)),"cacheIds"in a&&_b(a.cacheIds)?void Qe(bc(a.cacheIds),a.done):void("unload"in a?Se(wc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Re(a)}):Re(a))},df.unload=function(a){Se(wc(a),function(){Je({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},df.selected=function(a){return cf.merge(yi.selectAll("."+f.shapes+_c(a)).selectAll("."+f.shape).filter(function(){return cf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},df.select=function(a,b,c){ng&&yi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=cf.select(this),i="circle"===this.nodeName?je:me,j="circle"===this.nodeName?ke:ne,k=og||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?pg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},df.unselect=function(a,b){ng&&yi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=cf.select(this),g="circle"===this.nodeName?ke:ne,h=og||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&pg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},df.toLine=function(a){bf(a,"line")},df.toSpline=function(a){bf(a,"spline")},df.toBar=function(a){bf(a,"bar")},df.toScatter=function(a){bf(a,"scatter")},df.toArea=function(a){bf(a,"area")},df.toAreaSpline=function(a){bf(a,"area-spline")},df.toPie=function(a){bf(a,"pie",{withTransform:!0})},df.toDonut=function(a){bf(a,"donut",{withTransform:!0})},df.groups=function(a){return c(a)?eg:(eg=a,Je(),eg)},df.xgrids=function(a){return a?(kh=a,Je(),kh):kh},df.xgrids.add=function(a){return a?df.xgrids(kh.concat(a)):void 0},df.xgrids.remove=function(a){var b=af(a);return df.xgrids(kh.filter(b))},df.ygrids=function(a){return a?(mh=a,Je(),mh):mh},df.ygrids.add=function(a){return a?df.ygrids(mh.concat(a)):void 0},df.ygrids.remove=function(a){var b=af(a);return df.ygrids(mh.filter(b))},df.regions=function(a){return c(a)?Hh:(Hh=a,Je(),Hh)},df.regions.add=function(a){return c(a)?Hh:(Hh=Hh.concat(a),Je(),Hh)},df.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;wi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Hh=Hh.filter(function(b){return b.classes.indexOf(a)<0})}),Hh},df.data.get=function(a){var b=df.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},df.data.getAsTarget=function(a){var b=yc(function(b){return b.id===a});return b.length>0?b[0]:void 0},df.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){dg[b]=a[b]}),Ze(vc(df.data.targets),{withTransition:!0}),dg):dg},df.x=function(a){return arguments.length&&(kc(df.data.targets,a),Je({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),df.data.x},df.xs=function(a){return arguments.length&&(lc(df.data.targets,a),Je({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),df.data.x},df.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},df.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Tg=+a.y),b(a.y2)&&(ah=+a.y2)):Tg=ah=+a,Je())},df.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Ug=+a.y),b(a.y2)&&(bh=+a.y2)):Ug=bh=+a,Je())},df.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&df.axis.max(a.max),"undefined"!=typeof a.min&&df.axis.min(a.min)) -},df.legend.show=function(a){Bg&&(Xe(wc(a)),Je({withTransitionForHorizontalAxis:!1}))},df.legend.hide=function(a){Bg&&(Ye(wc(a)),Je({withTransitionForHorizontalAxis:!1}))},df.resize=function(a){gf=a?a.width:null,hf=a?a.height:null,Oe({withLegend:!0,withTransition:!1})},df.destroy=function(){df.data.targets=void 0,df.data.x={},Ci.html(""),a.onresize=null},"url"in e.data)cf.csv(e.data.url,function(a,b){Ce(b)});else if("rows"in e.data)Ce(nc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ce(oc(e.data.columns))}return df},"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.28"},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;cvf&&(vf=0),0>xf&&(xf=0),tf={top:Eg?sf.top:Af-yg-(ji?0:a),right:0/0,bottom:20+(ji?0:a),left:Eg?ni:sf.left},wf=Eg?sf.left-ni-oi:vf,yf=Eg?xf:Af-tf.top-tf.bottom,0>wf&&(wf=0),0>yf&&(yf=0),uf={top:ji?0:Af-a,right:0/0,bottom:0,left:ji?zf-b:0},p(),ji&&Rd(ef.data.targets)&&(uf.left=vf/2+Cf)}function o(){xi.select("line."+f.xgridFocus).attr("x1",Eg?0:-10).attr("x2",Eg?vf:-10).attr("y1",Eg?-10:sf.top).attr("y2",Eg?-10:xf)}function p(){Cf=xf/2,Bf=.95*Cf,Df=Qd(ef.data.targets)?.6*Bf:0}function q(){var a=Eg?f.axisX:f.axisY,b=df.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=df.select(gf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return hf?hf:x()}function s(){var a=jf?jf:y();return a>0?a:320}function t(){return Rd(ef.data.targets)?0:kf?kf:Eg||!Rg||Wg?1:v("y")}function u(){var a=1;return Rd(ef.data.targets)?0:lf?lf:ji?P()+($g&&!Eg?v("y2"):a):$g?dh||Eg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||Rg?"y2"!==a||$g?(gb(a).isInner?30:40)+("y2"===a?-10:0):pi:Ag&&!ji?10:1}function x(){return+df.select(gf).style("width").replace("px","")}function y(){return+df.select(gf).style("height").replace("px","")}function z(a){return a?-5:-(sf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Eg)}function C(){return A(!Eg)}function D(){return z(Eg)}function E(){return A(Eg)}function F(a){return a?vf+2+4:sf.left+20}function G(a){return a?80:xf+2}function H(){return F(!Eg)}function I(){return G(!Eg)}function J(){return F(Eg)}function K(){return G(Eg)}function L(){var a=Eg?xf:vf,b=tc(),c=Vb()*(Nd(ef.data.targets)?(b-(Vh?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){ki=a}function N(a){li=a}function O(a){mi=a}function P(){return Ag?ji?li*(ki+1):zf:0}function Q(){return Ag?ji?Af:mi*(ki+1):0}function R(){var a,b=!Qf;If=Eg?1:0,Jf=Eg?xf:vf,Kf=Eg?0:xf,Lf=Eg?vf:1,Mf=If,Nf=Jf,Of=Eg?0:yf,Pf=Eg?wf:1,Qf=T(If,Jf,b?void 0:Qf.domain(),function(){return Wf.tickOffset()}),Rf=U(Kf,Lf),Sf=U(Kf,Lf),Tf=T(If,Jf,Ci,function(a){return a%1?0:Zf.tickOffset()}),Uf=U(Of,Pf),Vf=U(Of,Pf),a=$(),Wf=X(Qf,ei,a),Zf=X(Tf,hi,a),Xf=Y(Rf,fi,Xg,Zg),Yf=Y(Sf,gi,eh,gh),b||(qi.scale(Tf),mf&&ui.scale(Qf)),S()}function S(){Ef=Db(),Ff=Eb(),Gf=Eb(.98)}function T(a,b,e,f){var g=(Uh?df.time.scale():df.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),Vh){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return df.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?Sf:Rf}function W(a){return"y2"===Z(a)?Vf:Uf}function X(a,b,c){var d=(Vh?Bb():df.svg.axis()).scale(a).orient(b);return d.tickFormat(c),Vh?d.tickCentered(Hg):d.tickOffset=function(){var a=Eg?xf:vf;return a*Vb()/tc()/2},Vh&&d.categories(Gg),d}function Y(a,b,c,d){return df.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in eg?eg[a]:"y"}function $(){var a=Uh?bi:Vh?Mc:function(a){return 0>a?a.toFixed(0):a};return Ig&&("function"==typeof Ig?a=Ig:Uh&&(a=function(a){return df.time.format(Ig)(a)})),a}function _(a){var b;return"y"===a?b=Vg:"y2"===a?b=ch:"x"===a&&(b=Qg),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Vg=b:"y2"===a?ch=b:"x"===a&&(Qg=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Eg?"inner-top":"inner-right")}function eb(){return cb("y",Eg?"inner-right":"inner-top")}function fb(){return cb("y2",Eg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?vf/2:vf:b.isBottom?-xf:b.isMiddle?-xf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Eg,db())}function ob(){return kb(Eg,eb())}function pb(){return kb(Eg,fb())}function qb(){return lb(!Eg,db())}function rb(){return lb(Eg,eb())}function sb(){return lb(Eg,fb())}function tb(){var a=db();return Eg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Eg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Eg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Eg,db())}function xb(){return mb(Eg,eb())}function yb(){return mb(Eg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return df.selectAll("."+c+" .tick text").each(function(){var a=this.getBBox();bb?20:b}function Ab(){xi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),xi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),xi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Kc(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 df.min(Object.keys(i).map(function(a){return df.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=vc(a),i=Ic(a);if(dg.length>0)for(g=Lc(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 df.max(Object.keys(i).map(function(a){return df.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?ah:Tg,n="y2"===c?_g:Sg,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?bh:Ug,r=id()&&Eg;return 0===l.length?"y2"===c?Sf.domain():Rf.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=jd(o,p),j=$b(Rf.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Yg&&(f=b(Yg.top)?Yg.top:e,g=b(Yg.bottom)?Yg.bottom:e),"y2"===c&&fh&&(f=b(fh.top)?fh.top:e,g=b(fh.bottom)?fh.bottom:e),Nd(l)&&!Kc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Ci),c=$b(Qf.domain());return a||0===c?1:b/c}function Wb(a){return Og?Og:df.min(a,function(a){return df.min(a.values,function(a){return a.x})})}function Xb(a){return Ng?Ng:df.max(a,function(a){return df.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return Vh?d=0:Nd(a)?(c=tc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=Uh?new Date(c.getTime()-e):c-e,g=Uh?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return $f&&a===$f||ge(_f)&&he(_f,a)}function fc(a){return!ec(a)}function gc(a){return $f?$f:ge(_f)?_f[a]:null}function hc(a,b){return a in ef.data.x&&ef.data.x[a]&&ef.data.x[a][b]?ef.data.x[a][b]:b}function ic(a){Object.keys(a).forEach(function(b){_f[b]=a[b]})}function jc(a){var b;return a&&(b=cg[a.id],a.name=b?b:a.id),a}function kc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=mc(b[d],a.id,d)}),ef.data.x[a.id]=b})}function lc(a,b){a.forEach(function(a){b[a.id]&&kc([a],b[a.id])})}function mc(a,b,c){var d;return d=Uh?a?a instanceof Date?a:be(a):be(hc(b,c)):Wh&&!Vh?a?+a:hc(b,c):c}function nc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0&&(ef.data.x[b]=a.map(function(a){return a[c]})):ef.data.x[b]=a.map(function(a,b){return b})}),c.forEach(function(a){if(!ef.data.x[a])throw new Error('x is not defined for id = "'+a+'".')}),b=c.map(function(b,c){var d=bg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=mc(g,b,e);return Wh&&Vh&&0===c&&g&&(0===e&&(Gg=[]),Gg.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++})}),fg&&Ld(vc(b).filter(function(a){return!(a in gg)}),fg),b.forEach(function(a){ac(a.id_org,a)}),b}function qc(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 rc(a){return a>0&&ef.data.targets[0].values[a-1]?ef.data.targets[0].values[a-1].x:void 0}function sc(a){return a1?ef.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?ef.data.targets[0]:null,a}function vc(a){return a.map(function(a){return a.id})}function wc(a){return a?"string"==typeof a?[a]:a:vc(ef.data.targets)}function xc(a,b){var c,d=vc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(Uh?new Date(h):h);i.push(d)}return i}function Ec(a){ci=ci.concat(a)}function Fc(a){ci=ci.filter(function(b){return a.indexOf(b)<0})}function Gc(a){di=di.concat(a)}function Hc(a){di=di.filter(function(b){return a.indexOf(b)<0})}function Ic(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Jc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Lc(a){return Jc(a,function(a){return a>0})}function Mc(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(rd(a,f))),a[g].x&&(e=e.concat(rd(a,g))),ud(e,b)):sd(a,b,f,g)}function td(a,b){var c;return c=a.map(function(a){return sd(a.values,b)}),ud(c,b)}function ud(a,b){var c,d;return a.forEach(function(a){var e=ie(a,b);(c>e||!c)&&(c=e,d=a)}),d}function vd(a,b){return df.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function wd(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 xd(){return ig&&"desc"===ig.toLowerCase()}function yd(){return ig&&"asc"===ig.toLowerCase()}function zd(a){var b=yd(),c=xd();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 ig&&a.sort(ig),a}function Ad(a,c){var d,e,f,g,h,i,j,k=Rd(ef.data.targets),l=k?ld:kd,m=a.filter(function(a){return a&&b(a.value)});Hh&&0!==m.length&&(Ai.html(Kh(a,$(),l,ai)).style("display","block"),d=Ai.property("offsetWidth"),e=Ai.property("offsetHeight"),k?(g=vf/2+c[0],i=xf/2+c[1]+20):(Eg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Qf(m[0].x)+20):(f=q(),g=f+t()+Qf(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Ai.style("top",i+"px").style("left",g+"px"))}function Bd(){Ai.style("display","none")}function Cd(a){var c=a.filter(function(a){return a&&b(a.value)});Hh&&(Od(ef.data.targets)||Rd(ef.data.targets)||xi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Eg?"y1":"x1",nd).attr(Eg?"y2":"x2",nd))}function Dd(){xi.select("line."+f.xgridFocus).style("visibility","hidden")}function Ed(a){return a.x||0===a.x?Qf(a.x):null}function Fd(a){return V(a.id)(a.value)}function Gd(){var a,b,d={},e=0;return Bc(yc(Ud)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Kd(a,b){return th?th:b?2*a.tickOffset()*uh/b:0}function Ld(a,b){wc(a).forEach(function(a){Ei[a]=b===gg[a],gg[a]=b})}function Md(a,b){var c=!1;return a.forEach(function(a){gg[a.id]===b&&(c=!0),a.id in gg||"line"!==b||(c=!0)}),c}function Nd(a){return Md(a,"bar")}function Od(a){return Md(a,"scatter")}function Pd(a){return Md(a,"pie")}function Qd(a){return Md(a,"donut")}function Rd(a){return Pd(a)||Qd(a)}function Sd(a){var b="string"==typeof a?a:a.id;return!(b in gg)||"line"===gg[b]||"spline"===gg[b]||"area"===gg[b]||"area-spline"===gg[b]}function Td(a){var b="string"==typeof a?a:a.id;return"spline"===gg[b]||"area-spline"===gg[b]}function Ud(a){var b="string"==typeof a?a:a.id;return"bar"===gg[b]}function Vd(a){var b="string"==typeof a?a:a.id;return"scatter"===gg[b]}function Wd(a){var b="string"==typeof a?a:a.id;return"pie"===gg[b]}function Xd(a){var b="string"==typeof a?a:a.id;return"donut"===gg[b]}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){return Ud(a)?a.values:[]}function $d(a){return Sd(a)||Vd(a)?a.values:[]}function _d(a){return Ud(a)||Sd(a)?a.values:[]}function ae(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function be(b){var c;if(!b)throw Error(b+" can not be parsed as d3.time with format "+ag+". Maybe 'x' of this data is not defined. See data.x or data.xs option.");try{c=ag?df.time.format(ag).parse(b):new Date(b)}catch(d){c=void 0}return c||a.console.error("Failed to parse x '"+b+"' to Date with format "+ag),c}function ce(a,b){var c=df.mouse(a),d=df.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function he(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ie(a,b){var c="y"===Z(a.id)?Rf:Sf,d=Eg?1:0,e=Eg?0:1;return Math.pow(Qf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function je(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function ke(a,b,c){tg(b,a.node()),xi.select("."+f.selectedCircles+_c(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Nc(f.selectedCircle,c)}).attr("cx",Eg?Fd:Ed).attr("cy",Eg?Ed:Fd).attr("stroke",function(){return ai(b)}).attr("r",1.4*sh).transition().duration(100).attr("r",sh)}function le(a,b,c){ug(b,a.node()),xi.select("."+f.selectedCircles+_c(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function me(a,b,c,d){a?ke(b,c,d):le(b,c,d)}function ne(a,b){tg(b,a.node()),a.transition().duration(100).style("fill",function(){return df.rgb(ai(b)).darker(1)})}function oe(a,b){ug(b,a.node()),a.transition().duration(100).style("fill",function(){return ai(b)})}function pe(a,b,c,d){a?ne(b,c,d):oe(b,c,d)}function qe(a){return a.filter(function(a){return b(a.value)})}function re(a,c){return(c?xi.selectAll("."+f.circles+_c(c)):xi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function se(a,b){re(a,b).classed(f.EXPANDED,!0).attr("r",rh)}function te(a){re(a).filter(function(){return df.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",oh)}function ue(a){return xi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function ve(a){ue(a).classed(f.EXPANDED,!0)}function we(a){ue(a).classed(f.EXPANDED,!1)}function xe(a,b){var c=Be(a,b);return function(a,b){var d=c(a,b),e=Eg?1:0,f=Eg?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 ye(a,b){var c=Be(a,!1),d=b?ze:Ae;return function(a,b){return d(c(a,b),a,this)}}function ze(a,b){var c;return Eg?(c=Ud(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ae(a,b,c){var d=c.getBBox();return Eg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:Ud(b)?-3:-6)}function Be(a,b){var c=a.__max__+1,d=Kd(Wf,c),e=Hd(d,c,a,!!b),f=Id(!!b),g=Jd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Eg&&(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 Ce(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 De(b){var c,d,e;if(Bi=df.select(gf),Bi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Bi.html(""),Bi.classed("c3",!0),ef.data.x={},ef.data.targets=pc(b),n(),R(),Qf.domain(df.extent(Zb(ef.data.targets))),Rf.domain(Ub(ef.data.targets,"y")),Sf.domain(Ub(ef.data.targets,"y2")),Tf.domain(Qf.domain()),Uf.domain(Rf.domain()),Vf.domain(Sf.domain()),Ci=Qf.domain(),qi.scale(Tf),mf&&ui.scale(Qf),vi=Bi.append("svg").attr("width",vf+sf.left+sf.right).attr("height",xf+sf.top+sf.bottom).on("mouseenter",pf).on("mouseleave",qf),wi=vi.append("defs"),wi.append("clipPath").attr("id",Oh).append("rect").attr("width",vf).attr("height",xf),wi.append("clipPath").attr("id",Ph).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),wi.append("clipPath").attr("id",Qh).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),xi=vi.append("g").attr("transform",ii.main),yi=xg?vi.append("g").attr("transform",ii.context):null,zi=vi.append("g").attr("transform",ii.legend),Ag||(zi.style("visibility","hidden"),di=vc(ef.data.targets)),Ai=df.select(gf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),$e(vc(ef.data.targets),{withTransform:!1,withTransitionForTransform:!1}),xi.append("g").attr("class",f.axisX).attr("clip-path",Eg?"":Sh).attr("transform",ii.x).append("text").attr("class",f.axisXLabel).attr("transform",Eg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),Rg&&xi.append("g").attr("class",f.axisY).attr("clip-path",Eg?Th:"").attr("transform",ii.y).append("text").attr("class",f.axisYLabel).attr("transform",Eg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),$g&&xi.append("g").attr("class",f.axisY2).attr("transform",ii.y2).append("text").attr("class",f.axisY2Label).attr("transform",Eg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=xi.append("g").attr("clip-path",Rh).attr("class",f.grid),hh&&d.append("g").attr("class",f.xgrids),ge(jh)&&d.append("g").attr("class",f.xgridLines),ph&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),kh&&d.append("g").attr("class",f.ygrids),ge(lh)&&d.append("g").attr("class",f.ygridLines),xi.append("g").attr("clip-path",Rh).attr("class",f.regions),xi.append("g").attr("clip-path",Rh).attr("class",f.chart),c=xi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",mf?Eg?"ns-resize":"ew-resize":null),xi.select("."+f.chart).append("g").attr("class",f.chartBars),xi.select("."+f.chart).append("g").attr("class",f.chartLines),xi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",ii.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),xi.select("."+f.chart).append("g").attr("class",f.chartTexts),mf&&xi.insert("rect",of?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",vf).attr("height",xf).style("opacity",0).style("cursor",Eg?"ns-resize":"ew-resize").call(ui).on("dblclick.zoom",null),Pg&&qi.extent("function"!=typeof Pg?Pg:Pg(Zb())),xg&&(yi.append("g").attr("clip-path",Rh).attr("class",f.chart),yi.select("."+f.chart).append("g").attr("class",f.chartBars),yi.select("."+f.chart).append("g").attr("class",f.chartLines),yi.append("g").attr("clip-path",Rh).attr("class",f.brush).call(qi).selectAll("rect").attr(Eg?"width":"height",Eg?wf:yf),yi.append("g").attr("class",f.axisX).attr("transform",ii.subx).attr("clip-path",Eg?"":Sh)),Qe(ef.data.targets),Eg?xi.select("."+f.axisX).style("opacity",0).call(Wf):(xi.select("."+f.axisY).style("opacity",0).call(Xf),xi.select("."+f.axisY2).style("opacity",0).call(Yf)),Ke({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Lh){if(Uh&&"string"==typeof Mh){for(Mh=be(Mh),e=0;e0){d=[];for(var g in cg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=wd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=pe,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 Ie(a){Rd(ef.data.targets)||mg&&(Xh=a,xi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Yh=!0,vg())}function Je(){Rd(ef.data.targets)||mg&&(xi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),xi.selectAll("."+f.shape).classed(f.INCLUDED,!1),Yh=!1,wg())}function Ke(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S=Gd(),T=Rd(ef.data.targets),U=Bc(ef.data.targets);if(0!==U.length){if(a=d(a)?a:{},x=d(a.withY)?a.withY:!0,y=d(a.withSubchart)?a.withSubchart:!0,z=d(a.withTransition)?a.withTransition:!0,D=d(a.withTransform)?a.withTransform:!1,E=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,F=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,G=d(a.withLegend)?a.withLegend:!1,A=d(a.withTransitionForExit)?a.withTransitionForExit:z,B=d(a.withTransitionForAxis)?a.withTransitionForAxis:z,C=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:z,M=z?rf:0,N=A?M:0,O=B?M:0,G&&Ag&&$e(vc(ef.data.targets),a),F&&(Qf.domain(df.extent(Zb(U))),Ci=Qf.domain(),mf&&ui.scale(Qf).updateScaleExtent(),Tf.domain(Qf.domain()),qi.scale(Tf)),E&&(Qf.domain(qi.empty()?Ci:qi.extent()),mf&&ui.scale(Qf).updateScaleExtent()),Rf.domain(Ub(U,"y")),Sf.domain(Ub(U,"y2")),Od(U)||(P=Dc(Cc(U)).sort(),Wf.tickValues(P),Zf.tickValues(P)),c=xi.select("."+f.axisX).style("opacity",T?0:1),(Eg||C)&&(c=c.transition().duration(O)),c.call(Wf),e=xi.select("."+f.axisY).style("opacity",T?0:1),(!Eg||C)&&(e=e.transition().duration(O)),e.call(Xf),xi.select("."+f.axisY2).style("opacity",T?0:1).transition().duration(O).call(Yf),E&&Jg&&P){for(Q=1;Q=Y;Y++)h.push(new Date(Y+"-01-01 00:00:00"))}else h=Qf.ticks(10);g=xi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Eg?0:function(a){return Qf(a)-Wf.tickOffset()}).attr("x2",Eg?vf:function(a){return Qf(a)-Wf.tickOffset()}).attr("y1",Eg?function(a){return Qf(a)-Wf.tickOffset()}:sf.top).attr("y2",Eg?function(a){return Qf(a)-Wf.tickOffset()}:xf).style("opacity",function(){return+df.select(this).attr(Eg?"y1":"x1")===(Eg?xf:0)?0:1}),g.exit().remove()}ge(jh)&&(i=xi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(jh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Eg?"":"rotate(-90)").attr("dx",Eg?0:-sf.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(M).attr("x1",Eg?0:od).attr("x2",Eg?vf:od).attr("y1",Eg?od:sf.top).attr("y2",Eg?od:xf).style("opacity",1),i.select("text").transition().duration(M).attr("x",Eg?vf:0).attr("y",od).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(M).style("opacity",0).remove()),x&&kh&&(k=xi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Rf.ticks(mh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Eg?Rf:0).attr("x2",Eg?Rf:vf).attr("y1",Eg?0:Rf).attr("y2",Eg?xf:Rf),k.exit().remove()),x&&ge(lh)&&(l=xi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(lh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Eg?"rotate(-90)":"").attr("dx",Eg?0:-sf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(M).attr("x1",Eg?pd:0).attr("x2",Eg?pd:vf).attr("y1",Eg?0:pd).attr("y2",Eg?xf:pd).style("opacity",1),l.select("text").transition().duration(M).attr("x",Eg?0:vf).attr("y",pd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(M).style("opacity",0).remove()),p=xi.selectAll("."+f.bars).selectAll("."+f.bar).data(Zd),p.enter().append("path").attr("d",H).style("stroke","none").style("opacity",0).style("fill",function(a){return ai(a)}).attr("class",Vc),p.style("opacity",ed).transition().duration(M).attr("d",H).style("opacity",1),p.exit().transition().duration(N).style("opacity",0).remove(),r=xi.selectAll("."+f.texts).selectAll("."+f.text).data(_d),r.enter().append("text").attr("class",Oc).attr("text-anchor",function(a){return Eg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return md(a.id)(a.value)}).style("fill-opacity",fd).transition().duration(M).attr("x",J).attr("y",K).style("fill-opacity",hd),r.exit().transition().duration(N).style("fill-opacity",0).remove(),xi.selectAll("."+f.line).style("opacity",ed).transition().duration(M).attr("d",ri).style("opacity",1),xi.selectAll("."+f.area).style("opacity",0).transition().duration(M).attr("d",si).style("opacity",Di),n=xi.selectAll("."+f.circles).selectAll("."+f.circle).data($d),n.enter().append("circle").attr("class",Tc).style("opacity",0).attr("r",oh),n.style("opacity",ed).transition().duration(M).style("opacity",gd).attr("cx",Eg?Fd:Ed).attr("cy",Eg?Ed:Fd),n.exit().remove(),xi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",D?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(M).attrTween("d",function(a){var b,c=Cb(a);return c?(b=df.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",D?"scale(1)":"").style("opacity",1),xi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(M).text(Jb).style("opacity",function(a){return zc(a.data.id)&&Yd(a.data)?1:0}),xi.select("."+f.chartArcsTitle).style("opacity",Qd(ef.data.targets)?1:0),xg&&(null!==df.event&&"zoom"===df.event.type&&qi.extent(Qf.orgDomain()).update(),y&&(yi.select("."+f.axisX).style("opacity",T?0:1).transition().duration(M).call(Zf),qi.empty()||qi.extent(Qf.orgDomain()).update(),I=xe(S,!0),s=yi.selectAll("."+f.bars).selectAll("."+f.bar).data(Zd),s.enter().append("path").attr("d",I).style("stroke","none").style("fill",function(a){return ai(a)}).attr("class",Vc),s.style("opacity",ed).transition().duration(M).attr("d",I).style("opacity",1),s.exit().transition().duration(M).style("opacity",0).remove(),yi.selectAll("."+f.line).style("opacity",ed).transition().duration(M).attr("d",ti).style("opacity",1))),xi.selectAll("."+f.selectedCircles).filter(function(a){return Ud(a)}).selectAll("circle").remove(),xi.selectAll("."+f.selectedCircle).transition().duration(M).attr("cx",Eg?Fd:Ed).attr("cy",Eg?Ed:Fd),ge(_f)?(t=xi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Fe(t.enter()),t.attr("x",0).attr("y",0).attr("width",vf).attr("height",xf)):(Wh&&!Vh?(w=function(a,b){var c=rc(b),d=sc(b),e=ef.data.x[a.id][b];return(Qf(d?d:e+50)-Qf(c?c:e-50))/2},v=function(a,b){var c=rc(b),d=ef.data.x[a.id][b];return(Qf(d)+Qf(c?c:d-50))/2}):(w=L(),v=function(a){return Qf(a.x)-w/2}),u=uc(),xi.select("."+f.eventRects).datum(u?u.values:[]),t=xi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ee(t.enter()),t.attr("class",$c).attr("x",Eg?0:v).attr("y",Eg?v:0).attr("width",Eg?vf:w).attr("height",Eg?w:xf),t.exit().remove()),q=xi.select("."+f.regions).selectAll("rect."+f.region).data(Gh),q.enter().append("rect").style("fill-opacity",0),q.attr("class",Zc).attr("x",Eg?0:cc).attr("y",Eg?cc:sf.top).attr("width",Eg?vf:dc).attr("height",Eg?dc:xf).transition().duration(M).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(M).style("fill-opacity",0).remove(),vc(ef.data.targets).forEach(function(a){Ei[a]=!0})}}function Le(){Ke({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Me(){return"mousemove"===df.event.sourceEvent.type&&ui.altDomain?(Qf.domain(ui.altDomain),void ui.scale(Qf).updateScaleExtent()):(Vh&&Qf.orgDomain()[0]===Ci[0]&&Qf.domain([Ci[0]-1e-10,Qf.orgDomain()[1]]),Ke({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===df.event.sourceEvent.type&&(Zh=!0)))}function Ne(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Oe(){vi.attr("width",zf).attr("height",Af),vi.select("#"+Oh).select("rect").attr("width",vf).attr("height",xf),vi.select("#"+Ph).select("rect").attr("width",H),vi.select("#"+Qh).select("rect").attr("width",J),vi.select("."+f.zoomRect).attr("width",vf).attr("height",xf)}function Pe(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Oe(),m(a.withTransition),Ke(a)}function Qe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=xi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a),j=i.enter().append("g").attr("class",function(a){return f.chartText+Nc(f.target,a.id)}).style("pointer-events","none"),j.append("g").attr("class",Pc).style("fill",function(a){return ai(a)}),e=xi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),d=e.enter().append("g").attr("class",function(a){return f.chartBar+Nc(f.target,a.id)}).style("pointer-events","none"),d.append("g").attr("class",Wc).style("fill",function(a){return ai(a)}).style("stroke","none").style("cursor",function(a){return og(a)?"pointer":null}),c=xi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),b=c.enter().append("g").attr("class",function(a){return f.chartLine+Nc(f.target,a.id)}).style("pointer-events","none"),b.append("path").attr("class",Sc).style("opacity",0).style("stroke",function(a){return ai(a)}),b.append("path").attr("class",Yc).style("opacity",function(){return Di=+df.select(this).style("opacity"),0}).style("fill",function(a){return ai(a)}),b.append("g").attr("class",function(a){return Nc(f.selectedCircles,a.id)}),b.append("g").attr("class",Uc).style("fill",function(a){return ai(a)}).style("cursor",function(a){return og(a)?"pointer":null}),a.forEach(function(a){xi.selectAll("."+f.selectedCircles+_c(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=xi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Hf(a)),g=h.enter().append("g").attr("class",function(a){return f.chartArc+Nc(f.target,a.data.id)}),g.append("path").attr("class",Xc).style("opacity",0).style("fill",function(a){return ai(a.data)}).style("cursor",function(a){return og(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),Ve(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Ad(c,df.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),Xe(),Bd(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),xg&&(n=yi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),m=n.enter().append("g").attr("class",function(a){return f.chartBar+Nc(f.target,a.id)}),m.append("g").attr("class",Wc).style("fill",function(a){return ai(a)}),l=yi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),k=l.enter().append("g").attr("class",function(a){return f.chartLine+Nc(f.target,a.id)}),k.append("path").attr("class",Sc).style("opacity",0).style("stroke",function(a){return ai(a)})),vi.selectAll("."+f.target).filter(function(a){return zc(a.id)}).transition().style("opacity",1)}function Re(a,b){ef.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBBox(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=ji?j:i,l=ji?Q():P();return d&&(w=0,C=0,t=0,u=0),Ag&&!Ac(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=ji?u:t,void(Dg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,ji?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=zi.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Nc(f.legendItem,a)}).style("visibility",function(a){return Ac(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Cg?Cg(a):ef.toggle(a)}).on("mouseover",function(a){ef.focus(a)}).on("mouseout",function(){ef.revert()}),l.append("text").text(function(a){return d(cg[a])?cg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",ji?g:-200).attr("y",ji?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",ji?h:-200).attr("y",ji?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return ai(a)}).attr("x",ji?g:-200).attr("y",ji?-200:i).attr("width",10).attr("height",10),zi.selectAll("text").data(a).text(function(a){return d(cg[a])?cg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),zi.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),zi.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Oe(),q&&m(p)}function _e(a){return xc(ef.data.targets,a.id)}function af(a){return"data"in a&&xc(ef.data.targets,a.data.id)}function bf(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 cf(a,b,c){var d=!Rd(ef.data.targets);Ld(a,b),Pe(c?c:{withTransitionForAxis:d})}var df=a.d3?a.d3:a.require?a.require("d3"):void 0,ef={data:{},axis:{},legend:{}},ff={},gf=h(["bindto"],"#chart"),hf=h(["size","width"]),jf=h(["size","height"]),kf=h(["padding","left"]),lf=h(["padding","right"]),mf=h(["zoom","enabled"],!1),nf=h(["zoom","extent"]),of=h(["zoom","privileged"],!1),pf=h(["onenter"],function(){}),qf=h(["onleave"],function(){}),rf=h(["transition","duration"],350);g("data","data is required in config");var 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,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f=h(["data","x"]),_f=h(["data","xs"],{}),ag=h(["data","x_format"]),bg=h(["data","id_converter"],function(a){return a}),cg=h(["data","names"],{}),dg=h(["data","groups"],[]),eg=h(["data","axes"],{}),fg=h(["data","type"]),gg=h(["data","types"],{}),hg=h(["data","labels"],{}),ig=h(["data","order"]),jg=h(["data","regions"],{}),kg=h(["data","color"]),lg=h(["data","colors"],{}),mg=h(["data","selection","enabled"],!1),ng=h(["data","selection","grouped"],!1),og=h(["data","selection","isselectable"],function(){return!0}),pg=h(["data","selection","multiple"],!0),qg=h(["data","onclick"],function(){}),rg=h(["data","onenter"],function(){}),sg=h(["data","onleave"],function(){}),tg=h(["data","onselected"],function(){}),ug=h(["data","onunselected"],function(){}),vg=h(["data","ondragstart"],function(){}),wg=h(["data","ondragend"],function(){}),xg=h(["subchart","show"],!1),yg=xg?h(["subchart","size","height"],60):0,zg=h(["color","pattern"],[]),Ag=h(["legend","show"],!0),Bg=h(["legend","position"],"bottom"),Cg=h(["legend","item","onclick"]),Dg=h(["legend","equally"],!1),Eg=h(["axis","rotated"],!1),Fg=h(["axis","x","type"],"indexed"),Gg=h(["axis","x","categories"],[]),Hg=h(["axis","x","tick","centered"],!1),Ig=h(["axis","x","tick","format"]),Jg=h(["axis","x","tick","culling"],{}),Kg=h(["axis","x","tick","culling","max"],"categorized"===Fg?1/0:10),Lg=h(["axis","x","tick","count"]),Mg=h(["axis","x","tick","fit"],!1),Ng=h(["axis","x","max"]),Og=h(["axis","x","min"]),Pg=h(["axis","x","default"]),Qg=h(["axis","x","label"],{}),Rg=h(["axis","y","show"],!0),Sg=h(["axis","y","max"]),Tg=h(["axis","y","min"]),Ug=h(["axis","y","center"]),Vg=h(["axis","y","label"],{}),Wg=h(["axis","y","inner"],!1),Xg=h(["axis","y","tick","format"]),Yg=h(["axis","y","padding"],{}),Zg=h(["axis","y","ticks"],10),$g=h(["axis","y2","show"],!1),_g=h(["axis","y2","max"]),ah=h(["axis","y2","min"]),bh=h(["axis","y2","center"]),ch=h(["axis","y2","label"],{}),dh=h(["axis","y2","inner"],!1),eh=h(["axis","y2","tick","format"]),fh=h(["axis","y2","padding"],{}),gh=h(["axis","y2","ticks"],10),hh=h(["grid","x","show"],!1),ih=h(["grid","x","type"],"tick"),jh=h(["grid","x","lines"],[]),kh=h(["grid","y","show"],!1),lh=h(["grid","y","lines"],[]),mh=h(["grid","y","ticks"],10),nh=h(["point","show"],!0),oh=nh?h(["point","r"],2.5):0,ph=h(["point","focus","line","enabled"],!0),qh=h(["point","focus","expand","enabled"],!0),rh=h(["point","focus","expand","r"],qh?4:oh),sh=h(["point","focus","select","r"],8),th=h(["bar","width"]),uh=h(["bar","width","ratio"],.6),vh=h(["pie","label","show"],!0),wh=h(["pie","label","format"]),xh=h(["pie","onclick"],function(){}),yh=h(["pie","onmouseover"],function(){}),zh=h(["pie","onmouseout"],function(){}),Ah=h(["donut","label","show"],!0),Bh=h(["donut","label","format"]),Ch=h(["donut","title"],""),Dh=h(["donut","onclick"],function(){}),Eh=h(["donut","onmouseover"],function(){}),Fh=h(["donut","onmouseout"],function(){}),Gh=h(["regions"],[]),Hh=h(["tooltip","show"],!0),Ih=h(["tooltip","format","title"]),Jh=h(["tooltip","format","value"]),Kh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Ih?Ih:b,l=Jh?Jh: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+""}),Lh=h(["tooltip","init","show"],!1),Mh=h(["tooltip","init","x"],0),Nh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Oh=("string"==typeof gf?gf.replace("#",""):gf.id)+"-clip",Ph=Oh+"-xaxis",Qh=Oh+"-yaxis",Rh=i(Oh),Sh=i(Sh),Th=i(Th),Uh="timeseries"===Fg,Vh="categorized"===Fg,Wh=!Uh&&($f||ge(_f)),Xh=null,Yh=!1,Zh=!1,$h=!1,_h=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ai=ae(lg,ge(zg)?zg:_h,kg),bi=function(){var a=[[df.time.format("%Y/%-m/%-d"),function(){return!0}],[df.time.format("%-m/%-d"),function(a){return a.getMonth()}],[df.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[df.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[df.time.format("%I %p"),function(a){return a.getHours()}],[df.time.format("%I:%M"),function(a){return a.getMinutes()}],[df.time.format(":%S"),function(a){return a.getSeconds()}],[df.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)}}(),ci=[],di=[],ei=Eg?"left":"bottom",fi=Eg?Wg?"top":"bottom":Wg?"right":"left",gi=Eg?dh?"bottom":"top":dh?"left":"right",hi=Eg?"left":"bottom",ii={main:function(){return"translate("+sf.left+","+sf.top+")"},context:function(){return"translate("+tf.left+","+tf.top+")"},legend:function(){return"translate("+uf.left+","+uf.top+")"},x:function(){return"translate(0,"+(Eg?0:xf)+")"},y:function(){return"translate(0,"+(Eg?xf:0)+")"},y2:function(){return"translate("+(Eg?0:vf)+","+(Eg?1:0)+")"},subx:function(){return"translate(0,"+(Eg?0:yf)+")"},arc:function(){return"translate("+vf/2+","+xf/2+")"}},ji="right"===Bg,ki=0,li=0,mi=0,ni=30,oi=30,pi=5;Hf=df.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var qi,ri=function(){var a=df.svg.line().x(Eg?function(a){return V(a.id)(a.value)}:nd).y(Eg?nd:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=qe(b.values);return Sd(b)?(a.interpolate(Td(b)?"cardinal":"linear"),jg[b.id]?Ce(e,Qf,V(b.id),jg[b.id]):a(e)):(c=Qf(e[0].x),d=V(b.id)(e[0].value),Eg?"M "+d+" "+c:"M "+c+" "+d)}}(),si=function(){var a;return a=Eg?df.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(nd):df.svg.area().x(nd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=qe(b.values);return Md([b],"area")||Md([b],"area-spline")?(a.interpolate(Td(b)?"cardinal":"linear"),a(e)):(c=Qf(e[0].x),d=V(b.id)(e[0].value),Eg?"M "+d+" "+c:"M "+c+" "+d)}}(),ti=function(){var a=df.svg.line().x(Eg?function(a){return W(a.id)(a.value)}:qd).y(Eg?qd:function(a){return W(a.id)(a.value)});return function(b){var c=qe(b.values);return Sd(b)?a(c):"M "+Tf(c[0].x)+" "+W(b.id)(c[0].value)}}(),ui=function(){};qi=df.svg.brush().on("brush",Le),qi.update=function(){return yi&&yi.select("."+f.brush).call(this),this},qi.scale=function(a){return Eg?this.y(a):this.x(a)},mf&&(ui=df.behavior.zoom().on("zoomstart",function(){ui.altDomain=df.event.sourceEvent.altKey?Qf.orgDomain():null}).on("zoom",mf?Me:null),ui.scale=function(a){return Eg?this.y(a):this.x(a)},ui.orgScaleExtent=function(){var a=nf?nf:[1,10];return[a[0],Math.max(tc()/a[1],a[1])]},ui.updateScaleExtent=function(){var a=$b(Qf.orgDomain())/$b(Ci),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var vi,wi,xi,yi,zi,Ai,Bi,Ci,Di,Ei={};if(ef.focus=function(a){function b(a){Bc(a).transition().duration(100).style("opacity",1)}var c=vi.selectAll(ad(a)),d=c.filter(_e),e=c.filter(af);ef.revert(),ef.defocus(),b(d.classed(f.focused,!0)),b(e),Rd(ef.data.targets)&&Kb(a,!0),Ve(a)},ef.defocus=function(a){function b(a){Bc(a).transition().duration(100).style("opacity",.3)}var c=vi.selectAll(ad(a)),d=c.filter(_e),e=c.filter(af);ef.revert(),b(d.classed(f.focused,!1)),b(e),Rd(ef.data.targets)&&Lb(a),We(a)},ef.revert=function(a){function b(a){Bc(a).transition().duration(100).style("opacity",1)}var c=vi.selectAll(ad(a)),d=c.filter(_e),e=c.filter(af);b(d.classed(f.focused,!1)),b(e),Rd(ef.data.targets)&&Lb(a),Xe()},ef.show=function(a,b){a=wc(a),b=b||{},Fc(a),vi.selectAll(bd(a)).transition().style("opacity",1),b.withLegend&&Ye(a),Ke({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},ef.hide=function(a,b){a=wc(a),b=b||{},Ec(a),vi.selectAll(bd(a)).transition().style("opacity",0),b.withLegend&&Ze(a),Ke({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},ef.toggle=function(a){zc(a)?ef.hide(a):ef.show(a)},ef.unzoom=function(){qi.clear().update(),Ke({withUpdateXDomain:!0})},ef.load=function(a){return a.xs&&ic(a.xs),"categories"in a&&Vh&&(Gg=a.categories,Wf.categories(Gg)),"cacheIds"in a&&_b(a.cacheIds)?void Re(bc(a.cacheIds),a.done):void("unload"in a?Te(wc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Se(a)}):Se(a))},ef.unload=function(a){Te(wc(a),function(){Ke({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},ef.selected=function(a){return df.merge(xi.selectAll("."+f.shapes+_c(a)).selectAll("."+f.shape).filter(function(){return df.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},ef.select=function(a,b,c){mg&&xi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=df.select(this),i="circle"===this.nodeName?ke:ne,j="circle"===this.nodeName?le:oe,k=ng||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?og(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},ef.unselect=function(a,b){mg&&xi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=df.select(this),g="circle"===this.nodeName?le:oe,h=ng||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&og(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},ef.toLine=function(a){cf(a,"line")},ef.toSpline=function(a){cf(a,"spline")},ef.toBar=function(a){cf(a,"bar")},ef.toScatter=function(a){cf(a,"scatter")},ef.toArea=function(a){cf(a,"area")},ef.toAreaSpline=function(a){cf(a,"area-spline")},ef.toPie=function(a){cf(a,"pie",{withTransform:!0})},ef.toDonut=function(a){cf(a,"donut",{withTransform:!0})},ef.groups=function(a){return c(a)?dg:(dg=a,Ke(),dg)},ef.xgrids=function(a){return a?(jh=a,Ke(),jh):jh},ef.xgrids.add=function(a){return a?ef.xgrids(jh.concat(a)):void 0},ef.xgrids.remove=function(a){var b=bf(a);return ef.xgrids(jh.filter(b))},ef.ygrids=function(a){return a?(lh=a,Ke(),lh):lh},ef.ygrids.add=function(a){return a?ef.ygrids(lh.concat(a)):void 0},ef.ygrids.remove=function(a){var b=bf(a);return ef.ygrids(lh.filter(b))},ef.regions=function(a){return c(a)?Gh:(Gh=a,Ke(),Gh)},ef.regions.add=function(a){return c(a)?Gh:(Gh=Gh.concat(a),Ke(),Gh)},ef.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;vi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Gh=Gh.filter(function(b){return b.classes.indexOf(a)<0})}),Gh},ef.data.get=function(a){var b=ef.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},ef.data.getAsTarget=function(a){var b=yc(function(b){return b.id===a});return b.length>0?b[0]:void 0},ef.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){cg[b]=a[b]}),$e(vc(ef.data.targets),{withTransition:!0}),cg):cg},ef.x=function(a){return arguments.length&&(kc(ef.data.targets,a),Ke({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),ef.data.x},ef.xs=function(a){return arguments.length&&(lc(ef.data.targets,a),Ke({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),ef.data.x},ef.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},ef.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Sg=+a.y),b(a.y2)&&(_g=+a.y2)):Sg=_g=+a,Ke())},ef.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Tg=+a.y),b(a.y2)&&(ah=+a.y2)):Tg=ah=+a,Ke()) +},ef.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&ef.axis.max(a.max),"undefined"!=typeof a.min&&ef.axis.min(a.min))},ef.legend.show=function(a){Ag||(Ag=!0,zi.style("visibility","visible")),Ye(wc(a)),Ke({withTransitionForHorizontalAxis:!1})},ef.legend.hide=function(a){Ag&&fe(a)&&(Ag=!1,zi.style("visibility","hidden")),Ze(wc(a)),Ke({withTransitionForHorizontalAxis:!1})},ef.resize=function(a){hf=a?a.width:null,jf=a?a.height:null,Pe({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},ef.destroy=function(){ef.data.targets=void 0,ef.data.x={},Bi.html(""),a.onresize=null},"url"in e.data)df.csv(e.data.url,function(a,b){De(b)});else if("rows"in e.data)De(nc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");De(oc(e.data.columns))}return ef},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From a4805bcb51e6db3113758d90bcc7f6805d1dfced Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Mon, 7 Apr 2014 15:40:59 +0900 Subject: [PATCH 015/178] Add type and types param to load API --- c3.js | 22 +++++++++++++++------- c3.min.js | 4 ++-- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/c3.js b/c3.js index cd4a6b0..ba07dd0 100644 --- a/c3.js +++ b/c3.js @@ -3537,7 +3537,13 @@ .style("opacity", 1); } - function load(targets, done) { + function load(targets, args) { + // set type if args.types || args.type specified + if (args.type || args.types) { + targets.forEach(function (t) { + args.types ? setTargetType(t.id, args.types[t.id]) : setTargetType(t.id, args.type); + }); + } // Update/Add data c3.data.targets.forEach(function (d) { for (var i = 0; i < targets.length; i++) { @@ -3556,23 +3562,25 @@ // Redraw with new targets redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: true}); - if (typeof done === 'function') { done(); } + if (typeof args.done === 'function') { + args.done(); + } } function loadFromArgs(args) { // load data if ('data' in args) { - load(convertDataToTargets(args.data), args.done); + load(convertDataToTargets(args.data), args); } else if ('url' in args) { d3.csv(args.url, function (error, data) { - load(convertDataToTargets(data), args.done); + load(convertDataToTargets(data), args); }); } else if ('rows' in args) { - load(convertDataToTargets(convertRowsToData(args.rows)), args.done); + load(convertDataToTargets(convertRowsToData(args.rows)), args); } else if ('columns' in args) { - load(convertDataToTargets(convertColumnsToData(args.columns)), args.done); + load(convertDataToTargets(convertColumnsToData(args.columns)), args); } else { throw Error('url or rows or columns is required.'); @@ -3907,7 +3915,7 @@ }; c3.load = function (args) { - // update xs if exists + // update xs if specified if (args.xs) { addXs(args.xs); } diff --git a/c3.min.js b/c3.min.js index 9fd02a3..6a61d73 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ !function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.28"},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;cvf&&(vf=0),0>xf&&(xf=0),tf={top:Eg?sf.top:Af-yg-(ji?0:a),right:0/0,bottom:20+(ji?0:a),left:Eg?ni:sf.left},wf=Eg?sf.left-ni-oi:vf,yf=Eg?xf:Af-tf.top-tf.bottom,0>wf&&(wf=0),0>yf&&(yf=0),uf={top:ji?0:Af-a,right:0/0,bottom:0,left:ji?zf-b:0},p(),ji&&Rd(ef.data.targets)&&(uf.left=vf/2+Cf)}function o(){xi.select("line."+f.xgridFocus).attr("x1",Eg?0:-10).attr("x2",Eg?vf:-10).attr("y1",Eg?-10:sf.top).attr("y2",Eg?-10:xf)}function p(){Cf=xf/2,Bf=.95*Cf,Df=Qd(ef.data.targets)?.6*Bf:0}function q(){var a=Eg?f.axisX:f.axisY,b=df.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=df.select(gf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return hf?hf:x()}function s(){var a=jf?jf:y();return a>0?a:320}function t(){return Rd(ef.data.targets)?0:kf?kf:Eg||!Rg||Wg?1:v("y")}function u(){var a=1;return Rd(ef.data.targets)?0:lf?lf:ji?P()+($g&&!Eg?v("y2"):a):$g?dh||Eg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||Rg?"y2"!==a||$g?(gb(a).isInner?30:40)+("y2"===a?-10:0):pi:Ag&&!ji?10:1}function x(){return+df.select(gf).style("width").replace("px","")}function y(){return+df.select(gf).style("height").replace("px","")}function z(a){return a?-5:-(sf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Eg)}function C(){return A(!Eg)}function D(){return z(Eg)}function E(){return A(Eg)}function F(a){return a?vf+2+4:sf.left+20}function G(a){return a?80:xf+2}function H(){return F(!Eg)}function I(){return G(!Eg)}function J(){return F(Eg)}function K(){return G(Eg)}function L(){var a=Eg?xf:vf,b=tc(),c=Vb()*(Nd(ef.data.targets)?(b-(Vh?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){ki=a}function N(a){li=a}function O(a){mi=a}function P(){return Ag?ji?li*(ki+1):zf:0}function Q(){return Ag?ji?Af:mi*(ki+1):0}function R(){var a,b=!Qf;If=Eg?1:0,Jf=Eg?xf:vf,Kf=Eg?0:xf,Lf=Eg?vf:1,Mf=If,Nf=Jf,Of=Eg?0:yf,Pf=Eg?wf:1,Qf=T(If,Jf,b?void 0:Qf.domain(),function(){return Wf.tickOffset()}),Rf=U(Kf,Lf),Sf=U(Kf,Lf),Tf=T(If,Jf,Ci,function(a){return a%1?0:Zf.tickOffset()}),Uf=U(Of,Pf),Vf=U(Of,Pf),a=$(),Wf=X(Qf,ei,a),Zf=X(Tf,hi,a),Xf=Y(Rf,fi,Xg,Zg),Yf=Y(Sf,gi,eh,gh),b||(qi.scale(Tf),mf&&ui.scale(Qf)),S()}function S(){Ef=Db(),Ff=Eb(),Gf=Eb(.98)}function T(a,b,e,f){var g=(Uh?df.time.scale():df.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),Vh){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return df.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?Sf:Rf}function W(a){return"y2"===Z(a)?Vf:Uf}function X(a,b,c){var d=(Vh?Bb():df.svg.axis()).scale(a).orient(b);return d.tickFormat(c),Vh?d.tickCentered(Hg):d.tickOffset=function(){var a=Eg?xf:vf;return a*Vb()/tc()/2},Vh&&d.categories(Gg),d}function Y(a,b,c,d){return df.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in eg?eg[a]:"y"}function $(){var a=Uh?bi:Vh?Mc:function(a){return 0>a?a.toFixed(0):a};return Ig&&("function"==typeof Ig?a=Ig:Uh&&(a=function(a){return df.time.format(Ig)(a)})),a}function _(a){var b;return"y"===a?b=Vg:"y2"===a?b=ch:"x"===a&&(b=Qg),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Vg=b:"y2"===a?ch=b:"x"===a&&(Qg=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Eg?"inner-top":"inner-right")}function eb(){return cb("y",Eg?"inner-right":"inner-top")}function fb(){return cb("y2",Eg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?vf/2:vf:b.isBottom?-xf:b.isMiddle?-xf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Eg,db())}function ob(){return kb(Eg,eb())}function pb(){return kb(Eg,fb())}function qb(){return lb(!Eg,db())}function rb(){return lb(Eg,eb())}function sb(){return lb(Eg,fb())}function tb(){var a=db();return Eg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Eg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Eg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Eg,db())}function xb(){return mb(Eg,eb())}function yb(){return mb(Eg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return df.selectAll("."+c+" .tick text").each(function(){var a=this.getBBox();bb?20:b}function Ab(){xi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),xi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),xi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Kc(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 df.min(Object.keys(i).map(function(a){return df.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=vc(a),i=Ic(a);if(dg.length>0)for(g=Lc(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 df.max(Object.keys(i).map(function(a){return df.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?ah:Tg,n="y2"===c?_g:Sg,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?bh:Ug,r=id()&&Eg;return 0===l.length?"y2"===c?Sf.domain():Rf.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=jd(o,p),j=$b(Rf.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Yg&&(f=b(Yg.top)?Yg.top:e,g=b(Yg.bottom)?Yg.bottom:e),"y2"===c&&fh&&(f=b(fh.top)?fh.top:e,g=b(fh.bottom)?fh.bottom:e),Nd(l)&&!Kc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Ci),c=$b(Qf.domain());return a||0===c?1:b/c}function Wb(a){return Og?Og:df.min(a,function(a){return df.min(a.values,function(a){return a.x})})}function Xb(a){return Ng?Ng:df.max(a,function(a){return df.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return Vh?d=0:Nd(a)?(c=tc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=Uh?new Date(c.getTime()-e):c-e,g=Uh?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return $f&&a===$f||ge(_f)&&he(_f,a)}function fc(a){return!ec(a)}function gc(a){return $f?$f:ge(_f)?_f[a]:null}function hc(a,b){return a in ef.data.x&&ef.data.x[a]&&ef.data.x[a][b]?ef.data.x[a][b]:b}function ic(a){Object.keys(a).forEach(function(b){_f[b]=a[b]})}function jc(a){var b;return a&&(b=cg[a.id],a.name=b?b:a.id),a}function kc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=mc(b[d],a.id,d)}),ef.data.x[a.id]=b})}function lc(a,b){a.forEach(function(a){b[a.id]&&kc([a],b[a.id])})}function mc(a,b,c){var d;return d=Uh?a?a instanceof Date?a:be(a):be(hc(b,c)):Wh&&!Vh?a?+a:hc(b,c):c}function nc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0&&(ef.data.x[b]=a.map(function(a){return a[c]})):ef.data.x[b]=a.map(function(a,b){return b})}),c.forEach(function(a){if(!ef.data.x[a])throw new Error('x is not defined for id = "'+a+'".')}),b=c.map(function(b,c){var d=bg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=mc(g,b,e);return Wh&&Vh&&0===c&&g&&(0===e&&(Gg=[]),Gg.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++})}),fg&&Ld(vc(b).filter(function(a){return!(a in gg)}),fg),b.forEach(function(a){ac(a.id_org,a)}),b}function qc(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 rc(a){return a>0&&ef.data.targets[0].values[a-1]?ef.data.targets[0].values[a-1].x:void 0}function sc(a){return a1?ef.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?ef.data.targets[0]:null,a}function vc(a){return a.map(function(a){return a.id})}function wc(a){return a?"string"==typeof a?[a]:a:vc(ef.data.targets)}function xc(a,b){var c,d=vc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(Uh?new Date(h):h);i.push(d)}return i}function Ec(a){ci=ci.concat(a)}function Fc(a){ci=ci.filter(function(b){return a.indexOf(b)<0})}function Gc(a){di=di.concat(a)}function Hc(a){di=di.filter(function(b){return a.indexOf(b)<0})}function Ic(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Jc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Lc(a){return Jc(a,function(a){return a>0})}function Mc(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(rd(a,f))),a[g].x&&(e=e.concat(rd(a,g))),ud(e,b)):sd(a,b,f,g)}function td(a,b){var c;return c=a.map(function(a){return sd(a.values,b)}),ud(c,b)}function ud(a,b){var c,d;return a.forEach(function(a){var e=ie(a,b);(c>e||!c)&&(c=e,d=a)}),d}function vd(a,b){return df.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function wd(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 xd(){return ig&&"desc"===ig.toLowerCase()}function yd(){return ig&&"asc"===ig.toLowerCase()}function zd(a){var b=yd(),c=xd();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 ig&&a.sort(ig),a}function Ad(a,c){var d,e,f,g,h,i,j,k=Rd(ef.data.targets),l=k?ld:kd,m=a.filter(function(a){return a&&b(a.value)});Hh&&0!==m.length&&(Ai.html(Kh(a,$(),l,ai)).style("display","block"),d=Ai.property("offsetWidth"),e=Ai.property("offsetHeight"),k?(g=vf/2+c[0],i=xf/2+c[1]+20):(Eg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Qf(m[0].x)+20):(f=q(),g=f+t()+Qf(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Ai.style("top",i+"px").style("left",g+"px"))}function Bd(){Ai.style("display","none")}function Cd(a){var c=a.filter(function(a){return a&&b(a.value)});Hh&&(Od(ef.data.targets)||Rd(ef.data.targets)||xi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Eg?"y1":"x1",nd).attr(Eg?"y2":"x2",nd))}function Dd(){xi.select("line."+f.xgridFocus).style("visibility","hidden")}function Ed(a){return a.x||0===a.x?Qf(a.x):null}function Fd(a){return V(a.id)(a.value)}function Gd(){var a,b,d={},e=0;return Bc(yc(Ud)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Kd(a,b){return th?th:b?2*a.tickOffset()*uh/b:0}function Ld(a,b){wc(a).forEach(function(a){Ei[a]=b===gg[a],gg[a]=b})}function Md(a,b){var c=!1;return a.forEach(function(a){gg[a.id]===b&&(c=!0),a.id in gg||"line"!==b||(c=!0)}),c}function Nd(a){return Md(a,"bar")}function Od(a){return Md(a,"scatter")}function Pd(a){return Md(a,"pie")}function Qd(a){return Md(a,"donut")}function Rd(a){return Pd(a)||Qd(a)}function Sd(a){var b="string"==typeof a?a:a.id;return!(b in gg)||"line"===gg[b]||"spline"===gg[b]||"area"===gg[b]||"area-spline"===gg[b]}function Td(a){var b="string"==typeof a?a:a.id;return"spline"===gg[b]||"area-spline"===gg[b]}function Ud(a){var b="string"==typeof a?a:a.id;return"bar"===gg[b]}function Vd(a){var b="string"==typeof a?a:a.id;return"scatter"===gg[b]}function Wd(a){var b="string"==typeof a?a:a.id;return"pie"===gg[b]}function Xd(a){var b="string"==typeof a?a:a.id;return"donut"===gg[b]}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){return Ud(a)?a.values:[]}function $d(a){return Sd(a)||Vd(a)?a.values:[]}function _d(a){return Ud(a)||Sd(a)?a.values:[]}function ae(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function be(b){var c;if(!b)throw Error(b+" can not be parsed as d3.time with format "+ag+". Maybe 'x' of this data is not defined. See data.x or data.xs option.");try{c=ag?df.time.format(ag).parse(b):new Date(b)}catch(d){c=void 0}return c||a.console.error("Failed to parse x '"+b+"' to Date with format "+ag),c}function ce(a,b){var c=df.mouse(a),d=df.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function he(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ie(a,b){var c="y"===Z(a.id)?Rf:Sf,d=Eg?1:0,e=Eg?0:1;return Math.pow(Qf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function je(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function ke(a,b,c){tg(b,a.node()),xi.select("."+f.selectedCircles+_c(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Nc(f.selectedCircle,c)}).attr("cx",Eg?Fd:Ed).attr("cy",Eg?Ed:Fd).attr("stroke",function(){return ai(b)}).attr("r",1.4*sh).transition().duration(100).attr("r",sh)}function le(a,b,c){ug(b,a.node()),xi.select("."+f.selectedCircles+_c(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function me(a,b,c,d){a?ke(b,c,d):le(b,c,d)}function ne(a,b){tg(b,a.node()),a.transition().duration(100).style("fill",function(){return df.rgb(ai(b)).darker(1)})}function oe(a,b){ug(b,a.node()),a.transition().duration(100).style("fill",function(){return ai(b)})}function pe(a,b,c,d){a?ne(b,c,d):oe(b,c,d)}function qe(a){return a.filter(function(a){return b(a.value)})}function re(a,c){return(c?xi.selectAll("."+f.circles+_c(c)):xi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function se(a,b){re(a,b).classed(f.EXPANDED,!0).attr("r",rh)}function te(a){re(a).filter(function(){return df.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",oh)}function ue(a){return xi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function ve(a){ue(a).classed(f.EXPANDED,!0)}function we(a){ue(a).classed(f.EXPANDED,!1)}function xe(a,b){var c=Be(a,b);return function(a,b){var d=c(a,b),e=Eg?1:0,f=Eg?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 ye(a,b){var c=Be(a,!1),d=b?ze:Ae;return function(a,b){return d(c(a,b),a,this)}}function ze(a,b){var c;return Eg?(c=Ud(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ae(a,b,c){var d=c.getBBox();return Eg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:Ud(b)?-3:-6)}function Be(a,b){var c=a.__max__+1,d=Kd(Wf,c),e=Hd(d,c,a,!!b),f=Id(!!b),g=Jd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Eg&&(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 Ce(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 De(b){var c,d,e;if(Bi=df.select(gf),Bi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Bi.html(""),Bi.classed("c3",!0),ef.data.x={},ef.data.targets=pc(b),n(),R(),Qf.domain(df.extent(Zb(ef.data.targets))),Rf.domain(Ub(ef.data.targets,"y")),Sf.domain(Ub(ef.data.targets,"y2")),Tf.domain(Qf.domain()),Uf.domain(Rf.domain()),Vf.domain(Sf.domain()),Ci=Qf.domain(),qi.scale(Tf),mf&&ui.scale(Qf),vi=Bi.append("svg").attr("width",vf+sf.left+sf.right).attr("height",xf+sf.top+sf.bottom).on("mouseenter",pf).on("mouseleave",qf),wi=vi.append("defs"),wi.append("clipPath").attr("id",Oh).append("rect").attr("width",vf).attr("height",xf),wi.append("clipPath").attr("id",Ph).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),wi.append("clipPath").attr("id",Qh).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),xi=vi.append("g").attr("transform",ii.main),yi=xg?vi.append("g").attr("transform",ii.context):null,zi=vi.append("g").attr("transform",ii.legend),Ag||(zi.style("visibility","hidden"),di=vc(ef.data.targets)),Ai=df.select(gf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),$e(vc(ef.data.targets),{withTransform:!1,withTransitionForTransform:!1}),xi.append("g").attr("class",f.axisX).attr("clip-path",Eg?"":Sh).attr("transform",ii.x).append("text").attr("class",f.axisXLabel).attr("transform",Eg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),Rg&&xi.append("g").attr("class",f.axisY).attr("clip-path",Eg?Th:"").attr("transform",ii.y).append("text").attr("class",f.axisYLabel).attr("transform",Eg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),$g&&xi.append("g").attr("class",f.axisY2).attr("transform",ii.y2).append("text").attr("class",f.axisY2Label).attr("transform",Eg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=xi.append("g").attr("clip-path",Rh).attr("class",f.grid),hh&&d.append("g").attr("class",f.xgrids),ge(jh)&&d.append("g").attr("class",f.xgridLines),ph&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),kh&&d.append("g").attr("class",f.ygrids),ge(lh)&&d.append("g").attr("class",f.ygridLines),xi.append("g").attr("clip-path",Rh).attr("class",f.regions),xi.append("g").attr("clip-path",Rh).attr("class",f.chart),c=xi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",mf?Eg?"ns-resize":"ew-resize":null),xi.select("."+f.chart).append("g").attr("class",f.chartBars),xi.select("."+f.chart).append("g").attr("class",f.chartLines),xi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",ii.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),xi.select("."+f.chart).append("g").attr("class",f.chartTexts),mf&&xi.insert("rect",of?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",vf).attr("height",xf).style("opacity",0).style("cursor",Eg?"ns-resize":"ew-resize").call(ui).on("dblclick.zoom",null),Pg&&qi.extent("function"!=typeof Pg?Pg:Pg(Zb())),xg&&(yi.append("g").attr("clip-path",Rh).attr("class",f.chart),yi.select("."+f.chart).append("g").attr("class",f.chartBars),yi.select("."+f.chart).append("g").attr("class",f.chartLines),yi.append("g").attr("clip-path",Rh).attr("class",f.brush).call(qi).selectAll("rect").attr(Eg?"width":"height",Eg?wf:yf),yi.append("g").attr("class",f.axisX).attr("transform",ii.subx).attr("clip-path",Eg?"":Sh)),Qe(ef.data.targets),Eg?xi.select("."+f.axisX).style("opacity",0).call(Wf):(xi.select("."+f.axisY).style("opacity",0).call(Xf),xi.select("."+f.axisY2).style("opacity",0).call(Yf)),Ke({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Lh){if(Uh&&"string"==typeof Mh){for(Mh=be(Mh),e=0;e0){d=[];for(var g in cg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=wd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=pe,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 Ie(a){Rd(ef.data.targets)||mg&&(Xh=a,xi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Yh=!0,vg())}function Je(){Rd(ef.data.targets)||mg&&(xi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),xi.selectAll("."+f.shape).classed(f.INCLUDED,!1),Yh=!1,wg())}function Ke(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S=Gd(),T=Rd(ef.data.targets),U=Bc(ef.data.targets);if(0!==U.length){if(a=d(a)?a:{},x=d(a.withY)?a.withY:!0,y=d(a.withSubchart)?a.withSubchart:!0,z=d(a.withTransition)?a.withTransition:!0,D=d(a.withTransform)?a.withTransform:!1,E=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,F=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,G=d(a.withLegend)?a.withLegend:!1,A=d(a.withTransitionForExit)?a.withTransitionForExit:z,B=d(a.withTransitionForAxis)?a.withTransitionForAxis:z,C=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:z,M=z?rf:0,N=A?M:0,O=B?M:0,G&&Ag&&$e(vc(ef.data.targets),a),F&&(Qf.domain(df.extent(Zb(U))),Ci=Qf.domain(),mf&&ui.scale(Qf).updateScaleExtent(),Tf.domain(Qf.domain()),qi.scale(Tf)),E&&(Qf.domain(qi.empty()?Ci:qi.extent()),mf&&ui.scale(Qf).updateScaleExtent()),Rf.domain(Ub(U,"y")),Sf.domain(Ub(U,"y2")),Od(U)||(P=Dc(Cc(U)).sort(),Wf.tickValues(P),Zf.tickValues(P)),c=xi.select("."+f.axisX).style("opacity",T?0:1),(Eg||C)&&(c=c.transition().duration(O)),c.call(Wf),e=xi.select("."+f.axisY).style("opacity",T?0:1),(!Eg||C)&&(e=e.transition().duration(O)),e.call(Xf),xi.select("."+f.axisY2).style("opacity",T?0:1).transition().duration(O).call(Yf),E&&Jg&&P){for(Q=1;Q=Y;Y++)h.push(new Date(Y+"-01-01 00:00:00"))}else h=Qf.ticks(10);g=xi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Eg?0:function(a){return Qf(a)-Wf.tickOffset()}).attr("x2",Eg?vf:function(a){return Qf(a)-Wf.tickOffset()}).attr("y1",Eg?function(a){return Qf(a)-Wf.tickOffset()}:sf.top).attr("y2",Eg?function(a){return Qf(a)-Wf.tickOffset()}:xf).style("opacity",function(){return+df.select(this).attr(Eg?"y1":"x1")===(Eg?xf:0)?0:1}),g.exit().remove()}ge(jh)&&(i=xi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(jh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Eg?"":"rotate(-90)").attr("dx",Eg?0:-sf.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(M).attr("x1",Eg?0:od).attr("x2",Eg?vf:od).attr("y1",Eg?od:sf.top).attr("y2",Eg?od:xf).style("opacity",1),i.select("text").transition().duration(M).attr("x",Eg?vf:0).attr("y",od).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(M).style("opacity",0).remove()),x&&kh&&(k=xi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Rf.ticks(mh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Eg?Rf:0).attr("x2",Eg?Rf:vf).attr("y1",Eg?0:Rf).attr("y2",Eg?xf:Rf),k.exit().remove()),x&&ge(lh)&&(l=xi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(lh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Eg?"rotate(-90)":"").attr("dx",Eg?0:-sf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(M).attr("x1",Eg?pd:0).attr("x2",Eg?pd:vf).attr("y1",Eg?0:pd).attr("y2",Eg?xf:pd).style("opacity",1),l.select("text").transition().duration(M).attr("x",Eg?0:vf).attr("y",pd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(M).style("opacity",0).remove()),p=xi.selectAll("."+f.bars).selectAll("."+f.bar).data(Zd),p.enter().append("path").attr("d",H).style("stroke","none").style("opacity",0).style("fill",function(a){return ai(a)}).attr("class",Vc),p.style("opacity",ed).transition().duration(M).attr("d",H).style("opacity",1),p.exit().transition().duration(N).style("opacity",0).remove(),r=xi.selectAll("."+f.texts).selectAll("."+f.text).data(_d),r.enter().append("text").attr("class",Oc).attr("text-anchor",function(a){return Eg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return md(a.id)(a.value)}).style("fill-opacity",fd).transition().duration(M).attr("x",J).attr("y",K).style("fill-opacity",hd),r.exit().transition().duration(N).style("fill-opacity",0).remove(),xi.selectAll("."+f.line).style("opacity",ed).transition().duration(M).attr("d",ri).style("opacity",1),xi.selectAll("."+f.area).style("opacity",0).transition().duration(M).attr("d",si).style("opacity",Di),n=xi.selectAll("."+f.circles).selectAll("."+f.circle).data($d),n.enter().append("circle").attr("class",Tc).style("opacity",0).attr("r",oh),n.style("opacity",ed).transition().duration(M).style("opacity",gd).attr("cx",Eg?Fd:Ed).attr("cy",Eg?Ed:Fd),n.exit().remove(),xi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",D?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(M).attrTween("d",function(a){var b,c=Cb(a);return c?(b=df.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",D?"scale(1)":"").style("opacity",1),xi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(M).text(Jb).style("opacity",function(a){return zc(a.data.id)&&Yd(a.data)?1:0}),xi.select("."+f.chartArcsTitle).style("opacity",Qd(ef.data.targets)?1:0),xg&&(null!==df.event&&"zoom"===df.event.type&&qi.extent(Qf.orgDomain()).update(),y&&(yi.select("."+f.axisX).style("opacity",T?0:1).transition().duration(M).call(Zf),qi.empty()||qi.extent(Qf.orgDomain()).update(),I=xe(S,!0),s=yi.selectAll("."+f.bars).selectAll("."+f.bar).data(Zd),s.enter().append("path").attr("d",I).style("stroke","none").style("fill",function(a){return ai(a)}).attr("class",Vc),s.style("opacity",ed).transition().duration(M).attr("d",I).style("opacity",1),s.exit().transition().duration(M).style("opacity",0).remove(),yi.selectAll("."+f.line).style("opacity",ed).transition().duration(M).attr("d",ti).style("opacity",1))),xi.selectAll("."+f.selectedCircles).filter(function(a){return Ud(a)}).selectAll("circle").remove(),xi.selectAll("."+f.selectedCircle).transition().duration(M).attr("cx",Eg?Fd:Ed).attr("cy",Eg?Ed:Fd),ge(_f)?(t=xi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Fe(t.enter()),t.attr("x",0).attr("y",0).attr("width",vf).attr("height",xf)):(Wh&&!Vh?(w=function(a,b){var c=rc(b),d=sc(b),e=ef.data.x[a.id][b];return(Qf(d?d:e+50)-Qf(c?c:e-50))/2},v=function(a,b){var c=rc(b),d=ef.data.x[a.id][b];return(Qf(d)+Qf(c?c:d-50))/2}):(w=L(),v=function(a){return Qf(a.x)-w/2}),u=uc(),xi.select("."+f.eventRects).datum(u?u.values:[]),t=xi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ee(t.enter()),t.attr("class",$c).attr("x",Eg?0:v).attr("y",Eg?v:0).attr("width",Eg?vf:w).attr("height",Eg?w:xf),t.exit().remove()),q=xi.select("."+f.regions).selectAll("rect."+f.region).data(Gh),q.enter().append("rect").style("fill-opacity",0),q.attr("class",Zc).attr("x",Eg?0:cc).attr("y",Eg?cc:sf.top).attr("width",Eg?vf:dc).attr("height",Eg?dc:xf).transition().duration(M).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(M).style("fill-opacity",0).remove(),vc(ef.data.targets).forEach(function(a){Ei[a]=!0})}}function Le(){Ke({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Me(){return"mousemove"===df.event.sourceEvent.type&&ui.altDomain?(Qf.domain(ui.altDomain),void ui.scale(Qf).updateScaleExtent()):(Vh&&Qf.orgDomain()[0]===Ci[0]&&Qf.domain([Ci[0]-1e-10,Qf.orgDomain()[1]]),Ke({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===df.event.sourceEvent.type&&(Zh=!0)))}function Ne(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Oe(){vi.attr("width",zf).attr("height",Af),vi.select("#"+Oh).select("rect").attr("width",vf).attr("height",xf),vi.select("#"+Ph).select("rect").attr("width",H),vi.select("#"+Qh).select("rect").attr("width",J),vi.select("."+f.zoomRect).attr("width",vf).attr("height",xf)}function Pe(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Oe(),m(a.withTransition),Ke(a)}function Qe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=xi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a),j=i.enter().append("g").attr("class",function(a){return f.chartText+Nc(f.target,a.id)}).style("pointer-events","none"),j.append("g").attr("class",Pc).style("fill",function(a){return ai(a)}),e=xi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),d=e.enter().append("g").attr("class",function(a){return f.chartBar+Nc(f.target,a.id)}).style("pointer-events","none"),d.append("g").attr("class",Wc).style("fill",function(a){return ai(a)}).style("stroke","none").style("cursor",function(a){return og(a)?"pointer":null}),c=xi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),b=c.enter().append("g").attr("class",function(a){return f.chartLine+Nc(f.target,a.id)}).style("pointer-events","none"),b.append("path").attr("class",Sc).style("opacity",0).style("stroke",function(a){return ai(a)}),b.append("path").attr("class",Yc).style("opacity",function(){return Di=+df.select(this).style("opacity"),0}).style("fill",function(a){return ai(a)}),b.append("g").attr("class",function(a){return Nc(f.selectedCircles,a.id)}),b.append("g").attr("class",Uc).style("fill",function(a){return ai(a)}).style("cursor",function(a){return og(a)?"pointer":null}),a.forEach(function(a){xi.selectAll("."+f.selectedCircles+_c(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=xi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Hf(a)),g=h.enter().append("g").attr("class",function(a){return f.chartArc+Nc(f.target,a.data.id)}),g.append("path").attr("class",Xc).style("opacity",0).style("fill",function(a){return ai(a.data)}).style("cursor",function(a){return og(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),Ve(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Ad(c,df.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),Xe(),Bd(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),xg&&(n=yi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),m=n.enter().append("g").attr("class",function(a){return f.chartBar+Nc(f.target,a.id)}),m.append("g").attr("class",Wc).style("fill",function(a){return ai(a)}),l=yi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),k=l.enter().append("g").attr("class",function(a){return f.chartLine+Nc(f.target,a.id)}),k.append("path").attr("class",Sc).style("opacity",0).style("stroke",function(a){return ai(a)})),vi.selectAll("."+f.target).filter(function(a){return zc(a.id)}).transition().style("opacity",1)}function Re(a,b){ef.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBBox(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=ji?j:i,l=ji?Q():P();return d&&(w=0,C=0,t=0,u=0),Ag&&!Ac(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=ji?u:t,void(Dg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,ji?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=zi.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Nc(f.legendItem,a)}).style("visibility",function(a){return Ac(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Cg?Cg(a):ef.toggle(a)}).on("mouseover",function(a){ef.focus(a)}).on("mouseout",function(){ef.revert()}),l.append("text").text(function(a){return d(cg[a])?cg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",ji?g:-200).attr("y",ji?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",ji?h:-200).attr("y",ji?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return ai(a)}).attr("x",ji?g:-200).attr("y",ji?-200:i).attr("width",10).attr("height",10),zi.selectAll("text").data(a).text(function(a){return d(cg[a])?cg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),zi.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),zi.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Oe(),q&&m(p)}function _e(a){return xc(ef.data.targets,a.id)}function af(a){return"data"in a&&xc(ef.data.targets,a.data.id)}function bf(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 cf(a,b,c){var d=!Rd(ef.data.targets);Ld(a,b),Pe(c?c:{withTransitionForAxis:d})}var df=a.d3?a.d3:a.require?a.require("d3"):void 0,ef={data:{},axis:{},legend:{}},ff={},gf=h(["bindto"],"#chart"),hf=h(["size","width"]),jf=h(["size","height"]),kf=h(["padding","left"]),lf=h(["padding","right"]),mf=h(["zoom","enabled"],!1),nf=h(["zoom","extent"]),of=h(["zoom","privileged"],!1),pf=h(["onenter"],function(){}),qf=h(["onleave"],function(){}),rf=h(["transition","duration"],350);g("data","data is required in config");var 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,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f=h(["data","x"]),_f=h(["data","xs"],{}),ag=h(["data","x_format"]),bg=h(["data","id_converter"],function(a){return a}),cg=h(["data","names"],{}),dg=h(["data","groups"],[]),eg=h(["data","axes"],{}),fg=h(["data","type"]),gg=h(["data","types"],{}),hg=h(["data","labels"],{}),ig=h(["data","order"]),jg=h(["data","regions"],{}),kg=h(["data","color"]),lg=h(["data","colors"],{}),mg=h(["data","selection","enabled"],!1),ng=h(["data","selection","grouped"],!1),og=h(["data","selection","isselectable"],function(){return!0}),pg=h(["data","selection","multiple"],!0),qg=h(["data","onclick"],function(){}),rg=h(["data","onenter"],function(){}),sg=h(["data","onleave"],function(){}),tg=h(["data","onselected"],function(){}),ug=h(["data","onunselected"],function(){}),vg=h(["data","ondragstart"],function(){}),wg=h(["data","ondragend"],function(){}),xg=h(["subchart","show"],!1),yg=xg?h(["subchart","size","height"],60):0,zg=h(["color","pattern"],[]),Ag=h(["legend","show"],!0),Bg=h(["legend","position"],"bottom"),Cg=h(["legend","item","onclick"]),Dg=h(["legend","equally"],!1),Eg=h(["axis","rotated"],!1),Fg=h(["axis","x","type"],"indexed"),Gg=h(["axis","x","categories"],[]),Hg=h(["axis","x","tick","centered"],!1),Ig=h(["axis","x","tick","format"]),Jg=h(["axis","x","tick","culling"],{}),Kg=h(["axis","x","tick","culling","max"],"categorized"===Fg?1/0:10),Lg=h(["axis","x","tick","count"]),Mg=h(["axis","x","tick","fit"],!1),Ng=h(["axis","x","max"]),Og=h(["axis","x","min"]),Pg=h(["axis","x","default"]),Qg=h(["axis","x","label"],{}),Rg=h(["axis","y","show"],!0),Sg=h(["axis","y","max"]),Tg=h(["axis","y","min"]),Ug=h(["axis","y","center"]),Vg=h(["axis","y","label"],{}),Wg=h(["axis","y","inner"],!1),Xg=h(["axis","y","tick","format"]),Yg=h(["axis","y","padding"],{}),Zg=h(["axis","y","ticks"],10),$g=h(["axis","y2","show"],!1),_g=h(["axis","y2","max"]),ah=h(["axis","y2","min"]),bh=h(["axis","y2","center"]),ch=h(["axis","y2","label"],{}),dh=h(["axis","y2","inner"],!1),eh=h(["axis","y2","tick","format"]),fh=h(["axis","y2","padding"],{}),gh=h(["axis","y2","ticks"],10),hh=h(["grid","x","show"],!1),ih=h(["grid","x","type"],"tick"),jh=h(["grid","x","lines"],[]),kh=h(["grid","y","show"],!1),lh=h(["grid","y","lines"],[]),mh=h(["grid","y","ticks"],10),nh=h(["point","show"],!0),oh=nh?h(["point","r"],2.5):0,ph=h(["point","focus","line","enabled"],!0),qh=h(["point","focus","expand","enabled"],!0),rh=h(["point","focus","expand","r"],qh?4:oh),sh=h(["point","focus","select","r"],8),th=h(["bar","width"]),uh=h(["bar","width","ratio"],.6),vh=h(["pie","label","show"],!0),wh=h(["pie","label","format"]),xh=h(["pie","onclick"],function(){}),yh=h(["pie","onmouseover"],function(){}),zh=h(["pie","onmouseout"],function(){}),Ah=h(["donut","label","show"],!0),Bh=h(["donut","label","format"]),Ch=h(["donut","title"],""),Dh=h(["donut","onclick"],function(){}),Eh=h(["donut","onmouseover"],function(){}),Fh=h(["donut","onmouseout"],function(){}),Gh=h(["regions"],[]),Hh=h(["tooltip","show"],!0),Ih=h(["tooltip","format","title"]),Jh=h(["tooltip","format","value"]),Kh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Ih?Ih:b,l=Jh?Jh: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+""}),Lh=h(["tooltip","init","show"],!1),Mh=h(["tooltip","init","x"],0),Nh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Oh=("string"==typeof gf?gf.replace("#",""):gf.id)+"-clip",Ph=Oh+"-xaxis",Qh=Oh+"-yaxis",Rh=i(Oh),Sh=i(Sh),Th=i(Th),Uh="timeseries"===Fg,Vh="categorized"===Fg,Wh=!Uh&&($f||ge(_f)),Xh=null,Yh=!1,Zh=!1,$h=!1,_h=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ai=ae(lg,ge(zg)?zg:_h,kg),bi=function(){var a=[[df.time.format("%Y/%-m/%-d"),function(){return!0}],[df.time.format("%-m/%-d"),function(a){return a.getMonth()}],[df.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[df.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[df.time.format("%I %p"),function(a){return a.getHours()}],[df.time.format("%I:%M"),function(a){return a.getMinutes()}],[df.time.format(":%S"),function(a){return a.getSeconds()}],[df.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)}}(),ci=[],di=[],ei=Eg?"left":"bottom",fi=Eg?Wg?"top":"bottom":Wg?"right":"left",gi=Eg?dh?"bottom":"top":dh?"left":"right",hi=Eg?"left":"bottom",ii={main:function(){return"translate("+sf.left+","+sf.top+")"},context:function(){return"translate("+tf.left+","+tf.top+")"},legend:function(){return"translate("+uf.left+","+uf.top+")"},x:function(){return"translate(0,"+(Eg?0:xf)+")"},y:function(){return"translate(0,"+(Eg?xf:0)+")"},y2:function(){return"translate("+(Eg?0:vf)+","+(Eg?1:0)+")"},subx:function(){return"translate(0,"+(Eg?0:yf)+")"},arc:function(){return"translate("+vf/2+","+xf/2+")"}},ji="right"===Bg,ki=0,li=0,mi=0,ni=30,oi=30,pi=5;Hf=df.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var qi,ri=function(){var a=df.svg.line().x(Eg?function(a){return V(a.id)(a.value)}:nd).y(Eg?nd:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=qe(b.values);return Sd(b)?(a.interpolate(Td(b)?"cardinal":"linear"),jg[b.id]?Ce(e,Qf,V(b.id),jg[b.id]):a(e)):(c=Qf(e[0].x),d=V(b.id)(e[0].value),Eg?"M "+d+" "+c:"M "+c+" "+d)}}(),si=function(){var a;return a=Eg?df.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(nd):df.svg.area().x(nd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=qe(b.values);return Md([b],"area")||Md([b],"area-spline")?(a.interpolate(Td(b)?"cardinal":"linear"),a(e)):(c=Qf(e[0].x),d=V(b.id)(e[0].value),Eg?"M "+d+" "+c:"M "+c+" "+d)}}(),ti=function(){var a=df.svg.line().x(Eg?function(a){return W(a.id)(a.value)}:qd).y(Eg?qd:function(a){return W(a.id)(a.value)});return function(b){var c=qe(b.values);return Sd(b)?a(c):"M "+Tf(c[0].x)+" "+W(b.id)(c[0].value)}}(),ui=function(){};qi=df.svg.brush().on("brush",Le),qi.update=function(){return yi&&yi.select("."+f.brush).call(this),this},qi.scale=function(a){return Eg?this.y(a):this.x(a)},mf&&(ui=df.behavior.zoom().on("zoomstart",function(){ui.altDomain=df.event.sourceEvent.altKey?Qf.orgDomain():null}).on("zoom",mf?Me:null),ui.scale=function(a){return Eg?this.y(a):this.x(a)},ui.orgScaleExtent=function(){var a=nf?nf:[1,10];return[a[0],Math.max(tc()/a[1],a[1])]},ui.updateScaleExtent=function(){var a=$b(Qf.orgDomain())/$b(Ci),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var vi,wi,xi,yi,zi,Ai,Bi,Ci,Di,Ei={};if(ef.focus=function(a){function b(a){Bc(a).transition().duration(100).style("opacity",1)}var c=vi.selectAll(ad(a)),d=c.filter(_e),e=c.filter(af);ef.revert(),ef.defocus(),b(d.classed(f.focused,!0)),b(e),Rd(ef.data.targets)&&Kb(a,!0),Ve(a)},ef.defocus=function(a){function b(a){Bc(a).transition().duration(100).style("opacity",.3)}var c=vi.selectAll(ad(a)),d=c.filter(_e),e=c.filter(af);ef.revert(),b(d.classed(f.focused,!1)),b(e),Rd(ef.data.targets)&&Lb(a),We(a)},ef.revert=function(a){function b(a){Bc(a).transition().duration(100).style("opacity",1)}var c=vi.selectAll(ad(a)),d=c.filter(_e),e=c.filter(af);b(d.classed(f.focused,!1)),b(e),Rd(ef.data.targets)&&Lb(a),Xe()},ef.show=function(a,b){a=wc(a),b=b||{},Fc(a),vi.selectAll(bd(a)).transition().style("opacity",1),b.withLegend&&Ye(a),Ke({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},ef.hide=function(a,b){a=wc(a),b=b||{},Ec(a),vi.selectAll(bd(a)).transition().style("opacity",0),b.withLegend&&Ze(a),Ke({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},ef.toggle=function(a){zc(a)?ef.hide(a):ef.show(a)},ef.unzoom=function(){qi.clear().update(),Ke({withUpdateXDomain:!0})},ef.load=function(a){return a.xs&&ic(a.xs),"categories"in a&&Vh&&(Gg=a.categories,Wf.categories(Gg)),"cacheIds"in a&&_b(a.cacheIds)?void Re(bc(a.cacheIds),a.done):void("unload"in a?Te(wc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Se(a)}):Se(a))},ef.unload=function(a){Te(wc(a),function(){Ke({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},ef.selected=function(a){return df.merge(xi.selectAll("."+f.shapes+_c(a)).selectAll("."+f.shape).filter(function(){return df.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},ef.select=function(a,b,c){mg&&xi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=df.select(this),i="circle"===this.nodeName?ke:ne,j="circle"===this.nodeName?le:oe,k=ng||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?og(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},ef.unselect=function(a,b){mg&&xi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=df.select(this),g="circle"===this.nodeName?le:oe,h=ng||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&og(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},ef.toLine=function(a){cf(a,"line")},ef.toSpline=function(a){cf(a,"spline")},ef.toBar=function(a){cf(a,"bar")},ef.toScatter=function(a){cf(a,"scatter")},ef.toArea=function(a){cf(a,"area")},ef.toAreaSpline=function(a){cf(a,"area-spline")},ef.toPie=function(a){cf(a,"pie",{withTransform:!0})},ef.toDonut=function(a){cf(a,"donut",{withTransform:!0})},ef.groups=function(a){return c(a)?dg:(dg=a,Ke(),dg)},ef.xgrids=function(a){return a?(jh=a,Ke(),jh):jh},ef.xgrids.add=function(a){return a?ef.xgrids(jh.concat(a)):void 0},ef.xgrids.remove=function(a){var b=bf(a);return ef.xgrids(jh.filter(b))},ef.ygrids=function(a){return a?(lh=a,Ke(),lh):lh},ef.ygrids.add=function(a){return a?ef.ygrids(lh.concat(a)):void 0},ef.ygrids.remove=function(a){var b=bf(a);return ef.ygrids(lh.filter(b))},ef.regions=function(a){return c(a)?Gh:(Gh=a,Ke(),Gh)},ef.regions.add=function(a){return c(a)?Gh:(Gh=Gh.concat(a),Ke(),Gh)},ef.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;vi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Gh=Gh.filter(function(b){return b.classes.indexOf(a)<0})}),Gh},ef.data.get=function(a){var b=ef.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},ef.data.getAsTarget=function(a){var b=yc(function(b){return b.id===a});return b.length>0?b[0]:void 0},ef.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){cg[b]=a[b]}),$e(vc(ef.data.targets),{withTransition:!0}),cg):cg},ef.x=function(a){return arguments.length&&(kc(ef.data.targets,a),Ke({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),ef.data.x},ef.xs=function(a){return arguments.length&&(lc(ef.data.targets,a),Ke({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),ef.data.x},ef.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},ef.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Sg=+a.y),b(a.y2)&&(_g=+a.y2)):Sg=_g=+a,Ke())},ef.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Tg=+a.y),b(a.y2)&&(ah=+a.y2)):Tg=ah=+a,Ke()) -},ef.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&ef.axis.max(a.max),"undefined"!=typeof a.min&&ef.axis.min(a.min))},ef.legend.show=function(a){Ag||(Ag=!0,zi.style("visibility","visible")),Ye(wc(a)),Ke({withTransitionForHorizontalAxis:!1})},ef.legend.hide=function(a){Ag&&fe(a)&&(Ag=!1,zi.style("visibility","hidden")),Ze(wc(a)),Ke({withTransitionForHorizontalAxis:!1})},ef.resize=function(a){hf=a?a.width:null,jf=a?a.height:null,Pe({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},ef.destroy=function(){ef.data.targets=void 0,ef.data.x={},Bi.html(""),a.onresize=null},"url"in e.data)df.csv(e.data.url,function(a,b){De(b)});else if("rows"in e.data)De(nc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");De(oc(e.data.columns))}return ef},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file +}Ai.html(Kh(ef.data.targets.map(function(a){return jc(a.values[Mh])}),$(),kd,ai)),Ai.style("top",Nh.top).style("left",Nh.left).style("display","block")}null==a.onresize&&(a.onresize=Ne()),a.onresize.add&&a.onresize.add(function(){Pe({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})})}function Ee(a){a.append("rect").attr("class",$c).style("cursor",mg&&ng?"pointer":null).on("mouseover",function(a,b){if(!Yh&&!Rd(ef.data.targets)){var c,d,e=ef.data.targets.map(function(a){return jc(a.values[b])});if(Object.keys(cg).length>0){d=[];for(var g in cg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=wd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=pe,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 Ie(a){Rd(ef.data.targets)||mg&&(Xh=a,xi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Yh=!0,vg())}function Je(){Rd(ef.data.targets)||mg&&(xi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),xi.selectAll("."+f.shape).classed(f.INCLUDED,!1),Yh=!1,wg())}function Ke(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S=Gd(),T=Rd(ef.data.targets),U=Bc(ef.data.targets);if(0!==U.length){if(a=d(a)?a:{},x=d(a.withY)?a.withY:!0,y=d(a.withSubchart)?a.withSubchart:!0,z=d(a.withTransition)?a.withTransition:!0,D=d(a.withTransform)?a.withTransform:!1,E=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,F=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,G=d(a.withLegend)?a.withLegend:!1,A=d(a.withTransitionForExit)?a.withTransitionForExit:z,B=d(a.withTransitionForAxis)?a.withTransitionForAxis:z,C=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:z,M=z?rf:0,N=A?M:0,O=B?M:0,G&&Ag&&$e(vc(ef.data.targets),a),F&&(Qf.domain(df.extent(Zb(U))),Ci=Qf.domain(),mf&&ui.scale(Qf).updateScaleExtent(),Tf.domain(Qf.domain()),qi.scale(Tf)),E&&(Qf.domain(qi.empty()?Ci:qi.extent()),mf&&ui.scale(Qf).updateScaleExtent()),Rf.domain(Ub(U,"y")),Sf.domain(Ub(U,"y2")),Od(U)||(P=Dc(Cc(U)).sort(),Wf.tickValues(P),Zf.tickValues(P)),c=xi.select("."+f.axisX).style("opacity",T?0:1),(Eg||C)&&(c=c.transition().duration(O)),c.call(Wf),e=xi.select("."+f.axisY).style("opacity",T?0:1),(!Eg||C)&&(e=e.transition().duration(O)),e.call(Xf),xi.select("."+f.axisY2).style("opacity",T?0:1).transition().duration(O).call(Yf),E&&Jg&&P){for(Q=1;Q=Y;Y++)h.push(new Date(Y+"-01-01 00:00:00"))}else h=Qf.ticks(10);g=xi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Eg?0:function(a){return Qf(a)-Wf.tickOffset()}).attr("x2",Eg?vf:function(a){return Qf(a)-Wf.tickOffset()}).attr("y1",Eg?function(a){return Qf(a)-Wf.tickOffset()}:sf.top).attr("y2",Eg?function(a){return Qf(a)-Wf.tickOffset()}:xf).style("opacity",function(){return+df.select(this).attr(Eg?"y1":"x1")===(Eg?xf:0)?0:1}),g.exit().remove()}ge(jh)&&(i=xi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(jh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Eg?"":"rotate(-90)").attr("dx",Eg?0:-sf.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(M).attr("x1",Eg?0:od).attr("x2",Eg?vf:od).attr("y1",Eg?od:sf.top).attr("y2",Eg?od:xf).style("opacity",1),i.select("text").transition().duration(M).attr("x",Eg?vf:0).attr("y",od).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(M).style("opacity",0).remove()),x&&kh&&(k=xi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Rf.ticks(mh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Eg?Rf:0).attr("x2",Eg?Rf:vf).attr("y1",Eg?0:Rf).attr("y2",Eg?xf:Rf),k.exit().remove()),x&&ge(lh)&&(l=xi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(lh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Eg?"rotate(-90)":"").attr("dx",Eg?0:-sf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(M).attr("x1",Eg?pd:0).attr("x2",Eg?pd:vf).attr("y1",Eg?0:pd).attr("y2",Eg?xf:pd).style("opacity",1),l.select("text").transition().duration(M).attr("x",Eg?0:vf).attr("y",pd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(M).style("opacity",0).remove()),p=xi.selectAll("."+f.bars).selectAll("."+f.bar).data(Zd),p.enter().append("path").attr("d",H).style("stroke","none").style("opacity",0).style("fill",function(a){return ai(a)}).attr("class",Vc),p.style("opacity",ed).transition().duration(M).attr("d",H).style("opacity",1),p.exit().transition().duration(N).style("opacity",0).remove(),r=xi.selectAll("."+f.texts).selectAll("."+f.text).data(_d),r.enter().append("text").attr("class",Oc).attr("text-anchor",function(a){return Eg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return md(a.id)(a.value)}).style("fill-opacity",fd).transition().duration(M).attr("x",J).attr("y",K).style("fill-opacity",hd),r.exit().transition().duration(N).style("fill-opacity",0).remove(),xi.selectAll("."+f.line).style("opacity",ed).transition().duration(M).attr("d",ri).style("opacity",1),xi.selectAll("."+f.area).style("opacity",0).transition().duration(M).attr("d",si).style("opacity",Di),n=xi.selectAll("."+f.circles).selectAll("."+f.circle).data($d),n.enter().append("circle").attr("class",Tc).style("opacity",0).attr("r",oh),n.style("opacity",ed).transition().duration(M).style("opacity",gd).attr("cx",Eg?Fd:Ed).attr("cy",Eg?Ed:Fd),n.exit().remove(),xi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",D?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(M).attrTween("d",function(a){var b,c=Cb(a);return c?(b=df.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",D?"scale(1)":"").style("opacity",1),xi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(M).text(Jb).style("opacity",function(a){return zc(a.data.id)&&Yd(a.data)?1:0}),xi.select("."+f.chartArcsTitle).style("opacity",Qd(ef.data.targets)?1:0),xg&&(null!==df.event&&"zoom"===df.event.type&&qi.extent(Qf.orgDomain()).update(),y&&(yi.select("."+f.axisX).style("opacity",T?0:1).transition().duration(M).call(Zf),qi.empty()||qi.extent(Qf.orgDomain()).update(),I=xe(S,!0),s=yi.selectAll("."+f.bars).selectAll("."+f.bar).data(Zd),s.enter().append("path").attr("d",I).style("stroke","none").style("fill",function(a){return ai(a)}).attr("class",Vc),s.style("opacity",ed).transition().duration(M).attr("d",I).style("opacity",1),s.exit().transition().duration(M).style("opacity",0).remove(),yi.selectAll("."+f.line).style("opacity",ed).transition().duration(M).attr("d",ti).style("opacity",1))),xi.selectAll("."+f.selectedCircles).filter(function(a){return Ud(a)}).selectAll("circle").remove(),xi.selectAll("."+f.selectedCircle).transition().duration(M).attr("cx",Eg?Fd:Ed).attr("cy",Eg?Ed:Fd),ge(_f)?(t=xi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Fe(t.enter()),t.attr("x",0).attr("y",0).attr("width",vf).attr("height",xf)):(Wh&&!Vh?(w=function(a,b){var c=rc(b),d=sc(b),e=ef.data.x[a.id][b];return(Qf(d?d:e+50)-Qf(c?c:e-50))/2},v=function(a,b){var c=rc(b),d=ef.data.x[a.id][b];return(Qf(d)+Qf(c?c:d-50))/2}):(w=L(),v=function(a){return Qf(a.x)-w/2}),u=uc(),xi.select("."+f.eventRects).datum(u?u.values:[]),t=xi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ee(t.enter()),t.attr("class",$c).attr("x",Eg?0:v).attr("y",Eg?v:0).attr("width",Eg?vf:w).attr("height",Eg?w:xf),t.exit().remove()),q=xi.select("."+f.regions).selectAll("rect."+f.region).data(Gh),q.enter().append("rect").style("fill-opacity",0),q.attr("class",Zc).attr("x",Eg?0:cc).attr("y",Eg?cc:sf.top).attr("width",Eg?vf:dc).attr("height",Eg?dc:xf).transition().duration(M).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(M).style("fill-opacity",0).remove(),vc(ef.data.targets).forEach(function(a){Ei[a]=!0})}}function Le(){Ke({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Me(){return"mousemove"===df.event.sourceEvent.type&&ui.altDomain?(Qf.domain(ui.altDomain),void ui.scale(Qf).updateScaleExtent()):(Vh&&Qf.orgDomain()[0]===Ci[0]&&Qf.domain([Ci[0]-1e-10,Qf.orgDomain()[1]]),Ke({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===df.event.sourceEvent.type&&(Zh=!0)))}function Ne(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Oe(){vi.attr("width",zf).attr("height",Af),vi.select("#"+Oh).select("rect").attr("width",vf).attr("height",xf),vi.select("#"+Ph).select("rect").attr("width",H),vi.select("#"+Qh).select("rect").attr("width",J),vi.select("."+f.zoomRect).attr("width",vf).attr("height",xf)}function Pe(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Oe(),m(a.withTransition),Ke(a)}function Qe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=xi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a),j=i.enter().append("g").attr("class",function(a){return f.chartText+Nc(f.target,a.id)}).style("pointer-events","none"),j.append("g").attr("class",Pc).style("fill",function(a){return ai(a)}),e=xi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),d=e.enter().append("g").attr("class",function(a){return f.chartBar+Nc(f.target,a.id)}).style("pointer-events","none"),d.append("g").attr("class",Wc).style("fill",function(a){return ai(a)}).style("stroke","none").style("cursor",function(a){return og(a)?"pointer":null}),c=xi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),b=c.enter().append("g").attr("class",function(a){return f.chartLine+Nc(f.target,a.id)}).style("pointer-events","none"),b.append("path").attr("class",Sc).style("opacity",0).style("stroke",function(a){return ai(a)}),b.append("path").attr("class",Yc).style("opacity",function(){return Di=+df.select(this).style("opacity"),0}).style("fill",function(a){return ai(a)}),b.append("g").attr("class",function(a){return Nc(f.selectedCircles,a.id)}),b.append("g").attr("class",Uc).style("fill",function(a){return ai(a)}).style("cursor",function(a){return og(a)?"pointer":null}),a.forEach(function(a){xi.selectAll("."+f.selectedCircles+_c(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=xi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Hf(a)),g=h.enter().append("g").attr("class",function(a){return f.chartArc+Nc(f.target,a.data.id)}),g.append("path").attr("class",Xc).style("opacity",0).style("fill",function(a){return ai(a.data)}).style("cursor",function(a){return og(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),Ve(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Ad(c,df.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),Xe(),Bd(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),xg&&(n=yi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),m=n.enter().append("g").attr("class",function(a){return f.chartBar+Nc(f.target,a.id)}),m.append("g").attr("class",Wc).style("fill",function(a){return ai(a)}),l=yi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),k=l.enter().append("g").attr("class",function(a){return f.chartLine+Nc(f.target,a.id)}),k.append("path").attr("class",Sc).style("opacity",0).style("stroke",function(a){return ai(a)})),vi.selectAll("."+f.target).filter(function(a){return zc(a.id)}).transition().style("opacity",1)}function Re(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Ld(a.id,b.types[a.id]):Ld(a.id,b.type)}),ef.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBBox(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=ji?j:i,l=ji?Q():P();return d&&(w=0,C=0,t=0,u=0),Ag&&!Ac(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=ji?u:t,void(Dg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,ji?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=zi.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Nc(f.legendItem,a)}).style("visibility",function(a){return Ac(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Cg?Cg(a):ef.toggle(a)}).on("mouseover",function(a){ef.focus(a)}).on("mouseout",function(){ef.revert()}),l.append("text").text(function(a){return d(cg[a])?cg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",ji?g:-200).attr("y",ji?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",ji?h:-200).attr("y",ji?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return ai(a)}).attr("x",ji?g:-200).attr("y",ji?-200:i).attr("width",10).attr("height",10),zi.selectAll("text").data(a).text(function(a){return d(cg[a])?cg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),zi.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),zi.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Oe(),q&&m(p)}function _e(a){return xc(ef.data.targets,a.id)}function af(a){return"data"in a&&xc(ef.data.targets,a.data.id)}function bf(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 cf(a,b,c){var d=!Rd(ef.data.targets);Ld(a,b),Pe(c?c:{withTransitionForAxis:d})}var df=a.d3?a.d3:a.require?a.require("d3"):void 0,ef={data:{},axis:{},legend:{}},ff={},gf=h(["bindto"],"#chart"),hf=h(["size","width"]),jf=h(["size","height"]),kf=h(["padding","left"]),lf=h(["padding","right"]),mf=h(["zoom","enabled"],!1),nf=h(["zoom","extent"]),of=h(["zoom","privileged"],!1),pf=h(["onenter"],function(){}),qf=h(["onleave"],function(){}),rf=h(["transition","duration"],350);g("data","data is required in config");var 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,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f=h(["data","x"]),_f=h(["data","xs"],{}),ag=h(["data","x_format"]),bg=h(["data","id_converter"],function(a){return a}),cg=h(["data","names"],{}),dg=h(["data","groups"],[]),eg=h(["data","axes"],{}),fg=h(["data","type"]),gg=h(["data","types"],{}),hg=h(["data","labels"],{}),ig=h(["data","order"]),jg=h(["data","regions"],{}),kg=h(["data","color"]),lg=h(["data","colors"],{}),mg=h(["data","selection","enabled"],!1),ng=h(["data","selection","grouped"],!1),og=h(["data","selection","isselectable"],function(){return!0}),pg=h(["data","selection","multiple"],!0),qg=h(["data","onclick"],function(){}),rg=h(["data","onenter"],function(){}),sg=h(["data","onleave"],function(){}),tg=h(["data","onselected"],function(){}),ug=h(["data","onunselected"],function(){}),vg=h(["data","ondragstart"],function(){}),wg=h(["data","ondragend"],function(){}),xg=h(["subchart","show"],!1),yg=xg?h(["subchart","size","height"],60):0,zg=h(["color","pattern"],[]),Ag=h(["legend","show"],!0),Bg=h(["legend","position"],"bottom"),Cg=h(["legend","item","onclick"]),Dg=h(["legend","equally"],!1),Eg=h(["axis","rotated"],!1),Fg=h(["axis","x","type"],"indexed"),Gg=h(["axis","x","categories"],[]),Hg=h(["axis","x","tick","centered"],!1),Ig=h(["axis","x","tick","format"]),Jg=h(["axis","x","tick","culling"],{}),Kg=h(["axis","x","tick","culling","max"],"categorized"===Fg?1/0:10),Lg=h(["axis","x","tick","count"]),Mg=h(["axis","x","tick","fit"],!1),Ng=h(["axis","x","max"]),Og=h(["axis","x","min"]),Pg=h(["axis","x","default"]),Qg=h(["axis","x","label"],{}),Rg=h(["axis","y","show"],!0),Sg=h(["axis","y","max"]),Tg=h(["axis","y","min"]),Ug=h(["axis","y","center"]),Vg=h(["axis","y","label"],{}),Wg=h(["axis","y","inner"],!1),Xg=h(["axis","y","tick","format"]),Yg=h(["axis","y","padding"],{}),Zg=h(["axis","y","ticks"],10),$g=h(["axis","y2","show"],!1),_g=h(["axis","y2","max"]),ah=h(["axis","y2","min"]),bh=h(["axis","y2","center"]),ch=h(["axis","y2","label"],{}),dh=h(["axis","y2","inner"],!1),eh=h(["axis","y2","tick","format"]),fh=h(["axis","y2","padding"],{}),gh=h(["axis","y2","ticks"],10),hh=h(["grid","x","show"],!1),ih=h(["grid","x","type"],"tick"),jh=h(["grid","x","lines"],[]),kh=h(["grid","y","show"],!1),lh=h(["grid","y","lines"],[]),mh=h(["grid","y","ticks"],10),nh=h(["point","show"],!0),oh=nh?h(["point","r"],2.5):0,ph=h(["point","focus","line","enabled"],!0),qh=h(["point","focus","expand","enabled"],!0),rh=h(["point","focus","expand","r"],qh?4:oh),sh=h(["point","focus","select","r"],8),th=h(["bar","width"]),uh=h(["bar","width","ratio"],.6),vh=h(["pie","label","show"],!0),wh=h(["pie","label","format"]),xh=h(["pie","onclick"],function(){}),yh=h(["pie","onmouseover"],function(){}),zh=h(["pie","onmouseout"],function(){}),Ah=h(["donut","label","show"],!0),Bh=h(["donut","label","format"]),Ch=h(["donut","title"],""),Dh=h(["donut","onclick"],function(){}),Eh=h(["donut","onmouseover"],function(){}),Fh=h(["donut","onmouseout"],function(){}),Gh=h(["regions"],[]),Hh=h(["tooltip","show"],!0),Ih=h(["tooltip","format","title"]),Jh=h(["tooltip","format","value"]),Kh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Ih?Ih:b,l=Jh?Jh: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+""}),Lh=h(["tooltip","init","show"],!1),Mh=h(["tooltip","init","x"],0),Nh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Oh=("string"==typeof gf?gf.replace("#",""):gf.id)+"-clip",Ph=Oh+"-xaxis",Qh=Oh+"-yaxis",Rh=i(Oh),Sh=i(Sh),Th=i(Th),Uh="timeseries"===Fg,Vh="categorized"===Fg,Wh=!Uh&&($f||ge(_f)),Xh=null,Yh=!1,Zh=!1,$h=!1,_h=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ai=ae(lg,ge(zg)?zg:_h,kg),bi=function(){var a=[[df.time.format("%Y/%-m/%-d"),function(){return!0}],[df.time.format("%-m/%-d"),function(a){return a.getMonth()}],[df.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[df.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[df.time.format("%I %p"),function(a){return a.getHours()}],[df.time.format("%I:%M"),function(a){return a.getMinutes()}],[df.time.format(":%S"),function(a){return a.getSeconds()}],[df.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)}}(),ci=[],di=[],ei=Eg?"left":"bottom",fi=Eg?Wg?"top":"bottom":Wg?"right":"left",gi=Eg?dh?"bottom":"top":dh?"left":"right",hi=Eg?"left":"bottom",ii={main:function(){return"translate("+sf.left+","+sf.top+")"},context:function(){return"translate("+tf.left+","+tf.top+")"},legend:function(){return"translate("+uf.left+","+uf.top+")"},x:function(){return"translate(0,"+(Eg?0:xf)+")"},y:function(){return"translate(0,"+(Eg?xf:0)+")"},y2:function(){return"translate("+(Eg?0:vf)+","+(Eg?1:0)+")"},subx:function(){return"translate(0,"+(Eg?0:yf)+")"},arc:function(){return"translate("+vf/2+","+xf/2+")"}},ji="right"===Bg,ki=0,li=0,mi=0,ni=30,oi=30,pi=5;Hf=df.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var qi,ri=function(){var a=df.svg.line().x(Eg?function(a){return V(a.id)(a.value)}:nd).y(Eg?nd:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=qe(b.values);return Sd(b)?(a.interpolate(Td(b)?"cardinal":"linear"),jg[b.id]?Ce(e,Qf,V(b.id),jg[b.id]):a(e)):(c=Qf(e[0].x),d=V(b.id)(e[0].value),Eg?"M "+d+" "+c:"M "+c+" "+d)}}(),si=function(){var a;return a=Eg?df.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(nd):df.svg.area().x(nd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=qe(b.values);return Md([b],"area")||Md([b],"area-spline")?(a.interpolate(Td(b)?"cardinal":"linear"),a(e)):(c=Qf(e[0].x),d=V(b.id)(e[0].value),Eg?"M "+d+" "+c:"M "+c+" "+d)}}(),ti=function(){var a=df.svg.line().x(Eg?function(a){return W(a.id)(a.value)}:qd).y(Eg?qd:function(a){return W(a.id)(a.value)});return function(b){var c=qe(b.values);return Sd(b)?a(c):"M "+Tf(c[0].x)+" "+W(b.id)(c[0].value)}}(),ui=function(){};qi=df.svg.brush().on("brush",Le),qi.update=function(){return yi&&yi.select("."+f.brush).call(this),this},qi.scale=function(a){return Eg?this.y(a):this.x(a)},mf&&(ui=df.behavior.zoom().on("zoomstart",function(){ui.altDomain=df.event.sourceEvent.altKey?Qf.orgDomain():null}).on("zoom",mf?Me:null),ui.scale=function(a){return Eg?this.y(a):this.x(a)},ui.orgScaleExtent=function(){var a=nf?nf:[1,10];return[a[0],Math.max(tc()/a[1],a[1])]},ui.updateScaleExtent=function(){var a=$b(Qf.orgDomain())/$b(Ci),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var vi,wi,xi,yi,zi,Ai,Bi,Ci,Di,Ei={};if(ef.focus=function(a){function b(a){Bc(a).transition().duration(100).style("opacity",1)}var c=vi.selectAll(ad(a)),d=c.filter(_e),e=c.filter(af);ef.revert(),ef.defocus(),b(d.classed(f.focused,!0)),b(e),Rd(ef.data.targets)&&Kb(a,!0),Ve(a)},ef.defocus=function(a){function b(a){Bc(a).transition().duration(100).style("opacity",.3)}var c=vi.selectAll(ad(a)),d=c.filter(_e),e=c.filter(af);ef.revert(),b(d.classed(f.focused,!1)),b(e),Rd(ef.data.targets)&&Lb(a),We(a)},ef.revert=function(a){function b(a){Bc(a).transition().duration(100).style("opacity",1)}var c=vi.selectAll(ad(a)),d=c.filter(_e),e=c.filter(af);b(d.classed(f.focused,!1)),b(e),Rd(ef.data.targets)&&Lb(a),Xe()},ef.show=function(a,b){a=wc(a),b=b||{},Fc(a),vi.selectAll(bd(a)).transition().style("opacity",1),b.withLegend&&Ye(a),Ke({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},ef.hide=function(a,b){a=wc(a),b=b||{},Ec(a),vi.selectAll(bd(a)).transition().style("opacity",0),b.withLegend&&Ze(a),Ke({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},ef.toggle=function(a){zc(a)?ef.hide(a):ef.show(a)},ef.unzoom=function(){qi.clear().update(),Ke({withUpdateXDomain:!0})},ef.load=function(a){return a.xs&&ic(a.xs),"categories"in a&&Vh&&(Gg=a.categories,Wf.categories(Gg)),"cacheIds"in a&&_b(a.cacheIds)?void Re(bc(a.cacheIds),a.done):void("unload"in a?Te(wc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Se(a)}):Se(a))},ef.unload=function(a){Te(wc(a),function(){Ke({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},ef.selected=function(a){return df.merge(xi.selectAll("."+f.shapes+_c(a)).selectAll("."+f.shape).filter(function(){return df.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},ef.select=function(a,b,c){mg&&xi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=df.select(this),i="circle"===this.nodeName?ke:ne,j="circle"===this.nodeName?le:oe,k=ng||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?og(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},ef.unselect=function(a,b){mg&&xi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=df.select(this),g="circle"===this.nodeName?le:oe,h=ng||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&og(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},ef.toLine=function(a){cf(a,"line")},ef.toSpline=function(a){cf(a,"spline")},ef.toBar=function(a){cf(a,"bar")},ef.toScatter=function(a){cf(a,"scatter")},ef.toArea=function(a){cf(a,"area")},ef.toAreaSpline=function(a){cf(a,"area-spline")},ef.toPie=function(a){cf(a,"pie",{withTransform:!0})},ef.toDonut=function(a){cf(a,"donut",{withTransform:!0})},ef.groups=function(a){return c(a)?dg:(dg=a,Ke(),dg)},ef.xgrids=function(a){return a?(jh=a,Ke(),jh):jh},ef.xgrids.add=function(a){return a?ef.xgrids(jh.concat(a)):void 0},ef.xgrids.remove=function(a){var b=bf(a);return ef.xgrids(jh.filter(b))},ef.ygrids=function(a){return a?(lh=a,Ke(),lh):lh},ef.ygrids.add=function(a){return a?ef.ygrids(lh.concat(a)):void 0},ef.ygrids.remove=function(a){var b=bf(a);return ef.ygrids(lh.filter(b))},ef.regions=function(a){return c(a)?Gh:(Gh=a,Ke(),Gh)},ef.regions.add=function(a){return c(a)?Gh:(Gh=Gh.concat(a),Ke(),Gh)},ef.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;vi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Gh=Gh.filter(function(b){return b.classes.indexOf(a)<0})}),Gh},ef.data.get=function(a){var b=ef.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},ef.data.getAsTarget=function(a){var b=yc(function(b){return b.id===a});return b.length>0?b[0]:void 0},ef.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){cg[b]=a[b]}),$e(vc(ef.data.targets),{withTransition:!0}),cg):cg},ef.x=function(a){return arguments.length&&(kc(ef.data.targets,a),Ke({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),ef.data.x},ef.xs=function(a){return arguments.length&&(lc(ef.data.targets,a),Ke({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),ef.data.x},ef.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},ef.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Sg=+a.y),b(a.y2)&&(_g=+a.y2)):Sg=_g=+a,Ke()) +},ef.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Tg=+a.y),b(a.y2)&&(ah=+a.y2)):Tg=ah=+a,Ke())},ef.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&ef.axis.max(a.max),"undefined"!=typeof a.min&&ef.axis.min(a.min))},ef.legend.show=function(a){Ag||(Ag=!0,zi.style("visibility","visible")),Ye(wc(a)),Ke({withTransitionForHorizontalAxis:!1})},ef.legend.hide=function(a){Ag&&fe(a)&&(Ag=!1,zi.style("visibility","hidden")),Ze(wc(a)),Ke({withTransitionForHorizontalAxis:!1})},ef.resize=function(a){hf=a?a.width:null,jf=a?a.height:null,Pe({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},ef.destroy=function(){ef.data.targets=void 0,ef.data.x={},Bi.html(""),a.onresize=null},"url"in e.data)df.csv(e.data.url,function(a,b){De(b)});else if("rows"in e.data)De(nc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");De(oc(e.data.columns))}return ef},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 069a6491c8c22947305c8797d708a43667d91956 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Mon, 7 Apr 2014 15:55:38 +0900 Subject: [PATCH 016/178] Fix bug for xy and timeseries load --- c3.js | 7 ++++++- c3.min.js | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/c3.js b/c3.js index ba07dd0..d087d1b 100644 --- a/c3.js +++ b/c3.js @@ -1338,11 +1338,16 @@ // save x for update data by load when custom x and c3.x API ids.forEach(function (id) { - var xKey = getXKey(id); + var xKey = getXKey(id), idsForX = Object.keys(c3.data.x); + if (isCustomX || isTimeSeries) { if (xs.indexOf(xKey) >= 0) { c3.data.x[id] = data.map(function (d) { return d[xKey]; }); } + // Use other id's x when same x (data.x option) specified. + else if (__data_x && idsForX.length > 0) { + c3.data.x[id] = c3.data.x[idsForX[0]]; + } // MEMO: if no x included, use same x of current will be used } else { c3.data.x[id] = data.map(function (d, i) { return i; }); diff --git a/c3.min.js b/c3.min.js index 6a61d73..6123789 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.28"},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;cvf&&(vf=0),0>xf&&(xf=0),tf={top:Eg?sf.top:Af-yg-(ji?0:a),right:0/0,bottom:20+(ji?0:a),left:Eg?ni:sf.left},wf=Eg?sf.left-ni-oi:vf,yf=Eg?xf:Af-tf.top-tf.bottom,0>wf&&(wf=0),0>yf&&(yf=0),uf={top:ji?0:Af-a,right:0/0,bottom:0,left:ji?zf-b:0},p(),ji&&Rd(ef.data.targets)&&(uf.left=vf/2+Cf)}function o(){xi.select("line."+f.xgridFocus).attr("x1",Eg?0:-10).attr("x2",Eg?vf:-10).attr("y1",Eg?-10:sf.top).attr("y2",Eg?-10:xf)}function p(){Cf=xf/2,Bf=.95*Cf,Df=Qd(ef.data.targets)?.6*Bf:0}function q(){var a=Eg?f.axisX:f.axisY,b=df.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=df.select(gf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return hf?hf:x()}function s(){var a=jf?jf:y();return a>0?a:320}function t(){return Rd(ef.data.targets)?0:kf?kf:Eg||!Rg||Wg?1:v("y")}function u(){var a=1;return Rd(ef.data.targets)?0:lf?lf:ji?P()+($g&&!Eg?v("y2"):a):$g?dh||Eg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||Rg?"y2"!==a||$g?(gb(a).isInner?30:40)+("y2"===a?-10:0):pi:Ag&&!ji?10:1}function x(){return+df.select(gf).style("width").replace("px","")}function y(){return+df.select(gf).style("height").replace("px","")}function z(a){return a?-5:-(sf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Eg)}function C(){return A(!Eg)}function D(){return z(Eg)}function E(){return A(Eg)}function F(a){return a?vf+2+4:sf.left+20}function G(a){return a?80:xf+2}function H(){return F(!Eg)}function I(){return G(!Eg)}function J(){return F(Eg)}function K(){return G(Eg)}function L(){var a=Eg?xf:vf,b=tc(),c=Vb()*(Nd(ef.data.targets)?(b-(Vh?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){ki=a}function N(a){li=a}function O(a){mi=a}function P(){return Ag?ji?li*(ki+1):zf:0}function Q(){return Ag?ji?Af:mi*(ki+1):0}function R(){var a,b=!Qf;If=Eg?1:0,Jf=Eg?xf:vf,Kf=Eg?0:xf,Lf=Eg?vf:1,Mf=If,Nf=Jf,Of=Eg?0:yf,Pf=Eg?wf:1,Qf=T(If,Jf,b?void 0:Qf.domain(),function(){return Wf.tickOffset()}),Rf=U(Kf,Lf),Sf=U(Kf,Lf),Tf=T(If,Jf,Ci,function(a){return a%1?0:Zf.tickOffset()}),Uf=U(Of,Pf),Vf=U(Of,Pf),a=$(),Wf=X(Qf,ei,a),Zf=X(Tf,hi,a),Xf=Y(Rf,fi,Xg,Zg),Yf=Y(Sf,gi,eh,gh),b||(qi.scale(Tf),mf&&ui.scale(Qf)),S()}function S(){Ef=Db(),Ff=Eb(),Gf=Eb(.98)}function T(a,b,e,f){var g=(Uh?df.time.scale():df.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),Vh){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return df.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?Sf:Rf}function W(a){return"y2"===Z(a)?Vf:Uf}function X(a,b,c){var d=(Vh?Bb():df.svg.axis()).scale(a).orient(b);return d.tickFormat(c),Vh?d.tickCentered(Hg):d.tickOffset=function(){var a=Eg?xf:vf;return a*Vb()/tc()/2},Vh&&d.categories(Gg),d}function Y(a,b,c,d){return df.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in eg?eg[a]:"y"}function $(){var a=Uh?bi:Vh?Mc:function(a){return 0>a?a.toFixed(0):a};return Ig&&("function"==typeof Ig?a=Ig:Uh&&(a=function(a){return df.time.format(Ig)(a)})),a}function _(a){var b;return"y"===a?b=Vg:"y2"===a?b=ch:"x"===a&&(b=Qg),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Vg=b:"y2"===a?ch=b:"x"===a&&(Qg=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Eg?"inner-top":"inner-right")}function eb(){return cb("y",Eg?"inner-right":"inner-top")}function fb(){return cb("y2",Eg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?vf/2:vf:b.isBottom?-xf:b.isMiddle?-xf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Eg,db())}function ob(){return kb(Eg,eb())}function pb(){return kb(Eg,fb())}function qb(){return lb(!Eg,db())}function rb(){return lb(Eg,eb())}function sb(){return lb(Eg,fb())}function tb(){var a=db();return Eg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Eg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Eg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Eg,db())}function xb(){return mb(Eg,eb())}function yb(){return mb(Eg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return df.selectAll("."+c+" .tick text").each(function(){var a=this.getBBox();bb?20:b}function Ab(){xi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),xi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),xi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Kc(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 df.min(Object.keys(i).map(function(a){return df.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=vc(a),i=Ic(a);if(dg.length>0)for(g=Lc(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 df.max(Object.keys(i).map(function(a){return df.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?ah:Tg,n="y2"===c?_g:Sg,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?bh:Ug,r=id()&&Eg;return 0===l.length?"y2"===c?Sf.domain():Rf.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=jd(o,p),j=$b(Rf.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Yg&&(f=b(Yg.top)?Yg.top:e,g=b(Yg.bottom)?Yg.bottom:e),"y2"===c&&fh&&(f=b(fh.top)?fh.top:e,g=b(fh.bottom)?fh.bottom:e),Nd(l)&&!Kc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Ci),c=$b(Qf.domain());return a||0===c?1:b/c}function Wb(a){return Og?Og:df.min(a,function(a){return df.min(a.values,function(a){return a.x})})}function Xb(a){return Ng?Ng:df.max(a,function(a){return df.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return Vh?d=0:Nd(a)?(c=tc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=Uh?new Date(c.getTime()-e):c-e,g=Uh?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return $f&&a===$f||ge(_f)&&he(_f,a)}function fc(a){return!ec(a)}function gc(a){return $f?$f:ge(_f)?_f[a]:null}function hc(a,b){return a in ef.data.x&&ef.data.x[a]&&ef.data.x[a][b]?ef.data.x[a][b]:b}function ic(a){Object.keys(a).forEach(function(b){_f[b]=a[b]})}function jc(a){var b;return a&&(b=cg[a.id],a.name=b?b:a.id),a}function kc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=mc(b[d],a.id,d)}),ef.data.x[a.id]=b})}function lc(a,b){a.forEach(function(a){b[a.id]&&kc([a],b[a.id])})}function mc(a,b,c){var d;return d=Uh?a?a instanceof Date?a:be(a):be(hc(b,c)):Wh&&!Vh?a?+a:hc(b,c):c}function nc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0&&(ef.data.x[b]=a.map(function(a){return a[c]})):ef.data.x[b]=a.map(function(a,b){return b})}),c.forEach(function(a){if(!ef.data.x[a])throw new Error('x is not defined for id = "'+a+'".')}),b=c.map(function(b,c){var d=bg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=mc(g,b,e);return Wh&&Vh&&0===c&&g&&(0===e&&(Gg=[]),Gg.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++})}),fg&&Ld(vc(b).filter(function(a){return!(a in gg)}),fg),b.forEach(function(a){ac(a.id_org,a)}),b}function qc(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 rc(a){return a>0&&ef.data.targets[0].values[a-1]?ef.data.targets[0].values[a-1].x:void 0}function sc(a){return a1?ef.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?ef.data.targets[0]:null,a}function vc(a){return a.map(function(a){return a.id})}function wc(a){return a?"string"==typeof a?[a]:a:vc(ef.data.targets)}function xc(a,b){var c,d=vc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(Uh?new Date(h):h);i.push(d)}return i}function Ec(a){ci=ci.concat(a)}function Fc(a){ci=ci.filter(function(b){return a.indexOf(b)<0})}function Gc(a){di=di.concat(a)}function Hc(a){di=di.filter(function(b){return a.indexOf(b)<0})}function Ic(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Jc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Lc(a){return Jc(a,function(a){return a>0})}function Mc(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(rd(a,f))),a[g].x&&(e=e.concat(rd(a,g))),ud(e,b)):sd(a,b,f,g)}function td(a,b){var c;return c=a.map(function(a){return sd(a.values,b)}),ud(c,b)}function ud(a,b){var c,d;return a.forEach(function(a){var e=ie(a,b);(c>e||!c)&&(c=e,d=a)}),d}function vd(a,b){return df.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function wd(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 xd(){return ig&&"desc"===ig.toLowerCase()}function yd(){return ig&&"asc"===ig.toLowerCase()}function zd(a){var b=yd(),c=xd();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 ig&&a.sort(ig),a}function Ad(a,c){var d,e,f,g,h,i,j,k=Rd(ef.data.targets),l=k?ld:kd,m=a.filter(function(a){return a&&b(a.value)});Hh&&0!==m.length&&(Ai.html(Kh(a,$(),l,ai)).style("display","block"),d=Ai.property("offsetWidth"),e=Ai.property("offsetHeight"),k?(g=vf/2+c[0],i=xf/2+c[1]+20):(Eg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Qf(m[0].x)+20):(f=q(),g=f+t()+Qf(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Ai.style("top",i+"px").style("left",g+"px"))}function Bd(){Ai.style("display","none")}function Cd(a){var c=a.filter(function(a){return a&&b(a.value)});Hh&&(Od(ef.data.targets)||Rd(ef.data.targets)||xi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Eg?"y1":"x1",nd).attr(Eg?"y2":"x2",nd))}function Dd(){xi.select("line."+f.xgridFocus).style("visibility","hidden")}function Ed(a){return a.x||0===a.x?Qf(a.x):null}function Fd(a){return V(a.id)(a.value)}function Gd(){var a,b,d={},e=0;return Bc(yc(Ud)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Kd(a,b){return th?th:b?2*a.tickOffset()*uh/b:0}function Ld(a,b){wc(a).forEach(function(a){Ei[a]=b===gg[a],gg[a]=b})}function Md(a,b){var c=!1;return a.forEach(function(a){gg[a.id]===b&&(c=!0),a.id in gg||"line"!==b||(c=!0)}),c}function Nd(a){return Md(a,"bar")}function Od(a){return Md(a,"scatter")}function Pd(a){return Md(a,"pie")}function Qd(a){return Md(a,"donut")}function Rd(a){return Pd(a)||Qd(a)}function Sd(a){var b="string"==typeof a?a:a.id;return!(b in gg)||"line"===gg[b]||"spline"===gg[b]||"area"===gg[b]||"area-spline"===gg[b]}function Td(a){var b="string"==typeof a?a:a.id;return"spline"===gg[b]||"area-spline"===gg[b]}function Ud(a){var b="string"==typeof a?a:a.id;return"bar"===gg[b]}function Vd(a){var b="string"==typeof a?a:a.id;return"scatter"===gg[b]}function Wd(a){var b="string"==typeof a?a:a.id;return"pie"===gg[b]}function Xd(a){var b="string"==typeof a?a:a.id;return"donut"===gg[b]}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){return Ud(a)?a.values:[]}function $d(a){return Sd(a)||Vd(a)?a.values:[]}function _d(a){return Ud(a)||Sd(a)?a.values:[]}function ae(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function be(b){var c;if(!b)throw Error(b+" can not be parsed as d3.time with format "+ag+". Maybe 'x' of this data is not defined. See data.x or data.xs option.");try{c=ag?df.time.format(ag).parse(b):new Date(b)}catch(d){c=void 0}return c||a.console.error("Failed to parse x '"+b+"' to Date with format "+ag),c}function ce(a,b){var c=df.mouse(a),d=df.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function he(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ie(a,b){var c="y"===Z(a.id)?Rf:Sf,d=Eg?1:0,e=Eg?0:1;return Math.pow(Qf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function je(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function ke(a,b,c){tg(b,a.node()),xi.select("."+f.selectedCircles+_c(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Nc(f.selectedCircle,c)}).attr("cx",Eg?Fd:Ed).attr("cy",Eg?Ed:Fd).attr("stroke",function(){return ai(b)}).attr("r",1.4*sh).transition().duration(100).attr("r",sh)}function le(a,b,c){ug(b,a.node()),xi.select("."+f.selectedCircles+_c(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function me(a,b,c,d){a?ke(b,c,d):le(b,c,d)}function ne(a,b){tg(b,a.node()),a.transition().duration(100).style("fill",function(){return df.rgb(ai(b)).darker(1)})}function oe(a,b){ug(b,a.node()),a.transition().duration(100).style("fill",function(){return ai(b)})}function pe(a,b,c,d){a?ne(b,c,d):oe(b,c,d)}function qe(a){return a.filter(function(a){return b(a.value)})}function re(a,c){return(c?xi.selectAll("."+f.circles+_c(c)):xi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function se(a,b){re(a,b).classed(f.EXPANDED,!0).attr("r",rh)}function te(a){re(a).filter(function(){return df.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",oh)}function ue(a){return xi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function ve(a){ue(a).classed(f.EXPANDED,!0)}function we(a){ue(a).classed(f.EXPANDED,!1)}function xe(a,b){var c=Be(a,b);return function(a,b){var d=c(a,b),e=Eg?1:0,f=Eg?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 ye(a,b){var c=Be(a,!1),d=b?ze:Ae;return function(a,b){return d(c(a,b),a,this)}}function ze(a,b){var c;return Eg?(c=Ud(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ae(a,b,c){var d=c.getBBox();return Eg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:Ud(b)?-3:-6)}function Be(a,b){var c=a.__max__+1,d=Kd(Wf,c),e=Hd(d,c,a,!!b),f=Id(!!b),g=Jd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Eg&&(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 Ce(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 De(b){var c,d,e;if(Bi=df.select(gf),Bi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Bi.html(""),Bi.classed("c3",!0),ef.data.x={},ef.data.targets=pc(b),n(),R(),Qf.domain(df.extent(Zb(ef.data.targets))),Rf.domain(Ub(ef.data.targets,"y")),Sf.domain(Ub(ef.data.targets,"y2")),Tf.domain(Qf.domain()),Uf.domain(Rf.domain()),Vf.domain(Sf.domain()),Ci=Qf.domain(),qi.scale(Tf),mf&&ui.scale(Qf),vi=Bi.append("svg").attr("width",vf+sf.left+sf.right).attr("height",xf+sf.top+sf.bottom).on("mouseenter",pf).on("mouseleave",qf),wi=vi.append("defs"),wi.append("clipPath").attr("id",Oh).append("rect").attr("width",vf).attr("height",xf),wi.append("clipPath").attr("id",Ph).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),wi.append("clipPath").attr("id",Qh).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),xi=vi.append("g").attr("transform",ii.main),yi=xg?vi.append("g").attr("transform",ii.context):null,zi=vi.append("g").attr("transform",ii.legend),Ag||(zi.style("visibility","hidden"),di=vc(ef.data.targets)),Ai=df.select(gf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),$e(vc(ef.data.targets),{withTransform:!1,withTransitionForTransform:!1}),xi.append("g").attr("class",f.axisX).attr("clip-path",Eg?"":Sh).attr("transform",ii.x).append("text").attr("class",f.axisXLabel).attr("transform",Eg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),Rg&&xi.append("g").attr("class",f.axisY).attr("clip-path",Eg?Th:"").attr("transform",ii.y).append("text").attr("class",f.axisYLabel).attr("transform",Eg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),$g&&xi.append("g").attr("class",f.axisY2).attr("transform",ii.y2).append("text").attr("class",f.axisY2Label).attr("transform",Eg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=xi.append("g").attr("clip-path",Rh).attr("class",f.grid),hh&&d.append("g").attr("class",f.xgrids),ge(jh)&&d.append("g").attr("class",f.xgridLines),ph&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),kh&&d.append("g").attr("class",f.ygrids),ge(lh)&&d.append("g").attr("class",f.ygridLines),xi.append("g").attr("clip-path",Rh).attr("class",f.regions),xi.append("g").attr("clip-path",Rh).attr("class",f.chart),c=xi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",mf?Eg?"ns-resize":"ew-resize":null),xi.select("."+f.chart).append("g").attr("class",f.chartBars),xi.select("."+f.chart).append("g").attr("class",f.chartLines),xi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",ii.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),xi.select("."+f.chart).append("g").attr("class",f.chartTexts),mf&&xi.insert("rect",of?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",vf).attr("height",xf).style("opacity",0).style("cursor",Eg?"ns-resize":"ew-resize").call(ui).on("dblclick.zoom",null),Pg&&qi.extent("function"!=typeof Pg?Pg:Pg(Zb())),xg&&(yi.append("g").attr("clip-path",Rh).attr("class",f.chart),yi.select("."+f.chart).append("g").attr("class",f.chartBars),yi.select("."+f.chart).append("g").attr("class",f.chartLines),yi.append("g").attr("clip-path",Rh).attr("class",f.brush).call(qi).selectAll("rect").attr(Eg?"width":"height",Eg?wf:yf),yi.append("g").attr("class",f.axisX).attr("transform",ii.subx).attr("clip-path",Eg?"":Sh)),Qe(ef.data.targets),Eg?xi.select("."+f.axisX).style("opacity",0).call(Wf):(xi.select("."+f.axisY).style("opacity",0).call(Xf),xi.select("."+f.axisY2).style("opacity",0).call(Yf)),Ke({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Lh){if(Uh&&"string"==typeof Mh){for(Mh=be(Mh),e=0;evf&&(vf=0),0>xf&&(xf=0),tf={top:Eg?sf.top:Af-yg-(ji?0:a),right:0/0,bottom:20+(ji?0:a),left:Eg?ni:sf.left},wf=Eg?sf.left-ni-oi:vf,yf=Eg?xf:Af-tf.top-tf.bottom,0>wf&&(wf=0),0>yf&&(yf=0),uf={top:ji?0:Af-a,right:0/0,bottom:0,left:ji?zf-b:0},p(),ji&&Rd(ef.data.targets)&&(uf.left=vf/2+Cf)}function o(){xi.select("line."+f.xgridFocus).attr("x1",Eg?0:-10).attr("x2",Eg?vf:-10).attr("y1",Eg?-10:sf.top).attr("y2",Eg?-10:xf)}function p(){Cf=xf/2,Bf=.95*Cf,Df=Qd(ef.data.targets)?.6*Bf:0}function q(){var a=Eg?f.axisX:f.axisY,b=df.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=df.select(gf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return hf?hf:x()}function s(){var a=jf?jf:y();return a>0?a:320}function t(){return Rd(ef.data.targets)?0:kf?kf:Eg||!Rg||Wg?1:v("y")}function u(){var a=1;return Rd(ef.data.targets)?0:lf?lf:ji?P()+($g&&!Eg?v("y2"):a):$g?dh||Eg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||Rg?"y2"!==a||$g?(gb(a).isInner?30:40)+("y2"===a?-10:0):pi:Ag&&!ji?10:1}function x(){return+df.select(gf).style("width").replace("px","")}function y(){return+df.select(gf).style("height").replace("px","")}function z(a){return a?-5:-(sf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Eg)}function C(){return A(!Eg)}function D(){return z(Eg)}function E(){return A(Eg)}function F(a){return a?vf+2+4:sf.left+20}function G(a){return a?80:xf+2}function H(){return F(!Eg)}function I(){return G(!Eg)}function J(){return F(Eg)}function K(){return G(Eg)}function L(){var a=Eg?xf:vf,b=tc(),c=Vb()*(Nd(ef.data.targets)?(b-(Vh?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){ki=a}function N(a){li=a}function O(a){mi=a}function P(){return Ag?ji?li*(ki+1):zf:0}function Q(){return Ag?ji?Af:mi*(ki+1):0}function R(){var a,b=!Qf;If=Eg?1:0,Jf=Eg?xf:vf,Kf=Eg?0:xf,Lf=Eg?vf:1,Mf=If,Nf=Jf,Of=Eg?0:yf,Pf=Eg?wf:1,Qf=T(If,Jf,b?void 0:Qf.domain(),function(){return Wf.tickOffset()}),Rf=U(Kf,Lf),Sf=U(Kf,Lf),Tf=T(If,Jf,Ci,function(a){return a%1?0:Zf.tickOffset()}),Uf=U(Of,Pf),Vf=U(Of,Pf),a=$(),Wf=X(Qf,ei,a),Zf=X(Tf,hi,a),Xf=Y(Rf,fi,Xg,Zg),Yf=Y(Sf,gi,eh,gh),b||(qi.scale(Tf),mf&&ui.scale(Qf)),S()}function S(){Ef=Db(),Ff=Eb(),Gf=Eb(.98)}function T(a,b,e,f){var g=(Uh?df.time.scale():df.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),Vh){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return df.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?Sf:Rf}function W(a){return"y2"===Z(a)?Vf:Uf}function X(a,b,c){var d=(Vh?Bb():df.svg.axis()).scale(a).orient(b);return d.tickFormat(c),Vh?d.tickCentered(Hg):d.tickOffset=function(){var a=Eg?xf:vf;return a*Vb()/tc()/2},Vh&&d.categories(Gg),d}function Y(a,b,c,d){return df.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in eg?eg[a]:"y"}function $(){var a=Uh?bi:Vh?Mc:function(a){return 0>a?a.toFixed(0):a};return Ig&&("function"==typeof Ig?a=Ig:Uh&&(a=function(a){return df.time.format(Ig)(a)})),a}function _(a){var b;return"y"===a?b=Vg:"y2"===a?b=ch:"x"===a&&(b=Qg),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Vg=b:"y2"===a?ch=b:"x"===a&&(Qg=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Eg?"inner-top":"inner-right")}function eb(){return cb("y",Eg?"inner-right":"inner-top")}function fb(){return cb("y2",Eg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?vf/2:vf:b.isBottom?-xf:b.isMiddle?-xf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Eg,db())}function ob(){return kb(Eg,eb())}function pb(){return kb(Eg,fb())}function qb(){return lb(!Eg,db())}function rb(){return lb(Eg,eb())}function sb(){return lb(Eg,fb())}function tb(){var a=db();return Eg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Eg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Eg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Eg,db())}function xb(){return mb(Eg,eb())}function yb(){return mb(Eg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return df.selectAll("."+c+" .tick text").each(function(){var a=this.getBBox();bb?20:b}function Ab(){xi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),xi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),xi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Kc(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 df.min(Object.keys(i).map(function(a){return df.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=vc(a),i=Ic(a);if(dg.length>0)for(g=Lc(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 df.max(Object.keys(i).map(function(a){return df.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?ah:Tg,n="y2"===c?_g:Sg,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?bh:Ug,r=id()&&Eg;return 0===l.length?"y2"===c?Sf.domain():Rf.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=jd(o,p),j=$b(Rf.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Yg&&(f=b(Yg.top)?Yg.top:e,g=b(Yg.bottom)?Yg.bottom:e),"y2"===c&&fh&&(f=b(fh.top)?fh.top:e,g=b(fh.bottom)?fh.bottom:e),Nd(l)&&!Kc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Ci),c=$b(Qf.domain());return a||0===c?1:b/c}function Wb(a){return Og?Og:df.min(a,function(a){return df.min(a.values,function(a){return a.x})})}function Xb(a){return Ng?Ng:df.max(a,function(a){return df.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return Vh?d=0:Nd(a)?(c=tc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=Uh?new Date(c.getTime()-e):c-e,g=Uh?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return $f&&a===$f||ge(_f)&&he(_f,a)}function fc(a){return!ec(a)}function gc(a){return $f?$f:ge(_f)?_f[a]:null}function hc(a,b){return a in ef.data.x&&ef.data.x[a]&&ef.data.x[a][b]?ef.data.x[a][b]:b}function ic(a){Object.keys(a).forEach(function(b){_f[b]=a[b]})}function jc(a){var b;return a&&(b=cg[a.id],a.name=b?b:a.id),a}function kc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=mc(b[d],a.id,d)}),ef.data.x[a.id]=b})}function lc(a,b){a.forEach(function(a){b[a.id]&&kc([a],b[a.id])})}function mc(a,b,c){var d;return d=Uh?a?a instanceof Date?a:be(a):be(hc(b,c)):Wh&&!Vh?a?+a:hc(b,c):c}function nc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?ef.data.x[b]=a.map(function(a){return a[c]}):$f&&e.length>0&&(ef.data.x[b]=ef.data.x[e[0]]):ef.data.x[b]=a.map(function(a,b){return b})}),c.forEach(function(a){if(!ef.data.x[a])throw new Error('x is not defined for id = "'+a+'".')}),b=c.map(function(b,c){var d=bg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=mc(g,b,e);return Wh&&Vh&&0===c&&g&&(0===e&&(Gg=[]),Gg.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++})}),fg&&Ld(vc(b).filter(function(a){return!(a in gg)}),fg),b.forEach(function(a){ac(a.id_org,a)}),b}function qc(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 rc(a){return a>0&&ef.data.targets[0].values[a-1]?ef.data.targets[0].values[a-1].x:void 0}function sc(a){return a1?ef.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?ef.data.targets[0]:null,a}function vc(a){return a.map(function(a){return a.id})}function wc(a){return a?"string"==typeof a?[a]:a:vc(ef.data.targets)}function xc(a,b){var c,d=vc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(Uh?new Date(h):h);i.push(d)}return i}function Ec(a){ci=ci.concat(a)}function Fc(a){ci=ci.filter(function(b){return a.indexOf(b)<0})}function Gc(a){di=di.concat(a)}function Hc(a){di=di.filter(function(b){return a.indexOf(b)<0})}function Ic(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Jc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Lc(a){return Jc(a,function(a){return a>0})}function Mc(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(rd(a,f))),a[g].x&&(e=e.concat(rd(a,g))),ud(e,b)):sd(a,b,f,g)}function td(a,b){var c;return c=a.map(function(a){return sd(a.values,b)}),ud(c,b)}function ud(a,b){var c,d;return a.forEach(function(a){var e=ie(a,b);(c>e||!c)&&(c=e,d=a)}),d}function vd(a,b){return df.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function wd(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 xd(){return ig&&"desc"===ig.toLowerCase()}function yd(){return ig&&"asc"===ig.toLowerCase()}function zd(a){var b=yd(),c=xd();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 ig&&a.sort(ig),a}function Ad(a,c){var d,e,f,g,h,i,j,k=Rd(ef.data.targets),l=k?ld:kd,m=a.filter(function(a){return a&&b(a.value)});Hh&&0!==m.length&&(Ai.html(Kh(a,$(),l,ai)).style("display","block"),d=Ai.property("offsetWidth"),e=Ai.property("offsetHeight"),k?(g=vf/2+c[0],i=xf/2+c[1]+20):(Eg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Qf(m[0].x)+20):(f=q(),g=f+t()+Qf(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Ai.style("top",i+"px").style("left",g+"px"))}function Bd(){Ai.style("display","none")}function Cd(a){var c=a.filter(function(a){return a&&b(a.value)});Hh&&(Od(ef.data.targets)||Rd(ef.data.targets)||xi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Eg?"y1":"x1",nd).attr(Eg?"y2":"x2",nd))}function Dd(){xi.select("line."+f.xgridFocus).style("visibility","hidden")}function Ed(a){return a.x||0===a.x?Qf(a.x):null}function Fd(a){return V(a.id)(a.value)}function Gd(){var a,b,d={},e=0;return Bc(yc(Ud)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Kd(a,b){return th?th:b?2*a.tickOffset()*uh/b:0}function Ld(a,b){wc(a).forEach(function(a){Ei[a]=b===gg[a],gg[a]=b})}function Md(a,b){var c=!1;return a.forEach(function(a){gg[a.id]===b&&(c=!0),a.id in gg||"line"!==b||(c=!0)}),c}function Nd(a){return Md(a,"bar")}function Od(a){return Md(a,"scatter")}function Pd(a){return Md(a,"pie")}function Qd(a){return Md(a,"donut")}function Rd(a){return Pd(a)||Qd(a)}function Sd(a){var b="string"==typeof a?a:a.id;return!(b in gg)||"line"===gg[b]||"spline"===gg[b]||"area"===gg[b]||"area-spline"===gg[b]}function Td(a){var b="string"==typeof a?a:a.id;return"spline"===gg[b]||"area-spline"===gg[b]}function Ud(a){var b="string"==typeof a?a:a.id;return"bar"===gg[b]}function Vd(a){var b="string"==typeof a?a:a.id;return"scatter"===gg[b]}function Wd(a){var b="string"==typeof a?a:a.id;return"pie"===gg[b]}function Xd(a){var b="string"==typeof a?a:a.id;return"donut"===gg[b]}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){return Ud(a)?a.values:[]}function $d(a){return Sd(a)||Vd(a)?a.values:[]}function _d(a){return Ud(a)||Sd(a)?a.values:[]}function ae(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function be(b){var c;if(!b)throw Error(b+" can not be parsed as d3.time with format "+ag+". Maybe 'x' of this data is not defined. See data.x or data.xs option.");try{c=ag?df.time.format(ag).parse(b):new Date(b)}catch(d){c=void 0}return c||a.console.error("Failed to parse x '"+b+"' to Date with format "+ag),c}function ce(a,b){var c=df.mouse(a),d=df.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function he(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ie(a,b){var c="y"===Z(a.id)?Rf:Sf,d=Eg?1:0,e=Eg?0:1;return Math.pow(Qf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function je(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function ke(a,b,c){tg(b,a.node()),xi.select("."+f.selectedCircles+_c(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Nc(f.selectedCircle,c)}).attr("cx",Eg?Fd:Ed).attr("cy",Eg?Ed:Fd).attr("stroke",function(){return ai(b)}).attr("r",1.4*sh).transition().duration(100).attr("r",sh)}function le(a,b,c){ug(b,a.node()),xi.select("."+f.selectedCircles+_c(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function me(a,b,c,d){a?ke(b,c,d):le(b,c,d)}function ne(a,b){tg(b,a.node()),a.transition().duration(100).style("fill",function(){return df.rgb(ai(b)).darker(1)})}function oe(a,b){ug(b,a.node()),a.transition().duration(100).style("fill",function(){return ai(b)})}function pe(a,b,c,d){a?ne(b,c,d):oe(b,c,d)}function qe(a){return a.filter(function(a){return b(a.value)})}function re(a,c){return(c?xi.selectAll("."+f.circles+_c(c)):xi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function se(a,b){re(a,b).classed(f.EXPANDED,!0).attr("r",rh)}function te(a){re(a).filter(function(){return df.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",oh)}function ue(a){return xi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function ve(a){ue(a).classed(f.EXPANDED,!0)}function we(a){ue(a).classed(f.EXPANDED,!1)}function xe(a,b){var c=Be(a,b);return function(a,b){var d=c(a,b),e=Eg?1:0,f=Eg?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 ye(a,b){var c=Be(a,!1),d=b?ze:Ae;return function(a,b){return d(c(a,b),a,this)}}function ze(a,b){var c;return Eg?(c=Ud(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ae(a,b,c){var d=c.getBBox();return Eg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:Ud(b)?-3:-6)}function Be(a,b){var c=a.__max__+1,d=Kd(Wf,c),e=Hd(d,c,a,!!b),f=Id(!!b),g=Jd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Eg&&(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 Ce(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 De(b){var c,d,e;if(Bi=df.select(gf),Bi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Bi.html(""),Bi.classed("c3",!0),ef.data.x={},ef.data.targets=pc(b),n(),R(),Qf.domain(df.extent(Zb(ef.data.targets))),Rf.domain(Ub(ef.data.targets,"y")),Sf.domain(Ub(ef.data.targets,"y2")),Tf.domain(Qf.domain()),Uf.domain(Rf.domain()),Vf.domain(Sf.domain()),Ci=Qf.domain(),qi.scale(Tf),mf&&ui.scale(Qf),vi=Bi.append("svg").attr("width",vf+sf.left+sf.right).attr("height",xf+sf.top+sf.bottom).on("mouseenter",pf).on("mouseleave",qf),wi=vi.append("defs"),wi.append("clipPath").attr("id",Oh).append("rect").attr("width",vf).attr("height",xf),wi.append("clipPath").attr("id",Ph).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),wi.append("clipPath").attr("id",Qh).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),xi=vi.append("g").attr("transform",ii.main),yi=xg?vi.append("g").attr("transform",ii.context):null,zi=vi.append("g").attr("transform",ii.legend),Ag||(zi.style("visibility","hidden"),di=vc(ef.data.targets)),Ai=df.select(gf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),$e(vc(ef.data.targets),{withTransform:!1,withTransitionForTransform:!1}),xi.append("g").attr("class",f.axisX).attr("clip-path",Eg?"":Sh).attr("transform",ii.x).append("text").attr("class",f.axisXLabel).attr("transform",Eg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),Rg&&xi.append("g").attr("class",f.axisY).attr("clip-path",Eg?Th:"").attr("transform",ii.y).append("text").attr("class",f.axisYLabel).attr("transform",Eg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),$g&&xi.append("g").attr("class",f.axisY2).attr("transform",ii.y2).append("text").attr("class",f.axisY2Label).attr("transform",Eg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=xi.append("g").attr("clip-path",Rh).attr("class",f.grid),hh&&d.append("g").attr("class",f.xgrids),ge(jh)&&d.append("g").attr("class",f.xgridLines),ph&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),kh&&d.append("g").attr("class",f.ygrids),ge(lh)&&d.append("g").attr("class",f.ygridLines),xi.append("g").attr("clip-path",Rh).attr("class",f.regions),xi.append("g").attr("clip-path",Rh).attr("class",f.chart),c=xi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",mf?Eg?"ns-resize":"ew-resize":null),xi.select("."+f.chart).append("g").attr("class",f.chartBars),xi.select("."+f.chart).append("g").attr("class",f.chartLines),xi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",ii.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),xi.select("."+f.chart).append("g").attr("class",f.chartTexts),mf&&xi.insert("rect",of?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",vf).attr("height",xf).style("opacity",0).style("cursor",Eg?"ns-resize":"ew-resize").call(ui).on("dblclick.zoom",null),Pg&&qi.extent("function"!=typeof Pg?Pg:Pg(Zb())),xg&&(yi.append("g").attr("clip-path",Rh).attr("class",f.chart),yi.select("."+f.chart).append("g").attr("class",f.chartBars),yi.select("."+f.chart).append("g").attr("class",f.chartLines),yi.append("g").attr("clip-path",Rh).attr("class",f.brush).call(qi).selectAll("rect").attr(Eg?"width":"height",Eg?wf:yf),yi.append("g").attr("class",f.axisX).attr("transform",ii.subx).attr("clip-path",Eg?"":Sh)),Qe(ef.data.targets),Eg?xi.select("."+f.axisX).style("opacity",0).call(Wf):(xi.select("."+f.axisY).style("opacity",0).call(Xf),xi.select("."+f.axisY2).style("opacity",0).call(Yf)),Ke({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Lh){if(Uh&&"string"==typeof Mh){for(Mh=be(Mh),e=0;e0){d=[];for(var g in cg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=wd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=pe,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 Ie(a){Rd(ef.data.targets)||mg&&(Xh=a,xi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Yh=!0,vg())}function Je(){Rd(ef.data.targets)||mg&&(xi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),xi.selectAll("."+f.shape).classed(f.INCLUDED,!1),Yh=!1,wg())}function Ke(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S=Gd(),T=Rd(ef.data.targets),U=Bc(ef.data.targets);if(0!==U.length){if(a=d(a)?a:{},x=d(a.withY)?a.withY:!0,y=d(a.withSubchart)?a.withSubchart:!0,z=d(a.withTransition)?a.withTransition:!0,D=d(a.withTransform)?a.withTransform:!1,E=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,F=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,G=d(a.withLegend)?a.withLegend:!1,A=d(a.withTransitionForExit)?a.withTransitionForExit:z,B=d(a.withTransitionForAxis)?a.withTransitionForAxis:z,C=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:z,M=z?rf:0,N=A?M:0,O=B?M:0,G&&Ag&&$e(vc(ef.data.targets),a),F&&(Qf.domain(df.extent(Zb(U))),Ci=Qf.domain(),mf&&ui.scale(Qf).updateScaleExtent(),Tf.domain(Qf.domain()),qi.scale(Tf)),E&&(Qf.domain(qi.empty()?Ci:qi.extent()),mf&&ui.scale(Qf).updateScaleExtent()),Rf.domain(Ub(U,"y")),Sf.domain(Ub(U,"y2")),Od(U)||(P=Dc(Cc(U)).sort(),Wf.tickValues(P),Zf.tickValues(P)),c=xi.select("."+f.axisX).style("opacity",T?0:1),(Eg||C)&&(c=c.transition().duration(O)),c.call(Wf),e=xi.select("."+f.axisY).style("opacity",T?0:1),(!Eg||C)&&(e=e.transition().duration(O)),e.call(Xf),xi.select("."+f.axisY2).style("opacity",T?0:1).transition().duration(O).call(Yf),E&&Jg&&P){for(Q=1;Q=Y;Y++)h.push(new Date(Y+"-01-01 00:00:00"))}else h=Qf.ticks(10);g=xi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Eg?0:function(a){return Qf(a)-Wf.tickOffset()}).attr("x2",Eg?vf:function(a){return Qf(a)-Wf.tickOffset()}).attr("y1",Eg?function(a){return Qf(a)-Wf.tickOffset()}:sf.top).attr("y2",Eg?function(a){return Qf(a)-Wf.tickOffset()}:xf).style("opacity",function(){return+df.select(this).attr(Eg?"y1":"x1")===(Eg?xf:0)?0:1}),g.exit().remove()}ge(jh)&&(i=xi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(jh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Eg?"":"rotate(-90)").attr("dx",Eg?0:-sf.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(M).attr("x1",Eg?0:od).attr("x2",Eg?vf:od).attr("y1",Eg?od:sf.top).attr("y2",Eg?od:xf).style("opacity",1),i.select("text").transition().duration(M).attr("x",Eg?vf:0).attr("y",od).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(M).style("opacity",0).remove()),x&&kh&&(k=xi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Rf.ticks(mh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Eg?Rf:0).attr("x2",Eg?Rf:vf).attr("y1",Eg?0:Rf).attr("y2",Eg?xf:Rf),k.exit().remove()),x&&ge(lh)&&(l=xi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(lh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Eg?"rotate(-90)":"").attr("dx",Eg?0:-sf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(M).attr("x1",Eg?pd:0).attr("x2",Eg?pd:vf).attr("y1",Eg?0:pd).attr("y2",Eg?xf:pd).style("opacity",1),l.select("text").transition().duration(M).attr("x",Eg?0:vf).attr("y",pd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(M).style("opacity",0).remove()),p=xi.selectAll("."+f.bars).selectAll("."+f.bar).data(Zd),p.enter().append("path").attr("d",H).style("stroke","none").style("opacity",0).style("fill",function(a){return ai(a)}).attr("class",Vc),p.style("opacity",ed).transition().duration(M).attr("d",H).style("opacity",1),p.exit().transition().duration(N).style("opacity",0).remove(),r=xi.selectAll("."+f.texts).selectAll("."+f.text).data(_d),r.enter().append("text").attr("class",Oc).attr("text-anchor",function(a){return Eg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return md(a.id)(a.value)}).style("fill-opacity",fd).transition().duration(M).attr("x",J).attr("y",K).style("fill-opacity",hd),r.exit().transition().duration(N).style("fill-opacity",0).remove(),xi.selectAll("."+f.line).style("opacity",ed).transition().duration(M).attr("d",ri).style("opacity",1),xi.selectAll("."+f.area).style("opacity",0).transition().duration(M).attr("d",si).style("opacity",Di),n=xi.selectAll("."+f.circles).selectAll("."+f.circle).data($d),n.enter().append("circle").attr("class",Tc).style("opacity",0).attr("r",oh),n.style("opacity",ed).transition().duration(M).style("opacity",gd).attr("cx",Eg?Fd:Ed).attr("cy",Eg?Ed:Fd),n.exit().remove(),xi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",D?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(M).attrTween("d",function(a){var b,c=Cb(a);return c?(b=df.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",D?"scale(1)":"").style("opacity",1),xi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(M).text(Jb).style("opacity",function(a){return zc(a.data.id)&&Yd(a.data)?1:0}),xi.select("."+f.chartArcsTitle).style("opacity",Qd(ef.data.targets)?1:0),xg&&(null!==df.event&&"zoom"===df.event.type&&qi.extent(Qf.orgDomain()).update(),y&&(yi.select("."+f.axisX).style("opacity",T?0:1).transition().duration(M).call(Zf),qi.empty()||qi.extent(Qf.orgDomain()).update(),I=xe(S,!0),s=yi.selectAll("."+f.bars).selectAll("."+f.bar).data(Zd),s.enter().append("path").attr("d",I).style("stroke","none").style("fill",function(a){return ai(a)}).attr("class",Vc),s.style("opacity",ed).transition().duration(M).attr("d",I).style("opacity",1),s.exit().transition().duration(M).style("opacity",0).remove(),yi.selectAll("."+f.line).style("opacity",ed).transition().duration(M).attr("d",ti).style("opacity",1))),xi.selectAll("."+f.selectedCircles).filter(function(a){return Ud(a)}).selectAll("circle").remove(),xi.selectAll("."+f.selectedCircle).transition().duration(M).attr("cx",Eg?Fd:Ed).attr("cy",Eg?Ed:Fd),ge(_f)?(t=xi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Fe(t.enter()),t.attr("x",0).attr("y",0).attr("width",vf).attr("height",xf)):(Wh&&!Vh?(w=function(a,b){var c=rc(b),d=sc(b),e=ef.data.x[a.id][b];return(Qf(d?d:e+50)-Qf(c?c:e-50))/2},v=function(a,b){var c=rc(b),d=ef.data.x[a.id][b];return(Qf(d)+Qf(c?c:d-50))/2}):(w=L(),v=function(a){return Qf(a.x)-w/2}),u=uc(),xi.select("."+f.eventRects).datum(u?u.values:[]),t=xi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ee(t.enter()),t.attr("class",$c).attr("x",Eg?0:v).attr("y",Eg?v:0).attr("width",Eg?vf:w).attr("height",Eg?w:xf),t.exit().remove()),q=xi.select("."+f.regions).selectAll("rect."+f.region).data(Gh),q.enter().append("rect").style("fill-opacity",0),q.attr("class",Zc).attr("x",Eg?0:cc).attr("y",Eg?cc:sf.top).attr("width",Eg?vf:dc).attr("height",Eg?dc:xf).transition().duration(M).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(M).style("fill-opacity",0).remove(),vc(ef.data.targets).forEach(function(a){Ei[a]=!0})}}function Le(){Ke({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Me(){return"mousemove"===df.event.sourceEvent.type&&ui.altDomain?(Qf.domain(ui.altDomain),void ui.scale(Qf).updateScaleExtent()):(Vh&&Qf.orgDomain()[0]===Ci[0]&&Qf.domain([Ci[0]-1e-10,Qf.orgDomain()[1]]),Ke({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===df.event.sourceEvent.type&&(Zh=!0)))}function Ne(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Oe(){vi.attr("width",zf).attr("height",Af),vi.select("#"+Oh).select("rect").attr("width",vf).attr("height",xf),vi.select("#"+Ph).select("rect").attr("width",H),vi.select("#"+Qh).select("rect").attr("width",J),vi.select("."+f.zoomRect).attr("width",vf).attr("height",xf)}function Pe(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Oe(),m(a.withTransition),Ke(a)}function Qe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=xi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a),j=i.enter().append("g").attr("class",function(a){return f.chartText+Nc(f.target,a.id)}).style("pointer-events","none"),j.append("g").attr("class",Pc).style("fill",function(a){return ai(a)}),e=xi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),d=e.enter().append("g").attr("class",function(a){return f.chartBar+Nc(f.target,a.id)}).style("pointer-events","none"),d.append("g").attr("class",Wc).style("fill",function(a){return ai(a)}).style("stroke","none").style("cursor",function(a){return og(a)?"pointer":null}),c=xi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),b=c.enter().append("g").attr("class",function(a){return f.chartLine+Nc(f.target,a.id)}).style("pointer-events","none"),b.append("path").attr("class",Sc).style("opacity",0).style("stroke",function(a){return ai(a)}),b.append("path").attr("class",Yc).style("opacity",function(){return Di=+df.select(this).style("opacity"),0}).style("fill",function(a){return ai(a)}),b.append("g").attr("class",function(a){return Nc(f.selectedCircles,a.id)}),b.append("g").attr("class",Uc).style("fill",function(a){return ai(a)}).style("cursor",function(a){return og(a)?"pointer":null}),a.forEach(function(a){xi.selectAll("."+f.selectedCircles+_c(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=xi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Hf(a)),g=h.enter().append("g").attr("class",function(a){return f.chartArc+Nc(f.target,a.data.id)}),g.append("path").attr("class",Xc).style("opacity",0).style("fill",function(a){return ai(a.data)}).style("cursor",function(a){return og(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),Ve(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Ad(c,df.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),Xe(),Bd(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),xg&&(n=yi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),m=n.enter().append("g").attr("class",function(a){return f.chartBar+Nc(f.target,a.id)}),m.append("g").attr("class",Wc).style("fill",function(a){return ai(a)}),l=yi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),k=l.enter().append("g").attr("class",function(a){return f.chartLine+Nc(f.target,a.id)}),k.append("path").attr("class",Sc).style("opacity",0).style("stroke",function(a){return ai(a)})),vi.selectAll("."+f.target).filter(function(a){return zc(a.id)}).transition().style("opacity",1)}function Re(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Ld(a.id,b.types[a.id]):Ld(a.id,b.type)}),ef.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBBox(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=ji?j:i,l=ji?Q():P();return d&&(w=0,C=0,t=0,u=0),Ag&&!Ac(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=ji?u:t,void(Dg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,ji?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=zi.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Nc(f.legendItem,a)}).style("visibility",function(a){return Ac(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Cg?Cg(a):ef.toggle(a)}).on("mouseover",function(a){ef.focus(a)}).on("mouseout",function(){ef.revert()}),l.append("text").text(function(a){return d(cg[a])?cg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",ji?g:-200).attr("y",ji?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",ji?h:-200).attr("y",ji?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return ai(a)}).attr("x",ji?g:-200).attr("y",ji?-200:i).attr("width",10).attr("height",10),zi.selectAll("text").data(a).text(function(a){return d(cg[a])?cg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),zi.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),zi.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Oe(),q&&m(p)}function _e(a){return xc(ef.data.targets,a.id)}function af(a){return"data"in a&&xc(ef.data.targets,a.data.id)}function bf(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 cf(a,b,c){var d=!Rd(ef.data.targets);Ld(a,b),Pe(c?c:{withTransitionForAxis:d})}var df=a.d3?a.d3:a.require?a.require("d3"):void 0,ef={data:{},axis:{},legend:{}},ff={},gf=h(["bindto"],"#chart"),hf=h(["size","width"]),jf=h(["size","height"]),kf=h(["padding","left"]),lf=h(["padding","right"]),mf=h(["zoom","enabled"],!1),nf=h(["zoom","extent"]),of=h(["zoom","privileged"],!1),pf=h(["onenter"],function(){}),qf=h(["onleave"],function(){}),rf=h(["transition","duration"],350);g("data","data is required in config");var 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,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f=h(["data","x"]),_f=h(["data","xs"],{}),ag=h(["data","x_format"]),bg=h(["data","id_converter"],function(a){return a}),cg=h(["data","names"],{}),dg=h(["data","groups"],[]),eg=h(["data","axes"],{}),fg=h(["data","type"]),gg=h(["data","types"],{}),hg=h(["data","labels"],{}),ig=h(["data","order"]),jg=h(["data","regions"],{}),kg=h(["data","color"]),lg=h(["data","colors"],{}),mg=h(["data","selection","enabled"],!1),ng=h(["data","selection","grouped"],!1),og=h(["data","selection","isselectable"],function(){return!0}),pg=h(["data","selection","multiple"],!0),qg=h(["data","onclick"],function(){}),rg=h(["data","onenter"],function(){}),sg=h(["data","onleave"],function(){}),tg=h(["data","onselected"],function(){}),ug=h(["data","onunselected"],function(){}),vg=h(["data","ondragstart"],function(){}),wg=h(["data","ondragend"],function(){}),xg=h(["subchart","show"],!1),yg=xg?h(["subchart","size","height"],60):0,zg=h(["color","pattern"],[]),Ag=h(["legend","show"],!0),Bg=h(["legend","position"],"bottom"),Cg=h(["legend","item","onclick"]),Dg=h(["legend","equally"],!1),Eg=h(["axis","rotated"],!1),Fg=h(["axis","x","type"],"indexed"),Gg=h(["axis","x","categories"],[]),Hg=h(["axis","x","tick","centered"],!1),Ig=h(["axis","x","tick","format"]),Jg=h(["axis","x","tick","culling"],{}),Kg=h(["axis","x","tick","culling","max"],"categorized"===Fg?1/0:10),Lg=h(["axis","x","tick","count"]),Mg=h(["axis","x","tick","fit"],!1),Ng=h(["axis","x","max"]),Og=h(["axis","x","min"]),Pg=h(["axis","x","default"]),Qg=h(["axis","x","label"],{}),Rg=h(["axis","y","show"],!0),Sg=h(["axis","y","max"]),Tg=h(["axis","y","min"]),Ug=h(["axis","y","center"]),Vg=h(["axis","y","label"],{}),Wg=h(["axis","y","inner"],!1),Xg=h(["axis","y","tick","format"]),Yg=h(["axis","y","padding"],{}),Zg=h(["axis","y","ticks"],10),$g=h(["axis","y2","show"],!1),_g=h(["axis","y2","max"]),ah=h(["axis","y2","min"]),bh=h(["axis","y2","center"]),ch=h(["axis","y2","label"],{}),dh=h(["axis","y2","inner"],!1),eh=h(["axis","y2","tick","format"]),fh=h(["axis","y2","padding"],{}),gh=h(["axis","y2","ticks"],10),hh=h(["grid","x","show"],!1),ih=h(["grid","x","type"],"tick"),jh=h(["grid","x","lines"],[]),kh=h(["grid","y","show"],!1),lh=h(["grid","y","lines"],[]),mh=h(["grid","y","ticks"],10),nh=h(["point","show"],!0),oh=nh?h(["point","r"],2.5):0,ph=h(["point","focus","line","enabled"],!0),qh=h(["point","focus","expand","enabled"],!0),rh=h(["point","focus","expand","r"],qh?4:oh),sh=h(["point","focus","select","r"],8),th=h(["bar","width"]),uh=h(["bar","width","ratio"],.6),vh=h(["pie","label","show"],!0),wh=h(["pie","label","format"]),xh=h(["pie","onclick"],function(){}),yh=h(["pie","onmouseover"],function(){}),zh=h(["pie","onmouseout"],function(){}),Ah=h(["donut","label","show"],!0),Bh=h(["donut","label","format"]),Ch=h(["donut","title"],""),Dh=h(["donut","onclick"],function(){}),Eh=h(["donut","onmouseover"],function(){}),Fh=h(["donut","onmouseout"],function(){}),Gh=h(["regions"],[]),Hh=h(["tooltip","show"],!0),Ih=h(["tooltip","format","title"]),Jh=h(["tooltip","format","value"]),Kh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Ih?Ih:b,l=Jh?Jh: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+""}),Lh=h(["tooltip","init","show"],!1),Mh=h(["tooltip","init","x"],0),Nh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Oh=("string"==typeof gf?gf.replace("#",""):gf.id)+"-clip",Ph=Oh+"-xaxis",Qh=Oh+"-yaxis",Rh=i(Oh),Sh=i(Sh),Th=i(Th),Uh="timeseries"===Fg,Vh="categorized"===Fg,Wh=!Uh&&($f||ge(_f)),Xh=null,Yh=!1,Zh=!1,$h=!1,_h=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ai=ae(lg,ge(zg)?zg:_h,kg),bi=function(){var a=[[df.time.format("%Y/%-m/%-d"),function(){return!0}],[df.time.format("%-m/%-d"),function(a){return a.getMonth()}],[df.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[df.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[df.time.format("%I %p"),function(a){return a.getHours()}],[df.time.format("%I:%M"),function(a){return a.getMinutes()}],[df.time.format(":%S"),function(a){return a.getSeconds()}],[df.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)}}(),ci=[],di=[],ei=Eg?"left":"bottom",fi=Eg?Wg?"top":"bottom":Wg?"right":"left",gi=Eg?dh?"bottom":"top":dh?"left":"right",hi=Eg?"left":"bottom",ii={main:function(){return"translate("+sf.left+","+sf.top+")"},context:function(){return"translate("+tf.left+","+tf.top+")"},legend:function(){return"translate("+uf.left+","+uf.top+")"},x:function(){return"translate(0,"+(Eg?0:xf)+")"},y:function(){return"translate(0,"+(Eg?xf:0)+")"},y2:function(){return"translate("+(Eg?0:vf)+","+(Eg?1:0)+")"},subx:function(){return"translate(0,"+(Eg?0:yf)+")"},arc:function(){return"translate("+vf/2+","+xf/2+")"}},ji="right"===Bg,ki=0,li=0,mi=0,ni=30,oi=30,pi=5;Hf=df.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var qi,ri=function(){var a=df.svg.line().x(Eg?function(a){return V(a.id)(a.value)}:nd).y(Eg?nd:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=qe(b.values);return Sd(b)?(a.interpolate(Td(b)?"cardinal":"linear"),jg[b.id]?Ce(e,Qf,V(b.id),jg[b.id]):a(e)):(c=Qf(e[0].x),d=V(b.id)(e[0].value),Eg?"M "+d+" "+c:"M "+c+" "+d)}}(),si=function(){var a;return a=Eg?df.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(nd):df.svg.area().x(nd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=qe(b.values);return Md([b],"area")||Md([b],"area-spline")?(a.interpolate(Td(b)?"cardinal":"linear"),a(e)):(c=Qf(e[0].x),d=V(b.id)(e[0].value),Eg?"M "+d+" "+c:"M "+c+" "+d)}}(),ti=function(){var a=df.svg.line().x(Eg?function(a){return W(a.id)(a.value)}:qd).y(Eg?qd:function(a){return W(a.id)(a.value)});return function(b){var c=qe(b.values);return Sd(b)?a(c):"M "+Tf(c[0].x)+" "+W(b.id)(c[0].value)}}(),ui=function(){};qi=df.svg.brush().on("brush",Le),qi.update=function(){return yi&&yi.select("."+f.brush).call(this),this},qi.scale=function(a){return Eg?this.y(a):this.x(a)},mf&&(ui=df.behavior.zoom().on("zoomstart",function(){ui.altDomain=df.event.sourceEvent.altKey?Qf.orgDomain():null}).on("zoom",mf?Me:null),ui.scale=function(a){return Eg?this.y(a):this.x(a)},ui.orgScaleExtent=function(){var a=nf?nf:[1,10];return[a[0],Math.max(tc()/a[1],a[1])]},ui.updateScaleExtent=function(){var a=$b(Qf.orgDomain())/$b(Ci),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var vi,wi,xi,yi,zi,Ai,Bi,Ci,Di,Ei={};if(ef.focus=function(a){function b(a){Bc(a).transition().duration(100).style("opacity",1)}var c=vi.selectAll(ad(a)),d=c.filter(_e),e=c.filter(af);ef.revert(),ef.defocus(),b(d.classed(f.focused,!0)),b(e),Rd(ef.data.targets)&&Kb(a,!0),Ve(a)},ef.defocus=function(a){function b(a){Bc(a).transition().duration(100).style("opacity",.3)}var c=vi.selectAll(ad(a)),d=c.filter(_e),e=c.filter(af);ef.revert(),b(d.classed(f.focused,!1)),b(e),Rd(ef.data.targets)&&Lb(a),We(a)},ef.revert=function(a){function b(a){Bc(a).transition().duration(100).style("opacity",1)}var c=vi.selectAll(ad(a)),d=c.filter(_e),e=c.filter(af);b(d.classed(f.focused,!1)),b(e),Rd(ef.data.targets)&&Lb(a),Xe()},ef.show=function(a,b){a=wc(a),b=b||{},Fc(a),vi.selectAll(bd(a)).transition().style("opacity",1),b.withLegend&&Ye(a),Ke({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},ef.hide=function(a,b){a=wc(a),b=b||{},Ec(a),vi.selectAll(bd(a)).transition().style("opacity",0),b.withLegend&&Ze(a),Ke({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},ef.toggle=function(a){zc(a)?ef.hide(a):ef.show(a)},ef.unzoom=function(){qi.clear().update(),Ke({withUpdateXDomain:!0})},ef.load=function(a){return a.xs&&ic(a.xs),"categories"in a&&Vh&&(Gg=a.categories,Wf.categories(Gg)),"cacheIds"in a&&_b(a.cacheIds)?void Re(bc(a.cacheIds),a.done):void("unload"in a?Te(wc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Se(a)}):Se(a))},ef.unload=function(a){Te(wc(a),function(){Ke({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},ef.selected=function(a){return df.merge(xi.selectAll("."+f.shapes+_c(a)).selectAll("."+f.shape).filter(function(){return df.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},ef.select=function(a,b,c){mg&&xi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=df.select(this),i="circle"===this.nodeName?ke:ne,j="circle"===this.nodeName?le:oe,k=ng||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?og(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},ef.unselect=function(a,b){mg&&xi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=df.select(this),g="circle"===this.nodeName?le:oe,h=ng||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&og(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},ef.toLine=function(a){cf(a,"line")},ef.toSpline=function(a){cf(a,"spline")},ef.toBar=function(a){cf(a,"bar")},ef.toScatter=function(a){cf(a,"scatter")},ef.toArea=function(a){cf(a,"area")},ef.toAreaSpline=function(a){cf(a,"area-spline")},ef.toPie=function(a){cf(a,"pie",{withTransform:!0})},ef.toDonut=function(a){cf(a,"donut",{withTransform:!0})},ef.groups=function(a){return c(a)?dg:(dg=a,Ke(),dg)},ef.xgrids=function(a){return a?(jh=a,Ke(),jh):jh},ef.xgrids.add=function(a){return a?ef.xgrids(jh.concat(a)):void 0},ef.xgrids.remove=function(a){var b=bf(a);return ef.xgrids(jh.filter(b))},ef.ygrids=function(a){return a?(lh=a,Ke(),lh):lh},ef.ygrids.add=function(a){return a?ef.ygrids(lh.concat(a)):void 0},ef.ygrids.remove=function(a){var b=bf(a);return ef.ygrids(lh.filter(b))},ef.regions=function(a){return c(a)?Gh:(Gh=a,Ke(),Gh)},ef.regions.add=function(a){return c(a)?Gh:(Gh=Gh.concat(a),Ke(),Gh)},ef.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;vi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Gh=Gh.filter(function(b){return b.classes.indexOf(a)<0})}),Gh},ef.data.get=function(a){var b=ef.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},ef.data.getAsTarget=function(a){var b=yc(function(b){return b.id===a});return b.length>0?b[0]:void 0},ef.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){cg[b]=a[b]}),$e(vc(ef.data.targets),{withTransition:!0}),cg):cg},ef.x=function(a){return arguments.length&&(kc(ef.data.targets,a),Ke({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),ef.data.x},ef.xs=function(a){return arguments.length&&(lc(ef.data.targets,a),Ke({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),ef.data.x},ef.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},ef.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Sg=+a.y),b(a.y2)&&(_g=+a.y2)):Sg=_g=+a,Ke()) },ef.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Tg=+a.y),b(a.y2)&&(ah=+a.y2)):Tg=ah=+a,Ke())},ef.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&ef.axis.max(a.max),"undefined"!=typeof a.min&&ef.axis.min(a.min))},ef.legend.show=function(a){Ag||(Ag=!0,zi.style("visibility","visible")),Ye(wc(a)),Ke({withTransitionForHorizontalAxis:!1})},ef.legend.hide=function(a){Ag&&fe(a)&&(Ag=!1,zi.style("visibility","hidden")),Ze(wc(a)),Ke({withTransitionForHorizontalAxis:!1})},ef.resize=function(a){hf=a?a.width:null,jf=a?a.height:null,Pe({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},ef.destroy=function(){ef.data.targets=void 0,ef.data.x={},Bi.html(""),a.onresize=null},"url"in e.data)df.csv(e.data.url,function(a,b){De(b)});else if("rows"in e.data)De(nc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");De(oc(e.data.columns))}return ef},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From da421871355f993af376d825fd242b27b250a25d Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Mon, 7 Apr 2014 16:07:54 +0900 Subject: [PATCH 017/178] Update version --- bower.json | 2 +- c3.js | 2 +- c3.min.js | 2 +- package.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bower.json b/bower.json index 156da9c..d305465 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "c3", "main": "c3.min.js", - "version": "0.1.28", + "version": "0.1.29", "homepage": "https://github.com/masayuki0812/c3", "authors": [ "Masayuki Tanaka " diff --git a/c3.js b/c3.js index d087d1b..525c993 100644 --- a/c3.js +++ b/c3.js @@ -2,7 +2,7 @@ 'use strict'; var c3 = { - version: "0.1.28" + version: "0.1.29" }; var CLASS = { diff --git a/c3.min.js b/c3.min.js index 6123789..27f061b 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.28"},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;cvf&&(vf=0),0>xf&&(xf=0),tf={top:Eg?sf.top:Af-yg-(ji?0:a),right:0/0,bottom:20+(ji?0:a),left:Eg?ni:sf.left},wf=Eg?sf.left-ni-oi:vf,yf=Eg?xf:Af-tf.top-tf.bottom,0>wf&&(wf=0),0>yf&&(yf=0),uf={top:ji?0:Af-a,right:0/0,bottom:0,left:ji?zf-b:0},p(),ji&&Rd(ef.data.targets)&&(uf.left=vf/2+Cf)}function o(){xi.select("line."+f.xgridFocus).attr("x1",Eg?0:-10).attr("x2",Eg?vf:-10).attr("y1",Eg?-10:sf.top).attr("y2",Eg?-10:xf)}function p(){Cf=xf/2,Bf=.95*Cf,Df=Qd(ef.data.targets)?.6*Bf:0}function q(){var a=Eg?f.axisX:f.axisY,b=df.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=df.select(gf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return hf?hf:x()}function s(){var a=jf?jf:y();return a>0?a:320}function t(){return Rd(ef.data.targets)?0:kf?kf:Eg||!Rg||Wg?1:v("y")}function u(){var a=1;return Rd(ef.data.targets)?0:lf?lf:ji?P()+($g&&!Eg?v("y2"):a):$g?dh||Eg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||Rg?"y2"!==a||$g?(gb(a).isInner?30:40)+("y2"===a?-10:0):pi:Ag&&!ji?10:1}function x(){return+df.select(gf).style("width").replace("px","")}function y(){return+df.select(gf).style("height").replace("px","")}function z(a){return a?-5:-(sf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Eg)}function C(){return A(!Eg)}function D(){return z(Eg)}function E(){return A(Eg)}function F(a){return a?vf+2+4:sf.left+20}function G(a){return a?80:xf+2}function H(){return F(!Eg)}function I(){return G(!Eg)}function J(){return F(Eg)}function K(){return G(Eg)}function L(){var a=Eg?xf:vf,b=tc(),c=Vb()*(Nd(ef.data.targets)?(b-(Vh?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){ki=a}function N(a){li=a}function O(a){mi=a}function P(){return Ag?ji?li*(ki+1):zf:0}function Q(){return Ag?ji?Af:mi*(ki+1):0}function R(){var a,b=!Qf;If=Eg?1:0,Jf=Eg?xf:vf,Kf=Eg?0:xf,Lf=Eg?vf:1,Mf=If,Nf=Jf,Of=Eg?0:yf,Pf=Eg?wf:1,Qf=T(If,Jf,b?void 0:Qf.domain(),function(){return Wf.tickOffset()}),Rf=U(Kf,Lf),Sf=U(Kf,Lf),Tf=T(If,Jf,Ci,function(a){return a%1?0:Zf.tickOffset()}),Uf=U(Of,Pf),Vf=U(Of,Pf),a=$(),Wf=X(Qf,ei,a),Zf=X(Tf,hi,a),Xf=Y(Rf,fi,Xg,Zg),Yf=Y(Sf,gi,eh,gh),b||(qi.scale(Tf),mf&&ui.scale(Qf)),S()}function S(){Ef=Db(),Ff=Eb(),Gf=Eb(.98)}function T(a,b,e,f){var g=(Uh?df.time.scale():df.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),Vh){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return df.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?Sf:Rf}function W(a){return"y2"===Z(a)?Vf:Uf}function X(a,b,c){var d=(Vh?Bb():df.svg.axis()).scale(a).orient(b);return d.tickFormat(c),Vh?d.tickCentered(Hg):d.tickOffset=function(){var a=Eg?xf:vf;return a*Vb()/tc()/2},Vh&&d.categories(Gg),d}function Y(a,b,c,d){return df.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in eg?eg[a]:"y"}function $(){var a=Uh?bi:Vh?Mc:function(a){return 0>a?a.toFixed(0):a};return Ig&&("function"==typeof Ig?a=Ig:Uh&&(a=function(a){return df.time.format(Ig)(a)})),a}function _(a){var b;return"y"===a?b=Vg:"y2"===a?b=ch:"x"===a&&(b=Qg),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Vg=b:"y2"===a?ch=b:"x"===a&&(Qg=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Eg?"inner-top":"inner-right")}function eb(){return cb("y",Eg?"inner-right":"inner-top")}function fb(){return cb("y2",Eg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?vf/2:vf:b.isBottom?-xf:b.isMiddle?-xf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Eg,db())}function ob(){return kb(Eg,eb())}function pb(){return kb(Eg,fb())}function qb(){return lb(!Eg,db())}function rb(){return lb(Eg,eb())}function sb(){return lb(Eg,fb())}function tb(){var a=db();return Eg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Eg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Eg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Eg,db())}function xb(){return mb(Eg,eb())}function yb(){return mb(Eg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return df.selectAll("."+c+" .tick text").each(function(){var a=this.getBBox();bb?20:b}function Ab(){xi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),xi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),xi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Kc(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 df.min(Object.keys(i).map(function(a){return df.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=vc(a),i=Ic(a);if(dg.length>0)for(g=Lc(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 df.max(Object.keys(i).map(function(a){return df.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?ah:Tg,n="y2"===c?_g:Sg,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?bh:Ug,r=id()&&Eg;return 0===l.length?"y2"===c?Sf.domain():Rf.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=jd(o,p),j=$b(Rf.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Yg&&(f=b(Yg.top)?Yg.top:e,g=b(Yg.bottom)?Yg.bottom:e),"y2"===c&&fh&&(f=b(fh.top)?fh.top:e,g=b(fh.bottom)?fh.bottom:e),Nd(l)&&!Kc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Ci),c=$b(Qf.domain());return a||0===c?1:b/c}function Wb(a){return Og?Og:df.min(a,function(a){return df.min(a.values,function(a){return a.x})})}function Xb(a){return Ng?Ng:df.max(a,function(a){return df.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return Vh?d=0:Nd(a)?(c=tc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=Uh?new Date(c.getTime()-e):c-e,g=Uh?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return $f&&a===$f||ge(_f)&&he(_f,a)}function fc(a){return!ec(a)}function gc(a){return $f?$f:ge(_f)?_f[a]:null}function hc(a,b){return a in ef.data.x&&ef.data.x[a]&&ef.data.x[a][b]?ef.data.x[a][b]:b}function ic(a){Object.keys(a).forEach(function(b){_f[b]=a[b]})}function jc(a){var b;return a&&(b=cg[a.id],a.name=b?b:a.id),a}function kc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=mc(b[d],a.id,d)}),ef.data.x[a.id]=b})}function lc(a,b){a.forEach(function(a){b[a.id]&&kc([a],b[a.id])})}function mc(a,b,c){var d;return d=Uh?a?a instanceof Date?a:be(a):be(hc(b,c)):Wh&&!Vh?a?+a:hc(b,c):c}function nc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?ef.data.x[b]=a.map(function(a){return a[c]}):$f&&e.length>0&&(ef.data.x[b]=ef.data.x[e[0]]):ef.data.x[b]=a.map(function(a,b){return b})}),c.forEach(function(a){if(!ef.data.x[a])throw new Error('x is not defined for id = "'+a+'".')}),b=c.map(function(b,c){var d=bg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=mc(g,b,e);return Wh&&Vh&&0===c&&g&&(0===e&&(Gg=[]),Gg.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++})}),fg&&Ld(vc(b).filter(function(a){return!(a in gg)}),fg),b.forEach(function(a){ac(a.id_org,a)}),b}function qc(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 rc(a){return a>0&&ef.data.targets[0].values[a-1]?ef.data.targets[0].values[a-1].x:void 0}function sc(a){return a1?ef.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?ef.data.targets[0]:null,a}function vc(a){return a.map(function(a){return a.id})}function wc(a){return a?"string"==typeof a?[a]:a:vc(ef.data.targets)}function xc(a,b){var c,d=vc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(Uh?new Date(h):h);i.push(d)}return i}function Ec(a){ci=ci.concat(a)}function Fc(a){ci=ci.filter(function(b){return a.indexOf(b)<0})}function Gc(a){di=di.concat(a)}function Hc(a){di=di.filter(function(b){return a.indexOf(b)<0})}function Ic(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Jc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Lc(a){return Jc(a,function(a){return a>0})}function Mc(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(rd(a,f))),a[g].x&&(e=e.concat(rd(a,g))),ud(e,b)):sd(a,b,f,g)}function td(a,b){var c;return c=a.map(function(a){return sd(a.values,b)}),ud(c,b)}function ud(a,b){var c,d;return a.forEach(function(a){var e=ie(a,b);(c>e||!c)&&(c=e,d=a)}),d}function vd(a,b){return df.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function wd(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 xd(){return ig&&"desc"===ig.toLowerCase()}function yd(){return ig&&"asc"===ig.toLowerCase()}function zd(a){var b=yd(),c=xd();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 ig&&a.sort(ig),a}function Ad(a,c){var d,e,f,g,h,i,j,k=Rd(ef.data.targets),l=k?ld:kd,m=a.filter(function(a){return a&&b(a.value)});Hh&&0!==m.length&&(Ai.html(Kh(a,$(),l,ai)).style("display","block"),d=Ai.property("offsetWidth"),e=Ai.property("offsetHeight"),k?(g=vf/2+c[0],i=xf/2+c[1]+20):(Eg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Qf(m[0].x)+20):(f=q(),g=f+t()+Qf(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Ai.style("top",i+"px").style("left",g+"px"))}function Bd(){Ai.style("display","none")}function Cd(a){var c=a.filter(function(a){return a&&b(a.value)});Hh&&(Od(ef.data.targets)||Rd(ef.data.targets)||xi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Eg?"y1":"x1",nd).attr(Eg?"y2":"x2",nd))}function Dd(){xi.select("line."+f.xgridFocus).style("visibility","hidden")}function Ed(a){return a.x||0===a.x?Qf(a.x):null}function Fd(a){return V(a.id)(a.value)}function Gd(){var a,b,d={},e=0;return Bc(yc(Ud)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Kd(a,b){return th?th:b?2*a.tickOffset()*uh/b:0}function Ld(a,b){wc(a).forEach(function(a){Ei[a]=b===gg[a],gg[a]=b})}function Md(a,b){var c=!1;return a.forEach(function(a){gg[a.id]===b&&(c=!0),a.id in gg||"line"!==b||(c=!0)}),c}function Nd(a){return Md(a,"bar")}function Od(a){return Md(a,"scatter")}function Pd(a){return Md(a,"pie")}function Qd(a){return Md(a,"donut")}function Rd(a){return Pd(a)||Qd(a)}function Sd(a){var b="string"==typeof a?a:a.id;return!(b in gg)||"line"===gg[b]||"spline"===gg[b]||"area"===gg[b]||"area-spline"===gg[b]}function Td(a){var b="string"==typeof a?a:a.id;return"spline"===gg[b]||"area-spline"===gg[b]}function Ud(a){var b="string"==typeof a?a:a.id;return"bar"===gg[b]}function Vd(a){var b="string"==typeof a?a:a.id;return"scatter"===gg[b]}function Wd(a){var b="string"==typeof a?a:a.id;return"pie"===gg[b]}function Xd(a){var b="string"==typeof a?a:a.id;return"donut"===gg[b]}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){return Ud(a)?a.values:[]}function $d(a){return Sd(a)||Vd(a)?a.values:[]}function _d(a){return Ud(a)||Sd(a)?a.values:[]}function ae(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function be(b){var c;if(!b)throw Error(b+" can not be parsed as d3.time with format "+ag+". Maybe 'x' of this data is not defined. See data.x or data.xs option.");try{c=ag?df.time.format(ag).parse(b):new Date(b)}catch(d){c=void 0}return c||a.console.error("Failed to parse x '"+b+"' to Date with format "+ag),c}function ce(a,b){var c=df.mouse(a),d=df.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function he(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ie(a,b){var c="y"===Z(a.id)?Rf:Sf,d=Eg?1:0,e=Eg?0:1;return Math.pow(Qf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function je(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function ke(a,b,c){tg(b,a.node()),xi.select("."+f.selectedCircles+_c(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Nc(f.selectedCircle,c)}).attr("cx",Eg?Fd:Ed).attr("cy",Eg?Ed:Fd).attr("stroke",function(){return ai(b)}).attr("r",1.4*sh).transition().duration(100).attr("r",sh)}function le(a,b,c){ug(b,a.node()),xi.select("."+f.selectedCircles+_c(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function me(a,b,c,d){a?ke(b,c,d):le(b,c,d)}function ne(a,b){tg(b,a.node()),a.transition().duration(100).style("fill",function(){return df.rgb(ai(b)).darker(1)})}function oe(a,b){ug(b,a.node()),a.transition().duration(100).style("fill",function(){return ai(b)})}function pe(a,b,c,d){a?ne(b,c,d):oe(b,c,d)}function qe(a){return a.filter(function(a){return b(a.value)})}function re(a,c){return(c?xi.selectAll("."+f.circles+_c(c)):xi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function se(a,b){re(a,b).classed(f.EXPANDED,!0).attr("r",rh)}function te(a){re(a).filter(function(){return df.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",oh)}function ue(a){return xi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function ve(a){ue(a).classed(f.EXPANDED,!0)}function we(a){ue(a).classed(f.EXPANDED,!1)}function xe(a,b){var c=Be(a,b);return function(a,b){var d=c(a,b),e=Eg?1:0,f=Eg?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 ye(a,b){var c=Be(a,!1),d=b?ze:Ae;return function(a,b){return d(c(a,b),a,this)}}function ze(a,b){var c;return Eg?(c=Ud(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ae(a,b,c){var d=c.getBBox();return Eg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:Ud(b)?-3:-6)}function Be(a,b){var c=a.__max__+1,d=Kd(Wf,c),e=Hd(d,c,a,!!b),f=Id(!!b),g=Jd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Eg&&(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 Ce(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 De(b){var c,d,e;if(Bi=df.select(gf),Bi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Bi.html(""),Bi.classed("c3",!0),ef.data.x={},ef.data.targets=pc(b),n(),R(),Qf.domain(df.extent(Zb(ef.data.targets))),Rf.domain(Ub(ef.data.targets,"y")),Sf.domain(Ub(ef.data.targets,"y2")),Tf.domain(Qf.domain()),Uf.domain(Rf.domain()),Vf.domain(Sf.domain()),Ci=Qf.domain(),qi.scale(Tf),mf&&ui.scale(Qf),vi=Bi.append("svg").attr("width",vf+sf.left+sf.right).attr("height",xf+sf.top+sf.bottom).on("mouseenter",pf).on("mouseleave",qf),wi=vi.append("defs"),wi.append("clipPath").attr("id",Oh).append("rect").attr("width",vf).attr("height",xf),wi.append("clipPath").attr("id",Ph).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),wi.append("clipPath").attr("id",Qh).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),xi=vi.append("g").attr("transform",ii.main),yi=xg?vi.append("g").attr("transform",ii.context):null,zi=vi.append("g").attr("transform",ii.legend),Ag||(zi.style("visibility","hidden"),di=vc(ef.data.targets)),Ai=df.select(gf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),$e(vc(ef.data.targets),{withTransform:!1,withTransitionForTransform:!1}),xi.append("g").attr("class",f.axisX).attr("clip-path",Eg?"":Sh).attr("transform",ii.x).append("text").attr("class",f.axisXLabel).attr("transform",Eg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),Rg&&xi.append("g").attr("class",f.axisY).attr("clip-path",Eg?Th:"").attr("transform",ii.y).append("text").attr("class",f.axisYLabel).attr("transform",Eg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),$g&&xi.append("g").attr("class",f.axisY2).attr("transform",ii.y2).append("text").attr("class",f.axisY2Label).attr("transform",Eg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=xi.append("g").attr("clip-path",Rh).attr("class",f.grid),hh&&d.append("g").attr("class",f.xgrids),ge(jh)&&d.append("g").attr("class",f.xgridLines),ph&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),kh&&d.append("g").attr("class",f.ygrids),ge(lh)&&d.append("g").attr("class",f.ygridLines),xi.append("g").attr("clip-path",Rh).attr("class",f.regions),xi.append("g").attr("clip-path",Rh).attr("class",f.chart),c=xi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",mf?Eg?"ns-resize":"ew-resize":null),xi.select("."+f.chart).append("g").attr("class",f.chartBars),xi.select("."+f.chart).append("g").attr("class",f.chartLines),xi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",ii.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),xi.select("."+f.chart).append("g").attr("class",f.chartTexts),mf&&xi.insert("rect",of?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",vf).attr("height",xf).style("opacity",0).style("cursor",Eg?"ns-resize":"ew-resize").call(ui).on("dblclick.zoom",null),Pg&&qi.extent("function"!=typeof Pg?Pg:Pg(Zb())),xg&&(yi.append("g").attr("clip-path",Rh).attr("class",f.chart),yi.select("."+f.chart).append("g").attr("class",f.chartBars),yi.select("."+f.chart).append("g").attr("class",f.chartLines),yi.append("g").attr("clip-path",Rh).attr("class",f.brush).call(qi).selectAll("rect").attr(Eg?"width":"height",Eg?wf:yf),yi.append("g").attr("class",f.axisX).attr("transform",ii.subx).attr("clip-path",Eg?"":Sh)),Qe(ef.data.targets),Eg?xi.select("."+f.axisX).style("opacity",0).call(Wf):(xi.select("."+f.axisY).style("opacity",0).call(Xf),xi.select("."+f.axisY2).style("opacity",0).call(Yf)),Ke({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Lh){if(Uh&&"string"==typeof Mh){for(Mh=be(Mh),e=0;evf&&(vf=0),0>xf&&(xf=0),tf={top:Eg?sf.top:Af-yg-(ji?0:a),right:0/0,bottom:20+(ji?0:a),left:Eg?ni:sf.left},wf=Eg?sf.left-ni-oi:vf,yf=Eg?xf:Af-tf.top-tf.bottom,0>wf&&(wf=0),0>yf&&(yf=0),uf={top:ji?0:Af-a,right:0/0,bottom:0,left:ji?zf-b:0},p(),ji&&Rd(ef.data.targets)&&(uf.left=vf/2+Cf)}function o(){xi.select("line."+f.xgridFocus).attr("x1",Eg?0:-10).attr("x2",Eg?vf:-10).attr("y1",Eg?-10:sf.top).attr("y2",Eg?-10:xf)}function p(){Cf=xf/2,Bf=.95*Cf,Df=Qd(ef.data.targets)?.6*Bf:0}function q(){var a=Eg?f.axisX:f.axisY,b=df.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=df.select(gf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return hf?hf:x()}function s(){var a=jf?jf:y();return a>0?a:320}function t(){return Rd(ef.data.targets)?0:kf?kf:Eg||!Rg||Wg?1:v("y")}function u(){var a=1;return Rd(ef.data.targets)?0:lf?lf:ji?P()+($g&&!Eg?v("y2"):a):$g?dh||Eg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||Rg?"y2"!==a||$g?(gb(a).isInner?30:40)+("y2"===a?-10:0):pi:Ag&&!ji?10:1}function x(){return+df.select(gf).style("width").replace("px","")}function y(){return+df.select(gf).style("height").replace("px","")}function z(a){return a?-5:-(sf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Eg)}function C(){return A(!Eg)}function D(){return z(Eg)}function E(){return A(Eg)}function F(a){return a?vf+2+4:sf.left+20}function G(a){return a?80:xf+2}function H(){return F(!Eg)}function I(){return G(!Eg)}function J(){return F(Eg)}function K(){return G(Eg)}function L(){var a=Eg?xf:vf,b=tc(),c=Vb()*(Nd(ef.data.targets)?(b-(Vh?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){ki=a}function N(a){li=a}function O(a){mi=a}function P(){return Ag?ji?li*(ki+1):zf:0}function Q(){return Ag?ji?Af:mi*(ki+1):0}function R(){var a,b=!Qf;If=Eg?1:0,Jf=Eg?xf:vf,Kf=Eg?0:xf,Lf=Eg?vf:1,Mf=If,Nf=Jf,Of=Eg?0:yf,Pf=Eg?wf:1,Qf=T(If,Jf,b?void 0:Qf.domain(),function(){return Wf.tickOffset()}),Rf=U(Kf,Lf),Sf=U(Kf,Lf),Tf=T(If,Jf,Ci,function(a){return a%1?0:Zf.tickOffset()}),Uf=U(Of,Pf),Vf=U(Of,Pf),a=$(),Wf=X(Qf,ei,a),Zf=X(Tf,hi,a),Xf=Y(Rf,fi,Xg,Zg),Yf=Y(Sf,gi,eh,gh),b||(qi.scale(Tf),mf&&ui.scale(Qf)),S()}function S(){Ef=Db(),Ff=Eb(),Gf=Eb(.98)}function T(a,b,e,f){var g=(Uh?df.time.scale():df.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),Vh){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return df.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?Sf:Rf}function W(a){return"y2"===Z(a)?Vf:Uf}function X(a,b,c){var d=(Vh?Bb():df.svg.axis()).scale(a).orient(b);return d.tickFormat(c),Vh?d.tickCentered(Hg):d.tickOffset=function(){var a=Eg?xf:vf;return a*Vb()/tc()/2},Vh&&d.categories(Gg),d}function Y(a,b,c,d){return df.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in eg?eg[a]:"y"}function $(){var a=Uh?bi:Vh?Mc:function(a){return 0>a?a.toFixed(0):a};return Ig&&("function"==typeof Ig?a=Ig:Uh&&(a=function(a){return df.time.format(Ig)(a)})),a}function _(a){var b;return"y"===a?b=Vg:"y2"===a?b=ch:"x"===a&&(b=Qg),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Vg=b:"y2"===a?ch=b:"x"===a&&(Qg=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Eg?"inner-top":"inner-right")}function eb(){return cb("y",Eg?"inner-right":"inner-top")}function fb(){return cb("y2",Eg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?vf/2:vf:b.isBottom?-xf:b.isMiddle?-xf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Eg,db())}function ob(){return kb(Eg,eb())}function pb(){return kb(Eg,fb())}function qb(){return lb(!Eg,db())}function rb(){return lb(Eg,eb())}function sb(){return lb(Eg,fb())}function tb(){var a=db();return Eg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Eg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Eg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Eg,db())}function xb(){return mb(Eg,eb())}function yb(){return mb(Eg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return df.selectAll("."+c+" .tick text").each(function(){var a=this.getBBox();bb?20:b}function Ab(){xi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),xi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),xi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Kc(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 df.min(Object.keys(i).map(function(a){return df.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=vc(a),i=Ic(a);if(dg.length>0)for(g=Lc(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 df.max(Object.keys(i).map(function(a){return df.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?ah:Tg,n="y2"===c?_g:Sg,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?bh:Ug,r=id()&&Eg;return 0===l.length?"y2"===c?Sf.domain():Rf.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=jd(o,p),j=$b(Rf.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Yg&&(f=b(Yg.top)?Yg.top:e,g=b(Yg.bottom)?Yg.bottom:e),"y2"===c&&fh&&(f=b(fh.top)?fh.top:e,g=b(fh.bottom)?fh.bottom:e),Nd(l)&&!Kc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Ci),c=$b(Qf.domain());return a||0===c?1:b/c}function Wb(a){return Og?Og:df.min(a,function(a){return df.min(a.values,function(a){return a.x})})}function Xb(a){return Ng?Ng:df.max(a,function(a){return df.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return Vh?d=0:Nd(a)?(c=tc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=Uh?new Date(c.getTime()-e):c-e,g=Uh?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return $f&&a===$f||ge(_f)&&he(_f,a)}function fc(a){return!ec(a)}function gc(a){return $f?$f:ge(_f)?_f[a]:null}function hc(a,b){return a in ef.data.x&&ef.data.x[a]&&ef.data.x[a][b]?ef.data.x[a][b]:b}function ic(a){Object.keys(a).forEach(function(b){_f[b]=a[b]})}function jc(a){var b;return a&&(b=cg[a.id],a.name=b?b:a.id),a}function kc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=mc(b[d],a.id,d)}),ef.data.x[a.id]=b})}function lc(a,b){a.forEach(function(a){b[a.id]&&kc([a],b[a.id])})}function mc(a,b,c){var d;return d=Uh?a?a instanceof Date?a:be(a):be(hc(b,c)):Wh&&!Vh?a?+a:hc(b,c):c}function nc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?ef.data.x[b]=a.map(function(a){return a[c]}):$f&&e.length>0&&(ef.data.x[b]=ef.data.x[e[0]]):ef.data.x[b]=a.map(function(a,b){return b})}),c.forEach(function(a){if(!ef.data.x[a])throw new Error('x is not defined for id = "'+a+'".')}),b=c.map(function(b,c){var d=bg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=mc(g,b,e);return Wh&&Vh&&0===c&&g&&(0===e&&(Gg=[]),Gg.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++})}),fg&&Ld(vc(b).filter(function(a){return!(a in gg)}),fg),b.forEach(function(a){ac(a.id_org,a)}),b}function qc(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 rc(a){return a>0&&ef.data.targets[0].values[a-1]?ef.data.targets[0].values[a-1].x:void 0}function sc(a){return a1?ef.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?ef.data.targets[0]:null,a}function vc(a){return a.map(function(a){return a.id})}function wc(a){return a?"string"==typeof a?[a]:a:vc(ef.data.targets)}function xc(a,b){var c,d=vc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(Uh?new Date(h):h);i.push(d)}return i}function Ec(a){ci=ci.concat(a)}function Fc(a){ci=ci.filter(function(b){return a.indexOf(b)<0})}function Gc(a){di=di.concat(a)}function Hc(a){di=di.filter(function(b){return a.indexOf(b)<0})}function Ic(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Jc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Lc(a){return Jc(a,function(a){return a>0})}function Mc(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(rd(a,f))),a[g].x&&(e=e.concat(rd(a,g))),ud(e,b)):sd(a,b,f,g)}function td(a,b){var c;return c=a.map(function(a){return sd(a.values,b)}),ud(c,b)}function ud(a,b){var c,d;return a.forEach(function(a){var e=ie(a,b);(c>e||!c)&&(c=e,d=a)}),d}function vd(a,b){return df.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function wd(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 xd(){return ig&&"desc"===ig.toLowerCase()}function yd(){return ig&&"asc"===ig.toLowerCase()}function zd(a){var b=yd(),c=xd();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 ig&&a.sort(ig),a}function Ad(a,c){var d,e,f,g,h,i,j,k=Rd(ef.data.targets),l=k?ld:kd,m=a.filter(function(a){return a&&b(a.value)});Hh&&0!==m.length&&(Ai.html(Kh(a,$(),l,ai)).style("display","block"),d=Ai.property("offsetWidth"),e=Ai.property("offsetHeight"),k?(g=vf/2+c[0],i=xf/2+c[1]+20):(Eg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Qf(m[0].x)+20):(f=q(),g=f+t()+Qf(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Ai.style("top",i+"px").style("left",g+"px"))}function Bd(){Ai.style("display","none")}function Cd(a){var c=a.filter(function(a){return a&&b(a.value)});Hh&&(Od(ef.data.targets)||Rd(ef.data.targets)||xi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Eg?"y1":"x1",nd).attr(Eg?"y2":"x2",nd))}function Dd(){xi.select("line."+f.xgridFocus).style("visibility","hidden")}function Ed(a){return a.x||0===a.x?Qf(a.x):null}function Fd(a){return V(a.id)(a.value)}function Gd(){var a,b,d={},e=0;return Bc(yc(Ud)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Kd(a,b){return th?th:b?2*a.tickOffset()*uh/b:0}function Ld(a,b){wc(a).forEach(function(a){Ei[a]=b===gg[a],gg[a]=b})}function Md(a,b){var c=!1;return a.forEach(function(a){gg[a.id]===b&&(c=!0),a.id in gg||"line"!==b||(c=!0)}),c}function Nd(a){return Md(a,"bar")}function Od(a){return Md(a,"scatter")}function Pd(a){return Md(a,"pie")}function Qd(a){return Md(a,"donut")}function Rd(a){return Pd(a)||Qd(a)}function Sd(a){var b="string"==typeof a?a:a.id;return!(b in gg)||"line"===gg[b]||"spline"===gg[b]||"area"===gg[b]||"area-spline"===gg[b]}function Td(a){var b="string"==typeof a?a:a.id;return"spline"===gg[b]||"area-spline"===gg[b]}function Ud(a){var b="string"==typeof a?a:a.id;return"bar"===gg[b]}function Vd(a){var b="string"==typeof a?a:a.id;return"scatter"===gg[b]}function Wd(a){var b="string"==typeof a?a:a.id;return"pie"===gg[b]}function Xd(a){var b="string"==typeof a?a:a.id;return"donut"===gg[b]}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){return Ud(a)?a.values:[]}function $d(a){return Sd(a)||Vd(a)?a.values:[]}function _d(a){return Ud(a)||Sd(a)?a.values:[]}function ae(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function be(b){var c;if(!b)throw Error(b+" can not be parsed as d3.time with format "+ag+". Maybe 'x' of this data is not defined. See data.x or data.xs option.");try{c=ag?df.time.format(ag).parse(b):new Date(b)}catch(d){c=void 0}return c||a.console.error("Failed to parse x '"+b+"' to Date with format "+ag),c}function ce(a,b){var c=df.mouse(a),d=df.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function he(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ie(a,b){var c="y"===Z(a.id)?Rf:Sf,d=Eg?1:0,e=Eg?0:1;return Math.pow(Qf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function je(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function ke(a,b,c){tg(b,a.node()),xi.select("."+f.selectedCircles+_c(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Nc(f.selectedCircle,c)}).attr("cx",Eg?Fd:Ed).attr("cy",Eg?Ed:Fd).attr("stroke",function(){return ai(b)}).attr("r",1.4*sh).transition().duration(100).attr("r",sh)}function le(a,b,c){ug(b,a.node()),xi.select("."+f.selectedCircles+_c(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function me(a,b,c,d){a?ke(b,c,d):le(b,c,d)}function ne(a,b){tg(b,a.node()),a.transition().duration(100).style("fill",function(){return df.rgb(ai(b)).darker(1)})}function oe(a,b){ug(b,a.node()),a.transition().duration(100).style("fill",function(){return ai(b)})}function pe(a,b,c,d){a?ne(b,c,d):oe(b,c,d)}function qe(a){return a.filter(function(a){return b(a.value)})}function re(a,c){return(c?xi.selectAll("."+f.circles+_c(c)):xi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function se(a,b){re(a,b).classed(f.EXPANDED,!0).attr("r",rh)}function te(a){re(a).filter(function(){return df.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",oh)}function ue(a){return xi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function ve(a){ue(a).classed(f.EXPANDED,!0)}function we(a){ue(a).classed(f.EXPANDED,!1)}function xe(a,b){var c=Be(a,b);return function(a,b){var d=c(a,b),e=Eg?1:0,f=Eg?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 ye(a,b){var c=Be(a,!1),d=b?ze:Ae;return function(a,b){return d(c(a,b),a,this)}}function ze(a,b){var c;return Eg?(c=Ud(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ae(a,b,c){var d=c.getBBox();return Eg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:Ud(b)?-3:-6)}function Be(a,b){var c=a.__max__+1,d=Kd(Wf,c),e=Hd(d,c,a,!!b),f=Id(!!b),g=Jd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Eg&&(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 Ce(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 De(b){var c,d,e;if(Bi=df.select(gf),Bi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Bi.html(""),Bi.classed("c3",!0),ef.data.x={},ef.data.targets=pc(b),n(),R(),Qf.domain(df.extent(Zb(ef.data.targets))),Rf.domain(Ub(ef.data.targets,"y")),Sf.domain(Ub(ef.data.targets,"y2")),Tf.domain(Qf.domain()),Uf.domain(Rf.domain()),Vf.domain(Sf.domain()),Ci=Qf.domain(),qi.scale(Tf),mf&&ui.scale(Qf),vi=Bi.append("svg").attr("width",vf+sf.left+sf.right).attr("height",xf+sf.top+sf.bottom).on("mouseenter",pf).on("mouseleave",qf),wi=vi.append("defs"),wi.append("clipPath").attr("id",Oh).append("rect").attr("width",vf).attr("height",xf),wi.append("clipPath").attr("id",Ph).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),wi.append("clipPath").attr("id",Qh).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),xi=vi.append("g").attr("transform",ii.main),yi=xg?vi.append("g").attr("transform",ii.context):null,zi=vi.append("g").attr("transform",ii.legend),Ag||(zi.style("visibility","hidden"),di=vc(ef.data.targets)),Ai=df.select(gf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),$e(vc(ef.data.targets),{withTransform:!1,withTransitionForTransform:!1}),xi.append("g").attr("class",f.axisX).attr("clip-path",Eg?"":Sh).attr("transform",ii.x).append("text").attr("class",f.axisXLabel).attr("transform",Eg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),Rg&&xi.append("g").attr("class",f.axisY).attr("clip-path",Eg?Th:"").attr("transform",ii.y).append("text").attr("class",f.axisYLabel).attr("transform",Eg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),$g&&xi.append("g").attr("class",f.axisY2).attr("transform",ii.y2).append("text").attr("class",f.axisY2Label).attr("transform",Eg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=xi.append("g").attr("clip-path",Rh).attr("class",f.grid),hh&&d.append("g").attr("class",f.xgrids),ge(jh)&&d.append("g").attr("class",f.xgridLines),ph&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),kh&&d.append("g").attr("class",f.ygrids),ge(lh)&&d.append("g").attr("class",f.ygridLines),xi.append("g").attr("clip-path",Rh).attr("class",f.regions),xi.append("g").attr("clip-path",Rh).attr("class",f.chart),c=xi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",mf?Eg?"ns-resize":"ew-resize":null),xi.select("."+f.chart).append("g").attr("class",f.chartBars),xi.select("."+f.chart).append("g").attr("class",f.chartLines),xi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",ii.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),xi.select("."+f.chart).append("g").attr("class",f.chartTexts),mf&&xi.insert("rect",of?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",vf).attr("height",xf).style("opacity",0).style("cursor",Eg?"ns-resize":"ew-resize").call(ui).on("dblclick.zoom",null),Pg&&qi.extent("function"!=typeof Pg?Pg:Pg(Zb())),xg&&(yi.append("g").attr("clip-path",Rh).attr("class",f.chart),yi.select("."+f.chart).append("g").attr("class",f.chartBars),yi.select("."+f.chart).append("g").attr("class",f.chartLines),yi.append("g").attr("clip-path",Rh).attr("class",f.brush).call(qi).selectAll("rect").attr(Eg?"width":"height",Eg?wf:yf),yi.append("g").attr("class",f.axisX).attr("transform",ii.subx).attr("clip-path",Eg?"":Sh)),Qe(ef.data.targets),Eg?xi.select("."+f.axisX).style("opacity",0).call(Wf):(xi.select("."+f.axisY).style("opacity",0).call(Xf),xi.select("."+f.axisY2).style("opacity",0).call(Yf)),Ke({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Lh){if(Uh&&"string"==typeof Mh){for(Mh=be(Mh),e=0;e0){d=[];for(var g in cg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=wd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=pe,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 Ie(a){Rd(ef.data.targets)||mg&&(Xh=a,xi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Yh=!0,vg())}function Je(){Rd(ef.data.targets)||mg&&(xi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),xi.selectAll("."+f.shape).classed(f.INCLUDED,!1),Yh=!1,wg())}function Ke(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S=Gd(),T=Rd(ef.data.targets),U=Bc(ef.data.targets);if(0!==U.length){if(a=d(a)?a:{},x=d(a.withY)?a.withY:!0,y=d(a.withSubchart)?a.withSubchart:!0,z=d(a.withTransition)?a.withTransition:!0,D=d(a.withTransform)?a.withTransform:!1,E=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,F=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,G=d(a.withLegend)?a.withLegend:!1,A=d(a.withTransitionForExit)?a.withTransitionForExit:z,B=d(a.withTransitionForAxis)?a.withTransitionForAxis:z,C=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:z,M=z?rf:0,N=A?M:0,O=B?M:0,G&&Ag&&$e(vc(ef.data.targets),a),F&&(Qf.domain(df.extent(Zb(U))),Ci=Qf.domain(),mf&&ui.scale(Qf).updateScaleExtent(),Tf.domain(Qf.domain()),qi.scale(Tf)),E&&(Qf.domain(qi.empty()?Ci:qi.extent()),mf&&ui.scale(Qf).updateScaleExtent()),Rf.domain(Ub(U,"y")),Sf.domain(Ub(U,"y2")),Od(U)||(P=Dc(Cc(U)).sort(),Wf.tickValues(P),Zf.tickValues(P)),c=xi.select("."+f.axisX).style("opacity",T?0:1),(Eg||C)&&(c=c.transition().duration(O)),c.call(Wf),e=xi.select("."+f.axisY).style("opacity",T?0:1),(!Eg||C)&&(e=e.transition().duration(O)),e.call(Xf),xi.select("."+f.axisY2).style("opacity",T?0:1).transition().duration(O).call(Yf),E&&Jg&&P){for(Q=1;Q=Y;Y++)h.push(new Date(Y+"-01-01 00:00:00"))}else h=Qf.ticks(10);g=xi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Eg?0:function(a){return Qf(a)-Wf.tickOffset()}).attr("x2",Eg?vf:function(a){return Qf(a)-Wf.tickOffset()}).attr("y1",Eg?function(a){return Qf(a)-Wf.tickOffset()}:sf.top).attr("y2",Eg?function(a){return Qf(a)-Wf.tickOffset()}:xf).style("opacity",function(){return+df.select(this).attr(Eg?"y1":"x1")===(Eg?xf:0)?0:1}),g.exit().remove()}ge(jh)&&(i=xi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(jh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Eg?"":"rotate(-90)").attr("dx",Eg?0:-sf.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(M).attr("x1",Eg?0:od).attr("x2",Eg?vf:od).attr("y1",Eg?od:sf.top).attr("y2",Eg?od:xf).style("opacity",1),i.select("text").transition().duration(M).attr("x",Eg?vf:0).attr("y",od).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(M).style("opacity",0).remove()),x&&kh&&(k=xi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Rf.ticks(mh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Eg?Rf:0).attr("x2",Eg?Rf:vf).attr("y1",Eg?0:Rf).attr("y2",Eg?xf:Rf),k.exit().remove()),x&&ge(lh)&&(l=xi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(lh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Eg?"rotate(-90)":"").attr("dx",Eg?0:-sf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(M).attr("x1",Eg?pd:0).attr("x2",Eg?pd:vf).attr("y1",Eg?0:pd).attr("y2",Eg?xf:pd).style("opacity",1),l.select("text").transition().duration(M).attr("x",Eg?0:vf).attr("y",pd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(M).style("opacity",0).remove()),p=xi.selectAll("."+f.bars).selectAll("."+f.bar).data(Zd),p.enter().append("path").attr("d",H).style("stroke","none").style("opacity",0).style("fill",function(a){return ai(a)}).attr("class",Vc),p.style("opacity",ed).transition().duration(M).attr("d",H).style("opacity",1),p.exit().transition().duration(N).style("opacity",0).remove(),r=xi.selectAll("."+f.texts).selectAll("."+f.text).data(_d),r.enter().append("text").attr("class",Oc).attr("text-anchor",function(a){return Eg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return md(a.id)(a.value)}).style("fill-opacity",fd).transition().duration(M).attr("x",J).attr("y",K).style("fill-opacity",hd),r.exit().transition().duration(N).style("fill-opacity",0).remove(),xi.selectAll("."+f.line).style("opacity",ed).transition().duration(M).attr("d",ri).style("opacity",1),xi.selectAll("."+f.area).style("opacity",0).transition().duration(M).attr("d",si).style("opacity",Di),n=xi.selectAll("."+f.circles).selectAll("."+f.circle).data($d),n.enter().append("circle").attr("class",Tc).style("opacity",0).attr("r",oh),n.style("opacity",ed).transition().duration(M).style("opacity",gd).attr("cx",Eg?Fd:Ed).attr("cy",Eg?Ed:Fd),n.exit().remove(),xi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",D?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(M).attrTween("d",function(a){var b,c=Cb(a);return c?(b=df.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",D?"scale(1)":"").style("opacity",1),xi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(M).text(Jb).style("opacity",function(a){return zc(a.data.id)&&Yd(a.data)?1:0}),xi.select("."+f.chartArcsTitle).style("opacity",Qd(ef.data.targets)?1:0),xg&&(null!==df.event&&"zoom"===df.event.type&&qi.extent(Qf.orgDomain()).update(),y&&(yi.select("."+f.axisX).style("opacity",T?0:1).transition().duration(M).call(Zf),qi.empty()||qi.extent(Qf.orgDomain()).update(),I=xe(S,!0),s=yi.selectAll("."+f.bars).selectAll("."+f.bar).data(Zd),s.enter().append("path").attr("d",I).style("stroke","none").style("fill",function(a){return ai(a)}).attr("class",Vc),s.style("opacity",ed).transition().duration(M).attr("d",I).style("opacity",1),s.exit().transition().duration(M).style("opacity",0).remove(),yi.selectAll("."+f.line).style("opacity",ed).transition().duration(M).attr("d",ti).style("opacity",1))),xi.selectAll("."+f.selectedCircles).filter(function(a){return Ud(a)}).selectAll("circle").remove(),xi.selectAll("."+f.selectedCircle).transition().duration(M).attr("cx",Eg?Fd:Ed).attr("cy",Eg?Ed:Fd),ge(_f)?(t=xi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Fe(t.enter()),t.attr("x",0).attr("y",0).attr("width",vf).attr("height",xf)):(Wh&&!Vh?(w=function(a,b){var c=rc(b),d=sc(b),e=ef.data.x[a.id][b];return(Qf(d?d:e+50)-Qf(c?c:e-50))/2},v=function(a,b){var c=rc(b),d=ef.data.x[a.id][b];return(Qf(d)+Qf(c?c:d-50))/2}):(w=L(),v=function(a){return Qf(a.x)-w/2}),u=uc(),xi.select("."+f.eventRects).datum(u?u.values:[]),t=xi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ee(t.enter()),t.attr("class",$c).attr("x",Eg?0:v).attr("y",Eg?v:0).attr("width",Eg?vf:w).attr("height",Eg?w:xf),t.exit().remove()),q=xi.select("."+f.regions).selectAll("rect."+f.region).data(Gh),q.enter().append("rect").style("fill-opacity",0),q.attr("class",Zc).attr("x",Eg?0:cc).attr("y",Eg?cc:sf.top).attr("width",Eg?vf:dc).attr("height",Eg?dc:xf).transition().duration(M).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(M).style("fill-opacity",0).remove(),vc(ef.data.targets).forEach(function(a){Ei[a]=!0})}}function Le(){Ke({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Me(){return"mousemove"===df.event.sourceEvent.type&&ui.altDomain?(Qf.domain(ui.altDomain),void ui.scale(Qf).updateScaleExtent()):(Vh&&Qf.orgDomain()[0]===Ci[0]&&Qf.domain([Ci[0]-1e-10,Qf.orgDomain()[1]]),Ke({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===df.event.sourceEvent.type&&(Zh=!0)))}function Ne(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Oe(){vi.attr("width",zf).attr("height",Af),vi.select("#"+Oh).select("rect").attr("width",vf).attr("height",xf),vi.select("#"+Ph).select("rect").attr("width",H),vi.select("#"+Qh).select("rect").attr("width",J),vi.select("."+f.zoomRect).attr("width",vf).attr("height",xf)}function Pe(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Oe(),m(a.withTransition),Ke(a)}function Qe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=xi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a),j=i.enter().append("g").attr("class",function(a){return f.chartText+Nc(f.target,a.id)}).style("pointer-events","none"),j.append("g").attr("class",Pc).style("fill",function(a){return ai(a)}),e=xi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),d=e.enter().append("g").attr("class",function(a){return f.chartBar+Nc(f.target,a.id)}).style("pointer-events","none"),d.append("g").attr("class",Wc).style("fill",function(a){return ai(a)}).style("stroke","none").style("cursor",function(a){return og(a)?"pointer":null}),c=xi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),b=c.enter().append("g").attr("class",function(a){return f.chartLine+Nc(f.target,a.id)}).style("pointer-events","none"),b.append("path").attr("class",Sc).style("opacity",0).style("stroke",function(a){return ai(a)}),b.append("path").attr("class",Yc).style("opacity",function(){return Di=+df.select(this).style("opacity"),0}).style("fill",function(a){return ai(a)}),b.append("g").attr("class",function(a){return Nc(f.selectedCircles,a.id)}),b.append("g").attr("class",Uc).style("fill",function(a){return ai(a)}).style("cursor",function(a){return og(a)?"pointer":null}),a.forEach(function(a){xi.selectAll("."+f.selectedCircles+_c(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=xi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Hf(a)),g=h.enter().append("g").attr("class",function(a){return f.chartArc+Nc(f.target,a.data.id)}),g.append("path").attr("class",Xc).style("opacity",0).style("fill",function(a){return ai(a.data)}).style("cursor",function(a){return og(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),Ve(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Ad(c,df.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),Xe(),Bd(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),xg&&(n=yi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),m=n.enter().append("g").attr("class",function(a){return f.chartBar+Nc(f.target,a.id)}),m.append("g").attr("class",Wc).style("fill",function(a){return ai(a)}),l=yi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),k=l.enter().append("g").attr("class",function(a){return f.chartLine+Nc(f.target,a.id)}),k.append("path").attr("class",Sc).style("opacity",0).style("stroke",function(a){return ai(a)})),vi.selectAll("."+f.target).filter(function(a){return zc(a.id)}).transition().style("opacity",1)}function Re(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Ld(a.id,b.types[a.id]):Ld(a.id,b.type)}),ef.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBBox(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=ji?j:i,l=ji?Q():P();return d&&(w=0,C=0,t=0,u=0),Ag&&!Ac(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=ji?u:t,void(Dg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,ji?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=zi.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Nc(f.legendItem,a)}).style("visibility",function(a){return Ac(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Cg?Cg(a):ef.toggle(a)}).on("mouseover",function(a){ef.focus(a)}).on("mouseout",function(){ef.revert()}),l.append("text").text(function(a){return d(cg[a])?cg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",ji?g:-200).attr("y",ji?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",ji?h:-200).attr("y",ji?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return ai(a)}).attr("x",ji?g:-200).attr("y",ji?-200:i).attr("width",10).attr("height",10),zi.selectAll("text").data(a).text(function(a){return d(cg[a])?cg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),zi.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),zi.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Oe(),q&&m(p)}function _e(a){return xc(ef.data.targets,a.id)}function af(a){return"data"in a&&xc(ef.data.targets,a.data.id)}function bf(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 cf(a,b,c){var d=!Rd(ef.data.targets);Ld(a,b),Pe(c?c:{withTransitionForAxis:d})}var df=a.d3?a.d3:a.require?a.require("d3"):void 0,ef={data:{},axis:{},legend:{}},ff={},gf=h(["bindto"],"#chart"),hf=h(["size","width"]),jf=h(["size","height"]),kf=h(["padding","left"]),lf=h(["padding","right"]),mf=h(["zoom","enabled"],!1),nf=h(["zoom","extent"]),of=h(["zoom","privileged"],!1),pf=h(["onenter"],function(){}),qf=h(["onleave"],function(){}),rf=h(["transition","duration"],350);g("data","data is required in config");var 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,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f=h(["data","x"]),_f=h(["data","xs"],{}),ag=h(["data","x_format"]),bg=h(["data","id_converter"],function(a){return a}),cg=h(["data","names"],{}),dg=h(["data","groups"],[]),eg=h(["data","axes"],{}),fg=h(["data","type"]),gg=h(["data","types"],{}),hg=h(["data","labels"],{}),ig=h(["data","order"]),jg=h(["data","regions"],{}),kg=h(["data","color"]),lg=h(["data","colors"],{}),mg=h(["data","selection","enabled"],!1),ng=h(["data","selection","grouped"],!1),og=h(["data","selection","isselectable"],function(){return!0}),pg=h(["data","selection","multiple"],!0),qg=h(["data","onclick"],function(){}),rg=h(["data","onenter"],function(){}),sg=h(["data","onleave"],function(){}),tg=h(["data","onselected"],function(){}),ug=h(["data","onunselected"],function(){}),vg=h(["data","ondragstart"],function(){}),wg=h(["data","ondragend"],function(){}),xg=h(["subchart","show"],!1),yg=xg?h(["subchart","size","height"],60):0,zg=h(["color","pattern"],[]),Ag=h(["legend","show"],!0),Bg=h(["legend","position"],"bottom"),Cg=h(["legend","item","onclick"]),Dg=h(["legend","equally"],!1),Eg=h(["axis","rotated"],!1),Fg=h(["axis","x","type"],"indexed"),Gg=h(["axis","x","categories"],[]),Hg=h(["axis","x","tick","centered"],!1),Ig=h(["axis","x","tick","format"]),Jg=h(["axis","x","tick","culling"],{}),Kg=h(["axis","x","tick","culling","max"],"categorized"===Fg?1/0:10),Lg=h(["axis","x","tick","count"]),Mg=h(["axis","x","tick","fit"],!1),Ng=h(["axis","x","max"]),Og=h(["axis","x","min"]),Pg=h(["axis","x","default"]),Qg=h(["axis","x","label"],{}),Rg=h(["axis","y","show"],!0),Sg=h(["axis","y","max"]),Tg=h(["axis","y","min"]),Ug=h(["axis","y","center"]),Vg=h(["axis","y","label"],{}),Wg=h(["axis","y","inner"],!1),Xg=h(["axis","y","tick","format"]),Yg=h(["axis","y","padding"],{}),Zg=h(["axis","y","ticks"],10),$g=h(["axis","y2","show"],!1),_g=h(["axis","y2","max"]),ah=h(["axis","y2","min"]),bh=h(["axis","y2","center"]),ch=h(["axis","y2","label"],{}),dh=h(["axis","y2","inner"],!1),eh=h(["axis","y2","tick","format"]),fh=h(["axis","y2","padding"],{}),gh=h(["axis","y2","ticks"],10),hh=h(["grid","x","show"],!1),ih=h(["grid","x","type"],"tick"),jh=h(["grid","x","lines"],[]),kh=h(["grid","y","show"],!1),lh=h(["grid","y","lines"],[]),mh=h(["grid","y","ticks"],10),nh=h(["point","show"],!0),oh=nh?h(["point","r"],2.5):0,ph=h(["point","focus","line","enabled"],!0),qh=h(["point","focus","expand","enabled"],!0),rh=h(["point","focus","expand","r"],qh?4:oh),sh=h(["point","focus","select","r"],8),th=h(["bar","width"]),uh=h(["bar","width","ratio"],.6),vh=h(["pie","label","show"],!0),wh=h(["pie","label","format"]),xh=h(["pie","onclick"],function(){}),yh=h(["pie","onmouseover"],function(){}),zh=h(["pie","onmouseout"],function(){}),Ah=h(["donut","label","show"],!0),Bh=h(["donut","label","format"]),Ch=h(["donut","title"],""),Dh=h(["donut","onclick"],function(){}),Eh=h(["donut","onmouseover"],function(){}),Fh=h(["donut","onmouseout"],function(){}),Gh=h(["regions"],[]),Hh=h(["tooltip","show"],!0),Ih=h(["tooltip","format","title"]),Jh=h(["tooltip","format","value"]),Kh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Ih?Ih:b,l=Jh?Jh: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+""}),Lh=h(["tooltip","init","show"],!1),Mh=h(["tooltip","init","x"],0),Nh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Oh=("string"==typeof gf?gf.replace("#",""):gf.id)+"-clip",Ph=Oh+"-xaxis",Qh=Oh+"-yaxis",Rh=i(Oh),Sh=i(Sh),Th=i(Th),Uh="timeseries"===Fg,Vh="categorized"===Fg,Wh=!Uh&&($f||ge(_f)),Xh=null,Yh=!1,Zh=!1,$h=!1,_h=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ai=ae(lg,ge(zg)?zg:_h,kg),bi=function(){var a=[[df.time.format("%Y/%-m/%-d"),function(){return!0}],[df.time.format("%-m/%-d"),function(a){return a.getMonth()}],[df.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[df.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[df.time.format("%I %p"),function(a){return a.getHours()}],[df.time.format("%I:%M"),function(a){return a.getMinutes()}],[df.time.format(":%S"),function(a){return a.getSeconds()}],[df.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)}}(),ci=[],di=[],ei=Eg?"left":"bottom",fi=Eg?Wg?"top":"bottom":Wg?"right":"left",gi=Eg?dh?"bottom":"top":dh?"left":"right",hi=Eg?"left":"bottom",ii={main:function(){return"translate("+sf.left+","+sf.top+")"},context:function(){return"translate("+tf.left+","+tf.top+")"},legend:function(){return"translate("+uf.left+","+uf.top+")"},x:function(){return"translate(0,"+(Eg?0:xf)+")"},y:function(){return"translate(0,"+(Eg?xf:0)+")"},y2:function(){return"translate("+(Eg?0:vf)+","+(Eg?1:0)+")"},subx:function(){return"translate(0,"+(Eg?0:yf)+")"},arc:function(){return"translate("+vf/2+","+xf/2+")"}},ji="right"===Bg,ki=0,li=0,mi=0,ni=30,oi=30,pi=5;Hf=df.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var qi,ri=function(){var a=df.svg.line().x(Eg?function(a){return V(a.id)(a.value)}:nd).y(Eg?nd:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=qe(b.values);return Sd(b)?(a.interpolate(Td(b)?"cardinal":"linear"),jg[b.id]?Ce(e,Qf,V(b.id),jg[b.id]):a(e)):(c=Qf(e[0].x),d=V(b.id)(e[0].value),Eg?"M "+d+" "+c:"M "+c+" "+d)}}(),si=function(){var a;return a=Eg?df.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(nd):df.svg.area().x(nd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=qe(b.values);return Md([b],"area")||Md([b],"area-spline")?(a.interpolate(Td(b)?"cardinal":"linear"),a(e)):(c=Qf(e[0].x),d=V(b.id)(e[0].value),Eg?"M "+d+" "+c:"M "+c+" "+d)}}(),ti=function(){var a=df.svg.line().x(Eg?function(a){return W(a.id)(a.value)}:qd).y(Eg?qd:function(a){return W(a.id)(a.value)});return function(b){var c=qe(b.values);return Sd(b)?a(c):"M "+Tf(c[0].x)+" "+W(b.id)(c[0].value)}}(),ui=function(){};qi=df.svg.brush().on("brush",Le),qi.update=function(){return yi&&yi.select("."+f.brush).call(this),this},qi.scale=function(a){return Eg?this.y(a):this.x(a)},mf&&(ui=df.behavior.zoom().on("zoomstart",function(){ui.altDomain=df.event.sourceEvent.altKey?Qf.orgDomain():null}).on("zoom",mf?Me:null),ui.scale=function(a){return Eg?this.y(a):this.x(a)},ui.orgScaleExtent=function(){var a=nf?nf:[1,10];return[a[0],Math.max(tc()/a[1],a[1])]},ui.updateScaleExtent=function(){var a=$b(Qf.orgDomain())/$b(Ci),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var vi,wi,xi,yi,zi,Ai,Bi,Ci,Di,Ei={};if(ef.focus=function(a){function b(a){Bc(a).transition().duration(100).style("opacity",1)}var c=vi.selectAll(ad(a)),d=c.filter(_e),e=c.filter(af);ef.revert(),ef.defocus(),b(d.classed(f.focused,!0)),b(e),Rd(ef.data.targets)&&Kb(a,!0),Ve(a)},ef.defocus=function(a){function b(a){Bc(a).transition().duration(100).style("opacity",.3)}var c=vi.selectAll(ad(a)),d=c.filter(_e),e=c.filter(af);ef.revert(),b(d.classed(f.focused,!1)),b(e),Rd(ef.data.targets)&&Lb(a),We(a)},ef.revert=function(a){function b(a){Bc(a).transition().duration(100).style("opacity",1)}var c=vi.selectAll(ad(a)),d=c.filter(_e),e=c.filter(af);b(d.classed(f.focused,!1)),b(e),Rd(ef.data.targets)&&Lb(a),Xe()},ef.show=function(a,b){a=wc(a),b=b||{},Fc(a),vi.selectAll(bd(a)).transition().style("opacity",1),b.withLegend&&Ye(a),Ke({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},ef.hide=function(a,b){a=wc(a),b=b||{},Ec(a),vi.selectAll(bd(a)).transition().style("opacity",0),b.withLegend&&Ze(a),Ke({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},ef.toggle=function(a){zc(a)?ef.hide(a):ef.show(a)},ef.unzoom=function(){qi.clear().update(),Ke({withUpdateXDomain:!0})},ef.load=function(a){return a.xs&&ic(a.xs),"categories"in a&&Vh&&(Gg=a.categories,Wf.categories(Gg)),"cacheIds"in a&&_b(a.cacheIds)?void Re(bc(a.cacheIds),a.done):void("unload"in a?Te(wc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Se(a)}):Se(a))},ef.unload=function(a){Te(wc(a),function(){Ke({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},ef.selected=function(a){return df.merge(xi.selectAll("."+f.shapes+_c(a)).selectAll("."+f.shape).filter(function(){return df.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},ef.select=function(a,b,c){mg&&xi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=df.select(this),i="circle"===this.nodeName?ke:ne,j="circle"===this.nodeName?le:oe,k=ng||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?og(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},ef.unselect=function(a,b){mg&&xi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=df.select(this),g="circle"===this.nodeName?le:oe,h=ng||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&og(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},ef.toLine=function(a){cf(a,"line")},ef.toSpline=function(a){cf(a,"spline")},ef.toBar=function(a){cf(a,"bar")},ef.toScatter=function(a){cf(a,"scatter")},ef.toArea=function(a){cf(a,"area")},ef.toAreaSpline=function(a){cf(a,"area-spline")},ef.toPie=function(a){cf(a,"pie",{withTransform:!0})},ef.toDonut=function(a){cf(a,"donut",{withTransform:!0})},ef.groups=function(a){return c(a)?dg:(dg=a,Ke(),dg)},ef.xgrids=function(a){return a?(jh=a,Ke(),jh):jh},ef.xgrids.add=function(a){return a?ef.xgrids(jh.concat(a)):void 0},ef.xgrids.remove=function(a){var b=bf(a);return ef.xgrids(jh.filter(b))},ef.ygrids=function(a){return a?(lh=a,Ke(),lh):lh},ef.ygrids.add=function(a){return a?ef.ygrids(lh.concat(a)):void 0},ef.ygrids.remove=function(a){var b=bf(a);return ef.ygrids(lh.filter(b))},ef.regions=function(a){return c(a)?Gh:(Gh=a,Ke(),Gh)},ef.regions.add=function(a){return c(a)?Gh:(Gh=Gh.concat(a),Ke(),Gh)},ef.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;vi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Gh=Gh.filter(function(b){return b.classes.indexOf(a)<0})}),Gh},ef.data.get=function(a){var b=ef.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},ef.data.getAsTarget=function(a){var b=yc(function(b){return b.id===a});return b.length>0?b[0]:void 0},ef.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){cg[b]=a[b]}),$e(vc(ef.data.targets),{withTransition:!0}),cg):cg},ef.x=function(a){return arguments.length&&(kc(ef.data.targets,a),Ke({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),ef.data.x},ef.xs=function(a){return arguments.length&&(lc(ef.data.targets,a),Ke({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),ef.data.x},ef.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},ef.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Sg=+a.y),b(a.y2)&&(_g=+a.y2)):Sg=_g=+a,Ke()) },ef.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Tg=+a.y),b(a.y2)&&(ah=+a.y2)):Tg=ah=+a,Ke())},ef.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&ef.axis.max(a.max),"undefined"!=typeof a.min&&ef.axis.min(a.min))},ef.legend.show=function(a){Ag||(Ag=!0,zi.style("visibility","visible")),Ye(wc(a)),Ke({withTransitionForHorizontalAxis:!1})},ef.legend.hide=function(a){Ag&&fe(a)&&(Ag=!1,zi.style("visibility","hidden")),Ze(wc(a)),Ke({withTransitionForHorizontalAxis:!1})},ef.resize=function(a){hf=a?a.width:null,jf=a?a.height:null,Pe({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},ef.destroy=function(){ef.data.targets=void 0,ef.data.x={},Bi.html(""),a.onresize=null},"url"in e.data)df.csv(e.data.url,function(a,b){De(b)});else if("rows"in e.data)De(nc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");De(oc(e.data.columns))}return ef},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file diff --git a/package.json b/package.json index 5d200cd..7cd0834 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "c3", - "version": "0.1.28", + "version": "0.1.29", "description": "D3-based reusable chart library", "main": "c3.js", "scripts": { From 17b6e5531d5e2bbea7d5c298fb66101dac8cfc63 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Tue, 8 Apr 2014 10:14:49 +0900 Subject: [PATCH 018/178] Fix multiple xs processing - #125 --- c3.js | 69 ++++++++++++++++++++++++++++++++++++++++--------------- c3.min.js | 6 ++--- 2 files changed, 54 insertions(+), 21 deletions(-) diff --git a/c3.js b/c3.js index 525c993..f19e78e 100644 --- a/c3.js +++ b/c3.js @@ -21,6 +21,8 @@ selectedCircles: 'c3-selected-circles', eventRect: 'c3-event-rect', eventRects: 'c3-event-rects', + eventRectsSingle: 'c3-event-rects-single', + eventRectsMultiple: 'c3-event-rects-multiple', zoomRect: 'c3-zoom-rect', brush: 'c3-brush', focused: 'c3-focused', @@ -1263,14 +1265,26 @@ function getXKey(id) { return __data_x ? __data_x : notEmpty(__data_xs) ? __data_xs[id] : null; } + function getXValuesOfXKey(key, targets) { + var xValues, ids = targets && notEmpty(targets) ? mapToIds(targets) : []; + ids.forEach(function (id) { + if (getXKey(id) === key) { + xValues = c3.data.xs[id]; + } + }); + return xValues; + } function getXValue(id, i) { - return id in c3.data.x && c3.data.x[id] && c3.data.x[id][i] ? c3.data.x[id][i] : i; + return id in c3.data.xs && c3.data.xs[id] && c3.data.xs[id][i] ? c3.data.xs[id][i] : i; } function addXs(xs) { Object.keys(xs).forEach(function (id) { __data_xs[id] = xs[id]; }); } + function isSingleX(xs) { + return d3.set(Object.keys(xs).map(function (id) { return xs[id]; })).size() === 1; + } function addName(data) { var name; @@ -1286,7 +1300,7 @@ t.values.forEach(function (v, i) { v.x = generateTargetX(x[i], t.id, i); }); - c3.data.x[t.id] = x; + c3.data.xs[t.id] = x; }); } function updateTargetXs(targets, xs) { @@ -1338,25 +1352,31 @@ // save x for update data by load when custom x and c3.x API ids.forEach(function (id) { - var xKey = getXKey(id), idsForX = Object.keys(c3.data.x); + var xKey = getXKey(id), idsForX; if (isCustomX || isTimeSeries) { + // if included in input data if (xs.indexOf(xKey) >= 0) { - c3.data.x[id] = data.map(function (d) { return d[xKey]; }); + c3.data.xs[id] = data.map(function (d) { return d[xKey]; }).filter(isValue); + } + // if not included in input data, find from preloaded data of other id's x + else if (__data_x) { + idsForX = Object.keys(c3.data.xs); + c3.data.xs[id] = idsForX.length > 0 ? c3.data.xs[idsForX[0]] : undefined; } - // Use other id's x when same x (data.x option) specified. - else if (__data_x && idsForX.length > 0) { - c3.data.x[id] = c3.data.x[idsForX[0]]; + // if not included in input data, find from preloaded data + else if (notEmpty(__data_xs)) { + c3.data.xs[id] = getXValuesOfXKey(xKey, c3.data.targets); } // MEMO: if no x included, use same x of current will be used } else { - c3.data.x[id] = data.map(function (d, i) { return i; }); + c3.data.xs[id] = data.map(function (d, i) { return i; }); } }); // check x is defined ids.forEach(function (id) { - if (!c3.data.x[id]) { + if (!c3.data.xs[id]) { throw new Error('x is not defined for id = "' + id + '".'); } }); @@ -1375,7 +1395,7 @@ __axis_x_categories.push(rawX); } // mark as x = undefined if value is undefined and filter to remove after mapped - if (typeof d[id] === 'undefined') { + if (typeof d[id] === 'undefined' || c3.data.xs[id].length <= i) { x = undefined; } return {x: x, value: d[id] !== null && !isNaN(d[id]) ? +d[id] : null, id: convertedId}; @@ -2349,7 +2369,7 @@ selectChart.classed("c3", true); // Init data as targets - c3.data.x = {}; + c3.data.xs = {}; c3.data.targets = convertDataToTargets(data); // TODO: set names if names not specified @@ -2908,7 +2928,7 @@ function redraw(options) { var xaxis, yaxis, xgrid, xgridData, xgridLines, xgridLine, ygrid, ygridLines, ygridLine; - var mainCircle, mainBar, mainRegion, mainText, contextBar, eventRectUpdate; + var mainCircle, mainBar, mainRegion, mainText, contextBar, eventRect, eventRectUpdate; var barIndices = getBarIndices(), maxDataCountTarget; var rectX, rectW; var withY, withSubchart, withTransition, withTransitionForExit, withTransitionForAxis, withTransitionForHorizontalAxis, withTransform, withUpdateXDomain, withUpdateOrgXDomain, withLegend; @@ -3264,7 +3284,14 @@ .attr("cy", __axis_rotated ? circleX : circleY); // rect for mouseover - if (notEmpty(__data_xs)) { + eventRect = main.select('.' + CLASS.eventRects); + if (notEmpty(__data_xs) && !isSingleX(__data_xs)) { + + if (!eventRect.classed(CLASS.eventRectsMultiple)) { + eventRect.classed(CLASS.eventRectsMultiple, true).classed(CLASS.eventRectsSingle, false) + .selectAll('.' + CLASS.eventRect).remove(); + } + eventRectUpdate = main.select('.' + CLASS.eventRects).selectAll('.' + CLASS.eventRect) .data([0]); // enter : only one rect will be added @@ -3277,13 +3304,19 @@ .attr('height', height); // exit : not needed becuase always only one rect exists } else { + + if (!eventRect.classed(CLASS.eventRectsSingle)) { + eventRect.classed(CLASS.eventRectsMultiple, false).classed(CLASS.eventRectsSingle, true) + .selectAll('.' + CLASS.eventRect).remove(); + } + if (isCustomX && !isCategorized) { rectW = function (d, i) { - var prevX = getPrevX(i), nextX = getNextX(i), dx = c3.data.x[d.id][i]; + var prevX = getPrevX(i), nextX = getNextX(i), dx = c3.data.xs[d.id][i]; return (x(nextX ? nextX : dx + 50) - x(prevX ? prevX : dx - 50)) / 2; }; rectX = function (d, i) { - var prevX = getPrevX(i), dx = c3.data.x[d.id][i]; + var prevX = getPrevX(i), dx = c3.data.xs[d.id][i]; return (x(dx) + x(prevX ? prevX : dx - 50)) / 2; }; } else { @@ -4117,14 +4150,14 @@ updateTargetX(c3.data.targets, x); redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true}); } - return c3.data.x; + return c3.data.xs; }; c3.xs = function (xs) { if (arguments.length) { updateTargetXs(c3.data.targets, xs); redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true}); } - return c3.data.x; + return c3.data.xs; }; c3.axis.labels = function (labels) { @@ -4190,7 +4223,7 @@ c3.destroy = function () { c3.data.targets = undefined; - c3.data.x = {}; + c3.data.xs = {}; selectChart.html(""); window.onresize = null; }; diff --git a/c3.min.js b/c3.min.js index 27f061b..a290896 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.29"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",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;cvf&&(vf=0),0>xf&&(xf=0),tf={top:Eg?sf.top:Af-yg-(ji?0:a),right:0/0,bottom:20+(ji?0:a),left:Eg?ni:sf.left},wf=Eg?sf.left-ni-oi:vf,yf=Eg?xf:Af-tf.top-tf.bottom,0>wf&&(wf=0),0>yf&&(yf=0),uf={top:ji?0:Af-a,right:0/0,bottom:0,left:ji?zf-b:0},p(),ji&&Rd(ef.data.targets)&&(uf.left=vf/2+Cf)}function o(){xi.select("line."+f.xgridFocus).attr("x1",Eg?0:-10).attr("x2",Eg?vf:-10).attr("y1",Eg?-10:sf.top).attr("y2",Eg?-10:xf)}function p(){Cf=xf/2,Bf=.95*Cf,Df=Qd(ef.data.targets)?.6*Bf:0}function q(){var a=Eg?f.axisX:f.axisY,b=df.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=df.select(gf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return hf?hf:x()}function s(){var a=jf?jf:y();return a>0?a:320}function t(){return Rd(ef.data.targets)?0:kf?kf:Eg||!Rg||Wg?1:v("y")}function u(){var a=1;return Rd(ef.data.targets)?0:lf?lf:ji?P()+($g&&!Eg?v("y2"):a):$g?dh||Eg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||Rg?"y2"!==a||$g?(gb(a).isInner?30:40)+("y2"===a?-10:0):pi:Ag&&!ji?10:1}function x(){return+df.select(gf).style("width").replace("px","")}function y(){return+df.select(gf).style("height").replace("px","")}function z(a){return a?-5:-(sf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Eg)}function C(){return A(!Eg)}function D(){return z(Eg)}function E(){return A(Eg)}function F(a){return a?vf+2+4:sf.left+20}function G(a){return a?80:xf+2}function H(){return F(!Eg)}function I(){return G(!Eg)}function J(){return F(Eg)}function K(){return G(Eg)}function L(){var a=Eg?xf:vf,b=tc(),c=Vb()*(Nd(ef.data.targets)?(b-(Vh?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){ki=a}function N(a){li=a}function O(a){mi=a}function P(){return Ag?ji?li*(ki+1):zf:0}function Q(){return Ag?ji?Af:mi*(ki+1):0}function R(){var a,b=!Qf;If=Eg?1:0,Jf=Eg?xf:vf,Kf=Eg?0:xf,Lf=Eg?vf:1,Mf=If,Nf=Jf,Of=Eg?0:yf,Pf=Eg?wf:1,Qf=T(If,Jf,b?void 0:Qf.domain(),function(){return Wf.tickOffset()}),Rf=U(Kf,Lf),Sf=U(Kf,Lf),Tf=T(If,Jf,Ci,function(a){return a%1?0:Zf.tickOffset()}),Uf=U(Of,Pf),Vf=U(Of,Pf),a=$(),Wf=X(Qf,ei,a),Zf=X(Tf,hi,a),Xf=Y(Rf,fi,Xg,Zg),Yf=Y(Sf,gi,eh,gh),b||(qi.scale(Tf),mf&&ui.scale(Qf)),S()}function S(){Ef=Db(),Ff=Eb(),Gf=Eb(.98)}function T(a,b,e,f){var g=(Uh?df.time.scale():df.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),Vh){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return df.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?Sf:Rf}function W(a){return"y2"===Z(a)?Vf:Uf}function X(a,b,c){var d=(Vh?Bb():df.svg.axis()).scale(a).orient(b);return d.tickFormat(c),Vh?d.tickCentered(Hg):d.tickOffset=function(){var a=Eg?xf:vf;return a*Vb()/tc()/2},Vh&&d.categories(Gg),d}function Y(a,b,c,d){return df.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in eg?eg[a]:"y"}function $(){var a=Uh?bi:Vh?Mc:function(a){return 0>a?a.toFixed(0):a};return Ig&&("function"==typeof Ig?a=Ig:Uh&&(a=function(a){return df.time.format(Ig)(a)})),a}function _(a){var b;return"y"===a?b=Vg:"y2"===a?b=ch:"x"===a&&(b=Qg),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Vg=b:"y2"===a?ch=b:"x"===a&&(Qg=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Eg?"inner-top":"inner-right")}function eb(){return cb("y",Eg?"inner-right":"inner-top")}function fb(){return cb("y2",Eg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?vf/2:vf:b.isBottom?-xf:b.isMiddle?-xf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Eg,db())}function ob(){return kb(Eg,eb())}function pb(){return kb(Eg,fb())}function qb(){return lb(!Eg,db())}function rb(){return lb(Eg,eb())}function sb(){return lb(Eg,fb())}function tb(){var a=db();return Eg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Eg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Eg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Eg,db())}function xb(){return mb(Eg,eb())}function yb(){return mb(Eg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return df.selectAll("."+c+" .tick text").each(function(){var a=this.getBBox();bb?20:b}function Ab(){xi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),xi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),xi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Kc(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 df.min(Object.keys(i).map(function(a){return df.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=vc(a),i=Ic(a);if(dg.length>0)for(g=Lc(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 df.max(Object.keys(i).map(function(a){return df.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?ah:Tg,n="y2"===c?_g:Sg,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?bh:Ug,r=id()&&Eg;return 0===l.length?"y2"===c?Sf.domain():Rf.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=jd(o,p),j=$b(Rf.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Yg&&(f=b(Yg.top)?Yg.top:e,g=b(Yg.bottom)?Yg.bottom:e),"y2"===c&&fh&&(f=b(fh.top)?fh.top:e,g=b(fh.bottom)?fh.bottom:e),Nd(l)&&!Kc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Ci),c=$b(Qf.domain());return a||0===c?1:b/c}function Wb(a){return Og?Og:df.min(a,function(a){return df.min(a.values,function(a){return a.x})})}function Xb(a){return Ng?Ng:df.max(a,function(a){return df.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return Vh?d=0:Nd(a)?(c=tc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=Uh?new Date(c.getTime()-e):c-e,g=Uh?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return $f&&a===$f||ge(_f)&&he(_f,a)}function fc(a){return!ec(a)}function gc(a){return $f?$f:ge(_f)?_f[a]:null}function hc(a,b){return a in ef.data.x&&ef.data.x[a]&&ef.data.x[a][b]?ef.data.x[a][b]:b}function ic(a){Object.keys(a).forEach(function(b){_f[b]=a[b]})}function jc(a){var b;return a&&(b=cg[a.id],a.name=b?b:a.id),a}function kc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=mc(b[d],a.id,d)}),ef.data.x[a.id]=b})}function lc(a,b){a.forEach(function(a){b[a.id]&&kc([a],b[a.id])})}function mc(a,b,c){var d;return d=Uh?a?a instanceof Date?a:be(a):be(hc(b,c)):Wh&&!Vh?a?+a:hc(b,c):c}function nc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?ef.data.x[b]=a.map(function(a){return a[c]}):$f&&e.length>0&&(ef.data.x[b]=ef.data.x[e[0]]):ef.data.x[b]=a.map(function(a,b){return b})}),c.forEach(function(a){if(!ef.data.x[a])throw new Error('x is not defined for id = "'+a+'".')}),b=c.map(function(b,c){var d=bg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=mc(g,b,e);return Wh&&Vh&&0===c&&g&&(0===e&&(Gg=[]),Gg.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++})}),fg&&Ld(vc(b).filter(function(a){return!(a in gg)}),fg),b.forEach(function(a){ac(a.id_org,a)}),b}function qc(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 rc(a){return a>0&&ef.data.targets[0].values[a-1]?ef.data.targets[0].values[a-1].x:void 0}function sc(a){return a1?ef.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?ef.data.targets[0]:null,a}function vc(a){return a.map(function(a){return a.id})}function wc(a){return a?"string"==typeof a?[a]:a:vc(ef.data.targets)}function xc(a,b){var c,d=vc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(Uh?new Date(h):h);i.push(d)}return i}function Ec(a){ci=ci.concat(a)}function Fc(a){ci=ci.filter(function(b){return a.indexOf(b)<0})}function Gc(a){di=di.concat(a)}function Hc(a){di=di.filter(function(b){return a.indexOf(b)<0})}function Ic(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Jc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Lc(a){return Jc(a,function(a){return a>0})}function Mc(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(rd(a,f))),a[g].x&&(e=e.concat(rd(a,g))),ud(e,b)):sd(a,b,f,g)}function td(a,b){var c;return c=a.map(function(a){return sd(a.values,b)}),ud(c,b)}function ud(a,b){var c,d;return a.forEach(function(a){var e=ie(a,b);(c>e||!c)&&(c=e,d=a)}),d}function vd(a,b){return df.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function wd(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 xd(){return ig&&"desc"===ig.toLowerCase()}function yd(){return ig&&"asc"===ig.toLowerCase()}function zd(a){var b=yd(),c=xd();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 ig&&a.sort(ig),a}function Ad(a,c){var d,e,f,g,h,i,j,k=Rd(ef.data.targets),l=k?ld:kd,m=a.filter(function(a){return a&&b(a.value)});Hh&&0!==m.length&&(Ai.html(Kh(a,$(),l,ai)).style("display","block"),d=Ai.property("offsetWidth"),e=Ai.property("offsetHeight"),k?(g=vf/2+c[0],i=xf/2+c[1]+20):(Eg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Qf(m[0].x)+20):(f=q(),g=f+t()+Qf(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Ai.style("top",i+"px").style("left",g+"px"))}function Bd(){Ai.style("display","none")}function Cd(a){var c=a.filter(function(a){return a&&b(a.value)});Hh&&(Od(ef.data.targets)||Rd(ef.data.targets)||xi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Eg?"y1":"x1",nd).attr(Eg?"y2":"x2",nd))}function Dd(){xi.select("line."+f.xgridFocus).style("visibility","hidden")}function Ed(a){return a.x||0===a.x?Qf(a.x):null}function Fd(a){return V(a.id)(a.value)}function Gd(){var a,b,d={},e=0;return Bc(yc(Ud)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Kd(a,b){return th?th:b?2*a.tickOffset()*uh/b:0}function Ld(a,b){wc(a).forEach(function(a){Ei[a]=b===gg[a],gg[a]=b})}function Md(a,b){var c=!1;return a.forEach(function(a){gg[a.id]===b&&(c=!0),a.id in gg||"line"!==b||(c=!0)}),c}function Nd(a){return Md(a,"bar")}function Od(a){return Md(a,"scatter")}function Pd(a){return Md(a,"pie")}function Qd(a){return Md(a,"donut")}function Rd(a){return Pd(a)||Qd(a)}function Sd(a){var b="string"==typeof a?a:a.id;return!(b in gg)||"line"===gg[b]||"spline"===gg[b]||"area"===gg[b]||"area-spline"===gg[b]}function Td(a){var b="string"==typeof a?a:a.id;return"spline"===gg[b]||"area-spline"===gg[b]}function Ud(a){var b="string"==typeof a?a:a.id;return"bar"===gg[b]}function Vd(a){var b="string"==typeof a?a:a.id;return"scatter"===gg[b]}function Wd(a){var b="string"==typeof a?a:a.id;return"pie"===gg[b]}function Xd(a){var b="string"==typeof a?a:a.id;return"donut"===gg[b]}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){return Ud(a)?a.values:[]}function $d(a){return Sd(a)||Vd(a)?a.values:[]}function _d(a){return Ud(a)||Sd(a)?a.values:[]}function ae(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function be(b){var c;if(!b)throw Error(b+" can not be parsed as d3.time with format "+ag+". Maybe 'x' of this data is not defined. See data.x or data.xs option.");try{c=ag?df.time.format(ag).parse(b):new Date(b)}catch(d){c=void 0}return c||a.console.error("Failed to parse x '"+b+"' to Date with format "+ag),c}function ce(a,b){var c=df.mouse(a),d=df.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function he(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ie(a,b){var c="y"===Z(a.id)?Rf:Sf,d=Eg?1:0,e=Eg?0:1;return Math.pow(Qf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function je(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function ke(a,b,c){tg(b,a.node()),xi.select("."+f.selectedCircles+_c(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Nc(f.selectedCircle,c)}).attr("cx",Eg?Fd:Ed).attr("cy",Eg?Ed:Fd).attr("stroke",function(){return ai(b)}).attr("r",1.4*sh).transition().duration(100).attr("r",sh)}function le(a,b,c){ug(b,a.node()),xi.select("."+f.selectedCircles+_c(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function me(a,b,c,d){a?ke(b,c,d):le(b,c,d)}function ne(a,b){tg(b,a.node()),a.transition().duration(100).style("fill",function(){return df.rgb(ai(b)).darker(1)})}function oe(a,b){ug(b,a.node()),a.transition().duration(100).style("fill",function(){return ai(b)})}function pe(a,b,c,d){a?ne(b,c,d):oe(b,c,d)}function qe(a){return a.filter(function(a){return b(a.value)})}function re(a,c){return(c?xi.selectAll("."+f.circles+_c(c)):xi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function se(a,b){re(a,b).classed(f.EXPANDED,!0).attr("r",rh)}function te(a){re(a).filter(function(){return df.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",oh)}function ue(a){return xi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function ve(a){ue(a).classed(f.EXPANDED,!0)}function we(a){ue(a).classed(f.EXPANDED,!1)}function xe(a,b){var c=Be(a,b);return function(a,b){var d=c(a,b),e=Eg?1:0,f=Eg?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 ye(a,b){var c=Be(a,!1),d=b?ze:Ae;return function(a,b){return d(c(a,b),a,this)}}function ze(a,b){var c;return Eg?(c=Ud(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ae(a,b,c){var d=c.getBBox();return Eg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:Ud(b)?-3:-6)}function Be(a,b){var c=a.__max__+1,d=Kd(Wf,c),e=Hd(d,c,a,!!b),f=Id(!!b),g=Jd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Eg&&(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 Ce(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 De(b){var c,d,e;if(Bi=df.select(gf),Bi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Bi.html(""),Bi.classed("c3",!0),ef.data.x={},ef.data.targets=pc(b),n(),R(),Qf.domain(df.extent(Zb(ef.data.targets))),Rf.domain(Ub(ef.data.targets,"y")),Sf.domain(Ub(ef.data.targets,"y2")),Tf.domain(Qf.domain()),Uf.domain(Rf.domain()),Vf.domain(Sf.domain()),Ci=Qf.domain(),qi.scale(Tf),mf&&ui.scale(Qf),vi=Bi.append("svg").attr("width",vf+sf.left+sf.right).attr("height",xf+sf.top+sf.bottom).on("mouseenter",pf).on("mouseleave",qf),wi=vi.append("defs"),wi.append("clipPath").attr("id",Oh).append("rect").attr("width",vf).attr("height",xf),wi.append("clipPath").attr("id",Ph).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),wi.append("clipPath").attr("id",Qh).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),xi=vi.append("g").attr("transform",ii.main),yi=xg?vi.append("g").attr("transform",ii.context):null,zi=vi.append("g").attr("transform",ii.legend),Ag||(zi.style("visibility","hidden"),di=vc(ef.data.targets)),Ai=df.select(gf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),$e(vc(ef.data.targets),{withTransform:!1,withTransitionForTransform:!1}),xi.append("g").attr("class",f.axisX).attr("clip-path",Eg?"":Sh).attr("transform",ii.x).append("text").attr("class",f.axisXLabel).attr("transform",Eg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),Rg&&xi.append("g").attr("class",f.axisY).attr("clip-path",Eg?Th:"").attr("transform",ii.y).append("text").attr("class",f.axisYLabel).attr("transform",Eg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),$g&&xi.append("g").attr("class",f.axisY2).attr("transform",ii.y2).append("text").attr("class",f.axisY2Label).attr("transform",Eg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=xi.append("g").attr("clip-path",Rh).attr("class",f.grid),hh&&d.append("g").attr("class",f.xgrids),ge(jh)&&d.append("g").attr("class",f.xgridLines),ph&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),kh&&d.append("g").attr("class",f.ygrids),ge(lh)&&d.append("g").attr("class",f.ygridLines),xi.append("g").attr("clip-path",Rh).attr("class",f.regions),xi.append("g").attr("clip-path",Rh).attr("class",f.chart),c=xi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",mf?Eg?"ns-resize":"ew-resize":null),xi.select("."+f.chart).append("g").attr("class",f.chartBars),xi.select("."+f.chart).append("g").attr("class",f.chartLines),xi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",ii.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),xi.select("."+f.chart).append("g").attr("class",f.chartTexts),mf&&xi.insert("rect",of?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",vf).attr("height",xf).style("opacity",0).style("cursor",Eg?"ns-resize":"ew-resize").call(ui).on("dblclick.zoom",null),Pg&&qi.extent("function"!=typeof Pg?Pg:Pg(Zb())),xg&&(yi.append("g").attr("clip-path",Rh).attr("class",f.chart),yi.select("."+f.chart).append("g").attr("class",f.chartBars),yi.select("."+f.chart).append("g").attr("class",f.chartLines),yi.append("g").attr("clip-path",Rh).attr("class",f.brush).call(qi).selectAll("rect").attr(Eg?"width":"height",Eg?wf:yf),yi.append("g").attr("class",f.axisX).attr("transform",ii.subx).attr("clip-path",Eg?"":Sh)),Qe(ef.data.targets),Eg?xi.select("."+f.axisX).style("opacity",0).call(Wf):(xi.select("."+f.axisY).style("opacity",0).call(Xf),xi.select("."+f.axisY2).style("opacity",0).call(Yf)),Ke({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Lh){if(Uh&&"string"==typeof Mh){for(Mh=be(Mh),e=0;e0){d=[];for(var g in cg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=wd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=pe,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 Ie(a){Rd(ef.data.targets)||mg&&(Xh=a,xi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Yh=!0,vg())}function Je(){Rd(ef.data.targets)||mg&&(xi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),xi.selectAll("."+f.shape).classed(f.INCLUDED,!1),Yh=!1,wg())}function Ke(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S=Gd(),T=Rd(ef.data.targets),U=Bc(ef.data.targets);if(0!==U.length){if(a=d(a)?a:{},x=d(a.withY)?a.withY:!0,y=d(a.withSubchart)?a.withSubchart:!0,z=d(a.withTransition)?a.withTransition:!0,D=d(a.withTransform)?a.withTransform:!1,E=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,F=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,G=d(a.withLegend)?a.withLegend:!1,A=d(a.withTransitionForExit)?a.withTransitionForExit:z,B=d(a.withTransitionForAxis)?a.withTransitionForAxis:z,C=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:z,M=z?rf:0,N=A?M:0,O=B?M:0,G&&Ag&&$e(vc(ef.data.targets),a),F&&(Qf.domain(df.extent(Zb(U))),Ci=Qf.domain(),mf&&ui.scale(Qf).updateScaleExtent(),Tf.domain(Qf.domain()),qi.scale(Tf)),E&&(Qf.domain(qi.empty()?Ci:qi.extent()),mf&&ui.scale(Qf).updateScaleExtent()),Rf.domain(Ub(U,"y")),Sf.domain(Ub(U,"y2")),Od(U)||(P=Dc(Cc(U)).sort(),Wf.tickValues(P),Zf.tickValues(P)),c=xi.select("."+f.axisX).style("opacity",T?0:1),(Eg||C)&&(c=c.transition().duration(O)),c.call(Wf),e=xi.select("."+f.axisY).style("opacity",T?0:1),(!Eg||C)&&(e=e.transition().duration(O)),e.call(Xf),xi.select("."+f.axisY2).style("opacity",T?0:1).transition().duration(O).call(Yf),E&&Jg&&P){for(Q=1;Q=Y;Y++)h.push(new Date(Y+"-01-01 00:00:00"))}else h=Qf.ticks(10);g=xi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Eg?0:function(a){return Qf(a)-Wf.tickOffset()}).attr("x2",Eg?vf:function(a){return Qf(a)-Wf.tickOffset()}).attr("y1",Eg?function(a){return Qf(a)-Wf.tickOffset()}:sf.top).attr("y2",Eg?function(a){return Qf(a)-Wf.tickOffset()}:xf).style("opacity",function(){return+df.select(this).attr(Eg?"y1":"x1")===(Eg?xf:0)?0:1}),g.exit().remove()}ge(jh)&&(i=xi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(jh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Eg?"":"rotate(-90)").attr("dx",Eg?0:-sf.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(M).attr("x1",Eg?0:od).attr("x2",Eg?vf:od).attr("y1",Eg?od:sf.top).attr("y2",Eg?od:xf).style("opacity",1),i.select("text").transition().duration(M).attr("x",Eg?vf:0).attr("y",od).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(M).style("opacity",0).remove()),x&&kh&&(k=xi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Rf.ticks(mh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Eg?Rf:0).attr("x2",Eg?Rf:vf).attr("y1",Eg?0:Rf).attr("y2",Eg?xf:Rf),k.exit().remove()),x&&ge(lh)&&(l=xi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(lh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Eg?"rotate(-90)":"").attr("dx",Eg?0:-sf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(M).attr("x1",Eg?pd:0).attr("x2",Eg?pd:vf).attr("y1",Eg?0:pd).attr("y2",Eg?xf:pd).style("opacity",1),l.select("text").transition().duration(M).attr("x",Eg?0:vf).attr("y",pd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(M).style("opacity",0).remove()),p=xi.selectAll("."+f.bars).selectAll("."+f.bar).data(Zd),p.enter().append("path").attr("d",H).style("stroke","none").style("opacity",0).style("fill",function(a){return ai(a)}).attr("class",Vc),p.style("opacity",ed).transition().duration(M).attr("d",H).style("opacity",1),p.exit().transition().duration(N).style("opacity",0).remove(),r=xi.selectAll("."+f.texts).selectAll("."+f.text).data(_d),r.enter().append("text").attr("class",Oc).attr("text-anchor",function(a){return Eg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return md(a.id)(a.value)}).style("fill-opacity",fd).transition().duration(M).attr("x",J).attr("y",K).style("fill-opacity",hd),r.exit().transition().duration(N).style("fill-opacity",0).remove(),xi.selectAll("."+f.line).style("opacity",ed).transition().duration(M).attr("d",ri).style("opacity",1),xi.selectAll("."+f.area).style("opacity",0).transition().duration(M).attr("d",si).style("opacity",Di),n=xi.selectAll("."+f.circles).selectAll("."+f.circle).data($d),n.enter().append("circle").attr("class",Tc).style("opacity",0).attr("r",oh),n.style("opacity",ed).transition().duration(M).style("opacity",gd).attr("cx",Eg?Fd:Ed).attr("cy",Eg?Ed:Fd),n.exit().remove(),xi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",D?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(M).attrTween("d",function(a){var b,c=Cb(a);return c?(b=df.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",D?"scale(1)":"").style("opacity",1),xi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(M).text(Jb).style("opacity",function(a){return zc(a.data.id)&&Yd(a.data)?1:0}),xi.select("."+f.chartArcsTitle).style("opacity",Qd(ef.data.targets)?1:0),xg&&(null!==df.event&&"zoom"===df.event.type&&qi.extent(Qf.orgDomain()).update(),y&&(yi.select("."+f.axisX).style("opacity",T?0:1).transition().duration(M).call(Zf),qi.empty()||qi.extent(Qf.orgDomain()).update(),I=xe(S,!0),s=yi.selectAll("."+f.bars).selectAll("."+f.bar).data(Zd),s.enter().append("path").attr("d",I).style("stroke","none").style("fill",function(a){return ai(a)}).attr("class",Vc),s.style("opacity",ed).transition().duration(M).attr("d",I).style("opacity",1),s.exit().transition().duration(M).style("opacity",0).remove(),yi.selectAll("."+f.line).style("opacity",ed).transition().duration(M).attr("d",ti).style("opacity",1))),xi.selectAll("."+f.selectedCircles).filter(function(a){return Ud(a)}).selectAll("circle").remove(),xi.selectAll("."+f.selectedCircle).transition().duration(M).attr("cx",Eg?Fd:Ed).attr("cy",Eg?Ed:Fd),ge(_f)?(t=xi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Fe(t.enter()),t.attr("x",0).attr("y",0).attr("width",vf).attr("height",xf)):(Wh&&!Vh?(w=function(a,b){var c=rc(b),d=sc(b),e=ef.data.x[a.id][b];return(Qf(d?d:e+50)-Qf(c?c:e-50))/2},v=function(a,b){var c=rc(b),d=ef.data.x[a.id][b];return(Qf(d)+Qf(c?c:d-50))/2}):(w=L(),v=function(a){return Qf(a.x)-w/2}),u=uc(),xi.select("."+f.eventRects).datum(u?u.values:[]),t=xi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ee(t.enter()),t.attr("class",$c).attr("x",Eg?0:v).attr("y",Eg?v:0).attr("width",Eg?vf:w).attr("height",Eg?w:xf),t.exit().remove()),q=xi.select("."+f.regions).selectAll("rect."+f.region).data(Gh),q.enter().append("rect").style("fill-opacity",0),q.attr("class",Zc).attr("x",Eg?0:cc).attr("y",Eg?cc:sf.top).attr("width",Eg?vf:dc).attr("height",Eg?dc:xf).transition().duration(M).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(M).style("fill-opacity",0).remove(),vc(ef.data.targets).forEach(function(a){Ei[a]=!0})}}function Le(){Ke({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Me(){return"mousemove"===df.event.sourceEvent.type&&ui.altDomain?(Qf.domain(ui.altDomain),void ui.scale(Qf).updateScaleExtent()):(Vh&&Qf.orgDomain()[0]===Ci[0]&&Qf.domain([Ci[0]-1e-10,Qf.orgDomain()[1]]),Ke({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===df.event.sourceEvent.type&&(Zh=!0)))}function Ne(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Oe(){vi.attr("width",zf).attr("height",Af),vi.select("#"+Oh).select("rect").attr("width",vf).attr("height",xf),vi.select("#"+Ph).select("rect").attr("width",H),vi.select("#"+Qh).select("rect").attr("width",J),vi.select("."+f.zoomRect).attr("width",vf).attr("height",xf)}function Pe(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Oe(),m(a.withTransition),Ke(a)}function Qe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=xi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a),j=i.enter().append("g").attr("class",function(a){return f.chartText+Nc(f.target,a.id)}).style("pointer-events","none"),j.append("g").attr("class",Pc).style("fill",function(a){return ai(a)}),e=xi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),d=e.enter().append("g").attr("class",function(a){return f.chartBar+Nc(f.target,a.id)}).style("pointer-events","none"),d.append("g").attr("class",Wc).style("fill",function(a){return ai(a)}).style("stroke","none").style("cursor",function(a){return og(a)?"pointer":null}),c=xi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),b=c.enter().append("g").attr("class",function(a){return f.chartLine+Nc(f.target,a.id)}).style("pointer-events","none"),b.append("path").attr("class",Sc).style("opacity",0).style("stroke",function(a){return ai(a)}),b.append("path").attr("class",Yc).style("opacity",function(){return Di=+df.select(this).style("opacity"),0}).style("fill",function(a){return ai(a)}),b.append("g").attr("class",function(a){return Nc(f.selectedCircles,a.id)}),b.append("g").attr("class",Uc).style("fill",function(a){return ai(a)}).style("cursor",function(a){return og(a)?"pointer":null}),a.forEach(function(a){xi.selectAll("."+f.selectedCircles+_c(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=xi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Hf(a)),g=h.enter().append("g").attr("class",function(a){return f.chartArc+Nc(f.target,a.data.id)}),g.append("path").attr("class",Xc).style("opacity",0).style("fill",function(a){return ai(a.data)}).style("cursor",function(a){return og(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),Ve(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Ad(c,df.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),Xe(),Bd(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),xg&&(n=yi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),m=n.enter().append("g").attr("class",function(a){return f.chartBar+Nc(f.target,a.id)}),m.append("g").attr("class",Wc).style("fill",function(a){return ai(a)}),l=yi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),k=l.enter().append("g").attr("class",function(a){return f.chartLine+Nc(f.target,a.id)}),k.append("path").attr("class",Sc).style("opacity",0).style("stroke",function(a){return ai(a)})),vi.selectAll("."+f.target).filter(function(a){return zc(a.id)}).transition().style("opacity",1)}function Re(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Ld(a.id,b.types[a.id]):Ld(a.id,b.type)}),ef.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBBox(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=ji?j:i,l=ji?Q():P();return d&&(w=0,C=0,t=0,u=0),Ag&&!Ac(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=ji?u:t,void(Dg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,ji?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=zi.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Nc(f.legendItem,a)}).style("visibility",function(a){return Ac(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Cg?Cg(a):ef.toggle(a)}).on("mouseover",function(a){ef.focus(a)}).on("mouseout",function(){ef.revert()}),l.append("text").text(function(a){return d(cg[a])?cg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",ji?g:-200).attr("y",ji?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",ji?h:-200).attr("y",ji?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return ai(a)}).attr("x",ji?g:-200).attr("y",ji?-200:i).attr("width",10).attr("height",10),zi.selectAll("text").data(a).text(function(a){return d(cg[a])?cg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),zi.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),zi.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Oe(),q&&m(p)}function _e(a){return xc(ef.data.targets,a.id)}function af(a){return"data"in a&&xc(ef.data.targets,a.data.id)}function bf(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 cf(a,b,c){var d=!Rd(ef.data.targets);Ld(a,b),Pe(c?c:{withTransitionForAxis:d})}var df=a.d3?a.d3:a.require?a.require("d3"):void 0,ef={data:{},axis:{},legend:{}},ff={},gf=h(["bindto"],"#chart"),hf=h(["size","width"]),jf=h(["size","height"]),kf=h(["padding","left"]),lf=h(["padding","right"]),mf=h(["zoom","enabled"],!1),nf=h(["zoom","extent"]),of=h(["zoom","privileged"],!1),pf=h(["onenter"],function(){}),qf=h(["onleave"],function(){}),rf=h(["transition","duration"],350);g("data","data is required in config");var 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,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f=h(["data","x"]),_f=h(["data","xs"],{}),ag=h(["data","x_format"]),bg=h(["data","id_converter"],function(a){return a}),cg=h(["data","names"],{}),dg=h(["data","groups"],[]),eg=h(["data","axes"],{}),fg=h(["data","type"]),gg=h(["data","types"],{}),hg=h(["data","labels"],{}),ig=h(["data","order"]),jg=h(["data","regions"],{}),kg=h(["data","color"]),lg=h(["data","colors"],{}),mg=h(["data","selection","enabled"],!1),ng=h(["data","selection","grouped"],!1),og=h(["data","selection","isselectable"],function(){return!0}),pg=h(["data","selection","multiple"],!0),qg=h(["data","onclick"],function(){}),rg=h(["data","onenter"],function(){}),sg=h(["data","onleave"],function(){}),tg=h(["data","onselected"],function(){}),ug=h(["data","onunselected"],function(){}),vg=h(["data","ondragstart"],function(){}),wg=h(["data","ondragend"],function(){}),xg=h(["subchart","show"],!1),yg=xg?h(["subchart","size","height"],60):0,zg=h(["color","pattern"],[]),Ag=h(["legend","show"],!0),Bg=h(["legend","position"],"bottom"),Cg=h(["legend","item","onclick"]),Dg=h(["legend","equally"],!1),Eg=h(["axis","rotated"],!1),Fg=h(["axis","x","type"],"indexed"),Gg=h(["axis","x","categories"],[]),Hg=h(["axis","x","tick","centered"],!1),Ig=h(["axis","x","tick","format"]),Jg=h(["axis","x","tick","culling"],{}),Kg=h(["axis","x","tick","culling","max"],"categorized"===Fg?1/0:10),Lg=h(["axis","x","tick","count"]),Mg=h(["axis","x","tick","fit"],!1),Ng=h(["axis","x","max"]),Og=h(["axis","x","min"]),Pg=h(["axis","x","default"]),Qg=h(["axis","x","label"],{}),Rg=h(["axis","y","show"],!0),Sg=h(["axis","y","max"]),Tg=h(["axis","y","min"]),Ug=h(["axis","y","center"]),Vg=h(["axis","y","label"],{}),Wg=h(["axis","y","inner"],!1),Xg=h(["axis","y","tick","format"]),Yg=h(["axis","y","padding"],{}),Zg=h(["axis","y","ticks"],10),$g=h(["axis","y2","show"],!1),_g=h(["axis","y2","max"]),ah=h(["axis","y2","min"]),bh=h(["axis","y2","center"]),ch=h(["axis","y2","label"],{}),dh=h(["axis","y2","inner"],!1),eh=h(["axis","y2","tick","format"]),fh=h(["axis","y2","padding"],{}),gh=h(["axis","y2","ticks"],10),hh=h(["grid","x","show"],!1),ih=h(["grid","x","type"],"tick"),jh=h(["grid","x","lines"],[]),kh=h(["grid","y","show"],!1),lh=h(["grid","y","lines"],[]),mh=h(["grid","y","ticks"],10),nh=h(["point","show"],!0),oh=nh?h(["point","r"],2.5):0,ph=h(["point","focus","line","enabled"],!0),qh=h(["point","focus","expand","enabled"],!0),rh=h(["point","focus","expand","r"],qh?4:oh),sh=h(["point","focus","select","r"],8),th=h(["bar","width"]),uh=h(["bar","width","ratio"],.6),vh=h(["pie","label","show"],!0),wh=h(["pie","label","format"]),xh=h(["pie","onclick"],function(){}),yh=h(["pie","onmouseover"],function(){}),zh=h(["pie","onmouseout"],function(){}),Ah=h(["donut","label","show"],!0),Bh=h(["donut","label","format"]),Ch=h(["donut","title"],""),Dh=h(["donut","onclick"],function(){}),Eh=h(["donut","onmouseover"],function(){}),Fh=h(["donut","onmouseout"],function(){}),Gh=h(["regions"],[]),Hh=h(["tooltip","show"],!0),Ih=h(["tooltip","format","title"]),Jh=h(["tooltip","format","value"]),Kh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Ih?Ih:b,l=Jh?Jh: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+""}),Lh=h(["tooltip","init","show"],!1),Mh=h(["tooltip","init","x"],0),Nh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Oh=("string"==typeof gf?gf.replace("#",""):gf.id)+"-clip",Ph=Oh+"-xaxis",Qh=Oh+"-yaxis",Rh=i(Oh),Sh=i(Sh),Th=i(Th),Uh="timeseries"===Fg,Vh="categorized"===Fg,Wh=!Uh&&($f||ge(_f)),Xh=null,Yh=!1,Zh=!1,$h=!1,_h=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ai=ae(lg,ge(zg)?zg:_h,kg),bi=function(){var a=[[df.time.format("%Y/%-m/%-d"),function(){return!0}],[df.time.format("%-m/%-d"),function(a){return a.getMonth()}],[df.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[df.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[df.time.format("%I %p"),function(a){return a.getHours()}],[df.time.format("%I:%M"),function(a){return a.getMinutes()}],[df.time.format(":%S"),function(a){return a.getSeconds()}],[df.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)}}(),ci=[],di=[],ei=Eg?"left":"bottom",fi=Eg?Wg?"top":"bottom":Wg?"right":"left",gi=Eg?dh?"bottom":"top":dh?"left":"right",hi=Eg?"left":"bottom",ii={main:function(){return"translate("+sf.left+","+sf.top+")"},context:function(){return"translate("+tf.left+","+tf.top+")"},legend:function(){return"translate("+uf.left+","+uf.top+")"},x:function(){return"translate(0,"+(Eg?0:xf)+")"},y:function(){return"translate(0,"+(Eg?xf:0)+")"},y2:function(){return"translate("+(Eg?0:vf)+","+(Eg?1:0)+")"},subx:function(){return"translate(0,"+(Eg?0:yf)+")"},arc:function(){return"translate("+vf/2+","+xf/2+")"}},ji="right"===Bg,ki=0,li=0,mi=0,ni=30,oi=30,pi=5;Hf=df.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var qi,ri=function(){var a=df.svg.line().x(Eg?function(a){return V(a.id)(a.value)}:nd).y(Eg?nd:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=qe(b.values);return Sd(b)?(a.interpolate(Td(b)?"cardinal":"linear"),jg[b.id]?Ce(e,Qf,V(b.id),jg[b.id]):a(e)):(c=Qf(e[0].x),d=V(b.id)(e[0].value),Eg?"M "+d+" "+c:"M "+c+" "+d)}}(),si=function(){var a;return a=Eg?df.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(nd):df.svg.area().x(nd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=qe(b.values);return Md([b],"area")||Md([b],"area-spline")?(a.interpolate(Td(b)?"cardinal":"linear"),a(e)):(c=Qf(e[0].x),d=V(b.id)(e[0].value),Eg?"M "+d+" "+c:"M "+c+" "+d)}}(),ti=function(){var a=df.svg.line().x(Eg?function(a){return W(a.id)(a.value)}:qd).y(Eg?qd:function(a){return W(a.id)(a.value)});return function(b){var c=qe(b.values);return Sd(b)?a(c):"M "+Tf(c[0].x)+" "+W(b.id)(c[0].value)}}(),ui=function(){};qi=df.svg.brush().on("brush",Le),qi.update=function(){return yi&&yi.select("."+f.brush).call(this),this},qi.scale=function(a){return Eg?this.y(a):this.x(a)},mf&&(ui=df.behavior.zoom().on("zoomstart",function(){ui.altDomain=df.event.sourceEvent.altKey?Qf.orgDomain():null}).on("zoom",mf?Me:null),ui.scale=function(a){return Eg?this.y(a):this.x(a)},ui.orgScaleExtent=function(){var a=nf?nf:[1,10];return[a[0],Math.max(tc()/a[1],a[1])]},ui.updateScaleExtent=function(){var a=$b(Qf.orgDomain())/$b(Ci),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var vi,wi,xi,yi,zi,Ai,Bi,Ci,Di,Ei={};if(ef.focus=function(a){function b(a){Bc(a).transition().duration(100).style("opacity",1)}var c=vi.selectAll(ad(a)),d=c.filter(_e),e=c.filter(af);ef.revert(),ef.defocus(),b(d.classed(f.focused,!0)),b(e),Rd(ef.data.targets)&&Kb(a,!0),Ve(a)},ef.defocus=function(a){function b(a){Bc(a).transition().duration(100).style("opacity",.3)}var c=vi.selectAll(ad(a)),d=c.filter(_e),e=c.filter(af);ef.revert(),b(d.classed(f.focused,!1)),b(e),Rd(ef.data.targets)&&Lb(a),We(a)},ef.revert=function(a){function b(a){Bc(a).transition().duration(100).style("opacity",1)}var c=vi.selectAll(ad(a)),d=c.filter(_e),e=c.filter(af);b(d.classed(f.focused,!1)),b(e),Rd(ef.data.targets)&&Lb(a),Xe()},ef.show=function(a,b){a=wc(a),b=b||{},Fc(a),vi.selectAll(bd(a)).transition().style("opacity",1),b.withLegend&&Ye(a),Ke({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},ef.hide=function(a,b){a=wc(a),b=b||{},Ec(a),vi.selectAll(bd(a)).transition().style("opacity",0),b.withLegend&&Ze(a),Ke({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},ef.toggle=function(a){zc(a)?ef.hide(a):ef.show(a)},ef.unzoom=function(){qi.clear().update(),Ke({withUpdateXDomain:!0})},ef.load=function(a){return a.xs&&ic(a.xs),"categories"in a&&Vh&&(Gg=a.categories,Wf.categories(Gg)),"cacheIds"in a&&_b(a.cacheIds)?void Re(bc(a.cacheIds),a.done):void("unload"in a?Te(wc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Se(a)}):Se(a))},ef.unload=function(a){Te(wc(a),function(){Ke({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},ef.selected=function(a){return df.merge(xi.selectAll("."+f.shapes+_c(a)).selectAll("."+f.shape).filter(function(){return df.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},ef.select=function(a,b,c){mg&&xi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=df.select(this),i="circle"===this.nodeName?ke:ne,j="circle"===this.nodeName?le:oe,k=ng||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?og(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},ef.unselect=function(a,b){mg&&xi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=df.select(this),g="circle"===this.nodeName?le:oe,h=ng||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&og(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},ef.toLine=function(a){cf(a,"line")},ef.toSpline=function(a){cf(a,"spline")},ef.toBar=function(a){cf(a,"bar")},ef.toScatter=function(a){cf(a,"scatter")},ef.toArea=function(a){cf(a,"area")},ef.toAreaSpline=function(a){cf(a,"area-spline")},ef.toPie=function(a){cf(a,"pie",{withTransform:!0})},ef.toDonut=function(a){cf(a,"donut",{withTransform:!0})},ef.groups=function(a){return c(a)?dg:(dg=a,Ke(),dg)},ef.xgrids=function(a){return a?(jh=a,Ke(),jh):jh},ef.xgrids.add=function(a){return a?ef.xgrids(jh.concat(a)):void 0},ef.xgrids.remove=function(a){var b=bf(a);return ef.xgrids(jh.filter(b))},ef.ygrids=function(a){return a?(lh=a,Ke(),lh):lh},ef.ygrids.add=function(a){return a?ef.ygrids(lh.concat(a)):void 0},ef.ygrids.remove=function(a){var b=bf(a);return ef.ygrids(lh.filter(b))},ef.regions=function(a){return c(a)?Gh:(Gh=a,Ke(),Gh)},ef.regions.add=function(a){return c(a)?Gh:(Gh=Gh.concat(a),Ke(),Gh)},ef.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;vi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Gh=Gh.filter(function(b){return b.classes.indexOf(a)<0})}),Gh},ef.data.get=function(a){var b=ef.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},ef.data.getAsTarget=function(a){var b=yc(function(b){return b.id===a});return b.length>0?b[0]:void 0},ef.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){cg[b]=a[b]}),$e(vc(ef.data.targets),{withTransition:!0}),cg):cg},ef.x=function(a){return arguments.length&&(kc(ef.data.targets,a),Ke({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),ef.data.x},ef.xs=function(a){return arguments.length&&(lc(ef.data.targets,a),Ke({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),ef.data.x},ef.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},ef.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Sg=+a.y),b(a.y2)&&(_g=+a.y2)):Sg=_g=+a,Ke()) -},ef.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Tg=+a.y),b(a.y2)&&(ah=+a.y2)):Tg=ah=+a,Ke())},ef.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&ef.axis.max(a.max),"undefined"!=typeof a.min&&ef.axis.min(a.min))},ef.legend.show=function(a){Ag||(Ag=!0,zi.style("visibility","visible")),Ye(wc(a)),Ke({withTransitionForHorizontalAxis:!1})},ef.legend.hide=function(a){Ag&&fe(a)&&(Ag=!1,zi.style("visibility","hidden")),Ze(wc(a)),Ke({withTransitionForHorizontalAxis:!1})},ef.resize=function(a){hf=a?a.width:null,jf=a?a.height:null,Pe({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},ef.destroy=function(){ef.data.targets=void 0,ef.data.x={},Bi.html(""),a.onresize=null},"url"in e.data)df.csv(e.data.url,function(a,b){De(b)});else if("rows"in e.data)De(nc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");De(oc(e.data.columns))}return ef},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file +!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.29"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",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;cxf&&(xf=0),0>zf&&(zf=0),vf={top:Gg?uf.top:Cf-Ag-(li?0:a),right:0/0,bottom:20+(li?0:a),left:Gg?pi:uf.left},yf=Gg?uf.left-pi-qi:xf,Af=Gg?zf:Cf-vf.top-vf.bottom,0>yf&&(yf=0),0>Af&&(Af=0),wf={top:li?0:Cf-a,right:0/0,bottom:0,left:li?Bf-b:0},p(),li&&Td(gf.data.targets)&&(wf.left=xf/2+Ef)}function o(){zi.select("line."+f.xgridFocus).attr("x1",Gg?0:-10).attr("x2",Gg?xf:-10).attr("y1",Gg?-10:uf.top).attr("y2",Gg?-10:zf)}function p(){Ef=zf/2,Df=.95*Ef,Ff=Sd(gf.data.targets)?.6*Df:0}function q(){var a=Gg?f.axisX:f.axisY,b=ff.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=ff.select(jf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return kf?kf:x()}function s(){var a=lf?lf:y();return a>0?a:320}function t(){return Td(gf.data.targets)?0:mf?mf:Gg||!Tg||Yg?1:v("y")}function u(){var a=1;return Td(gf.data.targets)?0:nf?nf:li?P()+(ah&&!Gg?v("y2"):a):ah?fh||Gg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||Tg?"y2"!==a||ah?(gb(a).isInner?30:40)+("y2"===a?-10:0):ri:Cg&&!li?10:1}function x(){return+ff.select(jf).style("width").replace("px","")}function y(){return+ff.select(jf).style("height").replace("px","")}function z(a){return a?-5:-(uf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Gg)}function C(){return A(!Gg)}function D(){return z(Gg)}function E(){return A(Gg)}function F(a){return a?xf+2+4:uf.left+20}function G(a){return a?80:zf+2}function H(){return F(!Gg)}function I(){return G(!Gg)}function J(){return F(Gg)}function K(){return G(Gg)}function L(){var a=Gg?zf:xf,b=vc(),c=Vb()*(Pd(gf.data.targets)?(b-(Xh?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){mi=a}function N(a){ni=a}function O(a){oi=a}function P(){return Cg?li?ni*(mi+1):Bf:0}function Q(){return Cg?li?Cf:oi*(mi+1):0}function R(){var a,b=!Sf;Kf=Gg?1:0,Lf=Gg?zf:xf,Mf=Gg?0:zf,Nf=Gg?xf:1,Of=Kf,Pf=Lf,Qf=Gg?0:Af,Rf=Gg?yf:1,Sf=T(Kf,Lf,b?void 0:Sf.domain(),function(){return Yf.tickOffset()}),Tf=U(Mf,Nf),Uf=U(Mf,Nf),Vf=T(Kf,Lf,Ei,function(a){return a%1?0:_f.tickOffset()}),Wf=U(Qf,Rf),Xf=U(Qf,Rf),a=$(),Yf=X(Sf,gi,a),_f=X(Vf,ji,a),Zf=Y(Tf,hi,Zg,_g),$f=Y(Uf,ii,gh,ih),b||(si.scale(Vf),of&&wi.scale(Sf)),S()}function S(){Gf=Db(),Hf=Eb(),If=Eb(.98)}function T(a,b,e,f){var g=(Wh?ff.time.scale():ff.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),Xh){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return ff.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?Uf:Tf}function W(a){return"y2"===Z(a)?Xf:Wf}function X(a,b,c){var d=(Xh?Bb():ff.svg.axis()).scale(a).orient(b);return d.tickFormat(c),Xh?d.tickCentered(Jg):d.tickOffset=function(){var a=Gg?zf:xf;return a*Vb()/vc()/2},Xh&&d.categories(Ig),d}function Y(a,b,c,d){return ff.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in gg?gg[a]:"y"}function $(){var a=Wh?di:Xh?Oc:function(a){return 0>a?a.toFixed(0):a};return Kg&&("function"==typeof Kg?a=Kg:Wh&&(a=function(a){return ff.time.format(Kg)(a)})),a}function _(a){var b;return"y"===a?b=Xg:"y2"===a?b=eh:"x"===a&&(b=Sg),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Xg=b:"y2"===a?eh=b:"x"===a&&(Sg=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Gg?"inner-top":"inner-right")}function eb(){return cb("y",Gg?"inner-right":"inner-top")}function fb(){return cb("y2",Gg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?xf/2:xf:b.isBottom?-zf:b.isMiddle?-zf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Gg,db())}function ob(){return kb(Gg,eb())}function pb(){return kb(Gg,fb())}function qb(){return lb(!Gg,db())}function rb(){return lb(Gg,eb())}function sb(){return lb(Gg,fb())}function tb(){var a=db();return Gg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Gg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Gg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Gg,db())}function xb(){return mb(Gg,eb())}function yb(){return mb(Gg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return ff.selectAll("."+c+" .tick text").each(function(){var a=this.getBBox();bb?20:b}function Ab(){zi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),zi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),zi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return ff.min(Object.keys(i).map(function(a){return ff.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(fg.length>0)for(g=Nc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return ff.max(Object.keys(i).map(function(a){return ff.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?ch:Vg,n="y2"===c?bh:Ug,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?dh:Wg,r=kd()&⋙return 0===l.length?"y2"===c?Uf.domain():Tf.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=ld(o,p),j=$b(Tf.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&$g&&(f=b($g.top)?$g.top:e,g=b($g.bottom)?$g.bottom:e),"y2"===c&&hh&&(f=b(hh.top)?hh.top:e,g=b(hh.bottom)?hh.bottom:e),Pd(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Ei),c=$b(Sf.domain());return a||0===c?1:b/c}function Wb(a){return Qg?Qg:ff.min(a,function(a){return ff.min(a.values,function(a){return a.x})})}function Xb(a){return Pg?Pg:ff.max(a,function(a){return ff.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return Xh?d=0:Pd(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=Wh?new Date(c.getTime()-e):c-e,g=Wh?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return ag&&a===ag||ie(bg)&&je(bg,a)}function fc(a){return!ec(a)}function gc(a){return ag?ag:ie(bg)?bg[a]:null}function hc(a,b){var c,d=b&&ie(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=gf.data.xs[b])}),c}function ic(a,b){return a in gf.data.xs&&gf.data.xs[a]&&gf.data.xs[a][b]?gf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){bg[b]=a[b]})}function kc(a){return 1===ff.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=eg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),gf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=Wh?a?a instanceof Date?a:de(a):de(ic(b,c)):Yh&&!Xh?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?gf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):ag?(d=Object.keys(gf.data.xs),gf.data.xs[c]=d.length>0?gf.data.xs[d[0]]:void 0):ie(bg)&&(gf.data.xs[c]=hc(f,gf.data.targets)):gf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!gf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=dg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return Yh&&Xh&&0===c&&g&&(0===e&&(Ig=[]),Ig.push(g)),("undefined"==typeof a[b]||gf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),hg&&Nd(xc(c).filter(function(a){return!(a in ig)}),hg),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function tc(a){return a>0&&gf.data.targets[0].values[a-1]?gf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?gf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?gf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(gf.data.targets)}function zc(a,b){var c,d=xc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(Wh?new Date(h):h);i.push(d)}return i}function Gc(a){ei=ei.concat(a)}function Hc(a){ei=ei.filter(function(b){return a.indexOf(b)<0})}function Ic(a){fi=fi.concat(a)}function Jc(a){fi=fi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(td(a,f))),a[g].x&&(e=e.concat(td(a,g))),wd(e,b)):ud(a,b,f,g)}function vd(a,b){var c;return c=a.map(function(a){return ud(a.values,b)}),wd(c,b)}function wd(a,b){var c,d;return a.forEach(function(a){var e=ke(a,b);(c>e||!c)&&(c=e,d=a)}),d}function xd(a,b){return ff.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function yd(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 zd(){return kg&&"desc"===kg.toLowerCase()}function Ad(){return kg&&"asc"===kg.toLowerCase()}function Bd(a){var b=Ad(),c=zd();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 kg&&a.sort(kg),a}function Cd(a,c){var d,e,f,g,h,i,j,k=Td(gf.data.targets),l=k?nd:md,m=a.filter(function(a){return a&&b(a.value)});Jh&&0!==m.length&&(Ci.html(Mh(a,$(),l,ci)).style("display","block"),d=Ci.property("offsetWidth"),e=Ci.property("offsetHeight"),k?(g=xf/2+c[0],i=zf/2+c[1]+20):(Gg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Sf(m[0].x)+20):(f=q(),g=f+t()+Sf(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Ci.style("top",i+"px").style("left",g+"px"))}function Dd(){Ci.style("display","none")}function Ed(a){var c=a.filter(function(a){return a&&b(a.value)});Jh&&(Qd(gf.data.targets)||Td(gf.data.targets)||zi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Gg?"y1":"x1",pd).attr(Gg?"y2":"x2",pd))}function Fd(){zi.select("line."+f.xgridFocus).style("visibility","hidden")}function Gd(a){return a.x||0===a.x?Sf(a.x):null}function Hd(a){return V(a.id)(a.value)}function Id(){var a,b,d={},e=0;return Dc(Ac(Wd)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Md(a,b){return vh?vh:b?2*a.tickOffset()*wh/b:0}function Nd(a,b){yc(a).forEach(function(a){Gi[a]=b===ig[a],ig[a]=b})}function Od(a,b){var c=!1;return a.forEach(function(a){ig[a.id]===b&&(c=!0),a.id in ig||"line"!==b||(c=!0)}),c}function Pd(a){return Od(a,"bar")}function Qd(a){return Od(a,"scatter")}function Rd(a){return Od(a,"pie")}function Sd(a){return Od(a,"donut")}function Td(a){return Rd(a)||Sd(a)}function Ud(a){var b="string"==typeof a?a:a.id;return!(b in ig)||"line"===ig[b]||"spline"===ig[b]||"area"===ig[b]||"area-spline"===ig[b]}function Vd(a){var b="string"==typeof a?a:a.id;return"spline"===ig[b]||"area-spline"===ig[b]}function Wd(a){var b="string"==typeof a?a:a.id;return"bar"===ig[b]}function Xd(a){var b="string"==typeof a?a:a.id;return"scatter"===ig[b]}function Yd(a){var b="string"==typeof a?a:a.id;return"pie"===ig[b]}function Zd(a){var b="string"==typeof a?a:a.id;return"donut"===ig[b]}function $d(a){return Yd(a)||Zd(a)}function _d(a){return Wd(a)?a.values:[]}function ae(a){return Ud(a)||Xd(a)?a.values:[]}function be(a){return Wd(a)||Ud(a)?a.values:[]}function ce(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function de(b){var c;if(!b)throw Error(b+" can not be parsed as d3.time with format "+cg+". Maybe 'x' of this data is not defined. See data.x or data.xs option.");try{c=cg?ff.time.format(cg).parse(b):new Date(b)}catch(d){c=void 0}return c||a.console.error("Failed to parse x '"+b+"' to Date with format "+cg),c}function ee(a,b){var c=ff.mouse(a),d=ff.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function je(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ke(a,b){var c="y"===Z(a.id)?Tf:Uf,d=Gg?1:0,e=Gg?0:1;return Math.pow(Sf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function le(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function me(a,b,c){vg(b,a.node()),zi.select("."+f.selectedCircles+bd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Gg?Hd:Gd).attr("cy",Gg?Gd:Hd).attr("stroke",function(){return ci(b)}).attr("r",1.4*uh).transition().duration(100).attr("r",uh)}function ne(a,b,c){wg(b,a.node()),zi.select("."+f.selectedCircles+bd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function oe(a,b,c,d){a?me(b,c,d):ne(b,c,d)}function pe(a,b){vg(b,a.node()),a.transition().duration(100).style("fill",function(){return ff.rgb(ci(b)).darker(1)})}function qe(a,b){wg(b,a.node()),a.transition().duration(100).style("fill",function(){return ci(b)})}function re(a,b,c,d){a?pe(b,c,d):qe(b,c,d)}function se(a){return a.filter(function(a){return b(a.value)})}function te(a,c){return(c?zi.selectAll("."+f.circles+bd(c)):zi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ue(a,b){te(a,b).classed(f.EXPANDED,!0).attr("r",th)}function ve(a){te(a).filter(function(){return ff.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",qh)}function we(a){return zi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function xe(a){we(a).classed(f.EXPANDED,!0)}function ye(a){we(a).classed(f.EXPANDED,!1)}function ze(a,b){var c=De(a,b);return function(a,b){var d=c(a,b),e=Gg?1:0,f=Gg?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 Ae(a,b){var c=De(a,!1),d=b?Be:Ce;return function(a,b){return d(c(a,b),a,this)}}function Be(a,b){var c;return Gg?(c=Wd(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ce(a,b,c){var d=c.getBBox();return Gg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:Wd(b)?-3:-6)}function De(a,b){var c=a.__max__+1,d=Md(Yf,c),e=Jd(d,c,a,!!b),f=Kd(!!b),g=Ld(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Gg&&(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 Ee(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 Fe(b){var c,d,e;if(Di=ff.select(jf),Di.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Di.html(""),Di.classed("c3",!0),gf.data.xs={},gf.data.targets=rc(b),n(),R(),Sf.domain(ff.extent(Zb(gf.data.targets))),Tf.domain(Ub(gf.data.targets,"y")),Uf.domain(Ub(gf.data.targets,"y2")),Vf.domain(Sf.domain()),Wf.domain(Tf.domain()),Xf.domain(Uf.domain()),Ei=Sf.domain(),si.scale(Vf),of&&wi.scale(Sf),xi=Di.append("svg").attr("width",xf+uf.left+uf.right).attr("height",zf+uf.top+uf.bottom).on("mouseenter",rf).on("mouseleave",sf),yi=xi.append("defs"),yi.append("clipPath").attr("id",Qh).append("rect").attr("width",xf).attr("height",zf),yi.append("clipPath").attr("id",Rh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),yi.append("clipPath").attr("id",Sh).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),zi=xi.append("g").attr("transform",ki.main),Ai=zg?xi.append("g").attr("transform",ki.context):null,Bi=xi.append("g").attr("transform",ki.legend),Cg||(Bi.style("visibility","hidden"),fi=xc(gf.data.targets)),Ci=ff.select(jf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),af(xc(gf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),zi.append("g").attr("class",f.axisX).attr("clip-path",Gg?"":Uh).attr("transform",ki.x).append("text").attr("class",f.axisXLabel).attr("transform",Gg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),Tg&&zi.append("g").attr("class",f.axisY).attr("clip-path",Gg?Vh:"").attr("transform",ki.y).append("text").attr("class",f.axisYLabel).attr("transform",Gg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),ah&&zi.append("g").attr("class",f.axisY2).attr("transform",ki.y2).append("text").attr("class",f.axisY2Label).attr("transform",Gg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=zi.append("g").attr("clip-path",Th).attr("class",f.grid),jh&&d.append("g").attr("class",f.xgrids),ie(lh)&&d.append("g").attr("class",f.xgridLines),rh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),mh&&d.append("g").attr("class",f.ygrids),ie(nh)&&d.append("g").attr("class",f.ygridLines),zi.append("g").attr("clip-path",Th).attr("class",f.regions),zi.append("g").attr("clip-path",Th).attr("class",f.chart),c=zi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",of?Gg?"ns-resize":"ew-resize":null),zi.select("."+f.chart).append("g").attr("class",f.chartBars),zi.select("."+f.chart).append("g").attr("class",f.chartLines),zi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",ki.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),zi.select("."+f.chart).append("g").attr("class",f.chartTexts),of&&zi.insert("rect",qf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",xf).attr("height",zf).style("opacity",0).style("cursor",Gg?"ns-resize":"ew-resize").call(wi).on("dblclick.zoom",null),Rg&&si.extent("function"!=typeof Rg?Rg:Rg(Zb())),zg&&(Ai.append("g").attr("clip-path",Th).attr("class",f.chart),Ai.select("."+f.chart).append("g").attr("class",f.chartBars),Ai.select("."+f.chart).append("g").attr("class",f.chartLines),Ai.append("g").attr("clip-path",Th).attr("class",f.brush).call(si).selectAll("rect").attr(Gg?"width":"height",Gg?yf:Af),Ai.append("g").attr("class",f.axisX).attr("transform",ki.subx).attr("clip-path",Gg?"":Uh)),Se(gf.data.targets),Gg?zi.select("."+f.axisX).style("opacity",0).call(Yf):(zi.select("."+f.axisY).style("opacity",0).call(Zf),zi.select("."+f.axisY2).style("opacity",0).call($f)),Me({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Nh){if(Wh&&"string"==typeof Oh){for(Oh=de(Oh),e=0;e0){d=[];for(var g in eg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=yd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=re,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 Ke(a){Td(gf.data.targets)||og&&(Zh=a,zi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),$h=!0,xg())}function Le(){Td(gf.data.targets)||og&&(zi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),zi.selectAll("."+f.shape).classed(f.INCLUDED,!1),$h=!1,yg())}function Me(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Id(),U=Td(gf.data.targets),V=Dc(gf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?tf:0,O=B?N:0,P=C?N:0,H&&Cg&&af(xc(gf.data.targets),a),G&&(Sf.domain(ff.extent(Zb(V))),Ei=Sf.domain(),of&&wi.scale(Sf).updateScaleExtent(),Vf.domain(Sf.domain()),si.scale(Vf)),F&&(Sf.domain(si.empty()?Ei:si.extent()),of&&wi.scale(Sf).updateScaleExtent()),Tf.domain(Ub(V,"y")),Uf.domain(Ub(V,"y2")),Qd(V)||(Q=Fc(Ec(V)).sort(),Yf.tickValues(Q),_f.tickValues(Q)),c=zi.select("."+f.axisX).style("opacity",U?0:1),(Gg||D)&&(c=c.transition().duration(P)),c.call(Yf),e=zi.select("."+f.axisY).style("opacity",U?0:1),(!Gg||D)&&(e=e.transition().duration(P)),e.call(Zf),zi.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call($f),F&&Lg&&Q){for(R=1;R=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=Sf.ticks(10);g=zi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Gg?0:function(a){return Sf(a)-Yf.tickOffset()}).attr("x2",Gg?xf:function(a){return Sf(a)-Yf.tickOffset()}).attr("y1",Gg?function(a){return Sf(a)-Yf.tickOffset()}:uf.top).attr("y2",Gg?function(a){return Sf(a)-Yf.tickOffset()}:zf).style("opacity",function(){return+ff.select(this).attr(Gg?"y1":"x1")===(Gg?zf:0)?0:1}),g.exit().remove()}ie(lh)&&(i=zi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(lh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Gg?"":"rotate(-90)").attr("dx",Gg?0:-uf.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Gg?0:qd).attr("x2",Gg?xf:qd).attr("y1",Gg?qd:uf.top).attr("y2",Gg?qd:zf).style("opacity",1),i.select("text").transition().duration(N).attr("x",Gg?xf:0).attr("y",qd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&mh&&(k=zi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Tf.ticks(oh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Gg?Tf:0).attr("x2",Gg?Tf:xf).attr("y1",Gg?0:Tf).attr("y2",Gg?zf:Tf),k.exit().remove()),y&&ie(nh)&&(l=zi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(nh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Gg?"rotate(-90)":"").attr("dx",Gg?0:-uf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Gg?rd:0).attr("x2",Gg?rd:xf).attr("y1",Gg?0:rd).attr("y2",Gg?zf:rd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Gg?0:xf).attr("y",rd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=zi.selectAll("."+f.bars).selectAll("."+f.bar).data(_d),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ci(a)}).attr("class",Xc),p.style("opacity",gd).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=zi.selectAll("."+f.texts).selectAll("."+f.text).data(be),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Gg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return od(a.id)(a.value)}).style("fill-opacity",hd).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",jd),r.exit().transition().duration(O).style("fill-opacity",0).remove(),zi.selectAll("."+f.line).style("opacity",gd).transition().duration(N).attr("d",ti).style("opacity",1),zi.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",ui).style("opacity",Fi),n=zi.selectAll("."+f.circles).selectAll("."+f.circle).data(ae),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",qh),n.style("opacity",gd).transition().duration(N).style("opacity",id).attr("cx",Gg?Hd:Gd).attr("cy",Gg?Gd:Hd),n.exit().remove(),zi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=ff.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),zi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&$d(a.data)?1:0}),zi.select("."+f.chartArcsTitle).style("opacity",Sd(gf.data.targets)?1:0),zg&&(null!==ff.event&&"zoom"===ff.event.type&&si.extent(Sf.orgDomain()).update(),z&&(Ai.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(_f),si.empty()||si.extent(Sf.orgDomain()).update(),J=ze(T,!0),s=Ai.selectAll("."+f.bars).selectAll("."+f.bar).data(_d),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ci(a)}).attr("class",Xc),s.style("opacity",gd).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Ai.selectAll("."+f.line).style("opacity",gd).transition().duration(N).attr("d",vi).style("opacity",1))),zi.selectAll("."+f.selectedCircles).filter(function(a){return Wd(a)}).selectAll("circle").remove(),zi.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Gg?Hd:Gd).attr("cy",Gg?Gd:Hd),t=zi.select("."+f.eventRects),ie(bg)&&!kc(bg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=zi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),He(u.enter()),u.attr("x",0).attr("y",0).attr("width",xf).attr("height",zf)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Yh&&!Xh?(x=function(a,b){var c=tc(b),d=uc(b),e=gf.data.xs[a.id][b];return(Sf(d?d:e+50)-Sf(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=gf.data.xs[a.id][b];return(Sf(d)+Sf(c?c:d-50))/2}):(x=L(),w=function(a){return Sf(a.x)-x/2}),v=wc(),zi.select("."+f.eventRects).datum(v?v.values:[]),u=zi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ge(u.enter()),u.attr("class",ad).attr("x",Gg?0:w).attr("y",Gg?w:0).attr("width",Gg?xf:x).attr("height",Gg?x:zf),u.exit().remove()),q=zi.select("."+f.regions).selectAll("rect."+f.region).data(Ih),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Gg?0:cc).attr("y",Gg?cc:uf.top).attr("width",Gg?xf:dc).attr("height",Gg?dc:zf).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),xc(gf.data.targets).forEach(function(a){Gi[a]=!0})}}function Ne(){Me({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Oe(){return"mousemove"===ff.event.sourceEvent.type&&wi.altDomain?(Sf.domain(wi.altDomain),void wi.scale(Sf).updateScaleExtent()):(Xh&&Sf.orgDomain()[0]===Ei[0]&&Sf.domain([Ei[0]-1e-10,Sf.orgDomain()[1]]),Me({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===ff.event.sourceEvent.type&&(_h=!0)))}function Pe(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Qe(){xi.attr("width",Bf).attr("height",Cf),xi.select("#"+Qh).select("rect").attr("width",xf).attr("height",zf),xi.select("#"+Rh).select("rect").attr("width",H),xi.select("#"+Sh).select("rect").attr("width",J),xi.select("."+f.zoomRect).attr("width",xf).attr("height",zf)}function Re(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Qe(),m(a.withTransition),Me(a)}function Se(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=zi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a),j=i.enter().append("g").attr("class",function(a){return f.chartText+Pc(f.target,a.id)}).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ci(a)}),e=zi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),d=e.enter().append("g").attr("class",function(a){return f.chartBar+Pc(f.target,a.id)}).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ci(a)}).style("stroke","none").style("cursor",function(a){return qg(a)?"pointer":null}),c=zi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),b=c.enter().append("g").attr("class",function(a){return f.chartLine+Pc(f.target,a.id)}).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ci(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Fi=+ff.select(this).style("opacity"),0}).style("fill",function(a){return ci(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ci(a)}).style("cursor",function(a){return qg(a)?"pointer":null}),a.forEach(function(a){zi.selectAll("."+f.selectedCircles+bd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=zi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Jf(a)),g=h.enter().append("g").attr("class",function(a){return f.chartArc+Pc(f.target,a.data.id)}),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ci(a.data)}).style("cursor",function(a){return qg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),Xe(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Cd(c,ff.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),Ze(),Dd(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),zg&&(n=Ai.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),m=n.enter().append("g").attr("class",function(a){return f.chartBar+Pc(f.target,a.id)}),m.append("g").attr("class",Yc).style("fill",function(a){return ci(a)}),l=Ai.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),k=l.enter().append("g").attr("class",function(a){return f.chartLine+Pc(f.target,a.id)}),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ci(a)})),xi.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Te(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Nd(a.id,b.types[a.id]):Nd(a.id,b.type)}),gf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBBox(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=li?j:i,l=li?Q():P();return d&&(w=0,C=0,t=0,u=0),Cg&&!Cc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=li?u:t,void(Fg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,li?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Bi.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Eg?Eg(a):gf.toggle(a)}).on("mouseover",function(a){gf.focus(a)}).on("mouseout",function(){gf.revert()}),l.append("text").text(function(a){return d(eg[a])?eg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",li?g:-200).attr("y",li?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",li?h:-200).attr("y",li?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return ci(a)}).attr("x",li?g:-200).attr("y",li?-200:i).attr("width",10).attr("height",10),Bi.selectAll("text").data(a).text(function(a){return d(eg[a])?eg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Bi.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Bi.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Qe(),q&&m(p)}function bf(a){return zc(gf.data.targets,a.id)}function cf(a){return"data"in a&&zc(gf.data.targets,a.data.id)}function df(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 ef(a,b,c){var d=!Td(gf.data.targets);Nd(a,b),Re(c?c:{withTransitionForAxis:d})}var ff=a.d3?a.d3:a.require?a.require("d3"):void 0,gf={data:{},axis:{},legend:{}},hf={},jf=h(["bindto"],"#chart"),kf=h(["size","width"]),lf=h(["size","height"]),mf=h(["padding","left"]),nf=h(["padding","right"]),of=h(["zoom","enabled"],!1),pf=h(["zoom","extent"]),qf=h(["zoom","privileged"],!1),rf=h(["onenter"],function(){}),sf=h(["onleave"],function(){}),tf=h(["transition","duration"],350);g("data","data is required in config");var uf,vf,wf,xf,yf,zf,Af,Bf,Cf,Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag=h(["data","x"]),bg=h(["data","xs"],{}),cg=h(["data","x_format"]),dg=h(["data","id_converter"],function(a){return a}),eg=h(["data","names"],{}),fg=h(["data","groups"],[]),gg=h(["data","axes"],{}),hg=h(["data","type"]),ig=h(["data","types"],{}),jg=h(["data","labels"],{}),kg=h(["data","order"]),lg=h(["data","regions"],{}),mg=h(["data","color"]),ng=h(["data","colors"],{}),og=h(["data","selection","enabled"],!1),pg=h(["data","selection","grouped"],!1),qg=h(["data","selection","isselectable"],function(){return!0}),rg=h(["data","selection","multiple"],!0),sg=h(["data","onclick"],function(){}),tg=h(["data","onenter"],function(){}),ug=h(["data","onleave"],function(){}),vg=h(["data","onselected"],function(){}),wg=h(["data","onunselected"],function(){}),xg=h(["data","ondragstart"],function(){}),yg=h(["data","ondragend"],function(){}),zg=h(["subchart","show"],!1),Ag=zg?h(["subchart","size","height"],60):0,Bg=h(["color","pattern"],[]),Cg=h(["legend","show"],!0),Dg=h(["legend","position"],"bottom"),Eg=h(["legend","item","onclick"]),Fg=h(["legend","equally"],!1),Gg=h(["axis","rotated"],!1),Hg=h(["axis","x","type"],"indexed"),Ig=h(["axis","x","categories"],[]),Jg=h(["axis","x","tick","centered"],!1),Kg=h(["axis","x","tick","format"]),Lg=h(["axis","x","tick","culling"],{}),Mg=h(["axis","x","tick","culling","max"],"categorized"===Hg?1/0:10),Ng=h(["axis","x","tick","count"]),Og=h(["axis","x","tick","fit"],!1),Pg=h(["axis","x","max"]),Qg=h(["axis","x","min"]),Rg=h(["axis","x","default"]),Sg=h(["axis","x","label"],{}),Tg=h(["axis","y","show"],!0),Ug=h(["axis","y","max"]),Vg=h(["axis","y","min"]),Wg=h(["axis","y","center"]),Xg=h(["axis","y","label"],{}),Yg=h(["axis","y","inner"],!1),Zg=h(["axis","y","tick","format"]),$g=h(["axis","y","padding"],{}),_g=h(["axis","y","ticks"],10),ah=h(["axis","y2","show"],!1),bh=h(["axis","y2","max"]),ch=h(["axis","y2","min"]),dh=h(["axis","y2","center"]),eh=h(["axis","y2","label"],{}),fh=h(["axis","y2","inner"],!1),gh=h(["axis","y2","tick","format"]),hh=h(["axis","y2","padding"],{}),ih=h(["axis","y2","ticks"],10),jh=h(["grid","x","show"],!1),kh=h(["grid","x","type"],"tick"),lh=h(["grid","x","lines"],[]),mh=h(["grid","y","show"],!1),nh=h(["grid","y","lines"],[]),oh=h(["grid","y","ticks"],10),ph=h(["point","show"],!0),qh=ph?h(["point","r"],2.5):0,rh=h(["point","focus","line","enabled"],!0),sh=h(["point","focus","expand","enabled"],!0),th=h(["point","focus","expand","r"],sh?4:qh),uh=h(["point","focus","select","r"],8),vh=h(["bar","width"]),wh=h(["bar","width","ratio"],.6),xh=h(["pie","label","show"],!0),yh=h(["pie","label","format"]),zh=h(["pie","onclick"],function(){}),Ah=h(["pie","onmouseover"],function(){}),Bh=h(["pie","onmouseout"],function(){}),Ch=h(["donut","label","show"],!0),Dh=h(["donut","label","format"]),Eh=h(["donut","title"],""),Fh=h(["donut","onclick"],function(){}),Gh=h(["donut","onmouseover"],function(){}),Hh=h(["donut","onmouseout"],function(){}),Ih=h(["regions"],[]),Jh=h(["tooltip","show"],!0),Kh=h(["tooltip","format","title"]),Lh=h(["tooltip","format","value"]),Mh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Kh?Kh:b,l=Lh?Lh: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+""}),Nh=h(["tooltip","init","show"],!1),Oh=h(["tooltip","init","x"],0),Ph=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Qh=("string"==typeof jf?jf.replace("#",""):jf.id)+"-clip",Rh=Qh+"-xaxis",Sh=Qh+"-yaxis",Th=i(Qh),Uh=i(Uh),Vh=i(Vh),Wh="timeseries"===Hg,Xh="categorized"===Hg,Yh=!Wh&&(ag||ie(bg)),Zh=null,$h=!1,_h=!1,ai=!1,bi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ci=ce(ng,ie(Bg)?Bg:bi,mg),di=function(){var a=[[ff.time.format("%Y/%-m/%-d"),function(){return!0}],[ff.time.format("%-m/%-d"),function(a){return a.getMonth()}],[ff.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[ff.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[ff.time.format("%I %p"),function(a){return a.getHours()}],[ff.time.format("%I:%M"),function(a){return a.getMinutes()}],[ff.time.format(":%S"),function(a){return a.getSeconds()}],[ff.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)}}(),ei=[],fi=[],gi=Gg?"left":"bottom",hi=Gg?Yg?"top":"bottom":Yg?"right":"left",ii=Gg?fh?"bottom":"top":fh?"left":"right",ji=Gg?"left":"bottom",ki={main:function(){return"translate("+uf.left+","+uf.top+")"},context:function(){return"translate("+vf.left+","+vf.top+")"},legend:function(){return"translate("+wf.left+","+wf.top+")"},x:function(){return"translate(0,"+(Gg?0:zf)+")"},y:function(){return"translate(0,"+(Gg?zf:0)+")"},y2:function(){return"translate("+(Gg?0:xf)+","+(Gg?1:0)+")"},subx:function(){return"translate(0,"+(Gg?0:Af)+")"},arc:function(){return"translate("+xf/2+","+zf/2+")"}},li="right"===Dg,mi=0,ni=0,oi=0,pi=30,qi=30,ri=5;Jf=ff.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var si,ti=function(){var a=ff.svg.line().x(Gg?function(a){return V(a.id)(a.value)}:pd).y(Gg?pd:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=se(b.values);return Ud(b)?(a.interpolate(Vd(b)?"cardinal":"linear"),lg[b.id]?Ee(e,Sf,V(b.id),lg[b.id]):a(e)):(c=Sf(e[0].x),d=V(b.id)(e[0].value),Gg?"M "+d+" "+c:"M "+c+" "+d)}}(),ui=function(){var a;return a=Gg?ff.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(pd):ff.svg.area().x(pd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=se(b.values);return Od([b],"area")||Od([b],"area-spline")?(a.interpolate(Vd(b)?"cardinal":"linear"),a(e)):(c=Sf(e[0].x),d=V(b.id)(e[0].value),Gg?"M "+d+" "+c:"M "+c+" "+d)}}(),vi=function(){var a=ff.svg.line().x(Gg?function(a){return W(a.id)(a.value)}:sd).y(Gg?sd:function(a){return W(a.id)(a.value)});return function(b){var c=se(b.values);return Ud(b)?a(c):"M "+Vf(c[0].x)+" "+W(b.id)(c[0].value)}}(),wi=function(){};si=ff.svg.brush().on("brush",Ne),si.update=function(){return Ai&&Ai.select("."+f.brush).call(this),this},si.scale=function(a){return Gg?this.y(a):this.x(a)},of&&(wi=ff.behavior.zoom().on("zoomstart",function(){wi.altDomain=ff.event.sourceEvent.altKey?Sf.orgDomain():null}).on("zoom",of?Oe:null),wi.scale=function(a){return Gg?this.y(a):this.x(a)},wi.orgScaleExtent=function(){var a=pf?pf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},wi.updateScaleExtent=function(){var a=$b(Sf.orgDomain())/$b(Ei),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var xi,yi,zi,Ai,Bi,Ci,Di,Ei,Fi,Gi={};if(gf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=xi.selectAll(cd(a)),d=c.filter(bf),e=c.filter(cf);gf.revert(),gf.defocus(),b(d.classed(f.focused,!0)),b(e),Td(gf.data.targets)&&Kb(a,!0),Xe(a)},gf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=xi.selectAll(cd(a)),d=c.filter(bf),e=c.filter(cf);gf.revert(),b(d.classed(f.focused,!1)),b(e),Td(gf.data.targets)&&Lb(a),Ye(a)},gf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=xi.selectAll(cd(a)),d=c.filter(bf),e=c.filter(cf);b(d.classed(f.focused,!1)),b(e),Td(gf.data.targets)&&Lb(a),Ze()},gf.show=function(a,b){a=yc(a),b=b||{},Hc(a),xi.selectAll(dd(a)).transition().style("opacity",1),b.withLegend&&$e(a),Me({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},gf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),xi.selectAll(dd(a)).transition().style("opacity",0),b.withLegend&&_e(a),Me({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},gf.toggle=function(a){Bc(a)?gf.hide(a):gf.show(a)},gf.unzoom=function(){si.clear().update(),Me({withUpdateXDomain:!0})},gf.load=function(a){return a.xs&&jc(a.xs),"categories"in a&&Xh&&(Ig=a.categories,Yf.categories(Ig)),"cacheIds"in a&&_b(a.cacheIds)?void Te(bc(a.cacheIds),a.done):void("unload"in a?Ve(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ue(a)}):Ue(a))},gf.unload=function(a){Ve(yc(a),function(){Me({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},gf.selected=function(a){return ff.merge(zi.selectAll("."+f.shapes+bd(a)).selectAll("."+f.shape).filter(function(){return ff.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},gf.select=function(a,b,c){og&&zi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=ff.select(this),i="circle"===this.nodeName?me:pe,j="circle"===this.nodeName?ne:qe,k=pg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?qg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},gf.unselect=function(a,b){og&&zi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=ff.select(this),g="circle"===this.nodeName?ne:qe,h=pg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&qg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},gf.toLine=function(a){ef(a,"line")},gf.toSpline=function(a){ef(a,"spline")},gf.toBar=function(a){ef(a,"bar")},gf.toScatter=function(a){ef(a,"scatter")},gf.toArea=function(a){ef(a,"area")},gf.toAreaSpline=function(a){ef(a,"area-spline")},gf.toPie=function(a){ef(a,"pie",{withTransform:!0})},gf.toDonut=function(a){ef(a,"donut",{withTransform:!0})},gf.groups=function(a){return c(a)?fg:(fg=a,Me(),fg)},gf.xgrids=function(a){return a?(lh=a,Me(),lh):lh},gf.xgrids.add=function(a){return a?gf.xgrids(lh.concat(a)):void 0},gf.xgrids.remove=function(a){var b=df(a);return gf.xgrids(lh.filter(b))},gf.ygrids=function(a){return a?(nh=a,Me(),nh):nh},gf.ygrids.add=function(a){return a?gf.ygrids(nh.concat(a)):void 0},gf.ygrids.remove=function(a){var b=df(a);return gf.ygrids(nh.filter(b))},gf.regions=function(a){return c(a)?Ih:(Ih=a,Me(),Ih)},gf.regions.add=function(a){return c(a)?Ih:(Ih=Ih.concat(a),Me(),Ih)},gf.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;xi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Ih=Ih.filter(function(b){return b.classes.indexOf(a)<0})}),Ih},gf.data.get=function(a){var b=gf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},gf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},gf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){eg[b]=a[b]}),af(xc(gf.data.targets),{withTransition:!0}),eg):eg},gf.x=function(a){return arguments.length&&(mc(gf.data.targets,a),Me({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),gf.data.xs},gf.xs=function(a){return arguments.length&&(nc(gf.data.targets,a),Me({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),gf.data.xs +},gf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},gf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Ug=+a.y),b(a.y2)&&(bh=+a.y2)):Ug=bh=+a,Me())},gf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Vg=+a.y),b(a.y2)&&(ch=+a.y2)):Vg=ch=+a,Me())},gf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&gf.axis.max(a.max),"undefined"!=typeof a.min&&gf.axis.min(a.min))},gf.legend.show=function(a){Cg||(Cg=!0,Bi.style("visibility","visible")),$e(yc(a)),Me({withTransitionForHorizontalAxis:!1})},gf.legend.hide=function(a){Cg&&he(a)&&(Cg=!1,Bi.style("visibility","hidden")),_e(yc(a)),Me({withTransitionForHorizontalAxis:!1})},gf.resize=function(a){kf=a?a.width:null,lf=a?a.height:null,Re({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},gf.destroy=function(){gf.data.targets=void 0,gf.data.xs={},Di.html(""),a.onresize=null},"url"in e.data)ff.csv(e.data.url,function(a,b){Fe(b)});else if("rows"in e.data)Fe(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Fe(qc(e.data.columns))}return gf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From ea641a2963a6191be29c9c1f36623d1e21b0a9c3 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Tue, 8 Apr 2014 21:22:31 +0900 Subject: [PATCH 019/178] Fix x axis tick culling - #136 --- c3.js | 1 + c3.min.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/c3.js b/c3.js index f19e78e..cdb52a5 100644 --- a/c3.js +++ b/c3.js @@ -3010,6 +3010,7 @@ break; } } + d3.selectAll('.' + CLASS.axisX + ' .tick').sort(function (e1, e2) { return e1 - e2; }); d3.selectAll('.' + CLASS.axisX + ' .tick text').each(function (e, i) { d3.select(this).style('display', i % intervalForCulling ? 'none' : 'block'); }); diff --git a/c3.min.js b/c3.min.js index a290896..ff4c6bd 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ !function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.29"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",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;cxf&&(xf=0),0>zf&&(zf=0),vf={top:Gg?uf.top:Cf-Ag-(li?0:a),right:0/0,bottom:20+(li?0:a),left:Gg?pi:uf.left},yf=Gg?uf.left-pi-qi:xf,Af=Gg?zf:Cf-vf.top-vf.bottom,0>yf&&(yf=0),0>Af&&(Af=0),wf={top:li?0:Cf-a,right:0/0,bottom:0,left:li?Bf-b:0},p(),li&&Td(gf.data.targets)&&(wf.left=xf/2+Ef)}function o(){zi.select("line."+f.xgridFocus).attr("x1",Gg?0:-10).attr("x2",Gg?xf:-10).attr("y1",Gg?-10:uf.top).attr("y2",Gg?-10:zf)}function p(){Ef=zf/2,Df=.95*Ef,Ff=Sd(gf.data.targets)?.6*Df:0}function q(){var a=Gg?f.axisX:f.axisY,b=ff.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=ff.select(jf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return kf?kf:x()}function s(){var a=lf?lf:y();return a>0?a:320}function t(){return Td(gf.data.targets)?0:mf?mf:Gg||!Tg||Yg?1:v("y")}function u(){var a=1;return Td(gf.data.targets)?0:nf?nf:li?P()+(ah&&!Gg?v("y2"):a):ah?fh||Gg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||Tg?"y2"!==a||ah?(gb(a).isInner?30:40)+("y2"===a?-10:0):ri:Cg&&!li?10:1}function x(){return+ff.select(jf).style("width").replace("px","")}function y(){return+ff.select(jf).style("height").replace("px","")}function z(a){return a?-5:-(uf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Gg)}function C(){return A(!Gg)}function D(){return z(Gg)}function E(){return A(Gg)}function F(a){return a?xf+2+4:uf.left+20}function G(a){return a?80:zf+2}function H(){return F(!Gg)}function I(){return G(!Gg)}function J(){return F(Gg)}function K(){return G(Gg)}function L(){var a=Gg?zf:xf,b=vc(),c=Vb()*(Pd(gf.data.targets)?(b-(Xh?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){mi=a}function N(a){ni=a}function O(a){oi=a}function P(){return Cg?li?ni*(mi+1):Bf:0}function Q(){return Cg?li?Cf:oi*(mi+1):0}function R(){var a,b=!Sf;Kf=Gg?1:0,Lf=Gg?zf:xf,Mf=Gg?0:zf,Nf=Gg?xf:1,Of=Kf,Pf=Lf,Qf=Gg?0:Af,Rf=Gg?yf:1,Sf=T(Kf,Lf,b?void 0:Sf.domain(),function(){return Yf.tickOffset()}),Tf=U(Mf,Nf),Uf=U(Mf,Nf),Vf=T(Kf,Lf,Ei,function(a){return a%1?0:_f.tickOffset()}),Wf=U(Qf,Rf),Xf=U(Qf,Rf),a=$(),Yf=X(Sf,gi,a),_f=X(Vf,ji,a),Zf=Y(Tf,hi,Zg,_g),$f=Y(Uf,ii,gh,ih),b||(si.scale(Vf),of&&wi.scale(Sf)),S()}function S(){Gf=Db(),Hf=Eb(),If=Eb(.98)}function T(a,b,e,f){var g=(Wh?ff.time.scale():ff.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),Xh){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return ff.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?Uf:Tf}function W(a){return"y2"===Z(a)?Xf:Wf}function X(a,b,c){var d=(Xh?Bb():ff.svg.axis()).scale(a).orient(b);return d.tickFormat(c),Xh?d.tickCentered(Jg):d.tickOffset=function(){var a=Gg?zf:xf;return a*Vb()/vc()/2},Xh&&d.categories(Ig),d}function Y(a,b,c,d){return ff.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in gg?gg[a]:"y"}function $(){var a=Wh?di:Xh?Oc:function(a){return 0>a?a.toFixed(0):a};return Kg&&("function"==typeof Kg?a=Kg:Wh&&(a=function(a){return ff.time.format(Kg)(a)})),a}function _(a){var b;return"y"===a?b=Xg:"y2"===a?b=eh:"x"===a&&(b=Sg),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Xg=b:"y2"===a?eh=b:"x"===a&&(Sg=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Gg?"inner-top":"inner-right")}function eb(){return cb("y",Gg?"inner-right":"inner-top")}function fb(){return cb("y2",Gg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?xf/2:xf:b.isBottom?-zf:b.isMiddle?-zf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Gg,db())}function ob(){return kb(Gg,eb())}function pb(){return kb(Gg,fb())}function qb(){return lb(!Gg,db())}function rb(){return lb(Gg,eb())}function sb(){return lb(Gg,fb())}function tb(){var a=db();return Gg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Gg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Gg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Gg,db())}function xb(){return mb(Gg,eb())}function yb(){return mb(Gg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return ff.selectAll("."+c+" .tick text").each(function(){var a=this.getBBox();bb?20:b}function Ab(){zi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),zi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),zi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return ff.min(Object.keys(i).map(function(a){return ff.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(fg.length>0)for(g=Nc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return ff.max(Object.keys(i).map(function(a){return ff.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?ch:Vg,n="y2"===c?bh:Ug,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?dh:Wg,r=kd()&⋙return 0===l.length?"y2"===c?Uf.domain():Tf.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=ld(o,p),j=$b(Tf.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&$g&&(f=b($g.top)?$g.top:e,g=b($g.bottom)?$g.bottom:e),"y2"===c&&hh&&(f=b(hh.top)?hh.top:e,g=b(hh.bottom)?hh.bottom:e),Pd(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Ei),c=$b(Sf.domain());return a||0===c?1:b/c}function Wb(a){return Qg?Qg:ff.min(a,function(a){return ff.min(a.values,function(a){return a.x})})}function Xb(a){return Pg?Pg:ff.max(a,function(a){return ff.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return Xh?d=0:Pd(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=Wh?new Date(c.getTime()-e):c-e,g=Wh?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return ag&&a===ag||ie(bg)&&je(bg,a)}function fc(a){return!ec(a)}function gc(a){return ag?ag:ie(bg)?bg[a]:null}function hc(a,b){var c,d=b&&ie(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=gf.data.xs[b])}),c}function ic(a,b){return a in gf.data.xs&&gf.data.xs[a]&&gf.data.xs[a][b]?gf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){bg[b]=a[b]})}function kc(a){return 1===ff.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=eg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),gf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=Wh?a?a instanceof Date?a:de(a):de(ic(b,c)):Yh&&!Xh?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?gf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):ag?(d=Object.keys(gf.data.xs),gf.data.xs[c]=d.length>0?gf.data.xs[d[0]]:void 0):ie(bg)&&(gf.data.xs[c]=hc(f,gf.data.targets)):gf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!gf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=dg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return Yh&&Xh&&0===c&&g&&(0===e&&(Ig=[]),Ig.push(g)),("undefined"==typeof a[b]||gf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),hg&&Nd(xc(c).filter(function(a){return!(a in ig)}),hg),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function tc(a){return a>0&&gf.data.targets[0].values[a-1]?gf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?gf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?gf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(gf.data.targets)}function zc(a,b){var c,d=xc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(Wh?new Date(h):h);i.push(d)}return i}function Gc(a){ei=ei.concat(a)}function Hc(a){ei=ei.filter(function(b){return a.indexOf(b)<0})}function Ic(a){fi=fi.concat(a)}function Jc(a){fi=fi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(td(a,f))),a[g].x&&(e=e.concat(td(a,g))),wd(e,b)):ud(a,b,f,g)}function vd(a,b){var c;return c=a.map(function(a){return ud(a.values,b)}),wd(c,b)}function wd(a,b){var c,d;return a.forEach(function(a){var e=ke(a,b);(c>e||!c)&&(c=e,d=a)}),d}function xd(a,b){return ff.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function yd(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 zd(){return kg&&"desc"===kg.toLowerCase()}function Ad(){return kg&&"asc"===kg.toLowerCase()}function Bd(a){var b=Ad(),c=zd();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 kg&&a.sort(kg),a}function Cd(a,c){var d,e,f,g,h,i,j,k=Td(gf.data.targets),l=k?nd:md,m=a.filter(function(a){return a&&b(a.value)});Jh&&0!==m.length&&(Ci.html(Mh(a,$(),l,ci)).style("display","block"),d=Ci.property("offsetWidth"),e=Ci.property("offsetHeight"),k?(g=xf/2+c[0],i=zf/2+c[1]+20):(Gg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Sf(m[0].x)+20):(f=q(),g=f+t()+Sf(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Ci.style("top",i+"px").style("left",g+"px"))}function Dd(){Ci.style("display","none")}function Ed(a){var c=a.filter(function(a){return a&&b(a.value)});Jh&&(Qd(gf.data.targets)||Td(gf.data.targets)||zi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Gg?"y1":"x1",pd).attr(Gg?"y2":"x2",pd))}function Fd(){zi.select("line."+f.xgridFocus).style("visibility","hidden")}function Gd(a){return a.x||0===a.x?Sf(a.x):null}function Hd(a){return V(a.id)(a.value)}function Id(){var a,b,d={},e=0;return Dc(Ac(Wd)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Md(a,b){return vh?vh:b?2*a.tickOffset()*wh/b:0}function Nd(a,b){yc(a).forEach(function(a){Gi[a]=b===ig[a],ig[a]=b})}function Od(a,b){var c=!1;return a.forEach(function(a){ig[a.id]===b&&(c=!0),a.id in ig||"line"!==b||(c=!0)}),c}function Pd(a){return Od(a,"bar")}function Qd(a){return Od(a,"scatter")}function Rd(a){return Od(a,"pie")}function Sd(a){return Od(a,"donut")}function Td(a){return Rd(a)||Sd(a)}function Ud(a){var b="string"==typeof a?a:a.id;return!(b in ig)||"line"===ig[b]||"spline"===ig[b]||"area"===ig[b]||"area-spline"===ig[b]}function Vd(a){var b="string"==typeof a?a:a.id;return"spline"===ig[b]||"area-spline"===ig[b]}function Wd(a){var b="string"==typeof a?a:a.id;return"bar"===ig[b]}function Xd(a){var b="string"==typeof a?a:a.id;return"scatter"===ig[b]}function Yd(a){var b="string"==typeof a?a:a.id;return"pie"===ig[b]}function Zd(a){var b="string"==typeof a?a:a.id;return"donut"===ig[b]}function $d(a){return Yd(a)||Zd(a)}function _d(a){return Wd(a)?a.values:[]}function ae(a){return Ud(a)||Xd(a)?a.values:[]}function be(a){return Wd(a)||Ud(a)?a.values:[]}function ce(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function de(b){var c;if(!b)throw Error(b+" can not be parsed as d3.time with format "+cg+". Maybe 'x' of this data is not defined. See data.x or data.xs option.");try{c=cg?ff.time.format(cg).parse(b):new Date(b)}catch(d){c=void 0}return c||a.console.error("Failed to parse x '"+b+"' to Date with format "+cg),c}function ee(a,b){var c=ff.mouse(a),d=ff.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function je(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ke(a,b){var c="y"===Z(a.id)?Tf:Uf,d=Gg?1:0,e=Gg?0:1;return Math.pow(Sf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function le(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function me(a,b,c){vg(b,a.node()),zi.select("."+f.selectedCircles+bd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Gg?Hd:Gd).attr("cy",Gg?Gd:Hd).attr("stroke",function(){return ci(b)}).attr("r",1.4*uh).transition().duration(100).attr("r",uh)}function ne(a,b,c){wg(b,a.node()),zi.select("."+f.selectedCircles+bd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function oe(a,b,c,d){a?me(b,c,d):ne(b,c,d)}function pe(a,b){vg(b,a.node()),a.transition().duration(100).style("fill",function(){return ff.rgb(ci(b)).darker(1)})}function qe(a,b){wg(b,a.node()),a.transition().duration(100).style("fill",function(){return ci(b)})}function re(a,b,c,d){a?pe(b,c,d):qe(b,c,d)}function se(a){return a.filter(function(a){return b(a.value)})}function te(a,c){return(c?zi.selectAll("."+f.circles+bd(c)):zi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ue(a,b){te(a,b).classed(f.EXPANDED,!0).attr("r",th)}function ve(a){te(a).filter(function(){return ff.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",qh)}function we(a){return zi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function xe(a){we(a).classed(f.EXPANDED,!0)}function ye(a){we(a).classed(f.EXPANDED,!1)}function ze(a,b){var c=De(a,b);return function(a,b){var d=c(a,b),e=Gg?1:0,f=Gg?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 Ae(a,b){var c=De(a,!1),d=b?Be:Ce;return function(a,b){return d(c(a,b),a,this)}}function Be(a,b){var c;return Gg?(c=Wd(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ce(a,b,c){var d=c.getBBox();return Gg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:Wd(b)?-3:-6)}function De(a,b){var c=a.__max__+1,d=Md(Yf,c),e=Jd(d,c,a,!!b),f=Kd(!!b),g=Ld(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Gg&&(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 Ee(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 Fe(b){var c,d,e;if(Di=ff.select(jf),Di.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Di.html(""),Di.classed("c3",!0),gf.data.xs={},gf.data.targets=rc(b),n(),R(),Sf.domain(ff.extent(Zb(gf.data.targets))),Tf.domain(Ub(gf.data.targets,"y")),Uf.domain(Ub(gf.data.targets,"y2")),Vf.domain(Sf.domain()),Wf.domain(Tf.domain()),Xf.domain(Uf.domain()),Ei=Sf.domain(),si.scale(Vf),of&&wi.scale(Sf),xi=Di.append("svg").attr("width",xf+uf.left+uf.right).attr("height",zf+uf.top+uf.bottom).on("mouseenter",rf).on("mouseleave",sf),yi=xi.append("defs"),yi.append("clipPath").attr("id",Qh).append("rect").attr("width",xf).attr("height",zf),yi.append("clipPath").attr("id",Rh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),yi.append("clipPath").attr("id",Sh).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),zi=xi.append("g").attr("transform",ki.main),Ai=zg?xi.append("g").attr("transform",ki.context):null,Bi=xi.append("g").attr("transform",ki.legend),Cg||(Bi.style("visibility","hidden"),fi=xc(gf.data.targets)),Ci=ff.select(jf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),af(xc(gf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),zi.append("g").attr("class",f.axisX).attr("clip-path",Gg?"":Uh).attr("transform",ki.x).append("text").attr("class",f.axisXLabel).attr("transform",Gg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),Tg&&zi.append("g").attr("class",f.axisY).attr("clip-path",Gg?Vh:"").attr("transform",ki.y).append("text").attr("class",f.axisYLabel).attr("transform",Gg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),ah&&zi.append("g").attr("class",f.axisY2).attr("transform",ki.y2).append("text").attr("class",f.axisY2Label).attr("transform",Gg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=zi.append("g").attr("clip-path",Th).attr("class",f.grid),jh&&d.append("g").attr("class",f.xgrids),ie(lh)&&d.append("g").attr("class",f.xgridLines),rh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),mh&&d.append("g").attr("class",f.ygrids),ie(nh)&&d.append("g").attr("class",f.ygridLines),zi.append("g").attr("clip-path",Th).attr("class",f.regions),zi.append("g").attr("clip-path",Th).attr("class",f.chart),c=zi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",of?Gg?"ns-resize":"ew-resize":null),zi.select("."+f.chart).append("g").attr("class",f.chartBars),zi.select("."+f.chart).append("g").attr("class",f.chartLines),zi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",ki.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),zi.select("."+f.chart).append("g").attr("class",f.chartTexts),of&&zi.insert("rect",qf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",xf).attr("height",zf).style("opacity",0).style("cursor",Gg?"ns-resize":"ew-resize").call(wi).on("dblclick.zoom",null),Rg&&si.extent("function"!=typeof Rg?Rg:Rg(Zb())),zg&&(Ai.append("g").attr("clip-path",Th).attr("class",f.chart),Ai.select("."+f.chart).append("g").attr("class",f.chartBars),Ai.select("."+f.chart).append("g").attr("class",f.chartLines),Ai.append("g").attr("clip-path",Th).attr("class",f.brush).call(si).selectAll("rect").attr(Gg?"width":"height",Gg?yf:Af),Ai.append("g").attr("class",f.axisX).attr("transform",ki.subx).attr("clip-path",Gg?"":Uh)),Se(gf.data.targets),Gg?zi.select("."+f.axisX).style("opacity",0).call(Yf):(zi.select("."+f.axisY).style("opacity",0).call(Zf),zi.select("."+f.axisY2).style("opacity",0).call($f)),Me({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Nh){if(Wh&&"string"==typeof Oh){for(Oh=de(Oh),e=0;e0){d=[];for(var g in eg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=yd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=re,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 Ke(a){Td(gf.data.targets)||og&&(Zh=a,zi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),$h=!0,xg())}function Le(){Td(gf.data.targets)||og&&(zi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),zi.selectAll("."+f.shape).classed(f.INCLUDED,!1),$h=!1,yg())}function Me(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Id(),U=Td(gf.data.targets),V=Dc(gf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?tf:0,O=B?N:0,P=C?N:0,H&&Cg&&af(xc(gf.data.targets),a),G&&(Sf.domain(ff.extent(Zb(V))),Ei=Sf.domain(),of&&wi.scale(Sf).updateScaleExtent(),Vf.domain(Sf.domain()),si.scale(Vf)),F&&(Sf.domain(si.empty()?Ei:si.extent()),of&&wi.scale(Sf).updateScaleExtent()),Tf.domain(Ub(V,"y")),Uf.domain(Ub(V,"y2")),Qd(V)||(Q=Fc(Ec(V)).sort(),Yf.tickValues(Q),_f.tickValues(Q)),c=zi.select("."+f.axisX).style("opacity",U?0:1),(Gg||D)&&(c=c.transition().duration(P)),c.call(Yf),e=zi.select("."+f.axisY).style("opacity",U?0:1),(!Gg||D)&&(e=e.transition().duration(P)),e.call(Zf),zi.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call($f),F&&Lg&&Q){for(R=1;R=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=Sf.ticks(10);g=zi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Gg?0:function(a){return Sf(a)-Yf.tickOffset()}).attr("x2",Gg?xf:function(a){return Sf(a)-Yf.tickOffset()}).attr("y1",Gg?function(a){return Sf(a)-Yf.tickOffset()}:uf.top).attr("y2",Gg?function(a){return Sf(a)-Yf.tickOffset()}:zf).style("opacity",function(){return+ff.select(this).attr(Gg?"y1":"x1")===(Gg?zf:0)?0:1}),g.exit().remove()}ie(lh)&&(i=zi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(lh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Gg?"":"rotate(-90)").attr("dx",Gg?0:-uf.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Gg?0:qd).attr("x2",Gg?xf:qd).attr("y1",Gg?qd:uf.top).attr("y2",Gg?qd:zf).style("opacity",1),i.select("text").transition().duration(N).attr("x",Gg?xf:0).attr("y",qd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&mh&&(k=zi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Tf.ticks(oh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Gg?Tf:0).attr("x2",Gg?Tf:xf).attr("y1",Gg?0:Tf).attr("y2",Gg?zf:Tf),k.exit().remove()),y&&ie(nh)&&(l=zi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(nh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Gg?"rotate(-90)":"").attr("dx",Gg?0:-uf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Gg?rd:0).attr("x2",Gg?rd:xf).attr("y1",Gg?0:rd).attr("y2",Gg?zf:rd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Gg?0:xf).attr("y",rd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=zi.selectAll("."+f.bars).selectAll("."+f.bar).data(_d),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ci(a)}).attr("class",Xc),p.style("opacity",gd).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=zi.selectAll("."+f.texts).selectAll("."+f.text).data(be),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Gg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return od(a.id)(a.value)}).style("fill-opacity",hd).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",jd),r.exit().transition().duration(O).style("fill-opacity",0).remove(),zi.selectAll("."+f.line).style("opacity",gd).transition().duration(N).attr("d",ti).style("opacity",1),zi.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",ui).style("opacity",Fi),n=zi.selectAll("."+f.circles).selectAll("."+f.circle).data(ae),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",qh),n.style("opacity",gd).transition().duration(N).style("opacity",id).attr("cx",Gg?Hd:Gd).attr("cy",Gg?Gd:Hd),n.exit().remove(),zi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=ff.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),zi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&$d(a.data)?1:0}),zi.select("."+f.chartArcsTitle).style("opacity",Sd(gf.data.targets)?1:0),zg&&(null!==ff.event&&"zoom"===ff.event.type&&si.extent(Sf.orgDomain()).update(),z&&(Ai.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(_f),si.empty()||si.extent(Sf.orgDomain()).update(),J=ze(T,!0),s=Ai.selectAll("."+f.bars).selectAll("."+f.bar).data(_d),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ci(a)}).attr("class",Xc),s.style("opacity",gd).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Ai.selectAll("."+f.line).style("opacity",gd).transition().duration(N).attr("d",vi).style("opacity",1))),zi.selectAll("."+f.selectedCircles).filter(function(a){return Wd(a)}).selectAll("circle").remove(),zi.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Gg?Hd:Gd).attr("cy",Gg?Gd:Hd),t=zi.select("."+f.eventRects),ie(bg)&&!kc(bg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=zi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),He(u.enter()),u.attr("x",0).attr("y",0).attr("width",xf).attr("height",zf)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Yh&&!Xh?(x=function(a,b){var c=tc(b),d=uc(b),e=gf.data.xs[a.id][b];return(Sf(d?d:e+50)-Sf(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=gf.data.xs[a.id][b];return(Sf(d)+Sf(c?c:d-50))/2}):(x=L(),w=function(a){return Sf(a.x)-x/2}),v=wc(),zi.select("."+f.eventRects).datum(v?v.values:[]),u=zi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ge(u.enter()),u.attr("class",ad).attr("x",Gg?0:w).attr("y",Gg?w:0).attr("width",Gg?xf:x).attr("height",Gg?x:zf),u.exit().remove()),q=zi.select("."+f.regions).selectAll("rect."+f.region).data(Ih),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Gg?0:cc).attr("y",Gg?cc:uf.top).attr("width",Gg?xf:dc).attr("height",Gg?dc:zf).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),xc(gf.data.targets).forEach(function(a){Gi[a]=!0})}}function Ne(){Me({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Oe(){return"mousemove"===ff.event.sourceEvent.type&&wi.altDomain?(Sf.domain(wi.altDomain),void wi.scale(Sf).updateScaleExtent()):(Xh&&Sf.orgDomain()[0]===Ei[0]&&Sf.domain([Ei[0]-1e-10,Sf.orgDomain()[1]]),Me({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===ff.event.sourceEvent.type&&(_h=!0)))}function Pe(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Qe(){xi.attr("width",Bf).attr("height",Cf),xi.select("#"+Qh).select("rect").attr("width",xf).attr("height",zf),xi.select("#"+Rh).select("rect").attr("width",H),xi.select("#"+Sh).select("rect").attr("width",J),xi.select("."+f.zoomRect).attr("width",xf).attr("height",zf)}function Re(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Qe(),m(a.withTransition),Me(a)}function Se(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=zi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a),j=i.enter().append("g").attr("class",function(a){return f.chartText+Pc(f.target,a.id)}).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ci(a)}),e=zi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),d=e.enter().append("g").attr("class",function(a){return f.chartBar+Pc(f.target,a.id)}).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ci(a)}).style("stroke","none").style("cursor",function(a){return qg(a)?"pointer":null}),c=zi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),b=c.enter().append("g").attr("class",function(a){return f.chartLine+Pc(f.target,a.id)}).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ci(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Fi=+ff.select(this).style("opacity"),0}).style("fill",function(a){return ci(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ci(a)}).style("cursor",function(a){return qg(a)?"pointer":null}),a.forEach(function(a){zi.selectAll("."+f.selectedCircles+bd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=zi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Jf(a)),g=h.enter().append("g").attr("class",function(a){return f.chartArc+Pc(f.target,a.data.id)}),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ci(a.data)}).style("cursor",function(a){return qg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),Xe(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Cd(c,ff.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),Ze(),Dd(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),zg&&(n=Ai.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),m=n.enter().append("g").attr("class",function(a){return f.chartBar+Pc(f.target,a.id)}),m.append("g").attr("class",Yc).style("fill",function(a){return ci(a)}),l=Ai.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),k=l.enter().append("g").attr("class",function(a){return f.chartLine+Pc(f.target,a.id)}),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ci(a)})),xi.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Te(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Nd(a.id,b.types[a.id]):Nd(a.id,b.type)}),gf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBBox(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=li?j:i,l=li?Q():P();return d&&(w=0,C=0,t=0,u=0),Cg&&!Cc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=li?u:t,void(Fg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,li?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Bi.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Eg?Eg(a):gf.toggle(a)}).on("mouseover",function(a){gf.focus(a)}).on("mouseout",function(){gf.revert()}),l.append("text").text(function(a){return d(eg[a])?eg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",li?g:-200).attr("y",li?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",li?h:-200).attr("y",li?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return ci(a)}).attr("x",li?g:-200).attr("y",li?-200:i).attr("width",10).attr("height",10),Bi.selectAll("text").data(a).text(function(a){return d(eg[a])?eg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Bi.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Bi.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Qe(),q&&m(p)}function bf(a){return zc(gf.data.targets,a.id)}function cf(a){return"data"in a&&zc(gf.data.targets,a.data.id)}function df(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 ef(a,b,c){var d=!Td(gf.data.targets);Nd(a,b),Re(c?c:{withTransitionForAxis:d})}var ff=a.d3?a.d3:a.require?a.require("d3"):void 0,gf={data:{},axis:{},legend:{}},hf={},jf=h(["bindto"],"#chart"),kf=h(["size","width"]),lf=h(["size","height"]),mf=h(["padding","left"]),nf=h(["padding","right"]),of=h(["zoom","enabled"],!1),pf=h(["zoom","extent"]),qf=h(["zoom","privileged"],!1),rf=h(["onenter"],function(){}),sf=h(["onleave"],function(){}),tf=h(["transition","duration"],350);g("data","data is required in config");var uf,vf,wf,xf,yf,zf,Af,Bf,Cf,Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag=h(["data","x"]),bg=h(["data","xs"],{}),cg=h(["data","x_format"]),dg=h(["data","id_converter"],function(a){return a}),eg=h(["data","names"],{}),fg=h(["data","groups"],[]),gg=h(["data","axes"],{}),hg=h(["data","type"]),ig=h(["data","types"],{}),jg=h(["data","labels"],{}),kg=h(["data","order"]),lg=h(["data","regions"],{}),mg=h(["data","color"]),ng=h(["data","colors"],{}),og=h(["data","selection","enabled"],!1),pg=h(["data","selection","grouped"],!1),qg=h(["data","selection","isselectable"],function(){return!0}),rg=h(["data","selection","multiple"],!0),sg=h(["data","onclick"],function(){}),tg=h(["data","onenter"],function(){}),ug=h(["data","onleave"],function(){}),vg=h(["data","onselected"],function(){}),wg=h(["data","onunselected"],function(){}),xg=h(["data","ondragstart"],function(){}),yg=h(["data","ondragend"],function(){}),zg=h(["subchart","show"],!1),Ag=zg?h(["subchart","size","height"],60):0,Bg=h(["color","pattern"],[]),Cg=h(["legend","show"],!0),Dg=h(["legend","position"],"bottom"),Eg=h(["legend","item","onclick"]),Fg=h(["legend","equally"],!1),Gg=h(["axis","rotated"],!1),Hg=h(["axis","x","type"],"indexed"),Ig=h(["axis","x","categories"],[]),Jg=h(["axis","x","tick","centered"],!1),Kg=h(["axis","x","tick","format"]),Lg=h(["axis","x","tick","culling"],{}),Mg=h(["axis","x","tick","culling","max"],"categorized"===Hg?1/0:10),Ng=h(["axis","x","tick","count"]),Og=h(["axis","x","tick","fit"],!1),Pg=h(["axis","x","max"]),Qg=h(["axis","x","min"]),Rg=h(["axis","x","default"]),Sg=h(["axis","x","label"],{}),Tg=h(["axis","y","show"],!0),Ug=h(["axis","y","max"]),Vg=h(["axis","y","min"]),Wg=h(["axis","y","center"]),Xg=h(["axis","y","label"],{}),Yg=h(["axis","y","inner"],!1),Zg=h(["axis","y","tick","format"]),$g=h(["axis","y","padding"],{}),_g=h(["axis","y","ticks"],10),ah=h(["axis","y2","show"],!1),bh=h(["axis","y2","max"]),ch=h(["axis","y2","min"]),dh=h(["axis","y2","center"]),eh=h(["axis","y2","label"],{}),fh=h(["axis","y2","inner"],!1),gh=h(["axis","y2","tick","format"]),hh=h(["axis","y2","padding"],{}),ih=h(["axis","y2","ticks"],10),jh=h(["grid","x","show"],!1),kh=h(["grid","x","type"],"tick"),lh=h(["grid","x","lines"],[]),mh=h(["grid","y","show"],!1),nh=h(["grid","y","lines"],[]),oh=h(["grid","y","ticks"],10),ph=h(["point","show"],!0),qh=ph?h(["point","r"],2.5):0,rh=h(["point","focus","line","enabled"],!0),sh=h(["point","focus","expand","enabled"],!0),th=h(["point","focus","expand","r"],sh?4:qh),uh=h(["point","focus","select","r"],8),vh=h(["bar","width"]),wh=h(["bar","width","ratio"],.6),xh=h(["pie","label","show"],!0),yh=h(["pie","label","format"]),zh=h(["pie","onclick"],function(){}),Ah=h(["pie","onmouseover"],function(){}),Bh=h(["pie","onmouseout"],function(){}),Ch=h(["donut","label","show"],!0),Dh=h(["donut","label","format"]),Eh=h(["donut","title"],""),Fh=h(["donut","onclick"],function(){}),Gh=h(["donut","onmouseover"],function(){}),Hh=h(["donut","onmouseout"],function(){}),Ih=h(["regions"],[]),Jh=h(["tooltip","show"],!0),Kh=h(["tooltip","format","title"]),Lh=h(["tooltip","format","value"]),Mh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Kh?Kh:b,l=Lh?Lh: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+""}),Nh=h(["tooltip","init","show"],!1),Oh=h(["tooltip","init","x"],0),Ph=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Qh=("string"==typeof jf?jf.replace("#",""):jf.id)+"-clip",Rh=Qh+"-xaxis",Sh=Qh+"-yaxis",Th=i(Qh),Uh=i(Uh),Vh=i(Vh),Wh="timeseries"===Hg,Xh="categorized"===Hg,Yh=!Wh&&(ag||ie(bg)),Zh=null,$h=!1,_h=!1,ai=!1,bi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ci=ce(ng,ie(Bg)?Bg:bi,mg),di=function(){var a=[[ff.time.format("%Y/%-m/%-d"),function(){return!0}],[ff.time.format("%-m/%-d"),function(a){return a.getMonth()}],[ff.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[ff.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[ff.time.format("%I %p"),function(a){return a.getHours()}],[ff.time.format("%I:%M"),function(a){return a.getMinutes()}],[ff.time.format(":%S"),function(a){return a.getSeconds()}],[ff.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)}}(),ei=[],fi=[],gi=Gg?"left":"bottom",hi=Gg?Yg?"top":"bottom":Yg?"right":"left",ii=Gg?fh?"bottom":"top":fh?"left":"right",ji=Gg?"left":"bottom",ki={main:function(){return"translate("+uf.left+","+uf.top+")"},context:function(){return"translate("+vf.left+","+vf.top+")"},legend:function(){return"translate("+wf.left+","+wf.top+")"},x:function(){return"translate(0,"+(Gg?0:zf)+")"},y:function(){return"translate(0,"+(Gg?zf:0)+")"},y2:function(){return"translate("+(Gg?0:xf)+","+(Gg?1:0)+")"},subx:function(){return"translate(0,"+(Gg?0:Af)+")"},arc:function(){return"translate("+xf/2+","+zf/2+")"}},li="right"===Dg,mi=0,ni=0,oi=0,pi=30,qi=30,ri=5;Jf=ff.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var si,ti=function(){var a=ff.svg.line().x(Gg?function(a){return V(a.id)(a.value)}:pd).y(Gg?pd:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=se(b.values);return Ud(b)?(a.interpolate(Vd(b)?"cardinal":"linear"),lg[b.id]?Ee(e,Sf,V(b.id),lg[b.id]):a(e)):(c=Sf(e[0].x),d=V(b.id)(e[0].value),Gg?"M "+d+" "+c:"M "+c+" "+d)}}(),ui=function(){var a;return a=Gg?ff.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(pd):ff.svg.area().x(pd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=se(b.values);return Od([b],"area")||Od([b],"area-spline")?(a.interpolate(Vd(b)?"cardinal":"linear"),a(e)):(c=Sf(e[0].x),d=V(b.id)(e[0].value),Gg?"M "+d+" "+c:"M "+c+" "+d)}}(),vi=function(){var a=ff.svg.line().x(Gg?function(a){return W(a.id)(a.value)}:sd).y(Gg?sd:function(a){return W(a.id)(a.value)});return function(b){var c=se(b.values);return Ud(b)?a(c):"M "+Vf(c[0].x)+" "+W(b.id)(c[0].value)}}(),wi=function(){};si=ff.svg.brush().on("brush",Ne),si.update=function(){return Ai&&Ai.select("."+f.brush).call(this),this},si.scale=function(a){return Gg?this.y(a):this.x(a)},of&&(wi=ff.behavior.zoom().on("zoomstart",function(){wi.altDomain=ff.event.sourceEvent.altKey?Sf.orgDomain():null}).on("zoom",of?Oe:null),wi.scale=function(a){return Gg?this.y(a):this.x(a)},wi.orgScaleExtent=function(){var a=pf?pf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},wi.updateScaleExtent=function(){var a=$b(Sf.orgDomain())/$b(Ei),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var xi,yi,zi,Ai,Bi,Ci,Di,Ei,Fi,Gi={};if(gf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=xi.selectAll(cd(a)),d=c.filter(bf),e=c.filter(cf);gf.revert(),gf.defocus(),b(d.classed(f.focused,!0)),b(e),Td(gf.data.targets)&&Kb(a,!0),Xe(a)},gf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=xi.selectAll(cd(a)),d=c.filter(bf),e=c.filter(cf);gf.revert(),b(d.classed(f.focused,!1)),b(e),Td(gf.data.targets)&&Lb(a),Ye(a)},gf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=xi.selectAll(cd(a)),d=c.filter(bf),e=c.filter(cf);b(d.classed(f.focused,!1)),b(e),Td(gf.data.targets)&&Lb(a),Ze()},gf.show=function(a,b){a=yc(a),b=b||{},Hc(a),xi.selectAll(dd(a)).transition().style("opacity",1),b.withLegend&&$e(a),Me({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},gf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),xi.selectAll(dd(a)).transition().style("opacity",0),b.withLegend&&_e(a),Me({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},gf.toggle=function(a){Bc(a)?gf.hide(a):gf.show(a)},gf.unzoom=function(){si.clear().update(),Me({withUpdateXDomain:!0})},gf.load=function(a){return a.xs&&jc(a.xs),"categories"in a&&Xh&&(Ig=a.categories,Yf.categories(Ig)),"cacheIds"in a&&_b(a.cacheIds)?void Te(bc(a.cacheIds),a.done):void("unload"in a?Ve(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ue(a)}):Ue(a))},gf.unload=function(a){Ve(yc(a),function(){Me({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},gf.selected=function(a){return ff.merge(zi.selectAll("."+f.shapes+bd(a)).selectAll("."+f.shape).filter(function(){return ff.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},gf.select=function(a,b,c){og&&zi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=ff.select(this),i="circle"===this.nodeName?me:pe,j="circle"===this.nodeName?ne:qe,k=pg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?qg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},gf.unselect=function(a,b){og&&zi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=ff.select(this),g="circle"===this.nodeName?ne:qe,h=pg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&qg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},gf.toLine=function(a){ef(a,"line")},gf.toSpline=function(a){ef(a,"spline")},gf.toBar=function(a){ef(a,"bar")},gf.toScatter=function(a){ef(a,"scatter")},gf.toArea=function(a){ef(a,"area")},gf.toAreaSpline=function(a){ef(a,"area-spline")},gf.toPie=function(a){ef(a,"pie",{withTransform:!0})},gf.toDonut=function(a){ef(a,"donut",{withTransform:!0})},gf.groups=function(a){return c(a)?fg:(fg=a,Me(),fg)},gf.xgrids=function(a){return a?(lh=a,Me(),lh):lh},gf.xgrids.add=function(a){return a?gf.xgrids(lh.concat(a)):void 0},gf.xgrids.remove=function(a){var b=df(a);return gf.xgrids(lh.filter(b))},gf.ygrids=function(a){return a?(nh=a,Me(),nh):nh},gf.ygrids.add=function(a){return a?gf.ygrids(nh.concat(a)):void 0},gf.ygrids.remove=function(a){var b=df(a);return gf.ygrids(nh.filter(b))},gf.regions=function(a){return c(a)?Ih:(Ih=a,Me(),Ih)},gf.regions.add=function(a){return c(a)?Ih:(Ih=Ih.concat(a),Me(),Ih)},gf.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;xi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Ih=Ih.filter(function(b){return b.classes.indexOf(a)<0})}),Ih},gf.data.get=function(a){var b=gf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},gf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},gf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){eg[b]=a[b]}),af(xc(gf.data.targets),{withTransition:!0}),eg):eg},gf.x=function(a){return arguments.length&&(mc(gf.data.targets,a),Me({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),gf.data.xs},gf.xs=function(a){return arguments.length&&(nc(gf.data.targets,a),Me({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),gf.data.xs -},gf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},gf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Ug=+a.y),b(a.y2)&&(bh=+a.y2)):Ug=bh=+a,Me())},gf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Vg=+a.y),b(a.y2)&&(ch=+a.y2)):Vg=ch=+a,Me())},gf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&gf.axis.max(a.max),"undefined"!=typeof a.min&&gf.axis.min(a.min))},gf.legend.show=function(a){Cg||(Cg=!0,Bi.style("visibility","visible")),$e(yc(a)),Me({withTransitionForHorizontalAxis:!1})},gf.legend.hide=function(a){Cg&&he(a)&&(Cg=!1,Bi.style("visibility","hidden")),_e(yc(a)),Me({withTransitionForHorizontalAxis:!1})},gf.resize=function(a){kf=a?a.width:null,lf=a?a.height:null,Re({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},gf.destroy=function(){gf.data.targets=void 0,gf.data.xs={},Di.html(""),a.onresize=null},"url"in e.data)ff.csv(e.data.url,function(a,b){Fe(b)});else if("rows"in e.data)Fe(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Fe(qc(e.data.columns))}return gf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file +}Ci.html(Mh(gf.data.targets.map(function(a){return lc(a.values[Oh])}),$(),md,ci)),Ci.style("top",Ph.top).style("left",Ph.left).style("display","block")}null==a.onresize&&(a.onresize=Pe()),a.onresize.add&&a.onresize.add(function(){Re({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})})}function Ge(a){a.append("rect").attr("class",ad).style("cursor",og&&pg?"pointer":null).on("mouseover",function(a,b){if(!$h&&!Td(gf.data.targets)){var c,d,e=gf.data.targets.map(function(a){return lc(a.values[b])});if(Object.keys(eg).length>0){d=[];for(var g in eg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=yd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=re,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 Ke(a){Td(gf.data.targets)||og&&(Zh=a,zi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),$h=!0,xg())}function Le(){Td(gf.data.targets)||og&&(zi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),zi.selectAll("."+f.shape).classed(f.INCLUDED,!1),$h=!1,yg())}function Me(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Id(),U=Td(gf.data.targets),V=Dc(gf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?tf:0,O=B?N:0,P=C?N:0,H&&Cg&&af(xc(gf.data.targets),a),G&&(Sf.domain(ff.extent(Zb(V))),Ei=Sf.domain(),of&&wi.scale(Sf).updateScaleExtent(),Vf.domain(Sf.domain()),si.scale(Vf)),F&&(Sf.domain(si.empty()?Ei:si.extent()),of&&wi.scale(Sf).updateScaleExtent()),Tf.domain(Ub(V,"y")),Uf.domain(Ub(V,"y2")),Qd(V)||(Q=Fc(Ec(V)).sort(),Yf.tickValues(Q),_f.tickValues(Q)),c=zi.select("."+f.axisX).style("opacity",U?0:1),(Gg||D)&&(c=c.transition().duration(P)),c.call(Yf),e=zi.select("."+f.axisY).style("opacity",U?0:1),(!Gg||D)&&(e=e.transition().duration(P)),e.call(Zf),zi.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call($f),F&&Lg&&Q){for(R=1;R=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=Sf.ticks(10);g=zi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Gg?0:function(a){return Sf(a)-Yf.tickOffset()}).attr("x2",Gg?xf:function(a){return Sf(a)-Yf.tickOffset()}).attr("y1",Gg?function(a){return Sf(a)-Yf.tickOffset()}:uf.top).attr("y2",Gg?function(a){return Sf(a)-Yf.tickOffset()}:zf).style("opacity",function(){return+ff.select(this).attr(Gg?"y1":"x1")===(Gg?zf:0)?0:1}),g.exit().remove()}ie(lh)&&(i=zi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(lh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Gg?"":"rotate(-90)").attr("dx",Gg?0:-uf.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Gg?0:qd).attr("x2",Gg?xf:qd).attr("y1",Gg?qd:uf.top).attr("y2",Gg?qd:zf).style("opacity",1),i.select("text").transition().duration(N).attr("x",Gg?xf:0).attr("y",qd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&mh&&(k=zi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Tf.ticks(oh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Gg?Tf:0).attr("x2",Gg?Tf:xf).attr("y1",Gg?0:Tf).attr("y2",Gg?zf:Tf),k.exit().remove()),y&&ie(nh)&&(l=zi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(nh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Gg?"rotate(-90)":"").attr("dx",Gg?0:-uf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Gg?rd:0).attr("x2",Gg?rd:xf).attr("y1",Gg?0:rd).attr("y2",Gg?zf:rd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Gg?0:xf).attr("y",rd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=zi.selectAll("."+f.bars).selectAll("."+f.bar).data(_d),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ci(a)}).attr("class",Xc),p.style("opacity",gd).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=zi.selectAll("."+f.texts).selectAll("."+f.text).data(be),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Gg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return od(a.id)(a.value)}).style("fill-opacity",hd).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",jd),r.exit().transition().duration(O).style("fill-opacity",0).remove(),zi.selectAll("."+f.line).style("opacity",gd).transition().duration(N).attr("d",ti).style("opacity",1),zi.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",ui).style("opacity",Fi),n=zi.selectAll("."+f.circles).selectAll("."+f.circle).data(ae),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",qh),n.style("opacity",gd).transition().duration(N).style("opacity",id).attr("cx",Gg?Hd:Gd).attr("cy",Gg?Gd:Hd),n.exit().remove(),zi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=ff.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),zi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&$d(a.data)?1:0}),zi.select("."+f.chartArcsTitle).style("opacity",Sd(gf.data.targets)?1:0),zg&&(null!==ff.event&&"zoom"===ff.event.type&&si.extent(Sf.orgDomain()).update(),z&&(Ai.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(_f),si.empty()||si.extent(Sf.orgDomain()).update(),J=ze(T,!0),s=Ai.selectAll("."+f.bars).selectAll("."+f.bar).data(_d),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ci(a)}).attr("class",Xc),s.style("opacity",gd).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Ai.selectAll("."+f.line).style("opacity",gd).transition().duration(N).attr("d",vi).style("opacity",1))),zi.selectAll("."+f.selectedCircles).filter(function(a){return Wd(a)}).selectAll("circle").remove(),zi.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Gg?Hd:Gd).attr("cy",Gg?Gd:Hd),t=zi.select("."+f.eventRects),ie(bg)&&!kc(bg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=zi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),He(u.enter()),u.attr("x",0).attr("y",0).attr("width",xf).attr("height",zf)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Yh&&!Xh?(x=function(a,b){var c=tc(b),d=uc(b),e=gf.data.xs[a.id][b];return(Sf(d?d:e+50)-Sf(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=gf.data.xs[a.id][b];return(Sf(d)+Sf(c?c:d-50))/2}):(x=L(),w=function(a){return Sf(a.x)-x/2}),v=wc(),zi.select("."+f.eventRects).datum(v?v.values:[]),u=zi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ge(u.enter()),u.attr("class",ad).attr("x",Gg?0:w).attr("y",Gg?w:0).attr("width",Gg?xf:x).attr("height",Gg?x:zf),u.exit().remove()),q=zi.select("."+f.regions).selectAll("rect."+f.region).data(Ih),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Gg?0:cc).attr("y",Gg?cc:uf.top).attr("width",Gg?xf:dc).attr("height",Gg?dc:zf).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),xc(gf.data.targets).forEach(function(a){Gi[a]=!0})}}function Ne(){Me({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Oe(){return"mousemove"===ff.event.sourceEvent.type&&wi.altDomain?(Sf.domain(wi.altDomain),void wi.scale(Sf).updateScaleExtent()):(Xh&&Sf.orgDomain()[0]===Ei[0]&&Sf.domain([Ei[0]-1e-10,Sf.orgDomain()[1]]),Me({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===ff.event.sourceEvent.type&&(_h=!0)))}function Pe(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Qe(){xi.attr("width",Bf).attr("height",Cf),xi.select("#"+Qh).select("rect").attr("width",xf).attr("height",zf),xi.select("#"+Rh).select("rect").attr("width",H),xi.select("#"+Sh).select("rect").attr("width",J),xi.select("."+f.zoomRect).attr("width",xf).attr("height",zf)}function Re(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Qe(),m(a.withTransition),Me(a)}function Se(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=zi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a),j=i.enter().append("g").attr("class",function(a){return f.chartText+Pc(f.target,a.id)}).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ci(a)}),e=zi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),d=e.enter().append("g").attr("class",function(a){return f.chartBar+Pc(f.target,a.id)}).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ci(a)}).style("stroke","none").style("cursor",function(a){return qg(a)?"pointer":null}),c=zi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),b=c.enter().append("g").attr("class",function(a){return f.chartLine+Pc(f.target,a.id)}).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ci(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Fi=+ff.select(this).style("opacity"),0}).style("fill",function(a){return ci(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ci(a)}).style("cursor",function(a){return qg(a)?"pointer":null}),a.forEach(function(a){zi.selectAll("."+f.selectedCircles+bd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=zi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Jf(a)),g=h.enter().append("g").attr("class",function(a){return f.chartArc+Pc(f.target,a.data.id)}),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ci(a.data)}).style("cursor",function(a){return qg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),Xe(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Cd(c,ff.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),Ze(),Dd(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),zg&&(n=Ai.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),m=n.enter().append("g").attr("class",function(a){return f.chartBar+Pc(f.target,a.id)}),m.append("g").attr("class",Yc).style("fill",function(a){return ci(a)}),l=Ai.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),k=l.enter().append("g").attr("class",function(a){return f.chartLine+Pc(f.target,a.id)}),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ci(a)})),xi.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Te(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Nd(a.id,b.types[a.id]):Nd(a.id,b.type)}),gf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBBox(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=li?j:i,l=li?Q():P();return d&&(w=0,C=0,t=0,u=0),Cg&&!Cc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=li?u:t,void(Fg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,li?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Bi.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Eg?Eg(a):gf.toggle(a)}).on("mouseover",function(a){gf.focus(a)}).on("mouseout",function(){gf.revert()}),l.append("text").text(function(a){return d(eg[a])?eg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",li?g:-200).attr("y",li?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",li?h:-200).attr("y",li?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return ci(a)}).attr("x",li?g:-200).attr("y",li?-200:i).attr("width",10).attr("height",10),Bi.selectAll("text").data(a).text(function(a){return d(eg[a])?eg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Bi.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Bi.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Qe(),q&&m(p)}function bf(a){return zc(gf.data.targets,a.id)}function cf(a){return"data"in a&&zc(gf.data.targets,a.data.id)}function df(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 ef(a,b,c){var d=!Td(gf.data.targets);Nd(a,b),Re(c?c:{withTransitionForAxis:d})}var ff=a.d3?a.d3:a.require?a.require("d3"):void 0,gf={data:{},axis:{},legend:{}},hf={},jf=h(["bindto"],"#chart"),kf=h(["size","width"]),lf=h(["size","height"]),mf=h(["padding","left"]),nf=h(["padding","right"]),of=h(["zoom","enabled"],!1),pf=h(["zoom","extent"]),qf=h(["zoom","privileged"],!1),rf=h(["onenter"],function(){}),sf=h(["onleave"],function(){}),tf=h(["transition","duration"],350);g("data","data is required in config");var uf,vf,wf,xf,yf,zf,Af,Bf,Cf,Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag=h(["data","x"]),bg=h(["data","xs"],{}),cg=h(["data","x_format"]),dg=h(["data","id_converter"],function(a){return a}),eg=h(["data","names"],{}),fg=h(["data","groups"],[]),gg=h(["data","axes"],{}),hg=h(["data","type"]),ig=h(["data","types"],{}),jg=h(["data","labels"],{}),kg=h(["data","order"]),lg=h(["data","regions"],{}),mg=h(["data","color"]),ng=h(["data","colors"],{}),og=h(["data","selection","enabled"],!1),pg=h(["data","selection","grouped"],!1),qg=h(["data","selection","isselectable"],function(){return!0}),rg=h(["data","selection","multiple"],!0),sg=h(["data","onclick"],function(){}),tg=h(["data","onenter"],function(){}),ug=h(["data","onleave"],function(){}),vg=h(["data","onselected"],function(){}),wg=h(["data","onunselected"],function(){}),xg=h(["data","ondragstart"],function(){}),yg=h(["data","ondragend"],function(){}),zg=h(["subchart","show"],!1),Ag=zg?h(["subchart","size","height"],60):0,Bg=h(["color","pattern"],[]),Cg=h(["legend","show"],!0),Dg=h(["legend","position"],"bottom"),Eg=h(["legend","item","onclick"]),Fg=h(["legend","equally"],!1),Gg=h(["axis","rotated"],!1),Hg=h(["axis","x","type"],"indexed"),Ig=h(["axis","x","categories"],[]),Jg=h(["axis","x","tick","centered"],!1),Kg=h(["axis","x","tick","format"]),Lg=h(["axis","x","tick","culling"],{}),Mg=h(["axis","x","tick","culling","max"],"categorized"===Hg?1/0:10),Ng=h(["axis","x","tick","count"]),Og=h(["axis","x","tick","fit"],!1),Pg=h(["axis","x","max"]),Qg=h(["axis","x","min"]),Rg=h(["axis","x","default"]),Sg=h(["axis","x","label"],{}),Tg=h(["axis","y","show"],!0),Ug=h(["axis","y","max"]),Vg=h(["axis","y","min"]),Wg=h(["axis","y","center"]),Xg=h(["axis","y","label"],{}),Yg=h(["axis","y","inner"],!1),Zg=h(["axis","y","tick","format"]),$g=h(["axis","y","padding"],{}),_g=h(["axis","y","ticks"],10),ah=h(["axis","y2","show"],!1),bh=h(["axis","y2","max"]),ch=h(["axis","y2","min"]),dh=h(["axis","y2","center"]),eh=h(["axis","y2","label"],{}),fh=h(["axis","y2","inner"],!1),gh=h(["axis","y2","tick","format"]),hh=h(["axis","y2","padding"],{}),ih=h(["axis","y2","ticks"],10),jh=h(["grid","x","show"],!1),kh=h(["grid","x","type"],"tick"),lh=h(["grid","x","lines"],[]),mh=h(["grid","y","show"],!1),nh=h(["grid","y","lines"],[]),oh=h(["grid","y","ticks"],10),ph=h(["point","show"],!0),qh=ph?h(["point","r"],2.5):0,rh=h(["point","focus","line","enabled"],!0),sh=h(["point","focus","expand","enabled"],!0),th=h(["point","focus","expand","r"],sh?4:qh),uh=h(["point","focus","select","r"],8),vh=h(["bar","width"]),wh=h(["bar","width","ratio"],.6),xh=h(["pie","label","show"],!0),yh=h(["pie","label","format"]),zh=h(["pie","onclick"],function(){}),Ah=h(["pie","onmouseover"],function(){}),Bh=h(["pie","onmouseout"],function(){}),Ch=h(["donut","label","show"],!0),Dh=h(["donut","label","format"]),Eh=h(["donut","title"],""),Fh=h(["donut","onclick"],function(){}),Gh=h(["donut","onmouseover"],function(){}),Hh=h(["donut","onmouseout"],function(){}),Ih=h(["regions"],[]),Jh=h(["tooltip","show"],!0),Kh=h(["tooltip","format","title"]),Lh=h(["tooltip","format","value"]),Mh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Kh?Kh:b,l=Lh?Lh: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+""}),Nh=h(["tooltip","init","show"],!1),Oh=h(["tooltip","init","x"],0),Ph=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Qh=("string"==typeof jf?jf.replace("#",""):jf.id)+"-clip",Rh=Qh+"-xaxis",Sh=Qh+"-yaxis",Th=i(Qh),Uh=i(Uh),Vh=i(Vh),Wh="timeseries"===Hg,Xh="categorized"===Hg,Yh=!Wh&&(ag||ie(bg)),Zh=null,$h=!1,_h=!1,ai=!1,bi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ci=ce(ng,ie(Bg)?Bg:bi,mg),di=function(){var a=[[ff.time.format("%Y/%-m/%-d"),function(){return!0}],[ff.time.format("%-m/%-d"),function(a){return a.getMonth()}],[ff.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[ff.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[ff.time.format("%I %p"),function(a){return a.getHours()}],[ff.time.format("%I:%M"),function(a){return a.getMinutes()}],[ff.time.format(":%S"),function(a){return a.getSeconds()}],[ff.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)}}(),ei=[],fi=[],gi=Gg?"left":"bottom",hi=Gg?Yg?"top":"bottom":Yg?"right":"left",ii=Gg?fh?"bottom":"top":fh?"left":"right",ji=Gg?"left":"bottom",ki={main:function(){return"translate("+uf.left+","+uf.top+")"},context:function(){return"translate("+vf.left+","+vf.top+")"},legend:function(){return"translate("+wf.left+","+wf.top+")"},x:function(){return"translate(0,"+(Gg?0:zf)+")"},y:function(){return"translate(0,"+(Gg?zf:0)+")"},y2:function(){return"translate("+(Gg?0:xf)+","+(Gg?1:0)+")"},subx:function(){return"translate(0,"+(Gg?0:Af)+")"},arc:function(){return"translate("+xf/2+","+zf/2+")"}},li="right"===Dg,mi=0,ni=0,oi=0,pi=30,qi=30,ri=5;Jf=ff.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var si,ti=function(){var a=ff.svg.line().x(Gg?function(a){return V(a.id)(a.value)}:pd).y(Gg?pd:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=se(b.values);return Ud(b)?(a.interpolate(Vd(b)?"cardinal":"linear"),lg[b.id]?Ee(e,Sf,V(b.id),lg[b.id]):a(e)):(c=Sf(e[0].x),d=V(b.id)(e[0].value),Gg?"M "+d+" "+c:"M "+c+" "+d)}}(),ui=function(){var a;return a=Gg?ff.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(pd):ff.svg.area().x(pd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=se(b.values);return Od([b],"area")||Od([b],"area-spline")?(a.interpolate(Vd(b)?"cardinal":"linear"),a(e)):(c=Sf(e[0].x),d=V(b.id)(e[0].value),Gg?"M "+d+" "+c:"M "+c+" "+d)}}(),vi=function(){var a=ff.svg.line().x(Gg?function(a){return W(a.id)(a.value)}:sd).y(Gg?sd:function(a){return W(a.id)(a.value)});return function(b){var c=se(b.values);return Ud(b)?a(c):"M "+Vf(c[0].x)+" "+W(b.id)(c[0].value)}}(),wi=function(){};si=ff.svg.brush().on("brush",Ne),si.update=function(){return Ai&&Ai.select("."+f.brush).call(this),this},si.scale=function(a){return Gg?this.y(a):this.x(a)},of&&(wi=ff.behavior.zoom().on("zoomstart",function(){wi.altDomain=ff.event.sourceEvent.altKey?Sf.orgDomain():null}).on("zoom",of?Oe:null),wi.scale=function(a){return Gg?this.y(a):this.x(a)},wi.orgScaleExtent=function(){var a=pf?pf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},wi.updateScaleExtent=function(){var a=$b(Sf.orgDomain())/$b(Ei),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var xi,yi,zi,Ai,Bi,Ci,Di,Ei,Fi,Gi={};if(gf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=xi.selectAll(cd(a)),d=c.filter(bf),e=c.filter(cf);gf.revert(),gf.defocus(),b(d.classed(f.focused,!0)),b(e),Td(gf.data.targets)&&Kb(a,!0),Xe(a)},gf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=xi.selectAll(cd(a)),d=c.filter(bf),e=c.filter(cf);gf.revert(),b(d.classed(f.focused,!1)),b(e),Td(gf.data.targets)&&Lb(a),Ye(a)},gf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=xi.selectAll(cd(a)),d=c.filter(bf),e=c.filter(cf);b(d.classed(f.focused,!1)),b(e),Td(gf.data.targets)&&Lb(a),Ze()},gf.show=function(a,b){a=yc(a),b=b||{},Hc(a),xi.selectAll(dd(a)).transition().style("opacity",1),b.withLegend&&$e(a),Me({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},gf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),xi.selectAll(dd(a)).transition().style("opacity",0),b.withLegend&&_e(a),Me({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},gf.toggle=function(a){Bc(a)?gf.hide(a):gf.show(a)},gf.unzoom=function(){si.clear().update(),Me({withUpdateXDomain:!0})},gf.load=function(a){return a.xs&&jc(a.xs),"categories"in a&&Xh&&(Ig=a.categories,Yf.categories(Ig)),"cacheIds"in a&&_b(a.cacheIds)?void Te(bc(a.cacheIds),a.done):void("unload"in a?Ve(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ue(a)}):Ue(a))},gf.unload=function(a){Ve(yc(a),function(){Me({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},gf.selected=function(a){return ff.merge(zi.selectAll("."+f.shapes+bd(a)).selectAll("."+f.shape).filter(function(){return ff.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},gf.select=function(a,b,c){og&&zi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=ff.select(this),i="circle"===this.nodeName?me:pe,j="circle"===this.nodeName?ne:qe,k=pg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?qg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},gf.unselect=function(a,b){og&&zi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=ff.select(this),g="circle"===this.nodeName?ne:qe,h=pg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&qg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},gf.toLine=function(a){ef(a,"line")},gf.toSpline=function(a){ef(a,"spline")},gf.toBar=function(a){ef(a,"bar")},gf.toScatter=function(a){ef(a,"scatter")},gf.toArea=function(a){ef(a,"area")},gf.toAreaSpline=function(a){ef(a,"area-spline")},gf.toPie=function(a){ef(a,"pie",{withTransform:!0})},gf.toDonut=function(a){ef(a,"donut",{withTransform:!0})},gf.groups=function(a){return c(a)?fg:(fg=a,Me(),fg)},gf.xgrids=function(a){return a?(lh=a,Me(),lh):lh},gf.xgrids.add=function(a){return a?gf.xgrids(lh.concat(a)):void 0},gf.xgrids.remove=function(a){var b=df(a);return gf.xgrids(lh.filter(b))},gf.ygrids=function(a){return a?(nh=a,Me(),nh):nh},gf.ygrids.add=function(a){return a?gf.ygrids(nh.concat(a)):void 0},gf.ygrids.remove=function(a){var b=df(a);return gf.ygrids(nh.filter(b))},gf.regions=function(a){return c(a)?Ih:(Ih=a,Me(),Ih)},gf.regions.add=function(a){return c(a)?Ih:(Ih=Ih.concat(a),Me(),Ih)},gf.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;xi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Ih=Ih.filter(function(b){return b.classes.indexOf(a)<0})}),Ih},gf.data.get=function(a){var b=gf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},gf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},gf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){eg[b]=a[b]}),af(xc(gf.data.targets),{withTransition:!0}),eg):eg},gf.x=function(a){return arguments.length&&(mc(gf.data.targets,a),Me({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),gf.data.xs +},gf.xs=function(a){return arguments.length&&(nc(gf.data.targets,a),Me({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),gf.data.xs},gf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},gf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Ug=+a.y),b(a.y2)&&(bh=+a.y2)):Ug=bh=+a,Me())},gf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Vg=+a.y),b(a.y2)&&(ch=+a.y2)):Vg=ch=+a,Me())},gf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&gf.axis.max(a.max),"undefined"!=typeof a.min&&gf.axis.min(a.min))},gf.legend.show=function(a){Cg||(Cg=!0,Bi.style("visibility","visible")),$e(yc(a)),Me({withTransitionForHorizontalAxis:!1})},gf.legend.hide=function(a){Cg&&he(a)&&(Cg=!1,Bi.style("visibility","hidden")),_e(yc(a)),Me({withTransitionForHorizontalAxis:!1})},gf.resize=function(a){kf=a?a.width:null,lf=a?a.height:null,Re({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},gf.destroy=function(){gf.data.targets=void 0,gf.data.xs={},Di.html(""),a.onresize=null},"url"in e.data)ff.csv(e.data.url,function(a,b){Fe(b)});else if("rows"in e.data)Fe(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Fe(qc(e.data.columns))}return gf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From dfc43024a0fe7495816969f7b4ca4188d115e66f Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Tue, 8 Apr 2014 21:39:59 +0900 Subject: [PATCH 020/178] Fix bug when all null data exists - #137 --- c3.js | 4 ++-- c3.min.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/c3.js b/c3.js index cdb52a5..7c27c4c 100644 --- a/c3.js +++ b/c3.js @@ -2156,8 +2156,8 @@ isSplineType(d) ? area.interpolate("cardinal") : area.interpolate("linear"); return area(data); } else { - x0 = x(data[0].x); - y0 = getYScale(d.id)(data[0].value); + x0 = data[0] ? x(data[0].x) : 0; + y0 = data[0] ? getYScale(d.id)(data[0].value) : 0; return __axis_rotated ? "M " + y0 + " " + x0 : "M " + x0 + " " + y0; } }; diff --git a/c3.min.js b/c3.min.js index ff4c6bd..6bc8575 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ !function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.29"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",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;cxf&&(xf=0),0>zf&&(zf=0),vf={top:Gg?uf.top:Cf-Ag-(li?0:a),right:0/0,bottom:20+(li?0:a),left:Gg?pi:uf.left},yf=Gg?uf.left-pi-qi:xf,Af=Gg?zf:Cf-vf.top-vf.bottom,0>yf&&(yf=0),0>Af&&(Af=0),wf={top:li?0:Cf-a,right:0/0,bottom:0,left:li?Bf-b:0},p(),li&&Td(gf.data.targets)&&(wf.left=xf/2+Ef)}function o(){zi.select("line."+f.xgridFocus).attr("x1",Gg?0:-10).attr("x2",Gg?xf:-10).attr("y1",Gg?-10:uf.top).attr("y2",Gg?-10:zf)}function p(){Ef=zf/2,Df=.95*Ef,Ff=Sd(gf.data.targets)?.6*Df:0}function q(){var a=Gg?f.axisX:f.axisY,b=ff.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=ff.select(jf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return kf?kf:x()}function s(){var a=lf?lf:y();return a>0?a:320}function t(){return Td(gf.data.targets)?0:mf?mf:Gg||!Tg||Yg?1:v("y")}function u(){var a=1;return Td(gf.data.targets)?0:nf?nf:li?P()+(ah&&!Gg?v("y2"):a):ah?fh||Gg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||Tg?"y2"!==a||ah?(gb(a).isInner?30:40)+("y2"===a?-10:0):ri:Cg&&!li?10:1}function x(){return+ff.select(jf).style("width").replace("px","")}function y(){return+ff.select(jf).style("height").replace("px","")}function z(a){return a?-5:-(uf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Gg)}function C(){return A(!Gg)}function D(){return z(Gg)}function E(){return A(Gg)}function F(a){return a?xf+2+4:uf.left+20}function G(a){return a?80:zf+2}function H(){return F(!Gg)}function I(){return G(!Gg)}function J(){return F(Gg)}function K(){return G(Gg)}function L(){var a=Gg?zf:xf,b=vc(),c=Vb()*(Pd(gf.data.targets)?(b-(Xh?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){mi=a}function N(a){ni=a}function O(a){oi=a}function P(){return Cg?li?ni*(mi+1):Bf:0}function Q(){return Cg?li?Cf:oi*(mi+1):0}function R(){var a,b=!Sf;Kf=Gg?1:0,Lf=Gg?zf:xf,Mf=Gg?0:zf,Nf=Gg?xf:1,Of=Kf,Pf=Lf,Qf=Gg?0:Af,Rf=Gg?yf:1,Sf=T(Kf,Lf,b?void 0:Sf.domain(),function(){return Yf.tickOffset()}),Tf=U(Mf,Nf),Uf=U(Mf,Nf),Vf=T(Kf,Lf,Ei,function(a){return a%1?0:_f.tickOffset()}),Wf=U(Qf,Rf),Xf=U(Qf,Rf),a=$(),Yf=X(Sf,gi,a),_f=X(Vf,ji,a),Zf=Y(Tf,hi,Zg,_g),$f=Y(Uf,ii,gh,ih),b||(si.scale(Vf),of&&wi.scale(Sf)),S()}function S(){Gf=Db(),Hf=Eb(),If=Eb(.98)}function T(a,b,e,f){var g=(Wh?ff.time.scale():ff.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),Xh){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return ff.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?Uf:Tf}function W(a){return"y2"===Z(a)?Xf:Wf}function X(a,b,c){var d=(Xh?Bb():ff.svg.axis()).scale(a).orient(b);return d.tickFormat(c),Xh?d.tickCentered(Jg):d.tickOffset=function(){var a=Gg?zf:xf;return a*Vb()/vc()/2},Xh&&d.categories(Ig),d}function Y(a,b,c,d){return ff.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in gg?gg[a]:"y"}function $(){var a=Wh?di:Xh?Oc:function(a){return 0>a?a.toFixed(0):a};return Kg&&("function"==typeof Kg?a=Kg:Wh&&(a=function(a){return ff.time.format(Kg)(a)})),a}function _(a){var b;return"y"===a?b=Xg:"y2"===a?b=eh:"x"===a&&(b=Sg),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Xg=b:"y2"===a?eh=b:"x"===a&&(Sg=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Gg?"inner-top":"inner-right")}function eb(){return cb("y",Gg?"inner-right":"inner-top")}function fb(){return cb("y2",Gg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?xf/2:xf:b.isBottom?-zf:b.isMiddle?-zf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Gg,db())}function ob(){return kb(Gg,eb())}function pb(){return kb(Gg,fb())}function qb(){return lb(!Gg,db())}function rb(){return lb(Gg,eb())}function sb(){return lb(Gg,fb())}function tb(){var a=db();return Gg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Gg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Gg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Gg,db())}function xb(){return mb(Gg,eb())}function yb(){return mb(Gg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return ff.selectAll("."+c+" .tick text").each(function(){var a=this.getBBox();bb?20:b}function Ab(){zi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),zi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),zi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return ff.min(Object.keys(i).map(function(a){return ff.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(fg.length>0)for(g=Nc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return ff.max(Object.keys(i).map(function(a){return ff.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?ch:Vg,n="y2"===c?bh:Ug,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?dh:Wg,r=kd()&⋙return 0===l.length?"y2"===c?Uf.domain():Tf.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=ld(o,p),j=$b(Tf.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&$g&&(f=b($g.top)?$g.top:e,g=b($g.bottom)?$g.bottom:e),"y2"===c&&hh&&(f=b(hh.top)?hh.top:e,g=b(hh.bottom)?hh.bottom:e),Pd(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Ei),c=$b(Sf.domain());return a||0===c?1:b/c}function Wb(a){return Qg?Qg:ff.min(a,function(a){return ff.min(a.values,function(a){return a.x})})}function Xb(a){return Pg?Pg:ff.max(a,function(a){return ff.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return Xh?d=0:Pd(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=Wh?new Date(c.getTime()-e):c-e,g=Wh?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return ag&&a===ag||ie(bg)&&je(bg,a)}function fc(a){return!ec(a)}function gc(a){return ag?ag:ie(bg)?bg[a]:null}function hc(a,b){var c,d=b&&ie(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=gf.data.xs[b])}),c}function ic(a,b){return a in gf.data.xs&&gf.data.xs[a]&&gf.data.xs[a][b]?gf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){bg[b]=a[b]})}function kc(a){return 1===ff.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=eg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),gf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=Wh?a?a instanceof Date?a:de(a):de(ic(b,c)):Yh&&!Xh?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?gf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):ag?(d=Object.keys(gf.data.xs),gf.data.xs[c]=d.length>0?gf.data.xs[d[0]]:void 0):ie(bg)&&(gf.data.xs[c]=hc(f,gf.data.targets)):gf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!gf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=dg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return Yh&&Xh&&0===c&&g&&(0===e&&(Ig=[]),Ig.push(g)),("undefined"==typeof a[b]||gf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),hg&&Nd(xc(c).filter(function(a){return!(a in ig)}),hg),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function tc(a){return a>0&&gf.data.targets[0].values[a-1]?gf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?gf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?gf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(gf.data.targets)}function zc(a,b){var c,d=xc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(Wh?new Date(h):h);i.push(d)}return i}function Gc(a){ei=ei.concat(a)}function Hc(a){ei=ei.filter(function(b){return a.indexOf(b)<0})}function Ic(a){fi=fi.concat(a)}function Jc(a){fi=fi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(td(a,f))),a[g].x&&(e=e.concat(td(a,g))),wd(e,b)):ud(a,b,f,g)}function vd(a,b){var c;return c=a.map(function(a){return ud(a.values,b)}),wd(c,b)}function wd(a,b){var c,d;return a.forEach(function(a){var e=ke(a,b);(c>e||!c)&&(c=e,d=a)}),d}function xd(a,b){return ff.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function yd(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 zd(){return kg&&"desc"===kg.toLowerCase()}function Ad(){return kg&&"asc"===kg.toLowerCase()}function Bd(a){var b=Ad(),c=zd();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 kg&&a.sort(kg),a}function Cd(a,c){var d,e,f,g,h,i,j,k=Td(gf.data.targets),l=k?nd:md,m=a.filter(function(a){return a&&b(a.value)});Jh&&0!==m.length&&(Ci.html(Mh(a,$(),l,ci)).style("display","block"),d=Ci.property("offsetWidth"),e=Ci.property("offsetHeight"),k?(g=xf/2+c[0],i=zf/2+c[1]+20):(Gg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Sf(m[0].x)+20):(f=q(),g=f+t()+Sf(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Ci.style("top",i+"px").style("left",g+"px"))}function Dd(){Ci.style("display","none")}function Ed(a){var c=a.filter(function(a){return a&&b(a.value)});Jh&&(Qd(gf.data.targets)||Td(gf.data.targets)||zi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Gg?"y1":"x1",pd).attr(Gg?"y2":"x2",pd))}function Fd(){zi.select("line."+f.xgridFocus).style("visibility","hidden")}function Gd(a){return a.x||0===a.x?Sf(a.x):null}function Hd(a){return V(a.id)(a.value)}function Id(){var a,b,d={},e=0;return Dc(Ac(Wd)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Md(a,b){return vh?vh:b?2*a.tickOffset()*wh/b:0}function Nd(a,b){yc(a).forEach(function(a){Gi[a]=b===ig[a],ig[a]=b})}function Od(a,b){var c=!1;return a.forEach(function(a){ig[a.id]===b&&(c=!0),a.id in ig||"line"!==b||(c=!0)}),c}function Pd(a){return Od(a,"bar")}function Qd(a){return Od(a,"scatter")}function Rd(a){return Od(a,"pie")}function Sd(a){return Od(a,"donut")}function Td(a){return Rd(a)||Sd(a)}function Ud(a){var b="string"==typeof a?a:a.id;return!(b in ig)||"line"===ig[b]||"spline"===ig[b]||"area"===ig[b]||"area-spline"===ig[b]}function Vd(a){var b="string"==typeof a?a:a.id;return"spline"===ig[b]||"area-spline"===ig[b]}function Wd(a){var b="string"==typeof a?a:a.id;return"bar"===ig[b]}function Xd(a){var b="string"==typeof a?a:a.id;return"scatter"===ig[b]}function Yd(a){var b="string"==typeof a?a:a.id;return"pie"===ig[b]}function Zd(a){var b="string"==typeof a?a:a.id;return"donut"===ig[b]}function $d(a){return Yd(a)||Zd(a)}function _d(a){return Wd(a)?a.values:[]}function ae(a){return Ud(a)||Xd(a)?a.values:[]}function be(a){return Wd(a)||Ud(a)?a.values:[]}function ce(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function de(b){var c;if(!b)throw Error(b+" can not be parsed as d3.time with format "+cg+". Maybe 'x' of this data is not defined. See data.x or data.xs option.");try{c=cg?ff.time.format(cg).parse(b):new Date(b)}catch(d){c=void 0}return c||a.console.error("Failed to parse x '"+b+"' to Date with format "+cg),c}function ee(a,b){var c=ff.mouse(a),d=ff.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function je(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ke(a,b){var c="y"===Z(a.id)?Tf:Uf,d=Gg?1:0,e=Gg?0:1;return Math.pow(Sf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function le(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function me(a,b,c){vg(b,a.node()),zi.select("."+f.selectedCircles+bd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Gg?Hd:Gd).attr("cy",Gg?Gd:Hd).attr("stroke",function(){return ci(b)}).attr("r",1.4*uh).transition().duration(100).attr("r",uh)}function ne(a,b,c){wg(b,a.node()),zi.select("."+f.selectedCircles+bd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function oe(a,b,c,d){a?me(b,c,d):ne(b,c,d)}function pe(a,b){vg(b,a.node()),a.transition().duration(100).style("fill",function(){return ff.rgb(ci(b)).darker(1)})}function qe(a,b){wg(b,a.node()),a.transition().duration(100).style("fill",function(){return ci(b)})}function re(a,b,c,d){a?pe(b,c,d):qe(b,c,d)}function se(a){return a.filter(function(a){return b(a.value)})}function te(a,c){return(c?zi.selectAll("."+f.circles+bd(c)):zi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ue(a,b){te(a,b).classed(f.EXPANDED,!0).attr("r",th)}function ve(a){te(a).filter(function(){return ff.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",qh)}function we(a){return zi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function xe(a){we(a).classed(f.EXPANDED,!0)}function ye(a){we(a).classed(f.EXPANDED,!1)}function ze(a,b){var c=De(a,b);return function(a,b){var d=c(a,b),e=Gg?1:0,f=Gg?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 Ae(a,b){var c=De(a,!1),d=b?Be:Ce;return function(a,b){return d(c(a,b),a,this)}}function Be(a,b){var c;return Gg?(c=Wd(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ce(a,b,c){var d=c.getBBox();return Gg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:Wd(b)?-3:-6)}function De(a,b){var c=a.__max__+1,d=Md(Yf,c),e=Jd(d,c,a,!!b),f=Kd(!!b),g=Ld(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Gg&&(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 Ee(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 Fe(b){var c,d,e;if(Di=ff.select(jf),Di.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Di.html(""),Di.classed("c3",!0),gf.data.xs={},gf.data.targets=rc(b),n(),R(),Sf.domain(ff.extent(Zb(gf.data.targets))),Tf.domain(Ub(gf.data.targets,"y")),Uf.domain(Ub(gf.data.targets,"y2")),Vf.domain(Sf.domain()),Wf.domain(Tf.domain()),Xf.domain(Uf.domain()),Ei=Sf.domain(),si.scale(Vf),of&&wi.scale(Sf),xi=Di.append("svg").attr("width",xf+uf.left+uf.right).attr("height",zf+uf.top+uf.bottom).on("mouseenter",rf).on("mouseleave",sf),yi=xi.append("defs"),yi.append("clipPath").attr("id",Qh).append("rect").attr("width",xf).attr("height",zf),yi.append("clipPath").attr("id",Rh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),yi.append("clipPath").attr("id",Sh).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),zi=xi.append("g").attr("transform",ki.main),Ai=zg?xi.append("g").attr("transform",ki.context):null,Bi=xi.append("g").attr("transform",ki.legend),Cg||(Bi.style("visibility","hidden"),fi=xc(gf.data.targets)),Ci=ff.select(jf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),af(xc(gf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),zi.append("g").attr("class",f.axisX).attr("clip-path",Gg?"":Uh).attr("transform",ki.x).append("text").attr("class",f.axisXLabel).attr("transform",Gg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),Tg&&zi.append("g").attr("class",f.axisY).attr("clip-path",Gg?Vh:"").attr("transform",ki.y).append("text").attr("class",f.axisYLabel).attr("transform",Gg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),ah&&zi.append("g").attr("class",f.axisY2).attr("transform",ki.y2).append("text").attr("class",f.axisY2Label).attr("transform",Gg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=zi.append("g").attr("clip-path",Th).attr("class",f.grid),jh&&d.append("g").attr("class",f.xgrids),ie(lh)&&d.append("g").attr("class",f.xgridLines),rh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),mh&&d.append("g").attr("class",f.ygrids),ie(nh)&&d.append("g").attr("class",f.ygridLines),zi.append("g").attr("clip-path",Th).attr("class",f.regions),zi.append("g").attr("clip-path",Th).attr("class",f.chart),c=zi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",of?Gg?"ns-resize":"ew-resize":null),zi.select("."+f.chart).append("g").attr("class",f.chartBars),zi.select("."+f.chart).append("g").attr("class",f.chartLines),zi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",ki.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),zi.select("."+f.chart).append("g").attr("class",f.chartTexts),of&&zi.insert("rect",qf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",xf).attr("height",zf).style("opacity",0).style("cursor",Gg?"ns-resize":"ew-resize").call(wi).on("dblclick.zoom",null),Rg&&si.extent("function"!=typeof Rg?Rg:Rg(Zb())),zg&&(Ai.append("g").attr("clip-path",Th).attr("class",f.chart),Ai.select("."+f.chart).append("g").attr("class",f.chartBars),Ai.select("."+f.chart).append("g").attr("class",f.chartLines),Ai.append("g").attr("clip-path",Th).attr("class",f.brush).call(si).selectAll("rect").attr(Gg?"width":"height",Gg?yf:Af),Ai.append("g").attr("class",f.axisX).attr("transform",ki.subx).attr("clip-path",Gg?"":Uh)),Se(gf.data.targets),Gg?zi.select("."+f.axisX).style("opacity",0).call(Yf):(zi.select("."+f.axisY).style("opacity",0).call(Zf),zi.select("."+f.axisY2).style("opacity",0).call($f)),Me({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Nh){if(Wh&&"string"==typeof Oh){for(Oh=de(Oh),e=0;e0){d=[];for(var g in eg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=yd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=re,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 Ke(a){Td(gf.data.targets)||og&&(Zh=a,zi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),$h=!0,xg())}function Le(){Td(gf.data.targets)||og&&(zi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),zi.selectAll("."+f.shape).classed(f.INCLUDED,!1),$h=!1,yg())}function Me(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Id(),U=Td(gf.data.targets),V=Dc(gf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?tf:0,O=B?N:0,P=C?N:0,H&&Cg&&af(xc(gf.data.targets),a),G&&(Sf.domain(ff.extent(Zb(V))),Ei=Sf.domain(),of&&wi.scale(Sf).updateScaleExtent(),Vf.domain(Sf.domain()),si.scale(Vf)),F&&(Sf.domain(si.empty()?Ei:si.extent()),of&&wi.scale(Sf).updateScaleExtent()),Tf.domain(Ub(V,"y")),Uf.domain(Ub(V,"y2")),Qd(V)||(Q=Fc(Ec(V)).sort(),Yf.tickValues(Q),_f.tickValues(Q)),c=zi.select("."+f.axisX).style("opacity",U?0:1),(Gg||D)&&(c=c.transition().duration(P)),c.call(Yf),e=zi.select("."+f.axisY).style("opacity",U?0:1),(!Gg||D)&&(e=e.transition().duration(P)),e.call(Zf),zi.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call($f),F&&Lg&&Q){for(R=1;R=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=Sf.ticks(10);g=zi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Gg?0:function(a){return Sf(a)-Yf.tickOffset()}).attr("x2",Gg?xf:function(a){return Sf(a)-Yf.tickOffset()}).attr("y1",Gg?function(a){return Sf(a)-Yf.tickOffset()}:uf.top).attr("y2",Gg?function(a){return Sf(a)-Yf.tickOffset()}:zf).style("opacity",function(){return+ff.select(this).attr(Gg?"y1":"x1")===(Gg?zf:0)?0:1}),g.exit().remove()}ie(lh)&&(i=zi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(lh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Gg?"":"rotate(-90)").attr("dx",Gg?0:-uf.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Gg?0:qd).attr("x2",Gg?xf:qd).attr("y1",Gg?qd:uf.top).attr("y2",Gg?qd:zf).style("opacity",1),i.select("text").transition().duration(N).attr("x",Gg?xf:0).attr("y",qd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&mh&&(k=zi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Tf.ticks(oh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Gg?Tf:0).attr("x2",Gg?Tf:xf).attr("y1",Gg?0:Tf).attr("y2",Gg?zf:Tf),k.exit().remove()),y&&ie(nh)&&(l=zi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(nh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Gg?"rotate(-90)":"").attr("dx",Gg?0:-uf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Gg?rd:0).attr("x2",Gg?rd:xf).attr("y1",Gg?0:rd).attr("y2",Gg?zf:rd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Gg?0:xf).attr("y",rd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=zi.selectAll("."+f.bars).selectAll("."+f.bar).data(_d),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ci(a)}).attr("class",Xc),p.style("opacity",gd).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=zi.selectAll("."+f.texts).selectAll("."+f.text).data(be),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Gg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return od(a.id)(a.value)}).style("fill-opacity",hd).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",jd),r.exit().transition().duration(O).style("fill-opacity",0).remove(),zi.selectAll("."+f.line).style("opacity",gd).transition().duration(N).attr("d",ti).style("opacity",1),zi.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",ui).style("opacity",Fi),n=zi.selectAll("."+f.circles).selectAll("."+f.circle).data(ae),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",qh),n.style("opacity",gd).transition().duration(N).style("opacity",id).attr("cx",Gg?Hd:Gd).attr("cy",Gg?Gd:Hd),n.exit().remove(),zi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=ff.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),zi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&$d(a.data)?1:0}),zi.select("."+f.chartArcsTitle).style("opacity",Sd(gf.data.targets)?1:0),zg&&(null!==ff.event&&"zoom"===ff.event.type&&si.extent(Sf.orgDomain()).update(),z&&(Ai.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(_f),si.empty()||si.extent(Sf.orgDomain()).update(),J=ze(T,!0),s=Ai.selectAll("."+f.bars).selectAll("."+f.bar).data(_d),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ci(a)}).attr("class",Xc),s.style("opacity",gd).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Ai.selectAll("."+f.line).style("opacity",gd).transition().duration(N).attr("d",vi).style("opacity",1))),zi.selectAll("."+f.selectedCircles).filter(function(a){return Wd(a)}).selectAll("circle").remove(),zi.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Gg?Hd:Gd).attr("cy",Gg?Gd:Hd),t=zi.select("."+f.eventRects),ie(bg)&&!kc(bg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=zi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),He(u.enter()),u.attr("x",0).attr("y",0).attr("width",xf).attr("height",zf)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Yh&&!Xh?(x=function(a,b){var c=tc(b),d=uc(b),e=gf.data.xs[a.id][b];return(Sf(d?d:e+50)-Sf(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=gf.data.xs[a.id][b];return(Sf(d)+Sf(c?c:d-50))/2}):(x=L(),w=function(a){return Sf(a.x)-x/2}),v=wc(),zi.select("."+f.eventRects).datum(v?v.values:[]),u=zi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ge(u.enter()),u.attr("class",ad).attr("x",Gg?0:w).attr("y",Gg?w:0).attr("width",Gg?xf:x).attr("height",Gg?x:zf),u.exit().remove()),q=zi.select("."+f.regions).selectAll("rect."+f.region).data(Ih),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Gg?0:cc).attr("y",Gg?cc:uf.top).attr("width",Gg?xf:dc).attr("height",Gg?dc:zf).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),xc(gf.data.targets).forEach(function(a){Gi[a]=!0})}}function Ne(){Me({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Oe(){return"mousemove"===ff.event.sourceEvent.type&&wi.altDomain?(Sf.domain(wi.altDomain),void wi.scale(Sf).updateScaleExtent()):(Xh&&Sf.orgDomain()[0]===Ei[0]&&Sf.domain([Ei[0]-1e-10,Sf.orgDomain()[1]]),Me({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===ff.event.sourceEvent.type&&(_h=!0)))}function Pe(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Qe(){xi.attr("width",Bf).attr("height",Cf),xi.select("#"+Qh).select("rect").attr("width",xf).attr("height",zf),xi.select("#"+Rh).select("rect").attr("width",H),xi.select("#"+Sh).select("rect").attr("width",J),xi.select("."+f.zoomRect).attr("width",xf).attr("height",zf)}function Re(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Qe(),m(a.withTransition),Me(a)}function Se(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=zi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a),j=i.enter().append("g").attr("class",function(a){return f.chartText+Pc(f.target,a.id)}).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ci(a)}),e=zi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),d=e.enter().append("g").attr("class",function(a){return f.chartBar+Pc(f.target,a.id)}).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ci(a)}).style("stroke","none").style("cursor",function(a){return qg(a)?"pointer":null}),c=zi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),b=c.enter().append("g").attr("class",function(a){return f.chartLine+Pc(f.target,a.id)}).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ci(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Fi=+ff.select(this).style("opacity"),0}).style("fill",function(a){return ci(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ci(a)}).style("cursor",function(a){return qg(a)?"pointer":null}),a.forEach(function(a){zi.selectAll("."+f.selectedCircles+bd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=zi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Jf(a)),g=h.enter().append("g").attr("class",function(a){return f.chartArc+Pc(f.target,a.data.id)}),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ci(a.data)}).style("cursor",function(a){return qg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),Xe(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Cd(c,ff.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),Ze(),Dd(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),zg&&(n=Ai.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),m=n.enter().append("g").attr("class",function(a){return f.chartBar+Pc(f.target,a.id)}),m.append("g").attr("class",Yc).style("fill",function(a){return ci(a)}),l=Ai.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),k=l.enter().append("g").attr("class",function(a){return f.chartLine+Pc(f.target,a.id)}),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ci(a)})),xi.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Te(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Nd(a.id,b.types[a.id]):Nd(a.id,b.type)}),gf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBBox(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=li?j:i,l=li?Q():P();return d&&(w=0,C=0,t=0,u=0),Cg&&!Cc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=li?u:t,void(Fg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,li?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Bi.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Eg?Eg(a):gf.toggle(a)}).on("mouseover",function(a){gf.focus(a)}).on("mouseout",function(){gf.revert()}),l.append("text").text(function(a){return d(eg[a])?eg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",li?g:-200).attr("y",li?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",li?h:-200).attr("y",li?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return ci(a)}).attr("x",li?g:-200).attr("y",li?-200:i).attr("width",10).attr("height",10),Bi.selectAll("text").data(a).text(function(a){return d(eg[a])?eg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Bi.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Bi.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Qe(),q&&m(p)}function bf(a){return zc(gf.data.targets,a.id)}function cf(a){return"data"in a&&zc(gf.data.targets,a.data.id)}function df(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 ef(a,b,c){var d=!Td(gf.data.targets);Nd(a,b),Re(c?c:{withTransitionForAxis:d})}var ff=a.d3?a.d3:a.require?a.require("d3"):void 0,gf={data:{},axis:{},legend:{}},hf={},jf=h(["bindto"],"#chart"),kf=h(["size","width"]),lf=h(["size","height"]),mf=h(["padding","left"]),nf=h(["padding","right"]),of=h(["zoom","enabled"],!1),pf=h(["zoom","extent"]),qf=h(["zoom","privileged"],!1),rf=h(["onenter"],function(){}),sf=h(["onleave"],function(){}),tf=h(["transition","duration"],350);g("data","data is required in config");var uf,vf,wf,xf,yf,zf,Af,Bf,Cf,Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag=h(["data","x"]),bg=h(["data","xs"],{}),cg=h(["data","x_format"]),dg=h(["data","id_converter"],function(a){return a}),eg=h(["data","names"],{}),fg=h(["data","groups"],[]),gg=h(["data","axes"],{}),hg=h(["data","type"]),ig=h(["data","types"],{}),jg=h(["data","labels"],{}),kg=h(["data","order"]),lg=h(["data","regions"],{}),mg=h(["data","color"]),ng=h(["data","colors"],{}),og=h(["data","selection","enabled"],!1),pg=h(["data","selection","grouped"],!1),qg=h(["data","selection","isselectable"],function(){return!0}),rg=h(["data","selection","multiple"],!0),sg=h(["data","onclick"],function(){}),tg=h(["data","onenter"],function(){}),ug=h(["data","onleave"],function(){}),vg=h(["data","onselected"],function(){}),wg=h(["data","onunselected"],function(){}),xg=h(["data","ondragstart"],function(){}),yg=h(["data","ondragend"],function(){}),zg=h(["subchart","show"],!1),Ag=zg?h(["subchart","size","height"],60):0,Bg=h(["color","pattern"],[]),Cg=h(["legend","show"],!0),Dg=h(["legend","position"],"bottom"),Eg=h(["legend","item","onclick"]),Fg=h(["legend","equally"],!1),Gg=h(["axis","rotated"],!1),Hg=h(["axis","x","type"],"indexed"),Ig=h(["axis","x","categories"],[]),Jg=h(["axis","x","tick","centered"],!1),Kg=h(["axis","x","tick","format"]),Lg=h(["axis","x","tick","culling"],{}),Mg=h(["axis","x","tick","culling","max"],"categorized"===Hg?1/0:10),Ng=h(["axis","x","tick","count"]),Og=h(["axis","x","tick","fit"],!1),Pg=h(["axis","x","max"]),Qg=h(["axis","x","min"]),Rg=h(["axis","x","default"]),Sg=h(["axis","x","label"],{}),Tg=h(["axis","y","show"],!0),Ug=h(["axis","y","max"]),Vg=h(["axis","y","min"]),Wg=h(["axis","y","center"]),Xg=h(["axis","y","label"],{}),Yg=h(["axis","y","inner"],!1),Zg=h(["axis","y","tick","format"]),$g=h(["axis","y","padding"],{}),_g=h(["axis","y","ticks"],10),ah=h(["axis","y2","show"],!1),bh=h(["axis","y2","max"]),ch=h(["axis","y2","min"]),dh=h(["axis","y2","center"]),eh=h(["axis","y2","label"],{}),fh=h(["axis","y2","inner"],!1),gh=h(["axis","y2","tick","format"]),hh=h(["axis","y2","padding"],{}),ih=h(["axis","y2","ticks"],10),jh=h(["grid","x","show"],!1),kh=h(["grid","x","type"],"tick"),lh=h(["grid","x","lines"],[]),mh=h(["grid","y","show"],!1),nh=h(["grid","y","lines"],[]),oh=h(["grid","y","ticks"],10),ph=h(["point","show"],!0),qh=ph?h(["point","r"],2.5):0,rh=h(["point","focus","line","enabled"],!0),sh=h(["point","focus","expand","enabled"],!0),th=h(["point","focus","expand","r"],sh?4:qh),uh=h(["point","focus","select","r"],8),vh=h(["bar","width"]),wh=h(["bar","width","ratio"],.6),xh=h(["pie","label","show"],!0),yh=h(["pie","label","format"]),zh=h(["pie","onclick"],function(){}),Ah=h(["pie","onmouseover"],function(){}),Bh=h(["pie","onmouseout"],function(){}),Ch=h(["donut","label","show"],!0),Dh=h(["donut","label","format"]),Eh=h(["donut","title"],""),Fh=h(["donut","onclick"],function(){}),Gh=h(["donut","onmouseover"],function(){}),Hh=h(["donut","onmouseout"],function(){}),Ih=h(["regions"],[]),Jh=h(["tooltip","show"],!0),Kh=h(["tooltip","format","title"]),Lh=h(["tooltip","format","value"]),Mh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Kh?Kh:b,l=Lh?Lh: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+""}),Nh=h(["tooltip","init","show"],!1),Oh=h(["tooltip","init","x"],0),Ph=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Qh=("string"==typeof jf?jf.replace("#",""):jf.id)+"-clip",Rh=Qh+"-xaxis",Sh=Qh+"-yaxis",Th=i(Qh),Uh=i(Uh),Vh=i(Vh),Wh="timeseries"===Hg,Xh="categorized"===Hg,Yh=!Wh&&(ag||ie(bg)),Zh=null,$h=!1,_h=!1,ai=!1,bi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ci=ce(ng,ie(Bg)?Bg:bi,mg),di=function(){var a=[[ff.time.format("%Y/%-m/%-d"),function(){return!0}],[ff.time.format("%-m/%-d"),function(a){return a.getMonth()}],[ff.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[ff.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[ff.time.format("%I %p"),function(a){return a.getHours()}],[ff.time.format("%I:%M"),function(a){return a.getMinutes()}],[ff.time.format(":%S"),function(a){return a.getSeconds()}],[ff.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)}}(),ei=[],fi=[],gi=Gg?"left":"bottom",hi=Gg?Yg?"top":"bottom":Yg?"right":"left",ii=Gg?fh?"bottom":"top":fh?"left":"right",ji=Gg?"left":"bottom",ki={main:function(){return"translate("+uf.left+","+uf.top+")"},context:function(){return"translate("+vf.left+","+vf.top+")"},legend:function(){return"translate("+wf.left+","+wf.top+")"},x:function(){return"translate(0,"+(Gg?0:zf)+")"},y:function(){return"translate(0,"+(Gg?zf:0)+")"},y2:function(){return"translate("+(Gg?0:xf)+","+(Gg?1:0)+")"},subx:function(){return"translate(0,"+(Gg?0:Af)+")"},arc:function(){return"translate("+xf/2+","+zf/2+")"}},li="right"===Dg,mi=0,ni=0,oi=0,pi=30,qi=30,ri=5;Jf=ff.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var si,ti=function(){var a=ff.svg.line().x(Gg?function(a){return V(a.id)(a.value)}:pd).y(Gg?pd:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=se(b.values);return Ud(b)?(a.interpolate(Vd(b)?"cardinal":"linear"),lg[b.id]?Ee(e,Sf,V(b.id),lg[b.id]):a(e)):(c=Sf(e[0].x),d=V(b.id)(e[0].value),Gg?"M "+d+" "+c:"M "+c+" "+d)}}(),ui=function(){var a;return a=Gg?ff.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(pd):ff.svg.area().x(pd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=se(b.values);return Od([b],"area")||Od([b],"area-spline")?(a.interpolate(Vd(b)?"cardinal":"linear"),a(e)):(c=Sf(e[0].x),d=V(b.id)(e[0].value),Gg?"M "+d+" "+c:"M "+c+" "+d)}}(),vi=function(){var a=ff.svg.line().x(Gg?function(a){return W(a.id)(a.value)}:sd).y(Gg?sd:function(a){return W(a.id)(a.value)});return function(b){var c=se(b.values);return Ud(b)?a(c):"M "+Vf(c[0].x)+" "+W(b.id)(c[0].value)}}(),wi=function(){};si=ff.svg.brush().on("brush",Ne),si.update=function(){return Ai&&Ai.select("."+f.brush).call(this),this},si.scale=function(a){return Gg?this.y(a):this.x(a)},of&&(wi=ff.behavior.zoom().on("zoomstart",function(){wi.altDomain=ff.event.sourceEvent.altKey?Sf.orgDomain():null}).on("zoom",of?Oe:null),wi.scale=function(a){return Gg?this.y(a):this.x(a)},wi.orgScaleExtent=function(){var a=pf?pf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},wi.updateScaleExtent=function(){var a=$b(Sf.orgDomain())/$b(Ei),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var xi,yi,zi,Ai,Bi,Ci,Di,Ei,Fi,Gi={};if(gf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=xi.selectAll(cd(a)),d=c.filter(bf),e=c.filter(cf);gf.revert(),gf.defocus(),b(d.classed(f.focused,!0)),b(e),Td(gf.data.targets)&&Kb(a,!0),Xe(a)},gf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=xi.selectAll(cd(a)),d=c.filter(bf),e=c.filter(cf);gf.revert(),b(d.classed(f.focused,!1)),b(e),Td(gf.data.targets)&&Lb(a),Ye(a)},gf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=xi.selectAll(cd(a)),d=c.filter(bf),e=c.filter(cf);b(d.classed(f.focused,!1)),b(e),Td(gf.data.targets)&&Lb(a),Ze()},gf.show=function(a,b){a=yc(a),b=b||{},Hc(a),xi.selectAll(dd(a)).transition().style("opacity",1),b.withLegend&&$e(a),Me({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},gf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),xi.selectAll(dd(a)).transition().style("opacity",0),b.withLegend&&_e(a),Me({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},gf.toggle=function(a){Bc(a)?gf.hide(a):gf.show(a)},gf.unzoom=function(){si.clear().update(),Me({withUpdateXDomain:!0})},gf.load=function(a){return a.xs&&jc(a.xs),"categories"in a&&Xh&&(Ig=a.categories,Yf.categories(Ig)),"cacheIds"in a&&_b(a.cacheIds)?void Te(bc(a.cacheIds),a.done):void("unload"in a?Ve(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ue(a)}):Ue(a))},gf.unload=function(a){Ve(yc(a),function(){Me({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},gf.selected=function(a){return ff.merge(zi.selectAll("."+f.shapes+bd(a)).selectAll("."+f.shape).filter(function(){return ff.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},gf.select=function(a,b,c){og&&zi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=ff.select(this),i="circle"===this.nodeName?me:pe,j="circle"===this.nodeName?ne:qe,k=pg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?qg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},gf.unselect=function(a,b){og&&zi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=ff.select(this),g="circle"===this.nodeName?ne:qe,h=pg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&qg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},gf.toLine=function(a){ef(a,"line")},gf.toSpline=function(a){ef(a,"spline")},gf.toBar=function(a){ef(a,"bar")},gf.toScatter=function(a){ef(a,"scatter")},gf.toArea=function(a){ef(a,"area")},gf.toAreaSpline=function(a){ef(a,"area-spline")},gf.toPie=function(a){ef(a,"pie",{withTransform:!0})},gf.toDonut=function(a){ef(a,"donut",{withTransform:!0})},gf.groups=function(a){return c(a)?fg:(fg=a,Me(),fg)},gf.xgrids=function(a){return a?(lh=a,Me(),lh):lh},gf.xgrids.add=function(a){return a?gf.xgrids(lh.concat(a)):void 0},gf.xgrids.remove=function(a){var b=df(a);return gf.xgrids(lh.filter(b))},gf.ygrids=function(a){return a?(nh=a,Me(),nh):nh},gf.ygrids.add=function(a){return a?gf.ygrids(nh.concat(a)):void 0},gf.ygrids.remove=function(a){var b=df(a);return gf.ygrids(nh.filter(b))},gf.regions=function(a){return c(a)?Ih:(Ih=a,Me(),Ih)},gf.regions.add=function(a){return c(a)?Ih:(Ih=Ih.concat(a),Me(),Ih)},gf.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;xi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Ih=Ih.filter(function(b){return b.classes.indexOf(a)<0})}),Ih},gf.data.get=function(a){var b=gf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},gf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},gf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){eg[b]=a[b]}),af(xc(gf.data.targets),{withTransition:!0}),eg):eg},gf.x=function(a){return arguments.length&&(mc(gf.data.targets,a),Me({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),gf.data.xs +}Ci.html(Mh(gf.data.targets.map(function(a){return lc(a.values[Oh])}),$(),md,ci)),Ci.style("top",Ph.top).style("left",Ph.left).style("display","block")}null==a.onresize&&(a.onresize=Pe()),a.onresize.add&&a.onresize.add(function(){Re({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})})}function Ge(a){a.append("rect").attr("class",ad).style("cursor",og&&pg?"pointer":null).on("mouseover",function(a,b){if(!$h&&!Td(gf.data.targets)){var c,d,e=gf.data.targets.map(function(a){return lc(a.values[b])});if(Object.keys(eg).length>0){d=[];for(var g in eg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=yd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=re,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 Ke(a){Td(gf.data.targets)||og&&(Zh=a,zi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),$h=!0,xg())}function Le(){Td(gf.data.targets)||og&&(zi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),zi.selectAll("."+f.shape).classed(f.INCLUDED,!1),$h=!1,yg())}function Me(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Id(),U=Td(gf.data.targets),V=Dc(gf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?tf:0,O=B?N:0,P=C?N:0,H&&Cg&&af(xc(gf.data.targets),a),G&&(Sf.domain(ff.extent(Zb(V))),Ei=Sf.domain(),of&&wi.scale(Sf).updateScaleExtent(),Vf.domain(Sf.domain()),si.scale(Vf)),F&&(Sf.domain(si.empty()?Ei:si.extent()),of&&wi.scale(Sf).updateScaleExtent()),Tf.domain(Ub(V,"y")),Uf.domain(Ub(V,"y2")),Qd(V)||(Q=Fc(Ec(V)).sort(),Yf.tickValues(Q),_f.tickValues(Q)),c=zi.select("."+f.axisX).style("opacity",U?0:1),(Gg||D)&&(c=c.transition().duration(P)),c.call(Yf),e=zi.select("."+f.axisY).style("opacity",U?0:1),(!Gg||D)&&(e=e.transition().duration(P)),e.call(Zf),zi.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call($f),F&&Lg&&Q){for(R=1;R=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=Sf.ticks(10);g=zi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Gg?0:function(a){return Sf(a)-Yf.tickOffset()}).attr("x2",Gg?xf:function(a){return Sf(a)-Yf.tickOffset()}).attr("y1",Gg?function(a){return Sf(a)-Yf.tickOffset()}:uf.top).attr("y2",Gg?function(a){return Sf(a)-Yf.tickOffset()}:zf).style("opacity",function(){return+ff.select(this).attr(Gg?"y1":"x1")===(Gg?zf:0)?0:1}),g.exit().remove()}ie(lh)&&(i=zi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(lh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Gg?"":"rotate(-90)").attr("dx",Gg?0:-uf.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Gg?0:qd).attr("x2",Gg?xf:qd).attr("y1",Gg?qd:uf.top).attr("y2",Gg?qd:zf).style("opacity",1),i.select("text").transition().duration(N).attr("x",Gg?xf:0).attr("y",qd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&mh&&(k=zi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Tf.ticks(oh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Gg?Tf:0).attr("x2",Gg?Tf:xf).attr("y1",Gg?0:Tf).attr("y2",Gg?zf:Tf),k.exit().remove()),y&&ie(nh)&&(l=zi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(nh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Gg?"rotate(-90)":"").attr("dx",Gg?0:-uf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Gg?rd:0).attr("x2",Gg?rd:xf).attr("y1",Gg?0:rd).attr("y2",Gg?zf:rd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Gg?0:xf).attr("y",rd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=zi.selectAll("."+f.bars).selectAll("."+f.bar).data(_d),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ci(a)}).attr("class",Xc),p.style("opacity",gd).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=zi.selectAll("."+f.texts).selectAll("."+f.text).data(be),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Gg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return od(a.id)(a.value)}).style("fill-opacity",hd).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",jd),r.exit().transition().duration(O).style("fill-opacity",0).remove(),zi.selectAll("."+f.line).style("opacity",gd).transition().duration(N).attr("d",ti).style("opacity",1),zi.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",ui).style("opacity",Fi),n=zi.selectAll("."+f.circles).selectAll("."+f.circle).data(ae),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",qh),n.style("opacity",gd).transition().duration(N).style("opacity",id).attr("cx",Gg?Hd:Gd).attr("cy",Gg?Gd:Hd),n.exit().remove(),zi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=ff.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),zi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&$d(a.data)?1:0}),zi.select("."+f.chartArcsTitle).style("opacity",Sd(gf.data.targets)?1:0),zg&&(null!==ff.event&&"zoom"===ff.event.type&&si.extent(Sf.orgDomain()).update(),z&&(Ai.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(_f),si.empty()||si.extent(Sf.orgDomain()).update(),J=ze(T,!0),s=Ai.selectAll("."+f.bars).selectAll("."+f.bar).data(_d),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ci(a)}).attr("class",Xc),s.style("opacity",gd).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Ai.selectAll("."+f.line).style("opacity",gd).transition().duration(N).attr("d",vi).style("opacity",1))),zi.selectAll("."+f.selectedCircles).filter(function(a){return Wd(a)}).selectAll("circle").remove(),zi.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Gg?Hd:Gd).attr("cy",Gg?Gd:Hd),t=zi.select("."+f.eventRects),ie(bg)&&!kc(bg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=zi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),He(u.enter()),u.attr("x",0).attr("y",0).attr("width",xf).attr("height",zf)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Yh&&!Xh?(x=function(a,b){var c=tc(b),d=uc(b),e=gf.data.xs[a.id][b];return(Sf(d?d:e+50)-Sf(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=gf.data.xs[a.id][b];return(Sf(d)+Sf(c?c:d-50))/2}):(x=L(),w=function(a){return Sf(a.x)-x/2}),v=wc(),zi.select("."+f.eventRects).datum(v?v.values:[]),u=zi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ge(u.enter()),u.attr("class",ad).attr("x",Gg?0:w).attr("y",Gg?w:0).attr("width",Gg?xf:x).attr("height",Gg?x:zf),u.exit().remove()),q=zi.select("."+f.regions).selectAll("rect."+f.region).data(Ih),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Gg?0:cc).attr("y",Gg?cc:uf.top).attr("width",Gg?xf:dc).attr("height",Gg?dc:zf).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),xc(gf.data.targets).forEach(function(a){Gi[a]=!0})}}function Ne(){Me({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Oe(){return"mousemove"===ff.event.sourceEvent.type&&wi.altDomain?(Sf.domain(wi.altDomain),void wi.scale(Sf).updateScaleExtent()):(Xh&&Sf.orgDomain()[0]===Ei[0]&&Sf.domain([Ei[0]-1e-10,Sf.orgDomain()[1]]),Me({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===ff.event.sourceEvent.type&&(_h=!0)))}function Pe(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Qe(){xi.attr("width",Bf).attr("height",Cf),xi.select("#"+Qh).select("rect").attr("width",xf).attr("height",zf),xi.select("#"+Rh).select("rect").attr("width",H),xi.select("#"+Sh).select("rect").attr("width",J),xi.select("."+f.zoomRect).attr("width",xf).attr("height",zf)}function Re(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Qe(),m(a.withTransition),Me(a)}function Se(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=zi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a),j=i.enter().append("g").attr("class",function(a){return f.chartText+Pc(f.target,a.id)}).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ci(a)}),e=zi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),d=e.enter().append("g").attr("class",function(a){return f.chartBar+Pc(f.target,a.id)}).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ci(a)}).style("stroke","none").style("cursor",function(a){return qg(a)?"pointer":null}),c=zi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),b=c.enter().append("g").attr("class",function(a){return f.chartLine+Pc(f.target,a.id)}).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ci(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Fi=+ff.select(this).style("opacity"),0}).style("fill",function(a){return ci(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ci(a)}).style("cursor",function(a){return qg(a)?"pointer":null}),a.forEach(function(a){zi.selectAll("."+f.selectedCircles+bd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=zi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Jf(a)),g=h.enter().append("g").attr("class",function(a){return f.chartArc+Pc(f.target,a.data.id)}),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ci(a.data)}).style("cursor",function(a){return qg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),Xe(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Cd(c,ff.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),Ze(),Dd(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),zg&&(n=Ai.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),m=n.enter().append("g").attr("class",function(a){return f.chartBar+Pc(f.target,a.id)}),m.append("g").attr("class",Yc).style("fill",function(a){return ci(a)}),l=Ai.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),k=l.enter().append("g").attr("class",function(a){return f.chartLine+Pc(f.target,a.id)}),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ci(a)})),xi.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Te(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Nd(a.id,b.types[a.id]):Nd(a.id,b.type)}),gf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBBox(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=li?j:i,l=li?Q():P();return d&&(w=0,C=0,t=0,u=0),Cg&&!Cc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=li?u:t,void(Fg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,li?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Bi.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Eg?Eg(a):gf.toggle(a)}).on("mouseover",function(a){gf.focus(a)}).on("mouseout",function(){gf.revert()}),l.append("text").text(function(a){return d(eg[a])?eg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",li?g:-200).attr("y",li?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",li?h:-200).attr("y",li?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return ci(a)}).attr("x",li?g:-200).attr("y",li?-200:i).attr("width",10).attr("height",10),Bi.selectAll("text").data(a).text(function(a){return d(eg[a])?eg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Bi.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Bi.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Qe(),q&&m(p)}function bf(a){return zc(gf.data.targets,a.id)}function cf(a){return"data"in a&&zc(gf.data.targets,a.data.id)}function df(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 ef(a,b,c){var d=!Td(gf.data.targets);Nd(a,b),Re(c?c:{withTransitionForAxis:d})}var ff=a.d3?a.d3:a.require?a.require("d3"):void 0,gf={data:{},axis:{},legend:{}},hf={},jf=h(["bindto"],"#chart"),kf=h(["size","width"]),lf=h(["size","height"]),mf=h(["padding","left"]),nf=h(["padding","right"]),of=h(["zoom","enabled"],!1),pf=h(["zoom","extent"]),qf=h(["zoom","privileged"],!1),rf=h(["onenter"],function(){}),sf=h(["onleave"],function(){}),tf=h(["transition","duration"],350);g("data","data is required in config");var uf,vf,wf,xf,yf,zf,Af,Bf,Cf,Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag=h(["data","x"]),bg=h(["data","xs"],{}),cg=h(["data","x_format"]),dg=h(["data","id_converter"],function(a){return a}),eg=h(["data","names"],{}),fg=h(["data","groups"],[]),gg=h(["data","axes"],{}),hg=h(["data","type"]),ig=h(["data","types"],{}),jg=h(["data","labels"],{}),kg=h(["data","order"]),lg=h(["data","regions"],{}),mg=h(["data","color"]),ng=h(["data","colors"],{}),og=h(["data","selection","enabled"],!1),pg=h(["data","selection","grouped"],!1),qg=h(["data","selection","isselectable"],function(){return!0}),rg=h(["data","selection","multiple"],!0),sg=h(["data","onclick"],function(){}),tg=h(["data","onenter"],function(){}),ug=h(["data","onleave"],function(){}),vg=h(["data","onselected"],function(){}),wg=h(["data","onunselected"],function(){}),xg=h(["data","ondragstart"],function(){}),yg=h(["data","ondragend"],function(){}),zg=h(["subchart","show"],!1),Ag=zg?h(["subchart","size","height"],60):0,Bg=h(["color","pattern"],[]),Cg=h(["legend","show"],!0),Dg=h(["legend","position"],"bottom"),Eg=h(["legend","item","onclick"]),Fg=h(["legend","equally"],!1),Gg=h(["axis","rotated"],!1),Hg=h(["axis","x","type"],"indexed"),Ig=h(["axis","x","categories"],[]),Jg=h(["axis","x","tick","centered"],!1),Kg=h(["axis","x","tick","format"]),Lg=h(["axis","x","tick","culling"],{}),Mg=h(["axis","x","tick","culling","max"],"categorized"===Hg?1/0:10),Ng=h(["axis","x","tick","count"]),Og=h(["axis","x","tick","fit"],!1),Pg=h(["axis","x","max"]),Qg=h(["axis","x","min"]),Rg=h(["axis","x","default"]),Sg=h(["axis","x","label"],{}),Tg=h(["axis","y","show"],!0),Ug=h(["axis","y","max"]),Vg=h(["axis","y","min"]),Wg=h(["axis","y","center"]),Xg=h(["axis","y","label"],{}),Yg=h(["axis","y","inner"],!1),Zg=h(["axis","y","tick","format"]),$g=h(["axis","y","padding"],{}),_g=h(["axis","y","ticks"],10),ah=h(["axis","y2","show"],!1),bh=h(["axis","y2","max"]),ch=h(["axis","y2","min"]),dh=h(["axis","y2","center"]),eh=h(["axis","y2","label"],{}),fh=h(["axis","y2","inner"],!1),gh=h(["axis","y2","tick","format"]),hh=h(["axis","y2","padding"],{}),ih=h(["axis","y2","ticks"],10),jh=h(["grid","x","show"],!1),kh=h(["grid","x","type"],"tick"),lh=h(["grid","x","lines"],[]),mh=h(["grid","y","show"],!1),nh=h(["grid","y","lines"],[]),oh=h(["grid","y","ticks"],10),ph=h(["point","show"],!0),qh=ph?h(["point","r"],2.5):0,rh=h(["point","focus","line","enabled"],!0),sh=h(["point","focus","expand","enabled"],!0),th=h(["point","focus","expand","r"],sh?4:qh),uh=h(["point","focus","select","r"],8),vh=h(["bar","width"]),wh=h(["bar","width","ratio"],.6),xh=h(["pie","label","show"],!0),yh=h(["pie","label","format"]),zh=h(["pie","onclick"],function(){}),Ah=h(["pie","onmouseover"],function(){}),Bh=h(["pie","onmouseout"],function(){}),Ch=h(["donut","label","show"],!0),Dh=h(["donut","label","format"]),Eh=h(["donut","title"],""),Fh=h(["donut","onclick"],function(){}),Gh=h(["donut","onmouseover"],function(){}),Hh=h(["donut","onmouseout"],function(){}),Ih=h(["regions"],[]),Jh=h(["tooltip","show"],!0),Kh=h(["tooltip","format","title"]),Lh=h(["tooltip","format","value"]),Mh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Kh?Kh:b,l=Lh?Lh: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+""}),Nh=h(["tooltip","init","show"],!1),Oh=h(["tooltip","init","x"],0),Ph=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Qh=("string"==typeof jf?jf.replace("#",""):jf.id)+"-clip",Rh=Qh+"-xaxis",Sh=Qh+"-yaxis",Th=i(Qh),Uh=i(Uh),Vh=i(Vh),Wh="timeseries"===Hg,Xh="categorized"===Hg,Yh=!Wh&&(ag||ie(bg)),Zh=null,$h=!1,_h=!1,ai=!1,bi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ci=ce(ng,ie(Bg)?Bg:bi,mg),di=function(){var a=[[ff.time.format("%Y/%-m/%-d"),function(){return!0}],[ff.time.format("%-m/%-d"),function(a){return a.getMonth()}],[ff.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[ff.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[ff.time.format("%I %p"),function(a){return a.getHours()}],[ff.time.format("%I:%M"),function(a){return a.getMinutes()}],[ff.time.format(":%S"),function(a){return a.getSeconds()}],[ff.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)}}(),ei=[],fi=[],gi=Gg?"left":"bottom",hi=Gg?Yg?"top":"bottom":Yg?"right":"left",ii=Gg?fh?"bottom":"top":fh?"left":"right",ji=Gg?"left":"bottom",ki={main:function(){return"translate("+uf.left+","+uf.top+")"},context:function(){return"translate("+vf.left+","+vf.top+")"},legend:function(){return"translate("+wf.left+","+wf.top+")"},x:function(){return"translate(0,"+(Gg?0:zf)+")"},y:function(){return"translate(0,"+(Gg?zf:0)+")"},y2:function(){return"translate("+(Gg?0:xf)+","+(Gg?1:0)+")"},subx:function(){return"translate(0,"+(Gg?0:Af)+")"},arc:function(){return"translate("+xf/2+","+zf/2+")"}},li="right"===Dg,mi=0,ni=0,oi=0,pi=30,qi=30,ri=5;Jf=ff.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var si,ti=function(){var a=ff.svg.line().x(Gg?function(a){return V(a.id)(a.value)}:pd).y(Gg?pd:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=se(b.values);return Ud(b)?(a.interpolate(Vd(b)?"cardinal":"linear"),lg[b.id]?Ee(e,Sf,V(b.id),lg[b.id]):a(e)):(c=Sf(e[0].x),d=V(b.id)(e[0].value),Gg?"M "+d+" "+c:"M "+c+" "+d)}}(),ui=function(){var a;return a=Gg?ff.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(pd):ff.svg.area().x(pd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=se(b.values);return Od([b],"area")||Od([b],"area-spline")?(a.interpolate(Vd(b)?"cardinal":"linear"),a(e)):(c=e[0]?Sf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Gg?"M "+d+" "+c:"M "+c+" "+d)}}(),vi=function(){var a=ff.svg.line().x(Gg?function(a){return W(a.id)(a.value)}:sd).y(Gg?sd:function(a){return W(a.id)(a.value)});return function(b){var c=se(b.values);return Ud(b)?a(c):"M "+Vf(c[0].x)+" "+W(b.id)(c[0].value)}}(),wi=function(){};si=ff.svg.brush().on("brush",Ne),si.update=function(){return Ai&&Ai.select("."+f.brush).call(this),this},si.scale=function(a){return Gg?this.y(a):this.x(a)},of&&(wi=ff.behavior.zoom().on("zoomstart",function(){wi.altDomain=ff.event.sourceEvent.altKey?Sf.orgDomain():null}).on("zoom",of?Oe:null),wi.scale=function(a){return Gg?this.y(a):this.x(a)},wi.orgScaleExtent=function(){var a=pf?pf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},wi.updateScaleExtent=function(){var a=$b(Sf.orgDomain())/$b(Ei),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var xi,yi,zi,Ai,Bi,Ci,Di,Ei,Fi,Gi={};if(gf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=xi.selectAll(cd(a)),d=c.filter(bf),e=c.filter(cf);gf.revert(),gf.defocus(),b(d.classed(f.focused,!0)),b(e),Td(gf.data.targets)&&Kb(a,!0),Xe(a)},gf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=xi.selectAll(cd(a)),d=c.filter(bf),e=c.filter(cf);gf.revert(),b(d.classed(f.focused,!1)),b(e),Td(gf.data.targets)&&Lb(a),Ye(a)},gf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=xi.selectAll(cd(a)),d=c.filter(bf),e=c.filter(cf);b(d.classed(f.focused,!1)),b(e),Td(gf.data.targets)&&Lb(a),Ze()},gf.show=function(a,b){a=yc(a),b=b||{},Hc(a),xi.selectAll(dd(a)).transition().style("opacity",1),b.withLegend&&$e(a),Me({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},gf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),xi.selectAll(dd(a)).transition().style("opacity",0),b.withLegend&&_e(a),Me({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},gf.toggle=function(a){Bc(a)?gf.hide(a):gf.show(a)},gf.unzoom=function(){si.clear().update(),Me({withUpdateXDomain:!0})},gf.load=function(a){return a.xs&&jc(a.xs),"categories"in a&&Xh&&(Ig=a.categories,Yf.categories(Ig)),"cacheIds"in a&&_b(a.cacheIds)?void Te(bc(a.cacheIds),a.done):void("unload"in a?Ve(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ue(a)}):Ue(a))},gf.unload=function(a){Ve(yc(a),function(){Me({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},gf.selected=function(a){return ff.merge(zi.selectAll("."+f.shapes+bd(a)).selectAll("."+f.shape).filter(function(){return ff.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},gf.select=function(a,b,c){og&&zi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=ff.select(this),i="circle"===this.nodeName?me:pe,j="circle"===this.nodeName?ne:qe,k=pg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?qg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},gf.unselect=function(a,b){og&&zi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=ff.select(this),g="circle"===this.nodeName?ne:qe,h=pg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&qg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},gf.toLine=function(a){ef(a,"line")},gf.toSpline=function(a){ef(a,"spline")},gf.toBar=function(a){ef(a,"bar")},gf.toScatter=function(a){ef(a,"scatter")},gf.toArea=function(a){ef(a,"area")},gf.toAreaSpline=function(a){ef(a,"area-spline")},gf.toPie=function(a){ef(a,"pie",{withTransform:!0})},gf.toDonut=function(a){ef(a,"donut",{withTransform:!0})},gf.groups=function(a){return c(a)?fg:(fg=a,Me(),fg)},gf.xgrids=function(a){return a?(lh=a,Me(),lh):lh},gf.xgrids.add=function(a){return a?gf.xgrids(lh.concat(a)):void 0},gf.xgrids.remove=function(a){var b=df(a);return gf.xgrids(lh.filter(b))},gf.ygrids=function(a){return a?(nh=a,Me(),nh):nh},gf.ygrids.add=function(a){return a?gf.ygrids(nh.concat(a)):void 0},gf.ygrids.remove=function(a){var b=df(a);return gf.ygrids(nh.filter(b))},gf.regions=function(a){return c(a)?Ih:(Ih=a,Me(),Ih)},gf.regions.add=function(a){return c(a)?Ih:(Ih=Ih.concat(a),Me(),Ih)},gf.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;xi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Ih=Ih.filter(function(b){return b.classes.indexOf(a)<0})}),Ih},gf.data.get=function(a){var b=gf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},gf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},gf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){eg[b]=a[b]}),af(xc(gf.data.targets),{withTransition:!0}),eg):eg},gf.x=function(a){return arguments.length&&(mc(gf.data.targets,a),Me({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),gf.data.xs },gf.xs=function(a){return arguments.length&&(nc(gf.data.targets,a),Me({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),gf.data.xs},gf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},gf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Ug=+a.y),b(a.y2)&&(bh=+a.y2)):Ug=bh=+a,Me())},gf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Vg=+a.y),b(a.y2)&&(ch=+a.y2)):Vg=ch=+a,Me())},gf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&gf.axis.max(a.max),"undefined"!=typeof a.min&&gf.axis.min(a.min))},gf.legend.show=function(a){Cg||(Cg=!0,Bi.style("visibility","visible")),$e(yc(a)),Me({withTransitionForHorizontalAxis:!1})},gf.legend.hide=function(a){Cg&&he(a)&&(Cg=!1,Bi.style("visibility","hidden")),_e(yc(a)),Me({withTransitionForHorizontalAxis:!1})},gf.resize=function(a){kf=a?a.width:null,lf=a?a.height:null,Re({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},gf.destroy=function(){gf.data.targets=void 0,gf.data.xs={},Di.html(""),a.onresize=null},"url"in e.data)ff.csv(e.data.url,function(a,b){Fe(b)});else if("rows"in e.data)Fe(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Fe(qc(e.data.columns))}return gf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From f1b08788e0996f2d6151e96de781b218c9d79ebe Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Tue, 8 Apr 2014 21:57:41 +0900 Subject: [PATCH 021/178] Add data.classes option - #117 --- c3.js | 20 ++++++++++++++------ c3.min.js | 6 +++--- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/c3.js b/c3.js index 7c27c4c..b85de7d 100644 --- a/c3.js +++ b/c3.js @@ -124,6 +124,7 @@ __data_x_format = getConfig(['data', 'x_format']), __data_id_converter = getConfig(['data', 'id_converter'], function (id) { return id; }), __data_names = getConfig(['data', 'names'], {}), + __data_classes = getConfig(['data', 'classes'], {}), __data_groups = getConfig(['data', 'groups'], []), __data_axes = getConfig(['data', 'axes'], {}), __data_type = getConfig(['data', 'type']), @@ -1579,6 +1580,13 @@ function classArea(d) { return classShapes(d) + generateClass(CLASS.area, d.id); } function classRegion(d, i) { return generateClass(CLASS.region, i) + ' ' + ('class' in d ? d.class : ''); } function classEvent(d, i) { return generateClass(CLASS.eventRect, i); } + function classTarget(id) { + var additionalClassSuffix = __data_classes[id], additionalClass = ''; + if (additionalClassSuffix) { + additionalClass = ' ' + CLASS.target + '-' + additionalClassSuffix; + } + return generateClass(CLASS.target, id) + additionalClass; + } function getTargetSelectorSuffix(targetId) { return targetId || targetId === 0 ? '-' + (targetId.replace ? targetId.replace(/([^a-zA-Z0-9-_])/g, '-') : targetId) : ''; @@ -3447,7 +3455,7 @@ .selectAll('.' + CLASS.chartText) .data(targets); mainTextEnter = mainTextUpdate.enter().append('g') - .attr('class', function (d) { return CLASS.chartText + generateClass(CLASS.target, d.id); }) + .attr('class', function (d) { return CLASS.chartText + classTarget(d.id); }) .style("pointer-events", "none"); mainTextEnter.append('g') .attr('class', classTexts) @@ -3458,7 +3466,7 @@ .selectAll('.' + CLASS.chartBar) .data(targets); mainBarEnter = mainBarUpdate.enter().append('g') - .attr('class', function (d) { return CLASS.chartBar + generateClass(CLASS.target, d.id); }) + .attr('class', function (d) { return CLASS.chartBar + classTarget(d.id); }) .style("pointer-events", "none"); // Bars for each data mainBarEnter.append('g') @@ -3472,7 +3480,7 @@ .selectAll('.' + CLASS.chartLine) .data(targets); mainLineEnter = mainLineUpdate.enter().append('g') - .attr('class', function (d) { return CLASS.chartLine + generateClass(CLASS.target, d.id); }) + .attr('class', function (d) { return CLASS.chartLine + classTarget(d.id); }) .style("pointer-events", "none"); // Lines for each data mainLineEnter.append("path") @@ -3505,7 +3513,7 @@ .selectAll('.' + CLASS.chartArc) .data(pie(targets)); mainPieEnter = mainPieUpdate.enter().append("g") - .attr("class", function (d) { return CLASS.chartArc + generateClass(CLASS.target, d.data.id); }); + .attr("class", function (d) { return CLASS.chartArc + classTarget(d.data.id); }); mainPieEnter.append("path") .attr("class", classArc) .style("opacity", 0) @@ -3549,7 +3557,7 @@ .selectAll('.' + CLASS.chartBar) .data(targets); contextBarEnter = contextBarUpdate.enter().append('g') - .attr('class', function (d) { return CLASS.chartBar + generateClass(CLASS.target, d.id); }); + .attr('class', function (d) { return CLASS.chartBar + classTarget(d.id); }); // Bars for each data contextBarEnter.append('g') .attr("class", classBars) @@ -3560,7 +3568,7 @@ .selectAll('.' + CLASS.chartLine) .data(targets); contextLineEnter = contextLineUpdate.enter().append('g') - .attr('class', function (d) { return CLASS.chartLine + generateClass(CLASS.target, d.id); }); + .attr('class', function (d) { return CLASS.chartLine + classTarget(d.id); }); // Lines for each data contextLineEnter.append("path") .attr("class", classLine) diff --git a/c3.min.js b/c3.min.js index 6bc8575..4bafa8d 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.29"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",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;cxf&&(xf=0),0>zf&&(zf=0),vf={top:Gg?uf.top:Cf-Ag-(li?0:a),right:0/0,bottom:20+(li?0:a),left:Gg?pi:uf.left},yf=Gg?uf.left-pi-qi:xf,Af=Gg?zf:Cf-vf.top-vf.bottom,0>yf&&(yf=0),0>Af&&(Af=0),wf={top:li?0:Cf-a,right:0/0,bottom:0,left:li?Bf-b:0},p(),li&&Td(gf.data.targets)&&(wf.left=xf/2+Ef)}function o(){zi.select("line."+f.xgridFocus).attr("x1",Gg?0:-10).attr("x2",Gg?xf:-10).attr("y1",Gg?-10:uf.top).attr("y2",Gg?-10:zf)}function p(){Ef=zf/2,Df=.95*Ef,Ff=Sd(gf.data.targets)?.6*Df:0}function q(){var a=Gg?f.axisX:f.axisY,b=ff.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=ff.select(jf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return kf?kf:x()}function s(){var a=lf?lf:y();return a>0?a:320}function t(){return Td(gf.data.targets)?0:mf?mf:Gg||!Tg||Yg?1:v("y")}function u(){var a=1;return Td(gf.data.targets)?0:nf?nf:li?P()+(ah&&!Gg?v("y2"):a):ah?fh||Gg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||Tg?"y2"!==a||ah?(gb(a).isInner?30:40)+("y2"===a?-10:0):ri:Cg&&!li?10:1}function x(){return+ff.select(jf).style("width").replace("px","")}function y(){return+ff.select(jf).style("height").replace("px","")}function z(a){return a?-5:-(uf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Gg)}function C(){return A(!Gg)}function D(){return z(Gg)}function E(){return A(Gg)}function F(a){return a?xf+2+4:uf.left+20}function G(a){return a?80:zf+2}function H(){return F(!Gg)}function I(){return G(!Gg)}function J(){return F(Gg)}function K(){return G(Gg)}function L(){var a=Gg?zf:xf,b=vc(),c=Vb()*(Pd(gf.data.targets)?(b-(Xh?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){mi=a}function N(a){ni=a}function O(a){oi=a}function P(){return Cg?li?ni*(mi+1):Bf:0}function Q(){return Cg?li?Cf:oi*(mi+1):0}function R(){var a,b=!Sf;Kf=Gg?1:0,Lf=Gg?zf:xf,Mf=Gg?0:zf,Nf=Gg?xf:1,Of=Kf,Pf=Lf,Qf=Gg?0:Af,Rf=Gg?yf:1,Sf=T(Kf,Lf,b?void 0:Sf.domain(),function(){return Yf.tickOffset()}),Tf=U(Mf,Nf),Uf=U(Mf,Nf),Vf=T(Kf,Lf,Ei,function(a){return a%1?0:_f.tickOffset()}),Wf=U(Qf,Rf),Xf=U(Qf,Rf),a=$(),Yf=X(Sf,gi,a),_f=X(Vf,ji,a),Zf=Y(Tf,hi,Zg,_g),$f=Y(Uf,ii,gh,ih),b||(si.scale(Vf),of&&wi.scale(Sf)),S()}function S(){Gf=Db(),Hf=Eb(),If=Eb(.98)}function T(a,b,e,f){var g=(Wh?ff.time.scale():ff.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),Xh){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return ff.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?Uf:Tf}function W(a){return"y2"===Z(a)?Xf:Wf}function X(a,b,c){var d=(Xh?Bb():ff.svg.axis()).scale(a).orient(b);return d.tickFormat(c),Xh?d.tickCentered(Jg):d.tickOffset=function(){var a=Gg?zf:xf;return a*Vb()/vc()/2},Xh&&d.categories(Ig),d}function Y(a,b,c,d){return ff.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in gg?gg[a]:"y"}function $(){var a=Wh?di:Xh?Oc:function(a){return 0>a?a.toFixed(0):a};return Kg&&("function"==typeof Kg?a=Kg:Wh&&(a=function(a){return ff.time.format(Kg)(a)})),a}function _(a){var b;return"y"===a?b=Xg:"y2"===a?b=eh:"x"===a&&(b=Sg),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Xg=b:"y2"===a?eh=b:"x"===a&&(Sg=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Gg?"inner-top":"inner-right")}function eb(){return cb("y",Gg?"inner-right":"inner-top")}function fb(){return cb("y2",Gg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?xf/2:xf:b.isBottom?-zf:b.isMiddle?-zf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Gg,db())}function ob(){return kb(Gg,eb())}function pb(){return kb(Gg,fb())}function qb(){return lb(!Gg,db())}function rb(){return lb(Gg,eb())}function sb(){return lb(Gg,fb())}function tb(){var a=db();return Gg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Gg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Gg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Gg,db())}function xb(){return mb(Gg,eb())}function yb(){return mb(Gg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return ff.selectAll("."+c+" .tick text").each(function(){var a=this.getBBox();bb?20:b}function Ab(){zi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),zi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),zi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return ff.min(Object.keys(i).map(function(a){return ff.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(fg.length>0)for(g=Nc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return ff.max(Object.keys(i).map(function(a){return ff.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?ch:Vg,n="y2"===c?bh:Ug,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?dh:Wg,r=kd()&⋙return 0===l.length?"y2"===c?Uf.domain():Tf.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=ld(o,p),j=$b(Tf.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&$g&&(f=b($g.top)?$g.top:e,g=b($g.bottom)?$g.bottom:e),"y2"===c&&hh&&(f=b(hh.top)?hh.top:e,g=b(hh.bottom)?hh.bottom:e),Pd(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Ei),c=$b(Sf.domain());return a||0===c?1:b/c}function Wb(a){return Qg?Qg:ff.min(a,function(a){return ff.min(a.values,function(a){return a.x})})}function Xb(a){return Pg?Pg:ff.max(a,function(a){return ff.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return Xh?d=0:Pd(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=Wh?new Date(c.getTime()-e):c-e,g=Wh?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return ag&&a===ag||ie(bg)&&je(bg,a)}function fc(a){return!ec(a)}function gc(a){return ag?ag:ie(bg)?bg[a]:null}function hc(a,b){var c,d=b&&ie(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=gf.data.xs[b])}),c}function ic(a,b){return a in gf.data.xs&&gf.data.xs[a]&&gf.data.xs[a][b]?gf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){bg[b]=a[b]})}function kc(a){return 1===ff.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=eg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),gf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=Wh?a?a instanceof Date?a:de(a):de(ic(b,c)):Yh&&!Xh?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?gf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):ag?(d=Object.keys(gf.data.xs),gf.data.xs[c]=d.length>0?gf.data.xs[d[0]]:void 0):ie(bg)&&(gf.data.xs[c]=hc(f,gf.data.targets)):gf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!gf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=dg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return Yh&&Xh&&0===c&&g&&(0===e&&(Ig=[]),Ig.push(g)),("undefined"==typeof a[b]||gf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),hg&&Nd(xc(c).filter(function(a){return!(a in ig)}),hg),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function tc(a){return a>0&&gf.data.targets[0].values[a-1]?gf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?gf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?gf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(gf.data.targets)}function zc(a,b){var c,d=xc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(Wh?new Date(h):h);i.push(d)}return i}function Gc(a){ei=ei.concat(a)}function Hc(a){ei=ei.filter(function(b){return a.indexOf(b)<0})}function Ic(a){fi=fi.concat(a)}function Jc(a){fi=fi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(td(a,f))),a[g].x&&(e=e.concat(td(a,g))),wd(e,b)):ud(a,b,f,g)}function vd(a,b){var c;return c=a.map(function(a){return ud(a.values,b)}),wd(c,b)}function wd(a,b){var c,d;return a.forEach(function(a){var e=ke(a,b);(c>e||!c)&&(c=e,d=a)}),d}function xd(a,b){return ff.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function yd(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 zd(){return kg&&"desc"===kg.toLowerCase()}function Ad(){return kg&&"asc"===kg.toLowerCase()}function Bd(a){var b=Ad(),c=zd();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 kg&&a.sort(kg),a}function Cd(a,c){var d,e,f,g,h,i,j,k=Td(gf.data.targets),l=k?nd:md,m=a.filter(function(a){return a&&b(a.value)});Jh&&0!==m.length&&(Ci.html(Mh(a,$(),l,ci)).style("display","block"),d=Ci.property("offsetWidth"),e=Ci.property("offsetHeight"),k?(g=xf/2+c[0],i=zf/2+c[1]+20):(Gg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Sf(m[0].x)+20):(f=q(),g=f+t()+Sf(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Ci.style("top",i+"px").style("left",g+"px"))}function Dd(){Ci.style("display","none")}function Ed(a){var c=a.filter(function(a){return a&&b(a.value)});Jh&&(Qd(gf.data.targets)||Td(gf.data.targets)||zi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Gg?"y1":"x1",pd).attr(Gg?"y2":"x2",pd))}function Fd(){zi.select("line."+f.xgridFocus).style("visibility","hidden")}function Gd(a){return a.x||0===a.x?Sf(a.x):null}function Hd(a){return V(a.id)(a.value)}function Id(){var a,b,d={},e=0;return Dc(Ac(Wd)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Md(a,b){return vh?vh:b?2*a.tickOffset()*wh/b:0}function Nd(a,b){yc(a).forEach(function(a){Gi[a]=b===ig[a],ig[a]=b})}function Od(a,b){var c=!1;return a.forEach(function(a){ig[a.id]===b&&(c=!0),a.id in ig||"line"!==b||(c=!0)}),c}function Pd(a){return Od(a,"bar")}function Qd(a){return Od(a,"scatter")}function Rd(a){return Od(a,"pie")}function Sd(a){return Od(a,"donut")}function Td(a){return Rd(a)||Sd(a)}function Ud(a){var b="string"==typeof a?a:a.id;return!(b in ig)||"line"===ig[b]||"spline"===ig[b]||"area"===ig[b]||"area-spline"===ig[b]}function Vd(a){var b="string"==typeof a?a:a.id;return"spline"===ig[b]||"area-spline"===ig[b]}function Wd(a){var b="string"==typeof a?a:a.id;return"bar"===ig[b]}function Xd(a){var b="string"==typeof a?a:a.id;return"scatter"===ig[b]}function Yd(a){var b="string"==typeof a?a:a.id;return"pie"===ig[b]}function Zd(a){var b="string"==typeof a?a:a.id;return"donut"===ig[b]}function $d(a){return Yd(a)||Zd(a)}function _d(a){return Wd(a)?a.values:[]}function ae(a){return Ud(a)||Xd(a)?a.values:[]}function be(a){return Wd(a)||Ud(a)?a.values:[]}function ce(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function de(b){var c;if(!b)throw Error(b+" can not be parsed as d3.time with format "+cg+". Maybe 'x' of this data is not defined. See data.x or data.xs option.");try{c=cg?ff.time.format(cg).parse(b):new Date(b)}catch(d){c=void 0}return c||a.console.error("Failed to parse x '"+b+"' to Date with format "+cg),c}function ee(a,b){var c=ff.mouse(a),d=ff.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function je(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ke(a,b){var c="y"===Z(a.id)?Tf:Uf,d=Gg?1:0,e=Gg?0:1;return Math.pow(Sf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function le(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function me(a,b,c){vg(b,a.node()),zi.select("."+f.selectedCircles+bd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Gg?Hd:Gd).attr("cy",Gg?Gd:Hd).attr("stroke",function(){return ci(b)}).attr("r",1.4*uh).transition().duration(100).attr("r",uh)}function ne(a,b,c){wg(b,a.node()),zi.select("."+f.selectedCircles+bd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function oe(a,b,c,d){a?me(b,c,d):ne(b,c,d)}function pe(a,b){vg(b,a.node()),a.transition().duration(100).style("fill",function(){return ff.rgb(ci(b)).darker(1)})}function qe(a,b){wg(b,a.node()),a.transition().duration(100).style("fill",function(){return ci(b)})}function re(a,b,c,d){a?pe(b,c,d):qe(b,c,d)}function se(a){return a.filter(function(a){return b(a.value)})}function te(a,c){return(c?zi.selectAll("."+f.circles+bd(c)):zi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ue(a,b){te(a,b).classed(f.EXPANDED,!0).attr("r",th)}function ve(a){te(a).filter(function(){return ff.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",qh)}function we(a){return zi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function xe(a){we(a).classed(f.EXPANDED,!0)}function ye(a){we(a).classed(f.EXPANDED,!1)}function ze(a,b){var c=De(a,b);return function(a,b){var d=c(a,b),e=Gg?1:0,f=Gg?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 Ae(a,b){var c=De(a,!1),d=b?Be:Ce;return function(a,b){return d(c(a,b),a,this)}}function Be(a,b){var c;return Gg?(c=Wd(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ce(a,b,c){var d=c.getBBox();return Gg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:Wd(b)?-3:-6)}function De(a,b){var c=a.__max__+1,d=Md(Yf,c),e=Jd(d,c,a,!!b),f=Kd(!!b),g=Ld(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Gg&&(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 Ee(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 Fe(b){var c,d,e;if(Di=ff.select(jf),Di.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Di.html(""),Di.classed("c3",!0),gf.data.xs={},gf.data.targets=rc(b),n(),R(),Sf.domain(ff.extent(Zb(gf.data.targets))),Tf.domain(Ub(gf.data.targets,"y")),Uf.domain(Ub(gf.data.targets,"y2")),Vf.domain(Sf.domain()),Wf.domain(Tf.domain()),Xf.domain(Uf.domain()),Ei=Sf.domain(),si.scale(Vf),of&&wi.scale(Sf),xi=Di.append("svg").attr("width",xf+uf.left+uf.right).attr("height",zf+uf.top+uf.bottom).on("mouseenter",rf).on("mouseleave",sf),yi=xi.append("defs"),yi.append("clipPath").attr("id",Qh).append("rect").attr("width",xf).attr("height",zf),yi.append("clipPath").attr("id",Rh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),yi.append("clipPath").attr("id",Sh).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),zi=xi.append("g").attr("transform",ki.main),Ai=zg?xi.append("g").attr("transform",ki.context):null,Bi=xi.append("g").attr("transform",ki.legend),Cg||(Bi.style("visibility","hidden"),fi=xc(gf.data.targets)),Ci=ff.select(jf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),af(xc(gf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),zi.append("g").attr("class",f.axisX).attr("clip-path",Gg?"":Uh).attr("transform",ki.x).append("text").attr("class",f.axisXLabel).attr("transform",Gg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),Tg&&zi.append("g").attr("class",f.axisY).attr("clip-path",Gg?Vh:"").attr("transform",ki.y).append("text").attr("class",f.axisYLabel).attr("transform",Gg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),ah&&zi.append("g").attr("class",f.axisY2).attr("transform",ki.y2).append("text").attr("class",f.axisY2Label).attr("transform",Gg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=zi.append("g").attr("clip-path",Th).attr("class",f.grid),jh&&d.append("g").attr("class",f.xgrids),ie(lh)&&d.append("g").attr("class",f.xgridLines),rh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),mh&&d.append("g").attr("class",f.ygrids),ie(nh)&&d.append("g").attr("class",f.ygridLines),zi.append("g").attr("clip-path",Th).attr("class",f.regions),zi.append("g").attr("clip-path",Th).attr("class",f.chart),c=zi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",of?Gg?"ns-resize":"ew-resize":null),zi.select("."+f.chart).append("g").attr("class",f.chartBars),zi.select("."+f.chart).append("g").attr("class",f.chartLines),zi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",ki.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),zi.select("."+f.chart).append("g").attr("class",f.chartTexts),of&&zi.insert("rect",qf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",xf).attr("height",zf).style("opacity",0).style("cursor",Gg?"ns-resize":"ew-resize").call(wi).on("dblclick.zoom",null),Rg&&si.extent("function"!=typeof Rg?Rg:Rg(Zb())),zg&&(Ai.append("g").attr("clip-path",Th).attr("class",f.chart),Ai.select("."+f.chart).append("g").attr("class",f.chartBars),Ai.select("."+f.chart).append("g").attr("class",f.chartLines),Ai.append("g").attr("clip-path",Th).attr("class",f.brush).call(si).selectAll("rect").attr(Gg?"width":"height",Gg?yf:Af),Ai.append("g").attr("class",f.axisX).attr("transform",ki.subx).attr("clip-path",Gg?"":Uh)),Se(gf.data.targets),Gg?zi.select("."+f.axisX).style("opacity",0).call(Yf):(zi.select("."+f.axisY).style("opacity",0).call(Zf),zi.select("."+f.axisY2).style("opacity",0).call($f)),Me({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Nh){if(Wh&&"string"==typeof Oh){for(Oh=de(Oh),e=0;e0){d=[];for(var g in eg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=yd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=re,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 Ke(a){Td(gf.data.targets)||og&&(Zh=a,zi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),$h=!0,xg())}function Le(){Td(gf.data.targets)||og&&(zi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),zi.selectAll("."+f.shape).classed(f.INCLUDED,!1),$h=!1,yg())}function Me(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Id(),U=Td(gf.data.targets),V=Dc(gf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?tf:0,O=B?N:0,P=C?N:0,H&&Cg&&af(xc(gf.data.targets),a),G&&(Sf.domain(ff.extent(Zb(V))),Ei=Sf.domain(),of&&wi.scale(Sf).updateScaleExtent(),Vf.domain(Sf.domain()),si.scale(Vf)),F&&(Sf.domain(si.empty()?Ei:si.extent()),of&&wi.scale(Sf).updateScaleExtent()),Tf.domain(Ub(V,"y")),Uf.domain(Ub(V,"y2")),Qd(V)||(Q=Fc(Ec(V)).sort(),Yf.tickValues(Q),_f.tickValues(Q)),c=zi.select("."+f.axisX).style("opacity",U?0:1),(Gg||D)&&(c=c.transition().duration(P)),c.call(Yf),e=zi.select("."+f.axisY).style("opacity",U?0:1),(!Gg||D)&&(e=e.transition().duration(P)),e.call(Zf),zi.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call($f),F&&Lg&&Q){for(R=1;R=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=Sf.ticks(10);g=zi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Gg?0:function(a){return Sf(a)-Yf.tickOffset()}).attr("x2",Gg?xf:function(a){return Sf(a)-Yf.tickOffset()}).attr("y1",Gg?function(a){return Sf(a)-Yf.tickOffset()}:uf.top).attr("y2",Gg?function(a){return Sf(a)-Yf.tickOffset()}:zf).style("opacity",function(){return+ff.select(this).attr(Gg?"y1":"x1")===(Gg?zf:0)?0:1}),g.exit().remove()}ie(lh)&&(i=zi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(lh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Gg?"":"rotate(-90)").attr("dx",Gg?0:-uf.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Gg?0:qd).attr("x2",Gg?xf:qd).attr("y1",Gg?qd:uf.top).attr("y2",Gg?qd:zf).style("opacity",1),i.select("text").transition().duration(N).attr("x",Gg?xf:0).attr("y",qd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&mh&&(k=zi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Tf.ticks(oh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Gg?Tf:0).attr("x2",Gg?Tf:xf).attr("y1",Gg?0:Tf).attr("y2",Gg?zf:Tf),k.exit().remove()),y&&ie(nh)&&(l=zi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(nh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Gg?"rotate(-90)":"").attr("dx",Gg?0:-uf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Gg?rd:0).attr("x2",Gg?rd:xf).attr("y1",Gg?0:rd).attr("y2",Gg?zf:rd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Gg?0:xf).attr("y",rd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=zi.selectAll("."+f.bars).selectAll("."+f.bar).data(_d),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ci(a)}).attr("class",Xc),p.style("opacity",gd).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=zi.selectAll("."+f.texts).selectAll("."+f.text).data(be),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Gg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return od(a.id)(a.value)}).style("fill-opacity",hd).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",jd),r.exit().transition().duration(O).style("fill-opacity",0).remove(),zi.selectAll("."+f.line).style("opacity",gd).transition().duration(N).attr("d",ti).style("opacity",1),zi.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",ui).style("opacity",Fi),n=zi.selectAll("."+f.circles).selectAll("."+f.circle).data(ae),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",qh),n.style("opacity",gd).transition().duration(N).style("opacity",id).attr("cx",Gg?Hd:Gd).attr("cy",Gg?Gd:Hd),n.exit().remove(),zi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=ff.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),zi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&$d(a.data)?1:0}),zi.select("."+f.chartArcsTitle).style("opacity",Sd(gf.data.targets)?1:0),zg&&(null!==ff.event&&"zoom"===ff.event.type&&si.extent(Sf.orgDomain()).update(),z&&(Ai.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(_f),si.empty()||si.extent(Sf.orgDomain()).update(),J=ze(T,!0),s=Ai.selectAll("."+f.bars).selectAll("."+f.bar).data(_d),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ci(a)}).attr("class",Xc),s.style("opacity",gd).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Ai.selectAll("."+f.line).style("opacity",gd).transition().duration(N).attr("d",vi).style("opacity",1))),zi.selectAll("."+f.selectedCircles).filter(function(a){return Wd(a)}).selectAll("circle").remove(),zi.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Gg?Hd:Gd).attr("cy",Gg?Gd:Hd),t=zi.select("."+f.eventRects),ie(bg)&&!kc(bg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=zi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),He(u.enter()),u.attr("x",0).attr("y",0).attr("width",xf).attr("height",zf)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Yh&&!Xh?(x=function(a,b){var c=tc(b),d=uc(b),e=gf.data.xs[a.id][b];return(Sf(d?d:e+50)-Sf(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=gf.data.xs[a.id][b];return(Sf(d)+Sf(c?c:d-50))/2}):(x=L(),w=function(a){return Sf(a.x)-x/2}),v=wc(),zi.select("."+f.eventRects).datum(v?v.values:[]),u=zi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ge(u.enter()),u.attr("class",ad).attr("x",Gg?0:w).attr("y",Gg?w:0).attr("width",Gg?xf:x).attr("height",Gg?x:zf),u.exit().remove()),q=zi.select("."+f.regions).selectAll("rect."+f.region).data(Ih),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Gg?0:cc).attr("y",Gg?cc:uf.top).attr("width",Gg?xf:dc).attr("height",Gg?dc:zf).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),xc(gf.data.targets).forEach(function(a){Gi[a]=!0})}}function Ne(){Me({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Oe(){return"mousemove"===ff.event.sourceEvent.type&&wi.altDomain?(Sf.domain(wi.altDomain),void wi.scale(Sf).updateScaleExtent()):(Xh&&Sf.orgDomain()[0]===Ei[0]&&Sf.domain([Ei[0]-1e-10,Sf.orgDomain()[1]]),Me({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===ff.event.sourceEvent.type&&(_h=!0)))}function Pe(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Qe(){xi.attr("width",Bf).attr("height",Cf),xi.select("#"+Qh).select("rect").attr("width",xf).attr("height",zf),xi.select("#"+Rh).select("rect").attr("width",H),xi.select("#"+Sh).select("rect").attr("width",J),xi.select("."+f.zoomRect).attr("width",xf).attr("height",zf)}function Re(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Qe(),m(a.withTransition),Me(a)}function Se(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=zi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a),j=i.enter().append("g").attr("class",function(a){return f.chartText+Pc(f.target,a.id)}).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ci(a)}),e=zi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),d=e.enter().append("g").attr("class",function(a){return f.chartBar+Pc(f.target,a.id)}).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ci(a)}).style("stroke","none").style("cursor",function(a){return qg(a)?"pointer":null}),c=zi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),b=c.enter().append("g").attr("class",function(a){return f.chartLine+Pc(f.target,a.id)}).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ci(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Fi=+ff.select(this).style("opacity"),0}).style("fill",function(a){return ci(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ci(a)}).style("cursor",function(a){return qg(a)?"pointer":null}),a.forEach(function(a){zi.selectAll("."+f.selectedCircles+bd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=zi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Jf(a)),g=h.enter().append("g").attr("class",function(a){return f.chartArc+Pc(f.target,a.data.id)}),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ci(a.data)}).style("cursor",function(a){return qg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),Xe(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Cd(c,ff.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),Ze(),Dd(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),zg&&(n=Ai.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),m=n.enter().append("g").attr("class",function(a){return f.chartBar+Pc(f.target,a.id)}),m.append("g").attr("class",Yc).style("fill",function(a){return ci(a)}),l=Ai.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),k=l.enter().append("g").attr("class",function(a){return f.chartLine+Pc(f.target,a.id)}),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ci(a)})),xi.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Te(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Nd(a.id,b.types[a.id]):Nd(a.id,b.type)}),gf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBBox(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=li?j:i,l=li?Q():P();return d&&(w=0,C=0,t=0,u=0),Cg&&!Cc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=li?u:t,void(Fg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,li?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Bi.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Eg?Eg(a):gf.toggle(a)}).on("mouseover",function(a){gf.focus(a)}).on("mouseout",function(){gf.revert()}),l.append("text").text(function(a){return d(eg[a])?eg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",li?g:-200).attr("y",li?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",li?h:-200).attr("y",li?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return ci(a)}).attr("x",li?g:-200).attr("y",li?-200:i).attr("width",10).attr("height",10),Bi.selectAll("text").data(a).text(function(a){return d(eg[a])?eg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Bi.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Bi.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Qe(),q&&m(p)}function bf(a){return zc(gf.data.targets,a.id)}function cf(a){return"data"in a&&zc(gf.data.targets,a.data.id)}function df(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 ef(a,b,c){var d=!Td(gf.data.targets);Nd(a,b),Re(c?c:{withTransitionForAxis:d})}var ff=a.d3?a.d3:a.require?a.require("d3"):void 0,gf={data:{},axis:{},legend:{}},hf={},jf=h(["bindto"],"#chart"),kf=h(["size","width"]),lf=h(["size","height"]),mf=h(["padding","left"]),nf=h(["padding","right"]),of=h(["zoom","enabled"],!1),pf=h(["zoom","extent"]),qf=h(["zoom","privileged"],!1),rf=h(["onenter"],function(){}),sf=h(["onleave"],function(){}),tf=h(["transition","duration"],350);g("data","data is required in config");var uf,vf,wf,xf,yf,zf,Af,Bf,Cf,Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag=h(["data","x"]),bg=h(["data","xs"],{}),cg=h(["data","x_format"]),dg=h(["data","id_converter"],function(a){return a}),eg=h(["data","names"],{}),fg=h(["data","groups"],[]),gg=h(["data","axes"],{}),hg=h(["data","type"]),ig=h(["data","types"],{}),jg=h(["data","labels"],{}),kg=h(["data","order"]),lg=h(["data","regions"],{}),mg=h(["data","color"]),ng=h(["data","colors"],{}),og=h(["data","selection","enabled"],!1),pg=h(["data","selection","grouped"],!1),qg=h(["data","selection","isselectable"],function(){return!0}),rg=h(["data","selection","multiple"],!0),sg=h(["data","onclick"],function(){}),tg=h(["data","onenter"],function(){}),ug=h(["data","onleave"],function(){}),vg=h(["data","onselected"],function(){}),wg=h(["data","onunselected"],function(){}),xg=h(["data","ondragstart"],function(){}),yg=h(["data","ondragend"],function(){}),zg=h(["subchart","show"],!1),Ag=zg?h(["subchart","size","height"],60):0,Bg=h(["color","pattern"],[]),Cg=h(["legend","show"],!0),Dg=h(["legend","position"],"bottom"),Eg=h(["legend","item","onclick"]),Fg=h(["legend","equally"],!1),Gg=h(["axis","rotated"],!1),Hg=h(["axis","x","type"],"indexed"),Ig=h(["axis","x","categories"],[]),Jg=h(["axis","x","tick","centered"],!1),Kg=h(["axis","x","tick","format"]),Lg=h(["axis","x","tick","culling"],{}),Mg=h(["axis","x","tick","culling","max"],"categorized"===Hg?1/0:10),Ng=h(["axis","x","tick","count"]),Og=h(["axis","x","tick","fit"],!1),Pg=h(["axis","x","max"]),Qg=h(["axis","x","min"]),Rg=h(["axis","x","default"]),Sg=h(["axis","x","label"],{}),Tg=h(["axis","y","show"],!0),Ug=h(["axis","y","max"]),Vg=h(["axis","y","min"]),Wg=h(["axis","y","center"]),Xg=h(["axis","y","label"],{}),Yg=h(["axis","y","inner"],!1),Zg=h(["axis","y","tick","format"]),$g=h(["axis","y","padding"],{}),_g=h(["axis","y","ticks"],10),ah=h(["axis","y2","show"],!1),bh=h(["axis","y2","max"]),ch=h(["axis","y2","min"]),dh=h(["axis","y2","center"]),eh=h(["axis","y2","label"],{}),fh=h(["axis","y2","inner"],!1),gh=h(["axis","y2","tick","format"]),hh=h(["axis","y2","padding"],{}),ih=h(["axis","y2","ticks"],10),jh=h(["grid","x","show"],!1),kh=h(["grid","x","type"],"tick"),lh=h(["grid","x","lines"],[]),mh=h(["grid","y","show"],!1),nh=h(["grid","y","lines"],[]),oh=h(["grid","y","ticks"],10),ph=h(["point","show"],!0),qh=ph?h(["point","r"],2.5):0,rh=h(["point","focus","line","enabled"],!0),sh=h(["point","focus","expand","enabled"],!0),th=h(["point","focus","expand","r"],sh?4:qh),uh=h(["point","focus","select","r"],8),vh=h(["bar","width"]),wh=h(["bar","width","ratio"],.6),xh=h(["pie","label","show"],!0),yh=h(["pie","label","format"]),zh=h(["pie","onclick"],function(){}),Ah=h(["pie","onmouseover"],function(){}),Bh=h(["pie","onmouseout"],function(){}),Ch=h(["donut","label","show"],!0),Dh=h(["donut","label","format"]),Eh=h(["donut","title"],""),Fh=h(["donut","onclick"],function(){}),Gh=h(["donut","onmouseover"],function(){}),Hh=h(["donut","onmouseout"],function(){}),Ih=h(["regions"],[]),Jh=h(["tooltip","show"],!0),Kh=h(["tooltip","format","title"]),Lh=h(["tooltip","format","value"]),Mh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Kh?Kh:b,l=Lh?Lh: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+""}),Nh=h(["tooltip","init","show"],!1),Oh=h(["tooltip","init","x"],0),Ph=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Qh=("string"==typeof jf?jf.replace("#",""):jf.id)+"-clip",Rh=Qh+"-xaxis",Sh=Qh+"-yaxis",Th=i(Qh),Uh=i(Uh),Vh=i(Vh),Wh="timeseries"===Hg,Xh="categorized"===Hg,Yh=!Wh&&(ag||ie(bg)),Zh=null,$h=!1,_h=!1,ai=!1,bi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ci=ce(ng,ie(Bg)?Bg:bi,mg),di=function(){var a=[[ff.time.format("%Y/%-m/%-d"),function(){return!0}],[ff.time.format("%-m/%-d"),function(a){return a.getMonth()}],[ff.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[ff.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[ff.time.format("%I %p"),function(a){return a.getHours()}],[ff.time.format("%I:%M"),function(a){return a.getMinutes()}],[ff.time.format(":%S"),function(a){return a.getSeconds()}],[ff.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)}}(),ei=[],fi=[],gi=Gg?"left":"bottom",hi=Gg?Yg?"top":"bottom":Yg?"right":"left",ii=Gg?fh?"bottom":"top":fh?"left":"right",ji=Gg?"left":"bottom",ki={main:function(){return"translate("+uf.left+","+uf.top+")"},context:function(){return"translate("+vf.left+","+vf.top+")"},legend:function(){return"translate("+wf.left+","+wf.top+")"},x:function(){return"translate(0,"+(Gg?0:zf)+")"},y:function(){return"translate(0,"+(Gg?zf:0)+")"},y2:function(){return"translate("+(Gg?0:xf)+","+(Gg?1:0)+")"},subx:function(){return"translate(0,"+(Gg?0:Af)+")"},arc:function(){return"translate("+xf/2+","+zf/2+")"}},li="right"===Dg,mi=0,ni=0,oi=0,pi=30,qi=30,ri=5;Jf=ff.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var si,ti=function(){var a=ff.svg.line().x(Gg?function(a){return V(a.id)(a.value)}:pd).y(Gg?pd:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=se(b.values);return Ud(b)?(a.interpolate(Vd(b)?"cardinal":"linear"),lg[b.id]?Ee(e,Sf,V(b.id),lg[b.id]):a(e)):(c=Sf(e[0].x),d=V(b.id)(e[0].value),Gg?"M "+d+" "+c:"M "+c+" "+d)}}(),ui=function(){var a;return a=Gg?ff.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(pd):ff.svg.area().x(pd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=se(b.values);return Od([b],"area")||Od([b],"area-spline")?(a.interpolate(Vd(b)?"cardinal":"linear"),a(e)):(c=e[0]?Sf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Gg?"M "+d+" "+c:"M "+c+" "+d)}}(),vi=function(){var a=ff.svg.line().x(Gg?function(a){return W(a.id)(a.value)}:sd).y(Gg?sd:function(a){return W(a.id)(a.value)});return function(b){var c=se(b.values);return Ud(b)?a(c):"M "+Vf(c[0].x)+" "+W(b.id)(c[0].value)}}(),wi=function(){};si=ff.svg.brush().on("brush",Ne),si.update=function(){return Ai&&Ai.select("."+f.brush).call(this),this},si.scale=function(a){return Gg?this.y(a):this.x(a)},of&&(wi=ff.behavior.zoom().on("zoomstart",function(){wi.altDomain=ff.event.sourceEvent.altKey?Sf.orgDomain():null}).on("zoom",of?Oe:null),wi.scale=function(a){return Gg?this.y(a):this.x(a)},wi.orgScaleExtent=function(){var a=pf?pf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},wi.updateScaleExtent=function(){var a=$b(Sf.orgDomain())/$b(Ei),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var xi,yi,zi,Ai,Bi,Ci,Di,Ei,Fi,Gi={};if(gf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=xi.selectAll(cd(a)),d=c.filter(bf),e=c.filter(cf);gf.revert(),gf.defocus(),b(d.classed(f.focused,!0)),b(e),Td(gf.data.targets)&&Kb(a,!0),Xe(a)},gf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=xi.selectAll(cd(a)),d=c.filter(bf),e=c.filter(cf);gf.revert(),b(d.classed(f.focused,!1)),b(e),Td(gf.data.targets)&&Lb(a),Ye(a)},gf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=xi.selectAll(cd(a)),d=c.filter(bf),e=c.filter(cf);b(d.classed(f.focused,!1)),b(e),Td(gf.data.targets)&&Lb(a),Ze()},gf.show=function(a,b){a=yc(a),b=b||{},Hc(a),xi.selectAll(dd(a)).transition().style("opacity",1),b.withLegend&&$e(a),Me({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},gf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),xi.selectAll(dd(a)).transition().style("opacity",0),b.withLegend&&_e(a),Me({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},gf.toggle=function(a){Bc(a)?gf.hide(a):gf.show(a)},gf.unzoom=function(){si.clear().update(),Me({withUpdateXDomain:!0})},gf.load=function(a){return a.xs&&jc(a.xs),"categories"in a&&Xh&&(Ig=a.categories,Yf.categories(Ig)),"cacheIds"in a&&_b(a.cacheIds)?void Te(bc(a.cacheIds),a.done):void("unload"in a?Ve(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ue(a)}):Ue(a))},gf.unload=function(a){Ve(yc(a),function(){Me({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},gf.selected=function(a){return ff.merge(zi.selectAll("."+f.shapes+bd(a)).selectAll("."+f.shape).filter(function(){return ff.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},gf.select=function(a,b,c){og&&zi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=ff.select(this),i="circle"===this.nodeName?me:pe,j="circle"===this.nodeName?ne:qe,k=pg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?qg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},gf.unselect=function(a,b){og&&zi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=ff.select(this),g="circle"===this.nodeName?ne:qe,h=pg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&qg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},gf.toLine=function(a){ef(a,"line")},gf.toSpline=function(a){ef(a,"spline")},gf.toBar=function(a){ef(a,"bar")},gf.toScatter=function(a){ef(a,"scatter")},gf.toArea=function(a){ef(a,"area")},gf.toAreaSpline=function(a){ef(a,"area-spline")},gf.toPie=function(a){ef(a,"pie",{withTransform:!0})},gf.toDonut=function(a){ef(a,"donut",{withTransform:!0})},gf.groups=function(a){return c(a)?fg:(fg=a,Me(),fg)},gf.xgrids=function(a){return a?(lh=a,Me(),lh):lh},gf.xgrids.add=function(a){return a?gf.xgrids(lh.concat(a)):void 0},gf.xgrids.remove=function(a){var b=df(a);return gf.xgrids(lh.filter(b))},gf.ygrids=function(a){return a?(nh=a,Me(),nh):nh},gf.ygrids.add=function(a){return a?gf.ygrids(nh.concat(a)):void 0},gf.ygrids.remove=function(a){var b=df(a);return gf.ygrids(nh.filter(b))},gf.regions=function(a){return c(a)?Ih:(Ih=a,Me(),Ih)},gf.regions.add=function(a){return c(a)?Ih:(Ih=Ih.concat(a),Me(),Ih)},gf.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;xi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Ih=Ih.filter(function(b){return b.classes.indexOf(a)<0})}),Ih},gf.data.get=function(a){var b=gf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},gf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},gf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){eg[b]=a[b]}),af(xc(gf.data.targets),{withTransition:!0}),eg):eg},gf.x=function(a){return arguments.length&&(mc(gf.data.targets,a),Me({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),gf.data.xs -},gf.xs=function(a){return arguments.length&&(nc(gf.data.targets,a),Me({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),gf.data.xs},gf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},gf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Ug=+a.y),b(a.y2)&&(bh=+a.y2)):Ug=bh=+a,Me())},gf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Vg=+a.y),b(a.y2)&&(ch=+a.y2)):Vg=ch=+a,Me())},gf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&gf.axis.max(a.max),"undefined"!=typeof a.min&&gf.axis.min(a.min))},gf.legend.show=function(a){Cg||(Cg=!0,Bi.style("visibility","visible")),$e(yc(a)),Me({withTransitionForHorizontalAxis:!1})},gf.legend.hide=function(a){Cg&&he(a)&&(Cg=!1,Bi.style("visibility","hidden")),_e(yc(a)),Me({withTransitionForHorizontalAxis:!1})},gf.resize=function(a){kf=a?a.width:null,lf=a?a.height:null,Re({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},gf.destroy=function(){gf.data.targets=void 0,gf.data.xs={},Di.html(""),a.onresize=null},"url"in e.data)ff.csv(e.data.url,function(a,b){Fe(b)});else if("rows"in e.data)Fe(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Fe(qc(e.data.columns))}return gf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file +!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.29"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",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;cyf&&(yf=0),0>Af&&(Af=0),wf={top:Ig?vf.top:Df-Cg-(ni?0:a),right:0/0,bottom:20+(ni?0:a),left:Ig?ri:vf.left},zf=Ig?vf.left-ri-si:yf,Bf=Ig?Af:Df-wf.top-wf.bottom,0>zf&&(zf=0),0>Bf&&(Bf=0),xf={top:ni?0:Df-a,right:0/0,bottom:0,left:ni?Cf-b:0},p(),ni&&Ud(hf.data.targets)&&(xf.left=yf/2+Ff)}function o(){Bi.select("line."+f.xgridFocus).attr("x1",Ig?0:-10).attr("x2",Ig?yf:-10).attr("y1",Ig?-10:vf.top).attr("y2",Ig?-10:Af)}function p(){Ff=Af/2,Ef=.95*Ff,Gf=Td(hf.data.targets)?.6*Ef:0}function q(){var a=Ig?f.axisX:f.axisY,b=gf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=gf.select(kf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return lf?lf:x()}function s(){var a=mf?mf:y();return a>0?a:320}function t(){return Ud(hf.data.targets)?0:nf?nf:Ig||!Vg||$g?1:v("y")}function u(){var a=1;return Ud(hf.data.targets)?0:of?of:ni?P()+(ch&&!Ig?v("y2"):a):ch?hh||Ig?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||Vg?"y2"!==a||ch?(gb(a).isInner?30:40)+("y2"===a?-10:0):ti:Eg&&!ni?10:1}function x(){return+gf.select(kf).style("width").replace("px","")}function y(){return+gf.select(kf).style("height").replace("px","")}function z(a){return a?-5:-(vf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Ig)}function C(){return A(!Ig)}function D(){return z(Ig)}function E(){return A(Ig)}function F(a){return a?yf+2+4:vf.left+20}function G(a){return a?80:Af+2}function H(){return F(!Ig)}function I(){return G(!Ig)}function J(){return F(Ig)}function K(){return G(Ig)}function L(){var a=Ig?Af:yf,b=vc(),c=Vb()*(Qd(hf.data.targets)?(b-(Zh?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){oi=a}function N(a){pi=a}function O(a){qi=a}function P(){return Eg?ni?pi*(oi+1):Cf:0}function Q(){return Eg?ni?Df:qi*(oi+1):0}function R(){var a,b=!Tf;Lf=Ig?1:0,Mf=Ig?Af:yf,Nf=Ig?0:Af,Of=Ig?yf:1,Pf=Lf,Qf=Mf,Rf=Ig?0:Bf,Sf=Ig?zf:1,Tf=T(Lf,Mf,b?void 0:Tf.domain(),function(){return Zf.tickOffset()}),Uf=U(Nf,Of),Vf=U(Nf,Of),Wf=T(Lf,Mf,Gi,function(a){return a%1?0:ag.tickOffset()}),Xf=U(Rf,Sf),Yf=U(Rf,Sf),a=$(),Zf=X(Tf,ii,a),ag=X(Wf,li,a),$f=Y(Uf,ji,_g,bh),_f=Y(Vf,ki,ih,kh),b||(ui.scale(Wf),pf&&yi.scale(Tf)),S()}function S(){Hf=Db(),If=Eb(),Jf=Eb(.98)}function T(a,b,e,f){var g=(Yh?gf.time.scale():gf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),Zh){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return gf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?Vf:Uf}function W(a){return"y2"===Z(a)?Yf:Xf}function X(a,b,c){var d=(Zh?Bb():gf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),Zh?d.tickCentered(Lg):d.tickOffset=function(){var a=Ig?Af:yf;return a*Vb()/vc()/2},Zh&&d.categories(Kg),d}function Y(a,b,c,d){return gf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in ig?ig[a]:"y"}function $(){var a=Yh?fi:Zh?Oc:function(a){return 0>a?a.toFixed(0):a};return Mg&&("function"==typeof Mg?a=Mg:Yh&&(a=function(a){return gf.time.format(Mg)(a)})),a}function _(a){var b;return"y"===a?b=Zg:"y2"===a?b=gh:"x"===a&&(b=Ug),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Zg=b:"y2"===a?gh=b:"x"===a&&(Ug=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Ig?"inner-top":"inner-right")}function eb(){return cb("y",Ig?"inner-right":"inner-top")}function fb(){return cb("y2",Ig?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?yf/2:yf:b.isBottom?-Af:b.isMiddle?-Af/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Ig,db())}function ob(){return kb(Ig,eb())}function pb(){return kb(Ig,fb())}function qb(){return lb(!Ig,db())}function rb(){return lb(Ig,eb())}function sb(){return lb(Ig,fb())}function tb(){var a=db();return Ig?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Ig?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Ig?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Ig,db())}function xb(){return mb(Ig,eb())}function yb(){return mb(Ig,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return gf.selectAll("."+c+" .tick text").each(function(){var a=this.getBBox();bb?20:b}function Ab(){Bi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Bi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Bi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return gf.min(Object.keys(i).map(function(a){return gf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(hg.length>0)for(g=Nc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return gf.max(Object.keys(i).map(function(a){return gf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?eh:Xg,n="y2"===c?dh:Wg,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?fh:Yg,r=ld()&&Ig;return 0===l.length?"y2"===c?Vf.domain():Uf.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=md(o,p),j=$b(Uf.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&ah&&(f=b(ah.top)?ah.top:e,g=b(ah.bottom)?ah.bottom:e),"y2"===c&&jh&&(f=b(jh.top)?jh.top:e,g=b(jh.bottom)?jh.bottom:e),Qd(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Gi),c=$b(Tf.domain());return a||0===c?1:b/c}function Wb(a){return Sg?Sg:gf.min(a,function(a){return gf.min(a.values,function(a){return a.x})})}function Xb(a){return Rg?Rg:gf.max(a,function(a){return gf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return Zh?d=0:Qd(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=Yh?new Date(c.getTime()-e):c-e,g=Yh?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return bg&&a===bg||je(cg)&&ke(cg,a)}function fc(a){return!ec(a)}function gc(a){return bg?bg:je(cg)?cg[a]:null}function hc(a,b){var c,d=b&&je(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=hf.data.xs[b])}),c}function ic(a,b){return a in hf.data.xs&&hf.data.xs[a]&&hf.data.xs[a][b]?hf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){cg[b]=a[b]})}function kc(a){return 1===gf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=fg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),hf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=Yh?a?a instanceof Date?a:ee(a):ee(ic(b,c)):$h&&!Zh?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?hf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):bg?(d=Object.keys(hf.data.xs),hf.data.xs[c]=d.length>0?hf.data.xs[d[0]]:void 0):je(cg)&&(hf.data.xs[c]=hc(f,hf.data.targets)):hf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!hf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=eg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return $h&&Zh&&0===c&&g&&(0===e&&(Kg=[]),Kg.push(g)),("undefined"==typeof a[b]||hf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),jg&&Od(xc(c).filter(function(a){return!(a in kg)}),jg),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function tc(a){return a>0&&hf.data.targets[0].values[a-1]?hf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?hf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?hf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(hf.data.targets)}function zc(a,b){var c,d=xc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(Yh?new Date(h):h);i.push(d)}return i}function Gc(a){gi=gi.concat(a)}function Hc(a){gi=gi.filter(function(b){return a.indexOf(b)<0})}function Ic(a){hi=hi.concat(a)}function Jc(a){hi=hi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(ud(a,f))),a[g].x&&(e=e.concat(ud(a,g))),xd(e,b)):vd(a,b,f,g)}function wd(a,b){var c;return c=a.map(function(a){return vd(a.values,b)}),xd(c,b)}function xd(a,b){var c,d;return a.forEach(function(a){var e=le(a,b);(c>e||!c)&&(c=e,d=a)}),d}function yd(a,b){return gf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function zd(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 Ad(){return mg&&"desc"===mg.toLowerCase()}function Bd(){return mg&&"asc"===mg.toLowerCase()}function Cd(a){var b=Bd(),c=Ad();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 mg&&a.sort(mg),a}function Dd(a,c){var d,e,f,g,h,i,j,k=Ud(hf.data.targets),l=k?od:nd,m=a.filter(function(a){return a&&b(a.value)});Lh&&0!==m.length&&(Ei.html(Oh(a,$(),l,ei)).style("display","block"),d=Ei.property("offsetWidth"),e=Ei.property("offsetHeight"),k?(g=yf/2+c[0],i=Af/2+c[1]+20):(Ig?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Tf(m[0].x)+20):(f=q(),g=f+t()+Tf(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Ei.style("top",i+"px").style("left",g+"px"))}function Ed(){Ei.style("display","none")}function Fd(a){var c=a.filter(function(a){return a&&b(a.value)});Lh&&(Rd(hf.data.targets)||Ud(hf.data.targets)||Bi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Ig?"y1":"x1",qd).attr(Ig?"y2":"x2",qd))}function Gd(){Bi.select("line."+f.xgridFocus).style("visibility","hidden")}function Hd(a){return a.x||0===a.x?Tf(a.x):null}function Id(a){return V(a.id)(a.value)}function Jd(){var a,b,d={},e=0;return Dc(Ac(Xd)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Nd(a,b){return xh?xh:b?2*a.tickOffset()*yh/b:0}function Od(a,b){yc(a).forEach(function(a){Ii[a]=b===kg[a],kg[a]=b})}function Pd(a,b){var c=!1;return a.forEach(function(a){kg[a.id]===b&&(c=!0),a.id in kg||"line"!==b||(c=!0)}),c}function Qd(a){return Pd(a,"bar")}function Rd(a){return Pd(a,"scatter")}function Sd(a){return Pd(a,"pie")}function Td(a){return Pd(a,"donut")}function Ud(a){return Sd(a)||Td(a)}function Vd(a){var b="string"==typeof a?a:a.id;return!(b in kg)||"line"===kg[b]||"spline"===kg[b]||"area"===kg[b]||"area-spline"===kg[b]}function Wd(a){var b="string"==typeof a?a:a.id;return"spline"===kg[b]||"area-spline"===kg[b]}function Xd(a){var b="string"==typeof a?a:a.id;return"bar"===kg[b]}function Yd(a){var b="string"==typeof a?a:a.id;return"scatter"===kg[b]}function Zd(a){var b="string"==typeof a?a:a.id;return"pie"===kg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"donut"===kg[b]}function _d(a){return Zd(a)||$d(a)}function ae(a){return Xd(a)?a.values:[]}function be(a){return Vd(a)||Yd(a)?a.values:[]}function ce(a){return Xd(a)||Vd(a)?a.values:[]}function de(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ee(b){var c;if(!b)throw Error(b+" can not be parsed as d3.time with format "+dg+". Maybe 'x' of this data is not defined. See data.x or data.xs option.");try{c=dg?gf.time.format(dg).parse(b):new Date(b)}catch(d){c=void 0}return c||a.console.error("Failed to parse x '"+b+"' to Date with format "+dg),c}function fe(a,b){var c=gf.mouse(a),d=gf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function ke(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function le(a,b){var c="y"===Z(a.id)?Uf:Vf,d=Ig?1:0,e=Ig?0:1;return Math.pow(Tf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function me(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function ne(a,b,c){xg(b,a.node()),Bi.select("."+f.selectedCircles+cd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Ig?Id:Hd).attr("cy",Ig?Hd:Id).attr("stroke",function(){return ei(b)}).attr("r",1.4*wh).transition().duration(100).attr("r",wh)}function oe(a,b,c){yg(b,a.node()),Bi.select("."+f.selectedCircles+cd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function pe(a,b,c,d){a?ne(b,c,d):oe(b,c,d)}function qe(a,b){xg(b,a.node()),a.transition().duration(100).style("fill",function(){return gf.rgb(ei(b)).darker(1)})}function re(a,b){yg(b,a.node()),a.transition().duration(100).style("fill",function(){return ei(b)})}function se(a,b,c,d){a?qe(b,c,d):re(b,c,d)}function te(a){return a.filter(function(a){return b(a.value)})}function ue(a,c){return(c?Bi.selectAll("."+f.circles+cd(c)):Bi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ve(a,b){ue(a,b).classed(f.EXPANDED,!0).attr("r",vh)}function we(a){ue(a).filter(function(){return gf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",sh)}function xe(a){return Bi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function ye(a){xe(a).classed(f.EXPANDED,!0)}function ze(a){xe(a).classed(f.EXPANDED,!1)}function Ae(a,b){var c=Ee(a,b);return function(a,b){var d=c(a,b),e=Ig?1:0,f=Ig?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 Be(a,b){var c=Ee(a,!1),d=b?Ce:De;return function(a,b){return d(c(a,b),a,this)}}function Ce(a,b){var c;return Ig?(c=Xd(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function De(a,b,c){var d=c.getBBox();return Ig?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:Xd(b)?-3:-6)}function Ee(a,b){var c=a.__max__+1,d=Nd(Zf,c),e=Kd(d,c,a,!!b),f=Ld(!!b),g=Md(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Ig&&(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 Fe(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 Ge(b){var c,d,e;if(Fi=gf.select(kf),Fi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Fi.html(""),Fi.classed("c3",!0),hf.data.xs={},hf.data.targets=rc(b),n(),R(),Tf.domain(gf.extent(Zb(hf.data.targets))),Uf.domain(Ub(hf.data.targets,"y")),Vf.domain(Ub(hf.data.targets,"y2")),Wf.domain(Tf.domain()),Xf.domain(Uf.domain()),Yf.domain(Vf.domain()),Gi=Tf.domain(),ui.scale(Wf),pf&&yi.scale(Tf),zi=Fi.append("svg").attr("width",yf+vf.left+vf.right).attr("height",Af+vf.top+vf.bottom).on("mouseenter",sf).on("mouseleave",tf),Ai=zi.append("defs"),Ai.append("clipPath").attr("id",Sh).append("rect").attr("width",yf).attr("height",Af),Ai.append("clipPath").attr("id",Th).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Ai.append("clipPath").attr("id",Uh).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Bi=zi.append("g").attr("transform",mi.main),Ci=Bg?zi.append("g").attr("transform",mi.context):null,Di=zi.append("g").attr("transform",mi.legend),Eg||(Di.style("visibility","hidden"),hi=xc(hf.data.targets)),Ei=gf.select(kf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),bf(xc(hf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Bi.append("g").attr("class",f.axisX).attr("clip-path",Ig?"":Wh).attr("transform",mi.x).append("text").attr("class",f.axisXLabel).attr("transform",Ig?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),Vg&&Bi.append("g").attr("class",f.axisY).attr("clip-path",Ig?Xh:"").attr("transform",mi.y).append("text").attr("class",f.axisYLabel).attr("transform",Ig?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),ch&&Bi.append("g").attr("class",f.axisY2).attr("transform",mi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Ig?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Bi.append("g").attr("clip-path",Vh).attr("class",f.grid),lh&&d.append("g").attr("class",f.xgrids),je(nh)&&d.append("g").attr("class",f.xgridLines),th&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),oh&&d.append("g").attr("class",f.ygrids),je(ph)&&d.append("g").attr("class",f.ygridLines),Bi.append("g").attr("clip-path",Vh).attr("class",f.regions),Bi.append("g").attr("clip-path",Vh).attr("class",f.chart),c=Bi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",pf?Ig?"ns-resize":"ew-resize":null),Bi.select("."+f.chart).append("g").attr("class",f.chartBars),Bi.select("."+f.chart).append("g").attr("class",f.chartLines),Bi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",mi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Bi.select("."+f.chart).append("g").attr("class",f.chartTexts),pf&&Bi.insert("rect",rf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",yf).attr("height",Af).style("opacity",0).style("cursor",Ig?"ns-resize":"ew-resize").call(yi).on("dblclick.zoom",null),Tg&&ui.extent("function"!=typeof Tg?Tg:Tg(Zb())),Bg&&(Ci.append("g").attr("clip-path",Vh).attr("class",f.chart),Ci.select("."+f.chart).append("g").attr("class",f.chartBars),Ci.select("."+f.chart).append("g").attr("class",f.chartLines),Ci.append("g").attr("clip-path",Vh).attr("class",f.brush).call(ui).selectAll("rect").attr(Ig?"width":"height",Ig?zf:Bf),Ci.append("g").attr("class",f.axisX).attr("transform",mi.subx).attr("clip-path",Ig?"":Wh)),Te(hf.data.targets),Ig?Bi.select("."+f.axisX).style("opacity",0).call(Zf):(Bi.select("."+f.axisY).style("opacity",0).call($f),Bi.select("."+f.axisY2).style("opacity",0).call(_f)),Ne({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Ph){if(Yh&&"string"==typeof Qh){for(Qh=ee(Qh),e=0;e0){d=[];for(var g in fg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=zd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=se,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 Le(a){Ud(hf.data.targets)||qg&&(_h=a,Bi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),ai=!0,zg())}function Me(){Ud(hf.data.targets)||qg&&(Bi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Bi.selectAll("."+f.shape).classed(f.INCLUDED,!1),ai=!1,Ag())}function Ne(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Jd(),U=Ud(hf.data.targets),V=Dc(hf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?uf:0,O=B?N:0,P=C?N:0,H&&Eg&&bf(xc(hf.data.targets),a),G&&(Tf.domain(gf.extent(Zb(V))),Gi=Tf.domain(),pf&&yi.scale(Tf).updateScaleExtent(),Wf.domain(Tf.domain()),ui.scale(Wf)),F&&(Tf.domain(ui.empty()?Gi:ui.extent()),pf&&yi.scale(Tf).updateScaleExtent()),Uf.domain(Ub(V,"y")),Vf.domain(Ub(V,"y2")),Rd(V)||(Q=Fc(Ec(V)).sort(),Zf.tickValues(Q),ag.tickValues(Q)),c=Bi.select("."+f.axisX).style("opacity",U?0:1),(Ig||D)&&(c=c.transition().duration(P)),c.call(Zf),e=Bi.select("."+f.axisY).style("opacity",U?0:1),(!Ig||D)&&(e=e.transition().duration(P)),e.call($f),Bi.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(_f),F&&Ng&&Q){for(R=1;R=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=Tf.ticks(10);g=Bi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Ig?0:function(a){return Tf(a)-Zf.tickOffset()}).attr("x2",Ig?yf:function(a){return Tf(a)-Zf.tickOffset()}).attr("y1",Ig?function(a){return Tf(a)-Zf.tickOffset()}:vf.top).attr("y2",Ig?function(a){return Tf(a)-Zf.tickOffset()}:Af).style("opacity",function(){return+gf.select(this).attr(Ig?"y1":"x1")===(Ig?Af:0)?0:1}),g.exit().remove()}je(nh)&&(i=Bi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(nh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Ig?"":"rotate(-90)").attr("dx",Ig?0:-vf.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Ig?0:rd).attr("x2",Ig?yf:rd).attr("y1",Ig?rd:vf.top).attr("y2",Ig?rd:Af).style("opacity",1),i.select("text").transition().duration(N).attr("x",Ig?yf:0).attr("y",rd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&oh&&(k=Bi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Uf.ticks(qh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Ig?Uf:0).attr("x2",Ig?Uf:yf).attr("y1",Ig?0:Uf).attr("y2",Ig?Af:Uf),k.exit().remove()),y&&je(ph)&&(l=Bi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(ph),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Ig?"rotate(-90)":"").attr("dx",Ig?0:-vf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Ig?sd:0).attr("x2",Ig?sd:yf).attr("y1",Ig?0:sd).attr("y2",Ig?Af:sd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Ig?0:yf).attr("y",sd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Bi.selectAll("."+f.bars).selectAll("."+f.bar).data(ae),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ei(a)}).attr("class",Xc),p.style("opacity",hd).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Bi.selectAll("."+f.texts).selectAll("."+f.text).data(ce),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Ig?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return pd(a.id)(a.value)}).style("fill-opacity",id).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",kd),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Bi.selectAll("."+f.line).style("opacity",hd).transition().duration(N).attr("d",vi).style("opacity",1),Bi.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",wi).style("opacity",Hi),n=Bi.selectAll("."+f.circles).selectAll("."+f.circle).data(be),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",sh),n.style("opacity",hd).transition().duration(N).style("opacity",jd).attr("cx",Ig?Id:Hd).attr("cy",Ig?Hd:Id),n.exit().remove(),Bi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=gf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Bi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&_d(a.data)?1:0}),Bi.select("."+f.chartArcsTitle).style("opacity",Td(hf.data.targets)?1:0),Bg&&(null!==gf.event&&"zoom"===gf.event.type&&ui.extent(Tf.orgDomain()).update(),z&&(Ci.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(ag),ui.empty()||ui.extent(Tf.orgDomain()).update(),J=Ae(T,!0),s=Ci.selectAll("."+f.bars).selectAll("."+f.bar).data(ae),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ei(a)}).attr("class",Xc),s.style("opacity",hd).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Ci.selectAll("."+f.line).style("opacity",hd).transition().duration(N).attr("d",xi).style("opacity",1))),Bi.selectAll("."+f.selectedCircles).filter(function(a){return Xd(a)}).selectAll("circle").remove(),Bi.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Ig?Id:Hd).attr("cy",Ig?Hd:Id),t=Bi.select("."+f.eventRects),je(cg)&&!kc(cg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Bi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ie(u.enter()),u.attr("x",0).attr("y",0).attr("width",yf).attr("height",Af)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),$h&&!Zh?(x=function(a,b){var c=tc(b),d=uc(b),e=hf.data.xs[a.id][b];return(Tf(d?d:e+50)-Tf(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=hf.data.xs[a.id][b];return(Tf(d)+Tf(c?c:d-50))/2}):(x=L(),w=function(a){return Tf(a.x)-x/2}),v=wc(),Bi.select("."+f.eventRects).datum(v?v.values:[]),u=Bi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),He(u.enter()),u.attr("class",ad).attr("x",Ig?0:w).attr("y",Ig?w:0).attr("width",Ig?yf:x).attr("height",Ig?x:Af),u.exit().remove()),q=Bi.select("."+f.regions).selectAll("rect."+f.region).data(Kh),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Ig?0:cc).attr("y",Ig?cc:vf.top).attr("width",Ig?yf:dc).attr("height",Ig?dc:Af).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),xc(hf.data.targets).forEach(function(a){Ii[a]=!0})}}function Oe(){Ne({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Pe(){return"mousemove"===gf.event.sourceEvent.type&&yi.altDomain?(Tf.domain(yi.altDomain),void yi.scale(Tf).updateScaleExtent()):(Zh&&Tf.orgDomain()[0]===Gi[0]&&Tf.domain([Gi[0]-1e-10,Tf.orgDomain()[1]]),Ne({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===gf.event.sourceEvent.type&&(bi=!0)))}function Qe(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Re(){zi.attr("width",Cf).attr("height",Df),zi.select("#"+Sh).select("rect").attr("width",yf).attr("height",Af),zi.select("#"+Th).select("rect").attr("width",H),zi.select("#"+Uh).select("rect").attr("width",J),zi.select("."+f.zoomRect).attr("width",yf).attr("height",Af)}function Se(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Re(),m(a.withTransition),Ne(a)}function Te(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Bi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a),j=i.enter().append("g").attr("class",function(a){return f.chartText+bd(a.id)}).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ei(a)}),e=Bi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),d=e.enter().append("g").attr("class",function(a){return f.chartBar+bd(a.id)}).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ei(a)}).style("stroke","none").style("cursor",function(a){return sg(a)?"pointer":null}),c=Bi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),b=c.enter().append("g").attr("class",function(a){return f.chartLine+bd(a.id)}).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ei(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Hi=+gf.select(this).style("opacity"),0}).style("fill",function(a){return ei(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ei(a)}).style("cursor",function(a){return sg(a)?"pointer":null}),a.forEach(function(a){Bi.selectAll("."+f.selectedCircles+cd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Bi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Kf(a)),g=h.enter().append("g").attr("class",function(a){return f.chartArc+bd(a.data.id)}),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ei(a.data)}).style("cursor",function(a){return sg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),Ye(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Dd(c,gf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),$e(),Ed(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Bg&&(n=Ci.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),m=n.enter().append("g").attr("class",function(a){return f.chartBar+bd(a.id)}),m.append("g").attr("class",Yc).style("fill",function(a){return ei(a)}),l=Ci.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),k=l.enter().append("g").attr("class",function(a){return f.chartLine+bd(a.id)}),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ei(a)})),zi.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ue(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Od(a.id,b.types[a.id]):Od(a.id,b.type)}),hf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBBox(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=ni?j:i,l=ni?Q():P();return d&&(w=0,C=0,t=0,u=0),Eg&&!Cc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=ni?u:t,void(Hg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,ni?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Di.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Gg?Gg(a):hf.toggle(a)}).on("mouseover",function(a){hf.focus(a)}).on("mouseout",function(){hf.revert()}),l.append("text").text(function(a){return d(fg[a])?fg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",ni?g:-200).attr("y",ni?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",ni?h:-200).attr("y",ni?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return ei(a)}).attr("x",ni?g:-200).attr("y",ni?-200:i).attr("width",10).attr("height",10),Di.selectAll("text").data(a).text(function(a){return d(fg[a])?fg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Di.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Di.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Re(),q&&m(p)}function cf(a){return zc(hf.data.targets,a.id)}function df(a){return"data"in a&&zc(hf.data.targets,a.data.id)}function ef(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 ff(a,b,c){var d=!Ud(hf.data.targets);Od(a,b),Se(c?c:{withTransitionForAxis:d})}var gf=a.d3?a.d3:a.require?a.require("d3"):void 0,hf={data:{},axis:{},legend:{}},jf={},kf=h(["bindto"],"#chart"),lf=h(["size","width"]),mf=h(["size","height"]),nf=h(["padding","left"]),of=h(["padding","right"]),pf=h(["zoom","enabled"],!1),qf=h(["zoom","extent"]),rf=h(["zoom","privileged"],!1),sf=h(["onenter"],function(){}),tf=h(["onleave"],function(){}),uf=h(["transition","duration"],350);g("data","data is required in config");var vf,wf,xf,yf,zf,Af,Bf,Cf,Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg=h(["data","x"]),cg=h(["data","xs"],{}),dg=h(["data","x_format"]),eg=h(["data","id_converter"],function(a){return a}),fg=h(["data","names"],{}),gg=h(["data","classes"],{}),hg=h(["data","groups"],[]),ig=h(["data","axes"],{}),jg=h(["data","type"]),kg=h(["data","types"],{}),lg=h(["data","labels"],{}),mg=h(["data","order"]),ng=h(["data","regions"],{}),og=h(["data","color"]),pg=h(["data","colors"],{}),qg=h(["data","selection","enabled"],!1),rg=h(["data","selection","grouped"],!1),sg=h(["data","selection","isselectable"],function(){return!0}),tg=h(["data","selection","multiple"],!0),ug=h(["data","onclick"],function(){}),vg=h(["data","onenter"],function(){}),wg=h(["data","onleave"],function(){}),xg=h(["data","onselected"],function(){}),yg=h(["data","onunselected"],function(){}),zg=h(["data","ondragstart"],function(){}),Ag=h(["data","ondragend"],function(){}),Bg=h(["subchart","show"],!1),Cg=Bg?h(["subchart","size","height"],60):0,Dg=h(["color","pattern"],[]),Eg=h(["legend","show"],!0),Fg=h(["legend","position"],"bottom"),Gg=h(["legend","item","onclick"]),Hg=h(["legend","equally"],!1),Ig=h(["axis","rotated"],!1),Jg=h(["axis","x","type"],"indexed"),Kg=h(["axis","x","categories"],[]),Lg=h(["axis","x","tick","centered"],!1),Mg=h(["axis","x","tick","format"]),Ng=h(["axis","x","tick","culling"],{}),Og=h(["axis","x","tick","culling","max"],"categorized"===Jg?1/0:10),Pg=h(["axis","x","tick","count"]),Qg=h(["axis","x","tick","fit"],!1),Rg=h(["axis","x","max"]),Sg=h(["axis","x","min"]),Tg=h(["axis","x","default"]),Ug=h(["axis","x","label"],{}),Vg=h(["axis","y","show"],!0),Wg=h(["axis","y","max"]),Xg=h(["axis","y","min"]),Yg=h(["axis","y","center"]),Zg=h(["axis","y","label"],{}),$g=h(["axis","y","inner"],!1),_g=h(["axis","y","tick","format"]),ah=h(["axis","y","padding"],{}),bh=h(["axis","y","ticks"],10),ch=h(["axis","y2","show"],!1),dh=h(["axis","y2","max"]),eh=h(["axis","y2","min"]),fh=h(["axis","y2","center"]),gh=h(["axis","y2","label"],{}),hh=h(["axis","y2","inner"],!1),ih=h(["axis","y2","tick","format"]),jh=h(["axis","y2","padding"],{}),kh=h(["axis","y2","ticks"],10),lh=h(["grid","x","show"],!1),mh=h(["grid","x","type"],"tick"),nh=h(["grid","x","lines"],[]),oh=h(["grid","y","show"],!1),ph=h(["grid","y","lines"],[]),qh=h(["grid","y","ticks"],10),rh=h(["point","show"],!0),sh=rh?h(["point","r"],2.5):0,th=h(["point","focus","line","enabled"],!0),uh=h(["point","focus","expand","enabled"],!0),vh=h(["point","focus","expand","r"],uh?4:sh),wh=h(["point","focus","select","r"],8),xh=h(["bar","width"]),yh=h(["bar","width","ratio"],.6),zh=h(["pie","label","show"],!0),Ah=h(["pie","label","format"]),Bh=h(["pie","onclick"],function(){}),Ch=h(["pie","onmouseover"],function(){}),Dh=h(["pie","onmouseout"],function(){}),Eh=h(["donut","label","show"],!0),Fh=h(["donut","label","format"]),Gh=h(["donut","title"],""),Hh=h(["donut","onclick"],function(){}),Ih=h(["donut","onmouseover"],function(){}),Jh=h(["donut","onmouseout"],function(){}),Kh=h(["regions"],[]),Lh=h(["tooltip","show"],!0),Mh=h(["tooltip","format","title"]),Nh=h(["tooltip","format","value"]),Oh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Mh?Mh:b,l=Nh?Nh: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+""}),Ph=h(["tooltip","init","show"],!1),Qh=h(["tooltip","init","x"],0),Rh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Sh=("string"==typeof kf?kf.replace("#",""):kf.id)+"-clip",Th=Sh+"-xaxis",Uh=Sh+"-yaxis",Vh=i(Sh),Wh=i(Wh),Xh=i(Xh),Yh="timeseries"===Jg,Zh="categorized"===Jg,$h=!Yh&&(bg||je(cg)),_h=null,ai=!1,bi=!1,ci=!1,di=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ei=de(pg,je(Dg)?Dg:di,og),fi=function(){var a=[[gf.time.format("%Y/%-m/%-d"),function(){return!0}],[gf.time.format("%-m/%-d"),function(a){return a.getMonth()}],[gf.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[gf.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[gf.time.format("%I %p"),function(a){return a.getHours()}],[gf.time.format("%I:%M"),function(a){return a.getMinutes()}],[gf.time.format(":%S"),function(a){return a.getSeconds()}],[gf.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)}}(),gi=[],hi=[],ii=Ig?"left":"bottom",ji=Ig?$g?"top":"bottom":$g?"right":"left",ki=Ig?hh?"bottom":"top":hh?"left":"right",li=Ig?"left":"bottom",mi={main:function(){return"translate("+vf.left+","+vf.top+")"},context:function(){return"translate("+wf.left+","+wf.top+")"},legend:function(){return"translate("+xf.left+","+xf.top+")"},x:function(){return"translate(0,"+(Ig?0:Af)+")"},y:function(){return"translate(0,"+(Ig?Af:0)+")"},y2:function(){return"translate("+(Ig?0:yf)+","+(Ig?1:0)+")"},subx:function(){return"translate(0,"+(Ig?0:Bf)+")"},arc:function(){return"translate("+yf/2+","+Af/2+")"}},ni="right"===Fg,oi=0,pi=0,qi=0,ri=30,si=30,ti=5;Kf=gf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var ui,vi=function(){var a=gf.svg.line().x(Ig?function(a){return V(a.id)(a.value)}:qd).y(Ig?qd:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=te(b.values);return Vd(b)?(a.interpolate(Wd(b)?"cardinal":"linear"),ng[b.id]?Fe(e,Tf,V(b.id),ng[b.id]):a(e)):(c=Tf(e[0].x),d=V(b.id)(e[0].value),Ig?"M "+d+" "+c:"M "+c+" "+d)}}(),wi=function(){var a;return a=Ig?gf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(qd):gf.svg.area().x(qd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=te(b.values);return Pd([b],"area")||Pd([b],"area-spline")?(a.interpolate(Wd(b)?"cardinal":"linear"),a(e)):(c=e[0]?Tf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ig?"M "+d+" "+c:"M "+c+" "+d)}}(),xi=function(){var a=gf.svg.line().x(Ig?function(a){return W(a.id)(a.value)}:td).y(Ig?td:function(a){return W(a.id)(a.value)});return function(b){var c=te(b.values);return Vd(b)?a(c):"M "+Wf(c[0].x)+" "+W(b.id)(c[0].value)}}(),yi=function(){};ui=gf.svg.brush().on("brush",Oe),ui.update=function(){return Ci&&Ci.select("."+f.brush).call(this),this},ui.scale=function(a){return Ig?this.y(a):this.x(a)},pf&&(yi=gf.behavior.zoom().on("zoomstart",function(){yi.altDomain=gf.event.sourceEvent.altKey?Tf.orgDomain():null}).on("zoom",pf?Pe:null),yi.scale=function(a){return Ig?this.y(a):this.x(a)},yi.orgScaleExtent=function(){var a=qf?qf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},yi.updateScaleExtent=function(){var a=$b(Tf.orgDomain())/$b(Gi),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var zi,Ai,Bi,Ci,Di,Ei,Fi,Gi,Hi,Ii={};if(hf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=zi.selectAll(dd(a)),d=c.filter(cf),e=c.filter(df);hf.revert(),hf.defocus(),b(d.classed(f.focused,!0)),b(e),Ud(hf.data.targets)&&Kb(a,!0),Ye(a)},hf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=zi.selectAll(dd(a)),d=c.filter(cf),e=c.filter(df);hf.revert(),b(d.classed(f.focused,!1)),b(e),Ud(hf.data.targets)&&Lb(a),Ze(a)},hf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=zi.selectAll(dd(a)),d=c.filter(cf),e=c.filter(df);b(d.classed(f.focused,!1)),b(e),Ud(hf.data.targets)&&Lb(a),$e()},hf.show=function(a,b){a=yc(a),b=b||{},Hc(a),zi.selectAll(ed(a)).transition().style("opacity",1),b.withLegend&&_e(a),Ne({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},hf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),zi.selectAll(ed(a)).transition().style("opacity",0),b.withLegend&&af(a),Ne({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},hf.toggle=function(a){Bc(a)?hf.hide(a):hf.show(a)},hf.unzoom=function(){ui.clear().update(),Ne({withUpdateXDomain:!0})},hf.load=function(a){return a.xs&&jc(a.xs),"categories"in a&&Zh&&(Kg=a.categories,Zf.categories(Kg)),"cacheIds"in a&&_b(a.cacheIds)?void Ue(bc(a.cacheIds),a.done):void("unload"in a?We(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ve(a)}):Ve(a))},hf.unload=function(a){We(yc(a),function(){Ne({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},hf.selected=function(a){return gf.merge(Bi.selectAll("."+f.shapes+cd(a)).selectAll("."+f.shape).filter(function(){return gf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},hf.select=function(a,b,c){qg&&Bi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=gf.select(this),i="circle"===this.nodeName?ne:qe,j="circle"===this.nodeName?oe:re,k=rg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?sg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},hf.unselect=function(a,b){qg&&Bi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=gf.select(this),g="circle"===this.nodeName?oe:re,h=rg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&sg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},hf.toLine=function(a){ff(a,"line")},hf.toSpline=function(a){ff(a,"spline")},hf.toBar=function(a){ff(a,"bar")},hf.toScatter=function(a){ff(a,"scatter")},hf.toArea=function(a){ff(a,"area")},hf.toAreaSpline=function(a){ff(a,"area-spline")},hf.toPie=function(a){ff(a,"pie",{withTransform:!0})},hf.toDonut=function(a){ff(a,"donut",{withTransform:!0})},hf.groups=function(a){return c(a)?hg:(hg=a,Ne(),hg)},hf.xgrids=function(a){return a?(nh=a,Ne(),nh):nh},hf.xgrids.add=function(a){return a?hf.xgrids(nh.concat(a)):void 0},hf.xgrids.remove=function(a){var b=ef(a);return hf.xgrids(nh.filter(b))},hf.ygrids=function(a){return a?(ph=a,Ne(),ph):ph},hf.ygrids.add=function(a){return a?hf.ygrids(ph.concat(a)):void 0},hf.ygrids.remove=function(a){var b=ef(a);return hf.ygrids(ph.filter(b))},hf.regions=function(a){return c(a)?Kh:(Kh=a,Ne(),Kh)},hf.regions.add=function(a){return c(a)?Kh:(Kh=Kh.concat(a),Ne(),Kh)},hf.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;zi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Kh=Kh.filter(function(b){return b.classes.indexOf(a)<0})}),Kh},hf.data.get=function(a){var b=hf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},hf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},hf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){fg[b]=a[b]}),bf(xc(hf.data.targets),{withTransition:!0}),fg):fg},hf.x=function(a){return arguments.length&&(mc(hf.data.targets,a),Ne({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),hf.data.xs +},hf.xs=function(a){return arguments.length&&(nc(hf.data.targets,a),Ne({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),hf.data.xs},hf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},hf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Wg=+a.y),b(a.y2)&&(dh=+a.y2)):Wg=dh=+a,Ne())},hf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Xg=+a.y),b(a.y2)&&(eh=+a.y2)):Xg=eh=+a,Ne())},hf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&hf.axis.max(a.max),"undefined"!=typeof a.min&&hf.axis.min(a.min))},hf.legend.show=function(a){Eg||(Eg=!0,Di.style("visibility","visible")),_e(yc(a)),Ne({withTransitionForHorizontalAxis:!1})},hf.legend.hide=function(a){Eg&&ie(a)&&(Eg=!1,Di.style("visibility","hidden")),af(yc(a)),Ne({withTransitionForHorizontalAxis:!1})},hf.resize=function(a){lf=a?a.width:null,mf=a?a.height:null,Se({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},hf.destroy=function(){hf.data.targets=void 0,hf.data.xs={},Fi.html(""),a.onresize=null},"url"in e.data)gf.csv(e.data.url,function(a,b){Ge(b)});else if("rows"in e.data)Ge(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ge(qc(e.data.columns))}return hf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From f0a80a4528931f9848ecde2a87f437f9f0efa6b2 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Tue, 8 Apr 2014 22:16:53 +0900 Subject: [PATCH 022/178] Add classes param on load API - #117 --- c3.js | 55 +++++++++++++++++++++++++++++++++---------------------- c3.min.js | 6 +++--- 2 files changed, 36 insertions(+), 25 deletions(-) diff --git a/c3.js b/c3.js index b85de7d..9c1005d 100644 --- a/c3.js +++ b/c3.js @@ -1587,6 +1587,10 @@ } return generateClass(CLASS.target, id) + additionalClass; } + function classChartText(d) { return CLASS.chartText + classTarget(d.id); } + function classChartLine(d) { return CLASS.chartLine + classTarget(d.id); } + function classChartBar(d) { return CLASS.chartBar + classTarget(d.id); } + function classChartArc(d) { return CLASS.chartArc + classTarget(d.data.id); } function getTargetSelectorSuffix(targetId) { return targetId || targetId === 0 ? '-' + (targetId.replace ? targetId.replace(/([^a-zA-Z0-9-_])/g, '-') : targetId) : ''; @@ -3451,22 +3455,22 @@ /*-- Main --*/ //-- Text --// - mainTextUpdate = main.select('.' + CLASS.chartTexts) - .selectAll('.' + CLASS.chartText) - .data(targets); + mainTextUpdate = main.select('.' + CLASS.chartTexts).selectAll('.' + CLASS.chartText) + .data(targets) + .attr('class', classChartText); mainTextEnter = mainTextUpdate.enter().append('g') - .attr('class', function (d) { return CLASS.chartText + classTarget(d.id); }) + .attr('class', classChartText) .style("pointer-events", "none"); mainTextEnter.append('g') .attr('class', classTexts) .style("fill", function (d) { return color(d); }); //-- Bar --// - mainBarUpdate = main.select('.' + CLASS.chartBars) - .selectAll('.' + CLASS.chartBar) - .data(targets); + mainBarUpdate = main.select('.' + CLASS.chartBars).selectAll('.' + CLASS.chartBar) + .data(targets) + .attr('class', classChartBar); mainBarEnter = mainBarUpdate.enter().append('g') - .attr('class', function (d) { return CLASS.chartBar + classTarget(d.id); }) + .attr('class', classChartBar) .style("pointer-events", "none"); // Bars for each data mainBarEnter.append('g') @@ -3478,9 +3482,10 @@ //-- Line --// mainLineUpdate = main.select('.' + CLASS.chartLines) .selectAll('.' + CLASS.chartLine) - .data(targets); + .data(targets) + .attr('class', classChartLine); mainLineEnter = mainLineUpdate.enter().append('g') - .attr('class', function (d) { return CLASS.chartLine + classTarget(d.id); }) + .attr('class', classChartLine) .style("pointer-events", "none"); // Lines for each data mainLineEnter.append("path") @@ -3509,11 +3514,11 @@ //mainLineUpdate.exit().remove(); //-- Pie --// - mainPieUpdate = main.select('.' + CLASS.chartArcs) - .selectAll('.' + CLASS.chartArc) - .data(pie(targets)); + mainPieUpdate = main.select('.' + CLASS.chartArcs).selectAll('.' + CLASS.chartArc) + .data(pie(targets)) + .attr("class", classChartArc); mainPieEnter = mainPieUpdate.enter().append("g") - .attr("class", function (d) { return CLASS.chartArc + classTarget(d.data.id); }); + .attr("class", classChartArc); mainPieEnter.append("path") .attr("class", classArc) .style("opacity", 0) @@ -3553,22 +3558,22 @@ if (__subchart_show) { - contextBarUpdate = context.select('.' + CLASS.chartBars) - .selectAll('.' + CLASS.chartBar) - .data(targets); + contextBarUpdate = context.select('.' + CLASS.chartBars).selectAll('.' + CLASS.chartBar) + .data(targets) + .attr('class', classChartBar); contextBarEnter = contextBarUpdate.enter().append('g') - .attr('class', function (d) { return CLASS.chartBar + classTarget(d.id); }); + .attr('class', classChartBar); // Bars for each data contextBarEnter.append('g') .attr("class", classBars) .style("fill", function (d) { return color(d); }); //-- Line --// - contextLineUpdate = context.select('.' + CLASS.chartLines) - .selectAll('.' + CLASS.chartLine) - .data(targets); + contextLineUpdate = context.select('.' + CLASS.chartLines).selectAll('.' + CLASS.chartLine) + .data(targets) + .attr('class', classChartLine); contextLineEnter = contextLineUpdate.enter().append('g') - .attr('class', function (d) { return CLASS.chartLine + classTarget(d.id); }); + .attr('class', classChartLine); // Lines for each data contextLineEnter.append("path") .attr("class", classLine) @@ -3966,6 +3971,12 @@ if (args.xs) { addXs(args.xs); } + // update classes if exists + if ('classes' in args) { + Object.keys(args.classes).forEach(function (id) { + __data_classes[id] = args.classes[id]; + }); + } // update categories if exists if ('categories' in args && isCategorized) { __axis_x_categories = args.categories; diff --git a/c3.min.js b/c3.min.js index 4bafa8d..4a1961b 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.29"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",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;cyf&&(yf=0),0>Af&&(Af=0),wf={top:Ig?vf.top:Df-Cg-(ni?0:a),right:0/0,bottom:20+(ni?0:a),left:Ig?ri:vf.left},zf=Ig?vf.left-ri-si:yf,Bf=Ig?Af:Df-wf.top-wf.bottom,0>zf&&(zf=0),0>Bf&&(Bf=0),xf={top:ni?0:Df-a,right:0/0,bottom:0,left:ni?Cf-b:0},p(),ni&&Ud(hf.data.targets)&&(xf.left=yf/2+Ff)}function o(){Bi.select("line."+f.xgridFocus).attr("x1",Ig?0:-10).attr("x2",Ig?yf:-10).attr("y1",Ig?-10:vf.top).attr("y2",Ig?-10:Af)}function p(){Ff=Af/2,Ef=.95*Ff,Gf=Td(hf.data.targets)?.6*Ef:0}function q(){var a=Ig?f.axisX:f.axisY,b=gf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=gf.select(kf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return lf?lf:x()}function s(){var a=mf?mf:y();return a>0?a:320}function t(){return Ud(hf.data.targets)?0:nf?nf:Ig||!Vg||$g?1:v("y")}function u(){var a=1;return Ud(hf.data.targets)?0:of?of:ni?P()+(ch&&!Ig?v("y2"):a):ch?hh||Ig?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||Vg?"y2"!==a||ch?(gb(a).isInner?30:40)+("y2"===a?-10:0):ti:Eg&&!ni?10:1}function x(){return+gf.select(kf).style("width").replace("px","")}function y(){return+gf.select(kf).style("height").replace("px","")}function z(a){return a?-5:-(vf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Ig)}function C(){return A(!Ig)}function D(){return z(Ig)}function E(){return A(Ig)}function F(a){return a?yf+2+4:vf.left+20}function G(a){return a?80:Af+2}function H(){return F(!Ig)}function I(){return G(!Ig)}function J(){return F(Ig)}function K(){return G(Ig)}function L(){var a=Ig?Af:yf,b=vc(),c=Vb()*(Qd(hf.data.targets)?(b-(Zh?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){oi=a}function N(a){pi=a}function O(a){qi=a}function P(){return Eg?ni?pi*(oi+1):Cf:0}function Q(){return Eg?ni?Df:qi*(oi+1):0}function R(){var a,b=!Tf;Lf=Ig?1:0,Mf=Ig?Af:yf,Nf=Ig?0:Af,Of=Ig?yf:1,Pf=Lf,Qf=Mf,Rf=Ig?0:Bf,Sf=Ig?zf:1,Tf=T(Lf,Mf,b?void 0:Tf.domain(),function(){return Zf.tickOffset()}),Uf=U(Nf,Of),Vf=U(Nf,Of),Wf=T(Lf,Mf,Gi,function(a){return a%1?0:ag.tickOffset()}),Xf=U(Rf,Sf),Yf=U(Rf,Sf),a=$(),Zf=X(Tf,ii,a),ag=X(Wf,li,a),$f=Y(Uf,ji,_g,bh),_f=Y(Vf,ki,ih,kh),b||(ui.scale(Wf),pf&&yi.scale(Tf)),S()}function S(){Hf=Db(),If=Eb(),Jf=Eb(.98)}function T(a,b,e,f){var g=(Yh?gf.time.scale():gf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),Zh){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return gf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?Vf:Uf}function W(a){return"y2"===Z(a)?Yf:Xf}function X(a,b,c){var d=(Zh?Bb():gf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),Zh?d.tickCentered(Lg):d.tickOffset=function(){var a=Ig?Af:yf;return a*Vb()/vc()/2},Zh&&d.categories(Kg),d}function Y(a,b,c,d){return gf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in ig?ig[a]:"y"}function $(){var a=Yh?fi:Zh?Oc:function(a){return 0>a?a.toFixed(0):a};return Mg&&("function"==typeof Mg?a=Mg:Yh&&(a=function(a){return gf.time.format(Mg)(a)})),a}function _(a){var b;return"y"===a?b=Zg:"y2"===a?b=gh:"x"===a&&(b=Ug),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Zg=b:"y2"===a?gh=b:"x"===a&&(Ug=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Ig?"inner-top":"inner-right")}function eb(){return cb("y",Ig?"inner-right":"inner-top")}function fb(){return cb("y2",Ig?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?yf/2:yf:b.isBottom?-Af:b.isMiddle?-Af/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Ig,db())}function ob(){return kb(Ig,eb())}function pb(){return kb(Ig,fb())}function qb(){return lb(!Ig,db())}function rb(){return lb(Ig,eb())}function sb(){return lb(Ig,fb())}function tb(){var a=db();return Ig?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Ig?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Ig?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Ig,db())}function xb(){return mb(Ig,eb())}function yb(){return mb(Ig,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return gf.selectAll("."+c+" .tick text").each(function(){var a=this.getBBox();bb?20:b}function Ab(){Bi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Bi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Bi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return gf.min(Object.keys(i).map(function(a){return gf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(hg.length>0)for(g=Nc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return gf.max(Object.keys(i).map(function(a){return gf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?eh:Xg,n="y2"===c?dh:Wg,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?fh:Yg,r=ld()&&Ig;return 0===l.length?"y2"===c?Vf.domain():Uf.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=md(o,p),j=$b(Uf.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&ah&&(f=b(ah.top)?ah.top:e,g=b(ah.bottom)?ah.bottom:e),"y2"===c&&jh&&(f=b(jh.top)?jh.top:e,g=b(jh.bottom)?jh.bottom:e),Qd(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Gi),c=$b(Tf.domain());return a||0===c?1:b/c}function Wb(a){return Sg?Sg:gf.min(a,function(a){return gf.min(a.values,function(a){return a.x})})}function Xb(a){return Rg?Rg:gf.max(a,function(a){return gf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return Zh?d=0:Qd(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=Yh?new Date(c.getTime()-e):c-e,g=Yh?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return bg&&a===bg||je(cg)&&ke(cg,a)}function fc(a){return!ec(a)}function gc(a){return bg?bg:je(cg)?cg[a]:null}function hc(a,b){var c,d=b&&je(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=hf.data.xs[b])}),c}function ic(a,b){return a in hf.data.xs&&hf.data.xs[a]&&hf.data.xs[a][b]?hf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){cg[b]=a[b]})}function kc(a){return 1===gf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=fg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),hf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=Yh?a?a instanceof Date?a:ee(a):ee(ic(b,c)):$h&&!Zh?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?hf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):bg?(d=Object.keys(hf.data.xs),hf.data.xs[c]=d.length>0?hf.data.xs[d[0]]:void 0):je(cg)&&(hf.data.xs[c]=hc(f,hf.data.targets)):hf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!hf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=eg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return $h&&Zh&&0===c&&g&&(0===e&&(Kg=[]),Kg.push(g)),("undefined"==typeof a[b]||hf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),jg&&Od(xc(c).filter(function(a){return!(a in kg)}),jg),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function tc(a){return a>0&&hf.data.targets[0].values[a-1]?hf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?hf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?hf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(hf.data.targets)}function zc(a,b){var c,d=xc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(Yh?new Date(h):h);i.push(d)}return i}function Gc(a){gi=gi.concat(a)}function Hc(a){gi=gi.filter(function(b){return a.indexOf(b)<0})}function Ic(a){hi=hi.concat(a)}function Jc(a){hi=hi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(ud(a,f))),a[g].x&&(e=e.concat(ud(a,g))),xd(e,b)):vd(a,b,f,g)}function wd(a,b){var c;return c=a.map(function(a){return vd(a.values,b)}),xd(c,b)}function xd(a,b){var c,d;return a.forEach(function(a){var e=le(a,b);(c>e||!c)&&(c=e,d=a)}),d}function yd(a,b){return gf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function zd(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 Ad(){return mg&&"desc"===mg.toLowerCase()}function Bd(){return mg&&"asc"===mg.toLowerCase()}function Cd(a){var b=Bd(),c=Ad();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 mg&&a.sort(mg),a}function Dd(a,c){var d,e,f,g,h,i,j,k=Ud(hf.data.targets),l=k?od:nd,m=a.filter(function(a){return a&&b(a.value)});Lh&&0!==m.length&&(Ei.html(Oh(a,$(),l,ei)).style("display","block"),d=Ei.property("offsetWidth"),e=Ei.property("offsetHeight"),k?(g=yf/2+c[0],i=Af/2+c[1]+20):(Ig?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Tf(m[0].x)+20):(f=q(),g=f+t()+Tf(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Ei.style("top",i+"px").style("left",g+"px"))}function Ed(){Ei.style("display","none")}function Fd(a){var c=a.filter(function(a){return a&&b(a.value)});Lh&&(Rd(hf.data.targets)||Ud(hf.data.targets)||Bi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Ig?"y1":"x1",qd).attr(Ig?"y2":"x2",qd))}function Gd(){Bi.select("line."+f.xgridFocus).style("visibility","hidden")}function Hd(a){return a.x||0===a.x?Tf(a.x):null}function Id(a){return V(a.id)(a.value)}function Jd(){var a,b,d={},e=0;return Dc(Ac(Xd)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Nd(a,b){return xh?xh:b?2*a.tickOffset()*yh/b:0}function Od(a,b){yc(a).forEach(function(a){Ii[a]=b===kg[a],kg[a]=b})}function Pd(a,b){var c=!1;return a.forEach(function(a){kg[a.id]===b&&(c=!0),a.id in kg||"line"!==b||(c=!0)}),c}function Qd(a){return Pd(a,"bar")}function Rd(a){return Pd(a,"scatter")}function Sd(a){return Pd(a,"pie")}function Td(a){return Pd(a,"donut")}function Ud(a){return Sd(a)||Td(a)}function Vd(a){var b="string"==typeof a?a:a.id;return!(b in kg)||"line"===kg[b]||"spline"===kg[b]||"area"===kg[b]||"area-spline"===kg[b]}function Wd(a){var b="string"==typeof a?a:a.id;return"spline"===kg[b]||"area-spline"===kg[b]}function Xd(a){var b="string"==typeof a?a:a.id;return"bar"===kg[b]}function Yd(a){var b="string"==typeof a?a:a.id;return"scatter"===kg[b]}function Zd(a){var b="string"==typeof a?a:a.id;return"pie"===kg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"donut"===kg[b]}function _d(a){return Zd(a)||$d(a)}function ae(a){return Xd(a)?a.values:[]}function be(a){return Vd(a)||Yd(a)?a.values:[]}function ce(a){return Xd(a)||Vd(a)?a.values:[]}function de(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ee(b){var c;if(!b)throw Error(b+" can not be parsed as d3.time with format "+dg+". Maybe 'x' of this data is not defined. See data.x or data.xs option.");try{c=dg?gf.time.format(dg).parse(b):new Date(b)}catch(d){c=void 0}return c||a.console.error("Failed to parse x '"+b+"' to Date with format "+dg),c}function fe(a,b){var c=gf.mouse(a),d=gf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function ke(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function le(a,b){var c="y"===Z(a.id)?Uf:Vf,d=Ig?1:0,e=Ig?0:1;return Math.pow(Tf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function me(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function ne(a,b,c){xg(b,a.node()),Bi.select("."+f.selectedCircles+cd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Ig?Id:Hd).attr("cy",Ig?Hd:Id).attr("stroke",function(){return ei(b)}).attr("r",1.4*wh).transition().duration(100).attr("r",wh)}function oe(a,b,c){yg(b,a.node()),Bi.select("."+f.selectedCircles+cd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function pe(a,b,c,d){a?ne(b,c,d):oe(b,c,d)}function qe(a,b){xg(b,a.node()),a.transition().duration(100).style("fill",function(){return gf.rgb(ei(b)).darker(1)})}function re(a,b){yg(b,a.node()),a.transition().duration(100).style("fill",function(){return ei(b)})}function se(a,b,c,d){a?qe(b,c,d):re(b,c,d)}function te(a){return a.filter(function(a){return b(a.value)})}function ue(a,c){return(c?Bi.selectAll("."+f.circles+cd(c)):Bi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ve(a,b){ue(a,b).classed(f.EXPANDED,!0).attr("r",vh)}function we(a){ue(a).filter(function(){return gf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",sh)}function xe(a){return Bi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function ye(a){xe(a).classed(f.EXPANDED,!0)}function ze(a){xe(a).classed(f.EXPANDED,!1)}function Ae(a,b){var c=Ee(a,b);return function(a,b){var d=c(a,b),e=Ig?1:0,f=Ig?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 Be(a,b){var c=Ee(a,!1),d=b?Ce:De;return function(a,b){return d(c(a,b),a,this)}}function Ce(a,b){var c;return Ig?(c=Xd(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function De(a,b,c){var d=c.getBBox();return Ig?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:Xd(b)?-3:-6)}function Ee(a,b){var c=a.__max__+1,d=Nd(Zf,c),e=Kd(d,c,a,!!b),f=Ld(!!b),g=Md(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Ig&&(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 Fe(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 Ge(b){var c,d,e;if(Fi=gf.select(kf),Fi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Fi.html(""),Fi.classed("c3",!0),hf.data.xs={},hf.data.targets=rc(b),n(),R(),Tf.domain(gf.extent(Zb(hf.data.targets))),Uf.domain(Ub(hf.data.targets,"y")),Vf.domain(Ub(hf.data.targets,"y2")),Wf.domain(Tf.domain()),Xf.domain(Uf.domain()),Yf.domain(Vf.domain()),Gi=Tf.domain(),ui.scale(Wf),pf&&yi.scale(Tf),zi=Fi.append("svg").attr("width",yf+vf.left+vf.right).attr("height",Af+vf.top+vf.bottom).on("mouseenter",sf).on("mouseleave",tf),Ai=zi.append("defs"),Ai.append("clipPath").attr("id",Sh).append("rect").attr("width",yf).attr("height",Af),Ai.append("clipPath").attr("id",Th).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Ai.append("clipPath").attr("id",Uh).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Bi=zi.append("g").attr("transform",mi.main),Ci=Bg?zi.append("g").attr("transform",mi.context):null,Di=zi.append("g").attr("transform",mi.legend),Eg||(Di.style("visibility","hidden"),hi=xc(hf.data.targets)),Ei=gf.select(kf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),bf(xc(hf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Bi.append("g").attr("class",f.axisX).attr("clip-path",Ig?"":Wh).attr("transform",mi.x).append("text").attr("class",f.axisXLabel).attr("transform",Ig?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),Vg&&Bi.append("g").attr("class",f.axisY).attr("clip-path",Ig?Xh:"").attr("transform",mi.y).append("text").attr("class",f.axisYLabel).attr("transform",Ig?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),ch&&Bi.append("g").attr("class",f.axisY2).attr("transform",mi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Ig?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Bi.append("g").attr("clip-path",Vh).attr("class",f.grid),lh&&d.append("g").attr("class",f.xgrids),je(nh)&&d.append("g").attr("class",f.xgridLines),th&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),oh&&d.append("g").attr("class",f.ygrids),je(ph)&&d.append("g").attr("class",f.ygridLines),Bi.append("g").attr("clip-path",Vh).attr("class",f.regions),Bi.append("g").attr("clip-path",Vh).attr("class",f.chart),c=Bi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",pf?Ig?"ns-resize":"ew-resize":null),Bi.select("."+f.chart).append("g").attr("class",f.chartBars),Bi.select("."+f.chart).append("g").attr("class",f.chartLines),Bi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",mi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Bi.select("."+f.chart).append("g").attr("class",f.chartTexts),pf&&Bi.insert("rect",rf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",yf).attr("height",Af).style("opacity",0).style("cursor",Ig?"ns-resize":"ew-resize").call(yi).on("dblclick.zoom",null),Tg&&ui.extent("function"!=typeof Tg?Tg:Tg(Zb())),Bg&&(Ci.append("g").attr("clip-path",Vh).attr("class",f.chart),Ci.select("."+f.chart).append("g").attr("class",f.chartBars),Ci.select("."+f.chart).append("g").attr("class",f.chartLines),Ci.append("g").attr("clip-path",Vh).attr("class",f.brush).call(ui).selectAll("rect").attr(Ig?"width":"height",Ig?zf:Bf),Ci.append("g").attr("class",f.axisX).attr("transform",mi.subx).attr("clip-path",Ig?"":Wh)),Te(hf.data.targets),Ig?Bi.select("."+f.axisX).style("opacity",0).call(Zf):(Bi.select("."+f.axisY).style("opacity",0).call($f),Bi.select("."+f.axisY2).style("opacity",0).call(_f)),Ne({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Ph){if(Yh&&"string"==typeof Qh){for(Qh=ee(Qh),e=0;e0){d=[];for(var g in fg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=zd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=se,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 Le(a){Ud(hf.data.targets)||qg&&(_h=a,Bi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),ai=!0,zg())}function Me(){Ud(hf.data.targets)||qg&&(Bi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Bi.selectAll("."+f.shape).classed(f.INCLUDED,!1),ai=!1,Ag())}function Ne(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Jd(),U=Ud(hf.data.targets),V=Dc(hf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?uf:0,O=B?N:0,P=C?N:0,H&&Eg&&bf(xc(hf.data.targets),a),G&&(Tf.domain(gf.extent(Zb(V))),Gi=Tf.domain(),pf&&yi.scale(Tf).updateScaleExtent(),Wf.domain(Tf.domain()),ui.scale(Wf)),F&&(Tf.domain(ui.empty()?Gi:ui.extent()),pf&&yi.scale(Tf).updateScaleExtent()),Uf.domain(Ub(V,"y")),Vf.domain(Ub(V,"y2")),Rd(V)||(Q=Fc(Ec(V)).sort(),Zf.tickValues(Q),ag.tickValues(Q)),c=Bi.select("."+f.axisX).style("opacity",U?0:1),(Ig||D)&&(c=c.transition().duration(P)),c.call(Zf),e=Bi.select("."+f.axisY).style("opacity",U?0:1),(!Ig||D)&&(e=e.transition().duration(P)),e.call($f),Bi.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(_f),F&&Ng&&Q){for(R=1;R=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=Tf.ticks(10);g=Bi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Ig?0:function(a){return Tf(a)-Zf.tickOffset()}).attr("x2",Ig?yf:function(a){return Tf(a)-Zf.tickOffset()}).attr("y1",Ig?function(a){return Tf(a)-Zf.tickOffset()}:vf.top).attr("y2",Ig?function(a){return Tf(a)-Zf.tickOffset()}:Af).style("opacity",function(){return+gf.select(this).attr(Ig?"y1":"x1")===(Ig?Af:0)?0:1}),g.exit().remove()}je(nh)&&(i=Bi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(nh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Ig?"":"rotate(-90)").attr("dx",Ig?0:-vf.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Ig?0:rd).attr("x2",Ig?yf:rd).attr("y1",Ig?rd:vf.top).attr("y2",Ig?rd:Af).style("opacity",1),i.select("text").transition().duration(N).attr("x",Ig?yf:0).attr("y",rd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&oh&&(k=Bi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Uf.ticks(qh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Ig?Uf:0).attr("x2",Ig?Uf:yf).attr("y1",Ig?0:Uf).attr("y2",Ig?Af:Uf),k.exit().remove()),y&&je(ph)&&(l=Bi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(ph),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Ig?"rotate(-90)":"").attr("dx",Ig?0:-vf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Ig?sd:0).attr("x2",Ig?sd:yf).attr("y1",Ig?0:sd).attr("y2",Ig?Af:sd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Ig?0:yf).attr("y",sd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Bi.selectAll("."+f.bars).selectAll("."+f.bar).data(ae),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ei(a)}).attr("class",Xc),p.style("opacity",hd).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Bi.selectAll("."+f.texts).selectAll("."+f.text).data(ce),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Ig?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return pd(a.id)(a.value)}).style("fill-opacity",id).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",kd),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Bi.selectAll("."+f.line).style("opacity",hd).transition().duration(N).attr("d",vi).style("opacity",1),Bi.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",wi).style("opacity",Hi),n=Bi.selectAll("."+f.circles).selectAll("."+f.circle).data(be),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",sh),n.style("opacity",hd).transition().duration(N).style("opacity",jd).attr("cx",Ig?Id:Hd).attr("cy",Ig?Hd:Id),n.exit().remove(),Bi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=gf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Bi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&_d(a.data)?1:0}),Bi.select("."+f.chartArcsTitle).style("opacity",Td(hf.data.targets)?1:0),Bg&&(null!==gf.event&&"zoom"===gf.event.type&&ui.extent(Tf.orgDomain()).update(),z&&(Ci.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(ag),ui.empty()||ui.extent(Tf.orgDomain()).update(),J=Ae(T,!0),s=Ci.selectAll("."+f.bars).selectAll("."+f.bar).data(ae),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ei(a)}).attr("class",Xc),s.style("opacity",hd).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Ci.selectAll("."+f.line).style("opacity",hd).transition().duration(N).attr("d",xi).style("opacity",1))),Bi.selectAll("."+f.selectedCircles).filter(function(a){return Xd(a)}).selectAll("circle").remove(),Bi.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Ig?Id:Hd).attr("cy",Ig?Hd:Id),t=Bi.select("."+f.eventRects),je(cg)&&!kc(cg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Bi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ie(u.enter()),u.attr("x",0).attr("y",0).attr("width",yf).attr("height",Af)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),$h&&!Zh?(x=function(a,b){var c=tc(b),d=uc(b),e=hf.data.xs[a.id][b];return(Tf(d?d:e+50)-Tf(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=hf.data.xs[a.id][b];return(Tf(d)+Tf(c?c:d-50))/2}):(x=L(),w=function(a){return Tf(a.x)-x/2}),v=wc(),Bi.select("."+f.eventRects).datum(v?v.values:[]),u=Bi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),He(u.enter()),u.attr("class",ad).attr("x",Ig?0:w).attr("y",Ig?w:0).attr("width",Ig?yf:x).attr("height",Ig?x:Af),u.exit().remove()),q=Bi.select("."+f.regions).selectAll("rect."+f.region).data(Kh),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Ig?0:cc).attr("y",Ig?cc:vf.top).attr("width",Ig?yf:dc).attr("height",Ig?dc:Af).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),xc(hf.data.targets).forEach(function(a){Ii[a]=!0})}}function Oe(){Ne({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Pe(){return"mousemove"===gf.event.sourceEvent.type&&yi.altDomain?(Tf.domain(yi.altDomain),void yi.scale(Tf).updateScaleExtent()):(Zh&&Tf.orgDomain()[0]===Gi[0]&&Tf.domain([Gi[0]-1e-10,Tf.orgDomain()[1]]),Ne({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===gf.event.sourceEvent.type&&(bi=!0)))}function Qe(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Re(){zi.attr("width",Cf).attr("height",Df),zi.select("#"+Sh).select("rect").attr("width",yf).attr("height",Af),zi.select("#"+Th).select("rect").attr("width",H),zi.select("#"+Uh).select("rect").attr("width",J),zi.select("."+f.zoomRect).attr("width",yf).attr("height",Af)}function Se(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Re(),m(a.withTransition),Ne(a)}function Te(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Bi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a),j=i.enter().append("g").attr("class",function(a){return f.chartText+bd(a.id)}).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ei(a)}),e=Bi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),d=e.enter().append("g").attr("class",function(a){return f.chartBar+bd(a.id)}).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ei(a)}).style("stroke","none").style("cursor",function(a){return sg(a)?"pointer":null}),c=Bi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),b=c.enter().append("g").attr("class",function(a){return f.chartLine+bd(a.id)}).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ei(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Hi=+gf.select(this).style("opacity"),0}).style("fill",function(a){return ei(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ei(a)}).style("cursor",function(a){return sg(a)?"pointer":null}),a.forEach(function(a){Bi.selectAll("."+f.selectedCircles+cd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Bi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Kf(a)),g=h.enter().append("g").attr("class",function(a){return f.chartArc+bd(a.data.id)}),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ei(a.data)}).style("cursor",function(a){return sg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),Ye(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Dd(c,gf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),$e(),Ed(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Bg&&(n=Ci.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),m=n.enter().append("g").attr("class",function(a){return f.chartBar+bd(a.id)}),m.append("g").attr("class",Yc).style("fill",function(a){return ei(a)}),l=Ci.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),k=l.enter().append("g").attr("class",function(a){return f.chartLine+bd(a.id)}),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ei(a)})),zi.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ue(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Od(a.id,b.types[a.id]):Od(a.id,b.type)}),hf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBBox(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=ni?j:i,l=ni?Q():P();return d&&(w=0,C=0,t=0,u=0),Eg&&!Cc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=ni?u:t,void(Hg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,ni?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Di.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Gg?Gg(a):hf.toggle(a)}).on("mouseover",function(a){hf.focus(a)}).on("mouseout",function(){hf.revert()}),l.append("text").text(function(a){return d(fg[a])?fg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",ni?g:-200).attr("y",ni?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",ni?h:-200).attr("y",ni?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return ei(a)}).attr("x",ni?g:-200).attr("y",ni?-200:i).attr("width",10).attr("height",10),Di.selectAll("text").data(a).text(function(a){return d(fg[a])?fg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Di.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Di.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Re(),q&&m(p)}function cf(a){return zc(hf.data.targets,a.id)}function df(a){return"data"in a&&zc(hf.data.targets,a.data.id)}function ef(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 ff(a,b,c){var d=!Ud(hf.data.targets);Od(a,b),Se(c?c:{withTransitionForAxis:d})}var gf=a.d3?a.d3:a.require?a.require("d3"):void 0,hf={data:{},axis:{},legend:{}},jf={},kf=h(["bindto"],"#chart"),lf=h(["size","width"]),mf=h(["size","height"]),nf=h(["padding","left"]),of=h(["padding","right"]),pf=h(["zoom","enabled"],!1),qf=h(["zoom","extent"]),rf=h(["zoom","privileged"],!1),sf=h(["onenter"],function(){}),tf=h(["onleave"],function(){}),uf=h(["transition","duration"],350);g("data","data is required in config");var vf,wf,xf,yf,zf,Af,Bf,Cf,Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg=h(["data","x"]),cg=h(["data","xs"],{}),dg=h(["data","x_format"]),eg=h(["data","id_converter"],function(a){return a}),fg=h(["data","names"],{}),gg=h(["data","classes"],{}),hg=h(["data","groups"],[]),ig=h(["data","axes"],{}),jg=h(["data","type"]),kg=h(["data","types"],{}),lg=h(["data","labels"],{}),mg=h(["data","order"]),ng=h(["data","regions"],{}),og=h(["data","color"]),pg=h(["data","colors"],{}),qg=h(["data","selection","enabled"],!1),rg=h(["data","selection","grouped"],!1),sg=h(["data","selection","isselectable"],function(){return!0}),tg=h(["data","selection","multiple"],!0),ug=h(["data","onclick"],function(){}),vg=h(["data","onenter"],function(){}),wg=h(["data","onleave"],function(){}),xg=h(["data","onselected"],function(){}),yg=h(["data","onunselected"],function(){}),zg=h(["data","ondragstart"],function(){}),Ag=h(["data","ondragend"],function(){}),Bg=h(["subchart","show"],!1),Cg=Bg?h(["subchart","size","height"],60):0,Dg=h(["color","pattern"],[]),Eg=h(["legend","show"],!0),Fg=h(["legend","position"],"bottom"),Gg=h(["legend","item","onclick"]),Hg=h(["legend","equally"],!1),Ig=h(["axis","rotated"],!1),Jg=h(["axis","x","type"],"indexed"),Kg=h(["axis","x","categories"],[]),Lg=h(["axis","x","tick","centered"],!1),Mg=h(["axis","x","tick","format"]),Ng=h(["axis","x","tick","culling"],{}),Og=h(["axis","x","tick","culling","max"],"categorized"===Jg?1/0:10),Pg=h(["axis","x","tick","count"]),Qg=h(["axis","x","tick","fit"],!1),Rg=h(["axis","x","max"]),Sg=h(["axis","x","min"]),Tg=h(["axis","x","default"]),Ug=h(["axis","x","label"],{}),Vg=h(["axis","y","show"],!0),Wg=h(["axis","y","max"]),Xg=h(["axis","y","min"]),Yg=h(["axis","y","center"]),Zg=h(["axis","y","label"],{}),$g=h(["axis","y","inner"],!1),_g=h(["axis","y","tick","format"]),ah=h(["axis","y","padding"],{}),bh=h(["axis","y","ticks"],10),ch=h(["axis","y2","show"],!1),dh=h(["axis","y2","max"]),eh=h(["axis","y2","min"]),fh=h(["axis","y2","center"]),gh=h(["axis","y2","label"],{}),hh=h(["axis","y2","inner"],!1),ih=h(["axis","y2","tick","format"]),jh=h(["axis","y2","padding"],{}),kh=h(["axis","y2","ticks"],10),lh=h(["grid","x","show"],!1),mh=h(["grid","x","type"],"tick"),nh=h(["grid","x","lines"],[]),oh=h(["grid","y","show"],!1),ph=h(["grid","y","lines"],[]),qh=h(["grid","y","ticks"],10),rh=h(["point","show"],!0),sh=rh?h(["point","r"],2.5):0,th=h(["point","focus","line","enabled"],!0),uh=h(["point","focus","expand","enabled"],!0),vh=h(["point","focus","expand","r"],uh?4:sh),wh=h(["point","focus","select","r"],8),xh=h(["bar","width"]),yh=h(["bar","width","ratio"],.6),zh=h(["pie","label","show"],!0),Ah=h(["pie","label","format"]),Bh=h(["pie","onclick"],function(){}),Ch=h(["pie","onmouseover"],function(){}),Dh=h(["pie","onmouseout"],function(){}),Eh=h(["donut","label","show"],!0),Fh=h(["donut","label","format"]),Gh=h(["donut","title"],""),Hh=h(["donut","onclick"],function(){}),Ih=h(["donut","onmouseover"],function(){}),Jh=h(["donut","onmouseout"],function(){}),Kh=h(["regions"],[]),Lh=h(["tooltip","show"],!0),Mh=h(["tooltip","format","title"]),Nh=h(["tooltip","format","value"]),Oh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Mh?Mh:b,l=Nh?Nh: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+""}),Ph=h(["tooltip","init","show"],!1),Qh=h(["tooltip","init","x"],0),Rh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Sh=("string"==typeof kf?kf.replace("#",""):kf.id)+"-clip",Th=Sh+"-xaxis",Uh=Sh+"-yaxis",Vh=i(Sh),Wh=i(Wh),Xh=i(Xh),Yh="timeseries"===Jg,Zh="categorized"===Jg,$h=!Yh&&(bg||je(cg)),_h=null,ai=!1,bi=!1,ci=!1,di=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ei=de(pg,je(Dg)?Dg:di,og),fi=function(){var a=[[gf.time.format("%Y/%-m/%-d"),function(){return!0}],[gf.time.format("%-m/%-d"),function(a){return a.getMonth()}],[gf.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[gf.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[gf.time.format("%I %p"),function(a){return a.getHours()}],[gf.time.format("%I:%M"),function(a){return a.getMinutes()}],[gf.time.format(":%S"),function(a){return a.getSeconds()}],[gf.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)}}(),gi=[],hi=[],ii=Ig?"left":"bottom",ji=Ig?$g?"top":"bottom":$g?"right":"left",ki=Ig?hh?"bottom":"top":hh?"left":"right",li=Ig?"left":"bottom",mi={main:function(){return"translate("+vf.left+","+vf.top+")"},context:function(){return"translate("+wf.left+","+wf.top+")"},legend:function(){return"translate("+xf.left+","+xf.top+")"},x:function(){return"translate(0,"+(Ig?0:Af)+")"},y:function(){return"translate(0,"+(Ig?Af:0)+")"},y2:function(){return"translate("+(Ig?0:yf)+","+(Ig?1:0)+")"},subx:function(){return"translate(0,"+(Ig?0:Bf)+")"},arc:function(){return"translate("+yf/2+","+Af/2+")"}},ni="right"===Fg,oi=0,pi=0,qi=0,ri=30,si=30,ti=5;Kf=gf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var ui,vi=function(){var a=gf.svg.line().x(Ig?function(a){return V(a.id)(a.value)}:qd).y(Ig?qd:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=te(b.values);return Vd(b)?(a.interpolate(Wd(b)?"cardinal":"linear"),ng[b.id]?Fe(e,Tf,V(b.id),ng[b.id]):a(e)):(c=Tf(e[0].x),d=V(b.id)(e[0].value),Ig?"M "+d+" "+c:"M "+c+" "+d)}}(),wi=function(){var a;return a=Ig?gf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(qd):gf.svg.area().x(qd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=te(b.values);return Pd([b],"area")||Pd([b],"area-spline")?(a.interpolate(Wd(b)?"cardinal":"linear"),a(e)):(c=e[0]?Tf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ig?"M "+d+" "+c:"M "+c+" "+d)}}(),xi=function(){var a=gf.svg.line().x(Ig?function(a){return W(a.id)(a.value)}:td).y(Ig?td:function(a){return W(a.id)(a.value)});return function(b){var c=te(b.values);return Vd(b)?a(c):"M "+Wf(c[0].x)+" "+W(b.id)(c[0].value)}}(),yi=function(){};ui=gf.svg.brush().on("brush",Oe),ui.update=function(){return Ci&&Ci.select("."+f.brush).call(this),this},ui.scale=function(a){return Ig?this.y(a):this.x(a)},pf&&(yi=gf.behavior.zoom().on("zoomstart",function(){yi.altDomain=gf.event.sourceEvent.altKey?Tf.orgDomain():null}).on("zoom",pf?Pe:null),yi.scale=function(a){return Ig?this.y(a):this.x(a)},yi.orgScaleExtent=function(){var a=qf?qf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},yi.updateScaleExtent=function(){var a=$b(Tf.orgDomain())/$b(Gi),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var zi,Ai,Bi,Ci,Di,Ei,Fi,Gi,Hi,Ii={};if(hf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=zi.selectAll(dd(a)),d=c.filter(cf),e=c.filter(df);hf.revert(),hf.defocus(),b(d.classed(f.focused,!0)),b(e),Ud(hf.data.targets)&&Kb(a,!0),Ye(a)},hf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=zi.selectAll(dd(a)),d=c.filter(cf),e=c.filter(df);hf.revert(),b(d.classed(f.focused,!1)),b(e),Ud(hf.data.targets)&&Lb(a),Ze(a)},hf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=zi.selectAll(dd(a)),d=c.filter(cf),e=c.filter(df);b(d.classed(f.focused,!1)),b(e),Ud(hf.data.targets)&&Lb(a),$e()},hf.show=function(a,b){a=yc(a),b=b||{},Hc(a),zi.selectAll(ed(a)).transition().style("opacity",1),b.withLegend&&_e(a),Ne({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},hf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),zi.selectAll(ed(a)).transition().style("opacity",0),b.withLegend&&af(a),Ne({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},hf.toggle=function(a){Bc(a)?hf.hide(a):hf.show(a)},hf.unzoom=function(){ui.clear().update(),Ne({withUpdateXDomain:!0})},hf.load=function(a){return a.xs&&jc(a.xs),"categories"in a&&Zh&&(Kg=a.categories,Zf.categories(Kg)),"cacheIds"in a&&_b(a.cacheIds)?void Ue(bc(a.cacheIds),a.done):void("unload"in a?We(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ve(a)}):Ve(a))},hf.unload=function(a){We(yc(a),function(){Ne({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},hf.selected=function(a){return gf.merge(Bi.selectAll("."+f.shapes+cd(a)).selectAll("."+f.shape).filter(function(){return gf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},hf.select=function(a,b,c){qg&&Bi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=gf.select(this),i="circle"===this.nodeName?ne:qe,j="circle"===this.nodeName?oe:re,k=rg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?sg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},hf.unselect=function(a,b){qg&&Bi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=gf.select(this),g="circle"===this.nodeName?oe:re,h=rg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&sg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},hf.toLine=function(a){ff(a,"line")},hf.toSpline=function(a){ff(a,"spline")},hf.toBar=function(a){ff(a,"bar")},hf.toScatter=function(a){ff(a,"scatter")},hf.toArea=function(a){ff(a,"area")},hf.toAreaSpline=function(a){ff(a,"area-spline")},hf.toPie=function(a){ff(a,"pie",{withTransform:!0})},hf.toDonut=function(a){ff(a,"donut",{withTransform:!0})},hf.groups=function(a){return c(a)?hg:(hg=a,Ne(),hg)},hf.xgrids=function(a){return a?(nh=a,Ne(),nh):nh},hf.xgrids.add=function(a){return a?hf.xgrids(nh.concat(a)):void 0},hf.xgrids.remove=function(a){var b=ef(a);return hf.xgrids(nh.filter(b))},hf.ygrids=function(a){return a?(ph=a,Ne(),ph):ph},hf.ygrids.add=function(a){return a?hf.ygrids(ph.concat(a)):void 0},hf.ygrids.remove=function(a){var b=ef(a);return hf.ygrids(ph.filter(b))},hf.regions=function(a){return c(a)?Kh:(Kh=a,Ne(),Kh)},hf.regions.add=function(a){return c(a)?Kh:(Kh=Kh.concat(a),Ne(),Kh)},hf.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;zi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Kh=Kh.filter(function(b){return b.classes.indexOf(a)<0})}),Kh},hf.data.get=function(a){var b=hf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},hf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},hf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){fg[b]=a[b]}),bf(xc(hf.data.targets),{withTransition:!0}),fg):fg},hf.x=function(a){return arguments.length&&(mc(hf.data.targets,a),Ne({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),hf.data.xs -},hf.xs=function(a){return arguments.length&&(nc(hf.data.targets,a),Ne({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),hf.data.xs},hf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},hf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Wg=+a.y),b(a.y2)&&(dh=+a.y2)):Wg=dh=+a,Ne())},hf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Xg=+a.y),b(a.y2)&&(eh=+a.y2)):Xg=eh=+a,Ne())},hf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&hf.axis.max(a.max),"undefined"!=typeof a.min&&hf.axis.min(a.min))},hf.legend.show=function(a){Eg||(Eg=!0,Di.style("visibility","visible")),_e(yc(a)),Ne({withTransitionForHorizontalAxis:!1})},hf.legend.hide=function(a){Eg&&ie(a)&&(Eg=!1,Di.style("visibility","hidden")),af(yc(a)),Ne({withTransitionForHorizontalAxis:!1})},hf.resize=function(a){lf=a?a.width:null,mf=a?a.height:null,Se({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},hf.destroy=function(){hf.data.targets=void 0,hf.data.xs={},Fi.html(""),a.onresize=null},"url"in e.data)gf.csv(e.data.url,function(a,b){Ge(b)});else if("rows"in e.data)Ge(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ge(qc(e.data.columns))}return hf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file +!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.29"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",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;cCf&&(Cf=0),0>Ef&&(Ef=0),Af={top:Mg?zf.top:Hf-Gg-(ri?0:a),right:0/0,bottom:20+(ri?0:a),left:Mg?vi:zf.left},Df=Mg?zf.left-vi-wi:Cf,Ff=Mg?Ef:Hf-Af.top-Af.bottom,0>Df&&(Df=0),0>Ff&&(Ff=0),Bf={top:ri?0:Hf-a,right:0/0,bottom:0,left:ri?Gf-b:0},p(),ri&&Yd(mf.data.targets)&&(Bf.left=Cf/2+Jf)}function o(){Fi.select("line."+f.xgridFocus).attr("x1",Mg?0:-10).attr("x2",Mg?Cf:-10).attr("y1",Mg?-10:zf.top).attr("y2",Mg?-10:Ef)}function p(){Jf=Ef/2,If=.95*Jf,Kf=Xd(mf.data.targets)?.6*If:0}function q(){var a=Mg?f.axisX:f.axisY,b=lf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=lf.select(of).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return pf?pf:x()}function s(){var a=qf?qf:y();return a>0?a:320}function t(){return Yd(mf.data.targets)?0:rf?rf:Mg||!Zg||ch?1:v("y")}function u(){var a=1;return Yd(mf.data.targets)?0:sf?sf:ri?P()+(gh&&!Mg?v("y2"):a):gh?lh||Mg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||Zg?"y2"!==a||gh?(gb(a).isInner?30:40)+("y2"===a?-10:0):xi:Ig&&!ri?10:1}function x(){return+lf.select(of).style("width").replace("px","")}function y(){return+lf.select(of).style("height").replace("px","")}function z(a){return a?-5:-(zf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Mg)}function C(){return A(!Mg)}function D(){return z(Mg)}function E(){return A(Mg)}function F(a){return a?Cf+2+4:zf.left+20}function G(a){return a?80:Ef+2}function H(){return F(!Mg)}function I(){return G(!Mg)}function J(){return F(Mg)}function K(){return G(Mg)}function L(){var a=Mg?Ef:Cf,b=vc(),c=Vb()*(Ud(mf.data.targets)?(b-(bi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){si=a}function N(a){ti=a}function O(a){ui=a}function P(){return Ig?ri?ti*(si+1):Gf:0}function Q(){return Ig?ri?Hf:ui*(si+1):0}function R(){var a,b=!Xf;Pf=Mg?1:0,Qf=Mg?Ef:Cf,Rf=Mg?0:Ef,Sf=Mg?Cf:1,Tf=Pf,Uf=Qf,Vf=Mg?0:Ff,Wf=Mg?Df:1,Xf=T(Pf,Qf,b?void 0:Xf.domain(),function(){return bg.tickOffset()}),Yf=U(Rf,Sf),Zf=U(Rf,Sf),$f=T(Pf,Qf,Ki,function(a){return a%1?0:eg.tickOffset()}),_f=U(Vf,Wf),ag=U(Vf,Wf),a=$(),bg=X(Xf,mi,a),eg=X($f,pi,a),cg=Y(Yf,ni,dh,fh),dg=Y(Zf,oi,mh,oh),b||(yi.scale($f),tf&&Ci.scale(Xf)),S()}function S(){Lf=Db(),Mf=Eb(),Nf=Eb(.98)}function T(a,b,e,f){var g=(ai?lf.time.scale():lf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),bi){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return lf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?Zf:Yf}function W(a){return"y2"===Z(a)?ag:_f}function X(a,b,c){var d=(bi?Bb():lf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),bi?d.tickCentered(Pg):d.tickOffset=function(){var a=Mg?Ef:Cf;return a*Vb()/vc()/2},bi&&d.categories(Og),d}function Y(a,b,c,d){return lf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in mg?mg[a]:"y"}function $(){var a=ai?ji:bi?Oc:function(a){return 0>a?a.toFixed(0):a};return Qg&&("function"==typeof Qg?a=Qg:ai&&(a=function(a){return lf.time.format(Qg)(a)})),a}function _(a){var b;return"y"===a?b=bh:"y2"===a?b=kh:"x"===a&&(b=Yg),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?bh=b:"y2"===a?kh=b:"x"===a&&(Yg=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Mg?"inner-top":"inner-right")}function eb(){return cb("y",Mg?"inner-right":"inner-top")}function fb(){return cb("y2",Mg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?Cf/2:Cf:b.isBottom?-Ef:b.isMiddle?-Ef/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Mg,db())}function ob(){return kb(Mg,eb())}function pb(){return kb(Mg,fb())}function qb(){return lb(!Mg,db())}function rb(){return lb(Mg,eb())}function sb(){return lb(Mg,fb())}function tb(){var a=db();return Mg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Mg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Mg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Mg,db())}function xb(){return mb(Mg,eb())}function yb(){return mb(Mg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return lf.selectAll("."+c+" .tick text").each(function(){var a=this.getBBox();bb?20:b}function Ab(){Fi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Fi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Fi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return lf.min(Object.keys(i).map(function(a){return lf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(lg.length>0)for(g=Nc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return lf.max(Object.keys(i).map(function(a){return lf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?ih:_g,n="y2"===c?hh:$g,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?jh:ah,r=pd()&&Mg;return 0===l.length?"y2"===c?Zf.domain():Yf.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=qd(o,p),j=$b(Yf.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&eh&&(f=b(eh.top)?eh.top:e,g=b(eh.bottom)?eh.bottom:e),"y2"===c&&nh&&(f=b(nh.top)?nh.top:e,g=b(nh.bottom)?nh.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Ki),c=$b(Xf.domain());return a||0===c?1:b/c}function Wb(a){return Wg?Wg:lf.min(a,function(a){return lf.min(a.values,function(a){return a.x})})}function Xb(a){return Vg?Vg:lf.max(a,function(a){return lf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return bi?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=ai?new Date(c.getTime()-e):c-e,g=ai?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return fg&&a===fg||ne(gg)&&oe(gg,a)}function fc(a){return!ec(a)}function gc(a){return fg?fg:ne(gg)?gg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=mf.data.xs[b])}),c}function ic(a,b){return a in mf.data.xs&&mf.data.xs[a]&&mf.data.xs[a][b]?mf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){gg[b]=a[b]})}function kc(a){return 1===lf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=jg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),mf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=ai?a?a instanceof Date?a:ie(a):ie(ic(b,c)):ci&&!bi?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?mf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):fg?(d=Object.keys(mf.data.xs),mf.data.xs[c]=d.length>0?mf.data.xs[d[0]]:void 0):ne(gg)&&(mf.data.xs[c]=hc(f,mf.data.targets)):mf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!mf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=ig(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return ci&&bi&&0===c&&g&&(0===e&&(Og=[]),Og.push(g)),("undefined"==typeof a[b]||mf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),ng&&Sd(xc(c).filter(function(a){return!(a in og)}),ng),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function tc(a){return a>0&&mf.data.targets[0].values[a-1]?mf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?mf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?mf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(mf.data.targets)}function zc(a,b){var c,d=xc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(ai?new Date(h):h);i.push(d)}return i}function Gc(a){ki=ki.concat(a)}function Hc(a){ki=ki.filter(function(b){return a.indexOf(b)<0})}function Ic(a){li=li.concat(a)}function Jc(a){li=li.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return lf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Ed(){return qg&&"desc"===qg.toLowerCase()}function Fd(){return qg&&"asc"===qg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof qg&&a.sort(qg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(mf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Ph&&0!==m.length&&(Ii.html(Sh(a,$(),l,ii)).style("display","block"),d=Ii.property("offsetWidth"),e=Ii.property("offsetHeight"),k?(g=Cf/2+c[0],i=Ef/2+c[1]+20):(Mg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Xf(m[0].x)+20):(f=q(),g=f+t()+Xf(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Ii.style("top",i+"px").style("left",g+"px"))}function Id(){Ii.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Ph&&(Vd(mf.data.targets)||Yd(mf.data.targets)||Fi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Mg?"y1":"x1",ud).attr(Mg?"y2":"x2",ud))}function Kd(){Fi.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?Xf(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Bh?Bh:b?2*a.tickOffset()*Ch/b:0}function Sd(a,b){yc(a).forEach(function(a){Mi[a]=b===og[a],og[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){og[a.id]===b&&(c=!0),a.id in og||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in og)||"line"===og[b]||"spline"===og[b]||"area"===og[b]||"area-spline"===og[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===og[b]||"area-spline"===og[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===og[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===og[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===og[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===og[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ie(b){var c;if(!b)throw Error(b+" can not be parsed as d3.time with format "+hg+". Maybe 'x' of this data is not defined. See data.x or data.xs option.");try{c=hg?lf.time.format(hg).parse(b):new Date(b)}catch(d){c=void 0}return c||a.console.error("Failed to parse x '"+b+"' to Date with format "+hg),c}function je(a,b){var c=lf.mouse(a),d=lf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?Yf:Zf,d=Mg?1:0,e=Mg?0:1;return Math.pow(Xf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Bg(b,a.node()),Fi.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Mg?Md:Ld).attr("cy",Mg?Ld:Md).attr("stroke",function(){return ii(b)}).attr("r",1.4*Ah).transition().duration(100).attr("r",Ah)}function se(a,b,c){Cg(b,a.node()),Fi.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Bg(b,a.node()),a.transition().duration(100).style("fill",function(){return lf.rgb(ii(b)).darker(1)})}function ve(a,b){Cg(b,a.node()),a.transition().duration(100).style("fill",function(){return ii(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Fi.selectAll("."+f.circles+gd(c)):Fi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",zh)}function Ae(a){ye(a).filter(function(){return lf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",wh)}function Be(a){return Fi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Mg?1:0,f=Mg?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Mg?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBBox();return Mg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(bg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Mg&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Je(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function Ke(b){var c,d,e;if(Ji=lf.select(of),Ji.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Ji.html(""),Ji.classed("c3",!0),mf.data.xs={},mf.data.targets=rc(b),n(),R(),Xf.domain(lf.extent(Zb(mf.data.targets))),Yf.domain(Ub(mf.data.targets,"y")),Zf.domain(Ub(mf.data.targets,"y2")),$f.domain(Xf.domain()),_f.domain(Yf.domain()),ag.domain(Zf.domain()),Ki=Xf.domain(),yi.scale($f),tf&&Ci.scale(Xf),Di=Ji.append("svg").attr("width",Cf+zf.left+zf.right).attr("height",Ef+zf.top+zf.bottom).on("mouseenter",wf).on("mouseleave",xf),Ei=Di.append("defs"),Ei.append("clipPath").attr("id",Wh).append("rect").attr("width",Cf).attr("height",Ef),Ei.append("clipPath").attr("id",Xh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Ei.append("clipPath").attr("id",Yh).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Fi=Di.append("g").attr("transform",qi.main),Gi=Fg?Di.append("g").attr("transform",qi.context):null,Hi=Di.append("g").attr("transform",qi.legend),Ig||(Hi.style("visibility","hidden"),li=xc(mf.data.targets)),Ii=lf.select(of).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),ff(xc(mf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Fi.append("g").attr("class",f.axisX).attr("clip-path",Mg?"":$h).attr("transform",qi.x).append("text").attr("class",f.axisXLabel).attr("transform",Mg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),Zg&&Fi.append("g").attr("class",f.axisY).attr("clip-path",Mg?_h:"").attr("transform",qi.y).append("text").attr("class",f.axisYLabel).attr("transform",Mg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),gh&&Fi.append("g").attr("class",f.axisY2).attr("transform",qi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Mg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Fi.append("g").attr("clip-path",Zh).attr("class",f.grid),ph&&d.append("g").attr("class",f.xgrids),ne(rh)&&d.append("g").attr("class",f.xgridLines),xh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),sh&&d.append("g").attr("class",f.ygrids),ne(th)&&d.append("g").attr("class",f.ygridLines),Fi.append("g").attr("clip-path",Zh).attr("class",f.regions),Fi.append("g").attr("clip-path",Zh).attr("class",f.chart),c=Fi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",tf?Mg?"ns-resize":"ew-resize":null),Fi.select("."+f.chart).append("g").attr("class",f.chartBars),Fi.select("."+f.chart).append("g").attr("class",f.chartLines),Fi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",qi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Fi.select("."+f.chart).append("g").attr("class",f.chartTexts),tf&&Fi.insert("rect",vf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Cf).attr("height",Ef).style("opacity",0).style("cursor",Mg?"ns-resize":"ew-resize").call(Ci).on("dblclick.zoom",null),Xg&&yi.extent("function"!=typeof Xg?Xg:Xg(Zb())),Fg&&(Gi.append("g").attr("clip-path",Zh).attr("class",f.chart),Gi.select("."+f.chart).append("g").attr("class",f.chartBars),Gi.select("."+f.chart).append("g").attr("class",f.chartLines),Gi.append("g").attr("clip-path",Zh).attr("class",f.brush).call(yi).selectAll("rect").attr(Mg?"width":"height",Mg?Df:Ff),Gi.append("g").attr("class",f.axisX).attr("transform",qi.subx).attr("clip-path",Mg?"":$h)),Xe(mf.data.targets),Mg?Fi.select("."+f.axisX).style("opacity",0).call(bg):(Fi.select("."+f.axisY).style("opacity",0).call(cg),Fi.select("."+f.axisY2).style("opacity",0).call(dg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Th){if(ai&&"string"==typeof Uh){for(Uh=ie(Uh),e=0;e0){d=[];for(var g in jg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function Pe(a){Yd(mf.data.targets)||ug&&(di=a,Fi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),ei=!0,Dg())}function Qe(){Yd(mf.data.targets)||ug&&(Fi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Fi.selectAll("."+f.shape).classed(f.INCLUDED,!1),ei=!1,Eg())}function Re(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Nd(),U=Yd(mf.data.targets),V=Dc(mf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?yf:0,O=B?N:0,P=C?N:0,H&&Ig&&ff(xc(mf.data.targets),a),G&&(Xf.domain(lf.extent(Zb(V))),Ki=Xf.domain(),tf&&Ci.scale(Xf).updateScaleExtent(),$f.domain(Xf.domain()),yi.scale($f)),F&&(Xf.domain(yi.empty()?Ki:yi.extent()),tf&&Ci.scale(Xf).updateScaleExtent()),Yf.domain(Ub(V,"y")),Zf.domain(Ub(V,"y2")),Vd(V)||(Q=Fc(Ec(V)).sort(),bg.tickValues(Q),eg.tickValues(Q)),c=Fi.select("."+f.axisX).style("opacity",U?0:1),(Mg||D)&&(c=c.transition().duration(P)),c.call(bg),e=Fi.select("."+f.axisY).style("opacity",U?0:1),(!Mg||D)&&(e=e.transition().duration(P)),e.call(cg),Fi.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(dg),F&&Rg&&Q){for(R=1;R=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=Xf.ticks(10);g=Fi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Mg?0:function(a){return Xf(a)-bg.tickOffset()}).attr("x2",Mg?Cf:function(a){return Xf(a)-bg.tickOffset()}).attr("y1",Mg?function(a){return Xf(a)-bg.tickOffset()}:zf.top).attr("y2",Mg?function(a){return Xf(a)-bg.tickOffset()}:Ef).style("opacity",function(){return+lf.select(this).attr(Mg?"y1":"x1")===(Mg?Ef:0)?0:1}),g.exit().remove()}ne(rh)&&(i=Fi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(rh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Mg?"":"rotate(-90)").attr("dx",Mg?0:-zf.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Mg?0:vd).attr("x2",Mg?Cf:vd).attr("y1",Mg?vd:zf.top).attr("y2",Mg?vd:Ef).style("opacity",1),i.select("text").transition().duration(N).attr("x",Mg?Cf:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&sh&&(k=Fi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Yf.ticks(uh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Mg?Yf:0).attr("x2",Mg?Yf:Cf).attr("y1",Mg?0:Yf).attr("y2",Mg?Ef:Yf),k.exit().remove()),y&&ne(th)&&(l=Fi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(th),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Mg?"rotate(-90)":"").attr("dx",Mg?0:-zf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Mg?wd:0).attr("x2",Mg?wd:Cf).attr("y1",Mg?0:wd).attr("y2",Mg?Ef:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Mg?0:Cf).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Fi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ii(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Fi.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Mg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Fi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",zi).style("opacity",1),Fi.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Ai).style("opacity",Li),n=Fi.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",wh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Mg?Md:Ld).attr("cy",Mg?Ld:Md),n.exit().remove(),Fi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=lf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Fi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Fi.select("."+f.chartArcsTitle).style("opacity",Xd(mf.data.targets)?1:0),Fg&&(null!==lf.event&&"zoom"===lf.event.type&&yi.extent(Xf.orgDomain()).update(),z&&(Gi.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(eg),yi.empty()||yi.extent(Xf.orgDomain()).update(),J=Ee(T,!0),s=Gi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ii(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Gi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Bi).style("opacity",1))),Fi.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Fi.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Mg?Md:Ld).attr("cy",Mg?Ld:Md),t=Fi.select("."+f.eventRects),ne(gg)&&!kc(gg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Fi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Cf).attr("height",Ef)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),ci&&!bi?(x=function(a,b){var c=tc(b),d=uc(b),e=mf.data.xs[a.id][b];return(Xf(d?d:e+50)-Xf(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=mf.data.xs[a.id][b];return(Xf(d)+Xf(c?c:d-50))/2}):(x=L(),w=function(a){return Xf(a.x)-x/2}),v=wc(),Fi.select("."+f.eventRects).datum(v?v.values:[]),u=Fi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Mg?0:w).attr("y",Mg?w:0).attr("width",Mg?Cf:x).attr("height",Mg?x:Ef),u.exit().remove()),q=Fi.select("."+f.regions).selectAll("rect."+f.region).data(Oh),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Mg?0:cc).attr("y",Mg?cc:zf.top).attr("width",Mg?Cf:dc).attr("height",Mg?dc:Ef).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),xc(mf.data.targets).forEach(function(a){Mi[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===lf.event.sourceEvent.type&&Ci.altDomain?(Xf.domain(Ci.altDomain),void Ci.scale(Xf).updateScaleExtent()):(bi&&Xf.orgDomain()[0]===Ki[0]&&Xf.domain([Ki[0]-1e-10,Xf.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===lf.event.sourceEvent.type&&(fi=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Di.attr("width",Gf).attr("height",Hf),Di.select("#"+Wh).select("rect").attr("width",Cf).attr("height",Ef),Di.select("#"+Xh).select("rect").attr("width",H),Di.select("#"+Yh).select("rect").attr("width",J),Di.select("."+f.zoomRect).attr("width",Cf).attr("height",Ef)}function We(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Fi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ii(a)}),e=Fi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ii(a)}).style("stroke","none").style("cursor",function(a){return wg(a)?"pointer":null}),c=Fi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ii(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Li=+lf.select(this).style("opacity"),0}).style("fill",function(a){return ii(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ii(a)}).style("cursor",function(a){return wg(a)?"pointer":null}),a.forEach(function(a){Fi.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Fi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Of(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ii(a.data)}).style("cursor",function(a){return wg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),af(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,lf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),cf(),Id(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Fg&&(n=Gi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ii(a)}),l=Gi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ii(a)})),Di.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),mf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBBox(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=ri?j:i,l=ri?Q():P();return d&&(w=0,C=0,t=0,u=0),Ig&&!Cc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=ri?u:t,void(Lg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,ri?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Hi.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Kg?Kg(a):mf.toggle(a)}).on("mouseover",function(a){mf.focus(a)}).on("mouseout",function(){mf.revert()}),l.append("text").text(function(a){return d(jg[a])?jg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",ri?g:-200).attr("y",ri?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",ri?h:-200).attr("y",ri?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return ii(a)}).attr("x",ri?g:-200).attr("y",ri?-200:i).attr("width",10).attr("height",10),Hi.selectAll("text").data(a).text(function(a){return d(jg[a])?jg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Hi.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Hi.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Ve(),q&&m(p)}function gf(a){return zc(mf.data.targets,a.id)}function hf(a){return"data"in a&&zc(mf.data.targets,a.data.id)}function jf(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 kf(a,b,c){var d=!Yd(mf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var lf=a.d3?a.d3:a.require?a.require("d3"):void 0,mf={data:{},axis:{},legend:{}},nf={},of=h(["bindto"],"#chart"),pf=h(["size","width"]),qf=h(["size","height"]),rf=h(["padding","left"]),sf=h(["padding","right"]),tf=h(["zoom","enabled"],!1),uf=h(["zoom","extent"]),vf=h(["zoom","privileged"],!1),wf=h(["onenter"],function(){}),xf=h(["onleave"],function(){}),yf=h(["transition","duration"],350);g("data","data is required in config");var zf,Af,Bf,Cf,Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg=h(["data","x"]),gg=h(["data","xs"],{}),hg=h(["data","x_format"]),ig=h(["data","id_converter"],function(a){return a}),jg=h(["data","names"],{}),kg=h(["data","classes"],{}),lg=h(["data","groups"],[]),mg=h(["data","axes"],{}),ng=h(["data","type"]),og=h(["data","types"],{}),pg=h(["data","labels"],{}),qg=h(["data","order"]),rg=h(["data","regions"],{}),sg=h(["data","color"]),tg=h(["data","colors"],{}),ug=h(["data","selection","enabled"],!1),vg=h(["data","selection","grouped"],!1),wg=h(["data","selection","isselectable"],function(){return!0}),xg=h(["data","selection","multiple"],!0),yg=h(["data","onclick"],function(){}),zg=h(["data","onenter"],function(){}),Ag=h(["data","onleave"],function(){}),Bg=h(["data","onselected"],function(){}),Cg=h(["data","onunselected"],function(){}),Dg=h(["data","ondragstart"],function(){}),Eg=h(["data","ondragend"],function(){}),Fg=h(["subchart","show"],!1),Gg=Fg?h(["subchart","size","height"],60):0,Hg=h(["color","pattern"],[]),Ig=h(["legend","show"],!0),Jg=h(["legend","position"],"bottom"),Kg=h(["legend","item","onclick"]),Lg=h(["legend","equally"],!1),Mg=h(["axis","rotated"],!1),Ng=h(["axis","x","type"],"indexed"),Og=h(["axis","x","categories"],[]),Pg=h(["axis","x","tick","centered"],!1),Qg=h(["axis","x","tick","format"]),Rg=h(["axis","x","tick","culling"],{}),Sg=h(["axis","x","tick","culling","max"],"categorized"===Ng?1/0:10),Tg=h(["axis","x","tick","count"]),Ug=h(["axis","x","tick","fit"],!1),Vg=h(["axis","x","max"]),Wg=h(["axis","x","min"]),Xg=h(["axis","x","default"]),Yg=h(["axis","x","label"],{}),Zg=h(["axis","y","show"],!0),$g=h(["axis","y","max"]),_g=h(["axis","y","min"]),ah=h(["axis","y","center"]),bh=h(["axis","y","label"],{}),ch=h(["axis","y","inner"],!1),dh=h(["axis","y","tick","format"]),eh=h(["axis","y","padding"],{}),fh=h(["axis","y","ticks"],10),gh=h(["axis","y2","show"],!1),hh=h(["axis","y2","max"]),ih=h(["axis","y2","min"]),jh=h(["axis","y2","center"]),kh=h(["axis","y2","label"],{}),lh=h(["axis","y2","inner"],!1),mh=h(["axis","y2","tick","format"]),nh=h(["axis","y2","padding"],{}),oh=h(["axis","y2","ticks"],10),ph=h(["grid","x","show"],!1),qh=h(["grid","x","type"],"tick"),rh=h(["grid","x","lines"],[]),sh=h(["grid","y","show"],!1),th=h(["grid","y","lines"],[]),uh=h(["grid","y","ticks"],10),vh=h(["point","show"],!0),wh=vh?h(["point","r"],2.5):0,xh=h(["point","focus","line","enabled"],!0),yh=h(["point","focus","expand","enabled"],!0),zh=h(["point","focus","expand","r"],yh?4:wh),Ah=h(["point","focus","select","r"],8),Bh=h(["bar","width"]),Ch=h(["bar","width","ratio"],.6),Dh=h(["pie","label","show"],!0),Eh=h(["pie","label","format"]),Fh=h(["pie","onclick"],function(){}),Gh=h(["pie","onmouseover"],function(){}),Hh=h(["pie","onmouseout"],function(){}),Ih=h(["donut","label","show"],!0),Jh=h(["donut","label","format"]),Kh=h(["donut","title"],""),Lh=h(["donut","onclick"],function(){}),Mh=h(["donut","onmouseover"],function(){}),Nh=h(["donut","onmouseout"],function(){}),Oh=h(["regions"],[]),Ph=h(["tooltip","show"],!0),Qh=h(["tooltip","format","title"]),Rh=h(["tooltip","format","value"]),Sh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Qh?Qh:b,l=Rh?Rh: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+""}),Th=h(["tooltip","init","show"],!1),Uh=h(["tooltip","init","x"],0),Vh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Wh=("string"==typeof of?of.replace("#",""):of.id)+"-clip",Xh=Wh+"-xaxis",Yh=Wh+"-yaxis",Zh=i(Wh),$h=i($h),_h=i(_h),ai="timeseries"===Ng,bi="categorized"===Ng,ci=!ai&&(fg||ne(gg)),di=null,ei=!1,fi=!1,gi=!1,hi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ii=he(tg,ne(Hg)?Hg:hi,sg),ji=function(){var a=[[lf.time.format("%Y/%-m/%-d"),function(){return!0}],[lf.time.format("%-m/%-d"),function(a){return a.getMonth()}],[lf.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[lf.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[lf.time.format("%I %p"),function(a){return a.getHours()}],[lf.time.format("%I:%M"),function(a){return a.getMinutes()}],[lf.time.format(":%S"),function(a){return a.getSeconds()}],[lf.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)}}(),ki=[],li=[],mi=Mg?"left":"bottom",ni=Mg?ch?"top":"bottom":ch?"right":"left",oi=Mg?lh?"bottom":"top":lh?"left":"right",pi=Mg?"left":"bottom",qi={main:function(){return"translate("+zf.left+","+zf.top+")"},context:function(){return"translate("+Af.left+","+Af.top+")"},legend:function(){return"translate("+Bf.left+","+Bf.top+")"},x:function(){return"translate(0,"+(Mg?0:Ef)+")"},y:function(){return"translate(0,"+(Mg?Ef:0)+")"},y2:function(){return"translate("+(Mg?0:Cf)+","+(Mg?1:0)+")"},subx:function(){return"translate(0,"+(Mg?0:Ff)+")"},arc:function(){return"translate("+Cf/2+","+Ef/2+")"}},ri="right"===Jg,si=0,ti=0,ui=0,vi=30,wi=30,xi=5;Of=lf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var yi,zi=function(){var a=lf.svg.line().x(Mg?function(a){return V(a.id)(a.value)}:ud).y(Mg?ud:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=xe(b.values);return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),rg[b.id]?Je(e,Xf,V(b.id),rg[b.id]):a(e)):(c=Xf(e[0].x),d=V(b.id)(e[0].value),Mg?"M "+d+" "+c:"M "+c+" "+d)}}(),Ai=function(){var a;return a=Mg?lf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):lf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?Xf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Mg?"M "+d+" "+c:"M "+c+" "+d)}}(),Bi=function(){var a=lf.svg.line().x(Mg?function(a){return W(a.id)(a.value)}:xd).y(Mg?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+$f(c[0].x)+" "+W(b.id)(c[0].value)}}(),Ci=function(){};yi=lf.svg.brush().on("brush",Se),yi.update=function(){return Gi&&Gi.select("."+f.brush).call(this),this},yi.scale=function(a){return Mg?this.y(a):this.x(a)},tf&&(Ci=lf.behavior.zoom().on("zoomstart",function(){Ci.altDomain=lf.event.sourceEvent.altKey?Xf.orgDomain():null}).on("zoom",tf?Te:null),Ci.scale=function(a){return Mg?this.y(a):this.x(a)},Ci.orgScaleExtent=function(){var a=uf?uf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Ci.updateScaleExtent=function(){var a=$b(Xf.orgDomain())/$b(Ki),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Di,Ei,Fi,Gi,Hi,Ii,Ji,Ki,Li,Mi={};if(mf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Di.selectAll(hd(a)),d=c.filter(gf),e=c.filter(hf);mf.revert(),mf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(mf.data.targets)&&Kb(a,!0),af(a)},mf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Di.selectAll(hd(a)),d=c.filter(gf),e=c.filter(hf);mf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(mf.data.targets)&&Lb(a),bf(a)},mf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Di.selectAll(hd(a)),d=c.filter(gf),e=c.filter(hf);b(d.classed(f.focused,!1)),b(e),Yd(mf.data.targets)&&Lb(a),cf()},mf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Di.selectAll(id(a)).transition().style("opacity",1),b.withLegend&&df(a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},mf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Di.selectAll(id(a)).transition().style("opacity",0),b.withLegend&&ef(a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},mf.toggle=function(a){Bc(a)?mf.hide(a):mf.show(a)},mf.unzoom=function(){yi.clear().update(),Re({withUpdateXDomain:!0})},mf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){kg[b]=a.classes[b]}),"categories"in a&&bi&&(Og=a.categories,bg.categories(Og)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},mf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},mf.selected=function(a){return lf.merge(Fi.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return lf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},mf.select=function(a,b,c){ug&&Fi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=lf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=vg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?wg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},mf.unselect=function(a,b){ug&&Fi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=lf.select(this),g="circle"===this.nodeName?se:ve,h=vg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&wg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},mf.toLine=function(a){kf(a,"line")},mf.toSpline=function(a){kf(a,"spline")},mf.toBar=function(a){kf(a,"bar")},mf.toScatter=function(a){kf(a,"scatter")},mf.toArea=function(a){kf(a,"area")},mf.toAreaSpline=function(a){kf(a,"area-spline")},mf.toPie=function(a){kf(a,"pie",{withTransform:!0})},mf.toDonut=function(a){kf(a,"donut",{withTransform:!0})},mf.groups=function(a){return c(a)?lg:(lg=a,Re(),lg)},mf.xgrids=function(a){return a?(rh=a,Re(),rh):rh},mf.xgrids.add=function(a){return a?mf.xgrids(rh.concat(a)):void 0},mf.xgrids.remove=function(a){var b=jf(a);return mf.xgrids(rh.filter(b))},mf.ygrids=function(a){return a?(th=a,Re(),th):th},mf.ygrids.add=function(a){return a?mf.ygrids(th.concat(a)):void 0},mf.ygrids.remove=function(a){var b=jf(a);return mf.ygrids(th.filter(b))},mf.regions=function(a){return c(a)?Oh:(Oh=a,Re(),Oh)},mf.regions.add=function(a){return c(a)?Oh:(Oh=Oh.concat(a),Re(),Oh)},mf.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;Di.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Oh=Oh.filter(function(b){return b.classes.indexOf(a)<0})}),Oh},mf.data.get=function(a){var b=mf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},mf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},mf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){jg[b]=a[b]}),ff(xc(mf.data.targets),{withTransition:!0}),jg):jg},mf.x=function(a){return arguments.length&&(mc(mf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),mf.data.xs},mf.xs=function(a){return arguments.length&&(nc(mf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),mf.data.xs +},mf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},mf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&($g=+a.y),b(a.y2)&&(hh=+a.y2)):$g=hh=+a,Re())},mf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(_g=+a.y),b(a.y2)&&(ih=+a.y2)):_g=ih=+a,Re())},mf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&mf.axis.max(a.max),"undefined"!=typeof a.min&&mf.axis.min(a.min))},mf.legend.show=function(a){Ig||(Ig=!0,Hi.style("visibility","visible")),df(yc(a)),Re({withTransitionForHorizontalAxis:!1})},mf.legend.hide=function(a){Ig&&me(a)&&(Ig=!1,Hi.style("visibility","hidden")),ef(yc(a)),Re({withTransitionForHorizontalAxis:!1})},mf.resize=function(a){pf=a?a.width:null,qf=a?a.height:null,We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},mf.destroy=function(){mf.data.targets=void 0,mf.data.xs={},Ji.html(""),a.onresize=null},"url"in e.data)lf.csv(e.data.url,function(a,b){Ke(b)});else if("rows"in e.data)Ke(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ke(qc(e.data.columns))}return mf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From aa9069dc40f59345c8c90d697d785d5b7649e226 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Tue, 8 Apr 2014 23:11:03 +0900 Subject: [PATCH 023/178] Gray out legend when hidden - #128 --- c3.js | 22 ++++++++++++++++++---- c3.min.js | 6 +++--- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/c3.js b/c3.js index 9c1005d..b8c4ddc 100644 --- a/c3.js +++ b/c3.js @@ -60,6 +60,7 @@ legendItem: 'c3-legend-item', legendItemEvent: 'c3-legend-item-event', legendItemTile: 'c3-legend-item-tile', + legendItemHidden: 'c3-legend-item-hidden', dragarea: 'c3-dragarea', EXPANDED: '_expanded_', SELECTED: '_selected_', @@ -3669,12 +3670,15 @@ /*-- Draw Legend --*/ + function opacityForLegend(id) { + return d3.select(selectorLegend(id)).classed(CLASS.legendItemHidden) ? 0.5 : 1; + } function toggleFocusLegend(id, focus) { var legendItem = legend.selectAll('.' + CLASS.legendItem), isTarget = function (d) { return (!id || d === id); }, notTarget = function (d) { return !isTarget(d); }; - legendItem.filter(notTarget).transition().duration(100).style('opacity', focus ? 0.3 : 1); - legendItem.filter(isTarget).transition().duration(100).style('opacity', focus ? 1 : 0.3); + legendItem.filter(notTarget).transition().duration(100).style('opacity', focus ? 0.3 : opacityForLegend); + legendItem.filter(isTarget).transition().duration(100).style('opacity', focus ? opacityForLegend : 0.3); } function focusLegend(id) { toggleFocusLegend(id, true); @@ -3685,14 +3689,14 @@ function revertLegend() { legend.selectAll('.' + CLASS.legendItem) .transition().duration(100) - .style('opacity', 1); + .style('opacity', opacityForLegend); } function showLegend(targetIds) { removeHiddenLegendIds(targetIds); legend.selectAll(selectorLegends(targetIds)) .style('visibility', 'visible') .transition() - .style('opacity', 1); + .style('opacity', opacityForLegend); updateLegend(mapToIds(c3.data.targets)); } function hideLegend(targetIds) { @@ -3936,6 +3940,11 @@ if (options.withLegend) { showLegend(targetIds); + } else { + legend.selectAll(selectorLegends(targetIds)) + .classed(CLASS.legendItemHidden, false) + .transition() + .style('opacity', 1); } redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withTransitionForHorizontalAxis: false}); @@ -3952,6 +3961,11 @@ if (options.withLegend) { hideLegend(targetIds); + } else { + legend.selectAll(selectorLegends(targetIds)) + .classed(CLASS.legendItemHidden, true) + .transition() + .style('opacity', 0.5); } redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withTransitionForHorizontalAxis: false}); diff --git a/c3.min.js b/c3.min.js index 4a1961b..0eaa22c 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.29"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",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;cCf&&(Cf=0),0>Ef&&(Ef=0),Af={top:Mg?zf.top:Hf-Gg-(ri?0:a),right:0/0,bottom:20+(ri?0:a),left:Mg?vi:zf.left},Df=Mg?zf.left-vi-wi:Cf,Ff=Mg?Ef:Hf-Af.top-Af.bottom,0>Df&&(Df=0),0>Ff&&(Ff=0),Bf={top:ri?0:Hf-a,right:0/0,bottom:0,left:ri?Gf-b:0},p(),ri&&Yd(mf.data.targets)&&(Bf.left=Cf/2+Jf)}function o(){Fi.select("line."+f.xgridFocus).attr("x1",Mg?0:-10).attr("x2",Mg?Cf:-10).attr("y1",Mg?-10:zf.top).attr("y2",Mg?-10:Ef)}function p(){Jf=Ef/2,If=.95*Jf,Kf=Xd(mf.data.targets)?.6*If:0}function q(){var a=Mg?f.axisX:f.axisY,b=lf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=lf.select(of).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return pf?pf:x()}function s(){var a=qf?qf:y();return a>0?a:320}function t(){return Yd(mf.data.targets)?0:rf?rf:Mg||!Zg||ch?1:v("y")}function u(){var a=1;return Yd(mf.data.targets)?0:sf?sf:ri?P()+(gh&&!Mg?v("y2"):a):gh?lh||Mg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||Zg?"y2"!==a||gh?(gb(a).isInner?30:40)+("y2"===a?-10:0):xi:Ig&&!ri?10:1}function x(){return+lf.select(of).style("width").replace("px","")}function y(){return+lf.select(of).style("height").replace("px","")}function z(a){return a?-5:-(zf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Mg)}function C(){return A(!Mg)}function D(){return z(Mg)}function E(){return A(Mg)}function F(a){return a?Cf+2+4:zf.left+20}function G(a){return a?80:Ef+2}function H(){return F(!Mg)}function I(){return G(!Mg)}function J(){return F(Mg)}function K(){return G(Mg)}function L(){var a=Mg?Ef:Cf,b=vc(),c=Vb()*(Ud(mf.data.targets)?(b-(bi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){si=a}function N(a){ti=a}function O(a){ui=a}function P(){return Ig?ri?ti*(si+1):Gf:0}function Q(){return Ig?ri?Hf:ui*(si+1):0}function R(){var a,b=!Xf;Pf=Mg?1:0,Qf=Mg?Ef:Cf,Rf=Mg?0:Ef,Sf=Mg?Cf:1,Tf=Pf,Uf=Qf,Vf=Mg?0:Ff,Wf=Mg?Df:1,Xf=T(Pf,Qf,b?void 0:Xf.domain(),function(){return bg.tickOffset()}),Yf=U(Rf,Sf),Zf=U(Rf,Sf),$f=T(Pf,Qf,Ki,function(a){return a%1?0:eg.tickOffset()}),_f=U(Vf,Wf),ag=U(Vf,Wf),a=$(),bg=X(Xf,mi,a),eg=X($f,pi,a),cg=Y(Yf,ni,dh,fh),dg=Y(Zf,oi,mh,oh),b||(yi.scale($f),tf&&Ci.scale(Xf)),S()}function S(){Lf=Db(),Mf=Eb(),Nf=Eb(.98)}function T(a,b,e,f){var g=(ai?lf.time.scale():lf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),bi){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return lf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?Zf:Yf}function W(a){return"y2"===Z(a)?ag:_f}function X(a,b,c){var d=(bi?Bb():lf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),bi?d.tickCentered(Pg):d.tickOffset=function(){var a=Mg?Ef:Cf;return a*Vb()/vc()/2},bi&&d.categories(Og),d}function Y(a,b,c,d){return lf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in mg?mg[a]:"y"}function $(){var a=ai?ji:bi?Oc:function(a){return 0>a?a.toFixed(0):a};return Qg&&("function"==typeof Qg?a=Qg:ai&&(a=function(a){return lf.time.format(Qg)(a)})),a}function _(a){var b;return"y"===a?b=bh:"y2"===a?b=kh:"x"===a&&(b=Yg),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?bh=b:"y2"===a?kh=b:"x"===a&&(Yg=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Mg?"inner-top":"inner-right")}function eb(){return cb("y",Mg?"inner-right":"inner-top")}function fb(){return cb("y2",Mg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?Cf/2:Cf:b.isBottom?-Ef:b.isMiddle?-Ef/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Mg,db())}function ob(){return kb(Mg,eb())}function pb(){return kb(Mg,fb())}function qb(){return lb(!Mg,db())}function rb(){return lb(Mg,eb())}function sb(){return lb(Mg,fb())}function tb(){var a=db();return Mg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Mg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Mg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Mg,db())}function xb(){return mb(Mg,eb())}function yb(){return mb(Mg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return lf.selectAll("."+c+" .tick text").each(function(){var a=this.getBBox();bb?20:b}function Ab(){Fi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Fi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Fi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return lf.min(Object.keys(i).map(function(a){return lf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(lg.length>0)for(g=Nc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return lf.max(Object.keys(i).map(function(a){return lf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?ih:_g,n="y2"===c?hh:$g,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?jh:ah,r=pd()&&Mg;return 0===l.length?"y2"===c?Zf.domain():Yf.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=qd(o,p),j=$b(Yf.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&eh&&(f=b(eh.top)?eh.top:e,g=b(eh.bottom)?eh.bottom:e),"y2"===c&&nh&&(f=b(nh.top)?nh.top:e,g=b(nh.bottom)?nh.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Ki),c=$b(Xf.domain());return a||0===c?1:b/c}function Wb(a){return Wg?Wg:lf.min(a,function(a){return lf.min(a.values,function(a){return a.x})})}function Xb(a){return Vg?Vg:lf.max(a,function(a){return lf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return bi?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=ai?new Date(c.getTime()-e):c-e,g=ai?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return fg&&a===fg||ne(gg)&&oe(gg,a)}function fc(a){return!ec(a)}function gc(a){return fg?fg:ne(gg)?gg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=mf.data.xs[b])}),c}function ic(a,b){return a in mf.data.xs&&mf.data.xs[a]&&mf.data.xs[a][b]?mf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){gg[b]=a[b]})}function kc(a){return 1===lf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=jg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),mf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=ai?a?a instanceof Date?a:ie(a):ie(ic(b,c)):ci&&!bi?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?mf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):fg?(d=Object.keys(mf.data.xs),mf.data.xs[c]=d.length>0?mf.data.xs[d[0]]:void 0):ne(gg)&&(mf.data.xs[c]=hc(f,mf.data.targets)):mf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!mf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=ig(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return ci&&bi&&0===c&&g&&(0===e&&(Og=[]),Og.push(g)),("undefined"==typeof a[b]||mf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),ng&&Sd(xc(c).filter(function(a){return!(a in og)}),ng),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function tc(a){return a>0&&mf.data.targets[0].values[a-1]?mf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?mf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?mf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(mf.data.targets)}function zc(a,b){var c,d=xc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(ai?new Date(h):h);i.push(d)}return i}function Gc(a){ki=ki.concat(a)}function Hc(a){ki=ki.filter(function(b){return a.indexOf(b)<0})}function Ic(a){li=li.concat(a)}function Jc(a){li=li.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return lf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Ed(){return qg&&"desc"===qg.toLowerCase()}function Fd(){return qg&&"asc"===qg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof qg&&a.sort(qg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(mf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Ph&&0!==m.length&&(Ii.html(Sh(a,$(),l,ii)).style("display","block"),d=Ii.property("offsetWidth"),e=Ii.property("offsetHeight"),k?(g=Cf/2+c[0],i=Ef/2+c[1]+20):(Mg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Xf(m[0].x)+20):(f=q(),g=f+t()+Xf(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Ii.style("top",i+"px").style("left",g+"px"))}function Id(){Ii.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Ph&&(Vd(mf.data.targets)||Yd(mf.data.targets)||Fi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Mg?"y1":"x1",ud).attr(Mg?"y2":"x2",ud))}function Kd(){Fi.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?Xf(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Bh?Bh:b?2*a.tickOffset()*Ch/b:0}function Sd(a,b){yc(a).forEach(function(a){Mi[a]=b===og[a],og[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){og[a.id]===b&&(c=!0),a.id in og||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in og)||"line"===og[b]||"spline"===og[b]||"area"===og[b]||"area-spline"===og[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===og[b]||"area-spline"===og[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===og[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===og[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===og[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===og[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ie(b){var c;if(!b)throw Error(b+" can not be parsed as d3.time with format "+hg+". Maybe 'x' of this data is not defined. See data.x or data.xs option.");try{c=hg?lf.time.format(hg).parse(b):new Date(b)}catch(d){c=void 0}return c||a.console.error("Failed to parse x '"+b+"' to Date with format "+hg),c}function je(a,b){var c=lf.mouse(a),d=lf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?Yf:Zf,d=Mg?1:0,e=Mg?0:1;return Math.pow(Xf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Bg(b,a.node()),Fi.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Mg?Md:Ld).attr("cy",Mg?Ld:Md).attr("stroke",function(){return ii(b)}).attr("r",1.4*Ah).transition().duration(100).attr("r",Ah)}function se(a,b,c){Cg(b,a.node()),Fi.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Bg(b,a.node()),a.transition().duration(100).style("fill",function(){return lf.rgb(ii(b)).darker(1)})}function ve(a,b){Cg(b,a.node()),a.transition().duration(100).style("fill",function(){return ii(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Fi.selectAll("."+f.circles+gd(c)):Fi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",zh)}function Ae(a){ye(a).filter(function(){return lf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",wh)}function Be(a){return Fi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Mg?1:0,f=Mg?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Mg?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBBox();return Mg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(bg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Mg&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Je(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function Ke(b){var c,d,e;if(Ji=lf.select(of),Ji.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Ji.html(""),Ji.classed("c3",!0),mf.data.xs={},mf.data.targets=rc(b),n(),R(),Xf.domain(lf.extent(Zb(mf.data.targets))),Yf.domain(Ub(mf.data.targets,"y")),Zf.domain(Ub(mf.data.targets,"y2")),$f.domain(Xf.domain()),_f.domain(Yf.domain()),ag.domain(Zf.domain()),Ki=Xf.domain(),yi.scale($f),tf&&Ci.scale(Xf),Di=Ji.append("svg").attr("width",Cf+zf.left+zf.right).attr("height",Ef+zf.top+zf.bottom).on("mouseenter",wf).on("mouseleave",xf),Ei=Di.append("defs"),Ei.append("clipPath").attr("id",Wh).append("rect").attr("width",Cf).attr("height",Ef),Ei.append("clipPath").attr("id",Xh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Ei.append("clipPath").attr("id",Yh).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Fi=Di.append("g").attr("transform",qi.main),Gi=Fg?Di.append("g").attr("transform",qi.context):null,Hi=Di.append("g").attr("transform",qi.legend),Ig||(Hi.style("visibility","hidden"),li=xc(mf.data.targets)),Ii=lf.select(of).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),ff(xc(mf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Fi.append("g").attr("class",f.axisX).attr("clip-path",Mg?"":$h).attr("transform",qi.x).append("text").attr("class",f.axisXLabel).attr("transform",Mg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),Zg&&Fi.append("g").attr("class",f.axisY).attr("clip-path",Mg?_h:"").attr("transform",qi.y).append("text").attr("class",f.axisYLabel).attr("transform",Mg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),gh&&Fi.append("g").attr("class",f.axisY2).attr("transform",qi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Mg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Fi.append("g").attr("clip-path",Zh).attr("class",f.grid),ph&&d.append("g").attr("class",f.xgrids),ne(rh)&&d.append("g").attr("class",f.xgridLines),xh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),sh&&d.append("g").attr("class",f.ygrids),ne(th)&&d.append("g").attr("class",f.ygridLines),Fi.append("g").attr("clip-path",Zh).attr("class",f.regions),Fi.append("g").attr("clip-path",Zh).attr("class",f.chart),c=Fi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",tf?Mg?"ns-resize":"ew-resize":null),Fi.select("."+f.chart).append("g").attr("class",f.chartBars),Fi.select("."+f.chart).append("g").attr("class",f.chartLines),Fi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",qi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Fi.select("."+f.chart).append("g").attr("class",f.chartTexts),tf&&Fi.insert("rect",vf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Cf).attr("height",Ef).style("opacity",0).style("cursor",Mg?"ns-resize":"ew-resize").call(Ci).on("dblclick.zoom",null),Xg&&yi.extent("function"!=typeof Xg?Xg:Xg(Zb())),Fg&&(Gi.append("g").attr("clip-path",Zh).attr("class",f.chart),Gi.select("."+f.chart).append("g").attr("class",f.chartBars),Gi.select("."+f.chart).append("g").attr("class",f.chartLines),Gi.append("g").attr("clip-path",Zh).attr("class",f.brush).call(yi).selectAll("rect").attr(Mg?"width":"height",Mg?Df:Ff),Gi.append("g").attr("class",f.axisX).attr("transform",qi.subx).attr("clip-path",Mg?"":$h)),Xe(mf.data.targets),Mg?Fi.select("."+f.axisX).style("opacity",0).call(bg):(Fi.select("."+f.axisY).style("opacity",0).call(cg),Fi.select("."+f.axisY2).style("opacity",0).call(dg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Th){if(ai&&"string"==typeof Uh){for(Uh=ie(Uh),e=0;e0){d=[];for(var g in jg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function Pe(a){Yd(mf.data.targets)||ug&&(di=a,Fi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),ei=!0,Dg())}function Qe(){Yd(mf.data.targets)||ug&&(Fi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Fi.selectAll("."+f.shape).classed(f.INCLUDED,!1),ei=!1,Eg())}function Re(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Nd(),U=Yd(mf.data.targets),V=Dc(mf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?yf:0,O=B?N:0,P=C?N:0,H&&Ig&&ff(xc(mf.data.targets),a),G&&(Xf.domain(lf.extent(Zb(V))),Ki=Xf.domain(),tf&&Ci.scale(Xf).updateScaleExtent(),$f.domain(Xf.domain()),yi.scale($f)),F&&(Xf.domain(yi.empty()?Ki:yi.extent()),tf&&Ci.scale(Xf).updateScaleExtent()),Yf.domain(Ub(V,"y")),Zf.domain(Ub(V,"y2")),Vd(V)||(Q=Fc(Ec(V)).sort(),bg.tickValues(Q),eg.tickValues(Q)),c=Fi.select("."+f.axisX).style("opacity",U?0:1),(Mg||D)&&(c=c.transition().duration(P)),c.call(bg),e=Fi.select("."+f.axisY).style("opacity",U?0:1),(!Mg||D)&&(e=e.transition().duration(P)),e.call(cg),Fi.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(dg),F&&Rg&&Q){for(R=1;R=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=Xf.ticks(10);g=Fi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Mg?0:function(a){return Xf(a)-bg.tickOffset()}).attr("x2",Mg?Cf:function(a){return Xf(a)-bg.tickOffset()}).attr("y1",Mg?function(a){return Xf(a)-bg.tickOffset()}:zf.top).attr("y2",Mg?function(a){return Xf(a)-bg.tickOffset()}:Ef).style("opacity",function(){return+lf.select(this).attr(Mg?"y1":"x1")===(Mg?Ef:0)?0:1}),g.exit().remove()}ne(rh)&&(i=Fi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(rh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Mg?"":"rotate(-90)").attr("dx",Mg?0:-zf.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Mg?0:vd).attr("x2",Mg?Cf:vd).attr("y1",Mg?vd:zf.top).attr("y2",Mg?vd:Ef).style("opacity",1),i.select("text").transition().duration(N).attr("x",Mg?Cf:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&sh&&(k=Fi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Yf.ticks(uh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Mg?Yf:0).attr("x2",Mg?Yf:Cf).attr("y1",Mg?0:Yf).attr("y2",Mg?Ef:Yf),k.exit().remove()),y&&ne(th)&&(l=Fi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(th),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Mg?"rotate(-90)":"").attr("dx",Mg?0:-zf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Mg?wd:0).attr("x2",Mg?wd:Cf).attr("y1",Mg?0:wd).attr("y2",Mg?Ef:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Mg?0:Cf).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Fi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ii(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Fi.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Mg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Fi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",zi).style("opacity",1),Fi.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Ai).style("opacity",Li),n=Fi.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",wh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Mg?Md:Ld).attr("cy",Mg?Ld:Md),n.exit().remove(),Fi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=lf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Fi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Fi.select("."+f.chartArcsTitle).style("opacity",Xd(mf.data.targets)?1:0),Fg&&(null!==lf.event&&"zoom"===lf.event.type&&yi.extent(Xf.orgDomain()).update(),z&&(Gi.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(eg),yi.empty()||yi.extent(Xf.orgDomain()).update(),J=Ee(T,!0),s=Gi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ii(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Gi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Bi).style("opacity",1))),Fi.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Fi.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Mg?Md:Ld).attr("cy",Mg?Ld:Md),t=Fi.select("."+f.eventRects),ne(gg)&&!kc(gg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Fi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Cf).attr("height",Ef)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),ci&&!bi?(x=function(a,b){var c=tc(b),d=uc(b),e=mf.data.xs[a.id][b];return(Xf(d?d:e+50)-Xf(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=mf.data.xs[a.id][b];return(Xf(d)+Xf(c?c:d-50))/2}):(x=L(),w=function(a){return Xf(a.x)-x/2}),v=wc(),Fi.select("."+f.eventRects).datum(v?v.values:[]),u=Fi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Mg?0:w).attr("y",Mg?w:0).attr("width",Mg?Cf:x).attr("height",Mg?x:Ef),u.exit().remove()),q=Fi.select("."+f.regions).selectAll("rect."+f.region).data(Oh),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Mg?0:cc).attr("y",Mg?cc:zf.top).attr("width",Mg?Cf:dc).attr("height",Mg?dc:Ef).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),xc(mf.data.targets).forEach(function(a){Mi[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===lf.event.sourceEvent.type&&Ci.altDomain?(Xf.domain(Ci.altDomain),void Ci.scale(Xf).updateScaleExtent()):(bi&&Xf.orgDomain()[0]===Ki[0]&&Xf.domain([Ki[0]-1e-10,Xf.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===lf.event.sourceEvent.type&&(fi=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Di.attr("width",Gf).attr("height",Hf),Di.select("#"+Wh).select("rect").attr("width",Cf).attr("height",Ef),Di.select("#"+Xh).select("rect").attr("width",H),Di.select("#"+Yh).select("rect").attr("width",J),Di.select("."+f.zoomRect).attr("width",Cf).attr("height",Ef)}function We(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Fi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ii(a)}),e=Fi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ii(a)}).style("stroke","none").style("cursor",function(a){return wg(a)?"pointer":null}),c=Fi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ii(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Li=+lf.select(this).style("opacity"),0}).style("fill",function(a){return ii(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ii(a)}).style("cursor",function(a){return wg(a)?"pointer":null}),a.forEach(function(a){Fi.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Fi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Of(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ii(a.data)}).style("cursor",function(a){return wg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),af(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,lf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),cf(),Id(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Fg&&(n=Gi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ii(a)}),l=Gi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ii(a)})),Di.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),mf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBBox(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=ri?j:i,l=ri?Q():P();return d&&(w=0,C=0,t=0,u=0),Ig&&!Cc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=ri?u:t,void(Lg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,ri?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Hi.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Kg?Kg(a):mf.toggle(a)}).on("mouseover",function(a){mf.focus(a)}).on("mouseout",function(){mf.revert()}),l.append("text").text(function(a){return d(jg[a])?jg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",ri?g:-200).attr("y",ri?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",ri?h:-200).attr("y",ri?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return ii(a)}).attr("x",ri?g:-200).attr("y",ri?-200:i).attr("width",10).attr("height",10),Hi.selectAll("text").data(a).text(function(a){return d(jg[a])?jg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Hi.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Hi.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Ve(),q&&m(p)}function gf(a){return zc(mf.data.targets,a.id)}function hf(a){return"data"in a&&zc(mf.data.targets,a.data.id)}function jf(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 kf(a,b,c){var d=!Yd(mf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var lf=a.d3?a.d3:a.require?a.require("d3"):void 0,mf={data:{},axis:{},legend:{}},nf={},of=h(["bindto"],"#chart"),pf=h(["size","width"]),qf=h(["size","height"]),rf=h(["padding","left"]),sf=h(["padding","right"]),tf=h(["zoom","enabled"],!1),uf=h(["zoom","extent"]),vf=h(["zoom","privileged"],!1),wf=h(["onenter"],function(){}),xf=h(["onleave"],function(){}),yf=h(["transition","duration"],350);g("data","data is required in config");var zf,Af,Bf,Cf,Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg=h(["data","x"]),gg=h(["data","xs"],{}),hg=h(["data","x_format"]),ig=h(["data","id_converter"],function(a){return a}),jg=h(["data","names"],{}),kg=h(["data","classes"],{}),lg=h(["data","groups"],[]),mg=h(["data","axes"],{}),ng=h(["data","type"]),og=h(["data","types"],{}),pg=h(["data","labels"],{}),qg=h(["data","order"]),rg=h(["data","regions"],{}),sg=h(["data","color"]),tg=h(["data","colors"],{}),ug=h(["data","selection","enabled"],!1),vg=h(["data","selection","grouped"],!1),wg=h(["data","selection","isselectable"],function(){return!0}),xg=h(["data","selection","multiple"],!0),yg=h(["data","onclick"],function(){}),zg=h(["data","onenter"],function(){}),Ag=h(["data","onleave"],function(){}),Bg=h(["data","onselected"],function(){}),Cg=h(["data","onunselected"],function(){}),Dg=h(["data","ondragstart"],function(){}),Eg=h(["data","ondragend"],function(){}),Fg=h(["subchart","show"],!1),Gg=Fg?h(["subchart","size","height"],60):0,Hg=h(["color","pattern"],[]),Ig=h(["legend","show"],!0),Jg=h(["legend","position"],"bottom"),Kg=h(["legend","item","onclick"]),Lg=h(["legend","equally"],!1),Mg=h(["axis","rotated"],!1),Ng=h(["axis","x","type"],"indexed"),Og=h(["axis","x","categories"],[]),Pg=h(["axis","x","tick","centered"],!1),Qg=h(["axis","x","tick","format"]),Rg=h(["axis","x","tick","culling"],{}),Sg=h(["axis","x","tick","culling","max"],"categorized"===Ng?1/0:10),Tg=h(["axis","x","tick","count"]),Ug=h(["axis","x","tick","fit"],!1),Vg=h(["axis","x","max"]),Wg=h(["axis","x","min"]),Xg=h(["axis","x","default"]),Yg=h(["axis","x","label"],{}),Zg=h(["axis","y","show"],!0),$g=h(["axis","y","max"]),_g=h(["axis","y","min"]),ah=h(["axis","y","center"]),bh=h(["axis","y","label"],{}),ch=h(["axis","y","inner"],!1),dh=h(["axis","y","tick","format"]),eh=h(["axis","y","padding"],{}),fh=h(["axis","y","ticks"],10),gh=h(["axis","y2","show"],!1),hh=h(["axis","y2","max"]),ih=h(["axis","y2","min"]),jh=h(["axis","y2","center"]),kh=h(["axis","y2","label"],{}),lh=h(["axis","y2","inner"],!1),mh=h(["axis","y2","tick","format"]),nh=h(["axis","y2","padding"],{}),oh=h(["axis","y2","ticks"],10),ph=h(["grid","x","show"],!1),qh=h(["grid","x","type"],"tick"),rh=h(["grid","x","lines"],[]),sh=h(["grid","y","show"],!1),th=h(["grid","y","lines"],[]),uh=h(["grid","y","ticks"],10),vh=h(["point","show"],!0),wh=vh?h(["point","r"],2.5):0,xh=h(["point","focus","line","enabled"],!0),yh=h(["point","focus","expand","enabled"],!0),zh=h(["point","focus","expand","r"],yh?4:wh),Ah=h(["point","focus","select","r"],8),Bh=h(["bar","width"]),Ch=h(["bar","width","ratio"],.6),Dh=h(["pie","label","show"],!0),Eh=h(["pie","label","format"]),Fh=h(["pie","onclick"],function(){}),Gh=h(["pie","onmouseover"],function(){}),Hh=h(["pie","onmouseout"],function(){}),Ih=h(["donut","label","show"],!0),Jh=h(["donut","label","format"]),Kh=h(["donut","title"],""),Lh=h(["donut","onclick"],function(){}),Mh=h(["donut","onmouseover"],function(){}),Nh=h(["donut","onmouseout"],function(){}),Oh=h(["regions"],[]),Ph=h(["tooltip","show"],!0),Qh=h(["tooltip","format","title"]),Rh=h(["tooltip","format","value"]),Sh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Qh?Qh:b,l=Rh?Rh: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+""}),Th=h(["tooltip","init","show"],!1),Uh=h(["tooltip","init","x"],0),Vh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Wh=("string"==typeof of?of.replace("#",""):of.id)+"-clip",Xh=Wh+"-xaxis",Yh=Wh+"-yaxis",Zh=i(Wh),$h=i($h),_h=i(_h),ai="timeseries"===Ng,bi="categorized"===Ng,ci=!ai&&(fg||ne(gg)),di=null,ei=!1,fi=!1,gi=!1,hi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ii=he(tg,ne(Hg)?Hg:hi,sg),ji=function(){var a=[[lf.time.format("%Y/%-m/%-d"),function(){return!0}],[lf.time.format("%-m/%-d"),function(a){return a.getMonth()}],[lf.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[lf.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[lf.time.format("%I %p"),function(a){return a.getHours()}],[lf.time.format("%I:%M"),function(a){return a.getMinutes()}],[lf.time.format(":%S"),function(a){return a.getSeconds()}],[lf.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)}}(),ki=[],li=[],mi=Mg?"left":"bottom",ni=Mg?ch?"top":"bottom":ch?"right":"left",oi=Mg?lh?"bottom":"top":lh?"left":"right",pi=Mg?"left":"bottom",qi={main:function(){return"translate("+zf.left+","+zf.top+")"},context:function(){return"translate("+Af.left+","+Af.top+")"},legend:function(){return"translate("+Bf.left+","+Bf.top+")"},x:function(){return"translate(0,"+(Mg?0:Ef)+")"},y:function(){return"translate(0,"+(Mg?Ef:0)+")"},y2:function(){return"translate("+(Mg?0:Cf)+","+(Mg?1:0)+")"},subx:function(){return"translate(0,"+(Mg?0:Ff)+")"},arc:function(){return"translate("+Cf/2+","+Ef/2+")"}},ri="right"===Jg,si=0,ti=0,ui=0,vi=30,wi=30,xi=5;Of=lf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var yi,zi=function(){var a=lf.svg.line().x(Mg?function(a){return V(a.id)(a.value)}:ud).y(Mg?ud:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=xe(b.values);return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),rg[b.id]?Je(e,Xf,V(b.id),rg[b.id]):a(e)):(c=Xf(e[0].x),d=V(b.id)(e[0].value),Mg?"M "+d+" "+c:"M "+c+" "+d)}}(),Ai=function(){var a;return a=Mg?lf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):lf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?Xf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Mg?"M "+d+" "+c:"M "+c+" "+d)}}(),Bi=function(){var a=lf.svg.line().x(Mg?function(a){return W(a.id)(a.value)}:xd).y(Mg?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+$f(c[0].x)+" "+W(b.id)(c[0].value)}}(),Ci=function(){};yi=lf.svg.brush().on("brush",Se),yi.update=function(){return Gi&&Gi.select("."+f.brush).call(this),this},yi.scale=function(a){return Mg?this.y(a):this.x(a)},tf&&(Ci=lf.behavior.zoom().on("zoomstart",function(){Ci.altDomain=lf.event.sourceEvent.altKey?Xf.orgDomain():null}).on("zoom",tf?Te:null),Ci.scale=function(a){return Mg?this.y(a):this.x(a)},Ci.orgScaleExtent=function(){var a=uf?uf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Ci.updateScaleExtent=function(){var a=$b(Xf.orgDomain())/$b(Ki),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Di,Ei,Fi,Gi,Hi,Ii,Ji,Ki,Li,Mi={};if(mf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Di.selectAll(hd(a)),d=c.filter(gf),e=c.filter(hf);mf.revert(),mf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(mf.data.targets)&&Kb(a,!0),af(a)},mf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Di.selectAll(hd(a)),d=c.filter(gf),e=c.filter(hf);mf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(mf.data.targets)&&Lb(a),bf(a)},mf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Di.selectAll(hd(a)),d=c.filter(gf),e=c.filter(hf);b(d.classed(f.focused,!1)),b(e),Yd(mf.data.targets)&&Lb(a),cf()},mf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Di.selectAll(id(a)).transition().style("opacity",1),b.withLegend&&df(a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},mf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Di.selectAll(id(a)).transition().style("opacity",0),b.withLegend&&ef(a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},mf.toggle=function(a){Bc(a)?mf.hide(a):mf.show(a)},mf.unzoom=function(){yi.clear().update(),Re({withUpdateXDomain:!0})},mf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){kg[b]=a.classes[b]}),"categories"in a&&bi&&(Og=a.categories,bg.categories(Og)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},mf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},mf.selected=function(a){return lf.merge(Fi.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return lf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},mf.select=function(a,b,c){ug&&Fi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=lf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=vg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?wg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},mf.unselect=function(a,b){ug&&Fi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=lf.select(this),g="circle"===this.nodeName?se:ve,h=vg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&wg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},mf.toLine=function(a){kf(a,"line")},mf.toSpline=function(a){kf(a,"spline")},mf.toBar=function(a){kf(a,"bar")},mf.toScatter=function(a){kf(a,"scatter")},mf.toArea=function(a){kf(a,"area")},mf.toAreaSpline=function(a){kf(a,"area-spline")},mf.toPie=function(a){kf(a,"pie",{withTransform:!0})},mf.toDonut=function(a){kf(a,"donut",{withTransform:!0})},mf.groups=function(a){return c(a)?lg:(lg=a,Re(),lg)},mf.xgrids=function(a){return a?(rh=a,Re(),rh):rh},mf.xgrids.add=function(a){return a?mf.xgrids(rh.concat(a)):void 0},mf.xgrids.remove=function(a){var b=jf(a);return mf.xgrids(rh.filter(b))},mf.ygrids=function(a){return a?(th=a,Re(),th):th},mf.ygrids.add=function(a){return a?mf.ygrids(th.concat(a)):void 0},mf.ygrids.remove=function(a){var b=jf(a);return mf.ygrids(th.filter(b))},mf.regions=function(a){return c(a)?Oh:(Oh=a,Re(),Oh)},mf.regions.add=function(a){return c(a)?Oh:(Oh=Oh.concat(a),Re(),Oh)},mf.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;Di.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Oh=Oh.filter(function(b){return b.classes.indexOf(a)<0})}),Oh},mf.data.get=function(a){var b=mf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},mf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},mf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){jg[b]=a[b]}),ff(xc(mf.data.targets),{withTransition:!0}),jg):jg},mf.x=function(a){return arguments.length&&(mc(mf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),mf.data.xs},mf.xs=function(a){return arguments.length&&(nc(mf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),mf.data.xs -},mf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},mf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&($g=+a.y),b(a.y2)&&(hh=+a.y2)):$g=hh=+a,Re())},mf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(_g=+a.y),b(a.y2)&&(ih=+a.y2)):_g=ih=+a,Re())},mf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&mf.axis.max(a.max),"undefined"!=typeof a.min&&mf.axis.min(a.min))},mf.legend.show=function(a){Ig||(Ig=!0,Hi.style("visibility","visible")),df(yc(a)),Re({withTransitionForHorizontalAxis:!1})},mf.legend.hide=function(a){Ig&&me(a)&&(Ig=!1,Hi.style("visibility","hidden")),ef(yc(a)),Re({withTransitionForHorizontalAxis:!1})},mf.resize=function(a){pf=a?a.width:null,qf=a?a.height:null,We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},mf.destroy=function(){mf.data.targets=void 0,mf.data.xs={},Ji.html(""),a.onresize=null},"url"in e.data)lf.csv(e.data.url,function(a,b){Ke(b)});else if("rows"in e.data)Ke(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ke(qc(e.data.columns))}return mf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file +!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.29"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cDf&&(Df=0),0>Ff&&(Ff=0),Bf={top:Ng?Af.top:If-Hg-(si?0:a),right:0/0,bottom:20+(si?0:a),left:Ng?wi:Af.left},Ef=Ng?Af.left-wi-xi:Df,Gf=Ng?Ff:If-Bf.top-Bf.bottom,0>Ef&&(Ef=0),0>Gf&&(Gf=0),Cf={top:si?0:If-a,right:0/0,bottom:0,left:si?Hf-b:0},p(),si&&Yd(nf.data.targets)&&(Cf.left=Df/2+Kf)}function o(){Gi.select("line."+f.xgridFocus).attr("x1",Ng?0:-10).attr("x2",Ng?Df:-10).attr("y1",Ng?-10:Af.top).attr("y2",Ng?-10:Ff)}function p(){Kf=Ff/2,Jf=.95*Kf,Lf=Xd(nf.data.targets)?.6*Jf:0}function q(){var a=Ng?f.axisX:f.axisY,b=mf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=mf.select(pf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return qf?qf:x()}function s(){var a=rf?rf:y();return a>0?a:320}function t(){return Yd(nf.data.targets)?0:sf?sf:Ng||!$g||dh?1:v("y")}function u(){var a=1;return Yd(nf.data.targets)?0:tf?tf:si?P()+(hh&&!Ng?v("y2"):a):hh?mh||Ng?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||$g?"y2"!==a||hh?(gb(a).isInner?30:40)+("y2"===a?-10:0):yi:Jg&&!si?10:1}function x(){return+mf.select(pf).style("width").replace("px","")}function y(){return+mf.select(pf).style("height").replace("px","")}function z(a){return a?-5:-(Af.left-1)}function A(a){return a?-20:-1}function B(){return z(!Ng)}function C(){return A(!Ng)}function D(){return z(Ng)}function E(){return A(Ng)}function F(a){return a?Df+2+4:Af.left+20}function G(a){return a?80:Ff+2}function H(){return F(!Ng)}function I(){return G(!Ng)}function J(){return F(Ng)}function K(){return G(Ng)}function L(){var a=Ng?Ff:Df,b=vc(),c=Vb()*(Ud(nf.data.targets)?(b-(ci?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){ti=a}function N(a){ui=a}function O(a){vi=a}function P(){return Jg?si?ui*(ti+1):Hf:0}function Q(){return Jg?si?If:vi*(ti+1):0}function R(){var a,b=!Yf;Qf=Ng?1:0,Rf=Ng?Ff:Df,Sf=Ng?0:Ff,Tf=Ng?Df:1,Uf=Qf,Vf=Rf,Wf=Ng?0:Gf,Xf=Ng?Ef:1,Yf=T(Qf,Rf,b?void 0:Yf.domain(),function(){return cg.tickOffset()}),Zf=U(Sf,Tf),$f=U(Sf,Tf),_f=T(Qf,Rf,Li,function(a){return a%1?0:fg.tickOffset()}),ag=U(Wf,Xf),bg=U(Wf,Xf),a=$(),cg=X(Yf,ni,a),fg=X(_f,qi,a),dg=Y(Zf,oi,eh,gh),eg=Y($f,pi,nh,ph),b||(zi.scale(_f),uf&&Di.scale(Yf)),S()}function S(){Mf=Db(),Nf=Eb(),Of=Eb(.98)}function T(a,b,e,f){var g=(bi?mf.time.scale():mf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),ci){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return mf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?$f:Zf}function W(a){return"y2"===Z(a)?bg:ag}function X(a,b,c){var d=(ci?Bb():mf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),ci?d.tickCentered(Qg):d.tickOffset=function(){var a=Ng?Ff:Df;return a*Vb()/vc()/2},ci&&d.categories(Pg),d}function Y(a,b,c,d){return mf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in ng?ng[a]:"y"}function $(){var a=bi?ki:ci?Oc:function(a){return 0>a?a.toFixed(0):a};return Rg&&("function"==typeof Rg?a=Rg:bi&&(a=function(a){return mf.time.format(Rg)(a)})),a}function _(a){var b;return"y"===a?b=ch:"y2"===a?b=lh:"x"===a&&(b=Zg),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?ch=b:"y2"===a?lh=b:"x"===a&&(Zg=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Ng?"inner-top":"inner-right")}function eb(){return cb("y",Ng?"inner-right":"inner-top")}function fb(){return cb("y2",Ng?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?Df/2:Df:b.isBottom?-Ff:b.isMiddle?-Ff/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Ng,db())}function ob(){return kb(Ng,eb())}function pb(){return kb(Ng,fb())}function qb(){return lb(!Ng,db())}function rb(){return lb(Ng,eb())}function sb(){return lb(Ng,fb())}function tb(){var a=db();return Ng?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Ng?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Ng?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Ng,db())}function xb(){return mb(Ng,eb())}function yb(){return mb(Ng,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBBox();bb?20:b}function Ab(){Gi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Gi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Gi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return mf.min(Object.keys(i).map(function(a){return mf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(mg.length>0)for(g=Nc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return mf.max(Object.keys(i).map(function(a){return mf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?jh:ah,n="y2"===c?ih:_g,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?kh:bh,r=pd()&&Ng;return 0===l.length?"y2"===c?$f.domain():Zf.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=qd(o,p),j=$b(Zf.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&fh&&(f=b(fh.top)?fh.top:e,g=b(fh.bottom)?fh.bottom:e),"y2"===c&&oh&&(f=b(oh.top)?oh.top:e,g=b(oh.bottom)?oh.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Li),c=$b(Yf.domain());return a||0===c?1:b/c}function Wb(a){return Xg?Xg:mf.min(a,function(a){return mf.min(a.values,function(a){return a.x})})}function Xb(a){return Wg?Wg:mf.max(a,function(a){return mf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return ci?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=bi?new Date(c.getTime()-e):c-e,g=bi?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return gg&&a===gg||ne(hg)&&oe(hg,a)}function fc(a){return!ec(a)}function gc(a){return gg?gg:ne(hg)?hg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=nf.data.xs[b])}),c}function ic(a,b){return a in nf.data.xs&&nf.data.xs[a]&&nf.data.xs[a][b]?nf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){hg[b]=a[b]})}function kc(a){return 1===mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=kg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),nf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=bi?a?a instanceof Date?a:ie(a):ie(ic(b,c)):di&&!ci?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):gg?(d=Object.keys(nf.data.xs),nf.data.xs[c]=d.length>0?nf.data.xs[d[0]]:void 0):ne(hg)&&(nf.data.xs[c]=hc(f,nf.data.targets)):nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=jg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return di&&ci&&0===c&&g&&(0===e&&(Pg=[]),Pg.push(g)),("undefined"==typeof a[b]||nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),og&&Sd(xc(c).filter(function(a){return!(a in pg)}),og),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function tc(a){return a>0&&nf.data.targets[0].values[a-1]?nf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?nf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?nf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(nf.data.targets)}function zc(a,b){var c,d=xc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(bi?new Date(h):h);i.push(d)}return i}function Gc(a){li=li.concat(a)}function Hc(a){li=li.filter(function(b){return a.indexOf(b)<0})}function Ic(a){mi=mi.concat(a)}function Jc(a){mi=mi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Ed(){return rg&&"desc"===rg.toLowerCase()}function Fd(){return rg&&"asc"===rg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof rg&&a.sort(rg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(nf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Qh&&0!==m.length&&(Ji.html(Th(a,$(),l,ji)).style("display","block"),d=Ji.property("offsetWidth"),e=Ji.property("offsetHeight"),k?(g=Df/2+c[0],i=Ff/2+c[1]+20):(Ng?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Yf(m[0].x)+20):(f=q(),g=f+t()+Yf(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Ji.style("top",i+"px").style("left",g+"px"))}function Id(){Ji.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Qh&&(Vd(nf.data.targets)||Yd(nf.data.targets)||Gi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Ng?"y1":"x1",ud).attr(Ng?"y2":"x2",ud))}function Kd(){Gi.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?Yf(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Ch?Ch:b?2*a.tickOffset()*Dh/b:0}function Sd(a,b){yc(a).forEach(function(a){Ni[a]=b===pg[a],pg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){pg[a.id]===b&&(c=!0),a.id in pg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in pg)||"line"===pg[b]||"spline"===pg[b]||"area"===pg[b]||"area-spline"===pg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===pg[b]||"area-spline"===pg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===pg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===pg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===pg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===pg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ie(b){var c;if(!b)throw Error(b+" can not be parsed as d3.time with format "+ig+". Maybe 'x' of this data is not defined. See data.x or data.xs option.");try{c=ig?mf.time.format(ig).parse(b):new Date(b)}catch(d){c=void 0}return c||a.console.error("Failed to parse x '"+b+"' to Date with format "+ig),c}function je(a,b){var c=mf.mouse(a),d=mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?Zf:$f,d=Ng?1:0,e=Ng?0:1;return Math.pow(Yf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Cg(b,a.node()),Gi.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md).attr("stroke",function(){return ji(b)}).attr("r",1.4*Bh).transition().duration(100).attr("r",Bh)}function se(a,b,c){Dg(b,a.node()),Gi.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Cg(b,a.node()),a.transition().duration(100).style("fill",function(){return mf.rgb(ji(b)).darker(1)})}function ve(a,b){Dg(b,a.node()),a.transition().duration(100).style("fill",function(){return ji(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Gi.selectAll("."+f.circles+gd(c)):Gi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",Ah)}function Ae(a){ye(a).filter(function(){return mf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",xh)}function Be(a){return Gi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Ng?1:0,f=Ng?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Ng?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBBox();return Ng?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(cg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Ng&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Je(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function Ke(b){var c,d,e;if(Ki=mf.select(pf),Ki.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Ki.html(""),Ki.classed("c3",!0),nf.data.xs={},nf.data.targets=rc(b),n(),R(),Yf.domain(mf.extent(Zb(nf.data.targets))),Zf.domain(Ub(nf.data.targets,"y")),$f.domain(Ub(nf.data.targets,"y2")),_f.domain(Yf.domain()),ag.domain(Zf.domain()),bg.domain($f.domain()),Li=Yf.domain(),zi.scale(_f),uf&&Di.scale(Yf),Ei=Ki.append("svg").attr("width",Df+Af.left+Af.right).attr("height",Ff+Af.top+Af.bottom).on("mouseenter",xf).on("mouseleave",yf),Fi=Ei.append("defs"),Fi.append("clipPath").attr("id",Xh).append("rect").attr("width",Df).attr("height",Ff),Fi.append("clipPath").attr("id",Yh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Fi.append("clipPath").attr("id",Zh).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Gi=Ei.append("g").attr("transform",ri.main),Hi=Gg?Ei.append("g").attr("transform",ri.context):null,Ii=Ei.append("g").attr("transform",ri.legend),Jg||(Ii.style("visibility","hidden"),mi=xc(nf.data.targets)),Ji=mf.select(pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),gf(xc(nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Gi.append("g").attr("class",f.axisX).attr("clip-path",Ng?"":_h).attr("transform",ri.x).append("text").attr("class",f.axisXLabel).attr("transform",Ng?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),$g&&Gi.append("g").attr("class",f.axisY).attr("clip-path",Ng?ai:"").attr("transform",ri.y).append("text").attr("class",f.axisYLabel).attr("transform",Ng?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),hh&&Gi.append("g").attr("class",f.axisY2).attr("transform",ri.y2).append("text").attr("class",f.axisY2Label).attr("transform",Ng?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Gi.append("g").attr("clip-path",$h).attr("class",f.grid),qh&&d.append("g").attr("class",f.xgrids),ne(sh)&&d.append("g").attr("class",f.xgridLines),yh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),th&&d.append("g").attr("class",f.ygrids),ne(uh)&&d.append("g").attr("class",f.ygridLines),Gi.append("g").attr("clip-path",$h).attr("class",f.regions),Gi.append("g").attr("clip-path",$h).attr("class",f.chart),c=Gi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",uf?Ng?"ns-resize":"ew-resize":null),Gi.select("."+f.chart).append("g").attr("class",f.chartBars),Gi.select("."+f.chart).append("g").attr("class",f.chartLines),Gi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",ri.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Gi.select("."+f.chart).append("g").attr("class",f.chartTexts),uf&&Gi.insert("rect",wf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Df).attr("height",Ff).style("opacity",0).style("cursor",Ng?"ns-resize":"ew-resize").call(Di).on("dblclick.zoom",null),Yg&&zi.extent("function"!=typeof Yg?Yg:Yg(Zb())),Gg&&(Hi.append("g").attr("clip-path",$h).attr("class",f.chart),Hi.select("."+f.chart).append("g").attr("class",f.chartBars),Hi.select("."+f.chart).append("g").attr("class",f.chartLines),Hi.append("g").attr("clip-path",$h).attr("class",f.brush).call(zi).selectAll("rect").attr(Ng?"width":"height",Ng?Ef:Gf),Hi.append("g").attr("class",f.axisX).attr("transform",ri.subx).attr("clip-path",Ng?"":_h)),Xe(nf.data.targets),Ng?Gi.select("."+f.axisX).style("opacity",0).call(cg):(Gi.select("."+f.axisY).style("opacity",0).call(dg),Gi.select("."+f.axisY2).style("opacity",0).call(eg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Uh){if(bi&&"string"==typeof Vh){for(Vh=ie(Vh),e=0;e0){d=[];for(var g in kg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function Pe(a){Yd(nf.data.targets)||vg&&(ei=a,Gi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),fi=!0,Eg())}function Qe(){Yd(nf.data.targets)||vg&&(Gi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Gi.selectAll("."+f.shape).classed(f.INCLUDED,!1),fi=!1,Fg())}function Re(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Nd(),U=Yd(nf.data.targets),V=Dc(nf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?zf:0,O=B?N:0,P=C?N:0,H&&Jg&&gf(xc(nf.data.targets),a),G&&(Yf.domain(mf.extent(Zb(V))),Li=Yf.domain(),uf&&Di.scale(Yf).updateScaleExtent(),_f.domain(Yf.domain()),zi.scale(_f)),F&&(Yf.domain(zi.empty()?Li:zi.extent()),uf&&Di.scale(Yf).updateScaleExtent()),Zf.domain(Ub(V,"y")),$f.domain(Ub(V,"y2")),Vd(V)||(Q=Fc(Ec(V)).sort(),cg.tickValues(Q),fg.tickValues(Q)),c=Gi.select("."+f.axisX).style("opacity",U?0:1),(Ng||D)&&(c=c.transition().duration(P)),c.call(cg),e=Gi.select("."+f.axisY).style("opacity",U?0:1),(!Ng||D)&&(e=e.transition().duration(P)),e.call(dg),Gi.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(eg),F&&Sg&&Q){for(R=1;R=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=Yf.ticks(10);g=Gi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Ng?0:function(a){return Yf(a)-cg.tickOffset()}).attr("x2",Ng?Df:function(a){return Yf(a)-cg.tickOffset()}).attr("y1",Ng?function(a){return Yf(a)-cg.tickOffset()}:Af.top).attr("y2",Ng?function(a){return Yf(a)-cg.tickOffset()}:Ff).style("opacity",function(){return+mf.select(this).attr(Ng?"y1":"x1")===(Ng?Ff:0)?0:1}),g.exit().remove()}ne(sh)&&(i=Gi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(sh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Ng?"":"rotate(-90)").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Ng?0:vd).attr("x2",Ng?Df:vd).attr("y1",Ng?vd:Af.top).attr("y2",Ng?vd:Ff).style("opacity",1),i.select("text").transition().duration(N).attr("x",Ng?Df:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&th&&(k=Gi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Zf.ticks(vh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Ng?Zf:0).attr("x2",Ng?Zf:Df).attr("y1",Ng?0:Zf).attr("y2",Ng?Ff:Zf),k.exit().remove()),y&&ne(uh)&&(l=Gi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(uh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Ng?"rotate(-90)":"").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Ng?wd:0).attr("x2",Ng?wd:Df).attr("y1",Ng?0:wd).attr("y2",Ng?Ff:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Ng?0:Df).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Gi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ji(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Gi.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Ng?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Gi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ai).style("opacity",1),Gi.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Bi).style("opacity",Mi),n=Gi.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",xh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),n.exit().remove(),Gi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=mf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Gi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Gi.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Gg&&(null!==mf.event&&"zoom"===mf.event.type&&zi.extent(Yf.orgDomain()).update(),z&&(Hi.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(fg),zi.empty()||zi.extent(Yf.orgDomain()).update(),J=Ee(T,!0),s=Hi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ji(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Hi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ci).style("opacity",1))),Gi.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Gi.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),t=Gi.select("."+f.eventRects),ne(hg)&&!kc(hg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Gi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Df).attr("height",Ff)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),di&&!ci?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return(Yf(d?d:e+50)-Yf(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return(Yf(d)+Yf(c?c:d-50))/2}):(x=L(),w=function(a){return Yf(a.x)-x/2}),v=wc(),Gi.select("."+f.eventRects).datum(v?v.values:[]),u=Gi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Ng?0:w).attr("y",Ng?w:0).attr("width",Ng?Df:x).attr("height",Ng?x:Ff),u.exit().remove()),q=Gi.select("."+f.regions).selectAll("rect."+f.region).data(Ph),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Ng?0:cc).attr("y",Ng?cc:Af.top).attr("width",Ng?Df:dc).attr("height",Ng?dc:Ff).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),xc(nf.data.targets).forEach(function(a){Ni[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Di.altDomain?(Yf.domain(Di.altDomain),void Di.scale(Yf).updateScaleExtent()):(ci&&Yf.orgDomain()[0]===Li[0]&&Yf.domain([Li[0]-1e-10,Yf.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(gi=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Ei.attr("width",Hf).attr("height",If),Ei.select("#"+Xh).select("rect").attr("width",Df).attr("height",Ff),Ei.select("#"+Yh).select("rect").attr("width",H),Ei.select("#"+Zh).select("rect").attr("width",J),Ei.select("."+f.zoomRect).attr("width",Df).attr("height",Ff)}function We(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Gi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ji(a)}),e=Gi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ji(a)}).style("stroke","none").style("cursor",function(a){return xg(a)?"pointer":null}),c=Gi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ji(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Mi=+mf.select(this).style("opacity"),0}).style("fill",function(a){return ji(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ji(a)}).style("cursor",function(a){return xg(a)?"pointer":null}),a.forEach(function(a){Gi.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Gi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Pf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ji(a.data)}).style("cursor",function(a){return xg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Gg&&(n=Hi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ji(a)}),l=Hi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ji(a)})),Ei.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBBox(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=si?j:i,l=si?Q():P();return d&&(w=0,C=0,t=0,u=0),Jg&&!Cc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=si?u:t,void(Mg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,si?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Ii.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Lg?Lg(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",si?g:-200).attr("y",si?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",si?h:-200).attr("y",si?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return ji(a)}).attr("x",si?g:-200).attr("y",si?-200:i).attr("width",10).attr("height",10),Ii.selectAll("text").data(a).text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ii.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ii.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["transition","duration"],350);g("data","data is required in config");var Af,Bf,Cf,Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg=h(["data","x"]),hg=h(["data","xs"],{}),ig=h(["data","x_format"]),jg=h(["data","id_converter"],function(a){return a}),kg=h(["data","names"],{}),lg=h(["data","classes"],{}),mg=h(["data","groups"],[]),ng=h(["data","axes"],{}),og=h(["data","type"]),pg=h(["data","types"],{}),qg=h(["data","labels"],{}),rg=h(["data","order"]),sg=h(["data","regions"],{}),tg=h(["data","color"]),ug=h(["data","colors"],{}),vg=h(["data","selection","enabled"],!1),wg=h(["data","selection","grouped"],!1),xg=h(["data","selection","isselectable"],function(){return!0}),yg=h(["data","selection","multiple"],!0),zg=h(["data","onclick"],function(){}),Ag=h(["data","onenter"],function(){}),Bg=h(["data","onleave"],function(){}),Cg=h(["data","onselected"],function(){}),Dg=h(["data","onunselected"],function(){}),Eg=h(["data","ondragstart"],function(){}),Fg=h(["data","ondragend"],function(){}),Gg=h(["subchart","show"],!1),Hg=Gg?h(["subchart","size","height"],60):0,Ig=h(["color","pattern"],[]),Jg=h(["legend","show"],!0),Kg=h(["legend","position"],"bottom"),Lg=h(["legend","item","onclick"]),Mg=h(["legend","equally"],!1),Ng=h(["axis","rotated"],!1),Og=h(["axis","x","type"],"indexed"),Pg=h(["axis","x","categories"],[]),Qg=h(["axis","x","tick","centered"],!1),Rg=h(["axis","x","tick","format"]),Sg=h(["axis","x","tick","culling"],{}),Tg=h(["axis","x","tick","culling","max"],"categorized"===Og?1/0:10),Ug=h(["axis","x","tick","count"]),Vg=h(["axis","x","tick","fit"],!1),Wg=h(["axis","x","max"]),Xg=h(["axis","x","min"]),Yg=h(["axis","x","default"]),Zg=h(["axis","x","label"],{}),$g=h(["axis","y","show"],!0),_g=h(["axis","y","max"]),ah=h(["axis","y","min"]),bh=h(["axis","y","center"]),ch=h(["axis","y","label"],{}),dh=h(["axis","y","inner"],!1),eh=h(["axis","y","tick","format"]),fh=h(["axis","y","padding"],{}),gh=h(["axis","y","ticks"],10),hh=h(["axis","y2","show"],!1),ih=h(["axis","y2","max"]),jh=h(["axis","y2","min"]),kh=h(["axis","y2","center"]),lh=h(["axis","y2","label"],{}),mh=h(["axis","y2","inner"],!1),nh=h(["axis","y2","tick","format"]),oh=h(["axis","y2","padding"],{}),ph=h(["axis","y2","ticks"],10),qh=h(["grid","x","show"],!1),rh=h(["grid","x","type"],"tick"),sh=h(["grid","x","lines"],[]),th=h(["grid","y","show"],!1),uh=h(["grid","y","lines"],[]),vh=h(["grid","y","ticks"],10),wh=h(["point","show"],!0),xh=wh?h(["point","r"],2.5):0,yh=h(["point","focus","line","enabled"],!0),zh=h(["point","focus","expand","enabled"],!0),Ah=h(["point","focus","expand","r"],zh?4:xh),Bh=h(["point","focus","select","r"],8),Ch=h(["bar","width"]),Dh=h(["bar","width","ratio"],.6),Eh=h(["pie","label","show"],!0),Fh=h(["pie","label","format"]),Gh=h(["pie","onclick"],function(){}),Hh=h(["pie","onmouseover"],function(){}),Ih=h(["pie","onmouseout"],function(){}),Jh=h(["donut","label","show"],!0),Kh=h(["donut","label","format"]),Lh=h(["donut","title"],""),Mh=h(["donut","onclick"],function(){}),Nh=h(["donut","onmouseover"],function(){}),Oh=h(["donut","onmouseout"],function(){}),Ph=h(["regions"],[]),Qh=h(["tooltip","show"],!0),Rh=h(["tooltip","format","title"]),Sh=h(["tooltip","format","value"]),Th=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Rh?Rh:b,l=Sh?Sh:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Uh=h(["tooltip","init","show"],!1),Vh=h(["tooltip","init","x"],0),Wh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Xh=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",Yh=Xh+"-xaxis",Zh=Xh+"-yaxis",$h=i(Xh),_h=i(_h),ai=i(ai),bi="timeseries"===Og,ci="categorized"===Og,di=!bi&&(gg||ne(hg)),ei=null,fi=!1,gi=!1,hi=!1,ii=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ji=he(ug,ne(Ig)?Ig:ii,tg),ki=function(){var a=[[mf.time.format("%Y/%-m/%-d"),function(){return!0}],[mf.time.format("%-m/%-d"),function(a){return a.getMonth()}],[mf.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[mf.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[mf.time.format("%I %p"),function(a){return a.getHours()}],[mf.time.format("%I:%M"),function(a){return a.getMinutes()}],[mf.time.format(":%S"),function(a){return a.getSeconds()}],[mf.time.format(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),li=[],mi=[],ni=Ng?"left":"bottom",oi=Ng?dh?"top":"bottom":dh?"right":"left",pi=Ng?mh?"bottom":"top":mh?"left":"right",qi=Ng?"left":"bottom",ri={main:function(){return"translate("+Af.left+","+Af.top+")"},context:function(){return"translate("+Bf.left+","+Bf.top+")"},legend:function(){return"translate("+Cf.left+","+Cf.top+")"},x:function(){return"translate(0,"+(Ng?0:Ff)+")"},y:function(){return"translate(0,"+(Ng?Ff:0)+")"},y2:function(){return"translate("+(Ng?0:Df)+","+(Ng?1:0)+")"},subx:function(){return"translate(0,"+(Ng?0:Gf)+")"},arc:function(){return"translate("+Df/2+","+Ff/2+")"}},si="right"===Kg,ti=0,ui=0,vi=0,wi=30,xi=30,yi=5;Pf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var zi,Ai=function(){var a=mf.svg.line().x(Ng?function(a){return V(a.id)(a.value)}:ud).y(Ng?ud:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=xe(b.values);return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),sg[b.id]?Je(e,Yf,V(b.id),sg[b.id]):a(e)):(c=Yf(e[0].x),d=V(b.id)(e[0].value),Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Bi=function(){var a;return a=Ng?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Ci=function(){var a=mf.svg.line().x(Ng?function(a){return W(a.id)(a.value)}:xd).y(Ng?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+_f(c[0].x)+" "+W(b.id)(c[0].value)}}(),Di=function(){};zi=mf.svg.brush().on("brush",Se),zi.update=function(){return Hi&&Hi.select("."+f.brush).call(this),this},zi.scale=function(a){return Ng?this.y(a):this.x(a)},uf&&(Di=mf.behavior.zoom().on("zoomstart",function(){Di.altDomain=mf.event.sourceEvent.altKey?Yf.orgDomain():null}).on("zoom",uf?Te:null),Di.scale=function(a){return Ng?this.y(a):this.x(a)},Di.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Di.updateScaleExtent=function(){var a=$b(Yf.orgDomain())/$b(Li),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Ei,Fi,Gi,Hi,Ii,Ji,Ki,Li,Mi,Ni={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Ei.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Ii.selectAll(kd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Ei.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Ii.selectAll(kd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",.5),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){zi.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){lg[b]=a.classes[b]}),"categories"in a&&ci&&(Pg=a.categories,cg.categories(Pg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Gi.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){vg&&Gi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=wg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?xg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){vg&&Gi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=wg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&xg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?mg:(mg=a,Re(),mg)},nf.xgrids=function(a){return a?(sh=a,Re(),sh):sh},nf.xgrids.add=function(a){return a?nf.xgrids(sh.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(sh.filter(b))},nf.ygrids=function(a){return a?(uh=a,Re(),uh):uh},nf.ygrids.add=function(a){return a?nf.ygrids(uh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(uh.filter(b))},nf.regions=function(a){return c(a)?Ph:(Ph=a,Re(),Ph)},nf.regions.add=function(a){return c(a)?Ph:(Ph=Ph.concat(a),Re(),Ph)},nf.regions.remove=function(a,c){var e=[].concat(a);return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;Ei.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Ph=Ph.filter(function(b){return b.classes.indexOf(a)<0})}),Ph},nf.data.get=function(a){var b=nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},nf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){kg[b]=a[b] +}),gf(xc(nf.data.targets),{withTransition:!0}),kg):kg},nf.x=function(a){return arguments.length&&(mc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.xs=function(a){return arguments.length&&(nc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(_g=+a.y),b(a.y2)&&(ih=+a.y2)):_g=ih=+a,Re())},nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(ah=+a.y),b(a.y2)&&(jh=+a.y2)):ah=jh=+a,Re())},nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&nf.axis.max(a.max),"undefined"!=typeof a.min&&nf.axis.min(a.min))},nf.legend.show=function(a){Jg||(Jg=!0,Ii.style("visibility","visible")),ef(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.legend.hide=function(a){Jg&&me(a)&&(Jg=!1,Ii.style("visibility","hidden")),ff(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.resize=function(a){qf=a?a.width:null,rf=a?a.height:null,We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},nf.destroy=function(){nf.data.targets=void 0,nf.data.xs={},Ki.html(""),a.onresize=null},"url"in e.data)mf.csv(e.data.url,function(a,b){Ke(b)});else if("rows"in e.data)Ke(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ke(qc(e.data.columns))}return nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 38774e9917368fef1fad43d8d18d7d2823ccda19 Mon Sep 17 00:00:00 2001 From: Kyle Campbell Date: Tue, 8 Apr 2014 13:18:48 -0700 Subject: [PATCH 024/178] added component.json --- component.json | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 component.json diff --git a/component.json b/component.json new file mode 100644 index 0000000..ed667d1 --- /dev/null +++ b/component.json @@ -0,0 +1,14 @@ +{ + "name": "c3", + "repo": "masayuki0812/c3", + "description": "A D3-based reusable chart library", + "version": "0.0.1", + "keywords": [], + "dependencies": {}, + "development": {}, + "license": "MIT", + "main": "c3.min.js", + "scripts": [ + "c3.min.js" + ] +} From 8dd53d7cd37d544204c9ff697c6dea936f3e2af2 Mon Sep 17 00:00:00 2001 From: Kyle Campbell Date: Tue, 8 Apr 2014 13:27:48 -0700 Subject: [PATCH 025/178] added css to component --- component.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/component.json b/component.json index ed667d1..e759c8f 100644 --- a/component.json +++ b/component.json @@ -10,5 +10,8 @@ "main": "c3.min.js", "scripts": [ "c3.min.js" + ], + "styles": [ + "c3.css" ] } From bf94ca8ad9f02f3dd676495e6598615dda20af85 Mon Sep 17 00:00:00 2001 From: Kyle Campbell Date: Tue, 8 Apr 2014 16:47:19 -0700 Subject: [PATCH 026/178] include uncompressed --- component.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/component.json b/component.json index e759c8f..f735d60 100644 --- a/component.json +++ b/component.json @@ -9,7 +9,7 @@ "license": "MIT", "main": "c3.min.js", "scripts": [ - "c3.min.js" + "c3.js" ], "styles": [ "c3.css" From 45ebb095577311e0aa739711047b57908fa5c909 Mon Sep 17 00:00:00 2001 From: Kyle Campbell Date: Tue, 8 Apr 2014 16:48:47 -0700 Subject: [PATCH 027/178] include uncompressed --- component.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/component.json b/component.json index f735d60..abf09d2 100644 --- a/component.json +++ b/component.json @@ -7,7 +7,7 @@ "dependencies": {}, "development": {}, "license": "MIT", - "main": "c3.min.js", + "main": "c3.js", "scripts": [ "c3.js" ], From b0af2e82ce1764b0086187dc38dba78f6efb0a20 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 9 Apr 2014 21:51:56 +0900 Subject: [PATCH 028/178] Fix clip path for axis --- c3.js | 4 ++-- c3.min.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/c3.js b/c3.js index b8c4ddc..0c7c4c4 100644 --- a/c3.js +++ b/c3.js @@ -269,8 +269,8 @@ clipIdForXAxis = clipId + '-xaxis', clipIdForYAxis = clipId + '-yaxis', clipPath = getClipPath(clipId), - clipPathForXAxis = getClipPath(clipPathForXAxis), - clipPathForYAxis = getClipPath(clipPathForYAxis); + clipPathForXAxis = getClipPath(clipIdForXAxis), + clipPathForYAxis = getClipPath(clipIdForYAxis); var isTimeSeries = (__axis_x_type === 'timeseries'), isCategorized = (__axis_x_type === 'categorized'), diff --git a/c3.min.js b/c3.min.js index 0eaa22c..d528171 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ !function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.29"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cDf&&(Df=0),0>Ff&&(Ff=0),Bf={top:Ng?Af.top:If-Hg-(si?0:a),right:0/0,bottom:20+(si?0:a),left:Ng?wi:Af.left},Ef=Ng?Af.left-wi-xi:Df,Gf=Ng?Ff:If-Bf.top-Bf.bottom,0>Ef&&(Ef=0),0>Gf&&(Gf=0),Cf={top:si?0:If-a,right:0/0,bottom:0,left:si?Hf-b:0},p(),si&&Yd(nf.data.targets)&&(Cf.left=Df/2+Kf)}function o(){Gi.select("line."+f.xgridFocus).attr("x1",Ng?0:-10).attr("x2",Ng?Df:-10).attr("y1",Ng?-10:Af.top).attr("y2",Ng?-10:Ff)}function p(){Kf=Ff/2,Jf=.95*Kf,Lf=Xd(nf.data.targets)?.6*Jf:0}function q(){var a=Ng?f.axisX:f.axisY,b=mf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=mf.select(pf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return qf?qf:x()}function s(){var a=rf?rf:y();return a>0?a:320}function t(){return Yd(nf.data.targets)?0:sf?sf:Ng||!$g||dh?1:v("y")}function u(){var a=1;return Yd(nf.data.targets)?0:tf?tf:si?P()+(hh&&!Ng?v("y2"):a):hh?mh||Ng?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||$g?"y2"!==a||hh?(gb(a).isInner?30:40)+("y2"===a?-10:0):yi:Jg&&!si?10:1}function x(){return+mf.select(pf).style("width").replace("px","")}function y(){return+mf.select(pf).style("height").replace("px","")}function z(a){return a?-5:-(Af.left-1)}function A(a){return a?-20:-1}function B(){return z(!Ng)}function C(){return A(!Ng)}function D(){return z(Ng)}function E(){return A(Ng)}function F(a){return a?Df+2+4:Af.left+20}function G(a){return a?80:Ff+2}function H(){return F(!Ng)}function I(){return G(!Ng)}function J(){return F(Ng)}function K(){return G(Ng)}function L(){var a=Ng?Ff:Df,b=vc(),c=Vb()*(Ud(nf.data.targets)?(b-(ci?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){ti=a}function N(a){ui=a}function O(a){vi=a}function P(){return Jg?si?ui*(ti+1):Hf:0}function Q(){return Jg?si?If:vi*(ti+1):0}function R(){var a,b=!Yf;Qf=Ng?1:0,Rf=Ng?Ff:Df,Sf=Ng?0:Ff,Tf=Ng?Df:1,Uf=Qf,Vf=Rf,Wf=Ng?0:Gf,Xf=Ng?Ef:1,Yf=T(Qf,Rf,b?void 0:Yf.domain(),function(){return cg.tickOffset()}),Zf=U(Sf,Tf),$f=U(Sf,Tf),_f=T(Qf,Rf,Li,function(a){return a%1?0:fg.tickOffset()}),ag=U(Wf,Xf),bg=U(Wf,Xf),a=$(),cg=X(Yf,ni,a),fg=X(_f,qi,a),dg=Y(Zf,oi,eh,gh),eg=Y($f,pi,nh,ph),b||(zi.scale(_f),uf&&Di.scale(Yf)),S()}function S(){Mf=Db(),Nf=Eb(),Of=Eb(.98)}function T(a,b,e,f){var g=(bi?mf.time.scale():mf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),ci){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return mf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?$f:Zf}function W(a){return"y2"===Z(a)?bg:ag}function X(a,b,c){var d=(ci?Bb():mf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),ci?d.tickCentered(Qg):d.tickOffset=function(){var a=Ng?Ff:Df;return a*Vb()/vc()/2},ci&&d.categories(Pg),d}function Y(a,b,c,d){return mf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in ng?ng[a]:"y"}function $(){var a=bi?ki:ci?Oc:function(a){return 0>a?a.toFixed(0):a};return Rg&&("function"==typeof Rg?a=Rg:bi&&(a=function(a){return mf.time.format(Rg)(a)})),a}function _(a){var b;return"y"===a?b=ch:"y2"===a?b=lh:"x"===a&&(b=Zg),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?ch=b:"y2"===a?lh=b:"x"===a&&(Zg=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Ng?"inner-top":"inner-right")}function eb(){return cb("y",Ng?"inner-right":"inner-top")}function fb(){return cb("y2",Ng?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?Df/2:Df:b.isBottom?-Ff:b.isMiddle?-Ff/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Ng,db())}function ob(){return kb(Ng,eb())}function pb(){return kb(Ng,fb())}function qb(){return lb(!Ng,db())}function rb(){return lb(Ng,eb())}function sb(){return lb(Ng,fb())}function tb(){var a=db();return Ng?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Ng?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Ng?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Ng,db())}function xb(){return mb(Ng,eb())}function yb(){return mb(Ng,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBBox();bb?20:b}function Ab(){Gi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Gi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Gi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return mf.min(Object.keys(i).map(function(a){return mf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(mg.length>0)for(g=Nc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return mf.max(Object.keys(i).map(function(a){return mf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?jh:ah,n="y2"===c?ih:_g,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?kh:bh,r=pd()&&Ng;return 0===l.length?"y2"===c?$f.domain():Zf.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=qd(o,p),j=$b(Zf.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&fh&&(f=b(fh.top)?fh.top:e,g=b(fh.bottom)?fh.bottom:e),"y2"===c&&oh&&(f=b(oh.top)?oh.top:e,g=b(oh.bottom)?oh.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Li),c=$b(Yf.domain());return a||0===c?1:b/c}function Wb(a){return Xg?Xg:mf.min(a,function(a){return mf.min(a.values,function(a){return a.x})})}function Xb(a){return Wg?Wg:mf.max(a,function(a){return mf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return ci?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=bi?new Date(c.getTime()-e):c-e,g=bi?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return gg&&a===gg||ne(hg)&&oe(hg,a)}function fc(a){return!ec(a)}function gc(a){return gg?gg:ne(hg)?hg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=nf.data.xs[b])}),c}function ic(a,b){return a in nf.data.xs&&nf.data.xs[a]&&nf.data.xs[a][b]?nf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){hg[b]=a[b]})}function kc(a){return 1===mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=kg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),nf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=bi?a?a instanceof Date?a:ie(a):ie(ic(b,c)):di&&!ci?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):gg?(d=Object.keys(nf.data.xs),nf.data.xs[c]=d.length>0?nf.data.xs[d[0]]:void 0):ne(hg)&&(nf.data.xs[c]=hc(f,nf.data.targets)):nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=jg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return di&&ci&&0===c&&g&&(0===e&&(Pg=[]),Pg.push(g)),("undefined"==typeof a[b]||nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),og&&Sd(xc(c).filter(function(a){return!(a in pg)}),og),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function tc(a){return a>0&&nf.data.targets[0].values[a-1]?nf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?nf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?nf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(nf.data.targets)}function zc(a,b){var c,d=xc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(bi?new Date(h):h);i.push(d)}return i}function Gc(a){li=li.concat(a)}function Hc(a){li=li.filter(function(b){return a.indexOf(b)<0})}function Ic(a){mi=mi.concat(a)}function Jc(a){mi=mi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Ed(){return rg&&"desc"===rg.toLowerCase()}function Fd(){return rg&&"asc"===rg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof rg&&a.sort(rg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(nf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Qh&&0!==m.length&&(Ji.html(Th(a,$(),l,ji)).style("display","block"),d=Ji.property("offsetWidth"),e=Ji.property("offsetHeight"),k?(g=Df/2+c[0],i=Ff/2+c[1]+20):(Ng?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Yf(m[0].x)+20):(f=q(),g=f+t()+Yf(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Ji.style("top",i+"px").style("left",g+"px"))}function Id(){Ji.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Qh&&(Vd(nf.data.targets)||Yd(nf.data.targets)||Gi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Ng?"y1":"x1",ud).attr(Ng?"y2":"x2",ud))}function Kd(){Gi.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?Yf(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Ch?Ch:b?2*a.tickOffset()*Dh/b:0}function Sd(a,b){yc(a).forEach(function(a){Ni[a]=b===pg[a],pg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){pg[a.id]===b&&(c=!0),a.id in pg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in pg)||"line"===pg[b]||"spline"===pg[b]||"area"===pg[b]||"area-spline"===pg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===pg[b]||"area-spline"===pg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===pg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===pg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===pg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===pg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ie(b){var c;if(!b)throw Error(b+" can not be parsed as d3.time with format "+ig+". Maybe 'x' of this data is not defined. See data.x or data.xs option.");try{c=ig?mf.time.format(ig).parse(b):new Date(b)}catch(d){c=void 0}return c||a.console.error("Failed to parse x '"+b+"' to Date with format "+ig),c}function je(a,b){var c=mf.mouse(a),d=mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?Zf:$f,d=Ng?1:0,e=Ng?0:1;return Math.pow(Yf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Cg(b,a.node()),Gi.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md).attr("stroke",function(){return ji(b)}).attr("r",1.4*Bh).transition().duration(100).attr("r",Bh)}function se(a,b,c){Dg(b,a.node()),Gi.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Cg(b,a.node()),a.transition().duration(100).style("fill",function(){return mf.rgb(ji(b)).darker(1)})}function ve(a,b){Dg(b,a.node()),a.transition().duration(100).style("fill",function(){return ji(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Gi.selectAll("."+f.circles+gd(c)):Gi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",Ah)}function Ae(a){ye(a).filter(function(){return mf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",xh)}function Be(a){return Gi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Ng?1:0,f=Ng?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Ng?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBBox();return Ng?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(cg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Ng&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Je(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function Ke(b){var c,d,e;if(Ki=mf.select(pf),Ki.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Ki.html(""),Ki.classed("c3",!0),nf.data.xs={},nf.data.targets=rc(b),n(),R(),Yf.domain(mf.extent(Zb(nf.data.targets))),Zf.domain(Ub(nf.data.targets,"y")),$f.domain(Ub(nf.data.targets,"y2")),_f.domain(Yf.domain()),ag.domain(Zf.domain()),bg.domain($f.domain()),Li=Yf.domain(),zi.scale(_f),uf&&Di.scale(Yf),Ei=Ki.append("svg").attr("width",Df+Af.left+Af.right).attr("height",Ff+Af.top+Af.bottom).on("mouseenter",xf).on("mouseleave",yf),Fi=Ei.append("defs"),Fi.append("clipPath").attr("id",Xh).append("rect").attr("width",Df).attr("height",Ff),Fi.append("clipPath").attr("id",Yh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Fi.append("clipPath").attr("id",Zh).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Gi=Ei.append("g").attr("transform",ri.main),Hi=Gg?Ei.append("g").attr("transform",ri.context):null,Ii=Ei.append("g").attr("transform",ri.legend),Jg||(Ii.style("visibility","hidden"),mi=xc(nf.data.targets)),Ji=mf.select(pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),gf(xc(nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Gi.append("g").attr("class",f.axisX).attr("clip-path",Ng?"":_h).attr("transform",ri.x).append("text").attr("class",f.axisXLabel).attr("transform",Ng?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),$g&&Gi.append("g").attr("class",f.axisY).attr("clip-path",Ng?ai:"").attr("transform",ri.y).append("text").attr("class",f.axisYLabel).attr("transform",Ng?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),hh&&Gi.append("g").attr("class",f.axisY2).attr("transform",ri.y2).append("text").attr("class",f.axisY2Label).attr("transform",Ng?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Gi.append("g").attr("clip-path",$h).attr("class",f.grid),qh&&d.append("g").attr("class",f.xgrids),ne(sh)&&d.append("g").attr("class",f.xgridLines),yh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),th&&d.append("g").attr("class",f.ygrids),ne(uh)&&d.append("g").attr("class",f.ygridLines),Gi.append("g").attr("clip-path",$h).attr("class",f.regions),Gi.append("g").attr("clip-path",$h).attr("class",f.chart),c=Gi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",uf?Ng?"ns-resize":"ew-resize":null),Gi.select("."+f.chart).append("g").attr("class",f.chartBars),Gi.select("."+f.chart).append("g").attr("class",f.chartLines),Gi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",ri.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Gi.select("."+f.chart).append("g").attr("class",f.chartTexts),uf&&Gi.insert("rect",wf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Df).attr("height",Ff).style("opacity",0).style("cursor",Ng?"ns-resize":"ew-resize").call(Di).on("dblclick.zoom",null),Yg&&zi.extent("function"!=typeof Yg?Yg:Yg(Zb())),Gg&&(Hi.append("g").attr("clip-path",$h).attr("class",f.chart),Hi.select("."+f.chart).append("g").attr("class",f.chartBars),Hi.select("."+f.chart).append("g").attr("class",f.chartLines),Hi.append("g").attr("clip-path",$h).attr("class",f.brush).call(zi).selectAll("rect").attr(Ng?"width":"height",Ng?Ef:Gf),Hi.append("g").attr("class",f.axisX).attr("transform",ri.subx).attr("clip-path",Ng?"":_h)),Xe(nf.data.targets),Ng?Gi.select("."+f.axisX).style("opacity",0).call(cg):(Gi.select("."+f.axisY).style("opacity",0).call(dg),Gi.select("."+f.axisY2).style("opacity",0).call(eg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Uh){if(bi&&"string"==typeof Vh){for(Vh=ie(Vh),e=0;e0){d=[];for(var g in kg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function Pe(a){Yd(nf.data.targets)||vg&&(ei=a,Gi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),fi=!0,Eg())}function Qe(){Yd(nf.data.targets)||vg&&(Gi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Gi.selectAll("."+f.shape).classed(f.INCLUDED,!1),fi=!1,Fg())}function Re(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Nd(),U=Yd(nf.data.targets),V=Dc(nf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?zf:0,O=B?N:0,P=C?N:0,H&&Jg&&gf(xc(nf.data.targets),a),G&&(Yf.domain(mf.extent(Zb(V))),Li=Yf.domain(),uf&&Di.scale(Yf).updateScaleExtent(),_f.domain(Yf.domain()),zi.scale(_f)),F&&(Yf.domain(zi.empty()?Li:zi.extent()),uf&&Di.scale(Yf).updateScaleExtent()),Zf.domain(Ub(V,"y")),$f.domain(Ub(V,"y2")),Vd(V)||(Q=Fc(Ec(V)).sort(),cg.tickValues(Q),fg.tickValues(Q)),c=Gi.select("."+f.axisX).style("opacity",U?0:1),(Ng||D)&&(c=c.transition().duration(P)),c.call(cg),e=Gi.select("."+f.axisY).style("opacity",U?0:1),(!Ng||D)&&(e=e.transition().duration(P)),e.call(dg),Gi.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(eg),F&&Sg&&Q){for(R=1;R=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=Yf.ticks(10);g=Gi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Ng?0:function(a){return Yf(a)-cg.tickOffset()}).attr("x2",Ng?Df:function(a){return Yf(a)-cg.tickOffset()}).attr("y1",Ng?function(a){return Yf(a)-cg.tickOffset()}:Af.top).attr("y2",Ng?function(a){return Yf(a)-cg.tickOffset()}:Ff).style("opacity",function(){return+mf.select(this).attr(Ng?"y1":"x1")===(Ng?Ff:0)?0:1}),g.exit().remove()}ne(sh)&&(i=Gi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(sh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Ng?"":"rotate(-90)").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Ng?0:vd).attr("x2",Ng?Df:vd).attr("y1",Ng?vd:Af.top).attr("y2",Ng?vd:Ff).style("opacity",1),i.select("text").transition().duration(N).attr("x",Ng?Df:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&th&&(k=Gi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Zf.ticks(vh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Ng?Zf:0).attr("x2",Ng?Zf:Df).attr("y1",Ng?0:Zf).attr("y2",Ng?Ff:Zf),k.exit().remove()),y&&ne(uh)&&(l=Gi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(uh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Ng?"rotate(-90)":"").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Ng?wd:0).attr("x2",Ng?wd:Df).attr("y1",Ng?0:wd).attr("y2",Ng?Ff:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Ng?0:Df).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Gi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ji(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Gi.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Ng?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Gi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ai).style("opacity",1),Gi.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Bi).style("opacity",Mi),n=Gi.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",xh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),n.exit().remove(),Gi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=mf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Gi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Gi.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Gg&&(null!==mf.event&&"zoom"===mf.event.type&&zi.extent(Yf.orgDomain()).update(),z&&(Hi.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(fg),zi.empty()||zi.extent(Yf.orgDomain()).update(),J=Ee(T,!0),s=Hi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ji(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Hi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ci).style("opacity",1))),Gi.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Gi.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),t=Gi.select("."+f.eventRects),ne(hg)&&!kc(hg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Gi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Df).attr("height",Ff)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),di&&!ci?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return(Yf(d?d:e+50)-Yf(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return(Yf(d)+Yf(c?c:d-50))/2}):(x=L(),w=function(a){return Yf(a.x)-x/2}),v=wc(),Gi.select("."+f.eventRects).datum(v?v.values:[]),u=Gi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Ng?0:w).attr("y",Ng?w:0).attr("width",Ng?Df:x).attr("height",Ng?x:Ff),u.exit().remove()),q=Gi.select("."+f.regions).selectAll("rect."+f.region).data(Ph),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Ng?0:cc).attr("y",Ng?cc:Af.top).attr("width",Ng?Df:dc).attr("height",Ng?dc:Ff).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),xc(nf.data.targets).forEach(function(a){Ni[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Di.altDomain?(Yf.domain(Di.altDomain),void Di.scale(Yf).updateScaleExtent()):(ci&&Yf.orgDomain()[0]===Li[0]&&Yf.domain([Li[0]-1e-10,Yf.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(gi=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Ei.attr("width",Hf).attr("height",If),Ei.select("#"+Xh).select("rect").attr("width",Df).attr("height",Ff),Ei.select("#"+Yh).select("rect").attr("width",H),Ei.select("#"+Zh).select("rect").attr("width",J),Ei.select("."+f.zoomRect).attr("width",Df).attr("height",Ff)}function We(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Gi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ji(a)}),e=Gi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ji(a)}).style("stroke","none").style("cursor",function(a){return xg(a)?"pointer":null}),c=Gi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ji(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Mi=+mf.select(this).style("opacity"),0}).style("fill",function(a){return ji(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ji(a)}).style("cursor",function(a){return xg(a)?"pointer":null}),a.forEach(function(a){Gi.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Gi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Pf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ji(a.data)}).style("cursor",function(a){return xg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Gg&&(n=Hi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ji(a)}),l=Hi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ji(a)})),Ei.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBBox(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=si?j:i,l=si?Q():P();return d&&(w=0,C=0,t=0,u=0),Jg&&!Cc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=si?u:t,void(Mg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,si?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Ii.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Lg?Lg(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",si?g:-200).attr("y",si?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",si?h:-200).attr("y",si?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return ji(a)}).attr("x",si?g:-200).attr("y",si?-200:i).attr("width",10).attr("height",10),Ii.selectAll("text").data(a).text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ii.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ii.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["transition","duration"],350);g("data","data is required in config");var Af,Bf,Cf,Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg=h(["data","x"]),hg=h(["data","xs"],{}),ig=h(["data","x_format"]),jg=h(["data","id_converter"],function(a){return a}),kg=h(["data","names"],{}),lg=h(["data","classes"],{}),mg=h(["data","groups"],[]),ng=h(["data","axes"],{}),og=h(["data","type"]),pg=h(["data","types"],{}),qg=h(["data","labels"],{}),rg=h(["data","order"]),sg=h(["data","regions"],{}),tg=h(["data","color"]),ug=h(["data","colors"],{}),vg=h(["data","selection","enabled"],!1),wg=h(["data","selection","grouped"],!1),xg=h(["data","selection","isselectable"],function(){return!0}),yg=h(["data","selection","multiple"],!0),zg=h(["data","onclick"],function(){}),Ag=h(["data","onenter"],function(){}),Bg=h(["data","onleave"],function(){}),Cg=h(["data","onselected"],function(){}),Dg=h(["data","onunselected"],function(){}),Eg=h(["data","ondragstart"],function(){}),Fg=h(["data","ondragend"],function(){}),Gg=h(["subchart","show"],!1),Hg=Gg?h(["subchart","size","height"],60):0,Ig=h(["color","pattern"],[]),Jg=h(["legend","show"],!0),Kg=h(["legend","position"],"bottom"),Lg=h(["legend","item","onclick"]),Mg=h(["legend","equally"],!1),Ng=h(["axis","rotated"],!1),Og=h(["axis","x","type"],"indexed"),Pg=h(["axis","x","categories"],[]),Qg=h(["axis","x","tick","centered"],!1),Rg=h(["axis","x","tick","format"]),Sg=h(["axis","x","tick","culling"],{}),Tg=h(["axis","x","tick","culling","max"],"categorized"===Og?1/0:10),Ug=h(["axis","x","tick","count"]),Vg=h(["axis","x","tick","fit"],!1),Wg=h(["axis","x","max"]),Xg=h(["axis","x","min"]),Yg=h(["axis","x","default"]),Zg=h(["axis","x","label"],{}),$g=h(["axis","y","show"],!0),_g=h(["axis","y","max"]),ah=h(["axis","y","min"]),bh=h(["axis","y","center"]),ch=h(["axis","y","label"],{}),dh=h(["axis","y","inner"],!1),eh=h(["axis","y","tick","format"]),fh=h(["axis","y","padding"],{}),gh=h(["axis","y","ticks"],10),hh=h(["axis","y2","show"],!1),ih=h(["axis","y2","max"]),jh=h(["axis","y2","min"]),kh=h(["axis","y2","center"]),lh=h(["axis","y2","label"],{}),mh=h(["axis","y2","inner"],!1),nh=h(["axis","y2","tick","format"]),oh=h(["axis","y2","padding"],{}),ph=h(["axis","y2","ticks"],10),qh=h(["grid","x","show"],!1),rh=h(["grid","x","type"],"tick"),sh=h(["grid","x","lines"],[]),th=h(["grid","y","show"],!1),uh=h(["grid","y","lines"],[]),vh=h(["grid","y","ticks"],10),wh=h(["point","show"],!0),xh=wh?h(["point","r"],2.5):0,yh=h(["point","focus","line","enabled"],!0),zh=h(["point","focus","expand","enabled"],!0),Ah=h(["point","focus","expand","r"],zh?4:xh),Bh=h(["point","focus","select","r"],8),Ch=h(["bar","width"]),Dh=h(["bar","width","ratio"],.6),Eh=h(["pie","label","show"],!0),Fh=h(["pie","label","format"]),Gh=h(["pie","onclick"],function(){}),Hh=h(["pie","onmouseover"],function(){}),Ih=h(["pie","onmouseout"],function(){}),Jh=h(["donut","label","show"],!0),Kh=h(["donut","label","format"]),Lh=h(["donut","title"],""),Mh=h(["donut","onclick"],function(){}),Nh=h(["donut","onmouseover"],function(){}),Oh=h(["donut","onmouseout"],function(){}),Ph=h(["regions"],[]),Qh=h(["tooltip","show"],!0),Rh=h(["tooltip","format","title"]),Sh=h(["tooltip","format","value"]),Th=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Rh?Rh:b,l=Sh?Sh:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Uh=h(["tooltip","init","show"],!1),Vh=h(["tooltip","init","x"],0),Wh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Xh=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",Yh=Xh+"-xaxis",Zh=Xh+"-yaxis",$h=i(Xh),_h=i(_h),ai=i(ai),bi="timeseries"===Og,ci="categorized"===Og,di=!bi&&(gg||ne(hg)),ei=null,fi=!1,gi=!1,hi=!1,ii=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ji=he(ug,ne(Ig)?Ig:ii,tg),ki=function(){var a=[[mf.time.format("%Y/%-m/%-d"),function(){return!0}],[mf.time.format("%-m/%-d"),function(a){return a.getMonth()}],[mf.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[mf.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[mf.time.format("%I %p"),function(a){return a.getHours()}],[mf.time.format("%I:%M"),function(a){return a.getMinutes()}],[mf.time.format(":%S"),function(a){return a.getSeconds()}],[mf.time.format(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),li=[],mi=[],ni=Ng?"left":"bottom",oi=Ng?dh?"top":"bottom":dh?"right":"left",pi=Ng?mh?"bottom":"top":mh?"left":"right",qi=Ng?"left":"bottom",ri={main:function(){return"translate("+Af.left+","+Af.top+")"},context:function(){return"translate("+Bf.left+","+Bf.top+")"},legend:function(){return"translate("+Cf.left+","+Cf.top+")"},x:function(){return"translate(0,"+(Ng?0:Ff)+")"},y:function(){return"translate(0,"+(Ng?Ff:0)+")"},y2:function(){return"translate("+(Ng?0:Df)+","+(Ng?1:0)+")"},subx:function(){return"translate(0,"+(Ng?0:Gf)+")"},arc:function(){return"translate("+Df/2+","+Ff/2+")"}},si="right"===Kg,ti=0,ui=0,vi=0,wi=30,xi=30,yi=5;Pf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var zi,Ai=function(){var a=mf.svg.line().x(Ng?function(a){return V(a.id)(a.value)}:ud).y(Ng?ud:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=xe(b.values);return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),sg[b.id]?Je(e,Yf,V(b.id),sg[b.id]):a(e)):(c=Yf(e[0].x),d=V(b.id)(e[0].value),Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Bi=function(){var a;return a=Ng?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Ci=function(){var a=mf.svg.line().x(Ng?function(a){return W(a.id)(a.value)}:xd).y(Ng?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+_f(c[0].x)+" "+W(b.id)(c[0].value)}}(),Di=function(){};zi=mf.svg.brush().on("brush",Se),zi.update=function(){return Hi&&Hi.select("."+f.brush).call(this),this},zi.scale=function(a){return Ng?this.y(a):this.x(a)},uf&&(Di=mf.behavior.zoom().on("zoomstart",function(){Di.altDomain=mf.event.sourceEvent.altKey?Yf.orgDomain():null}).on("zoom",uf?Te:null),Di.scale=function(a){return Ng?this.y(a):this.x(a)},Di.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Di.updateScaleExtent=function(){var a=$b(Yf.orgDomain())/$b(Li),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Ei,Fi,Gi,Hi,Ii,Ji,Ki,Li,Mi,Ni={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Ei.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Ii.selectAll(kd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Ei.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Ii.selectAll(kd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",.5),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){zi.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){lg[b]=a.classes[b]}),"categories"in a&&ci&&(Pg=a.categories,cg.categories(Pg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Gi.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){vg&&Gi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=wg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?xg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){vg&&Gi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=wg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&xg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?mg:(mg=a,Re(),mg)},nf.xgrids=function(a){return a?(sh=a,Re(),sh):sh},nf.xgrids.add=function(a){return a?nf.xgrids(sh.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(sh.filter(b))},nf.ygrids=function(a){return a?(uh=a,Re(),uh):uh},nf.ygrids.add=function(a){return a?nf.ygrids(uh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(uh.filter(b))},nf.regions=function(a){return c(a)?Ph:(Ph=a,Re(),Ph)},nf.regions.add=function(a){return c(a)?Ph:(Ph=Ph.concat(a),Re(),Ph)},nf.regions.remove=function(a,c){var e=[].concat(a);return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;Ei.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Ph=Ph.filter(function(b){return b.classes.indexOf(a)<0})}),Ph},nf.data.get=function(a){var b=nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},nf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){kg[b]=a[b] +}Ji.html(Th(nf.data.targets.map(function(a){return lc(a.values[Vh])}),$(),rd,ji)),Ji.style("top",Wh.top).style("left",Wh.left).style("display","block")}null==a.onresize&&(a.onresize=Ue()),a.onresize.add&&a.onresize.add(function(){We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})})}function Le(a){a.append("rect").attr("class",ad).style("cursor",vg&&wg?"pointer":null).on("mouseover",function(a,b){if(!fi&&!Yd(nf.data.targets)){var c,d,e=nf.data.targets.map(function(a){return lc(a.values[b])});if(Object.keys(kg).length>0){d=[];for(var g in kg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function Pe(a){Yd(nf.data.targets)||vg&&(ei=a,Gi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),fi=!0,Eg())}function Qe(){Yd(nf.data.targets)||vg&&(Gi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Gi.selectAll("."+f.shape).classed(f.INCLUDED,!1),fi=!1,Fg())}function Re(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Nd(),U=Yd(nf.data.targets),V=Dc(nf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?zf:0,O=B?N:0,P=C?N:0,H&&Jg&&gf(xc(nf.data.targets),a),G&&(Yf.domain(mf.extent(Zb(V))),Li=Yf.domain(),uf&&Di.scale(Yf).updateScaleExtent(),_f.domain(Yf.domain()),zi.scale(_f)),F&&(Yf.domain(zi.empty()?Li:zi.extent()),uf&&Di.scale(Yf).updateScaleExtent()),Zf.domain(Ub(V,"y")),$f.domain(Ub(V,"y2")),Vd(V)||(Q=Fc(Ec(V)).sort(),cg.tickValues(Q),fg.tickValues(Q)),c=Gi.select("."+f.axisX).style("opacity",U?0:1),(Ng||D)&&(c=c.transition().duration(P)),c.call(cg),e=Gi.select("."+f.axisY).style("opacity",U?0:1),(!Ng||D)&&(e=e.transition().duration(P)),e.call(dg),Gi.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(eg),F&&Sg&&Q){for(R=1;R=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=Yf.ticks(10);g=Gi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Ng?0:function(a){return Yf(a)-cg.tickOffset()}).attr("x2",Ng?Df:function(a){return Yf(a)-cg.tickOffset()}).attr("y1",Ng?function(a){return Yf(a)-cg.tickOffset()}:Af.top).attr("y2",Ng?function(a){return Yf(a)-cg.tickOffset()}:Ff).style("opacity",function(){return+mf.select(this).attr(Ng?"y1":"x1")===(Ng?Ff:0)?0:1}),g.exit().remove()}ne(sh)&&(i=Gi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(sh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Ng?"":"rotate(-90)").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Ng?0:vd).attr("x2",Ng?Df:vd).attr("y1",Ng?vd:Af.top).attr("y2",Ng?vd:Ff).style("opacity",1),i.select("text").transition().duration(N).attr("x",Ng?Df:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&th&&(k=Gi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Zf.ticks(vh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Ng?Zf:0).attr("x2",Ng?Zf:Df).attr("y1",Ng?0:Zf).attr("y2",Ng?Ff:Zf),k.exit().remove()),y&&ne(uh)&&(l=Gi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(uh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Ng?"rotate(-90)":"").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Ng?wd:0).attr("x2",Ng?wd:Df).attr("y1",Ng?0:wd).attr("y2",Ng?Ff:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Ng?0:Df).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Gi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ji(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Gi.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Ng?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Gi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ai).style("opacity",1),Gi.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Bi).style("opacity",Mi),n=Gi.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",xh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),n.exit().remove(),Gi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=mf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Gi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Gi.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Gg&&(null!==mf.event&&"zoom"===mf.event.type&&zi.extent(Yf.orgDomain()).update(),z&&(Hi.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(fg),zi.empty()||zi.extent(Yf.orgDomain()).update(),J=Ee(T,!0),s=Hi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ji(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Hi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ci).style("opacity",1))),Gi.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Gi.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),t=Gi.select("."+f.eventRects),ne(hg)&&!kc(hg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Gi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Df).attr("height",Ff)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),di&&!ci?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return(Yf(d?d:e+50)-Yf(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return(Yf(d)+Yf(c?c:d-50))/2}):(x=L(),w=function(a){return Yf(a.x)-x/2}),v=wc(),Gi.select("."+f.eventRects).datum(v?v.values:[]),u=Gi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Ng?0:w).attr("y",Ng?w:0).attr("width",Ng?Df:x).attr("height",Ng?x:Ff),u.exit().remove()),q=Gi.select("."+f.regions).selectAll("rect."+f.region).data(Ph),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Ng?0:cc).attr("y",Ng?cc:Af.top).attr("width",Ng?Df:dc).attr("height",Ng?dc:Ff).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),xc(nf.data.targets).forEach(function(a){Ni[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Di.altDomain?(Yf.domain(Di.altDomain),void Di.scale(Yf).updateScaleExtent()):(ci&&Yf.orgDomain()[0]===Li[0]&&Yf.domain([Li[0]-1e-10,Yf.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(gi=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Ei.attr("width",Hf).attr("height",If),Ei.select("#"+Xh).select("rect").attr("width",Df).attr("height",Ff),Ei.select("#"+Yh).select("rect").attr("width",H),Ei.select("#"+Zh).select("rect").attr("width",J),Ei.select("."+f.zoomRect).attr("width",Df).attr("height",Ff)}function We(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Gi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ji(a)}),e=Gi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ji(a)}).style("stroke","none").style("cursor",function(a){return xg(a)?"pointer":null}),c=Gi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ji(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Mi=+mf.select(this).style("opacity"),0}).style("fill",function(a){return ji(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ji(a)}).style("cursor",function(a){return xg(a)?"pointer":null}),a.forEach(function(a){Gi.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Gi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Pf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ji(a.data)}).style("cursor",function(a){return xg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Gg&&(n=Hi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ji(a)}),l=Hi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ji(a)})),Ei.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBBox(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=si?j:i,l=si?Q():P();return d&&(w=0,C=0,t=0,u=0),Jg&&!Cc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=si?u:t,void(Mg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,si?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Ii.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Lg?Lg(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",si?g:-200).attr("y",si?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",si?h:-200).attr("y",si?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return ji(a)}).attr("x",si?g:-200).attr("y",si?-200:i).attr("width",10).attr("height",10),Ii.selectAll("text").data(a).text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ii.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ii.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["transition","duration"],350);g("data","data is required in config");var Af,Bf,Cf,Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg=h(["data","x"]),hg=h(["data","xs"],{}),ig=h(["data","x_format"]),jg=h(["data","id_converter"],function(a){return a}),kg=h(["data","names"],{}),lg=h(["data","classes"],{}),mg=h(["data","groups"],[]),ng=h(["data","axes"],{}),og=h(["data","type"]),pg=h(["data","types"],{}),qg=h(["data","labels"],{}),rg=h(["data","order"]),sg=h(["data","regions"],{}),tg=h(["data","color"]),ug=h(["data","colors"],{}),vg=h(["data","selection","enabled"],!1),wg=h(["data","selection","grouped"],!1),xg=h(["data","selection","isselectable"],function(){return!0}),yg=h(["data","selection","multiple"],!0),zg=h(["data","onclick"],function(){}),Ag=h(["data","onenter"],function(){}),Bg=h(["data","onleave"],function(){}),Cg=h(["data","onselected"],function(){}),Dg=h(["data","onunselected"],function(){}),Eg=h(["data","ondragstart"],function(){}),Fg=h(["data","ondragend"],function(){}),Gg=h(["subchart","show"],!1),Hg=Gg?h(["subchart","size","height"],60):0,Ig=h(["color","pattern"],[]),Jg=h(["legend","show"],!0),Kg=h(["legend","position"],"bottom"),Lg=h(["legend","item","onclick"]),Mg=h(["legend","equally"],!1),Ng=h(["axis","rotated"],!1),Og=h(["axis","x","type"],"indexed"),Pg=h(["axis","x","categories"],[]),Qg=h(["axis","x","tick","centered"],!1),Rg=h(["axis","x","tick","format"]),Sg=h(["axis","x","tick","culling"],{}),Tg=h(["axis","x","tick","culling","max"],"categorized"===Og?1/0:10),Ug=h(["axis","x","tick","count"]),Vg=h(["axis","x","tick","fit"],!1),Wg=h(["axis","x","max"]),Xg=h(["axis","x","min"]),Yg=h(["axis","x","default"]),Zg=h(["axis","x","label"],{}),$g=h(["axis","y","show"],!0),_g=h(["axis","y","max"]),ah=h(["axis","y","min"]),bh=h(["axis","y","center"]),ch=h(["axis","y","label"],{}),dh=h(["axis","y","inner"],!1),eh=h(["axis","y","tick","format"]),fh=h(["axis","y","padding"],{}),gh=h(["axis","y","ticks"],10),hh=h(["axis","y2","show"],!1),ih=h(["axis","y2","max"]),jh=h(["axis","y2","min"]),kh=h(["axis","y2","center"]),lh=h(["axis","y2","label"],{}),mh=h(["axis","y2","inner"],!1),nh=h(["axis","y2","tick","format"]),oh=h(["axis","y2","padding"],{}),ph=h(["axis","y2","ticks"],10),qh=h(["grid","x","show"],!1),rh=h(["grid","x","type"],"tick"),sh=h(["grid","x","lines"],[]),th=h(["grid","y","show"],!1),uh=h(["grid","y","lines"],[]),vh=h(["grid","y","ticks"],10),wh=h(["point","show"],!0),xh=wh?h(["point","r"],2.5):0,yh=h(["point","focus","line","enabled"],!0),zh=h(["point","focus","expand","enabled"],!0),Ah=h(["point","focus","expand","r"],zh?4:xh),Bh=h(["point","focus","select","r"],8),Ch=h(["bar","width"]),Dh=h(["bar","width","ratio"],.6),Eh=h(["pie","label","show"],!0),Fh=h(["pie","label","format"]),Gh=h(["pie","onclick"],function(){}),Hh=h(["pie","onmouseover"],function(){}),Ih=h(["pie","onmouseout"],function(){}),Jh=h(["donut","label","show"],!0),Kh=h(["donut","label","format"]),Lh=h(["donut","title"],""),Mh=h(["donut","onclick"],function(){}),Nh=h(["donut","onmouseover"],function(){}),Oh=h(["donut","onmouseout"],function(){}),Ph=h(["regions"],[]),Qh=h(["tooltip","show"],!0),Rh=h(["tooltip","format","title"]),Sh=h(["tooltip","format","value"]),Th=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Rh?Rh:b,l=Sh?Sh:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Uh=h(["tooltip","init","show"],!1),Vh=h(["tooltip","init","x"],0),Wh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Xh=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",Yh=Xh+"-xaxis",Zh=Xh+"-yaxis",$h=i(Xh),_h=i(Yh),ai=i(Zh),bi="timeseries"===Og,ci="categorized"===Og,di=!bi&&(gg||ne(hg)),ei=null,fi=!1,gi=!1,hi=!1,ii=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ji=he(ug,ne(Ig)?Ig:ii,tg),ki=function(){var a=[[mf.time.format("%Y/%-m/%-d"),function(){return!0}],[mf.time.format("%-m/%-d"),function(a){return a.getMonth()}],[mf.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[mf.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[mf.time.format("%I %p"),function(a){return a.getHours()}],[mf.time.format("%I:%M"),function(a){return a.getMinutes()}],[mf.time.format(":%S"),function(a){return a.getSeconds()}],[mf.time.format(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),li=[],mi=[],ni=Ng?"left":"bottom",oi=Ng?dh?"top":"bottom":dh?"right":"left",pi=Ng?mh?"bottom":"top":mh?"left":"right",qi=Ng?"left":"bottom",ri={main:function(){return"translate("+Af.left+","+Af.top+")"},context:function(){return"translate("+Bf.left+","+Bf.top+")"},legend:function(){return"translate("+Cf.left+","+Cf.top+")"},x:function(){return"translate(0,"+(Ng?0:Ff)+")"},y:function(){return"translate(0,"+(Ng?Ff:0)+")"},y2:function(){return"translate("+(Ng?0:Df)+","+(Ng?1:0)+")"},subx:function(){return"translate(0,"+(Ng?0:Gf)+")"},arc:function(){return"translate("+Df/2+","+Ff/2+")"}},si="right"===Kg,ti=0,ui=0,vi=0,wi=30,xi=30,yi=5;Pf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var zi,Ai=function(){var a=mf.svg.line().x(Ng?function(a){return V(a.id)(a.value)}:ud).y(Ng?ud:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=xe(b.values);return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),sg[b.id]?Je(e,Yf,V(b.id),sg[b.id]):a(e)):(c=Yf(e[0].x),d=V(b.id)(e[0].value),Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Bi=function(){var a;return a=Ng?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Ci=function(){var a=mf.svg.line().x(Ng?function(a){return W(a.id)(a.value)}:xd).y(Ng?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+_f(c[0].x)+" "+W(b.id)(c[0].value)}}(),Di=function(){};zi=mf.svg.brush().on("brush",Se),zi.update=function(){return Hi&&Hi.select("."+f.brush).call(this),this},zi.scale=function(a){return Ng?this.y(a):this.x(a)},uf&&(Di=mf.behavior.zoom().on("zoomstart",function(){Di.altDomain=mf.event.sourceEvent.altKey?Yf.orgDomain():null}).on("zoom",uf?Te:null),Di.scale=function(a){return Ng?this.y(a):this.x(a)},Di.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Di.updateScaleExtent=function(){var a=$b(Yf.orgDomain())/$b(Li),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Ei,Fi,Gi,Hi,Ii,Ji,Ki,Li,Mi,Ni={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Ei.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Ii.selectAll(kd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Ei.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Ii.selectAll(kd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",.5),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){zi.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){lg[b]=a.classes[b]}),"categories"in a&&ci&&(Pg=a.categories,cg.categories(Pg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Gi.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){vg&&Gi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=wg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?xg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){vg&&Gi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=wg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&xg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?mg:(mg=a,Re(),mg)},nf.xgrids=function(a){return a?(sh=a,Re(),sh):sh},nf.xgrids.add=function(a){return a?nf.xgrids(sh.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(sh.filter(b))},nf.ygrids=function(a){return a?(uh=a,Re(),uh):uh},nf.ygrids.add=function(a){return a?nf.ygrids(uh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(uh.filter(b))},nf.regions=function(a){return c(a)?Ph:(Ph=a,Re(),Ph)},nf.regions.add=function(a){return c(a)?Ph:(Ph=Ph.concat(a),Re(),Ph)},nf.regions.remove=function(a,c){var e=[].concat(a);return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;Ei.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Ph=Ph.filter(function(b){return b.classes.indexOf(a)<0})}),Ph},nf.data.get=function(a){var b=nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},nf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){kg[b]=a[b] }),gf(xc(nf.data.targets),{withTransition:!0}),kg):kg},nf.x=function(a){return arguments.length&&(mc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.xs=function(a){return arguments.length&&(nc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(_g=+a.y),b(a.y2)&&(ih=+a.y2)):_g=ih=+a,Re())},nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(ah=+a.y),b(a.y2)&&(jh=+a.y2)):ah=jh=+a,Re())},nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&nf.axis.max(a.max),"undefined"!=typeof a.min&&nf.axis.min(a.min))},nf.legend.show=function(a){Jg||(Jg=!0,Ii.style("visibility","visible")),ef(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.legend.hide=function(a){Jg&&me(a)&&(Jg=!1,Ii.style("visibility","hidden")),ff(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.resize=function(a){qf=a?a.width:null,rf=a?a.height:null,We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},nf.destroy=function(){nf.data.targets=void 0,nf.data.xs={},Ki.html(""),a.onresize=null},"url"in e.data)mf.csv(e.data.url,function(a,b){Ke(b)});else if("rows"in e.data)Ke(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ke(qc(e.data.columns))}return nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From cd004fea652f6f97ac63b9978619e6b6ba540255 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 9 Apr 2014 22:36:54 +0900 Subject: [PATCH 029/178] Purge getBBox - #131 --- c3.js | 13 +++++++------ c3.min.js | 4 ++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/c3.js b/c3.js index 0c7c4c4..7fcc9c5 100644 --- a/c3.js +++ b/c3.js @@ -785,7 +785,7 @@ function getMaxTickWidth(id) { var maxWidth = 0, axisClass = id === 'x' ? CLASS.axisX : id === 'y' ? CLASS.axisY : CLASS.axisY2; d3.selectAll('.' + axisClass + ' .tick text').each(function () { - var box = this.getBBox(); + var box = this.getBoundingClientRect(); if (maxWidth < box.width) { maxWidth = box.width; } }); return maxWidth < 20 ? 20 : maxWidth; @@ -1628,7 +1628,7 @@ .data([min, max]) .enter().append('text') .text(function (d) { return d; }) - .each(function (d, i) { var box = this.getBBox(); widths[i] = box.width * paddingCoef; }) + .each(function (d, i) { widths[i] = this.getBoundingClientRect().width * paddingCoef; }) .remove(); return widths; } @@ -2017,8 +2017,9 @@ return Math.sqrt(Math.pow(cx - mouse[0], 2) + Math.pow(cy - mouse[1], 2)) < _r; } function isWithinBar(_this) { - var mouse = d3.mouse(_this), box = _this.getBBox(); - var x = box.x, y = box.y, w = box.width, h = box.height, offset = 2; + var mouse = d3.mouse(_this), box = _this.getBoundingClientRect(), + seg0 = _this.pathSegList.getItem(0), seg1 = _this.pathSegList.getItem(1); + var x = seg0.x, y = Math.min(seg0.y, seg1.y), w = box.width, h = box.height, offset = 2; var sx = x - offset, ex = x + w + offset, sy = y + h + offset, ey = y - offset; return sx < mouse[0] && mouse[0] < ex && ey < mouse[1] && mouse[1] < sy; } @@ -2212,7 +2213,7 @@ } } function getYForText(points, d, textElement) { - var box = textElement.getBBox(); + var box = textElement.getBoundingClientRect(); if (__axis_rotated) { return (points[0][0] + points[2][0] + box.height * 0.6) / 2; } else { @@ -3719,7 +3720,7 @@ withTransformAll = isDefined(options.withTransformAll) ? options.withTransformAll : true; function updatePositions(textElement, id, reset) { - var box = textElement.getBBox(), + var box = textElement.getBoundingClientRect(), itemWidth = Math.ceil((box.width + paddingRight) / 10) * 10, itemHeight = Math.ceil((box.height + paddingTop) / 10) * 10, itemLength = isLegendRight ? itemHeight : itemWidth, diff --git a/c3.min.js b/c3.min.js index d528171..86e12ab 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.29"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cDf&&(Df=0),0>Ff&&(Ff=0),Bf={top:Ng?Af.top:If-Hg-(si?0:a),right:0/0,bottom:20+(si?0:a),left:Ng?wi:Af.left},Ef=Ng?Af.left-wi-xi:Df,Gf=Ng?Ff:If-Bf.top-Bf.bottom,0>Ef&&(Ef=0),0>Gf&&(Gf=0),Cf={top:si?0:If-a,right:0/0,bottom:0,left:si?Hf-b:0},p(),si&&Yd(nf.data.targets)&&(Cf.left=Df/2+Kf)}function o(){Gi.select("line."+f.xgridFocus).attr("x1",Ng?0:-10).attr("x2",Ng?Df:-10).attr("y1",Ng?-10:Af.top).attr("y2",Ng?-10:Ff)}function p(){Kf=Ff/2,Jf=.95*Kf,Lf=Xd(nf.data.targets)?.6*Jf:0}function q(){var a=Ng?f.axisX:f.axisY,b=mf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=mf.select(pf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return qf?qf:x()}function s(){var a=rf?rf:y();return a>0?a:320}function t(){return Yd(nf.data.targets)?0:sf?sf:Ng||!$g||dh?1:v("y")}function u(){var a=1;return Yd(nf.data.targets)?0:tf?tf:si?P()+(hh&&!Ng?v("y2"):a):hh?mh||Ng?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||$g?"y2"!==a||hh?(gb(a).isInner?30:40)+("y2"===a?-10:0):yi:Jg&&!si?10:1}function x(){return+mf.select(pf).style("width").replace("px","")}function y(){return+mf.select(pf).style("height").replace("px","")}function z(a){return a?-5:-(Af.left-1)}function A(a){return a?-20:-1}function B(){return z(!Ng)}function C(){return A(!Ng)}function D(){return z(Ng)}function E(){return A(Ng)}function F(a){return a?Df+2+4:Af.left+20}function G(a){return a?80:Ff+2}function H(){return F(!Ng)}function I(){return G(!Ng)}function J(){return F(Ng)}function K(){return G(Ng)}function L(){var a=Ng?Ff:Df,b=vc(),c=Vb()*(Ud(nf.data.targets)?(b-(ci?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){ti=a}function N(a){ui=a}function O(a){vi=a}function P(){return Jg?si?ui*(ti+1):Hf:0}function Q(){return Jg?si?If:vi*(ti+1):0}function R(){var a,b=!Yf;Qf=Ng?1:0,Rf=Ng?Ff:Df,Sf=Ng?0:Ff,Tf=Ng?Df:1,Uf=Qf,Vf=Rf,Wf=Ng?0:Gf,Xf=Ng?Ef:1,Yf=T(Qf,Rf,b?void 0:Yf.domain(),function(){return cg.tickOffset()}),Zf=U(Sf,Tf),$f=U(Sf,Tf),_f=T(Qf,Rf,Li,function(a){return a%1?0:fg.tickOffset()}),ag=U(Wf,Xf),bg=U(Wf,Xf),a=$(),cg=X(Yf,ni,a),fg=X(_f,qi,a),dg=Y(Zf,oi,eh,gh),eg=Y($f,pi,nh,ph),b||(zi.scale(_f),uf&&Di.scale(Yf)),S()}function S(){Mf=Db(),Nf=Eb(),Of=Eb(.98)}function T(a,b,e,f){var g=(bi?mf.time.scale():mf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),ci){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return mf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?$f:Zf}function W(a){return"y2"===Z(a)?bg:ag}function X(a,b,c){var d=(ci?Bb():mf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),ci?d.tickCentered(Qg):d.tickOffset=function(){var a=Ng?Ff:Df;return a*Vb()/vc()/2},ci&&d.categories(Pg),d}function Y(a,b,c,d){return mf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in ng?ng[a]:"y"}function $(){var a=bi?ki:ci?Oc:function(a){return 0>a?a.toFixed(0):a};return Rg&&("function"==typeof Rg?a=Rg:bi&&(a=function(a){return mf.time.format(Rg)(a)})),a}function _(a){var b;return"y"===a?b=ch:"y2"===a?b=lh:"x"===a&&(b=Zg),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?ch=b:"y2"===a?lh=b:"x"===a&&(Zg=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Ng?"inner-top":"inner-right")}function eb(){return cb("y",Ng?"inner-right":"inner-top")}function fb(){return cb("y2",Ng?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?Df/2:Df:b.isBottom?-Ff:b.isMiddle?-Ff/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Ng,db())}function ob(){return kb(Ng,eb())}function pb(){return kb(Ng,fb())}function qb(){return lb(!Ng,db())}function rb(){return lb(Ng,eb())}function sb(){return lb(Ng,fb())}function tb(){var a=db();return Ng?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Ng?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Ng?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Ng,db())}function xb(){return mb(Ng,eb())}function yb(){return mb(Ng,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBBox();bb?20:b}function Ab(){Gi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Gi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Gi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return mf.min(Object.keys(i).map(function(a){return mf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(mg.length>0)for(g=Nc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return mf.max(Object.keys(i).map(function(a){return mf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?jh:ah,n="y2"===c?ih:_g,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?kh:bh,r=pd()&&Ng;return 0===l.length?"y2"===c?$f.domain():Zf.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=qd(o,p),j=$b(Zf.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&fh&&(f=b(fh.top)?fh.top:e,g=b(fh.bottom)?fh.bottom:e),"y2"===c&&oh&&(f=b(oh.top)?oh.top:e,g=b(oh.bottom)?oh.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Li),c=$b(Yf.domain());return a||0===c?1:b/c}function Wb(a){return Xg?Xg:mf.min(a,function(a){return mf.min(a.values,function(a){return a.x})})}function Xb(a){return Wg?Wg:mf.max(a,function(a){return mf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return ci?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=bi?new Date(c.getTime()-e):c-e,g=bi?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return gg&&a===gg||ne(hg)&&oe(hg,a)}function fc(a){return!ec(a)}function gc(a){return gg?gg:ne(hg)?hg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=nf.data.xs[b])}),c}function ic(a,b){return a in nf.data.xs&&nf.data.xs[a]&&nf.data.xs[a][b]?nf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){hg[b]=a[b]})}function kc(a){return 1===mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=kg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),nf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=bi?a?a instanceof Date?a:ie(a):ie(ic(b,c)):di&&!ci?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):gg?(d=Object.keys(nf.data.xs),nf.data.xs[c]=d.length>0?nf.data.xs[d[0]]:void 0):ne(hg)&&(nf.data.xs[c]=hc(f,nf.data.targets)):nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=jg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return di&&ci&&0===c&&g&&(0===e&&(Pg=[]),Pg.push(g)),("undefined"==typeof a[b]||nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),og&&Sd(xc(c).filter(function(a){return!(a in pg)}),og),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function tc(a){return a>0&&nf.data.targets[0].values[a-1]?nf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?nf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?nf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(nf.data.targets)}function zc(a,b){var c,d=xc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(bi?new Date(h):h);i.push(d)}return i}function Gc(a){li=li.concat(a)}function Hc(a){li=li.filter(function(b){return a.indexOf(b)<0})}function Ic(a){mi=mi.concat(a)}function Jc(a){mi=mi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Ed(){return rg&&"desc"===rg.toLowerCase()}function Fd(){return rg&&"asc"===rg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof rg&&a.sort(rg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(nf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Qh&&0!==m.length&&(Ji.html(Th(a,$(),l,ji)).style("display","block"),d=Ji.property("offsetWidth"),e=Ji.property("offsetHeight"),k?(g=Df/2+c[0],i=Ff/2+c[1]+20):(Ng?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Yf(m[0].x)+20):(f=q(),g=f+t()+Yf(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Ji.style("top",i+"px").style("left",g+"px"))}function Id(){Ji.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Qh&&(Vd(nf.data.targets)||Yd(nf.data.targets)||Gi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Ng?"y1":"x1",ud).attr(Ng?"y2":"x2",ud))}function Kd(){Gi.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?Yf(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Ch?Ch:b?2*a.tickOffset()*Dh/b:0}function Sd(a,b){yc(a).forEach(function(a){Ni[a]=b===pg[a],pg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){pg[a.id]===b&&(c=!0),a.id in pg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in pg)||"line"===pg[b]||"spline"===pg[b]||"area"===pg[b]||"area-spline"===pg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===pg[b]||"area-spline"===pg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===pg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===pg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===pg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===pg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ie(b){var c;if(!b)throw Error(b+" can not be parsed as d3.time with format "+ig+". Maybe 'x' of this data is not defined. See data.x or data.xs option.");try{c=ig?mf.time.format(ig).parse(b):new Date(b)}catch(d){c=void 0}return c||a.console.error("Failed to parse x '"+b+"' to Date with format "+ig),c}function je(a,b){var c=mf.mouse(a),d=mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?Zf:$f,d=Ng?1:0,e=Ng?0:1;return Math.pow(Yf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Cg(b,a.node()),Gi.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md).attr("stroke",function(){return ji(b)}).attr("r",1.4*Bh).transition().duration(100).attr("r",Bh)}function se(a,b,c){Dg(b,a.node()),Gi.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Cg(b,a.node()),a.transition().duration(100).style("fill",function(){return mf.rgb(ji(b)).darker(1)})}function ve(a,b){Dg(b,a.node()),a.transition().duration(100).style("fill",function(){return ji(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Gi.selectAll("."+f.circles+gd(c)):Gi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",Ah)}function Ae(a){ye(a).filter(function(){return mf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",xh)}function Be(a){return Gi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Ng?1:0,f=Ng?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Ng?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBBox();return Ng?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(cg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Ng&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Je(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function Ke(b){var c,d,e;if(Ki=mf.select(pf),Ki.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Ki.html(""),Ki.classed("c3",!0),nf.data.xs={},nf.data.targets=rc(b),n(),R(),Yf.domain(mf.extent(Zb(nf.data.targets))),Zf.domain(Ub(nf.data.targets,"y")),$f.domain(Ub(nf.data.targets,"y2")),_f.domain(Yf.domain()),ag.domain(Zf.domain()),bg.domain($f.domain()),Li=Yf.domain(),zi.scale(_f),uf&&Di.scale(Yf),Ei=Ki.append("svg").attr("width",Df+Af.left+Af.right).attr("height",Ff+Af.top+Af.bottom).on("mouseenter",xf).on("mouseleave",yf),Fi=Ei.append("defs"),Fi.append("clipPath").attr("id",Xh).append("rect").attr("width",Df).attr("height",Ff),Fi.append("clipPath").attr("id",Yh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Fi.append("clipPath").attr("id",Zh).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Gi=Ei.append("g").attr("transform",ri.main),Hi=Gg?Ei.append("g").attr("transform",ri.context):null,Ii=Ei.append("g").attr("transform",ri.legend),Jg||(Ii.style("visibility","hidden"),mi=xc(nf.data.targets)),Ji=mf.select(pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),gf(xc(nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Gi.append("g").attr("class",f.axisX).attr("clip-path",Ng?"":_h).attr("transform",ri.x).append("text").attr("class",f.axisXLabel).attr("transform",Ng?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),$g&&Gi.append("g").attr("class",f.axisY).attr("clip-path",Ng?ai:"").attr("transform",ri.y).append("text").attr("class",f.axisYLabel).attr("transform",Ng?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),hh&&Gi.append("g").attr("class",f.axisY2).attr("transform",ri.y2).append("text").attr("class",f.axisY2Label).attr("transform",Ng?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Gi.append("g").attr("clip-path",$h).attr("class",f.grid),qh&&d.append("g").attr("class",f.xgrids),ne(sh)&&d.append("g").attr("class",f.xgridLines),yh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),th&&d.append("g").attr("class",f.ygrids),ne(uh)&&d.append("g").attr("class",f.ygridLines),Gi.append("g").attr("clip-path",$h).attr("class",f.regions),Gi.append("g").attr("clip-path",$h).attr("class",f.chart),c=Gi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",uf?Ng?"ns-resize":"ew-resize":null),Gi.select("."+f.chart).append("g").attr("class",f.chartBars),Gi.select("."+f.chart).append("g").attr("class",f.chartLines),Gi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",ri.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Gi.select("."+f.chart).append("g").attr("class",f.chartTexts),uf&&Gi.insert("rect",wf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Df).attr("height",Ff).style("opacity",0).style("cursor",Ng?"ns-resize":"ew-resize").call(Di).on("dblclick.zoom",null),Yg&&zi.extent("function"!=typeof Yg?Yg:Yg(Zb())),Gg&&(Hi.append("g").attr("clip-path",$h).attr("class",f.chart),Hi.select("."+f.chart).append("g").attr("class",f.chartBars),Hi.select("."+f.chart).append("g").attr("class",f.chartLines),Hi.append("g").attr("clip-path",$h).attr("class",f.brush).call(zi).selectAll("rect").attr(Ng?"width":"height",Ng?Ef:Gf),Hi.append("g").attr("class",f.axisX).attr("transform",ri.subx).attr("clip-path",Ng?"":_h)),Xe(nf.data.targets),Ng?Gi.select("."+f.axisX).style("opacity",0).call(cg):(Gi.select("."+f.axisY).style("opacity",0).call(dg),Gi.select("."+f.axisY2).style("opacity",0).call(eg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Uh){if(bi&&"string"==typeof Vh){for(Vh=ie(Vh),e=0;e0){d=[];for(var g in kg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function Pe(a){Yd(nf.data.targets)||vg&&(ei=a,Gi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),fi=!0,Eg())}function Qe(){Yd(nf.data.targets)||vg&&(Gi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Gi.selectAll("."+f.shape).classed(f.INCLUDED,!1),fi=!1,Fg())}function Re(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Nd(),U=Yd(nf.data.targets),V=Dc(nf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?zf:0,O=B?N:0,P=C?N:0,H&&Jg&&gf(xc(nf.data.targets),a),G&&(Yf.domain(mf.extent(Zb(V))),Li=Yf.domain(),uf&&Di.scale(Yf).updateScaleExtent(),_f.domain(Yf.domain()),zi.scale(_f)),F&&(Yf.domain(zi.empty()?Li:zi.extent()),uf&&Di.scale(Yf).updateScaleExtent()),Zf.domain(Ub(V,"y")),$f.domain(Ub(V,"y2")),Vd(V)||(Q=Fc(Ec(V)).sort(),cg.tickValues(Q),fg.tickValues(Q)),c=Gi.select("."+f.axisX).style("opacity",U?0:1),(Ng||D)&&(c=c.transition().duration(P)),c.call(cg),e=Gi.select("."+f.axisY).style("opacity",U?0:1),(!Ng||D)&&(e=e.transition().duration(P)),e.call(dg),Gi.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(eg),F&&Sg&&Q){for(R=1;R=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=Yf.ticks(10);g=Gi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Ng?0:function(a){return Yf(a)-cg.tickOffset()}).attr("x2",Ng?Df:function(a){return Yf(a)-cg.tickOffset()}).attr("y1",Ng?function(a){return Yf(a)-cg.tickOffset()}:Af.top).attr("y2",Ng?function(a){return Yf(a)-cg.tickOffset()}:Ff).style("opacity",function(){return+mf.select(this).attr(Ng?"y1":"x1")===(Ng?Ff:0)?0:1}),g.exit().remove()}ne(sh)&&(i=Gi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(sh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Ng?"":"rotate(-90)").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Ng?0:vd).attr("x2",Ng?Df:vd).attr("y1",Ng?vd:Af.top).attr("y2",Ng?vd:Ff).style("opacity",1),i.select("text").transition().duration(N).attr("x",Ng?Df:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&th&&(k=Gi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Zf.ticks(vh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Ng?Zf:0).attr("x2",Ng?Zf:Df).attr("y1",Ng?0:Zf).attr("y2",Ng?Ff:Zf),k.exit().remove()),y&&ne(uh)&&(l=Gi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(uh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Ng?"rotate(-90)":"").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Ng?wd:0).attr("x2",Ng?wd:Df).attr("y1",Ng?0:wd).attr("y2",Ng?Ff:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Ng?0:Df).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Gi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ji(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Gi.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Ng?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Gi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ai).style("opacity",1),Gi.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Bi).style("opacity",Mi),n=Gi.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",xh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),n.exit().remove(),Gi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=mf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Gi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Gi.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Gg&&(null!==mf.event&&"zoom"===mf.event.type&&zi.extent(Yf.orgDomain()).update(),z&&(Hi.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(fg),zi.empty()||zi.extent(Yf.orgDomain()).update(),J=Ee(T,!0),s=Hi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ji(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Hi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ci).style("opacity",1))),Gi.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Gi.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),t=Gi.select("."+f.eventRects),ne(hg)&&!kc(hg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Gi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Df).attr("height",Ff)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),di&&!ci?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return(Yf(d?d:e+50)-Yf(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return(Yf(d)+Yf(c?c:d-50))/2}):(x=L(),w=function(a){return Yf(a.x)-x/2}),v=wc(),Gi.select("."+f.eventRects).datum(v?v.values:[]),u=Gi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Ng?0:w).attr("y",Ng?w:0).attr("width",Ng?Df:x).attr("height",Ng?x:Ff),u.exit().remove()),q=Gi.select("."+f.regions).selectAll("rect."+f.region).data(Ph),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Ng?0:cc).attr("y",Ng?cc:Af.top).attr("width",Ng?Df:dc).attr("height",Ng?dc:Ff).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),xc(nf.data.targets).forEach(function(a){Ni[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Di.altDomain?(Yf.domain(Di.altDomain),void Di.scale(Yf).updateScaleExtent()):(ci&&Yf.orgDomain()[0]===Li[0]&&Yf.domain([Li[0]-1e-10,Yf.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(gi=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Ei.attr("width",Hf).attr("height",If),Ei.select("#"+Xh).select("rect").attr("width",Df).attr("height",Ff),Ei.select("#"+Yh).select("rect").attr("width",H),Ei.select("#"+Zh).select("rect").attr("width",J),Ei.select("."+f.zoomRect).attr("width",Df).attr("height",Ff)}function We(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Gi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ji(a)}),e=Gi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ji(a)}).style("stroke","none").style("cursor",function(a){return xg(a)?"pointer":null}),c=Gi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ji(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Mi=+mf.select(this).style("opacity"),0}).style("fill",function(a){return ji(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ji(a)}).style("cursor",function(a){return xg(a)?"pointer":null}),a.forEach(function(a){Gi.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Gi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Pf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ji(a.data)}).style("cursor",function(a){return xg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Gg&&(n=Hi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ji(a)}),l=Hi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ji(a)})),Ei.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBBox(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=si?j:i,l=si?Q():P();return d&&(w=0,C=0,t=0,u=0),Jg&&!Cc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=si?u:t,void(Mg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,si?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Ii.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Lg?Lg(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",si?g:-200).attr("y",si?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",si?h:-200).attr("y",si?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return ji(a)}).attr("x",si?g:-200).attr("y",si?-200:i).attr("width",10).attr("height",10),Ii.selectAll("text").data(a).text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ii.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ii.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["transition","duration"],350);g("data","data is required in config");var Af,Bf,Cf,Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg=h(["data","x"]),hg=h(["data","xs"],{}),ig=h(["data","x_format"]),jg=h(["data","id_converter"],function(a){return a}),kg=h(["data","names"],{}),lg=h(["data","classes"],{}),mg=h(["data","groups"],[]),ng=h(["data","axes"],{}),og=h(["data","type"]),pg=h(["data","types"],{}),qg=h(["data","labels"],{}),rg=h(["data","order"]),sg=h(["data","regions"],{}),tg=h(["data","color"]),ug=h(["data","colors"],{}),vg=h(["data","selection","enabled"],!1),wg=h(["data","selection","grouped"],!1),xg=h(["data","selection","isselectable"],function(){return!0}),yg=h(["data","selection","multiple"],!0),zg=h(["data","onclick"],function(){}),Ag=h(["data","onenter"],function(){}),Bg=h(["data","onleave"],function(){}),Cg=h(["data","onselected"],function(){}),Dg=h(["data","onunselected"],function(){}),Eg=h(["data","ondragstart"],function(){}),Fg=h(["data","ondragend"],function(){}),Gg=h(["subchart","show"],!1),Hg=Gg?h(["subchart","size","height"],60):0,Ig=h(["color","pattern"],[]),Jg=h(["legend","show"],!0),Kg=h(["legend","position"],"bottom"),Lg=h(["legend","item","onclick"]),Mg=h(["legend","equally"],!1),Ng=h(["axis","rotated"],!1),Og=h(["axis","x","type"],"indexed"),Pg=h(["axis","x","categories"],[]),Qg=h(["axis","x","tick","centered"],!1),Rg=h(["axis","x","tick","format"]),Sg=h(["axis","x","tick","culling"],{}),Tg=h(["axis","x","tick","culling","max"],"categorized"===Og?1/0:10),Ug=h(["axis","x","tick","count"]),Vg=h(["axis","x","tick","fit"],!1),Wg=h(["axis","x","max"]),Xg=h(["axis","x","min"]),Yg=h(["axis","x","default"]),Zg=h(["axis","x","label"],{}),$g=h(["axis","y","show"],!0),_g=h(["axis","y","max"]),ah=h(["axis","y","min"]),bh=h(["axis","y","center"]),ch=h(["axis","y","label"],{}),dh=h(["axis","y","inner"],!1),eh=h(["axis","y","tick","format"]),fh=h(["axis","y","padding"],{}),gh=h(["axis","y","ticks"],10),hh=h(["axis","y2","show"],!1),ih=h(["axis","y2","max"]),jh=h(["axis","y2","min"]),kh=h(["axis","y2","center"]),lh=h(["axis","y2","label"],{}),mh=h(["axis","y2","inner"],!1),nh=h(["axis","y2","tick","format"]),oh=h(["axis","y2","padding"],{}),ph=h(["axis","y2","ticks"],10),qh=h(["grid","x","show"],!1),rh=h(["grid","x","type"],"tick"),sh=h(["grid","x","lines"],[]),th=h(["grid","y","show"],!1),uh=h(["grid","y","lines"],[]),vh=h(["grid","y","ticks"],10),wh=h(["point","show"],!0),xh=wh?h(["point","r"],2.5):0,yh=h(["point","focus","line","enabled"],!0),zh=h(["point","focus","expand","enabled"],!0),Ah=h(["point","focus","expand","r"],zh?4:xh),Bh=h(["point","focus","select","r"],8),Ch=h(["bar","width"]),Dh=h(["bar","width","ratio"],.6),Eh=h(["pie","label","show"],!0),Fh=h(["pie","label","format"]),Gh=h(["pie","onclick"],function(){}),Hh=h(["pie","onmouseover"],function(){}),Ih=h(["pie","onmouseout"],function(){}),Jh=h(["donut","label","show"],!0),Kh=h(["donut","label","format"]),Lh=h(["donut","title"],""),Mh=h(["donut","onclick"],function(){}),Nh=h(["donut","onmouseover"],function(){}),Oh=h(["donut","onmouseout"],function(){}),Ph=h(["regions"],[]),Qh=h(["tooltip","show"],!0),Rh=h(["tooltip","format","title"]),Sh=h(["tooltip","format","value"]),Th=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Rh?Rh:b,l=Sh?Sh:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Uh=h(["tooltip","init","show"],!1),Vh=h(["tooltip","init","x"],0),Wh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Xh=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",Yh=Xh+"-xaxis",Zh=Xh+"-yaxis",$h=i(Xh),_h=i(Yh),ai=i(Zh),bi="timeseries"===Og,ci="categorized"===Og,di=!bi&&(gg||ne(hg)),ei=null,fi=!1,gi=!1,hi=!1,ii=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ji=he(ug,ne(Ig)?Ig:ii,tg),ki=function(){var a=[[mf.time.format("%Y/%-m/%-d"),function(){return!0}],[mf.time.format("%-m/%-d"),function(a){return a.getMonth()}],[mf.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[mf.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[mf.time.format("%I %p"),function(a){return a.getHours()}],[mf.time.format("%I:%M"),function(a){return a.getMinutes()}],[mf.time.format(":%S"),function(a){return a.getSeconds()}],[mf.time.format(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),li=[],mi=[],ni=Ng?"left":"bottom",oi=Ng?dh?"top":"bottom":dh?"right":"left",pi=Ng?mh?"bottom":"top":mh?"left":"right",qi=Ng?"left":"bottom",ri={main:function(){return"translate("+Af.left+","+Af.top+")"},context:function(){return"translate("+Bf.left+","+Bf.top+")"},legend:function(){return"translate("+Cf.left+","+Cf.top+")"},x:function(){return"translate(0,"+(Ng?0:Ff)+")"},y:function(){return"translate(0,"+(Ng?Ff:0)+")"},y2:function(){return"translate("+(Ng?0:Df)+","+(Ng?1:0)+")"},subx:function(){return"translate(0,"+(Ng?0:Gf)+")"},arc:function(){return"translate("+Df/2+","+Ff/2+")"}},si="right"===Kg,ti=0,ui=0,vi=0,wi=30,xi=30,yi=5;Pf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var zi,Ai=function(){var a=mf.svg.line().x(Ng?function(a){return V(a.id)(a.value)}:ud).y(Ng?ud:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=xe(b.values);return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),sg[b.id]?Je(e,Yf,V(b.id),sg[b.id]):a(e)):(c=Yf(e[0].x),d=V(b.id)(e[0].value),Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Bi=function(){var a;return a=Ng?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Ci=function(){var a=mf.svg.line().x(Ng?function(a){return W(a.id)(a.value)}:xd).y(Ng?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+_f(c[0].x)+" "+W(b.id)(c[0].value)}}(),Di=function(){};zi=mf.svg.brush().on("brush",Se),zi.update=function(){return Hi&&Hi.select("."+f.brush).call(this),this},zi.scale=function(a){return Ng?this.y(a):this.x(a)},uf&&(Di=mf.behavior.zoom().on("zoomstart",function(){Di.altDomain=mf.event.sourceEvent.altKey?Yf.orgDomain():null}).on("zoom",uf?Te:null),Di.scale=function(a){return Ng?this.y(a):this.x(a)},Di.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Di.updateScaleExtent=function(){var a=$b(Yf.orgDomain())/$b(Li),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Ei,Fi,Gi,Hi,Ii,Ji,Ki,Li,Mi,Ni={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Ei.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Ii.selectAll(kd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Ei.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Ii.selectAll(kd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",.5),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){zi.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){lg[b]=a.classes[b]}),"categories"in a&&ci&&(Pg=a.categories,cg.categories(Pg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Gi.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){vg&&Gi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=wg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?xg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){vg&&Gi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=wg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&xg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?mg:(mg=a,Re(),mg)},nf.xgrids=function(a){return a?(sh=a,Re(),sh):sh},nf.xgrids.add=function(a){return a?nf.xgrids(sh.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(sh.filter(b))},nf.ygrids=function(a){return a?(uh=a,Re(),uh):uh},nf.ygrids.add=function(a){return a?nf.ygrids(uh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(uh.filter(b))},nf.regions=function(a){return c(a)?Ph:(Ph=a,Re(),Ph)},nf.regions.add=function(a){return c(a)?Ph:(Ph=Ph.concat(a),Re(),Ph)},nf.regions.remove=function(a,c){var e=[].concat(a);return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;Ei.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Ph=Ph.filter(function(b){return b.classes.indexOf(a)<0})}),Ph},nf.data.get=function(a){var b=nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},nf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){kg[b]=a[b] +!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.29"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cDf&&(Df=0),0>Ff&&(Ff=0),Bf={top:Ng?Af.top:If-Hg-(si?0:a),right:0/0,bottom:20+(si?0:a),left:Ng?wi:Af.left},Ef=Ng?Af.left-wi-xi:Df,Gf=Ng?Ff:If-Bf.top-Bf.bottom,0>Ef&&(Ef=0),0>Gf&&(Gf=0),Cf={top:si?0:If-a,right:0/0,bottom:0,left:si?Hf-b:0},p(),si&&Yd(nf.data.targets)&&(Cf.left=Df/2+Kf)}function o(){Gi.select("line."+f.xgridFocus).attr("x1",Ng?0:-10).attr("x2",Ng?Df:-10).attr("y1",Ng?-10:Af.top).attr("y2",Ng?-10:Ff)}function p(){Kf=Ff/2,Jf=.95*Kf,Lf=Xd(nf.data.targets)?.6*Jf:0}function q(){var a=Ng?f.axisX:f.axisY,b=mf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=mf.select(pf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return qf?qf:x()}function s(){var a=rf?rf:y();return a>0?a:320}function t(){return Yd(nf.data.targets)?0:sf?sf:Ng||!$g||dh?1:v("y")}function u(){var a=1;return Yd(nf.data.targets)?0:tf?tf:si?P()+(hh&&!Ng?v("y2"):a):hh?mh||Ng?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||$g?"y2"!==a||hh?(gb(a).isInner?30:40)+("y2"===a?-10:0):yi:Jg&&!si?10:1}function x(){return+mf.select(pf).style("width").replace("px","")}function y(){return+mf.select(pf).style("height").replace("px","")}function z(a){return a?-5:-(Af.left-1)}function A(a){return a?-20:-1}function B(){return z(!Ng)}function C(){return A(!Ng)}function D(){return z(Ng)}function E(){return A(Ng)}function F(a){return a?Df+2+4:Af.left+20}function G(a){return a?80:Ff+2}function H(){return F(!Ng)}function I(){return G(!Ng)}function J(){return F(Ng)}function K(){return G(Ng)}function L(){var a=Ng?Ff:Df,b=vc(),c=Vb()*(Ud(nf.data.targets)?(b-(ci?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){ti=a}function N(a){ui=a}function O(a){vi=a}function P(){return Jg?si?ui*(ti+1):Hf:0}function Q(){return Jg?si?If:vi*(ti+1):0}function R(){var a,b=!Yf;Qf=Ng?1:0,Rf=Ng?Ff:Df,Sf=Ng?0:Ff,Tf=Ng?Df:1,Uf=Qf,Vf=Rf,Wf=Ng?0:Gf,Xf=Ng?Ef:1,Yf=T(Qf,Rf,b?void 0:Yf.domain(),function(){return cg.tickOffset()}),Zf=U(Sf,Tf),$f=U(Sf,Tf),_f=T(Qf,Rf,Li,function(a){return a%1?0:fg.tickOffset()}),ag=U(Wf,Xf),bg=U(Wf,Xf),a=$(),cg=X(Yf,ni,a),fg=X(_f,qi,a),dg=Y(Zf,oi,eh,gh),eg=Y($f,pi,nh,ph),b||(zi.scale(_f),uf&&Di.scale(Yf)),S()}function S(){Mf=Db(),Nf=Eb(),Of=Eb(.98)}function T(a,b,e,f){var g=(bi?mf.time.scale():mf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),ci){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return mf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?$f:Zf}function W(a){return"y2"===Z(a)?bg:ag}function X(a,b,c){var d=(ci?Bb():mf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),ci?d.tickCentered(Qg):d.tickOffset=function(){var a=Ng?Ff:Df;return a*Vb()/vc()/2},ci&&d.categories(Pg),d}function Y(a,b,c,d){return mf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in ng?ng[a]:"y"}function $(){var a=bi?ki:ci?Oc:function(a){return 0>a?a.toFixed(0):a};return Rg&&("function"==typeof Rg?a=Rg:bi&&(a=function(a){return mf.time.format(Rg)(a)})),a}function _(a){var b;return"y"===a?b=ch:"y2"===a?b=lh:"x"===a&&(b=Zg),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?ch=b:"y2"===a?lh=b:"x"===a&&(Zg=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Ng?"inner-top":"inner-right")}function eb(){return cb("y",Ng?"inner-right":"inner-top")}function fb(){return cb("y2",Ng?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?Df/2:Df:b.isBottom?-Ff:b.isMiddle?-Ff/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Ng,db())}function ob(){return kb(Ng,eb())}function pb(){return kb(Ng,fb())}function qb(){return lb(!Ng,db())}function rb(){return lb(Ng,eb())}function sb(){return lb(Ng,fb())}function tb(){var a=db();return Ng?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Ng?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Ng?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Ng,db())}function xb(){return mb(Ng,eb())}function yb(){return mb(Ng,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Gi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Gi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Gi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return mf.min(Object.keys(i).map(function(a){return mf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(mg.length>0)for(g=Nc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return mf.max(Object.keys(i).map(function(a){return mf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?jh:ah,n="y2"===c?ih:_g,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?kh:bh,r=pd()&&Ng;return 0===l.length?"y2"===c?$f.domain():Zf.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=qd(o,p),j=$b(Zf.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&fh&&(f=b(fh.top)?fh.top:e,g=b(fh.bottom)?fh.bottom:e),"y2"===c&&oh&&(f=b(oh.top)?oh.top:e,g=b(oh.bottom)?oh.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Li),c=$b(Yf.domain());return a||0===c?1:b/c}function Wb(a){return Xg?Xg:mf.min(a,function(a){return mf.min(a.values,function(a){return a.x})})}function Xb(a){return Wg?Wg:mf.max(a,function(a){return mf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return ci?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=bi?new Date(c.getTime()-e):c-e,g=bi?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return gg&&a===gg||ne(hg)&&oe(hg,a)}function fc(a){return!ec(a)}function gc(a){return gg?gg:ne(hg)?hg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=nf.data.xs[b])}),c}function ic(a,b){return a in nf.data.xs&&nf.data.xs[a]&&nf.data.xs[a][b]?nf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){hg[b]=a[b]})}function kc(a){return 1===mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=kg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),nf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=bi?a?a instanceof Date?a:ie(a):ie(ic(b,c)):di&&!ci?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):gg?(d=Object.keys(nf.data.xs),nf.data.xs[c]=d.length>0?nf.data.xs[d[0]]:void 0):ne(hg)&&(nf.data.xs[c]=hc(f,nf.data.targets)):nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=jg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return di&&ci&&0===c&&g&&(0===e&&(Pg=[]),Pg.push(g)),("undefined"==typeof a[b]||nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),og&&Sd(xc(c).filter(function(a){return!(a in pg)}),og),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function tc(a){return a>0&&nf.data.targets[0].values[a-1]?nf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?nf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?nf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(nf.data.targets)}function zc(a,b){var c,d=xc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(bi?new Date(h):h);i.push(d)}return i}function Gc(a){li=li.concat(a)}function Hc(a){li=li.filter(function(b){return a.indexOf(b)<0})}function Ic(a){mi=mi.concat(a)}function Jc(a){mi=mi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Ed(){return rg&&"desc"===rg.toLowerCase()}function Fd(){return rg&&"asc"===rg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof rg&&a.sort(rg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(nf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Qh&&0!==m.length&&(Ji.html(Th(a,$(),l,ji)).style("display","block"),d=Ji.property("offsetWidth"),e=Ji.property("offsetHeight"),k?(g=Df/2+c[0],i=Ff/2+c[1]+20):(Ng?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Yf(m[0].x)+20):(f=q(),g=f+t()+Yf(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Ji.style("top",i+"px").style("left",g+"px"))}function Id(){Ji.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Qh&&(Vd(nf.data.targets)||Yd(nf.data.targets)||Gi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Ng?"y1":"x1",ud).attr(Ng?"y2":"x2",ud))}function Kd(){Gi.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?Yf(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Ch?Ch:b?2*a.tickOffset()*Dh/b:0}function Sd(a,b){yc(a).forEach(function(a){Ni[a]=b===pg[a],pg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){pg[a.id]===b&&(c=!0),a.id in pg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in pg)||"line"===pg[b]||"spline"===pg[b]||"area"===pg[b]||"area-spline"===pg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===pg[b]||"area-spline"===pg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===pg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===pg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===pg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===pg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ie(b){var c;if(!b)throw Error(b+" can not be parsed as d3.time with format "+ig+". Maybe 'x' of this data is not defined. See data.x or data.xs option.");try{c=ig?mf.time.format(ig).parse(b):new Date(b)}catch(d){c=void 0}return c||a.console.error("Failed to parse x '"+b+"' to Date with format "+ig),c}function je(a,b){var c=mf.mouse(a),d=mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?Zf:$f,d=Ng?1:0,e=Ng?0:1;return Math.pow(Yf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Cg(b,a.node()),Gi.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md).attr("stroke",function(){return ji(b)}).attr("r",1.4*Bh).transition().duration(100).attr("r",Bh)}function se(a,b,c){Dg(b,a.node()),Gi.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Cg(b,a.node()),a.transition().duration(100).style("fill",function(){return mf.rgb(ji(b)).darker(1)})}function ve(a,b){Dg(b,a.node()),a.transition().duration(100).style("fill",function(){return ji(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Gi.selectAll("."+f.circles+gd(c)):Gi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",Ah)}function Ae(a){ye(a).filter(function(){return mf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",xh)}function Be(a){return Gi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Ng?1:0,f=Ng?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Ng?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBoundingClientRect();return Ng?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(cg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Ng&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Je(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function Ke(b){var c,d,e;if(Ki=mf.select(pf),Ki.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Ki.html(""),Ki.classed("c3",!0),nf.data.xs={},nf.data.targets=rc(b),n(),R(),Yf.domain(mf.extent(Zb(nf.data.targets))),Zf.domain(Ub(nf.data.targets,"y")),$f.domain(Ub(nf.data.targets,"y2")),_f.domain(Yf.domain()),ag.domain(Zf.domain()),bg.domain($f.domain()),Li=Yf.domain(),zi.scale(_f),uf&&Di.scale(Yf),Ei=Ki.append("svg").attr("width",Df+Af.left+Af.right).attr("height",Ff+Af.top+Af.bottom).on("mouseenter",xf).on("mouseleave",yf),Fi=Ei.append("defs"),Fi.append("clipPath").attr("id",Xh).append("rect").attr("width",Df).attr("height",Ff),Fi.append("clipPath").attr("id",Yh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Fi.append("clipPath").attr("id",Zh).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Gi=Ei.append("g").attr("transform",ri.main),Hi=Gg?Ei.append("g").attr("transform",ri.context):null,Ii=Ei.append("g").attr("transform",ri.legend),Jg||(Ii.style("visibility","hidden"),mi=xc(nf.data.targets)),Ji=mf.select(pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),gf(xc(nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Gi.append("g").attr("class",f.axisX).attr("clip-path",Ng?"":_h).attr("transform",ri.x).append("text").attr("class",f.axisXLabel).attr("transform",Ng?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),$g&&Gi.append("g").attr("class",f.axisY).attr("clip-path",Ng?ai:"").attr("transform",ri.y).append("text").attr("class",f.axisYLabel).attr("transform",Ng?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),hh&&Gi.append("g").attr("class",f.axisY2).attr("transform",ri.y2).append("text").attr("class",f.axisY2Label).attr("transform",Ng?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Gi.append("g").attr("clip-path",$h).attr("class",f.grid),qh&&d.append("g").attr("class",f.xgrids),ne(sh)&&d.append("g").attr("class",f.xgridLines),yh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),th&&d.append("g").attr("class",f.ygrids),ne(uh)&&d.append("g").attr("class",f.ygridLines),Gi.append("g").attr("clip-path",$h).attr("class",f.regions),Gi.append("g").attr("clip-path",$h).attr("class",f.chart),c=Gi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",uf?Ng?"ns-resize":"ew-resize":null),Gi.select("."+f.chart).append("g").attr("class",f.chartBars),Gi.select("."+f.chart).append("g").attr("class",f.chartLines),Gi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",ri.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Gi.select("."+f.chart).append("g").attr("class",f.chartTexts),uf&&Gi.insert("rect",wf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Df).attr("height",Ff).style("opacity",0).style("cursor",Ng?"ns-resize":"ew-resize").call(Di).on("dblclick.zoom",null),Yg&&zi.extent("function"!=typeof Yg?Yg:Yg(Zb())),Gg&&(Hi.append("g").attr("clip-path",$h).attr("class",f.chart),Hi.select("."+f.chart).append("g").attr("class",f.chartBars),Hi.select("."+f.chart).append("g").attr("class",f.chartLines),Hi.append("g").attr("clip-path",$h).attr("class",f.brush).call(zi).selectAll("rect").attr(Ng?"width":"height",Ng?Ef:Gf),Hi.append("g").attr("class",f.axisX).attr("transform",ri.subx).attr("clip-path",Ng?"":_h)),Xe(nf.data.targets),Ng?Gi.select("."+f.axisX).style("opacity",0).call(cg):(Gi.select("."+f.axisY).style("opacity",0).call(dg),Gi.select("."+f.axisY2).style("opacity",0).call(eg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Uh){if(bi&&"string"==typeof Vh){for(Vh=ie(Vh),e=0;e0){d=[];for(var g in kg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function Pe(a){Yd(nf.data.targets)||vg&&(ei=a,Gi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),fi=!0,Eg())}function Qe(){Yd(nf.data.targets)||vg&&(Gi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Gi.selectAll("."+f.shape).classed(f.INCLUDED,!1),fi=!1,Fg())}function Re(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Nd(),U=Yd(nf.data.targets),V=Dc(nf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?zf:0,O=B?N:0,P=C?N:0,H&&Jg&&gf(xc(nf.data.targets),a),G&&(Yf.domain(mf.extent(Zb(V))),Li=Yf.domain(),uf&&Di.scale(Yf).updateScaleExtent(),_f.domain(Yf.domain()),zi.scale(_f)),F&&(Yf.domain(zi.empty()?Li:zi.extent()),uf&&Di.scale(Yf).updateScaleExtent()),Zf.domain(Ub(V,"y")),$f.domain(Ub(V,"y2")),Vd(V)||(Q=Fc(Ec(V)).sort(),cg.tickValues(Q),fg.tickValues(Q)),c=Gi.select("."+f.axisX).style("opacity",U?0:1),(Ng||D)&&(c=c.transition().duration(P)),c.call(cg),e=Gi.select("."+f.axisY).style("opacity",U?0:1),(!Ng||D)&&(e=e.transition().duration(P)),e.call(dg),Gi.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(eg),F&&Sg&&Q){for(R=1;R=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=Yf.ticks(10);g=Gi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Ng?0:function(a){return Yf(a)-cg.tickOffset()}).attr("x2",Ng?Df:function(a){return Yf(a)-cg.tickOffset()}).attr("y1",Ng?function(a){return Yf(a)-cg.tickOffset()}:Af.top).attr("y2",Ng?function(a){return Yf(a)-cg.tickOffset()}:Ff).style("opacity",function(){return+mf.select(this).attr(Ng?"y1":"x1")===(Ng?Ff:0)?0:1}),g.exit().remove()}ne(sh)&&(i=Gi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(sh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Ng?"":"rotate(-90)").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Ng?0:vd).attr("x2",Ng?Df:vd).attr("y1",Ng?vd:Af.top).attr("y2",Ng?vd:Ff).style("opacity",1),i.select("text").transition().duration(N).attr("x",Ng?Df:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&th&&(k=Gi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Zf.ticks(vh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Ng?Zf:0).attr("x2",Ng?Zf:Df).attr("y1",Ng?0:Zf).attr("y2",Ng?Ff:Zf),k.exit().remove()),y&&ne(uh)&&(l=Gi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(uh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Ng?"rotate(-90)":"").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Ng?wd:0).attr("x2",Ng?wd:Df).attr("y1",Ng?0:wd).attr("y2",Ng?Ff:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Ng?0:Df).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Gi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ji(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Gi.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Ng?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Gi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ai).style("opacity",1),Gi.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Bi).style("opacity",Mi),n=Gi.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",xh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),n.exit().remove(),Gi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=mf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Gi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Gi.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Gg&&(null!==mf.event&&"zoom"===mf.event.type&&zi.extent(Yf.orgDomain()).update(),z&&(Hi.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(fg),zi.empty()||zi.extent(Yf.orgDomain()).update(),J=Ee(T,!0),s=Hi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ji(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Hi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ci).style("opacity",1))),Gi.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Gi.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),t=Gi.select("."+f.eventRects),ne(hg)&&!kc(hg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Gi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Df).attr("height",Ff)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),di&&!ci?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return(Yf(d?d:e+50)-Yf(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return(Yf(d)+Yf(c?c:d-50))/2}):(x=L(),w=function(a){return Yf(a.x)-x/2}),v=wc(),Gi.select("."+f.eventRects).datum(v?v.values:[]),u=Gi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Ng?0:w).attr("y",Ng?w:0).attr("width",Ng?Df:x).attr("height",Ng?x:Ff),u.exit().remove()),q=Gi.select("."+f.regions).selectAll("rect."+f.region).data(Ph),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Ng?0:cc).attr("y",Ng?cc:Af.top).attr("width",Ng?Df:dc).attr("height",Ng?dc:Ff).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),xc(nf.data.targets).forEach(function(a){Ni[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Di.altDomain?(Yf.domain(Di.altDomain),void Di.scale(Yf).updateScaleExtent()):(ci&&Yf.orgDomain()[0]===Li[0]&&Yf.domain([Li[0]-1e-10,Yf.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(gi=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Ei.attr("width",Hf).attr("height",If),Ei.select("#"+Xh).select("rect").attr("width",Df).attr("height",Ff),Ei.select("#"+Yh).select("rect").attr("width",H),Ei.select("#"+Zh).select("rect").attr("width",J),Ei.select("."+f.zoomRect).attr("width",Df).attr("height",Ff)}function We(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Gi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ji(a)}),e=Gi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ji(a)}).style("stroke","none").style("cursor",function(a){return xg(a)?"pointer":null}),c=Gi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ji(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Mi=+mf.select(this).style("opacity"),0}).style("fill",function(a){return ji(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ji(a)}).style("cursor",function(a){return xg(a)?"pointer":null}),a.forEach(function(a){Gi.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Gi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Pf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ji(a.data)}).style("cursor",function(a){return xg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Gg&&(n=Hi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ji(a)}),l=Hi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ji(a)})),Ei.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=si?j:i,l=si?Q():P();return d&&(w=0,C=0,t=0,u=0),Jg&&!Cc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=si?u:t,void(Mg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,si?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Ii.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Lg?Lg(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",si?g:-200).attr("y",si?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",si?h:-200).attr("y",si?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return ji(a)}).attr("x",si?g:-200).attr("y",si?-200:i).attr("width",10).attr("height",10),Ii.selectAll("text").data(a).text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ii.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ii.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["transition","duration"],350);g("data","data is required in config");var Af,Bf,Cf,Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg=h(["data","x"]),hg=h(["data","xs"],{}),ig=h(["data","x_format"]),jg=h(["data","id_converter"],function(a){return a}),kg=h(["data","names"],{}),lg=h(["data","classes"],{}),mg=h(["data","groups"],[]),ng=h(["data","axes"],{}),og=h(["data","type"]),pg=h(["data","types"],{}),qg=h(["data","labels"],{}),rg=h(["data","order"]),sg=h(["data","regions"],{}),tg=h(["data","color"]),ug=h(["data","colors"],{}),vg=h(["data","selection","enabled"],!1),wg=h(["data","selection","grouped"],!1),xg=h(["data","selection","isselectable"],function(){return!0}),yg=h(["data","selection","multiple"],!0),zg=h(["data","onclick"],function(){}),Ag=h(["data","onenter"],function(){}),Bg=h(["data","onleave"],function(){}),Cg=h(["data","onselected"],function(){}),Dg=h(["data","onunselected"],function(){}),Eg=h(["data","ondragstart"],function(){}),Fg=h(["data","ondragend"],function(){}),Gg=h(["subchart","show"],!1),Hg=Gg?h(["subchart","size","height"],60):0,Ig=h(["color","pattern"],[]),Jg=h(["legend","show"],!0),Kg=h(["legend","position"],"bottom"),Lg=h(["legend","item","onclick"]),Mg=h(["legend","equally"],!1),Ng=h(["axis","rotated"],!1),Og=h(["axis","x","type"],"indexed"),Pg=h(["axis","x","categories"],[]),Qg=h(["axis","x","tick","centered"],!1),Rg=h(["axis","x","tick","format"]),Sg=h(["axis","x","tick","culling"],{}),Tg=h(["axis","x","tick","culling","max"],"categorized"===Og?1/0:10),Ug=h(["axis","x","tick","count"]),Vg=h(["axis","x","tick","fit"],!1),Wg=h(["axis","x","max"]),Xg=h(["axis","x","min"]),Yg=h(["axis","x","default"]),Zg=h(["axis","x","label"],{}),$g=h(["axis","y","show"],!0),_g=h(["axis","y","max"]),ah=h(["axis","y","min"]),bh=h(["axis","y","center"]),ch=h(["axis","y","label"],{}),dh=h(["axis","y","inner"],!1),eh=h(["axis","y","tick","format"]),fh=h(["axis","y","padding"],{}),gh=h(["axis","y","ticks"],10),hh=h(["axis","y2","show"],!1),ih=h(["axis","y2","max"]),jh=h(["axis","y2","min"]),kh=h(["axis","y2","center"]),lh=h(["axis","y2","label"],{}),mh=h(["axis","y2","inner"],!1),nh=h(["axis","y2","tick","format"]),oh=h(["axis","y2","padding"],{}),ph=h(["axis","y2","ticks"],10),qh=h(["grid","x","show"],!1),rh=h(["grid","x","type"],"tick"),sh=h(["grid","x","lines"],[]),th=h(["grid","y","show"],!1),uh=h(["grid","y","lines"],[]),vh=h(["grid","y","ticks"],10),wh=h(["point","show"],!0),xh=wh?h(["point","r"],2.5):0,yh=h(["point","focus","line","enabled"],!0),zh=h(["point","focus","expand","enabled"],!0),Ah=h(["point","focus","expand","r"],zh?4:xh),Bh=h(["point","focus","select","r"],8),Ch=h(["bar","width"]),Dh=h(["bar","width","ratio"],.6),Eh=h(["pie","label","show"],!0),Fh=h(["pie","label","format"]),Gh=h(["pie","onclick"],function(){}),Hh=h(["pie","onmouseover"],function(){}),Ih=h(["pie","onmouseout"],function(){}),Jh=h(["donut","label","show"],!0),Kh=h(["donut","label","format"]),Lh=h(["donut","title"],""),Mh=h(["donut","onclick"],function(){}),Nh=h(["donut","onmouseover"],function(){}),Oh=h(["donut","onmouseout"],function(){}),Ph=h(["regions"],[]),Qh=h(["tooltip","show"],!0),Rh=h(["tooltip","format","title"]),Sh=h(["tooltip","format","value"]),Th=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Rh?Rh:b,l=Sh?Sh:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Uh=h(["tooltip","init","show"],!1),Vh=h(["tooltip","init","x"],0),Wh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Xh=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",Yh=Xh+"-xaxis",Zh=Xh+"-yaxis",$h=i(Xh),_h=i(Yh),ai=i(Zh),bi="timeseries"===Og,ci="categorized"===Og,di=!bi&&(gg||ne(hg)),ei=null,fi=!1,gi=!1,hi=!1,ii=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ji=he(ug,ne(Ig)?Ig:ii,tg),ki=function(){var a=[[mf.time.format("%Y/%-m/%-d"),function(){return!0}],[mf.time.format("%-m/%-d"),function(a){return a.getMonth()}],[mf.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[mf.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[mf.time.format("%I %p"),function(a){return a.getHours()}],[mf.time.format("%I:%M"),function(a){return a.getMinutes()}],[mf.time.format(":%S"),function(a){return a.getSeconds()}],[mf.time.format(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),li=[],mi=[],ni=Ng?"left":"bottom",oi=Ng?dh?"top":"bottom":dh?"right":"left",pi=Ng?mh?"bottom":"top":mh?"left":"right",qi=Ng?"left":"bottom",ri={main:function(){return"translate("+Af.left+","+Af.top+")"},context:function(){return"translate("+Bf.left+","+Bf.top+")"},legend:function(){return"translate("+Cf.left+","+Cf.top+")"},x:function(){return"translate(0,"+(Ng?0:Ff)+")"},y:function(){return"translate(0,"+(Ng?Ff:0)+")"},y2:function(){return"translate("+(Ng?0:Df)+","+(Ng?1:0)+")"},subx:function(){return"translate(0,"+(Ng?0:Gf)+")"},arc:function(){return"translate("+Df/2+","+Ff/2+")"}},si="right"===Kg,ti=0,ui=0,vi=0,wi=30,xi=30,yi=5;Pf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var zi,Ai=function(){var a=mf.svg.line().x(Ng?function(a){return V(a.id)(a.value)}:ud).y(Ng?ud:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=xe(b.values);return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),sg[b.id]?Je(e,Yf,V(b.id),sg[b.id]):a(e)):(c=Yf(e[0].x),d=V(b.id)(e[0].value),Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Bi=function(){var a;return a=Ng?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Ci=function(){var a=mf.svg.line().x(Ng?function(a){return W(a.id)(a.value)}:xd).y(Ng?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+_f(c[0].x)+" "+W(b.id)(c[0].value)}}(),Di=function(){};zi=mf.svg.brush().on("brush",Se),zi.update=function(){return Hi&&Hi.select("."+f.brush).call(this),this},zi.scale=function(a){return Ng?this.y(a):this.x(a)},uf&&(Di=mf.behavior.zoom().on("zoomstart",function(){Di.altDomain=mf.event.sourceEvent.altKey?Yf.orgDomain():null}).on("zoom",uf?Te:null),Di.scale=function(a){return Ng?this.y(a):this.x(a)},Di.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Di.updateScaleExtent=function(){var a=$b(Yf.orgDomain())/$b(Li),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Ei,Fi,Gi,Hi,Ii,Ji,Ki,Li,Mi,Ni={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Ei.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Ii.selectAll(kd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Ei.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Ii.selectAll(kd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",.5),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){zi.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){lg[b]=a.classes[b]}),"categories"in a&&ci&&(Pg=a.categories,cg.categories(Pg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Gi.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){vg&&Gi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=wg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?xg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){vg&&Gi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=wg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&xg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?mg:(mg=a,Re(),mg)},nf.xgrids=function(a){return a?(sh=a,Re(),sh):sh},nf.xgrids.add=function(a){return a?nf.xgrids(sh.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(sh.filter(b))},nf.ygrids=function(a){return a?(uh=a,Re(),uh):uh},nf.ygrids.add=function(a){return a?nf.ygrids(uh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(uh.filter(b))},nf.regions=function(a){return c(a)?Ph:(Ph=a,Re(),Ph)},nf.regions.add=function(a){return c(a)?Ph:(Ph=Ph.concat(a),Re(),Ph)},nf.regions.remove=function(a,c){var e=[].concat(a);return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;Ei.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Ph=Ph.filter(function(b){return b.classes.indexOf(a)<0})}),Ph},nf.data.get=function(a){var b=nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},nf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){kg[b]=a[b] }),gf(xc(nf.data.targets),{withTransition:!0}),kg):kg},nf.x=function(a){return arguments.length&&(mc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.xs=function(a){return arguments.length&&(nc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(_g=+a.y),b(a.y2)&&(ih=+a.y2)):_g=ih=+a,Re())},nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(ah=+a.y),b(a.y2)&&(jh=+a.y2)):ah=jh=+a,Re())},nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&nf.axis.max(a.max),"undefined"!=typeof a.min&&nf.axis.min(a.min))},nf.legend.show=function(a){Jg||(Jg=!0,Ii.style("visibility","visible")),ef(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.legend.hide=function(a){Jg&&me(a)&&(Jg=!1,Ii.style("visibility","hidden")),ff(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.resize=function(a){qf=a?a.width:null,rf=a?a.height:null,We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},nf.destroy=function(){nf.data.targets=void 0,nf.data.xs={},Ki.html(""),a.onresize=null},"url"in e.data)mf.csv(e.data.url,function(a,b){Ke(b)});else if("rows"in e.data)Ke(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ke(qc(e.data.columns))}return nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From b05e3b0e8045c36fe676e2ce3f04ee5f4308beaf Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 9 Apr 2014 22:37:36 +0900 Subject: [PATCH 030/178] Fix error when all null on line --- c3.js | 4 ++-- c3.min.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/c3.js b/c3.js index 7fcc9c5..fb4c513 100644 --- a/c3.js +++ b/c3.js @@ -2141,8 +2141,8 @@ isSplineType(d) ? line.interpolate("cardinal") : line.interpolate("linear"); return __data_regions[d.id] ? lineWithRegions(data, x, getYScale(d.id), __data_regions[d.id]) : line(data); } else { - x0 = x(data[0].x); - y0 = getYScale(d.id)(data[0].value); + x0 = data[0] ? x(data[0].x) : 0; + y0 = data[0] ? getYScale(d.id)(data[0].value) : 0; return __axis_rotated ? "M " + y0 + " " + x0 : "M " + x0 + " " + y0; } }; diff --git a/c3.min.js b/c3.min.js index 86e12ab..441261b 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ !function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.29"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cDf&&(Df=0),0>Ff&&(Ff=0),Bf={top:Ng?Af.top:If-Hg-(si?0:a),right:0/0,bottom:20+(si?0:a),left:Ng?wi:Af.left},Ef=Ng?Af.left-wi-xi:Df,Gf=Ng?Ff:If-Bf.top-Bf.bottom,0>Ef&&(Ef=0),0>Gf&&(Gf=0),Cf={top:si?0:If-a,right:0/0,bottom:0,left:si?Hf-b:0},p(),si&&Yd(nf.data.targets)&&(Cf.left=Df/2+Kf)}function o(){Gi.select("line."+f.xgridFocus).attr("x1",Ng?0:-10).attr("x2",Ng?Df:-10).attr("y1",Ng?-10:Af.top).attr("y2",Ng?-10:Ff)}function p(){Kf=Ff/2,Jf=.95*Kf,Lf=Xd(nf.data.targets)?.6*Jf:0}function q(){var a=Ng?f.axisX:f.axisY,b=mf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=mf.select(pf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return qf?qf:x()}function s(){var a=rf?rf:y();return a>0?a:320}function t(){return Yd(nf.data.targets)?0:sf?sf:Ng||!$g||dh?1:v("y")}function u(){var a=1;return Yd(nf.data.targets)?0:tf?tf:si?P()+(hh&&!Ng?v("y2"):a):hh?mh||Ng?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||$g?"y2"!==a||hh?(gb(a).isInner?30:40)+("y2"===a?-10:0):yi:Jg&&!si?10:1}function x(){return+mf.select(pf).style("width").replace("px","")}function y(){return+mf.select(pf).style("height").replace("px","")}function z(a){return a?-5:-(Af.left-1)}function A(a){return a?-20:-1}function B(){return z(!Ng)}function C(){return A(!Ng)}function D(){return z(Ng)}function E(){return A(Ng)}function F(a){return a?Df+2+4:Af.left+20}function G(a){return a?80:Ff+2}function H(){return F(!Ng)}function I(){return G(!Ng)}function J(){return F(Ng)}function K(){return G(Ng)}function L(){var a=Ng?Ff:Df,b=vc(),c=Vb()*(Ud(nf.data.targets)?(b-(ci?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){ti=a}function N(a){ui=a}function O(a){vi=a}function P(){return Jg?si?ui*(ti+1):Hf:0}function Q(){return Jg?si?If:vi*(ti+1):0}function R(){var a,b=!Yf;Qf=Ng?1:0,Rf=Ng?Ff:Df,Sf=Ng?0:Ff,Tf=Ng?Df:1,Uf=Qf,Vf=Rf,Wf=Ng?0:Gf,Xf=Ng?Ef:1,Yf=T(Qf,Rf,b?void 0:Yf.domain(),function(){return cg.tickOffset()}),Zf=U(Sf,Tf),$f=U(Sf,Tf),_f=T(Qf,Rf,Li,function(a){return a%1?0:fg.tickOffset()}),ag=U(Wf,Xf),bg=U(Wf,Xf),a=$(),cg=X(Yf,ni,a),fg=X(_f,qi,a),dg=Y(Zf,oi,eh,gh),eg=Y($f,pi,nh,ph),b||(zi.scale(_f),uf&&Di.scale(Yf)),S()}function S(){Mf=Db(),Nf=Eb(),Of=Eb(.98)}function T(a,b,e,f){var g=(bi?mf.time.scale():mf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),ci){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return mf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?$f:Zf}function W(a){return"y2"===Z(a)?bg:ag}function X(a,b,c){var d=(ci?Bb():mf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),ci?d.tickCentered(Qg):d.tickOffset=function(){var a=Ng?Ff:Df;return a*Vb()/vc()/2},ci&&d.categories(Pg),d}function Y(a,b,c,d){return mf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in ng?ng[a]:"y"}function $(){var a=bi?ki:ci?Oc:function(a){return 0>a?a.toFixed(0):a};return Rg&&("function"==typeof Rg?a=Rg:bi&&(a=function(a){return mf.time.format(Rg)(a)})),a}function _(a){var b;return"y"===a?b=ch:"y2"===a?b=lh:"x"===a&&(b=Zg),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?ch=b:"y2"===a?lh=b:"x"===a&&(Zg=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Ng?"inner-top":"inner-right")}function eb(){return cb("y",Ng?"inner-right":"inner-top")}function fb(){return cb("y2",Ng?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?Df/2:Df:b.isBottom?-Ff:b.isMiddle?-Ff/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Ng,db())}function ob(){return kb(Ng,eb())}function pb(){return kb(Ng,fb())}function qb(){return lb(!Ng,db())}function rb(){return lb(Ng,eb())}function sb(){return lb(Ng,fb())}function tb(){var a=db();return Ng?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Ng?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Ng?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Ng,db())}function xb(){return mb(Ng,eb())}function yb(){return mb(Ng,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Gi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Gi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Gi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return mf.min(Object.keys(i).map(function(a){return mf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(mg.length>0)for(g=Nc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return mf.max(Object.keys(i).map(function(a){return mf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?jh:ah,n="y2"===c?ih:_g,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?kh:bh,r=pd()&&Ng;return 0===l.length?"y2"===c?$f.domain():Zf.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=qd(o,p),j=$b(Zf.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&fh&&(f=b(fh.top)?fh.top:e,g=b(fh.bottom)?fh.bottom:e),"y2"===c&&oh&&(f=b(oh.top)?oh.top:e,g=b(oh.bottom)?oh.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Li),c=$b(Yf.domain());return a||0===c?1:b/c}function Wb(a){return Xg?Xg:mf.min(a,function(a){return mf.min(a.values,function(a){return a.x})})}function Xb(a){return Wg?Wg:mf.max(a,function(a){return mf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return ci?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=bi?new Date(c.getTime()-e):c-e,g=bi?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return gg&&a===gg||ne(hg)&&oe(hg,a)}function fc(a){return!ec(a)}function gc(a){return gg?gg:ne(hg)?hg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=nf.data.xs[b])}),c}function ic(a,b){return a in nf.data.xs&&nf.data.xs[a]&&nf.data.xs[a][b]?nf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){hg[b]=a[b]})}function kc(a){return 1===mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=kg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),nf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=bi?a?a instanceof Date?a:ie(a):ie(ic(b,c)):di&&!ci?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):gg?(d=Object.keys(nf.data.xs),nf.data.xs[c]=d.length>0?nf.data.xs[d[0]]:void 0):ne(hg)&&(nf.data.xs[c]=hc(f,nf.data.targets)):nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=jg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return di&&ci&&0===c&&g&&(0===e&&(Pg=[]),Pg.push(g)),("undefined"==typeof a[b]||nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),og&&Sd(xc(c).filter(function(a){return!(a in pg)}),og),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function tc(a){return a>0&&nf.data.targets[0].values[a-1]?nf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?nf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?nf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(nf.data.targets)}function zc(a,b){var c,d=xc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(bi?new Date(h):h);i.push(d)}return i}function Gc(a){li=li.concat(a)}function Hc(a){li=li.filter(function(b){return a.indexOf(b)<0})}function Ic(a){mi=mi.concat(a)}function Jc(a){mi=mi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Ed(){return rg&&"desc"===rg.toLowerCase()}function Fd(){return rg&&"asc"===rg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof rg&&a.sort(rg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(nf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Qh&&0!==m.length&&(Ji.html(Th(a,$(),l,ji)).style("display","block"),d=Ji.property("offsetWidth"),e=Ji.property("offsetHeight"),k?(g=Df/2+c[0],i=Ff/2+c[1]+20):(Ng?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Yf(m[0].x)+20):(f=q(),g=f+t()+Yf(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Ji.style("top",i+"px").style("left",g+"px"))}function Id(){Ji.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Qh&&(Vd(nf.data.targets)||Yd(nf.data.targets)||Gi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Ng?"y1":"x1",ud).attr(Ng?"y2":"x2",ud))}function Kd(){Gi.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?Yf(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Ch?Ch:b?2*a.tickOffset()*Dh/b:0}function Sd(a,b){yc(a).forEach(function(a){Ni[a]=b===pg[a],pg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){pg[a.id]===b&&(c=!0),a.id in pg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in pg)||"line"===pg[b]||"spline"===pg[b]||"area"===pg[b]||"area-spline"===pg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===pg[b]||"area-spline"===pg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===pg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===pg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===pg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===pg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ie(b){var c;if(!b)throw Error(b+" can not be parsed as d3.time with format "+ig+". Maybe 'x' of this data is not defined. See data.x or data.xs option.");try{c=ig?mf.time.format(ig).parse(b):new Date(b)}catch(d){c=void 0}return c||a.console.error("Failed to parse x '"+b+"' to Date with format "+ig),c}function je(a,b){var c=mf.mouse(a),d=mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?Zf:$f,d=Ng?1:0,e=Ng?0:1;return Math.pow(Yf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Cg(b,a.node()),Gi.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md).attr("stroke",function(){return ji(b)}).attr("r",1.4*Bh).transition().duration(100).attr("r",Bh)}function se(a,b,c){Dg(b,a.node()),Gi.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Cg(b,a.node()),a.transition().duration(100).style("fill",function(){return mf.rgb(ji(b)).darker(1)})}function ve(a,b){Dg(b,a.node()),a.transition().duration(100).style("fill",function(){return ji(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Gi.selectAll("."+f.circles+gd(c)):Gi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",Ah)}function Ae(a){ye(a).filter(function(){return mf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",xh)}function Be(a){return Gi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Ng?1:0,f=Ng?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Ng?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBoundingClientRect();return Ng?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(cg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Ng&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Je(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function Ke(b){var c,d,e;if(Ki=mf.select(pf),Ki.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Ki.html(""),Ki.classed("c3",!0),nf.data.xs={},nf.data.targets=rc(b),n(),R(),Yf.domain(mf.extent(Zb(nf.data.targets))),Zf.domain(Ub(nf.data.targets,"y")),$f.domain(Ub(nf.data.targets,"y2")),_f.domain(Yf.domain()),ag.domain(Zf.domain()),bg.domain($f.domain()),Li=Yf.domain(),zi.scale(_f),uf&&Di.scale(Yf),Ei=Ki.append("svg").attr("width",Df+Af.left+Af.right).attr("height",Ff+Af.top+Af.bottom).on("mouseenter",xf).on("mouseleave",yf),Fi=Ei.append("defs"),Fi.append("clipPath").attr("id",Xh).append("rect").attr("width",Df).attr("height",Ff),Fi.append("clipPath").attr("id",Yh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Fi.append("clipPath").attr("id",Zh).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Gi=Ei.append("g").attr("transform",ri.main),Hi=Gg?Ei.append("g").attr("transform",ri.context):null,Ii=Ei.append("g").attr("transform",ri.legend),Jg||(Ii.style("visibility","hidden"),mi=xc(nf.data.targets)),Ji=mf.select(pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),gf(xc(nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Gi.append("g").attr("class",f.axisX).attr("clip-path",Ng?"":_h).attr("transform",ri.x).append("text").attr("class",f.axisXLabel).attr("transform",Ng?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),$g&&Gi.append("g").attr("class",f.axisY).attr("clip-path",Ng?ai:"").attr("transform",ri.y).append("text").attr("class",f.axisYLabel).attr("transform",Ng?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),hh&&Gi.append("g").attr("class",f.axisY2).attr("transform",ri.y2).append("text").attr("class",f.axisY2Label).attr("transform",Ng?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Gi.append("g").attr("clip-path",$h).attr("class",f.grid),qh&&d.append("g").attr("class",f.xgrids),ne(sh)&&d.append("g").attr("class",f.xgridLines),yh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),th&&d.append("g").attr("class",f.ygrids),ne(uh)&&d.append("g").attr("class",f.ygridLines),Gi.append("g").attr("clip-path",$h).attr("class",f.regions),Gi.append("g").attr("clip-path",$h).attr("class",f.chart),c=Gi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",uf?Ng?"ns-resize":"ew-resize":null),Gi.select("."+f.chart).append("g").attr("class",f.chartBars),Gi.select("."+f.chart).append("g").attr("class",f.chartLines),Gi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",ri.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Gi.select("."+f.chart).append("g").attr("class",f.chartTexts),uf&&Gi.insert("rect",wf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Df).attr("height",Ff).style("opacity",0).style("cursor",Ng?"ns-resize":"ew-resize").call(Di).on("dblclick.zoom",null),Yg&&zi.extent("function"!=typeof Yg?Yg:Yg(Zb())),Gg&&(Hi.append("g").attr("clip-path",$h).attr("class",f.chart),Hi.select("."+f.chart).append("g").attr("class",f.chartBars),Hi.select("."+f.chart).append("g").attr("class",f.chartLines),Hi.append("g").attr("clip-path",$h).attr("class",f.brush).call(zi).selectAll("rect").attr(Ng?"width":"height",Ng?Ef:Gf),Hi.append("g").attr("class",f.axisX).attr("transform",ri.subx).attr("clip-path",Ng?"":_h)),Xe(nf.data.targets),Ng?Gi.select("."+f.axisX).style("opacity",0).call(cg):(Gi.select("."+f.axisY).style("opacity",0).call(dg),Gi.select("."+f.axisY2).style("opacity",0).call(eg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Uh){if(bi&&"string"==typeof Vh){for(Vh=ie(Vh),e=0;e0){d=[];for(var g in kg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function Pe(a){Yd(nf.data.targets)||vg&&(ei=a,Gi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),fi=!0,Eg())}function Qe(){Yd(nf.data.targets)||vg&&(Gi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Gi.selectAll("."+f.shape).classed(f.INCLUDED,!1),fi=!1,Fg())}function Re(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Nd(),U=Yd(nf.data.targets),V=Dc(nf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?zf:0,O=B?N:0,P=C?N:0,H&&Jg&&gf(xc(nf.data.targets),a),G&&(Yf.domain(mf.extent(Zb(V))),Li=Yf.domain(),uf&&Di.scale(Yf).updateScaleExtent(),_f.domain(Yf.domain()),zi.scale(_f)),F&&(Yf.domain(zi.empty()?Li:zi.extent()),uf&&Di.scale(Yf).updateScaleExtent()),Zf.domain(Ub(V,"y")),$f.domain(Ub(V,"y2")),Vd(V)||(Q=Fc(Ec(V)).sort(),cg.tickValues(Q),fg.tickValues(Q)),c=Gi.select("."+f.axisX).style("opacity",U?0:1),(Ng||D)&&(c=c.transition().duration(P)),c.call(cg),e=Gi.select("."+f.axisY).style("opacity",U?0:1),(!Ng||D)&&(e=e.transition().duration(P)),e.call(dg),Gi.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(eg),F&&Sg&&Q){for(R=1;R=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=Yf.ticks(10);g=Gi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Ng?0:function(a){return Yf(a)-cg.tickOffset()}).attr("x2",Ng?Df:function(a){return Yf(a)-cg.tickOffset()}).attr("y1",Ng?function(a){return Yf(a)-cg.tickOffset()}:Af.top).attr("y2",Ng?function(a){return Yf(a)-cg.tickOffset()}:Ff).style("opacity",function(){return+mf.select(this).attr(Ng?"y1":"x1")===(Ng?Ff:0)?0:1}),g.exit().remove()}ne(sh)&&(i=Gi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(sh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Ng?"":"rotate(-90)").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Ng?0:vd).attr("x2",Ng?Df:vd).attr("y1",Ng?vd:Af.top).attr("y2",Ng?vd:Ff).style("opacity",1),i.select("text").transition().duration(N).attr("x",Ng?Df:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&th&&(k=Gi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Zf.ticks(vh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Ng?Zf:0).attr("x2",Ng?Zf:Df).attr("y1",Ng?0:Zf).attr("y2",Ng?Ff:Zf),k.exit().remove()),y&&ne(uh)&&(l=Gi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(uh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Ng?"rotate(-90)":"").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Ng?wd:0).attr("x2",Ng?wd:Df).attr("y1",Ng?0:wd).attr("y2",Ng?Ff:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Ng?0:Df).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Gi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ji(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Gi.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Ng?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Gi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ai).style("opacity",1),Gi.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Bi).style("opacity",Mi),n=Gi.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",xh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),n.exit().remove(),Gi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=mf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Gi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Gi.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Gg&&(null!==mf.event&&"zoom"===mf.event.type&&zi.extent(Yf.orgDomain()).update(),z&&(Hi.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(fg),zi.empty()||zi.extent(Yf.orgDomain()).update(),J=Ee(T,!0),s=Hi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ji(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Hi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ci).style("opacity",1))),Gi.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Gi.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),t=Gi.select("."+f.eventRects),ne(hg)&&!kc(hg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Gi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Df).attr("height",Ff)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),di&&!ci?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return(Yf(d?d:e+50)-Yf(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return(Yf(d)+Yf(c?c:d-50))/2}):(x=L(),w=function(a){return Yf(a.x)-x/2}),v=wc(),Gi.select("."+f.eventRects).datum(v?v.values:[]),u=Gi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Ng?0:w).attr("y",Ng?w:0).attr("width",Ng?Df:x).attr("height",Ng?x:Ff),u.exit().remove()),q=Gi.select("."+f.regions).selectAll("rect."+f.region).data(Ph),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Ng?0:cc).attr("y",Ng?cc:Af.top).attr("width",Ng?Df:dc).attr("height",Ng?dc:Ff).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),xc(nf.data.targets).forEach(function(a){Ni[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Di.altDomain?(Yf.domain(Di.altDomain),void Di.scale(Yf).updateScaleExtent()):(ci&&Yf.orgDomain()[0]===Li[0]&&Yf.domain([Li[0]-1e-10,Yf.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(gi=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Ei.attr("width",Hf).attr("height",If),Ei.select("#"+Xh).select("rect").attr("width",Df).attr("height",Ff),Ei.select("#"+Yh).select("rect").attr("width",H),Ei.select("#"+Zh).select("rect").attr("width",J),Ei.select("."+f.zoomRect).attr("width",Df).attr("height",Ff)}function We(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Gi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ji(a)}),e=Gi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ji(a)}).style("stroke","none").style("cursor",function(a){return xg(a)?"pointer":null}),c=Gi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ji(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Mi=+mf.select(this).style("opacity"),0}).style("fill",function(a){return ji(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ji(a)}).style("cursor",function(a){return xg(a)?"pointer":null}),a.forEach(function(a){Gi.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Gi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Pf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ji(a.data)}).style("cursor",function(a){return xg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Gg&&(n=Hi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ji(a)}),l=Hi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ji(a)})),Ei.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=si?j:i,l=si?Q():P();return d&&(w=0,C=0,t=0,u=0),Jg&&!Cc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=si?u:t,void(Mg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,si?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Ii.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Lg?Lg(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",si?g:-200).attr("y",si?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",si?h:-200).attr("y",si?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return ji(a)}).attr("x",si?g:-200).attr("y",si?-200:i).attr("width",10).attr("height",10),Ii.selectAll("text").data(a).text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ii.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ii.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["transition","duration"],350);g("data","data is required in config");var Af,Bf,Cf,Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg=h(["data","x"]),hg=h(["data","xs"],{}),ig=h(["data","x_format"]),jg=h(["data","id_converter"],function(a){return a}),kg=h(["data","names"],{}),lg=h(["data","classes"],{}),mg=h(["data","groups"],[]),ng=h(["data","axes"],{}),og=h(["data","type"]),pg=h(["data","types"],{}),qg=h(["data","labels"],{}),rg=h(["data","order"]),sg=h(["data","regions"],{}),tg=h(["data","color"]),ug=h(["data","colors"],{}),vg=h(["data","selection","enabled"],!1),wg=h(["data","selection","grouped"],!1),xg=h(["data","selection","isselectable"],function(){return!0}),yg=h(["data","selection","multiple"],!0),zg=h(["data","onclick"],function(){}),Ag=h(["data","onenter"],function(){}),Bg=h(["data","onleave"],function(){}),Cg=h(["data","onselected"],function(){}),Dg=h(["data","onunselected"],function(){}),Eg=h(["data","ondragstart"],function(){}),Fg=h(["data","ondragend"],function(){}),Gg=h(["subchart","show"],!1),Hg=Gg?h(["subchart","size","height"],60):0,Ig=h(["color","pattern"],[]),Jg=h(["legend","show"],!0),Kg=h(["legend","position"],"bottom"),Lg=h(["legend","item","onclick"]),Mg=h(["legend","equally"],!1),Ng=h(["axis","rotated"],!1),Og=h(["axis","x","type"],"indexed"),Pg=h(["axis","x","categories"],[]),Qg=h(["axis","x","tick","centered"],!1),Rg=h(["axis","x","tick","format"]),Sg=h(["axis","x","tick","culling"],{}),Tg=h(["axis","x","tick","culling","max"],"categorized"===Og?1/0:10),Ug=h(["axis","x","tick","count"]),Vg=h(["axis","x","tick","fit"],!1),Wg=h(["axis","x","max"]),Xg=h(["axis","x","min"]),Yg=h(["axis","x","default"]),Zg=h(["axis","x","label"],{}),$g=h(["axis","y","show"],!0),_g=h(["axis","y","max"]),ah=h(["axis","y","min"]),bh=h(["axis","y","center"]),ch=h(["axis","y","label"],{}),dh=h(["axis","y","inner"],!1),eh=h(["axis","y","tick","format"]),fh=h(["axis","y","padding"],{}),gh=h(["axis","y","ticks"],10),hh=h(["axis","y2","show"],!1),ih=h(["axis","y2","max"]),jh=h(["axis","y2","min"]),kh=h(["axis","y2","center"]),lh=h(["axis","y2","label"],{}),mh=h(["axis","y2","inner"],!1),nh=h(["axis","y2","tick","format"]),oh=h(["axis","y2","padding"],{}),ph=h(["axis","y2","ticks"],10),qh=h(["grid","x","show"],!1),rh=h(["grid","x","type"],"tick"),sh=h(["grid","x","lines"],[]),th=h(["grid","y","show"],!1),uh=h(["grid","y","lines"],[]),vh=h(["grid","y","ticks"],10),wh=h(["point","show"],!0),xh=wh?h(["point","r"],2.5):0,yh=h(["point","focus","line","enabled"],!0),zh=h(["point","focus","expand","enabled"],!0),Ah=h(["point","focus","expand","r"],zh?4:xh),Bh=h(["point","focus","select","r"],8),Ch=h(["bar","width"]),Dh=h(["bar","width","ratio"],.6),Eh=h(["pie","label","show"],!0),Fh=h(["pie","label","format"]),Gh=h(["pie","onclick"],function(){}),Hh=h(["pie","onmouseover"],function(){}),Ih=h(["pie","onmouseout"],function(){}),Jh=h(["donut","label","show"],!0),Kh=h(["donut","label","format"]),Lh=h(["donut","title"],""),Mh=h(["donut","onclick"],function(){}),Nh=h(["donut","onmouseover"],function(){}),Oh=h(["donut","onmouseout"],function(){}),Ph=h(["regions"],[]),Qh=h(["tooltip","show"],!0),Rh=h(["tooltip","format","title"]),Sh=h(["tooltip","format","value"]),Th=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Rh?Rh:b,l=Sh?Sh:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Uh=h(["tooltip","init","show"],!1),Vh=h(["tooltip","init","x"],0),Wh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Xh=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",Yh=Xh+"-xaxis",Zh=Xh+"-yaxis",$h=i(Xh),_h=i(Yh),ai=i(Zh),bi="timeseries"===Og,ci="categorized"===Og,di=!bi&&(gg||ne(hg)),ei=null,fi=!1,gi=!1,hi=!1,ii=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ji=he(ug,ne(Ig)?Ig:ii,tg),ki=function(){var a=[[mf.time.format("%Y/%-m/%-d"),function(){return!0}],[mf.time.format("%-m/%-d"),function(a){return a.getMonth()}],[mf.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[mf.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[mf.time.format("%I %p"),function(a){return a.getHours()}],[mf.time.format("%I:%M"),function(a){return a.getMinutes()}],[mf.time.format(":%S"),function(a){return a.getSeconds()}],[mf.time.format(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),li=[],mi=[],ni=Ng?"left":"bottom",oi=Ng?dh?"top":"bottom":dh?"right":"left",pi=Ng?mh?"bottom":"top":mh?"left":"right",qi=Ng?"left":"bottom",ri={main:function(){return"translate("+Af.left+","+Af.top+")"},context:function(){return"translate("+Bf.left+","+Bf.top+")"},legend:function(){return"translate("+Cf.left+","+Cf.top+")"},x:function(){return"translate(0,"+(Ng?0:Ff)+")"},y:function(){return"translate(0,"+(Ng?Ff:0)+")"},y2:function(){return"translate("+(Ng?0:Df)+","+(Ng?1:0)+")"},subx:function(){return"translate(0,"+(Ng?0:Gf)+")"},arc:function(){return"translate("+Df/2+","+Ff/2+")"}},si="right"===Kg,ti=0,ui=0,vi=0,wi=30,xi=30,yi=5;Pf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var zi,Ai=function(){var a=mf.svg.line().x(Ng?function(a){return V(a.id)(a.value)}:ud).y(Ng?ud:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=xe(b.values);return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),sg[b.id]?Je(e,Yf,V(b.id),sg[b.id]):a(e)):(c=Yf(e[0].x),d=V(b.id)(e[0].value),Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Bi=function(){var a;return a=Ng?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Ci=function(){var a=mf.svg.line().x(Ng?function(a){return W(a.id)(a.value)}:xd).y(Ng?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+_f(c[0].x)+" "+W(b.id)(c[0].value)}}(),Di=function(){};zi=mf.svg.brush().on("brush",Se),zi.update=function(){return Hi&&Hi.select("."+f.brush).call(this),this},zi.scale=function(a){return Ng?this.y(a):this.x(a)},uf&&(Di=mf.behavior.zoom().on("zoomstart",function(){Di.altDomain=mf.event.sourceEvent.altKey?Yf.orgDomain():null}).on("zoom",uf?Te:null),Di.scale=function(a){return Ng?this.y(a):this.x(a)},Di.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Di.updateScaleExtent=function(){var a=$b(Yf.orgDomain())/$b(Li),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Ei,Fi,Gi,Hi,Ii,Ji,Ki,Li,Mi,Ni={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Ei.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Ii.selectAll(kd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Ei.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Ii.selectAll(kd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",.5),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){zi.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){lg[b]=a.classes[b]}),"categories"in a&&ci&&(Pg=a.categories,cg.categories(Pg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Gi.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){vg&&Gi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=wg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?xg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){vg&&Gi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=wg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&xg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?mg:(mg=a,Re(),mg)},nf.xgrids=function(a){return a?(sh=a,Re(),sh):sh},nf.xgrids.add=function(a){return a?nf.xgrids(sh.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(sh.filter(b))},nf.ygrids=function(a){return a?(uh=a,Re(),uh):uh},nf.ygrids.add=function(a){return a?nf.ygrids(uh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(uh.filter(b))},nf.regions=function(a){return c(a)?Ph:(Ph=a,Re(),Ph)},nf.regions.add=function(a){return c(a)?Ph:(Ph=Ph.concat(a),Re(),Ph)},nf.regions.remove=function(a,c){var e=[].concat(a);return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;Ei.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Ph=Ph.filter(function(b){return b.classes.indexOf(a)<0})}),Ph},nf.data.get=function(a){var b=nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},nf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){kg[b]=a[b] +}Ji.html(Th(nf.data.targets.map(function(a){return lc(a.values[Vh])}),$(),rd,ji)),Ji.style("top",Wh.top).style("left",Wh.left).style("display","block")}null==a.onresize&&(a.onresize=Ue()),a.onresize.add&&a.onresize.add(function(){We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})})}function Le(a){a.append("rect").attr("class",ad).style("cursor",vg&&wg?"pointer":null).on("mouseover",function(a,b){if(!fi&&!Yd(nf.data.targets)){var c,d,e=nf.data.targets.map(function(a){return lc(a.values[b])});if(Object.keys(kg).length>0){d=[];for(var g in kg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function Pe(a){Yd(nf.data.targets)||vg&&(ei=a,Gi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),fi=!0,Eg())}function Qe(){Yd(nf.data.targets)||vg&&(Gi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Gi.selectAll("."+f.shape).classed(f.INCLUDED,!1),fi=!1,Fg())}function Re(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Nd(),U=Yd(nf.data.targets),V=Dc(nf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?zf:0,O=B?N:0,P=C?N:0,H&&Jg&&gf(xc(nf.data.targets),a),G&&(Yf.domain(mf.extent(Zb(V))),Li=Yf.domain(),uf&&Di.scale(Yf).updateScaleExtent(),_f.domain(Yf.domain()),zi.scale(_f)),F&&(Yf.domain(zi.empty()?Li:zi.extent()),uf&&Di.scale(Yf).updateScaleExtent()),Zf.domain(Ub(V,"y")),$f.domain(Ub(V,"y2")),Vd(V)||(Q=Fc(Ec(V)).sort(),cg.tickValues(Q),fg.tickValues(Q)),c=Gi.select("."+f.axisX).style("opacity",U?0:1),(Ng||D)&&(c=c.transition().duration(P)),c.call(cg),e=Gi.select("."+f.axisY).style("opacity",U?0:1),(!Ng||D)&&(e=e.transition().duration(P)),e.call(dg),Gi.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(eg),F&&Sg&&Q){for(R=1;R=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=Yf.ticks(10);g=Gi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Ng?0:function(a){return Yf(a)-cg.tickOffset()}).attr("x2",Ng?Df:function(a){return Yf(a)-cg.tickOffset()}).attr("y1",Ng?function(a){return Yf(a)-cg.tickOffset()}:Af.top).attr("y2",Ng?function(a){return Yf(a)-cg.tickOffset()}:Ff).style("opacity",function(){return+mf.select(this).attr(Ng?"y1":"x1")===(Ng?Ff:0)?0:1}),g.exit().remove()}ne(sh)&&(i=Gi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(sh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Ng?"":"rotate(-90)").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Ng?0:vd).attr("x2",Ng?Df:vd).attr("y1",Ng?vd:Af.top).attr("y2",Ng?vd:Ff).style("opacity",1),i.select("text").transition().duration(N).attr("x",Ng?Df:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&th&&(k=Gi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Zf.ticks(vh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Ng?Zf:0).attr("x2",Ng?Zf:Df).attr("y1",Ng?0:Zf).attr("y2",Ng?Ff:Zf),k.exit().remove()),y&&ne(uh)&&(l=Gi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(uh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Ng?"rotate(-90)":"").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Ng?wd:0).attr("x2",Ng?wd:Df).attr("y1",Ng?0:wd).attr("y2",Ng?Ff:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Ng?0:Df).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Gi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ji(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Gi.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Ng?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Gi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ai).style("opacity",1),Gi.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Bi).style("opacity",Mi),n=Gi.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",xh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),n.exit().remove(),Gi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=mf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Gi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Gi.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Gg&&(null!==mf.event&&"zoom"===mf.event.type&&zi.extent(Yf.orgDomain()).update(),z&&(Hi.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(fg),zi.empty()||zi.extent(Yf.orgDomain()).update(),J=Ee(T,!0),s=Hi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ji(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Hi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ci).style("opacity",1))),Gi.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Gi.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),t=Gi.select("."+f.eventRects),ne(hg)&&!kc(hg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Gi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Df).attr("height",Ff)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),di&&!ci?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return(Yf(d?d:e+50)-Yf(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return(Yf(d)+Yf(c?c:d-50))/2}):(x=L(),w=function(a){return Yf(a.x)-x/2}),v=wc(),Gi.select("."+f.eventRects).datum(v?v.values:[]),u=Gi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Ng?0:w).attr("y",Ng?w:0).attr("width",Ng?Df:x).attr("height",Ng?x:Ff),u.exit().remove()),q=Gi.select("."+f.regions).selectAll("rect."+f.region).data(Ph),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Ng?0:cc).attr("y",Ng?cc:Af.top).attr("width",Ng?Df:dc).attr("height",Ng?dc:Ff).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),xc(nf.data.targets).forEach(function(a){Ni[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Di.altDomain?(Yf.domain(Di.altDomain),void Di.scale(Yf).updateScaleExtent()):(ci&&Yf.orgDomain()[0]===Li[0]&&Yf.domain([Li[0]-1e-10,Yf.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(gi=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Ei.attr("width",Hf).attr("height",If),Ei.select("#"+Xh).select("rect").attr("width",Df).attr("height",Ff),Ei.select("#"+Yh).select("rect").attr("width",H),Ei.select("#"+Zh).select("rect").attr("width",J),Ei.select("."+f.zoomRect).attr("width",Df).attr("height",Ff)}function We(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Gi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ji(a)}),e=Gi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ji(a)}).style("stroke","none").style("cursor",function(a){return xg(a)?"pointer":null}),c=Gi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ji(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Mi=+mf.select(this).style("opacity"),0}).style("fill",function(a){return ji(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ji(a)}).style("cursor",function(a){return xg(a)?"pointer":null}),a.forEach(function(a){Gi.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Gi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Pf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ji(a.data)}).style("cursor",function(a){return xg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Gg&&(n=Hi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ji(a)}),l=Hi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ji(a)})),Ei.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=si?j:i,l=si?Q():P();return d&&(w=0,C=0,t=0,u=0),Jg&&!Cc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=si?u:t,void(Mg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,si?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Ii.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Lg?Lg(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",si?g:-200).attr("y",si?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",si?h:-200).attr("y",si?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return ji(a)}).attr("x",si?g:-200).attr("y",si?-200:i).attr("width",10).attr("height",10),Ii.selectAll("text").data(a).text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ii.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ii.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["transition","duration"],350);g("data","data is required in config");var Af,Bf,Cf,Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg=h(["data","x"]),hg=h(["data","xs"],{}),ig=h(["data","x_format"]),jg=h(["data","id_converter"],function(a){return a}),kg=h(["data","names"],{}),lg=h(["data","classes"],{}),mg=h(["data","groups"],[]),ng=h(["data","axes"],{}),og=h(["data","type"]),pg=h(["data","types"],{}),qg=h(["data","labels"],{}),rg=h(["data","order"]),sg=h(["data","regions"],{}),tg=h(["data","color"]),ug=h(["data","colors"],{}),vg=h(["data","selection","enabled"],!1),wg=h(["data","selection","grouped"],!1),xg=h(["data","selection","isselectable"],function(){return!0}),yg=h(["data","selection","multiple"],!0),zg=h(["data","onclick"],function(){}),Ag=h(["data","onenter"],function(){}),Bg=h(["data","onleave"],function(){}),Cg=h(["data","onselected"],function(){}),Dg=h(["data","onunselected"],function(){}),Eg=h(["data","ondragstart"],function(){}),Fg=h(["data","ondragend"],function(){}),Gg=h(["subchart","show"],!1),Hg=Gg?h(["subchart","size","height"],60):0,Ig=h(["color","pattern"],[]),Jg=h(["legend","show"],!0),Kg=h(["legend","position"],"bottom"),Lg=h(["legend","item","onclick"]),Mg=h(["legend","equally"],!1),Ng=h(["axis","rotated"],!1),Og=h(["axis","x","type"],"indexed"),Pg=h(["axis","x","categories"],[]),Qg=h(["axis","x","tick","centered"],!1),Rg=h(["axis","x","tick","format"]),Sg=h(["axis","x","tick","culling"],{}),Tg=h(["axis","x","tick","culling","max"],"categorized"===Og?1/0:10),Ug=h(["axis","x","tick","count"]),Vg=h(["axis","x","tick","fit"],!1),Wg=h(["axis","x","max"]),Xg=h(["axis","x","min"]),Yg=h(["axis","x","default"]),Zg=h(["axis","x","label"],{}),$g=h(["axis","y","show"],!0),_g=h(["axis","y","max"]),ah=h(["axis","y","min"]),bh=h(["axis","y","center"]),ch=h(["axis","y","label"],{}),dh=h(["axis","y","inner"],!1),eh=h(["axis","y","tick","format"]),fh=h(["axis","y","padding"],{}),gh=h(["axis","y","ticks"],10),hh=h(["axis","y2","show"],!1),ih=h(["axis","y2","max"]),jh=h(["axis","y2","min"]),kh=h(["axis","y2","center"]),lh=h(["axis","y2","label"],{}),mh=h(["axis","y2","inner"],!1),nh=h(["axis","y2","tick","format"]),oh=h(["axis","y2","padding"],{}),ph=h(["axis","y2","ticks"],10),qh=h(["grid","x","show"],!1),rh=h(["grid","x","type"],"tick"),sh=h(["grid","x","lines"],[]),th=h(["grid","y","show"],!1),uh=h(["grid","y","lines"],[]),vh=h(["grid","y","ticks"],10),wh=h(["point","show"],!0),xh=wh?h(["point","r"],2.5):0,yh=h(["point","focus","line","enabled"],!0),zh=h(["point","focus","expand","enabled"],!0),Ah=h(["point","focus","expand","r"],zh?4:xh),Bh=h(["point","focus","select","r"],8),Ch=h(["bar","width"]),Dh=h(["bar","width","ratio"],.6),Eh=h(["pie","label","show"],!0),Fh=h(["pie","label","format"]),Gh=h(["pie","onclick"],function(){}),Hh=h(["pie","onmouseover"],function(){}),Ih=h(["pie","onmouseout"],function(){}),Jh=h(["donut","label","show"],!0),Kh=h(["donut","label","format"]),Lh=h(["donut","title"],""),Mh=h(["donut","onclick"],function(){}),Nh=h(["donut","onmouseover"],function(){}),Oh=h(["donut","onmouseout"],function(){}),Ph=h(["regions"],[]),Qh=h(["tooltip","show"],!0),Rh=h(["tooltip","format","title"]),Sh=h(["tooltip","format","value"]),Th=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Rh?Rh:b,l=Sh?Sh:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Uh=h(["tooltip","init","show"],!1),Vh=h(["tooltip","init","x"],0),Wh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Xh=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",Yh=Xh+"-xaxis",Zh=Xh+"-yaxis",$h=i(Xh),_h=i(Yh),ai=i(Zh),bi="timeseries"===Og,ci="categorized"===Og,di=!bi&&(gg||ne(hg)),ei=null,fi=!1,gi=!1,hi=!1,ii=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ji=he(ug,ne(Ig)?Ig:ii,tg),ki=function(){var a=[[mf.time.format("%Y/%-m/%-d"),function(){return!0}],[mf.time.format("%-m/%-d"),function(a){return a.getMonth()}],[mf.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[mf.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[mf.time.format("%I %p"),function(a){return a.getHours()}],[mf.time.format("%I:%M"),function(a){return a.getMinutes()}],[mf.time.format(":%S"),function(a){return a.getSeconds()}],[mf.time.format(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),li=[],mi=[],ni=Ng?"left":"bottom",oi=Ng?dh?"top":"bottom":dh?"right":"left",pi=Ng?mh?"bottom":"top":mh?"left":"right",qi=Ng?"left":"bottom",ri={main:function(){return"translate("+Af.left+","+Af.top+")"},context:function(){return"translate("+Bf.left+","+Bf.top+")"},legend:function(){return"translate("+Cf.left+","+Cf.top+")"},x:function(){return"translate(0,"+(Ng?0:Ff)+")"},y:function(){return"translate(0,"+(Ng?Ff:0)+")"},y2:function(){return"translate("+(Ng?0:Df)+","+(Ng?1:0)+")"},subx:function(){return"translate(0,"+(Ng?0:Gf)+")"},arc:function(){return"translate("+Df/2+","+Ff/2+")"}},si="right"===Kg,ti=0,ui=0,vi=0,wi=30,xi=30,yi=5;Pf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var zi,Ai=function(){var a=mf.svg.line().x(Ng?function(a){return V(a.id)(a.value)}:ud).y(Ng?ud:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=xe(b.values);return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),sg[b.id]?Je(e,Yf,V(b.id),sg[b.id]):a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Bi=function(){var a;return a=Ng?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Ci=function(){var a=mf.svg.line().x(Ng?function(a){return W(a.id)(a.value)}:xd).y(Ng?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+_f(c[0].x)+" "+W(b.id)(c[0].value)}}(),Di=function(){};zi=mf.svg.brush().on("brush",Se),zi.update=function(){return Hi&&Hi.select("."+f.brush).call(this),this},zi.scale=function(a){return Ng?this.y(a):this.x(a)},uf&&(Di=mf.behavior.zoom().on("zoomstart",function(){Di.altDomain=mf.event.sourceEvent.altKey?Yf.orgDomain():null}).on("zoom",uf?Te:null),Di.scale=function(a){return Ng?this.y(a):this.x(a)},Di.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Di.updateScaleExtent=function(){var a=$b(Yf.orgDomain())/$b(Li),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Ei,Fi,Gi,Hi,Ii,Ji,Ki,Li,Mi,Ni={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Ei.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Ii.selectAll(kd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Ei.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Ii.selectAll(kd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",.5),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){zi.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){lg[b]=a.classes[b]}),"categories"in a&&ci&&(Pg=a.categories,cg.categories(Pg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Gi.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){vg&&Gi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=wg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?xg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){vg&&Gi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=wg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&xg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?mg:(mg=a,Re(),mg)},nf.xgrids=function(a){return a?(sh=a,Re(),sh):sh},nf.xgrids.add=function(a){return a?nf.xgrids(sh.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(sh.filter(b))},nf.ygrids=function(a){return a?(uh=a,Re(),uh):uh},nf.ygrids.add=function(a){return a?nf.ygrids(uh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(uh.filter(b))},nf.regions=function(a){return c(a)?Ph:(Ph=a,Re(),Ph)},nf.regions.add=function(a){return c(a)?Ph:(Ph=Ph.concat(a),Re(),Ph)},nf.regions.remove=function(a,c){var e=[].concat(a);return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;Ei.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Ph=Ph.filter(function(b){return b.classes.indexOf(a)<0})}),Ph},nf.data.get=function(a){var b=nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},nf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){kg[b]=a[b] }),gf(xc(nf.data.targets),{withTransition:!0}),kg):kg},nf.x=function(a){return arguments.length&&(mc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.xs=function(a){return arguments.length&&(nc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(_g=+a.y),b(a.y2)&&(ih=+a.y2)):_g=ih=+a,Re())},nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(ah=+a.y),b(a.y2)&&(jh=+a.y2)):ah=jh=+a,Re())},nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&nf.axis.max(a.max),"undefined"!=typeof a.min&&nf.axis.min(a.min))},nf.legend.show=function(a){Jg||(Jg=!0,Ii.style("visibility","visible")),ef(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.legend.hide=function(a){Jg&&me(a)&&(Jg=!1,Ii.style("visibility","hidden")),ff(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.resize=function(a){qf=a?a.width:null,rf=a?a.height:null,We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},nf.destroy=function(){nf.data.targets=void 0,nf.data.xs={},Ki.html(""),a.onresize=null},"url"in e.data)mf.csv(e.data.url,function(a,b){Ke(b)});else if("rows"in e.data)Ke(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ke(qc(e.data.columns))}return nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From b87e6602b31889bb940b09625f0bdaca1919031c Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Thu, 10 Apr 2014 11:10:27 +0900 Subject: [PATCH 031/178] Fix hidden legend opacity to use css class - #128 --- c3.css | 3 +++ c3.js | 18 ++++++++---------- c3.min.js | 4 ++-- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/c3.css b/c3.css index 737e783..1d8d26a 100644 --- a/c3.css +++ b/c3.css @@ -115,6 +115,9 @@ .c3-legend-item { font-size: 12px; } +.c3-legend-item-hidden { + opacity: 0.1; +} /*-- Tooltip --*/ diff --git a/c3.js b/c3.js index fb4c513..271288d 100644 --- a/c3.js +++ b/c3.js @@ -3672,14 +3672,16 @@ /*-- Draw Legend --*/ function opacityForLegend(id) { - return d3.select(selectorLegend(id)).classed(CLASS.legendItemHidden) ? 0.5 : 1; + var item = legend.select(selectorLegend(id)); + item.style('opacity', null); // MEMO: remove to get opacity by css + return item.classed(CLASS.legendItemHidden) ? item.style('opacity') : 1; } function toggleFocusLegend(id, focus) { - var legendItem = legend.selectAll('.' + CLASS.legendItem), + var items = legend.selectAll('.' + CLASS.legendItem).filter(function () { return !d3.select(this).classed(CLASS.legendItemHidden); }), isTarget = function (d) { return (!id || d === id); }, notTarget = function (d) { return !isTarget(d); }; - legendItem.filter(notTarget).transition().duration(100).style('opacity', focus ? 0.3 : opacityForLegend); - legendItem.filter(isTarget).transition().duration(100).style('opacity', focus ? opacityForLegend : 0.3); + items.filter(notTarget).transition().duration(100).style('opacity', focus ? 0.3 : opacityForLegend); + items.filter(isTarget).transition().duration(100).style('opacity', focus ? opacityForLegend : 0.3); } function focusLegend(id) { toggleFocusLegend(id, true); @@ -3943,9 +3945,7 @@ showLegend(targetIds); } else { legend.selectAll(selectorLegends(targetIds)) - .classed(CLASS.legendItemHidden, false) - .transition() - .style('opacity', 1); + .classed(CLASS.legendItemHidden, false); } redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withTransitionForHorizontalAxis: false}); @@ -3964,9 +3964,7 @@ hideLegend(targetIds); } else { legend.selectAll(selectorLegends(targetIds)) - .classed(CLASS.legendItemHidden, true) - .transition() - .style('opacity', 0.5); + .classed(CLASS.legendItemHidden, true); } redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withTransitionForHorizontalAxis: false}); diff --git a/c3.min.js b/c3.min.js index 441261b..93fbf12 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ !function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.29"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cDf&&(Df=0),0>Ff&&(Ff=0),Bf={top:Ng?Af.top:If-Hg-(si?0:a),right:0/0,bottom:20+(si?0:a),left:Ng?wi:Af.left},Ef=Ng?Af.left-wi-xi:Df,Gf=Ng?Ff:If-Bf.top-Bf.bottom,0>Ef&&(Ef=0),0>Gf&&(Gf=0),Cf={top:si?0:If-a,right:0/0,bottom:0,left:si?Hf-b:0},p(),si&&Yd(nf.data.targets)&&(Cf.left=Df/2+Kf)}function o(){Gi.select("line."+f.xgridFocus).attr("x1",Ng?0:-10).attr("x2",Ng?Df:-10).attr("y1",Ng?-10:Af.top).attr("y2",Ng?-10:Ff)}function p(){Kf=Ff/2,Jf=.95*Kf,Lf=Xd(nf.data.targets)?.6*Jf:0}function q(){var a=Ng?f.axisX:f.axisY,b=mf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=mf.select(pf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return qf?qf:x()}function s(){var a=rf?rf:y();return a>0?a:320}function t(){return Yd(nf.data.targets)?0:sf?sf:Ng||!$g||dh?1:v("y")}function u(){var a=1;return Yd(nf.data.targets)?0:tf?tf:si?P()+(hh&&!Ng?v("y2"):a):hh?mh||Ng?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||$g?"y2"!==a||hh?(gb(a).isInner?30:40)+("y2"===a?-10:0):yi:Jg&&!si?10:1}function x(){return+mf.select(pf).style("width").replace("px","")}function y(){return+mf.select(pf).style("height").replace("px","")}function z(a){return a?-5:-(Af.left-1)}function A(a){return a?-20:-1}function B(){return z(!Ng)}function C(){return A(!Ng)}function D(){return z(Ng)}function E(){return A(Ng)}function F(a){return a?Df+2+4:Af.left+20}function G(a){return a?80:Ff+2}function H(){return F(!Ng)}function I(){return G(!Ng)}function J(){return F(Ng)}function K(){return G(Ng)}function L(){var a=Ng?Ff:Df,b=vc(),c=Vb()*(Ud(nf.data.targets)?(b-(ci?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){ti=a}function N(a){ui=a}function O(a){vi=a}function P(){return Jg?si?ui*(ti+1):Hf:0}function Q(){return Jg?si?If:vi*(ti+1):0}function R(){var a,b=!Yf;Qf=Ng?1:0,Rf=Ng?Ff:Df,Sf=Ng?0:Ff,Tf=Ng?Df:1,Uf=Qf,Vf=Rf,Wf=Ng?0:Gf,Xf=Ng?Ef:1,Yf=T(Qf,Rf,b?void 0:Yf.domain(),function(){return cg.tickOffset()}),Zf=U(Sf,Tf),$f=U(Sf,Tf),_f=T(Qf,Rf,Li,function(a){return a%1?0:fg.tickOffset()}),ag=U(Wf,Xf),bg=U(Wf,Xf),a=$(),cg=X(Yf,ni,a),fg=X(_f,qi,a),dg=Y(Zf,oi,eh,gh),eg=Y($f,pi,nh,ph),b||(zi.scale(_f),uf&&Di.scale(Yf)),S()}function S(){Mf=Db(),Nf=Eb(),Of=Eb(.98)}function T(a,b,e,f){var g=(bi?mf.time.scale():mf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),ci){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return mf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?$f:Zf}function W(a){return"y2"===Z(a)?bg:ag}function X(a,b,c){var d=(ci?Bb():mf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),ci?d.tickCentered(Qg):d.tickOffset=function(){var a=Ng?Ff:Df;return a*Vb()/vc()/2},ci&&d.categories(Pg),d}function Y(a,b,c,d){return mf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in ng?ng[a]:"y"}function $(){var a=bi?ki:ci?Oc:function(a){return 0>a?a.toFixed(0):a};return Rg&&("function"==typeof Rg?a=Rg:bi&&(a=function(a){return mf.time.format(Rg)(a)})),a}function _(a){var b;return"y"===a?b=ch:"y2"===a?b=lh:"x"===a&&(b=Zg),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?ch=b:"y2"===a?lh=b:"x"===a&&(Zg=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Ng?"inner-top":"inner-right")}function eb(){return cb("y",Ng?"inner-right":"inner-top")}function fb(){return cb("y2",Ng?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?Df/2:Df:b.isBottom?-Ff:b.isMiddle?-Ff/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Ng,db())}function ob(){return kb(Ng,eb())}function pb(){return kb(Ng,fb())}function qb(){return lb(!Ng,db())}function rb(){return lb(Ng,eb())}function sb(){return lb(Ng,fb())}function tb(){var a=db();return Ng?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Ng?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Ng?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Ng,db())}function xb(){return mb(Ng,eb())}function yb(){return mb(Ng,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Gi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Gi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Gi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return mf.min(Object.keys(i).map(function(a){return mf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(mg.length>0)for(g=Nc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return mf.max(Object.keys(i).map(function(a){return mf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?jh:ah,n="y2"===c?ih:_g,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?kh:bh,r=pd()&&Ng;return 0===l.length?"y2"===c?$f.domain():Zf.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=qd(o,p),j=$b(Zf.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&fh&&(f=b(fh.top)?fh.top:e,g=b(fh.bottom)?fh.bottom:e),"y2"===c&&oh&&(f=b(oh.top)?oh.top:e,g=b(oh.bottom)?oh.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Li),c=$b(Yf.domain());return a||0===c?1:b/c}function Wb(a){return Xg?Xg:mf.min(a,function(a){return mf.min(a.values,function(a){return a.x})})}function Xb(a){return Wg?Wg:mf.max(a,function(a){return mf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return ci?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=bi?new Date(c.getTime()-e):c-e,g=bi?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return gg&&a===gg||ne(hg)&&oe(hg,a)}function fc(a){return!ec(a)}function gc(a){return gg?gg:ne(hg)?hg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=nf.data.xs[b])}),c}function ic(a,b){return a in nf.data.xs&&nf.data.xs[a]&&nf.data.xs[a][b]?nf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){hg[b]=a[b]})}function kc(a){return 1===mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=kg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),nf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=bi?a?a instanceof Date?a:ie(a):ie(ic(b,c)):di&&!ci?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):gg?(d=Object.keys(nf.data.xs),nf.data.xs[c]=d.length>0?nf.data.xs[d[0]]:void 0):ne(hg)&&(nf.data.xs[c]=hc(f,nf.data.targets)):nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=jg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return di&&ci&&0===c&&g&&(0===e&&(Pg=[]),Pg.push(g)),("undefined"==typeof a[b]||nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),og&&Sd(xc(c).filter(function(a){return!(a in pg)}),og),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function tc(a){return a>0&&nf.data.targets[0].values[a-1]?nf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?nf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?nf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(nf.data.targets)}function zc(a,b){var c,d=xc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(bi?new Date(h):h);i.push(d)}return i}function Gc(a){li=li.concat(a)}function Hc(a){li=li.filter(function(b){return a.indexOf(b)<0})}function Ic(a){mi=mi.concat(a)}function Jc(a){mi=mi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Ed(){return rg&&"desc"===rg.toLowerCase()}function Fd(){return rg&&"asc"===rg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof rg&&a.sort(rg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(nf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Qh&&0!==m.length&&(Ji.html(Th(a,$(),l,ji)).style("display","block"),d=Ji.property("offsetWidth"),e=Ji.property("offsetHeight"),k?(g=Df/2+c[0],i=Ff/2+c[1]+20):(Ng?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Yf(m[0].x)+20):(f=q(),g=f+t()+Yf(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Ji.style("top",i+"px").style("left",g+"px"))}function Id(){Ji.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Qh&&(Vd(nf.data.targets)||Yd(nf.data.targets)||Gi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Ng?"y1":"x1",ud).attr(Ng?"y2":"x2",ud))}function Kd(){Gi.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?Yf(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Ch?Ch:b?2*a.tickOffset()*Dh/b:0}function Sd(a,b){yc(a).forEach(function(a){Ni[a]=b===pg[a],pg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){pg[a.id]===b&&(c=!0),a.id in pg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in pg)||"line"===pg[b]||"spline"===pg[b]||"area"===pg[b]||"area-spline"===pg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===pg[b]||"area-spline"===pg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===pg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===pg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===pg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===pg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ie(b){var c;if(!b)throw Error(b+" can not be parsed as d3.time with format "+ig+". Maybe 'x' of this data is not defined. See data.x or data.xs option.");try{c=ig?mf.time.format(ig).parse(b):new Date(b)}catch(d){c=void 0}return c||a.console.error("Failed to parse x '"+b+"' to Date with format "+ig),c}function je(a,b){var c=mf.mouse(a),d=mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?Zf:$f,d=Ng?1:0,e=Ng?0:1;return Math.pow(Yf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Cg(b,a.node()),Gi.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md).attr("stroke",function(){return ji(b)}).attr("r",1.4*Bh).transition().duration(100).attr("r",Bh)}function se(a,b,c){Dg(b,a.node()),Gi.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Cg(b,a.node()),a.transition().duration(100).style("fill",function(){return mf.rgb(ji(b)).darker(1)})}function ve(a,b){Dg(b,a.node()),a.transition().duration(100).style("fill",function(){return ji(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Gi.selectAll("."+f.circles+gd(c)):Gi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",Ah)}function Ae(a){ye(a).filter(function(){return mf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",xh)}function Be(a){return Gi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Ng?1:0,f=Ng?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Ng?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBoundingClientRect();return Ng?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(cg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Ng&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Je(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function Ke(b){var c,d,e;if(Ki=mf.select(pf),Ki.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Ki.html(""),Ki.classed("c3",!0),nf.data.xs={},nf.data.targets=rc(b),n(),R(),Yf.domain(mf.extent(Zb(nf.data.targets))),Zf.domain(Ub(nf.data.targets,"y")),$f.domain(Ub(nf.data.targets,"y2")),_f.domain(Yf.domain()),ag.domain(Zf.domain()),bg.domain($f.domain()),Li=Yf.domain(),zi.scale(_f),uf&&Di.scale(Yf),Ei=Ki.append("svg").attr("width",Df+Af.left+Af.right).attr("height",Ff+Af.top+Af.bottom).on("mouseenter",xf).on("mouseleave",yf),Fi=Ei.append("defs"),Fi.append("clipPath").attr("id",Xh).append("rect").attr("width",Df).attr("height",Ff),Fi.append("clipPath").attr("id",Yh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Fi.append("clipPath").attr("id",Zh).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Gi=Ei.append("g").attr("transform",ri.main),Hi=Gg?Ei.append("g").attr("transform",ri.context):null,Ii=Ei.append("g").attr("transform",ri.legend),Jg||(Ii.style("visibility","hidden"),mi=xc(nf.data.targets)),Ji=mf.select(pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),gf(xc(nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Gi.append("g").attr("class",f.axisX).attr("clip-path",Ng?"":_h).attr("transform",ri.x).append("text").attr("class",f.axisXLabel).attr("transform",Ng?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),$g&&Gi.append("g").attr("class",f.axisY).attr("clip-path",Ng?ai:"").attr("transform",ri.y).append("text").attr("class",f.axisYLabel).attr("transform",Ng?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),hh&&Gi.append("g").attr("class",f.axisY2).attr("transform",ri.y2).append("text").attr("class",f.axisY2Label).attr("transform",Ng?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Gi.append("g").attr("clip-path",$h).attr("class",f.grid),qh&&d.append("g").attr("class",f.xgrids),ne(sh)&&d.append("g").attr("class",f.xgridLines),yh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),th&&d.append("g").attr("class",f.ygrids),ne(uh)&&d.append("g").attr("class",f.ygridLines),Gi.append("g").attr("clip-path",$h).attr("class",f.regions),Gi.append("g").attr("clip-path",$h).attr("class",f.chart),c=Gi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",uf?Ng?"ns-resize":"ew-resize":null),Gi.select("."+f.chart).append("g").attr("class",f.chartBars),Gi.select("."+f.chart).append("g").attr("class",f.chartLines),Gi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",ri.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Gi.select("."+f.chart).append("g").attr("class",f.chartTexts),uf&&Gi.insert("rect",wf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Df).attr("height",Ff).style("opacity",0).style("cursor",Ng?"ns-resize":"ew-resize").call(Di).on("dblclick.zoom",null),Yg&&zi.extent("function"!=typeof Yg?Yg:Yg(Zb())),Gg&&(Hi.append("g").attr("clip-path",$h).attr("class",f.chart),Hi.select("."+f.chart).append("g").attr("class",f.chartBars),Hi.select("."+f.chart).append("g").attr("class",f.chartLines),Hi.append("g").attr("clip-path",$h).attr("class",f.brush).call(zi).selectAll("rect").attr(Ng?"width":"height",Ng?Ef:Gf),Hi.append("g").attr("class",f.axisX).attr("transform",ri.subx).attr("clip-path",Ng?"":_h)),Xe(nf.data.targets),Ng?Gi.select("."+f.axisX).style("opacity",0).call(cg):(Gi.select("."+f.axisY).style("opacity",0).call(dg),Gi.select("."+f.axisY2).style("opacity",0).call(eg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Uh){if(bi&&"string"==typeof Vh){for(Vh=ie(Vh),e=0;e0){d=[];for(var g in kg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function Pe(a){Yd(nf.data.targets)||vg&&(ei=a,Gi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),fi=!0,Eg())}function Qe(){Yd(nf.data.targets)||vg&&(Gi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Gi.selectAll("."+f.shape).classed(f.INCLUDED,!1),fi=!1,Fg())}function Re(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Nd(),U=Yd(nf.data.targets),V=Dc(nf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?zf:0,O=B?N:0,P=C?N:0,H&&Jg&&gf(xc(nf.data.targets),a),G&&(Yf.domain(mf.extent(Zb(V))),Li=Yf.domain(),uf&&Di.scale(Yf).updateScaleExtent(),_f.domain(Yf.domain()),zi.scale(_f)),F&&(Yf.domain(zi.empty()?Li:zi.extent()),uf&&Di.scale(Yf).updateScaleExtent()),Zf.domain(Ub(V,"y")),$f.domain(Ub(V,"y2")),Vd(V)||(Q=Fc(Ec(V)).sort(),cg.tickValues(Q),fg.tickValues(Q)),c=Gi.select("."+f.axisX).style("opacity",U?0:1),(Ng||D)&&(c=c.transition().duration(P)),c.call(cg),e=Gi.select("."+f.axisY).style("opacity",U?0:1),(!Ng||D)&&(e=e.transition().duration(P)),e.call(dg),Gi.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(eg),F&&Sg&&Q){for(R=1;R=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=Yf.ticks(10);g=Gi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Ng?0:function(a){return Yf(a)-cg.tickOffset()}).attr("x2",Ng?Df:function(a){return Yf(a)-cg.tickOffset()}).attr("y1",Ng?function(a){return Yf(a)-cg.tickOffset()}:Af.top).attr("y2",Ng?function(a){return Yf(a)-cg.tickOffset()}:Ff).style("opacity",function(){return+mf.select(this).attr(Ng?"y1":"x1")===(Ng?Ff:0)?0:1}),g.exit().remove()}ne(sh)&&(i=Gi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(sh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Ng?"":"rotate(-90)").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Ng?0:vd).attr("x2",Ng?Df:vd).attr("y1",Ng?vd:Af.top).attr("y2",Ng?vd:Ff).style("opacity",1),i.select("text").transition().duration(N).attr("x",Ng?Df:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&th&&(k=Gi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Zf.ticks(vh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Ng?Zf:0).attr("x2",Ng?Zf:Df).attr("y1",Ng?0:Zf).attr("y2",Ng?Ff:Zf),k.exit().remove()),y&&ne(uh)&&(l=Gi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(uh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Ng?"rotate(-90)":"").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Ng?wd:0).attr("x2",Ng?wd:Df).attr("y1",Ng?0:wd).attr("y2",Ng?Ff:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Ng?0:Df).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Gi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ji(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Gi.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Ng?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Gi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ai).style("opacity",1),Gi.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Bi).style("opacity",Mi),n=Gi.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",xh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),n.exit().remove(),Gi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=mf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Gi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Gi.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Gg&&(null!==mf.event&&"zoom"===mf.event.type&&zi.extent(Yf.orgDomain()).update(),z&&(Hi.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(fg),zi.empty()||zi.extent(Yf.orgDomain()).update(),J=Ee(T,!0),s=Hi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ji(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Hi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ci).style("opacity",1))),Gi.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Gi.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),t=Gi.select("."+f.eventRects),ne(hg)&&!kc(hg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Gi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Df).attr("height",Ff)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),di&&!ci?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return(Yf(d?d:e+50)-Yf(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return(Yf(d)+Yf(c?c:d-50))/2}):(x=L(),w=function(a){return Yf(a.x)-x/2}),v=wc(),Gi.select("."+f.eventRects).datum(v?v.values:[]),u=Gi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Ng?0:w).attr("y",Ng?w:0).attr("width",Ng?Df:x).attr("height",Ng?x:Ff),u.exit().remove()),q=Gi.select("."+f.regions).selectAll("rect."+f.region).data(Ph),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Ng?0:cc).attr("y",Ng?cc:Af.top).attr("width",Ng?Df:dc).attr("height",Ng?dc:Ff).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),xc(nf.data.targets).forEach(function(a){Ni[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Di.altDomain?(Yf.domain(Di.altDomain),void Di.scale(Yf).updateScaleExtent()):(ci&&Yf.orgDomain()[0]===Li[0]&&Yf.domain([Li[0]-1e-10,Yf.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(gi=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Ei.attr("width",Hf).attr("height",If),Ei.select("#"+Xh).select("rect").attr("width",Df).attr("height",Ff),Ei.select("#"+Yh).select("rect").attr("width",H),Ei.select("#"+Zh).select("rect").attr("width",J),Ei.select("."+f.zoomRect).attr("width",Df).attr("height",Ff)}function We(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Gi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ji(a)}),e=Gi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ji(a)}).style("stroke","none").style("cursor",function(a){return xg(a)?"pointer":null}),c=Gi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ji(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Mi=+mf.select(this).style("opacity"),0}).style("fill",function(a){return ji(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ji(a)}).style("cursor",function(a){return xg(a)?"pointer":null}),a.forEach(function(a){Gi.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Gi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Pf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ji(a.data)}).style("cursor",function(a){return xg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Gg&&(n=Hi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ji(a)}),l=Hi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ji(a)})),Ei.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=si?j:i,l=si?Q():P();return d&&(w=0,C=0,t=0,u=0),Jg&&!Cc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=si?u:t,void(Mg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,si?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Ii.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Lg?Lg(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",si?g:-200).attr("y",si?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",si?h:-200).attr("y",si?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return ji(a)}).attr("x",si?g:-200).attr("y",si?-200:i).attr("width",10).attr("height",10),Ii.selectAll("text").data(a).text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ii.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ii.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["transition","duration"],350);g("data","data is required in config");var Af,Bf,Cf,Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg=h(["data","x"]),hg=h(["data","xs"],{}),ig=h(["data","x_format"]),jg=h(["data","id_converter"],function(a){return a}),kg=h(["data","names"],{}),lg=h(["data","classes"],{}),mg=h(["data","groups"],[]),ng=h(["data","axes"],{}),og=h(["data","type"]),pg=h(["data","types"],{}),qg=h(["data","labels"],{}),rg=h(["data","order"]),sg=h(["data","regions"],{}),tg=h(["data","color"]),ug=h(["data","colors"],{}),vg=h(["data","selection","enabled"],!1),wg=h(["data","selection","grouped"],!1),xg=h(["data","selection","isselectable"],function(){return!0}),yg=h(["data","selection","multiple"],!0),zg=h(["data","onclick"],function(){}),Ag=h(["data","onenter"],function(){}),Bg=h(["data","onleave"],function(){}),Cg=h(["data","onselected"],function(){}),Dg=h(["data","onunselected"],function(){}),Eg=h(["data","ondragstart"],function(){}),Fg=h(["data","ondragend"],function(){}),Gg=h(["subchart","show"],!1),Hg=Gg?h(["subchart","size","height"],60):0,Ig=h(["color","pattern"],[]),Jg=h(["legend","show"],!0),Kg=h(["legend","position"],"bottom"),Lg=h(["legend","item","onclick"]),Mg=h(["legend","equally"],!1),Ng=h(["axis","rotated"],!1),Og=h(["axis","x","type"],"indexed"),Pg=h(["axis","x","categories"],[]),Qg=h(["axis","x","tick","centered"],!1),Rg=h(["axis","x","tick","format"]),Sg=h(["axis","x","tick","culling"],{}),Tg=h(["axis","x","tick","culling","max"],"categorized"===Og?1/0:10),Ug=h(["axis","x","tick","count"]),Vg=h(["axis","x","tick","fit"],!1),Wg=h(["axis","x","max"]),Xg=h(["axis","x","min"]),Yg=h(["axis","x","default"]),Zg=h(["axis","x","label"],{}),$g=h(["axis","y","show"],!0),_g=h(["axis","y","max"]),ah=h(["axis","y","min"]),bh=h(["axis","y","center"]),ch=h(["axis","y","label"],{}),dh=h(["axis","y","inner"],!1),eh=h(["axis","y","tick","format"]),fh=h(["axis","y","padding"],{}),gh=h(["axis","y","ticks"],10),hh=h(["axis","y2","show"],!1),ih=h(["axis","y2","max"]),jh=h(["axis","y2","min"]),kh=h(["axis","y2","center"]),lh=h(["axis","y2","label"],{}),mh=h(["axis","y2","inner"],!1),nh=h(["axis","y2","tick","format"]),oh=h(["axis","y2","padding"],{}),ph=h(["axis","y2","ticks"],10),qh=h(["grid","x","show"],!1),rh=h(["grid","x","type"],"tick"),sh=h(["grid","x","lines"],[]),th=h(["grid","y","show"],!1),uh=h(["grid","y","lines"],[]),vh=h(["grid","y","ticks"],10),wh=h(["point","show"],!0),xh=wh?h(["point","r"],2.5):0,yh=h(["point","focus","line","enabled"],!0),zh=h(["point","focus","expand","enabled"],!0),Ah=h(["point","focus","expand","r"],zh?4:xh),Bh=h(["point","focus","select","r"],8),Ch=h(["bar","width"]),Dh=h(["bar","width","ratio"],.6),Eh=h(["pie","label","show"],!0),Fh=h(["pie","label","format"]),Gh=h(["pie","onclick"],function(){}),Hh=h(["pie","onmouseover"],function(){}),Ih=h(["pie","onmouseout"],function(){}),Jh=h(["donut","label","show"],!0),Kh=h(["donut","label","format"]),Lh=h(["donut","title"],""),Mh=h(["donut","onclick"],function(){}),Nh=h(["donut","onmouseover"],function(){}),Oh=h(["donut","onmouseout"],function(){}),Ph=h(["regions"],[]),Qh=h(["tooltip","show"],!0),Rh=h(["tooltip","format","title"]),Sh=h(["tooltip","format","value"]),Th=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Rh?Rh:b,l=Sh?Sh:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Uh=h(["tooltip","init","show"],!1),Vh=h(["tooltip","init","x"],0),Wh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Xh=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",Yh=Xh+"-xaxis",Zh=Xh+"-yaxis",$h=i(Xh),_h=i(Yh),ai=i(Zh),bi="timeseries"===Og,ci="categorized"===Og,di=!bi&&(gg||ne(hg)),ei=null,fi=!1,gi=!1,hi=!1,ii=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ji=he(ug,ne(Ig)?Ig:ii,tg),ki=function(){var a=[[mf.time.format("%Y/%-m/%-d"),function(){return!0}],[mf.time.format("%-m/%-d"),function(a){return a.getMonth()}],[mf.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[mf.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[mf.time.format("%I %p"),function(a){return a.getHours()}],[mf.time.format("%I:%M"),function(a){return a.getMinutes()}],[mf.time.format(":%S"),function(a){return a.getSeconds()}],[mf.time.format(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),li=[],mi=[],ni=Ng?"left":"bottom",oi=Ng?dh?"top":"bottom":dh?"right":"left",pi=Ng?mh?"bottom":"top":mh?"left":"right",qi=Ng?"left":"bottom",ri={main:function(){return"translate("+Af.left+","+Af.top+")"},context:function(){return"translate("+Bf.left+","+Bf.top+")"},legend:function(){return"translate("+Cf.left+","+Cf.top+")"},x:function(){return"translate(0,"+(Ng?0:Ff)+")"},y:function(){return"translate(0,"+(Ng?Ff:0)+")"},y2:function(){return"translate("+(Ng?0:Df)+","+(Ng?1:0)+")"},subx:function(){return"translate(0,"+(Ng?0:Gf)+")"},arc:function(){return"translate("+Df/2+","+Ff/2+")"}},si="right"===Kg,ti=0,ui=0,vi=0,wi=30,xi=30,yi=5;Pf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var zi,Ai=function(){var a=mf.svg.line().x(Ng?function(a){return V(a.id)(a.value)}:ud).y(Ng?ud:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=xe(b.values);return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),sg[b.id]?Je(e,Yf,V(b.id),sg[b.id]):a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Bi=function(){var a;return a=Ng?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Ci=function(){var a=mf.svg.line().x(Ng?function(a){return W(a.id)(a.value)}:xd).y(Ng?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+_f(c[0].x)+" "+W(b.id)(c[0].value)}}(),Di=function(){};zi=mf.svg.brush().on("brush",Se),zi.update=function(){return Hi&&Hi.select("."+f.brush).call(this),this},zi.scale=function(a){return Ng?this.y(a):this.x(a)},uf&&(Di=mf.behavior.zoom().on("zoomstart",function(){Di.altDomain=mf.event.sourceEvent.altKey?Yf.orgDomain():null}).on("zoom",uf?Te:null),Di.scale=function(a){return Ng?this.y(a):this.x(a)},Di.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Di.updateScaleExtent=function(){var a=$b(Yf.orgDomain())/$b(Li),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Ei,Fi,Gi,Hi,Ii,Ji,Ki,Li,Mi,Ni={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Ei.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Ii.selectAll(kd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Ei.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Ii.selectAll(kd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",.5),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){zi.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){lg[b]=a.classes[b]}),"categories"in a&&ci&&(Pg=a.categories,cg.categories(Pg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Gi.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){vg&&Gi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=wg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?xg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){vg&&Gi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=wg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&xg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?mg:(mg=a,Re(),mg)},nf.xgrids=function(a){return a?(sh=a,Re(),sh):sh},nf.xgrids.add=function(a){return a?nf.xgrids(sh.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(sh.filter(b))},nf.ygrids=function(a){return a?(uh=a,Re(),uh):uh},nf.ygrids.add=function(a){return a?nf.ygrids(uh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(uh.filter(b))},nf.regions=function(a){return c(a)?Ph:(Ph=a,Re(),Ph)},nf.regions.add=function(a){return c(a)?Ph:(Ph=Ph.concat(a),Re(),Ph)},nf.regions.remove=function(a,c){var e=[].concat(a);return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;Ei.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Ph=Ph.filter(function(b){return b.classes.indexOf(a)<0})}),Ph},nf.data.get=function(a){var b=nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},nf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){kg[b]=a[b] -}),gf(xc(nf.data.targets),{withTransition:!0}),kg):kg},nf.x=function(a){return arguments.length&&(mc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.xs=function(a){return arguments.length&&(nc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(_g=+a.y),b(a.y2)&&(ih=+a.y2)):_g=ih=+a,Re())},nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(ah=+a.y),b(a.y2)&&(jh=+a.y2)):ah=jh=+a,Re())},nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&nf.axis.max(a.max),"undefined"!=typeof a.min&&nf.axis.min(a.min))},nf.legend.show=function(a){Jg||(Jg=!0,Ii.style("visibility","visible")),ef(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.legend.hide=function(a){Jg&&me(a)&&(Jg=!1,Ii.style("visibility","hidden")),ff(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.resize=function(a){qf=a?a.width:null,rf=a?a.height:null,We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},nf.destroy=function(){nf.data.targets=void 0,nf.data.xs={},Ki.html(""),a.onresize=null},"url"in e.data)mf.csv(e.data.url,function(a,b){Ke(b)});else if("rows"in e.data)Ke(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ke(qc(e.data.columns))}return nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file +}Ji.html(Th(nf.data.targets.map(function(a){return lc(a.values[Vh])}),$(),rd,ji)),Ji.style("top",Wh.top).style("left",Wh.left).style("display","block")}null==a.onresize&&(a.onresize=Ue()),a.onresize.add&&a.onresize.add(function(){We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})})}function Le(a){a.append("rect").attr("class",ad).style("cursor",vg&&wg?"pointer":null).on("mouseover",function(a,b){if(!fi&&!Yd(nf.data.targets)){var c,d,e=nf.data.targets.map(function(a){return lc(a.values[b])});if(Object.keys(kg).length>0){d=[];for(var g in kg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function Pe(a){Yd(nf.data.targets)||vg&&(ei=a,Gi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),fi=!0,Eg())}function Qe(){Yd(nf.data.targets)||vg&&(Gi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Gi.selectAll("."+f.shape).classed(f.INCLUDED,!1),fi=!1,Fg())}function Re(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Nd(),U=Yd(nf.data.targets),V=Dc(nf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?zf:0,O=B?N:0,P=C?N:0,H&&Jg&&gf(xc(nf.data.targets),a),G&&(Yf.domain(mf.extent(Zb(V))),Li=Yf.domain(),uf&&Di.scale(Yf).updateScaleExtent(),_f.domain(Yf.domain()),zi.scale(_f)),F&&(Yf.domain(zi.empty()?Li:zi.extent()),uf&&Di.scale(Yf).updateScaleExtent()),Zf.domain(Ub(V,"y")),$f.domain(Ub(V,"y2")),Vd(V)||(Q=Fc(Ec(V)).sort(),cg.tickValues(Q),fg.tickValues(Q)),c=Gi.select("."+f.axisX).style("opacity",U?0:1),(Ng||D)&&(c=c.transition().duration(P)),c.call(cg),e=Gi.select("."+f.axisY).style("opacity",U?0:1),(!Ng||D)&&(e=e.transition().duration(P)),e.call(dg),Gi.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(eg),F&&Sg&&Q){for(R=1;R=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=Yf.ticks(10);g=Gi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Ng?0:function(a){return Yf(a)-cg.tickOffset()}).attr("x2",Ng?Df:function(a){return Yf(a)-cg.tickOffset()}).attr("y1",Ng?function(a){return Yf(a)-cg.tickOffset()}:Af.top).attr("y2",Ng?function(a){return Yf(a)-cg.tickOffset()}:Ff).style("opacity",function(){return+mf.select(this).attr(Ng?"y1":"x1")===(Ng?Ff:0)?0:1}),g.exit().remove()}ne(sh)&&(i=Gi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(sh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Ng?"":"rotate(-90)").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Ng?0:vd).attr("x2",Ng?Df:vd).attr("y1",Ng?vd:Af.top).attr("y2",Ng?vd:Ff).style("opacity",1),i.select("text").transition().duration(N).attr("x",Ng?Df:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&th&&(k=Gi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Zf.ticks(vh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Ng?Zf:0).attr("x2",Ng?Zf:Df).attr("y1",Ng?0:Zf).attr("y2",Ng?Ff:Zf),k.exit().remove()),y&&ne(uh)&&(l=Gi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(uh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Ng?"rotate(-90)":"").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Ng?wd:0).attr("x2",Ng?wd:Df).attr("y1",Ng?0:wd).attr("y2",Ng?Ff:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Ng?0:Df).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Gi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ji(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Gi.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Ng?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Gi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ai).style("opacity",1),Gi.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Bi).style("opacity",Mi),n=Gi.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",xh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),n.exit().remove(),Gi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=mf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Gi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Gi.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Gg&&(null!==mf.event&&"zoom"===mf.event.type&&zi.extent(Yf.orgDomain()).update(),z&&(Hi.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(fg),zi.empty()||zi.extent(Yf.orgDomain()).update(),J=Ee(T,!0),s=Hi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ji(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Hi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ci).style("opacity",1))),Gi.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Gi.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),t=Gi.select("."+f.eventRects),ne(hg)&&!kc(hg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Gi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Df).attr("height",Ff)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),di&&!ci?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return(Yf(d?d:e+50)-Yf(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return(Yf(d)+Yf(c?c:d-50))/2}):(x=L(),w=function(a){return Yf(a.x)-x/2}),v=wc(),Gi.select("."+f.eventRects).datum(v?v.values:[]),u=Gi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Ng?0:w).attr("y",Ng?w:0).attr("width",Ng?Df:x).attr("height",Ng?x:Ff),u.exit().remove()),q=Gi.select("."+f.regions).selectAll("rect."+f.region).data(Ph),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Ng?0:cc).attr("y",Ng?cc:Af.top).attr("width",Ng?Df:dc).attr("height",Ng?dc:Ff).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),xc(nf.data.targets).forEach(function(a){Ni[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Di.altDomain?(Yf.domain(Di.altDomain),void Di.scale(Yf).updateScaleExtent()):(ci&&Yf.orgDomain()[0]===Li[0]&&Yf.domain([Li[0]-1e-10,Yf.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(gi=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Ei.attr("width",Hf).attr("height",If),Ei.select("#"+Xh).select("rect").attr("width",Df).attr("height",Ff),Ei.select("#"+Yh).select("rect").attr("width",H),Ei.select("#"+Zh).select("rect").attr("width",J),Ei.select("."+f.zoomRect).attr("width",Df).attr("height",Ff)}function We(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Gi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ji(a)}),e=Gi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ji(a)}).style("stroke","none").style("cursor",function(a){return xg(a)?"pointer":null}),c=Gi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ji(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Mi=+mf.select(this).style("opacity"),0}).style("fill",function(a){return ji(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ji(a)}).style("cursor",function(a){return xg(a)?"pointer":null}),a.forEach(function(a){Gi.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Gi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Pf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ji(a.data)}).style("cursor",function(a){return xg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Gg&&(n=Hi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ji(a)}),l=Hi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ji(a)})),Ei.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=si?j:i,l=si?Q():P();return d&&(w=0,C=0,t=0,u=0),Jg&&!Cc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=si?u:t,void(Mg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,si?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Ii.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Lg?Lg(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",si?g:-200).attr("y",si?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",si?h:-200).attr("y",si?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return ji(a)}).attr("x",si?g:-200).attr("y",si?-200:i).attr("width",10).attr("height",10),Ii.selectAll("text").data(a).text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ii.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ii.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["transition","duration"],350);g("data","data is required in config");var Af,Bf,Cf,Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg=h(["data","x"]),hg=h(["data","xs"],{}),ig=h(["data","x_format"]),jg=h(["data","id_converter"],function(a){return a}),kg=h(["data","names"],{}),lg=h(["data","classes"],{}),mg=h(["data","groups"],[]),ng=h(["data","axes"],{}),og=h(["data","type"]),pg=h(["data","types"],{}),qg=h(["data","labels"],{}),rg=h(["data","order"]),sg=h(["data","regions"],{}),tg=h(["data","color"]),ug=h(["data","colors"],{}),vg=h(["data","selection","enabled"],!1),wg=h(["data","selection","grouped"],!1),xg=h(["data","selection","isselectable"],function(){return!0}),yg=h(["data","selection","multiple"],!0),zg=h(["data","onclick"],function(){}),Ag=h(["data","onenter"],function(){}),Bg=h(["data","onleave"],function(){}),Cg=h(["data","onselected"],function(){}),Dg=h(["data","onunselected"],function(){}),Eg=h(["data","ondragstart"],function(){}),Fg=h(["data","ondragend"],function(){}),Gg=h(["subchart","show"],!1),Hg=Gg?h(["subchart","size","height"],60):0,Ig=h(["color","pattern"],[]),Jg=h(["legend","show"],!0),Kg=h(["legend","position"],"bottom"),Lg=h(["legend","item","onclick"]),Mg=h(["legend","equally"],!1),Ng=h(["axis","rotated"],!1),Og=h(["axis","x","type"],"indexed"),Pg=h(["axis","x","categories"],[]),Qg=h(["axis","x","tick","centered"],!1),Rg=h(["axis","x","tick","format"]),Sg=h(["axis","x","tick","culling"],{}),Tg=h(["axis","x","tick","culling","max"],"categorized"===Og?1/0:10),Ug=h(["axis","x","tick","count"]),Vg=h(["axis","x","tick","fit"],!1),Wg=h(["axis","x","max"]),Xg=h(["axis","x","min"]),Yg=h(["axis","x","default"]),Zg=h(["axis","x","label"],{}),$g=h(["axis","y","show"],!0),_g=h(["axis","y","max"]),ah=h(["axis","y","min"]),bh=h(["axis","y","center"]),ch=h(["axis","y","label"],{}),dh=h(["axis","y","inner"],!1),eh=h(["axis","y","tick","format"]),fh=h(["axis","y","padding"],{}),gh=h(["axis","y","ticks"],10),hh=h(["axis","y2","show"],!1),ih=h(["axis","y2","max"]),jh=h(["axis","y2","min"]),kh=h(["axis","y2","center"]),lh=h(["axis","y2","label"],{}),mh=h(["axis","y2","inner"],!1),nh=h(["axis","y2","tick","format"]),oh=h(["axis","y2","padding"],{}),ph=h(["axis","y2","ticks"],10),qh=h(["grid","x","show"],!1),rh=h(["grid","x","type"],"tick"),sh=h(["grid","x","lines"],[]),th=h(["grid","y","show"],!1),uh=h(["grid","y","lines"],[]),vh=h(["grid","y","ticks"],10),wh=h(["point","show"],!0),xh=wh?h(["point","r"],2.5):0,yh=h(["point","focus","line","enabled"],!0),zh=h(["point","focus","expand","enabled"],!0),Ah=h(["point","focus","expand","r"],zh?4:xh),Bh=h(["point","focus","select","r"],8),Ch=h(["bar","width"]),Dh=h(["bar","width","ratio"],.6),Eh=h(["pie","label","show"],!0),Fh=h(["pie","label","format"]),Gh=h(["pie","onclick"],function(){}),Hh=h(["pie","onmouseover"],function(){}),Ih=h(["pie","onmouseout"],function(){}),Jh=h(["donut","label","show"],!0),Kh=h(["donut","label","format"]),Lh=h(["donut","title"],""),Mh=h(["donut","onclick"],function(){}),Nh=h(["donut","onmouseover"],function(){}),Oh=h(["donut","onmouseout"],function(){}),Ph=h(["regions"],[]),Qh=h(["tooltip","show"],!0),Rh=h(["tooltip","format","title"]),Sh=h(["tooltip","format","value"]),Th=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Rh?Rh:b,l=Sh?Sh:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Uh=h(["tooltip","init","show"],!1),Vh=h(["tooltip","init","x"],0),Wh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Xh=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",Yh=Xh+"-xaxis",Zh=Xh+"-yaxis",$h=i(Xh),_h=i(Yh),ai=i(Zh),bi="timeseries"===Og,ci="categorized"===Og,di=!bi&&(gg||ne(hg)),ei=null,fi=!1,gi=!1,hi=!1,ii=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ji=he(ug,ne(Ig)?Ig:ii,tg),ki=function(){var a=[[mf.time.format("%Y/%-m/%-d"),function(){return!0}],[mf.time.format("%-m/%-d"),function(a){return a.getMonth()}],[mf.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[mf.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[mf.time.format("%I %p"),function(a){return a.getHours()}],[mf.time.format("%I:%M"),function(a){return a.getMinutes()}],[mf.time.format(":%S"),function(a){return a.getSeconds()}],[mf.time.format(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),li=[],mi=[],ni=Ng?"left":"bottom",oi=Ng?dh?"top":"bottom":dh?"right":"left",pi=Ng?mh?"bottom":"top":mh?"left":"right",qi=Ng?"left":"bottom",ri={main:function(){return"translate("+Af.left+","+Af.top+")"},context:function(){return"translate("+Bf.left+","+Bf.top+")"},legend:function(){return"translate("+Cf.left+","+Cf.top+")"},x:function(){return"translate(0,"+(Ng?0:Ff)+")"},y:function(){return"translate(0,"+(Ng?Ff:0)+")"},y2:function(){return"translate("+(Ng?0:Df)+","+(Ng?1:0)+")"},subx:function(){return"translate(0,"+(Ng?0:Gf)+")"},arc:function(){return"translate("+Df/2+","+Ff/2+")"}},si="right"===Kg,ti=0,ui=0,vi=0,wi=30,xi=30,yi=5;Pf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var zi,Ai=function(){var a=mf.svg.line().x(Ng?function(a){return V(a.id)(a.value)}:ud).y(Ng?ud:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=xe(b.values);return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),sg[b.id]?Je(e,Yf,V(b.id),sg[b.id]):a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Bi=function(){var a;return a=Ng?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Ci=function(){var a=mf.svg.line().x(Ng?function(a){return W(a.id)(a.value)}:xd).y(Ng?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+_f(c[0].x)+" "+W(b.id)(c[0].value)}}(),Di=function(){};zi=mf.svg.brush().on("brush",Se),zi.update=function(){return Hi&&Hi.select("."+f.brush).call(this),this},zi.scale=function(a){return Ng?this.y(a):this.x(a)},uf&&(Di=mf.behavior.zoom().on("zoomstart",function(){Di.altDomain=mf.event.sourceEvent.altKey?Yf.orgDomain():null}).on("zoom",uf?Te:null),Di.scale=function(a){return Ng?this.y(a):this.x(a)},Di.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Di.updateScaleExtent=function(){var a=$b(Yf.orgDomain())/$b(Li),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Ei,Fi,Gi,Hi,Ii,Ji,Ki,Li,Mi,Ni={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Ei.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Ii.selectAll(kd(a)).classed(f.legendItemHidden,!1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Ei.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Ii.selectAll(kd(a)).classed(f.legendItemHidden,!0),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){zi.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){lg[b]=a.classes[b]}),"categories"in a&&ci&&(Pg=a.categories,cg.categories(Pg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Gi.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){vg&&Gi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=wg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?xg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){vg&&Gi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=wg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&xg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?mg:(mg=a,Re(),mg)},nf.xgrids=function(a){return a?(sh=a,Re(),sh):sh},nf.xgrids.add=function(a){return a?nf.xgrids(sh.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(sh.filter(b))},nf.ygrids=function(a){return a?(uh=a,Re(),uh):uh},nf.ygrids.add=function(a){return a?nf.ygrids(uh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(uh.filter(b))},nf.regions=function(a){return c(a)?Ph:(Ph=a,Re(),Ph)},nf.regions.add=function(a){return c(a)?Ph:(Ph=Ph.concat(a),Re(),Ph)},nf.regions.remove=function(a,c){var e=[].concat(a);return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;Ei.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Ph=Ph.filter(function(b){return b.classes.indexOf(a)<0})}),Ph},nf.data.get=function(a){var b=nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},nf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a +});return b.length>0?b[0]:void 0},nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){kg[b]=a[b]}),gf(xc(nf.data.targets),{withTransition:!0}),kg):kg},nf.x=function(a){return arguments.length&&(mc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.xs=function(a){return arguments.length&&(nc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(_g=+a.y),b(a.y2)&&(ih=+a.y2)):_g=ih=+a,Re())},nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(ah=+a.y),b(a.y2)&&(jh=+a.y2)):ah=jh=+a,Re())},nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&nf.axis.max(a.max),"undefined"!=typeof a.min&&nf.axis.min(a.min))},nf.legend.show=function(a){Jg||(Jg=!0,Ii.style("visibility","visible")),ef(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.legend.hide=function(a){Jg&&me(a)&&(Jg=!1,Ii.style("visibility","hidden")),ff(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.resize=function(a){qf=a?a.width:null,rf=a?a.height:null,We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},nf.destroy=function(){nf.data.targets=void 0,nf.data.xs={},Ki.html(""),a.onresize=null},"url"in e.data)mf.csv(e.data.url,function(a,b){Ke(b)});else if("rows"in e.data)Ke(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ke(qc(e.data.columns))}return nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 82cdf8965ab6d8215fcc6b2ad6fbfc1695aa337b Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Thu, 10 Apr 2014 12:29:10 +0900 Subject: [PATCH 032/178] Add axis.x.utc option and use utc for x time format as default - #144 --- c3.js | 22 ++++++++++++---------- c3.min.js | 6 +++--- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/c3.js b/c3.js index 271288d..11588bd 100644 --- a/c3.js +++ b/c3.js @@ -163,6 +163,7 @@ // axis var __axis_rotated = getConfig(['axis', 'rotated'], false), __axis_x_type = getConfig(['axis', 'x', 'type'], 'indexed'), + __axis_x_utc = getConfig(['axis', 'x', 'utc'], true), __axis_x_categories = getConfig(['axis', 'x', 'categories'], []), __axis_x_tick_centered = getConfig(['axis', 'x', 'tick', 'centered'], false), __axis_x_tick_format = getConfig(['axis', 'x', 'tick', 'format']), @@ -281,16 +282,17 @@ var defaultColorPattern = ['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd', '#8c564b', '#e377c2', '#7f7f7f', '#bcbd22', '#17becf'], //same as d3.scale.category10() color = generateColor(__data_colors, notEmpty(__color_pattern) ? __color_pattern : defaultColorPattern, __data_color); - var defaultTimeFormat = (function () { + var xTimeFormat = __axis_x_utc ? d3.time.format.utc : d3.time.format, + defaultTimeFormat = (function () { var formats = [ - [d3.time.format("%Y/%-m/%-d"), function () { return true; }], - [d3.time.format("%-m/%-d"), function (d) { return d.getMonth(); }], - [d3.time.format("%-m/%-d"), function (d) { return d.getDate() !== 1; }], - [d3.time.format("%-m/%-d"), function (d) { return d.getDay() && d.getDate() !== 1; }], - [d3.time.format("%I %p"), function (d) { return d.getHours(); }], - [d3.time.format("%I:%M"), function (d) { return d.getMinutes(); }], - [d3.time.format(":%S"), function (d) { return d.getSeconds(); }], - [d3.time.format(".%L"), function (d) { return d.getMilliseconds(); }] + [xTimeFormat("%Y/%-m/%-d"), function () { return true; }], + [xTimeFormat("%-m/%-d"), function (d) { return d.getMonth(); }], + [xTimeFormat("%-m/%-d"), function (d) { return d.getDate() !== 1; }], + [xTimeFormat("%-m/%-d"), function (d) { return d.getDay() && d.getDate() !== 1; }], + [xTimeFormat("%I %p"), function (d) { return d.getHours(); }], + [xTimeFormat("%I:%M"), function (d) { return d.getMinutes(); }], + [xTimeFormat(":%S"), function (d) { return d.getSeconds(); }], + [xTimeFormat(".%L"), function (d) { return d.getMilliseconds(); }] ]; return function (date) { var i = formats.length - 1, f = formats[i]; @@ -641,7 +643,7 @@ if (typeof __axis_x_tick_format === 'function') { format = __axis_x_tick_format; } else if (isTimeSeries) { - format = function (date) { return d3.time.format(__axis_x_tick_format)(date); }; + format = function (date) { return xTimeFormat(__axis_x_tick_format)(date); }; } } return format; diff --git a/c3.min.js b/c3.min.js index 93fbf12..59fd804 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.29"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cDf&&(Df=0),0>Ff&&(Ff=0),Bf={top:Ng?Af.top:If-Hg-(si?0:a),right:0/0,bottom:20+(si?0:a),left:Ng?wi:Af.left},Ef=Ng?Af.left-wi-xi:Df,Gf=Ng?Ff:If-Bf.top-Bf.bottom,0>Ef&&(Ef=0),0>Gf&&(Gf=0),Cf={top:si?0:If-a,right:0/0,bottom:0,left:si?Hf-b:0},p(),si&&Yd(nf.data.targets)&&(Cf.left=Df/2+Kf)}function o(){Gi.select("line."+f.xgridFocus).attr("x1",Ng?0:-10).attr("x2",Ng?Df:-10).attr("y1",Ng?-10:Af.top).attr("y2",Ng?-10:Ff)}function p(){Kf=Ff/2,Jf=.95*Kf,Lf=Xd(nf.data.targets)?.6*Jf:0}function q(){var a=Ng?f.axisX:f.axisY,b=mf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=mf.select(pf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return qf?qf:x()}function s(){var a=rf?rf:y();return a>0?a:320}function t(){return Yd(nf.data.targets)?0:sf?sf:Ng||!$g||dh?1:v("y")}function u(){var a=1;return Yd(nf.data.targets)?0:tf?tf:si?P()+(hh&&!Ng?v("y2"):a):hh?mh||Ng?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||$g?"y2"!==a||hh?(gb(a).isInner?30:40)+("y2"===a?-10:0):yi:Jg&&!si?10:1}function x(){return+mf.select(pf).style("width").replace("px","")}function y(){return+mf.select(pf).style("height").replace("px","")}function z(a){return a?-5:-(Af.left-1)}function A(a){return a?-20:-1}function B(){return z(!Ng)}function C(){return A(!Ng)}function D(){return z(Ng)}function E(){return A(Ng)}function F(a){return a?Df+2+4:Af.left+20}function G(a){return a?80:Ff+2}function H(){return F(!Ng)}function I(){return G(!Ng)}function J(){return F(Ng)}function K(){return G(Ng)}function L(){var a=Ng?Ff:Df,b=vc(),c=Vb()*(Ud(nf.data.targets)?(b-(ci?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){ti=a}function N(a){ui=a}function O(a){vi=a}function P(){return Jg?si?ui*(ti+1):Hf:0}function Q(){return Jg?si?If:vi*(ti+1):0}function R(){var a,b=!Yf;Qf=Ng?1:0,Rf=Ng?Ff:Df,Sf=Ng?0:Ff,Tf=Ng?Df:1,Uf=Qf,Vf=Rf,Wf=Ng?0:Gf,Xf=Ng?Ef:1,Yf=T(Qf,Rf,b?void 0:Yf.domain(),function(){return cg.tickOffset()}),Zf=U(Sf,Tf),$f=U(Sf,Tf),_f=T(Qf,Rf,Li,function(a){return a%1?0:fg.tickOffset()}),ag=U(Wf,Xf),bg=U(Wf,Xf),a=$(),cg=X(Yf,ni,a),fg=X(_f,qi,a),dg=Y(Zf,oi,eh,gh),eg=Y($f,pi,nh,ph),b||(zi.scale(_f),uf&&Di.scale(Yf)),S()}function S(){Mf=Db(),Nf=Eb(),Of=Eb(.98)}function T(a,b,e,f){var g=(bi?mf.time.scale():mf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),ci){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return mf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?$f:Zf}function W(a){return"y2"===Z(a)?bg:ag}function X(a,b,c){var d=(ci?Bb():mf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),ci?d.tickCentered(Qg):d.tickOffset=function(){var a=Ng?Ff:Df;return a*Vb()/vc()/2},ci&&d.categories(Pg),d}function Y(a,b,c,d){return mf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in ng?ng[a]:"y"}function $(){var a=bi?ki:ci?Oc:function(a){return 0>a?a.toFixed(0):a};return Rg&&("function"==typeof Rg?a=Rg:bi&&(a=function(a){return mf.time.format(Rg)(a)})),a}function _(a){var b;return"y"===a?b=ch:"y2"===a?b=lh:"x"===a&&(b=Zg),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?ch=b:"y2"===a?lh=b:"x"===a&&(Zg=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Ng?"inner-top":"inner-right")}function eb(){return cb("y",Ng?"inner-right":"inner-top")}function fb(){return cb("y2",Ng?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?Df/2:Df:b.isBottom?-Ff:b.isMiddle?-Ff/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Ng,db())}function ob(){return kb(Ng,eb())}function pb(){return kb(Ng,fb())}function qb(){return lb(!Ng,db())}function rb(){return lb(Ng,eb())}function sb(){return lb(Ng,fb())}function tb(){var a=db();return Ng?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Ng?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Ng?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Ng,db())}function xb(){return mb(Ng,eb())}function yb(){return mb(Ng,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Gi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Gi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Gi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return mf.min(Object.keys(i).map(function(a){return mf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(mg.length>0)for(g=Nc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return mf.max(Object.keys(i).map(function(a){return mf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?jh:ah,n="y2"===c?ih:_g,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?kh:bh,r=pd()&&Ng;return 0===l.length?"y2"===c?$f.domain():Zf.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=qd(o,p),j=$b(Zf.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&fh&&(f=b(fh.top)?fh.top:e,g=b(fh.bottom)?fh.bottom:e),"y2"===c&&oh&&(f=b(oh.top)?oh.top:e,g=b(oh.bottom)?oh.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Li),c=$b(Yf.domain());return a||0===c?1:b/c}function Wb(a){return Xg?Xg:mf.min(a,function(a){return mf.min(a.values,function(a){return a.x})})}function Xb(a){return Wg?Wg:mf.max(a,function(a){return mf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return ci?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=bi?new Date(c.getTime()-e):c-e,g=bi?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return gg&&a===gg||ne(hg)&&oe(hg,a)}function fc(a){return!ec(a)}function gc(a){return gg?gg:ne(hg)?hg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=nf.data.xs[b])}),c}function ic(a,b){return a in nf.data.xs&&nf.data.xs[a]&&nf.data.xs[a][b]?nf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){hg[b]=a[b]})}function kc(a){return 1===mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=kg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),nf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=bi?a?a instanceof Date?a:ie(a):ie(ic(b,c)):di&&!ci?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):gg?(d=Object.keys(nf.data.xs),nf.data.xs[c]=d.length>0?nf.data.xs[d[0]]:void 0):ne(hg)&&(nf.data.xs[c]=hc(f,nf.data.targets)):nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=jg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return di&&ci&&0===c&&g&&(0===e&&(Pg=[]),Pg.push(g)),("undefined"==typeof a[b]||nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),og&&Sd(xc(c).filter(function(a){return!(a in pg)}),og),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function tc(a){return a>0&&nf.data.targets[0].values[a-1]?nf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?nf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?nf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(nf.data.targets)}function zc(a,b){var c,d=xc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(bi?new Date(h):h);i.push(d)}return i}function Gc(a){li=li.concat(a)}function Hc(a){li=li.filter(function(b){return a.indexOf(b)<0})}function Ic(a){mi=mi.concat(a)}function Jc(a){mi=mi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Ed(){return rg&&"desc"===rg.toLowerCase()}function Fd(){return rg&&"asc"===rg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof rg&&a.sort(rg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(nf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Qh&&0!==m.length&&(Ji.html(Th(a,$(),l,ji)).style("display","block"),d=Ji.property("offsetWidth"),e=Ji.property("offsetHeight"),k?(g=Df/2+c[0],i=Ff/2+c[1]+20):(Ng?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Yf(m[0].x)+20):(f=q(),g=f+t()+Yf(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Ji.style("top",i+"px").style("left",g+"px"))}function Id(){Ji.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Qh&&(Vd(nf.data.targets)||Yd(nf.data.targets)||Gi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Ng?"y1":"x1",ud).attr(Ng?"y2":"x2",ud))}function Kd(){Gi.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?Yf(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Ch?Ch:b?2*a.tickOffset()*Dh/b:0}function Sd(a,b){yc(a).forEach(function(a){Ni[a]=b===pg[a],pg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){pg[a.id]===b&&(c=!0),a.id in pg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in pg)||"line"===pg[b]||"spline"===pg[b]||"area"===pg[b]||"area-spline"===pg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===pg[b]||"area-spline"===pg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===pg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===pg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===pg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===pg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ie(b){var c;if(!b)throw Error(b+" can not be parsed as d3.time with format "+ig+". Maybe 'x' of this data is not defined. See data.x or data.xs option.");try{c=ig?mf.time.format(ig).parse(b):new Date(b)}catch(d){c=void 0}return c||a.console.error("Failed to parse x '"+b+"' to Date with format "+ig),c}function je(a,b){var c=mf.mouse(a),d=mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?Zf:$f,d=Ng?1:0,e=Ng?0:1;return Math.pow(Yf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Cg(b,a.node()),Gi.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md).attr("stroke",function(){return ji(b)}).attr("r",1.4*Bh).transition().duration(100).attr("r",Bh)}function se(a,b,c){Dg(b,a.node()),Gi.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Cg(b,a.node()),a.transition().duration(100).style("fill",function(){return mf.rgb(ji(b)).darker(1)})}function ve(a,b){Dg(b,a.node()),a.transition().duration(100).style("fill",function(){return ji(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Gi.selectAll("."+f.circles+gd(c)):Gi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",Ah)}function Ae(a){ye(a).filter(function(){return mf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",xh)}function Be(a){return Gi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Ng?1:0,f=Ng?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Ng?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBoundingClientRect();return Ng?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(cg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Ng&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Je(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function Ke(b){var c,d,e;if(Ki=mf.select(pf),Ki.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Ki.html(""),Ki.classed("c3",!0),nf.data.xs={},nf.data.targets=rc(b),n(),R(),Yf.domain(mf.extent(Zb(nf.data.targets))),Zf.domain(Ub(nf.data.targets,"y")),$f.domain(Ub(nf.data.targets,"y2")),_f.domain(Yf.domain()),ag.domain(Zf.domain()),bg.domain($f.domain()),Li=Yf.domain(),zi.scale(_f),uf&&Di.scale(Yf),Ei=Ki.append("svg").attr("width",Df+Af.left+Af.right).attr("height",Ff+Af.top+Af.bottom).on("mouseenter",xf).on("mouseleave",yf),Fi=Ei.append("defs"),Fi.append("clipPath").attr("id",Xh).append("rect").attr("width",Df).attr("height",Ff),Fi.append("clipPath").attr("id",Yh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Fi.append("clipPath").attr("id",Zh).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Gi=Ei.append("g").attr("transform",ri.main),Hi=Gg?Ei.append("g").attr("transform",ri.context):null,Ii=Ei.append("g").attr("transform",ri.legend),Jg||(Ii.style("visibility","hidden"),mi=xc(nf.data.targets)),Ji=mf.select(pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),gf(xc(nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Gi.append("g").attr("class",f.axisX).attr("clip-path",Ng?"":_h).attr("transform",ri.x).append("text").attr("class",f.axisXLabel).attr("transform",Ng?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),$g&&Gi.append("g").attr("class",f.axisY).attr("clip-path",Ng?ai:"").attr("transform",ri.y).append("text").attr("class",f.axisYLabel).attr("transform",Ng?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),hh&&Gi.append("g").attr("class",f.axisY2).attr("transform",ri.y2).append("text").attr("class",f.axisY2Label).attr("transform",Ng?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Gi.append("g").attr("clip-path",$h).attr("class",f.grid),qh&&d.append("g").attr("class",f.xgrids),ne(sh)&&d.append("g").attr("class",f.xgridLines),yh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),th&&d.append("g").attr("class",f.ygrids),ne(uh)&&d.append("g").attr("class",f.ygridLines),Gi.append("g").attr("clip-path",$h).attr("class",f.regions),Gi.append("g").attr("clip-path",$h).attr("class",f.chart),c=Gi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",uf?Ng?"ns-resize":"ew-resize":null),Gi.select("."+f.chart).append("g").attr("class",f.chartBars),Gi.select("."+f.chart).append("g").attr("class",f.chartLines),Gi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",ri.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Gi.select("."+f.chart).append("g").attr("class",f.chartTexts),uf&&Gi.insert("rect",wf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Df).attr("height",Ff).style("opacity",0).style("cursor",Ng?"ns-resize":"ew-resize").call(Di).on("dblclick.zoom",null),Yg&&zi.extent("function"!=typeof Yg?Yg:Yg(Zb())),Gg&&(Hi.append("g").attr("clip-path",$h).attr("class",f.chart),Hi.select("."+f.chart).append("g").attr("class",f.chartBars),Hi.select("."+f.chart).append("g").attr("class",f.chartLines),Hi.append("g").attr("clip-path",$h).attr("class",f.brush).call(zi).selectAll("rect").attr(Ng?"width":"height",Ng?Ef:Gf),Hi.append("g").attr("class",f.axisX).attr("transform",ri.subx).attr("clip-path",Ng?"":_h)),Xe(nf.data.targets),Ng?Gi.select("."+f.axisX).style("opacity",0).call(cg):(Gi.select("."+f.axisY).style("opacity",0).call(dg),Gi.select("."+f.axisY2).style("opacity",0).call(eg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Uh){if(bi&&"string"==typeof Vh){for(Vh=ie(Vh),e=0;e0){d=[];for(var g in kg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function Pe(a){Yd(nf.data.targets)||vg&&(ei=a,Gi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),fi=!0,Eg())}function Qe(){Yd(nf.data.targets)||vg&&(Gi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Gi.selectAll("."+f.shape).classed(f.INCLUDED,!1),fi=!1,Fg())}function Re(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Nd(),U=Yd(nf.data.targets),V=Dc(nf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?zf:0,O=B?N:0,P=C?N:0,H&&Jg&&gf(xc(nf.data.targets),a),G&&(Yf.domain(mf.extent(Zb(V))),Li=Yf.domain(),uf&&Di.scale(Yf).updateScaleExtent(),_f.domain(Yf.domain()),zi.scale(_f)),F&&(Yf.domain(zi.empty()?Li:zi.extent()),uf&&Di.scale(Yf).updateScaleExtent()),Zf.domain(Ub(V,"y")),$f.domain(Ub(V,"y2")),Vd(V)||(Q=Fc(Ec(V)).sort(),cg.tickValues(Q),fg.tickValues(Q)),c=Gi.select("."+f.axisX).style("opacity",U?0:1),(Ng||D)&&(c=c.transition().duration(P)),c.call(cg),e=Gi.select("."+f.axisY).style("opacity",U?0:1),(!Ng||D)&&(e=e.transition().duration(P)),e.call(dg),Gi.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(eg),F&&Sg&&Q){for(R=1;R=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=Yf.ticks(10);g=Gi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Ng?0:function(a){return Yf(a)-cg.tickOffset()}).attr("x2",Ng?Df:function(a){return Yf(a)-cg.tickOffset()}).attr("y1",Ng?function(a){return Yf(a)-cg.tickOffset()}:Af.top).attr("y2",Ng?function(a){return Yf(a)-cg.tickOffset()}:Ff).style("opacity",function(){return+mf.select(this).attr(Ng?"y1":"x1")===(Ng?Ff:0)?0:1}),g.exit().remove()}ne(sh)&&(i=Gi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(sh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Ng?"":"rotate(-90)").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Ng?0:vd).attr("x2",Ng?Df:vd).attr("y1",Ng?vd:Af.top).attr("y2",Ng?vd:Ff).style("opacity",1),i.select("text").transition().duration(N).attr("x",Ng?Df:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&th&&(k=Gi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Zf.ticks(vh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Ng?Zf:0).attr("x2",Ng?Zf:Df).attr("y1",Ng?0:Zf).attr("y2",Ng?Ff:Zf),k.exit().remove()),y&&ne(uh)&&(l=Gi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(uh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Ng?"rotate(-90)":"").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Ng?wd:0).attr("x2",Ng?wd:Df).attr("y1",Ng?0:wd).attr("y2",Ng?Ff:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Ng?0:Df).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Gi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ji(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Gi.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Ng?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Gi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ai).style("opacity",1),Gi.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Bi).style("opacity",Mi),n=Gi.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",xh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),n.exit().remove(),Gi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=mf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Gi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Gi.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Gg&&(null!==mf.event&&"zoom"===mf.event.type&&zi.extent(Yf.orgDomain()).update(),z&&(Hi.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(fg),zi.empty()||zi.extent(Yf.orgDomain()).update(),J=Ee(T,!0),s=Hi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ji(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Hi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ci).style("opacity",1))),Gi.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Gi.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),t=Gi.select("."+f.eventRects),ne(hg)&&!kc(hg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Gi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Df).attr("height",Ff)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),di&&!ci?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return(Yf(d?d:e+50)-Yf(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return(Yf(d)+Yf(c?c:d-50))/2}):(x=L(),w=function(a){return Yf(a.x)-x/2}),v=wc(),Gi.select("."+f.eventRects).datum(v?v.values:[]),u=Gi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Ng?0:w).attr("y",Ng?w:0).attr("width",Ng?Df:x).attr("height",Ng?x:Ff),u.exit().remove()),q=Gi.select("."+f.regions).selectAll("rect."+f.region).data(Ph),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Ng?0:cc).attr("y",Ng?cc:Af.top).attr("width",Ng?Df:dc).attr("height",Ng?dc:Ff).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),xc(nf.data.targets).forEach(function(a){Ni[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Di.altDomain?(Yf.domain(Di.altDomain),void Di.scale(Yf).updateScaleExtent()):(ci&&Yf.orgDomain()[0]===Li[0]&&Yf.domain([Li[0]-1e-10,Yf.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(gi=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Ei.attr("width",Hf).attr("height",If),Ei.select("#"+Xh).select("rect").attr("width",Df).attr("height",Ff),Ei.select("#"+Yh).select("rect").attr("width",H),Ei.select("#"+Zh).select("rect").attr("width",J),Ei.select("."+f.zoomRect).attr("width",Df).attr("height",Ff)}function We(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Gi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ji(a)}),e=Gi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ji(a)}).style("stroke","none").style("cursor",function(a){return xg(a)?"pointer":null}),c=Gi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ji(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Mi=+mf.select(this).style("opacity"),0}).style("fill",function(a){return ji(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ji(a)}).style("cursor",function(a){return xg(a)?"pointer":null}),a.forEach(function(a){Gi.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Gi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Pf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ji(a.data)}).style("cursor",function(a){return xg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Gg&&(n=Hi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ji(a)}),l=Hi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ji(a)})),Ei.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=si?j:i,l=si?Q():P();return d&&(w=0,C=0,t=0,u=0),Jg&&!Cc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=si?u:t,void(Mg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,si?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Ii.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Lg?Lg(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",si?g:-200).attr("y",si?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",si?h:-200).attr("y",si?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return ji(a)}).attr("x",si?g:-200).attr("y",si?-200:i).attr("width",10).attr("height",10),Ii.selectAll("text").data(a).text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ii.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ii.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["transition","duration"],350);g("data","data is required in config");var Af,Bf,Cf,Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg=h(["data","x"]),hg=h(["data","xs"],{}),ig=h(["data","x_format"]),jg=h(["data","id_converter"],function(a){return a}),kg=h(["data","names"],{}),lg=h(["data","classes"],{}),mg=h(["data","groups"],[]),ng=h(["data","axes"],{}),og=h(["data","type"]),pg=h(["data","types"],{}),qg=h(["data","labels"],{}),rg=h(["data","order"]),sg=h(["data","regions"],{}),tg=h(["data","color"]),ug=h(["data","colors"],{}),vg=h(["data","selection","enabled"],!1),wg=h(["data","selection","grouped"],!1),xg=h(["data","selection","isselectable"],function(){return!0}),yg=h(["data","selection","multiple"],!0),zg=h(["data","onclick"],function(){}),Ag=h(["data","onenter"],function(){}),Bg=h(["data","onleave"],function(){}),Cg=h(["data","onselected"],function(){}),Dg=h(["data","onunselected"],function(){}),Eg=h(["data","ondragstart"],function(){}),Fg=h(["data","ondragend"],function(){}),Gg=h(["subchart","show"],!1),Hg=Gg?h(["subchart","size","height"],60):0,Ig=h(["color","pattern"],[]),Jg=h(["legend","show"],!0),Kg=h(["legend","position"],"bottom"),Lg=h(["legend","item","onclick"]),Mg=h(["legend","equally"],!1),Ng=h(["axis","rotated"],!1),Og=h(["axis","x","type"],"indexed"),Pg=h(["axis","x","categories"],[]),Qg=h(["axis","x","tick","centered"],!1),Rg=h(["axis","x","tick","format"]),Sg=h(["axis","x","tick","culling"],{}),Tg=h(["axis","x","tick","culling","max"],"categorized"===Og?1/0:10),Ug=h(["axis","x","tick","count"]),Vg=h(["axis","x","tick","fit"],!1),Wg=h(["axis","x","max"]),Xg=h(["axis","x","min"]),Yg=h(["axis","x","default"]),Zg=h(["axis","x","label"],{}),$g=h(["axis","y","show"],!0),_g=h(["axis","y","max"]),ah=h(["axis","y","min"]),bh=h(["axis","y","center"]),ch=h(["axis","y","label"],{}),dh=h(["axis","y","inner"],!1),eh=h(["axis","y","tick","format"]),fh=h(["axis","y","padding"],{}),gh=h(["axis","y","ticks"],10),hh=h(["axis","y2","show"],!1),ih=h(["axis","y2","max"]),jh=h(["axis","y2","min"]),kh=h(["axis","y2","center"]),lh=h(["axis","y2","label"],{}),mh=h(["axis","y2","inner"],!1),nh=h(["axis","y2","tick","format"]),oh=h(["axis","y2","padding"],{}),ph=h(["axis","y2","ticks"],10),qh=h(["grid","x","show"],!1),rh=h(["grid","x","type"],"tick"),sh=h(["grid","x","lines"],[]),th=h(["grid","y","show"],!1),uh=h(["grid","y","lines"],[]),vh=h(["grid","y","ticks"],10),wh=h(["point","show"],!0),xh=wh?h(["point","r"],2.5):0,yh=h(["point","focus","line","enabled"],!0),zh=h(["point","focus","expand","enabled"],!0),Ah=h(["point","focus","expand","r"],zh?4:xh),Bh=h(["point","focus","select","r"],8),Ch=h(["bar","width"]),Dh=h(["bar","width","ratio"],.6),Eh=h(["pie","label","show"],!0),Fh=h(["pie","label","format"]),Gh=h(["pie","onclick"],function(){}),Hh=h(["pie","onmouseover"],function(){}),Ih=h(["pie","onmouseout"],function(){}),Jh=h(["donut","label","show"],!0),Kh=h(["donut","label","format"]),Lh=h(["donut","title"],""),Mh=h(["donut","onclick"],function(){}),Nh=h(["donut","onmouseover"],function(){}),Oh=h(["donut","onmouseout"],function(){}),Ph=h(["regions"],[]),Qh=h(["tooltip","show"],!0),Rh=h(["tooltip","format","title"]),Sh=h(["tooltip","format","value"]),Th=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Rh?Rh:b,l=Sh?Sh:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Uh=h(["tooltip","init","show"],!1),Vh=h(["tooltip","init","x"],0),Wh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Xh=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",Yh=Xh+"-xaxis",Zh=Xh+"-yaxis",$h=i(Xh),_h=i(Yh),ai=i(Zh),bi="timeseries"===Og,ci="categorized"===Og,di=!bi&&(gg||ne(hg)),ei=null,fi=!1,gi=!1,hi=!1,ii=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ji=he(ug,ne(Ig)?Ig:ii,tg),ki=function(){var a=[[mf.time.format("%Y/%-m/%-d"),function(){return!0}],[mf.time.format("%-m/%-d"),function(a){return a.getMonth()}],[mf.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[mf.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[mf.time.format("%I %p"),function(a){return a.getHours()}],[mf.time.format("%I:%M"),function(a){return a.getMinutes()}],[mf.time.format(":%S"),function(a){return a.getSeconds()}],[mf.time.format(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),li=[],mi=[],ni=Ng?"left":"bottom",oi=Ng?dh?"top":"bottom":dh?"right":"left",pi=Ng?mh?"bottom":"top":mh?"left":"right",qi=Ng?"left":"bottom",ri={main:function(){return"translate("+Af.left+","+Af.top+")"},context:function(){return"translate("+Bf.left+","+Bf.top+")"},legend:function(){return"translate("+Cf.left+","+Cf.top+")"},x:function(){return"translate(0,"+(Ng?0:Ff)+")"},y:function(){return"translate(0,"+(Ng?Ff:0)+")"},y2:function(){return"translate("+(Ng?0:Df)+","+(Ng?1:0)+")"},subx:function(){return"translate(0,"+(Ng?0:Gf)+")"},arc:function(){return"translate("+Df/2+","+Ff/2+")"}},si="right"===Kg,ti=0,ui=0,vi=0,wi=30,xi=30,yi=5;Pf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var zi,Ai=function(){var a=mf.svg.line().x(Ng?function(a){return V(a.id)(a.value)}:ud).y(Ng?ud:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=xe(b.values);return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),sg[b.id]?Je(e,Yf,V(b.id),sg[b.id]):a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Bi=function(){var a;return a=Ng?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Ci=function(){var a=mf.svg.line().x(Ng?function(a){return W(a.id)(a.value)}:xd).y(Ng?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+_f(c[0].x)+" "+W(b.id)(c[0].value)}}(),Di=function(){};zi=mf.svg.brush().on("brush",Se),zi.update=function(){return Hi&&Hi.select("."+f.brush).call(this),this},zi.scale=function(a){return Ng?this.y(a):this.x(a)},uf&&(Di=mf.behavior.zoom().on("zoomstart",function(){Di.altDomain=mf.event.sourceEvent.altKey?Yf.orgDomain():null}).on("zoom",uf?Te:null),Di.scale=function(a){return Ng?this.y(a):this.x(a)},Di.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Di.updateScaleExtent=function(){var a=$b(Yf.orgDomain())/$b(Li),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Ei,Fi,Gi,Hi,Ii,Ji,Ki,Li,Mi,Ni={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ei.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Ei.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Ii.selectAll(kd(a)).classed(f.legendItemHidden,!1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Ei.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Ii.selectAll(kd(a)).classed(f.legendItemHidden,!0),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){zi.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){lg[b]=a.classes[b]}),"categories"in a&&ci&&(Pg=a.categories,cg.categories(Pg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Gi.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){vg&&Gi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=wg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?xg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){vg&&Gi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=wg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&xg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?mg:(mg=a,Re(),mg)},nf.xgrids=function(a){return a?(sh=a,Re(),sh):sh},nf.xgrids.add=function(a){return a?nf.xgrids(sh.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(sh.filter(b))},nf.ygrids=function(a){return a?(uh=a,Re(),uh):uh},nf.ygrids.add=function(a){return a?nf.ygrids(uh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(uh.filter(b))},nf.regions=function(a){return c(a)?Ph:(Ph=a,Re(),Ph)},nf.regions.add=function(a){return c(a)?Ph:(Ph=Ph.concat(a),Re(),Ph)},nf.regions.remove=function(a,c){var e=[].concat(a);return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;Ei.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Ph=Ph.filter(function(b){return b.classes.indexOf(a)<0})}),Ph},nf.data.get=function(a){var b=nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},nf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a -});return b.length>0?b[0]:void 0},nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){kg[b]=a[b]}),gf(xc(nf.data.targets),{withTransition:!0}),kg):kg},nf.x=function(a){return arguments.length&&(mc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.xs=function(a){return arguments.length&&(nc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(_g=+a.y),b(a.y2)&&(ih=+a.y2)):_g=ih=+a,Re())},nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(ah=+a.y),b(a.y2)&&(jh=+a.y2)):ah=jh=+a,Re())},nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&nf.axis.max(a.max),"undefined"!=typeof a.min&&nf.axis.min(a.min))},nf.legend.show=function(a){Jg||(Jg=!0,Ii.style("visibility","visible")),ef(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.legend.hide=function(a){Jg&&me(a)&&(Jg=!1,Ii.style("visibility","hidden")),ff(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.resize=function(a){qf=a?a.width:null,rf=a?a.height:null,We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},nf.destroy=function(){nf.data.targets=void 0,nf.data.xs={},Ki.html(""),a.onresize=null},"url"in e.data)mf.csv(e.data.url,function(a,b){Ke(b)});else if("rows"in e.data)Ke(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ke(qc(e.data.columns))}return nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file +!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.29"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cDf&&(Df=0),0>Ff&&(Ff=0),Bf={top:Ng?Af.top:If-Hg-(ui?0:a),right:0/0,bottom:20+(ui?0:a),left:Ng?yi:Af.left},Ef=Ng?Af.left-yi-zi:Df,Gf=Ng?Ff:If-Bf.top-Bf.bottom,0>Ef&&(Ef=0),0>Gf&&(Gf=0),Cf={top:ui?0:If-a,right:0/0,bottom:0,left:ui?Hf-b:0},p(),ui&&Yd(nf.data.targets)&&(Cf.left=Df/2+Kf)}function o(){Ii.select("line."+f.xgridFocus).attr("x1",Ng?0:-10).attr("x2",Ng?Df:-10).attr("y1",Ng?-10:Af.top).attr("y2",Ng?-10:Ff)}function p(){Kf=Ff/2,Jf=.95*Kf,Lf=Xd(nf.data.targets)?.6*Jf:0}function q(){var a=Ng?f.axisX:f.axisY,b=mf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=mf.select(pf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return qf?qf:x()}function s(){var a=rf?rf:y();return a>0?a:320}function t(){return Yd(nf.data.targets)?0:sf?sf:Ng||!_g||eh?1:v("y")}function u(){var a=1;return Yd(nf.data.targets)?0:tf?tf:ui?P()+(ih&&!Ng?v("y2"):a):ih?nh||Ng?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||_g?"y2"!==a||ih?(gb(a).isInner?30:40)+("y2"===a?-10:0):Ai:Jg&&!ui?10:1}function x(){return+mf.select(pf).style("width").replace("px","")}function y(){return+mf.select(pf).style("height").replace("px","")}function z(a){return a?-5:-(Af.left-1)}function A(a){return a?-20:-1}function B(){return z(!Ng)}function C(){return A(!Ng)}function D(){return z(Ng)}function E(){return A(Ng)}function F(a){return a?Df+2+4:Af.left+20}function G(a){return a?80:Ff+2}function H(){return F(!Ng)}function I(){return G(!Ng)}function J(){return F(Ng)}function K(){return G(Ng)}function L(){var a=Ng?Ff:Df,b=vc(),c=Vb()*(Ud(nf.data.targets)?(b-(di?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){vi=a}function N(a){wi=a}function O(a){xi=a}function P(){return Jg?ui?wi*(vi+1):Hf:0}function Q(){return Jg?ui?If:xi*(vi+1):0}function R(){var a,b=!Yf;Qf=Ng?1:0,Rf=Ng?Ff:Df,Sf=Ng?0:Ff,Tf=Ng?Df:1,Uf=Qf,Vf=Rf,Wf=Ng?0:Gf,Xf=Ng?Ef:1,Yf=T(Qf,Rf,b?void 0:Yf.domain(),function(){return cg.tickOffset()}),Zf=U(Sf,Tf),$f=U(Sf,Tf),_f=T(Qf,Rf,Ni,function(a){return a%1?0:fg.tickOffset()}),ag=U(Wf,Xf),bg=U(Wf,Xf),a=$(),cg=X(Yf,pi,a),fg=X(_f,si,a),dg=Y(Zf,qi,fh,hh),eg=Y($f,ri,oh,qh),b||(Bi.scale(_f),uf&&Fi.scale(Yf)),S()}function S(){Mf=Db(),Nf=Eb(),Of=Eb(.98)}function T(a,b,e,f){var g=(ci?mf.time.scale():mf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),di){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return mf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?$f:Zf}function W(a){return"y2"===Z(a)?bg:ag}function X(a,b,c){var d=(di?Bb():mf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),di?d.tickCentered(Rg):d.tickOffset=function(){var a=Ng?Ff:Df;return a*Vb()/vc()/2},di&&d.categories(Qg),d}function Y(a,b,c,d){return mf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in ng?ng[a]:"y"}function $(){var a=ci?mi:di?Oc:function(a){return 0>a?a.toFixed(0):a};return Sg&&("function"==typeof Sg?a=Sg:ci&&(a=function(a){return li(Sg)(a)})),a}function _(a){var b;return"y"===a?b=dh:"y2"===a?b=mh:"x"===a&&(b=$g),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?dh=b:"y2"===a?mh=b:"x"===a&&($g=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Ng?"inner-top":"inner-right")}function eb(){return cb("y",Ng?"inner-right":"inner-top")}function fb(){return cb("y2",Ng?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?Df/2:Df:b.isBottom?-Ff:b.isMiddle?-Ff/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Ng,db())}function ob(){return kb(Ng,eb())}function pb(){return kb(Ng,fb())}function qb(){return lb(!Ng,db())}function rb(){return lb(Ng,eb())}function sb(){return lb(Ng,fb())}function tb(){var a=db();return Ng?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Ng?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Ng?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Ng,db())}function xb(){return mb(Ng,eb())}function yb(){return mb(Ng,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Ii.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Ii.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Ii.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return mf.min(Object.keys(i).map(function(a){return mf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(mg.length>0)for(g=Nc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return mf.max(Object.keys(i).map(function(a){return mf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?kh:bh,n="y2"===c?jh:ah,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?lh:ch,r=pd()&&Ng;return 0===l.length?"y2"===c?$f.domain():Zf.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=qd(o,p),j=$b(Zf.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&gh&&(f=b(gh.top)?gh.top:e,g=b(gh.bottom)?gh.bottom:e),"y2"===c&&ph&&(f=b(ph.top)?ph.top:e,g=b(ph.bottom)?ph.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Ni),c=$b(Yf.domain());return a||0===c?1:b/c}function Wb(a){return Yg?Yg:mf.min(a,function(a){return mf.min(a.values,function(a){return a.x})})}function Xb(a){return Xg?Xg:mf.max(a,function(a){return mf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return di?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=ci?new Date(c.getTime()-e):c-e,g=ci?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return gg&&a===gg||ne(hg)&&oe(hg,a)}function fc(a){return!ec(a)}function gc(a){return gg?gg:ne(hg)?hg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=nf.data.xs[b])}),c}function ic(a,b){return a in nf.data.xs&&nf.data.xs[a]&&nf.data.xs[a][b]?nf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){hg[b]=a[b]})}function kc(a){return 1===mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=kg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),nf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=ci?a?a instanceof Date?a:ie(a):ie(ic(b,c)):ei&&!di?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):gg?(d=Object.keys(nf.data.xs),nf.data.xs[c]=d.length>0?nf.data.xs[d[0]]:void 0):ne(hg)&&(nf.data.xs[c]=hc(f,nf.data.targets)):nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=jg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return ei&&di&&0===c&&g&&(0===e&&(Qg=[]),Qg.push(g)),("undefined"==typeof a[b]||nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),og&&Sd(xc(c).filter(function(a){return!(a in pg)}),og),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function tc(a){return a>0&&nf.data.targets[0].values[a-1]?nf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?nf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?nf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(nf.data.targets)}function zc(a,b){var c,d=xc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(ci?new Date(h):h);i.push(d)}return i}function Gc(a){ni=ni.concat(a)}function Hc(a){ni=ni.filter(function(b){return a.indexOf(b)<0})}function Ic(a){oi=oi.concat(a)}function Jc(a){oi=oi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Ed(){return rg&&"desc"===rg.toLowerCase()}function Fd(){return rg&&"asc"===rg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof rg&&a.sort(rg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(nf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Rh&&0!==m.length&&(Li.html(Uh(a,$(),l,ki)).style("display","block"),d=Li.property("offsetWidth"),e=Li.property("offsetHeight"),k?(g=Df/2+c[0],i=Ff/2+c[1]+20):(Ng?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Yf(m[0].x)+20):(f=q(),g=f+t()+Yf(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Li.style("top",i+"px").style("left",g+"px"))}function Id(){Li.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Rh&&(Vd(nf.data.targets)||Yd(nf.data.targets)||Ii.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Ng?"y1":"x1",ud).attr(Ng?"y2":"x2",ud))}function Kd(){Ii.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?Yf(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Dh?Dh:b?2*a.tickOffset()*Eh/b:0}function Sd(a,b){yc(a).forEach(function(a){Pi[a]=b===pg[a],pg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){pg[a.id]===b&&(c=!0),a.id in pg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in pg)||"line"===pg[b]||"spline"===pg[b]||"area"===pg[b]||"area-spline"===pg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===pg[b]||"area-spline"===pg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===pg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===pg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===pg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===pg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ie(b){var c;if(!b)throw Error(b+" can not be parsed as d3.time with format "+ig+". Maybe 'x' of this data is not defined. See data.x or data.xs option.");try{c=ig?mf.time.format(ig).parse(b):new Date(b)}catch(d){c=void 0}return c||a.console.error("Failed to parse x '"+b+"' to Date with format "+ig),c}function je(a,b){var c=mf.mouse(a),d=mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?Zf:$f,d=Ng?1:0,e=Ng?0:1;return Math.pow(Yf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Cg(b,a.node()),Ii.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md).attr("stroke",function(){return ki(b)}).attr("r",1.4*Ch).transition().duration(100).attr("r",Ch)}function se(a,b,c){Dg(b,a.node()),Ii.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Cg(b,a.node()),a.transition().duration(100).style("fill",function(){return mf.rgb(ki(b)).darker(1)})}function ve(a,b){Dg(b,a.node()),a.transition().duration(100).style("fill",function(){return ki(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Ii.selectAll("."+f.circles+gd(c)):Ii).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",Bh)}function Ae(a){ye(a).filter(function(){return mf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",yh)}function Be(a){return Ii.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Ng?1:0,f=Ng?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Ng?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBoundingClientRect();return Ng?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(cg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Ng&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Je(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function Ke(b){var c,d,e;if(Mi=mf.select(pf),Mi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Mi.html(""),Mi.classed("c3",!0),nf.data.xs={},nf.data.targets=rc(b),n(),R(),Yf.domain(mf.extent(Zb(nf.data.targets))),Zf.domain(Ub(nf.data.targets,"y")),$f.domain(Ub(nf.data.targets,"y2")),_f.domain(Yf.domain()),ag.domain(Zf.domain()),bg.domain($f.domain()),Ni=Yf.domain(),Bi.scale(_f),uf&&Fi.scale(Yf),Gi=Mi.append("svg").attr("width",Df+Af.left+Af.right).attr("height",Ff+Af.top+Af.bottom).on("mouseenter",xf).on("mouseleave",yf),Hi=Gi.append("defs"),Hi.append("clipPath").attr("id",Yh).append("rect").attr("width",Df).attr("height",Ff),Hi.append("clipPath").attr("id",Zh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Hi.append("clipPath").attr("id",$h).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Ii=Gi.append("g").attr("transform",ti.main),Ji=Gg?Gi.append("g").attr("transform",ti.context):null,Ki=Gi.append("g").attr("transform",ti.legend),Jg||(Ki.style("visibility","hidden"),oi=xc(nf.data.targets)),Li=mf.select(pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),gf(xc(nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Ii.append("g").attr("class",f.axisX).attr("clip-path",Ng?"":ai).attr("transform",ti.x).append("text").attr("class",f.axisXLabel).attr("transform",Ng?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),_g&&Ii.append("g").attr("class",f.axisY).attr("clip-path",Ng?bi:"").attr("transform",ti.y).append("text").attr("class",f.axisYLabel).attr("transform",Ng?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),ih&&Ii.append("g").attr("class",f.axisY2).attr("transform",ti.y2).append("text").attr("class",f.axisY2Label).attr("transform",Ng?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Ii.append("g").attr("clip-path",_h).attr("class",f.grid),rh&&d.append("g").attr("class",f.xgrids),ne(th)&&d.append("g").attr("class",f.xgridLines),zh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),uh&&d.append("g").attr("class",f.ygrids),ne(vh)&&d.append("g").attr("class",f.ygridLines),Ii.append("g").attr("clip-path",_h).attr("class",f.regions),Ii.append("g").attr("clip-path",_h).attr("class",f.chart),c=Ii.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",uf?Ng?"ns-resize":"ew-resize":null),Ii.select("."+f.chart).append("g").attr("class",f.chartBars),Ii.select("."+f.chart).append("g").attr("class",f.chartLines),Ii.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",ti.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Ii.select("."+f.chart).append("g").attr("class",f.chartTexts),uf&&Ii.insert("rect",wf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Df).attr("height",Ff).style("opacity",0).style("cursor",Ng?"ns-resize":"ew-resize").call(Fi).on("dblclick.zoom",null),Zg&&Bi.extent("function"!=typeof Zg?Zg:Zg(Zb())),Gg&&(Ji.append("g").attr("clip-path",_h).attr("class",f.chart),Ji.select("."+f.chart).append("g").attr("class",f.chartBars),Ji.select("."+f.chart).append("g").attr("class",f.chartLines),Ji.append("g").attr("clip-path",_h).attr("class",f.brush).call(Bi).selectAll("rect").attr(Ng?"width":"height",Ng?Ef:Gf),Ji.append("g").attr("class",f.axisX).attr("transform",ti.subx).attr("clip-path",Ng?"":ai)),Xe(nf.data.targets),Ng?Ii.select("."+f.axisX).style("opacity",0).call(cg):(Ii.select("."+f.axisY).style("opacity",0).call(dg),Ii.select("."+f.axisY2).style("opacity",0).call(eg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Vh){if(ci&&"string"==typeof Wh){for(Wh=ie(Wh),e=0;e0){d=[];for(var g in kg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function Pe(a){Yd(nf.data.targets)||vg&&(fi=a,Ii.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),gi=!0,Eg())}function Qe(){Yd(nf.data.targets)||vg&&(Ii.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Ii.selectAll("."+f.shape).classed(f.INCLUDED,!1),gi=!1,Fg())}function Re(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Nd(),U=Yd(nf.data.targets),V=Dc(nf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?zf:0,O=B?N:0,P=C?N:0,H&&Jg&&gf(xc(nf.data.targets),a),G&&(Yf.domain(mf.extent(Zb(V))),Ni=Yf.domain(),uf&&Fi.scale(Yf).updateScaleExtent(),_f.domain(Yf.domain()),Bi.scale(_f)),F&&(Yf.domain(Bi.empty()?Ni:Bi.extent()),uf&&Fi.scale(Yf).updateScaleExtent()),Zf.domain(Ub(V,"y")),$f.domain(Ub(V,"y2")),Vd(V)||(Q=Fc(Ec(V)).sort(),cg.tickValues(Q),fg.tickValues(Q)),c=Ii.select("."+f.axisX).style("opacity",U?0:1),(Ng||D)&&(c=c.transition().duration(P)),c.call(cg),e=Ii.select("."+f.axisY).style("opacity",U?0:1),(!Ng||D)&&(e=e.transition().duration(P)),e.call(dg),Ii.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(eg),F&&Tg&&Q){for(R=1;R=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=Yf.ticks(10);g=Ii.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Ng?0:function(a){return Yf(a)-cg.tickOffset()}).attr("x2",Ng?Df:function(a){return Yf(a)-cg.tickOffset()}).attr("y1",Ng?function(a){return Yf(a)-cg.tickOffset()}:Af.top).attr("y2",Ng?function(a){return Yf(a)-cg.tickOffset()}:Ff).style("opacity",function(){return+mf.select(this).attr(Ng?"y1":"x1")===(Ng?Ff:0)?0:1}),g.exit().remove()}ne(th)&&(i=Ii.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(th),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Ng?"":"rotate(-90)").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Ng?0:vd).attr("x2",Ng?Df:vd).attr("y1",Ng?vd:Af.top).attr("y2",Ng?vd:Ff).style("opacity",1),i.select("text").transition().duration(N).attr("x",Ng?Df:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&uh&&(k=Ii.select("."+f.ygrids).selectAll("."+f.ygrid).data(Zf.ticks(wh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Ng?Zf:0).attr("x2",Ng?Zf:Df).attr("y1",Ng?0:Zf).attr("y2",Ng?Ff:Zf),k.exit().remove()),y&&ne(vh)&&(l=Ii.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(vh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Ng?"rotate(-90)":"").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Ng?wd:0).attr("x2",Ng?wd:Df).attr("y1",Ng?0:wd).attr("y2",Ng?Ff:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Ng?0:Df).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Ii.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ki(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Ii.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Ng?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Ii.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ci).style("opacity",1),Ii.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Di).style("opacity",Oi),n=Ii.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",yh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),n.exit().remove(),Ii.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=mf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Ii.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Ii.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Gg&&(null!==mf.event&&"zoom"===mf.event.type&&Bi.extent(Yf.orgDomain()).update(),z&&(Ji.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(fg),Bi.empty()||Bi.extent(Yf.orgDomain()).update(),J=Ee(T,!0),s=Ji.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ki(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Ji.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ei).style("opacity",1))),Ii.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Ii.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),t=Ii.select("."+f.eventRects),ne(hg)&&!kc(hg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Ii.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Df).attr("height",Ff)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),ei&&!di?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return(Yf(d?d:e+50)-Yf(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return(Yf(d)+Yf(c?c:d-50))/2}):(x=L(),w=function(a){return Yf(a.x)-x/2}),v=wc(),Ii.select("."+f.eventRects).datum(v?v.values:[]),u=Ii.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Ng?0:w).attr("y",Ng?w:0).attr("width",Ng?Df:x).attr("height",Ng?x:Ff),u.exit().remove()),q=Ii.select("."+f.regions).selectAll("rect."+f.region).data(Qh),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Ng?0:cc).attr("y",Ng?cc:Af.top).attr("width",Ng?Df:dc).attr("height",Ng?dc:Ff).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),xc(nf.data.targets).forEach(function(a){Pi[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Fi.altDomain?(Yf.domain(Fi.altDomain),void Fi.scale(Yf).updateScaleExtent()):(di&&Yf.orgDomain()[0]===Ni[0]&&Yf.domain([Ni[0]-1e-10,Yf.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(hi=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Gi.attr("width",Hf).attr("height",If),Gi.select("#"+Yh).select("rect").attr("width",Df).attr("height",Ff),Gi.select("#"+Zh).select("rect").attr("width",H),Gi.select("#"+$h).select("rect").attr("width",J),Gi.select("."+f.zoomRect).attr("width",Df).attr("height",Ff)}function We(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Ii.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ki(a)}),e=Ii.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ki(a)}).style("stroke","none").style("cursor",function(a){return xg(a)?"pointer":null}),c=Ii.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ki(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Oi=+mf.select(this).style("opacity"),0}).style("fill",function(a){return ki(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ki(a)}).style("cursor",function(a){return xg(a)?"pointer":null}),a.forEach(function(a){Ii.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Ii.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Pf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ki(a.data)}).style("cursor",function(a){return xg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Gg&&(n=Ji.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ki(a)}),l=Ji.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ki(a)})),Gi.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=ui?j:i,l=ui?Q():P();return d&&(w=0,C=0,t=0,u=0),Jg&&!Cc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=ui?u:t,void(Mg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,ui?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Ki.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Lg?Lg(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",ui?g:-200).attr("y",ui?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",ui?h:-200).attr("y",ui?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return ki(a)}).attr("x",ui?g:-200).attr("y",ui?-200:i).attr("width",10).attr("height",10),Ki.selectAll("text").data(a).text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ki.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ki.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["transition","duration"],350);g("data","data is required in config");var Af,Bf,Cf,Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg=h(["data","x"]),hg=h(["data","xs"],{}),ig=h(["data","x_format"]),jg=h(["data","id_converter"],function(a){return a}),kg=h(["data","names"],{}),lg=h(["data","classes"],{}),mg=h(["data","groups"],[]),ng=h(["data","axes"],{}),og=h(["data","type"]),pg=h(["data","types"],{}),qg=h(["data","labels"],{}),rg=h(["data","order"]),sg=h(["data","regions"],{}),tg=h(["data","color"]),ug=h(["data","colors"],{}),vg=h(["data","selection","enabled"],!1),wg=h(["data","selection","grouped"],!1),xg=h(["data","selection","isselectable"],function(){return!0}),yg=h(["data","selection","multiple"],!0),zg=h(["data","onclick"],function(){}),Ag=h(["data","onenter"],function(){}),Bg=h(["data","onleave"],function(){}),Cg=h(["data","onselected"],function(){}),Dg=h(["data","onunselected"],function(){}),Eg=h(["data","ondragstart"],function(){}),Fg=h(["data","ondragend"],function(){}),Gg=h(["subchart","show"],!1),Hg=Gg?h(["subchart","size","height"],60):0,Ig=h(["color","pattern"],[]),Jg=h(["legend","show"],!0),Kg=h(["legend","position"],"bottom"),Lg=h(["legend","item","onclick"]),Mg=h(["legend","equally"],!1),Ng=h(["axis","rotated"],!1),Og=h(["axis","x","type"],"indexed"),Pg=h(["axis","x","utc"],!0),Qg=h(["axis","x","categories"],[]),Rg=h(["axis","x","tick","centered"],!1),Sg=h(["axis","x","tick","format"]),Tg=h(["axis","x","tick","culling"],{}),Ug=h(["axis","x","tick","culling","max"],"categorized"===Og?1/0:10),Vg=h(["axis","x","tick","count"]),Wg=h(["axis","x","tick","fit"],!1),Xg=h(["axis","x","max"]),Yg=h(["axis","x","min"]),Zg=h(["axis","x","default"]),$g=h(["axis","x","label"],{}),_g=h(["axis","y","show"],!0),ah=h(["axis","y","max"]),bh=h(["axis","y","min"]),ch=h(["axis","y","center"]),dh=h(["axis","y","label"],{}),eh=h(["axis","y","inner"],!1),fh=h(["axis","y","tick","format"]),gh=h(["axis","y","padding"],{}),hh=h(["axis","y","ticks"],10),ih=h(["axis","y2","show"],!1),jh=h(["axis","y2","max"]),kh=h(["axis","y2","min"]),lh=h(["axis","y2","center"]),mh=h(["axis","y2","label"],{}),nh=h(["axis","y2","inner"],!1),oh=h(["axis","y2","tick","format"]),ph=h(["axis","y2","padding"],{}),qh=h(["axis","y2","ticks"],10),rh=h(["grid","x","show"],!1),sh=h(["grid","x","type"],"tick"),th=h(["grid","x","lines"],[]),uh=h(["grid","y","show"],!1),vh=h(["grid","y","lines"],[]),wh=h(["grid","y","ticks"],10),xh=h(["point","show"],!0),yh=xh?h(["point","r"],2.5):0,zh=h(["point","focus","line","enabled"],!0),Ah=h(["point","focus","expand","enabled"],!0),Bh=h(["point","focus","expand","r"],Ah?4:yh),Ch=h(["point","focus","select","r"],8),Dh=h(["bar","width"]),Eh=h(["bar","width","ratio"],.6),Fh=h(["pie","label","show"],!0),Gh=h(["pie","label","format"]),Hh=h(["pie","onclick"],function(){}),Ih=h(["pie","onmouseover"],function(){}),Jh=h(["pie","onmouseout"],function(){}),Kh=h(["donut","label","show"],!0),Lh=h(["donut","label","format"]),Mh=h(["donut","title"],""),Nh=h(["donut","onclick"],function(){}),Oh=h(["donut","onmouseover"],function(){}),Ph=h(["donut","onmouseout"],function(){}),Qh=h(["regions"],[]),Rh=h(["tooltip","show"],!0),Sh=h(["tooltip","format","title"]),Th=h(["tooltip","format","value"]),Uh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Sh?Sh:b,l=Th?Th:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Vh=h(["tooltip","init","show"],!1),Wh=h(["tooltip","init","x"],0),Xh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Yh=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",Zh=Yh+"-xaxis",$h=Yh+"-yaxis",_h=i(Yh),ai=i(Zh),bi=i($h),ci="timeseries"===Og,di="categorized"===Og,ei=!ci&&(gg||ne(hg)),fi=null,gi=!1,hi=!1,ii=!1,ji=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ki=he(ug,ne(Ig)?Ig:ji,tg),li=Pg?mf.time.format.utc:mf.time.format,mi=function(){var a=[[li("%Y/%-m/%-d"),function(){return!0}],[li("%-m/%-d"),function(a){return a.getMonth()}],[li("%-m/%-d"),function(a){return 1!==a.getDate()}],[li("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[li("%I %p"),function(a){return a.getHours()}],[li("%I:%M"),function(a){return a.getMinutes()}],[li(":%S"),function(a){return a.getSeconds()}],[li(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),ni=[],oi=[],pi=Ng?"left":"bottom",qi=Ng?eh?"top":"bottom":eh?"right":"left",ri=Ng?nh?"bottom":"top":nh?"left":"right",si=Ng?"left":"bottom",ti={main:function(){return"translate("+Af.left+","+Af.top+")"},context:function(){return"translate("+Bf.left+","+Bf.top+")"},legend:function(){return"translate("+Cf.left+","+Cf.top+")"},x:function(){return"translate(0,"+(Ng?0:Ff)+")"},y:function(){return"translate(0,"+(Ng?Ff:0)+")"},y2:function(){return"translate("+(Ng?0:Df)+","+(Ng?1:0)+")"},subx:function(){return"translate(0,"+(Ng?0:Gf)+")"},arc:function(){return"translate("+Df/2+","+Ff/2+")"}},ui="right"===Kg,vi=0,wi=0,xi=0,yi=30,zi=30,Ai=5;Pf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Bi,Ci=function(){var a=mf.svg.line().x(Ng?function(a){return V(a.id)(a.value)}:ud).y(Ng?ud:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=xe(b.values);return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),sg[b.id]?Je(e,Yf,V(b.id),sg[b.id]):a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Di=function(){var a;return a=Ng?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Ei=function(){var a=mf.svg.line().x(Ng?function(a){return W(a.id)(a.value)}:xd).y(Ng?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+_f(c[0].x)+" "+W(b.id)(c[0].value)}}(),Fi=function(){};Bi=mf.svg.brush().on("brush",Se),Bi.update=function(){return Ji&&Ji.select("."+f.brush).call(this),this},Bi.scale=function(a){return Ng?this.y(a):this.x(a)},uf&&(Fi=mf.behavior.zoom().on("zoomstart",function(){Fi.altDomain=mf.event.sourceEvent.altKey?Yf.orgDomain():null}).on("zoom",uf?Te:null),Fi.scale=function(a){return Ng?this.y(a):this.x(a)},Fi.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Fi.updateScaleExtent=function(){var a=$b(Yf.orgDomain())/$b(Ni),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Gi,Hi,Ii,Ji,Ki,Li,Mi,Ni,Oi,Pi={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Gi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Gi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Gi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Gi.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Ki.selectAll(kd(a)).classed(f.legendItemHidden,!1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Gi.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Ki.selectAll(kd(a)).classed(f.legendItemHidden,!0),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){Bi.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){lg[b]=a.classes[b]}),"categories"in a&&di&&(Qg=a.categories,cg.categories(Qg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Ii.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){vg&&Ii.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=wg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?xg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){vg&&Ii.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=wg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&xg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?mg:(mg=a,Re(),mg)},nf.xgrids=function(a){return a?(th=a,Re(),th):th},nf.xgrids.add=function(a){return a?nf.xgrids(th.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(th.filter(b))},nf.ygrids=function(a){return a?(vh=a,Re(),vh):vh},nf.ygrids.add=function(a){return a?nf.ygrids(vh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(vh.filter(b))},nf.regions=function(a){return c(a)?Qh:(Qh=a,Re(),Qh)},nf.regions.add=function(a){return c(a)?Qh:(Qh=Qh.concat(a),Re(),Qh)},nf.regions.remove=function(a,c){var e=[].concat(a);return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;Gi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Qh=Qh.filter(function(b){return b.classes.indexOf(a)<0})}),Qh},nf.data.get=function(a){var b=nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},nf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0 +},nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){kg[b]=a[b]}),gf(xc(nf.data.targets),{withTransition:!0}),kg):kg},nf.x=function(a){return arguments.length&&(mc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.xs=function(a){return arguments.length&&(nc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(ah=+a.y),b(a.y2)&&(jh=+a.y2)):ah=jh=+a,Re())},nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(bh=+a.y),b(a.y2)&&(kh=+a.y2)):bh=kh=+a,Re())},nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&nf.axis.max(a.max),"undefined"!=typeof a.min&&nf.axis.min(a.min))},nf.legend.show=function(a){Jg||(Jg=!0,Ki.style("visibility","visible")),ef(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.legend.hide=function(a){Jg&&me(a)&&(Jg=!1,Ki.style("visibility","hidden")),ff(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.resize=function(a){qf=a?a.width:null,rf=a?a.height:null,We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},nf.destroy=function(){nf.data.targets=void 0,nf.data.xs={},Mi.html(""),a.onresize=null},"url"in e.data)mf.csv(e.data.url,function(a,b){Ke(b)});else if("rows"in e.data)Ke(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ke(qc(e.data.columns))}return nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 5127f887eb2a163eb699136ee20c1ddabe4493db Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Thu, 10 Apr 2014 12:44:15 +0900 Subject: [PATCH 033/178] Modify axis.x.utc to axis.x.localtime - #144 --- c3.js | 4 ++-- c3.min.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/c3.js b/c3.js index 11588bd..4daaa53 100644 --- a/c3.js +++ b/c3.js @@ -163,7 +163,7 @@ // axis var __axis_rotated = getConfig(['axis', 'rotated'], false), __axis_x_type = getConfig(['axis', 'x', 'type'], 'indexed'), - __axis_x_utc = getConfig(['axis', 'x', 'utc'], true), + __axis_x_localtime = getConfig(['axis', 'x', 'localtime'], false), __axis_x_categories = getConfig(['axis', 'x', 'categories'], []), __axis_x_tick_centered = getConfig(['axis', 'x', 'tick', 'centered'], false), __axis_x_tick_format = getConfig(['axis', 'x', 'tick', 'format']), @@ -282,7 +282,7 @@ var defaultColorPattern = ['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd', '#8c564b', '#e377c2', '#7f7f7f', '#bcbd22', '#17becf'], //same as d3.scale.category10() color = generateColor(__data_colors, notEmpty(__color_pattern) ? __color_pattern : defaultColorPattern, __data_color); - var xTimeFormat = __axis_x_utc ? d3.time.format.utc : d3.time.format, + var xTimeFormat = __axis_x_localtime ? d3.time.format : d3.time.format.utc, defaultTimeFormat = (function () { var formats = [ [xTimeFormat("%Y/%-m/%-d"), function () { return true; }], diff --git a/c3.min.js b/c3.min.js index 59fd804..60fffe5 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ !function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.29"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cDf&&(Df=0),0>Ff&&(Ff=0),Bf={top:Ng?Af.top:If-Hg-(ui?0:a),right:0/0,bottom:20+(ui?0:a),left:Ng?yi:Af.left},Ef=Ng?Af.left-yi-zi:Df,Gf=Ng?Ff:If-Bf.top-Bf.bottom,0>Ef&&(Ef=0),0>Gf&&(Gf=0),Cf={top:ui?0:If-a,right:0/0,bottom:0,left:ui?Hf-b:0},p(),ui&&Yd(nf.data.targets)&&(Cf.left=Df/2+Kf)}function o(){Ii.select("line."+f.xgridFocus).attr("x1",Ng?0:-10).attr("x2",Ng?Df:-10).attr("y1",Ng?-10:Af.top).attr("y2",Ng?-10:Ff)}function p(){Kf=Ff/2,Jf=.95*Kf,Lf=Xd(nf.data.targets)?.6*Jf:0}function q(){var a=Ng?f.axisX:f.axisY,b=mf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=mf.select(pf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return qf?qf:x()}function s(){var a=rf?rf:y();return a>0?a:320}function t(){return Yd(nf.data.targets)?0:sf?sf:Ng||!_g||eh?1:v("y")}function u(){var a=1;return Yd(nf.data.targets)?0:tf?tf:ui?P()+(ih&&!Ng?v("y2"):a):ih?nh||Ng?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||_g?"y2"!==a||ih?(gb(a).isInner?30:40)+("y2"===a?-10:0):Ai:Jg&&!ui?10:1}function x(){return+mf.select(pf).style("width").replace("px","")}function y(){return+mf.select(pf).style("height").replace("px","")}function z(a){return a?-5:-(Af.left-1)}function A(a){return a?-20:-1}function B(){return z(!Ng)}function C(){return A(!Ng)}function D(){return z(Ng)}function E(){return A(Ng)}function F(a){return a?Df+2+4:Af.left+20}function G(a){return a?80:Ff+2}function H(){return F(!Ng)}function I(){return G(!Ng)}function J(){return F(Ng)}function K(){return G(Ng)}function L(){var a=Ng?Ff:Df,b=vc(),c=Vb()*(Ud(nf.data.targets)?(b-(di?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){vi=a}function N(a){wi=a}function O(a){xi=a}function P(){return Jg?ui?wi*(vi+1):Hf:0}function Q(){return Jg?ui?If:xi*(vi+1):0}function R(){var a,b=!Yf;Qf=Ng?1:0,Rf=Ng?Ff:Df,Sf=Ng?0:Ff,Tf=Ng?Df:1,Uf=Qf,Vf=Rf,Wf=Ng?0:Gf,Xf=Ng?Ef:1,Yf=T(Qf,Rf,b?void 0:Yf.domain(),function(){return cg.tickOffset()}),Zf=U(Sf,Tf),$f=U(Sf,Tf),_f=T(Qf,Rf,Ni,function(a){return a%1?0:fg.tickOffset()}),ag=U(Wf,Xf),bg=U(Wf,Xf),a=$(),cg=X(Yf,pi,a),fg=X(_f,si,a),dg=Y(Zf,qi,fh,hh),eg=Y($f,ri,oh,qh),b||(Bi.scale(_f),uf&&Fi.scale(Yf)),S()}function S(){Mf=Db(),Nf=Eb(),Of=Eb(.98)}function T(a,b,e,f){var g=(ci?mf.time.scale():mf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),di){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return mf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?$f:Zf}function W(a){return"y2"===Z(a)?bg:ag}function X(a,b,c){var d=(di?Bb():mf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),di?d.tickCentered(Rg):d.tickOffset=function(){var a=Ng?Ff:Df;return a*Vb()/vc()/2},di&&d.categories(Qg),d}function Y(a,b,c,d){return mf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in ng?ng[a]:"y"}function $(){var a=ci?mi:di?Oc:function(a){return 0>a?a.toFixed(0):a};return Sg&&("function"==typeof Sg?a=Sg:ci&&(a=function(a){return li(Sg)(a)})),a}function _(a){var b;return"y"===a?b=dh:"y2"===a?b=mh:"x"===a&&(b=$g),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?dh=b:"y2"===a?mh=b:"x"===a&&($g=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Ng?"inner-top":"inner-right")}function eb(){return cb("y",Ng?"inner-right":"inner-top")}function fb(){return cb("y2",Ng?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?Df/2:Df:b.isBottom?-Ff:b.isMiddle?-Ff/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Ng,db())}function ob(){return kb(Ng,eb())}function pb(){return kb(Ng,fb())}function qb(){return lb(!Ng,db())}function rb(){return lb(Ng,eb())}function sb(){return lb(Ng,fb())}function tb(){var a=db();return Ng?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Ng?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Ng?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Ng,db())}function xb(){return mb(Ng,eb())}function yb(){return mb(Ng,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Ii.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Ii.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Ii.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return mf.min(Object.keys(i).map(function(a){return mf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(mg.length>0)for(g=Nc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return mf.max(Object.keys(i).map(function(a){return mf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?kh:bh,n="y2"===c?jh:ah,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?lh:ch,r=pd()&&Ng;return 0===l.length?"y2"===c?$f.domain():Zf.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=qd(o,p),j=$b(Zf.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&gh&&(f=b(gh.top)?gh.top:e,g=b(gh.bottom)?gh.bottom:e),"y2"===c&&ph&&(f=b(ph.top)?ph.top:e,g=b(ph.bottom)?ph.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Ni),c=$b(Yf.domain());return a||0===c?1:b/c}function Wb(a){return Yg?Yg:mf.min(a,function(a){return mf.min(a.values,function(a){return a.x})})}function Xb(a){return Xg?Xg:mf.max(a,function(a){return mf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return di?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=ci?new Date(c.getTime()-e):c-e,g=ci?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return gg&&a===gg||ne(hg)&&oe(hg,a)}function fc(a){return!ec(a)}function gc(a){return gg?gg:ne(hg)?hg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=nf.data.xs[b])}),c}function ic(a,b){return a in nf.data.xs&&nf.data.xs[a]&&nf.data.xs[a][b]?nf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){hg[b]=a[b]})}function kc(a){return 1===mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=kg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),nf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=ci?a?a instanceof Date?a:ie(a):ie(ic(b,c)):ei&&!di?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):gg?(d=Object.keys(nf.data.xs),nf.data.xs[c]=d.length>0?nf.data.xs[d[0]]:void 0):ne(hg)&&(nf.data.xs[c]=hc(f,nf.data.targets)):nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=jg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return ei&&di&&0===c&&g&&(0===e&&(Qg=[]),Qg.push(g)),("undefined"==typeof a[b]||nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),og&&Sd(xc(c).filter(function(a){return!(a in pg)}),og),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function tc(a){return a>0&&nf.data.targets[0].values[a-1]?nf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?nf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?nf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(nf.data.targets)}function zc(a,b){var c,d=xc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(ci?new Date(h):h);i.push(d)}return i}function Gc(a){ni=ni.concat(a)}function Hc(a){ni=ni.filter(function(b){return a.indexOf(b)<0})}function Ic(a){oi=oi.concat(a)}function Jc(a){oi=oi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Ed(){return rg&&"desc"===rg.toLowerCase()}function Fd(){return rg&&"asc"===rg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof rg&&a.sort(rg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(nf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Rh&&0!==m.length&&(Li.html(Uh(a,$(),l,ki)).style("display","block"),d=Li.property("offsetWidth"),e=Li.property("offsetHeight"),k?(g=Df/2+c[0],i=Ff/2+c[1]+20):(Ng?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Yf(m[0].x)+20):(f=q(),g=f+t()+Yf(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Li.style("top",i+"px").style("left",g+"px"))}function Id(){Li.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Rh&&(Vd(nf.data.targets)||Yd(nf.data.targets)||Ii.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Ng?"y1":"x1",ud).attr(Ng?"y2":"x2",ud))}function Kd(){Ii.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?Yf(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Dh?Dh:b?2*a.tickOffset()*Eh/b:0}function Sd(a,b){yc(a).forEach(function(a){Pi[a]=b===pg[a],pg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){pg[a.id]===b&&(c=!0),a.id in pg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in pg)||"line"===pg[b]||"spline"===pg[b]||"area"===pg[b]||"area-spline"===pg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===pg[b]||"area-spline"===pg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===pg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===pg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===pg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===pg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ie(b){var c;if(!b)throw Error(b+" can not be parsed as d3.time with format "+ig+". Maybe 'x' of this data is not defined. See data.x or data.xs option.");try{c=ig?mf.time.format(ig).parse(b):new Date(b)}catch(d){c=void 0}return c||a.console.error("Failed to parse x '"+b+"' to Date with format "+ig),c}function je(a,b){var c=mf.mouse(a),d=mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?Zf:$f,d=Ng?1:0,e=Ng?0:1;return Math.pow(Yf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Cg(b,a.node()),Ii.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md).attr("stroke",function(){return ki(b)}).attr("r",1.4*Ch).transition().duration(100).attr("r",Ch)}function se(a,b,c){Dg(b,a.node()),Ii.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Cg(b,a.node()),a.transition().duration(100).style("fill",function(){return mf.rgb(ki(b)).darker(1)})}function ve(a,b){Dg(b,a.node()),a.transition().duration(100).style("fill",function(){return ki(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Ii.selectAll("."+f.circles+gd(c)):Ii).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",Bh)}function Ae(a){ye(a).filter(function(){return mf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",yh)}function Be(a){return Ii.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Ng?1:0,f=Ng?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Ng?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBoundingClientRect();return Ng?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(cg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Ng&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Je(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function Ke(b){var c,d,e;if(Mi=mf.select(pf),Mi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Mi.html(""),Mi.classed("c3",!0),nf.data.xs={},nf.data.targets=rc(b),n(),R(),Yf.domain(mf.extent(Zb(nf.data.targets))),Zf.domain(Ub(nf.data.targets,"y")),$f.domain(Ub(nf.data.targets,"y2")),_f.domain(Yf.domain()),ag.domain(Zf.domain()),bg.domain($f.domain()),Ni=Yf.domain(),Bi.scale(_f),uf&&Fi.scale(Yf),Gi=Mi.append("svg").attr("width",Df+Af.left+Af.right).attr("height",Ff+Af.top+Af.bottom).on("mouseenter",xf).on("mouseleave",yf),Hi=Gi.append("defs"),Hi.append("clipPath").attr("id",Yh).append("rect").attr("width",Df).attr("height",Ff),Hi.append("clipPath").attr("id",Zh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Hi.append("clipPath").attr("id",$h).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Ii=Gi.append("g").attr("transform",ti.main),Ji=Gg?Gi.append("g").attr("transform",ti.context):null,Ki=Gi.append("g").attr("transform",ti.legend),Jg||(Ki.style("visibility","hidden"),oi=xc(nf.data.targets)),Li=mf.select(pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),gf(xc(nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Ii.append("g").attr("class",f.axisX).attr("clip-path",Ng?"":ai).attr("transform",ti.x).append("text").attr("class",f.axisXLabel).attr("transform",Ng?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),_g&&Ii.append("g").attr("class",f.axisY).attr("clip-path",Ng?bi:"").attr("transform",ti.y).append("text").attr("class",f.axisYLabel).attr("transform",Ng?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),ih&&Ii.append("g").attr("class",f.axisY2).attr("transform",ti.y2).append("text").attr("class",f.axisY2Label).attr("transform",Ng?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Ii.append("g").attr("clip-path",_h).attr("class",f.grid),rh&&d.append("g").attr("class",f.xgrids),ne(th)&&d.append("g").attr("class",f.xgridLines),zh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),uh&&d.append("g").attr("class",f.ygrids),ne(vh)&&d.append("g").attr("class",f.ygridLines),Ii.append("g").attr("clip-path",_h).attr("class",f.regions),Ii.append("g").attr("clip-path",_h).attr("class",f.chart),c=Ii.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",uf?Ng?"ns-resize":"ew-resize":null),Ii.select("."+f.chart).append("g").attr("class",f.chartBars),Ii.select("."+f.chart).append("g").attr("class",f.chartLines),Ii.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",ti.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Ii.select("."+f.chart).append("g").attr("class",f.chartTexts),uf&&Ii.insert("rect",wf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Df).attr("height",Ff).style("opacity",0).style("cursor",Ng?"ns-resize":"ew-resize").call(Fi).on("dblclick.zoom",null),Zg&&Bi.extent("function"!=typeof Zg?Zg:Zg(Zb())),Gg&&(Ji.append("g").attr("clip-path",_h).attr("class",f.chart),Ji.select("."+f.chart).append("g").attr("class",f.chartBars),Ji.select("."+f.chart).append("g").attr("class",f.chartLines),Ji.append("g").attr("clip-path",_h).attr("class",f.brush).call(Bi).selectAll("rect").attr(Ng?"width":"height",Ng?Ef:Gf),Ji.append("g").attr("class",f.axisX).attr("transform",ti.subx).attr("clip-path",Ng?"":ai)),Xe(nf.data.targets),Ng?Ii.select("."+f.axisX).style("opacity",0).call(cg):(Ii.select("."+f.axisY).style("opacity",0).call(dg),Ii.select("."+f.axisY2).style("opacity",0).call(eg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Vh){if(ci&&"string"==typeof Wh){for(Wh=ie(Wh),e=0;e0){d=[];for(var g in kg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function Pe(a){Yd(nf.data.targets)||vg&&(fi=a,Ii.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),gi=!0,Eg())}function Qe(){Yd(nf.data.targets)||vg&&(Ii.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Ii.selectAll("."+f.shape).classed(f.INCLUDED,!1),gi=!1,Fg())}function Re(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Nd(),U=Yd(nf.data.targets),V=Dc(nf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?zf:0,O=B?N:0,P=C?N:0,H&&Jg&&gf(xc(nf.data.targets),a),G&&(Yf.domain(mf.extent(Zb(V))),Ni=Yf.domain(),uf&&Fi.scale(Yf).updateScaleExtent(),_f.domain(Yf.domain()),Bi.scale(_f)),F&&(Yf.domain(Bi.empty()?Ni:Bi.extent()),uf&&Fi.scale(Yf).updateScaleExtent()),Zf.domain(Ub(V,"y")),$f.domain(Ub(V,"y2")),Vd(V)||(Q=Fc(Ec(V)).sort(),cg.tickValues(Q),fg.tickValues(Q)),c=Ii.select("."+f.axisX).style("opacity",U?0:1),(Ng||D)&&(c=c.transition().duration(P)),c.call(cg),e=Ii.select("."+f.axisY).style("opacity",U?0:1),(!Ng||D)&&(e=e.transition().duration(P)),e.call(dg),Ii.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(eg),F&&Tg&&Q){for(R=1;R=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=Yf.ticks(10);g=Ii.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Ng?0:function(a){return Yf(a)-cg.tickOffset()}).attr("x2",Ng?Df:function(a){return Yf(a)-cg.tickOffset()}).attr("y1",Ng?function(a){return Yf(a)-cg.tickOffset()}:Af.top).attr("y2",Ng?function(a){return Yf(a)-cg.tickOffset()}:Ff).style("opacity",function(){return+mf.select(this).attr(Ng?"y1":"x1")===(Ng?Ff:0)?0:1}),g.exit().remove()}ne(th)&&(i=Ii.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(th),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Ng?"":"rotate(-90)").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Ng?0:vd).attr("x2",Ng?Df:vd).attr("y1",Ng?vd:Af.top).attr("y2",Ng?vd:Ff).style("opacity",1),i.select("text").transition().duration(N).attr("x",Ng?Df:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&uh&&(k=Ii.select("."+f.ygrids).selectAll("."+f.ygrid).data(Zf.ticks(wh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Ng?Zf:0).attr("x2",Ng?Zf:Df).attr("y1",Ng?0:Zf).attr("y2",Ng?Ff:Zf),k.exit().remove()),y&&ne(vh)&&(l=Ii.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(vh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Ng?"rotate(-90)":"").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Ng?wd:0).attr("x2",Ng?wd:Df).attr("y1",Ng?0:wd).attr("y2",Ng?Ff:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Ng?0:Df).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Ii.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ki(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Ii.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Ng?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Ii.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ci).style("opacity",1),Ii.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Di).style("opacity",Oi),n=Ii.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",yh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),n.exit().remove(),Ii.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=mf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Ii.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Ii.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Gg&&(null!==mf.event&&"zoom"===mf.event.type&&Bi.extent(Yf.orgDomain()).update(),z&&(Ji.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(fg),Bi.empty()||Bi.extent(Yf.orgDomain()).update(),J=Ee(T,!0),s=Ji.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ki(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Ji.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ei).style("opacity",1))),Ii.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Ii.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),t=Ii.select("."+f.eventRects),ne(hg)&&!kc(hg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Ii.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Df).attr("height",Ff)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),ei&&!di?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return(Yf(d?d:e+50)-Yf(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return(Yf(d)+Yf(c?c:d-50))/2}):(x=L(),w=function(a){return Yf(a.x)-x/2}),v=wc(),Ii.select("."+f.eventRects).datum(v?v.values:[]),u=Ii.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Ng?0:w).attr("y",Ng?w:0).attr("width",Ng?Df:x).attr("height",Ng?x:Ff),u.exit().remove()),q=Ii.select("."+f.regions).selectAll("rect."+f.region).data(Qh),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Ng?0:cc).attr("y",Ng?cc:Af.top).attr("width",Ng?Df:dc).attr("height",Ng?dc:Ff).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),xc(nf.data.targets).forEach(function(a){Pi[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Fi.altDomain?(Yf.domain(Fi.altDomain),void Fi.scale(Yf).updateScaleExtent()):(di&&Yf.orgDomain()[0]===Ni[0]&&Yf.domain([Ni[0]-1e-10,Yf.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(hi=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Gi.attr("width",Hf).attr("height",If),Gi.select("#"+Yh).select("rect").attr("width",Df).attr("height",Ff),Gi.select("#"+Zh).select("rect").attr("width",H),Gi.select("#"+$h).select("rect").attr("width",J),Gi.select("."+f.zoomRect).attr("width",Df).attr("height",Ff)}function We(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Ii.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ki(a)}),e=Ii.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ki(a)}).style("stroke","none").style("cursor",function(a){return xg(a)?"pointer":null}),c=Ii.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ki(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Oi=+mf.select(this).style("opacity"),0}).style("fill",function(a){return ki(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ki(a)}).style("cursor",function(a){return xg(a)?"pointer":null}),a.forEach(function(a){Ii.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Ii.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Pf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ki(a.data)}).style("cursor",function(a){return xg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Gg&&(n=Ji.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ki(a)}),l=Ji.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ki(a)})),Gi.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=ui?j:i,l=ui?Q():P();return d&&(w=0,C=0,t=0,u=0),Jg&&!Cc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=ui?u:t,void(Mg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,ui?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Ki.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Lg?Lg(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",ui?g:-200).attr("y",ui?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",ui?h:-200).attr("y",ui?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return ki(a)}).attr("x",ui?g:-200).attr("y",ui?-200:i).attr("width",10).attr("height",10),Ki.selectAll("text").data(a).text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ki.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ki.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["transition","duration"],350);g("data","data is required in config");var Af,Bf,Cf,Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg=h(["data","x"]),hg=h(["data","xs"],{}),ig=h(["data","x_format"]),jg=h(["data","id_converter"],function(a){return a}),kg=h(["data","names"],{}),lg=h(["data","classes"],{}),mg=h(["data","groups"],[]),ng=h(["data","axes"],{}),og=h(["data","type"]),pg=h(["data","types"],{}),qg=h(["data","labels"],{}),rg=h(["data","order"]),sg=h(["data","regions"],{}),tg=h(["data","color"]),ug=h(["data","colors"],{}),vg=h(["data","selection","enabled"],!1),wg=h(["data","selection","grouped"],!1),xg=h(["data","selection","isselectable"],function(){return!0}),yg=h(["data","selection","multiple"],!0),zg=h(["data","onclick"],function(){}),Ag=h(["data","onenter"],function(){}),Bg=h(["data","onleave"],function(){}),Cg=h(["data","onselected"],function(){}),Dg=h(["data","onunselected"],function(){}),Eg=h(["data","ondragstart"],function(){}),Fg=h(["data","ondragend"],function(){}),Gg=h(["subchart","show"],!1),Hg=Gg?h(["subchart","size","height"],60):0,Ig=h(["color","pattern"],[]),Jg=h(["legend","show"],!0),Kg=h(["legend","position"],"bottom"),Lg=h(["legend","item","onclick"]),Mg=h(["legend","equally"],!1),Ng=h(["axis","rotated"],!1),Og=h(["axis","x","type"],"indexed"),Pg=h(["axis","x","utc"],!0),Qg=h(["axis","x","categories"],[]),Rg=h(["axis","x","tick","centered"],!1),Sg=h(["axis","x","tick","format"]),Tg=h(["axis","x","tick","culling"],{}),Ug=h(["axis","x","tick","culling","max"],"categorized"===Og?1/0:10),Vg=h(["axis","x","tick","count"]),Wg=h(["axis","x","tick","fit"],!1),Xg=h(["axis","x","max"]),Yg=h(["axis","x","min"]),Zg=h(["axis","x","default"]),$g=h(["axis","x","label"],{}),_g=h(["axis","y","show"],!0),ah=h(["axis","y","max"]),bh=h(["axis","y","min"]),ch=h(["axis","y","center"]),dh=h(["axis","y","label"],{}),eh=h(["axis","y","inner"],!1),fh=h(["axis","y","tick","format"]),gh=h(["axis","y","padding"],{}),hh=h(["axis","y","ticks"],10),ih=h(["axis","y2","show"],!1),jh=h(["axis","y2","max"]),kh=h(["axis","y2","min"]),lh=h(["axis","y2","center"]),mh=h(["axis","y2","label"],{}),nh=h(["axis","y2","inner"],!1),oh=h(["axis","y2","tick","format"]),ph=h(["axis","y2","padding"],{}),qh=h(["axis","y2","ticks"],10),rh=h(["grid","x","show"],!1),sh=h(["grid","x","type"],"tick"),th=h(["grid","x","lines"],[]),uh=h(["grid","y","show"],!1),vh=h(["grid","y","lines"],[]),wh=h(["grid","y","ticks"],10),xh=h(["point","show"],!0),yh=xh?h(["point","r"],2.5):0,zh=h(["point","focus","line","enabled"],!0),Ah=h(["point","focus","expand","enabled"],!0),Bh=h(["point","focus","expand","r"],Ah?4:yh),Ch=h(["point","focus","select","r"],8),Dh=h(["bar","width"]),Eh=h(["bar","width","ratio"],.6),Fh=h(["pie","label","show"],!0),Gh=h(["pie","label","format"]),Hh=h(["pie","onclick"],function(){}),Ih=h(["pie","onmouseover"],function(){}),Jh=h(["pie","onmouseout"],function(){}),Kh=h(["donut","label","show"],!0),Lh=h(["donut","label","format"]),Mh=h(["donut","title"],""),Nh=h(["donut","onclick"],function(){}),Oh=h(["donut","onmouseover"],function(){}),Ph=h(["donut","onmouseout"],function(){}),Qh=h(["regions"],[]),Rh=h(["tooltip","show"],!0),Sh=h(["tooltip","format","title"]),Th=h(["tooltip","format","value"]),Uh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Sh?Sh:b,l=Th?Th:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Vh=h(["tooltip","init","show"],!1),Wh=h(["tooltip","init","x"],0),Xh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Yh=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",Zh=Yh+"-xaxis",$h=Yh+"-yaxis",_h=i(Yh),ai=i(Zh),bi=i($h),ci="timeseries"===Og,di="categorized"===Og,ei=!ci&&(gg||ne(hg)),fi=null,gi=!1,hi=!1,ii=!1,ji=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ki=he(ug,ne(Ig)?Ig:ji,tg),li=Pg?mf.time.format.utc:mf.time.format,mi=function(){var a=[[li("%Y/%-m/%-d"),function(){return!0}],[li("%-m/%-d"),function(a){return a.getMonth()}],[li("%-m/%-d"),function(a){return 1!==a.getDate()}],[li("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[li("%I %p"),function(a){return a.getHours()}],[li("%I:%M"),function(a){return a.getMinutes()}],[li(":%S"),function(a){return a.getSeconds()}],[li(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),ni=[],oi=[],pi=Ng?"left":"bottom",qi=Ng?eh?"top":"bottom":eh?"right":"left",ri=Ng?nh?"bottom":"top":nh?"left":"right",si=Ng?"left":"bottom",ti={main:function(){return"translate("+Af.left+","+Af.top+")"},context:function(){return"translate("+Bf.left+","+Bf.top+")"},legend:function(){return"translate("+Cf.left+","+Cf.top+")"},x:function(){return"translate(0,"+(Ng?0:Ff)+")"},y:function(){return"translate(0,"+(Ng?Ff:0)+")"},y2:function(){return"translate("+(Ng?0:Df)+","+(Ng?1:0)+")"},subx:function(){return"translate(0,"+(Ng?0:Gf)+")"},arc:function(){return"translate("+Df/2+","+Ff/2+")"}},ui="right"===Kg,vi=0,wi=0,xi=0,yi=30,zi=30,Ai=5;Pf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Bi,Ci=function(){var a=mf.svg.line().x(Ng?function(a){return V(a.id)(a.value)}:ud).y(Ng?ud:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=xe(b.values);return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),sg[b.id]?Je(e,Yf,V(b.id),sg[b.id]):a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Di=function(){var a;return a=Ng?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Ei=function(){var a=mf.svg.line().x(Ng?function(a){return W(a.id)(a.value)}:xd).y(Ng?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+_f(c[0].x)+" "+W(b.id)(c[0].value)}}(),Fi=function(){};Bi=mf.svg.brush().on("brush",Se),Bi.update=function(){return Ji&&Ji.select("."+f.brush).call(this),this},Bi.scale=function(a){return Ng?this.y(a):this.x(a)},uf&&(Fi=mf.behavior.zoom().on("zoomstart",function(){Fi.altDomain=mf.event.sourceEvent.altKey?Yf.orgDomain():null}).on("zoom",uf?Te:null),Fi.scale=function(a){return Ng?this.y(a):this.x(a)},Fi.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Fi.updateScaleExtent=function(){var a=$b(Yf.orgDomain())/$b(Ni),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Gi,Hi,Ii,Ji,Ki,Li,Mi,Ni,Oi,Pi={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Gi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Gi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Gi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Gi.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Ki.selectAll(kd(a)).classed(f.legendItemHidden,!1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Gi.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Ki.selectAll(kd(a)).classed(f.legendItemHidden,!0),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){Bi.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){lg[b]=a.classes[b]}),"categories"in a&&di&&(Qg=a.categories,cg.categories(Qg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Ii.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){vg&&Ii.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=wg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?xg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){vg&&Ii.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=wg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&xg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?mg:(mg=a,Re(),mg)},nf.xgrids=function(a){return a?(th=a,Re(),th):th},nf.xgrids.add=function(a){return a?nf.xgrids(th.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(th.filter(b))},nf.ygrids=function(a){return a?(vh=a,Re(),vh):vh},nf.ygrids.add=function(a){return a?nf.ygrids(vh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(vh.filter(b))},nf.regions=function(a){return c(a)?Qh:(Qh=a,Re(),Qh)},nf.regions.add=function(a){return c(a)?Qh:(Qh=Qh.concat(a),Re(),Qh)},nf.regions.remove=function(a,c){var e=[].concat(a);return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;Gi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Qh=Qh.filter(function(b){return b.classes.indexOf(a)<0})}),Qh},nf.data.get=function(a){var b=nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},nf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0 +}Li.html(Uh(nf.data.targets.map(function(a){return lc(a.values[Wh])}),$(),rd,ki)),Li.style("top",Xh.top).style("left",Xh.left).style("display","block")}null==a.onresize&&(a.onresize=Ue()),a.onresize.add&&a.onresize.add(function(){We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})})}function Le(a){a.append("rect").attr("class",ad).style("cursor",vg&&wg?"pointer":null).on("mouseover",function(a,b){if(!gi&&!Yd(nf.data.targets)){var c,d,e=nf.data.targets.map(function(a){return lc(a.values[b])});if(Object.keys(kg).length>0){d=[];for(var g in kg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function Pe(a){Yd(nf.data.targets)||vg&&(fi=a,Ii.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),gi=!0,Eg())}function Qe(){Yd(nf.data.targets)||vg&&(Ii.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Ii.selectAll("."+f.shape).classed(f.INCLUDED,!1),gi=!1,Fg())}function Re(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Nd(),U=Yd(nf.data.targets),V=Dc(nf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?zf:0,O=B?N:0,P=C?N:0,H&&Jg&&gf(xc(nf.data.targets),a),G&&(Yf.domain(mf.extent(Zb(V))),Ni=Yf.domain(),uf&&Fi.scale(Yf).updateScaleExtent(),_f.domain(Yf.domain()),Bi.scale(_f)),F&&(Yf.domain(Bi.empty()?Ni:Bi.extent()),uf&&Fi.scale(Yf).updateScaleExtent()),Zf.domain(Ub(V,"y")),$f.domain(Ub(V,"y2")),Vd(V)||(Q=Fc(Ec(V)).sort(),cg.tickValues(Q),fg.tickValues(Q)),c=Ii.select("."+f.axisX).style("opacity",U?0:1),(Ng||D)&&(c=c.transition().duration(P)),c.call(cg),e=Ii.select("."+f.axisY).style("opacity",U?0:1),(!Ng||D)&&(e=e.transition().duration(P)),e.call(dg),Ii.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(eg),F&&Tg&&Q){for(R=1;R=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=Yf.ticks(10);g=Ii.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Ng?0:function(a){return Yf(a)-cg.tickOffset()}).attr("x2",Ng?Df:function(a){return Yf(a)-cg.tickOffset()}).attr("y1",Ng?function(a){return Yf(a)-cg.tickOffset()}:Af.top).attr("y2",Ng?function(a){return Yf(a)-cg.tickOffset()}:Ff).style("opacity",function(){return+mf.select(this).attr(Ng?"y1":"x1")===(Ng?Ff:0)?0:1}),g.exit().remove()}ne(th)&&(i=Ii.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(th),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Ng?"":"rotate(-90)").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Ng?0:vd).attr("x2",Ng?Df:vd).attr("y1",Ng?vd:Af.top).attr("y2",Ng?vd:Ff).style("opacity",1),i.select("text").transition().duration(N).attr("x",Ng?Df:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&uh&&(k=Ii.select("."+f.ygrids).selectAll("."+f.ygrid).data(Zf.ticks(wh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Ng?Zf:0).attr("x2",Ng?Zf:Df).attr("y1",Ng?0:Zf).attr("y2",Ng?Ff:Zf),k.exit().remove()),y&&ne(vh)&&(l=Ii.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(vh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Ng?"rotate(-90)":"").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Ng?wd:0).attr("x2",Ng?wd:Df).attr("y1",Ng?0:wd).attr("y2",Ng?Ff:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Ng?0:Df).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Ii.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ki(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Ii.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Ng?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Ii.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ci).style("opacity",1),Ii.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Di).style("opacity",Oi),n=Ii.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",yh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),n.exit().remove(),Ii.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=mf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Ii.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Ii.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Gg&&(null!==mf.event&&"zoom"===mf.event.type&&Bi.extent(Yf.orgDomain()).update(),z&&(Ji.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(fg),Bi.empty()||Bi.extent(Yf.orgDomain()).update(),J=Ee(T,!0),s=Ji.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ki(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Ji.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ei).style("opacity",1))),Ii.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Ii.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),t=Ii.select("."+f.eventRects),ne(hg)&&!kc(hg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Ii.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Df).attr("height",Ff)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),ei&&!di?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return(Yf(d?d:e+50)-Yf(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return(Yf(d)+Yf(c?c:d-50))/2}):(x=L(),w=function(a){return Yf(a.x)-x/2}),v=wc(),Ii.select("."+f.eventRects).datum(v?v.values:[]),u=Ii.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Ng?0:w).attr("y",Ng?w:0).attr("width",Ng?Df:x).attr("height",Ng?x:Ff),u.exit().remove()),q=Ii.select("."+f.regions).selectAll("rect."+f.region).data(Qh),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Ng?0:cc).attr("y",Ng?cc:Af.top).attr("width",Ng?Df:dc).attr("height",Ng?dc:Ff).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),xc(nf.data.targets).forEach(function(a){Pi[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Fi.altDomain?(Yf.domain(Fi.altDomain),void Fi.scale(Yf).updateScaleExtent()):(di&&Yf.orgDomain()[0]===Ni[0]&&Yf.domain([Ni[0]-1e-10,Yf.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(hi=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Gi.attr("width",Hf).attr("height",If),Gi.select("#"+Yh).select("rect").attr("width",Df).attr("height",Ff),Gi.select("#"+Zh).select("rect").attr("width",H),Gi.select("#"+$h).select("rect").attr("width",J),Gi.select("."+f.zoomRect).attr("width",Df).attr("height",Ff)}function We(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Ii.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ki(a)}),e=Ii.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ki(a)}).style("stroke","none").style("cursor",function(a){return xg(a)?"pointer":null}),c=Ii.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ki(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Oi=+mf.select(this).style("opacity"),0}).style("fill",function(a){return ki(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ki(a)}).style("cursor",function(a){return xg(a)?"pointer":null}),a.forEach(function(a){Ii.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Ii.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Pf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ki(a.data)}).style("cursor",function(a){return xg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Gg&&(n=Ji.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ki(a)}),l=Ji.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ki(a)})),Gi.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=ui?j:i,l=ui?Q():P();return d&&(w=0,C=0,t=0,u=0),Jg&&!Cc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=ui?u:t,void(Mg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,ui?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Ki.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Lg?Lg(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",ui?g:-200).attr("y",ui?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",ui?h:-200).attr("y",ui?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return ki(a)}).attr("x",ui?g:-200).attr("y",ui?-200:i).attr("width",10).attr("height",10),Ki.selectAll("text").data(a).text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ki.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ki.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["transition","duration"],350);g("data","data is required in config");var Af,Bf,Cf,Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg=h(["data","x"]),hg=h(["data","xs"],{}),ig=h(["data","x_format"]),jg=h(["data","id_converter"],function(a){return a}),kg=h(["data","names"],{}),lg=h(["data","classes"],{}),mg=h(["data","groups"],[]),ng=h(["data","axes"],{}),og=h(["data","type"]),pg=h(["data","types"],{}),qg=h(["data","labels"],{}),rg=h(["data","order"]),sg=h(["data","regions"],{}),tg=h(["data","color"]),ug=h(["data","colors"],{}),vg=h(["data","selection","enabled"],!1),wg=h(["data","selection","grouped"],!1),xg=h(["data","selection","isselectable"],function(){return!0}),yg=h(["data","selection","multiple"],!0),zg=h(["data","onclick"],function(){}),Ag=h(["data","onenter"],function(){}),Bg=h(["data","onleave"],function(){}),Cg=h(["data","onselected"],function(){}),Dg=h(["data","onunselected"],function(){}),Eg=h(["data","ondragstart"],function(){}),Fg=h(["data","ondragend"],function(){}),Gg=h(["subchart","show"],!1),Hg=Gg?h(["subchart","size","height"],60):0,Ig=h(["color","pattern"],[]),Jg=h(["legend","show"],!0),Kg=h(["legend","position"],"bottom"),Lg=h(["legend","item","onclick"]),Mg=h(["legend","equally"],!1),Ng=h(["axis","rotated"],!1),Og=h(["axis","x","type"],"indexed"),Pg=h(["axis","x","localtime"],!1),Qg=h(["axis","x","categories"],[]),Rg=h(["axis","x","tick","centered"],!1),Sg=h(["axis","x","tick","format"]),Tg=h(["axis","x","tick","culling"],{}),Ug=h(["axis","x","tick","culling","max"],"categorized"===Og?1/0:10),Vg=h(["axis","x","tick","count"]),Wg=h(["axis","x","tick","fit"],!1),Xg=h(["axis","x","max"]),Yg=h(["axis","x","min"]),Zg=h(["axis","x","default"]),$g=h(["axis","x","label"],{}),_g=h(["axis","y","show"],!0),ah=h(["axis","y","max"]),bh=h(["axis","y","min"]),ch=h(["axis","y","center"]),dh=h(["axis","y","label"],{}),eh=h(["axis","y","inner"],!1),fh=h(["axis","y","tick","format"]),gh=h(["axis","y","padding"],{}),hh=h(["axis","y","ticks"],10),ih=h(["axis","y2","show"],!1),jh=h(["axis","y2","max"]),kh=h(["axis","y2","min"]),lh=h(["axis","y2","center"]),mh=h(["axis","y2","label"],{}),nh=h(["axis","y2","inner"],!1),oh=h(["axis","y2","tick","format"]),ph=h(["axis","y2","padding"],{}),qh=h(["axis","y2","ticks"],10),rh=h(["grid","x","show"],!1),sh=h(["grid","x","type"],"tick"),th=h(["grid","x","lines"],[]),uh=h(["grid","y","show"],!1),vh=h(["grid","y","lines"],[]),wh=h(["grid","y","ticks"],10),xh=h(["point","show"],!0),yh=xh?h(["point","r"],2.5):0,zh=h(["point","focus","line","enabled"],!0),Ah=h(["point","focus","expand","enabled"],!0),Bh=h(["point","focus","expand","r"],Ah?4:yh),Ch=h(["point","focus","select","r"],8),Dh=h(["bar","width"]),Eh=h(["bar","width","ratio"],.6),Fh=h(["pie","label","show"],!0),Gh=h(["pie","label","format"]),Hh=h(["pie","onclick"],function(){}),Ih=h(["pie","onmouseover"],function(){}),Jh=h(["pie","onmouseout"],function(){}),Kh=h(["donut","label","show"],!0),Lh=h(["donut","label","format"]),Mh=h(["donut","title"],""),Nh=h(["donut","onclick"],function(){}),Oh=h(["donut","onmouseover"],function(){}),Ph=h(["donut","onmouseout"],function(){}),Qh=h(["regions"],[]),Rh=h(["tooltip","show"],!0),Sh=h(["tooltip","format","title"]),Th=h(["tooltip","format","value"]),Uh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Sh?Sh:b,l=Th?Th:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Vh=h(["tooltip","init","show"],!1),Wh=h(["tooltip","init","x"],0),Xh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Yh=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",Zh=Yh+"-xaxis",$h=Yh+"-yaxis",_h=i(Yh),ai=i(Zh),bi=i($h),ci="timeseries"===Og,di="categorized"===Og,ei=!ci&&(gg||ne(hg)),fi=null,gi=!1,hi=!1,ii=!1,ji=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ki=he(ug,ne(Ig)?Ig:ji,tg),li=Pg?mf.time.format:mf.time.format.utc,mi=function(){var a=[[li("%Y/%-m/%-d"),function(){return!0}],[li("%-m/%-d"),function(a){return a.getMonth()}],[li("%-m/%-d"),function(a){return 1!==a.getDate()}],[li("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[li("%I %p"),function(a){return a.getHours()}],[li("%I:%M"),function(a){return a.getMinutes()}],[li(":%S"),function(a){return a.getSeconds()}],[li(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),ni=[],oi=[],pi=Ng?"left":"bottom",qi=Ng?eh?"top":"bottom":eh?"right":"left",ri=Ng?nh?"bottom":"top":nh?"left":"right",si=Ng?"left":"bottom",ti={main:function(){return"translate("+Af.left+","+Af.top+")"},context:function(){return"translate("+Bf.left+","+Bf.top+")"},legend:function(){return"translate("+Cf.left+","+Cf.top+")"},x:function(){return"translate(0,"+(Ng?0:Ff)+")"},y:function(){return"translate(0,"+(Ng?Ff:0)+")"},y2:function(){return"translate("+(Ng?0:Df)+","+(Ng?1:0)+")"},subx:function(){return"translate(0,"+(Ng?0:Gf)+")"},arc:function(){return"translate("+Df/2+","+Ff/2+")"}},ui="right"===Kg,vi=0,wi=0,xi=0,yi=30,zi=30,Ai=5;Pf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Bi,Ci=function(){var a=mf.svg.line().x(Ng?function(a){return V(a.id)(a.value)}:ud).y(Ng?ud:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=xe(b.values);return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),sg[b.id]?Je(e,Yf,V(b.id),sg[b.id]):a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Di=function(){var a;return a=Ng?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Ei=function(){var a=mf.svg.line().x(Ng?function(a){return W(a.id)(a.value)}:xd).y(Ng?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+_f(c[0].x)+" "+W(b.id)(c[0].value)}}(),Fi=function(){};Bi=mf.svg.brush().on("brush",Se),Bi.update=function(){return Ji&&Ji.select("."+f.brush).call(this),this},Bi.scale=function(a){return Ng?this.y(a):this.x(a)},uf&&(Fi=mf.behavior.zoom().on("zoomstart",function(){Fi.altDomain=mf.event.sourceEvent.altKey?Yf.orgDomain():null}).on("zoom",uf?Te:null),Fi.scale=function(a){return Ng?this.y(a):this.x(a)},Fi.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Fi.updateScaleExtent=function(){var a=$b(Yf.orgDomain())/$b(Ni),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Gi,Hi,Ii,Ji,Ki,Li,Mi,Ni,Oi,Pi={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Gi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Gi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Gi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Gi.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Ki.selectAll(kd(a)).classed(f.legendItemHidden,!1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Gi.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Ki.selectAll(kd(a)).classed(f.legendItemHidden,!0),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){Bi.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){lg[b]=a.classes[b]}),"categories"in a&&di&&(Qg=a.categories,cg.categories(Qg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Ii.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){vg&&Ii.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=wg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?xg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){vg&&Ii.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=wg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&xg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?mg:(mg=a,Re(),mg)},nf.xgrids=function(a){return a?(th=a,Re(),th):th},nf.xgrids.add=function(a){return a?nf.xgrids(th.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(th.filter(b))},nf.ygrids=function(a){return a?(vh=a,Re(),vh):vh},nf.ygrids.add=function(a){return a?nf.ygrids(vh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(vh.filter(b))},nf.regions=function(a){return c(a)?Qh:(Qh=a,Re(),Qh)},nf.regions.add=function(a){return c(a)?Qh:(Qh=Qh.concat(a),Re(),Qh)},nf.regions.remove=function(a,c){var e=[].concat(a);return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;Gi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Qh=Qh.filter(function(b){return b.classes.indexOf(a)<0})}),Qh},nf.data.get=function(a){var b=nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},nf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0 },nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){kg[b]=a[b]}),gf(xc(nf.data.targets),{withTransition:!0}),kg):kg},nf.x=function(a){return arguments.length&&(mc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.xs=function(a){return arguments.length&&(nc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(ah=+a.y),b(a.y2)&&(jh=+a.y2)):ah=jh=+a,Re())},nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(bh=+a.y),b(a.y2)&&(kh=+a.y2)):bh=kh=+a,Re())},nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&nf.axis.max(a.max),"undefined"!=typeof a.min&&nf.axis.min(a.min))},nf.legend.show=function(a){Jg||(Jg=!0,Ki.style("visibility","visible")),ef(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.legend.hide=function(a){Jg&&me(a)&&(Jg=!1,Ki.style("visibility","hidden")),ff(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.resize=function(a){qf=a?a.width:null,rf=a?a.height:null,We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},nf.destroy=function(){nf.data.targets=void 0,nf.data.xs={},Mi.html(""),a.onresize=null},"url"in e.data)mf.csv(e.data.url,function(a,b){Ke(b)});else if("rows"in e.data)Ke(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ke(qc(e.data.columns))}return nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From ae8cf74bd6be5f582823e1d86471c1d6c133dac7 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Thu, 10 Apr 2014 23:30:26 +0900 Subject: [PATCH 034/178] Fix loading only header data from url - #143 --- c3.js | 25 ++++++++++++++++++++----- c3.min.js | 4 ++-- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/c3.js b/c3.js index 4daaa53..87f7aae 100644 --- a/c3.js +++ b/c3.js @@ -1218,8 +1218,13 @@ var xDomain = [getXDomainMin(targets), getXDomainMax(targets)], firstX = xDomain[0], lastX = xDomain[1], padding = getXDomainPadding(targets, xDomain), - min = isTimeSeries ? new Date(firstX.getTime() - padding) : firstX - padding, + min = 0, max = 0; + if (firstX || firstX === 0) { + min = isTimeSeries ? new Date(firstX.getTime() - padding) : firstX - padding; + } + if (lastX || lastX === 0) { max = isTimeSeries ? new Date(lastX.getTime() + padding) : lastX + padding; + } return [min, max]; } function diffDomain(d) { @@ -2001,13 +2006,11 @@ function parseDate(date) { var parsedDate; - if (!date) { throw Error(date + " can not be parsed as d3.time with format " + __data_x_format + ". Maybe 'x' of this data is not defined. See data.x or data.xs option."); } try { parsedDate = __data_x_format ? d3.time.format(__data_x_format).parse(date) : new Date(date); } catch (e) { - parsedDate = undefined; + window.console.error("Failed to parse x '" + date + "' to Date with format " + __data_x_format); } - if (!parsedDate) { window.console.error("Failed to parse x '" + date + "' to Date with format " + __data_x_format); } return parsedDate; } @@ -4266,7 +4269,19 @@ /*-- Load data and init chart with defined functions --*/ if ('url' in config.data) { - d3.csv(config.data.url, function (error, data) { init(data); }); + d3.xhr(config.data.url, function (error, data) { + // TODO: other mine/type + var rows = d3.csv.parseRows(data.response), d; + if (rows.length === 1) { + d = [{}]; + rows[0].forEach(function (id) { + d[0][id] = null; + }); + } else { + d = d3.csv.parse(data.response); + } + init(d); + }); } else if ('rows' in config.data) { init(convertRowsToData(config.data.rows)); diff --git a/c3.min.js b/c3.min.js index 60fffe5..a38c8ea 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.29"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cDf&&(Df=0),0>Ff&&(Ff=0),Bf={top:Ng?Af.top:If-Hg-(ui?0:a),right:0/0,bottom:20+(ui?0:a),left:Ng?yi:Af.left},Ef=Ng?Af.left-yi-zi:Df,Gf=Ng?Ff:If-Bf.top-Bf.bottom,0>Ef&&(Ef=0),0>Gf&&(Gf=0),Cf={top:ui?0:If-a,right:0/0,bottom:0,left:ui?Hf-b:0},p(),ui&&Yd(nf.data.targets)&&(Cf.left=Df/2+Kf)}function o(){Ii.select("line."+f.xgridFocus).attr("x1",Ng?0:-10).attr("x2",Ng?Df:-10).attr("y1",Ng?-10:Af.top).attr("y2",Ng?-10:Ff)}function p(){Kf=Ff/2,Jf=.95*Kf,Lf=Xd(nf.data.targets)?.6*Jf:0}function q(){var a=Ng?f.axisX:f.axisY,b=mf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=mf.select(pf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return qf?qf:x()}function s(){var a=rf?rf:y();return a>0?a:320}function t(){return Yd(nf.data.targets)?0:sf?sf:Ng||!_g||eh?1:v("y")}function u(){var a=1;return Yd(nf.data.targets)?0:tf?tf:ui?P()+(ih&&!Ng?v("y2"):a):ih?nh||Ng?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||_g?"y2"!==a||ih?(gb(a).isInner?30:40)+("y2"===a?-10:0):Ai:Jg&&!ui?10:1}function x(){return+mf.select(pf).style("width").replace("px","")}function y(){return+mf.select(pf).style("height").replace("px","")}function z(a){return a?-5:-(Af.left-1)}function A(a){return a?-20:-1}function B(){return z(!Ng)}function C(){return A(!Ng)}function D(){return z(Ng)}function E(){return A(Ng)}function F(a){return a?Df+2+4:Af.left+20}function G(a){return a?80:Ff+2}function H(){return F(!Ng)}function I(){return G(!Ng)}function J(){return F(Ng)}function K(){return G(Ng)}function L(){var a=Ng?Ff:Df,b=vc(),c=Vb()*(Ud(nf.data.targets)?(b-(di?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){vi=a}function N(a){wi=a}function O(a){xi=a}function P(){return Jg?ui?wi*(vi+1):Hf:0}function Q(){return Jg?ui?If:xi*(vi+1):0}function R(){var a,b=!Yf;Qf=Ng?1:0,Rf=Ng?Ff:Df,Sf=Ng?0:Ff,Tf=Ng?Df:1,Uf=Qf,Vf=Rf,Wf=Ng?0:Gf,Xf=Ng?Ef:1,Yf=T(Qf,Rf,b?void 0:Yf.domain(),function(){return cg.tickOffset()}),Zf=U(Sf,Tf),$f=U(Sf,Tf),_f=T(Qf,Rf,Ni,function(a){return a%1?0:fg.tickOffset()}),ag=U(Wf,Xf),bg=U(Wf,Xf),a=$(),cg=X(Yf,pi,a),fg=X(_f,si,a),dg=Y(Zf,qi,fh,hh),eg=Y($f,ri,oh,qh),b||(Bi.scale(_f),uf&&Fi.scale(Yf)),S()}function S(){Mf=Db(),Nf=Eb(),Of=Eb(.98)}function T(a,b,e,f){var g=(ci?mf.time.scale():mf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),di){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return mf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?$f:Zf}function W(a){return"y2"===Z(a)?bg:ag}function X(a,b,c){var d=(di?Bb():mf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),di?d.tickCentered(Rg):d.tickOffset=function(){var a=Ng?Ff:Df;return a*Vb()/vc()/2},di&&d.categories(Qg),d}function Y(a,b,c,d){return mf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in ng?ng[a]:"y"}function $(){var a=ci?mi:di?Oc:function(a){return 0>a?a.toFixed(0):a};return Sg&&("function"==typeof Sg?a=Sg:ci&&(a=function(a){return li(Sg)(a)})),a}function _(a){var b;return"y"===a?b=dh:"y2"===a?b=mh:"x"===a&&(b=$g),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?dh=b:"y2"===a?mh=b:"x"===a&&($g=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Ng?"inner-top":"inner-right")}function eb(){return cb("y",Ng?"inner-right":"inner-top")}function fb(){return cb("y2",Ng?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?Df/2:Df:b.isBottom?-Ff:b.isMiddle?-Ff/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Ng,db())}function ob(){return kb(Ng,eb())}function pb(){return kb(Ng,fb())}function qb(){return lb(!Ng,db())}function rb(){return lb(Ng,eb())}function sb(){return lb(Ng,fb())}function tb(){var a=db();return Ng?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Ng?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Ng?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Ng,db())}function xb(){return mb(Ng,eb())}function yb(){return mb(Ng,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Ii.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Ii.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Ii.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return mf.min(Object.keys(i).map(function(a){return mf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(mg.length>0)for(g=Nc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return mf.max(Object.keys(i).map(function(a){return mf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?kh:bh,n="y2"===c?jh:ah,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?lh:ch,r=pd()&&Ng;return 0===l.length?"y2"===c?$f.domain():Zf.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=qd(o,p),j=$b(Zf.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&gh&&(f=b(gh.top)?gh.top:e,g=b(gh.bottom)?gh.bottom:e),"y2"===c&&ph&&(f=b(ph.top)?ph.top:e,g=b(ph.bottom)?ph.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Ni),c=$b(Yf.domain());return a||0===c?1:b/c}function Wb(a){return Yg?Yg:mf.min(a,function(a){return mf.min(a.values,function(a){return a.x})})}function Xb(a){return Xg?Xg:mf.max(a,function(a){return mf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return di?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=ci?new Date(c.getTime()-e):c-e,g=ci?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return gg&&a===gg||ne(hg)&&oe(hg,a)}function fc(a){return!ec(a)}function gc(a){return gg?gg:ne(hg)?hg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=nf.data.xs[b])}),c}function ic(a,b){return a in nf.data.xs&&nf.data.xs[a]&&nf.data.xs[a][b]?nf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){hg[b]=a[b]})}function kc(a){return 1===mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=kg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),nf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=ci?a?a instanceof Date?a:ie(a):ie(ic(b,c)):ei&&!di?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):gg?(d=Object.keys(nf.data.xs),nf.data.xs[c]=d.length>0?nf.data.xs[d[0]]:void 0):ne(hg)&&(nf.data.xs[c]=hc(f,nf.data.targets)):nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=jg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return ei&&di&&0===c&&g&&(0===e&&(Qg=[]),Qg.push(g)),("undefined"==typeof a[b]||nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),og&&Sd(xc(c).filter(function(a){return!(a in pg)}),og),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function tc(a){return a>0&&nf.data.targets[0].values[a-1]?nf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?nf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?nf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(nf.data.targets)}function zc(a,b){var c,d=xc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(ci?new Date(h):h);i.push(d)}return i}function Gc(a){ni=ni.concat(a)}function Hc(a){ni=ni.filter(function(b){return a.indexOf(b)<0})}function Ic(a){oi=oi.concat(a)}function Jc(a){oi=oi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Ed(){return rg&&"desc"===rg.toLowerCase()}function Fd(){return rg&&"asc"===rg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof rg&&a.sort(rg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(nf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Rh&&0!==m.length&&(Li.html(Uh(a,$(),l,ki)).style("display","block"),d=Li.property("offsetWidth"),e=Li.property("offsetHeight"),k?(g=Df/2+c[0],i=Ff/2+c[1]+20):(Ng?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Yf(m[0].x)+20):(f=q(),g=f+t()+Yf(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Li.style("top",i+"px").style("left",g+"px"))}function Id(){Li.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Rh&&(Vd(nf.data.targets)||Yd(nf.data.targets)||Ii.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Ng?"y1":"x1",ud).attr(Ng?"y2":"x2",ud))}function Kd(){Ii.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?Yf(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Dh?Dh:b?2*a.tickOffset()*Eh/b:0}function Sd(a,b){yc(a).forEach(function(a){Pi[a]=b===pg[a],pg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){pg[a.id]===b&&(c=!0),a.id in pg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in pg)||"line"===pg[b]||"spline"===pg[b]||"area"===pg[b]||"area-spline"===pg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===pg[b]||"area-spline"===pg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===pg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===pg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===pg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===pg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ie(b){var c;if(!b)throw Error(b+" can not be parsed as d3.time with format "+ig+". Maybe 'x' of this data is not defined. See data.x or data.xs option.");try{c=ig?mf.time.format(ig).parse(b):new Date(b)}catch(d){c=void 0}return c||a.console.error("Failed to parse x '"+b+"' to Date with format "+ig),c}function je(a,b){var c=mf.mouse(a),d=mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?Zf:$f,d=Ng?1:0,e=Ng?0:1;return Math.pow(Yf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Cg(b,a.node()),Ii.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md).attr("stroke",function(){return ki(b)}).attr("r",1.4*Ch).transition().duration(100).attr("r",Ch)}function se(a,b,c){Dg(b,a.node()),Ii.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Cg(b,a.node()),a.transition().duration(100).style("fill",function(){return mf.rgb(ki(b)).darker(1)})}function ve(a,b){Dg(b,a.node()),a.transition().duration(100).style("fill",function(){return ki(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Ii.selectAll("."+f.circles+gd(c)):Ii).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",Bh)}function Ae(a){ye(a).filter(function(){return mf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",yh)}function Be(a){return Ii.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Ng?1:0,f=Ng?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Ng?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBoundingClientRect();return Ng?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(cg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Ng&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Je(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function Ke(b){var c,d,e;if(Mi=mf.select(pf),Mi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Mi.html(""),Mi.classed("c3",!0),nf.data.xs={},nf.data.targets=rc(b),n(),R(),Yf.domain(mf.extent(Zb(nf.data.targets))),Zf.domain(Ub(nf.data.targets,"y")),$f.domain(Ub(nf.data.targets,"y2")),_f.domain(Yf.domain()),ag.domain(Zf.domain()),bg.domain($f.domain()),Ni=Yf.domain(),Bi.scale(_f),uf&&Fi.scale(Yf),Gi=Mi.append("svg").attr("width",Df+Af.left+Af.right).attr("height",Ff+Af.top+Af.bottom).on("mouseenter",xf).on("mouseleave",yf),Hi=Gi.append("defs"),Hi.append("clipPath").attr("id",Yh).append("rect").attr("width",Df).attr("height",Ff),Hi.append("clipPath").attr("id",Zh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Hi.append("clipPath").attr("id",$h).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Ii=Gi.append("g").attr("transform",ti.main),Ji=Gg?Gi.append("g").attr("transform",ti.context):null,Ki=Gi.append("g").attr("transform",ti.legend),Jg||(Ki.style("visibility","hidden"),oi=xc(nf.data.targets)),Li=mf.select(pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),gf(xc(nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Ii.append("g").attr("class",f.axisX).attr("clip-path",Ng?"":ai).attr("transform",ti.x).append("text").attr("class",f.axisXLabel).attr("transform",Ng?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),_g&&Ii.append("g").attr("class",f.axisY).attr("clip-path",Ng?bi:"").attr("transform",ti.y).append("text").attr("class",f.axisYLabel).attr("transform",Ng?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),ih&&Ii.append("g").attr("class",f.axisY2).attr("transform",ti.y2).append("text").attr("class",f.axisY2Label).attr("transform",Ng?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Ii.append("g").attr("clip-path",_h).attr("class",f.grid),rh&&d.append("g").attr("class",f.xgrids),ne(th)&&d.append("g").attr("class",f.xgridLines),zh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),uh&&d.append("g").attr("class",f.ygrids),ne(vh)&&d.append("g").attr("class",f.ygridLines),Ii.append("g").attr("clip-path",_h).attr("class",f.regions),Ii.append("g").attr("clip-path",_h).attr("class",f.chart),c=Ii.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",uf?Ng?"ns-resize":"ew-resize":null),Ii.select("."+f.chart).append("g").attr("class",f.chartBars),Ii.select("."+f.chart).append("g").attr("class",f.chartLines),Ii.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",ti.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Ii.select("."+f.chart).append("g").attr("class",f.chartTexts),uf&&Ii.insert("rect",wf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Df).attr("height",Ff).style("opacity",0).style("cursor",Ng?"ns-resize":"ew-resize").call(Fi).on("dblclick.zoom",null),Zg&&Bi.extent("function"!=typeof Zg?Zg:Zg(Zb())),Gg&&(Ji.append("g").attr("clip-path",_h).attr("class",f.chart),Ji.select("."+f.chart).append("g").attr("class",f.chartBars),Ji.select("."+f.chart).append("g").attr("class",f.chartLines),Ji.append("g").attr("clip-path",_h).attr("class",f.brush).call(Bi).selectAll("rect").attr(Ng?"width":"height",Ng?Ef:Gf),Ji.append("g").attr("class",f.axisX).attr("transform",ti.subx).attr("clip-path",Ng?"":ai)),Xe(nf.data.targets),Ng?Ii.select("."+f.axisX).style("opacity",0).call(cg):(Ii.select("."+f.axisY).style("opacity",0).call(dg),Ii.select("."+f.axisY2).style("opacity",0).call(eg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Vh){if(ci&&"string"==typeof Wh){for(Wh=ie(Wh),e=0;eDf&&(Df=0),0>Ff&&(Ff=0),Bf={top:Ng?Af.top:If-Hg-(ui?0:a),right:0/0,bottom:20+(ui?0:a),left:Ng?yi:Af.left},Ef=Ng?Af.left-yi-zi:Df,Gf=Ng?Ff:If-Bf.top-Bf.bottom,0>Ef&&(Ef=0),0>Gf&&(Gf=0),Cf={top:ui?0:If-a,right:0/0,bottom:0,left:ui?Hf-b:0},p(),ui&&Yd(nf.data.targets)&&(Cf.left=Df/2+Kf)}function o(){Ii.select("line."+f.xgridFocus).attr("x1",Ng?0:-10).attr("x2",Ng?Df:-10).attr("y1",Ng?-10:Af.top).attr("y2",Ng?-10:Ff)}function p(){Kf=Ff/2,Jf=.95*Kf,Lf=Xd(nf.data.targets)?.6*Jf:0}function q(){var a=Ng?f.axisX:f.axisY,b=mf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=mf.select(pf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return qf?qf:x()}function s(){var a=rf?rf:y();return a>0?a:320}function t(){return Yd(nf.data.targets)?0:sf?sf:Ng||!_g||eh?1:v("y")}function u(){var a=1;return Yd(nf.data.targets)?0:tf?tf:ui?P()+(ih&&!Ng?v("y2"):a):ih?nh||Ng?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||_g?"y2"!==a||ih?(gb(a).isInner?30:40)+("y2"===a?-10:0):Ai:Jg&&!ui?10:1}function x(){return+mf.select(pf).style("width").replace("px","")}function y(){return+mf.select(pf).style("height").replace("px","")}function z(a){return a?-5:-(Af.left-1)}function A(a){return a?-20:-1}function B(){return z(!Ng)}function C(){return A(!Ng)}function D(){return z(Ng)}function E(){return A(Ng)}function F(a){return a?Df+2+4:Af.left+20}function G(a){return a?80:Ff+2}function H(){return F(!Ng)}function I(){return G(!Ng)}function J(){return F(Ng)}function K(){return G(Ng)}function L(){var a=Ng?Ff:Df,b=vc(),c=Vb()*(Ud(nf.data.targets)?(b-(di?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){vi=a}function N(a){wi=a}function O(a){xi=a}function P(){return Jg?ui?wi*(vi+1):Hf:0}function Q(){return Jg?ui?If:xi*(vi+1):0}function R(){var a,b=!Yf;Qf=Ng?1:0,Rf=Ng?Ff:Df,Sf=Ng?0:Ff,Tf=Ng?Df:1,Uf=Qf,Vf=Rf,Wf=Ng?0:Gf,Xf=Ng?Ef:1,Yf=T(Qf,Rf,b?void 0:Yf.domain(),function(){return cg.tickOffset()}),Zf=U(Sf,Tf),$f=U(Sf,Tf),_f=T(Qf,Rf,Ni,function(a){return a%1?0:fg.tickOffset()}),ag=U(Wf,Xf),bg=U(Wf,Xf),a=$(),cg=X(Yf,pi,a),fg=X(_f,si,a),dg=Y(Zf,qi,fh,hh),eg=Y($f,ri,oh,qh),b||(Bi.scale(_f),uf&&Fi.scale(Yf)),S()}function S(){Mf=Db(),Nf=Eb(),Of=Eb(.98)}function T(a,b,e,f){var g=(ci?mf.time.scale():mf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),di){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return mf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?$f:Zf}function W(a){return"y2"===Z(a)?bg:ag}function X(a,b,c){var d=(di?Bb():mf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),di?d.tickCentered(Rg):d.tickOffset=function(){var a=Ng?Ff:Df;return a*Vb()/vc()/2},di&&d.categories(Qg),d}function Y(a,b,c,d){return mf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in ng?ng[a]:"y"}function $(){var a=ci?mi:di?Oc:function(a){return 0>a?a.toFixed(0):a};return Sg&&("function"==typeof Sg?a=Sg:ci&&(a=function(a){return li(Sg)(a)})),a}function _(a){var b;return"y"===a?b=dh:"y2"===a?b=mh:"x"===a&&(b=$g),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?dh=b:"y2"===a?mh=b:"x"===a&&($g=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Ng?"inner-top":"inner-right")}function eb(){return cb("y",Ng?"inner-right":"inner-top")}function fb(){return cb("y2",Ng?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?Df/2:Df:b.isBottom?-Ff:b.isMiddle?-Ff/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Ng,db())}function ob(){return kb(Ng,eb())}function pb(){return kb(Ng,fb())}function qb(){return lb(!Ng,db())}function rb(){return lb(Ng,eb())}function sb(){return lb(Ng,fb())}function tb(){var a=db();return Ng?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Ng?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Ng?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Ng,db())}function xb(){return mb(Ng,eb())}function yb(){return mb(Ng,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Ii.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Ii.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Ii.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return mf.min(Object.keys(i).map(function(a){return mf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(mg.length>0)for(g=Nc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return mf.max(Object.keys(i).map(function(a){return mf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?kh:bh,n="y2"===c?jh:ah,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?lh:ch,r=pd()&&Ng;return 0===l.length?"y2"===c?$f.domain():Zf.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=qd(o,p),j=$b(Zf.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&gh&&(f=b(gh.top)?gh.top:e,g=b(gh.bottom)?gh.bottom:e),"y2"===c&&ph&&(f=b(ph.top)?ph.top:e,g=b(ph.bottom)?ph.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Ni),c=$b(Yf.domain());return a||0===c?1:b/c}function Wb(a){return Yg?Yg:mf.min(a,function(a){return mf.min(a.values,function(a){return a.x})})}function Xb(a){return Xg?Xg:mf.max(a,function(a){return mf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return di?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=0,g=0;return(c||0===c)&&(f=ci?new Date(c.getTime()-e):c-e),(d||0===d)&&(g=ci?new Date(d.getTime()+e):d+e),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return gg&&a===gg||ne(hg)&&oe(hg,a)}function fc(a){return!ec(a)}function gc(a){return gg?gg:ne(hg)?hg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=nf.data.xs[b])}),c}function ic(a,b){return a in nf.data.xs&&nf.data.xs[a]&&nf.data.xs[a][b]?nf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){hg[b]=a[b]})}function kc(a){return 1===mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=kg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),nf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=ci?a?a instanceof Date?a:ie(a):ie(ic(b,c)):ei&&!di?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):gg?(d=Object.keys(nf.data.xs),nf.data.xs[c]=d.length>0?nf.data.xs[d[0]]:void 0):ne(hg)&&(nf.data.xs[c]=hc(f,nf.data.targets)):nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=jg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return ei&&di&&0===c&&g&&(0===e&&(Qg=[]),Qg.push(g)),("undefined"==typeof a[b]||nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),og&&Sd(xc(c).filter(function(a){return!(a in pg)}),og),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function tc(a){return a>0&&nf.data.targets[0].values[a-1]?nf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?nf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?nf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(nf.data.targets)}function zc(a,b){var c,d=xc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(ci?new Date(h):h);i.push(d)}return i}function Gc(a){ni=ni.concat(a)}function Hc(a){ni=ni.filter(function(b){return a.indexOf(b)<0})}function Ic(a){oi=oi.concat(a)}function Jc(a){oi=oi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Ed(){return rg&&"desc"===rg.toLowerCase()}function Fd(){return rg&&"asc"===rg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof rg&&a.sort(rg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(nf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Rh&&0!==m.length&&(Li.html(Uh(a,$(),l,ki)).style("display","block"),d=Li.property("offsetWidth"),e=Li.property("offsetHeight"),k?(g=Df/2+c[0],i=Ff/2+c[1]+20):(Ng?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Yf(m[0].x)+20):(f=q(),g=f+t()+Yf(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Li.style("top",i+"px").style("left",g+"px"))}function Id(){Li.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Rh&&(Vd(nf.data.targets)||Yd(nf.data.targets)||Ii.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Ng?"y1":"x1",ud).attr(Ng?"y2":"x2",ud))}function Kd(){Ii.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?Yf(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Dh?Dh:b?2*a.tickOffset()*Eh/b:0}function Sd(a,b){yc(a).forEach(function(a){Pi[a]=b===pg[a],pg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){pg[a.id]===b&&(c=!0),a.id in pg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in pg)||"line"===pg[b]||"spline"===pg[b]||"area"===pg[b]||"area-spline"===pg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===pg[b]||"area-spline"===pg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===pg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===pg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===pg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===pg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ie(b){var c;try{c=ig?mf.time.format(ig).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ig)}return c}function je(a,b){var c=mf.mouse(a),d=mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?Zf:$f,d=Ng?1:0,e=Ng?0:1;return Math.pow(Yf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Cg(b,a.node()),Ii.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md).attr("stroke",function(){return ki(b)}).attr("r",1.4*Ch).transition().duration(100).attr("r",Ch)}function se(a,b,c){Dg(b,a.node()),Ii.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Cg(b,a.node()),a.transition().duration(100).style("fill",function(){return mf.rgb(ki(b)).darker(1)})}function ve(a,b){Dg(b,a.node()),a.transition().duration(100).style("fill",function(){return ki(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Ii.selectAll("."+f.circles+gd(c)):Ii).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",Bh)}function Ae(a){ye(a).filter(function(){return mf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",yh)}function Be(a){return Ii.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Ng?1:0,f=Ng?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Ng?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBoundingClientRect();return Ng?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(cg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Ng&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Je(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function Ke(b){var c,d,e;if(Mi=mf.select(pf),Mi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Mi.html(""),Mi.classed("c3",!0),nf.data.xs={},nf.data.targets=rc(b),n(),R(),Yf.domain(mf.extent(Zb(nf.data.targets))),Zf.domain(Ub(nf.data.targets,"y")),$f.domain(Ub(nf.data.targets,"y2")),_f.domain(Yf.domain()),ag.domain(Zf.domain()),bg.domain($f.domain()),Ni=Yf.domain(),Bi.scale(_f),uf&&Fi.scale(Yf),Gi=Mi.append("svg").attr("width",Df+Af.left+Af.right).attr("height",Ff+Af.top+Af.bottom).on("mouseenter",xf).on("mouseleave",yf),Hi=Gi.append("defs"),Hi.append("clipPath").attr("id",Yh).append("rect").attr("width",Df).attr("height",Ff),Hi.append("clipPath").attr("id",Zh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Hi.append("clipPath").attr("id",$h).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Ii=Gi.append("g").attr("transform",ti.main),Ji=Gg?Gi.append("g").attr("transform",ti.context):null,Ki=Gi.append("g").attr("transform",ti.legend),Jg||(Ki.style("visibility","hidden"),oi=xc(nf.data.targets)),Li=mf.select(pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),gf(xc(nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Ii.append("g").attr("class",f.axisX).attr("clip-path",Ng?"":ai).attr("transform",ti.x).append("text").attr("class",f.axisXLabel).attr("transform",Ng?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),_g&&Ii.append("g").attr("class",f.axisY).attr("clip-path",Ng?bi:"").attr("transform",ti.y).append("text").attr("class",f.axisYLabel).attr("transform",Ng?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),ih&&Ii.append("g").attr("class",f.axisY2).attr("transform",ti.y2).append("text").attr("class",f.axisY2Label).attr("transform",Ng?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Ii.append("g").attr("clip-path",_h).attr("class",f.grid),rh&&d.append("g").attr("class",f.xgrids),ne(th)&&d.append("g").attr("class",f.xgridLines),zh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),uh&&d.append("g").attr("class",f.ygrids),ne(vh)&&d.append("g").attr("class",f.ygridLines),Ii.append("g").attr("clip-path",_h).attr("class",f.regions),Ii.append("g").attr("clip-path",_h).attr("class",f.chart),c=Ii.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",uf?Ng?"ns-resize":"ew-resize":null),Ii.select("."+f.chart).append("g").attr("class",f.chartBars),Ii.select("."+f.chart).append("g").attr("class",f.chartLines),Ii.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",ti.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Ii.select("."+f.chart).append("g").attr("class",f.chartTexts),uf&&Ii.insert("rect",wf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Df).attr("height",Ff).style("opacity",0).style("cursor",Ng?"ns-resize":"ew-resize").call(Fi).on("dblclick.zoom",null),Zg&&Bi.extent("function"!=typeof Zg?Zg:Zg(Zb())),Gg&&(Ji.append("g").attr("clip-path",_h).attr("class",f.chart),Ji.select("."+f.chart).append("g").attr("class",f.chartBars),Ji.select("."+f.chart).append("g").attr("class",f.chartLines),Ji.append("g").attr("clip-path",_h).attr("class",f.brush).call(Bi).selectAll("rect").attr(Ng?"width":"height",Ng?Ef:Gf),Ji.append("g").attr("class",f.axisX).attr("transform",ti.subx).attr("clip-path",Ng?"":ai)),Xe(nf.data.targets),Ng?Ii.select("."+f.axisX).style("opacity",0).call(cg):(Ii.select("."+f.axisY).style("opacity",0).call(dg),Ii.select("."+f.axisY2).style("opacity",0).call(eg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Vh){if(ci&&"string"==typeof Wh){for(Wh=ie(Wh),e=0;e0){d=[];for(var g in kg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function Pe(a){Yd(nf.data.targets)||vg&&(fi=a,Ii.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),gi=!0,Eg())}function Qe(){Yd(nf.data.targets)||vg&&(Ii.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Ii.selectAll("."+f.shape).classed(f.INCLUDED,!1),gi=!1,Fg())}function Re(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Nd(),U=Yd(nf.data.targets),V=Dc(nf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?zf:0,O=B?N:0,P=C?N:0,H&&Jg&&gf(xc(nf.data.targets),a),G&&(Yf.domain(mf.extent(Zb(V))),Ni=Yf.domain(),uf&&Fi.scale(Yf).updateScaleExtent(),_f.domain(Yf.domain()),Bi.scale(_f)),F&&(Yf.domain(Bi.empty()?Ni:Bi.extent()),uf&&Fi.scale(Yf).updateScaleExtent()),Zf.domain(Ub(V,"y")),$f.domain(Ub(V,"y2")),Vd(V)||(Q=Fc(Ec(V)).sort(),cg.tickValues(Q),fg.tickValues(Q)),c=Ii.select("."+f.axisX).style("opacity",U?0:1),(Ng||D)&&(c=c.transition().duration(P)),c.call(cg),e=Ii.select("."+f.axisY).style("opacity",U?0:1),(!Ng||D)&&(e=e.transition().duration(P)),e.call(dg),Ii.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(eg),F&&Tg&&Q){for(R=1;R=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=Yf.ticks(10);g=Ii.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Ng?0:function(a){return Yf(a)-cg.tickOffset()}).attr("x2",Ng?Df:function(a){return Yf(a)-cg.tickOffset()}).attr("y1",Ng?function(a){return Yf(a)-cg.tickOffset()}:Af.top).attr("y2",Ng?function(a){return Yf(a)-cg.tickOffset()}:Ff).style("opacity",function(){return+mf.select(this).attr(Ng?"y1":"x1")===(Ng?Ff:0)?0:1}),g.exit().remove()}ne(th)&&(i=Ii.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(th),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Ng?"":"rotate(-90)").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Ng?0:vd).attr("x2",Ng?Df:vd).attr("y1",Ng?vd:Af.top).attr("y2",Ng?vd:Ff).style("opacity",1),i.select("text").transition().duration(N).attr("x",Ng?Df:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&uh&&(k=Ii.select("."+f.ygrids).selectAll("."+f.ygrid).data(Zf.ticks(wh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Ng?Zf:0).attr("x2",Ng?Zf:Df).attr("y1",Ng?0:Zf).attr("y2",Ng?Ff:Zf),k.exit().remove()),y&&ne(vh)&&(l=Ii.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(vh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Ng?"rotate(-90)":"").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Ng?wd:0).attr("x2",Ng?wd:Df).attr("y1",Ng?0:wd).attr("y2",Ng?Ff:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Ng?0:Df).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Ii.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ki(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Ii.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Ng?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Ii.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ci).style("opacity",1),Ii.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Di).style("opacity",Oi),n=Ii.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",yh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),n.exit().remove(),Ii.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=mf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Ii.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Ii.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Gg&&(null!==mf.event&&"zoom"===mf.event.type&&Bi.extent(Yf.orgDomain()).update(),z&&(Ji.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(fg),Bi.empty()||Bi.extent(Yf.orgDomain()).update(),J=Ee(T,!0),s=Ji.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ki(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Ji.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ei).style("opacity",1))),Ii.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Ii.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),t=Ii.select("."+f.eventRects),ne(hg)&&!kc(hg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Ii.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Df).attr("height",Ff)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),ei&&!di?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return(Yf(d?d:e+50)-Yf(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return(Yf(d)+Yf(c?c:d-50))/2}):(x=L(),w=function(a){return Yf(a.x)-x/2}),v=wc(),Ii.select("."+f.eventRects).datum(v?v.values:[]),u=Ii.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Ng?0:w).attr("y",Ng?w:0).attr("width",Ng?Df:x).attr("height",Ng?x:Ff),u.exit().remove()),q=Ii.select("."+f.regions).selectAll("rect."+f.region).data(Qh),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Ng?0:cc).attr("y",Ng?cc:Af.top).attr("width",Ng?Df:dc).attr("height",Ng?dc:Ff).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),xc(nf.data.targets).forEach(function(a){Pi[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Fi.altDomain?(Yf.domain(Fi.altDomain),void Fi.scale(Yf).updateScaleExtent()):(di&&Yf.orgDomain()[0]===Ni[0]&&Yf.domain([Ni[0]-1e-10,Yf.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(hi=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Gi.attr("width",Hf).attr("height",If),Gi.select("#"+Yh).select("rect").attr("width",Df).attr("height",Ff),Gi.select("#"+Zh).select("rect").attr("width",H),Gi.select("#"+$h).select("rect").attr("width",J),Gi.select("."+f.zoomRect).attr("width",Df).attr("height",Ff)}function We(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Ii.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ki(a)}),e=Ii.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ki(a)}).style("stroke","none").style("cursor",function(a){return xg(a)?"pointer":null}),c=Ii.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ki(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Oi=+mf.select(this).style("opacity"),0}).style("fill",function(a){return ki(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ki(a)}).style("cursor",function(a){return xg(a)?"pointer":null}),a.forEach(function(a){Ii.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Ii.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Pf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ki(a.data)}).style("cursor",function(a){return xg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Gg&&(n=Ji.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ki(a)}),l=Ji.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ki(a)})),Gi.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=ui?j:i,l=ui?Q():P();return d&&(w=0,C=0,t=0,u=0),Jg&&!Cc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=ui?u:t,void(Mg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,ui?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Ki.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Lg?Lg(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",ui?g:-200).attr("y",ui?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",ui?h:-200).attr("y",ui?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return ki(a)}).attr("x",ui?g:-200).attr("y",ui?-200:i).attr("width",10).attr("height",10),Ki.selectAll("text").data(a).text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ki.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ki.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["transition","duration"],350);g("data","data is required in config");var Af,Bf,Cf,Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg=h(["data","x"]),hg=h(["data","xs"],{}),ig=h(["data","x_format"]),jg=h(["data","id_converter"],function(a){return a}),kg=h(["data","names"],{}),lg=h(["data","classes"],{}),mg=h(["data","groups"],[]),ng=h(["data","axes"],{}),og=h(["data","type"]),pg=h(["data","types"],{}),qg=h(["data","labels"],{}),rg=h(["data","order"]),sg=h(["data","regions"],{}),tg=h(["data","color"]),ug=h(["data","colors"],{}),vg=h(["data","selection","enabled"],!1),wg=h(["data","selection","grouped"],!1),xg=h(["data","selection","isselectable"],function(){return!0}),yg=h(["data","selection","multiple"],!0),zg=h(["data","onclick"],function(){}),Ag=h(["data","onenter"],function(){}),Bg=h(["data","onleave"],function(){}),Cg=h(["data","onselected"],function(){}),Dg=h(["data","onunselected"],function(){}),Eg=h(["data","ondragstart"],function(){}),Fg=h(["data","ondragend"],function(){}),Gg=h(["subchart","show"],!1),Hg=Gg?h(["subchart","size","height"],60):0,Ig=h(["color","pattern"],[]),Jg=h(["legend","show"],!0),Kg=h(["legend","position"],"bottom"),Lg=h(["legend","item","onclick"]),Mg=h(["legend","equally"],!1),Ng=h(["axis","rotated"],!1),Og=h(["axis","x","type"],"indexed"),Pg=h(["axis","x","localtime"],!1),Qg=h(["axis","x","categories"],[]),Rg=h(["axis","x","tick","centered"],!1),Sg=h(["axis","x","tick","format"]),Tg=h(["axis","x","tick","culling"],{}),Ug=h(["axis","x","tick","culling","max"],"categorized"===Og?1/0:10),Vg=h(["axis","x","tick","count"]),Wg=h(["axis","x","tick","fit"],!1),Xg=h(["axis","x","max"]),Yg=h(["axis","x","min"]),Zg=h(["axis","x","default"]),$g=h(["axis","x","label"],{}),_g=h(["axis","y","show"],!0),ah=h(["axis","y","max"]),bh=h(["axis","y","min"]),ch=h(["axis","y","center"]),dh=h(["axis","y","label"],{}),eh=h(["axis","y","inner"],!1),fh=h(["axis","y","tick","format"]),gh=h(["axis","y","padding"],{}),hh=h(["axis","y","ticks"],10),ih=h(["axis","y2","show"],!1),jh=h(["axis","y2","max"]),kh=h(["axis","y2","min"]),lh=h(["axis","y2","center"]),mh=h(["axis","y2","label"],{}),nh=h(["axis","y2","inner"],!1),oh=h(["axis","y2","tick","format"]),ph=h(["axis","y2","padding"],{}),qh=h(["axis","y2","ticks"],10),rh=h(["grid","x","show"],!1),sh=h(["grid","x","type"],"tick"),th=h(["grid","x","lines"],[]),uh=h(["grid","y","show"],!1),vh=h(["grid","y","lines"],[]),wh=h(["grid","y","ticks"],10),xh=h(["point","show"],!0),yh=xh?h(["point","r"],2.5):0,zh=h(["point","focus","line","enabled"],!0),Ah=h(["point","focus","expand","enabled"],!0),Bh=h(["point","focus","expand","r"],Ah?4:yh),Ch=h(["point","focus","select","r"],8),Dh=h(["bar","width"]),Eh=h(["bar","width","ratio"],.6),Fh=h(["pie","label","show"],!0),Gh=h(["pie","label","format"]),Hh=h(["pie","onclick"],function(){}),Ih=h(["pie","onmouseover"],function(){}),Jh=h(["pie","onmouseout"],function(){}),Kh=h(["donut","label","show"],!0),Lh=h(["donut","label","format"]),Mh=h(["donut","title"],""),Nh=h(["donut","onclick"],function(){}),Oh=h(["donut","onmouseover"],function(){}),Ph=h(["donut","onmouseout"],function(){}),Qh=h(["regions"],[]),Rh=h(["tooltip","show"],!0),Sh=h(["tooltip","format","title"]),Th=h(["tooltip","format","value"]),Uh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Sh?Sh:b,l=Th?Th:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Vh=h(["tooltip","init","show"],!1),Wh=h(["tooltip","init","x"],0),Xh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Yh=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",Zh=Yh+"-xaxis",$h=Yh+"-yaxis",_h=i(Yh),ai=i(Zh),bi=i($h),ci="timeseries"===Og,di="categorized"===Og,ei=!ci&&(gg||ne(hg)),fi=null,gi=!1,hi=!1,ii=!1,ji=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ki=he(ug,ne(Ig)?Ig:ji,tg),li=Pg?mf.time.format:mf.time.format.utc,mi=function(){var a=[[li("%Y/%-m/%-d"),function(){return!0}],[li("%-m/%-d"),function(a){return a.getMonth()}],[li("%-m/%-d"),function(a){return 1!==a.getDate()}],[li("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[li("%I %p"),function(a){return a.getHours()}],[li("%I:%M"),function(a){return a.getMinutes()}],[li(":%S"),function(a){return a.getSeconds()}],[li(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),ni=[],oi=[],pi=Ng?"left":"bottom",qi=Ng?eh?"top":"bottom":eh?"right":"left",ri=Ng?nh?"bottom":"top":nh?"left":"right",si=Ng?"left":"bottom",ti={main:function(){return"translate("+Af.left+","+Af.top+")"},context:function(){return"translate("+Bf.left+","+Bf.top+")"},legend:function(){return"translate("+Cf.left+","+Cf.top+")"},x:function(){return"translate(0,"+(Ng?0:Ff)+")"},y:function(){return"translate(0,"+(Ng?Ff:0)+")"},y2:function(){return"translate("+(Ng?0:Df)+","+(Ng?1:0)+")"},subx:function(){return"translate(0,"+(Ng?0:Gf)+")"},arc:function(){return"translate("+Df/2+","+Ff/2+")"}},ui="right"===Kg,vi=0,wi=0,xi=0,yi=30,zi=30,Ai=5;Pf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Bi,Ci=function(){var a=mf.svg.line().x(Ng?function(a){return V(a.id)(a.value)}:ud).y(Ng?ud:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=xe(b.values);return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),sg[b.id]?Je(e,Yf,V(b.id),sg[b.id]):a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Di=function(){var a;return a=Ng?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Ei=function(){var a=mf.svg.line().x(Ng?function(a){return W(a.id)(a.value)}:xd).y(Ng?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+_f(c[0].x)+" "+W(b.id)(c[0].value)}}(),Fi=function(){};Bi=mf.svg.brush().on("brush",Se),Bi.update=function(){return Ji&&Ji.select("."+f.brush).call(this),this},Bi.scale=function(a){return Ng?this.y(a):this.x(a)},uf&&(Fi=mf.behavior.zoom().on("zoomstart",function(){Fi.altDomain=mf.event.sourceEvent.altKey?Yf.orgDomain():null}).on("zoom",uf?Te:null),Fi.scale=function(a){return Ng?this.y(a):this.x(a)},Fi.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Fi.updateScaleExtent=function(){var a=$b(Yf.orgDomain())/$b(Ni),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Gi,Hi,Ii,Ji,Ki,Li,Mi,Ni,Oi,Pi={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Gi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Gi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Gi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Gi.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Ki.selectAll(kd(a)).classed(f.legendItemHidden,!1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Gi.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Ki.selectAll(kd(a)).classed(f.legendItemHidden,!0),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){Bi.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){lg[b]=a.classes[b]}),"categories"in a&&di&&(Qg=a.categories,cg.categories(Qg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Ii.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){vg&&Ii.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=wg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?xg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){vg&&Ii.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=wg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&xg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?mg:(mg=a,Re(),mg)},nf.xgrids=function(a){return a?(th=a,Re(),th):th},nf.xgrids.add=function(a){return a?nf.xgrids(th.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(th.filter(b))},nf.ygrids=function(a){return a?(vh=a,Re(),vh):vh},nf.ygrids.add=function(a){return a?nf.ygrids(vh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(vh.filter(b))},nf.regions=function(a){return c(a)?Qh:(Qh=a,Re(),Qh)},nf.regions.add=function(a){return c(a)?Qh:(Qh=Qh.concat(a),Re(),Qh)},nf.regions.remove=function(a,c){var e=[].concat(a);return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;Gi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Qh=Qh.filter(function(b){return b.classes.indexOf(a)<0})}),Qh},nf.data.get=function(a){var b=nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},nf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0 -},nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){kg[b]=a[b]}),gf(xc(nf.data.targets),{withTransition:!0}),kg):kg},nf.x=function(a){return arguments.length&&(mc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.xs=function(a){return arguments.length&&(nc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(ah=+a.y),b(a.y2)&&(jh=+a.y2)):ah=jh=+a,Re())},nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(bh=+a.y),b(a.y2)&&(kh=+a.y2)):bh=kh=+a,Re())},nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&nf.axis.max(a.max),"undefined"!=typeof a.min&&nf.axis.min(a.min))},nf.legend.show=function(a){Jg||(Jg=!0,Ki.style("visibility","visible")),ef(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.legend.hide=function(a){Jg&&me(a)&&(Jg=!1,Ki.style("visibility","hidden")),ff(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.resize=function(a){qf=a?a.width:null,rf=a?a.height:null,We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},nf.destroy=function(){nf.data.targets=void 0,nf.data.xs={},Mi.html(""),a.onresize=null},"url"in e.data)mf.csv(e.data.url,function(a,b){Ke(b)});else if("rows"in e.data)Ke(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ke(qc(e.data.columns))}return nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file +},nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){kg[b]=a[b]}),gf(xc(nf.data.targets),{withTransition:!0}),kg):kg},nf.x=function(a){return arguments.length&&(mc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.xs=function(a){return arguments.length&&(nc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(ah=+a.y),b(a.y2)&&(jh=+a.y2)):ah=jh=+a,Re())},nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(bh=+a.y),b(a.y2)&&(kh=+a.y2)):bh=kh=+a,Re())},nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&nf.axis.max(a.max),"undefined"!=typeof a.min&&nf.axis.min(a.min))},nf.legend.show=function(a){Jg||(Jg=!0,Ki.style("visibility","visible")),ef(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.legend.hide=function(a){Jg&&me(a)&&(Jg=!1,Ki.style("visibility","hidden")),ff(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.resize=function(a){qf=a?a.width:null,rf=a?a.height:null,We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},nf.destroy=function(){nf.data.targets=void 0,nf.data.xs={},Mi.html(""),a.onresize=null},"url"in e.data)mf.xhr(e.data.url,function(a,b){var c,d=mf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=mf.csv.parse(b.response),Ke(c)});else if("rows"in e.data)Ke(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ke(qc(e.data.columns))}return nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From adbe644efc39b99d029c0193214a9730196ebfd6 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Thu, 10 Apr 2014 23:55:19 +0900 Subject: [PATCH 035/178] Fix x axis tick --- c3.js | 11 +++++++---- c3.min.js | 6 +++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/c3.js b/c3.js index 87f7aae..777cbf9 100644 --- a/c3.js +++ b/c3.js @@ -1527,6 +1527,7 @@ tickValues.push(end); } } + if (!isTimeSeries) { tickValues = tickValues.sort(); } return tickValues; } function addHiddenTargetIds(targetIds) { @@ -3001,7 +3002,7 @@ // update axis tick values according to options, except for scatter plot if (! hasScatterType(targetsToShow)) { // TODO: fix this - tickValues = generateTickValues(mapTargetsToUniqueXs(targetsToShow)).sort(); + tickValues = generateTickValues(mapTargetsToUniqueXs(targetsToShow)); xAxis.tickValues(tickValues); subXAxis.tickValues(tickValues); } @@ -3029,9 +3030,11 @@ break; } } - d3.selectAll('.' + CLASS.axisX + ' .tick').sort(function (e1, e2) { return e1 - e2; }); - d3.selectAll('.' + CLASS.axisX + ' .tick text').each(function (e, i) { - d3.select(this).style('display', i % intervalForCulling ? 'none' : 'block'); + d3.selectAll('.' + CLASS.axisX + ' .tick text').each(function (e) { + var index = tickValues.indexOf(e); + if (index > 0) { + d3.select(this).style('display', index % intervalForCulling ? 'none' : 'block'); + } }); } diff --git a/c3.min.js b/c3.min.js index a38c8ea..82c9a54 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.29"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cDf&&(Df=0),0>Ff&&(Ff=0),Bf={top:Ng?Af.top:If-Hg-(ui?0:a),right:0/0,bottom:20+(ui?0:a),left:Ng?yi:Af.left},Ef=Ng?Af.left-yi-zi:Df,Gf=Ng?Ff:If-Bf.top-Bf.bottom,0>Ef&&(Ef=0),0>Gf&&(Gf=0),Cf={top:ui?0:If-a,right:0/0,bottom:0,left:ui?Hf-b:0},p(),ui&&Yd(nf.data.targets)&&(Cf.left=Df/2+Kf)}function o(){Ii.select("line."+f.xgridFocus).attr("x1",Ng?0:-10).attr("x2",Ng?Df:-10).attr("y1",Ng?-10:Af.top).attr("y2",Ng?-10:Ff)}function p(){Kf=Ff/2,Jf=.95*Kf,Lf=Xd(nf.data.targets)?.6*Jf:0}function q(){var a=Ng?f.axisX:f.axisY,b=mf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=mf.select(pf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return qf?qf:x()}function s(){var a=rf?rf:y();return a>0?a:320}function t(){return Yd(nf.data.targets)?0:sf?sf:Ng||!_g||eh?1:v("y")}function u(){var a=1;return Yd(nf.data.targets)?0:tf?tf:ui?P()+(ih&&!Ng?v("y2"):a):ih?nh||Ng?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||_g?"y2"!==a||ih?(gb(a).isInner?30:40)+("y2"===a?-10:0):Ai:Jg&&!ui?10:1}function x(){return+mf.select(pf).style("width").replace("px","")}function y(){return+mf.select(pf).style("height").replace("px","")}function z(a){return a?-5:-(Af.left-1)}function A(a){return a?-20:-1}function B(){return z(!Ng)}function C(){return A(!Ng)}function D(){return z(Ng)}function E(){return A(Ng)}function F(a){return a?Df+2+4:Af.left+20}function G(a){return a?80:Ff+2}function H(){return F(!Ng)}function I(){return G(!Ng)}function J(){return F(Ng)}function K(){return G(Ng)}function L(){var a=Ng?Ff:Df,b=vc(),c=Vb()*(Ud(nf.data.targets)?(b-(di?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){vi=a}function N(a){wi=a}function O(a){xi=a}function P(){return Jg?ui?wi*(vi+1):Hf:0}function Q(){return Jg?ui?If:xi*(vi+1):0}function R(){var a,b=!Yf;Qf=Ng?1:0,Rf=Ng?Ff:Df,Sf=Ng?0:Ff,Tf=Ng?Df:1,Uf=Qf,Vf=Rf,Wf=Ng?0:Gf,Xf=Ng?Ef:1,Yf=T(Qf,Rf,b?void 0:Yf.domain(),function(){return cg.tickOffset()}),Zf=U(Sf,Tf),$f=U(Sf,Tf),_f=T(Qf,Rf,Ni,function(a){return a%1?0:fg.tickOffset()}),ag=U(Wf,Xf),bg=U(Wf,Xf),a=$(),cg=X(Yf,pi,a),fg=X(_f,si,a),dg=Y(Zf,qi,fh,hh),eg=Y($f,ri,oh,qh),b||(Bi.scale(_f),uf&&Fi.scale(Yf)),S()}function S(){Mf=Db(),Nf=Eb(),Of=Eb(.98)}function T(a,b,e,f){var g=(ci?mf.time.scale():mf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),di){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return mf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?$f:Zf}function W(a){return"y2"===Z(a)?bg:ag}function X(a,b,c){var d=(di?Bb():mf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),di?d.tickCentered(Rg):d.tickOffset=function(){var a=Ng?Ff:Df;return a*Vb()/vc()/2},di&&d.categories(Qg),d}function Y(a,b,c,d){return mf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in ng?ng[a]:"y"}function $(){var a=ci?mi:di?Oc:function(a){return 0>a?a.toFixed(0):a};return Sg&&("function"==typeof Sg?a=Sg:ci&&(a=function(a){return li(Sg)(a)})),a}function _(a){var b;return"y"===a?b=dh:"y2"===a?b=mh:"x"===a&&(b=$g),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?dh=b:"y2"===a?mh=b:"x"===a&&($g=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Ng?"inner-top":"inner-right")}function eb(){return cb("y",Ng?"inner-right":"inner-top")}function fb(){return cb("y2",Ng?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?Df/2:Df:b.isBottom?-Ff:b.isMiddle?-Ff/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Ng,db())}function ob(){return kb(Ng,eb())}function pb(){return kb(Ng,fb())}function qb(){return lb(!Ng,db())}function rb(){return lb(Ng,eb())}function sb(){return lb(Ng,fb())}function tb(){var a=db();return Ng?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Ng?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Ng?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Ng,db())}function xb(){return mb(Ng,eb())}function yb(){return mb(Ng,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Ii.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Ii.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Ii.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return mf.min(Object.keys(i).map(function(a){return mf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(mg.length>0)for(g=Nc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return mf.max(Object.keys(i).map(function(a){return mf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?kh:bh,n="y2"===c?jh:ah,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?lh:ch,r=pd()&&Ng;return 0===l.length?"y2"===c?$f.domain():Zf.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=qd(o,p),j=$b(Zf.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&gh&&(f=b(gh.top)?gh.top:e,g=b(gh.bottom)?gh.bottom:e),"y2"===c&&ph&&(f=b(ph.top)?ph.top:e,g=b(ph.bottom)?ph.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Ni),c=$b(Yf.domain());return a||0===c?1:b/c}function Wb(a){return Yg?Yg:mf.min(a,function(a){return mf.min(a.values,function(a){return a.x})})}function Xb(a){return Xg?Xg:mf.max(a,function(a){return mf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return di?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=0,g=0;return(c||0===c)&&(f=ci?new Date(c.getTime()-e):c-e),(d||0===d)&&(g=ci?new Date(d.getTime()+e):d+e),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return gg&&a===gg||ne(hg)&&oe(hg,a)}function fc(a){return!ec(a)}function gc(a){return gg?gg:ne(hg)?hg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=nf.data.xs[b])}),c}function ic(a,b){return a in nf.data.xs&&nf.data.xs[a]&&nf.data.xs[a][b]?nf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){hg[b]=a[b]})}function kc(a){return 1===mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=kg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),nf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=ci?a?a instanceof Date?a:ie(a):ie(ic(b,c)):ei&&!di?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):gg?(d=Object.keys(nf.data.xs),nf.data.xs[c]=d.length>0?nf.data.xs[d[0]]:void 0):ne(hg)&&(nf.data.xs[c]=hc(f,nf.data.targets)):nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=jg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return ei&&di&&0===c&&g&&(0===e&&(Qg=[]),Qg.push(g)),("undefined"==typeof a[b]||nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),og&&Sd(xc(c).filter(function(a){return!(a in pg)}),og),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function tc(a){return a>0&&nf.data.targets[0].values[a-1]?nf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?nf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?nf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(nf.data.targets)}function zc(a,b){var c,d=xc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(ci?new Date(h):h);i.push(d)}return i}function Gc(a){ni=ni.concat(a)}function Hc(a){ni=ni.filter(function(b){return a.indexOf(b)<0})}function Ic(a){oi=oi.concat(a)}function Jc(a){oi=oi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Ed(){return rg&&"desc"===rg.toLowerCase()}function Fd(){return rg&&"asc"===rg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof rg&&a.sort(rg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(nf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Rh&&0!==m.length&&(Li.html(Uh(a,$(),l,ki)).style("display","block"),d=Li.property("offsetWidth"),e=Li.property("offsetHeight"),k?(g=Df/2+c[0],i=Ff/2+c[1]+20):(Ng?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Yf(m[0].x)+20):(f=q(),g=f+t()+Yf(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Li.style("top",i+"px").style("left",g+"px"))}function Id(){Li.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Rh&&(Vd(nf.data.targets)||Yd(nf.data.targets)||Ii.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Ng?"y1":"x1",ud).attr(Ng?"y2":"x2",ud))}function Kd(){Ii.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?Yf(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Dh?Dh:b?2*a.tickOffset()*Eh/b:0}function Sd(a,b){yc(a).forEach(function(a){Pi[a]=b===pg[a],pg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){pg[a.id]===b&&(c=!0),a.id in pg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in pg)||"line"===pg[b]||"spline"===pg[b]||"area"===pg[b]||"area-spline"===pg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===pg[b]||"area-spline"===pg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===pg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===pg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===pg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===pg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ie(b){var c;try{c=ig?mf.time.format(ig).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ig)}return c}function je(a,b){var c=mf.mouse(a),d=mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?Zf:$f,d=Ng?1:0,e=Ng?0:1;return Math.pow(Yf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Cg(b,a.node()),Ii.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md).attr("stroke",function(){return ki(b)}).attr("r",1.4*Ch).transition().duration(100).attr("r",Ch)}function se(a,b,c){Dg(b,a.node()),Ii.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Cg(b,a.node()),a.transition().duration(100).style("fill",function(){return mf.rgb(ki(b)).darker(1)})}function ve(a,b){Dg(b,a.node()),a.transition().duration(100).style("fill",function(){return ki(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Ii.selectAll("."+f.circles+gd(c)):Ii).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",Bh)}function Ae(a){ye(a).filter(function(){return mf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",yh)}function Be(a){return Ii.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Ng?1:0,f=Ng?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Ng?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBoundingClientRect();return Ng?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(cg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Ng&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Je(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function Ke(b){var c,d,e;if(Mi=mf.select(pf),Mi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Mi.html(""),Mi.classed("c3",!0),nf.data.xs={},nf.data.targets=rc(b),n(),R(),Yf.domain(mf.extent(Zb(nf.data.targets))),Zf.domain(Ub(nf.data.targets,"y")),$f.domain(Ub(nf.data.targets,"y2")),_f.domain(Yf.domain()),ag.domain(Zf.domain()),bg.domain($f.domain()),Ni=Yf.domain(),Bi.scale(_f),uf&&Fi.scale(Yf),Gi=Mi.append("svg").attr("width",Df+Af.left+Af.right).attr("height",Ff+Af.top+Af.bottom).on("mouseenter",xf).on("mouseleave",yf),Hi=Gi.append("defs"),Hi.append("clipPath").attr("id",Yh).append("rect").attr("width",Df).attr("height",Ff),Hi.append("clipPath").attr("id",Zh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Hi.append("clipPath").attr("id",$h).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Ii=Gi.append("g").attr("transform",ti.main),Ji=Gg?Gi.append("g").attr("transform",ti.context):null,Ki=Gi.append("g").attr("transform",ti.legend),Jg||(Ki.style("visibility","hidden"),oi=xc(nf.data.targets)),Li=mf.select(pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),gf(xc(nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Ii.append("g").attr("class",f.axisX).attr("clip-path",Ng?"":ai).attr("transform",ti.x).append("text").attr("class",f.axisXLabel).attr("transform",Ng?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),_g&&Ii.append("g").attr("class",f.axisY).attr("clip-path",Ng?bi:"").attr("transform",ti.y).append("text").attr("class",f.axisYLabel).attr("transform",Ng?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),ih&&Ii.append("g").attr("class",f.axisY2).attr("transform",ti.y2).append("text").attr("class",f.axisY2Label).attr("transform",Ng?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Ii.append("g").attr("clip-path",_h).attr("class",f.grid),rh&&d.append("g").attr("class",f.xgrids),ne(th)&&d.append("g").attr("class",f.xgridLines),zh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),uh&&d.append("g").attr("class",f.ygrids),ne(vh)&&d.append("g").attr("class",f.ygridLines),Ii.append("g").attr("clip-path",_h).attr("class",f.regions),Ii.append("g").attr("clip-path",_h).attr("class",f.chart),c=Ii.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",uf?Ng?"ns-resize":"ew-resize":null),Ii.select("."+f.chart).append("g").attr("class",f.chartBars),Ii.select("."+f.chart).append("g").attr("class",f.chartLines),Ii.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",ti.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Ii.select("."+f.chart).append("g").attr("class",f.chartTexts),uf&&Ii.insert("rect",wf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Df).attr("height",Ff).style("opacity",0).style("cursor",Ng?"ns-resize":"ew-resize").call(Fi).on("dblclick.zoom",null),Zg&&Bi.extent("function"!=typeof Zg?Zg:Zg(Zb())),Gg&&(Ji.append("g").attr("clip-path",_h).attr("class",f.chart),Ji.select("."+f.chart).append("g").attr("class",f.chartBars),Ji.select("."+f.chart).append("g").attr("class",f.chartLines),Ji.append("g").attr("clip-path",_h).attr("class",f.brush).call(Bi).selectAll("rect").attr(Ng?"width":"height",Ng?Ef:Gf),Ji.append("g").attr("class",f.axisX).attr("transform",ti.subx).attr("clip-path",Ng?"":ai)),Xe(nf.data.targets),Ng?Ii.select("."+f.axisX).style("opacity",0).call(cg):(Ii.select("."+f.axisY).style("opacity",0).call(dg),Ii.select("."+f.axisY2).style("opacity",0).call(eg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Vh){if(ci&&"string"==typeof Wh){for(Wh=ie(Wh),e=0;e0){d=[];for(var g in kg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function Pe(a){Yd(nf.data.targets)||vg&&(fi=a,Ii.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),gi=!0,Eg())}function Qe(){Yd(nf.data.targets)||vg&&(Ii.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Ii.selectAll("."+f.shape).classed(f.INCLUDED,!1),gi=!1,Fg())}function Re(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Nd(),U=Yd(nf.data.targets),V=Dc(nf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?zf:0,O=B?N:0,P=C?N:0,H&&Jg&&gf(xc(nf.data.targets),a),G&&(Yf.domain(mf.extent(Zb(V))),Ni=Yf.domain(),uf&&Fi.scale(Yf).updateScaleExtent(),_f.domain(Yf.domain()),Bi.scale(_f)),F&&(Yf.domain(Bi.empty()?Ni:Bi.extent()),uf&&Fi.scale(Yf).updateScaleExtent()),Zf.domain(Ub(V,"y")),$f.domain(Ub(V,"y2")),Vd(V)||(Q=Fc(Ec(V)).sort(),cg.tickValues(Q),fg.tickValues(Q)),c=Ii.select("."+f.axisX).style("opacity",U?0:1),(Ng||D)&&(c=c.transition().duration(P)),c.call(cg),e=Ii.select("."+f.axisY).style("opacity",U?0:1),(!Ng||D)&&(e=e.transition().duration(P)),e.call(dg),Ii.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(eg),F&&Tg&&Q){for(R=1;R=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=Yf.ticks(10);g=Ii.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Ng?0:function(a){return Yf(a)-cg.tickOffset()}).attr("x2",Ng?Df:function(a){return Yf(a)-cg.tickOffset()}).attr("y1",Ng?function(a){return Yf(a)-cg.tickOffset()}:Af.top).attr("y2",Ng?function(a){return Yf(a)-cg.tickOffset()}:Ff).style("opacity",function(){return+mf.select(this).attr(Ng?"y1":"x1")===(Ng?Ff:0)?0:1}),g.exit().remove()}ne(th)&&(i=Ii.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(th),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Ng?"":"rotate(-90)").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Ng?0:vd).attr("x2",Ng?Df:vd).attr("y1",Ng?vd:Af.top).attr("y2",Ng?vd:Ff).style("opacity",1),i.select("text").transition().duration(N).attr("x",Ng?Df:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&uh&&(k=Ii.select("."+f.ygrids).selectAll("."+f.ygrid).data(Zf.ticks(wh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Ng?Zf:0).attr("x2",Ng?Zf:Df).attr("y1",Ng?0:Zf).attr("y2",Ng?Ff:Zf),k.exit().remove()),y&&ne(vh)&&(l=Ii.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(vh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Ng?"rotate(-90)":"").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Ng?wd:0).attr("x2",Ng?wd:Df).attr("y1",Ng?0:wd).attr("y2",Ng?Ff:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Ng?0:Df).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Ii.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ki(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Ii.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Ng?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Ii.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ci).style("opacity",1),Ii.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Di).style("opacity",Oi),n=Ii.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",yh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),n.exit().remove(),Ii.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=mf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Ii.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Ii.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Gg&&(null!==mf.event&&"zoom"===mf.event.type&&Bi.extent(Yf.orgDomain()).update(),z&&(Ji.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(fg),Bi.empty()||Bi.extent(Yf.orgDomain()).update(),J=Ee(T,!0),s=Ji.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ki(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Ji.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ei).style("opacity",1))),Ii.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Ii.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),t=Ii.select("."+f.eventRects),ne(hg)&&!kc(hg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Ii.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Df).attr("height",Ff)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),ei&&!di?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return(Yf(d?d:e+50)-Yf(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return(Yf(d)+Yf(c?c:d-50))/2}):(x=L(),w=function(a){return Yf(a.x)-x/2}),v=wc(),Ii.select("."+f.eventRects).datum(v?v.values:[]),u=Ii.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Ng?0:w).attr("y",Ng?w:0).attr("width",Ng?Df:x).attr("height",Ng?x:Ff),u.exit().remove()),q=Ii.select("."+f.regions).selectAll("rect."+f.region).data(Qh),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Ng?0:cc).attr("y",Ng?cc:Af.top).attr("width",Ng?Df:dc).attr("height",Ng?dc:Ff).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),xc(nf.data.targets).forEach(function(a){Pi[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Fi.altDomain?(Yf.domain(Fi.altDomain),void Fi.scale(Yf).updateScaleExtent()):(di&&Yf.orgDomain()[0]===Ni[0]&&Yf.domain([Ni[0]-1e-10,Yf.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(hi=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Gi.attr("width",Hf).attr("height",If),Gi.select("#"+Yh).select("rect").attr("width",Df).attr("height",Ff),Gi.select("#"+Zh).select("rect").attr("width",H),Gi.select("#"+$h).select("rect").attr("width",J),Gi.select("."+f.zoomRect).attr("width",Df).attr("height",Ff)}function We(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Ii.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ki(a)}),e=Ii.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ki(a)}).style("stroke","none").style("cursor",function(a){return xg(a)?"pointer":null}),c=Ii.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ki(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Oi=+mf.select(this).style("opacity"),0}).style("fill",function(a){return ki(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ki(a)}).style("cursor",function(a){return xg(a)?"pointer":null}),a.forEach(function(a){Ii.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Ii.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Pf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ki(a.data)}).style("cursor",function(a){return xg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Gg&&(n=Ji.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ki(a)}),l=Ji.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ki(a)})),Gi.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=ui?j:i,l=ui?Q():P();return d&&(w=0,C=0,t=0,u=0),Jg&&!Cc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=ui?u:t,void(Mg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,ui?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Ki.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Lg?Lg(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",ui?g:-200).attr("y",ui?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",ui?h:-200).attr("y",ui?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return ki(a)}).attr("x",ui?g:-200).attr("y",ui?-200:i).attr("width",10).attr("height",10),Ki.selectAll("text").data(a).text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ki.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ki.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["transition","duration"],350);g("data","data is required in config");var Af,Bf,Cf,Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg=h(["data","x"]),hg=h(["data","xs"],{}),ig=h(["data","x_format"]),jg=h(["data","id_converter"],function(a){return a}),kg=h(["data","names"],{}),lg=h(["data","classes"],{}),mg=h(["data","groups"],[]),ng=h(["data","axes"],{}),og=h(["data","type"]),pg=h(["data","types"],{}),qg=h(["data","labels"],{}),rg=h(["data","order"]),sg=h(["data","regions"],{}),tg=h(["data","color"]),ug=h(["data","colors"],{}),vg=h(["data","selection","enabled"],!1),wg=h(["data","selection","grouped"],!1),xg=h(["data","selection","isselectable"],function(){return!0}),yg=h(["data","selection","multiple"],!0),zg=h(["data","onclick"],function(){}),Ag=h(["data","onenter"],function(){}),Bg=h(["data","onleave"],function(){}),Cg=h(["data","onselected"],function(){}),Dg=h(["data","onunselected"],function(){}),Eg=h(["data","ondragstart"],function(){}),Fg=h(["data","ondragend"],function(){}),Gg=h(["subchart","show"],!1),Hg=Gg?h(["subchart","size","height"],60):0,Ig=h(["color","pattern"],[]),Jg=h(["legend","show"],!0),Kg=h(["legend","position"],"bottom"),Lg=h(["legend","item","onclick"]),Mg=h(["legend","equally"],!1),Ng=h(["axis","rotated"],!1),Og=h(["axis","x","type"],"indexed"),Pg=h(["axis","x","localtime"],!1),Qg=h(["axis","x","categories"],[]),Rg=h(["axis","x","tick","centered"],!1),Sg=h(["axis","x","tick","format"]),Tg=h(["axis","x","tick","culling"],{}),Ug=h(["axis","x","tick","culling","max"],"categorized"===Og?1/0:10),Vg=h(["axis","x","tick","count"]),Wg=h(["axis","x","tick","fit"],!1),Xg=h(["axis","x","max"]),Yg=h(["axis","x","min"]),Zg=h(["axis","x","default"]),$g=h(["axis","x","label"],{}),_g=h(["axis","y","show"],!0),ah=h(["axis","y","max"]),bh=h(["axis","y","min"]),ch=h(["axis","y","center"]),dh=h(["axis","y","label"],{}),eh=h(["axis","y","inner"],!1),fh=h(["axis","y","tick","format"]),gh=h(["axis","y","padding"],{}),hh=h(["axis","y","ticks"],10),ih=h(["axis","y2","show"],!1),jh=h(["axis","y2","max"]),kh=h(["axis","y2","min"]),lh=h(["axis","y2","center"]),mh=h(["axis","y2","label"],{}),nh=h(["axis","y2","inner"],!1),oh=h(["axis","y2","tick","format"]),ph=h(["axis","y2","padding"],{}),qh=h(["axis","y2","ticks"],10),rh=h(["grid","x","show"],!1),sh=h(["grid","x","type"],"tick"),th=h(["grid","x","lines"],[]),uh=h(["grid","y","show"],!1),vh=h(["grid","y","lines"],[]),wh=h(["grid","y","ticks"],10),xh=h(["point","show"],!0),yh=xh?h(["point","r"],2.5):0,zh=h(["point","focus","line","enabled"],!0),Ah=h(["point","focus","expand","enabled"],!0),Bh=h(["point","focus","expand","r"],Ah?4:yh),Ch=h(["point","focus","select","r"],8),Dh=h(["bar","width"]),Eh=h(["bar","width","ratio"],.6),Fh=h(["pie","label","show"],!0),Gh=h(["pie","label","format"]),Hh=h(["pie","onclick"],function(){}),Ih=h(["pie","onmouseover"],function(){}),Jh=h(["pie","onmouseout"],function(){}),Kh=h(["donut","label","show"],!0),Lh=h(["donut","label","format"]),Mh=h(["donut","title"],""),Nh=h(["donut","onclick"],function(){}),Oh=h(["donut","onmouseover"],function(){}),Ph=h(["donut","onmouseout"],function(){}),Qh=h(["regions"],[]),Rh=h(["tooltip","show"],!0),Sh=h(["tooltip","format","title"]),Th=h(["tooltip","format","value"]),Uh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Sh?Sh:b,l=Th?Th:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Vh=h(["tooltip","init","show"],!1),Wh=h(["tooltip","init","x"],0),Xh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Yh=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",Zh=Yh+"-xaxis",$h=Yh+"-yaxis",_h=i(Yh),ai=i(Zh),bi=i($h),ci="timeseries"===Og,di="categorized"===Og,ei=!ci&&(gg||ne(hg)),fi=null,gi=!1,hi=!1,ii=!1,ji=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ki=he(ug,ne(Ig)?Ig:ji,tg),li=Pg?mf.time.format:mf.time.format.utc,mi=function(){var a=[[li("%Y/%-m/%-d"),function(){return!0}],[li("%-m/%-d"),function(a){return a.getMonth()}],[li("%-m/%-d"),function(a){return 1!==a.getDate()}],[li("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[li("%I %p"),function(a){return a.getHours()}],[li("%I:%M"),function(a){return a.getMinutes()}],[li(":%S"),function(a){return a.getSeconds()}],[li(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),ni=[],oi=[],pi=Ng?"left":"bottom",qi=Ng?eh?"top":"bottom":eh?"right":"left",ri=Ng?nh?"bottom":"top":nh?"left":"right",si=Ng?"left":"bottom",ti={main:function(){return"translate("+Af.left+","+Af.top+")"},context:function(){return"translate("+Bf.left+","+Bf.top+")"},legend:function(){return"translate("+Cf.left+","+Cf.top+")"},x:function(){return"translate(0,"+(Ng?0:Ff)+")"},y:function(){return"translate(0,"+(Ng?Ff:0)+")"},y2:function(){return"translate("+(Ng?0:Df)+","+(Ng?1:0)+")"},subx:function(){return"translate(0,"+(Ng?0:Gf)+")"},arc:function(){return"translate("+Df/2+","+Ff/2+")"}},ui="right"===Kg,vi=0,wi=0,xi=0,yi=30,zi=30,Ai=5;Pf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Bi,Ci=function(){var a=mf.svg.line().x(Ng?function(a){return V(a.id)(a.value)}:ud).y(Ng?ud:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=xe(b.values);return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),sg[b.id]?Je(e,Yf,V(b.id),sg[b.id]):a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Di=function(){var a;return a=Ng?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Ei=function(){var a=mf.svg.line().x(Ng?function(a){return W(a.id)(a.value)}:xd).y(Ng?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+_f(c[0].x)+" "+W(b.id)(c[0].value)}}(),Fi=function(){};Bi=mf.svg.brush().on("brush",Se),Bi.update=function(){return Ji&&Ji.select("."+f.brush).call(this),this},Bi.scale=function(a){return Ng?this.y(a):this.x(a)},uf&&(Fi=mf.behavior.zoom().on("zoomstart",function(){Fi.altDomain=mf.event.sourceEvent.altKey?Yf.orgDomain():null}).on("zoom",uf?Te:null),Fi.scale=function(a){return Ng?this.y(a):this.x(a)},Fi.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Fi.updateScaleExtent=function(){var a=$b(Yf.orgDomain())/$b(Ni),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Gi,Hi,Ii,Ji,Ki,Li,Mi,Ni,Oi,Pi={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Gi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Gi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Gi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Gi.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Ki.selectAll(kd(a)).classed(f.legendItemHidden,!1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Gi.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Ki.selectAll(kd(a)).classed(f.legendItemHidden,!0),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){Bi.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){lg[b]=a.classes[b]}),"categories"in a&&di&&(Qg=a.categories,cg.categories(Qg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Ii.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){vg&&Ii.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=wg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?xg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){vg&&Ii.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=wg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&xg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?mg:(mg=a,Re(),mg)},nf.xgrids=function(a){return a?(th=a,Re(),th):th},nf.xgrids.add=function(a){return a?nf.xgrids(th.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(th.filter(b))},nf.ygrids=function(a){return a?(vh=a,Re(),vh):vh},nf.ygrids.add=function(a){return a?nf.ygrids(vh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(vh.filter(b))},nf.regions=function(a){return c(a)?Qh:(Qh=a,Re(),Qh)},nf.regions.add=function(a){return c(a)?Qh:(Qh=Qh.concat(a),Re(),Qh)},nf.regions.remove=function(a,c){var e=[].concat(a);return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;Gi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Qh=Qh.filter(function(b){return b.classes.indexOf(a)<0})}),Qh},nf.data.get=function(a){var b=nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},nf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0 -},nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){kg[b]=a[b]}),gf(xc(nf.data.targets),{withTransition:!0}),kg):kg},nf.x=function(a){return arguments.length&&(mc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.xs=function(a){return arguments.length&&(nc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(ah=+a.y),b(a.y2)&&(jh=+a.y2)):ah=jh=+a,Re())},nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(bh=+a.y),b(a.y2)&&(kh=+a.y2)):bh=kh=+a,Re())},nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&nf.axis.max(a.max),"undefined"!=typeof a.min&&nf.axis.min(a.min))},nf.legend.show=function(a){Jg||(Jg=!0,Ki.style("visibility","visible")),ef(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.legend.hide=function(a){Jg&&me(a)&&(Jg=!1,Ki.style("visibility","hidden")),ff(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.resize=function(a){qf=a?a.width:null,rf=a?a.height:null,We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},nf.destroy=function(){nf.data.targets=void 0,nf.data.xs={},Mi.html(""),a.onresize=null},"url"in e.data)mf.xhr(e.data.url,function(a,b){var c,d=mf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=mf.csv.parse(b.response),Ke(c)});else if("rows"in e.data)Ke(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ke(qc(e.data.columns))}return nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file +!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.29"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cDf&&(Df=0),0>Ff&&(Ff=0),Bf={top:Ng?Af.top:If-Hg-(ui?0:a),right:0/0,bottom:20+(ui?0:a),left:Ng?yi:Af.left},Ef=Ng?Af.left-yi-zi:Df,Gf=Ng?Ff:If-Bf.top-Bf.bottom,0>Ef&&(Ef=0),0>Gf&&(Gf=0),Cf={top:ui?0:If-a,right:0/0,bottom:0,left:ui?Hf-b:0},p(),ui&&Yd(nf.data.targets)&&(Cf.left=Df/2+Kf)}function o(){Ii.select("line."+f.xgridFocus).attr("x1",Ng?0:-10).attr("x2",Ng?Df:-10).attr("y1",Ng?-10:Af.top).attr("y2",Ng?-10:Ff)}function p(){Kf=Ff/2,Jf=.95*Kf,Lf=Xd(nf.data.targets)?.6*Jf:0}function q(){var a=Ng?f.axisX:f.axisY,b=mf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=mf.select(pf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return qf?qf:x()}function s(){var a=rf?rf:y();return a>0?a:320}function t(){return Yd(nf.data.targets)?0:sf?sf:Ng||!_g||eh?1:v("y")}function u(){var a=1;return Yd(nf.data.targets)?0:tf?tf:ui?P()+(ih&&!Ng?v("y2"):a):ih?nh||Ng?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||_g?"y2"!==a||ih?(gb(a).isInner?30:40)+("y2"===a?-10:0):Ai:Jg&&!ui?10:1}function x(){return+mf.select(pf).style("width").replace("px","")}function y(){return+mf.select(pf).style("height").replace("px","")}function z(a){return a?-5:-(Af.left-1)}function A(a){return a?-20:-1}function B(){return z(!Ng)}function C(){return A(!Ng)}function D(){return z(Ng)}function E(){return A(Ng)}function F(a){return a?Df+2+4:Af.left+20}function G(a){return a?80:Ff+2}function H(){return F(!Ng)}function I(){return G(!Ng)}function J(){return F(Ng)}function K(){return G(Ng)}function L(){var a=Ng?Ff:Df,b=vc(),c=Vb()*(Ud(nf.data.targets)?(b-(di?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){vi=a}function N(a){wi=a}function O(a){xi=a}function P(){return Jg?ui?wi*(vi+1):Hf:0}function Q(){return Jg?ui?If:xi*(vi+1):0}function R(){var a,b=!Yf;Qf=Ng?1:0,Rf=Ng?Ff:Df,Sf=Ng?0:Ff,Tf=Ng?Df:1,Uf=Qf,Vf=Rf,Wf=Ng?0:Gf,Xf=Ng?Ef:1,Yf=T(Qf,Rf,b?void 0:Yf.domain(),function(){return cg.tickOffset()}),Zf=U(Sf,Tf),$f=U(Sf,Tf),_f=T(Qf,Rf,Ni,function(a){return a%1?0:fg.tickOffset()}),ag=U(Wf,Xf),bg=U(Wf,Xf),a=$(),cg=X(Yf,pi,a),fg=X(_f,si,a),dg=Y(Zf,qi,fh,hh),eg=Y($f,ri,oh,qh),b||(Bi.scale(_f),uf&&Fi.scale(Yf)),S()}function S(){Mf=Db(),Nf=Eb(),Of=Eb(.98)}function T(a,b,e,f){var g=(ci?mf.time.scale():mf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),di){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return mf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?$f:Zf}function W(a){return"y2"===Z(a)?bg:ag}function X(a,b,c){var d=(di?Bb():mf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),di?d.tickCentered(Rg):d.tickOffset=function(){var a=Ng?Ff:Df;return a*Vb()/vc()/2},di&&d.categories(Qg),d}function Y(a,b,c,d){return mf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in ng?ng[a]:"y"}function $(){var a=ci?mi:di?Oc:function(a){return 0>a?a.toFixed(0):a};return Sg&&("function"==typeof Sg?a=Sg:ci&&(a=function(a){return li(Sg)(a)})),a}function _(a){var b;return"y"===a?b=dh:"y2"===a?b=mh:"x"===a&&(b=$g),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?dh=b:"y2"===a?mh=b:"x"===a&&($g=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Ng?"inner-top":"inner-right")}function eb(){return cb("y",Ng?"inner-right":"inner-top")}function fb(){return cb("y2",Ng?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?Df/2:Df:b.isBottom?-Ff:b.isMiddle?-Ff/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Ng,db())}function ob(){return kb(Ng,eb())}function pb(){return kb(Ng,fb())}function qb(){return lb(!Ng,db())}function rb(){return lb(Ng,eb())}function sb(){return lb(Ng,fb())}function tb(){var a=db();return Ng?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Ng?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Ng?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Ng,db())}function xb(){return mb(Ng,eb())}function yb(){return mb(Ng,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Ii.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Ii.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Ii.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return mf.min(Object.keys(i).map(function(a){return mf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(mg.length>0)for(g=Nc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return mf.max(Object.keys(i).map(function(a){return mf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?kh:bh,n="y2"===c?jh:ah,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?lh:ch,r=pd()&&Ng;return 0===l.length?"y2"===c?$f.domain():Zf.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=qd(o,p),j=$b(Zf.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&gh&&(f=b(gh.top)?gh.top:e,g=b(gh.bottom)?gh.bottom:e),"y2"===c&&ph&&(f=b(ph.top)?ph.top:e,g=b(ph.bottom)?ph.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Ni),c=$b(Yf.domain());return a||0===c?1:b/c}function Wb(a){return Yg?Yg:mf.min(a,function(a){return mf.min(a.values,function(a){return a.x})})}function Xb(a){return Xg?Xg:mf.max(a,function(a){return mf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return di?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=0,g=0;return(c||0===c)&&(f=ci?new Date(c.getTime()-e):c-e),(d||0===d)&&(g=ci?new Date(d.getTime()+e):d+e),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return gg&&a===gg||ne(hg)&&oe(hg,a)}function fc(a){return!ec(a)}function gc(a){return gg?gg:ne(hg)?hg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=nf.data.xs[b])}),c}function ic(a,b){return a in nf.data.xs&&nf.data.xs[a]&&nf.data.xs[a][b]?nf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){hg[b]=a[b]})}function kc(a){return 1===mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=kg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),nf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=ci?a?a instanceof Date?a:ie(a):ie(ic(b,c)):ei&&!di?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):gg?(d=Object.keys(nf.data.xs),nf.data.xs[c]=d.length>0?nf.data.xs[d[0]]:void 0):ne(hg)&&(nf.data.xs[c]=hc(f,nf.data.targets)):nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=jg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return ei&&di&&0===c&&g&&(0===e&&(Qg=[]),Qg.push(g)),("undefined"==typeof a[b]||nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),og&&Sd(xc(c).filter(function(a){return!(a in pg)}),og),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function tc(a){return a>0&&nf.data.targets[0].values[a-1]?nf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?nf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?nf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(nf.data.targets)}function zc(a,b){var c,d=xc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(ci?new Date(h):h);i.push(d)}return ci||(i=i.sort()),i}function Gc(a){ni=ni.concat(a)}function Hc(a){ni=ni.filter(function(b){return a.indexOf(b)<0})}function Ic(a){oi=oi.concat(a)}function Jc(a){oi=oi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Ed(){return rg&&"desc"===rg.toLowerCase()}function Fd(){return rg&&"asc"===rg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof rg&&a.sort(rg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(nf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Rh&&0!==m.length&&(Li.html(Uh(a,$(),l,ki)).style("display","block"),d=Li.property("offsetWidth"),e=Li.property("offsetHeight"),k?(g=Df/2+c[0],i=Ff/2+c[1]+20):(Ng?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Yf(m[0].x)+20):(f=q(),g=f+t()+Yf(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Li.style("top",i+"px").style("left",g+"px"))}function Id(){Li.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Rh&&(Vd(nf.data.targets)||Yd(nf.data.targets)||Ii.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Ng?"y1":"x1",ud).attr(Ng?"y2":"x2",ud))}function Kd(){Ii.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?Yf(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Dh?Dh:b?2*a.tickOffset()*Eh/b:0}function Sd(a,b){yc(a).forEach(function(a){Pi[a]=b===pg[a],pg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){pg[a.id]===b&&(c=!0),a.id in pg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in pg)||"line"===pg[b]||"spline"===pg[b]||"area"===pg[b]||"area-spline"===pg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===pg[b]||"area-spline"===pg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===pg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===pg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===pg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===pg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ie(b){var c;try{c=ig?mf.time.format(ig).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ig)}return c}function je(a,b){var c=mf.mouse(a),d=mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?Zf:$f,d=Ng?1:0,e=Ng?0:1;return Math.pow(Yf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Cg(b,a.node()),Ii.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md).attr("stroke",function(){return ki(b)}).attr("r",1.4*Ch).transition().duration(100).attr("r",Ch)}function se(a,b,c){Dg(b,a.node()),Ii.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Cg(b,a.node()),a.transition().duration(100).style("fill",function(){return mf.rgb(ki(b)).darker(1)})}function ve(a,b){Dg(b,a.node()),a.transition().duration(100).style("fill",function(){return ki(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Ii.selectAll("."+f.circles+gd(c)):Ii).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",Bh)}function Ae(a){ye(a).filter(function(){return mf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",yh)}function Be(a){return Ii.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Ng?1:0,f=Ng?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Ng?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBoundingClientRect();return Ng?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(cg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Ng&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Je(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function Ke(b){var c,d,e;if(Mi=mf.select(pf),Mi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Mi.html(""),Mi.classed("c3",!0),nf.data.xs={},nf.data.targets=rc(b),n(),R(),Yf.domain(mf.extent(Zb(nf.data.targets))),Zf.domain(Ub(nf.data.targets,"y")),$f.domain(Ub(nf.data.targets,"y2")),_f.domain(Yf.domain()),ag.domain(Zf.domain()),bg.domain($f.domain()),Ni=Yf.domain(),Bi.scale(_f),uf&&Fi.scale(Yf),Gi=Mi.append("svg").attr("width",Df+Af.left+Af.right).attr("height",Ff+Af.top+Af.bottom).on("mouseenter",xf).on("mouseleave",yf),Hi=Gi.append("defs"),Hi.append("clipPath").attr("id",Yh).append("rect").attr("width",Df).attr("height",Ff),Hi.append("clipPath").attr("id",Zh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Hi.append("clipPath").attr("id",$h).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Ii=Gi.append("g").attr("transform",ti.main),Ji=Gg?Gi.append("g").attr("transform",ti.context):null,Ki=Gi.append("g").attr("transform",ti.legend),Jg||(Ki.style("visibility","hidden"),oi=xc(nf.data.targets)),Li=mf.select(pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),gf(xc(nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Ii.append("g").attr("class",f.axisX).attr("clip-path",Ng?"":ai).attr("transform",ti.x).append("text").attr("class",f.axisXLabel).attr("transform",Ng?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),_g&&Ii.append("g").attr("class",f.axisY).attr("clip-path",Ng?bi:"").attr("transform",ti.y).append("text").attr("class",f.axisYLabel).attr("transform",Ng?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),ih&&Ii.append("g").attr("class",f.axisY2).attr("transform",ti.y2).append("text").attr("class",f.axisY2Label).attr("transform",Ng?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Ii.append("g").attr("clip-path",_h).attr("class",f.grid),rh&&d.append("g").attr("class",f.xgrids),ne(th)&&d.append("g").attr("class",f.xgridLines),zh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),uh&&d.append("g").attr("class",f.ygrids),ne(vh)&&d.append("g").attr("class",f.ygridLines),Ii.append("g").attr("clip-path",_h).attr("class",f.regions),Ii.append("g").attr("clip-path",_h).attr("class",f.chart),c=Ii.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",uf?Ng?"ns-resize":"ew-resize":null),Ii.select("."+f.chart).append("g").attr("class",f.chartBars),Ii.select("."+f.chart).append("g").attr("class",f.chartLines),Ii.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",ti.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Ii.select("."+f.chart).append("g").attr("class",f.chartTexts),uf&&Ii.insert("rect",wf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Df).attr("height",Ff).style("opacity",0).style("cursor",Ng?"ns-resize":"ew-resize").call(Fi).on("dblclick.zoom",null),Zg&&Bi.extent("function"!=typeof Zg?Zg:Zg(Zb())),Gg&&(Ji.append("g").attr("clip-path",_h).attr("class",f.chart),Ji.select("."+f.chart).append("g").attr("class",f.chartBars),Ji.select("."+f.chart).append("g").attr("class",f.chartLines),Ji.append("g").attr("clip-path",_h).attr("class",f.brush).call(Bi).selectAll("rect").attr(Ng?"width":"height",Ng?Ef:Gf),Ji.append("g").attr("class",f.axisX).attr("transform",ti.subx).attr("clip-path",Ng?"":ai)),Xe(nf.data.targets),Ng?Ii.select("."+f.axisX).style("opacity",0).call(cg):(Ii.select("."+f.axisY).style("opacity",0).call(dg),Ii.select("."+f.axisY2).style("opacity",0).call(eg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Vh){if(ci&&"string"==typeof Wh){for(Wh=ie(Wh),e=0;e0){d=[];for(var g in kg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function Pe(a){Yd(nf.data.targets)||vg&&(fi=a,Ii.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),gi=!0,Eg())}function Qe(){Yd(nf.data.targets)||vg&&(Ii.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Ii.selectAll("."+f.shape).classed(f.INCLUDED,!1),gi=!1,Fg())}function Re(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Nd(),U=Yd(nf.data.targets),V=Dc(nf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?zf:0,O=B?N:0,P=C?N:0,H&&Jg&&gf(xc(nf.data.targets),a),G&&(Yf.domain(mf.extent(Zb(V))),Ni=Yf.domain(),uf&&Fi.scale(Yf).updateScaleExtent(),_f.domain(Yf.domain()),Bi.scale(_f)),F&&(Yf.domain(Bi.empty()?Ni:Bi.extent()),uf&&Fi.scale(Yf).updateScaleExtent()),Zf.domain(Ub(V,"y")),$f.domain(Ub(V,"y2")),Vd(V)||(Q=Fc(Ec(V)),cg.tickValues(Q),fg.tickValues(Q)),c=Ii.select("."+f.axisX).style("opacity",U?0:1),(Ng||D)&&(c=c.transition().duration(P)),c.call(cg),e=Ii.select("."+f.axisY).style("opacity",U?0:1),(!Ng||D)&&(e=e.transition().duration(P)),e.call(dg),Ii.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(eg),F&&Tg&&Q){for(R=1;R0&&mf.select(this).style("display",b%S?"none":"block")})}if(I=Ee(T),K=Fe(T,!0),M=Fe(T,!1),Ab(),ag.domain(Zf.domain()),bg.domain($f.domain()),Li.style("display","none"),o(),Ii.select("line."+f.xgridFocus).style("visibility","hidden"),rh){if("year"===sh){h=[];for(var W=Zb(),X=W[0].getFullYear(),Y=W[1].getFullYear(),Z=X;Y>=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=Yf.ticks(10);g=Ii.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Ng?0:function(a){return Yf(a)-cg.tickOffset()}).attr("x2",Ng?Df:function(a){return Yf(a)-cg.tickOffset()}).attr("y1",Ng?function(a){return Yf(a)-cg.tickOffset()}:Af.top).attr("y2",Ng?function(a){return Yf(a)-cg.tickOffset()}:Ff).style("opacity",function(){return+mf.select(this).attr(Ng?"y1":"x1")===(Ng?Ff:0)?0:1}),g.exit().remove()}ne(th)&&(i=Ii.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(th),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Ng?"":"rotate(-90)").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Ng?0:vd).attr("x2",Ng?Df:vd).attr("y1",Ng?vd:Af.top).attr("y2",Ng?vd:Ff).style("opacity",1),i.select("text").transition().duration(N).attr("x",Ng?Df:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&uh&&(k=Ii.select("."+f.ygrids).selectAll("."+f.ygrid).data(Zf.ticks(wh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Ng?Zf:0).attr("x2",Ng?Zf:Df).attr("y1",Ng?0:Zf).attr("y2",Ng?Ff:Zf),k.exit().remove()),y&&ne(vh)&&(l=Ii.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(vh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Ng?"rotate(-90)":"").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Ng?wd:0).attr("x2",Ng?wd:Df).attr("y1",Ng?0:wd).attr("y2",Ng?Ff:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Ng?0:Df).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Ii.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ki(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Ii.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Ng?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Ii.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ci).style("opacity",1),Ii.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Di).style("opacity",Oi),n=Ii.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",yh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),n.exit().remove(),Ii.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=mf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Ii.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Ii.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Gg&&(null!==mf.event&&"zoom"===mf.event.type&&Bi.extent(Yf.orgDomain()).update(),z&&(Ji.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(fg),Bi.empty()||Bi.extent(Yf.orgDomain()).update(),J=Ee(T,!0),s=Ji.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ki(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Ji.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ei).style("opacity",1))),Ii.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Ii.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),t=Ii.select("."+f.eventRects),ne(hg)&&!kc(hg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Ii.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Df).attr("height",Ff)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),ei&&!di?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return(Yf(d?d:e+50)-Yf(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return(Yf(d)+Yf(c?c:d-50))/2}):(x=L(),w=function(a){return Yf(a.x)-x/2}),v=wc(),Ii.select("."+f.eventRects).datum(v?v.values:[]),u=Ii.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Ng?0:w).attr("y",Ng?w:0).attr("width",Ng?Df:x).attr("height",Ng?x:Ff),u.exit().remove()),q=Ii.select("."+f.regions).selectAll("rect."+f.region).data(Qh),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Ng?0:cc).attr("y",Ng?cc:Af.top).attr("width",Ng?Df:dc).attr("height",Ng?dc:Ff).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),xc(nf.data.targets).forEach(function(a){Pi[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Fi.altDomain?(Yf.domain(Fi.altDomain),void Fi.scale(Yf).updateScaleExtent()):(di&&Yf.orgDomain()[0]===Ni[0]&&Yf.domain([Ni[0]-1e-10,Yf.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(hi=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Gi.attr("width",Hf).attr("height",If),Gi.select("#"+Yh).select("rect").attr("width",Df).attr("height",Ff),Gi.select("#"+Zh).select("rect").attr("width",H),Gi.select("#"+$h).select("rect").attr("width",J),Gi.select("."+f.zoomRect).attr("width",Df).attr("height",Ff)}function We(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Ii.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ki(a)}),e=Ii.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ki(a)}).style("stroke","none").style("cursor",function(a){return xg(a)?"pointer":null}),c=Ii.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ki(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Oi=+mf.select(this).style("opacity"),0}).style("fill",function(a){return ki(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ki(a)}).style("cursor",function(a){return xg(a)?"pointer":null}),a.forEach(function(a){Ii.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Ii.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Pf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ki(a.data)}).style("cursor",function(a){return xg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Gg&&(n=Ji.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ki(a)}),l=Ji.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ki(a)})),Gi.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=ui?j:i,l=ui?Q():P();return d&&(w=0,C=0,t=0,u=0),Jg&&!Cc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=ui?u:t,void(Mg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,ui?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Ki.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Lg?Lg(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",ui?g:-200).attr("y",ui?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",ui?h:-200).attr("y",ui?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return ki(a)}).attr("x",ui?g:-200).attr("y",ui?-200:i).attr("width",10).attr("height",10),Ki.selectAll("text").data(a).text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ki.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ki.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["transition","duration"],350);g("data","data is required in config");var Af,Bf,Cf,Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg=h(["data","x"]),hg=h(["data","xs"],{}),ig=h(["data","x_format"]),jg=h(["data","id_converter"],function(a){return a}),kg=h(["data","names"],{}),lg=h(["data","classes"],{}),mg=h(["data","groups"],[]),ng=h(["data","axes"],{}),og=h(["data","type"]),pg=h(["data","types"],{}),qg=h(["data","labels"],{}),rg=h(["data","order"]),sg=h(["data","regions"],{}),tg=h(["data","color"]),ug=h(["data","colors"],{}),vg=h(["data","selection","enabled"],!1),wg=h(["data","selection","grouped"],!1),xg=h(["data","selection","isselectable"],function(){return!0}),yg=h(["data","selection","multiple"],!0),zg=h(["data","onclick"],function(){}),Ag=h(["data","onenter"],function(){}),Bg=h(["data","onleave"],function(){}),Cg=h(["data","onselected"],function(){}),Dg=h(["data","onunselected"],function(){}),Eg=h(["data","ondragstart"],function(){}),Fg=h(["data","ondragend"],function(){}),Gg=h(["subchart","show"],!1),Hg=Gg?h(["subchart","size","height"],60):0,Ig=h(["color","pattern"],[]),Jg=h(["legend","show"],!0),Kg=h(["legend","position"],"bottom"),Lg=h(["legend","item","onclick"]),Mg=h(["legend","equally"],!1),Ng=h(["axis","rotated"],!1),Og=h(["axis","x","type"],"indexed"),Pg=h(["axis","x","localtime"],!1),Qg=h(["axis","x","categories"],[]),Rg=h(["axis","x","tick","centered"],!1),Sg=h(["axis","x","tick","format"]),Tg=h(["axis","x","tick","culling"],{}),Ug=h(["axis","x","tick","culling","max"],"categorized"===Og?1/0:10),Vg=h(["axis","x","tick","count"]),Wg=h(["axis","x","tick","fit"],!1),Xg=h(["axis","x","max"]),Yg=h(["axis","x","min"]),Zg=h(["axis","x","default"]),$g=h(["axis","x","label"],{}),_g=h(["axis","y","show"],!0),ah=h(["axis","y","max"]),bh=h(["axis","y","min"]),ch=h(["axis","y","center"]),dh=h(["axis","y","label"],{}),eh=h(["axis","y","inner"],!1),fh=h(["axis","y","tick","format"]),gh=h(["axis","y","padding"],{}),hh=h(["axis","y","ticks"],10),ih=h(["axis","y2","show"],!1),jh=h(["axis","y2","max"]),kh=h(["axis","y2","min"]),lh=h(["axis","y2","center"]),mh=h(["axis","y2","label"],{}),nh=h(["axis","y2","inner"],!1),oh=h(["axis","y2","tick","format"]),ph=h(["axis","y2","padding"],{}),qh=h(["axis","y2","ticks"],10),rh=h(["grid","x","show"],!1),sh=h(["grid","x","type"],"tick"),th=h(["grid","x","lines"],[]),uh=h(["grid","y","show"],!1),vh=h(["grid","y","lines"],[]),wh=h(["grid","y","ticks"],10),xh=h(["point","show"],!0),yh=xh?h(["point","r"],2.5):0,zh=h(["point","focus","line","enabled"],!0),Ah=h(["point","focus","expand","enabled"],!0),Bh=h(["point","focus","expand","r"],Ah?4:yh),Ch=h(["point","focus","select","r"],8),Dh=h(["bar","width"]),Eh=h(["bar","width","ratio"],.6),Fh=h(["pie","label","show"],!0),Gh=h(["pie","label","format"]),Hh=h(["pie","onclick"],function(){}),Ih=h(["pie","onmouseover"],function(){}),Jh=h(["pie","onmouseout"],function(){}),Kh=h(["donut","label","show"],!0),Lh=h(["donut","label","format"]),Mh=h(["donut","title"],""),Nh=h(["donut","onclick"],function(){}),Oh=h(["donut","onmouseover"],function(){}),Ph=h(["donut","onmouseout"],function(){}),Qh=h(["regions"],[]),Rh=h(["tooltip","show"],!0),Sh=h(["tooltip","format","title"]),Th=h(["tooltip","format","value"]),Uh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Sh?Sh:b,l=Th?Th:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Vh=h(["tooltip","init","show"],!1),Wh=h(["tooltip","init","x"],0),Xh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Yh=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",Zh=Yh+"-xaxis",$h=Yh+"-yaxis",_h=i(Yh),ai=i(Zh),bi=i($h),ci="timeseries"===Og,di="categorized"===Og,ei=!ci&&(gg||ne(hg)),fi=null,gi=!1,hi=!1,ii=!1,ji=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ki=he(ug,ne(Ig)?Ig:ji,tg),li=Pg?mf.time.format:mf.time.format.utc,mi=function(){var a=[[li("%Y/%-m/%-d"),function(){return!0}],[li("%-m/%-d"),function(a){return a.getMonth()}],[li("%-m/%-d"),function(a){return 1!==a.getDate()}],[li("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[li("%I %p"),function(a){return a.getHours()}],[li("%I:%M"),function(a){return a.getMinutes()}],[li(":%S"),function(a){return a.getSeconds()}],[li(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),ni=[],oi=[],pi=Ng?"left":"bottom",qi=Ng?eh?"top":"bottom":eh?"right":"left",ri=Ng?nh?"bottom":"top":nh?"left":"right",si=Ng?"left":"bottom",ti={main:function(){return"translate("+Af.left+","+Af.top+")"},context:function(){return"translate("+Bf.left+","+Bf.top+")"},legend:function(){return"translate("+Cf.left+","+Cf.top+")"},x:function(){return"translate(0,"+(Ng?0:Ff)+")"},y:function(){return"translate(0,"+(Ng?Ff:0)+")"},y2:function(){return"translate("+(Ng?0:Df)+","+(Ng?1:0)+")"},subx:function(){return"translate(0,"+(Ng?0:Gf)+")"},arc:function(){return"translate("+Df/2+","+Ff/2+")"}},ui="right"===Kg,vi=0,wi=0,xi=0,yi=30,zi=30,Ai=5;Pf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Bi,Ci=function(){var a=mf.svg.line().x(Ng?function(a){return V(a.id)(a.value)}:ud).y(Ng?ud:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=xe(b.values);return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),sg[b.id]?Je(e,Yf,V(b.id),sg[b.id]):a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Di=function(){var a;return a=Ng?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Ei=function(){var a=mf.svg.line().x(Ng?function(a){return W(a.id)(a.value)}:xd).y(Ng?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+_f(c[0].x)+" "+W(b.id)(c[0].value)}}(),Fi=function(){};Bi=mf.svg.brush().on("brush",Se),Bi.update=function(){return Ji&&Ji.select("."+f.brush).call(this),this},Bi.scale=function(a){return Ng?this.y(a):this.x(a)},uf&&(Fi=mf.behavior.zoom().on("zoomstart",function(){Fi.altDomain=mf.event.sourceEvent.altKey?Yf.orgDomain():null}).on("zoom",uf?Te:null),Fi.scale=function(a){return Ng?this.y(a):this.x(a)},Fi.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Fi.updateScaleExtent=function(){var a=$b(Yf.orgDomain())/$b(Ni),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Gi,Hi,Ii,Ji,Ki,Li,Mi,Ni,Oi,Pi={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Gi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Gi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Gi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Gi.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Ki.selectAll(kd(a)).classed(f.legendItemHidden,!1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Gi.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Ki.selectAll(kd(a)).classed(f.legendItemHidden,!0),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){Bi.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){lg[b]=a.classes[b]}),"categories"in a&&di&&(Qg=a.categories,cg.categories(Qg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Ii.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){vg&&Ii.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=wg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?xg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){vg&&Ii.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=wg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&xg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?mg:(mg=a,Re(),mg)},nf.xgrids=function(a){return a?(th=a,Re(),th):th},nf.xgrids.add=function(a){return a?nf.xgrids(th.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(th.filter(b))},nf.ygrids=function(a){return a?(vh=a,Re(),vh):vh},nf.ygrids.add=function(a){return a?nf.ygrids(vh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(vh.filter(b))},nf.regions=function(a){return c(a)?Qh:(Qh=a,Re(),Qh)},nf.regions.add=function(a){return c(a)?Qh:(Qh=Qh.concat(a),Re(),Qh)},nf.regions.remove=function(a,c){var e=[].concat(a);return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;Gi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Qh=Qh.filter(function(b){return b.classes.indexOf(a)<0})}),Qh},nf.data.get=function(a){var b=nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},nf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){kg[b]=a[b] +}),gf(xc(nf.data.targets),{withTransition:!0}),kg):kg},nf.x=function(a){return arguments.length&&(mc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.xs=function(a){return arguments.length&&(nc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(ah=+a.y),b(a.y2)&&(jh=+a.y2)):ah=jh=+a,Re())},nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(bh=+a.y),b(a.y2)&&(kh=+a.y2)):bh=kh=+a,Re())},nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&nf.axis.max(a.max),"undefined"!=typeof a.min&&nf.axis.min(a.min))},nf.legend.show=function(a){Jg||(Jg=!0,Ki.style("visibility","visible")),ef(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.legend.hide=function(a){Jg&&me(a)&&(Jg=!1,Ki.style("visibility","hidden")),ff(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.resize=function(a){qf=a?a.width:null,rf=a?a.height:null,We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},nf.destroy=function(){nf.data.targets=void 0,nf.data.xs={},Mi.html(""),a.onresize=null},"url"in e.data)mf.xhr(e.data.url,function(a,b){var c,d=mf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=mf.csv.parse(b.response),Ke(c)});else if("rows"in e.data)Ke(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ke(qc(e.data.columns))}return nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From e79df141ecaba5125ae87f7449a0febc35e852ba Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Fri, 11 Apr 2014 00:16:03 +0900 Subject: [PATCH 036/178] Add line.connect_null option - #81 --- c3.js | 5 ++++- c3.min.js | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/c3.js b/c3.js index 777cbf9..e356085 100644 --- a/c3.js +++ b/c3.js @@ -212,6 +212,8 @@ __point_focus_expand_r = getConfig(['point', 'focus', 'expand', 'r'], __point_focus_expand_enabled ? 4 : __point_r), __point_select_r = getConfig(['point', 'focus', 'select', 'r'], 8); + var __line_connect_null = getConfig(['line', 'connect_null'], false); + // bar var __bar_width = getConfig(['bar', 'width']), __bar_width_ratio = getConfig(['bar', 'width', 'ratio'], 0.6); @@ -2141,8 +2143,9 @@ var line = d3.svg.line() .x(__axis_rotated ? function (d) { return getYScale(d.id)(d.value); } : xx) .y(__axis_rotated ? xx : function (d) { return getYScale(d.id)(d.value); }); + if (!__line_connect_null) { line = line.defined(function (d) { return d.value != null; }); } return function (d) { - var data = filterRemoveNull(d.values), x0, y0; + var data = __line_connect_null ? filterRemoveNull(d.values) : d.values, x0, y0; if (isLineType(d)) { isSplineType(d) ? line.interpolate("cardinal") : line.interpolate("linear"); return __data_regions[d.id] ? lineWithRegions(data, x, getYScale(d.id), __data_regions[d.id]) : line(data); diff --git a/c3.min.js b/c3.min.js index 82c9a54..39921e7 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.29"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cDf&&(Df=0),0>Ff&&(Ff=0),Bf={top:Ng?Af.top:If-Hg-(ui?0:a),right:0/0,bottom:20+(ui?0:a),left:Ng?yi:Af.left},Ef=Ng?Af.left-yi-zi:Df,Gf=Ng?Ff:If-Bf.top-Bf.bottom,0>Ef&&(Ef=0),0>Gf&&(Gf=0),Cf={top:ui?0:If-a,right:0/0,bottom:0,left:ui?Hf-b:0},p(),ui&&Yd(nf.data.targets)&&(Cf.left=Df/2+Kf)}function o(){Ii.select("line."+f.xgridFocus).attr("x1",Ng?0:-10).attr("x2",Ng?Df:-10).attr("y1",Ng?-10:Af.top).attr("y2",Ng?-10:Ff)}function p(){Kf=Ff/2,Jf=.95*Kf,Lf=Xd(nf.data.targets)?.6*Jf:0}function q(){var a=Ng?f.axisX:f.axisY,b=mf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=mf.select(pf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return qf?qf:x()}function s(){var a=rf?rf:y();return a>0?a:320}function t(){return Yd(nf.data.targets)?0:sf?sf:Ng||!_g||eh?1:v("y")}function u(){var a=1;return Yd(nf.data.targets)?0:tf?tf:ui?P()+(ih&&!Ng?v("y2"):a):ih?nh||Ng?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||_g?"y2"!==a||ih?(gb(a).isInner?30:40)+("y2"===a?-10:0):Ai:Jg&&!ui?10:1}function x(){return+mf.select(pf).style("width").replace("px","")}function y(){return+mf.select(pf).style("height").replace("px","")}function z(a){return a?-5:-(Af.left-1)}function A(a){return a?-20:-1}function B(){return z(!Ng)}function C(){return A(!Ng)}function D(){return z(Ng)}function E(){return A(Ng)}function F(a){return a?Df+2+4:Af.left+20}function G(a){return a?80:Ff+2}function H(){return F(!Ng)}function I(){return G(!Ng)}function J(){return F(Ng)}function K(){return G(Ng)}function L(){var a=Ng?Ff:Df,b=vc(),c=Vb()*(Ud(nf.data.targets)?(b-(di?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){vi=a}function N(a){wi=a}function O(a){xi=a}function P(){return Jg?ui?wi*(vi+1):Hf:0}function Q(){return Jg?ui?If:xi*(vi+1):0}function R(){var a,b=!Yf;Qf=Ng?1:0,Rf=Ng?Ff:Df,Sf=Ng?0:Ff,Tf=Ng?Df:1,Uf=Qf,Vf=Rf,Wf=Ng?0:Gf,Xf=Ng?Ef:1,Yf=T(Qf,Rf,b?void 0:Yf.domain(),function(){return cg.tickOffset()}),Zf=U(Sf,Tf),$f=U(Sf,Tf),_f=T(Qf,Rf,Ni,function(a){return a%1?0:fg.tickOffset()}),ag=U(Wf,Xf),bg=U(Wf,Xf),a=$(),cg=X(Yf,pi,a),fg=X(_f,si,a),dg=Y(Zf,qi,fh,hh),eg=Y($f,ri,oh,qh),b||(Bi.scale(_f),uf&&Fi.scale(Yf)),S()}function S(){Mf=Db(),Nf=Eb(),Of=Eb(.98)}function T(a,b,e,f){var g=(ci?mf.time.scale():mf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),di){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return mf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?$f:Zf}function W(a){return"y2"===Z(a)?bg:ag}function X(a,b,c){var d=(di?Bb():mf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),di?d.tickCentered(Rg):d.tickOffset=function(){var a=Ng?Ff:Df;return a*Vb()/vc()/2},di&&d.categories(Qg),d}function Y(a,b,c,d){return mf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in ng?ng[a]:"y"}function $(){var a=ci?mi:di?Oc:function(a){return 0>a?a.toFixed(0):a};return Sg&&("function"==typeof Sg?a=Sg:ci&&(a=function(a){return li(Sg)(a)})),a}function _(a){var b;return"y"===a?b=dh:"y2"===a?b=mh:"x"===a&&(b=$g),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?dh=b:"y2"===a?mh=b:"x"===a&&($g=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Ng?"inner-top":"inner-right")}function eb(){return cb("y",Ng?"inner-right":"inner-top")}function fb(){return cb("y2",Ng?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?Df/2:Df:b.isBottom?-Ff:b.isMiddle?-Ff/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Ng,db())}function ob(){return kb(Ng,eb())}function pb(){return kb(Ng,fb())}function qb(){return lb(!Ng,db())}function rb(){return lb(Ng,eb())}function sb(){return lb(Ng,fb())}function tb(){var a=db();return Ng?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Ng?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Ng?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Ng,db())}function xb(){return mb(Ng,eb())}function yb(){return mb(Ng,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Ii.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Ii.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Ii.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return mf.min(Object.keys(i).map(function(a){return mf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(mg.length>0)for(g=Nc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return mf.max(Object.keys(i).map(function(a){return mf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?kh:bh,n="y2"===c?jh:ah,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?lh:ch,r=pd()&&Ng;return 0===l.length?"y2"===c?$f.domain():Zf.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=qd(o,p),j=$b(Zf.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&gh&&(f=b(gh.top)?gh.top:e,g=b(gh.bottom)?gh.bottom:e),"y2"===c&&ph&&(f=b(ph.top)?ph.top:e,g=b(ph.bottom)?ph.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Ni),c=$b(Yf.domain());return a||0===c?1:b/c}function Wb(a){return Yg?Yg:mf.min(a,function(a){return mf.min(a.values,function(a){return a.x})})}function Xb(a){return Xg?Xg:mf.max(a,function(a){return mf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return di?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=0,g=0;return(c||0===c)&&(f=ci?new Date(c.getTime()-e):c-e),(d||0===d)&&(g=ci?new Date(d.getTime()+e):d+e),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return gg&&a===gg||ne(hg)&&oe(hg,a)}function fc(a){return!ec(a)}function gc(a){return gg?gg:ne(hg)?hg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=nf.data.xs[b])}),c}function ic(a,b){return a in nf.data.xs&&nf.data.xs[a]&&nf.data.xs[a][b]?nf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){hg[b]=a[b]})}function kc(a){return 1===mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=kg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),nf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=ci?a?a instanceof Date?a:ie(a):ie(ic(b,c)):ei&&!di?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):gg?(d=Object.keys(nf.data.xs),nf.data.xs[c]=d.length>0?nf.data.xs[d[0]]:void 0):ne(hg)&&(nf.data.xs[c]=hc(f,nf.data.targets)):nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=jg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return ei&&di&&0===c&&g&&(0===e&&(Qg=[]),Qg.push(g)),("undefined"==typeof a[b]||nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),og&&Sd(xc(c).filter(function(a){return!(a in pg)}),og),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function tc(a){return a>0&&nf.data.targets[0].values[a-1]?nf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?nf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?nf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(nf.data.targets)}function zc(a,b){var c,d=xc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(ci?new Date(h):h);i.push(d)}return ci||(i=i.sort()),i}function Gc(a){ni=ni.concat(a)}function Hc(a){ni=ni.filter(function(b){return a.indexOf(b)<0})}function Ic(a){oi=oi.concat(a)}function Jc(a){oi=oi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Ed(){return rg&&"desc"===rg.toLowerCase()}function Fd(){return rg&&"asc"===rg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof rg&&a.sort(rg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(nf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Rh&&0!==m.length&&(Li.html(Uh(a,$(),l,ki)).style("display","block"),d=Li.property("offsetWidth"),e=Li.property("offsetHeight"),k?(g=Df/2+c[0],i=Ff/2+c[1]+20):(Ng?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Yf(m[0].x)+20):(f=q(),g=f+t()+Yf(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Li.style("top",i+"px").style("left",g+"px"))}function Id(){Li.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Rh&&(Vd(nf.data.targets)||Yd(nf.data.targets)||Ii.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Ng?"y1":"x1",ud).attr(Ng?"y2":"x2",ud))}function Kd(){Ii.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?Yf(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Dh?Dh:b?2*a.tickOffset()*Eh/b:0}function Sd(a,b){yc(a).forEach(function(a){Pi[a]=b===pg[a],pg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){pg[a.id]===b&&(c=!0),a.id in pg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in pg)||"line"===pg[b]||"spline"===pg[b]||"area"===pg[b]||"area-spline"===pg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===pg[b]||"area-spline"===pg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===pg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===pg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===pg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===pg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ie(b){var c;try{c=ig?mf.time.format(ig).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ig)}return c}function je(a,b){var c=mf.mouse(a),d=mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?Zf:$f,d=Ng?1:0,e=Ng?0:1;return Math.pow(Yf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Cg(b,a.node()),Ii.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md).attr("stroke",function(){return ki(b)}).attr("r",1.4*Ch).transition().duration(100).attr("r",Ch)}function se(a,b,c){Dg(b,a.node()),Ii.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Cg(b,a.node()),a.transition().duration(100).style("fill",function(){return mf.rgb(ki(b)).darker(1)})}function ve(a,b){Dg(b,a.node()),a.transition().duration(100).style("fill",function(){return ki(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Ii.selectAll("."+f.circles+gd(c)):Ii).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",Bh)}function Ae(a){ye(a).filter(function(){return mf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",yh)}function Be(a){return Ii.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Ng?1:0,f=Ng?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Ng?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBoundingClientRect();return Ng?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(cg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Ng&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Je(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function Ke(b){var c,d,e;if(Mi=mf.select(pf),Mi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Mi.html(""),Mi.classed("c3",!0),nf.data.xs={},nf.data.targets=rc(b),n(),R(),Yf.domain(mf.extent(Zb(nf.data.targets))),Zf.domain(Ub(nf.data.targets,"y")),$f.domain(Ub(nf.data.targets,"y2")),_f.domain(Yf.domain()),ag.domain(Zf.domain()),bg.domain($f.domain()),Ni=Yf.domain(),Bi.scale(_f),uf&&Fi.scale(Yf),Gi=Mi.append("svg").attr("width",Df+Af.left+Af.right).attr("height",Ff+Af.top+Af.bottom).on("mouseenter",xf).on("mouseleave",yf),Hi=Gi.append("defs"),Hi.append("clipPath").attr("id",Yh).append("rect").attr("width",Df).attr("height",Ff),Hi.append("clipPath").attr("id",Zh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Hi.append("clipPath").attr("id",$h).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Ii=Gi.append("g").attr("transform",ti.main),Ji=Gg?Gi.append("g").attr("transform",ti.context):null,Ki=Gi.append("g").attr("transform",ti.legend),Jg||(Ki.style("visibility","hidden"),oi=xc(nf.data.targets)),Li=mf.select(pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),gf(xc(nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Ii.append("g").attr("class",f.axisX).attr("clip-path",Ng?"":ai).attr("transform",ti.x).append("text").attr("class",f.axisXLabel).attr("transform",Ng?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),_g&&Ii.append("g").attr("class",f.axisY).attr("clip-path",Ng?bi:"").attr("transform",ti.y).append("text").attr("class",f.axisYLabel).attr("transform",Ng?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),ih&&Ii.append("g").attr("class",f.axisY2).attr("transform",ti.y2).append("text").attr("class",f.axisY2Label).attr("transform",Ng?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Ii.append("g").attr("clip-path",_h).attr("class",f.grid),rh&&d.append("g").attr("class",f.xgrids),ne(th)&&d.append("g").attr("class",f.xgridLines),zh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),uh&&d.append("g").attr("class",f.ygrids),ne(vh)&&d.append("g").attr("class",f.ygridLines),Ii.append("g").attr("clip-path",_h).attr("class",f.regions),Ii.append("g").attr("clip-path",_h).attr("class",f.chart),c=Ii.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",uf?Ng?"ns-resize":"ew-resize":null),Ii.select("."+f.chart).append("g").attr("class",f.chartBars),Ii.select("."+f.chart).append("g").attr("class",f.chartLines),Ii.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",ti.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Ii.select("."+f.chart).append("g").attr("class",f.chartTexts),uf&&Ii.insert("rect",wf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Df).attr("height",Ff).style("opacity",0).style("cursor",Ng?"ns-resize":"ew-resize").call(Fi).on("dblclick.zoom",null),Zg&&Bi.extent("function"!=typeof Zg?Zg:Zg(Zb())),Gg&&(Ji.append("g").attr("clip-path",_h).attr("class",f.chart),Ji.select("."+f.chart).append("g").attr("class",f.chartBars),Ji.select("."+f.chart).append("g").attr("class",f.chartLines),Ji.append("g").attr("clip-path",_h).attr("class",f.brush).call(Bi).selectAll("rect").attr(Ng?"width":"height",Ng?Ef:Gf),Ji.append("g").attr("class",f.axisX).attr("transform",ti.subx).attr("clip-path",Ng?"":ai)),Xe(nf.data.targets),Ng?Ii.select("."+f.axisX).style("opacity",0).call(cg):(Ii.select("."+f.axisY).style("opacity",0).call(dg),Ii.select("."+f.axisY2).style("opacity",0).call(eg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Vh){if(ci&&"string"==typeof Wh){for(Wh=ie(Wh),e=0;e0){d=[];for(var g in kg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function Pe(a){Yd(nf.data.targets)||vg&&(fi=a,Ii.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),gi=!0,Eg())}function Qe(){Yd(nf.data.targets)||vg&&(Ii.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Ii.selectAll("."+f.shape).classed(f.INCLUDED,!1),gi=!1,Fg())}function Re(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Nd(),U=Yd(nf.data.targets),V=Dc(nf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?zf:0,O=B?N:0,P=C?N:0,H&&Jg&&gf(xc(nf.data.targets),a),G&&(Yf.domain(mf.extent(Zb(V))),Ni=Yf.domain(),uf&&Fi.scale(Yf).updateScaleExtent(),_f.domain(Yf.domain()),Bi.scale(_f)),F&&(Yf.domain(Bi.empty()?Ni:Bi.extent()),uf&&Fi.scale(Yf).updateScaleExtent()),Zf.domain(Ub(V,"y")),$f.domain(Ub(V,"y2")),Vd(V)||(Q=Fc(Ec(V)),cg.tickValues(Q),fg.tickValues(Q)),c=Ii.select("."+f.axisX).style("opacity",U?0:1),(Ng||D)&&(c=c.transition().duration(P)),c.call(cg),e=Ii.select("."+f.axisY).style("opacity",U?0:1),(!Ng||D)&&(e=e.transition().duration(P)),e.call(dg),Ii.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(eg),F&&Tg&&Q){for(R=1;R0&&mf.select(this).style("display",b%S?"none":"block")})}if(I=Ee(T),K=Fe(T,!0),M=Fe(T,!1),Ab(),ag.domain(Zf.domain()),bg.domain($f.domain()),Li.style("display","none"),o(),Ii.select("line."+f.xgridFocus).style("visibility","hidden"),rh){if("year"===sh){h=[];for(var W=Zb(),X=W[0].getFullYear(),Y=W[1].getFullYear(),Z=X;Y>=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=Yf.ticks(10);g=Ii.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Ng?0:function(a){return Yf(a)-cg.tickOffset()}).attr("x2",Ng?Df:function(a){return Yf(a)-cg.tickOffset()}).attr("y1",Ng?function(a){return Yf(a)-cg.tickOffset()}:Af.top).attr("y2",Ng?function(a){return Yf(a)-cg.tickOffset()}:Ff).style("opacity",function(){return+mf.select(this).attr(Ng?"y1":"x1")===(Ng?Ff:0)?0:1}),g.exit().remove()}ne(th)&&(i=Ii.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(th),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Ng?"":"rotate(-90)").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Ng?0:vd).attr("x2",Ng?Df:vd).attr("y1",Ng?vd:Af.top).attr("y2",Ng?vd:Ff).style("opacity",1),i.select("text").transition().duration(N).attr("x",Ng?Df:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&uh&&(k=Ii.select("."+f.ygrids).selectAll("."+f.ygrid).data(Zf.ticks(wh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Ng?Zf:0).attr("x2",Ng?Zf:Df).attr("y1",Ng?0:Zf).attr("y2",Ng?Ff:Zf),k.exit().remove()),y&&ne(vh)&&(l=Ii.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(vh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Ng?"rotate(-90)":"").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Ng?wd:0).attr("x2",Ng?wd:Df).attr("y1",Ng?0:wd).attr("y2",Ng?Ff:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Ng?0:Df).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Ii.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ki(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Ii.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Ng?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Ii.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ci).style("opacity",1),Ii.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Di).style("opacity",Oi),n=Ii.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",yh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),n.exit().remove(),Ii.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=mf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Ii.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Ii.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Gg&&(null!==mf.event&&"zoom"===mf.event.type&&Bi.extent(Yf.orgDomain()).update(),z&&(Ji.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(fg),Bi.empty()||Bi.extent(Yf.orgDomain()).update(),J=Ee(T,!0),s=Ji.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ki(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Ji.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ei).style("opacity",1))),Ii.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Ii.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),t=Ii.select("."+f.eventRects),ne(hg)&&!kc(hg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Ii.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Df).attr("height",Ff)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),ei&&!di?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return(Yf(d?d:e+50)-Yf(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return(Yf(d)+Yf(c?c:d-50))/2}):(x=L(),w=function(a){return Yf(a.x)-x/2}),v=wc(),Ii.select("."+f.eventRects).datum(v?v.values:[]),u=Ii.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Ng?0:w).attr("y",Ng?w:0).attr("width",Ng?Df:x).attr("height",Ng?x:Ff),u.exit().remove()),q=Ii.select("."+f.regions).selectAll("rect."+f.region).data(Qh),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Ng?0:cc).attr("y",Ng?cc:Af.top).attr("width",Ng?Df:dc).attr("height",Ng?dc:Ff).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),xc(nf.data.targets).forEach(function(a){Pi[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Fi.altDomain?(Yf.domain(Fi.altDomain),void Fi.scale(Yf).updateScaleExtent()):(di&&Yf.orgDomain()[0]===Ni[0]&&Yf.domain([Ni[0]-1e-10,Yf.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(hi=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Gi.attr("width",Hf).attr("height",If),Gi.select("#"+Yh).select("rect").attr("width",Df).attr("height",Ff),Gi.select("#"+Zh).select("rect").attr("width",H),Gi.select("#"+$h).select("rect").attr("width",J),Gi.select("."+f.zoomRect).attr("width",Df).attr("height",Ff)}function We(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Ii.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ki(a)}),e=Ii.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ki(a)}).style("stroke","none").style("cursor",function(a){return xg(a)?"pointer":null}),c=Ii.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ki(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Oi=+mf.select(this).style("opacity"),0}).style("fill",function(a){return ki(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ki(a)}).style("cursor",function(a){return xg(a)?"pointer":null}),a.forEach(function(a){Ii.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Ii.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Pf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ki(a.data)}).style("cursor",function(a){return xg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Gg&&(n=Ji.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ki(a)}),l=Ji.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ki(a)})),Gi.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=ui?j:i,l=ui?Q():P();return d&&(w=0,C=0,t=0,u=0),Jg&&!Cc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=ui?u:t,void(Mg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,ui?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Ki.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Lg?Lg(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",ui?g:-200).attr("y",ui?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",ui?h:-200).attr("y",ui?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return ki(a)}).attr("x",ui?g:-200).attr("y",ui?-200:i).attr("width",10).attr("height",10),Ki.selectAll("text").data(a).text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ki.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ki.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["transition","duration"],350);g("data","data is required in config");var Af,Bf,Cf,Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg=h(["data","x"]),hg=h(["data","xs"],{}),ig=h(["data","x_format"]),jg=h(["data","id_converter"],function(a){return a}),kg=h(["data","names"],{}),lg=h(["data","classes"],{}),mg=h(["data","groups"],[]),ng=h(["data","axes"],{}),og=h(["data","type"]),pg=h(["data","types"],{}),qg=h(["data","labels"],{}),rg=h(["data","order"]),sg=h(["data","regions"],{}),tg=h(["data","color"]),ug=h(["data","colors"],{}),vg=h(["data","selection","enabled"],!1),wg=h(["data","selection","grouped"],!1),xg=h(["data","selection","isselectable"],function(){return!0}),yg=h(["data","selection","multiple"],!0),zg=h(["data","onclick"],function(){}),Ag=h(["data","onenter"],function(){}),Bg=h(["data","onleave"],function(){}),Cg=h(["data","onselected"],function(){}),Dg=h(["data","onunselected"],function(){}),Eg=h(["data","ondragstart"],function(){}),Fg=h(["data","ondragend"],function(){}),Gg=h(["subchart","show"],!1),Hg=Gg?h(["subchart","size","height"],60):0,Ig=h(["color","pattern"],[]),Jg=h(["legend","show"],!0),Kg=h(["legend","position"],"bottom"),Lg=h(["legend","item","onclick"]),Mg=h(["legend","equally"],!1),Ng=h(["axis","rotated"],!1),Og=h(["axis","x","type"],"indexed"),Pg=h(["axis","x","localtime"],!1),Qg=h(["axis","x","categories"],[]),Rg=h(["axis","x","tick","centered"],!1),Sg=h(["axis","x","tick","format"]),Tg=h(["axis","x","tick","culling"],{}),Ug=h(["axis","x","tick","culling","max"],"categorized"===Og?1/0:10),Vg=h(["axis","x","tick","count"]),Wg=h(["axis","x","tick","fit"],!1),Xg=h(["axis","x","max"]),Yg=h(["axis","x","min"]),Zg=h(["axis","x","default"]),$g=h(["axis","x","label"],{}),_g=h(["axis","y","show"],!0),ah=h(["axis","y","max"]),bh=h(["axis","y","min"]),ch=h(["axis","y","center"]),dh=h(["axis","y","label"],{}),eh=h(["axis","y","inner"],!1),fh=h(["axis","y","tick","format"]),gh=h(["axis","y","padding"],{}),hh=h(["axis","y","ticks"],10),ih=h(["axis","y2","show"],!1),jh=h(["axis","y2","max"]),kh=h(["axis","y2","min"]),lh=h(["axis","y2","center"]),mh=h(["axis","y2","label"],{}),nh=h(["axis","y2","inner"],!1),oh=h(["axis","y2","tick","format"]),ph=h(["axis","y2","padding"],{}),qh=h(["axis","y2","ticks"],10),rh=h(["grid","x","show"],!1),sh=h(["grid","x","type"],"tick"),th=h(["grid","x","lines"],[]),uh=h(["grid","y","show"],!1),vh=h(["grid","y","lines"],[]),wh=h(["grid","y","ticks"],10),xh=h(["point","show"],!0),yh=xh?h(["point","r"],2.5):0,zh=h(["point","focus","line","enabled"],!0),Ah=h(["point","focus","expand","enabled"],!0),Bh=h(["point","focus","expand","r"],Ah?4:yh),Ch=h(["point","focus","select","r"],8),Dh=h(["bar","width"]),Eh=h(["bar","width","ratio"],.6),Fh=h(["pie","label","show"],!0),Gh=h(["pie","label","format"]),Hh=h(["pie","onclick"],function(){}),Ih=h(["pie","onmouseover"],function(){}),Jh=h(["pie","onmouseout"],function(){}),Kh=h(["donut","label","show"],!0),Lh=h(["donut","label","format"]),Mh=h(["donut","title"],""),Nh=h(["donut","onclick"],function(){}),Oh=h(["donut","onmouseover"],function(){}),Ph=h(["donut","onmouseout"],function(){}),Qh=h(["regions"],[]),Rh=h(["tooltip","show"],!0),Sh=h(["tooltip","format","title"]),Th=h(["tooltip","format","value"]),Uh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Sh?Sh:b,l=Th?Th:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Vh=h(["tooltip","init","show"],!1),Wh=h(["tooltip","init","x"],0),Xh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Yh=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",Zh=Yh+"-xaxis",$h=Yh+"-yaxis",_h=i(Yh),ai=i(Zh),bi=i($h),ci="timeseries"===Og,di="categorized"===Og,ei=!ci&&(gg||ne(hg)),fi=null,gi=!1,hi=!1,ii=!1,ji=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ki=he(ug,ne(Ig)?Ig:ji,tg),li=Pg?mf.time.format:mf.time.format.utc,mi=function(){var a=[[li("%Y/%-m/%-d"),function(){return!0}],[li("%-m/%-d"),function(a){return a.getMonth()}],[li("%-m/%-d"),function(a){return 1!==a.getDate()}],[li("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[li("%I %p"),function(a){return a.getHours()}],[li("%I:%M"),function(a){return a.getMinutes()}],[li(":%S"),function(a){return a.getSeconds()}],[li(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),ni=[],oi=[],pi=Ng?"left":"bottom",qi=Ng?eh?"top":"bottom":eh?"right":"left",ri=Ng?nh?"bottom":"top":nh?"left":"right",si=Ng?"left":"bottom",ti={main:function(){return"translate("+Af.left+","+Af.top+")"},context:function(){return"translate("+Bf.left+","+Bf.top+")"},legend:function(){return"translate("+Cf.left+","+Cf.top+")"},x:function(){return"translate(0,"+(Ng?0:Ff)+")"},y:function(){return"translate(0,"+(Ng?Ff:0)+")"},y2:function(){return"translate("+(Ng?0:Df)+","+(Ng?1:0)+")"},subx:function(){return"translate(0,"+(Ng?0:Gf)+")"},arc:function(){return"translate("+Df/2+","+Ff/2+")"}},ui="right"===Kg,vi=0,wi=0,xi=0,yi=30,zi=30,Ai=5;Pf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Bi,Ci=function(){var a=mf.svg.line().x(Ng?function(a){return V(a.id)(a.value)}:ud).y(Ng?ud:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=xe(b.values);return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),sg[b.id]?Je(e,Yf,V(b.id),sg[b.id]):a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Di=function(){var a;return a=Ng?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Ei=function(){var a=mf.svg.line().x(Ng?function(a){return W(a.id)(a.value)}:xd).y(Ng?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+_f(c[0].x)+" "+W(b.id)(c[0].value)}}(),Fi=function(){};Bi=mf.svg.brush().on("brush",Se),Bi.update=function(){return Ji&&Ji.select("."+f.brush).call(this),this},Bi.scale=function(a){return Ng?this.y(a):this.x(a)},uf&&(Fi=mf.behavior.zoom().on("zoomstart",function(){Fi.altDomain=mf.event.sourceEvent.altKey?Yf.orgDomain():null}).on("zoom",uf?Te:null),Fi.scale=function(a){return Ng?this.y(a):this.x(a)},Fi.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Fi.updateScaleExtent=function(){var a=$b(Yf.orgDomain())/$b(Ni),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Gi,Hi,Ii,Ji,Ki,Li,Mi,Ni,Oi,Pi={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Gi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Gi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Gi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Gi.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Ki.selectAll(kd(a)).classed(f.legendItemHidden,!1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Gi.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Ki.selectAll(kd(a)).classed(f.legendItemHidden,!0),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){Bi.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){lg[b]=a.classes[b]}),"categories"in a&&di&&(Qg=a.categories,cg.categories(Qg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Ii.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){vg&&Ii.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=wg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?xg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){vg&&Ii.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=wg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&xg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?mg:(mg=a,Re(),mg)},nf.xgrids=function(a){return a?(th=a,Re(),th):th},nf.xgrids.add=function(a){return a?nf.xgrids(th.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(th.filter(b))},nf.ygrids=function(a){return a?(vh=a,Re(),vh):vh},nf.ygrids.add=function(a){return a?nf.ygrids(vh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(vh.filter(b))},nf.regions=function(a){return c(a)?Qh:(Qh=a,Re(),Qh)},nf.regions.add=function(a){return c(a)?Qh:(Qh=Qh.concat(a),Re(),Qh)},nf.regions.remove=function(a,c){var e=[].concat(a);return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;Gi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Qh=Qh.filter(function(b){return b.classes.indexOf(a)<0})}),Qh},nf.data.get=function(a){var b=nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},nf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){kg[b]=a[b] -}),gf(xc(nf.data.targets),{withTransition:!0}),kg):kg},nf.x=function(a){return arguments.length&&(mc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.xs=function(a){return arguments.length&&(nc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(ah=+a.y),b(a.y2)&&(jh=+a.y2)):ah=jh=+a,Re())},nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(bh=+a.y),b(a.y2)&&(kh=+a.y2)):bh=kh=+a,Re())},nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&nf.axis.max(a.max),"undefined"!=typeof a.min&&nf.axis.min(a.min))},nf.legend.show=function(a){Jg||(Jg=!0,Ki.style("visibility","visible")),ef(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.legend.hide=function(a){Jg&&me(a)&&(Jg=!1,Ki.style("visibility","hidden")),ff(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.resize=function(a){qf=a?a.width:null,rf=a?a.height:null,We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},nf.destroy=function(){nf.data.targets=void 0,nf.data.xs={},Mi.html(""),a.onresize=null},"url"in e.data)mf.xhr(e.data.url,function(a,b){var c,d=mf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=mf.csv.parse(b.response),Ke(c)});else if("rows"in e.data)Ke(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ke(qc(e.data.columns))}return nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file +!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.29"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cDf&&(Df=0),0>Ff&&(Ff=0),Bf={top:Ng?Af.top:If-Hg-(vi?0:a),right:0/0,bottom:20+(vi?0:a),left:Ng?zi:Af.left},Ef=Ng?Af.left-zi-Ai:Df,Gf=Ng?Ff:If-Bf.top-Bf.bottom,0>Ef&&(Ef=0),0>Gf&&(Gf=0),Cf={top:vi?0:If-a,right:0/0,bottom:0,left:vi?Hf-b:0},p(),vi&&Yd(nf.data.targets)&&(Cf.left=Df/2+Kf)}function o(){Ji.select("line."+f.xgridFocus).attr("x1",Ng?0:-10).attr("x2",Ng?Df:-10).attr("y1",Ng?-10:Af.top).attr("y2",Ng?-10:Ff)}function p(){Kf=Ff/2,Jf=.95*Kf,Lf=Xd(nf.data.targets)?.6*Jf:0}function q(){var a=Ng?f.axisX:f.axisY,b=mf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=mf.select(pf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return qf?qf:x()}function s(){var a=rf?rf:y();return a>0?a:320}function t(){return Yd(nf.data.targets)?0:sf?sf:Ng||!_g||eh?1:v("y")}function u(){var a=1;return Yd(nf.data.targets)?0:tf?tf:vi?P()+(ih&&!Ng?v("y2"):a):ih?nh||Ng?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||_g?"y2"!==a||ih?(gb(a).isInner?30:40)+("y2"===a?-10:0):Bi:Jg&&!vi?10:1}function x(){return+mf.select(pf).style("width").replace("px","")}function y(){return+mf.select(pf).style("height").replace("px","")}function z(a){return a?-5:-(Af.left-1)}function A(a){return a?-20:-1}function B(){return z(!Ng)}function C(){return A(!Ng)}function D(){return z(Ng)}function E(){return A(Ng)}function F(a){return a?Df+2+4:Af.left+20}function G(a){return a?80:Ff+2}function H(){return F(!Ng)}function I(){return G(!Ng)}function J(){return F(Ng)}function K(){return G(Ng)}function L(){var a=Ng?Ff:Df,b=vc(),c=Vb()*(Ud(nf.data.targets)?(b-(ei?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){wi=a}function N(a){xi=a}function O(a){yi=a}function P(){return Jg?vi?xi*(wi+1):Hf:0}function Q(){return Jg?vi?If:yi*(wi+1):0}function R(){var a,b=!Yf;Qf=Ng?1:0,Rf=Ng?Ff:Df,Sf=Ng?0:Ff,Tf=Ng?Df:1,Uf=Qf,Vf=Rf,Wf=Ng?0:Gf,Xf=Ng?Ef:1,Yf=T(Qf,Rf,b?void 0:Yf.domain(),function(){return cg.tickOffset()}),Zf=U(Sf,Tf),$f=U(Sf,Tf),_f=T(Qf,Rf,Oi,function(a){return a%1?0:fg.tickOffset()}),ag=U(Wf,Xf),bg=U(Wf,Xf),a=$(),cg=X(Yf,qi,a),fg=X(_f,ti,a),dg=Y(Zf,ri,fh,hh),eg=Y($f,si,oh,qh),b||(Ci.scale(_f),uf&&Gi.scale(Yf)),S()}function S(){Mf=Db(),Nf=Eb(),Of=Eb(.98)}function T(a,b,e,f){var g=(di?mf.time.scale():mf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),ei){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return mf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?$f:Zf}function W(a){return"y2"===Z(a)?bg:ag}function X(a,b,c){var d=(ei?Bb():mf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),ei?d.tickCentered(Rg):d.tickOffset=function(){var a=Ng?Ff:Df;return a*Vb()/vc()/2},ei&&d.categories(Qg),d}function Y(a,b,c,d){return mf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in ng?ng[a]:"y"}function $(){var a=di?ni:ei?Oc:function(a){return 0>a?a.toFixed(0):a};return Sg&&("function"==typeof Sg?a=Sg:di&&(a=function(a){return mi(Sg)(a)})),a}function _(a){var b;return"y"===a?b=dh:"y2"===a?b=mh:"x"===a&&(b=$g),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?dh=b:"y2"===a?mh=b:"x"===a&&($g=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Ng?"inner-top":"inner-right")}function eb(){return cb("y",Ng?"inner-right":"inner-top")}function fb(){return cb("y2",Ng?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?Df/2:Df:b.isBottom?-Ff:b.isMiddle?-Ff/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Ng,db())}function ob(){return kb(Ng,eb())}function pb(){return kb(Ng,fb())}function qb(){return lb(!Ng,db())}function rb(){return lb(Ng,eb())}function sb(){return lb(Ng,fb())}function tb(){var a=db();return Ng?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Ng?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Ng?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Ng,db())}function xb(){return mb(Ng,eb())}function yb(){return mb(Ng,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Ji.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Ji.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Ji.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return mf.min(Object.keys(i).map(function(a){return mf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(mg.length>0)for(g=Nc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return mf.max(Object.keys(i).map(function(a){return mf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?kh:bh,n="y2"===c?jh:ah,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?lh:ch,r=pd()&&Ng;return 0===l.length?"y2"===c?$f.domain():Zf.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=qd(o,p),j=$b(Zf.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&gh&&(f=b(gh.top)?gh.top:e,g=b(gh.bottom)?gh.bottom:e),"y2"===c&&ph&&(f=b(ph.top)?ph.top:e,g=b(ph.bottom)?ph.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Oi),c=$b(Yf.domain());return a||0===c?1:b/c}function Wb(a){return Yg?Yg:mf.min(a,function(a){return mf.min(a.values,function(a){return a.x})})}function Xb(a){return Xg?Xg:mf.max(a,function(a){return mf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return ei?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=0,g=0;return(c||0===c)&&(f=di?new Date(c.getTime()-e):c-e),(d||0===d)&&(g=di?new Date(d.getTime()+e):d+e),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return gg&&a===gg||ne(hg)&&oe(hg,a)}function fc(a){return!ec(a)}function gc(a){return gg?gg:ne(hg)?hg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=nf.data.xs[b])}),c}function ic(a,b){return a in nf.data.xs&&nf.data.xs[a]&&nf.data.xs[a][b]?nf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){hg[b]=a[b]})}function kc(a){return 1===mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=kg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),nf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=di?a?a instanceof Date?a:ie(a):ie(ic(b,c)):fi&&!ei?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):gg?(d=Object.keys(nf.data.xs),nf.data.xs[c]=d.length>0?nf.data.xs[d[0]]:void 0):ne(hg)&&(nf.data.xs[c]=hc(f,nf.data.targets)):nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=jg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return fi&&ei&&0===c&&g&&(0===e&&(Qg=[]),Qg.push(g)),("undefined"==typeof a[b]||nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),og&&Sd(xc(c).filter(function(a){return!(a in pg)}),og),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function tc(a){return a>0&&nf.data.targets[0].values[a-1]?nf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?nf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?nf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(nf.data.targets)}function zc(a,b){var c,d=xc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(di?new Date(h):h);i.push(d)}return di||(i=i.sort()),i}function Gc(a){oi=oi.concat(a)}function Hc(a){oi=oi.filter(function(b){return a.indexOf(b)<0})}function Ic(a){pi=pi.concat(a)}function Jc(a){pi=pi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Ed(){return rg&&"desc"===rg.toLowerCase()}function Fd(){return rg&&"asc"===rg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof rg&&a.sort(rg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(nf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Sh&&0!==m.length&&(Mi.html(Vh(a,$(),l,li)).style("display","block"),d=Mi.property("offsetWidth"),e=Mi.property("offsetHeight"),k?(g=Df/2+c[0],i=Ff/2+c[1]+20):(Ng?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Yf(m[0].x)+20):(f=q(),g=f+t()+Yf(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Mi.style("top",i+"px").style("left",g+"px"))}function Id(){Mi.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Sh&&(Vd(nf.data.targets)||Yd(nf.data.targets)||Ji.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Ng?"y1":"x1",ud).attr(Ng?"y2":"x2",ud))}function Kd(){Ji.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?Yf(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Eh?Eh:b?2*a.tickOffset()*Fh/b:0}function Sd(a,b){yc(a).forEach(function(a){Qi[a]=b===pg[a],pg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){pg[a.id]===b&&(c=!0),a.id in pg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in pg)||"line"===pg[b]||"spline"===pg[b]||"area"===pg[b]||"area-spline"===pg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===pg[b]||"area-spline"===pg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===pg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===pg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===pg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===pg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ie(b){var c;try{c=ig?mf.time.format(ig).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ig)}return c}function je(a,b){var c=mf.mouse(a),d=mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?Zf:$f,d=Ng?1:0,e=Ng?0:1;return Math.pow(Yf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Cg(b,a.node()),Ji.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md).attr("stroke",function(){return li(b)}).attr("r",1.4*Ch).transition().duration(100).attr("r",Ch)}function se(a,b,c){Dg(b,a.node()),Ji.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Cg(b,a.node()),a.transition().duration(100).style("fill",function(){return mf.rgb(li(b)).darker(1)})}function ve(a,b){Dg(b,a.node()),a.transition().duration(100).style("fill",function(){return li(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Ji.selectAll("."+f.circles+gd(c)):Ji).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",Bh)}function Ae(a){ye(a).filter(function(){return mf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",yh)}function Be(a){return Ji.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Ng?1:0,f=Ng?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Ng?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBoundingClientRect();return Ng?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(cg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Ng&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Je(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function Ke(b){var c,d,e;if(Ni=mf.select(pf),Ni.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Ni.html(""),Ni.classed("c3",!0),nf.data.xs={},nf.data.targets=rc(b),n(),R(),Yf.domain(mf.extent(Zb(nf.data.targets))),Zf.domain(Ub(nf.data.targets,"y")),$f.domain(Ub(nf.data.targets,"y2")),_f.domain(Yf.domain()),ag.domain(Zf.domain()),bg.domain($f.domain()),Oi=Yf.domain(),Ci.scale(_f),uf&&Gi.scale(Yf),Hi=Ni.append("svg").attr("width",Df+Af.left+Af.right).attr("height",Ff+Af.top+Af.bottom).on("mouseenter",xf).on("mouseleave",yf),Ii=Hi.append("defs"),Ii.append("clipPath").attr("id",Zh).append("rect").attr("width",Df).attr("height",Ff),Ii.append("clipPath").attr("id",$h).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Ii.append("clipPath").attr("id",_h).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Ji=Hi.append("g").attr("transform",ui.main),Ki=Gg?Hi.append("g").attr("transform",ui.context):null,Li=Hi.append("g").attr("transform",ui.legend),Jg||(Li.style("visibility","hidden"),pi=xc(nf.data.targets)),Mi=mf.select(pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),gf(xc(nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Ji.append("g").attr("class",f.axisX).attr("clip-path",Ng?"":bi).attr("transform",ui.x).append("text").attr("class",f.axisXLabel).attr("transform",Ng?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),_g&&Ji.append("g").attr("class",f.axisY).attr("clip-path",Ng?ci:"").attr("transform",ui.y).append("text").attr("class",f.axisYLabel).attr("transform",Ng?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),ih&&Ji.append("g").attr("class",f.axisY2).attr("transform",ui.y2).append("text").attr("class",f.axisY2Label).attr("transform",Ng?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Ji.append("g").attr("clip-path",ai).attr("class",f.grid),rh&&d.append("g").attr("class",f.xgrids),ne(th)&&d.append("g").attr("class",f.xgridLines),zh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),uh&&d.append("g").attr("class",f.ygrids),ne(vh)&&d.append("g").attr("class",f.ygridLines),Ji.append("g").attr("clip-path",ai).attr("class",f.regions),Ji.append("g").attr("clip-path",ai).attr("class",f.chart),c=Ji.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",uf?Ng?"ns-resize":"ew-resize":null),Ji.select("."+f.chart).append("g").attr("class",f.chartBars),Ji.select("."+f.chart).append("g").attr("class",f.chartLines),Ji.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",ui.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Ji.select("."+f.chart).append("g").attr("class",f.chartTexts),uf&&Ji.insert("rect",wf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Df).attr("height",Ff).style("opacity",0).style("cursor",Ng?"ns-resize":"ew-resize").call(Gi).on("dblclick.zoom",null),Zg&&Ci.extent("function"!=typeof Zg?Zg:Zg(Zb())),Gg&&(Ki.append("g").attr("clip-path",ai).attr("class",f.chart),Ki.select("."+f.chart).append("g").attr("class",f.chartBars),Ki.select("."+f.chart).append("g").attr("class",f.chartLines),Ki.append("g").attr("clip-path",ai).attr("class",f.brush).call(Ci).selectAll("rect").attr(Ng?"width":"height",Ng?Ef:Gf),Ki.append("g").attr("class",f.axisX).attr("transform",ui.subx).attr("clip-path",Ng?"":bi)),Xe(nf.data.targets),Ng?Ji.select("."+f.axisX).style("opacity",0).call(cg):(Ji.select("."+f.axisY).style("opacity",0).call(dg),Ji.select("."+f.axisY2).style("opacity",0).call(eg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Wh){if(di&&"string"==typeof Xh){for(Xh=ie(Xh),e=0;e0){d=[];for(var g in kg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function Pe(a){Yd(nf.data.targets)||vg&&(gi=a,Ji.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),hi=!0,Eg())}function Qe(){Yd(nf.data.targets)||vg&&(Ji.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Ji.selectAll("."+f.shape).classed(f.INCLUDED,!1),hi=!1,Fg())}function Re(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Nd(),U=Yd(nf.data.targets),V=Dc(nf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?zf:0,O=B?N:0,P=C?N:0,H&&Jg&&gf(xc(nf.data.targets),a),G&&(Yf.domain(mf.extent(Zb(V))),Oi=Yf.domain(),uf&&Gi.scale(Yf).updateScaleExtent(),_f.domain(Yf.domain()),Ci.scale(_f)),F&&(Yf.domain(Ci.empty()?Oi:Ci.extent()),uf&&Gi.scale(Yf).updateScaleExtent()),Zf.domain(Ub(V,"y")),$f.domain(Ub(V,"y2")),Vd(V)||(Q=Fc(Ec(V)),cg.tickValues(Q),fg.tickValues(Q)),c=Ji.select("."+f.axisX).style("opacity",U?0:1),(Ng||D)&&(c=c.transition().duration(P)),c.call(cg),e=Ji.select("."+f.axisY).style("opacity",U?0:1),(!Ng||D)&&(e=e.transition().duration(P)),e.call(dg),Ji.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(eg),F&&Tg&&Q){for(R=1;R0&&mf.select(this).style("display",b%S?"none":"block")})}if(I=Ee(T),K=Fe(T,!0),M=Fe(T,!1),Ab(),ag.domain(Zf.domain()),bg.domain($f.domain()),Mi.style("display","none"),o(),Ji.select("line."+f.xgridFocus).style("visibility","hidden"),rh){if("year"===sh){h=[];for(var W=Zb(),X=W[0].getFullYear(),Y=W[1].getFullYear(),Z=X;Y>=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=Yf.ticks(10);g=Ji.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Ng?0:function(a){return Yf(a)-cg.tickOffset()}).attr("x2",Ng?Df:function(a){return Yf(a)-cg.tickOffset()}).attr("y1",Ng?function(a){return Yf(a)-cg.tickOffset()}:Af.top).attr("y2",Ng?function(a){return Yf(a)-cg.tickOffset()}:Ff).style("opacity",function(){return+mf.select(this).attr(Ng?"y1":"x1")===(Ng?Ff:0)?0:1}),g.exit().remove()}ne(th)&&(i=Ji.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(th),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Ng?"":"rotate(-90)").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Ng?0:vd).attr("x2",Ng?Df:vd).attr("y1",Ng?vd:Af.top).attr("y2",Ng?vd:Ff).style("opacity",1),i.select("text").transition().duration(N).attr("x",Ng?Df:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&uh&&(k=Ji.select("."+f.ygrids).selectAll("."+f.ygrid).data(Zf.ticks(wh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Ng?Zf:0).attr("x2",Ng?Zf:Df).attr("y1",Ng?0:Zf).attr("y2",Ng?Ff:Zf),k.exit().remove()),y&&ne(vh)&&(l=Ji.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(vh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Ng?"rotate(-90)":"").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Ng?wd:0).attr("x2",Ng?wd:Df).attr("y1",Ng?0:wd).attr("y2",Ng?Ff:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Ng?0:Df).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Ji.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return li(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Ji.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Ng?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Ji.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Di).style("opacity",1),Ji.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Ei).style("opacity",Pi),n=Ji.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",yh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),n.exit().remove(),Ji.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=mf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Ji.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Ji.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Gg&&(null!==mf.event&&"zoom"===mf.event.type&&Ci.extent(Yf.orgDomain()).update(),z&&(Ki.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(fg),Ci.empty()||Ci.extent(Yf.orgDomain()).update(),J=Ee(T,!0),s=Ki.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return li(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Ki.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Fi).style("opacity",1))),Ji.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Ji.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),t=Ji.select("."+f.eventRects),ne(hg)&&!kc(hg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Ji.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Df).attr("height",Ff)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),fi&&!ei?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return(Yf(d?d:e+50)-Yf(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return(Yf(d)+Yf(c?c:d-50))/2}):(x=L(),w=function(a){return Yf(a.x)-x/2}),v=wc(),Ji.select("."+f.eventRects).datum(v?v.values:[]),u=Ji.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Ng?0:w).attr("y",Ng?w:0).attr("width",Ng?Df:x).attr("height",Ng?x:Ff),u.exit().remove()),q=Ji.select("."+f.regions).selectAll("rect."+f.region).data(Rh),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Ng?0:cc).attr("y",Ng?cc:Af.top).attr("width",Ng?Df:dc).attr("height",Ng?dc:Ff).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),xc(nf.data.targets).forEach(function(a){Qi[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Gi.altDomain?(Yf.domain(Gi.altDomain),void Gi.scale(Yf).updateScaleExtent()):(ei&&Yf.orgDomain()[0]===Oi[0]&&Yf.domain([Oi[0]-1e-10,Yf.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(ii=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Hi.attr("width",Hf).attr("height",If),Hi.select("#"+Zh).select("rect").attr("width",Df).attr("height",Ff),Hi.select("#"+$h).select("rect").attr("width",H),Hi.select("#"+_h).select("rect").attr("width",J),Hi.select("."+f.zoomRect).attr("width",Df).attr("height",Ff)}function We(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Ji.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return li(a)}),e=Ji.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return li(a)}).style("stroke","none").style("cursor",function(a){return xg(a)?"pointer":null}),c=Ji.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return li(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Pi=+mf.select(this).style("opacity"),0}).style("fill",function(a){return li(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return li(a)}).style("cursor",function(a){return xg(a)?"pointer":null}),a.forEach(function(a){Ji.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Ji.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Pf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return li(a.data)}).style("cursor",function(a){return xg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Gg&&(n=Ki.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return li(a)}),l=Ki.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return li(a)})),Hi.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=vi?j:i,l=vi?Q():P();return d&&(w=0,C=0,t=0,u=0),Jg&&!Cc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=vi?u:t,void(Mg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,vi?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Li.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Lg?Lg(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",vi?g:-200).attr("y",vi?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",vi?h:-200).attr("y",vi?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return li(a)}).attr("x",vi?g:-200).attr("y",vi?-200:i).attr("width",10).attr("height",10),Li.selectAll("text").data(a).text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Li.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Li.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["transition","duration"],350);g("data","data is required in config");var Af,Bf,Cf,Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg=h(["data","x"]),hg=h(["data","xs"],{}),ig=h(["data","x_format"]),jg=h(["data","id_converter"],function(a){return a}),kg=h(["data","names"],{}),lg=h(["data","classes"],{}),mg=h(["data","groups"],[]),ng=h(["data","axes"],{}),og=h(["data","type"]),pg=h(["data","types"],{}),qg=h(["data","labels"],{}),rg=h(["data","order"]),sg=h(["data","regions"],{}),tg=h(["data","color"]),ug=h(["data","colors"],{}),vg=h(["data","selection","enabled"],!1),wg=h(["data","selection","grouped"],!1),xg=h(["data","selection","isselectable"],function(){return!0}),yg=h(["data","selection","multiple"],!0),zg=h(["data","onclick"],function(){}),Ag=h(["data","onenter"],function(){}),Bg=h(["data","onleave"],function(){}),Cg=h(["data","onselected"],function(){}),Dg=h(["data","onunselected"],function(){}),Eg=h(["data","ondragstart"],function(){}),Fg=h(["data","ondragend"],function(){}),Gg=h(["subchart","show"],!1),Hg=Gg?h(["subchart","size","height"],60):0,Ig=h(["color","pattern"],[]),Jg=h(["legend","show"],!0),Kg=h(["legend","position"],"bottom"),Lg=h(["legend","item","onclick"]),Mg=h(["legend","equally"],!1),Ng=h(["axis","rotated"],!1),Og=h(["axis","x","type"],"indexed"),Pg=h(["axis","x","localtime"],!1),Qg=h(["axis","x","categories"],[]),Rg=h(["axis","x","tick","centered"],!1),Sg=h(["axis","x","tick","format"]),Tg=h(["axis","x","tick","culling"],{}),Ug=h(["axis","x","tick","culling","max"],"categorized"===Og?1/0:10),Vg=h(["axis","x","tick","count"]),Wg=h(["axis","x","tick","fit"],!1),Xg=h(["axis","x","max"]),Yg=h(["axis","x","min"]),Zg=h(["axis","x","default"]),$g=h(["axis","x","label"],{}),_g=h(["axis","y","show"],!0),ah=h(["axis","y","max"]),bh=h(["axis","y","min"]),ch=h(["axis","y","center"]),dh=h(["axis","y","label"],{}),eh=h(["axis","y","inner"],!1),fh=h(["axis","y","tick","format"]),gh=h(["axis","y","padding"],{}),hh=h(["axis","y","ticks"],10),ih=h(["axis","y2","show"],!1),jh=h(["axis","y2","max"]),kh=h(["axis","y2","min"]),lh=h(["axis","y2","center"]),mh=h(["axis","y2","label"],{}),nh=h(["axis","y2","inner"],!1),oh=h(["axis","y2","tick","format"]),ph=h(["axis","y2","padding"],{}),qh=h(["axis","y2","ticks"],10),rh=h(["grid","x","show"],!1),sh=h(["grid","x","type"],"tick"),th=h(["grid","x","lines"],[]),uh=h(["grid","y","show"],!1),vh=h(["grid","y","lines"],[]),wh=h(["grid","y","ticks"],10),xh=h(["point","show"],!0),yh=xh?h(["point","r"],2.5):0,zh=h(["point","focus","line","enabled"],!0),Ah=h(["point","focus","expand","enabled"],!0),Bh=h(["point","focus","expand","r"],Ah?4:yh),Ch=h(["point","focus","select","r"],8),Dh=h(["line","connect_null"],!1),Eh=h(["bar","width"]),Fh=h(["bar","width","ratio"],.6),Gh=h(["pie","label","show"],!0),Hh=h(["pie","label","format"]),Ih=h(["pie","onclick"],function(){}),Jh=h(["pie","onmouseover"],function(){}),Kh=h(["pie","onmouseout"],function(){}),Lh=h(["donut","label","show"],!0),Mh=h(["donut","label","format"]),Nh=h(["donut","title"],""),Oh=h(["donut","onclick"],function(){}),Ph=h(["donut","onmouseover"],function(){}),Qh=h(["donut","onmouseout"],function(){}),Rh=h(["regions"],[]),Sh=h(["tooltip","show"],!0),Th=h(["tooltip","format","title"]),Uh=h(["tooltip","format","value"]),Vh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Th?Th:b,l=Uh?Uh:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Wh=h(["tooltip","init","show"],!1),Xh=h(["tooltip","init","x"],0),Yh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Zh=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",$h=Zh+"-xaxis",_h=Zh+"-yaxis",ai=i(Zh),bi=i($h),ci=i(_h),di="timeseries"===Og,ei="categorized"===Og,fi=!di&&(gg||ne(hg)),gi=null,hi=!1,ii=!1,ji=!1,ki=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],li=he(ug,ne(Ig)?Ig:ki,tg),mi=Pg?mf.time.format:mf.time.format.utc,ni=function(){var a=[[mi("%Y/%-m/%-d"),function(){return!0}],[mi("%-m/%-d"),function(a){return a.getMonth()}],[mi("%-m/%-d"),function(a){return 1!==a.getDate()}],[mi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[mi("%I %p"),function(a){return a.getHours()}],[mi("%I:%M"),function(a){return a.getMinutes()}],[mi(":%S"),function(a){return a.getSeconds()}],[mi(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),oi=[],pi=[],qi=Ng?"left":"bottom",ri=Ng?eh?"top":"bottom":eh?"right":"left",si=Ng?nh?"bottom":"top":nh?"left":"right",ti=Ng?"left":"bottom",ui={main:function(){return"translate("+Af.left+","+Af.top+")"},context:function(){return"translate("+Bf.left+","+Bf.top+")"},legend:function(){return"translate("+Cf.left+","+Cf.top+")"},x:function(){return"translate(0,"+(Ng?0:Ff)+")"},y:function(){return"translate(0,"+(Ng?Ff:0)+")"},y2:function(){return"translate("+(Ng?0:Df)+","+(Ng?1:0)+")"},subx:function(){return"translate(0,"+(Ng?0:Gf)+")"},arc:function(){return"translate("+Df/2+","+Ff/2+")"}},vi="right"===Kg,wi=0,xi=0,yi=0,zi=30,Ai=30,Bi=5;Pf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Ci,Di=function(){var a=mf.svg.line().x(Ng?function(a){return V(a.id)(a.value)}:ud).y(Ng?ud:function(a){return V(a.id)(a.value)});return Dh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Dh?xe(b.values):b.values;return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),sg[b.id]?Je(e,Yf,V(b.id),sg[b.id]):a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Ei=function(){var a;return a=Ng?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Fi=function(){var a=mf.svg.line().x(Ng?function(a){return W(a.id)(a.value)}:xd).y(Ng?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+_f(c[0].x)+" "+W(b.id)(c[0].value)}}(),Gi=function(){};Ci=mf.svg.brush().on("brush",Se),Ci.update=function(){return Ki&&Ki.select("."+f.brush).call(this),this},Ci.scale=function(a){return Ng?this.y(a):this.x(a)},uf&&(Gi=mf.behavior.zoom().on("zoomstart",function(){Gi.altDomain=mf.event.sourceEvent.altKey?Yf.orgDomain():null}).on("zoom",uf?Te:null),Gi.scale=function(a){return Ng?this.y(a):this.x(a)},Gi.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Gi.updateScaleExtent=function(){var a=$b(Yf.orgDomain())/$b(Oi),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Hi,Ii,Ji,Ki,Li,Mi,Ni,Oi,Pi,Qi={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Hi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Hi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Hi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Hi.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Li.selectAll(kd(a)).classed(f.legendItemHidden,!1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Hi.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Li.selectAll(kd(a)).classed(f.legendItemHidden,!0),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){Ci.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){lg[b]=a.classes[b]}),"categories"in a&&ei&&(Qg=a.categories,cg.categories(Qg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Ji.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){vg&&Ji.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=wg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?xg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){vg&&Ji.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=wg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&xg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?mg:(mg=a,Re(),mg)},nf.xgrids=function(a){return a?(th=a,Re(),th):th},nf.xgrids.add=function(a){return a?nf.xgrids(th.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(th.filter(b))},nf.ygrids=function(a){return a?(vh=a,Re(),vh):vh},nf.ygrids.add=function(a){return a?nf.ygrids(vh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(vh.filter(b))},nf.regions=function(a){return c(a)?Rh:(Rh=a,Re(),Rh)},nf.regions.add=function(a){return c(a)?Rh:(Rh=Rh.concat(a),Re(),Rh)},nf.regions.remove=function(a,c){var e=[].concat(a);return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;Hi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Rh=Rh.filter(function(b){return b.classes.indexOf(a)<0})}),Rh},nf.data.get=function(a){var b=nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},nf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a +});return b.length>0?b[0]:void 0},nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){kg[b]=a[b]}),gf(xc(nf.data.targets),{withTransition:!0}),kg):kg},nf.x=function(a){return arguments.length&&(mc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.xs=function(a){return arguments.length&&(nc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(ah=+a.y),b(a.y2)&&(jh=+a.y2)):ah=jh=+a,Re())},nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(bh=+a.y),b(a.y2)&&(kh=+a.y2)):bh=kh=+a,Re())},nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&nf.axis.max(a.max),"undefined"!=typeof a.min&&nf.axis.min(a.min))},nf.legend.show=function(a){Jg||(Jg=!0,Li.style("visibility","visible")),ef(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.legend.hide=function(a){Jg&&me(a)&&(Jg=!1,Li.style("visibility","hidden")),ff(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.resize=function(a){qf=a?a.width:null,rf=a?a.height:null,We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},nf.destroy=function(){nf.data.targets=void 0,nf.data.xs={},Ni.html(""),a.onresize=null},"url"in e.data)mf.xhr(e.data.url,function(a,b){var c,d=mf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=mf.csv.parse(b.response),Ke(c)});else if("rows"in e.data)Ke(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ke(qc(e.data.columns))}return nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From fc9e61da60e4ba41af48a9ee637b6c2b76a82576 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Sat, 12 Apr 2014 21:16:39 +0900 Subject: [PATCH 037/178] Add onresize and onresized event hander - #145 --- c3.js | 6 +++++- c3.min.js | 6 +++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/c3.js b/c3.js index e356085..3db8115 100644 --- a/c3.js +++ b/c3.js @@ -113,7 +113,9 @@ __zoom_privileged = getConfig(['zoom', 'privileged'], false); var __onenter = getConfig(['onenter'], function () {}), - __onleave = getConfig(['onleave'], function () {}); + __onleave = getConfig(['onleave'], function () {}), + __onresize = getConfig(['onresize'], function () {}), + __onresized = getConfig(['onresized'], function () {}); var __transition_duration = getConfig(['transition', 'duration'], 350); @@ -2656,9 +2658,11 @@ window.onresize = generateResize(); } if (window.onresize.add) { + window.onresize.add(__onresize); window.onresize.add(function () { updateAndRedraw({withLegend: true, withTransition: false, withTransitionForTransform: false}); }); + window.onresize.add(__onresized); } } diff --git a/c3.min.js b/c3.min.js index 39921e7..2cd2e2a 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.29"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cDf&&(Df=0),0>Ff&&(Ff=0),Bf={top:Ng?Af.top:If-Hg-(vi?0:a),right:0/0,bottom:20+(vi?0:a),left:Ng?zi:Af.left},Ef=Ng?Af.left-zi-Ai:Df,Gf=Ng?Ff:If-Bf.top-Bf.bottom,0>Ef&&(Ef=0),0>Gf&&(Gf=0),Cf={top:vi?0:If-a,right:0/0,bottom:0,left:vi?Hf-b:0},p(),vi&&Yd(nf.data.targets)&&(Cf.left=Df/2+Kf)}function o(){Ji.select("line."+f.xgridFocus).attr("x1",Ng?0:-10).attr("x2",Ng?Df:-10).attr("y1",Ng?-10:Af.top).attr("y2",Ng?-10:Ff)}function p(){Kf=Ff/2,Jf=.95*Kf,Lf=Xd(nf.data.targets)?.6*Jf:0}function q(){var a=Ng?f.axisX:f.axisY,b=mf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=mf.select(pf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return qf?qf:x()}function s(){var a=rf?rf:y();return a>0?a:320}function t(){return Yd(nf.data.targets)?0:sf?sf:Ng||!_g||eh?1:v("y")}function u(){var a=1;return Yd(nf.data.targets)?0:tf?tf:vi?P()+(ih&&!Ng?v("y2"):a):ih?nh||Ng?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||_g?"y2"!==a||ih?(gb(a).isInner?30:40)+("y2"===a?-10:0):Bi:Jg&&!vi?10:1}function x(){return+mf.select(pf).style("width").replace("px","")}function y(){return+mf.select(pf).style("height").replace("px","")}function z(a){return a?-5:-(Af.left-1)}function A(a){return a?-20:-1}function B(){return z(!Ng)}function C(){return A(!Ng)}function D(){return z(Ng)}function E(){return A(Ng)}function F(a){return a?Df+2+4:Af.left+20}function G(a){return a?80:Ff+2}function H(){return F(!Ng)}function I(){return G(!Ng)}function J(){return F(Ng)}function K(){return G(Ng)}function L(){var a=Ng?Ff:Df,b=vc(),c=Vb()*(Ud(nf.data.targets)?(b-(ei?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){wi=a}function N(a){xi=a}function O(a){yi=a}function P(){return Jg?vi?xi*(wi+1):Hf:0}function Q(){return Jg?vi?If:yi*(wi+1):0}function R(){var a,b=!Yf;Qf=Ng?1:0,Rf=Ng?Ff:Df,Sf=Ng?0:Ff,Tf=Ng?Df:1,Uf=Qf,Vf=Rf,Wf=Ng?0:Gf,Xf=Ng?Ef:1,Yf=T(Qf,Rf,b?void 0:Yf.domain(),function(){return cg.tickOffset()}),Zf=U(Sf,Tf),$f=U(Sf,Tf),_f=T(Qf,Rf,Oi,function(a){return a%1?0:fg.tickOffset()}),ag=U(Wf,Xf),bg=U(Wf,Xf),a=$(),cg=X(Yf,qi,a),fg=X(_f,ti,a),dg=Y(Zf,ri,fh,hh),eg=Y($f,si,oh,qh),b||(Ci.scale(_f),uf&&Gi.scale(Yf)),S()}function S(){Mf=Db(),Nf=Eb(),Of=Eb(.98)}function T(a,b,e,f){var g=(di?mf.time.scale():mf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),ei){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return mf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?$f:Zf}function W(a){return"y2"===Z(a)?bg:ag}function X(a,b,c){var d=(ei?Bb():mf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),ei?d.tickCentered(Rg):d.tickOffset=function(){var a=Ng?Ff:Df;return a*Vb()/vc()/2},ei&&d.categories(Qg),d}function Y(a,b,c,d){return mf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in ng?ng[a]:"y"}function $(){var a=di?ni:ei?Oc:function(a){return 0>a?a.toFixed(0):a};return Sg&&("function"==typeof Sg?a=Sg:di&&(a=function(a){return mi(Sg)(a)})),a}function _(a){var b;return"y"===a?b=dh:"y2"===a?b=mh:"x"===a&&(b=$g),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?dh=b:"y2"===a?mh=b:"x"===a&&($g=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Ng?"inner-top":"inner-right")}function eb(){return cb("y",Ng?"inner-right":"inner-top")}function fb(){return cb("y2",Ng?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?Df/2:Df:b.isBottom?-Ff:b.isMiddle?-Ff/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Ng,db())}function ob(){return kb(Ng,eb())}function pb(){return kb(Ng,fb())}function qb(){return lb(!Ng,db())}function rb(){return lb(Ng,eb())}function sb(){return lb(Ng,fb())}function tb(){var a=db();return Ng?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Ng?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Ng?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Ng,db())}function xb(){return mb(Ng,eb())}function yb(){return mb(Ng,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Ji.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Ji.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Ji.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return mf.min(Object.keys(i).map(function(a){return mf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(mg.length>0)for(g=Nc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return mf.max(Object.keys(i).map(function(a){return mf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?kh:bh,n="y2"===c?jh:ah,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?lh:ch,r=pd()&&Ng;return 0===l.length?"y2"===c?$f.domain():Zf.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=qd(o,p),j=$b(Zf.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&gh&&(f=b(gh.top)?gh.top:e,g=b(gh.bottom)?gh.bottom:e),"y2"===c&&ph&&(f=b(ph.top)?ph.top:e,g=b(ph.bottom)?ph.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Oi),c=$b(Yf.domain());return a||0===c?1:b/c}function Wb(a){return Yg?Yg:mf.min(a,function(a){return mf.min(a.values,function(a){return a.x})})}function Xb(a){return Xg?Xg:mf.max(a,function(a){return mf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return ei?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=0,g=0;return(c||0===c)&&(f=di?new Date(c.getTime()-e):c-e),(d||0===d)&&(g=di?new Date(d.getTime()+e):d+e),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return gg&&a===gg||ne(hg)&&oe(hg,a)}function fc(a){return!ec(a)}function gc(a){return gg?gg:ne(hg)?hg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=nf.data.xs[b])}),c}function ic(a,b){return a in nf.data.xs&&nf.data.xs[a]&&nf.data.xs[a][b]?nf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){hg[b]=a[b]})}function kc(a){return 1===mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=kg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),nf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=di?a?a instanceof Date?a:ie(a):ie(ic(b,c)):fi&&!ei?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):gg?(d=Object.keys(nf.data.xs),nf.data.xs[c]=d.length>0?nf.data.xs[d[0]]:void 0):ne(hg)&&(nf.data.xs[c]=hc(f,nf.data.targets)):nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=jg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return fi&&ei&&0===c&&g&&(0===e&&(Qg=[]),Qg.push(g)),("undefined"==typeof a[b]||nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),og&&Sd(xc(c).filter(function(a){return!(a in pg)}),og),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function tc(a){return a>0&&nf.data.targets[0].values[a-1]?nf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?nf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?nf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(nf.data.targets)}function zc(a,b){var c,d=xc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(di?new Date(h):h);i.push(d)}return di||(i=i.sort()),i}function Gc(a){oi=oi.concat(a)}function Hc(a){oi=oi.filter(function(b){return a.indexOf(b)<0})}function Ic(a){pi=pi.concat(a)}function Jc(a){pi=pi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Ed(){return rg&&"desc"===rg.toLowerCase()}function Fd(){return rg&&"asc"===rg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof rg&&a.sort(rg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(nf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Sh&&0!==m.length&&(Mi.html(Vh(a,$(),l,li)).style("display","block"),d=Mi.property("offsetWidth"),e=Mi.property("offsetHeight"),k?(g=Df/2+c[0],i=Ff/2+c[1]+20):(Ng?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Yf(m[0].x)+20):(f=q(),g=f+t()+Yf(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Mi.style("top",i+"px").style("left",g+"px"))}function Id(){Mi.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Sh&&(Vd(nf.data.targets)||Yd(nf.data.targets)||Ji.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Ng?"y1":"x1",ud).attr(Ng?"y2":"x2",ud))}function Kd(){Ji.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?Yf(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Eh?Eh:b?2*a.tickOffset()*Fh/b:0}function Sd(a,b){yc(a).forEach(function(a){Qi[a]=b===pg[a],pg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){pg[a.id]===b&&(c=!0),a.id in pg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in pg)||"line"===pg[b]||"spline"===pg[b]||"area"===pg[b]||"area-spline"===pg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===pg[b]||"area-spline"===pg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===pg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===pg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===pg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===pg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ie(b){var c;try{c=ig?mf.time.format(ig).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ig)}return c}function je(a,b){var c=mf.mouse(a),d=mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?Zf:$f,d=Ng?1:0,e=Ng?0:1;return Math.pow(Yf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Cg(b,a.node()),Ji.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md).attr("stroke",function(){return li(b)}).attr("r",1.4*Ch).transition().duration(100).attr("r",Ch)}function se(a,b,c){Dg(b,a.node()),Ji.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Cg(b,a.node()),a.transition().duration(100).style("fill",function(){return mf.rgb(li(b)).darker(1)})}function ve(a,b){Dg(b,a.node()),a.transition().duration(100).style("fill",function(){return li(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Ji.selectAll("."+f.circles+gd(c)):Ji).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",Bh)}function Ae(a){ye(a).filter(function(){return mf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",yh)}function Be(a){return Ji.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Ng?1:0,f=Ng?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Ng?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBoundingClientRect();return Ng?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(cg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Ng&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Je(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function Ke(b){var c,d,e;if(Ni=mf.select(pf),Ni.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Ni.html(""),Ni.classed("c3",!0),nf.data.xs={},nf.data.targets=rc(b),n(),R(),Yf.domain(mf.extent(Zb(nf.data.targets))),Zf.domain(Ub(nf.data.targets,"y")),$f.domain(Ub(nf.data.targets,"y2")),_f.domain(Yf.domain()),ag.domain(Zf.domain()),bg.domain($f.domain()),Oi=Yf.domain(),Ci.scale(_f),uf&&Gi.scale(Yf),Hi=Ni.append("svg").attr("width",Df+Af.left+Af.right).attr("height",Ff+Af.top+Af.bottom).on("mouseenter",xf).on("mouseleave",yf),Ii=Hi.append("defs"),Ii.append("clipPath").attr("id",Zh).append("rect").attr("width",Df).attr("height",Ff),Ii.append("clipPath").attr("id",$h).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Ii.append("clipPath").attr("id",_h).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Ji=Hi.append("g").attr("transform",ui.main),Ki=Gg?Hi.append("g").attr("transform",ui.context):null,Li=Hi.append("g").attr("transform",ui.legend),Jg||(Li.style("visibility","hidden"),pi=xc(nf.data.targets)),Mi=mf.select(pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),gf(xc(nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Ji.append("g").attr("class",f.axisX).attr("clip-path",Ng?"":bi).attr("transform",ui.x).append("text").attr("class",f.axisXLabel).attr("transform",Ng?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),_g&&Ji.append("g").attr("class",f.axisY).attr("clip-path",Ng?ci:"").attr("transform",ui.y).append("text").attr("class",f.axisYLabel).attr("transform",Ng?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),ih&&Ji.append("g").attr("class",f.axisY2).attr("transform",ui.y2).append("text").attr("class",f.axisY2Label).attr("transform",Ng?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Ji.append("g").attr("clip-path",ai).attr("class",f.grid),rh&&d.append("g").attr("class",f.xgrids),ne(th)&&d.append("g").attr("class",f.xgridLines),zh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),uh&&d.append("g").attr("class",f.ygrids),ne(vh)&&d.append("g").attr("class",f.ygridLines),Ji.append("g").attr("clip-path",ai).attr("class",f.regions),Ji.append("g").attr("clip-path",ai).attr("class",f.chart),c=Ji.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",uf?Ng?"ns-resize":"ew-resize":null),Ji.select("."+f.chart).append("g").attr("class",f.chartBars),Ji.select("."+f.chart).append("g").attr("class",f.chartLines),Ji.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",ui.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Ji.select("."+f.chart).append("g").attr("class",f.chartTexts),uf&&Ji.insert("rect",wf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Df).attr("height",Ff).style("opacity",0).style("cursor",Ng?"ns-resize":"ew-resize").call(Gi).on("dblclick.zoom",null),Zg&&Ci.extent("function"!=typeof Zg?Zg:Zg(Zb())),Gg&&(Ki.append("g").attr("clip-path",ai).attr("class",f.chart),Ki.select("."+f.chart).append("g").attr("class",f.chartBars),Ki.select("."+f.chart).append("g").attr("class",f.chartLines),Ki.append("g").attr("clip-path",ai).attr("class",f.brush).call(Ci).selectAll("rect").attr(Ng?"width":"height",Ng?Ef:Gf),Ki.append("g").attr("class",f.axisX).attr("transform",ui.subx).attr("clip-path",Ng?"":bi)),Xe(nf.data.targets),Ng?Ji.select("."+f.axisX).style("opacity",0).call(cg):(Ji.select("."+f.axisY).style("opacity",0).call(dg),Ji.select("."+f.axisY2).style("opacity",0).call(eg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Wh){if(di&&"string"==typeof Xh){for(Xh=ie(Xh),e=0;e0){d=[];for(var g in kg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function Pe(a){Yd(nf.data.targets)||vg&&(gi=a,Ji.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),hi=!0,Eg())}function Qe(){Yd(nf.data.targets)||vg&&(Ji.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Ji.selectAll("."+f.shape).classed(f.INCLUDED,!1),hi=!1,Fg())}function Re(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Nd(),U=Yd(nf.data.targets),V=Dc(nf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?zf:0,O=B?N:0,P=C?N:0,H&&Jg&&gf(xc(nf.data.targets),a),G&&(Yf.domain(mf.extent(Zb(V))),Oi=Yf.domain(),uf&&Gi.scale(Yf).updateScaleExtent(),_f.domain(Yf.domain()),Ci.scale(_f)),F&&(Yf.domain(Ci.empty()?Oi:Ci.extent()),uf&&Gi.scale(Yf).updateScaleExtent()),Zf.domain(Ub(V,"y")),$f.domain(Ub(V,"y2")),Vd(V)||(Q=Fc(Ec(V)),cg.tickValues(Q),fg.tickValues(Q)),c=Ji.select("."+f.axisX).style("opacity",U?0:1),(Ng||D)&&(c=c.transition().duration(P)),c.call(cg),e=Ji.select("."+f.axisY).style("opacity",U?0:1),(!Ng||D)&&(e=e.transition().duration(P)),e.call(dg),Ji.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(eg),F&&Tg&&Q){for(R=1;R0&&mf.select(this).style("display",b%S?"none":"block")})}if(I=Ee(T),K=Fe(T,!0),M=Fe(T,!1),Ab(),ag.domain(Zf.domain()),bg.domain($f.domain()),Mi.style("display","none"),o(),Ji.select("line."+f.xgridFocus).style("visibility","hidden"),rh){if("year"===sh){h=[];for(var W=Zb(),X=W[0].getFullYear(),Y=W[1].getFullYear(),Z=X;Y>=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=Yf.ticks(10);g=Ji.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Ng?0:function(a){return Yf(a)-cg.tickOffset()}).attr("x2",Ng?Df:function(a){return Yf(a)-cg.tickOffset()}).attr("y1",Ng?function(a){return Yf(a)-cg.tickOffset()}:Af.top).attr("y2",Ng?function(a){return Yf(a)-cg.tickOffset()}:Ff).style("opacity",function(){return+mf.select(this).attr(Ng?"y1":"x1")===(Ng?Ff:0)?0:1}),g.exit().remove()}ne(th)&&(i=Ji.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(th),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Ng?"":"rotate(-90)").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Ng?0:vd).attr("x2",Ng?Df:vd).attr("y1",Ng?vd:Af.top).attr("y2",Ng?vd:Ff).style("opacity",1),i.select("text").transition().duration(N).attr("x",Ng?Df:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&uh&&(k=Ji.select("."+f.ygrids).selectAll("."+f.ygrid).data(Zf.ticks(wh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Ng?Zf:0).attr("x2",Ng?Zf:Df).attr("y1",Ng?0:Zf).attr("y2",Ng?Ff:Zf),k.exit().remove()),y&&ne(vh)&&(l=Ji.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(vh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Ng?"rotate(-90)":"").attr("dx",Ng?0:-Af.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Ng?wd:0).attr("x2",Ng?wd:Df).attr("y1",Ng?0:wd).attr("y2",Ng?Ff:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Ng?0:Df).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Ji.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return li(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Ji.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Ng?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Ji.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Di).style("opacity",1),Ji.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Ei).style("opacity",Pi),n=Ji.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",yh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),n.exit().remove(),Ji.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=mf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Ji.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Ji.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Gg&&(null!==mf.event&&"zoom"===mf.event.type&&Ci.extent(Yf.orgDomain()).update(),z&&(Ki.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(fg),Ci.empty()||Ci.extent(Yf.orgDomain()).update(),J=Ee(T,!0),s=Ki.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return li(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Ki.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Fi).style("opacity",1))),Ji.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Ji.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Ng?Md:Ld).attr("cy",Ng?Ld:Md),t=Ji.select("."+f.eventRects),ne(hg)&&!kc(hg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Ji.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Df).attr("height",Ff)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),fi&&!ei?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return(Yf(d?d:e+50)-Yf(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return(Yf(d)+Yf(c?c:d-50))/2}):(x=L(),w=function(a){return Yf(a.x)-x/2}),v=wc(),Ji.select("."+f.eventRects).datum(v?v.values:[]),u=Ji.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Ng?0:w).attr("y",Ng?w:0).attr("width",Ng?Df:x).attr("height",Ng?x:Ff),u.exit().remove()),q=Ji.select("."+f.regions).selectAll("rect."+f.region).data(Rh),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Ng?0:cc).attr("y",Ng?cc:Af.top).attr("width",Ng?Df:dc).attr("height",Ng?dc:Ff).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),xc(nf.data.targets).forEach(function(a){Qi[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Gi.altDomain?(Yf.domain(Gi.altDomain),void Gi.scale(Yf).updateScaleExtent()):(ei&&Yf.orgDomain()[0]===Oi[0]&&Yf.domain([Oi[0]-1e-10,Yf.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(ii=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Hi.attr("width",Hf).attr("height",If),Hi.select("#"+Zh).select("rect").attr("width",Df).attr("height",Ff),Hi.select("#"+$h).select("rect").attr("width",H),Hi.select("#"+_h).select("rect").attr("width",J),Hi.select("."+f.zoomRect).attr("width",Df).attr("height",Ff)}function We(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Ji.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return li(a)}),e=Ji.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return li(a)}).style("stroke","none").style("cursor",function(a){return xg(a)?"pointer":null}),c=Ji.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return li(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Pi=+mf.select(this).style("opacity"),0}).style("fill",function(a){return li(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return li(a)}).style("cursor",function(a){return xg(a)?"pointer":null}),a.forEach(function(a){Ji.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Ji.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Pf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return li(a.data)}).style("cursor",function(a){return xg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Gg&&(n=Ki.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return li(a)}),l=Ki.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return li(a)})),Hi.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=vi?j:i,l=vi?Q():P();return d&&(w=0,C=0,t=0,u=0),Jg&&!Cc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=vi?u:t,void(Mg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,vi?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Li.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Lg?Lg(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",vi?g:-200).attr("y",vi?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",vi?h:-200).attr("y",vi?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return li(a)}).attr("x",vi?g:-200).attr("y",vi?-200:i).attr("width",10).attr("height",10),Li.selectAll("text").data(a).text(function(a){return d(kg[a])?kg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Li.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Li.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["transition","duration"],350);g("data","data is required in config");var Af,Bf,Cf,Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg=h(["data","x"]),hg=h(["data","xs"],{}),ig=h(["data","x_format"]),jg=h(["data","id_converter"],function(a){return a}),kg=h(["data","names"],{}),lg=h(["data","classes"],{}),mg=h(["data","groups"],[]),ng=h(["data","axes"],{}),og=h(["data","type"]),pg=h(["data","types"],{}),qg=h(["data","labels"],{}),rg=h(["data","order"]),sg=h(["data","regions"],{}),tg=h(["data","color"]),ug=h(["data","colors"],{}),vg=h(["data","selection","enabled"],!1),wg=h(["data","selection","grouped"],!1),xg=h(["data","selection","isselectable"],function(){return!0}),yg=h(["data","selection","multiple"],!0),zg=h(["data","onclick"],function(){}),Ag=h(["data","onenter"],function(){}),Bg=h(["data","onleave"],function(){}),Cg=h(["data","onselected"],function(){}),Dg=h(["data","onunselected"],function(){}),Eg=h(["data","ondragstart"],function(){}),Fg=h(["data","ondragend"],function(){}),Gg=h(["subchart","show"],!1),Hg=Gg?h(["subchart","size","height"],60):0,Ig=h(["color","pattern"],[]),Jg=h(["legend","show"],!0),Kg=h(["legend","position"],"bottom"),Lg=h(["legend","item","onclick"]),Mg=h(["legend","equally"],!1),Ng=h(["axis","rotated"],!1),Og=h(["axis","x","type"],"indexed"),Pg=h(["axis","x","localtime"],!1),Qg=h(["axis","x","categories"],[]),Rg=h(["axis","x","tick","centered"],!1),Sg=h(["axis","x","tick","format"]),Tg=h(["axis","x","tick","culling"],{}),Ug=h(["axis","x","tick","culling","max"],"categorized"===Og?1/0:10),Vg=h(["axis","x","tick","count"]),Wg=h(["axis","x","tick","fit"],!1),Xg=h(["axis","x","max"]),Yg=h(["axis","x","min"]),Zg=h(["axis","x","default"]),$g=h(["axis","x","label"],{}),_g=h(["axis","y","show"],!0),ah=h(["axis","y","max"]),bh=h(["axis","y","min"]),ch=h(["axis","y","center"]),dh=h(["axis","y","label"],{}),eh=h(["axis","y","inner"],!1),fh=h(["axis","y","tick","format"]),gh=h(["axis","y","padding"],{}),hh=h(["axis","y","ticks"],10),ih=h(["axis","y2","show"],!1),jh=h(["axis","y2","max"]),kh=h(["axis","y2","min"]),lh=h(["axis","y2","center"]),mh=h(["axis","y2","label"],{}),nh=h(["axis","y2","inner"],!1),oh=h(["axis","y2","tick","format"]),ph=h(["axis","y2","padding"],{}),qh=h(["axis","y2","ticks"],10),rh=h(["grid","x","show"],!1),sh=h(["grid","x","type"],"tick"),th=h(["grid","x","lines"],[]),uh=h(["grid","y","show"],!1),vh=h(["grid","y","lines"],[]),wh=h(["grid","y","ticks"],10),xh=h(["point","show"],!0),yh=xh?h(["point","r"],2.5):0,zh=h(["point","focus","line","enabled"],!0),Ah=h(["point","focus","expand","enabled"],!0),Bh=h(["point","focus","expand","r"],Ah?4:yh),Ch=h(["point","focus","select","r"],8),Dh=h(["line","connect_null"],!1),Eh=h(["bar","width"]),Fh=h(["bar","width","ratio"],.6),Gh=h(["pie","label","show"],!0),Hh=h(["pie","label","format"]),Ih=h(["pie","onclick"],function(){}),Jh=h(["pie","onmouseover"],function(){}),Kh=h(["pie","onmouseout"],function(){}),Lh=h(["donut","label","show"],!0),Mh=h(["donut","label","format"]),Nh=h(["donut","title"],""),Oh=h(["donut","onclick"],function(){}),Ph=h(["donut","onmouseover"],function(){}),Qh=h(["donut","onmouseout"],function(){}),Rh=h(["regions"],[]),Sh=h(["tooltip","show"],!0),Th=h(["tooltip","format","title"]),Uh=h(["tooltip","format","value"]),Vh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Th?Th:b,l=Uh?Uh:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Wh=h(["tooltip","init","show"],!1),Xh=h(["tooltip","init","x"],0),Yh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Zh=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",$h=Zh+"-xaxis",_h=Zh+"-yaxis",ai=i(Zh),bi=i($h),ci=i(_h),di="timeseries"===Og,ei="categorized"===Og,fi=!di&&(gg||ne(hg)),gi=null,hi=!1,ii=!1,ji=!1,ki=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],li=he(ug,ne(Ig)?Ig:ki,tg),mi=Pg?mf.time.format:mf.time.format.utc,ni=function(){var a=[[mi("%Y/%-m/%-d"),function(){return!0}],[mi("%-m/%-d"),function(a){return a.getMonth()}],[mi("%-m/%-d"),function(a){return 1!==a.getDate()}],[mi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[mi("%I %p"),function(a){return a.getHours()}],[mi("%I:%M"),function(a){return a.getMinutes()}],[mi(":%S"),function(a){return a.getSeconds()}],[mi(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),oi=[],pi=[],qi=Ng?"left":"bottom",ri=Ng?eh?"top":"bottom":eh?"right":"left",si=Ng?nh?"bottom":"top":nh?"left":"right",ti=Ng?"left":"bottom",ui={main:function(){return"translate("+Af.left+","+Af.top+")"},context:function(){return"translate("+Bf.left+","+Bf.top+")"},legend:function(){return"translate("+Cf.left+","+Cf.top+")"},x:function(){return"translate(0,"+(Ng?0:Ff)+")"},y:function(){return"translate(0,"+(Ng?Ff:0)+")"},y2:function(){return"translate("+(Ng?0:Df)+","+(Ng?1:0)+")"},subx:function(){return"translate(0,"+(Ng?0:Gf)+")"},arc:function(){return"translate("+Df/2+","+Ff/2+")"}},vi="right"===Kg,wi=0,xi=0,yi=0,zi=30,Ai=30,Bi=5;Pf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Ci,Di=function(){var a=mf.svg.line().x(Ng?function(a){return V(a.id)(a.value)}:ud).y(Ng?ud:function(a){return V(a.id)(a.value)});return Dh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Dh?xe(b.values):b.values;return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),sg[b.id]?Je(e,Yf,V(b.id),sg[b.id]):a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Ei=function(){var a;return a=Ng?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?Yf(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Fi=function(){var a=mf.svg.line().x(Ng?function(a){return W(a.id)(a.value)}:xd).y(Ng?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+_f(c[0].x)+" "+W(b.id)(c[0].value)}}(),Gi=function(){};Ci=mf.svg.brush().on("brush",Se),Ci.update=function(){return Ki&&Ki.select("."+f.brush).call(this),this},Ci.scale=function(a){return Ng?this.y(a):this.x(a)},uf&&(Gi=mf.behavior.zoom().on("zoomstart",function(){Gi.altDomain=mf.event.sourceEvent.altKey?Yf.orgDomain():null}).on("zoom",uf?Te:null),Gi.scale=function(a){return Ng?this.y(a):this.x(a)},Gi.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Gi.updateScaleExtent=function(){var a=$b(Yf.orgDomain())/$b(Oi),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Hi,Ii,Ji,Ki,Li,Mi,Ni,Oi,Pi,Qi={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Hi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Hi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Hi.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Hi.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Li.selectAll(kd(a)).classed(f.legendItemHidden,!1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Hi.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Li.selectAll(kd(a)).classed(f.legendItemHidden,!0),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){Ci.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){lg[b]=a.classes[b]}),"categories"in a&&ei&&(Qg=a.categories,cg.categories(Qg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Ji.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){vg&&Ji.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=wg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?xg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){vg&&Ji.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=wg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&xg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?mg:(mg=a,Re(),mg)},nf.xgrids=function(a){return a?(th=a,Re(),th):th},nf.xgrids.add=function(a){return a?nf.xgrids(th.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(th.filter(b))},nf.ygrids=function(a){return a?(vh=a,Re(),vh):vh},nf.ygrids.add=function(a){return a?nf.ygrids(vh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(vh.filter(b))},nf.regions=function(a){return c(a)?Rh:(Rh=a,Re(),Rh)},nf.regions.add=function(a){return c(a)?Rh:(Rh=Rh.concat(a),Re(),Rh)},nf.regions.remove=function(a,c){var e=[].concat(a);return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;Hi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Rh=Rh.filter(function(b){return b.classes.indexOf(a)<0})}),Rh},nf.data.get=function(a){var b=nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},nf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a -});return b.length>0?b[0]:void 0},nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){kg[b]=a[b]}),gf(xc(nf.data.targets),{withTransition:!0}),kg):kg},nf.x=function(a){return arguments.length&&(mc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.xs=function(a){return arguments.length&&(nc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(ah=+a.y),b(a.y2)&&(jh=+a.y2)):ah=jh=+a,Re())},nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(bh=+a.y),b(a.y2)&&(kh=+a.y2)):bh=kh=+a,Re())},nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&nf.axis.max(a.max),"undefined"!=typeof a.min&&nf.axis.min(a.min))},nf.legend.show=function(a){Jg||(Jg=!0,Li.style("visibility","visible")),ef(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.legend.hide=function(a){Jg&&me(a)&&(Jg=!1,Li.style("visibility","hidden")),ff(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.resize=function(a){qf=a?a.width:null,rf=a?a.height:null,We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},nf.destroy=function(){nf.data.targets=void 0,nf.data.xs={},Ni.html(""),a.onresize=null},"url"in e.data)mf.xhr(e.data.url,function(a,b){var c,d=mf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=mf.csv.parse(b.response),Ke(c)});else if("rows"in e.data)Ke(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ke(qc(e.data.columns))}return nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file +!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.29"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cFf&&(Ff=0),0>Hf&&(Hf=0),Df={top:Pg?Cf.top:Kf-Jg-(xi?0:a),right:0/0,bottom:20+(xi?0:a),left:Pg?Bi:Cf.left},Gf=Pg?Cf.left-Bi-Ci:Ff,If=Pg?Hf:Kf-Df.top-Df.bottom,0>Gf&&(Gf=0),0>If&&(If=0),Ef={top:xi?0:Kf-a,right:0/0,bottom:0,left:xi?Jf-b:0},p(),xi&&Yd(nf.data.targets)&&(Ef.left=Ff/2+Mf)}function o(){Li.select("line."+f.xgridFocus).attr("x1",Pg?0:-10).attr("x2",Pg?Ff:-10).attr("y1",Pg?-10:Cf.top).attr("y2",Pg?-10:Hf)}function p(){Mf=Hf/2,Lf=.95*Mf,Nf=Xd(nf.data.targets)?.6*Lf:0}function q(){var a=Pg?f.axisX:f.axisY,b=mf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=mf.select(pf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return qf?qf:x()}function s(){var a=rf?rf:y();return a>0?a:320}function t(){return Yd(nf.data.targets)?0:sf?sf:Pg||!bh||gh?1:v("y")}function u(){var a=1;return Yd(nf.data.targets)?0:tf?tf:xi?P()+(kh&&!Pg?v("y2"):a):kh?ph||Pg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||bh?"y2"!==a||kh?(gb(a).isInner?30:40)+("y2"===a?-10:0):Di:Lg&&!xi?10:1}function x(){return+mf.select(pf).style("width").replace("px","")}function y(){return+mf.select(pf).style("height").replace("px","")}function z(a){return a?-5:-(Cf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Pg)}function C(){return A(!Pg)}function D(){return z(Pg)}function E(){return A(Pg)}function F(a){return a?Ff+2+4:Cf.left+20}function G(a){return a?80:Hf+2}function H(){return F(!Pg)}function I(){return G(!Pg)}function J(){return F(Pg)}function K(){return G(Pg)}function L(){var a=Pg?Hf:Ff,b=vc(),c=Vb()*(Ud(nf.data.targets)?(b-(gi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){yi=a}function N(a){zi=a}function O(a){Ai=a}function P(){return Lg?xi?zi*(yi+1):Jf:0}function Q(){return Lg?xi?Kf:Ai*(yi+1):0}function R(){var a,b=!$f;Sf=Pg?1:0,Tf=Pg?Hf:Ff,Uf=Pg?0:Hf,Vf=Pg?Ff:1,Wf=Sf,Xf=Tf,Yf=Pg?0:If,Zf=Pg?Gf:1,$f=T(Sf,Tf,b?void 0:$f.domain(),function(){return eg.tickOffset()}),_f=U(Uf,Vf),ag=U(Uf,Vf),bg=T(Sf,Tf,Qi,function(a){return a%1?0:hg.tickOffset()}),cg=U(Yf,Zf),dg=U(Yf,Zf),a=$(),eg=X($f,si,a),hg=X(bg,vi,a),fg=Y(_f,ti,hh,jh),gg=Y(ag,ui,qh,sh),b||(Ei.scale(bg),uf&&Ii.scale($f)),S()}function S(){Of=Db(),Pf=Eb(),Qf=Eb(.98)}function T(a,b,e,f){var g=(fi?mf.time.scale():mf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),gi){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return mf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?ag:_f}function W(a){return"y2"===Z(a)?dg:cg}function X(a,b,c){var d=(gi?Bb():mf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),gi?d.tickCentered(Tg):d.tickOffset=function(){var a=Pg?Hf:Ff;return a*Vb()/vc()/2},gi&&d.categories(Sg),d}function Y(a,b,c,d){return mf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in pg?pg[a]:"y"}function $(){var a=fi?pi:gi?Oc:function(a){return 0>a?a.toFixed(0):a};return Ug&&("function"==typeof Ug?a=Ug:fi&&(a=function(a){return oi(Ug)(a)})),a}function _(a){var b;return"y"===a?b=fh:"y2"===a?b=oh:"x"===a&&(b=ah),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?fh=b:"y2"===a?oh=b:"x"===a&&(ah=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Pg?"inner-top":"inner-right")}function eb(){return cb("y",Pg?"inner-right":"inner-top")}function fb(){return cb("y2",Pg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?Ff/2:Ff:b.isBottom?-Hf:b.isMiddle?-Hf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Pg,db())}function ob(){return kb(Pg,eb())}function pb(){return kb(Pg,fb())}function qb(){return lb(!Pg,db())}function rb(){return lb(Pg,eb())}function sb(){return lb(Pg,fb())}function tb(){var a=db();return Pg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Pg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Pg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Pg,db())}function xb(){return mb(Pg,eb())}function yb(){return mb(Pg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Li.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Li.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Li.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return mf.min(Object.keys(i).map(function(a){return mf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(og.length>0)for(g=Nc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return mf.max(Object.keys(i).map(function(a){return mf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?mh:dh,n="y2"===c?lh:ch,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?nh:eh,r=pd()&&Pg;return 0===l.length?"y2"===c?ag.domain():_f.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=qd(o,p),j=$b(_f.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&ih&&(f=b(ih.top)?ih.top:e,g=b(ih.bottom)?ih.bottom:e),"y2"===c&&rh&&(f=b(rh.top)?rh.top:e,g=b(rh.bottom)?rh.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Qi),c=$b($f.domain());return a||0===c?1:b/c}function Wb(a){return $g?$g:mf.min(a,function(a){return mf.min(a.values,function(a){return a.x})})}function Xb(a){return Zg?Zg:mf.max(a,function(a){return mf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return gi?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=0,g=0;return(c||0===c)&&(f=fi?new Date(c.getTime()-e):c-e),(d||0===d)&&(g=fi?new Date(d.getTime()+e):d+e),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return ig&&a===ig||ne(jg)&&oe(jg,a)}function fc(a){return!ec(a)}function gc(a){return ig?ig:ne(jg)?jg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=nf.data.xs[b])}),c}function ic(a,b){return a in nf.data.xs&&nf.data.xs[a]&&nf.data.xs[a][b]?nf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){jg[b]=a[b]})}function kc(a){return 1===mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=mg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),nf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=fi?a?a instanceof Date?a:ie(a):ie(ic(b,c)):hi&&!gi?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):ig?(d=Object.keys(nf.data.xs),nf.data.xs[c]=d.length>0?nf.data.xs[d[0]]:void 0):ne(jg)&&(nf.data.xs[c]=hc(f,nf.data.targets)):nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=lg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return hi&&gi&&0===c&&g&&(0===e&&(Sg=[]),Sg.push(g)),("undefined"==typeof a[b]||nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),qg&&Sd(xc(c).filter(function(a){return!(a in rg)}),qg),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function tc(a){return a>0&&nf.data.targets[0].values[a-1]?nf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?nf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?nf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(nf.data.targets)}function zc(a,b){var c,d=xc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(fi?new Date(h):h);i.push(d)}return fi||(i=i.sort()),i}function Gc(a){qi=qi.concat(a)}function Hc(a){qi=qi.filter(function(b){return a.indexOf(b)<0})}function Ic(a){ri=ri.concat(a)}function Jc(a){ri=ri.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Ed(){return tg&&"desc"===tg.toLowerCase()}function Fd(){return tg&&"asc"===tg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof tg&&a.sort(tg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(nf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Uh&&0!==m.length&&(Oi.html(Xh(a,$(),l,ni)).style("display","block"),d=Oi.property("offsetWidth"),e=Oi.property("offsetHeight"),k?(g=Ff/2+c[0],i=Hf/2+c[1]+20):(Pg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=$f(m[0].x)+20):(f=q(),g=f+t()+$f(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Oi.style("top",i+"px").style("left",g+"px"))}function Id(){Oi.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Uh&&(Vd(nf.data.targets)||Yd(nf.data.targets)||Li.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Pg?"y1":"x1",ud).attr(Pg?"y2":"x2",ud))}function Kd(){Li.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?$f(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Gh?Gh:b?2*a.tickOffset()*Hh/b:0}function Sd(a,b){yc(a).forEach(function(a){Si[a]=b===rg[a],rg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){rg[a.id]===b&&(c=!0),a.id in rg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in rg)||"line"===rg[b]||"spline"===rg[b]||"area"===rg[b]||"area-spline"===rg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===rg[b]||"area-spline"===rg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===rg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===rg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===rg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===rg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ie(b){var c;try{c=kg?mf.time.format(kg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+kg)}return c}function je(a,b){var c=mf.mouse(a),d=mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?_f:ag,d=Pg?1:0,e=Pg?0:1;return Math.pow($f(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Eg(b,a.node()),Li.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Pg?Md:Ld).attr("cy",Pg?Ld:Md).attr("stroke",function(){return ni(b)}).attr("r",1.4*Eh).transition().duration(100).attr("r",Eh)}function se(a,b,c){Fg(b,a.node()),Li.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Eg(b,a.node()),a.transition().duration(100).style("fill",function(){return mf.rgb(ni(b)).darker(1)})}function ve(a,b){Fg(b,a.node()),a.transition().duration(100).style("fill",function(){return ni(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Li.selectAll("."+f.circles+gd(c)):Li).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",Dh)}function Ae(a){ye(a).filter(function(){return mf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Ah)}function Be(a){return Li.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Pg?1:0,f=Pg?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Pg?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBoundingClientRect();return Pg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(eg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Pg&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Je(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function Ke(b){var c,d,e;if(Pi=mf.select(pf),Pi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Pi.html(""),Pi.classed("c3",!0),nf.data.xs={},nf.data.targets=rc(b),n(),R(),$f.domain(mf.extent(Zb(nf.data.targets))),_f.domain(Ub(nf.data.targets,"y")),ag.domain(Ub(nf.data.targets,"y2")),bg.domain($f.domain()),cg.domain(_f.domain()),dg.domain(ag.domain()),Qi=$f.domain(),Ei.scale(bg),uf&&Ii.scale($f),Ji=Pi.append("svg").attr("width",Ff+Cf.left+Cf.right).attr("height",Hf+Cf.top+Cf.bottom).on("mouseenter",xf).on("mouseleave",yf),Ki=Ji.append("defs"),Ki.append("clipPath").attr("id",_h).append("rect").attr("width",Ff).attr("height",Hf),Ki.append("clipPath").attr("id",ai).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Ki.append("clipPath").attr("id",bi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Li=Ji.append("g").attr("transform",wi.main),Mi=Ig?Ji.append("g").attr("transform",wi.context):null,Ni=Ji.append("g").attr("transform",wi.legend),Lg||(Ni.style("visibility","hidden"),ri=xc(nf.data.targets)),Oi=mf.select(pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),gf(xc(nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Li.append("g").attr("class",f.axisX).attr("clip-path",Pg?"":di).attr("transform",wi.x).append("text").attr("class",f.axisXLabel).attr("transform",Pg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),bh&&Li.append("g").attr("class",f.axisY).attr("clip-path",Pg?ei:"").attr("transform",wi.y).append("text").attr("class",f.axisYLabel).attr("transform",Pg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),kh&&Li.append("g").attr("class",f.axisY2).attr("transform",wi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Pg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Li.append("g").attr("clip-path",ci).attr("class",f.grid),th&&d.append("g").attr("class",f.xgrids),ne(vh)&&d.append("g").attr("class",f.xgridLines),Bh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),wh&&d.append("g").attr("class",f.ygrids),ne(xh)&&d.append("g").attr("class",f.ygridLines),Li.append("g").attr("clip-path",ci).attr("class",f.regions),Li.append("g").attr("clip-path",ci).attr("class",f.chart),c=Li.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",uf?Pg?"ns-resize":"ew-resize":null),Li.select("."+f.chart).append("g").attr("class",f.chartBars),Li.select("."+f.chart).append("g").attr("class",f.chartLines),Li.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",wi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Li.select("."+f.chart).append("g").attr("class",f.chartTexts),uf&&Li.insert("rect",wf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Ff).attr("height",Hf).style("opacity",0).style("cursor",Pg?"ns-resize":"ew-resize").call(Ii).on("dblclick.zoom",null),_g&&Ei.extent("function"!=typeof _g?_g:_g(Zb())),Ig&&(Mi.append("g").attr("clip-path",ci).attr("class",f.chart),Mi.select("."+f.chart).append("g").attr("class",f.chartBars),Mi.select("."+f.chart).append("g").attr("class",f.chartLines),Mi.append("g").attr("clip-path",ci).attr("class",f.brush).call(Ei).selectAll("rect").attr(Pg?"width":"height",Pg?Gf:If),Mi.append("g").attr("class",f.axisX).attr("transform",wi.subx).attr("clip-path",Pg?"":di)),Xe(nf.data.targets),Pg?Li.select("."+f.axisX).style("opacity",0).call(eg):(Li.select("."+f.axisY).style("opacity",0).call(fg),Li.select("."+f.axisY2).style("opacity",0).call(gg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Yh){if(fi&&"string"==typeof Zh){for(Zh=ie(Zh),e=0;e0){d=[];for(var g in mg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function Pe(a){Yd(nf.data.targets)||xg&&(ii=a,Li.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),ji=!0,Gg())}function Qe(){Yd(nf.data.targets)||xg&&(Li.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Li.selectAll("."+f.shape).classed(f.INCLUDED,!1),ji=!1,Hg())}function Re(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Nd(),U=Yd(nf.data.targets),V=Dc(nf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?Bf:0,O=B?N:0,P=C?N:0,H&&Lg&&gf(xc(nf.data.targets),a),G&&($f.domain(mf.extent(Zb(V))),Qi=$f.domain(),uf&&Ii.scale($f).updateScaleExtent(),bg.domain($f.domain()),Ei.scale(bg)),F&&($f.domain(Ei.empty()?Qi:Ei.extent()),uf&&Ii.scale($f).updateScaleExtent()),_f.domain(Ub(V,"y")),ag.domain(Ub(V,"y2")),Vd(V)||(Q=Fc(Ec(V)),eg.tickValues(Q),hg.tickValues(Q)),c=Li.select("."+f.axisX).style("opacity",U?0:1),(Pg||D)&&(c=c.transition().duration(P)),c.call(eg),e=Li.select("."+f.axisY).style("opacity",U?0:1),(!Pg||D)&&(e=e.transition().duration(P)),e.call(fg),Li.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(gg),F&&Vg&&Q){for(R=1;R0&&mf.select(this).style("display",b%S?"none":"block")})}if(I=Ee(T),K=Fe(T,!0),M=Fe(T,!1),Ab(),cg.domain(_f.domain()),dg.domain(ag.domain()),Oi.style("display","none"),o(),Li.select("line."+f.xgridFocus).style("visibility","hidden"),th){if("year"===uh){h=[];for(var W=Zb(),X=W[0].getFullYear(),Y=W[1].getFullYear(),Z=X;Y>=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=$f.ticks(10);g=Li.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Pg?0:function(a){return $f(a)-eg.tickOffset()}).attr("x2",Pg?Ff:function(a){return $f(a)-eg.tickOffset()}).attr("y1",Pg?function(a){return $f(a)-eg.tickOffset()}:Cf.top).attr("y2",Pg?function(a){return $f(a)-eg.tickOffset()}:Hf).style("opacity",function(){return+mf.select(this).attr(Pg?"y1":"x1")===(Pg?Hf:0)?0:1}),g.exit().remove()}ne(vh)&&(i=Li.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(vh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Pg?"":"rotate(-90)").attr("dx",Pg?0:-Cf.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Pg?0:vd).attr("x2",Pg?Ff:vd).attr("y1",Pg?vd:Cf.top).attr("y2",Pg?vd:Hf).style("opacity",1),i.select("text").transition().duration(N).attr("x",Pg?Ff:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&wh&&(k=Li.select("."+f.ygrids).selectAll("."+f.ygrid).data(_f.ticks(yh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Pg?_f:0).attr("x2",Pg?_f:Ff).attr("y1",Pg?0:_f).attr("y2",Pg?Hf:_f),k.exit().remove()),y&&ne(xh)&&(l=Li.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(xh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Pg?"rotate(-90)":"").attr("dx",Pg?0:-Cf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Pg?wd:0).attr("x2",Pg?wd:Ff).attr("y1",Pg?0:wd).attr("y2",Pg?Hf:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Pg?0:Ff).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Li.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ni(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Li.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Pg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Li.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Fi).style("opacity",1),Li.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Gi).style("opacity",Ri),n=Li.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",Ah),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Pg?Md:Ld).attr("cy",Pg?Ld:Md),n.exit().remove(),Li.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=mf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Li.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Li.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Ig&&(null!==mf.event&&"zoom"===mf.event.type&&Ei.extent($f.orgDomain()).update(),z&&(Mi.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(hg),Ei.empty()||Ei.extent($f.orgDomain()).update(),J=Ee(T,!0),s=Mi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ni(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Mi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Hi).style("opacity",1))),Li.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Li.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Pg?Md:Ld).attr("cy",Pg?Ld:Md),t=Li.select("."+f.eventRects),ne(jg)&&!kc(jg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Li.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Ff).attr("height",Hf)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),hi&&!gi?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return($f(d?d:e+50)-$f(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return($f(d)+$f(c?c:d-50))/2}):(x=L(),w=function(a){return $f(a.x)-x/2}),v=wc(),Li.select("."+f.eventRects).datum(v?v.values:[]),u=Li.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Pg?0:w).attr("y",Pg?w:0).attr("width",Pg?Ff:x).attr("height",Pg?x:Hf),u.exit().remove()),q=Li.select("."+f.regions).selectAll("rect."+f.region).data(Th),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Pg?0:cc).attr("y",Pg?cc:Cf.top).attr("width",Pg?Ff:dc).attr("height",Pg?dc:Hf).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),xc(nf.data.targets).forEach(function(a){Si[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Ii.altDomain?($f.domain(Ii.altDomain),void Ii.scale($f).updateScaleExtent()):(gi&&$f.orgDomain()[0]===Qi[0]&&$f.domain([Qi[0]-1e-10,$f.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(ki=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Ji.attr("width",Jf).attr("height",Kf),Ji.select("#"+_h).select("rect").attr("width",Ff).attr("height",Hf),Ji.select("#"+ai).select("rect").attr("width",H),Ji.select("#"+bi).select("rect").attr("width",J),Ji.select("."+f.zoomRect).attr("width",Ff).attr("height",Hf)}function We(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Li.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ni(a)}),e=Li.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ni(a)}).style("stroke","none").style("cursor",function(a){return zg(a)?"pointer":null}),c=Li.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ni(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Ri=+mf.select(this).style("opacity"),0}).style("fill",function(a){return ni(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ni(a)}).style("cursor",function(a){return zg(a)?"pointer":null}),a.forEach(function(a){Li.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Li.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Rf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ni(a.data)}).style("cursor",function(a){return zg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Ig&&(n=Mi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ni(a)}),l=Mi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ni(a)})),Ji.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=xi?j:i,l=xi?Q():P();return d&&(w=0,C=0,t=0,u=0),Lg&&!Cc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=xi?u:t,void(Og?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,xi?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Ni.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Ng?Ng(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(mg[a])?mg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",xi?g:-200).attr("y",xi?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",xi?h:-200).attr("y",xi?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return ni(a)}).attr("x",xi?g:-200).attr("y",xi?-200:i).attr("width",10).attr("height",10),Ni.selectAll("text").data(a).text(function(a){return d(mg[a])?mg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ni.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ni.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["onresize"],function(){}),Af=h(["onresized"],function(){}),Bf=h(["transition","duration"],350);g("data","data is required in config");var Cf,Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig=h(["data","x"]),jg=h(["data","xs"],{}),kg=h(["data","x_format"]),lg=h(["data","id_converter"],function(a){return a}),mg=h(["data","names"],{}),ng=h(["data","classes"],{}),og=h(["data","groups"],[]),pg=h(["data","axes"],{}),qg=h(["data","type"]),rg=h(["data","types"],{}),sg=h(["data","labels"],{}),tg=h(["data","order"]),ug=h(["data","regions"],{}),vg=h(["data","color"]),wg=h(["data","colors"],{}),xg=h(["data","selection","enabled"],!1),yg=h(["data","selection","grouped"],!1),zg=h(["data","selection","isselectable"],function(){return!0}),Ag=h(["data","selection","multiple"],!0),Bg=h(["data","onclick"],function(){}),Cg=h(["data","onenter"],function(){}),Dg=h(["data","onleave"],function(){}),Eg=h(["data","onselected"],function(){}),Fg=h(["data","onunselected"],function(){}),Gg=h(["data","ondragstart"],function(){}),Hg=h(["data","ondragend"],function(){}),Ig=h(["subchart","show"],!1),Jg=Ig?h(["subchart","size","height"],60):0,Kg=h(["color","pattern"],[]),Lg=h(["legend","show"],!0),Mg=h(["legend","position"],"bottom"),Ng=h(["legend","item","onclick"]),Og=h(["legend","equally"],!1),Pg=h(["axis","rotated"],!1),Qg=h(["axis","x","type"],"indexed"),Rg=h(["axis","x","localtime"],!1),Sg=h(["axis","x","categories"],[]),Tg=h(["axis","x","tick","centered"],!1),Ug=h(["axis","x","tick","format"]),Vg=h(["axis","x","tick","culling"],{}),Wg=h(["axis","x","tick","culling","max"],"categorized"===Qg?1/0:10),Xg=h(["axis","x","tick","count"]),Yg=h(["axis","x","tick","fit"],!1),Zg=h(["axis","x","max"]),$g=h(["axis","x","min"]),_g=h(["axis","x","default"]),ah=h(["axis","x","label"],{}),bh=h(["axis","y","show"],!0),ch=h(["axis","y","max"]),dh=h(["axis","y","min"]),eh=h(["axis","y","center"]),fh=h(["axis","y","label"],{}),gh=h(["axis","y","inner"],!1),hh=h(["axis","y","tick","format"]),ih=h(["axis","y","padding"],{}),jh=h(["axis","y","ticks"],10),kh=h(["axis","y2","show"],!1),lh=h(["axis","y2","max"]),mh=h(["axis","y2","min"]),nh=h(["axis","y2","center"]),oh=h(["axis","y2","label"],{}),ph=h(["axis","y2","inner"],!1),qh=h(["axis","y2","tick","format"]),rh=h(["axis","y2","padding"],{}),sh=h(["axis","y2","ticks"],10),th=h(["grid","x","show"],!1),uh=h(["grid","x","type"],"tick"),vh=h(["grid","x","lines"],[]),wh=h(["grid","y","show"],!1),xh=h(["grid","y","lines"],[]),yh=h(["grid","y","ticks"],10),zh=h(["point","show"],!0),Ah=zh?h(["point","r"],2.5):0,Bh=h(["point","focus","line","enabled"],!0),Ch=h(["point","focus","expand","enabled"],!0),Dh=h(["point","focus","expand","r"],Ch?4:Ah),Eh=h(["point","focus","select","r"],8),Fh=h(["line","connect_null"],!1),Gh=h(["bar","width"]),Hh=h(["bar","width","ratio"],.6),Ih=h(["pie","label","show"],!0),Jh=h(["pie","label","format"]),Kh=h(["pie","onclick"],function(){}),Lh=h(["pie","onmouseover"],function(){}),Mh=h(["pie","onmouseout"],function(){}),Nh=h(["donut","label","show"],!0),Oh=h(["donut","label","format"]),Ph=h(["donut","title"],""),Qh=h(["donut","onclick"],function(){}),Rh=h(["donut","onmouseover"],function(){}),Sh=h(["donut","onmouseout"],function(){}),Th=h(["regions"],[]),Uh=h(["tooltip","show"],!0),Vh=h(["tooltip","format","title"]),Wh=h(["tooltip","format","value"]),Xh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Vh?Vh:b,l=Wh?Wh:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Yh=h(["tooltip","init","show"],!1),Zh=h(["tooltip","init","x"],0),$h=h(["tooltip","init","position"],{top:"0px",left:"50px"}),_h=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",ai=_h+"-xaxis",bi=_h+"-yaxis",ci=i(_h),di=i(ai),ei=i(bi),fi="timeseries"===Qg,gi="categorized"===Qg,hi=!fi&&(ig||ne(jg)),ii=null,ji=!1,ki=!1,li=!1,mi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ni=he(wg,ne(Kg)?Kg:mi,vg),oi=Rg?mf.time.format:mf.time.format.utc,pi=function(){var a=[[oi("%Y/%-m/%-d"),function(){return!0}],[oi("%-m/%-d"),function(a){return a.getMonth()}],[oi("%-m/%-d"),function(a){return 1!==a.getDate()}],[oi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[oi("%I %p"),function(a){return a.getHours()}],[oi("%I:%M"),function(a){return a.getMinutes()}],[oi(":%S"),function(a){return a.getSeconds()}],[oi(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),qi=[],ri=[],si=Pg?"left":"bottom",ti=Pg?gh?"top":"bottom":gh?"right":"left",ui=Pg?ph?"bottom":"top":ph?"left":"right",vi=Pg?"left":"bottom",wi={main:function(){return"translate("+Cf.left+","+Cf.top+")"},context:function(){return"translate("+Df.left+","+Df.top+")"},legend:function(){return"translate("+Ef.left+","+Ef.top+")"},x:function(){return"translate(0,"+(Pg?0:Hf)+")"},y:function(){return"translate(0,"+(Pg?Hf:0)+")"},y2:function(){return"translate("+(Pg?0:Ff)+","+(Pg?1:0)+")"},subx:function(){return"translate(0,"+(Pg?0:If)+")"},arc:function(){return"translate("+Ff/2+","+Hf/2+")"}},xi="right"===Mg,yi=0,zi=0,Ai=0,Bi=30,Ci=30,Di=5;Rf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Ei,Fi=function(){var a=mf.svg.line().x(Pg?function(a){return V(a.id)(a.value)}:ud).y(Pg?ud:function(a){return V(a.id)(a.value)});return Fh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Fh?xe(b.values):b.values;return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),ug[b.id]?Je(e,$f,V(b.id),ug[b.id]):a(e)):(c=e[0]?$f(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Pg?"M "+d+" "+c:"M "+c+" "+d)}}(),Gi=function(){var a;return a=Pg?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?$f(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Pg?"M "+d+" "+c:"M "+c+" "+d)}}(),Hi=function(){var a=mf.svg.line().x(Pg?function(a){return W(a.id)(a.value)}:xd).y(Pg?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+bg(c[0].x)+" "+W(b.id)(c[0].value)}}(),Ii=function(){};Ei=mf.svg.brush().on("brush",Se),Ei.update=function(){return Mi&&Mi.select("."+f.brush).call(this),this},Ei.scale=function(a){return Pg?this.y(a):this.x(a)},uf&&(Ii=mf.behavior.zoom().on("zoomstart",function(){Ii.altDomain=mf.event.sourceEvent.altKey?$f.orgDomain():null}).on("zoom",uf?Te:null),Ii.scale=function(a){return Pg?this.y(a):this.x(a)},Ii.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Ii.updateScaleExtent=function(){var a=$b($f.orgDomain())/$b(Qi),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Ji,Ki,Li,Mi,Ni,Oi,Pi,Qi,Ri,Si={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ji.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Ji.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ji.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Ji.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Ni.selectAll(kd(a)).classed(f.legendItemHidden,!1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Ji.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Ni.selectAll(kd(a)).classed(f.legendItemHidden,!0),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){Ei.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){ng[b]=a.classes[b]}),"categories"in a&&gi&&(Sg=a.categories,eg.categories(Sg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Li.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){xg&&Li.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=yg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?zg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){xg&&Li.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=yg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&zg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?og:(og=a,Re(),og)},nf.xgrids=function(a){return a?(vh=a,Re(),vh):vh},nf.xgrids.add=function(a){return a?nf.xgrids(vh.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(vh.filter(b))},nf.ygrids=function(a){return a?(xh=a,Re(),xh):xh},nf.ygrids.add=function(a){return a?nf.ygrids(xh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(xh.filter(b))},nf.regions=function(a){return c(a)?Th:(Th=a,Re(),Th)},nf.regions.add=function(a){return c(a)?Th:(Th=Th.concat(a),Re(),Th)},nf.regions.remove=function(a,c){var e=[].concat(a);return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;Ji.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Th=Th.filter(function(b){return b.classes.indexOf(a)<0})}),Th},nf.data.get=function(a){var b=nf.data.getAsTarget(a); +return d(b)?b.values.map(function(a){return a.value}):void 0},nf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){mg[b]=a[b]}),gf(xc(nf.data.targets),{withTransition:!0}),mg):mg},nf.x=function(a){return arguments.length&&(mc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.xs=function(a){return arguments.length&&(nc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(ch=+a.y),b(a.y2)&&(lh=+a.y2)):ch=lh=+a,Re())},nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(dh=+a.y),b(a.y2)&&(mh=+a.y2)):dh=mh=+a,Re())},nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&nf.axis.max(a.max),"undefined"!=typeof a.min&&nf.axis.min(a.min))},nf.legend.show=function(a){Lg||(Lg=!0,Ni.style("visibility","visible")),ef(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.legend.hide=function(a){Lg&&me(a)&&(Lg=!1,Ni.style("visibility","hidden")),ff(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.resize=function(a){qf=a?a.width:null,rf=a?a.height:null,We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},nf.destroy=function(){nf.data.targets=void 0,nf.data.xs={},Pi.html(""),a.onresize=null},"url"in e.data)mf.xhr(e.data.url,function(a,b){var c,d=mf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=mf.csv.parse(b.response),Ke(c)});else if("rows"in e.data)Ke(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ke(qc(e.data.columns))}return nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 11c0fe61af115defb69bad05af3175fe1013f4d6 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Sat, 12 Apr 2014 21:39:26 +0900 Subject: [PATCH 038/178] Update version to 0.1.30 --- bower.json | 2 +- c3.js | 2 +- c3.min.js | 2 +- package.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bower.json b/bower.json index d305465..87e14e3 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "c3", "main": "c3.min.js", - "version": "0.1.29", + "version": "0.1.30", "homepage": "https://github.com/masayuki0812/c3", "authors": [ "Masayuki Tanaka " diff --git a/c3.js b/c3.js index 3db8115..c09c37d 100644 --- a/c3.js +++ b/c3.js @@ -2,7 +2,7 @@ 'use strict'; var c3 = { - version: "0.1.29" + version: "0.1.30" }; var CLASS = { diff --git a/c3.min.js b/c3.min.js index 2cd2e2a..1af5ea8 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.29"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cFf&&(Ff=0),0>Hf&&(Hf=0),Df={top:Pg?Cf.top:Kf-Jg-(xi?0:a),right:0/0,bottom:20+(xi?0:a),left:Pg?Bi:Cf.left},Gf=Pg?Cf.left-Bi-Ci:Ff,If=Pg?Hf:Kf-Df.top-Df.bottom,0>Gf&&(Gf=0),0>If&&(If=0),Ef={top:xi?0:Kf-a,right:0/0,bottom:0,left:xi?Jf-b:0},p(),xi&&Yd(nf.data.targets)&&(Ef.left=Ff/2+Mf)}function o(){Li.select("line."+f.xgridFocus).attr("x1",Pg?0:-10).attr("x2",Pg?Ff:-10).attr("y1",Pg?-10:Cf.top).attr("y2",Pg?-10:Hf)}function p(){Mf=Hf/2,Lf=.95*Mf,Nf=Xd(nf.data.targets)?.6*Lf:0}function q(){var a=Pg?f.axisX:f.axisY,b=mf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=mf.select(pf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return qf?qf:x()}function s(){var a=rf?rf:y();return a>0?a:320}function t(){return Yd(nf.data.targets)?0:sf?sf:Pg||!bh||gh?1:v("y")}function u(){var a=1;return Yd(nf.data.targets)?0:tf?tf:xi?P()+(kh&&!Pg?v("y2"):a):kh?ph||Pg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||bh?"y2"!==a||kh?(gb(a).isInner?30:40)+("y2"===a?-10:0):Di:Lg&&!xi?10:1}function x(){return+mf.select(pf).style("width").replace("px","")}function y(){return+mf.select(pf).style("height").replace("px","")}function z(a){return a?-5:-(Cf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Pg)}function C(){return A(!Pg)}function D(){return z(Pg)}function E(){return A(Pg)}function F(a){return a?Ff+2+4:Cf.left+20}function G(a){return a?80:Hf+2}function H(){return F(!Pg)}function I(){return G(!Pg)}function J(){return F(Pg)}function K(){return G(Pg)}function L(){var a=Pg?Hf:Ff,b=vc(),c=Vb()*(Ud(nf.data.targets)?(b-(gi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){yi=a}function N(a){zi=a}function O(a){Ai=a}function P(){return Lg?xi?zi*(yi+1):Jf:0}function Q(){return Lg?xi?Kf:Ai*(yi+1):0}function R(){var a,b=!$f;Sf=Pg?1:0,Tf=Pg?Hf:Ff,Uf=Pg?0:Hf,Vf=Pg?Ff:1,Wf=Sf,Xf=Tf,Yf=Pg?0:If,Zf=Pg?Gf:1,$f=T(Sf,Tf,b?void 0:$f.domain(),function(){return eg.tickOffset()}),_f=U(Uf,Vf),ag=U(Uf,Vf),bg=T(Sf,Tf,Qi,function(a){return a%1?0:hg.tickOffset()}),cg=U(Yf,Zf),dg=U(Yf,Zf),a=$(),eg=X($f,si,a),hg=X(bg,vi,a),fg=Y(_f,ti,hh,jh),gg=Y(ag,ui,qh,sh),b||(Ei.scale(bg),uf&&Ii.scale($f)),S()}function S(){Of=Db(),Pf=Eb(),Qf=Eb(.98)}function T(a,b,e,f){var g=(fi?mf.time.scale():mf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),gi){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return mf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?ag:_f}function W(a){return"y2"===Z(a)?dg:cg}function X(a,b,c){var d=(gi?Bb():mf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),gi?d.tickCentered(Tg):d.tickOffset=function(){var a=Pg?Hf:Ff;return a*Vb()/vc()/2},gi&&d.categories(Sg),d}function Y(a,b,c,d){return mf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in pg?pg[a]:"y"}function $(){var a=fi?pi:gi?Oc:function(a){return 0>a?a.toFixed(0):a};return Ug&&("function"==typeof Ug?a=Ug:fi&&(a=function(a){return oi(Ug)(a)})),a}function _(a){var b;return"y"===a?b=fh:"y2"===a?b=oh:"x"===a&&(b=ah),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?fh=b:"y2"===a?oh=b:"x"===a&&(ah=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Pg?"inner-top":"inner-right")}function eb(){return cb("y",Pg?"inner-right":"inner-top")}function fb(){return cb("y2",Pg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?Ff/2:Ff:b.isBottom?-Hf:b.isMiddle?-Hf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Pg,db())}function ob(){return kb(Pg,eb())}function pb(){return kb(Pg,fb())}function qb(){return lb(!Pg,db())}function rb(){return lb(Pg,eb())}function sb(){return lb(Pg,fb())}function tb(){var a=db();return Pg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Pg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Pg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Pg,db())}function xb(){return mb(Pg,eb())}function yb(){return mb(Pg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Li.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Li.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Li.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return mf.min(Object.keys(i).map(function(a){return mf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(og.length>0)for(g=Nc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return mf.max(Object.keys(i).map(function(a){return mf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?mh:dh,n="y2"===c?lh:ch,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?nh:eh,r=pd()&&Pg;return 0===l.length?"y2"===c?ag.domain():_f.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=qd(o,p),j=$b(_f.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&ih&&(f=b(ih.top)?ih.top:e,g=b(ih.bottom)?ih.bottom:e),"y2"===c&&rh&&(f=b(rh.top)?rh.top:e,g=b(rh.bottom)?rh.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Qi),c=$b($f.domain());return a||0===c?1:b/c}function Wb(a){return $g?$g:mf.min(a,function(a){return mf.min(a.values,function(a){return a.x})})}function Xb(a){return Zg?Zg:mf.max(a,function(a){return mf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return gi?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=0,g=0;return(c||0===c)&&(f=fi?new Date(c.getTime()-e):c-e),(d||0===d)&&(g=fi?new Date(d.getTime()+e):d+e),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return ig&&a===ig||ne(jg)&&oe(jg,a)}function fc(a){return!ec(a)}function gc(a){return ig?ig:ne(jg)?jg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=nf.data.xs[b])}),c}function ic(a,b){return a in nf.data.xs&&nf.data.xs[a]&&nf.data.xs[a][b]?nf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){jg[b]=a[b]})}function kc(a){return 1===mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=mg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),nf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=fi?a?a instanceof Date?a:ie(a):ie(ic(b,c)):hi&&!gi?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):ig?(d=Object.keys(nf.data.xs),nf.data.xs[c]=d.length>0?nf.data.xs[d[0]]:void 0):ne(jg)&&(nf.data.xs[c]=hc(f,nf.data.targets)):nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=lg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return hi&&gi&&0===c&&g&&(0===e&&(Sg=[]),Sg.push(g)),("undefined"==typeof a[b]||nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),qg&&Sd(xc(c).filter(function(a){return!(a in rg)}),qg),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function tc(a){return a>0&&nf.data.targets[0].values[a-1]?nf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?nf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?nf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(nf.data.targets)}function zc(a,b){var c,d=xc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(fi?new Date(h):h);i.push(d)}return fi||(i=i.sort()),i}function Gc(a){qi=qi.concat(a)}function Hc(a){qi=qi.filter(function(b){return a.indexOf(b)<0})}function Ic(a){ri=ri.concat(a)}function Jc(a){ri=ri.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Ed(){return tg&&"desc"===tg.toLowerCase()}function Fd(){return tg&&"asc"===tg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof tg&&a.sort(tg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(nf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Uh&&0!==m.length&&(Oi.html(Xh(a,$(),l,ni)).style("display","block"),d=Oi.property("offsetWidth"),e=Oi.property("offsetHeight"),k?(g=Ff/2+c[0],i=Hf/2+c[1]+20):(Pg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=$f(m[0].x)+20):(f=q(),g=f+t()+$f(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Oi.style("top",i+"px").style("left",g+"px"))}function Id(){Oi.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Uh&&(Vd(nf.data.targets)||Yd(nf.data.targets)||Li.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Pg?"y1":"x1",ud).attr(Pg?"y2":"x2",ud))}function Kd(){Li.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?$f(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Gh?Gh:b?2*a.tickOffset()*Hh/b:0}function Sd(a,b){yc(a).forEach(function(a){Si[a]=b===rg[a],rg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){rg[a.id]===b&&(c=!0),a.id in rg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in rg)||"line"===rg[b]||"spline"===rg[b]||"area"===rg[b]||"area-spline"===rg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===rg[b]||"area-spline"===rg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===rg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===rg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===rg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===rg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ie(b){var c;try{c=kg?mf.time.format(kg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+kg)}return c}function je(a,b){var c=mf.mouse(a),d=mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?_f:ag,d=Pg?1:0,e=Pg?0:1;return Math.pow($f(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Eg(b,a.node()),Li.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Pg?Md:Ld).attr("cy",Pg?Ld:Md).attr("stroke",function(){return ni(b)}).attr("r",1.4*Eh).transition().duration(100).attr("r",Eh)}function se(a,b,c){Fg(b,a.node()),Li.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Eg(b,a.node()),a.transition().duration(100).style("fill",function(){return mf.rgb(ni(b)).darker(1)})}function ve(a,b){Fg(b,a.node()),a.transition().duration(100).style("fill",function(){return ni(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Li.selectAll("."+f.circles+gd(c)):Li).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",Dh)}function Ae(a){ye(a).filter(function(){return mf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Ah)}function Be(a){return Li.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Pg?1:0,f=Pg?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Pg?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBoundingClientRect();return Pg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(eg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Pg&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Je(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function Ke(b){var c,d,e;if(Pi=mf.select(pf),Pi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Pi.html(""),Pi.classed("c3",!0),nf.data.xs={},nf.data.targets=rc(b),n(),R(),$f.domain(mf.extent(Zb(nf.data.targets))),_f.domain(Ub(nf.data.targets,"y")),ag.domain(Ub(nf.data.targets,"y2")),bg.domain($f.domain()),cg.domain(_f.domain()),dg.domain(ag.domain()),Qi=$f.domain(),Ei.scale(bg),uf&&Ii.scale($f),Ji=Pi.append("svg").attr("width",Ff+Cf.left+Cf.right).attr("height",Hf+Cf.top+Cf.bottom).on("mouseenter",xf).on("mouseleave",yf),Ki=Ji.append("defs"),Ki.append("clipPath").attr("id",_h).append("rect").attr("width",Ff).attr("height",Hf),Ki.append("clipPath").attr("id",ai).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Ki.append("clipPath").attr("id",bi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Li=Ji.append("g").attr("transform",wi.main),Mi=Ig?Ji.append("g").attr("transform",wi.context):null,Ni=Ji.append("g").attr("transform",wi.legend),Lg||(Ni.style("visibility","hidden"),ri=xc(nf.data.targets)),Oi=mf.select(pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),gf(xc(nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Li.append("g").attr("class",f.axisX).attr("clip-path",Pg?"":di).attr("transform",wi.x).append("text").attr("class",f.axisXLabel).attr("transform",Pg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),bh&&Li.append("g").attr("class",f.axisY).attr("clip-path",Pg?ei:"").attr("transform",wi.y).append("text").attr("class",f.axisYLabel).attr("transform",Pg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),kh&&Li.append("g").attr("class",f.axisY2).attr("transform",wi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Pg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Li.append("g").attr("clip-path",ci).attr("class",f.grid),th&&d.append("g").attr("class",f.xgrids),ne(vh)&&d.append("g").attr("class",f.xgridLines),Bh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),wh&&d.append("g").attr("class",f.ygrids),ne(xh)&&d.append("g").attr("class",f.ygridLines),Li.append("g").attr("clip-path",ci).attr("class",f.regions),Li.append("g").attr("clip-path",ci).attr("class",f.chart),c=Li.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",uf?Pg?"ns-resize":"ew-resize":null),Li.select("."+f.chart).append("g").attr("class",f.chartBars),Li.select("."+f.chart).append("g").attr("class",f.chartLines),Li.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",wi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Li.select("."+f.chart).append("g").attr("class",f.chartTexts),uf&&Li.insert("rect",wf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Ff).attr("height",Hf).style("opacity",0).style("cursor",Pg?"ns-resize":"ew-resize").call(Ii).on("dblclick.zoom",null),_g&&Ei.extent("function"!=typeof _g?_g:_g(Zb())),Ig&&(Mi.append("g").attr("clip-path",ci).attr("class",f.chart),Mi.select("."+f.chart).append("g").attr("class",f.chartBars),Mi.select("."+f.chart).append("g").attr("class",f.chartLines),Mi.append("g").attr("clip-path",ci).attr("class",f.brush).call(Ei).selectAll("rect").attr(Pg?"width":"height",Pg?Gf:If),Mi.append("g").attr("class",f.axisX).attr("transform",wi.subx).attr("clip-path",Pg?"":di)),Xe(nf.data.targets),Pg?Li.select("."+f.axisX).style("opacity",0).call(eg):(Li.select("."+f.axisY).style("opacity",0).call(fg),Li.select("."+f.axisY2).style("opacity",0).call(gg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Yh){if(fi&&"string"==typeof Zh){for(Zh=ie(Zh),e=0;eFf&&(Ff=0),0>Hf&&(Hf=0),Df={top:Pg?Cf.top:Kf-Jg-(xi?0:a),right:0/0,bottom:20+(xi?0:a),left:Pg?Bi:Cf.left},Gf=Pg?Cf.left-Bi-Ci:Ff,If=Pg?Hf:Kf-Df.top-Df.bottom,0>Gf&&(Gf=0),0>If&&(If=0),Ef={top:xi?0:Kf-a,right:0/0,bottom:0,left:xi?Jf-b:0},p(),xi&&Yd(nf.data.targets)&&(Ef.left=Ff/2+Mf)}function o(){Li.select("line."+f.xgridFocus).attr("x1",Pg?0:-10).attr("x2",Pg?Ff:-10).attr("y1",Pg?-10:Cf.top).attr("y2",Pg?-10:Hf)}function p(){Mf=Hf/2,Lf=.95*Mf,Nf=Xd(nf.data.targets)?.6*Lf:0}function q(){var a=Pg?f.axisX:f.axisY,b=mf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=mf.select(pf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return qf?qf:x()}function s(){var a=rf?rf:y();return a>0?a:320}function t(){return Yd(nf.data.targets)?0:sf?sf:Pg||!bh||gh?1:v("y")}function u(){var a=1;return Yd(nf.data.targets)?0:tf?tf:xi?P()+(kh&&!Pg?v("y2"):a):kh?ph||Pg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||bh?"y2"!==a||kh?(gb(a).isInner?30:40)+("y2"===a?-10:0):Di:Lg&&!xi?10:1}function x(){return+mf.select(pf).style("width").replace("px","")}function y(){return+mf.select(pf).style("height").replace("px","")}function z(a){return a?-5:-(Cf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Pg)}function C(){return A(!Pg)}function D(){return z(Pg)}function E(){return A(Pg)}function F(a){return a?Ff+2+4:Cf.left+20}function G(a){return a?80:Hf+2}function H(){return F(!Pg)}function I(){return G(!Pg)}function J(){return F(Pg)}function K(){return G(Pg)}function L(){var a=Pg?Hf:Ff,b=vc(),c=Vb()*(Ud(nf.data.targets)?(b-(gi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){yi=a}function N(a){zi=a}function O(a){Ai=a}function P(){return Lg?xi?zi*(yi+1):Jf:0}function Q(){return Lg?xi?Kf:Ai*(yi+1):0}function R(){var a,b=!$f;Sf=Pg?1:0,Tf=Pg?Hf:Ff,Uf=Pg?0:Hf,Vf=Pg?Ff:1,Wf=Sf,Xf=Tf,Yf=Pg?0:If,Zf=Pg?Gf:1,$f=T(Sf,Tf,b?void 0:$f.domain(),function(){return eg.tickOffset()}),_f=U(Uf,Vf),ag=U(Uf,Vf),bg=T(Sf,Tf,Qi,function(a){return a%1?0:hg.tickOffset()}),cg=U(Yf,Zf),dg=U(Yf,Zf),a=$(),eg=X($f,si,a),hg=X(bg,vi,a),fg=Y(_f,ti,hh,jh),gg=Y(ag,ui,qh,sh),b||(Ei.scale(bg),uf&&Ii.scale($f)),S()}function S(){Of=Db(),Pf=Eb(),Qf=Eb(.98)}function T(a,b,e,f){var g=(fi?mf.time.scale():mf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),gi){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return mf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?ag:_f}function W(a){return"y2"===Z(a)?dg:cg}function X(a,b,c){var d=(gi?Bb():mf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),gi?d.tickCentered(Tg):d.tickOffset=function(){var a=Pg?Hf:Ff;return a*Vb()/vc()/2},gi&&d.categories(Sg),d}function Y(a,b,c,d){return mf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in pg?pg[a]:"y"}function $(){var a=fi?pi:gi?Oc:function(a){return 0>a?a.toFixed(0):a};return Ug&&("function"==typeof Ug?a=Ug:fi&&(a=function(a){return oi(Ug)(a)})),a}function _(a){var b;return"y"===a?b=fh:"y2"===a?b=oh:"x"===a&&(b=ah),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?fh=b:"y2"===a?oh=b:"x"===a&&(ah=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Pg?"inner-top":"inner-right")}function eb(){return cb("y",Pg?"inner-right":"inner-top")}function fb(){return cb("y2",Pg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?Ff/2:Ff:b.isBottom?-Hf:b.isMiddle?-Hf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Pg,db())}function ob(){return kb(Pg,eb())}function pb(){return kb(Pg,fb())}function qb(){return lb(!Pg,db())}function rb(){return lb(Pg,eb())}function sb(){return lb(Pg,fb())}function tb(){var a=db();return Pg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Pg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Pg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Pg,db())}function xb(){return mb(Pg,eb())}function yb(){return mb(Pg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Li.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Li.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Li.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return mf.min(Object.keys(i).map(function(a){return mf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(og.length>0)for(g=Nc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return mf.max(Object.keys(i).map(function(a){return mf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?mh:dh,n="y2"===c?lh:ch,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?nh:eh,r=pd()&&Pg;return 0===l.length?"y2"===c?ag.domain():_f.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=qd(o,p),j=$b(_f.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&ih&&(f=b(ih.top)?ih.top:e,g=b(ih.bottom)?ih.bottom:e),"y2"===c&&rh&&(f=b(rh.top)?rh.top:e,g=b(rh.bottom)?rh.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Qi),c=$b($f.domain());return a||0===c?1:b/c}function Wb(a){return $g?$g:mf.min(a,function(a){return mf.min(a.values,function(a){return a.x})})}function Xb(a){return Zg?Zg:mf.max(a,function(a){return mf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return gi?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=0,g=0;return(c||0===c)&&(f=fi?new Date(c.getTime()-e):c-e),(d||0===d)&&(g=fi?new Date(d.getTime()+e):d+e),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return ig&&a===ig||ne(jg)&&oe(jg,a)}function fc(a){return!ec(a)}function gc(a){return ig?ig:ne(jg)?jg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=nf.data.xs[b])}),c}function ic(a,b){return a in nf.data.xs&&nf.data.xs[a]&&nf.data.xs[a][b]?nf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){jg[b]=a[b]})}function kc(a){return 1===mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=mg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),nf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=fi?a?a instanceof Date?a:ie(a):ie(ic(b,c)):hi&&!gi?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):ig?(d=Object.keys(nf.data.xs),nf.data.xs[c]=d.length>0?nf.data.xs[d[0]]:void 0):ne(jg)&&(nf.data.xs[c]=hc(f,nf.data.targets)):nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=lg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return hi&&gi&&0===c&&g&&(0===e&&(Sg=[]),Sg.push(g)),("undefined"==typeof a[b]||nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),qg&&Sd(xc(c).filter(function(a){return!(a in rg)}),qg),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function tc(a){return a>0&&nf.data.targets[0].values[a-1]?nf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?nf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?nf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(nf.data.targets)}function zc(a,b){var c,d=xc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(fi?new Date(h):h);i.push(d)}return fi||(i=i.sort()),i}function Gc(a){qi=qi.concat(a)}function Hc(a){qi=qi.filter(function(b){return a.indexOf(b)<0})}function Ic(a){ri=ri.concat(a)}function Jc(a){ri=ri.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Ed(){return tg&&"desc"===tg.toLowerCase()}function Fd(){return tg&&"asc"===tg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof tg&&a.sort(tg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(nf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Uh&&0!==m.length&&(Oi.html(Xh(a,$(),l,ni)).style("display","block"),d=Oi.property("offsetWidth"),e=Oi.property("offsetHeight"),k?(g=Ff/2+c[0],i=Hf/2+c[1]+20):(Pg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=$f(m[0].x)+20):(f=q(),g=f+t()+$f(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Oi.style("top",i+"px").style("left",g+"px"))}function Id(){Oi.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Uh&&(Vd(nf.data.targets)||Yd(nf.data.targets)||Li.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Pg?"y1":"x1",ud).attr(Pg?"y2":"x2",ud))}function Kd(){Li.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?$f(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Gh?Gh:b?2*a.tickOffset()*Hh/b:0}function Sd(a,b){yc(a).forEach(function(a){Si[a]=b===rg[a],rg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){rg[a.id]===b&&(c=!0),a.id in rg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in rg)||"line"===rg[b]||"spline"===rg[b]||"area"===rg[b]||"area-spline"===rg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===rg[b]||"area-spline"===rg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===rg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===rg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===rg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===rg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ie(b){var c;try{c=kg?mf.time.format(kg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+kg)}return c}function je(a,b){var c=mf.mouse(a),d=mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?_f:ag,d=Pg?1:0,e=Pg?0:1;return Math.pow($f(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Eg(b,a.node()),Li.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Pg?Md:Ld).attr("cy",Pg?Ld:Md).attr("stroke",function(){return ni(b)}).attr("r",1.4*Eh).transition().duration(100).attr("r",Eh)}function se(a,b,c){Fg(b,a.node()),Li.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Eg(b,a.node()),a.transition().duration(100).style("fill",function(){return mf.rgb(ni(b)).darker(1)})}function ve(a,b){Fg(b,a.node()),a.transition().duration(100).style("fill",function(){return ni(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Li.selectAll("."+f.circles+gd(c)):Li).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",Dh)}function Ae(a){ye(a).filter(function(){return mf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Ah)}function Be(a){return Li.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Pg?1:0,f=Pg?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Pg?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBoundingClientRect();return Pg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(eg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Pg&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Je(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function Ke(b){var c,d,e;if(Pi=mf.select(pf),Pi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Pi.html(""),Pi.classed("c3",!0),nf.data.xs={},nf.data.targets=rc(b),n(),R(),$f.domain(mf.extent(Zb(nf.data.targets))),_f.domain(Ub(nf.data.targets,"y")),ag.domain(Ub(nf.data.targets,"y2")),bg.domain($f.domain()),cg.domain(_f.domain()),dg.domain(ag.domain()),Qi=$f.domain(),Ei.scale(bg),uf&&Ii.scale($f),Ji=Pi.append("svg").attr("width",Ff+Cf.left+Cf.right).attr("height",Hf+Cf.top+Cf.bottom).on("mouseenter",xf).on("mouseleave",yf),Ki=Ji.append("defs"),Ki.append("clipPath").attr("id",_h).append("rect").attr("width",Ff).attr("height",Hf),Ki.append("clipPath").attr("id",ai).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Ki.append("clipPath").attr("id",bi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Li=Ji.append("g").attr("transform",wi.main),Mi=Ig?Ji.append("g").attr("transform",wi.context):null,Ni=Ji.append("g").attr("transform",wi.legend),Lg||(Ni.style("visibility","hidden"),ri=xc(nf.data.targets)),Oi=mf.select(pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),gf(xc(nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Li.append("g").attr("class",f.axisX).attr("clip-path",Pg?"":di).attr("transform",wi.x).append("text").attr("class",f.axisXLabel).attr("transform",Pg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),bh&&Li.append("g").attr("class",f.axisY).attr("clip-path",Pg?ei:"").attr("transform",wi.y).append("text").attr("class",f.axisYLabel).attr("transform",Pg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),kh&&Li.append("g").attr("class",f.axisY2).attr("transform",wi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Pg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Li.append("g").attr("clip-path",ci).attr("class",f.grid),th&&d.append("g").attr("class",f.xgrids),ne(vh)&&d.append("g").attr("class",f.xgridLines),Bh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),wh&&d.append("g").attr("class",f.ygrids),ne(xh)&&d.append("g").attr("class",f.ygridLines),Li.append("g").attr("clip-path",ci).attr("class",f.regions),Li.append("g").attr("clip-path",ci).attr("class",f.chart),c=Li.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",uf?Pg?"ns-resize":"ew-resize":null),Li.select("."+f.chart).append("g").attr("class",f.chartBars),Li.select("."+f.chart).append("g").attr("class",f.chartLines),Li.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",wi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Li.select("."+f.chart).append("g").attr("class",f.chartTexts),uf&&Li.insert("rect",wf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Ff).attr("height",Hf).style("opacity",0).style("cursor",Pg?"ns-resize":"ew-resize").call(Ii).on("dblclick.zoom",null),_g&&Ei.extent("function"!=typeof _g?_g:_g(Zb())),Ig&&(Mi.append("g").attr("clip-path",ci).attr("class",f.chart),Mi.select("."+f.chart).append("g").attr("class",f.chartBars),Mi.select("."+f.chart).append("g").attr("class",f.chartLines),Mi.append("g").attr("clip-path",ci).attr("class",f.brush).call(Ei).selectAll("rect").attr(Pg?"width":"height",Pg?Gf:If),Mi.append("g").attr("class",f.axisX).attr("transform",wi.subx).attr("clip-path",Pg?"":di)),Xe(nf.data.targets),Pg?Li.select("."+f.axisX).style("opacity",0).call(eg):(Li.select("."+f.axisY).style("opacity",0).call(fg),Li.select("."+f.axisY2).style("opacity",0).call(gg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Yh){if(fi&&"string"==typeof Zh){for(Zh=ie(Zh),e=0;e0){d=[];for(var g in mg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function Pe(a){Yd(nf.data.targets)||xg&&(ii=a,Li.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),ji=!0,Gg())}function Qe(){Yd(nf.data.targets)||xg&&(Li.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Li.selectAll("."+f.shape).classed(f.INCLUDED,!1),ji=!1,Hg())}function Re(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Nd(),U=Yd(nf.data.targets),V=Dc(nf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?Bf:0,O=B?N:0,P=C?N:0,H&&Lg&&gf(xc(nf.data.targets),a),G&&($f.domain(mf.extent(Zb(V))),Qi=$f.domain(),uf&&Ii.scale($f).updateScaleExtent(),bg.domain($f.domain()),Ei.scale(bg)),F&&($f.domain(Ei.empty()?Qi:Ei.extent()),uf&&Ii.scale($f).updateScaleExtent()),_f.domain(Ub(V,"y")),ag.domain(Ub(V,"y2")),Vd(V)||(Q=Fc(Ec(V)),eg.tickValues(Q),hg.tickValues(Q)),c=Li.select("."+f.axisX).style("opacity",U?0:1),(Pg||D)&&(c=c.transition().duration(P)),c.call(eg),e=Li.select("."+f.axisY).style("opacity",U?0:1),(!Pg||D)&&(e=e.transition().duration(P)),e.call(fg),Li.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(gg),F&&Vg&&Q){for(R=1;R0&&mf.select(this).style("display",b%S?"none":"block")})}if(I=Ee(T),K=Fe(T,!0),M=Fe(T,!1),Ab(),cg.domain(_f.domain()),dg.domain(ag.domain()),Oi.style("display","none"),o(),Li.select("line."+f.xgridFocus).style("visibility","hidden"),th){if("year"===uh){h=[];for(var W=Zb(),X=W[0].getFullYear(),Y=W[1].getFullYear(),Z=X;Y>=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=$f.ticks(10);g=Li.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Pg?0:function(a){return $f(a)-eg.tickOffset()}).attr("x2",Pg?Ff:function(a){return $f(a)-eg.tickOffset()}).attr("y1",Pg?function(a){return $f(a)-eg.tickOffset()}:Cf.top).attr("y2",Pg?function(a){return $f(a)-eg.tickOffset()}:Hf).style("opacity",function(){return+mf.select(this).attr(Pg?"y1":"x1")===(Pg?Hf:0)?0:1}),g.exit().remove()}ne(vh)&&(i=Li.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(vh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Pg?"":"rotate(-90)").attr("dx",Pg?0:-Cf.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Pg?0:vd).attr("x2",Pg?Ff:vd).attr("y1",Pg?vd:Cf.top).attr("y2",Pg?vd:Hf).style("opacity",1),i.select("text").transition().duration(N).attr("x",Pg?Ff:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&wh&&(k=Li.select("."+f.ygrids).selectAll("."+f.ygrid).data(_f.ticks(yh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Pg?_f:0).attr("x2",Pg?_f:Ff).attr("y1",Pg?0:_f).attr("y2",Pg?Hf:_f),k.exit().remove()),y&&ne(xh)&&(l=Li.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(xh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Pg?"rotate(-90)":"").attr("dx",Pg?0:-Cf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Pg?wd:0).attr("x2",Pg?wd:Ff).attr("y1",Pg?0:wd).attr("y2",Pg?Hf:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Pg?0:Ff).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Li.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ni(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Li.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Pg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Li.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Fi).style("opacity",1),Li.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Gi).style("opacity",Ri),n=Li.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",Ah),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Pg?Md:Ld).attr("cy",Pg?Ld:Md),n.exit().remove(),Li.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=mf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Li.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Li.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Ig&&(null!==mf.event&&"zoom"===mf.event.type&&Ei.extent($f.orgDomain()).update(),z&&(Mi.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(hg),Ei.empty()||Ei.extent($f.orgDomain()).update(),J=Ee(T,!0),s=Mi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ni(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Mi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Hi).style("opacity",1))),Li.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Li.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Pg?Md:Ld).attr("cy",Pg?Ld:Md),t=Li.select("."+f.eventRects),ne(jg)&&!kc(jg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Li.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Ff).attr("height",Hf)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),hi&&!gi?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return($f(d?d:e+50)-$f(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return($f(d)+$f(c?c:d-50))/2}):(x=L(),w=function(a){return $f(a.x)-x/2}),v=wc(),Li.select("."+f.eventRects).datum(v?v.values:[]),u=Li.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Pg?0:w).attr("y",Pg?w:0).attr("width",Pg?Ff:x).attr("height",Pg?x:Hf),u.exit().remove()),q=Li.select("."+f.regions).selectAll("rect."+f.region).data(Th),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Pg?0:cc).attr("y",Pg?cc:Cf.top).attr("width",Pg?Ff:dc).attr("height",Pg?dc:Hf).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),xc(nf.data.targets).forEach(function(a){Si[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Ii.altDomain?($f.domain(Ii.altDomain),void Ii.scale($f).updateScaleExtent()):(gi&&$f.orgDomain()[0]===Qi[0]&&$f.domain([Qi[0]-1e-10,$f.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(ki=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Ji.attr("width",Jf).attr("height",Kf),Ji.select("#"+_h).select("rect").attr("width",Ff).attr("height",Hf),Ji.select("#"+ai).select("rect").attr("width",H),Ji.select("#"+bi).select("rect").attr("width",J),Ji.select("."+f.zoomRect).attr("width",Ff).attr("height",Hf)}function We(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Li.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ni(a)}),e=Li.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ni(a)}).style("stroke","none").style("cursor",function(a){return zg(a)?"pointer":null}),c=Li.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ni(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Ri=+mf.select(this).style("opacity"),0}).style("fill",function(a){return ni(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ni(a)}).style("cursor",function(a){return zg(a)?"pointer":null}),a.forEach(function(a){Li.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Li.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Rf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ni(a.data)}).style("cursor",function(a){return zg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Ig&&(n=Mi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ni(a)}),l=Mi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ni(a)})),Ji.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=xi?j:i,l=xi?Q():P();return d&&(w=0,C=0,t=0,u=0),Lg&&!Cc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=xi?u:t,void(Og?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,xi?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Ni.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Ng?Ng(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(mg[a])?mg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",xi?g:-200).attr("y",xi?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",xi?h:-200).attr("y",xi?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return ni(a)}).attr("x",xi?g:-200).attr("y",xi?-200:i).attr("width",10).attr("height",10),Ni.selectAll("text").data(a).text(function(a){return d(mg[a])?mg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ni.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ni.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["onresize"],function(){}),Af=h(["onresized"],function(){}),Bf=h(["transition","duration"],350);g("data","data is required in config");var Cf,Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig=h(["data","x"]),jg=h(["data","xs"],{}),kg=h(["data","x_format"]),lg=h(["data","id_converter"],function(a){return a}),mg=h(["data","names"],{}),ng=h(["data","classes"],{}),og=h(["data","groups"],[]),pg=h(["data","axes"],{}),qg=h(["data","type"]),rg=h(["data","types"],{}),sg=h(["data","labels"],{}),tg=h(["data","order"]),ug=h(["data","regions"],{}),vg=h(["data","color"]),wg=h(["data","colors"],{}),xg=h(["data","selection","enabled"],!1),yg=h(["data","selection","grouped"],!1),zg=h(["data","selection","isselectable"],function(){return!0}),Ag=h(["data","selection","multiple"],!0),Bg=h(["data","onclick"],function(){}),Cg=h(["data","onenter"],function(){}),Dg=h(["data","onleave"],function(){}),Eg=h(["data","onselected"],function(){}),Fg=h(["data","onunselected"],function(){}),Gg=h(["data","ondragstart"],function(){}),Hg=h(["data","ondragend"],function(){}),Ig=h(["subchart","show"],!1),Jg=Ig?h(["subchart","size","height"],60):0,Kg=h(["color","pattern"],[]),Lg=h(["legend","show"],!0),Mg=h(["legend","position"],"bottom"),Ng=h(["legend","item","onclick"]),Og=h(["legend","equally"],!1),Pg=h(["axis","rotated"],!1),Qg=h(["axis","x","type"],"indexed"),Rg=h(["axis","x","localtime"],!1),Sg=h(["axis","x","categories"],[]),Tg=h(["axis","x","tick","centered"],!1),Ug=h(["axis","x","tick","format"]),Vg=h(["axis","x","tick","culling"],{}),Wg=h(["axis","x","tick","culling","max"],"categorized"===Qg?1/0:10),Xg=h(["axis","x","tick","count"]),Yg=h(["axis","x","tick","fit"],!1),Zg=h(["axis","x","max"]),$g=h(["axis","x","min"]),_g=h(["axis","x","default"]),ah=h(["axis","x","label"],{}),bh=h(["axis","y","show"],!0),ch=h(["axis","y","max"]),dh=h(["axis","y","min"]),eh=h(["axis","y","center"]),fh=h(["axis","y","label"],{}),gh=h(["axis","y","inner"],!1),hh=h(["axis","y","tick","format"]),ih=h(["axis","y","padding"],{}),jh=h(["axis","y","ticks"],10),kh=h(["axis","y2","show"],!1),lh=h(["axis","y2","max"]),mh=h(["axis","y2","min"]),nh=h(["axis","y2","center"]),oh=h(["axis","y2","label"],{}),ph=h(["axis","y2","inner"],!1),qh=h(["axis","y2","tick","format"]),rh=h(["axis","y2","padding"],{}),sh=h(["axis","y2","ticks"],10),th=h(["grid","x","show"],!1),uh=h(["grid","x","type"],"tick"),vh=h(["grid","x","lines"],[]),wh=h(["grid","y","show"],!1),xh=h(["grid","y","lines"],[]),yh=h(["grid","y","ticks"],10),zh=h(["point","show"],!0),Ah=zh?h(["point","r"],2.5):0,Bh=h(["point","focus","line","enabled"],!0),Ch=h(["point","focus","expand","enabled"],!0),Dh=h(["point","focus","expand","r"],Ch?4:Ah),Eh=h(["point","focus","select","r"],8),Fh=h(["line","connect_null"],!1),Gh=h(["bar","width"]),Hh=h(["bar","width","ratio"],.6),Ih=h(["pie","label","show"],!0),Jh=h(["pie","label","format"]),Kh=h(["pie","onclick"],function(){}),Lh=h(["pie","onmouseover"],function(){}),Mh=h(["pie","onmouseout"],function(){}),Nh=h(["donut","label","show"],!0),Oh=h(["donut","label","format"]),Ph=h(["donut","title"],""),Qh=h(["donut","onclick"],function(){}),Rh=h(["donut","onmouseover"],function(){}),Sh=h(["donut","onmouseout"],function(){}),Th=h(["regions"],[]),Uh=h(["tooltip","show"],!0),Vh=h(["tooltip","format","title"]),Wh=h(["tooltip","format","value"]),Xh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Vh?Vh:b,l=Wh?Wh:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Yh=h(["tooltip","init","show"],!1),Zh=h(["tooltip","init","x"],0),$h=h(["tooltip","init","position"],{top:"0px",left:"50px"}),_h=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",ai=_h+"-xaxis",bi=_h+"-yaxis",ci=i(_h),di=i(ai),ei=i(bi),fi="timeseries"===Qg,gi="categorized"===Qg,hi=!fi&&(ig||ne(jg)),ii=null,ji=!1,ki=!1,li=!1,mi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ni=he(wg,ne(Kg)?Kg:mi,vg),oi=Rg?mf.time.format:mf.time.format.utc,pi=function(){var a=[[oi("%Y/%-m/%-d"),function(){return!0}],[oi("%-m/%-d"),function(a){return a.getMonth()}],[oi("%-m/%-d"),function(a){return 1!==a.getDate()}],[oi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[oi("%I %p"),function(a){return a.getHours()}],[oi("%I:%M"),function(a){return a.getMinutes()}],[oi(":%S"),function(a){return a.getSeconds()}],[oi(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),qi=[],ri=[],si=Pg?"left":"bottom",ti=Pg?gh?"top":"bottom":gh?"right":"left",ui=Pg?ph?"bottom":"top":ph?"left":"right",vi=Pg?"left":"bottom",wi={main:function(){return"translate("+Cf.left+","+Cf.top+")"},context:function(){return"translate("+Df.left+","+Df.top+")"},legend:function(){return"translate("+Ef.left+","+Ef.top+")"},x:function(){return"translate(0,"+(Pg?0:Hf)+")"},y:function(){return"translate(0,"+(Pg?Hf:0)+")"},y2:function(){return"translate("+(Pg?0:Ff)+","+(Pg?1:0)+")"},subx:function(){return"translate(0,"+(Pg?0:If)+")"},arc:function(){return"translate("+Ff/2+","+Hf/2+")"}},xi="right"===Mg,yi=0,zi=0,Ai=0,Bi=30,Ci=30,Di=5;Rf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Ei,Fi=function(){var a=mf.svg.line().x(Pg?function(a){return V(a.id)(a.value)}:ud).y(Pg?ud:function(a){return V(a.id)(a.value)});return Fh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Fh?xe(b.values):b.values;return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),ug[b.id]?Je(e,$f,V(b.id),ug[b.id]):a(e)):(c=e[0]?$f(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Pg?"M "+d+" "+c:"M "+c+" "+d)}}(),Gi=function(){var a;return a=Pg?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?$f(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Pg?"M "+d+" "+c:"M "+c+" "+d)}}(),Hi=function(){var a=mf.svg.line().x(Pg?function(a){return W(a.id)(a.value)}:xd).y(Pg?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+bg(c[0].x)+" "+W(b.id)(c[0].value)}}(),Ii=function(){};Ei=mf.svg.brush().on("brush",Se),Ei.update=function(){return Mi&&Mi.select("."+f.brush).call(this),this},Ei.scale=function(a){return Pg?this.y(a):this.x(a)},uf&&(Ii=mf.behavior.zoom().on("zoomstart",function(){Ii.altDomain=mf.event.sourceEvent.altKey?$f.orgDomain():null}).on("zoom",uf?Te:null),Ii.scale=function(a){return Pg?this.y(a):this.x(a)},Ii.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Ii.updateScaleExtent=function(){var a=$b($f.orgDomain())/$b(Qi),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Ji,Ki,Li,Mi,Ni,Oi,Pi,Qi,Ri,Si={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ji.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Ji.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ji.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Ji.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Ni.selectAll(kd(a)).classed(f.legendItemHidden,!1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Ji.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Ni.selectAll(kd(a)).classed(f.legendItemHidden,!0),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){Ei.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){ng[b]=a.classes[b]}),"categories"in a&&gi&&(Sg=a.categories,eg.categories(Sg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Li.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){xg&&Li.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=yg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?zg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){xg&&Li.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=yg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&zg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?og:(og=a,Re(),og)},nf.xgrids=function(a){return a?(vh=a,Re(),vh):vh},nf.xgrids.add=function(a){return a?nf.xgrids(vh.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(vh.filter(b))},nf.ygrids=function(a){return a?(xh=a,Re(),xh):xh},nf.ygrids.add=function(a){return a?nf.ygrids(xh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(xh.filter(b))},nf.regions=function(a){return c(a)?Th:(Th=a,Re(),Th)},nf.regions.add=function(a){return c(a)?Th:(Th=Th.concat(a),Re(),Th)},nf.regions.remove=function(a,c){var e=[].concat(a);return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;Ji.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Th=Th.filter(function(b){return b.classes.indexOf(a)<0})}),Th},nf.data.get=function(a){var b=nf.data.getAsTarget(a); return d(b)?b.values.map(function(a){return a.value}):void 0},nf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){mg[b]=a[b]}),gf(xc(nf.data.targets),{withTransition:!0}),mg):mg},nf.x=function(a){return arguments.length&&(mc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.xs=function(a){return arguments.length&&(nc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(ch=+a.y),b(a.y2)&&(lh=+a.y2)):ch=lh=+a,Re())},nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(dh=+a.y),b(a.y2)&&(mh=+a.y2)):dh=mh=+a,Re())},nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&nf.axis.max(a.max),"undefined"!=typeof a.min&&nf.axis.min(a.min))},nf.legend.show=function(a){Lg||(Lg=!0,Ni.style("visibility","visible")),ef(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.legend.hide=function(a){Lg&&me(a)&&(Lg=!1,Ni.style("visibility","hidden")),ff(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.resize=function(a){qf=a?a.width:null,rf=a?a.height:null,We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},nf.destroy=function(){nf.data.targets=void 0,nf.data.xs={},Pi.html(""),a.onresize=null},"url"in e.data)mf.xhr(e.data.url,function(a,b){var c,d=mf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=mf.csv.parse(b.response),Ke(c)});else if("rows"in e.data)Ke(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ke(qc(e.data.columns))}return nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file diff --git a/package.json b/package.json index 7cd0834..5dac006 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "c3", - "version": "0.1.29", + "version": "0.1.30", "description": "D3-based reusable chart library", "main": "c3.js", "scripts": { From 29e871ff16fedc9e05d0eb716b4186fddcac0584 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Sat, 12 Apr 2014 22:08:46 +0900 Subject: [PATCH 039/178] Fix tick values sort --- c3.js | 2 +- c3.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/c3.js b/c3.js index c09c37d..c8073d0 100644 --- a/c3.js +++ b/c3.js @@ -1531,7 +1531,7 @@ tickValues.push(end); } } - if (!isTimeSeries) { tickValues = tickValues.sort(); } + if (!isTimeSeries) { tickValues = tickValues.sort(function (a, b) { return a - b; }); } return tickValues; } function addHiddenTargetIds(targetIds) { diff --git a/c3.min.js b/c3.min.js index 1af5ea8..69040e6 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.30"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cFf&&(Ff=0),0>Hf&&(Hf=0),Df={top:Pg?Cf.top:Kf-Jg-(xi?0:a),right:0/0,bottom:20+(xi?0:a),left:Pg?Bi:Cf.left},Gf=Pg?Cf.left-Bi-Ci:Ff,If=Pg?Hf:Kf-Df.top-Df.bottom,0>Gf&&(Gf=0),0>If&&(If=0),Ef={top:xi?0:Kf-a,right:0/0,bottom:0,left:xi?Jf-b:0},p(),xi&&Yd(nf.data.targets)&&(Ef.left=Ff/2+Mf)}function o(){Li.select("line."+f.xgridFocus).attr("x1",Pg?0:-10).attr("x2",Pg?Ff:-10).attr("y1",Pg?-10:Cf.top).attr("y2",Pg?-10:Hf)}function p(){Mf=Hf/2,Lf=.95*Mf,Nf=Xd(nf.data.targets)?.6*Lf:0}function q(){var a=Pg?f.axisX:f.axisY,b=mf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=mf.select(pf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return qf?qf:x()}function s(){var a=rf?rf:y();return a>0?a:320}function t(){return Yd(nf.data.targets)?0:sf?sf:Pg||!bh||gh?1:v("y")}function u(){var a=1;return Yd(nf.data.targets)?0:tf?tf:xi?P()+(kh&&!Pg?v("y2"):a):kh?ph||Pg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||bh?"y2"!==a||kh?(gb(a).isInner?30:40)+("y2"===a?-10:0):Di:Lg&&!xi?10:1}function x(){return+mf.select(pf).style("width").replace("px","")}function y(){return+mf.select(pf).style("height").replace("px","")}function z(a){return a?-5:-(Cf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Pg)}function C(){return A(!Pg)}function D(){return z(Pg)}function E(){return A(Pg)}function F(a){return a?Ff+2+4:Cf.left+20}function G(a){return a?80:Hf+2}function H(){return F(!Pg)}function I(){return G(!Pg)}function J(){return F(Pg)}function K(){return G(Pg)}function L(){var a=Pg?Hf:Ff,b=vc(),c=Vb()*(Ud(nf.data.targets)?(b-(gi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){yi=a}function N(a){zi=a}function O(a){Ai=a}function P(){return Lg?xi?zi*(yi+1):Jf:0}function Q(){return Lg?xi?Kf:Ai*(yi+1):0}function R(){var a,b=!$f;Sf=Pg?1:0,Tf=Pg?Hf:Ff,Uf=Pg?0:Hf,Vf=Pg?Ff:1,Wf=Sf,Xf=Tf,Yf=Pg?0:If,Zf=Pg?Gf:1,$f=T(Sf,Tf,b?void 0:$f.domain(),function(){return eg.tickOffset()}),_f=U(Uf,Vf),ag=U(Uf,Vf),bg=T(Sf,Tf,Qi,function(a){return a%1?0:hg.tickOffset()}),cg=U(Yf,Zf),dg=U(Yf,Zf),a=$(),eg=X($f,si,a),hg=X(bg,vi,a),fg=Y(_f,ti,hh,jh),gg=Y(ag,ui,qh,sh),b||(Ei.scale(bg),uf&&Ii.scale($f)),S()}function S(){Of=Db(),Pf=Eb(),Qf=Eb(.98)}function T(a,b,e,f){var g=(fi?mf.time.scale():mf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),gi){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return mf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?ag:_f}function W(a){return"y2"===Z(a)?dg:cg}function X(a,b,c){var d=(gi?Bb():mf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),gi?d.tickCentered(Tg):d.tickOffset=function(){var a=Pg?Hf:Ff;return a*Vb()/vc()/2},gi&&d.categories(Sg),d}function Y(a,b,c,d){return mf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in pg?pg[a]:"y"}function $(){var a=fi?pi:gi?Oc:function(a){return 0>a?a.toFixed(0):a};return Ug&&("function"==typeof Ug?a=Ug:fi&&(a=function(a){return oi(Ug)(a)})),a}function _(a){var b;return"y"===a?b=fh:"y2"===a?b=oh:"x"===a&&(b=ah),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?fh=b:"y2"===a?oh=b:"x"===a&&(ah=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Pg?"inner-top":"inner-right")}function eb(){return cb("y",Pg?"inner-right":"inner-top")}function fb(){return cb("y2",Pg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?Ff/2:Ff:b.isBottom?-Hf:b.isMiddle?-Hf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Pg,db())}function ob(){return kb(Pg,eb())}function pb(){return kb(Pg,fb())}function qb(){return lb(!Pg,db())}function rb(){return lb(Pg,eb())}function sb(){return lb(Pg,fb())}function tb(){var a=db();return Pg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Pg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Pg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Pg,db())}function xb(){return mb(Pg,eb())}function yb(){return mb(Pg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Li.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Li.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Li.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return mf.min(Object.keys(i).map(function(a){return mf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(og.length>0)for(g=Nc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return mf.max(Object.keys(i).map(function(a){return mf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?mh:dh,n="y2"===c?lh:ch,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?nh:eh,r=pd()&&Pg;return 0===l.length?"y2"===c?ag.domain():_f.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=qd(o,p),j=$b(_f.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&ih&&(f=b(ih.top)?ih.top:e,g=b(ih.bottom)?ih.bottom:e),"y2"===c&&rh&&(f=b(rh.top)?rh.top:e,g=b(rh.bottom)?rh.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Qi),c=$b($f.domain());return a||0===c?1:b/c}function Wb(a){return $g?$g:mf.min(a,function(a){return mf.min(a.values,function(a){return a.x})})}function Xb(a){return Zg?Zg:mf.max(a,function(a){return mf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return gi?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=0,g=0;return(c||0===c)&&(f=fi?new Date(c.getTime()-e):c-e),(d||0===d)&&(g=fi?new Date(d.getTime()+e):d+e),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return ig&&a===ig||ne(jg)&&oe(jg,a)}function fc(a){return!ec(a)}function gc(a){return ig?ig:ne(jg)?jg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=nf.data.xs[b])}),c}function ic(a,b){return a in nf.data.xs&&nf.data.xs[a]&&nf.data.xs[a][b]?nf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){jg[b]=a[b]})}function kc(a){return 1===mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=mg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),nf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=fi?a?a instanceof Date?a:ie(a):ie(ic(b,c)):hi&&!gi?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):ig?(d=Object.keys(nf.data.xs),nf.data.xs[c]=d.length>0?nf.data.xs[d[0]]:void 0):ne(jg)&&(nf.data.xs[c]=hc(f,nf.data.targets)):nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=lg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return hi&&gi&&0===c&&g&&(0===e&&(Sg=[]),Sg.push(g)),("undefined"==typeof a[b]||nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),qg&&Sd(xc(c).filter(function(a){return!(a in rg)}),qg),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function tc(a){return a>0&&nf.data.targets[0].values[a-1]?nf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?nf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?nf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(nf.data.targets)}function zc(a,b){var c,d=xc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(fi?new Date(h):h);i.push(d)}return fi||(i=i.sort()),i}function Gc(a){qi=qi.concat(a)}function Hc(a){qi=qi.filter(function(b){return a.indexOf(b)<0})}function Ic(a){ri=ri.concat(a)}function Jc(a){ri=ri.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Ed(){return tg&&"desc"===tg.toLowerCase()}function Fd(){return tg&&"asc"===tg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof tg&&a.sort(tg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(nf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Uh&&0!==m.length&&(Oi.html(Xh(a,$(),l,ni)).style("display","block"),d=Oi.property("offsetWidth"),e=Oi.property("offsetHeight"),k?(g=Ff/2+c[0],i=Hf/2+c[1]+20):(Pg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=$f(m[0].x)+20):(f=q(),g=f+t()+$f(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Oi.style("top",i+"px").style("left",g+"px"))}function Id(){Oi.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Uh&&(Vd(nf.data.targets)||Yd(nf.data.targets)||Li.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Pg?"y1":"x1",ud).attr(Pg?"y2":"x2",ud))}function Kd(){Li.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?$f(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Gh?Gh:b?2*a.tickOffset()*Hh/b:0}function Sd(a,b){yc(a).forEach(function(a){Si[a]=b===rg[a],rg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){rg[a.id]===b&&(c=!0),a.id in rg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in rg)||"line"===rg[b]||"spline"===rg[b]||"area"===rg[b]||"area-spline"===rg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===rg[b]||"area-spline"===rg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===rg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===rg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===rg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===rg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ie(b){var c;try{c=kg?mf.time.format(kg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+kg)}return c}function je(a,b){var c=mf.mouse(a),d=mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?_f:ag,d=Pg?1:0,e=Pg?0:1;return Math.pow($f(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Eg(b,a.node()),Li.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Pg?Md:Ld).attr("cy",Pg?Ld:Md).attr("stroke",function(){return ni(b)}).attr("r",1.4*Eh).transition().duration(100).attr("r",Eh)}function se(a,b,c){Fg(b,a.node()),Li.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Eg(b,a.node()),a.transition().duration(100).style("fill",function(){return mf.rgb(ni(b)).darker(1)})}function ve(a,b){Fg(b,a.node()),a.transition().duration(100).style("fill",function(){return ni(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Li.selectAll("."+f.circles+gd(c)):Li).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",Dh)}function Ae(a){ye(a).filter(function(){return mf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Ah)}function Be(a){return Li.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Pg?1:0,f=Pg?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Pg?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBoundingClientRect();return Pg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(eg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Pg&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Je(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function Ke(b){var c,d,e;if(Pi=mf.select(pf),Pi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Pi.html(""),Pi.classed("c3",!0),nf.data.xs={},nf.data.targets=rc(b),n(),R(),$f.domain(mf.extent(Zb(nf.data.targets))),_f.domain(Ub(nf.data.targets,"y")),ag.domain(Ub(nf.data.targets,"y2")),bg.domain($f.domain()),cg.domain(_f.domain()),dg.domain(ag.domain()),Qi=$f.domain(),Ei.scale(bg),uf&&Ii.scale($f),Ji=Pi.append("svg").attr("width",Ff+Cf.left+Cf.right).attr("height",Hf+Cf.top+Cf.bottom).on("mouseenter",xf).on("mouseleave",yf),Ki=Ji.append("defs"),Ki.append("clipPath").attr("id",_h).append("rect").attr("width",Ff).attr("height",Hf),Ki.append("clipPath").attr("id",ai).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Ki.append("clipPath").attr("id",bi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Li=Ji.append("g").attr("transform",wi.main),Mi=Ig?Ji.append("g").attr("transform",wi.context):null,Ni=Ji.append("g").attr("transform",wi.legend),Lg||(Ni.style("visibility","hidden"),ri=xc(nf.data.targets)),Oi=mf.select(pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),gf(xc(nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Li.append("g").attr("class",f.axisX).attr("clip-path",Pg?"":di).attr("transform",wi.x).append("text").attr("class",f.axisXLabel).attr("transform",Pg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),bh&&Li.append("g").attr("class",f.axisY).attr("clip-path",Pg?ei:"").attr("transform",wi.y).append("text").attr("class",f.axisYLabel).attr("transform",Pg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),kh&&Li.append("g").attr("class",f.axisY2).attr("transform",wi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Pg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Li.append("g").attr("clip-path",ci).attr("class",f.grid),th&&d.append("g").attr("class",f.xgrids),ne(vh)&&d.append("g").attr("class",f.xgridLines),Bh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),wh&&d.append("g").attr("class",f.ygrids),ne(xh)&&d.append("g").attr("class",f.ygridLines),Li.append("g").attr("clip-path",ci).attr("class",f.regions),Li.append("g").attr("clip-path",ci).attr("class",f.chart),c=Li.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",uf?Pg?"ns-resize":"ew-resize":null),Li.select("."+f.chart).append("g").attr("class",f.chartBars),Li.select("."+f.chart).append("g").attr("class",f.chartLines),Li.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",wi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Li.select("."+f.chart).append("g").attr("class",f.chartTexts),uf&&Li.insert("rect",wf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Ff).attr("height",Hf).style("opacity",0).style("cursor",Pg?"ns-resize":"ew-resize").call(Ii).on("dblclick.zoom",null),_g&&Ei.extent("function"!=typeof _g?_g:_g(Zb())),Ig&&(Mi.append("g").attr("clip-path",ci).attr("class",f.chart),Mi.select("."+f.chart).append("g").attr("class",f.chartBars),Mi.select("."+f.chart).append("g").attr("class",f.chartLines),Mi.append("g").attr("clip-path",ci).attr("class",f.brush).call(Ei).selectAll("rect").attr(Pg?"width":"height",Pg?Gf:If),Mi.append("g").attr("class",f.axisX).attr("transform",wi.subx).attr("clip-path",Pg?"":di)),Xe(nf.data.targets),Pg?Li.select("."+f.axisX).style("opacity",0).call(eg):(Li.select("."+f.axisY).style("opacity",0).call(fg),Li.select("."+f.axisY2).style("opacity",0).call(gg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Yh){if(fi&&"string"==typeof Zh){for(Zh=ie(Zh),e=0;eFf&&(Ff=0),0>Hf&&(Hf=0),Df={top:Pg?Cf.top:Kf-Jg-(xi?0:a),right:0/0,bottom:20+(xi?0:a),left:Pg?Bi:Cf.left},Gf=Pg?Cf.left-Bi-Ci:Ff,If=Pg?Hf:Kf-Df.top-Df.bottom,0>Gf&&(Gf=0),0>If&&(If=0),Ef={top:xi?0:Kf-a,right:0/0,bottom:0,left:xi?Jf-b:0},p(),xi&&Yd(nf.data.targets)&&(Ef.left=Ff/2+Mf)}function o(){Li.select("line."+f.xgridFocus).attr("x1",Pg?0:-10).attr("x2",Pg?Ff:-10).attr("y1",Pg?-10:Cf.top).attr("y2",Pg?-10:Hf)}function p(){Mf=Hf/2,Lf=.95*Mf,Nf=Xd(nf.data.targets)?.6*Lf:0}function q(){var a=Pg?f.axisX:f.axisY,b=mf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=mf.select(pf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return qf?qf:x()}function s(){var a=rf?rf:y();return a>0?a:320}function t(){return Yd(nf.data.targets)?0:sf?sf:Pg||!bh||gh?1:v("y")}function u(){var a=1;return Yd(nf.data.targets)?0:tf?tf:xi?P()+(kh&&!Pg?v("y2"):a):kh?ph||Pg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||bh?"y2"!==a||kh?(gb(a).isInner?30:40)+("y2"===a?-10:0):Di:Lg&&!xi?10:1}function x(){return+mf.select(pf).style("width").replace("px","")}function y(){return+mf.select(pf).style("height").replace("px","")}function z(a){return a?-5:-(Cf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Pg)}function C(){return A(!Pg)}function D(){return z(Pg)}function E(){return A(Pg)}function F(a){return a?Ff+2+4:Cf.left+20}function G(a){return a?80:Hf+2}function H(){return F(!Pg)}function I(){return G(!Pg)}function J(){return F(Pg)}function K(){return G(Pg)}function L(){var a=Pg?Hf:Ff,b=vc(),c=Vb()*(Ud(nf.data.targets)?(b-(gi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){yi=a}function N(a){zi=a}function O(a){Ai=a}function P(){return Lg?xi?zi*(yi+1):Jf:0}function Q(){return Lg?xi?Kf:Ai*(yi+1):0}function R(){var a,b=!$f;Sf=Pg?1:0,Tf=Pg?Hf:Ff,Uf=Pg?0:Hf,Vf=Pg?Ff:1,Wf=Sf,Xf=Tf,Yf=Pg?0:If,Zf=Pg?Gf:1,$f=T(Sf,Tf,b?void 0:$f.domain(),function(){return eg.tickOffset()}),_f=U(Uf,Vf),ag=U(Uf,Vf),bg=T(Sf,Tf,Qi,function(a){return a%1?0:hg.tickOffset()}),cg=U(Yf,Zf),dg=U(Yf,Zf),a=$(),eg=X($f,si,a),hg=X(bg,vi,a),fg=Y(_f,ti,hh,jh),gg=Y(ag,ui,qh,sh),b||(Ei.scale(bg),uf&&Ii.scale($f)),S()}function S(){Of=Db(),Pf=Eb(),Qf=Eb(.98)}function T(a,b,e,f){var g=(fi?mf.time.scale():mf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),gi){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return mf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?ag:_f}function W(a){return"y2"===Z(a)?dg:cg}function X(a,b,c){var d=(gi?Bb():mf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),gi?d.tickCentered(Tg):d.tickOffset=function(){var a=Pg?Hf:Ff;return a*Vb()/vc()/2},gi&&d.categories(Sg),d}function Y(a,b,c,d){return mf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in pg?pg[a]:"y"}function $(){var a=fi?pi:gi?Oc:function(a){return 0>a?a.toFixed(0):a};return Ug&&("function"==typeof Ug?a=Ug:fi&&(a=function(a){return oi(Ug)(a)})),a}function _(a){var b;return"y"===a?b=fh:"y2"===a?b=oh:"x"===a&&(b=ah),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?fh=b:"y2"===a?oh=b:"x"===a&&(ah=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Pg?"inner-top":"inner-right")}function eb(){return cb("y",Pg?"inner-right":"inner-top")}function fb(){return cb("y2",Pg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?Ff/2:Ff:b.isBottom?-Hf:b.isMiddle?-Hf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Pg,db())}function ob(){return kb(Pg,eb())}function pb(){return kb(Pg,fb())}function qb(){return lb(!Pg,db())}function rb(){return lb(Pg,eb())}function sb(){return lb(Pg,fb())}function tb(){var a=db();return Pg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Pg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Pg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Pg,db())}function xb(){return mb(Pg,eb())}function yb(){return mb(Pg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Li.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Li.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Li.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return mf.min(Object.keys(i).map(function(a){return mf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(og.length>0)for(g=Nc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return mf.max(Object.keys(i).map(function(a){return mf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?mh:dh,n="y2"===c?lh:ch,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?nh:eh,r=pd()&&Pg;return 0===l.length?"y2"===c?ag.domain():_f.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=qd(o,p),j=$b(_f.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&ih&&(f=b(ih.top)?ih.top:e,g=b(ih.bottom)?ih.bottom:e),"y2"===c&&rh&&(f=b(rh.top)?rh.top:e,g=b(rh.bottom)?rh.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Qi),c=$b($f.domain());return a||0===c?1:b/c}function Wb(a){return $g?$g:mf.min(a,function(a){return mf.min(a.values,function(a){return a.x})})}function Xb(a){return Zg?Zg:mf.max(a,function(a){return mf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return gi?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=0,g=0;return(c||0===c)&&(f=fi?new Date(c.getTime()-e):c-e),(d||0===d)&&(g=fi?new Date(d.getTime()+e):d+e),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return ig&&a===ig||ne(jg)&&oe(jg,a)}function fc(a){return!ec(a)}function gc(a){return ig?ig:ne(jg)?jg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=nf.data.xs[b])}),c}function ic(a,b){return a in nf.data.xs&&nf.data.xs[a]&&nf.data.xs[a][b]?nf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){jg[b]=a[b]})}function kc(a){return 1===mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=mg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),nf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=fi?a?a instanceof Date?a:ie(a):ie(ic(b,c)):hi&&!gi?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):ig?(d=Object.keys(nf.data.xs),nf.data.xs[c]=d.length>0?nf.data.xs[d[0]]:void 0):ne(jg)&&(nf.data.xs[c]=hc(f,nf.data.targets)):nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=lg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return hi&&gi&&0===c&&g&&(0===e&&(Sg=[]),Sg.push(g)),("undefined"==typeof a[b]||nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),qg&&Sd(xc(c).filter(function(a){return!(a in rg)}),qg),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function tc(a){return a>0&&nf.data.targets[0].values[a-1]?nf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?nf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?nf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(nf.data.targets)}function zc(a,b){var c,d=xc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(fi?new Date(h):h);i.push(d)}return fi||(i=i.sort(function(a,b){return a-b})),i}function Gc(a){qi=qi.concat(a)}function Hc(a){qi=qi.filter(function(b){return a.indexOf(b)<0})}function Ic(a){ri=ri.concat(a)}function Jc(a){ri=ri.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Ed(){return tg&&"desc"===tg.toLowerCase()}function Fd(){return tg&&"asc"===tg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof tg&&a.sort(tg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(nf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Uh&&0!==m.length&&(Oi.html(Xh(a,$(),l,ni)).style("display","block"),d=Oi.property("offsetWidth"),e=Oi.property("offsetHeight"),k?(g=Ff/2+c[0],i=Hf/2+c[1]+20):(Pg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=$f(m[0].x)+20):(f=q(),g=f+t()+$f(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Oi.style("top",i+"px").style("left",g+"px"))}function Id(){Oi.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Uh&&(Vd(nf.data.targets)||Yd(nf.data.targets)||Li.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Pg?"y1":"x1",ud).attr(Pg?"y2":"x2",ud))}function Kd(){Li.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?$f(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Gh?Gh:b?2*a.tickOffset()*Hh/b:0}function Sd(a,b){yc(a).forEach(function(a){Si[a]=b===rg[a],rg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){rg[a.id]===b&&(c=!0),a.id in rg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in rg)||"line"===rg[b]||"spline"===rg[b]||"area"===rg[b]||"area-spline"===rg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===rg[b]||"area-spline"===rg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===rg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===rg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===rg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===rg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ie(b){var c;try{c=kg?mf.time.format(kg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+kg)}return c}function je(a,b){var c=mf.mouse(a),d=mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?_f:ag,d=Pg?1:0,e=Pg?0:1;return Math.pow($f(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Eg(b,a.node()),Li.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Pg?Md:Ld).attr("cy",Pg?Ld:Md).attr("stroke",function(){return ni(b)}).attr("r",1.4*Eh).transition().duration(100).attr("r",Eh)}function se(a,b,c){Fg(b,a.node()),Li.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Eg(b,a.node()),a.transition().duration(100).style("fill",function(){return mf.rgb(ni(b)).darker(1)})}function ve(a,b){Fg(b,a.node()),a.transition().duration(100).style("fill",function(){return ni(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Li.selectAll("."+f.circles+gd(c)):Li).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",Dh)}function Ae(a){ye(a).filter(function(){return mf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Ah)}function Be(a){return Li.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Pg?1:0,f=Pg?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Pg?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBoundingClientRect();return Pg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(eg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Pg&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Je(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function Ke(b){var c,d,e;if(Pi=mf.select(pf),Pi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Pi.html(""),Pi.classed("c3",!0),nf.data.xs={},nf.data.targets=rc(b),n(),R(),$f.domain(mf.extent(Zb(nf.data.targets))),_f.domain(Ub(nf.data.targets,"y")),ag.domain(Ub(nf.data.targets,"y2")),bg.domain($f.domain()),cg.domain(_f.domain()),dg.domain(ag.domain()),Qi=$f.domain(),Ei.scale(bg),uf&&Ii.scale($f),Ji=Pi.append("svg").attr("width",Ff+Cf.left+Cf.right).attr("height",Hf+Cf.top+Cf.bottom).on("mouseenter",xf).on("mouseleave",yf),Ki=Ji.append("defs"),Ki.append("clipPath").attr("id",_h).append("rect").attr("width",Ff).attr("height",Hf),Ki.append("clipPath").attr("id",ai).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Ki.append("clipPath").attr("id",bi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Li=Ji.append("g").attr("transform",wi.main),Mi=Ig?Ji.append("g").attr("transform",wi.context):null,Ni=Ji.append("g").attr("transform",wi.legend),Lg||(Ni.style("visibility","hidden"),ri=xc(nf.data.targets)),Oi=mf.select(pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),gf(xc(nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Li.append("g").attr("class",f.axisX).attr("clip-path",Pg?"":di).attr("transform",wi.x).append("text").attr("class",f.axisXLabel).attr("transform",Pg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),bh&&Li.append("g").attr("class",f.axisY).attr("clip-path",Pg?ei:"").attr("transform",wi.y).append("text").attr("class",f.axisYLabel).attr("transform",Pg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),kh&&Li.append("g").attr("class",f.axisY2).attr("transform",wi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Pg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Li.append("g").attr("clip-path",ci).attr("class",f.grid),th&&d.append("g").attr("class",f.xgrids),ne(vh)&&d.append("g").attr("class",f.xgridLines),Bh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),wh&&d.append("g").attr("class",f.ygrids),ne(xh)&&d.append("g").attr("class",f.ygridLines),Li.append("g").attr("clip-path",ci).attr("class",f.regions),Li.append("g").attr("clip-path",ci).attr("class",f.chart),c=Li.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",uf?Pg?"ns-resize":"ew-resize":null),Li.select("."+f.chart).append("g").attr("class",f.chartBars),Li.select("."+f.chart).append("g").attr("class",f.chartLines),Li.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",wi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Li.select("."+f.chart).append("g").attr("class",f.chartTexts),uf&&Li.insert("rect",wf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Ff).attr("height",Hf).style("opacity",0).style("cursor",Pg?"ns-resize":"ew-resize").call(Ii).on("dblclick.zoom",null),_g&&Ei.extent("function"!=typeof _g?_g:_g(Zb())),Ig&&(Mi.append("g").attr("clip-path",ci).attr("class",f.chart),Mi.select("."+f.chart).append("g").attr("class",f.chartBars),Mi.select("."+f.chart).append("g").attr("class",f.chartLines),Mi.append("g").attr("clip-path",ci).attr("class",f.brush).call(Ei).selectAll("rect").attr(Pg?"width":"height",Pg?Gf:If),Mi.append("g").attr("class",f.axisX).attr("transform",wi.subx).attr("clip-path",Pg?"":di)),Xe(nf.data.targets),Pg?Li.select("."+f.axisX).style("opacity",0).call(eg):(Li.select("."+f.axisY).style("opacity",0).call(fg),Li.select("."+f.axisY2).style("opacity",0).call(gg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Yh){if(fi&&"string"==typeof Zh){for(Zh=ie(Zh),e=0;e0){d=[];for(var g in mg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function Pe(a){Yd(nf.data.targets)||xg&&(ii=a,Li.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),ji=!0,Gg())}function Qe(){Yd(nf.data.targets)||xg&&(Li.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Li.selectAll("."+f.shape).classed(f.INCLUDED,!1),ji=!1,Hg())}function Re(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Nd(),U=Yd(nf.data.targets),V=Dc(nf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?Bf:0,O=B?N:0,P=C?N:0,H&&Lg&&gf(xc(nf.data.targets),a),G&&($f.domain(mf.extent(Zb(V))),Qi=$f.domain(),uf&&Ii.scale($f).updateScaleExtent(),bg.domain($f.domain()),Ei.scale(bg)),F&&($f.domain(Ei.empty()?Qi:Ei.extent()),uf&&Ii.scale($f).updateScaleExtent()),_f.domain(Ub(V,"y")),ag.domain(Ub(V,"y2")),Vd(V)||(Q=Fc(Ec(V)),eg.tickValues(Q),hg.tickValues(Q)),c=Li.select("."+f.axisX).style("opacity",U?0:1),(Pg||D)&&(c=c.transition().duration(P)),c.call(eg),e=Li.select("."+f.axisY).style("opacity",U?0:1),(!Pg||D)&&(e=e.transition().duration(P)),e.call(fg),Li.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(gg),F&&Vg&&Q){for(R=1;R0&&mf.select(this).style("display",b%S?"none":"block")})}if(I=Ee(T),K=Fe(T,!0),M=Fe(T,!1),Ab(),cg.domain(_f.domain()),dg.domain(ag.domain()),Oi.style("display","none"),o(),Li.select("line."+f.xgridFocus).style("visibility","hidden"),th){if("year"===uh){h=[];for(var W=Zb(),X=W[0].getFullYear(),Y=W[1].getFullYear(),Z=X;Y>=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=$f.ticks(10);g=Li.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Pg?0:function(a){return $f(a)-eg.tickOffset()}).attr("x2",Pg?Ff:function(a){return $f(a)-eg.tickOffset()}).attr("y1",Pg?function(a){return $f(a)-eg.tickOffset()}:Cf.top).attr("y2",Pg?function(a){return $f(a)-eg.tickOffset()}:Hf).style("opacity",function(){return+mf.select(this).attr(Pg?"y1":"x1")===(Pg?Hf:0)?0:1}),g.exit().remove()}ne(vh)&&(i=Li.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(vh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Pg?"":"rotate(-90)").attr("dx",Pg?0:-Cf.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Pg?0:vd).attr("x2",Pg?Ff:vd).attr("y1",Pg?vd:Cf.top).attr("y2",Pg?vd:Hf).style("opacity",1),i.select("text").transition().duration(N).attr("x",Pg?Ff:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&wh&&(k=Li.select("."+f.ygrids).selectAll("."+f.ygrid).data(_f.ticks(yh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Pg?_f:0).attr("x2",Pg?_f:Ff).attr("y1",Pg?0:_f).attr("y2",Pg?Hf:_f),k.exit().remove()),y&&ne(xh)&&(l=Li.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(xh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Pg?"rotate(-90)":"").attr("dx",Pg?0:-Cf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Pg?wd:0).attr("x2",Pg?wd:Ff).attr("y1",Pg?0:wd).attr("y2",Pg?Hf:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Pg?0:Ff).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Li.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ni(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Li.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Pg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Li.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Fi).style("opacity",1),Li.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Gi).style("opacity",Ri),n=Li.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",Ah),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Pg?Md:Ld).attr("cy",Pg?Ld:Md),n.exit().remove(),Li.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=mf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Li.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Li.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Ig&&(null!==mf.event&&"zoom"===mf.event.type&&Ei.extent($f.orgDomain()).update(),z&&(Mi.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(hg),Ei.empty()||Ei.extent($f.orgDomain()).update(),J=Ee(T,!0),s=Mi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ni(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Mi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Hi).style("opacity",1))),Li.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Li.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Pg?Md:Ld).attr("cy",Pg?Ld:Md),t=Li.select("."+f.eventRects),ne(jg)&&!kc(jg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Li.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Ff).attr("height",Hf)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),hi&&!gi?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return($f(d?d:e+50)-$f(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return($f(d)+$f(c?c:d-50))/2}):(x=L(),w=function(a){return $f(a.x)-x/2}),v=wc(),Li.select("."+f.eventRects).datum(v?v.values:[]),u=Li.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Pg?0:w).attr("y",Pg?w:0).attr("width",Pg?Ff:x).attr("height",Pg?x:Hf),u.exit().remove()),q=Li.select("."+f.regions).selectAll("rect."+f.region).data(Th),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Pg?0:cc).attr("y",Pg?cc:Cf.top).attr("width",Pg?Ff:dc).attr("height",Pg?dc:Hf).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),xc(nf.data.targets).forEach(function(a){Si[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Ii.altDomain?($f.domain(Ii.altDomain),void Ii.scale($f).updateScaleExtent()):(gi&&$f.orgDomain()[0]===Qi[0]&&$f.domain([Qi[0]-1e-10,$f.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(ki=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Ji.attr("width",Jf).attr("height",Kf),Ji.select("#"+_h).select("rect").attr("width",Ff).attr("height",Hf),Ji.select("#"+ai).select("rect").attr("width",H),Ji.select("#"+bi).select("rect").attr("width",J),Ji.select("."+f.zoomRect).attr("width",Ff).attr("height",Hf)}function We(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Li.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ni(a)}),e=Li.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ni(a)}).style("stroke","none").style("cursor",function(a){return zg(a)?"pointer":null}),c=Li.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ni(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Ri=+mf.select(this).style("opacity"),0}).style("fill",function(a){return ni(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ni(a)}).style("cursor",function(a){return zg(a)?"pointer":null}),a.forEach(function(a){Li.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Li.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Rf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ni(a.data)}).style("cursor",function(a){return zg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Ig&&(n=Mi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ni(a)}),l=Mi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ni(a)})),Ji.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=xi?j:i,l=xi?Q():P();return d&&(w=0,C=0,t=0,u=0),Lg&&!Cc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=xi?u:t,void(Og?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,xi?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Ni.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Ng?Ng(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(mg[a])?mg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",xi?g:-200).attr("y",xi?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",xi?h:-200).attr("y",xi?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return ni(a)}).attr("x",xi?g:-200).attr("y",xi?-200:i).attr("width",10).attr("height",10),Ni.selectAll("text").data(a).text(function(a){return d(mg[a])?mg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ni.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ni.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["onresize"],function(){}),Af=h(["onresized"],function(){}),Bf=h(["transition","duration"],350);g("data","data is required in config");var Cf,Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig=h(["data","x"]),jg=h(["data","xs"],{}),kg=h(["data","x_format"]),lg=h(["data","id_converter"],function(a){return a}),mg=h(["data","names"],{}),ng=h(["data","classes"],{}),og=h(["data","groups"],[]),pg=h(["data","axes"],{}),qg=h(["data","type"]),rg=h(["data","types"],{}),sg=h(["data","labels"],{}),tg=h(["data","order"]),ug=h(["data","regions"],{}),vg=h(["data","color"]),wg=h(["data","colors"],{}),xg=h(["data","selection","enabled"],!1),yg=h(["data","selection","grouped"],!1),zg=h(["data","selection","isselectable"],function(){return!0}),Ag=h(["data","selection","multiple"],!0),Bg=h(["data","onclick"],function(){}),Cg=h(["data","onenter"],function(){}),Dg=h(["data","onleave"],function(){}),Eg=h(["data","onselected"],function(){}),Fg=h(["data","onunselected"],function(){}),Gg=h(["data","ondragstart"],function(){}),Hg=h(["data","ondragend"],function(){}),Ig=h(["subchart","show"],!1),Jg=Ig?h(["subchart","size","height"],60):0,Kg=h(["color","pattern"],[]),Lg=h(["legend","show"],!0),Mg=h(["legend","position"],"bottom"),Ng=h(["legend","item","onclick"]),Og=h(["legend","equally"],!1),Pg=h(["axis","rotated"],!1),Qg=h(["axis","x","type"],"indexed"),Rg=h(["axis","x","localtime"],!1),Sg=h(["axis","x","categories"],[]),Tg=h(["axis","x","tick","centered"],!1),Ug=h(["axis","x","tick","format"]),Vg=h(["axis","x","tick","culling"],{}),Wg=h(["axis","x","tick","culling","max"],"categorized"===Qg?1/0:10),Xg=h(["axis","x","tick","count"]),Yg=h(["axis","x","tick","fit"],!1),Zg=h(["axis","x","max"]),$g=h(["axis","x","min"]),_g=h(["axis","x","default"]),ah=h(["axis","x","label"],{}),bh=h(["axis","y","show"],!0),ch=h(["axis","y","max"]),dh=h(["axis","y","min"]),eh=h(["axis","y","center"]),fh=h(["axis","y","label"],{}),gh=h(["axis","y","inner"],!1),hh=h(["axis","y","tick","format"]),ih=h(["axis","y","padding"],{}),jh=h(["axis","y","ticks"],10),kh=h(["axis","y2","show"],!1),lh=h(["axis","y2","max"]),mh=h(["axis","y2","min"]),nh=h(["axis","y2","center"]),oh=h(["axis","y2","label"],{}),ph=h(["axis","y2","inner"],!1),qh=h(["axis","y2","tick","format"]),rh=h(["axis","y2","padding"],{}),sh=h(["axis","y2","ticks"],10),th=h(["grid","x","show"],!1),uh=h(["grid","x","type"],"tick"),vh=h(["grid","x","lines"],[]),wh=h(["grid","y","show"],!1),xh=h(["grid","y","lines"],[]),yh=h(["grid","y","ticks"],10),zh=h(["point","show"],!0),Ah=zh?h(["point","r"],2.5):0,Bh=h(["point","focus","line","enabled"],!0),Ch=h(["point","focus","expand","enabled"],!0),Dh=h(["point","focus","expand","r"],Ch?4:Ah),Eh=h(["point","focus","select","r"],8),Fh=h(["line","connect_null"],!1),Gh=h(["bar","width"]),Hh=h(["bar","width","ratio"],.6),Ih=h(["pie","label","show"],!0),Jh=h(["pie","label","format"]),Kh=h(["pie","onclick"],function(){}),Lh=h(["pie","onmouseover"],function(){}),Mh=h(["pie","onmouseout"],function(){}),Nh=h(["donut","label","show"],!0),Oh=h(["donut","label","format"]),Ph=h(["donut","title"],""),Qh=h(["donut","onclick"],function(){}),Rh=h(["donut","onmouseover"],function(){}),Sh=h(["donut","onmouseout"],function(){}),Th=h(["regions"],[]),Uh=h(["tooltip","show"],!0),Vh=h(["tooltip","format","title"]),Wh=h(["tooltip","format","value"]),Xh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Vh?Vh:b,l=Wh?Wh:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Yh=h(["tooltip","init","show"],!1),Zh=h(["tooltip","init","x"],0),$h=h(["tooltip","init","position"],{top:"0px",left:"50px"}),_h=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",ai=_h+"-xaxis",bi=_h+"-yaxis",ci=i(_h),di=i(ai),ei=i(bi),fi="timeseries"===Qg,gi="categorized"===Qg,hi=!fi&&(ig||ne(jg)),ii=null,ji=!1,ki=!1,li=!1,mi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ni=he(wg,ne(Kg)?Kg:mi,vg),oi=Rg?mf.time.format:mf.time.format.utc,pi=function(){var a=[[oi("%Y/%-m/%-d"),function(){return!0}],[oi("%-m/%-d"),function(a){return a.getMonth()}],[oi("%-m/%-d"),function(a){return 1!==a.getDate()}],[oi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[oi("%I %p"),function(a){return a.getHours()}],[oi("%I:%M"),function(a){return a.getMinutes()}],[oi(":%S"),function(a){return a.getSeconds()}],[oi(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),qi=[],ri=[],si=Pg?"left":"bottom",ti=Pg?gh?"top":"bottom":gh?"right":"left",ui=Pg?ph?"bottom":"top":ph?"left":"right",vi=Pg?"left":"bottom",wi={main:function(){return"translate("+Cf.left+","+Cf.top+")"},context:function(){return"translate("+Df.left+","+Df.top+")"},legend:function(){return"translate("+Ef.left+","+Ef.top+")"},x:function(){return"translate(0,"+(Pg?0:Hf)+")"},y:function(){return"translate(0,"+(Pg?Hf:0)+")"},y2:function(){return"translate("+(Pg?0:Ff)+","+(Pg?1:0)+")"},subx:function(){return"translate(0,"+(Pg?0:If)+")"},arc:function(){return"translate("+Ff/2+","+Hf/2+")"}},xi="right"===Mg,yi=0,zi=0,Ai=0,Bi=30,Ci=30,Di=5;Rf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Ei,Fi=function(){var a=mf.svg.line().x(Pg?function(a){return V(a.id)(a.value)}:ud).y(Pg?ud:function(a){return V(a.id)(a.value)});return Fh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Fh?xe(b.values):b.values;return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),ug[b.id]?Je(e,$f,V(b.id),ug[b.id]):a(e)):(c=e[0]?$f(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Pg?"M "+d+" "+c:"M "+c+" "+d)}}(),Gi=function(){var a;return a=Pg?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?$f(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Pg?"M "+d+" "+c:"M "+c+" "+d)}}(),Hi=function(){var a=mf.svg.line().x(Pg?function(a){return W(a.id)(a.value)}:xd).y(Pg?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+bg(c[0].x)+" "+W(b.id)(c[0].value)}}(),Ii=function(){};Ei=mf.svg.brush().on("brush",Se),Ei.update=function(){return Mi&&Mi.select("."+f.brush).call(this),this},Ei.scale=function(a){return Pg?this.y(a):this.x(a)},uf&&(Ii=mf.behavior.zoom().on("zoomstart",function(){Ii.altDomain=mf.event.sourceEvent.altKey?$f.orgDomain():null}).on("zoom",uf?Te:null),Ii.scale=function(a){return Pg?this.y(a):this.x(a)},Ii.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Ii.updateScaleExtent=function(){var a=$b($f.orgDomain())/$b(Qi),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Ji,Ki,Li,Mi,Ni,Oi,Pi,Qi,Ri,Si={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ji.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Ji.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ji.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Ji.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Ni.selectAll(kd(a)).classed(f.legendItemHidden,!1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Ji.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Ni.selectAll(kd(a)).classed(f.legendItemHidden,!0),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){Ei.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){ng[b]=a.classes[b]}),"categories"in a&&gi&&(Sg=a.categories,eg.categories(Sg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Li.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){xg&&Li.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=yg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?zg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){xg&&Li.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=yg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&zg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?og:(og=a,Re(),og)},nf.xgrids=function(a){return a?(vh=a,Re(),vh):vh},nf.xgrids.add=function(a){return a?nf.xgrids(vh.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(vh.filter(b))},nf.ygrids=function(a){return a?(xh=a,Re(),xh):xh},nf.ygrids.add=function(a){return a?nf.ygrids(xh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(xh.filter(b))},nf.regions=function(a){return c(a)?Th:(Th=a,Re(),Th)},nf.regions.add=function(a){return c(a)?Th:(Th=Th.concat(a),Re(),Th)},nf.regions.remove=function(a,c){var e=[].concat(a);return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;Ji.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Th=Th.filter(function(b){return b.classes.indexOf(a)<0})}),Th},nf.data.get=function(a){var b=nf.data.getAsTarget(a); return d(b)?b.values.map(function(a){return a.value}):void 0},nf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){mg[b]=a[b]}),gf(xc(nf.data.targets),{withTransition:!0}),mg):mg},nf.x=function(a){return arguments.length&&(mc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.xs=function(a){return arguments.length&&(nc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(ch=+a.y),b(a.y2)&&(lh=+a.y2)):ch=lh=+a,Re())},nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(dh=+a.y),b(a.y2)&&(mh=+a.y2)):dh=mh=+a,Re())},nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&nf.axis.max(a.max),"undefined"!=typeof a.min&&nf.axis.min(a.min))},nf.legend.show=function(a){Lg||(Lg=!0,Ni.style("visibility","visible")),ef(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.legend.hide=function(a){Lg&&me(a)&&(Lg=!1,Ni.style("visibility","hidden")),ff(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.resize=function(a){qf=a?a.width:null,rf=a?a.height:null,We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},nf.destroy=function(){nf.data.targets=void 0,nf.data.xs={},Pi.html(""),a.onresize=null},"url"in e.data)mf.xhr(e.data.url,function(a,b){var c,d=mf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=mf.csv.parse(b.response),Ke(c)});else if("rows"in e.data)Ke(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ke(qc(e.data.columns))}return nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 533ce17e1cc06c93dcaa277a5c68ff220464013e Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Sat, 12 Apr 2014 22:44:21 +0900 Subject: [PATCH 040/178] Fix tick culling on categorized axis and add axis.x.tick.values option - #149 --- c3.js | 42 +++++++++++++++++++++++------------------- c3.min.js | 6 +++--- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/c3.js b/c3.js index c8073d0..ae985d7 100644 --- a/c3.js +++ b/c3.js @@ -170,9 +170,10 @@ __axis_x_tick_centered = getConfig(['axis', 'x', 'tick', 'centered'], false), __axis_x_tick_format = getConfig(['axis', 'x', 'tick', 'format']), __axis_x_tick_culling = getConfig(['axis', 'x', 'tick', 'culling'], {}), - __axis_x_tick_culling_max = getConfig(['axis', 'x', 'tick', 'culling', 'max'], __axis_x_type === 'categorized' ? Infinity : 10), + __axis_x_tick_culling_max = getConfig(['axis', 'x', 'tick', 'culling', 'max'], 10), __axis_x_tick_count = getConfig(['axis', 'x', 'tick', 'count']), __axis_x_tick_fit = getConfig(['axis', 'x', 'tick', 'fit'], false), + __axis_x_tick_values = getConfig(['axis', 'x', 'tick', 'values'], []), __axis_x_max = getConfig(['axis', 'x', 'max']), __axis_x_min = getConfig(['axis', 'x', 'min']), __axis_x_default = getConfig(['axis', 'x', 'default']), @@ -621,6 +622,9 @@ axis.tickFormat(tickFormat); if (isCategorized) { axis.tickCentered(__axis_x_tick_centered); + if (isEmpty(__axis_x_tick_culling)) { + __axis_x_tick_culling = false; + } } else { axis.tickOffset = function () { var base = __axis_rotated ? height : width; @@ -830,10 +834,6 @@ } return ticks; } - function shouldShowTickText(ticks, i) { - var length = ticks.length - 1; - return length <= tickTextNum || i % Math.ceil(length / tickTextNum) === 0; - } function category(i) { return i < categories.length ? categories[i] : i; } @@ -876,7 +876,7 @@ lineUpdate.attr("x1", tickX).attr("x2", tickX).attr("y2", tickMajorSize); textUpdate.attr("x", 0).attr("y", Math.max(tickMajorSize, 0) + tickPadding); text.attr("dy", ".71em").style("text-anchor", "middle"); - text.text(function (i) { return shouldShowTickText(ticks, i) ? formattedCategory(i) : ""; }); + text.text(formattedCategory); pathUpdate.attr("d", "M" + range[0] + "," + tickEndSize + "V0H" + range[1] + "V" + tickEndSize); break; } @@ -901,7 +901,7 @@ lineUpdate.attr("x2", -tickMajorSize).attr("y2", 0); textUpdate.attr("x", -(Math.max(tickMajorSize, 0) + tickPadding)).attr("y", tickOffset); text.attr("dy", ".32em").style("text-anchor", "end"); - text.text(function (i) { return shouldShowTickText(ticks, i) ? formattedCategory(i) : ""; }); + text.text(formattedCategory); pathUpdate.attr("d", "M" + -tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + -tickEndSize); break; } @@ -3009,7 +3009,7 @@ // update axis tick values according to options, except for scatter plot if (! hasScatterType(targetsToShow)) { // TODO: fix this - tickValues = generateTickValues(mapTargetsToUniqueXs(targetsToShow)); + tickValues = __axis_x_tick_values ? __axis_x_tick_values : generateTickValues(mapTargetsToUniqueXs(targetsToShow)); xAxis.tickValues(tickValues); subXAxis.tickValues(tickValues); } @@ -3030,19 +3030,23 @@ main.select('.' + CLASS.axisY2).style("opacity", hideAxis ? 0 : 1).transition().duration(durationForAxis).call(yAxis2); // show/hide if manual culling needed - if (withUpdateXDomain && __axis_x_tick_culling && tickValues) { - for (i = 1; i < tickValues.length; i++) { - if (tickValues.length / i < __axis_x_tick_culling_max) { - intervalForCulling = i; - break; + if (withUpdateXDomain) { + if (__axis_x_tick_culling && tickValues) { + for (i = 1; i < tickValues.length; i++) { + if (tickValues.length / i < __axis_x_tick_culling_max) { + intervalForCulling = i; + break; + } } + d3.selectAll('.' + CLASS.axisX + ' .tick text').each(function (e) { + var index = tickValues.indexOf(e); + if (index >= 0) { + d3.select(this).style('display', index % intervalForCulling ? 'none' : 'block'); + } + }); + } else { + d3.selectAll('.' + CLASS.axisX + ' .tick text').style('display', 'block'); } - d3.selectAll('.' + CLASS.axisX + ' .tick text').each(function (e) { - var index = tickValues.indexOf(e); - if (index > 0) { - d3.select(this).style('display', index % intervalForCulling ? 'none' : 'block'); - } - }); } // setup drawer - MEMO: these must be called after axis updated diff --git a/c3.min.js b/c3.min.js index 69040e6..9c998ab 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.30"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cFf&&(Ff=0),0>Hf&&(Hf=0),Df={top:Pg?Cf.top:Kf-Jg-(xi?0:a),right:0/0,bottom:20+(xi?0:a),left:Pg?Bi:Cf.left},Gf=Pg?Cf.left-Bi-Ci:Ff,If=Pg?Hf:Kf-Df.top-Df.bottom,0>Gf&&(Gf=0),0>If&&(If=0),Ef={top:xi?0:Kf-a,right:0/0,bottom:0,left:xi?Jf-b:0},p(),xi&&Yd(nf.data.targets)&&(Ef.left=Ff/2+Mf)}function o(){Li.select("line."+f.xgridFocus).attr("x1",Pg?0:-10).attr("x2",Pg?Ff:-10).attr("y1",Pg?-10:Cf.top).attr("y2",Pg?-10:Hf)}function p(){Mf=Hf/2,Lf=.95*Mf,Nf=Xd(nf.data.targets)?.6*Lf:0}function q(){var a=Pg?f.axisX:f.axisY,b=mf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=mf.select(pf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return qf?qf:x()}function s(){var a=rf?rf:y();return a>0?a:320}function t(){return Yd(nf.data.targets)?0:sf?sf:Pg||!bh||gh?1:v("y")}function u(){var a=1;return Yd(nf.data.targets)?0:tf?tf:xi?P()+(kh&&!Pg?v("y2"):a):kh?ph||Pg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||bh?"y2"!==a||kh?(gb(a).isInner?30:40)+("y2"===a?-10:0):Di:Lg&&!xi?10:1}function x(){return+mf.select(pf).style("width").replace("px","")}function y(){return+mf.select(pf).style("height").replace("px","")}function z(a){return a?-5:-(Cf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Pg)}function C(){return A(!Pg)}function D(){return z(Pg)}function E(){return A(Pg)}function F(a){return a?Ff+2+4:Cf.left+20}function G(a){return a?80:Hf+2}function H(){return F(!Pg)}function I(){return G(!Pg)}function J(){return F(Pg)}function K(){return G(Pg)}function L(){var a=Pg?Hf:Ff,b=vc(),c=Vb()*(Ud(nf.data.targets)?(b-(gi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){yi=a}function N(a){zi=a}function O(a){Ai=a}function P(){return Lg?xi?zi*(yi+1):Jf:0}function Q(){return Lg?xi?Kf:Ai*(yi+1):0}function R(){var a,b=!$f;Sf=Pg?1:0,Tf=Pg?Hf:Ff,Uf=Pg?0:Hf,Vf=Pg?Ff:1,Wf=Sf,Xf=Tf,Yf=Pg?0:If,Zf=Pg?Gf:1,$f=T(Sf,Tf,b?void 0:$f.domain(),function(){return eg.tickOffset()}),_f=U(Uf,Vf),ag=U(Uf,Vf),bg=T(Sf,Tf,Qi,function(a){return a%1?0:hg.tickOffset()}),cg=U(Yf,Zf),dg=U(Yf,Zf),a=$(),eg=X($f,si,a),hg=X(bg,vi,a),fg=Y(_f,ti,hh,jh),gg=Y(ag,ui,qh,sh),b||(Ei.scale(bg),uf&&Ii.scale($f)),S()}function S(){Of=Db(),Pf=Eb(),Qf=Eb(.98)}function T(a,b,e,f){var g=(fi?mf.time.scale():mf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),gi){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return mf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?ag:_f}function W(a){return"y2"===Z(a)?dg:cg}function X(a,b,c){var d=(gi?Bb():mf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),gi?d.tickCentered(Tg):d.tickOffset=function(){var a=Pg?Hf:Ff;return a*Vb()/vc()/2},gi&&d.categories(Sg),d}function Y(a,b,c,d){return mf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in pg?pg[a]:"y"}function $(){var a=fi?pi:gi?Oc:function(a){return 0>a?a.toFixed(0):a};return Ug&&("function"==typeof Ug?a=Ug:fi&&(a=function(a){return oi(Ug)(a)})),a}function _(a){var b;return"y"===a?b=fh:"y2"===a?b=oh:"x"===a&&(b=ah),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?fh=b:"y2"===a?oh=b:"x"===a&&(ah=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Pg?"inner-top":"inner-right")}function eb(){return cb("y",Pg?"inner-right":"inner-top")}function fb(){return cb("y2",Pg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?Ff/2:Ff:b.isBottom?-Hf:b.isMiddle?-Hf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Pg,db())}function ob(){return kb(Pg,eb())}function pb(){return kb(Pg,fb())}function qb(){return lb(!Pg,db())}function rb(){return lb(Pg,eb())}function sb(){return lb(Pg,fb())}function tb(){var a=db();return Pg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Pg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Pg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Pg,db())}function xb(){return mb(Pg,eb())}function yb(){return mb(Pg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Li.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Li.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Li.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return mf.min(Object.keys(i).map(function(a){return mf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(og.length>0)for(g=Nc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return mf.max(Object.keys(i).map(function(a){return mf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?mh:dh,n="y2"===c?lh:ch,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?nh:eh,r=pd()&&Pg;return 0===l.length?"y2"===c?ag.domain():_f.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=qd(o,p),j=$b(_f.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&ih&&(f=b(ih.top)?ih.top:e,g=b(ih.bottom)?ih.bottom:e),"y2"===c&&rh&&(f=b(rh.top)?rh.top:e,g=b(rh.bottom)?rh.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Qi),c=$b($f.domain());return a||0===c?1:b/c}function Wb(a){return $g?$g:mf.min(a,function(a){return mf.min(a.values,function(a){return a.x})})}function Xb(a){return Zg?Zg:mf.max(a,function(a){return mf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return gi?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=0,g=0;return(c||0===c)&&(f=fi?new Date(c.getTime()-e):c-e),(d||0===d)&&(g=fi?new Date(d.getTime()+e):d+e),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return ig&&a===ig||ne(jg)&&oe(jg,a)}function fc(a){return!ec(a)}function gc(a){return ig?ig:ne(jg)?jg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=nf.data.xs[b])}),c}function ic(a,b){return a in nf.data.xs&&nf.data.xs[a]&&nf.data.xs[a][b]?nf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){jg[b]=a[b]})}function kc(a){return 1===mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=mg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),nf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=fi?a?a instanceof Date?a:ie(a):ie(ic(b,c)):hi&&!gi?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):ig?(d=Object.keys(nf.data.xs),nf.data.xs[c]=d.length>0?nf.data.xs[d[0]]:void 0):ne(jg)&&(nf.data.xs[c]=hc(f,nf.data.targets)):nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=lg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return hi&&gi&&0===c&&g&&(0===e&&(Sg=[]),Sg.push(g)),("undefined"==typeof a[b]||nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),qg&&Sd(xc(c).filter(function(a){return!(a in rg)}),qg),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function tc(a){return a>0&&nf.data.targets[0].values[a-1]?nf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?nf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?nf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(nf.data.targets)}function zc(a,b){var c,d=xc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(fi?new Date(h):h);i.push(d)}return fi||(i=i.sort(function(a,b){return a-b})),i}function Gc(a){qi=qi.concat(a)}function Hc(a){qi=qi.filter(function(b){return a.indexOf(b)<0})}function Ic(a){ri=ri.concat(a)}function Jc(a){ri=ri.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Ed(){return tg&&"desc"===tg.toLowerCase()}function Fd(){return tg&&"asc"===tg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof tg&&a.sort(tg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(nf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Uh&&0!==m.length&&(Oi.html(Xh(a,$(),l,ni)).style("display","block"),d=Oi.property("offsetWidth"),e=Oi.property("offsetHeight"),k?(g=Ff/2+c[0],i=Hf/2+c[1]+20):(Pg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=$f(m[0].x)+20):(f=q(),g=f+t()+$f(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Oi.style("top",i+"px").style("left",g+"px"))}function Id(){Oi.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Uh&&(Vd(nf.data.targets)||Yd(nf.data.targets)||Li.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Pg?"y1":"x1",ud).attr(Pg?"y2":"x2",ud))}function Kd(){Li.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?$f(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Gh?Gh:b?2*a.tickOffset()*Hh/b:0}function Sd(a,b){yc(a).forEach(function(a){Si[a]=b===rg[a],rg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){rg[a.id]===b&&(c=!0),a.id in rg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in rg)||"line"===rg[b]||"spline"===rg[b]||"area"===rg[b]||"area-spline"===rg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===rg[b]||"area-spline"===rg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===rg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===rg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===rg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===rg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ie(b){var c;try{c=kg?mf.time.format(kg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+kg)}return c}function je(a,b){var c=mf.mouse(a),d=mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?_f:ag,d=Pg?1:0,e=Pg?0:1;return Math.pow($f(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Eg(b,a.node()),Li.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Pg?Md:Ld).attr("cy",Pg?Ld:Md).attr("stroke",function(){return ni(b)}).attr("r",1.4*Eh).transition().duration(100).attr("r",Eh)}function se(a,b,c){Fg(b,a.node()),Li.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Eg(b,a.node()),a.transition().duration(100).style("fill",function(){return mf.rgb(ni(b)).darker(1)})}function ve(a,b){Fg(b,a.node()),a.transition().duration(100).style("fill",function(){return ni(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Li.selectAll("."+f.circles+gd(c)):Li).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",Dh)}function Ae(a){ye(a).filter(function(){return mf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Ah)}function Be(a){return Li.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Pg?1:0,f=Pg?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Pg?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBoundingClientRect();return Pg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(eg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Pg&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Je(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function Ke(b){var c,d,e;if(Pi=mf.select(pf),Pi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Pi.html(""),Pi.classed("c3",!0),nf.data.xs={},nf.data.targets=rc(b),n(),R(),$f.domain(mf.extent(Zb(nf.data.targets))),_f.domain(Ub(nf.data.targets,"y")),ag.domain(Ub(nf.data.targets,"y2")),bg.domain($f.domain()),cg.domain(_f.domain()),dg.domain(ag.domain()),Qi=$f.domain(),Ei.scale(bg),uf&&Ii.scale($f),Ji=Pi.append("svg").attr("width",Ff+Cf.left+Cf.right).attr("height",Hf+Cf.top+Cf.bottom).on("mouseenter",xf).on("mouseleave",yf),Ki=Ji.append("defs"),Ki.append("clipPath").attr("id",_h).append("rect").attr("width",Ff).attr("height",Hf),Ki.append("clipPath").attr("id",ai).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Ki.append("clipPath").attr("id",bi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Li=Ji.append("g").attr("transform",wi.main),Mi=Ig?Ji.append("g").attr("transform",wi.context):null,Ni=Ji.append("g").attr("transform",wi.legend),Lg||(Ni.style("visibility","hidden"),ri=xc(nf.data.targets)),Oi=mf.select(pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),gf(xc(nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Li.append("g").attr("class",f.axisX).attr("clip-path",Pg?"":di).attr("transform",wi.x).append("text").attr("class",f.axisXLabel).attr("transform",Pg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),bh&&Li.append("g").attr("class",f.axisY).attr("clip-path",Pg?ei:"").attr("transform",wi.y).append("text").attr("class",f.axisYLabel).attr("transform",Pg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),kh&&Li.append("g").attr("class",f.axisY2).attr("transform",wi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Pg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Li.append("g").attr("clip-path",ci).attr("class",f.grid),th&&d.append("g").attr("class",f.xgrids),ne(vh)&&d.append("g").attr("class",f.xgridLines),Bh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),wh&&d.append("g").attr("class",f.ygrids),ne(xh)&&d.append("g").attr("class",f.ygridLines),Li.append("g").attr("clip-path",ci).attr("class",f.regions),Li.append("g").attr("clip-path",ci).attr("class",f.chart),c=Li.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",uf?Pg?"ns-resize":"ew-resize":null),Li.select("."+f.chart).append("g").attr("class",f.chartBars),Li.select("."+f.chart).append("g").attr("class",f.chartLines),Li.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",wi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Li.select("."+f.chart).append("g").attr("class",f.chartTexts),uf&&Li.insert("rect",wf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Ff).attr("height",Hf).style("opacity",0).style("cursor",Pg?"ns-resize":"ew-resize").call(Ii).on("dblclick.zoom",null),_g&&Ei.extent("function"!=typeof _g?_g:_g(Zb())),Ig&&(Mi.append("g").attr("clip-path",ci).attr("class",f.chart),Mi.select("."+f.chart).append("g").attr("class",f.chartBars),Mi.select("."+f.chart).append("g").attr("class",f.chartLines),Mi.append("g").attr("clip-path",ci).attr("class",f.brush).call(Ei).selectAll("rect").attr(Pg?"width":"height",Pg?Gf:If),Mi.append("g").attr("class",f.axisX).attr("transform",wi.subx).attr("clip-path",Pg?"":di)),Xe(nf.data.targets),Pg?Li.select("."+f.axisX).style("opacity",0).call(eg):(Li.select("."+f.axisY).style("opacity",0).call(fg),Li.select("."+f.axisY2).style("opacity",0).call(gg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Yh){if(fi&&"string"==typeof Zh){for(Zh=ie(Zh),e=0;e0){d=[];for(var g in mg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function Pe(a){Yd(nf.data.targets)||xg&&(ii=a,Li.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),ji=!0,Gg())}function Qe(){Yd(nf.data.targets)||xg&&(Li.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Li.selectAll("."+f.shape).classed(f.INCLUDED,!1),ji=!1,Hg())}function Re(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Nd(),U=Yd(nf.data.targets),V=Dc(nf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?Bf:0,O=B?N:0,P=C?N:0,H&&Lg&&gf(xc(nf.data.targets),a),G&&($f.domain(mf.extent(Zb(V))),Qi=$f.domain(),uf&&Ii.scale($f).updateScaleExtent(),bg.domain($f.domain()),Ei.scale(bg)),F&&($f.domain(Ei.empty()?Qi:Ei.extent()),uf&&Ii.scale($f).updateScaleExtent()),_f.domain(Ub(V,"y")),ag.domain(Ub(V,"y2")),Vd(V)||(Q=Fc(Ec(V)),eg.tickValues(Q),hg.tickValues(Q)),c=Li.select("."+f.axisX).style("opacity",U?0:1),(Pg||D)&&(c=c.transition().duration(P)),c.call(eg),e=Li.select("."+f.axisY).style("opacity",U?0:1),(!Pg||D)&&(e=e.transition().duration(P)),e.call(fg),Li.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(gg),F&&Vg&&Q){for(R=1;R0&&mf.select(this).style("display",b%S?"none":"block")})}if(I=Ee(T),K=Fe(T,!0),M=Fe(T,!1),Ab(),cg.domain(_f.domain()),dg.domain(ag.domain()),Oi.style("display","none"),o(),Li.select("line."+f.xgridFocus).style("visibility","hidden"),th){if("year"===uh){h=[];for(var W=Zb(),X=W[0].getFullYear(),Y=W[1].getFullYear(),Z=X;Y>=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=$f.ticks(10);g=Li.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Pg?0:function(a){return $f(a)-eg.tickOffset()}).attr("x2",Pg?Ff:function(a){return $f(a)-eg.tickOffset()}).attr("y1",Pg?function(a){return $f(a)-eg.tickOffset()}:Cf.top).attr("y2",Pg?function(a){return $f(a)-eg.tickOffset()}:Hf).style("opacity",function(){return+mf.select(this).attr(Pg?"y1":"x1")===(Pg?Hf:0)?0:1}),g.exit().remove()}ne(vh)&&(i=Li.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(vh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Pg?"":"rotate(-90)").attr("dx",Pg?0:-Cf.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Pg?0:vd).attr("x2",Pg?Ff:vd).attr("y1",Pg?vd:Cf.top).attr("y2",Pg?vd:Hf).style("opacity",1),i.select("text").transition().duration(N).attr("x",Pg?Ff:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&wh&&(k=Li.select("."+f.ygrids).selectAll("."+f.ygrid).data(_f.ticks(yh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Pg?_f:0).attr("x2",Pg?_f:Ff).attr("y1",Pg?0:_f).attr("y2",Pg?Hf:_f),k.exit().remove()),y&&ne(xh)&&(l=Li.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(xh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Pg?"rotate(-90)":"").attr("dx",Pg?0:-Cf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Pg?wd:0).attr("x2",Pg?wd:Ff).attr("y1",Pg?0:wd).attr("y2",Pg?Hf:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Pg?0:Ff).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Li.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ni(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Li.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Pg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Li.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Fi).style("opacity",1),Li.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Gi).style("opacity",Ri),n=Li.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",Ah),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Pg?Md:Ld).attr("cy",Pg?Ld:Md),n.exit().remove(),Li.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=mf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Li.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Li.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Ig&&(null!==mf.event&&"zoom"===mf.event.type&&Ei.extent($f.orgDomain()).update(),z&&(Mi.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(hg),Ei.empty()||Ei.extent($f.orgDomain()).update(),J=Ee(T,!0),s=Mi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ni(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Mi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Hi).style("opacity",1))),Li.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Li.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Pg?Md:Ld).attr("cy",Pg?Ld:Md),t=Li.select("."+f.eventRects),ne(jg)&&!kc(jg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Li.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Ff).attr("height",Hf)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),hi&&!gi?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return($f(d?d:e+50)-$f(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return($f(d)+$f(c?c:d-50))/2}):(x=L(),w=function(a){return $f(a.x)-x/2}),v=wc(),Li.select("."+f.eventRects).datum(v?v.values:[]),u=Li.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Pg?0:w).attr("y",Pg?w:0).attr("width",Pg?Ff:x).attr("height",Pg?x:Hf),u.exit().remove()),q=Li.select("."+f.regions).selectAll("rect."+f.region).data(Th),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Pg?0:cc).attr("y",Pg?cc:Cf.top).attr("width",Pg?Ff:dc).attr("height",Pg?dc:Hf).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),xc(nf.data.targets).forEach(function(a){Si[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Ii.altDomain?($f.domain(Ii.altDomain),void Ii.scale($f).updateScaleExtent()):(gi&&$f.orgDomain()[0]===Qi[0]&&$f.domain([Qi[0]-1e-10,$f.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(ki=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Ji.attr("width",Jf).attr("height",Kf),Ji.select("#"+_h).select("rect").attr("width",Ff).attr("height",Hf),Ji.select("#"+ai).select("rect").attr("width",H),Ji.select("#"+bi).select("rect").attr("width",J),Ji.select("."+f.zoomRect).attr("width",Ff).attr("height",Hf)}function We(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Li.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ni(a)}),e=Li.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ni(a)}).style("stroke","none").style("cursor",function(a){return zg(a)?"pointer":null}),c=Li.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ni(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Ri=+mf.select(this).style("opacity"),0}).style("fill",function(a){return ni(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ni(a)}).style("cursor",function(a){return zg(a)?"pointer":null}),a.forEach(function(a){Li.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Li.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Rf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ni(a.data)}).style("cursor",function(a){return zg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Ig&&(n=Mi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ni(a)}),l=Mi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ni(a)})),Ji.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=xi?j:i,l=xi?Q():P();return d&&(w=0,C=0,t=0,u=0),Lg&&!Cc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=xi?u:t,void(Og?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,xi?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Ni.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Ng?Ng(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(mg[a])?mg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",xi?g:-200).attr("y",xi?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",xi?h:-200).attr("y",xi?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return ni(a)}).attr("x",xi?g:-200).attr("y",xi?-200:i).attr("width",10).attr("height",10),Ni.selectAll("text").data(a).text(function(a){return d(mg[a])?mg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ni.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ni.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["onresize"],function(){}),Af=h(["onresized"],function(){}),Bf=h(["transition","duration"],350);g("data","data is required in config");var Cf,Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig=h(["data","x"]),jg=h(["data","xs"],{}),kg=h(["data","x_format"]),lg=h(["data","id_converter"],function(a){return a}),mg=h(["data","names"],{}),ng=h(["data","classes"],{}),og=h(["data","groups"],[]),pg=h(["data","axes"],{}),qg=h(["data","type"]),rg=h(["data","types"],{}),sg=h(["data","labels"],{}),tg=h(["data","order"]),ug=h(["data","regions"],{}),vg=h(["data","color"]),wg=h(["data","colors"],{}),xg=h(["data","selection","enabled"],!1),yg=h(["data","selection","grouped"],!1),zg=h(["data","selection","isselectable"],function(){return!0}),Ag=h(["data","selection","multiple"],!0),Bg=h(["data","onclick"],function(){}),Cg=h(["data","onenter"],function(){}),Dg=h(["data","onleave"],function(){}),Eg=h(["data","onselected"],function(){}),Fg=h(["data","onunselected"],function(){}),Gg=h(["data","ondragstart"],function(){}),Hg=h(["data","ondragend"],function(){}),Ig=h(["subchart","show"],!1),Jg=Ig?h(["subchart","size","height"],60):0,Kg=h(["color","pattern"],[]),Lg=h(["legend","show"],!0),Mg=h(["legend","position"],"bottom"),Ng=h(["legend","item","onclick"]),Og=h(["legend","equally"],!1),Pg=h(["axis","rotated"],!1),Qg=h(["axis","x","type"],"indexed"),Rg=h(["axis","x","localtime"],!1),Sg=h(["axis","x","categories"],[]),Tg=h(["axis","x","tick","centered"],!1),Ug=h(["axis","x","tick","format"]),Vg=h(["axis","x","tick","culling"],{}),Wg=h(["axis","x","tick","culling","max"],"categorized"===Qg?1/0:10),Xg=h(["axis","x","tick","count"]),Yg=h(["axis","x","tick","fit"],!1),Zg=h(["axis","x","max"]),$g=h(["axis","x","min"]),_g=h(["axis","x","default"]),ah=h(["axis","x","label"],{}),bh=h(["axis","y","show"],!0),ch=h(["axis","y","max"]),dh=h(["axis","y","min"]),eh=h(["axis","y","center"]),fh=h(["axis","y","label"],{}),gh=h(["axis","y","inner"],!1),hh=h(["axis","y","tick","format"]),ih=h(["axis","y","padding"],{}),jh=h(["axis","y","ticks"],10),kh=h(["axis","y2","show"],!1),lh=h(["axis","y2","max"]),mh=h(["axis","y2","min"]),nh=h(["axis","y2","center"]),oh=h(["axis","y2","label"],{}),ph=h(["axis","y2","inner"],!1),qh=h(["axis","y2","tick","format"]),rh=h(["axis","y2","padding"],{}),sh=h(["axis","y2","ticks"],10),th=h(["grid","x","show"],!1),uh=h(["grid","x","type"],"tick"),vh=h(["grid","x","lines"],[]),wh=h(["grid","y","show"],!1),xh=h(["grid","y","lines"],[]),yh=h(["grid","y","ticks"],10),zh=h(["point","show"],!0),Ah=zh?h(["point","r"],2.5):0,Bh=h(["point","focus","line","enabled"],!0),Ch=h(["point","focus","expand","enabled"],!0),Dh=h(["point","focus","expand","r"],Ch?4:Ah),Eh=h(["point","focus","select","r"],8),Fh=h(["line","connect_null"],!1),Gh=h(["bar","width"]),Hh=h(["bar","width","ratio"],.6),Ih=h(["pie","label","show"],!0),Jh=h(["pie","label","format"]),Kh=h(["pie","onclick"],function(){}),Lh=h(["pie","onmouseover"],function(){}),Mh=h(["pie","onmouseout"],function(){}),Nh=h(["donut","label","show"],!0),Oh=h(["donut","label","format"]),Ph=h(["donut","title"],""),Qh=h(["donut","onclick"],function(){}),Rh=h(["donut","onmouseover"],function(){}),Sh=h(["donut","onmouseout"],function(){}),Th=h(["regions"],[]),Uh=h(["tooltip","show"],!0),Vh=h(["tooltip","format","title"]),Wh=h(["tooltip","format","value"]),Xh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Vh?Vh:b,l=Wh?Wh:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Yh=h(["tooltip","init","show"],!1),Zh=h(["tooltip","init","x"],0),$h=h(["tooltip","init","position"],{top:"0px",left:"50px"}),_h=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",ai=_h+"-xaxis",bi=_h+"-yaxis",ci=i(_h),di=i(ai),ei=i(bi),fi="timeseries"===Qg,gi="categorized"===Qg,hi=!fi&&(ig||ne(jg)),ii=null,ji=!1,ki=!1,li=!1,mi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ni=he(wg,ne(Kg)?Kg:mi,vg),oi=Rg?mf.time.format:mf.time.format.utc,pi=function(){var a=[[oi("%Y/%-m/%-d"),function(){return!0}],[oi("%-m/%-d"),function(a){return a.getMonth()}],[oi("%-m/%-d"),function(a){return 1!==a.getDate()}],[oi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[oi("%I %p"),function(a){return a.getHours()}],[oi("%I:%M"),function(a){return a.getMinutes()}],[oi(":%S"),function(a){return a.getSeconds()}],[oi(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),qi=[],ri=[],si=Pg?"left":"bottom",ti=Pg?gh?"top":"bottom":gh?"right":"left",ui=Pg?ph?"bottom":"top":ph?"left":"right",vi=Pg?"left":"bottom",wi={main:function(){return"translate("+Cf.left+","+Cf.top+")"},context:function(){return"translate("+Df.left+","+Df.top+")"},legend:function(){return"translate("+Ef.left+","+Ef.top+")"},x:function(){return"translate(0,"+(Pg?0:Hf)+")"},y:function(){return"translate(0,"+(Pg?Hf:0)+")"},y2:function(){return"translate("+(Pg?0:Ff)+","+(Pg?1:0)+")"},subx:function(){return"translate(0,"+(Pg?0:If)+")"},arc:function(){return"translate("+Ff/2+","+Hf/2+")"}},xi="right"===Mg,yi=0,zi=0,Ai=0,Bi=30,Ci=30,Di=5;Rf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Ei,Fi=function(){var a=mf.svg.line().x(Pg?function(a){return V(a.id)(a.value)}:ud).y(Pg?ud:function(a){return V(a.id)(a.value)});return Fh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Fh?xe(b.values):b.values;return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),ug[b.id]?Je(e,$f,V(b.id),ug[b.id]):a(e)):(c=e[0]?$f(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Pg?"M "+d+" "+c:"M "+c+" "+d)}}(),Gi=function(){var a;return a=Pg?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?$f(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Pg?"M "+d+" "+c:"M "+c+" "+d)}}(),Hi=function(){var a=mf.svg.line().x(Pg?function(a){return W(a.id)(a.value)}:xd).y(Pg?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+bg(c[0].x)+" "+W(b.id)(c[0].value)}}(),Ii=function(){};Ei=mf.svg.brush().on("brush",Se),Ei.update=function(){return Mi&&Mi.select("."+f.brush).call(this),this},Ei.scale=function(a){return Pg?this.y(a):this.x(a)},uf&&(Ii=mf.behavior.zoom().on("zoomstart",function(){Ii.altDomain=mf.event.sourceEvent.altKey?$f.orgDomain():null}).on("zoom",uf?Te:null),Ii.scale=function(a){return Pg?this.y(a):this.x(a)},Ii.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Ii.updateScaleExtent=function(){var a=$b($f.orgDomain())/$b(Qi),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Ji,Ki,Li,Mi,Ni,Oi,Pi,Qi,Ri,Si={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ji.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Ji.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ji.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Ji.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Ni.selectAll(kd(a)).classed(f.legendItemHidden,!1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Ji.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Ni.selectAll(kd(a)).classed(f.legendItemHidden,!0),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){Ei.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){ng[b]=a.classes[b]}),"categories"in a&&gi&&(Sg=a.categories,eg.categories(Sg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Li.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){xg&&Li.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=yg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?zg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){xg&&Li.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=yg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&zg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?og:(og=a,Re(),og)},nf.xgrids=function(a){return a?(vh=a,Re(),vh):vh},nf.xgrids.add=function(a){return a?nf.xgrids(vh.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(vh.filter(b))},nf.ygrids=function(a){return a?(xh=a,Re(),xh):xh},nf.ygrids.add=function(a){return a?nf.ygrids(xh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(xh.filter(b))},nf.regions=function(a){return c(a)?Th:(Th=a,Re(),Th)},nf.regions.add=function(a){return c(a)?Th:(Th=Th.concat(a),Re(),Th)},nf.regions.remove=function(a,c){var e=[].concat(a);return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;Ji.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Th=Th.filter(function(b){return b.classes.indexOf(a)<0})}),Th},nf.data.get=function(a){var b=nf.data.getAsTarget(a); -return d(b)?b.values.map(function(a){return a.value}):void 0},nf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){mg[b]=a[b]}),gf(xc(nf.data.targets),{withTransition:!0}),mg):mg},nf.x=function(a){return arguments.length&&(mc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.xs=function(a){return arguments.length&&(nc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(ch=+a.y),b(a.y2)&&(lh=+a.y2)):ch=lh=+a,Re())},nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(dh=+a.y),b(a.y2)&&(mh=+a.y2)):dh=mh=+a,Re())},nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&nf.axis.max(a.max),"undefined"!=typeof a.min&&nf.axis.min(a.min))},nf.legend.show=function(a){Lg||(Lg=!0,Ni.style("visibility","visible")),ef(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.legend.hide=function(a){Lg&&me(a)&&(Lg=!1,Ni.style("visibility","hidden")),ff(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.resize=function(a){qf=a?a.width:null,rf=a?a.height:null,We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},nf.destroy=function(){nf.data.targets=void 0,nf.data.xs={},Pi.html(""),a.onresize=null},"url"in e.data)mf.xhr(e.data.url,function(a,b){var c,d=mf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=mf.csv.parse(b.response),Ke(c)});else if("rows"in e.data)Ke(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ke(qc(e.data.columns))}return nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file +!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.30"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cFf&&(Ff=0),0>Hf&&(Hf=0),Df={top:Pg?Cf.top:Kf-Jg-(yi?0:a),right:0/0,bottom:20+(yi?0:a),left:Pg?Ci:Cf.left},Gf=Pg?Cf.left-Ci-Di:Ff,If=Pg?Hf:Kf-Df.top-Df.bottom,0>Gf&&(Gf=0),0>If&&(If=0),Ef={top:yi?0:Kf-a,right:0/0,bottom:0,left:yi?Jf-b:0},p(),yi&&Yd(nf.data.targets)&&(Ef.left=Ff/2+Mf)}function o(){Mi.select("line."+f.xgridFocus).attr("x1",Pg?0:-10).attr("x2",Pg?Ff:-10).attr("y1",Pg?-10:Cf.top).attr("y2",Pg?-10:Hf)}function p(){Mf=Hf/2,Lf=.95*Mf,Nf=Xd(nf.data.targets)?.6*Lf:0}function q(){var a=Pg?f.axisX:f.axisY,b=mf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=mf.select(pf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return qf?qf:x()}function s(){var a=rf?rf:y();return a>0?a:320}function t(){return Yd(nf.data.targets)?0:sf?sf:Pg||!ch||hh?1:v("y")}function u(){var a=1;return Yd(nf.data.targets)?0:tf?tf:yi?P()+(lh&&!Pg?v("y2"):a):lh?qh||Pg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||ch?"y2"!==a||lh?(gb(a).isInner?30:40)+("y2"===a?-10:0):Ei:Lg&&!yi?10:1}function x(){return+mf.select(pf).style("width").replace("px","")}function y(){return+mf.select(pf).style("height").replace("px","")}function z(a){return a?-5:-(Cf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Pg)}function C(){return A(!Pg)}function D(){return z(Pg)}function E(){return A(Pg)}function F(a){return a?Ff+2+4:Cf.left+20}function G(a){return a?80:Hf+2}function H(){return F(!Pg)}function I(){return G(!Pg)}function J(){return F(Pg)}function K(){return G(Pg)}function L(){var a=Pg?Hf:Ff,b=vc(),c=Vb()*(Ud(nf.data.targets)?(b-(hi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){zi=a}function N(a){Ai=a}function O(a){Bi=a}function P(){return Lg?yi?Ai*(zi+1):Jf:0}function Q(){return Lg?yi?Kf:Bi*(zi+1):0}function R(){var a,b=!$f;Sf=Pg?1:0,Tf=Pg?Hf:Ff,Uf=Pg?0:Hf,Vf=Pg?Ff:1,Wf=Sf,Xf=Tf,Yf=Pg?0:If,Zf=Pg?Gf:1,$f=T(Sf,Tf,b?void 0:$f.domain(),function(){return eg.tickOffset()}),_f=U(Uf,Vf),ag=U(Uf,Vf),bg=T(Sf,Tf,Ri,function(a){return a%1?0:hg.tickOffset()}),cg=U(Yf,Zf),dg=U(Yf,Zf),a=$(),eg=X($f,ti,a),hg=X(bg,wi,a),fg=Y(_f,ui,ih,kh),gg=Y(ag,vi,rh,th),b||(Fi.scale(bg),uf&&Ji.scale($f)),S()}function S(){Of=Db(),Pf=Eb(),Qf=Eb(.98)}function T(a,b,e,f){var g=(gi?mf.time.scale():mf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),hi){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return mf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?ag:_f}function W(a){return"y2"===Z(a)?dg:cg}function X(a,b,c){var d=(hi?Bb():mf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),hi?(d.tickCentered(Tg),me(Vg)&&(Vg=!1)):d.tickOffset=function(){var a=Pg?Hf:Ff;return a*Vb()/vc()/2},hi&&d.categories(Sg),d}function Y(a,b,c,d){return mf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in pg?pg[a]:"y"}function $(){var a=gi?qi:hi?Oc:function(a){return 0>a?a.toFixed(0):a};return Ug&&("function"==typeof Ug?a=Ug:gi&&(a=function(a){return pi(Ug)(a)})),a}function _(a){var b;return"y"===a?b=gh:"y2"===a?b=ph:"x"===a&&(b=bh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?gh=b:"y2"===a?ph=b:"x"===a&&(bh=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Pg?"inner-top":"inner-right")}function eb(){return cb("y",Pg?"inner-right":"inner-top")}function fb(){return cb("y2",Pg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?Ff/2:Ff:b.isBottom?-Hf:b.isMiddle?-Hf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Pg,db())}function ob(){return kb(Pg,eb())}function pb(){return kb(Pg,fb())}function qb(){return lb(!Pg,db())}function rb(){return lb(Pg,eb())}function sb(){return lb(Pg,fb())}function tb(){var a=db();return Pg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Pg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Pg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Pg,db())}function xb(){return mb(Pg,eb())}function yb(){return mb(Pg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Mi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Mi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Mi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+o)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Mc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return mf.min(Object.keys(i).map(function(a){return mf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(og.length>0)for(g=Nc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return mf.max(Object.keys(i).map(function(a){return mf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?nh:eh,n="y2"===c?mh:dh,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?oh:fh,r=pd()&&Pg;return 0===l.length?"y2"===c?ag.domain():_f.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=qd(o,p),j=$b(_f.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&jh&&(f=b(jh.top)?jh.top:e,g=b(jh.bottom)?jh.bottom:e),"y2"===c&&sh&&(f=b(sh.top)?sh.top:e,g=b(sh.bottom)?sh.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Ri),c=$b($f.domain());return a||0===c?1:b/c}function Wb(a){return _g?_g:mf.min(a,function(a){return mf.min(a.values,function(a){return a.x})})}function Xb(a){return $g?$g:mf.max(a,function(a){return mf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return hi?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=0,g=0;return(c||0===c)&&(f=gi?new Date(c.getTime()-e):c-e),(d||0===d)&&(g=gi?new Date(d.getTime()+e):d+e),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return ig&&a===ig||ne(jg)&&oe(jg,a)}function fc(a){return!ec(a)}function gc(a){return ig?ig:ne(jg)?jg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=nf.data.xs[b])}),c}function ic(a,b){return a in nf.data.xs&&nf.data.xs[a]&&nf.data.xs[a][b]?nf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){jg[b]=a[b]})}function kc(a){return 1===mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=mg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),nf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=gi?a?a instanceof Date?a:ie(a):ie(ic(b,c)):ii&&!hi?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):ig?(d=Object.keys(nf.data.xs),nf.data.xs[c]=d.length>0?nf.data.xs[d[0]]:void 0):ne(jg)&&(nf.data.xs[c]=hc(f,nf.data.targets)):nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=lg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return ii&&hi&&0===c&&g&&(0===e&&(Sg=[]),Sg.push(g)),("undefined"==typeof a[b]||nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),qg&&Sd(xc(c).filter(function(a){return!(a in rg)}),qg),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function tc(a){return a>0&&nf.data.targets[0].values[a-1]?nf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?nf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?nf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(nf.data.targets)}function zc(a,b){var c,d=xc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(gi?new Date(h):h);i.push(d)}return gi||(i=i.sort(function(a,b){return a-b})),i}function Gc(a){ri=ri.concat(a)}function Hc(a){ri=ri.filter(function(b){return a.indexOf(b)<0})}function Ic(a){si=si.concat(a)}function Jc(a){si=si.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Ed(){return tg&&"desc"===tg.toLowerCase()}function Fd(){return tg&&"asc"===tg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof tg&&a.sort(tg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(nf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Vh&&0!==m.length&&(Pi.html(Yh(a,$(),l,oi)).style("display","block"),d=Pi.property("offsetWidth"),e=Pi.property("offsetHeight"),k?(g=Ff/2+c[0],i=Hf/2+c[1]+20):(Pg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=$f(m[0].x)+20):(f=q(),g=f+t()+$f(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Pi.style("top",i+"px").style("left",g+"px"))}function Id(){Pi.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Vh&&(Vd(nf.data.targets)||Yd(nf.data.targets)||Mi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Pg?"y1":"x1",ud).attr(Pg?"y2":"x2",ud))}function Kd(){Mi.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?$f(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Hh?Hh:b?2*a.tickOffset()*Ih/b:0}function Sd(a,b){yc(a).forEach(function(a){Ti[a]=b===rg[a],rg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){rg[a.id]===b&&(c=!0),a.id in rg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in rg)||"line"===rg[b]||"spline"===rg[b]||"area"===rg[b]||"area-spline"===rg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===rg[b]||"area-spline"===rg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===rg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===rg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===rg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===rg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ie(b){var c;try{c=kg?mf.time.format(kg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+kg)}return c}function je(a,b){var c=mf.mouse(a),d=mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?_f:ag,d=Pg?1:0,e=Pg?0:1;return Math.pow($f(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Eg(b,a.node()),Mi.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Pg?Md:Ld).attr("cy",Pg?Ld:Md).attr("stroke",function(){return oi(b)}).attr("r",1.4*Fh).transition().duration(100).attr("r",Fh)}function se(a,b,c){Fg(b,a.node()),Mi.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Eg(b,a.node()),a.transition().duration(100).style("fill",function(){return mf.rgb(oi(b)).darker(1)})}function ve(a,b){Fg(b,a.node()),a.transition().duration(100).style("fill",function(){return oi(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Mi.selectAll("."+f.circles+gd(c)):Mi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",Eh)}function Ae(a){ye(a).filter(function(){return mf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Bh)}function Be(a){return Mi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Pg?1:0,f=Pg?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Pg?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBoundingClientRect();return Pg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(eg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Pg&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Je(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function Ke(b){var c,d,e;if(Qi=mf.select(pf),Qi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Qi.html(""),Qi.classed("c3",!0),nf.data.xs={},nf.data.targets=rc(b),n(),R(),$f.domain(mf.extent(Zb(nf.data.targets))),_f.domain(Ub(nf.data.targets,"y")),ag.domain(Ub(nf.data.targets,"y2")),bg.domain($f.domain()),cg.domain(_f.domain()),dg.domain(ag.domain()),Ri=$f.domain(),Fi.scale(bg),uf&&Ji.scale($f),Ki=Qi.append("svg").attr("width",Ff+Cf.left+Cf.right).attr("height",Hf+Cf.top+Cf.bottom).on("mouseenter",xf).on("mouseleave",yf),Li=Ki.append("defs"),Li.append("clipPath").attr("id",ai).append("rect").attr("width",Ff).attr("height",Hf),Li.append("clipPath").attr("id",bi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Li.append("clipPath").attr("id",ci).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Mi=Ki.append("g").attr("transform",xi.main),Ni=Ig?Ki.append("g").attr("transform",xi.context):null,Oi=Ki.append("g").attr("transform",xi.legend),Lg||(Oi.style("visibility","hidden"),si=xc(nf.data.targets)),Pi=mf.select(pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),gf(xc(nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Mi.append("g").attr("class",f.axisX).attr("clip-path",Pg?"":ei).attr("transform",xi.x).append("text").attr("class",f.axisXLabel).attr("transform",Pg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),ch&&Mi.append("g").attr("class",f.axisY).attr("clip-path",Pg?fi:"").attr("transform",xi.y).append("text").attr("class",f.axisYLabel).attr("transform",Pg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),lh&&Mi.append("g").attr("class",f.axisY2).attr("transform",xi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Pg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Mi.append("g").attr("clip-path",di).attr("class",f.grid),uh&&d.append("g").attr("class",f.xgrids),ne(wh)&&d.append("g").attr("class",f.xgridLines),Ch&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),xh&&d.append("g").attr("class",f.ygrids),ne(yh)&&d.append("g").attr("class",f.ygridLines),Mi.append("g").attr("clip-path",di).attr("class",f.regions),Mi.append("g").attr("clip-path",di).attr("class",f.chart),c=Mi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",uf?Pg?"ns-resize":"ew-resize":null),Mi.select("."+f.chart).append("g").attr("class",f.chartBars),Mi.select("."+f.chart).append("g").attr("class",f.chartLines),Mi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",xi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Mi.select("."+f.chart).append("g").attr("class",f.chartTexts),uf&&Mi.insert("rect",wf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Ff).attr("height",Hf).style("opacity",0).style("cursor",Pg?"ns-resize":"ew-resize").call(Ji).on("dblclick.zoom",null),ah&&Fi.extent("function"!=typeof ah?ah:ah(Zb())),Ig&&(Ni.append("g").attr("clip-path",di).attr("class",f.chart),Ni.select("."+f.chart).append("g").attr("class",f.chartBars),Ni.select("."+f.chart).append("g").attr("class",f.chartLines),Ni.append("g").attr("clip-path",di).attr("class",f.brush).call(Fi).selectAll("rect").attr(Pg?"width":"height",Pg?Gf:If),Ni.append("g").attr("class",f.axisX).attr("transform",xi.subx).attr("clip-path",Pg?"":ei)),Xe(nf.data.targets),Pg?Mi.select("."+f.axisX).style("opacity",0).call(eg):(Mi.select("."+f.axisY).style("opacity",0).call(fg),Mi.select("."+f.axisY2).style("opacity",0).call(gg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Zh){if(gi&&"string"==typeof $h){for($h=ie($h),e=0;e0){d=[];for(var g in mg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function Pe(a){Yd(nf.data.targets)||xg&&(ji=a,Mi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),ki=!0,Gg())}function Qe(){Yd(nf.data.targets)||xg&&(Mi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Mi.selectAll("."+f.shape).classed(f.INCLUDED,!1),ki=!1,Hg())}function Re(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Nd(),U=Yd(nf.data.targets),V=Dc(nf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?Bf:0,O=B?N:0,P=C?N:0,H&&Lg&&gf(xc(nf.data.targets),a),G&&($f.domain(mf.extent(Zb(V))),Ri=$f.domain(),uf&&Ji.scale($f).updateScaleExtent(),bg.domain($f.domain()),Fi.scale(bg)),F&&($f.domain(Fi.empty()?Ri:Fi.extent()),uf&&Ji.scale($f).updateScaleExtent()),_f.domain(Ub(V,"y")),ag.domain(Ub(V,"y2")),Vd(V)||(Q=Zg?Zg:Fc(Ec(V)),eg.tickValues(Q),hg.tickValues(Q)),c=Mi.select("."+f.axisX).style("opacity",U?0:1),(Pg||D)&&(c=c.transition().duration(P)),c.call(eg),e=Mi.select("."+f.axisY).style("opacity",U?0:1),(!Pg||D)&&(e=e.transition().duration(P)),e.call(fg),Mi.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(gg),F)if(Vg&&Q){for(R=1;R=0&&mf.select(this).style("display",b%S?"none":"block")})}else mf.selectAll("."+f.axisX+" .tick text").style("display","block");if(I=Ee(T),K=Fe(T,!0),M=Fe(T,!1),Ab(),cg.domain(_f.domain()),dg.domain(ag.domain()),Pi.style("display","none"),o(),Mi.select("line."+f.xgridFocus).style("visibility","hidden"),uh){if("year"===vh){h=[];for(var W=Zb(),X=W[0].getFullYear(),Y=W[1].getFullYear(),Z=X;Y>=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=$f.ticks(10);g=Mi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Pg?0:function(a){return $f(a)-eg.tickOffset()}).attr("x2",Pg?Ff:function(a){return $f(a)-eg.tickOffset()}).attr("y1",Pg?function(a){return $f(a)-eg.tickOffset()}:Cf.top).attr("y2",Pg?function(a){return $f(a)-eg.tickOffset()}:Hf).style("opacity",function(){return+mf.select(this).attr(Pg?"y1":"x1")===(Pg?Hf:0)?0:1}),g.exit().remove()}ne(wh)&&(i=Mi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(wh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Pg?"":"rotate(-90)").attr("dx",Pg?0:-Cf.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Pg?0:vd).attr("x2",Pg?Ff:vd).attr("y1",Pg?vd:Cf.top).attr("y2",Pg?vd:Hf).style("opacity",1),i.select("text").transition().duration(N).attr("x",Pg?Ff:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&xh&&(k=Mi.select("."+f.ygrids).selectAll("."+f.ygrid).data(_f.ticks(zh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Pg?_f:0).attr("x2",Pg?_f:Ff).attr("y1",Pg?0:_f).attr("y2",Pg?Hf:_f),k.exit().remove()),y&&ne(yh)&&(l=Mi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(yh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Pg?"rotate(-90)":"").attr("dx",Pg?0:-Cf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Pg?wd:0).attr("x2",Pg?wd:Ff).attr("y1",Pg?0:wd).attr("y2",Pg?Hf:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Pg?0:Ff).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Mi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return oi(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Mi.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Pg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Mi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Gi).style("opacity",1),Mi.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Hi).style("opacity",Si),n=Mi.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",Bh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Pg?Md:Ld).attr("cy",Pg?Ld:Md),n.exit().remove(),Mi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=mf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Mi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Mi.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Ig&&(null!==mf.event&&"zoom"===mf.event.type&&Fi.extent($f.orgDomain()).update(),z&&(Ni.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(hg),Fi.empty()||Fi.extent($f.orgDomain()).update(),J=Ee(T,!0),s=Ni.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return oi(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Ni.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ii).style("opacity",1))),Mi.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Mi.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Pg?Md:Ld).attr("cy",Pg?Ld:Md),t=Mi.select("."+f.eventRects),ne(jg)&&!kc(jg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Mi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Ff).attr("height",Hf)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),ii&&!hi?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return($f(d?d:e+50)-$f(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return($f(d)+$f(c?c:d-50))/2}):(x=L(),w=function(a){return $f(a.x)-x/2}),v=wc(),Mi.select("."+f.eventRects).datum(v?v.values:[]),u=Mi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Pg?0:w).attr("y",Pg?w:0).attr("width",Pg?Ff:x).attr("height",Pg?x:Hf),u.exit().remove()),q=Mi.select("."+f.regions).selectAll("rect."+f.region).data(Uh),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Pg?0:cc).attr("y",Pg?cc:Cf.top).attr("width",Pg?Ff:dc).attr("height",Pg?dc:Hf).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),xc(nf.data.targets).forEach(function(a){Ti[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Ji.altDomain?($f.domain(Ji.altDomain),void Ji.scale($f).updateScaleExtent()):(hi&&$f.orgDomain()[0]===Ri[0]&&$f.domain([Ri[0]-1e-10,$f.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(li=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Ki.attr("width",Jf).attr("height",Kf),Ki.select("#"+ai).select("rect").attr("width",Ff).attr("height",Hf),Ki.select("#"+bi).select("rect").attr("width",H),Ki.select("#"+ci).select("rect").attr("width",J),Ki.select("."+f.zoomRect).attr("width",Ff).attr("height",Hf)}function We(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Mi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return oi(a)}),e=Mi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return oi(a)}).style("stroke","none").style("cursor",function(a){return zg(a)?"pointer":null}),c=Mi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return oi(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Si=+mf.select(this).style("opacity"),0}).style("fill",function(a){return oi(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return oi(a)}).style("cursor",function(a){return zg(a)?"pointer":null}),a.forEach(function(a){Mi.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Mi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Rf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return oi(a.data)}).style("cursor",function(a){return zg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Ig&&(n=Ni.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return oi(a)}),l=Ni.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return oi(a)})),Ki.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=yi?j:i,l=yi?Q():P();return d&&(w=0,C=0,t=0,u=0),Lg&&!Cc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=yi?u:t,void(Og?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,yi?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Oi.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Ng?Ng(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(mg[a])?mg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",yi?g:-200).attr("y",yi?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",yi?h:-200).attr("y",yi?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return oi(a)}).attr("x",yi?g:-200).attr("y",yi?-200:i).attr("width",10).attr("height",10),Oi.selectAll("text").data(a).text(function(a){return d(mg[a])?mg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Oi.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Oi.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["onresize"],function(){}),Af=h(["onresized"],function(){}),Bf=h(["transition","duration"],350);g("data","data is required in config");var Cf,Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig=h(["data","x"]),jg=h(["data","xs"],{}),kg=h(["data","x_format"]),lg=h(["data","id_converter"],function(a){return a}),mg=h(["data","names"],{}),ng=h(["data","classes"],{}),og=h(["data","groups"],[]),pg=h(["data","axes"],{}),qg=h(["data","type"]),rg=h(["data","types"],{}),sg=h(["data","labels"],{}),tg=h(["data","order"]),ug=h(["data","regions"],{}),vg=h(["data","color"]),wg=h(["data","colors"],{}),xg=h(["data","selection","enabled"],!1),yg=h(["data","selection","grouped"],!1),zg=h(["data","selection","isselectable"],function(){return!0}),Ag=h(["data","selection","multiple"],!0),Bg=h(["data","onclick"],function(){}),Cg=h(["data","onenter"],function(){}),Dg=h(["data","onleave"],function(){}),Eg=h(["data","onselected"],function(){}),Fg=h(["data","onunselected"],function(){}),Gg=h(["data","ondragstart"],function(){}),Hg=h(["data","ondragend"],function(){}),Ig=h(["subchart","show"],!1),Jg=Ig?h(["subchart","size","height"],60):0,Kg=h(["color","pattern"],[]),Lg=h(["legend","show"],!0),Mg=h(["legend","position"],"bottom"),Ng=h(["legend","item","onclick"]),Og=h(["legend","equally"],!1),Pg=h(["axis","rotated"],!1),Qg=h(["axis","x","type"],"indexed"),Rg=h(["axis","x","localtime"],!1),Sg=h(["axis","x","categories"],[]),Tg=h(["axis","x","tick","centered"],!1),Ug=h(["axis","x","tick","format"]),Vg=h(["axis","x","tick","culling"],{}),Wg=h(["axis","x","tick","culling","max"],10),Xg=h(["axis","x","tick","count"]),Yg=h(["axis","x","tick","fit"],!1),Zg=h(["axis","x","tick","values"],[]),$g=h(["axis","x","max"]),_g=h(["axis","x","min"]),ah=h(["axis","x","default"]),bh=h(["axis","x","label"],{}),ch=h(["axis","y","show"],!0),dh=h(["axis","y","max"]),eh=h(["axis","y","min"]),fh=h(["axis","y","center"]),gh=h(["axis","y","label"],{}),hh=h(["axis","y","inner"],!1),ih=h(["axis","y","tick","format"]),jh=h(["axis","y","padding"],{}),kh=h(["axis","y","ticks"],10),lh=h(["axis","y2","show"],!1),mh=h(["axis","y2","max"]),nh=h(["axis","y2","min"]),oh=h(["axis","y2","center"]),ph=h(["axis","y2","label"],{}),qh=h(["axis","y2","inner"],!1),rh=h(["axis","y2","tick","format"]),sh=h(["axis","y2","padding"],{}),th=h(["axis","y2","ticks"],10),uh=h(["grid","x","show"],!1),vh=h(["grid","x","type"],"tick"),wh=h(["grid","x","lines"],[]),xh=h(["grid","y","show"],!1),yh=h(["grid","y","lines"],[]),zh=h(["grid","y","ticks"],10),Ah=h(["point","show"],!0),Bh=Ah?h(["point","r"],2.5):0,Ch=h(["point","focus","line","enabled"],!0),Dh=h(["point","focus","expand","enabled"],!0),Eh=h(["point","focus","expand","r"],Dh?4:Bh),Fh=h(["point","focus","select","r"],8),Gh=h(["line","connect_null"],!1),Hh=h(["bar","width"]),Ih=h(["bar","width","ratio"],.6),Jh=h(["pie","label","show"],!0),Kh=h(["pie","label","format"]),Lh=h(["pie","onclick"],function(){}),Mh=h(["pie","onmouseover"],function(){}),Nh=h(["pie","onmouseout"],function(){}),Oh=h(["donut","label","show"],!0),Ph=h(["donut","label","format"]),Qh=h(["donut","title"],""),Rh=h(["donut","onclick"],function(){}),Sh=h(["donut","onmouseover"],function(){}),Th=h(["donut","onmouseout"],function(){}),Uh=h(["regions"],[]),Vh=h(["tooltip","show"],!0),Wh=h(["tooltip","format","title"]),Xh=h(["tooltip","format","value"]),Yh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Wh?Wh:b,l=Xh?Xh:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Zh=h(["tooltip","init","show"],!1),$h=h(["tooltip","init","x"],0),_h=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ai=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",bi=ai+"-xaxis",ci=ai+"-yaxis",di=i(ai),ei=i(bi),fi=i(ci),gi="timeseries"===Qg,hi="categorized"===Qg,ii=!gi&&(ig||ne(jg)),ji=null,ki=!1,li=!1,mi=!1,ni=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],oi=he(wg,ne(Kg)?Kg:ni,vg),pi=Rg?mf.time.format:mf.time.format.utc,qi=function(){var a=[[pi("%Y/%-m/%-d"),function(){return!0}],[pi("%-m/%-d"),function(a){return a.getMonth()}],[pi("%-m/%-d"),function(a){return 1!==a.getDate()}],[pi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[pi("%I %p"),function(a){return a.getHours()}],[pi("%I:%M"),function(a){return a.getMinutes()}],[pi(":%S"),function(a){return a.getSeconds()}],[pi(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),ri=[],si=[],ti=Pg?"left":"bottom",ui=Pg?hh?"top":"bottom":hh?"right":"left",vi=Pg?qh?"bottom":"top":qh?"left":"right",wi=Pg?"left":"bottom",xi={main:function(){return"translate("+Cf.left+","+Cf.top+")"},context:function(){return"translate("+Df.left+","+Df.top+")"},legend:function(){return"translate("+Ef.left+","+Ef.top+")"},x:function(){return"translate(0,"+(Pg?0:Hf)+")"},y:function(){return"translate(0,"+(Pg?Hf:0)+")"},y2:function(){return"translate("+(Pg?0:Ff)+","+(Pg?1:0)+")"},subx:function(){return"translate(0,"+(Pg?0:If)+")"},arc:function(){return"translate("+Ff/2+","+Hf/2+")"}},yi="right"===Mg,zi=0,Ai=0,Bi=0,Ci=30,Di=30,Ei=5;Rf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Fi,Gi=function(){var a=mf.svg.line().x(Pg?function(a){return V(a.id)(a.value)}:ud).y(Pg?ud:function(a){return V(a.id)(a.value)});return Gh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Gh?xe(b.values):b.values;return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),ug[b.id]?Je(e,$f,V(b.id),ug[b.id]):a(e)):(c=e[0]?$f(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Pg?"M "+d+" "+c:"M "+c+" "+d)}}(),Hi=function(){var a;return a=Pg?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?$f(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Pg?"M "+d+" "+c:"M "+c+" "+d)}}(),Ii=function(){var a=mf.svg.line().x(Pg?function(a){return W(a.id)(a.value)}:xd).y(Pg?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+bg(c[0].x)+" "+W(b.id)(c[0].value)}}(),Ji=function(){};Fi=mf.svg.brush().on("brush",Se),Fi.update=function(){return Ni&&Ni.select("."+f.brush).call(this),this},Fi.scale=function(a){return Pg?this.y(a):this.x(a)},uf&&(Ji=mf.behavior.zoom().on("zoomstart",function(){Ji.altDomain=mf.event.sourceEvent.altKey?$f.orgDomain():null}).on("zoom",uf?Te:null),Ji.scale=function(a){return Pg?this.y(a):this.x(a)},Ji.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Ji.updateScaleExtent=function(){var a=$b($f.orgDomain())/$b(Ri),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Ki,Li,Mi,Ni,Oi,Pi,Qi,Ri,Si,Ti={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ki.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Ki.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ki.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Ki.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Oi.selectAll(kd(a)).classed(f.legendItemHidden,!1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Ki.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Oi.selectAll(kd(a)).classed(f.legendItemHidden,!0),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){Fi.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){ng[b]=a.classes[b]}),"categories"in a&&hi&&(Sg=a.categories,eg.categories(Sg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Mi.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){xg&&Mi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=yg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?zg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){xg&&Mi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=yg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&zg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?og:(og=a,Re(),og)},nf.xgrids=function(a){return a?(wh=a,Re(),wh):wh},nf.xgrids.add=function(a){return a?nf.xgrids(wh.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(wh.filter(b))},nf.ygrids=function(a){return a?(yh=a,Re(),yh):yh},nf.ygrids.add=function(a){return a?nf.ygrids(yh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(yh.filter(b))},nf.regions=function(a){return c(a)?Uh:(Uh=a,Re(),Uh)},nf.regions.add=function(a){return c(a)?Uh:(Uh=Uh.concat(a),Re(),Uh)},nf.regions.remove=function(a,c){var e=[].concat(a);return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;Ki.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Uh=Uh.filter(function(b){return b.classes.indexOf(a)<0 +})}),Uh},nf.data.get=function(a){var b=nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},nf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){mg[b]=a[b]}),gf(xc(nf.data.targets),{withTransition:!0}),mg):mg},nf.x=function(a){return arguments.length&&(mc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.xs=function(a){return arguments.length&&(nc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(dh=+a.y),b(a.y2)&&(mh=+a.y2)):dh=mh=+a,Re())},nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(eh=+a.y),b(a.y2)&&(nh=+a.y2)):eh=nh=+a,Re())},nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&nf.axis.max(a.max),"undefined"!=typeof a.min&&nf.axis.min(a.min))},nf.legend.show=function(a){Lg||(Lg=!0,Oi.style("visibility","visible")),ef(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.legend.hide=function(a){Lg&&me(a)&&(Lg=!1,Oi.style("visibility","hidden")),ff(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.resize=function(a){qf=a?a.width:null,rf=a?a.height:null,We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},nf.destroy=function(){nf.data.targets=void 0,nf.data.xs={},Qi.html(""),a.onresize=null},"url"in e.data)mf.xhr(e.data.url,function(a,b){var c,d=mf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=mf.csv.parse(b.response),Ke(c)});else if("rows"in e.data)Ke(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ke(qc(e.data.columns))}return nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From c4cac6aa4f09ff3869913f22ce29cb1336d5a895 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Sun, 13 Apr 2014 08:43:41 +0900 Subject: [PATCH 041/178] Fix tick values - #146 --- c3.js | 2 +- c3.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/c3.js b/c3.js index ae985d7..8ac2d87 100644 --- a/c3.js +++ b/c3.js @@ -173,7 +173,7 @@ __axis_x_tick_culling_max = getConfig(['axis', 'x', 'tick', 'culling', 'max'], 10), __axis_x_tick_count = getConfig(['axis', 'x', 'tick', 'count']), __axis_x_tick_fit = getConfig(['axis', 'x', 'tick', 'fit'], false), - __axis_x_tick_values = getConfig(['axis', 'x', 'tick', 'values'], []), + __axis_x_tick_values = getConfig(['axis', 'x', 'tick', 'values'], null), __axis_x_max = getConfig(['axis', 'x', 'max']), __axis_x_min = getConfig(['axis', 'x', 'min']), __axis_x_default = getConfig(['axis', 'x', 'default']), diff --git a/c3.min.js b/c3.min.js index 9c998ab..a20e152 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ !function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.30"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cFf&&(Ff=0),0>Hf&&(Hf=0),Df={top:Pg?Cf.top:Kf-Jg-(yi?0:a),right:0/0,bottom:20+(yi?0:a),left:Pg?Ci:Cf.left},Gf=Pg?Cf.left-Ci-Di:Ff,If=Pg?Hf:Kf-Df.top-Df.bottom,0>Gf&&(Gf=0),0>If&&(If=0),Ef={top:yi?0:Kf-a,right:0/0,bottom:0,left:yi?Jf-b:0},p(),yi&&Yd(nf.data.targets)&&(Ef.left=Ff/2+Mf)}function o(){Mi.select("line."+f.xgridFocus).attr("x1",Pg?0:-10).attr("x2",Pg?Ff:-10).attr("y1",Pg?-10:Cf.top).attr("y2",Pg?-10:Hf)}function p(){Mf=Hf/2,Lf=.95*Mf,Nf=Xd(nf.data.targets)?.6*Lf:0}function q(){var a=Pg?f.axisX:f.axisY,b=mf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=mf.select(pf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return qf?qf:x()}function s(){var a=rf?rf:y();return a>0?a:320}function t(){return Yd(nf.data.targets)?0:sf?sf:Pg||!ch||hh?1:v("y")}function u(){var a=1;return Yd(nf.data.targets)?0:tf?tf:yi?P()+(lh&&!Pg?v("y2"):a):lh?qh||Pg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||ch?"y2"!==a||lh?(gb(a).isInner?30:40)+("y2"===a?-10:0):Ei:Lg&&!yi?10:1}function x(){return+mf.select(pf).style("width").replace("px","")}function y(){return+mf.select(pf).style("height").replace("px","")}function z(a){return a?-5:-(Cf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Pg)}function C(){return A(!Pg)}function D(){return z(Pg)}function E(){return A(Pg)}function F(a){return a?Ff+2+4:Cf.left+20}function G(a){return a?80:Hf+2}function H(){return F(!Pg)}function I(){return G(!Pg)}function J(){return F(Pg)}function K(){return G(Pg)}function L(){var a=Pg?Hf:Ff,b=vc(),c=Vb()*(Ud(nf.data.targets)?(b-(hi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){zi=a}function N(a){Ai=a}function O(a){Bi=a}function P(){return Lg?yi?Ai*(zi+1):Jf:0}function Q(){return Lg?yi?Kf:Bi*(zi+1):0}function R(){var a,b=!$f;Sf=Pg?1:0,Tf=Pg?Hf:Ff,Uf=Pg?0:Hf,Vf=Pg?Ff:1,Wf=Sf,Xf=Tf,Yf=Pg?0:If,Zf=Pg?Gf:1,$f=T(Sf,Tf,b?void 0:$f.domain(),function(){return eg.tickOffset()}),_f=U(Uf,Vf),ag=U(Uf,Vf),bg=T(Sf,Tf,Ri,function(a){return a%1?0:hg.tickOffset()}),cg=U(Yf,Zf),dg=U(Yf,Zf),a=$(),eg=X($f,ti,a),hg=X(bg,wi,a),fg=Y(_f,ui,ih,kh),gg=Y(ag,vi,rh,th),b||(Fi.scale(bg),uf&&Ji.scale($f)),S()}function S(){Of=Db(),Pf=Eb(),Qf=Eb(.98)}function T(a,b,e,f){var g=(gi?mf.time.scale():mf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),hi){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return mf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?ag:_f}function W(a){return"y2"===Z(a)?dg:cg}function X(a,b,c){var d=(hi?Bb():mf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),hi?(d.tickCentered(Tg),me(Vg)&&(Vg=!1)):d.tickOffset=function(){var a=Pg?Hf:Ff;return a*Vb()/vc()/2},hi&&d.categories(Sg),d}function Y(a,b,c,d){return mf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in pg?pg[a]:"y"}function $(){var a=gi?qi:hi?Oc:function(a){return 0>a?a.toFixed(0):a};return Ug&&("function"==typeof Ug?a=Ug:gi&&(a=function(a){return pi(Ug)(a)})),a}function _(a){var b;return"y"===a?b=gh:"y2"===a?b=ph:"x"===a&&(b=bh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?gh=b:"y2"===a?ph=b:"x"===a&&(bh=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Pg?"inner-top":"inner-right")}function eb(){return cb("y",Pg?"inner-right":"inner-top")}function fb(){return cb("y2",Pg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?Ff/2:Ff:b.isBottom?-Hf:b.isMiddle?-Hf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Pg,db())}function ob(){return kb(Pg,eb())}function pb(){return kb(Pg,fb())}function qb(){return lb(!Pg,db())}function rb(){return lb(Pg,eb())}function sb(){return lb(Pg,fb())}function tb(){var a=db();return Pg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Pg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Pg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Pg,db())}function xb(){return mb(Pg,eb())}function yb(){return mb(Pg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Mi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Mi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Mi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+o)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Mc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return mf.min(Object.keys(i).map(function(a){return mf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(og.length>0)for(g=Nc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return mf.max(Object.keys(i).map(function(a){return mf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?nh:eh,n="y2"===c?mh:dh,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?oh:fh,r=pd()&&Pg;return 0===l.length?"y2"===c?ag.domain():_f.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=qd(o,p),j=$b(_f.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&jh&&(f=b(jh.top)?jh.top:e,g=b(jh.bottom)?jh.bottom:e),"y2"===c&&sh&&(f=b(sh.top)?sh.top:e,g=b(sh.bottom)?sh.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Ri),c=$b($f.domain());return a||0===c?1:b/c}function Wb(a){return _g?_g:mf.min(a,function(a){return mf.min(a.values,function(a){return a.x})})}function Xb(a){return $g?$g:mf.max(a,function(a){return mf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return hi?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=0,g=0;return(c||0===c)&&(f=gi?new Date(c.getTime()-e):c-e),(d||0===d)&&(g=gi?new Date(d.getTime()+e):d+e),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return ig&&a===ig||ne(jg)&&oe(jg,a)}function fc(a){return!ec(a)}function gc(a){return ig?ig:ne(jg)?jg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=nf.data.xs[b])}),c}function ic(a,b){return a in nf.data.xs&&nf.data.xs[a]&&nf.data.xs[a][b]?nf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){jg[b]=a[b]})}function kc(a){return 1===mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=mg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),nf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=gi?a?a instanceof Date?a:ie(a):ie(ic(b,c)):ii&&!hi?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):ig?(d=Object.keys(nf.data.xs),nf.data.xs[c]=d.length>0?nf.data.xs[d[0]]:void 0):ne(jg)&&(nf.data.xs[c]=hc(f,nf.data.targets)):nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=lg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return ii&&hi&&0===c&&g&&(0===e&&(Sg=[]),Sg.push(g)),("undefined"==typeof a[b]||nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),qg&&Sd(xc(c).filter(function(a){return!(a in rg)}),qg),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function tc(a){return a>0&&nf.data.targets[0].values[a-1]?nf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?nf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?nf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(nf.data.targets)}function zc(a,b){var c,d=xc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(gi?new Date(h):h);i.push(d)}return gi||(i=i.sort(function(a,b){return a-b})),i}function Gc(a){ri=ri.concat(a)}function Hc(a){ri=ri.filter(function(b){return a.indexOf(b)<0})}function Ic(a){si=si.concat(a)}function Jc(a){si=si.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Ed(){return tg&&"desc"===tg.toLowerCase()}function Fd(){return tg&&"asc"===tg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof tg&&a.sort(tg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(nf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Vh&&0!==m.length&&(Pi.html(Yh(a,$(),l,oi)).style("display","block"),d=Pi.property("offsetWidth"),e=Pi.property("offsetHeight"),k?(g=Ff/2+c[0],i=Hf/2+c[1]+20):(Pg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=$f(m[0].x)+20):(f=q(),g=f+t()+$f(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Pi.style("top",i+"px").style("left",g+"px"))}function Id(){Pi.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Vh&&(Vd(nf.data.targets)||Yd(nf.data.targets)||Mi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Pg?"y1":"x1",ud).attr(Pg?"y2":"x2",ud))}function Kd(){Mi.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?$f(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Hh?Hh:b?2*a.tickOffset()*Ih/b:0}function Sd(a,b){yc(a).forEach(function(a){Ti[a]=b===rg[a],rg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){rg[a.id]===b&&(c=!0),a.id in rg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in rg)||"line"===rg[b]||"spline"===rg[b]||"area"===rg[b]||"area-spline"===rg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===rg[b]||"area-spline"===rg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===rg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===rg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===rg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===rg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ie(b){var c;try{c=kg?mf.time.format(kg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+kg)}return c}function je(a,b){var c=mf.mouse(a),d=mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?_f:ag,d=Pg?1:0,e=Pg?0:1;return Math.pow($f(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Eg(b,a.node()),Mi.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Pg?Md:Ld).attr("cy",Pg?Ld:Md).attr("stroke",function(){return oi(b)}).attr("r",1.4*Fh).transition().duration(100).attr("r",Fh)}function se(a,b,c){Fg(b,a.node()),Mi.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Eg(b,a.node()),a.transition().duration(100).style("fill",function(){return mf.rgb(oi(b)).darker(1)})}function ve(a,b){Fg(b,a.node()),a.transition().duration(100).style("fill",function(){return oi(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Mi.selectAll("."+f.circles+gd(c)):Mi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",Eh)}function Ae(a){ye(a).filter(function(){return mf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Bh)}function Be(a){return Mi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Pg?1:0,f=Pg?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Pg?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBoundingClientRect();return Pg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(eg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Pg&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Je(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function Ke(b){var c,d,e;if(Qi=mf.select(pf),Qi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Qi.html(""),Qi.classed("c3",!0),nf.data.xs={},nf.data.targets=rc(b),n(),R(),$f.domain(mf.extent(Zb(nf.data.targets))),_f.domain(Ub(nf.data.targets,"y")),ag.domain(Ub(nf.data.targets,"y2")),bg.domain($f.domain()),cg.domain(_f.domain()),dg.domain(ag.domain()),Ri=$f.domain(),Fi.scale(bg),uf&&Ji.scale($f),Ki=Qi.append("svg").attr("width",Ff+Cf.left+Cf.right).attr("height",Hf+Cf.top+Cf.bottom).on("mouseenter",xf).on("mouseleave",yf),Li=Ki.append("defs"),Li.append("clipPath").attr("id",ai).append("rect").attr("width",Ff).attr("height",Hf),Li.append("clipPath").attr("id",bi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Li.append("clipPath").attr("id",ci).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Mi=Ki.append("g").attr("transform",xi.main),Ni=Ig?Ki.append("g").attr("transform",xi.context):null,Oi=Ki.append("g").attr("transform",xi.legend),Lg||(Oi.style("visibility","hidden"),si=xc(nf.data.targets)),Pi=mf.select(pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),gf(xc(nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Mi.append("g").attr("class",f.axisX).attr("clip-path",Pg?"":ei).attr("transform",xi.x).append("text").attr("class",f.axisXLabel).attr("transform",Pg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),ch&&Mi.append("g").attr("class",f.axisY).attr("clip-path",Pg?fi:"").attr("transform",xi.y).append("text").attr("class",f.axisYLabel).attr("transform",Pg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),lh&&Mi.append("g").attr("class",f.axisY2).attr("transform",xi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Pg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Mi.append("g").attr("clip-path",di).attr("class",f.grid),uh&&d.append("g").attr("class",f.xgrids),ne(wh)&&d.append("g").attr("class",f.xgridLines),Ch&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),xh&&d.append("g").attr("class",f.ygrids),ne(yh)&&d.append("g").attr("class",f.ygridLines),Mi.append("g").attr("clip-path",di).attr("class",f.regions),Mi.append("g").attr("clip-path",di).attr("class",f.chart),c=Mi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",uf?Pg?"ns-resize":"ew-resize":null),Mi.select("."+f.chart).append("g").attr("class",f.chartBars),Mi.select("."+f.chart).append("g").attr("class",f.chartLines),Mi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",xi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Mi.select("."+f.chart).append("g").attr("class",f.chartTexts),uf&&Mi.insert("rect",wf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Ff).attr("height",Hf).style("opacity",0).style("cursor",Pg?"ns-resize":"ew-resize").call(Ji).on("dblclick.zoom",null),ah&&Fi.extent("function"!=typeof ah?ah:ah(Zb())),Ig&&(Ni.append("g").attr("clip-path",di).attr("class",f.chart),Ni.select("."+f.chart).append("g").attr("class",f.chartBars),Ni.select("."+f.chart).append("g").attr("class",f.chartLines),Ni.append("g").attr("clip-path",di).attr("class",f.brush).call(Fi).selectAll("rect").attr(Pg?"width":"height",Pg?Gf:If),Ni.append("g").attr("class",f.axisX).attr("transform",xi.subx).attr("clip-path",Pg?"":ei)),Xe(nf.data.targets),Pg?Mi.select("."+f.axisX).style("opacity",0).call(eg):(Mi.select("."+f.axisY).style("opacity",0).call(fg),Mi.select("."+f.axisY2).style("opacity",0).call(gg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Zh){if(gi&&"string"==typeof $h){for($h=ie($h),e=0;e0){d=[];for(var g in mg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function Pe(a){Yd(nf.data.targets)||xg&&(ji=a,Mi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),ki=!0,Gg())}function Qe(){Yd(nf.data.targets)||xg&&(Mi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Mi.selectAll("."+f.shape).classed(f.INCLUDED,!1),ki=!1,Hg())}function Re(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Nd(),U=Yd(nf.data.targets),V=Dc(nf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?Bf:0,O=B?N:0,P=C?N:0,H&&Lg&&gf(xc(nf.data.targets),a),G&&($f.domain(mf.extent(Zb(V))),Ri=$f.domain(),uf&&Ji.scale($f).updateScaleExtent(),bg.domain($f.domain()),Fi.scale(bg)),F&&($f.domain(Fi.empty()?Ri:Fi.extent()),uf&&Ji.scale($f).updateScaleExtent()),_f.domain(Ub(V,"y")),ag.domain(Ub(V,"y2")),Vd(V)||(Q=Zg?Zg:Fc(Ec(V)),eg.tickValues(Q),hg.tickValues(Q)),c=Mi.select("."+f.axisX).style("opacity",U?0:1),(Pg||D)&&(c=c.transition().duration(P)),c.call(eg),e=Mi.select("."+f.axisY).style("opacity",U?0:1),(!Pg||D)&&(e=e.transition().duration(P)),e.call(fg),Mi.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(gg),F)if(Vg&&Q){for(R=1;R=0&&mf.select(this).style("display",b%S?"none":"block")})}else mf.selectAll("."+f.axisX+" .tick text").style("display","block");if(I=Ee(T),K=Fe(T,!0),M=Fe(T,!1),Ab(),cg.domain(_f.domain()),dg.domain(ag.domain()),Pi.style("display","none"),o(),Mi.select("line."+f.xgridFocus).style("visibility","hidden"),uh){if("year"===vh){h=[];for(var W=Zb(),X=W[0].getFullYear(),Y=W[1].getFullYear(),Z=X;Y>=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=$f.ticks(10);g=Mi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Pg?0:function(a){return $f(a)-eg.tickOffset()}).attr("x2",Pg?Ff:function(a){return $f(a)-eg.tickOffset()}).attr("y1",Pg?function(a){return $f(a)-eg.tickOffset()}:Cf.top).attr("y2",Pg?function(a){return $f(a)-eg.tickOffset()}:Hf).style("opacity",function(){return+mf.select(this).attr(Pg?"y1":"x1")===(Pg?Hf:0)?0:1}),g.exit().remove()}ne(wh)&&(i=Mi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(wh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Pg?"":"rotate(-90)").attr("dx",Pg?0:-Cf.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Pg?0:vd).attr("x2",Pg?Ff:vd).attr("y1",Pg?vd:Cf.top).attr("y2",Pg?vd:Hf).style("opacity",1),i.select("text").transition().duration(N).attr("x",Pg?Ff:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&xh&&(k=Mi.select("."+f.ygrids).selectAll("."+f.ygrid).data(_f.ticks(zh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Pg?_f:0).attr("x2",Pg?_f:Ff).attr("y1",Pg?0:_f).attr("y2",Pg?Hf:_f),k.exit().remove()),y&&ne(yh)&&(l=Mi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(yh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Pg?"rotate(-90)":"").attr("dx",Pg?0:-Cf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Pg?wd:0).attr("x2",Pg?wd:Ff).attr("y1",Pg?0:wd).attr("y2",Pg?Hf:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Pg?0:Ff).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Mi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return oi(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Mi.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Pg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Mi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Gi).style("opacity",1),Mi.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Hi).style("opacity",Si),n=Mi.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",Bh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Pg?Md:Ld).attr("cy",Pg?Ld:Md),n.exit().remove(),Mi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=mf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Mi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Mi.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Ig&&(null!==mf.event&&"zoom"===mf.event.type&&Fi.extent($f.orgDomain()).update(),z&&(Ni.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(hg),Fi.empty()||Fi.extent($f.orgDomain()).update(),J=Ee(T,!0),s=Ni.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return oi(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Ni.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ii).style("opacity",1))),Mi.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Mi.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Pg?Md:Ld).attr("cy",Pg?Ld:Md),t=Mi.select("."+f.eventRects),ne(jg)&&!kc(jg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Mi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Ff).attr("height",Hf)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),ii&&!hi?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return($f(d?d:e+50)-$f(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return($f(d)+$f(c?c:d-50))/2}):(x=L(),w=function(a){return $f(a.x)-x/2}),v=wc(),Mi.select("."+f.eventRects).datum(v?v.values:[]),u=Mi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Pg?0:w).attr("y",Pg?w:0).attr("width",Pg?Ff:x).attr("height",Pg?x:Hf),u.exit().remove()),q=Mi.select("."+f.regions).selectAll("rect."+f.region).data(Uh),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Pg?0:cc).attr("y",Pg?cc:Cf.top).attr("width",Pg?Ff:dc).attr("height",Pg?dc:Hf).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),xc(nf.data.targets).forEach(function(a){Ti[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Ji.altDomain?($f.domain(Ji.altDomain),void Ji.scale($f).updateScaleExtent()):(hi&&$f.orgDomain()[0]===Ri[0]&&$f.domain([Ri[0]-1e-10,$f.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(li=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Ki.attr("width",Jf).attr("height",Kf),Ki.select("#"+ai).select("rect").attr("width",Ff).attr("height",Hf),Ki.select("#"+bi).select("rect").attr("width",H),Ki.select("#"+ci).select("rect").attr("width",J),Ki.select("."+f.zoomRect).attr("width",Ff).attr("height",Hf)}function We(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Mi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return oi(a)}),e=Mi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return oi(a)}).style("stroke","none").style("cursor",function(a){return zg(a)?"pointer":null}),c=Mi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return oi(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Si=+mf.select(this).style("opacity"),0}).style("fill",function(a){return oi(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return oi(a)}).style("cursor",function(a){return zg(a)?"pointer":null}),a.forEach(function(a){Mi.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Mi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Rf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return oi(a.data)}).style("cursor",function(a){return zg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Ig&&(n=Ni.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return oi(a)}),l=Ni.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return oi(a)})),Ki.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=yi?j:i,l=yi?Q():P();return d&&(w=0,C=0,t=0,u=0),Lg&&!Cc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=yi?u:t,void(Og?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,yi?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Oi.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Ng?Ng(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(mg[a])?mg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",yi?g:-200).attr("y",yi?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",yi?h:-200).attr("y",yi?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return oi(a)}).attr("x",yi?g:-200).attr("y",yi?-200:i).attr("width",10).attr("height",10),Oi.selectAll("text").data(a).text(function(a){return d(mg[a])?mg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Oi.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Oi.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["onresize"],function(){}),Af=h(["onresized"],function(){}),Bf=h(["transition","duration"],350);g("data","data is required in config");var Cf,Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig=h(["data","x"]),jg=h(["data","xs"],{}),kg=h(["data","x_format"]),lg=h(["data","id_converter"],function(a){return a}),mg=h(["data","names"],{}),ng=h(["data","classes"],{}),og=h(["data","groups"],[]),pg=h(["data","axes"],{}),qg=h(["data","type"]),rg=h(["data","types"],{}),sg=h(["data","labels"],{}),tg=h(["data","order"]),ug=h(["data","regions"],{}),vg=h(["data","color"]),wg=h(["data","colors"],{}),xg=h(["data","selection","enabled"],!1),yg=h(["data","selection","grouped"],!1),zg=h(["data","selection","isselectable"],function(){return!0}),Ag=h(["data","selection","multiple"],!0),Bg=h(["data","onclick"],function(){}),Cg=h(["data","onenter"],function(){}),Dg=h(["data","onleave"],function(){}),Eg=h(["data","onselected"],function(){}),Fg=h(["data","onunselected"],function(){}),Gg=h(["data","ondragstart"],function(){}),Hg=h(["data","ondragend"],function(){}),Ig=h(["subchart","show"],!1),Jg=Ig?h(["subchart","size","height"],60):0,Kg=h(["color","pattern"],[]),Lg=h(["legend","show"],!0),Mg=h(["legend","position"],"bottom"),Ng=h(["legend","item","onclick"]),Og=h(["legend","equally"],!1),Pg=h(["axis","rotated"],!1),Qg=h(["axis","x","type"],"indexed"),Rg=h(["axis","x","localtime"],!1),Sg=h(["axis","x","categories"],[]),Tg=h(["axis","x","tick","centered"],!1),Ug=h(["axis","x","tick","format"]),Vg=h(["axis","x","tick","culling"],{}),Wg=h(["axis","x","tick","culling","max"],10),Xg=h(["axis","x","tick","count"]),Yg=h(["axis","x","tick","fit"],!1),Zg=h(["axis","x","tick","values"],[]),$g=h(["axis","x","max"]),_g=h(["axis","x","min"]),ah=h(["axis","x","default"]),bh=h(["axis","x","label"],{}),ch=h(["axis","y","show"],!0),dh=h(["axis","y","max"]),eh=h(["axis","y","min"]),fh=h(["axis","y","center"]),gh=h(["axis","y","label"],{}),hh=h(["axis","y","inner"],!1),ih=h(["axis","y","tick","format"]),jh=h(["axis","y","padding"],{}),kh=h(["axis","y","ticks"],10),lh=h(["axis","y2","show"],!1),mh=h(["axis","y2","max"]),nh=h(["axis","y2","min"]),oh=h(["axis","y2","center"]),ph=h(["axis","y2","label"],{}),qh=h(["axis","y2","inner"],!1),rh=h(["axis","y2","tick","format"]),sh=h(["axis","y2","padding"],{}),th=h(["axis","y2","ticks"],10),uh=h(["grid","x","show"],!1),vh=h(["grid","x","type"],"tick"),wh=h(["grid","x","lines"],[]),xh=h(["grid","y","show"],!1),yh=h(["grid","y","lines"],[]),zh=h(["grid","y","ticks"],10),Ah=h(["point","show"],!0),Bh=Ah?h(["point","r"],2.5):0,Ch=h(["point","focus","line","enabled"],!0),Dh=h(["point","focus","expand","enabled"],!0),Eh=h(["point","focus","expand","r"],Dh?4:Bh),Fh=h(["point","focus","select","r"],8),Gh=h(["line","connect_null"],!1),Hh=h(["bar","width"]),Ih=h(["bar","width","ratio"],.6),Jh=h(["pie","label","show"],!0),Kh=h(["pie","label","format"]),Lh=h(["pie","onclick"],function(){}),Mh=h(["pie","onmouseover"],function(){}),Nh=h(["pie","onmouseout"],function(){}),Oh=h(["donut","label","show"],!0),Ph=h(["donut","label","format"]),Qh=h(["donut","title"],""),Rh=h(["donut","onclick"],function(){}),Sh=h(["donut","onmouseover"],function(){}),Th=h(["donut","onmouseout"],function(){}),Uh=h(["regions"],[]),Vh=h(["tooltip","show"],!0),Wh=h(["tooltip","format","title"]),Xh=h(["tooltip","format","value"]),Yh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Wh?Wh:b,l=Xh?Xh:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Zh=h(["tooltip","init","show"],!1),$h=h(["tooltip","init","x"],0),_h=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ai=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",bi=ai+"-xaxis",ci=ai+"-yaxis",di=i(ai),ei=i(bi),fi=i(ci),gi="timeseries"===Qg,hi="categorized"===Qg,ii=!gi&&(ig||ne(jg)),ji=null,ki=!1,li=!1,mi=!1,ni=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],oi=he(wg,ne(Kg)?Kg:ni,vg),pi=Rg?mf.time.format:mf.time.format.utc,qi=function(){var a=[[pi("%Y/%-m/%-d"),function(){return!0}],[pi("%-m/%-d"),function(a){return a.getMonth()}],[pi("%-m/%-d"),function(a){return 1!==a.getDate()}],[pi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[pi("%I %p"),function(a){return a.getHours()}],[pi("%I:%M"),function(a){return a.getMinutes()}],[pi(":%S"),function(a){return a.getSeconds()}],[pi(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),ri=[],si=[],ti=Pg?"left":"bottom",ui=Pg?hh?"top":"bottom":hh?"right":"left",vi=Pg?qh?"bottom":"top":qh?"left":"right",wi=Pg?"left":"bottom",xi={main:function(){return"translate("+Cf.left+","+Cf.top+")"},context:function(){return"translate("+Df.left+","+Df.top+")"},legend:function(){return"translate("+Ef.left+","+Ef.top+")"},x:function(){return"translate(0,"+(Pg?0:Hf)+")"},y:function(){return"translate(0,"+(Pg?Hf:0)+")"},y2:function(){return"translate("+(Pg?0:Ff)+","+(Pg?1:0)+")"},subx:function(){return"translate(0,"+(Pg?0:If)+")"},arc:function(){return"translate("+Ff/2+","+Hf/2+")"}},yi="right"===Mg,zi=0,Ai=0,Bi=0,Ci=30,Di=30,Ei=5;Rf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Fi,Gi=function(){var a=mf.svg.line().x(Pg?function(a){return V(a.id)(a.value)}:ud).y(Pg?ud:function(a){return V(a.id)(a.value)});return Gh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Gh?xe(b.values):b.values;return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),ug[b.id]?Je(e,$f,V(b.id),ug[b.id]):a(e)):(c=e[0]?$f(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Pg?"M "+d+" "+c:"M "+c+" "+d)}}(),Hi=function(){var a;return a=Pg?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?$f(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Pg?"M "+d+" "+c:"M "+c+" "+d)}}(),Ii=function(){var a=mf.svg.line().x(Pg?function(a){return W(a.id)(a.value)}:xd).y(Pg?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+bg(c[0].x)+" "+W(b.id)(c[0].value)}}(),Ji=function(){};Fi=mf.svg.brush().on("brush",Se),Fi.update=function(){return Ni&&Ni.select("."+f.brush).call(this),this},Fi.scale=function(a){return Pg?this.y(a):this.x(a)},uf&&(Ji=mf.behavior.zoom().on("zoomstart",function(){Ji.altDomain=mf.event.sourceEvent.altKey?$f.orgDomain():null}).on("zoom",uf?Te:null),Ji.scale=function(a){return Pg?this.y(a):this.x(a)},Ji.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Ji.updateScaleExtent=function(){var a=$b($f.orgDomain())/$b(Ri),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Ki,Li,Mi,Ni,Oi,Pi,Qi,Ri,Si,Ti={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ki.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Ki.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ki.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Ki.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Oi.selectAll(kd(a)).classed(f.legendItemHidden,!1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Ki.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Oi.selectAll(kd(a)).classed(f.legendItemHidden,!0),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){Fi.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){ng[b]=a.classes[b]}),"categories"in a&&hi&&(Sg=a.categories,eg.categories(Sg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Mi.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){xg&&Mi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=yg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?zg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){xg&&Mi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=yg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&zg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?og:(og=a,Re(),og)},nf.xgrids=function(a){return a?(wh=a,Re(),wh):wh},nf.xgrids.add=function(a){return a?nf.xgrids(wh.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(wh.filter(b))},nf.ygrids=function(a){return a?(yh=a,Re(),yh):yh},nf.ygrids.add=function(a){return a?nf.ygrids(yh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(yh.filter(b))},nf.regions=function(a){return c(a)?Uh:(Uh=a,Re(),Uh)},nf.regions.add=function(a){return c(a)?Uh:(Uh=Uh.concat(a),Re(),Uh)},nf.regions.remove=function(a,c){var e=[].concat(a);return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;Ki.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Uh=Uh.filter(function(b){return b.classes.indexOf(a)<0 +}Pi.html(Yh(nf.data.targets.map(function(a){return lc(a.values[$h])}),$(),rd,oi)),Pi.style("top",_h.top).style("left",_h.left).style("display","block")}null==a.onresize&&(a.onresize=Ue()),a.onresize.add&&(a.onresize.add(zf),a.onresize.add(function(){We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})}),a.onresize.add(Af))}function Le(a){a.append("rect").attr("class",ad).style("cursor",xg&&yg?"pointer":null).on("mouseover",function(a,b){if(!ki&&!Yd(nf.data.targets)){var c,d,e=nf.data.targets.map(function(a){return lc(a.values[b])});if(Object.keys(mg).length>0){d=[];for(var g in mg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function Pe(a){Yd(nf.data.targets)||xg&&(ji=a,Mi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),ki=!0,Gg())}function Qe(){Yd(nf.data.targets)||xg&&(Mi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Mi.selectAll("."+f.shape).classed(f.INCLUDED,!1),ki=!1,Hg())}function Re(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Nd(),U=Yd(nf.data.targets),V=Dc(nf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?Bf:0,O=B?N:0,P=C?N:0,H&&Lg&&gf(xc(nf.data.targets),a),G&&($f.domain(mf.extent(Zb(V))),Ri=$f.domain(),uf&&Ji.scale($f).updateScaleExtent(),bg.domain($f.domain()),Fi.scale(bg)),F&&($f.domain(Fi.empty()?Ri:Fi.extent()),uf&&Ji.scale($f).updateScaleExtent()),_f.domain(Ub(V,"y")),ag.domain(Ub(V,"y2")),Vd(V)||(Q=Zg?Zg:Fc(Ec(V)),eg.tickValues(Q),hg.tickValues(Q)),c=Mi.select("."+f.axisX).style("opacity",U?0:1),(Pg||D)&&(c=c.transition().duration(P)),c.call(eg),e=Mi.select("."+f.axisY).style("opacity",U?0:1),(!Pg||D)&&(e=e.transition().duration(P)),e.call(fg),Mi.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(gg),F)if(Vg&&Q){for(R=1;R=0&&mf.select(this).style("display",b%S?"none":"block")})}else mf.selectAll("."+f.axisX+" .tick text").style("display","block");if(I=Ee(T),K=Fe(T,!0),M=Fe(T,!1),Ab(),cg.domain(_f.domain()),dg.domain(ag.domain()),Pi.style("display","none"),o(),Mi.select("line."+f.xgridFocus).style("visibility","hidden"),uh){if("year"===vh){h=[];for(var W=Zb(),X=W[0].getFullYear(),Y=W[1].getFullYear(),Z=X;Y>=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=$f.ticks(10);g=Mi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Pg?0:function(a){return $f(a)-eg.tickOffset()}).attr("x2",Pg?Ff:function(a){return $f(a)-eg.tickOffset()}).attr("y1",Pg?function(a){return $f(a)-eg.tickOffset()}:Cf.top).attr("y2",Pg?function(a){return $f(a)-eg.tickOffset()}:Hf).style("opacity",function(){return+mf.select(this).attr(Pg?"y1":"x1")===(Pg?Hf:0)?0:1}),g.exit().remove()}ne(wh)&&(i=Mi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(wh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Pg?"":"rotate(-90)").attr("dx",Pg?0:-Cf.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Pg?0:vd).attr("x2",Pg?Ff:vd).attr("y1",Pg?vd:Cf.top).attr("y2",Pg?vd:Hf).style("opacity",1),i.select("text").transition().duration(N).attr("x",Pg?Ff:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&xh&&(k=Mi.select("."+f.ygrids).selectAll("."+f.ygrid).data(_f.ticks(zh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Pg?_f:0).attr("x2",Pg?_f:Ff).attr("y1",Pg?0:_f).attr("y2",Pg?Hf:_f),k.exit().remove()),y&&ne(yh)&&(l=Mi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(yh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Pg?"rotate(-90)":"").attr("dx",Pg?0:-Cf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Pg?wd:0).attr("x2",Pg?wd:Ff).attr("y1",Pg?0:wd).attr("y2",Pg?Hf:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Pg?0:Ff).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Mi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return oi(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Mi.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Pg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Mi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Gi).style("opacity",1),Mi.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Hi).style("opacity",Si),n=Mi.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",Bh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Pg?Md:Ld).attr("cy",Pg?Ld:Md),n.exit().remove(),Mi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=mf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Mi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Mi.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Ig&&(null!==mf.event&&"zoom"===mf.event.type&&Fi.extent($f.orgDomain()).update(),z&&(Ni.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(hg),Fi.empty()||Fi.extent($f.orgDomain()).update(),J=Ee(T,!0),s=Ni.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return oi(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Ni.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ii).style("opacity",1))),Mi.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Mi.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Pg?Md:Ld).attr("cy",Pg?Ld:Md),t=Mi.select("."+f.eventRects),ne(jg)&&!kc(jg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Mi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Ff).attr("height",Hf)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),ii&&!hi?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return($f(d?d:e+50)-$f(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return($f(d)+$f(c?c:d-50))/2}):(x=L(),w=function(a){return $f(a.x)-x/2}),v=wc(),Mi.select("."+f.eventRects).datum(v?v.values:[]),u=Mi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Pg?0:w).attr("y",Pg?w:0).attr("width",Pg?Ff:x).attr("height",Pg?x:Hf),u.exit().remove()),q=Mi.select("."+f.regions).selectAll("rect."+f.region).data(Uh),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Pg?0:cc).attr("y",Pg?cc:Cf.top).attr("width",Pg?Ff:dc).attr("height",Pg?dc:Hf).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),xc(nf.data.targets).forEach(function(a){Ti[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Ji.altDomain?($f.domain(Ji.altDomain),void Ji.scale($f).updateScaleExtent()):(hi&&$f.orgDomain()[0]===Ri[0]&&$f.domain([Ri[0]-1e-10,$f.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(li=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Ki.attr("width",Jf).attr("height",Kf),Ki.select("#"+ai).select("rect").attr("width",Ff).attr("height",Hf),Ki.select("#"+bi).select("rect").attr("width",H),Ki.select("#"+ci).select("rect").attr("width",J),Ki.select("."+f.zoomRect).attr("width",Ff).attr("height",Hf)}function We(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Mi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return oi(a)}),e=Mi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return oi(a)}).style("stroke","none").style("cursor",function(a){return zg(a)?"pointer":null}),c=Mi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return oi(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Si=+mf.select(this).style("opacity"),0}).style("fill",function(a){return oi(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return oi(a)}).style("cursor",function(a){return zg(a)?"pointer":null}),a.forEach(function(a){Mi.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Mi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Rf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return oi(a.data)}).style("cursor",function(a){return zg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Ig&&(n=Ni.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return oi(a)}),l=Ni.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return oi(a)})),Ki.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=yi?j:i,l=yi?Q():P();return d&&(w=0,C=0,t=0,u=0),Lg&&!Cc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=yi?u:t,void(Og?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,yi?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Oi.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Ng?Ng(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(mg[a])?mg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",yi?g:-200).attr("y",yi?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",yi?h:-200).attr("y",yi?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return oi(a)}).attr("x",yi?g:-200).attr("y",yi?-200:i).attr("width",10).attr("height",10),Oi.selectAll("text").data(a).text(function(a){return d(mg[a])?mg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Oi.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Oi.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["onresize"],function(){}),Af=h(["onresized"],function(){}),Bf=h(["transition","duration"],350);g("data","data is required in config");var Cf,Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig=h(["data","x"]),jg=h(["data","xs"],{}),kg=h(["data","x_format"]),lg=h(["data","id_converter"],function(a){return a}),mg=h(["data","names"],{}),ng=h(["data","classes"],{}),og=h(["data","groups"],[]),pg=h(["data","axes"],{}),qg=h(["data","type"]),rg=h(["data","types"],{}),sg=h(["data","labels"],{}),tg=h(["data","order"]),ug=h(["data","regions"],{}),vg=h(["data","color"]),wg=h(["data","colors"],{}),xg=h(["data","selection","enabled"],!1),yg=h(["data","selection","grouped"],!1),zg=h(["data","selection","isselectable"],function(){return!0}),Ag=h(["data","selection","multiple"],!0),Bg=h(["data","onclick"],function(){}),Cg=h(["data","onenter"],function(){}),Dg=h(["data","onleave"],function(){}),Eg=h(["data","onselected"],function(){}),Fg=h(["data","onunselected"],function(){}),Gg=h(["data","ondragstart"],function(){}),Hg=h(["data","ondragend"],function(){}),Ig=h(["subchart","show"],!1),Jg=Ig?h(["subchart","size","height"],60):0,Kg=h(["color","pattern"],[]),Lg=h(["legend","show"],!0),Mg=h(["legend","position"],"bottom"),Ng=h(["legend","item","onclick"]),Og=h(["legend","equally"],!1),Pg=h(["axis","rotated"],!1),Qg=h(["axis","x","type"],"indexed"),Rg=h(["axis","x","localtime"],!1),Sg=h(["axis","x","categories"],[]),Tg=h(["axis","x","tick","centered"],!1),Ug=h(["axis","x","tick","format"]),Vg=h(["axis","x","tick","culling"],{}),Wg=h(["axis","x","tick","culling","max"],10),Xg=h(["axis","x","tick","count"]),Yg=h(["axis","x","tick","fit"],!1),Zg=h(["axis","x","tick","values"],null),$g=h(["axis","x","max"]),_g=h(["axis","x","min"]),ah=h(["axis","x","default"]),bh=h(["axis","x","label"],{}),ch=h(["axis","y","show"],!0),dh=h(["axis","y","max"]),eh=h(["axis","y","min"]),fh=h(["axis","y","center"]),gh=h(["axis","y","label"],{}),hh=h(["axis","y","inner"],!1),ih=h(["axis","y","tick","format"]),jh=h(["axis","y","padding"],{}),kh=h(["axis","y","ticks"],10),lh=h(["axis","y2","show"],!1),mh=h(["axis","y2","max"]),nh=h(["axis","y2","min"]),oh=h(["axis","y2","center"]),ph=h(["axis","y2","label"],{}),qh=h(["axis","y2","inner"],!1),rh=h(["axis","y2","tick","format"]),sh=h(["axis","y2","padding"],{}),th=h(["axis","y2","ticks"],10),uh=h(["grid","x","show"],!1),vh=h(["grid","x","type"],"tick"),wh=h(["grid","x","lines"],[]),xh=h(["grid","y","show"],!1),yh=h(["grid","y","lines"],[]),zh=h(["grid","y","ticks"],10),Ah=h(["point","show"],!0),Bh=Ah?h(["point","r"],2.5):0,Ch=h(["point","focus","line","enabled"],!0),Dh=h(["point","focus","expand","enabled"],!0),Eh=h(["point","focus","expand","r"],Dh?4:Bh),Fh=h(["point","focus","select","r"],8),Gh=h(["line","connect_null"],!1),Hh=h(["bar","width"]),Ih=h(["bar","width","ratio"],.6),Jh=h(["pie","label","show"],!0),Kh=h(["pie","label","format"]),Lh=h(["pie","onclick"],function(){}),Mh=h(["pie","onmouseover"],function(){}),Nh=h(["pie","onmouseout"],function(){}),Oh=h(["donut","label","show"],!0),Ph=h(["donut","label","format"]),Qh=h(["donut","title"],""),Rh=h(["donut","onclick"],function(){}),Sh=h(["donut","onmouseover"],function(){}),Th=h(["donut","onmouseout"],function(){}),Uh=h(["regions"],[]),Vh=h(["tooltip","show"],!0),Wh=h(["tooltip","format","title"]),Xh=h(["tooltip","format","value"]),Yh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Wh?Wh:b,l=Xh?Xh:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Zh=h(["tooltip","init","show"],!1),$h=h(["tooltip","init","x"],0),_h=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ai=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",bi=ai+"-xaxis",ci=ai+"-yaxis",di=i(ai),ei=i(bi),fi=i(ci),gi="timeseries"===Qg,hi="categorized"===Qg,ii=!gi&&(ig||ne(jg)),ji=null,ki=!1,li=!1,mi=!1,ni=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],oi=he(wg,ne(Kg)?Kg:ni,vg),pi=Rg?mf.time.format:mf.time.format.utc,qi=function(){var a=[[pi("%Y/%-m/%-d"),function(){return!0}],[pi("%-m/%-d"),function(a){return a.getMonth()}],[pi("%-m/%-d"),function(a){return 1!==a.getDate()}],[pi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[pi("%I %p"),function(a){return a.getHours()}],[pi("%I:%M"),function(a){return a.getMinutes()}],[pi(":%S"),function(a){return a.getSeconds()}],[pi(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),ri=[],si=[],ti=Pg?"left":"bottom",ui=Pg?hh?"top":"bottom":hh?"right":"left",vi=Pg?qh?"bottom":"top":qh?"left":"right",wi=Pg?"left":"bottom",xi={main:function(){return"translate("+Cf.left+","+Cf.top+")"},context:function(){return"translate("+Df.left+","+Df.top+")"},legend:function(){return"translate("+Ef.left+","+Ef.top+")"},x:function(){return"translate(0,"+(Pg?0:Hf)+")"},y:function(){return"translate(0,"+(Pg?Hf:0)+")"},y2:function(){return"translate("+(Pg?0:Ff)+","+(Pg?1:0)+")"},subx:function(){return"translate(0,"+(Pg?0:If)+")"},arc:function(){return"translate("+Ff/2+","+Hf/2+")"}},yi="right"===Mg,zi=0,Ai=0,Bi=0,Ci=30,Di=30,Ei=5;Rf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Fi,Gi=function(){var a=mf.svg.line().x(Pg?function(a){return V(a.id)(a.value)}:ud).y(Pg?ud:function(a){return V(a.id)(a.value)});return Gh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Gh?xe(b.values):b.values;return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),ug[b.id]?Je(e,$f,V(b.id),ug[b.id]):a(e)):(c=e[0]?$f(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Pg?"M "+d+" "+c:"M "+c+" "+d)}}(),Hi=function(){var a;return a=Pg?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?$f(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Pg?"M "+d+" "+c:"M "+c+" "+d)}}(),Ii=function(){var a=mf.svg.line().x(Pg?function(a){return W(a.id)(a.value)}:xd).y(Pg?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+bg(c[0].x)+" "+W(b.id)(c[0].value)}}(),Ji=function(){};Fi=mf.svg.brush().on("brush",Se),Fi.update=function(){return Ni&&Ni.select("."+f.brush).call(this),this},Fi.scale=function(a){return Pg?this.y(a):this.x(a)},uf&&(Ji=mf.behavior.zoom().on("zoomstart",function(){Ji.altDomain=mf.event.sourceEvent.altKey?$f.orgDomain():null}).on("zoom",uf?Te:null),Ji.scale=function(a){return Pg?this.y(a):this.x(a)},Ji.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Ji.updateScaleExtent=function(){var a=$b($f.orgDomain())/$b(Ri),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Ki,Li,Mi,Ni,Oi,Pi,Qi,Ri,Si,Ti={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ki.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Ki.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ki.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Ki.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Oi.selectAll(kd(a)).classed(f.legendItemHidden,!1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Ki.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Oi.selectAll(kd(a)).classed(f.legendItemHidden,!0),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){Fi.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){ng[b]=a.classes[b]}),"categories"in a&&hi&&(Sg=a.categories,eg.categories(Sg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Mi.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){xg&&Mi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=yg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?zg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){xg&&Mi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=yg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&zg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?og:(og=a,Re(),og)},nf.xgrids=function(a){return a?(wh=a,Re(),wh):wh},nf.xgrids.add=function(a){return a?nf.xgrids(wh.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(wh.filter(b))},nf.ygrids=function(a){return a?(yh=a,Re(),yh):yh},nf.ygrids.add=function(a){return a?nf.ygrids(yh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(yh.filter(b))},nf.regions=function(a){return c(a)?Uh:(Uh=a,Re(),Uh)},nf.regions.add=function(a){return c(a)?Uh:(Uh=Uh.concat(a),Re(),Uh)},nf.regions.remove=function(a,c){var e=[].concat(a);return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;Ki.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Uh=Uh.filter(function(b){return b.classes.indexOf(a)<0 })}),Uh},nf.data.get=function(a){var b=nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},nf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){mg[b]=a[b]}),gf(xc(nf.data.targets),{withTransition:!0}),mg):mg},nf.x=function(a){return arguments.length&&(mc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.xs=function(a){return arguments.length&&(nc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(dh=+a.y),b(a.y2)&&(mh=+a.y2)):dh=mh=+a,Re())},nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(eh=+a.y),b(a.y2)&&(nh=+a.y2)):eh=nh=+a,Re())},nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&nf.axis.max(a.max),"undefined"!=typeof a.min&&nf.axis.min(a.min))},nf.legend.show=function(a){Lg||(Lg=!0,Oi.style("visibility","visible")),ef(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.legend.hide=function(a){Lg&&me(a)&&(Lg=!1,Oi.style("visibility","hidden")),ff(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.resize=function(a){qf=a?a.width:null,rf=a?a.height:null,We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},nf.destroy=function(){nf.data.targets=void 0,nf.data.xs={},Qi.html(""),a.onresize=null},"url"in e.data)mf.xhr(e.data.url,function(a,b){var c,d=mf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=mf.csv.parse(b.response),Ke(c)});else if("rows"in e.data)Ke(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ke(qc(e.data.columns))}return nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 602f3775f2a65a42231c0a04bdca17586e5e1b7d Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Sun, 13 Apr 2014 08:49:27 +0900 Subject: [PATCH 042/178] Update version to 0.1.31 --- bower.json | 2 +- c3.js | 2 +- c3.min.js | 2 +- package.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bower.json b/bower.json index 87e14e3..300dd59 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "c3", "main": "c3.min.js", - "version": "0.1.30", + "version": "0.1.31", "homepage": "https://github.com/masayuki0812/c3", "authors": [ "Masayuki Tanaka " diff --git a/c3.js b/c3.js index 8ac2d87..f6635ab 100644 --- a/c3.js +++ b/c3.js @@ -2,7 +2,7 @@ 'use strict'; var c3 = { - version: "0.1.30" + version: "0.1.31" }; var CLASS = { diff --git a/c3.min.js b/c3.min.js index a20e152..17aa969 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.30"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cFf&&(Ff=0),0>Hf&&(Hf=0),Df={top:Pg?Cf.top:Kf-Jg-(yi?0:a),right:0/0,bottom:20+(yi?0:a),left:Pg?Ci:Cf.left},Gf=Pg?Cf.left-Ci-Di:Ff,If=Pg?Hf:Kf-Df.top-Df.bottom,0>Gf&&(Gf=0),0>If&&(If=0),Ef={top:yi?0:Kf-a,right:0/0,bottom:0,left:yi?Jf-b:0},p(),yi&&Yd(nf.data.targets)&&(Ef.left=Ff/2+Mf)}function o(){Mi.select("line."+f.xgridFocus).attr("x1",Pg?0:-10).attr("x2",Pg?Ff:-10).attr("y1",Pg?-10:Cf.top).attr("y2",Pg?-10:Hf)}function p(){Mf=Hf/2,Lf=.95*Mf,Nf=Xd(nf.data.targets)?.6*Lf:0}function q(){var a=Pg?f.axisX:f.axisY,b=mf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=mf.select(pf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return qf?qf:x()}function s(){var a=rf?rf:y();return a>0?a:320}function t(){return Yd(nf.data.targets)?0:sf?sf:Pg||!ch||hh?1:v("y")}function u(){var a=1;return Yd(nf.data.targets)?0:tf?tf:yi?P()+(lh&&!Pg?v("y2"):a):lh?qh||Pg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||ch?"y2"!==a||lh?(gb(a).isInner?30:40)+("y2"===a?-10:0):Ei:Lg&&!yi?10:1}function x(){return+mf.select(pf).style("width").replace("px","")}function y(){return+mf.select(pf).style("height").replace("px","")}function z(a){return a?-5:-(Cf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Pg)}function C(){return A(!Pg)}function D(){return z(Pg)}function E(){return A(Pg)}function F(a){return a?Ff+2+4:Cf.left+20}function G(a){return a?80:Hf+2}function H(){return F(!Pg)}function I(){return G(!Pg)}function J(){return F(Pg)}function K(){return G(Pg)}function L(){var a=Pg?Hf:Ff,b=vc(),c=Vb()*(Ud(nf.data.targets)?(b-(hi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){zi=a}function N(a){Ai=a}function O(a){Bi=a}function P(){return Lg?yi?Ai*(zi+1):Jf:0}function Q(){return Lg?yi?Kf:Bi*(zi+1):0}function R(){var a,b=!$f;Sf=Pg?1:0,Tf=Pg?Hf:Ff,Uf=Pg?0:Hf,Vf=Pg?Ff:1,Wf=Sf,Xf=Tf,Yf=Pg?0:If,Zf=Pg?Gf:1,$f=T(Sf,Tf,b?void 0:$f.domain(),function(){return eg.tickOffset()}),_f=U(Uf,Vf),ag=U(Uf,Vf),bg=T(Sf,Tf,Ri,function(a){return a%1?0:hg.tickOffset()}),cg=U(Yf,Zf),dg=U(Yf,Zf),a=$(),eg=X($f,ti,a),hg=X(bg,wi,a),fg=Y(_f,ui,ih,kh),gg=Y(ag,vi,rh,th),b||(Fi.scale(bg),uf&&Ji.scale($f)),S()}function S(){Of=Db(),Pf=Eb(),Qf=Eb(.98)}function T(a,b,e,f){var g=(gi?mf.time.scale():mf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),hi){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return mf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?ag:_f}function W(a){return"y2"===Z(a)?dg:cg}function X(a,b,c){var d=(hi?Bb():mf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),hi?(d.tickCentered(Tg),me(Vg)&&(Vg=!1)):d.tickOffset=function(){var a=Pg?Hf:Ff;return a*Vb()/vc()/2},hi&&d.categories(Sg),d}function Y(a,b,c,d){return mf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in pg?pg[a]:"y"}function $(){var a=gi?qi:hi?Oc:function(a){return 0>a?a.toFixed(0):a};return Ug&&("function"==typeof Ug?a=Ug:gi&&(a=function(a){return pi(Ug)(a)})),a}function _(a){var b;return"y"===a?b=gh:"y2"===a?b=ph:"x"===a&&(b=bh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?gh=b:"y2"===a?ph=b:"x"===a&&(bh=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Pg?"inner-top":"inner-right")}function eb(){return cb("y",Pg?"inner-right":"inner-top")}function fb(){return cb("y2",Pg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?Ff/2:Ff:b.isBottom?-Hf:b.isMiddle?-Hf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Pg,db())}function ob(){return kb(Pg,eb())}function pb(){return kb(Pg,fb())}function qb(){return lb(!Pg,db())}function rb(){return lb(Pg,eb())}function sb(){return lb(Pg,fb())}function tb(){var a=db();return Pg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Pg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Pg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Pg,db())}function xb(){return mb(Pg,eb())}function yb(){return mb(Pg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Mi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Mi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Mi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+o)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Mc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return mf.min(Object.keys(i).map(function(a){return mf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(og.length>0)for(g=Nc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return mf.max(Object.keys(i).map(function(a){return mf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?nh:eh,n="y2"===c?mh:dh,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?oh:fh,r=pd()&&Pg;return 0===l.length?"y2"===c?ag.domain():_f.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=qd(o,p),j=$b(_f.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&jh&&(f=b(jh.top)?jh.top:e,g=b(jh.bottom)?jh.bottom:e),"y2"===c&&sh&&(f=b(sh.top)?sh.top:e,g=b(sh.bottom)?sh.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Ri),c=$b($f.domain());return a||0===c?1:b/c}function Wb(a){return _g?_g:mf.min(a,function(a){return mf.min(a.values,function(a){return a.x})})}function Xb(a){return $g?$g:mf.max(a,function(a){return mf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return hi?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=0,g=0;return(c||0===c)&&(f=gi?new Date(c.getTime()-e):c-e),(d||0===d)&&(g=gi?new Date(d.getTime()+e):d+e),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return ig&&a===ig||ne(jg)&&oe(jg,a)}function fc(a){return!ec(a)}function gc(a){return ig?ig:ne(jg)?jg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=nf.data.xs[b])}),c}function ic(a,b){return a in nf.data.xs&&nf.data.xs[a]&&nf.data.xs[a][b]?nf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){jg[b]=a[b]})}function kc(a){return 1===mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=mg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),nf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=gi?a?a instanceof Date?a:ie(a):ie(ic(b,c)):ii&&!hi?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):ig?(d=Object.keys(nf.data.xs),nf.data.xs[c]=d.length>0?nf.data.xs[d[0]]:void 0):ne(jg)&&(nf.data.xs[c]=hc(f,nf.data.targets)):nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=lg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return ii&&hi&&0===c&&g&&(0===e&&(Sg=[]),Sg.push(g)),("undefined"==typeof a[b]||nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),qg&&Sd(xc(c).filter(function(a){return!(a in rg)}),qg),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function tc(a){return a>0&&nf.data.targets[0].values[a-1]?nf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?nf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?nf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(nf.data.targets)}function zc(a,b){var c,d=xc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(gi?new Date(h):h);i.push(d)}return gi||(i=i.sort(function(a,b){return a-b})),i}function Gc(a){ri=ri.concat(a)}function Hc(a){ri=ri.filter(function(b){return a.indexOf(b)<0})}function Ic(a){si=si.concat(a)}function Jc(a){si=si.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Ed(){return tg&&"desc"===tg.toLowerCase()}function Fd(){return tg&&"asc"===tg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof tg&&a.sort(tg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(nf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Vh&&0!==m.length&&(Pi.html(Yh(a,$(),l,oi)).style("display","block"),d=Pi.property("offsetWidth"),e=Pi.property("offsetHeight"),k?(g=Ff/2+c[0],i=Hf/2+c[1]+20):(Pg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=$f(m[0].x)+20):(f=q(),g=f+t()+$f(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Pi.style("top",i+"px").style("left",g+"px"))}function Id(){Pi.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Vh&&(Vd(nf.data.targets)||Yd(nf.data.targets)||Mi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Pg?"y1":"x1",ud).attr(Pg?"y2":"x2",ud))}function Kd(){Mi.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?$f(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Hh?Hh:b?2*a.tickOffset()*Ih/b:0}function Sd(a,b){yc(a).forEach(function(a){Ti[a]=b===rg[a],rg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){rg[a.id]===b&&(c=!0),a.id in rg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in rg)||"line"===rg[b]||"spline"===rg[b]||"area"===rg[b]||"area-spline"===rg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===rg[b]||"area-spline"===rg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===rg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===rg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===rg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===rg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ie(b){var c;try{c=kg?mf.time.format(kg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+kg)}return c}function je(a,b){var c=mf.mouse(a),d=mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?_f:ag,d=Pg?1:0,e=Pg?0:1;return Math.pow($f(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Eg(b,a.node()),Mi.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Pg?Md:Ld).attr("cy",Pg?Ld:Md).attr("stroke",function(){return oi(b)}).attr("r",1.4*Fh).transition().duration(100).attr("r",Fh)}function se(a,b,c){Fg(b,a.node()),Mi.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Eg(b,a.node()),a.transition().duration(100).style("fill",function(){return mf.rgb(oi(b)).darker(1)})}function ve(a,b){Fg(b,a.node()),a.transition().duration(100).style("fill",function(){return oi(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Mi.selectAll("."+f.circles+gd(c)):Mi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",Eh)}function Ae(a){ye(a).filter(function(){return mf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Bh)}function Be(a){return Mi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Pg?1:0,f=Pg?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Pg?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBoundingClientRect();return Pg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(eg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Pg&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Je(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function Ke(b){var c,d,e;if(Qi=mf.select(pf),Qi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Qi.html(""),Qi.classed("c3",!0),nf.data.xs={},nf.data.targets=rc(b),n(),R(),$f.domain(mf.extent(Zb(nf.data.targets))),_f.domain(Ub(nf.data.targets,"y")),ag.domain(Ub(nf.data.targets,"y2")),bg.domain($f.domain()),cg.domain(_f.domain()),dg.domain(ag.domain()),Ri=$f.domain(),Fi.scale(bg),uf&&Ji.scale($f),Ki=Qi.append("svg").attr("width",Ff+Cf.left+Cf.right).attr("height",Hf+Cf.top+Cf.bottom).on("mouseenter",xf).on("mouseleave",yf),Li=Ki.append("defs"),Li.append("clipPath").attr("id",ai).append("rect").attr("width",Ff).attr("height",Hf),Li.append("clipPath").attr("id",bi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Li.append("clipPath").attr("id",ci).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Mi=Ki.append("g").attr("transform",xi.main),Ni=Ig?Ki.append("g").attr("transform",xi.context):null,Oi=Ki.append("g").attr("transform",xi.legend),Lg||(Oi.style("visibility","hidden"),si=xc(nf.data.targets)),Pi=mf.select(pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),gf(xc(nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Mi.append("g").attr("class",f.axisX).attr("clip-path",Pg?"":ei).attr("transform",xi.x).append("text").attr("class",f.axisXLabel).attr("transform",Pg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),ch&&Mi.append("g").attr("class",f.axisY).attr("clip-path",Pg?fi:"").attr("transform",xi.y).append("text").attr("class",f.axisYLabel).attr("transform",Pg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),lh&&Mi.append("g").attr("class",f.axisY2).attr("transform",xi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Pg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Mi.append("g").attr("clip-path",di).attr("class",f.grid),uh&&d.append("g").attr("class",f.xgrids),ne(wh)&&d.append("g").attr("class",f.xgridLines),Ch&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),xh&&d.append("g").attr("class",f.ygrids),ne(yh)&&d.append("g").attr("class",f.ygridLines),Mi.append("g").attr("clip-path",di).attr("class",f.regions),Mi.append("g").attr("clip-path",di).attr("class",f.chart),c=Mi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",uf?Pg?"ns-resize":"ew-resize":null),Mi.select("."+f.chart).append("g").attr("class",f.chartBars),Mi.select("."+f.chart).append("g").attr("class",f.chartLines),Mi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",xi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Mi.select("."+f.chart).append("g").attr("class",f.chartTexts),uf&&Mi.insert("rect",wf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Ff).attr("height",Hf).style("opacity",0).style("cursor",Pg?"ns-resize":"ew-resize").call(Ji).on("dblclick.zoom",null),ah&&Fi.extent("function"!=typeof ah?ah:ah(Zb())),Ig&&(Ni.append("g").attr("clip-path",di).attr("class",f.chart),Ni.select("."+f.chart).append("g").attr("class",f.chartBars),Ni.select("."+f.chart).append("g").attr("class",f.chartLines),Ni.append("g").attr("clip-path",di).attr("class",f.brush).call(Fi).selectAll("rect").attr(Pg?"width":"height",Pg?Gf:If),Ni.append("g").attr("class",f.axisX).attr("transform",xi.subx).attr("clip-path",Pg?"":ei)),Xe(nf.data.targets),Pg?Mi.select("."+f.axisX).style("opacity",0).call(eg):(Mi.select("."+f.axisY).style("opacity",0).call(fg),Mi.select("."+f.axisY2).style("opacity",0).call(gg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Zh){if(gi&&"string"==typeof $h){for($h=ie($h),e=0;eFf&&(Ff=0),0>Hf&&(Hf=0),Df={top:Pg?Cf.top:Kf-Jg-(yi?0:a),right:0/0,bottom:20+(yi?0:a),left:Pg?Ci:Cf.left},Gf=Pg?Cf.left-Ci-Di:Ff,If=Pg?Hf:Kf-Df.top-Df.bottom,0>Gf&&(Gf=0),0>If&&(If=0),Ef={top:yi?0:Kf-a,right:0/0,bottom:0,left:yi?Jf-b:0},p(),yi&&Yd(nf.data.targets)&&(Ef.left=Ff/2+Mf)}function o(){Mi.select("line."+f.xgridFocus).attr("x1",Pg?0:-10).attr("x2",Pg?Ff:-10).attr("y1",Pg?-10:Cf.top).attr("y2",Pg?-10:Hf)}function p(){Mf=Hf/2,Lf=.95*Mf,Nf=Xd(nf.data.targets)?.6*Lf:0}function q(){var a=Pg?f.axisX:f.axisY,b=mf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=mf.select(pf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return qf?qf:x()}function s(){var a=rf?rf:y();return a>0?a:320}function t(){return Yd(nf.data.targets)?0:sf?sf:Pg||!ch||hh?1:v("y")}function u(){var a=1;return Yd(nf.data.targets)?0:tf?tf:yi?P()+(lh&&!Pg?v("y2"):a):lh?qh||Pg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||ch?"y2"!==a||lh?(gb(a).isInner?30:40)+("y2"===a?-10:0):Ei:Lg&&!yi?10:1}function x(){return+mf.select(pf).style("width").replace("px","")}function y(){return+mf.select(pf).style("height").replace("px","")}function z(a){return a?-5:-(Cf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Pg)}function C(){return A(!Pg)}function D(){return z(Pg)}function E(){return A(Pg)}function F(a){return a?Ff+2+4:Cf.left+20}function G(a){return a?80:Hf+2}function H(){return F(!Pg)}function I(){return G(!Pg)}function J(){return F(Pg)}function K(){return G(Pg)}function L(){var a=Pg?Hf:Ff,b=vc(),c=Vb()*(Ud(nf.data.targets)?(b-(hi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){zi=a}function N(a){Ai=a}function O(a){Bi=a}function P(){return Lg?yi?Ai*(zi+1):Jf:0}function Q(){return Lg?yi?Kf:Bi*(zi+1):0}function R(){var a,b=!$f;Sf=Pg?1:0,Tf=Pg?Hf:Ff,Uf=Pg?0:Hf,Vf=Pg?Ff:1,Wf=Sf,Xf=Tf,Yf=Pg?0:If,Zf=Pg?Gf:1,$f=T(Sf,Tf,b?void 0:$f.domain(),function(){return eg.tickOffset()}),_f=U(Uf,Vf),ag=U(Uf,Vf),bg=T(Sf,Tf,Ri,function(a){return a%1?0:hg.tickOffset()}),cg=U(Yf,Zf),dg=U(Yf,Zf),a=$(),eg=X($f,ti,a),hg=X(bg,wi,a),fg=Y(_f,ui,ih,kh),gg=Y(ag,vi,rh,th),b||(Fi.scale(bg),uf&&Ji.scale($f)),S()}function S(){Of=Db(),Pf=Eb(),Qf=Eb(.98)}function T(a,b,e,f){var g=(gi?mf.time.scale():mf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),hi){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return mf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?ag:_f}function W(a){return"y2"===Z(a)?dg:cg}function X(a,b,c){var d=(hi?Bb():mf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),hi?(d.tickCentered(Tg),me(Vg)&&(Vg=!1)):d.tickOffset=function(){var a=Pg?Hf:Ff;return a*Vb()/vc()/2},hi&&d.categories(Sg),d}function Y(a,b,c,d){return mf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in pg?pg[a]:"y"}function $(){var a=gi?qi:hi?Oc:function(a){return 0>a?a.toFixed(0):a};return Ug&&("function"==typeof Ug?a=Ug:gi&&(a=function(a){return pi(Ug)(a)})),a}function _(a){var b;return"y"===a?b=gh:"y2"===a?b=ph:"x"===a&&(b=bh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?gh=b:"y2"===a?ph=b:"x"===a&&(bh=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Pg?"inner-top":"inner-right")}function eb(){return cb("y",Pg?"inner-right":"inner-top")}function fb(){return cb("y2",Pg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?Ff/2:Ff:b.isBottom?-Hf:b.isMiddle?-Hf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Pg,db())}function ob(){return kb(Pg,eb())}function pb(){return kb(Pg,fb())}function qb(){return lb(!Pg,db())}function rb(){return lb(Pg,eb())}function sb(){return lb(Pg,fb())}function tb(){var a=db();return Pg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Pg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Pg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Pg,db())}function xb(){return mb(Pg,eb())}function yb(){return mb(Pg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Mi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Mi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Mi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+o)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Mc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return mf.min(Object.keys(i).map(function(a){return mf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(og.length>0)for(g=Nc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return mf.max(Object.keys(i).map(function(a){return mf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?nh:eh,n="y2"===c?mh:dh,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?oh:fh,r=pd()&&Pg;return 0===l.length?"y2"===c?ag.domain():_f.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=qd(o,p),j=$b(_f.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&jh&&(f=b(jh.top)?jh.top:e,g=b(jh.bottom)?jh.bottom:e),"y2"===c&&sh&&(f=b(sh.top)?sh.top:e,g=b(sh.bottom)?sh.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Ri),c=$b($f.domain());return a||0===c?1:b/c}function Wb(a){return _g?_g:mf.min(a,function(a){return mf.min(a.values,function(a){return a.x})})}function Xb(a){return $g?$g:mf.max(a,function(a){return mf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return hi?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=0,g=0;return(c||0===c)&&(f=gi?new Date(c.getTime()-e):c-e),(d||0===d)&&(g=gi?new Date(d.getTime()+e):d+e),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return ig&&a===ig||ne(jg)&&oe(jg,a)}function fc(a){return!ec(a)}function gc(a){return ig?ig:ne(jg)?jg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=nf.data.xs[b])}),c}function ic(a,b){return a in nf.data.xs&&nf.data.xs[a]&&nf.data.xs[a][b]?nf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){jg[b]=a[b]})}function kc(a){return 1===mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=mg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),nf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=gi?a?a instanceof Date?a:ie(a):ie(ic(b,c)):ii&&!hi?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):ig?(d=Object.keys(nf.data.xs),nf.data.xs[c]=d.length>0?nf.data.xs[d[0]]:void 0):ne(jg)&&(nf.data.xs[c]=hc(f,nf.data.targets)):nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=lg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return ii&&hi&&0===c&&g&&(0===e&&(Sg=[]),Sg.push(g)),("undefined"==typeof a[b]||nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),qg&&Sd(xc(c).filter(function(a){return!(a in rg)}),qg),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function tc(a){return a>0&&nf.data.targets[0].values[a-1]?nf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?nf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?nf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(nf.data.targets)}function zc(a,b){var c,d=xc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(gi?new Date(h):h);i.push(d)}return gi||(i=i.sort(function(a,b){return a-b})),i}function Gc(a){ri=ri.concat(a)}function Hc(a){ri=ri.filter(function(b){return a.indexOf(b)<0})}function Ic(a){si=si.concat(a)}function Jc(a){si=si.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Ed(){return tg&&"desc"===tg.toLowerCase()}function Fd(){return tg&&"asc"===tg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof tg&&a.sort(tg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(nf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Vh&&0!==m.length&&(Pi.html(Yh(a,$(),l,oi)).style("display","block"),d=Pi.property("offsetWidth"),e=Pi.property("offsetHeight"),k?(g=Ff/2+c[0],i=Hf/2+c[1]+20):(Pg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=$f(m[0].x)+20):(f=q(),g=f+t()+$f(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Pi.style("top",i+"px").style("left",g+"px"))}function Id(){Pi.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Vh&&(Vd(nf.data.targets)||Yd(nf.data.targets)||Mi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Pg?"y1":"x1",ud).attr(Pg?"y2":"x2",ud))}function Kd(){Mi.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?$f(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Hh?Hh:b?2*a.tickOffset()*Ih/b:0}function Sd(a,b){yc(a).forEach(function(a){Ti[a]=b===rg[a],rg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){rg[a.id]===b&&(c=!0),a.id in rg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in rg)||"line"===rg[b]||"spline"===rg[b]||"area"===rg[b]||"area-spline"===rg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===rg[b]||"area-spline"===rg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===rg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===rg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===rg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===rg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ie(b){var c;try{c=kg?mf.time.format(kg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+kg)}return c}function je(a,b){var c=mf.mouse(a),d=mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?_f:ag,d=Pg?1:0,e=Pg?0:1;return Math.pow($f(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Eg(b,a.node()),Mi.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Pg?Md:Ld).attr("cy",Pg?Ld:Md).attr("stroke",function(){return oi(b)}).attr("r",1.4*Fh).transition().duration(100).attr("r",Fh)}function se(a,b,c){Fg(b,a.node()),Mi.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Eg(b,a.node()),a.transition().duration(100).style("fill",function(){return mf.rgb(oi(b)).darker(1)})}function ve(a,b){Fg(b,a.node()),a.transition().duration(100).style("fill",function(){return oi(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Mi.selectAll("."+f.circles+gd(c)):Mi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",Eh)}function Ae(a){ye(a).filter(function(){return mf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Bh)}function Be(a){return Mi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Pg?1:0,f=Pg?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Pg?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBoundingClientRect();return Pg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(eg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Pg&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Je(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function Ke(b){var c,d,e;if(Qi=mf.select(pf),Qi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Qi.html(""),Qi.classed("c3",!0),nf.data.xs={},nf.data.targets=rc(b),n(),R(),$f.domain(mf.extent(Zb(nf.data.targets))),_f.domain(Ub(nf.data.targets,"y")),ag.domain(Ub(nf.data.targets,"y2")),bg.domain($f.domain()),cg.domain(_f.domain()),dg.domain(ag.domain()),Ri=$f.domain(),Fi.scale(bg),uf&&Ji.scale($f),Ki=Qi.append("svg").attr("width",Ff+Cf.left+Cf.right).attr("height",Hf+Cf.top+Cf.bottom).on("mouseenter",xf).on("mouseleave",yf),Li=Ki.append("defs"),Li.append("clipPath").attr("id",ai).append("rect").attr("width",Ff).attr("height",Hf),Li.append("clipPath").attr("id",bi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Li.append("clipPath").attr("id",ci).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Mi=Ki.append("g").attr("transform",xi.main),Ni=Ig?Ki.append("g").attr("transform",xi.context):null,Oi=Ki.append("g").attr("transform",xi.legend),Lg||(Oi.style("visibility","hidden"),si=xc(nf.data.targets)),Pi=mf.select(pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),gf(xc(nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Mi.append("g").attr("class",f.axisX).attr("clip-path",Pg?"":ei).attr("transform",xi.x).append("text").attr("class",f.axisXLabel).attr("transform",Pg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),ch&&Mi.append("g").attr("class",f.axisY).attr("clip-path",Pg?fi:"").attr("transform",xi.y).append("text").attr("class",f.axisYLabel).attr("transform",Pg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),lh&&Mi.append("g").attr("class",f.axisY2).attr("transform",xi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Pg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Mi.append("g").attr("clip-path",di).attr("class",f.grid),uh&&d.append("g").attr("class",f.xgrids),ne(wh)&&d.append("g").attr("class",f.xgridLines),Ch&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),xh&&d.append("g").attr("class",f.ygrids),ne(yh)&&d.append("g").attr("class",f.ygridLines),Mi.append("g").attr("clip-path",di).attr("class",f.regions),Mi.append("g").attr("clip-path",di).attr("class",f.chart),c=Mi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",uf?Pg?"ns-resize":"ew-resize":null),Mi.select("."+f.chart).append("g").attr("class",f.chartBars),Mi.select("."+f.chart).append("g").attr("class",f.chartLines),Mi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",xi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Mi.select("."+f.chart).append("g").attr("class",f.chartTexts),uf&&Mi.insert("rect",wf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Ff).attr("height",Hf).style("opacity",0).style("cursor",Pg?"ns-resize":"ew-resize").call(Ji).on("dblclick.zoom",null),ah&&Fi.extent("function"!=typeof ah?ah:ah(Zb())),Ig&&(Ni.append("g").attr("clip-path",di).attr("class",f.chart),Ni.select("."+f.chart).append("g").attr("class",f.chartBars),Ni.select("."+f.chart).append("g").attr("class",f.chartLines),Ni.append("g").attr("clip-path",di).attr("class",f.brush).call(Fi).selectAll("rect").attr(Pg?"width":"height",Pg?Gf:If),Ni.append("g").attr("class",f.axisX).attr("transform",xi.subx).attr("clip-path",Pg?"":ei)),Xe(nf.data.targets),Pg?Mi.select("."+f.axisX).style("opacity",0).call(eg):(Mi.select("."+f.axisY).style("opacity",0).call(fg),Mi.select("."+f.axisY2).style("opacity",0).call(gg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Zh){if(gi&&"string"==typeof $h){for($h=ie($h),e=0;e0){d=[];for(var g in mg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function Pe(a){Yd(nf.data.targets)||xg&&(ji=a,Mi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),ki=!0,Gg())}function Qe(){Yd(nf.data.targets)||xg&&(Mi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Mi.selectAll("."+f.shape).classed(f.INCLUDED,!1),ki=!1,Hg())}function Re(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Nd(),U=Yd(nf.data.targets),V=Dc(nf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?Bf:0,O=B?N:0,P=C?N:0,H&&Lg&&gf(xc(nf.data.targets),a),G&&($f.domain(mf.extent(Zb(V))),Ri=$f.domain(),uf&&Ji.scale($f).updateScaleExtent(),bg.domain($f.domain()),Fi.scale(bg)),F&&($f.domain(Fi.empty()?Ri:Fi.extent()),uf&&Ji.scale($f).updateScaleExtent()),_f.domain(Ub(V,"y")),ag.domain(Ub(V,"y2")),Vd(V)||(Q=Zg?Zg:Fc(Ec(V)),eg.tickValues(Q),hg.tickValues(Q)),c=Mi.select("."+f.axisX).style("opacity",U?0:1),(Pg||D)&&(c=c.transition().duration(P)),c.call(eg),e=Mi.select("."+f.axisY).style("opacity",U?0:1),(!Pg||D)&&(e=e.transition().duration(P)),e.call(fg),Mi.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(gg),F)if(Vg&&Q){for(R=1;R=0&&mf.select(this).style("display",b%S?"none":"block")})}else mf.selectAll("."+f.axisX+" .tick text").style("display","block");if(I=Ee(T),K=Fe(T,!0),M=Fe(T,!1),Ab(),cg.domain(_f.domain()),dg.domain(ag.domain()),Pi.style("display","none"),o(),Mi.select("line."+f.xgridFocus).style("visibility","hidden"),uh){if("year"===vh){h=[];for(var W=Zb(),X=W[0].getFullYear(),Y=W[1].getFullYear(),Z=X;Y>=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=$f.ticks(10);g=Mi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Pg?0:function(a){return $f(a)-eg.tickOffset()}).attr("x2",Pg?Ff:function(a){return $f(a)-eg.tickOffset()}).attr("y1",Pg?function(a){return $f(a)-eg.tickOffset()}:Cf.top).attr("y2",Pg?function(a){return $f(a)-eg.tickOffset()}:Hf).style("opacity",function(){return+mf.select(this).attr(Pg?"y1":"x1")===(Pg?Hf:0)?0:1}),g.exit().remove()}ne(wh)&&(i=Mi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(wh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Pg?"":"rotate(-90)").attr("dx",Pg?0:-Cf.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Pg?0:vd).attr("x2",Pg?Ff:vd).attr("y1",Pg?vd:Cf.top).attr("y2",Pg?vd:Hf).style("opacity",1),i.select("text").transition().duration(N).attr("x",Pg?Ff:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&xh&&(k=Mi.select("."+f.ygrids).selectAll("."+f.ygrid).data(_f.ticks(zh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Pg?_f:0).attr("x2",Pg?_f:Ff).attr("y1",Pg?0:_f).attr("y2",Pg?Hf:_f),k.exit().remove()),y&&ne(yh)&&(l=Mi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(yh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Pg?"rotate(-90)":"").attr("dx",Pg?0:-Cf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Pg?wd:0).attr("x2",Pg?wd:Ff).attr("y1",Pg?0:wd).attr("y2",Pg?Hf:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Pg?0:Ff).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Mi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return oi(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Mi.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Pg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Mi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Gi).style("opacity",1),Mi.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Hi).style("opacity",Si),n=Mi.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",Bh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Pg?Md:Ld).attr("cy",Pg?Ld:Md),n.exit().remove(),Mi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=mf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Mi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Mi.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Ig&&(null!==mf.event&&"zoom"===mf.event.type&&Fi.extent($f.orgDomain()).update(),z&&(Ni.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(hg),Fi.empty()||Fi.extent($f.orgDomain()).update(),J=Ee(T,!0),s=Ni.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return oi(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Ni.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ii).style("opacity",1))),Mi.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Mi.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Pg?Md:Ld).attr("cy",Pg?Ld:Md),t=Mi.select("."+f.eventRects),ne(jg)&&!kc(jg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Mi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Ff).attr("height",Hf)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),ii&&!hi?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return($f(d?d:e+50)-$f(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return($f(d)+$f(c?c:d-50))/2}):(x=L(),w=function(a){return $f(a.x)-x/2}),v=wc(),Mi.select("."+f.eventRects).datum(v?v.values:[]),u=Mi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Pg?0:w).attr("y",Pg?w:0).attr("width",Pg?Ff:x).attr("height",Pg?x:Hf),u.exit().remove()),q=Mi.select("."+f.regions).selectAll("rect."+f.region).data(Uh),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Pg?0:cc).attr("y",Pg?cc:Cf.top).attr("width",Pg?Ff:dc).attr("height",Pg?dc:Hf).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),xc(nf.data.targets).forEach(function(a){Ti[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Ji.altDomain?($f.domain(Ji.altDomain),void Ji.scale($f).updateScaleExtent()):(hi&&$f.orgDomain()[0]===Ri[0]&&$f.domain([Ri[0]-1e-10,$f.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(li=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Ki.attr("width",Jf).attr("height",Kf),Ki.select("#"+ai).select("rect").attr("width",Ff).attr("height",Hf),Ki.select("#"+bi).select("rect").attr("width",H),Ki.select("#"+ci).select("rect").attr("width",J),Ki.select("."+f.zoomRect).attr("width",Ff).attr("height",Hf)}function We(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Mi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return oi(a)}),e=Mi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return oi(a)}).style("stroke","none").style("cursor",function(a){return zg(a)?"pointer":null}),c=Mi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return oi(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Si=+mf.select(this).style("opacity"),0}).style("fill",function(a){return oi(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return oi(a)}).style("cursor",function(a){return zg(a)?"pointer":null}),a.forEach(function(a){Mi.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Mi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Rf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return oi(a.data)}).style("cursor",function(a){return zg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Ig&&(n=Ni.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return oi(a)}),l=Ni.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return oi(a)})),Ki.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=yi?j:i,l=yi?Q():P();return d&&(w=0,C=0,t=0,u=0),Lg&&!Cc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=yi?u:t,void(Og?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,yi?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Oi.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Ng?Ng(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(mg[a])?mg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",yi?g:-200).attr("y",yi?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",yi?h:-200).attr("y",yi?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return oi(a)}).attr("x",yi?g:-200).attr("y",yi?-200:i).attr("width",10).attr("height",10),Oi.selectAll("text").data(a).text(function(a){return d(mg[a])?mg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Oi.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Oi.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["onresize"],function(){}),Af=h(["onresized"],function(){}),Bf=h(["transition","duration"],350);g("data","data is required in config");var Cf,Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig=h(["data","x"]),jg=h(["data","xs"],{}),kg=h(["data","x_format"]),lg=h(["data","id_converter"],function(a){return a}),mg=h(["data","names"],{}),ng=h(["data","classes"],{}),og=h(["data","groups"],[]),pg=h(["data","axes"],{}),qg=h(["data","type"]),rg=h(["data","types"],{}),sg=h(["data","labels"],{}),tg=h(["data","order"]),ug=h(["data","regions"],{}),vg=h(["data","color"]),wg=h(["data","colors"],{}),xg=h(["data","selection","enabled"],!1),yg=h(["data","selection","grouped"],!1),zg=h(["data","selection","isselectable"],function(){return!0}),Ag=h(["data","selection","multiple"],!0),Bg=h(["data","onclick"],function(){}),Cg=h(["data","onenter"],function(){}),Dg=h(["data","onleave"],function(){}),Eg=h(["data","onselected"],function(){}),Fg=h(["data","onunselected"],function(){}),Gg=h(["data","ondragstart"],function(){}),Hg=h(["data","ondragend"],function(){}),Ig=h(["subchart","show"],!1),Jg=Ig?h(["subchart","size","height"],60):0,Kg=h(["color","pattern"],[]),Lg=h(["legend","show"],!0),Mg=h(["legend","position"],"bottom"),Ng=h(["legend","item","onclick"]),Og=h(["legend","equally"],!1),Pg=h(["axis","rotated"],!1),Qg=h(["axis","x","type"],"indexed"),Rg=h(["axis","x","localtime"],!1),Sg=h(["axis","x","categories"],[]),Tg=h(["axis","x","tick","centered"],!1),Ug=h(["axis","x","tick","format"]),Vg=h(["axis","x","tick","culling"],{}),Wg=h(["axis","x","tick","culling","max"],10),Xg=h(["axis","x","tick","count"]),Yg=h(["axis","x","tick","fit"],!1),Zg=h(["axis","x","tick","values"],null),$g=h(["axis","x","max"]),_g=h(["axis","x","min"]),ah=h(["axis","x","default"]),bh=h(["axis","x","label"],{}),ch=h(["axis","y","show"],!0),dh=h(["axis","y","max"]),eh=h(["axis","y","min"]),fh=h(["axis","y","center"]),gh=h(["axis","y","label"],{}),hh=h(["axis","y","inner"],!1),ih=h(["axis","y","tick","format"]),jh=h(["axis","y","padding"],{}),kh=h(["axis","y","ticks"],10),lh=h(["axis","y2","show"],!1),mh=h(["axis","y2","max"]),nh=h(["axis","y2","min"]),oh=h(["axis","y2","center"]),ph=h(["axis","y2","label"],{}),qh=h(["axis","y2","inner"],!1),rh=h(["axis","y2","tick","format"]),sh=h(["axis","y2","padding"],{}),th=h(["axis","y2","ticks"],10),uh=h(["grid","x","show"],!1),vh=h(["grid","x","type"],"tick"),wh=h(["grid","x","lines"],[]),xh=h(["grid","y","show"],!1),yh=h(["grid","y","lines"],[]),zh=h(["grid","y","ticks"],10),Ah=h(["point","show"],!0),Bh=Ah?h(["point","r"],2.5):0,Ch=h(["point","focus","line","enabled"],!0),Dh=h(["point","focus","expand","enabled"],!0),Eh=h(["point","focus","expand","r"],Dh?4:Bh),Fh=h(["point","focus","select","r"],8),Gh=h(["line","connect_null"],!1),Hh=h(["bar","width"]),Ih=h(["bar","width","ratio"],.6),Jh=h(["pie","label","show"],!0),Kh=h(["pie","label","format"]),Lh=h(["pie","onclick"],function(){}),Mh=h(["pie","onmouseover"],function(){}),Nh=h(["pie","onmouseout"],function(){}),Oh=h(["donut","label","show"],!0),Ph=h(["donut","label","format"]),Qh=h(["donut","title"],""),Rh=h(["donut","onclick"],function(){}),Sh=h(["donut","onmouseover"],function(){}),Th=h(["donut","onmouseout"],function(){}),Uh=h(["regions"],[]),Vh=h(["tooltip","show"],!0),Wh=h(["tooltip","format","title"]),Xh=h(["tooltip","format","value"]),Yh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Wh?Wh:b,l=Xh?Xh:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Zh=h(["tooltip","init","show"],!1),$h=h(["tooltip","init","x"],0),_h=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ai=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",bi=ai+"-xaxis",ci=ai+"-yaxis",di=i(ai),ei=i(bi),fi=i(ci),gi="timeseries"===Qg,hi="categorized"===Qg,ii=!gi&&(ig||ne(jg)),ji=null,ki=!1,li=!1,mi=!1,ni=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],oi=he(wg,ne(Kg)?Kg:ni,vg),pi=Rg?mf.time.format:mf.time.format.utc,qi=function(){var a=[[pi("%Y/%-m/%-d"),function(){return!0}],[pi("%-m/%-d"),function(a){return a.getMonth()}],[pi("%-m/%-d"),function(a){return 1!==a.getDate()}],[pi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[pi("%I %p"),function(a){return a.getHours()}],[pi("%I:%M"),function(a){return a.getMinutes()}],[pi(":%S"),function(a){return a.getSeconds()}],[pi(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),ri=[],si=[],ti=Pg?"left":"bottom",ui=Pg?hh?"top":"bottom":hh?"right":"left",vi=Pg?qh?"bottom":"top":qh?"left":"right",wi=Pg?"left":"bottom",xi={main:function(){return"translate("+Cf.left+","+Cf.top+")"},context:function(){return"translate("+Df.left+","+Df.top+")"},legend:function(){return"translate("+Ef.left+","+Ef.top+")"},x:function(){return"translate(0,"+(Pg?0:Hf)+")"},y:function(){return"translate(0,"+(Pg?Hf:0)+")"},y2:function(){return"translate("+(Pg?0:Ff)+","+(Pg?1:0)+")"},subx:function(){return"translate(0,"+(Pg?0:If)+")"},arc:function(){return"translate("+Ff/2+","+Hf/2+")"}},yi="right"===Mg,zi=0,Ai=0,Bi=0,Ci=30,Di=30,Ei=5;Rf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Fi,Gi=function(){var a=mf.svg.line().x(Pg?function(a){return V(a.id)(a.value)}:ud).y(Pg?ud:function(a){return V(a.id)(a.value)});return Gh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Gh?xe(b.values):b.values;return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),ug[b.id]?Je(e,$f,V(b.id),ug[b.id]):a(e)):(c=e[0]?$f(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Pg?"M "+d+" "+c:"M "+c+" "+d)}}(),Hi=function(){var a;return a=Pg?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?$f(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Pg?"M "+d+" "+c:"M "+c+" "+d)}}(),Ii=function(){var a=mf.svg.line().x(Pg?function(a){return W(a.id)(a.value)}:xd).y(Pg?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+bg(c[0].x)+" "+W(b.id)(c[0].value)}}(),Ji=function(){};Fi=mf.svg.brush().on("brush",Se),Fi.update=function(){return Ni&&Ni.select("."+f.brush).call(this),this},Fi.scale=function(a){return Pg?this.y(a):this.x(a)},uf&&(Ji=mf.behavior.zoom().on("zoomstart",function(){Ji.altDomain=mf.event.sourceEvent.altKey?$f.orgDomain():null}).on("zoom",uf?Te:null),Ji.scale=function(a){return Pg?this.y(a):this.x(a)},Ji.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Ji.updateScaleExtent=function(){var a=$b($f.orgDomain())/$b(Ri),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Ki,Li,Mi,Ni,Oi,Pi,Qi,Ri,Si,Ti={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ki.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Ki.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ki.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Ki.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Oi.selectAll(kd(a)).classed(f.legendItemHidden,!1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Ki.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Oi.selectAll(kd(a)).classed(f.legendItemHidden,!0),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){Fi.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){ng[b]=a.classes[b]}),"categories"in a&&hi&&(Sg=a.categories,eg.categories(Sg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Mi.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){xg&&Mi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=yg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?zg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){xg&&Mi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=yg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&zg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?og:(og=a,Re(),og)},nf.xgrids=function(a){return a?(wh=a,Re(),wh):wh},nf.xgrids.add=function(a){return a?nf.xgrids(wh.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(wh.filter(b))},nf.ygrids=function(a){return a?(yh=a,Re(),yh):yh},nf.ygrids.add=function(a){return a?nf.ygrids(yh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(yh.filter(b))},nf.regions=function(a){return c(a)?Uh:(Uh=a,Re(),Uh)},nf.regions.add=function(a){return c(a)?Uh:(Uh=Uh.concat(a),Re(),Uh)},nf.regions.remove=function(a,c){var e=[].concat(a);return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;Ki.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Uh=Uh.filter(function(b){return b.classes.indexOf(a)<0 })}),Uh},nf.data.get=function(a){var b=nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},nf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){mg[b]=a[b]}),gf(xc(nf.data.targets),{withTransition:!0}),mg):mg},nf.x=function(a){return arguments.length&&(mc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.xs=function(a){return arguments.length&&(nc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(dh=+a.y),b(a.y2)&&(mh=+a.y2)):dh=mh=+a,Re())},nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(eh=+a.y),b(a.y2)&&(nh=+a.y2)):eh=nh=+a,Re())},nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&nf.axis.max(a.max),"undefined"!=typeof a.min&&nf.axis.min(a.min))},nf.legend.show=function(a){Lg||(Lg=!0,Oi.style("visibility","visible")),ef(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.legend.hide=function(a){Lg&&me(a)&&(Lg=!1,Oi.style("visibility","hidden")),ff(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.resize=function(a){qf=a?a.width:null,rf=a?a.height:null,We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},nf.destroy=function(){nf.data.targets=void 0,nf.data.xs={},Qi.html(""),a.onresize=null},"url"in e.data)mf.xhr(e.data.url,function(a,b){var c,d=mf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=mf.csv.parse(b.response),Ke(c)});else if("rows"in e.data)Ke(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ke(qc(e.data.columns))}return nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file diff --git a/package.json b/package.json index 5dac006..ac883d4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "c3", - "version": "0.1.30", + "version": "0.1.31", "description": "D3-based reusable chart library", "main": "c3.js", "scripts": { From 0cf1c6de13a50b548ceb85c7b4e328a5ac8bfedf Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Mon, 14 Apr 2014 20:19:28 +0900 Subject: [PATCH 043/178] Add pie.expand and donut.expand option - #153 --- c3.js | 29 +++++++++++++++++++---------- c3.min.js | 6 +++--- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/c3.js b/c3.js index f6635ab..0e63029 100644 --- a/c3.js +++ b/c3.js @@ -224,6 +224,7 @@ // pie var __pie_label_show = getConfig(['pie', 'label', 'show'], true), __pie_label_format = getConfig(['pie', 'label', 'format']), + __pie_expand = getConfig(['pie', 'expand'], true), __pie_onclick = getConfig(['pie', 'onclick'], function () {}), __pie_onmouseover = getConfig(['pie', 'onmouseover'], function () {}), __pie_onmouseout = getConfig(['pie', 'onmouseout'], function () {}); @@ -231,6 +232,7 @@ // donut var __donut_label_show = getConfig(['donut', 'label', 'show'], true), __donut_label_format = getConfig(['donut', 'label', 'format']), + __donut_expand = getConfig(['donut', 'expand'], true), __donut_title = getConfig(['donut', 'title'], ""), __donut_onclick = getConfig(['donut', 'onclick'], function () {}), __donut_onmouseover = getConfig(['donut', 'onmouseover'], function () {}), @@ -1047,16 +1049,19 @@ function expandArc(id, withoutFadeOut) { var target = svg.selectAll('.' + CLASS.chartArc + selectorTarget(id)), noneTargets = svg.selectAll('.' + CLASS.arc).filter(function (data) { return data.data.id !== id; }); - target.selectAll('path') - .transition().duration(50) - .attr("d", svgArcExpanded) - .transition().duration(100) - .attr("d", svgArcExpandedSub) - .each(function (d) { - if (isDonutType(d.data)) { - // callback here - } - }); + + if (shouldExpand(id)) { + target.selectAll('path') + .transition().duration(50) + .attr("d", svgArcExpanded) + .transition().duration(100) + .attr("d", svgArcExpandedSub) + .each(function (d) { + if (isDonutType(d.data)) { + // callback here + } + }); + } if (!withoutFadeOut) { noneTargets.style("opacity", 0.3); } @@ -1982,6 +1987,10 @@ return isBarType(d) || isLineType(d) ? d.values : []; } + function shouldExpand(id) { + return (isDonutType(id) && __donut_expand) || (isPieType(id) && __pie_expand); + } + //-- Color --// function generateColor(colors, pattern, callback) { diff --git a/c3.min.js b/c3.min.js index 17aa969..a9047a7 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.31"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cFf&&(Ff=0),0>Hf&&(Hf=0),Df={top:Pg?Cf.top:Kf-Jg-(yi?0:a),right:0/0,bottom:20+(yi?0:a),left:Pg?Ci:Cf.left},Gf=Pg?Cf.left-Ci-Di:Ff,If=Pg?Hf:Kf-Df.top-Df.bottom,0>Gf&&(Gf=0),0>If&&(If=0),Ef={top:yi?0:Kf-a,right:0/0,bottom:0,left:yi?Jf-b:0},p(),yi&&Yd(nf.data.targets)&&(Ef.left=Ff/2+Mf)}function o(){Mi.select("line."+f.xgridFocus).attr("x1",Pg?0:-10).attr("x2",Pg?Ff:-10).attr("y1",Pg?-10:Cf.top).attr("y2",Pg?-10:Hf)}function p(){Mf=Hf/2,Lf=.95*Mf,Nf=Xd(nf.data.targets)?.6*Lf:0}function q(){var a=Pg?f.axisX:f.axisY,b=mf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=mf.select(pf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return qf?qf:x()}function s(){var a=rf?rf:y();return a>0?a:320}function t(){return Yd(nf.data.targets)?0:sf?sf:Pg||!ch||hh?1:v("y")}function u(){var a=1;return Yd(nf.data.targets)?0:tf?tf:yi?P()+(lh&&!Pg?v("y2"):a):lh?qh||Pg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||ch?"y2"!==a||lh?(gb(a).isInner?30:40)+("y2"===a?-10:0):Ei:Lg&&!yi?10:1}function x(){return+mf.select(pf).style("width").replace("px","")}function y(){return+mf.select(pf).style("height").replace("px","")}function z(a){return a?-5:-(Cf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Pg)}function C(){return A(!Pg)}function D(){return z(Pg)}function E(){return A(Pg)}function F(a){return a?Ff+2+4:Cf.left+20}function G(a){return a?80:Hf+2}function H(){return F(!Pg)}function I(){return G(!Pg)}function J(){return F(Pg)}function K(){return G(Pg)}function L(){var a=Pg?Hf:Ff,b=vc(),c=Vb()*(Ud(nf.data.targets)?(b-(hi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){zi=a}function N(a){Ai=a}function O(a){Bi=a}function P(){return Lg?yi?Ai*(zi+1):Jf:0}function Q(){return Lg?yi?Kf:Bi*(zi+1):0}function R(){var a,b=!$f;Sf=Pg?1:0,Tf=Pg?Hf:Ff,Uf=Pg?0:Hf,Vf=Pg?Ff:1,Wf=Sf,Xf=Tf,Yf=Pg?0:If,Zf=Pg?Gf:1,$f=T(Sf,Tf,b?void 0:$f.domain(),function(){return eg.tickOffset()}),_f=U(Uf,Vf),ag=U(Uf,Vf),bg=T(Sf,Tf,Ri,function(a){return a%1?0:hg.tickOffset()}),cg=U(Yf,Zf),dg=U(Yf,Zf),a=$(),eg=X($f,ti,a),hg=X(bg,wi,a),fg=Y(_f,ui,ih,kh),gg=Y(ag,vi,rh,th),b||(Fi.scale(bg),uf&&Ji.scale($f)),S()}function S(){Of=Db(),Pf=Eb(),Qf=Eb(.98)}function T(a,b,e,f){var g=(gi?mf.time.scale():mf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),hi){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return mf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?ag:_f}function W(a){return"y2"===Z(a)?dg:cg}function X(a,b,c){var d=(hi?Bb():mf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),hi?(d.tickCentered(Tg),me(Vg)&&(Vg=!1)):d.tickOffset=function(){var a=Pg?Hf:Ff;return a*Vb()/vc()/2},hi&&d.categories(Sg),d}function Y(a,b,c,d){return mf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in pg?pg[a]:"y"}function $(){var a=gi?qi:hi?Oc:function(a){return 0>a?a.toFixed(0):a};return Ug&&("function"==typeof Ug?a=Ug:gi&&(a=function(a){return pi(Ug)(a)})),a}function _(a){var b;return"y"===a?b=gh:"y2"===a?b=ph:"x"===a&&(b=bh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?gh=b:"y2"===a?ph=b:"x"===a&&(bh=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Pg?"inner-top":"inner-right")}function eb(){return cb("y",Pg?"inner-right":"inner-top")}function fb(){return cb("y2",Pg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?Ff/2:Ff:b.isBottom?-Hf:b.isMiddle?-Hf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Pg,db())}function ob(){return kb(Pg,eb())}function pb(){return kb(Pg,fb())}function qb(){return lb(!Pg,db())}function rb(){return lb(Pg,eb())}function sb(){return lb(Pg,fb())}function tb(){var a=db();return Pg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Pg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Pg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Pg,db())}function xb(){return mb(Pg,eb())}function yb(){return mb(Pg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Mi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Mi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Mi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+o)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Mc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return mf.min(Object.keys(i).map(function(a){return mf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(og.length>0)for(g=Nc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return mf.max(Object.keys(i).map(function(a){return mf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?nh:eh,n="y2"===c?mh:dh,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?oh:fh,r=pd()&&Pg;return 0===l.length?"y2"===c?ag.domain():_f.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=qd(o,p),j=$b(_f.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&jh&&(f=b(jh.top)?jh.top:e,g=b(jh.bottom)?jh.bottom:e),"y2"===c&&sh&&(f=b(sh.top)?sh.top:e,g=b(sh.bottom)?sh.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Ri),c=$b($f.domain());return a||0===c?1:b/c}function Wb(a){return _g?_g:mf.min(a,function(a){return mf.min(a.values,function(a){return a.x})})}function Xb(a){return $g?$g:mf.max(a,function(a){return mf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return hi?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=0,g=0;return(c||0===c)&&(f=gi?new Date(c.getTime()-e):c-e),(d||0===d)&&(g=gi?new Date(d.getTime()+e):d+e),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return ig&&a===ig||ne(jg)&&oe(jg,a)}function fc(a){return!ec(a)}function gc(a){return ig?ig:ne(jg)?jg[a]:null}function hc(a,b){var c,d=b&&ne(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=nf.data.xs[b])}),c}function ic(a,b){return a in nf.data.xs&&nf.data.xs[a]&&nf.data.xs[a][b]?nf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){jg[b]=a[b]})}function kc(a){return 1===mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=mg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),nf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=gi?a?a instanceof Date?a:ie(a):ie(ic(b,c)):ii&&!hi?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):ig?(d=Object.keys(nf.data.xs),nf.data.xs[c]=d.length>0?nf.data.xs[d[0]]:void 0):ne(jg)&&(nf.data.xs[c]=hc(f,nf.data.targets)):nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=lg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return ii&&hi&&0===c&&g&&(0===e&&(Sg=[]),Sg.push(g)),("undefined"==typeof a[b]||nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),qg&&Sd(xc(c).filter(function(a){return!(a in rg)}),qg),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function tc(a){return a>0&&nf.data.targets[0].values[a-1]?nf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?nf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?nf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(nf.data.targets)}function zc(a,b){var c,d=xc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(gi?new Date(h):h);i.push(d)}return gi||(i=i.sort(function(a,b){return a-b})),i}function Gc(a){ri=ri.concat(a)}function Hc(a){ri=ri.filter(function(b){return a.indexOf(b)<0})}function Ic(a){si=si.concat(a)}function Jc(a){si=si.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=pe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Ed(){return tg&&"desc"===tg.toLowerCase()}function Fd(){return tg&&"asc"===tg.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof tg&&a.sort(tg),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(nf.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Vh&&0!==m.length&&(Pi.html(Yh(a,$(),l,oi)).style("display","block"),d=Pi.property("offsetWidth"),e=Pi.property("offsetHeight"),k?(g=Ff/2+c[0],i=Hf/2+c[1]+20):(Pg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=$f(m[0].x)+20):(f=q(),g=f+t()+$f(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Pi.style("top",i+"px").style("left",g+"px"))}function Id(){Pi.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Vh&&(Vd(nf.data.targets)||Yd(nf.data.targets)||Mi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Pg?"y1":"x1",ud).attr(Pg?"y2":"x2",ud))}function Kd(){Mi.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?$f(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Hh?Hh:b?2*a.tickOffset()*Ih/b:0}function Sd(a,b){yc(a).forEach(function(a){Ti[a]=b===rg[a],rg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){rg[a.id]===b&&(c=!0),a.id in rg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in rg)||"line"===rg[b]||"spline"===rg[b]||"area"===rg[b]||"area-spline"===rg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===rg[b]||"area-spline"===rg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===rg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===rg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===rg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===rg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ie(b){var c;try{c=kg?mf.time.format(kg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+kg)}return c}function je(a,b){var c=mf.mouse(a),d=mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function oe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function pe(a,b){var c="y"===Z(a.id)?_f:ag,d=Pg?1:0,e=Pg?0:1;return Math.pow($f(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function qe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function re(a,b,c){Eg(b,a.node()),Mi.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Pg?Md:Ld).attr("cy",Pg?Ld:Md).attr("stroke",function(){return oi(b)}).attr("r",1.4*Fh).transition().duration(100).attr("r",Fh)}function se(a,b,c){Fg(b,a.node()),Mi.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function te(a,b,c,d){a?re(b,c,d):se(b,c,d)}function ue(a,b){Eg(b,a.node()),a.transition().duration(100).style("fill",function(){return mf.rgb(oi(b)).darker(1)})}function ve(a,b){Fg(b,a.node()),a.transition().duration(100).style("fill",function(){return oi(b)})}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a){return a.filter(function(a){return b(a.value)})}function ye(a,c){return(c?Mi.selectAll("."+f.circles+gd(c)):Mi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ze(a,b){ye(a,b).classed(f.EXPANDED,!0).attr("r",Eh)}function Ae(a){ye(a).filter(function(){return mf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Bh)}function Be(a){return Mi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ce(a){Be(a).classed(f.EXPANDED,!0)}function De(a){Be(a).classed(f.EXPANDED,!1)}function Ee(a,b){var c=Ie(a,b);return function(a,b){var d=c(a,b),e=Pg?1:0,f=Pg?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function Fe(a,b){var c=Ie(a,!1),d=b?Ge:He;return function(a,b){return d(c(a,b),a,this)}}function Ge(a,b){var c;return Pg?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function He(a,b,c){var d=c.getBoundingClientRect();return Pg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Ie(a,b){var c=a.__max__+1,d=Rd(eg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Pg&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Je(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function Ke(b){var c,d,e;if(Qi=mf.select(pf),Qi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Qi.html(""),Qi.classed("c3",!0),nf.data.xs={},nf.data.targets=rc(b),n(),R(),$f.domain(mf.extent(Zb(nf.data.targets))),_f.domain(Ub(nf.data.targets,"y")),ag.domain(Ub(nf.data.targets,"y2")),bg.domain($f.domain()),cg.domain(_f.domain()),dg.domain(ag.domain()),Ri=$f.domain(),Fi.scale(bg),uf&&Ji.scale($f),Ki=Qi.append("svg").attr("width",Ff+Cf.left+Cf.right).attr("height",Hf+Cf.top+Cf.bottom).on("mouseenter",xf).on("mouseleave",yf),Li=Ki.append("defs"),Li.append("clipPath").attr("id",ai).append("rect").attr("width",Ff).attr("height",Hf),Li.append("clipPath").attr("id",bi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Li.append("clipPath").attr("id",ci).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Mi=Ki.append("g").attr("transform",xi.main),Ni=Ig?Ki.append("g").attr("transform",xi.context):null,Oi=Ki.append("g").attr("transform",xi.legend),Lg||(Oi.style("visibility","hidden"),si=xc(nf.data.targets)),Pi=mf.select(pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),gf(xc(nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Mi.append("g").attr("class",f.axisX).attr("clip-path",Pg?"":ei).attr("transform",xi.x).append("text").attr("class",f.axisXLabel).attr("transform",Pg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),ch&&Mi.append("g").attr("class",f.axisY).attr("clip-path",Pg?fi:"").attr("transform",xi.y).append("text").attr("class",f.axisYLabel).attr("transform",Pg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),lh&&Mi.append("g").attr("class",f.axisY2).attr("transform",xi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Pg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Mi.append("g").attr("clip-path",di).attr("class",f.grid),uh&&d.append("g").attr("class",f.xgrids),ne(wh)&&d.append("g").attr("class",f.xgridLines),Ch&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),xh&&d.append("g").attr("class",f.ygrids),ne(yh)&&d.append("g").attr("class",f.ygridLines),Mi.append("g").attr("clip-path",di).attr("class",f.regions),Mi.append("g").attr("clip-path",di).attr("class",f.chart),c=Mi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",uf?Pg?"ns-resize":"ew-resize":null),Mi.select("."+f.chart).append("g").attr("class",f.chartBars),Mi.select("."+f.chart).append("g").attr("class",f.chartLines),Mi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",xi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Mi.select("."+f.chart).append("g").attr("class",f.chartTexts),uf&&Mi.insert("rect",wf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Ff).attr("height",Hf).style("opacity",0).style("cursor",Pg?"ns-resize":"ew-resize").call(Ji).on("dblclick.zoom",null),ah&&Fi.extent("function"!=typeof ah?ah:ah(Zb())),Ig&&(Ni.append("g").attr("clip-path",di).attr("class",f.chart),Ni.select("."+f.chart).append("g").attr("class",f.chartBars),Ni.select("."+f.chart).append("g").attr("class",f.chartLines),Ni.append("g").attr("clip-path",di).attr("class",f.brush).call(Fi).selectAll("rect").attr(Pg?"width":"height",Pg?Gf:If),Ni.append("g").attr("class",f.axisX).attr("transform",xi.subx).attr("clip-path",Pg?"":ei)),Xe(nf.data.targets),Pg?Mi.select("."+f.axisX).style("opacity",0).call(eg):(Mi.select("."+f.axisY).style("opacity",0).call(fg),Mi.select("."+f.axisY2).style("opacity",0).call(gg)),Re({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Zh){if(gi&&"string"==typeof $h){for($h=ie($h),e=0;e0){d=[];for(var g in mg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=we,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function Pe(a){Yd(nf.data.targets)||xg&&(ji=a,Mi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),ki=!0,Gg())}function Qe(){Yd(nf.data.targets)||xg&&(Mi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Mi.selectAll("."+f.shape).classed(f.INCLUDED,!1),ki=!1,Hg())}function Re(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Nd(),U=Yd(nf.data.targets),V=Dc(nf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?Bf:0,O=B?N:0,P=C?N:0,H&&Lg&&gf(xc(nf.data.targets),a),G&&($f.domain(mf.extent(Zb(V))),Ri=$f.domain(),uf&&Ji.scale($f).updateScaleExtent(),bg.domain($f.domain()),Fi.scale(bg)),F&&($f.domain(Fi.empty()?Ri:Fi.extent()),uf&&Ji.scale($f).updateScaleExtent()),_f.domain(Ub(V,"y")),ag.domain(Ub(V,"y2")),Vd(V)||(Q=Zg?Zg:Fc(Ec(V)),eg.tickValues(Q),hg.tickValues(Q)),c=Mi.select("."+f.axisX).style("opacity",U?0:1),(Pg||D)&&(c=c.transition().duration(P)),c.call(eg),e=Mi.select("."+f.axisY).style("opacity",U?0:1),(!Pg||D)&&(e=e.transition().duration(P)),e.call(fg),Mi.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(gg),F)if(Vg&&Q){for(R=1;R=0&&mf.select(this).style("display",b%S?"none":"block")})}else mf.selectAll("."+f.axisX+" .tick text").style("display","block");if(I=Ee(T),K=Fe(T,!0),M=Fe(T,!1),Ab(),cg.domain(_f.domain()),dg.domain(ag.domain()),Pi.style("display","none"),o(),Mi.select("line."+f.xgridFocus).style("visibility","hidden"),uh){if("year"===vh){h=[];for(var W=Zb(),X=W[0].getFullYear(),Y=W[1].getFullYear(),Z=X;Y>=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=$f.ticks(10);g=Mi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Pg?0:function(a){return $f(a)-eg.tickOffset()}).attr("x2",Pg?Ff:function(a){return $f(a)-eg.tickOffset()}).attr("y1",Pg?function(a){return $f(a)-eg.tickOffset()}:Cf.top).attr("y2",Pg?function(a){return $f(a)-eg.tickOffset()}:Hf).style("opacity",function(){return+mf.select(this).attr(Pg?"y1":"x1")===(Pg?Hf:0)?0:1}),g.exit().remove()}ne(wh)&&(i=Mi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(wh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Pg?"":"rotate(-90)").attr("dx",Pg?0:-Cf.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Pg?0:vd).attr("x2",Pg?Ff:vd).attr("y1",Pg?vd:Cf.top).attr("y2",Pg?vd:Hf).style("opacity",1),i.select("text").transition().duration(N).attr("x",Pg?Ff:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&xh&&(k=Mi.select("."+f.ygrids).selectAll("."+f.ygrid).data(_f.ticks(zh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Pg?_f:0).attr("x2",Pg?_f:Ff).attr("y1",Pg?0:_f).attr("y2",Pg?Hf:_f),k.exit().remove()),y&&ne(yh)&&(l=Mi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(yh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Pg?"rotate(-90)":"").attr("dx",Pg?0:-Cf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Pg?wd:0).attr("x2",Pg?wd:Ff).attr("y1",Pg?0:wd).attr("y2",Pg?Hf:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Pg?0:Ff).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Mi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return oi(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Mi.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Pg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Mi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Gi).style("opacity",1),Mi.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Hi).style("opacity",Si),n=Mi.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",Bh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Pg?Md:Ld).attr("cy",Pg?Ld:Md),n.exit().remove(),Mi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=mf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Mi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Mi.select("."+f.chartArcsTitle).style("opacity",Xd(nf.data.targets)?1:0),Ig&&(null!==mf.event&&"zoom"===mf.event.type&&Fi.extent($f.orgDomain()).update(),z&&(Ni.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(hg),Fi.empty()||Fi.extent($f.orgDomain()).update(),J=Ee(T,!0),s=Ni.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return oi(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Ni.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ii).style("opacity",1))),Mi.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Mi.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Pg?Md:Ld).attr("cy",Pg?Ld:Md),t=Mi.select("."+f.eventRects),ne(jg)&&!kc(jg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Mi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Me(u.enter()),u.attr("x",0).attr("y",0).attr("width",Ff).attr("height",Hf)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),ii&&!hi?(x=function(a,b){var c=tc(b),d=uc(b),e=nf.data.xs[a.id][b];return($f(d?d:e+50)-$f(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=nf.data.xs[a.id][b];return($f(d)+$f(c?c:d-50))/2}):(x=L(),w=function(a){return $f(a.x)-x/2}),v=wc(),Mi.select("."+f.eventRects).datum(v?v.values:[]),u=Mi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Le(u.enter()),u.attr("class",ad).attr("x",Pg?0:w).attr("y",Pg?w:0).attr("width",Pg?Ff:x).attr("height",Pg?x:Hf),u.exit().remove()),q=Mi.select("."+f.regions).selectAll("rect."+f.region).data(Uh),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Pg?0:cc).attr("y",Pg?cc:Cf.top).attr("width",Pg?Ff:dc).attr("height",Pg?dc:Hf).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),xc(nf.data.targets).forEach(function(a){Ti[a]=!0})}}function Se(){Re({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Te(){return"mousemove"===mf.event.sourceEvent.type&&Ji.altDomain?($f.domain(Ji.altDomain),void Ji.scale($f).updateScaleExtent()):(hi&&$f.orgDomain()[0]===Ri[0]&&$f.domain([Ri[0]-1e-10,$f.orgDomain()[1]]),Re({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===mf.event.sourceEvent.type&&(li=!0)))}function Ue(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ve(){Ki.attr("width",Jf).attr("height",Kf),Ki.select("#"+ai).select("rect").attr("width",Ff).attr("height",Hf),Ki.select("#"+bi).select("rect").attr("width",H),Ki.select("#"+ci).select("rect").attr("width",J),Ki.select("."+f.zoomRect).attr("width",Ff).attr("height",Hf)}function We(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Ve(),m(a.withTransition),Re(a)}function Xe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Mi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return oi(a)}),e=Mi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return oi(a)}).style("stroke","none").style("cursor",function(a){return zg(a)?"pointer":null}),c=Mi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return oi(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Si=+mf.select(this).style("opacity"),0}).style("fill",function(a){return oi(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return oi(a)}).style("cursor",function(a){return zg(a)?"pointer":null}),a.forEach(function(a){Mi.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Mi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Rf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return oi(a.data)}).style("cursor",function(a){return zg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),bf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,mf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),df(),Id(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Ig&&(n=Ni.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return oi(a)}),l=Ni.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return oi(a)})),Ki.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ye(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=yi?j:i,l=yi?Q():P();return d&&(w=0,C=0,t=0,u=0),Lg&&!Cc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=yi?u:t,void(Og?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,yi?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Oi.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Ng?Ng(a):nf.toggle(a)}).on("mouseover",function(a){nf.focus(a)}).on("mouseout",function(){nf.revert()}),l.append("text").text(function(a){return d(mg[a])?mg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",yi?g:-200).attr("y",yi?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",yi?h:-200).attr("y",yi?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return oi(a)}).attr("x",yi?g:-200).attr("y",yi?-200:i).attr("width",10).attr("height",10),Oi.selectAll("text").data(a).text(function(a){return d(mg[a])?mg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Oi.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Oi.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Ve(),q&&m(p)}function hf(a){return zc(nf.data.targets,a.id)}function jf(a){return"data"in a&&zc(nf.data.targets,a.data.id)}function kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function lf(a,b,c){var d=!Yd(nf.data.targets);Sd(a,b),We(c?c:{withTransitionForAxis:d})}var mf=a.d3?a.d3:a.require?a.require("d3"):void 0,nf={data:{},axis:{},legend:{}},of={},pf=h(["bindto"],"#chart"),qf=h(["size","width"]),rf=h(["size","height"]),sf=h(["padding","left"]),tf=h(["padding","right"]),uf=h(["zoom","enabled"],!1),vf=h(["zoom","extent"]),wf=h(["zoom","privileged"],!1),xf=h(["onenter"],function(){}),yf=h(["onleave"],function(){}),zf=h(["onresize"],function(){}),Af=h(["onresized"],function(){}),Bf=h(["transition","duration"],350);g("data","data is required in config");var Cf,Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig=h(["data","x"]),jg=h(["data","xs"],{}),kg=h(["data","x_format"]),lg=h(["data","id_converter"],function(a){return a}),mg=h(["data","names"],{}),ng=h(["data","classes"],{}),og=h(["data","groups"],[]),pg=h(["data","axes"],{}),qg=h(["data","type"]),rg=h(["data","types"],{}),sg=h(["data","labels"],{}),tg=h(["data","order"]),ug=h(["data","regions"],{}),vg=h(["data","color"]),wg=h(["data","colors"],{}),xg=h(["data","selection","enabled"],!1),yg=h(["data","selection","grouped"],!1),zg=h(["data","selection","isselectable"],function(){return!0}),Ag=h(["data","selection","multiple"],!0),Bg=h(["data","onclick"],function(){}),Cg=h(["data","onenter"],function(){}),Dg=h(["data","onleave"],function(){}),Eg=h(["data","onselected"],function(){}),Fg=h(["data","onunselected"],function(){}),Gg=h(["data","ondragstart"],function(){}),Hg=h(["data","ondragend"],function(){}),Ig=h(["subchart","show"],!1),Jg=Ig?h(["subchart","size","height"],60):0,Kg=h(["color","pattern"],[]),Lg=h(["legend","show"],!0),Mg=h(["legend","position"],"bottom"),Ng=h(["legend","item","onclick"]),Og=h(["legend","equally"],!1),Pg=h(["axis","rotated"],!1),Qg=h(["axis","x","type"],"indexed"),Rg=h(["axis","x","localtime"],!1),Sg=h(["axis","x","categories"],[]),Tg=h(["axis","x","tick","centered"],!1),Ug=h(["axis","x","tick","format"]),Vg=h(["axis","x","tick","culling"],{}),Wg=h(["axis","x","tick","culling","max"],10),Xg=h(["axis","x","tick","count"]),Yg=h(["axis","x","tick","fit"],!1),Zg=h(["axis","x","tick","values"],null),$g=h(["axis","x","max"]),_g=h(["axis","x","min"]),ah=h(["axis","x","default"]),bh=h(["axis","x","label"],{}),ch=h(["axis","y","show"],!0),dh=h(["axis","y","max"]),eh=h(["axis","y","min"]),fh=h(["axis","y","center"]),gh=h(["axis","y","label"],{}),hh=h(["axis","y","inner"],!1),ih=h(["axis","y","tick","format"]),jh=h(["axis","y","padding"],{}),kh=h(["axis","y","ticks"],10),lh=h(["axis","y2","show"],!1),mh=h(["axis","y2","max"]),nh=h(["axis","y2","min"]),oh=h(["axis","y2","center"]),ph=h(["axis","y2","label"],{}),qh=h(["axis","y2","inner"],!1),rh=h(["axis","y2","tick","format"]),sh=h(["axis","y2","padding"],{}),th=h(["axis","y2","ticks"],10),uh=h(["grid","x","show"],!1),vh=h(["grid","x","type"],"tick"),wh=h(["grid","x","lines"],[]),xh=h(["grid","y","show"],!1),yh=h(["grid","y","lines"],[]),zh=h(["grid","y","ticks"],10),Ah=h(["point","show"],!0),Bh=Ah?h(["point","r"],2.5):0,Ch=h(["point","focus","line","enabled"],!0),Dh=h(["point","focus","expand","enabled"],!0),Eh=h(["point","focus","expand","r"],Dh?4:Bh),Fh=h(["point","focus","select","r"],8),Gh=h(["line","connect_null"],!1),Hh=h(["bar","width"]),Ih=h(["bar","width","ratio"],.6),Jh=h(["pie","label","show"],!0),Kh=h(["pie","label","format"]),Lh=h(["pie","onclick"],function(){}),Mh=h(["pie","onmouseover"],function(){}),Nh=h(["pie","onmouseout"],function(){}),Oh=h(["donut","label","show"],!0),Ph=h(["donut","label","format"]),Qh=h(["donut","title"],""),Rh=h(["donut","onclick"],function(){}),Sh=h(["donut","onmouseover"],function(){}),Th=h(["donut","onmouseout"],function(){}),Uh=h(["regions"],[]),Vh=h(["tooltip","show"],!0),Wh=h(["tooltip","format","title"]),Xh=h(["tooltip","format","value"]),Yh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Wh?Wh:b,l=Xh?Xh:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Zh=h(["tooltip","init","show"],!1),$h=h(["tooltip","init","x"],0),_h=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ai=("string"==typeof pf?pf.replace("#",""):pf.id)+"-clip",bi=ai+"-xaxis",ci=ai+"-yaxis",di=i(ai),ei=i(bi),fi=i(ci),gi="timeseries"===Qg,hi="categorized"===Qg,ii=!gi&&(ig||ne(jg)),ji=null,ki=!1,li=!1,mi=!1,ni=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],oi=he(wg,ne(Kg)?Kg:ni,vg),pi=Rg?mf.time.format:mf.time.format.utc,qi=function(){var a=[[pi("%Y/%-m/%-d"),function(){return!0}],[pi("%-m/%-d"),function(a){return a.getMonth()}],[pi("%-m/%-d"),function(a){return 1!==a.getDate()}],[pi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[pi("%I %p"),function(a){return a.getHours()}],[pi("%I:%M"),function(a){return a.getMinutes()}],[pi(":%S"),function(a){return a.getSeconds()}],[pi(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),ri=[],si=[],ti=Pg?"left":"bottom",ui=Pg?hh?"top":"bottom":hh?"right":"left",vi=Pg?qh?"bottom":"top":qh?"left":"right",wi=Pg?"left":"bottom",xi={main:function(){return"translate("+Cf.left+","+Cf.top+")"},context:function(){return"translate("+Df.left+","+Df.top+")"},legend:function(){return"translate("+Ef.left+","+Ef.top+")"},x:function(){return"translate(0,"+(Pg?0:Hf)+")"},y:function(){return"translate(0,"+(Pg?Hf:0)+")"},y2:function(){return"translate("+(Pg?0:Ff)+","+(Pg?1:0)+")"},subx:function(){return"translate(0,"+(Pg?0:If)+")"},arc:function(){return"translate("+Ff/2+","+Hf/2+")"}},yi="right"===Mg,zi=0,Ai=0,Bi=0,Ci=30,Di=30,Ei=5;Rf=mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Fi,Gi=function(){var a=mf.svg.line().x(Pg?function(a){return V(a.id)(a.value)}:ud).y(Pg?ud:function(a){return V(a.id)(a.value)});return Gh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Gh?xe(b.values):b.values;return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),ug[b.id]?Je(e,$f,V(b.id),ug[b.id]):a(e)):(c=e[0]?$f(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Pg?"M "+d+" "+c:"M "+c+" "+d)}}(),Hi=function(){var a;return a=Pg?mf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):mf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=xe(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?$f(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Pg?"M "+d+" "+c:"M "+c+" "+d)}}(),Ii=function(){var a=mf.svg.line().x(Pg?function(a){return W(a.id)(a.value)}:xd).y(Pg?xd:function(a){return W(a.id)(a.value)});return function(b){var c=xe(b.values);return Zd(b)?a(c):"M "+bg(c[0].x)+" "+W(b.id)(c[0].value)}}(),Ji=function(){};Fi=mf.svg.brush().on("brush",Se),Fi.update=function(){return Ni&&Ni.select("."+f.brush).call(this),this},Fi.scale=function(a){return Pg?this.y(a):this.x(a)},uf&&(Ji=mf.behavior.zoom().on("zoomstart",function(){Ji.altDomain=mf.event.sourceEvent.altKey?$f.orgDomain():null}).on("zoom",uf?Te:null),Ji.scale=function(a){return Pg?this.y(a):this.x(a)},Ji.orgScaleExtent=function(){var a=vf?vf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Ji.updateScaleExtent=function(){var a=$b($f.orgDomain())/$b(Ri),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Ki,Li,Mi,Ni,Oi,Pi,Qi,Ri,Si,Ti={};if(nf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ki.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),nf.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(nf.data.targets)&&Kb(a,!0),bf(a)},nf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Ki.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);nf.revert(),b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),cf(a)},nf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ki.selectAll(hd(a)),d=c.filter(hf),e=c.filter(jf);b(d.classed(f.focused,!1)),b(e),Yd(nf.data.targets)&&Lb(a),df()},nf.show=function(a,b){a=yc(a),b=b||{},Hc(a),Ki.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ef(a):Oi.selectAll(kd(a)).classed(f.legendItemHidden,!1),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Ki.selectAll(id(a)).transition().style("opacity",0),b.withLegend?ff(a):Oi.selectAll(kd(a)).classed(f.legendItemHidden,!0),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},nf.toggle=function(a){Bc(a)?nf.hide(a):nf.show(a)},nf.unzoom=function(){Fi.clear().update(),Re({withUpdateXDomain:!0})},nf.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){ng[b]=a.classes[b]}),"categories"in a&&hi&&(Sg=a.categories,eg.categories(Sg)),"cacheIds"in a&&_b(a.cacheIds)?void Ye(bc(a.cacheIds),a.done):void("unload"in a?$e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ze(a)}):Ze(a))},nf.unload=function(a){$e(yc(a),function(){Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},nf.selected=function(a){return mf.merge(Mi.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return mf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},nf.select=function(a,b,c){xg&&Mi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=mf.select(this),i="circle"===this.nodeName?re:ue,j="circle"===this.nodeName?se:ve,k=yg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?zg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},nf.unselect=function(a,b){xg&&Mi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=mf.select(this),g="circle"===this.nodeName?se:ve,h=yg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&zg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},nf.toLine=function(a){lf(a,"line")},nf.toSpline=function(a){lf(a,"spline")},nf.toBar=function(a){lf(a,"bar")},nf.toScatter=function(a){lf(a,"scatter")},nf.toArea=function(a){lf(a,"area")},nf.toAreaSpline=function(a){lf(a,"area-spline")},nf.toPie=function(a){lf(a,"pie",{withTransform:!0})},nf.toDonut=function(a){lf(a,"donut",{withTransform:!0})},nf.groups=function(a){return c(a)?og:(og=a,Re(),og)},nf.xgrids=function(a){return a?(wh=a,Re(),wh):wh},nf.xgrids.add=function(a){return a?nf.xgrids(wh.concat(a)):void 0},nf.xgrids.remove=function(a){var b=kf(a);return nf.xgrids(wh.filter(b))},nf.ygrids=function(a){return a?(yh=a,Re(),yh):yh},nf.ygrids.add=function(a){return a?nf.ygrids(yh.concat(a)):void 0},nf.ygrids.remove=function(a){var b=kf(a);return nf.ygrids(yh.filter(b))},nf.regions=function(a){return c(a)?Uh:(Uh=a,Re(),Uh)},nf.regions.add=function(a){return c(a)?Uh:(Uh=Uh.concat(a),Re(),Uh)},nf.regions.remove=function(a,c){var e=[].concat(a);return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;Ki.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Uh=Uh.filter(function(b){return b.classes.indexOf(a)<0 -})}),Uh},nf.data.get=function(a){var b=nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},nf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){mg[b]=a[b]}),gf(xc(nf.data.targets),{withTransition:!0}),mg):mg},nf.x=function(a){return arguments.length&&(mc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.xs=function(a){return arguments.length&&(nc(nf.data.targets,a),Re({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),nf.data.xs},nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(dh=+a.y),b(a.y2)&&(mh=+a.y2)):dh=mh=+a,Re())},nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(eh=+a.y),b(a.y2)&&(nh=+a.y2)):eh=nh=+a,Re())},nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&nf.axis.max(a.max),"undefined"!=typeof a.min&&nf.axis.min(a.min))},nf.legend.show=function(a){Lg||(Lg=!0,Oi.style("visibility","visible")),ef(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.legend.hide=function(a){Lg&&me(a)&&(Lg=!1,Oi.style("visibility","hidden")),ff(yc(a)),Re({withTransitionForHorizontalAxis:!1})},nf.resize=function(a){qf=a?a.width:null,rf=a?a.height:null,We({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},nf.destroy=function(){nf.data.targets=void 0,nf.data.xs={},Qi.html(""),a.onresize=null},"url"in e.data)mf.xhr(e.data.url,function(a,b){var c,d=mf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=mf.csv.parse(b.response),Ke(c)});else if("rows"in e.data)Ke(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ke(qc(e.data.columns))}return nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file +!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.31"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cGf&&(Gf=0),0>If&&(If=0),Ef={top:Qg?Df.top:Lf-Kg-(Bi?0:a),right:0/0,bottom:20+(Bi?0:a),left:Qg?Fi:Df.left},Hf=Qg?Df.left-Fi-Gi:Gf,Jf=Qg?If:Lf-Ef.top-Ef.bottom,0>Hf&&(Hf=0),0>Jf&&(Jf=0),Ff={top:Bi?0:Lf-a,right:0/0,bottom:0,left:Bi?Kf-b:0},p(),Bi&&Yd(of.data.targets)&&(Ff.left=Gf/2+Nf)}function o(){Pi.select("line."+f.xgridFocus).attr("x1",Qg?0:-10).attr("x2",Qg?Gf:-10).attr("y1",Qg?-10:Df.top).attr("y2",Qg?-10:If)}function p(){Nf=If/2,Mf=.95*Nf,Of=Xd(of.data.targets)?.6*Mf:0}function q(){var a=Qg?f.axisX:f.axisY,b=nf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=nf.select(qf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return rf?rf:x()}function s(){var a=sf?sf:y();return a>0?a:320}function t(){return Yd(of.data.targets)?0:tf?tf:Qg||!dh||ih?1:v("y")}function u(){var a=1;return Yd(of.data.targets)?0:uf?uf:Bi?P()+(mh&&!Qg?v("y2"):a):mh?rh||Qg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||dh?"y2"!==a||mh?(gb(a).isInner?30:40)+("y2"===a?-10:0):Hi:Mg&&!Bi?10:1}function x(){return+nf.select(qf).style("width").replace("px","")}function y(){return+nf.select(qf).style("height").replace("px","")}function z(a){return a?-5:-(Df.left-1)}function A(a){return a?-20:-1}function B(){return z(!Qg)}function C(){return A(!Qg)}function D(){return z(Qg)}function E(){return A(Qg)}function F(a){return a?Gf+2+4:Df.left+20}function G(a){return a?80:If+2}function H(){return F(!Qg)}function I(){return G(!Qg)}function J(){return F(Qg)}function K(){return G(Qg)}function L(){var a=Qg?If:Gf,b=vc(),c=Vb()*(Ud(of.data.targets)?(b-(ki?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){Ci=a}function N(a){Di=a}function O(a){Ei=a}function P(){return Mg?Bi?Di*(Ci+1):Kf:0}function Q(){return Mg?Bi?Lf:Ei*(Ci+1):0}function R(){var a,b=!_f;Tf=Qg?1:0,Uf=Qg?If:Gf,Vf=Qg?0:If,Wf=Qg?Gf:1,Xf=Tf,Yf=Uf,Zf=Qg?0:Jf,$f=Qg?Hf:1,_f=T(Tf,Uf,b?void 0:_f.domain(),function(){return fg.tickOffset()}),ag=U(Vf,Wf),bg=U(Vf,Wf),cg=T(Tf,Uf,Ui,function(a){return a%1?0:ig.tickOffset()}),dg=U(Zf,$f),eg=U(Zf,$f),a=$(),fg=X(_f,wi,a),ig=X(cg,zi,a),gg=Y(ag,xi,jh,lh),hg=Y(bg,yi,sh,uh),b||(Ii.scale(cg),vf&&Mi.scale(_f)),S()}function S(){Pf=Db(),Qf=Eb(),Rf=Eb(.98)}function T(a,b,e,f){var g=(ji?nf.time.scale():nf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),ki){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return nf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?bg:ag}function W(a){return"y2"===Z(a)?eg:dg}function X(a,b,c){var d=(ki?Bb():nf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),ki?(d.tickCentered(Ug),ne(Wg)&&(Wg=!1)):d.tickOffset=function(){var a=Qg?If:Gf;return a*Vb()/vc()/2},ki&&d.categories(Tg),d}function Y(a,b,c,d){return nf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in qg?qg[a]:"y"}function $(){var a=ji?ti:ki?Oc:function(a){return 0>a?a.toFixed(0):a};return Vg&&("function"==typeof Vg?a=Vg:ji&&(a=function(a){return si(Vg)(a)})),a}function _(a){var b;return"y"===a?b=hh:"y2"===a?b=qh:"x"===a&&(b=ch),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?hh=b:"y2"===a?qh=b:"x"===a&&(ch=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Qg?"inner-top":"inner-right")}function eb(){return cb("y",Qg?"inner-right":"inner-top")}function fb(){return cb("y2",Qg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?Gf/2:Gf:b.isBottom?-If:b.isMiddle?-If/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Qg,db())}function ob(){return kb(Qg,eb())}function pb(){return kb(Qg,fb())}function qb(){return lb(!Qg,db())}function rb(){return lb(Qg,eb())}function sb(){return lb(Qg,fb())}function tb(){var a=db();return Qg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Qg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Qg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Qg,db())}function xb(){return mb(Qg,eb())}function yb(){return mb(Qg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return nf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Pi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Pi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Pi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+o)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Mc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return nf.min(Object.keys(i).map(function(a){return nf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(pg.length>0)for(g=Nc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return nf.max(Object.keys(i).map(function(a){return nf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?oh:fh,n="y2"===c?nh:eh,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?ph:gh,r=pd()&&Qg;return 0===l.length?"y2"===c?bg.domain():ag.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=qd(o,p),j=$b(ag.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&kh&&(f=b(kh.top)?kh.top:e,g=b(kh.bottom)?kh.bottom:e),"y2"===c&&th&&(f=b(th.top)?th.top:e,g=b(th.bottom)?th.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Ui),c=$b(_f.domain());return a||0===c?1:b/c}function Wb(a){return ah?ah:nf.min(a,function(a){return nf.min(a.values,function(a){return a.x})})}function Xb(a){return _g?_g:nf.max(a,function(a){return nf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return ki?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=0,g=0;return(c||0===c)&&(f=ji?new Date(c.getTime()-e):c-e),(d||0===d)&&(g=ji?new Date(d.getTime()+e):d+e),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return jg&&a===jg||oe(kg)&&pe(kg,a)}function fc(a){return!ec(a)}function gc(a){return jg?jg:oe(kg)?kg[a]:null}function hc(a,b){var c,d=b&&oe(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=of.data.xs[b])}),c}function ic(a,b){return a in of.data.xs&&of.data.xs[a]&&of.data.xs[a][b]?of.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){kg[b]=a[b]})}function kc(a){return 1===nf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=ng[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),of.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=ji?a?a instanceof Date?a:je(a):je(ic(b,c)):li&&!ki?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?of.data.xs[c]=a.map(function(a){return a[f]}).filter(b):jg?(d=Object.keys(of.data.xs),of.data.xs[c]=d.length>0?of.data.xs[d[0]]:void 0):oe(kg)&&(of.data.xs[c]=hc(f,of.data.targets)):of.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!of.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=mg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return li&&ki&&0===c&&g&&(0===e&&(Tg=[]),Tg.push(g)),("undefined"==typeof a[b]||of.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),rg&&Sd(xc(c).filter(function(a){return!(a in sg)}),rg),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function tc(a){return a>0&&of.data.targets[0].values[a-1]?of.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?of.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?of.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(of.data.targets)}function zc(a,b){var c,d=xc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(ji?new Date(h):h);i.push(d)}return ji||(i=i.sort(function(a,b){return a-b})),i}function Gc(a){ui=ui.concat(a)}function Hc(a){ui=ui.filter(function(b){return a.indexOf(b)<0})}function Ic(a){vi=vi.concat(a)}function Jc(a){vi=vi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=qe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return nf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Ed(){return ug&&"desc"===ug.toLowerCase()}function Fd(){return ug&&"asc"===ug.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof ug&&a.sort(ug),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(of.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Yh&&0!==m.length&&(Si.html(_h(a,$(),l,ri)).style("display","block"),d=Si.property("offsetWidth"),e=Si.property("offsetHeight"),k?(g=Gf/2+c[0],i=If/2+c[1]+20):(Qg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=_f(m[0].x)+20):(f=q(),g=f+t()+_f(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Si.style("top",i+"px").style("left",g+"px"))}function Id(){Si.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Yh&&(Vd(of.data.targets)||Yd(of.data.targets)||Pi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Qg?"y1":"x1",ud).attr(Qg?"y2":"x2",ud))}function Kd(){Pi.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?_f(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Ih?Ih:b?2*a.tickOffset()*Jh/b:0}function Sd(a,b){yc(a).forEach(function(a){Wi[a]=b===sg[a],sg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){sg[a.id]===b&&(c=!0),a.id in sg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in sg)||"line"===sg[b]||"spline"===sg[b]||"area"===sg[b]||"area-spline"===sg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===sg[b]||"area-spline"===sg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===sg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===sg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===sg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===sg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(a){return ce(a)&&Sh||be(a)&&Mh}function ie(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function je(b){var c;try{c=lg?nf.time.format(lg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+lg)}return c}function ke(a,b){var c=nf.mouse(a),d=nf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function pe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function qe(a,b){var c="y"===Z(a.id)?ag:bg,d=Qg?1:0,e=Qg?0:1;return Math.pow(_f(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function re(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function se(a,b,c){Fg(b,a.node()),Pi.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Qg?Md:Ld).attr("cy",Qg?Ld:Md).attr("stroke",function(){return ri(b)}).attr("r",1.4*Gh).transition().duration(100).attr("r",Gh)}function te(a,b,c){Gg(b,a.node()),Pi.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ue(a,b,c,d){a?se(b,c,d):te(b,c,d)}function ve(a,b){Fg(b,a.node()),a.transition().duration(100).style("fill",function(){return nf.rgb(ri(b)).darker(1)})}function we(a,b){Gg(b,a.node()),a.transition().duration(100).style("fill",function(){return ri(b)})}function xe(a,b,c,d){a?ve(b,c,d):we(b,c,d)}function ye(a){return a.filter(function(a){return b(a.value)})}function ze(a,c){return(c?Pi.selectAll("."+f.circles+gd(c)):Pi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ae(a,b){ze(a,b).classed(f.EXPANDED,!0).attr("r",Fh)}function Be(a){ze(a).filter(function(){return nf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Ch)}function Ce(a){return Pi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function De(a){Ce(a).classed(f.EXPANDED,!0)}function Ee(a){Ce(a).classed(f.EXPANDED,!1)}function Fe(a,b){var c=Je(a,b);return function(a,b){var d=c(a,b),e=Qg?1:0,f=Qg?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 Ge(a,b){var c=Je(a,!1),d=b?He:Ie;return function(a,b){return d(c(a,b),a,this)}}function He(a,b){var c;return Qg?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ie(a,b,c){var d=c.getBoundingClientRect();return Qg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Je(a,b){var c=a.__max__+1,d=Rd(fg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Qg&&(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 Ke(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 Le(b){var c,d,e;if(Ti=nf.select(qf),Ti.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Ti.html(""),Ti.classed("c3",!0),of.data.xs={},of.data.targets=rc(b),n(),R(),_f.domain(nf.extent(Zb(of.data.targets))),ag.domain(Ub(of.data.targets,"y")),bg.domain(Ub(of.data.targets,"y2")),cg.domain(_f.domain()),dg.domain(ag.domain()),eg.domain(bg.domain()),Ui=_f.domain(),Ii.scale(cg),vf&&Mi.scale(_f),Ni=Ti.append("svg").attr("width",Gf+Df.left+Df.right).attr("height",If+Df.top+Df.bottom).on("mouseenter",yf).on("mouseleave",zf),Oi=Ni.append("defs"),Oi.append("clipPath").attr("id",di).append("rect").attr("width",Gf).attr("height",If),Oi.append("clipPath").attr("id",ei).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Oi.append("clipPath").attr("id",fi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Pi=Ni.append("g").attr("transform",Ai.main),Qi=Jg?Ni.append("g").attr("transform",Ai.context):null,Ri=Ni.append("g").attr("transform",Ai.legend),Mg||(Ri.style("visibility","hidden"),vi=xc(of.data.targets)),Si=nf.select(qf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),hf(xc(of.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Pi.append("g").attr("class",f.axisX).attr("clip-path",Qg?"":hi).attr("transform",Ai.x).append("text").attr("class",f.axisXLabel).attr("transform",Qg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),dh&&Pi.append("g").attr("class",f.axisY).attr("clip-path",Qg?ii:"").attr("transform",Ai.y).append("text").attr("class",f.axisYLabel).attr("transform",Qg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),mh&&Pi.append("g").attr("class",f.axisY2).attr("transform",Ai.y2).append("text").attr("class",f.axisY2Label).attr("transform",Qg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Pi.append("g").attr("clip-path",gi).attr("class",f.grid),vh&&d.append("g").attr("class",f.xgrids),oe(xh)&&d.append("g").attr("class",f.xgridLines),Dh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),yh&&d.append("g").attr("class",f.ygrids),oe(zh)&&d.append("g").attr("class",f.ygridLines),Pi.append("g").attr("clip-path",gi).attr("class",f.regions),Pi.append("g").attr("clip-path",gi).attr("class",f.chart),c=Pi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",vf?Qg?"ns-resize":"ew-resize":null),Pi.select("."+f.chart).append("g").attr("class",f.chartBars),Pi.select("."+f.chart).append("g").attr("class",f.chartLines),Pi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Ai.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Pi.select("."+f.chart).append("g").attr("class",f.chartTexts),vf&&Pi.insert("rect",xf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Gf).attr("height",If).style("opacity",0).style("cursor",Qg?"ns-resize":"ew-resize").call(Mi).on("dblclick.zoom",null),bh&&Ii.extent("function"!=typeof bh?bh:bh(Zb())),Jg&&(Qi.append("g").attr("clip-path",gi).attr("class",f.chart),Qi.select("."+f.chart).append("g").attr("class",f.chartBars),Qi.select("."+f.chart).append("g").attr("class",f.chartLines),Qi.append("g").attr("clip-path",gi).attr("class",f.brush).call(Ii).selectAll("rect").attr(Qg?"width":"height",Qg?Hf:Jf),Qi.append("g").attr("class",f.axisX).attr("transform",Ai.subx).attr("clip-path",Qg?"":hi)),Ye(of.data.targets),Qg?Pi.select("."+f.axisX).style("opacity",0).call(fg):(Pi.select("."+f.axisY).style("opacity",0).call(gg),Pi.select("."+f.axisY2).style("opacity",0).call(hg)),Se({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),ai){if(ji&&"string"==typeof bi){for(bi=je(bi),e=0;e0){d=[];for(var g in ng)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=xe,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 Qe(a){Yd(of.data.targets)||yg&&(mi=a,Pi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),ni=!0,Hg())}function Re(){Yd(of.data.targets)||yg&&(Pi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Pi.selectAll("."+f.shape).classed(f.INCLUDED,!1),ni=!1,Ig())}function Se(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Nd(),U=Yd(of.data.targets),V=Dc(of.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?Cf:0,O=B?N:0,P=C?N:0,H&&Mg&&hf(xc(of.data.targets),a),G&&(_f.domain(nf.extent(Zb(V))),Ui=_f.domain(),vf&&Mi.scale(_f).updateScaleExtent(),cg.domain(_f.domain()),Ii.scale(cg)),F&&(_f.domain(Ii.empty()?Ui:Ii.extent()),vf&&Mi.scale(_f).updateScaleExtent()),ag.domain(Ub(V,"y")),bg.domain(Ub(V,"y2")),Vd(V)||(Q=$g?$g:Fc(Ec(V)),fg.tickValues(Q),ig.tickValues(Q)),c=Pi.select("."+f.axisX).style("opacity",U?0:1),(Qg||D)&&(c=c.transition().duration(P)),c.call(fg),e=Pi.select("."+f.axisY).style("opacity",U?0:1),(!Qg||D)&&(e=e.transition().duration(P)),e.call(gg),Pi.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(hg),F)if(Wg&&Q){for(R=1;R=0&&nf.select(this).style("display",b%S?"none":"block")})}else nf.selectAll("."+f.axisX+" .tick text").style("display","block");if(I=Fe(T),K=Ge(T,!0),M=Ge(T,!1),Ab(),dg.domain(ag.domain()),eg.domain(bg.domain()),Si.style("display","none"),o(),Pi.select("line."+f.xgridFocus).style("visibility","hidden"),vh){if("year"===wh){h=[];for(var W=Zb(),X=W[0].getFullYear(),Y=W[1].getFullYear(),Z=X;Y>=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=_f.ticks(10);g=Pi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Qg?0:function(a){return _f(a)-fg.tickOffset()}).attr("x2",Qg?Gf:function(a){return _f(a)-fg.tickOffset()}).attr("y1",Qg?function(a){return _f(a)-fg.tickOffset()}:Df.top).attr("y2",Qg?function(a){return _f(a)-fg.tickOffset()}:If).style("opacity",function(){return+nf.select(this).attr(Qg?"y1":"x1")===(Qg?If:0)?0:1}),g.exit().remove()}oe(xh)&&(i=Pi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(xh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Qg?"":"rotate(-90)").attr("dx",Qg?0:-Df.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Qg?0:vd).attr("x2",Qg?Gf:vd).attr("y1",Qg?vd:Df.top).attr("y2",Qg?vd:If).style("opacity",1),i.select("text").transition().duration(N).attr("x",Qg?Gf:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&yh&&(k=Pi.select("."+f.ygrids).selectAll("."+f.ygrid).data(ag.ticks(Ah)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Qg?ag:0).attr("x2",Qg?ag:Gf).attr("y1",Qg?0:ag).attr("y2",Qg?If:ag),k.exit().remove()),y&&oe(zh)&&(l=Pi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(zh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Qg?"rotate(-90)":"").attr("dx",Qg?0:-Df.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Qg?wd:0).attr("x2",Qg?wd:Gf).attr("y1",Qg?0:wd).attr("y2",Qg?If:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Qg?0:Gf).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Pi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ri(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Pi.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Qg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Pi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ji).style("opacity",1),Pi.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Ki).style("opacity",Vi),n=Pi.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",Ch),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Qg?Md:Ld).attr("cy",Qg?Ld:Md),n.exit().remove(),Pi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=nf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Pi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Pi.select("."+f.chartArcsTitle).style("opacity",Xd(of.data.targets)?1:0),Jg&&(null!==nf.event&&"zoom"===nf.event.type&&Ii.extent(_f.orgDomain()).update(),z&&(Qi.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(ig),Ii.empty()||Ii.extent(_f.orgDomain()).update(),J=Fe(T,!0),s=Qi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ri(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Qi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Li).style("opacity",1))),Pi.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Pi.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Qg?Md:Ld).attr("cy",Qg?Ld:Md),t=Pi.select("."+f.eventRects),oe(kg)&&!kc(kg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Pi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ne(u.enter()),u.attr("x",0).attr("y",0).attr("width",Gf).attr("height",If)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),li&&!ki?(x=function(a,b){var c=tc(b),d=uc(b),e=of.data.xs[a.id][b];return(_f(d?d:e+50)-_f(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=of.data.xs[a.id][b];return(_f(d)+_f(c?c:d-50))/2}):(x=L(),w=function(a){return _f(a.x)-x/2}),v=wc(),Pi.select("."+f.eventRects).datum(v?v.values:[]),u=Pi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Me(u.enter()),u.attr("class",ad).attr("x",Qg?0:w).attr("y",Qg?w:0).attr("width",Qg?Gf:x).attr("height",Qg?x:If),u.exit().remove()),q=Pi.select("."+f.regions).selectAll("rect."+f.region).data(Xh),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Qg?0:cc).attr("y",Qg?cc:Df.top).attr("width",Qg?Gf:dc).attr("height",Qg?dc:If).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),xc(of.data.targets).forEach(function(a){Wi[a]=!0})}}function Te(){Se({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ue(){return"mousemove"===nf.event.sourceEvent.type&&Mi.altDomain?(_f.domain(Mi.altDomain),void Mi.scale(_f).updateScaleExtent()):(ki&&_f.orgDomain()[0]===Ui[0]&&_f.domain([Ui[0]-1e-10,_f.orgDomain()[1]]),Se({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===nf.event.sourceEvent.type&&(oi=!0)))}function Ve(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function We(){Ni.attr("width",Kf).attr("height",Lf),Ni.select("#"+di).select("rect").attr("width",Gf).attr("height",If),Ni.select("#"+ei).select("rect").attr("width",H),Ni.select("#"+fi).select("rect").attr("width",J),Ni.select("."+f.zoomRect).attr("width",Gf).attr("height",If)}function Xe(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),We(),m(a.withTransition),Se(a)}function Ye(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Pi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ri(a)}),e=Pi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ri(a)}).style("stroke","none").style("cursor",function(a){return Ag(a)?"pointer":null}),c=Pi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ri(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Vi=+nf.select(this).style("opacity"),0}).style("fill",function(a){return ri(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ri(a)}).style("cursor",function(a){return Ag(a)?"pointer":null}),a.forEach(function(a){Pi.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Pi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Sf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ri(a.data)}).style("cursor",function(a){return Ag(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),cf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,nf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),ef(),Id(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Jg&&(n=Qi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ri(a)}),l=Qi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ri(a)})),Ni.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ze(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),of.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Bi?j:i,l=Bi?Q():P();return d&&(w=0,C=0,t=0,u=0),Mg&&!Cc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Bi?u:t,void(Pg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,Bi?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Ri.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Og?Og(a):of.toggle(a)}).on("mouseover",function(a){of.focus(a)}).on("mouseout",function(){of.revert()}),l.append("text").text(function(a){return d(ng[a])?ng[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",Bi?g:-200).attr("y",Bi?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Bi?h:-200).attr("y",Bi?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return ri(a)}).attr("x",Bi?g:-200).attr("y",Bi?-200:i).attr("width",10).attr("height",10),Ri.selectAll("text").data(a).text(function(a){return d(ng[a])?ng[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ri.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ri.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),We(),q&&m(p)}function jf(a){return zc(of.data.targets,a.id)}function kf(a){return"data"in a&&zc(of.data.targets,a.data.id)}function lf(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 mf(a,b,c){var d=!Yd(of.data.targets);Sd(a,b),Xe(c?c:{withTransitionForAxis:d})}var nf=a.d3?a.d3:a.require?a.require("d3"):void 0,of={data:{},axis:{},legend:{}},pf={},qf=h(["bindto"],"#chart"),rf=h(["size","width"]),sf=h(["size","height"]),tf=h(["padding","left"]),uf=h(["padding","right"]),vf=h(["zoom","enabled"],!1),wf=h(["zoom","extent"]),xf=h(["zoom","privileged"],!1),yf=h(["onenter"],function(){}),zf=h(["onleave"],function(){}),Af=h(["onresize"],function(){}),Bf=h(["onresized"],function(){}),Cf=h(["transition","duration"],350);g("data","data is required in config");var Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg=h(["data","x"]),kg=h(["data","xs"],{}),lg=h(["data","x_format"]),mg=h(["data","id_converter"],function(a){return a}),ng=h(["data","names"],{}),og=h(["data","classes"],{}),pg=h(["data","groups"],[]),qg=h(["data","axes"],{}),rg=h(["data","type"]),sg=h(["data","types"],{}),tg=h(["data","labels"],{}),ug=h(["data","order"]),vg=h(["data","regions"],{}),wg=h(["data","color"]),xg=h(["data","colors"],{}),yg=h(["data","selection","enabled"],!1),zg=h(["data","selection","grouped"],!1),Ag=h(["data","selection","isselectable"],function(){return!0}),Bg=h(["data","selection","multiple"],!0),Cg=h(["data","onclick"],function(){}),Dg=h(["data","onenter"],function(){}),Eg=h(["data","onleave"],function(){}),Fg=h(["data","onselected"],function(){}),Gg=h(["data","onunselected"],function(){}),Hg=h(["data","ondragstart"],function(){}),Ig=h(["data","ondragend"],function(){}),Jg=h(["subchart","show"],!1),Kg=Jg?h(["subchart","size","height"],60):0,Lg=h(["color","pattern"],[]),Mg=h(["legend","show"],!0),Ng=h(["legend","position"],"bottom"),Og=h(["legend","item","onclick"]),Pg=h(["legend","equally"],!1),Qg=h(["axis","rotated"],!1),Rg=h(["axis","x","type"],"indexed"),Sg=h(["axis","x","localtime"],!1),Tg=h(["axis","x","categories"],[]),Ug=h(["axis","x","tick","centered"],!1),Vg=h(["axis","x","tick","format"]),Wg=h(["axis","x","tick","culling"],{}),Xg=h(["axis","x","tick","culling","max"],10),Yg=h(["axis","x","tick","count"]),Zg=h(["axis","x","tick","fit"],!1),$g=h(["axis","x","tick","values"],null),_g=h(["axis","x","max"]),ah=h(["axis","x","min"]),bh=h(["axis","x","default"]),ch=h(["axis","x","label"],{}),dh=h(["axis","y","show"],!0),eh=h(["axis","y","max"]),fh=h(["axis","y","min"]),gh=h(["axis","y","center"]),hh=h(["axis","y","label"],{}),ih=h(["axis","y","inner"],!1),jh=h(["axis","y","tick","format"]),kh=h(["axis","y","padding"],{}),lh=h(["axis","y","ticks"],10),mh=h(["axis","y2","show"],!1),nh=h(["axis","y2","max"]),oh=h(["axis","y2","min"]),ph=h(["axis","y2","center"]),qh=h(["axis","y2","label"],{}),rh=h(["axis","y2","inner"],!1),sh=h(["axis","y2","tick","format"]),th=h(["axis","y2","padding"],{}),uh=h(["axis","y2","ticks"],10),vh=h(["grid","x","show"],!1),wh=h(["grid","x","type"],"tick"),xh=h(["grid","x","lines"],[]),yh=h(["grid","y","show"],!1),zh=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(["line","connect_null"],!1),Ih=h(["bar","width"]),Jh=h(["bar","width","ratio"],.6),Kh=h(["pie","label","show"],!0),Lh=h(["pie","label","format"]),Mh=h(["pie","expand"],!0),Nh=h(["pie","onclick"],function(){}),Oh=h(["pie","onmouseover"],function(){}),Ph=h(["pie","onmouseout"],function(){}),Qh=h(["donut","label","show"],!0),Rh=h(["donut","label","format"]),Sh=h(["donut","expand"],!0),Th=h(["donut","title"],""),Uh=h(["donut","onclick"],function(){}),Vh=h(["donut","onmouseover"],function(){}),Wh=h(["donut","onmouseout"],function(){}),Xh=h(["regions"],[]),Yh=h(["tooltip","show"],!0),Zh=h(["tooltip","format","title"]),$h=h(["tooltip","format","value"]),_h=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Zh?Zh:b,l=$h?$h: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+""}),ai=h(["tooltip","init","show"],!1),bi=h(["tooltip","init","x"],0),ci=h(["tooltip","init","position"],{top:"0px",left:"50px"}),di=("string"==typeof qf?qf.replace("#",""):qf.id)+"-clip",ei=di+"-xaxis",fi=di+"-yaxis",gi=i(di),hi=i(ei),ii=i(fi),ji="timeseries"===Rg,ki="categorized"===Rg,li=!ji&&(jg||oe(kg)),mi=null,ni=!1,oi=!1,pi=!1,qi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ri=ie(xg,oe(Lg)?Lg:qi,wg),si=Sg?nf.time.format:nf.time.format.utc,ti=function(){var a=[[si("%Y/%-m/%-d"),function(){return!0}],[si("%-m/%-d"),function(a){return a.getMonth()}],[si("%-m/%-d"),function(a){return 1!==a.getDate()}],[si("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[si("%I %p"),function(a){return a.getHours()}],[si("%I:%M"),function(a){return a.getMinutes()}],[si(":%S"),function(a){return a.getSeconds()}],[si(".%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)}}(),ui=[],vi=[],wi=Qg?"left":"bottom",xi=Qg?ih?"top":"bottom":ih?"right":"left",yi=Qg?rh?"bottom":"top":rh?"left":"right",zi=Qg?"left":"bottom",Ai={main:function(){return"translate("+Df.left+","+Df.top+")"},context:function(){return"translate("+Ef.left+","+Ef.top+")"},legend:function(){return"translate("+Ff.left+","+Ff.top+")"},x:function(){return"translate(0,"+(Qg?0:If)+")"},y:function(){return"translate(0,"+(Qg?If:0)+")"},y2:function(){return"translate("+(Qg?0:Gf)+","+(Qg?1:0)+")"},subx:function(){return"translate(0,"+(Qg?0:Jf)+")"},arc:function(){return"translate("+Gf/2+","+If/2+")"}},Bi="right"===Ng,Ci=0,Di=0,Ei=0,Fi=30,Gi=30,Hi=5;Sf=nf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Ii,Ji=function(){var a=nf.svg.line().x(Qg?function(a){return V(a.id)(a.value)}:ud).y(Qg?ud:function(a){return V(a.id)(a.value)});return Hh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Hh?ye(b.values):b.values;return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),vg[b.id]?Ke(e,_f,V(b.id),vg[b.id]):a(e)):(c=e[0]?_f(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Qg?"M "+d+" "+c:"M "+c+" "+d)}}(),Ki=function(){var a;return a=Qg?nf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):nf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=ye(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?_f(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Qg?"M "+d+" "+c:"M "+c+" "+d)}}(),Li=function(){var a=nf.svg.line().x(Qg?function(a){return W(a.id)(a.value)}:xd).y(Qg?xd:function(a){return W(a.id)(a.value)});return function(b){var c=ye(b.values);return Zd(b)?a(c):"M "+cg(c[0].x)+" "+W(b.id)(c[0].value)}}(),Mi=function(){};Ii=nf.svg.brush().on("brush",Te),Ii.update=function(){return Qi&&Qi.select("."+f.brush).call(this),this},Ii.scale=function(a){return Qg?this.y(a):this.x(a)},vf&&(Mi=nf.behavior.zoom().on("zoomstart",function(){Mi.altDomain=nf.event.sourceEvent.altKey?_f.orgDomain():null}).on("zoom",vf?Ue:null),Mi.scale=function(a){return Qg?this.y(a):this.x(a)},Mi.orgScaleExtent=function(){var a=wf?wf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Mi.updateScaleExtent=function(){var a=$b(_f.orgDomain())/$b(Ui),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Ni,Oi,Pi,Qi,Ri,Si,Ti,Ui,Vi,Wi={};if(of.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ni.selectAll(hd(a)),d=c.filter(jf),e=c.filter(kf);of.revert(),of.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(of.data.targets)&&Kb(a,!0),cf(a)},of.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Ni.selectAll(hd(a)),d=c.filter(jf),e=c.filter(kf);of.revert(),b(d.classed(f.focused,!1)),b(e),Yd(of.data.targets)&&Lb(a),df(a)},of.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ni.selectAll(hd(a)),d=c.filter(jf),e=c.filter(kf);b(d.classed(f.focused,!1)),b(e),Yd(of.data.targets)&&Lb(a),ef()},of.show=function(a,b){a=yc(a),b=b||{},Hc(a),Ni.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ff(a):Ri.selectAll(kd(a)).classed(f.legendItemHidden,!1),Se({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},of.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Ni.selectAll(id(a)).transition().style("opacity",0),b.withLegend?gf(a):Ri.selectAll(kd(a)).classed(f.legendItemHidden,!0),Se({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},of.toggle=function(a){Bc(a)?of.hide(a):of.show(a)},of.unzoom=function(){Ii.clear().update(),Se({withUpdateXDomain:!0})},of.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){og[b]=a.classes[b]}),"categories"in a&&ki&&(Tg=a.categories,fg.categories(Tg)),"cacheIds"in a&&_b(a.cacheIds)?void Ze(bc(a.cacheIds),a.done):void("unload"in a?_e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){$e(a)}):$e(a))},of.unload=function(a){_e(yc(a),function(){Se({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},of.selected=function(a){return nf.merge(Pi.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return nf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},of.select=function(a,b,c){yg&&Pi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=nf.select(this),i="circle"===this.nodeName?se:ve,j="circle"===this.nodeName?te:we,k=zg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Ag(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},of.unselect=function(a,b){yg&&Pi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=nf.select(this),g="circle"===this.nodeName?te:we,h=zg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Ag(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},of.toLine=function(a){mf(a,"line")},of.toSpline=function(a){mf(a,"spline")},of.toBar=function(a){mf(a,"bar")},of.toScatter=function(a){mf(a,"scatter")},of.toArea=function(a){mf(a,"area")},of.toAreaSpline=function(a){mf(a,"area-spline")},of.toPie=function(a){mf(a,"pie",{withTransform:!0})},of.toDonut=function(a){mf(a,"donut",{withTransform:!0})},of.groups=function(a){return c(a)?pg:(pg=a,Se(),pg)},of.xgrids=function(a){return a?(xh=a,Se(),xh):xh},of.xgrids.add=function(a){return a?of.xgrids(xh.concat(a)):void 0},of.xgrids.remove=function(a){var b=lf(a);return of.xgrids(xh.filter(b))},of.ygrids=function(a){return a?(zh=a,Se(),zh):zh},of.ygrids.add=function(a){return a?of.ygrids(zh.concat(a)):void 0},of.ygrids.remove=function(a){var b=lf(a);return of.ygrids(zh.filter(b))},of.regions=function(a){return c(a)?Xh:(Xh=a,Se(),Xh)},of.regions.add=function(a){return c(a)?Xh:(Xh=Xh.concat(a),Se(),Xh)},of.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;Ni.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Xh=Xh.filter(function(b){return b.classes.indexOf(a)<0 +})}),Xh},of.data.get=function(a){var b=of.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},of.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},of.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){ng[b]=a[b]}),hf(xc(of.data.targets),{withTransition:!0}),ng):ng},of.x=function(a){return arguments.length&&(mc(of.data.targets,a),Se({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),of.data.xs},of.xs=function(a){return arguments.length&&(nc(of.data.targets,a),Se({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),of.data.xs},of.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},of.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(eh=+a.y),b(a.y2)&&(nh=+a.y2)):eh=nh=+a,Se())},of.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(fh=+a.y),b(a.y2)&&(oh=+a.y2)):fh=oh=+a,Se())},of.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&of.axis.max(a.max),"undefined"!=typeof a.min&&of.axis.min(a.min))},of.legend.show=function(a){Mg||(Mg=!0,Ri.style("visibility","visible")),ff(yc(a)),Se({withTransitionForHorizontalAxis:!1})},of.legend.hide=function(a){Mg&&ne(a)&&(Mg=!1,Ri.style("visibility","hidden")),gf(yc(a)),Se({withTransitionForHorizontalAxis:!1})},of.resize=function(a){rf=a?a.width:null,sf=a?a.height:null,Xe({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},of.destroy=function(){of.data.targets=void 0,of.data.xs={},Ti.html(""),a.onresize=null},"url"in e.data)nf.xhr(e.data.url,function(a,b){var c,d=nf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=nf.csv.parse(b.response),Le(c)});else if("rows"in e.data)Le(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Le(qc(e.data.columns))}return of},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From f0164c7e837ca1638af942d446ff9a2ab798af85 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 16 Apr 2014 11:50:16 +0900 Subject: [PATCH 044/178] Add onmouseover/onmouseout for legend item --- c3.js | 10 +++++++++- c3.min.js | 6 +++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/c3.js b/c3.js index 0e63029..ecfa585 100644 --- a/c3.js +++ b/c3.js @@ -160,6 +160,8 @@ var __legend_show = getConfig(['legend', 'show'], true), __legend_position = getConfig(['legend', 'position'], 'bottom'), __legend_item_onclick = getConfig(['legend', 'item', 'onclick']), + __legend_item_onmouseover = getConfig(['legend', 'item', 'onmouseover']), + __legend_item_onmouseout = getConfig(['legend', 'item', 'onmouseout']), __legend_equally = getConfig(['legend', 'equally'], false); // axis @@ -3833,9 +3835,15 @@ }) .on('mouseover', function (id) { c3.focus(id); + if (typeof __legend_item_onmouseover === 'function') { + __legend_item_onmouseover(id); + } }) - .on('mouseout', function () { + .on('mouseout', function (id) { c3.revert(); + if (typeof __legend_item_onmouseout === 'function') { + __legend_item_onmouseout(id); + } }); l.append('text') .text(function (id) { return isDefined(__data_names[id]) ? __data_names[id] : id; }) diff --git a/c3.min.js b/c3.min.js index a9047a7..317a2f5 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.31"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cGf&&(Gf=0),0>If&&(If=0),Ef={top:Qg?Df.top:Lf-Kg-(Bi?0:a),right:0/0,bottom:20+(Bi?0:a),left:Qg?Fi:Df.left},Hf=Qg?Df.left-Fi-Gi:Gf,Jf=Qg?If:Lf-Ef.top-Ef.bottom,0>Hf&&(Hf=0),0>Jf&&(Jf=0),Ff={top:Bi?0:Lf-a,right:0/0,bottom:0,left:Bi?Kf-b:0},p(),Bi&&Yd(of.data.targets)&&(Ff.left=Gf/2+Nf)}function o(){Pi.select("line."+f.xgridFocus).attr("x1",Qg?0:-10).attr("x2",Qg?Gf:-10).attr("y1",Qg?-10:Df.top).attr("y2",Qg?-10:If)}function p(){Nf=If/2,Mf=.95*Nf,Of=Xd(of.data.targets)?.6*Mf:0}function q(){var a=Qg?f.axisX:f.axisY,b=nf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=nf.select(qf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return rf?rf:x()}function s(){var a=sf?sf:y();return a>0?a:320}function t(){return Yd(of.data.targets)?0:tf?tf:Qg||!dh||ih?1:v("y")}function u(){var a=1;return Yd(of.data.targets)?0:uf?uf:Bi?P()+(mh&&!Qg?v("y2"):a):mh?rh||Qg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||dh?"y2"!==a||mh?(gb(a).isInner?30:40)+("y2"===a?-10:0):Hi:Mg&&!Bi?10:1}function x(){return+nf.select(qf).style("width").replace("px","")}function y(){return+nf.select(qf).style("height").replace("px","")}function z(a){return a?-5:-(Df.left-1)}function A(a){return a?-20:-1}function B(){return z(!Qg)}function C(){return A(!Qg)}function D(){return z(Qg)}function E(){return A(Qg)}function F(a){return a?Gf+2+4:Df.left+20}function G(a){return a?80:If+2}function H(){return F(!Qg)}function I(){return G(!Qg)}function J(){return F(Qg)}function K(){return G(Qg)}function L(){var a=Qg?If:Gf,b=vc(),c=Vb()*(Ud(of.data.targets)?(b-(ki?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){Ci=a}function N(a){Di=a}function O(a){Ei=a}function P(){return Mg?Bi?Di*(Ci+1):Kf:0}function Q(){return Mg?Bi?Lf:Ei*(Ci+1):0}function R(){var a,b=!_f;Tf=Qg?1:0,Uf=Qg?If:Gf,Vf=Qg?0:If,Wf=Qg?Gf:1,Xf=Tf,Yf=Uf,Zf=Qg?0:Jf,$f=Qg?Hf:1,_f=T(Tf,Uf,b?void 0:_f.domain(),function(){return fg.tickOffset()}),ag=U(Vf,Wf),bg=U(Vf,Wf),cg=T(Tf,Uf,Ui,function(a){return a%1?0:ig.tickOffset()}),dg=U(Zf,$f),eg=U(Zf,$f),a=$(),fg=X(_f,wi,a),ig=X(cg,zi,a),gg=Y(ag,xi,jh,lh),hg=Y(bg,yi,sh,uh),b||(Ii.scale(cg),vf&&Mi.scale(_f)),S()}function S(){Pf=Db(),Qf=Eb(),Rf=Eb(.98)}function T(a,b,e,f){var g=(ji?nf.time.scale():nf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),ki){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return nf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?bg:ag}function W(a){return"y2"===Z(a)?eg:dg}function X(a,b,c){var d=(ki?Bb():nf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),ki?(d.tickCentered(Ug),ne(Wg)&&(Wg=!1)):d.tickOffset=function(){var a=Qg?If:Gf;return a*Vb()/vc()/2},ki&&d.categories(Tg),d}function Y(a,b,c,d){return nf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in qg?qg[a]:"y"}function $(){var a=ji?ti:ki?Oc:function(a){return 0>a?a.toFixed(0):a};return Vg&&("function"==typeof Vg?a=Vg:ji&&(a=function(a){return si(Vg)(a)})),a}function _(a){var b;return"y"===a?b=hh:"y2"===a?b=qh:"x"===a&&(b=ch),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?hh=b:"y2"===a?qh=b:"x"===a&&(ch=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Qg?"inner-top":"inner-right")}function eb(){return cb("y",Qg?"inner-right":"inner-top")}function fb(){return cb("y2",Qg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?Gf/2:Gf:b.isBottom?-If:b.isMiddle?-If/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Qg,db())}function ob(){return kb(Qg,eb())}function pb(){return kb(Qg,fb())}function qb(){return lb(!Qg,db())}function rb(){return lb(Qg,eb())}function sb(){return lb(Qg,fb())}function tb(){var a=db();return Qg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Qg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Qg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Qg,db())}function xb(){return mb(Qg,eb())}function yb(){return mb(Qg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return nf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Pi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Pi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Pi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+o)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Mc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return nf.min(Object.keys(i).map(function(a){return nf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(pg.length>0)for(g=Nc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return nf.max(Object.keys(i).map(function(a){return nf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?oh:fh,n="y2"===c?nh:eh,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?ph:gh,r=pd()&&Qg;return 0===l.length?"y2"===c?bg.domain():ag.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=qd(o,p),j=$b(ag.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&kh&&(f=b(kh.top)?kh.top:e,g=b(kh.bottom)?kh.bottom:e),"y2"===c&&th&&(f=b(th.top)?th.top:e,g=b(th.bottom)?th.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Ui),c=$b(_f.domain());return a||0===c?1:b/c}function Wb(a){return ah?ah:nf.min(a,function(a){return nf.min(a.values,function(a){return a.x})})}function Xb(a){return _g?_g:nf.max(a,function(a){return nf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return ki?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=0,g=0;return(c||0===c)&&(f=ji?new Date(c.getTime()-e):c-e),(d||0===d)&&(g=ji?new Date(d.getTime()+e):d+e),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return jg&&a===jg||oe(kg)&&pe(kg,a)}function fc(a){return!ec(a)}function gc(a){return jg?jg:oe(kg)?kg[a]:null}function hc(a,b){var c,d=b&&oe(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=of.data.xs[b])}),c}function ic(a,b){return a in of.data.xs&&of.data.xs[a]&&of.data.xs[a][b]?of.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){kg[b]=a[b]})}function kc(a){return 1===nf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=ng[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),of.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=ji?a?a instanceof Date?a:je(a):je(ic(b,c)):li&&!ki?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?of.data.xs[c]=a.map(function(a){return a[f]}).filter(b):jg?(d=Object.keys(of.data.xs),of.data.xs[c]=d.length>0?of.data.xs[d[0]]:void 0):oe(kg)&&(of.data.xs[c]=hc(f,of.data.targets)):of.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!of.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=mg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return li&&ki&&0===c&&g&&(0===e&&(Tg=[]),Tg.push(g)),("undefined"==typeof a[b]||of.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),rg&&Sd(xc(c).filter(function(a){return!(a in sg)}),rg),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function tc(a){return a>0&&of.data.targets[0].values[a-1]?of.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?of.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?of.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(of.data.targets)}function zc(a,b){var c,d=xc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(ji?new Date(h):h);i.push(d)}return ji||(i=i.sort(function(a,b){return a-b})),i}function Gc(a){ui=ui.concat(a)}function Hc(a){ui=ui.filter(function(b){return a.indexOf(b)<0})}function Ic(a){vi=vi.concat(a)}function Jc(a){vi=vi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=qe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return nf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Ed(){return ug&&"desc"===ug.toLowerCase()}function Fd(){return ug&&"asc"===ug.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof ug&&a.sort(ug),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(of.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});Yh&&0!==m.length&&(Si.html(_h(a,$(),l,ri)).style("display","block"),d=Si.property("offsetWidth"),e=Si.property("offsetHeight"),k?(g=Gf/2+c[0],i=If/2+c[1]+20):(Qg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=_f(m[0].x)+20):(f=q(),g=f+t()+_f(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Si.style("top",i+"px").style("left",g+"px"))}function Id(){Si.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});Yh&&(Vd(of.data.targets)||Yd(of.data.targets)||Pi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Qg?"y1":"x1",ud).attr(Qg?"y2":"x2",ud))}function Kd(){Pi.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?_f(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Ih?Ih:b?2*a.tickOffset()*Jh/b:0}function Sd(a,b){yc(a).forEach(function(a){Wi[a]=b===sg[a],sg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){sg[a.id]===b&&(c=!0),a.id in sg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in sg)||"line"===sg[b]||"spline"===sg[b]||"area"===sg[b]||"area-spline"===sg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===sg[b]||"area-spline"===sg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===sg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===sg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===sg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===sg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(a){return ce(a)&&Sh||be(a)&&Mh}function ie(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function je(b){var c;try{c=lg?nf.time.format(lg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+lg)}return c}function ke(a,b){var c=nf.mouse(a),d=nf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function pe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function qe(a,b){var c="y"===Z(a.id)?ag:bg,d=Qg?1:0,e=Qg?0:1;return Math.pow(_f(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function re(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function se(a,b,c){Fg(b,a.node()),Pi.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Qg?Md:Ld).attr("cy",Qg?Ld:Md).attr("stroke",function(){return ri(b)}).attr("r",1.4*Gh).transition().duration(100).attr("r",Gh)}function te(a,b,c){Gg(b,a.node()),Pi.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ue(a,b,c,d){a?se(b,c,d):te(b,c,d)}function ve(a,b){Fg(b,a.node()),a.transition().duration(100).style("fill",function(){return nf.rgb(ri(b)).darker(1)})}function we(a,b){Gg(b,a.node()),a.transition().duration(100).style("fill",function(){return ri(b)})}function xe(a,b,c,d){a?ve(b,c,d):we(b,c,d)}function ye(a){return a.filter(function(a){return b(a.value)})}function ze(a,c){return(c?Pi.selectAll("."+f.circles+gd(c)):Pi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ae(a,b){ze(a,b).classed(f.EXPANDED,!0).attr("r",Fh)}function Be(a){ze(a).filter(function(){return nf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Ch)}function Ce(a){return Pi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function De(a){Ce(a).classed(f.EXPANDED,!0)}function Ee(a){Ce(a).classed(f.EXPANDED,!1)}function Fe(a,b){var c=Je(a,b);return function(a,b){var d=c(a,b),e=Qg?1:0,f=Qg?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 Ge(a,b){var c=Je(a,!1),d=b?He:Ie;return function(a,b){return d(c(a,b),a,this)}}function He(a,b){var c;return Qg?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ie(a,b,c){var d=c.getBoundingClientRect();return Qg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Je(a,b){var c=a.__max__+1,d=Rd(fg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Qg&&(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 Ke(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 Le(b){var c,d,e;if(Ti=nf.select(qf),Ti.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Ti.html(""),Ti.classed("c3",!0),of.data.xs={},of.data.targets=rc(b),n(),R(),_f.domain(nf.extent(Zb(of.data.targets))),ag.domain(Ub(of.data.targets,"y")),bg.domain(Ub(of.data.targets,"y2")),cg.domain(_f.domain()),dg.domain(ag.domain()),eg.domain(bg.domain()),Ui=_f.domain(),Ii.scale(cg),vf&&Mi.scale(_f),Ni=Ti.append("svg").attr("width",Gf+Df.left+Df.right).attr("height",If+Df.top+Df.bottom).on("mouseenter",yf).on("mouseleave",zf),Oi=Ni.append("defs"),Oi.append("clipPath").attr("id",di).append("rect").attr("width",Gf).attr("height",If),Oi.append("clipPath").attr("id",ei).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Oi.append("clipPath").attr("id",fi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Pi=Ni.append("g").attr("transform",Ai.main),Qi=Jg?Ni.append("g").attr("transform",Ai.context):null,Ri=Ni.append("g").attr("transform",Ai.legend),Mg||(Ri.style("visibility","hidden"),vi=xc(of.data.targets)),Si=nf.select(qf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),hf(xc(of.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Pi.append("g").attr("class",f.axisX).attr("clip-path",Qg?"":hi).attr("transform",Ai.x).append("text").attr("class",f.axisXLabel).attr("transform",Qg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),dh&&Pi.append("g").attr("class",f.axisY).attr("clip-path",Qg?ii:"").attr("transform",Ai.y).append("text").attr("class",f.axisYLabel).attr("transform",Qg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),mh&&Pi.append("g").attr("class",f.axisY2).attr("transform",Ai.y2).append("text").attr("class",f.axisY2Label).attr("transform",Qg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Pi.append("g").attr("clip-path",gi).attr("class",f.grid),vh&&d.append("g").attr("class",f.xgrids),oe(xh)&&d.append("g").attr("class",f.xgridLines),Dh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),yh&&d.append("g").attr("class",f.ygrids),oe(zh)&&d.append("g").attr("class",f.ygridLines),Pi.append("g").attr("clip-path",gi).attr("class",f.regions),Pi.append("g").attr("clip-path",gi).attr("class",f.chart),c=Pi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",vf?Qg?"ns-resize":"ew-resize":null),Pi.select("."+f.chart).append("g").attr("class",f.chartBars),Pi.select("."+f.chart).append("g").attr("class",f.chartLines),Pi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Ai.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Pi.select("."+f.chart).append("g").attr("class",f.chartTexts),vf&&Pi.insert("rect",xf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Gf).attr("height",If).style("opacity",0).style("cursor",Qg?"ns-resize":"ew-resize").call(Mi).on("dblclick.zoom",null),bh&&Ii.extent("function"!=typeof bh?bh:bh(Zb())),Jg&&(Qi.append("g").attr("clip-path",gi).attr("class",f.chart),Qi.select("."+f.chart).append("g").attr("class",f.chartBars),Qi.select("."+f.chart).append("g").attr("class",f.chartLines),Qi.append("g").attr("clip-path",gi).attr("class",f.brush).call(Ii).selectAll("rect").attr(Qg?"width":"height",Qg?Hf:Jf),Qi.append("g").attr("class",f.axisX).attr("transform",Ai.subx).attr("clip-path",Qg?"":hi)),Ye(of.data.targets),Qg?Pi.select("."+f.axisX).style("opacity",0).call(fg):(Pi.select("."+f.axisY).style("opacity",0).call(gg),Pi.select("."+f.axisY2).style("opacity",0).call(hg)),Se({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),ai){if(ji&&"string"==typeof bi){for(bi=je(bi),e=0;e0){d=[];for(var g in ng)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=xe,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 Qe(a){Yd(of.data.targets)||yg&&(mi=a,Pi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),ni=!0,Hg())}function Re(){Yd(of.data.targets)||yg&&(Pi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Pi.selectAll("."+f.shape).classed(f.INCLUDED,!1),ni=!1,Ig())}function Se(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Nd(),U=Yd(of.data.targets),V=Dc(of.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?Cf:0,O=B?N:0,P=C?N:0,H&&Mg&&hf(xc(of.data.targets),a),G&&(_f.domain(nf.extent(Zb(V))),Ui=_f.domain(),vf&&Mi.scale(_f).updateScaleExtent(),cg.domain(_f.domain()),Ii.scale(cg)),F&&(_f.domain(Ii.empty()?Ui:Ii.extent()),vf&&Mi.scale(_f).updateScaleExtent()),ag.domain(Ub(V,"y")),bg.domain(Ub(V,"y2")),Vd(V)||(Q=$g?$g:Fc(Ec(V)),fg.tickValues(Q),ig.tickValues(Q)),c=Pi.select("."+f.axisX).style("opacity",U?0:1),(Qg||D)&&(c=c.transition().duration(P)),c.call(fg),e=Pi.select("."+f.axisY).style("opacity",U?0:1),(!Qg||D)&&(e=e.transition().duration(P)),e.call(gg),Pi.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(hg),F)if(Wg&&Q){for(R=1;R=0&&nf.select(this).style("display",b%S?"none":"block")})}else nf.selectAll("."+f.axisX+" .tick text").style("display","block");if(I=Fe(T),K=Ge(T,!0),M=Ge(T,!1),Ab(),dg.domain(ag.domain()),eg.domain(bg.domain()),Si.style("display","none"),o(),Pi.select("line."+f.xgridFocus).style("visibility","hidden"),vh){if("year"===wh){h=[];for(var W=Zb(),X=W[0].getFullYear(),Y=W[1].getFullYear(),Z=X;Y>=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=_f.ticks(10);g=Pi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Qg?0:function(a){return _f(a)-fg.tickOffset()}).attr("x2",Qg?Gf:function(a){return _f(a)-fg.tickOffset()}).attr("y1",Qg?function(a){return _f(a)-fg.tickOffset()}:Df.top).attr("y2",Qg?function(a){return _f(a)-fg.tickOffset()}:If).style("opacity",function(){return+nf.select(this).attr(Qg?"y1":"x1")===(Qg?If:0)?0:1}),g.exit().remove()}oe(xh)&&(i=Pi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(xh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Qg?"":"rotate(-90)").attr("dx",Qg?0:-Df.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Qg?0:vd).attr("x2",Qg?Gf:vd).attr("y1",Qg?vd:Df.top).attr("y2",Qg?vd:If).style("opacity",1),i.select("text").transition().duration(N).attr("x",Qg?Gf:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&yh&&(k=Pi.select("."+f.ygrids).selectAll("."+f.ygrid).data(ag.ticks(Ah)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Qg?ag:0).attr("x2",Qg?ag:Gf).attr("y1",Qg?0:ag).attr("y2",Qg?If:ag),k.exit().remove()),y&&oe(zh)&&(l=Pi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(zh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Qg?"rotate(-90)":"").attr("dx",Qg?0:-Df.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Qg?wd:0).attr("x2",Qg?wd:Gf).attr("y1",Qg?0:wd).attr("y2",Qg?If:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Qg?0:Gf).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Pi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ri(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Pi.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Qg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Pi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ji).style("opacity",1),Pi.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Ki).style("opacity",Vi),n=Pi.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",Ch),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Qg?Md:Ld).attr("cy",Qg?Ld:Md),n.exit().remove(),Pi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=nf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Pi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Pi.select("."+f.chartArcsTitle).style("opacity",Xd(of.data.targets)?1:0),Jg&&(null!==nf.event&&"zoom"===nf.event.type&&Ii.extent(_f.orgDomain()).update(),z&&(Qi.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(ig),Ii.empty()||Ii.extent(_f.orgDomain()).update(),J=Fe(T,!0),s=Qi.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ri(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Qi.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Li).style("opacity",1))),Pi.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Pi.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Qg?Md:Ld).attr("cy",Qg?Ld:Md),t=Pi.select("."+f.eventRects),oe(kg)&&!kc(kg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Pi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ne(u.enter()),u.attr("x",0).attr("y",0).attr("width",Gf).attr("height",If)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),li&&!ki?(x=function(a,b){var c=tc(b),d=uc(b),e=of.data.xs[a.id][b];return(_f(d?d:e+50)-_f(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=of.data.xs[a.id][b];return(_f(d)+_f(c?c:d-50))/2}):(x=L(),w=function(a){return _f(a.x)-x/2}),v=wc(),Pi.select("."+f.eventRects).datum(v?v.values:[]),u=Pi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Me(u.enter()),u.attr("class",ad).attr("x",Qg?0:w).attr("y",Qg?w:0).attr("width",Qg?Gf:x).attr("height",Qg?x:If),u.exit().remove()),q=Pi.select("."+f.regions).selectAll("rect."+f.region).data(Xh),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Qg?0:cc).attr("y",Qg?cc:Df.top).attr("width",Qg?Gf:dc).attr("height",Qg?dc:If).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),xc(of.data.targets).forEach(function(a){Wi[a]=!0})}}function Te(){Se({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ue(){return"mousemove"===nf.event.sourceEvent.type&&Mi.altDomain?(_f.domain(Mi.altDomain),void Mi.scale(_f).updateScaleExtent()):(ki&&_f.orgDomain()[0]===Ui[0]&&_f.domain([Ui[0]-1e-10,_f.orgDomain()[1]]),Se({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===nf.event.sourceEvent.type&&(oi=!0)))}function Ve(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function We(){Ni.attr("width",Kf).attr("height",Lf),Ni.select("#"+di).select("rect").attr("width",Gf).attr("height",If),Ni.select("#"+ei).select("rect").attr("width",H),Ni.select("#"+fi).select("rect").attr("width",J),Ni.select("."+f.zoomRect).attr("width",Gf).attr("height",If)}function Xe(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),We(),m(a.withTransition),Se(a)}function Ye(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Pi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ri(a)}),e=Pi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ri(a)}).style("stroke","none").style("cursor",function(a){return Ag(a)?"pointer":null}),c=Pi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ri(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Vi=+nf.select(this).style("opacity"),0}).style("fill",function(a){return ri(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ri(a)}).style("cursor",function(a){return Ag(a)?"pointer":null}),a.forEach(function(a){Pi.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Pi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Sf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ri(a.data)}).style("cursor",function(a){return Ag(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),cf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,nf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),ef(),Id(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Jg&&(n=Qi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ri(a)}),l=Qi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ri(a)})),Ni.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ze(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),of.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Bi?j:i,l=Bi?Q():P();return d&&(w=0,C=0,t=0,u=0),Mg&&!Cc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Bi?u:t,void(Pg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,Bi?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Ri.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Og?Og(a):of.toggle(a)}).on("mouseover",function(a){of.focus(a)}).on("mouseout",function(){of.revert()}),l.append("text").text(function(a){return d(ng[a])?ng[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",Bi?g:-200).attr("y",Bi?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Bi?h:-200).attr("y",Bi?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return ri(a)}).attr("x",Bi?g:-200).attr("y",Bi?-200:i).attr("width",10).attr("height",10),Ri.selectAll("text").data(a).text(function(a){return d(ng[a])?ng[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ri.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ri.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),We(),q&&m(p)}function jf(a){return zc(of.data.targets,a.id)}function kf(a){return"data"in a&&zc(of.data.targets,a.data.id)}function lf(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 mf(a,b,c){var d=!Yd(of.data.targets);Sd(a,b),Xe(c?c:{withTransitionForAxis:d})}var nf=a.d3?a.d3:a.require?a.require("d3"):void 0,of={data:{},axis:{},legend:{}},pf={},qf=h(["bindto"],"#chart"),rf=h(["size","width"]),sf=h(["size","height"]),tf=h(["padding","left"]),uf=h(["padding","right"]),vf=h(["zoom","enabled"],!1),wf=h(["zoom","extent"]),xf=h(["zoom","privileged"],!1),yf=h(["onenter"],function(){}),zf=h(["onleave"],function(){}),Af=h(["onresize"],function(){}),Bf=h(["onresized"],function(){}),Cf=h(["transition","duration"],350);g("data","data is required in config");var Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg=h(["data","x"]),kg=h(["data","xs"],{}),lg=h(["data","x_format"]),mg=h(["data","id_converter"],function(a){return a}),ng=h(["data","names"],{}),og=h(["data","classes"],{}),pg=h(["data","groups"],[]),qg=h(["data","axes"],{}),rg=h(["data","type"]),sg=h(["data","types"],{}),tg=h(["data","labels"],{}),ug=h(["data","order"]),vg=h(["data","regions"],{}),wg=h(["data","color"]),xg=h(["data","colors"],{}),yg=h(["data","selection","enabled"],!1),zg=h(["data","selection","grouped"],!1),Ag=h(["data","selection","isselectable"],function(){return!0}),Bg=h(["data","selection","multiple"],!0),Cg=h(["data","onclick"],function(){}),Dg=h(["data","onenter"],function(){}),Eg=h(["data","onleave"],function(){}),Fg=h(["data","onselected"],function(){}),Gg=h(["data","onunselected"],function(){}),Hg=h(["data","ondragstart"],function(){}),Ig=h(["data","ondragend"],function(){}),Jg=h(["subchart","show"],!1),Kg=Jg?h(["subchart","size","height"],60):0,Lg=h(["color","pattern"],[]),Mg=h(["legend","show"],!0),Ng=h(["legend","position"],"bottom"),Og=h(["legend","item","onclick"]),Pg=h(["legend","equally"],!1),Qg=h(["axis","rotated"],!1),Rg=h(["axis","x","type"],"indexed"),Sg=h(["axis","x","localtime"],!1),Tg=h(["axis","x","categories"],[]),Ug=h(["axis","x","tick","centered"],!1),Vg=h(["axis","x","tick","format"]),Wg=h(["axis","x","tick","culling"],{}),Xg=h(["axis","x","tick","culling","max"],10),Yg=h(["axis","x","tick","count"]),Zg=h(["axis","x","tick","fit"],!1),$g=h(["axis","x","tick","values"],null),_g=h(["axis","x","max"]),ah=h(["axis","x","min"]),bh=h(["axis","x","default"]),ch=h(["axis","x","label"],{}),dh=h(["axis","y","show"],!0),eh=h(["axis","y","max"]),fh=h(["axis","y","min"]),gh=h(["axis","y","center"]),hh=h(["axis","y","label"],{}),ih=h(["axis","y","inner"],!1),jh=h(["axis","y","tick","format"]),kh=h(["axis","y","padding"],{}),lh=h(["axis","y","ticks"],10),mh=h(["axis","y2","show"],!1),nh=h(["axis","y2","max"]),oh=h(["axis","y2","min"]),ph=h(["axis","y2","center"]),qh=h(["axis","y2","label"],{}),rh=h(["axis","y2","inner"],!1),sh=h(["axis","y2","tick","format"]),th=h(["axis","y2","padding"],{}),uh=h(["axis","y2","ticks"],10),vh=h(["grid","x","show"],!1),wh=h(["grid","x","type"],"tick"),xh=h(["grid","x","lines"],[]),yh=h(["grid","y","show"],!1),zh=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(["line","connect_null"],!1),Ih=h(["bar","width"]),Jh=h(["bar","width","ratio"],.6),Kh=h(["pie","label","show"],!0),Lh=h(["pie","label","format"]),Mh=h(["pie","expand"],!0),Nh=h(["pie","onclick"],function(){}),Oh=h(["pie","onmouseover"],function(){}),Ph=h(["pie","onmouseout"],function(){}),Qh=h(["donut","label","show"],!0),Rh=h(["donut","label","format"]),Sh=h(["donut","expand"],!0),Th=h(["donut","title"],""),Uh=h(["donut","onclick"],function(){}),Vh=h(["donut","onmouseover"],function(){}),Wh=h(["donut","onmouseout"],function(){}),Xh=h(["regions"],[]),Yh=h(["tooltip","show"],!0),Zh=h(["tooltip","format","title"]),$h=h(["tooltip","format","value"]),_h=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Zh?Zh:b,l=$h?$h: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+""}),ai=h(["tooltip","init","show"],!1),bi=h(["tooltip","init","x"],0),ci=h(["tooltip","init","position"],{top:"0px",left:"50px"}),di=("string"==typeof qf?qf.replace("#",""):qf.id)+"-clip",ei=di+"-xaxis",fi=di+"-yaxis",gi=i(di),hi=i(ei),ii=i(fi),ji="timeseries"===Rg,ki="categorized"===Rg,li=!ji&&(jg||oe(kg)),mi=null,ni=!1,oi=!1,pi=!1,qi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ri=ie(xg,oe(Lg)?Lg:qi,wg),si=Sg?nf.time.format:nf.time.format.utc,ti=function(){var a=[[si("%Y/%-m/%-d"),function(){return!0}],[si("%-m/%-d"),function(a){return a.getMonth()}],[si("%-m/%-d"),function(a){return 1!==a.getDate()}],[si("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[si("%I %p"),function(a){return a.getHours()}],[si("%I:%M"),function(a){return a.getMinutes()}],[si(":%S"),function(a){return a.getSeconds()}],[si(".%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)}}(),ui=[],vi=[],wi=Qg?"left":"bottom",xi=Qg?ih?"top":"bottom":ih?"right":"left",yi=Qg?rh?"bottom":"top":rh?"left":"right",zi=Qg?"left":"bottom",Ai={main:function(){return"translate("+Df.left+","+Df.top+")"},context:function(){return"translate("+Ef.left+","+Ef.top+")"},legend:function(){return"translate("+Ff.left+","+Ff.top+")"},x:function(){return"translate(0,"+(Qg?0:If)+")"},y:function(){return"translate(0,"+(Qg?If:0)+")"},y2:function(){return"translate("+(Qg?0:Gf)+","+(Qg?1:0)+")"},subx:function(){return"translate(0,"+(Qg?0:Jf)+")"},arc:function(){return"translate("+Gf/2+","+If/2+")"}},Bi="right"===Ng,Ci=0,Di=0,Ei=0,Fi=30,Gi=30,Hi=5;Sf=nf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Ii,Ji=function(){var a=nf.svg.line().x(Qg?function(a){return V(a.id)(a.value)}:ud).y(Qg?ud:function(a){return V(a.id)(a.value)});return Hh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Hh?ye(b.values):b.values;return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),vg[b.id]?Ke(e,_f,V(b.id),vg[b.id]):a(e)):(c=e[0]?_f(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Qg?"M "+d+" "+c:"M "+c+" "+d)}}(),Ki=function(){var a;return a=Qg?nf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):nf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=ye(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?_f(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Qg?"M "+d+" "+c:"M "+c+" "+d)}}(),Li=function(){var a=nf.svg.line().x(Qg?function(a){return W(a.id)(a.value)}:xd).y(Qg?xd:function(a){return W(a.id)(a.value)});return function(b){var c=ye(b.values);return Zd(b)?a(c):"M "+cg(c[0].x)+" "+W(b.id)(c[0].value)}}(),Mi=function(){};Ii=nf.svg.brush().on("brush",Te),Ii.update=function(){return Qi&&Qi.select("."+f.brush).call(this),this},Ii.scale=function(a){return Qg?this.y(a):this.x(a)},vf&&(Mi=nf.behavior.zoom().on("zoomstart",function(){Mi.altDomain=nf.event.sourceEvent.altKey?_f.orgDomain():null}).on("zoom",vf?Ue:null),Mi.scale=function(a){return Qg?this.y(a):this.x(a)},Mi.orgScaleExtent=function(){var a=wf?wf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Mi.updateScaleExtent=function(){var a=$b(_f.orgDomain())/$b(Ui),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Ni,Oi,Pi,Qi,Ri,Si,Ti,Ui,Vi,Wi={};if(of.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ni.selectAll(hd(a)),d=c.filter(jf),e=c.filter(kf);of.revert(),of.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(of.data.targets)&&Kb(a,!0),cf(a)},of.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Ni.selectAll(hd(a)),d=c.filter(jf),e=c.filter(kf);of.revert(),b(d.classed(f.focused,!1)),b(e),Yd(of.data.targets)&&Lb(a),df(a)},of.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Ni.selectAll(hd(a)),d=c.filter(jf),e=c.filter(kf);b(d.classed(f.focused,!1)),b(e),Yd(of.data.targets)&&Lb(a),ef()},of.show=function(a,b){a=yc(a),b=b||{},Hc(a),Ni.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ff(a):Ri.selectAll(kd(a)).classed(f.legendItemHidden,!1),Se({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},of.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Ni.selectAll(id(a)).transition().style("opacity",0),b.withLegend?gf(a):Ri.selectAll(kd(a)).classed(f.legendItemHidden,!0),Se({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},of.toggle=function(a){Bc(a)?of.hide(a):of.show(a)},of.unzoom=function(){Ii.clear().update(),Se({withUpdateXDomain:!0})},of.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){og[b]=a.classes[b]}),"categories"in a&&ki&&(Tg=a.categories,fg.categories(Tg)),"cacheIds"in a&&_b(a.cacheIds)?void Ze(bc(a.cacheIds),a.done):void("unload"in a?_e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){$e(a)}):$e(a))},of.unload=function(a){_e(yc(a),function(){Se({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},of.selected=function(a){return nf.merge(Pi.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return nf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},of.select=function(a,b,c){yg&&Pi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=nf.select(this),i="circle"===this.nodeName?se:ve,j="circle"===this.nodeName?te:we,k=zg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Ag(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},of.unselect=function(a,b){yg&&Pi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=nf.select(this),g="circle"===this.nodeName?te:we,h=zg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Ag(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},of.toLine=function(a){mf(a,"line")},of.toSpline=function(a){mf(a,"spline")},of.toBar=function(a){mf(a,"bar")},of.toScatter=function(a){mf(a,"scatter")},of.toArea=function(a){mf(a,"area")},of.toAreaSpline=function(a){mf(a,"area-spline")},of.toPie=function(a){mf(a,"pie",{withTransform:!0})},of.toDonut=function(a){mf(a,"donut",{withTransform:!0})},of.groups=function(a){return c(a)?pg:(pg=a,Se(),pg)},of.xgrids=function(a){return a?(xh=a,Se(),xh):xh},of.xgrids.add=function(a){return a?of.xgrids(xh.concat(a)):void 0},of.xgrids.remove=function(a){var b=lf(a);return of.xgrids(xh.filter(b))},of.ygrids=function(a){return a?(zh=a,Se(),zh):zh},of.ygrids.add=function(a){return a?of.ygrids(zh.concat(a)):void 0},of.ygrids.remove=function(a){var b=lf(a);return of.ygrids(zh.filter(b))},of.regions=function(a){return c(a)?Xh:(Xh=a,Se(),Xh)},of.regions.add=function(a){return c(a)?Xh:(Xh=Xh.concat(a),Se(),Xh)},of.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;Ni.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Xh=Xh.filter(function(b){return b.classes.indexOf(a)<0 -})}),Xh},of.data.get=function(a){var b=of.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},of.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},of.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){ng[b]=a[b]}),hf(xc(of.data.targets),{withTransition:!0}),ng):ng},of.x=function(a){return arguments.length&&(mc(of.data.targets,a),Se({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),of.data.xs},of.xs=function(a){return arguments.length&&(nc(of.data.targets,a),Se({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),of.data.xs},of.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},of.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(eh=+a.y),b(a.y2)&&(nh=+a.y2)):eh=nh=+a,Se())},of.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(fh=+a.y),b(a.y2)&&(oh=+a.y2)):fh=oh=+a,Se())},of.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&of.axis.max(a.max),"undefined"!=typeof a.min&&of.axis.min(a.min))},of.legend.show=function(a){Mg||(Mg=!0,Ri.style("visibility","visible")),ff(yc(a)),Se({withTransitionForHorizontalAxis:!1})},of.legend.hide=function(a){Mg&&ne(a)&&(Mg=!1,Ri.style("visibility","hidden")),gf(yc(a)),Se({withTransitionForHorizontalAxis:!1})},of.resize=function(a){rf=a?a.width:null,sf=a?a.height:null,Xe({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},of.destroy=function(){of.data.targets=void 0,of.data.xs={},Ti.html(""),a.onresize=null},"url"in e.data)nf.xhr(e.data.url,function(a,b){var c,d=nf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=nf.csv.parse(b.response),Le(c)});else if("rows"in e.data)Le(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Le(qc(e.data.columns))}return of},"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.31"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cGf&&(Gf=0),0>If&&(If=0),Ef={top:Sg?Df.top:Lf-Kg-(Di?0:a),right:0/0,bottom:20+(Di?0:a),left:Sg?Hi:Df.left},Hf=Sg?Df.left-Hi-Ii:Gf,Jf=Sg?If:Lf-Ef.top-Ef.bottom,0>Hf&&(Hf=0),0>Jf&&(Jf=0),Ff={top:Di?0:Lf-a,right:0/0,bottom:0,left:Di?Kf-b:0},p(),Di&&Yd(of.data.targets)&&(Ff.left=Gf/2+Nf)}function o(){Ri.select("line."+f.xgridFocus).attr("x1",Sg?0:-10).attr("x2",Sg?Gf:-10).attr("y1",Sg?-10:Df.top).attr("y2",Sg?-10:If)}function p(){Nf=If/2,Mf=.95*Nf,Of=Xd(of.data.targets)?.6*Mf:0}function q(){var a=Sg?f.axisX:f.axisY,b=nf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=nf.select(qf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return rf?rf:x()}function s(){var a=sf?sf:y();return a>0?a:320}function t(){return Yd(of.data.targets)?0:tf?tf:Sg||!fh||kh?1:v("y")}function u(){var a=1;return Yd(of.data.targets)?0:uf?uf:Di?P()+(oh&&!Sg?v("y2"):a):oh?th||Sg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||fh?"y2"!==a||oh?(gb(a).isInner?30:40)+("y2"===a?-10:0):Ji:Mg&&!Di?10:1}function x(){return+nf.select(qf).style("width").replace("px","")}function y(){return+nf.select(qf).style("height").replace("px","")}function z(a){return a?-5:-(Df.left-1)}function A(a){return a?-20:-1}function B(){return z(!Sg)}function C(){return A(!Sg)}function D(){return z(Sg)}function E(){return A(Sg)}function F(a){return a?Gf+2+4:Df.left+20}function G(a){return a?80:If+2}function H(){return F(!Sg)}function I(){return G(!Sg)}function J(){return F(Sg)}function K(){return G(Sg)}function L(){var a=Sg?If:Gf,b=vc(),c=Vb()*(Ud(of.data.targets)?(b-(mi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){Ei=a}function N(a){Fi=a}function O(a){Gi=a}function P(){return Mg?Di?Fi*(Ei+1):Kf:0}function Q(){return Mg?Di?Lf:Gi*(Ei+1):0}function R(){var a,b=!_f;Tf=Sg?1:0,Uf=Sg?If:Gf,Vf=Sg?0:If,Wf=Sg?Gf:1,Xf=Tf,Yf=Uf,Zf=Sg?0:Jf,$f=Sg?Hf:1,_f=T(Tf,Uf,b?void 0:_f.domain(),function(){return fg.tickOffset()}),ag=U(Vf,Wf),bg=U(Vf,Wf),cg=T(Tf,Uf,Wi,function(a){return a%1?0:ig.tickOffset()}),dg=U(Zf,$f),eg=U(Zf,$f),a=$(),fg=X(_f,yi,a),ig=X(cg,Bi,a),gg=Y(ag,zi,lh,nh),hg=Y(bg,Ai,uh,wh),b||(Ki.scale(cg),vf&&Oi.scale(_f)),S()}function S(){Pf=Db(),Qf=Eb(),Rf=Eb(.98)}function T(a,b,e,f){var g=(li?nf.time.scale():nf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),mi){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return nf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?bg:ag}function W(a){return"y2"===Z(a)?eg:dg}function X(a,b,c){var d=(mi?Bb():nf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),mi?(d.tickCentered(Wg),ne(Yg)&&(Yg=!1)):d.tickOffset=function(){var a=Sg?If:Gf;return a*Vb()/vc()/2},mi&&d.categories(Vg),d}function Y(a,b,c,d){return nf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in qg?qg[a]:"y"}function $(){var a=li?vi:mi?Oc:function(a){return 0>a?a.toFixed(0):a};return Xg&&("function"==typeof Xg?a=Xg:li&&(a=function(a){return ui(Xg)(a)})),a}function _(a){var b;return"y"===a?b=jh:"y2"===a?b=sh:"x"===a&&(b=eh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?jh=b:"y2"===a?sh=b:"x"===a&&(eh=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Sg?"inner-top":"inner-right")}function eb(){return cb("y",Sg?"inner-right":"inner-top")}function fb(){return cb("y2",Sg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?Gf/2:Gf:b.isBottom?-If:b.isMiddle?-If/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Sg,db())}function ob(){return kb(Sg,eb())}function pb(){return kb(Sg,fb())}function qb(){return lb(!Sg,db())}function rb(){return lb(Sg,eb())}function sb(){return lb(Sg,fb())}function tb(){var a=db();return Sg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Sg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Sg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Sg,db())}function xb(){return mb(Sg,eb())}function yb(){return mb(Sg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return nf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Ri.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Ri.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Ri.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+o)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Mc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return nf.min(Object.keys(i).map(function(a){return nf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(pg.length>0)for(g=Nc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return nf.max(Object.keys(i).map(function(a){return nf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?qh:hh,n="y2"===c?ph:gh,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?rh:ih,r=pd()&&Sg;return 0===l.length?"y2"===c?bg.domain():ag.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=qd(o,p),j=$b(ag.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&mh&&(f=b(mh.top)?mh.top:e,g=b(mh.bottom)?mh.bottom:e),"y2"===c&&vh&&(f=b(vh.top)?vh.top:e,g=b(vh.bottom)?vh.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Wi),c=$b(_f.domain());return a||0===c?1:b/c}function Wb(a){return ch?ch:nf.min(a,function(a){return nf.min(a.values,function(a){return a.x})})}function Xb(a){return bh?bh:nf.max(a,function(a){return nf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return mi?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=0,g=0;return(c||0===c)&&(f=li?new Date(c.getTime()-e):c-e),(d||0===d)&&(g=li?new Date(d.getTime()+e):d+e),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return jg&&a===jg||oe(kg)&&pe(kg,a)}function fc(a){return!ec(a)}function gc(a){return jg?jg:oe(kg)?kg[a]:null}function hc(a,b){var c,d=b&&oe(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=of.data.xs[b])}),c}function ic(a,b){return a in of.data.xs&&of.data.xs[a]&&of.data.xs[a][b]?of.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){kg[b]=a[b]})}function kc(a){return 1===nf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=ng[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),of.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=li?a?a instanceof Date?a:je(a):je(ic(b,c)):ni&&!mi?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?of.data.xs[c]=a.map(function(a){return a[f]}).filter(b):jg?(d=Object.keys(of.data.xs),of.data.xs[c]=d.length>0?of.data.xs[d[0]]:void 0):oe(kg)&&(of.data.xs[c]=hc(f,of.data.targets)):of.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!of.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=mg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return ni&&mi&&0===c&&g&&(0===e&&(Vg=[]),Vg.push(g)),("undefined"==typeof a[b]||of.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),rg&&Sd(xc(c).filter(function(a){return!(a in sg)}),rg),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function tc(a){return a>0&&of.data.targets[0].values[a-1]?of.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?of.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?of.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(of.data.targets)}function zc(a,b){var c,d=xc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(li?new Date(h):h);i.push(d)}return li||(i=i.sort(function(a,b){return a-b})),i}function Gc(a){wi=wi.concat(a)}function Hc(a){wi=wi.filter(function(b){return a.indexOf(b)<0})}function Ic(a){xi=xi.concat(a)}function Jc(a){xi=xi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=qe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return nf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Ed(){return ug&&"desc"===ug.toLowerCase()}function Fd(){return ug&&"asc"===ug.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof ug&&a.sort(ug),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(of.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});$h&&0!==m.length&&(Ui.html(bi(a,$(),l,ti)).style("display","block"),d=Ui.property("offsetWidth"),e=Ui.property("offsetHeight"),k?(g=Gf/2+c[0],i=If/2+c[1]+20):(Sg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=_f(m[0].x)+20):(f=q(),g=f+t()+_f(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Ui.style("top",i+"px").style("left",g+"px"))}function Id(){Ui.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});$h&&(Vd(of.data.targets)||Yd(of.data.targets)||Ri.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Sg?"y1":"x1",ud).attr(Sg?"y2":"x2",ud))}function Kd(){Ri.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?_f(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Kh?Kh:b?2*a.tickOffset()*Lh/b:0}function Sd(a,b){yc(a).forEach(function(a){Yi[a]=b===sg[a],sg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){sg[a.id]===b&&(c=!0),a.id in sg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in sg)||"line"===sg[b]||"spline"===sg[b]||"area"===sg[b]||"area-spline"===sg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===sg[b]||"area-spline"===sg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===sg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===sg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===sg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===sg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(a){return ce(a)&&Uh||be(a)&&Oh}function ie(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function je(b){var c;try{c=lg?nf.time.format(lg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+lg)}return c}function ke(a,b){var c=nf.mouse(a),d=nf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function pe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function qe(a,b){var c="y"===Z(a.id)?ag:bg,d=Sg?1:0,e=Sg?0:1;return Math.pow(_f(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function re(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function se(a,b,c){Fg(b,a.node()),Ri.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Sg?Md:Ld).attr("cy",Sg?Ld:Md).attr("stroke",function(){return ti(b)}).attr("r",1.4*Ih).transition().duration(100).attr("r",Ih)}function te(a,b,c){Gg(b,a.node()),Ri.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ue(a,b,c,d){a?se(b,c,d):te(b,c,d)}function ve(a,b){Fg(b,a.node()),a.transition().duration(100).style("fill",function(){return nf.rgb(ti(b)).darker(1)})}function we(a,b){Gg(b,a.node()),a.transition().duration(100).style("fill",function(){return ti(b)})}function xe(a,b,c,d){a?ve(b,c,d):we(b,c,d)}function ye(a){return a.filter(function(a){return b(a.value)})}function ze(a,c){return(c?Ri.selectAll("."+f.circles+gd(c)):Ri).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ae(a,b){ze(a,b).classed(f.EXPANDED,!0).attr("r",Hh)}function Be(a){ze(a).filter(function(){return nf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Eh)}function Ce(a){return Ri.selectAll("."+f.bar+(b(a)?"-"+a:""))}function De(a){Ce(a).classed(f.EXPANDED,!0)}function Ee(a){Ce(a).classed(f.EXPANDED,!1)}function Fe(a,b){var c=Je(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 Ge(a,b){var c=Je(a,!1),d=b?He:Ie;return function(a,b){return d(c(a,b),a,this)}}function He(a,b){var c;return Sg?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ie(a,b,c){var d=c.getBoundingClientRect();return Sg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Je(a,b){var c=a.__max__+1,d=Rd(fg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return 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 Ke(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 Le(b){var c,d,e;if(Vi=nf.select(qf),Vi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Vi.html(""),Vi.classed("c3",!0),of.data.xs={},of.data.targets=rc(b),n(),R(),_f.domain(nf.extent(Zb(of.data.targets))),ag.domain(Ub(of.data.targets,"y")),bg.domain(Ub(of.data.targets,"y2")),cg.domain(_f.domain()),dg.domain(ag.domain()),eg.domain(bg.domain()),Wi=_f.domain(),Ki.scale(cg),vf&&Oi.scale(_f),Pi=Vi.append("svg").attr("width",Gf+Df.left+Df.right).attr("height",If+Df.top+Df.bottom).on("mouseenter",yf).on("mouseleave",zf),Qi=Pi.append("defs"),Qi.append("clipPath").attr("id",fi).append("rect").attr("width",Gf).attr("height",If),Qi.append("clipPath").attr("id",gi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Qi.append("clipPath").attr("id",hi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Ri=Pi.append("g").attr("transform",Ci.main),Si=Jg?Pi.append("g").attr("transform",Ci.context):null,Ti=Pi.append("g").attr("transform",Ci.legend),Mg||(Ti.style("visibility","hidden"),xi=xc(of.data.targets)),Ui=nf.select(qf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),hf(xc(of.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Ri.append("g").attr("class",f.axisX).attr("clip-path",Sg?"":ji).attr("transform",Ci.x).append("text").attr("class",f.axisXLabel).attr("transform",Sg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),fh&&Ri.append("g").attr("class",f.axisY).attr("clip-path",Sg?ki:"").attr("transform",Ci.y).append("text").attr("class",f.axisYLabel).attr("transform",Sg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),oh&&Ri.append("g").attr("class",f.axisY2).attr("transform",Ci.y2).append("text").attr("class",f.axisY2Label).attr("transform",Sg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Ri.append("g").attr("clip-path",ii).attr("class",f.grid),xh&&d.append("g").attr("class",f.xgrids),oe(zh)&&d.append("g").attr("class",f.xgridLines),Fh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Ah&&d.append("g").attr("class",f.ygrids),oe(Bh)&&d.append("g").attr("class",f.ygridLines),Ri.append("g").attr("clip-path",ii).attr("class",f.regions),Ri.append("g").attr("clip-path",ii).attr("class",f.chart),c=Ri.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",vf?Sg?"ns-resize":"ew-resize":null),Ri.select("."+f.chart).append("g").attr("class",f.chartBars),Ri.select("."+f.chart).append("g").attr("class",f.chartLines),Ri.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Ci.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Ri.select("."+f.chart).append("g").attr("class",f.chartTexts),vf&&Ri.insert("rect",xf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Gf).attr("height",If).style("opacity",0).style("cursor",Sg?"ns-resize":"ew-resize").call(Oi).on("dblclick.zoom",null),dh&&Ki.extent("function"!=typeof dh?dh:dh(Zb())),Jg&&(Si.append("g").attr("clip-path",ii).attr("class",f.chart),Si.select("."+f.chart).append("g").attr("class",f.chartBars),Si.select("."+f.chart).append("g").attr("class",f.chartLines),Si.append("g").attr("clip-path",ii).attr("class",f.brush).call(Ki).selectAll("rect").attr(Sg?"width":"height",Sg?Hf:Jf),Si.append("g").attr("class",f.axisX).attr("transform",Ci.subx).attr("clip-path",Sg?"":ji)),Ye(of.data.targets),Sg?Ri.select("."+f.axisX).style("opacity",0).call(fg):(Ri.select("."+f.axisY).style("opacity",0).call(gg),Ri.select("."+f.axisY2).style("opacity",0).call(hg)),Se({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),ci){if(li&&"string"==typeof di){for(di=je(di),e=0;e0){d=[];for(var g in ng)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=xe,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 Qe(a){Yd(of.data.targets)||yg&&(oi=a,Ri.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),pi=!0,Hg())}function Re(){Yd(of.data.targets)||yg&&(Ri.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Ri.selectAll("."+f.shape).classed(f.INCLUDED,!1),pi=!1,Ig())}function Se(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Nd(),U=Yd(of.data.targets),V=Dc(of.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?Cf:0,O=B?N:0,P=C?N:0,H&&Mg&&hf(xc(of.data.targets),a),G&&(_f.domain(nf.extent(Zb(V))),Wi=_f.domain(),vf&&Oi.scale(_f).updateScaleExtent(),cg.domain(_f.domain()),Ki.scale(cg)),F&&(_f.domain(Ki.empty()?Wi:Ki.extent()),vf&&Oi.scale(_f).updateScaleExtent()),ag.domain(Ub(V,"y")),bg.domain(Ub(V,"y2")),Vd(V)||(Q=ah?ah:Fc(Ec(V)),fg.tickValues(Q),ig.tickValues(Q)),c=Ri.select("."+f.axisX).style("opacity",U?0:1),(Sg||D)&&(c=c.transition().duration(P)),c.call(fg),e=Ri.select("."+f.axisY).style("opacity",U?0:1),(!Sg||D)&&(e=e.transition().duration(P)),e.call(gg),Ri.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(hg),F)if(Yg&&Q){for(R=1;R=0&&nf.select(this).style("display",b%S?"none":"block")})}else nf.selectAll("."+f.axisX+" .tick text").style("display","block");if(I=Fe(T),K=Ge(T,!0),M=Ge(T,!1),Ab(),dg.domain(ag.domain()),eg.domain(bg.domain()),Ui.style("display","none"),o(),Ri.select("line."+f.xgridFocus).style("visibility","hidden"),xh){if("year"===yh){h=[];for(var W=Zb(),X=W[0].getFullYear(),Y=W[1].getFullYear(),Z=X;Y>=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=_f.ticks(10);g=Ri.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Sg?0:function(a){return _f(a)-fg.tickOffset()}).attr("x2",Sg?Gf:function(a){return _f(a)-fg.tickOffset()}).attr("y1",Sg?function(a){return _f(a)-fg.tickOffset()}:Df.top).attr("y2",Sg?function(a){return _f(a)-fg.tickOffset()}:If).style("opacity",function(){return+nf.select(this).attr(Sg?"y1":"x1")===(Sg?If:0)?0:1}),g.exit().remove()}oe(zh)&&(i=Ri.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(zh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Sg?"":"rotate(-90)").attr("dx",Sg?0:-Df.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Sg?0:vd).attr("x2",Sg?Gf:vd).attr("y1",Sg?vd:Df.top).attr("y2",Sg?vd:If).style("opacity",1),i.select("text").transition().duration(N).attr("x",Sg?Gf:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&Ah&&(k=Ri.select("."+f.ygrids).selectAll("."+f.ygrid).data(ag.ticks(Ch)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Sg?ag:0).attr("x2",Sg?ag:Gf).attr("y1",Sg?0:ag).attr("y2",Sg?If:ag),k.exit().remove()),y&&oe(Bh)&&(l=Ri.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Bh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Sg?"rotate(-90)":"").attr("dx",Sg?0:-Df.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Sg?wd:0).attr("x2",Sg?wd:Gf).attr("y1",Sg?0:wd).attr("y2",Sg?If:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Sg?0:Gf).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Ri.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ti(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Ri.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Sg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Ri.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Li).style("opacity",1),Ri.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Mi).style("opacity",Xi),n=Ri.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",Eh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Sg?Md:Ld).attr("cy",Sg?Ld:Md),n.exit().remove(),Ri.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=nf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Ri.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Ri.select("."+f.chartArcsTitle).style("opacity",Xd(of.data.targets)?1:0),Jg&&(null!==nf.event&&"zoom"===nf.event.type&&Ki.extent(_f.orgDomain()).update(),z&&(Si.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(ig),Ki.empty()||Ki.extent(_f.orgDomain()).update(),J=Fe(T,!0),s=Si.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ti(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Si.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ni).style("opacity",1))),Ri.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Ri.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Sg?Md:Ld).attr("cy",Sg?Ld:Md),t=Ri.select("."+f.eventRects),oe(kg)&&!kc(kg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Ri.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ne(u.enter()),u.attr("x",0).attr("y",0).attr("width",Gf).attr("height",If)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),ni&&!mi?(x=function(a,b){var c=tc(b),d=uc(b),e=of.data.xs[a.id][b];return(_f(d?d:e+50)-_f(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=of.data.xs[a.id][b];return(_f(d)+_f(c?c:d-50))/2}):(x=L(),w=function(a){return _f(a.x)-x/2}),v=wc(),Ri.select("."+f.eventRects).datum(v?v.values:[]),u=Ri.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Me(u.enter()),u.attr("class",ad).attr("x",Sg?0:w).attr("y",Sg?w:0).attr("width",Sg?Gf:x).attr("height",Sg?x:If),u.exit().remove()),q=Ri.select("."+f.regions).selectAll("rect."+f.region).data(Zh),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Sg?0:cc).attr("y",Sg?cc:Df.top).attr("width",Sg?Gf:dc).attr("height",Sg?dc:If).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),xc(of.data.targets).forEach(function(a){Yi[a]=!0})}}function Te(){Se({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ue(){return"mousemove"===nf.event.sourceEvent.type&&Oi.altDomain?(_f.domain(Oi.altDomain),void Oi.scale(_f).updateScaleExtent()):(mi&&_f.orgDomain()[0]===Wi[0]&&_f.domain([Wi[0]-1e-10,_f.orgDomain()[1]]),Se({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===nf.event.sourceEvent.type&&(qi=!0)))}function Ve(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function We(){Pi.attr("width",Kf).attr("height",Lf),Pi.select("#"+fi).select("rect").attr("width",Gf).attr("height",If),Pi.select("#"+gi).select("rect").attr("width",H),Pi.select("#"+hi).select("rect").attr("width",J),Pi.select("."+f.zoomRect).attr("width",Gf).attr("height",If)}function Xe(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),We(),m(a.withTransition),Se(a)}function Ye(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Ri.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ti(a)}),e=Ri.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ti(a)}).style("stroke","none").style("cursor",function(a){return Ag(a)?"pointer":null}),c=Ri.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ti(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Xi=+nf.select(this).style("opacity"),0}).style("fill",function(a){return ti(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ti(a)}).style("cursor",function(a){return Ag(a)?"pointer":null}),a.forEach(function(a){Ri.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Ri.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Sf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ti(a.data)}).style("cursor",function(a){return Ag(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),cf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,nf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),ef(),Id(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Jg&&(n=Si.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ti(a)}),l=Si.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ti(a)})),Pi.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ze(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),of.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Di?j:i,l=Di?Q():P();return d&&(w=0,C=0,t=0,u=0),Mg&&!Cc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Di?u:t,void(Rg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,Di?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Ti.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Og?Og(a):of.toggle(a)}).on("mouseover",function(a){of.focus(a),"function"==typeof Pg&&Pg(a)}).on("mouseout",function(a){of.revert(),"function"==typeof Qg&&Qg(a)}),l.append("text").text(function(a){return d(ng[a])?ng[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",Di?g:-200).attr("y",Di?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Di?h:-200).attr("y",Di?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return ti(a)}).attr("x",Di?g:-200).attr("y",Di?-200:i).attr("width",10).attr("height",10),Ti.selectAll("text").data(a).text(function(a){return d(ng[a])?ng[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ti.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ti.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),We(),q&&m(p)}function jf(a){return zc(of.data.targets,a.id)}function kf(a){return"data"in a&&zc(of.data.targets,a.data.id)}function lf(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 mf(a,b,c){var d=!Yd(of.data.targets);Sd(a,b),Xe(c?c:{withTransitionForAxis:d})}var nf=a.d3?a.d3:a.require?a.require("d3"):void 0,of={data:{},axis:{},legend:{}},pf={},qf=h(["bindto"],"#chart"),rf=h(["size","width"]),sf=h(["size","height"]),tf=h(["padding","left"]),uf=h(["padding","right"]),vf=h(["zoom","enabled"],!1),wf=h(["zoom","extent"]),xf=h(["zoom","privileged"],!1),yf=h(["onenter"],function(){}),zf=h(["onleave"],function(){}),Af=h(["onresize"],function(){}),Bf=h(["onresized"],function(){}),Cf=h(["transition","duration"],350);g("data","data is required in config");var Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg=h(["data","x"]),kg=h(["data","xs"],{}),lg=h(["data","x_format"]),mg=h(["data","id_converter"],function(a){return a}),ng=h(["data","names"],{}),og=h(["data","classes"],{}),pg=h(["data","groups"],[]),qg=h(["data","axes"],{}),rg=h(["data","type"]),sg=h(["data","types"],{}),tg=h(["data","labels"],{}),ug=h(["data","order"]),vg=h(["data","regions"],{}),wg=h(["data","color"]),xg=h(["data","colors"],{}),yg=h(["data","selection","enabled"],!1),zg=h(["data","selection","grouped"],!1),Ag=h(["data","selection","isselectable"],function(){return!0}),Bg=h(["data","selection","multiple"],!0),Cg=h(["data","onclick"],function(){}),Dg=h(["data","onenter"],function(){}),Eg=h(["data","onleave"],function(){}),Fg=h(["data","onselected"],function(){}),Gg=h(["data","onunselected"],function(){}),Hg=h(["data","ondragstart"],function(){}),Ig=h(["data","ondragend"],function(){}),Jg=h(["subchart","show"],!1),Kg=Jg?h(["subchart","size","height"],60):0,Lg=h(["color","pattern"],[]),Mg=h(["legend","show"],!0),Ng=h(["legend","position"],"bottom"),Og=h(["legend","item","onclick"]),Pg=h(["legend","item","onmouseover"]),Qg=h(["legend","item","onmouseout"]),Rg=h(["legend","equally"],!1),Sg=h(["axis","rotated"],!1),Tg=h(["axis","x","type"],"indexed"),Ug=h(["axis","x","localtime"],!1),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"],10),$g=h(["axis","x","tick","count"]),_g=h(["axis","x","tick","fit"],!1),ah=h(["axis","x","tick","values"],null),bh=h(["axis","x","max"]),ch=h(["axis","x","min"]),dh=h(["axis","x","default"]),eh=h(["axis","x","label"],{}),fh=h(["axis","y","show"],!0),gh=h(["axis","y","max"]),hh=h(["axis","y","min"]),ih=h(["axis","y","center"]),jh=h(["axis","y","label"],{}),kh=h(["axis","y","inner"],!1),lh=h(["axis","y","tick","format"]),mh=h(["axis","y","padding"],{}),nh=h(["axis","y","ticks"],10),oh=h(["axis","y2","show"],!1),ph=h(["axis","y2","max"]),qh=h(["axis","y2","min"]),rh=h(["axis","y2","center"]),sh=h(["axis","y2","label"],{}),th=h(["axis","y2","inner"],!1),uh=h(["axis","y2","tick","format"]),vh=h(["axis","y2","padding"],{}),wh=h(["axis","y2","ticks"],10),xh=h(["grid","x","show"],!1),yh=h(["grid","x","type"],"tick"),zh=h(["grid","x","lines"],[]),Ah=h(["grid","y","show"],!1),Bh=h(["grid","y","lines"],[]),Ch=h(["grid","y","ticks"],10),Dh=h(["point","show"],!0),Eh=Dh?h(["point","r"],2.5):0,Fh=h(["point","focus","line","enabled"],!0),Gh=h(["point","focus","expand","enabled"],!0),Hh=h(["point","focus","expand","r"],Gh?4:Eh),Ih=h(["point","focus","select","r"],8),Jh=h(["line","connect_null"],!1),Kh=h(["bar","width"]),Lh=h(["bar","width","ratio"],.6),Mh=h(["pie","label","show"],!0),Nh=h(["pie","label","format"]),Oh=h(["pie","expand"],!0),Ph=h(["pie","onclick"],function(){}),Qh=h(["pie","onmouseover"],function(){}),Rh=h(["pie","onmouseout"],function(){}),Sh=h(["donut","label","show"],!0),Th=h(["donut","label","format"]),Uh=h(["donut","expand"],!0),Vh=h(["donut","title"],""),Wh=h(["donut","onclick"],function(){}),Xh=h(["donut","onmouseover"],function(){}),Yh=h(["donut","onmouseout"],function(){}),Zh=h(["regions"],[]),$h=h(["tooltip","show"],!0),_h=h(["tooltip","format","title"]),ai=h(["tooltip","format","value"]),bi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=_h?_h:b,l=ai?ai: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+""}),ci=h(["tooltip","init","show"],!1),di=h(["tooltip","init","x"],0),ei=h(["tooltip","init","position"],{top:"0px",left:"50px"}),fi=("string"==typeof qf?qf.replace("#",""):qf.id)+"-clip",gi=fi+"-xaxis",hi=fi+"-yaxis",ii=i(fi),ji=i(gi),ki=i(hi),li="timeseries"===Tg,mi="categorized"===Tg,ni=!li&&(jg||oe(kg)),oi=null,pi=!1,qi=!1,ri=!1,si=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ti=ie(xg,oe(Lg)?Lg:si,wg),ui=Ug?nf.time.format:nf.time.format.utc,vi=function(){var a=[[ui("%Y/%-m/%-d"),function(){return!0}],[ui("%-m/%-d"),function(a){return a.getMonth()}],[ui("%-m/%-d"),function(a){return 1!==a.getDate()}],[ui("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[ui("%I %p"),function(a){return a.getHours()}],[ui("%I:%M"),function(a){return a.getMinutes()}],[ui(":%S"),function(a){return a.getSeconds()}],[ui(".%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)}}(),wi=[],xi=[],yi=Sg?"left":"bottom",zi=Sg?kh?"top":"bottom":kh?"right":"left",Ai=Sg?th?"bottom":"top":th?"left":"right",Bi=Sg?"left":"bottom",Ci={main:function(){return"translate("+Df.left+","+Df.top+")"},context:function(){return"translate("+Ef.left+","+Ef.top+")"},legend:function(){return"translate("+Ff.left+","+Ff.top+")"},x:function(){return"translate(0,"+(Sg?0:If)+")"},y:function(){return"translate(0,"+(Sg?If:0)+")"},y2:function(){return"translate("+(Sg?0:Gf)+","+(Sg?1:0)+")"},subx:function(){return"translate(0,"+(Sg?0:Jf)+")"},arc:function(){return"translate("+Gf/2+","+If/2+")"}},Di="right"===Ng,Ei=0,Fi=0,Gi=0,Hi=30,Ii=30,Ji=5;Sf=nf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Ki,Li=function(){var a=nf.svg.line().x(Sg?function(a){return V(a.id)(a.value)}:ud).y(Sg?ud:function(a){return V(a.id)(a.value)});return Jh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Jh?ye(b.values):b.values;return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),vg[b.id]?Ke(e,_f,V(b.id),vg[b.id]):a(e)):(c=e[0]?_f(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Sg?"M "+d+" "+c:"M "+c+" "+d)}}(),Mi=function(){var a;return a=Sg?nf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):nf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=ye(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?_f(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Sg?"M "+d+" "+c:"M "+c+" "+d)}}(),Ni=function(){var a=nf.svg.line().x(Sg?function(a){return W(a.id)(a.value)}:xd).y(Sg?xd:function(a){return W(a.id)(a.value)});return function(b){var c=ye(b.values);return Zd(b)?a(c):"M "+cg(c[0].x)+" "+W(b.id)(c[0].value)}}(),Oi=function(){};Ki=nf.svg.brush().on("brush",Te),Ki.update=function(){return Si&&Si.select("."+f.brush).call(this),this},Ki.scale=function(a){return Sg?this.y(a):this.x(a)},vf&&(Oi=nf.behavior.zoom().on("zoomstart",function(){Oi.altDomain=nf.event.sourceEvent.altKey?_f.orgDomain():null}).on("zoom",vf?Ue:null),Oi.scale=function(a){return Sg?this.y(a):this.x(a)},Oi.orgScaleExtent=function(){var a=wf?wf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Oi.updateScaleExtent=function(){var a=$b(_f.orgDomain())/$b(Wi),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Pi,Qi,Ri,Si,Ti,Ui,Vi,Wi,Xi,Yi={};if(of.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Pi.selectAll(hd(a)),d=c.filter(jf),e=c.filter(kf);of.revert(),of.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(of.data.targets)&&Kb(a,!0),cf(a)},of.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Pi.selectAll(hd(a)),d=c.filter(jf),e=c.filter(kf);of.revert(),b(d.classed(f.focused,!1)),b(e),Yd(of.data.targets)&&Lb(a),df(a)},of.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Pi.selectAll(hd(a)),d=c.filter(jf),e=c.filter(kf);b(d.classed(f.focused,!1)),b(e),Yd(of.data.targets)&&Lb(a),ef()},of.show=function(a,b){a=yc(a),b=b||{},Hc(a),Pi.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ff(a):Ti.selectAll(kd(a)).classed(f.legendItemHidden,!1),Se({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},of.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Pi.selectAll(id(a)).transition().style("opacity",0),b.withLegend?gf(a):Ti.selectAll(kd(a)).classed(f.legendItemHidden,!0),Se({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},of.toggle=function(a){Bc(a)?of.hide(a):of.show(a)},of.unzoom=function(){Ki.clear().update(),Se({withUpdateXDomain:!0})},of.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){og[b]=a.classes[b]}),"categories"in a&&mi&&(Vg=a.categories,fg.categories(Vg)),"cacheIds"in a&&_b(a.cacheIds)?void Ze(bc(a.cacheIds),a.done):void("unload"in a?_e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){$e(a)}):$e(a))},of.unload=function(a){_e(yc(a),function(){Se({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},of.selected=function(a){return nf.merge(Ri.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return nf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},of.select=function(a,b,c){yg&&Ri.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=nf.select(this),i="circle"===this.nodeName?se:ve,j="circle"===this.nodeName?te:we,k=zg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Ag(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},of.unselect=function(a,b){yg&&Ri.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=nf.select(this),g="circle"===this.nodeName?te:we,h=zg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Ag(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},of.toLine=function(a){mf(a,"line")},of.toSpline=function(a){mf(a,"spline")},of.toBar=function(a){mf(a,"bar")},of.toScatter=function(a){mf(a,"scatter")},of.toArea=function(a){mf(a,"area")},of.toAreaSpline=function(a){mf(a,"area-spline")},of.toPie=function(a){mf(a,"pie",{withTransform:!0})},of.toDonut=function(a){mf(a,"donut",{withTransform:!0})},of.groups=function(a){return c(a)?pg:(pg=a,Se(),pg)},of.xgrids=function(a){return a?(zh=a,Se(),zh):zh},of.xgrids.add=function(a){return a?of.xgrids(zh.concat(a)):void 0},of.xgrids.remove=function(a){var b=lf(a);return of.xgrids(zh.filter(b))},of.ygrids=function(a){return a?(Bh=a,Se(),Bh):Bh},of.ygrids.add=function(a){return a?of.ygrids(Bh.concat(a)):void 0},of.ygrids.remove=function(a){var b=lf(a);return of.ygrids(Bh.filter(b))},of.regions=function(a){return c(a)?Zh:(Zh=a,Se(),Zh)},of.regions.add=function(a){return c(a)?Zh:(Zh=Zh.concat(a),Se(),Zh)},of.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;Pi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Zh=Zh.filter(function(b){return b.classes.indexOf(a)<0})}),Zh},of.data.get=function(a){var b=of.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},of.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},of.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){ng[b]=a[b]}),hf(xc(of.data.targets),{withTransition:!0}),ng):ng},of.x=function(a){return arguments.length&&(mc(of.data.targets,a),Se({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),of.data.xs},of.xs=function(a){return arguments.length&&(nc(of.data.targets,a),Se({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),of.data.xs},of.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},of.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(gh=+a.y),b(a.y2)&&(ph=+a.y2)):gh=ph=+a,Se())},of.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(hh=+a.y),b(a.y2)&&(qh=+a.y2)):hh=qh=+a,Se())},of.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&of.axis.max(a.max),"undefined"!=typeof a.min&&of.axis.min(a.min))},of.legend.show=function(a){Mg||(Mg=!0,Ti.style("visibility","visible")),ff(yc(a)),Se({withTransitionForHorizontalAxis:!1})},of.legend.hide=function(a){Mg&&ne(a)&&(Mg=!1,Ti.style("visibility","hidden")),gf(yc(a)),Se({withTransitionForHorizontalAxis:!1})},of.resize=function(a){rf=a?a.width:null,sf=a?a.height:null,Xe({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},of.destroy=function(){of.data.targets=void 0,of.data.xs={},Vi.html(""),a.onresize=null},"url"in e.data)nf.xhr(e.data.url,function(a,b){var c,d=nf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=nf.csv.parse(b.response),Le(c)});else if("rows"in e.data)Le(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Le(qc(e.data.columns))}return of},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 0665e60bebb9c9a90065c3ff3a08dc60bfea76c4 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 16 Apr 2014 12:01:32 +0900 Subject: [PATCH 045/178] Fix bug when arc with timeseries data --- c3.js | 4 +++- c3.min.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/c3.js b/c3.js index ecfa585..d08c368 100644 --- a/c3.js +++ b/c3.js @@ -655,7 +655,9 @@ if (typeof __axis_x_tick_format === 'function') { format = __axis_x_tick_format; } else if (isTimeSeries) { - format = function (date) { return xTimeFormat(__axis_x_tick_format)(date); }; + format = function (date) { + return date ? xTimeFormat(__axis_x_tick_format)(date) : ""; + }; } } return format; diff --git a/c3.min.js b/c3.min.js index 317a2f5..3ee867b 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.31"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cGf&&(Gf=0),0>If&&(If=0),Ef={top:Sg?Df.top:Lf-Kg-(Di?0:a),right:0/0,bottom:20+(Di?0:a),left:Sg?Hi:Df.left},Hf=Sg?Df.left-Hi-Ii:Gf,Jf=Sg?If:Lf-Ef.top-Ef.bottom,0>Hf&&(Hf=0),0>Jf&&(Jf=0),Ff={top:Di?0:Lf-a,right:0/0,bottom:0,left:Di?Kf-b:0},p(),Di&&Yd(of.data.targets)&&(Ff.left=Gf/2+Nf)}function o(){Ri.select("line."+f.xgridFocus).attr("x1",Sg?0:-10).attr("x2",Sg?Gf:-10).attr("y1",Sg?-10:Df.top).attr("y2",Sg?-10:If)}function p(){Nf=If/2,Mf=.95*Nf,Of=Xd(of.data.targets)?.6*Mf:0}function q(){var a=Sg?f.axisX:f.axisY,b=nf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=nf.select(qf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return rf?rf:x()}function s(){var a=sf?sf:y();return a>0?a:320}function t(){return Yd(of.data.targets)?0:tf?tf:Sg||!fh||kh?1:v("y")}function u(){var a=1;return Yd(of.data.targets)?0:uf?uf:Di?P()+(oh&&!Sg?v("y2"):a):oh?th||Sg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||fh?"y2"!==a||oh?(gb(a).isInner?30:40)+("y2"===a?-10:0):Ji:Mg&&!Di?10:1}function x(){return+nf.select(qf).style("width").replace("px","")}function y(){return+nf.select(qf).style("height").replace("px","")}function z(a){return a?-5:-(Df.left-1)}function A(a){return a?-20:-1}function B(){return z(!Sg)}function C(){return A(!Sg)}function D(){return z(Sg)}function E(){return A(Sg)}function F(a){return a?Gf+2+4:Df.left+20}function G(a){return a?80:If+2}function H(){return F(!Sg)}function I(){return G(!Sg)}function J(){return F(Sg)}function K(){return G(Sg)}function L(){var a=Sg?If:Gf,b=vc(),c=Vb()*(Ud(of.data.targets)?(b-(mi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){Ei=a}function N(a){Fi=a}function O(a){Gi=a}function P(){return Mg?Di?Fi*(Ei+1):Kf:0}function Q(){return Mg?Di?Lf:Gi*(Ei+1):0}function R(){var a,b=!_f;Tf=Sg?1:0,Uf=Sg?If:Gf,Vf=Sg?0:If,Wf=Sg?Gf:1,Xf=Tf,Yf=Uf,Zf=Sg?0:Jf,$f=Sg?Hf:1,_f=T(Tf,Uf,b?void 0:_f.domain(),function(){return fg.tickOffset()}),ag=U(Vf,Wf),bg=U(Vf,Wf),cg=T(Tf,Uf,Wi,function(a){return a%1?0:ig.tickOffset()}),dg=U(Zf,$f),eg=U(Zf,$f),a=$(),fg=X(_f,yi,a),ig=X(cg,Bi,a),gg=Y(ag,zi,lh,nh),hg=Y(bg,Ai,uh,wh),b||(Ki.scale(cg),vf&&Oi.scale(_f)),S()}function S(){Pf=Db(),Qf=Eb(),Rf=Eb(.98)}function T(a,b,e,f){var g=(li?nf.time.scale():nf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),mi){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return nf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?bg:ag}function W(a){return"y2"===Z(a)?eg:dg}function X(a,b,c){var d=(mi?Bb():nf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),mi?(d.tickCentered(Wg),ne(Yg)&&(Yg=!1)):d.tickOffset=function(){var a=Sg?If:Gf;return a*Vb()/vc()/2},mi&&d.categories(Vg),d}function Y(a,b,c,d){return nf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in qg?qg[a]:"y"}function $(){var a=li?vi:mi?Oc:function(a){return 0>a?a.toFixed(0):a};return Xg&&("function"==typeof Xg?a=Xg:li&&(a=function(a){return ui(Xg)(a)})),a}function _(a){var b;return"y"===a?b=jh:"y2"===a?b=sh:"x"===a&&(b=eh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?jh=b:"y2"===a?sh=b:"x"===a&&(eh=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Sg?"inner-top":"inner-right")}function eb(){return cb("y",Sg?"inner-right":"inner-top")}function fb(){return cb("y2",Sg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?Gf/2:Gf:b.isBottom?-If:b.isMiddle?-If/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Sg,db())}function ob(){return kb(Sg,eb())}function pb(){return kb(Sg,fb())}function qb(){return lb(!Sg,db())}function rb(){return lb(Sg,eb())}function sb(){return lb(Sg,fb())}function tb(){var a=db();return Sg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Sg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Sg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Sg,db())}function xb(){return mb(Sg,eb())}function yb(){return mb(Sg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return nf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Ri.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Ri.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Ri.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+o)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Mc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return nf.min(Object.keys(i).map(function(a){return nf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(pg.length>0)for(g=Nc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return nf.max(Object.keys(i).map(function(a){return nf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?qh:hh,n="y2"===c?ph:gh,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?rh:ih,r=pd()&&Sg;return 0===l.length?"y2"===c?bg.domain():ag.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=qd(o,p),j=$b(ag.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&mh&&(f=b(mh.top)?mh.top:e,g=b(mh.bottom)?mh.bottom:e),"y2"===c&&vh&&(f=b(vh.top)?vh.top:e,g=b(vh.bottom)?vh.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Wi),c=$b(_f.domain());return a||0===c?1:b/c}function Wb(a){return ch?ch:nf.min(a,function(a){return nf.min(a.values,function(a){return a.x})})}function Xb(a){return bh?bh:nf.max(a,function(a){return nf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return mi?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=0,g=0;return(c||0===c)&&(f=li?new Date(c.getTime()-e):c-e),(d||0===d)&&(g=li?new Date(d.getTime()+e):d+e),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return jg&&a===jg||oe(kg)&&pe(kg,a)}function fc(a){return!ec(a)}function gc(a){return jg?jg:oe(kg)?kg[a]:null}function hc(a,b){var c,d=b&&oe(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=of.data.xs[b])}),c}function ic(a,b){return a in of.data.xs&&of.data.xs[a]&&of.data.xs[a][b]?of.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){kg[b]=a[b]})}function kc(a){return 1===nf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=ng[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),of.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=li?a?a instanceof Date?a:je(a):je(ic(b,c)):ni&&!mi?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?of.data.xs[c]=a.map(function(a){return a[f]}).filter(b):jg?(d=Object.keys(of.data.xs),of.data.xs[c]=d.length>0?of.data.xs[d[0]]:void 0):oe(kg)&&(of.data.xs[c]=hc(f,of.data.targets)):of.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!of.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=mg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return ni&&mi&&0===c&&g&&(0===e&&(Vg=[]),Vg.push(g)),("undefined"==typeof a[b]||of.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),rg&&Sd(xc(c).filter(function(a){return!(a in sg)}),rg),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function tc(a){return a>0&&of.data.targets[0].values[a-1]?of.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?of.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?of.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(of.data.targets)}function zc(a,b){var c,d=xc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(li?new Date(h):h);i.push(d)}return li||(i=i.sort(function(a,b){return a-b})),i}function Gc(a){wi=wi.concat(a)}function Hc(a){wi=wi.filter(function(b){return a.indexOf(b)<0})}function Ic(a){xi=xi.concat(a)}function Jc(a){xi=xi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=qe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return nf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Ed(){return ug&&"desc"===ug.toLowerCase()}function Fd(){return ug&&"asc"===ug.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof ug&&a.sort(ug),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(of.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});$h&&0!==m.length&&(Ui.html(bi(a,$(),l,ti)).style("display","block"),d=Ui.property("offsetWidth"),e=Ui.property("offsetHeight"),k?(g=Gf/2+c[0],i=If/2+c[1]+20):(Sg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=_f(m[0].x)+20):(f=q(),g=f+t()+_f(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Ui.style("top",i+"px").style("left",g+"px"))}function Id(){Ui.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});$h&&(Vd(of.data.targets)||Yd(of.data.targets)||Ri.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Sg?"y1":"x1",ud).attr(Sg?"y2":"x2",ud))}function Kd(){Ri.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?_f(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Kh?Kh:b?2*a.tickOffset()*Lh/b:0}function Sd(a,b){yc(a).forEach(function(a){Yi[a]=b===sg[a],sg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){sg[a.id]===b&&(c=!0),a.id in sg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in sg)||"line"===sg[b]||"spline"===sg[b]||"area"===sg[b]||"area-spline"===sg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===sg[b]||"area-spline"===sg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===sg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===sg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===sg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===sg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(a){return ce(a)&&Uh||be(a)&&Oh}function ie(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function je(b){var c;try{c=lg?nf.time.format(lg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+lg)}return c}function ke(a,b){var c=nf.mouse(a),d=nf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function pe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function qe(a,b){var c="y"===Z(a.id)?ag:bg,d=Sg?1:0,e=Sg?0:1;return Math.pow(_f(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function re(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function se(a,b,c){Fg(b,a.node()),Ri.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Sg?Md:Ld).attr("cy",Sg?Ld:Md).attr("stroke",function(){return ti(b)}).attr("r",1.4*Ih).transition().duration(100).attr("r",Ih)}function te(a,b,c){Gg(b,a.node()),Ri.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ue(a,b,c,d){a?se(b,c,d):te(b,c,d)}function ve(a,b){Fg(b,a.node()),a.transition().duration(100).style("fill",function(){return nf.rgb(ti(b)).darker(1)})}function we(a,b){Gg(b,a.node()),a.transition().duration(100).style("fill",function(){return ti(b)})}function xe(a,b,c,d){a?ve(b,c,d):we(b,c,d)}function ye(a){return a.filter(function(a){return b(a.value)})}function ze(a,c){return(c?Ri.selectAll("."+f.circles+gd(c)):Ri).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ae(a,b){ze(a,b).classed(f.EXPANDED,!0).attr("r",Hh)}function Be(a){ze(a).filter(function(){return nf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Eh)}function Ce(a){return Ri.selectAll("."+f.bar+(b(a)?"-"+a:""))}function De(a){Ce(a).classed(f.EXPANDED,!0)}function Ee(a){Ce(a).classed(f.EXPANDED,!1)}function Fe(a,b){var c=Je(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 Ge(a,b){var c=Je(a,!1),d=b?He:Ie;return function(a,b){return d(c(a,b),a,this)}}function He(a,b){var c;return Sg?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ie(a,b,c){var d=c.getBoundingClientRect();return Sg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Je(a,b){var c=a.__max__+1,d=Rd(fg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return 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 Ke(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 Le(b){var c,d,e;if(Vi=nf.select(qf),Vi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Vi.html(""),Vi.classed("c3",!0),of.data.xs={},of.data.targets=rc(b),n(),R(),_f.domain(nf.extent(Zb(of.data.targets))),ag.domain(Ub(of.data.targets,"y")),bg.domain(Ub(of.data.targets,"y2")),cg.domain(_f.domain()),dg.domain(ag.domain()),eg.domain(bg.domain()),Wi=_f.domain(),Ki.scale(cg),vf&&Oi.scale(_f),Pi=Vi.append("svg").attr("width",Gf+Df.left+Df.right).attr("height",If+Df.top+Df.bottom).on("mouseenter",yf).on("mouseleave",zf),Qi=Pi.append("defs"),Qi.append("clipPath").attr("id",fi).append("rect").attr("width",Gf).attr("height",If),Qi.append("clipPath").attr("id",gi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Qi.append("clipPath").attr("id",hi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Ri=Pi.append("g").attr("transform",Ci.main),Si=Jg?Pi.append("g").attr("transform",Ci.context):null,Ti=Pi.append("g").attr("transform",Ci.legend),Mg||(Ti.style("visibility","hidden"),xi=xc(of.data.targets)),Ui=nf.select(qf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),hf(xc(of.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Ri.append("g").attr("class",f.axisX).attr("clip-path",Sg?"":ji).attr("transform",Ci.x).append("text").attr("class",f.axisXLabel).attr("transform",Sg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),fh&&Ri.append("g").attr("class",f.axisY).attr("clip-path",Sg?ki:"").attr("transform",Ci.y).append("text").attr("class",f.axisYLabel).attr("transform",Sg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),oh&&Ri.append("g").attr("class",f.axisY2).attr("transform",Ci.y2).append("text").attr("class",f.axisY2Label).attr("transform",Sg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Ri.append("g").attr("clip-path",ii).attr("class",f.grid),xh&&d.append("g").attr("class",f.xgrids),oe(zh)&&d.append("g").attr("class",f.xgridLines),Fh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Ah&&d.append("g").attr("class",f.ygrids),oe(Bh)&&d.append("g").attr("class",f.ygridLines),Ri.append("g").attr("clip-path",ii).attr("class",f.regions),Ri.append("g").attr("clip-path",ii).attr("class",f.chart),c=Ri.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",vf?Sg?"ns-resize":"ew-resize":null),Ri.select("."+f.chart).append("g").attr("class",f.chartBars),Ri.select("."+f.chart).append("g").attr("class",f.chartLines),Ri.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Ci.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Ri.select("."+f.chart).append("g").attr("class",f.chartTexts),vf&&Ri.insert("rect",xf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Gf).attr("height",If).style("opacity",0).style("cursor",Sg?"ns-resize":"ew-resize").call(Oi).on("dblclick.zoom",null),dh&&Ki.extent("function"!=typeof dh?dh:dh(Zb())),Jg&&(Si.append("g").attr("clip-path",ii).attr("class",f.chart),Si.select("."+f.chart).append("g").attr("class",f.chartBars),Si.select("."+f.chart).append("g").attr("class",f.chartLines),Si.append("g").attr("clip-path",ii).attr("class",f.brush).call(Ki).selectAll("rect").attr(Sg?"width":"height",Sg?Hf:Jf),Si.append("g").attr("class",f.axisX).attr("transform",Ci.subx).attr("clip-path",Sg?"":ji)),Ye(of.data.targets),Sg?Ri.select("."+f.axisX).style("opacity",0).call(fg):(Ri.select("."+f.axisY).style("opacity",0).call(gg),Ri.select("."+f.axisY2).style("opacity",0).call(hg)),Se({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),ci){if(li&&"string"==typeof di){for(di=je(di),e=0;eGf&&(Gf=0),0>If&&(If=0),Ef={top:Sg?Df.top:Lf-Kg-(Di?0:a),right:0/0,bottom:20+(Di?0:a),left:Sg?Hi:Df.left},Hf=Sg?Df.left-Hi-Ii:Gf,Jf=Sg?If:Lf-Ef.top-Ef.bottom,0>Hf&&(Hf=0),0>Jf&&(Jf=0),Ff={top:Di?0:Lf-a,right:0/0,bottom:0,left:Di?Kf-b:0},p(),Di&&Yd(of.data.targets)&&(Ff.left=Gf/2+Nf)}function o(){Ri.select("line."+f.xgridFocus).attr("x1",Sg?0:-10).attr("x2",Sg?Gf:-10).attr("y1",Sg?-10:Df.top).attr("y2",Sg?-10:If)}function p(){Nf=If/2,Mf=.95*Nf,Of=Xd(of.data.targets)?.6*Mf:0}function q(){var a=Sg?f.axisX:f.axisY,b=nf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=nf.select(qf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return rf?rf:x()}function s(){var a=sf?sf:y();return a>0?a:320}function t(){return Yd(of.data.targets)?0:tf?tf:Sg||!fh||kh?1:v("y")}function u(){var a=1;return Yd(of.data.targets)?0:uf?uf:Di?P()+(oh&&!Sg?v("y2"):a):oh?th||Sg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||fh?"y2"!==a||oh?(gb(a).isInner?30:40)+("y2"===a?-10:0):Ji:Mg&&!Di?10:1}function x(){return+nf.select(qf).style("width").replace("px","")}function y(){return+nf.select(qf).style("height").replace("px","")}function z(a){return a?-5:-(Df.left-1)}function A(a){return a?-20:-1}function B(){return z(!Sg)}function C(){return A(!Sg)}function D(){return z(Sg)}function E(){return A(Sg)}function F(a){return a?Gf+2+4:Df.left+20}function G(a){return a?80:If+2}function H(){return F(!Sg)}function I(){return G(!Sg)}function J(){return F(Sg)}function K(){return G(Sg)}function L(){var a=Sg?If:Gf,b=vc(),c=Vb()*(Ud(of.data.targets)?(b-(mi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){Ei=a}function N(a){Fi=a}function O(a){Gi=a}function P(){return Mg?Di?Fi*(Ei+1):Kf:0}function Q(){return Mg?Di?Lf:Gi*(Ei+1):0}function R(){var a,b=!_f;Tf=Sg?1:0,Uf=Sg?If:Gf,Vf=Sg?0:If,Wf=Sg?Gf:1,Xf=Tf,Yf=Uf,Zf=Sg?0:Jf,$f=Sg?Hf:1,_f=T(Tf,Uf,b?void 0:_f.domain(),function(){return fg.tickOffset()}),ag=U(Vf,Wf),bg=U(Vf,Wf),cg=T(Tf,Uf,Wi,function(a){return a%1?0:ig.tickOffset()}),dg=U(Zf,$f),eg=U(Zf,$f),a=$(),fg=X(_f,yi,a),ig=X(cg,Bi,a),gg=Y(ag,zi,lh,nh),hg=Y(bg,Ai,uh,wh),b||(Ki.scale(cg),vf&&Oi.scale(_f)),S()}function S(){Pf=Db(),Qf=Eb(),Rf=Eb(.98)}function T(a,b,e,f){var g=(li?nf.time.scale():nf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),mi){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return nf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?bg:ag}function W(a){return"y2"===Z(a)?eg:dg}function X(a,b,c){var d=(mi?Bb():nf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),mi?(d.tickCentered(Wg),ne(Yg)&&(Yg=!1)):d.tickOffset=function(){var a=Sg?If:Gf;return a*Vb()/vc()/2},mi&&d.categories(Vg),d}function Y(a,b,c,d){return nf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in qg?qg[a]:"y"}function $(){var a=li?vi:mi?Oc:function(a){return 0>a?a.toFixed(0):a};return Xg&&("function"==typeof Xg?a=Xg:li&&(a=function(a){return a?ui(Xg)(a):""})),a}function _(a){var b;return"y"===a?b=jh:"y2"===a?b=sh:"x"===a&&(b=eh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?jh=b:"y2"===a?sh=b:"x"===a&&(eh=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Sg?"inner-top":"inner-right")}function eb(){return cb("y",Sg?"inner-right":"inner-top")}function fb(){return cb("y2",Sg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?Gf/2:Gf:b.isBottom?-If:b.isMiddle?-If/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Sg,db())}function ob(){return kb(Sg,eb())}function pb(){return kb(Sg,fb())}function qb(){return lb(!Sg,db())}function rb(){return lb(Sg,eb())}function sb(){return lb(Sg,fb())}function tb(){var a=db();return Sg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Sg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Sg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Sg,db())}function xb(){return mb(Sg,eb())}function yb(){return mb(Sg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return nf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Ri.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Ri.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Ri.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+o)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Mc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return nf.min(Object.keys(i).map(function(a){return nf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(pg.length>0)for(g=Nc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return nf.max(Object.keys(i).map(function(a){return nf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?qh:hh,n="y2"===c?ph:gh,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?rh:ih,r=pd()&&Sg;return 0===l.length?"y2"===c?bg.domain():ag.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=qd(o,p),j=$b(ag.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&mh&&(f=b(mh.top)?mh.top:e,g=b(mh.bottom)?mh.bottom:e),"y2"===c&&vh&&(f=b(vh.top)?vh.top:e,g=b(vh.bottom)?vh.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Wi),c=$b(_f.domain());return a||0===c?1:b/c}function Wb(a){return ch?ch:nf.min(a,function(a){return nf.min(a.values,function(a){return a.x})})}function Xb(a){return bh?bh:nf.max(a,function(a){return nf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return mi?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=0,g=0;return(c||0===c)&&(f=li?new Date(c.getTime()-e):c-e),(d||0===d)&&(g=li?new Date(d.getTime()+e):d+e),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return jg&&a===jg||oe(kg)&&pe(kg,a)}function fc(a){return!ec(a)}function gc(a){return jg?jg:oe(kg)?kg[a]:null}function hc(a,b){var c,d=b&&oe(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=of.data.xs[b])}),c}function ic(a,b){return a in of.data.xs&&of.data.xs[a]&&of.data.xs[a][b]?of.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){kg[b]=a[b]})}function kc(a){return 1===nf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=ng[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),of.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=li?a?a instanceof Date?a:je(a):je(ic(b,c)):ni&&!mi?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?of.data.xs[c]=a.map(function(a){return a[f]}).filter(b):jg?(d=Object.keys(of.data.xs),of.data.xs[c]=d.length>0?of.data.xs[d[0]]:void 0):oe(kg)&&(of.data.xs[c]=hc(f,of.data.targets)):of.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!of.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=mg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return ni&&mi&&0===c&&g&&(0===e&&(Vg=[]),Vg.push(g)),("undefined"==typeof a[b]||of.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),rg&&Sd(xc(c).filter(function(a){return!(a in sg)}),rg),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function tc(a){return a>0&&of.data.targets[0].values[a-1]?of.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?of.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?of.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(of.data.targets)}function zc(a,b){var c,d=xc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(li?new Date(h):h);i.push(d)}return li||(i=i.sort(function(a,b){return a-b})),i}function Gc(a){wi=wi.concat(a)}function Hc(a){wi=wi.filter(function(b){return a.indexOf(b)<0})}function Ic(a){xi=xi.concat(a)}function Jc(a){xi=xi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=qe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return nf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Ed(){return ug&&"desc"===ug.toLowerCase()}function Fd(){return ug&&"asc"===ug.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof ug&&a.sort(ug),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(of.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});$h&&0!==m.length&&(Ui.html(bi(a,$(),l,ti)).style("display","block"),d=Ui.property("offsetWidth"),e=Ui.property("offsetHeight"),k?(g=Gf/2+c[0],i=If/2+c[1]+20):(Sg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=_f(m[0].x)+20):(f=q(),g=f+t()+_f(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Ui.style("top",i+"px").style("left",g+"px"))}function Id(){Ui.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});$h&&(Vd(of.data.targets)||Yd(of.data.targets)||Ri.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Sg?"y1":"x1",ud).attr(Sg?"y2":"x2",ud))}function Kd(){Ri.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?_f(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Kh?Kh:b?2*a.tickOffset()*Lh/b:0}function Sd(a,b){yc(a).forEach(function(a){Yi[a]=b===sg[a],sg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){sg[a.id]===b&&(c=!0),a.id in sg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in sg)||"line"===sg[b]||"spline"===sg[b]||"area"===sg[b]||"area-spline"===sg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===sg[b]||"area-spline"===sg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===sg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===sg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===sg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===sg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(a){return ce(a)&&Uh||be(a)&&Oh}function ie(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function je(b){var c;try{c=lg?nf.time.format(lg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+lg)}return c}function ke(a,b){var c=nf.mouse(a),d=nf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function pe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function qe(a,b){var c="y"===Z(a.id)?ag:bg,d=Sg?1:0,e=Sg?0:1;return Math.pow(_f(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function re(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function se(a,b,c){Fg(b,a.node()),Ri.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Sg?Md:Ld).attr("cy",Sg?Ld:Md).attr("stroke",function(){return ti(b)}).attr("r",1.4*Ih).transition().duration(100).attr("r",Ih)}function te(a,b,c){Gg(b,a.node()),Ri.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ue(a,b,c,d){a?se(b,c,d):te(b,c,d)}function ve(a,b){Fg(b,a.node()),a.transition().duration(100).style("fill",function(){return nf.rgb(ti(b)).darker(1)})}function we(a,b){Gg(b,a.node()),a.transition().duration(100).style("fill",function(){return ti(b)})}function xe(a,b,c,d){a?ve(b,c,d):we(b,c,d)}function ye(a){return a.filter(function(a){return b(a.value)})}function ze(a,c){return(c?Ri.selectAll("."+f.circles+gd(c)):Ri).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ae(a,b){ze(a,b).classed(f.EXPANDED,!0).attr("r",Hh)}function Be(a){ze(a).filter(function(){return nf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Eh)}function Ce(a){return Ri.selectAll("."+f.bar+(b(a)?"-"+a:""))}function De(a){Ce(a).classed(f.EXPANDED,!0)}function Ee(a){Ce(a).classed(f.EXPANDED,!1)}function Fe(a,b){var c=Je(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 Ge(a,b){var c=Je(a,!1),d=b?He:Ie;return function(a,b){return d(c(a,b),a,this)}}function He(a,b){var c;return Sg?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ie(a,b,c){var d=c.getBoundingClientRect();return Sg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Je(a,b){var c=a.__max__+1,d=Rd(fg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return 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 Ke(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 Le(b){var c,d,e;if(Vi=nf.select(qf),Vi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Vi.html(""),Vi.classed("c3",!0),of.data.xs={},of.data.targets=rc(b),n(),R(),_f.domain(nf.extent(Zb(of.data.targets))),ag.domain(Ub(of.data.targets,"y")),bg.domain(Ub(of.data.targets,"y2")),cg.domain(_f.domain()),dg.domain(ag.domain()),eg.domain(bg.domain()),Wi=_f.domain(),Ki.scale(cg),vf&&Oi.scale(_f),Pi=Vi.append("svg").attr("width",Gf+Df.left+Df.right).attr("height",If+Df.top+Df.bottom).on("mouseenter",yf).on("mouseleave",zf),Qi=Pi.append("defs"),Qi.append("clipPath").attr("id",fi).append("rect").attr("width",Gf).attr("height",If),Qi.append("clipPath").attr("id",gi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Qi.append("clipPath").attr("id",hi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Ri=Pi.append("g").attr("transform",Ci.main),Si=Jg?Pi.append("g").attr("transform",Ci.context):null,Ti=Pi.append("g").attr("transform",Ci.legend),Mg||(Ti.style("visibility","hidden"),xi=xc(of.data.targets)),Ui=nf.select(qf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),hf(xc(of.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Ri.append("g").attr("class",f.axisX).attr("clip-path",Sg?"":ji).attr("transform",Ci.x).append("text").attr("class",f.axisXLabel).attr("transform",Sg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),fh&&Ri.append("g").attr("class",f.axisY).attr("clip-path",Sg?ki:"").attr("transform",Ci.y).append("text").attr("class",f.axisYLabel).attr("transform",Sg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),oh&&Ri.append("g").attr("class",f.axisY2).attr("transform",Ci.y2).append("text").attr("class",f.axisY2Label).attr("transform",Sg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Ri.append("g").attr("clip-path",ii).attr("class",f.grid),xh&&d.append("g").attr("class",f.xgrids),oe(zh)&&d.append("g").attr("class",f.xgridLines),Fh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Ah&&d.append("g").attr("class",f.ygrids),oe(Bh)&&d.append("g").attr("class",f.ygridLines),Ri.append("g").attr("clip-path",ii).attr("class",f.regions),Ri.append("g").attr("clip-path",ii).attr("class",f.chart),c=Ri.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",vf?Sg?"ns-resize":"ew-resize":null),Ri.select("."+f.chart).append("g").attr("class",f.chartBars),Ri.select("."+f.chart).append("g").attr("class",f.chartLines),Ri.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Ci.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Ri.select("."+f.chart).append("g").attr("class",f.chartTexts),vf&&Ri.insert("rect",xf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Gf).attr("height",If).style("opacity",0).style("cursor",Sg?"ns-resize":"ew-resize").call(Oi).on("dblclick.zoom",null),dh&&Ki.extent("function"!=typeof dh?dh:dh(Zb())),Jg&&(Si.append("g").attr("clip-path",ii).attr("class",f.chart),Si.select("."+f.chart).append("g").attr("class",f.chartBars),Si.select("."+f.chart).append("g").attr("class",f.chartLines),Si.append("g").attr("clip-path",ii).attr("class",f.brush).call(Ki).selectAll("rect").attr(Sg?"width":"height",Sg?Hf:Jf),Si.append("g").attr("class",f.axisX).attr("transform",Ci.subx).attr("clip-path",Sg?"":ji)),Ye(of.data.targets),Sg?Ri.select("."+f.axisX).style("opacity",0).call(fg):(Ri.select("."+f.axisY).style("opacity",0).call(gg),Ri.select("."+f.axisY2).style("opacity",0).call(hg)),Se({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),ci){if(li&&"string"==typeof di){for(di=je(di),e=0;e0){d=[];for(var g in ng)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=xe,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 Qe(a){Yd(of.data.targets)||yg&&(oi=a,Ri.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),pi=!0,Hg())}function Re(){Yd(of.data.targets)||yg&&(Ri.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Ri.selectAll("."+f.shape).classed(f.INCLUDED,!1),pi=!1,Ig())}function Se(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Nd(),U=Yd(of.data.targets),V=Dc(of.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?Cf:0,O=B?N:0,P=C?N:0,H&&Mg&&hf(xc(of.data.targets),a),G&&(_f.domain(nf.extent(Zb(V))),Wi=_f.domain(),vf&&Oi.scale(_f).updateScaleExtent(),cg.domain(_f.domain()),Ki.scale(cg)),F&&(_f.domain(Ki.empty()?Wi:Ki.extent()),vf&&Oi.scale(_f).updateScaleExtent()),ag.domain(Ub(V,"y")),bg.domain(Ub(V,"y2")),Vd(V)||(Q=ah?ah:Fc(Ec(V)),fg.tickValues(Q),ig.tickValues(Q)),c=Ri.select("."+f.axisX).style("opacity",U?0:1),(Sg||D)&&(c=c.transition().duration(P)),c.call(fg),e=Ri.select("."+f.axisY).style("opacity",U?0:1),(!Sg||D)&&(e=e.transition().duration(P)),e.call(gg),Ri.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(hg),F)if(Yg&&Q){for(R=1;R=0&&nf.select(this).style("display",b%S?"none":"block")})}else nf.selectAll("."+f.axisX+" .tick text").style("display","block");if(I=Fe(T),K=Ge(T,!0),M=Ge(T,!1),Ab(),dg.domain(ag.domain()),eg.domain(bg.domain()),Ui.style("display","none"),o(),Ri.select("line."+f.xgridFocus).style("visibility","hidden"),xh){if("year"===yh){h=[];for(var W=Zb(),X=W[0].getFullYear(),Y=W[1].getFullYear(),Z=X;Y>=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=_f.ticks(10);g=Ri.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Sg?0:function(a){return _f(a)-fg.tickOffset()}).attr("x2",Sg?Gf:function(a){return _f(a)-fg.tickOffset()}).attr("y1",Sg?function(a){return _f(a)-fg.tickOffset()}:Df.top).attr("y2",Sg?function(a){return _f(a)-fg.tickOffset()}:If).style("opacity",function(){return+nf.select(this).attr(Sg?"y1":"x1")===(Sg?If:0)?0:1}),g.exit().remove()}oe(zh)&&(i=Ri.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(zh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Sg?"":"rotate(-90)").attr("dx",Sg?0:-Df.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Sg?0:vd).attr("x2",Sg?Gf:vd).attr("y1",Sg?vd:Df.top).attr("y2",Sg?vd:If).style("opacity",1),i.select("text").transition().duration(N).attr("x",Sg?Gf:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&Ah&&(k=Ri.select("."+f.ygrids).selectAll("."+f.ygrid).data(ag.ticks(Ch)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Sg?ag:0).attr("x2",Sg?ag:Gf).attr("y1",Sg?0:ag).attr("y2",Sg?If:ag),k.exit().remove()),y&&oe(Bh)&&(l=Ri.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Bh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Sg?"rotate(-90)":"").attr("dx",Sg?0:-Df.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Sg?wd:0).attr("x2",Sg?wd:Gf).attr("y1",Sg?0:wd).attr("y2",Sg?If:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Sg?0:Gf).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Ri.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ti(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Ri.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Sg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Ri.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Li).style("opacity",1),Ri.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Mi).style("opacity",Xi),n=Ri.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",Eh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Sg?Md:Ld).attr("cy",Sg?Ld:Md),n.exit().remove(),Ri.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=nf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Ri.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Ri.select("."+f.chartArcsTitle).style("opacity",Xd(of.data.targets)?1:0),Jg&&(null!==nf.event&&"zoom"===nf.event.type&&Ki.extent(_f.orgDomain()).update(),z&&(Si.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(ig),Ki.empty()||Ki.extent(_f.orgDomain()).update(),J=Fe(T,!0),s=Si.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ti(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Si.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ni).style("opacity",1))),Ri.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Ri.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Sg?Md:Ld).attr("cy",Sg?Ld:Md),t=Ri.select("."+f.eventRects),oe(kg)&&!kc(kg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Ri.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ne(u.enter()),u.attr("x",0).attr("y",0).attr("width",Gf).attr("height",If)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),ni&&!mi?(x=function(a,b){var c=tc(b),d=uc(b),e=of.data.xs[a.id][b];return(_f(d?d:e+50)-_f(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=of.data.xs[a.id][b];return(_f(d)+_f(c?c:d-50))/2}):(x=L(),w=function(a){return _f(a.x)-x/2}),v=wc(),Ri.select("."+f.eventRects).datum(v?v.values:[]),u=Ri.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Me(u.enter()),u.attr("class",ad).attr("x",Sg?0:w).attr("y",Sg?w:0).attr("width",Sg?Gf:x).attr("height",Sg?x:If),u.exit().remove()),q=Ri.select("."+f.regions).selectAll("rect."+f.region).data(Zh),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Sg?0:cc).attr("y",Sg?cc:Df.top).attr("width",Sg?Gf:dc).attr("height",Sg?dc:If).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),xc(of.data.targets).forEach(function(a){Yi[a]=!0})}}function Te(){Se({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ue(){return"mousemove"===nf.event.sourceEvent.type&&Oi.altDomain?(_f.domain(Oi.altDomain),void Oi.scale(_f).updateScaleExtent()):(mi&&_f.orgDomain()[0]===Wi[0]&&_f.domain([Wi[0]-1e-10,_f.orgDomain()[1]]),Se({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===nf.event.sourceEvent.type&&(qi=!0)))}function Ve(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function We(){Pi.attr("width",Kf).attr("height",Lf),Pi.select("#"+fi).select("rect").attr("width",Gf).attr("height",If),Pi.select("#"+gi).select("rect").attr("width",H),Pi.select("#"+hi).select("rect").attr("width",J),Pi.select("."+f.zoomRect).attr("width",Gf).attr("height",If)}function Xe(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),We(),m(a.withTransition),Se(a)}function Ye(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Ri.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ti(a)}),e=Ri.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ti(a)}).style("stroke","none").style("cursor",function(a){return Ag(a)?"pointer":null}),c=Ri.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ti(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Xi=+nf.select(this).style("opacity"),0}).style("fill",function(a){return ti(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ti(a)}).style("cursor",function(a){return Ag(a)?"pointer":null}),a.forEach(function(a){Ri.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Ri.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Sf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ti(a.data)}).style("cursor",function(a){return Ag(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),cf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,nf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),ef(),Id(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Jg&&(n=Si.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ti(a)}),l=Si.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ti(a)})),Pi.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ze(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),of.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Di?j:i,l=Di?Q():P();return d&&(w=0,C=0,t=0,u=0),Mg&&!Cc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Di?u:t,void(Rg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,Di?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Ti.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Og?Og(a):of.toggle(a)}).on("mouseover",function(a){of.focus(a),"function"==typeof Pg&&Pg(a)}).on("mouseout",function(a){of.revert(),"function"==typeof Qg&&Qg(a)}),l.append("text").text(function(a){return d(ng[a])?ng[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",Di?g:-200).attr("y",Di?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Di?h:-200).attr("y",Di?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return ti(a)}).attr("x",Di?g:-200).attr("y",Di?-200:i).attr("width",10).attr("height",10),Ti.selectAll("text").data(a).text(function(a){return d(ng[a])?ng[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ti.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ti.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),We(),q&&m(p)}function jf(a){return zc(of.data.targets,a.id)}function kf(a){return"data"in a&&zc(of.data.targets,a.data.id)}function lf(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 mf(a,b,c){var d=!Yd(of.data.targets);Sd(a,b),Xe(c?c:{withTransitionForAxis:d})}var nf=a.d3?a.d3:a.require?a.require("d3"):void 0,of={data:{},axis:{},legend:{}},pf={},qf=h(["bindto"],"#chart"),rf=h(["size","width"]),sf=h(["size","height"]),tf=h(["padding","left"]),uf=h(["padding","right"]),vf=h(["zoom","enabled"],!1),wf=h(["zoom","extent"]),xf=h(["zoom","privileged"],!1),yf=h(["onenter"],function(){}),zf=h(["onleave"],function(){}),Af=h(["onresize"],function(){}),Bf=h(["onresized"],function(){}),Cf=h(["transition","duration"],350);g("data","data is required in config");var Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg=h(["data","x"]),kg=h(["data","xs"],{}),lg=h(["data","x_format"]),mg=h(["data","id_converter"],function(a){return a}),ng=h(["data","names"],{}),og=h(["data","classes"],{}),pg=h(["data","groups"],[]),qg=h(["data","axes"],{}),rg=h(["data","type"]),sg=h(["data","types"],{}),tg=h(["data","labels"],{}),ug=h(["data","order"]),vg=h(["data","regions"],{}),wg=h(["data","color"]),xg=h(["data","colors"],{}),yg=h(["data","selection","enabled"],!1),zg=h(["data","selection","grouped"],!1),Ag=h(["data","selection","isselectable"],function(){return!0}),Bg=h(["data","selection","multiple"],!0),Cg=h(["data","onclick"],function(){}),Dg=h(["data","onenter"],function(){}),Eg=h(["data","onleave"],function(){}),Fg=h(["data","onselected"],function(){}),Gg=h(["data","onunselected"],function(){}),Hg=h(["data","ondragstart"],function(){}),Ig=h(["data","ondragend"],function(){}),Jg=h(["subchart","show"],!1),Kg=Jg?h(["subchart","size","height"],60):0,Lg=h(["color","pattern"],[]),Mg=h(["legend","show"],!0),Ng=h(["legend","position"],"bottom"),Og=h(["legend","item","onclick"]),Pg=h(["legend","item","onmouseover"]),Qg=h(["legend","item","onmouseout"]),Rg=h(["legend","equally"],!1),Sg=h(["axis","rotated"],!1),Tg=h(["axis","x","type"],"indexed"),Ug=h(["axis","x","localtime"],!1),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"],10),$g=h(["axis","x","tick","count"]),_g=h(["axis","x","tick","fit"],!1),ah=h(["axis","x","tick","values"],null),bh=h(["axis","x","max"]),ch=h(["axis","x","min"]),dh=h(["axis","x","default"]),eh=h(["axis","x","label"],{}),fh=h(["axis","y","show"],!0),gh=h(["axis","y","max"]),hh=h(["axis","y","min"]),ih=h(["axis","y","center"]),jh=h(["axis","y","label"],{}),kh=h(["axis","y","inner"],!1),lh=h(["axis","y","tick","format"]),mh=h(["axis","y","padding"],{}),nh=h(["axis","y","ticks"],10),oh=h(["axis","y2","show"],!1),ph=h(["axis","y2","max"]),qh=h(["axis","y2","min"]),rh=h(["axis","y2","center"]),sh=h(["axis","y2","label"],{}),th=h(["axis","y2","inner"],!1),uh=h(["axis","y2","tick","format"]),vh=h(["axis","y2","padding"],{}),wh=h(["axis","y2","ticks"],10),xh=h(["grid","x","show"],!1),yh=h(["grid","x","type"],"tick"),zh=h(["grid","x","lines"],[]),Ah=h(["grid","y","show"],!1),Bh=h(["grid","y","lines"],[]),Ch=h(["grid","y","ticks"],10),Dh=h(["point","show"],!0),Eh=Dh?h(["point","r"],2.5):0,Fh=h(["point","focus","line","enabled"],!0),Gh=h(["point","focus","expand","enabled"],!0),Hh=h(["point","focus","expand","r"],Gh?4:Eh),Ih=h(["point","focus","select","r"],8),Jh=h(["line","connect_null"],!1),Kh=h(["bar","width"]),Lh=h(["bar","width","ratio"],.6),Mh=h(["pie","label","show"],!0),Nh=h(["pie","label","format"]),Oh=h(["pie","expand"],!0),Ph=h(["pie","onclick"],function(){}),Qh=h(["pie","onmouseover"],function(){}),Rh=h(["pie","onmouseout"],function(){}),Sh=h(["donut","label","show"],!0),Th=h(["donut","label","format"]),Uh=h(["donut","expand"],!0),Vh=h(["donut","title"],""),Wh=h(["donut","onclick"],function(){}),Xh=h(["donut","onmouseover"],function(){}),Yh=h(["donut","onmouseout"],function(){}),Zh=h(["regions"],[]),$h=h(["tooltip","show"],!0),_h=h(["tooltip","format","title"]),ai=h(["tooltip","format","value"]),bi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=_h?_h:b,l=ai?ai: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+""}),ci=h(["tooltip","init","show"],!1),di=h(["tooltip","init","x"],0),ei=h(["tooltip","init","position"],{top:"0px",left:"50px"}),fi=("string"==typeof qf?qf.replace("#",""):qf.id)+"-clip",gi=fi+"-xaxis",hi=fi+"-yaxis",ii=i(fi),ji=i(gi),ki=i(hi),li="timeseries"===Tg,mi="categorized"===Tg,ni=!li&&(jg||oe(kg)),oi=null,pi=!1,qi=!1,ri=!1,si=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ti=ie(xg,oe(Lg)?Lg:si,wg),ui=Ug?nf.time.format:nf.time.format.utc,vi=function(){var a=[[ui("%Y/%-m/%-d"),function(){return!0}],[ui("%-m/%-d"),function(a){return a.getMonth()}],[ui("%-m/%-d"),function(a){return 1!==a.getDate()}],[ui("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[ui("%I %p"),function(a){return a.getHours()}],[ui("%I:%M"),function(a){return a.getMinutes()}],[ui(":%S"),function(a){return a.getSeconds()}],[ui(".%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)}}(),wi=[],xi=[],yi=Sg?"left":"bottom",zi=Sg?kh?"top":"bottom":kh?"right":"left",Ai=Sg?th?"bottom":"top":th?"left":"right",Bi=Sg?"left":"bottom",Ci={main:function(){return"translate("+Df.left+","+Df.top+")"},context:function(){return"translate("+Ef.left+","+Ef.top+")"},legend:function(){return"translate("+Ff.left+","+Ff.top+")"},x:function(){return"translate(0,"+(Sg?0:If)+")"},y:function(){return"translate(0,"+(Sg?If:0)+")"},y2:function(){return"translate("+(Sg?0:Gf)+","+(Sg?1:0)+")"},subx:function(){return"translate(0,"+(Sg?0:Jf)+")"},arc:function(){return"translate("+Gf/2+","+If/2+")"}},Di="right"===Ng,Ei=0,Fi=0,Gi=0,Hi=30,Ii=30,Ji=5;Sf=nf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Ki,Li=function(){var a=nf.svg.line().x(Sg?function(a){return V(a.id)(a.value)}:ud).y(Sg?ud:function(a){return V(a.id)(a.value)});return Jh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Jh?ye(b.values):b.values;return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),vg[b.id]?Ke(e,_f,V(b.id),vg[b.id]):a(e)):(c=e[0]?_f(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Sg?"M "+d+" "+c:"M "+c+" "+d)}}(),Mi=function(){var a;return a=Sg?nf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):nf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=ye(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?_f(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Sg?"M "+d+" "+c:"M "+c+" "+d)}}(),Ni=function(){var a=nf.svg.line().x(Sg?function(a){return W(a.id)(a.value)}:xd).y(Sg?xd:function(a){return W(a.id)(a.value)});return function(b){var c=ye(b.values);return Zd(b)?a(c):"M "+cg(c[0].x)+" "+W(b.id)(c[0].value)}}(),Oi=function(){};Ki=nf.svg.brush().on("brush",Te),Ki.update=function(){return Si&&Si.select("."+f.brush).call(this),this},Ki.scale=function(a){return Sg?this.y(a):this.x(a)},vf&&(Oi=nf.behavior.zoom().on("zoomstart",function(){Oi.altDomain=nf.event.sourceEvent.altKey?_f.orgDomain():null}).on("zoom",vf?Ue:null),Oi.scale=function(a){return Sg?this.y(a):this.x(a)},Oi.orgScaleExtent=function(){var a=wf?wf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Oi.updateScaleExtent=function(){var a=$b(_f.orgDomain())/$b(Wi),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Pi,Qi,Ri,Si,Ti,Ui,Vi,Wi,Xi,Yi={};if(of.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Pi.selectAll(hd(a)),d=c.filter(jf),e=c.filter(kf);of.revert(),of.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(of.data.targets)&&Kb(a,!0),cf(a)},of.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Pi.selectAll(hd(a)),d=c.filter(jf),e=c.filter(kf);of.revert(),b(d.classed(f.focused,!1)),b(e),Yd(of.data.targets)&&Lb(a),df(a)},of.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Pi.selectAll(hd(a)),d=c.filter(jf),e=c.filter(kf);b(d.classed(f.focused,!1)),b(e),Yd(of.data.targets)&&Lb(a),ef()},of.show=function(a,b){a=yc(a),b=b||{},Hc(a),Pi.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ff(a):Ti.selectAll(kd(a)).classed(f.legendItemHidden,!1),Se({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},of.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Pi.selectAll(id(a)).transition().style("opacity",0),b.withLegend?gf(a):Ti.selectAll(kd(a)).classed(f.legendItemHidden,!0),Se({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},of.toggle=function(a){Bc(a)?of.hide(a):of.show(a)},of.unzoom=function(){Ki.clear().update(),Se({withUpdateXDomain:!0})},of.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){og[b]=a.classes[b]}),"categories"in a&&mi&&(Vg=a.categories,fg.categories(Vg)),"cacheIds"in a&&_b(a.cacheIds)?void Ze(bc(a.cacheIds),a.done):void("unload"in a?_e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){$e(a)}):$e(a))},of.unload=function(a){_e(yc(a),function(){Se({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},of.selected=function(a){return nf.merge(Ri.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return nf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},of.select=function(a,b,c){yg&&Ri.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=nf.select(this),i="circle"===this.nodeName?se:ve,j="circle"===this.nodeName?te:we,k=zg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Ag(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},of.unselect=function(a,b){yg&&Ri.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=nf.select(this),g="circle"===this.nodeName?te:we,h=zg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Ag(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},of.toLine=function(a){mf(a,"line")},of.toSpline=function(a){mf(a,"spline")},of.toBar=function(a){mf(a,"bar")},of.toScatter=function(a){mf(a,"scatter")},of.toArea=function(a){mf(a,"area")},of.toAreaSpline=function(a){mf(a,"area-spline")},of.toPie=function(a){mf(a,"pie",{withTransform:!0})},of.toDonut=function(a){mf(a,"donut",{withTransform:!0})},of.groups=function(a){return c(a)?pg:(pg=a,Se(),pg)},of.xgrids=function(a){return a?(zh=a,Se(),zh):zh},of.xgrids.add=function(a){return a?of.xgrids(zh.concat(a)):void 0},of.xgrids.remove=function(a){var b=lf(a);return of.xgrids(zh.filter(b))},of.ygrids=function(a){return a?(Bh=a,Se(),Bh):Bh},of.ygrids.add=function(a){return a?of.ygrids(Bh.concat(a)):void 0},of.ygrids.remove=function(a){var b=lf(a);return of.ygrids(Bh.filter(b))},of.regions=function(a){return c(a)?Zh:(Zh=a,Se(),Zh)},of.regions.add=function(a){return c(a)?Zh:(Zh=Zh.concat(a),Se(),Zh)},of.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;Pi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Zh=Zh.filter(function(b){return b.classes.indexOf(a)<0})}),Zh},of.data.get=function(a){var b=of.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},of.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},of.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){ng[b]=a[b]}),hf(xc(of.data.targets),{withTransition:!0}),ng):ng},of.x=function(a){return arguments.length&&(mc(of.data.targets,a),Se({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),of.data.xs},of.xs=function(a){return arguments.length&&(nc(of.data.targets,a),Se({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),of.data.xs},of.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},of.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(gh=+a.y),b(a.y2)&&(ph=+a.y2)):gh=ph=+a,Se())},of.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(hh=+a.y),b(a.y2)&&(qh=+a.y2)):hh=qh=+a,Se())},of.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&of.axis.max(a.max),"undefined"!=typeof a.min&&of.axis.min(a.min))},of.legend.show=function(a){Mg||(Mg=!0,Ti.style("visibility","visible")),ff(yc(a)),Se({withTransitionForHorizontalAxis:!1})},of.legend.hide=function(a){Mg&&ne(a)&&(Mg=!1,Ti.style("visibility","hidden")),gf(yc(a)),Se({withTransitionForHorizontalAxis:!1})},of.resize=function(a){rf=a?a.width:null,sf=a?a.height:null,Xe({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},of.destroy=function(){of.data.targets=void 0,of.data.xs={},Vi.html(""),a.onresize=null},"url"in e.data)nf.xhr(e.data.url,function(a,b){var c,d=nf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=nf.csv.parse(b.response),Le(c)});else if("rows"in e.data)Le(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Le(qc(e.data.columns))}return of},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From ea25970439a9099af9f41c3caf1692461182bfac Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Thu, 17 Apr 2014 14:24:32 +0900 Subject: [PATCH 046/178] Modify default of axis.x.localtime to true - #161 --- c3.js | 2 +- c3.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/c3.js b/c3.js index d08c368..6d15073 100644 --- a/c3.js +++ b/c3.js @@ -167,7 +167,7 @@ // axis var __axis_rotated = getConfig(['axis', 'rotated'], false), __axis_x_type = getConfig(['axis', 'x', 'type'], 'indexed'), - __axis_x_localtime = getConfig(['axis', 'x', 'localtime'], false), + __axis_x_localtime = getConfig(['axis', 'x', 'localtime'], true), __axis_x_categories = getConfig(['axis', 'x', 'categories'], []), __axis_x_tick_centered = getConfig(['axis', 'x', 'tick', 'centered'], false), __axis_x_tick_format = getConfig(['axis', 'x', 'tick', 'format']), diff --git a/c3.min.js b/c3.min.js index 3ee867b..f0dfe8d 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ !function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.31"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cGf&&(Gf=0),0>If&&(If=0),Ef={top:Sg?Df.top:Lf-Kg-(Di?0:a),right:0/0,bottom:20+(Di?0:a),left:Sg?Hi:Df.left},Hf=Sg?Df.left-Hi-Ii:Gf,Jf=Sg?If:Lf-Ef.top-Ef.bottom,0>Hf&&(Hf=0),0>Jf&&(Jf=0),Ff={top:Di?0:Lf-a,right:0/0,bottom:0,left:Di?Kf-b:0},p(),Di&&Yd(of.data.targets)&&(Ff.left=Gf/2+Nf)}function o(){Ri.select("line."+f.xgridFocus).attr("x1",Sg?0:-10).attr("x2",Sg?Gf:-10).attr("y1",Sg?-10:Df.top).attr("y2",Sg?-10:If)}function p(){Nf=If/2,Mf=.95*Nf,Of=Xd(of.data.targets)?.6*Mf:0}function q(){var a=Sg?f.axisX:f.axisY,b=nf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=nf.select(qf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return rf?rf:x()}function s(){var a=sf?sf:y();return a>0?a:320}function t(){return Yd(of.data.targets)?0:tf?tf:Sg||!fh||kh?1:v("y")}function u(){var a=1;return Yd(of.data.targets)?0:uf?uf:Di?P()+(oh&&!Sg?v("y2"):a):oh?th||Sg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||fh?"y2"!==a||oh?(gb(a).isInner?30:40)+("y2"===a?-10:0):Ji:Mg&&!Di?10:1}function x(){return+nf.select(qf).style("width").replace("px","")}function y(){return+nf.select(qf).style("height").replace("px","")}function z(a){return a?-5:-(Df.left-1)}function A(a){return a?-20:-1}function B(){return z(!Sg)}function C(){return A(!Sg)}function D(){return z(Sg)}function E(){return A(Sg)}function F(a){return a?Gf+2+4:Df.left+20}function G(a){return a?80:If+2}function H(){return F(!Sg)}function I(){return G(!Sg)}function J(){return F(Sg)}function K(){return G(Sg)}function L(){var a=Sg?If:Gf,b=vc(),c=Vb()*(Ud(of.data.targets)?(b-(mi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){Ei=a}function N(a){Fi=a}function O(a){Gi=a}function P(){return Mg?Di?Fi*(Ei+1):Kf:0}function Q(){return Mg?Di?Lf:Gi*(Ei+1):0}function R(){var a,b=!_f;Tf=Sg?1:0,Uf=Sg?If:Gf,Vf=Sg?0:If,Wf=Sg?Gf:1,Xf=Tf,Yf=Uf,Zf=Sg?0:Jf,$f=Sg?Hf:1,_f=T(Tf,Uf,b?void 0:_f.domain(),function(){return fg.tickOffset()}),ag=U(Vf,Wf),bg=U(Vf,Wf),cg=T(Tf,Uf,Wi,function(a){return a%1?0:ig.tickOffset()}),dg=U(Zf,$f),eg=U(Zf,$f),a=$(),fg=X(_f,yi,a),ig=X(cg,Bi,a),gg=Y(ag,zi,lh,nh),hg=Y(bg,Ai,uh,wh),b||(Ki.scale(cg),vf&&Oi.scale(_f)),S()}function S(){Pf=Db(),Qf=Eb(),Rf=Eb(.98)}function T(a,b,e,f){var g=(li?nf.time.scale():nf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),mi){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return nf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?bg:ag}function W(a){return"y2"===Z(a)?eg:dg}function X(a,b,c){var d=(mi?Bb():nf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),mi?(d.tickCentered(Wg),ne(Yg)&&(Yg=!1)):d.tickOffset=function(){var a=Sg?If:Gf;return a*Vb()/vc()/2},mi&&d.categories(Vg),d}function Y(a,b,c,d){return nf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in qg?qg[a]:"y"}function $(){var a=li?vi:mi?Oc:function(a){return 0>a?a.toFixed(0):a};return Xg&&("function"==typeof Xg?a=Xg:li&&(a=function(a){return a?ui(Xg)(a):""})),a}function _(a){var b;return"y"===a?b=jh:"y2"===a?b=sh:"x"===a&&(b=eh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?jh=b:"y2"===a?sh=b:"x"===a&&(eh=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Sg?"inner-top":"inner-right")}function eb(){return cb("y",Sg?"inner-right":"inner-top")}function fb(){return cb("y2",Sg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?Gf/2:Gf:b.isBottom?-If:b.isMiddle?-If/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Sg,db())}function ob(){return kb(Sg,eb())}function pb(){return kb(Sg,fb())}function qb(){return lb(!Sg,db())}function rb(){return lb(Sg,eb())}function sb(){return lb(Sg,fb())}function tb(){var a=db();return Sg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Sg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Sg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Sg,db())}function xb(){return mb(Sg,eb())}function yb(){return mb(Sg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return nf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Ri.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Ri.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Ri.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+o)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Mc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return nf.min(Object.keys(i).map(function(a){return nf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(pg.length>0)for(g=Nc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return nf.max(Object.keys(i).map(function(a){return nf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?qh:hh,n="y2"===c?ph:gh,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?rh:ih,r=pd()&&Sg;return 0===l.length?"y2"===c?bg.domain():ag.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=qd(o,p),j=$b(ag.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&mh&&(f=b(mh.top)?mh.top:e,g=b(mh.bottom)?mh.bottom:e),"y2"===c&&vh&&(f=b(vh.top)?vh.top:e,g=b(vh.bottom)?vh.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Wi),c=$b(_f.domain());return a||0===c?1:b/c}function Wb(a){return ch?ch:nf.min(a,function(a){return nf.min(a.values,function(a){return a.x})})}function Xb(a){return bh?bh:nf.max(a,function(a){return nf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return mi?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=0,g=0;return(c||0===c)&&(f=li?new Date(c.getTime()-e):c-e),(d||0===d)&&(g=li?new Date(d.getTime()+e):d+e),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return jg&&a===jg||oe(kg)&&pe(kg,a)}function fc(a){return!ec(a)}function gc(a){return jg?jg:oe(kg)?kg[a]:null}function hc(a,b){var c,d=b&&oe(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=of.data.xs[b])}),c}function ic(a,b){return a in of.data.xs&&of.data.xs[a]&&of.data.xs[a][b]?of.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){kg[b]=a[b]})}function kc(a){return 1===nf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=ng[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),of.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=li?a?a instanceof Date?a:je(a):je(ic(b,c)):ni&&!mi?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?of.data.xs[c]=a.map(function(a){return a[f]}).filter(b):jg?(d=Object.keys(of.data.xs),of.data.xs[c]=d.length>0?of.data.xs[d[0]]:void 0):oe(kg)&&(of.data.xs[c]=hc(f,of.data.targets)):of.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!of.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=mg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return ni&&mi&&0===c&&g&&(0===e&&(Vg=[]),Vg.push(g)),("undefined"==typeof a[b]||of.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),rg&&Sd(xc(c).filter(function(a){return!(a in sg)}),rg),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function tc(a){return a>0&&of.data.targets[0].values[a-1]?of.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?of.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?of.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(of.data.targets)}function zc(a,b){var c,d=xc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(li?new Date(h):h);i.push(d)}return li||(i=i.sort(function(a,b){return a-b})),i}function Gc(a){wi=wi.concat(a)}function Hc(a){wi=wi.filter(function(b){return a.indexOf(b)<0})}function Ic(a){xi=xi.concat(a)}function Jc(a){xi=xi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=qe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return nf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Ed(){return ug&&"desc"===ug.toLowerCase()}function Fd(){return ug&&"asc"===ug.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof ug&&a.sort(ug),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(of.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});$h&&0!==m.length&&(Ui.html(bi(a,$(),l,ti)).style("display","block"),d=Ui.property("offsetWidth"),e=Ui.property("offsetHeight"),k?(g=Gf/2+c[0],i=If/2+c[1]+20):(Sg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=_f(m[0].x)+20):(f=q(),g=f+t()+_f(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Ui.style("top",i+"px").style("left",g+"px"))}function Id(){Ui.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});$h&&(Vd(of.data.targets)||Yd(of.data.targets)||Ri.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Sg?"y1":"x1",ud).attr(Sg?"y2":"x2",ud))}function Kd(){Ri.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?_f(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Kh?Kh:b?2*a.tickOffset()*Lh/b:0}function Sd(a,b){yc(a).forEach(function(a){Yi[a]=b===sg[a],sg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){sg[a.id]===b&&(c=!0),a.id in sg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in sg)||"line"===sg[b]||"spline"===sg[b]||"area"===sg[b]||"area-spline"===sg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===sg[b]||"area-spline"===sg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===sg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===sg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===sg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===sg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(a){return ce(a)&&Uh||be(a)&&Oh}function ie(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function je(b){var c;try{c=lg?nf.time.format(lg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+lg)}return c}function ke(a,b){var c=nf.mouse(a),d=nf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function pe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function qe(a,b){var c="y"===Z(a.id)?ag:bg,d=Sg?1:0,e=Sg?0:1;return Math.pow(_f(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function re(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function se(a,b,c){Fg(b,a.node()),Ri.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Sg?Md:Ld).attr("cy",Sg?Ld:Md).attr("stroke",function(){return ti(b)}).attr("r",1.4*Ih).transition().duration(100).attr("r",Ih)}function te(a,b,c){Gg(b,a.node()),Ri.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ue(a,b,c,d){a?se(b,c,d):te(b,c,d)}function ve(a,b){Fg(b,a.node()),a.transition().duration(100).style("fill",function(){return nf.rgb(ti(b)).darker(1)})}function we(a,b){Gg(b,a.node()),a.transition().duration(100).style("fill",function(){return ti(b)})}function xe(a,b,c,d){a?ve(b,c,d):we(b,c,d)}function ye(a){return a.filter(function(a){return b(a.value)})}function ze(a,c){return(c?Ri.selectAll("."+f.circles+gd(c)):Ri).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ae(a,b){ze(a,b).classed(f.EXPANDED,!0).attr("r",Hh)}function Be(a){ze(a).filter(function(){return nf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Eh)}function Ce(a){return Ri.selectAll("."+f.bar+(b(a)?"-"+a:""))}function De(a){Ce(a).classed(f.EXPANDED,!0)}function Ee(a){Ce(a).classed(f.EXPANDED,!1)}function Fe(a,b){var c=Je(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 Ge(a,b){var c=Je(a,!1),d=b?He:Ie;return function(a,b){return d(c(a,b),a,this)}}function He(a,b){var c;return Sg?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ie(a,b,c){var d=c.getBoundingClientRect();return Sg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Je(a,b){var c=a.__max__+1,d=Rd(fg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return 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 Ke(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 Le(b){var c,d,e;if(Vi=nf.select(qf),Vi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Vi.html(""),Vi.classed("c3",!0),of.data.xs={},of.data.targets=rc(b),n(),R(),_f.domain(nf.extent(Zb(of.data.targets))),ag.domain(Ub(of.data.targets,"y")),bg.domain(Ub(of.data.targets,"y2")),cg.domain(_f.domain()),dg.domain(ag.domain()),eg.domain(bg.domain()),Wi=_f.domain(),Ki.scale(cg),vf&&Oi.scale(_f),Pi=Vi.append("svg").attr("width",Gf+Df.left+Df.right).attr("height",If+Df.top+Df.bottom).on("mouseenter",yf).on("mouseleave",zf),Qi=Pi.append("defs"),Qi.append("clipPath").attr("id",fi).append("rect").attr("width",Gf).attr("height",If),Qi.append("clipPath").attr("id",gi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Qi.append("clipPath").attr("id",hi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Ri=Pi.append("g").attr("transform",Ci.main),Si=Jg?Pi.append("g").attr("transform",Ci.context):null,Ti=Pi.append("g").attr("transform",Ci.legend),Mg||(Ti.style("visibility","hidden"),xi=xc(of.data.targets)),Ui=nf.select(qf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),hf(xc(of.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Ri.append("g").attr("class",f.axisX).attr("clip-path",Sg?"":ji).attr("transform",Ci.x).append("text").attr("class",f.axisXLabel).attr("transform",Sg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),fh&&Ri.append("g").attr("class",f.axisY).attr("clip-path",Sg?ki:"").attr("transform",Ci.y).append("text").attr("class",f.axisYLabel).attr("transform",Sg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),oh&&Ri.append("g").attr("class",f.axisY2).attr("transform",Ci.y2).append("text").attr("class",f.axisY2Label).attr("transform",Sg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Ri.append("g").attr("clip-path",ii).attr("class",f.grid),xh&&d.append("g").attr("class",f.xgrids),oe(zh)&&d.append("g").attr("class",f.xgridLines),Fh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Ah&&d.append("g").attr("class",f.ygrids),oe(Bh)&&d.append("g").attr("class",f.ygridLines),Ri.append("g").attr("clip-path",ii).attr("class",f.regions),Ri.append("g").attr("clip-path",ii).attr("class",f.chart),c=Ri.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",vf?Sg?"ns-resize":"ew-resize":null),Ri.select("."+f.chart).append("g").attr("class",f.chartBars),Ri.select("."+f.chart).append("g").attr("class",f.chartLines),Ri.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Ci.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Ri.select("."+f.chart).append("g").attr("class",f.chartTexts),vf&&Ri.insert("rect",xf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Gf).attr("height",If).style("opacity",0).style("cursor",Sg?"ns-resize":"ew-resize").call(Oi).on("dblclick.zoom",null),dh&&Ki.extent("function"!=typeof dh?dh:dh(Zb())),Jg&&(Si.append("g").attr("clip-path",ii).attr("class",f.chart),Si.select("."+f.chart).append("g").attr("class",f.chartBars),Si.select("."+f.chart).append("g").attr("class",f.chartLines),Si.append("g").attr("clip-path",ii).attr("class",f.brush).call(Ki).selectAll("rect").attr(Sg?"width":"height",Sg?Hf:Jf),Si.append("g").attr("class",f.axisX).attr("transform",Ci.subx).attr("clip-path",Sg?"":ji)),Ye(of.data.targets),Sg?Ri.select("."+f.axisX).style("opacity",0).call(fg):(Ri.select("."+f.axisY).style("opacity",0).call(gg),Ri.select("."+f.axisY2).style("opacity",0).call(hg)),Se({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),ci){if(li&&"string"==typeof di){for(di=je(di),e=0;e0){d=[];for(var g in ng)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=xe,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 Qe(a){Yd(of.data.targets)||yg&&(oi=a,Ri.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),pi=!0,Hg())}function Re(){Yd(of.data.targets)||yg&&(Ri.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Ri.selectAll("."+f.shape).classed(f.INCLUDED,!1),pi=!1,Ig())}function Se(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Nd(),U=Yd(of.data.targets),V=Dc(of.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?Cf:0,O=B?N:0,P=C?N:0,H&&Mg&&hf(xc(of.data.targets),a),G&&(_f.domain(nf.extent(Zb(V))),Wi=_f.domain(),vf&&Oi.scale(_f).updateScaleExtent(),cg.domain(_f.domain()),Ki.scale(cg)),F&&(_f.domain(Ki.empty()?Wi:Ki.extent()),vf&&Oi.scale(_f).updateScaleExtent()),ag.domain(Ub(V,"y")),bg.domain(Ub(V,"y2")),Vd(V)||(Q=ah?ah:Fc(Ec(V)),fg.tickValues(Q),ig.tickValues(Q)),c=Ri.select("."+f.axisX).style("opacity",U?0:1),(Sg||D)&&(c=c.transition().duration(P)),c.call(fg),e=Ri.select("."+f.axisY).style("opacity",U?0:1),(!Sg||D)&&(e=e.transition().duration(P)),e.call(gg),Ri.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(hg),F)if(Yg&&Q){for(R=1;R=0&&nf.select(this).style("display",b%S?"none":"block")})}else nf.selectAll("."+f.axisX+" .tick text").style("display","block");if(I=Fe(T),K=Ge(T,!0),M=Ge(T,!1),Ab(),dg.domain(ag.domain()),eg.domain(bg.domain()),Ui.style("display","none"),o(),Ri.select("line."+f.xgridFocus).style("visibility","hidden"),xh){if("year"===yh){h=[];for(var W=Zb(),X=W[0].getFullYear(),Y=W[1].getFullYear(),Z=X;Y>=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=_f.ticks(10);g=Ri.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Sg?0:function(a){return _f(a)-fg.tickOffset()}).attr("x2",Sg?Gf:function(a){return _f(a)-fg.tickOffset()}).attr("y1",Sg?function(a){return _f(a)-fg.tickOffset()}:Df.top).attr("y2",Sg?function(a){return _f(a)-fg.tickOffset()}:If).style("opacity",function(){return+nf.select(this).attr(Sg?"y1":"x1")===(Sg?If:0)?0:1}),g.exit().remove()}oe(zh)&&(i=Ri.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(zh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Sg?"":"rotate(-90)").attr("dx",Sg?0:-Df.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Sg?0:vd).attr("x2",Sg?Gf:vd).attr("y1",Sg?vd:Df.top).attr("y2",Sg?vd:If).style("opacity",1),i.select("text").transition().duration(N).attr("x",Sg?Gf:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&Ah&&(k=Ri.select("."+f.ygrids).selectAll("."+f.ygrid).data(ag.ticks(Ch)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Sg?ag:0).attr("x2",Sg?ag:Gf).attr("y1",Sg?0:ag).attr("y2",Sg?If:ag),k.exit().remove()),y&&oe(Bh)&&(l=Ri.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Bh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Sg?"rotate(-90)":"").attr("dx",Sg?0:-Df.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Sg?wd:0).attr("x2",Sg?wd:Gf).attr("y1",Sg?0:wd).attr("y2",Sg?If:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Sg?0:Gf).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Ri.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ti(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Ri.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Sg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Ri.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Li).style("opacity",1),Ri.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Mi).style("opacity",Xi),n=Ri.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",Eh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Sg?Md:Ld).attr("cy",Sg?Ld:Md),n.exit().remove(),Ri.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=nf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Ri.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Ri.select("."+f.chartArcsTitle).style("opacity",Xd(of.data.targets)?1:0),Jg&&(null!==nf.event&&"zoom"===nf.event.type&&Ki.extent(_f.orgDomain()).update(),z&&(Si.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(ig),Ki.empty()||Ki.extent(_f.orgDomain()).update(),J=Fe(T,!0),s=Si.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ti(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Si.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ni).style("opacity",1))),Ri.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Ri.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Sg?Md:Ld).attr("cy",Sg?Ld:Md),t=Ri.select("."+f.eventRects),oe(kg)&&!kc(kg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Ri.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ne(u.enter()),u.attr("x",0).attr("y",0).attr("width",Gf).attr("height",If)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),ni&&!mi?(x=function(a,b){var c=tc(b),d=uc(b),e=of.data.xs[a.id][b];return(_f(d?d:e+50)-_f(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=of.data.xs[a.id][b];return(_f(d)+_f(c?c:d-50))/2}):(x=L(),w=function(a){return _f(a.x)-x/2}),v=wc(),Ri.select("."+f.eventRects).datum(v?v.values:[]),u=Ri.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Me(u.enter()),u.attr("class",ad).attr("x",Sg?0:w).attr("y",Sg?w:0).attr("width",Sg?Gf:x).attr("height",Sg?x:If),u.exit().remove()),q=Ri.select("."+f.regions).selectAll("rect."+f.region).data(Zh),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Sg?0:cc).attr("y",Sg?cc:Df.top).attr("width",Sg?Gf:dc).attr("height",Sg?dc:If).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),xc(of.data.targets).forEach(function(a){Yi[a]=!0})}}function Te(){Se({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ue(){return"mousemove"===nf.event.sourceEvent.type&&Oi.altDomain?(_f.domain(Oi.altDomain),void Oi.scale(_f).updateScaleExtent()):(mi&&_f.orgDomain()[0]===Wi[0]&&_f.domain([Wi[0]-1e-10,_f.orgDomain()[1]]),Se({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===nf.event.sourceEvent.type&&(qi=!0)))}function Ve(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function We(){Pi.attr("width",Kf).attr("height",Lf),Pi.select("#"+fi).select("rect").attr("width",Gf).attr("height",If),Pi.select("#"+gi).select("rect").attr("width",H),Pi.select("#"+hi).select("rect").attr("width",J),Pi.select("."+f.zoomRect).attr("width",Gf).attr("height",If)}function Xe(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),We(),m(a.withTransition),Se(a)}function Ye(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Ri.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ti(a)}),e=Ri.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ti(a)}).style("stroke","none").style("cursor",function(a){return Ag(a)?"pointer":null}),c=Ri.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ti(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Xi=+nf.select(this).style("opacity"),0}).style("fill",function(a){return ti(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ti(a)}).style("cursor",function(a){return Ag(a)?"pointer":null}),a.forEach(function(a){Ri.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Ri.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Sf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ti(a.data)}).style("cursor",function(a){return Ag(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),cf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,nf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),ef(),Id(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Jg&&(n=Si.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ti(a)}),l=Si.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ti(a)})),Pi.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ze(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),of.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Di?j:i,l=Di?Q():P();return d&&(w=0,C=0,t=0,u=0),Mg&&!Cc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Di?u:t,void(Rg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,Di?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Ti.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Og?Og(a):of.toggle(a)}).on("mouseover",function(a){of.focus(a),"function"==typeof Pg&&Pg(a)}).on("mouseout",function(a){of.revert(),"function"==typeof Qg&&Qg(a)}),l.append("text").text(function(a){return d(ng[a])?ng[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",Di?g:-200).attr("y",Di?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Di?h:-200).attr("y",Di?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return ti(a)}).attr("x",Di?g:-200).attr("y",Di?-200:i).attr("width",10).attr("height",10),Ti.selectAll("text").data(a).text(function(a){return d(ng[a])?ng[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ti.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ti.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),We(),q&&m(p)}function jf(a){return zc(of.data.targets,a.id)}function kf(a){return"data"in a&&zc(of.data.targets,a.data.id)}function lf(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 mf(a,b,c){var d=!Yd(of.data.targets);Sd(a,b),Xe(c?c:{withTransitionForAxis:d})}var nf=a.d3?a.d3:a.require?a.require("d3"):void 0,of={data:{},axis:{},legend:{}},pf={},qf=h(["bindto"],"#chart"),rf=h(["size","width"]),sf=h(["size","height"]),tf=h(["padding","left"]),uf=h(["padding","right"]),vf=h(["zoom","enabled"],!1),wf=h(["zoom","extent"]),xf=h(["zoom","privileged"],!1),yf=h(["onenter"],function(){}),zf=h(["onleave"],function(){}),Af=h(["onresize"],function(){}),Bf=h(["onresized"],function(){}),Cf=h(["transition","duration"],350);g("data","data is required in config");var Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg=h(["data","x"]),kg=h(["data","xs"],{}),lg=h(["data","x_format"]),mg=h(["data","id_converter"],function(a){return a}),ng=h(["data","names"],{}),og=h(["data","classes"],{}),pg=h(["data","groups"],[]),qg=h(["data","axes"],{}),rg=h(["data","type"]),sg=h(["data","types"],{}),tg=h(["data","labels"],{}),ug=h(["data","order"]),vg=h(["data","regions"],{}),wg=h(["data","color"]),xg=h(["data","colors"],{}),yg=h(["data","selection","enabled"],!1),zg=h(["data","selection","grouped"],!1),Ag=h(["data","selection","isselectable"],function(){return!0}),Bg=h(["data","selection","multiple"],!0),Cg=h(["data","onclick"],function(){}),Dg=h(["data","onenter"],function(){}),Eg=h(["data","onleave"],function(){}),Fg=h(["data","onselected"],function(){}),Gg=h(["data","onunselected"],function(){}),Hg=h(["data","ondragstart"],function(){}),Ig=h(["data","ondragend"],function(){}),Jg=h(["subchart","show"],!1),Kg=Jg?h(["subchart","size","height"],60):0,Lg=h(["color","pattern"],[]),Mg=h(["legend","show"],!0),Ng=h(["legend","position"],"bottom"),Og=h(["legend","item","onclick"]),Pg=h(["legend","item","onmouseover"]),Qg=h(["legend","item","onmouseout"]),Rg=h(["legend","equally"],!1),Sg=h(["axis","rotated"],!1),Tg=h(["axis","x","type"],"indexed"),Ug=h(["axis","x","localtime"],!1),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"],10),$g=h(["axis","x","tick","count"]),_g=h(["axis","x","tick","fit"],!1),ah=h(["axis","x","tick","values"],null),bh=h(["axis","x","max"]),ch=h(["axis","x","min"]),dh=h(["axis","x","default"]),eh=h(["axis","x","label"],{}),fh=h(["axis","y","show"],!0),gh=h(["axis","y","max"]),hh=h(["axis","y","min"]),ih=h(["axis","y","center"]),jh=h(["axis","y","label"],{}),kh=h(["axis","y","inner"],!1),lh=h(["axis","y","tick","format"]),mh=h(["axis","y","padding"],{}),nh=h(["axis","y","ticks"],10),oh=h(["axis","y2","show"],!1),ph=h(["axis","y2","max"]),qh=h(["axis","y2","min"]),rh=h(["axis","y2","center"]),sh=h(["axis","y2","label"],{}),th=h(["axis","y2","inner"],!1),uh=h(["axis","y2","tick","format"]),vh=h(["axis","y2","padding"],{}),wh=h(["axis","y2","ticks"],10),xh=h(["grid","x","show"],!1),yh=h(["grid","x","type"],"tick"),zh=h(["grid","x","lines"],[]),Ah=h(["grid","y","show"],!1),Bh=h(["grid","y","lines"],[]),Ch=h(["grid","y","ticks"],10),Dh=h(["point","show"],!0),Eh=Dh?h(["point","r"],2.5):0,Fh=h(["point","focus","line","enabled"],!0),Gh=h(["point","focus","expand","enabled"],!0),Hh=h(["point","focus","expand","r"],Gh?4:Eh),Ih=h(["point","focus","select","r"],8),Jh=h(["line","connect_null"],!1),Kh=h(["bar","width"]),Lh=h(["bar","width","ratio"],.6),Mh=h(["pie","label","show"],!0),Nh=h(["pie","label","format"]),Oh=h(["pie","expand"],!0),Ph=h(["pie","onclick"],function(){}),Qh=h(["pie","onmouseover"],function(){}),Rh=h(["pie","onmouseout"],function(){}),Sh=h(["donut","label","show"],!0),Th=h(["donut","label","format"]),Uh=h(["donut","expand"],!0),Vh=h(["donut","title"],""),Wh=h(["donut","onclick"],function(){}),Xh=h(["donut","onmouseover"],function(){}),Yh=h(["donut","onmouseout"],function(){}),Zh=h(["regions"],[]),$h=h(["tooltip","show"],!0),_h=h(["tooltip","format","title"]),ai=h(["tooltip","format","value"]),bi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=_h?_h:b,l=ai?ai: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+""}),ci=h(["tooltip","init","show"],!1),di=h(["tooltip","init","x"],0),ei=h(["tooltip","init","position"],{top:"0px",left:"50px"}),fi=("string"==typeof qf?qf.replace("#",""):qf.id)+"-clip",gi=fi+"-xaxis",hi=fi+"-yaxis",ii=i(fi),ji=i(gi),ki=i(hi),li="timeseries"===Tg,mi="categorized"===Tg,ni=!li&&(jg||oe(kg)),oi=null,pi=!1,qi=!1,ri=!1,si=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ti=ie(xg,oe(Lg)?Lg:si,wg),ui=Ug?nf.time.format:nf.time.format.utc,vi=function(){var a=[[ui("%Y/%-m/%-d"),function(){return!0}],[ui("%-m/%-d"),function(a){return a.getMonth()}],[ui("%-m/%-d"),function(a){return 1!==a.getDate()}],[ui("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[ui("%I %p"),function(a){return a.getHours()}],[ui("%I:%M"),function(a){return a.getMinutes()}],[ui(":%S"),function(a){return a.getSeconds()}],[ui(".%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)}}(),wi=[],xi=[],yi=Sg?"left":"bottom",zi=Sg?kh?"top":"bottom":kh?"right":"left",Ai=Sg?th?"bottom":"top":th?"left":"right",Bi=Sg?"left":"bottom",Ci={main:function(){return"translate("+Df.left+","+Df.top+")"},context:function(){return"translate("+Ef.left+","+Ef.top+")"},legend:function(){return"translate("+Ff.left+","+Ff.top+")"},x:function(){return"translate(0,"+(Sg?0:If)+")"},y:function(){return"translate(0,"+(Sg?If:0)+")"},y2:function(){return"translate("+(Sg?0:Gf)+","+(Sg?1:0)+")"},subx:function(){return"translate(0,"+(Sg?0:Jf)+")"},arc:function(){return"translate("+Gf/2+","+If/2+")"}},Di="right"===Ng,Ei=0,Fi=0,Gi=0,Hi=30,Ii=30,Ji=5;Sf=nf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Ki,Li=function(){var a=nf.svg.line().x(Sg?function(a){return V(a.id)(a.value)}:ud).y(Sg?ud:function(a){return V(a.id)(a.value)});return Jh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Jh?ye(b.values):b.values;return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),vg[b.id]?Ke(e,_f,V(b.id),vg[b.id]):a(e)):(c=e[0]?_f(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Sg?"M "+d+" "+c:"M "+c+" "+d)}}(),Mi=function(){var a;return a=Sg?nf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):nf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=ye(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?_f(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Sg?"M "+d+" "+c:"M "+c+" "+d)}}(),Ni=function(){var a=nf.svg.line().x(Sg?function(a){return W(a.id)(a.value)}:xd).y(Sg?xd:function(a){return W(a.id)(a.value)});return function(b){var c=ye(b.values);return Zd(b)?a(c):"M "+cg(c[0].x)+" "+W(b.id)(c[0].value)}}(),Oi=function(){};Ki=nf.svg.brush().on("brush",Te),Ki.update=function(){return Si&&Si.select("."+f.brush).call(this),this},Ki.scale=function(a){return Sg?this.y(a):this.x(a)},vf&&(Oi=nf.behavior.zoom().on("zoomstart",function(){Oi.altDomain=nf.event.sourceEvent.altKey?_f.orgDomain():null}).on("zoom",vf?Ue:null),Oi.scale=function(a){return Sg?this.y(a):this.x(a)},Oi.orgScaleExtent=function(){var a=wf?wf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Oi.updateScaleExtent=function(){var a=$b(_f.orgDomain())/$b(Wi),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Pi,Qi,Ri,Si,Ti,Ui,Vi,Wi,Xi,Yi={};if(of.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Pi.selectAll(hd(a)),d=c.filter(jf),e=c.filter(kf);of.revert(),of.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(of.data.targets)&&Kb(a,!0),cf(a)},of.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Pi.selectAll(hd(a)),d=c.filter(jf),e=c.filter(kf);of.revert(),b(d.classed(f.focused,!1)),b(e),Yd(of.data.targets)&&Lb(a),df(a)},of.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Pi.selectAll(hd(a)),d=c.filter(jf),e=c.filter(kf);b(d.classed(f.focused,!1)),b(e),Yd(of.data.targets)&&Lb(a),ef()},of.show=function(a,b){a=yc(a),b=b||{},Hc(a),Pi.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ff(a):Ti.selectAll(kd(a)).classed(f.legendItemHidden,!1),Se({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},of.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Pi.selectAll(id(a)).transition().style("opacity",0),b.withLegend?gf(a):Ti.selectAll(kd(a)).classed(f.legendItemHidden,!0),Se({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},of.toggle=function(a){Bc(a)?of.hide(a):of.show(a)},of.unzoom=function(){Ki.clear().update(),Se({withUpdateXDomain:!0})},of.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){og[b]=a.classes[b]}),"categories"in a&&mi&&(Vg=a.categories,fg.categories(Vg)),"cacheIds"in a&&_b(a.cacheIds)?void Ze(bc(a.cacheIds),a.done):void("unload"in a?_e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){$e(a)}):$e(a))},of.unload=function(a){_e(yc(a),function(){Se({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},of.selected=function(a){return nf.merge(Ri.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return nf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},of.select=function(a,b,c){yg&&Ri.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=nf.select(this),i="circle"===this.nodeName?se:ve,j="circle"===this.nodeName?te:we,k=zg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Ag(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},of.unselect=function(a,b){yg&&Ri.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=nf.select(this),g="circle"===this.nodeName?te:we,h=zg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Ag(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},of.toLine=function(a){mf(a,"line")},of.toSpline=function(a){mf(a,"spline")},of.toBar=function(a){mf(a,"bar")},of.toScatter=function(a){mf(a,"scatter")},of.toArea=function(a){mf(a,"area")},of.toAreaSpline=function(a){mf(a,"area-spline")},of.toPie=function(a){mf(a,"pie",{withTransform:!0})},of.toDonut=function(a){mf(a,"donut",{withTransform:!0})},of.groups=function(a){return c(a)?pg:(pg=a,Se(),pg)},of.xgrids=function(a){return a?(zh=a,Se(),zh):zh},of.xgrids.add=function(a){return a?of.xgrids(zh.concat(a)):void 0},of.xgrids.remove=function(a){var b=lf(a);return of.xgrids(zh.filter(b))},of.ygrids=function(a){return a?(Bh=a,Se(),Bh):Bh},of.ygrids.add=function(a){return a?of.ygrids(Bh.concat(a)):void 0},of.ygrids.remove=function(a){var b=lf(a);return of.ygrids(Bh.filter(b))},of.regions=function(a){return c(a)?Zh:(Zh=a,Se(),Zh)},of.regions.add=function(a){return c(a)?Zh:(Zh=Zh.concat(a),Se(),Zh)},of.regions.remove=function(a,c){var e=[].concat(a); +}Ui.html(bi(of.data.targets.map(function(a){return lc(a.values[di])}),$(),rd,ti)),Ui.style("top",ei.top).style("left",ei.left).style("display","block")}null==a.onresize&&(a.onresize=Ve()),a.onresize.add&&(a.onresize.add(Af),a.onresize.add(function(){Xe({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})}),a.onresize.add(Bf))}function Me(a){a.append("rect").attr("class",ad).style("cursor",yg&&zg?"pointer":null).on("mouseover",function(a,b){if(!pi&&!Yd(of.data.targets)){var c,d,e=of.data.targets.map(function(a){return lc(a.values[b])});if(Object.keys(ng).length>0){d=[];for(var g in ng)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=xe,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 Qe(a){Yd(of.data.targets)||yg&&(oi=a,Ri.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),pi=!0,Hg())}function Re(){Yd(of.data.targets)||yg&&(Ri.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Ri.selectAll("."+f.shape).classed(f.INCLUDED,!1),pi=!1,Ig())}function Se(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Nd(),U=Yd(of.data.targets),V=Dc(of.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?Cf:0,O=B?N:0,P=C?N:0,H&&Mg&&hf(xc(of.data.targets),a),G&&(_f.domain(nf.extent(Zb(V))),Wi=_f.domain(),vf&&Oi.scale(_f).updateScaleExtent(),cg.domain(_f.domain()),Ki.scale(cg)),F&&(_f.domain(Ki.empty()?Wi:Ki.extent()),vf&&Oi.scale(_f).updateScaleExtent()),ag.domain(Ub(V,"y")),bg.domain(Ub(V,"y2")),Vd(V)||(Q=ah?ah:Fc(Ec(V)),fg.tickValues(Q),ig.tickValues(Q)),c=Ri.select("."+f.axisX).style("opacity",U?0:1),(Sg||D)&&(c=c.transition().duration(P)),c.call(fg),e=Ri.select("."+f.axisY).style("opacity",U?0:1),(!Sg||D)&&(e=e.transition().duration(P)),e.call(gg),Ri.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(hg),F)if(Yg&&Q){for(R=1;R=0&&nf.select(this).style("display",b%S?"none":"block")})}else nf.selectAll("."+f.axisX+" .tick text").style("display","block");if(I=Fe(T),K=Ge(T,!0),M=Ge(T,!1),Ab(),dg.domain(ag.domain()),eg.domain(bg.domain()),Ui.style("display","none"),o(),Ri.select("line."+f.xgridFocus).style("visibility","hidden"),xh){if("year"===yh){h=[];for(var W=Zb(),X=W[0].getFullYear(),Y=W[1].getFullYear(),Z=X;Y>=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=_f.ticks(10);g=Ri.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Sg?0:function(a){return _f(a)-fg.tickOffset()}).attr("x2",Sg?Gf:function(a){return _f(a)-fg.tickOffset()}).attr("y1",Sg?function(a){return _f(a)-fg.tickOffset()}:Df.top).attr("y2",Sg?function(a){return _f(a)-fg.tickOffset()}:If).style("opacity",function(){return+nf.select(this).attr(Sg?"y1":"x1")===(Sg?If:0)?0:1}),g.exit().remove()}oe(zh)&&(i=Ri.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(zh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Sg?"":"rotate(-90)").attr("dx",Sg?0:-Df.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Sg?0:vd).attr("x2",Sg?Gf:vd).attr("y1",Sg?vd:Df.top).attr("y2",Sg?vd:If).style("opacity",1),i.select("text").transition().duration(N).attr("x",Sg?Gf:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&Ah&&(k=Ri.select("."+f.ygrids).selectAll("."+f.ygrid).data(ag.ticks(Ch)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Sg?ag:0).attr("x2",Sg?ag:Gf).attr("y1",Sg?0:ag).attr("y2",Sg?If:ag),k.exit().remove()),y&&oe(Bh)&&(l=Ri.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Bh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Sg?"rotate(-90)":"").attr("dx",Sg?0:-Df.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Sg?wd:0).attr("x2",Sg?wd:Gf).attr("y1",Sg?0:wd).attr("y2",Sg?If:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Sg?0:Gf).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Ri.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ti(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Ri.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Sg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Ri.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Li).style("opacity",1),Ri.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Mi).style("opacity",Xi),n=Ri.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",Eh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Sg?Md:Ld).attr("cy",Sg?Ld:Md),n.exit().remove(),Ri.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=nf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Ri.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Ri.select("."+f.chartArcsTitle).style("opacity",Xd(of.data.targets)?1:0),Jg&&(null!==nf.event&&"zoom"===nf.event.type&&Ki.extent(_f.orgDomain()).update(),z&&(Si.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(ig),Ki.empty()||Ki.extent(_f.orgDomain()).update(),J=Fe(T,!0),s=Si.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ti(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Si.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ni).style("opacity",1))),Ri.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Ri.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Sg?Md:Ld).attr("cy",Sg?Ld:Md),t=Ri.select("."+f.eventRects),oe(kg)&&!kc(kg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Ri.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ne(u.enter()),u.attr("x",0).attr("y",0).attr("width",Gf).attr("height",If)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),ni&&!mi?(x=function(a,b){var c=tc(b),d=uc(b),e=of.data.xs[a.id][b];return(_f(d?d:e+50)-_f(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=of.data.xs[a.id][b];return(_f(d)+_f(c?c:d-50))/2}):(x=L(),w=function(a){return _f(a.x)-x/2}),v=wc(),Ri.select("."+f.eventRects).datum(v?v.values:[]),u=Ri.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Me(u.enter()),u.attr("class",ad).attr("x",Sg?0:w).attr("y",Sg?w:0).attr("width",Sg?Gf:x).attr("height",Sg?x:If),u.exit().remove()),q=Ri.select("."+f.regions).selectAll("rect."+f.region).data(Zh),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Sg?0:cc).attr("y",Sg?cc:Df.top).attr("width",Sg?Gf:dc).attr("height",Sg?dc:If).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),xc(of.data.targets).forEach(function(a){Yi[a]=!0})}}function Te(){Se({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ue(){return"mousemove"===nf.event.sourceEvent.type&&Oi.altDomain?(_f.domain(Oi.altDomain),void Oi.scale(_f).updateScaleExtent()):(mi&&_f.orgDomain()[0]===Wi[0]&&_f.domain([Wi[0]-1e-10,_f.orgDomain()[1]]),Se({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===nf.event.sourceEvent.type&&(qi=!0)))}function Ve(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function We(){Pi.attr("width",Kf).attr("height",Lf),Pi.select("#"+fi).select("rect").attr("width",Gf).attr("height",If),Pi.select("#"+gi).select("rect").attr("width",H),Pi.select("#"+hi).select("rect").attr("width",J),Pi.select("."+f.zoomRect).attr("width",Gf).attr("height",If)}function Xe(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),We(),m(a.withTransition),Se(a)}function Ye(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Ri.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ti(a)}),e=Ri.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ti(a)}).style("stroke","none").style("cursor",function(a){return Ag(a)?"pointer":null}),c=Ri.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ti(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Xi=+nf.select(this).style("opacity"),0}).style("fill",function(a){return ti(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ti(a)}).style("cursor",function(a){return Ag(a)?"pointer":null}),a.forEach(function(a){Ri.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Ri.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Sf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ti(a.data)}).style("cursor",function(a){return Ag(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),cf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,nf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),ef(),Id(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Jg&&(n=Si.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ti(a)}),l=Si.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ti(a)})),Pi.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ze(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),of.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Di?j:i,l=Di?Q():P();return d&&(w=0,C=0,t=0,u=0),Mg&&!Cc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Di?u:t,void(Rg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,Di?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Ti.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Og?Og(a):of.toggle(a)}).on("mouseover",function(a){of.focus(a),"function"==typeof Pg&&Pg(a)}).on("mouseout",function(a){of.revert(),"function"==typeof Qg&&Qg(a)}),l.append("text").text(function(a){return d(ng[a])?ng[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",Di?g:-200).attr("y",Di?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Di?h:-200).attr("y",Di?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return ti(a)}).attr("x",Di?g:-200).attr("y",Di?-200:i).attr("width",10).attr("height",10),Ti.selectAll("text").data(a).text(function(a){return d(ng[a])?ng[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ti.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ti.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),We(),q&&m(p)}function jf(a){return zc(of.data.targets,a.id)}function kf(a){return"data"in a&&zc(of.data.targets,a.data.id)}function lf(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 mf(a,b,c){var d=!Yd(of.data.targets);Sd(a,b),Xe(c?c:{withTransitionForAxis:d})}var nf=a.d3?a.d3:a.require?a.require("d3"):void 0,of={data:{},axis:{},legend:{}},pf={},qf=h(["bindto"],"#chart"),rf=h(["size","width"]),sf=h(["size","height"]),tf=h(["padding","left"]),uf=h(["padding","right"]),vf=h(["zoom","enabled"],!1),wf=h(["zoom","extent"]),xf=h(["zoom","privileged"],!1),yf=h(["onenter"],function(){}),zf=h(["onleave"],function(){}),Af=h(["onresize"],function(){}),Bf=h(["onresized"],function(){}),Cf=h(["transition","duration"],350);g("data","data is required in config");var Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg=h(["data","x"]),kg=h(["data","xs"],{}),lg=h(["data","x_format"]),mg=h(["data","id_converter"],function(a){return a}),ng=h(["data","names"],{}),og=h(["data","classes"],{}),pg=h(["data","groups"],[]),qg=h(["data","axes"],{}),rg=h(["data","type"]),sg=h(["data","types"],{}),tg=h(["data","labels"],{}),ug=h(["data","order"]),vg=h(["data","regions"],{}),wg=h(["data","color"]),xg=h(["data","colors"],{}),yg=h(["data","selection","enabled"],!1),zg=h(["data","selection","grouped"],!1),Ag=h(["data","selection","isselectable"],function(){return!0}),Bg=h(["data","selection","multiple"],!0),Cg=h(["data","onclick"],function(){}),Dg=h(["data","onenter"],function(){}),Eg=h(["data","onleave"],function(){}),Fg=h(["data","onselected"],function(){}),Gg=h(["data","onunselected"],function(){}),Hg=h(["data","ondragstart"],function(){}),Ig=h(["data","ondragend"],function(){}),Jg=h(["subchart","show"],!1),Kg=Jg?h(["subchart","size","height"],60):0,Lg=h(["color","pattern"],[]),Mg=h(["legend","show"],!0),Ng=h(["legend","position"],"bottom"),Og=h(["legend","item","onclick"]),Pg=h(["legend","item","onmouseover"]),Qg=h(["legend","item","onmouseout"]),Rg=h(["legend","equally"],!1),Sg=h(["axis","rotated"],!1),Tg=h(["axis","x","type"],"indexed"),Ug=h(["axis","x","localtime"],!0),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"],10),$g=h(["axis","x","tick","count"]),_g=h(["axis","x","tick","fit"],!1),ah=h(["axis","x","tick","values"],null),bh=h(["axis","x","max"]),ch=h(["axis","x","min"]),dh=h(["axis","x","default"]),eh=h(["axis","x","label"],{}),fh=h(["axis","y","show"],!0),gh=h(["axis","y","max"]),hh=h(["axis","y","min"]),ih=h(["axis","y","center"]),jh=h(["axis","y","label"],{}),kh=h(["axis","y","inner"],!1),lh=h(["axis","y","tick","format"]),mh=h(["axis","y","padding"],{}),nh=h(["axis","y","ticks"],10),oh=h(["axis","y2","show"],!1),ph=h(["axis","y2","max"]),qh=h(["axis","y2","min"]),rh=h(["axis","y2","center"]),sh=h(["axis","y2","label"],{}),th=h(["axis","y2","inner"],!1),uh=h(["axis","y2","tick","format"]),vh=h(["axis","y2","padding"],{}),wh=h(["axis","y2","ticks"],10),xh=h(["grid","x","show"],!1),yh=h(["grid","x","type"],"tick"),zh=h(["grid","x","lines"],[]),Ah=h(["grid","y","show"],!1),Bh=h(["grid","y","lines"],[]),Ch=h(["grid","y","ticks"],10),Dh=h(["point","show"],!0),Eh=Dh?h(["point","r"],2.5):0,Fh=h(["point","focus","line","enabled"],!0),Gh=h(["point","focus","expand","enabled"],!0),Hh=h(["point","focus","expand","r"],Gh?4:Eh),Ih=h(["point","focus","select","r"],8),Jh=h(["line","connect_null"],!1),Kh=h(["bar","width"]),Lh=h(["bar","width","ratio"],.6),Mh=h(["pie","label","show"],!0),Nh=h(["pie","label","format"]),Oh=h(["pie","expand"],!0),Ph=h(["pie","onclick"],function(){}),Qh=h(["pie","onmouseover"],function(){}),Rh=h(["pie","onmouseout"],function(){}),Sh=h(["donut","label","show"],!0),Th=h(["donut","label","format"]),Uh=h(["donut","expand"],!0),Vh=h(["donut","title"],""),Wh=h(["donut","onclick"],function(){}),Xh=h(["donut","onmouseover"],function(){}),Yh=h(["donut","onmouseout"],function(){}),Zh=h(["regions"],[]),$h=h(["tooltip","show"],!0),_h=h(["tooltip","format","title"]),ai=h(["tooltip","format","value"]),bi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=_h?_h:b,l=ai?ai: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+""}),ci=h(["tooltip","init","show"],!1),di=h(["tooltip","init","x"],0),ei=h(["tooltip","init","position"],{top:"0px",left:"50px"}),fi=("string"==typeof qf?qf.replace("#",""):qf.id)+"-clip",gi=fi+"-xaxis",hi=fi+"-yaxis",ii=i(fi),ji=i(gi),ki=i(hi),li="timeseries"===Tg,mi="categorized"===Tg,ni=!li&&(jg||oe(kg)),oi=null,pi=!1,qi=!1,ri=!1,si=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ti=ie(xg,oe(Lg)?Lg:si,wg),ui=Ug?nf.time.format:nf.time.format.utc,vi=function(){var a=[[ui("%Y/%-m/%-d"),function(){return!0}],[ui("%-m/%-d"),function(a){return a.getMonth()}],[ui("%-m/%-d"),function(a){return 1!==a.getDate()}],[ui("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[ui("%I %p"),function(a){return a.getHours()}],[ui("%I:%M"),function(a){return a.getMinutes()}],[ui(":%S"),function(a){return a.getSeconds()}],[ui(".%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)}}(),wi=[],xi=[],yi=Sg?"left":"bottom",zi=Sg?kh?"top":"bottom":kh?"right":"left",Ai=Sg?th?"bottom":"top":th?"left":"right",Bi=Sg?"left":"bottom",Ci={main:function(){return"translate("+Df.left+","+Df.top+")"},context:function(){return"translate("+Ef.left+","+Ef.top+")"},legend:function(){return"translate("+Ff.left+","+Ff.top+")"},x:function(){return"translate(0,"+(Sg?0:If)+")"},y:function(){return"translate(0,"+(Sg?If:0)+")"},y2:function(){return"translate("+(Sg?0:Gf)+","+(Sg?1:0)+")"},subx:function(){return"translate(0,"+(Sg?0:Jf)+")"},arc:function(){return"translate("+Gf/2+","+If/2+")"}},Di="right"===Ng,Ei=0,Fi=0,Gi=0,Hi=30,Ii=30,Ji=5;Sf=nf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Ki,Li=function(){var a=nf.svg.line().x(Sg?function(a){return V(a.id)(a.value)}:ud).y(Sg?ud:function(a){return V(a.id)(a.value)});return Jh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Jh?ye(b.values):b.values;return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),vg[b.id]?Ke(e,_f,V(b.id),vg[b.id]):a(e)):(c=e[0]?_f(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Sg?"M "+d+" "+c:"M "+c+" "+d)}}(),Mi=function(){var a;return a=Sg?nf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):nf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=ye(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?_f(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Sg?"M "+d+" "+c:"M "+c+" "+d)}}(),Ni=function(){var a=nf.svg.line().x(Sg?function(a){return W(a.id)(a.value)}:xd).y(Sg?xd:function(a){return W(a.id)(a.value)});return function(b){var c=ye(b.values);return Zd(b)?a(c):"M "+cg(c[0].x)+" "+W(b.id)(c[0].value)}}(),Oi=function(){};Ki=nf.svg.brush().on("brush",Te),Ki.update=function(){return Si&&Si.select("."+f.brush).call(this),this},Ki.scale=function(a){return Sg?this.y(a):this.x(a)},vf&&(Oi=nf.behavior.zoom().on("zoomstart",function(){Oi.altDomain=nf.event.sourceEvent.altKey?_f.orgDomain():null}).on("zoom",vf?Ue:null),Oi.scale=function(a){return Sg?this.y(a):this.x(a)},Oi.orgScaleExtent=function(){var a=wf?wf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Oi.updateScaleExtent=function(){var a=$b(_f.orgDomain())/$b(Wi),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Pi,Qi,Ri,Si,Ti,Ui,Vi,Wi,Xi,Yi={};if(of.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Pi.selectAll(hd(a)),d=c.filter(jf),e=c.filter(kf);of.revert(),of.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(of.data.targets)&&Kb(a,!0),cf(a)},of.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Pi.selectAll(hd(a)),d=c.filter(jf),e=c.filter(kf);of.revert(),b(d.classed(f.focused,!1)),b(e),Yd(of.data.targets)&&Lb(a),df(a)},of.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Pi.selectAll(hd(a)),d=c.filter(jf),e=c.filter(kf);b(d.classed(f.focused,!1)),b(e),Yd(of.data.targets)&&Lb(a),ef()},of.show=function(a,b){a=yc(a),b=b||{},Hc(a),Pi.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ff(a):Ti.selectAll(kd(a)).classed(f.legendItemHidden,!1),Se({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},of.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Pi.selectAll(id(a)).transition().style("opacity",0),b.withLegend?gf(a):Ti.selectAll(kd(a)).classed(f.legendItemHidden,!0),Se({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},of.toggle=function(a){Bc(a)?of.hide(a):of.show(a)},of.unzoom=function(){Ki.clear().update(),Se({withUpdateXDomain:!0})},of.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){og[b]=a.classes[b]}),"categories"in a&&mi&&(Vg=a.categories,fg.categories(Vg)),"cacheIds"in a&&_b(a.cacheIds)?void Ze(bc(a.cacheIds),a.done):void("unload"in a?_e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){$e(a)}):$e(a))},of.unload=function(a){_e(yc(a),function(){Se({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},of.selected=function(a){return nf.merge(Ri.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return nf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},of.select=function(a,b,c){yg&&Ri.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=nf.select(this),i="circle"===this.nodeName?se:ve,j="circle"===this.nodeName?te:we,k=zg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Ag(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},of.unselect=function(a,b){yg&&Ri.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=nf.select(this),g="circle"===this.nodeName?te:we,h=zg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Ag(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},of.toLine=function(a){mf(a,"line")},of.toSpline=function(a){mf(a,"spline")},of.toBar=function(a){mf(a,"bar")},of.toScatter=function(a){mf(a,"scatter")},of.toArea=function(a){mf(a,"area")},of.toAreaSpline=function(a){mf(a,"area-spline")},of.toPie=function(a){mf(a,"pie",{withTransform:!0})},of.toDonut=function(a){mf(a,"donut",{withTransform:!0})},of.groups=function(a){return c(a)?pg:(pg=a,Se(),pg)},of.xgrids=function(a){return a?(zh=a,Se(),zh):zh},of.xgrids.add=function(a){return a?of.xgrids(zh.concat(a)):void 0},of.xgrids.remove=function(a){var b=lf(a);return of.xgrids(zh.filter(b))},of.ygrids=function(a){return a?(Bh=a,Se(),Bh):Bh},of.ygrids.add=function(a){return a?of.ygrids(Bh.concat(a)):void 0},of.ygrids.remove=function(a){var b=lf(a);return of.ygrids(Bh.filter(b))},of.regions=function(a){return c(a)?Zh:(Zh=a,Se(),Zh)},of.regions.add=function(a){return c(a)?Zh:(Zh=Zh.concat(a),Se(),Zh)},of.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;Pi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Zh=Zh.filter(function(b){return b.classes.indexOf(a)<0})}),Zh},of.data.get=function(a){var b=of.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},of.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},of.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){ng[b]=a[b]}),hf(xc(of.data.targets),{withTransition:!0}),ng):ng},of.x=function(a){return arguments.length&&(mc(of.data.targets,a),Se({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),of.data.xs},of.xs=function(a){return arguments.length&&(nc(of.data.targets,a),Se({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),of.data.xs},of.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},of.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(gh=+a.y),b(a.y2)&&(ph=+a.y2)):gh=ph=+a,Se())},of.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(hh=+a.y),b(a.y2)&&(qh=+a.y2)):hh=qh=+a,Se())},of.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&of.axis.max(a.max),"undefined"!=typeof a.min&&of.axis.min(a.min))},of.legend.show=function(a){Mg||(Mg=!0,Ti.style("visibility","visible")),ff(yc(a)),Se({withTransitionForHorizontalAxis:!1})},of.legend.hide=function(a){Mg&&ne(a)&&(Mg=!1,Ti.style("visibility","hidden")),gf(yc(a)),Se({withTransitionForHorizontalAxis:!1})},of.resize=function(a){rf=a?a.width:null,sf=a?a.height:null,Xe({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},of.destroy=function(){of.data.targets=void 0,of.data.xs={},Vi.html(""),a.onresize=null},"url"in e.data)nf.xhr(e.data.url,function(a,b){var c,d=nf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=nf.csv.parse(b.response),Le(c)});else if("rows"in e.data)Le(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Le(qc(e.data.columns))}return of},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 0a315b1d96ec2b208c07c15cb19a88fcd2b89f57 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Sat, 19 Apr 2014 07:32:56 +0900 Subject: [PATCH 047/178] Add axis.x.padding option - #167 --- c3.js | 17 +++++++++++++---- c3.min.js | 6 +++--- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/c3.js b/c3.js index 6d15073..0889ab2 100644 --- a/c3.js +++ b/c3.js @@ -178,6 +178,7 @@ __axis_x_tick_values = getConfig(['axis', 'x', 'tick', 'values'], null), __axis_x_max = getConfig(['axis', 'x', 'max']), __axis_x_min = getConfig(['axis', 'x', 'min']), + __axis_x_padding = getConfig(['axis', 'x', 'padding'], {}), __axis_x_default = getConfig(['axis', 'x', 'default']), __axis_x_label = getConfig(['axis', 'x', 'label'], {}), __axis_y_show = getConfig(['axis', 'y', 'show'], true), @@ -1216,7 +1217,7 @@ return __axis_x_max ? __axis_x_max : d3.max(targets, function (t) { return d3.max(t.values, function (v) { return v.x; }); }); } function getXDomainPadding(targets, domain) { - var firstX = domain[0], lastX = domain[1], diff = Math.abs(firstX - lastX), maxDataCount, padding; + var firstX = domain[0], lastX = domain[1], diff = Math.abs(firstX - lastX), maxDataCount, padding, paddingLeft, paddingRight; if (isCategorized) { padding = 0; } else if (hasBarType(targets)) { @@ -1225,7 +1226,15 @@ } else { padding = diff * 0.01; } - return padding; + if (typeof __axis_x_padding === 'object' && notEmpty(__axis_x_padding)) { + paddingLeft = isValue(__axis_x_padding.left) ? __axis_x_padding.left : padding; + paddingRight = isValue(__axis_x_padding.right) ? __axis_x_padding.right : padding; + } else if (typeof __axis_x_padding === 'number') { + paddingLeft = paddingRight = __axis_x_padding; + } else { + paddingLeft = paddingRight = padding; + } + return {left: paddingLeft, right: paddingRight}; } function getXDomain(targets) { var xDomain = [getXDomainMin(targets), getXDomainMax(targets)], @@ -1233,10 +1242,10 @@ padding = getXDomainPadding(targets, xDomain), min = 0, max = 0; if (firstX || firstX === 0) { - min = isTimeSeries ? new Date(firstX.getTime() - padding) : firstX - padding; + min = isTimeSeries ? new Date(firstX.getTime() - padding.left) : firstX - padding.left; } if (lastX || lastX === 0) { - max = isTimeSeries ? new Date(lastX.getTime() + padding) : lastX + padding; + max = isTimeSeries ? new Date(lastX.getTime() + padding.right) : lastX + padding.right; } return [min, max]; } diff --git a/c3.min.js b/c3.min.js index f0dfe8d..aee452e 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.31"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cGf&&(Gf=0),0>If&&(If=0),Ef={top:Sg?Df.top:Lf-Kg-(Di?0:a),right:0/0,bottom:20+(Di?0:a),left:Sg?Hi:Df.left},Hf=Sg?Df.left-Hi-Ii:Gf,Jf=Sg?If:Lf-Ef.top-Ef.bottom,0>Hf&&(Hf=0),0>Jf&&(Jf=0),Ff={top:Di?0:Lf-a,right:0/0,bottom:0,left:Di?Kf-b:0},p(),Di&&Yd(of.data.targets)&&(Ff.left=Gf/2+Nf)}function o(){Ri.select("line."+f.xgridFocus).attr("x1",Sg?0:-10).attr("x2",Sg?Gf:-10).attr("y1",Sg?-10:Df.top).attr("y2",Sg?-10:If)}function p(){Nf=If/2,Mf=.95*Nf,Of=Xd(of.data.targets)?.6*Mf:0}function q(){var a=Sg?f.axisX:f.axisY,b=nf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=nf.select(qf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return rf?rf:x()}function s(){var a=sf?sf:y();return a>0?a:320}function t(){return Yd(of.data.targets)?0:tf?tf:Sg||!fh||kh?1:v("y")}function u(){var a=1;return Yd(of.data.targets)?0:uf?uf:Di?P()+(oh&&!Sg?v("y2"):a):oh?th||Sg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||fh?"y2"!==a||oh?(gb(a).isInner?30:40)+("y2"===a?-10:0):Ji:Mg&&!Di?10:1}function x(){return+nf.select(qf).style("width").replace("px","")}function y(){return+nf.select(qf).style("height").replace("px","")}function z(a){return a?-5:-(Df.left-1)}function A(a){return a?-20:-1}function B(){return z(!Sg)}function C(){return A(!Sg)}function D(){return z(Sg)}function E(){return A(Sg)}function F(a){return a?Gf+2+4:Df.left+20}function G(a){return a?80:If+2}function H(){return F(!Sg)}function I(){return G(!Sg)}function J(){return F(Sg)}function K(){return G(Sg)}function L(){var a=Sg?If:Gf,b=vc(),c=Vb()*(Ud(of.data.targets)?(b-(mi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){Ei=a}function N(a){Fi=a}function O(a){Gi=a}function P(){return Mg?Di?Fi*(Ei+1):Kf:0}function Q(){return Mg?Di?Lf:Gi*(Ei+1):0}function R(){var a,b=!_f;Tf=Sg?1:0,Uf=Sg?If:Gf,Vf=Sg?0:If,Wf=Sg?Gf:1,Xf=Tf,Yf=Uf,Zf=Sg?0:Jf,$f=Sg?Hf:1,_f=T(Tf,Uf,b?void 0:_f.domain(),function(){return fg.tickOffset()}),ag=U(Vf,Wf),bg=U(Vf,Wf),cg=T(Tf,Uf,Wi,function(a){return a%1?0:ig.tickOffset()}),dg=U(Zf,$f),eg=U(Zf,$f),a=$(),fg=X(_f,yi,a),ig=X(cg,Bi,a),gg=Y(ag,zi,lh,nh),hg=Y(bg,Ai,uh,wh),b||(Ki.scale(cg),vf&&Oi.scale(_f)),S()}function S(){Pf=Db(),Qf=Eb(),Rf=Eb(.98)}function T(a,b,e,f){var g=(li?nf.time.scale():nf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),mi){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return nf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?bg:ag}function W(a){return"y2"===Z(a)?eg:dg}function X(a,b,c){var d=(mi?Bb():nf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),mi?(d.tickCentered(Wg),ne(Yg)&&(Yg=!1)):d.tickOffset=function(){var a=Sg?If:Gf;return a*Vb()/vc()/2},mi&&d.categories(Vg),d}function Y(a,b,c,d){return nf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in qg?qg[a]:"y"}function $(){var a=li?vi:mi?Oc:function(a){return 0>a?a.toFixed(0):a};return Xg&&("function"==typeof Xg?a=Xg:li&&(a=function(a){return a?ui(Xg)(a):""})),a}function _(a){var b;return"y"===a?b=jh:"y2"===a?b=sh:"x"===a&&(b=eh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?jh=b:"y2"===a?sh=b:"x"===a&&(eh=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Sg?"inner-top":"inner-right")}function eb(){return cb("y",Sg?"inner-right":"inner-top")}function fb(){return cb("y2",Sg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?Gf/2:Gf:b.isBottom?-If:b.isMiddle?-If/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Sg,db())}function ob(){return kb(Sg,eb())}function pb(){return kb(Sg,fb())}function qb(){return lb(!Sg,db())}function rb(){return lb(Sg,eb())}function sb(){return lb(Sg,fb())}function tb(){var a=db();return Sg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Sg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Sg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Sg,db())}function xb(){return mb(Sg,eb())}function yb(){return mb(Sg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return nf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Ri.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Ri.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Ri.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+o)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Mc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return nf.min(Object.keys(i).map(function(a){return nf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(pg.length>0)for(g=Nc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return nf.max(Object.keys(i).map(function(a){return nf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?qh:hh,n="y2"===c?ph:gh,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?rh:ih,r=pd()&&Sg;return 0===l.length?"y2"===c?bg.domain():ag.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=qd(o,p),j=$b(ag.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&mh&&(f=b(mh.top)?mh.top:e,g=b(mh.bottom)?mh.bottom:e),"y2"===c&&vh&&(f=b(vh.top)?vh.top:e,g=b(vh.bottom)?vh.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Wi),c=$b(_f.domain());return a||0===c?1:b/c}function Wb(a){return ch?ch:nf.min(a,function(a){return nf.min(a.values,function(a){return a.x})})}function Xb(a){return bh?bh:nf.max(a,function(a){return nf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return mi?d=0:Ud(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=0,g=0;return(c||0===c)&&(f=li?new Date(c.getTime()-e):c-e),(d||0===d)&&(g=li?new Date(d.getTime()+e):d+e),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return jg&&a===jg||oe(kg)&&pe(kg,a)}function fc(a){return!ec(a)}function gc(a){return jg?jg:oe(kg)?kg[a]:null}function hc(a,b){var c,d=b&&oe(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=of.data.xs[b])}),c}function ic(a,b){return a in of.data.xs&&of.data.xs[a]&&of.data.xs[a][b]?of.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){kg[b]=a[b]})}function kc(a){return 1===nf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=ng[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),of.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=li?a?a instanceof Date?a:je(a):je(ic(b,c)):ni&&!mi?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?of.data.xs[c]=a.map(function(a){return a[f]}).filter(b):jg?(d=Object.keys(of.data.xs),of.data.xs[c]=d.length>0?of.data.xs[d[0]]:void 0):oe(kg)&&(of.data.xs[c]=hc(f,of.data.targets)):of.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!of.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=mg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return ni&&mi&&0===c&&g&&(0===e&&(Vg=[]),Vg.push(g)),("undefined"==typeof a[b]||of.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),rg&&Sd(xc(c).filter(function(a){return!(a in sg)}),rg),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function tc(a){return a>0&&of.data.targets[0].values[a-1]?of.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?of.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?of.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(of.data.targets)}function zc(a,b){var c,d=xc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(li?new Date(h):h);i.push(d)}return li||(i=i.sort(function(a,b){return a-b})),i}function Gc(a){wi=wi.concat(a)}function Hc(a){wi=wi.filter(function(b){return a.indexOf(b)<0})}function Ic(a){xi=xi.concat(a)}function Jc(a){xi=xi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=qe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return nf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Ed(){return ug&&"desc"===ug.toLowerCase()}function Fd(){return ug&&"asc"===ug.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof ug&&a.sort(ug),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(of.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});$h&&0!==m.length&&(Ui.html(bi(a,$(),l,ti)).style("display","block"),d=Ui.property("offsetWidth"),e=Ui.property("offsetHeight"),k?(g=Gf/2+c[0],i=If/2+c[1]+20):(Sg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=_f(m[0].x)+20):(f=q(),g=f+t()+_f(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Ui.style("top",i+"px").style("left",g+"px"))}function Id(){Ui.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});$h&&(Vd(of.data.targets)||Yd(of.data.targets)||Ri.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Sg?"y1":"x1",ud).attr(Sg?"y2":"x2",ud))}function Kd(){Ri.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?_f(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Kh?Kh:b?2*a.tickOffset()*Lh/b:0}function Sd(a,b){yc(a).forEach(function(a){Yi[a]=b===sg[a],sg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){sg[a.id]===b&&(c=!0),a.id in sg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in sg)||"line"===sg[b]||"spline"===sg[b]||"area"===sg[b]||"area-spline"===sg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===sg[b]||"area-spline"===sg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===sg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===sg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===sg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===sg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(a){return ce(a)&&Uh||be(a)&&Oh}function ie(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function je(b){var c;try{c=lg?nf.time.format(lg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+lg)}return c}function ke(a,b){var c=nf.mouse(a),d=nf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function pe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function qe(a,b){var c="y"===Z(a.id)?ag:bg,d=Sg?1:0,e=Sg?0:1;return Math.pow(_f(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function re(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function se(a,b,c){Fg(b,a.node()),Ri.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Sg?Md:Ld).attr("cy",Sg?Ld:Md).attr("stroke",function(){return ti(b)}).attr("r",1.4*Ih).transition().duration(100).attr("r",Ih)}function te(a,b,c){Gg(b,a.node()),Ri.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ue(a,b,c,d){a?se(b,c,d):te(b,c,d)}function ve(a,b){Fg(b,a.node()),a.transition().duration(100).style("fill",function(){return nf.rgb(ti(b)).darker(1)})}function we(a,b){Gg(b,a.node()),a.transition().duration(100).style("fill",function(){return ti(b)})}function xe(a,b,c,d){a?ve(b,c,d):we(b,c,d)}function ye(a){return a.filter(function(a){return b(a.value)})}function ze(a,c){return(c?Ri.selectAll("."+f.circles+gd(c)):Ri).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ae(a,b){ze(a,b).classed(f.EXPANDED,!0).attr("r",Hh)}function Be(a){ze(a).filter(function(){return nf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Eh)}function Ce(a){return Ri.selectAll("."+f.bar+(b(a)?"-"+a:""))}function De(a){Ce(a).classed(f.EXPANDED,!0)}function Ee(a){Ce(a).classed(f.EXPANDED,!1)}function Fe(a,b){var c=Je(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 Ge(a,b){var c=Je(a,!1),d=b?He:Ie;return function(a,b){return d(c(a,b),a,this)}}function He(a,b){var c;return Sg?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ie(a,b,c){var d=c.getBoundingClientRect();return Sg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Je(a,b){var c=a.__max__+1,d=Rd(fg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return 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 Ke(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 Le(b){var c,d,e;if(Vi=nf.select(qf),Vi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Vi.html(""),Vi.classed("c3",!0),of.data.xs={},of.data.targets=rc(b),n(),R(),_f.domain(nf.extent(Zb(of.data.targets))),ag.domain(Ub(of.data.targets,"y")),bg.domain(Ub(of.data.targets,"y2")),cg.domain(_f.domain()),dg.domain(ag.domain()),eg.domain(bg.domain()),Wi=_f.domain(),Ki.scale(cg),vf&&Oi.scale(_f),Pi=Vi.append("svg").attr("width",Gf+Df.left+Df.right).attr("height",If+Df.top+Df.bottom).on("mouseenter",yf).on("mouseleave",zf),Qi=Pi.append("defs"),Qi.append("clipPath").attr("id",fi).append("rect").attr("width",Gf).attr("height",If),Qi.append("clipPath").attr("id",gi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Qi.append("clipPath").attr("id",hi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Ri=Pi.append("g").attr("transform",Ci.main),Si=Jg?Pi.append("g").attr("transform",Ci.context):null,Ti=Pi.append("g").attr("transform",Ci.legend),Mg||(Ti.style("visibility","hidden"),xi=xc(of.data.targets)),Ui=nf.select(qf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),hf(xc(of.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Ri.append("g").attr("class",f.axisX).attr("clip-path",Sg?"":ji).attr("transform",Ci.x).append("text").attr("class",f.axisXLabel).attr("transform",Sg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),fh&&Ri.append("g").attr("class",f.axisY).attr("clip-path",Sg?ki:"").attr("transform",Ci.y).append("text").attr("class",f.axisYLabel).attr("transform",Sg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),oh&&Ri.append("g").attr("class",f.axisY2).attr("transform",Ci.y2).append("text").attr("class",f.axisY2Label).attr("transform",Sg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Ri.append("g").attr("clip-path",ii).attr("class",f.grid),xh&&d.append("g").attr("class",f.xgrids),oe(zh)&&d.append("g").attr("class",f.xgridLines),Fh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Ah&&d.append("g").attr("class",f.ygrids),oe(Bh)&&d.append("g").attr("class",f.ygridLines),Ri.append("g").attr("clip-path",ii).attr("class",f.regions),Ri.append("g").attr("clip-path",ii).attr("class",f.chart),c=Ri.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",vf?Sg?"ns-resize":"ew-resize":null),Ri.select("."+f.chart).append("g").attr("class",f.chartBars),Ri.select("."+f.chart).append("g").attr("class",f.chartLines),Ri.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Ci.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Ri.select("."+f.chart).append("g").attr("class",f.chartTexts),vf&&Ri.insert("rect",xf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Gf).attr("height",If).style("opacity",0).style("cursor",Sg?"ns-resize":"ew-resize").call(Oi).on("dblclick.zoom",null),dh&&Ki.extent("function"!=typeof dh?dh:dh(Zb())),Jg&&(Si.append("g").attr("clip-path",ii).attr("class",f.chart),Si.select("."+f.chart).append("g").attr("class",f.chartBars),Si.select("."+f.chart).append("g").attr("class",f.chartLines),Si.append("g").attr("clip-path",ii).attr("class",f.brush).call(Ki).selectAll("rect").attr(Sg?"width":"height",Sg?Hf:Jf),Si.append("g").attr("class",f.axisX).attr("transform",Ci.subx).attr("clip-path",Sg?"":ji)),Ye(of.data.targets),Sg?Ri.select("."+f.axisX).style("opacity",0).call(fg):(Ri.select("."+f.axisY).style("opacity",0).call(gg),Ri.select("."+f.axisY2).style("opacity",0).call(hg)),Se({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),ci){if(li&&"string"==typeof di){for(di=je(di),e=0;e0){d=[];for(var g in ng)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=xe,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 Qe(a){Yd(of.data.targets)||yg&&(oi=a,Ri.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),pi=!0,Hg())}function Re(){Yd(of.data.targets)||yg&&(Ri.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Ri.selectAll("."+f.shape).classed(f.INCLUDED,!1),pi=!1,Ig())}function Se(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Nd(),U=Yd(of.data.targets),V=Dc(of.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?Cf:0,O=B?N:0,P=C?N:0,H&&Mg&&hf(xc(of.data.targets),a),G&&(_f.domain(nf.extent(Zb(V))),Wi=_f.domain(),vf&&Oi.scale(_f).updateScaleExtent(),cg.domain(_f.domain()),Ki.scale(cg)),F&&(_f.domain(Ki.empty()?Wi:Ki.extent()),vf&&Oi.scale(_f).updateScaleExtent()),ag.domain(Ub(V,"y")),bg.domain(Ub(V,"y2")),Vd(V)||(Q=ah?ah:Fc(Ec(V)),fg.tickValues(Q),ig.tickValues(Q)),c=Ri.select("."+f.axisX).style("opacity",U?0:1),(Sg||D)&&(c=c.transition().duration(P)),c.call(fg),e=Ri.select("."+f.axisY).style("opacity",U?0:1),(!Sg||D)&&(e=e.transition().duration(P)),e.call(gg),Ri.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(hg),F)if(Yg&&Q){for(R=1;R=0&&nf.select(this).style("display",b%S?"none":"block")})}else nf.selectAll("."+f.axisX+" .tick text").style("display","block");if(I=Fe(T),K=Ge(T,!0),M=Ge(T,!1),Ab(),dg.domain(ag.domain()),eg.domain(bg.domain()),Ui.style("display","none"),o(),Ri.select("line."+f.xgridFocus).style("visibility","hidden"),xh){if("year"===yh){h=[];for(var W=Zb(),X=W[0].getFullYear(),Y=W[1].getFullYear(),Z=X;Y>=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=_f.ticks(10);g=Ri.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Sg?0:function(a){return _f(a)-fg.tickOffset()}).attr("x2",Sg?Gf:function(a){return _f(a)-fg.tickOffset()}).attr("y1",Sg?function(a){return _f(a)-fg.tickOffset()}:Df.top).attr("y2",Sg?function(a){return _f(a)-fg.tickOffset()}:If).style("opacity",function(){return+nf.select(this).attr(Sg?"y1":"x1")===(Sg?If:0)?0:1}),g.exit().remove()}oe(zh)&&(i=Ri.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(zh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Sg?"":"rotate(-90)").attr("dx",Sg?0:-Df.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Sg?0:vd).attr("x2",Sg?Gf:vd).attr("y1",Sg?vd:Df.top).attr("y2",Sg?vd:If).style("opacity",1),i.select("text").transition().duration(N).attr("x",Sg?Gf:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&Ah&&(k=Ri.select("."+f.ygrids).selectAll("."+f.ygrid).data(ag.ticks(Ch)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Sg?ag:0).attr("x2",Sg?ag:Gf).attr("y1",Sg?0:ag).attr("y2",Sg?If:ag),k.exit().remove()),y&&oe(Bh)&&(l=Ri.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Bh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Sg?"rotate(-90)":"").attr("dx",Sg?0:-Df.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Sg?wd:0).attr("x2",Sg?wd:Gf).attr("y1",Sg?0:wd).attr("y2",Sg?If:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Sg?0:Gf).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Ri.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ti(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Ri.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Sg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Ri.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Li).style("opacity",1),Ri.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Mi).style("opacity",Xi),n=Ri.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",Eh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Sg?Md:Ld).attr("cy",Sg?Ld:Md),n.exit().remove(),Ri.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=nf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Ri.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Ri.select("."+f.chartArcsTitle).style("opacity",Xd(of.data.targets)?1:0),Jg&&(null!==nf.event&&"zoom"===nf.event.type&&Ki.extent(_f.orgDomain()).update(),z&&(Si.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(ig),Ki.empty()||Ki.extent(_f.orgDomain()).update(),J=Fe(T,!0),s=Si.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ti(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Si.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Ni).style("opacity",1))),Ri.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Ri.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Sg?Md:Ld).attr("cy",Sg?Ld:Md),t=Ri.select("."+f.eventRects),oe(kg)&&!kc(kg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Ri.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ne(u.enter()),u.attr("x",0).attr("y",0).attr("width",Gf).attr("height",If)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),ni&&!mi?(x=function(a,b){var c=tc(b),d=uc(b),e=of.data.xs[a.id][b];return(_f(d?d:e+50)-_f(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=of.data.xs[a.id][b];return(_f(d)+_f(c?c:d-50))/2}):(x=L(),w=function(a){return _f(a.x)-x/2}),v=wc(),Ri.select("."+f.eventRects).datum(v?v.values:[]),u=Ri.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Me(u.enter()),u.attr("class",ad).attr("x",Sg?0:w).attr("y",Sg?w:0).attr("width",Sg?Gf:x).attr("height",Sg?x:If),u.exit().remove()),q=Ri.select("."+f.regions).selectAll("rect."+f.region).data(Zh),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Sg?0:cc).attr("y",Sg?cc:Df.top).attr("width",Sg?Gf:dc).attr("height",Sg?dc:If).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),xc(of.data.targets).forEach(function(a){Yi[a]=!0})}}function Te(){Se({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ue(){return"mousemove"===nf.event.sourceEvent.type&&Oi.altDomain?(_f.domain(Oi.altDomain),void Oi.scale(_f).updateScaleExtent()):(mi&&_f.orgDomain()[0]===Wi[0]&&_f.domain([Wi[0]-1e-10,_f.orgDomain()[1]]),Se({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===nf.event.sourceEvent.type&&(qi=!0)))}function Ve(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function We(){Pi.attr("width",Kf).attr("height",Lf),Pi.select("#"+fi).select("rect").attr("width",Gf).attr("height",If),Pi.select("#"+gi).select("rect").attr("width",H),Pi.select("#"+hi).select("rect").attr("width",J),Pi.select("."+f.zoomRect).attr("width",Gf).attr("height",If)}function Xe(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),We(),m(a.withTransition),Se(a)}function Ye(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Ri.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ti(a)}),e=Ri.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ti(a)}).style("stroke","none").style("cursor",function(a){return Ag(a)?"pointer":null}),c=Ri.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ti(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Xi=+nf.select(this).style("opacity"),0}).style("fill",function(a){return ti(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ti(a)}).style("cursor",function(a){return Ag(a)?"pointer":null}),a.forEach(function(a){Ri.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Ri.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Sf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ti(a.data)}).style("cursor",function(a){return Ag(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),cf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,nf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),ef(),Id(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Jg&&(n=Si.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ti(a)}),l=Si.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ti(a)})),Pi.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ze(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),of.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Di?j:i,l=Di?Q():P();return d&&(w=0,C=0,t=0,u=0),Mg&&!Cc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Di?u:t,void(Rg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,Di?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Ti.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Og?Og(a):of.toggle(a)}).on("mouseover",function(a){of.focus(a),"function"==typeof Pg&&Pg(a)}).on("mouseout",function(a){of.revert(),"function"==typeof Qg&&Qg(a)}),l.append("text").text(function(a){return d(ng[a])?ng[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",Di?g:-200).attr("y",Di?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Di?h:-200).attr("y",Di?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return ti(a)}).attr("x",Di?g:-200).attr("y",Di?-200:i).attr("width",10).attr("height",10),Ti.selectAll("text").data(a).text(function(a){return d(ng[a])?ng[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ti.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ti.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),We(),q&&m(p)}function jf(a){return zc(of.data.targets,a.id)}function kf(a){return"data"in a&&zc(of.data.targets,a.data.id)}function lf(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 mf(a,b,c){var d=!Yd(of.data.targets);Sd(a,b),Xe(c?c:{withTransitionForAxis:d})}var nf=a.d3?a.d3:a.require?a.require("d3"):void 0,of={data:{},axis:{},legend:{}},pf={},qf=h(["bindto"],"#chart"),rf=h(["size","width"]),sf=h(["size","height"]),tf=h(["padding","left"]),uf=h(["padding","right"]),vf=h(["zoom","enabled"],!1),wf=h(["zoom","extent"]),xf=h(["zoom","privileged"],!1),yf=h(["onenter"],function(){}),zf=h(["onleave"],function(){}),Af=h(["onresize"],function(){}),Bf=h(["onresized"],function(){}),Cf=h(["transition","duration"],350);g("data","data is required in config");var Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg=h(["data","x"]),kg=h(["data","xs"],{}),lg=h(["data","x_format"]),mg=h(["data","id_converter"],function(a){return a}),ng=h(["data","names"],{}),og=h(["data","classes"],{}),pg=h(["data","groups"],[]),qg=h(["data","axes"],{}),rg=h(["data","type"]),sg=h(["data","types"],{}),tg=h(["data","labels"],{}),ug=h(["data","order"]),vg=h(["data","regions"],{}),wg=h(["data","color"]),xg=h(["data","colors"],{}),yg=h(["data","selection","enabled"],!1),zg=h(["data","selection","grouped"],!1),Ag=h(["data","selection","isselectable"],function(){return!0}),Bg=h(["data","selection","multiple"],!0),Cg=h(["data","onclick"],function(){}),Dg=h(["data","onenter"],function(){}),Eg=h(["data","onleave"],function(){}),Fg=h(["data","onselected"],function(){}),Gg=h(["data","onunselected"],function(){}),Hg=h(["data","ondragstart"],function(){}),Ig=h(["data","ondragend"],function(){}),Jg=h(["subchart","show"],!1),Kg=Jg?h(["subchart","size","height"],60):0,Lg=h(["color","pattern"],[]),Mg=h(["legend","show"],!0),Ng=h(["legend","position"],"bottom"),Og=h(["legend","item","onclick"]),Pg=h(["legend","item","onmouseover"]),Qg=h(["legend","item","onmouseout"]),Rg=h(["legend","equally"],!1),Sg=h(["axis","rotated"],!1),Tg=h(["axis","x","type"],"indexed"),Ug=h(["axis","x","localtime"],!0),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"],10),$g=h(["axis","x","tick","count"]),_g=h(["axis","x","tick","fit"],!1),ah=h(["axis","x","tick","values"],null),bh=h(["axis","x","max"]),ch=h(["axis","x","min"]),dh=h(["axis","x","default"]),eh=h(["axis","x","label"],{}),fh=h(["axis","y","show"],!0),gh=h(["axis","y","max"]),hh=h(["axis","y","min"]),ih=h(["axis","y","center"]),jh=h(["axis","y","label"],{}),kh=h(["axis","y","inner"],!1),lh=h(["axis","y","tick","format"]),mh=h(["axis","y","padding"],{}),nh=h(["axis","y","ticks"],10),oh=h(["axis","y2","show"],!1),ph=h(["axis","y2","max"]),qh=h(["axis","y2","min"]),rh=h(["axis","y2","center"]),sh=h(["axis","y2","label"],{}),th=h(["axis","y2","inner"],!1),uh=h(["axis","y2","tick","format"]),vh=h(["axis","y2","padding"],{}),wh=h(["axis","y2","ticks"],10),xh=h(["grid","x","show"],!1),yh=h(["grid","x","type"],"tick"),zh=h(["grid","x","lines"],[]),Ah=h(["grid","y","show"],!1),Bh=h(["grid","y","lines"],[]),Ch=h(["grid","y","ticks"],10),Dh=h(["point","show"],!0),Eh=Dh?h(["point","r"],2.5):0,Fh=h(["point","focus","line","enabled"],!0),Gh=h(["point","focus","expand","enabled"],!0),Hh=h(["point","focus","expand","r"],Gh?4:Eh),Ih=h(["point","focus","select","r"],8),Jh=h(["line","connect_null"],!1),Kh=h(["bar","width"]),Lh=h(["bar","width","ratio"],.6),Mh=h(["pie","label","show"],!0),Nh=h(["pie","label","format"]),Oh=h(["pie","expand"],!0),Ph=h(["pie","onclick"],function(){}),Qh=h(["pie","onmouseover"],function(){}),Rh=h(["pie","onmouseout"],function(){}),Sh=h(["donut","label","show"],!0),Th=h(["donut","label","format"]),Uh=h(["donut","expand"],!0),Vh=h(["donut","title"],""),Wh=h(["donut","onclick"],function(){}),Xh=h(["donut","onmouseover"],function(){}),Yh=h(["donut","onmouseout"],function(){}),Zh=h(["regions"],[]),$h=h(["tooltip","show"],!0),_h=h(["tooltip","format","title"]),ai=h(["tooltip","format","value"]),bi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=_h?_h:b,l=ai?ai: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+""}),ci=h(["tooltip","init","show"],!1),di=h(["tooltip","init","x"],0),ei=h(["tooltip","init","position"],{top:"0px",left:"50px"}),fi=("string"==typeof qf?qf.replace("#",""):qf.id)+"-clip",gi=fi+"-xaxis",hi=fi+"-yaxis",ii=i(fi),ji=i(gi),ki=i(hi),li="timeseries"===Tg,mi="categorized"===Tg,ni=!li&&(jg||oe(kg)),oi=null,pi=!1,qi=!1,ri=!1,si=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ti=ie(xg,oe(Lg)?Lg:si,wg),ui=Ug?nf.time.format:nf.time.format.utc,vi=function(){var a=[[ui("%Y/%-m/%-d"),function(){return!0}],[ui("%-m/%-d"),function(a){return a.getMonth()}],[ui("%-m/%-d"),function(a){return 1!==a.getDate()}],[ui("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[ui("%I %p"),function(a){return a.getHours()}],[ui("%I:%M"),function(a){return a.getMinutes()}],[ui(":%S"),function(a){return a.getSeconds()}],[ui(".%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)}}(),wi=[],xi=[],yi=Sg?"left":"bottom",zi=Sg?kh?"top":"bottom":kh?"right":"left",Ai=Sg?th?"bottom":"top":th?"left":"right",Bi=Sg?"left":"bottom",Ci={main:function(){return"translate("+Df.left+","+Df.top+")"},context:function(){return"translate("+Ef.left+","+Ef.top+")"},legend:function(){return"translate("+Ff.left+","+Ff.top+")"},x:function(){return"translate(0,"+(Sg?0:If)+")"},y:function(){return"translate(0,"+(Sg?If:0)+")"},y2:function(){return"translate("+(Sg?0:Gf)+","+(Sg?1:0)+")"},subx:function(){return"translate(0,"+(Sg?0:Jf)+")"},arc:function(){return"translate("+Gf/2+","+If/2+")"}},Di="right"===Ng,Ei=0,Fi=0,Gi=0,Hi=30,Ii=30,Ji=5;Sf=nf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Ki,Li=function(){var a=nf.svg.line().x(Sg?function(a){return V(a.id)(a.value)}:ud).y(Sg?ud:function(a){return V(a.id)(a.value)});return Jh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Jh?ye(b.values):b.values;return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),vg[b.id]?Ke(e,_f,V(b.id),vg[b.id]):a(e)):(c=e[0]?_f(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Sg?"M "+d+" "+c:"M "+c+" "+d)}}(),Mi=function(){var a;return a=Sg?nf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):nf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=ye(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?_f(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Sg?"M "+d+" "+c:"M "+c+" "+d)}}(),Ni=function(){var a=nf.svg.line().x(Sg?function(a){return W(a.id)(a.value)}:xd).y(Sg?xd:function(a){return W(a.id)(a.value)});return function(b){var c=ye(b.values);return Zd(b)?a(c):"M "+cg(c[0].x)+" "+W(b.id)(c[0].value)}}(),Oi=function(){};Ki=nf.svg.brush().on("brush",Te),Ki.update=function(){return Si&&Si.select("."+f.brush).call(this),this},Ki.scale=function(a){return Sg?this.y(a):this.x(a)},vf&&(Oi=nf.behavior.zoom().on("zoomstart",function(){Oi.altDomain=nf.event.sourceEvent.altKey?_f.orgDomain():null}).on("zoom",vf?Ue:null),Oi.scale=function(a){return Sg?this.y(a):this.x(a)},Oi.orgScaleExtent=function(){var a=wf?wf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Oi.updateScaleExtent=function(){var a=$b(_f.orgDomain())/$b(Wi),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Pi,Qi,Ri,Si,Ti,Ui,Vi,Wi,Xi,Yi={};if(of.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Pi.selectAll(hd(a)),d=c.filter(jf),e=c.filter(kf);of.revert(),of.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(of.data.targets)&&Kb(a,!0),cf(a)},of.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Pi.selectAll(hd(a)),d=c.filter(jf),e=c.filter(kf);of.revert(),b(d.classed(f.focused,!1)),b(e),Yd(of.data.targets)&&Lb(a),df(a)},of.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Pi.selectAll(hd(a)),d=c.filter(jf),e=c.filter(kf);b(d.classed(f.focused,!1)),b(e),Yd(of.data.targets)&&Lb(a),ef()},of.show=function(a,b){a=yc(a),b=b||{},Hc(a),Pi.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ff(a):Ti.selectAll(kd(a)).classed(f.legendItemHidden,!1),Se({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},of.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Pi.selectAll(id(a)).transition().style("opacity",0),b.withLegend?gf(a):Ti.selectAll(kd(a)).classed(f.legendItemHidden,!0),Se({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},of.toggle=function(a){Bc(a)?of.hide(a):of.show(a)},of.unzoom=function(){Ki.clear().update(),Se({withUpdateXDomain:!0})},of.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){og[b]=a.classes[b]}),"categories"in a&&mi&&(Vg=a.categories,fg.categories(Vg)),"cacheIds"in a&&_b(a.cacheIds)?void Ze(bc(a.cacheIds),a.done):void("unload"in a?_e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){$e(a)}):$e(a))},of.unload=function(a){_e(yc(a),function(){Se({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},of.selected=function(a){return nf.merge(Ri.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return nf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},of.select=function(a,b,c){yg&&Ri.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=nf.select(this),i="circle"===this.nodeName?se:ve,j="circle"===this.nodeName?te:we,k=zg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Ag(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},of.unselect=function(a,b){yg&&Ri.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=nf.select(this),g="circle"===this.nodeName?te:we,h=zg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Ag(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},of.toLine=function(a){mf(a,"line")},of.toSpline=function(a){mf(a,"spline")},of.toBar=function(a){mf(a,"bar")},of.toScatter=function(a){mf(a,"scatter")},of.toArea=function(a){mf(a,"area")},of.toAreaSpline=function(a){mf(a,"area-spline")},of.toPie=function(a){mf(a,"pie",{withTransform:!0})},of.toDonut=function(a){mf(a,"donut",{withTransform:!0})},of.groups=function(a){return c(a)?pg:(pg=a,Se(),pg)},of.xgrids=function(a){return a?(zh=a,Se(),zh):zh},of.xgrids.add=function(a){return a?of.xgrids(zh.concat(a)):void 0},of.xgrids.remove=function(a){var b=lf(a);return of.xgrids(zh.filter(b))},of.ygrids=function(a){return a?(Bh=a,Se(),Bh):Bh},of.ygrids.add=function(a){return a?of.ygrids(Bh.concat(a)):void 0},of.ygrids.remove=function(a){var b=lf(a);return of.ygrids(Bh.filter(b))},of.regions=function(a){return c(a)?Zh:(Zh=a,Se(),Zh)},of.regions.add=function(a){return c(a)?Zh:(Zh=Zh.concat(a),Se(),Zh)},of.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;Pi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Zh=Zh.filter(function(b){return b.classes.indexOf(a)<0})}),Zh},of.data.get=function(a){var b=of.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},of.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},of.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){ng[b]=a[b]}),hf(xc(of.data.targets),{withTransition:!0}),ng):ng},of.x=function(a){return arguments.length&&(mc(of.data.targets,a),Se({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),of.data.xs},of.xs=function(a){return arguments.length&&(nc(of.data.targets,a),Se({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),of.data.xs},of.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},of.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(gh=+a.y),b(a.y2)&&(ph=+a.y2)):gh=ph=+a,Se())},of.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(hh=+a.y),b(a.y2)&&(qh=+a.y2)):hh=qh=+a,Se())},of.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&of.axis.max(a.max),"undefined"!=typeof a.min&&of.axis.min(a.min))},of.legend.show=function(a){Mg||(Mg=!0,Ti.style("visibility","visible")),ff(yc(a)),Se({withTransitionForHorizontalAxis:!1})},of.legend.hide=function(a){Mg&&ne(a)&&(Mg=!1,Ti.style("visibility","hidden")),gf(yc(a)),Se({withTransitionForHorizontalAxis:!1})},of.resize=function(a){rf=a?a.width:null,sf=a?a.height:null,Xe({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},of.destroy=function(){of.data.targets=void 0,of.data.xs={},Vi.html(""),a.onresize=null},"url"in e.data)nf.xhr(e.data.url,function(a,b){var c,d=nf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=nf.csv.parse(b.response),Le(c)});else if("rows"in e.data)Le(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Le(qc(e.data.columns))}return of},"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.31"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cGf&&(Gf=0),0>If&&(If=0),Ef={top:Sg?Df.top:Lf-Kg-(Ei?0:a),right:0/0,bottom:20+(Ei?0:a),left:Sg?Ii:Df.left},Hf=Sg?Df.left-Ii-Ji:Gf,Jf=Sg?If:Lf-Ef.top-Ef.bottom,0>Hf&&(Hf=0),0>Jf&&(Jf=0),Ff={top:Ei?0:Lf-a,right:0/0,bottom:0,left:Ei?Kf-b:0},p(),Ei&&Yd(of.data.targets)&&(Ff.left=Gf/2+Nf)}function o(){Si.select("line."+f.xgridFocus).attr("x1",Sg?0:-10).attr("x2",Sg?Gf:-10).attr("y1",Sg?-10:Df.top).attr("y2",Sg?-10:If)}function p(){Nf=If/2,Mf=.95*Nf,Of=Xd(of.data.targets)?.6*Mf:0}function q(){var a=Sg?f.axisX:f.axisY,b=nf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=nf.select(qf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return rf?rf:x()}function s(){var a=sf?sf:y();return a>0?a:320}function t(){return Yd(of.data.targets)?0:tf?tf:Sg||!gh||lh?1:v("y")}function u(){var a=1;return Yd(of.data.targets)?0:uf?uf:Ei?P()+(ph&&!Sg?v("y2"):a):ph?uh||Sg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||gh?"y2"!==a||ph?(gb(a).isInner?30:40)+("y2"===a?-10:0):Ki:Mg&&!Ei?10:1}function x(){return+nf.select(qf).style("width").replace("px","")}function y(){return+nf.select(qf).style("height").replace("px","")}function z(a){return a?-5:-(Df.left-1)}function A(a){return a?-20:-1}function B(){return z(!Sg)}function C(){return A(!Sg)}function D(){return z(Sg)}function E(){return A(Sg)}function F(a){return a?Gf+2+4:Df.left+20}function G(a){return a?80:If+2}function H(){return F(!Sg)}function I(){return G(!Sg)}function J(){return F(Sg)}function K(){return G(Sg)}function L(){var a=Sg?If:Gf,b=vc(),c=Vb()*(Ud(of.data.targets)?(b-(ni?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){Fi=a}function N(a){Gi=a}function O(a){Hi=a}function P(){return Mg?Ei?Gi*(Fi+1):Kf:0}function Q(){return Mg?Ei?Lf:Hi*(Fi+1):0}function R(){var a,b=!_f;Tf=Sg?1:0,Uf=Sg?If:Gf,Vf=Sg?0:If,Wf=Sg?Gf:1,Xf=Tf,Yf=Uf,Zf=Sg?0:Jf,$f=Sg?Hf:1,_f=T(Tf,Uf,b?void 0:_f.domain(),function(){return fg.tickOffset()}),ag=U(Vf,Wf),bg=U(Vf,Wf),cg=T(Tf,Uf,Xi,function(a){return a%1?0:ig.tickOffset()}),dg=U(Zf,$f),eg=U(Zf,$f),a=$(),fg=X(_f,zi,a),ig=X(cg,Ci,a),gg=Y(ag,Ai,mh,oh),hg=Y(bg,Bi,vh,xh),b||(Li.scale(cg),vf&&Pi.scale(_f)),S()}function S(){Pf=Db(),Qf=Eb(),Rf=Eb(.98)}function T(a,b,e,f){var g=(mi?nf.time.scale():nf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),ni){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return nf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?bg:ag}function W(a){return"y2"===Z(a)?eg:dg}function X(a,b,c){var d=(ni?Bb():nf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),ni?(d.tickCentered(Wg),ne(Yg)&&(Yg=!1)):d.tickOffset=function(){var a=Sg?If:Gf;return a*Vb()/vc()/2},ni&&d.categories(Vg),d}function Y(a,b,c,d){return nf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in qg?qg[a]:"y"}function $(){var a=mi?wi:ni?Oc:function(a){return 0>a?a.toFixed(0):a};return Xg&&("function"==typeof Xg?a=Xg:mi&&(a=function(a){return a?vi(Xg)(a):""})),a}function _(a){var b;return"y"===a?b=kh:"y2"===a?b=th:"x"===a&&(b=fh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?kh=b:"y2"===a?th=b:"x"===a&&(fh=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Sg?"inner-top":"inner-right")}function eb(){return cb("y",Sg?"inner-right":"inner-top")}function fb(){return cb("y2",Sg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?Gf/2:Gf:b.isBottom?-If:b.isMiddle?-If/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Sg,db())}function ob(){return kb(Sg,eb())}function pb(){return kb(Sg,fb())}function qb(){return lb(!Sg,db())}function rb(){return lb(Sg,eb())}function sb(){return lb(Sg,fb())}function tb(){var a=db();return Sg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Sg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Sg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Sg,db())}function xb(){return mb(Sg,eb())}function yb(){return mb(Sg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return nf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Si.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Si.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Si.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+o)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Mc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return nf.min(Object.keys(i).map(function(a){return nf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(pg.length>0)for(g=Nc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return nf.max(Object.keys(i).map(function(a){return nf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?rh:ih,n="y2"===c?qh:hh,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?sh:jh,r=pd()&&Sg;return 0===l.length?"y2"===c?bg.domain():ag.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=qd(o,p),j=$b(ag.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&nh&&(f=b(nh.top)?nh.top:e,g=b(nh.bottom)?nh.bottom:e),"y2"===c&&wh&&(f=b(wh.top)?wh.top:e,g=b(wh.bottom)?wh.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Xi),c=$b(_f.domain());return a||0===c?1:b/c}function Wb(a){return ch?ch:nf.min(a,function(a){return nf.min(a.values,function(a){return a.x})})}function Xb(a){return bh?bh:nf.max(a,function(a){return nf.max(a.values,function(a){return a.x})})}function Yb(a,c){var d,e,f,g,h=c[0],i=c[1],j=Math.abs(h-i);return ni?e=0:Ud(a)?(d=vc(),e=d>1?j/(d-1)/2:.5):e=.01*j,"object"==typeof dh&&oe(dh)?(f=b(dh.left)?dh.left:e,g=b(dh.right)?dh.right:e):f=g="number"==typeof dh?dh:e,{left:f,right:g}}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=0,g=0;return(c||0===c)&&(f=mi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=mi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return jg&&a===jg||oe(kg)&&pe(kg,a)}function fc(a){return!ec(a)}function gc(a){return jg?jg:oe(kg)?kg[a]:null}function hc(a,b){var c,d=b&&oe(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=of.data.xs[b])}),c}function ic(a,b){return a in of.data.xs&&of.data.xs[a]&&of.data.xs[a][b]?of.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){kg[b]=a[b]})}function kc(a){return 1===nf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=ng[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),of.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=mi?a?a instanceof Date?a:je(a):je(ic(b,c)):oi&&!ni?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?of.data.xs[c]=a.map(function(a){return a[f]}).filter(b):jg?(d=Object.keys(of.data.xs),of.data.xs[c]=d.length>0?of.data.xs[d[0]]:void 0):oe(kg)&&(of.data.xs[c]=hc(f,of.data.targets)):of.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!of.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=mg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return oi&&ni&&0===c&&g&&(0===e&&(Vg=[]),Vg.push(g)),("undefined"==typeof a[b]||of.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),rg&&Sd(xc(c).filter(function(a){return!(a in sg)}),rg),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function tc(a){return a>0&&of.data.targets[0].values[a-1]?of.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?of.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?of.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(of.data.targets)}function zc(a,b){var c,d=xc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(mi?new Date(h):h);i.push(d)}return mi||(i=i.sort(function(a,b){return a-b})),i}function Gc(a){xi=xi.concat(a)}function Hc(a){xi=xi.filter(function(b){return a.indexOf(b)<0})}function Ic(a){yi=yi.concat(a)}function Jc(a){yi=yi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=qe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return nf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Ed(){return ug&&"desc"===ug.toLowerCase()}function Fd(){return ug&&"asc"===ug.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof ug&&a.sort(ug),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(of.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});_h&&0!==m.length&&(Vi.html(ci(a,$(),l,ui)).style("display","block"),d=Vi.property("offsetWidth"),e=Vi.property("offsetHeight"),k?(g=Gf/2+c[0],i=If/2+c[1]+20):(Sg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=_f(m[0].x)+20):(f=q(),g=f+t()+_f(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Vi.style("top",i+"px").style("left",g+"px"))}function Id(){Vi.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});_h&&(Vd(of.data.targets)||Yd(of.data.targets)||Si.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Sg?"y1":"x1",ud).attr(Sg?"y2":"x2",ud))}function Kd(){Si.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?_f(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Lh?Lh:b?2*a.tickOffset()*Mh/b:0}function Sd(a,b){yc(a).forEach(function(a){Zi[a]=b===sg[a],sg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){sg[a.id]===b&&(c=!0),a.id in sg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in sg)||"line"===sg[b]||"spline"===sg[b]||"area"===sg[b]||"area-spline"===sg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===sg[b]||"area-spline"===sg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===sg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===sg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===sg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===sg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(a){return ce(a)&&Vh||be(a)&&Ph}function ie(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function je(b){var c;try{c=lg?nf.time.format(lg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+lg)}return c}function ke(a,b){var c=nf.mouse(a),d=nf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function pe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function qe(a,b){var c="y"===Z(a.id)?ag:bg,d=Sg?1:0,e=Sg?0:1;return Math.pow(_f(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function re(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function se(a,b,c){Fg(b,a.node()),Si.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Sg?Md:Ld).attr("cy",Sg?Ld:Md).attr("stroke",function(){return ui(b)}).attr("r",1.4*Jh).transition().duration(100).attr("r",Jh)}function te(a,b,c){Gg(b,a.node()),Si.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ue(a,b,c,d){a?se(b,c,d):te(b,c,d)}function ve(a,b){Fg(b,a.node()),a.transition().duration(100).style("fill",function(){return nf.rgb(ui(b)).darker(1)})}function we(a,b){Gg(b,a.node()),a.transition().duration(100).style("fill",function(){return ui(b)})}function xe(a,b,c,d){a?ve(b,c,d):we(b,c,d)}function ye(a){return a.filter(function(a){return b(a.value)})}function ze(a,c){return(c?Si.selectAll("."+f.circles+gd(c)):Si).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ae(a,b){ze(a,b).classed(f.EXPANDED,!0).attr("r",Ih)}function Be(a){ze(a).filter(function(){return nf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Fh)}function Ce(a){return Si.selectAll("."+f.bar+(b(a)?"-"+a:""))}function De(a){Ce(a).classed(f.EXPANDED,!0)}function Ee(a){Ce(a).classed(f.EXPANDED,!1)}function Fe(a,b){var c=Je(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 Ge(a,b){var c=Je(a,!1),d=b?He:Ie;return function(a,b){return d(c(a,b),a,this)}}function He(a,b){var c;return Sg?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ie(a,b,c){var d=c.getBoundingClientRect();return Sg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Je(a,b){var c=a.__max__+1,d=Rd(fg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return 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 Ke(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 Le(b){var c,d,e;if(Wi=nf.select(qf),Wi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Wi.html(""),Wi.classed("c3",!0),of.data.xs={},of.data.targets=rc(b),n(),R(),_f.domain(nf.extent(Zb(of.data.targets))),ag.domain(Ub(of.data.targets,"y")),bg.domain(Ub(of.data.targets,"y2")),cg.domain(_f.domain()),dg.domain(ag.domain()),eg.domain(bg.domain()),Xi=_f.domain(),Li.scale(cg),vf&&Pi.scale(_f),Qi=Wi.append("svg").attr("width",Gf+Df.left+Df.right).attr("height",If+Df.top+Df.bottom).on("mouseenter",yf).on("mouseleave",zf),Ri=Qi.append("defs"),Ri.append("clipPath").attr("id",gi).append("rect").attr("width",Gf).attr("height",If),Ri.append("clipPath").attr("id",hi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Ri.append("clipPath").attr("id",ii).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Si=Qi.append("g").attr("transform",Di.main),Ti=Jg?Qi.append("g").attr("transform",Di.context):null,Ui=Qi.append("g").attr("transform",Di.legend),Mg||(Ui.style("visibility","hidden"),yi=xc(of.data.targets)),Vi=nf.select(qf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),hf(xc(of.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Si.append("g").attr("class",f.axisX).attr("clip-path",Sg?"":ki).attr("transform",Di.x).append("text").attr("class",f.axisXLabel).attr("transform",Sg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),gh&&Si.append("g").attr("class",f.axisY).attr("clip-path",Sg?li:"").attr("transform",Di.y).append("text").attr("class",f.axisYLabel).attr("transform",Sg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),ph&&Si.append("g").attr("class",f.axisY2).attr("transform",Di.y2).append("text").attr("class",f.axisY2Label).attr("transform",Sg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Si.append("g").attr("clip-path",ji).attr("class",f.grid),yh&&d.append("g").attr("class",f.xgrids),oe(Ah)&&d.append("g").attr("class",f.xgridLines),Gh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Bh&&d.append("g").attr("class",f.ygrids),oe(Ch)&&d.append("g").attr("class",f.ygridLines),Si.append("g").attr("clip-path",ji).attr("class",f.regions),Si.append("g").attr("clip-path",ji).attr("class",f.chart),c=Si.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",vf?Sg?"ns-resize":"ew-resize":null),Si.select("."+f.chart).append("g").attr("class",f.chartBars),Si.select("."+f.chart).append("g").attr("class",f.chartLines),Si.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Di.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Si.select("."+f.chart).append("g").attr("class",f.chartTexts),vf&&Si.insert("rect",xf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Gf).attr("height",If).style("opacity",0).style("cursor",Sg?"ns-resize":"ew-resize").call(Pi).on("dblclick.zoom",null),eh&&Li.extent("function"!=typeof eh?eh:eh(Zb())),Jg&&(Ti.append("g").attr("clip-path",ji).attr("class",f.chart),Ti.select("."+f.chart).append("g").attr("class",f.chartBars),Ti.select("."+f.chart).append("g").attr("class",f.chartLines),Ti.append("g").attr("clip-path",ji).attr("class",f.brush).call(Li).selectAll("rect").attr(Sg?"width":"height",Sg?Hf:Jf),Ti.append("g").attr("class",f.axisX).attr("transform",Di.subx).attr("clip-path",Sg?"":ki)),Ye(of.data.targets),Sg?Si.select("."+f.axisX).style("opacity",0).call(fg):(Si.select("."+f.axisY).style("opacity",0).call(gg),Si.select("."+f.axisY2).style("opacity",0).call(hg)),Se({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),di){if(mi&&"string"==typeof ei){for(ei=je(ei),e=0;e0){d=[];for(var g in ng)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=xe,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 Qe(a){Yd(of.data.targets)||yg&&(pi=a,Si.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),qi=!0,Hg())}function Re(){Yd(of.data.targets)||yg&&(Si.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Si.selectAll("."+f.shape).classed(f.INCLUDED,!1),qi=!1,Ig())}function Se(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Nd(),U=Yd(of.data.targets),V=Dc(of.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?Cf:0,O=B?N:0,P=C?N:0,H&&Mg&&hf(xc(of.data.targets),a),G&&(_f.domain(nf.extent(Zb(V))),Xi=_f.domain(),vf&&Pi.scale(_f).updateScaleExtent(),cg.domain(_f.domain()),Li.scale(cg)),F&&(_f.domain(Li.empty()?Xi:Li.extent()),vf&&Pi.scale(_f).updateScaleExtent()),ag.domain(Ub(V,"y")),bg.domain(Ub(V,"y2")),Vd(V)||(Q=ah?ah:Fc(Ec(V)),fg.tickValues(Q),ig.tickValues(Q)),c=Si.select("."+f.axisX).style("opacity",U?0:1),(Sg||D)&&(c=c.transition().duration(P)),c.call(fg),e=Si.select("."+f.axisY).style("opacity",U?0:1),(!Sg||D)&&(e=e.transition().duration(P)),e.call(gg),Si.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(hg),F)if(Yg&&Q){for(R=1;R=0&&nf.select(this).style("display",b%S?"none":"block")})}else nf.selectAll("."+f.axisX+" .tick text").style("display","block");if(I=Fe(T),K=Ge(T,!0),M=Ge(T,!1),Ab(),dg.domain(ag.domain()),eg.domain(bg.domain()),Vi.style("display","none"),o(),Si.select("line."+f.xgridFocus).style("visibility","hidden"),yh){if("year"===zh){h=[];for(var W=Zb(),X=W[0].getFullYear(),Y=W[1].getFullYear(),Z=X;Y>=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=_f.ticks(10);g=Si.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Sg?0:function(a){return _f(a)-fg.tickOffset()}).attr("x2",Sg?Gf:function(a){return _f(a)-fg.tickOffset()}).attr("y1",Sg?function(a){return _f(a)-fg.tickOffset()}:Df.top).attr("y2",Sg?function(a){return _f(a)-fg.tickOffset()}:If).style("opacity",function(){return+nf.select(this).attr(Sg?"y1":"x1")===(Sg?If:0)?0:1}),g.exit().remove()}oe(Ah)&&(i=Si.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Ah),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Sg?"":"rotate(-90)").attr("dx",Sg?0:-Df.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Sg?0:vd).attr("x2",Sg?Gf:vd).attr("y1",Sg?vd:Df.top).attr("y2",Sg?vd:If).style("opacity",1),i.select("text").transition().duration(N).attr("x",Sg?Gf:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&Bh&&(k=Si.select("."+f.ygrids).selectAll("."+f.ygrid).data(ag.ticks(Dh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Sg?ag:0).attr("x2",Sg?ag:Gf).attr("y1",Sg?0:ag).attr("y2",Sg?If:ag),k.exit().remove()),y&&oe(Ch)&&(l=Si.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Ch),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Sg?"rotate(-90)":"").attr("dx",Sg?0:-Df.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Sg?wd:0).attr("x2",Sg?wd:Gf).attr("y1",Sg?0:wd).attr("y2",Sg?If:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Sg?0:Gf).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Si.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ui(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Si.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Sg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Si.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Mi).style("opacity",1),Si.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Ni).style("opacity",Yi),n=Si.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",Fh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Sg?Md:Ld).attr("cy",Sg?Ld:Md),n.exit().remove(),Si.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=nf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Si.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Si.select("."+f.chartArcsTitle).style("opacity",Xd(of.data.targets)?1:0),Jg&&(null!==nf.event&&"zoom"===nf.event.type&&Li.extent(_f.orgDomain()).update(),z&&(Ti.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(ig),Li.empty()||Li.extent(_f.orgDomain()).update(),J=Fe(T,!0),s=Ti.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ui(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Ti.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Oi).style("opacity",1))),Si.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Si.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Sg?Md:Ld).attr("cy",Sg?Ld:Md),t=Si.select("."+f.eventRects),oe(kg)&&!kc(kg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Si.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ne(u.enter()),u.attr("x",0).attr("y",0).attr("width",Gf).attr("height",If)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),oi&&!ni?(x=function(a,b){var c=tc(b),d=uc(b),e=of.data.xs[a.id][b];return(_f(d?d:e+50)-_f(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=of.data.xs[a.id][b];return(_f(d)+_f(c?c:d-50))/2}):(x=L(),w=function(a){return _f(a.x)-x/2}),v=wc(),Si.select("."+f.eventRects).datum(v?v.values:[]),u=Si.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Me(u.enter()),u.attr("class",ad).attr("x",Sg?0:w).attr("y",Sg?w:0).attr("width",Sg?Gf:x).attr("height",Sg?x:If),u.exit().remove()),q=Si.select("."+f.regions).selectAll("rect."+f.region).data($h),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Sg?0:cc).attr("y",Sg?cc:Df.top).attr("width",Sg?Gf:dc).attr("height",Sg?dc:If).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),xc(of.data.targets).forEach(function(a){Zi[a]=!0})}}function Te(){Se({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ue(){return"mousemove"===nf.event.sourceEvent.type&&Pi.altDomain?(_f.domain(Pi.altDomain),void Pi.scale(_f).updateScaleExtent()):(ni&&_f.orgDomain()[0]===Xi[0]&&_f.domain([Xi[0]-1e-10,_f.orgDomain()[1]]),Se({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===nf.event.sourceEvent.type&&(ri=!0)))}function Ve(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function We(){Qi.attr("width",Kf).attr("height",Lf),Qi.select("#"+gi).select("rect").attr("width",Gf).attr("height",If),Qi.select("#"+hi).select("rect").attr("width",H),Qi.select("#"+ii).select("rect").attr("width",J),Qi.select("."+f.zoomRect).attr("width",Gf).attr("height",If)}function Xe(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),We(),m(a.withTransition),Se(a)}function Ye(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Si.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ui(a)}),e=Si.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ui(a)}).style("stroke","none").style("cursor",function(a){return Ag(a)?"pointer":null}),c=Si.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ui(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Yi=+nf.select(this).style("opacity"),0}).style("fill",function(a){return ui(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ui(a)}).style("cursor",function(a){return Ag(a)?"pointer":null}),a.forEach(function(a){Si.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Si.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Sf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ui(a.data)}).style("cursor",function(a){return Ag(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),cf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,nf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),ef(),Id(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Jg&&(n=Ti.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ui(a)}),l=Ti.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ui(a)})),Qi.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ze(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),of.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Ei?j:i,l=Ei?Q():P();return d&&(w=0,C=0,t=0,u=0),Mg&&!Cc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Ei?u:t,void(Rg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,Ei?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Ui.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Og?Og(a):of.toggle(a)}).on("mouseover",function(a){of.focus(a),"function"==typeof Pg&&Pg(a)}).on("mouseout",function(a){of.revert(),"function"==typeof Qg&&Qg(a)}),l.append("text").text(function(a){return d(ng[a])?ng[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",Ei?g:-200).attr("y",Ei?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ei?h:-200).attr("y",Ei?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return ui(a)}).attr("x",Ei?g:-200).attr("y",Ei?-200:i).attr("width",10).attr("height",10),Ui.selectAll("text").data(a).text(function(a){return d(ng[a])?ng[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ui.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ui.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),We(),q&&m(p)}function jf(a){return zc(of.data.targets,a.id)}function kf(a){return"data"in a&&zc(of.data.targets,a.data.id)}function lf(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 mf(a,b,c){var d=!Yd(of.data.targets);Sd(a,b),Xe(c?c:{withTransitionForAxis:d})}var nf=a.d3?a.d3:a.require?a.require("d3"):void 0,of={data:{},axis:{},legend:{}},pf={},qf=h(["bindto"],"#chart"),rf=h(["size","width"]),sf=h(["size","height"]),tf=h(["padding","left"]),uf=h(["padding","right"]),vf=h(["zoom","enabled"],!1),wf=h(["zoom","extent"]),xf=h(["zoom","privileged"],!1),yf=h(["onenter"],function(){}),zf=h(["onleave"],function(){}),Af=h(["onresize"],function(){}),Bf=h(["onresized"],function(){}),Cf=h(["transition","duration"],350);g("data","data is required in config");var Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg=h(["data","x"]),kg=h(["data","xs"],{}),lg=h(["data","x_format"]),mg=h(["data","id_converter"],function(a){return a}),ng=h(["data","names"],{}),og=h(["data","classes"],{}),pg=h(["data","groups"],[]),qg=h(["data","axes"],{}),rg=h(["data","type"]),sg=h(["data","types"],{}),tg=h(["data","labels"],{}),ug=h(["data","order"]),vg=h(["data","regions"],{}),wg=h(["data","color"]),xg=h(["data","colors"],{}),yg=h(["data","selection","enabled"],!1),zg=h(["data","selection","grouped"],!1),Ag=h(["data","selection","isselectable"],function(){return!0}),Bg=h(["data","selection","multiple"],!0),Cg=h(["data","onclick"],function(){}),Dg=h(["data","onenter"],function(){}),Eg=h(["data","onleave"],function(){}),Fg=h(["data","onselected"],function(){}),Gg=h(["data","onunselected"],function(){}),Hg=h(["data","ondragstart"],function(){}),Ig=h(["data","ondragend"],function(){}),Jg=h(["subchart","show"],!1),Kg=Jg?h(["subchart","size","height"],60):0,Lg=h(["color","pattern"],[]),Mg=h(["legend","show"],!0),Ng=h(["legend","position"],"bottom"),Og=h(["legend","item","onclick"]),Pg=h(["legend","item","onmouseover"]),Qg=h(["legend","item","onmouseout"]),Rg=h(["legend","equally"],!1),Sg=h(["axis","rotated"],!1),Tg=h(["axis","x","type"],"indexed"),Ug=h(["axis","x","localtime"],!0),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"],10),$g=h(["axis","x","tick","count"]),_g=h(["axis","x","tick","fit"],!1),ah=h(["axis","x","tick","values"],null),bh=h(["axis","x","max"]),ch=h(["axis","x","min"]),dh=h(["axis","x","padding"],{}),eh=h(["axis","x","default"]),fh=h(["axis","x","label"],{}),gh=h(["axis","y","show"],!0),hh=h(["axis","y","max"]),ih=h(["axis","y","min"]),jh=h(["axis","y","center"]),kh=h(["axis","y","label"],{}),lh=h(["axis","y","inner"],!1),mh=h(["axis","y","tick","format"]),nh=h(["axis","y","padding"],{}),oh=h(["axis","y","ticks"],10),ph=h(["axis","y2","show"],!1),qh=h(["axis","y2","max"]),rh=h(["axis","y2","min"]),sh=h(["axis","y2","center"]),th=h(["axis","y2","label"],{}),uh=h(["axis","y2","inner"],!1),vh=h(["axis","y2","tick","format"]),wh=h(["axis","y2","padding"],{}),xh=h(["axis","y2","ticks"],10),yh=h(["grid","x","show"],!1),zh=h(["grid","x","type"],"tick"),Ah=h(["grid","x","lines"],[]),Bh=h(["grid","y","show"],!1),Ch=h(["grid","y","lines"],[]),Dh=h(["grid","y","ticks"],10),Eh=h(["point","show"],!0),Fh=Eh?h(["point","r"],2.5):0,Gh=h(["point","focus","line","enabled"],!0),Hh=h(["point","focus","expand","enabled"],!0),Ih=h(["point","focus","expand","r"],Hh?4:Fh),Jh=h(["point","focus","select","r"],8),Kh=h(["line","connect_null"],!1),Lh=h(["bar","width"]),Mh=h(["bar","width","ratio"],.6),Nh=h(["pie","label","show"],!0),Oh=h(["pie","label","format"]),Ph=h(["pie","expand"],!0),Qh=h(["pie","onclick"],function(){}),Rh=h(["pie","onmouseover"],function(){}),Sh=h(["pie","onmouseout"],function(){}),Th=h(["donut","label","show"],!0),Uh=h(["donut","label","format"]),Vh=h(["donut","expand"],!0),Wh=h(["donut","title"],""),Xh=h(["donut","onclick"],function(){}),Yh=h(["donut","onmouseover"],function(){}),Zh=h(["donut","onmouseout"],function(){}),$h=h(["regions"],[]),_h=h(["tooltip","show"],!0),ai=h(["tooltip","format","title"]),bi=h(["tooltip","format","value"]),ci=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ai?ai:b,l=bi?bi: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+""}),di=h(["tooltip","init","show"],!1),ei=h(["tooltip","init","x"],0),fi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),gi=("string"==typeof qf?qf.replace("#",""):qf.id)+"-clip",hi=gi+"-xaxis",ii=gi+"-yaxis",ji=i(gi),ki=i(hi),li=i(ii),mi="timeseries"===Tg,ni="categorized"===Tg,oi=!mi&&(jg||oe(kg)),pi=null,qi=!1,ri=!1,si=!1,ti=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ui=ie(xg,oe(Lg)?Lg:ti,wg),vi=Ug?nf.time.format:nf.time.format.utc,wi=function(){var a=[[vi("%Y/%-m/%-d"),function(){return!0}],[vi("%-m/%-d"),function(a){return a.getMonth()}],[vi("%-m/%-d"),function(a){return 1!==a.getDate()}],[vi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[vi("%I %p"),function(a){return a.getHours()}],[vi("%I:%M"),function(a){return a.getMinutes()}],[vi(":%S"),function(a){return a.getSeconds()}],[vi(".%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)}}(),xi=[],yi=[],zi=Sg?"left":"bottom",Ai=Sg?lh?"top":"bottom":lh?"right":"left",Bi=Sg?uh?"bottom":"top":uh?"left":"right",Ci=Sg?"left":"bottom",Di={main:function(){return"translate("+Df.left+","+Df.top+")"},context:function(){return"translate("+Ef.left+","+Ef.top+")"},legend:function(){return"translate("+Ff.left+","+Ff.top+")"},x:function(){return"translate(0,"+(Sg?0:If)+")"},y:function(){return"translate(0,"+(Sg?If:0)+")"},y2:function(){return"translate("+(Sg?0:Gf)+","+(Sg?1:0)+")"},subx:function(){return"translate(0,"+(Sg?0:Jf)+")"},arc:function(){return"translate("+Gf/2+","+If/2+")"}},Ei="right"===Ng,Fi=0,Gi=0,Hi=0,Ii=30,Ji=30,Ki=5;Sf=nf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Li,Mi=function(){var a=nf.svg.line().x(Sg?function(a){return V(a.id)(a.value)}:ud).y(Sg?ud:function(a){return V(a.id)(a.value)});return Kh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Kh?ye(b.values):b.values;return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),vg[b.id]?Ke(e,_f,V(b.id),vg[b.id]):a(e)):(c=e[0]?_f(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Sg?"M "+d+" "+c:"M "+c+" "+d)}}(),Ni=function(){var a;return a=Sg?nf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):nf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=ye(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?_f(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Sg?"M "+d+" "+c:"M "+c+" "+d)}}(),Oi=function(){var a=nf.svg.line().x(Sg?function(a){return W(a.id)(a.value)}:xd).y(Sg?xd:function(a){return W(a.id)(a.value)});return function(b){var c=ye(b.values);return Zd(b)?a(c):"M "+cg(c[0].x)+" "+W(b.id)(c[0].value)}}(),Pi=function(){};Li=nf.svg.brush().on("brush",Te),Li.update=function(){return Ti&&Ti.select("."+f.brush).call(this),this},Li.scale=function(a){return Sg?this.y(a):this.x(a)},vf&&(Pi=nf.behavior.zoom().on("zoomstart",function(){Pi.altDomain=nf.event.sourceEvent.altKey?_f.orgDomain():null}).on("zoom",vf?Ue:null),Pi.scale=function(a){return Sg?this.y(a):this.x(a)},Pi.orgScaleExtent=function(){var a=wf?wf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Pi.updateScaleExtent=function(){var a=$b(_f.orgDomain())/$b(Xi),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Qi,Ri,Si,Ti,Ui,Vi,Wi,Xi,Yi,Zi={};if(of.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Qi.selectAll(hd(a)),d=c.filter(jf),e=c.filter(kf);of.revert(),of.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(of.data.targets)&&Kb(a,!0),cf(a)},of.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Qi.selectAll(hd(a)),d=c.filter(jf),e=c.filter(kf);of.revert(),b(d.classed(f.focused,!1)),b(e),Yd(of.data.targets)&&Lb(a),df(a)},of.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Qi.selectAll(hd(a)),d=c.filter(jf),e=c.filter(kf);b(d.classed(f.focused,!1)),b(e),Yd(of.data.targets)&&Lb(a),ef()},of.show=function(a,b){a=yc(a),b=b||{},Hc(a),Qi.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ff(a):Ui.selectAll(kd(a)).classed(f.legendItemHidden,!1),Se({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},of.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Qi.selectAll(id(a)).transition().style("opacity",0),b.withLegend?gf(a):Ui.selectAll(kd(a)).classed(f.legendItemHidden,!0),Se({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},of.toggle=function(a){Bc(a)?of.hide(a):of.show(a)},of.unzoom=function(){Li.clear().update(),Se({withUpdateXDomain:!0})},of.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){og[b]=a.classes[b]}),"categories"in a&&ni&&(Vg=a.categories,fg.categories(Vg)),"cacheIds"in a&&_b(a.cacheIds)?void Ze(bc(a.cacheIds),a.done):void("unload"in a?_e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){$e(a)}):$e(a))},of.unload=function(a){_e(yc(a),function(){Se({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},of.selected=function(a){return nf.merge(Si.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return nf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},of.select=function(a,b,c){yg&&Si.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=nf.select(this),i="circle"===this.nodeName?se:ve,j="circle"===this.nodeName?te:we,k=zg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Ag(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},of.unselect=function(a,b){yg&&Si.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=nf.select(this),g="circle"===this.nodeName?te:we,h=zg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Ag(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},of.toLine=function(a){mf(a,"line")},of.toSpline=function(a){mf(a,"spline")},of.toBar=function(a){mf(a,"bar")},of.toScatter=function(a){mf(a,"scatter")},of.toArea=function(a){mf(a,"area")},of.toAreaSpline=function(a){mf(a,"area-spline")},of.toPie=function(a){mf(a,"pie",{withTransform:!0})},of.toDonut=function(a){mf(a,"donut",{withTransform:!0})},of.groups=function(a){return c(a)?pg:(pg=a,Se(),pg)},of.xgrids=function(a){return a?(Ah=a,Se(),Ah):Ah},of.xgrids.add=function(a){return a?of.xgrids(Ah.concat(a)):void 0},of.xgrids.remove=function(a){var b=lf(a);return of.xgrids(Ah.filter(b))},of.ygrids=function(a){return a?(Ch=a,Se(),Ch):Ch},of.ygrids.add=function(a){return a?of.ygrids(Ch.concat(a)):void 0},of.ygrids.remove=function(a){var b=lf(a);return of.ygrids(Ch.filter(b))},of.regions=function(a){return c(a)?$h:($h=a,Se(),$h)},of.regions.add=function(a){return c(a)?$h:($h=$h.concat(a),Se(),$h) +},of.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;Qi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),$h=$h.filter(function(b){return b.classes.indexOf(a)<0})}),$h},of.data.get=function(a){var b=of.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},of.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},of.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){ng[b]=a[b]}),hf(xc(of.data.targets),{withTransition:!0}),ng):ng},of.x=function(a){return arguments.length&&(mc(of.data.targets,a),Se({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),of.data.xs},of.xs=function(a){return arguments.length&&(nc(of.data.targets,a),Se({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),of.data.xs},of.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},of.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(hh=+a.y),b(a.y2)&&(qh=+a.y2)):hh=qh=+a,Se())},of.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(ih=+a.y),b(a.y2)&&(rh=+a.y2)):ih=rh=+a,Se())},of.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&of.axis.max(a.max),"undefined"!=typeof a.min&&of.axis.min(a.min))},of.legend.show=function(a){Mg||(Mg=!0,Ui.style("visibility","visible")),ff(yc(a)),Se({withTransitionForHorizontalAxis:!1})},of.legend.hide=function(a){Mg&&ne(a)&&(Mg=!1,Ui.style("visibility","hidden")),gf(yc(a)),Se({withTransitionForHorizontalAxis:!1})},of.resize=function(a){rf=a?a.width:null,sf=a?a.height:null,Xe({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},of.destroy=function(){of.data.targets=void 0,of.data.xs={},Wi.html(""),a.onresize=null},"url"in e.data)nf.xhr(e.data.url,function(a,b){var c,d=nf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=nf.csv.parse(b.response),Le(c)});else if("rows"in e.data)Le(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Le(qc(e.data.columns))}return of},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 560a519ea38c64dc81fd6dbdb5477589bd4dde8b Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Sun, 20 Apr 2014 23:10:47 +0900 Subject: [PATCH 048/178] Enable ygrids for y2 - #132 --- c3.js | 3 ++- c3.min.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/c3.js b/c3.js index 0889ab2..9727bdf 100644 --- a/c3.js +++ b/c3.js @@ -1690,7 +1690,8 @@ return x(isTimeSeries ? parseDate(d.value) : d.value); } function yv(d) { - return y(d.value); + var yScale = d.axis && d.axis === 'y2' ? y2 : y; + return yScale(d.value); } function subxx(d) { return subX(d.x); diff --git a/c3.min.js b/c3.min.js index aee452e..019c825 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.31"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cGf&&(Gf=0),0>If&&(If=0),Ef={top:Sg?Df.top:Lf-Kg-(Ei?0:a),right:0/0,bottom:20+(Ei?0:a),left:Sg?Ii:Df.left},Hf=Sg?Df.left-Ii-Ji:Gf,Jf=Sg?If:Lf-Ef.top-Ef.bottom,0>Hf&&(Hf=0),0>Jf&&(Jf=0),Ff={top:Ei?0:Lf-a,right:0/0,bottom:0,left:Ei?Kf-b:0},p(),Ei&&Yd(of.data.targets)&&(Ff.left=Gf/2+Nf)}function o(){Si.select("line."+f.xgridFocus).attr("x1",Sg?0:-10).attr("x2",Sg?Gf:-10).attr("y1",Sg?-10:Df.top).attr("y2",Sg?-10:If)}function p(){Nf=If/2,Mf=.95*Nf,Of=Xd(of.data.targets)?.6*Mf:0}function q(){var a=Sg?f.axisX:f.axisY,b=nf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=nf.select(qf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return rf?rf:x()}function s(){var a=sf?sf:y();return a>0?a:320}function t(){return Yd(of.data.targets)?0:tf?tf:Sg||!gh||lh?1:v("y")}function u(){var a=1;return Yd(of.data.targets)?0:uf?uf:Ei?P()+(ph&&!Sg?v("y2"):a):ph?uh||Sg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||gh?"y2"!==a||ph?(gb(a).isInner?30:40)+("y2"===a?-10:0):Ki:Mg&&!Ei?10:1}function x(){return+nf.select(qf).style("width").replace("px","")}function y(){return+nf.select(qf).style("height").replace("px","")}function z(a){return a?-5:-(Df.left-1)}function A(a){return a?-20:-1}function B(){return z(!Sg)}function C(){return A(!Sg)}function D(){return z(Sg)}function E(){return A(Sg)}function F(a){return a?Gf+2+4:Df.left+20}function G(a){return a?80:If+2}function H(){return F(!Sg)}function I(){return G(!Sg)}function J(){return F(Sg)}function K(){return G(Sg)}function L(){var a=Sg?If:Gf,b=vc(),c=Vb()*(Ud(of.data.targets)?(b-(ni?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){Fi=a}function N(a){Gi=a}function O(a){Hi=a}function P(){return Mg?Ei?Gi*(Fi+1):Kf:0}function Q(){return Mg?Ei?Lf:Hi*(Fi+1):0}function R(){var a,b=!_f;Tf=Sg?1:0,Uf=Sg?If:Gf,Vf=Sg?0:If,Wf=Sg?Gf:1,Xf=Tf,Yf=Uf,Zf=Sg?0:Jf,$f=Sg?Hf:1,_f=T(Tf,Uf,b?void 0:_f.domain(),function(){return fg.tickOffset()}),ag=U(Vf,Wf),bg=U(Vf,Wf),cg=T(Tf,Uf,Xi,function(a){return a%1?0:ig.tickOffset()}),dg=U(Zf,$f),eg=U(Zf,$f),a=$(),fg=X(_f,zi,a),ig=X(cg,Ci,a),gg=Y(ag,Ai,mh,oh),hg=Y(bg,Bi,vh,xh),b||(Li.scale(cg),vf&&Pi.scale(_f)),S()}function S(){Pf=Db(),Qf=Eb(),Rf=Eb(.98)}function T(a,b,e,f){var g=(mi?nf.time.scale():nf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),ni){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return nf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?bg:ag}function W(a){return"y2"===Z(a)?eg:dg}function X(a,b,c){var d=(ni?Bb():nf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),ni?(d.tickCentered(Wg),ne(Yg)&&(Yg=!1)):d.tickOffset=function(){var a=Sg?If:Gf;return a*Vb()/vc()/2},ni&&d.categories(Vg),d}function Y(a,b,c,d){return nf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in qg?qg[a]:"y"}function $(){var a=mi?wi:ni?Oc:function(a){return 0>a?a.toFixed(0):a};return Xg&&("function"==typeof Xg?a=Xg:mi&&(a=function(a){return a?vi(Xg)(a):""})),a}function _(a){var b;return"y"===a?b=kh:"y2"===a?b=th:"x"===a&&(b=fh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?kh=b:"y2"===a?th=b:"x"===a&&(fh=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Sg?"inner-top":"inner-right")}function eb(){return cb("y",Sg?"inner-right":"inner-top")}function fb(){return cb("y2",Sg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?Gf/2:Gf:b.isBottom?-If:b.isMiddle?-If/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Sg,db())}function ob(){return kb(Sg,eb())}function pb(){return kb(Sg,fb())}function qb(){return lb(!Sg,db())}function rb(){return lb(Sg,eb())}function sb(){return lb(Sg,fb())}function tb(){var a=db();return Sg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Sg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Sg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Sg,db())}function xb(){return mb(Sg,eb())}function yb(){return mb(Sg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return nf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Si.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Si.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Si.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+o)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Mc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return nf.min(Object.keys(i).map(function(a){return nf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(pg.length>0)for(g=Nc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return nf.max(Object.keys(i).map(function(a){return nf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?rh:ih,n="y2"===c?qh:hh,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?sh:jh,r=pd()&&Sg;return 0===l.length?"y2"===c?bg.domain():ag.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=qd(o,p),j=$b(ag.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&nh&&(f=b(nh.top)?nh.top:e,g=b(nh.bottom)?nh.bottom:e),"y2"===c&&wh&&(f=b(wh.top)?wh.top:e,g=b(wh.bottom)?wh.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Xi),c=$b(_f.domain());return a||0===c?1:b/c}function Wb(a){return ch?ch:nf.min(a,function(a){return nf.min(a.values,function(a){return a.x})})}function Xb(a){return bh?bh:nf.max(a,function(a){return nf.max(a.values,function(a){return a.x})})}function Yb(a,c){var d,e,f,g,h=c[0],i=c[1],j=Math.abs(h-i);return ni?e=0:Ud(a)?(d=vc(),e=d>1?j/(d-1)/2:.5):e=.01*j,"object"==typeof dh&&oe(dh)?(f=b(dh.left)?dh.left:e,g=b(dh.right)?dh.right:e):f=g="number"==typeof dh?dh:e,{left:f,right:g}}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=0,g=0;return(c||0===c)&&(f=mi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=mi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return jg&&a===jg||oe(kg)&&pe(kg,a)}function fc(a){return!ec(a)}function gc(a){return jg?jg:oe(kg)?kg[a]:null}function hc(a,b){var c,d=b&&oe(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=of.data.xs[b])}),c}function ic(a,b){return a in of.data.xs&&of.data.xs[a]&&of.data.xs[a][b]?of.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){kg[b]=a[b]})}function kc(a){return 1===nf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=ng[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),of.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=mi?a?a instanceof Date?a:je(a):je(ic(b,c)):oi&&!ni?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?of.data.xs[c]=a.map(function(a){return a[f]}).filter(b):jg?(d=Object.keys(of.data.xs),of.data.xs[c]=d.length>0?of.data.xs[d[0]]:void 0):oe(kg)&&(of.data.xs[c]=hc(f,of.data.targets)):of.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!of.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=mg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return oi&&ni&&0===c&&g&&(0===e&&(Vg=[]),Vg.push(g)),("undefined"==typeof a[b]||of.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),rg&&Sd(xc(c).filter(function(a){return!(a in sg)}),rg),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function tc(a){return a>0&&of.data.targets[0].values[a-1]?of.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?of.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?of.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(of.data.targets)}function zc(a,b){var c,d=xc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(mi?new Date(h):h);i.push(d)}return mi||(i=i.sort(function(a,b){return a-b})),i}function Gc(a){xi=xi.concat(a)}function Hc(a){xi=xi.filter(function(b){return a.indexOf(b)<0})}function Ic(a){yi=yi.concat(a)}function Jc(a){yi=yi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=qe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return nf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Ed(){return ug&&"desc"===ug.toLowerCase()}function Fd(){return ug&&"asc"===ug.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof ug&&a.sort(ug),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(of.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});_h&&0!==m.length&&(Vi.html(ci(a,$(),l,ui)).style("display","block"),d=Vi.property("offsetWidth"),e=Vi.property("offsetHeight"),k?(g=Gf/2+c[0],i=If/2+c[1]+20):(Sg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=_f(m[0].x)+20):(f=q(),g=f+t()+_f(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Vi.style("top",i+"px").style("left",g+"px"))}function Id(){Vi.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});_h&&(Vd(of.data.targets)||Yd(of.data.targets)||Si.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Sg?"y1":"x1",ud).attr(Sg?"y2":"x2",ud))}function Kd(){Si.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?_f(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Lh?Lh:b?2*a.tickOffset()*Mh/b:0}function Sd(a,b){yc(a).forEach(function(a){Zi[a]=b===sg[a],sg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){sg[a.id]===b&&(c=!0),a.id in sg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in sg)||"line"===sg[b]||"spline"===sg[b]||"area"===sg[b]||"area-spline"===sg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===sg[b]||"area-spline"===sg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===sg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===sg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===sg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===sg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(a){return ce(a)&&Vh||be(a)&&Ph}function ie(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function je(b){var c;try{c=lg?nf.time.format(lg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+lg)}return c}function ke(a,b){var c=nf.mouse(a),d=nf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function pe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function qe(a,b){var c="y"===Z(a.id)?ag:bg,d=Sg?1:0,e=Sg?0:1;return Math.pow(_f(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function re(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function se(a,b,c){Fg(b,a.node()),Si.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Sg?Md:Ld).attr("cy",Sg?Ld:Md).attr("stroke",function(){return ui(b)}).attr("r",1.4*Jh).transition().duration(100).attr("r",Jh)}function te(a,b,c){Gg(b,a.node()),Si.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ue(a,b,c,d){a?se(b,c,d):te(b,c,d)}function ve(a,b){Fg(b,a.node()),a.transition().duration(100).style("fill",function(){return nf.rgb(ui(b)).darker(1)})}function we(a,b){Gg(b,a.node()),a.transition().duration(100).style("fill",function(){return ui(b)})}function xe(a,b,c,d){a?ve(b,c,d):we(b,c,d)}function ye(a){return a.filter(function(a){return b(a.value)})}function ze(a,c){return(c?Si.selectAll("."+f.circles+gd(c)):Si).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ae(a,b){ze(a,b).classed(f.EXPANDED,!0).attr("r",Ih)}function Be(a){ze(a).filter(function(){return nf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Fh)}function Ce(a){return Si.selectAll("."+f.bar+(b(a)?"-"+a:""))}function De(a){Ce(a).classed(f.EXPANDED,!0)}function Ee(a){Ce(a).classed(f.EXPANDED,!1)}function Fe(a,b){var c=Je(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 Ge(a,b){var c=Je(a,!1),d=b?He:Ie;return function(a,b){return d(c(a,b),a,this)}}function He(a,b){var c;return Sg?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ie(a,b,c){var d=c.getBoundingClientRect();return Sg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Je(a,b){var c=a.__max__+1,d=Rd(fg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return 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 Ke(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 Le(b){var c,d,e;if(Wi=nf.select(qf),Wi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Wi.html(""),Wi.classed("c3",!0),of.data.xs={},of.data.targets=rc(b),n(),R(),_f.domain(nf.extent(Zb(of.data.targets))),ag.domain(Ub(of.data.targets,"y")),bg.domain(Ub(of.data.targets,"y2")),cg.domain(_f.domain()),dg.domain(ag.domain()),eg.domain(bg.domain()),Xi=_f.domain(),Li.scale(cg),vf&&Pi.scale(_f),Qi=Wi.append("svg").attr("width",Gf+Df.left+Df.right).attr("height",If+Df.top+Df.bottom).on("mouseenter",yf).on("mouseleave",zf),Ri=Qi.append("defs"),Ri.append("clipPath").attr("id",gi).append("rect").attr("width",Gf).attr("height",If),Ri.append("clipPath").attr("id",hi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Ri.append("clipPath").attr("id",ii).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Si=Qi.append("g").attr("transform",Di.main),Ti=Jg?Qi.append("g").attr("transform",Di.context):null,Ui=Qi.append("g").attr("transform",Di.legend),Mg||(Ui.style("visibility","hidden"),yi=xc(of.data.targets)),Vi=nf.select(qf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),hf(xc(of.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Si.append("g").attr("class",f.axisX).attr("clip-path",Sg?"":ki).attr("transform",Di.x).append("text").attr("class",f.axisXLabel).attr("transform",Sg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),gh&&Si.append("g").attr("class",f.axisY).attr("clip-path",Sg?li:"").attr("transform",Di.y).append("text").attr("class",f.axisYLabel).attr("transform",Sg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),ph&&Si.append("g").attr("class",f.axisY2).attr("transform",Di.y2).append("text").attr("class",f.axisY2Label).attr("transform",Sg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Si.append("g").attr("clip-path",ji).attr("class",f.grid),yh&&d.append("g").attr("class",f.xgrids),oe(Ah)&&d.append("g").attr("class",f.xgridLines),Gh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Bh&&d.append("g").attr("class",f.ygrids),oe(Ch)&&d.append("g").attr("class",f.ygridLines),Si.append("g").attr("clip-path",ji).attr("class",f.regions),Si.append("g").attr("clip-path",ji).attr("class",f.chart),c=Si.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",vf?Sg?"ns-resize":"ew-resize":null),Si.select("."+f.chart).append("g").attr("class",f.chartBars),Si.select("."+f.chart).append("g").attr("class",f.chartLines),Si.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Di.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Si.select("."+f.chart).append("g").attr("class",f.chartTexts),vf&&Si.insert("rect",xf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Gf).attr("height",If).style("opacity",0).style("cursor",Sg?"ns-resize":"ew-resize").call(Pi).on("dblclick.zoom",null),eh&&Li.extent("function"!=typeof eh?eh:eh(Zb())),Jg&&(Ti.append("g").attr("clip-path",ji).attr("class",f.chart),Ti.select("."+f.chart).append("g").attr("class",f.chartBars),Ti.select("."+f.chart).append("g").attr("class",f.chartLines),Ti.append("g").attr("clip-path",ji).attr("class",f.brush).call(Li).selectAll("rect").attr(Sg?"width":"height",Sg?Hf:Jf),Ti.append("g").attr("class",f.axisX).attr("transform",Di.subx).attr("clip-path",Sg?"":ki)),Ye(of.data.targets),Sg?Si.select("."+f.axisX).style("opacity",0).call(fg):(Si.select("."+f.axisY).style("opacity",0).call(gg),Si.select("."+f.axisY2).style("opacity",0).call(hg)),Se({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),di){if(mi&&"string"==typeof ei){for(ei=je(ei),e=0;eGf&&(Gf=0),0>If&&(If=0),Ef={top:Sg?Df.top:Lf-Kg-(Ei?0:a),right:0/0,bottom:20+(Ei?0:a),left:Sg?Ii:Df.left},Hf=Sg?Df.left-Ii-Ji:Gf,Jf=Sg?If:Lf-Ef.top-Ef.bottom,0>Hf&&(Hf=0),0>Jf&&(Jf=0),Ff={top:Ei?0:Lf-a,right:0/0,bottom:0,left:Ei?Kf-b:0},p(),Ei&&Yd(of.data.targets)&&(Ff.left=Gf/2+Nf)}function o(){Si.select("line."+f.xgridFocus).attr("x1",Sg?0:-10).attr("x2",Sg?Gf:-10).attr("y1",Sg?-10:Df.top).attr("y2",Sg?-10:If)}function p(){Nf=If/2,Mf=.95*Nf,Of=Xd(of.data.targets)?.6*Mf:0}function q(){var a=Sg?f.axisX:f.axisY,b=nf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=nf.select(qf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return rf?rf:x()}function s(){var a=sf?sf:y();return a>0?a:320}function t(){return Yd(of.data.targets)?0:tf?tf:Sg||!gh||lh?1:v("y")}function u(){var a=1;return Yd(of.data.targets)?0:uf?uf:Ei?P()+(ph&&!Sg?v("y2"):a):ph?uh||Sg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||gh?"y2"!==a||ph?(gb(a).isInner?30:40)+("y2"===a?-10:0):Ki:Mg&&!Ei?10:1}function x(){return+nf.select(qf).style("width").replace("px","")}function y(){return+nf.select(qf).style("height").replace("px","")}function z(a){return a?-5:-(Df.left-1)}function A(a){return a?-20:-1}function B(){return z(!Sg)}function C(){return A(!Sg)}function D(){return z(Sg)}function E(){return A(Sg)}function F(a){return a?Gf+2+4:Df.left+20}function G(a){return a?80:If+2}function H(){return F(!Sg)}function I(){return G(!Sg)}function J(){return F(Sg)}function K(){return G(Sg)}function L(){var a=Sg?If:Gf,b=vc(),c=Vb()*(Ud(of.data.targets)?(b-(ni?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){Fi=a}function N(a){Gi=a}function O(a){Hi=a}function P(){return Mg?Ei?Gi*(Fi+1):Kf:0}function Q(){return Mg?Ei?Lf:Hi*(Fi+1):0}function R(){var a,b=!_f;Tf=Sg?1:0,Uf=Sg?If:Gf,Vf=Sg?0:If,Wf=Sg?Gf:1,Xf=Tf,Yf=Uf,Zf=Sg?0:Jf,$f=Sg?Hf:1,_f=T(Tf,Uf,b?void 0:_f.domain(),function(){return fg.tickOffset()}),ag=U(Vf,Wf),bg=U(Vf,Wf),cg=T(Tf,Uf,Xi,function(a){return a%1?0:ig.tickOffset()}),dg=U(Zf,$f),eg=U(Zf,$f),a=$(),fg=X(_f,zi,a),ig=X(cg,Ci,a),gg=Y(ag,Ai,mh,oh),hg=Y(bg,Bi,vh,xh),b||(Li.scale(cg),vf&&Pi.scale(_f)),S()}function S(){Pf=Db(),Qf=Eb(),Rf=Eb(.98)}function T(a,b,e,f){var g=(mi?nf.time.scale():nf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),ni){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return nf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?bg:ag}function W(a){return"y2"===Z(a)?eg:dg}function X(a,b,c){var d=(ni?Bb():nf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),ni?(d.tickCentered(Wg),ne(Yg)&&(Yg=!1)):d.tickOffset=function(){var a=Sg?If:Gf;return a*Vb()/vc()/2},ni&&d.categories(Vg),d}function Y(a,b,c,d){return nf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in qg?qg[a]:"y"}function $(){var a=mi?wi:ni?Oc:function(a){return 0>a?a.toFixed(0):a};return Xg&&("function"==typeof Xg?a=Xg:mi&&(a=function(a){return a?vi(Xg)(a):""})),a}function _(a){var b;return"y"===a?b=kh:"y2"===a?b=th:"x"===a&&(b=fh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?kh=b:"y2"===a?th=b:"x"===a&&(fh=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Sg?"inner-top":"inner-right")}function eb(){return cb("y",Sg?"inner-right":"inner-top")}function fb(){return cb("y2",Sg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?Gf/2:Gf:b.isBottom?-If:b.isMiddle?-If/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Sg,db())}function ob(){return kb(Sg,eb())}function pb(){return kb(Sg,fb())}function qb(){return lb(!Sg,db())}function rb(){return lb(Sg,eb())}function sb(){return lb(Sg,fb())}function tb(){var a=db();return Sg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Sg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Sg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Sg,db())}function xb(){return mb(Sg,eb())}function yb(){return mb(Sg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return nf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Si.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Si.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Si.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+o)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Mc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return nf.min(Object.keys(i).map(function(a){return nf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(pg.length>0)for(g=Nc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return nf.max(Object.keys(i).map(function(a){return nf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?rh:ih,n="y2"===c?qh:hh,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?sh:jh,r=pd()&&Sg;return 0===l.length?"y2"===c?bg.domain():ag.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=qd(o,p),j=$b(ag.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&nh&&(f=b(nh.top)?nh.top:e,g=b(nh.bottom)?nh.bottom:e),"y2"===c&&wh&&(f=b(wh.top)?wh.top:e,g=b(wh.bottom)?wh.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Xi),c=$b(_f.domain());return a||0===c?1:b/c}function Wb(a){return ch?ch:nf.min(a,function(a){return nf.min(a.values,function(a){return a.x})})}function Xb(a){return bh?bh:nf.max(a,function(a){return nf.max(a.values,function(a){return a.x})})}function Yb(a,c){var d,e,f,g,h=c[0],i=c[1],j=Math.abs(h-i);return ni?e=0:Ud(a)?(d=vc(),e=d>1?j/(d-1)/2:.5):e=.01*j,"object"==typeof dh&&oe(dh)?(f=b(dh.left)?dh.left:e,g=b(dh.right)?dh.right:e):f=g="number"==typeof dh?dh:e,{left:f,right:g}}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=0,g=0;return(c||0===c)&&(f=mi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=mi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return jg&&a===jg||oe(kg)&&pe(kg,a)}function fc(a){return!ec(a)}function gc(a){return jg?jg:oe(kg)?kg[a]:null}function hc(a,b){var c,d=b&&oe(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=of.data.xs[b])}),c}function ic(a,b){return a in of.data.xs&&of.data.xs[a]&&of.data.xs[a][b]?of.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){kg[b]=a[b]})}function kc(a){return 1===nf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=ng[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),of.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=mi?a?a instanceof Date?a:je(a):je(ic(b,c)):oi&&!ni?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?of.data.xs[c]=a.map(function(a){return a[f]}).filter(b):jg?(d=Object.keys(of.data.xs),of.data.xs[c]=d.length>0?of.data.xs[d[0]]:void 0):oe(kg)&&(of.data.xs[c]=hc(f,of.data.targets)):of.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!of.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=mg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return oi&&ni&&0===c&&g&&(0===e&&(Vg=[]),Vg.push(g)),("undefined"==typeof a[b]||of.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),rg&&Sd(xc(c).filter(function(a){return!(a in sg)}),rg),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function tc(a){return a>0&&of.data.targets[0].values[a-1]?of.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?of.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?of.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(of.data.targets)}function zc(a,b){var c,d=xc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(mi?new Date(h):h);i.push(d)}return mi||(i=i.sort(function(a,b){return a-b})),i}function Gc(a){xi=xi.concat(a)}function Hc(a){xi=xi.filter(function(b){return a.indexOf(b)<0})}function Ic(a){yi=yi.concat(a)}function Jc(a){yi=yi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=qe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return nf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Ed(){return ug&&"desc"===ug.toLowerCase()}function Fd(){return ug&&"asc"===ug.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof ug&&a.sort(ug),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(of.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});_h&&0!==m.length&&(Vi.html(ci(a,$(),l,ui)).style("display","block"),d=Vi.property("offsetWidth"),e=Vi.property("offsetHeight"),k?(g=Gf/2+c[0],i=If/2+c[1]+20):(Sg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=_f(m[0].x)+20):(f=q(),g=f+t()+_f(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Vi.style("top",i+"px").style("left",g+"px"))}function Id(){Vi.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});_h&&(Vd(of.data.targets)||Yd(of.data.targets)||Si.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Sg?"y1":"x1",ud).attr(Sg?"y2":"x2",ud))}function Kd(){Si.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?_f(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Lh?Lh:b?2*a.tickOffset()*Mh/b:0}function Sd(a,b){yc(a).forEach(function(a){Zi[a]=b===sg[a],sg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){sg[a.id]===b&&(c=!0),a.id in sg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in sg)||"line"===sg[b]||"spline"===sg[b]||"area"===sg[b]||"area-spline"===sg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===sg[b]||"area-spline"===sg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===sg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===sg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===sg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===sg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(a){return ce(a)&&Vh||be(a)&&Ph}function ie(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function je(b){var c;try{c=lg?nf.time.format(lg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+lg)}return c}function ke(a,b){var c=nf.mouse(a),d=nf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function pe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function qe(a,b){var c="y"===Z(a.id)?ag:bg,d=Sg?1:0,e=Sg?0:1;return Math.pow(_f(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function re(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function se(a,b,c){Fg(b,a.node()),Si.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Sg?Md:Ld).attr("cy",Sg?Ld:Md).attr("stroke",function(){return ui(b)}).attr("r",1.4*Jh).transition().duration(100).attr("r",Jh)}function te(a,b,c){Gg(b,a.node()),Si.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ue(a,b,c,d){a?se(b,c,d):te(b,c,d)}function ve(a,b){Fg(b,a.node()),a.transition().duration(100).style("fill",function(){return nf.rgb(ui(b)).darker(1)})}function we(a,b){Gg(b,a.node()),a.transition().duration(100).style("fill",function(){return ui(b)})}function xe(a,b,c,d){a?ve(b,c,d):we(b,c,d)}function ye(a){return a.filter(function(a){return b(a.value)})}function ze(a,c){return(c?Si.selectAll("."+f.circles+gd(c)):Si).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ae(a,b){ze(a,b).classed(f.EXPANDED,!0).attr("r",Ih)}function Be(a){ze(a).filter(function(){return nf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Fh)}function Ce(a){return Si.selectAll("."+f.bar+(b(a)?"-"+a:""))}function De(a){Ce(a).classed(f.EXPANDED,!0)}function Ee(a){Ce(a).classed(f.EXPANDED,!1)}function Fe(a,b){var c=Je(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 Ge(a,b){var c=Je(a,!1),d=b?He:Ie;return function(a,b){return d(c(a,b),a,this)}}function He(a,b){var c;return Sg?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ie(a,b,c){var d=c.getBoundingClientRect();return Sg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Je(a,b){var c=a.__max__+1,d=Rd(fg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return 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 Ke(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 Le(b){var c,d,e;if(Wi=nf.select(qf),Wi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Wi.html(""),Wi.classed("c3",!0),of.data.xs={},of.data.targets=rc(b),n(),R(),_f.domain(nf.extent(Zb(of.data.targets))),ag.domain(Ub(of.data.targets,"y")),bg.domain(Ub(of.data.targets,"y2")),cg.domain(_f.domain()),dg.domain(ag.domain()),eg.domain(bg.domain()),Xi=_f.domain(),Li.scale(cg),vf&&Pi.scale(_f),Qi=Wi.append("svg").attr("width",Gf+Df.left+Df.right).attr("height",If+Df.top+Df.bottom).on("mouseenter",yf).on("mouseleave",zf),Ri=Qi.append("defs"),Ri.append("clipPath").attr("id",gi).append("rect").attr("width",Gf).attr("height",If),Ri.append("clipPath").attr("id",hi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Ri.append("clipPath").attr("id",ii).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Si=Qi.append("g").attr("transform",Di.main),Ti=Jg?Qi.append("g").attr("transform",Di.context):null,Ui=Qi.append("g").attr("transform",Di.legend),Mg||(Ui.style("visibility","hidden"),yi=xc(of.data.targets)),Vi=nf.select(qf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),hf(xc(of.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Si.append("g").attr("class",f.axisX).attr("clip-path",Sg?"":ki).attr("transform",Di.x).append("text").attr("class",f.axisXLabel).attr("transform",Sg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),gh&&Si.append("g").attr("class",f.axisY).attr("clip-path",Sg?li:"").attr("transform",Di.y).append("text").attr("class",f.axisYLabel).attr("transform",Sg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),ph&&Si.append("g").attr("class",f.axisY2).attr("transform",Di.y2).append("text").attr("class",f.axisY2Label).attr("transform",Sg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Si.append("g").attr("clip-path",ji).attr("class",f.grid),yh&&d.append("g").attr("class",f.xgrids),oe(Ah)&&d.append("g").attr("class",f.xgridLines),Gh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Bh&&d.append("g").attr("class",f.ygrids),oe(Ch)&&d.append("g").attr("class",f.ygridLines),Si.append("g").attr("clip-path",ji).attr("class",f.regions),Si.append("g").attr("clip-path",ji).attr("class",f.chart),c=Si.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",vf?Sg?"ns-resize":"ew-resize":null),Si.select("."+f.chart).append("g").attr("class",f.chartBars),Si.select("."+f.chart).append("g").attr("class",f.chartLines),Si.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Di.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Si.select("."+f.chart).append("g").attr("class",f.chartTexts),vf&&Si.insert("rect",xf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Gf).attr("height",If).style("opacity",0).style("cursor",Sg?"ns-resize":"ew-resize").call(Pi).on("dblclick.zoom",null),eh&&Li.extent("function"!=typeof eh?eh:eh(Zb())),Jg&&(Ti.append("g").attr("clip-path",ji).attr("class",f.chart),Ti.select("."+f.chart).append("g").attr("class",f.chartBars),Ti.select("."+f.chart).append("g").attr("class",f.chartLines),Ti.append("g").attr("clip-path",ji).attr("class",f.brush).call(Li).selectAll("rect").attr(Sg?"width":"height",Sg?Hf:Jf),Ti.append("g").attr("class",f.axisX).attr("transform",Di.subx).attr("clip-path",Sg?"":ki)),Ye(of.data.targets),Sg?Si.select("."+f.axisX).style("opacity",0).call(fg):(Si.select("."+f.axisY).style("opacity",0).call(gg),Si.select("."+f.axisY2).style("opacity",0).call(hg)),Se({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),di){if(mi&&"string"==typeof ei){for(ei=je(ei),e=0;e0){d=[];for(var g in ng)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=xe,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 Qe(a){Yd(of.data.targets)||yg&&(pi=a,Si.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),qi=!0,Hg())}function Re(){Yd(of.data.targets)||yg&&(Si.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Si.selectAll("."+f.shape).classed(f.INCLUDED,!1),qi=!1,Ig())}function Se(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Nd(),U=Yd(of.data.targets),V=Dc(of.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?Cf:0,O=B?N:0,P=C?N:0,H&&Mg&&hf(xc(of.data.targets),a),G&&(_f.domain(nf.extent(Zb(V))),Xi=_f.domain(),vf&&Pi.scale(_f).updateScaleExtent(),cg.domain(_f.domain()),Li.scale(cg)),F&&(_f.domain(Li.empty()?Xi:Li.extent()),vf&&Pi.scale(_f).updateScaleExtent()),ag.domain(Ub(V,"y")),bg.domain(Ub(V,"y2")),Vd(V)||(Q=ah?ah:Fc(Ec(V)),fg.tickValues(Q),ig.tickValues(Q)),c=Si.select("."+f.axisX).style("opacity",U?0:1),(Sg||D)&&(c=c.transition().duration(P)),c.call(fg),e=Si.select("."+f.axisY).style("opacity",U?0:1),(!Sg||D)&&(e=e.transition().duration(P)),e.call(gg),Si.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(hg),F)if(Yg&&Q){for(R=1;R=0&&nf.select(this).style("display",b%S?"none":"block")})}else nf.selectAll("."+f.axisX+" .tick text").style("display","block");if(I=Fe(T),K=Ge(T,!0),M=Ge(T,!1),Ab(),dg.domain(ag.domain()),eg.domain(bg.domain()),Vi.style("display","none"),o(),Si.select("line."+f.xgridFocus).style("visibility","hidden"),yh){if("year"===zh){h=[];for(var W=Zb(),X=W[0].getFullYear(),Y=W[1].getFullYear(),Z=X;Y>=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=_f.ticks(10);g=Si.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Sg?0:function(a){return _f(a)-fg.tickOffset()}).attr("x2",Sg?Gf:function(a){return _f(a)-fg.tickOffset()}).attr("y1",Sg?function(a){return _f(a)-fg.tickOffset()}:Df.top).attr("y2",Sg?function(a){return _f(a)-fg.tickOffset()}:If).style("opacity",function(){return+nf.select(this).attr(Sg?"y1":"x1")===(Sg?If:0)?0:1}),g.exit().remove()}oe(Ah)&&(i=Si.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Ah),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Sg?"":"rotate(-90)").attr("dx",Sg?0:-Df.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Sg?0:vd).attr("x2",Sg?Gf:vd).attr("y1",Sg?vd:Df.top).attr("y2",Sg?vd:If).style("opacity",1),i.select("text").transition().duration(N).attr("x",Sg?Gf:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&Bh&&(k=Si.select("."+f.ygrids).selectAll("."+f.ygrid).data(ag.ticks(Dh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Sg?ag:0).attr("x2",Sg?ag:Gf).attr("y1",Sg?0:ag).attr("y2",Sg?If:ag),k.exit().remove()),y&&oe(Ch)&&(l=Si.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Ch),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Sg?"rotate(-90)":"").attr("dx",Sg?0:-Df.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Sg?wd:0).attr("x2",Sg?wd:Gf).attr("y1",Sg?0:wd).attr("y2",Sg?If:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Sg?0:Gf).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Si.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ui(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Si.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Sg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Si.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Mi).style("opacity",1),Si.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Ni).style("opacity",Yi),n=Si.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",Fh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Sg?Md:Ld).attr("cy",Sg?Ld:Md),n.exit().remove(),Si.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=nf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Si.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Si.select("."+f.chartArcsTitle).style("opacity",Xd(of.data.targets)?1:0),Jg&&(null!==nf.event&&"zoom"===nf.event.type&&Li.extent(_f.orgDomain()).update(),z&&(Ti.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(ig),Li.empty()||Li.extent(_f.orgDomain()).update(),J=Fe(T,!0),s=Ti.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ui(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Ti.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Oi).style("opacity",1))),Si.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Si.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Sg?Md:Ld).attr("cy",Sg?Ld:Md),t=Si.select("."+f.eventRects),oe(kg)&&!kc(kg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Si.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ne(u.enter()),u.attr("x",0).attr("y",0).attr("width",Gf).attr("height",If)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),oi&&!ni?(x=function(a,b){var c=tc(b),d=uc(b),e=of.data.xs[a.id][b];return(_f(d?d:e+50)-_f(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=of.data.xs[a.id][b];return(_f(d)+_f(c?c:d-50))/2}):(x=L(),w=function(a){return _f(a.x)-x/2}),v=wc(),Si.select("."+f.eventRects).datum(v?v.values:[]),u=Si.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Me(u.enter()),u.attr("class",ad).attr("x",Sg?0:w).attr("y",Sg?w:0).attr("width",Sg?Gf:x).attr("height",Sg?x:If),u.exit().remove()),q=Si.select("."+f.regions).selectAll("rect."+f.region).data($h),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Sg?0:cc).attr("y",Sg?cc:Df.top).attr("width",Sg?Gf:dc).attr("height",Sg?dc:If).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),xc(of.data.targets).forEach(function(a){Zi[a]=!0})}}function Te(){Se({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ue(){return"mousemove"===nf.event.sourceEvent.type&&Pi.altDomain?(_f.domain(Pi.altDomain),void Pi.scale(_f).updateScaleExtent()):(ni&&_f.orgDomain()[0]===Xi[0]&&_f.domain([Xi[0]-1e-10,_f.orgDomain()[1]]),Se({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===nf.event.sourceEvent.type&&(ri=!0)))}function Ve(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function We(){Qi.attr("width",Kf).attr("height",Lf),Qi.select("#"+gi).select("rect").attr("width",Gf).attr("height",If),Qi.select("#"+hi).select("rect").attr("width",H),Qi.select("#"+ii).select("rect").attr("width",J),Qi.select("."+f.zoomRect).attr("width",Gf).attr("height",If)}function Xe(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),We(),m(a.withTransition),Se(a)}function Ye(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Si.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ui(a)}),e=Si.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ui(a)}).style("stroke","none").style("cursor",function(a){return Ag(a)?"pointer":null}),c=Si.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ui(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Yi=+nf.select(this).style("opacity"),0}).style("fill",function(a){return ui(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ui(a)}).style("cursor",function(a){return Ag(a)?"pointer":null}),a.forEach(function(a){Si.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Si.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Sf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ui(a.data)}).style("cursor",function(a){return Ag(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),cf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,nf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),ef(),Id(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Jg&&(n=Ti.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ui(a)}),l=Ti.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ui(a)})),Qi.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ze(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),of.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Ei?j:i,l=Ei?Q():P();return d&&(w=0,C=0,t=0,u=0),Mg&&!Cc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Ei?u:t,void(Rg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,Ei?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Ui.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Og?Og(a):of.toggle(a)}).on("mouseover",function(a){of.focus(a),"function"==typeof Pg&&Pg(a)}).on("mouseout",function(a){of.revert(),"function"==typeof Qg&&Qg(a)}),l.append("text").text(function(a){return d(ng[a])?ng[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",Ei?g:-200).attr("y",Ei?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ei?h:-200).attr("y",Ei?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return ui(a)}).attr("x",Ei?g:-200).attr("y",Ei?-200:i).attr("width",10).attr("height",10),Ui.selectAll("text").data(a).text(function(a){return d(ng[a])?ng[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ui.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ui.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),We(),q&&m(p)}function jf(a){return zc(of.data.targets,a.id)}function kf(a){return"data"in a&&zc(of.data.targets,a.data.id)}function lf(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 mf(a,b,c){var d=!Yd(of.data.targets);Sd(a,b),Xe(c?c:{withTransitionForAxis:d})}var nf=a.d3?a.d3:a.require?a.require("d3"):void 0,of={data:{},axis:{},legend:{}},pf={},qf=h(["bindto"],"#chart"),rf=h(["size","width"]),sf=h(["size","height"]),tf=h(["padding","left"]),uf=h(["padding","right"]),vf=h(["zoom","enabled"],!1),wf=h(["zoom","extent"]),xf=h(["zoom","privileged"],!1),yf=h(["onenter"],function(){}),zf=h(["onleave"],function(){}),Af=h(["onresize"],function(){}),Bf=h(["onresized"],function(){}),Cf=h(["transition","duration"],350);g("data","data is required in config");var Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg=h(["data","x"]),kg=h(["data","xs"],{}),lg=h(["data","x_format"]),mg=h(["data","id_converter"],function(a){return a}),ng=h(["data","names"],{}),og=h(["data","classes"],{}),pg=h(["data","groups"],[]),qg=h(["data","axes"],{}),rg=h(["data","type"]),sg=h(["data","types"],{}),tg=h(["data","labels"],{}),ug=h(["data","order"]),vg=h(["data","regions"],{}),wg=h(["data","color"]),xg=h(["data","colors"],{}),yg=h(["data","selection","enabled"],!1),zg=h(["data","selection","grouped"],!1),Ag=h(["data","selection","isselectable"],function(){return!0}),Bg=h(["data","selection","multiple"],!0),Cg=h(["data","onclick"],function(){}),Dg=h(["data","onenter"],function(){}),Eg=h(["data","onleave"],function(){}),Fg=h(["data","onselected"],function(){}),Gg=h(["data","onunselected"],function(){}),Hg=h(["data","ondragstart"],function(){}),Ig=h(["data","ondragend"],function(){}),Jg=h(["subchart","show"],!1),Kg=Jg?h(["subchart","size","height"],60):0,Lg=h(["color","pattern"],[]),Mg=h(["legend","show"],!0),Ng=h(["legend","position"],"bottom"),Og=h(["legend","item","onclick"]),Pg=h(["legend","item","onmouseover"]),Qg=h(["legend","item","onmouseout"]),Rg=h(["legend","equally"],!1),Sg=h(["axis","rotated"],!1),Tg=h(["axis","x","type"],"indexed"),Ug=h(["axis","x","localtime"],!0),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"],10),$g=h(["axis","x","tick","count"]),_g=h(["axis","x","tick","fit"],!1),ah=h(["axis","x","tick","values"],null),bh=h(["axis","x","max"]),ch=h(["axis","x","min"]),dh=h(["axis","x","padding"],{}),eh=h(["axis","x","default"]),fh=h(["axis","x","label"],{}),gh=h(["axis","y","show"],!0),hh=h(["axis","y","max"]),ih=h(["axis","y","min"]),jh=h(["axis","y","center"]),kh=h(["axis","y","label"],{}),lh=h(["axis","y","inner"],!1),mh=h(["axis","y","tick","format"]),nh=h(["axis","y","padding"],{}),oh=h(["axis","y","ticks"],10),ph=h(["axis","y2","show"],!1),qh=h(["axis","y2","max"]),rh=h(["axis","y2","min"]),sh=h(["axis","y2","center"]),th=h(["axis","y2","label"],{}),uh=h(["axis","y2","inner"],!1),vh=h(["axis","y2","tick","format"]),wh=h(["axis","y2","padding"],{}),xh=h(["axis","y2","ticks"],10),yh=h(["grid","x","show"],!1),zh=h(["grid","x","type"],"tick"),Ah=h(["grid","x","lines"],[]),Bh=h(["grid","y","show"],!1),Ch=h(["grid","y","lines"],[]),Dh=h(["grid","y","ticks"],10),Eh=h(["point","show"],!0),Fh=Eh?h(["point","r"],2.5):0,Gh=h(["point","focus","line","enabled"],!0),Hh=h(["point","focus","expand","enabled"],!0),Ih=h(["point","focus","expand","r"],Hh?4:Fh),Jh=h(["point","focus","select","r"],8),Kh=h(["line","connect_null"],!1),Lh=h(["bar","width"]),Mh=h(["bar","width","ratio"],.6),Nh=h(["pie","label","show"],!0),Oh=h(["pie","label","format"]),Ph=h(["pie","expand"],!0),Qh=h(["pie","onclick"],function(){}),Rh=h(["pie","onmouseover"],function(){}),Sh=h(["pie","onmouseout"],function(){}),Th=h(["donut","label","show"],!0),Uh=h(["donut","label","format"]),Vh=h(["donut","expand"],!0),Wh=h(["donut","title"],""),Xh=h(["donut","onclick"],function(){}),Yh=h(["donut","onmouseover"],function(){}),Zh=h(["donut","onmouseout"],function(){}),$h=h(["regions"],[]),_h=h(["tooltip","show"],!0),ai=h(["tooltip","format","title"]),bi=h(["tooltip","format","value"]),ci=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ai?ai:b,l=bi?bi: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+""}),di=h(["tooltip","init","show"],!1),ei=h(["tooltip","init","x"],0),fi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),gi=("string"==typeof qf?qf.replace("#",""):qf.id)+"-clip",hi=gi+"-xaxis",ii=gi+"-yaxis",ji=i(gi),ki=i(hi),li=i(ii),mi="timeseries"===Tg,ni="categorized"===Tg,oi=!mi&&(jg||oe(kg)),pi=null,qi=!1,ri=!1,si=!1,ti=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ui=ie(xg,oe(Lg)?Lg:ti,wg),vi=Ug?nf.time.format:nf.time.format.utc,wi=function(){var a=[[vi("%Y/%-m/%-d"),function(){return!0}],[vi("%-m/%-d"),function(a){return a.getMonth()}],[vi("%-m/%-d"),function(a){return 1!==a.getDate()}],[vi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[vi("%I %p"),function(a){return a.getHours()}],[vi("%I:%M"),function(a){return a.getMinutes()}],[vi(":%S"),function(a){return a.getSeconds()}],[vi(".%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)}}(),xi=[],yi=[],zi=Sg?"left":"bottom",Ai=Sg?lh?"top":"bottom":lh?"right":"left",Bi=Sg?uh?"bottom":"top":uh?"left":"right",Ci=Sg?"left":"bottom",Di={main:function(){return"translate("+Df.left+","+Df.top+")"},context:function(){return"translate("+Ef.left+","+Ef.top+")"},legend:function(){return"translate("+Ff.left+","+Ff.top+")"},x:function(){return"translate(0,"+(Sg?0:If)+")"},y:function(){return"translate(0,"+(Sg?If:0)+")"},y2:function(){return"translate("+(Sg?0:Gf)+","+(Sg?1:0)+")"},subx:function(){return"translate(0,"+(Sg?0:Jf)+")"},arc:function(){return"translate("+Gf/2+","+If/2+")"}},Ei="right"===Ng,Fi=0,Gi=0,Hi=0,Ii=30,Ji=30,Ki=5;Sf=nf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Li,Mi=function(){var a=nf.svg.line().x(Sg?function(a){return V(a.id)(a.value)}:ud).y(Sg?ud:function(a){return V(a.id)(a.value)});return Kh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Kh?ye(b.values):b.values;return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),vg[b.id]?Ke(e,_f,V(b.id),vg[b.id]):a(e)):(c=e[0]?_f(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Sg?"M "+d+" "+c:"M "+c+" "+d)}}(),Ni=function(){var a;return a=Sg?nf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):nf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=ye(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?_f(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Sg?"M "+d+" "+c:"M "+c+" "+d)}}(),Oi=function(){var a=nf.svg.line().x(Sg?function(a){return W(a.id)(a.value)}:xd).y(Sg?xd:function(a){return W(a.id)(a.value)});return function(b){var c=ye(b.values);return Zd(b)?a(c):"M "+cg(c[0].x)+" "+W(b.id)(c[0].value)}}(),Pi=function(){};Li=nf.svg.brush().on("brush",Te),Li.update=function(){return Ti&&Ti.select("."+f.brush).call(this),this},Li.scale=function(a){return Sg?this.y(a):this.x(a)},vf&&(Pi=nf.behavior.zoom().on("zoomstart",function(){Pi.altDomain=nf.event.sourceEvent.altKey?_f.orgDomain():null}).on("zoom",vf?Ue:null),Pi.scale=function(a){return Sg?this.y(a):this.x(a)},Pi.orgScaleExtent=function(){var a=wf?wf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Pi.updateScaleExtent=function(){var a=$b(_f.orgDomain())/$b(Xi),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Qi,Ri,Si,Ti,Ui,Vi,Wi,Xi,Yi,Zi={};if(of.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Qi.selectAll(hd(a)),d=c.filter(jf),e=c.filter(kf);of.revert(),of.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(of.data.targets)&&Kb(a,!0),cf(a)},of.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Qi.selectAll(hd(a)),d=c.filter(jf),e=c.filter(kf);of.revert(),b(d.classed(f.focused,!1)),b(e),Yd(of.data.targets)&&Lb(a),df(a)},of.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Qi.selectAll(hd(a)),d=c.filter(jf),e=c.filter(kf);b(d.classed(f.focused,!1)),b(e),Yd(of.data.targets)&&Lb(a),ef()},of.show=function(a,b){a=yc(a),b=b||{},Hc(a),Qi.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ff(a):Ui.selectAll(kd(a)).classed(f.legendItemHidden,!1),Se({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},of.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Qi.selectAll(id(a)).transition().style("opacity",0),b.withLegend?gf(a):Ui.selectAll(kd(a)).classed(f.legendItemHidden,!0),Se({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},of.toggle=function(a){Bc(a)?of.hide(a):of.show(a)},of.unzoom=function(){Li.clear().update(),Se({withUpdateXDomain:!0})},of.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){og[b]=a.classes[b]}),"categories"in a&&ni&&(Vg=a.categories,fg.categories(Vg)),"cacheIds"in a&&_b(a.cacheIds)?void Ze(bc(a.cacheIds),a.done):void("unload"in a?_e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){$e(a)}):$e(a))},of.unload=function(a){_e(yc(a),function(){Se({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},of.selected=function(a){return nf.merge(Si.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return nf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},of.select=function(a,b,c){yg&&Si.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=nf.select(this),i="circle"===this.nodeName?se:ve,j="circle"===this.nodeName?te:we,k=zg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Ag(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},of.unselect=function(a,b){yg&&Si.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=nf.select(this),g="circle"===this.nodeName?te:we,h=zg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Ag(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},of.toLine=function(a){mf(a,"line")},of.toSpline=function(a){mf(a,"spline")},of.toBar=function(a){mf(a,"bar")},of.toScatter=function(a){mf(a,"scatter")},of.toArea=function(a){mf(a,"area")},of.toAreaSpline=function(a){mf(a,"area-spline")},of.toPie=function(a){mf(a,"pie",{withTransform:!0})},of.toDonut=function(a){mf(a,"donut",{withTransform:!0})},of.groups=function(a){return c(a)?pg:(pg=a,Se(),pg)},of.xgrids=function(a){return a?(Ah=a,Se(),Ah):Ah},of.xgrids.add=function(a){return a?of.xgrids(Ah.concat(a)):void 0},of.xgrids.remove=function(a){var b=lf(a);return of.xgrids(Ah.filter(b))},of.ygrids=function(a){return a?(Ch=a,Se(),Ch):Ch},of.ygrids.add=function(a){return a?of.ygrids(Ch.concat(a)):void 0},of.ygrids.remove=function(a){var b=lf(a);return of.ygrids(Ch.filter(b))},of.regions=function(a){return c(a)?$h:($h=a,Se(),$h)},of.regions.add=function(a){return c(a)?$h:($h=$h.concat(a),Se(),$h) },of.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;Qi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),$h=$h.filter(function(b){return b.classes.indexOf(a)<0})}),$h},of.data.get=function(a){var b=of.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},of.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},of.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){ng[b]=a[b]}),hf(xc(of.data.targets),{withTransition:!0}),ng):ng},of.x=function(a){return arguments.length&&(mc(of.data.targets,a),Se({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),of.data.xs},of.xs=function(a){return arguments.length&&(nc(of.data.targets,a),Se({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),of.data.xs},of.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},of.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(hh=+a.y),b(a.y2)&&(qh=+a.y2)):hh=qh=+a,Se())},of.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(ih=+a.y),b(a.y2)&&(rh=+a.y2)):ih=rh=+a,Se())},of.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&of.axis.max(a.max),"undefined"!=typeof a.min&&of.axis.min(a.min))},of.legend.show=function(a){Mg||(Mg=!0,Ui.style("visibility","visible")),ff(yc(a)),Se({withTransitionForHorizontalAxis:!1})},of.legend.hide=function(a){Mg&&ne(a)&&(Mg=!1,Ui.style("visibility","hidden")),gf(yc(a)),Se({withTransitionForHorizontalAxis:!1})},of.resize=function(a){rf=a?a.width:null,sf=a?a.height:null,Xe({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},of.destroy=function(){of.data.targets=void 0,of.data.xs={},Wi.html(""),a.onresize=null},"url"in e.data)nf.xhr(e.data.url,function(a,b){var c,d=nf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=nf.csv.parse(b.response),Le(c)});else if("rows"in e.data)Le(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Le(qc(e.data.columns))}return of},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From a4aac3c7ab97dc55fbacdc8197028baeabc1a749 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Tue, 22 Apr 2014 12:17:01 +0900 Subject: [PATCH 049/178] Enable y directed regions - #132 --- c3.js | 50 ++++++++++++++++++++++++++++--------- c3.min.js | 6 ++--- htdocs/samples/regions.html | 30 +++++++++++++++++++--- 3 files changed, 68 insertions(+), 18 deletions(-) diff --git a/c3.js b/c3.js index 9727bdf..1fd8cb3 100644 --- a/c3.js +++ b/c3.js @@ -382,7 +382,7 @@ // for main margin = { - top: __axis_rotated ? getHorizontalAxisHeight('y2') : rotated_padding_top, + top: __axis_rotated ? getHorizontalAxisHeight('y2') : 0, right: getCurrentPaddingRight(), bottom: getHorizontalAxisHeight(__axis_rotated ? 'y' : 'x') + (__axis_rotated ? 0 : __subchart_size_height) + (isLegendRight ? 0 : legendHeight), left: (__axis_rotated ? __subchart_size_height + rotated_padding_right : 0) + getCurrentPaddingLeft() @@ -1274,15 +1274,41 @@ //-- Regions --// - function regionStart(d) { - return ('start' in d) ? x(isTimeSeries ? parseDate(d.start) : d.start) : 0; + function regionX(d) { + var xPos, yScale = d.axis === 'y' ? y : y2; + if (d.axis === 'y' || d.axis === 'y2') { + xPos = __axis_rotated ? ('start' in d ? yScale(d.start) : 0) : 0; + } else { + xPos = __axis_rotated ? 0 : ('start' in d ? x(isTimeSeries ? parseDate(d.start) : d.start) : 0); + } + return xPos; + } + function regionY(d) { + var yPos, yScale = d.axis === 'y' ? y : y2; + if (d.axis === 'y' || d.axis === 'y2') { + yPos = __axis_rotated ? 0 : ('end' in d ? yScale(d.end) : 0); + } else { + yPos = __axis_rotated ? ('start' in d ? x(isTimeSeries ? parseDate(d.start) : d.start) : 0) : 0; + } + return yPos; } - function regionWidth(d) { - var start = regionStart(d), - end = ('end' in d) ? x(isTimeSeries ? parseDate(d.end) : d.end) : width, - w = end - start; - return (w < 0) ? 0 : w; + var start = regionX(d), end, yScale = d.axis === 'y' ? y : y2; + if (d.axis === 'y' || d.axis === 'y2') { + end = __axis_rotated ? ('end' in d ? yScale(d.end) : width) : width; + } else { + end = __axis_rotated ? width : ('end' in d ? x(isTimeSeries ? parseDate(d.end) : d.end) : width); + } + return end < start ? 0 : end - start; + } + function regionHeight(d) { + var start = regionY(d), end, yScale = d.axis === 'y' ? y : y2; + if (d.axis === 'y' || d.axis === 'y2') { + end = __axis_rotated ? height : ('start' in d ? yScale(d.start) : height); + } else { + end = __axis_rotated ? ('end' in d ? x(isTimeSeries ? parseDate(d.end) : d.end) : height) : height; + } + return end < start ? 0 : end - start; } //-- Data --// @@ -3409,10 +3435,10 @@ .style("fill-opacity", 0); mainRegion .attr('class', classRegion) - .attr("x", __axis_rotated ? 0 : regionStart) - .attr("y", __axis_rotated ? regionStart : margin.top) - .attr("width", __axis_rotated ? width : regionWidth) - .attr("height", __axis_rotated ? regionWidth : height) + .attr("x", regionX) + .attr("y", regionY) + .attr("width", regionWidth) + .attr("height", regionHeight) .transition().duration(duration) .style("fill-opacity", function (d) { return isValue(d.opacity) ? d.opacity : 0.1; }); mainRegion.exit().transition().duration(duration) diff --git a/c3.min.js b/c3.min.js index 019c825..9f30464 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.31"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cGf&&(Gf=0),0>If&&(If=0),Ef={top:Sg?Df.top:Lf-Kg-(Ei?0:a),right:0/0,bottom:20+(Ei?0:a),left:Sg?Ii:Df.left},Hf=Sg?Df.left-Ii-Ji:Gf,Jf=Sg?If:Lf-Ef.top-Ef.bottom,0>Hf&&(Hf=0),0>Jf&&(Jf=0),Ff={top:Ei?0:Lf-a,right:0/0,bottom:0,left:Ei?Kf-b:0},p(),Ei&&Yd(of.data.targets)&&(Ff.left=Gf/2+Nf)}function o(){Si.select("line."+f.xgridFocus).attr("x1",Sg?0:-10).attr("x2",Sg?Gf:-10).attr("y1",Sg?-10:Df.top).attr("y2",Sg?-10:If)}function p(){Nf=If/2,Mf=.95*Nf,Of=Xd(of.data.targets)?.6*Mf:0}function q(){var a=Sg?f.axisX:f.axisY,b=nf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=nf.select(qf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return rf?rf:x()}function s(){var a=sf?sf:y();return a>0?a:320}function t(){return Yd(of.data.targets)?0:tf?tf:Sg||!gh||lh?1:v("y")}function u(){var a=1;return Yd(of.data.targets)?0:uf?uf:Ei?P()+(ph&&!Sg?v("y2"):a):ph?uh||Sg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||gh?"y2"!==a||ph?(gb(a).isInner?30:40)+("y2"===a?-10:0):Ki:Mg&&!Ei?10:1}function x(){return+nf.select(qf).style("width").replace("px","")}function y(){return+nf.select(qf).style("height").replace("px","")}function z(a){return a?-5:-(Df.left-1)}function A(a){return a?-20:-1}function B(){return z(!Sg)}function C(){return A(!Sg)}function D(){return z(Sg)}function E(){return A(Sg)}function F(a){return a?Gf+2+4:Df.left+20}function G(a){return a?80:If+2}function H(){return F(!Sg)}function I(){return G(!Sg)}function J(){return F(Sg)}function K(){return G(Sg)}function L(){var a=Sg?If:Gf,b=vc(),c=Vb()*(Ud(of.data.targets)?(b-(ni?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){Fi=a}function N(a){Gi=a}function O(a){Hi=a}function P(){return Mg?Ei?Gi*(Fi+1):Kf:0}function Q(){return Mg?Ei?Lf:Hi*(Fi+1):0}function R(){var a,b=!_f;Tf=Sg?1:0,Uf=Sg?If:Gf,Vf=Sg?0:If,Wf=Sg?Gf:1,Xf=Tf,Yf=Uf,Zf=Sg?0:Jf,$f=Sg?Hf:1,_f=T(Tf,Uf,b?void 0:_f.domain(),function(){return fg.tickOffset()}),ag=U(Vf,Wf),bg=U(Vf,Wf),cg=T(Tf,Uf,Xi,function(a){return a%1?0:ig.tickOffset()}),dg=U(Zf,$f),eg=U(Zf,$f),a=$(),fg=X(_f,zi,a),ig=X(cg,Ci,a),gg=Y(ag,Ai,mh,oh),hg=Y(bg,Bi,vh,xh),b||(Li.scale(cg),vf&&Pi.scale(_f)),S()}function S(){Pf=Db(),Qf=Eb(),Rf=Eb(.98)}function T(a,b,e,f){var g=(mi?nf.time.scale():nf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),ni){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return nf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?bg:ag}function W(a){return"y2"===Z(a)?eg:dg}function X(a,b,c){var d=(ni?Bb():nf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),ni?(d.tickCentered(Wg),ne(Yg)&&(Yg=!1)):d.tickOffset=function(){var a=Sg?If:Gf;return a*Vb()/vc()/2},ni&&d.categories(Vg),d}function Y(a,b,c,d){return nf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in qg?qg[a]:"y"}function $(){var a=mi?wi:ni?Oc:function(a){return 0>a?a.toFixed(0):a};return Xg&&("function"==typeof Xg?a=Xg:mi&&(a=function(a){return a?vi(Xg)(a):""})),a}function _(a){var b;return"y"===a?b=kh:"y2"===a?b=th:"x"===a&&(b=fh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?kh=b:"y2"===a?th=b:"x"===a&&(fh=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Sg?"inner-top":"inner-right")}function eb(){return cb("y",Sg?"inner-right":"inner-top")}function fb(){return cb("y2",Sg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?Gf/2:Gf:b.isBottom?-If:b.isMiddle?-If/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Sg,db())}function ob(){return kb(Sg,eb())}function pb(){return kb(Sg,fb())}function qb(){return lb(!Sg,db())}function rb(){return lb(Sg,eb())}function sb(){return lb(Sg,fb())}function tb(){var a=db();return Sg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Sg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Sg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Sg,db())}function xb(){return mb(Sg,eb())}function yb(){return mb(Sg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return nf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Si.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Si.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Si.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+o)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Mc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return nf.min(Object.keys(i).map(function(a){return nf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(pg.length>0)for(g=Nc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return nf.max(Object.keys(i).map(function(a){return nf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?rh:ih,n="y2"===c?qh:hh,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?sh:jh,r=pd()&&Sg;return 0===l.length?"y2"===c?bg.domain():ag.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=qd(o,p),j=$b(ag.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&nh&&(f=b(nh.top)?nh.top:e,g=b(nh.bottom)?nh.bottom:e),"y2"===c&&wh&&(f=b(wh.top)?wh.top:e,g=b(wh.bottom)?wh.bottom:e),Ud(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Xi),c=$b(_f.domain());return a||0===c?1:b/c}function Wb(a){return ch?ch:nf.min(a,function(a){return nf.min(a.values,function(a){return a.x})})}function Xb(a){return bh?bh:nf.max(a,function(a){return nf.max(a.values,function(a){return a.x})})}function Yb(a,c){var d,e,f,g,h=c[0],i=c[1],j=Math.abs(h-i);return ni?e=0:Ud(a)?(d=vc(),e=d>1?j/(d-1)/2:.5):e=.01*j,"object"==typeof dh&&oe(dh)?(f=b(dh.left)?dh.left:e,g=b(dh.right)?dh.right:e):f=g="number"==typeof dh?dh:e,{left:f,right:g}}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=0,g=0;return(c||0===c)&&(f=mi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=mi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return jg&&a===jg||oe(kg)&&pe(kg,a)}function fc(a){return!ec(a)}function gc(a){return jg?jg:oe(kg)?kg[a]:null}function hc(a,b){var c,d=b&&oe(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=of.data.xs[b])}),c}function ic(a,b){return a in of.data.xs&&of.data.xs[a]&&of.data.xs[a][b]?of.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){kg[b]=a[b]})}function kc(a){return 1===nf.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=ng[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),of.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=mi?a?a instanceof Date?a:je(a):je(ic(b,c)):oi&&!ni?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?of.data.xs[c]=a.map(function(a){return a[f]}).filter(b):jg?(d=Object.keys(of.data.xs),of.data.xs[c]=d.length>0?of.data.xs[d[0]]:void 0):oe(kg)&&(of.data.xs[c]=hc(f,of.data.targets)):of.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!of.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=mg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return oi&&ni&&0===c&&g&&(0===e&&(Vg=[]),Vg.push(g)),("undefined"==typeof a[b]||of.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),rg&&Sd(xc(c).filter(function(a){return!(a in sg)}),rg),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function tc(a){return a>0&&of.data.targets[0].values[a-1]?of.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?of.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?of.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(of.data.targets)}function zc(a,b){var c,d=xc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(mi?new Date(h):h);i.push(d)}return mi||(i=i.sort(function(a,b){return a-b})),i}function Gc(a){xi=xi.concat(a)}function Hc(a){xi=xi.filter(function(b){return a.indexOf(b)<0})}function Ic(a){yi=yi.concat(a)}function Jc(a){yi=yi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(yd(a,f))),a[g].x&&(e=e.concat(yd(a,g))),Bd(e,b)):zd(a,b,f,g)}function Ad(a,b){var c;return c=a.map(function(a){return zd(a.values,b)}),Bd(c,b)}function Bd(a,b){var c,d;return a.forEach(function(a){var e=qe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Cd(a,b){return nf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Dd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Ed(){return ug&&"desc"===ug.toLowerCase()}function Fd(){return ug&&"asc"===ug.toLowerCase()}function Gd(a){var b=Fd(),c=Ed();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof ug&&a.sort(ug),a}function Hd(a,c){var d,e,f,g,h,i,j,k=Yd(of.data.targets),l=k?sd:rd,m=a.filter(function(a){return a&&b(a.value)});_h&&0!==m.length&&(Vi.html(ci(a,$(),l,ui)).style("display","block"),d=Vi.property("offsetWidth"),e=Vi.property("offsetHeight"),k?(g=Gf/2+c[0],i=If/2+c[1]+20):(Sg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=_f(m[0].x)+20):(f=q(),g=f+t()+_f(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Vi.style("top",i+"px").style("left",g+"px"))}function Id(){Vi.style("display","none")}function Jd(a){var c=a.filter(function(a){return a&&b(a.value)});_h&&(Vd(of.data.targets)||Yd(of.data.targets)||Si.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Sg?"y1":"x1",ud).attr(Sg?"y2":"x2",ud))}function Kd(){Si.select("line."+f.xgridFocus).style("visibility","hidden")}function Ld(a){return a.x||0===a.x?_f(a.x):null}function Md(a){return V(a.id)(a.value)}function Nd(){var a,b,d={},e=0;return Dc(Ac(_d)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Rd(a,b){return Lh?Lh:b?2*a.tickOffset()*Mh/b:0}function Sd(a,b){yc(a).forEach(function(a){Zi[a]=b===sg[a],sg[a]=b})}function Td(a,b){var c=!1;return a.forEach(function(a){sg[a.id]===b&&(c=!0),a.id in sg||"line"!==b||(c=!0)}),c}function Ud(a){return Td(a,"bar")}function Vd(a){return Td(a,"scatter")}function Wd(a){return Td(a,"pie")}function Xd(a){return Td(a,"donut")}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){var b="string"==typeof a?a:a.id;return!(b in sg)||"line"===sg[b]||"spline"===sg[b]||"area"===sg[b]||"area-spline"===sg[b]}function $d(a){var b="string"==typeof a?a:a.id;return"spline"===sg[b]||"area-spline"===sg[b]}function _d(a){var b="string"==typeof a?a:a.id;return"bar"===sg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"scatter"===sg[b]}function be(a){var b="string"==typeof a?a:a.id;return"pie"===sg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"donut"===sg[b]}function de(a){return be(a)||ce(a)}function ee(a){return _d(a)?a.values:[]}function fe(a){return Zd(a)||ae(a)?a.values:[]}function ge(a){return _d(a)||Zd(a)?a.values:[]}function he(a){return ce(a)&&Vh||be(a)&&Ph}function ie(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function je(b){var c;try{c=lg?nf.time.format(lg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+lg)}return c}function ke(a,b){var c=nf.mouse(a),d=nf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function pe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function qe(a,b){var c="y"===Z(a.id)?ag:bg,d=Sg?1:0,e=Sg?0:1;return Math.pow(_f(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function re(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function se(a,b,c){Fg(b,a.node()),Si.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Sg?Md:Ld).attr("cy",Sg?Ld:Md).attr("stroke",function(){return ui(b)}).attr("r",1.4*Jh).transition().duration(100).attr("r",Jh)}function te(a,b,c){Gg(b,a.node()),Si.select("."+f.selectedCircles+gd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ue(a,b,c,d){a?se(b,c,d):te(b,c,d)}function ve(a,b){Fg(b,a.node()),a.transition().duration(100).style("fill",function(){return nf.rgb(ui(b)).darker(1)})}function we(a,b){Gg(b,a.node()),a.transition().duration(100).style("fill",function(){return ui(b)})}function xe(a,b,c,d){a?ve(b,c,d):we(b,c,d)}function ye(a){return a.filter(function(a){return b(a.value)})}function ze(a,c){return(c?Si.selectAll("."+f.circles+gd(c)):Si).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ae(a,b){ze(a,b).classed(f.EXPANDED,!0).attr("r",Ih)}function Be(a){ze(a).filter(function(){return nf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Fh)}function Ce(a){return Si.selectAll("."+f.bar+(b(a)?"-"+a:""))}function De(a){Ce(a).classed(f.EXPANDED,!0)}function Ee(a){Ce(a).classed(f.EXPANDED,!1)}function Fe(a,b){var c=Je(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 Ge(a,b){var c=Je(a,!1),d=b?He:Ie;return function(a,b){return d(c(a,b),a,this)}}function He(a,b){var c;return Sg?(c=_d(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ie(a,b,c){var d=c.getBoundingClientRect();return Sg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:_d(b)?-3:-6)}function Je(a,b){var c=a.__max__+1,d=Rd(fg,c),e=Od(d,c,a,!!b),f=Pd(!!b),g=Qd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return 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 Ke(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 Le(b){var c,d,e;if(Wi=nf.select(qf),Wi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Wi.html(""),Wi.classed("c3",!0),of.data.xs={},of.data.targets=rc(b),n(),R(),_f.domain(nf.extent(Zb(of.data.targets))),ag.domain(Ub(of.data.targets,"y")),bg.domain(Ub(of.data.targets,"y2")),cg.domain(_f.domain()),dg.domain(ag.domain()),eg.domain(bg.domain()),Xi=_f.domain(),Li.scale(cg),vf&&Pi.scale(_f),Qi=Wi.append("svg").attr("width",Gf+Df.left+Df.right).attr("height",If+Df.top+Df.bottom).on("mouseenter",yf).on("mouseleave",zf),Ri=Qi.append("defs"),Ri.append("clipPath").attr("id",gi).append("rect").attr("width",Gf).attr("height",If),Ri.append("clipPath").attr("id",hi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Ri.append("clipPath").attr("id",ii).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Si=Qi.append("g").attr("transform",Di.main),Ti=Jg?Qi.append("g").attr("transform",Di.context):null,Ui=Qi.append("g").attr("transform",Di.legend),Mg||(Ui.style("visibility","hidden"),yi=xc(of.data.targets)),Vi=nf.select(qf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),hf(xc(of.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Si.append("g").attr("class",f.axisX).attr("clip-path",Sg?"":ki).attr("transform",Di.x).append("text").attr("class",f.axisXLabel).attr("transform",Sg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),gh&&Si.append("g").attr("class",f.axisY).attr("clip-path",Sg?li:"").attr("transform",Di.y).append("text").attr("class",f.axisYLabel).attr("transform",Sg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),ph&&Si.append("g").attr("class",f.axisY2).attr("transform",Di.y2).append("text").attr("class",f.axisY2Label).attr("transform",Sg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Si.append("g").attr("clip-path",ji).attr("class",f.grid),yh&&d.append("g").attr("class",f.xgrids),oe(Ah)&&d.append("g").attr("class",f.xgridLines),Gh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Bh&&d.append("g").attr("class",f.ygrids),oe(Ch)&&d.append("g").attr("class",f.ygridLines),Si.append("g").attr("clip-path",ji).attr("class",f.regions),Si.append("g").attr("clip-path",ji).attr("class",f.chart),c=Si.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",vf?Sg?"ns-resize":"ew-resize":null),Si.select("."+f.chart).append("g").attr("class",f.chartBars),Si.select("."+f.chart).append("g").attr("class",f.chartLines),Si.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Di.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Si.select("."+f.chart).append("g").attr("class",f.chartTexts),vf&&Si.insert("rect",xf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Gf).attr("height",If).style("opacity",0).style("cursor",Sg?"ns-resize":"ew-resize").call(Pi).on("dblclick.zoom",null),eh&&Li.extent("function"!=typeof eh?eh:eh(Zb())),Jg&&(Ti.append("g").attr("clip-path",ji).attr("class",f.chart),Ti.select("."+f.chart).append("g").attr("class",f.chartBars),Ti.select("."+f.chart).append("g").attr("class",f.chartLines),Ti.append("g").attr("clip-path",ji).attr("class",f.brush).call(Li).selectAll("rect").attr(Sg?"width":"height",Sg?Hf:Jf),Ti.append("g").attr("class",f.axisX).attr("transform",Di.subx).attr("clip-path",Sg?"":ki)),Ye(of.data.targets),Sg?Si.select("."+f.axisX).style("opacity",0).call(fg):(Si.select("."+f.axisY).style("opacity",0).call(gg),Si.select("."+f.axisY2).style("opacity",0).call(hg)),Se({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),di){if(mi&&"string"==typeof ei){for(ei=je(ei),e=0;e0){d=[];for(var g in ng)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Dd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=xe,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 Qe(a){Yd(of.data.targets)||yg&&(pi=a,Si.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),qi=!0,Hg())}function Re(){Yd(of.data.targets)||yg&&(Si.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Si.selectAll("."+f.shape).classed(f.INCLUDED,!1),qi=!1,Ig())}function Se(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Nd(),U=Yd(of.data.targets),V=Dc(of.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?Cf:0,O=B?N:0,P=C?N:0,H&&Mg&&hf(xc(of.data.targets),a),G&&(_f.domain(nf.extent(Zb(V))),Xi=_f.domain(),vf&&Pi.scale(_f).updateScaleExtent(),cg.domain(_f.domain()),Li.scale(cg)),F&&(_f.domain(Li.empty()?Xi:Li.extent()),vf&&Pi.scale(_f).updateScaleExtent()),ag.domain(Ub(V,"y")),bg.domain(Ub(V,"y2")),Vd(V)||(Q=ah?ah:Fc(Ec(V)),fg.tickValues(Q),ig.tickValues(Q)),c=Si.select("."+f.axisX).style("opacity",U?0:1),(Sg||D)&&(c=c.transition().duration(P)),c.call(fg),e=Si.select("."+f.axisY).style("opacity",U?0:1),(!Sg||D)&&(e=e.transition().duration(P)),e.call(gg),Si.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(hg),F)if(Yg&&Q){for(R=1;R=0&&nf.select(this).style("display",b%S?"none":"block")})}else nf.selectAll("."+f.axisX+" .tick text").style("display","block");if(I=Fe(T),K=Ge(T,!0),M=Ge(T,!1),Ab(),dg.domain(ag.domain()),eg.domain(bg.domain()),Vi.style("display","none"),o(),Si.select("line."+f.xgridFocus).style("visibility","hidden"),yh){if("year"===zh){h=[];for(var W=Zb(),X=W[0].getFullYear(),Y=W[1].getFullYear(),Z=X;Y>=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=_f.ticks(10);g=Si.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Sg?0:function(a){return _f(a)-fg.tickOffset()}).attr("x2",Sg?Gf:function(a){return _f(a)-fg.tickOffset()}).attr("y1",Sg?function(a){return _f(a)-fg.tickOffset()}:Df.top).attr("y2",Sg?function(a){return _f(a)-fg.tickOffset()}:If).style("opacity",function(){return+nf.select(this).attr(Sg?"y1":"x1")===(Sg?If:0)?0:1}),g.exit().remove()}oe(Ah)&&(i=Si.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Ah),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Sg?"":"rotate(-90)").attr("dx",Sg?0:-Df.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Sg?0:vd).attr("x2",Sg?Gf:vd).attr("y1",Sg?vd:Df.top).attr("y2",Sg?vd:If).style("opacity",1),i.select("text").transition().duration(N).attr("x",Sg?Gf:0).attr("y",vd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&Bh&&(k=Si.select("."+f.ygrids).selectAll("."+f.ygrid).data(ag.ticks(Dh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Sg?ag:0).attr("x2",Sg?ag:Gf).attr("y1",Sg?0:ag).attr("y2",Sg?If:ag),k.exit().remove()),y&&oe(Ch)&&(l=Si.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Ch),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Sg?"rotate(-90)":"").attr("dx",Sg?0:-Df.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Sg?wd:0).attr("x2",Sg?wd:Gf).attr("y1",Sg?0:wd).attr("y2",Sg?If:wd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Sg?0:Gf).attr("y",wd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Si.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ui(a)}).attr("class",Xc),p.style("opacity",ld).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Si.selectAll("."+f.texts).selectAll("."+f.text).data(ge),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Sg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return td(a.id)(a.value)}).style("fill-opacity",md).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",od),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Si.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Mi).style("opacity",1),Si.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Ni).style("opacity",Yi),n=Si.selectAll("."+f.circles).selectAll("."+f.circle).data(fe),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",Fh),n.style("opacity",ld).transition().duration(N).style("opacity",nd).attr("cx",Sg?Md:Ld).attr("cy",Sg?Ld:Md),n.exit().remove(),Si.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=nf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Si.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&de(a.data)?1:0}),Si.select("."+f.chartArcsTitle).style("opacity",Xd(of.data.targets)?1:0),Jg&&(null!==nf.event&&"zoom"===nf.event.type&&Li.extent(_f.orgDomain()).update(),z&&(Ti.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(ig),Li.empty()||Li.extent(_f.orgDomain()).update(),J=Fe(T,!0),s=Ti.selectAll("."+f.bars).selectAll("."+f.bar).data(ee),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ui(a)}).attr("class",Xc),s.style("opacity",ld).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Ti.selectAll("."+f.line).style("opacity",ld).transition().duration(N).attr("d",Oi).style("opacity",1))),Si.selectAll("."+f.selectedCircles).filter(function(a){return _d(a)}).selectAll("circle").remove(),Si.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Sg?Md:Ld).attr("cy",Sg?Ld:Md),t=Si.select("."+f.eventRects),oe(kg)&&!kc(kg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Si.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ne(u.enter()),u.attr("x",0).attr("y",0).attr("width",Gf).attr("height",If)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),oi&&!ni?(x=function(a,b){var c=tc(b),d=uc(b),e=of.data.xs[a.id][b];return(_f(d?d:e+50)-_f(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=of.data.xs[a.id][b];return(_f(d)+_f(c?c:d-50))/2}):(x=L(),w=function(a){return _f(a.x)-x/2}),v=wc(),Si.select("."+f.eventRects).datum(v?v.values:[]),u=Si.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Me(u.enter()),u.attr("class",ad).attr("x",Sg?0:w).attr("y",Sg?w:0).attr("width",Sg?Gf:x).attr("height",Sg?x:If),u.exit().remove()),q=Si.select("."+f.regions).selectAll("rect."+f.region).data($h),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Sg?0:cc).attr("y",Sg?cc:Df.top).attr("width",Sg?Gf:dc).attr("height",Sg?dc:If).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),xc(of.data.targets).forEach(function(a){Zi[a]=!0})}}function Te(){Se({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ue(){return"mousemove"===nf.event.sourceEvent.type&&Pi.altDomain?(_f.domain(Pi.altDomain),void Pi.scale(_f).updateScaleExtent()):(ni&&_f.orgDomain()[0]===Xi[0]&&_f.domain([Xi[0]-1e-10,_f.orgDomain()[1]]),Se({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===nf.event.sourceEvent.type&&(ri=!0)))}function Ve(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function We(){Qi.attr("width",Kf).attr("height",Lf),Qi.select("#"+gi).select("rect").attr("width",Gf).attr("height",If),Qi.select("#"+hi).select("rect").attr("width",H),Qi.select("#"+ii).select("rect").attr("width",J),Qi.select("."+f.zoomRect).attr("width",Gf).attr("height",If)}function Xe(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),We(),m(a.withTransition),Se(a)}function Ye(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Si.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",cd),j=i.enter().append("g").attr("class",cd).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ui(a)}),e=Si.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),d=e.enter().append("g").attr("class",ed).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ui(a)}).style("stroke","none").style("cursor",function(a){return Ag(a)?"pointer":null}),c=Si.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),b=c.enter().append("g").attr("class",dd).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ui(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Yi=+nf.select(this).style("opacity"),0}).style("fill",function(a){return ui(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ui(a)}).style("cursor",function(a){return Ag(a)?"pointer":null}),a.forEach(function(a){Si.selectAll("."+f.selectedCircles+gd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Si.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Sf(a)).attr("class",fd),g=h.enter().append("g").attr("class",fd),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ui(a.data)}).style("cursor",function(a){return Ag(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),cf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Hd(c,nf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),ef(),Id(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Jg&&(n=Ti.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",ed),m=n.enter().append("g").attr("class",ed),m.append("g").attr("class",Yc).style("fill",function(a){return ui(a)}),l=Ti.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",dd),k=l.enter().append("g").attr("class",dd),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ui(a)})),Qi.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Ze(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Sd(a.id,b.types[a.id]):Sd(a.id,b.type)}),of.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Ei?j:i,l=Ei?Q():P();return d&&(w=0,C=0,t=0,u=0),Mg&&!Cc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Ei?u:t,void(Rg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,Ei?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Ui.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Og?Og(a):of.toggle(a)}).on("mouseover",function(a){of.focus(a),"function"==typeof Pg&&Pg(a)}).on("mouseout",function(a){of.revert(),"function"==typeof Qg&&Qg(a)}),l.append("text").text(function(a){return d(ng[a])?ng[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",Ei?g:-200).attr("y",Ei?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ei?h:-200).attr("y",Ei?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return ui(a)}).attr("x",Ei?g:-200).attr("y",Ei?-200:i).attr("width",10).attr("height",10),Ui.selectAll("text").data(a).text(function(a){return d(ng[a])?ng[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Ui.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Ui.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),We(),q&&m(p)}function jf(a){return zc(of.data.targets,a.id)}function kf(a){return"data"in a&&zc(of.data.targets,a.data.id)}function lf(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 mf(a,b,c){var d=!Yd(of.data.targets);Sd(a,b),Xe(c?c:{withTransitionForAxis:d})}var nf=a.d3?a.d3:a.require?a.require("d3"):void 0,of={data:{},axis:{},legend:{}},pf={},qf=h(["bindto"],"#chart"),rf=h(["size","width"]),sf=h(["size","height"]),tf=h(["padding","left"]),uf=h(["padding","right"]),vf=h(["zoom","enabled"],!1),wf=h(["zoom","extent"]),xf=h(["zoom","privileged"],!1),yf=h(["onenter"],function(){}),zf=h(["onleave"],function(){}),Af=h(["onresize"],function(){}),Bf=h(["onresized"],function(){}),Cf=h(["transition","duration"],350);g("data","data is required in config");var Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg=h(["data","x"]),kg=h(["data","xs"],{}),lg=h(["data","x_format"]),mg=h(["data","id_converter"],function(a){return a}),ng=h(["data","names"],{}),og=h(["data","classes"],{}),pg=h(["data","groups"],[]),qg=h(["data","axes"],{}),rg=h(["data","type"]),sg=h(["data","types"],{}),tg=h(["data","labels"],{}),ug=h(["data","order"]),vg=h(["data","regions"],{}),wg=h(["data","color"]),xg=h(["data","colors"],{}),yg=h(["data","selection","enabled"],!1),zg=h(["data","selection","grouped"],!1),Ag=h(["data","selection","isselectable"],function(){return!0}),Bg=h(["data","selection","multiple"],!0),Cg=h(["data","onclick"],function(){}),Dg=h(["data","onenter"],function(){}),Eg=h(["data","onleave"],function(){}),Fg=h(["data","onselected"],function(){}),Gg=h(["data","onunselected"],function(){}),Hg=h(["data","ondragstart"],function(){}),Ig=h(["data","ondragend"],function(){}),Jg=h(["subchart","show"],!1),Kg=Jg?h(["subchart","size","height"],60):0,Lg=h(["color","pattern"],[]),Mg=h(["legend","show"],!0),Ng=h(["legend","position"],"bottom"),Og=h(["legend","item","onclick"]),Pg=h(["legend","item","onmouseover"]),Qg=h(["legend","item","onmouseout"]),Rg=h(["legend","equally"],!1),Sg=h(["axis","rotated"],!1),Tg=h(["axis","x","type"],"indexed"),Ug=h(["axis","x","localtime"],!0),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"],10),$g=h(["axis","x","tick","count"]),_g=h(["axis","x","tick","fit"],!1),ah=h(["axis","x","tick","values"],null),bh=h(["axis","x","max"]),ch=h(["axis","x","min"]),dh=h(["axis","x","padding"],{}),eh=h(["axis","x","default"]),fh=h(["axis","x","label"],{}),gh=h(["axis","y","show"],!0),hh=h(["axis","y","max"]),ih=h(["axis","y","min"]),jh=h(["axis","y","center"]),kh=h(["axis","y","label"],{}),lh=h(["axis","y","inner"],!1),mh=h(["axis","y","tick","format"]),nh=h(["axis","y","padding"],{}),oh=h(["axis","y","ticks"],10),ph=h(["axis","y2","show"],!1),qh=h(["axis","y2","max"]),rh=h(["axis","y2","min"]),sh=h(["axis","y2","center"]),th=h(["axis","y2","label"],{}),uh=h(["axis","y2","inner"],!1),vh=h(["axis","y2","tick","format"]),wh=h(["axis","y2","padding"],{}),xh=h(["axis","y2","ticks"],10),yh=h(["grid","x","show"],!1),zh=h(["grid","x","type"],"tick"),Ah=h(["grid","x","lines"],[]),Bh=h(["grid","y","show"],!1),Ch=h(["grid","y","lines"],[]),Dh=h(["grid","y","ticks"],10),Eh=h(["point","show"],!0),Fh=Eh?h(["point","r"],2.5):0,Gh=h(["point","focus","line","enabled"],!0),Hh=h(["point","focus","expand","enabled"],!0),Ih=h(["point","focus","expand","r"],Hh?4:Fh),Jh=h(["point","focus","select","r"],8),Kh=h(["line","connect_null"],!1),Lh=h(["bar","width"]),Mh=h(["bar","width","ratio"],.6),Nh=h(["pie","label","show"],!0),Oh=h(["pie","label","format"]),Ph=h(["pie","expand"],!0),Qh=h(["pie","onclick"],function(){}),Rh=h(["pie","onmouseover"],function(){}),Sh=h(["pie","onmouseout"],function(){}),Th=h(["donut","label","show"],!0),Uh=h(["donut","label","format"]),Vh=h(["donut","expand"],!0),Wh=h(["donut","title"],""),Xh=h(["donut","onclick"],function(){}),Yh=h(["donut","onmouseover"],function(){}),Zh=h(["donut","onmouseout"],function(){}),$h=h(["regions"],[]),_h=h(["tooltip","show"],!0),ai=h(["tooltip","format","title"]),bi=h(["tooltip","format","value"]),ci=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ai?ai:b,l=bi?bi: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+""}),di=h(["tooltip","init","show"],!1),ei=h(["tooltip","init","x"],0),fi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),gi=("string"==typeof qf?qf.replace("#",""):qf.id)+"-clip",hi=gi+"-xaxis",ii=gi+"-yaxis",ji=i(gi),ki=i(hi),li=i(ii),mi="timeseries"===Tg,ni="categorized"===Tg,oi=!mi&&(jg||oe(kg)),pi=null,qi=!1,ri=!1,si=!1,ti=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ui=ie(xg,oe(Lg)?Lg:ti,wg),vi=Ug?nf.time.format:nf.time.format.utc,wi=function(){var a=[[vi("%Y/%-m/%-d"),function(){return!0}],[vi("%-m/%-d"),function(a){return a.getMonth()}],[vi("%-m/%-d"),function(a){return 1!==a.getDate()}],[vi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[vi("%I %p"),function(a){return a.getHours()}],[vi("%I:%M"),function(a){return a.getMinutes()}],[vi(":%S"),function(a){return a.getSeconds()}],[vi(".%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)}}(),xi=[],yi=[],zi=Sg?"left":"bottom",Ai=Sg?lh?"top":"bottom":lh?"right":"left",Bi=Sg?uh?"bottom":"top":uh?"left":"right",Ci=Sg?"left":"bottom",Di={main:function(){return"translate("+Df.left+","+Df.top+")"},context:function(){return"translate("+Ef.left+","+Ef.top+")"},legend:function(){return"translate("+Ff.left+","+Ff.top+")"},x:function(){return"translate(0,"+(Sg?0:If)+")"},y:function(){return"translate(0,"+(Sg?If:0)+")"},y2:function(){return"translate("+(Sg?0:Gf)+","+(Sg?1:0)+")"},subx:function(){return"translate(0,"+(Sg?0:Jf)+")"},arc:function(){return"translate("+Gf/2+","+If/2+")"}},Ei="right"===Ng,Fi=0,Gi=0,Hi=0,Ii=30,Ji=30,Ki=5;Sf=nf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Li,Mi=function(){var a=nf.svg.line().x(Sg?function(a){return V(a.id)(a.value)}:ud).y(Sg?ud:function(a){return V(a.id)(a.value)});return Kh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Kh?ye(b.values):b.values;return Zd(b)?(a.interpolate($d(b)?"cardinal":"linear"),vg[b.id]?Ke(e,_f,V(b.id),vg[b.id]):a(e)):(c=e[0]?_f(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Sg?"M "+d+" "+c:"M "+c+" "+d)}}(),Ni=function(){var a;return a=Sg?nf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(ud):nf.svg.area().x(ud).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=ye(b.values);return Td([b],"area")||Td([b],"area-spline")?(a.interpolate($d(b)?"cardinal":"linear"),a(e)):(c=e[0]?_f(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Sg?"M "+d+" "+c:"M "+c+" "+d)}}(),Oi=function(){var a=nf.svg.line().x(Sg?function(a){return W(a.id)(a.value)}:xd).y(Sg?xd:function(a){return W(a.id)(a.value)});return function(b){var c=ye(b.values);return Zd(b)?a(c):"M "+cg(c[0].x)+" "+W(b.id)(c[0].value)}}(),Pi=function(){};Li=nf.svg.brush().on("brush",Te),Li.update=function(){return Ti&&Ti.select("."+f.brush).call(this),this},Li.scale=function(a){return Sg?this.y(a):this.x(a)},vf&&(Pi=nf.behavior.zoom().on("zoomstart",function(){Pi.altDomain=nf.event.sourceEvent.altKey?_f.orgDomain():null}).on("zoom",vf?Ue:null),Pi.scale=function(a){return Sg?this.y(a):this.x(a)},Pi.orgScaleExtent=function(){var a=wf?wf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},Pi.updateScaleExtent=function(){var a=$b(_f.orgDomain())/$b(Xi),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Qi,Ri,Si,Ti,Ui,Vi,Wi,Xi,Yi,Zi={};if(of.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Qi.selectAll(hd(a)),d=c.filter(jf),e=c.filter(kf);of.revert(),of.defocus(),b(d.classed(f.focused,!0)),b(e),Yd(of.data.targets)&&Kb(a,!0),cf(a)},of.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=Qi.selectAll(hd(a)),d=c.filter(jf),e=c.filter(kf);of.revert(),b(d.classed(f.focused,!1)),b(e),Yd(of.data.targets)&&Lb(a),df(a)},of.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=Qi.selectAll(hd(a)),d=c.filter(jf),e=c.filter(kf);b(d.classed(f.focused,!1)),b(e),Yd(of.data.targets)&&Lb(a),ef()},of.show=function(a,b){a=yc(a),b=b||{},Hc(a),Qi.selectAll(id(a)).transition().style("opacity",1),b.withLegend?ff(a):Ui.selectAll(kd(a)).classed(f.legendItemHidden,!1),Se({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},of.hide=function(a,b){a=yc(a),b=b||{},Gc(a),Qi.selectAll(id(a)).transition().style("opacity",0),b.withLegend?gf(a):Ui.selectAll(kd(a)).classed(f.legendItemHidden,!0),Se({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},of.toggle=function(a){Bc(a)?of.hide(a):of.show(a)},of.unzoom=function(){Li.clear().update(),Se({withUpdateXDomain:!0})},of.load=function(a){return a.xs&&jc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){og[b]=a.classes[b]}),"categories"in a&&ni&&(Vg=a.categories,fg.categories(Vg)),"cacheIds"in a&&_b(a.cacheIds)?void Ze(bc(a.cacheIds),a.done):void("unload"in a?_e(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){$e(a)}):$e(a))},of.unload=function(a){_e(yc(a),function(){Se({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},of.selected=function(a){return nf.merge(Si.selectAll("."+f.shapes+gd(a)).selectAll("."+f.shape).filter(function(){return nf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},of.select=function(a,b,c){yg&&Si.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=nf.select(this),i="circle"===this.nodeName?se:ve,j="circle"===this.nodeName?te:we,k=zg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Ag(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},of.unselect=function(a,b){yg&&Si.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=nf.select(this),g="circle"===this.nodeName?te:we,h=zg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Ag(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},of.toLine=function(a){mf(a,"line")},of.toSpline=function(a){mf(a,"spline")},of.toBar=function(a){mf(a,"bar")},of.toScatter=function(a){mf(a,"scatter")},of.toArea=function(a){mf(a,"area")},of.toAreaSpline=function(a){mf(a,"area-spline")},of.toPie=function(a){mf(a,"pie",{withTransform:!0})},of.toDonut=function(a){mf(a,"donut",{withTransform:!0})},of.groups=function(a){return c(a)?pg:(pg=a,Se(),pg)},of.xgrids=function(a){return a?(Ah=a,Se(),Ah):Ah},of.xgrids.add=function(a){return a?of.xgrids(Ah.concat(a)):void 0},of.xgrids.remove=function(a){var b=lf(a);return of.xgrids(Ah.filter(b))},of.ygrids=function(a){return a?(Ch=a,Se(),Ch):Ch},of.ygrids.add=function(a){return a?of.ygrids(Ch.concat(a)):void 0},of.ygrids.remove=function(a){var b=lf(a);return of.ygrids(Ch.filter(b))},of.regions=function(a){return c(a)?$h:($h=a,Se(),$h)},of.regions.add=function(a){return c(a)?$h:($h=$h.concat(a),Se(),$h) -},of.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;Qi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),$h=$h.filter(function(b){return b.classes.indexOf(a)<0})}),$h},of.data.get=function(a){var b=of.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},of.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},of.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){ng[b]=a[b]}),hf(xc(of.data.targets),{withTransition:!0}),ng):ng},of.x=function(a){return arguments.length&&(mc(of.data.targets,a),Se({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),of.data.xs},of.xs=function(a){return arguments.length&&(nc(of.data.targets,a),Se({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),of.data.xs},of.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},of.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(hh=+a.y),b(a.y2)&&(qh=+a.y2)):hh=qh=+a,Se())},of.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(ih=+a.y),b(a.y2)&&(rh=+a.y2)):ih=rh=+a,Se())},of.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&of.axis.max(a.max),"undefined"!=typeof a.min&&of.axis.min(a.min))},of.legend.show=function(a){Mg||(Mg=!0,Ui.style("visibility","visible")),ff(yc(a)),Se({withTransitionForHorizontalAxis:!1})},of.legend.hide=function(a){Mg&&ne(a)&&(Mg=!1,Ui.style("visibility","hidden")),gf(yc(a)),Se({withTransitionForHorizontalAxis:!1})},of.resize=function(a){rf=a?a.width:null,sf=a?a.height:null,Xe({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},of.destroy=function(){of.data.targets=void 0,of.data.xs={},Wi.html(""),a.onresize=null},"url"in e.data)nf.xhr(e.data.url,function(a,b){var c,d=nf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=nf.csv.parse(b.response),Le(c)});else if("rows"in e.data)Le(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Le(qc(e.data.columns))}return of},"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.31"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cIf&&(If=0),0>Kf&&(Kf=0),Gf={top:Ug?Ff.top:Nf-Mg-(Gi?0:a),right:0/0,bottom:20+(Gi?0:a),left:Ug?Ki:Ff.left},Jf=Ug?Ff.left-Ki-Li:If,Lf=Ug?Kf:Nf-Gf.top-Gf.bottom,0>Jf&&(Jf=0),0>Lf&&(Lf=0),Hf={top:Gi?0:Nf-a,right:0/0,bottom:0,left:Gi?Mf-b:0},p(),Gi&&$d(qf.data.targets)&&(Hf.left=If/2+Pf)}function o(){Ui.select("line."+f.xgridFocus).attr("x1",Ug?0:-10).attr("x2",Ug?If:-10).attr("y1",Ug?-10:Ff.top).attr("y2",Ug?-10:Kf)}function p(){Pf=Kf/2,Of=.95*Pf,Qf=Zd(qf.data.targets)?.6*Of:0}function q(){var a=Ug?f.axisX:f.axisY,b=pf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=pf.select(sf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return tf?tf:x()}function s(){var a=uf?uf:y();return a>0?a:320}function t(){return $d(qf.data.targets)?0:vf?vf:Ug||!ih||nh?1:v("y")}function u(){var a=1;return $d(qf.data.targets)?0:wf?wf:Gi?P()+(rh&&!Ug?v("y2"):a):rh?wh||Ug?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||ih?"y2"!==a||rh?(gb(a).isInner?30:40)+("y2"===a?-10:0):Mi:Og&&!Gi?10:1}function x(){return+pf.select(sf).style("width").replace("px","")}function y(){return+pf.select(sf).style("height").replace("px","")}function z(a){return a?-5:-(Ff.left-1)}function A(a){return a?-20:-1}function B(){return z(!Ug)}function C(){return A(!Ug)}function D(){return z(Ug)}function E(){return A(Ug)}function F(a){return a?If+2+4:Ff.left+20}function G(a){return a?80:Kf+2}function H(){return F(!Ug)}function I(){return G(!Ug)}function J(){return F(Ug)}function K(){return G(Ug)}function L(){var a=Ug?Kf:If,b=xc(),c=Vb()*(Wd(qf.data.targets)?(b-(pi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){Hi=a}function N(a){Ii=a}function O(a){Ji=a}function P(){return Og?Gi?Ii*(Hi+1):Mf:0}function Q(){return Og?Gi?Nf:Ji*(Hi+1):0}function R(){var a,b=!bg;Vf=Ug?1:0,Wf=Ug?Kf:If,Xf=Ug?0:Kf,Yf=Ug?If:1,Zf=Vf,$f=Wf,_f=Ug?0:Lf,ag=Ug?Jf:1,bg=T(Vf,Wf,b?void 0:bg.domain(),function(){return hg.tickOffset()}),cg=U(Xf,Yf),dg=U(Xf,Yf),eg=T(Vf,Wf,Zi,function(a){return a%1?0:kg.tickOffset()}),fg=U(_f,ag),gg=U(_f,ag),a=$(),hg=X(bg,Bi,a),kg=X(eg,Ei,a),ig=Y(cg,Ci,oh,qh),jg=Y(dg,Di,xh,zh),b||(Ni.scale(eg),xf&&Ri.scale(bg)),S()}function S(){Rf=Db(),Sf=Eb(),Tf=Eb(.98)}function T(a,b,e,f){var g=(oi?pf.time.scale():pf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),pi){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return pf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?dg:cg}function W(a){return"y2"===Z(a)?gg:fg}function X(a,b,c){var d=(pi?Bb():pf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),pi?(d.tickCentered(Yg),pe($g)&&($g=!1)):d.tickOffset=function(){var a=Ug?Kf:If;return a*Vb()/xc()/2},pi&&d.categories(Xg),d}function Y(a,b,c,d){return pf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in sg?sg[a]:"y"}function $(){var a=oi?yi:pi?Qc:function(a){return 0>a?a.toFixed(0):a};return Zg&&("function"==typeof Zg?a=Zg:oi&&(a=function(a){return a?xi(Zg)(a):""})),a}function _(a){var b;return"y"===a?b=mh:"y2"===a?b=vh:"x"===a&&(b=hh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?mh=b:"y2"===a?vh=b:"x"===a&&(hh=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Ug?"inner-top":"inner-right")}function eb(){return cb("y",Ug?"inner-right":"inner-top")}function fb(){return cb("y2",Ug?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?If/2:If:b.isBottom?-Kf:b.isMiddle?-Kf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Ug,db())}function ob(){return kb(Ug,eb())}function pb(){return kb(Ug,fb())}function qb(){return lb(!Ug,db())}function rb(){return lb(Ug,eb())}function sb(){return lb(Ug,fb())}function tb(){var a=db();return Ug?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Ug?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Ug?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Ug,db())}function xb(){return mb(Ug,eb())}function yb(){return mb(Ug,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return pf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Ui.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Ui.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Ui.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+o)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Oc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return pf.min(Object.keys(i).map(function(a){return pf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=zc(a),i=Mc(a);if(rg.length>0)for(g=Pc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return pf.max(Object.keys(i).map(function(a){return pf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?th:kh,n="y2"===c?sh:jh,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?uh:lh,r=rd()&&Ug;return 0===l.length?"y2"===c?dg.domain():cg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=sd(o,p),j=$b(cg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&ph&&(f=b(ph.top)?ph.top:e,g=b(ph.bottom)?ph.bottom:e),"y2"===c&&yh&&(f=b(yh.top)?yh.top:e,g=b(yh.bottom)?yh.bottom:e),Wd(l)&&!Oc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Zi),c=$b(bg.domain());return a||0===c?1:b/c}function Wb(a){return eh?eh:pf.min(a,function(a){return pf.min(a.values,function(a){return a.x})})}function Xb(a){return dh?dh:pf.max(a,function(a){return pf.max(a.values,function(a){return a.x})})}function Yb(a,c){var d,e,f,g,h=c[0],i=c[1],j=Math.abs(h-i);return pi?e=0:Wd(a)?(d=xc(),e=d>1?j/(d-1)/2:.5):e=.01*j,"object"==typeof fh&&qe(fh)?(f=b(fh.left)?fh.left:e,g=b(fh.right)?fh.right:e):f=g="number"==typeof fh?fh:e,{left:f,right:g}}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=0,g=0;return(c||0===c)&&(f=oi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=oi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bb?0:b-c}function fc(a){var b,c=dc(a),d="y"===a.axis?cg:dg;return b="y"===a.axis||"y2"===a.axis?Ug?Kf:"start"in a?d(a.start):Kf:Ug?"end"in a?bg(oi?le(a.end):a.end):Kf:Kf,c>b?0:b-c}function gc(a){return lg&&a===lg||qe(mg)&&re(mg,a)}function hc(a){return!gc(a)}function ic(a){return lg?lg:qe(mg)?mg[a]:null}function jc(a,b){var c,d=b&&qe(b)?zc(b):[];return d.forEach(function(b){ic(b)===a&&(c=qf.data.xs[b])}),c}function kc(a,b){return a in qf.data.xs&&qf.data.xs[a]&&qf.data.xs[a][b]?qf.data.xs[a][b]:b}function lc(a){Object.keys(a).forEach(function(b){mg[b]=a[b]})}function mc(a){return 1===pf.set(Object.keys(a).map(function(b){return a[b]})).size()}function nc(a){var b;return a&&(b=pg[a.id],a.name=b?b:a.id),a}function oc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=qc(b[d],a.id,d)}),qf.data.xs[a.id]=b})}function pc(a,b){a.forEach(function(a){b[a.id]&&oc([a],b[a.id])})}function qc(a,b,c){var d;return d=oi?a?a instanceof Date?a:le(a):le(kc(b,c)):qi&&!pi?a?+a:kc(b,c):c}function rc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?qf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):lg?(d=Object.keys(qf.data.xs),qf.data.xs[c]=d.length>0?qf.data.xs[d[0]]:void 0):qe(mg)&&(qf.data.xs[c]=jc(f,qf.data.targets)):qf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!qf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=og(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=ic(b),g=a[f],h=qc(g,b,e);return qi&&pi&&0===c&&g&&(0===e&&(Xg=[]),Xg.push(g)),("undefined"==typeof a[b]||qf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),tg&&Ud(zc(c).filter(function(a){return!(a in ug)}),tg),c.forEach(function(a){ac(a.id_org,a)}),c}function uc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function vc(a){return a>0&&qf.data.targets[0].values[a-1]?qf.data.targets[0].values[a-1].x:void 0}function wc(a){return a1?qf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?qf.data.targets[0]:null,a}function zc(a){return a.map(function(a){return a.id})}function Ac(a){return a?"string"==typeof a?[a]:a:zc(qf.data.targets)}function Bc(a,b){var c,d=zc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(oi?new Date(h):h);i.push(d)}return oi||(i=i.sort(function(a,b){return a-b})),i}function Ic(a){zi=zi.concat(a)}function Jc(a){zi=zi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){Ai=Ai.concat(a)}function Lc(a){Ai=Ai.filter(function(b){return a.indexOf(b)<0})}function Mc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Nc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Pc(a){return Nc(a,function(a){return a>0})}function Qc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(Ad(a,f))),a[g].x&&(e=e.concat(Ad(a,g))),Dd(e,b)):Bd(a,b,f,g)}function Cd(a,b){var c;return c=a.map(function(a){return Bd(a.values,b)}),Dd(c,b)}function Dd(a,b){var c,d;return a.forEach(function(a){var e=se(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Ed(a,b){return pf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Fd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Gd(){return wg&&"desc"===wg.toLowerCase()}function Hd(){return wg&&"asc"===wg.toLowerCase()}function Id(a){var b=Hd(),c=Gd();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof wg&&a.sort(wg),a}function Jd(a,c){var d,e,f,g,h,i,j,k=$d(qf.data.targets),l=k?ud:td,m=a.filter(function(a){return a&&b(a.value)});bi&&0!==m.length&&(Xi.html(ei(a,$(),l,wi)).style("display","block"),d=Xi.property("offsetWidth"),e=Xi.property("offsetHeight"),k?(g=If/2+c[0],i=Kf/2+c[1]+20):(Ug?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=bg(m[0].x)+20):(f=q(),g=f+t()+bg(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Xi.style("top",i+"px").style("left",g+"px"))}function Kd(){Xi.style("display","none")}function Ld(a){var c=a.filter(function(a){return a&&b(a.value)});bi&&(Xd(qf.data.targets)||$d(qf.data.targets)||Ui.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Ug?"y1":"x1",wd).attr(Ug?"y2":"x2",wd))}function Md(){Ui.select("line."+f.xgridFocus).style("visibility","hidden")}function Nd(a){return a.x||0===a.x?bg(a.x):null}function Od(a){return V(a.id)(a.value)}function Pd(){var a,b,d={},e=0;return Fc(Cc(be)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Td(a,b){return Nh?Nh:b?2*a.tickOffset()*Oh/b:0}function Ud(a,b){Ac(a).forEach(function(a){_i[a]=b===ug[a],ug[a]=b})}function Vd(a,b){var c=!1;return a.forEach(function(a){ug[a.id]===b&&(c=!0),a.id in ug||"line"!==b||(c=!0)}),c}function Wd(a){return Vd(a,"bar")}function Xd(a){return Vd(a,"scatter")}function Yd(a){return Vd(a,"pie")}function Zd(a){return Vd(a,"donut")}function $d(a){return Yd(a)||Zd(a)}function _d(a){var b="string"==typeof a?a:a.id;return!(b in ug)||"line"===ug[b]||"spline"===ug[b]||"area"===ug[b]||"area-spline"===ug[b]}function ae(a){var b="string"==typeof a?a:a.id;return"spline"===ug[b]||"area-spline"===ug[b]}function be(a){var b="string"==typeof a?a:a.id;return"bar"===ug[b]}function ce(a){var b="string"==typeof a?a:a.id;return"scatter"===ug[b]}function de(a){var b="string"==typeof a?a:a.id;return"pie"===ug[b]}function ee(a){var b="string"==typeof a?a:a.id;return"donut"===ug[b]}function fe(a){return de(a)||ee(a)}function ge(a){return be(a)?a.values:[]}function he(a){return _d(a)||ce(a)?a.values:[]}function ie(a){return be(a)||_d(a)?a.values:[]}function je(a){return ee(a)&&Xh||de(a)&&Rh}function ke(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function le(b){var c;try{c=ng?pf.time.format(ng).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ng)}return c}function me(a,b){var c=pf.mouse(a),d=pf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function re(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function se(a,b){var c="y"===Z(a.id)?cg:dg,d=Ug?1:0,e=Ug?0:1;return Math.pow(bg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function te(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function ue(a,b,c){Hg(b,a.node()),Ui.select("."+f.selectedCircles+id(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Rc(f.selectedCircle,c)}).attr("cx",Ug?Od:Nd).attr("cy",Ug?Nd:Od).attr("stroke",function(){return wi(b)}).attr("r",1.4*Lh).transition().duration(100).attr("r",Lh)}function ve(a,b,c){Ig(b,a.node()),Ui.select("."+f.selectedCircles+id(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a,b){Hg(b,a.node()),a.transition().duration(100).style("fill",function(){return pf.rgb(wi(b)).darker(1)})}function ye(a,b){Ig(b,a.node()),a.transition().duration(100).style("fill",function(){return wi(b)})}function ze(a,b,c,d){a?xe(b,c,d):ye(b,c,d)}function Ae(a){return a.filter(function(a){return b(a.value)})}function Be(a,c){return(c?Ui.selectAll("."+f.circles+id(c)):Ui).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ce(a,b){Be(a,b).classed(f.EXPANDED,!0).attr("r",Kh)}function De(a){Be(a).filter(function(){return pf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Hh)}function Ee(a){return Ui.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Fe(a){Ee(a).classed(f.EXPANDED,!0)}function Ge(a){Ee(a).classed(f.EXPANDED,!1)}function He(a,b){var c=Le(a,b);return function(a,b){var d=c(a,b),e=Ug?1:0,f=Ug?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function Ie(a,b){var c=Le(a,!1),d=b?Je:Ke;return function(a,b){return d(c(a,b),a,this)}}function Je(a,b){var c;return Ug?(c=be(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ke(a,b,c){var d=c.getBoundingClientRect();return Ug?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:be(b)?-3:-6)}function Le(a,b){var c=a.__max__+1,d=Td(hg,c),e=Qd(d,c,a,!!b),f=Rd(!!b),g=Sd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Ug&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Me(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function Ne(b){var c,d,e;if(Yi=pf.select(sf),Yi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Yi.html(""),Yi.classed("c3",!0),qf.data.xs={},qf.data.targets=tc(b),n(),R(),bg.domain(pf.extent(Zb(qf.data.targets))),cg.domain(Ub(qf.data.targets,"y")),dg.domain(Ub(qf.data.targets,"y2")),eg.domain(bg.domain()),fg.domain(cg.domain()),gg.domain(dg.domain()),Zi=bg.domain(),Ni.scale(eg),xf&&Ri.scale(bg),Si=Yi.append("svg").attr("width",If+Ff.left+Ff.right).attr("height",Kf+Ff.top+Ff.bottom).on("mouseenter",Af).on("mouseleave",Bf),Ti=Si.append("defs"),Ti.append("clipPath").attr("id",ii).append("rect").attr("width",If).attr("height",Kf),Ti.append("clipPath").attr("id",ji).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Ti.append("clipPath").attr("id",ki).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Ui=Si.append("g").attr("transform",Fi.main),Vi=Lg?Si.append("g").attr("transform",Fi.context):null,Wi=Si.append("g").attr("transform",Fi.legend),Og||(Wi.style("visibility","hidden"),Ai=zc(qf.data.targets)),Xi=pf.select(sf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),kf(zc(qf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Ui.append("g").attr("class",f.axisX).attr("clip-path",Ug?"":mi).attr("transform",Fi.x).append("text").attr("class",f.axisXLabel).attr("transform",Ug?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),ih&&Ui.append("g").attr("class",f.axisY).attr("clip-path",Ug?ni:"").attr("transform",Fi.y).append("text").attr("class",f.axisYLabel).attr("transform",Ug?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),rh&&Ui.append("g").attr("class",f.axisY2).attr("transform",Fi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Ug?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Ui.append("g").attr("clip-path",li).attr("class",f.grid),Ah&&d.append("g").attr("class",f.xgrids),qe(Ch)&&d.append("g").attr("class",f.xgridLines),Ih&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Dh&&d.append("g").attr("class",f.ygrids),qe(Eh)&&d.append("g").attr("class",f.ygridLines),Ui.append("g").attr("clip-path",li).attr("class",f.regions),Ui.append("g").attr("clip-path",li).attr("class",f.chart),c=Ui.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",xf?Ug?"ns-resize":"ew-resize":null),Ui.select("."+f.chart).append("g").attr("class",f.chartBars),Ui.select("."+f.chart).append("g").attr("class",f.chartLines),Ui.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Fi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Ui.select("."+f.chart).append("g").attr("class",f.chartTexts),xf&&Ui.insert("rect",zf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",If).attr("height",Kf).style("opacity",0).style("cursor",Ug?"ns-resize":"ew-resize").call(Ri).on("dblclick.zoom",null),gh&&Ni.extent("function"!=typeof gh?gh:gh(Zb())),Lg&&(Vi.append("g").attr("clip-path",li).attr("class",f.chart),Vi.select("."+f.chart).append("g").attr("class",f.chartBars),Vi.select("."+f.chart).append("g").attr("class",f.chartLines),Vi.append("g").attr("clip-path",li).attr("class",f.brush).call(Ni).selectAll("rect").attr(Ug?"width":"height",Ug?Jf:Lf),Vi.append("g").attr("class",f.axisX).attr("transform",Fi.subx).attr("clip-path",Ug?"":mi)),$e(qf.data.targets),Ug?Ui.select("."+f.axisX).style("opacity",0).call(hg):(Ui.select("."+f.axisY).style("opacity",0).call(ig),Ui.select("."+f.axisY2).style("opacity",0).call(jg)),Ue({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),fi){if(oi&&"string"==typeof gi){for(gi=le(gi),e=0;e0){d=[];for(var g in pg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Fd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=ze,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function Se(a){$d(qf.data.targets)||Ag&&(ri=a,Ui.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),si=!0,Jg())}function Te(){$d(qf.data.targets)||Ag&&(Ui.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Ui.selectAll("."+f.shape).classed(f.INCLUDED,!1),si=!1,Kg())}function Ue(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Pd(),U=$d(qf.data.targets),V=Fc(qf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?Ef:0,O=B?N:0,P=C?N:0,H&&Og&&kf(zc(qf.data.targets),a),G&&(bg.domain(pf.extent(Zb(V))),Zi=bg.domain(),xf&&Ri.scale(bg).updateScaleExtent(),eg.domain(bg.domain()),Ni.scale(eg)),F&&(bg.domain(Ni.empty()?Zi:Ni.extent()),xf&&Ri.scale(bg).updateScaleExtent()),cg.domain(Ub(V,"y")),dg.domain(Ub(V,"y2")),Xd(V)||(Q=ch?ch:Hc(Gc(V)),hg.tickValues(Q),kg.tickValues(Q)),c=Ui.select("."+f.axisX).style("opacity",U?0:1),(Ug||D)&&(c=c.transition().duration(P)),c.call(hg),e=Ui.select("."+f.axisY).style("opacity",U?0:1),(!Ug||D)&&(e=e.transition().duration(P)),e.call(ig),Ui.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(jg),F)if($g&&Q){for(R=1;R=0&&pf.select(this).style("display",b%S?"none":"block")})}else pf.selectAll("."+f.axisX+" .tick text").style("display","block");if(I=He(T),K=Ie(T,!0),M=Ie(T,!1),Ab(),fg.domain(cg.domain()),gg.domain(dg.domain()),Xi.style("display","none"),o(),Ui.select("line."+f.xgridFocus).style("visibility","hidden"),Ah){if("year"===Bh){h=[];for(var W=Zb(),X=W[0].getFullYear(),Y=W[1].getFullYear(),Z=X;Y>=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=bg.ticks(10);g=Ui.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Ug?0:function(a){return bg(a)-hg.tickOffset()}).attr("x2",Ug?If:function(a){return bg(a)-hg.tickOffset()}).attr("y1",Ug?function(a){return bg(a)-hg.tickOffset()}:Ff.top).attr("y2",Ug?function(a){return bg(a)-hg.tickOffset()}:Kf).style("opacity",function(){return+pf.select(this).attr(Ug?"y1":"x1")===(Ug?Kf:0)?0:1}),g.exit().remove()}qe(Ch)&&(i=Ui.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Ch),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Ug?"":"rotate(-90)").attr("dx",Ug?0:-Ff.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Ug?0:xd).attr("x2",Ug?If:xd).attr("y1",Ug?xd:Ff.top).attr("y2",Ug?xd:Kf).style("opacity",1),i.select("text").transition().duration(N).attr("x",Ug?If:0).attr("y",xd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&Dh&&(k=Ui.select("."+f.ygrids).selectAll("."+f.ygrid).data(cg.ticks(Fh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Ug?cg:0).attr("x2",Ug?cg:If).attr("y1",Ug?0:cg).attr("y2",Ug?Kf:cg),k.exit().remove()),y&&qe(Eh)&&(l=Ui.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Eh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Ug?"rotate(-90)":"").attr("dx",Ug?0:-Ff.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Ug?yd:0).attr("x2",Ug?yd:If).attr("y1",Ug?0:yd).attr("y2",Ug?Kf:yd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Ug?0:If).attr("y",yd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Ui.selectAll("."+f.bars).selectAll("."+f.bar).data(ge),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return wi(a)}).attr("class",Zc),p.style("opacity",nd).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Ui.selectAll("."+f.texts).selectAll("."+f.text).data(ie),r.enter().append("text").attr("class",Sc).attr("text-anchor",function(a){return Ug?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return vd(a.id)(a.value)}).style("fill-opacity",od).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",qd),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Ui.selectAll("."+f.line).style("opacity",nd).transition().duration(N).attr("d",Oi).style("opacity",1),Ui.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Pi).style("opacity",$i),n=Ui.selectAll("."+f.circles).selectAll("."+f.circle).data(he),n.enter().append("circle").attr("class",Xc).style("opacity",0).attr("r",Hh),n.style("opacity",nd).transition().duration(N).style("opacity",pd).attr("cx",Ug?Od:Nd).attr("cy",Ug?Nd:Od),n.exit().remove(),Ui.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=pf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Ui.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Dc(a.data.id)&&fe(a.data)?1:0}),Ui.select("."+f.chartArcsTitle).style("opacity",Zd(qf.data.targets)?1:0),Lg&&(null!==pf.event&&"zoom"===pf.event.type&&Ni.extent(bg.orgDomain()).update(),z&&(Vi.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(kg),Ni.empty()||Ni.extent(bg.orgDomain()).update(),J=He(T,!0),s=Vi.selectAll("."+f.bars).selectAll("."+f.bar).data(ge),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return wi(a)}).attr("class",Zc),s.style("opacity",nd).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Vi.selectAll("."+f.line).style("opacity",nd).transition().duration(N).attr("d",Qi).style("opacity",1))),Ui.selectAll("."+f.selectedCircles).filter(function(a){return be(a)}).selectAll("circle").remove(),Ui.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Ug?Od:Nd).attr("cy",Ug?Nd:Od),t=Ui.select("."+f.eventRects),qe(mg)&&!mc(mg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Ui.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Pe(u.enter()),u.attr("x",0).attr("y",0).attr("width",If).attr("height",Kf)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),qi&&!pi?(x=function(a,b){var c=vc(b),d=wc(b),e=qf.data.xs[a.id][b];return(bg(d?d:e+50)-bg(c?c:e-50))/2},w=function(a,b){var c=vc(b),d=qf.data.xs[a.id][b];return(bg(d)+bg(c?c:d-50))/2}):(x=L(),w=function(a){return bg(a.x)-x/2}),v=yc(),Ui.select("."+f.eventRects).datum(v?v.values:[]),u=Ui.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Oe(u.enter()),u.attr("class",cd).attr("x",Ug?0:w).attr("y",Ug?w:0).attr("width",Ug?If:x).attr("height",Ug?x:Kf),u.exit().remove()),q=Ui.select("."+f.regions).selectAll("rect."+f.region).data(ai),q.enter().append("rect").style("fill-opacity",0),q.attr("class",bd).attr("x",cc).attr("y",dc).attr("width",ec).attr("height",fc).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),zc(qf.data.targets).forEach(function(a){_i[a]=!0})}}function Ve(){Ue({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function We(){return"mousemove"===pf.event.sourceEvent.type&&Ri.altDomain?(bg.domain(Ri.altDomain),void Ri.scale(bg).updateScaleExtent()):(pi&&bg.orgDomain()[0]===Zi[0]&&bg.domain([Zi[0]-1e-10,bg.orgDomain()[1]]),Ue({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===pf.event.sourceEvent.type&&(ti=!0)))}function Xe(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ye(){Si.attr("width",Mf).attr("height",Nf),Si.select("#"+ii).select("rect").attr("width",If).attr("height",Kf),Si.select("#"+ji).select("rect").attr("width",H),Si.select("#"+ki).select("rect").attr("width",J),Si.select("."+f.zoomRect).attr("width",If).attr("height",Kf)}function Ze(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Ye(),m(a.withTransition),Ue(a)}function $e(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Ui.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",ed),j=i.enter().append("g").attr("class",ed).style("pointer-events","none"),j.append("g").attr("class",Tc).style("fill",function(a){return wi(a)}),e=Ui.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",gd),d=e.enter().append("g").attr("class",gd).style("pointer-events","none"),d.append("g").attr("class",$c).style("fill",function(a){return wi(a)}).style("stroke","none").style("cursor",function(a){return Cg(a)?"pointer":null}),c=Ui.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",fd),b=c.enter().append("g").attr("class",fd).style("pointer-events","none"),b.append("path").attr("class",Wc).style("opacity",0).style("stroke",function(a){return wi(a)}),b.append("path").attr("class",ad).style("opacity",function(){return $i=+pf.select(this).style("opacity"),0}).style("fill",function(a){return wi(a)}),b.append("g").attr("class",function(a){return Rc(f.selectedCircles,a.id)}),b.append("g").attr("class",Yc).style("fill",function(a){return wi(a)}).style("cursor",function(a){return Cg(a)?"pointer":null}),a.forEach(function(a){Ui.selectAll("."+f.selectedCircles+id(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Ui.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Uf(a)).attr("class",hd),g=h.enter().append("g").attr("class",hd),g.append("path").attr("class",_c).style("opacity",0).style("fill",function(a){return wi(a.data)}).style("cursor",function(a){return Cg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),ef(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Jd(c,pf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),gf(),Kd(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Lg&&(n=Vi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",gd),m=n.enter().append("g").attr("class",gd),m.append("g").attr("class",$c).style("fill",function(a){return wi(a)}),l=Vi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",fd),k=l.enter().append("g").attr("class",fd),k.append("path").attr("class",Wc).style("opacity",0).style("stroke",function(a){return wi(a)})),Si.selectAll("."+f.target).filter(function(a){return Dc(a.id)}).transition().style("opacity",1)}function _e(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Ud(a.id,b.types[a.id]):Ud(a.id,b.type)}),qf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Gi?j:i,l=Gi?Q():P();return d&&(w=0,C=0,t=0,u=0),Og&&!Ec(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Gi?u:t,void(Tg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,Gi?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Wi.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Rc(f.legendItem,a)}).style("visibility",function(a){return Ec(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Qg?Qg(a):qf.toggle(a)}).on("mouseover",function(a){qf.focus(a),"function"==typeof Rg&&Rg(a)}).on("mouseout",function(a){qf.revert(),"function"==typeof Sg&&Sg(a)}),l.append("text").text(function(a){return d(pg[a])?pg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",Gi?g:-200).attr("y",Gi?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Gi?h:-200).attr("y",Gi?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return wi(a)}).attr("x",Gi?g:-200).attr("y",Gi?-200:i).attr("width",10).attr("height",10),Wi.selectAll("text").data(a).text(function(a){return d(pg[a])?pg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Wi.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Wi.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Ye(),q&&m(p)}function lf(a){return Bc(qf.data.targets,a.id)}function mf(a){return"data"in a&&Bc(qf.data.targets,a.data.id)}function nf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function of(a,b,c){var d=!$d(qf.data.targets);Ud(a,b),Ze(c?c:{withTransitionForAxis:d})}var pf=a.d3?a.d3:a.require?a.require("d3"):void 0,qf={data:{},axis:{},legend:{}},rf={},sf=h(["bindto"],"#chart"),tf=h(["size","width"]),uf=h(["size","height"]),vf=h(["padding","left"]),wf=h(["padding","right"]),xf=h(["zoom","enabled"],!1),yf=h(["zoom","extent"]),zf=h(["zoom","privileged"],!1),Af=h(["onenter"],function(){}),Bf=h(["onleave"],function(){}),Cf=h(["onresize"],function(){}),Df=h(["onresized"],function(){}),Ef=h(["transition","duration"],350);g("data","data is required in config");var Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg=h(["data","x"]),mg=h(["data","xs"],{}),ng=h(["data","x_format"]),og=h(["data","id_converter"],function(a){return a}),pg=h(["data","names"],{}),qg=h(["data","classes"],{}),rg=h(["data","groups"],[]),sg=h(["data","axes"],{}),tg=h(["data","type"]),ug=h(["data","types"],{}),vg=h(["data","labels"],{}),wg=h(["data","order"]),xg=h(["data","regions"],{}),yg=h(["data","color"]),zg=h(["data","colors"],{}),Ag=h(["data","selection","enabled"],!1),Bg=h(["data","selection","grouped"],!1),Cg=h(["data","selection","isselectable"],function(){return!0}),Dg=h(["data","selection","multiple"],!0),Eg=h(["data","onclick"],function(){}),Fg=h(["data","onenter"],function(){}),Gg=h(["data","onleave"],function(){}),Hg=h(["data","onselected"],function(){}),Ig=h(["data","onunselected"],function(){}),Jg=h(["data","ondragstart"],function(){}),Kg=h(["data","ondragend"],function(){}),Lg=h(["subchart","show"],!1),Mg=Lg?h(["subchart","size","height"],60):0,Ng=h(["color","pattern"],[]),Og=h(["legend","show"],!0),Pg=h(["legend","position"],"bottom"),Qg=h(["legend","item","onclick"]),Rg=h(["legend","item","onmouseover"]),Sg=h(["legend","item","onmouseout"]),Tg=h(["legend","equally"],!1),Ug=h(["axis","rotated"],!1),Vg=h(["axis","x","type"],"indexed"),Wg=h(["axis","x","localtime"],!0),Xg=h(["axis","x","categories"],[]),Yg=h(["axis","x","tick","centered"],!1),Zg=h(["axis","x","tick","format"]),$g=h(["axis","x","tick","culling"],{}),_g=h(["axis","x","tick","culling","max"],10),ah=h(["axis","x","tick","count"]),bh=h(["axis","x","tick","fit"],!1),ch=h(["axis","x","tick","values"],null),dh=h(["axis","x","max"]),eh=h(["axis","x","min"]),fh=h(["axis","x","padding"],{}),gh=h(["axis","x","default"]),hh=h(["axis","x","label"],{}),ih=h(["axis","y","show"],!0),jh=h(["axis","y","max"]),kh=h(["axis","y","min"]),lh=h(["axis","y","center"]),mh=h(["axis","y","label"],{}),nh=h(["axis","y","inner"],!1),oh=h(["axis","y","tick","format"]),ph=h(["axis","y","padding"],{}),qh=h(["axis","y","ticks"],10),rh=h(["axis","y2","show"],!1),sh=h(["axis","y2","max"]),th=h(["axis","y2","min"]),uh=h(["axis","y2","center"]),vh=h(["axis","y2","label"],{}),wh=h(["axis","y2","inner"],!1),xh=h(["axis","y2","tick","format"]),yh=h(["axis","y2","padding"],{}),zh=h(["axis","y2","ticks"],10),Ah=h(["grid","x","show"],!1),Bh=h(["grid","x","type"],"tick"),Ch=h(["grid","x","lines"],[]),Dh=h(["grid","y","show"],!1),Eh=h(["grid","y","lines"],[]),Fh=h(["grid","y","ticks"],10),Gh=h(["point","show"],!0),Hh=Gh?h(["point","r"],2.5):0,Ih=h(["point","focus","line","enabled"],!0),Jh=h(["point","focus","expand","enabled"],!0),Kh=h(["point","focus","expand","r"],Jh?4:Hh),Lh=h(["point","focus","select","r"],8),Mh=h(["line","connect_null"],!1),Nh=h(["bar","width"]),Oh=h(["bar","width","ratio"],.6),Ph=h(["pie","label","show"],!0),Qh=h(["pie","label","format"]),Rh=h(["pie","expand"],!0),Sh=h(["pie","onclick"],function(){}),Th=h(["pie","onmouseover"],function(){}),Uh=h(["pie","onmouseout"],function(){}),Vh=h(["donut","label","show"],!0),Wh=h(["donut","label","format"]),Xh=h(["donut","expand"],!0),Yh=h(["donut","title"],""),Zh=h(["donut","onclick"],function(){}),$h=h(["donut","onmouseover"],function(){}),_h=h(["donut","onmouseout"],function(){}),ai=h(["regions"],[]),bi=h(["tooltip","show"],!0),ci=h(["tooltip","format","title"]),di=h(["tooltip","format","value"]),ei=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ci?ci:b,l=di?di:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),fi=h(["tooltip","init","show"],!1),gi=h(["tooltip","init","x"],0),hi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ii=("string"==typeof sf?sf.replace("#",""):sf.id)+"-clip",ji=ii+"-xaxis",ki=ii+"-yaxis",li=i(ii),mi=i(ji),ni=i(ki),oi="timeseries"===Vg,pi="categorized"===Vg,qi=!oi&&(lg||qe(mg)),ri=null,si=!1,ti=!1,ui=!1,vi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],wi=ke(zg,qe(Ng)?Ng:vi,yg),xi=Wg?pf.time.format:pf.time.format.utc,yi=function(){var a=[[xi("%Y/%-m/%-d"),function(){return!0}],[xi("%-m/%-d"),function(a){return a.getMonth()}],[xi("%-m/%-d"),function(a){return 1!==a.getDate()}],[xi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[xi("%I %p"),function(a){return a.getHours()}],[xi("%I:%M"),function(a){return a.getMinutes()}],[xi(":%S"),function(a){return a.getSeconds()}],[xi(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),zi=[],Ai=[],Bi=Ug?"left":"bottom",Ci=Ug?nh?"top":"bottom":nh?"right":"left",Di=Ug?wh?"bottom":"top":wh?"left":"right",Ei=Ug?"left":"bottom",Fi={main:function(){return"translate("+Ff.left+","+Ff.top+")"},context:function(){return"translate("+Gf.left+","+Gf.top+")"},legend:function(){return"translate("+Hf.left+","+Hf.top+")"},x:function(){return"translate(0,"+(Ug?0:Kf)+")"},y:function(){return"translate(0,"+(Ug?Kf:0)+")"},y2:function(){return"translate("+(Ug?0:If)+","+(Ug?1:0)+")"},subx:function(){return"translate(0,"+(Ug?0:Lf)+")"},arc:function(){return"translate("+If/2+","+Kf/2+")"}},Gi="right"===Pg,Hi=0,Ii=0,Ji=0,Ki=30,Li=30,Mi=5;Uf=pf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Ni,Oi=function(){var a=pf.svg.line().x(Ug?function(a){return V(a.id)(a.value)}:wd).y(Ug?wd:function(a){return V(a.id)(a.value)});return Mh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Mh?Ae(b.values):b.values;return _d(b)?(a.interpolate(ae(b)?"cardinal":"linear"),xg[b.id]?Me(e,bg,V(b.id),xg[b.id]):a(e)):(c=e[0]?bg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ug?"M "+d+" "+c:"M "+c+" "+d)}}(),Pi=function(){var a;return a=Ug?pf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(wd):pf.svg.area().x(wd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ae(b.values);return Vd([b],"area")||Vd([b],"area-spline")?(a.interpolate(ae(b)?"cardinal":"linear"),a(e)):(c=e[0]?bg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ug?"M "+d+" "+c:"M "+c+" "+d)}}(),Qi=function(){var a=pf.svg.line().x(Ug?function(a){return W(a.id)(a.value)}:zd).y(Ug?zd:function(a){return W(a.id)(a.value)});return function(b){var c=Ae(b.values);return _d(b)?a(c):"M "+eg(c[0].x)+" "+W(b.id)(c[0].value)}}(),Ri=function(){};Ni=pf.svg.brush().on("brush",Ve),Ni.update=function(){return Vi&&Vi.select("."+f.brush).call(this),this},Ni.scale=function(a){return Ug?this.y(a):this.x(a)},xf&&(Ri=pf.behavior.zoom().on("zoomstart",function(){Ri.altDomain=pf.event.sourceEvent.altKey?bg.orgDomain():null}).on("zoom",xf?We:null),Ri.scale=function(a){return Ug?this.y(a):this.x(a)},Ri.orgScaleExtent=function(){var a=yf?yf:[1,10];return[a[0],Math.max(xc()/a[1],a[1])]},Ri.updateScaleExtent=function(){var a=$b(bg.orgDomain())/$b(Zi),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Si,Ti,Ui,Vi,Wi,Xi,Yi,Zi,$i,_i={};if(qf.focus=function(a){function b(a){Fc(a).transition().duration(100).style("opacity",1)}var c=Si.selectAll(jd(a)),d=c.filter(lf),e=c.filter(mf);qf.revert(),qf.defocus(),b(d.classed(f.focused,!0)),b(e),$d(qf.data.targets)&&Kb(a,!0),ef(a)},qf.defocus=function(a){function b(a){Fc(a).transition().duration(100).style("opacity",.3)}var c=Si.selectAll(jd(a)),d=c.filter(lf),e=c.filter(mf);qf.revert(),b(d.classed(f.focused,!1)),b(e),$d(qf.data.targets)&&Lb(a),ff(a)},qf.revert=function(a){function b(a){Fc(a).transition().duration(100).style("opacity",1)}var c=Si.selectAll(jd(a)),d=c.filter(lf),e=c.filter(mf);b(d.classed(f.focused,!1)),b(e),$d(qf.data.targets)&&Lb(a),gf()},qf.show=function(a,b){a=Ac(a),b=b||{},Jc(a),Si.selectAll(kd(a)).transition().style("opacity",1),b.withLegend?hf(a):Wi.selectAll(md(a)).classed(f.legendItemHidden,!1),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},qf.hide=function(a,b){a=Ac(a),b=b||{},Ic(a),Si.selectAll(kd(a)).transition().style("opacity",0),b.withLegend?jf(a):Wi.selectAll(md(a)).classed(f.legendItemHidden,!0),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},qf.toggle=function(a){Dc(a)?qf.hide(a):qf.show(a)},qf.unzoom=function(){Ni.clear().update(),Ue({withUpdateXDomain:!0})},qf.load=function(a){return a.xs&&lc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){qg[b]=a.classes[b]}),"categories"in a&&pi&&(Xg=a.categories,hg.categories(Xg)),"cacheIds"in a&&_b(a.cacheIds)?void _e(bc(a.cacheIds),a.done):void("unload"in a?bf(Ac("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){af(a)}):af(a))},qf.unload=function(a){bf(Ac(a),function(){Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},qf.selected=function(a){return pf.merge(Ui.selectAll("."+f.shapes+id(a)).selectAll("."+f.shape).filter(function(){return pf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},qf.select=function(a,b,c){Ag&&Ui.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=pf.select(this),i="circle"===this.nodeName?ue:xe,j="circle"===this.nodeName?ve:ye,k=Bg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Cg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},qf.unselect=function(a,b){Ag&&Ui.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=pf.select(this),g="circle"===this.nodeName?ve:ye,h=Bg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Cg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},qf.toLine=function(a){of(a,"line")},qf.toSpline=function(a){of(a,"spline")},qf.toBar=function(a){of(a,"bar")},qf.toScatter=function(a){of(a,"scatter")},qf.toArea=function(a){of(a,"area")},qf.toAreaSpline=function(a){of(a,"area-spline")},qf.toPie=function(a){of(a,"pie",{withTransform:!0})},qf.toDonut=function(a){of(a,"donut",{withTransform:!0})},qf.groups=function(a){return c(a)?rg:(rg=a,Ue(),rg)},qf.xgrids=function(a){return a?(Ch=a,Ue(),Ch):Ch},qf.xgrids.add=function(a){return a?qf.xgrids(Ch.concat(a)):void 0},qf.xgrids.remove=function(a){var b=nf(a);return qf.xgrids(Ch.filter(b))},qf.ygrids=function(a){return a?(Eh=a,Ue(),Eh):Eh},qf.ygrids.add=function(a){return a?qf.ygrids(Eh.concat(a)):void 0},qf.ygrids.remove=function(a){var b=nf(a);return qf.ygrids(Eh.filter(b))},qf.regions=function(a){return c(a)?ai:(ai=a,Ue(),ai)},qf.regions.add=function(a){return c(a)?ai:(ai=ai.concat(a),Ue(),ai)},qf.regions.remove=function(a,c){var e=[].concat(a); +return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;Si.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ai=ai.filter(function(b){return b.classes.indexOf(a)<0})}),ai},qf.data.get=function(a){var b=qf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},qf.data.getAsTarget=function(a){var b=Cc(function(b){return b.id===a});return b.length>0?b[0]:void 0},qf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){pg[b]=a[b]}),kf(zc(qf.data.targets),{withTransition:!0}),pg):pg},qf.x=function(a){return arguments.length&&(oc(qf.data.targets,a),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),qf.data.xs},qf.xs=function(a){return arguments.length&&(pc(qf.data.targets,a),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),qf.data.xs},qf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},qf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(jh=+a.y),b(a.y2)&&(sh=+a.y2)):jh=sh=+a,Ue())},qf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(kh=+a.y),b(a.y2)&&(th=+a.y2)):kh=th=+a,Ue())},qf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&qf.axis.max(a.max),"undefined"!=typeof a.min&&qf.axis.min(a.min))},qf.legend.show=function(a){Og||(Og=!0,Wi.style("visibility","visible")),hf(Ac(a)),Ue({withTransitionForHorizontalAxis:!1})},qf.legend.hide=function(a){Og&&pe(a)&&(Og=!1,Wi.style("visibility","hidden")),jf(Ac(a)),Ue({withTransitionForHorizontalAxis:!1})},qf.resize=function(a){tf=a?a.width:null,uf=a?a.height:null,Ze({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},qf.destroy=function(){qf.data.targets=void 0,qf.data.xs={},Yi.html(""),a.onresize=null},"url"in e.data)pf.xhr(e.data.url,function(a,b){var c,d=pf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=pf.csv.parse(b.response),Ne(c)});else if("rows"in e.data)Ne(rc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ne(sc(e.data.columns))}return qf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file diff --git a/htdocs/samples/regions.html b/htdocs/samples/regions.html index b7cd80d..85c9745 100644 --- a/htdocs/samples/regions.html +++ b/htdocs/samples/regions.html @@ -11,13 +11,37 @@ var chart = c3.generate({ data: { columns: [ - ['sample', 30, 200, 100, 400, 150, 250] + ['sample', 30, 200, 100, 400, 150, 250, 300] ] }, + axis: { + rotated: true, + y2: { +// show: true, + } + }, regions: [ - {start:2,end:4,class:'region1'} - ] + {end:1,class:'region1'}, + {start:2,end:4,class:'region1'}, + {start:5,class:'region1'}, + {end:50,axis:'y'}, + {start:100,end:200,axis:'y'}, + {start:300,axis:'y'}, + ], + zoom: { +// enabled: true + } }); + +/* + setTimeout(function () { + chart.load({ + columns: [ + ['sample', -100, 200, 50, 100, 400, 299] + ] + }); + }, 1000); +*/ From ffe5202df7aaf259f55173d5ae491bf097c46ec2 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Tue, 22 Apr 2014 12:22:45 +0900 Subject: [PATCH 050/178] Fix clip path for axis --- c3.js | 4 ++-- c3.min.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/c3.js b/c3.js index 1fd8cb3..5dd4ac1 100644 --- a/c3.js +++ b/c3.js @@ -2526,7 +2526,7 @@ // Add Axis main.append("g") .attr("class", CLASS.axisX) - .attr("clip-path", __axis_rotated ? "" : clipPathForXAxis) + .attr("clip-path", clipPathForXAxis) .attr("transform", translate.x) .append("text") .attr("class", CLASS.axisXLabel) @@ -2538,7 +2538,7 @@ if (__axis_y_show) { main.append("g") .attr("class", CLASS.axisY) - .attr("clip-path", __axis_rotated ? clipPathForYAxis : "") + .attr("clip-path", clipPathForYAxis) .attr("transform", translate.y) .append("text") .attr("class", CLASS.axisYLabel) diff --git a/c3.min.js b/c3.min.js index 9f30464..0853166 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.31"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cIf&&(If=0),0>Kf&&(Kf=0),Gf={top:Ug?Ff.top:Nf-Mg-(Gi?0:a),right:0/0,bottom:20+(Gi?0:a),left:Ug?Ki:Ff.left},Jf=Ug?Ff.left-Ki-Li:If,Lf=Ug?Kf:Nf-Gf.top-Gf.bottom,0>Jf&&(Jf=0),0>Lf&&(Lf=0),Hf={top:Gi?0:Nf-a,right:0/0,bottom:0,left:Gi?Mf-b:0},p(),Gi&&$d(qf.data.targets)&&(Hf.left=If/2+Pf)}function o(){Ui.select("line."+f.xgridFocus).attr("x1",Ug?0:-10).attr("x2",Ug?If:-10).attr("y1",Ug?-10:Ff.top).attr("y2",Ug?-10:Kf)}function p(){Pf=Kf/2,Of=.95*Pf,Qf=Zd(qf.data.targets)?.6*Of:0}function q(){var a=Ug?f.axisX:f.axisY,b=pf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=pf.select(sf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return tf?tf:x()}function s(){var a=uf?uf:y();return a>0?a:320}function t(){return $d(qf.data.targets)?0:vf?vf:Ug||!ih||nh?1:v("y")}function u(){var a=1;return $d(qf.data.targets)?0:wf?wf:Gi?P()+(rh&&!Ug?v("y2"):a):rh?wh||Ug?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||ih?"y2"!==a||rh?(gb(a).isInner?30:40)+("y2"===a?-10:0):Mi:Og&&!Gi?10:1}function x(){return+pf.select(sf).style("width").replace("px","")}function y(){return+pf.select(sf).style("height").replace("px","")}function z(a){return a?-5:-(Ff.left-1)}function A(a){return a?-20:-1}function B(){return z(!Ug)}function C(){return A(!Ug)}function D(){return z(Ug)}function E(){return A(Ug)}function F(a){return a?If+2+4:Ff.left+20}function G(a){return a?80:Kf+2}function H(){return F(!Ug)}function I(){return G(!Ug)}function J(){return F(Ug)}function K(){return G(Ug)}function L(){var a=Ug?Kf:If,b=xc(),c=Vb()*(Wd(qf.data.targets)?(b-(pi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){Hi=a}function N(a){Ii=a}function O(a){Ji=a}function P(){return Og?Gi?Ii*(Hi+1):Mf:0}function Q(){return Og?Gi?Nf:Ji*(Hi+1):0}function R(){var a,b=!bg;Vf=Ug?1:0,Wf=Ug?Kf:If,Xf=Ug?0:Kf,Yf=Ug?If:1,Zf=Vf,$f=Wf,_f=Ug?0:Lf,ag=Ug?Jf:1,bg=T(Vf,Wf,b?void 0:bg.domain(),function(){return hg.tickOffset()}),cg=U(Xf,Yf),dg=U(Xf,Yf),eg=T(Vf,Wf,Zi,function(a){return a%1?0:kg.tickOffset()}),fg=U(_f,ag),gg=U(_f,ag),a=$(),hg=X(bg,Bi,a),kg=X(eg,Ei,a),ig=Y(cg,Ci,oh,qh),jg=Y(dg,Di,xh,zh),b||(Ni.scale(eg),xf&&Ri.scale(bg)),S()}function S(){Rf=Db(),Sf=Eb(),Tf=Eb(.98)}function T(a,b,e,f){var g=(oi?pf.time.scale():pf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),pi){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return pf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?dg:cg}function W(a){return"y2"===Z(a)?gg:fg}function X(a,b,c){var d=(pi?Bb():pf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),pi?(d.tickCentered(Yg),pe($g)&&($g=!1)):d.tickOffset=function(){var a=Ug?Kf:If;return a*Vb()/xc()/2},pi&&d.categories(Xg),d}function Y(a,b,c,d){return pf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in sg?sg[a]:"y"}function $(){var a=oi?yi:pi?Qc:function(a){return 0>a?a.toFixed(0):a};return Zg&&("function"==typeof Zg?a=Zg:oi&&(a=function(a){return a?xi(Zg)(a):""})),a}function _(a){var b;return"y"===a?b=mh:"y2"===a?b=vh:"x"===a&&(b=hh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?mh=b:"y2"===a?vh=b:"x"===a&&(hh=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Ug?"inner-top":"inner-right")}function eb(){return cb("y",Ug?"inner-right":"inner-top")}function fb(){return cb("y2",Ug?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?If/2:If:b.isBottom?-Kf:b.isMiddle?-Kf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Ug,db())}function ob(){return kb(Ug,eb())}function pb(){return kb(Ug,fb())}function qb(){return lb(!Ug,db())}function rb(){return lb(Ug,eb())}function sb(){return lb(Ug,fb())}function tb(){var a=db();return Ug?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Ug?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Ug?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Ug,db())}function xb(){return mb(Ug,eb())}function yb(){return mb(Ug,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return pf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Ui.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Ui.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Ui.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+o)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Oc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return pf.min(Object.keys(i).map(function(a){return pf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=zc(a),i=Mc(a);if(rg.length>0)for(g=Pc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return pf.max(Object.keys(i).map(function(a){return pf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?th:kh,n="y2"===c?sh:jh,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?uh:lh,r=rd()&&Ug;return 0===l.length?"y2"===c?dg.domain():cg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=sd(o,p),j=$b(cg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&ph&&(f=b(ph.top)?ph.top:e,g=b(ph.bottom)?ph.bottom:e),"y2"===c&&yh&&(f=b(yh.top)?yh.top:e,g=b(yh.bottom)?yh.bottom:e),Wd(l)&&!Oc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Zi),c=$b(bg.domain());return a||0===c?1:b/c}function Wb(a){return eh?eh:pf.min(a,function(a){return pf.min(a.values,function(a){return a.x})})}function Xb(a){return dh?dh:pf.max(a,function(a){return pf.max(a.values,function(a){return a.x})})}function Yb(a,c){var d,e,f,g,h=c[0],i=c[1],j=Math.abs(h-i);return pi?e=0:Wd(a)?(d=xc(),e=d>1?j/(d-1)/2:.5):e=.01*j,"object"==typeof fh&&qe(fh)?(f=b(fh.left)?fh.left:e,g=b(fh.right)?fh.right:e):f=g="number"==typeof fh?fh:e,{left:f,right:g}}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=0,g=0;return(c||0===c)&&(f=oi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=oi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bb?0:b-c}function fc(a){var b,c=dc(a),d="y"===a.axis?cg:dg;return b="y"===a.axis||"y2"===a.axis?Ug?Kf:"start"in a?d(a.start):Kf:Ug?"end"in a?bg(oi?le(a.end):a.end):Kf:Kf,c>b?0:b-c}function gc(a){return lg&&a===lg||qe(mg)&&re(mg,a)}function hc(a){return!gc(a)}function ic(a){return lg?lg:qe(mg)?mg[a]:null}function jc(a,b){var c,d=b&&qe(b)?zc(b):[];return d.forEach(function(b){ic(b)===a&&(c=qf.data.xs[b])}),c}function kc(a,b){return a in qf.data.xs&&qf.data.xs[a]&&qf.data.xs[a][b]?qf.data.xs[a][b]:b}function lc(a){Object.keys(a).forEach(function(b){mg[b]=a[b]})}function mc(a){return 1===pf.set(Object.keys(a).map(function(b){return a[b]})).size()}function nc(a){var b;return a&&(b=pg[a.id],a.name=b?b:a.id),a}function oc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=qc(b[d],a.id,d)}),qf.data.xs[a.id]=b})}function pc(a,b){a.forEach(function(a){b[a.id]&&oc([a],b[a.id])})}function qc(a,b,c){var d;return d=oi?a?a instanceof Date?a:le(a):le(kc(b,c)):qi&&!pi?a?+a:kc(b,c):c}function rc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?qf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):lg?(d=Object.keys(qf.data.xs),qf.data.xs[c]=d.length>0?qf.data.xs[d[0]]:void 0):qe(mg)&&(qf.data.xs[c]=jc(f,qf.data.targets)):qf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!qf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=og(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=ic(b),g=a[f],h=qc(g,b,e);return qi&&pi&&0===c&&g&&(0===e&&(Xg=[]),Xg.push(g)),("undefined"==typeof a[b]||qf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),tg&&Ud(zc(c).filter(function(a){return!(a in ug)}),tg),c.forEach(function(a){ac(a.id_org,a)}),c}function uc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function vc(a){return a>0&&qf.data.targets[0].values[a-1]?qf.data.targets[0].values[a-1].x:void 0}function wc(a){return a1?qf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?qf.data.targets[0]:null,a}function zc(a){return a.map(function(a){return a.id})}function Ac(a){return a?"string"==typeof a?[a]:a:zc(qf.data.targets)}function Bc(a,b){var c,d=zc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(oi?new Date(h):h);i.push(d)}return oi||(i=i.sort(function(a,b){return a-b})),i}function Ic(a){zi=zi.concat(a)}function Jc(a){zi=zi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){Ai=Ai.concat(a)}function Lc(a){Ai=Ai.filter(function(b){return a.indexOf(b)<0})}function Mc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Nc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Pc(a){return Nc(a,function(a){return a>0})}function Qc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(Ad(a,f))),a[g].x&&(e=e.concat(Ad(a,g))),Dd(e,b)):Bd(a,b,f,g)}function Cd(a,b){var c;return c=a.map(function(a){return Bd(a.values,b)}),Dd(c,b)}function Dd(a,b){var c,d;return a.forEach(function(a){var e=se(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Ed(a,b){return pf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Fd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Gd(){return wg&&"desc"===wg.toLowerCase()}function Hd(){return wg&&"asc"===wg.toLowerCase()}function Id(a){var b=Hd(),c=Gd();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof wg&&a.sort(wg),a}function Jd(a,c){var d,e,f,g,h,i,j,k=$d(qf.data.targets),l=k?ud:td,m=a.filter(function(a){return a&&b(a.value)});bi&&0!==m.length&&(Xi.html(ei(a,$(),l,wi)).style("display","block"),d=Xi.property("offsetWidth"),e=Xi.property("offsetHeight"),k?(g=If/2+c[0],i=Kf/2+c[1]+20):(Ug?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=bg(m[0].x)+20):(f=q(),g=f+t()+bg(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Xi.style("top",i+"px").style("left",g+"px"))}function Kd(){Xi.style("display","none")}function Ld(a){var c=a.filter(function(a){return a&&b(a.value)});bi&&(Xd(qf.data.targets)||$d(qf.data.targets)||Ui.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Ug?"y1":"x1",wd).attr(Ug?"y2":"x2",wd))}function Md(){Ui.select("line."+f.xgridFocus).style("visibility","hidden")}function Nd(a){return a.x||0===a.x?bg(a.x):null}function Od(a){return V(a.id)(a.value)}function Pd(){var a,b,d={},e=0;return Fc(Cc(be)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Td(a,b){return Nh?Nh:b?2*a.tickOffset()*Oh/b:0}function Ud(a,b){Ac(a).forEach(function(a){_i[a]=b===ug[a],ug[a]=b})}function Vd(a,b){var c=!1;return a.forEach(function(a){ug[a.id]===b&&(c=!0),a.id in ug||"line"!==b||(c=!0)}),c}function Wd(a){return Vd(a,"bar")}function Xd(a){return Vd(a,"scatter")}function Yd(a){return Vd(a,"pie")}function Zd(a){return Vd(a,"donut")}function $d(a){return Yd(a)||Zd(a)}function _d(a){var b="string"==typeof a?a:a.id;return!(b in ug)||"line"===ug[b]||"spline"===ug[b]||"area"===ug[b]||"area-spline"===ug[b]}function ae(a){var b="string"==typeof a?a:a.id;return"spline"===ug[b]||"area-spline"===ug[b]}function be(a){var b="string"==typeof a?a:a.id;return"bar"===ug[b]}function ce(a){var b="string"==typeof a?a:a.id;return"scatter"===ug[b]}function de(a){var b="string"==typeof a?a:a.id;return"pie"===ug[b]}function ee(a){var b="string"==typeof a?a:a.id;return"donut"===ug[b]}function fe(a){return de(a)||ee(a)}function ge(a){return be(a)?a.values:[]}function he(a){return _d(a)||ce(a)?a.values:[]}function ie(a){return be(a)||_d(a)?a.values:[]}function je(a){return ee(a)&&Xh||de(a)&&Rh}function ke(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function le(b){var c;try{c=ng?pf.time.format(ng).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ng)}return c}function me(a,b){var c=pf.mouse(a),d=pf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function re(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function se(a,b){var c="y"===Z(a.id)?cg:dg,d=Ug?1:0,e=Ug?0:1;return Math.pow(bg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function te(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function ue(a,b,c){Hg(b,a.node()),Ui.select("."+f.selectedCircles+id(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Rc(f.selectedCircle,c)}).attr("cx",Ug?Od:Nd).attr("cy",Ug?Nd:Od).attr("stroke",function(){return wi(b)}).attr("r",1.4*Lh).transition().duration(100).attr("r",Lh)}function ve(a,b,c){Ig(b,a.node()),Ui.select("."+f.selectedCircles+id(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a,b){Hg(b,a.node()),a.transition().duration(100).style("fill",function(){return pf.rgb(wi(b)).darker(1)})}function ye(a,b){Ig(b,a.node()),a.transition().duration(100).style("fill",function(){return wi(b)})}function ze(a,b,c,d){a?xe(b,c,d):ye(b,c,d)}function Ae(a){return a.filter(function(a){return b(a.value)})}function Be(a,c){return(c?Ui.selectAll("."+f.circles+id(c)):Ui).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ce(a,b){Be(a,b).classed(f.EXPANDED,!0).attr("r",Kh)}function De(a){Be(a).filter(function(){return pf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Hh)}function Ee(a){return Ui.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Fe(a){Ee(a).classed(f.EXPANDED,!0)}function Ge(a){Ee(a).classed(f.EXPANDED,!1)}function He(a,b){var c=Le(a,b);return function(a,b){var d=c(a,b),e=Ug?1:0,f=Ug?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function Ie(a,b){var c=Le(a,!1),d=b?Je:Ke;return function(a,b){return d(c(a,b),a,this)}}function Je(a,b){var c;return Ug?(c=be(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ke(a,b,c){var d=c.getBoundingClientRect();return Ug?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:be(b)?-3:-6)}function Le(a,b){var c=a.__max__+1,d=Td(hg,c),e=Qd(d,c,a,!!b),f=Rd(!!b),g=Sd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Ug&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Me(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function Ne(b){var c,d,e;if(Yi=pf.select(sf),Yi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Yi.html(""),Yi.classed("c3",!0),qf.data.xs={},qf.data.targets=tc(b),n(),R(),bg.domain(pf.extent(Zb(qf.data.targets))),cg.domain(Ub(qf.data.targets,"y")),dg.domain(Ub(qf.data.targets,"y2")),eg.domain(bg.domain()),fg.domain(cg.domain()),gg.domain(dg.domain()),Zi=bg.domain(),Ni.scale(eg),xf&&Ri.scale(bg),Si=Yi.append("svg").attr("width",If+Ff.left+Ff.right).attr("height",Kf+Ff.top+Ff.bottom).on("mouseenter",Af).on("mouseleave",Bf),Ti=Si.append("defs"),Ti.append("clipPath").attr("id",ii).append("rect").attr("width",If).attr("height",Kf),Ti.append("clipPath").attr("id",ji).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Ti.append("clipPath").attr("id",ki).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Ui=Si.append("g").attr("transform",Fi.main),Vi=Lg?Si.append("g").attr("transform",Fi.context):null,Wi=Si.append("g").attr("transform",Fi.legend),Og||(Wi.style("visibility","hidden"),Ai=zc(qf.data.targets)),Xi=pf.select(sf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),kf(zc(qf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Ui.append("g").attr("class",f.axisX).attr("clip-path",Ug?"":mi).attr("transform",Fi.x).append("text").attr("class",f.axisXLabel).attr("transform",Ug?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),ih&&Ui.append("g").attr("class",f.axisY).attr("clip-path",Ug?ni:"").attr("transform",Fi.y).append("text").attr("class",f.axisYLabel).attr("transform",Ug?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),rh&&Ui.append("g").attr("class",f.axisY2).attr("transform",Fi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Ug?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Ui.append("g").attr("clip-path",li).attr("class",f.grid),Ah&&d.append("g").attr("class",f.xgrids),qe(Ch)&&d.append("g").attr("class",f.xgridLines),Ih&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Dh&&d.append("g").attr("class",f.ygrids),qe(Eh)&&d.append("g").attr("class",f.ygridLines),Ui.append("g").attr("clip-path",li).attr("class",f.regions),Ui.append("g").attr("clip-path",li).attr("class",f.chart),c=Ui.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",xf?Ug?"ns-resize":"ew-resize":null),Ui.select("."+f.chart).append("g").attr("class",f.chartBars),Ui.select("."+f.chart).append("g").attr("class",f.chartLines),Ui.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Fi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Ui.select("."+f.chart).append("g").attr("class",f.chartTexts),xf&&Ui.insert("rect",zf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",If).attr("height",Kf).style("opacity",0).style("cursor",Ug?"ns-resize":"ew-resize").call(Ri).on("dblclick.zoom",null),gh&&Ni.extent("function"!=typeof gh?gh:gh(Zb())),Lg&&(Vi.append("g").attr("clip-path",li).attr("class",f.chart),Vi.select("."+f.chart).append("g").attr("class",f.chartBars),Vi.select("."+f.chart).append("g").attr("class",f.chartLines),Vi.append("g").attr("clip-path",li).attr("class",f.brush).call(Ni).selectAll("rect").attr(Ug?"width":"height",Ug?Jf:Lf),Vi.append("g").attr("class",f.axisX).attr("transform",Fi.subx).attr("clip-path",Ug?"":mi)),$e(qf.data.targets),Ug?Ui.select("."+f.axisX).style("opacity",0).call(hg):(Ui.select("."+f.axisY).style("opacity",0).call(ig),Ui.select("."+f.axisY2).style("opacity",0).call(jg)),Ue({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),fi){if(oi&&"string"==typeof gi){for(gi=le(gi),e=0;eIf&&(If=0),0>Kf&&(Kf=0),Gf={top:Ug?Ff.top:Nf-Mg-(Gi?0:a),right:0/0,bottom:20+(Gi?0:a),left:Ug?Ki:Ff.left},Jf=Ug?Ff.left-Ki-Li:If,Lf=Ug?Kf:Nf-Gf.top-Gf.bottom,0>Jf&&(Jf=0),0>Lf&&(Lf=0),Hf={top:Gi?0:Nf-a,right:0/0,bottom:0,left:Gi?Mf-b:0},p(),Gi&&$d(qf.data.targets)&&(Hf.left=If/2+Pf)}function o(){Ui.select("line."+f.xgridFocus).attr("x1",Ug?0:-10).attr("x2",Ug?If:-10).attr("y1",Ug?-10:Ff.top).attr("y2",Ug?-10:Kf)}function p(){Pf=Kf/2,Of=.95*Pf,Qf=Zd(qf.data.targets)?.6*Of:0}function q(){var a=Ug?f.axisX:f.axisY,b=pf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=pf.select(sf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return tf?tf:x()}function s(){var a=uf?uf:y();return a>0?a:320}function t(){return $d(qf.data.targets)?0:vf?vf:Ug||!ih||nh?1:v("y")}function u(){var a=1;return $d(qf.data.targets)?0:wf?wf:Gi?P()+(rh&&!Ug?v("y2"):a):rh?wh||Ug?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||ih?"y2"!==a||rh?(gb(a).isInner?30:40)+("y2"===a?-10:0):Mi:Og&&!Gi?10:1}function x(){return+pf.select(sf).style("width").replace("px","")}function y(){return+pf.select(sf).style("height").replace("px","")}function z(a){return a?-5:-(Ff.left-1)}function A(a){return a?-20:-1}function B(){return z(!Ug)}function C(){return A(!Ug)}function D(){return z(Ug)}function E(){return A(Ug)}function F(a){return a?If+2+4:Ff.left+20}function G(a){return a?80:Kf+2}function H(){return F(!Ug)}function I(){return G(!Ug)}function J(){return F(Ug)}function K(){return G(Ug)}function L(){var a=Ug?Kf:If,b=xc(),c=Vb()*(Wd(qf.data.targets)?(b-(pi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){Hi=a}function N(a){Ii=a}function O(a){Ji=a}function P(){return Og?Gi?Ii*(Hi+1):Mf:0}function Q(){return Og?Gi?Nf:Ji*(Hi+1):0}function R(){var a,b=!bg;Vf=Ug?1:0,Wf=Ug?Kf:If,Xf=Ug?0:Kf,Yf=Ug?If:1,Zf=Vf,$f=Wf,_f=Ug?0:Lf,ag=Ug?Jf:1,bg=T(Vf,Wf,b?void 0:bg.domain(),function(){return hg.tickOffset()}),cg=U(Xf,Yf),dg=U(Xf,Yf),eg=T(Vf,Wf,Zi,function(a){return a%1?0:kg.tickOffset()}),fg=U(_f,ag),gg=U(_f,ag),a=$(),hg=X(bg,Bi,a),kg=X(eg,Ei,a),ig=Y(cg,Ci,oh,qh),jg=Y(dg,Di,xh,zh),b||(Ni.scale(eg),xf&&Ri.scale(bg)),S()}function S(){Rf=Db(),Sf=Eb(),Tf=Eb(.98)}function T(a,b,e,f){var g=(oi?pf.time.scale():pf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),pi){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return pf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?dg:cg}function W(a){return"y2"===Z(a)?gg:fg}function X(a,b,c){var d=(pi?Bb():pf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),pi?(d.tickCentered(Yg),pe($g)&&($g=!1)):d.tickOffset=function(){var a=Ug?Kf:If;return a*Vb()/xc()/2},pi&&d.categories(Xg),d}function Y(a,b,c,d){return pf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in sg?sg[a]:"y"}function $(){var a=oi?yi:pi?Qc:function(a){return 0>a?a.toFixed(0):a};return Zg&&("function"==typeof Zg?a=Zg:oi&&(a=function(a){return a?xi(Zg)(a):""})),a}function _(a){var b;return"y"===a?b=mh:"y2"===a?b=vh:"x"===a&&(b=hh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?mh=b:"y2"===a?vh=b:"x"===a&&(hh=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Ug?"inner-top":"inner-right")}function eb(){return cb("y",Ug?"inner-right":"inner-top")}function fb(){return cb("y2",Ug?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?If/2:If:b.isBottom?-Kf:b.isMiddle?-Kf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Ug,db())}function ob(){return kb(Ug,eb())}function pb(){return kb(Ug,fb())}function qb(){return lb(!Ug,db())}function rb(){return lb(Ug,eb())}function sb(){return lb(Ug,fb())}function tb(){var a=db();return Ug?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Ug?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Ug?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Ug,db())}function xb(){return mb(Ug,eb())}function yb(){return mb(Ug,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return pf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Ui.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Ui.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Ui.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+o)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Oc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return pf.min(Object.keys(i).map(function(a){return pf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=zc(a),i=Mc(a);if(rg.length>0)for(g=Pc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return pf.max(Object.keys(i).map(function(a){return pf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?th:kh,n="y2"===c?sh:jh,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?uh:lh,r=rd()&&Ug;return 0===l.length?"y2"===c?dg.domain():cg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=sd(o,p),j=$b(cg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&ph&&(f=b(ph.top)?ph.top:e,g=b(ph.bottom)?ph.bottom:e),"y2"===c&&yh&&(f=b(yh.top)?yh.top:e,g=b(yh.bottom)?yh.bottom:e),Wd(l)&&!Oc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Zi),c=$b(bg.domain());return a||0===c?1:b/c}function Wb(a){return eh?eh:pf.min(a,function(a){return pf.min(a.values,function(a){return a.x})})}function Xb(a){return dh?dh:pf.max(a,function(a){return pf.max(a.values,function(a){return a.x})})}function Yb(a,c){var d,e,f,g,h=c[0],i=c[1],j=Math.abs(h-i);return pi?e=0:Wd(a)?(d=xc(),e=d>1?j/(d-1)/2:.5):e=.01*j,"object"==typeof fh&&qe(fh)?(f=b(fh.left)?fh.left:e,g=b(fh.right)?fh.right:e):f=g="number"==typeof fh?fh:e,{left:f,right:g}}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=0,g=0;return(c||0===c)&&(f=oi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=oi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bb?0:b-c}function fc(a){var b,c=dc(a),d="y"===a.axis?cg:dg;return b="y"===a.axis||"y2"===a.axis?Ug?Kf:"start"in a?d(a.start):Kf:Ug?"end"in a?bg(oi?le(a.end):a.end):Kf:Kf,c>b?0:b-c}function gc(a){return lg&&a===lg||qe(mg)&&re(mg,a)}function hc(a){return!gc(a)}function ic(a){return lg?lg:qe(mg)?mg[a]:null}function jc(a,b){var c,d=b&&qe(b)?zc(b):[];return d.forEach(function(b){ic(b)===a&&(c=qf.data.xs[b])}),c}function kc(a,b){return a in qf.data.xs&&qf.data.xs[a]&&qf.data.xs[a][b]?qf.data.xs[a][b]:b}function lc(a){Object.keys(a).forEach(function(b){mg[b]=a[b]})}function mc(a){return 1===pf.set(Object.keys(a).map(function(b){return a[b]})).size()}function nc(a){var b;return a&&(b=pg[a.id],a.name=b?b:a.id),a}function oc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=qc(b[d],a.id,d)}),qf.data.xs[a.id]=b})}function pc(a,b){a.forEach(function(a){b[a.id]&&oc([a],b[a.id])})}function qc(a,b,c){var d;return d=oi?a?a instanceof Date?a:le(a):le(kc(b,c)):qi&&!pi?a?+a:kc(b,c):c}function rc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?qf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):lg?(d=Object.keys(qf.data.xs),qf.data.xs[c]=d.length>0?qf.data.xs[d[0]]:void 0):qe(mg)&&(qf.data.xs[c]=jc(f,qf.data.targets)):qf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!qf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=og(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=ic(b),g=a[f],h=qc(g,b,e);return qi&&pi&&0===c&&g&&(0===e&&(Xg=[]),Xg.push(g)),("undefined"==typeof a[b]||qf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),tg&&Ud(zc(c).filter(function(a){return!(a in ug)}),tg),c.forEach(function(a){ac(a.id_org,a)}),c}function uc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function vc(a){return a>0&&qf.data.targets[0].values[a-1]?qf.data.targets[0].values[a-1].x:void 0}function wc(a){return a1?qf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?qf.data.targets[0]:null,a}function zc(a){return a.map(function(a){return a.id})}function Ac(a){return a?"string"==typeof a?[a]:a:zc(qf.data.targets)}function Bc(a,b){var c,d=zc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(oi?new Date(h):h);i.push(d)}return oi||(i=i.sort(function(a,b){return a-b})),i}function Ic(a){zi=zi.concat(a)}function Jc(a){zi=zi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){Ai=Ai.concat(a)}function Lc(a){Ai=Ai.filter(function(b){return a.indexOf(b)<0})}function Mc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Nc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Pc(a){return Nc(a,function(a){return a>0})}function Qc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(Ad(a,f))),a[g].x&&(e=e.concat(Ad(a,g))),Dd(e,b)):Bd(a,b,f,g)}function Cd(a,b){var c;return c=a.map(function(a){return Bd(a.values,b)}),Dd(c,b)}function Dd(a,b){var c,d;return a.forEach(function(a){var e=se(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Ed(a,b){return pf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Fd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Gd(){return wg&&"desc"===wg.toLowerCase()}function Hd(){return wg&&"asc"===wg.toLowerCase()}function Id(a){var b=Hd(),c=Gd();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof wg&&a.sort(wg),a}function Jd(a,c){var d,e,f,g,h,i,j,k=$d(qf.data.targets),l=k?ud:td,m=a.filter(function(a){return a&&b(a.value)});bi&&0!==m.length&&(Xi.html(ei(a,$(),l,wi)).style("display","block"),d=Xi.property("offsetWidth"),e=Xi.property("offsetHeight"),k?(g=If/2+c[0],i=Kf/2+c[1]+20):(Ug?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=bg(m[0].x)+20):(f=q(),g=f+t()+bg(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Xi.style("top",i+"px").style("left",g+"px"))}function Kd(){Xi.style("display","none")}function Ld(a){var c=a.filter(function(a){return a&&b(a.value)});bi&&(Xd(qf.data.targets)||$d(qf.data.targets)||Ui.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Ug?"y1":"x1",wd).attr(Ug?"y2":"x2",wd))}function Md(){Ui.select("line."+f.xgridFocus).style("visibility","hidden")}function Nd(a){return a.x||0===a.x?bg(a.x):null}function Od(a){return V(a.id)(a.value)}function Pd(){var a,b,d={},e=0;return Fc(Cc(be)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Td(a,b){return Nh?Nh:b?2*a.tickOffset()*Oh/b:0}function Ud(a,b){Ac(a).forEach(function(a){_i[a]=b===ug[a],ug[a]=b})}function Vd(a,b){var c=!1;return a.forEach(function(a){ug[a.id]===b&&(c=!0),a.id in ug||"line"!==b||(c=!0)}),c}function Wd(a){return Vd(a,"bar")}function Xd(a){return Vd(a,"scatter")}function Yd(a){return Vd(a,"pie")}function Zd(a){return Vd(a,"donut")}function $d(a){return Yd(a)||Zd(a)}function _d(a){var b="string"==typeof a?a:a.id;return!(b in ug)||"line"===ug[b]||"spline"===ug[b]||"area"===ug[b]||"area-spline"===ug[b]}function ae(a){var b="string"==typeof a?a:a.id;return"spline"===ug[b]||"area-spline"===ug[b]}function be(a){var b="string"==typeof a?a:a.id;return"bar"===ug[b]}function ce(a){var b="string"==typeof a?a:a.id;return"scatter"===ug[b]}function de(a){var b="string"==typeof a?a:a.id;return"pie"===ug[b]}function ee(a){var b="string"==typeof a?a:a.id;return"donut"===ug[b]}function fe(a){return de(a)||ee(a)}function ge(a){return be(a)?a.values:[]}function he(a){return _d(a)||ce(a)?a.values:[]}function ie(a){return be(a)||_d(a)?a.values:[]}function je(a){return ee(a)&&Xh||de(a)&&Rh}function ke(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function le(b){var c;try{c=ng?pf.time.format(ng).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ng)}return c}function me(a,b){var c=pf.mouse(a),d=pf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function re(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function se(a,b){var c="y"===Z(a.id)?cg:dg,d=Ug?1:0,e=Ug?0:1;return Math.pow(bg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function te(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function ue(a,b,c){Hg(b,a.node()),Ui.select("."+f.selectedCircles+id(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Rc(f.selectedCircle,c)}).attr("cx",Ug?Od:Nd).attr("cy",Ug?Nd:Od).attr("stroke",function(){return wi(b)}).attr("r",1.4*Lh).transition().duration(100).attr("r",Lh)}function ve(a,b,c){Ig(b,a.node()),Ui.select("."+f.selectedCircles+id(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a,b){Hg(b,a.node()),a.transition().duration(100).style("fill",function(){return pf.rgb(wi(b)).darker(1)})}function ye(a,b){Ig(b,a.node()),a.transition().duration(100).style("fill",function(){return wi(b)})}function ze(a,b,c,d){a?xe(b,c,d):ye(b,c,d)}function Ae(a){return a.filter(function(a){return b(a.value)})}function Be(a,c){return(c?Ui.selectAll("."+f.circles+id(c)):Ui).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ce(a,b){Be(a,b).classed(f.EXPANDED,!0).attr("r",Kh)}function De(a){Be(a).filter(function(){return pf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Hh)}function Ee(a){return Ui.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Fe(a){Ee(a).classed(f.EXPANDED,!0)}function Ge(a){Ee(a).classed(f.EXPANDED,!1)}function He(a,b){var c=Le(a,b);return function(a,b){var d=c(a,b),e=Ug?1:0,f=Ug?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function Ie(a,b){var c=Le(a,!1),d=b?Je:Ke;return function(a,b){return d(c(a,b),a,this)}}function Je(a,b){var c;return Ug?(c=be(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ke(a,b,c){var d=c.getBoundingClientRect();return Ug?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:be(b)?-3:-6)}function Le(a,b){var c=a.__max__+1,d=Td(hg,c),e=Qd(d,c,a,!!b),f=Rd(!!b),g=Sd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Ug&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Me(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function Ne(b){var c,d,e;if(Yi=pf.select(sf),Yi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Yi.html(""),Yi.classed("c3",!0),qf.data.xs={},qf.data.targets=tc(b),n(),R(),bg.domain(pf.extent(Zb(qf.data.targets))),cg.domain(Ub(qf.data.targets,"y")),dg.domain(Ub(qf.data.targets,"y2")),eg.domain(bg.domain()),fg.domain(cg.domain()),gg.domain(dg.domain()),Zi=bg.domain(),Ni.scale(eg),xf&&Ri.scale(bg),Si=Yi.append("svg").attr("width",If+Ff.left+Ff.right).attr("height",Kf+Ff.top+Ff.bottom).on("mouseenter",Af).on("mouseleave",Bf),Ti=Si.append("defs"),Ti.append("clipPath").attr("id",ii).append("rect").attr("width",If).attr("height",Kf),Ti.append("clipPath").attr("id",ji).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Ti.append("clipPath").attr("id",ki).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Ui=Si.append("g").attr("transform",Fi.main),Vi=Lg?Si.append("g").attr("transform",Fi.context):null,Wi=Si.append("g").attr("transform",Fi.legend),Og||(Wi.style("visibility","hidden"),Ai=zc(qf.data.targets)),Xi=pf.select(sf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),kf(zc(qf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Ui.append("g").attr("class",f.axisX).attr("clip-path",mi).attr("transform",Fi.x).append("text").attr("class",f.axisXLabel).attr("transform",Ug?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),ih&&Ui.append("g").attr("class",f.axisY).attr("clip-path",ni).attr("transform",Fi.y).append("text").attr("class",f.axisYLabel).attr("transform",Ug?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),rh&&Ui.append("g").attr("class",f.axisY2).attr("transform",Fi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Ug?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Ui.append("g").attr("clip-path",li).attr("class",f.grid),Ah&&d.append("g").attr("class",f.xgrids),qe(Ch)&&d.append("g").attr("class",f.xgridLines),Ih&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Dh&&d.append("g").attr("class",f.ygrids),qe(Eh)&&d.append("g").attr("class",f.ygridLines),Ui.append("g").attr("clip-path",li).attr("class",f.regions),Ui.append("g").attr("clip-path",li).attr("class",f.chart),c=Ui.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",xf?Ug?"ns-resize":"ew-resize":null),Ui.select("."+f.chart).append("g").attr("class",f.chartBars),Ui.select("."+f.chart).append("g").attr("class",f.chartLines),Ui.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Fi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Ui.select("."+f.chart).append("g").attr("class",f.chartTexts),xf&&Ui.insert("rect",zf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",If).attr("height",Kf).style("opacity",0).style("cursor",Ug?"ns-resize":"ew-resize").call(Ri).on("dblclick.zoom",null),gh&&Ni.extent("function"!=typeof gh?gh:gh(Zb())),Lg&&(Vi.append("g").attr("clip-path",li).attr("class",f.chart),Vi.select("."+f.chart).append("g").attr("class",f.chartBars),Vi.select("."+f.chart).append("g").attr("class",f.chartLines),Vi.append("g").attr("clip-path",li).attr("class",f.brush).call(Ni).selectAll("rect").attr(Ug?"width":"height",Ug?Jf:Lf),Vi.append("g").attr("class",f.axisX).attr("transform",Fi.subx).attr("clip-path",Ug?"":mi)),$e(qf.data.targets),Ug?Ui.select("."+f.axisX).style("opacity",0).call(hg):(Ui.select("."+f.axisY).style("opacity",0).call(ig),Ui.select("."+f.axisY2).style("opacity",0).call(jg)),Ue({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),fi){if(oi&&"string"==typeof gi){for(gi=le(gi),e=0;e0){d=[];for(var g in pg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Fd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=ze,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function Se(a){$d(qf.data.targets)||Ag&&(ri=a,Ui.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),si=!0,Jg())}function Te(){$d(qf.data.targets)||Ag&&(Ui.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Ui.selectAll("."+f.shape).classed(f.INCLUDED,!1),si=!1,Kg())}function Ue(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Pd(),U=$d(qf.data.targets),V=Fc(qf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?Ef:0,O=B?N:0,P=C?N:0,H&&Og&&kf(zc(qf.data.targets),a),G&&(bg.domain(pf.extent(Zb(V))),Zi=bg.domain(),xf&&Ri.scale(bg).updateScaleExtent(),eg.domain(bg.domain()),Ni.scale(eg)),F&&(bg.domain(Ni.empty()?Zi:Ni.extent()),xf&&Ri.scale(bg).updateScaleExtent()),cg.domain(Ub(V,"y")),dg.domain(Ub(V,"y2")),Xd(V)||(Q=ch?ch:Hc(Gc(V)),hg.tickValues(Q),kg.tickValues(Q)),c=Ui.select("."+f.axisX).style("opacity",U?0:1),(Ug||D)&&(c=c.transition().duration(P)),c.call(hg),e=Ui.select("."+f.axisY).style("opacity",U?0:1),(!Ug||D)&&(e=e.transition().duration(P)),e.call(ig),Ui.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(jg),F)if($g&&Q){for(R=1;R=0&&pf.select(this).style("display",b%S?"none":"block")})}else pf.selectAll("."+f.axisX+" .tick text").style("display","block");if(I=He(T),K=Ie(T,!0),M=Ie(T,!1),Ab(),fg.domain(cg.domain()),gg.domain(dg.domain()),Xi.style("display","none"),o(),Ui.select("line."+f.xgridFocus).style("visibility","hidden"),Ah){if("year"===Bh){h=[];for(var W=Zb(),X=W[0].getFullYear(),Y=W[1].getFullYear(),Z=X;Y>=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=bg.ticks(10);g=Ui.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Ug?0:function(a){return bg(a)-hg.tickOffset()}).attr("x2",Ug?If:function(a){return bg(a)-hg.tickOffset()}).attr("y1",Ug?function(a){return bg(a)-hg.tickOffset()}:Ff.top).attr("y2",Ug?function(a){return bg(a)-hg.tickOffset()}:Kf).style("opacity",function(){return+pf.select(this).attr(Ug?"y1":"x1")===(Ug?Kf:0)?0:1}),g.exit().remove()}qe(Ch)&&(i=Ui.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Ch),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Ug?"":"rotate(-90)").attr("dx",Ug?0:-Ff.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Ug?0:xd).attr("x2",Ug?If:xd).attr("y1",Ug?xd:Ff.top).attr("y2",Ug?xd:Kf).style("opacity",1),i.select("text").transition().duration(N).attr("x",Ug?If:0).attr("y",xd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&Dh&&(k=Ui.select("."+f.ygrids).selectAll("."+f.ygrid).data(cg.ticks(Fh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Ug?cg:0).attr("x2",Ug?cg:If).attr("y1",Ug?0:cg).attr("y2",Ug?Kf:cg),k.exit().remove()),y&&qe(Eh)&&(l=Ui.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Eh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Ug?"rotate(-90)":"").attr("dx",Ug?0:-Ff.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Ug?yd:0).attr("x2",Ug?yd:If).attr("y1",Ug?0:yd).attr("y2",Ug?Kf:yd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Ug?0:If).attr("y",yd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Ui.selectAll("."+f.bars).selectAll("."+f.bar).data(ge),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return wi(a)}).attr("class",Zc),p.style("opacity",nd).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Ui.selectAll("."+f.texts).selectAll("."+f.text).data(ie),r.enter().append("text").attr("class",Sc).attr("text-anchor",function(a){return Ug?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return vd(a.id)(a.value)}).style("fill-opacity",od).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",qd),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Ui.selectAll("."+f.line).style("opacity",nd).transition().duration(N).attr("d",Oi).style("opacity",1),Ui.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Pi).style("opacity",$i),n=Ui.selectAll("."+f.circles).selectAll("."+f.circle).data(he),n.enter().append("circle").attr("class",Xc).style("opacity",0).attr("r",Hh),n.style("opacity",nd).transition().duration(N).style("opacity",pd).attr("cx",Ug?Od:Nd).attr("cy",Ug?Nd:Od),n.exit().remove(),Ui.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=pf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Ui.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Dc(a.data.id)&&fe(a.data)?1:0}),Ui.select("."+f.chartArcsTitle).style("opacity",Zd(qf.data.targets)?1:0),Lg&&(null!==pf.event&&"zoom"===pf.event.type&&Ni.extent(bg.orgDomain()).update(),z&&(Vi.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(kg),Ni.empty()||Ni.extent(bg.orgDomain()).update(),J=He(T,!0),s=Vi.selectAll("."+f.bars).selectAll("."+f.bar).data(ge),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return wi(a)}).attr("class",Zc),s.style("opacity",nd).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Vi.selectAll("."+f.line).style("opacity",nd).transition().duration(N).attr("d",Qi).style("opacity",1))),Ui.selectAll("."+f.selectedCircles).filter(function(a){return be(a)}).selectAll("circle").remove(),Ui.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Ug?Od:Nd).attr("cy",Ug?Nd:Od),t=Ui.select("."+f.eventRects),qe(mg)&&!mc(mg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Ui.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Pe(u.enter()),u.attr("x",0).attr("y",0).attr("width",If).attr("height",Kf)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),qi&&!pi?(x=function(a,b){var c=vc(b),d=wc(b),e=qf.data.xs[a.id][b];return(bg(d?d:e+50)-bg(c?c:e-50))/2},w=function(a,b){var c=vc(b),d=qf.data.xs[a.id][b];return(bg(d)+bg(c?c:d-50))/2}):(x=L(),w=function(a){return bg(a.x)-x/2}),v=yc(),Ui.select("."+f.eventRects).datum(v?v.values:[]),u=Ui.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Oe(u.enter()),u.attr("class",cd).attr("x",Ug?0:w).attr("y",Ug?w:0).attr("width",Ug?If:x).attr("height",Ug?x:Kf),u.exit().remove()),q=Ui.select("."+f.regions).selectAll("rect."+f.region).data(ai),q.enter().append("rect").style("fill-opacity",0),q.attr("class",bd).attr("x",cc).attr("y",dc).attr("width",ec).attr("height",fc).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),zc(qf.data.targets).forEach(function(a){_i[a]=!0})}}function Ve(){Ue({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function We(){return"mousemove"===pf.event.sourceEvent.type&&Ri.altDomain?(bg.domain(Ri.altDomain),void Ri.scale(bg).updateScaleExtent()):(pi&&bg.orgDomain()[0]===Zi[0]&&bg.domain([Zi[0]-1e-10,bg.orgDomain()[1]]),Ue({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===pf.event.sourceEvent.type&&(ti=!0)))}function Xe(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ye(){Si.attr("width",Mf).attr("height",Nf),Si.select("#"+ii).select("rect").attr("width",If).attr("height",Kf),Si.select("#"+ji).select("rect").attr("width",H),Si.select("#"+ki).select("rect").attr("width",J),Si.select("."+f.zoomRect).attr("width",If).attr("height",Kf)}function Ze(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Ye(),m(a.withTransition),Ue(a)}function $e(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Ui.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",ed),j=i.enter().append("g").attr("class",ed).style("pointer-events","none"),j.append("g").attr("class",Tc).style("fill",function(a){return wi(a)}),e=Ui.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",gd),d=e.enter().append("g").attr("class",gd).style("pointer-events","none"),d.append("g").attr("class",$c).style("fill",function(a){return wi(a)}).style("stroke","none").style("cursor",function(a){return Cg(a)?"pointer":null}),c=Ui.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",fd),b=c.enter().append("g").attr("class",fd).style("pointer-events","none"),b.append("path").attr("class",Wc).style("opacity",0).style("stroke",function(a){return wi(a)}),b.append("path").attr("class",ad).style("opacity",function(){return $i=+pf.select(this).style("opacity"),0}).style("fill",function(a){return wi(a)}),b.append("g").attr("class",function(a){return Rc(f.selectedCircles,a.id)}),b.append("g").attr("class",Yc).style("fill",function(a){return wi(a)}).style("cursor",function(a){return Cg(a)?"pointer":null}),a.forEach(function(a){Ui.selectAll("."+f.selectedCircles+id(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Ui.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Uf(a)).attr("class",hd),g=h.enter().append("g").attr("class",hd),g.append("path").attr("class",_c).style("opacity",0).style("fill",function(a){return wi(a.data)}).style("cursor",function(a){return Cg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),ef(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Jd(c,pf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),gf(),Kd(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Lg&&(n=Vi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",gd),m=n.enter().append("g").attr("class",gd),m.append("g").attr("class",$c).style("fill",function(a){return wi(a)}),l=Vi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",fd),k=l.enter().append("g").attr("class",fd),k.append("path").attr("class",Wc).style("opacity",0).style("stroke",function(a){return wi(a)})),Si.selectAll("."+f.target).filter(function(a){return Dc(a.id)}).transition().style("opacity",1)}function _e(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Ud(a.id,b.types[a.id]):Ud(a.id,b.type)}),qf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Gi?j:i,l=Gi?Q():P();return d&&(w=0,C=0,t=0,u=0),Og&&!Ec(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Gi?u:t,void(Tg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,Gi?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Wi.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Rc(f.legendItem,a)}).style("visibility",function(a){return Ec(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Qg?Qg(a):qf.toggle(a)}).on("mouseover",function(a){qf.focus(a),"function"==typeof Rg&&Rg(a)}).on("mouseout",function(a){qf.revert(),"function"==typeof Sg&&Sg(a)}),l.append("text").text(function(a){return d(pg[a])?pg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",Gi?g:-200).attr("y",Gi?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Gi?h:-200).attr("y",Gi?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return wi(a)}).attr("x",Gi?g:-200).attr("y",Gi?-200:i).attr("width",10).attr("height",10),Wi.selectAll("text").data(a).text(function(a){return d(pg[a])?pg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Wi.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Wi.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Ye(),q&&m(p)}function lf(a){return Bc(qf.data.targets,a.id)}function mf(a){return"data"in a&&Bc(qf.data.targets,a.data.id)}function nf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function of(a,b,c){var d=!$d(qf.data.targets);Ud(a,b),Ze(c?c:{withTransitionForAxis:d})}var pf=a.d3?a.d3:a.require?a.require("d3"):void 0,qf={data:{},axis:{},legend:{}},rf={},sf=h(["bindto"],"#chart"),tf=h(["size","width"]),uf=h(["size","height"]),vf=h(["padding","left"]),wf=h(["padding","right"]),xf=h(["zoom","enabled"],!1),yf=h(["zoom","extent"]),zf=h(["zoom","privileged"],!1),Af=h(["onenter"],function(){}),Bf=h(["onleave"],function(){}),Cf=h(["onresize"],function(){}),Df=h(["onresized"],function(){}),Ef=h(["transition","duration"],350);g("data","data is required in config");var Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg=h(["data","x"]),mg=h(["data","xs"],{}),ng=h(["data","x_format"]),og=h(["data","id_converter"],function(a){return a}),pg=h(["data","names"],{}),qg=h(["data","classes"],{}),rg=h(["data","groups"],[]),sg=h(["data","axes"],{}),tg=h(["data","type"]),ug=h(["data","types"],{}),vg=h(["data","labels"],{}),wg=h(["data","order"]),xg=h(["data","regions"],{}),yg=h(["data","color"]),zg=h(["data","colors"],{}),Ag=h(["data","selection","enabled"],!1),Bg=h(["data","selection","grouped"],!1),Cg=h(["data","selection","isselectable"],function(){return!0}),Dg=h(["data","selection","multiple"],!0),Eg=h(["data","onclick"],function(){}),Fg=h(["data","onenter"],function(){}),Gg=h(["data","onleave"],function(){}),Hg=h(["data","onselected"],function(){}),Ig=h(["data","onunselected"],function(){}),Jg=h(["data","ondragstart"],function(){}),Kg=h(["data","ondragend"],function(){}),Lg=h(["subchart","show"],!1),Mg=Lg?h(["subchart","size","height"],60):0,Ng=h(["color","pattern"],[]),Og=h(["legend","show"],!0),Pg=h(["legend","position"],"bottom"),Qg=h(["legend","item","onclick"]),Rg=h(["legend","item","onmouseover"]),Sg=h(["legend","item","onmouseout"]),Tg=h(["legend","equally"],!1),Ug=h(["axis","rotated"],!1),Vg=h(["axis","x","type"],"indexed"),Wg=h(["axis","x","localtime"],!0),Xg=h(["axis","x","categories"],[]),Yg=h(["axis","x","tick","centered"],!1),Zg=h(["axis","x","tick","format"]),$g=h(["axis","x","tick","culling"],{}),_g=h(["axis","x","tick","culling","max"],10),ah=h(["axis","x","tick","count"]),bh=h(["axis","x","tick","fit"],!1),ch=h(["axis","x","tick","values"],null),dh=h(["axis","x","max"]),eh=h(["axis","x","min"]),fh=h(["axis","x","padding"],{}),gh=h(["axis","x","default"]),hh=h(["axis","x","label"],{}),ih=h(["axis","y","show"],!0),jh=h(["axis","y","max"]),kh=h(["axis","y","min"]),lh=h(["axis","y","center"]),mh=h(["axis","y","label"],{}),nh=h(["axis","y","inner"],!1),oh=h(["axis","y","tick","format"]),ph=h(["axis","y","padding"],{}),qh=h(["axis","y","ticks"],10),rh=h(["axis","y2","show"],!1),sh=h(["axis","y2","max"]),th=h(["axis","y2","min"]),uh=h(["axis","y2","center"]),vh=h(["axis","y2","label"],{}),wh=h(["axis","y2","inner"],!1),xh=h(["axis","y2","tick","format"]),yh=h(["axis","y2","padding"],{}),zh=h(["axis","y2","ticks"],10),Ah=h(["grid","x","show"],!1),Bh=h(["grid","x","type"],"tick"),Ch=h(["grid","x","lines"],[]),Dh=h(["grid","y","show"],!1),Eh=h(["grid","y","lines"],[]),Fh=h(["grid","y","ticks"],10),Gh=h(["point","show"],!0),Hh=Gh?h(["point","r"],2.5):0,Ih=h(["point","focus","line","enabled"],!0),Jh=h(["point","focus","expand","enabled"],!0),Kh=h(["point","focus","expand","r"],Jh?4:Hh),Lh=h(["point","focus","select","r"],8),Mh=h(["line","connect_null"],!1),Nh=h(["bar","width"]),Oh=h(["bar","width","ratio"],.6),Ph=h(["pie","label","show"],!0),Qh=h(["pie","label","format"]),Rh=h(["pie","expand"],!0),Sh=h(["pie","onclick"],function(){}),Th=h(["pie","onmouseover"],function(){}),Uh=h(["pie","onmouseout"],function(){}),Vh=h(["donut","label","show"],!0),Wh=h(["donut","label","format"]),Xh=h(["donut","expand"],!0),Yh=h(["donut","title"],""),Zh=h(["donut","onclick"],function(){}),$h=h(["donut","onmouseover"],function(){}),_h=h(["donut","onmouseout"],function(){}),ai=h(["regions"],[]),bi=h(["tooltip","show"],!0),ci=h(["tooltip","format","title"]),di=h(["tooltip","format","value"]),ei=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ci?ci:b,l=di?di:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),fi=h(["tooltip","init","show"],!1),gi=h(["tooltip","init","x"],0),hi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ii=("string"==typeof sf?sf.replace("#",""):sf.id)+"-clip",ji=ii+"-xaxis",ki=ii+"-yaxis",li=i(ii),mi=i(ji),ni=i(ki),oi="timeseries"===Vg,pi="categorized"===Vg,qi=!oi&&(lg||qe(mg)),ri=null,si=!1,ti=!1,ui=!1,vi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],wi=ke(zg,qe(Ng)?Ng:vi,yg),xi=Wg?pf.time.format:pf.time.format.utc,yi=function(){var a=[[xi("%Y/%-m/%-d"),function(){return!0}],[xi("%-m/%-d"),function(a){return a.getMonth()}],[xi("%-m/%-d"),function(a){return 1!==a.getDate()}],[xi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[xi("%I %p"),function(a){return a.getHours()}],[xi("%I:%M"),function(a){return a.getMinutes()}],[xi(":%S"),function(a){return a.getSeconds()}],[xi(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),zi=[],Ai=[],Bi=Ug?"left":"bottom",Ci=Ug?nh?"top":"bottom":nh?"right":"left",Di=Ug?wh?"bottom":"top":wh?"left":"right",Ei=Ug?"left":"bottom",Fi={main:function(){return"translate("+Ff.left+","+Ff.top+")"},context:function(){return"translate("+Gf.left+","+Gf.top+")"},legend:function(){return"translate("+Hf.left+","+Hf.top+")"},x:function(){return"translate(0,"+(Ug?0:Kf)+")"},y:function(){return"translate(0,"+(Ug?Kf:0)+")"},y2:function(){return"translate("+(Ug?0:If)+","+(Ug?1:0)+")"},subx:function(){return"translate(0,"+(Ug?0:Lf)+")"},arc:function(){return"translate("+If/2+","+Kf/2+")"}},Gi="right"===Pg,Hi=0,Ii=0,Ji=0,Ki=30,Li=30,Mi=5;Uf=pf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Ni,Oi=function(){var a=pf.svg.line().x(Ug?function(a){return V(a.id)(a.value)}:wd).y(Ug?wd:function(a){return V(a.id)(a.value)});return Mh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Mh?Ae(b.values):b.values;return _d(b)?(a.interpolate(ae(b)?"cardinal":"linear"),xg[b.id]?Me(e,bg,V(b.id),xg[b.id]):a(e)):(c=e[0]?bg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ug?"M "+d+" "+c:"M "+c+" "+d)}}(),Pi=function(){var a;return a=Ug?pf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(wd):pf.svg.area().x(wd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ae(b.values);return Vd([b],"area")||Vd([b],"area-spline")?(a.interpolate(ae(b)?"cardinal":"linear"),a(e)):(c=e[0]?bg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ug?"M "+d+" "+c:"M "+c+" "+d)}}(),Qi=function(){var a=pf.svg.line().x(Ug?function(a){return W(a.id)(a.value)}:zd).y(Ug?zd:function(a){return W(a.id)(a.value)});return function(b){var c=Ae(b.values);return _d(b)?a(c):"M "+eg(c[0].x)+" "+W(b.id)(c[0].value)}}(),Ri=function(){};Ni=pf.svg.brush().on("brush",Ve),Ni.update=function(){return Vi&&Vi.select("."+f.brush).call(this),this},Ni.scale=function(a){return Ug?this.y(a):this.x(a)},xf&&(Ri=pf.behavior.zoom().on("zoomstart",function(){Ri.altDomain=pf.event.sourceEvent.altKey?bg.orgDomain():null}).on("zoom",xf?We:null),Ri.scale=function(a){return Ug?this.y(a):this.x(a)},Ri.orgScaleExtent=function(){var a=yf?yf:[1,10];return[a[0],Math.max(xc()/a[1],a[1])]},Ri.updateScaleExtent=function(){var a=$b(bg.orgDomain())/$b(Zi),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Si,Ti,Ui,Vi,Wi,Xi,Yi,Zi,$i,_i={};if(qf.focus=function(a){function b(a){Fc(a).transition().duration(100).style("opacity",1)}var c=Si.selectAll(jd(a)),d=c.filter(lf),e=c.filter(mf);qf.revert(),qf.defocus(),b(d.classed(f.focused,!0)),b(e),$d(qf.data.targets)&&Kb(a,!0),ef(a)},qf.defocus=function(a){function b(a){Fc(a).transition().duration(100).style("opacity",.3)}var c=Si.selectAll(jd(a)),d=c.filter(lf),e=c.filter(mf);qf.revert(),b(d.classed(f.focused,!1)),b(e),$d(qf.data.targets)&&Lb(a),ff(a)},qf.revert=function(a){function b(a){Fc(a).transition().duration(100).style("opacity",1)}var c=Si.selectAll(jd(a)),d=c.filter(lf),e=c.filter(mf);b(d.classed(f.focused,!1)),b(e),$d(qf.data.targets)&&Lb(a),gf()},qf.show=function(a,b){a=Ac(a),b=b||{},Jc(a),Si.selectAll(kd(a)).transition().style("opacity",1),b.withLegend?hf(a):Wi.selectAll(md(a)).classed(f.legendItemHidden,!1),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},qf.hide=function(a,b){a=Ac(a),b=b||{},Ic(a),Si.selectAll(kd(a)).transition().style("opacity",0),b.withLegend?jf(a):Wi.selectAll(md(a)).classed(f.legendItemHidden,!0),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},qf.toggle=function(a){Dc(a)?qf.hide(a):qf.show(a)},qf.unzoom=function(){Ni.clear().update(),Ue({withUpdateXDomain:!0})},qf.load=function(a){return a.xs&&lc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){qg[b]=a.classes[b]}),"categories"in a&&pi&&(Xg=a.categories,hg.categories(Xg)),"cacheIds"in a&&_b(a.cacheIds)?void _e(bc(a.cacheIds),a.done):void("unload"in a?bf(Ac("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){af(a)}):af(a))},qf.unload=function(a){bf(Ac(a),function(){Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},qf.selected=function(a){return pf.merge(Ui.selectAll("."+f.shapes+id(a)).selectAll("."+f.shape).filter(function(){return pf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},qf.select=function(a,b,c){Ag&&Ui.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=pf.select(this),i="circle"===this.nodeName?ue:xe,j="circle"===this.nodeName?ve:ye,k=Bg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Cg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},qf.unselect=function(a,b){Ag&&Ui.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=pf.select(this),g="circle"===this.nodeName?ve:ye,h=Bg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Cg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},qf.toLine=function(a){of(a,"line")},qf.toSpline=function(a){of(a,"spline")},qf.toBar=function(a){of(a,"bar")},qf.toScatter=function(a){of(a,"scatter")},qf.toArea=function(a){of(a,"area")},qf.toAreaSpline=function(a){of(a,"area-spline")},qf.toPie=function(a){of(a,"pie",{withTransform:!0})},qf.toDonut=function(a){of(a,"donut",{withTransform:!0})},qf.groups=function(a){return c(a)?rg:(rg=a,Ue(),rg)},qf.xgrids=function(a){return a?(Ch=a,Ue(),Ch):Ch},qf.xgrids.add=function(a){return a?qf.xgrids(Ch.concat(a)):void 0},qf.xgrids.remove=function(a){var b=nf(a);return qf.xgrids(Ch.filter(b))},qf.ygrids=function(a){return a?(Eh=a,Ue(),Eh):Eh},qf.ygrids.add=function(a){return a?qf.ygrids(Eh.concat(a)):void 0},qf.ygrids.remove=function(a){var b=nf(a);return qf.ygrids(Eh.filter(b))},qf.regions=function(a){return c(a)?ai:(ai=a,Ue(),ai)},qf.regions.add=function(a){return c(a)?ai:(ai=ai.concat(a),Ue(),ai)},qf.regions.remove=function(a,c){var e=[].concat(a); return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;Si.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ai=ai.filter(function(b){return b.classes.indexOf(a)<0})}),ai},qf.data.get=function(a){var b=qf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},qf.data.getAsTarget=function(a){var b=Cc(function(b){return b.id===a});return b.length>0?b[0]:void 0},qf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){pg[b]=a[b]}),kf(zc(qf.data.targets),{withTransition:!0}),pg):pg},qf.x=function(a){return arguments.length&&(oc(qf.data.targets,a),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),qf.data.xs},qf.xs=function(a){return arguments.length&&(pc(qf.data.targets,a),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),qf.data.xs},qf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},qf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(jh=+a.y),b(a.y2)&&(sh=+a.y2)):jh=sh=+a,Ue())},qf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(kh=+a.y),b(a.y2)&&(th=+a.y2)):kh=th=+a,Ue())},qf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&qf.axis.max(a.max),"undefined"!=typeof a.min&&qf.axis.min(a.min))},qf.legend.show=function(a){Og||(Og=!0,Wi.style("visibility","visible")),hf(Ac(a)),Ue({withTransitionForHorizontalAxis:!1})},qf.legend.hide=function(a){Og&&pe(a)&&(Og=!1,Wi.style("visibility","hidden")),jf(Ac(a)),Ue({withTransitionForHorizontalAxis:!1})},qf.resize=function(a){tf=a?a.width:null,uf=a?a.height:null,Ze({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},qf.destroy=function(){qf.data.targets=void 0,qf.data.xs={},Yi.html(""),a.onresize=null},"url"in e.data)pf.xhr(e.data.url,function(a,b){var c,d=pf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=pf.csv.parse(b.response),Ne(c)});else if("rows"in e.data)Ne(rc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ne(sc(e.data.columns))}return qf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From dcb656d3b90c8f936c9d35cc33348c35c091da8d Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Tue, 22 Apr 2014 20:00:19 +0900 Subject: [PATCH 051/178] Fix axis.x.tick.fit/count logic - #156 --- c3.js | 8 ++++---- c3.min.js | 4 ++-- htdocs/samples/scatter.html | 5 ++++- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/c3.js b/c3.js index 5dd4ac1..b1d3ac7 100644 --- a/c3.js +++ b/c3.js @@ -174,7 +174,7 @@ __axis_x_tick_culling = getConfig(['axis', 'x', 'tick', 'culling'], {}), __axis_x_tick_culling_max = getConfig(['axis', 'x', 'tick', 'culling', 'max'], 10), __axis_x_tick_count = getConfig(['axis', 'x', 'tick', 'count']), - __axis_x_tick_fit = getConfig(['axis', 'x', 'tick', 'fit'], false), + __axis_x_tick_fit = getConfig(['axis', 'x', 'tick', 'fit'], true), __axis_x_tick_values = getConfig(['axis', 'x', 'tick', 'values'], null), __axis_x_max = getConfig(['axis', 'x', 'max']), __axis_x_min = getConfig(['axis', 'x', 'min']), @@ -1553,7 +1553,7 @@ } function generateTickValues(xs) { var tickValues = xs, targetCount, start, end, count, interval, i, tickValue; - if (!__axis_x_tick_fit && __axis_x_tick_count) { + if (__axis_x_tick_count) { // TODO: need some arguments for __axis_x_tick_count()? targetCount = typeof __axis_x_tick_count === 'function' ? __axis_x_tick_count() : __axis_x_tick_count; // compute ticks according to __axis_x_tick_count @@ -3056,8 +3056,8 @@ y.domain(getYDomain(targetsToShow, 'y')); y2.domain(getYDomain(targetsToShow, 'y2')); - // update axis tick values according to options, except for scatter plot - if (! hasScatterType(targetsToShow)) { // TODO: fix this + // update axis tick values according to options + if (__axis_x_tick_fit || __axis_x_tick_count) { tickValues = __axis_x_tick_values ? __axis_x_tick_values : generateTickValues(mapTargetsToUniqueXs(targetsToShow)); xAxis.tickValues(tickValues); subXAxis.tickValues(tickValues); diff --git a/c3.min.js b/c3.min.js index 0853166..731b83b 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.31"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cIf&&(If=0),0>Kf&&(Kf=0),Gf={top:Ug?Ff.top:Nf-Mg-(Gi?0:a),right:0/0,bottom:20+(Gi?0:a),left:Ug?Ki:Ff.left},Jf=Ug?Ff.left-Ki-Li:If,Lf=Ug?Kf:Nf-Gf.top-Gf.bottom,0>Jf&&(Jf=0),0>Lf&&(Lf=0),Hf={top:Gi?0:Nf-a,right:0/0,bottom:0,left:Gi?Mf-b:0},p(),Gi&&$d(qf.data.targets)&&(Hf.left=If/2+Pf)}function o(){Ui.select("line."+f.xgridFocus).attr("x1",Ug?0:-10).attr("x2",Ug?If:-10).attr("y1",Ug?-10:Ff.top).attr("y2",Ug?-10:Kf)}function p(){Pf=Kf/2,Of=.95*Pf,Qf=Zd(qf.data.targets)?.6*Of:0}function q(){var a=Ug?f.axisX:f.axisY,b=pf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=pf.select(sf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return tf?tf:x()}function s(){var a=uf?uf:y();return a>0?a:320}function t(){return $d(qf.data.targets)?0:vf?vf:Ug||!ih||nh?1:v("y")}function u(){var a=1;return $d(qf.data.targets)?0:wf?wf:Gi?P()+(rh&&!Ug?v("y2"):a):rh?wh||Ug?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||ih?"y2"!==a||rh?(gb(a).isInner?30:40)+("y2"===a?-10:0):Mi:Og&&!Gi?10:1}function x(){return+pf.select(sf).style("width").replace("px","")}function y(){return+pf.select(sf).style("height").replace("px","")}function z(a){return a?-5:-(Ff.left-1)}function A(a){return a?-20:-1}function B(){return z(!Ug)}function C(){return A(!Ug)}function D(){return z(Ug)}function E(){return A(Ug)}function F(a){return a?If+2+4:Ff.left+20}function G(a){return a?80:Kf+2}function H(){return F(!Ug)}function I(){return G(!Ug)}function J(){return F(Ug)}function K(){return G(Ug)}function L(){var a=Ug?Kf:If,b=xc(),c=Vb()*(Wd(qf.data.targets)?(b-(pi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){Hi=a}function N(a){Ii=a}function O(a){Ji=a}function P(){return Og?Gi?Ii*(Hi+1):Mf:0}function Q(){return Og?Gi?Nf:Ji*(Hi+1):0}function R(){var a,b=!bg;Vf=Ug?1:0,Wf=Ug?Kf:If,Xf=Ug?0:Kf,Yf=Ug?If:1,Zf=Vf,$f=Wf,_f=Ug?0:Lf,ag=Ug?Jf:1,bg=T(Vf,Wf,b?void 0:bg.domain(),function(){return hg.tickOffset()}),cg=U(Xf,Yf),dg=U(Xf,Yf),eg=T(Vf,Wf,Zi,function(a){return a%1?0:kg.tickOffset()}),fg=U(_f,ag),gg=U(_f,ag),a=$(),hg=X(bg,Bi,a),kg=X(eg,Ei,a),ig=Y(cg,Ci,oh,qh),jg=Y(dg,Di,xh,zh),b||(Ni.scale(eg),xf&&Ri.scale(bg)),S()}function S(){Rf=Db(),Sf=Eb(),Tf=Eb(.98)}function T(a,b,e,f){var g=(oi?pf.time.scale():pf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),pi){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return pf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?dg:cg}function W(a){return"y2"===Z(a)?gg:fg}function X(a,b,c){var d=(pi?Bb():pf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),pi?(d.tickCentered(Yg),pe($g)&&($g=!1)):d.tickOffset=function(){var a=Ug?Kf:If;return a*Vb()/xc()/2},pi&&d.categories(Xg),d}function Y(a,b,c,d){return pf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in sg?sg[a]:"y"}function $(){var a=oi?yi:pi?Qc:function(a){return 0>a?a.toFixed(0):a};return Zg&&("function"==typeof Zg?a=Zg:oi&&(a=function(a){return a?xi(Zg)(a):""})),a}function _(a){var b;return"y"===a?b=mh:"y2"===a?b=vh:"x"===a&&(b=hh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?mh=b:"y2"===a?vh=b:"x"===a&&(hh=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Ug?"inner-top":"inner-right")}function eb(){return cb("y",Ug?"inner-right":"inner-top")}function fb(){return cb("y2",Ug?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?If/2:If:b.isBottom?-Kf:b.isMiddle?-Kf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Ug,db())}function ob(){return kb(Ug,eb())}function pb(){return kb(Ug,fb())}function qb(){return lb(!Ug,db())}function rb(){return lb(Ug,eb())}function sb(){return lb(Ug,fb())}function tb(){var a=db();return Ug?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Ug?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Ug?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Ug,db())}function xb(){return mb(Ug,eb())}function yb(){return mb(Ug,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return pf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Ui.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Ui.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Ui.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+o)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Oc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return pf.min(Object.keys(i).map(function(a){return pf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=zc(a),i=Mc(a);if(rg.length>0)for(g=Pc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return pf.max(Object.keys(i).map(function(a){return pf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?th:kh,n="y2"===c?sh:jh,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?uh:lh,r=rd()&&Ug;return 0===l.length?"y2"===c?dg.domain():cg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=sd(o,p),j=$b(cg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&ph&&(f=b(ph.top)?ph.top:e,g=b(ph.bottom)?ph.bottom:e),"y2"===c&&yh&&(f=b(yh.top)?yh.top:e,g=b(yh.bottom)?yh.bottom:e),Wd(l)&&!Oc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Zi),c=$b(bg.domain());return a||0===c?1:b/c}function Wb(a){return eh?eh:pf.min(a,function(a){return pf.min(a.values,function(a){return a.x})})}function Xb(a){return dh?dh:pf.max(a,function(a){return pf.max(a.values,function(a){return a.x})})}function Yb(a,c){var d,e,f,g,h=c[0],i=c[1],j=Math.abs(h-i);return pi?e=0:Wd(a)?(d=xc(),e=d>1?j/(d-1)/2:.5):e=.01*j,"object"==typeof fh&&qe(fh)?(f=b(fh.left)?fh.left:e,g=b(fh.right)?fh.right:e):f=g="number"==typeof fh?fh:e,{left:f,right:g}}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=0,g=0;return(c||0===c)&&(f=oi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=oi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bb?0:b-c}function fc(a){var b,c=dc(a),d="y"===a.axis?cg:dg;return b="y"===a.axis||"y2"===a.axis?Ug?Kf:"start"in a?d(a.start):Kf:Ug?"end"in a?bg(oi?le(a.end):a.end):Kf:Kf,c>b?0:b-c}function gc(a){return lg&&a===lg||qe(mg)&&re(mg,a)}function hc(a){return!gc(a)}function ic(a){return lg?lg:qe(mg)?mg[a]:null}function jc(a,b){var c,d=b&&qe(b)?zc(b):[];return d.forEach(function(b){ic(b)===a&&(c=qf.data.xs[b])}),c}function kc(a,b){return a in qf.data.xs&&qf.data.xs[a]&&qf.data.xs[a][b]?qf.data.xs[a][b]:b}function lc(a){Object.keys(a).forEach(function(b){mg[b]=a[b]})}function mc(a){return 1===pf.set(Object.keys(a).map(function(b){return a[b]})).size()}function nc(a){var b;return a&&(b=pg[a.id],a.name=b?b:a.id),a}function oc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=qc(b[d],a.id,d)}),qf.data.xs[a.id]=b})}function pc(a,b){a.forEach(function(a){b[a.id]&&oc([a],b[a.id])})}function qc(a,b,c){var d;return d=oi?a?a instanceof Date?a:le(a):le(kc(b,c)):qi&&!pi?a?+a:kc(b,c):c}function rc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?qf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):lg?(d=Object.keys(qf.data.xs),qf.data.xs[c]=d.length>0?qf.data.xs[d[0]]:void 0):qe(mg)&&(qf.data.xs[c]=jc(f,qf.data.targets)):qf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!qf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=og(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=ic(b),g=a[f],h=qc(g,b,e);return qi&&pi&&0===c&&g&&(0===e&&(Xg=[]),Xg.push(g)),("undefined"==typeof a[b]||qf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),tg&&Ud(zc(c).filter(function(a){return!(a in ug)}),tg),c.forEach(function(a){ac(a.id_org,a)}),c}function uc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function vc(a){return a>0&&qf.data.targets[0].values[a-1]?qf.data.targets[0].values[a-1].x:void 0}function wc(a){return a1?qf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?qf.data.targets[0]:null,a}function zc(a){return a.map(function(a){return a.id})}function Ac(a){return a?"string"==typeof a?[a]:a:zc(qf.data.targets)}function Bc(a,b){var c,d=zc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(oi?new Date(h):h);i.push(d)}return oi||(i=i.sort(function(a,b){return a-b})),i}function Ic(a){zi=zi.concat(a)}function Jc(a){zi=zi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){Ai=Ai.concat(a)}function Lc(a){Ai=Ai.filter(function(b){return a.indexOf(b)<0})}function Mc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Nc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Pc(a){return Nc(a,function(a){return a>0})}function Qc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(Ad(a,f))),a[g].x&&(e=e.concat(Ad(a,g))),Dd(e,b)):Bd(a,b,f,g)}function Cd(a,b){var c;return c=a.map(function(a){return Bd(a.values,b)}),Dd(c,b)}function Dd(a,b){var c,d;return a.forEach(function(a){var e=se(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Ed(a,b){return pf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Fd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Gd(){return wg&&"desc"===wg.toLowerCase()}function Hd(){return wg&&"asc"===wg.toLowerCase()}function Id(a){var b=Hd(),c=Gd();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof wg&&a.sort(wg),a}function Jd(a,c){var d,e,f,g,h,i,j,k=$d(qf.data.targets),l=k?ud:td,m=a.filter(function(a){return a&&b(a.value)});bi&&0!==m.length&&(Xi.html(ei(a,$(),l,wi)).style("display","block"),d=Xi.property("offsetWidth"),e=Xi.property("offsetHeight"),k?(g=If/2+c[0],i=Kf/2+c[1]+20):(Ug?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=bg(m[0].x)+20):(f=q(),g=f+t()+bg(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Xi.style("top",i+"px").style("left",g+"px"))}function Kd(){Xi.style("display","none")}function Ld(a){var c=a.filter(function(a){return a&&b(a.value)});bi&&(Xd(qf.data.targets)||$d(qf.data.targets)||Ui.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Ug?"y1":"x1",wd).attr(Ug?"y2":"x2",wd))}function Md(){Ui.select("line."+f.xgridFocus).style("visibility","hidden")}function Nd(a){return a.x||0===a.x?bg(a.x):null}function Od(a){return V(a.id)(a.value)}function Pd(){var a,b,d={},e=0;return Fc(Cc(be)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Td(a,b){return Nh?Nh:b?2*a.tickOffset()*Oh/b:0}function Ud(a,b){Ac(a).forEach(function(a){_i[a]=b===ug[a],ug[a]=b})}function Vd(a,b){var c=!1;return a.forEach(function(a){ug[a.id]===b&&(c=!0),a.id in ug||"line"!==b||(c=!0)}),c}function Wd(a){return Vd(a,"bar")}function Xd(a){return Vd(a,"scatter")}function Yd(a){return Vd(a,"pie")}function Zd(a){return Vd(a,"donut")}function $d(a){return Yd(a)||Zd(a)}function _d(a){var b="string"==typeof a?a:a.id;return!(b in ug)||"line"===ug[b]||"spline"===ug[b]||"area"===ug[b]||"area-spline"===ug[b]}function ae(a){var b="string"==typeof a?a:a.id;return"spline"===ug[b]||"area-spline"===ug[b]}function be(a){var b="string"==typeof a?a:a.id;return"bar"===ug[b]}function ce(a){var b="string"==typeof a?a:a.id;return"scatter"===ug[b]}function de(a){var b="string"==typeof a?a:a.id;return"pie"===ug[b]}function ee(a){var b="string"==typeof a?a:a.id;return"donut"===ug[b]}function fe(a){return de(a)||ee(a)}function ge(a){return be(a)?a.values:[]}function he(a){return _d(a)||ce(a)?a.values:[]}function ie(a){return be(a)||_d(a)?a.values:[]}function je(a){return ee(a)&&Xh||de(a)&&Rh}function ke(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function le(b){var c;try{c=ng?pf.time.format(ng).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ng)}return c}function me(a,b){var c=pf.mouse(a),d=pf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function re(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function se(a,b){var c="y"===Z(a.id)?cg:dg,d=Ug?1:0,e=Ug?0:1;return Math.pow(bg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function te(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function ue(a,b,c){Hg(b,a.node()),Ui.select("."+f.selectedCircles+id(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Rc(f.selectedCircle,c)}).attr("cx",Ug?Od:Nd).attr("cy",Ug?Nd:Od).attr("stroke",function(){return wi(b)}).attr("r",1.4*Lh).transition().duration(100).attr("r",Lh)}function ve(a,b,c){Ig(b,a.node()),Ui.select("."+f.selectedCircles+id(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a,b){Hg(b,a.node()),a.transition().duration(100).style("fill",function(){return pf.rgb(wi(b)).darker(1)})}function ye(a,b){Ig(b,a.node()),a.transition().duration(100).style("fill",function(){return wi(b)})}function ze(a,b,c,d){a?xe(b,c,d):ye(b,c,d)}function Ae(a){return a.filter(function(a){return b(a.value)})}function Be(a,c){return(c?Ui.selectAll("."+f.circles+id(c)):Ui).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ce(a,b){Be(a,b).classed(f.EXPANDED,!0).attr("r",Kh)}function De(a){Be(a).filter(function(){return pf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Hh)}function Ee(a){return Ui.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Fe(a){Ee(a).classed(f.EXPANDED,!0)}function Ge(a){Ee(a).classed(f.EXPANDED,!1)}function He(a,b){var c=Le(a,b);return function(a,b){var d=c(a,b),e=Ug?1:0,f=Ug?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function Ie(a,b){var c=Le(a,!1),d=b?Je:Ke;return function(a,b){return d(c(a,b),a,this)}}function Je(a,b){var c;return Ug?(c=be(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ke(a,b,c){var d=c.getBoundingClientRect();return Ug?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:be(b)?-3:-6)}function Le(a,b){var c=a.__max__+1,d=Td(hg,c),e=Qd(d,c,a,!!b),f=Rd(!!b),g=Sd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Ug&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Me(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function Ne(b){var c,d,e;if(Yi=pf.select(sf),Yi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Yi.html(""),Yi.classed("c3",!0),qf.data.xs={},qf.data.targets=tc(b),n(),R(),bg.domain(pf.extent(Zb(qf.data.targets))),cg.domain(Ub(qf.data.targets,"y")),dg.domain(Ub(qf.data.targets,"y2")),eg.domain(bg.domain()),fg.domain(cg.domain()),gg.domain(dg.domain()),Zi=bg.domain(),Ni.scale(eg),xf&&Ri.scale(bg),Si=Yi.append("svg").attr("width",If+Ff.left+Ff.right).attr("height",Kf+Ff.top+Ff.bottom).on("mouseenter",Af).on("mouseleave",Bf),Ti=Si.append("defs"),Ti.append("clipPath").attr("id",ii).append("rect").attr("width",If).attr("height",Kf),Ti.append("clipPath").attr("id",ji).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Ti.append("clipPath").attr("id",ki).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Ui=Si.append("g").attr("transform",Fi.main),Vi=Lg?Si.append("g").attr("transform",Fi.context):null,Wi=Si.append("g").attr("transform",Fi.legend),Og||(Wi.style("visibility","hidden"),Ai=zc(qf.data.targets)),Xi=pf.select(sf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),kf(zc(qf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Ui.append("g").attr("class",f.axisX).attr("clip-path",mi).attr("transform",Fi.x).append("text").attr("class",f.axisXLabel).attr("transform",Ug?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),ih&&Ui.append("g").attr("class",f.axisY).attr("clip-path",ni).attr("transform",Fi.y).append("text").attr("class",f.axisYLabel).attr("transform",Ug?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),rh&&Ui.append("g").attr("class",f.axisY2).attr("transform",Fi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Ug?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Ui.append("g").attr("clip-path",li).attr("class",f.grid),Ah&&d.append("g").attr("class",f.xgrids),qe(Ch)&&d.append("g").attr("class",f.xgridLines),Ih&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Dh&&d.append("g").attr("class",f.ygrids),qe(Eh)&&d.append("g").attr("class",f.ygridLines),Ui.append("g").attr("clip-path",li).attr("class",f.regions),Ui.append("g").attr("clip-path",li).attr("class",f.chart),c=Ui.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",xf?Ug?"ns-resize":"ew-resize":null),Ui.select("."+f.chart).append("g").attr("class",f.chartBars),Ui.select("."+f.chart).append("g").attr("class",f.chartLines),Ui.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Fi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Ui.select("."+f.chart).append("g").attr("class",f.chartTexts),xf&&Ui.insert("rect",zf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",If).attr("height",Kf).style("opacity",0).style("cursor",Ug?"ns-resize":"ew-resize").call(Ri).on("dblclick.zoom",null),gh&&Ni.extent("function"!=typeof gh?gh:gh(Zb())),Lg&&(Vi.append("g").attr("clip-path",li).attr("class",f.chart),Vi.select("."+f.chart).append("g").attr("class",f.chartBars),Vi.select("."+f.chart).append("g").attr("class",f.chartLines),Vi.append("g").attr("clip-path",li).attr("class",f.brush).call(Ni).selectAll("rect").attr(Ug?"width":"height",Ug?Jf:Lf),Vi.append("g").attr("class",f.axisX).attr("transform",Fi.subx).attr("clip-path",Ug?"":mi)),$e(qf.data.targets),Ug?Ui.select("."+f.axisX).style("opacity",0).call(hg):(Ui.select("."+f.axisY).style("opacity",0).call(ig),Ui.select("."+f.axisY2).style("opacity",0).call(jg)),Ue({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),fi){if(oi&&"string"==typeof gi){for(gi=le(gi),e=0;e0){d=[];for(var g in pg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Fd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=ze,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function Se(a){$d(qf.data.targets)||Ag&&(ri=a,Ui.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),si=!0,Jg())}function Te(){$d(qf.data.targets)||Ag&&(Ui.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Ui.selectAll("."+f.shape).classed(f.INCLUDED,!1),si=!1,Kg())}function Ue(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Pd(),U=$d(qf.data.targets),V=Fc(qf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?Ef:0,O=B?N:0,P=C?N:0,H&&Og&&kf(zc(qf.data.targets),a),G&&(bg.domain(pf.extent(Zb(V))),Zi=bg.domain(),xf&&Ri.scale(bg).updateScaleExtent(),eg.domain(bg.domain()),Ni.scale(eg)),F&&(bg.domain(Ni.empty()?Zi:Ni.extent()),xf&&Ri.scale(bg).updateScaleExtent()),cg.domain(Ub(V,"y")),dg.domain(Ub(V,"y2")),Xd(V)||(Q=ch?ch:Hc(Gc(V)),hg.tickValues(Q),kg.tickValues(Q)),c=Ui.select("."+f.axisX).style("opacity",U?0:1),(Ug||D)&&(c=c.transition().duration(P)),c.call(hg),e=Ui.select("."+f.axisY).style("opacity",U?0:1),(!Ug||D)&&(e=e.transition().duration(P)),e.call(ig),Ui.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(jg),F)if($g&&Q){for(R=1;R=0&&pf.select(this).style("display",b%S?"none":"block")})}else pf.selectAll("."+f.axisX+" .tick text").style("display","block");if(I=He(T),K=Ie(T,!0),M=Ie(T,!1),Ab(),fg.domain(cg.domain()),gg.domain(dg.domain()),Xi.style("display","none"),o(),Ui.select("line."+f.xgridFocus).style("visibility","hidden"),Ah){if("year"===Bh){h=[];for(var W=Zb(),X=W[0].getFullYear(),Y=W[1].getFullYear(),Z=X;Y>=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=bg.ticks(10);g=Ui.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Ug?0:function(a){return bg(a)-hg.tickOffset()}).attr("x2",Ug?If:function(a){return bg(a)-hg.tickOffset()}).attr("y1",Ug?function(a){return bg(a)-hg.tickOffset()}:Ff.top).attr("y2",Ug?function(a){return bg(a)-hg.tickOffset()}:Kf).style("opacity",function(){return+pf.select(this).attr(Ug?"y1":"x1")===(Ug?Kf:0)?0:1}),g.exit().remove()}qe(Ch)&&(i=Ui.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Ch),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Ug?"":"rotate(-90)").attr("dx",Ug?0:-Ff.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Ug?0:xd).attr("x2",Ug?If:xd).attr("y1",Ug?xd:Ff.top).attr("y2",Ug?xd:Kf).style("opacity",1),i.select("text").transition().duration(N).attr("x",Ug?If:0).attr("y",xd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&Dh&&(k=Ui.select("."+f.ygrids).selectAll("."+f.ygrid).data(cg.ticks(Fh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Ug?cg:0).attr("x2",Ug?cg:If).attr("y1",Ug?0:cg).attr("y2",Ug?Kf:cg),k.exit().remove()),y&&qe(Eh)&&(l=Ui.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Eh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Ug?"rotate(-90)":"").attr("dx",Ug?0:-Ff.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Ug?yd:0).attr("x2",Ug?yd:If).attr("y1",Ug?0:yd).attr("y2",Ug?Kf:yd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Ug?0:If).attr("y",yd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Ui.selectAll("."+f.bars).selectAll("."+f.bar).data(ge),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return wi(a)}).attr("class",Zc),p.style("opacity",nd).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Ui.selectAll("."+f.texts).selectAll("."+f.text).data(ie),r.enter().append("text").attr("class",Sc).attr("text-anchor",function(a){return Ug?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return vd(a.id)(a.value)}).style("fill-opacity",od).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",qd),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Ui.selectAll("."+f.line).style("opacity",nd).transition().duration(N).attr("d",Oi).style("opacity",1),Ui.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Pi).style("opacity",$i),n=Ui.selectAll("."+f.circles).selectAll("."+f.circle).data(he),n.enter().append("circle").attr("class",Xc).style("opacity",0).attr("r",Hh),n.style("opacity",nd).transition().duration(N).style("opacity",pd).attr("cx",Ug?Od:Nd).attr("cy",Ug?Nd:Od),n.exit().remove(),Ui.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=pf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Ui.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Dc(a.data.id)&&fe(a.data)?1:0}),Ui.select("."+f.chartArcsTitle).style("opacity",Zd(qf.data.targets)?1:0),Lg&&(null!==pf.event&&"zoom"===pf.event.type&&Ni.extent(bg.orgDomain()).update(),z&&(Vi.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(kg),Ni.empty()||Ni.extent(bg.orgDomain()).update(),J=He(T,!0),s=Vi.selectAll("."+f.bars).selectAll("."+f.bar).data(ge),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return wi(a)}).attr("class",Zc),s.style("opacity",nd).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Vi.selectAll("."+f.line).style("opacity",nd).transition().duration(N).attr("d",Qi).style("opacity",1))),Ui.selectAll("."+f.selectedCircles).filter(function(a){return be(a)}).selectAll("circle").remove(),Ui.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Ug?Od:Nd).attr("cy",Ug?Nd:Od),t=Ui.select("."+f.eventRects),qe(mg)&&!mc(mg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Ui.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Pe(u.enter()),u.attr("x",0).attr("y",0).attr("width",If).attr("height",Kf)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),qi&&!pi?(x=function(a,b){var c=vc(b),d=wc(b),e=qf.data.xs[a.id][b];return(bg(d?d:e+50)-bg(c?c:e-50))/2},w=function(a,b){var c=vc(b),d=qf.data.xs[a.id][b];return(bg(d)+bg(c?c:d-50))/2}):(x=L(),w=function(a){return bg(a.x)-x/2}),v=yc(),Ui.select("."+f.eventRects).datum(v?v.values:[]),u=Ui.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Oe(u.enter()),u.attr("class",cd).attr("x",Ug?0:w).attr("y",Ug?w:0).attr("width",Ug?If:x).attr("height",Ug?x:Kf),u.exit().remove()),q=Ui.select("."+f.regions).selectAll("rect."+f.region).data(ai),q.enter().append("rect").style("fill-opacity",0),q.attr("class",bd).attr("x",cc).attr("y",dc).attr("width",ec).attr("height",fc).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),zc(qf.data.targets).forEach(function(a){_i[a]=!0})}}function Ve(){Ue({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function We(){return"mousemove"===pf.event.sourceEvent.type&&Ri.altDomain?(bg.domain(Ri.altDomain),void Ri.scale(bg).updateScaleExtent()):(pi&&bg.orgDomain()[0]===Zi[0]&&bg.domain([Zi[0]-1e-10,bg.orgDomain()[1]]),Ue({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===pf.event.sourceEvent.type&&(ti=!0)))}function Xe(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ye(){Si.attr("width",Mf).attr("height",Nf),Si.select("#"+ii).select("rect").attr("width",If).attr("height",Kf),Si.select("#"+ji).select("rect").attr("width",H),Si.select("#"+ki).select("rect").attr("width",J),Si.select("."+f.zoomRect).attr("width",If).attr("height",Kf)}function Ze(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Ye(),m(a.withTransition),Ue(a)}function $e(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Ui.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",ed),j=i.enter().append("g").attr("class",ed).style("pointer-events","none"),j.append("g").attr("class",Tc).style("fill",function(a){return wi(a)}),e=Ui.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",gd),d=e.enter().append("g").attr("class",gd).style("pointer-events","none"),d.append("g").attr("class",$c).style("fill",function(a){return wi(a)}).style("stroke","none").style("cursor",function(a){return Cg(a)?"pointer":null}),c=Ui.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",fd),b=c.enter().append("g").attr("class",fd).style("pointer-events","none"),b.append("path").attr("class",Wc).style("opacity",0).style("stroke",function(a){return wi(a)}),b.append("path").attr("class",ad).style("opacity",function(){return $i=+pf.select(this).style("opacity"),0}).style("fill",function(a){return wi(a)}),b.append("g").attr("class",function(a){return Rc(f.selectedCircles,a.id)}),b.append("g").attr("class",Yc).style("fill",function(a){return wi(a)}).style("cursor",function(a){return Cg(a)?"pointer":null}),a.forEach(function(a){Ui.selectAll("."+f.selectedCircles+id(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Ui.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Uf(a)).attr("class",hd),g=h.enter().append("g").attr("class",hd),g.append("path").attr("class",_c).style("opacity",0).style("fill",function(a){return wi(a.data)}).style("cursor",function(a){return Cg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),ef(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Jd(c,pf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),gf(),Kd(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Lg&&(n=Vi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",gd),m=n.enter().append("g").attr("class",gd),m.append("g").attr("class",$c).style("fill",function(a){return wi(a)}),l=Vi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",fd),k=l.enter().append("g").attr("class",fd),k.append("path").attr("class",Wc).style("opacity",0).style("stroke",function(a){return wi(a)})),Si.selectAll("."+f.target).filter(function(a){return Dc(a.id)}).transition().style("opacity",1)}function _e(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Ud(a.id,b.types[a.id]):Ud(a.id,b.type)}),qf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Gi?j:i,l=Gi?Q():P();return d&&(w=0,C=0,t=0,u=0),Og&&!Ec(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Gi?u:t,void(Tg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,Gi?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Wi.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Rc(f.legendItem,a)}).style("visibility",function(a){return Ec(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Qg?Qg(a):qf.toggle(a)}).on("mouseover",function(a){qf.focus(a),"function"==typeof Rg&&Rg(a)}).on("mouseout",function(a){qf.revert(),"function"==typeof Sg&&Sg(a)}),l.append("text").text(function(a){return d(pg[a])?pg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",Gi?g:-200).attr("y",Gi?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Gi?h:-200).attr("y",Gi?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return wi(a)}).attr("x",Gi?g:-200).attr("y",Gi?-200:i).attr("width",10).attr("height",10),Wi.selectAll("text").data(a).text(function(a){return d(pg[a])?pg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Wi.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Wi.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Ye(),q&&m(p)}function lf(a){return Bc(qf.data.targets,a.id)}function mf(a){return"data"in a&&Bc(qf.data.targets,a.data.id)}function nf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function of(a,b,c){var d=!$d(qf.data.targets);Ud(a,b),Ze(c?c:{withTransitionForAxis:d})}var pf=a.d3?a.d3:a.require?a.require("d3"):void 0,qf={data:{},axis:{},legend:{}},rf={},sf=h(["bindto"],"#chart"),tf=h(["size","width"]),uf=h(["size","height"]),vf=h(["padding","left"]),wf=h(["padding","right"]),xf=h(["zoom","enabled"],!1),yf=h(["zoom","extent"]),zf=h(["zoom","privileged"],!1),Af=h(["onenter"],function(){}),Bf=h(["onleave"],function(){}),Cf=h(["onresize"],function(){}),Df=h(["onresized"],function(){}),Ef=h(["transition","duration"],350);g("data","data is required in config");var Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg=h(["data","x"]),mg=h(["data","xs"],{}),ng=h(["data","x_format"]),og=h(["data","id_converter"],function(a){return a}),pg=h(["data","names"],{}),qg=h(["data","classes"],{}),rg=h(["data","groups"],[]),sg=h(["data","axes"],{}),tg=h(["data","type"]),ug=h(["data","types"],{}),vg=h(["data","labels"],{}),wg=h(["data","order"]),xg=h(["data","regions"],{}),yg=h(["data","color"]),zg=h(["data","colors"],{}),Ag=h(["data","selection","enabled"],!1),Bg=h(["data","selection","grouped"],!1),Cg=h(["data","selection","isselectable"],function(){return!0}),Dg=h(["data","selection","multiple"],!0),Eg=h(["data","onclick"],function(){}),Fg=h(["data","onenter"],function(){}),Gg=h(["data","onleave"],function(){}),Hg=h(["data","onselected"],function(){}),Ig=h(["data","onunselected"],function(){}),Jg=h(["data","ondragstart"],function(){}),Kg=h(["data","ondragend"],function(){}),Lg=h(["subchart","show"],!1),Mg=Lg?h(["subchart","size","height"],60):0,Ng=h(["color","pattern"],[]),Og=h(["legend","show"],!0),Pg=h(["legend","position"],"bottom"),Qg=h(["legend","item","onclick"]),Rg=h(["legend","item","onmouseover"]),Sg=h(["legend","item","onmouseout"]),Tg=h(["legend","equally"],!1),Ug=h(["axis","rotated"],!1),Vg=h(["axis","x","type"],"indexed"),Wg=h(["axis","x","localtime"],!0),Xg=h(["axis","x","categories"],[]),Yg=h(["axis","x","tick","centered"],!1),Zg=h(["axis","x","tick","format"]),$g=h(["axis","x","tick","culling"],{}),_g=h(["axis","x","tick","culling","max"],10),ah=h(["axis","x","tick","count"]),bh=h(["axis","x","tick","fit"],!1),ch=h(["axis","x","tick","values"],null),dh=h(["axis","x","max"]),eh=h(["axis","x","min"]),fh=h(["axis","x","padding"],{}),gh=h(["axis","x","default"]),hh=h(["axis","x","label"],{}),ih=h(["axis","y","show"],!0),jh=h(["axis","y","max"]),kh=h(["axis","y","min"]),lh=h(["axis","y","center"]),mh=h(["axis","y","label"],{}),nh=h(["axis","y","inner"],!1),oh=h(["axis","y","tick","format"]),ph=h(["axis","y","padding"],{}),qh=h(["axis","y","ticks"],10),rh=h(["axis","y2","show"],!1),sh=h(["axis","y2","max"]),th=h(["axis","y2","min"]),uh=h(["axis","y2","center"]),vh=h(["axis","y2","label"],{}),wh=h(["axis","y2","inner"],!1),xh=h(["axis","y2","tick","format"]),yh=h(["axis","y2","padding"],{}),zh=h(["axis","y2","ticks"],10),Ah=h(["grid","x","show"],!1),Bh=h(["grid","x","type"],"tick"),Ch=h(["grid","x","lines"],[]),Dh=h(["grid","y","show"],!1),Eh=h(["grid","y","lines"],[]),Fh=h(["grid","y","ticks"],10),Gh=h(["point","show"],!0),Hh=Gh?h(["point","r"],2.5):0,Ih=h(["point","focus","line","enabled"],!0),Jh=h(["point","focus","expand","enabled"],!0),Kh=h(["point","focus","expand","r"],Jh?4:Hh),Lh=h(["point","focus","select","r"],8),Mh=h(["line","connect_null"],!1),Nh=h(["bar","width"]),Oh=h(["bar","width","ratio"],.6),Ph=h(["pie","label","show"],!0),Qh=h(["pie","label","format"]),Rh=h(["pie","expand"],!0),Sh=h(["pie","onclick"],function(){}),Th=h(["pie","onmouseover"],function(){}),Uh=h(["pie","onmouseout"],function(){}),Vh=h(["donut","label","show"],!0),Wh=h(["donut","label","format"]),Xh=h(["donut","expand"],!0),Yh=h(["donut","title"],""),Zh=h(["donut","onclick"],function(){}),$h=h(["donut","onmouseover"],function(){}),_h=h(["donut","onmouseout"],function(){}),ai=h(["regions"],[]),bi=h(["tooltip","show"],!0),ci=h(["tooltip","format","title"]),di=h(["tooltip","format","value"]),ei=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ci?ci:b,l=di?di:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),fi=h(["tooltip","init","show"],!1),gi=h(["tooltip","init","x"],0),hi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ii=("string"==typeof sf?sf.replace("#",""):sf.id)+"-clip",ji=ii+"-xaxis",ki=ii+"-yaxis",li=i(ii),mi=i(ji),ni=i(ki),oi="timeseries"===Vg,pi="categorized"===Vg,qi=!oi&&(lg||qe(mg)),ri=null,si=!1,ti=!1,ui=!1,vi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],wi=ke(zg,qe(Ng)?Ng:vi,yg),xi=Wg?pf.time.format:pf.time.format.utc,yi=function(){var a=[[xi("%Y/%-m/%-d"),function(){return!0}],[xi("%-m/%-d"),function(a){return a.getMonth()}],[xi("%-m/%-d"),function(a){return 1!==a.getDate()}],[xi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[xi("%I %p"),function(a){return a.getHours()}],[xi("%I:%M"),function(a){return a.getMinutes()}],[xi(":%S"),function(a){return a.getSeconds()}],[xi(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),zi=[],Ai=[],Bi=Ug?"left":"bottom",Ci=Ug?nh?"top":"bottom":nh?"right":"left",Di=Ug?wh?"bottom":"top":wh?"left":"right",Ei=Ug?"left":"bottom",Fi={main:function(){return"translate("+Ff.left+","+Ff.top+")"},context:function(){return"translate("+Gf.left+","+Gf.top+")"},legend:function(){return"translate("+Hf.left+","+Hf.top+")"},x:function(){return"translate(0,"+(Ug?0:Kf)+")"},y:function(){return"translate(0,"+(Ug?Kf:0)+")"},y2:function(){return"translate("+(Ug?0:If)+","+(Ug?1:0)+")"},subx:function(){return"translate(0,"+(Ug?0:Lf)+")"},arc:function(){return"translate("+If/2+","+Kf/2+")"}},Gi="right"===Pg,Hi=0,Ii=0,Ji=0,Ki=30,Li=30,Mi=5;Uf=pf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Ni,Oi=function(){var a=pf.svg.line().x(Ug?function(a){return V(a.id)(a.value)}:wd).y(Ug?wd:function(a){return V(a.id)(a.value)});return Mh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Mh?Ae(b.values):b.values;return _d(b)?(a.interpolate(ae(b)?"cardinal":"linear"),xg[b.id]?Me(e,bg,V(b.id),xg[b.id]):a(e)):(c=e[0]?bg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ug?"M "+d+" "+c:"M "+c+" "+d)}}(),Pi=function(){var a;return a=Ug?pf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(wd):pf.svg.area().x(wd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ae(b.values);return Vd([b],"area")||Vd([b],"area-spline")?(a.interpolate(ae(b)?"cardinal":"linear"),a(e)):(c=e[0]?bg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ug?"M "+d+" "+c:"M "+c+" "+d)}}(),Qi=function(){var a=pf.svg.line().x(Ug?function(a){return W(a.id)(a.value)}:zd).y(Ug?zd:function(a){return W(a.id)(a.value)});return function(b){var c=Ae(b.values);return _d(b)?a(c):"M "+eg(c[0].x)+" "+W(b.id)(c[0].value)}}(),Ri=function(){};Ni=pf.svg.brush().on("brush",Ve),Ni.update=function(){return Vi&&Vi.select("."+f.brush).call(this),this},Ni.scale=function(a){return Ug?this.y(a):this.x(a)},xf&&(Ri=pf.behavior.zoom().on("zoomstart",function(){Ri.altDomain=pf.event.sourceEvent.altKey?bg.orgDomain():null}).on("zoom",xf?We:null),Ri.scale=function(a){return Ug?this.y(a):this.x(a)},Ri.orgScaleExtent=function(){var a=yf?yf:[1,10];return[a[0],Math.max(xc()/a[1],a[1])]},Ri.updateScaleExtent=function(){var a=$b(bg.orgDomain())/$b(Zi),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Si,Ti,Ui,Vi,Wi,Xi,Yi,Zi,$i,_i={};if(qf.focus=function(a){function b(a){Fc(a).transition().duration(100).style("opacity",1)}var c=Si.selectAll(jd(a)),d=c.filter(lf),e=c.filter(mf);qf.revert(),qf.defocus(),b(d.classed(f.focused,!0)),b(e),$d(qf.data.targets)&&Kb(a,!0),ef(a)},qf.defocus=function(a){function b(a){Fc(a).transition().duration(100).style("opacity",.3)}var c=Si.selectAll(jd(a)),d=c.filter(lf),e=c.filter(mf);qf.revert(),b(d.classed(f.focused,!1)),b(e),$d(qf.data.targets)&&Lb(a),ff(a)},qf.revert=function(a){function b(a){Fc(a).transition().duration(100).style("opacity",1)}var c=Si.selectAll(jd(a)),d=c.filter(lf),e=c.filter(mf);b(d.classed(f.focused,!1)),b(e),$d(qf.data.targets)&&Lb(a),gf()},qf.show=function(a,b){a=Ac(a),b=b||{},Jc(a),Si.selectAll(kd(a)).transition().style("opacity",1),b.withLegend?hf(a):Wi.selectAll(md(a)).classed(f.legendItemHidden,!1),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},qf.hide=function(a,b){a=Ac(a),b=b||{},Ic(a),Si.selectAll(kd(a)).transition().style("opacity",0),b.withLegend?jf(a):Wi.selectAll(md(a)).classed(f.legendItemHidden,!0),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},qf.toggle=function(a){Dc(a)?qf.hide(a):qf.show(a)},qf.unzoom=function(){Ni.clear().update(),Ue({withUpdateXDomain:!0})},qf.load=function(a){return a.xs&&lc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){qg[b]=a.classes[b]}),"categories"in a&&pi&&(Xg=a.categories,hg.categories(Xg)),"cacheIds"in a&&_b(a.cacheIds)?void _e(bc(a.cacheIds),a.done):void("unload"in a?bf(Ac("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){af(a)}):af(a))},qf.unload=function(a){bf(Ac(a),function(){Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},qf.selected=function(a){return pf.merge(Ui.selectAll("."+f.shapes+id(a)).selectAll("."+f.shape).filter(function(){return pf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},qf.select=function(a,b,c){Ag&&Ui.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=pf.select(this),i="circle"===this.nodeName?ue:xe,j="circle"===this.nodeName?ve:ye,k=Bg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Cg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},qf.unselect=function(a,b){Ag&&Ui.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=pf.select(this),g="circle"===this.nodeName?ve:ye,h=Bg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Cg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},qf.toLine=function(a){of(a,"line")},qf.toSpline=function(a){of(a,"spline")},qf.toBar=function(a){of(a,"bar")},qf.toScatter=function(a){of(a,"scatter")},qf.toArea=function(a){of(a,"area")},qf.toAreaSpline=function(a){of(a,"area-spline")},qf.toPie=function(a){of(a,"pie",{withTransform:!0})},qf.toDonut=function(a){of(a,"donut",{withTransform:!0})},qf.groups=function(a){return c(a)?rg:(rg=a,Ue(),rg)},qf.xgrids=function(a){return a?(Ch=a,Ue(),Ch):Ch},qf.xgrids.add=function(a){return a?qf.xgrids(Ch.concat(a)):void 0},qf.xgrids.remove=function(a){var b=nf(a);return qf.xgrids(Ch.filter(b))},qf.ygrids=function(a){return a?(Eh=a,Ue(),Eh):Eh},qf.ygrids.add=function(a){return a?qf.ygrids(Eh.concat(a)):void 0},qf.ygrids.remove=function(a){var b=nf(a);return qf.ygrids(Eh.filter(b))},qf.regions=function(a){return c(a)?ai:(ai=a,Ue(),ai)},qf.regions.add=function(a){return c(a)?ai:(ai=ai.concat(a),Ue(),ai)},qf.regions.remove=function(a,c){var e=[].concat(a); +!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.31"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cIf&&(If=0),0>Kf&&(Kf=0),Gf={top:Ug?Ff.top:Nf-Mg-(Gi?0:a),right:0/0,bottom:20+(Gi?0:a),left:Ug?Ki:Ff.left},Jf=Ug?Ff.left-Ki-Li:If,Lf=Ug?Kf:Nf-Gf.top-Gf.bottom,0>Jf&&(Jf=0),0>Lf&&(Lf=0),Hf={top:Gi?0:Nf-a,right:0/0,bottom:0,left:Gi?Mf-b:0},p(),Gi&&$d(qf.data.targets)&&(Hf.left=If/2+Pf)}function o(){Ui.select("line."+f.xgridFocus).attr("x1",Ug?0:-10).attr("x2",Ug?If:-10).attr("y1",Ug?-10:Ff.top).attr("y2",Ug?-10:Kf)}function p(){Pf=Kf/2,Of=.95*Pf,Qf=Zd(qf.data.targets)?.6*Of:0}function q(){var a=Ug?f.axisX:f.axisY,b=pf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=pf.select(sf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return tf?tf:x()}function s(){var a=uf?uf:y();return a>0?a:320}function t(){return $d(qf.data.targets)?0:vf?vf:Ug||!ih||nh?1:v("y")}function u(){var a=1;return $d(qf.data.targets)?0:wf?wf:Gi?P()+(rh&&!Ug?v("y2"):a):rh?wh||Ug?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||ih?"y2"!==a||rh?(gb(a).isInner?30:40)+("y2"===a?-10:0):Mi:Og&&!Gi?10:1}function x(){return+pf.select(sf).style("width").replace("px","")}function y(){return+pf.select(sf).style("height").replace("px","")}function z(a){return a?-5:-(Ff.left-1)}function A(a){return a?-20:-1}function B(){return z(!Ug)}function C(){return A(!Ug)}function D(){return z(Ug)}function E(){return A(Ug)}function F(a){return a?If+2+4:Ff.left+20}function G(a){return a?80:Kf+2}function H(){return F(!Ug)}function I(){return G(!Ug)}function J(){return F(Ug)}function K(){return G(Ug)}function L(){var a=Ug?Kf:If,b=xc(),c=Vb()*(Wd(qf.data.targets)?(b-(pi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){Hi=a}function N(a){Ii=a}function O(a){Ji=a}function P(){return Og?Gi?Ii*(Hi+1):Mf:0}function Q(){return Og?Gi?Nf:Ji*(Hi+1):0}function R(){var a,b=!bg;Vf=Ug?1:0,Wf=Ug?Kf:If,Xf=Ug?0:Kf,Yf=Ug?If:1,Zf=Vf,$f=Wf,_f=Ug?0:Lf,ag=Ug?Jf:1,bg=T(Vf,Wf,b?void 0:bg.domain(),function(){return hg.tickOffset()}),cg=U(Xf,Yf),dg=U(Xf,Yf),eg=T(Vf,Wf,Zi,function(a){return a%1?0:kg.tickOffset()}),fg=U(_f,ag),gg=U(_f,ag),a=$(),hg=X(bg,Bi,a),kg=X(eg,Ei,a),ig=Y(cg,Ci,oh,qh),jg=Y(dg,Di,xh,zh),b||(Ni.scale(eg),xf&&Ri.scale(bg)),S()}function S(){Rf=Db(),Sf=Eb(),Tf=Eb(.98)}function T(a,b,e,f){var g=(oi?pf.time.scale():pf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),pi){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return pf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?dg:cg}function W(a){return"y2"===Z(a)?gg:fg}function X(a,b,c){var d=(pi?Bb():pf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),pi?(d.tickCentered(Yg),pe($g)&&($g=!1)):d.tickOffset=function(){var a=Ug?Kf:If;return a*Vb()/xc()/2},pi&&d.categories(Xg),d}function Y(a,b,c,d){return pf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in sg?sg[a]:"y"}function $(){var a=oi?yi:pi?Qc:function(a){return 0>a?a.toFixed(0):a};return Zg&&("function"==typeof Zg?a=Zg:oi&&(a=function(a){return a?xi(Zg)(a):""})),a}function _(a){var b;return"y"===a?b=mh:"y2"===a?b=vh:"x"===a&&(b=hh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?mh=b:"y2"===a?vh=b:"x"===a&&(hh=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Ug?"inner-top":"inner-right")}function eb(){return cb("y",Ug?"inner-right":"inner-top")}function fb(){return cb("y2",Ug?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?If/2:If:b.isBottom?-Kf:b.isMiddle?-Kf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Ug,db())}function ob(){return kb(Ug,eb())}function pb(){return kb(Ug,fb())}function qb(){return lb(!Ug,db())}function rb(){return lb(Ug,eb())}function sb(){return lb(Ug,fb())}function tb(){var a=db();return Ug?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Ug?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Ug?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Ug,db())}function xb(){return mb(Ug,eb())}function yb(){return mb(Ug,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return pf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Ui.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Ui.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Ui.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+o)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Oc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return pf.min(Object.keys(i).map(function(a){return pf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=zc(a),i=Mc(a);if(rg.length>0)for(g=Pc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return pf.max(Object.keys(i).map(function(a){return pf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?th:kh,n="y2"===c?sh:jh,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?uh:lh,r=rd()&&Ug;return 0===l.length?"y2"===c?dg.domain():cg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=sd(o,p),j=$b(cg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&ph&&(f=b(ph.top)?ph.top:e,g=b(ph.bottom)?ph.bottom:e),"y2"===c&&yh&&(f=b(yh.top)?yh.top:e,g=b(yh.bottom)?yh.bottom:e),Wd(l)&&!Oc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Zi),c=$b(bg.domain());return a||0===c?1:b/c}function Wb(a){return eh?eh:pf.min(a,function(a){return pf.min(a.values,function(a){return a.x})})}function Xb(a){return dh?dh:pf.max(a,function(a){return pf.max(a.values,function(a){return a.x})})}function Yb(a,c){var d,e,f,g,h=c[0],i=c[1],j=Math.abs(h-i);return pi?e=0:Wd(a)?(d=xc(),e=d>1?j/(d-1)/2:.5):e=.01*j,"object"==typeof fh&&qe(fh)?(f=b(fh.left)?fh.left:e,g=b(fh.right)?fh.right:e):f=g="number"==typeof fh?fh:e,{left:f,right:g}}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=0,g=0;return(c||0===c)&&(f=oi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=oi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bb?0:b-c}function fc(a){var b,c=dc(a),d="y"===a.axis?cg:dg;return b="y"===a.axis||"y2"===a.axis?Ug?Kf:"start"in a?d(a.start):Kf:Ug?"end"in a?bg(oi?le(a.end):a.end):Kf:Kf,c>b?0:b-c}function gc(a){return lg&&a===lg||qe(mg)&&re(mg,a)}function hc(a){return!gc(a)}function ic(a){return lg?lg:qe(mg)?mg[a]:null}function jc(a,b){var c,d=b&&qe(b)?zc(b):[];return d.forEach(function(b){ic(b)===a&&(c=qf.data.xs[b])}),c}function kc(a,b){return a in qf.data.xs&&qf.data.xs[a]&&qf.data.xs[a][b]?qf.data.xs[a][b]:b}function lc(a){Object.keys(a).forEach(function(b){mg[b]=a[b]})}function mc(a){return 1===pf.set(Object.keys(a).map(function(b){return a[b]})).size()}function nc(a){var b;return a&&(b=pg[a.id],a.name=b?b:a.id),a}function oc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=qc(b[d],a.id,d)}),qf.data.xs[a.id]=b})}function pc(a,b){a.forEach(function(a){b[a.id]&&oc([a],b[a.id])})}function qc(a,b,c){var d;return d=oi?a?a instanceof Date?a:le(a):le(kc(b,c)):qi&&!pi?a?+a:kc(b,c):c}function rc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?qf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):lg?(d=Object.keys(qf.data.xs),qf.data.xs[c]=d.length>0?qf.data.xs[d[0]]:void 0):qe(mg)&&(qf.data.xs[c]=jc(f,qf.data.targets)):qf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!qf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=og(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=ic(b),g=a[f],h=qc(g,b,e);return qi&&pi&&0===c&&g&&(0===e&&(Xg=[]),Xg.push(g)),("undefined"==typeof a[b]||qf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),tg&&Ud(zc(c).filter(function(a){return!(a in ug)}),tg),c.forEach(function(a){ac(a.id_org,a)}),c}function uc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function vc(a){return a>0&&qf.data.targets[0].values[a-1]?qf.data.targets[0].values[a-1].x:void 0}function wc(a){return a1?qf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?qf.data.targets[0]:null,a}function zc(a){return a.map(function(a){return a.id})}function Ac(a){return a?"string"==typeof a?[a]:a:zc(qf.data.targets)}function Bc(a,b){var c,d=zc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(oi?new Date(h):h);i.push(d)}return oi||(i=i.sort(function(a,b){return a-b})),i}function Ic(a){zi=zi.concat(a)}function Jc(a){zi=zi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){Ai=Ai.concat(a)}function Lc(a){Ai=Ai.filter(function(b){return a.indexOf(b)<0})}function Mc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Nc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Pc(a){return Nc(a,function(a){return a>0})}function Qc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(Ad(a,f))),a[g].x&&(e=e.concat(Ad(a,g))),Dd(e,b)):Bd(a,b,f,g)}function Cd(a,b){var c;return c=a.map(function(a){return Bd(a.values,b)}),Dd(c,b)}function Dd(a,b){var c,d;return a.forEach(function(a){var e=se(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Ed(a,b){return pf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Fd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Gd(){return wg&&"desc"===wg.toLowerCase()}function Hd(){return wg&&"asc"===wg.toLowerCase()}function Id(a){var b=Hd(),c=Gd();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof wg&&a.sort(wg),a}function Jd(a,c){var d,e,f,g,h,i,j,k=$d(qf.data.targets),l=k?ud:td,m=a.filter(function(a){return a&&b(a.value)});bi&&0!==m.length&&(Xi.html(ei(a,$(),l,wi)).style("display","block"),d=Xi.property("offsetWidth"),e=Xi.property("offsetHeight"),k?(g=If/2+c[0],i=Kf/2+c[1]+20):(Ug?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=bg(m[0].x)+20):(f=q(),g=f+t()+bg(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Xi.style("top",i+"px").style("left",g+"px"))}function Kd(){Xi.style("display","none")}function Ld(a){var c=a.filter(function(a){return a&&b(a.value)});bi&&(Xd(qf.data.targets)||$d(qf.data.targets)||Ui.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Ug?"y1":"x1",wd).attr(Ug?"y2":"x2",wd))}function Md(){Ui.select("line."+f.xgridFocus).style("visibility","hidden")}function Nd(a){return a.x||0===a.x?bg(a.x):null}function Od(a){return V(a.id)(a.value)}function Pd(){var a,b,d={},e=0;return Fc(Cc(be)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Td(a,b){return Nh?Nh:b?2*a.tickOffset()*Oh/b:0}function Ud(a,b){Ac(a).forEach(function(a){_i[a]=b===ug[a],ug[a]=b})}function Vd(a,b){var c=!1;return a.forEach(function(a){ug[a.id]===b&&(c=!0),a.id in ug||"line"!==b||(c=!0)}),c}function Wd(a){return Vd(a,"bar")}function Xd(a){return Vd(a,"scatter")}function Yd(a){return Vd(a,"pie")}function Zd(a){return Vd(a,"donut")}function $d(a){return Yd(a)||Zd(a)}function _d(a){var b="string"==typeof a?a:a.id;return!(b in ug)||"line"===ug[b]||"spline"===ug[b]||"area"===ug[b]||"area-spline"===ug[b]}function ae(a){var b="string"==typeof a?a:a.id;return"spline"===ug[b]||"area-spline"===ug[b]}function be(a){var b="string"==typeof a?a:a.id;return"bar"===ug[b]}function ce(a){var b="string"==typeof a?a:a.id;return"scatter"===ug[b]}function de(a){var b="string"==typeof a?a:a.id;return"pie"===ug[b]}function ee(a){var b="string"==typeof a?a:a.id;return"donut"===ug[b]}function fe(a){return de(a)||ee(a)}function ge(a){return be(a)?a.values:[]}function he(a){return _d(a)||ce(a)?a.values:[]}function ie(a){return be(a)||_d(a)?a.values:[]}function je(a){return ee(a)&&Xh||de(a)&&Rh}function ke(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function le(b){var c;try{c=ng?pf.time.format(ng).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ng)}return c}function me(a,b){var c=pf.mouse(a),d=pf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function re(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function se(a,b){var c="y"===Z(a.id)?cg:dg,d=Ug?1:0,e=Ug?0:1;return Math.pow(bg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function te(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function ue(a,b,c){Hg(b,a.node()),Ui.select("."+f.selectedCircles+id(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Rc(f.selectedCircle,c)}).attr("cx",Ug?Od:Nd).attr("cy",Ug?Nd:Od).attr("stroke",function(){return wi(b)}).attr("r",1.4*Lh).transition().duration(100).attr("r",Lh)}function ve(a,b,c){Ig(b,a.node()),Ui.select("."+f.selectedCircles+id(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a,b){Hg(b,a.node()),a.transition().duration(100).style("fill",function(){return pf.rgb(wi(b)).darker(1)})}function ye(a,b){Ig(b,a.node()),a.transition().duration(100).style("fill",function(){return wi(b)})}function ze(a,b,c,d){a?xe(b,c,d):ye(b,c,d)}function Ae(a){return a.filter(function(a){return b(a.value)})}function Be(a,c){return(c?Ui.selectAll("."+f.circles+id(c)):Ui).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ce(a,b){Be(a,b).classed(f.EXPANDED,!0).attr("r",Kh)}function De(a){Be(a).filter(function(){return pf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Hh)}function Ee(a){return Ui.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Fe(a){Ee(a).classed(f.EXPANDED,!0)}function Ge(a){Ee(a).classed(f.EXPANDED,!1)}function He(a,b){var c=Le(a,b);return function(a,b){var d=c(a,b),e=Ug?1:0,f=Ug?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function Ie(a,b){var c=Le(a,!1),d=b?Je:Ke;return function(a,b){return d(c(a,b),a,this)}}function Je(a,b){var c;return Ug?(c=be(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ke(a,b,c){var d=c.getBoundingClientRect();return Ug?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:be(b)?-3:-6)}function Le(a,b){var c=a.__max__+1,d=Td(hg,c),e=Qd(d,c,a,!!b),f=Rd(!!b),g=Sd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Ug&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Me(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function Ne(b){var c,d,e;if(Yi=pf.select(sf),Yi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Yi.html(""),Yi.classed("c3",!0),qf.data.xs={},qf.data.targets=tc(b),n(),R(),bg.domain(pf.extent(Zb(qf.data.targets))),cg.domain(Ub(qf.data.targets,"y")),dg.domain(Ub(qf.data.targets,"y2")),eg.domain(bg.domain()),fg.domain(cg.domain()),gg.domain(dg.domain()),Zi=bg.domain(),Ni.scale(eg),xf&&Ri.scale(bg),Si=Yi.append("svg").attr("width",If+Ff.left+Ff.right).attr("height",Kf+Ff.top+Ff.bottom).on("mouseenter",Af).on("mouseleave",Bf),Ti=Si.append("defs"),Ti.append("clipPath").attr("id",ii).append("rect").attr("width",If).attr("height",Kf),Ti.append("clipPath").attr("id",ji).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Ti.append("clipPath").attr("id",ki).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Ui=Si.append("g").attr("transform",Fi.main),Vi=Lg?Si.append("g").attr("transform",Fi.context):null,Wi=Si.append("g").attr("transform",Fi.legend),Og||(Wi.style("visibility","hidden"),Ai=zc(qf.data.targets)),Xi=pf.select(sf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),kf(zc(qf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Ui.append("g").attr("class",f.axisX).attr("clip-path",mi).attr("transform",Fi.x).append("text").attr("class",f.axisXLabel).attr("transform",Ug?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),ih&&Ui.append("g").attr("class",f.axisY).attr("clip-path",ni).attr("transform",Fi.y).append("text").attr("class",f.axisYLabel).attr("transform",Ug?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),rh&&Ui.append("g").attr("class",f.axisY2).attr("transform",Fi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Ug?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Ui.append("g").attr("clip-path",li).attr("class",f.grid),Ah&&d.append("g").attr("class",f.xgrids),qe(Ch)&&d.append("g").attr("class",f.xgridLines),Ih&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Dh&&d.append("g").attr("class",f.ygrids),qe(Eh)&&d.append("g").attr("class",f.ygridLines),Ui.append("g").attr("clip-path",li).attr("class",f.regions),Ui.append("g").attr("clip-path",li).attr("class",f.chart),c=Ui.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",xf?Ug?"ns-resize":"ew-resize":null),Ui.select("."+f.chart).append("g").attr("class",f.chartBars),Ui.select("."+f.chart).append("g").attr("class",f.chartLines),Ui.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Fi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Ui.select("."+f.chart).append("g").attr("class",f.chartTexts),xf&&Ui.insert("rect",zf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",If).attr("height",Kf).style("opacity",0).style("cursor",Ug?"ns-resize":"ew-resize").call(Ri).on("dblclick.zoom",null),gh&&Ni.extent("function"!=typeof gh?gh:gh(Zb())),Lg&&(Vi.append("g").attr("clip-path",li).attr("class",f.chart),Vi.select("."+f.chart).append("g").attr("class",f.chartBars),Vi.select("."+f.chart).append("g").attr("class",f.chartLines),Vi.append("g").attr("clip-path",li).attr("class",f.brush).call(Ni).selectAll("rect").attr(Ug?"width":"height",Ug?Jf:Lf),Vi.append("g").attr("class",f.axisX).attr("transform",Fi.subx).attr("clip-path",Ug?"":mi)),$e(qf.data.targets),Ug?Ui.select("."+f.axisX).style("opacity",0).call(hg):(Ui.select("."+f.axisY).style("opacity",0).call(ig),Ui.select("."+f.axisY2).style("opacity",0).call(jg)),Ue({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),fi){if(oi&&"string"==typeof gi){for(gi=le(gi),e=0;e0){d=[];for(var g in pg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Fd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=ze,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function Se(a){$d(qf.data.targets)||Ag&&(ri=a,Ui.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),si=!0,Jg())}function Te(){$d(qf.data.targets)||Ag&&(Ui.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Ui.selectAll("."+f.shape).classed(f.INCLUDED,!1),si=!1,Kg())}function Ue(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Pd(),U=$d(qf.data.targets),V=Fc(qf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?Ef:0,O=B?N:0,P=C?N:0,H&&Og&&kf(zc(qf.data.targets),a),G&&(bg.domain(pf.extent(Zb(V))),Zi=bg.domain(),xf&&Ri.scale(bg).updateScaleExtent(),eg.domain(bg.domain()),Ni.scale(eg)),F&&(bg.domain(Ni.empty()?Zi:Ni.extent()),xf&&Ri.scale(bg).updateScaleExtent()),cg.domain(Ub(V,"y")),dg.domain(Ub(V,"y2")),(bh||ah)&&(Q=ch?ch:Hc(Gc(V)),hg.tickValues(Q),kg.tickValues(Q)),c=Ui.select("."+f.axisX).style("opacity",U?0:1),(Ug||D)&&(c=c.transition().duration(P)),c.call(hg),e=Ui.select("."+f.axisY).style("opacity",U?0:1),(!Ug||D)&&(e=e.transition().duration(P)),e.call(ig),Ui.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(jg),F)if($g&&Q){for(R=1;R=0&&pf.select(this).style("display",b%S?"none":"block")})}else pf.selectAll("."+f.axisX+" .tick text").style("display","block");if(I=He(T),K=Ie(T,!0),M=Ie(T,!1),Ab(),fg.domain(cg.domain()),gg.domain(dg.domain()),Xi.style("display","none"),o(),Ui.select("line."+f.xgridFocus).style("visibility","hidden"),Ah){if("year"===Bh){h=[];for(var W=Zb(),X=W[0].getFullYear(),Y=W[1].getFullYear(),Z=X;Y>=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=bg.ticks(10);g=Ui.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Ug?0:function(a){return bg(a)-hg.tickOffset()}).attr("x2",Ug?If:function(a){return bg(a)-hg.tickOffset()}).attr("y1",Ug?function(a){return bg(a)-hg.tickOffset()}:Ff.top).attr("y2",Ug?function(a){return bg(a)-hg.tickOffset()}:Kf).style("opacity",function(){return+pf.select(this).attr(Ug?"y1":"x1")===(Ug?Kf:0)?0:1}),g.exit().remove()}qe(Ch)&&(i=Ui.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Ch),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Ug?"":"rotate(-90)").attr("dx",Ug?0:-Ff.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Ug?0:xd).attr("x2",Ug?If:xd).attr("y1",Ug?xd:Ff.top).attr("y2",Ug?xd:Kf).style("opacity",1),i.select("text").transition().duration(N).attr("x",Ug?If:0).attr("y",xd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&Dh&&(k=Ui.select("."+f.ygrids).selectAll("."+f.ygrid).data(cg.ticks(Fh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Ug?cg:0).attr("x2",Ug?cg:If).attr("y1",Ug?0:cg).attr("y2",Ug?Kf:cg),k.exit().remove()),y&&qe(Eh)&&(l=Ui.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Eh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Ug?"rotate(-90)":"").attr("dx",Ug?0:-Ff.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Ug?yd:0).attr("x2",Ug?yd:If).attr("y1",Ug?0:yd).attr("y2",Ug?Kf:yd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Ug?0:If).attr("y",yd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Ui.selectAll("."+f.bars).selectAll("."+f.bar).data(ge),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return wi(a)}).attr("class",Zc),p.style("opacity",nd).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Ui.selectAll("."+f.texts).selectAll("."+f.text).data(ie),r.enter().append("text").attr("class",Sc).attr("text-anchor",function(a){return Ug?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return vd(a.id)(a.value)}).style("fill-opacity",od).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",qd),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Ui.selectAll("."+f.line).style("opacity",nd).transition().duration(N).attr("d",Oi).style("opacity",1),Ui.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Pi).style("opacity",$i),n=Ui.selectAll("."+f.circles).selectAll("."+f.circle).data(he),n.enter().append("circle").attr("class",Xc).style("opacity",0).attr("r",Hh),n.style("opacity",nd).transition().duration(N).style("opacity",pd).attr("cx",Ug?Od:Nd).attr("cy",Ug?Nd:Od),n.exit().remove(),Ui.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=pf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Ui.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Dc(a.data.id)&&fe(a.data)?1:0}),Ui.select("."+f.chartArcsTitle).style("opacity",Zd(qf.data.targets)?1:0),Lg&&(null!==pf.event&&"zoom"===pf.event.type&&Ni.extent(bg.orgDomain()).update(),z&&(Vi.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(kg),Ni.empty()||Ni.extent(bg.orgDomain()).update(),J=He(T,!0),s=Vi.selectAll("."+f.bars).selectAll("."+f.bar).data(ge),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return wi(a)}).attr("class",Zc),s.style("opacity",nd).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Vi.selectAll("."+f.line).style("opacity",nd).transition().duration(N).attr("d",Qi).style("opacity",1))),Ui.selectAll("."+f.selectedCircles).filter(function(a){return be(a)}).selectAll("circle").remove(),Ui.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Ug?Od:Nd).attr("cy",Ug?Nd:Od),t=Ui.select("."+f.eventRects),qe(mg)&&!mc(mg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Ui.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Pe(u.enter()),u.attr("x",0).attr("y",0).attr("width",If).attr("height",Kf)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),qi&&!pi?(x=function(a,b){var c=vc(b),d=wc(b),e=qf.data.xs[a.id][b];return(bg(d?d:e+50)-bg(c?c:e-50))/2},w=function(a,b){var c=vc(b),d=qf.data.xs[a.id][b];return(bg(d)+bg(c?c:d-50))/2}):(x=L(),w=function(a){return bg(a.x)-x/2}),v=yc(),Ui.select("."+f.eventRects).datum(v?v.values:[]),u=Ui.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Oe(u.enter()),u.attr("class",cd).attr("x",Ug?0:w).attr("y",Ug?w:0).attr("width",Ug?If:x).attr("height",Ug?x:Kf),u.exit().remove()),q=Ui.select("."+f.regions).selectAll("rect."+f.region).data(ai),q.enter().append("rect").style("fill-opacity",0),q.attr("class",bd).attr("x",cc).attr("y",dc).attr("width",ec).attr("height",fc).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),zc(qf.data.targets).forEach(function(a){_i[a]=!0})}}function Ve(){Ue({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function We(){return"mousemove"===pf.event.sourceEvent.type&&Ri.altDomain?(bg.domain(Ri.altDomain),void Ri.scale(bg).updateScaleExtent()):(pi&&bg.orgDomain()[0]===Zi[0]&&bg.domain([Zi[0]-1e-10,bg.orgDomain()[1]]),Ue({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===pf.event.sourceEvent.type&&(ti=!0)))}function Xe(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ye(){Si.attr("width",Mf).attr("height",Nf),Si.select("#"+ii).select("rect").attr("width",If).attr("height",Kf),Si.select("#"+ji).select("rect").attr("width",H),Si.select("#"+ki).select("rect").attr("width",J),Si.select("."+f.zoomRect).attr("width",If).attr("height",Kf)}function Ze(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Ye(),m(a.withTransition),Ue(a)}function $e(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Ui.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",ed),j=i.enter().append("g").attr("class",ed).style("pointer-events","none"),j.append("g").attr("class",Tc).style("fill",function(a){return wi(a)}),e=Ui.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",gd),d=e.enter().append("g").attr("class",gd).style("pointer-events","none"),d.append("g").attr("class",$c).style("fill",function(a){return wi(a)}).style("stroke","none").style("cursor",function(a){return Cg(a)?"pointer":null}),c=Ui.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",fd),b=c.enter().append("g").attr("class",fd).style("pointer-events","none"),b.append("path").attr("class",Wc).style("opacity",0).style("stroke",function(a){return wi(a)}),b.append("path").attr("class",ad).style("opacity",function(){return $i=+pf.select(this).style("opacity"),0}).style("fill",function(a){return wi(a)}),b.append("g").attr("class",function(a){return Rc(f.selectedCircles,a.id)}),b.append("g").attr("class",Yc).style("fill",function(a){return wi(a)}).style("cursor",function(a){return Cg(a)?"pointer":null}),a.forEach(function(a){Ui.selectAll("."+f.selectedCircles+id(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Ui.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Uf(a)).attr("class",hd),g=h.enter().append("g").attr("class",hd),g.append("path").attr("class",_c).style("opacity",0).style("fill",function(a){return wi(a.data)}).style("cursor",function(a){return Cg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),ef(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Jd(c,pf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),gf(),Kd(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Lg&&(n=Vi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",gd),m=n.enter().append("g").attr("class",gd),m.append("g").attr("class",$c).style("fill",function(a){return wi(a)}),l=Vi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",fd),k=l.enter().append("g").attr("class",fd),k.append("path").attr("class",Wc).style("opacity",0).style("stroke",function(a){return wi(a)})),Si.selectAll("."+f.target).filter(function(a){return Dc(a.id)}).transition().style("opacity",1)}function _e(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Ud(a.id,b.types[a.id]):Ud(a.id,b.type)}),qf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Gi?j:i,l=Gi?Q():P();return d&&(w=0,C=0,t=0,u=0),Og&&!Ec(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Gi?u:t,void(Tg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,Gi?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Wi.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Rc(f.legendItem,a)}).style("visibility",function(a){return Ec(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Qg?Qg(a):qf.toggle(a)}).on("mouseover",function(a){qf.focus(a),"function"==typeof Rg&&Rg(a)}).on("mouseout",function(a){qf.revert(),"function"==typeof Sg&&Sg(a)}),l.append("text").text(function(a){return d(pg[a])?pg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",Gi?g:-200).attr("y",Gi?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Gi?h:-200).attr("y",Gi?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return wi(a)}).attr("x",Gi?g:-200).attr("y",Gi?-200:i).attr("width",10).attr("height",10),Wi.selectAll("text").data(a).text(function(a){return d(pg[a])?pg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Wi.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Wi.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Ye(),q&&m(p)}function lf(a){return Bc(qf.data.targets,a.id)}function mf(a){return"data"in a&&Bc(qf.data.targets,a.data.id)}function nf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function of(a,b,c){var d=!$d(qf.data.targets);Ud(a,b),Ze(c?c:{withTransitionForAxis:d})}var pf=a.d3?a.d3:a.require?a.require("d3"):void 0,qf={data:{},axis:{},legend:{}},rf={},sf=h(["bindto"],"#chart"),tf=h(["size","width"]),uf=h(["size","height"]),vf=h(["padding","left"]),wf=h(["padding","right"]),xf=h(["zoom","enabled"],!1),yf=h(["zoom","extent"]),zf=h(["zoom","privileged"],!1),Af=h(["onenter"],function(){}),Bf=h(["onleave"],function(){}),Cf=h(["onresize"],function(){}),Df=h(["onresized"],function(){}),Ef=h(["transition","duration"],350);g("data","data is required in config");var Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg=h(["data","x"]),mg=h(["data","xs"],{}),ng=h(["data","x_format"]),og=h(["data","id_converter"],function(a){return a}),pg=h(["data","names"],{}),qg=h(["data","classes"],{}),rg=h(["data","groups"],[]),sg=h(["data","axes"],{}),tg=h(["data","type"]),ug=h(["data","types"],{}),vg=h(["data","labels"],{}),wg=h(["data","order"]),xg=h(["data","regions"],{}),yg=h(["data","color"]),zg=h(["data","colors"],{}),Ag=h(["data","selection","enabled"],!1),Bg=h(["data","selection","grouped"],!1),Cg=h(["data","selection","isselectable"],function(){return!0}),Dg=h(["data","selection","multiple"],!0),Eg=h(["data","onclick"],function(){}),Fg=h(["data","onenter"],function(){}),Gg=h(["data","onleave"],function(){}),Hg=h(["data","onselected"],function(){}),Ig=h(["data","onunselected"],function(){}),Jg=h(["data","ondragstart"],function(){}),Kg=h(["data","ondragend"],function(){}),Lg=h(["subchart","show"],!1),Mg=Lg?h(["subchart","size","height"],60):0,Ng=h(["color","pattern"],[]),Og=h(["legend","show"],!0),Pg=h(["legend","position"],"bottom"),Qg=h(["legend","item","onclick"]),Rg=h(["legend","item","onmouseover"]),Sg=h(["legend","item","onmouseout"]),Tg=h(["legend","equally"],!1),Ug=h(["axis","rotated"],!1),Vg=h(["axis","x","type"],"indexed"),Wg=h(["axis","x","localtime"],!0),Xg=h(["axis","x","categories"],[]),Yg=h(["axis","x","tick","centered"],!1),Zg=h(["axis","x","tick","format"]),$g=h(["axis","x","tick","culling"],{}),_g=h(["axis","x","tick","culling","max"],10),ah=h(["axis","x","tick","count"]),bh=h(["axis","x","tick","fit"],!0),ch=h(["axis","x","tick","values"],null),dh=h(["axis","x","max"]),eh=h(["axis","x","min"]),fh=h(["axis","x","padding"],{}),gh=h(["axis","x","default"]),hh=h(["axis","x","label"],{}),ih=h(["axis","y","show"],!0),jh=h(["axis","y","max"]),kh=h(["axis","y","min"]),lh=h(["axis","y","center"]),mh=h(["axis","y","label"],{}),nh=h(["axis","y","inner"],!1),oh=h(["axis","y","tick","format"]),ph=h(["axis","y","padding"],{}),qh=h(["axis","y","ticks"],10),rh=h(["axis","y2","show"],!1),sh=h(["axis","y2","max"]),th=h(["axis","y2","min"]),uh=h(["axis","y2","center"]),vh=h(["axis","y2","label"],{}),wh=h(["axis","y2","inner"],!1),xh=h(["axis","y2","tick","format"]),yh=h(["axis","y2","padding"],{}),zh=h(["axis","y2","ticks"],10),Ah=h(["grid","x","show"],!1),Bh=h(["grid","x","type"],"tick"),Ch=h(["grid","x","lines"],[]),Dh=h(["grid","y","show"],!1),Eh=h(["grid","y","lines"],[]),Fh=h(["grid","y","ticks"],10),Gh=h(["point","show"],!0),Hh=Gh?h(["point","r"],2.5):0,Ih=h(["point","focus","line","enabled"],!0),Jh=h(["point","focus","expand","enabled"],!0),Kh=h(["point","focus","expand","r"],Jh?4:Hh),Lh=h(["point","focus","select","r"],8),Mh=h(["line","connect_null"],!1),Nh=h(["bar","width"]),Oh=h(["bar","width","ratio"],.6),Ph=h(["pie","label","show"],!0),Qh=h(["pie","label","format"]),Rh=h(["pie","expand"],!0),Sh=h(["pie","onclick"],function(){}),Th=h(["pie","onmouseover"],function(){}),Uh=h(["pie","onmouseout"],function(){}),Vh=h(["donut","label","show"],!0),Wh=h(["donut","label","format"]),Xh=h(["donut","expand"],!0),Yh=h(["donut","title"],""),Zh=h(["donut","onclick"],function(){}),$h=h(["donut","onmouseover"],function(){}),_h=h(["donut","onmouseout"],function(){}),ai=h(["regions"],[]),bi=h(["tooltip","show"],!0),ci=h(["tooltip","format","title"]),di=h(["tooltip","format","value"]),ei=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ci?ci:b,l=di?di:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),fi=h(["tooltip","init","show"],!1),gi=h(["tooltip","init","x"],0),hi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ii=("string"==typeof sf?sf.replace("#",""):sf.id)+"-clip",ji=ii+"-xaxis",ki=ii+"-yaxis",li=i(ii),mi=i(ji),ni=i(ki),oi="timeseries"===Vg,pi="categorized"===Vg,qi=!oi&&(lg||qe(mg)),ri=null,si=!1,ti=!1,ui=!1,vi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],wi=ke(zg,qe(Ng)?Ng:vi,yg),xi=Wg?pf.time.format:pf.time.format.utc,yi=function(){var a=[[xi("%Y/%-m/%-d"),function(){return!0}],[xi("%-m/%-d"),function(a){return a.getMonth()}],[xi("%-m/%-d"),function(a){return 1!==a.getDate()}],[xi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[xi("%I %p"),function(a){return a.getHours()}],[xi("%I:%M"),function(a){return a.getMinutes()}],[xi(":%S"),function(a){return a.getSeconds()}],[xi(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),zi=[],Ai=[],Bi=Ug?"left":"bottom",Ci=Ug?nh?"top":"bottom":nh?"right":"left",Di=Ug?wh?"bottom":"top":wh?"left":"right",Ei=Ug?"left":"bottom",Fi={main:function(){return"translate("+Ff.left+","+Ff.top+")"},context:function(){return"translate("+Gf.left+","+Gf.top+")"},legend:function(){return"translate("+Hf.left+","+Hf.top+")"},x:function(){return"translate(0,"+(Ug?0:Kf)+")"},y:function(){return"translate(0,"+(Ug?Kf:0)+")"},y2:function(){return"translate("+(Ug?0:If)+","+(Ug?1:0)+")"},subx:function(){return"translate(0,"+(Ug?0:Lf)+")"},arc:function(){return"translate("+If/2+","+Kf/2+")"}},Gi="right"===Pg,Hi=0,Ii=0,Ji=0,Ki=30,Li=30,Mi=5;Uf=pf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Ni,Oi=function(){var a=pf.svg.line().x(Ug?function(a){return V(a.id)(a.value)}:wd).y(Ug?wd:function(a){return V(a.id)(a.value)});return Mh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Mh?Ae(b.values):b.values;return _d(b)?(a.interpolate(ae(b)?"cardinal":"linear"),xg[b.id]?Me(e,bg,V(b.id),xg[b.id]):a(e)):(c=e[0]?bg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ug?"M "+d+" "+c:"M "+c+" "+d)}}(),Pi=function(){var a;return a=Ug?pf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(wd):pf.svg.area().x(wd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ae(b.values);return Vd([b],"area")||Vd([b],"area-spline")?(a.interpolate(ae(b)?"cardinal":"linear"),a(e)):(c=e[0]?bg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ug?"M "+d+" "+c:"M "+c+" "+d)}}(),Qi=function(){var a=pf.svg.line().x(Ug?function(a){return W(a.id)(a.value)}:zd).y(Ug?zd:function(a){return W(a.id)(a.value)});return function(b){var c=Ae(b.values);return _d(b)?a(c):"M "+eg(c[0].x)+" "+W(b.id)(c[0].value)}}(),Ri=function(){};Ni=pf.svg.brush().on("brush",Ve),Ni.update=function(){return Vi&&Vi.select("."+f.brush).call(this),this},Ni.scale=function(a){return Ug?this.y(a):this.x(a)},xf&&(Ri=pf.behavior.zoom().on("zoomstart",function(){Ri.altDomain=pf.event.sourceEvent.altKey?bg.orgDomain():null}).on("zoom",xf?We:null),Ri.scale=function(a){return Ug?this.y(a):this.x(a)},Ri.orgScaleExtent=function(){var a=yf?yf:[1,10];return[a[0],Math.max(xc()/a[1],a[1])]},Ri.updateScaleExtent=function(){var a=$b(bg.orgDomain())/$b(Zi),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Si,Ti,Ui,Vi,Wi,Xi,Yi,Zi,$i,_i={};if(qf.focus=function(a){function b(a){Fc(a).transition().duration(100).style("opacity",1)}var c=Si.selectAll(jd(a)),d=c.filter(lf),e=c.filter(mf);qf.revert(),qf.defocus(),b(d.classed(f.focused,!0)),b(e),$d(qf.data.targets)&&Kb(a,!0),ef(a)},qf.defocus=function(a){function b(a){Fc(a).transition().duration(100).style("opacity",.3)}var c=Si.selectAll(jd(a)),d=c.filter(lf),e=c.filter(mf);qf.revert(),b(d.classed(f.focused,!1)),b(e),$d(qf.data.targets)&&Lb(a),ff(a)},qf.revert=function(a){function b(a){Fc(a).transition().duration(100).style("opacity",1)}var c=Si.selectAll(jd(a)),d=c.filter(lf),e=c.filter(mf);b(d.classed(f.focused,!1)),b(e),$d(qf.data.targets)&&Lb(a),gf()},qf.show=function(a,b){a=Ac(a),b=b||{},Jc(a),Si.selectAll(kd(a)).transition().style("opacity",1),b.withLegend?hf(a):Wi.selectAll(md(a)).classed(f.legendItemHidden,!1),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},qf.hide=function(a,b){a=Ac(a),b=b||{},Ic(a),Si.selectAll(kd(a)).transition().style("opacity",0),b.withLegend?jf(a):Wi.selectAll(md(a)).classed(f.legendItemHidden,!0),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},qf.toggle=function(a){Dc(a)?qf.hide(a):qf.show(a)},qf.unzoom=function(){Ni.clear().update(),Ue({withUpdateXDomain:!0})},qf.load=function(a){return a.xs&&lc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){qg[b]=a.classes[b]}),"categories"in a&&pi&&(Xg=a.categories,hg.categories(Xg)),"cacheIds"in a&&_b(a.cacheIds)?void _e(bc(a.cacheIds),a.done):void("unload"in a?bf(Ac("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){af(a)}):af(a))},qf.unload=function(a){bf(Ac(a),function(){Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},qf.selected=function(a){return pf.merge(Ui.selectAll("."+f.shapes+id(a)).selectAll("."+f.shape).filter(function(){return pf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},qf.select=function(a,b,c){Ag&&Ui.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=pf.select(this),i="circle"===this.nodeName?ue:xe,j="circle"===this.nodeName?ve:ye,k=Bg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Cg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},qf.unselect=function(a,b){Ag&&Ui.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=pf.select(this),g="circle"===this.nodeName?ve:ye,h=Bg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Cg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},qf.toLine=function(a){of(a,"line")},qf.toSpline=function(a){of(a,"spline")},qf.toBar=function(a){of(a,"bar")},qf.toScatter=function(a){of(a,"scatter")},qf.toArea=function(a){of(a,"area")},qf.toAreaSpline=function(a){of(a,"area-spline")},qf.toPie=function(a){of(a,"pie",{withTransform:!0})},qf.toDonut=function(a){of(a,"donut",{withTransform:!0})},qf.groups=function(a){return c(a)?rg:(rg=a,Ue(),rg)},qf.xgrids=function(a){return a?(Ch=a,Ue(),Ch):Ch},qf.xgrids.add=function(a){return a?qf.xgrids(Ch.concat(a)):void 0},qf.xgrids.remove=function(a){var b=nf(a);return qf.xgrids(Ch.filter(b))},qf.ygrids=function(a){return a?(Eh=a,Ue(),Eh):Eh},qf.ygrids.add=function(a){return a?qf.ygrids(Eh.concat(a)):void 0},qf.ygrids.remove=function(a){var b=nf(a);return qf.ygrids(Eh.filter(b))},qf.regions=function(a){return c(a)?ai:(ai=a,Ue(),ai)},qf.regions.add=function(a){return c(a)?ai:(ai=ai.concat(a),Ue(),ai)},qf.regions.remove=function(a,c){var e=[].concat(a); return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;Si.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ai=ai.filter(function(b){return b.classes.indexOf(a)<0})}),ai},qf.data.get=function(a){var b=qf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},qf.data.getAsTarget=function(a){var b=Cc(function(b){return b.id===a});return b.length>0?b[0]:void 0},qf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){pg[b]=a[b]}),kf(zc(qf.data.targets),{withTransition:!0}),pg):pg},qf.x=function(a){return arguments.length&&(oc(qf.data.targets,a),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),qf.data.xs},qf.xs=function(a){return arguments.length&&(pc(qf.data.targets,a),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),qf.data.xs},qf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},qf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(jh=+a.y),b(a.y2)&&(sh=+a.y2)):jh=sh=+a,Ue())},qf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(kh=+a.y),b(a.y2)&&(th=+a.y2)):kh=th=+a,Ue())},qf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&qf.axis.max(a.max),"undefined"!=typeof a.min&&qf.axis.min(a.min))},qf.legend.show=function(a){Og||(Og=!0,Wi.style("visibility","visible")),hf(Ac(a)),Ue({withTransitionForHorizontalAxis:!1})},qf.legend.hide=function(a){Og&&pe(a)&&(Og=!1,Wi.style("visibility","hidden")),jf(Ac(a)),Ue({withTransitionForHorizontalAxis:!1})},qf.resize=function(a){tf=a?a.width:null,uf=a?a.height:null,Ze({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},qf.destroy=function(){qf.data.targets=void 0,qf.data.xs={},Yi.html(""),a.onresize=null},"url"in e.data)pf.xhr(e.data.url,function(a,b){var c,d=pf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=pf.csv.parse(b.response),Ne(c)});else if("rows"in e.data)Ne(rc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ne(sc(e.data.columns))}return qf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file diff --git a/htdocs/samples/scatter.html b/htdocs/samples/scatter.html index 4ec7e13..0afe1da 100644 --- a/htdocs/samples/scatter.html +++ b/htdocs/samples/scatter.html @@ -27,7 +27,10 @@ }, axis: { x: { - label: 'Sepal.Width' + label: 'Sepal.Width', + tick: { + fit: false + } }, y: { label: 'Petal.Width' From 0fd30419aad6ce97e0e7b43ae7bd9b595ade4203 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Tue, 22 Apr 2014 20:11:58 +0900 Subject: [PATCH 052/178] Fix tooltip when scatter plot --- c3.js | 6 +++++- c3.min.js | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/c3.js b/c3.js index b1d3ac7..929bb5c 100644 --- a/c3.js +++ b/c3.js @@ -2843,7 +2843,11 @@ mouse = d3.mouse(this); closest = findClosestFromTargets(c3.data.targets, mouse); - sameXData = filterSameX(c3.data.targets, closest.x); + if (isScatterType(closest)) { + sameXData = [closest]; + } else { + sameXData = filterSameX(c3.data.targets, closest.x); + } // show tooltip when cursor is close to some point selectedData = sameXData.map(function (d) { diff --git a/c3.min.js b/c3.min.js index 731b83b..6f35bd9 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ !function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.31"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cIf&&(If=0),0>Kf&&(Kf=0),Gf={top:Ug?Ff.top:Nf-Mg-(Gi?0:a),right:0/0,bottom:20+(Gi?0:a),left:Ug?Ki:Ff.left},Jf=Ug?Ff.left-Ki-Li:If,Lf=Ug?Kf:Nf-Gf.top-Gf.bottom,0>Jf&&(Jf=0),0>Lf&&(Lf=0),Hf={top:Gi?0:Nf-a,right:0/0,bottom:0,left:Gi?Mf-b:0},p(),Gi&&$d(qf.data.targets)&&(Hf.left=If/2+Pf)}function o(){Ui.select("line."+f.xgridFocus).attr("x1",Ug?0:-10).attr("x2",Ug?If:-10).attr("y1",Ug?-10:Ff.top).attr("y2",Ug?-10:Kf)}function p(){Pf=Kf/2,Of=.95*Pf,Qf=Zd(qf.data.targets)?.6*Of:0}function q(){var a=Ug?f.axisX:f.axisY,b=pf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=pf.select(sf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return tf?tf:x()}function s(){var a=uf?uf:y();return a>0?a:320}function t(){return $d(qf.data.targets)?0:vf?vf:Ug||!ih||nh?1:v("y")}function u(){var a=1;return $d(qf.data.targets)?0:wf?wf:Gi?P()+(rh&&!Ug?v("y2"):a):rh?wh||Ug?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||ih?"y2"!==a||rh?(gb(a).isInner?30:40)+("y2"===a?-10:0):Mi:Og&&!Gi?10:1}function x(){return+pf.select(sf).style("width").replace("px","")}function y(){return+pf.select(sf).style("height").replace("px","")}function z(a){return a?-5:-(Ff.left-1)}function A(a){return a?-20:-1}function B(){return z(!Ug)}function C(){return A(!Ug)}function D(){return z(Ug)}function E(){return A(Ug)}function F(a){return a?If+2+4:Ff.left+20}function G(a){return a?80:Kf+2}function H(){return F(!Ug)}function I(){return G(!Ug)}function J(){return F(Ug)}function K(){return G(Ug)}function L(){var a=Ug?Kf:If,b=xc(),c=Vb()*(Wd(qf.data.targets)?(b-(pi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){Hi=a}function N(a){Ii=a}function O(a){Ji=a}function P(){return Og?Gi?Ii*(Hi+1):Mf:0}function Q(){return Og?Gi?Nf:Ji*(Hi+1):0}function R(){var a,b=!bg;Vf=Ug?1:0,Wf=Ug?Kf:If,Xf=Ug?0:Kf,Yf=Ug?If:1,Zf=Vf,$f=Wf,_f=Ug?0:Lf,ag=Ug?Jf:1,bg=T(Vf,Wf,b?void 0:bg.domain(),function(){return hg.tickOffset()}),cg=U(Xf,Yf),dg=U(Xf,Yf),eg=T(Vf,Wf,Zi,function(a){return a%1?0:kg.tickOffset()}),fg=U(_f,ag),gg=U(_f,ag),a=$(),hg=X(bg,Bi,a),kg=X(eg,Ei,a),ig=Y(cg,Ci,oh,qh),jg=Y(dg,Di,xh,zh),b||(Ni.scale(eg),xf&&Ri.scale(bg)),S()}function S(){Rf=Db(),Sf=Eb(),Tf=Eb(.98)}function T(a,b,e,f){var g=(oi?pf.time.scale():pf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),pi){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return pf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?dg:cg}function W(a){return"y2"===Z(a)?gg:fg}function X(a,b,c){var d=(pi?Bb():pf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),pi?(d.tickCentered(Yg),pe($g)&&($g=!1)):d.tickOffset=function(){var a=Ug?Kf:If;return a*Vb()/xc()/2},pi&&d.categories(Xg),d}function Y(a,b,c,d){return pf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in sg?sg[a]:"y"}function $(){var a=oi?yi:pi?Qc:function(a){return 0>a?a.toFixed(0):a};return Zg&&("function"==typeof Zg?a=Zg:oi&&(a=function(a){return a?xi(Zg)(a):""})),a}function _(a){var b;return"y"===a?b=mh:"y2"===a?b=vh:"x"===a&&(b=hh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?mh=b:"y2"===a?vh=b:"x"===a&&(hh=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Ug?"inner-top":"inner-right")}function eb(){return cb("y",Ug?"inner-right":"inner-top")}function fb(){return cb("y2",Ug?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?If/2:If:b.isBottom?-Kf:b.isMiddle?-Kf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Ug,db())}function ob(){return kb(Ug,eb())}function pb(){return kb(Ug,fb())}function qb(){return lb(!Ug,db())}function rb(){return lb(Ug,eb())}function sb(){return lb(Ug,fb())}function tb(){var a=db();return Ug?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Ug?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Ug?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Ug,db())}function xb(){return mb(Ug,eb())}function yb(){return mb(Ug,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return pf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Ui.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Ui.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Ui.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+o)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Oc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return pf.min(Object.keys(i).map(function(a){return pf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=zc(a),i=Mc(a);if(rg.length>0)for(g=Pc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return pf.max(Object.keys(i).map(function(a){return pf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?th:kh,n="y2"===c?sh:jh,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?uh:lh,r=rd()&&Ug;return 0===l.length?"y2"===c?dg.domain():cg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=sd(o,p),j=$b(cg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&ph&&(f=b(ph.top)?ph.top:e,g=b(ph.bottom)?ph.bottom:e),"y2"===c&&yh&&(f=b(yh.top)?yh.top:e,g=b(yh.bottom)?yh.bottom:e),Wd(l)&&!Oc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Zi),c=$b(bg.domain());return a||0===c?1:b/c}function Wb(a){return eh?eh:pf.min(a,function(a){return pf.min(a.values,function(a){return a.x})})}function Xb(a){return dh?dh:pf.max(a,function(a){return pf.max(a.values,function(a){return a.x})})}function Yb(a,c){var d,e,f,g,h=c[0],i=c[1],j=Math.abs(h-i);return pi?e=0:Wd(a)?(d=xc(),e=d>1?j/(d-1)/2:.5):e=.01*j,"object"==typeof fh&&qe(fh)?(f=b(fh.left)?fh.left:e,g=b(fh.right)?fh.right:e):f=g="number"==typeof fh?fh:e,{left:f,right:g}}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=0,g=0;return(c||0===c)&&(f=oi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=oi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bb?0:b-c}function fc(a){var b,c=dc(a),d="y"===a.axis?cg:dg;return b="y"===a.axis||"y2"===a.axis?Ug?Kf:"start"in a?d(a.start):Kf:Ug?"end"in a?bg(oi?le(a.end):a.end):Kf:Kf,c>b?0:b-c}function gc(a){return lg&&a===lg||qe(mg)&&re(mg,a)}function hc(a){return!gc(a)}function ic(a){return lg?lg:qe(mg)?mg[a]:null}function jc(a,b){var c,d=b&&qe(b)?zc(b):[];return d.forEach(function(b){ic(b)===a&&(c=qf.data.xs[b])}),c}function kc(a,b){return a in qf.data.xs&&qf.data.xs[a]&&qf.data.xs[a][b]?qf.data.xs[a][b]:b}function lc(a){Object.keys(a).forEach(function(b){mg[b]=a[b]})}function mc(a){return 1===pf.set(Object.keys(a).map(function(b){return a[b]})).size()}function nc(a){var b;return a&&(b=pg[a.id],a.name=b?b:a.id),a}function oc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=qc(b[d],a.id,d)}),qf.data.xs[a.id]=b})}function pc(a,b){a.forEach(function(a){b[a.id]&&oc([a],b[a.id])})}function qc(a,b,c){var d;return d=oi?a?a instanceof Date?a:le(a):le(kc(b,c)):qi&&!pi?a?+a:kc(b,c):c}function rc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?qf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):lg?(d=Object.keys(qf.data.xs),qf.data.xs[c]=d.length>0?qf.data.xs[d[0]]:void 0):qe(mg)&&(qf.data.xs[c]=jc(f,qf.data.targets)):qf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!qf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=og(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=ic(b),g=a[f],h=qc(g,b,e);return qi&&pi&&0===c&&g&&(0===e&&(Xg=[]),Xg.push(g)),("undefined"==typeof a[b]||qf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),tg&&Ud(zc(c).filter(function(a){return!(a in ug)}),tg),c.forEach(function(a){ac(a.id_org,a)}),c}function uc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function vc(a){return a>0&&qf.data.targets[0].values[a-1]?qf.data.targets[0].values[a-1].x:void 0}function wc(a){return a1?qf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?qf.data.targets[0]:null,a}function zc(a){return a.map(function(a){return a.id})}function Ac(a){return a?"string"==typeof a?[a]:a:zc(qf.data.targets)}function Bc(a,b){var c,d=zc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(oi?new Date(h):h);i.push(d)}return oi||(i=i.sort(function(a,b){return a-b})),i}function Ic(a){zi=zi.concat(a)}function Jc(a){zi=zi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){Ai=Ai.concat(a)}function Lc(a){Ai=Ai.filter(function(b){return a.indexOf(b)<0})}function Mc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Nc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Pc(a){return Nc(a,function(a){return a>0})}function Qc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(Ad(a,f))),a[g].x&&(e=e.concat(Ad(a,g))),Dd(e,b)):Bd(a,b,f,g)}function Cd(a,b){var c;return c=a.map(function(a){return Bd(a.values,b)}),Dd(c,b)}function Dd(a,b){var c,d;return a.forEach(function(a){var e=se(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Ed(a,b){return pf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Fd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Gd(){return wg&&"desc"===wg.toLowerCase()}function Hd(){return wg&&"asc"===wg.toLowerCase()}function Id(a){var b=Hd(),c=Gd();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof wg&&a.sort(wg),a}function Jd(a,c){var d,e,f,g,h,i,j,k=$d(qf.data.targets),l=k?ud:td,m=a.filter(function(a){return a&&b(a.value)});bi&&0!==m.length&&(Xi.html(ei(a,$(),l,wi)).style("display","block"),d=Xi.property("offsetWidth"),e=Xi.property("offsetHeight"),k?(g=If/2+c[0],i=Kf/2+c[1]+20):(Ug?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=bg(m[0].x)+20):(f=q(),g=f+t()+bg(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Xi.style("top",i+"px").style("left",g+"px"))}function Kd(){Xi.style("display","none")}function Ld(a){var c=a.filter(function(a){return a&&b(a.value)});bi&&(Xd(qf.data.targets)||$d(qf.data.targets)||Ui.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Ug?"y1":"x1",wd).attr(Ug?"y2":"x2",wd))}function Md(){Ui.select("line."+f.xgridFocus).style("visibility","hidden")}function Nd(a){return a.x||0===a.x?bg(a.x):null}function Od(a){return V(a.id)(a.value)}function Pd(){var a,b,d={},e=0;return Fc(Cc(be)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Td(a,b){return Nh?Nh:b?2*a.tickOffset()*Oh/b:0}function Ud(a,b){Ac(a).forEach(function(a){_i[a]=b===ug[a],ug[a]=b})}function Vd(a,b){var c=!1;return a.forEach(function(a){ug[a.id]===b&&(c=!0),a.id in ug||"line"!==b||(c=!0)}),c}function Wd(a){return Vd(a,"bar")}function Xd(a){return Vd(a,"scatter")}function Yd(a){return Vd(a,"pie")}function Zd(a){return Vd(a,"donut")}function $d(a){return Yd(a)||Zd(a)}function _d(a){var b="string"==typeof a?a:a.id;return!(b in ug)||"line"===ug[b]||"spline"===ug[b]||"area"===ug[b]||"area-spline"===ug[b]}function ae(a){var b="string"==typeof a?a:a.id;return"spline"===ug[b]||"area-spline"===ug[b]}function be(a){var b="string"==typeof a?a:a.id;return"bar"===ug[b]}function ce(a){var b="string"==typeof a?a:a.id;return"scatter"===ug[b]}function de(a){var b="string"==typeof a?a:a.id;return"pie"===ug[b]}function ee(a){var b="string"==typeof a?a:a.id;return"donut"===ug[b]}function fe(a){return de(a)||ee(a)}function ge(a){return be(a)?a.values:[]}function he(a){return _d(a)||ce(a)?a.values:[]}function ie(a){return be(a)||_d(a)?a.values:[]}function je(a){return ee(a)&&Xh||de(a)&&Rh}function ke(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function le(b){var c;try{c=ng?pf.time.format(ng).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ng)}return c}function me(a,b){var c=pf.mouse(a),d=pf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function re(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function se(a,b){var c="y"===Z(a.id)?cg:dg,d=Ug?1:0,e=Ug?0:1;return Math.pow(bg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function te(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function ue(a,b,c){Hg(b,a.node()),Ui.select("."+f.selectedCircles+id(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Rc(f.selectedCircle,c)}).attr("cx",Ug?Od:Nd).attr("cy",Ug?Nd:Od).attr("stroke",function(){return wi(b)}).attr("r",1.4*Lh).transition().duration(100).attr("r",Lh)}function ve(a,b,c){Ig(b,a.node()),Ui.select("."+f.selectedCircles+id(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a,b){Hg(b,a.node()),a.transition().duration(100).style("fill",function(){return pf.rgb(wi(b)).darker(1)})}function ye(a,b){Ig(b,a.node()),a.transition().duration(100).style("fill",function(){return wi(b)})}function ze(a,b,c,d){a?xe(b,c,d):ye(b,c,d)}function Ae(a){return a.filter(function(a){return b(a.value)})}function Be(a,c){return(c?Ui.selectAll("."+f.circles+id(c)):Ui).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ce(a,b){Be(a,b).classed(f.EXPANDED,!0).attr("r",Kh)}function De(a){Be(a).filter(function(){return pf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Hh)}function Ee(a){return Ui.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Fe(a){Ee(a).classed(f.EXPANDED,!0)}function Ge(a){Ee(a).classed(f.EXPANDED,!1)}function He(a,b){var c=Le(a,b);return function(a,b){var d=c(a,b),e=Ug?1:0,f=Ug?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function Ie(a,b){var c=Le(a,!1),d=b?Je:Ke;return function(a,b){return d(c(a,b),a,this)}}function Je(a,b){var c;return Ug?(c=be(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ke(a,b,c){var d=c.getBoundingClientRect();return Ug?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:be(b)?-3:-6)}function Le(a,b){var c=a.__max__+1,d=Td(hg,c),e=Qd(d,c,a,!!b),f=Rd(!!b),g=Sd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Ug&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Me(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function Ne(b){var c,d,e;if(Yi=pf.select(sf),Yi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Yi.html(""),Yi.classed("c3",!0),qf.data.xs={},qf.data.targets=tc(b),n(),R(),bg.domain(pf.extent(Zb(qf.data.targets))),cg.domain(Ub(qf.data.targets,"y")),dg.domain(Ub(qf.data.targets,"y2")),eg.domain(bg.domain()),fg.domain(cg.domain()),gg.domain(dg.domain()),Zi=bg.domain(),Ni.scale(eg),xf&&Ri.scale(bg),Si=Yi.append("svg").attr("width",If+Ff.left+Ff.right).attr("height",Kf+Ff.top+Ff.bottom).on("mouseenter",Af).on("mouseleave",Bf),Ti=Si.append("defs"),Ti.append("clipPath").attr("id",ii).append("rect").attr("width",If).attr("height",Kf),Ti.append("clipPath").attr("id",ji).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Ti.append("clipPath").attr("id",ki).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Ui=Si.append("g").attr("transform",Fi.main),Vi=Lg?Si.append("g").attr("transform",Fi.context):null,Wi=Si.append("g").attr("transform",Fi.legend),Og||(Wi.style("visibility","hidden"),Ai=zc(qf.data.targets)),Xi=pf.select(sf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),kf(zc(qf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Ui.append("g").attr("class",f.axisX).attr("clip-path",mi).attr("transform",Fi.x).append("text").attr("class",f.axisXLabel).attr("transform",Ug?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),ih&&Ui.append("g").attr("class",f.axisY).attr("clip-path",ni).attr("transform",Fi.y).append("text").attr("class",f.axisYLabel).attr("transform",Ug?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),rh&&Ui.append("g").attr("class",f.axisY2).attr("transform",Fi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Ug?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Ui.append("g").attr("clip-path",li).attr("class",f.grid),Ah&&d.append("g").attr("class",f.xgrids),qe(Ch)&&d.append("g").attr("class",f.xgridLines),Ih&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Dh&&d.append("g").attr("class",f.ygrids),qe(Eh)&&d.append("g").attr("class",f.ygridLines),Ui.append("g").attr("clip-path",li).attr("class",f.regions),Ui.append("g").attr("clip-path",li).attr("class",f.chart),c=Ui.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",xf?Ug?"ns-resize":"ew-resize":null),Ui.select("."+f.chart).append("g").attr("class",f.chartBars),Ui.select("."+f.chart).append("g").attr("class",f.chartLines),Ui.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Fi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Ui.select("."+f.chart).append("g").attr("class",f.chartTexts),xf&&Ui.insert("rect",zf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",If).attr("height",Kf).style("opacity",0).style("cursor",Ug?"ns-resize":"ew-resize").call(Ri).on("dblclick.zoom",null),gh&&Ni.extent("function"!=typeof gh?gh:gh(Zb())),Lg&&(Vi.append("g").attr("clip-path",li).attr("class",f.chart),Vi.select("."+f.chart).append("g").attr("class",f.chartBars),Vi.select("."+f.chart).append("g").attr("class",f.chartLines),Vi.append("g").attr("clip-path",li).attr("class",f.brush).call(Ni).selectAll("rect").attr(Ug?"width":"height",Ug?Jf:Lf),Vi.append("g").attr("class",f.axisX).attr("transform",Fi.subx).attr("clip-path",Ug?"":mi)),$e(qf.data.targets),Ug?Ui.select("."+f.axisX).style("opacity",0).call(hg):(Ui.select("."+f.axisY).style("opacity",0).call(ig),Ui.select("."+f.axisY2).style("opacity",0).call(jg)),Ue({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),fi){if(oi&&"string"==typeof gi){for(gi=le(gi),e=0;e0){d=[];for(var g in pg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Fd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=ze,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function Se(a){$d(qf.data.targets)||Ag&&(ri=a,Ui.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),si=!0,Jg())}function Te(){$d(qf.data.targets)||Ag&&(Ui.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Ui.selectAll("."+f.shape).classed(f.INCLUDED,!1),si=!1,Kg())}function Ue(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Pd(),U=$d(qf.data.targets),V=Fc(qf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?Ef:0,O=B?N:0,P=C?N:0,H&&Og&&kf(zc(qf.data.targets),a),G&&(bg.domain(pf.extent(Zb(V))),Zi=bg.domain(),xf&&Ri.scale(bg).updateScaleExtent(),eg.domain(bg.domain()),Ni.scale(eg)),F&&(bg.domain(Ni.empty()?Zi:Ni.extent()),xf&&Ri.scale(bg).updateScaleExtent()),cg.domain(Ub(V,"y")),dg.domain(Ub(V,"y2")),(bh||ah)&&(Q=ch?ch:Hc(Gc(V)),hg.tickValues(Q),kg.tickValues(Q)),c=Ui.select("."+f.axisX).style("opacity",U?0:1),(Ug||D)&&(c=c.transition().duration(P)),c.call(hg),e=Ui.select("."+f.axisY).style("opacity",U?0:1),(!Ug||D)&&(e=e.transition().duration(P)),e.call(ig),Ui.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(jg),F)if($g&&Q){for(R=1;R=0&&pf.select(this).style("display",b%S?"none":"block")})}else pf.selectAll("."+f.axisX+" .tick text").style("display","block");if(I=He(T),K=Ie(T,!0),M=Ie(T,!1),Ab(),fg.domain(cg.domain()),gg.domain(dg.domain()),Xi.style("display","none"),o(),Ui.select("line."+f.xgridFocus).style("visibility","hidden"),Ah){if("year"===Bh){h=[];for(var W=Zb(),X=W[0].getFullYear(),Y=W[1].getFullYear(),Z=X;Y>=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=bg.ticks(10);g=Ui.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Ug?0:function(a){return bg(a)-hg.tickOffset()}).attr("x2",Ug?If:function(a){return bg(a)-hg.tickOffset()}).attr("y1",Ug?function(a){return bg(a)-hg.tickOffset()}:Ff.top).attr("y2",Ug?function(a){return bg(a)-hg.tickOffset()}:Kf).style("opacity",function(){return+pf.select(this).attr(Ug?"y1":"x1")===(Ug?Kf:0)?0:1}),g.exit().remove()}qe(Ch)&&(i=Ui.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Ch),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Ug?"":"rotate(-90)").attr("dx",Ug?0:-Ff.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Ug?0:xd).attr("x2",Ug?If:xd).attr("y1",Ug?xd:Ff.top).attr("y2",Ug?xd:Kf).style("opacity",1),i.select("text").transition().duration(N).attr("x",Ug?If:0).attr("y",xd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&Dh&&(k=Ui.select("."+f.ygrids).selectAll("."+f.ygrid).data(cg.ticks(Fh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Ug?cg:0).attr("x2",Ug?cg:If).attr("y1",Ug?0:cg).attr("y2",Ug?Kf:cg),k.exit().remove()),y&&qe(Eh)&&(l=Ui.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Eh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Ug?"rotate(-90)":"").attr("dx",Ug?0:-Ff.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Ug?yd:0).attr("x2",Ug?yd:If).attr("y1",Ug?0:yd).attr("y2",Ug?Kf:yd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Ug?0:If).attr("y",yd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Ui.selectAll("."+f.bars).selectAll("."+f.bar).data(ge),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return wi(a)}).attr("class",Zc),p.style("opacity",nd).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Ui.selectAll("."+f.texts).selectAll("."+f.text).data(ie),r.enter().append("text").attr("class",Sc).attr("text-anchor",function(a){return Ug?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return vd(a.id)(a.value)}).style("fill-opacity",od).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",qd),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Ui.selectAll("."+f.line).style("opacity",nd).transition().duration(N).attr("d",Oi).style("opacity",1),Ui.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Pi).style("opacity",$i),n=Ui.selectAll("."+f.circles).selectAll("."+f.circle).data(he),n.enter().append("circle").attr("class",Xc).style("opacity",0).attr("r",Hh),n.style("opacity",nd).transition().duration(N).style("opacity",pd).attr("cx",Ug?Od:Nd).attr("cy",Ug?Nd:Od),n.exit().remove(),Ui.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=pf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Ui.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Dc(a.data.id)&&fe(a.data)?1:0}),Ui.select("."+f.chartArcsTitle).style("opacity",Zd(qf.data.targets)?1:0),Lg&&(null!==pf.event&&"zoom"===pf.event.type&&Ni.extent(bg.orgDomain()).update(),z&&(Vi.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(kg),Ni.empty()||Ni.extent(bg.orgDomain()).update(),J=He(T,!0),s=Vi.selectAll("."+f.bars).selectAll("."+f.bar).data(ge),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return wi(a)}).attr("class",Zc),s.style("opacity",nd).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Vi.selectAll("."+f.line).style("opacity",nd).transition().duration(N).attr("d",Qi).style("opacity",1))),Ui.selectAll("."+f.selectedCircles).filter(function(a){return be(a)}).selectAll("circle").remove(),Ui.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Ug?Od:Nd).attr("cy",Ug?Nd:Od),t=Ui.select("."+f.eventRects),qe(mg)&&!mc(mg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Ui.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Pe(u.enter()),u.attr("x",0).attr("y",0).attr("width",If).attr("height",Kf)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),qi&&!pi?(x=function(a,b){var c=vc(b),d=wc(b),e=qf.data.xs[a.id][b];return(bg(d?d:e+50)-bg(c?c:e-50))/2},w=function(a,b){var c=vc(b),d=qf.data.xs[a.id][b];return(bg(d)+bg(c?c:d-50))/2}):(x=L(),w=function(a){return bg(a.x)-x/2}),v=yc(),Ui.select("."+f.eventRects).datum(v?v.values:[]),u=Ui.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Oe(u.enter()),u.attr("class",cd).attr("x",Ug?0:w).attr("y",Ug?w:0).attr("width",Ug?If:x).attr("height",Ug?x:Kf),u.exit().remove()),q=Ui.select("."+f.regions).selectAll("rect."+f.region).data(ai),q.enter().append("rect").style("fill-opacity",0),q.attr("class",bd).attr("x",cc).attr("y",dc).attr("width",ec).attr("height",fc).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),zc(qf.data.targets).forEach(function(a){_i[a]=!0})}}function Ve(){Ue({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function We(){return"mousemove"===pf.event.sourceEvent.type&&Ri.altDomain?(bg.domain(Ri.altDomain),void Ri.scale(bg).updateScaleExtent()):(pi&&bg.orgDomain()[0]===Zi[0]&&bg.domain([Zi[0]-1e-10,bg.orgDomain()[1]]),Ue({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===pf.event.sourceEvent.type&&(ti=!0)))}function Xe(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ye(){Si.attr("width",Mf).attr("height",Nf),Si.select("#"+ii).select("rect").attr("width",If).attr("height",Kf),Si.select("#"+ji).select("rect").attr("width",H),Si.select("#"+ki).select("rect").attr("width",J),Si.select("."+f.zoomRect).attr("width",If).attr("height",Kf)}function Ze(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Ye(),m(a.withTransition),Ue(a)}function $e(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Ui.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",ed),j=i.enter().append("g").attr("class",ed).style("pointer-events","none"),j.append("g").attr("class",Tc).style("fill",function(a){return wi(a)}),e=Ui.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",gd),d=e.enter().append("g").attr("class",gd).style("pointer-events","none"),d.append("g").attr("class",$c).style("fill",function(a){return wi(a)}).style("stroke","none").style("cursor",function(a){return Cg(a)?"pointer":null}),c=Ui.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",fd),b=c.enter().append("g").attr("class",fd).style("pointer-events","none"),b.append("path").attr("class",Wc).style("opacity",0).style("stroke",function(a){return wi(a)}),b.append("path").attr("class",ad).style("opacity",function(){return $i=+pf.select(this).style("opacity"),0}).style("fill",function(a){return wi(a)}),b.append("g").attr("class",function(a){return Rc(f.selectedCircles,a.id)}),b.append("g").attr("class",Yc).style("fill",function(a){return wi(a)}).style("cursor",function(a){return Cg(a)?"pointer":null}),a.forEach(function(a){Ui.selectAll("."+f.selectedCircles+id(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Ui.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Uf(a)).attr("class",hd),g=h.enter().append("g").attr("class",hd),g.append("path").attr("class",_c).style("opacity",0).style("fill",function(a){return wi(a.data)}).style("cursor",function(a){return Cg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),ef(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Jd(c,pf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),gf(),Kd(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Lg&&(n=Vi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",gd),m=n.enter().append("g").attr("class",gd),m.append("g").attr("class",$c).style("fill",function(a){return wi(a)}),l=Vi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",fd),k=l.enter().append("g").attr("class",fd),k.append("path").attr("class",Wc).style("opacity",0).style("stroke",function(a){return wi(a)})),Si.selectAll("."+f.target).filter(function(a){return Dc(a.id)}).transition().style("opacity",1)}function _e(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Ud(a.id,b.types[a.id]):Ud(a.id,b.type)}),qf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Gi?j:i,l=Gi?Q():P();return d&&(w=0,C=0,t=0,u=0),Og&&!Ec(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Gi?u:t,void(Tg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,Gi?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Wi.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Rc(f.legendItem,a)}).style("visibility",function(a){return Ec(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Qg?Qg(a):qf.toggle(a)}).on("mouseover",function(a){qf.focus(a),"function"==typeof Rg&&Rg(a)}).on("mouseout",function(a){qf.revert(),"function"==typeof Sg&&Sg(a)}),l.append("text").text(function(a){return d(pg[a])?pg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",Gi?g:-200).attr("y",Gi?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Gi?h:-200).attr("y",Gi?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return wi(a)}).attr("x",Gi?g:-200).attr("y",Gi?-200:i).attr("width",10).attr("height",10),Wi.selectAll("text").data(a).text(function(a){return d(pg[a])?pg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Wi.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Wi.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Ye(),q&&m(p)}function lf(a){return Bc(qf.data.targets,a.id)}function mf(a){return"data"in a&&Bc(qf.data.targets,a.data.id)}function nf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function of(a,b,c){var d=!$d(qf.data.targets);Ud(a,b),Ze(c?c:{withTransitionForAxis:d})}var pf=a.d3?a.d3:a.require?a.require("d3"):void 0,qf={data:{},axis:{},legend:{}},rf={},sf=h(["bindto"],"#chart"),tf=h(["size","width"]),uf=h(["size","height"]),vf=h(["padding","left"]),wf=h(["padding","right"]),xf=h(["zoom","enabled"],!1),yf=h(["zoom","extent"]),zf=h(["zoom","privileged"],!1),Af=h(["onenter"],function(){}),Bf=h(["onleave"],function(){}),Cf=h(["onresize"],function(){}),Df=h(["onresized"],function(){}),Ef=h(["transition","duration"],350);g("data","data is required in config");var Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg=h(["data","x"]),mg=h(["data","xs"],{}),ng=h(["data","x_format"]),og=h(["data","id_converter"],function(a){return a}),pg=h(["data","names"],{}),qg=h(["data","classes"],{}),rg=h(["data","groups"],[]),sg=h(["data","axes"],{}),tg=h(["data","type"]),ug=h(["data","types"],{}),vg=h(["data","labels"],{}),wg=h(["data","order"]),xg=h(["data","regions"],{}),yg=h(["data","color"]),zg=h(["data","colors"],{}),Ag=h(["data","selection","enabled"],!1),Bg=h(["data","selection","grouped"],!1),Cg=h(["data","selection","isselectable"],function(){return!0}),Dg=h(["data","selection","multiple"],!0),Eg=h(["data","onclick"],function(){}),Fg=h(["data","onenter"],function(){}),Gg=h(["data","onleave"],function(){}),Hg=h(["data","onselected"],function(){}),Ig=h(["data","onunselected"],function(){}),Jg=h(["data","ondragstart"],function(){}),Kg=h(["data","ondragend"],function(){}),Lg=h(["subchart","show"],!1),Mg=Lg?h(["subchart","size","height"],60):0,Ng=h(["color","pattern"],[]),Og=h(["legend","show"],!0),Pg=h(["legend","position"],"bottom"),Qg=h(["legend","item","onclick"]),Rg=h(["legend","item","onmouseover"]),Sg=h(["legend","item","onmouseout"]),Tg=h(["legend","equally"],!1),Ug=h(["axis","rotated"],!1),Vg=h(["axis","x","type"],"indexed"),Wg=h(["axis","x","localtime"],!0),Xg=h(["axis","x","categories"],[]),Yg=h(["axis","x","tick","centered"],!1),Zg=h(["axis","x","tick","format"]),$g=h(["axis","x","tick","culling"],{}),_g=h(["axis","x","tick","culling","max"],10),ah=h(["axis","x","tick","count"]),bh=h(["axis","x","tick","fit"],!0),ch=h(["axis","x","tick","values"],null),dh=h(["axis","x","max"]),eh=h(["axis","x","min"]),fh=h(["axis","x","padding"],{}),gh=h(["axis","x","default"]),hh=h(["axis","x","label"],{}),ih=h(["axis","y","show"],!0),jh=h(["axis","y","max"]),kh=h(["axis","y","min"]),lh=h(["axis","y","center"]),mh=h(["axis","y","label"],{}),nh=h(["axis","y","inner"],!1),oh=h(["axis","y","tick","format"]),ph=h(["axis","y","padding"],{}),qh=h(["axis","y","ticks"],10),rh=h(["axis","y2","show"],!1),sh=h(["axis","y2","max"]),th=h(["axis","y2","min"]),uh=h(["axis","y2","center"]),vh=h(["axis","y2","label"],{}),wh=h(["axis","y2","inner"],!1),xh=h(["axis","y2","tick","format"]),yh=h(["axis","y2","padding"],{}),zh=h(["axis","y2","ticks"],10),Ah=h(["grid","x","show"],!1),Bh=h(["grid","x","type"],"tick"),Ch=h(["grid","x","lines"],[]),Dh=h(["grid","y","show"],!1),Eh=h(["grid","y","lines"],[]),Fh=h(["grid","y","ticks"],10),Gh=h(["point","show"],!0),Hh=Gh?h(["point","r"],2.5):0,Ih=h(["point","focus","line","enabled"],!0),Jh=h(["point","focus","expand","enabled"],!0),Kh=h(["point","focus","expand","r"],Jh?4:Hh),Lh=h(["point","focus","select","r"],8),Mh=h(["line","connect_null"],!1),Nh=h(["bar","width"]),Oh=h(["bar","width","ratio"],.6),Ph=h(["pie","label","show"],!0),Qh=h(["pie","label","format"]),Rh=h(["pie","expand"],!0),Sh=h(["pie","onclick"],function(){}),Th=h(["pie","onmouseover"],function(){}),Uh=h(["pie","onmouseout"],function(){}),Vh=h(["donut","label","show"],!0),Wh=h(["donut","label","format"]),Xh=h(["donut","expand"],!0),Yh=h(["donut","title"],""),Zh=h(["donut","onclick"],function(){}),$h=h(["donut","onmouseover"],function(){}),_h=h(["donut","onmouseout"],function(){}),ai=h(["regions"],[]),bi=h(["tooltip","show"],!0),ci=h(["tooltip","format","title"]),di=h(["tooltip","format","value"]),ei=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ci?ci:b,l=di?di:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),fi=h(["tooltip","init","show"],!1),gi=h(["tooltip","init","x"],0),hi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ii=("string"==typeof sf?sf.replace("#",""):sf.id)+"-clip",ji=ii+"-xaxis",ki=ii+"-yaxis",li=i(ii),mi=i(ji),ni=i(ki),oi="timeseries"===Vg,pi="categorized"===Vg,qi=!oi&&(lg||qe(mg)),ri=null,si=!1,ti=!1,ui=!1,vi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],wi=ke(zg,qe(Ng)?Ng:vi,yg),xi=Wg?pf.time.format:pf.time.format.utc,yi=function(){var a=[[xi("%Y/%-m/%-d"),function(){return!0}],[xi("%-m/%-d"),function(a){return a.getMonth()}],[xi("%-m/%-d"),function(a){return 1!==a.getDate()}],[xi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[xi("%I %p"),function(a){return a.getHours()}],[xi("%I:%M"),function(a){return a.getMinutes()}],[xi(":%S"),function(a){return a.getSeconds()}],[xi(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),zi=[],Ai=[],Bi=Ug?"left":"bottom",Ci=Ug?nh?"top":"bottom":nh?"right":"left",Di=Ug?wh?"bottom":"top":wh?"left":"right",Ei=Ug?"left":"bottom",Fi={main:function(){return"translate("+Ff.left+","+Ff.top+")"},context:function(){return"translate("+Gf.left+","+Gf.top+")"},legend:function(){return"translate("+Hf.left+","+Hf.top+")"},x:function(){return"translate(0,"+(Ug?0:Kf)+")"},y:function(){return"translate(0,"+(Ug?Kf:0)+")"},y2:function(){return"translate("+(Ug?0:If)+","+(Ug?1:0)+")"},subx:function(){return"translate(0,"+(Ug?0:Lf)+")"},arc:function(){return"translate("+If/2+","+Kf/2+")"}},Gi="right"===Pg,Hi=0,Ii=0,Ji=0,Ki=30,Li=30,Mi=5;Uf=pf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Ni,Oi=function(){var a=pf.svg.line().x(Ug?function(a){return V(a.id)(a.value)}:wd).y(Ug?wd:function(a){return V(a.id)(a.value)});return Mh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Mh?Ae(b.values):b.values;return _d(b)?(a.interpolate(ae(b)?"cardinal":"linear"),xg[b.id]?Me(e,bg,V(b.id),xg[b.id]):a(e)):(c=e[0]?bg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ug?"M "+d+" "+c:"M "+c+" "+d)}}(),Pi=function(){var a;return a=Ug?pf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(wd):pf.svg.area().x(wd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ae(b.values);return Vd([b],"area")||Vd([b],"area-spline")?(a.interpolate(ae(b)?"cardinal":"linear"),a(e)):(c=e[0]?bg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ug?"M "+d+" "+c:"M "+c+" "+d)}}(),Qi=function(){var a=pf.svg.line().x(Ug?function(a){return W(a.id)(a.value)}:zd).y(Ug?zd:function(a){return W(a.id)(a.value)});return function(b){var c=Ae(b.values);return _d(b)?a(c):"M "+eg(c[0].x)+" "+W(b.id)(c[0].value)}}(),Ri=function(){};Ni=pf.svg.brush().on("brush",Ve),Ni.update=function(){return Vi&&Vi.select("."+f.brush).call(this),this},Ni.scale=function(a){return Ug?this.y(a):this.x(a)},xf&&(Ri=pf.behavior.zoom().on("zoomstart",function(){Ri.altDomain=pf.event.sourceEvent.altKey?bg.orgDomain():null}).on("zoom",xf?We:null),Ri.scale=function(a){return Ug?this.y(a):this.x(a)},Ri.orgScaleExtent=function(){var a=yf?yf:[1,10];return[a[0],Math.max(xc()/a[1],a[1])]},Ri.updateScaleExtent=function(){var a=$b(bg.orgDomain())/$b(Zi),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Si,Ti,Ui,Vi,Wi,Xi,Yi,Zi,$i,_i={};if(qf.focus=function(a){function b(a){Fc(a).transition().duration(100).style("opacity",1)}var c=Si.selectAll(jd(a)),d=c.filter(lf),e=c.filter(mf);qf.revert(),qf.defocus(),b(d.classed(f.focused,!0)),b(e),$d(qf.data.targets)&&Kb(a,!0),ef(a)},qf.defocus=function(a){function b(a){Fc(a).transition().duration(100).style("opacity",.3)}var c=Si.selectAll(jd(a)),d=c.filter(lf),e=c.filter(mf);qf.revert(),b(d.classed(f.focused,!1)),b(e),$d(qf.data.targets)&&Lb(a),ff(a)},qf.revert=function(a){function b(a){Fc(a).transition().duration(100).style("opacity",1)}var c=Si.selectAll(jd(a)),d=c.filter(lf),e=c.filter(mf);b(d.classed(f.focused,!1)),b(e),$d(qf.data.targets)&&Lb(a),gf()},qf.show=function(a,b){a=Ac(a),b=b||{},Jc(a),Si.selectAll(kd(a)).transition().style("opacity",1),b.withLegend?hf(a):Wi.selectAll(md(a)).classed(f.legendItemHidden,!1),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},qf.hide=function(a,b){a=Ac(a),b=b||{},Ic(a),Si.selectAll(kd(a)).transition().style("opacity",0),b.withLegend?jf(a):Wi.selectAll(md(a)).classed(f.legendItemHidden,!0),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},qf.toggle=function(a){Dc(a)?qf.hide(a):qf.show(a)},qf.unzoom=function(){Ni.clear().update(),Ue({withUpdateXDomain:!0})},qf.load=function(a){return a.xs&&lc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){qg[b]=a.classes[b]}),"categories"in a&&pi&&(Xg=a.categories,hg.categories(Xg)),"cacheIds"in a&&_b(a.cacheIds)?void _e(bc(a.cacheIds),a.done):void("unload"in a?bf(Ac("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){af(a)}):af(a))},qf.unload=function(a){bf(Ac(a),function(){Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},qf.selected=function(a){return pf.merge(Ui.selectAll("."+f.shapes+id(a)).selectAll("."+f.shape).filter(function(){return pf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},qf.select=function(a,b,c){Ag&&Ui.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=pf.select(this),i="circle"===this.nodeName?ue:xe,j="circle"===this.nodeName?ve:ye,k=Bg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Cg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},qf.unselect=function(a,b){Ag&&Ui.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=pf.select(this),g="circle"===this.nodeName?ve:ye,h=Bg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Cg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},qf.toLine=function(a){of(a,"line")},qf.toSpline=function(a){of(a,"spline")},qf.toBar=function(a){of(a,"bar")},qf.toScatter=function(a){of(a,"scatter")},qf.toArea=function(a){of(a,"area")},qf.toAreaSpline=function(a){of(a,"area-spline")},qf.toPie=function(a){of(a,"pie",{withTransform:!0})},qf.toDonut=function(a){of(a,"donut",{withTransform:!0})},qf.groups=function(a){return c(a)?rg:(rg=a,Ue(),rg)},qf.xgrids=function(a){return a?(Ch=a,Ue(),Ch):Ch},qf.xgrids.add=function(a){return a?qf.xgrids(Ch.concat(a)):void 0},qf.xgrids.remove=function(a){var b=nf(a);return qf.xgrids(Ch.filter(b))},qf.ygrids=function(a){return a?(Eh=a,Ue(),Eh):Eh},qf.ygrids.add=function(a){return a?qf.ygrids(Eh.concat(a)):void 0},qf.ygrids.remove=function(a){var b=nf(a);return qf.ygrids(Eh.filter(b))},qf.regions=function(a){return c(a)?ai:(ai=a,Ue(),ai)},qf.regions.add=function(a){return c(a)?ai:(ai=ai.concat(a),Ue(),ai)},qf.regions.remove=function(a,c){var e=[].concat(a); +}Xi.html(ei(qf.data.targets.map(function(a){return nc(a.values[gi])}),$(),td,wi)),Xi.style("top",hi.top).style("left",hi.left).style("display","block")}null==a.onresize&&(a.onresize=Xe()),a.onresize.add&&(a.onresize.add(Cf),a.onresize.add(function(){Ze({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})}),a.onresize.add(Df))}function Oe(a){a.append("rect").attr("class",cd).style("cursor",Ag&&Bg?"pointer":null).on("mouseover",function(a,b){if(!si&&!$d(qf.data.targets)){var c,d,e=qf.data.targets.map(function(a){return nc(a.values[b])});if(Object.keys(pg).length>0){d=[];for(var g in pg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Fd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=ze,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function Se(a){$d(qf.data.targets)||Ag&&(ri=a,Ui.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),si=!0,Jg())}function Te(){$d(qf.data.targets)||Ag&&(Ui.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Ui.selectAll("."+f.shape).classed(f.INCLUDED,!1),si=!1,Kg())}function Ue(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Pd(),U=$d(qf.data.targets),V=Fc(qf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?Ef:0,O=B?N:0,P=C?N:0,H&&Og&&kf(zc(qf.data.targets),a),G&&(bg.domain(pf.extent(Zb(V))),Zi=bg.domain(),xf&&Ri.scale(bg).updateScaleExtent(),eg.domain(bg.domain()),Ni.scale(eg)),F&&(bg.domain(Ni.empty()?Zi:Ni.extent()),xf&&Ri.scale(bg).updateScaleExtent()),cg.domain(Ub(V,"y")),dg.domain(Ub(V,"y2")),(bh||ah)&&(Q=ch?ch:Hc(Gc(V)),hg.tickValues(Q),kg.tickValues(Q)),c=Ui.select("."+f.axisX).style("opacity",U?0:1),(Ug||D)&&(c=c.transition().duration(P)),c.call(hg),e=Ui.select("."+f.axisY).style("opacity",U?0:1),(!Ug||D)&&(e=e.transition().duration(P)),e.call(ig),Ui.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(jg),F)if($g&&Q){for(R=1;R=0&&pf.select(this).style("display",b%S?"none":"block")})}else pf.selectAll("."+f.axisX+" .tick text").style("display","block");if(I=He(T),K=Ie(T,!0),M=Ie(T,!1),Ab(),fg.domain(cg.domain()),gg.domain(dg.domain()),Xi.style("display","none"),o(),Ui.select("line."+f.xgridFocus).style("visibility","hidden"),Ah){if("year"===Bh){h=[];for(var W=Zb(),X=W[0].getFullYear(),Y=W[1].getFullYear(),Z=X;Y>=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=bg.ticks(10);g=Ui.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Ug?0:function(a){return bg(a)-hg.tickOffset()}).attr("x2",Ug?If:function(a){return bg(a)-hg.tickOffset()}).attr("y1",Ug?function(a){return bg(a)-hg.tickOffset()}:Ff.top).attr("y2",Ug?function(a){return bg(a)-hg.tickOffset()}:Kf).style("opacity",function(){return+pf.select(this).attr(Ug?"y1":"x1")===(Ug?Kf:0)?0:1}),g.exit().remove()}qe(Ch)&&(i=Ui.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Ch),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Ug?"":"rotate(-90)").attr("dx",Ug?0:-Ff.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Ug?0:xd).attr("x2",Ug?If:xd).attr("y1",Ug?xd:Ff.top).attr("y2",Ug?xd:Kf).style("opacity",1),i.select("text").transition().duration(N).attr("x",Ug?If:0).attr("y",xd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&Dh&&(k=Ui.select("."+f.ygrids).selectAll("."+f.ygrid).data(cg.ticks(Fh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Ug?cg:0).attr("x2",Ug?cg:If).attr("y1",Ug?0:cg).attr("y2",Ug?Kf:cg),k.exit().remove()),y&&qe(Eh)&&(l=Ui.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Eh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Ug?"rotate(-90)":"").attr("dx",Ug?0:-Ff.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Ug?yd:0).attr("x2",Ug?yd:If).attr("y1",Ug?0:yd).attr("y2",Ug?Kf:yd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Ug?0:If).attr("y",yd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Ui.selectAll("."+f.bars).selectAll("."+f.bar).data(ge),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return wi(a)}).attr("class",Zc),p.style("opacity",nd).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Ui.selectAll("."+f.texts).selectAll("."+f.text).data(ie),r.enter().append("text").attr("class",Sc).attr("text-anchor",function(a){return Ug?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return vd(a.id)(a.value)}).style("fill-opacity",od).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",qd),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Ui.selectAll("."+f.line).style("opacity",nd).transition().duration(N).attr("d",Oi).style("opacity",1),Ui.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Pi).style("opacity",$i),n=Ui.selectAll("."+f.circles).selectAll("."+f.circle).data(he),n.enter().append("circle").attr("class",Xc).style("opacity",0).attr("r",Hh),n.style("opacity",nd).transition().duration(N).style("opacity",pd).attr("cx",Ug?Od:Nd).attr("cy",Ug?Nd:Od),n.exit().remove(),Ui.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=pf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Ui.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Dc(a.data.id)&&fe(a.data)?1:0}),Ui.select("."+f.chartArcsTitle).style("opacity",Zd(qf.data.targets)?1:0),Lg&&(null!==pf.event&&"zoom"===pf.event.type&&Ni.extent(bg.orgDomain()).update(),z&&(Vi.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(kg),Ni.empty()||Ni.extent(bg.orgDomain()).update(),J=He(T,!0),s=Vi.selectAll("."+f.bars).selectAll("."+f.bar).data(ge),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return wi(a)}).attr("class",Zc),s.style("opacity",nd).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Vi.selectAll("."+f.line).style("opacity",nd).transition().duration(N).attr("d",Qi).style("opacity",1))),Ui.selectAll("."+f.selectedCircles).filter(function(a){return be(a)}).selectAll("circle").remove(),Ui.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Ug?Od:Nd).attr("cy",Ug?Nd:Od),t=Ui.select("."+f.eventRects),qe(mg)&&!mc(mg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Ui.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Pe(u.enter()),u.attr("x",0).attr("y",0).attr("width",If).attr("height",Kf)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),qi&&!pi?(x=function(a,b){var c=vc(b),d=wc(b),e=qf.data.xs[a.id][b];return(bg(d?d:e+50)-bg(c?c:e-50))/2},w=function(a,b){var c=vc(b),d=qf.data.xs[a.id][b];return(bg(d)+bg(c?c:d-50))/2}):(x=L(),w=function(a){return bg(a.x)-x/2}),v=yc(),Ui.select("."+f.eventRects).datum(v?v.values:[]),u=Ui.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Oe(u.enter()),u.attr("class",cd).attr("x",Ug?0:w).attr("y",Ug?w:0).attr("width",Ug?If:x).attr("height",Ug?x:Kf),u.exit().remove()),q=Ui.select("."+f.regions).selectAll("rect."+f.region).data(ai),q.enter().append("rect").style("fill-opacity",0),q.attr("class",bd).attr("x",cc).attr("y",dc).attr("width",ec).attr("height",fc).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),zc(qf.data.targets).forEach(function(a){_i[a]=!0})}}function Ve(){Ue({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function We(){return"mousemove"===pf.event.sourceEvent.type&&Ri.altDomain?(bg.domain(Ri.altDomain),void Ri.scale(bg).updateScaleExtent()):(pi&&bg.orgDomain()[0]===Zi[0]&&bg.domain([Zi[0]-1e-10,bg.orgDomain()[1]]),Ue({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===pf.event.sourceEvent.type&&(ti=!0)))}function Xe(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ye(){Si.attr("width",Mf).attr("height",Nf),Si.select("#"+ii).select("rect").attr("width",If).attr("height",Kf),Si.select("#"+ji).select("rect").attr("width",H),Si.select("#"+ki).select("rect").attr("width",J),Si.select("."+f.zoomRect).attr("width",If).attr("height",Kf)}function Ze(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Ye(),m(a.withTransition),Ue(a)}function $e(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Ui.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",ed),j=i.enter().append("g").attr("class",ed).style("pointer-events","none"),j.append("g").attr("class",Tc).style("fill",function(a){return wi(a)}),e=Ui.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",gd),d=e.enter().append("g").attr("class",gd).style("pointer-events","none"),d.append("g").attr("class",$c).style("fill",function(a){return wi(a)}).style("stroke","none").style("cursor",function(a){return Cg(a)?"pointer":null}),c=Ui.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",fd),b=c.enter().append("g").attr("class",fd).style("pointer-events","none"),b.append("path").attr("class",Wc).style("opacity",0).style("stroke",function(a){return wi(a)}),b.append("path").attr("class",ad).style("opacity",function(){return $i=+pf.select(this).style("opacity"),0}).style("fill",function(a){return wi(a)}),b.append("g").attr("class",function(a){return Rc(f.selectedCircles,a.id)}),b.append("g").attr("class",Yc).style("fill",function(a){return wi(a)}).style("cursor",function(a){return Cg(a)?"pointer":null}),a.forEach(function(a){Ui.selectAll("."+f.selectedCircles+id(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Ui.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Uf(a)).attr("class",hd),g=h.enter().append("g").attr("class",hd),g.append("path").attr("class",_c).style("opacity",0).style("fill",function(a){return wi(a.data)}).style("cursor",function(a){return Cg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),ef(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Jd(c,pf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),gf(),Kd(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Lg&&(n=Vi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",gd),m=n.enter().append("g").attr("class",gd),m.append("g").attr("class",$c).style("fill",function(a){return wi(a)}),l=Vi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",fd),k=l.enter().append("g").attr("class",fd),k.append("path").attr("class",Wc).style("opacity",0).style("stroke",function(a){return wi(a)})),Si.selectAll("."+f.target).filter(function(a){return Dc(a.id)}).transition().style("opacity",1)}function _e(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Ud(a.id,b.types[a.id]):Ud(a.id,b.type)}),qf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Gi?j:i,l=Gi?Q():P();return d&&(w=0,C=0,t=0,u=0),Og&&!Ec(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Gi?u:t,void(Tg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,Gi?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Wi.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Rc(f.legendItem,a)}).style("visibility",function(a){return Ec(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Qg?Qg(a):qf.toggle(a)}).on("mouseover",function(a){qf.focus(a),"function"==typeof Rg&&Rg(a)}).on("mouseout",function(a){qf.revert(),"function"==typeof Sg&&Sg(a)}),l.append("text").text(function(a){return d(pg[a])?pg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",Gi?g:-200).attr("y",Gi?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Gi?h:-200).attr("y",Gi?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return wi(a)}).attr("x",Gi?g:-200).attr("y",Gi?-200:i).attr("width",10).attr("height",10),Wi.selectAll("text").data(a).text(function(a){return d(pg[a])?pg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Wi.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Wi.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Ye(),q&&m(p)}function lf(a){return Bc(qf.data.targets,a.id)}function mf(a){return"data"in a&&Bc(qf.data.targets,a.data.id)}function nf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function of(a,b,c){var d=!$d(qf.data.targets);Ud(a,b),Ze(c?c:{withTransitionForAxis:d})}var pf=a.d3?a.d3:a.require?a.require("d3"):void 0,qf={data:{},axis:{},legend:{}},rf={},sf=h(["bindto"],"#chart"),tf=h(["size","width"]),uf=h(["size","height"]),vf=h(["padding","left"]),wf=h(["padding","right"]),xf=h(["zoom","enabled"],!1),yf=h(["zoom","extent"]),zf=h(["zoom","privileged"],!1),Af=h(["onenter"],function(){}),Bf=h(["onleave"],function(){}),Cf=h(["onresize"],function(){}),Df=h(["onresized"],function(){}),Ef=h(["transition","duration"],350);g("data","data is required in config");var Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg=h(["data","x"]),mg=h(["data","xs"],{}),ng=h(["data","x_format"]),og=h(["data","id_converter"],function(a){return a}),pg=h(["data","names"],{}),qg=h(["data","classes"],{}),rg=h(["data","groups"],[]),sg=h(["data","axes"],{}),tg=h(["data","type"]),ug=h(["data","types"],{}),vg=h(["data","labels"],{}),wg=h(["data","order"]),xg=h(["data","regions"],{}),yg=h(["data","color"]),zg=h(["data","colors"],{}),Ag=h(["data","selection","enabled"],!1),Bg=h(["data","selection","grouped"],!1),Cg=h(["data","selection","isselectable"],function(){return!0}),Dg=h(["data","selection","multiple"],!0),Eg=h(["data","onclick"],function(){}),Fg=h(["data","onenter"],function(){}),Gg=h(["data","onleave"],function(){}),Hg=h(["data","onselected"],function(){}),Ig=h(["data","onunselected"],function(){}),Jg=h(["data","ondragstart"],function(){}),Kg=h(["data","ondragend"],function(){}),Lg=h(["subchart","show"],!1),Mg=Lg?h(["subchart","size","height"],60):0,Ng=h(["color","pattern"],[]),Og=h(["legend","show"],!0),Pg=h(["legend","position"],"bottom"),Qg=h(["legend","item","onclick"]),Rg=h(["legend","item","onmouseover"]),Sg=h(["legend","item","onmouseout"]),Tg=h(["legend","equally"],!1),Ug=h(["axis","rotated"],!1),Vg=h(["axis","x","type"],"indexed"),Wg=h(["axis","x","localtime"],!0),Xg=h(["axis","x","categories"],[]),Yg=h(["axis","x","tick","centered"],!1),Zg=h(["axis","x","tick","format"]),$g=h(["axis","x","tick","culling"],{}),_g=h(["axis","x","tick","culling","max"],10),ah=h(["axis","x","tick","count"]),bh=h(["axis","x","tick","fit"],!0),ch=h(["axis","x","tick","values"],null),dh=h(["axis","x","max"]),eh=h(["axis","x","min"]),fh=h(["axis","x","padding"],{}),gh=h(["axis","x","default"]),hh=h(["axis","x","label"],{}),ih=h(["axis","y","show"],!0),jh=h(["axis","y","max"]),kh=h(["axis","y","min"]),lh=h(["axis","y","center"]),mh=h(["axis","y","label"],{}),nh=h(["axis","y","inner"],!1),oh=h(["axis","y","tick","format"]),ph=h(["axis","y","padding"],{}),qh=h(["axis","y","ticks"],10),rh=h(["axis","y2","show"],!1),sh=h(["axis","y2","max"]),th=h(["axis","y2","min"]),uh=h(["axis","y2","center"]),vh=h(["axis","y2","label"],{}),wh=h(["axis","y2","inner"],!1),xh=h(["axis","y2","tick","format"]),yh=h(["axis","y2","padding"],{}),zh=h(["axis","y2","ticks"],10),Ah=h(["grid","x","show"],!1),Bh=h(["grid","x","type"],"tick"),Ch=h(["grid","x","lines"],[]),Dh=h(["grid","y","show"],!1),Eh=h(["grid","y","lines"],[]),Fh=h(["grid","y","ticks"],10),Gh=h(["point","show"],!0),Hh=Gh?h(["point","r"],2.5):0,Ih=h(["point","focus","line","enabled"],!0),Jh=h(["point","focus","expand","enabled"],!0),Kh=h(["point","focus","expand","r"],Jh?4:Hh),Lh=h(["point","focus","select","r"],8),Mh=h(["line","connect_null"],!1),Nh=h(["bar","width"]),Oh=h(["bar","width","ratio"],.6),Ph=h(["pie","label","show"],!0),Qh=h(["pie","label","format"]),Rh=h(["pie","expand"],!0),Sh=h(["pie","onclick"],function(){}),Th=h(["pie","onmouseover"],function(){}),Uh=h(["pie","onmouseout"],function(){}),Vh=h(["donut","label","show"],!0),Wh=h(["donut","label","format"]),Xh=h(["donut","expand"],!0),Yh=h(["donut","title"],""),Zh=h(["donut","onclick"],function(){}),$h=h(["donut","onmouseover"],function(){}),_h=h(["donut","onmouseout"],function(){}),ai=h(["regions"],[]),bi=h(["tooltip","show"],!0),ci=h(["tooltip","format","title"]),di=h(["tooltip","format","value"]),ei=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ci?ci:b,l=di?di:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),fi=h(["tooltip","init","show"],!1),gi=h(["tooltip","init","x"],0),hi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ii=("string"==typeof sf?sf.replace("#",""):sf.id)+"-clip",ji=ii+"-xaxis",ki=ii+"-yaxis",li=i(ii),mi=i(ji),ni=i(ki),oi="timeseries"===Vg,pi="categorized"===Vg,qi=!oi&&(lg||qe(mg)),ri=null,si=!1,ti=!1,ui=!1,vi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],wi=ke(zg,qe(Ng)?Ng:vi,yg),xi=Wg?pf.time.format:pf.time.format.utc,yi=function(){var a=[[xi("%Y/%-m/%-d"),function(){return!0}],[xi("%-m/%-d"),function(a){return a.getMonth()}],[xi("%-m/%-d"),function(a){return 1!==a.getDate()}],[xi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[xi("%I %p"),function(a){return a.getHours()}],[xi("%I:%M"),function(a){return a.getMinutes()}],[xi(":%S"),function(a){return a.getSeconds()}],[xi(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),zi=[],Ai=[],Bi=Ug?"left":"bottom",Ci=Ug?nh?"top":"bottom":nh?"right":"left",Di=Ug?wh?"bottom":"top":wh?"left":"right",Ei=Ug?"left":"bottom",Fi={main:function(){return"translate("+Ff.left+","+Ff.top+")"},context:function(){return"translate("+Gf.left+","+Gf.top+")"},legend:function(){return"translate("+Hf.left+","+Hf.top+")"},x:function(){return"translate(0,"+(Ug?0:Kf)+")"},y:function(){return"translate(0,"+(Ug?Kf:0)+")"},y2:function(){return"translate("+(Ug?0:If)+","+(Ug?1:0)+")"},subx:function(){return"translate(0,"+(Ug?0:Lf)+")"},arc:function(){return"translate("+If/2+","+Kf/2+")"}},Gi="right"===Pg,Hi=0,Ii=0,Ji=0,Ki=30,Li=30,Mi=5;Uf=pf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Ni,Oi=function(){var a=pf.svg.line().x(Ug?function(a){return V(a.id)(a.value)}:wd).y(Ug?wd:function(a){return V(a.id)(a.value)});return Mh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Mh?Ae(b.values):b.values;return _d(b)?(a.interpolate(ae(b)?"cardinal":"linear"),xg[b.id]?Me(e,bg,V(b.id),xg[b.id]):a(e)):(c=e[0]?bg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ug?"M "+d+" "+c:"M "+c+" "+d)}}(),Pi=function(){var a;return a=Ug?pf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(wd):pf.svg.area().x(wd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ae(b.values);return Vd([b],"area")||Vd([b],"area-spline")?(a.interpolate(ae(b)?"cardinal":"linear"),a(e)):(c=e[0]?bg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ug?"M "+d+" "+c:"M "+c+" "+d)}}(),Qi=function(){var a=pf.svg.line().x(Ug?function(a){return W(a.id)(a.value)}:zd).y(Ug?zd:function(a){return W(a.id)(a.value)});return function(b){var c=Ae(b.values);return _d(b)?a(c):"M "+eg(c[0].x)+" "+W(b.id)(c[0].value)}}(),Ri=function(){};Ni=pf.svg.brush().on("brush",Ve),Ni.update=function(){return Vi&&Vi.select("."+f.brush).call(this),this},Ni.scale=function(a){return Ug?this.y(a):this.x(a)},xf&&(Ri=pf.behavior.zoom().on("zoomstart",function(){Ri.altDomain=pf.event.sourceEvent.altKey?bg.orgDomain():null}).on("zoom",xf?We:null),Ri.scale=function(a){return Ug?this.y(a):this.x(a)},Ri.orgScaleExtent=function(){var a=yf?yf:[1,10];return[a[0],Math.max(xc()/a[1],a[1])]},Ri.updateScaleExtent=function(){var a=$b(bg.orgDomain())/$b(Zi),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Si,Ti,Ui,Vi,Wi,Xi,Yi,Zi,$i,_i={};if(qf.focus=function(a){function b(a){Fc(a).transition().duration(100).style("opacity",1)}var c=Si.selectAll(jd(a)),d=c.filter(lf),e=c.filter(mf);qf.revert(),qf.defocus(),b(d.classed(f.focused,!0)),b(e),$d(qf.data.targets)&&Kb(a,!0),ef(a)},qf.defocus=function(a){function b(a){Fc(a).transition().duration(100).style("opacity",.3)}var c=Si.selectAll(jd(a)),d=c.filter(lf),e=c.filter(mf);qf.revert(),b(d.classed(f.focused,!1)),b(e),$d(qf.data.targets)&&Lb(a),ff(a)},qf.revert=function(a){function b(a){Fc(a).transition().duration(100).style("opacity",1)}var c=Si.selectAll(jd(a)),d=c.filter(lf),e=c.filter(mf);b(d.classed(f.focused,!1)),b(e),$d(qf.data.targets)&&Lb(a),gf()},qf.show=function(a,b){a=Ac(a),b=b||{},Jc(a),Si.selectAll(kd(a)).transition().style("opacity",1),b.withLegend?hf(a):Wi.selectAll(md(a)).classed(f.legendItemHidden,!1),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},qf.hide=function(a,b){a=Ac(a),b=b||{},Ic(a),Si.selectAll(kd(a)).transition().style("opacity",0),b.withLegend?jf(a):Wi.selectAll(md(a)).classed(f.legendItemHidden,!0),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},qf.toggle=function(a){Dc(a)?qf.hide(a):qf.show(a)},qf.unzoom=function(){Ni.clear().update(),Ue({withUpdateXDomain:!0})},qf.load=function(a){return a.xs&&lc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){qg[b]=a.classes[b]}),"categories"in a&&pi&&(Xg=a.categories,hg.categories(Xg)),"cacheIds"in a&&_b(a.cacheIds)?void _e(bc(a.cacheIds),a.done):void("unload"in a?bf(Ac("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){af(a)}):af(a))},qf.unload=function(a){bf(Ac(a),function(){Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},qf.selected=function(a){return pf.merge(Ui.selectAll("."+f.shapes+id(a)).selectAll("."+f.shape).filter(function(){return pf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},qf.select=function(a,b,c){Ag&&Ui.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=pf.select(this),i="circle"===this.nodeName?ue:xe,j="circle"===this.nodeName?ve:ye,k=Bg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Cg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},qf.unselect=function(a,b){Ag&&Ui.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=pf.select(this),g="circle"===this.nodeName?ve:ye,h=Bg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Cg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},qf.toLine=function(a){of(a,"line")},qf.toSpline=function(a){of(a,"spline")},qf.toBar=function(a){of(a,"bar")},qf.toScatter=function(a){of(a,"scatter")},qf.toArea=function(a){of(a,"area")},qf.toAreaSpline=function(a){of(a,"area-spline")},qf.toPie=function(a){of(a,"pie",{withTransform:!0})},qf.toDonut=function(a){of(a,"donut",{withTransform:!0})},qf.groups=function(a){return c(a)?rg:(rg=a,Ue(),rg)},qf.xgrids=function(a){return a?(Ch=a,Ue(),Ch):Ch},qf.xgrids.add=function(a){return a?qf.xgrids(Ch.concat(a)):void 0},qf.xgrids.remove=function(a){var b=nf(a);return qf.xgrids(Ch.filter(b))},qf.ygrids=function(a){return a?(Eh=a,Ue(),Eh):Eh},qf.ygrids.add=function(a){return a?qf.ygrids(Eh.concat(a)):void 0},qf.ygrids.remove=function(a){var b=nf(a);return qf.ygrids(Eh.filter(b))},qf.regions=function(a){return c(a)?ai:(ai=a,Ue(),ai)},qf.regions.add=function(a){return c(a)?ai:(ai=ai.concat(a),Ue(),ai)},qf.regions.remove=function(a,c){var e=[].concat(a); return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;Si.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ai=ai.filter(function(b){return b.classes.indexOf(a)<0})}),ai},qf.data.get=function(a){var b=qf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},qf.data.getAsTarget=function(a){var b=Cc(function(b){return b.id===a});return b.length>0?b[0]:void 0},qf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){pg[b]=a[b]}),kf(zc(qf.data.targets),{withTransition:!0}),pg):pg},qf.x=function(a){return arguments.length&&(oc(qf.data.targets,a),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),qf.data.xs},qf.xs=function(a){return arguments.length&&(pc(qf.data.targets,a),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),qf.data.xs},qf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},qf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(jh=+a.y),b(a.y2)&&(sh=+a.y2)):jh=sh=+a,Ue())},qf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(kh=+a.y),b(a.y2)&&(th=+a.y2)):kh=th=+a,Ue())},qf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&qf.axis.max(a.max),"undefined"!=typeof a.min&&qf.axis.min(a.min))},qf.legend.show=function(a){Og||(Og=!0,Wi.style("visibility","visible")),hf(Ac(a)),Ue({withTransitionForHorizontalAxis:!1})},qf.legend.hide=function(a){Og&&pe(a)&&(Og=!1,Wi.style("visibility","hidden")),jf(Ac(a)),Ue({withTransitionForHorizontalAxis:!1})},qf.resize=function(a){tf=a?a.width:null,uf=a?a.height:null,Ze({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},qf.destroy=function(){qf.data.targets=void 0,qf.data.xs={},Yi.html(""),a.onresize=null},"url"in e.data)pf.xhr(e.data.url,function(a,b){var c,d=pf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=pf.csv.parse(b.response),Ne(c)});else if("rows"in e.data)Ne(rc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ne(sc(e.data.columns))}return qf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From b9342ab19e9f0a248c73ddc0d3b6d6659d639a55 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Tue, 22 Apr 2014 20:17:30 +0900 Subject: [PATCH 053/178] Revert legend item hidden style because of flicker --- c3.css | 3 --- c3.js | 18 ++++++++++-------- c3.min.js | 4 ++-- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/c3.css b/c3.css index 1d8d26a..737e783 100644 --- a/c3.css +++ b/c3.css @@ -115,9 +115,6 @@ .c3-legend-item { font-size: 12px; } -.c3-legend-item-hidden { - opacity: 0.1; -} /*-- Tooltip --*/ diff --git a/c3.js b/c3.js index 929bb5c..00a2c16 100644 --- a/c3.js +++ b/c3.js @@ -3744,16 +3744,14 @@ /*-- Draw Legend --*/ function opacityForLegend(id) { - var item = legend.select(selectorLegend(id)); - item.style('opacity', null); // MEMO: remove to get opacity by css - return item.classed(CLASS.legendItemHidden) ? item.style('opacity') : 1; + return d3.select(selectorLegend(id)).classed(CLASS.legendItemHidden) ? 0.5 : 1; } function toggleFocusLegend(id, focus) { - var items = legend.selectAll('.' + CLASS.legendItem).filter(function () { return !d3.select(this).classed(CLASS.legendItemHidden); }), + var legendItem = legend.selectAll('.' + CLASS.legendItem), isTarget = function (d) { return (!id || d === id); }, notTarget = function (d) { return !isTarget(d); }; - items.filter(notTarget).transition().duration(100).style('opacity', focus ? 0.3 : opacityForLegend); - items.filter(isTarget).transition().duration(100).style('opacity', focus ? opacityForLegend : 0.3); + legendItem.filter(notTarget).transition().duration(100).style('opacity', focus ? 0.3 : opacityForLegend); + legendItem.filter(isTarget).transition().duration(100).style('opacity', focus ? opacityForLegend : 0.3); } function focusLegend(id) { toggleFocusLegend(id, true); @@ -4023,7 +4021,9 @@ showLegend(targetIds); } else { legend.selectAll(selectorLegends(targetIds)) - .classed(CLASS.legendItemHidden, false); + .classed(CLASS.legendItemHidden, false) + .transition() + .style('opacity', 1); } redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withTransitionForHorizontalAxis: false}); @@ -4042,7 +4042,9 @@ hideLegend(targetIds); } else { legend.selectAll(selectorLegends(targetIds)) - .classed(CLASS.legendItemHidden, true); + .classed(CLASS.legendItemHidden, true) + .transition() + .style('opacity', 0.5); } redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withTransitionForHorizontalAxis: false}); diff --git a/c3.min.js b/c3.min.js index 6f35bd9..dc6cff8 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ !function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.31"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cIf&&(If=0),0>Kf&&(Kf=0),Gf={top:Ug?Ff.top:Nf-Mg-(Gi?0:a),right:0/0,bottom:20+(Gi?0:a),left:Ug?Ki:Ff.left},Jf=Ug?Ff.left-Ki-Li:If,Lf=Ug?Kf:Nf-Gf.top-Gf.bottom,0>Jf&&(Jf=0),0>Lf&&(Lf=0),Hf={top:Gi?0:Nf-a,right:0/0,bottom:0,left:Gi?Mf-b:0},p(),Gi&&$d(qf.data.targets)&&(Hf.left=If/2+Pf)}function o(){Ui.select("line."+f.xgridFocus).attr("x1",Ug?0:-10).attr("x2",Ug?If:-10).attr("y1",Ug?-10:Ff.top).attr("y2",Ug?-10:Kf)}function p(){Pf=Kf/2,Of=.95*Pf,Qf=Zd(qf.data.targets)?.6*Of:0}function q(){var a=Ug?f.axisX:f.axisY,b=pf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=pf.select(sf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return tf?tf:x()}function s(){var a=uf?uf:y();return a>0?a:320}function t(){return $d(qf.data.targets)?0:vf?vf:Ug||!ih||nh?1:v("y")}function u(){var a=1;return $d(qf.data.targets)?0:wf?wf:Gi?P()+(rh&&!Ug?v("y2"):a):rh?wh||Ug?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||ih?"y2"!==a||rh?(gb(a).isInner?30:40)+("y2"===a?-10:0):Mi:Og&&!Gi?10:1}function x(){return+pf.select(sf).style("width").replace("px","")}function y(){return+pf.select(sf).style("height").replace("px","")}function z(a){return a?-5:-(Ff.left-1)}function A(a){return a?-20:-1}function B(){return z(!Ug)}function C(){return A(!Ug)}function D(){return z(Ug)}function E(){return A(Ug)}function F(a){return a?If+2+4:Ff.left+20}function G(a){return a?80:Kf+2}function H(){return F(!Ug)}function I(){return G(!Ug)}function J(){return F(Ug)}function K(){return G(Ug)}function L(){var a=Ug?Kf:If,b=xc(),c=Vb()*(Wd(qf.data.targets)?(b-(pi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){Hi=a}function N(a){Ii=a}function O(a){Ji=a}function P(){return Og?Gi?Ii*(Hi+1):Mf:0}function Q(){return Og?Gi?Nf:Ji*(Hi+1):0}function R(){var a,b=!bg;Vf=Ug?1:0,Wf=Ug?Kf:If,Xf=Ug?0:Kf,Yf=Ug?If:1,Zf=Vf,$f=Wf,_f=Ug?0:Lf,ag=Ug?Jf:1,bg=T(Vf,Wf,b?void 0:bg.domain(),function(){return hg.tickOffset()}),cg=U(Xf,Yf),dg=U(Xf,Yf),eg=T(Vf,Wf,Zi,function(a){return a%1?0:kg.tickOffset()}),fg=U(_f,ag),gg=U(_f,ag),a=$(),hg=X(bg,Bi,a),kg=X(eg,Ei,a),ig=Y(cg,Ci,oh,qh),jg=Y(dg,Di,xh,zh),b||(Ni.scale(eg),xf&&Ri.scale(bg)),S()}function S(){Rf=Db(),Sf=Eb(),Tf=Eb(.98)}function T(a,b,e,f){var g=(oi?pf.time.scale():pf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),pi){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return pf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?dg:cg}function W(a){return"y2"===Z(a)?gg:fg}function X(a,b,c){var d=(pi?Bb():pf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),pi?(d.tickCentered(Yg),pe($g)&&($g=!1)):d.tickOffset=function(){var a=Ug?Kf:If;return a*Vb()/xc()/2},pi&&d.categories(Xg),d}function Y(a,b,c,d){return pf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in sg?sg[a]:"y"}function $(){var a=oi?yi:pi?Qc:function(a){return 0>a?a.toFixed(0):a};return Zg&&("function"==typeof Zg?a=Zg:oi&&(a=function(a){return a?xi(Zg)(a):""})),a}function _(a){var b;return"y"===a?b=mh:"y2"===a?b=vh:"x"===a&&(b=hh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?mh=b:"y2"===a?vh=b:"x"===a&&(hh=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Ug?"inner-top":"inner-right")}function eb(){return cb("y",Ug?"inner-right":"inner-top")}function fb(){return cb("y2",Ug?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?If/2:If:b.isBottom?-Kf:b.isMiddle?-Kf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Ug,db())}function ob(){return kb(Ug,eb())}function pb(){return kb(Ug,fb())}function qb(){return lb(!Ug,db())}function rb(){return lb(Ug,eb())}function sb(){return lb(Ug,fb())}function tb(){var a=db();return Ug?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Ug?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Ug?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Ug,db())}function xb(){return mb(Ug,eb())}function yb(){return mb(Ug,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return pf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Ui.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Ui.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Ui.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+o)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Oc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return pf.min(Object.keys(i).map(function(a){return pf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=zc(a),i=Mc(a);if(rg.length>0)for(g=Pc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return pf.max(Object.keys(i).map(function(a){return pf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?th:kh,n="y2"===c?sh:jh,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?uh:lh,r=rd()&&Ug;return 0===l.length?"y2"===c?dg.domain():cg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=sd(o,p),j=$b(cg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&ph&&(f=b(ph.top)?ph.top:e,g=b(ph.bottom)?ph.bottom:e),"y2"===c&&yh&&(f=b(yh.top)?yh.top:e,g=b(yh.bottom)?yh.bottom:e),Wd(l)&&!Oc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Zi),c=$b(bg.domain());return a||0===c?1:b/c}function Wb(a){return eh?eh:pf.min(a,function(a){return pf.min(a.values,function(a){return a.x})})}function Xb(a){return dh?dh:pf.max(a,function(a){return pf.max(a.values,function(a){return a.x})})}function Yb(a,c){var d,e,f,g,h=c[0],i=c[1],j=Math.abs(h-i);return pi?e=0:Wd(a)?(d=xc(),e=d>1?j/(d-1)/2:.5):e=.01*j,"object"==typeof fh&&qe(fh)?(f=b(fh.left)?fh.left:e,g=b(fh.right)?fh.right:e):f=g="number"==typeof fh?fh:e,{left:f,right:g}}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=0,g=0;return(c||0===c)&&(f=oi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=oi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bb?0:b-c}function fc(a){var b,c=dc(a),d="y"===a.axis?cg:dg;return b="y"===a.axis||"y2"===a.axis?Ug?Kf:"start"in a?d(a.start):Kf:Ug?"end"in a?bg(oi?le(a.end):a.end):Kf:Kf,c>b?0:b-c}function gc(a){return lg&&a===lg||qe(mg)&&re(mg,a)}function hc(a){return!gc(a)}function ic(a){return lg?lg:qe(mg)?mg[a]:null}function jc(a,b){var c,d=b&&qe(b)?zc(b):[];return d.forEach(function(b){ic(b)===a&&(c=qf.data.xs[b])}),c}function kc(a,b){return a in qf.data.xs&&qf.data.xs[a]&&qf.data.xs[a][b]?qf.data.xs[a][b]:b}function lc(a){Object.keys(a).forEach(function(b){mg[b]=a[b]})}function mc(a){return 1===pf.set(Object.keys(a).map(function(b){return a[b]})).size()}function nc(a){var b;return a&&(b=pg[a.id],a.name=b?b:a.id),a}function oc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=qc(b[d],a.id,d)}),qf.data.xs[a.id]=b})}function pc(a,b){a.forEach(function(a){b[a.id]&&oc([a],b[a.id])})}function qc(a,b,c){var d;return d=oi?a?a instanceof Date?a:le(a):le(kc(b,c)):qi&&!pi?a?+a:kc(b,c):c}function rc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?qf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):lg?(d=Object.keys(qf.data.xs),qf.data.xs[c]=d.length>0?qf.data.xs[d[0]]:void 0):qe(mg)&&(qf.data.xs[c]=jc(f,qf.data.targets)):qf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!qf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=og(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=ic(b),g=a[f],h=qc(g,b,e);return qi&&pi&&0===c&&g&&(0===e&&(Xg=[]),Xg.push(g)),("undefined"==typeof a[b]||qf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),tg&&Ud(zc(c).filter(function(a){return!(a in ug)}),tg),c.forEach(function(a){ac(a.id_org,a)}),c}function uc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function vc(a){return a>0&&qf.data.targets[0].values[a-1]?qf.data.targets[0].values[a-1].x:void 0}function wc(a){return a1?qf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?qf.data.targets[0]:null,a}function zc(a){return a.map(function(a){return a.id})}function Ac(a){return a?"string"==typeof a?[a]:a:zc(qf.data.targets)}function Bc(a,b){var c,d=zc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(oi?new Date(h):h);i.push(d)}return oi||(i=i.sort(function(a,b){return a-b})),i}function Ic(a){zi=zi.concat(a)}function Jc(a){zi=zi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){Ai=Ai.concat(a)}function Lc(a){Ai=Ai.filter(function(b){return a.indexOf(b)<0})}function Mc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Nc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Pc(a){return Nc(a,function(a){return a>0})}function Qc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(Ad(a,f))),a[g].x&&(e=e.concat(Ad(a,g))),Dd(e,b)):Bd(a,b,f,g)}function Cd(a,b){var c;return c=a.map(function(a){return Bd(a.values,b)}),Dd(c,b)}function Dd(a,b){var c,d;return a.forEach(function(a){var e=se(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Ed(a,b){return pf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Fd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Gd(){return wg&&"desc"===wg.toLowerCase()}function Hd(){return wg&&"asc"===wg.toLowerCase()}function Id(a){var b=Hd(),c=Gd();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof wg&&a.sort(wg),a}function Jd(a,c){var d,e,f,g,h,i,j,k=$d(qf.data.targets),l=k?ud:td,m=a.filter(function(a){return a&&b(a.value)});bi&&0!==m.length&&(Xi.html(ei(a,$(),l,wi)).style("display","block"),d=Xi.property("offsetWidth"),e=Xi.property("offsetHeight"),k?(g=If/2+c[0],i=Kf/2+c[1]+20):(Ug?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=bg(m[0].x)+20):(f=q(),g=f+t()+bg(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Xi.style("top",i+"px").style("left",g+"px"))}function Kd(){Xi.style("display","none")}function Ld(a){var c=a.filter(function(a){return a&&b(a.value)});bi&&(Xd(qf.data.targets)||$d(qf.data.targets)||Ui.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Ug?"y1":"x1",wd).attr(Ug?"y2":"x2",wd))}function Md(){Ui.select("line."+f.xgridFocus).style("visibility","hidden")}function Nd(a){return a.x||0===a.x?bg(a.x):null}function Od(a){return V(a.id)(a.value)}function Pd(){var a,b,d={},e=0;return Fc(Cc(be)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Td(a,b){return Nh?Nh:b?2*a.tickOffset()*Oh/b:0}function Ud(a,b){Ac(a).forEach(function(a){_i[a]=b===ug[a],ug[a]=b})}function Vd(a,b){var c=!1;return a.forEach(function(a){ug[a.id]===b&&(c=!0),a.id in ug||"line"!==b||(c=!0)}),c}function Wd(a){return Vd(a,"bar")}function Xd(a){return Vd(a,"scatter")}function Yd(a){return Vd(a,"pie")}function Zd(a){return Vd(a,"donut")}function $d(a){return Yd(a)||Zd(a)}function _d(a){var b="string"==typeof a?a:a.id;return!(b in ug)||"line"===ug[b]||"spline"===ug[b]||"area"===ug[b]||"area-spline"===ug[b]}function ae(a){var b="string"==typeof a?a:a.id;return"spline"===ug[b]||"area-spline"===ug[b]}function be(a){var b="string"==typeof a?a:a.id;return"bar"===ug[b]}function ce(a){var b="string"==typeof a?a:a.id;return"scatter"===ug[b]}function de(a){var b="string"==typeof a?a:a.id;return"pie"===ug[b]}function ee(a){var b="string"==typeof a?a:a.id;return"donut"===ug[b]}function fe(a){return de(a)||ee(a)}function ge(a){return be(a)?a.values:[]}function he(a){return _d(a)||ce(a)?a.values:[]}function ie(a){return be(a)||_d(a)?a.values:[]}function je(a){return ee(a)&&Xh||de(a)&&Rh}function ke(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function le(b){var c;try{c=ng?pf.time.format(ng).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ng)}return c}function me(a,b){var c=pf.mouse(a),d=pf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function re(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function se(a,b){var c="y"===Z(a.id)?cg:dg,d=Ug?1:0,e=Ug?0:1;return Math.pow(bg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function te(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function ue(a,b,c){Hg(b,a.node()),Ui.select("."+f.selectedCircles+id(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Rc(f.selectedCircle,c)}).attr("cx",Ug?Od:Nd).attr("cy",Ug?Nd:Od).attr("stroke",function(){return wi(b)}).attr("r",1.4*Lh).transition().duration(100).attr("r",Lh)}function ve(a,b,c){Ig(b,a.node()),Ui.select("."+f.selectedCircles+id(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a,b){Hg(b,a.node()),a.transition().duration(100).style("fill",function(){return pf.rgb(wi(b)).darker(1)})}function ye(a,b){Ig(b,a.node()),a.transition().duration(100).style("fill",function(){return wi(b)})}function ze(a,b,c,d){a?xe(b,c,d):ye(b,c,d)}function Ae(a){return a.filter(function(a){return b(a.value)})}function Be(a,c){return(c?Ui.selectAll("."+f.circles+id(c)):Ui).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ce(a,b){Be(a,b).classed(f.EXPANDED,!0).attr("r",Kh)}function De(a){Be(a).filter(function(){return pf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Hh)}function Ee(a){return Ui.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Fe(a){Ee(a).classed(f.EXPANDED,!0)}function Ge(a){Ee(a).classed(f.EXPANDED,!1)}function He(a,b){var c=Le(a,b);return function(a,b){var d=c(a,b),e=Ug?1:0,f=Ug?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function Ie(a,b){var c=Le(a,!1),d=b?Je:Ke;return function(a,b){return d(c(a,b),a,this)}}function Je(a,b){var c;return Ug?(c=be(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ke(a,b,c){var d=c.getBoundingClientRect();return Ug?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:be(b)?-3:-6)}function Le(a,b){var c=a.__max__+1,d=Td(hg,c),e=Qd(d,c,a,!!b),f=Rd(!!b),g=Sd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Ug&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Me(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function Ne(b){var c,d,e;if(Yi=pf.select(sf),Yi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Yi.html(""),Yi.classed("c3",!0),qf.data.xs={},qf.data.targets=tc(b),n(),R(),bg.domain(pf.extent(Zb(qf.data.targets))),cg.domain(Ub(qf.data.targets,"y")),dg.domain(Ub(qf.data.targets,"y2")),eg.domain(bg.domain()),fg.domain(cg.domain()),gg.domain(dg.domain()),Zi=bg.domain(),Ni.scale(eg),xf&&Ri.scale(bg),Si=Yi.append("svg").attr("width",If+Ff.left+Ff.right).attr("height",Kf+Ff.top+Ff.bottom).on("mouseenter",Af).on("mouseleave",Bf),Ti=Si.append("defs"),Ti.append("clipPath").attr("id",ii).append("rect").attr("width",If).attr("height",Kf),Ti.append("clipPath").attr("id",ji).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Ti.append("clipPath").attr("id",ki).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Ui=Si.append("g").attr("transform",Fi.main),Vi=Lg?Si.append("g").attr("transform",Fi.context):null,Wi=Si.append("g").attr("transform",Fi.legend),Og||(Wi.style("visibility","hidden"),Ai=zc(qf.data.targets)),Xi=pf.select(sf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),kf(zc(qf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Ui.append("g").attr("class",f.axisX).attr("clip-path",mi).attr("transform",Fi.x).append("text").attr("class",f.axisXLabel).attr("transform",Ug?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),ih&&Ui.append("g").attr("class",f.axisY).attr("clip-path",ni).attr("transform",Fi.y).append("text").attr("class",f.axisYLabel).attr("transform",Ug?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),rh&&Ui.append("g").attr("class",f.axisY2).attr("transform",Fi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Ug?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Ui.append("g").attr("clip-path",li).attr("class",f.grid),Ah&&d.append("g").attr("class",f.xgrids),qe(Ch)&&d.append("g").attr("class",f.xgridLines),Ih&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Dh&&d.append("g").attr("class",f.ygrids),qe(Eh)&&d.append("g").attr("class",f.ygridLines),Ui.append("g").attr("clip-path",li).attr("class",f.regions),Ui.append("g").attr("clip-path",li).attr("class",f.chart),c=Ui.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",xf?Ug?"ns-resize":"ew-resize":null),Ui.select("."+f.chart).append("g").attr("class",f.chartBars),Ui.select("."+f.chart).append("g").attr("class",f.chartLines),Ui.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Fi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Ui.select("."+f.chart).append("g").attr("class",f.chartTexts),xf&&Ui.insert("rect",zf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",If).attr("height",Kf).style("opacity",0).style("cursor",Ug?"ns-resize":"ew-resize").call(Ri).on("dblclick.zoom",null),gh&&Ni.extent("function"!=typeof gh?gh:gh(Zb())),Lg&&(Vi.append("g").attr("clip-path",li).attr("class",f.chart),Vi.select("."+f.chart).append("g").attr("class",f.chartBars),Vi.select("."+f.chart).append("g").attr("class",f.chartLines),Vi.append("g").attr("clip-path",li).attr("class",f.brush).call(Ni).selectAll("rect").attr(Ug?"width":"height",Ug?Jf:Lf),Vi.append("g").attr("class",f.axisX).attr("transform",Fi.subx).attr("clip-path",Ug?"":mi)),$e(qf.data.targets),Ug?Ui.select("."+f.axisX).style("opacity",0).call(hg):(Ui.select("."+f.axisY).style("opacity",0).call(ig),Ui.select("."+f.axisY2).style("opacity",0).call(jg)),Ue({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),fi){if(oi&&"string"==typeof gi){for(gi=le(gi),e=0;e0){d=[];for(var g in pg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Fd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=ze,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function Se(a){$d(qf.data.targets)||Ag&&(ri=a,Ui.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),si=!0,Jg())}function Te(){$d(qf.data.targets)||Ag&&(Ui.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Ui.selectAll("."+f.shape).classed(f.INCLUDED,!1),si=!1,Kg())}function Ue(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Pd(),U=$d(qf.data.targets),V=Fc(qf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?Ef:0,O=B?N:0,P=C?N:0,H&&Og&&kf(zc(qf.data.targets),a),G&&(bg.domain(pf.extent(Zb(V))),Zi=bg.domain(),xf&&Ri.scale(bg).updateScaleExtent(),eg.domain(bg.domain()),Ni.scale(eg)),F&&(bg.domain(Ni.empty()?Zi:Ni.extent()),xf&&Ri.scale(bg).updateScaleExtent()),cg.domain(Ub(V,"y")),dg.domain(Ub(V,"y2")),(bh||ah)&&(Q=ch?ch:Hc(Gc(V)),hg.tickValues(Q),kg.tickValues(Q)),c=Ui.select("."+f.axisX).style("opacity",U?0:1),(Ug||D)&&(c=c.transition().duration(P)),c.call(hg),e=Ui.select("."+f.axisY).style("opacity",U?0:1),(!Ug||D)&&(e=e.transition().duration(P)),e.call(ig),Ui.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(jg),F)if($g&&Q){for(R=1;R=0&&pf.select(this).style("display",b%S?"none":"block")})}else pf.selectAll("."+f.axisX+" .tick text").style("display","block");if(I=He(T),K=Ie(T,!0),M=Ie(T,!1),Ab(),fg.domain(cg.domain()),gg.domain(dg.domain()),Xi.style("display","none"),o(),Ui.select("line."+f.xgridFocus).style("visibility","hidden"),Ah){if("year"===Bh){h=[];for(var W=Zb(),X=W[0].getFullYear(),Y=W[1].getFullYear(),Z=X;Y>=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=bg.ticks(10);g=Ui.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Ug?0:function(a){return bg(a)-hg.tickOffset()}).attr("x2",Ug?If:function(a){return bg(a)-hg.tickOffset()}).attr("y1",Ug?function(a){return bg(a)-hg.tickOffset()}:Ff.top).attr("y2",Ug?function(a){return bg(a)-hg.tickOffset()}:Kf).style("opacity",function(){return+pf.select(this).attr(Ug?"y1":"x1")===(Ug?Kf:0)?0:1}),g.exit().remove()}qe(Ch)&&(i=Ui.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Ch),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Ug?"":"rotate(-90)").attr("dx",Ug?0:-Ff.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Ug?0:xd).attr("x2",Ug?If:xd).attr("y1",Ug?xd:Ff.top).attr("y2",Ug?xd:Kf).style("opacity",1),i.select("text").transition().duration(N).attr("x",Ug?If:0).attr("y",xd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&Dh&&(k=Ui.select("."+f.ygrids).selectAll("."+f.ygrid).data(cg.ticks(Fh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Ug?cg:0).attr("x2",Ug?cg:If).attr("y1",Ug?0:cg).attr("y2",Ug?Kf:cg),k.exit().remove()),y&&qe(Eh)&&(l=Ui.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Eh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Ug?"rotate(-90)":"").attr("dx",Ug?0:-Ff.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Ug?yd:0).attr("x2",Ug?yd:If).attr("y1",Ug?0:yd).attr("y2",Ug?Kf:yd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Ug?0:If).attr("y",yd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Ui.selectAll("."+f.bars).selectAll("."+f.bar).data(ge),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return wi(a)}).attr("class",Zc),p.style("opacity",nd).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Ui.selectAll("."+f.texts).selectAll("."+f.text).data(ie),r.enter().append("text").attr("class",Sc).attr("text-anchor",function(a){return Ug?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return vd(a.id)(a.value)}).style("fill-opacity",od).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",qd),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Ui.selectAll("."+f.line).style("opacity",nd).transition().duration(N).attr("d",Oi).style("opacity",1),Ui.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Pi).style("opacity",$i),n=Ui.selectAll("."+f.circles).selectAll("."+f.circle).data(he),n.enter().append("circle").attr("class",Xc).style("opacity",0).attr("r",Hh),n.style("opacity",nd).transition().duration(N).style("opacity",pd).attr("cx",Ug?Od:Nd).attr("cy",Ug?Nd:Od),n.exit().remove(),Ui.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=pf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Ui.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Dc(a.data.id)&&fe(a.data)?1:0}),Ui.select("."+f.chartArcsTitle).style("opacity",Zd(qf.data.targets)?1:0),Lg&&(null!==pf.event&&"zoom"===pf.event.type&&Ni.extent(bg.orgDomain()).update(),z&&(Vi.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(kg),Ni.empty()||Ni.extent(bg.orgDomain()).update(),J=He(T,!0),s=Vi.selectAll("."+f.bars).selectAll("."+f.bar).data(ge),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return wi(a)}).attr("class",Zc),s.style("opacity",nd).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Vi.selectAll("."+f.line).style("opacity",nd).transition().duration(N).attr("d",Qi).style("opacity",1))),Ui.selectAll("."+f.selectedCircles).filter(function(a){return be(a)}).selectAll("circle").remove(),Ui.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Ug?Od:Nd).attr("cy",Ug?Nd:Od),t=Ui.select("."+f.eventRects),qe(mg)&&!mc(mg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Ui.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Pe(u.enter()),u.attr("x",0).attr("y",0).attr("width",If).attr("height",Kf)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),qi&&!pi?(x=function(a,b){var c=vc(b),d=wc(b),e=qf.data.xs[a.id][b];return(bg(d?d:e+50)-bg(c?c:e-50))/2},w=function(a,b){var c=vc(b),d=qf.data.xs[a.id][b];return(bg(d)+bg(c?c:d-50))/2}):(x=L(),w=function(a){return bg(a.x)-x/2}),v=yc(),Ui.select("."+f.eventRects).datum(v?v.values:[]),u=Ui.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Oe(u.enter()),u.attr("class",cd).attr("x",Ug?0:w).attr("y",Ug?w:0).attr("width",Ug?If:x).attr("height",Ug?x:Kf),u.exit().remove()),q=Ui.select("."+f.regions).selectAll("rect."+f.region).data(ai),q.enter().append("rect").style("fill-opacity",0),q.attr("class",bd).attr("x",cc).attr("y",dc).attr("width",ec).attr("height",fc).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),zc(qf.data.targets).forEach(function(a){_i[a]=!0})}}function Ve(){Ue({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function We(){return"mousemove"===pf.event.sourceEvent.type&&Ri.altDomain?(bg.domain(Ri.altDomain),void Ri.scale(bg).updateScaleExtent()):(pi&&bg.orgDomain()[0]===Zi[0]&&bg.domain([Zi[0]-1e-10,bg.orgDomain()[1]]),Ue({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===pf.event.sourceEvent.type&&(ti=!0)))}function Xe(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ye(){Si.attr("width",Mf).attr("height",Nf),Si.select("#"+ii).select("rect").attr("width",If).attr("height",Kf),Si.select("#"+ji).select("rect").attr("width",H),Si.select("#"+ki).select("rect").attr("width",J),Si.select("."+f.zoomRect).attr("width",If).attr("height",Kf)}function Ze(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Ye(),m(a.withTransition),Ue(a)}function $e(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Ui.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",ed),j=i.enter().append("g").attr("class",ed).style("pointer-events","none"),j.append("g").attr("class",Tc).style("fill",function(a){return wi(a)}),e=Ui.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",gd),d=e.enter().append("g").attr("class",gd).style("pointer-events","none"),d.append("g").attr("class",$c).style("fill",function(a){return wi(a)}).style("stroke","none").style("cursor",function(a){return Cg(a)?"pointer":null}),c=Ui.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",fd),b=c.enter().append("g").attr("class",fd).style("pointer-events","none"),b.append("path").attr("class",Wc).style("opacity",0).style("stroke",function(a){return wi(a)}),b.append("path").attr("class",ad).style("opacity",function(){return $i=+pf.select(this).style("opacity"),0}).style("fill",function(a){return wi(a)}),b.append("g").attr("class",function(a){return Rc(f.selectedCircles,a.id)}),b.append("g").attr("class",Yc).style("fill",function(a){return wi(a)}).style("cursor",function(a){return Cg(a)?"pointer":null}),a.forEach(function(a){Ui.selectAll("."+f.selectedCircles+id(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Ui.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Uf(a)).attr("class",hd),g=h.enter().append("g").attr("class",hd),g.append("path").attr("class",_c).style("opacity",0).style("fill",function(a){return wi(a.data)}).style("cursor",function(a){return Cg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),ef(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Jd(c,pf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),gf(),Kd(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Lg&&(n=Vi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",gd),m=n.enter().append("g").attr("class",gd),m.append("g").attr("class",$c).style("fill",function(a){return wi(a)}),l=Vi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",fd),k=l.enter().append("g").attr("class",fd),k.append("path").attr("class",Wc).style("opacity",0).style("stroke",function(a){return wi(a)})),Si.selectAll("."+f.target).filter(function(a){return Dc(a.id)}).transition().style("opacity",1)}function _e(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Ud(a.id,b.types[a.id]):Ud(a.id,b.type)}),qf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Gi?j:i,l=Gi?Q():P();return d&&(w=0,C=0,t=0,u=0),Og&&!Ec(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Gi?u:t,void(Tg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,Gi?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Wi.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Rc(f.legendItem,a)}).style("visibility",function(a){return Ec(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Qg?Qg(a):qf.toggle(a)}).on("mouseover",function(a){qf.focus(a),"function"==typeof Rg&&Rg(a)}).on("mouseout",function(a){qf.revert(),"function"==typeof Sg&&Sg(a)}),l.append("text").text(function(a){return d(pg[a])?pg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",Gi?g:-200).attr("y",Gi?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Gi?h:-200).attr("y",Gi?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return wi(a)}).attr("x",Gi?g:-200).attr("y",Gi?-200:i).attr("width",10).attr("height",10),Wi.selectAll("text").data(a).text(function(a){return d(pg[a])?pg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Wi.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Wi.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Ye(),q&&m(p)}function lf(a){return Bc(qf.data.targets,a.id)}function mf(a){return"data"in a&&Bc(qf.data.targets,a.data.id)}function nf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function of(a,b,c){var d=!$d(qf.data.targets);Ud(a,b),Ze(c?c:{withTransitionForAxis:d})}var pf=a.d3?a.d3:a.require?a.require("d3"):void 0,qf={data:{},axis:{},legend:{}},rf={},sf=h(["bindto"],"#chart"),tf=h(["size","width"]),uf=h(["size","height"]),vf=h(["padding","left"]),wf=h(["padding","right"]),xf=h(["zoom","enabled"],!1),yf=h(["zoom","extent"]),zf=h(["zoom","privileged"],!1),Af=h(["onenter"],function(){}),Bf=h(["onleave"],function(){}),Cf=h(["onresize"],function(){}),Df=h(["onresized"],function(){}),Ef=h(["transition","duration"],350);g("data","data is required in config");var Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg=h(["data","x"]),mg=h(["data","xs"],{}),ng=h(["data","x_format"]),og=h(["data","id_converter"],function(a){return a}),pg=h(["data","names"],{}),qg=h(["data","classes"],{}),rg=h(["data","groups"],[]),sg=h(["data","axes"],{}),tg=h(["data","type"]),ug=h(["data","types"],{}),vg=h(["data","labels"],{}),wg=h(["data","order"]),xg=h(["data","regions"],{}),yg=h(["data","color"]),zg=h(["data","colors"],{}),Ag=h(["data","selection","enabled"],!1),Bg=h(["data","selection","grouped"],!1),Cg=h(["data","selection","isselectable"],function(){return!0}),Dg=h(["data","selection","multiple"],!0),Eg=h(["data","onclick"],function(){}),Fg=h(["data","onenter"],function(){}),Gg=h(["data","onleave"],function(){}),Hg=h(["data","onselected"],function(){}),Ig=h(["data","onunselected"],function(){}),Jg=h(["data","ondragstart"],function(){}),Kg=h(["data","ondragend"],function(){}),Lg=h(["subchart","show"],!1),Mg=Lg?h(["subchart","size","height"],60):0,Ng=h(["color","pattern"],[]),Og=h(["legend","show"],!0),Pg=h(["legend","position"],"bottom"),Qg=h(["legend","item","onclick"]),Rg=h(["legend","item","onmouseover"]),Sg=h(["legend","item","onmouseout"]),Tg=h(["legend","equally"],!1),Ug=h(["axis","rotated"],!1),Vg=h(["axis","x","type"],"indexed"),Wg=h(["axis","x","localtime"],!0),Xg=h(["axis","x","categories"],[]),Yg=h(["axis","x","tick","centered"],!1),Zg=h(["axis","x","tick","format"]),$g=h(["axis","x","tick","culling"],{}),_g=h(["axis","x","tick","culling","max"],10),ah=h(["axis","x","tick","count"]),bh=h(["axis","x","tick","fit"],!0),ch=h(["axis","x","tick","values"],null),dh=h(["axis","x","max"]),eh=h(["axis","x","min"]),fh=h(["axis","x","padding"],{}),gh=h(["axis","x","default"]),hh=h(["axis","x","label"],{}),ih=h(["axis","y","show"],!0),jh=h(["axis","y","max"]),kh=h(["axis","y","min"]),lh=h(["axis","y","center"]),mh=h(["axis","y","label"],{}),nh=h(["axis","y","inner"],!1),oh=h(["axis","y","tick","format"]),ph=h(["axis","y","padding"],{}),qh=h(["axis","y","ticks"],10),rh=h(["axis","y2","show"],!1),sh=h(["axis","y2","max"]),th=h(["axis","y2","min"]),uh=h(["axis","y2","center"]),vh=h(["axis","y2","label"],{}),wh=h(["axis","y2","inner"],!1),xh=h(["axis","y2","tick","format"]),yh=h(["axis","y2","padding"],{}),zh=h(["axis","y2","ticks"],10),Ah=h(["grid","x","show"],!1),Bh=h(["grid","x","type"],"tick"),Ch=h(["grid","x","lines"],[]),Dh=h(["grid","y","show"],!1),Eh=h(["grid","y","lines"],[]),Fh=h(["grid","y","ticks"],10),Gh=h(["point","show"],!0),Hh=Gh?h(["point","r"],2.5):0,Ih=h(["point","focus","line","enabled"],!0),Jh=h(["point","focus","expand","enabled"],!0),Kh=h(["point","focus","expand","r"],Jh?4:Hh),Lh=h(["point","focus","select","r"],8),Mh=h(["line","connect_null"],!1),Nh=h(["bar","width"]),Oh=h(["bar","width","ratio"],.6),Ph=h(["pie","label","show"],!0),Qh=h(["pie","label","format"]),Rh=h(["pie","expand"],!0),Sh=h(["pie","onclick"],function(){}),Th=h(["pie","onmouseover"],function(){}),Uh=h(["pie","onmouseout"],function(){}),Vh=h(["donut","label","show"],!0),Wh=h(["donut","label","format"]),Xh=h(["donut","expand"],!0),Yh=h(["donut","title"],""),Zh=h(["donut","onclick"],function(){}),$h=h(["donut","onmouseover"],function(){}),_h=h(["donut","onmouseout"],function(){}),ai=h(["regions"],[]),bi=h(["tooltip","show"],!0),ci=h(["tooltip","format","title"]),di=h(["tooltip","format","value"]),ei=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ci?ci:b,l=di?di:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),fi=h(["tooltip","init","show"],!1),gi=h(["tooltip","init","x"],0),hi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ii=("string"==typeof sf?sf.replace("#",""):sf.id)+"-clip",ji=ii+"-xaxis",ki=ii+"-yaxis",li=i(ii),mi=i(ji),ni=i(ki),oi="timeseries"===Vg,pi="categorized"===Vg,qi=!oi&&(lg||qe(mg)),ri=null,si=!1,ti=!1,ui=!1,vi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],wi=ke(zg,qe(Ng)?Ng:vi,yg),xi=Wg?pf.time.format:pf.time.format.utc,yi=function(){var a=[[xi("%Y/%-m/%-d"),function(){return!0}],[xi("%-m/%-d"),function(a){return a.getMonth()}],[xi("%-m/%-d"),function(a){return 1!==a.getDate()}],[xi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[xi("%I %p"),function(a){return a.getHours()}],[xi("%I:%M"),function(a){return a.getMinutes()}],[xi(":%S"),function(a){return a.getSeconds()}],[xi(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),zi=[],Ai=[],Bi=Ug?"left":"bottom",Ci=Ug?nh?"top":"bottom":nh?"right":"left",Di=Ug?wh?"bottom":"top":wh?"left":"right",Ei=Ug?"left":"bottom",Fi={main:function(){return"translate("+Ff.left+","+Ff.top+")"},context:function(){return"translate("+Gf.left+","+Gf.top+")"},legend:function(){return"translate("+Hf.left+","+Hf.top+")"},x:function(){return"translate(0,"+(Ug?0:Kf)+")"},y:function(){return"translate(0,"+(Ug?Kf:0)+")"},y2:function(){return"translate("+(Ug?0:If)+","+(Ug?1:0)+")"},subx:function(){return"translate(0,"+(Ug?0:Lf)+")"},arc:function(){return"translate("+If/2+","+Kf/2+")"}},Gi="right"===Pg,Hi=0,Ii=0,Ji=0,Ki=30,Li=30,Mi=5;Uf=pf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Ni,Oi=function(){var a=pf.svg.line().x(Ug?function(a){return V(a.id)(a.value)}:wd).y(Ug?wd:function(a){return V(a.id)(a.value)});return Mh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Mh?Ae(b.values):b.values;return _d(b)?(a.interpolate(ae(b)?"cardinal":"linear"),xg[b.id]?Me(e,bg,V(b.id),xg[b.id]):a(e)):(c=e[0]?bg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ug?"M "+d+" "+c:"M "+c+" "+d)}}(),Pi=function(){var a;return a=Ug?pf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(wd):pf.svg.area().x(wd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ae(b.values);return Vd([b],"area")||Vd([b],"area-spline")?(a.interpolate(ae(b)?"cardinal":"linear"),a(e)):(c=e[0]?bg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ug?"M "+d+" "+c:"M "+c+" "+d)}}(),Qi=function(){var a=pf.svg.line().x(Ug?function(a){return W(a.id)(a.value)}:zd).y(Ug?zd:function(a){return W(a.id)(a.value)});return function(b){var c=Ae(b.values);return _d(b)?a(c):"M "+eg(c[0].x)+" "+W(b.id)(c[0].value)}}(),Ri=function(){};Ni=pf.svg.brush().on("brush",Ve),Ni.update=function(){return Vi&&Vi.select("."+f.brush).call(this),this},Ni.scale=function(a){return Ug?this.y(a):this.x(a)},xf&&(Ri=pf.behavior.zoom().on("zoomstart",function(){Ri.altDomain=pf.event.sourceEvent.altKey?bg.orgDomain():null}).on("zoom",xf?We:null),Ri.scale=function(a){return Ug?this.y(a):this.x(a)},Ri.orgScaleExtent=function(){var a=yf?yf:[1,10];return[a[0],Math.max(xc()/a[1],a[1])]},Ri.updateScaleExtent=function(){var a=$b(bg.orgDomain())/$b(Zi),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Si,Ti,Ui,Vi,Wi,Xi,Yi,Zi,$i,_i={};if(qf.focus=function(a){function b(a){Fc(a).transition().duration(100).style("opacity",1)}var c=Si.selectAll(jd(a)),d=c.filter(lf),e=c.filter(mf);qf.revert(),qf.defocus(),b(d.classed(f.focused,!0)),b(e),$d(qf.data.targets)&&Kb(a,!0),ef(a)},qf.defocus=function(a){function b(a){Fc(a).transition().duration(100).style("opacity",.3)}var c=Si.selectAll(jd(a)),d=c.filter(lf),e=c.filter(mf);qf.revert(),b(d.classed(f.focused,!1)),b(e),$d(qf.data.targets)&&Lb(a),ff(a)},qf.revert=function(a){function b(a){Fc(a).transition().duration(100).style("opacity",1)}var c=Si.selectAll(jd(a)),d=c.filter(lf),e=c.filter(mf);b(d.classed(f.focused,!1)),b(e),$d(qf.data.targets)&&Lb(a),gf()},qf.show=function(a,b){a=Ac(a),b=b||{},Jc(a),Si.selectAll(kd(a)).transition().style("opacity",1),b.withLegend?hf(a):Wi.selectAll(md(a)).classed(f.legendItemHidden,!1),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},qf.hide=function(a,b){a=Ac(a),b=b||{},Ic(a),Si.selectAll(kd(a)).transition().style("opacity",0),b.withLegend?jf(a):Wi.selectAll(md(a)).classed(f.legendItemHidden,!0),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},qf.toggle=function(a){Dc(a)?qf.hide(a):qf.show(a)},qf.unzoom=function(){Ni.clear().update(),Ue({withUpdateXDomain:!0})},qf.load=function(a){return a.xs&&lc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){qg[b]=a.classes[b]}),"categories"in a&&pi&&(Xg=a.categories,hg.categories(Xg)),"cacheIds"in a&&_b(a.cacheIds)?void _e(bc(a.cacheIds),a.done):void("unload"in a?bf(Ac("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){af(a)}):af(a))},qf.unload=function(a){bf(Ac(a),function(){Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},qf.selected=function(a){return pf.merge(Ui.selectAll("."+f.shapes+id(a)).selectAll("."+f.shape).filter(function(){return pf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},qf.select=function(a,b,c){Ag&&Ui.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=pf.select(this),i="circle"===this.nodeName?ue:xe,j="circle"===this.nodeName?ve:ye,k=Bg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Cg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},qf.unselect=function(a,b){Ag&&Ui.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=pf.select(this),g="circle"===this.nodeName?ve:ye,h=Bg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Cg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},qf.toLine=function(a){of(a,"line")},qf.toSpline=function(a){of(a,"spline")},qf.toBar=function(a){of(a,"bar")},qf.toScatter=function(a){of(a,"scatter")},qf.toArea=function(a){of(a,"area")},qf.toAreaSpline=function(a){of(a,"area-spline")},qf.toPie=function(a){of(a,"pie",{withTransform:!0})},qf.toDonut=function(a){of(a,"donut",{withTransform:!0})},qf.groups=function(a){return c(a)?rg:(rg=a,Ue(),rg)},qf.xgrids=function(a){return a?(Ch=a,Ue(),Ch):Ch},qf.xgrids.add=function(a){return a?qf.xgrids(Ch.concat(a)):void 0},qf.xgrids.remove=function(a){var b=nf(a);return qf.xgrids(Ch.filter(b))},qf.ygrids=function(a){return a?(Eh=a,Ue(),Eh):Eh},qf.ygrids.add=function(a){return a?qf.ygrids(Eh.concat(a)):void 0},qf.ygrids.remove=function(a){var b=nf(a);return qf.ygrids(Eh.filter(b))},qf.regions=function(a){return c(a)?ai:(ai=a,Ue(),ai)},qf.regions.add=function(a){return c(a)?ai:(ai=ai.concat(a),Ue(),ai)},qf.regions.remove=function(a,c){var e=[].concat(a); -return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;Si.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ai=ai.filter(function(b){return b.classes.indexOf(a)<0})}),ai},qf.data.get=function(a){var b=qf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},qf.data.getAsTarget=function(a){var b=Cc(function(b){return b.id===a});return b.length>0?b[0]:void 0},qf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){pg[b]=a[b]}),kf(zc(qf.data.targets),{withTransition:!0}),pg):pg},qf.x=function(a){return arguments.length&&(oc(qf.data.targets,a),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),qf.data.xs},qf.xs=function(a){return arguments.length&&(pc(qf.data.targets,a),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),qf.data.xs},qf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},qf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(jh=+a.y),b(a.y2)&&(sh=+a.y2)):jh=sh=+a,Ue())},qf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(kh=+a.y),b(a.y2)&&(th=+a.y2)):kh=th=+a,Ue())},qf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&qf.axis.max(a.max),"undefined"!=typeof a.min&&qf.axis.min(a.min))},qf.legend.show=function(a){Og||(Og=!0,Wi.style("visibility","visible")),hf(Ac(a)),Ue({withTransitionForHorizontalAxis:!1})},qf.legend.hide=function(a){Og&&pe(a)&&(Og=!1,Wi.style("visibility","hidden")),jf(Ac(a)),Ue({withTransitionForHorizontalAxis:!1})},qf.resize=function(a){tf=a?a.width:null,uf=a?a.height:null,Ze({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},qf.destroy=function(){qf.data.targets=void 0,qf.data.xs={},Yi.html(""),a.onresize=null},"url"in e.data)pf.xhr(e.data.url,function(a,b){var c,d=pf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=pf.csv.parse(b.response),Ne(c)});else if("rows"in e.data)Ne(rc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ne(sc(e.data.columns))}return qf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file +}Xi.html(ei(qf.data.targets.map(function(a){return nc(a.values[gi])}),$(),td,wi)),Xi.style("top",hi.top).style("left",hi.left).style("display","block")}null==a.onresize&&(a.onresize=Xe()),a.onresize.add&&(a.onresize.add(Cf),a.onresize.add(function(){Ze({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})}),a.onresize.add(Df))}function Oe(a){a.append("rect").attr("class",cd).style("cursor",Ag&&Bg?"pointer":null).on("mouseover",function(a,b){if(!si&&!$d(qf.data.targets)){var c,d,e=qf.data.targets.map(function(a){return nc(a.values[b])});if(Object.keys(pg).length>0){d=[];for(var g in pg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Fd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=ze,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function Se(a){$d(qf.data.targets)||Ag&&(ri=a,Ui.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),si=!0,Jg())}function Te(){$d(qf.data.targets)||Ag&&(Ui.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Ui.selectAll("."+f.shape).classed(f.INCLUDED,!1),si=!1,Kg())}function Ue(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Pd(),U=$d(qf.data.targets),V=Fc(qf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?Ef:0,O=B?N:0,P=C?N:0,H&&Og&&kf(zc(qf.data.targets),a),G&&(bg.domain(pf.extent(Zb(V))),Zi=bg.domain(),xf&&Ri.scale(bg).updateScaleExtent(),eg.domain(bg.domain()),Ni.scale(eg)),F&&(bg.domain(Ni.empty()?Zi:Ni.extent()),xf&&Ri.scale(bg).updateScaleExtent()),cg.domain(Ub(V,"y")),dg.domain(Ub(V,"y2")),(bh||ah)&&(Q=ch?ch:Hc(Gc(V)),hg.tickValues(Q),kg.tickValues(Q)),c=Ui.select("."+f.axisX).style("opacity",U?0:1),(Ug||D)&&(c=c.transition().duration(P)),c.call(hg),e=Ui.select("."+f.axisY).style("opacity",U?0:1),(!Ug||D)&&(e=e.transition().duration(P)),e.call(ig),Ui.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(jg),F)if($g&&Q){for(R=1;R=0&&pf.select(this).style("display",b%S?"none":"block")})}else pf.selectAll("."+f.axisX+" .tick text").style("display","block");if(I=He(T),K=Ie(T,!0),M=Ie(T,!1),Ab(),fg.domain(cg.domain()),gg.domain(dg.domain()),Xi.style("display","none"),o(),Ui.select("line."+f.xgridFocus).style("visibility","hidden"),Ah){if("year"===Bh){h=[];for(var W=Zb(),X=W[0].getFullYear(),Y=W[1].getFullYear(),Z=X;Y>=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=bg.ticks(10);g=Ui.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Ug?0:function(a){return bg(a)-hg.tickOffset()}).attr("x2",Ug?If:function(a){return bg(a)-hg.tickOffset()}).attr("y1",Ug?function(a){return bg(a)-hg.tickOffset()}:Ff.top).attr("y2",Ug?function(a){return bg(a)-hg.tickOffset()}:Kf).style("opacity",function(){return+pf.select(this).attr(Ug?"y1":"x1")===(Ug?Kf:0)?0:1}),g.exit().remove()}qe(Ch)&&(i=Ui.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Ch),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Ug?"":"rotate(-90)").attr("dx",Ug?0:-Ff.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Ug?0:xd).attr("x2",Ug?If:xd).attr("y1",Ug?xd:Ff.top).attr("y2",Ug?xd:Kf).style("opacity",1),i.select("text").transition().duration(N).attr("x",Ug?If:0).attr("y",xd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&Dh&&(k=Ui.select("."+f.ygrids).selectAll("."+f.ygrid).data(cg.ticks(Fh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Ug?cg:0).attr("x2",Ug?cg:If).attr("y1",Ug?0:cg).attr("y2",Ug?Kf:cg),k.exit().remove()),y&&qe(Eh)&&(l=Ui.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Eh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Ug?"rotate(-90)":"").attr("dx",Ug?0:-Ff.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Ug?yd:0).attr("x2",Ug?yd:If).attr("y1",Ug?0:yd).attr("y2",Ug?Kf:yd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Ug?0:If).attr("y",yd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Ui.selectAll("."+f.bars).selectAll("."+f.bar).data(ge),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return wi(a)}).attr("class",Zc),p.style("opacity",nd).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Ui.selectAll("."+f.texts).selectAll("."+f.text).data(ie),r.enter().append("text").attr("class",Sc).attr("text-anchor",function(a){return Ug?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return vd(a.id)(a.value)}).style("fill-opacity",od).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",qd),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Ui.selectAll("."+f.line).style("opacity",nd).transition().duration(N).attr("d",Oi).style("opacity",1),Ui.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Pi).style("opacity",$i),n=Ui.selectAll("."+f.circles).selectAll("."+f.circle).data(he),n.enter().append("circle").attr("class",Xc).style("opacity",0).attr("r",Hh),n.style("opacity",nd).transition().duration(N).style("opacity",pd).attr("cx",Ug?Od:Nd).attr("cy",Ug?Nd:Od),n.exit().remove(),Ui.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=pf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Ui.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Dc(a.data.id)&&fe(a.data)?1:0}),Ui.select("."+f.chartArcsTitle).style("opacity",Zd(qf.data.targets)?1:0),Lg&&(null!==pf.event&&"zoom"===pf.event.type&&Ni.extent(bg.orgDomain()).update(),z&&(Vi.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(kg),Ni.empty()||Ni.extent(bg.orgDomain()).update(),J=He(T,!0),s=Vi.selectAll("."+f.bars).selectAll("."+f.bar).data(ge),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return wi(a)}).attr("class",Zc),s.style("opacity",nd).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Vi.selectAll("."+f.line).style("opacity",nd).transition().duration(N).attr("d",Qi).style("opacity",1))),Ui.selectAll("."+f.selectedCircles).filter(function(a){return be(a)}).selectAll("circle").remove(),Ui.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Ug?Od:Nd).attr("cy",Ug?Nd:Od),t=Ui.select("."+f.eventRects),qe(mg)&&!mc(mg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Ui.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Pe(u.enter()),u.attr("x",0).attr("y",0).attr("width",If).attr("height",Kf)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),qi&&!pi?(x=function(a,b){var c=vc(b),d=wc(b),e=qf.data.xs[a.id][b];return(bg(d?d:e+50)-bg(c?c:e-50))/2},w=function(a,b){var c=vc(b),d=qf.data.xs[a.id][b];return(bg(d)+bg(c?c:d-50))/2}):(x=L(),w=function(a){return bg(a.x)-x/2}),v=yc(),Ui.select("."+f.eventRects).datum(v?v.values:[]),u=Ui.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Oe(u.enter()),u.attr("class",cd).attr("x",Ug?0:w).attr("y",Ug?w:0).attr("width",Ug?If:x).attr("height",Ug?x:Kf),u.exit().remove()),q=Ui.select("."+f.regions).selectAll("rect."+f.region).data(ai),q.enter().append("rect").style("fill-opacity",0),q.attr("class",bd).attr("x",cc).attr("y",dc).attr("width",ec).attr("height",fc).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),zc(qf.data.targets).forEach(function(a){_i[a]=!0})}}function Ve(){Ue({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function We(){return"mousemove"===pf.event.sourceEvent.type&&Ri.altDomain?(bg.domain(Ri.altDomain),void Ri.scale(bg).updateScaleExtent()):(pi&&bg.orgDomain()[0]===Zi[0]&&bg.domain([Zi[0]-1e-10,bg.orgDomain()[1]]),Ue({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===pf.event.sourceEvent.type&&(ti=!0)))}function Xe(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ye(){Si.attr("width",Mf).attr("height",Nf),Si.select("#"+ii).select("rect").attr("width",If).attr("height",Kf),Si.select("#"+ji).select("rect").attr("width",H),Si.select("#"+ki).select("rect").attr("width",J),Si.select("."+f.zoomRect).attr("width",If).attr("height",Kf)}function Ze(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Ye(),m(a.withTransition),Ue(a)}function $e(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Ui.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",ed),j=i.enter().append("g").attr("class",ed).style("pointer-events","none"),j.append("g").attr("class",Tc).style("fill",function(a){return wi(a)}),e=Ui.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",gd),d=e.enter().append("g").attr("class",gd).style("pointer-events","none"),d.append("g").attr("class",$c).style("fill",function(a){return wi(a)}).style("stroke","none").style("cursor",function(a){return Cg(a)?"pointer":null}),c=Ui.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",fd),b=c.enter().append("g").attr("class",fd).style("pointer-events","none"),b.append("path").attr("class",Wc).style("opacity",0).style("stroke",function(a){return wi(a)}),b.append("path").attr("class",ad).style("opacity",function(){return $i=+pf.select(this).style("opacity"),0}).style("fill",function(a){return wi(a)}),b.append("g").attr("class",function(a){return Rc(f.selectedCircles,a.id)}),b.append("g").attr("class",Yc).style("fill",function(a){return wi(a)}).style("cursor",function(a){return Cg(a)?"pointer":null}),a.forEach(function(a){Ui.selectAll("."+f.selectedCircles+id(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Ui.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Uf(a)).attr("class",hd),g=h.enter().append("g").attr("class",hd),g.append("path").attr("class",_c).style("opacity",0).style("fill",function(a){return wi(a.data)}).style("cursor",function(a){return Cg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),ef(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Jd(c,pf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),gf(),Kd(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Lg&&(n=Vi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",gd),m=n.enter().append("g").attr("class",gd),m.append("g").attr("class",$c).style("fill",function(a){return wi(a)}),l=Vi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",fd),k=l.enter().append("g").attr("class",fd),k.append("path").attr("class",Wc).style("opacity",0).style("stroke",function(a){return wi(a)})),Si.selectAll("."+f.target).filter(function(a){return Dc(a.id)}).transition().style("opacity",1)}function _e(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Ud(a.id,b.types[a.id]):Ud(a.id,b.type)}),qf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Gi?j:i,l=Gi?Q():P();return d&&(w=0,C=0,t=0,u=0),Og&&!Ec(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Gi?u:t,void(Tg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,Gi?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Wi.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Rc(f.legendItem,a)}).style("visibility",function(a){return Ec(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Qg?Qg(a):qf.toggle(a)}).on("mouseover",function(a){qf.focus(a),"function"==typeof Rg&&Rg(a)}).on("mouseout",function(a){qf.revert(),"function"==typeof Sg&&Sg(a)}),l.append("text").text(function(a){return d(pg[a])?pg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",Gi?g:-200).attr("y",Gi?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Gi?h:-200).attr("y",Gi?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return wi(a)}).attr("x",Gi?g:-200).attr("y",Gi?-200:i).attr("width",10).attr("height",10),Wi.selectAll("text").data(a).text(function(a){return d(pg[a])?pg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Wi.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Wi.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Ye(),q&&m(p)}function lf(a){return Bc(qf.data.targets,a.id)}function mf(a){return"data"in a&&Bc(qf.data.targets,a.data.id)}function nf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function of(a,b,c){var d=!$d(qf.data.targets);Ud(a,b),Ze(c?c:{withTransitionForAxis:d})}var pf=a.d3?a.d3:a.require?a.require("d3"):void 0,qf={data:{},axis:{},legend:{}},rf={},sf=h(["bindto"],"#chart"),tf=h(["size","width"]),uf=h(["size","height"]),vf=h(["padding","left"]),wf=h(["padding","right"]),xf=h(["zoom","enabled"],!1),yf=h(["zoom","extent"]),zf=h(["zoom","privileged"],!1),Af=h(["onenter"],function(){}),Bf=h(["onleave"],function(){}),Cf=h(["onresize"],function(){}),Df=h(["onresized"],function(){}),Ef=h(["transition","duration"],350);g("data","data is required in config");var Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg=h(["data","x"]),mg=h(["data","xs"],{}),ng=h(["data","x_format"]),og=h(["data","id_converter"],function(a){return a}),pg=h(["data","names"],{}),qg=h(["data","classes"],{}),rg=h(["data","groups"],[]),sg=h(["data","axes"],{}),tg=h(["data","type"]),ug=h(["data","types"],{}),vg=h(["data","labels"],{}),wg=h(["data","order"]),xg=h(["data","regions"],{}),yg=h(["data","color"]),zg=h(["data","colors"],{}),Ag=h(["data","selection","enabled"],!1),Bg=h(["data","selection","grouped"],!1),Cg=h(["data","selection","isselectable"],function(){return!0}),Dg=h(["data","selection","multiple"],!0),Eg=h(["data","onclick"],function(){}),Fg=h(["data","onenter"],function(){}),Gg=h(["data","onleave"],function(){}),Hg=h(["data","onselected"],function(){}),Ig=h(["data","onunselected"],function(){}),Jg=h(["data","ondragstart"],function(){}),Kg=h(["data","ondragend"],function(){}),Lg=h(["subchart","show"],!1),Mg=Lg?h(["subchart","size","height"],60):0,Ng=h(["color","pattern"],[]),Og=h(["legend","show"],!0),Pg=h(["legend","position"],"bottom"),Qg=h(["legend","item","onclick"]),Rg=h(["legend","item","onmouseover"]),Sg=h(["legend","item","onmouseout"]),Tg=h(["legend","equally"],!1),Ug=h(["axis","rotated"],!1),Vg=h(["axis","x","type"],"indexed"),Wg=h(["axis","x","localtime"],!0),Xg=h(["axis","x","categories"],[]),Yg=h(["axis","x","tick","centered"],!1),Zg=h(["axis","x","tick","format"]),$g=h(["axis","x","tick","culling"],{}),_g=h(["axis","x","tick","culling","max"],10),ah=h(["axis","x","tick","count"]),bh=h(["axis","x","tick","fit"],!0),ch=h(["axis","x","tick","values"],null),dh=h(["axis","x","max"]),eh=h(["axis","x","min"]),fh=h(["axis","x","padding"],{}),gh=h(["axis","x","default"]),hh=h(["axis","x","label"],{}),ih=h(["axis","y","show"],!0),jh=h(["axis","y","max"]),kh=h(["axis","y","min"]),lh=h(["axis","y","center"]),mh=h(["axis","y","label"],{}),nh=h(["axis","y","inner"],!1),oh=h(["axis","y","tick","format"]),ph=h(["axis","y","padding"],{}),qh=h(["axis","y","ticks"],10),rh=h(["axis","y2","show"],!1),sh=h(["axis","y2","max"]),th=h(["axis","y2","min"]),uh=h(["axis","y2","center"]),vh=h(["axis","y2","label"],{}),wh=h(["axis","y2","inner"],!1),xh=h(["axis","y2","tick","format"]),yh=h(["axis","y2","padding"],{}),zh=h(["axis","y2","ticks"],10),Ah=h(["grid","x","show"],!1),Bh=h(["grid","x","type"],"tick"),Ch=h(["grid","x","lines"],[]),Dh=h(["grid","y","show"],!1),Eh=h(["grid","y","lines"],[]),Fh=h(["grid","y","ticks"],10),Gh=h(["point","show"],!0),Hh=Gh?h(["point","r"],2.5):0,Ih=h(["point","focus","line","enabled"],!0),Jh=h(["point","focus","expand","enabled"],!0),Kh=h(["point","focus","expand","r"],Jh?4:Hh),Lh=h(["point","focus","select","r"],8),Mh=h(["line","connect_null"],!1),Nh=h(["bar","width"]),Oh=h(["bar","width","ratio"],.6),Ph=h(["pie","label","show"],!0),Qh=h(["pie","label","format"]),Rh=h(["pie","expand"],!0),Sh=h(["pie","onclick"],function(){}),Th=h(["pie","onmouseover"],function(){}),Uh=h(["pie","onmouseout"],function(){}),Vh=h(["donut","label","show"],!0),Wh=h(["donut","label","format"]),Xh=h(["donut","expand"],!0),Yh=h(["donut","title"],""),Zh=h(["donut","onclick"],function(){}),$h=h(["donut","onmouseover"],function(){}),_h=h(["donut","onmouseout"],function(){}),ai=h(["regions"],[]),bi=h(["tooltip","show"],!0),ci=h(["tooltip","format","title"]),di=h(["tooltip","format","value"]),ei=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ci?ci:b,l=di?di:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),fi=h(["tooltip","init","show"],!1),gi=h(["tooltip","init","x"],0),hi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ii=("string"==typeof sf?sf.replace("#",""):sf.id)+"-clip",ji=ii+"-xaxis",ki=ii+"-yaxis",li=i(ii),mi=i(ji),ni=i(ki),oi="timeseries"===Vg,pi="categorized"===Vg,qi=!oi&&(lg||qe(mg)),ri=null,si=!1,ti=!1,ui=!1,vi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],wi=ke(zg,qe(Ng)?Ng:vi,yg),xi=Wg?pf.time.format:pf.time.format.utc,yi=function(){var a=[[xi("%Y/%-m/%-d"),function(){return!0}],[xi("%-m/%-d"),function(a){return a.getMonth()}],[xi("%-m/%-d"),function(a){return 1!==a.getDate()}],[xi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[xi("%I %p"),function(a){return a.getHours()}],[xi("%I:%M"),function(a){return a.getMinutes()}],[xi(":%S"),function(a){return a.getSeconds()}],[xi(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),zi=[],Ai=[],Bi=Ug?"left":"bottom",Ci=Ug?nh?"top":"bottom":nh?"right":"left",Di=Ug?wh?"bottom":"top":wh?"left":"right",Ei=Ug?"left":"bottom",Fi={main:function(){return"translate("+Ff.left+","+Ff.top+")"},context:function(){return"translate("+Gf.left+","+Gf.top+")"},legend:function(){return"translate("+Hf.left+","+Hf.top+")"},x:function(){return"translate(0,"+(Ug?0:Kf)+")"},y:function(){return"translate(0,"+(Ug?Kf:0)+")"},y2:function(){return"translate("+(Ug?0:If)+","+(Ug?1:0)+")"},subx:function(){return"translate(0,"+(Ug?0:Lf)+")"},arc:function(){return"translate("+If/2+","+Kf/2+")"}},Gi="right"===Pg,Hi=0,Ii=0,Ji=0,Ki=30,Li=30,Mi=5;Uf=pf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Ni,Oi=function(){var a=pf.svg.line().x(Ug?function(a){return V(a.id)(a.value)}:wd).y(Ug?wd:function(a){return V(a.id)(a.value)});return Mh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Mh?Ae(b.values):b.values;return _d(b)?(a.interpolate(ae(b)?"cardinal":"linear"),xg[b.id]?Me(e,bg,V(b.id),xg[b.id]):a(e)):(c=e[0]?bg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ug?"M "+d+" "+c:"M "+c+" "+d)}}(),Pi=function(){var a;return a=Ug?pf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(wd):pf.svg.area().x(wd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ae(b.values);return Vd([b],"area")||Vd([b],"area-spline")?(a.interpolate(ae(b)?"cardinal":"linear"),a(e)):(c=e[0]?bg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ug?"M "+d+" "+c:"M "+c+" "+d)}}(),Qi=function(){var a=pf.svg.line().x(Ug?function(a){return W(a.id)(a.value)}:zd).y(Ug?zd:function(a){return W(a.id)(a.value)});return function(b){var c=Ae(b.values);return _d(b)?a(c):"M "+eg(c[0].x)+" "+W(b.id)(c[0].value)}}(),Ri=function(){};Ni=pf.svg.brush().on("brush",Ve),Ni.update=function(){return Vi&&Vi.select("."+f.brush).call(this),this},Ni.scale=function(a){return Ug?this.y(a):this.x(a)},xf&&(Ri=pf.behavior.zoom().on("zoomstart",function(){Ri.altDomain=pf.event.sourceEvent.altKey?bg.orgDomain():null}).on("zoom",xf?We:null),Ri.scale=function(a){return Ug?this.y(a):this.x(a)},Ri.orgScaleExtent=function(){var a=yf?yf:[1,10];return[a[0],Math.max(xc()/a[1],a[1])]},Ri.updateScaleExtent=function(){var a=$b(bg.orgDomain())/$b(Zi),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Si,Ti,Ui,Vi,Wi,Xi,Yi,Zi,$i,_i={};if(qf.focus=function(a){function b(a){Fc(a).transition().duration(100).style("opacity",1)}var c=Si.selectAll(jd(a)),d=c.filter(lf),e=c.filter(mf);qf.revert(),qf.defocus(),b(d.classed(f.focused,!0)),b(e),$d(qf.data.targets)&&Kb(a,!0),ef(a)},qf.defocus=function(a){function b(a){Fc(a).transition().duration(100).style("opacity",.3)}var c=Si.selectAll(jd(a)),d=c.filter(lf),e=c.filter(mf);qf.revert(),b(d.classed(f.focused,!1)),b(e),$d(qf.data.targets)&&Lb(a),ff(a)},qf.revert=function(a){function b(a){Fc(a).transition().duration(100).style("opacity",1)}var c=Si.selectAll(jd(a)),d=c.filter(lf),e=c.filter(mf);b(d.classed(f.focused,!1)),b(e),$d(qf.data.targets)&&Lb(a),gf()},qf.show=function(a,b){a=Ac(a),b=b||{},Jc(a),Si.selectAll(kd(a)).transition().style("opacity",1),b.withLegend?hf(a):Wi.selectAll(md(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},qf.hide=function(a,b){a=Ac(a),b=b||{},Ic(a),Si.selectAll(kd(a)).transition().style("opacity",0),b.withLegend?jf(a):Wi.selectAll(md(a)).classed(f.legendItemHidden,!0).transition().style("opacity",.5),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},qf.toggle=function(a){Dc(a)?qf.hide(a):qf.show(a)},qf.unzoom=function(){Ni.clear().update(),Ue({withUpdateXDomain:!0})},qf.load=function(a){return a.xs&&lc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){qg[b]=a.classes[b]}),"categories"in a&&pi&&(Xg=a.categories,hg.categories(Xg)),"cacheIds"in a&&_b(a.cacheIds)?void _e(bc(a.cacheIds),a.done):void("unload"in a?bf(Ac("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){af(a)}):af(a))},qf.unload=function(a){bf(Ac(a),function(){Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},qf.selected=function(a){return pf.merge(Ui.selectAll("."+f.shapes+id(a)).selectAll("."+f.shape).filter(function(){return pf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},qf.select=function(a,b,c){Ag&&Ui.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=pf.select(this),i="circle"===this.nodeName?ue:xe,j="circle"===this.nodeName?ve:ye,k=Bg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Cg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},qf.unselect=function(a,b){Ag&&Ui.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=pf.select(this),g="circle"===this.nodeName?ve:ye,h=Bg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Cg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},qf.toLine=function(a){of(a,"line")},qf.toSpline=function(a){of(a,"spline")},qf.toBar=function(a){of(a,"bar")},qf.toScatter=function(a){of(a,"scatter")},qf.toArea=function(a){of(a,"area")},qf.toAreaSpline=function(a){of(a,"area-spline")},qf.toPie=function(a){of(a,"pie",{withTransform:!0})},qf.toDonut=function(a){of(a,"donut",{withTransform:!0})},qf.groups=function(a){return c(a)?rg:(rg=a,Ue(),rg)},qf.xgrids=function(a){return a?(Ch=a,Ue(),Ch):Ch},qf.xgrids.add=function(a){return a?qf.xgrids(Ch.concat(a)):void 0},qf.xgrids.remove=function(a){var b=nf(a);return qf.xgrids(Ch.filter(b))},qf.ygrids=function(a){return a?(Eh=a,Ue(),Eh):Eh},qf.ygrids.add=function(a){return a?qf.ygrids(Eh.concat(a)):void 0},qf.ygrids.remove=function(a){var b=nf(a);return qf.ygrids(Eh.filter(b))},qf.regions=function(a){return c(a)?ai:(ai=a,Ue(),ai)},qf.regions.add=function(a){return c(a)?ai:(ai=ai.concat(a),Ue(),ai)},qf.regions.remove=function(a,c){var e=[].concat(a);return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0; +Si.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ai=ai.filter(function(b){return b.classes.indexOf(a)<0})}),ai},qf.data.get=function(a){var b=qf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},qf.data.getAsTarget=function(a){var b=Cc(function(b){return b.id===a});return b.length>0?b[0]:void 0},qf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){pg[b]=a[b]}),kf(zc(qf.data.targets),{withTransition:!0}),pg):pg},qf.x=function(a){return arguments.length&&(oc(qf.data.targets,a),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),qf.data.xs},qf.xs=function(a){return arguments.length&&(pc(qf.data.targets,a),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),qf.data.xs},qf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},qf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(jh=+a.y),b(a.y2)&&(sh=+a.y2)):jh=sh=+a,Ue())},qf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(kh=+a.y),b(a.y2)&&(th=+a.y2)):kh=th=+a,Ue())},qf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&qf.axis.max(a.max),"undefined"!=typeof a.min&&qf.axis.min(a.min))},qf.legend.show=function(a){Og||(Og=!0,Wi.style("visibility","visible")),hf(Ac(a)),Ue({withTransitionForHorizontalAxis:!1})},qf.legend.hide=function(a){Og&&pe(a)&&(Og=!1,Wi.style("visibility","hidden")),jf(Ac(a)),Ue({withTransitionForHorizontalAxis:!1})},qf.resize=function(a){tf=a?a.width:null,uf=a?a.height:null,Ze({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},qf.destroy=function(){qf.data.targets=void 0,qf.data.xs={},Yi.html(""),a.onresize=null},"url"in e.data)pf.xhr(e.data.url,function(a,b){var c,d=pf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=pf.csv.parse(b.response),Ne(c)});else if("rows"in e.data)Ne(rc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ne(sc(e.data.columns))}return qf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 633ed3bffc3e2b66d21c95686705865c94b39e95 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Tue, 22 Apr 2014 20:29:39 +0900 Subject: [PATCH 054/178] Fix opacity for hidden legend item --- c3.js | 13 ++++++++----- c3.min.js | 6 +++--- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/c3.js b/c3.js index 00a2c16..3692756 100644 --- a/c3.js +++ b/c3.js @@ -337,7 +337,7 @@ }; var isLegendRight = __legend_position === 'right'; - var legendStep = 0, legendItemWidth = 0, legendItemHeight = 0; + var legendStep = 0, legendItemWidth = 0, legendItemHeight = 0, legendOpacityForHidden = 0.15; /*-- Define Functions --*/ @@ -3744,14 +3744,17 @@ /*-- Draw Legend --*/ function opacityForLegend(id) { - return d3.select(selectorLegend(id)).classed(CLASS.legendItemHidden) ? 0.5 : 1; + return d3.select(selectorLegend(id)).classed(CLASS.legendItemHidden) ? legendOpacityForHidden : 1; + } + function opacityForUnfocusedLegend(id) { + return d3.select(selectorLegend(id)).classed(CLASS.legendItemHidden) ? legendOpacityForHidden : 0.3; } function toggleFocusLegend(id, focus) { var legendItem = legend.selectAll('.' + CLASS.legendItem), isTarget = function (d) { return (!id || d === id); }, notTarget = function (d) { return !isTarget(d); }; - legendItem.filter(notTarget).transition().duration(100).style('opacity', focus ? 0.3 : opacityForLegend); - legendItem.filter(isTarget).transition().duration(100).style('opacity', focus ? opacityForLegend : 0.3); + legendItem.filter(notTarget).transition().duration(100).style('opacity', focus ? opacityForUnfocusedLegend : opacityForLegend); + legendItem.filter(isTarget).transition().duration(100).style('opacity', focus ? opacityForLegend : opacityForUnfocusedLegend); } function focusLegend(id) { toggleFocusLegend(id, true); @@ -4044,7 +4047,7 @@ legend.selectAll(selectorLegends(targetIds)) .classed(CLASS.legendItemHidden, true) .transition() - .style('opacity', 0.5); + .style('opacity', legendOpacityForHidden); } redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withTransitionForHorizontalAxis: false}); diff --git a/c3.min.js b/c3.min.js index dc6cff8..eec090c 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.31"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cIf&&(If=0),0>Kf&&(Kf=0),Gf={top:Ug?Ff.top:Nf-Mg-(Gi?0:a),right:0/0,bottom:20+(Gi?0:a),left:Ug?Ki:Ff.left},Jf=Ug?Ff.left-Ki-Li:If,Lf=Ug?Kf:Nf-Gf.top-Gf.bottom,0>Jf&&(Jf=0),0>Lf&&(Lf=0),Hf={top:Gi?0:Nf-a,right:0/0,bottom:0,left:Gi?Mf-b:0},p(),Gi&&$d(qf.data.targets)&&(Hf.left=If/2+Pf)}function o(){Ui.select("line."+f.xgridFocus).attr("x1",Ug?0:-10).attr("x2",Ug?If:-10).attr("y1",Ug?-10:Ff.top).attr("y2",Ug?-10:Kf)}function p(){Pf=Kf/2,Of=.95*Pf,Qf=Zd(qf.data.targets)?.6*Of:0}function q(){var a=Ug?f.axisX:f.axisY,b=pf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=pf.select(sf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return tf?tf:x()}function s(){var a=uf?uf:y();return a>0?a:320}function t(){return $d(qf.data.targets)?0:vf?vf:Ug||!ih||nh?1:v("y")}function u(){var a=1;return $d(qf.data.targets)?0:wf?wf:Gi?P()+(rh&&!Ug?v("y2"):a):rh?wh||Ug?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||ih?"y2"!==a||rh?(gb(a).isInner?30:40)+("y2"===a?-10:0):Mi:Og&&!Gi?10:1}function x(){return+pf.select(sf).style("width").replace("px","")}function y(){return+pf.select(sf).style("height").replace("px","")}function z(a){return a?-5:-(Ff.left-1)}function A(a){return a?-20:-1}function B(){return z(!Ug)}function C(){return A(!Ug)}function D(){return z(Ug)}function E(){return A(Ug)}function F(a){return a?If+2+4:Ff.left+20}function G(a){return a?80:Kf+2}function H(){return F(!Ug)}function I(){return G(!Ug)}function J(){return F(Ug)}function K(){return G(Ug)}function L(){var a=Ug?Kf:If,b=xc(),c=Vb()*(Wd(qf.data.targets)?(b-(pi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){Hi=a}function N(a){Ii=a}function O(a){Ji=a}function P(){return Og?Gi?Ii*(Hi+1):Mf:0}function Q(){return Og?Gi?Nf:Ji*(Hi+1):0}function R(){var a,b=!bg;Vf=Ug?1:0,Wf=Ug?Kf:If,Xf=Ug?0:Kf,Yf=Ug?If:1,Zf=Vf,$f=Wf,_f=Ug?0:Lf,ag=Ug?Jf:1,bg=T(Vf,Wf,b?void 0:bg.domain(),function(){return hg.tickOffset()}),cg=U(Xf,Yf),dg=U(Xf,Yf),eg=T(Vf,Wf,Zi,function(a){return a%1?0:kg.tickOffset()}),fg=U(_f,ag),gg=U(_f,ag),a=$(),hg=X(bg,Bi,a),kg=X(eg,Ei,a),ig=Y(cg,Ci,oh,qh),jg=Y(dg,Di,xh,zh),b||(Ni.scale(eg),xf&&Ri.scale(bg)),S()}function S(){Rf=Db(),Sf=Eb(),Tf=Eb(.98)}function T(a,b,e,f){var g=(oi?pf.time.scale():pf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),pi){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return pf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?dg:cg}function W(a){return"y2"===Z(a)?gg:fg}function X(a,b,c){var d=(pi?Bb():pf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),pi?(d.tickCentered(Yg),pe($g)&&($g=!1)):d.tickOffset=function(){var a=Ug?Kf:If;return a*Vb()/xc()/2},pi&&d.categories(Xg),d}function Y(a,b,c,d){return pf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in sg?sg[a]:"y"}function $(){var a=oi?yi:pi?Qc:function(a){return 0>a?a.toFixed(0):a};return Zg&&("function"==typeof Zg?a=Zg:oi&&(a=function(a){return a?xi(Zg)(a):""})),a}function _(a){var b;return"y"===a?b=mh:"y2"===a?b=vh:"x"===a&&(b=hh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?mh=b:"y2"===a?vh=b:"x"===a&&(hh=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Ug?"inner-top":"inner-right")}function eb(){return cb("y",Ug?"inner-right":"inner-top")}function fb(){return cb("y2",Ug?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?If/2:If:b.isBottom?-Kf:b.isMiddle?-Kf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Ug,db())}function ob(){return kb(Ug,eb())}function pb(){return kb(Ug,fb())}function qb(){return lb(!Ug,db())}function rb(){return lb(Ug,eb())}function sb(){return lb(Ug,fb())}function tb(){var a=db();return Ug?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Ug?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Ug?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Ug,db())}function xb(){return mb(Ug,eb())}function yb(){return mb(Ug,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return pf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Ui.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Ui.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Ui.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+o)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Oc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return pf.min(Object.keys(i).map(function(a){return pf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=zc(a),i=Mc(a);if(rg.length>0)for(g=Pc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return pf.max(Object.keys(i).map(function(a){return pf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?th:kh,n="y2"===c?sh:jh,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?uh:lh,r=rd()&&Ug;return 0===l.length?"y2"===c?dg.domain():cg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=sd(o,p),j=$b(cg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&ph&&(f=b(ph.top)?ph.top:e,g=b(ph.bottom)?ph.bottom:e),"y2"===c&&yh&&(f=b(yh.top)?yh.top:e,g=b(yh.bottom)?yh.bottom:e),Wd(l)&&!Oc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Zi),c=$b(bg.domain());return a||0===c?1:b/c}function Wb(a){return eh?eh:pf.min(a,function(a){return pf.min(a.values,function(a){return a.x})})}function Xb(a){return dh?dh:pf.max(a,function(a){return pf.max(a.values,function(a){return a.x})})}function Yb(a,c){var d,e,f,g,h=c[0],i=c[1],j=Math.abs(h-i);return pi?e=0:Wd(a)?(d=xc(),e=d>1?j/(d-1)/2:.5):e=.01*j,"object"==typeof fh&&qe(fh)?(f=b(fh.left)?fh.left:e,g=b(fh.right)?fh.right:e):f=g="number"==typeof fh?fh:e,{left:f,right:g}}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=0,g=0;return(c||0===c)&&(f=oi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=oi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bb?0:b-c}function fc(a){var b,c=dc(a),d="y"===a.axis?cg:dg;return b="y"===a.axis||"y2"===a.axis?Ug?Kf:"start"in a?d(a.start):Kf:Ug?"end"in a?bg(oi?le(a.end):a.end):Kf:Kf,c>b?0:b-c}function gc(a){return lg&&a===lg||qe(mg)&&re(mg,a)}function hc(a){return!gc(a)}function ic(a){return lg?lg:qe(mg)?mg[a]:null}function jc(a,b){var c,d=b&&qe(b)?zc(b):[];return d.forEach(function(b){ic(b)===a&&(c=qf.data.xs[b])}),c}function kc(a,b){return a in qf.data.xs&&qf.data.xs[a]&&qf.data.xs[a][b]?qf.data.xs[a][b]:b}function lc(a){Object.keys(a).forEach(function(b){mg[b]=a[b]})}function mc(a){return 1===pf.set(Object.keys(a).map(function(b){return a[b]})).size()}function nc(a){var b;return a&&(b=pg[a.id],a.name=b?b:a.id),a}function oc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=qc(b[d],a.id,d)}),qf.data.xs[a.id]=b})}function pc(a,b){a.forEach(function(a){b[a.id]&&oc([a],b[a.id])})}function qc(a,b,c){var d;return d=oi?a?a instanceof Date?a:le(a):le(kc(b,c)):qi&&!pi?a?+a:kc(b,c):c}function rc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?qf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):lg?(d=Object.keys(qf.data.xs),qf.data.xs[c]=d.length>0?qf.data.xs[d[0]]:void 0):qe(mg)&&(qf.data.xs[c]=jc(f,qf.data.targets)):qf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!qf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=og(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=ic(b),g=a[f],h=qc(g,b,e);return qi&&pi&&0===c&&g&&(0===e&&(Xg=[]),Xg.push(g)),("undefined"==typeof a[b]||qf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),tg&&Ud(zc(c).filter(function(a){return!(a in ug)}),tg),c.forEach(function(a){ac(a.id_org,a)}),c}function uc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function vc(a){return a>0&&qf.data.targets[0].values[a-1]?qf.data.targets[0].values[a-1].x:void 0}function wc(a){return a1?qf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?qf.data.targets[0]:null,a}function zc(a){return a.map(function(a){return a.id})}function Ac(a){return a?"string"==typeof a?[a]:a:zc(qf.data.targets)}function Bc(a,b){var c,d=zc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(oi?new Date(h):h);i.push(d)}return oi||(i=i.sort(function(a,b){return a-b})),i}function Ic(a){zi=zi.concat(a)}function Jc(a){zi=zi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){Ai=Ai.concat(a)}function Lc(a){Ai=Ai.filter(function(b){return a.indexOf(b)<0})}function Mc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Nc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Pc(a){return Nc(a,function(a){return a>0})}function Qc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(Ad(a,f))),a[g].x&&(e=e.concat(Ad(a,g))),Dd(e,b)):Bd(a,b,f,g)}function Cd(a,b){var c;return c=a.map(function(a){return Bd(a.values,b)}),Dd(c,b)}function Dd(a,b){var c,d;return a.forEach(function(a){var e=se(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Ed(a,b){return pf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Fd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Gd(){return wg&&"desc"===wg.toLowerCase()}function Hd(){return wg&&"asc"===wg.toLowerCase()}function Id(a){var b=Hd(),c=Gd();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof wg&&a.sort(wg),a}function Jd(a,c){var d,e,f,g,h,i,j,k=$d(qf.data.targets),l=k?ud:td,m=a.filter(function(a){return a&&b(a.value)});bi&&0!==m.length&&(Xi.html(ei(a,$(),l,wi)).style("display","block"),d=Xi.property("offsetWidth"),e=Xi.property("offsetHeight"),k?(g=If/2+c[0],i=Kf/2+c[1]+20):(Ug?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=bg(m[0].x)+20):(f=q(),g=f+t()+bg(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Xi.style("top",i+"px").style("left",g+"px"))}function Kd(){Xi.style("display","none")}function Ld(a){var c=a.filter(function(a){return a&&b(a.value)});bi&&(Xd(qf.data.targets)||$d(qf.data.targets)||Ui.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Ug?"y1":"x1",wd).attr(Ug?"y2":"x2",wd))}function Md(){Ui.select("line."+f.xgridFocus).style("visibility","hidden")}function Nd(a){return a.x||0===a.x?bg(a.x):null}function Od(a){return V(a.id)(a.value)}function Pd(){var a,b,d={},e=0;return Fc(Cc(be)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Td(a,b){return Nh?Nh:b?2*a.tickOffset()*Oh/b:0}function Ud(a,b){Ac(a).forEach(function(a){_i[a]=b===ug[a],ug[a]=b})}function Vd(a,b){var c=!1;return a.forEach(function(a){ug[a.id]===b&&(c=!0),a.id in ug||"line"!==b||(c=!0)}),c}function Wd(a){return Vd(a,"bar")}function Xd(a){return Vd(a,"scatter")}function Yd(a){return Vd(a,"pie")}function Zd(a){return Vd(a,"donut")}function $d(a){return Yd(a)||Zd(a)}function _d(a){var b="string"==typeof a?a:a.id;return!(b in ug)||"line"===ug[b]||"spline"===ug[b]||"area"===ug[b]||"area-spline"===ug[b]}function ae(a){var b="string"==typeof a?a:a.id;return"spline"===ug[b]||"area-spline"===ug[b]}function be(a){var b="string"==typeof a?a:a.id;return"bar"===ug[b]}function ce(a){var b="string"==typeof a?a:a.id;return"scatter"===ug[b]}function de(a){var b="string"==typeof a?a:a.id;return"pie"===ug[b]}function ee(a){var b="string"==typeof a?a:a.id;return"donut"===ug[b]}function fe(a){return de(a)||ee(a)}function ge(a){return be(a)?a.values:[]}function he(a){return _d(a)||ce(a)?a.values:[]}function ie(a){return be(a)||_d(a)?a.values:[]}function je(a){return ee(a)&&Xh||de(a)&&Rh}function ke(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function le(b){var c;try{c=ng?pf.time.format(ng).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ng)}return c}function me(a,b){var c=pf.mouse(a),d=pf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function re(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function se(a,b){var c="y"===Z(a.id)?cg:dg,d=Ug?1:0,e=Ug?0:1;return Math.pow(bg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function te(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function ue(a,b,c){Hg(b,a.node()),Ui.select("."+f.selectedCircles+id(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Rc(f.selectedCircle,c)}).attr("cx",Ug?Od:Nd).attr("cy",Ug?Nd:Od).attr("stroke",function(){return wi(b)}).attr("r",1.4*Lh).transition().duration(100).attr("r",Lh)}function ve(a,b,c){Ig(b,a.node()),Ui.select("."+f.selectedCircles+id(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a,b){Hg(b,a.node()),a.transition().duration(100).style("fill",function(){return pf.rgb(wi(b)).darker(1)})}function ye(a,b){Ig(b,a.node()),a.transition().duration(100).style("fill",function(){return wi(b)})}function ze(a,b,c,d){a?xe(b,c,d):ye(b,c,d)}function Ae(a){return a.filter(function(a){return b(a.value)})}function Be(a,c){return(c?Ui.selectAll("."+f.circles+id(c)):Ui).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ce(a,b){Be(a,b).classed(f.EXPANDED,!0).attr("r",Kh)}function De(a){Be(a).filter(function(){return pf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Hh)}function Ee(a){return Ui.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Fe(a){Ee(a).classed(f.EXPANDED,!0)}function Ge(a){Ee(a).classed(f.EXPANDED,!1)}function He(a,b){var c=Le(a,b);return function(a,b){var d=c(a,b),e=Ug?1:0,f=Ug?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function Ie(a,b){var c=Le(a,!1),d=b?Je:Ke;return function(a,b){return d(c(a,b),a,this)}}function Je(a,b){var c;return Ug?(c=be(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ke(a,b,c){var d=c.getBoundingClientRect();return Ug?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:be(b)?-3:-6)}function Le(a,b){var c=a.__max__+1,d=Td(hg,c),e=Qd(d,c,a,!!b),f=Rd(!!b),g=Sd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Ug&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Me(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function Ne(b){var c,d,e;if(Yi=pf.select(sf),Yi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Yi.html(""),Yi.classed("c3",!0),qf.data.xs={},qf.data.targets=tc(b),n(),R(),bg.domain(pf.extent(Zb(qf.data.targets))),cg.domain(Ub(qf.data.targets,"y")),dg.domain(Ub(qf.data.targets,"y2")),eg.domain(bg.domain()),fg.domain(cg.domain()),gg.domain(dg.domain()),Zi=bg.domain(),Ni.scale(eg),xf&&Ri.scale(bg),Si=Yi.append("svg").attr("width",If+Ff.left+Ff.right).attr("height",Kf+Ff.top+Ff.bottom).on("mouseenter",Af).on("mouseleave",Bf),Ti=Si.append("defs"),Ti.append("clipPath").attr("id",ii).append("rect").attr("width",If).attr("height",Kf),Ti.append("clipPath").attr("id",ji).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Ti.append("clipPath").attr("id",ki).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Ui=Si.append("g").attr("transform",Fi.main),Vi=Lg?Si.append("g").attr("transform",Fi.context):null,Wi=Si.append("g").attr("transform",Fi.legend),Og||(Wi.style("visibility","hidden"),Ai=zc(qf.data.targets)),Xi=pf.select(sf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),kf(zc(qf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Ui.append("g").attr("class",f.axisX).attr("clip-path",mi).attr("transform",Fi.x).append("text").attr("class",f.axisXLabel).attr("transform",Ug?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),ih&&Ui.append("g").attr("class",f.axisY).attr("clip-path",ni).attr("transform",Fi.y).append("text").attr("class",f.axisYLabel).attr("transform",Ug?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),rh&&Ui.append("g").attr("class",f.axisY2).attr("transform",Fi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Ug?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Ui.append("g").attr("clip-path",li).attr("class",f.grid),Ah&&d.append("g").attr("class",f.xgrids),qe(Ch)&&d.append("g").attr("class",f.xgridLines),Ih&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Dh&&d.append("g").attr("class",f.ygrids),qe(Eh)&&d.append("g").attr("class",f.ygridLines),Ui.append("g").attr("clip-path",li).attr("class",f.regions),Ui.append("g").attr("clip-path",li).attr("class",f.chart),c=Ui.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",xf?Ug?"ns-resize":"ew-resize":null),Ui.select("."+f.chart).append("g").attr("class",f.chartBars),Ui.select("."+f.chart).append("g").attr("class",f.chartLines),Ui.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Fi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Ui.select("."+f.chart).append("g").attr("class",f.chartTexts),xf&&Ui.insert("rect",zf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",If).attr("height",Kf).style("opacity",0).style("cursor",Ug?"ns-resize":"ew-resize").call(Ri).on("dblclick.zoom",null),gh&&Ni.extent("function"!=typeof gh?gh:gh(Zb())),Lg&&(Vi.append("g").attr("clip-path",li).attr("class",f.chart),Vi.select("."+f.chart).append("g").attr("class",f.chartBars),Vi.select("."+f.chart).append("g").attr("class",f.chartLines),Vi.append("g").attr("clip-path",li).attr("class",f.brush).call(Ni).selectAll("rect").attr(Ug?"width":"height",Ug?Jf:Lf),Vi.append("g").attr("class",f.axisX).attr("transform",Fi.subx).attr("clip-path",Ug?"":mi)),$e(qf.data.targets),Ug?Ui.select("."+f.axisX).style("opacity",0).call(hg):(Ui.select("."+f.axisY).style("opacity",0).call(ig),Ui.select("."+f.axisY2).style("opacity",0).call(jg)),Ue({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),fi){if(oi&&"string"==typeof gi){for(gi=le(gi),e=0;e0){d=[];for(var g in pg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Fd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=ze,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function Se(a){$d(qf.data.targets)||Ag&&(ri=a,Ui.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),si=!0,Jg())}function Te(){$d(qf.data.targets)||Ag&&(Ui.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Ui.selectAll("."+f.shape).classed(f.INCLUDED,!1),si=!1,Kg())}function Ue(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Pd(),U=$d(qf.data.targets),V=Fc(qf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?Ef:0,O=B?N:0,P=C?N:0,H&&Og&&kf(zc(qf.data.targets),a),G&&(bg.domain(pf.extent(Zb(V))),Zi=bg.domain(),xf&&Ri.scale(bg).updateScaleExtent(),eg.domain(bg.domain()),Ni.scale(eg)),F&&(bg.domain(Ni.empty()?Zi:Ni.extent()),xf&&Ri.scale(bg).updateScaleExtent()),cg.domain(Ub(V,"y")),dg.domain(Ub(V,"y2")),(bh||ah)&&(Q=ch?ch:Hc(Gc(V)),hg.tickValues(Q),kg.tickValues(Q)),c=Ui.select("."+f.axisX).style("opacity",U?0:1),(Ug||D)&&(c=c.transition().duration(P)),c.call(hg),e=Ui.select("."+f.axisY).style("opacity",U?0:1),(!Ug||D)&&(e=e.transition().duration(P)),e.call(ig),Ui.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(jg),F)if($g&&Q){for(R=1;R=0&&pf.select(this).style("display",b%S?"none":"block")})}else pf.selectAll("."+f.axisX+" .tick text").style("display","block");if(I=He(T),K=Ie(T,!0),M=Ie(T,!1),Ab(),fg.domain(cg.domain()),gg.domain(dg.domain()),Xi.style("display","none"),o(),Ui.select("line."+f.xgridFocus).style("visibility","hidden"),Ah){if("year"===Bh){h=[];for(var W=Zb(),X=W[0].getFullYear(),Y=W[1].getFullYear(),Z=X;Y>=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=bg.ticks(10);g=Ui.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Ug?0:function(a){return bg(a)-hg.tickOffset()}).attr("x2",Ug?If:function(a){return bg(a)-hg.tickOffset()}).attr("y1",Ug?function(a){return bg(a)-hg.tickOffset()}:Ff.top).attr("y2",Ug?function(a){return bg(a)-hg.tickOffset()}:Kf).style("opacity",function(){return+pf.select(this).attr(Ug?"y1":"x1")===(Ug?Kf:0)?0:1}),g.exit().remove()}qe(Ch)&&(i=Ui.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Ch),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Ug?"":"rotate(-90)").attr("dx",Ug?0:-Ff.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Ug?0:xd).attr("x2",Ug?If:xd).attr("y1",Ug?xd:Ff.top).attr("y2",Ug?xd:Kf).style("opacity",1),i.select("text").transition().duration(N).attr("x",Ug?If:0).attr("y",xd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&Dh&&(k=Ui.select("."+f.ygrids).selectAll("."+f.ygrid).data(cg.ticks(Fh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Ug?cg:0).attr("x2",Ug?cg:If).attr("y1",Ug?0:cg).attr("y2",Ug?Kf:cg),k.exit().remove()),y&&qe(Eh)&&(l=Ui.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Eh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Ug?"rotate(-90)":"").attr("dx",Ug?0:-Ff.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Ug?yd:0).attr("x2",Ug?yd:If).attr("y1",Ug?0:yd).attr("y2",Ug?Kf:yd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Ug?0:If).attr("y",yd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Ui.selectAll("."+f.bars).selectAll("."+f.bar).data(ge),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return wi(a)}).attr("class",Zc),p.style("opacity",nd).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Ui.selectAll("."+f.texts).selectAll("."+f.text).data(ie),r.enter().append("text").attr("class",Sc).attr("text-anchor",function(a){return Ug?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return vd(a.id)(a.value)}).style("fill-opacity",od).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",qd),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Ui.selectAll("."+f.line).style("opacity",nd).transition().duration(N).attr("d",Oi).style("opacity",1),Ui.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Pi).style("opacity",$i),n=Ui.selectAll("."+f.circles).selectAll("."+f.circle).data(he),n.enter().append("circle").attr("class",Xc).style("opacity",0).attr("r",Hh),n.style("opacity",nd).transition().duration(N).style("opacity",pd).attr("cx",Ug?Od:Nd).attr("cy",Ug?Nd:Od),n.exit().remove(),Ui.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=pf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Ui.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Dc(a.data.id)&&fe(a.data)?1:0}),Ui.select("."+f.chartArcsTitle).style("opacity",Zd(qf.data.targets)?1:0),Lg&&(null!==pf.event&&"zoom"===pf.event.type&&Ni.extent(bg.orgDomain()).update(),z&&(Vi.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(kg),Ni.empty()||Ni.extent(bg.orgDomain()).update(),J=He(T,!0),s=Vi.selectAll("."+f.bars).selectAll("."+f.bar).data(ge),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return wi(a)}).attr("class",Zc),s.style("opacity",nd).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Vi.selectAll("."+f.line).style("opacity",nd).transition().duration(N).attr("d",Qi).style("opacity",1))),Ui.selectAll("."+f.selectedCircles).filter(function(a){return be(a)}).selectAll("circle").remove(),Ui.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Ug?Od:Nd).attr("cy",Ug?Nd:Od),t=Ui.select("."+f.eventRects),qe(mg)&&!mc(mg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Ui.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Pe(u.enter()),u.attr("x",0).attr("y",0).attr("width",If).attr("height",Kf)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),qi&&!pi?(x=function(a,b){var c=vc(b),d=wc(b),e=qf.data.xs[a.id][b];return(bg(d?d:e+50)-bg(c?c:e-50))/2},w=function(a,b){var c=vc(b),d=qf.data.xs[a.id][b];return(bg(d)+bg(c?c:d-50))/2}):(x=L(),w=function(a){return bg(a.x)-x/2}),v=yc(),Ui.select("."+f.eventRects).datum(v?v.values:[]),u=Ui.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Oe(u.enter()),u.attr("class",cd).attr("x",Ug?0:w).attr("y",Ug?w:0).attr("width",Ug?If:x).attr("height",Ug?x:Kf),u.exit().remove()),q=Ui.select("."+f.regions).selectAll("rect."+f.region).data(ai),q.enter().append("rect").style("fill-opacity",0),q.attr("class",bd).attr("x",cc).attr("y",dc).attr("width",ec).attr("height",fc).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),zc(qf.data.targets).forEach(function(a){_i[a]=!0})}}function Ve(){Ue({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function We(){return"mousemove"===pf.event.sourceEvent.type&&Ri.altDomain?(bg.domain(Ri.altDomain),void Ri.scale(bg).updateScaleExtent()):(pi&&bg.orgDomain()[0]===Zi[0]&&bg.domain([Zi[0]-1e-10,bg.orgDomain()[1]]),Ue({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===pf.event.sourceEvent.type&&(ti=!0)))}function Xe(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ye(){Si.attr("width",Mf).attr("height",Nf),Si.select("#"+ii).select("rect").attr("width",If).attr("height",Kf),Si.select("#"+ji).select("rect").attr("width",H),Si.select("#"+ki).select("rect").attr("width",J),Si.select("."+f.zoomRect).attr("width",If).attr("height",Kf)}function Ze(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Ye(),m(a.withTransition),Ue(a)}function $e(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Ui.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",ed),j=i.enter().append("g").attr("class",ed).style("pointer-events","none"),j.append("g").attr("class",Tc).style("fill",function(a){return wi(a)}),e=Ui.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",gd),d=e.enter().append("g").attr("class",gd).style("pointer-events","none"),d.append("g").attr("class",$c).style("fill",function(a){return wi(a)}).style("stroke","none").style("cursor",function(a){return Cg(a)?"pointer":null}),c=Ui.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",fd),b=c.enter().append("g").attr("class",fd).style("pointer-events","none"),b.append("path").attr("class",Wc).style("opacity",0).style("stroke",function(a){return wi(a)}),b.append("path").attr("class",ad).style("opacity",function(){return $i=+pf.select(this).style("opacity"),0}).style("fill",function(a){return wi(a)}),b.append("g").attr("class",function(a){return Rc(f.selectedCircles,a.id)}),b.append("g").attr("class",Yc).style("fill",function(a){return wi(a)}).style("cursor",function(a){return Cg(a)?"pointer":null}),a.forEach(function(a){Ui.selectAll("."+f.selectedCircles+id(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Ui.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Uf(a)).attr("class",hd),g=h.enter().append("g").attr("class",hd),g.append("path").attr("class",_c).style("opacity",0).style("fill",function(a){return wi(a.data)}).style("cursor",function(a){return Cg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),ef(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Jd(c,pf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),gf(),Kd(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Lg&&(n=Vi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",gd),m=n.enter().append("g").attr("class",gd),m.append("g").attr("class",$c).style("fill",function(a){return wi(a)}),l=Vi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",fd),k=l.enter().append("g").attr("class",fd),k.append("path").attr("class",Wc).style("opacity",0).style("stroke",function(a){return wi(a)})),Si.selectAll("."+f.target).filter(function(a){return Dc(a.id)}).transition().style("opacity",1)}function _e(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Ud(a.id,b.types[a.id]):Ud(a.id,b.type)}),qf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Gi?j:i,l=Gi?Q():P();return d&&(w=0,C=0,t=0,u=0),Og&&!Ec(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Gi?u:t,void(Tg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,Gi?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Wi.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Rc(f.legendItem,a)}).style("visibility",function(a){return Ec(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Qg?Qg(a):qf.toggle(a)}).on("mouseover",function(a){qf.focus(a),"function"==typeof Rg&&Rg(a)}).on("mouseout",function(a){qf.revert(),"function"==typeof Sg&&Sg(a)}),l.append("text").text(function(a){return d(pg[a])?pg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",Gi?g:-200).attr("y",Gi?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Gi?h:-200).attr("y",Gi?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return wi(a)}).attr("x",Gi?g:-200).attr("y",Gi?-200:i).attr("width",10).attr("height",10),Wi.selectAll("text").data(a).text(function(a){return d(pg[a])?pg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Wi.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Wi.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Ye(),q&&m(p)}function lf(a){return Bc(qf.data.targets,a.id)}function mf(a){return"data"in a&&Bc(qf.data.targets,a.data.id)}function nf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function of(a,b,c){var d=!$d(qf.data.targets);Ud(a,b),Ze(c?c:{withTransitionForAxis:d})}var pf=a.d3?a.d3:a.require?a.require("d3"):void 0,qf={data:{},axis:{},legend:{}},rf={},sf=h(["bindto"],"#chart"),tf=h(["size","width"]),uf=h(["size","height"]),vf=h(["padding","left"]),wf=h(["padding","right"]),xf=h(["zoom","enabled"],!1),yf=h(["zoom","extent"]),zf=h(["zoom","privileged"],!1),Af=h(["onenter"],function(){}),Bf=h(["onleave"],function(){}),Cf=h(["onresize"],function(){}),Df=h(["onresized"],function(){}),Ef=h(["transition","duration"],350);g("data","data is required in config");var Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg=h(["data","x"]),mg=h(["data","xs"],{}),ng=h(["data","x_format"]),og=h(["data","id_converter"],function(a){return a}),pg=h(["data","names"],{}),qg=h(["data","classes"],{}),rg=h(["data","groups"],[]),sg=h(["data","axes"],{}),tg=h(["data","type"]),ug=h(["data","types"],{}),vg=h(["data","labels"],{}),wg=h(["data","order"]),xg=h(["data","regions"],{}),yg=h(["data","color"]),zg=h(["data","colors"],{}),Ag=h(["data","selection","enabled"],!1),Bg=h(["data","selection","grouped"],!1),Cg=h(["data","selection","isselectable"],function(){return!0}),Dg=h(["data","selection","multiple"],!0),Eg=h(["data","onclick"],function(){}),Fg=h(["data","onenter"],function(){}),Gg=h(["data","onleave"],function(){}),Hg=h(["data","onselected"],function(){}),Ig=h(["data","onunselected"],function(){}),Jg=h(["data","ondragstart"],function(){}),Kg=h(["data","ondragend"],function(){}),Lg=h(["subchart","show"],!1),Mg=Lg?h(["subchart","size","height"],60):0,Ng=h(["color","pattern"],[]),Og=h(["legend","show"],!0),Pg=h(["legend","position"],"bottom"),Qg=h(["legend","item","onclick"]),Rg=h(["legend","item","onmouseover"]),Sg=h(["legend","item","onmouseout"]),Tg=h(["legend","equally"],!1),Ug=h(["axis","rotated"],!1),Vg=h(["axis","x","type"],"indexed"),Wg=h(["axis","x","localtime"],!0),Xg=h(["axis","x","categories"],[]),Yg=h(["axis","x","tick","centered"],!1),Zg=h(["axis","x","tick","format"]),$g=h(["axis","x","tick","culling"],{}),_g=h(["axis","x","tick","culling","max"],10),ah=h(["axis","x","tick","count"]),bh=h(["axis","x","tick","fit"],!0),ch=h(["axis","x","tick","values"],null),dh=h(["axis","x","max"]),eh=h(["axis","x","min"]),fh=h(["axis","x","padding"],{}),gh=h(["axis","x","default"]),hh=h(["axis","x","label"],{}),ih=h(["axis","y","show"],!0),jh=h(["axis","y","max"]),kh=h(["axis","y","min"]),lh=h(["axis","y","center"]),mh=h(["axis","y","label"],{}),nh=h(["axis","y","inner"],!1),oh=h(["axis","y","tick","format"]),ph=h(["axis","y","padding"],{}),qh=h(["axis","y","ticks"],10),rh=h(["axis","y2","show"],!1),sh=h(["axis","y2","max"]),th=h(["axis","y2","min"]),uh=h(["axis","y2","center"]),vh=h(["axis","y2","label"],{}),wh=h(["axis","y2","inner"],!1),xh=h(["axis","y2","tick","format"]),yh=h(["axis","y2","padding"],{}),zh=h(["axis","y2","ticks"],10),Ah=h(["grid","x","show"],!1),Bh=h(["grid","x","type"],"tick"),Ch=h(["grid","x","lines"],[]),Dh=h(["grid","y","show"],!1),Eh=h(["grid","y","lines"],[]),Fh=h(["grid","y","ticks"],10),Gh=h(["point","show"],!0),Hh=Gh?h(["point","r"],2.5):0,Ih=h(["point","focus","line","enabled"],!0),Jh=h(["point","focus","expand","enabled"],!0),Kh=h(["point","focus","expand","r"],Jh?4:Hh),Lh=h(["point","focus","select","r"],8),Mh=h(["line","connect_null"],!1),Nh=h(["bar","width"]),Oh=h(["bar","width","ratio"],.6),Ph=h(["pie","label","show"],!0),Qh=h(["pie","label","format"]),Rh=h(["pie","expand"],!0),Sh=h(["pie","onclick"],function(){}),Th=h(["pie","onmouseover"],function(){}),Uh=h(["pie","onmouseout"],function(){}),Vh=h(["donut","label","show"],!0),Wh=h(["donut","label","format"]),Xh=h(["donut","expand"],!0),Yh=h(["donut","title"],""),Zh=h(["donut","onclick"],function(){}),$h=h(["donut","onmouseover"],function(){}),_h=h(["donut","onmouseout"],function(){}),ai=h(["regions"],[]),bi=h(["tooltip","show"],!0),ci=h(["tooltip","format","title"]),di=h(["tooltip","format","value"]),ei=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ci?ci:b,l=di?di:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),fi=h(["tooltip","init","show"],!1),gi=h(["tooltip","init","x"],0),hi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ii=("string"==typeof sf?sf.replace("#",""):sf.id)+"-clip",ji=ii+"-xaxis",ki=ii+"-yaxis",li=i(ii),mi=i(ji),ni=i(ki),oi="timeseries"===Vg,pi="categorized"===Vg,qi=!oi&&(lg||qe(mg)),ri=null,si=!1,ti=!1,ui=!1,vi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],wi=ke(zg,qe(Ng)?Ng:vi,yg),xi=Wg?pf.time.format:pf.time.format.utc,yi=function(){var a=[[xi("%Y/%-m/%-d"),function(){return!0}],[xi("%-m/%-d"),function(a){return a.getMonth()}],[xi("%-m/%-d"),function(a){return 1!==a.getDate()}],[xi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[xi("%I %p"),function(a){return a.getHours()}],[xi("%I:%M"),function(a){return a.getMinutes()}],[xi(":%S"),function(a){return a.getSeconds()}],[xi(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),zi=[],Ai=[],Bi=Ug?"left":"bottom",Ci=Ug?nh?"top":"bottom":nh?"right":"left",Di=Ug?wh?"bottom":"top":wh?"left":"right",Ei=Ug?"left":"bottom",Fi={main:function(){return"translate("+Ff.left+","+Ff.top+")"},context:function(){return"translate("+Gf.left+","+Gf.top+")"},legend:function(){return"translate("+Hf.left+","+Hf.top+")"},x:function(){return"translate(0,"+(Ug?0:Kf)+")"},y:function(){return"translate(0,"+(Ug?Kf:0)+")"},y2:function(){return"translate("+(Ug?0:If)+","+(Ug?1:0)+")"},subx:function(){return"translate(0,"+(Ug?0:Lf)+")"},arc:function(){return"translate("+If/2+","+Kf/2+")"}},Gi="right"===Pg,Hi=0,Ii=0,Ji=0,Ki=30,Li=30,Mi=5;Uf=pf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Ni,Oi=function(){var a=pf.svg.line().x(Ug?function(a){return V(a.id)(a.value)}:wd).y(Ug?wd:function(a){return V(a.id)(a.value)});return Mh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Mh?Ae(b.values):b.values;return _d(b)?(a.interpolate(ae(b)?"cardinal":"linear"),xg[b.id]?Me(e,bg,V(b.id),xg[b.id]):a(e)):(c=e[0]?bg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ug?"M "+d+" "+c:"M "+c+" "+d)}}(),Pi=function(){var a;return a=Ug?pf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(wd):pf.svg.area().x(wd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ae(b.values);return Vd([b],"area")||Vd([b],"area-spline")?(a.interpolate(ae(b)?"cardinal":"linear"),a(e)):(c=e[0]?bg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Ug?"M "+d+" "+c:"M "+c+" "+d)}}(),Qi=function(){var a=pf.svg.line().x(Ug?function(a){return W(a.id)(a.value)}:zd).y(Ug?zd:function(a){return W(a.id)(a.value)});return function(b){var c=Ae(b.values);return _d(b)?a(c):"M "+eg(c[0].x)+" "+W(b.id)(c[0].value)}}(),Ri=function(){};Ni=pf.svg.brush().on("brush",Ve),Ni.update=function(){return Vi&&Vi.select("."+f.brush).call(this),this},Ni.scale=function(a){return Ug?this.y(a):this.x(a)},xf&&(Ri=pf.behavior.zoom().on("zoomstart",function(){Ri.altDomain=pf.event.sourceEvent.altKey?bg.orgDomain():null}).on("zoom",xf?We:null),Ri.scale=function(a){return Ug?this.y(a):this.x(a)},Ri.orgScaleExtent=function(){var a=yf?yf:[1,10];return[a[0],Math.max(xc()/a[1],a[1])]},Ri.updateScaleExtent=function(){var a=$b(bg.orgDomain())/$b(Zi),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Si,Ti,Ui,Vi,Wi,Xi,Yi,Zi,$i,_i={};if(qf.focus=function(a){function b(a){Fc(a).transition().duration(100).style("opacity",1)}var c=Si.selectAll(jd(a)),d=c.filter(lf),e=c.filter(mf);qf.revert(),qf.defocus(),b(d.classed(f.focused,!0)),b(e),$d(qf.data.targets)&&Kb(a,!0),ef(a)},qf.defocus=function(a){function b(a){Fc(a).transition().duration(100).style("opacity",.3)}var c=Si.selectAll(jd(a)),d=c.filter(lf),e=c.filter(mf);qf.revert(),b(d.classed(f.focused,!1)),b(e),$d(qf.data.targets)&&Lb(a),ff(a)},qf.revert=function(a){function b(a){Fc(a).transition().duration(100).style("opacity",1)}var c=Si.selectAll(jd(a)),d=c.filter(lf),e=c.filter(mf);b(d.classed(f.focused,!1)),b(e),$d(qf.data.targets)&&Lb(a),gf()},qf.show=function(a,b){a=Ac(a),b=b||{},Jc(a),Si.selectAll(kd(a)).transition().style("opacity",1),b.withLegend?hf(a):Wi.selectAll(md(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},qf.hide=function(a,b){a=Ac(a),b=b||{},Ic(a),Si.selectAll(kd(a)).transition().style("opacity",0),b.withLegend?jf(a):Wi.selectAll(md(a)).classed(f.legendItemHidden,!0).transition().style("opacity",.5),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},qf.toggle=function(a){Dc(a)?qf.hide(a):qf.show(a)},qf.unzoom=function(){Ni.clear().update(),Ue({withUpdateXDomain:!0})},qf.load=function(a){return a.xs&&lc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){qg[b]=a.classes[b]}),"categories"in a&&pi&&(Xg=a.categories,hg.categories(Xg)),"cacheIds"in a&&_b(a.cacheIds)?void _e(bc(a.cacheIds),a.done):void("unload"in a?bf(Ac("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){af(a)}):af(a))},qf.unload=function(a){bf(Ac(a),function(){Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},qf.selected=function(a){return pf.merge(Ui.selectAll("."+f.shapes+id(a)).selectAll("."+f.shape).filter(function(){return pf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},qf.select=function(a,b,c){Ag&&Ui.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=pf.select(this),i="circle"===this.nodeName?ue:xe,j="circle"===this.nodeName?ve:ye,k=Bg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Cg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},qf.unselect=function(a,b){Ag&&Ui.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=pf.select(this),g="circle"===this.nodeName?ve:ye,h=Bg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Cg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},qf.toLine=function(a){of(a,"line")},qf.toSpline=function(a){of(a,"spline")},qf.toBar=function(a){of(a,"bar")},qf.toScatter=function(a){of(a,"scatter")},qf.toArea=function(a){of(a,"area")},qf.toAreaSpline=function(a){of(a,"area-spline")},qf.toPie=function(a){of(a,"pie",{withTransform:!0})},qf.toDonut=function(a){of(a,"donut",{withTransform:!0})},qf.groups=function(a){return c(a)?rg:(rg=a,Ue(),rg)},qf.xgrids=function(a){return a?(Ch=a,Ue(),Ch):Ch},qf.xgrids.add=function(a){return a?qf.xgrids(Ch.concat(a)):void 0},qf.xgrids.remove=function(a){var b=nf(a);return qf.xgrids(Ch.filter(b))},qf.ygrids=function(a){return a?(Eh=a,Ue(),Eh):Eh},qf.ygrids.add=function(a){return a?qf.ygrids(Eh.concat(a)):void 0},qf.ygrids.remove=function(a){var b=nf(a);return qf.ygrids(Eh.filter(b))},qf.regions=function(a){return c(a)?ai:(ai=a,Ue(),ai)},qf.regions.add=function(a){return c(a)?ai:(ai=ai.concat(a),Ue(),ai)},qf.regions.remove=function(a,c){var e=[].concat(a);return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0; -Si.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ai=ai.filter(function(b){return b.classes.indexOf(a)<0})}),ai},qf.data.get=function(a){var b=qf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},qf.data.getAsTarget=function(a){var b=Cc(function(b){return b.id===a});return b.length>0?b[0]:void 0},qf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){pg[b]=a[b]}),kf(zc(qf.data.targets),{withTransition:!0}),pg):pg},qf.x=function(a){return arguments.length&&(oc(qf.data.targets,a),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),qf.data.xs},qf.xs=function(a){return arguments.length&&(pc(qf.data.targets,a),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),qf.data.xs},qf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},qf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(jh=+a.y),b(a.y2)&&(sh=+a.y2)):jh=sh=+a,Ue())},qf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(kh=+a.y),b(a.y2)&&(th=+a.y2)):kh=th=+a,Ue())},qf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&qf.axis.max(a.max),"undefined"!=typeof a.min&&qf.axis.min(a.min))},qf.legend.show=function(a){Og||(Og=!0,Wi.style("visibility","visible")),hf(Ac(a)),Ue({withTransitionForHorizontalAxis:!1})},qf.legend.hide=function(a){Og&&pe(a)&&(Og=!1,Wi.style("visibility","hidden")),jf(Ac(a)),Ue({withTransitionForHorizontalAxis:!1})},qf.resize=function(a){tf=a?a.width:null,uf=a?a.height:null,Ze({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},qf.destroy=function(){qf.data.targets=void 0,qf.data.xs={},Yi.html(""),a.onresize=null},"url"in e.data)pf.xhr(e.data.url,function(a,b){var c,d=pf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=pf.csv.parse(b.response),Ne(c)});else if("rows"in e.data)Ne(rc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ne(sc(e.data.columns))}return qf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file +!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.31"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cJf&&(Jf=0),0>Lf&&(Lf=0),Hf={top:Vg?Gf.top:Of-Ng-(Hi?0:a),right:0/0,bottom:20+(Hi?0:a),left:Vg?Mi:Gf.left},Kf=Vg?Gf.left-Mi-Ni:Jf,Mf=Vg?Lf:Of-Hf.top-Hf.bottom,0>Kf&&(Kf=0),0>Mf&&(Mf=0),If={top:Hi?0:Of-a,right:0/0,bottom:0,left:Hi?Nf-b:0},p(),Hi&&$d(rf.data.targets)&&(If.left=Jf/2+Qf)}function o(){Wi.select("line."+f.xgridFocus).attr("x1",Vg?0:-10).attr("x2",Vg?Jf:-10).attr("y1",Vg?-10:Gf.top).attr("y2",Vg?-10:Lf)}function p(){Qf=Lf/2,Pf=.95*Qf,Rf=Zd(rf.data.targets)?.6*Pf:0}function q(){var a=Vg?f.axisX:f.axisY,b=qf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=qf.select(tf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return uf?uf:x()}function s(){var a=vf?vf:y();return a>0?a:320}function t(){return $d(rf.data.targets)?0:wf?wf:Vg||!jh||oh?1:v("y")}function u(){var a=1;return $d(rf.data.targets)?0:xf?xf:Hi?P()+(sh&&!Vg?v("y2"):a):sh?xh||Vg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||jh?"y2"!==a||sh?(gb(a).isInner?30:40)+("y2"===a?-10:0):Oi:Pg&&!Hi?10:1}function x(){return+qf.select(tf).style("width").replace("px","")}function y(){return+qf.select(tf).style("height").replace("px","")}function z(a){return a?-5:-(Gf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Vg)}function C(){return A(!Vg)}function D(){return z(Vg)}function E(){return A(Vg)}function F(a){return a?Jf+2+4:Gf.left+20}function G(a){return a?80:Lf+2}function H(){return F(!Vg)}function I(){return G(!Vg)}function J(){return F(Vg)}function K(){return G(Vg)}function L(){var a=Vg?Lf:Jf,b=xc(),c=Vb()*(Wd(rf.data.targets)?(b-(qi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){Ii=a}function N(a){Ji=a}function O(a){Ki=a}function P(){return Pg?Hi?Ji*(Ii+1):Nf:0}function Q(){return Pg?Hi?Of:Ki*(Ii+1):0}function R(){var a,b=!cg;Wf=Vg?1:0,Xf=Vg?Lf:Jf,Yf=Vg?0:Lf,Zf=Vg?Jf:1,$f=Wf,_f=Xf,ag=Vg?0:Mf,bg=Vg?Kf:1,cg=T(Wf,Xf,b?void 0:cg.domain(),function(){return ig.tickOffset()}),dg=U(Yf,Zf),eg=U(Yf,Zf),fg=T(Wf,Xf,_i,function(a){return a%1?0:lg.tickOffset()}),gg=U(ag,bg),hg=U(ag,bg),a=$(),ig=X(cg,Ci,a),lg=X(fg,Fi,a),jg=Y(dg,Di,ph,rh),kg=Y(eg,Ei,yh,Ah),b||(Pi.scale(fg),yf&&Ti.scale(cg)),S()}function S(){Sf=Db(),Tf=Eb(),Uf=Eb(.98)}function T(a,b,e,f){var g=(pi?qf.time.scale():qf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),qi){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return qf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?eg:dg}function W(a){return"y2"===Z(a)?hg:gg}function X(a,b,c){var d=(qi?Bb():qf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),qi?(d.tickCentered(Zg),pe(_g)&&(_g=!1)):d.tickOffset=function(){var a=Vg?Lf:Jf;return a*Vb()/xc()/2},qi&&d.categories(Yg),d}function Y(a,b,c,d){return qf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in tg?tg[a]:"y"}function $(){var a=pi?zi:qi?Qc:function(a){return 0>a?a.toFixed(0):a};return $g&&("function"==typeof $g?a=$g:pi&&(a=function(a){return a?yi($g)(a):""})),a}function _(a){var b;return"y"===a?b=nh:"y2"===a?b=wh:"x"===a&&(b=ih),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?nh=b:"y2"===a?wh=b:"x"===a&&(ih=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Vg?"inner-top":"inner-right")}function eb(){return cb("y",Vg?"inner-right":"inner-top")}function fb(){return cb("y2",Vg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?Jf/2:Jf:b.isBottom?-Lf:b.isMiddle?-Lf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Vg,db())}function ob(){return kb(Vg,eb())}function pb(){return kb(Vg,fb())}function qb(){return lb(!Vg,db())}function rb(){return lb(Vg,eb())}function sb(){return lb(Vg,fb())}function tb(){var a=db();return Vg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Vg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Vg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Vg,db())}function xb(){return mb(Vg,eb())}function yb(){return mb(Vg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return qf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Wi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Wi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Wi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+o)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Oc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return qf.min(Object.keys(i).map(function(a){return qf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=zc(a),i=Mc(a);if(sg.length>0)for(g=Pc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return qf.max(Object.keys(i).map(function(a){return qf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?uh:lh,n="y2"===c?th:kh,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?vh:mh,r=rd()&&Vg;return 0===l.length?"y2"===c?eg.domain():dg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=sd(o,p),j=$b(dg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&qh&&(f=b(qh.top)?qh.top:e,g=b(qh.bottom)?qh.bottom:e),"y2"===c&&zh&&(f=b(zh.top)?zh.top:e,g=b(zh.bottom)?zh.bottom:e),Wd(l)&&!Oc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(_i),c=$b(cg.domain());return a||0===c?1:b/c}function Wb(a){return fh?fh:qf.min(a,function(a){return qf.min(a.values,function(a){return a.x})})}function Xb(a){return eh?eh:qf.max(a,function(a){return qf.max(a.values,function(a){return a.x})})}function Yb(a,c){var d,e,f,g,h=c[0],i=c[1],j=Math.abs(h-i);return qi?e=0:Wd(a)?(d=xc(),e=d>1?j/(d-1)/2:.5):e=.01*j,"object"==typeof gh&&qe(gh)?(f=b(gh.left)?gh.left:e,g=b(gh.right)?gh.right:e):f=g="number"==typeof gh?gh:e,{left:f,right:g}}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=0,g=0;return(c||0===c)&&(f=pi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=pi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bb?0:b-c}function fc(a){var b,c=dc(a),d="y"===a.axis?dg:eg;return b="y"===a.axis||"y2"===a.axis?Vg?Lf:"start"in a?d(a.start):Lf:Vg?"end"in a?cg(pi?le(a.end):a.end):Lf:Lf,c>b?0:b-c}function gc(a){return mg&&a===mg||qe(ng)&&re(ng,a)}function hc(a){return!gc(a)}function ic(a){return mg?mg:qe(ng)?ng[a]:null}function jc(a,b){var c,d=b&&qe(b)?zc(b):[];return d.forEach(function(b){ic(b)===a&&(c=rf.data.xs[b])}),c}function kc(a,b){return a in rf.data.xs&&rf.data.xs[a]&&rf.data.xs[a][b]?rf.data.xs[a][b]:b}function lc(a){Object.keys(a).forEach(function(b){ng[b]=a[b]})}function mc(a){return 1===qf.set(Object.keys(a).map(function(b){return a[b]})).size()}function nc(a){var b;return a&&(b=qg[a.id],a.name=b?b:a.id),a}function oc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=qc(b[d],a.id,d)}),rf.data.xs[a.id]=b})}function pc(a,b){a.forEach(function(a){b[a.id]&&oc([a],b[a.id])})}function qc(a,b,c){var d;return d=pi?a?a instanceof Date?a:le(a):le(kc(b,c)):ri&&!qi?a?+a:kc(b,c):c}function rc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?rf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):mg?(d=Object.keys(rf.data.xs),rf.data.xs[c]=d.length>0?rf.data.xs[d[0]]:void 0):qe(ng)&&(rf.data.xs[c]=jc(f,rf.data.targets)):rf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!rf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=pg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=ic(b),g=a[f],h=qc(g,b,e);return ri&&qi&&0===c&&g&&(0===e&&(Yg=[]),Yg.push(g)),("undefined"==typeof a[b]||rf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),ug&&Ud(zc(c).filter(function(a){return!(a in vg)}),ug),c.forEach(function(a){ac(a.id_org,a)}),c}function uc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function vc(a){return a>0&&rf.data.targets[0].values[a-1]?rf.data.targets[0].values[a-1].x:void 0}function wc(a){return a1?rf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?rf.data.targets[0]:null,a}function zc(a){return a.map(function(a){return a.id})}function Ac(a){return a?"string"==typeof a?[a]:a:zc(rf.data.targets)}function Bc(a,b){var c,d=zc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(pi?new Date(h):h);i.push(d)}return pi||(i=i.sort(function(a,b){return a-b})),i}function Ic(a){Ai=Ai.concat(a)}function Jc(a){Ai=Ai.filter(function(b){return a.indexOf(b)<0})}function Kc(a){Bi=Bi.concat(a)}function Lc(a){Bi=Bi.filter(function(b){return a.indexOf(b)<0})}function Mc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Nc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Pc(a){return Nc(a,function(a){return a>0})}function Qc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(Ad(a,f))),a[g].x&&(e=e.concat(Ad(a,g))),Dd(e,b)):Bd(a,b,f,g)}function Cd(a,b){var c;return c=a.map(function(a){return Bd(a.values,b)}),Dd(c,b)}function Dd(a,b){var c,d;return a.forEach(function(a){var e=se(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Ed(a,b){return qf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Fd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Gd(){return xg&&"desc"===xg.toLowerCase()}function Hd(){return xg&&"asc"===xg.toLowerCase()}function Id(a){var b=Hd(),c=Gd();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof xg&&a.sort(xg),a}function Jd(a,c){var d,e,f,g,h,i,j,k=$d(rf.data.targets),l=k?ud:td,m=a.filter(function(a){return a&&b(a.value)});ci&&0!==m.length&&(Zi.html(fi(a,$(),l,xi)).style("display","block"),d=Zi.property("offsetWidth"),e=Zi.property("offsetHeight"),k?(g=Jf/2+c[0],i=Lf/2+c[1]+20):(Vg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=cg(m[0].x)+20):(f=q(),g=f+t()+cg(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Zi.style("top",i+"px").style("left",g+"px"))}function Kd(){Zi.style("display","none")}function Ld(a){var c=a.filter(function(a){return a&&b(a.value)});ci&&(Xd(rf.data.targets)||$d(rf.data.targets)||Wi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Vg?"y1":"x1",wd).attr(Vg?"y2":"x2",wd))}function Md(){Wi.select("line."+f.xgridFocus).style("visibility","hidden")}function Nd(a){return a.x||0===a.x?cg(a.x):null}function Od(a){return V(a.id)(a.value)}function Pd(){var a,b,d={},e=0;return Fc(Cc(be)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Td(a,b){return Oh?Oh:b?2*a.tickOffset()*Ph/b:0}function Ud(a,b){Ac(a).forEach(function(a){bj[a]=b===vg[a],vg[a]=b})}function Vd(a,b){var c=!1;return a.forEach(function(a){vg[a.id]===b&&(c=!0),a.id in vg||"line"!==b||(c=!0)}),c}function Wd(a){return Vd(a,"bar")}function Xd(a){return Vd(a,"scatter")}function Yd(a){return Vd(a,"pie")}function Zd(a){return Vd(a,"donut")}function $d(a){return Yd(a)||Zd(a)}function _d(a){var b="string"==typeof a?a:a.id;return!(b in vg)||"line"===vg[b]||"spline"===vg[b]||"area"===vg[b]||"area-spline"===vg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"spline"===vg[b]||"area-spline"===vg[b]}function be(a){var b="string"==typeof a?a:a.id;return"bar"===vg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"scatter"===vg[b]}function de(a){var b="string"==typeof a?a:a.id;return"pie"===vg[b]}function ee(a){var b="string"==typeof a?a:a.id;return"donut"===vg[b]}function fe(a){return de(a)||ee(a)}function ge(a){return be(a)?a.values:[]}function he(a){return _d(a)||ce(a)?a.values:[]}function ie(a){return be(a)||_d(a)?a.values:[]}function je(a){return ee(a)&&Yh||de(a)&&Sh}function ke(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function le(b){var c;try{c=og?qf.time.format(og).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+og)}return c}function me(a,b){var c=qf.mouse(a),d=qf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function re(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function se(a,b){var c="y"===Z(a.id)?dg:eg,d=Vg?1:0,e=Vg?0:1;return Math.pow(cg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function te(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function ue(a,b,c){Ig(b,a.node()),Wi.select("."+f.selectedCircles+id(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Rc(f.selectedCircle,c)}).attr("cx",Vg?Od:Nd).attr("cy",Vg?Nd:Od).attr("stroke",function(){return xi(b)}).attr("r",1.4*Mh).transition().duration(100).attr("r",Mh)}function ve(a,b,c){Jg(b,a.node()),Wi.select("."+f.selectedCircles+id(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a,b){Ig(b,a.node()),a.transition().duration(100).style("fill",function(){return qf.rgb(xi(b)).darker(1)})}function ye(a,b){Jg(b,a.node()),a.transition().duration(100).style("fill",function(){return xi(b)})}function ze(a,b,c,d){a?xe(b,c,d):ye(b,c,d)}function Ae(a){return a.filter(function(a){return b(a.value)})}function Be(a,c){return(c?Wi.selectAll("."+f.circles+id(c)):Wi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ce(a,b){Be(a,b).classed(f.EXPANDED,!0).attr("r",Lh)}function De(a){Be(a).filter(function(){return qf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Ih)}function Ee(a){return Wi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Fe(a){Ee(a).classed(f.EXPANDED,!0)}function Ge(a){Ee(a).classed(f.EXPANDED,!1)}function He(a,b){var c=Le(a,b);return function(a,b){var d=c(a,b),e=Vg?1:0,f=Vg?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function Ie(a,b){var c=Le(a,!1),d=b?Je:Ke;return function(a,b){return d(c(a,b),a,this)}}function Je(a,b){var c;return Vg?(c=be(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ke(a,b,c){var d=c.getBoundingClientRect();return Vg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:be(b)?-3:-6)}function Le(a,b){var c=a.__max__+1,d=Td(ig,c),e=Qd(d,c,a,!!b),f=Rd(!!b),g=Sd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Vg&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Me(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function Ne(b){var c,d,e;if($i=qf.select(tf),$i.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if($i.html(""),$i.classed("c3",!0),rf.data.xs={},rf.data.targets=tc(b),n(),R(),cg.domain(qf.extent(Zb(rf.data.targets))),dg.domain(Ub(rf.data.targets,"y")),eg.domain(Ub(rf.data.targets,"y2")),fg.domain(cg.domain()),gg.domain(dg.domain()),hg.domain(eg.domain()),_i=cg.domain(),Pi.scale(fg),yf&&Ti.scale(cg),Ui=$i.append("svg").attr("width",Jf+Gf.left+Gf.right).attr("height",Lf+Gf.top+Gf.bottom).on("mouseenter",Bf).on("mouseleave",Cf),Vi=Ui.append("defs"),Vi.append("clipPath").attr("id",ji).append("rect").attr("width",Jf).attr("height",Lf),Vi.append("clipPath").attr("id",ki).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Vi.append("clipPath").attr("id",li).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Wi=Ui.append("g").attr("transform",Gi.main),Xi=Mg?Ui.append("g").attr("transform",Gi.context):null,Yi=Ui.append("g").attr("transform",Gi.legend),Pg||(Yi.style("visibility","hidden"),Bi=zc(rf.data.targets)),Zi=qf.select(tf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),lf(zc(rf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Wi.append("g").attr("class",f.axisX).attr("clip-path",ni).attr("transform",Gi.x).append("text").attr("class",f.axisXLabel).attr("transform",Vg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),jh&&Wi.append("g").attr("class",f.axisY).attr("clip-path",oi).attr("transform",Gi.y).append("text").attr("class",f.axisYLabel).attr("transform",Vg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),sh&&Wi.append("g").attr("class",f.axisY2).attr("transform",Gi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Vg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Wi.append("g").attr("clip-path",mi).attr("class",f.grid),Bh&&d.append("g").attr("class",f.xgrids),qe(Dh)&&d.append("g").attr("class",f.xgridLines),Jh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Eh&&d.append("g").attr("class",f.ygrids),qe(Fh)&&d.append("g").attr("class",f.ygridLines),Wi.append("g").attr("clip-path",mi).attr("class",f.regions),Wi.append("g").attr("clip-path",mi).attr("class",f.chart),c=Wi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",yf?Vg?"ns-resize":"ew-resize":null),Wi.select("."+f.chart).append("g").attr("class",f.chartBars),Wi.select("."+f.chart).append("g").attr("class",f.chartLines),Wi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Gi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Wi.select("."+f.chart).append("g").attr("class",f.chartTexts),yf&&Wi.insert("rect",Af?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Jf).attr("height",Lf).style("opacity",0).style("cursor",Vg?"ns-resize":"ew-resize").call(Ti).on("dblclick.zoom",null),hh&&Pi.extent("function"!=typeof hh?hh:hh(Zb())),Mg&&(Xi.append("g").attr("clip-path",mi).attr("class",f.chart),Xi.select("."+f.chart).append("g").attr("class",f.chartBars),Xi.select("."+f.chart).append("g").attr("class",f.chartLines),Xi.append("g").attr("clip-path",mi).attr("class",f.brush).call(Pi).selectAll("rect").attr(Vg?"width":"height",Vg?Kf:Mf),Xi.append("g").attr("class",f.axisX).attr("transform",Gi.subx).attr("clip-path",Vg?"":ni)),$e(rf.data.targets),Vg?Wi.select("."+f.axisX).style("opacity",0).call(ig):(Wi.select("."+f.axisY).style("opacity",0).call(jg),Wi.select("."+f.axisY2).style("opacity",0).call(kg)),Ue({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),gi){if(pi&&"string"==typeof hi){for(hi=le(hi),e=0;e0){d=[];for(var g in qg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Fd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=ze,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function Se(a){$d(rf.data.targets)||Bg&&(si=a,Wi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),ti=!0,Kg())}function Te(){$d(rf.data.targets)||Bg&&(Wi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Wi.selectAll("."+f.shape).classed(f.INCLUDED,!1),ti=!1,Lg())}function Ue(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Pd(),U=$d(rf.data.targets),V=Fc(rf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?Ff:0,O=B?N:0,P=C?N:0,H&&Pg&&lf(zc(rf.data.targets),a),G&&(cg.domain(qf.extent(Zb(V))),_i=cg.domain(),yf&&Ti.scale(cg).updateScaleExtent(),fg.domain(cg.domain()),Pi.scale(fg)),F&&(cg.domain(Pi.empty()?_i:Pi.extent()),yf&&Ti.scale(cg).updateScaleExtent()),dg.domain(Ub(V,"y")),eg.domain(Ub(V,"y2")),(ch||bh)&&(Q=dh?dh:Hc(Gc(V)),ig.tickValues(Q),lg.tickValues(Q)),c=Wi.select("."+f.axisX).style("opacity",U?0:1),(Vg||D)&&(c=c.transition().duration(P)),c.call(ig),e=Wi.select("."+f.axisY).style("opacity",U?0:1),(!Vg||D)&&(e=e.transition().duration(P)),e.call(jg),Wi.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(kg),F)if(_g&&Q){for(R=1;R=0&&qf.select(this).style("display",b%S?"none":"block")})}else qf.selectAll("."+f.axisX+" .tick text").style("display","block");if(I=He(T),K=Ie(T,!0),M=Ie(T,!1),Ab(),gg.domain(dg.domain()),hg.domain(eg.domain()),Zi.style("display","none"),o(),Wi.select("line."+f.xgridFocus).style("visibility","hidden"),Bh){if("year"===Ch){h=[];for(var W=Zb(),X=W[0].getFullYear(),Y=W[1].getFullYear(),Z=X;Y>=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=cg.ticks(10);g=Wi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Vg?0:function(a){return cg(a)-ig.tickOffset()}).attr("x2",Vg?Jf:function(a){return cg(a)-ig.tickOffset()}).attr("y1",Vg?function(a){return cg(a)-ig.tickOffset()}:Gf.top).attr("y2",Vg?function(a){return cg(a)-ig.tickOffset()}:Lf).style("opacity",function(){return+qf.select(this).attr(Vg?"y1":"x1")===(Vg?Lf:0)?0:1}),g.exit().remove()}qe(Dh)&&(i=Wi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Dh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Vg?"":"rotate(-90)").attr("dx",Vg?0:-Gf.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Vg?0:xd).attr("x2",Vg?Jf:xd).attr("y1",Vg?xd:Gf.top).attr("y2",Vg?xd:Lf).style("opacity",1),i.select("text").transition().duration(N).attr("x",Vg?Jf:0).attr("y",xd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&Eh&&(k=Wi.select("."+f.ygrids).selectAll("."+f.ygrid).data(dg.ticks(Gh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Vg?dg:0).attr("x2",Vg?dg:Jf).attr("y1",Vg?0:dg).attr("y2",Vg?Lf:dg),k.exit().remove()),y&&qe(Fh)&&(l=Wi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Fh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Vg?"rotate(-90)":"").attr("dx",Vg?0:-Gf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Vg?yd:0).attr("x2",Vg?yd:Jf).attr("y1",Vg?0:yd).attr("y2",Vg?Lf:yd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Vg?0:Jf).attr("y",yd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Wi.selectAll("."+f.bars).selectAll("."+f.bar).data(ge),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return xi(a)}).attr("class",Zc),p.style("opacity",nd).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Wi.selectAll("."+f.texts).selectAll("."+f.text).data(ie),r.enter().append("text").attr("class",Sc).attr("text-anchor",function(a){return Vg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return vd(a.id)(a.value)}).style("fill-opacity",od).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",qd),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Wi.selectAll("."+f.line).style("opacity",nd).transition().duration(N).attr("d",Qi).style("opacity",1),Wi.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Ri).style("opacity",aj),n=Wi.selectAll("."+f.circles).selectAll("."+f.circle).data(he),n.enter().append("circle").attr("class",Xc).style("opacity",0).attr("r",Ih),n.style("opacity",nd).transition().duration(N).style("opacity",pd).attr("cx",Vg?Od:Nd).attr("cy",Vg?Nd:Od),n.exit().remove(),Wi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=qf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Wi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Dc(a.data.id)&&fe(a.data)?1:0}),Wi.select("."+f.chartArcsTitle).style("opacity",Zd(rf.data.targets)?1:0),Mg&&(null!==qf.event&&"zoom"===qf.event.type&&Pi.extent(cg.orgDomain()).update(),z&&(Xi.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(lg),Pi.empty()||Pi.extent(cg.orgDomain()).update(),J=He(T,!0),s=Xi.selectAll("."+f.bars).selectAll("."+f.bar).data(ge),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return xi(a)}).attr("class",Zc),s.style("opacity",nd).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Xi.selectAll("."+f.line).style("opacity",nd).transition().duration(N).attr("d",Si).style("opacity",1))),Wi.selectAll("."+f.selectedCircles).filter(function(a){return be(a)}).selectAll("circle").remove(),Wi.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Vg?Od:Nd).attr("cy",Vg?Nd:Od),t=Wi.select("."+f.eventRects),qe(ng)&&!mc(ng)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Wi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Pe(u.enter()),u.attr("x",0).attr("y",0).attr("width",Jf).attr("height",Lf)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),ri&&!qi?(x=function(a,b){var c=vc(b),d=wc(b),e=rf.data.xs[a.id][b];return(cg(d?d:e+50)-cg(c?c:e-50))/2},w=function(a,b){var c=vc(b),d=rf.data.xs[a.id][b];return(cg(d)+cg(c?c:d-50))/2}):(x=L(),w=function(a){return cg(a.x)-x/2}),v=yc(),Wi.select("."+f.eventRects).datum(v?v.values:[]),u=Wi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Oe(u.enter()),u.attr("class",cd).attr("x",Vg?0:w).attr("y",Vg?w:0).attr("width",Vg?Jf:x).attr("height",Vg?x:Lf),u.exit().remove()),q=Wi.select("."+f.regions).selectAll("rect."+f.region).data(bi),q.enter().append("rect").style("fill-opacity",0),q.attr("class",bd).attr("x",cc).attr("y",dc).attr("width",ec).attr("height",fc).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),zc(rf.data.targets).forEach(function(a){bj[a]=!0})}}function Ve(){Ue({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function We(){return"mousemove"===qf.event.sourceEvent.type&&Ti.altDomain?(cg.domain(Ti.altDomain),void Ti.scale(cg).updateScaleExtent()):(qi&&cg.orgDomain()[0]===_i[0]&&cg.domain([_i[0]-1e-10,cg.orgDomain()[1]]),Ue({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===qf.event.sourceEvent.type&&(ui=!0)))}function Xe(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ye(){Ui.attr("width",Nf).attr("height",Of),Ui.select("#"+ji).select("rect").attr("width",Jf).attr("height",Lf),Ui.select("#"+ki).select("rect").attr("width",H),Ui.select("#"+li).select("rect").attr("width",J),Ui.select("."+f.zoomRect).attr("width",Jf).attr("height",Lf)}function Ze(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Ye(),m(a.withTransition),Ue(a)}function $e(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Wi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",ed),j=i.enter().append("g").attr("class",ed).style("pointer-events","none"),j.append("g").attr("class",Tc).style("fill",function(a){return xi(a)}),e=Wi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",gd),d=e.enter().append("g").attr("class",gd).style("pointer-events","none"),d.append("g").attr("class",$c).style("fill",function(a){return xi(a)}).style("stroke","none").style("cursor",function(a){return Dg(a)?"pointer":null}),c=Wi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",fd),b=c.enter().append("g").attr("class",fd).style("pointer-events","none"),b.append("path").attr("class",Wc).style("opacity",0).style("stroke",function(a){return xi(a)}),b.append("path").attr("class",ad).style("opacity",function(){return aj=+qf.select(this).style("opacity"),0}).style("fill",function(a){return xi(a)}),b.append("g").attr("class",function(a){return Rc(f.selectedCircles,a.id)}),b.append("g").attr("class",Yc).style("fill",function(a){return xi(a)}).style("cursor",function(a){return Dg(a)?"pointer":null}),a.forEach(function(a){Wi.selectAll("."+f.selectedCircles+id(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Wi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Vf(a)).attr("class",hd),g=h.enter().append("g").attr("class",hd),g.append("path").attr("class",_c).style("opacity",0).style("fill",function(a){return xi(a.data)}).style("cursor",function(a){return Dg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),ff(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Jd(c,qf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),hf(),Kd(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Mg&&(n=Xi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",gd),m=n.enter().append("g").attr("class",gd),m.append("g").attr("class",$c).style("fill",function(a){return xi(a)}),l=Xi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",fd),k=l.enter().append("g").attr("class",fd),k.append("path").attr("class",Wc).style("opacity",0).style("stroke",function(a){return xi(a)})),Ui.selectAll("."+f.target).filter(function(a){return Dc(a.id)}).transition().style("opacity",1)}function _e(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Ud(a.id,b.types[a.id]):Ud(a.id,b.type)}),rf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Hi?j:i,l=Hi?Q():P();return d&&(w=0,C=0,t=0,u=0),Pg&&!Ec(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Hi?u:t,void(Ug?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,Hi?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Yi.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Rc(f.legendItem,a)}).style("visibility",function(a){return Ec(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Rg?Rg(a):rf.toggle(a)}).on("mouseover",function(a){rf.focus(a),"function"==typeof Sg&&Sg(a)}).on("mouseout",function(a){rf.revert(),"function"==typeof Tg&&Tg(a)}),l.append("text").text(function(a){return d(qg[a])?qg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",Hi?g:-200).attr("y",Hi?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Hi?h:-200).attr("y",Hi?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return xi(a)}).attr("x",Hi?g:-200).attr("y",Hi?-200:i).attr("width",10).attr("height",10),Yi.selectAll("text").data(a).text(function(a){return d(qg[a])?qg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Yi.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Yi.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Ye(),q&&m(p)}function mf(a){return Bc(rf.data.targets,a.id)}function nf(a){return"data"in a&&Bc(rf.data.targets,a.data.id)}function of(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 pf(a,b,c){var d=!$d(rf.data.targets);Ud(a,b),Ze(c?c:{withTransitionForAxis:d})}var qf=a.d3?a.d3:a.require?a.require("d3"):void 0,rf={data:{},axis:{},legend:{}},sf={},tf=h(["bindto"],"#chart"),uf=h(["size","width"]),vf=h(["size","height"]),wf=h(["padding","left"]),xf=h(["padding","right"]),yf=h(["zoom","enabled"],!1),zf=h(["zoom","extent"]),Af=h(["zoom","privileged"],!1),Bf=h(["onenter"],function(){}),Cf=h(["onleave"],function(){}),Df=h(["onresize"],function(){}),Ef=h(["onresized"],function(){}),Ff=h(["transition","duration"],350);g("data","data is required in config");var Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg=h(["data","x"]),ng=h(["data","xs"],{}),og=h(["data","x_format"]),pg=h(["data","id_converter"],function(a){return a}),qg=h(["data","names"],{}),rg=h(["data","classes"],{}),sg=h(["data","groups"],[]),tg=h(["data","axes"],{}),ug=h(["data","type"]),vg=h(["data","types"],{}),wg=h(["data","labels"],{}),xg=h(["data","order"]),yg=h(["data","regions"],{}),zg=h(["data","color"]),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","item","onmouseover"]),Tg=h(["legend","item","onmouseout"]),Ug=h(["legend","equally"],!1),Vg=h(["axis","rotated"],!1),Wg=h(["axis","x","type"],"indexed"),Xg=h(["axis","x","localtime"],!0),Yg=h(["axis","x","categories"],[]),Zg=h(["axis","x","tick","centered"],!1),$g=h(["axis","x","tick","format"]),_g=h(["axis","x","tick","culling"],{}),ah=h(["axis","x","tick","culling","max"],10),bh=h(["axis","x","tick","count"]),ch=h(["axis","x","tick","fit"],!0),dh=h(["axis","x","tick","values"],null),eh=h(["axis","x","max"]),fh=h(["axis","x","min"]),gh=h(["axis","x","padding"],{}),hh=h(["axis","x","default"]),ih=h(["axis","x","label"],{}),jh=h(["axis","y","show"],!0),kh=h(["axis","y","max"]),lh=h(["axis","y","min"]),mh=h(["axis","y","center"]),nh=h(["axis","y","label"],{}),oh=h(["axis","y","inner"],!1),ph=h(["axis","y","tick","format"]),qh=h(["axis","y","padding"],{}),rh=h(["axis","y","ticks"],10),sh=h(["axis","y2","show"],!1),th=h(["axis","y2","max"]),uh=h(["axis","y2","min"]),vh=h(["axis","y2","center"]),wh=h(["axis","y2","label"],{}),xh=h(["axis","y2","inner"],!1),yh=h(["axis","y2","tick","format"]),zh=h(["axis","y2","padding"],{}),Ah=h(["axis","y2","ticks"],10),Bh=h(["grid","x","show"],!1),Ch=h(["grid","x","type"],"tick"),Dh=h(["grid","x","lines"],[]),Eh=h(["grid","y","show"],!1),Fh=h(["grid","y","lines"],[]),Gh=h(["grid","y","ticks"],10),Hh=h(["point","show"],!0),Ih=Hh?h(["point","r"],2.5):0,Jh=h(["point","focus","line","enabled"],!0),Kh=h(["point","focus","expand","enabled"],!0),Lh=h(["point","focus","expand","r"],Kh?4:Ih),Mh=h(["point","focus","select","r"],8),Nh=h(["line","connect_null"],!1),Oh=h(["bar","width"]),Ph=h(["bar","width","ratio"],.6),Qh=h(["pie","label","show"],!0),Rh=h(["pie","label","format"]),Sh=h(["pie","expand"],!0),Th=h(["pie","onclick"],function(){}),Uh=h(["pie","onmouseover"],function(){}),Vh=h(["pie","onmouseout"],function(){}),Wh=h(["donut","label","show"],!0),Xh=h(["donut","label","format"]),Yh=h(["donut","expand"],!0),Zh=h(["donut","title"],""),$h=h(["donut","onclick"],function(){}),_h=h(["donut","onmouseover"],function(){}),ai=h(["donut","onmouseout"],function(){}),bi=h(["regions"],[]),ci=h(["tooltip","show"],!0),di=h(["tooltip","format","title"]),ei=h(["tooltip","format","value"]),fi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=di?di:b,l=ei?ei: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+""}),gi=h(["tooltip","init","show"],!1),hi=h(["tooltip","init","x"],0),ii=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ji=("string"==typeof tf?tf.replace("#",""):tf.id)+"-clip",ki=ji+"-xaxis",li=ji+"-yaxis",mi=i(ji),ni=i(ki),oi=i(li),pi="timeseries"===Wg,qi="categorized"===Wg,ri=!pi&&(mg||qe(ng)),si=null,ti=!1,ui=!1,vi=!1,wi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],xi=ke(Ag,qe(Og)?Og:wi,zg),yi=Xg?qf.time.format:qf.time.format.utc,zi=function(){var a=[[yi("%Y/%-m/%-d"),function(){return!0}],[yi("%-m/%-d"),function(a){return a.getMonth()}],[yi("%-m/%-d"),function(a){return 1!==a.getDate()}],[yi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[yi("%I %p"),function(a){return a.getHours()}],[yi("%I:%M"),function(a){return a.getMinutes()}],[yi(":%S"),function(a){return a.getSeconds()}],[yi(".%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)}}(),Ai=[],Bi=[],Ci=Vg?"left":"bottom",Di=Vg?oh?"top":"bottom":oh?"right":"left",Ei=Vg?xh?"bottom":"top":xh?"left":"right",Fi=Vg?"left":"bottom",Gi={main:function(){return"translate("+Gf.left+","+Gf.top+")"},context:function(){return"translate("+Hf.left+","+Hf.top+")"},legend:function(){return"translate("+If.left+","+If.top+")"},x:function(){return"translate(0,"+(Vg?0:Lf)+")"},y:function(){return"translate(0,"+(Vg?Lf:0)+")"},y2:function(){return"translate("+(Vg?0:Jf)+","+(Vg?1:0)+")"},subx:function(){return"translate(0,"+(Vg?0:Mf)+")"},arc:function(){return"translate("+Jf/2+","+Lf/2+")"}},Hi="right"===Qg,Ii=0,Ji=0,Ki=0,Li=.15,Mi=30,Ni=30,Oi=5;Vf=qf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Pi,Qi=function(){var a=qf.svg.line().x(Vg?function(a){return V(a.id)(a.value)}:wd).y(Vg?wd:function(a){return V(a.id)(a.value)});return Nh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Nh?Ae(b.values):b.values;return _d(b)?(a.interpolate(ae(b)?"cardinal":"linear"),yg[b.id]?Me(e,cg,V(b.id),yg[b.id]):a(e)):(c=e[0]?cg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Vg?"M "+d+" "+c:"M "+c+" "+d)}}(),Ri=function(){var a;return a=Vg?qf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(wd):qf.svg.area().x(wd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ae(b.values);return Vd([b],"area")||Vd([b],"area-spline")?(a.interpolate(ae(b)?"cardinal":"linear"),a(e)):(c=e[0]?cg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Vg?"M "+d+" "+c:"M "+c+" "+d)}}(),Si=function(){var a=qf.svg.line().x(Vg?function(a){return W(a.id)(a.value)}:zd).y(Vg?zd:function(a){return W(a.id)(a.value)});return function(b){var c=Ae(b.values);return _d(b)?a(c):"M "+fg(c[0].x)+" "+W(b.id)(c[0].value)}}(),Ti=function(){};Pi=qf.svg.brush().on("brush",Ve),Pi.update=function(){return Xi&&Xi.select("."+f.brush).call(this),this},Pi.scale=function(a){return Vg?this.y(a):this.x(a)},yf&&(Ti=qf.behavior.zoom().on("zoomstart",function(){Ti.altDomain=qf.event.sourceEvent.altKey?cg.orgDomain():null}).on("zoom",yf?We:null),Ti.scale=function(a){return Vg?this.y(a):this.x(a)},Ti.orgScaleExtent=function(){var a=zf?zf:[1,10];return[a[0],Math.max(xc()/a[1],a[1])]},Ti.updateScaleExtent=function(){var a=$b(cg.orgDomain())/$b(_i),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Ui,Vi,Wi,Xi,Yi,Zi,$i,_i,aj,bj={};if(rf.focus=function(a){function b(a){Fc(a).transition().duration(100).style("opacity",1)}var c=Ui.selectAll(jd(a)),d=c.filter(mf),e=c.filter(nf);rf.revert(),rf.defocus(),b(d.classed(f.focused,!0)),b(e),$d(rf.data.targets)&&Kb(a,!0),ff(a)},rf.defocus=function(a){function b(a){Fc(a).transition().duration(100).style("opacity",.3)}var c=Ui.selectAll(jd(a)),d=c.filter(mf),e=c.filter(nf);rf.revert(),b(d.classed(f.focused,!1)),b(e),$d(rf.data.targets)&&Lb(a),gf(a)},rf.revert=function(a){function b(a){Fc(a).transition().duration(100).style("opacity",1)}var c=Ui.selectAll(jd(a)),d=c.filter(mf),e=c.filter(nf);b(d.classed(f.focused,!1)),b(e),$d(rf.data.targets)&&Lb(a),hf()},rf.show=function(a,b){a=Ac(a),b=b||{},Jc(a),Ui.selectAll(kd(a)).transition().style("opacity",1),b.withLegend?jf(a):Yi.selectAll(md(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},rf.hide=function(a,b){a=Ac(a),b=b||{},Ic(a),Ui.selectAll(kd(a)).transition().style("opacity",0),b.withLegend?kf(a):Yi.selectAll(md(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Li),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},rf.toggle=function(a){Dc(a)?rf.hide(a):rf.show(a)},rf.unzoom=function(){Pi.clear().update(),Ue({withUpdateXDomain:!0})},rf.load=function(a){return a.xs&&lc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){rg[b]=a.classes[b]}),"categories"in a&&qi&&(Yg=a.categories,ig.categories(Yg)),"cacheIds"in a&&_b(a.cacheIds)?void _e(bc(a.cacheIds),a.done):void("unload"in a?bf(Ac("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){af(a)}):af(a))},rf.unload=function(a){bf(Ac(a),function(){Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},rf.selected=function(a){return qf.merge(Wi.selectAll("."+f.shapes+id(a)).selectAll("."+f.shape).filter(function(){return qf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},rf.select=function(a,b,c){Bg&&Wi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=qf.select(this),i="circle"===this.nodeName?ue:xe,j="circle"===this.nodeName?ve:ye,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)})},rf.unselect=function(a,b){Bg&&Wi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=qf.select(this),g="circle"===this.nodeName?ve:ye,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)})},rf.toLine=function(a){pf(a,"line")},rf.toSpline=function(a){pf(a,"spline")},rf.toBar=function(a){pf(a,"bar")},rf.toScatter=function(a){pf(a,"scatter")},rf.toArea=function(a){pf(a,"area")},rf.toAreaSpline=function(a){pf(a,"area-spline")},rf.toPie=function(a){pf(a,"pie",{withTransform:!0})},rf.toDonut=function(a){pf(a,"donut",{withTransform:!0})},rf.groups=function(a){return c(a)?sg:(sg=a,Ue(),sg)},rf.xgrids=function(a){return a?(Dh=a,Ue(),Dh):Dh},rf.xgrids.add=function(a){return a?rf.xgrids(Dh.concat(a)):void 0},rf.xgrids.remove=function(a){var b=of(a);return rf.xgrids(Dh.filter(b))},rf.ygrids=function(a){return a?(Fh=a,Ue(),Fh):Fh},rf.ygrids.add=function(a){return a?rf.ygrids(Fh.concat(a)):void 0},rf.ygrids.remove=function(a){var b=of(a);return rf.ygrids(Fh.filter(b))},rf.regions=function(a){return c(a)?bi:(bi=a,Ue(),bi)},rf.regions.add=function(a){return c(a)?bi:(bi=bi.concat(a),Ue(),bi) +},rf.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;Ui.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),bi=bi.filter(function(b){return b.classes.indexOf(a)<0})}),bi},rf.data.get=function(a){var b=rf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},rf.data.getAsTarget=function(a){var b=Cc(function(b){return b.id===a});return b.length>0?b[0]:void 0},rf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){qg[b]=a[b]}),lf(zc(rf.data.targets),{withTransition:!0}),qg):qg},rf.x=function(a){return arguments.length&&(oc(rf.data.targets,a),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),rf.data.xs},rf.xs=function(a){return arguments.length&&(pc(rf.data.targets,a),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),rf.data.xs},rf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},rf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(kh=+a.y),b(a.y2)&&(th=+a.y2)):kh=th=+a,Ue())},rf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(lh=+a.y),b(a.y2)&&(uh=+a.y2)):lh=uh=+a,Ue())},rf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&rf.axis.max(a.max),"undefined"!=typeof a.min&&rf.axis.min(a.min))},rf.legend.show=function(a){Pg||(Pg=!0,Yi.style("visibility","visible")),jf(Ac(a)),Ue({withTransitionForHorizontalAxis:!1})},rf.legend.hide=function(a){Pg&&pe(a)&&(Pg=!1,Yi.style("visibility","hidden")),kf(Ac(a)),Ue({withTransitionForHorizontalAxis:!1})},rf.resize=function(a){uf=a?a.width:null,vf=a?a.height:null,Ze({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},rf.destroy=function(){rf.data.targets=void 0,rf.data.xs={},$i.html(""),a.onresize=null},"url"in e.data)qf.xhr(e.data.url,function(a,b){var c,d=qf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=qf.csv.parse(b.response),Ne(c)});else if("rows"in e.data)Ne(rc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ne(sc(e.data.columns))}return rf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 30bd75fe33c1a6c75dc7ef095ee083214ed2752e Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Tue, 22 Apr 2014 20:56:30 +0900 Subject: [PATCH 055/178] Add axis.x.show option - #135 --- c3.js | 26 +++++++++++++++----------- c3.min.js | 6 +++--- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/c3.js b/c3.js index 3692756..cdb9e60 100644 --- a/c3.js +++ b/c3.js @@ -166,6 +166,7 @@ // axis var __axis_rotated = getConfig(['axis', 'rotated'], false), + __axis_x_show = getConfig(['axis', 'x', 'show'], true), __axis_x_type = getConfig(['axis', 'x', 'type'], 'indexed'), __axis_x_localtime = getConfig(['axis', 'x', 'localtime'], true), __axis_x_categories = getConfig(['axis', 'x', 'categories'], []), @@ -372,7 +373,7 @@ //-- Sizes --// // TODO: configurabale - var rotated_padding_left = 30, rotated_padding_right = 30, rotated_padding_top = 5; + var rotated_padding_left = 30, rotated_padding_right = __axis_rotated && !__axis_x_show ? 0 : 30, rotated_padding_top = 5; function updateSizes() { var legendHeight = getLegendHeight(), legendWidth = getLegendWidth(); @@ -474,6 +475,7 @@ return position.isInner ? 20 + getMaxTickWidth(id) : 40 + getMaxTickWidth(id); } function getHorizontalAxisHeight(axisId) { + if (axisId === 'x' && !__axis_x_show) { return 0; } if (axisId === 'y' && !__axis_y_show) { return __legend_show && !isLegendRight ? 10 : 1; } if (axisId === 'y2' && !__axis_y2_show) { return rotated_padding_top; } return (getAxisLabelPositionById(axisId).isInner ? 30 : 40) + (axisId === 'y2' ? -10 : 0); @@ -2524,16 +2526,18 @@ /*-- Main Region --*/ // Add Axis - main.append("g") - .attr("class", CLASS.axisX) - .attr("clip-path", clipPathForXAxis) - .attr("transform", translate.x) - .append("text") - .attr("class", CLASS.axisXLabel) - .attr("transform", __axis_rotated ? "rotate(-90)" : "") - .attr("dx", dxForXAxisLabel) - .attr("dy", dyForXAxisLabel) - .style("text-anchor", textAnchorForXAxisLabel); + if (__axis_x_show) { + main.append("g") + .attr("class", CLASS.axisX) + .attr("clip-path", clipPathForXAxis) + .attr("transform", translate.x) + .append("text") + .attr("class", CLASS.axisXLabel) + .attr("transform", __axis_rotated ? "rotate(-90)" : "") + .attr("dx", dxForXAxisLabel) + .attr("dy", dyForXAxisLabel) + .style("text-anchor", textAnchorForXAxisLabel); + } if (__axis_y_show) { main.append("g") diff --git a/c3.min.js b/c3.min.js index eec090c..c442da0 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.31"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cJf&&(Jf=0),0>Lf&&(Lf=0),Hf={top:Vg?Gf.top:Of-Ng-(Hi?0:a),right:0/0,bottom:20+(Hi?0:a),left:Vg?Mi:Gf.left},Kf=Vg?Gf.left-Mi-Ni:Jf,Mf=Vg?Lf:Of-Hf.top-Hf.bottom,0>Kf&&(Kf=0),0>Mf&&(Mf=0),If={top:Hi?0:Of-a,right:0/0,bottom:0,left:Hi?Nf-b:0},p(),Hi&&$d(rf.data.targets)&&(If.left=Jf/2+Qf)}function o(){Wi.select("line."+f.xgridFocus).attr("x1",Vg?0:-10).attr("x2",Vg?Jf:-10).attr("y1",Vg?-10:Gf.top).attr("y2",Vg?-10:Lf)}function p(){Qf=Lf/2,Pf=.95*Qf,Rf=Zd(rf.data.targets)?.6*Pf:0}function q(){var a=Vg?f.axisX:f.axisY,b=qf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=qf.select(tf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return uf?uf:x()}function s(){var a=vf?vf:y();return a>0?a:320}function t(){return $d(rf.data.targets)?0:wf?wf:Vg||!jh||oh?1:v("y")}function u(){var a=1;return $d(rf.data.targets)?0:xf?xf:Hi?P()+(sh&&!Vg?v("y2"):a):sh?xh||Vg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||jh?"y2"!==a||sh?(gb(a).isInner?30:40)+("y2"===a?-10:0):Oi:Pg&&!Hi?10:1}function x(){return+qf.select(tf).style("width").replace("px","")}function y(){return+qf.select(tf).style("height").replace("px","")}function z(a){return a?-5:-(Gf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Vg)}function C(){return A(!Vg)}function D(){return z(Vg)}function E(){return A(Vg)}function F(a){return a?Jf+2+4:Gf.left+20}function G(a){return a?80:Lf+2}function H(){return F(!Vg)}function I(){return G(!Vg)}function J(){return F(Vg)}function K(){return G(Vg)}function L(){var a=Vg?Lf:Jf,b=xc(),c=Vb()*(Wd(rf.data.targets)?(b-(qi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){Ii=a}function N(a){Ji=a}function O(a){Ki=a}function P(){return Pg?Hi?Ji*(Ii+1):Nf:0}function Q(){return Pg?Hi?Of:Ki*(Ii+1):0}function R(){var a,b=!cg;Wf=Vg?1:0,Xf=Vg?Lf:Jf,Yf=Vg?0:Lf,Zf=Vg?Jf:1,$f=Wf,_f=Xf,ag=Vg?0:Mf,bg=Vg?Kf:1,cg=T(Wf,Xf,b?void 0:cg.domain(),function(){return ig.tickOffset()}),dg=U(Yf,Zf),eg=U(Yf,Zf),fg=T(Wf,Xf,_i,function(a){return a%1?0:lg.tickOffset()}),gg=U(ag,bg),hg=U(ag,bg),a=$(),ig=X(cg,Ci,a),lg=X(fg,Fi,a),jg=Y(dg,Di,ph,rh),kg=Y(eg,Ei,yh,Ah),b||(Pi.scale(fg),yf&&Ti.scale(cg)),S()}function S(){Sf=Db(),Tf=Eb(),Uf=Eb(.98)}function T(a,b,e,f){var g=(pi?qf.time.scale():qf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),qi){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return qf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?eg:dg}function W(a){return"y2"===Z(a)?hg:gg}function X(a,b,c){var d=(qi?Bb():qf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),qi?(d.tickCentered(Zg),pe(_g)&&(_g=!1)):d.tickOffset=function(){var a=Vg?Lf:Jf;return a*Vb()/xc()/2},qi&&d.categories(Yg),d}function Y(a,b,c,d){return qf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in tg?tg[a]:"y"}function $(){var a=pi?zi:qi?Qc:function(a){return 0>a?a.toFixed(0):a};return $g&&("function"==typeof $g?a=$g:pi&&(a=function(a){return a?yi($g)(a):""})),a}function _(a){var b;return"y"===a?b=nh:"y2"===a?b=wh:"x"===a&&(b=ih),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?nh=b:"y2"===a?wh=b:"x"===a&&(ih=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Vg?"inner-top":"inner-right")}function eb(){return cb("y",Vg?"inner-right":"inner-top")}function fb(){return cb("y2",Vg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?Jf/2:Jf:b.isBottom?-Lf:b.isMiddle?-Lf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Vg,db())}function ob(){return kb(Vg,eb())}function pb(){return kb(Vg,fb())}function qb(){return lb(!Vg,db())}function rb(){return lb(Vg,eb())}function sb(){return lb(Vg,fb())}function tb(){var a=db();return Vg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Vg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Vg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Vg,db())}function xb(){return mb(Vg,eb())}function yb(){return mb(Vg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return qf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Wi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Wi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Wi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+o)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Oc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return qf.min(Object.keys(i).map(function(a){return qf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=zc(a),i=Mc(a);if(sg.length>0)for(g=Pc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return qf.max(Object.keys(i).map(function(a){return qf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?uh:lh,n="y2"===c?th:kh,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?vh:mh,r=rd()&&Vg;return 0===l.length?"y2"===c?eg.domain():dg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=sd(o,p),j=$b(dg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&qh&&(f=b(qh.top)?qh.top:e,g=b(qh.bottom)?qh.bottom:e),"y2"===c&&zh&&(f=b(zh.top)?zh.top:e,g=b(zh.bottom)?zh.bottom:e),Wd(l)&&!Oc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(_i),c=$b(cg.domain());return a||0===c?1:b/c}function Wb(a){return fh?fh:qf.min(a,function(a){return qf.min(a.values,function(a){return a.x})})}function Xb(a){return eh?eh:qf.max(a,function(a){return qf.max(a.values,function(a){return a.x})})}function Yb(a,c){var d,e,f,g,h=c[0],i=c[1],j=Math.abs(h-i);return qi?e=0:Wd(a)?(d=xc(),e=d>1?j/(d-1)/2:.5):e=.01*j,"object"==typeof gh&&qe(gh)?(f=b(gh.left)?gh.left:e,g=b(gh.right)?gh.right:e):f=g="number"==typeof gh?gh:e,{left:f,right:g}}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=0,g=0;return(c||0===c)&&(f=pi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=pi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bb?0:b-c}function fc(a){var b,c=dc(a),d="y"===a.axis?dg:eg;return b="y"===a.axis||"y2"===a.axis?Vg?Lf:"start"in a?d(a.start):Lf:Vg?"end"in a?cg(pi?le(a.end):a.end):Lf:Lf,c>b?0:b-c}function gc(a){return mg&&a===mg||qe(ng)&&re(ng,a)}function hc(a){return!gc(a)}function ic(a){return mg?mg:qe(ng)?ng[a]:null}function jc(a,b){var c,d=b&&qe(b)?zc(b):[];return d.forEach(function(b){ic(b)===a&&(c=rf.data.xs[b])}),c}function kc(a,b){return a in rf.data.xs&&rf.data.xs[a]&&rf.data.xs[a][b]?rf.data.xs[a][b]:b}function lc(a){Object.keys(a).forEach(function(b){ng[b]=a[b]})}function mc(a){return 1===qf.set(Object.keys(a).map(function(b){return a[b]})).size()}function nc(a){var b;return a&&(b=qg[a.id],a.name=b?b:a.id),a}function oc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=qc(b[d],a.id,d)}),rf.data.xs[a.id]=b})}function pc(a,b){a.forEach(function(a){b[a.id]&&oc([a],b[a.id])})}function qc(a,b,c){var d;return d=pi?a?a instanceof Date?a:le(a):le(kc(b,c)):ri&&!qi?a?+a:kc(b,c):c}function rc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?rf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):mg?(d=Object.keys(rf.data.xs),rf.data.xs[c]=d.length>0?rf.data.xs[d[0]]:void 0):qe(ng)&&(rf.data.xs[c]=jc(f,rf.data.targets)):rf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!rf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=pg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=ic(b),g=a[f],h=qc(g,b,e);return ri&&qi&&0===c&&g&&(0===e&&(Yg=[]),Yg.push(g)),("undefined"==typeof a[b]||rf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),ug&&Ud(zc(c).filter(function(a){return!(a in vg)}),ug),c.forEach(function(a){ac(a.id_org,a)}),c}function uc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function vc(a){return a>0&&rf.data.targets[0].values[a-1]?rf.data.targets[0].values[a-1].x:void 0}function wc(a){return a1?rf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?rf.data.targets[0]:null,a}function zc(a){return a.map(function(a){return a.id})}function Ac(a){return a?"string"==typeof a?[a]:a:zc(rf.data.targets)}function Bc(a,b){var c,d=zc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(pi?new Date(h):h);i.push(d)}return pi||(i=i.sort(function(a,b){return a-b})),i}function Ic(a){Ai=Ai.concat(a)}function Jc(a){Ai=Ai.filter(function(b){return a.indexOf(b)<0})}function Kc(a){Bi=Bi.concat(a)}function Lc(a){Bi=Bi.filter(function(b){return a.indexOf(b)<0})}function Mc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Nc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Pc(a){return Nc(a,function(a){return a>0})}function Qc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(Ad(a,f))),a[g].x&&(e=e.concat(Ad(a,g))),Dd(e,b)):Bd(a,b,f,g)}function Cd(a,b){var c;return c=a.map(function(a){return Bd(a.values,b)}),Dd(c,b)}function Dd(a,b){var c,d;return a.forEach(function(a){var e=se(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Ed(a,b){return qf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Fd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Gd(){return xg&&"desc"===xg.toLowerCase()}function Hd(){return xg&&"asc"===xg.toLowerCase()}function Id(a){var b=Hd(),c=Gd();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof xg&&a.sort(xg),a}function Jd(a,c){var d,e,f,g,h,i,j,k=$d(rf.data.targets),l=k?ud:td,m=a.filter(function(a){return a&&b(a.value)});ci&&0!==m.length&&(Zi.html(fi(a,$(),l,xi)).style("display","block"),d=Zi.property("offsetWidth"),e=Zi.property("offsetHeight"),k?(g=Jf/2+c[0],i=Lf/2+c[1]+20):(Vg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=cg(m[0].x)+20):(f=q(),g=f+t()+cg(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Zi.style("top",i+"px").style("left",g+"px"))}function Kd(){Zi.style("display","none")}function Ld(a){var c=a.filter(function(a){return a&&b(a.value)});ci&&(Xd(rf.data.targets)||$d(rf.data.targets)||Wi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Vg?"y1":"x1",wd).attr(Vg?"y2":"x2",wd))}function Md(){Wi.select("line."+f.xgridFocus).style("visibility","hidden")}function Nd(a){return a.x||0===a.x?cg(a.x):null}function Od(a){return V(a.id)(a.value)}function Pd(){var a,b,d={},e=0;return Fc(Cc(be)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Td(a,b){return Oh?Oh:b?2*a.tickOffset()*Ph/b:0}function Ud(a,b){Ac(a).forEach(function(a){bj[a]=b===vg[a],vg[a]=b})}function Vd(a,b){var c=!1;return a.forEach(function(a){vg[a.id]===b&&(c=!0),a.id in vg||"line"!==b||(c=!0)}),c}function Wd(a){return Vd(a,"bar")}function Xd(a){return Vd(a,"scatter")}function Yd(a){return Vd(a,"pie")}function Zd(a){return Vd(a,"donut")}function $d(a){return Yd(a)||Zd(a)}function _d(a){var b="string"==typeof a?a:a.id;return!(b in vg)||"line"===vg[b]||"spline"===vg[b]||"area"===vg[b]||"area-spline"===vg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"spline"===vg[b]||"area-spline"===vg[b]}function be(a){var b="string"==typeof a?a:a.id;return"bar"===vg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"scatter"===vg[b]}function de(a){var b="string"==typeof a?a:a.id;return"pie"===vg[b]}function ee(a){var b="string"==typeof a?a:a.id;return"donut"===vg[b]}function fe(a){return de(a)||ee(a)}function ge(a){return be(a)?a.values:[]}function he(a){return _d(a)||ce(a)?a.values:[]}function ie(a){return be(a)||_d(a)?a.values:[]}function je(a){return ee(a)&&Yh||de(a)&&Sh}function ke(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function le(b){var c;try{c=og?qf.time.format(og).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+og)}return c}function me(a,b){var c=qf.mouse(a),d=qf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function re(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function se(a,b){var c="y"===Z(a.id)?dg:eg,d=Vg?1:0,e=Vg?0:1;return Math.pow(cg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function te(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function ue(a,b,c){Ig(b,a.node()),Wi.select("."+f.selectedCircles+id(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Rc(f.selectedCircle,c)}).attr("cx",Vg?Od:Nd).attr("cy",Vg?Nd:Od).attr("stroke",function(){return xi(b)}).attr("r",1.4*Mh).transition().duration(100).attr("r",Mh)}function ve(a,b,c){Jg(b,a.node()),Wi.select("."+f.selectedCircles+id(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a,b){Ig(b,a.node()),a.transition().duration(100).style("fill",function(){return qf.rgb(xi(b)).darker(1)})}function ye(a,b){Jg(b,a.node()),a.transition().duration(100).style("fill",function(){return xi(b)})}function ze(a,b,c,d){a?xe(b,c,d):ye(b,c,d)}function Ae(a){return a.filter(function(a){return b(a.value)})}function Be(a,c){return(c?Wi.selectAll("."+f.circles+id(c)):Wi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ce(a,b){Be(a,b).classed(f.EXPANDED,!0).attr("r",Lh)}function De(a){Be(a).filter(function(){return qf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Ih)}function Ee(a){return Wi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Fe(a){Ee(a).classed(f.EXPANDED,!0)}function Ge(a){Ee(a).classed(f.EXPANDED,!1)}function He(a,b){var c=Le(a,b);return function(a,b){var d=c(a,b),e=Vg?1:0,f=Vg?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function Ie(a,b){var c=Le(a,!1),d=b?Je:Ke;return function(a,b){return d(c(a,b),a,this)}}function Je(a,b){var c;return Vg?(c=be(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ke(a,b,c){var d=c.getBoundingClientRect();return Vg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:be(b)?-3:-6)}function Le(a,b){var c=a.__max__+1,d=Td(ig,c),e=Qd(d,c,a,!!b),f=Rd(!!b),g=Sd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Vg&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Me(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function Ne(b){var c,d,e;if($i=qf.select(tf),$i.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if($i.html(""),$i.classed("c3",!0),rf.data.xs={},rf.data.targets=tc(b),n(),R(),cg.domain(qf.extent(Zb(rf.data.targets))),dg.domain(Ub(rf.data.targets,"y")),eg.domain(Ub(rf.data.targets,"y2")),fg.domain(cg.domain()),gg.domain(dg.domain()),hg.domain(eg.domain()),_i=cg.domain(),Pi.scale(fg),yf&&Ti.scale(cg),Ui=$i.append("svg").attr("width",Jf+Gf.left+Gf.right).attr("height",Lf+Gf.top+Gf.bottom).on("mouseenter",Bf).on("mouseleave",Cf),Vi=Ui.append("defs"),Vi.append("clipPath").attr("id",ji).append("rect").attr("width",Jf).attr("height",Lf),Vi.append("clipPath").attr("id",ki).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Vi.append("clipPath").attr("id",li).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Wi=Ui.append("g").attr("transform",Gi.main),Xi=Mg?Ui.append("g").attr("transform",Gi.context):null,Yi=Ui.append("g").attr("transform",Gi.legend),Pg||(Yi.style("visibility","hidden"),Bi=zc(rf.data.targets)),Zi=qf.select(tf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),lf(zc(rf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Wi.append("g").attr("class",f.axisX).attr("clip-path",ni).attr("transform",Gi.x).append("text").attr("class",f.axisXLabel).attr("transform",Vg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),jh&&Wi.append("g").attr("class",f.axisY).attr("clip-path",oi).attr("transform",Gi.y).append("text").attr("class",f.axisYLabel).attr("transform",Vg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),sh&&Wi.append("g").attr("class",f.axisY2).attr("transform",Gi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Vg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Wi.append("g").attr("clip-path",mi).attr("class",f.grid),Bh&&d.append("g").attr("class",f.xgrids),qe(Dh)&&d.append("g").attr("class",f.xgridLines),Jh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Eh&&d.append("g").attr("class",f.ygrids),qe(Fh)&&d.append("g").attr("class",f.ygridLines),Wi.append("g").attr("clip-path",mi).attr("class",f.regions),Wi.append("g").attr("clip-path",mi).attr("class",f.chart),c=Wi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",yf?Vg?"ns-resize":"ew-resize":null),Wi.select("."+f.chart).append("g").attr("class",f.chartBars),Wi.select("."+f.chart).append("g").attr("class",f.chartLines),Wi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Gi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Wi.select("."+f.chart).append("g").attr("class",f.chartTexts),yf&&Wi.insert("rect",Af?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Jf).attr("height",Lf).style("opacity",0).style("cursor",Vg?"ns-resize":"ew-resize").call(Ti).on("dblclick.zoom",null),hh&&Pi.extent("function"!=typeof hh?hh:hh(Zb())),Mg&&(Xi.append("g").attr("clip-path",mi).attr("class",f.chart),Xi.select("."+f.chart).append("g").attr("class",f.chartBars),Xi.select("."+f.chart).append("g").attr("class",f.chartLines),Xi.append("g").attr("clip-path",mi).attr("class",f.brush).call(Pi).selectAll("rect").attr(Vg?"width":"height",Vg?Kf:Mf),Xi.append("g").attr("class",f.axisX).attr("transform",Gi.subx).attr("clip-path",Vg?"":ni)),$e(rf.data.targets),Vg?Wi.select("."+f.axisX).style("opacity",0).call(ig):(Wi.select("."+f.axisY).style("opacity",0).call(jg),Wi.select("."+f.axisY2).style("opacity",0).call(kg)),Ue({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),gi){if(pi&&"string"==typeof hi){for(hi=le(hi),e=0;e0){d=[];for(var g in qg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Fd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=ze,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function Se(a){$d(rf.data.targets)||Bg&&(si=a,Wi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),ti=!0,Kg())}function Te(){$d(rf.data.targets)||Bg&&(Wi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Wi.selectAll("."+f.shape).classed(f.INCLUDED,!1),ti=!1,Lg())}function Ue(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Pd(),U=$d(rf.data.targets),V=Fc(rf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?Ff:0,O=B?N:0,P=C?N:0,H&&Pg&&lf(zc(rf.data.targets),a),G&&(cg.domain(qf.extent(Zb(V))),_i=cg.domain(),yf&&Ti.scale(cg).updateScaleExtent(),fg.domain(cg.domain()),Pi.scale(fg)),F&&(cg.domain(Pi.empty()?_i:Pi.extent()),yf&&Ti.scale(cg).updateScaleExtent()),dg.domain(Ub(V,"y")),eg.domain(Ub(V,"y2")),(ch||bh)&&(Q=dh?dh:Hc(Gc(V)),ig.tickValues(Q),lg.tickValues(Q)),c=Wi.select("."+f.axisX).style("opacity",U?0:1),(Vg||D)&&(c=c.transition().duration(P)),c.call(ig),e=Wi.select("."+f.axisY).style("opacity",U?0:1),(!Vg||D)&&(e=e.transition().duration(P)),e.call(jg),Wi.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(kg),F)if(_g&&Q){for(R=1;R=0&&qf.select(this).style("display",b%S?"none":"block")})}else qf.selectAll("."+f.axisX+" .tick text").style("display","block");if(I=He(T),K=Ie(T,!0),M=Ie(T,!1),Ab(),gg.domain(dg.domain()),hg.domain(eg.domain()),Zi.style("display","none"),o(),Wi.select("line."+f.xgridFocus).style("visibility","hidden"),Bh){if("year"===Ch){h=[];for(var W=Zb(),X=W[0].getFullYear(),Y=W[1].getFullYear(),Z=X;Y>=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=cg.ticks(10);g=Wi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Vg?0:function(a){return cg(a)-ig.tickOffset()}).attr("x2",Vg?Jf:function(a){return cg(a)-ig.tickOffset()}).attr("y1",Vg?function(a){return cg(a)-ig.tickOffset()}:Gf.top).attr("y2",Vg?function(a){return cg(a)-ig.tickOffset()}:Lf).style("opacity",function(){return+qf.select(this).attr(Vg?"y1":"x1")===(Vg?Lf:0)?0:1}),g.exit().remove()}qe(Dh)&&(i=Wi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Dh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Vg?"":"rotate(-90)").attr("dx",Vg?0:-Gf.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Vg?0:xd).attr("x2",Vg?Jf:xd).attr("y1",Vg?xd:Gf.top).attr("y2",Vg?xd:Lf).style("opacity",1),i.select("text").transition().duration(N).attr("x",Vg?Jf:0).attr("y",xd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&Eh&&(k=Wi.select("."+f.ygrids).selectAll("."+f.ygrid).data(dg.ticks(Gh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Vg?dg:0).attr("x2",Vg?dg:Jf).attr("y1",Vg?0:dg).attr("y2",Vg?Lf:dg),k.exit().remove()),y&&qe(Fh)&&(l=Wi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Fh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Vg?"rotate(-90)":"").attr("dx",Vg?0:-Gf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Vg?yd:0).attr("x2",Vg?yd:Jf).attr("y1",Vg?0:yd).attr("y2",Vg?Lf:yd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Vg?0:Jf).attr("y",yd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Wi.selectAll("."+f.bars).selectAll("."+f.bar).data(ge),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return xi(a)}).attr("class",Zc),p.style("opacity",nd).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Wi.selectAll("."+f.texts).selectAll("."+f.text).data(ie),r.enter().append("text").attr("class",Sc).attr("text-anchor",function(a){return Vg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return vd(a.id)(a.value)}).style("fill-opacity",od).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",qd),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Wi.selectAll("."+f.line).style("opacity",nd).transition().duration(N).attr("d",Qi).style("opacity",1),Wi.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Ri).style("opacity",aj),n=Wi.selectAll("."+f.circles).selectAll("."+f.circle).data(he),n.enter().append("circle").attr("class",Xc).style("opacity",0).attr("r",Ih),n.style("opacity",nd).transition().duration(N).style("opacity",pd).attr("cx",Vg?Od:Nd).attr("cy",Vg?Nd:Od),n.exit().remove(),Wi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=qf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Wi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Dc(a.data.id)&&fe(a.data)?1:0}),Wi.select("."+f.chartArcsTitle).style("opacity",Zd(rf.data.targets)?1:0),Mg&&(null!==qf.event&&"zoom"===qf.event.type&&Pi.extent(cg.orgDomain()).update(),z&&(Xi.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(lg),Pi.empty()||Pi.extent(cg.orgDomain()).update(),J=He(T,!0),s=Xi.selectAll("."+f.bars).selectAll("."+f.bar).data(ge),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return xi(a)}).attr("class",Zc),s.style("opacity",nd).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Xi.selectAll("."+f.line).style("opacity",nd).transition().duration(N).attr("d",Si).style("opacity",1))),Wi.selectAll("."+f.selectedCircles).filter(function(a){return be(a)}).selectAll("circle").remove(),Wi.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Vg?Od:Nd).attr("cy",Vg?Nd:Od),t=Wi.select("."+f.eventRects),qe(ng)&&!mc(ng)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Wi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Pe(u.enter()),u.attr("x",0).attr("y",0).attr("width",Jf).attr("height",Lf)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),ri&&!qi?(x=function(a,b){var c=vc(b),d=wc(b),e=rf.data.xs[a.id][b];return(cg(d?d:e+50)-cg(c?c:e-50))/2},w=function(a,b){var c=vc(b),d=rf.data.xs[a.id][b];return(cg(d)+cg(c?c:d-50))/2}):(x=L(),w=function(a){return cg(a.x)-x/2}),v=yc(),Wi.select("."+f.eventRects).datum(v?v.values:[]),u=Wi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Oe(u.enter()),u.attr("class",cd).attr("x",Vg?0:w).attr("y",Vg?w:0).attr("width",Vg?Jf:x).attr("height",Vg?x:Lf),u.exit().remove()),q=Wi.select("."+f.regions).selectAll("rect."+f.region).data(bi),q.enter().append("rect").style("fill-opacity",0),q.attr("class",bd).attr("x",cc).attr("y",dc).attr("width",ec).attr("height",fc).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),zc(rf.data.targets).forEach(function(a){bj[a]=!0})}}function Ve(){Ue({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function We(){return"mousemove"===qf.event.sourceEvent.type&&Ti.altDomain?(cg.domain(Ti.altDomain),void Ti.scale(cg).updateScaleExtent()):(qi&&cg.orgDomain()[0]===_i[0]&&cg.domain([_i[0]-1e-10,cg.orgDomain()[1]]),Ue({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===qf.event.sourceEvent.type&&(ui=!0)))}function Xe(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ye(){Ui.attr("width",Nf).attr("height",Of),Ui.select("#"+ji).select("rect").attr("width",Jf).attr("height",Lf),Ui.select("#"+ki).select("rect").attr("width",H),Ui.select("#"+li).select("rect").attr("width",J),Ui.select("."+f.zoomRect).attr("width",Jf).attr("height",Lf)}function Ze(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Ye(),m(a.withTransition),Ue(a)}function $e(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Wi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",ed),j=i.enter().append("g").attr("class",ed).style("pointer-events","none"),j.append("g").attr("class",Tc).style("fill",function(a){return xi(a)}),e=Wi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",gd),d=e.enter().append("g").attr("class",gd).style("pointer-events","none"),d.append("g").attr("class",$c).style("fill",function(a){return xi(a)}).style("stroke","none").style("cursor",function(a){return Dg(a)?"pointer":null}),c=Wi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",fd),b=c.enter().append("g").attr("class",fd).style("pointer-events","none"),b.append("path").attr("class",Wc).style("opacity",0).style("stroke",function(a){return xi(a)}),b.append("path").attr("class",ad).style("opacity",function(){return aj=+qf.select(this).style("opacity"),0}).style("fill",function(a){return xi(a)}),b.append("g").attr("class",function(a){return Rc(f.selectedCircles,a.id)}),b.append("g").attr("class",Yc).style("fill",function(a){return xi(a)}).style("cursor",function(a){return Dg(a)?"pointer":null}),a.forEach(function(a){Wi.selectAll("."+f.selectedCircles+id(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Wi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Vf(a)).attr("class",hd),g=h.enter().append("g").attr("class",hd),g.append("path").attr("class",_c).style("opacity",0).style("fill",function(a){return xi(a.data)}).style("cursor",function(a){return Dg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),ff(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Jd(c,qf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),hf(),Kd(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Mg&&(n=Xi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",gd),m=n.enter().append("g").attr("class",gd),m.append("g").attr("class",$c).style("fill",function(a){return xi(a)}),l=Xi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",fd),k=l.enter().append("g").attr("class",fd),k.append("path").attr("class",Wc).style("opacity",0).style("stroke",function(a){return xi(a)})),Ui.selectAll("."+f.target).filter(function(a){return Dc(a.id)}).transition().style("opacity",1)}function _e(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Ud(a.id,b.types[a.id]):Ud(a.id,b.type)}),rf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Hi?j:i,l=Hi?Q():P();return d&&(w=0,C=0,t=0,u=0),Pg&&!Ec(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Hi?u:t,void(Ug?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,Hi?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Yi.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Rc(f.legendItem,a)}).style("visibility",function(a){return Ec(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Rg?Rg(a):rf.toggle(a)}).on("mouseover",function(a){rf.focus(a),"function"==typeof Sg&&Sg(a)}).on("mouseout",function(a){rf.revert(),"function"==typeof Tg&&Tg(a)}),l.append("text").text(function(a){return d(qg[a])?qg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",Hi?g:-200).attr("y",Hi?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Hi?h:-200).attr("y",Hi?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return xi(a)}).attr("x",Hi?g:-200).attr("y",Hi?-200:i).attr("width",10).attr("height",10),Yi.selectAll("text").data(a).text(function(a){return d(qg[a])?qg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Yi.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Yi.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Ye(),q&&m(p)}function mf(a){return Bc(rf.data.targets,a.id)}function nf(a){return"data"in a&&Bc(rf.data.targets,a.data.id)}function of(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 pf(a,b,c){var d=!$d(rf.data.targets);Ud(a,b),Ze(c?c:{withTransitionForAxis:d})}var qf=a.d3?a.d3:a.require?a.require("d3"):void 0,rf={data:{},axis:{},legend:{}},sf={},tf=h(["bindto"],"#chart"),uf=h(["size","width"]),vf=h(["size","height"]),wf=h(["padding","left"]),xf=h(["padding","right"]),yf=h(["zoom","enabled"],!1),zf=h(["zoom","extent"]),Af=h(["zoom","privileged"],!1),Bf=h(["onenter"],function(){}),Cf=h(["onleave"],function(){}),Df=h(["onresize"],function(){}),Ef=h(["onresized"],function(){}),Ff=h(["transition","duration"],350);g("data","data is required in config");var Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg=h(["data","x"]),ng=h(["data","xs"],{}),og=h(["data","x_format"]),pg=h(["data","id_converter"],function(a){return a}),qg=h(["data","names"],{}),rg=h(["data","classes"],{}),sg=h(["data","groups"],[]),tg=h(["data","axes"],{}),ug=h(["data","type"]),vg=h(["data","types"],{}),wg=h(["data","labels"],{}),xg=h(["data","order"]),yg=h(["data","regions"],{}),zg=h(["data","color"]),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","item","onmouseover"]),Tg=h(["legend","item","onmouseout"]),Ug=h(["legend","equally"],!1),Vg=h(["axis","rotated"],!1),Wg=h(["axis","x","type"],"indexed"),Xg=h(["axis","x","localtime"],!0),Yg=h(["axis","x","categories"],[]),Zg=h(["axis","x","tick","centered"],!1),$g=h(["axis","x","tick","format"]),_g=h(["axis","x","tick","culling"],{}),ah=h(["axis","x","tick","culling","max"],10),bh=h(["axis","x","tick","count"]),ch=h(["axis","x","tick","fit"],!0),dh=h(["axis","x","tick","values"],null),eh=h(["axis","x","max"]),fh=h(["axis","x","min"]),gh=h(["axis","x","padding"],{}),hh=h(["axis","x","default"]),ih=h(["axis","x","label"],{}),jh=h(["axis","y","show"],!0),kh=h(["axis","y","max"]),lh=h(["axis","y","min"]),mh=h(["axis","y","center"]),nh=h(["axis","y","label"],{}),oh=h(["axis","y","inner"],!1),ph=h(["axis","y","tick","format"]),qh=h(["axis","y","padding"],{}),rh=h(["axis","y","ticks"],10),sh=h(["axis","y2","show"],!1),th=h(["axis","y2","max"]),uh=h(["axis","y2","min"]),vh=h(["axis","y2","center"]),wh=h(["axis","y2","label"],{}),xh=h(["axis","y2","inner"],!1),yh=h(["axis","y2","tick","format"]),zh=h(["axis","y2","padding"],{}),Ah=h(["axis","y2","ticks"],10),Bh=h(["grid","x","show"],!1),Ch=h(["grid","x","type"],"tick"),Dh=h(["grid","x","lines"],[]),Eh=h(["grid","y","show"],!1),Fh=h(["grid","y","lines"],[]),Gh=h(["grid","y","ticks"],10),Hh=h(["point","show"],!0),Ih=Hh?h(["point","r"],2.5):0,Jh=h(["point","focus","line","enabled"],!0),Kh=h(["point","focus","expand","enabled"],!0),Lh=h(["point","focus","expand","r"],Kh?4:Ih),Mh=h(["point","focus","select","r"],8),Nh=h(["line","connect_null"],!1),Oh=h(["bar","width"]),Ph=h(["bar","width","ratio"],.6),Qh=h(["pie","label","show"],!0),Rh=h(["pie","label","format"]),Sh=h(["pie","expand"],!0),Th=h(["pie","onclick"],function(){}),Uh=h(["pie","onmouseover"],function(){}),Vh=h(["pie","onmouseout"],function(){}),Wh=h(["donut","label","show"],!0),Xh=h(["donut","label","format"]),Yh=h(["donut","expand"],!0),Zh=h(["donut","title"],""),$h=h(["donut","onclick"],function(){}),_h=h(["donut","onmouseover"],function(){}),ai=h(["donut","onmouseout"],function(){}),bi=h(["regions"],[]),ci=h(["tooltip","show"],!0),di=h(["tooltip","format","title"]),ei=h(["tooltip","format","value"]),fi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=di?di:b,l=ei?ei: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+""}),gi=h(["tooltip","init","show"],!1),hi=h(["tooltip","init","x"],0),ii=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ji=("string"==typeof tf?tf.replace("#",""):tf.id)+"-clip",ki=ji+"-xaxis",li=ji+"-yaxis",mi=i(ji),ni=i(ki),oi=i(li),pi="timeseries"===Wg,qi="categorized"===Wg,ri=!pi&&(mg||qe(ng)),si=null,ti=!1,ui=!1,vi=!1,wi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],xi=ke(Ag,qe(Og)?Og:wi,zg),yi=Xg?qf.time.format:qf.time.format.utc,zi=function(){var a=[[yi("%Y/%-m/%-d"),function(){return!0}],[yi("%-m/%-d"),function(a){return a.getMonth()}],[yi("%-m/%-d"),function(a){return 1!==a.getDate()}],[yi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[yi("%I %p"),function(a){return a.getHours()}],[yi("%I:%M"),function(a){return a.getMinutes()}],[yi(":%S"),function(a){return a.getSeconds()}],[yi(".%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)}}(),Ai=[],Bi=[],Ci=Vg?"left":"bottom",Di=Vg?oh?"top":"bottom":oh?"right":"left",Ei=Vg?xh?"bottom":"top":xh?"left":"right",Fi=Vg?"left":"bottom",Gi={main:function(){return"translate("+Gf.left+","+Gf.top+")"},context:function(){return"translate("+Hf.left+","+Hf.top+")"},legend:function(){return"translate("+If.left+","+If.top+")"},x:function(){return"translate(0,"+(Vg?0:Lf)+")"},y:function(){return"translate(0,"+(Vg?Lf:0)+")"},y2:function(){return"translate("+(Vg?0:Jf)+","+(Vg?1:0)+")"},subx:function(){return"translate(0,"+(Vg?0:Mf)+")"},arc:function(){return"translate("+Jf/2+","+Lf/2+")"}},Hi="right"===Qg,Ii=0,Ji=0,Ki=0,Li=.15,Mi=30,Ni=30,Oi=5;Vf=qf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Pi,Qi=function(){var a=qf.svg.line().x(Vg?function(a){return V(a.id)(a.value)}:wd).y(Vg?wd:function(a){return V(a.id)(a.value)});return Nh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Nh?Ae(b.values):b.values;return _d(b)?(a.interpolate(ae(b)?"cardinal":"linear"),yg[b.id]?Me(e,cg,V(b.id),yg[b.id]):a(e)):(c=e[0]?cg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Vg?"M "+d+" "+c:"M "+c+" "+d)}}(),Ri=function(){var a;return a=Vg?qf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(wd):qf.svg.area().x(wd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ae(b.values);return Vd([b],"area")||Vd([b],"area-spline")?(a.interpolate(ae(b)?"cardinal":"linear"),a(e)):(c=e[0]?cg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Vg?"M "+d+" "+c:"M "+c+" "+d)}}(),Si=function(){var a=qf.svg.line().x(Vg?function(a){return W(a.id)(a.value)}:zd).y(Vg?zd:function(a){return W(a.id)(a.value)});return function(b){var c=Ae(b.values);return _d(b)?a(c):"M "+fg(c[0].x)+" "+W(b.id)(c[0].value)}}(),Ti=function(){};Pi=qf.svg.brush().on("brush",Ve),Pi.update=function(){return Xi&&Xi.select("."+f.brush).call(this),this},Pi.scale=function(a){return Vg?this.y(a):this.x(a)},yf&&(Ti=qf.behavior.zoom().on("zoomstart",function(){Ti.altDomain=qf.event.sourceEvent.altKey?cg.orgDomain():null}).on("zoom",yf?We:null),Ti.scale=function(a){return Vg?this.y(a):this.x(a)},Ti.orgScaleExtent=function(){var a=zf?zf:[1,10];return[a[0],Math.max(xc()/a[1],a[1])]},Ti.updateScaleExtent=function(){var a=$b(cg.orgDomain())/$b(_i),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Ui,Vi,Wi,Xi,Yi,Zi,$i,_i,aj,bj={};if(rf.focus=function(a){function b(a){Fc(a).transition().duration(100).style("opacity",1)}var c=Ui.selectAll(jd(a)),d=c.filter(mf),e=c.filter(nf);rf.revert(),rf.defocus(),b(d.classed(f.focused,!0)),b(e),$d(rf.data.targets)&&Kb(a,!0),ff(a)},rf.defocus=function(a){function b(a){Fc(a).transition().duration(100).style("opacity",.3)}var c=Ui.selectAll(jd(a)),d=c.filter(mf),e=c.filter(nf);rf.revert(),b(d.classed(f.focused,!1)),b(e),$d(rf.data.targets)&&Lb(a),gf(a)},rf.revert=function(a){function b(a){Fc(a).transition().duration(100).style("opacity",1)}var c=Ui.selectAll(jd(a)),d=c.filter(mf),e=c.filter(nf);b(d.classed(f.focused,!1)),b(e),$d(rf.data.targets)&&Lb(a),hf()},rf.show=function(a,b){a=Ac(a),b=b||{},Jc(a),Ui.selectAll(kd(a)).transition().style("opacity",1),b.withLegend?jf(a):Yi.selectAll(md(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},rf.hide=function(a,b){a=Ac(a),b=b||{},Ic(a),Ui.selectAll(kd(a)).transition().style("opacity",0),b.withLegend?kf(a):Yi.selectAll(md(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Li),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},rf.toggle=function(a){Dc(a)?rf.hide(a):rf.show(a)},rf.unzoom=function(){Pi.clear().update(),Ue({withUpdateXDomain:!0})},rf.load=function(a){return a.xs&&lc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){rg[b]=a.classes[b]}),"categories"in a&&qi&&(Yg=a.categories,ig.categories(Yg)),"cacheIds"in a&&_b(a.cacheIds)?void _e(bc(a.cacheIds),a.done):void("unload"in a?bf(Ac("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){af(a)}):af(a))},rf.unload=function(a){bf(Ac(a),function(){Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},rf.selected=function(a){return qf.merge(Wi.selectAll("."+f.shapes+id(a)).selectAll("."+f.shape).filter(function(){return qf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},rf.select=function(a,b,c){Bg&&Wi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=qf.select(this),i="circle"===this.nodeName?ue:xe,j="circle"===this.nodeName?ve:ye,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)})},rf.unselect=function(a,b){Bg&&Wi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=qf.select(this),g="circle"===this.nodeName?ve:ye,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)})},rf.toLine=function(a){pf(a,"line")},rf.toSpline=function(a){pf(a,"spline")},rf.toBar=function(a){pf(a,"bar")},rf.toScatter=function(a){pf(a,"scatter")},rf.toArea=function(a){pf(a,"area")},rf.toAreaSpline=function(a){pf(a,"area-spline")},rf.toPie=function(a){pf(a,"pie",{withTransform:!0})},rf.toDonut=function(a){pf(a,"donut",{withTransform:!0})},rf.groups=function(a){return c(a)?sg:(sg=a,Ue(),sg)},rf.xgrids=function(a){return a?(Dh=a,Ue(),Dh):Dh},rf.xgrids.add=function(a){return a?rf.xgrids(Dh.concat(a)):void 0},rf.xgrids.remove=function(a){var b=of(a);return rf.xgrids(Dh.filter(b))},rf.ygrids=function(a){return a?(Fh=a,Ue(),Fh):Fh},rf.ygrids.add=function(a){return a?rf.ygrids(Fh.concat(a)):void 0},rf.ygrids.remove=function(a){var b=of(a);return rf.ygrids(Fh.filter(b))},rf.regions=function(a){return c(a)?bi:(bi=a,Ue(),bi)},rf.regions.add=function(a){return c(a)?bi:(bi=bi.concat(a),Ue(),bi) -},rf.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;Ui.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),bi=bi.filter(function(b){return b.classes.indexOf(a)<0})}),bi},rf.data.get=function(a){var b=rf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},rf.data.getAsTarget=function(a){var b=Cc(function(b){return b.id===a});return b.length>0?b[0]:void 0},rf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){qg[b]=a[b]}),lf(zc(rf.data.targets),{withTransition:!0}),qg):qg},rf.x=function(a){return arguments.length&&(oc(rf.data.targets,a),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),rf.data.xs},rf.xs=function(a){return arguments.length&&(pc(rf.data.targets,a),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),rf.data.xs},rf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},rf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(kh=+a.y),b(a.y2)&&(th=+a.y2)):kh=th=+a,Ue())},rf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(lh=+a.y),b(a.y2)&&(uh=+a.y2)):lh=uh=+a,Ue())},rf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&rf.axis.max(a.max),"undefined"!=typeof a.min&&rf.axis.min(a.min))},rf.legend.show=function(a){Pg||(Pg=!0,Yi.style("visibility","visible")),jf(Ac(a)),Ue({withTransitionForHorizontalAxis:!1})},rf.legend.hide=function(a){Pg&&pe(a)&&(Pg=!1,Yi.style("visibility","hidden")),kf(Ac(a)),Ue({withTransitionForHorizontalAxis:!1})},rf.resize=function(a){uf=a?a.width:null,vf=a?a.height:null,Ze({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},rf.destroy=function(){rf.data.targets=void 0,rf.data.xs={},$i.html(""),a.onresize=null},"url"in e.data)qf.xhr(e.data.url,function(a,b){var c,d=qf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=qf.csv.parse(b.response),Ne(c)});else if("rows"in e.data)Ne(rc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ne(sc(e.data.columns))}return rf},"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.31"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cJf&&(Jf=0),0>Lf&&(Lf=0),Hf={top:Vg?Gf.top:Of-Ng-(Ii?0:a),right:0/0,bottom:20+(Ii?0:a),left:Vg?Ni:Gf.left},Kf=Vg?Gf.left-Ni-Oi:Jf,Mf=Vg?Lf:Of-Hf.top-Hf.bottom,0>Kf&&(Kf=0),0>Mf&&(Mf=0),If={top:Ii?0:Of-a,right:0/0,bottom:0,left:Ii?Nf-b:0},p(),Ii&&$d(rf.data.targets)&&(If.left=Jf/2+Qf)}function o(){Xi.select("line."+f.xgridFocus).attr("x1",Vg?0:-10).attr("x2",Vg?Jf:-10).attr("y1",Vg?-10:Gf.top).attr("y2",Vg?-10:Lf)}function p(){Qf=Lf/2,Pf=.95*Qf,Rf=Zd(rf.data.targets)?.6*Pf:0}function q(){var a=Vg?f.axisX:f.axisY,b=qf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=qf.select(tf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return uf?uf:x()}function s(){var a=vf?vf:y();return a>0?a:320}function t(){return $d(rf.data.targets)?0:wf?wf:Vg||!kh||ph?1:v("y")}function u(){var a=1;return $d(rf.data.targets)?0:xf?xf:Ii?P()+(th&&!Vg?v("y2"):a):th?yh||Vg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"x"!==a||Wg?"y"!==a||kh?"y2"!==a||th?(gb(a).isInner?30:40)+("y2"===a?-10:0):Pi:Pg&&!Ii?10:1:0}function x(){return+qf.select(tf).style("width").replace("px","")}function y(){return+qf.select(tf).style("height").replace("px","")}function z(a){return a?-5:-(Gf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Vg)}function C(){return A(!Vg)}function D(){return z(Vg)}function E(){return A(Vg)}function F(a){return a?Jf+2+4:Gf.left+20}function G(a){return a?80:Lf+2}function H(){return F(!Vg)}function I(){return G(!Vg)}function J(){return F(Vg)}function K(){return G(Vg)}function L(){var a=Vg?Lf:Jf,b=xc(),c=Vb()*(Wd(rf.data.targets)?(b-(ri?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){Ji=a}function N(a){Ki=a}function O(a){Li=a}function P(){return Pg?Ii?Ki*(Ji+1):Nf:0}function Q(){return Pg?Ii?Of:Li*(Ji+1):0}function R(){var a,b=!cg;Wf=Vg?1:0,Xf=Vg?Lf:Jf,Yf=Vg?0:Lf,Zf=Vg?Jf:1,$f=Wf,_f=Xf,ag=Vg?0:Mf,bg=Vg?Kf:1,cg=T(Wf,Xf,b?void 0:cg.domain(),function(){return ig.tickOffset()}),dg=U(Yf,Zf),eg=U(Yf,Zf),fg=T(Wf,Xf,aj,function(a){return a%1?0:lg.tickOffset()}),gg=U(ag,bg),hg=U(ag,bg),a=$(),ig=X(cg,Di,a),lg=X(fg,Gi,a),jg=Y(dg,Ei,qh,sh),kg=Y(eg,Fi,zh,Bh),b||(Qi.scale(fg),yf&&Ui.scale(cg)),S()}function S(){Sf=Db(),Tf=Eb(),Uf=Eb(.98)}function T(a,b,e,f){var g=(qi?qf.time.scale():qf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),ri){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return qf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?eg:dg}function W(a){return"y2"===Z(a)?hg:gg}function X(a,b,c){var d=(ri?Bb():qf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),ri?(d.tickCentered($g),pe(ah)&&(ah=!1)):d.tickOffset=function(){var a=Vg?Lf:Jf;return a*Vb()/xc()/2},ri&&d.categories(Zg),d}function Y(a,b,c,d){return qf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in tg?tg[a]:"y"}function $(){var a=qi?Ai:ri?Qc:function(a){return 0>a?a.toFixed(0):a};return _g&&("function"==typeof _g?a=_g:qi&&(a=function(a){return a?zi(_g)(a):""})),a}function _(a){var b;return"y"===a?b=oh:"y2"===a?b=xh:"x"===a&&(b=jh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?oh=b:"y2"===a?xh=b:"x"===a&&(jh=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Vg?"inner-top":"inner-right")}function eb(){return cb("y",Vg?"inner-right":"inner-top")}function fb(){return cb("y2",Vg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?Jf/2:Jf:b.isBottom?-Lf:b.isMiddle?-Lf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Vg,db())}function ob(){return kb(Vg,eb())}function pb(){return kb(Vg,fb())}function qb(){return lb(!Vg,db())}function rb(){return lb(Vg,eb())}function sb(){return lb(Vg,fb())}function tb(){var a=db();return Vg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Vg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Vg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Vg,db())}function xb(){return mb(Vg,eb())}function yb(){return mb(Vg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return qf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Xi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Xi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Xi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+o)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Oc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return qf.min(Object.keys(i).map(function(a){return qf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=zc(a),i=Mc(a);if(sg.length>0)for(g=Pc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return qf.max(Object.keys(i).map(function(a){return qf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?vh:mh,n="y2"===c?uh:lh,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?wh:nh,r=rd()&&Vg;return 0===l.length?"y2"===c?eg.domain():dg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=sd(o,p),j=$b(dg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&rh&&(f=b(rh.top)?rh.top:e,g=b(rh.bottom)?rh.bottom:e),"y2"===c&&Ah&&(f=b(Ah.top)?Ah.top:e,g=b(Ah.bottom)?Ah.bottom:e),Wd(l)&&!Oc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(aj),c=$b(cg.domain());return a||0===c?1:b/c}function Wb(a){return gh?gh:qf.min(a,function(a){return qf.min(a.values,function(a){return a.x})})}function Xb(a){return fh?fh:qf.max(a,function(a){return qf.max(a.values,function(a){return a.x})})}function Yb(a,c){var d,e,f,g,h=c[0],i=c[1],j=Math.abs(h-i);return ri?e=0:Wd(a)?(d=xc(),e=d>1?j/(d-1)/2:.5):e=.01*j,"object"==typeof hh&&qe(hh)?(f=b(hh.left)?hh.left:e,g=b(hh.right)?hh.right:e):f=g="number"==typeof hh?hh:e,{left:f,right:g}}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=0,g=0;return(c||0===c)&&(f=qi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=qi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bb?0:b-c}function fc(a){var b,c=dc(a),d="y"===a.axis?dg:eg;return b="y"===a.axis||"y2"===a.axis?Vg?Lf:"start"in a?d(a.start):Lf:Vg?"end"in a?cg(qi?le(a.end):a.end):Lf:Lf,c>b?0:b-c}function gc(a){return mg&&a===mg||qe(ng)&&re(ng,a)}function hc(a){return!gc(a)}function ic(a){return mg?mg:qe(ng)?ng[a]:null}function jc(a,b){var c,d=b&&qe(b)?zc(b):[];return d.forEach(function(b){ic(b)===a&&(c=rf.data.xs[b])}),c}function kc(a,b){return a in rf.data.xs&&rf.data.xs[a]&&rf.data.xs[a][b]?rf.data.xs[a][b]:b}function lc(a){Object.keys(a).forEach(function(b){ng[b]=a[b]})}function mc(a){return 1===qf.set(Object.keys(a).map(function(b){return a[b]})).size()}function nc(a){var b;return a&&(b=qg[a.id],a.name=b?b:a.id),a}function oc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=qc(b[d],a.id,d)}),rf.data.xs[a.id]=b})}function pc(a,b){a.forEach(function(a){b[a.id]&&oc([a],b[a.id])})}function qc(a,b,c){var d;return d=qi?a?a instanceof Date?a:le(a):le(kc(b,c)):si&&!ri?a?+a:kc(b,c):c}function rc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?rf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):mg?(d=Object.keys(rf.data.xs),rf.data.xs[c]=d.length>0?rf.data.xs[d[0]]:void 0):qe(ng)&&(rf.data.xs[c]=jc(f,rf.data.targets)):rf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!rf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=pg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=ic(b),g=a[f],h=qc(g,b,e);return si&&ri&&0===c&&g&&(0===e&&(Zg=[]),Zg.push(g)),("undefined"==typeof a[b]||rf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),ug&&Ud(zc(c).filter(function(a){return!(a in vg)}),ug),c.forEach(function(a){ac(a.id_org,a)}),c}function uc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function vc(a){return a>0&&rf.data.targets[0].values[a-1]?rf.data.targets[0].values[a-1].x:void 0}function wc(a){return a1?rf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?rf.data.targets[0]:null,a}function zc(a){return a.map(function(a){return a.id})}function Ac(a){return a?"string"==typeof a?[a]:a:zc(rf.data.targets)}function Bc(a,b){var c,d=zc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(qi?new Date(h):h);i.push(d)}return qi||(i=i.sort(function(a,b){return a-b})),i}function Ic(a){Bi=Bi.concat(a)}function Jc(a){Bi=Bi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){Ci=Ci.concat(a)}function Lc(a){Ci=Ci.filter(function(b){return a.indexOf(b)<0})}function Mc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Nc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Pc(a){return Nc(a,function(a){return a>0})}function Qc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(Ad(a,f))),a[g].x&&(e=e.concat(Ad(a,g))),Dd(e,b)):Bd(a,b,f,g)}function Cd(a,b){var c;return c=a.map(function(a){return Bd(a.values,b)}),Dd(c,b)}function Dd(a,b){var c,d;return a.forEach(function(a){var e=se(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Ed(a,b){return qf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Fd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Gd(){return xg&&"desc"===xg.toLowerCase()}function Hd(){return xg&&"asc"===xg.toLowerCase()}function Id(a){var b=Hd(),c=Gd();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof xg&&a.sort(xg),a}function Jd(a,c){var d,e,f,g,h,i,j,k=$d(rf.data.targets),l=k?ud:td,m=a.filter(function(a){return a&&b(a.value)});di&&0!==m.length&&($i.html(gi(a,$(),l,yi)).style("display","block"),d=$i.property("offsetWidth"),e=$i.property("offsetHeight"),k?(g=Jf/2+c[0],i=Lf/2+c[1]+20):(Vg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=cg(m[0].x)+20):(f=q(),g=f+t()+cg(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),$i.style("top",i+"px").style("left",g+"px"))}function Kd(){$i.style("display","none")}function Ld(a){var c=a.filter(function(a){return a&&b(a.value)});di&&(Xd(rf.data.targets)||$d(rf.data.targets)||Xi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Vg?"y1":"x1",wd).attr(Vg?"y2":"x2",wd))}function Md(){Xi.select("line."+f.xgridFocus).style("visibility","hidden")}function Nd(a){return a.x||0===a.x?cg(a.x):null}function Od(a){return V(a.id)(a.value)}function Pd(){var a,b,d={},e=0;return Fc(Cc(be)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Td(a,b){return Ph?Ph:b?2*a.tickOffset()*Qh/b:0}function Ud(a,b){Ac(a).forEach(function(a){cj[a]=b===vg[a],vg[a]=b})}function Vd(a,b){var c=!1;return a.forEach(function(a){vg[a.id]===b&&(c=!0),a.id in vg||"line"!==b||(c=!0)}),c}function Wd(a){return Vd(a,"bar")}function Xd(a){return Vd(a,"scatter")}function Yd(a){return Vd(a,"pie")}function Zd(a){return Vd(a,"donut")}function $d(a){return Yd(a)||Zd(a)}function _d(a){var b="string"==typeof a?a:a.id;return!(b in vg)||"line"===vg[b]||"spline"===vg[b]||"area"===vg[b]||"area-spline"===vg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"spline"===vg[b]||"area-spline"===vg[b]}function be(a){var b="string"==typeof a?a:a.id;return"bar"===vg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"scatter"===vg[b]}function de(a){var b="string"==typeof a?a:a.id;return"pie"===vg[b]}function ee(a){var b="string"==typeof a?a:a.id;return"donut"===vg[b]}function fe(a){return de(a)||ee(a)}function ge(a){return be(a)?a.values:[]}function he(a){return _d(a)||ce(a)?a.values:[]}function ie(a){return be(a)||_d(a)?a.values:[]}function je(a){return ee(a)&&Zh||de(a)&&Th}function ke(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function le(b){var c;try{c=og?qf.time.format(og).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+og)}return c}function me(a,b){var c=qf.mouse(a),d=qf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function re(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function se(a,b){var c="y"===Z(a.id)?dg:eg,d=Vg?1:0,e=Vg?0:1;return Math.pow(cg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function te(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function ue(a,b,c){Ig(b,a.node()),Xi.select("."+f.selectedCircles+id(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Rc(f.selectedCircle,c)}).attr("cx",Vg?Od:Nd).attr("cy",Vg?Nd:Od).attr("stroke",function(){return yi(b)}).attr("r",1.4*Nh).transition().duration(100).attr("r",Nh)}function ve(a,b,c){Jg(b,a.node()),Xi.select("."+f.selectedCircles+id(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a,b){Ig(b,a.node()),a.transition().duration(100).style("fill",function(){return qf.rgb(yi(b)).darker(1)})}function ye(a,b){Jg(b,a.node()),a.transition().duration(100).style("fill",function(){return yi(b)})}function ze(a,b,c,d){a?xe(b,c,d):ye(b,c,d)}function Ae(a){return a.filter(function(a){return b(a.value)})}function Be(a,c){return(c?Xi.selectAll("."+f.circles+id(c)):Xi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ce(a,b){Be(a,b).classed(f.EXPANDED,!0).attr("r",Mh)}function De(a){Be(a).filter(function(){return qf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Jh)}function Ee(a){return Xi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Fe(a){Ee(a).classed(f.EXPANDED,!0)}function Ge(a){Ee(a).classed(f.EXPANDED,!1)}function He(a,b){var c=Le(a,b);return function(a,b){var d=c(a,b),e=Vg?1:0,f=Vg?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function Ie(a,b){var c=Le(a,!1),d=b?Je:Ke;return function(a,b){return d(c(a,b),a,this)}}function Je(a,b){var c;return Vg?(c=be(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ke(a,b,c){var d=c.getBoundingClientRect();return Vg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:be(b)?-3:-6)}function Le(a,b){var c=a.__max__+1,d=Td(ig,c),e=Qd(d,c,a,!!b),f=Rd(!!b),g=Sd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Vg&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Me(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function Ne(b){var c,d,e;if(_i=qf.select(tf),_i.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(_i.html(""),_i.classed("c3",!0),rf.data.xs={},rf.data.targets=tc(b),n(),R(),cg.domain(qf.extent(Zb(rf.data.targets))),dg.domain(Ub(rf.data.targets,"y")),eg.domain(Ub(rf.data.targets,"y2")),fg.domain(cg.domain()),gg.domain(dg.domain()),hg.domain(eg.domain()),aj=cg.domain(),Qi.scale(fg),yf&&Ui.scale(cg),Vi=_i.append("svg").attr("width",Jf+Gf.left+Gf.right).attr("height",Lf+Gf.top+Gf.bottom).on("mouseenter",Bf).on("mouseleave",Cf),Wi=Vi.append("defs"),Wi.append("clipPath").attr("id",ki).append("rect").attr("width",Jf).attr("height",Lf),Wi.append("clipPath").attr("id",li).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Wi.append("clipPath").attr("id",mi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Xi=Vi.append("g").attr("transform",Hi.main),Yi=Mg?Vi.append("g").attr("transform",Hi.context):null,Zi=Vi.append("g").attr("transform",Hi.legend),Pg||(Zi.style("visibility","hidden"),Ci=zc(rf.data.targets)),$i=qf.select(tf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),lf(zc(rf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Wg&&Xi.append("g").attr("class",f.axisX).attr("clip-path",oi).attr("transform",Hi.x).append("text").attr("class",f.axisXLabel).attr("transform",Vg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),kh&&Xi.append("g").attr("class",f.axisY).attr("clip-path",pi).attr("transform",Hi.y).append("text").attr("class",f.axisYLabel).attr("transform",Vg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),th&&Xi.append("g").attr("class",f.axisY2).attr("transform",Hi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Vg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Xi.append("g").attr("clip-path",ni).attr("class",f.grid),Ch&&d.append("g").attr("class",f.xgrids),qe(Eh)&&d.append("g").attr("class",f.xgridLines),Kh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Fh&&d.append("g").attr("class",f.ygrids),qe(Gh)&&d.append("g").attr("class",f.ygridLines),Xi.append("g").attr("clip-path",ni).attr("class",f.regions),Xi.append("g").attr("clip-path",ni).attr("class",f.chart),c=Xi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",yf?Vg?"ns-resize":"ew-resize":null),Xi.select("."+f.chart).append("g").attr("class",f.chartBars),Xi.select("."+f.chart).append("g").attr("class",f.chartLines),Xi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Hi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Xi.select("."+f.chart).append("g").attr("class",f.chartTexts),yf&&Xi.insert("rect",Af?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Jf).attr("height",Lf).style("opacity",0).style("cursor",Vg?"ns-resize":"ew-resize").call(Ui).on("dblclick.zoom",null),ih&&Qi.extent("function"!=typeof ih?ih:ih(Zb())),Mg&&(Yi.append("g").attr("clip-path",ni).attr("class",f.chart),Yi.select("."+f.chart).append("g").attr("class",f.chartBars),Yi.select("."+f.chart).append("g").attr("class",f.chartLines),Yi.append("g").attr("clip-path",ni).attr("class",f.brush).call(Qi).selectAll("rect").attr(Vg?"width":"height",Vg?Kf:Mf),Yi.append("g").attr("class",f.axisX).attr("transform",Hi.subx).attr("clip-path",Vg?"":oi)),$e(rf.data.targets),Vg?Xi.select("."+f.axisX).style("opacity",0).call(ig):(Xi.select("."+f.axisY).style("opacity",0).call(jg),Xi.select("."+f.axisY2).style("opacity",0).call(kg)),Ue({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),hi){if(qi&&"string"==typeof ii){for(ii=le(ii),e=0;e0){d=[];for(var g in qg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Fd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=ze,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function Se(a){$d(rf.data.targets)||Bg&&(ti=a,Xi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),ui=!0,Kg())}function Te(){$d(rf.data.targets)||Bg&&(Xi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Xi.selectAll("."+f.shape).classed(f.INCLUDED,!1),ui=!1,Lg())}function Ue(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Pd(),U=$d(rf.data.targets),V=Fc(rf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?Ff:0,O=B?N:0,P=C?N:0,H&&Pg&&lf(zc(rf.data.targets),a),G&&(cg.domain(qf.extent(Zb(V))),aj=cg.domain(),yf&&Ui.scale(cg).updateScaleExtent(),fg.domain(cg.domain()),Qi.scale(fg)),F&&(cg.domain(Qi.empty()?aj:Qi.extent()),yf&&Ui.scale(cg).updateScaleExtent()),dg.domain(Ub(V,"y")),eg.domain(Ub(V,"y2")),(dh||ch)&&(Q=eh?eh:Hc(Gc(V)),ig.tickValues(Q),lg.tickValues(Q)),c=Xi.select("."+f.axisX).style("opacity",U?0:1),(Vg||D)&&(c=c.transition().duration(P)),c.call(ig),e=Xi.select("."+f.axisY).style("opacity",U?0:1),(!Vg||D)&&(e=e.transition().duration(P)),e.call(jg),Xi.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(kg),F)if(ah&&Q){for(R=1;R=0&&qf.select(this).style("display",b%S?"none":"block")})}else qf.selectAll("."+f.axisX+" .tick text").style("display","block");if(I=He(T),K=Ie(T,!0),M=Ie(T,!1),Ab(),gg.domain(dg.domain()),hg.domain(eg.domain()),$i.style("display","none"),o(),Xi.select("line."+f.xgridFocus).style("visibility","hidden"),Ch){if("year"===Dh){h=[];for(var W=Zb(),X=W[0].getFullYear(),Y=W[1].getFullYear(),Z=X;Y>=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=cg.ticks(10);g=Xi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Vg?0:function(a){return cg(a)-ig.tickOffset()}).attr("x2",Vg?Jf:function(a){return cg(a)-ig.tickOffset()}).attr("y1",Vg?function(a){return cg(a)-ig.tickOffset()}:Gf.top).attr("y2",Vg?function(a){return cg(a)-ig.tickOffset()}:Lf).style("opacity",function(){return+qf.select(this).attr(Vg?"y1":"x1")===(Vg?Lf:0)?0:1}),g.exit().remove()}qe(Eh)&&(i=Xi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Eh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Vg?"":"rotate(-90)").attr("dx",Vg?0:-Gf.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Vg?0:xd).attr("x2",Vg?Jf:xd).attr("y1",Vg?xd:Gf.top).attr("y2",Vg?xd:Lf).style("opacity",1),i.select("text").transition().duration(N).attr("x",Vg?Jf:0).attr("y",xd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&Fh&&(k=Xi.select("."+f.ygrids).selectAll("."+f.ygrid).data(dg.ticks(Hh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Vg?dg:0).attr("x2",Vg?dg:Jf).attr("y1",Vg?0:dg).attr("y2",Vg?Lf:dg),k.exit().remove()),y&&qe(Gh)&&(l=Xi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Gh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Vg?"rotate(-90)":"").attr("dx",Vg?0:-Gf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Vg?yd:0).attr("x2",Vg?yd:Jf).attr("y1",Vg?0:yd).attr("y2",Vg?Lf:yd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Vg?0:Jf).attr("y",yd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Xi.selectAll("."+f.bars).selectAll("."+f.bar).data(ge),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return yi(a)}).attr("class",Zc),p.style("opacity",nd).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Xi.selectAll("."+f.texts).selectAll("."+f.text).data(ie),r.enter().append("text").attr("class",Sc).attr("text-anchor",function(a){return Vg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return vd(a.id)(a.value)}).style("fill-opacity",od).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",qd),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Xi.selectAll("."+f.line).style("opacity",nd).transition().duration(N).attr("d",Ri).style("opacity",1),Xi.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Si).style("opacity",bj),n=Xi.selectAll("."+f.circles).selectAll("."+f.circle).data(he),n.enter().append("circle").attr("class",Xc).style("opacity",0).attr("r",Jh),n.style("opacity",nd).transition().duration(N).style("opacity",pd).attr("cx",Vg?Od:Nd).attr("cy",Vg?Nd:Od),n.exit().remove(),Xi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=qf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Xi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Dc(a.data.id)&&fe(a.data)?1:0}),Xi.select("."+f.chartArcsTitle).style("opacity",Zd(rf.data.targets)?1:0),Mg&&(null!==qf.event&&"zoom"===qf.event.type&&Qi.extent(cg.orgDomain()).update(),z&&(Yi.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(lg),Qi.empty()||Qi.extent(cg.orgDomain()).update(),J=He(T,!0),s=Yi.selectAll("."+f.bars).selectAll("."+f.bar).data(ge),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return yi(a)}).attr("class",Zc),s.style("opacity",nd).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Yi.selectAll("."+f.line).style("opacity",nd).transition().duration(N).attr("d",Ti).style("opacity",1))),Xi.selectAll("."+f.selectedCircles).filter(function(a){return be(a)}).selectAll("circle").remove(),Xi.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Vg?Od:Nd).attr("cy",Vg?Nd:Od),t=Xi.select("."+f.eventRects),qe(ng)&&!mc(ng)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Xi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Pe(u.enter()),u.attr("x",0).attr("y",0).attr("width",Jf).attr("height",Lf)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),si&&!ri?(x=function(a,b){var c=vc(b),d=wc(b),e=rf.data.xs[a.id][b];return(cg(d?d:e+50)-cg(c?c:e-50))/2},w=function(a,b){var c=vc(b),d=rf.data.xs[a.id][b];return(cg(d)+cg(c?c:d-50))/2}):(x=L(),w=function(a){return cg(a.x)-x/2}),v=yc(),Xi.select("."+f.eventRects).datum(v?v.values:[]),u=Xi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Oe(u.enter()),u.attr("class",cd).attr("x",Vg?0:w).attr("y",Vg?w:0).attr("width",Vg?Jf:x).attr("height",Vg?x:Lf),u.exit().remove()),q=Xi.select("."+f.regions).selectAll("rect."+f.region).data(ci),q.enter().append("rect").style("fill-opacity",0),q.attr("class",bd).attr("x",cc).attr("y",dc).attr("width",ec).attr("height",fc).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),zc(rf.data.targets).forEach(function(a){cj[a]=!0})}}function Ve(){Ue({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function We(){return"mousemove"===qf.event.sourceEvent.type&&Ui.altDomain?(cg.domain(Ui.altDomain),void Ui.scale(cg).updateScaleExtent()):(ri&&cg.orgDomain()[0]===aj[0]&&cg.domain([aj[0]-1e-10,cg.orgDomain()[1]]),Ue({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===qf.event.sourceEvent.type&&(vi=!0)))}function Xe(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ye(){Vi.attr("width",Nf).attr("height",Of),Vi.select("#"+ki).select("rect").attr("width",Jf).attr("height",Lf),Vi.select("#"+li).select("rect").attr("width",H),Vi.select("#"+mi).select("rect").attr("width",J),Vi.select("."+f.zoomRect).attr("width",Jf).attr("height",Lf)}function Ze(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Ye(),m(a.withTransition),Ue(a)}function $e(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Xi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",ed),j=i.enter().append("g").attr("class",ed).style("pointer-events","none"),j.append("g").attr("class",Tc).style("fill",function(a){return yi(a)}),e=Xi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",gd),d=e.enter().append("g").attr("class",gd).style("pointer-events","none"),d.append("g").attr("class",$c).style("fill",function(a){return yi(a)}).style("stroke","none").style("cursor",function(a){return Dg(a)?"pointer":null}),c=Xi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",fd),b=c.enter().append("g").attr("class",fd).style("pointer-events","none"),b.append("path").attr("class",Wc).style("opacity",0).style("stroke",function(a){return yi(a)}),b.append("path").attr("class",ad).style("opacity",function(){return bj=+qf.select(this).style("opacity"),0}).style("fill",function(a){return yi(a)}),b.append("g").attr("class",function(a){return Rc(f.selectedCircles,a.id)}),b.append("g").attr("class",Yc).style("fill",function(a){return yi(a)}).style("cursor",function(a){return Dg(a)?"pointer":null}),a.forEach(function(a){Xi.selectAll("."+f.selectedCircles+id(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Xi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Vf(a)).attr("class",hd),g=h.enter().append("g").attr("class",hd),g.append("path").attr("class",_c).style("opacity",0).style("fill",function(a){return yi(a.data)}).style("cursor",function(a){return Dg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),ff(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Jd(c,qf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),hf(),Kd(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Mg&&(n=Yi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",gd),m=n.enter().append("g").attr("class",gd),m.append("g").attr("class",$c).style("fill",function(a){return yi(a)}),l=Yi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",fd),k=l.enter().append("g").attr("class",fd),k.append("path").attr("class",Wc).style("opacity",0).style("stroke",function(a){return yi(a)})),Vi.selectAll("."+f.target).filter(function(a){return Dc(a.id)}).transition().style("opacity",1)}function _e(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Ud(a.id,b.types[a.id]):Ud(a.id,b.type)}),rf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Ii?j:i,l=Ii?Q():P();return d&&(w=0,C=0,t=0,u=0),Pg&&!Ec(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Ii?u:t,void(Ug?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,Ii?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Zi.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Rc(f.legendItem,a)}).style("visibility",function(a){return Ec(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Rg?Rg(a):rf.toggle(a)}).on("mouseover",function(a){rf.focus(a),"function"==typeof Sg&&Sg(a)}).on("mouseout",function(a){rf.revert(),"function"==typeof Tg&&Tg(a)}),l.append("text").text(function(a){return d(qg[a])?qg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",Ii?g:-200).attr("y",Ii?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ii?h:-200).attr("y",Ii?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return yi(a)}).attr("x",Ii?g:-200).attr("y",Ii?-200:i).attr("width",10).attr("height",10),Zi.selectAll("text").data(a).text(function(a){return d(qg[a])?qg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Zi.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Zi.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Ye(),q&&m(p)}function mf(a){return Bc(rf.data.targets,a.id)}function nf(a){return"data"in a&&Bc(rf.data.targets,a.data.id)}function of(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 pf(a,b,c){var d=!$d(rf.data.targets);Ud(a,b),Ze(c?c:{withTransitionForAxis:d})}var qf=a.d3?a.d3:a.require?a.require("d3"):void 0,rf={data:{},axis:{},legend:{}},sf={},tf=h(["bindto"],"#chart"),uf=h(["size","width"]),vf=h(["size","height"]),wf=h(["padding","left"]),xf=h(["padding","right"]),yf=h(["zoom","enabled"],!1),zf=h(["zoom","extent"]),Af=h(["zoom","privileged"],!1),Bf=h(["onenter"],function(){}),Cf=h(["onleave"],function(){}),Df=h(["onresize"],function(){}),Ef=h(["onresized"],function(){}),Ff=h(["transition","duration"],350);g("data","data is required in config");var Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg=h(["data","x"]),ng=h(["data","xs"],{}),og=h(["data","x_format"]),pg=h(["data","id_converter"],function(a){return a}),qg=h(["data","names"],{}),rg=h(["data","classes"],{}),sg=h(["data","groups"],[]),tg=h(["data","axes"],{}),ug=h(["data","type"]),vg=h(["data","types"],{}),wg=h(["data","labels"],{}),xg=h(["data","order"]),yg=h(["data","regions"],{}),zg=h(["data","color"]),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","item","onmouseover"]),Tg=h(["legend","item","onmouseout"]),Ug=h(["legend","equally"],!1),Vg=h(["axis","rotated"],!1),Wg=h(["axis","x","show"],!0),Xg=h(["axis","x","type"],"indexed"),Yg=h(["axis","x","localtime"],!0),Zg=h(["axis","x","categories"],[]),$g=h(["axis","x","tick","centered"],!1),_g=h(["axis","x","tick","format"]),ah=h(["axis","x","tick","culling"],{}),bh=h(["axis","x","tick","culling","max"],10),ch=h(["axis","x","tick","count"]),dh=h(["axis","x","tick","fit"],!0),eh=h(["axis","x","tick","values"],null),fh=h(["axis","x","max"]),gh=h(["axis","x","min"]),hh=h(["axis","x","padding"],{}),ih=h(["axis","x","default"]),jh=h(["axis","x","label"],{}),kh=h(["axis","y","show"],!0),lh=h(["axis","y","max"]),mh=h(["axis","y","min"]),nh=h(["axis","y","center"]),oh=h(["axis","y","label"],{}),ph=h(["axis","y","inner"],!1),qh=h(["axis","y","tick","format"]),rh=h(["axis","y","padding"],{}),sh=h(["axis","y","ticks"],10),th=h(["axis","y2","show"],!1),uh=h(["axis","y2","max"]),vh=h(["axis","y2","min"]),wh=h(["axis","y2","center"]),xh=h(["axis","y2","label"],{}),yh=h(["axis","y2","inner"],!1),zh=h(["axis","y2","tick","format"]),Ah=h(["axis","y2","padding"],{}),Bh=h(["axis","y2","ticks"],10),Ch=h(["grid","x","show"],!1),Dh=h(["grid","x","type"],"tick"),Eh=h(["grid","x","lines"],[]),Fh=h(["grid","y","show"],!1),Gh=h(["grid","y","lines"],[]),Hh=h(["grid","y","ticks"],10),Ih=h(["point","show"],!0),Jh=Ih?h(["point","r"],2.5):0,Kh=h(["point","focus","line","enabled"],!0),Lh=h(["point","focus","expand","enabled"],!0),Mh=h(["point","focus","expand","r"],Lh?4:Jh),Nh=h(["point","focus","select","r"],8),Oh=h(["line","connect_null"],!1),Ph=h(["bar","width"]),Qh=h(["bar","width","ratio"],.6),Rh=h(["pie","label","show"],!0),Sh=h(["pie","label","format"]),Th=h(["pie","expand"],!0),Uh=h(["pie","onclick"],function(){}),Vh=h(["pie","onmouseover"],function(){}),Wh=h(["pie","onmouseout"],function(){}),Xh=h(["donut","label","show"],!0),Yh=h(["donut","label","format"]),Zh=h(["donut","expand"],!0),$h=h(["donut","title"],""),_h=h(["donut","onclick"],function(){}),ai=h(["donut","onmouseover"],function(){}),bi=h(["donut","onmouseout"],function(){}),ci=h(["regions"],[]),di=h(["tooltip","show"],!0),ei=h(["tooltip","format","title"]),fi=h(["tooltip","format","value"]),gi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ei?ei:b,l=fi?fi: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+""}),hi=h(["tooltip","init","show"],!1),ii=h(["tooltip","init","x"],0),ji=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ki=("string"==typeof tf?tf.replace("#",""):tf.id)+"-clip",li=ki+"-xaxis",mi=ki+"-yaxis",ni=i(ki),oi=i(li),pi=i(mi),qi="timeseries"===Xg,ri="categorized"===Xg,si=!qi&&(mg||qe(ng)),ti=null,ui=!1,vi=!1,wi=!1,xi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],yi=ke(Ag,qe(Og)?Og:xi,zg),zi=Yg?qf.time.format:qf.time.format.utc,Ai=function(){var a=[[zi("%Y/%-m/%-d"),function(){return!0}],[zi("%-m/%-d"),function(a){return a.getMonth()}],[zi("%-m/%-d"),function(a){return 1!==a.getDate()}],[zi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[zi("%I %p"),function(a){return a.getHours()}],[zi("%I:%M"),function(a){return a.getMinutes()}],[zi(":%S"),function(a){return a.getSeconds()}],[zi(".%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)}}(),Bi=[],Ci=[],Di=Vg?"left":"bottom",Ei=Vg?ph?"top":"bottom":ph?"right":"left",Fi=Vg?yh?"bottom":"top":yh?"left":"right",Gi=Vg?"left":"bottom",Hi={main:function(){return"translate("+Gf.left+","+Gf.top+")"},context:function(){return"translate("+Hf.left+","+Hf.top+")"},legend:function(){return"translate("+If.left+","+If.top+")"},x:function(){return"translate(0,"+(Vg?0:Lf)+")"},y:function(){return"translate(0,"+(Vg?Lf:0)+")"},y2:function(){return"translate("+(Vg?0:Jf)+","+(Vg?1:0)+")"},subx:function(){return"translate(0,"+(Vg?0:Mf)+")"},arc:function(){return"translate("+Jf/2+","+Lf/2+")"}},Ii="right"===Qg,Ji=0,Ki=0,Li=0,Mi=.15,Ni=30,Oi=Vg&&!Wg?0:30,Pi=5;Vf=qf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Qi,Ri=function(){var a=qf.svg.line().x(Vg?function(a){return V(a.id)(a.value)}:wd).y(Vg?wd:function(a){return V(a.id)(a.value)});return Oh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Oh?Ae(b.values):b.values;return _d(b)?(a.interpolate(ae(b)?"cardinal":"linear"),yg[b.id]?Me(e,cg,V(b.id),yg[b.id]):a(e)):(c=e[0]?cg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Vg?"M "+d+" "+c:"M "+c+" "+d)}}(),Si=function(){var a;return a=Vg?qf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(wd):qf.svg.area().x(wd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ae(b.values);return Vd([b],"area")||Vd([b],"area-spline")?(a.interpolate(ae(b)?"cardinal":"linear"),a(e)):(c=e[0]?cg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Vg?"M "+d+" "+c:"M "+c+" "+d)}}(),Ti=function(){var a=qf.svg.line().x(Vg?function(a){return W(a.id)(a.value)}:zd).y(Vg?zd:function(a){return W(a.id)(a.value)});return function(b){var c=Ae(b.values);return _d(b)?a(c):"M "+fg(c[0].x)+" "+W(b.id)(c[0].value)}}(),Ui=function(){};Qi=qf.svg.brush().on("brush",Ve),Qi.update=function(){return Yi&&Yi.select("."+f.brush).call(this),this},Qi.scale=function(a){return Vg?this.y(a):this.x(a)},yf&&(Ui=qf.behavior.zoom().on("zoomstart",function(){Ui.altDomain=qf.event.sourceEvent.altKey?cg.orgDomain():null}).on("zoom",yf?We:null),Ui.scale=function(a){return Vg?this.y(a):this.x(a)},Ui.orgScaleExtent=function(){var a=zf?zf:[1,10];return[a[0],Math.max(xc()/a[1],a[1])]},Ui.updateScaleExtent=function(){var a=$b(cg.orgDomain())/$b(aj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Vi,Wi,Xi,Yi,Zi,$i,_i,aj,bj,cj={};if(rf.focus=function(a){function b(a){Fc(a).transition().duration(100).style("opacity",1)}var c=Vi.selectAll(jd(a)),d=c.filter(mf),e=c.filter(nf);rf.revert(),rf.defocus(),b(d.classed(f.focused,!0)),b(e),$d(rf.data.targets)&&Kb(a,!0),ff(a)},rf.defocus=function(a){function b(a){Fc(a).transition().duration(100).style("opacity",.3)}var c=Vi.selectAll(jd(a)),d=c.filter(mf),e=c.filter(nf);rf.revert(),b(d.classed(f.focused,!1)),b(e),$d(rf.data.targets)&&Lb(a),gf(a)},rf.revert=function(a){function b(a){Fc(a).transition().duration(100).style("opacity",1)}var c=Vi.selectAll(jd(a)),d=c.filter(mf),e=c.filter(nf);b(d.classed(f.focused,!1)),b(e),$d(rf.data.targets)&&Lb(a),hf()},rf.show=function(a,b){a=Ac(a),b=b||{},Jc(a),Vi.selectAll(kd(a)).transition().style("opacity",1),b.withLegend?jf(a):Zi.selectAll(md(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},rf.hide=function(a,b){a=Ac(a),b=b||{},Ic(a),Vi.selectAll(kd(a)).transition().style("opacity",0),b.withLegend?kf(a):Zi.selectAll(md(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Mi),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},rf.toggle=function(a){Dc(a)?rf.hide(a):rf.show(a)},rf.unzoom=function(){Qi.clear().update(),Ue({withUpdateXDomain:!0})},rf.load=function(a){return a.xs&&lc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){rg[b]=a.classes[b]}),"categories"in a&&ri&&(Zg=a.categories,ig.categories(Zg)),"cacheIds"in a&&_b(a.cacheIds)?void _e(bc(a.cacheIds),a.done):void("unload"in a?bf(Ac("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){af(a)}):af(a))},rf.unload=function(a){bf(Ac(a),function(){Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},rf.selected=function(a){return qf.merge(Xi.selectAll("."+f.shapes+id(a)).selectAll("."+f.shape).filter(function(){return qf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},rf.select=function(a,b,c){Bg&&Xi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=qf.select(this),i="circle"===this.nodeName?ue:xe,j="circle"===this.nodeName?ve:ye,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)})},rf.unselect=function(a,b){Bg&&Xi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=qf.select(this),g="circle"===this.nodeName?ve:ye,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)})},rf.toLine=function(a){pf(a,"line")},rf.toSpline=function(a){pf(a,"spline")},rf.toBar=function(a){pf(a,"bar")},rf.toScatter=function(a){pf(a,"scatter")},rf.toArea=function(a){pf(a,"area")},rf.toAreaSpline=function(a){pf(a,"area-spline")},rf.toPie=function(a){pf(a,"pie",{withTransform:!0})},rf.toDonut=function(a){pf(a,"donut",{withTransform:!0})},rf.groups=function(a){return c(a)?sg:(sg=a,Ue(),sg)},rf.xgrids=function(a){return a?(Eh=a,Ue(),Eh):Eh},rf.xgrids.add=function(a){return a?rf.xgrids(Eh.concat(a)):void 0},rf.xgrids.remove=function(a){var b=of(a);return rf.xgrids(Eh.filter(b))},rf.ygrids=function(a){return a?(Gh=a,Ue(),Gh):Gh},rf.ygrids.add=function(a){return a?rf.ygrids(Gh.concat(a)):void 0},rf.ygrids.remove=function(a){var b=of(a);return rf.ygrids(Gh.filter(b))},rf.regions=function(a){return c(a)?ci:(ci=a,Ue(),ci)},rf.regions.add=function(a){return c(a)?ci:(ci=ci.concat(a),Ue(),ci) +},rf.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;Vi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ci=ci.filter(function(b){return b.classes.indexOf(a)<0})}),ci},rf.data.get=function(a){var b=rf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},rf.data.getAsTarget=function(a){var b=Cc(function(b){return b.id===a});return b.length>0?b[0]:void 0},rf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){qg[b]=a[b]}),lf(zc(rf.data.targets),{withTransition:!0}),qg):qg},rf.x=function(a){return arguments.length&&(oc(rf.data.targets,a),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),rf.data.xs},rf.xs=function(a){return arguments.length&&(pc(rf.data.targets,a),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),rf.data.xs},rf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},rf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(lh=+a.y),b(a.y2)&&(uh=+a.y2)):lh=uh=+a,Ue())},rf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(mh=+a.y),b(a.y2)&&(vh=+a.y2)):mh=vh=+a,Ue())},rf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&rf.axis.max(a.max),"undefined"!=typeof a.min&&rf.axis.min(a.min))},rf.legend.show=function(a){Pg||(Pg=!0,Zi.style("visibility","visible")),jf(Ac(a)),Ue({withTransitionForHorizontalAxis:!1})},rf.legend.hide=function(a){Pg&&pe(a)&&(Pg=!1,Zi.style("visibility","hidden")),kf(Ac(a)),Ue({withTransitionForHorizontalAxis:!1})},rf.resize=function(a){uf=a?a.width:null,vf=a?a.height:null,Ze({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},rf.destroy=function(){rf.data.targets=void 0,rf.data.xs={},_i.html(""),a.onresize=null},"url"in e.data)qf.xhr(e.data.url,function(a,b){var c,d=qf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=qf.csv.parse(b.response),Ne(c)});else if("rows"in e.data)Ne(rc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ne(sc(e.data.columns))}return rf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 5eba756fd3f6f8a3fdfc13949b0d5e80dca48122 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 23 Apr 2014 14:33:30 +0900 Subject: [PATCH 056/178] Add axis.x.tick.rotate and axis.x.height for tick text rotate - #138 --- c3.js | 49 +++++++++++++++++++++++++++++++++++++++++-------- c3.min.js | 6 +++--- 2 files changed, 44 insertions(+), 11 deletions(-) diff --git a/c3.js b/c3.js index cdb9e60..656bde0 100644 --- a/c3.js +++ b/c3.js @@ -151,7 +151,7 @@ // subchart var __subchart_show = getConfig(['subchart', 'show'], false), - __subchart_size_height = __subchart_show ? getConfig(['subchart', 'size', 'height'], 60) : 0; + __subchart_size_height = getConfig(['subchart', 'size', 'height'], 60); // color var __color_pattern = getConfig(['color', 'pattern'], []); @@ -177,9 +177,11 @@ __axis_x_tick_count = getConfig(['axis', 'x', 'tick', 'count']), __axis_x_tick_fit = getConfig(['axis', 'x', 'tick', 'fit'], true), __axis_x_tick_values = getConfig(['axis', 'x', 'tick', 'values'], null), + __axis_x_tick_rotate = getConfig(['axis', 'x', 'tick', 'rotate']), __axis_x_max = getConfig(['axis', 'x', 'max']), __axis_x_min = getConfig(['axis', 'x', 'min']), __axis_x_padding = getConfig(['axis', 'x', 'padding'], {}), + __axis_x_height = getConfig(['axis', 'x', 'height']), __axis_x_default = getConfig(['axis', 'x', 'default']), __axis_x_label = getConfig(['axis', 'x', 'label'], {}), __axis_y_show = getConfig(['axis', 'y', 'show'], true), @@ -376,17 +378,19 @@ var rotated_padding_left = 30, rotated_padding_right = __axis_rotated && !__axis_x_show ? 0 : 30, rotated_padding_top = 5; function updateSizes() { - var legendHeight = getLegendHeight(), legendWidth = getLegendWidth(); + var legendHeight = getLegendHeight(), legendWidth = getLegendWidth(), subchartHeight = __subchart_show ? (__subchart_size_height + getHorizontalAxisHeight('x')) : 0; currentWidth = getCurrentWidth(); currentHeight = getCurrentHeight(); + // TODO: refactor.. + // for main margin = { top: __axis_rotated ? getHorizontalAxisHeight('y2') : 0, right: getCurrentPaddingRight(), - bottom: getHorizontalAxisHeight(__axis_rotated ? 'y' : 'x') + (__axis_rotated ? 0 : __subchart_size_height) + (isLegendRight ? 0 : legendHeight), - left: (__axis_rotated ? __subchart_size_height + rotated_padding_right : 0) + getCurrentPaddingLeft() + bottom: getHorizontalAxisHeight(__axis_rotated ? 'y' : 'x') + (__axis_rotated ? 0 : subchartHeight) + (isLegendRight ? 0 : legendHeight), + left: (__axis_rotated ? subchartHeight + rotated_padding_right : 0) + getCurrentPaddingLeft() }; width = currentWidth - margin.left - margin.right; height = currentHeight - margin.top - margin.bottom; @@ -395,9 +399,9 @@ // for context margin2 = { - top: __axis_rotated ? margin.top : (currentHeight - __subchart_size_height - (isLegendRight ? 0 : legendHeight)), + top: __axis_rotated ? margin.top : (currentHeight - subchartHeight - (isLegendRight ? 0 : legendHeight)), right: NaN, - bottom: 20 + (isLegendRight ? 0 : legendHeight), + bottom: (__axis_rotated ? 20 : getHorizontalAxisHeight('x')) + (isLegendRight ? 0 : legendHeight), left: __axis_rotated ? rotated_padding_left : margin.left }; width2 = __axis_rotated ? margin.left - rotated_padding_left - rotated_padding_right : width; @@ -476,6 +480,7 @@ } function getHorizontalAxisHeight(axisId) { if (axisId === 'x' && !__axis_x_show) { return 0; } + if (axisId === 'x' && __axis_x_height) { return __axis_x_height; } if (axisId === 'y' && !__axis_y_show) { return __legend_show && !isLegendRight ? 10 : 1; } if (axisId === 'y2' && !__axis_y2_show) { return rotated_padding_top; } return (getAxisLabelPositionById(axisId).isInner ? 30 : 40) + (axisId === 'y2' ? -10 : 0); @@ -694,6 +699,19 @@ option.text = text; } } + function xForRotatedTickText(r) { + return 10 * Math.sin(Math.PI * (r / 180)); + } + function yForRotatedTickText(r) { + return 11.5 - 2.5 * (r / 15); + } + function rotateTickText(axis) { + axis.selectAll('.tick text') + .attr("y", yForRotatedTickText(__axis_x_tick_rotate)) + .attr("x", xForRotatedTickText(__axis_x_tick_rotate)) + .attr("transform", "rotate(" + __axis_x_tick_rotate + ")") + .style("text-anchor", "start"); + } function getAxisLabelPosition(axisId, defaultPosition) { var option = getAxisLabelOptionByAxisId(axisId), position = (option && typeof option === 'object' && option.position) ? option.position : defaultPosition; @@ -3011,7 +3029,7 @@ } function redraw(options) { - var xaxis, yaxis, xgrid, xgridData, xgridLines, xgridLine, ygrid, ygridLines, ygridLine; + var xaxis, subxaxis, yaxis, xgrid, xgridData, xgridLines, xgridLine, ygrid, ygridLines, ygridLine; var mainCircle, mainBar, mainRegion, mainText, contextBar, eventRect, eventRectUpdate; var barIndices = getBarIndices(), maxDataCountTarget; var rectX, rectW; @@ -3106,6 +3124,11 @@ } } + // rotate tick text if needed + if (!__axis_rotated && __axis_x_tick_rotate) { + rotateTickText(xaxis); + } + // setup drawer - MEMO: these must be called after axis updated drawBar = generateDrawBar(barIndices); xForText = generateXYForText(barIndices, true); @@ -3332,7 +3355,17 @@ // update subchart elements if needed if (withSubchart) { // axes - context.select('.' + CLASS.axisX).style("opacity", hideAxis ? 0 : 1).transition().duration(duration).call(subXAxis); + subxaxis = context.select('.' + CLASS.axisX).style("opacity", hideAxis ? 0 : 1); + if (__axis_rotated || withTransitionForHorizontalAxis) { + subxaxis = subxaxis.transition().duration(durationForAxis); + } + subxaxis.call(subXAxis); + + // rotate tick text if needed + if (!__axis_rotated && __axis_x_tick_rotate) { + rotateTickText(subxaxis); + } + // extent rect if (!brush.empty()) { brush.extent(x.orgDomain()).update(); diff --git a/c3.min.js b/c3.min.js index c442da0..32fd2a6 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.31"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cJf&&(Jf=0),0>Lf&&(Lf=0),Hf={top:Vg?Gf.top:Of-Ng-(Ii?0:a),right:0/0,bottom:20+(Ii?0:a),left:Vg?Ni:Gf.left},Kf=Vg?Gf.left-Ni-Oi:Jf,Mf=Vg?Lf:Of-Hf.top-Hf.bottom,0>Kf&&(Kf=0),0>Mf&&(Mf=0),If={top:Ii?0:Of-a,right:0/0,bottom:0,left:Ii?Nf-b:0},p(),Ii&&$d(rf.data.targets)&&(If.left=Jf/2+Qf)}function o(){Xi.select("line."+f.xgridFocus).attr("x1",Vg?0:-10).attr("x2",Vg?Jf:-10).attr("y1",Vg?-10:Gf.top).attr("y2",Vg?-10:Lf)}function p(){Qf=Lf/2,Pf=.95*Qf,Rf=Zd(rf.data.targets)?.6*Pf:0}function q(){var a=Vg?f.axisX:f.axisY,b=qf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=qf.select(tf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return uf?uf:x()}function s(){var a=vf?vf:y();return a>0?a:320}function t(){return $d(rf.data.targets)?0:wf?wf:Vg||!kh||ph?1:v("y")}function u(){var a=1;return $d(rf.data.targets)?0:xf?xf:Ii?P()+(th&&!Vg?v("y2"):a):th?yh||Vg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"x"!==a||Wg?"y"!==a||kh?"y2"!==a||th?(gb(a).isInner?30:40)+("y2"===a?-10:0):Pi:Pg&&!Ii?10:1:0}function x(){return+qf.select(tf).style("width").replace("px","")}function y(){return+qf.select(tf).style("height").replace("px","")}function z(a){return a?-5:-(Gf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Vg)}function C(){return A(!Vg)}function D(){return z(Vg)}function E(){return A(Vg)}function F(a){return a?Jf+2+4:Gf.left+20}function G(a){return a?80:Lf+2}function H(){return F(!Vg)}function I(){return G(!Vg)}function J(){return F(Vg)}function K(){return G(Vg)}function L(){var a=Vg?Lf:Jf,b=xc(),c=Vb()*(Wd(rf.data.targets)?(b-(ri?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){Ji=a}function N(a){Ki=a}function O(a){Li=a}function P(){return Pg?Ii?Ki*(Ji+1):Nf:0}function Q(){return Pg?Ii?Of:Li*(Ji+1):0}function R(){var a,b=!cg;Wf=Vg?1:0,Xf=Vg?Lf:Jf,Yf=Vg?0:Lf,Zf=Vg?Jf:1,$f=Wf,_f=Xf,ag=Vg?0:Mf,bg=Vg?Kf:1,cg=T(Wf,Xf,b?void 0:cg.domain(),function(){return ig.tickOffset()}),dg=U(Yf,Zf),eg=U(Yf,Zf),fg=T(Wf,Xf,aj,function(a){return a%1?0:lg.tickOffset()}),gg=U(ag,bg),hg=U(ag,bg),a=$(),ig=X(cg,Di,a),lg=X(fg,Gi,a),jg=Y(dg,Ei,qh,sh),kg=Y(eg,Fi,zh,Bh),b||(Qi.scale(fg),yf&&Ui.scale(cg)),S()}function S(){Sf=Db(),Tf=Eb(),Uf=Eb(.98)}function T(a,b,e,f){var g=(qi?qf.time.scale():qf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),ri){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return qf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?eg:dg}function W(a){return"y2"===Z(a)?hg:gg}function X(a,b,c){var d=(ri?Bb():qf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),ri?(d.tickCentered($g),pe(ah)&&(ah=!1)):d.tickOffset=function(){var a=Vg?Lf:Jf;return a*Vb()/xc()/2},ri&&d.categories(Zg),d}function Y(a,b,c,d){return qf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in tg?tg[a]:"y"}function $(){var a=qi?Ai:ri?Qc:function(a){return 0>a?a.toFixed(0):a};return _g&&("function"==typeof _g?a=_g:qi&&(a=function(a){return a?zi(_g)(a):""})),a}function _(a){var b;return"y"===a?b=oh:"y2"===a?b=xh:"x"===a&&(b=jh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?oh=b:"y2"===a?xh=b:"x"===a&&(jh=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Vg?"inner-top":"inner-right")}function eb(){return cb("y",Vg?"inner-right":"inner-top")}function fb(){return cb("y2",Vg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?Jf/2:Jf:b.isBottom?-Lf:b.isMiddle?-Lf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Vg,db())}function ob(){return kb(Vg,eb())}function pb(){return kb(Vg,fb())}function qb(){return lb(!Vg,db())}function rb(){return lb(Vg,eb())}function sb(){return lb(Vg,fb())}function tb(){var a=db();return Vg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Vg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Vg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Vg,db())}function xb(){return mb(Vg,eb())}function yb(){return mb(Vg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return qf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Ab(){Xi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),Xi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),Xi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+o)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Oc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return qf.min(Object.keys(i).map(function(a){return qf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=zc(a),i=Mc(a);if(sg.length>0)for(g=Pc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return qf.max(Object.keys(i).map(function(a){return qf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?vh:mh,n="y2"===c?uh:lh,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?wh:nh,r=rd()&&Vg;return 0===l.length?"y2"===c?eg.domain():dg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=sd(o,p),j=$b(dg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&rh&&(f=b(rh.top)?rh.top:e,g=b(rh.bottom)?rh.bottom:e),"y2"===c&&Ah&&(f=b(Ah.top)?Ah.top:e,g=b(Ah.bottom)?Ah.bottom:e),Wd(l)&&!Oc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(aj),c=$b(cg.domain());return a||0===c?1:b/c}function Wb(a){return gh?gh:qf.min(a,function(a){return qf.min(a.values,function(a){return a.x})})}function Xb(a){return fh?fh:qf.max(a,function(a){return qf.max(a.values,function(a){return a.x})})}function Yb(a,c){var d,e,f,g,h=c[0],i=c[1],j=Math.abs(h-i);return ri?e=0:Wd(a)?(d=xc(),e=d>1?j/(d-1)/2:.5):e=.01*j,"object"==typeof hh&&qe(hh)?(f=b(hh.left)?hh.left:e,g=b(hh.right)?hh.right:e):f=g="number"==typeof hh?hh:e,{left:f,right:g}}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=0,g=0;return(c||0===c)&&(f=qi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=qi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bb?0:b-c}function fc(a){var b,c=dc(a),d="y"===a.axis?dg:eg;return b="y"===a.axis||"y2"===a.axis?Vg?Lf:"start"in a?d(a.start):Lf:Vg?"end"in a?cg(qi?le(a.end):a.end):Lf:Lf,c>b?0:b-c}function gc(a){return mg&&a===mg||qe(ng)&&re(ng,a)}function hc(a){return!gc(a)}function ic(a){return mg?mg:qe(ng)?ng[a]:null}function jc(a,b){var c,d=b&&qe(b)?zc(b):[];return d.forEach(function(b){ic(b)===a&&(c=rf.data.xs[b])}),c}function kc(a,b){return a in rf.data.xs&&rf.data.xs[a]&&rf.data.xs[a][b]?rf.data.xs[a][b]:b}function lc(a){Object.keys(a).forEach(function(b){ng[b]=a[b]})}function mc(a){return 1===qf.set(Object.keys(a).map(function(b){return a[b]})).size()}function nc(a){var b;return a&&(b=qg[a.id],a.name=b?b:a.id),a}function oc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=qc(b[d],a.id,d)}),rf.data.xs[a.id]=b})}function pc(a,b){a.forEach(function(a){b[a.id]&&oc([a],b[a.id])})}function qc(a,b,c){var d;return d=qi?a?a instanceof Date?a:le(a):le(kc(b,c)):si&&!ri?a?+a:kc(b,c):c}function rc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?rf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):mg?(d=Object.keys(rf.data.xs),rf.data.xs[c]=d.length>0?rf.data.xs[d[0]]:void 0):qe(ng)&&(rf.data.xs[c]=jc(f,rf.data.targets)):rf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!rf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=pg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=ic(b),g=a[f],h=qc(g,b,e);return si&&ri&&0===c&&g&&(0===e&&(Zg=[]),Zg.push(g)),("undefined"==typeof a[b]||rf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),ug&&Ud(zc(c).filter(function(a){return!(a in vg)}),ug),c.forEach(function(a){ac(a.id_org,a)}),c}function uc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function vc(a){return a>0&&rf.data.targets[0].values[a-1]?rf.data.targets[0].values[a-1].x:void 0}function wc(a){return a1?rf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?rf.data.targets[0]:null,a}function zc(a){return a.map(function(a){return a.id})}function Ac(a){return a?"string"==typeof a?[a]:a:zc(rf.data.targets)}function Bc(a,b){var c,d=zc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(qi?new Date(h):h);i.push(d)}return qi||(i=i.sort(function(a,b){return a-b})),i}function Ic(a){Bi=Bi.concat(a)}function Jc(a){Bi=Bi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){Ci=Ci.concat(a)}function Lc(a){Ci=Ci.filter(function(b){return a.indexOf(b)<0})}function Mc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Nc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Pc(a){return Nc(a,function(a){return a>0})}function Qc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],a[f].x&&(e=e.concat(Ad(a,f))),a[g].x&&(e=e.concat(Ad(a,g))),Dd(e,b)):Bd(a,b,f,g)}function Cd(a,b){var c;return c=a.map(function(a){return Bd(a.values,b)}),Dd(c,b)}function Dd(a,b){var c,d;return a.forEach(function(a){var e=se(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Ed(a,b){return qf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Fd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Gd(){return xg&&"desc"===xg.toLowerCase()}function Hd(){return xg&&"asc"===xg.toLowerCase()}function Id(a){var b=Hd(),c=Gd();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof xg&&a.sort(xg),a}function Jd(a,c){var d,e,f,g,h,i,j,k=$d(rf.data.targets),l=k?ud:td,m=a.filter(function(a){return a&&b(a.value)});di&&0!==m.length&&($i.html(gi(a,$(),l,yi)).style("display","block"),d=$i.property("offsetWidth"),e=$i.property("offsetHeight"),k?(g=Jf/2+c[0],i=Lf/2+c[1]+20):(Vg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=cg(m[0].x)+20):(f=q(),g=f+t()+cg(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),$i.style("top",i+"px").style("left",g+"px"))}function Kd(){$i.style("display","none")}function Ld(a){var c=a.filter(function(a){return a&&b(a.value)});di&&(Xd(rf.data.targets)||$d(rf.data.targets)||Xi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Vg?"y1":"x1",wd).attr(Vg?"y2":"x2",wd))}function Md(){Xi.select("line."+f.xgridFocus).style("visibility","hidden")}function Nd(a){return a.x||0===a.x?cg(a.x):null}function Od(a){return V(a.id)(a.value)}function Pd(){var a,b,d={},e=0;return Fc(Cc(be)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Td(a,b){return Ph?Ph:b?2*a.tickOffset()*Qh/b:0}function Ud(a,b){Ac(a).forEach(function(a){cj[a]=b===vg[a],vg[a]=b})}function Vd(a,b){var c=!1;return a.forEach(function(a){vg[a.id]===b&&(c=!0),a.id in vg||"line"!==b||(c=!0)}),c}function Wd(a){return Vd(a,"bar")}function Xd(a){return Vd(a,"scatter")}function Yd(a){return Vd(a,"pie")}function Zd(a){return Vd(a,"donut")}function $d(a){return Yd(a)||Zd(a)}function _d(a){var b="string"==typeof a?a:a.id;return!(b in vg)||"line"===vg[b]||"spline"===vg[b]||"area"===vg[b]||"area-spline"===vg[b]}function ae(a){var b="string"==typeof a?a:a.id;return"spline"===vg[b]||"area-spline"===vg[b]}function be(a){var b="string"==typeof a?a:a.id;return"bar"===vg[b]}function ce(a){var b="string"==typeof a?a:a.id;return"scatter"===vg[b]}function de(a){var b="string"==typeof a?a:a.id;return"pie"===vg[b]}function ee(a){var b="string"==typeof a?a:a.id;return"donut"===vg[b]}function fe(a){return de(a)||ee(a)}function ge(a){return be(a)?a.values:[]}function he(a){return _d(a)||ce(a)?a.values:[]}function ie(a){return be(a)||_d(a)?a.values:[]}function je(a){return ee(a)&&Zh||de(a)&&Th}function ke(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function le(b){var c;try{c=og?qf.time.format(og).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+og)}return c}function me(a,b){var c=qf.mouse(a),d=qf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function re(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function se(a,b){var c="y"===Z(a.id)?dg:eg,d=Vg?1:0,e=Vg?0:1;return Math.pow(cg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function te(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function ue(a,b,c){Ig(b,a.node()),Xi.select("."+f.selectedCircles+id(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Rc(f.selectedCircle,c)}).attr("cx",Vg?Od:Nd).attr("cy",Vg?Nd:Od).attr("stroke",function(){return yi(b)}).attr("r",1.4*Nh).transition().duration(100).attr("r",Nh)}function ve(a,b,c){Jg(b,a.node()),Xi.select("."+f.selectedCircles+id(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function we(a,b,c,d){a?ue(b,c,d):ve(b,c,d)}function xe(a,b){Ig(b,a.node()),a.transition().duration(100).style("fill",function(){return qf.rgb(yi(b)).darker(1)})}function ye(a,b){Jg(b,a.node()),a.transition().duration(100).style("fill",function(){return yi(b)})}function ze(a,b,c,d){a?xe(b,c,d):ye(b,c,d)}function Ae(a){return a.filter(function(a){return b(a.value)})}function Be(a,c){return(c?Xi.selectAll("."+f.circles+id(c)):Xi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ce(a,b){Be(a,b).classed(f.EXPANDED,!0).attr("r",Mh)}function De(a){Be(a).filter(function(){return qf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Jh)}function Ee(a){return Xi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Fe(a){Ee(a).classed(f.EXPANDED,!0)}function Ge(a){Ee(a).classed(f.EXPANDED,!1)}function He(a,b){var c=Le(a,b);return function(a,b){var d=c(a,b),e=Vg?1:0,f=Vg?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function Ie(a,b){var c=Le(a,!1),d=b?Je:Ke;return function(a,b){return d(c(a,b),a,this)}}function Je(a,b){var c;return Vg?(c=be(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ke(a,b,c){var d=c.getBoundingClientRect();return Vg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:be(b)?-3:-6)}function Le(a,b){var c=a.__max__+1,d=Td(ig,c),e=Qd(d,c,a,!!b),f=Rd(!!b),g=Sd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Vg&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Me(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function Ne(b){var c,d,e;if(_i=qf.select(tf),_i.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(_i.html(""),_i.classed("c3",!0),rf.data.xs={},rf.data.targets=tc(b),n(),R(),cg.domain(qf.extent(Zb(rf.data.targets))),dg.domain(Ub(rf.data.targets,"y")),eg.domain(Ub(rf.data.targets,"y2")),fg.domain(cg.domain()),gg.domain(dg.domain()),hg.domain(eg.domain()),aj=cg.domain(),Qi.scale(fg),yf&&Ui.scale(cg),Vi=_i.append("svg").attr("width",Jf+Gf.left+Gf.right).attr("height",Lf+Gf.top+Gf.bottom).on("mouseenter",Bf).on("mouseleave",Cf),Wi=Vi.append("defs"),Wi.append("clipPath").attr("id",ki).append("rect").attr("width",Jf).attr("height",Lf),Wi.append("clipPath").attr("id",li).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Wi.append("clipPath").attr("id",mi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Xi=Vi.append("g").attr("transform",Hi.main),Yi=Mg?Vi.append("g").attr("transform",Hi.context):null,Zi=Vi.append("g").attr("transform",Hi.legend),Pg||(Zi.style("visibility","hidden"),Ci=zc(rf.data.targets)),$i=qf.select(tf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),lf(zc(rf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Wg&&Xi.append("g").attr("class",f.axisX).attr("clip-path",oi).attr("transform",Hi.x).append("text").attr("class",f.axisXLabel).attr("transform",Vg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),kh&&Xi.append("g").attr("class",f.axisY).attr("clip-path",pi).attr("transform",Hi.y).append("text").attr("class",f.axisYLabel).attr("transform",Vg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),th&&Xi.append("g").attr("class",f.axisY2).attr("transform",Hi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Vg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=Xi.append("g").attr("clip-path",ni).attr("class",f.grid),Ch&&d.append("g").attr("class",f.xgrids),qe(Eh)&&d.append("g").attr("class",f.xgridLines),Kh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Fh&&d.append("g").attr("class",f.ygrids),qe(Gh)&&d.append("g").attr("class",f.ygridLines),Xi.append("g").attr("clip-path",ni).attr("class",f.regions),Xi.append("g").attr("clip-path",ni).attr("class",f.chart),c=Xi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",yf?Vg?"ns-resize":"ew-resize":null),Xi.select("."+f.chart).append("g").attr("class",f.chartBars),Xi.select("."+f.chart).append("g").attr("class",f.chartLines),Xi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Hi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),Xi.select("."+f.chart).append("g").attr("class",f.chartTexts),yf&&Xi.insert("rect",Af?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Jf).attr("height",Lf).style("opacity",0).style("cursor",Vg?"ns-resize":"ew-resize").call(Ui).on("dblclick.zoom",null),ih&&Qi.extent("function"!=typeof ih?ih:ih(Zb())),Mg&&(Yi.append("g").attr("clip-path",ni).attr("class",f.chart),Yi.select("."+f.chart).append("g").attr("class",f.chartBars),Yi.select("."+f.chart).append("g").attr("class",f.chartLines),Yi.append("g").attr("clip-path",ni).attr("class",f.brush).call(Qi).selectAll("rect").attr(Vg?"width":"height",Vg?Kf:Mf),Yi.append("g").attr("class",f.axisX).attr("transform",Hi.subx).attr("clip-path",Vg?"":oi)),$e(rf.data.targets),Vg?Xi.select("."+f.axisX).style("opacity",0).call(ig):(Xi.select("."+f.axisY).style("opacity",0).call(jg),Xi.select("."+f.axisY2).style("opacity",0).call(kg)),Ue({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),hi){if(qi&&"string"==typeof ii){for(ii=le(ii),e=0;e0){d=[];for(var g in qg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Fd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=ze,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function Se(a){$d(rf.data.targets)||Bg&&(ti=a,Xi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),ui=!0,Kg())}function Te(){$d(rf.data.targets)||Bg&&(Xi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),Xi.selectAll("."+f.shape).classed(f.INCLUDED,!1),ui=!1,Lg())}function Ue(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Pd(),U=$d(rf.data.targets),V=Fc(rf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?Ff:0,O=B?N:0,P=C?N:0,H&&Pg&&lf(zc(rf.data.targets),a),G&&(cg.domain(qf.extent(Zb(V))),aj=cg.domain(),yf&&Ui.scale(cg).updateScaleExtent(),fg.domain(cg.domain()),Qi.scale(fg)),F&&(cg.domain(Qi.empty()?aj:Qi.extent()),yf&&Ui.scale(cg).updateScaleExtent()),dg.domain(Ub(V,"y")),eg.domain(Ub(V,"y2")),(dh||ch)&&(Q=eh?eh:Hc(Gc(V)),ig.tickValues(Q),lg.tickValues(Q)),c=Xi.select("."+f.axisX).style("opacity",U?0:1),(Vg||D)&&(c=c.transition().duration(P)),c.call(ig),e=Xi.select("."+f.axisY).style("opacity",U?0:1),(!Vg||D)&&(e=e.transition().duration(P)),e.call(jg),Xi.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call(kg),F)if(ah&&Q){for(R=1;R=0&&qf.select(this).style("display",b%S?"none":"block")})}else qf.selectAll("."+f.axisX+" .tick text").style("display","block");if(I=He(T),K=Ie(T,!0),M=Ie(T,!1),Ab(),gg.domain(dg.domain()),hg.domain(eg.domain()),$i.style("display","none"),o(),Xi.select("line."+f.xgridFocus).style("visibility","hidden"),Ch){if("year"===Dh){h=[];for(var W=Zb(),X=W[0].getFullYear(),Y=W[1].getFullYear(),Z=X;Y>=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=cg.ticks(10);g=Xi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Vg?0:function(a){return cg(a)-ig.tickOffset()}).attr("x2",Vg?Jf:function(a){return cg(a)-ig.tickOffset()}).attr("y1",Vg?function(a){return cg(a)-ig.tickOffset()}:Gf.top).attr("y2",Vg?function(a){return cg(a)-ig.tickOffset()}:Lf).style("opacity",function(){return+qf.select(this).attr(Vg?"y1":"x1")===(Vg?Lf:0)?0:1}),g.exit().remove()}qe(Eh)&&(i=Xi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Eh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Vg?"":"rotate(-90)").attr("dx",Vg?0:-Gf.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Vg?0:xd).attr("x2",Vg?Jf:xd).attr("y1",Vg?xd:Gf.top).attr("y2",Vg?xd:Lf).style("opacity",1),i.select("text").transition().duration(N).attr("x",Vg?Jf:0).attr("y",xd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&Fh&&(k=Xi.select("."+f.ygrids).selectAll("."+f.ygrid).data(dg.ticks(Hh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Vg?dg:0).attr("x2",Vg?dg:Jf).attr("y1",Vg?0:dg).attr("y2",Vg?Lf:dg),k.exit().remove()),y&&qe(Gh)&&(l=Xi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Gh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Vg?"rotate(-90)":"").attr("dx",Vg?0:-Gf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Vg?yd:0).attr("x2",Vg?yd:Jf).attr("y1",Vg?0:yd).attr("y2",Vg?Lf:yd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Vg?0:Jf).attr("y",yd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=Xi.selectAll("."+f.bars).selectAll("."+f.bar).data(ge),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return yi(a)}).attr("class",Zc),p.style("opacity",nd).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=Xi.selectAll("."+f.texts).selectAll("."+f.text).data(ie),r.enter().append("text").attr("class",Sc).attr("text-anchor",function(a){return Vg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return vd(a.id)(a.value)}).style("fill-opacity",od).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",qd),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Xi.selectAll("."+f.line).style("opacity",nd).transition().duration(N).attr("d",Ri).style("opacity",1),Xi.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",Si).style("opacity",bj),n=Xi.selectAll("."+f.circles).selectAll("."+f.circle).data(he),n.enter().append("circle").attr("class",Xc).style("opacity",0).attr("r",Jh),n.style("opacity",nd).transition().duration(N).style("opacity",pd).attr("cx",Vg?Od:Nd).attr("cy",Vg?Nd:Od),n.exit().remove(),Xi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=qf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),Xi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Dc(a.data.id)&&fe(a.data)?1:0}),Xi.select("."+f.chartArcsTitle).style("opacity",Zd(rf.data.targets)?1:0),Mg&&(null!==qf.event&&"zoom"===qf.event.type&&Qi.extent(cg.orgDomain()).update(),z&&(Yi.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(lg),Qi.empty()||Qi.extent(cg.orgDomain()).update(),J=He(T,!0),s=Yi.selectAll("."+f.bars).selectAll("."+f.bar).data(ge),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return yi(a)}).attr("class",Zc),s.style("opacity",nd).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Yi.selectAll("."+f.line).style("opacity",nd).transition().duration(N).attr("d",Ti).style("opacity",1))),Xi.selectAll("."+f.selectedCircles).filter(function(a){return be(a)}).selectAll("circle").remove(),Xi.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Vg?Od:Nd).attr("cy",Vg?Nd:Od),t=Xi.select("."+f.eventRects),qe(ng)&&!mc(ng)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=Xi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Pe(u.enter()),u.attr("x",0).attr("y",0).attr("width",Jf).attr("height",Lf)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),si&&!ri?(x=function(a,b){var c=vc(b),d=wc(b),e=rf.data.xs[a.id][b];return(cg(d?d:e+50)-cg(c?c:e-50))/2},w=function(a,b){var c=vc(b),d=rf.data.xs[a.id][b];return(cg(d)+cg(c?c:d-50))/2}):(x=L(),w=function(a){return cg(a.x)-x/2}),v=yc(),Xi.select("."+f.eventRects).datum(v?v.values:[]),u=Xi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Oe(u.enter()),u.attr("class",cd).attr("x",Vg?0:w).attr("y",Vg?w:0).attr("width",Vg?Jf:x).attr("height",Vg?x:Lf),u.exit().remove()),q=Xi.select("."+f.regions).selectAll("rect."+f.region).data(ci),q.enter().append("rect").style("fill-opacity",0),q.attr("class",bd).attr("x",cc).attr("y",dc).attr("width",ec).attr("height",fc).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),zc(rf.data.targets).forEach(function(a){cj[a]=!0})}}function Ve(){Ue({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function We(){return"mousemove"===qf.event.sourceEvent.type&&Ui.altDomain?(cg.domain(Ui.altDomain),void Ui.scale(cg).updateScaleExtent()):(ri&&cg.orgDomain()[0]===aj[0]&&cg.domain([aj[0]-1e-10,cg.orgDomain()[1]]),Ue({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===qf.event.sourceEvent.type&&(vi=!0)))}function Xe(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ye(){Vi.attr("width",Nf).attr("height",Of),Vi.select("#"+ki).select("rect").attr("width",Jf).attr("height",Lf),Vi.select("#"+li).select("rect").attr("width",H),Vi.select("#"+mi).select("rect").attr("width",J),Vi.select("."+f.zoomRect).attr("width",Jf).attr("height",Lf)}function Ze(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Ye(),m(a.withTransition),Ue(a)}function $e(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=Xi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",ed),j=i.enter().append("g").attr("class",ed).style("pointer-events","none"),j.append("g").attr("class",Tc).style("fill",function(a){return yi(a)}),e=Xi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",gd),d=e.enter().append("g").attr("class",gd).style("pointer-events","none"),d.append("g").attr("class",$c).style("fill",function(a){return yi(a)}).style("stroke","none").style("cursor",function(a){return Dg(a)?"pointer":null}),c=Xi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",fd),b=c.enter().append("g").attr("class",fd).style("pointer-events","none"),b.append("path").attr("class",Wc).style("opacity",0).style("stroke",function(a){return yi(a)}),b.append("path").attr("class",ad).style("opacity",function(){return bj=+qf.select(this).style("opacity"),0}).style("fill",function(a){return yi(a)}),b.append("g").attr("class",function(a){return Rc(f.selectedCircles,a.id)}),b.append("g").attr("class",Yc).style("fill",function(a){return yi(a)}).style("cursor",function(a){return Dg(a)?"pointer":null}),a.forEach(function(a){Xi.selectAll("."+f.selectedCircles+id(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Xi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Vf(a)).attr("class",hd),g=h.enter().append("g").attr("class",hd),g.append("path").attr("class",_c).style("opacity",0).style("fill",function(a){return yi(a.data)}).style("cursor",function(a){return Dg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),ff(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Jd(c,qf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),hf(),Kd(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Mg&&(n=Yi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",gd),m=n.enter().append("g").attr("class",gd),m.append("g").attr("class",$c).style("fill",function(a){return yi(a)}),l=Yi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",fd),k=l.enter().append("g").attr("class",fd),k.append("path").attr("class",Wc).style("opacity",0).style("stroke",function(a){return yi(a)})),Vi.selectAll("."+f.target).filter(function(a){return Dc(a.id)}).transition().style("opacity",1)}function _e(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Ud(a.id,b.types[a.id]):Ud(a.id,b.type)}),rf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Ii?j:i,l=Ii?Q():P();return d&&(w=0,C=0,t=0,u=0),Pg&&!Ec(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Ii?u:t,void(Ug?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,Ii?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Zi.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Rc(f.legendItem,a)}).style("visibility",function(a){return Ec(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Rg?Rg(a):rf.toggle(a)}).on("mouseover",function(a){rf.focus(a),"function"==typeof Sg&&Sg(a)}).on("mouseout",function(a){rf.revert(),"function"==typeof Tg&&Tg(a)}),l.append("text").text(function(a){return d(qg[a])?qg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",Ii?g:-200).attr("y",Ii?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ii?h:-200).attr("y",Ii?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return yi(a)}).attr("x",Ii?g:-200).attr("y",Ii?-200:i).attr("width",10).attr("height",10),Zi.selectAll("text").data(a).text(function(a){return d(qg[a])?qg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Zi.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Zi.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Ye(),q&&m(p)}function mf(a){return Bc(rf.data.targets,a.id)}function nf(a){return"data"in a&&Bc(rf.data.targets,a.data.id)}function of(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 pf(a,b,c){var d=!$d(rf.data.targets);Ud(a,b),Ze(c?c:{withTransitionForAxis:d})}var qf=a.d3?a.d3:a.require?a.require("d3"):void 0,rf={data:{},axis:{},legend:{}},sf={},tf=h(["bindto"],"#chart"),uf=h(["size","width"]),vf=h(["size","height"]),wf=h(["padding","left"]),xf=h(["padding","right"]),yf=h(["zoom","enabled"],!1),zf=h(["zoom","extent"]),Af=h(["zoom","privileged"],!1),Bf=h(["onenter"],function(){}),Cf=h(["onleave"],function(){}),Df=h(["onresize"],function(){}),Ef=h(["onresized"],function(){}),Ff=h(["transition","duration"],350);g("data","data is required in config");var Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg=h(["data","x"]),ng=h(["data","xs"],{}),og=h(["data","x_format"]),pg=h(["data","id_converter"],function(a){return a}),qg=h(["data","names"],{}),rg=h(["data","classes"],{}),sg=h(["data","groups"],[]),tg=h(["data","axes"],{}),ug=h(["data","type"]),vg=h(["data","types"],{}),wg=h(["data","labels"],{}),xg=h(["data","order"]),yg=h(["data","regions"],{}),zg=h(["data","color"]),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","item","onmouseover"]),Tg=h(["legend","item","onmouseout"]),Ug=h(["legend","equally"],!1),Vg=h(["axis","rotated"],!1),Wg=h(["axis","x","show"],!0),Xg=h(["axis","x","type"],"indexed"),Yg=h(["axis","x","localtime"],!0),Zg=h(["axis","x","categories"],[]),$g=h(["axis","x","tick","centered"],!1),_g=h(["axis","x","tick","format"]),ah=h(["axis","x","tick","culling"],{}),bh=h(["axis","x","tick","culling","max"],10),ch=h(["axis","x","tick","count"]),dh=h(["axis","x","tick","fit"],!0),eh=h(["axis","x","tick","values"],null),fh=h(["axis","x","max"]),gh=h(["axis","x","min"]),hh=h(["axis","x","padding"],{}),ih=h(["axis","x","default"]),jh=h(["axis","x","label"],{}),kh=h(["axis","y","show"],!0),lh=h(["axis","y","max"]),mh=h(["axis","y","min"]),nh=h(["axis","y","center"]),oh=h(["axis","y","label"],{}),ph=h(["axis","y","inner"],!1),qh=h(["axis","y","tick","format"]),rh=h(["axis","y","padding"],{}),sh=h(["axis","y","ticks"],10),th=h(["axis","y2","show"],!1),uh=h(["axis","y2","max"]),vh=h(["axis","y2","min"]),wh=h(["axis","y2","center"]),xh=h(["axis","y2","label"],{}),yh=h(["axis","y2","inner"],!1),zh=h(["axis","y2","tick","format"]),Ah=h(["axis","y2","padding"],{}),Bh=h(["axis","y2","ticks"],10),Ch=h(["grid","x","show"],!1),Dh=h(["grid","x","type"],"tick"),Eh=h(["grid","x","lines"],[]),Fh=h(["grid","y","show"],!1),Gh=h(["grid","y","lines"],[]),Hh=h(["grid","y","ticks"],10),Ih=h(["point","show"],!0),Jh=Ih?h(["point","r"],2.5):0,Kh=h(["point","focus","line","enabled"],!0),Lh=h(["point","focus","expand","enabled"],!0),Mh=h(["point","focus","expand","r"],Lh?4:Jh),Nh=h(["point","focus","select","r"],8),Oh=h(["line","connect_null"],!1),Ph=h(["bar","width"]),Qh=h(["bar","width","ratio"],.6),Rh=h(["pie","label","show"],!0),Sh=h(["pie","label","format"]),Th=h(["pie","expand"],!0),Uh=h(["pie","onclick"],function(){}),Vh=h(["pie","onmouseover"],function(){}),Wh=h(["pie","onmouseout"],function(){}),Xh=h(["donut","label","show"],!0),Yh=h(["donut","label","format"]),Zh=h(["donut","expand"],!0),$h=h(["donut","title"],""),_h=h(["donut","onclick"],function(){}),ai=h(["donut","onmouseover"],function(){}),bi=h(["donut","onmouseout"],function(){}),ci=h(["regions"],[]),di=h(["tooltip","show"],!0),ei=h(["tooltip","format","title"]),fi=h(["tooltip","format","value"]),gi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ei?ei:b,l=fi?fi: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+""}),hi=h(["tooltip","init","show"],!1),ii=h(["tooltip","init","x"],0),ji=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ki=("string"==typeof tf?tf.replace("#",""):tf.id)+"-clip",li=ki+"-xaxis",mi=ki+"-yaxis",ni=i(ki),oi=i(li),pi=i(mi),qi="timeseries"===Xg,ri="categorized"===Xg,si=!qi&&(mg||qe(ng)),ti=null,ui=!1,vi=!1,wi=!1,xi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],yi=ke(Ag,qe(Og)?Og:xi,zg),zi=Yg?qf.time.format:qf.time.format.utc,Ai=function(){var a=[[zi("%Y/%-m/%-d"),function(){return!0}],[zi("%-m/%-d"),function(a){return a.getMonth()}],[zi("%-m/%-d"),function(a){return 1!==a.getDate()}],[zi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[zi("%I %p"),function(a){return a.getHours()}],[zi("%I:%M"),function(a){return a.getMinutes()}],[zi(":%S"),function(a){return a.getSeconds()}],[zi(".%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)}}(),Bi=[],Ci=[],Di=Vg?"left":"bottom",Ei=Vg?ph?"top":"bottom":ph?"right":"left",Fi=Vg?yh?"bottom":"top":yh?"left":"right",Gi=Vg?"left":"bottom",Hi={main:function(){return"translate("+Gf.left+","+Gf.top+")"},context:function(){return"translate("+Hf.left+","+Hf.top+")"},legend:function(){return"translate("+If.left+","+If.top+")"},x:function(){return"translate(0,"+(Vg?0:Lf)+")"},y:function(){return"translate(0,"+(Vg?Lf:0)+")"},y2:function(){return"translate("+(Vg?0:Jf)+","+(Vg?1:0)+")"},subx:function(){return"translate(0,"+(Vg?0:Mf)+")"},arc:function(){return"translate("+Jf/2+","+Lf/2+")"}},Ii="right"===Qg,Ji=0,Ki=0,Li=0,Mi=.15,Ni=30,Oi=Vg&&!Wg?0:30,Pi=5;Vf=qf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Qi,Ri=function(){var a=qf.svg.line().x(Vg?function(a){return V(a.id)(a.value)}:wd).y(Vg?wd:function(a){return V(a.id)(a.value)});return Oh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Oh?Ae(b.values):b.values;return _d(b)?(a.interpolate(ae(b)?"cardinal":"linear"),yg[b.id]?Me(e,cg,V(b.id),yg[b.id]):a(e)):(c=e[0]?cg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Vg?"M "+d+" "+c:"M "+c+" "+d)}}(),Si=function(){var a;return a=Vg?qf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(wd):qf.svg.area().x(wd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ae(b.values);return Vd([b],"area")||Vd([b],"area-spline")?(a.interpolate(ae(b)?"cardinal":"linear"),a(e)):(c=e[0]?cg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Vg?"M "+d+" "+c:"M "+c+" "+d)}}(),Ti=function(){var a=qf.svg.line().x(Vg?function(a){return W(a.id)(a.value)}:zd).y(Vg?zd:function(a){return W(a.id)(a.value)});return function(b){var c=Ae(b.values);return _d(b)?a(c):"M "+fg(c[0].x)+" "+W(b.id)(c[0].value)}}(),Ui=function(){};Qi=qf.svg.brush().on("brush",Ve),Qi.update=function(){return Yi&&Yi.select("."+f.brush).call(this),this},Qi.scale=function(a){return Vg?this.y(a):this.x(a)},yf&&(Ui=qf.behavior.zoom().on("zoomstart",function(){Ui.altDomain=qf.event.sourceEvent.altKey?cg.orgDomain():null}).on("zoom",yf?We:null),Ui.scale=function(a){return Vg?this.y(a):this.x(a)},Ui.orgScaleExtent=function(){var a=zf?zf:[1,10];return[a[0],Math.max(xc()/a[1],a[1])]},Ui.updateScaleExtent=function(){var a=$b(cg.orgDomain())/$b(aj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Vi,Wi,Xi,Yi,Zi,$i,_i,aj,bj,cj={};if(rf.focus=function(a){function b(a){Fc(a).transition().duration(100).style("opacity",1)}var c=Vi.selectAll(jd(a)),d=c.filter(mf),e=c.filter(nf);rf.revert(),rf.defocus(),b(d.classed(f.focused,!0)),b(e),$d(rf.data.targets)&&Kb(a,!0),ff(a)},rf.defocus=function(a){function b(a){Fc(a).transition().duration(100).style("opacity",.3)}var c=Vi.selectAll(jd(a)),d=c.filter(mf),e=c.filter(nf);rf.revert(),b(d.classed(f.focused,!1)),b(e),$d(rf.data.targets)&&Lb(a),gf(a)},rf.revert=function(a){function b(a){Fc(a).transition().duration(100).style("opacity",1)}var c=Vi.selectAll(jd(a)),d=c.filter(mf),e=c.filter(nf);b(d.classed(f.focused,!1)),b(e),$d(rf.data.targets)&&Lb(a),hf()},rf.show=function(a,b){a=Ac(a),b=b||{},Jc(a),Vi.selectAll(kd(a)).transition().style("opacity",1),b.withLegend?jf(a):Zi.selectAll(md(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},rf.hide=function(a,b){a=Ac(a),b=b||{},Ic(a),Vi.selectAll(kd(a)).transition().style("opacity",0),b.withLegend?kf(a):Zi.selectAll(md(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Mi),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},rf.toggle=function(a){Dc(a)?rf.hide(a):rf.show(a)},rf.unzoom=function(){Qi.clear().update(),Ue({withUpdateXDomain:!0})},rf.load=function(a){return a.xs&&lc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){rg[b]=a.classes[b]}),"categories"in a&&ri&&(Zg=a.categories,ig.categories(Zg)),"cacheIds"in a&&_b(a.cacheIds)?void _e(bc(a.cacheIds),a.done):void("unload"in a?bf(Ac("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){af(a)}):af(a))},rf.unload=function(a){bf(Ac(a),function(){Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},rf.selected=function(a){return qf.merge(Xi.selectAll("."+f.shapes+id(a)).selectAll("."+f.shape).filter(function(){return qf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},rf.select=function(a,b,c){Bg&&Xi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=qf.select(this),i="circle"===this.nodeName?ue:xe,j="circle"===this.nodeName?ve:ye,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)})},rf.unselect=function(a,b){Bg&&Xi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=qf.select(this),g="circle"===this.nodeName?ve:ye,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)})},rf.toLine=function(a){pf(a,"line")},rf.toSpline=function(a){pf(a,"spline")},rf.toBar=function(a){pf(a,"bar")},rf.toScatter=function(a){pf(a,"scatter")},rf.toArea=function(a){pf(a,"area")},rf.toAreaSpline=function(a){pf(a,"area-spline")},rf.toPie=function(a){pf(a,"pie",{withTransform:!0})},rf.toDonut=function(a){pf(a,"donut",{withTransform:!0})},rf.groups=function(a){return c(a)?sg:(sg=a,Ue(),sg)},rf.xgrids=function(a){return a?(Eh=a,Ue(),Eh):Eh},rf.xgrids.add=function(a){return a?rf.xgrids(Eh.concat(a)):void 0},rf.xgrids.remove=function(a){var b=of(a);return rf.xgrids(Eh.filter(b))},rf.ygrids=function(a){return a?(Gh=a,Ue(),Gh):Gh},rf.ygrids.add=function(a){return a?rf.ygrids(Gh.concat(a)):void 0},rf.ygrids.remove=function(a){var b=of(a);return rf.ygrids(Gh.filter(b))},rf.regions=function(a){return c(a)?ci:(ci=a,Ue(),ci)},rf.regions.add=function(a){return c(a)?ci:(ci=ci.concat(a),Ue(),ci) -},rf.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;Vi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ci=ci.filter(function(b){return b.classes.indexOf(a)<0})}),ci},rf.data.get=function(a){var b=rf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},rf.data.getAsTarget=function(a){var b=Cc(function(b){return b.id===a});return b.length>0?b[0]:void 0},rf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){qg[b]=a[b]}),lf(zc(rf.data.targets),{withTransition:!0}),qg):qg},rf.x=function(a){return arguments.length&&(oc(rf.data.targets,a),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),rf.data.xs},rf.xs=function(a){return arguments.length&&(pc(rf.data.targets,a),Ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),rf.data.xs},rf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},rf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(lh=+a.y),b(a.y2)&&(uh=+a.y2)):lh=uh=+a,Ue())},rf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(mh=+a.y),b(a.y2)&&(vh=+a.y2)):mh=vh=+a,Ue())},rf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&rf.axis.max(a.max),"undefined"!=typeof a.min&&rf.axis.min(a.min))},rf.legend.show=function(a){Pg||(Pg=!0,Zi.style("visibility","visible")),jf(Ac(a)),Ue({withTransitionForHorizontalAxis:!1})},rf.legend.hide=function(a){Pg&&pe(a)&&(Pg=!1,Zi.style("visibility","hidden")),kf(Ac(a)),Ue({withTransitionForHorizontalAxis:!1})},rf.resize=function(a){uf=a?a.width:null,vf=a?a.height:null,Ze({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},rf.destroy=function(){rf.data.targets=void 0,rf.data.xs={},_i.html(""),a.onresize=null},"url"in e.data)qf.xhr(e.data.url,function(a,b){var c,d=qf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=qf.csv.parse(b.response),Ne(c)});else if("rows"in e.data)Ne(rc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ne(sc(e.data.columns))}return rf},"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.31"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cMf&&(Mf=0),0>Of&&(Of=0),Kf={top:Yg?Jf.top:Rf-c-(Ni?0:a),right:0/0,bottom:(Yg?20:w("x"))+(Ni?0:a),left:Yg?Si:Jf.left},Nf=Yg?Jf.left-Si-Ti:Mf,Pf=Yg?Of:Rf-Kf.top-Kf.bottom,0>Nf&&(Nf=0),0>Pf&&(Pf=0),Lf={top:Ni?0:Rf-a,right:0/0,bottom:0,left:Ni?Qf-b:0},p(),Ni&&be(uf.data.targets)&&(Lf.left=Mf/2+Tf)}function o(){aj.select("line."+f.xgridFocus).attr("x1",Yg?0:-10).attr("x2",Yg?Mf:-10).attr("y1",Yg?-10:Jf.top).attr("y2",Yg?-10:Of)}function p(){Tf=Of/2,Sf=.95*Tf,Uf=ae(uf.data.targets)?.6*Sf:0}function q(){var a=Yg?f.axisX:f.axisY,b=tf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=tf.select(wf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return xf?xf:x()}function s(){var a=yf?yf:y();return a>0?a:320}function t(){return be(uf.data.targets)?0:zf?zf:Yg||!ph||uh?1:v("y")}function u(){var a=1;return be(uf.data.targets)?0:Af?Af:Ni?P()+(yh&&!Yg?v("y2"):a):yh?Dh||Yg?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||Zg?"x"===a&&mh?mh:"y"!==a||ph?"y2"!==a||yh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Ui:Sg&&!Ni?10:1:0}function x(){return+tf.select(wf).style("width").replace("px","")}function y(){return+tf.select(wf).style("height").replace("px","")}function z(a){return a?-5:-(Jf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Yg)}function C(){return A(!Yg)}function D(){return z(Yg)}function E(){return A(Yg)}function F(a){return a?Mf+2+4:Jf.left+20}function G(a){return a?80:Of+2}function H(){return F(!Yg)}function I(){return G(!Yg)}function J(){return F(Yg)}function K(){return G(Yg)}function L(){var a=Yg?Of:Mf,b=Ac(),c=Yb()*(Zd(uf.data.targets)?(b-(wi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){Oi=a}function N(a){Pi=a}function O(a){Qi=a}function P(){return Sg?Ni?Pi*(Oi+1):Qf:0}function Q(){return Sg?Ni?Rf:Qi*(Oi+1):0}function R(){var a,b=!fg;Zf=Yg?1:0,$f=Yg?Of:Mf,_f=Yg?0:Of,ag=Yg?Mf:1,bg=Zf,cg=$f,dg=Yg?0:Pf,eg=Yg?Nf:1,fg=T(Zf,$f,b?void 0:fg.domain(),function(){return lg.tickOffset()}),gg=U(_f,ag),hg=U(_f,ag),ig=T(Zf,$f,fj,function(a){return a%1?0:og.tickOffset()}),jg=U(dg,eg),kg=U(dg,eg),a=$(),lg=X(fg,Ii,a),og=X(ig,Li,a),mg=Y(gg,Ji,vh,xh),ng=Y(hg,Ki,Eh,Gh),b||(Vi.scale(ig),Bf&&Zi.scale(fg)),S()}function S(){Vf=Gb(),Wf=Hb(),Xf=Hb(.98)}function T(a,b,e,f){var g=(vi?tf.time.scale():tf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),wi){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return tf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?hg:gg}function W(a){return"y2"===Z(a)?kg:jg}function X(a,b,c){var d=(wi?Eb():tf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),wi?(d.tickCentered(bh),se(dh)&&(dh=!1)):d.tickOffset=function(){var a=Yg?Of:Mf;return a*Yb()/Ac()/2},wi&&d.categories(ah),d}function Y(a,b,c,d){return tf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in wg?wg[a]:"y"}function $(){var a=vi?Fi:wi?Tc:function(a){return 0>a?a.toFixed(0):a};return ch&&("function"==typeof ch?a=ch:vi&&(a=function(a){return a?Ei(ch)(a):""})),a}function _(a){var b;return"y"===a?b=th:"y2"===a?b=Ch:"x"===a&&(b=oh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?th=b:"y2"===a?Ch=b:"x"===a&&(oh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a){a.selectAll(".tick text").attr("y",db(ih)).attr("x",cb(ih)).attr("transform","rotate("+ih+")").style("text-anchor","start")}function fb(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 gb(){return fb("x",Yg?"inner-top":"inner-right")}function hb(){return fb("y",Yg?"inner-right":"inner-top")}function ib(){return fb("y2",Yg?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Mf/2:Mf:b.isBottom?-Of:b.isMiddle?-Of/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!Yg,gb())}function rb(){return nb(Yg,hb())}function sb(){return nb(Yg,ib())}function tb(){return ob(!Yg,gb())}function ub(){return ob(Yg,hb())}function vb(){return ob(Yg,ib())}function wb(){var a=gb();return Yg?a.isInner?"1.2em":-30-Cb("x"):a.isInner?"-0.5em":"3em"}function xb(){var a=hb();return Yg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return Yg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!Yg,gb())}function Ab(){return pb(Yg,hb())}function Bb(){return pb(Yg,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return tf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Db(){aj.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).text(kb),aj.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dy",xb).text(lb),aj.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dy",yb).text(mb)}function Eb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+o)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Rc(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 tf.min(Object.keys(i).map(function(a){return tf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(vg.length>0)for(g=Sc(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 tf.max(Object.keys(i).map(function(a){return tf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Ah:rh,n="y2"===c?zh:qh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Bh:sh,r=ud()&&Yg;return 0===l.length?"y2"===c?hg.domain():gg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=bc(gg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&wh&&(f=b(wh.top)?wh.top:e,g=b(wh.bottom)?wh.bottom:e),"y2"===c&&Fh&&(f=b(Fh.top)?Fh.top:e,g=b(Fh.bottom)?Fh.bottom:e),Zd(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){var b=bc(fj),c=bc(fg.domain());return a||0===c?1:b/c}function Zb(a){return kh?kh:tf.min(a,function(a){return tf.min(a.values,function(a){return a.x})})}function $b(a){return jh?jh:tf.max(a,function(a){return tf.max(a.values,function(a){return a.x})})}function _b(a,c){var d,e,f,g,h=c[0],i=c[1],j=Math.abs(h-i);return wi?e=0:Zd(a)?(d=Ac(),e=d>1?j/(d-1)/2:.5):e=.01*j,"object"==typeof lh&&te(lh)?(f=b(lh.left)?lh.left:e,g=b(lh.right)?lh.right:e):f=g="number"==typeof lh?lh:e,{left:f,right:g}}function ac(a){var b=[Zb(a),$b(a)],c=b[0],d=b[1],e=_b(a,b),f=0,g=0;return(c||0===c)&&(f=vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function bc(a){return a[1]-a[0]}function cc(a){for(var b=0;bb?0:b-c}function ic(a){var b,c=gc(a),d="y"===a.axis?gg:hg;return b="y"===a.axis||"y2"===a.axis?Yg?Of:"start"in a?d(a.start):Of:Yg?"end"in a?fg(vi?oe(a.end):a.end):Of:Of,c>b?0:b-c}function jc(a){return pg&&a===pg||te(qg)&&ue(qg,a)}function kc(a){return!jc(a)}function lc(a){return pg?pg:te(qg)?qg[a]:null}function mc(a,b){var c,d=b&&te(b)?Cc(b):[];return d.forEach(function(b){lc(b)===a&&(c=uf.data.xs[b])}),c}function nc(a,b){return a in uf.data.xs&&uf.data.xs[a]&&uf.data.xs[a][b]?uf.data.xs[a][b]:b}function oc(a){Object.keys(a).forEach(function(b){qg[b]=a[b]})}function pc(a){return 1===tf.set(Object.keys(a).map(function(b){return a[b]})).size()}function qc(a){var b;return a&&(b=tg[a.id],a.name=b?b:a.id),a}function rc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=tc(b[d],a.id,d)}),uf.data.xs[a.id]=b})}function sc(a,b){a.forEach(function(a){b[a.id]&&rc([a],b[a.id])})}function tc(a,b,c){var d;return d=vi?a?a instanceof Date?a:oe(a):oe(nc(b,c)):xi&&!wi?a?+a:nc(b,c):c}function uc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?uf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):pg?(d=Object.keys(uf.data.xs),uf.data.xs[c]=d.length>0?uf.data.xs[d[0]]:void 0):te(qg)&&(uf.data.xs[c]=mc(f,uf.data.targets)):uf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!uf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=sg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=lc(b),g=a[f],h=tc(g,b,e);return xi&&wi&&0===c&&g&&(0===e&&(ah=[]),ah.push(g)),("undefined"==typeof a[b]||uf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),xg&&Xd(Cc(c).filter(function(a){return!(a in yg)}),xg),c.forEach(function(a){dc(a.id_org,a)}),c}function xc(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 yc(a){return a>0&&uf.data.targets[0].values[a-1]?uf.data.targets[0].values[a-1].x:void 0}function zc(a){return a1?uf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?uf.data.targets[0]:null,a}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(uf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(vi?new Date(h):h);i.push(d)}return vi||(i=i.sort(function(a,b){return a-b})),i}function Lc(a){Gi=Gi.concat(a)}function Mc(a){Gi=Gi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Hi=Hi.concat(a)}function Oc(a){Hi=Hi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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(Dd(a,f))),a[g].x&&(e=e.concat(Dd(a,g))),Gd(e,b)):Ed(a,b,f,g)}function Fd(a,b){var c;return c=a.map(function(a){return Ed(a.values,b)}),Gd(c,b)}function Gd(a,b){var c,d;return a.forEach(function(a){var e=ve(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Hd(a,b){return tf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Id(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 Jd(){return Ag&&"desc"===Ag.toLowerCase()}function Kd(){return Ag&&"asc"===Ag.toLowerCase()}function Ld(a){var b=Kd(),c=Jd();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 Ag&&a.sort(Ag),a}function Md(a,c){var d,e,f,g,h,i,j,k=be(uf.data.targets),l=k?xd:wd,m=a.filter(function(a){return a&&b(a.value)});ii&&0!==m.length&&(dj.html(li(a,$(),l,Di)).style("display","block"),d=dj.property("offsetWidth"),e=dj.property("offsetHeight"),k?(g=Mf/2+c[0],i=Of/2+c[1]+20):(Yg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=fg(m[0].x)+20):(f=q(),g=f+t()+fg(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),dj.style("top",i+"px").style("left",g+"px"))}function Nd(){dj.style("display","none")}function Od(a){var c=a.filter(function(a){return a&&b(a.value)});ii&&($d(uf.data.targets)||be(uf.data.targets)||aj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Yg?"y1":"x1",zd).attr(Yg?"y2":"x2",zd))}function Pd(){aj.select("line."+f.xgridFocus).style("visibility","hidden")}function Qd(a){return a.x||0===a.x?fg(a.x):null}function Rd(a){return V(a.id)(a.value)}function Sd(){var a,b,d={},e=0;return Ic(Fc(ee)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Wd(a,b){return Uh?Uh:b?2*a.tickOffset()*Vh/b:0}function Xd(a,b){Dc(a).forEach(function(a){hj[a]=b===yg[a],yg[a]=b})}function Yd(a,b){var c=!1;return a.forEach(function(a){yg[a.id]===b&&(c=!0),a.id in yg||"line"!==b||(c=!0)}),c}function Zd(a){return Yd(a,"bar")}function $d(a){return Yd(a,"scatter")}function _d(a){return Yd(a,"pie")}function ae(a){return Yd(a,"donut")}function be(a){return _d(a)||ae(a)}function ce(a){var b="string"==typeof a?a:a.id;return!(b in yg)||"line"===yg[b]||"spline"===yg[b]||"area"===yg[b]||"area-spline"===yg[b]}function de(a){var b="string"==typeof a?a:a.id;return"spline"===yg[b]||"area-spline"===yg[b]}function ee(a){var b="string"==typeof a?a:a.id;return"bar"===yg[b]}function fe(a){var b="string"==typeof a?a:a.id;return"scatter"===yg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"pie"===yg[b]}function he(a){var b="string"==typeof a?a:a.id;return"donut"===yg[b]}function ie(a){return ge(a)||he(a)}function je(a){return ee(a)?a.values:[]}function ke(a){return ce(a)||fe(a)?a.values:[]}function le(a){return ee(a)||ce(a)?a.values:[]}function me(a){return he(a)&&ci||ge(a)&&Yh}function ne(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function oe(b){var c;try{c=rg?tf.time.format(rg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+rg)}return c}function pe(a,b){var c=tf.mouse(a),d=tf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function ue(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ve(a,b){var c="y"===Z(a.id)?gg:hg,d=Yg?1:0,e=Yg?0:1;return Math.pow(fg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function we(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function xe(a,b,c){Lg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd).attr("stroke",function(){return Di(b)}).attr("r",1.4*Sh).transition().duration(100).attr("r",Sh)}function ye(a,b,c){Mg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ze(a,b,c,d){a?xe(b,c,d):ye(b,c,d)}function Ae(a,b){Lg(b,a.node()),a.transition().duration(100).style("fill",function(){return tf.rgb(Di(b)).darker(1)})}function Be(a,b){Mg(b,a.node()),a.transition().duration(100).style("fill",function(){return Di(b)})}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a){return a.filter(function(a){return b(a.value)})}function Ee(a,c){return(c?aj.selectAll("."+f.circles+ld(c)):aj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Fe(a,b){Ee(a,b).classed(f.EXPANDED,!0).attr("r",Rh)}function Ge(a){Ee(a).filter(function(){return tf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oh)}function He(a){return aj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ie(a){He(a).classed(f.EXPANDED,!0)}function Je(a){He(a).classed(f.EXPANDED,!1)}function Ke(a,b){var c=Oe(a,b);return function(a,b){var d=c(a,b),e=Yg?1:0,f=Yg?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 Le(a,b){var c=Oe(a,!1),d=b?Me:Ne;return function(a,b){return d(c(a,b),a,this)}}function Me(a,b){var c;return Yg?(c=ee(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ne(a,b,c){var d=c.getBoundingClientRect();return Yg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ee(b)?-3:-6)}function Oe(a,b){var c=a.__max__+1,d=Wd(lg,c),e=Td(d,c,a,!!b),f=Ud(!!b),g=Vd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Yg&&(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 Pe(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 Qe(b){var c,d,e;if(ej=tf.select(wf),ej.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ej.html(""),ej.classed("c3",!0),uf.data.xs={},uf.data.targets=wc(b),n(),R(),fg.domain(tf.extent(ac(uf.data.targets))),gg.domain(Xb(uf.data.targets,"y")),hg.domain(Xb(uf.data.targets,"y2")),ig.domain(fg.domain()),jg.domain(gg.domain()),kg.domain(hg.domain()),fj=fg.domain(),Vi.scale(ig),Bf&&Zi.scale(fg),$i=ej.append("svg").attr("width",Mf+Jf.left+Jf.right).attr("height",Of+Jf.top+Jf.bottom).on("mouseenter",Ef).on("mouseleave",Ff),_i=$i.append("defs"),_i.append("clipPath").attr("id",pi).append("rect").attr("width",Mf).attr("height",Of),_i.append("clipPath").attr("id",qi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),_i.append("clipPath").attr("id",ri).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),aj=$i.append("g").attr("transform",Mi.main),bj=Pg?$i.append("g").attr("transform",Mi.context):null,cj=$i.append("g").attr("transform",Mi.legend),Sg||(cj.style("visibility","hidden"),Hi=Cc(uf.data.targets)),dj=tf.select(wf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),of(Cc(uf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Zg&&aj.append("g").attr("class",f.axisX).attr("clip-path",ti).attr("transform",Mi.x).append("text").attr("class",f.axisXLabel).attr("transform",Yg?"rotate(-90)":"").attr("dx",tb).attr("dy",wb).style("text-anchor",zb),ph&&aj.append("g").attr("class",f.axisY).attr("clip-path",ui).attr("transform",Mi.y).append("text").attr("class",f.axisYLabel).attr("transform",Yg?"":"rotate(-90)").attr("dx",ub).attr("dy",xb).style("text-anchor",Ab),yh&&aj.append("g").attr("class",f.axisY2).attr("transform",Mi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Yg?"":"rotate(-90)").attr("dx",vb).style("text-anchor",Bb),d=aj.append("g").attr("clip-path",si).attr("class",f.grid),Hh&&d.append("g").attr("class",f.xgrids),te(Jh)&&d.append("g").attr("class",f.xgridLines),Ph&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Kh&&d.append("g").attr("class",f.ygrids),te(Lh)&&d.append("g").attr("class",f.ygridLines),aj.append("g").attr("clip-path",si).attr("class",f.regions),aj.append("g").attr("clip-path",si).attr("class",f.chart),c=aj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Bf?Yg?"ns-resize":"ew-resize":null),aj.select("."+f.chart).append("g").attr("class",f.chartBars),aj.select("."+f.chart).append("g").attr("class",f.chartLines),aj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Mi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),aj.select("."+f.chart).append("g").attr("class",f.chartTexts),Bf&&aj.insert("rect",Df?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Mf).attr("height",Of).style("opacity",0).style("cursor",Yg?"ns-resize":"ew-resize").call(Zi).on("dblclick.zoom",null),nh&&Vi.extent("function"!=typeof nh?nh:nh(ac())),Pg&&(bj.append("g").attr("clip-path",si).attr("class",f.chart),bj.select("."+f.chart).append("g").attr("class",f.chartBars),bj.select("."+f.chart).append("g").attr("class",f.chartLines),bj.append("g").attr("clip-path",si).attr("class",f.brush).call(Vi).selectAll("rect").attr(Yg?"width":"height",Yg?Nf:Pf),bj.append("g").attr("class",f.axisX).attr("transform",Mi.subx).attr("clip-path",Yg?"":ti)),bf(uf.data.targets),Yg?aj.select("."+f.axisX).style("opacity",0).call(lg):(aj.select("."+f.axisY).style("opacity",0).call(mg),aj.select("."+f.axisY2).style("opacity",0).call(ng)),Xe({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),mi){if(vi&&"string"==typeof ni){for(ni=oe(ni),e=0;e0){d=[];for(var g in tg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Id(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ce,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 Ve(a){be(uf.data.targets)||Eg&&(yi=a,aj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),zi=!0,Ng())}function We(){be(uf.data.targets)||Eg&&(aj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),aj.selectAll("."+f.shape).classed(f.INCLUDED,!1),zi=!1,Og())}function Xe(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U=Sd(),V=be(uf.data.targets),W=Ic(uf.data.targets);if(0!==W.length){if(a=d(a)?a:{},z=d(a.withY)?a.withY:!0,A=d(a.withSubchart)?a.withSubchart:!0,B=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,C=d(a.withTransitionForExit)?a.withTransitionForExit:B,D=d(a.withTransitionForAxis)?a.withTransitionForAxis:B,E=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:B,O=B?If:0,P=C?O:0,Q=D?O:0,I&&Sg&&of(Cc(uf.data.targets),a),H&&(fg.domain(tf.extent(ac(W))),fj=fg.domain(),Bf&&Zi.scale(fg).updateScaleExtent(),ig.domain(fg.domain()),Vi.scale(ig)),G&&(fg.domain(Vi.empty()?fj:Vi.extent()),Bf&&Zi.scale(fg).updateScaleExtent()),gg.domain(Xb(W,"y")),hg.domain(Xb(W,"y2")),(gh||fh)&&(R=hh?hh:Kc(Jc(W)),lg.tickValues(R),og.tickValues(R)),c=aj.select("."+f.axisX).style("opacity",V?0:1),(Yg||E)&&(c=c.transition().duration(Q)),c.call(lg),g=aj.select("."+f.axisY).style("opacity",V?0:1),(!Yg||E)&&(g=g.transition().duration(Q)),g.call(mg),aj.select("."+f.axisY2).style("opacity",V?0:1).transition().duration(Q).call(ng),G)if(dh&&R){for(S=1;S=0&&tf.select(this).style("display",b%T?"none":"block")})}else tf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!Yg&&ih&&eb(c),J=Ke(U),M=Le(U,!0),N=Le(U,!1),Db(),jg.domain(gg.domain()),kg.domain(hg.domain()),dj.style("display","none"),o(),aj.select("line."+f.xgridFocus).style("visibility","hidden"),Hh){if("year"===Ih){i=[];for(var X=ac(),Y=X[0].getFullYear(),Z=X[1].getFullYear(),$=Y;Z>=$;$++)i.push(new Date($+"-01-01 00:00:00"))}else i=fg.ticks(10);h=aj.select("."+f.xgrids).selectAll("."+f.xgrid).data(i),h.enter().append("line").attr("class",f.xgrid),h.attr("x1",Yg?0:function(a){return fg(a)-lg.tickOffset()}).attr("x2",Yg?Mf:function(a){return fg(a)-lg.tickOffset()}).attr("y1",Yg?function(a){return fg(a)-lg.tickOffset()}:Jf.top).attr("y2",Yg?function(a){return fg(a)-lg.tickOffset()}:Of).style("opacity",function(){return+tf.select(this).attr(Yg?"y1":"x1")===(Yg?Of:0)?0:1}),h.exit().remove()}te(Jh)&&(j=aj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Jh),k=j.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),k.append("line").style("opacity",0),k.append("text").attr("text-anchor","end").attr("transform",Yg?"":"rotate(-90)").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),j.select("line").transition().duration(O).attr("x1",Yg?0:Ad).attr("x2",Yg?Mf:Ad).attr("y1",Yg?Ad:Jf.top).attr("y2",Yg?Ad:Of).style("opacity",1),j.select("text").transition().duration(O).attr("x",Yg?Mf:0).attr("y",Ad).text(function(a){return a.text}).style("opacity",1),j.exit().transition().duration(O).style("opacity",0).remove()),z&&Kh&&(l=aj.select("."+f.ygrids).selectAll("."+f.ygrid).data(gg.ticks(Mh)),l.enter().append("line").attr("class",f.ygrid),l.attr("x1",Yg?gg:0).attr("x2",Yg?gg:Mf).attr("y1",Yg?0:gg).attr("y2",Yg?Of:gg),l.exit().remove()),z&&te(Lh)&&(m=aj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Lh),n=m.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),n.append("line").style("opacity",0),n.append("text").attr("text-anchor","end").attr("transform",Yg?"rotate(-90)":"").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),m.select("line").transition().duration(O).attr("x1",Yg?Bd:0).attr("x2",Yg?Bd:Mf).attr("y1",Yg?0:Bd).attr("y2",Yg?Of:Bd).style("opacity",1),m.select("text").transition().duration(O).attr("x",Yg?0:Mf).attr("y",Bd).text(function(a){return a.text}).style("opacity",1),m.exit().transition().duration(O).style("opacity",0).remove()),q=aj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),q.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Di(a)}).attr("class",ad),q.style("opacity",qd).transition().duration(O).attr("d",J).style("opacity",1),q.exit().transition().duration(P).style("opacity",0).remove(),s=aj.selectAll("."+f.texts).selectAll("."+f.text).data(le),s.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return Yg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),s.text(function(a){return yd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(O).attr("x",M).attr("y",N).style("fill-opacity",td),s.exit().transition().duration(P).style("fill-opacity",0).remove(),aj.selectAll("."+f.line).style("opacity",qd).transition().duration(O).attr("d",Wi).style("opacity",1),aj.selectAll("."+f.area).style("opacity",0).transition().duration(O).attr("d",Xi).style("opacity",gj),p=aj.selectAll("."+f.circles).selectAll("."+f.circle).data(ke),p.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Oh),p.style("opacity",qd).transition().duration(O).style("opacity",sd).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),p.exit().remove(),aj.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(O).attrTween("d",function(a){var b,c=Fb(a);return c?(b=tf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1),aj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(O).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&ie(a.data)?1:0}),aj.select("."+f.chartArcsTitle).style("opacity",ae(uf.data.targets)?1:0),Pg&&(null!==tf.event&&"zoom"===tf.event.type&&Vi.extent(fg.orgDomain()).update(),A&&(e=bj.select("."+f.axisX).style("opacity",V?0:1),(Yg||E)&&(e=e.transition().duration(Q)),e.call(og),!Yg&&ih&&eb(e),Vi.empty()||Vi.extent(fg.orgDomain()).update(),K=Ke(U,!0),t=bj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),t.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Di(a)}).attr("class",ad),t.style("opacity",qd).transition().duration(O).attr("d",K).style("opacity",1),t.exit().transition().duration(O).style("opacity",0).remove(),bj.selectAll("."+f.line).style("opacity",qd).transition().duration(O).attr("d",Yi).style("opacity",1))),aj.selectAll("."+f.selectedCircles).filter(function(a){return ee(a)}).selectAll("circle").remove(),aj.selectAll("."+f.selectedCircle).transition().duration(O).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),u=aj.select("."+f.eventRects),te(qg)&&!pc(qg)?(u.classed(f.eventRectsMultiple)||u.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),v=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Se(v.enter()),v.attr("x",0).attr("y",0).attr("width",Mf).attr("height",Of)):(u.classed(f.eventRectsSingle)||u.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),xi&&!wi?(y=function(a,b){var c=yc(b),d=zc(b),e=uf.data.xs[a.id][b];return(fg(d?d:e+50)-fg(c?c:e-50))/2},x=function(a,b){var c=yc(b),d=uf.data.xs[a.id][b];return(fg(d)+fg(c?c:d-50))/2}):(y=L(),x=function(a){return fg(a.x)-y/2}),w=Bc(),aj.select("."+f.eventRects).datum(w?w.values:[]),v=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Re(v.enter()),v.attr("class",fd).attr("x",Yg?0:x).attr("y",Yg?x:0).attr("width",Yg?Mf:y).attr("height",Yg?y:Of),v.exit().remove()),r=aj.select("."+f.regions).selectAll("rect."+f.region).data(hi),r.enter().append("rect").style("fill-opacity",0),r.attr("class",ed).attr("x",fc).attr("y",gc).attr("width",hc).attr("height",ic).transition().duration(O).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Cc(uf.data.targets).forEach(function(a){hj[a]=!0})}}function Ye(){Xe({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ze(){return"mousemove"===tf.event.sourceEvent.type&&Zi.altDomain?(fg.domain(Zi.altDomain),void Zi.scale(fg).updateScaleExtent()):(wi&&fg.orgDomain()[0]===fj[0]&&fg.domain([fj[0]-1e-10,fg.orgDomain()[1]]),Xe({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===tf.event.sourceEvent.type&&(Ai=!0)))}function $e(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function _e(){$i.attr("width",Qf).attr("height",Rf),$i.select("#"+pi).select("rect").attr("width",Mf).attr("height",Of),$i.select("#"+qi).select("rect").attr("width",H),$i.select("#"+ri).select("rect").attr("width",J),$i.select("."+f.zoomRect).attr("width",Mf).attr("height",Of)}function af(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),_e(),m(a.withTransition),Xe(a)}function bf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=aj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Di(a)}),e=aj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("fill",function(a){return Di(a)}).style("stroke","none").style("cursor",function(a){return Gg(a)?"pointer":null}),c=aj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)}),b.append("path").attr("class",dd).style("opacity",function(){return gj=+tf.select(this).style("opacity"),0}).style("fill",function(a){return Di(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Di(a)}).style("cursor",function(a){return Gg(a)?"pointer":null}),a.forEach(function(a){aj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=aj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Yf(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Di(a.data)}).style("cursor",function(a){return Gg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Fb(a),d=Lb(c),e=Tb();Nb(c.data.id),jf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Fb(a),c=[Lb(b)];Md(c,tf.mouse(this))}).on("mouseout",function(a,b){var c=Fb(a),d=Lb(c),e=Ub();Ob(c.data.id),lf(),Nd(),e(d,b)}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Pg&&(n=bj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Di(a)}),l=bj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)})),$i.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function cf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Xd(a.id,b.types[a.id]):Xd(a.id,b.type)}),uf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Ni?j:i,l=Ni?Q():P();return d&&(w=0,C=0,t=0,u=0),Sg&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Ni?u:t,void(Xg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,Ni?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=cj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Ug?Ug(a):uf.toggle(a)}).on("mouseover",function(a){uf.focus(a),"function"==typeof Vg&&Vg(a)}).on("mouseout",function(a){uf.revert(),"function"==typeof Wg&&Wg(a)}),l.append("text").text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",Ni?g:-200).attr("y",Ni?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ni?h:-200).attr("y",Ni?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Di(a)}).attr("x",Ni?g:-200).attr("y",Ni?-200:i).attr("width",10).attr("height",10),cj.selectAll("text").data(a).text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),cj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),cj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),_e(),q&&m(p)}function pf(a){return Ec(uf.data.targets,a.id)}function qf(a){return"data"in a&&Ec(uf.data.targets,a.data.id)}function rf(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 sf(a,b,c){var d=!be(uf.data.targets);Xd(a,b),af(c?c:{withTransitionForAxis:d})}var tf=a.d3?a.d3:a.require?a.require("d3"):void 0,uf={data:{},axis:{},legend:{}},vf={},wf=h(["bindto"],"#chart"),xf=h(["size","width"]),yf=h(["size","height"]),zf=h(["padding","left"]),Af=h(["padding","right"]),Bf=h(["zoom","enabled"],!1),Cf=h(["zoom","extent"]),Df=h(["zoom","privileged"],!1),Ef=h(["onenter"],function(){}),Ff=h(["onleave"],function(){}),Gf=h(["onresize"],function(){}),Hf=h(["onresized"],function(){}),If=h(["transition","duration"],350);g("data","data is required in config");var Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg=h(["data","x"]),qg=h(["data","xs"],{}),rg=h(["data","x_format"]),sg=h(["data","id_converter"],function(a){return a}),tg=h(["data","names"],{}),ug=h(["data","classes"],{}),vg=h(["data","groups"],[]),wg=h(["data","axes"],{}),xg=h(["data","type"]),yg=h(["data","types"],{}),zg=h(["data","labels"],{}),Ag=h(["data","order"]),Bg=h(["data","regions"],{}),Cg=h(["data","color"]),Dg=h(["data","colors"],{}),Eg=h(["data","selection","enabled"],!1),Fg=h(["data","selection","grouped"],!1),Gg=h(["data","selection","isselectable"],function(){return!0}),Hg=h(["data","selection","multiple"],!0),Ig=h(["data","onclick"],function(){}),Jg=h(["data","onenter"],function(){}),Kg=h(["data","onleave"],function(){}),Lg=h(["data","onselected"],function(){}),Mg=h(["data","onunselected"],function(){}),Ng=h(["data","ondragstart"],function(){}),Og=h(["data","ondragend"],function(){}),Pg=h(["subchart","show"],!1),Qg=h(["subchart","size","height"],60),Rg=h(["color","pattern"],[]),Sg=h(["legend","show"],!0),Tg=h(["legend","position"],"bottom"),Ug=h(["legend","item","onclick"]),Vg=h(["legend","item","onmouseover"]),Wg=h(["legend","item","onmouseout"]),Xg=h(["legend","equally"],!1),Yg=h(["axis","rotated"],!1),Zg=h(["axis","x","show"],!0),$g=h(["axis","x","type"],"indexed"),_g=h(["axis","x","localtime"],!0),ah=h(["axis","x","categories"],[]),bh=h(["axis","x","tick","centered"],!1),ch=h(["axis","x","tick","format"]),dh=h(["axis","x","tick","culling"],{}),eh=h(["axis","x","tick","culling","max"],10),fh=h(["axis","x","tick","count"]),gh=h(["axis","x","tick","fit"],!0),hh=h(["axis","x","tick","values"],null),ih=h(["axis","x","tick","rotate"]),jh=h(["axis","x","max"]),kh=h(["axis","x","min"]),lh=h(["axis","x","padding"],{}),mh=h(["axis","x","height"]),nh=h(["axis","x","default"]),oh=h(["axis","x","label"],{}),ph=h(["axis","y","show"],!0),qh=h(["axis","y","max"]),rh=h(["axis","y","min"]),sh=h(["axis","y","center"]),th=h(["axis","y","label"],{}),uh=h(["axis","y","inner"],!1),vh=h(["axis","y","tick","format"]),wh=h(["axis","y","padding"],{}),xh=h(["axis","y","ticks"],10),yh=h(["axis","y2","show"],!1),zh=h(["axis","y2","max"]),Ah=h(["axis","y2","min"]),Bh=h(["axis","y2","center"]),Ch=h(["axis","y2","label"],{}),Dh=h(["axis","y2","inner"],!1),Eh=h(["axis","y2","tick","format"]),Fh=h(["axis","y2","padding"],{}),Gh=h(["axis","y2","ticks"],10),Hh=h(["grid","x","show"],!1),Ih=h(["grid","x","type"],"tick"),Jh=h(["grid","x","lines"],[]),Kh=h(["grid","y","show"],!1),Lh=h(["grid","y","lines"],[]),Mh=h(["grid","y","ticks"],10),Nh=h(["point","show"],!0),Oh=Nh?h(["point","r"],2.5):0,Ph=h(["point","focus","line","enabled"],!0),Qh=h(["point","focus","expand","enabled"],!0),Rh=h(["point","focus","expand","r"],Qh?4:Oh),Sh=h(["point","focus","select","r"],8),Th=h(["line","connect_null"],!1),Uh=h(["bar","width"]),Vh=h(["bar","width","ratio"],.6),Wh=h(["pie","label","show"],!0),Xh=h(["pie","label","format"]),Yh=h(["pie","expand"],!0),Zh=h(["pie","onclick"],function(){}),$h=h(["pie","onmouseover"],function(){}),_h=h(["pie","onmouseout"],function(){}),ai=h(["donut","label","show"],!0),bi=h(["donut","label","format"]),ci=h(["donut","expand"],!0),di=h(["donut","title"],""),ei=h(["donut","onclick"],function(){}),fi=h(["donut","onmouseover"],function(){}),gi=h(["donut","onmouseout"],function(){}),hi=h(["regions"],[]),ii=h(["tooltip","show"],!0),ji=h(["tooltip","format","title"]),ki=h(["tooltip","format","value"]),li=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ji?ji:b,l=ki?ki: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+""}),mi=h(["tooltip","init","show"],!1),ni=h(["tooltip","init","x"],0),oi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),pi=("string"==typeof wf?wf.replace("#",""):wf.id)+"-clip",qi=pi+"-xaxis",ri=pi+"-yaxis",si=i(pi),ti=i(qi),ui=i(ri),vi="timeseries"===$g,wi="categorized"===$g,xi=!vi&&(pg||te(qg)),yi=null,zi=!1,Ai=!1,Bi=!1,Ci=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Di=ne(Dg,te(Rg)?Rg:Ci,Cg),Ei=_g?tf.time.format:tf.time.format.utc,Fi=function(){var a=[[Ei("%Y/%-m/%-d"),function(){return!0}],[Ei("%-m/%-d"),function(a){return a.getMonth()}],[Ei("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ei("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ei("%I %p"),function(a){return a.getHours()}],[Ei("%I:%M"),function(a){return a.getMinutes()}],[Ei(":%S"),function(a){return a.getSeconds()}],[Ei(".%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)}}(),Gi=[],Hi=[],Ii=Yg?"left":"bottom",Ji=Yg?uh?"top":"bottom":uh?"right":"left",Ki=Yg?Dh?"bottom":"top":Dh?"left":"right",Li=Yg?"left":"bottom",Mi={main:function(){return"translate("+Jf.left+","+Jf.top+")"},context:function(){return"translate("+Kf.left+","+Kf.top+")"},legend:function(){return"translate("+Lf.left+","+Lf.top+")"},x:function(){return"translate(0,"+(Yg?0:Of)+")"},y:function(){return"translate(0,"+(Yg?Of:0)+")"},y2:function(){return"translate("+(Yg?0:Mf)+","+(Yg?1:0)+")"},subx:function(){return"translate(0,"+(Yg?0:Pf)+")"},arc:function(){return"translate("+Mf/2+","+Of/2+")"}},Ni="right"===Tg,Oi=0,Pi=0,Qi=0,Ri=.15,Si=30,Ti=Yg&&!Zg?0:30,Ui=5;Yf=tf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Vi,Wi=function(){var a=tf.svg.line().x(Yg?function(a){return V(a.id)(a.value)}:zd).y(Yg?zd:function(a){return V(a.id)(a.value)});return Th||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Th?De(b.values):b.values;return ce(b)?(a.interpolate(de(b)?"cardinal":"linear"),Bg[b.id]?Pe(e,fg,V(b.id),Bg[b.id]):a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Xi=function(){var a;return a=Yg?tf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(zd):tf.svg.area().x(zd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=De(b.values);return Yd([b],"area")||Yd([b],"area-spline")?(a.interpolate(de(b)?"cardinal":"linear"),a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Yi=function(){var a=tf.svg.line().x(Yg?function(a){return W(a.id)(a.value)}:Cd).y(Yg?Cd:function(a){return W(a.id)(a.value)});return function(b){var c=De(b.values);return ce(b)?a(c):"M "+ig(c[0].x)+" "+W(b.id)(c[0].value)}}(),Zi=function(){};Vi=tf.svg.brush().on("brush",Ye),Vi.update=function(){return bj&&bj.select("."+f.brush).call(this),this},Vi.scale=function(a){return Yg?this.y(a):this.x(a)},Bf&&(Zi=tf.behavior.zoom().on("zoomstart",function(){Zi.altDomain=tf.event.sourceEvent.altKey?fg.orgDomain():null}).on("zoom",Bf?Ze:null),Zi.scale=function(a){return Yg?this.y(a):this.x(a)},Zi.orgScaleExtent=function(){var a=Cf?Cf:[1,10];return[a[0],Math.max(Ac()/a[1],a[1])]},Zi.updateScaleExtent=function(){var a=bc(fg.orgDomain())/bc(fj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var $i,_i,aj,bj,cj,dj,ej,fj,gj,hj={};if(uf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),uf.defocus(),b(d.classed(f.focused,!0)),b(e),be(uf.data.targets)&&Nb(a,!0),jf(a)},uf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),kf(a)},uf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),lf()},uf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),$i.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?mf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},uf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),$i.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?nf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Ri),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},uf.toggle=function(a){Gc(a)?uf.hide(a):uf.show(a)},uf.unzoom=function(){Vi.clear().update(),Xe({withUpdateXDomain:!0})},uf.load=function(a){return a.xs&&oc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){ug[b]=a.classes[b]}),"categories"in a&&wi&&(ah=a.categories,lg.categories(ah)),"cacheIds"in a&&cc(a.cacheIds)?void cf(ec(a.cacheIds),a.done):void("unload"in a?ef(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){df(a)}):df(a))},uf.unload=function(a){ef(Dc(a),function(){Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},uf.selected=function(a){return tf.merge(aj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return tf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},uf.select=function(a,b,c){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=tf.select(this),i="circle"===this.nodeName?xe:Ae,j="circle"===this.nodeName?ye:Be,k=Fg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Gg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},uf.unselect=function(a,b){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=tf.select(this),g="circle"===this.nodeName?ye:Be,h=Fg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Gg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},uf.toLine=function(a){sf(a,"line")},uf.toSpline=function(a){sf(a,"spline")},uf.toBar=function(a){sf(a,"bar")},uf.toScatter=function(a){sf(a,"scatter")},uf.toArea=function(a){sf(a,"area")},uf.toAreaSpline=function(a){sf(a,"area-spline")},uf.toPie=function(a){sf(a,"pie",{withTransform:!0})},uf.toDonut=function(a){sf(a,"donut",{withTransform:!0})},uf.groups=function(a){return c(a)?vg:(vg=a,Xe(),vg)},uf.xgrids=function(a){return a?(Jh=a,Xe(),Jh):Jh},uf.xgrids.add=function(a){return a?uf.xgrids(Jh.concat(a)):void 0},uf.xgrids.remove=function(a){var b=rf(a);return uf.xgrids(Jh.filter(b))},uf.ygrids=function(a){return a?(Lh=a,Xe(),Lh):Lh},uf.ygrids.add=function(a){return a?uf.ygrids(Lh.concat(a)):void 0},uf.ygrids.remove=function(a){var b=rf(a); +return uf.ygrids(Lh.filter(b))},uf.regions=function(a){return c(a)?hi:(hi=a,Xe(),hi)},uf.regions.add=function(a){return c(a)?hi:(hi=hi.concat(a),Xe(),hi)},uf.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;$i.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),hi=hi.filter(function(b){return b.classes.indexOf(a)<0})}),hi},uf.data.get=function(a){var b=uf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},uf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},uf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){tg[b]=a[b]}),of(Cc(uf.data.targets),{withTransition:!0}),tg):tg},uf.x=function(a){return arguments.length&&(rc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.xs=function(a){return arguments.length&&(sc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},uf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(qh=+a.y),b(a.y2)&&(zh=+a.y2)):qh=zh=+a,Xe())},uf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(rh=+a.y),b(a.y2)&&(Ah=+a.y2)):rh=Ah=+a,Xe())},uf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&uf.axis.max(a.max),"undefined"!=typeof a.min&&uf.axis.min(a.min))},uf.legend.show=function(a){Sg||(Sg=!0,cj.style("visibility","visible")),mf(Dc(a)),Xe({withTransitionForHorizontalAxis:!1})},uf.legend.hide=function(a){Sg&&se(a)&&(Sg=!1,cj.style("visibility","hidden")),nf(Dc(a)),Xe({withTransitionForHorizontalAxis:!1})},uf.resize=function(a){xf=a?a.width:null,yf=a?a.height:null,af({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},uf.destroy=function(){uf.data.targets=void 0,uf.data.xs={},ej.html(""),a.onresize=null},"url"in e.data)tf.xhr(e.data.url,function(a,b){var c,d=tf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=tf.csv.parse(b.response),Qe(c)});else if("rows"in e.data)Qe(uc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Qe(vc(e.data.columns))}return uf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 0a9ed2d5c891442d2864d7c6dc104362aa7ec1e2 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 23 Apr 2014 16:28:27 +0900 Subject: [PATCH 057/178] Refactor margins --- c3.js | 63 ++++++++++++++++++++++++++++++++++--------------------- c3.min.js | 2 +- 2 files changed, 40 insertions(+), 25 deletions(-) diff --git a/c3.js b/c3.js index 656bde0..fa24e71 100644 --- a/c3.js +++ b/c3.js @@ -378,45 +378,60 @@ var rotated_padding_left = 30, rotated_padding_right = __axis_rotated && !__axis_x_show ? 0 : 30, rotated_padding_top = 5; function updateSizes() { - var legendHeight = getLegendHeight(), legendWidth = getLegendWidth(), subchartHeight = __subchart_show ? (__subchart_size_height + getHorizontalAxisHeight('x')) : 0; + var legendHeight = getLegendHeight(), legendWidth = getLegendWidth(), + legendHeightForBottom = isLegendRight ? 0 : legendHeight, + xAxisHeight = __axis_rotated ? 0 : getHorizontalAxisHeight('x'), + subchartHeight = __subchart_show ? (__subchart_size_height + xAxisHeight) : 0; currentWidth = getCurrentWidth(); currentHeight = getCurrentHeight(); - // TODO: refactor.. - - // for main - margin = { - top: __axis_rotated ? getHorizontalAxisHeight('y2') : 0, - right: getCurrentPaddingRight(), - bottom: getHorizontalAxisHeight(__axis_rotated ? 'y' : 'x') + (__axis_rotated ? 0 : subchartHeight) + (isLegendRight ? 0 : legendHeight), - left: (__axis_rotated ? subchartHeight + rotated_padding_right : 0) + getCurrentPaddingLeft() + // for main, context + if (__axis_rotated) { + margin = { + top: getHorizontalAxisHeight('y2'), + right: getCurrentPaddingRight(), + bottom: getHorizontalAxisHeight('y') + legendHeightForBottom, + left: subchartHeight + rotated_padding_right + getCurrentPaddingLeft() + }; + margin2 = { + top: margin.top, + right: NaN, + bottom: 20 + legendHeightForBottom, + left: rotated_padding_left + }; + } else { + margin = { + top: 0, + right: getCurrentPaddingRight(), + bottom: xAxisHeight + subchartHeight + legendHeightForBottom, + left: getCurrentPaddingLeft() + }; + margin2 = { + top: currentHeight - subchartHeight - legendHeightForBottom, + right: NaN, + bottom: xAxisHeight + legendHeightForBottom, + left: margin.left + }; + } + // for legend + margin3 = { + top: isLegendRight ? 0 : currentHeight - legendHeight, + right: NaN, + bottom: 0, + left: isLegendRight ? currentWidth - legendWidth : 0 }; + width = currentWidth - margin.left - margin.right; height = currentHeight - margin.top - margin.bottom; if (width < 0) { width = 0; } if (height < 0) { height = 0; } - // for context - margin2 = { - top: __axis_rotated ? margin.top : (currentHeight - subchartHeight - (isLegendRight ? 0 : legendHeight)), - right: NaN, - bottom: (__axis_rotated ? 20 : getHorizontalAxisHeight('x')) + (isLegendRight ? 0 : legendHeight), - left: __axis_rotated ? rotated_padding_left : margin.left - }; width2 = __axis_rotated ? margin.left - rotated_padding_left - rotated_padding_right : width; height2 = __axis_rotated ? height : currentHeight - margin2.top - margin2.bottom; if (width2 < 0) { width2 = 0; } if (height2 < 0) { height2 = 0; } - // for legend - margin3 = { - top: isLegendRight ? 0 : currentHeight - legendHeight, - right: NaN, - bottom: 0, - left: isLegendRight ? currentWidth - legendWidth : 0 - }; - // for arc updateRadius(); diff --git a/c3.min.js b/c3.min.js index 32fd2a6..35ce508 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.31"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cMf&&(Mf=0),0>Of&&(Of=0),Kf={top:Yg?Jf.top:Rf-c-(Ni?0:a),right:0/0,bottom:(Yg?20:w("x"))+(Ni?0:a),left:Yg?Si:Jf.left},Nf=Yg?Jf.left-Si-Ti:Mf,Pf=Yg?Of:Rf-Kf.top-Kf.bottom,0>Nf&&(Nf=0),0>Pf&&(Pf=0),Lf={top:Ni?0:Rf-a,right:0/0,bottom:0,left:Ni?Qf-b:0},p(),Ni&&be(uf.data.targets)&&(Lf.left=Mf/2+Tf)}function o(){aj.select("line."+f.xgridFocus).attr("x1",Yg?0:-10).attr("x2",Yg?Mf:-10).attr("y1",Yg?-10:Jf.top).attr("y2",Yg?-10:Of)}function p(){Tf=Of/2,Sf=.95*Tf,Uf=ae(uf.data.targets)?.6*Sf:0}function q(){var a=Yg?f.axisX:f.axisY,b=tf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=tf.select(wf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return xf?xf:x()}function s(){var a=yf?yf:y();return a>0?a:320}function t(){return be(uf.data.targets)?0:zf?zf:Yg||!ph||uh?1:v("y")}function u(){var a=1;return be(uf.data.targets)?0:Af?Af:Ni?P()+(yh&&!Yg?v("y2"):a):yh?Dh||Yg?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||Zg?"x"===a&&mh?mh:"y"!==a||ph?"y2"!==a||yh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Ui:Sg&&!Ni?10:1:0}function x(){return+tf.select(wf).style("width").replace("px","")}function y(){return+tf.select(wf).style("height").replace("px","")}function z(a){return a?-5:-(Jf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Yg)}function C(){return A(!Yg)}function D(){return z(Yg)}function E(){return A(Yg)}function F(a){return a?Mf+2+4:Jf.left+20}function G(a){return a?80:Of+2}function H(){return F(!Yg)}function I(){return G(!Yg)}function J(){return F(Yg)}function K(){return G(Yg)}function L(){var a=Yg?Of:Mf,b=Ac(),c=Yb()*(Zd(uf.data.targets)?(b-(wi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){Oi=a}function N(a){Pi=a}function O(a){Qi=a}function P(){return Sg?Ni?Pi*(Oi+1):Qf:0}function Q(){return Sg?Ni?Rf:Qi*(Oi+1):0}function R(){var a,b=!fg;Zf=Yg?1:0,$f=Yg?Of:Mf,_f=Yg?0:Of,ag=Yg?Mf:1,bg=Zf,cg=$f,dg=Yg?0:Pf,eg=Yg?Nf:1,fg=T(Zf,$f,b?void 0:fg.domain(),function(){return lg.tickOffset()}),gg=U(_f,ag),hg=U(_f,ag),ig=T(Zf,$f,fj,function(a){return a%1?0:og.tickOffset()}),jg=U(dg,eg),kg=U(dg,eg),a=$(),lg=X(fg,Ii,a),og=X(ig,Li,a),mg=Y(gg,Ji,vh,xh),ng=Y(hg,Ki,Eh,Gh),b||(Vi.scale(ig),Bf&&Zi.scale(fg)),S()}function S(){Vf=Gb(),Wf=Hb(),Xf=Hb(.98)}function T(a,b,e,f){var g=(vi?tf.time.scale():tf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),wi){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return tf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?hg:gg}function W(a){return"y2"===Z(a)?kg:jg}function X(a,b,c){var d=(wi?Eb():tf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),wi?(d.tickCentered(bh),se(dh)&&(dh=!1)):d.tickOffset=function(){var a=Yg?Of:Mf;return a*Yb()/Ac()/2},wi&&d.categories(ah),d}function Y(a,b,c,d){return tf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in wg?wg[a]:"y"}function $(){var a=vi?Fi:wi?Tc:function(a){return 0>a?a.toFixed(0):a};return ch&&("function"==typeof ch?a=ch:vi&&(a=function(a){return a?Ei(ch)(a):""})),a}function _(a){var b;return"y"===a?b=th:"y2"===a?b=Ch:"x"===a&&(b=oh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?th=b:"y2"===a?Ch=b:"x"===a&&(oh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a){a.selectAll(".tick text").attr("y",db(ih)).attr("x",cb(ih)).attr("transform","rotate("+ih+")").style("text-anchor","start")}function fb(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 gb(){return fb("x",Yg?"inner-top":"inner-right")}function hb(){return fb("y",Yg?"inner-right":"inner-top")}function ib(){return fb("y2",Yg?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Mf/2:Mf:b.isBottom?-Of:b.isMiddle?-Of/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!Yg,gb())}function rb(){return nb(Yg,hb())}function sb(){return nb(Yg,ib())}function tb(){return ob(!Yg,gb())}function ub(){return ob(Yg,hb())}function vb(){return ob(Yg,ib())}function wb(){var a=gb();return Yg?a.isInner?"1.2em":-30-Cb("x"):a.isInner?"-0.5em":"3em"}function xb(){var a=hb();return Yg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return Yg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!Yg,gb())}function Ab(){return pb(Yg,hb())}function Bb(){return pb(Yg,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return tf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Db(){aj.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).text(kb),aj.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dy",xb).text(lb),aj.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dy",yb).text(mb)}function Eb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+o)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Rc(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 tf.min(Object.keys(i).map(function(a){return tf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(vg.length>0)for(g=Sc(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 tf.max(Object.keys(i).map(function(a){return tf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Ah:rh,n="y2"===c?zh:qh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Bh:sh,r=ud()&&Yg;return 0===l.length?"y2"===c?hg.domain():gg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=bc(gg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&wh&&(f=b(wh.top)?wh.top:e,g=b(wh.bottom)?wh.bottom:e),"y2"===c&&Fh&&(f=b(Fh.top)?Fh.top:e,g=b(Fh.bottom)?Fh.bottom:e),Zd(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){var b=bc(fj),c=bc(fg.domain());return a||0===c?1:b/c}function Zb(a){return kh?kh:tf.min(a,function(a){return tf.min(a.values,function(a){return a.x})})}function $b(a){return jh?jh:tf.max(a,function(a){return tf.max(a.values,function(a){return a.x})})}function _b(a,c){var d,e,f,g,h=c[0],i=c[1],j=Math.abs(h-i);return wi?e=0:Zd(a)?(d=Ac(),e=d>1?j/(d-1)/2:.5):e=.01*j,"object"==typeof lh&&te(lh)?(f=b(lh.left)?lh.left:e,g=b(lh.right)?lh.right:e):f=g="number"==typeof lh?lh:e,{left:f,right:g}}function ac(a){var b=[Zb(a),$b(a)],c=b[0],d=b[1],e=_b(a,b),f=0,g=0;return(c||0===c)&&(f=vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function bc(a){return a[1]-a[0]}function cc(a){for(var b=0;bb?0:b-c}function ic(a){var b,c=gc(a),d="y"===a.axis?gg:hg;return b="y"===a.axis||"y2"===a.axis?Yg?Of:"start"in a?d(a.start):Of:Yg?"end"in a?fg(vi?oe(a.end):a.end):Of:Of,c>b?0:b-c}function jc(a){return pg&&a===pg||te(qg)&&ue(qg,a)}function kc(a){return!jc(a)}function lc(a){return pg?pg:te(qg)?qg[a]:null}function mc(a,b){var c,d=b&&te(b)?Cc(b):[];return d.forEach(function(b){lc(b)===a&&(c=uf.data.xs[b])}),c}function nc(a,b){return a in uf.data.xs&&uf.data.xs[a]&&uf.data.xs[a][b]?uf.data.xs[a][b]:b}function oc(a){Object.keys(a).forEach(function(b){qg[b]=a[b]})}function pc(a){return 1===tf.set(Object.keys(a).map(function(b){return a[b]})).size()}function qc(a){var b;return a&&(b=tg[a.id],a.name=b?b:a.id),a}function rc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=tc(b[d],a.id,d)}),uf.data.xs[a.id]=b})}function sc(a,b){a.forEach(function(a){b[a.id]&&rc([a],b[a.id])})}function tc(a,b,c){var d;return d=vi?a?a instanceof Date?a:oe(a):oe(nc(b,c)):xi&&!wi?a?+a:nc(b,c):c}function uc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?uf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):pg?(d=Object.keys(uf.data.xs),uf.data.xs[c]=d.length>0?uf.data.xs[d[0]]:void 0):te(qg)&&(uf.data.xs[c]=mc(f,uf.data.targets)):uf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!uf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=sg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=lc(b),g=a[f],h=tc(g,b,e);return xi&&wi&&0===c&&g&&(0===e&&(ah=[]),ah.push(g)),("undefined"==typeof a[b]||uf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),xg&&Xd(Cc(c).filter(function(a){return!(a in yg)}),xg),c.forEach(function(a){dc(a.id_org,a)}),c}function xc(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 yc(a){return a>0&&uf.data.targets[0].values[a-1]?uf.data.targets[0].values[a-1].x:void 0}function zc(a){return a1?uf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?uf.data.targets[0]:null,a}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(uf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(vi?new Date(h):h);i.push(d)}return vi||(i=i.sort(function(a,b){return a-b})),i}function Lc(a){Gi=Gi.concat(a)}function Mc(a){Gi=Gi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Hi=Hi.concat(a)}function Oc(a){Hi=Hi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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(Dd(a,f))),a[g].x&&(e=e.concat(Dd(a,g))),Gd(e,b)):Ed(a,b,f,g)}function Fd(a,b){var c;return c=a.map(function(a){return Ed(a.values,b)}),Gd(c,b)}function Gd(a,b){var c,d;return a.forEach(function(a){var e=ve(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Hd(a,b){return tf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Id(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 Jd(){return Ag&&"desc"===Ag.toLowerCase()}function Kd(){return Ag&&"asc"===Ag.toLowerCase()}function Ld(a){var b=Kd(),c=Jd();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 Ag&&a.sort(Ag),a}function Md(a,c){var d,e,f,g,h,i,j,k=be(uf.data.targets),l=k?xd:wd,m=a.filter(function(a){return a&&b(a.value)});ii&&0!==m.length&&(dj.html(li(a,$(),l,Di)).style("display","block"),d=dj.property("offsetWidth"),e=dj.property("offsetHeight"),k?(g=Mf/2+c[0],i=Of/2+c[1]+20):(Yg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=fg(m[0].x)+20):(f=q(),g=f+t()+fg(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),dj.style("top",i+"px").style("left",g+"px"))}function Nd(){dj.style("display","none")}function Od(a){var c=a.filter(function(a){return a&&b(a.value)});ii&&($d(uf.data.targets)||be(uf.data.targets)||aj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Yg?"y1":"x1",zd).attr(Yg?"y2":"x2",zd))}function Pd(){aj.select("line."+f.xgridFocus).style("visibility","hidden")}function Qd(a){return a.x||0===a.x?fg(a.x):null}function Rd(a){return V(a.id)(a.value)}function Sd(){var a,b,d={},e=0;return Ic(Fc(ee)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Wd(a,b){return Uh?Uh:b?2*a.tickOffset()*Vh/b:0}function Xd(a,b){Dc(a).forEach(function(a){hj[a]=b===yg[a],yg[a]=b})}function Yd(a,b){var c=!1;return a.forEach(function(a){yg[a.id]===b&&(c=!0),a.id in yg||"line"!==b||(c=!0)}),c}function Zd(a){return Yd(a,"bar")}function $d(a){return Yd(a,"scatter")}function _d(a){return Yd(a,"pie")}function ae(a){return Yd(a,"donut")}function be(a){return _d(a)||ae(a)}function ce(a){var b="string"==typeof a?a:a.id;return!(b in yg)||"line"===yg[b]||"spline"===yg[b]||"area"===yg[b]||"area-spline"===yg[b]}function de(a){var b="string"==typeof a?a:a.id;return"spline"===yg[b]||"area-spline"===yg[b]}function ee(a){var b="string"==typeof a?a:a.id;return"bar"===yg[b]}function fe(a){var b="string"==typeof a?a:a.id;return"scatter"===yg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"pie"===yg[b]}function he(a){var b="string"==typeof a?a:a.id;return"donut"===yg[b]}function ie(a){return ge(a)||he(a)}function je(a){return ee(a)?a.values:[]}function ke(a){return ce(a)||fe(a)?a.values:[]}function le(a){return ee(a)||ce(a)?a.values:[]}function me(a){return he(a)&&ci||ge(a)&&Yh}function ne(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function oe(b){var c;try{c=rg?tf.time.format(rg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+rg)}return c}function pe(a,b){var c=tf.mouse(a),d=tf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function ue(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ve(a,b){var c="y"===Z(a.id)?gg:hg,d=Yg?1:0,e=Yg?0:1;return Math.pow(fg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function we(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function xe(a,b,c){Lg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd).attr("stroke",function(){return Di(b)}).attr("r",1.4*Sh).transition().duration(100).attr("r",Sh)}function ye(a,b,c){Mg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ze(a,b,c,d){a?xe(b,c,d):ye(b,c,d)}function Ae(a,b){Lg(b,a.node()),a.transition().duration(100).style("fill",function(){return tf.rgb(Di(b)).darker(1)})}function Be(a,b){Mg(b,a.node()),a.transition().duration(100).style("fill",function(){return Di(b)})}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a){return a.filter(function(a){return b(a.value)})}function Ee(a,c){return(c?aj.selectAll("."+f.circles+ld(c)):aj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Fe(a,b){Ee(a,b).classed(f.EXPANDED,!0).attr("r",Rh)}function Ge(a){Ee(a).filter(function(){return tf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oh)}function He(a){return aj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ie(a){He(a).classed(f.EXPANDED,!0)}function Je(a){He(a).classed(f.EXPANDED,!1)}function Ke(a,b){var c=Oe(a,b);return function(a,b){var d=c(a,b),e=Yg?1:0,f=Yg?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 Le(a,b){var c=Oe(a,!1),d=b?Me:Ne;return function(a,b){return d(c(a,b),a,this)}}function Me(a,b){var c;return Yg?(c=ee(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ne(a,b,c){var d=c.getBoundingClientRect();return Yg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ee(b)?-3:-6)}function Oe(a,b){var c=a.__max__+1,d=Wd(lg,c),e=Td(d,c,a,!!b),f=Ud(!!b),g=Vd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Yg&&(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 Pe(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 Qe(b){var c,d,e;if(ej=tf.select(wf),ej.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ej.html(""),ej.classed("c3",!0),uf.data.xs={},uf.data.targets=wc(b),n(),R(),fg.domain(tf.extent(ac(uf.data.targets))),gg.domain(Xb(uf.data.targets,"y")),hg.domain(Xb(uf.data.targets,"y2")),ig.domain(fg.domain()),jg.domain(gg.domain()),kg.domain(hg.domain()),fj=fg.domain(),Vi.scale(ig),Bf&&Zi.scale(fg),$i=ej.append("svg").attr("width",Mf+Jf.left+Jf.right).attr("height",Of+Jf.top+Jf.bottom).on("mouseenter",Ef).on("mouseleave",Ff),_i=$i.append("defs"),_i.append("clipPath").attr("id",pi).append("rect").attr("width",Mf).attr("height",Of),_i.append("clipPath").attr("id",qi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),_i.append("clipPath").attr("id",ri).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),aj=$i.append("g").attr("transform",Mi.main),bj=Pg?$i.append("g").attr("transform",Mi.context):null,cj=$i.append("g").attr("transform",Mi.legend),Sg||(cj.style("visibility","hidden"),Hi=Cc(uf.data.targets)),dj=tf.select(wf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),of(Cc(uf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Zg&&aj.append("g").attr("class",f.axisX).attr("clip-path",ti).attr("transform",Mi.x).append("text").attr("class",f.axisXLabel).attr("transform",Yg?"rotate(-90)":"").attr("dx",tb).attr("dy",wb).style("text-anchor",zb),ph&&aj.append("g").attr("class",f.axisY).attr("clip-path",ui).attr("transform",Mi.y).append("text").attr("class",f.axisYLabel).attr("transform",Yg?"":"rotate(-90)").attr("dx",ub).attr("dy",xb).style("text-anchor",Ab),yh&&aj.append("g").attr("class",f.axisY2).attr("transform",Mi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Yg?"":"rotate(-90)").attr("dx",vb).style("text-anchor",Bb),d=aj.append("g").attr("clip-path",si).attr("class",f.grid),Hh&&d.append("g").attr("class",f.xgrids),te(Jh)&&d.append("g").attr("class",f.xgridLines),Ph&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Kh&&d.append("g").attr("class",f.ygrids),te(Lh)&&d.append("g").attr("class",f.ygridLines),aj.append("g").attr("clip-path",si).attr("class",f.regions),aj.append("g").attr("clip-path",si).attr("class",f.chart),c=aj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Bf?Yg?"ns-resize":"ew-resize":null),aj.select("."+f.chart).append("g").attr("class",f.chartBars),aj.select("."+f.chart).append("g").attr("class",f.chartLines),aj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Mi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),aj.select("."+f.chart).append("g").attr("class",f.chartTexts),Bf&&aj.insert("rect",Df?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Mf).attr("height",Of).style("opacity",0).style("cursor",Yg?"ns-resize":"ew-resize").call(Zi).on("dblclick.zoom",null),nh&&Vi.extent("function"!=typeof nh?nh:nh(ac())),Pg&&(bj.append("g").attr("clip-path",si).attr("class",f.chart),bj.select("."+f.chart).append("g").attr("class",f.chartBars),bj.select("."+f.chart).append("g").attr("class",f.chartLines),bj.append("g").attr("clip-path",si).attr("class",f.brush).call(Vi).selectAll("rect").attr(Yg?"width":"height",Yg?Nf:Pf),bj.append("g").attr("class",f.axisX).attr("transform",Mi.subx).attr("clip-path",Yg?"":ti)),bf(uf.data.targets),Yg?aj.select("."+f.axisX).style("opacity",0).call(lg):(aj.select("."+f.axisY).style("opacity",0).call(mg),aj.select("."+f.axisY2).style("opacity",0).call(ng)),Xe({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),mi){if(vi&&"string"==typeof ni){for(ni=oe(ni),e=0;eMf&&(Mf=0),0>Of&&(Of=0),Nf=Yg?Jf.left-Si-Ti:Mf,Pf=Yg?Of:Rf-Kf.top-Kf.bottom,0>Nf&&(Nf=0),0>Pf&&(Pf=0),p(),Ni&&be(uf.data.targets)&&(Lf.left=Mf/2+Tf)}function o(){aj.select("line."+f.xgridFocus).attr("x1",Yg?0:-10).attr("x2",Yg?Mf:-10).attr("y1",Yg?-10:Jf.top).attr("y2",Yg?-10:Of)}function p(){Tf=Of/2,Sf=.95*Tf,Uf=ae(uf.data.targets)?.6*Sf:0}function q(){var a=Yg?f.axisX:f.axisY,b=tf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=tf.select(wf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return xf?xf:x()}function s(){var a=yf?yf:y();return a>0?a:320}function t(){return be(uf.data.targets)?0:zf?zf:Yg||!ph||uh?1:v("y")}function u(){var a=1;return be(uf.data.targets)?0:Af?Af:Ni?P()+(yh&&!Yg?v("y2"):a):yh?Dh||Yg?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||Zg?"x"===a&&mh?mh:"y"!==a||ph?"y2"!==a||yh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Ui:Sg&&!Ni?10:1:0}function x(){return+tf.select(wf).style("width").replace("px","")}function y(){return+tf.select(wf).style("height").replace("px","")}function z(a){return a?-5:-(Jf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Yg)}function C(){return A(!Yg)}function D(){return z(Yg)}function E(){return A(Yg)}function F(a){return a?Mf+2+4:Jf.left+20}function G(a){return a?80:Of+2}function H(){return F(!Yg)}function I(){return G(!Yg)}function J(){return F(Yg)}function K(){return G(Yg)}function L(){var a=Yg?Of:Mf,b=Ac(),c=Yb()*(Zd(uf.data.targets)?(b-(wi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){Oi=a}function N(a){Pi=a}function O(a){Qi=a}function P(){return Sg?Ni?Pi*(Oi+1):Qf:0}function Q(){return Sg?Ni?Rf:Qi*(Oi+1):0}function R(){var a,b=!fg;Zf=Yg?1:0,$f=Yg?Of:Mf,_f=Yg?0:Of,ag=Yg?Mf:1,bg=Zf,cg=$f,dg=Yg?0:Pf,eg=Yg?Nf:1,fg=T(Zf,$f,b?void 0:fg.domain(),function(){return lg.tickOffset()}),gg=U(_f,ag),hg=U(_f,ag),ig=T(Zf,$f,fj,function(a){return a%1?0:og.tickOffset()}),jg=U(dg,eg),kg=U(dg,eg),a=$(),lg=X(fg,Ii,a),og=X(ig,Li,a),mg=Y(gg,Ji,vh,xh),ng=Y(hg,Ki,Eh,Gh),b||(Vi.scale(ig),Bf&&Zi.scale(fg)),S()}function S(){Vf=Gb(),Wf=Hb(),Xf=Hb(.98)}function T(a,b,e,f){var g=(vi?tf.time.scale():tf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),wi){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return tf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?hg:gg}function W(a){return"y2"===Z(a)?kg:jg}function X(a,b,c){var d=(wi?Eb():tf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),wi?(d.tickCentered(bh),se(dh)&&(dh=!1)):d.tickOffset=function(){var a=Yg?Of:Mf;return a*Yb()/Ac()/2},wi&&d.categories(ah),d}function Y(a,b,c,d){return tf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in wg?wg[a]:"y"}function $(){var a=vi?Fi:wi?Tc:function(a){return 0>a?a.toFixed(0):a};return ch&&("function"==typeof ch?a=ch:vi&&(a=function(a){return a?Ei(ch)(a):""})),a}function _(a){var b;return"y"===a?b=th:"y2"===a?b=Ch:"x"===a&&(b=oh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?th=b:"y2"===a?Ch=b:"x"===a&&(oh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a){a.selectAll(".tick text").attr("y",db(ih)).attr("x",cb(ih)).attr("transform","rotate("+ih+")").style("text-anchor","start")}function fb(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 gb(){return fb("x",Yg?"inner-top":"inner-right")}function hb(){return fb("y",Yg?"inner-right":"inner-top")}function ib(){return fb("y2",Yg?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Mf/2:Mf:b.isBottom?-Of:b.isMiddle?-Of/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!Yg,gb())}function rb(){return nb(Yg,hb())}function sb(){return nb(Yg,ib())}function tb(){return ob(!Yg,gb())}function ub(){return ob(Yg,hb())}function vb(){return ob(Yg,ib())}function wb(){var a=gb();return Yg?a.isInner?"1.2em":-30-Cb("x"):a.isInner?"-0.5em":"3em"}function xb(){var a=hb();return Yg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return Yg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!Yg,gb())}function Ab(){return pb(Yg,hb())}function Bb(){return pb(Yg,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return tf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Db(){aj.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).text(kb),aj.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dy",xb).text(lb),aj.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dy",yb).text(mb)}function Eb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+o)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Rc(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 tf.min(Object.keys(i).map(function(a){return tf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(vg.length>0)for(g=Sc(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 tf.max(Object.keys(i).map(function(a){return tf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Ah:rh,n="y2"===c?zh:qh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Bh:sh,r=ud()&&Yg;return 0===l.length?"y2"===c?hg.domain():gg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=bc(gg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&wh&&(f=b(wh.top)?wh.top:e,g=b(wh.bottom)?wh.bottom:e),"y2"===c&&Fh&&(f=b(Fh.top)?Fh.top:e,g=b(Fh.bottom)?Fh.bottom:e),Zd(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){var b=bc(fj),c=bc(fg.domain());return a||0===c?1:b/c}function Zb(a){return kh?kh:tf.min(a,function(a){return tf.min(a.values,function(a){return a.x})})}function $b(a){return jh?jh:tf.max(a,function(a){return tf.max(a.values,function(a){return a.x})})}function _b(a,c){var d,e,f,g,h=c[0],i=c[1],j=Math.abs(h-i);return wi?e=0:Zd(a)?(d=Ac(),e=d>1?j/(d-1)/2:.5):e=.01*j,"object"==typeof lh&&te(lh)?(f=b(lh.left)?lh.left:e,g=b(lh.right)?lh.right:e):f=g="number"==typeof lh?lh:e,{left:f,right:g}}function ac(a){var b=[Zb(a),$b(a)],c=b[0],d=b[1],e=_b(a,b),f=0,g=0;return(c||0===c)&&(f=vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function bc(a){return a[1]-a[0]}function cc(a){for(var b=0;bb?0:b-c}function ic(a){var b,c=gc(a),d="y"===a.axis?gg:hg;return b="y"===a.axis||"y2"===a.axis?Yg?Of:"start"in a?d(a.start):Of:Yg?"end"in a?fg(vi?oe(a.end):a.end):Of:Of,c>b?0:b-c}function jc(a){return pg&&a===pg||te(qg)&&ue(qg,a)}function kc(a){return!jc(a)}function lc(a){return pg?pg:te(qg)?qg[a]:null}function mc(a,b){var c,d=b&&te(b)?Cc(b):[];return d.forEach(function(b){lc(b)===a&&(c=uf.data.xs[b])}),c}function nc(a,b){return a in uf.data.xs&&uf.data.xs[a]&&uf.data.xs[a][b]?uf.data.xs[a][b]:b}function oc(a){Object.keys(a).forEach(function(b){qg[b]=a[b]})}function pc(a){return 1===tf.set(Object.keys(a).map(function(b){return a[b]})).size()}function qc(a){var b;return a&&(b=tg[a.id],a.name=b?b:a.id),a}function rc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=tc(b[d],a.id,d)}),uf.data.xs[a.id]=b})}function sc(a,b){a.forEach(function(a){b[a.id]&&rc([a],b[a.id])})}function tc(a,b,c){var d;return d=vi?a?a instanceof Date?a:oe(a):oe(nc(b,c)):xi&&!wi?a?+a:nc(b,c):c}function uc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?uf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):pg?(d=Object.keys(uf.data.xs),uf.data.xs[c]=d.length>0?uf.data.xs[d[0]]:void 0):te(qg)&&(uf.data.xs[c]=mc(f,uf.data.targets)):uf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!uf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=sg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=lc(b),g=a[f],h=tc(g,b,e);return xi&&wi&&0===c&&g&&(0===e&&(ah=[]),ah.push(g)),("undefined"==typeof a[b]||uf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),xg&&Xd(Cc(c).filter(function(a){return!(a in yg)}),xg),c.forEach(function(a){dc(a.id_org,a)}),c}function xc(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 yc(a){return a>0&&uf.data.targets[0].values[a-1]?uf.data.targets[0].values[a-1].x:void 0}function zc(a){return a1?uf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?uf.data.targets[0]:null,a}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(uf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(vi?new Date(h):h);i.push(d)}return vi||(i=i.sort(function(a,b){return a-b})),i}function Lc(a){Gi=Gi.concat(a)}function Mc(a){Gi=Gi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Hi=Hi.concat(a)}function Oc(a){Hi=Hi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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(Dd(a,f))),a[g].x&&(e=e.concat(Dd(a,g))),Gd(e,b)):Ed(a,b,f,g)}function Fd(a,b){var c;return c=a.map(function(a){return Ed(a.values,b)}),Gd(c,b)}function Gd(a,b){var c,d;return a.forEach(function(a){var e=ve(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Hd(a,b){return tf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Id(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 Jd(){return Ag&&"desc"===Ag.toLowerCase()}function Kd(){return Ag&&"asc"===Ag.toLowerCase()}function Ld(a){var b=Kd(),c=Jd();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 Ag&&a.sort(Ag),a}function Md(a,c){var d,e,f,g,h,i,j,k=be(uf.data.targets),l=k?xd:wd,m=a.filter(function(a){return a&&b(a.value)});ii&&0!==m.length&&(dj.html(li(a,$(),l,Di)).style("display","block"),d=dj.property("offsetWidth"),e=dj.property("offsetHeight"),k?(g=Mf/2+c[0],i=Of/2+c[1]+20):(Yg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=fg(m[0].x)+20):(f=q(),g=f+t()+fg(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),dj.style("top",i+"px").style("left",g+"px"))}function Nd(){dj.style("display","none")}function Od(a){var c=a.filter(function(a){return a&&b(a.value)});ii&&($d(uf.data.targets)||be(uf.data.targets)||aj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Yg?"y1":"x1",zd).attr(Yg?"y2":"x2",zd))}function Pd(){aj.select("line."+f.xgridFocus).style("visibility","hidden")}function Qd(a){return a.x||0===a.x?fg(a.x):null}function Rd(a){return V(a.id)(a.value)}function Sd(){var a,b,d={},e=0;return Ic(Fc(ee)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Wd(a,b){return Uh?Uh:b?2*a.tickOffset()*Vh/b:0}function Xd(a,b){Dc(a).forEach(function(a){hj[a]=b===yg[a],yg[a]=b})}function Yd(a,b){var c=!1;return a.forEach(function(a){yg[a.id]===b&&(c=!0),a.id in yg||"line"!==b||(c=!0)}),c}function Zd(a){return Yd(a,"bar")}function $d(a){return Yd(a,"scatter")}function _d(a){return Yd(a,"pie")}function ae(a){return Yd(a,"donut")}function be(a){return _d(a)||ae(a)}function ce(a){var b="string"==typeof a?a:a.id;return!(b in yg)||"line"===yg[b]||"spline"===yg[b]||"area"===yg[b]||"area-spline"===yg[b]}function de(a){var b="string"==typeof a?a:a.id;return"spline"===yg[b]||"area-spline"===yg[b]}function ee(a){var b="string"==typeof a?a:a.id;return"bar"===yg[b]}function fe(a){var b="string"==typeof a?a:a.id;return"scatter"===yg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"pie"===yg[b]}function he(a){var b="string"==typeof a?a:a.id;return"donut"===yg[b]}function ie(a){return ge(a)||he(a)}function je(a){return ee(a)?a.values:[]}function ke(a){return ce(a)||fe(a)?a.values:[]}function le(a){return ee(a)||ce(a)?a.values:[]}function me(a){return he(a)&&ci||ge(a)&&Yh}function ne(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function oe(b){var c;try{c=rg?tf.time.format(rg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+rg)}return c}function pe(a,b){var c=tf.mouse(a),d=tf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function ue(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ve(a,b){var c="y"===Z(a.id)?gg:hg,d=Yg?1:0,e=Yg?0:1;return Math.pow(fg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function we(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function xe(a,b,c){Lg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd).attr("stroke",function(){return Di(b)}).attr("r",1.4*Sh).transition().duration(100).attr("r",Sh)}function ye(a,b,c){Mg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ze(a,b,c,d){a?xe(b,c,d):ye(b,c,d)}function Ae(a,b){Lg(b,a.node()),a.transition().duration(100).style("fill",function(){return tf.rgb(Di(b)).darker(1)})}function Be(a,b){Mg(b,a.node()),a.transition().duration(100).style("fill",function(){return Di(b)})}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a){return a.filter(function(a){return b(a.value)})}function Ee(a,c){return(c?aj.selectAll("."+f.circles+ld(c)):aj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Fe(a,b){Ee(a,b).classed(f.EXPANDED,!0).attr("r",Rh)}function Ge(a){Ee(a).filter(function(){return tf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oh)}function He(a){return aj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ie(a){He(a).classed(f.EXPANDED,!0)}function Je(a){He(a).classed(f.EXPANDED,!1)}function Ke(a,b){var c=Oe(a,b);return function(a,b){var d=c(a,b),e=Yg?1:0,f=Yg?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 Le(a,b){var c=Oe(a,!1),d=b?Me:Ne;return function(a,b){return d(c(a,b),a,this)}}function Me(a,b){var c;return Yg?(c=ee(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ne(a,b,c){var d=c.getBoundingClientRect();return Yg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ee(b)?-3:-6)}function Oe(a,b){var c=a.__max__+1,d=Wd(lg,c),e=Td(d,c,a,!!b),f=Ud(!!b),g=Vd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Yg&&(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 Pe(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 Qe(b){var c,d,e;if(ej=tf.select(wf),ej.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ej.html(""),ej.classed("c3",!0),uf.data.xs={},uf.data.targets=wc(b),n(),R(),fg.domain(tf.extent(ac(uf.data.targets))),gg.domain(Xb(uf.data.targets,"y")),hg.domain(Xb(uf.data.targets,"y2")),ig.domain(fg.domain()),jg.domain(gg.domain()),kg.domain(hg.domain()),fj=fg.domain(),Vi.scale(ig),Bf&&Zi.scale(fg),$i=ej.append("svg").attr("width",Mf+Jf.left+Jf.right).attr("height",Of+Jf.top+Jf.bottom).on("mouseenter",Ef).on("mouseleave",Ff),_i=$i.append("defs"),_i.append("clipPath").attr("id",pi).append("rect").attr("width",Mf).attr("height",Of),_i.append("clipPath").attr("id",qi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),_i.append("clipPath").attr("id",ri).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),aj=$i.append("g").attr("transform",Mi.main),bj=Pg?$i.append("g").attr("transform",Mi.context):null,cj=$i.append("g").attr("transform",Mi.legend),Sg||(cj.style("visibility","hidden"),Hi=Cc(uf.data.targets)),dj=tf.select(wf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),of(Cc(uf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Zg&&aj.append("g").attr("class",f.axisX).attr("clip-path",ti).attr("transform",Mi.x).append("text").attr("class",f.axisXLabel).attr("transform",Yg?"rotate(-90)":"").attr("dx",tb).attr("dy",wb).style("text-anchor",zb),ph&&aj.append("g").attr("class",f.axisY).attr("clip-path",ui).attr("transform",Mi.y).append("text").attr("class",f.axisYLabel).attr("transform",Yg?"":"rotate(-90)").attr("dx",ub).attr("dy",xb).style("text-anchor",Ab),yh&&aj.append("g").attr("class",f.axisY2).attr("transform",Mi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Yg?"":"rotate(-90)").attr("dx",vb).style("text-anchor",Bb),d=aj.append("g").attr("clip-path",si).attr("class",f.grid),Hh&&d.append("g").attr("class",f.xgrids),te(Jh)&&d.append("g").attr("class",f.xgridLines),Ph&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Kh&&d.append("g").attr("class",f.ygrids),te(Lh)&&d.append("g").attr("class",f.ygridLines),aj.append("g").attr("clip-path",si).attr("class",f.regions),aj.append("g").attr("clip-path",si).attr("class",f.chart),c=aj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Bf?Yg?"ns-resize":"ew-resize":null),aj.select("."+f.chart).append("g").attr("class",f.chartBars),aj.select("."+f.chart).append("g").attr("class",f.chartLines),aj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Mi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),aj.select("."+f.chart).append("g").attr("class",f.chartTexts),Bf&&aj.insert("rect",Df?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Mf).attr("height",Of).style("opacity",0).style("cursor",Yg?"ns-resize":"ew-resize").call(Zi).on("dblclick.zoom",null),nh&&Vi.extent("function"!=typeof nh?nh:nh(ac())),Pg&&(bj.append("g").attr("clip-path",si).attr("class",f.chart),bj.select("."+f.chart).append("g").attr("class",f.chartBars),bj.select("."+f.chart).append("g").attr("class",f.chartLines),bj.append("g").attr("clip-path",si).attr("class",f.brush).call(Vi).selectAll("rect").attr(Yg?"width":"height",Yg?Nf:Pf),bj.append("g").attr("class",f.axisX).attr("transform",Mi.subx).attr("clip-path",Yg?"":ti)),bf(uf.data.targets),Yg?aj.select("."+f.axisX).style("opacity",0).call(lg):(aj.select("."+f.axisY).style("opacity",0).call(mg),aj.select("."+f.axisY2).style("opacity",0).call(ng)),Xe({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),mi){if(vi&&"string"==typeof ni){for(ni=oe(ni),e=0;e0){d=[];for(var g in tg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Id(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ce,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 Ve(a){be(uf.data.targets)||Eg&&(yi=a,aj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),zi=!0,Ng())}function We(){be(uf.data.targets)||Eg&&(aj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),aj.selectAll("."+f.shape).classed(f.INCLUDED,!1),zi=!1,Og())}function Xe(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U=Sd(),V=be(uf.data.targets),W=Ic(uf.data.targets);if(0!==W.length){if(a=d(a)?a:{},z=d(a.withY)?a.withY:!0,A=d(a.withSubchart)?a.withSubchart:!0,B=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,C=d(a.withTransitionForExit)?a.withTransitionForExit:B,D=d(a.withTransitionForAxis)?a.withTransitionForAxis:B,E=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:B,O=B?If:0,P=C?O:0,Q=D?O:0,I&&Sg&&of(Cc(uf.data.targets),a),H&&(fg.domain(tf.extent(ac(W))),fj=fg.domain(),Bf&&Zi.scale(fg).updateScaleExtent(),ig.domain(fg.domain()),Vi.scale(ig)),G&&(fg.domain(Vi.empty()?fj:Vi.extent()),Bf&&Zi.scale(fg).updateScaleExtent()),gg.domain(Xb(W,"y")),hg.domain(Xb(W,"y2")),(gh||fh)&&(R=hh?hh:Kc(Jc(W)),lg.tickValues(R),og.tickValues(R)),c=aj.select("."+f.axisX).style("opacity",V?0:1),(Yg||E)&&(c=c.transition().duration(Q)),c.call(lg),g=aj.select("."+f.axisY).style("opacity",V?0:1),(!Yg||E)&&(g=g.transition().duration(Q)),g.call(mg),aj.select("."+f.axisY2).style("opacity",V?0:1).transition().duration(Q).call(ng),G)if(dh&&R){for(S=1;S=0&&tf.select(this).style("display",b%T?"none":"block")})}else tf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!Yg&&ih&&eb(c),J=Ke(U),M=Le(U,!0),N=Le(U,!1),Db(),jg.domain(gg.domain()),kg.domain(hg.domain()),dj.style("display","none"),o(),aj.select("line."+f.xgridFocus).style("visibility","hidden"),Hh){if("year"===Ih){i=[];for(var X=ac(),Y=X[0].getFullYear(),Z=X[1].getFullYear(),$=Y;Z>=$;$++)i.push(new Date($+"-01-01 00:00:00"))}else i=fg.ticks(10);h=aj.select("."+f.xgrids).selectAll("."+f.xgrid).data(i),h.enter().append("line").attr("class",f.xgrid),h.attr("x1",Yg?0:function(a){return fg(a)-lg.tickOffset()}).attr("x2",Yg?Mf:function(a){return fg(a)-lg.tickOffset()}).attr("y1",Yg?function(a){return fg(a)-lg.tickOffset()}:Jf.top).attr("y2",Yg?function(a){return fg(a)-lg.tickOffset()}:Of).style("opacity",function(){return+tf.select(this).attr(Yg?"y1":"x1")===(Yg?Of:0)?0:1}),h.exit().remove()}te(Jh)&&(j=aj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Jh),k=j.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),k.append("line").style("opacity",0),k.append("text").attr("text-anchor","end").attr("transform",Yg?"":"rotate(-90)").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),j.select("line").transition().duration(O).attr("x1",Yg?0:Ad).attr("x2",Yg?Mf:Ad).attr("y1",Yg?Ad:Jf.top).attr("y2",Yg?Ad:Of).style("opacity",1),j.select("text").transition().duration(O).attr("x",Yg?Mf:0).attr("y",Ad).text(function(a){return a.text}).style("opacity",1),j.exit().transition().duration(O).style("opacity",0).remove()),z&&Kh&&(l=aj.select("."+f.ygrids).selectAll("."+f.ygrid).data(gg.ticks(Mh)),l.enter().append("line").attr("class",f.ygrid),l.attr("x1",Yg?gg:0).attr("x2",Yg?gg:Mf).attr("y1",Yg?0:gg).attr("y2",Yg?Of:gg),l.exit().remove()),z&&te(Lh)&&(m=aj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Lh),n=m.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),n.append("line").style("opacity",0),n.append("text").attr("text-anchor","end").attr("transform",Yg?"rotate(-90)":"").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),m.select("line").transition().duration(O).attr("x1",Yg?Bd:0).attr("x2",Yg?Bd:Mf).attr("y1",Yg?0:Bd).attr("y2",Yg?Of:Bd).style("opacity",1),m.select("text").transition().duration(O).attr("x",Yg?0:Mf).attr("y",Bd).text(function(a){return a.text}).style("opacity",1),m.exit().transition().duration(O).style("opacity",0).remove()),q=aj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),q.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Di(a)}).attr("class",ad),q.style("opacity",qd).transition().duration(O).attr("d",J).style("opacity",1),q.exit().transition().duration(P).style("opacity",0).remove(),s=aj.selectAll("."+f.texts).selectAll("."+f.text).data(le),s.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return Yg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),s.text(function(a){return yd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(O).attr("x",M).attr("y",N).style("fill-opacity",td),s.exit().transition().duration(P).style("fill-opacity",0).remove(),aj.selectAll("."+f.line).style("opacity",qd).transition().duration(O).attr("d",Wi).style("opacity",1),aj.selectAll("."+f.area).style("opacity",0).transition().duration(O).attr("d",Xi).style("opacity",gj),p=aj.selectAll("."+f.circles).selectAll("."+f.circle).data(ke),p.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Oh),p.style("opacity",qd).transition().duration(O).style("opacity",sd).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),p.exit().remove(),aj.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(O).attrTween("d",function(a){var b,c=Fb(a);return c?(b=tf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1),aj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(O).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&ie(a.data)?1:0}),aj.select("."+f.chartArcsTitle).style("opacity",ae(uf.data.targets)?1:0),Pg&&(null!==tf.event&&"zoom"===tf.event.type&&Vi.extent(fg.orgDomain()).update(),A&&(e=bj.select("."+f.axisX).style("opacity",V?0:1),(Yg||E)&&(e=e.transition().duration(Q)),e.call(og),!Yg&&ih&&eb(e),Vi.empty()||Vi.extent(fg.orgDomain()).update(),K=Ke(U,!0),t=bj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),t.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Di(a)}).attr("class",ad),t.style("opacity",qd).transition().duration(O).attr("d",K).style("opacity",1),t.exit().transition().duration(O).style("opacity",0).remove(),bj.selectAll("."+f.line).style("opacity",qd).transition().duration(O).attr("d",Yi).style("opacity",1))),aj.selectAll("."+f.selectedCircles).filter(function(a){return ee(a)}).selectAll("circle").remove(),aj.selectAll("."+f.selectedCircle).transition().duration(O).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),u=aj.select("."+f.eventRects),te(qg)&&!pc(qg)?(u.classed(f.eventRectsMultiple)||u.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),v=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Se(v.enter()),v.attr("x",0).attr("y",0).attr("width",Mf).attr("height",Of)):(u.classed(f.eventRectsSingle)||u.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),xi&&!wi?(y=function(a,b){var c=yc(b),d=zc(b),e=uf.data.xs[a.id][b];return(fg(d?d:e+50)-fg(c?c:e-50))/2},x=function(a,b){var c=yc(b),d=uf.data.xs[a.id][b];return(fg(d)+fg(c?c:d-50))/2}):(y=L(),x=function(a){return fg(a.x)-y/2}),w=Bc(),aj.select("."+f.eventRects).datum(w?w.values:[]),v=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Re(v.enter()),v.attr("class",fd).attr("x",Yg?0:x).attr("y",Yg?x:0).attr("width",Yg?Mf:y).attr("height",Yg?y:Of),v.exit().remove()),r=aj.select("."+f.regions).selectAll("rect."+f.region).data(hi),r.enter().append("rect").style("fill-opacity",0),r.attr("class",ed).attr("x",fc).attr("y",gc).attr("width",hc).attr("height",ic).transition().duration(O).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Cc(uf.data.targets).forEach(function(a){hj[a]=!0})}}function Ye(){Xe({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ze(){return"mousemove"===tf.event.sourceEvent.type&&Zi.altDomain?(fg.domain(Zi.altDomain),void Zi.scale(fg).updateScaleExtent()):(wi&&fg.orgDomain()[0]===fj[0]&&fg.domain([fj[0]-1e-10,fg.orgDomain()[1]]),Xe({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===tf.event.sourceEvent.type&&(Ai=!0)))}function $e(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function _e(){$i.attr("width",Qf).attr("height",Rf),$i.select("#"+pi).select("rect").attr("width",Mf).attr("height",Of),$i.select("#"+qi).select("rect").attr("width",H),$i.select("#"+ri).select("rect").attr("width",J),$i.select("."+f.zoomRect).attr("width",Mf).attr("height",Of)}function af(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),_e(),m(a.withTransition),Xe(a)}function bf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=aj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Di(a)}),e=aj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("fill",function(a){return Di(a)}).style("stroke","none").style("cursor",function(a){return Gg(a)?"pointer":null}),c=aj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)}),b.append("path").attr("class",dd).style("opacity",function(){return gj=+tf.select(this).style("opacity"),0}).style("fill",function(a){return Di(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Di(a)}).style("cursor",function(a){return Gg(a)?"pointer":null}),a.forEach(function(a){aj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=aj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Yf(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Di(a.data)}).style("cursor",function(a){return Gg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Fb(a),d=Lb(c),e=Tb();Nb(c.data.id),jf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Fb(a),c=[Lb(b)];Md(c,tf.mouse(this))}).on("mouseout",function(a,b){var c=Fb(a),d=Lb(c),e=Ub();Ob(c.data.id),lf(),Nd(),e(d,b)}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Pg&&(n=bj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Di(a)}),l=bj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)})),$i.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function cf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Xd(a.id,b.types[a.id]):Xd(a.id,b.type)}),uf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Ni?j:i,l=Ni?Q():P();return d&&(w=0,C=0,t=0,u=0),Sg&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Ni?u:t,void(Xg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,Ni?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=cj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Ug?Ug(a):uf.toggle(a)}).on("mouseover",function(a){uf.focus(a),"function"==typeof Vg&&Vg(a)}).on("mouseout",function(a){uf.revert(),"function"==typeof Wg&&Wg(a)}),l.append("text").text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",Ni?g:-200).attr("y",Ni?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ni?h:-200).attr("y",Ni?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Di(a)}).attr("x",Ni?g:-200).attr("y",Ni?-200:i).attr("width",10).attr("height",10),cj.selectAll("text").data(a).text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),cj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),cj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),_e(),q&&m(p)}function pf(a){return Ec(uf.data.targets,a.id)}function qf(a){return"data"in a&&Ec(uf.data.targets,a.data.id)}function rf(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 sf(a,b,c){var d=!be(uf.data.targets);Xd(a,b),af(c?c:{withTransitionForAxis:d})}var tf=a.d3?a.d3:a.require?a.require("d3"):void 0,uf={data:{},axis:{},legend:{}},vf={},wf=h(["bindto"],"#chart"),xf=h(["size","width"]),yf=h(["size","height"]),zf=h(["padding","left"]),Af=h(["padding","right"]),Bf=h(["zoom","enabled"],!1),Cf=h(["zoom","extent"]),Df=h(["zoom","privileged"],!1),Ef=h(["onenter"],function(){}),Ff=h(["onleave"],function(){}),Gf=h(["onresize"],function(){}),Hf=h(["onresized"],function(){}),If=h(["transition","duration"],350);g("data","data is required in config");var Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg=h(["data","x"]),qg=h(["data","xs"],{}),rg=h(["data","x_format"]),sg=h(["data","id_converter"],function(a){return a}),tg=h(["data","names"],{}),ug=h(["data","classes"],{}),vg=h(["data","groups"],[]),wg=h(["data","axes"],{}),xg=h(["data","type"]),yg=h(["data","types"],{}),zg=h(["data","labels"],{}),Ag=h(["data","order"]),Bg=h(["data","regions"],{}),Cg=h(["data","color"]),Dg=h(["data","colors"],{}),Eg=h(["data","selection","enabled"],!1),Fg=h(["data","selection","grouped"],!1),Gg=h(["data","selection","isselectable"],function(){return!0}),Hg=h(["data","selection","multiple"],!0),Ig=h(["data","onclick"],function(){}),Jg=h(["data","onenter"],function(){}),Kg=h(["data","onleave"],function(){}),Lg=h(["data","onselected"],function(){}),Mg=h(["data","onunselected"],function(){}),Ng=h(["data","ondragstart"],function(){}),Og=h(["data","ondragend"],function(){}),Pg=h(["subchart","show"],!1),Qg=h(["subchart","size","height"],60),Rg=h(["color","pattern"],[]),Sg=h(["legend","show"],!0),Tg=h(["legend","position"],"bottom"),Ug=h(["legend","item","onclick"]),Vg=h(["legend","item","onmouseover"]),Wg=h(["legend","item","onmouseout"]),Xg=h(["legend","equally"],!1),Yg=h(["axis","rotated"],!1),Zg=h(["axis","x","show"],!0),$g=h(["axis","x","type"],"indexed"),_g=h(["axis","x","localtime"],!0),ah=h(["axis","x","categories"],[]),bh=h(["axis","x","tick","centered"],!1),ch=h(["axis","x","tick","format"]),dh=h(["axis","x","tick","culling"],{}),eh=h(["axis","x","tick","culling","max"],10),fh=h(["axis","x","tick","count"]),gh=h(["axis","x","tick","fit"],!0),hh=h(["axis","x","tick","values"],null),ih=h(["axis","x","tick","rotate"]),jh=h(["axis","x","max"]),kh=h(["axis","x","min"]),lh=h(["axis","x","padding"],{}),mh=h(["axis","x","height"]),nh=h(["axis","x","default"]),oh=h(["axis","x","label"],{}),ph=h(["axis","y","show"],!0),qh=h(["axis","y","max"]),rh=h(["axis","y","min"]),sh=h(["axis","y","center"]),th=h(["axis","y","label"],{}),uh=h(["axis","y","inner"],!1),vh=h(["axis","y","tick","format"]),wh=h(["axis","y","padding"],{}),xh=h(["axis","y","ticks"],10),yh=h(["axis","y2","show"],!1),zh=h(["axis","y2","max"]),Ah=h(["axis","y2","min"]),Bh=h(["axis","y2","center"]),Ch=h(["axis","y2","label"],{}),Dh=h(["axis","y2","inner"],!1),Eh=h(["axis","y2","tick","format"]),Fh=h(["axis","y2","padding"],{}),Gh=h(["axis","y2","ticks"],10),Hh=h(["grid","x","show"],!1),Ih=h(["grid","x","type"],"tick"),Jh=h(["grid","x","lines"],[]),Kh=h(["grid","y","show"],!1),Lh=h(["grid","y","lines"],[]),Mh=h(["grid","y","ticks"],10),Nh=h(["point","show"],!0),Oh=Nh?h(["point","r"],2.5):0,Ph=h(["point","focus","line","enabled"],!0),Qh=h(["point","focus","expand","enabled"],!0),Rh=h(["point","focus","expand","r"],Qh?4:Oh),Sh=h(["point","focus","select","r"],8),Th=h(["line","connect_null"],!1),Uh=h(["bar","width"]),Vh=h(["bar","width","ratio"],.6),Wh=h(["pie","label","show"],!0),Xh=h(["pie","label","format"]),Yh=h(["pie","expand"],!0),Zh=h(["pie","onclick"],function(){}),$h=h(["pie","onmouseover"],function(){}),_h=h(["pie","onmouseout"],function(){}),ai=h(["donut","label","show"],!0),bi=h(["donut","label","format"]),ci=h(["donut","expand"],!0),di=h(["donut","title"],""),ei=h(["donut","onclick"],function(){}),fi=h(["donut","onmouseover"],function(){}),gi=h(["donut","onmouseout"],function(){}),hi=h(["regions"],[]),ii=h(["tooltip","show"],!0),ji=h(["tooltip","format","title"]),ki=h(["tooltip","format","value"]),li=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ji?ji:b,l=ki?ki: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+""}),mi=h(["tooltip","init","show"],!1),ni=h(["tooltip","init","x"],0),oi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),pi=("string"==typeof wf?wf.replace("#",""):wf.id)+"-clip",qi=pi+"-xaxis",ri=pi+"-yaxis",si=i(pi),ti=i(qi),ui=i(ri),vi="timeseries"===$g,wi="categorized"===$g,xi=!vi&&(pg||te(qg)),yi=null,zi=!1,Ai=!1,Bi=!1,Ci=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Di=ne(Dg,te(Rg)?Rg:Ci,Cg),Ei=_g?tf.time.format:tf.time.format.utc,Fi=function(){var a=[[Ei("%Y/%-m/%-d"),function(){return!0}],[Ei("%-m/%-d"),function(a){return a.getMonth()}],[Ei("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ei("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ei("%I %p"),function(a){return a.getHours()}],[Ei("%I:%M"),function(a){return a.getMinutes()}],[Ei(":%S"),function(a){return a.getSeconds()}],[Ei(".%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)}}(),Gi=[],Hi=[],Ii=Yg?"left":"bottom",Ji=Yg?uh?"top":"bottom":uh?"right":"left",Ki=Yg?Dh?"bottom":"top":Dh?"left":"right",Li=Yg?"left":"bottom",Mi={main:function(){return"translate("+Jf.left+","+Jf.top+")"},context:function(){return"translate("+Kf.left+","+Kf.top+")"},legend:function(){return"translate("+Lf.left+","+Lf.top+")"},x:function(){return"translate(0,"+(Yg?0:Of)+")"},y:function(){return"translate(0,"+(Yg?Of:0)+")"},y2:function(){return"translate("+(Yg?0:Mf)+","+(Yg?1:0)+")"},subx:function(){return"translate(0,"+(Yg?0:Pf)+")"},arc:function(){return"translate("+Mf/2+","+Of/2+")"}},Ni="right"===Tg,Oi=0,Pi=0,Qi=0,Ri=.15,Si=30,Ti=Yg&&!Zg?0:30,Ui=5;Yf=tf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Vi,Wi=function(){var a=tf.svg.line().x(Yg?function(a){return V(a.id)(a.value)}:zd).y(Yg?zd:function(a){return V(a.id)(a.value)});return Th||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Th?De(b.values):b.values;return ce(b)?(a.interpolate(de(b)?"cardinal":"linear"),Bg[b.id]?Pe(e,fg,V(b.id),Bg[b.id]):a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Xi=function(){var a;return a=Yg?tf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(zd):tf.svg.area().x(zd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=De(b.values);return Yd([b],"area")||Yd([b],"area-spline")?(a.interpolate(de(b)?"cardinal":"linear"),a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Yi=function(){var a=tf.svg.line().x(Yg?function(a){return W(a.id)(a.value)}:Cd).y(Yg?Cd:function(a){return W(a.id)(a.value)});return function(b){var c=De(b.values);return ce(b)?a(c):"M "+ig(c[0].x)+" "+W(b.id)(c[0].value)}}(),Zi=function(){};Vi=tf.svg.brush().on("brush",Ye),Vi.update=function(){return bj&&bj.select("."+f.brush).call(this),this},Vi.scale=function(a){return Yg?this.y(a):this.x(a)},Bf&&(Zi=tf.behavior.zoom().on("zoomstart",function(){Zi.altDomain=tf.event.sourceEvent.altKey?fg.orgDomain():null}).on("zoom",Bf?Ze:null),Zi.scale=function(a){return Yg?this.y(a):this.x(a)},Zi.orgScaleExtent=function(){var a=Cf?Cf:[1,10];return[a[0],Math.max(Ac()/a[1],a[1])]},Zi.updateScaleExtent=function(){var a=bc(fg.orgDomain())/bc(fj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var $i,_i,aj,bj,cj,dj,ej,fj,gj,hj={};if(uf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),uf.defocus(),b(d.classed(f.focused,!0)),b(e),be(uf.data.targets)&&Nb(a,!0),jf(a)},uf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),kf(a)},uf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),lf()},uf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),$i.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?mf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},uf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),$i.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?nf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Ri),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},uf.toggle=function(a){Gc(a)?uf.hide(a):uf.show(a)},uf.unzoom=function(){Vi.clear().update(),Xe({withUpdateXDomain:!0})},uf.load=function(a){return a.xs&&oc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){ug[b]=a.classes[b]}),"categories"in a&&wi&&(ah=a.categories,lg.categories(ah)),"cacheIds"in a&&cc(a.cacheIds)?void cf(ec(a.cacheIds),a.done):void("unload"in a?ef(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){df(a)}):df(a))},uf.unload=function(a){ef(Dc(a),function(){Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},uf.selected=function(a){return tf.merge(aj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return tf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},uf.select=function(a,b,c){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=tf.select(this),i="circle"===this.nodeName?xe:Ae,j="circle"===this.nodeName?ye:Be,k=Fg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Gg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},uf.unselect=function(a,b){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=tf.select(this),g="circle"===this.nodeName?ye:Be,h=Fg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Gg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},uf.toLine=function(a){sf(a,"line")},uf.toSpline=function(a){sf(a,"spline")},uf.toBar=function(a){sf(a,"bar")},uf.toScatter=function(a){sf(a,"scatter")},uf.toArea=function(a){sf(a,"area")},uf.toAreaSpline=function(a){sf(a,"area-spline")},uf.toPie=function(a){sf(a,"pie",{withTransform:!0})},uf.toDonut=function(a){sf(a,"donut",{withTransform:!0})},uf.groups=function(a){return c(a)?vg:(vg=a,Xe(),vg)},uf.xgrids=function(a){return a?(Jh=a,Xe(),Jh):Jh},uf.xgrids.add=function(a){return a?uf.xgrids(Jh.concat(a)):void 0},uf.xgrids.remove=function(a){var b=rf(a);return uf.xgrids(Jh.filter(b))},uf.ygrids=function(a){return a?(Lh=a,Xe(),Lh):Lh},uf.ygrids.add=function(a){return a?uf.ygrids(Lh.concat(a)):void 0},uf.ygrids.remove=function(a){var b=rf(a); return uf.ygrids(Lh.filter(b))},uf.regions=function(a){return c(a)?hi:(hi=a,Xe(),hi)},uf.regions.add=function(a){return c(a)?hi:(hi=hi.concat(a),Xe(),hi)},uf.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;$i.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),hi=hi.filter(function(b){return b.classes.indexOf(a)<0})}),hi},uf.data.get=function(a){var b=uf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},uf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},uf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){tg[b]=a[b]}),of(Cc(uf.data.targets),{withTransition:!0}),tg):tg},uf.x=function(a){return arguments.length&&(rc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.xs=function(a){return arguments.length&&(sc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},uf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(qh=+a.y),b(a.y2)&&(zh=+a.y2)):qh=zh=+a,Xe())},uf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(rh=+a.y),b(a.y2)&&(Ah=+a.y2)):rh=Ah=+a,Xe())},uf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&uf.axis.max(a.max),"undefined"!=typeof a.min&&uf.axis.min(a.min))},uf.legend.show=function(a){Sg||(Sg=!0,cj.style("visibility","visible")),mf(Dc(a)),Xe({withTransitionForHorizontalAxis:!1})},uf.legend.hide=function(a){Sg&&se(a)&&(Sg=!1,cj.style("visibility","hidden")),nf(Dc(a)),Xe({withTransitionForHorizontalAxis:!1})},uf.resize=function(a){xf=a?a.width:null,yf=a?a.height:null,af({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},uf.destroy=function(){uf.data.targets=void 0,uf.data.xs={},ej.html(""),a.onresize=null},"url"in e.data)tf.xhr(e.data.url,function(a,b){var c,d=tf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=tf.csv.parse(b.response),Qe(c)});else if("rows"in e.data)Qe(uc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Qe(vc(e.data.columns))}return uf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From c396d32132540f03472f7845e52c6ee994875812 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 23 Apr 2014 20:59:16 +0900 Subject: [PATCH 058/178] Fix axis.x.height --- c3.js | 2 +- c3.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/c3.js b/c3.js index fa24e71..1102316 100644 --- a/c3.js +++ b/c3.js @@ -528,7 +528,7 @@ return forHorizontal ? width + 2 + 4 : margin.left + 20; } function getAxisClipHeight(forHorizontal) { - return forHorizontal ? 80 : height + 2; + return forHorizontal ? (__axis_x_height ? __axis_x_height : 0) + 40 : height + 2; } function getXAxisClipWidth() { return getAxisClipWidth(!__axis_rotated); diff --git a/c3.min.js b/c3.min.js index 35ce508..ab14774 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.31"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cMf&&(Mf=0),0>Of&&(Of=0),Nf=Yg?Jf.left-Si-Ti:Mf,Pf=Yg?Of:Rf-Kf.top-Kf.bottom,0>Nf&&(Nf=0),0>Pf&&(Pf=0),p(),Ni&&be(uf.data.targets)&&(Lf.left=Mf/2+Tf)}function o(){aj.select("line."+f.xgridFocus).attr("x1",Yg?0:-10).attr("x2",Yg?Mf:-10).attr("y1",Yg?-10:Jf.top).attr("y2",Yg?-10:Of)}function p(){Tf=Of/2,Sf=.95*Tf,Uf=ae(uf.data.targets)?.6*Sf:0}function q(){var a=Yg?f.axisX:f.axisY,b=tf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=tf.select(wf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return xf?xf:x()}function s(){var a=yf?yf:y();return a>0?a:320}function t(){return be(uf.data.targets)?0:zf?zf:Yg||!ph||uh?1:v("y")}function u(){var a=1;return be(uf.data.targets)?0:Af?Af:Ni?P()+(yh&&!Yg?v("y2"):a):yh?Dh||Yg?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||Zg?"x"===a&&mh?mh:"y"!==a||ph?"y2"!==a||yh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Ui:Sg&&!Ni?10:1:0}function x(){return+tf.select(wf).style("width").replace("px","")}function y(){return+tf.select(wf).style("height").replace("px","")}function z(a){return a?-5:-(Jf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Yg)}function C(){return A(!Yg)}function D(){return z(Yg)}function E(){return A(Yg)}function F(a){return a?Mf+2+4:Jf.left+20}function G(a){return a?80:Of+2}function H(){return F(!Yg)}function I(){return G(!Yg)}function J(){return F(Yg)}function K(){return G(Yg)}function L(){var a=Yg?Of:Mf,b=Ac(),c=Yb()*(Zd(uf.data.targets)?(b-(wi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){Oi=a}function N(a){Pi=a}function O(a){Qi=a}function P(){return Sg?Ni?Pi*(Oi+1):Qf:0}function Q(){return Sg?Ni?Rf:Qi*(Oi+1):0}function R(){var a,b=!fg;Zf=Yg?1:0,$f=Yg?Of:Mf,_f=Yg?0:Of,ag=Yg?Mf:1,bg=Zf,cg=$f,dg=Yg?0:Pf,eg=Yg?Nf:1,fg=T(Zf,$f,b?void 0:fg.domain(),function(){return lg.tickOffset()}),gg=U(_f,ag),hg=U(_f,ag),ig=T(Zf,$f,fj,function(a){return a%1?0:og.tickOffset()}),jg=U(dg,eg),kg=U(dg,eg),a=$(),lg=X(fg,Ii,a),og=X(ig,Li,a),mg=Y(gg,Ji,vh,xh),ng=Y(hg,Ki,Eh,Gh),b||(Vi.scale(ig),Bf&&Zi.scale(fg)),S()}function S(){Vf=Gb(),Wf=Hb(),Xf=Hb(.98)}function T(a,b,e,f){var g=(vi?tf.time.scale():tf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),wi){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return tf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?hg:gg}function W(a){return"y2"===Z(a)?kg:jg}function X(a,b,c){var d=(wi?Eb():tf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),wi?(d.tickCentered(bh),se(dh)&&(dh=!1)):d.tickOffset=function(){var a=Yg?Of:Mf;return a*Yb()/Ac()/2},wi&&d.categories(ah),d}function Y(a,b,c,d){return tf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in wg?wg[a]:"y"}function $(){var a=vi?Fi:wi?Tc:function(a){return 0>a?a.toFixed(0):a};return ch&&("function"==typeof ch?a=ch:vi&&(a=function(a){return a?Ei(ch)(a):""})),a}function _(a){var b;return"y"===a?b=th:"y2"===a?b=Ch:"x"===a&&(b=oh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?th=b:"y2"===a?Ch=b:"x"===a&&(oh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a){a.selectAll(".tick text").attr("y",db(ih)).attr("x",cb(ih)).attr("transform","rotate("+ih+")").style("text-anchor","start")}function fb(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 gb(){return fb("x",Yg?"inner-top":"inner-right")}function hb(){return fb("y",Yg?"inner-right":"inner-top")}function ib(){return fb("y2",Yg?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Mf/2:Mf:b.isBottom?-Of:b.isMiddle?-Of/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!Yg,gb())}function rb(){return nb(Yg,hb())}function sb(){return nb(Yg,ib())}function tb(){return ob(!Yg,gb())}function ub(){return ob(Yg,hb())}function vb(){return ob(Yg,ib())}function wb(){var a=gb();return Yg?a.isInner?"1.2em":-30-Cb("x"):a.isInner?"-0.5em":"3em"}function xb(){var a=hb();return Yg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return Yg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!Yg,gb())}function Ab(){return pb(Yg,hb())}function Bb(){return pb(Yg,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return tf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Db(){aj.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).text(kb),aj.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dy",xb).text(lb),aj.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dy",yb).text(mb)}function Eb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+o)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Rc(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 tf.min(Object.keys(i).map(function(a){return tf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(vg.length>0)for(g=Sc(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 tf.max(Object.keys(i).map(function(a){return tf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Ah:rh,n="y2"===c?zh:qh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Bh:sh,r=ud()&&Yg;return 0===l.length?"y2"===c?hg.domain():gg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=bc(gg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&wh&&(f=b(wh.top)?wh.top:e,g=b(wh.bottom)?wh.bottom:e),"y2"===c&&Fh&&(f=b(Fh.top)?Fh.top:e,g=b(Fh.bottom)?Fh.bottom:e),Zd(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){var b=bc(fj),c=bc(fg.domain());return a||0===c?1:b/c}function Zb(a){return kh?kh:tf.min(a,function(a){return tf.min(a.values,function(a){return a.x})})}function $b(a){return jh?jh:tf.max(a,function(a){return tf.max(a.values,function(a){return a.x})})}function _b(a,c){var d,e,f,g,h=c[0],i=c[1],j=Math.abs(h-i);return wi?e=0:Zd(a)?(d=Ac(),e=d>1?j/(d-1)/2:.5):e=.01*j,"object"==typeof lh&&te(lh)?(f=b(lh.left)?lh.left:e,g=b(lh.right)?lh.right:e):f=g="number"==typeof lh?lh:e,{left:f,right:g}}function ac(a){var b=[Zb(a),$b(a)],c=b[0],d=b[1],e=_b(a,b),f=0,g=0;return(c||0===c)&&(f=vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function bc(a){return a[1]-a[0]}function cc(a){for(var b=0;bb?0:b-c}function ic(a){var b,c=gc(a),d="y"===a.axis?gg:hg;return b="y"===a.axis||"y2"===a.axis?Yg?Of:"start"in a?d(a.start):Of:Yg?"end"in a?fg(vi?oe(a.end):a.end):Of:Of,c>b?0:b-c}function jc(a){return pg&&a===pg||te(qg)&&ue(qg,a)}function kc(a){return!jc(a)}function lc(a){return pg?pg:te(qg)?qg[a]:null}function mc(a,b){var c,d=b&&te(b)?Cc(b):[];return d.forEach(function(b){lc(b)===a&&(c=uf.data.xs[b])}),c}function nc(a,b){return a in uf.data.xs&&uf.data.xs[a]&&uf.data.xs[a][b]?uf.data.xs[a][b]:b}function oc(a){Object.keys(a).forEach(function(b){qg[b]=a[b]})}function pc(a){return 1===tf.set(Object.keys(a).map(function(b){return a[b]})).size()}function qc(a){var b;return a&&(b=tg[a.id],a.name=b?b:a.id),a}function rc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=tc(b[d],a.id,d)}),uf.data.xs[a.id]=b})}function sc(a,b){a.forEach(function(a){b[a.id]&&rc([a],b[a.id])})}function tc(a,b,c){var d;return d=vi?a?a instanceof Date?a:oe(a):oe(nc(b,c)):xi&&!wi?a?+a:nc(b,c):c}function uc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?uf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):pg?(d=Object.keys(uf.data.xs),uf.data.xs[c]=d.length>0?uf.data.xs[d[0]]:void 0):te(qg)&&(uf.data.xs[c]=mc(f,uf.data.targets)):uf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!uf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=sg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=lc(b),g=a[f],h=tc(g,b,e);return xi&&wi&&0===c&&g&&(0===e&&(ah=[]),ah.push(g)),("undefined"==typeof a[b]||uf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),xg&&Xd(Cc(c).filter(function(a){return!(a in yg)}),xg),c.forEach(function(a){dc(a.id_org,a)}),c}function xc(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 yc(a){return a>0&&uf.data.targets[0].values[a-1]?uf.data.targets[0].values[a-1].x:void 0}function zc(a){return a1?uf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?uf.data.targets[0]:null,a}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(uf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(vi?new Date(h):h);i.push(d)}return vi||(i=i.sort(function(a,b){return a-b})),i}function Lc(a){Gi=Gi.concat(a)}function Mc(a){Gi=Gi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Hi=Hi.concat(a)}function Oc(a){Hi=Hi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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(Dd(a,f))),a[g].x&&(e=e.concat(Dd(a,g))),Gd(e,b)):Ed(a,b,f,g)}function Fd(a,b){var c;return c=a.map(function(a){return Ed(a.values,b)}),Gd(c,b)}function Gd(a,b){var c,d;return a.forEach(function(a){var e=ve(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Hd(a,b){return tf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Id(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 Jd(){return Ag&&"desc"===Ag.toLowerCase()}function Kd(){return Ag&&"asc"===Ag.toLowerCase()}function Ld(a){var b=Kd(),c=Jd();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 Ag&&a.sort(Ag),a}function Md(a,c){var d,e,f,g,h,i,j,k=be(uf.data.targets),l=k?xd:wd,m=a.filter(function(a){return a&&b(a.value)});ii&&0!==m.length&&(dj.html(li(a,$(),l,Di)).style("display","block"),d=dj.property("offsetWidth"),e=dj.property("offsetHeight"),k?(g=Mf/2+c[0],i=Of/2+c[1]+20):(Yg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=fg(m[0].x)+20):(f=q(),g=f+t()+fg(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),dj.style("top",i+"px").style("left",g+"px"))}function Nd(){dj.style("display","none")}function Od(a){var c=a.filter(function(a){return a&&b(a.value)});ii&&($d(uf.data.targets)||be(uf.data.targets)||aj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Yg?"y1":"x1",zd).attr(Yg?"y2":"x2",zd))}function Pd(){aj.select("line."+f.xgridFocus).style("visibility","hidden")}function Qd(a){return a.x||0===a.x?fg(a.x):null}function Rd(a){return V(a.id)(a.value)}function Sd(){var a,b,d={},e=0;return Ic(Fc(ee)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Wd(a,b){return Uh?Uh:b?2*a.tickOffset()*Vh/b:0}function Xd(a,b){Dc(a).forEach(function(a){hj[a]=b===yg[a],yg[a]=b})}function Yd(a,b){var c=!1;return a.forEach(function(a){yg[a.id]===b&&(c=!0),a.id in yg||"line"!==b||(c=!0)}),c}function Zd(a){return Yd(a,"bar")}function $d(a){return Yd(a,"scatter")}function _d(a){return Yd(a,"pie")}function ae(a){return Yd(a,"donut")}function be(a){return _d(a)||ae(a)}function ce(a){var b="string"==typeof a?a:a.id;return!(b in yg)||"line"===yg[b]||"spline"===yg[b]||"area"===yg[b]||"area-spline"===yg[b]}function de(a){var b="string"==typeof a?a:a.id;return"spline"===yg[b]||"area-spline"===yg[b]}function ee(a){var b="string"==typeof a?a:a.id;return"bar"===yg[b]}function fe(a){var b="string"==typeof a?a:a.id;return"scatter"===yg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"pie"===yg[b]}function he(a){var b="string"==typeof a?a:a.id;return"donut"===yg[b]}function ie(a){return ge(a)||he(a)}function je(a){return ee(a)?a.values:[]}function ke(a){return ce(a)||fe(a)?a.values:[]}function le(a){return ee(a)||ce(a)?a.values:[]}function me(a){return he(a)&&ci||ge(a)&&Yh}function ne(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function oe(b){var c;try{c=rg?tf.time.format(rg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+rg)}return c}function pe(a,b){var c=tf.mouse(a),d=tf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function ue(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ve(a,b){var c="y"===Z(a.id)?gg:hg,d=Yg?1:0,e=Yg?0:1;return Math.pow(fg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function we(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function xe(a,b,c){Lg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd).attr("stroke",function(){return Di(b)}).attr("r",1.4*Sh).transition().duration(100).attr("r",Sh)}function ye(a,b,c){Mg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ze(a,b,c,d){a?xe(b,c,d):ye(b,c,d)}function Ae(a,b){Lg(b,a.node()),a.transition().duration(100).style("fill",function(){return tf.rgb(Di(b)).darker(1)})}function Be(a,b){Mg(b,a.node()),a.transition().duration(100).style("fill",function(){return Di(b)})}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a){return a.filter(function(a){return b(a.value)})}function Ee(a,c){return(c?aj.selectAll("."+f.circles+ld(c)):aj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Fe(a,b){Ee(a,b).classed(f.EXPANDED,!0).attr("r",Rh)}function Ge(a){Ee(a).filter(function(){return tf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oh)}function He(a){return aj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ie(a){He(a).classed(f.EXPANDED,!0)}function Je(a){He(a).classed(f.EXPANDED,!1)}function Ke(a,b){var c=Oe(a,b);return function(a,b){var d=c(a,b),e=Yg?1:0,f=Yg?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 Le(a,b){var c=Oe(a,!1),d=b?Me:Ne;return function(a,b){return d(c(a,b),a,this)}}function Me(a,b){var c;return Yg?(c=ee(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ne(a,b,c){var d=c.getBoundingClientRect();return Yg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ee(b)?-3:-6)}function Oe(a,b){var c=a.__max__+1,d=Wd(lg,c),e=Td(d,c,a,!!b),f=Ud(!!b),g=Vd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Yg&&(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 Pe(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 Qe(b){var c,d,e;if(ej=tf.select(wf),ej.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ej.html(""),ej.classed("c3",!0),uf.data.xs={},uf.data.targets=wc(b),n(),R(),fg.domain(tf.extent(ac(uf.data.targets))),gg.domain(Xb(uf.data.targets,"y")),hg.domain(Xb(uf.data.targets,"y2")),ig.domain(fg.domain()),jg.domain(gg.domain()),kg.domain(hg.domain()),fj=fg.domain(),Vi.scale(ig),Bf&&Zi.scale(fg),$i=ej.append("svg").attr("width",Mf+Jf.left+Jf.right).attr("height",Of+Jf.top+Jf.bottom).on("mouseenter",Ef).on("mouseleave",Ff),_i=$i.append("defs"),_i.append("clipPath").attr("id",pi).append("rect").attr("width",Mf).attr("height",Of),_i.append("clipPath").attr("id",qi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),_i.append("clipPath").attr("id",ri).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),aj=$i.append("g").attr("transform",Mi.main),bj=Pg?$i.append("g").attr("transform",Mi.context):null,cj=$i.append("g").attr("transform",Mi.legend),Sg||(cj.style("visibility","hidden"),Hi=Cc(uf.data.targets)),dj=tf.select(wf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),of(Cc(uf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Zg&&aj.append("g").attr("class",f.axisX).attr("clip-path",ti).attr("transform",Mi.x).append("text").attr("class",f.axisXLabel).attr("transform",Yg?"rotate(-90)":"").attr("dx",tb).attr("dy",wb).style("text-anchor",zb),ph&&aj.append("g").attr("class",f.axisY).attr("clip-path",ui).attr("transform",Mi.y).append("text").attr("class",f.axisYLabel).attr("transform",Yg?"":"rotate(-90)").attr("dx",ub).attr("dy",xb).style("text-anchor",Ab),yh&&aj.append("g").attr("class",f.axisY2).attr("transform",Mi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Yg?"":"rotate(-90)").attr("dx",vb).style("text-anchor",Bb),d=aj.append("g").attr("clip-path",si).attr("class",f.grid),Hh&&d.append("g").attr("class",f.xgrids),te(Jh)&&d.append("g").attr("class",f.xgridLines),Ph&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Kh&&d.append("g").attr("class",f.ygrids),te(Lh)&&d.append("g").attr("class",f.ygridLines),aj.append("g").attr("clip-path",si).attr("class",f.regions),aj.append("g").attr("clip-path",si).attr("class",f.chart),c=aj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Bf?Yg?"ns-resize":"ew-resize":null),aj.select("."+f.chart).append("g").attr("class",f.chartBars),aj.select("."+f.chart).append("g").attr("class",f.chartLines),aj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Mi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),aj.select("."+f.chart).append("g").attr("class",f.chartTexts),Bf&&aj.insert("rect",Df?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Mf).attr("height",Of).style("opacity",0).style("cursor",Yg?"ns-resize":"ew-resize").call(Zi).on("dblclick.zoom",null),nh&&Vi.extent("function"!=typeof nh?nh:nh(ac())),Pg&&(bj.append("g").attr("clip-path",si).attr("class",f.chart),bj.select("."+f.chart).append("g").attr("class",f.chartBars),bj.select("."+f.chart).append("g").attr("class",f.chartLines),bj.append("g").attr("clip-path",si).attr("class",f.brush).call(Vi).selectAll("rect").attr(Yg?"width":"height",Yg?Nf:Pf),bj.append("g").attr("class",f.axisX).attr("transform",Mi.subx).attr("clip-path",Yg?"":ti)),bf(uf.data.targets),Yg?aj.select("."+f.axisX).style("opacity",0).call(lg):(aj.select("."+f.axisY).style("opacity",0).call(mg),aj.select("."+f.axisY2).style("opacity",0).call(ng)),Xe({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),mi){if(vi&&"string"==typeof ni){for(ni=oe(ni),e=0;eMf&&(Mf=0),0>Of&&(Of=0),Nf=Yg?Jf.left-Si-Ti:Mf,Pf=Yg?Of:Rf-Kf.top-Kf.bottom,0>Nf&&(Nf=0),0>Pf&&(Pf=0),p(),Ni&&be(uf.data.targets)&&(Lf.left=Mf/2+Tf)}function o(){aj.select("line."+f.xgridFocus).attr("x1",Yg?0:-10).attr("x2",Yg?Mf:-10).attr("y1",Yg?-10:Jf.top).attr("y2",Yg?-10:Of)}function p(){Tf=Of/2,Sf=.95*Tf,Uf=ae(uf.data.targets)?.6*Sf:0}function q(){var a=Yg?f.axisX:f.axisY,b=tf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=tf.select(wf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return xf?xf:x()}function s(){var a=yf?yf:y();return a>0?a:320}function t(){return be(uf.data.targets)?0:zf?zf:Yg||!ph||uh?1:v("y")}function u(){var a=1;return be(uf.data.targets)?0:Af?Af:Ni?P()+(yh&&!Yg?v("y2"):a):yh?Dh||Yg?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||Zg?"x"===a&&mh?mh:"y"!==a||ph?"y2"!==a||yh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Ui:Sg&&!Ni?10:1:0}function x(){return+tf.select(wf).style("width").replace("px","")}function y(){return+tf.select(wf).style("height").replace("px","")}function z(a){return a?-5:-(Jf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Yg)}function C(){return A(!Yg)}function D(){return z(Yg)}function E(){return A(Yg)}function F(a){return a?Mf+2+4:Jf.left+20}function G(a){return a?(mh?mh:0)+40:Of+2}function H(){return F(!Yg)}function I(){return G(!Yg)}function J(){return F(Yg)}function K(){return G(Yg)}function L(){var a=Yg?Of:Mf,b=Ac(),c=Yb()*(Zd(uf.data.targets)?(b-(wi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){Oi=a}function N(a){Pi=a}function O(a){Qi=a}function P(){return Sg?Ni?Pi*(Oi+1):Qf:0}function Q(){return Sg?Ni?Rf:Qi*(Oi+1):0}function R(){var a,b=!fg;Zf=Yg?1:0,$f=Yg?Of:Mf,_f=Yg?0:Of,ag=Yg?Mf:1,bg=Zf,cg=$f,dg=Yg?0:Pf,eg=Yg?Nf:1,fg=T(Zf,$f,b?void 0:fg.domain(),function(){return lg.tickOffset()}),gg=U(_f,ag),hg=U(_f,ag),ig=T(Zf,$f,fj,function(a){return a%1?0:og.tickOffset()}),jg=U(dg,eg),kg=U(dg,eg),a=$(),lg=X(fg,Ii,a),og=X(ig,Li,a),mg=Y(gg,Ji,vh,xh),ng=Y(hg,Ki,Eh,Gh),b||(Vi.scale(ig),Bf&&Zi.scale(fg)),S()}function S(){Vf=Gb(),Wf=Hb(),Xf=Hb(.98)}function T(a,b,e,f){var g=(vi?tf.time.scale():tf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),wi){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return tf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?hg:gg}function W(a){return"y2"===Z(a)?kg:jg}function X(a,b,c){var d=(wi?Eb():tf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),wi?(d.tickCentered(bh),se(dh)&&(dh=!1)):d.tickOffset=function(){var a=Yg?Of:Mf;return a*Yb()/Ac()/2},wi&&d.categories(ah),d}function Y(a,b,c,d){return tf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in wg?wg[a]:"y"}function $(){var a=vi?Fi:wi?Tc:function(a){return 0>a?a.toFixed(0):a};return ch&&("function"==typeof ch?a=ch:vi&&(a=function(a){return a?Ei(ch)(a):""})),a}function _(a){var b;return"y"===a?b=th:"y2"===a?b=Ch:"x"===a&&(b=oh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?th=b:"y2"===a?Ch=b:"x"===a&&(oh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a){a.selectAll(".tick text").attr("y",db(ih)).attr("x",cb(ih)).attr("transform","rotate("+ih+")").style("text-anchor","start")}function fb(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 gb(){return fb("x",Yg?"inner-top":"inner-right")}function hb(){return fb("y",Yg?"inner-right":"inner-top")}function ib(){return fb("y2",Yg?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Mf/2:Mf:b.isBottom?-Of:b.isMiddle?-Of/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!Yg,gb())}function rb(){return nb(Yg,hb())}function sb(){return nb(Yg,ib())}function tb(){return ob(!Yg,gb())}function ub(){return ob(Yg,hb())}function vb(){return ob(Yg,ib())}function wb(){var a=gb();return Yg?a.isInner?"1.2em":-30-Cb("x"):a.isInner?"-0.5em":"3em"}function xb(){var a=hb();return Yg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return Yg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!Yg,gb())}function Ab(){return pb(Yg,hb())}function Bb(){return pb(Yg,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return tf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Db(){aj.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).text(kb),aj.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dy",xb).text(lb),aj.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dy",yb).text(mb)}function Eb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+o)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Rc(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 tf.min(Object.keys(i).map(function(a){return tf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(vg.length>0)for(g=Sc(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 tf.max(Object.keys(i).map(function(a){return tf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Ah:rh,n="y2"===c?zh:qh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Bh:sh,r=ud()&&Yg;return 0===l.length?"y2"===c?hg.domain():gg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=bc(gg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&wh&&(f=b(wh.top)?wh.top:e,g=b(wh.bottom)?wh.bottom:e),"y2"===c&&Fh&&(f=b(Fh.top)?Fh.top:e,g=b(Fh.bottom)?Fh.bottom:e),Zd(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){var b=bc(fj),c=bc(fg.domain());return a||0===c?1:b/c}function Zb(a){return kh?kh:tf.min(a,function(a){return tf.min(a.values,function(a){return a.x})})}function $b(a){return jh?jh:tf.max(a,function(a){return tf.max(a.values,function(a){return a.x})})}function _b(a,c){var d,e,f,g,h=c[0],i=c[1],j=Math.abs(h-i);return wi?e=0:Zd(a)?(d=Ac(),e=d>1?j/(d-1)/2:.5):e=.01*j,"object"==typeof lh&&te(lh)?(f=b(lh.left)?lh.left:e,g=b(lh.right)?lh.right:e):f=g="number"==typeof lh?lh:e,{left:f,right:g}}function ac(a){var b=[Zb(a),$b(a)],c=b[0],d=b[1],e=_b(a,b),f=0,g=0;return(c||0===c)&&(f=vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function bc(a){return a[1]-a[0]}function cc(a){for(var b=0;bb?0:b-c}function ic(a){var b,c=gc(a),d="y"===a.axis?gg:hg;return b="y"===a.axis||"y2"===a.axis?Yg?Of:"start"in a?d(a.start):Of:Yg?"end"in a?fg(vi?oe(a.end):a.end):Of:Of,c>b?0:b-c}function jc(a){return pg&&a===pg||te(qg)&&ue(qg,a)}function kc(a){return!jc(a)}function lc(a){return pg?pg:te(qg)?qg[a]:null}function mc(a,b){var c,d=b&&te(b)?Cc(b):[];return d.forEach(function(b){lc(b)===a&&(c=uf.data.xs[b])}),c}function nc(a,b){return a in uf.data.xs&&uf.data.xs[a]&&uf.data.xs[a][b]?uf.data.xs[a][b]:b}function oc(a){Object.keys(a).forEach(function(b){qg[b]=a[b]})}function pc(a){return 1===tf.set(Object.keys(a).map(function(b){return a[b]})).size()}function qc(a){var b;return a&&(b=tg[a.id],a.name=b?b:a.id),a}function rc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=tc(b[d],a.id,d)}),uf.data.xs[a.id]=b})}function sc(a,b){a.forEach(function(a){b[a.id]&&rc([a],b[a.id])})}function tc(a,b,c){var d;return d=vi?a?a instanceof Date?a:oe(a):oe(nc(b,c)):xi&&!wi?a?+a:nc(b,c):c}function uc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?uf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):pg?(d=Object.keys(uf.data.xs),uf.data.xs[c]=d.length>0?uf.data.xs[d[0]]:void 0):te(qg)&&(uf.data.xs[c]=mc(f,uf.data.targets)):uf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!uf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=sg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=lc(b),g=a[f],h=tc(g,b,e);return xi&&wi&&0===c&&g&&(0===e&&(ah=[]),ah.push(g)),("undefined"==typeof a[b]||uf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),xg&&Xd(Cc(c).filter(function(a){return!(a in yg)}),xg),c.forEach(function(a){dc(a.id_org,a)}),c}function xc(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 yc(a){return a>0&&uf.data.targets[0].values[a-1]?uf.data.targets[0].values[a-1].x:void 0}function zc(a){return a1?uf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?uf.data.targets[0]:null,a}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(uf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(vi?new Date(h):h);i.push(d)}return vi||(i=i.sort(function(a,b){return a-b})),i}function Lc(a){Gi=Gi.concat(a)}function Mc(a){Gi=Gi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Hi=Hi.concat(a)}function Oc(a){Hi=Hi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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(Dd(a,f))),a[g].x&&(e=e.concat(Dd(a,g))),Gd(e,b)):Ed(a,b,f,g)}function Fd(a,b){var c;return c=a.map(function(a){return Ed(a.values,b)}),Gd(c,b)}function Gd(a,b){var c,d;return a.forEach(function(a){var e=ve(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Hd(a,b){return tf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Id(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 Jd(){return Ag&&"desc"===Ag.toLowerCase()}function Kd(){return Ag&&"asc"===Ag.toLowerCase()}function Ld(a){var b=Kd(),c=Jd();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 Ag&&a.sort(Ag),a}function Md(a,c){var d,e,f,g,h,i,j,k=be(uf.data.targets),l=k?xd:wd,m=a.filter(function(a){return a&&b(a.value)});ii&&0!==m.length&&(dj.html(li(a,$(),l,Di)).style("display","block"),d=dj.property("offsetWidth"),e=dj.property("offsetHeight"),k?(g=Mf/2+c[0],i=Of/2+c[1]+20):(Yg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=fg(m[0].x)+20):(f=q(),g=f+t()+fg(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),dj.style("top",i+"px").style("left",g+"px"))}function Nd(){dj.style("display","none")}function Od(a){var c=a.filter(function(a){return a&&b(a.value)});ii&&($d(uf.data.targets)||be(uf.data.targets)||aj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Yg?"y1":"x1",zd).attr(Yg?"y2":"x2",zd))}function Pd(){aj.select("line."+f.xgridFocus).style("visibility","hidden")}function Qd(a){return a.x||0===a.x?fg(a.x):null}function Rd(a){return V(a.id)(a.value)}function Sd(){var a,b,d={},e=0;return Ic(Fc(ee)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Wd(a,b){return Uh?Uh:b?2*a.tickOffset()*Vh/b:0}function Xd(a,b){Dc(a).forEach(function(a){hj[a]=b===yg[a],yg[a]=b})}function Yd(a,b){var c=!1;return a.forEach(function(a){yg[a.id]===b&&(c=!0),a.id in yg||"line"!==b||(c=!0)}),c}function Zd(a){return Yd(a,"bar")}function $d(a){return Yd(a,"scatter")}function _d(a){return Yd(a,"pie")}function ae(a){return Yd(a,"donut")}function be(a){return _d(a)||ae(a)}function ce(a){var b="string"==typeof a?a:a.id;return!(b in yg)||"line"===yg[b]||"spline"===yg[b]||"area"===yg[b]||"area-spline"===yg[b]}function de(a){var b="string"==typeof a?a:a.id;return"spline"===yg[b]||"area-spline"===yg[b]}function ee(a){var b="string"==typeof a?a:a.id;return"bar"===yg[b]}function fe(a){var b="string"==typeof a?a:a.id;return"scatter"===yg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"pie"===yg[b]}function he(a){var b="string"==typeof a?a:a.id;return"donut"===yg[b]}function ie(a){return ge(a)||he(a)}function je(a){return ee(a)?a.values:[]}function ke(a){return ce(a)||fe(a)?a.values:[]}function le(a){return ee(a)||ce(a)?a.values:[]}function me(a){return he(a)&&ci||ge(a)&&Yh}function ne(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function oe(b){var c;try{c=rg?tf.time.format(rg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+rg)}return c}function pe(a,b){var c=tf.mouse(a),d=tf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function ue(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ve(a,b){var c="y"===Z(a.id)?gg:hg,d=Yg?1:0,e=Yg?0:1;return Math.pow(fg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function we(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function xe(a,b,c){Lg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd).attr("stroke",function(){return Di(b)}).attr("r",1.4*Sh).transition().duration(100).attr("r",Sh)}function ye(a,b,c){Mg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ze(a,b,c,d){a?xe(b,c,d):ye(b,c,d)}function Ae(a,b){Lg(b,a.node()),a.transition().duration(100).style("fill",function(){return tf.rgb(Di(b)).darker(1)})}function Be(a,b){Mg(b,a.node()),a.transition().duration(100).style("fill",function(){return Di(b)})}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a){return a.filter(function(a){return b(a.value)})}function Ee(a,c){return(c?aj.selectAll("."+f.circles+ld(c)):aj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Fe(a,b){Ee(a,b).classed(f.EXPANDED,!0).attr("r",Rh)}function Ge(a){Ee(a).filter(function(){return tf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oh)}function He(a){return aj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ie(a){He(a).classed(f.EXPANDED,!0)}function Je(a){He(a).classed(f.EXPANDED,!1)}function Ke(a,b){var c=Oe(a,b);return function(a,b){var d=c(a,b),e=Yg?1:0,f=Yg?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 Le(a,b){var c=Oe(a,!1),d=b?Me:Ne;return function(a,b){return d(c(a,b),a,this)}}function Me(a,b){var c;return Yg?(c=ee(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ne(a,b,c){var d=c.getBoundingClientRect();return Yg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ee(b)?-3:-6)}function Oe(a,b){var c=a.__max__+1,d=Wd(lg,c),e=Td(d,c,a,!!b),f=Ud(!!b),g=Vd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Yg&&(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 Pe(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 Qe(b){var c,d,e;if(ej=tf.select(wf),ej.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ej.html(""),ej.classed("c3",!0),uf.data.xs={},uf.data.targets=wc(b),n(),R(),fg.domain(tf.extent(ac(uf.data.targets))),gg.domain(Xb(uf.data.targets,"y")),hg.domain(Xb(uf.data.targets,"y2")),ig.domain(fg.domain()),jg.domain(gg.domain()),kg.domain(hg.domain()),fj=fg.domain(),Vi.scale(ig),Bf&&Zi.scale(fg),$i=ej.append("svg").attr("width",Mf+Jf.left+Jf.right).attr("height",Of+Jf.top+Jf.bottom).on("mouseenter",Ef).on("mouseleave",Ff),_i=$i.append("defs"),_i.append("clipPath").attr("id",pi).append("rect").attr("width",Mf).attr("height",Of),_i.append("clipPath").attr("id",qi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),_i.append("clipPath").attr("id",ri).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),aj=$i.append("g").attr("transform",Mi.main),bj=Pg?$i.append("g").attr("transform",Mi.context):null,cj=$i.append("g").attr("transform",Mi.legend),Sg||(cj.style("visibility","hidden"),Hi=Cc(uf.data.targets)),dj=tf.select(wf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),of(Cc(uf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Zg&&aj.append("g").attr("class",f.axisX).attr("clip-path",ti).attr("transform",Mi.x).append("text").attr("class",f.axisXLabel).attr("transform",Yg?"rotate(-90)":"").attr("dx",tb).attr("dy",wb).style("text-anchor",zb),ph&&aj.append("g").attr("class",f.axisY).attr("clip-path",ui).attr("transform",Mi.y).append("text").attr("class",f.axisYLabel).attr("transform",Yg?"":"rotate(-90)").attr("dx",ub).attr("dy",xb).style("text-anchor",Ab),yh&&aj.append("g").attr("class",f.axisY2).attr("transform",Mi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Yg?"":"rotate(-90)").attr("dx",vb).style("text-anchor",Bb),d=aj.append("g").attr("clip-path",si).attr("class",f.grid),Hh&&d.append("g").attr("class",f.xgrids),te(Jh)&&d.append("g").attr("class",f.xgridLines),Ph&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Kh&&d.append("g").attr("class",f.ygrids),te(Lh)&&d.append("g").attr("class",f.ygridLines),aj.append("g").attr("clip-path",si).attr("class",f.regions),aj.append("g").attr("clip-path",si).attr("class",f.chart),c=aj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Bf?Yg?"ns-resize":"ew-resize":null),aj.select("."+f.chart).append("g").attr("class",f.chartBars),aj.select("."+f.chart).append("g").attr("class",f.chartLines),aj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Mi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),aj.select("."+f.chart).append("g").attr("class",f.chartTexts),Bf&&aj.insert("rect",Df?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Mf).attr("height",Of).style("opacity",0).style("cursor",Yg?"ns-resize":"ew-resize").call(Zi).on("dblclick.zoom",null),nh&&Vi.extent("function"!=typeof nh?nh:nh(ac())),Pg&&(bj.append("g").attr("clip-path",si).attr("class",f.chart),bj.select("."+f.chart).append("g").attr("class",f.chartBars),bj.select("."+f.chart).append("g").attr("class",f.chartLines),bj.append("g").attr("clip-path",si).attr("class",f.brush).call(Vi).selectAll("rect").attr(Yg?"width":"height",Yg?Nf:Pf),bj.append("g").attr("class",f.axisX).attr("transform",Mi.subx).attr("clip-path",Yg?"":ti)),bf(uf.data.targets),Yg?aj.select("."+f.axisX).style("opacity",0).call(lg):(aj.select("."+f.axisY).style("opacity",0).call(mg),aj.select("."+f.axisY2).style("opacity",0).call(ng)),Xe({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),mi){if(vi&&"string"==typeof ni){for(ni=oe(ni),e=0;e0){d=[];for(var g in tg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Id(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ce,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 Ve(a){be(uf.data.targets)||Eg&&(yi=a,aj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),zi=!0,Ng())}function We(){be(uf.data.targets)||Eg&&(aj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),aj.selectAll("."+f.shape).classed(f.INCLUDED,!1),zi=!1,Og())}function Xe(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U=Sd(),V=be(uf.data.targets),W=Ic(uf.data.targets);if(0!==W.length){if(a=d(a)?a:{},z=d(a.withY)?a.withY:!0,A=d(a.withSubchart)?a.withSubchart:!0,B=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,C=d(a.withTransitionForExit)?a.withTransitionForExit:B,D=d(a.withTransitionForAxis)?a.withTransitionForAxis:B,E=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:B,O=B?If:0,P=C?O:0,Q=D?O:0,I&&Sg&&of(Cc(uf.data.targets),a),H&&(fg.domain(tf.extent(ac(W))),fj=fg.domain(),Bf&&Zi.scale(fg).updateScaleExtent(),ig.domain(fg.domain()),Vi.scale(ig)),G&&(fg.domain(Vi.empty()?fj:Vi.extent()),Bf&&Zi.scale(fg).updateScaleExtent()),gg.domain(Xb(W,"y")),hg.domain(Xb(W,"y2")),(gh||fh)&&(R=hh?hh:Kc(Jc(W)),lg.tickValues(R),og.tickValues(R)),c=aj.select("."+f.axisX).style("opacity",V?0:1),(Yg||E)&&(c=c.transition().duration(Q)),c.call(lg),g=aj.select("."+f.axisY).style("opacity",V?0:1),(!Yg||E)&&(g=g.transition().duration(Q)),g.call(mg),aj.select("."+f.axisY2).style("opacity",V?0:1).transition().duration(Q).call(ng),G)if(dh&&R){for(S=1;S=0&&tf.select(this).style("display",b%T?"none":"block")})}else tf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!Yg&&ih&&eb(c),J=Ke(U),M=Le(U,!0),N=Le(U,!1),Db(),jg.domain(gg.domain()),kg.domain(hg.domain()),dj.style("display","none"),o(),aj.select("line."+f.xgridFocus).style("visibility","hidden"),Hh){if("year"===Ih){i=[];for(var X=ac(),Y=X[0].getFullYear(),Z=X[1].getFullYear(),$=Y;Z>=$;$++)i.push(new Date($+"-01-01 00:00:00"))}else i=fg.ticks(10);h=aj.select("."+f.xgrids).selectAll("."+f.xgrid).data(i),h.enter().append("line").attr("class",f.xgrid),h.attr("x1",Yg?0:function(a){return fg(a)-lg.tickOffset()}).attr("x2",Yg?Mf:function(a){return fg(a)-lg.tickOffset()}).attr("y1",Yg?function(a){return fg(a)-lg.tickOffset()}:Jf.top).attr("y2",Yg?function(a){return fg(a)-lg.tickOffset()}:Of).style("opacity",function(){return+tf.select(this).attr(Yg?"y1":"x1")===(Yg?Of:0)?0:1}),h.exit().remove()}te(Jh)&&(j=aj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Jh),k=j.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),k.append("line").style("opacity",0),k.append("text").attr("text-anchor","end").attr("transform",Yg?"":"rotate(-90)").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),j.select("line").transition().duration(O).attr("x1",Yg?0:Ad).attr("x2",Yg?Mf:Ad).attr("y1",Yg?Ad:Jf.top).attr("y2",Yg?Ad:Of).style("opacity",1),j.select("text").transition().duration(O).attr("x",Yg?Mf:0).attr("y",Ad).text(function(a){return a.text}).style("opacity",1),j.exit().transition().duration(O).style("opacity",0).remove()),z&&Kh&&(l=aj.select("."+f.ygrids).selectAll("."+f.ygrid).data(gg.ticks(Mh)),l.enter().append("line").attr("class",f.ygrid),l.attr("x1",Yg?gg:0).attr("x2",Yg?gg:Mf).attr("y1",Yg?0:gg).attr("y2",Yg?Of:gg),l.exit().remove()),z&&te(Lh)&&(m=aj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Lh),n=m.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),n.append("line").style("opacity",0),n.append("text").attr("text-anchor","end").attr("transform",Yg?"rotate(-90)":"").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),m.select("line").transition().duration(O).attr("x1",Yg?Bd:0).attr("x2",Yg?Bd:Mf).attr("y1",Yg?0:Bd).attr("y2",Yg?Of:Bd).style("opacity",1),m.select("text").transition().duration(O).attr("x",Yg?0:Mf).attr("y",Bd).text(function(a){return a.text}).style("opacity",1),m.exit().transition().duration(O).style("opacity",0).remove()),q=aj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),q.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Di(a)}).attr("class",ad),q.style("opacity",qd).transition().duration(O).attr("d",J).style("opacity",1),q.exit().transition().duration(P).style("opacity",0).remove(),s=aj.selectAll("."+f.texts).selectAll("."+f.text).data(le),s.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return Yg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),s.text(function(a){return yd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(O).attr("x",M).attr("y",N).style("fill-opacity",td),s.exit().transition().duration(P).style("fill-opacity",0).remove(),aj.selectAll("."+f.line).style("opacity",qd).transition().duration(O).attr("d",Wi).style("opacity",1),aj.selectAll("."+f.area).style("opacity",0).transition().duration(O).attr("d",Xi).style("opacity",gj),p=aj.selectAll("."+f.circles).selectAll("."+f.circle).data(ke),p.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Oh),p.style("opacity",qd).transition().duration(O).style("opacity",sd).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),p.exit().remove(),aj.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(O).attrTween("d",function(a){var b,c=Fb(a);return c?(b=tf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1),aj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(O).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&ie(a.data)?1:0}),aj.select("."+f.chartArcsTitle).style("opacity",ae(uf.data.targets)?1:0),Pg&&(null!==tf.event&&"zoom"===tf.event.type&&Vi.extent(fg.orgDomain()).update(),A&&(e=bj.select("."+f.axisX).style("opacity",V?0:1),(Yg||E)&&(e=e.transition().duration(Q)),e.call(og),!Yg&&ih&&eb(e),Vi.empty()||Vi.extent(fg.orgDomain()).update(),K=Ke(U,!0),t=bj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),t.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Di(a)}).attr("class",ad),t.style("opacity",qd).transition().duration(O).attr("d",K).style("opacity",1),t.exit().transition().duration(O).style("opacity",0).remove(),bj.selectAll("."+f.line).style("opacity",qd).transition().duration(O).attr("d",Yi).style("opacity",1))),aj.selectAll("."+f.selectedCircles).filter(function(a){return ee(a)}).selectAll("circle").remove(),aj.selectAll("."+f.selectedCircle).transition().duration(O).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),u=aj.select("."+f.eventRects),te(qg)&&!pc(qg)?(u.classed(f.eventRectsMultiple)||u.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),v=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Se(v.enter()),v.attr("x",0).attr("y",0).attr("width",Mf).attr("height",Of)):(u.classed(f.eventRectsSingle)||u.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),xi&&!wi?(y=function(a,b){var c=yc(b),d=zc(b),e=uf.data.xs[a.id][b];return(fg(d?d:e+50)-fg(c?c:e-50))/2},x=function(a,b){var c=yc(b),d=uf.data.xs[a.id][b];return(fg(d)+fg(c?c:d-50))/2}):(y=L(),x=function(a){return fg(a.x)-y/2}),w=Bc(),aj.select("."+f.eventRects).datum(w?w.values:[]),v=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Re(v.enter()),v.attr("class",fd).attr("x",Yg?0:x).attr("y",Yg?x:0).attr("width",Yg?Mf:y).attr("height",Yg?y:Of),v.exit().remove()),r=aj.select("."+f.regions).selectAll("rect."+f.region).data(hi),r.enter().append("rect").style("fill-opacity",0),r.attr("class",ed).attr("x",fc).attr("y",gc).attr("width",hc).attr("height",ic).transition().duration(O).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Cc(uf.data.targets).forEach(function(a){hj[a]=!0})}}function Ye(){Xe({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ze(){return"mousemove"===tf.event.sourceEvent.type&&Zi.altDomain?(fg.domain(Zi.altDomain),void Zi.scale(fg).updateScaleExtent()):(wi&&fg.orgDomain()[0]===fj[0]&&fg.domain([fj[0]-1e-10,fg.orgDomain()[1]]),Xe({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===tf.event.sourceEvent.type&&(Ai=!0)))}function $e(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function _e(){$i.attr("width",Qf).attr("height",Rf),$i.select("#"+pi).select("rect").attr("width",Mf).attr("height",Of),$i.select("#"+qi).select("rect").attr("width",H),$i.select("#"+ri).select("rect").attr("width",J),$i.select("."+f.zoomRect).attr("width",Mf).attr("height",Of)}function af(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),_e(),m(a.withTransition),Xe(a)}function bf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=aj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Di(a)}),e=aj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("fill",function(a){return Di(a)}).style("stroke","none").style("cursor",function(a){return Gg(a)?"pointer":null}),c=aj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)}),b.append("path").attr("class",dd).style("opacity",function(){return gj=+tf.select(this).style("opacity"),0}).style("fill",function(a){return Di(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Di(a)}).style("cursor",function(a){return Gg(a)?"pointer":null}),a.forEach(function(a){aj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=aj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Yf(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Di(a.data)}).style("cursor",function(a){return Gg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Fb(a),d=Lb(c),e=Tb();Nb(c.data.id),jf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Fb(a),c=[Lb(b)];Md(c,tf.mouse(this))}).on("mouseout",function(a,b){var c=Fb(a),d=Lb(c),e=Ub();Ob(c.data.id),lf(),Nd(),e(d,b)}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Pg&&(n=bj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Di(a)}),l=bj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)})),$i.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function cf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Xd(a.id,b.types[a.id]):Xd(a.id,b.type)}),uf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Ni?j:i,l=Ni?Q():P();return d&&(w=0,C=0,t=0,u=0),Sg&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Ni?u:t,void(Xg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,Ni?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=cj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Ug?Ug(a):uf.toggle(a)}).on("mouseover",function(a){uf.focus(a),"function"==typeof Vg&&Vg(a)}).on("mouseout",function(a){uf.revert(),"function"==typeof Wg&&Wg(a)}),l.append("text").text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",Ni?g:-200).attr("y",Ni?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ni?h:-200).attr("y",Ni?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Di(a)}).attr("x",Ni?g:-200).attr("y",Ni?-200:i).attr("width",10).attr("height",10),cj.selectAll("text").data(a).text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),cj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),cj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),_e(),q&&m(p)}function pf(a){return Ec(uf.data.targets,a.id)}function qf(a){return"data"in a&&Ec(uf.data.targets,a.data.id)}function rf(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 sf(a,b,c){var d=!be(uf.data.targets);Xd(a,b),af(c?c:{withTransitionForAxis:d})}var tf=a.d3?a.d3:a.require?a.require("d3"):void 0,uf={data:{},axis:{},legend:{}},vf={},wf=h(["bindto"],"#chart"),xf=h(["size","width"]),yf=h(["size","height"]),zf=h(["padding","left"]),Af=h(["padding","right"]),Bf=h(["zoom","enabled"],!1),Cf=h(["zoom","extent"]),Df=h(["zoom","privileged"],!1),Ef=h(["onenter"],function(){}),Ff=h(["onleave"],function(){}),Gf=h(["onresize"],function(){}),Hf=h(["onresized"],function(){}),If=h(["transition","duration"],350);g("data","data is required in config");var Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg=h(["data","x"]),qg=h(["data","xs"],{}),rg=h(["data","x_format"]),sg=h(["data","id_converter"],function(a){return a}),tg=h(["data","names"],{}),ug=h(["data","classes"],{}),vg=h(["data","groups"],[]),wg=h(["data","axes"],{}),xg=h(["data","type"]),yg=h(["data","types"],{}),zg=h(["data","labels"],{}),Ag=h(["data","order"]),Bg=h(["data","regions"],{}),Cg=h(["data","color"]),Dg=h(["data","colors"],{}),Eg=h(["data","selection","enabled"],!1),Fg=h(["data","selection","grouped"],!1),Gg=h(["data","selection","isselectable"],function(){return!0}),Hg=h(["data","selection","multiple"],!0),Ig=h(["data","onclick"],function(){}),Jg=h(["data","onenter"],function(){}),Kg=h(["data","onleave"],function(){}),Lg=h(["data","onselected"],function(){}),Mg=h(["data","onunselected"],function(){}),Ng=h(["data","ondragstart"],function(){}),Og=h(["data","ondragend"],function(){}),Pg=h(["subchart","show"],!1),Qg=h(["subchart","size","height"],60),Rg=h(["color","pattern"],[]),Sg=h(["legend","show"],!0),Tg=h(["legend","position"],"bottom"),Ug=h(["legend","item","onclick"]),Vg=h(["legend","item","onmouseover"]),Wg=h(["legend","item","onmouseout"]),Xg=h(["legend","equally"],!1),Yg=h(["axis","rotated"],!1),Zg=h(["axis","x","show"],!0),$g=h(["axis","x","type"],"indexed"),_g=h(["axis","x","localtime"],!0),ah=h(["axis","x","categories"],[]),bh=h(["axis","x","tick","centered"],!1),ch=h(["axis","x","tick","format"]),dh=h(["axis","x","tick","culling"],{}),eh=h(["axis","x","tick","culling","max"],10),fh=h(["axis","x","tick","count"]),gh=h(["axis","x","tick","fit"],!0),hh=h(["axis","x","tick","values"],null),ih=h(["axis","x","tick","rotate"]),jh=h(["axis","x","max"]),kh=h(["axis","x","min"]),lh=h(["axis","x","padding"],{}),mh=h(["axis","x","height"]),nh=h(["axis","x","default"]),oh=h(["axis","x","label"],{}),ph=h(["axis","y","show"],!0),qh=h(["axis","y","max"]),rh=h(["axis","y","min"]),sh=h(["axis","y","center"]),th=h(["axis","y","label"],{}),uh=h(["axis","y","inner"],!1),vh=h(["axis","y","tick","format"]),wh=h(["axis","y","padding"],{}),xh=h(["axis","y","ticks"],10),yh=h(["axis","y2","show"],!1),zh=h(["axis","y2","max"]),Ah=h(["axis","y2","min"]),Bh=h(["axis","y2","center"]),Ch=h(["axis","y2","label"],{}),Dh=h(["axis","y2","inner"],!1),Eh=h(["axis","y2","tick","format"]),Fh=h(["axis","y2","padding"],{}),Gh=h(["axis","y2","ticks"],10),Hh=h(["grid","x","show"],!1),Ih=h(["grid","x","type"],"tick"),Jh=h(["grid","x","lines"],[]),Kh=h(["grid","y","show"],!1),Lh=h(["grid","y","lines"],[]),Mh=h(["grid","y","ticks"],10),Nh=h(["point","show"],!0),Oh=Nh?h(["point","r"],2.5):0,Ph=h(["point","focus","line","enabled"],!0),Qh=h(["point","focus","expand","enabled"],!0),Rh=h(["point","focus","expand","r"],Qh?4:Oh),Sh=h(["point","focus","select","r"],8),Th=h(["line","connect_null"],!1),Uh=h(["bar","width"]),Vh=h(["bar","width","ratio"],.6),Wh=h(["pie","label","show"],!0),Xh=h(["pie","label","format"]),Yh=h(["pie","expand"],!0),Zh=h(["pie","onclick"],function(){}),$h=h(["pie","onmouseover"],function(){}),_h=h(["pie","onmouseout"],function(){}),ai=h(["donut","label","show"],!0),bi=h(["donut","label","format"]),ci=h(["donut","expand"],!0),di=h(["donut","title"],""),ei=h(["donut","onclick"],function(){}),fi=h(["donut","onmouseover"],function(){}),gi=h(["donut","onmouseout"],function(){}),hi=h(["regions"],[]),ii=h(["tooltip","show"],!0),ji=h(["tooltip","format","title"]),ki=h(["tooltip","format","value"]),li=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ji?ji:b,l=ki?ki: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+""}),mi=h(["tooltip","init","show"],!1),ni=h(["tooltip","init","x"],0),oi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),pi=("string"==typeof wf?wf.replace("#",""):wf.id)+"-clip",qi=pi+"-xaxis",ri=pi+"-yaxis",si=i(pi),ti=i(qi),ui=i(ri),vi="timeseries"===$g,wi="categorized"===$g,xi=!vi&&(pg||te(qg)),yi=null,zi=!1,Ai=!1,Bi=!1,Ci=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Di=ne(Dg,te(Rg)?Rg:Ci,Cg),Ei=_g?tf.time.format:tf.time.format.utc,Fi=function(){var a=[[Ei("%Y/%-m/%-d"),function(){return!0}],[Ei("%-m/%-d"),function(a){return a.getMonth()}],[Ei("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ei("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ei("%I %p"),function(a){return a.getHours()}],[Ei("%I:%M"),function(a){return a.getMinutes()}],[Ei(":%S"),function(a){return a.getSeconds()}],[Ei(".%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)}}(),Gi=[],Hi=[],Ii=Yg?"left":"bottom",Ji=Yg?uh?"top":"bottom":uh?"right":"left",Ki=Yg?Dh?"bottom":"top":Dh?"left":"right",Li=Yg?"left":"bottom",Mi={main:function(){return"translate("+Jf.left+","+Jf.top+")"},context:function(){return"translate("+Kf.left+","+Kf.top+")"},legend:function(){return"translate("+Lf.left+","+Lf.top+")"},x:function(){return"translate(0,"+(Yg?0:Of)+")"},y:function(){return"translate(0,"+(Yg?Of:0)+")"},y2:function(){return"translate("+(Yg?0:Mf)+","+(Yg?1:0)+")"},subx:function(){return"translate(0,"+(Yg?0:Pf)+")"},arc:function(){return"translate("+Mf/2+","+Of/2+")"}},Ni="right"===Tg,Oi=0,Pi=0,Qi=0,Ri=.15,Si=30,Ti=Yg&&!Zg?0:30,Ui=5;Yf=tf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Vi,Wi=function(){var a=tf.svg.line().x(Yg?function(a){return V(a.id)(a.value)}:zd).y(Yg?zd:function(a){return V(a.id)(a.value)});return Th||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Th?De(b.values):b.values;return ce(b)?(a.interpolate(de(b)?"cardinal":"linear"),Bg[b.id]?Pe(e,fg,V(b.id),Bg[b.id]):a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Xi=function(){var a;return a=Yg?tf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(zd):tf.svg.area().x(zd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=De(b.values);return Yd([b],"area")||Yd([b],"area-spline")?(a.interpolate(de(b)?"cardinal":"linear"),a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Yi=function(){var a=tf.svg.line().x(Yg?function(a){return W(a.id)(a.value)}:Cd).y(Yg?Cd:function(a){return W(a.id)(a.value)});return function(b){var c=De(b.values);return ce(b)?a(c):"M "+ig(c[0].x)+" "+W(b.id)(c[0].value)}}(),Zi=function(){};Vi=tf.svg.brush().on("brush",Ye),Vi.update=function(){return bj&&bj.select("."+f.brush).call(this),this},Vi.scale=function(a){return Yg?this.y(a):this.x(a)},Bf&&(Zi=tf.behavior.zoom().on("zoomstart",function(){Zi.altDomain=tf.event.sourceEvent.altKey?fg.orgDomain():null}).on("zoom",Bf?Ze:null),Zi.scale=function(a){return Yg?this.y(a):this.x(a)},Zi.orgScaleExtent=function(){var a=Cf?Cf:[1,10];return[a[0],Math.max(Ac()/a[1],a[1])]},Zi.updateScaleExtent=function(){var a=bc(fg.orgDomain())/bc(fj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var $i,_i,aj,bj,cj,dj,ej,fj,gj,hj={};if(uf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),uf.defocus(),b(d.classed(f.focused,!0)),b(e),be(uf.data.targets)&&Nb(a,!0),jf(a)},uf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),kf(a)},uf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),lf()},uf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),$i.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?mf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},uf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),$i.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?nf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Ri),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},uf.toggle=function(a){Gc(a)?uf.hide(a):uf.show(a)},uf.unzoom=function(){Vi.clear().update(),Xe({withUpdateXDomain:!0})},uf.load=function(a){return a.xs&&oc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){ug[b]=a.classes[b]}),"categories"in a&&wi&&(ah=a.categories,lg.categories(ah)),"cacheIds"in a&&cc(a.cacheIds)?void cf(ec(a.cacheIds),a.done):void("unload"in a?ef(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){df(a)}):df(a))},uf.unload=function(a){ef(Dc(a),function(){Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},uf.selected=function(a){return tf.merge(aj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return tf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},uf.select=function(a,b,c){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=tf.select(this),i="circle"===this.nodeName?xe:Ae,j="circle"===this.nodeName?ye:Be,k=Fg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Gg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},uf.unselect=function(a,b){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=tf.select(this),g="circle"===this.nodeName?ye:Be,h=Fg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Gg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},uf.toLine=function(a){sf(a,"line")},uf.toSpline=function(a){sf(a,"spline")},uf.toBar=function(a){sf(a,"bar")},uf.toScatter=function(a){sf(a,"scatter")},uf.toArea=function(a){sf(a,"area")},uf.toAreaSpline=function(a){sf(a,"area-spline")},uf.toPie=function(a){sf(a,"pie",{withTransform:!0})},uf.toDonut=function(a){sf(a,"donut",{withTransform:!0})},uf.groups=function(a){return c(a)?vg:(vg=a,Xe(),vg)},uf.xgrids=function(a){return a?(Jh=a,Xe(),Jh):Jh},uf.xgrids.add=function(a){return a?uf.xgrids(Jh.concat(a)):void 0},uf.xgrids.remove=function(a){var b=rf(a);return uf.xgrids(Jh.filter(b))},uf.ygrids=function(a){return a?(Lh=a,Xe(),Lh):Lh},uf.ygrids.add=function(a){return a?uf.ygrids(Lh.concat(a)):void 0},uf.ygrids.remove=function(a){var b=rf(a); return uf.ygrids(Lh.filter(b))},uf.regions=function(a){return c(a)?hi:(hi=a,Xe(),hi)},uf.regions.add=function(a){return c(a)?hi:(hi=hi.concat(a),Xe(),hi)},uf.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;$i.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),hi=hi.filter(function(b){return b.classes.indexOf(a)<0})}),hi},uf.data.get=function(a){var b=uf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},uf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},uf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){tg[b]=a[b]}),of(Cc(uf.data.targets),{withTransition:!0}),tg):tg},uf.x=function(a){return arguments.length&&(rc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.xs=function(a){return arguments.length&&(sc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},uf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(qh=+a.y),b(a.y2)&&(zh=+a.y2)):qh=zh=+a,Xe())},uf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(rh=+a.y),b(a.y2)&&(Ah=+a.y2)):rh=Ah=+a,Xe())},uf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&uf.axis.max(a.max),"undefined"!=typeof a.min&&uf.axis.min(a.min))},uf.legend.show=function(a){Sg||(Sg=!0,cj.style("visibility","visible")),mf(Dc(a)),Xe({withTransitionForHorizontalAxis:!1})},uf.legend.hide=function(a){Sg&&se(a)&&(Sg=!1,cj.style("visibility","hidden")),nf(Dc(a)),Xe({withTransitionForHorizontalAxis:!1})},uf.resize=function(a){xf=a?a.width:null,yf=a?a.height:null,af({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},uf.destroy=function(){uf.data.targets=void 0,uf.data.xs={},ej.html(""),a.onresize=null},"url"in e.data)tf.xhr(e.data.url,function(a,b){var c,d=tf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=tf.csv.parse(b.response),Qe(c)});else if("rows"in e.data)Qe(uc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Qe(vc(e.data.columns))}return uf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From f10e6c7aeb4bc4b65ffa8116e853141b29702dcc Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 23 Apr 2014 22:10:40 +0900 Subject: [PATCH 059/178] Update version to 0.1.32 --- bower.json | 2 +- c3.js | 2 +- c3.min.js | 2 +- package.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bower.json b/bower.json index 300dd59..b6a0675 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "c3", "main": "c3.min.js", - "version": "0.1.31", + "version": "0.1.32", "homepage": "https://github.com/masayuki0812/c3", "authors": [ "Masayuki Tanaka " diff --git a/c3.js b/c3.js index 1102316..9f57299 100644 --- a/c3.js +++ b/c3.js @@ -2,7 +2,7 @@ 'use strict'; var c3 = { - version: "0.1.31" + version: "0.1.32" }; var CLASS = { diff --git a/c3.min.js b/c3.min.js index ab14774..3fcc3eb 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.31"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cMf&&(Mf=0),0>Of&&(Of=0),Nf=Yg?Jf.left-Si-Ti:Mf,Pf=Yg?Of:Rf-Kf.top-Kf.bottom,0>Nf&&(Nf=0),0>Pf&&(Pf=0),p(),Ni&&be(uf.data.targets)&&(Lf.left=Mf/2+Tf)}function o(){aj.select("line."+f.xgridFocus).attr("x1",Yg?0:-10).attr("x2",Yg?Mf:-10).attr("y1",Yg?-10:Jf.top).attr("y2",Yg?-10:Of)}function p(){Tf=Of/2,Sf=.95*Tf,Uf=ae(uf.data.targets)?.6*Sf:0}function q(){var a=Yg?f.axisX:f.axisY,b=tf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=tf.select(wf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return xf?xf:x()}function s(){var a=yf?yf:y();return a>0?a:320}function t(){return be(uf.data.targets)?0:zf?zf:Yg||!ph||uh?1:v("y")}function u(){var a=1;return be(uf.data.targets)?0:Af?Af:Ni?P()+(yh&&!Yg?v("y2"):a):yh?Dh||Yg?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||Zg?"x"===a&&mh?mh:"y"!==a||ph?"y2"!==a||yh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Ui:Sg&&!Ni?10:1:0}function x(){return+tf.select(wf).style("width").replace("px","")}function y(){return+tf.select(wf).style("height").replace("px","")}function z(a){return a?-5:-(Jf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Yg)}function C(){return A(!Yg)}function D(){return z(Yg)}function E(){return A(Yg)}function F(a){return a?Mf+2+4:Jf.left+20}function G(a){return a?(mh?mh:0)+40:Of+2}function H(){return F(!Yg)}function I(){return G(!Yg)}function J(){return F(Yg)}function K(){return G(Yg)}function L(){var a=Yg?Of:Mf,b=Ac(),c=Yb()*(Zd(uf.data.targets)?(b-(wi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){Oi=a}function N(a){Pi=a}function O(a){Qi=a}function P(){return Sg?Ni?Pi*(Oi+1):Qf:0}function Q(){return Sg?Ni?Rf:Qi*(Oi+1):0}function R(){var a,b=!fg;Zf=Yg?1:0,$f=Yg?Of:Mf,_f=Yg?0:Of,ag=Yg?Mf:1,bg=Zf,cg=$f,dg=Yg?0:Pf,eg=Yg?Nf:1,fg=T(Zf,$f,b?void 0:fg.domain(),function(){return lg.tickOffset()}),gg=U(_f,ag),hg=U(_f,ag),ig=T(Zf,$f,fj,function(a){return a%1?0:og.tickOffset()}),jg=U(dg,eg),kg=U(dg,eg),a=$(),lg=X(fg,Ii,a),og=X(ig,Li,a),mg=Y(gg,Ji,vh,xh),ng=Y(hg,Ki,Eh,Gh),b||(Vi.scale(ig),Bf&&Zi.scale(fg)),S()}function S(){Vf=Gb(),Wf=Hb(),Xf=Hb(.98)}function T(a,b,e,f){var g=(vi?tf.time.scale():tf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),wi){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return tf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?hg:gg}function W(a){return"y2"===Z(a)?kg:jg}function X(a,b,c){var d=(wi?Eb():tf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),wi?(d.tickCentered(bh),se(dh)&&(dh=!1)):d.tickOffset=function(){var a=Yg?Of:Mf;return a*Yb()/Ac()/2},wi&&d.categories(ah),d}function Y(a,b,c,d){return tf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in wg?wg[a]:"y"}function $(){var a=vi?Fi:wi?Tc:function(a){return 0>a?a.toFixed(0):a};return ch&&("function"==typeof ch?a=ch:vi&&(a=function(a){return a?Ei(ch)(a):""})),a}function _(a){var b;return"y"===a?b=th:"y2"===a?b=Ch:"x"===a&&(b=oh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?th=b:"y2"===a?Ch=b:"x"===a&&(oh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a){a.selectAll(".tick text").attr("y",db(ih)).attr("x",cb(ih)).attr("transform","rotate("+ih+")").style("text-anchor","start")}function fb(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 gb(){return fb("x",Yg?"inner-top":"inner-right")}function hb(){return fb("y",Yg?"inner-right":"inner-top")}function ib(){return fb("y2",Yg?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Mf/2:Mf:b.isBottom?-Of:b.isMiddle?-Of/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!Yg,gb())}function rb(){return nb(Yg,hb())}function sb(){return nb(Yg,ib())}function tb(){return ob(!Yg,gb())}function ub(){return ob(Yg,hb())}function vb(){return ob(Yg,ib())}function wb(){var a=gb();return Yg?a.isInner?"1.2em":-30-Cb("x"):a.isInner?"-0.5em":"3em"}function xb(){var a=hb();return Yg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return Yg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!Yg,gb())}function Ab(){return pb(Yg,hb())}function Bb(){return pb(Yg,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return tf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Db(){aj.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).text(kb),aj.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dy",xb).text(lb),aj.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dy",yb).text(mb)}function Eb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+o)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Rc(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 tf.min(Object.keys(i).map(function(a){return tf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(vg.length>0)for(g=Sc(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 tf.max(Object.keys(i).map(function(a){return tf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Ah:rh,n="y2"===c?zh:qh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Bh:sh,r=ud()&&Yg;return 0===l.length?"y2"===c?hg.domain():gg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=bc(gg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&wh&&(f=b(wh.top)?wh.top:e,g=b(wh.bottom)?wh.bottom:e),"y2"===c&&Fh&&(f=b(Fh.top)?Fh.top:e,g=b(Fh.bottom)?Fh.bottom:e),Zd(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){var b=bc(fj),c=bc(fg.domain());return a||0===c?1:b/c}function Zb(a){return kh?kh:tf.min(a,function(a){return tf.min(a.values,function(a){return a.x})})}function $b(a){return jh?jh:tf.max(a,function(a){return tf.max(a.values,function(a){return a.x})})}function _b(a,c){var d,e,f,g,h=c[0],i=c[1],j=Math.abs(h-i);return wi?e=0:Zd(a)?(d=Ac(),e=d>1?j/(d-1)/2:.5):e=.01*j,"object"==typeof lh&&te(lh)?(f=b(lh.left)?lh.left:e,g=b(lh.right)?lh.right:e):f=g="number"==typeof lh?lh:e,{left:f,right:g}}function ac(a){var b=[Zb(a),$b(a)],c=b[0],d=b[1],e=_b(a,b),f=0,g=0;return(c||0===c)&&(f=vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function bc(a){return a[1]-a[0]}function cc(a){for(var b=0;bb?0:b-c}function ic(a){var b,c=gc(a),d="y"===a.axis?gg:hg;return b="y"===a.axis||"y2"===a.axis?Yg?Of:"start"in a?d(a.start):Of:Yg?"end"in a?fg(vi?oe(a.end):a.end):Of:Of,c>b?0:b-c}function jc(a){return pg&&a===pg||te(qg)&&ue(qg,a)}function kc(a){return!jc(a)}function lc(a){return pg?pg:te(qg)?qg[a]:null}function mc(a,b){var c,d=b&&te(b)?Cc(b):[];return d.forEach(function(b){lc(b)===a&&(c=uf.data.xs[b])}),c}function nc(a,b){return a in uf.data.xs&&uf.data.xs[a]&&uf.data.xs[a][b]?uf.data.xs[a][b]:b}function oc(a){Object.keys(a).forEach(function(b){qg[b]=a[b]})}function pc(a){return 1===tf.set(Object.keys(a).map(function(b){return a[b]})).size()}function qc(a){var b;return a&&(b=tg[a.id],a.name=b?b:a.id),a}function rc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=tc(b[d],a.id,d)}),uf.data.xs[a.id]=b})}function sc(a,b){a.forEach(function(a){b[a.id]&&rc([a],b[a.id])})}function tc(a,b,c){var d;return d=vi?a?a instanceof Date?a:oe(a):oe(nc(b,c)):xi&&!wi?a?+a:nc(b,c):c}function uc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?uf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):pg?(d=Object.keys(uf.data.xs),uf.data.xs[c]=d.length>0?uf.data.xs[d[0]]:void 0):te(qg)&&(uf.data.xs[c]=mc(f,uf.data.targets)):uf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!uf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=sg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=lc(b),g=a[f],h=tc(g,b,e);return xi&&wi&&0===c&&g&&(0===e&&(ah=[]),ah.push(g)),("undefined"==typeof a[b]||uf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),xg&&Xd(Cc(c).filter(function(a){return!(a in yg)}),xg),c.forEach(function(a){dc(a.id_org,a)}),c}function xc(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 yc(a){return a>0&&uf.data.targets[0].values[a-1]?uf.data.targets[0].values[a-1].x:void 0}function zc(a){return a1?uf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?uf.data.targets[0]:null,a}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(uf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(vi?new Date(h):h);i.push(d)}return vi||(i=i.sort(function(a,b){return a-b})),i}function Lc(a){Gi=Gi.concat(a)}function Mc(a){Gi=Gi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Hi=Hi.concat(a)}function Oc(a){Hi=Hi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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(Dd(a,f))),a[g].x&&(e=e.concat(Dd(a,g))),Gd(e,b)):Ed(a,b,f,g)}function Fd(a,b){var c;return c=a.map(function(a){return Ed(a.values,b)}),Gd(c,b)}function Gd(a,b){var c,d;return a.forEach(function(a){var e=ve(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Hd(a,b){return tf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Id(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 Jd(){return Ag&&"desc"===Ag.toLowerCase()}function Kd(){return Ag&&"asc"===Ag.toLowerCase()}function Ld(a){var b=Kd(),c=Jd();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 Ag&&a.sort(Ag),a}function Md(a,c){var d,e,f,g,h,i,j,k=be(uf.data.targets),l=k?xd:wd,m=a.filter(function(a){return a&&b(a.value)});ii&&0!==m.length&&(dj.html(li(a,$(),l,Di)).style("display","block"),d=dj.property("offsetWidth"),e=dj.property("offsetHeight"),k?(g=Mf/2+c[0],i=Of/2+c[1]+20):(Yg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=fg(m[0].x)+20):(f=q(),g=f+t()+fg(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),dj.style("top",i+"px").style("left",g+"px"))}function Nd(){dj.style("display","none")}function Od(a){var c=a.filter(function(a){return a&&b(a.value)});ii&&($d(uf.data.targets)||be(uf.data.targets)||aj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Yg?"y1":"x1",zd).attr(Yg?"y2":"x2",zd))}function Pd(){aj.select("line."+f.xgridFocus).style("visibility","hidden")}function Qd(a){return a.x||0===a.x?fg(a.x):null}function Rd(a){return V(a.id)(a.value)}function Sd(){var a,b,d={},e=0;return Ic(Fc(ee)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Wd(a,b){return Uh?Uh:b?2*a.tickOffset()*Vh/b:0}function Xd(a,b){Dc(a).forEach(function(a){hj[a]=b===yg[a],yg[a]=b})}function Yd(a,b){var c=!1;return a.forEach(function(a){yg[a.id]===b&&(c=!0),a.id in yg||"line"!==b||(c=!0)}),c}function Zd(a){return Yd(a,"bar")}function $d(a){return Yd(a,"scatter")}function _d(a){return Yd(a,"pie")}function ae(a){return Yd(a,"donut")}function be(a){return _d(a)||ae(a)}function ce(a){var b="string"==typeof a?a:a.id;return!(b in yg)||"line"===yg[b]||"spline"===yg[b]||"area"===yg[b]||"area-spline"===yg[b]}function de(a){var b="string"==typeof a?a:a.id;return"spline"===yg[b]||"area-spline"===yg[b]}function ee(a){var b="string"==typeof a?a:a.id;return"bar"===yg[b]}function fe(a){var b="string"==typeof a?a:a.id;return"scatter"===yg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"pie"===yg[b]}function he(a){var b="string"==typeof a?a:a.id;return"donut"===yg[b]}function ie(a){return ge(a)||he(a)}function je(a){return ee(a)?a.values:[]}function ke(a){return ce(a)||fe(a)?a.values:[]}function le(a){return ee(a)||ce(a)?a.values:[]}function me(a){return he(a)&&ci||ge(a)&&Yh}function ne(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function oe(b){var c;try{c=rg?tf.time.format(rg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+rg)}return c}function pe(a,b){var c=tf.mouse(a),d=tf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function ue(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ve(a,b){var c="y"===Z(a.id)?gg:hg,d=Yg?1:0,e=Yg?0:1;return Math.pow(fg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function we(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function xe(a,b,c){Lg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd).attr("stroke",function(){return Di(b)}).attr("r",1.4*Sh).transition().duration(100).attr("r",Sh)}function ye(a,b,c){Mg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ze(a,b,c,d){a?xe(b,c,d):ye(b,c,d)}function Ae(a,b){Lg(b,a.node()),a.transition().duration(100).style("fill",function(){return tf.rgb(Di(b)).darker(1)})}function Be(a,b){Mg(b,a.node()),a.transition().duration(100).style("fill",function(){return Di(b)})}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a){return a.filter(function(a){return b(a.value)})}function Ee(a,c){return(c?aj.selectAll("."+f.circles+ld(c)):aj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Fe(a,b){Ee(a,b).classed(f.EXPANDED,!0).attr("r",Rh)}function Ge(a){Ee(a).filter(function(){return tf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oh)}function He(a){return aj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ie(a){He(a).classed(f.EXPANDED,!0)}function Je(a){He(a).classed(f.EXPANDED,!1)}function Ke(a,b){var c=Oe(a,b);return function(a,b){var d=c(a,b),e=Yg?1:0,f=Yg?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 Le(a,b){var c=Oe(a,!1),d=b?Me:Ne;return function(a,b){return d(c(a,b),a,this)}}function Me(a,b){var c;return Yg?(c=ee(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ne(a,b,c){var d=c.getBoundingClientRect();return Yg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ee(b)?-3:-6)}function Oe(a,b){var c=a.__max__+1,d=Wd(lg,c),e=Td(d,c,a,!!b),f=Ud(!!b),g=Vd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Yg&&(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 Pe(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 Qe(b){var c,d,e;if(ej=tf.select(wf),ej.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ej.html(""),ej.classed("c3",!0),uf.data.xs={},uf.data.targets=wc(b),n(),R(),fg.domain(tf.extent(ac(uf.data.targets))),gg.domain(Xb(uf.data.targets,"y")),hg.domain(Xb(uf.data.targets,"y2")),ig.domain(fg.domain()),jg.domain(gg.domain()),kg.domain(hg.domain()),fj=fg.domain(),Vi.scale(ig),Bf&&Zi.scale(fg),$i=ej.append("svg").attr("width",Mf+Jf.left+Jf.right).attr("height",Of+Jf.top+Jf.bottom).on("mouseenter",Ef).on("mouseleave",Ff),_i=$i.append("defs"),_i.append("clipPath").attr("id",pi).append("rect").attr("width",Mf).attr("height",Of),_i.append("clipPath").attr("id",qi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),_i.append("clipPath").attr("id",ri).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),aj=$i.append("g").attr("transform",Mi.main),bj=Pg?$i.append("g").attr("transform",Mi.context):null,cj=$i.append("g").attr("transform",Mi.legend),Sg||(cj.style("visibility","hidden"),Hi=Cc(uf.data.targets)),dj=tf.select(wf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),of(Cc(uf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Zg&&aj.append("g").attr("class",f.axisX).attr("clip-path",ti).attr("transform",Mi.x).append("text").attr("class",f.axisXLabel).attr("transform",Yg?"rotate(-90)":"").attr("dx",tb).attr("dy",wb).style("text-anchor",zb),ph&&aj.append("g").attr("class",f.axisY).attr("clip-path",ui).attr("transform",Mi.y).append("text").attr("class",f.axisYLabel).attr("transform",Yg?"":"rotate(-90)").attr("dx",ub).attr("dy",xb).style("text-anchor",Ab),yh&&aj.append("g").attr("class",f.axisY2).attr("transform",Mi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Yg?"":"rotate(-90)").attr("dx",vb).style("text-anchor",Bb),d=aj.append("g").attr("clip-path",si).attr("class",f.grid),Hh&&d.append("g").attr("class",f.xgrids),te(Jh)&&d.append("g").attr("class",f.xgridLines),Ph&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Kh&&d.append("g").attr("class",f.ygrids),te(Lh)&&d.append("g").attr("class",f.ygridLines),aj.append("g").attr("clip-path",si).attr("class",f.regions),aj.append("g").attr("clip-path",si).attr("class",f.chart),c=aj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Bf?Yg?"ns-resize":"ew-resize":null),aj.select("."+f.chart).append("g").attr("class",f.chartBars),aj.select("."+f.chart).append("g").attr("class",f.chartLines),aj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Mi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),aj.select("."+f.chart).append("g").attr("class",f.chartTexts),Bf&&aj.insert("rect",Df?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Mf).attr("height",Of).style("opacity",0).style("cursor",Yg?"ns-resize":"ew-resize").call(Zi).on("dblclick.zoom",null),nh&&Vi.extent("function"!=typeof nh?nh:nh(ac())),Pg&&(bj.append("g").attr("clip-path",si).attr("class",f.chart),bj.select("."+f.chart).append("g").attr("class",f.chartBars),bj.select("."+f.chart).append("g").attr("class",f.chartLines),bj.append("g").attr("clip-path",si).attr("class",f.brush).call(Vi).selectAll("rect").attr(Yg?"width":"height",Yg?Nf:Pf),bj.append("g").attr("class",f.axisX).attr("transform",Mi.subx).attr("clip-path",Yg?"":ti)),bf(uf.data.targets),Yg?aj.select("."+f.axisX).style("opacity",0).call(lg):(aj.select("."+f.axisY).style("opacity",0).call(mg),aj.select("."+f.axisY2).style("opacity",0).call(ng)),Xe({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),mi){if(vi&&"string"==typeof ni){for(ni=oe(ni),e=0;eMf&&(Mf=0),0>Of&&(Of=0),Nf=Yg?Jf.left-Si-Ti:Mf,Pf=Yg?Of:Rf-Kf.top-Kf.bottom,0>Nf&&(Nf=0),0>Pf&&(Pf=0),p(),Ni&&be(uf.data.targets)&&(Lf.left=Mf/2+Tf)}function o(){aj.select("line."+f.xgridFocus).attr("x1",Yg?0:-10).attr("x2",Yg?Mf:-10).attr("y1",Yg?-10:Jf.top).attr("y2",Yg?-10:Of)}function p(){Tf=Of/2,Sf=.95*Tf,Uf=ae(uf.data.targets)?.6*Sf:0}function q(){var a=Yg?f.axisX:f.axisY,b=tf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=tf.select(wf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return xf?xf:x()}function s(){var a=yf?yf:y();return a>0?a:320}function t(){return be(uf.data.targets)?0:zf?zf:Yg||!ph||uh?1:v("y")}function u(){var a=1;return be(uf.data.targets)?0:Af?Af:Ni?P()+(yh&&!Yg?v("y2"):a):yh?Dh||Yg?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||Zg?"x"===a&&mh?mh:"y"!==a||ph?"y2"!==a||yh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Ui:Sg&&!Ni?10:1:0}function x(){return+tf.select(wf).style("width").replace("px","")}function y(){return+tf.select(wf).style("height").replace("px","")}function z(a){return a?-5:-(Jf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Yg)}function C(){return A(!Yg)}function D(){return z(Yg)}function E(){return A(Yg)}function F(a){return a?Mf+2+4:Jf.left+20}function G(a){return a?(mh?mh:0)+40:Of+2}function H(){return F(!Yg)}function I(){return G(!Yg)}function J(){return F(Yg)}function K(){return G(Yg)}function L(){var a=Yg?Of:Mf,b=Ac(),c=Yb()*(Zd(uf.data.targets)?(b-(wi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){Oi=a}function N(a){Pi=a}function O(a){Qi=a}function P(){return Sg?Ni?Pi*(Oi+1):Qf:0}function Q(){return Sg?Ni?Rf:Qi*(Oi+1):0}function R(){var a,b=!fg;Zf=Yg?1:0,$f=Yg?Of:Mf,_f=Yg?0:Of,ag=Yg?Mf:1,bg=Zf,cg=$f,dg=Yg?0:Pf,eg=Yg?Nf:1,fg=T(Zf,$f,b?void 0:fg.domain(),function(){return lg.tickOffset()}),gg=U(_f,ag),hg=U(_f,ag),ig=T(Zf,$f,fj,function(a){return a%1?0:og.tickOffset()}),jg=U(dg,eg),kg=U(dg,eg),a=$(),lg=X(fg,Ii,a),og=X(ig,Li,a),mg=Y(gg,Ji,vh,xh),ng=Y(hg,Ki,Eh,Gh),b||(Vi.scale(ig),Bf&&Zi.scale(fg)),S()}function S(){Vf=Gb(),Wf=Hb(),Xf=Hb(.98)}function T(a,b,e,f){var g=(vi?tf.time.scale():tf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),wi){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return tf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?hg:gg}function W(a){return"y2"===Z(a)?kg:jg}function X(a,b,c){var d=(wi?Eb():tf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),wi?(d.tickCentered(bh),se(dh)&&(dh=!1)):d.tickOffset=function(){var a=Yg?Of:Mf;return a*Yb()/Ac()/2},wi&&d.categories(ah),d}function Y(a,b,c,d){return tf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in wg?wg[a]:"y"}function $(){var a=vi?Fi:wi?Tc:function(a){return 0>a?a.toFixed(0):a};return ch&&("function"==typeof ch?a=ch:vi&&(a=function(a){return a?Ei(ch)(a):""})),a}function _(a){var b;return"y"===a?b=th:"y2"===a?b=Ch:"x"===a&&(b=oh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?th=b:"y2"===a?Ch=b:"x"===a&&(oh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a){a.selectAll(".tick text").attr("y",db(ih)).attr("x",cb(ih)).attr("transform","rotate("+ih+")").style("text-anchor","start")}function fb(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 gb(){return fb("x",Yg?"inner-top":"inner-right")}function hb(){return fb("y",Yg?"inner-right":"inner-top")}function ib(){return fb("y2",Yg?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Mf/2:Mf:b.isBottom?-Of:b.isMiddle?-Of/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!Yg,gb())}function rb(){return nb(Yg,hb())}function sb(){return nb(Yg,ib())}function tb(){return ob(!Yg,gb())}function ub(){return ob(Yg,hb())}function vb(){return ob(Yg,ib())}function wb(){var a=gb();return Yg?a.isInner?"1.2em":-30-Cb("x"):a.isInner?"-0.5em":"3em"}function xb(){var a=hb();return Yg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return Yg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!Yg,gb())}function Ab(){return pb(Yg,hb())}function Bb(){return pb(Yg,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return tf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Db(){aj.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).text(kb),aj.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dy",xb).text(lb),aj.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dy",yb).text(mb)}function Eb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+o)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Rc(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 tf.min(Object.keys(i).map(function(a){return tf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(vg.length>0)for(g=Sc(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 tf.max(Object.keys(i).map(function(a){return tf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Ah:rh,n="y2"===c?zh:qh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Bh:sh,r=ud()&&Yg;return 0===l.length?"y2"===c?hg.domain():gg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=bc(gg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&wh&&(f=b(wh.top)?wh.top:e,g=b(wh.bottom)?wh.bottom:e),"y2"===c&&Fh&&(f=b(Fh.top)?Fh.top:e,g=b(Fh.bottom)?Fh.bottom:e),Zd(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){var b=bc(fj),c=bc(fg.domain());return a||0===c?1:b/c}function Zb(a){return kh?kh:tf.min(a,function(a){return tf.min(a.values,function(a){return a.x})})}function $b(a){return jh?jh:tf.max(a,function(a){return tf.max(a.values,function(a){return a.x})})}function _b(a,c){var d,e,f,g,h=c[0],i=c[1],j=Math.abs(h-i);return wi?e=0:Zd(a)?(d=Ac(),e=d>1?j/(d-1)/2:.5):e=.01*j,"object"==typeof lh&&te(lh)?(f=b(lh.left)?lh.left:e,g=b(lh.right)?lh.right:e):f=g="number"==typeof lh?lh:e,{left:f,right:g}}function ac(a){var b=[Zb(a),$b(a)],c=b[0],d=b[1],e=_b(a,b),f=0,g=0;return(c||0===c)&&(f=vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function bc(a){return a[1]-a[0]}function cc(a){for(var b=0;bb?0:b-c}function ic(a){var b,c=gc(a),d="y"===a.axis?gg:hg;return b="y"===a.axis||"y2"===a.axis?Yg?Of:"start"in a?d(a.start):Of:Yg?"end"in a?fg(vi?oe(a.end):a.end):Of:Of,c>b?0:b-c}function jc(a){return pg&&a===pg||te(qg)&&ue(qg,a)}function kc(a){return!jc(a)}function lc(a){return pg?pg:te(qg)?qg[a]:null}function mc(a,b){var c,d=b&&te(b)?Cc(b):[];return d.forEach(function(b){lc(b)===a&&(c=uf.data.xs[b])}),c}function nc(a,b){return a in uf.data.xs&&uf.data.xs[a]&&uf.data.xs[a][b]?uf.data.xs[a][b]:b}function oc(a){Object.keys(a).forEach(function(b){qg[b]=a[b]})}function pc(a){return 1===tf.set(Object.keys(a).map(function(b){return a[b]})).size()}function qc(a){var b;return a&&(b=tg[a.id],a.name=b?b:a.id),a}function rc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=tc(b[d],a.id,d)}),uf.data.xs[a.id]=b})}function sc(a,b){a.forEach(function(a){b[a.id]&&rc([a],b[a.id])})}function tc(a,b,c){var d;return d=vi?a?a instanceof Date?a:oe(a):oe(nc(b,c)):xi&&!wi?a?+a:nc(b,c):c}function uc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?uf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):pg?(d=Object.keys(uf.data.xs),uf.data.xs[c]=d.length>0?uf.data.xs[d[0]]:void 0):te(qg)&&(uf.data.xs[c]=mc(f,uf.data.targets)):uf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!uf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=sg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=lc(b),g=a[f],h=tc(g,b,e);return xi&&wi&&0===c&&g&&(0===e&&(ah=[]),ah.push(g)),("undefined"==typeof a[b]||uf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),xg&&Xd(Cc(c).filter(function(a){return!(a in yg)}),xg),c.forEach(function(a){dc(a.id_org,a)}),c}function xc(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 yc(a){return a>0&&uf.data.targets[0].values[a-1]?uf.data.targets[0].values[a-1].x:void 0}function zc(a){return a1?uf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?uf.data.targets[0]:null,a}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(uf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(vi?new Date(h):h);i.push(d)}return vi||(i=i.sort(function(a,b){return a-b})),i}function Lc(a){Gi=Gi.concat(a)}function Mc(a){Gi=Gi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Hi=Hi.concat(a)}function Oc(a){Hi=Hi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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(Dd(a,f))),a[g].x&&(e=e.concat(Dd(a,g))),Gd(e,b)):Ed(a,b,f,g)}function Fd(a,b){var c;return c=a.map(function(a){return Ed(a.values,b)}),Gd(c,b)}function Gd(a,b){var c,d;return a.forEach(function(a){var e=ve(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Hd(a,b){return tf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Id(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 Jd(){return Ag&&"desc"===Ag.toLowerCase()}function Kd(){return Ag&&"asc"===Ag.toLowerCase()}function Ld(a){var b=Kd(),c=Jd();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 Ag&&a.sort(Ag),a}function Md(a,c){var d,e,f,g,h,i,j,k=be(uf.data.targets),l=k?xd:wd,m=a.filter(function(a){return a&&b(a.value)});ii&&0!==m.length&&(dj.html(li(a,$(),l,Di)).style("display","block"),d=dj.property("offsetWidth"),e=dj.property("offsetHeight"),k?(g=Mf/2+c[0],i=Of/2+c[1]+20):(Yg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=fg(m[0].x)+20):(f=q(),g=f+t()+fg(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),dj.style("top",i+"px").style("left",g+"px"))}function Nd(){dj.style("display","none")}function Od(a){var c=a.filter(function(a){return a&&b(a.value)});ii&&($d(uf.data.targets)||be(uf.data.targets)||aj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Yg?"y1":"x1",zd).attr(Yg?"y2":"x2",zd))}function Pd(){aj.select("line."+f.xgridFocus).style("visibility","hidden")}function Qd(a){return a.x||0===a.x?fg(a.x):null}function Rd(a){return V(a.id)(a.value)}function Sd(){var a,b,d={},e=0;return Ic(Fc(ee)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Wd(a,b){return Uh?Uh:b?2*a.tickOffset()*Vh/b:0}function Xd(a,b){Dc(a).forEach(function(a){hj[a]=b===yg[a],yg[a]=b})}function Yd(a,b){var c=!1;return a.forEach(function(a){yg[a.id]===b&&(c=!0),a.id in yg||"line"!==b||(c=!0)}),c}function Zd(a){return Yd(a,"bar")}function $d(a){return Yd(a,"scatter")}function _d(a){return Yd(a,"pie")}function ae(a){return Yd(a,"donut")}function be(a){return _d(a)||ae(a)}function ce(a){var b="string"==typeof a?a:a.id;return!(b in yg)||"line"===yg[b]||"spline"===yg[b]||"area"===yg[b]||"area-spline"===yg[b]}function de(a){var b="string"==typeof a?a:a.id;return"spline"===yg[b]||"area-spline"===yg[b]}function ee(a){var b="string"==typeof a?a:a.id;return"bar"===yg[b]}function fe(a){var b="string"==typeof a?a:a.id;return"scatter"===yg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"pie"===yg[b]}function he(a){var b="string"==typeof a?a:a.id;return"donut"===yg[b]}function ie(a){return ge(a)||he(a)}function je(a){return ee(a)?a.values:[]}function ke(a){return ce(a)||fe(a)?a.values:[]}function le(a){return ee(a)||ce(a)?a.values:[]}function me(a){return he(a)&&ci||ge(a)&&Yh}function ne(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function oe(b){var c;try{c=rg?tf.time.format(rg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+rg)}return c}function pe(a,b){var c=tf.mouse(a),d=tf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function ue(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ve(a,b){var c="y"===Z(a.id)?gg:hg,d=Yg?1:0,e=Yg?0:1;return Math.pow(fg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function we(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function xe(a,b,c){Lg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd).attr("stroke",function(){return Di(b)}).attr("r",1.4*Sh).transition().duration(100).attr("r",Sh)}function ye(a,b,c){Mg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ze(a,b,c,d){a?xe(b,c,d):ye(b,c,d)}function Ae(a,b){Lg(b,a.node()),a.transition().duration(100).style("fill",function(){return tf.rgb(Di(b)).darker(1)})}function Be(a,b){Mg(b,a.node()),a.transition().duration(100).style("fill",function(){return Di(b)})}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a){return a.filter(function(a){return b(a.value)})}function Ee(a,c){return(c?aj.selectAll("."+f.circles+ld(c)):aj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Fe(a,b){Ee(a,b).classed(f.EXPANDED,!0).attr("r",Rh)}function Ge(a){Ee(a).filter(function(){return tf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oh)}function He(a){return aj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ie(a){He(a).classed(f.EXPANDED,!0)}function Je(a){He(a).classed(f.EXPANDED,!1)}function Ke(a,b){var c=Oe(a,b);return function(a,b){var d=c(a,b),e=Yg?1:0,f=Yg?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 Le(a,b){var c=Oe(a,!1),d=b?Me:Ne;return function(a,b){return d(c(a,b),a,this)}}function Me(a,b){var c;return Yg?(c=ee(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ne(a,b,c){var d=c.getBoundingClientRect();return Yg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ee(b)?-3:-6)}function Oe(a,b){var c=a.__max__+1,d=Wd(lg,c),e=Td(d,c,a,!!b),f=Ud(!!b),g=Vd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Yg&&(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 Pe(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 Qe(b){var c,d,e;if(ej=tf.select(wf),ej.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ej.html(""),ej.classed("c3",!0),uf.data.xs={},uf.data.targets=wc(b),n(),R(),fg.domain(tf.extent(ac(uf.data.targets))),gg.domain(Xb(uf.data.targets,"y")),hg.domain(Xb(uf.data.targets,"y2")),ig.domain(fg.domain()),jg.domain(gg.domain()),kg.domain(hg.domain()),fj=fg.domain(),Vi.scale(ig),Bf&&Zi.scale(fg),$i=ej.append("svg").attr("width",Mf+Jf.left+Jf.right).attr("height",Of+Jf.top+Jf.bottom).on("mouseenter",Ef).on("mouseleave",Ff),_i=$i.append("defs"),_i.append("clipPath").attr("id",pi).append("rect").attr("width",Mf).attr("height",Of),_i.append("clipPath").attr("id",qi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),_i.append("clipPath").attr("id",ri).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),aj=$i.append("g").attr("transform",Mi.main),bj=Pg?$i.append("g").attr("transform",Mi.context):null,cj=$i.append("g").attr("transform",Mi.legend),Sg||(cj.style("visibility","hidden"),Hi=Cc(uf.data.targets)),dj=tf.select(wf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),of(Cc(uf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Zg&&aj.append("g").attr("class",f.axisX).attr("clip-path",ti).attr("transform",Mi.x).append("text").attr("class",f.axisXLabel).attr("transform",Yg?"rotate(-90)":"").attr("dx",tb).attr("dy",wb).style("text-anchor",zb),ph&&aj.append("g").attr("class",f.axisY).attr("clip-path",ui).attr("transform",Mi.y).append("text").attr("class",f.axisYLabel).attr("transform",Yg?"":"rotate(-90)").attr("dx",ub).attr("dy",xb).style("text-anchor",Ab),yh&&aj.append("g").attr("class",f.axisY2).attr("transform",Mi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Yg?"":"rotate(-90)").attr("dx",vb).style("text-anchor",Bb),d=aj.append("g").attr("clip-path",si).attr("class",f.grid),Hh&&d.append("g").attr("class",f.xgrids),te(Jh)&&d.append("g").attr("class",f.xgridLines),Ph&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Kh&&d.append("g").attr("class",f.ygrids),te(Lh)&&d.append("g").attr("class",f.ygridLines),aj.append("g").attr("clip-path",si).attr("class",f.regions),aj.append("g").attr("clip-path",si).attr("class",f.chart),c=aj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Bf?Yg?"ns-resize":"ew-resize":null),aj.select("."+f.chart).append("g").attr("class",f.chartBars),aj.select("."+f.chart).append("g").attr("class",f.chartLines),aj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Mi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),aj.select("."+f.chart).append("g").attr("class",f.chartTexts),Bf&&aj.insert("rect",Df?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Mf).attr("height",Of).style("opacity",0).style("cursor",Yg?"ns-resize":"ew-resize").call(Zi).on("dblclick.zoom",null),nh&&Vi.extent("function"!=typeof nh?nh:nh(ac())),Pg&&(bj.append("g").attr("clip-path",si).attr("class",f.chart),bj.select("."+f.chart).append("g").attr("class",f.chartBars),bj.select("."+f.chart).append("g").attr("class",f.chartLines),bj.append("g").attr("clip-path",si).attr("class",f.brush).call(Vi).selectAll("rect").attr(Yg?"width":"height",Yg?Nf:Pf),bj.append("g").attr("class",f.axisX).attr("transform",Mi.subx).attr("clip-path",Yg?"":ti)),bf(uf.data.targets),Yg?aj.select("."+f.axisX).style("opacity",0).call(lg):(aj.select("."+f.axisY).style("opacity",0).call(mg),aj.select("."+f.axisY2).style("opacity",0).call(ng)),Xe({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),mi){if(vi&&"string"==typeof ni){for(ni=oe(ni),e=0;e0){d=[];for(var g in tg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Id(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ce,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 Ve(a){be(uf.data.targets)||Eg&&(yi=a,aj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),zi=!0,Ng())}function We(){be(uf.data.targets)||Eg&&(aj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),aj.selectAll("."+f.shape).classed(f.INCLUDED,!1),zi=!1,Og())}function Xe(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U=Sd(),V=be(uf.data.targets),W=Ic(uf.data.targets);if(0!==W.length){if(a=d(a)?a:{},z=d(a.withY)?a.withY:!0,A=d(a.withSubchart)?a.withSubchart:!0,B=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,C=d(a.withTransitionForExit)?a.withTransitionForExit:B,D=d(a.withTransitionForAxis)?a.withTransitionForAxis:B,E=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:B,O=B?If:0,P=C?O:0,Q=D?O:0,I&&Sg&&of(Cc(uf.data.targets),a),H&&(fg.domain(tf.extent(ac(W))),fj=fg.domain(),Bf&&Zi.scale(fg).updateScaleExtent(),ig.domain(fg.domain()),Vi.scale(ig)),G&&(fg.domain(Vi.empty()?fj:Vi.extent()),Bf&&Zi.scale(fg).updateScaleExtent()),gg.domain(Xb(W,"y")),hg.domain(Xb(W,"y2")),(gh||fh)&&(R=hh?hh:Kc(Jc(W)),lg.tickValues(R),og.tickValues(R)),c=aj.select("."+f.axisX).style("opacity",V?0:1),(Yg||E)&&(c=c.transition().duration(Q)),c.call(lg),g=aj.select("."+f.axisY).style("opacity",V?0:1),(!Yg||E)&&(g=g.transition().duration(Q)),g.call(mg),aj.select("."+f.axisY2).style("opacity",V?0:1).transition().duration(Q).call(ng),G)if(dh&&R){for(S=1;S=0&&tf.select(this).style("display",b%T?"none":"block")})}else tf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!Yg&&ih&&eb(c),J=Ke(U),M=Le(U,!0),N=Le(U,!1),Db(),jg.domain(gg.domain()),kg.domain(hg.domain()),dj.style("display","none"),o(),aj.select("line."+f.xgridFocus).style("visibility","hidden"),Hh){if("year"===Ih){i=[];for(var X=ac(),Y=X[0].getFullYear(),Z=X[1].getFullYear(),$=Y;Z>=$;$++)i.push(new Date($+"-01-01 00:00:00"))}else i=fg.ticks(10);h=aj.select("."+f.xgrids).selectAll("."+f.xgrid).data(i),h.enter().append("line").attr("class",f.xgrid),h.attr("x1",Yg?0:function(a){return fg(a)-lg.tickOffset()}).attr("x2",Yg?Mf:function(a){return fg(a)-lg.tickOffset()}).attr("y1",Yg?function(a){return fg(a)-lg.tickOffset()}:Jf.top).attr("y2",Yg?function(a){return fg(a)-lg.tickOffset()}:Of).style("opacity",function(){return+tf.select(this).attr(Yg?"y1":"x1")===(Yg?Of:0)?0:1}),h.exit().remove()}te(Jh)&&(j=aj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Jh),k=j.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),k.append("line").style("opacity",0),k.append("text").attr("text-anchor","end").attr("transform",Yg?"":"rotate(-90)").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),j.select("line").transition().duration(O).attr("x1",Yg?0:Ad).attr("x2",Yg?Mf:Ad).attr("y1",Yg?Ad:Jf.top).attr("y2",Yg?Ad:Of).style("opacity",1),j.select("text").transition().duration(O).attr("x",Yg?Mf:0).attr("y",Ad).text(function(a){return a.text}).style("opacity",1),j.exit().transition().duration(O).style("opacity",0).remove()),z&&Kh&&(l=aj.select("."+f.ygrids).selectAll("."+f.ygrid).data(gg.ticks(Mh)),l.enter().append("line").attr("class",f.ygrid),l.attr("x1",Yg?gg:0).attr("x2",Yg?gg:Mf).attr("y1",Yg?0:gg).attr("y2",Yg?Of:gg),l.exit().remove()),z&&te(Lh)&&(m=aj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Lh),n=m.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),n.append("line").style("opacity",0),n.append("text").attr("text-anchor","end").attr("transform",Yg?"rotate(-90)":"").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),m.select("line").transition().duration(O).attr("x1",Yg?Bd:0).attr("x2",Yg?Bd:Mf).attr("y1",Yg?0:Bd).attr("y2",Yg?Of:Bd).style("opacity",1),m.select("text").transition().duration(O).attr("x",Yg?0:Mf).attr("y",Bd).text(function(a){return a.text}).style("opacity",1),m.exit().transition().duration(O).style("opacity",0).remove()),q=aj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),q.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Di(a)}).attr("class",ad),q.style("opacity",qd).transition().duration(O).attr("d",J).style("opacity",1),q.exit().transition().duration(P).style("opacity",0).remove(),s=aj.selectAll("."+f.texts).selectAll("."+f.text).data(le),s.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return Yg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),s.text(function(a){return yd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(O).attr("x",M).attr("y",N).style("fill-opacity",td),s.exit().transition().duration(P).style("fill-opacity",0).remove(),aj.selectAll("."+f.line).style("opacity",qd).transition().duration(O).attr("d",Wi).style("opacity",1),aj.selectAll("."+f.area).style("opacity",0).transition().duration(O).attr("d",Xi).style("opacity",gj),p=aj.selectAll("."+f.circles).selectAll("."+f.circle).data(ke),p.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Oh),p.style("opacity",qd).transition().duration(O).style("opacity",sd).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),p.exit().remove(),aj.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(O).attrTween("d",function(a){var b,c=Fb(a);return c?(b=tf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1),aj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(O).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&ie(a.data)?1:0}),aj.select("."+f.chartArcsTitle).style("opacity",ae(uf.data.targets)?1:0),Pg&&(null!==tf.event&&"zoom"===tf.event.type&&Vi.extent(fg.orgDomain()).update(),A&&(e=bj.select("."+f.axisX).style("opacity",V?0:1),(Yg||E)&&(e=e.transition().duration(Q)),e.call(og),!Yg&&ih&&eb(e),Vi.empty()||Vi.extent(fg.orgDomain()).update(),K=Ke(U,!0),t=bj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),t.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Di(a)}).attr("class",ad),t.style("opacity",qd).transition().duration(O).attr("d",K).style("opacity",1),t.exit().transition().duration(O).style("opacity",0).remove(),bj.selectAll("."+f.line).style("opacity",qd).transition().duration(O).attr("d",Yi).style("opacity",1))),aj.selectAll("."+f.selectedCircles).filter(function(a){return ee(a)}).selectAll("circle").remove(),aj.selectAll("."+f.selectedCircle).transition().duration(O).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),u=aj.select("."+f.eventRects),te(qg)&&!pc(qg)?(u.classed(f.eventRectsMultiple)||u.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),v=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Se(v.enter()),v.attr("x",0).attr("y",0).attr("width",Mf).attr("height",Of)):(u.classed(f.eventRectsSingle)||u.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),xi&&!wi?(y=function(a,b){var c=yc(b),d=zc(b),e=uf.data.xs[a.id][b];return(fg(d?d:e+50)-fg(c?c:e-50))/2},x=function(a,b){var c=yc(b),d=uf.data.xs[a.id][b];return(fg(d)+fg(c?c:d-50))/2}):(y=L(),x=function(a){return fg(a.x)-y/2}),w=Bc(),aj.select("."+f.eventRects).datum(w?w.values:[]),v=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Re(v.enter()),v.attr("class",fd).attr("x",Yg?0:x).attr("y",Yg?x:0).attr("width",Yg?Mf:y).attr("height",Yg?y:Of),v.exit().remove()),r=aj.select("."+f.regions).selectAll("rect."+f.region).data(hi),r.enter().append("rect").style("fill-opacity",0),r.attr("class",ed).attr("x",fc).attr("y",gc).attr("width",hc).attr("height",ic).transition().duration(O).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Cc(uf.data.targets).forEach(function(a){hj[a]=!0})}}function Ye(){Xe({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ze(){return"mousemove"===tf.event.sourceEvent.type&&Zi.altDomain?(fg.domain(Zi.altDomain),void Zi.scale(fg).updateScaleExtent()):(wi&&fg.orgDomain()[0]===fj[0]&&fg.domain([fj[0]-1e-10,fg.orgDomain()[1]]),Xe({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===tf.event.sourceEvent.type&&(Ai=!0)))}function $e(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function _e(){$i.attr("width",Qf).attr("height",Rf),$i.select("#"+pi).select("rect").attr("width",Mf).attr("height",Of),$i.select("#"+qi).select("rect").attr("width",H),$i.select("#"+ri).select("rect").attr("width",J),$i.select("."+f.zoomRect).attr("width",Mf).attr("height",Of)}function af(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),_e(),m(a.withTransition),Xe(a)}function bf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=aj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Di(a)}),e=aj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("fill",function(a){return Di(a)}).style("stroke","none").style("cursor",function(a){return Gg(a)?"pointer":null}),c=aj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)}),b.append("path").attr("class",dd).style("opacity",function(){return gj=+tf.select(this).style("opacity"),0}).style("fill",function(a){return Di(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Di(a)}).style("cursor",function(a){return Gg(a)?"pointer":null}),a.forEach(function(a){aj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=aj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Yf(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Di(a.data)}).style("cursor",function(a){return Gg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Fb(a),d=Lb(c),e=Tb();Nb(c.data.id),jf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Fb(a),c=[Lb(b)];Md(c,tf.mouse(this))}).on("mouseout",function(a,b){var c=Fb(a),d=Lb(c),e=Ub();Ob(c.data.id),lf(),Nd(),e(d,b)}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Pg&&(n=bj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Di(a)}),l=bj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)})),$i.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function cf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Xd(a.id,b.types[a.id]):Xd(a.id,b.type)}),uf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Ni?j:i,l=Ni?Q():P();return d&&(w=0,C=0,t=0,u=0),Sg&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Ni?u:t,void(Xg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,Ni?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=cj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Ug?Ug(a):uf.toggle(a)}).on("mouseover",function(a){uf.focus(a),"function"==typeof Vg&&Vg(a)}).on("mouseout",function(a){uf.revert(),"function"==typeof Wg&&Wg(a)}),l.append("text").text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",Ni?g:-200).attr("y",Ni?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ni?h:-200).attr("y",Ni?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Di(a)}).attr("x",Ni?g:-200).attr("y",Ni?-200:i).attr("width",10).attr("height",10),cj.selectAll("text").data(a).text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),cj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),cj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),_e(),q&&m(p)}function pf(a){return Ec(uf.data.targets,a.id)}function qf(a){return"data"in a&&Ec(uf.data.targets,a.data.id)}function rf(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 sf(a,b,c){var d=!be(uf.data.targets);Xd(a,b),af(c?c:{withTransitionForAxis:d})}var tf=a.d3?a.d3:a.require?a.require("d3"):void 0,uf={data:{},axis:{},legend:{}},vf={},wf=h(["bindto"],"#chart"),xf=h(["size","width"]),yf=h(["size","height"]),zf=h(["padding","left"]),Af=h(["padding","right"]),Bf=h(["zoom","enabled"],!1),Cf=h(["zoom","extent"]),Df=h(["zoom","privileged"],!1),Ef=h(["onenter"],function(){}),Ff=h(["onleave"],function(){}),Gf=h(["onresize"],function(){}),Hf=h(["onresized"],function(){}),If=h(["transition","duration"],350);g("data","data is required in config");var Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg=h(["data","x"]),qg=h(["data","xs"],{}),rg=h(["data","x_format"]),sg=h(["data","id_converter"],function(a){return a}),tg=h(["data","names"],{}),ug=h(["data","classes"],{}),vg=h(["data","groups"],[]),wg=h(["data","axes"],{}),xg=h(["data","type"]),yg=h(["data","types"],{}),zg=h(["data","labels"],{}),Ag=h(["data","order"]),Bg=h(["data","regions"],{}),Cg=h(["data","color"]),Dg=h(["data","colors"],{}),Eg=h(["data","selection","enabled"],!1),Fg=h(["data","selection","grouped"],!1),Gg=h(["data","selection","isselectable"],function(){return!0}),Hg=h(["data","selection","multiple"],!0),Ig=h(["data","onclick"],function(){}),Jg=h(["data","onenter"],function(){}),Kg=h(["data","onleave"],function(){}),Lg=h(["data","onselected"],function(){}),Mg=h(["data","onunselected"],function(){}),Ng=h(["data","ondragstart"],function(){}),Og=h(["data","ondragend"],function(){}),Pg=h(["subchart","show"],!1),Qg=h(["subchart","size","height"],60),Rg=h(["color","pattern"],[]),Sg=h(["legend","show"],!0),Tg=h(["legend","position"],"bottom"),Ug=h(["legend","item","onclick"]),Vg=h(["legend","item","onmouseover"]),Wg=h(["legend","item","onmouseout"]),Xg=h(["legend","equally"],!1),Yg=h(["axis","rotated"],!1),Zg=h(["axis","x","show"],!0),$g=h(["axis","x","type"],"indexed"),_g=h(["axis","x","localtime"],!0),ah=h(["axis","x","categories"],[]),bh=h(["axis","x","tick","centered"],!1),ch=h(["axis","x","tick","format"]),dh=h(["axis","x","tick","culling"],{}),eh=h(["axis","x","tick","culling","max"],10),fh=h(["axis","x","tick","count"]),gh=h(["axis","x","tick","fit"],!0),hh=h(["axis","x","tick","values"],null),ih=h(["axis","x","tick","rotate"]),jh=h(["axis","x","max"]),kh=h(["axis","x","min"]),lh=h(["axis","x","padding"],{}),mh=h(["axis","x","height"]),nh=h(["axis","x","default"]),oh=h(["axis","x","label"],{}),ph=h(["axis","y","show"],!0),qh=h(["axis","y","max"]),rh=h(["axis","y","min"]),sh=h(["axis","y","center"]),th=h(["axis","y","label"],{}),uh=h(["axis","y","inner"],!1),vh=h(["axis","y","tick","format"]),wh=h(["axis","y","padding"],{}),xh=h(["axis","y","ticks"],10),yh=h(["axis","y2","show"],!1),zh=h(["axis","y2","max"]),Ah=h(["axis","y2","min"]),Bh=h(["axis","y2","center"]),Ch=h(["axis","y2","label"],{}),Dh=h(["axis","y2","inner"],!1),Eh=h(["axis","y2","tick","format"]),Fh=h(["axis","y2","padding"],{}),Gh=h(["axis","y2","ticks"],10),Hh=h(["grid","x","show"],!1),Ih=h(["grid","x","type"],"tick"),Jh=h(["grid","x","lines"],[]),Kh=h(["grid","y","show"],!1),Lh=h(["grid","y","lines"],[]),Mh=h(["grid","y","ticks"],10),Nh=h(["point","show"],!0),Oh=Nh?h(["point","r"],2.5):0,Ph=h(["point","focus","line","enabled"],!0),Qh=h(["point","focus","expand","enabled"],!0),Rh=h(["point","focus","expand","r"],Qh?4:Oh),Sh=h(["point","focus","select","r"],8),Th=h(["line","connect_null"],!1),Uh=h(["bar","width"]),Vh=h(["bar","width","ratio"],.6),Wh=h(["pie","label","show"],!0),Xh=h(["pie","label","format"]),Yh=h(["pie","expand"],!0),Zh=h(["pie","onclick"],function(){}),$h=h(["pie","onmouseover"],function(){}),_h=h(["pie","onmouseout"],function(){}),ai=h(["donut","label","show"],!0),bi=h(["donut","label","format"]),ci=h(["donut","expand"],!0),di=h(["donut","title"],""),ei=h(["donut","onclick"],function(){}),fi=h(["donut","onmouseover"],function(){}),gi=h(["donut","onmouseout"],function(){}),hi=h(["regions"],[]),ii=h(["tooltip","show"],!0),ji=h(["tooltip","format","title"]),ki=h(["tooltip","format","value"]),li=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ji?ji:b,l=ki?ki: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+""}),mi=h(["tooltip","init","show"],!1),ni=h(["tooltip","init","x"],0),oi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),pi=("string"==typeof wf?wf.replace("#",""):wf.id)+"-clip",qi=pi+"-xaxis",ri=pi+"-yaxis",si=i(pi),ti=i(qi),ui=i(ri),vi="timeseries"===$g,wi="categorized"===$g,xi=!vi&&(pg||te(qg)),yi=null,zi=!1,Ai=!1,Bi=!1,Ci=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Di=ne(Dg,te(Rg)?Rg:Ci,Cg),Ei=_g?tf.time.format:tf.time.format.utc,Fi=function(){var a=[[Ei("%Y/%-m/%-d"),function(){return!0}],[Ei("%-m/%-d"),function(a){return a.getMonth()}],[Ei("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ei("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ei("%I %p"),function(a){return a.getHours()}],[Ei("%I:%M"),function(a){return a.getMinutes()}],[Ei(":%S"),function(a){return a.getSeconds()}],[Ei(".%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)}}(),Gi=[],Hi=[],Ii=Yg?"left":"bottom",Ji=Yg?uh?"top":"bottom":uh?"right":"left",Ki=Yg?Dh?"bottom":"top":Dh?"left":"right",Li=Yg?"left":"bottom",Mi={main:function(){return"translate("+Jf.left+","+Jf.top+")"},context:function(){return"translate("+Kf.left+","+Kf.top+")"},legend:function(){return"translate("+Lf.left+","+Lf.top+")"},x:function(){return"translate(0,"+(Yg?0:Of)+")"},y:function(){return"translate(0,"+(Yg?Of:0)+")"},y2:function(){return"translate("+(Yg?0:Mf)+","+(Yg?1:0)+")"},subx:function(){return"translate(0,"+(Yg?0:Pf)+")"},arc:function(){return"translate("+Mf/2+","+Of/2+")"}},Ni="right"===Tg,Oi=0,Pi=0,Qi=0,Ri=.15,Si=30,Ti=Yg&&!Zg?0:30,Ui=5;Yf=tf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Vi,Wi=function(){var a=tf.svg.line().x(Yg?function(a){return V(a.id)(a.value)}:zd).y(Yg?zd:function(a){return V(a.id)(a.value)});return Th||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Th?De(b.values):b.values;return ce(b)?(a.interpolate(de(b)?"cardinal":"linear"),Bg[b.id]?Pe(e,fg,V(b.id),Bg[b.id]):a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Xi=function(){var a;return a=Yg?tf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(zd):tf.svg.area().x(zd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=De(b.values);return Yd([b],"area")||Yd([b],"area-spline")?(a.interpolate(de(b)?"cardinal":"linear"),a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Yi=function(){var a=tf.svg.line().x(Yg?function(a){return W(a.id)(a.value)}:Cd).y(Yg?Cd:function(a){return W(a.id)(a.value)});return function(b){var c=De(b.values);return ce(b)?a(c):"M "+ig(c[0].x)+" "+W(b.id)(c[0].value)}}(),Zi=function(){};Vi=tf.svg.brush().on("brush",Ye),Vi.update=function(){return bj&&bj.select("."+f.brush).call(this),this},Vi.scale=function(a){return Yg?this.y(a):this.x(a)},Bf&&(Zi=tf.behavior.zoom().on("zoomstart",function(){Zi.altDomain=tf.event.sourceEvent.altKey?fg.orgDomain():null}).on("zoom",Bf?Ze:null),Zi.scale=function(a){return Yg?this.y(a):this.x(a)},Zi.orgScaleExtent=function(){var a=Cf?Cf:[1,10];return[a[0],Math.max(Ac()/a[1],a[1])]},Zi.updateScaleExtent=function(){var a=bc(fg.orgDomain())/bc(fj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var $i,_i,aj,bj,cj,dj,ej,fj,gj,hj={};if(uf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),uf.defocus(),b(d.classed(f.focused,!0)),b(e),be(uf.data.targets)&&Nb(a,!0),jf(a)},uf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),kf(a)},uf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),lf()},uf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),$i.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?mf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},uf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),$i.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?nf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Ri),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},uf.toggle=function(a){Gc(a)?uf.hide(a):uf.show(a)},uf.unzoom=function(){Vi.clear().update(),Xe({withUpdateXDomain:!0})},uf.load=function(a){return a.xs&&oc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){ug[b]=a.classes[b]}),"categories"in a&&wi&&(ah=a.categories,lg.categories(ah)),"cacheIds"in a&&cc(a.cacheIds)?void cf(ec(a.cacheIds),a.done):void("unload"in a?ef(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){df(a)}):df(a))},uf.unload=function(a){ef(Dc(a),function(){Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},uf.selected=function(a){return tf.merge(aj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return tf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},uf.select=function(a,b,c){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=tf.select(this),i="circle"===this.nodeName?xe:Ae,j="circle"===this.nodeName?ye:Be,k=Fg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Gg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},uf.unselect=function(a,b){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=tf.select(this),g="circle"===this.nodeName?ye:Be,h=Fg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Gg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},uf.toLine=function(a){sf(a,"line")},uf.toSpline=function(a){sf(a,"spline")},uf.toBar=function(a){sf(a,"bar")},uf.toScatter=function(a){sf(a,"scatter")},uf.toArea=function(a){sf(a,"area")},uf.toAreaSpline=function(a){sf(a,"area-spline")},uf.toPie=function(a){sf(a,"pie",{withTransform:!0})},uf.toDonut=function(a){sf(a,"donut",{withTransform:!0})},uf.groups=function(a){return c(a)?vg:(vg=a,Xe(),vg)},uf.xgrids=function(a){return a?(Jh=a,Xe(),Jh):Jh},uf.xgrids.add=function(a){return a?uf.xgrids(Jh.concat(a)):void 0},uf.xgrids.remove=function(a){var b=rf(a);return uf.xgrids(Jh.filter(b))},uf.ygrids=function(a){return a?(Lh=a,Xe(),Lh):Lh},uf.ygrids.add=function(a){return a?uf.ygrids(Lh.concat(a)):void 0},uf.ygrids.remove=function(a){var b=rf(a); return uf.ygrids(Lh.filter(b))},uf.regions=function(a){return c(a)?hi:(hi=a,Xe(),hi)},uf.regions.add=function(a){return c(a)?hi:(hi=hi.concat(a),Xe(),hi)},uf.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;$i.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),hi=hi.filter(function(b){return b.classes.indexOf(a)<0})}),hi},uf.data.get=function(a){var b=uf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},uf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},uf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){tg[b]=a[b]}),of(Cc(uf.data.targets),{withTransition:!0}),tg):tg},uf.x=function(a){return arguments.length&&(rc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.xs=function(a){return arguments.length&&(sc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},uf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(qh=+a.y),b(a.y2)&&(zh=+a.y2)):qh=zh=+a,Xe())},uf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(rh=+a.y),b(a.y2)&&(Ah=+a.y2)):rh=Ah=+a,Xe())},uf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&uf.axis.max(a.max),"undefined"!=typeof a.min&&uf.axis.min(a.min))},uf.legend.show=function(a){Sg||(Sg=!0,cj.style("visibility","visible")),mf(Dc(a)),Xe({withTransitionForHorizontalAxis:!1})},uf.legend.hide=function(a){Sg&&se(a)&&(Sg=!1,cj.style("visibility","hidden")),nf(Dc(a)),Xe({withTransitionForHorizontalAxis:!1})},uf.resize=function(a){xf=a?a.width:null,yf=a?a.height:null,af({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},uf.destroy=function(){uf.data.targets=void 0,uf.data.xs={},ej.html(""),a.onresize=null},"url"in e.data)tf.xhr(e.data.url,function(a,b){var c,d=tf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=tf.csv.parse(b.response),Qe(c)});else if("rows"in e.data)Qe(uc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Qe(vc(e.data.columns))}return uf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file diff --git a/package.json b/package.json index ac883d4..84d69d5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "c3", - "version": "0.1.31", + "version": "0.1.32", "description": "D3-based reusable chart library", "main": "c3.js", "scripts": { From bb097be73867d7b102f93122dcad49f2a97b3815 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 23 Apr 2014 23:12:50 +0900 Subject: [PATCH 060/178] Fix find closest data point - #154 --- c3.js | 4 ++-- c3.min.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/c3.js b/c3.js index 9f57299..cb1e866 100644 --- a/c3.js +++ b/c3.js @@ -1787,10 +1787,10 @@ // Get candidates that has same min and max index candidates = []; - if (values[min].x) { + if (values[min].x || values[min].x === 0) { candidates = candidates.concat(findSameXOfValues(values, min)); } - if (values[max].x) { + if (values[max].x || values[max].x === 0) { candidates = candidates.concat(findSameXOfValues(values, max)); } diff --git a/c3.min.js b/c3.min.js index 3fcc3eb..c9fbe91 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.32"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cMf&&(Mf=0),0>Of&&(Of=0),Nf=Yg?Jf.left-Si-Ti:Mf,Pf=Yg?Of:Rf-Kf.top-Kf.bottom,0>Nf&&(Nf=0),0>Pf&&(Pf=0),p(),Ni&&be(uf.data.targets)&&(Lf.left=Mf/2+Tf)}function o(){aj.select("line."+f.xgridFocus).attr("x1",Yg?0:-10).attr("x2",Yg?Mf:-10).attr("y1",Yg?-10:Jf.top).attr("y2",Yg?-10:Of)}function p(){Tf=Of/2,Sf=.95*Tf,Uf=ae(uf.data.targets)?.6*Sf:0}function q(){var a=Yg?f.axisX:f.axisY,b=tf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=tf.select(wf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return xf?xf:x()}function s(){var a=yf?yf:y();return a>0?a:320}function t(){return be(uf.data.targets)?0:zf?zf:Yg||!ph||uh?1:v("y")}function u(){var a=1;return be(uf.data.targets)?0:Af?Af:Ni?P()+(yh&&!Yg?v("y2"):a):yh?Dh||Yg?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||Zg?"x"===a&&mh?mh:"y"!==a||ph?"y2"!==a||yh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Ui:Sg&&!Ni?10:1:0}function x(){return+tf.select(wf).style("width").replace("px","")}function y(){return+tf.select(wf).style("height").replace("px","")}function z(a){return a?-5:-(Jf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Yg)}function C(){return A(!Yg)}function D(){return z(Yg)}function E(){return A(Yg)}function F(a){return a?Mf+2+4:Jf.left+20}function G(a){return a?(mh?mh:0)+40:Of+2}function H(){return F(!Yg)}function I(){return G(!Yg)}function J(){return F(Yg)}function K(){return G(Yg)}function L(){var a=Yg?Of:Mf,b=Ac(),c=Yb()*(Zd(uf.data.targets)?(b-(wi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){Oi=a}function N(a){Pi=a}function O(a){Qi=a}function P(){return Sg?Ni?Pi*(Oi+1):Qf:0}function Q(){return Sg?Ni?Rf:Qi*(Oi+1):0}function R(){var a,b=!fg;Zf=Yg?1:0,$f=Yg?Of:Mf,_f=Yg?0:Of,ag=Yg?Mf:1,bg=Zf,cg=$f,dg=Yg?0:Pf,eg=Yg?Nf:1,fg=T(Zf,$f,b?void 0:fg.domain(),function(){return lg.tickOffset()}),gg=U(_f,ag),hg=U(_f,ag),ig=T(Zf,$f,fj,function(a){return a%1?0:og.tickOffset()}),jg=U(dg,eg),kg=U(dg,eg),a=$(),lg=X(fg,Ii,a),og=X(ig,Li,a),mg=Y(gg,Ji,vh,xh),ng=Y(hg,Ki,Eh,Gh),b||(Vi.scale(ig),Bf&&Zi.scale(fg)),S()}function S(){Vf=Gb(),Wf=Hb(),Xf=Hb(.98)}function T(a,b,e,f){var g=(vi?tf.time.scale():tf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),wi){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return tf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?hg:gg}function W(a){return"y2"===Z(a)?kg:jg}function X(a,b,c){var d=(wi?Eb():tf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),wi?(d.tickCentered(bh),se(dh)&&(dh=!1)):d.tickOffset=function(){var a=Yg?Of:Mf;return a*Yb()/Ac()/2},wi&&d.categories(ah),d}function Y(a,b,c,d){return tf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in wg?wg[a]:"y"}function $(){var a=vi?Fi:wi?Tc:function(a){return 0>a?a.toFixed(0):a};return ch&&("function"==typeof ch?a=ch:vi&&(a=function(a){return a?Ei(ch)(a):""})),a}function _(a){var b;return"y"===a?b=th:"y2"===a?b=Ch:"x"===a&&(b=oh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?th=b:"y2"===a?Ch=b:"x"===a&&(oh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a){a.selectAll(".tick text").attr("y",db(ih)).attr("x",cb(ih)).attr("transform","rotate("+ih+")").style("text-anchor","start")}function fb(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 gb(){return fb("x",Yg?"inner-top":"inner-right")}function hb(){return fb("y",Yg?"inner-right":"inner-top")}function ib(){return fb("y2",Yg?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Mf/2:Mf:b.isBottom?-Of:b.isMiddle?-Of/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!Yg,gb())}function rb(){return nb(Yg,hb())}function sb(){return nb(Yg,ib())}function tb(){return ob(!Yg,gb())}function ub(){return ob(Yg,hb())}function vb(){return ob(Yg,ib())}function wb(){var a=gb();return Yg?a.isInner?"1.2em":-30-Cb("x"):a.isInner?"-0.5em":"3em"}function xb(){var a=hb();return Yg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return Yg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!Yg,gb())}function Ab(){return pb(Yg,hb())}function Bb(){return pb(Yg,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return tf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Db(){aj.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).text(kb),aj.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dy",xb).text(lb),aj.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dy",yb).text(mb)}function Eb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+o)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Rc(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 tf.min(Object.keys(i).map(function(a){return tf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(vg.length>0)for(g=Sc(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 tf.max(Object.keys(i).map(function(a){return tf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Ah:rh,n="y2"===c?zh:qh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Bh:sh,r=ud()&&Yg;return 0===l.length?"y2"===c?hg.domain():gg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=bc(gg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&wh&&(f=b(wh.top)?wh.top:e,g=b(wh.bottom)?wh.bottom:e),"y2"===c&&Fh&&(f=b(Fh.top)?Fh.top:e,g=b(Fh.bottom)?Fh.bottom:e),Zd(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){var b=bc(fj),c=bc(fg.domain());return a||0===c?1:b/c}function Zb(a){return kh?kh:tf.min(a,function(a){return tf.min(a.values,function(a){return a.x})})}function $b(a){return jh?jh:tf.max(a,function(a){return tf.max(a.values,function(a){return a.x})})}function _b(a,c){var d,e,f,g,h=c[0],i=c[1],j=Math.abs(h-i);return wi?e=0:Zd(a)?(d=Ac(),e=d>1?j/(d-1)/2:.5):e=.01*j,"object"==typeof lh&&te(lh)?(f=b(lh.left)?lh.left:e,g=b(lh.right)?lh.right:e):f=g="number"==typeof lh?lh:e,{left:f,right:g}}function ac(a){var b=[Zb(a),$b(a)],c=b[0],d=b[1],e=_b(a,b),f=0,g=0;return(c||0===c)&&(f=vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function bc(a){return a[1]-a[0]}function cc(a){for(var b=0;bb?0:b-c}function ic(a){var b,c=gc(a),d="y"===a.axis?gg:hg;return b="y"===a.axis||"y2"===a.axis?Yg?Of:"start"in a?d(a.start):Of:Yg?"end"in a?fg(vi?oe(a.end):a.end):Of:Of,c>b?0:b-c}function jc(a){return pg&&a===pg||te(qg)&&ue(qg,a)}function kc(a){return!jc(a)}function lc(a){return pg?pg:te(qg)?qg[a]:null}function mc(a,b){var c,d=b&&te(b)?Cc(b):[];return d.forEach(function(b){lc(b)===a&&(c=uf.data.xs[b])}),c}function nc(a,b){return a in uf.data.xs&&uf.data.xs[a]&&uf.data.xs[a][b]?uf.data.xs[a][b]:b}function oc(a){Object.keys(a).forEach(function(b){qg[b]=a[b]})}function pc(a){return 1===tf.set(Object.keys(a).map(function(b){return a[b]})).size()}function qc(a){var b;return a&&(b=tg[a.id],a.name=b?b:a.id),a}function rc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=tc(b[d],a.id,d)}),uf.data.xs[a.id]=b})}function sc(a,b){a.forEach(function(a){b[a.id]&&rc([a],b[a.id])})}function tc(a,b,c){var d;return d=vi?a?a instanceof Date?a:oe(a):oe(nc(b,c)):xi&&!wi?a?+a:nc(b,c):c}function uc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?uf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):pg?(d=Object.keys(uf.data.xs),uf.data.xs[c]=d.length>0?uf.data.xs[d[0]]:void 0):te(qg)&&(uf.data.xs[c]=mc(f,uf.data.targets)):uf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!uf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=sg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=lc(b),g=a[f],h=tc(g,b,e);return xi&&wi&&0===c&&g&&(0===e&&(ah=[]),ah.push(g)),("undefined"==typeof a[b]||uf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),xg&&Xd(Cc(c).filter(function(a){return!(a in yg)}),xg),c.forEach(function(a){dc(a.id_org,a)}),c}function xc(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 yc(a){return a>0&&uf.data.targets[0].values[a-1]?uf.data.targets[0].values[a-1].x:void 0}function zc(a){return a1?uf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?uf.data.targets[0]:null,a}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(uf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(vi?new Date(h):h);i.push(d)}return vi||(i=i.sort(function(a,b){return a-b})),i}function Lc(a){Gi=Gi.concat(a)}function Mc(a){Gi=Gi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Hi=Hi.concat(a)}function Oc(a){Hi=Hi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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(Dd(a,f))),a[g].x&&(e=e.concat(Dd(a,g))),Gd(e,b)):Ed(a,b,f,g)}function Fd(a,b){var c;return c=a.map(function(a){return Ed(a.values,b)}),Gd(c,b)}function Gd(a,b){var c,d;return a.forEach(function(a){var e=ve(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Hd(a,b){return tf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Id(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 Jd(){return Ag&&"desc"===Ag.toLowerCase()}function Kd(){return Ag&&"asc"===Ag.toLowerCase()}function Ld(a){var b=Kd(),c=Jd();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 Ag&&a.sort(Ag),a}function Md(a,c){var d,e,f,g,h,i,j,k=be(uf.data.targets),l=k?xd:wd,m=a.filter(function(a){return a&&b(a.value)});ii&&0!==m.length&&(dj.html(li(a,$(),l,Di)).style("display","block"),d=dj.property("offsetWidth"),e=dj.property("offsetHeight"),k?(g=Mf/2+c[0],i=Of/2+c[1]+20):(Yg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=fg(m[0].x)+20):(f=q(),g=f+t()+fg(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),dj.style("top",i+"px").style("left",g+"px"))}function Nd(){dj.style("display","none")}function Od(a){var c=a.filter(function(a){return a&&b(a.value)});ii&&($d(uf.data.targets)||be(uf.data.targets)||aj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Yg?"y1":"x1",zd).attr(Yg?"y2":"x2",zd))}function Pd(){aj.select("line."+f.xgridFocus).style("visibility","hidden")}function Qd(a){return a.x||0===a.x?fg(a.x):null}function Rd(a){return V(a.id)(a.value)}function Sd(){var a,b,d={},e=0;return Ic(Fc(ee)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Wd(a,b){return Uh?Uh:b?2*a.tickOffset()*Vh/b:0}function Xd(a,b){Dc(a).forEach(function(a){hj[a]=b===yg[a],yg[a]=b})}function Yd(a,b){var c=!1;return a.forEach(function(a){yg[a.id]===b&&(c=!0),a.id in yg||"line"!==b||(c=!0)}),c}function Zd(a){return Yd(a,"bar")}function $d(a){return Yd(a,"scatter")}function _d(a){return Yd(a,"pie")}function ae(a){return Yd(a,"donut")}function be(a){return _d(a)||ae(a)}function ce(a){var b="string"==typeof a?a:a.id;return!(b in yg)||"line"===yg[b]||"spline"===yg[b]||"area"===yg[b]||"area-spline"===yg[b]}function de(a){var b="string"==typeof a?a:a.id;return"spline"===yg[b]||"area-spline"===yg[b]}function ee(a){var b="string"==typeof a?a:a.id;return"bar"===yg[b]}function fe(a){var b="string"==typeof a?a:a.id;return"scatter"===yg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"pie"===yg[b]}function he(a){var b="string"==typeof a?a:a.id;return"donut"===yg[b]}function ie(a){return ge(a)||he(a)}function je(a){return ee(a)?a.values:[]}function ke(a){return ce(a)||fe(a)?a.values:[]}function le(a){return ee(a)||ce(a)?a.values:[]}function me(a){return he(a)&&ci||ge(a)&&Yh}function ne(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function oe(b){var c;try{c=rg?tf.time.format(rg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+rg)}return c}function pe(a,b){var c=tf.mouse(a),d=tf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function ue(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ve(a,b){var c="y"===Z(a.id)?gg:hg,d=Yg?1:0,e=Yg?0:1;return Math.pow(fg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function we(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function xe(a,b,c){Lg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd).attr("stroke",function(){return Di(b)}).attr("r",1.4*Sh).transition().duration(100).attr("r",Sh)}function ye(a,b,c){Mg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ze(a,b,c,d){a?xe(b,c,d):ye(b,c,d)}function Ae(a,b){Lg(b,a.node()),a.transition().duration(100).style("fill",function(){return tf.rgb(Di(b)).darker(1)})}function Be(a,b){Mg(b,a.node()),a.transition().duration(100).style("fill",function(){return Di(b)})}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a){return a.filter(function(a){return b(a.value)})}function Ee(a,c){return(c?aj.selectAll("."+f.circles+ld(c)):aj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Fe(a,b){Ee(a,b).classed(f.EXPANDED,!0).attr("r",Rh)}function Ge(a){Ee(a).filter(function(){return tf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oh)}function He(a){return aj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ie(a){He(a).classed(f.EXPANDED,!0)}function Je(a){He(a).classed(f.EXPANDED,!1)}function Ke(a,b){var c=Oe(a,b);return function(a,b){var d=c(a,b),e=Yg?1:0,f=Yg?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 Le(a,b){var c=Oe(a,!1),d=b?Me:Ne;return function(a,b){return d(c(a,b),a,this)}}function Me(a,b){var c;return Yg?(c=ee(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ne(a,b,c){var d=c.getBoundingClientRect();return Yg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ee(b)?-3:-6)}function Oe(a,b){var c=a.__max__+1,d=Wd(lg,c),e=Td(d,c,a,!!b),f=Ud(!!b),g=Vd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Yg&&(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 Pe(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 Qe(b){var c,d,e;if(ej=tf.select(wf),ej.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ej.html(""),ej.classed("c3",!0),uf.data.xs={},uf.data.targets=wc(b),n(),R(),fg.domain(tf.extent(ac(uf.data.targets))),gg.domain(Xb(uf.data.targets,"y")),hg.domain(Xb(uf.data.targets,"y2")),ig.domain(fg.domain()),jg.domain(gg.domain()),kg.domain(hg.domain()),fj=fg.domain(),Vi.scale(ig),Bf&&Zi.scale(fg),$i=ej.append("svg").attr("width",Mf+Jf.left+Jf.right).attr("height",Of+Jf.top+Jf.bottom).on("mouseenter",Ef).on("mouseleave",Ff),_i=$i.append("defs"),_i.append("clipPath").attr("id",pi).append("rect").attr("width",Mf).attr("height",Of),_i.append("clipPath").attr("id",qi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),_i.append("clipPath").attr("id",ri).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),aj=$i.append("g").attr("transform",Mi.main),bj=Pg?$i.append("g").attr("transform",Mi.context):null,cj=$i.append("g").attr("transform",Mi.legend),Sg||(cj.style("visibility","hidden"),Hi=Cc(uf.data.targets)),dj=tf.select(wf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),of(Cc(uf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Zg&&aj.append("g").attr("class",f.axisX).attr("clip-path",ti).attr("transform",Mi.x).append("text").attr("class",f.axisXLabel).attr("transform",Yg?"rotate(-90)":"").attr("dx",tb).attr("dy",wb).style("text-anchor",zb),ph&&aj.append("g").attr("class",f.axisY).attr("clip-path",ui).attr("transform",Mi.y).append("text").attr("class",f.axisYLabel).attr("transform",Yg?"":"rotate(-90)").attr("dx",ub).attr("dy",xb).style("text-anchor",Ab),yh&&aj.append("g").attr("class",f.axisY2).attr("transform",Mi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Yg?"":"rotate(-90)").attr("dx",vb).style("text-anchor",Bb),d=aj.append("g").attr("clip-path",si).attr("class",f.grid),Hh&&d.append("g").attr("class",f.xgrids),te(Jh)&&d.append("g").attr("class",f.xgridLines),Ph&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Kh&&d.append("g").attr("class",f.ygrids),te(Lh)&&d.append("g").attr("class",f.ygridLines),aj.append("g").attr("clip-path",si).attr("class",f.regions),aj.append("g").attr("clip-path",si).attr("class",f.chart),c=aj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Bf?Yg?"ns-resize":"ew-resize":null),aj.select("."+f.chart).append("g").attr("class",f.chartBars),aj.select("."+f.chart).append("g").attr("class",f.chartLines),aj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Mi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),aj.select("."+f.chart).append("g").attr("class",f.chartTexts),Bf&&aj.insert("rect",Df?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Mf).attr("height",Of).style("opacity",0).style("cursor",Yg?"ns-resize":"ew-resize").call(Zi).on("dblclick.zoom",null),nh&&Vi.extent("function"!=typeof nh?nh:nh(ac())),Pg&&(bj.append("g").attr("clip-path",si).attr("class",f.chart),bj.select("."+f.chart).append("g").attr("class",f.chartBars),bj.select("."+f.chart).append("g").attr("class",f.chartLines),bj.append("g").attr("clip-path",si).attr("class",f.brush).call(Vi).selectAll("rect").attr(Yg?"width":"height",Yg?Nf:Pf),bj.append("g").attr("class",f.axisX).attr("transform",Mi.subx).attr("clip-path",Yg?"":ti)),bf(uf.data.targets),Yg?aj.select("."+f.axisX).style("opacity",0).call(lg):(aj.select("."+f.axisY).style("opacity",0).call(mg),aj.select("."+f.axisY2).style("opacity",0).call(ng)),Xe({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),mi){if(vi&&"string"==typeof ni){for(ni=oe(ni),e=0;eMf&&(Mf=0),0>Of&&(Of=0),Nf=Yg?Jf.left-Si-Ti:Mf,Pf=Yg?Of:Rf-Kf.top-Kf.bottom,0>Nf&&(Nf=0),0>Pf&&(Pf=0),p(),Ni&&be(uf.data.targets)&&(Lf.left=Mf/2+Tf)}function o(){aj.select("line."+f.xgridFocus).attr("x1",Yg?0:-10).attr("x2",Yg?Mf:-10).attr("y1",Yg?-10:Jf.top).attr("y2",Yg?-10:Of)}function p(){Tf=Of/2,Sf=.95*Tf,Uf=ae(uf.data.targets)?.6*Sf:0}function q(){var a=Yg?f.axisX:f.axisY,b=tf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=tf.select(wf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return xf?xf:x()}function s(){var a=yf?yf:y();return a>0?a:320}function t(){return be(uf.data.targets)?0:zf?zf:Yg||!ph||uh?1:v("y")}function u(){var a=1;return be(uf.data.targets)?0:Af?Af:Ni?P()+(yh&&!Yg?v("y2"):a):yh?Dh||Yg?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||Zg?"x"===a&&mh?mh:"y"!==a||ph?"y2"!==a||yh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Ui:Sg&&!Ni?10:1:0}function x(){return+tf.select(wf).style("width").replace("px","")}function y(){return+tf.select(wf).style("height").replace("px","")}function z(a){return a?-5:-(Jf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Yg)}function C(){return A(!Yg)}function D(){return z(Yg)}function E(){return A(Yg)}function F(a){return a?Mf+2+4:Jf.left+20}function G(a){return a?(mh?mh:0)+40:Of+2}function H(){return F(!Yg)}function I(){return G(!Yg)}function J(){return F(Yg)}function K(){return G(Yg)}function L(){var a=Yg?Of:Mf,b=Ac(),c=Yb()*(Zd(uf.data.targets)?(b-(wi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){Oi=a}function N(a){Pi=a}function O(a){Qi=a}function P(){return Sg?Ni?Pi*(Oi+1):Qf:0}function Q(){return Sg?Ni?Rf:Qi*(Oi+1):0}function R(){var a,b=!fg;Zf=Yg?1:0,$f=Yg?Of:Mf,_f=Yg?0:Of,ag=Yg?Mf:1,bg=Zf,cg=$f,dg=Yg?0:Pf,eg=Yg?Nf:1,fg=T(Zf,$f,b?void 0:fg.domain(),function(){return lg.tickOffset()}),gg=U(_f,ag),hg=U(_f,ag),ig=T(Zf,$f,fj,function(a){return a%1?0:og.tickOffset()}),jg=U(dg,eg),kg=U(dg,eg),a=$(),lg=X(fg,Ii,a),og=X(ig,Li,a),mg=Y(gg,Ji,vh,xh),ng=Y(hg,Ki,Eh,Gh),b||(Vi.scale(ig),Bf&&Zi.scale(fg)),S()}function S(){Vf=Gb(),Wf=Hb(),Xf=Hb(.98)}function T(a,b,e,f){var g=(vi?tf.time.scale():tf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),wi){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return tf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?hg:gg}function W(a){return"y2"===Z(a)?kg:jg}function X(a,b,c){var d=(wi?Eb():tf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),wi?(d.tickCentered(bh),se(dh)&&(dh=!1)):d.tickOffset=function(){var a=Yg?Of:Mf;return a*Yb()/Ac()/2},wi&&d.categories(ah),d}function Y(a,b,c,d){return tf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in wg?wg[a]:"y"}function $(){var a=vi?Fi:wi?Tc:function(a){return 0>a?a.toFixed(0):a};return ch&&("function"==typeof ch?a=ch:vi&&(a=function(a){return a?Ei(ch)(a):""})),a}function _(a){var b;return"y"===a?b=th:"y2"===a?b=Ch:"x"===a&&(b=oh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?th=b:"y2"===a?Ch=b:"x"===a&&(oh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a){a.selectAll(".tick text").attr("y",db(ih)).attr("x",cb(ih)).attr("transform","rotate("+ih+")").style("text-anchor","start")}function fb(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 gb(){return fb("x",Yg?"inner-top":"inner-right")}function hb(){return fb("y",Yg?"inner-right":"inner-top")}function ib(){return fb("y2",Yg?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Mf/2:Mf:b.isBottom?-Of:b.isMiddle?-Of/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!Yg,gb())}function rb(){return nb(Yg,hb())}function sb(){return nb(Yg,ib())}function tb(){return ob(!Yg,gb())}function ub(){return ob(Yg,hb())}function vb(){return ob(Yg,ib())}function wb(){var a=gb();return Yg?a.isInner?"1.2em":-30-Cb("x"):a.isInner?"-0.5em":"3em"}function xb(){var a=hb();return Yg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return Yg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!Yg,gb())}function Ab(){return pb(Yg,hb())}function Bb(){return pb(Yg,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return tf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Db(){aj.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).text(kb),aj.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dy",xb).text(lb),aj.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dy",yb).text(mb)}function Eb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+o)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Rc(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 tf.min(Object.keys(i).map(function(a){return tf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(vg.length>0)for(g=Sc(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 tf.max(Object.keys(i).map(function(a){return tf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Ah:rh,n="y2"===c?zh:qh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Bh:sh,r=ud()&&Yg;return 0===l.length?"y2"===c?hg.domain():gg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=bc(gg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&wh&&(f=b(wh.top)?wh.top:e,g=b(wh.bottom)?wh.bottom:e),"y2"===c&&Fh&&(f=b(Fh.top)?Fh.top:e,g=b(Fh.bottom)?Fh.bottom:e),Zd(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){var b=bc(fj),c=bc(fg.domain());return a||0===c?1:b/c}function Zb(a){return kh?kh:tf.min(a,function(a){return tf.min(a.values,function(a){return a.x})})}function $b(a){return jh?jh:tf.max(a,function(a){return tf.max(a.values,function(a){return a.x})})}function _b(a,c){var d,e,f,g,h=c[0],i=c[1],j=Math.abs(h-i);return wi?e=0:Zd(a)?(d=Ac(),e=d>1?j/(d-1)/2:.5):e=.01*j,"object"==typeof lh&&te(lh)?(f=b(lh.left)?lh.left:e,g=b(lh.right)?lh.right:e):f=g="number"==typeof lh?lh:e,{left:f,right:g}}function ac(a){var b=[Zb(a),$b(a)],c=b[0],d=b[1],e=_b(a,b),f=0,g=0;return(c||0===c)&&(f=vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function bc(a){return a[1]-a[0]}function cc(a){for(var b=0;bb?0:b-c}function ic(a){var b,c=gc(a),d="y"===a.axis?gg:hg;return b="y"===a.axis||"y2"===a.axis?Yg?Of:"start"in a?d(a.start):Of:Yg?"end"in a?fg(vi?oe(a.end):a.end):Of:Of,c>b?0:b-c}function jc(a){return pg&&a===pg||te(qg)&&ue(qg,a)}function kc(a){return!jc(a)}function lc(a){return pg?pg:te(qg)?qg[a]:null}function mc(a,b){var c,d=b&&te(b)?Cc(b):[];return d.forEach(function(b){lc(b)===a&&(c=uf.data.xs[b])}),c}function nc(a,b){return a in uf.data.xs&&uf.data.xs[a]&&uf.data.xs[a][b]?uf.data.xs[a][b]:b}function oc(a){Object.keys(a).forEach(function(b){qg[b]=a[b]})}function pc(a){return 1===tf.set(Object.keys(a).map(function(b){return a[b]})).size()}function qc(a){var b;return a&&(b=tg[a.id],a.name=b?b:a.id),a}function rc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=tc(b[d],a.id,d)}),uf.data.xs[a.id]=b})}function sc(a,b){a.forEach(function(a){b[a.id]&&rc([a],b[a.id])})}function tc(a,b,c){var d;return d=vi?a?a instanceof Date?a:oe(a):oe(nc(b,c)):xi&&!wi?a?+a:nc(b,c):c}function uc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?uf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):pg?(d=Object.keys(uf.data.xs),uf.data.xs[c]=d.length>0?uf.data.xs[d[0]]:void 0):te(qg)&&(uf.data.xs[c]=mc(f,uf.data.targets)):uf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!uf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=sg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=lc(b),g=a[f],h=tc(g,b,e);return xi&&wi&&0===c&&g&&(0===e&&(ah=[]),ah.push(g)),("undefined"==typeof a[b]||uf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),xg&&Xd(Cc(c).filter(function(a){return!(a in yg)}),xg),c.forEach(function(a){dc(a.id_org,a)}),c}function xc(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 yc(a){return a>0&&uf.data.targets[0].values[a-1]?uf.data.targets[0].values[a-1].x:void 0}function zc(a){return a1?uf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?uf.data.targets[0]:null,a}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(uf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(vi?new Date(h):h);i.push(d)}return vi||(i=i.sort(function(a,b){return a-b})),i}function Lc(a){Gi=Gi.concat(a)}function Mc(a){Gi=Gi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Hi=Hi.concat(a)}function Oc(a){Hi=Hi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Dd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Dd(a,g))),Gd(e,b)):Ed(a,b,f,g)}function Fd(a,b){var c;return c=a.map(function(a){return Ed(a.values,b)}),Gd(c,b)}function Gd(a,b){var c,d;return a.forEach(function(a){var e=ve(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Hd(a,b){return tf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Id(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 Jd(){return Ag&&"desc"===Ag.toLowerCase()}function Kd(){return Ag&&"asc"===Ag.toLowerCase()}function Ld(a){var b=Kd(),c=Jd();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 Ag&&a.sort(Ag),a}function Md(a,c){var d,e,f,g,h,i,j,k=be(uf.data.targets),l=k?xd:wd,m=a.filter(function(a){return a&&b(a.value)});ii&&0!==m.length&&(dj.html(li(a,$(),l,Di)).style("display","block"),d=dj.property("offsetWidth"),e=dj.property("offsetHeight"),k?(g=Mf/2+c[0],i=Of/2+c[1]+20):(Yg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=fg(m[0].x)+20):(f=q(),g=f+t()+fg(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),dj.style("top",i+"px").style("left",g+"px"))}function Nd(){dj.style("display","none")}function Od(a){var c=a.filter(function(a){return a&&b(a.value)});ii&&($d(uf.data.targets)||be(uf.data.targets)||aj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Yg?"y1":"x1",zd).attr(Yg?"y2":"x2",zd))}function Pd(){aj.select("line."+f.xgridFocus).style("visibility","hidden")}function Qd(a){return a.x||0===a.x?fg(a.x):null}function Rd(a){return V(a.id)(a.value)}function Sd(){var a,b,d={},e=0;return Ic(Fc(ee)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Wd(a,b){return Uh?Uh:b?2*a.tickOffset()*Vh/b:0}function Xd(a,b){Dc(a).forEach(function(a){hj[a]=b===yg[a],yg[a]=b})}function Yd(a,b){var c=!1;return a.forEach(function(a){yg[a.id]===b&&(c=!0),a.id in yg||"line"!==b||(c=!0)}),c}function Zd(a){return Yd(a,"bar")}function $d(a){return Yd(a,"scatter")}function _d(a){return Yd(a,"pie")}function ae(a){return Yd(a,"donut")}function be(a){return _d(a)||ae(a)}function ce(a){var b="string"==typeof a?a:a.id;return!(b in yg)||"line"===yg[b]||"spline"===yg[b]||"area"===yg[b]||"area-spline"===yg[b]}function de(a){var b="string"==typeof a?a:a.id;return"spline"===yg[b]||"area-spline"===yg[b]}function ee(a){var b="string"==typeof a?a:a.id;return"bar"===yg[b]}function fe(a){var b="string"==typeof a?a:a.id;return"scatter"===yg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"pie"===yg[b]}function he(a){var b="string"==typeof a?a:a.id;return"donut"===yg[b]}function ie(a){return ge(a)||he(a)}function je(a){return ee(a)?a.values:[]}function ke(a){return ce(a)||fe(a)?a.values:[]}function le(a){return ee(a)||ce(a)?a.values:[]}function me(a){return he(a)&&ci||ge(a)&&Yh}function ne(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function oe(b){var c;try{c=rg?tf.time.format(rg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+rg)}return c}function pe(a,b){var c=tf.mouse(a),d=tf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function ue(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ve(a,b){var c="y"===Z(a.id)?gg:hg,d=Yg?1:0,e=Yg?0:1;return Math.pow(fg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function we(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function xe(a,b,c){Lg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd).attr("stroke",function(){return Di(b)}).attr("r",1.4*Sh).transition().duration(100).attr("r",Sh)}function ye(a,b,c){Mg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ze(a,b,c,d){a?xe(b,c,d):ye(b,c,d)}function Ae(a,b){Lg(b,a.node()),a.transition().duration(100).style("fill",function(){return tf.rgb(Di(b)).darker(1)})}function Be(a,b){Mg(b,a.node()),a.transition().duration(100).style("fill",function(){return Di(b)})}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a){return a.filter(function(a){return b(a.value)})}function Ee(a,c){return(c?aj.selectAll("."+f.circles+ld(c)):aj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Fe(a,b){Ee(a,b).classed(f.EXPANDED,!0).attr("r",Rh)}function Ge(a){Ee(a).filter(function(){return tf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oh)}function He(a){return aj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ie(a){He(a).classed(f.EXPANDED,!0)}function Je(a){He(a).classed(f.EXPANDED,!1)}function Ke(a,b){var c=Oe(a,b);return function(a,b){var d=c(a,b),e=Yg?1:0,f=Yg?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 Le(a,b){var c=Oe(a,!1),d=b?Me:Ne;return function(a,b){return d(c(a,b),a,this)}}function Me(a,b){var c;return Yg?(c=ee(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ne(a,b,c){var d=c.getBoundingClientRect();return Yg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ee(b)?-3:-6)}function Oe(a,b){var c=a.__max__+1,d=Wd(lg,c),e=Td(d,c,a,!!b),f=Ud(!!b),g=Vd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Yg&&(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 Pe(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 Qe(b){var c,d,e;if(ej=tf.select(wf),ej.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ej.html(""),ej.classed("c3",!0),uf.data.xs={},uf.data.targets=wc(b),n(),R(),fg.domain(tf.extent(ac(uf.data.targets))),gg.domain(Xb(uf.data.targets,"y")),hg.domain(Xb(uf.data.targets,"y2")),ig.domain(fg.domain()),jg.domain(gg.domain()),kg.domain(hg.domain()),fj=fg.domain(),Vi.scale(ig),Bf&&Zi.scale(fg),$i=ej.append("svg").attr("width",Mf+Jf.left+Jf.right).attr("height",Of+Jf.top+Jf.bottom).on("mouseenter",Ef).on("mouseleave",Ff),_i=$i.append("defs"),_i.append("clipPath").attr("id",pi).append("rect").attr("width",Mf).attr("height",Of),_i.append("clipPath").attr("id",qi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),_i.append("clipPath").attr("id",ri).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),aj=$i.append("g").attr("transform",Mi.main),bj=Pg?$i.append("g").attr("transform",Mi.context):null,cj=$i.append("g").attr("transform",Mi.legend),Sg||(cj.style("visibility","hidden"),Hi=Cc(uf.data.targets)),dj=tf.select(wf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),of(Cc(uf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Zg&&aj.append("g").attr("class",f.axisX).attr("clip-path",ti).attr("transform",Mi.x).append("text").attr("class",f.axisXLabel).attr("transform",Yg?"rotate(-90)":"").attr("dx",tb).attr("dy",wb).style("text-anchor",zb),ph&&aj.append("g").attr("class",f.axisY).attr("clip-path",ui).attr("transform",Mi.y).append("text").attr("class",f.axisYLabel).attr("transform",Yg?"":"rotate(-90)").attr("dx",ub).attr("dy",xb).style("text-anchor",Ab),yh&&aj.append("g").attr("class",f.axisY2).attr("transform",Mi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Yg?"":"rotate(-90)").attr("dx",vb).style("text-anchor",Bb),d=aj.append("g").attr("clip-path",si).attr("class",f.grid),Hh&&d.append("g").attr("class",f.xgrids),te(Jh)&&d.append("g").attr("class",f.xgridLines),Ph&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Kh&&d.append("g").attr("class",f.ygrids),te(Lh)&&d.append("g").attr("class",f.ygridLines),aj.append("g").attr("clip-path",si).attr("class",f.regions),aj.append("g").attr("clip-path",si).attr("class",f.chart),c=aj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Bf?Yg?"ns-resize":"ew-resize":null),aj.select("."+f.chart).append("g").attr("class",f.chartBars),aj.select("."+f.chart).append("g").attr("class",f.chartLines),aj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Mi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),aj.select("."+f.chart).append("g").attr("class",f.chartTexts),Bf&&aj.insert("rect",Df?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Mf).attr("height",Of).style("opacity",0).style("cursor",Yg?"ns-resize":"ew-resize").call(Zi).on("dblclick.zoom",null),nh&&Vi.extent("function"!=typeof nh?nh:nh(ac())),Pg&&(bj.append("g").attr("clip-path",si).attr("class",f.chart),bj.select("."+f.chart).append("g").attr("class",f.chartBars),bj.select("."+f.chart).append("g").attr("class",f.chartLines),bj.append("g").attr("clip-path",si).attr("class",f.brush).call(Vi).selectAll("rect").attr(Yg?"width":"height",Yg?Nf:Pf),bj.append("g").attr("class",f.axisX).attr("transform",Mi.subx).attr("clip-path",Yg?"":ti)),bf(uf.data.targets),Yg?aj.select("."+f.axisX).style("opacity",0).call(lg):(aj.select("."+f.axisY).style("opacity",0).call(mg),aj.select("."+f.axisY2).style("opacity",0).call(ng)),Xe({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),mi){if(vi&&"string"==typeof ni){for(ni=oe(ni),e=0;e0){d=[];for(var g in tg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Id(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ce,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 Ve(a){be(uf.data.targets)||Eg&&(yi=a,aj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),zi=!0,Ng())}function We(){be(uf.data.targets)||Eg&&(aj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),aj.selectAll("."+f.shape).classed(f.INCLUDED,!1),zi=!1,Og())}function Xe(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U=Sd(),V=be(uf.data.targets),W=Ic(uf.data.targets);if(0!==W.length){if(a=d(a)?a:{},z=d(a.withY)?a.withY:!0,A=d(a.withSubchart)?a.withSubchart:!0,B=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,C=d(a.withTransitionForExit)?a.withTransitionForExit:B,D=d(a.withTransitionForAxis)?a.withTransitionForAxis:B,E=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:B,O=B?If:0,P=C?O:0,Q=D?O:0,I&&Sg&&of(Cc(uf.data.targets),a),H&&(fg.domain(tf.extent(ac(W))),fj=fg.domain(),Bf&&Zi.scale(fg).updateScaleExtent(),ig.domain(fg.domain()),Vi.scale(ig)),G&&(fg.domain(Vi.empty()?fj:Vi.extent()),Bf&&Zi.scale(fg).updateScaleExtent()),gg.domain(Xb(W,"y")),hg.domain(Xb(W,"y2")),(gh||fh)&&(R=hh?hh:Kc(Jc(W)),lg.tickValues(R),og.tickValues(R)),c=aj.select("."+f.axisX).style("opacity",V?0:1),(Yg||E)&&(c=c.transition().duration(Q)),c.call(lg),g=aj.select("."+f.axisY).style("opacity",V?0:1),(!Yg||E)&&(g=g.transition().duration(Q)),g.call(mg),aj.select("."+f.axisY2).style("opacity",V?0:1).transition().duration(Q).call(ng),G)if(dh&&R){for(S=1;S=0&&tf.select(this).style("display",b%T?"none":"block")})}else tf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!Yg&&ih&&eb(c),J=Ke(U),M=Le(U,!0),N=Le(U,!1),Db(),jg.domain(gg.domain()),kg.domain(hg.domain()),dj.style("display","none"),o(),aj.select("line."+f.xgridFocus).style("visibility","hidden"),Hh){if("year"===Ih){i=[];for(var X=ac(),Y=X[0].getFullYear(),Z=X[1].getFullYear(),$=Y;Z>=$;$++)i.push(new Date($+"-01-01 00:00:00"))}else i=fg.ticks(10);h=aj.select("."+f.xgrids).selectAll("."+f.xgrid).data(i),h.enter().append("line").attr("class",f.xgrid),h.attr("x1",Yg?0:function(a){return fg(a)-lg.tickOffset()}).attr("x2",Yg?Mf:function(a){return fg(a)-lg.tickOffset()}).attr("y1",Yg?function(a){return fg(a)-lg.tickOffset()}:Jf.top).attr("y2",Yg?function(a){return fg(a)-lg.tickOffset()}:Of).style("opacity",function(){return+tf.select(this).attr(Yg?"y1":"x1")===(Yg?Of:0)?0:1}),h.exit().remove()}te(Jh)&&(j=aj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Jh),k=j.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),k.append("line").style("opacity",0),k.append("text").attr("text-anchor","end").attr("transform",Yg?"":"rotate(-90)").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),j.select("line").transition().duration(O).attr("x1",Yg?0:Ad).attr("x2",Yg?Mf:Ad).attr("y1",Yg?Ad:Jf.top).attr("y2",Yg?Ad:Of).style("opacity",1),j.select("text").transition().duration(O).attr("x",Yg?Mf:0).attr("y",Ad).text(function(a){return a.text}).style("opacity",1),j.exit().transition().duration(O).style("opacity",0).remove()),z&&Kh&&(l=aj.select("."+f.ygrids).selectAll("."+f.ygrid).data(gg.ticks(Mh)),l.enter().append("line").attr("class",f.ygrid),l.attr("x1",Yg?gg:0).attr("x2",Yg?gg:Mf).attr("y1",Yg?0:gg).attr("y2",Yg?Of:gg),l.exit().remove()),z&&te(Lh)&&(m=aj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Lh),n=m.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),n.append("line").style("opacity",0),n.append("text").attr("text-anchor","end").attr("transform",Yg?"rotate(-90)":"").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),m.select("line").transition().duration(O).attr("x1",Yg?Bd:0).attr("x2",Yg?Bd:Mf).attr("y1",Yg?0:Bd).attr("y2",Yg?Of:Bd).style("opacity",1),m.select("text").transition().duration(O).attr("x",Yg?0:Mf).attr("y",Bd).text(function(a){return a.text}).style("opacity",1),m.exit().transition().duration(O).style("opacity",0).remove()),q=aj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),q.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Di(a)}).attr("class",ad),q.style("opacity",qd).transition().duration(O).attr("d",J).style("opacity",1),q.exit().transition().duration(P).style("opacity",0).remove(),s=aj.selectAll("."+f.texts).selectAll("."+f.text).data(le),s.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return Yg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),s.text(function(a){return yd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(O).attr("x",M).attr("y",N).style("fill-opacity",td),s.exit().transition().duration(P).style("fill-opacity",0).remove(),aj.selectAll("."+f.line).style("opacity",qd).transition().duration(O).attr("d",Wi).style("opacity",1),aj.selectAll("."+f.area).style("opacity",0).transition().duration(O).attr("d",Xi).style("opacity",gj),p=aj.selectAll("."+f.circles).selectAll("."+f.circle).data(ke),p.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Oh),p.style("opacity",qd).transition().duration(O).style("opacity",sd).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),p.exit().remove(),aj.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(O).attrTween("d",function(a){var b,c=Fb(a);return c?(b=tf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1),aj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(O).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&ie(a.data)?1:0}),aj.select("."+f.chartArcsTitle).style("opacity",ae(uf.data.targets)?1:0),Pg&&(null!==tf.event&&"zoom"===tf.event.type&&Vi.extent(fg.orgDomain()).update(),A&&(e=bj.select("."+f.axisX).style("opacity",V?0:1),(Yg||E)&&(e=e.transition().duration(Q)),e.call(og),!Yg&&ih&&eb(e),Vi.empty()||Vi.extent(fg.orgDomain()).update(),K=Ke(U,!0),t=bj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),t.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Di(a)}).attr("class",ad),t.style("opacity",qd).transition().duration(O).attr("d",K).style("opacity",1),t.exit().transition().duration(O).style("opacity",0).remove(),bj.selectAll("."+f.line).style("opacity",qd).transition().duration(O).attr("d",Yi).style("opacity",1))),aj.selectAll("."+f.selectedCircles).filter(function(a){return ee(a)}).selectAll("circle").remove(),aj.selectAll("."+f.selectedCircle).transition().duration(O).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),u=aj.select("."+f.eventRects),te(qg)&&!pc(qg)?(u.classed(f.eventRectsMultiple)||u.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),v=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Se(v.enter()),v.attr("x",0).attr("y",0).attr("width",Mf).attr("height",Of)):(u.classed(f.eventRectsSingle)||u.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),xi&&!wi?(y=function(a,b){var c=yc(b),d=zc(b),e=uf.data.xs[a.id][b];return(fg(d?d:e+50)-fg(c?c:e-50))/2},x=function(a,b){var c=yc(b),d=uf.data.xs[a.id][b];return(fg(d)+fg(c?c:d-50))/2}):(y=L(),x=function(a){return fg(a.x)-y/2}),w=Bc(),aj.select("."+f.eventRects).datum(w?w.values:[]),v=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Re(v.enter()),v.attr("class",fd).attr("x",Yg?0:x).attr("y",Yg?x:0).attr("width",Yg?Mf:y).attr("height",Yg?y:Of),v.exit().remove()),r=aj.select("."+f.regions).selectAll("rect."+f.region).data(hi),r.enter().append("rect").style("fill-opacity",0),r.attr("class",ed).attr("x",fc).attr("y",gc).attr("width",hc).attr("height",ic).transition().duration(O).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Cc(uf.data.targets).forEach(function(a){hj[a]=!0})}}function Ye(){Xe({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ze(){return"mousemove"===tf.event.sourceEvent.type&&Zi.altDomain?(fg.domain(Zi.altDomain),void Zi.scale(fg).updateScaleExtent()):(wi&&fg.orgDomain()[0]===fj[0]&&fg.domain([fj[0]-1e-10,fg.orgDomain()[1]]),Xe({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===tf.event.sourceEvent.type&&(Ai=!0)))}function $e(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function _e(){$i.attr("width",Qf).attr("height",Rf),$i.select("#"+pi).select("rect").attr("width",Mf).attr("height",Of),$i.select("#"+qi).select("rect").attr("width",H),$i.select("#"+ri).select("rect").attr("width",J),$i.select("."+f.zoomRect).attr("width",Mf).attr("height",Of)}function af(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),_e(),m(a.withTransition),Xe(a)}function bf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=aj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Di(a)}),e=aj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("fill",function(a){return Di(a)}).style("stroke","none").style("cursor",function(a){return Gg(a)?"pointer":null}),c=aj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)}),b.append("path").attr("class",dd).style("opacity",function(){return gj=+tf.select(this).style("opacity"),0}).style("fill",function(a){return Di(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Di(a)}).style("cursor",function(a){return Gg(a)?"pointer":null}),a.forEach(function(a){aj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=aj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Yf(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Di(a.data)}).style("cursor",function(a){return Gg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Fb(a),d=Lb(c),e=Tb();Nb(c.data.id),jf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Fb(a),c=[Lb(b)];Md(c,tf.mouse(this))}).on("mouseout",function(a,b){var c=Fb(a),d=Lb(c),e=Ub();Ob(c.data.id),lf(),Nd(),e(d,b)}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Pg&&(n=bj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Di(a)}),l=bj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)})),$i.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function cf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Xd(a.id,b.types[a.id]):Xd(a.id,b.type)}),uf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Ni?j:i,l=Ni?Q():P();return d&&(w=0,C=0,t=0,u=0),Sg&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Ni?u:t,void(Xg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,Ni?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=cj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Ug?Ug(a):uf.toggle(a)}).on("mouseover",function(a){uf.focus(a),"function"==typeof Vg&&Vg(a)}).on("mouseout",function(a){uf.revert(),"function"==typeof Wg&&Wg(a)}),l.append("text").text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",Ni?g:-200).attr("y",Ni?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ni?h:-200).attr("y",Ni?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Di(a)}).attr("x",Ni?g:-200).attr("y",Ni?-200:i).attr("width",10).attr("height",10),cj.selectAll("text").data(a).text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),cj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),cj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),_e(),q&&m(p)}function pf(a){return Ec(uf.data.targets,a.id)}function qf(a){return"data"in a&&Ec(uf.data.targets,a.data.id)}function rf(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 sf(a,b,c){var d=!be(uf.data.targets);Xd(a,b),af(c?c:{withTransitionForAxis:d})}var tf=a.d3?a.d3:a.require?a.require("d3"):void 0,uf={data:{},axis:{},legend:{}},vf={},wf=h(["bindto"],"#chart"),xf=h(["size","width"]),yf=h(["size","height"]),zf=h(["padding","left"]),Af=h(["padding","right"]),Bf=h(["zoom","enabled"],!1),Cf=h(["zoom","extent"]),Df=h(["zoom","privileged"],!1),Ef=h(["onenter"],function(){}),Ff=h(["onleave"],function(){}),Gf=h(["onresize"],function(){}),Hf=h(["onresized"],function(){}),If=h(["transition","duration"],350);g("data","data is required in config");var Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg=h(["data","x"]),qg=h(["data","xs"],{}),rg=h(["data","x_format"]),sg=h(["data","id_converter"],function(a){return a}),tg=h(["data","names"],{}),ug=h(["data","classes"],{}),vg=h(["data","groups"],[]),wg=h(["data","axes"],{}),xg=h(["data","type"]),yg=h(["data","types"],{}),zg=h(["data","labels"],{}),Ag=h(["data","order"]),Bg=h(["data","regions"],{}),Cg=h(["data","color"]),Dg=h(["data","colors"],{}),Eg=h(["data","selection","enabled"],!1),Fg=h(["data","selection","grouped"],!1),Gg=h(["data","selection","isselectable"],function(){return!0}),Hg=h(["data","selection","multiple"],!0),Ig=h(["data","onclick"],function(){}),Jg=h(["data","onenter"],function(){}),Kg=h(["data","onleave"],function(){}),Lg=h(["data","onselected"],function(){}),Mg=h(["data","onunselected"],function(){}),Ng=h(["data","ondragstart"],function(){}),Og=h(["data","ondragend"],function(){}),Pg=h(["subchart","show"],!1),Qg=h(["subchart","size","height"],60),Rg=h(["color","pattern"],[]),Sg=h(["legend","show"],!0),Tg=h(["legend","position"],"bottom"),Ug=h(["legend","item","onclick"]),Vg=h(["legend","item","onmouseover"]),Wg=h(["legend","item","onmouseout"]),Xg=h(["legend","equally"],!1),Yg=h(["axis","rotated"],!1),Zg=h(["axis","x","show"],!0),$g=h(["axis","x","type"],"indexed"),_g=h(["axis","x","localtime"],!0),ah=h(["axis","x","categories"],[]),bh=h(["axis","x","tick","centered"],!1),ch=h(["axis","x","tick","format"]),dh=h(["axis","x","tick","culling"],{}),eh=h(["axis","x","tick","culling","max"],10),fh=h(["axis","x","tick","count"]),gh=h(["axis","x","tick","fit"],!0),hh=h(["axis","x","tick","values"],null),ih=h(["axis","x","tick","rotate"]),jh=h(["axis","x","max"]),kh=h(["axis","x","min"]),lh=h(["axis","x","padding"],{}),mh=h(["axis","x","height"]),nh=h(["axis","x","default"]),oh=h(["axis","x","label"],{}),ph=h(["axis","y","show"],!0),qh=h(["axis","y","max"]),rh=h(["axis","y","min"]),sh=h(["axis","y","center"]),th=h(["axis","y","label"],{}),uh=h(["axis","y","inner"],!1),vh=h(["axis","y","tick","format"]),wh=h(["axis","y","padding"],{}),xh=h(["axis","y","ticks"],10),yh=h(["axis","y2","show"],!1),zh=h(["axis","y2","max"]),Ah=h(["axis","y2","min"]),Bh=h(["axis","y2","center"]),Ch=h(["axis","y2","label"],{}),Dh=h(["axis","y2","inner"],!1),Eh=h(["axis","y2","tick","format"]),Fh=h(["axis","y2","padding"],{}),Gh=h(["axis","y2","ticks"],10),Hh=h(["grid","x","show"],!1),Ih=h(["grid","x","type"],"tick"),Jh=h(["grid","x","lines"],[]),Kh=h(["grid","y","show"],!1),Lh=h(["grid","y","lines"],[]),Mh=h(["grid","y","ticks"],10),Nh=h(["point","show"],!0),Oh=Nh?h(["point","r"],2.5):0,Ph=h(["point","focus","line","enabled"],!0),Qh=h(["point","focus","expand","enabled"],!0),Rh=h(["point","focus","expand","r"],Qh?4:Oh),Sh=h(["point","focus","select","r"],8),Th=h(["line","connect_null"],!1),Uh=h(["bar","width"]),Vh=h(["bar","width","ratio"],.6),Wh=h(["pie","label","show"],!0),Xh=h(["pie","label","format"]),Yh=h(["pie","expand"],!0),Zh=h(["pie","onclick"],function(){}),$h=h(["pie","onmouseover"],function(){}),_h=h(["pie","onmouseout"],function(){}),ai=h(["donut","label","show"],!0),bi=h(["donut","label","format"]),ci=h(["donut","expand"],!0),di=h(["donut","title"],""),ei=h(["donut","onclick"],function(){}),fi=h(["donut","onmouseover"],function(){}),gi=h(["donut","onmouseout"],function(){}),hi=h(["regions"],[]),ii=h(["tooltip","show"],!0),ji=h(["tooltip","format","title"]),ki=h(["tooltip","format","value"]),li=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ji?ji:b,l=ki?ki: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+""}),mi=h(["tooltip","init","show"],!1),ni=h(["tooltip","init","x"],0),oi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),pi=("string"==typeof wf?wf.replace("#",""):wf.id)+"-clip",qi=pi+"-xaxis",ri=pi+"-yaxis",si=i(pi),ti=i(qi),ui=i(ri),vi="timeseries"===$g,wi="categorized"===$g,xi=!vi&&(pg||te(qg)),yi=null,zi=!1,Ai=!1,Bi=!1,Ci=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Di=ne(Dg,te(Rg)?Rg:Ci,Cg),Ei=_g?tf.time.format:tf.time.format.utc,Fi=function(){var a=[[Ei("%Y/%-m/%-d"),function(){return!0}],[Ei("%-m/%-d"),function(a){return a.getMonth()}],[Ei("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ei("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ei("%I %p"),function(a){return a.getHours()}],[Ei("%I:%M"),function(a){return a.getMinutes()}],[Ei(":%S"),function(a){return a.getSeconds()}],[Ei(".%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)}}(),Gi=[],Hi=[],Ii=Yg?"left":"bottom",Ji=Yg?uh?"top":"bottom":uh?"right":"left",Ki=Yg?Dh?"bottom":"top":Dh?"left":"right",Li=Yg?"left":"bottom",Mi={main:function(){return"translate("+Jf.left+","+Jf.top+")"},context:function(){return"translate("+Kf.left+","+Kf.top+")"},legend:function(){return"translate("+Lf.left+","+Lf.top+")"},x:function(){return"translate(0,"+(Yg?0:Of)+")"},y:function(){return"translate(0,"+(Yg?Of:0)+")"},y2:function(){return"translate("+(Yg?0:Mf)+","+(Yg?1:0)+")"},subx:function(){return"translate(0,"+(Yg?0:Pf)+")"},arc:function(){return"translate("+Mf/2+","+Of/2+")"}},Ni="right"===Tg,Oi=0,Pi=0,Qi=0,Ri=.15,Si=30,Ti=Yg&&!Zg?0:30,Ui=5;Yf=tf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Vi,Wi=function(){var a=tf.svg.line().x(Yg?function(a){return V(a.id)(a.value)}:zd).y(Yg?zd:function(a){return V(a.id)(a.value)});return Th||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Th?De(b.values):b.values;return ce(b)?(a.interpolate(de(b)?"cardinal":"linear"),Bg[b.id]?Pe(e,fg,V(b.id),Bg[b.id]):a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Xi=function(){var a;return a=Yg?tf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(zd):tf.svg.area().x(zd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=De(b.values);return Yd([b],"area")||Yd([b],"area-spline")?(a.interpolate(de(b)?"cardinal":"linear"),a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Yi=function(){var a=tf.svg.line().x(Yg?function(a){return W(a.id)(a.value)}:Cd).y(Yg?Cd:function(a){return W(a.id)(a.value)});return function(b){var c=De(b.values);return ce(b)?a(c):"M "+ig(c[0].x)+" "+W(b.id)(c[0].value)}}(),Zi=function(){};Vi=tf.svg.brush().on("brush",Ye),Vi.update=function(){return bj&&bj.select("."+f.brush).call(this),this},Vi.scale=function(a){return Yg?this.y(a):this.x(a)},Bf&&(Zi=tf.behavior.zoom().on("zoomstart",function(){Zi.altDomain=tf.event.sourceEvent.altKey?fg.orgDomain():null}).on("zoom",Bf?Ze:null),Zi.scale=function(a){return Yg?this.y(a):this.x(a)},Zi.orgScaleExtent=function(){var a=Cf?Cf:[1,10];return[a[0],Math.max(Ac()/a[1],a[1])]},Zi.updateScaleExtent=function(){var a=bc(fg.orgDomain())/bc(fj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var $i,_i,aj,bj,cj,dj,ej,fj,gj,hj={};if(uf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),uf.defocus(),b(d.classed(f.focused,!0)),b(e),be(uf.data.targets)&&Nb(a,!0),jf(a)},uf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),kf(a)},uf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),lf()},uf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),$i.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?mf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},uf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),$i.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?nf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Ri),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},uf.toggle=function(a){Gc(a)?uf.hide(a):uf.show(a)},uf.unzoom=function(){Vi.clear().update(),Xe({withUpdateXDomain:!0})},uf.load=function(a){return a.xs&&oc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){ug[b]=a.classes[b]}),"categories"in a&&wi&&(ah=a.categories,lg.categories(ah)),"cacheIds"in a&&cc(a.cacheIds)?void cf(ec(a.cacheIds),a.done):void("unload"in a?ef(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){df(a)}):df(a))},uf.unload=function(a){ef(Dc(a),function(){Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},uf.selected=function(a){return tf.merge(aj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return tf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},uf.select=function(a,b,c){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=tf.select(this),i="circle"===this.nodeName?xe:Ae,j="circle"===this.nodeName?ye:Be,k=Fg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Gg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},uf.unselect=function(a,b){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=tf.select(this),g="circle"===this.nodeName?ye:Be,h=Fg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Gg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},uf.toLine=function(a){sf(a,"line")},uf.toSpline=function(a){sf(a,"spline")},uf.toBar=function(a){sf(a,"bar")},uf.toScatter=function(a){sf(a,"scatter")},uf.toArea=function(a){sf(a,"area")},uf.toAreaSpline=function(a){sf(a,"area-spline")},uf.toPie=function(a){sf(a,"pie",{withTransform:!0})},uf.toDonut=function(a){sf(a,"donut",{withTransform:!0})},uf.groups=function(a){return c(a)?vg:(vg=a,Xe(),vg)},uf.xgrids=function(a){return a?(Jh=a,Xe(),Jh):Jh},uf.xgrids.add=function(a){return a?uf.xgrids(Jh.concat(a)):void 0},uf.xgrids.remove=function(a){var b=rf(a);return uf.xgrids(Jh.filter(b))},uf.ygrids=function(a){return a?(Lh=a,Xe(),Lh):Lh},uf.ygrids.add=function(a){return a?uf.ygrids(Lh.concat(a)):void 0},uf.ygrids.remove=function(a){var b=rf(a); return uf.ygrids(Lh.filter(b))},uf.regions=function(a){return c(a)?hi:(hi=a,Xe(),hi)},uf.regions.add=function(a){return c(a)?hi:(hi=hi.concat(a),Xe(),hi)},uf.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;$i.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),hi=hi.filter(function(b){return b.classes.indexOf(a)<0})}),hi},uf.data.get=function(a){var b=uf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},uf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},uf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){tg[b]=a[b]}),of(Cc(uf.data.targets),{withTransition:!0}),tg):tg},uf.x=function(a){return arguments.length&&(rc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.xs=function(a){return arguments.length&&(sc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},uf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(qh=+a.y),b(a.y2)&&(zh=+a.y2)):qh=zh=+a,Xe())},uf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(rh=+a.y),b(a.y2)&&(Ah=+a.y2)):rh=Ah=+a,Xe())},uf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&uf.axis.max(a.max),"undefined"!=typeof a.min&&uf.axis.min(a.min))},uf.legend.show=function(a){Sg||(Sg=!0,cj.style("visibility","visible")),mf(Dc(a)),Xe({withTransitionForHorizontalAxis:!1})},uf.legend.hide=function(a){Sg&&se(a)&&(Sg=!1,cj.style("visibility","hidden")),nf(Dc(a)),Xe({withTransitionForHorizontalAxis:!1})},uf.resize=function(a){xf=a?a.width:null,yf=a?a.height:null,af({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},uf.destroy=function(){uf.data.targets=void 0,uf.data.xs={},ej.html(""),a.onresize=null},"url"in e.data)tf.xhr(e.data.url,function(a,b){var c,d=tf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=tf.csv.parse(b.response),Qe(c)});else if("rows"in e.data)Qe(uc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Qe(vc(e.data.columns))}return uf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From d1b316983a55713d26e17dec7540d6849f34539e Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Thu, 24 Apr 2014 11:45:33 +0900 Subject: [PATCH 061/178] Fix x min/max when timeseries - #171 --- c3.js | 4 ++-- c3.min.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/c3.js b/c3.js index cb1e866..a5184c4 100644 --- a/c3.js +++ b/c3.js @@ -1246,10 +1246,10 @@ return isSub || currentDiff === 0 ? 1 : orgDiff / currentDiff; } function getXDomainMin(targets) { - return __axis_x_min ? __axis_x_min : d3.min(targets, function (t) { return d3.min(t.values, function (v) { return v.x; }); }); + return __axis_x_min ? (isTimeSeries ? parseDate(__axis_x_min) : __axis_x_min) : d3.min(targets, function (t) { return d3.min(t.values, function (v) { return v.x; }); }); } function getXDomainMax(targets) { - return __axis_x_max ? __axis_x_max : d3.max(targets, function (t) { return d3.max(t.values, function (v) { return v.x; }); }); + return __axis_x_max ? (isTimeSeries ? parseDate(__axis_x_max) : __axis_x_max) : d3.max(targets, function (t) { return d3.max(t.values, function (v) { return v.x; }); }); } function getXDomainPadding(targets, domain) { var firstX = domain[0], lastX = domain[1], diff = Math.abs(firstX - lastX), maxDataCount, padding, paddingLeft, paddingRight; diff --git a/c3.min.js b/c3.min.js index c9fbe91..2c70380 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.32"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cMf&&(Mf=0),0>Of&&(Of=0),Nf=Yg?Jf.left-Si-Ti:Mf,Pf=Yg?Of:Rf-Kf.top-Kf.bottom,0>Nf&&(Nf=0),0>Pf&&(Pf=0),p(),Ni&&be(uf.data.targets)&&(Lf.left=Mf/2+Tf)}function o(){aj.select("line."+f.xgridFocus).attr("x1",Yg?0:-10).attr("x2",Yg?Mf:-10).attr("y1",Yg?-10:Jf.top).attr("y2",Yg?-10:Of)}function p(){Tf=Of/2,Sf=.95*Tf,Uf=ae(uf.data.targets)?.6*Sf:0}function q(){var a=Yg?f.axisX:f.axisY,b=tf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=tf.select(wf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return xf?xf:x()}function s(){var a=yf?yf:y();return a>0?a:320}function t(){return be(uf.data.targets)?0:zf?zf:Yg||!ph||uh?1:v("y")}function u(){var a=1;return be(uf.data.targets)?0:Af?Af:Ni?P()+(yh&&!Yg?v("y2"):a):yh?Dh||Yg?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||Zg?"x"===a&&mh?mh:"y"!==a||ph?"y2"!==a||yh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Ui:Sg&&!Ni?10:1:0}function x(){return+tf.select(wf).style("width").replace("px","")}function y(){return+tf.select(wf).style("height").replace("px","")}function z(a){return a?-5:-(Jf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Yg)}function C(){return A(!Yg)}function D(){return z(Yg)}function E(){return A(Yg)}function F(a){return a?Mf+2+4:Jf.left+20}function G(a){return a?(mh?mh:0)+40:Of+2}function H(){return F(!Yg)}function I(){return G(!Yg)}function J(){return F(Yg)}function K(){return G(Yg)}function L(){var a=Yg?Of:Mf,b=Ac(),c=Yb()*(Zd(uf.data.targets)?(b-(wi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){Oi=a}function N(a){Pi=a}function O(a){Qi=a}function P(){return Sg?Ni?Pi*(Oi+1):Qf:0}function Q(){return Sg?Ni?Rf:Qi*(Oi+1):0}function R(){var a,b=!fg;Zf=Yg?1:0,$f=Yg?Of:Mf,_f=Yg?0:Of,ag=Yg?Mf:1,bg=Zf,cg=$f,dg=Yg?0:Pf,eg=Yg?Nf:1,fg=T(Zf,$f,b?void 0:fg.domain(),function(){return lg.tickOffset()}),gg=U(_f,ag),hg=U(_f,ag),ig=T(Zf,$f,fj,function(a){return a%1?0:og.tickOffset()}),jg=U(dg,eg),kg=U(dg,eg),a=$(),lg=X(fg,Ii,a),og=X(ig,Li,a),mg=Y(gg,Ji,vh,xh),ng=Y(hg,Ki,Eh,Gh),b||(Vi.scale(ig),Bf&&Zi.scale(fg)),S()}function S(){Vf=Gb(),Wf=Hb(),Xf=Hb(.98)}function T(a,b,e,f){var g=(vi?tf.time.scale():tf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),wi){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return tf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?hg:gg}function W(a){return"y2"===Z(a)?kg:jg}function X(a,b,c){var d=(wi?Eb():tf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),wi?(d.tickCentered(bh),se(dh)&&(dh=!1)):d.tickOffset=function(){var a=Yg?Of:Mf;return a*Yb()/Ac()/2},wi&&d.categories(ah),d}function Y(a,b,c,d){return tf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in wg?wg[a]:"y"}function $(){var a=vi?Fi:wi?Tc:function(a){return 0>a?a.toFixed(0):a};return ch&&("function"==typeof ch?a=ch:vi&&(a=function(a){return a?Ei(ch)(a):""})),a}function _(a){var b;return"y"===a?b=th:"y2"===a?b=Ch:"x"===a&&(b=oh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?th=b:"y2"===a?Ch=b:"x"===a&&(oh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a){a.selectAll(".tick text").attr("y",db(ih)).attr("x",cb(ih)).attr("transform","rotate("+ih+")").style("text-anchor","start")}function fb(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 gb(){return fb("x",Yg?"inner-top":"inner-right")}function hb(){return fb("y",Yg?"inner-right":"inner-top")}function ib(){return fb("y2",Yg?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Mf/2:Mf:b.isBottom?-Of:b.isMiddle?-Of/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!Yg,gb())}function rb(){return nb(Yg,hb())}function sb(){return nb(Yg,ib())}function tb(){return ob(!Yg,gb())}function ub(){return ob(Yg,hb())}function vb(){return ob(Yg,ib())}function wb(){var a=gb();return Yg?a.isInner?"1.2em":-30-Cb("x"):a.isInner?"-0.5em":"3em"}function xb(){var a=hb();return Yg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return Yg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!Yg,gb())}function Ab(){return pb(Yg,hb())}function Bb(){return pb(Yg,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return tf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Db(){aj.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).text(kb),aj.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dy",xb).text(lb),aj.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dy",yb).text(mb)}function Eb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+o)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Rc(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 tf.min(Object.keys(i).map(function(a){return tf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(vg.length>0)for(g=Sc(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 tf.max(Object.keys(i).map(function(a){return tf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Ah:rh,n="y2"===c?zh:qh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Bh:sh,r=ud()&&Yg;return 0===l.length?"y2"===c?hg.domain():gg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=bc(gg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&wh&&(f=b(wh.top)?wh.top:e,g=b(wh.bottom)?wh.bottom:e),"y2"===c&&Fh&&(f=b(Fh.top)?Fh.top:e,g=b(Fh.bottom)?Fh.bottom:e),Zd(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){var b=bc(fj),c=bc(fg.domain());return a||0===c?1:b/c}function Zb(a){return kh?kh:tf.min(a,function(a){return tf.min(a.values,function(a){return a.x})})}function $b(a){return jh?jh:tf.max(a,function(a){return tf.max(a.values,function(a){return a.x})})}function _b(a,c){var d,e,f,g,h=c[0],i=c[1],j=Math.abs(h-i);return wi?e=0:Zd(a)?(d=Ac(),e=d>1?j/(d-1)/2:.5):e=.01*j,"object"==typeof lh&&te(lh)?(f=b(lh.left)?lh.left:e,g=b(lh.right)?lh.right:e):f=g="number"==typeof lh?lh:e,{left:f,right:g}}function ac(a){var b=[Zb(a),$b(a)],c=b[0],d=b[1],e=_b(a,b),f=0,g=0;return(c||0===c)&&(f=vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function bc(a){return a[1]-a[0]}function cc(a){for(var b=0;bb?0:b-c}function ic(a){var b,c=gc(a),d="y"===a.axis?gg:hg;return b="y"===a.axis||"y2"===a.axis?Yg?Of:"start"in a?d(a.start):Of:Yg?"end"in a?fg(vi?oe(a.end):a.end):Of:Of,c>b?0:b-c}function jc(a){return pg&&a===pg||te(qg)&&ue(qg,a)}function kc(a){return!jc(a)}function lc(a){return pg?pg:te(qg)?qg[a]:null}function mc(a,b){var c,d=b&&te(b)?Cc(b):[];return d.forEach(function(b){lc(b)===a&&(c=uf.data.xs[b])}),c}function nc(a,b){return a in uf.data.xs&&uf.data.xs[a]&&uf.data.xs[a][b]?uf.data.xs[a][b]:b}function oc(a){Object.keys(a).forEach(function(b){qg[b]=a[b]})}function pc(a){return 1===tf.set(Object.keys(a).map(function(b){return a[b]})).size()}function qc(a){var b;return a&&(b=tg[a.id],a.name=b?b:a.id),a}function rc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=tc(b[d],a.id,d)}),uf.data.xs[a.id]=b})}function sc(a,b){a.forEach(function(a){b[a.id]&&rc([a],b[a.id])})}function tc(a,b,c){var d;return d=vi?a?a instanceof Date?a:oe(a):oe(nc(b,c)):xi&&!wi?a?+a:nc(b,c):c}function uc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?uf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):pg?(d=Object.keys(uf.data.xs),uf.data.xs[c]=d.length>0?uf.data.xs[d[0]]:void 0):te(qg)&&(uf.data.xs[c]=mc(f,uf.data.targets)):uf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!uf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=sg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=lc(b),g=a[f],h=tc(g,b,e);return xi&&wi&&0===c&&g&&(0===e&&(ah=[]),ah.push(g)),("undefined"==typeof a[b]||uf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),xg&&Xd(Cc(c).filter(function(a){return!(a in yg)}),xg),c.forEach(function(a){dc(a.id_org,a)}),c}function xc(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 yc(a){return a>0&&uf.data.targets[0].values[a-1]?uf.data.targets[0].values[a-1].x:void 0}function zc(a){return a1?uf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?uf.data.targets[0]:null,a}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(uf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(vi?new Date(h):h);i.push(d)}return vi||(i=i.sort(function(a,b){return a-b})),i}function Lc(a){Gi=Gi.concat(a)}function Mc(a){Gi=Gi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Hi=Hi.concat(a)}function Oc(a){Hi=Hi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Dd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Dd(a,g))),Gd(e,b)):Ed(a,b,f,g)}function Fd(a,b){var c;return c=a.map(function(a){return Ed(a.values,b)}),Gd(c,b)}function Gd(a,b){var c,d;return a.forEach(function(a){var e=ve(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Hd(a,b){return tf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Id(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 Jd(){return Ag&&"desc"===Ag.toLowerCase()}function Kd(){return Ag&&"asc"===Ag.toLowerCase()}function Ld(a){var b=Kd(),c=Jd();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 Ag&&a.sort(Ag),a}function Md(a,c){var d,e,f,g,h,i,j,k=be(uf.data.targets),l=k?xd:wd,m=a.filter(function(a){return a&&b(a.value)});ii&&0!==m.length&&(dj.html(li(a,$(),l,Di)).style("display","block"),d=dj.property("offsetWidth"),e=dj.property("offsetHeight"),k?(g=Mf/2+c[0],i=Of/2+c[1]+20):(Yg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=fg(m[0].x)+20):(f=q(),g=f+t()+fg(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),dj.style("top",i+"px").style("left",g+"px"))}function Nd(){dj.style("display","none")}function Od(a){var c=a.filter(function(a){return a&&b(a.value)});ii&&($d(uf.data.targets)||be(uf.data.targets)||aj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Yg?"y1":"x1",zd).attr(Yg?"y2":"x2",zd))}function Pd(){aj.select("line."+f.xgridFocus).style("visibility","hidden")}function Qd(a){return a.x||0===a.x?fg(a.x):null}function Rd(a){return V(a.id)(a.value)}function Sd(){var a,b,d={},e=0;return Ic(Fc(ee)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Wd(a,b){return Uh?Uh:b?2*a.tickOffset()*Vh/b:0}function Xd(a,b){Dc(a).forEach(function(a){hj[a]=b===yg[a],yg[a]=b})}function Yd(a,b){var c=!1;return a.forEach(function(a){yg[a.id]===b&&(c=!0),a.id in yg||"line"!==b||(c=!0)}),c}function Zd(a){return Yd(a,"bar")}function $d(a){return Yd(a,"scatter")}function _d(a){return Yd(a,"pie")}function ae(a){return Yd(a,"donut")}function be(a){return _d(a)||ae(a)}function ce(a){var b="string"==typeof a?a:a.id;return!(b in yg)||"line"===yg[b]||"spline"===yg[b]||"area"===yg[b]||"area-spline"===yg[b]}function de(a){var b="string"==typeof a?a:a.id;return"spline"===yg[b]||"area-spline"===yg[b]}function ee(a){var b="string"==typeof a?a:a.id;return"bar"===yg[b]}function fe(a){var b="string"==typeof a?a:a.id;return"scatter"===yg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"pie"===yg[b]}function he(a){var b="string"==typeof a?a:a.id;return"donut"===yg[b]}function ie(a){return ge(a)||he(a)}function je(a){return ee(a)?a.values:[]}function ke(a){return ce(a)||fe(a)?a.values:[]}function le(a){return ee(a)||ce(a)?a.values:[]}function me(a){return he(a)&&ci||ge(a)&&Yh}function ne(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function oe(b){var c;try{c=rg?tf.time.format(rg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+rg)}return c}function pe(a,b){var c=tf.mouse(a),d=tf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function ue(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ve(a,b){var c="y"===Z(a.id)?gg:hg,d=Yg?1:0,e=Yg?0:1;return Math.pow(fg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function we(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function xe(a,b,c){Lg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd).attr("stroke",function(){return Di(b)}).attr("r",1.4*Sh).transition().duration(100).attr("r",Sh)}function ye(a,b,c){Mg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ze(a,b,c,d){a?xe(b,c,d):ye(b,c,d)}function Ae(a,b){Lg(b,a.node()),a.transition().duration(100).style("fill",function(){return tf.rgb(Di(b)).darker(1)})}function Be(a,b){Mg(b,a.node()),a.transition().duration(100).style("fill",function(){return Di(b)})}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a){return a.filter(function(a){return b(a.value)})}function Ee(a,c){return(c?aj.selectAll("."+f.circles+ld(c)):aj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Fe(a,b){Ee(a,b).classed(f.EXPANDED,!0).attr("r",Rh)}function Ge(a){Ee(a).filter(function(){return tf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oh)}function He(a){return aj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ie(a){He(a).classed(f.EXPANDED,!0)}function Je(a){He(a).classed(f.EXPANDED,!1)}function Ke(a,b){var c=Oe(a,b);return function(a,b){var d=c(a,b),e=Yg?1:0,f=Yg?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 Le(a,b){var c=Oe(a,!1),d=b?Me:Ne;return function(a,b){return d(c(a,b),a,this)}}function Me(a,b){var c;return Yg?(c=ee(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ne(a,b,c){var d=c.getBoundingClientRect();return Yg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ee(b)?-3:-6)}function Oe(a,b){var c=a.__max__+1,d=Wd(lg,c),e=Td(d,c,a,!!b),f=Ud(!!b),g=Vd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Yg&&(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 Pe(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 Qe(b){var c,d,e;if(ej=tf.select(wf),ej.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ej.html(""),ej.classed("c3",!0),uf.data.xs={},uf.data.targets=wc(b),n(),R(),fg.domain(tf.extent(ac(uf.data.targets))),gg.domain(Xb(uf.data.targets,"y")),hg.domain(Xb(uf.data.targets,"y2")),ig.domain(fg.domain()),jg.domain(gg.domain()),kg.domain(hg.domain()),fj=fg.domain(),Vi.scale(ig),Bf&&Zi.scale(fg),$i=ej.append("svg").attr("width",Mf+Jf.left+Jf.right).attr("height",Of+Jf.top+Jf.bottom).on("mouseenter",Ef).on("mouseleave",Ff),_i=$i.append("defs"),_i.append("clipPath").attr("id",pi).append("rect").attr("width",Mf).attr("height",Of),_i.append("clipPath").attr("id",qi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),_i.append("clipPath").attr("id",ri).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),aj=$i.append("g").attr("transform",Mi.main),bj=Pg?$i.append("g").attr("transform",Mi.context):null,cj=$i.append("g").attr("transform",Mi.legend),Sg||(cj.style("visibility","hidden"),Hi=Cc(uf.data.targets)),dj=tf.select(wf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),of(Cc(uf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Zg&&aj.append("g").attr("class",f.axisX).attr("clip-path",ti).attr("transform",Mi.x).append("text").attr("class",f.axisXLabel).attr("transform",Yg?"rotate(-90)":"").attr("dx",tb).attr("dy",wb).style("text-anchor",zb),ph&&aj.append("g").attr("class",f.axisY).attr("clip-path",ui).attr("transform",Mi.y).append("text").attr("class",f.axisYLabel).attr("transform",Yg?"":"rotate(-90)").attr("dx",ub).attr("dy",xb).style("text-anchor",Ab),yh&&aj.append("g").attr("class",f.axisY2).attr("transform",Mi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Yg?"":"rotate(-90)").attr("dx",vb).style("text-anchor",Bb),d=aj.append("g").attr("clip-path",si).attr("class",f.grid),Hh&&d.append("g").attr("class",f.xgrids),te(Jh)&&d.append("g").attr("class",f.xgridLines),Ph&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Kh&&d.append("g").attr("class",f.ygrids),te(Lh)&&d.append("g").attr("class",f.ygridLines),aj.append("g").attr("clip-path",si).attr("class",f.regions),aj.append("g").attr("clip-path",si).attr("class",f.chart),c=aj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Bf?Yg?"ns-resize":"ew-resize":null),aj.select("."+f.chart).append("g").attr("class",f.chartBars),aj.select("."+f.chart).append("g").attr("class",f.chartLines),aj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Mi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),aj.select("."+f.chart).append("g").attr("class",f.chartTexts),Bf&&aj.insert("rect",Df?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Mf).attr("height",Of).style("opacity",0).style("cursor",Yg?"ns-resize":"ew-resize").call(Zi).on("dblclick.zoom",null),nh&&Vi.extent("function"!=typeof nh?nh:nh(ac())),Pg&&(bj.append("g").attr("clip-path",si).attr("class",f.chart),bj.select("."+f.chart).append("g").attr("class",f.chartBars),bj.select("."+f.chart).append("g").attr("class",f.chartLines),bj.append("g").attr("clip-path",si).attr("class",f.brush).call(Vi).selectAll("rect").attr(Yg?"width":"height",Yg?Nf:Pf),bj.append("g").attr("class",f.axisX).attr("transform",Mi.subx).attr("clip-path",Yg?"":ti)),bf(uf.data.targets),Yg?aj.select("."+f.axisX).style("opacity",0).call(lg):(aj.select("."+f.axisY).style("opacity",0).call(mg),aj.select("."+f.axisY2).style("opacity",0).call(ng)),Xe({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),mi){if(vi&&"string"==typeof ni){for(ni=oe(ni),e=0;eMf&&(Mf=0),0>Of&&(Of=0),Nf=Yg?Jf.left-Si-Ti:Mf,Pf=Yg?Of:Rf-Kf.top-Kf.bottom,0>Nf&&(Nf=0),0>Pf&&(Pf=0),p(),Ni&&be(uf.data.targets)&&(Lf.left=Mf/2+Tf)}function o(){aj.select("line."+f.xgridFocus).attr("x1",Yg?0:-10).attr("x2",Yg?Mf:-10).attr("y1",Yg?-10:Jf.top).attr("y2",Yg?-10:Of)}function p(){Tf=Of/2,Sf=.95*Tf,Uf=ae(uf.data.targets)?.6*Sf:0}function q(){var a=Yg?f.axisX:f.axisY,b=tf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=tf.select(wf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return xf?xf:x()}function s(){var a=yf?yf:y();return a>0?a:320}function t(){return be(uf.data.targets)?0:zf?zf:Yg||!ph||uh?1:v("y")}function u(){var a=1;return be(uf.data.targets)?0:Af?Af:Ni?P()+(yh&&!Yg?v("y2"):a):yh?Dh||Yg?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||Zg?"x"===a&&mh?mh:"y"!==a||ph?"y2"!==a||yh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Ui:Sg&&!Ni?10:1:0}function x(){return+tf.select(wf).style("width").replace("px","")}function y(){return+tf.select(wf).style("height").replace("px","")}function z(a){return a?-5:-(Jf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Yg)}function C(){return A(!Yg)}function D(){return z(Yg)}function E(){return A(Yg)}function F(a){return a?Mf+2+4:Jf.left+20}function G(a){return a?(mh?mh:0)+40:Of+2}function H(){return F(!Yg)}function I(){return G(!Yg)}function J(){return F(Yg)}function K(){return G(Yg)}function L(){var a=Yg?Of:Mf,b=Ac(),c=Yb()*(Zd(uf.data.targets)?(b-(wi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){Oi=a}function N(a){Pi=a}function O(a){Qi=a}function P(){return Sg?Ni?Pi*(Oi+1):Qf:0}function Q(){return Sg?Ni?Rf:Qi*(Oi+1):0}function R(){var a,b=!fg;Zf=Yg?1:0,$f=Yg?Of:Mf,_f=Yg?0:Of,ag=Yg?Mf:1,bg=Zf,cg=$f,dg=Yg?0:Pf,eg=Yg?Nf:1,fg=T(Zf,$f,b?void 0:fg.domain(),function(){return lg.tickOffset()}),gg=U(_f,ag),hg=U(_f,ag),ig=T(Zf,$f,fj,function(a){return a%1?0:og.tickOffset()}),jg=U(dg,eg),kg=U(dg,eg),a=$(),lg=X(fg,Ii,a),og=X(ig,Li,a),mg=Y(gg,Ji,vh,xh),ng=Y(hg,Ki,Eh,Gh),b||(Vi.scale(ig),Bf&&Zi.scale(fg)),S()}function S(){Vf=Gb(),Wf=Hb(),Xf=Hb(.98)}function T(a,b,e,f){var g=(vi?tf.time.scale():tf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),wi){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return tf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?hg:gg}function W(a){return"y2"===Z(a)?kg:jg}function X(a,b,c){var d=(wi?Eb():tf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),wi?(d.tickCentered(bh),se(dh)&&(dh=!1)):d.tickOffset=function(){var a=Yg?Of:Mf;return a*Yb()/Ac()/2},wi&&d.categories(ah),d}function Y(a,b,c,d){return tf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in wg?wg[a]:"y"}function $(){var a=vi?Fi:wi?Tc:function(a){return 0>a?a.toFixed(0):a};return ch&&("function"==typeof ch?a=ch:vi&&(a=function(a){return a?Ei(ch)(a):""})),a}function _(a){var b;return"y"===a?b=th:"y2"===a?b=Ch:"x"===a&&(b=oh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?th=b:"y2"===a?Ch=b:"x"===a&&(oh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a){a.selectAll(".tick text").attr("y",db(ih)).attr("x",cb(ih)).attr("transform","rotate("+ih+")").style("text-anchor","start")}function fb(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 gb(){return fb("x",Yg?"inner-top":"inner-right")}function hb(){return fb("y",Yg?"inner-right":"inner-top")}function ib(){return fb("y2",Yg?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Mf/2:Mf:b.isBottom?-Of:b.isMiddle?-Of/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!Yg,gb())}function rb(){return nb(Yg,hb())}function sb(){return nb(Yg,ib())}function tb(){return ob(!Yg,gb())}function ub(){return ob(Yg,hb())}function vb(){return ob(Yg,ib())}function wb(){var a=gb();return Yg?a.isInner?"1.2em":-30-Cb("x"):a.isInner?"-0.5em":"3em"}function xb(){var a=hb();return Yg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return Yg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!Yg,gb())}function Ab(){return pb(Yg,hb())}function Bb(){return pb(Yg,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return tf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Db(){aj.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).text(kb),aj.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dy",xb).text(lb),aj.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dy",yb).text(mb)}function Eb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+o)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Rc(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 tf.min(Object.keys(i).map(function(a){return tf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(vg.length>0)for(g=Sc(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 tf.max(Object.keys(i).map(function(a){return tf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Ah:rh,n="y2"===c?zh:qh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Bh:sh,r=ud()&&Yg;return 0===l.length?"y2"===c?hg.domain():gg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=bc(gg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&wh&&(f=b(wh.top)?wh.top:e,g=b(wh.bottom)?wh.bottom:e),"y2"===c&&Fh&&(f=b(Fh.top)?Fh.top:e,g=b(Fh.bottom)?Fh.bottom:e),Zd(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){var b=bc(fj),c=bc(fg.domain());return a||0===c?1:b/c}function Zb(a){return kh?vi?oe(kh):kh:tf.min(a,function(a){return tf.min(a.values,function(a){return a.x})})}function $b(a){return jh?vi?oe(jh):jh:tf.max(a,function(a){return tf.max(a.values,function(a){return a.x})})}function _b(a,c){var d,e,f,g,h=c[0],i=c[1],j=Math.abs(h-i);return wi?e=0:Zd(a)?(d=Ac(),e=d>1?j/(d-1)/2:.5):e=.01*j,"object"==typeof lh&&te(lh)?(f=b(lh.left)?lh.left:e,g=b(lh.right)?lh.right:e):f=g="number"==typeof lh?lh:e,{left:f,right:g}}function ac(a){var b=[Zb(a),$b(a)],c=b[0],d=b[1],e=_b(a,b),f=0,g=0;return(c||0===c)&&(f=vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function bc(a){return a[1]-a[0]}function cc(a){for(var b=0;bb?0:b-c}function ic(a){var b,c=gc(a),d="y"===a.axis?gg:hg;return b="y"===a.axis||"y2"===a.axis?Yg?Of:"start"in a?d(a.start):Of:Yg?"end"in a?fg(vi?oe(a.end):a.end):Of:Of,c>b?0:b-c}function jc(a){return pg&&a===pg||te(qg)&&ue(qg,a)}function kc(a){return!jc(a)}function lc(a){return pg?pg:te(qg)?qg[a]:null}function mc(a,b){var c,d=b&&te(b)?Cc(b):[];return d.forEach(function(b){lc(b)===a&&(c=uf.data.xs[b])}),c}function nc(a,b){return a in uf.data.xs&&uf.data.xs[a]&&uf.data.xs[a][b]?uf.data.xs[a][b]:b}function oc(a){Object.keys(a).forEach(function(b){qg[b]=a[b]})}function pc(a){return 1===tf.set(Object.keys(a).map(function(b){return a[b]})).size()}function qc(a){var b;return a&&(b=tg[a.id],a.name=b?b:a.id),a}function rc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=tc(b[d],a.id,d)}),uf.data.xs[a.id]=b})}function sc(a,b){a.forEach(function(a){b[a.id]&&rc([a],b[a.id])})}function tc(a,b,c){var d;return d=vi?a?a instanceof Date?a:oe(a):oe(nc(b,c)):xi&&!wi?a?+a:nc(b,c):c}function uc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?uf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):pg?(d=Object.keys(uf.data.xs),uf.data.xs[c]=d.length>0?uf.data.xs[d[0]]:void 0):te(qg)&&(uf.data.xs[c]=mc(f,uf.data.targets)):uf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!uf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=sg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=lc(b),g=a[f],h=tc(g,b,e);return xi&&wi&&0===c&&g&&(0===e&&(ah=[]),ah.push(g)),("undefined"==typeof a[b]||uf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),xg&&Xd(Cc(c).filter(function(a){return!(a in yg)}),xg),c.forEach(function(a){dc(a.id_org,a)}),c}function xc(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 yc(a){return a>0&&uf.data.targets[0].values[a-1]?uf.data.targets[0].values[a-1].x:void 0}function zc(a){return a1?uf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?uf.data.targets[0]:null,a}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(uf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(vi?new Date(h):h);i.push(d)}return vi||(i=i.sort(function(a,b){return a-b})),i}function Lc(a){Gi=Gi.concat(a)}function Mc(a){Gi=Gi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Hi=Hi.concat(a)}function Oc(a){Hi=Hi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Dd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Dd(a,g))),Gd(e,b)):Ed(a,b,f,g)}function Fd(a,b){var c;return c=a.map(function(a){return Ed(a.values,b)}),Gd(c,b)}function Gd(a,b){var c,d;return a.forEach(function(a){var e=ve(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Hd(a,b){return tf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Id(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 Jd(){return Ag&&"desc"===Ag.toLowerCase()}function Kd(){return Ag&&"asc"===Ag.toLowerCase()}function Ld(a){var b=Kd(),c=Jd();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 Ag&&a.sort(Ag),a}function Md(a,c){var d,e,f,g,h,i,j,k=be(uf.data.targets),l=k?xd:wd,m=a.filter(function(a){return a&&b(a.value)});ii&&0!==m.length&&(dj.html(li(a,$(),l,Di)).style("display","block"),d=dj.property("offsetWidth"),e=dj.property("offsetHeight"),k?(g=Mf/2+c[0],i=Of/2+c[1]+20):(Yg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=fg(m[0].x)+20):(f=q(),g=f+t()+fg(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),dj.style("top",i+"px").style("left",g+"px"))}function Nd(){dj.style("display","none")}function Od(a){var c=a.filter(function(a){return a&&b(a.value)});ii&&($d(uf.data.targets)||be(uf.data.targets)||aj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Yg?"y1":"x1",zd).attr(Yg?"y2":"x2",zd))}function Pd(){aj.select("line."+f.xgridFocus).style("visibility","hidden")}function Qd(a){return a.x||0===a.x?fg(a.x):null}function Rd(a){return V(a.id)(a.value)}function Sd(){var a,b,d={},e=0;return Ic(Fc(ee)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Wd(a,b){return Uh?Uh:b?2*a.tickOffset()*Vh/b:0}function Xd(a,b){Dc(a).forEach(function(a){hj[a]=b===yg[a],yg[a]=b})}function Yd(a,b){var c=!1;return a.forEach(function(a){yg[a.id]===b&&(c=!0),a.id in yg||"line"!==b||(c=!0)}),c}function Zd(a){return Yd(a,"bar")}function $d(a){return Yd(a,"scatter")}function _d(a){return Yd(a,"pie")}function ae(a){return Yd(a,"donut")}function be(a){return _d(a)||ae(a)}function ce(a){var b="string"==typeof a?a:a.id;return!(b in yg)||"line"===yg[b]||"spline"===yg[b]||"area"===yg[b]||"area-spline"===yg[b]}function de(a){var b="string"==typeof a?a:a.id;return"spline"===yg[b]||"area-spline"===yg[b]}function ee(a){var b="string"==typeof a?a:a.id;return"bar"===yg[b]}function fe(a){var b="string"==typeof a?a:a.id;return"scatter"===yg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"pie"===yg[b]}function he(a){var b="string"==typeof a?a:a.id;return"donut"===yg[b]}function ie(a){return ge(a)||he(a)}function je(a){return ee(a)?a.values:[]}function ke(a){return ce(a)||fe(a)?a.values:[]}function le(a){return ee(a)||ce(a)?a.values:[]}function me(a){return he(a)&&ci||ge(a)&&Yh}function ne(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function oe(b){var c;try{c=rg?tf.time.format(rg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+rg)}return c}function pe(a,b){var c=tf.mouse(a),d=tf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function ue(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ve(a,b){var c="y"===Z(a.id)?gg:hg,d=Yg?1:0,e=Yg?0:1;return Math.pow(fg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function we(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function xe(a,b,c){Lg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd).attr("stroke",function(){return Di(b)}).attr("r",1.4*Sh).transition().duration(100).attr("r",Sh)}function ye(a,b,c){Mg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ze(a,b,c,d){a?xe(b,c,d):ye(b,c,d)}function Ae(a,b){Lg(b,a.node()),a.transition().duration(100).style("fill",function(){return tf.rgb(Di(b)).darker(1)})}function Be(a,b){Mg(b,a.node()),a.transition().duration(100).style("fill",function(){return Di(b)})}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a){return a.filter(function(a){return b(a.value)})}function Ee(a,c){return(c?aj.selectAll("."+f.circles+ld(c)):aj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Fe(a,b){Ee(a,b).classed(f.EXPANDED,!0).attr("r",Rh)}function Ge(a){Ee(a).filter(function(){return tf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oh)}function He(a){return aj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ie(a){He(a).classed(f.EXPANDED,!0)}function Je(a){He(a).classed(f.EXPANDED,!1)}function Ke(a,b){var c=Oe(a,b);return function(a,b){var d=c(a,b),e=Yg?1:0,f=Yg?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 Le(a,b){var c=Oe(a,!1),d=b?Me:Ne;return function(a,b){return d(c(a,b),a,this)}}function Me(a,b){var c;return Yg?(c=ee(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ne(a,b,c){var d=c.getBoundingClientRect();return Yg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ee(b)?-3:-6)}function Oe(a,b){var c=a.__max__+1,d=Wd(lg,c),e=Td(d,c,a,!!b),f=Ud(!!b),g=Vd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Yg&&(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 Pe(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 Qe(b){var c,d,e;if(ej=tf.select(wf),ej.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ej.html(""),ej.classed("c3",!0),uf.data.xs={},uf.data.targets=wc(b),n(),R(),fg.domain(tf.extent(ac(uf.data.targets))),gg.domain(Xb(uf.data.targets,"y")),hg.domain(Xb(uf.data.targets,"y2")),ig.domain(fg.domain()),jg.domain(gg.domain()),kg.domain(hg.domain()),fj=fg.domain(),Vi.scale(ig),Bf&&Zi.scale(fg),$i=ej.append("svg").attr("width",Mf+Jf.left+Jf.right).attr("height",Of+Jf.top+Jf.bottom).on("mouseenter",Ef).on("mouseleave",Ff),_i=$i.append("defs"),_i.append("clipPath").attr("id",pi).append("rect").attr("width",Mf).attr("height",Of),_i.append("clipPath").attr("id",qi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),_i.append("clipPath").attr("id",ri).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),aj=$i.append("g").attr("transform",Mi.main),bj=Pg?$i.append("g").attr("transform",Mi.context):null,cj=$i.append("g").attr("transform",Mi.legend),Sg||(cj.style("visibility","hidden"),Hi=Cc(uf.data.targets)),dj=tf.select(wf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),of(Cc(uf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Zg&&aj.append("g").attr("class",f.axisX).attr("clip-path",ti).attr("transform",Mi.x).append("text").attr("class",f.axisXLabel).attr("transform",Yg?"rotate(-90)":"").attr("dx",tb).attr("dy",wb).style("text-anchor",zb),ph&&aj.append("g").attr("class",f.axisY).attr("clip-path",ui).attr("transform",Mi.y).append("text").attr("class",f.axisYLabel).attr("transform",Yg?"":"rotate(-90)").attr("dx",ub).attr("dy",xb).style("text-anchor",Ab),yh&&aj.append("g").attr("class",f.axisY2).attr("transform",Mi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Yg?"":"rotate(-90)").attr("dx",vb).style("text-anchor",Bb),d=aj.append("g").attr("clip-path",si).attr("class",f.grid),Hh&&d.append("g").attr("class",f.xgrids),te(Jh)&&d.append("g").attr("class",f.xgridLines),Ph&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Kh&&d.append("g").attr("class",f.ygrids),te(Lh)&&d.append("g").attr("class",f.ygridLines),aj.append("g").attr("clip-path",si).attr("class",f.regions),aj.append("g").attr("clip-path",si).attr("class",f.chart),c=aj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Bf?Yg?"ns-resize":"ew-resize":null),aj.select("."+f.chart).append("g").attr("class",f.chartBars),aj.select("."+f.chart).append("g").attr("class",f.chartLines),aj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Mi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),aj.select("."+f.chart).append("g").attr("class",f.chartTexts),Bf&&aj.insert("rect",Df?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Mf).attr("height",Of).style("opacity",0).style("cursor",Yg?"ns-resize":"ew-resize").call(Zi).on("dblclick.zoom",null),nh&&Vi.extent("function"!=typeof nh?nh:nh(ac())),Pg&&(bj.append("g").attr("clip-path",si).attr("class",f.chart),bj.select("."+f.chart).append("g").attr("class",f.chartBars),bj.select("."+f.chart).append("g").attr("class",f.chartLines),bj.append("g").attr("clip-path",si).attr("class",f.brush).call(Vi).selectAll("rect").attr(Yg?"width":"height",Yg?Nf:Pf),bj.append("g").attr("class",f.axisX).attr("transform",Mi.subx).attr("clip-path",Yg?"":ti)),bf(uf.data.targets),Yg?aj.select("."+f.axisX).style("opacity",0).call(lg):(aj.select("."+f.axisY).style("opacity",0).call(mg),aj.select("."+f.axisY2).style("opacity",0).call(ng)),Xe({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),mi){if(vi&&"string"==typeof ni){for(ni=oe(ni),e=0;e0){d=[];for(var g in tg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Id(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ce,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 Ve(a){be(uf.data.targets)||Eg&&(yi=a,aj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),zi=!0,Ng())}function We(){be(uf.data.targets)||Eg&&(aj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),aj.selectAll("."+f.shape).classed(f.INCLUDED,!1),zi=!1,Og())}function Xe(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U=Sd(),V=be(uf.data.targets),W=Ic(uf.data.targets);if(0!==W.length){if(a=d(a)?a:{},z=d(a.withY)?a.withY:!0,A=d(a.withSubchart)?a.withSubchart:!0,B=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,C=d(a.withTransitionForExit)?a.withTransitionForExit:B,D=d(a.withTransitionForAxis)?a.withTransitionForAxis:B,E=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:B,O=B?If:0,P=C?O:0,Q=D?O:0,I&&Sg&&of(Cc(uf.data.targets),a),H&&(fg.domain(tf.extent(ac(W))),fj=fg.domain(),Bf&&Zi.scale(fg).updateScaleExtent(),ig.domain(fg.domain()),Vi.scale(ig)),G&&(fg.domain(Vi.empty()?fj:Vi.extent()),Bf&&Zi.scale(fg).updateScaleExtent()),gg.domain(Xb(W,"y")),hg.domain(Xb(W,"y2")),(gh||fh)&&(R=hh?hh:Kc(Jc(W)),lg.tickValues(R),og.tickValues(R)),c=aj.select("."+f.axisX).style("opacity",V?0:1),(Yg||E)&&(c=c.transition().duration(Q)),c.call(lg),g=aj.select("."+f.axisY).style("opacity",V?0:1),(!Yg||E)&&(g=g.transition().duration(Q)),g.call(mg),aj.select("."+f.axisY2).style("opacity",V?0:1).transition().duration(Q).call(ng),G)if(dh&&R){for(S=1;S=0&&tf.select(this).style("display",b%T?"none":"block")})}else tf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!Yg&&ih&&eb(c),J=Ke(U),M=Le(U,!0),N=Le(U,!1),Db(),jg.domain(gg.domain()),kg.domain(hg.domain()),dj.style("display","none"),o(),aj.select("line."+f.xgridFocus).style("visibility","hidden"),Hh){if("year"===Ih){i=[];for(var X=ac(),Y=X[0].getFullYear(),Z=X[1].getFullYear(),$=Y;Z>=$;$++)i.push(new Date($+"-01-01 00:00:00"))}else i=fg.ticks(10);h=aj.select("."+f.xgrids).selectAll("."+f.xgrid).data(i),h.enter().append("line").attr("class",f.xgrid),h.attr("x1",Yg?0:function(a){return fg(a)-lg.tickOffset()}).attr("x2",Yg?Mf:function(a){return fg(a)-lg.tickOffset()}).attr("y1",Yg?function(a){return fg(a)-lg.tickOffset()}:Jf.top).attr("y2",Yg?function(a){return fg(a)-lg.tickOffset()}:Of).style("opacity",function(){return+tf.select(this).attr(Yg?"y1":"x1")===(Yg?Of:0)?0:1}),h.exit().remove()}te(Jh)&&(j=aj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Jh),k=j.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),k.append("line").style("opacity",0),k.append("text").attr("text-anchor","end").attr("transform",Yg?"":"rotate(-90)").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),j.select("line").transition().duration(O).attr("x1",Yg?0:Ad).attr("x2",Yg?Mf:Ad).attr("y1",Yg?Ad:Jf.top).attr("y2",Yg?Ad:Of).style("opacity",1),j.select("text").transition().duration(O).attr("x",Yg?Mf:0).attr("y",Ad).text(function(a){return a.text}).style("opacity",1),j.exit().transition().duration(O).style("opacity",0).remove()),z&&Kh&&(l=aj.select("."+f.ygrids).selectAll("."+f.ygrid).data(gg.ticks(Mh)),l.enter().append("line").attr("class",f.ygrid),l.attr("x1",Yg?gg:0).attr("x2",Yg?gg:Mf).attr("y1",Yg?0:gg).attr("y2",Yg?Of:gg),l.exit().remove()),z&&te(Lh)&&(m=aj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Lh),n=m.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),n.append("line").style("opacity",0),n.append("text").attr("text-anchor","end").attr("transform",Yg?"rotate(-90)":"").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),m.select("line").transition().duration(O).attr("x1",Yg?Bd:0).attr("x2",Yg?Bd:Mf).attr("y1",Yg?0:Bd).attr("y2",Yg?Of:Bd).style("opacity",1),m.select("text").transition().duration(O).attr("x",Yg?0:Mf).attr("y",Bd).text(function(a){return a.text}).style("opacity",1),m.exit().transition().duration(O).style("opacity",0).remove()),q=aj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),q.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Di(a)}).attr("class",ad),q.style("opacity",qd).transition().duration(O).attr("d",J).style("opacity",1),q.exit().transition().duration(P).style("opacity",0).remove(),s=aj.selectAll("."+f.texts).selectAll("."+f.text).data(le),s.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return Yg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),s.text(function(a){return yd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(O).attr("x",M).attr("y",N).style("fill-opacity",td),s.exit().transition().duration(P).style("fill-opacity",0).remove(),aj.selectAll("."+f.line).style("opacity",qd).transition().duration(O).attr("d",Wi).style("opacity",1),aj.selectAll("."+f.area).style("opacity",0).transition().duration(O).attr("d",Xi).style("opacity",gj),p=aj.selectAll("."+f.circles).selectAll("."+f.circle).data(ke),p.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Oh),p.style("opacity",qd).transition().duration(O).style("opacity",sd).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),p.exit().remove(),aj.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(O).attrTween("d",function(a){var b,c=Fb(a);return c?(b=tf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1),aj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(O).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&ie(a.data)?1:0}),aj.select("."+f.chartArcsTitle).style("opacity",ae(uf.data.targets)?1:0),Pg&&(null!==tf.event&&"zoom"===tf.event.type&&Vi.extent(fg.orgDomain()).update(),A&&(e=bj.select("."+f.axisX).style("opacity",V?0:1),(Yg||E)&&(e=e.transition().duration(Q)),e.call(og),!Yg&&ih&&eb(e),Vi.empty()||Vi.extent(fg.orgDomain()).update(),K=Ke(U,!0),t=bj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),t.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Di(a)}).attr("class",ad),t.style("opacity",qd).transition().duration(O).attr("d",K).style("opacity",1),t.exit().transition().duration(O).style("opacity",0).remove(),bj.selectAll("."+f.line).style("opacity",qd).transition().duration(O).attr("d",Yi).style("opacity",1))),aj.selectAll("."+f.selectedCircles).filter(function(a){return ee(a)}).selectAll("circle").remove(),aj.selectAll("."+f.selectedCircle).transition().duration(O).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),u=aj.select("."+f.eventRects),te(qg)&&!pc(qg)?(u.classed(f.eventRectsMultiple)||u.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),v=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Se(v.enter()),v.attr("x",0).attr("y",0).attr("width",Mf).attr("height",Of)):(u.classed(f.eventRectsSingle)||u.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),xi&&!wi?(y=function(a,b){var c=yc(b),d=zc(b),e=uf.data.xs[a.id][b];return(fg(d?d:e+50)-fg(c?c:e-50))/2},x=function(a,b){var c=yc(b),d=uf.data.xs[a.id][b];return(fg(d)+fg(c?c:d-50))/2}):(y=L(),x=function(a){return fg(a.x)-y/2}),w=Bc(),aj.select("."+f.eventRects).datum(w?w.values:[]),v=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Re(v.enter()),v.attr("class",fd).attr("x",Yg?0:x).attr("y",Yg?x:0).attr("width",Yg?Mf:y).attr("height",Yg?y:Of),v.exit().remove()),r=aj.select("."+f.regions).selectAll("rect."+f.region).data(hi),r.enter().append("rect").style("fill-opacity",0),r.attr("class",ed).attr("x",fc).attr("y",gc).attr("width",hc).attr("height",ic).transition().duration(O).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Cc(uf.data.targets).forEach(function(a){hj[a]=!0})}}function Ye(){Xe({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ze(){return"mousemove"===tf.event.sourceEvent.type&&Zi.altDomain?(fg.domain(Zi.altDomain),void Zi.scale(fg).updateScaleExtent()):(wi&&fg.orgDomain()[0]===fj[0]&&fg.domain([fj[0]-1e-10,fg.orgDomain()[1]]),Xe({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===tf.event.sourceEvent.type&&(Ai=!0)))}function $e(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function _e(){$i.attr("width",Qf).attr("height",Rf),$i.select("#"+pi).select("rect").attr("width",Mf).attr("height",Of),$i.select("#"+qi).select("rect").attr("width",H),$i.select("#"+ri).select("rect").attr("width",J),$i.select("."+f.zoomRect).attr("width",Mf).attr("height",Of)}function af(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),_e(),m(a.withTransition),Xe(a)}function bf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=aj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Di(a)}),e=aj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("fill",function(a){return Di(a)}).style("stroke","none").style("cursor",function(a){return Gg(a)?"pointer":null}),c=aj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)}),b.append("path").attr("class",dd).style("opacity",function(){return gj=+tf.select(this).style("opacity"),0}).style("fill",function(a){return Di(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Di(a)}).style("cursor",function(a){return Gg(a)?"pointer":null}),a.forEach(function(a){aj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=aj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Yf(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Di(a.data)}).style("cursor",function(a){return Gg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Fb(a),d=Lb(c),e=Tb();Nb(c.data.id),jf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Fb(a),c=[Lb(b)];Md(c,tf.mouse(this))}).on("mouseout",function(a,b){var c=Fb(a),d=Lb(c),e=Ub();Ob(c.data.id),lf(),Nd(),e(d,b)}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Pg&&(n=bj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Di(a)}),l=bj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)})),$i.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function cf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Xd(a.id,b.types[a.id]):Xd(a.id,b.type)}),uf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Ni?j:i,l=Ni?Q():P();return d&&(w=0,C=0,t=0,u=0),Sg&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Ni?u:t,void(Xg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,Ni?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=cj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Ug?Ug(a):uf.toggle(a)}).on("mouseover",function(a){uf.focus(a),"function"==typeof Vg&&Vg(a)}).on("mouseout",function(a){uf.revert(),"function"==typeof Wg&&Wg(a)}),l.append("text").text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",Ni?g:-200).attr("y",Ni?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ni?h:-200).attr("y",Ni?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Di(a)}).attr("x",Ni?g:-200).attr("y",Ni?-200:i).attr("width",10).attr("height",10),cj.selectAll("text").data(a).text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),cj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),cj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),_e(),q&&m(p)}function pf(a){return Ec(uf.data.targets,a.id)}function qf(a){return"data"in a&&Ec(uf.data.targets,a.data.id)}function rf(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 sf(a,b,c){var d=!be(uf.data.targets);Xd(a,b),af(c?c:{withTransitionForAxis:d})}var tf=a.d3?a.d3:a.require?a.require("d3"):void 0,uf={data:{},axis:{},legend:{}},vf={},wf=h(["bindto"],"#chart"),xf=h(["size","width"]),yf=h(["size","height"]),zf=h(["padding","left"]),Af=h(["padding","right"]),Bf=h(["zoom","enabled"],!1),Cf=h(["zoom","extent"]),Df=h(["zoom","privileged"],!1),Ef=h(["onenter"],function(){}),Ff=h(["onleave"],function(){}),Gf=h(["onresize"],function(){}),Hf=h(["onresized"],function(){}),If=h(["transition","duration"],350);g("data","data is required in config");var Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg=h(["data","x"]),qg=h(["data","xs"],{}),rg=h(["data","x_format"]),sg=h(["data","id_converter"],function(a){return a}),tg=h(["data","names"],{}),ug=h(["data","classes"],{}),vg=h(["data","groups"],[]),wg=h(["data","axes"],{}),xg=h(["data","type"]),yg=h(["data","types"],{}),zg=h(["data","labels"],{}),Ag=h(["data","order"]),Bg=h(["data","regions"],{}),Cg=h(["data","color"]),Dg=h(["data","colors"],{}),Eg=h(["data","selection","enabled"],!1),Fg=h(["data","selection","grouped"],!1),Gg=h(["data","selection","isselectable"],function(){return!0}),Hg=h(["data","selection","multiple"],!0),Ig=h(["data","onclick"],function(){}),Jg=h(["data","onenter"],function(){}),Kg=h(["data","onleave"],function(){}),Lg=h(["data","onselected"],function(){}),Mg=h(["data","onunselected"],function(){}),Ng=h(["data","ondragstart"],function(){}),Og=h(["data","ondragend"],function(){}),Pg=h(["subchart","show"],!1),Qg=h(["subchart","size","height"],60),Rg=h(["color","pattern"],[]),Sg=h(["legend","show"],!0),Tg=h(["legend","position"],"bottom"),Ug=h(["legend","item","onclick"]),Vg=h(["legend","item","onmouseover"]),Wg=h(["legend","item","onmouseout"]),Xg=h(["legend","equally"],!1),Yg=h(["axis","rotated"],!1),Zg=h(["axis","x","show"],!0),$g=h(["axis","x","type"],"indexed"),_g=h(["axis","x","localtime"],!0),ah=h(["axis","x","categories"],[]),bh=h(["axis","x","tick","centered"],!1),ch=h(["axis","x","tick","format"]),dh=h(["axis","x","tick","culling"],{}),eh=h(["axis","x","tick","culling","max"],10),fh=h(["axis","x","tick","count"]),gh=h(["axis","x","tick","fit"],!0),hh=h(["axis","x","tick","values"],null),ih=h(["axis","x","tick","rotate"]),jh=h(["axis","x","max"]),kh=h(["axis","x","min"]),lh=h(["axis","x","padding"],{}),mh=h(["axis","x","height"]),nh=h(["axis","x","default"]),oh=h(["axis","x","label"],{}),ph=h(["axis","y","show"],!0),qh=h(["axis","y","max"]),rh=h(["axis","y","min"]),sh=h(["axis","y","center"]),th=h(["axis","y","label"],{}),uh=h(["axis","y","inner"],!1),vh=h(["axis","y","tick","format"]),wh=h(["axis","y","padding"],{}),xh=h(["axis","y","ticks"],10),yh=h(["axis","y2","show"],!1),zh=h(["axis","y2","max"]),Ah=h(["axis","y2","min"]),Bh=h(["axis","y2","center"]),Ch=h(["axis","y2","label"],{}),Dh=h(["axis","y2","inner"],!1),Eh=h(["axis","y2","tick","format"]),Fh=h(["axis","y2","padding"],{}),Gh=h(["axis","y2","ticks"],10),Hh=h(["grid","x","show"],!1),Ih=h(["grid","x","type"],"tick"),Jh=h(["grid","x","lines"],[]),Kh=h(["grid","y","show"],!1),Lh=h(["grid","y","lines"],[]),Mh=h(["grid","y","ticks"],10),Nh=h(["point","show"],!0),Oh=Nh?h(["point","r"],2.5):0,Ph=h(["point","focus","line","enabled"],!0),Qh=h(["point","focus","expand","enabled"],!0),Rh=h(["point","focus","expand","r"],Qh?4:Oh),Sh=h(["point","focus","select","r"],8),Th=h(["line","connect_null"],!1),Uh=h(["bar","width"]),Vh=h(["bar","width","ratio"],.6),Wh=h(["pie","label","show"],!0),Xh=h(["pie","label","format"]),Yh=h(["pie","expand"],!0),Zh=h(["pie","onclick"],function(){}),$h=h(["pie","onmouseover"],function(){}),_h=h(["pie","onmouseout"],function(){}),ai=h(["donut","label","show"],!0),bi=h(["donut","label","format"]),ci=h(["donut","expand"],!0),di=h(["donut","title"],""),ei=h(["donut","onclick"],function(){}),fi=h(["donut","onmouseover"],function(){}),gi=h(["donut","onmouseout"],function(){}),hi=h(["regions"],[]),ii=h(["tooltip","show"],!0),ji=h(["tooltip","format","title"]),ki=h(["tooltip","format","value"]),li=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ji?ji:b,l=ki?ki: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+""}),mi=h(["tooltip","init","show"],!1),ni=h(["tooltip","init","x"],0),oi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),pi=("string"==typeof wf?wf.replace("#",""):wf.id)+"-clip",qi=pi+"-xaxis",ri=pi+"-yaxis",si=i(pi),ti=i(qi),ui=i(ri),vi="timeseries"===$g,wi="categorized"===$g,xi=!vi&&(pg||te(qg)),yi=null,zi=!1,Ai=!1,Bi=!1,Ci=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Di=ne(Dg,te(Rg)?Rg:Ci,Cg),Ei=_g?tf.time.format:tf.time.format.utc,Fi=function(){var a=[[Ei("%Y/%-m/%-d"),function(){return!0}],[Ei("%-m/%-d"),function(a){return a.getMonth()}],[Ei("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ei("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ei("%I %p"),function(a){return a.getHours()}],[Ei("%I:%M"),function(a){return a.getMinutes()}],[Ei(":%S"),function(a){return a.getSeconds()}],[Ei(".%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)}}(),Gi=[],Hi=[],Ii=Yg?"left":"bottom",Ji=Yg?uh?"top":"bottom":uh?"right":"left",Ki=Yg?Dh?"bottom":"top":Dh?"left":"right",Li=Yg?"left":"bottom",Mi={main:function(){return"translate("+Jf.left+","+Jf.top+")"},context:function(){return"translate("+Kf.left+","+Kf.top+")"},legend:function(){return"translate("+Lf.left+","+Lf.top+")"},x:function(){return"translate(0,"+(Yg?0:Of)+")"},y:function(){return"translate(0,"+(Yg?Of:0)+")"},y2:function(){return"translate("+(Yg?0:Mf)+","+(Yg?1:0)+")"},subx:function(){return"translate(0,"+(Yg?0:Pf)+")"},arc:function(){return"translate("+Mf/2+","+Of/2+")"}},Ni="right"===Tg,Oi=0,Pi=0,Qi=0,Ri=.15,Si=30,Ti=Yg&&!Zg?0:30,Ui=5;Yf=tf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Vi,Wi=function(){var a=tf.svg.line().x(Yg?function(a){return V(a.id)(a.value)}:zd).y(Yg?zd:function(a){return V(a.id)(a.value)});return Th||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Th?De(b.values):b.values;return ce(b)?(a.interpolate(de(b)?"cardinal":"linear"),Bg[b.id]?Pe(e,fg,V(b.id),Bg[b.id]):a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Xi=function(){var a;return a=Yg?tf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(zd):tf.svg.area().x(zd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=De(b.values);return Yd([b],"area")||Yd([b],"area-spline")?(a.interpolate(de(b)?"cardinal":"linear"),a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Yi=function(){var a=tf.svg.line().x(Yg?function(a){return W(a.id)(a.value)}:Cd).y(Yg?Cd:function(a){return W(a.id)(a.value)});return function(b){var c=De(b.values);return ce(b)?a(c):"M "+ig(c[0].x)+" "+W(b.id)(c[0].value)}}(),Zi=function(){};Vi=tf.svg.brush().on("brush",Ye),Vi.update=function(){return bj&&bj.select("."+f.brush).call(this),this},Vi.scale=function(a){return Yg?this.y(a):this.x(a)},Bf&&(Zi=tf.behavior.zoom().on("zoomstart",function(){Zi.altDomain=tf.event.sourceEvent.altKey?fg.orgDomain():null}).on("zoom",Bf?Ze:null),Zi.scale=function(a){return Yg?this.y(a):this.x(a)},Zi.orgScaleExtent=function(){var a=Cf?Cf:[1,10];return[a[0],Math.max(Ac()/a[1],a[1])]},Zi.updateScaleExtent=function(){var a=bc(fg.orgDomain())/bc(fj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var $i,_i,aj,bj,cj,dj,ej,fj,gj,hj={};if(uf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),uf.defocus(),b(d.classed(f.focused,!0)),b(e),be(uf.data.targets)&&Nb(a,!0),jf(a)},uf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),kf(a)},uf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),lf()},uf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),$i.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?mf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},uf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),$i.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?nf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Ri),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},uf.toggle=function(a){Gc(a)?uf.hide(a):uf.show(a)},uf.unzoom=function(){Vi.clear().update(),Xe({withUpdateXDomain:!0})},uf.load=function(a){return a.xs&&oc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){ug[b]=a.classes[b]}),"categories"in a&&wi&&(ah=a.categories,lg.categories(ah)),"cacheIds"in a&&cc(a.cacheIds)?void cf(ec(a.cacheIds),a.done):void("unload"in a?ef(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){df(a)}):df(a))},uf.unload=function(a){ef(Dc(a),function(){Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},uf.selected=function(a){return tf.merge(aj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return tf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},uf.select=function(a,b,c){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=tf.select(this),i="circle"===this.nodeName?xe:Ae,j="circle"===this.nodeName?ye:Be,k=Fg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Gg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},uf.unselect=function(a,b){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=tf.select(this),g="circle"===this.nodeName?ye:Be,h=Fg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Gg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},uf.toLine=function(a){sf(a,"line")},uf.toSpline=function(a){sf(a,"spline")},uf.toBar=function(a){sf(a,"bar")},uf.toScatter=function(a){sf(a,"scatter")},uf.toArea=function(a){sf(a,"area")},uf.toAreaSpline=function(a){sf(a,"area-spline")},uf.toPie=function(a){sf(a,"pie",{withTransform:!0})},uf.toDonut=function(a){sf(a,"donut",{withTransform:!0})},uf.groups=function(a){return c(a)?vg:(vg=a,Xe(),vg)},uf.xgrids=function(a){return a?(Jh=a,Xe(),Jh):Jh},uf.xgrids.add=function(a){return a?uf.xgrids(Jh.concat(a)):void 0},uf.xgrids.remove=function(a){var b=rf(a);return uf.xgrids(Jh.filter(b))},uf.ygrids=function(a){return a?(Lh=a,Xe(),Lh):Lh},uf.ygrids.add=function(a){return a?uf.ygrids(Lh.concat(a)):void 0},uf.ygrids.remove=function(a){var b=rf(a); return uf.ygrids(Lh.filter(b))},uf.regions=function(a){return c(a)?hi:(hi=a,Xe(),hi)},uf.regions.add=function(a){return c(a)?hi:(hi=hi.concat(a),Xe(),hi)},uf.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;$i.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),hi=hi.filter(function(b){return b.classes.indexOf(a)<0})}),hi},uf.data.get=function(a){var b=uf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},uf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},uf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){tg[b]=a[b]}),of(Cc(uf.data.targets),{withTransition:!0}),tg):tg},uf.x=function(a){return arguments.length&&(rc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.xs=function(a){return arguments.length&&(sc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},uf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(qh=+a.y),b(a.y2)&&(zh=+a.y2)):qh=zh=+a,Xe())},uf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(rh=+a.y),b(a.y2)&&(Ah=+a.y2)):rh=Ah=+a,Xe())},uf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&uf.axis.max(a.max),"undefined"!=typeof a.min&&uf.axis.min(a.min))},uf.legend.show=function(a){Sg||(Sg=!0,cj.style("visibility","visible")),mf(Dc(a)),Xe({withTransitionForHorizontalAxis:!1})},uf.legend.hide=function(a){Sg&&se(a)&&(Sg=!1,cj.style("visibility","hidden")),nf(Dc(a)),Xe({withTransitionForHorizontalAxis:!1})},uf.resize=function(a){xf=a?a.width:null,yf=a?a.height:null,af({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},uf.destroy=function(){uf.data.targets=void 0,uf.data.xs={},ej.html(""),a.onresize=null},"url"in e.data)tf.xhr(e.data.url,function(a,b){var c,d=tf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=tf.csv.parse(b.response),Qe(c)});else if("rows"in e.data)Qe(uc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Qe(vc(e.data.columns))}return uf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From f05c08c8c10ba5fe98d14bc330e7a8d555f24843 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Thu, 24 Apr 2014 14:19:23 +0900 Subject: [PATCH 062/178] Fix growing height - #170 #105 --- c3.js | 2 ++ c3.min.js | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/c3.js b/c3.js index a5184c4..421803a 100644 --- a/c3.js +++ b/c3.js @@ -3552,6 +3552,8 @@ svg.select('#' + clipIdForXAxis).select('rect').attr('width', getXAxisClipWidth); svg.select('#' + clipIdForYAxis).select('rect').attr('width', getYAxisClipWidth); svg.select('.' + CLASS.zoomRect).attr('width', width).attr('height', height); + // MEMO: parent div's height will be bigger than svg when + selectChart.style('max-height', currentHeight + "px"); } function updateAndRedraw(options) { diff --git a/c3.min.js b/c3.min.js index 2c70380..5616beb 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ !function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.32"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cMf&&(Mf=0),0>Of&&(Of=0),Nf=Yg?Jf.left-Si-Ti:Mf,Pf=Yg?Of:Rf-Kf.top-Kf.bottom,0>Nf&&(Nf=0),0>Pf&&(Pf=0),p(),Ni&&be(uf.data.targets)&&(Lf.left=Mf/2+Tf)}function o(){aj.select("line."+f.xgridFocus).attr("x1",Yg?0:-10).attr("x2",Yg?Mf:-10).attr("y1",Yg?-10:Jf.top).attr("y2",Yg?-10:Of)}function p(){Tf=Of/2,Sf=.95*Tf,Uf=ae(uf.data.targets)?.6*Sf:0}function q(){var a=Yg?f.axisX:f.axisY,b=tf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=tf.select(wf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return xf?xf:x()}function s(){var a=yf?yf:y();return a>0?a:320}function t(){return be(uf.data.targets)?0:zf?zf:Yg||!ph||uh?1:v("y")}function u(){var a=1;return be(uf.data.targets)?0:Af?Af:Ni?P()+(yh&&!Yg?v("y2"):a):yh?Dh||Yg?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||Zg?"x"===a&&mh?mh:"y"!==a||ph?"y2"!==a||yh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Ui:Sg&&!Ni?10:1:0}function x(){return+tf.select(wf).style("width").replace("px","")}function y(){return+tf.select(wf).style("height").replace("px","")}function z(a){return a?-5:-(Jf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Yg)}function C(){return A(!Yg)}function D(){return z(Yg)}function E(){return A(Yg)}function F(a){return a?Mf+2+4:Jf.left+20}function G(a){return a?(mh?mh:0)+40:Of+2}function H(){return F(!Yg)}function I(){return G(!Yg)}function J(){return F(Yg)}function K(){return G(Yg)}function L(){var a=Yg?Of:Mf,b=Ac(),c=Yb()*(Zd(uf.data.targets)?(b-(wi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){Oi=a}function N(a){Pi=a}function O(a){Qi=a}function P(){return Sg?Ni?Pi*(Oi+1):Qf:0}function Q(){return Sg?Ni?Rf:Qi*(Oi+1):0}function R(){var a,b=!fg;Zf=Yg?1:0,$f=Yg?Of:Mf,_f=Yg?0:Of,ag=Yg?Mf:1,bg=Zf,cg=$f,dg=Yg?0:Pf,eg=Yg?Nf:1,fg=T(Zf,$f,b?void 0:fg.domain(),function(){return lg.tickOffset()}),gg=U(_f,ag),hg=U(_f,ag),ig=T(Zf,$f,fj,function(a){return a%1?0:og.tickOffset()}),jg=U(dg,eg),kg=U(dg,eg),a=$(),lg=X(fg,Ii,a),og=X(ig,Li,a),mg=Y(gg,Ji,vh,xh),ng=Y(hg,Ki,Eh,Gh),b||(Vi.scale(ig),Bf&&Zi.scale(fg)),S()}function S(){Vf=Gb(),Wf=Hb(),Xf=Hb(.98)}function T(a,b,e,f){var g=(vi?tf.time.scale():tf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),wi){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return tf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?hg:gg}function W(a){return"y2"===Z(a)?kg:jg}function X(a,b,c){var d=(wi?Eb():tf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),wi?(d.tickCentered(bh),se(dh)&&(dh=!1)):d.tickOffset=function(){var a=Yg?Of:Mf;return a*Yb()/Ac()/2},wi&&d.categories(ah),d}function Y(a,b,c,d){return tf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in wg?wg[a]:"y"}function $(){var a=vi?Fi:wi?Tc:function(a){return 0>a?a.toFixed(0):a};return ch&&("function"==typeof ch?a=ch:vi&&(a=function(a){return a?Ei(ch)(a):""})),a}function _(a){var b;return"y"===a?b=th:"y2"===a?b=Ch:"x"===a&&(b=oh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?th=b:"y2"===a?Ch=b:"x"===a&&(oh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a){a.selectAll(".tick text").attr("y",db(ih)).attr("x",cb(ih)).attr("transform","rotate("+ih+")").style("text-anchor","start")}function fb(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 gb(){return fb("x",Yg?"inner-top":"inner-right")}function hb(){return fb("y",Yg?"inner-right":"inner-top")}function ib(){return fb("y2",Yg?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Mf/2:Mf:b.isBottom?-Of:b.isMiddle?-Of/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!Yg,gb())}function rb(){return nb(Yg,hb())}function sb(){return nb(Yg,ib())}function tb(){return ob(!Yg,gb())}function ub(){return ob(Yg,hb())}function vb(){return ob(Yg,ib())}function wb(){var a=gb();return Yg?a.isInner?"1.2em":-30-Cb("x"):a.isInner?"-0.5em":"3em"}function xb(){var a=hb();return Yg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return Yg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!Yg,gb())}function Ab(){return pb(Yg,hb())}function Bb(){return pb(Yg,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return tf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Db(){aj.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).text(kb),aj.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dy",xb).text(lb),aj.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dy",yb).text(mb)}function Eb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+o)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Rc(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 tf.min(Object.keys(i).map(function(a){return tf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(vg.length>0)for(g=Sc(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 tf.max(Object.keys(i).map(function(a){return tf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Ah:rh,n="y2"===c?zh:qh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Bh:sh,r=ud()&&Yg;return 0===l.length?"y2"===c?hg.domain():gg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=bc(gg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&wh&&(f=b(wh.top)?wh.top:e,g=b(wh.bottom)?wh.bottom:e),"y2"===c&&Fh&&(f=b(Fh.top)?Fh.top:e,g=b(Fh.bottom)?Fh.bottom:e),Zd(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){var b=bc(fj),c=bc(fg.domain());return a||0===c?1:b/c}function Zb(a){return kh?vi?oe(kh):kh:tf.min(a,function(a){return tf.min(a.values,function(a){return a.x})})}function $b(a){return jh?vi?oe(jh):jh:tf.max(a,function(a){return tf.max(a.values,function(a){return a.x})})}function _b(a,c){var d,e,f,g,h=c[0],i=c[1],j=Math.abs(h-i);return wi?e=0:Zd(a)?(d=Ac(),e=d>1?j/(d-1)/2:.5):e=.01*j,"object"==typeof lh&&te(lh)?(f=b(lh.left)?lh.left:e,g=b(lh.right)?lh.right:e):f=g="number"==typeof lh?lh:e,{left:f,right:g}}function ac(a){var b=[Zb(a),$b(a)],c=b[0],d=b[1],e=_b(a,b),f=0,g=0;return(c||0===c)&&(f=vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function bc(a){return a[1]-a[0]}function cc(a){for(var b=0;bb?0:b-c}function ic(a){var b,c=gc(a),d="y"===a.axis?gg:hg;return b="y"===a.axis||"y2"===a.axis?Yg?Of:"start"in a?d(a.start):Of:Yg?"end"in a?fg(vi?oe(a.end):a.end):Of:Of,c>b?0:b-c}function jc(a){return pg&&a===pg||te(qg)&&ue(qg,a)}function kc(a){return!jc(a)}function lc(a){return pg?pg:te(qg)?qg[a]:null}function mc(a,b){var c,d=b&&te(b)?Cc(b):[];return d.forEach(function(b){lc(b)===a&&(c=uf.data.xs[b])}),c}function nc(a,b){return a in uf.data.xs&&uf.data.xs[a]&&uf.data.xs[a][b]?uf.data.xs[a][b]:b}function oc(a){Object.keys(a).forEach(function(b){qg[b]=a[b]})}function pc(a){return 1===tf.set(Object.keys(a).map(function(b){return a[b]})).size()}function qc(a){var b;return a&&(b=tg[a.id],a.name=b?b:a.id),a}function rc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=tc(b[d],a.id,d)}),uf.data.xs[a.id]=b})}function sc(a,b){a.forEach(function(a){b[a.id]&&rc([a],b[a.id])})}function tc(a,b,c){var d;return d=vi?a?a instanceof Date?a:oe(a):oe(nc(b,c)):xi&&!wi?a?+a:nc(b,c):c}function uc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?uf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):pg?(d=Object.keys(uf.data.xs),uf.data.xs[c]=d.length>0?uf.data.xs[d[0]]:void 0):te(qg)&&(uf.data.xs[c]=mc(f,uf.data.targets)):uf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!uf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=sg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=lc(b),g=a[f],h=tc(g,b,e);return xi&&wi&&0===c&&g&&(0===e&&(ah=[]),ah.push(g)),("undefined"==typeof a[b]||uf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),xg&&Xd(Cc(c).filter(function(a){return!(a in yg)}),xg),c.forEach(function(a){dc(a.id_org,a)}),c}function xc(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 yc(a){return a>0&&uf.data.targets[0].values[a-1]?uf.data.targets[0].values[a-1].x:void 0}function zc(a){return a1?uf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?uf.data.targets[0]:null,a}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(uf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(vi?new Date(h):h);i.push(d)}return vi||(i=i.sort(function(a,b){return a-b})),i}function Lc(a){Gi=Gi.concat(a)}function Mc(a){Gi=Gi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Hi=Hi.concat(a)}function Oc(a){Hi=Hi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Dd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Dd(a,g))),Gd(e,b)):Ed(a,b,f,g)}function Fd(a,b){var c;return c=a.map(function(a){return Ed(a.values,b)}),Gd(c,b)}function Gd(a,b){var c,d;return a.forEach(function(a){var e=ve(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Hd(a,b){return tf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Id(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 Jd(){return Ag&&"desc"===Ag.toLowerCase()}function Kd(){return Ag&&"asc"===Ag.toLowerCase()}function Ld(a){var b=Kd(),c=Jd();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 Ag&&a.sort(Ag),a}function Md(a,c){var d,e,f,g,h,i,j,k=be(uf.data.targets),l=k?xd:wd,m=a.filter(function(a){return a&&b(a.value)});ii&&0!==m.length&&(dj.html(li(a,$(),l,Di)).style("display","block"),d=dj.property("offsetWidth"),e=dj.property("offsetHeight"),k?(g=Mf/2+c[0],i=Of/2+c[1]+20):(Yg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=fg(m[0].x)+20):(f=q(),g=f+t()+fg(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),dj.style("top",i+"px").style("left",g+"px"))}function Nd(){dj.style("display","none")}function Od(a){var c=a.filter(function(a){return a&&b(a.value)});ii&&($d(uf.data.targets)||be(uf.data.targets)||aj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Yg?"y1":"x1",zd).attr(Yg?"y2":"x2",zd))}function Pd(){aj.select("line."+f.xgridFocus).style("visibility","hidden")}function Qd(a){return a.x||0===a.x?fg(a.x):null}function Rd(a){return V(a.id)(a.value)}function Sd(){var a,b,d={},e=0;return Ic(Fc(ee)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Wd(a,b){return Uh?Uh:b?2*a.tickOffset()*Vh/b:0}function Xd(a,b){Dc(a).forEach(function(a){hj[a]=b===yg[a],yg[a]=b})}function Yd(a,b){var c=!1;return a.forEach(function(a){yg[a.id]===b&&(c=!0),a.id in yg||"line"!==b||(c=!0)}),c}function Zd(a){return Yd(a,"bar")}function $d(a){return Yd(a,"scatter")}function _d(a){return Yd(a,"pie")}function ae(a){return Yd(a,"donut")}function be(a){return _d(a)||ae(a)}function ce(a){var b="string"==typeof a?a:a.id;return!(b in yg)||"line"===yg[b]||"spline"===yg[b]||"area"===yg[b]||"area-spline"===yg[b]}function de(a){var b="string"==typeof a?a:a.id;return"spline"===yg[b]||"area-spline"===yg[b]}function ee(a){var b="string"==typeof a?a:a.id;return"bar"===yg[b]}function fe(a){var b="string"==typeof a?a:a.id;return"scatter"===yg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"pie"===yg[b]}function he(a){var b="string"==typeof a?a:a.id;return"donut"===yg[b]}function ie(a){return ge(a)||he(a)}function je(a){return ee(a)?a.values:[]}function ke(a){return ce(a)||fe(a)?a.values:[]}function le(a){return ee(a)||ce(a)?a.values:[]}function me(a){return he(a)&&ci||ge(a)&&Yh}function ne(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function oe(b){var c;try{c=rg?tf.time.format(rg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+rg)}return c}function pe(a,b){var c=tf.mouse(a),d=tf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function ue(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ve(a,b){var c="y"===Z(a.id)?gg:hg,d=Yg?1:0,e=Yg?0:1;return Math.pow(fg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function we(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function xe(a,b,c){Lg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd).attr("stroke",function(){return Di(b)}).attr("r",1.4*Sh).transition().duration(100).attr("r",Sh)}function ye(a,b,c){Mg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ze(a,b,c,d){a?xe(b,c,d):ye(b,c,d)}function Ae(a,b){Lg(b,a.node()),a.transition().duration(100).style("fill",function(){return tf.rgb(Di(b)).darker(1)})}function Be(a,b){Mg(b,a.node()),a.transition().duration(100).style("fill",function(){return Di(b)})}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a){return a.filter(function(a){return b(a.value)})}function Ee(a,c){return(c?aj.selectAll("."+f.circles+ld(c)):aj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Fe(a,b){Ee(a,b).classed(f.EXPANDED,!0).attr("r",Rh)}function Ge(a){Ee(a).filter(function(){return tf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oh)}function He(a){return aj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ie(a){He(a).classed(f.EXPANDED,!0)}function Je(a){He(a).classed(f.EXPANDED,!1)}function Ke(a,b){var c=Oe(a,b);return function(a,b){var d=c(a,b),e=Yg?1:0,f=Yg?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 Le(a,b){var c=Oe(a,!1),d=b?Me:Ne;return function(a,b){return d(c(a,b),a,this)}}function Me(a,b){var c;return Yg?(c=ee(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ne(a,b,c){var d=c.getBoundingClientRect();return Yg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ee(b)?-3:-6)}function Oe(a,b){var c=a.__max__+1,d=Wd(lg,c),e=Td(d,c,a,!!b),f=Ud(!!b),g=Vd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Yg&&(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 Pe(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 Qe(b){var c,d,e;if(ej=tf.select(wf),ej.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ej.html(""),ej.classed("c3",!0),uf.data.xs={},uf.data.targets=wc(b),n(),R(),fg.domain(tf.extent(ac(uf.data.targets))),gg.domain(Xb(uf.data.targets,"y")),hg.domain(Xb(uf.data.targets,"y2")),ig.domain(fg.domain()),jg.domain(gg.domain()),kg.domain(hg.domain()),fj=fg.domain(),Vi.scale(ig),Bf&&Zi.scale(fg),$i=ej.append("svg").attr("width",Mf+Jf.left+Jf.right).attr("height",Of+Jf.top+Jf.bottom).on("mouseenter",Ef).on("mouseleave",Ff),_i=$i.append("defs"),_i.append("clipPath").attr("id",pi).append("rect").attr("width",Mf).attr("height",Of),_i.append("clipPath").attr("id",qi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),_i.append("clipPath").attr("id",ri).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),aj=$i.append("g").attr("transform",Mi.main),bj=Pg?$i.append("g").attr("transform",Mi.context):null,cj=$i.append("g").attr("transform",Mi.legend),Sg||(cj.style("visibility","hidden"),Hi=Cc(uf.data.targets)),dj=tf.select(wf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),of(Cc(uf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Zg&&aj.append("g").attr("class",f.axisX).attr("clip-path",ti).attr("transform",Mi.x).append("text").attr("class",f.axisXLabel).attr("transform",Yg?"rotate(-90)":"").attr("dx",tb).attr("dy",wb).style("text-anchor",zb),ph&&aj.append("g").attr("class",f.axisY).attr("clip-path",ui).attr("transform",Mi.y).append("text").attr("class",f.axisYLabel).attr("transform",Yg?"":"rotate(-90)").attr("dx",ub).attr("dy",xb).style("text-anchor",Ab),yh&&aj.append("g").attr("class",f.axisY2).attr("transform",Mi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Yg?"":"rotate(-90)").attr("dx",vb).style("text-anchor",Bb),d=aj.append("g").attr("clip-path",si).attr("class",f.grid),Hh&&d.append("g").attr("class",f.xgrids),te(Jh)&&d.append("g").attr("class",f.xgridLines),Ph&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Kh&&d.append("g").attr("class",f.ygrids),te(Lh)&&d.append("g").attr("class",f.ygridLines),aj.append("g").attr("clip-path",si).attr("class",f.regions),aj.append("g").attr("clip-path",si).attr("class",f.chart),c=aj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Bf?Yg?"ns-resize":"ew-resize":null),aj.select("."+f.chart).append("g").attr("class",f.chartBars),aj.select("."+f.chart).append("g").attr("class",f.chartLines),aj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Mi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),aj.select("."+f.chart).append("g").attr("class",f.chartTexts),Bf&&aj.insert("rect",Df?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Mf).attr("height",Of).style("opacity",0).style("cursor",Yg?"ns-resize":"ew-resize").call(Zi).on("dblclick.zoom",null),nh&&Vi.extent("function"!=typeof nh?nh:nh(ac())),Pg&&(bj.append("g").attr("clip-path",si).attr("class",f.chart),bj.select("."+f.chart).append("g").attr("class",f.chartBars),bj.select("."+f.chart).append("g").attr("class",f.chartLines),bj.append("g").attr("clip-path",si).attr("class",f.brush).call(Vi).selectAll("rect").attr(Yg?"width":"height",Yg?Nf:Pf),bj.append("g").attr("class",f.axisX).attr("transform",Mi.subx).attr("clip-path",Yg?"":ti)),bf(uf.data.targets),Yg?aj.select("."+f.axisX).style("opacity",0).call(lg):(aj.select("."+f.axisY).style("opacity",0).call(mg),aj.select("."+f.axisY2).style("opacity",0).call(ng)),Xe({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),mi){if(vi&&"string"==typeof ni){for(ni=oe(ni),e=0;e0){d=[];for(var g in tg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Id(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ce,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 Ve(a){be(uf.data.targets)||Eg&&(yi=a,aj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),zi=!0,Ng())}function We(){be(uf.data.targets)||Eg&&(aj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),aj.selectAll("."+f.shape).classed(f.INCLUDED,!1),zi=!1,Og())}function Xe(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U=Sd(),V=be(uf.data.targets),W=Ic(uf.data.targets);if(0!==W.length){if(a=d(a)?a:{},z=d(a.withY)?a.withY:!0,A=d(a.withSubchart)?a.withSubchart:!0,B=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,C=d(a.withTransitionForExit)?a.withTransitionForExit:B,D=d(a.withTransitionForAxis)?a.withTransitionForAxis:B,E=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:B,O=B?If:0,P=C?O:0,Q=D?O:0,I&&Sg&&of(Cc(uf.data.targets),a),H&&(fg.domain(tf.extent(ac(W))),fj=fg.domain(),Bf&&Zi.scale(fg).updateScaleExtent(),ig.domain(fg.domain()),Vi.scale(ig)),G&&(fg.domain(Vi.empty()?fj:Vi.extent()),Bf&&Zi.scale(fg).updateScaleExtent()),gg.domain(Xb(W,"y")),hg.domain(Xb(W,"y2")),(gh||fh)&&(R=hh?hh:Kc(Jc(W)),lg.tickValues(R),og.tickValues(R)),c=aj.select("."+f.axisX).style("opacity",V?0:1),(Yg||E)&&(c=c.transition().duration(Q)),c.call(lg),g=aj.select("."+f.axisY).style("opacity",V?0:1),(!Yg||E)&&(g=g.transition().duration(Q)),g.call(mg),aj.select("."+f.axisY2).style("opacity",V?0:1).transition().duration(Q).call(ng),G)if(dh&&R){for(S=1;S=0&&tf.select(this).style("display",b%T?"none":"block")})}else tf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!Yg&&ih&&eb(c),J=Ke(U),M=Le(U,!0),N=Le(U,!1),Db(),jg.domain(gg.domain()),kg.domain(hg.domain()),dj.style("display","none"),o(),aj.select("line."+f.xgridFocus).style("visibility","hidden"),Hh){if("year"===Ih){i=[];for(var X=ac(),Y=X[0].getFullYear(),Z=X[1].getFullYear(),$=Y;Z>=$;$++)i.push(new Date($+"-01-01 00:00:00"))}else i=fg.ticks(10);h=aj.select("."+f.xgrids).selectAll("."+f.xgrid).data(i),h.enter().append("line").attr("class",f.xgrid),h.attr("x1",Yg?0:function(a){return fg(a)-lg.tickOffset()}).attr("x2",Yg?Mf:function(a){return fg(a)-lg.tickOffset()}).attr("y1",Yg?function(a){return fg(a)-lg.tickOffset()}:Jf.top).attr("y2",Yg?function(a){return fg(a)-lg.tickOffset()}:Of).style("opacity",function(){return+tf.select(this).attr(Yg?"y1":"x1")===(Yg?Of:0)?0:1}),h.exit().remove()}te(Jh)&&(j=aj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Jh),k=j.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),k.append("line").style("opacity",0),k.append("text").attr("text-anchor","end").attr("transform",Yg?"":"rotate(-90)").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),j.select("line").transition().duration(O).attr("x1",Yg?0:Ad).attr("x2",Yg?Mf:Ad).attr("y1",Yg?Ad:Jf.top).attr("y2",Yg?Ad:Of).style("opacity",1),j.select("text").transition().duration(O).attr("x",Yg?Mf:0).attr("y",Ad).text(function(a){return a.text}).style("opacity",1),j.exit().transition().duration(O).style("opacity",0).remove()),z&&Kh&&(l=aj.select("."+f.ygrids).selectAll("."+f.ygrid).data(gg.ticks(Mh)),l.enter().append("line").attr("class",f.ygrid),l.attr("x1",Yg?gg:0).attr("x2",Yg?gg:Mf).attr("y1",Yg?0:gg).attr("y2",Yg?Of:gg),l.exit().remove()),z&&te(Lh)&&(m=aj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Lh),n=m.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),n.append("line").style("opacity",0),n.append("text").attr("text-anchor","end").attr("transform",Yg?"rotate(-90)":"").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),m.select("line").transition().duration(O).attr("x1",Yg?Bd:0).attr("x2",Yg?Bd:Mf).attr("y1",Yg?0:Bd).attr("y2",Yg?Of:Bd).style("opacity",1),m.select("text").transition().duration(O).attr("x",Yg?0:Mf).attr("y",Bd).text(function(a){return a.text}).style("opacity",1),m.exit().transition().duration(O).style("opacity",0).remove()),q=aj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),q.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Di(a)}).attr("class",ad),q.style("opacity",qd).transition().duration(O).attr("d",J).style("opacity",1),q.exit().transition().duration(P).style("opacity",0).remove(),s=aj.selectAll("."+f.texts).selectAll("."+f.text).data(le),s.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return Yg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),s.text(function(a){return yd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(O).attr("x",M).attr("y",N).style("fill-opacity",td),s.exit().transition().duration(P).style("fill-opacity",0).remove(),aj.selectAll("."+f.line).style("opacity",qd).transition().duration(O).attr("d",Wi).style("opacity",1),aj.selectAll("."+f.area).style("opacity",0).transition().duration(O).attr("d",Xi).style("opacity",gj),p=aj.selectAll("."+f.circles).selectAll("."+f.circle).data(ke),p.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Oh),p.style("opacity",qd).transition().duration(O).style("opacity",sd).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),p.exit().remove(),aj.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(O).attrTween("d",function(a){var b,c=Fb(a);return c?(b=tf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1),aj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(O).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&ie(a.data)?1:0}),aj.select("."+f.chartArcsTitle).style("opacity",ae(uf.data.targets)?1:0),Pg&&(null!==tf.event&&"zoom"===tf.event.type&&Vi.extent(fg.orgDomain()).update(),A&&(e=bj.select("."+f.axisX).style("opacity",V?0:1),(Yg||E)&&(e=e.transition().duration(Q)),e.call(og),!Yg&&ih&&eb(e),Vi.empty()||Vi.extent(fg.orgDomain()).update(),K=Ke(U,!0),t=bj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),t.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Di(a)}).attr("class",ad),t.style("opacity",qd).transition().duration(O).attr("d",K).style("opacity",1),t.exit().transition().duration(O).style("opacity",0).remove(),bj.selectAll("."+f.line).style("opacity",qd).transition().duration(O).attr("d",Yi).style("opacity",1))),aj.selectAll("."+f.selectedCircles).filter(function(a){return ee(a)}).selectAll("circle").remove(),aj.selectAll("."+f.selectedCircle).transition().duration(O).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),u=aj.select("."+f.eventRects),te(qg)&&!pc(qg)?(u.classed(f.eventRectsMultiple)||u.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),v=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Se(v.enter()),v.attr("x",0).attr("y",0).attr("width",Mf).attr("height",Of)):(u.classed(f.eventRectsSingle)||u.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),xi&&!wi?(y=function(a,b){var c=yc(b),d=zc(b),e=uf.data.xs[a.id][b];return(fg(d?d:e+50)-fg(c?c:e-50))/2},x=function(a,b){var c=yc(b),d=uf.data.xs[a.id][b];return(fg(d)+fg(c?c:d-50))/2}):(y=L(),x=function(a){return fg(a.x)-y/2}),w=Bc(),aj.select("."+f.eventRects).datum(w?w.values:[]),v=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Re(v.enter()),v.attr("class",fd).attr("x",Yg?0:x).attr("y",Yg?x:0).attr("width",Yg?Mf:y).attr("height",Yg?y:Of),v.exit().remove()),r=aj.select("."+f.regions).selectAll("rect."+f.region).data(hi),r.enter().append("rect").style("fill-opacity",0),r.attr("class",ed).attr("x",fc).attr("y",gc).attr("width",hc).attr("height",ic).transition().duration(O).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Cc(uf.data.targets).forEach(function(a){hj[a]=!0})}}function Ye(){Xe({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ze(){return"mousemove"===tf.event.sourceEvent.type&&Zi.altDomain?(fg.domain(Zi.altDomain),void Zi.scale(fg).updateScaleExtent()):(wi&&fg.orgDomain()[0]===fj[0]&&fg.domain([fj[0]-1e-10,fg.orgDomain()[1]]),Xe({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===tf.event.sourceEvent.type&&(Ai=!0)))}function $e(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function _e(){$i.attr("width",Qf).attr("height",Rf),$i.select("#"+pi).select("rect").attr("width",Mf).attr("height",Of),$i.select("#"+qi).select("rect").attr("width",H),$i.select("#"+ri).select("rect").attr("width",J),$i.select("."+f.zoomRect).attr("width",Mf).attr("height",Of)}function af(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),_e(),m(a.withTransition),Xe(a)}function bf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=aj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Di(a)}),e=aj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("fill",function(a){return Di(a)}).style("stroke","none").style("cursor",function(a){return Gg(a)?"pointer":null}),c=aj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)}),b.append("path").attr("class",dd).style("opacity",function(){return gj=+tf.select(this).style("opacity"),0}).style("fill",function(a){return Di(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Di(a)}).style("cursor",function(a){return Gg(a)?"pointer":null}),a.forEach(function(a){aj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=aj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Yf(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Di(a.data)}).style("cursor",function(a){return Gg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Fb(a),d=Lb(c),e=Tb();Nb(c.data.id),jf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Fb(a),c=[Lb(b)];Md(c,tf.mouse(this))}).on("mouseout",function(a,b){var c=Fb(a),d=Lb(c),e=Ub();Ob(c.data.id),lf(),Nd(),e(d,b)}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Pg&&(n=bj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Di(a)}),l=bj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)})),$i.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function cf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Xd(a.id,b.types[a.id]):Xd(a.id,b.type)}),uf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Ni?j:i,l=Ni?Q():P();return d&&(w=0,C=0,t=0,u=0),Sg&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Ni?u:t,void(Xg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,Ni?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=cj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Ug?Ug(a):uf.toggle(a)}).on("mouseover",function(a){uf.focus(a),"function"==typeof Vg&&Vg(a)}).on("mouseout",function(a){uf.revert(),"function"==typeof Wg&&Wg(a)}),l.append("text").text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",Ni?g:-200).attr("y",Ni?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ni?h:-200).attr("y",Ni?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Di(a)}).attr("x",Ni?g:-200).attr("y",Ni?-200:i).attr("width",10).attr("height",10),cj.selectAll("text").data(a).text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),cj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),cj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),_e(),q&&m(p)}function pf(a){return Ec(uf.data.targets,a.id)}function qf(a){return"data"in a&&Ec(uf.data.targets,a.data.id)}function rf(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 sf(a,b,c){var d=!be(uf.data.targets);Xd(a,b),af(c?c:{withTransitionForAxis:d})}var tf=a.d3?a.d3:a.require?a.require("d3"):void 0,uf={data:{},axis:{},legend:{}},vf={},wf=h(["bindto"],"#chart"),xf=h(["size","width"]),yf=h(["size","height"]),zf=h(["padding","left"]),Af=h(["padding","right"]),Bf=h(["zoom","enabled"],!1),Cf=h(["zoom","extent"]),Df=h(["zoom","privileged"],!1),Ef=h(["onenter"],function(){}),Ff=h(["onleave"],function(){}),Gf=h(["onresize"],function(){}),Hf=h(["onresized"],function(){}),If=h(["transition","duration"],350);g("data","data is required in config");var Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg=h(["data","x"]),qg=h(["data","xs"],{}),rg=h(["data","x_format"]),sg=h(["data","id_converter"],function(a){return a}),tg=h(["data","names"],{}),ug=h(["data","classes"],{}),vg=h(["data","groups"],[]),wg=h(["data","axes"],{}),xg=h(["data","type"]),yg=h(["data","types"],{}),zg=h(["data","labels"],{}),Ag=h(["data","order"]),Bg=h(["data","regions"],{}),Cg=h(["data","color"]),Dg=h(["data","colors"],{}),Eg=h(["data","selection","enabled"],!1),Fg=h(["data","selection","grouped"],!1),Gg=h(["data","selection","isselectable"],function(){return!0}),Hg=h(["data","selection","multiple"],!0),Ig=h(["data","onclick"],function(){}),Jg=h(["data","onenter"],function(){}),Kg=h(["data","onleave"],function(){}),Lg=h(["data","onselected"],function(){}),Mg=h(["data","onunselected"],function(){}),Ng=h(["data","ondragstart"],function(){}),Og=h(["data","ondragend"],function(){}),Pg=h(["subchart","show"],!1),Qg=h(["subchart","size","height"],60),Rg=h(["color","pattern"],[]),Sg=h(["legend","show"],!0),Tg=h(["legend","position"],"bottom"),Ug=h(["legend","item","onclick"]),Vg=h(["legend","item","onmouseover"]),Wg=h(["legend","item","onmouseout"]),Xg=h(["legend","equally"],!1),Yg=h(["axis","rotated"],!1),Zg=h(["axis","x","show"],!0),$g=h(["axis","x","type"],"indexed"),_g=h(["axis","x","localtime"],!0),ah=h(["axis","x","categories"],[]),bh=h(["axis","x","tick","centered"],!1),ch=h(["axis","x","tick","format"]),dh=h(["axis","x","tick","culling"],{}),eh=h(["axis","x","tick","culling","max"],10),fh=h(["axis","x","tick","count"]),gh=h(["axis","x","tick","fit"],!0),hh=h(["axis","x","tick","values"],null),ih=h(["axis","x","tick","rotate"]),jh=h(["axis","x","max"]),kh=h(["axis","x","min"]),lh=h(["axis","x","padding"],{}),mh=h(["axis","x","height"]),nh=h(["axis","x","default"]),oh=h(["axis","x","label"],{}),ph=h(["axis","y","show"],!0),qh=h(["axis","y","max"]),rh=h(["axis","y","min"]),sh=h(["axis","y","center"]),th=h(["axis","y","label"],{}),uh=h(["axis","y","inner"],!1),vh=h(["axis","y","tick","format"]),wh=h(["axis","y","padding"],{}),xh=h(["axis","y","ticks"],10),yh=h(["axis","y2","show"],!1),zh=h(["axis","y2","max"]),Ah=h(["axis","y2","min"]),Bh=h(["axis","y2","center"]),Ch=h(["axis","y2","label"],{}),Dh=h(["axis","y2","inner"],!1),Eh=h(["axis","y2","tick","format"]),Fh=h(["axis","y2","padding"],{}),Gh=h(["axis","y2","ticks"],10),Hh=h(["grid","x","show"],!1),Ih=h(["grid","x","type"],"tick"),Jh=h(["grid","x","lines"],[]),Kh=h(["grid","y","show"],!1),Lh=h(["grid","y","lines"],[]),Mh=h(["grid","y","ticks"],10),Nh=h(["point","show"],!0),Oh=Nh?h(["point","r"],2.5):0,Ph=h(["point","focus","line","enabled"],!0),Qh=h(["point","focus","expand","enabled"],!0),Rh=h(["point","focus","expand","r"],Qh?4:Oh),Sh=h(["point","focus","select","r"],8),Th=h(["line","connect_null"],!1),Uh=h(["bar","width"]),Vh=h(["bar","width","ratio"],.6),Wh=h(["pie","label","show"],!0),Xh=h(["pie","label","format"]),Yh=h(["pie","expand"],!0),Zh=h(["pie","onclick"],function(){}),$h=h(["pie","onmouseover"],function(){}),_h=h(["pie","onmouseout"],function(){}),ai=h(["donut","label","show"],!0),bi=h(["donut","label","format"]),ci=h(["donut","expand"],!0),di=h(["donut","title"],""),ei=h(["donut","onclick"],function(){}),fi=h(["donut","onmouseover"],function(){}),gi=h(["donut","onmouseout"],function(){}),hi=h(["regions"],[]),ii=h(["tooltip","show"],!0),ji=h(["tooltip","format","title"]),ki=h(["tooltip","format","value"]),li=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ji?ji:b,l=ki?ki: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+""}),mi=h(["tooltip","init","show"],!1),ni=h(["tooltip","init","x"],0),oi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),pi=("string"==typeof wf?wf.replace("#",""):wf.id)+"-clip",qi=pi+"-xaxis",ri=pi+"-yaxis",si=i(pi),ti=i(qi),ui=i(ri),vi="timeseries"===$g,wi="categorized"===$g,xi=!vi&&(pg||te(qg)),yi=null,zi=!1,Ai=!1,Bi=!1,Ci=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Di=ne(Dg,te(Rg)?Rg:Ci,Cg),Ei=_g?tf.time.format:tf.time.format.utc,Fi=function(){var a=[[Ei("%Y/%-m/%-d"),function(){return!0}],[Ei("%-m/%-d"),function(a){return a.getMonth()}],[Ei("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ei("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ei("%I %p"),function(a){return a.getHours()}],[Ei("%I:%M"),function(a){return a.getMinutes()}],[Ei(":%S"),function(a){return a.getSeconds()}],[Ei(".%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)}}(),Gi=[],Hi=[],Ii=Yg?"left":"bottom",Ji=Yg?uh?"top":"bottom":uh?"right":"left",Ki=Yg?Dh?"bottom":"top":Dh?"left":"right",Li=Yg?"left":"bottom",Mi={main:function(){return"translate("+Jf.left+","+Jf.top+")"},context:function(){return"translate("+Kf.left+","+Kf.top+")"},legend:function(){return"translate("+Lf.left+","+Lf.top+")"},x:function(){return"translate(0,"+(Yg?0:Of)+")"},y:function(){return"translate(0,"+(Yg?Of:0)+")"},y2:function(){return"translate("+(Yg?0:Mf)+","+(Yg?1:0)+")"},subx:function(){return"translate(0,"+(Yg?0:Pf)+")"},arc:function(){return"translate("+Mf/2+","+Of/2+")"}},Ni="right"===Tg,Oi=0,Pi=0,Qi=0,Ri=.15,Si=30,Ti=Yg&&!Zg?0:30,Ui=5;Yf=tf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Vi,Wi=function(){var a=tf.svg.line().x(Yg?function(a){return V(a.id)(a.value)}:zd).y(Yg?zd:function(a){return V(a.id)(a.value)});return Th||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Th?De(b.values):b.values;return ce(b)?(a.interpolate(de(b)?"cardinal":"linear"),Bg[b.id]?Pe(e,fg,V(b.id),Bg[b.id]):a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Xi=function(){var a;return a=Yg?tf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(zd):tf.svg.area().x(zd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=De(b.values);return Yd([b],"area")||Yd([b],"area-spline")?(a.interpolate(de(b)?"cardinal":"linear"),a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Yi=function(){var a=tf.svg.line().x(Yg?function(a){return W(a.id)(a.value)}:Cd).y(Yg?Cd:function(a){return W(a.id)(a.value)});return function(b){var c=De(b.values);return ce(b)?a(c):"M "+ig(c[0].x)+" "+W(b.id)(c[0].value)}}(),Zi=function(){};Vi=tf.svg.brush().on("brush",Ye),Vi.update=function(){return bj&&bj.select("."+f.brush).call(this),this},Vi.scale=function(a){return Yg?this.y(a):this.x(a)},Bf&&(Zi=tf.behavior.zoom().on("zoomstart",function(){Zi.altDomain=tf.event.sourceEvent.altKey?fg.orgDomain():null}).on("zoom",Bf?Ze:null),Zi.scale=function(a){return Yg?this.y(a):this.x(a)},Zi.orgScaleExtent=function(){var a=Cf?Cf:[1,10];return[a[0],Math.max(Ac()/a[1],a[1])]},Zi.updateScaleExtent=function(){var a=bc(fg.orgDomain())/bc(fj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var $i,_i,aj,bj,cj,dj,ej,fj,gj,hj={};if(uf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),uf.defocus(),b(d.classed(f.focused,!0)),b(e),be(uf.data.targets)&&Nb(a,!0),jf(a)},uf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),kf(a)},uf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),lf()},uf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),$i.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?mf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},uf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),$i.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?nf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Ri),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},uf.toggle=function(a){Gc(a)?uf.hide(a):uf.show(a)},uf.unzoom=function(){Vi.clear().update(),Xe({withUpdateXDomain:!0})},uf.load=function(a){return a.xs&&oc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){ug[b]=a.classes[b]}),"categories"in a&&wi&&(ah=a.categories,lg.categories(ah)),"cacheIds"in a&&cc(a.cacheIds)?void cf(ec(a.cacheIds),a.done):void("unload"in a?ef(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){df(a)}):df(a))},uf.unload=function(a){ef(Dc(a),function(){Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},uf.selected=function(a){return tf.merge(aj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return tf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},uf.select=function(a,b,c){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=tf.select(this),i="circle"===this.nodeName?xe:Ae,j="circle"===this.nodeName?ye:Be,k=Fg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Gg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},uf.unselect=function(a,b){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=tf.select(this),g="circle"===this.nodeName?ye:Be,h=Fg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Gg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},uf.toLine=function(a){sf(a,"line")},uf.toSpline=function(a){sf(a,"spline")},uf.toBar=function(a){sf(a,"bar")},uf.toScatter=function(a){sf(a,"scatter")},uf.toArea=function(a){sf(a,"area")},uf.toAreaSpline=function(a){sf(a,"area-spline")},uf.toPie=function(a){sf(a,"pie",{withTransform:!0})},uf.toDonut=function(a){sf(a,"donut",{withTransform:!0})},uf.groups=function(a){return c(a)?vg:(vg=a,Xe(),vg)},uf.xgrids=function(a){return a?(Jh=a,Xe(),Jh):Jh},uf.xgrids.add=function(a){return a?uf.xgrids(Jh.concat(a)):void 0},uf.xgrids.remove=function(a){var b=rf(a);return uf.xgrids(Jh.filter(b))},uf.ygrids=function(a){return a?(Lh=a,Xe(),Lh):Lh},uf.ygrids.add=function(a){return a?uf.ygrids(Lh.concat(a)):void 0},uf.ygrids.remove=function(a){var b=rf(a); +}dj.html(li(uf.data.targets.map(function(a){return qc(a.values[ni])}),$(),wd,Di)),dj.style("top",oi.top).style("left",oi.left).style("display","block")}null==a.onresize&&(a.onresize=$e()),a.onresize.add&&(a.onresize.add(Gf),a.onresize.add(function(){af({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})}),a.onresize.add(Hf))}function Re(a){a.append("rect").attr("class",fd).style("cursor",Eg&&Fg?"pointer":null).on("mouseover",function(a,b){if(!zi&&!be(uf.data.targets)){var c,d,e=uf.data.targets.map(function(a){return qc(a.values[b])});if(Object.keys(tg).length>0){d=[];for(var g in tg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Id(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ce,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 Ve(a){be(uf.data.targets)||Eg&&(yi=a,aj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),zi=!0,Ng())}function We(){be(uf.data.targets)||Eg&&(aj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),aj.selectAll("."+f.shape).classed(f.INCLUDED,!1),zi=!1,Og())}function Xe(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U=Sd(),V=be(uf.data.targets),W=Ic(uf.data.targets);if(0!==W.length){if(a=d(a)?a:{},z=d(a.withY)?a.withY:!0,A=d(a.withSubchart)?a.withSubchart:!0,B=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,C=d(a.withTransitionForExit)?a.withTransitionForExit:B,D=d(a.withTransitionForAxis)?a.withTransitionForAxis:B,E=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:B,O=B?If:0,P=C?O:0,Q=D?O:0,I&&Sg&&of(Cc(uf.data.targets),a),H&&(fg.domain(tf.extent(ac(W))),fj=fg.domain(),Bf&&Zi.scale(fg).updateScaleExtent(),ig.domain(fg.domain()),Vi.scale(ig)),G&&(fg.domain(Vi.empty()?fj:Vi.extent()),Bf&&Zi.scale(fg).updateScaleExtent()),gg.domain(Xb(W,"y")),hg.domain(Xb(W,"y2")),(gh||fh)&&(R=hh?hh:Kc(Jc(W)),lg.tickValues(R),og.tickValues(R)),c=aj.select("."+f.axisX).style("opacity",V?0:1),(Yg||E)&&(c=c.transition().duration(Q)),c.call(lg),g=aj.select("."+f.axisY).style("opacity",V?0:1),(!Yg||E)&&(g=g.transition().duration(Q)),g.call(mg),aj.select("."+f.axisY2).style("opacity",V?0:1).transition().duration(Q).call(ng),G)if(dh&&R){for(S=1;S=0&&tf.select(this).style("display",b%T?"none":"block")})}else tf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!Yg&&ih&&eb(c),J=Ke(U),M=Le(U,!0),N=Le(U,!1),Db(),jg.domain(gg.domain()),kg.domain(hg.domain()),dj.style("display","none"),o(),aj.select("line."+f.xgridFocus).style("visibility","hidden"),Hh){if("year"===Ih){i=[];for(var X=ac(),Y=X[0].getFullYear(),Z=X[1].getFullYear(),$=Y;Z>=$;$++)i.push(new Date($+"-01-01 00:00:00"))}else i=fg.ticks(10);h=aj.select("."+f.xgrids).selectAll("."+f.xgrid).data(i),h.enter().append("line").attr("class",f.xgrid),h.attr("x1",Yg?0:function(a){return fg(a)-lg.tickOffset()}).attr("x2",Yg?Mf:function(a){return fg(a)-lg.tickOffset()}).attr("y1",Yg?function(a){return fg(a)-lg.tickOffset()}:Jf.top).attr("y2",Yg?function(a){return fg(a)-lg.tickOffset()}:Of).style("opacity",function(){return+tf.select(this).attr(Yg?"y1":"x1")===(Yg?Of:0)?0:1}),h.exit().remove()}te(Jh)&&(j=aj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Jh),k=j.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),k.append("line").style("opacity",0),k.append("text").attr("text-anchor","end").attr("transform",Yg?"":"rotate(-90)").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),j.select("line").transition().duration(O).attr("x1",Yg?0:Ad).attr("x2",Yg?Mf:Ad).attr("y1",Yg?Ad:Jf.top).attr("y2",Yg?Ad:Of).style("opacity",1),j.select("text").transition().duration(O).attr("x",Yg?Mf:0).attr("y",Ad).text(function(a){return a.text}).style("opacity",1),j.exit().transition().duration(O).style("opacity",0).remove()),z&&Kh&&(l=aj.select("."+f.ygrids).selectAll("."+f.ygrid).data(gg.ticks(Mh)),l.enter().append("line").attr("class",f.ygrid),l.attr("x1",Yg?gg:0).attr("x2",Yg?gg:Mf).attr("y1",Yg?0:gg).attr("y2",Yg?Of:gg),l.exit().remove()),z&&te(Lh)&&(m=aj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Lh),n=m.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),n.append("line").style("opacity",0),n.append("text").attr("text-anchor","end").attr("transform",Yg?"rotate(-90)":"").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),m.select("line").transition().duration(O).attr("x1",Yg?Bd:0).attr("x2",Yg?Bd:Mf).attr("y1",Yg?0:Bd).attr("y2",Yg?Of:Bd).style("opacity",1),m.select("text").transition().duration(O).attr("x",Yg?0:Mf).attr("y",Bd).text(function(a){return a.text}).style("opacity",1),m.exit().transition().duration(O).style("opacity",0).remove()),q=aj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),q.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Di(a)}).attr("class",ad),q.style("opacity",qd).transition().duration(O).attr("d",J).style("opacity",1),q.exit().transition().duration(P).style("opacity",0).remove(),s=aj.selectAll("."+f.texts).selectAll("."+f.text).data(le),s.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return Yg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),s.text(function(a){return yd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(O).attr("x",M).attr("y",N).style("fill-opacity",td),s.exit().transition().duration(P).style("fill-opacity",0).remove(),aj.selectAll("."+f.line).style("opacity",qd).transition().duration(O).attr("d",Wi).style("opacity",1),aj.selectAll("."+f.area).style("opacity",0).transition().duration(O).attr("d",Xi).style("opacity",gj),p=aj.selectAll("."+f.circles).selectAll("."+f.circle).data(ke),p.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Oh),p.style("opacity",qd).transition().duration(O).style("opacity",sd).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),p.exit().remove(),aj.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(O).attrTween("d",function(a){var b,c=Fb(a);return c?(b=tf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1),aj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(O).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&ie(a.data)?1:0}),aj.select("."+f.chartArcsTitle).style("opacity",ae(uf.data.targets)?1:0),Pg&&(null!==tf.event&&"zoom"===tf.event.type&&Vi.extent(fg.orgDomain()).update(),A&&(e=bj.select("."+f.axisX).style("opacity",V?0:1),(Yg||E)&&(e=e.transition().duration(Q)),e.call(og),!Yg&&ih&&eb(e),Vi.empty()||Vi.extent(fg.orgDomain()).update(),K=Ke(U,!0),t=bj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),t.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Di(a)}).attr("class",ad),t.style("opacity",qd).transition().duration(O).attr("d",K).style("opacity",1),t.exit().transition().duration(O).style("opacity",0).remove(),bj.selectAll("."+f.line).style("opacity",qd).transition().duration(O).attr("d",Yi).style("opacity",1))),aj.selectAll("."+f.selectedCircles).filter(function(a){return ee(a)}).selectAll("circle").remove(),aj.selectAll("."+f.selectedCircle).transition().duration(O).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),u=aj.select("."+f.eventRects),te(qg)&&!pc(qg)?(u.classed(f.eventRectsMultiple)||u.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),v=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Se(v.enter()),v.attr("x",0).attr("y",0).attr("width",Mf).attr("height",Of)):(u.classed(f.eventRectsSingle)||u.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),xi&&!wi?(y=function(a,b){var c=yc(b),d=zc(b),e=uf.data.xs[a.id][b];return(fg(d?d:e+50)-fg(c?c:e-50))/2},x=function(a,b){var c=yc(b),d=uf.data.xs[a.id][b];return(fg(d)+fg(c?c:d-50))/2}):(y=L(),x=function(a){return fg(a.x)-y/2}),w=Bc(),aj.select("."+f.eventRects).datum(w?w.values:[]),v=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Re(v.enter()),v.attr("class",fd).attr("x",Yg?0:x).attr("y",Yg?x:0).attr("width",Yg?Mf:y).attr("height",Yg?y:Of),v.exit().remove()),r=aj.select("."+f.regions).selectAll("rect."+f.region).data(hi),r.enter().append("rect").style("fill-opacity",0),r.attr("class",ed).attr("x",fc).attr("y",gc).attr("width",hc).attr("height",ic).transition().duration(O).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Cc(uf.data.targets).forEach(function(a){hj[a]=!0})}}function Ye(){Xe({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ze(){return"mousemove"===tf.event.sourceEvent.type&&Zi.altDomain?(fg.domain(Zi.altDomain),void Zi.scale(fg).updateScaleExtent()):(wi&&fg.orgDomain()[0]===fj[0]&&fg.domain([fj[0]-1e-10,fg.orgDomain()[1]]),Xe({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===tf.event.sourceEvent.type&&(Ai=!0)))}function $e(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function _e(){$i.attr("width",Qf).attr("height",Rf),$i.select("#"+pi).select("rect").attr("width",Mf).attr("height",Of),$i.select("#"+qi).select("rect").attr("width",H),$i.select("#"+ri).select("rect").attr("width",J),$i.select("."+f.zoomRect).attr("width",Mf).attr("height",Of),ej.style("max-height",Rf+"px")}function af(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),_e(),m(a.withTransition),Xe(a)}function bf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=aj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Di(a)}),e=aj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("fill",function(a){return Di(a)}).style("stroke","none").style("cursor",function(a){return Gg(a)?"pointer":null}),c=aj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)}),b.append("path").attr("class",dd).style("opacity",function(){return gj=+tf.select(this).style("opacity"),0}).style("fill",function(a){return Di(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Di(a)}).style("cursor",function(a){return Gg(a)?"pointer":null}),a.forEach(function(a){aj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=aj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Yf(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Di(a.data)}).style("cursor",function(a){return Gg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Fb(a),d=Lb(c),e=Tb();Nb(c.data.id),jf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Fb(a),c=[Lb(b)];Md(c,tf.mouse(this))}).on("mouseout",function(a,b){var c=Fb(a),d=Lb(c),e=Ub();Ob(c.data.id),lf(),Nd(),e(d,b)}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Pg&&(n=bj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Di(a)}),l=bj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)})),$i.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function cf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Xd(a.id,b.types[a.id]):Xd(a.id,b.type)}),uf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Ni?j:i,l=Ni?Q():P();return d&&(w=0,C=0,t=0,u=0),Sg&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Ni?u:t,void(Xg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,Ni?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=cj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Ug?Ug(a):uf.toggle(a)}).on("mouseover",function(a){uf.focus(a),"function"==typeof Vg&&Vg(a)}).on("mouseout",function(a){uf.revert(),"function"==typeof Wg&&Wg(a)}),l.append("text").text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",Ni?g:-200).attr("y",Ni?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ni?h:-200).attr("y",Ni?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Di(a)}).attr("x",Ni?g:-200).attr("y",Ni?-200:i).attr("width",10).attr("height",10),cj.selectAll("text").data(a).text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),cj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),cj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),_e(),q&&m(p)}function pf(a){return Ec(uf.data.targets,a.id)}function qf(a){return"data"in a&&Ec(uf.data.targets,a.data.id)}function rf(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 sf(a,b,c){var d=!be(uf.data.targets);Xd(a,b),af(c?c:{withTransitionForAxis:d})}var tf=a.d3?a.d3:a.require?a.require("d3"):void 0,uf={data:{},axis:{},legend:{}},vf={},wf=h(["bindto"],"#chart"),xf=h(["size","width"]),yf=h(["size","height"]),zf=h(["padding","left"]),Af=h(["padding","right"]),Bf=h(["zoom","enabled"],!1),Cf=h(["zoom","extent"]),Df=h(["zoom","privileged"],!1),Ef=h(["onenter"],function(){}),Ff=h(["onleave"],function(){}),Gf=h(["onresize"],function(){}),Hf=h(["onresized"],function(){}),If=h(["transition","duration"],350);g("data","data is required in config");var Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg=h(["data","x"]),qg=h(["data","xs"],{}),rg=h(["data","x_format"]),sg=h(["data","id_converter"],function(a){return a}),tg=h(["data","names"],{}),ug=h(["data","classes"],{}),vg=h(["data","groups"],[]),wg=h(["data","axes"],{}),xg=h(["data","type"]),yg=h(["data","types"],{}),zg=h(["data","labels"],{}),Ag=h(["data","order"]),Bg=h(["data","regions"],{}),Cg=h(["data","color"]),Dg=h(["data","colors"],{}),Eg=h(["data","selection","enabled"],!1),Fg=h(["data","selection","grouped"],!1),Gg=h(["data","selection","isselectable"],function(){return!0}),Hg=h(["data","selection","multiple"],!0),Ig=h(["data","onclick"],function(){}),Jg=h(["data","onenter"],function(){}),Kg=h(["data","onleave"],function(){}),Lg=h(["data","onselected"],function(){}),Mg=h(["data","onunselected"],function(){}),Ng=h(["data","ondragstart"],function(){}),Og=h(["data","ondragend"],function(){}),Pg=h(["subchart","show"],!1),Qg=h(["subchart","size","height"],60),Rg=h(["color","pattern"],[]),Sg=h(["legend","show"],!0),Tg=h(["legend","position"],"bottom"),Ug=h(["legend","item","onclick"]),Vg=h(["legend","item","onmouseover"]),Wg=h(["legend","item","onmouseout"]),Xg=h(["legend","equally"],!1),Yg=h(["axis","rotated"],!1),Zg=h(["axis","x","show"],!0),$g=h(["axis","x","type"],"indexed"),_g=h(["axis","x","localtime"],!0),ah=h(["axis","x","categories"],[]),bh=h(["axis","x","tick","centered"],!1),ch=h(["axis","x","tick","format"]),dh=h(["axis","x","tick","culling"],{}),eh=h(["axis","x","tick","culling","max"],10),fh=h(["axis","x","tick","count"]),gh=h(["axis","x","tick","fit"],!0),hh=h(["axis","x","tick","values"],null),ih=h(["axis","x","tick","rotate"]),jh=h(["axis","x","max"]),kh=h(["axis","x","min"]),lh=h(["axis","x","padding"],{}),mh=h(["axis","x","height"]),nh=h(["axis","x","default"]),oh=h(["axis","x","label"],{}),ph=h(["axis","y","show"],!0),qh=h(["axis","y","max"]),rh=h(["axis","y","min"]),sh=h(["axis","y","center"]),th=h(["axis","y","label"],{}),uh=h(["axis","y","inner"],!1),vh=h(["axis","y","tick","format"]),wh=h(["axis","y","padding"],{}),xh=h(["axis","y","ticks"],10),yh=h(["axis","y2","show"],!1),zh=h(["axis","y2","max"]),Ah=h(["axis","y2","min"]),Bh=h(["axis","y2","center"]),Ch=h(["axis","y2","label"],{}),Dh=h(["axis","y2","inner"],!1),Eh=h(["axis","y2","tick","format"]),Fh=h(["axis","y2","padding"],{}),Gh=h(["axis","y2","ticks"],10),Hh=h(["grid","x","show"],!1),Ih=h(["grid","x","type"],"tick"),Jh=h(["grid","x","lines"],[]),Kh=h(["grid","y","show"],!1),Lh=h(["grid","y","lines"],[]),Mh=h(["grid","y","ticks"],10),Nh=h(["point","show"],!0),Oh=Nh?h(["point","r"],2.5):0,Ph=h(["point","focus","line","enabled"],!0),Qh=h(["point","focus","expand","enabled"],!0),Rh=h(["point","focus","expand","r"],Qh?4:Oh),Sh=h(["point","focus","select","r"],8),Th=h(["line","connect_null"],!1),Uh=h(["bar","width"]),Vh=h(["bar","width","ratio"],.6),Wh=h(["pie","label","show"],!0),Xh=h(["pie","label","format"]),Yh=h(["pie","expand"],!0),Zh=h(["pie","onclick"],function(){}),$h=h(["pie","onmouseover"],function(){}),_h=h(["pie","onmouseout"],function(){}),ai=h(["donut","label","show"],!0),bi=h(["donut","label","format"]),ci=h(["donut","expand"],!0),di=h(["donut","title"],""),ei=h(["donut","onclick"],function(){}),fi=h(["donut","onmouseover"],function(){}),gi=h(["donut","onmouseout"],function(){}),hi=h(["regions"],[]),ii=h(["tooltip","show"],!0),ji=h(["tooltip","format","title"]),ki=h(["tooltip","format","value"]),li=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ji?ji:b,l=ki?ki: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+""}),mi=h(["tooltip","init","show"],!1),ni=h(["tooltip","init","x"],0),oi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),pi=("string"==typeof wf?wf.replace("#",""):wf.id)+"-clip",qi=pi+"-xaxis",ri=pi+"-yaxis",si=i(pi),ti=i(qi),ui=i(ri),vi="timeseries"===$g,wi="categorized"===$g,xi=!vi&&(pg||te(qg)),yi=null,zi=!1,Ai=!1,Bi=!1,Ci=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Di=ne(Dg,te(Rg)?Rg:Ci,Cg),Ei=_g?tf.time.format:tf.time.format.utc,Fi=function(){var a=[[Ei("%Y/%-m/%-d"),function(){return!0}],[Ei("%-m/%-d"),function(a){return a.getMonth()}],[Ei("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ei("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ei("%I %p"),function(a){return a.getHours()}],[Ei("%I:%M"),function(a){return a.getMinutes()}],[Ei(":%S"),function(a){return a.getSeconds()}],[Ei(".%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)}}(),Gi=[],Hi=[],Ii=Yg?"left":"bottom",Ji=Yg?uh?"top":"bottom":uh?"right":"left",Ki=Yg?Dh?"bottom":"top":Dh?"left":"right",Li=Yg?"left":"bottom",Mi={main:function(){return"translate("+Jf.left+","+Jf.top+")"},context:function(){return"translate("+Kf.left+","+Kf.top+")"},legend:function(){return"translate("+Lf.left+","+Lf.top+")"},x:function(){return"translate(0,"+(Yg?0:Of)+")"},y:function(){return"translate(0,"+(Yg?Of:0)+")"},y2:function(){return"translate("+(Yg?0:Mf)+","+(Yg?1:0)+")"},subx:function(){return"translate(0,"+(Yg?0:Pf)+")"},arc:function(){return"translate("+Mf/2+","+Of/2+")"}},Ni="right"===Tg,Oi=0,Pi=0,Qi=0,Ri=.15,Si=30,Ti=Yg&&!Zg?0:30,Ui=5;Yf=tf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Vi,Wi=function(){var a=tf.svg.line().x(Yg?function(a){return V(a.id)(a.value)}:zd).y(Yg?zd:function(a){return V(a.id)(a.value)});return Th||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Th?De(b.values):b.values;return ce(b)?(a.interpolate(de(b)?"cardinal":"linear"),Bg[b.id]?Pe(e,fg,V(b.id),Bg[b.id]):a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Xi=function(){var a;return a=Yg?tf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(zd):tf.svg.area().x(zd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=De(b.values);return Yd([b],"area")||Yd([b],"area-spline")?(a.interpolate(de(b)?"cardinal":"linear"),a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Yi=function(){var a=tf.svg.line().x(Yg?function(a){return W(a.id)(a.value)}:Cd).y(Yg?Cd:function(a){return W(a.id)(a.value)});return function(b){var c=De(b.values);return ce(b)?a(c):"M "+ig(c[0].x)+" "+W(b.id)(c[0].value)}}(),Zi=function(){};Vi=tf.svg.brush().on("brush",Ye),Vi.update=function(){return bj&&bj.select("."+f.brush).call(this),this},Vi.scale=function(a){return Yg?this.y(a):this.x(a)},Bf&&(Zi=tf.behavior.zoom().on("zoomstart",function(){Zi.altDomain=tf.event.sourceEvent.altKey?fg.orgDomain():null}).on("zoom",Bf?Ze:null),Zi.scale=function(a){return Yg?this.y(a):this.x(a)},Zi.orgScaleExtent=function(){var a=Cf?Cf:[1,10];return[a[0],Math.max(Ac()/a[1],a[1])]},Zi.updateScaleExtent=function(){var a=bc(fg.orgDomain())/bc(fj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var $i,_i,aj,bj,cj,dj,ej,fj,gj,hj={};if(uf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),uf.defocus(),b(d.classed(f.focused,!0)),b(e),be(uf.data.targets)&&Nb(a,!0),jf(a)},uf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),kf(a)},uf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),lf()},uf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),$i.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?mf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},uf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),$i.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?nf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Ri),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},uf.toggle=function(a){Gc(a)?uf.hide(a):uf.show(a)},uf.unzoom=function(){Vi.clear().update(),Xe({withUpdateXDomain:!0})},uf.load=function(a){return a.xs&&oc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){ug[b]=a.classes[b]}),"categories"in a&&wi&&(ah=a.categories,lg.categories(ah)),"cacheIds"in a&&cc(a.cacheIds)?void cf(ec(a.cacheIds),a.done):void("unload"in a?ef(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){df(a)}):df(a))},uf.unload=function(a){ef(Dc(a),function(){Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},uf.selected=function(a){return tf.merge(aj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return tf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},uf.select=function(a,b,c){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=tf.select(this),i="circle"===this.nodeName?xe:Ae,j="circle"===this.nodeName?ye:Be,k=Fg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Gg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},uf.unselect=function(a,b){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=tf.select(this),g="circle"===this.nodeName?ye:Be,h=Fg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Gg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},uf.toLine=function(a){sf(a,"line")},uf.toSpline=function(a){sf(a,"spline")},uf.toBar=function(a){sf(a,"bar")},uf.toScatter=function(a){sf(a,"scatter")},uf.toArea=function(a){sf(a,"area")},uf.toAreaSpline=function(a){sf(a,"area-spline")},uf.toPie=function(a){sf(a,"pie",{withTransform:!0})},uf.toDonut=function(a){sf(a,"donut",{withTransform:!0})},uf.groups=function(a){return c(a)?vg:(vg=a,Xe(),vg)},uf.xgrids=function(a){return a?(Jh=a,Xe(),Jh):Jh},uf.xgrids.add=function(a){return a?uf.xgrids(Jh.concat(a)):void 0},uf.xgrids.remove=function(a){var b=rf(a);return uf.xgrids(Jh.filter(b))},uf.ygrids=function(a){return a?(Lh=a,Xe(),Lh):Lh},uf.ygrids.add=function(a){return a?uf.ygrids(Lh.concat(a)):void 0},uf.ygrids.remove=function(a){var b=rf(a); return uf.ygrids(Lh.filter(b))},uf.regions=function(a){return c(a)?hi:(hi=a,Xe(),hi)},uf.regions.add=function(a){return c(a)?hi:(hi=hi.concat(a),Xe(),hi)},uf.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;$i.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),hi=hi.filter(function(b){return b.classes.indexOf(a)<0})}),hi},uf.data.get=function(a){var b=uf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},uf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},uf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){tg[b]=a[b]}),of(Cc(uf.data.targets),{withTransition:!0}),tg):tg},uf.x=function(a){return arguments.length&&(rc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.xs=function(a){return arguments.length&&(sc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},uf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(qh=+a.y),b(a.y2)&&(zh=+a.y2)):qh=zh=+a,Xe())},uf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(rh=+a.y),b(a.y2)&&(Ah=+a.y2)):rh=Ah=+a,Xe())},uf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&uf.axis.max(a.max),"undefined"!=typeof a.min&&uf.axis.min(a.min))},uf.legend.show=function(a){Sg||(Sg=!0,cj.style("visibility","visible")),mf(Dc(a)),Xe({withTransitionForHorizontalAxis:!1})},uf.legend.hide=function(a){Sg&&se(a)&&(Sg=!1,cj.style("visibility","hidden")),nf(Dc(a)),Xe({withTransitionForHorizontalAxis:!1})},uf.resize=function(a){xf=a?a.width:null,yf=a?a.height:null,af({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},uf.destroy=function(){uf.data.targets=void 0,uf.data.xs={},ej.html(""),a.onresize=null},"url"in e.data)tf.xhr(e.data.url,function(a,b){var c,d=tf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=tf.csv.parse(b.response),Qe(c)});else if("rows"in e.data)Qe(uc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Qe(vc(e.data.columns))}return uf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From d41d8634511d5a709357f183d48333f1229a0432 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Thu, 24 Apr 2014 22:44:18 +0900 Subject: [PATCH 063/178] Fix axis.x.min/max when Date object - #171 --- c3.js | 4 ++-- c3.min.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/c3.js b/c3.js index 421803a..8715922 100644 --- a/c3.js +++ b/c3.js @@ -178,8 +178,8 @@ __axis_x_tick_fit = getConfig(['axis', 'x', 'tick', 'fit'], true), __axis_x_tick_values = getConfig(['axis', 'x', 'tick', 'values'], null), __axis_x_tick_rotate = getConfig(['axis', 'x', 'tick', 'rotate']), - __axis_x_max = getConfig(['axis', 'x', 'max']), - __axis_x_min = getConfig(['axis', 'x', 'min']), + __axis_x_max = getConfig(['axis', 'x', 'max'], null), + __axis_x_min = getConfig(['axis', 'x', 'min'], null), __axis_x_padding = getConfig(['axis', 'x', 'padding'], {}), __axis_x_height = getConfig(['axis', 'x', 'height']), __axis_x_default = getConfig(['axis', 'x', 'default']), diff --git a/c3.min.js b/c3.min.js index 5616beb..b42a254 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ !function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.32"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cMf&&(Mf=0),0>Of&&(Of=0),Nf=Yg?Jf.left-Si-Ti:Mf,Pf=Yg?Of:Rf-Kf.top-Kf.bottom,0>Nf&&(Nf=0),0>Pf&&(Pf=0),p(),Ni&&be(uf.data.targets)&&(Lf.left=Mf/2+Tf)}function o(){aj.select("line."+f.xgridFocus).attr("x1",Yg?0:-10).attr("x2",Yg?Mf:-10).attr("y1",Yg?-10:Jf.top).attr("y2",Yg?-10:Of)}function p(){Tf=Of/2,Sf=.95*Tf,Uf=ae(uf.data.targets)?.6*Sf:0}function q(){var a=Yg?f.axisX:f.axisY,b=tf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=tf.select(wf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return xf?xf:x()}function s(){var a=yf?yf:y();return a>0?a:320}function t(){return be(uf.data.targets)?0:zf?zf:Yg||!ph||uh?1:v("y")}function u(){var a=1;return be(uf.data.targets)?0:Af?Af:Ni?P()+(yh&&!Yg?v("y2"):a):yh?Dh||Yg?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||Zg?"x"===a&&mh?mh:"y"!==a||ph?"y2"!==a||yh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Ui:Sg&&!Ni?10:1:0}function x(){return+tf.select(wf).style("width").replace("px","")}function y(){return+tf.select(wf).style("height").replace("px","")}function z(a){return a?-5:-(Jf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Yg)}function C(){return A(!Yg)}function D(){return z(Yg)}function E(){return A(Yg)}function F(a){return a?Mf+2+4:Jf.left+20}function G(a){return a?(mh?mh:0)+40:Of+2}function H(){return F(!Yg)}function I(){return G(!Yg)}function J(){return F(Yg)}function K(){return G(Yg)}function L(){var a=Yg?Of:Mf,b=Ac(),c=Yb()*(Zd(uf.data.targets)?(b-(wi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){Oi=a}function N(a){Pi=a}function O(a){Qi=a}function P(){return Sg?Ni?Pi*(Oi+1):Qf:0}function Q(){return Sg?Ni?Rf:Qi*(Oi+1):0}function R(){var a,b=!fg;Zf=Yg?1:0,$f=Yg?Of:Mf,_f=Yg?0:Of,ag=Yg?Mf:1,bg=Zf,cg=$f,dg=Yg?0:Pf,eg=Yg?Nf:1,fg=T(Zf,$f,b?void 0:fg.domain(),function(){return lg.tickOffset()}),gg=U(_f,ag),hg=U(_f,ag),ig=T(Zf,$f,fj,function(a){return a%1?0:og.tickOffset()}),jg=U(dg,eg),kg=U(dg,eg),a=$(),lg=X(fg,Ii,a),og=X(ig,Li,a),mg=Y(gg,Ji,vh,xh),ng=Y(hg,Ki,Eh,Gh),b||(Vi.scale(ig),Bf&&Zi.scale(fg)),S()}function S(){Vf=Gb(),Wf=Hb(),Xf=Hb(.98)}function T(a,b,e,f){var g=(vi?tf.time.scale():tf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),wi){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return tf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?hg:gg}function W(a){return"y2"===Z(a)?kg:jg}function X(a,b,c){var d=(wi?Eb():tf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),wi?(d.tickCentered(bh),se(dh)&&(dh=!1)):d.tickOffset=function(){var a=Yg?Of:Mf;return a*Yb()/Ac()/2},wi&&d.categories(ah),d}function Y(a,b,c,d){return tf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in wg?wg[a]:"y"}function $(){var a=vi?Fi:wi?Tc:function(a){return 0>a?a.toFixed(0):a};return ch&&("function"==typeof ch?a=ch:vi&&(a=function(a){return a?Ei(ch)(a):""})),a}function _(a){var b;return"y"===a?b=th:"y2"===a?b=Ch:"x"===a&&(b=oh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?th=b:"y2"===a?Ch=b:"x"===a&&(oh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a){a.selectAll(".tick text").attr("y",db(ih)).attr("x",cb(ih)).attr("transform","rotate("+ih+")").style("text-anchor","start")}function fb(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 gb(){return fb("x",Yg?"inner-top":"inner-right")}function hb(){return fb("y",Yg?"inner-right":"inner-top")}function ib(){return fb("y2",Yg?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Mf/2:Mf:b.isBottom?-Of:b.isMiddle?-Of/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!Yg,gb())}function rb(){return nb(Yg,hb())}function sb(){return nb(Yg,ib())}function tb(){return ob(!Yg,gb())}function ub(){return ob(Yg,hb())}function vb(){return ob(Yg,ib())}function wb(){var a=gb();return Yg?a.isInner?"1.2em":-30-Cb("x"):a.isInner?"-0.5em":"3em"}function xb(){var a=hb();return Yg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return Yg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!Yg,gb())}function Ab(){return pb(Yg,hb())}function Bb(){return pb(Yg,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return tf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Db(){aj.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).text(kb),aj.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dy",xb).text(lb),aj.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dy",yb).text(mb)}function Eb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+o)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Rc(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 tf.min(Object.keys(i).map(function(a){return tf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(vg.length>0)for(g=Sc(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 tf.max(Object.keys(i).map(function(a){return tf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Ah:rh,n="y2"===c?zh:qh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Bh:sh,r=ud()&&Yg;return 0===l.length?"y2"===c?hg.domain():gg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=bc(gg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&wh&&(f=b(wh.top)?wh.top:e,g=b(wh.bottom)?wh.bottom:e),"y2"===c&&Fh&&(f=b(Fh.top)?Fh.top:e,g=b(Fh.bottom)?Fh.bottom:e),Zd(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){var b=bc(fj),c=bc(fg.domain());return a||0===c?1:b/c}function Zb(a){return kh?vi?oe(kh):kh:tf.min(a,function(a){return tf.min(a.values,function(a){return a.x})})}function $b(a){return jh?vi?oe(jh):jh:tf.max(a,function(a){return tf.max(a.values,function(a){return a.x})})}function _b(a,c){var d,e,f,g,h=c[0],i=c[1],j=Math.abs(h-i);return wi?e=0:Zd(a)?(d=Ac(),e=d>1?j/(d-1)/2:.5):e=.01*j,"object"==typeof lh&&te(lh)?(f=b(lh.left)?lh.left:e,g=b(lh.right)?lh.right:e):f=g="number"==typeof lh?lh:e,{left:f,right:g}}function ac(a){var b=[Zb(a),$b(a)],c=b[0],d=b[1],e=_b(a,b),f=0,g=0;return(c||0===c)&&(f=vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function bc(a){return a[1]-a[0]}function cc(a){for(var b=0;bb?0:b-c}function ic(a){var b,c=gc(a),d="y"===a.axis?gg:hg;return b="y"===a.axis||"y2"===a.axis?Yg?Of:"start"in a?d(a.start):Of:Yg?"end"in a?fg(vi?oe(a.end):a.end):Of:Of,c>b?0:b-c}function jc(a){return pg&&a===pg||te(qg)&&ue(qg,a)}function kc(a){return!jc(a)}function lc(a){return pg?pg:te(qg)?qg[a]:null}function mc(a,b){var c,d=b&&te(b)?Cc(b):[];return d.forEach(function(b){lc(b)===a&&(c=uf.data.xs[b])}),c}function nc(a,b){return a in uf.data.xs&&uf.data.xs[a]&&uf.data.xs[a][b]?uf.data.xs[a][b]:b}function oc(a){Object.keys(a).forEach(function(b){qg[b]=a[b]})}function pc(a){return 1===tf.set(Object.keys(a).map(function(b){return a[b]})).size()}function qc(a){var b;return a&&(b=tg[a.id],a.name=b?b:a.id),a}function rc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=tc(b[d],a.id,d)}),uf.data.xs[a.id]=b})}function sc(a,b){a.forEach(function(a){b[a.id]&&rc([a],b[a.id])})}function tc(a,b,c){var d;return d=vi?a?a instanceof Date?a:oe(a):oe(nc(b,c)):xi&&!wi?a?+a:nc(b,c):c}function uc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?uf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):pg?(d=Object.keys(uf.data.xs),uf.data.xs[c]=d.length>0?uf.data.xs[d[0]]:void 0):te(qg)&&(uf.data.xs[c]=mc(f,uf.data.targets)):uf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!uf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=sg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=lc(b),g=a[f],h=tc(g,b,e);return xi&&wi&&0===c&&g&&(0===e&&(ah=[]),ah.push(g)),("undefined"==typeof a[b]||uf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),xg&&Xd(Cc(c).filter(function(a){return!(a in yg)}),xg),c.forEach(function(a){dc(a.id_org,a)}),c}function xc(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 yc(a){return a>0&&uf.data.targets[0].values[a-1]?uf.data.targets[0].values[a-1].x:void 0}function zc(a){return a1?uf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?uf.data.targets[0]:null,a}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(uf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(vi?new Date(h):h);i.push(d)}return vi||(i=i.sort(function(a,b){return a-b})),i}function Lc(a){Gi=Gi.concat(a)}function Mc(a){Gi=Gi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Hi=Hi.concat(a)}function Oc(a){Hi=Hi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Dd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Dd(a,g))),Gd(e,b)):Ed(a,b,f,g)}function Fd(a,b){var c;return c=a.map(function(a){return Ed(a.values,b)}),Gd(c,b)}function Gd(a,b){var c,d;return a.forEach(function(a){var e=ve(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Hd(a,b){return tf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Id(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 Jd(){return Ag&&"desc"===Ag.toLowerCase()}function Kd(){return Ag&&"asc"===Ag.toLowerCase()}function Ld(a){var b=Kd(),c=Jd();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 Ag&&a.sort(Ag),a}function Md(a,c){var d,e,f,g,h,i,j,k=be(uf.data.targets),l=k?xd:wd,m=a.filter(function(a){return a&&b(a.value)});ii&&0!==m.length&&(dj.html(li(a,$(),l,Di)).style("display","block"),d=dj.property("offsetWidth"),e=dj.property("offsetHeight"),k?(g=Mf/2+c[0],i=Of/2+c[1]+20):(Yg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=fg(m[0].x)+20):(f=q(),g=f+t()+fg(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),dj.style("top",i+"px").style("left",g+"px"))}function Nd(){dj.style("display","none")}function Od(a){var c=a.filter(function(a){return a&&b(a.value)});ii&&($d(uf.data.targets)||be(uf.data.targets)||aj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Yg?"y1":"x1",zd).attr(Yg?"y2":"x2",zd))}function Pd(){aj.select("line."+f.xgridFocus).style("visibility","hidden")}function Qd(a){return a.x||0===a.x?fg(a.x):null}function Rd(a){return V(a.id)(a.value)}function Sd(){var a,b,d={},e=0;return Ic(Fc(ee)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Wd(a,b){return Uh?Uh:b?2*a.tickOffset()*Vh/b:0}function Xd(a,b){Dc(a).forEach(function(a){hj[a]=b===yg[a],yg[a]=b})}function Yd(a,b){var c=!1;return a.forEach(function(a){yg[a.id]===b&&(c=!0),a.id in yg||"line"!==b||(c=!0)}),c}function Zd(a){return Yd(a,"bar")}function $d(a){return Yd(a,"scatter")}function _d(a){return Yd(a,"pie")}function ae(a){return Yd(a,"donut")}function be(a){return _d(a)||ae(a)}function ce(a){var b="string"==typeof a?a:a.id;return!(b in yg)||"line"===yg[b]||"spline"===yg[b]||"area"===yg[b]||"area-spline"===yg[b]}function de(a){var b="string"==typeof a?a:a.id;return"spline"===yg[b]||"area-spline"===yg[b]}function ee(a){var b="string"==typeof a?a:a.id;return"bar"===yg[b]}function fe(a){var b="string"==typeof a?a:a.id;return"scatter"===yg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"pie"===yg[b]}function he(a){var b="string"==typeof a?a:a.id;return"donut"===yg[b]}function ie(a){return ge(a)||he(a)}function je(a){return ee(a)?a.values:[]}function ke(a){return ce(a)||fe(a)?a.values:[]}function le(a){return ee(a)||ce(a)?a.values:[]}function me(a){return he(a)&&ci||ge(a)&&Yh}function ne(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function oe(b){var c;try{c=rg?tf.time.format(rg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+rg)}return c}function pe(a,b){var c=tf.mouse(a),d=tf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function ue(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ve(a,b){var c="y"===Z(a.id)?gg:hg,d=Yg?1:0,e=Yg?0:1;return Math.pow(fg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function we(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function xe(a,b,c){Lg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd).attr("stroke",function(){return Di(b)}).attr("r",1.4*Sh).transition().duration(100).attr("r",Sh)}function ye(a,b,c){Mg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ze(a,b,c,d){a?xe(b,c,d):ye(b,c,d)}function Ae(a,b){Lg(b,a.node()),a.transition().duration(100).style("fill",function(){return tf.rgb(Di(b)).darker(1)})}function Be(a,b){Mg(b,a.node()),a.transition().duration(100).style("fill",function(){return Di(b)})}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a){return a.filter(function(a){return b(a.value)})}function Ee(a,c){return(c?aj.selectAll("."+f.circles+ld(c)):aj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Fe(a,b){Ee(a,b).classed(f.EXPANDED,!0).attr("r",Rh)}function Ge(a){Ee(a).filter(function(){return tf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oh)}function He(a){return aj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ie(a){He(a).classed(f.EXPANDED,!0)}function Je(a){He(a).classed(f.EXPANDED,!1)}function Ke(a,b){var c=Oe(a,b);return function(a,b){var d=c(a,b),e=Yg?1:0,f=Yg?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 Le(a,b){var c=Oe(a,!1),d=b?Me:Ne;return function(a,b){return d(c(a,b),a,this)}}function Me(a,b){var c;return Yg?(c=ee(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ne(a,b,c){var d=c.getBoundingClientRect();return Yg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ee(b)?-3:-6)}function Oe(a,b){var c=a.__max__+1,d=Wd(lg,c),e=Td(d,c,a,!!b),f=Ud(!!b),g=Vd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Yg&&(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 Pe(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 Qe(b){var c,d,e;if(ej=tf.select(wf),ej.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ej.html(""),ej.classed("c3",!0),uf.data.xs={},uf.data.targets=wc(b),n(),R(),fg.domain(tf.extent(ac(uf.data.targets))),gg.domain(Xb(uf.data.targets,"y")),hg.domain(Xb(uf.data.targets,"y2")),ig.domain(fg.domain()),jg.domain(gg.domain()),kg.domain(hg.domain()),fj=fg.domain(),Vi.scale(ig),Bf&&Zi.scale(fg),$i=ej.append("svg").attr("width",Mf+Jf.left+Jf.right).attr("height",Of+Jf.top+Jf.bottom).on("mouseenter",Ef).on("mouseleave",Ff),_i=$i.append("defs"),_i.append("clipPath").attr("id",pi).append("rect").attr("width",Mf).attr("height",Of),_i.append("clipPath").attr("id",qi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),_i.append("clipPath").attr("id",ri).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),aj=$i.append("g").attr("transform",Mi.main),bj=Pg?$i.append("g").attr("transform",Mi.context):null,cj=$i.append("g").attr("transform",Mi.legend),Sg||(cj.style("visibility","hidden"),Hi=Cc(uf.data.targets)),dj=tf.select(wf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),of(Cc(uf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Zg&&aj.append("g").attr("class",f.axisX).attr("clip-path",ti).attr("transform",Mi.x).append("text").attr("class",f.axisXLabel).attr("transform",Yg?"rotate(-90)":"").attr("dx",tb).attr("dy",wb).style("text-anchor",zb),ph&&aj.append("g").attr("class",f.axisY).attr("clip-path",ui).attr("transform",Mi.y).append("text").attr("class",f.axisYLabel).attr("transform",Yg?"":"rotate(-90)").attr("dx",ub).attr("dy",xb).style("text-anchor",Ab),yh&&aj.append("g").attr("class",f.axisY2).attr("transform",Mi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Yg?"":"rotate(-90)").attr("dx",vb).style("text-anchor",Bb),d=aj.append("g").attr("clip-path",si).attr("class",f.grid),Hh&&d.append("g").attr("class",f.xgrids),te(Jh)&&d.append("g").attr("class",f.xgridLines),Ph&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Kh&&d.append("g").attr("class",f.ygrids),te(Lh)&&d.append("g").attr("class",f.ygridLines),aj.append("g").attr("clip-path",si).attr("class",f.regions),aj.append("g").attr("clip-path",si).attr("class",f.chart),c=aj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Bf?Yg?"ns-resize":"ew-resize":null),aj.select("."+f.chart).append("g").attr("class",f.chartBars),aj.select("."+f.chart).append("g").attr("class",f.chartLines),aj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Mi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),aj.select("."+f.chart).append("g").attr("class",f.chartTexts),Bf&&aj.insert("rect",Df?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Mf).attr("height",Of).style("opacity",0).style("cursor",Yg?"ns-resize":"ew-resize").call(Zi).on("dblclick.zoom",null),nh&&Vi.extent("function"!=typeof nh?nh:nh(ac())),Pg&&(bj.append("g").attr("clip-path",si).attr("class",f.chart),bj.select("."+f.chart).append("g").attr("class",f.chartBars),bj.select("."+f.chart).append("g").attr("class",f.chartLines),bj.append("g").attr("clip-path",si).attr("class",f.brush).call(Vi).selectAll("rect").attr(Yg?"width":"height",Yg?Nf:Pf),bj.append("g").attr("class",f.axisX).attr("transform",Mi.subx).attr("clip-path",Yg?"":ti)),bf(uf.data.targets),Yg?aj.select("."+f.axisX).style("opacity",0).call(lg):(aj.select("."+f.axisY).style("opacity",0).call(mg),aj.select("."+f.axisY2).style("opacity",0).call(ng)),Xe({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),mi){if(vi&&"string"==typeof ni){for(ni=oe(ni),e=0;e0){d=[];for(var g in tg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Id(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ce,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 Ve(a){be(uf.data.targets)||Eg&&(yi=a,aj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),zi=!0,Ng())}function We(){be(uf.data.targets)||Eg&&(aj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),aj.selectAll("."+f.shape).classed(f.INCLUDED,!1),zi=!1,Og())}function Xe(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U=Sd(),V=be(uf.data.targets),W=Ic(uf.data.targets);if(0!==W.length){if(a=d(a)?a:{},z=d(a.withY)?a.withY:!0,A=d(a.withSubchart)?a.withSubchart:!0,B=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,C=d(a.withTransitionForExit)?a.withTransitionForExit:B,D=d(a.withTransitionForAxis)?a.withTransitionForAxis:B,E=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:B,O=B?If:0,P=C?O:0,Q=D?O:0,I&&Sg&&of(Cc(uf.data.targets),a),H&&(fg.domain(tf.extent(ac(W))),fj=fg.domain(),Bf&&Zi.scale(fg).updateScaleExtent(),ig.domain(fg.domain()),Vi.scale(ig)),G&&(fg.domain(Vi.empty()?fj:Vi.extent()),Bf&&Zi.scale(fg).updateScaleExtent()),gg.domain(Xb(W,"y")),hg.domain(Xb(W,"y2")),(gh||fh)&&(R=hh?hh:Kc(Jc(W)),lg.tickValues(R),og.tickValues(R)),c=aj.select("."+f.axisX).style("opacity",V?0:1),(Yg||E)&&(c=c.transition().duration(Q)),c.call(lg),g=aj.select("."+f.axisY).style("opacity",V?0:1),(!Yg||E)&&(g=g.transition().duration(Q)),g.call(mg),aj.select("."+f.axisY2).style("opacity",V?0:1).transition().duration(Q).call(ng),G)if(dh&&R){for(S=1;S=0&&tf.select(this).style("display",b%T?"none":"block")})}else tf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!Yg&&ih&&eb(c),J=Ke(U),M=Le(U,!0),N=Le(U,!1),Db(),jg.domain(gg.domain()),kg.domain(hg.domain()),dj.style("display","none"),o(),aj.select("line."+f.xgridFocus).style("visibility","hidden"),Hh){if("year"===Ih){i=[];for(var X=ac(),Y=X[0].getFullYear(),Z=X[1].getFullYear(),$=Y;Z>=$;$++)i.push(new Date($+"-01-01 00:00:00"))}else i=fg.ticks(10);h=aj.select("."+f.xgrids).selectAll("."+f.xgrid).data(i),h.enter().append("line").attr("class",f.xgrid),h.attr("x1",Yg?0:function(a){return fg(a)-lg.tickOffset()}).attr("x2",Yg?Mf:function(a){return fg(a)-lg.tickOffset()}).attr("y1",Yg?function(a){return fg(a)-lg.tickOffset()}:Jf.top).attr("y2",Yg?function(a){return fg(a)-lg.tickOffset()}:Of).style("opacity",function(){return+tf.select(this).attr(Yg?"y1":"x1")===(Yg?Of:0)?0:1}),h.exit().remove()}te(Jh)&&(j=aj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Jh),k=j.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),k.append("line").style("opacity",0),k.append("text").attr("text-anchor","end").attr("transform",Yg?"":"rotate(-90)").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),j.select("line").transition().duration(O).attr("x1",Yg?0:Ad).attr("x2",Yg?Mf:Ad).attr("y1",Yg?Ad:Jf.top).attr("y2",Yg?Ad:Of).style("opacity",1),j.select("text").transition().duration(O).attr("x",Yg?Mf:0).attr("y",Ad).text(function(a){return a.text}).style("opacity",1),j.exit().transition().duration(O).style("opacity",0).remove()),z&&Kh&&(l=aj.select("."+f.ygrids).selectAll("."+f.ygrid).data(gg.ticks(Mh)),l.enter().append("line").attr("class",f.ygrid),l.attr("x1",Yg?gg:0).attr("x2",Yg?gg:Mf).attr("y1",Yg?0:gg).attr("y2",Yg?Of:gg),l.exit().remove()),z&&te(Lh)&&(m=aj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Lh),n=m.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),n.append("line").style("opacity",0),n.append("text").attr("text-anchor","end").attr("transform",Yg?"rotate(-90)":"").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),m.select("line").transition().duration(O).attr("x1",Yg?Bd:0).attr("x2",Yg?Bd:Mf).attr("y1",Yg?0:Bd).attr("y2",Yg?Of:Bd).style("opacity",1),m.select("text").transition().duration(O).attr("x",Yg?0:Mf).attr("y",Bd).text(function(a){return a.text}).style("opacity",1),m.exit().transition().duration(O).style("opacity",0).remove()),q=aj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),q.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Di(a)}).attr("class",ad),q.style("opacity",qd).transition().duration(O).attr("d",J).style("opacity",1),q.exit().transition().duration(P).style("opacity",0).remove(),s=aj.selectAll("."+f.texts).selectAll("."+f.text).data(le),s.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return Yg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),s.text(function(a){return yd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(O).attr("x",M).attr("y",N).style("fill-opacity",td),s.exit().transition().duration(P).style("fill-opacity",0).remove(),aj.selectAll("."+f.line).style("opacity",qd).transition().duration(O).attr("d",Wi).style("opacity",1),aj.selectAll("."+f.area).style("opacity",0).transition().duration(O).attr("d",Xi).style("opacity",gj),p=aj.selectAll("."+f.circles).selectAll("."+f.circle).data(ke),p.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Oh),p.style("opacity",qd).transition().duration(O).style("opacity",sd).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),p.exit().remove(),aj.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(O).attrTween("d",function(a){var b,c=Fb(a);return c?(b=tf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1),aj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(O).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&ie(a.data)?1:0}),aj.select("."+f.chartArcsTitle).style("opacity",ae(uf.data.targets)?1:0),Pg&&(null!==tf.event&&"zoom"===tf.event.type&&Vi.extent(fg.orgDomain()).update(),A&&(e=bj.select("."+f.axisX).style("opacity",V?0:1),(Yg||E)&&(e=e.transition().duration(Q)),e.call(og),!Yg&&ih&&eb(e),Vi.empty()||Vi.extent(fg.orgDomain()).update(),K=Ke(U,!0),t=bj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),t.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Di(a)}).attr("class",ad),t.style("opacity",qd).transition().duration(O).attr("d",K).style("opacity",1),t.exit().transition().duration(O).style("opacity",0).remove(),bj.selectAll("."+f.line).style("opacity",qd).transition().duration(O).attr("d",Yi).style("opacity",1))),aj.selectAll("."+f.selectedCircles).filter(function(a){return ee(a)}).selectAll("circle").remove(),aj.selectAll("."+f.selectedCircle).transition().duration(O).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),u=aj.select("."+f.eventRects),te(qg)&&!pc(qg)?(u.classed(f.eventRectsMultiple)||u.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),v=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Se(v.enter()),v.attr("x",0).attr("y",0).attr("width",Mf).attr("height",Of)):(u.classed(f.eventRectsSingle)||u.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),xi&&!wi?(y=function(a,b){var c=yc(b),d=zc(b),e=uf.data.xs[a.id][b];return(fg(d?d:e+50)-fg(c?c:e-50))/2},x=function(a,b){var c=yc(b),d=uf.data.xs[a.id][b];return(fg(d)+fg(c?c:d-50))/2}):(y=L(),x=function(a){return fg(a.x)-y/2}),w=Bc(),aj.select("."+f.eventRects).datum(w?w.values:[]),v=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Re(v.enter()),v.attr("class",fd).attr("x",Yg?0:x).attr("y",Yg?x:0).attr("width",Yg?Mf:y).attr("height",Yg?y:Of),v.exit().remove()),r=aj.select("."+f.regions).selectAll("rect."+f.region).data(hi),r.enter().append("rect").style("fill-opacity",0),r.attr("class",ed).attr("x",fc).attr("y",gc).attr("width",hc).attr("height",ic).transition().duration(O).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Cc(uf.data.targets).forEach(function(a){hj[a]=!0})}}function Ye(){Xe({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ze(){return"mousemove"===tf.event.sourceEvent.type&&Zi.altDomain?(fg.domain(Zi.altDomain),void Zi.scale(fg).updateScaleExtent()):(wi&&fg.orgDomain()[0]===fj[0]&&fg.domain([fj[0]-1e-10,fg.orgDomain()[1]]),Xe({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===tf.event.sourceEvent.type&&(Ai=!0)))}function $e(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function _e(){$i.attr("width",Qf).attr("height",Rf),$i.select("#"+pi).select("rect").attr("width",Mf).attr("height",Of),$i.select("#"+qi).select("rect").attr("width",H),$i.select("#"+ri).select("rect").attr("width",J),$i.select("."+f.zoomRect).attr("width",Mf).attr("height",Of),ej.style("max-height",Rf+"px")}function af(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),_e(),m(a.withTransition),Xe(a)}function bf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=aj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Di(a)}),e=aj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("fill",function(a){return Di(a)}).style("stroke","none").style("cursor",function(a){return Gg(a)?"pointer":null}),c=aj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)}),b.append("path").attr("class",dd).style("opacity",function(){return gj=+tf.select(this).style("opacity"),0}).style("fill",function(a){return Di(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Di(a)}).style("cursor",function(a){return Gg(a)?"pointer":null}),a.forEach(function(a){aj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=aj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Yf(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Di(a.data)}).style("cursor",function(a){return Gg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Fb(a),d=Lb(c),e=Tb();Nb(c.data.id),jf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Fb(a),c=[Lb(b)];Md(c,tf.mouse(this))}).on("mouseout",function(a,b){var c=Fb(a),d=Lb(c),e=Ub();Ob(c.data.id),lf(),Nd(),e(d,b)}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Pg&&(n=bj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Di(a)}),l=bj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)})),$i.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function cf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Xd(a.id,b.types[a.id]):Xd(a.id,b.type)}),uf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Ni?j:i,l=Ni?Q():P();return d&&(w=0,C=0,t=0,u=0),Sg&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Ni?u:t,void(Xg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,Ni?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=cj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Ug?Ug(a):uf.toggle(a)}).on("mouseover",function(a){uf.focus(a),"function"==typeof Vg&&Vg(a)}).on("mouseout",function(a){uf.revert(),"function"==typeof Wg&&Wg(a)}),l.append("text").text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",Ni?g:-200).attr("y",Ni?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ni?h:-200).attr("y",Ni?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Di(a)}).attr("x",Ni?g:-200).attr("y",Ni?-200:i).attr("width",10).attr("height",10),cj.selectAll("text").data(a).text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),cj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),cj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),_e(),q&&m(p)}function pf(a){return Ec(uf.data.targets,a.id)}function qf(a){return"data"in a&&Ec(uf.data.targets,a.data.id)}function rf(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 sf(a,b,c){var d=!be(uf.data.targets);Xd(a,b),af(c?c:{withTransitionForAxis:d})}var tf=a.d3?a.d3:a.require?a.require("d3"):void 0,uf={data:{},axis:{},legend:{}},vf={},wf=h(["bindto"],"#chart"),xf=h(["size","width"]),yf=h(["size","height"]),zf=h(["padding","left"]),Af=h(["padding","right"]),Bf=h(["zoom","enabled"],!1),Cf=h(["zoom","extent"]),Df=h(["zoom","privileged"],!1),Ef=h(["onenter"],function(){}),Ff=h(["onleave"],function(){}),Gf=h(["onresize"],function(){}),Hf=h(["onresized"],function(){}),If=h(["transition","duration"],350);g("data","data is required in config");var Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg=h(["data","x"]),qg=h(["data","xs"],{}),rg=h(["data","x_format"]),sg=h(["data","id_converter"],function(a){return a}),tg=h(["data","names"],{}),ug=h(["data","classes"],{}),vg=h(["data","groups"],[]),wg=h(["data","axes"],{}),xg=h(["data","type"]),yg=h(["data","types"],{}),zg=h(["data","labels"],{}),Ag=h(["data","order"]),Bg=h(["data","regions"],{}),Cg=h(["data","color"]),Dg=h(["data","colors"],{}),Eg=h(["data","selection","enabled"],!1),Fg=h(["data","selection","grouped"],!1),Gg=h(["data","selection","isselectable"],function(){return!0}),Hg=h(["data","selection","multiple"],!0),Ig=h(["data","onclick"],function(){}),Jg=h(["data","onenter"],function(){}),Kg=h(["data","onleave"],function(){}),Lg=h(["data","onselected"],function(){}),Mg=h(["data","onunselected"],function(){}),Ng=h(["data","ondragstart"],function(){}),Og=h(["data","ondragend"],function(){}),Pg=h(["subchart","show"],!1),Qg=h(["subchart","size","height"],60),Rg=h(["color","pattern"],[]),Sg=h(["legend","show"],!0),Tg=h(["legend","position"],"bottom"),Ug=h(["legend","item","onclick"]),Vg=h(["legend","item","onmouseover"]),Wg=h(["legend","item","onmouseout"]),Xg=h(["legend","equally"],!1),Yg=h(["axis","rotated"],!1),Zg=h(["axis","x","show"],!0),$g=h(["axis","x","type"],"indexed"),_g=h(["axis","x","localtime"],!0),ah=h(["axis","x","categories"],[]),bh=h(["axis","x","tick","centered"],!1),ch=h(["axis","x","tick","format"]),dh=h(["axis","x","tick","culling"],{}),eh=h(["axis","x","tick","culling","max"],10),fh=h(["axis","x","tick","count"]),gh=h(["axis","x","tick","fit"],!0),hh=h(["axis","x","tick","values"],null),ih=h(["axis","x","tick","rotate"]),jh=h(["axis","x","max"]),kh=h(["axis","x","min"]),lh=h(["axis","x","padding"],{}),mh=h(["axis","x","height"]),nh=h(["axis","x","default"]),oh=h(["axis","x","label"],{}),ph=h(["axis","y","show"],!0),qh=h(["axis","y","max"]),rh=h(["axis","y","min"]),sh=h(["axis","y","center"]),th=h(["axis","y","label"],{}),uh=h(["axis","y","inner"],!1),vh=h(["axis","y","tick","format"]),wh=h(["axis","y","padding"],{}),xh=h(["axis","y","ticks"],10),yh=h(["axis","y2","show"],!1),zh=h(["axis","y2","max"]),Ah=h(["axis","y2","min"]),Bh=h(["axis","y2","center"]),Ch=h(["axis","y2","label"],{}),Dh=h(["axis","y2","inner"],!1),Eh=h(["axis","y2","tick","format"]),Fh=h(["axis","y2","padding"],{}),Gh=h(["axis","y2","ticks"],10),Hh=h(["grid","x","show"],!1),Ih=h(["grid","x","type"],"tick"),Jh=h(["grid","x","lines"],[]),Kh=h(["grid","y","show"],!1),Lh=h(["grid","y","lines"],[]),Mh=h(["grid","y","ticks"],10),Nh=h(["point","show"],!0),Oh=Nh?h(["point","r"],2.5):0,Ph=h(["point","focus","line","enabled"],!0),Qh=h(["point","focus","expand","enabled"],!0),Rh=h(["point","focus","expand","r"],Qh?4:Oh),Sh=h(["point","focus","select","r"],8),Th=h(["line","connect_null"],!1),Uh=h(["bar","width"]),Vh=h(["bar","width","ratio"],.6),Wh=h(["pie","label","show"],!0),Xh=h(["pie","label","format"]),Yh=h(["pie","expand"],!0),Zh=h(["pie","onclick"],function(){}),$h=h(["pie","onmouseover"],function(){}),_h=h(["pie","onmouseout"],function(){}),ai=h(["donut","label","show"],!0),bi=h(["donut","label","format"]),ci=h(["donut","expand"],!0),di=h(["donut","title"],""),ei=h(["donut","onclick"],function(){}),fi=h(["donut","onmouseover"],function(){}),gi=h(["donut","onmouseout"],function(){}),hi=h(["regions"],[]),ii=h(["tooltip","show"],!0),ji=h(["tooltip","format","title"]),ki=h(["tooltip","format","value"]),li=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ji?ji:b,l=ki?ki: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+""}),mi=h(["tooltip","init","show"],!1),ni=h(["tooltip","init","x"],0),oi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),pi=("string"==typeof wf?wf.replace("#",""):wf.id)+"-clip",qi=pi+"-xaxis",ri=pi+"-yaxis",si=i(pi),ti=i(qi),ui=i(ri),vi="timeseries"===$g,wi="categorized"===$g,xi=!vi&&(pg||te(qg)),yi=null,zi=!1,Ai=!1,Bi=!1,Ci=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Di=ne(Dg,te(Rg)?Rg:Ci,Cg),Ei=_g?tf.time.format:tf.time.format.utc,Fi=function(){var a=[[Ei("%Y/%-m/%-d"),function(){return!0}],[Ei("%-m/%-d"),function(a){return a.getMonth()}],[Ei("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ei("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ei("%I %p"),function(a){return a.getHours()}],[Ei("%I:%M"),function(a){return a.getMinutes()}],[Ei(":%S"),function(a){return a.getSeconds()}],[Ei(".%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)}}(),Gi=[],Hi=[],Ii=Yg?"left":"bottom",Ji=Yg?uh?"top":"bottom":uh?"right":"left",Ki=Yg?Dh?"bottom":"top":Dh?"left":"right",Li=Yg?"left":"bottom",Mi={main:function(){return"translate("+Jf.left+","+Jf.top+")"},context:function(){return"translate("+Kf.left+","+Kf.top+")"},legend:function(){return"translate("+Lf.left+","+Lf.top+")"},x:function(){return"translate(0,"+(Yg?0:Of)+")"},y:function(){return"translate(0,"+(Yg?Of:0)+")"},y2:function(){return"translate("+(Yg?0:Mf)+","+(Yg?1:0)+")"},subx:function(){return"translate(0,"+(Yg?0:Pf)+")"},arc:function(){return"translate("+Mf/2+","+Of/2+")"}},Ni="right"===Tg,Oi=0,Pi=0,Qi=0,Ri=.15,Si=30,Ti=Yg&&!Zg?0:30,Ui=5;Yf=tf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Vi,Wi=function(){var a=tf.svg.line().x(Yg?function(a){return V(a.id)(a.value)}:zd).y(Yg?zd:function(a){return V(a.id)(a.value)});return Th||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Th?De(b.values):b.values;return ce(b)?(a.interpolate(de(b)?"cardinal":"linear"),Bg[b.id]?Pe(e,fg,V(b.id),Bg[b.id]):a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Xi=function(){var a;return a=Yg?tf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(zd):tf.svg.area().x(zd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=De(b.values);return Yd([b],"area")||Yd([b],"area-spline")?(a.interpolate(de(b)?"cardinal":"linear"),a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Yi=function(){var a=tf.svg.line().x(Yg?function(a){return W(a.id)(a.value)}:Cd).y(Yg?Cd:function(a){return W(a.id)(a.value)});return function(b){var c=De(b.values);return ce(b)?a(c):"M "+ig(c[0].x)+" "+W(b.id)(c[0].value)}}(),Zi=function(){};Vi=tf.svg.brush().on("brush",Ye),Vi.update=function(){return bj&&bj.select("."+f.brush).call(this),this},Vi.scale=function(a){return Yg?this.y(a):this.x(a)},Bf&&(Zi=tf.behavior.zoom().on("zoomstart",function(){Zi.altDomain=tf.event.sourceEvent.altKey?fg.orgDomain():null}).on("zoom",Bf?Ze:null),Zi.scale=function(a){return Yg?this.y(a):this.x(a)},Zi.orgScaleExtent=function(){var a=Cf?Cf:[1,10];return[a[0],Math.max(Ac()/a[1],a[1])]},Zi.updateScaleExtent=function(){var a=bc(fg.orgDomain())/bc(fj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var $i,_i,aj,bj,cj,dj,ej,fj,gj,hj={};if(uf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),uf.defocus(),b(d.classed(f.focused,!0)),b(e),be(uf.data.targets)&&Nb(a,!0),jf(a)},uf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),kf(a)},uf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),lf()},uf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),$i.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?mf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},uf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),$i.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?nf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Ri),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},uf.toggle=function(a){Gc(a)?uf.hide(a):uf.show(a)},uf.unzoom=function(){Vi.clear().update(),Xe({withUpdateXDomain:!0})},uf.load=function(a){return a.xs&&oc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){ug[b]=a.classes[b]}),"categories"in a&&wi&&(ah=a.categories,lg.categories(ah)),"cacheIds"in a&&cc(a.cacheIds)?void cf(ec(a.cacheIds),a.done):void("unload"in a?ef(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){df(a)}):df(a))},uf.unload=function(a){ef(Dc(a),function(){Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},uf.selected=function(a){return tf.merge(aj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return tf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},uf.select=function(a,b,c){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=tf.select(this),i="circle"===this.nodeName?xe:Ae,j="circle"===this.nodeName?ye:Be,k=Fg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Gg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},uf.unselect=function(a,b){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=tf.select(this),g="circle"===this.nodeName?ye:Be,h=Fg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Gg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},uf.toLine=function(a){sf(a,"line")},uf.toSpline=function(a){sf(a,"spline")},uf.toBar=function(a){sf(a,"bar")},uf.toScatter=function(a){sf(a,"scatter")},uf.toArea=function(a){sf(a,"area")},uf.toAreaSpline=function(a){sf(a,"area-spline")},uf.toPie=function(a){sf(a,"pie",{withTransform:!0})},uf.toDonut=function(a){sf(a,"donut",{withTransform:!0})},uf.groups=function(a){return c(a)?vg:(vg=a,Xe(),vg)},uf.xgrids=function(a){return a?(Jh=a,Xe(),Jh):Jh},uf.xgrids.add=function(a){return a?uf.xgrids(Jh.concat(a)):void 0},uf.xgrids.remove=function(a){var b=rf(a);return uf.xgrids(Jh.filter(b))},uf.ygrids=function(a){return a?(Lh=a,Xe(),Lh):Lh},uf.ygrids.add=function(a){return a?uf.ygrids(Lh.concat(a)):void 0},uf.ygrids.remove=function(a){var b=rf(a); -return uf.ygrids(Lh.filter(b))},uf.regions=function(a){return c(a)?hi:(hi=a,Xe(),hi)},uf.regions.add=function(a){return c(a)?hi:(hi=hi.concat(a),Xe(),hi)},uf.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;$i.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),hi=hi.filter(function(b){return b.classes.indexOf(a)<0})}),hi},uf.data.get=function(a){var b=uf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},uf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},uf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){tg[b]=a[b]}),of(Cc(uf.data.targets),{withTransition:!0}),tg):tg},uf.x=function(a){return arguments.length&&(rc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.xs=function(a){return arguments.length&&(sc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},uf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(qh=+a.y),b(a.y2)&&(zh=+a.y2)):qh=zh=+a,Xe())},uf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(rh=+a.y),b(a.y2)&&(Ah=+a.y2)):rh=Ah=+a,Xe())},uf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&uf.axis.max(a.max),"undefined"!=typeof a.min&&uf.axis.min(a.min))},uf.legend.show=function(a){Sg||(Sg=!0,cj.style("visibility","visible")),mf(Dc(a)),Xe({withTransitionForHorizontalAxis:!1})},uf.legend.hide=function(a){Sg&&se(a)&&(Sg=!1,cj.style("visibility","hidden")),nf(Dc(a)),Xe({withTransitionForHorizontalAxis:!1})},uf.resize=function(a){xf=a?a.width:null,yf=a?a.height:null,af({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},uf.destroy=function(){uf.data.targets=void 0,uf.data.xs={},ej.html(""),a.onresize=null},"url"in e.data)tf.xhr(e.data.url,function(a,b){var c,d=tf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=tf.csv.parse(b.response),Qe(c)});else if("rows"in e.data)Qe(uc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Qe(vc(e.data.columns))}return uf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file +}dj.html(li(uf.data.targets.map(function(a){return qc(a.values[ni])}),$(),wd,Di)),dj.style("top",oi.top).style("left",oi.left).style("display","block")}null==a.onresize&&(a.onresize=$e()),a.onresize.add&&(a.onresize.add(Gf),a.onresize.add(function(){af({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})}),a.onresize.add(Hf))}function Re(a){a.append("rect").attr("class",fd).style("cursor",Eg&&Fg?"pointer":null).on("mouseover",function(a,b){if(!zi&&!be(uf.data.targets)){var c,d,e=uf.data.targets.map(function(a){return qc(a.values[b])});if(Object.keys(tg).length>0){d=[];for(var g in tg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Id(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ce,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 Ve(a){be(uf.data.targets)||Eg&&(yi=a,aj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),zi=!0,Ng())}function We(){be(uf.data.targets)||Eg&&(aj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),aj.selectAll("."+f.shape).classed(f.INCLUDED,!1),zi=!1,Og())}function Xe(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U=Sd(),V=be(uf.data.targets),W=Ic(uf.data.targets);if(0!==W.length){if(a=d(a)?a:{},z=d(a.withY)?a.withY:!0,A=d(a.withSubchart)?a.withSubchart:!0,B=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,C=d(a.withTransitionForExit)?a.withTransitionForExit:B,D=d(a.withTransitionForAxis)?a.withTransitionForAxis:B,E=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:B,O=B?If:0,P=C?O:0,Q=D?O:0,I&&Sg&&of(Cc(uf.data.targets),a),H&&(fg.domain(tf.extent(ac(W))),fj=fg.domain(),Bf&&Zi.scale(fg).updateScaleExtent(),ig.domain(fg.domain()),Vi.scale(ig)),G&&(fg.domain(Vi.empty()?fj:Vi.extent()),Bf&&Zi.scale(fg).updateScaleExtent()),gg.domain(Xb(W,"y")),hg.domain(Xb(W,"y2")),(gh||fh)&&(R=hh?hh:Kc(Jc(W)),lg.tickValues(R),og.tickValues(R)),c=aj.select("."+f.axisX).style("opacity",V?0:1),(Yg||E)&&(c=c.transition().duration(Q)),c.call(lg),g=aj.select("."+f.axisY).style("opacity",V?0:1),(!Yg||E)&&(g=g.transition().duration(Q)),g.call(mg),aj.select("."+f.axisY2).style("opacity",V?0:1).transition().duration(Q).call(ng),G)if(dh&&R){for(S=1;S=0&&tf.select(this).style("display",b%T?"none":"block")})}else tf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!Yg&&ih&&eb(c),J=Ke(U),M=Le(U,!0),N=Le(U,!1),Db(),jg.domain(gg.domain()),kg.domain(hg.domain()),dj.style("display","none"),o(),aj.select("line."+f.xgridFocus).style("visibility","hidden"),Hh){if("year"===Ih){i=[];for(var X=ac(),Y=X[0].getFullYear(),Z=X[1].getFullYear(),$=Y;Z>=$;$++)i.push(new Date($+"-01-01 00:00:00"))}else i=fg.ticks(10);h=aj.select("."+f.xgrids).selectAll("."+f.xgrid).data(i),h.enter().append("line").attr("class",f.xgrid),h.attr("x1",Yg?0:function(a){return fg(a)-lg.tickOffset()}).attr("x2",Yg?Mf:function(a){return fg(a)-lg.tickOffset()}).attr("y1",Yg?function(a){return fg(a)-lg.tickOffset()}:Jf.top).attr("y2",Yg?function(a){return fg(a)-lg.tickOffset()}:Of).style("opacity",function(){return+tf.select(this).attr(Yg?"y1":"x1")===(Yg?Of:0)?0:1}),h.exit().remove()}te(Jh)&&(j=aj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Jh),k=j.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),k.append("line").style("opacity",0),k.append("text").attr("text-anchor","end").attr("transform",Yg?"":"rotate(-90)").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),j.select("line").transition().duration(O).attr("x1",Yg?0:Ad).attr("x2",Yg?Mf:Ad).attr("y1",Yg?Ad:Jf.top).attr("y2",Yg?Ad:Of).style("opacity",1),j.select("text").transition().duration(O).attr("x",Yg?Mf:0).attr("y",Ad).text(function(a){return a.text}).style("opacity",1),j.exit().transition().duration(O).style("opacity",0).remove()),z&&Kh&&(l=aj.select("."+f.ygrids).selectAll("."+f.ygrid).data(gg.ticks(Mh)),l.enter().append("line").attr("class",f.ygrid),l.attr("x1",Yg?gg:0).attr("x2",Yg?gg:Mf).attr("y1",Yg?0:gg).attr("y2",Yg?Of:gg),l.exit().remove()),z&&te(Lh)&&(m=aj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Lh),n=m.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),n.append("line").style("opacity",0),n.append("text").attr("text-anchor","end").attr("transform",Yg?"rotate(-90)":"").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),m.select("line").transition().duration(O).attr("x1",Yg?Bd:0).attr("x2",Yg?Bd:Mf).attr("y1",Yg?0:Bd).attr("y2",Yg?Of:Bd).style("opacity",1),m.select("text").transition().duration(O).attr("x",Yg?0:Mf).attr("y",Bd).text(function(a){return a.text}).style("opacity",1),m.exit().transition().duration(O).style("opacity",0).remove()),q=aj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),q.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Di(a)}).attr("class",ad),q.style("opacity",qd).transition().duration(O).attr("d",J).style("opacity",1),q.exit().transition().duration(P).style("opacity",0).remove(),s=aj.selectAll("."+f.texts).selectAll("."+f.text).data(le),s.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return Yg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),s.text(function(a){return yd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(O).attr("x",M).attr("y",N).style("fill-opacity",td),s.exit().transition().duration(P).style("fill-opacity",0).remove(),aj.selectAll("."+f.line).style("opacity",qd).transition().duration(O).attr("d",Wi).style("opacity",1),aj.selectAll("."+f.area).style("opacity",0).transition().duration(O).attr("d",Xi).style("opacity",gj),p=aj.selectAll("."+f.circles).selectAll("."+f.circle).data(ke),p.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Oh),p.style("opacity",qd).transition().duration(O).style("opacity",sd).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),p.exit().remove(),aj.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(O).attrTween("d",function(a){var b,c=Fb(a);return c?(b=tf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1),aj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(O).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&ie(a.data)?1:0}),aj.select("."+f.chartArcsTitle).style("opacity",ae(uf.data.targets)?1:0),Pg&&(null!==tf.event&&"zoom"===tf.event.type&&Vi.extent(fg.orgDomain()).update(),A&&(e=bj.select("."+f.axisX).style("opacity",V?0:1),(Yg||E)&&(e=e.transition().duration(Q)),e.call(og),!Yg&&ih&&eb(e),Vi.empty()||Vi.extent(fg.orgDomain()).update(),K=Ke(U,!0),t=bj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),t.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Di(a)}).attr("class",ad),t.style("opacity",qd).transition().duration(O).attr("d",K).style("opacity",1),t.exit().transition().duration(O).style("opacity",0).remove(),bj.selectAll("."+f.line).style("opacity",qd).transition().duration(O).attr("d",Yi).style("opacity",1))),aj.selectAll("."+f.selectedCircles).filter(function(a){return ee(a)}).selectAll("circle").remove(),aj.selectAll("."+f.selectedCircle).transition().duration(O).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),u=aj.select("."+f.eventRects),te(qg)&&!pc(qg)?(u.classed(f.eventRectsMultiple)||u.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),v=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Se(v.enter()),v.attr("x",0).attr("y",0).attr("width",Mf).attr("height",Of)):(u.classed(f.eventRectsSingle)||u.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),xi&&!wi?(y=function(a,b){var c=yc(b),d=zc(b),e=uf.data.xs[a.id][b];return(fg(d?d:e+50)-fg(c?c:e-50))/2},x=function(a,b){var c=yc(b),d=uf.data.xs[a.id][b];return(fg(d)+fg(c?c:d-50))/2}):(y=L(),x=function(a){return fg(a.x)-y/2}),w=Bc(),aj.select("."+f.eventRects).datum(w?w.values:[]),v=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Re(v.enter()),v.attr("class",fd).attr("x",Yg?0:x).attr("y",Yg?x:0).attr("width",Yg?Mf:y).attr("height",Yg?y:Of),v.exit().remove()),r=aj.select("."+f.regions).selectAll("rect."+f.region).data(hi),r.enter().append("rect").style("fill-opacity",0),r.attr("class",ed).attr("x",fc).attr("y",gc).attr("width",hc).attr("height",ic).transition().duration(O).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Cc(uf.data.targets).forEach(function(a){hj[a]=!0})}}function Ye(){Xe({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ze(){return"mousemove"===tf.event.sourceEvent.type&&Zi.altDomain?(fg.domain(Zi.altDomain),void Zi.scale(fg).updateScaleExtent()):(wi&&fg.orgDomain()[0]===fj[0]&&fg.domain([fj[0]-1e-10,fg.orgDomain()[1]]),Xe({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===tf.event.sourceEvent.type&&(Ai=!0)))}function $e(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function _e(){$i.attr("width",Qf).attr("height",Rf),$i.select("#"+pi).select("rect").attr("width",Mf).attr("height",Of),$i.select("#"+qi).select("rect").attr("width",H),$i.select("#"+ri).select("rect").attr("width",J),$i.select("."+f.zoomRect).attr("width",Mf).attr("height",Of),ej.style("max-height",Rf+"px")}function af(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),_e(),m(a.withTransition),Xe(a)}function bf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=aj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Di(a)}),e=aj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("fill",function(a){return Di(a)}).style("stroke","none").style("cursor",function(a){return Gg(a)?"pointer":null}),c=aj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)}),b.append("path").attr("class",dd).style("opacity",function(){return gj=+tf.select(this).style("opacity"),0}).style("fill",function(a){return Di(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Di(a)}).style("cursor",function(a){return Gg(a)?"pointer":null}),a.forEach(function(a){aj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=aj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Yf(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Di(a.data)}).style("cursor",function(a){return Gg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Fb(a),d=Lb(c),e=Tb();Nb(c.data.id),jf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Fb(a),c=[Lb(b)];Md(c,tf.mouse(this))}).on("mouseout",function(a,b){var c=Fb(a),d=Lb(c),e=Ub();Ob(c.data.id),lf(),Nd(),e(d,b)}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Pg&&(n=bj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Di(a)}),l=bj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)})),$i.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function cf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Xd(a.id,b.types[a.id]):Xd(a.id,b.type)}),uf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Ni?j:i,l=Ni?Q():P();return d&&(w=0,C=0,t=0,u=0),Sg&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Ni?u:t,void(Xg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,Ni?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=cj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Ug?Ug(a):uf.toggle(a)}).on("mouseover",function(a){uf.focus(a),"function"==typeof Vg&&Vg(a)}).on("mouseout",function(a){uf.revert(),"function"==typeof Wg&&Wg(a)}),l.append("text").text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",Ni?g:-200).attr("y",Ni?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ni?h:-200).attr("y",Ni?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Di(a)}).attr("x",Ni?g:-200).attr("y",Ni?-200:i).attr("width",10).attr("height",10),cj.selectAll("text").data(a).text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),cj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),cj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),_e(),q&&m(p)}function pf(a){return Ec(uf.data.targets,a.id)}function qf(a){return"data"in a&&Ec(uf.data.targets,a.data.id)}function rf(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 sf(a,b,c){var d=!be(uf.data.targets);Xd(a,b),af(c?c:{withTransitionForAxis:d})}var tf=a.d3?a.d3:a.require?a.require("d3"):void 0,uf={data:{},axis:{},legend:{}},vf={},wf=h(["bindto"],"#chart"),xf=h(["size","width"]),yf=h(["size","height"]),zf=h(["padding","left"]),Af=h(["padding","right"]),Bf=h(["zoom","enabled"],!1),Cf=h(["zoom","extent"]),Df=h(["zoom","privileged"],!1),Ef=h(["onenter"],function(){}),Ff=h(["onleave"],function(){}),Gf=h(["onresize"],function(){}),Hf=h(["onresized"],function(){}),If=h(["transition","duration"],350);g("data","data is required in config");var Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg=h(["data","x"]),qg=h(["data","xs"],{}),rg=h(["data","x_format"]),sg=h(["data","id_converter"],function(a){return a}),tg=h(["data","names"],{}),ug=h(["data","classes"],{}),vg=h(["data","groups"],[]),wg=h(["data","axes"],{}),xg=h(["data","type"]),yg=h(["data","types"],{}),zg=h(["data","labels"],{}),Ag=h(["data","order"]),Bg=h(["data","regions"],{}),Cg=h(["data","color"]),Dg=h(["data","colors"],{}),Eg=h(["data","selection","enabled"],!1),Fg=h(["data","selection","grouped"],!1),Gg=h(["data","selection","isselectable"],function(){return!0}),Hg=h(["data","selection","multiple"],!0),Ig=h(["data","onclick"],function(){}),Jg=h(["data","onenter"],function(){}),Kg=h(["data","onleave"],function(){}),Lg=h(["data","onselected"],function(){}),Mg=h(["data","onunselected"],function(){}),Ng=h(["data","ondragstart"],function(){}),Og=h(["data","ondragend"],function(){}),Pg=h(["subchart","show"],!1),Qg=h(["subchart","size","height"],60),Rg=h(["color","pattern"],[]),Sg=h(["legend","show"],!0),Tg=h(["legend","position"],"bottom"),Ug=h(["legend","item","onclick"]),Vg=h(["legend","item","onmouseover"]),Wg=h(["legend","item","onmouseout"]),Xg=h(["legend","equally"],!1),Yg=h(["axis","rotated"],!1),Zg=h(["axis","x","show"],!0),$g=h(["axis","x","type"],"indexed"),_g=h(["axis","x","localtime"],!0),ah=h(["axis","x","categories"],[]),bh=h(["axis","x","tick","centered"],!1),ch=h(["axis","x","tick","format"]),dh=h(["axis","x","tick","culling"],{}),eh=h(["axis","x","tick","culling","max"],10),fh=h(["axis","x","tick","count"]),gh=h(["axis","x","tick","fit"],!0),hh=h(["axis","x","tick","values"],null),ih=h(["axis","x","tick","rotate"]),jh=h(["axis","x","max"],null),kh=h(["axis","x","min"],null),lh=h(["axis","x","padding"],{}),mh=h(["axis","x","height"]),nh=h(["axis","x","default"]),oh=h(["axis","x","label"],{}),ph=h(["axis","y","show"],!0),qh=h(["axis","y","max"]),rh=h(["axis","y","min"]),sh=h(["axis","y","center"]),th=h(["axis","y","label"],{}),uh=h(["axis","y","inner"],!1),vh=h(["axis","y","tick","format"]),wh=h(["axis","y","padding"],{}),xh=h(["axis","y","ticks"],10),yh=h(["axis","y2","show"],!1),zh=h(["axis","y2","max"]),Ah=h(["axis","y2","min"]),Bh=h(["axis","y2","center"]),Ch=h(["axis","y2","label"],{}),Dh=h(["axis","y2","inner"],!1),Eh=h(["axis","y2","tick","format"]),Fh=h(["axis","y2","padding"],{}),Gh=h(["axis","y2","ticks"],10),Hh=h(["grid","x","show"],!1),Ih=h(["grid","x","type"],"tick"),Jh=h(["grid","x","lines"],[]),Kh=h(["grid","y","show"],!1),Lh=h(["grid","y","lines"],[]),Mh=h(["grid","y","ticks"],10),Nh=h(["point","show"],!0),Oh=Nh?h(["point","r"],2.5):0,Ph=h(["point","focus","line","enabled"],!0),Qh=h(["point","focus","expand","enabled"],!0),Rh=h(["point","focus","expand","r"],Qh?4:Oh),Sh=h(["point","focus","select","r"],8),Th=h(["line","connect_null"],!1),Uh=h(["bar","width"]),Vh=h(["bar","width","ratio"],.6),Wh=h(["pie","label","show"],!0),Xh=h(["pie","label","format"]),Yh=h(["pie","expand"],!0),Zh=h(["pie","onclick"],function(){}),$h=h(["pie","onmouseover"],function(){}),_h=h(["pie","onmouseout"],function(){}),ai=h(["donut","label","show"],!0),bi=h(["donut","label","format"]),ci=h(["donut","expand"],!0),di=h(["donut","title"],""),ei=h(["donut","onclick"],function(){}),fi=h(["donut","onmouseover"],function(){}),gi=h(["donut","onmouseout"],function(){}),hi=h(["regions"],[]),ii=h(["tooltip","show"],!0),ji=h(["tooltip","format","title"]),ki=h(["tooltip","format","value"]),li=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ji?ji:b,l=ki?ki: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+""}),mi=h(["tooltip","init","show"],!1),ni=h(["tooltip","init","x"],0),oi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),pi=("string"==typeof wf?wf.replace("#",""):wf.id)+"-clip",qi=pi+"-xaxis",ri=pi+"-yaxis",si=i(pi),ti=i(qi),ui=i(ri),vi="timeseries"===$g,wi="categorized"===$g,xi=!vi&&(pg||te(qg)),yi=null,zi=!1,Ai=!1,Bi=!1,Ci=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Di=ne(Dg,te(Rg)?Rg:Ci,Cg),Ei=_g?tf.time.format:tf.time.format.utc,Fi=function(){var a=[[Ei("%Y/%-m/%-d"),function(){return!0}],[Ei("%-m/%-d"),function(a){return a.getMonth()}],[Ei("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ei("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ei("%I %p"),function(a){return a.getHours()}],[Ei("%I:%M"),function(a){return a.getMinutes()}],[Ei(":%S"),function(a){return a.getSeconds()}],[Ei(".%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)}}(),Gi=[],Hi=[],Ii=Yg?"left":"bottom",Ji=Yg?uh?"top":"bottom":uh?"right":"left",Ki=Yg?Dh?"bottom":"top":Dh?"left":"right",Li=Yg?"left":"bottom",Mi={main:function(){return"translate("+Jf.left+","+Jf.top+")"},context:function(){return"translate("+Kf.left+","+Kf.top+")"},legend:function(){return"translate("+Lf.left+","+Lf.top+")"},x:function(){return"translate(0,"+(Yg?0:Of)+")"},y:function(){return"translate(0,"+(Yg?Of:0)+")"},y2:function(){return"translate("+(Yg?0:Mf)+","+(Yg?1:0)+")"},subx:function(){return"translate(0,"+(Yg?0:Pf)+")"},arc:function(){return"translate("+Mf/2+","+Of/2+")"}},Ni="right"===Tg,Oi=0,Pi=0,Qi=0,Ri=.15,Si=30,Ti=Yg&&!Zg?0:30,Ui=5;Yf=tf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Vi,Wi=function(){var a=tf.svg.line().x(Yg?function(a){return V(a.id)(a.value)}:zd).y(Yg?zd:function(a){return V(a.id)(a.value)});return Th||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Th?De(b.values):b.values;return ce(b)?(a.interpolate(de(b)?"cardinal":"linear"),Bg[b.id]?Pe(e,fg,V(b.id),Bg[b.id]):a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Xi=function(){var a;return a=Yg?tf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(zd):tf.svg.area().x(zd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=De(b.values);return Yd([b],"area")||Yd([b],"area-spline")?(a.interpolate(de(b)?"cardinal":"linear"),a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Yi=function(){var a=tf.svg.line().x(Yg?function(a){return W(a.id)(a.value)}:Cd).y(Yg?Cd:function(a){return W(a.id)(a.value)});return function(b){var c=De(b.values);return ce(b)?a(c):"M "+ig(c[0].x)+" "+W(b.id)(c[0].value)}}(),Zi=function(){};Vi=tf.svg.brush().on("brush",Ye),Vi.update=function(){return bj&&bj.select("."+f.brush).call(this),this},Vi.scale=function(a){return Yg?this.y(a):this.x(a)},Bf&&(Zi=tf.behavior.zoom().on("zoomstart",function(){Zi.altDomain=tf.event.sourceEvent.altKey?fg.orgDomain():null}).on("zoom",Bf?Ze:null),Zi.scale=function(a){return Yg?this.y(a):this.x(a)},Zi.orgScaleExtent=function(){var a=Cf?Cf:[1,10];return[a[0],Math.max(Ac()/a[1],a[1])]},Zi.updateScaleExtent=function(){var a=bc(fg.orgDomain())/bc(fj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var $i,_i,aj,bj,cj,dj,ej,fj,gj,hj={};if(uf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),uf.defocus(),b(d.classed(f.focused,!0)),b(e),be(uf.data.targets)&&Nb(a,!0),jf(a)},uf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),kf(a)},uf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),lf()},uf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),$i.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?mf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},uf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),$i.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?nf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Ri),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},uf.toggle=function(a){Gc(a)?uf.hide(a):uf.show(a)},uf.unzoom=function(){Vi.clear().update(),Xe({withUpdateXDomain:!0})},uf.load=function(a){return a.xs&&oc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){ug[b]=a.classes[b]}),"categories"in a&&wi&&(ah=a.categories,lg.categories(ah)),"cacheIds"in a&&cc(a.cacheIds)?void cf(ec(a.cacheIds),a.done):void("unload"in a?ef(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){df(a)}):df(a))},uf.unload=function(a){ef(Dc(a),function(){Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},uf.selected=function(a){return tf.merge(aj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return tf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},uf.select=function(a,b,c){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=tf.select(this),i="circle"===this.nodeName?xe:Ae,j="circle"===this.nodeName?ye:Be,k=Fg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Gg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},uf.unselect=function(a,b){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=tf.select(this),g="circle"===this.nodeName?ye:Be,h=Fg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Gg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},uf.toLine=function(a){sf(a,"line")},uf.toSpline=function(a){sf(a,"spline")},uf.toBar=function(a){sf(a,"bar")},uf.toScatter=function(a){sf(a,"scatter")},uf.toArea=function(a){sf(a,"area")},uf.toAreaSpline=function(a){sf(a,"area-spline")},uf.toPie=function(a){sf(a,"pie",{withTransform:!0})},uf.toDonut=function(a){sf(a,"donut",{withTransform:!0})},uf.groups=function(a){return c(a)?vg:(vg=a,Xe(),vg)},uf.xgrids=function(a){return a?(Jh=a,Xe(),Jh):Jh},uf.xgrids.add=function(a){return a?uf.xgrids(Jh.concat(a)):void 0},uf.xgrids.remove=function(a){var b=rf(a);return uf.xgrids(Jh.filter(b))},uf.ygrids=function(a){return a?(Lh=a,Xe(),Lh):Lh},uf.ygrids.add=function(a){return a?uf.ygrids(Lh.concat(a)):void 0 +},uf.ygrids.remove=function(a){var b=rf(a);return uf.ygrids(Lh.filter(b))},uf.regions=function(a){return c(a)?hi:(hi=a,Xe(),hi)},uf.regions.add=function(a){return c(a)?hi:(hi=hi.concat(a),Xe(),hi)},uf.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;$i.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),hi=hi.filter(function(b){return b.classes.indexOf(a)<0})}),hi},uf.data.get=function(a){var b=uf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},uf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},uf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){tg[b]=a[b]}),of(Cc(uf.data.targets),{withTransition:!0}),tg):tg},uf.x=function(a){return arguments.length&&(rc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.xs=function(a){return arguments.length&&(sc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},uf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(qh=+a.y),b(a.y2)&&(zh=+a.y2)):qh=zh=+a,Xe())},uf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(rh=+a.y),b(a.y2)&&(Ah=+a.y2)):rh=Ah=+a,Xe())},uf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&uf.axis.max(a.max),"undefined"!=typeof a.min&&uf.axis.min(a.min))},uf.legend.show=function(a){Sg||(Sg=!0,cj.style("visibility","visible")),mf(Dc(a)),Xe({withTransitionForHorizontalAxis:!1})},uf.legend.hide=function(a){Sg&&se(a)&&(Sg=!1,cj.style("visibility","hidden")),nf(Dc(a)),Xe({withTransitionForHorizontalAxis:!1})},uf.resize=function(a){xf=a?a.width:null,yf=a?a.height:null,af({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},uf.destroy=function(){uf.data.targets=void 0,uf.data.xs={},ej.html(""),a.onresize=null},"url"in e.data)tf.xhr(e.data.url,function(a,b){var c,d=tf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=tf.csv.parse(b.response),Qe(c)});else if("rows"in e.data)Qe(uc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Qe(vc(e.data.columns))}return uf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 1f92c6e196b15444e9f023ffff51abeafeff8ebb Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Fri, 25 Apr 2014 12:04:39 +0900 Subject: [PATCH 064/178] Fix axis label and tick padding - #175 --- c3.js | 84 +++++++++++++++++++++++++++++++++++++------------------ c3.min.js | 6 ++-- 2 files changed, 60 insertions(+), 30 deletions(-) diff --git a/c3.js b/c3.js index 8715922..bd8a91a 100644 --- a/c3.js +++ b/c3.js @@ -392,7 +392,7 @@ top: getHorizontalAxisHeight('y2'), right: getCurrentPaddingRight(), bottom: getHorizontalAxisHeight('y') + legendHeightForBottom, - left: subchartHeight + rotated_padding_right + getCurrentPaddingLeft() + left: subchartHeight + getCurrentPaddingLeft() }; margin2 = { top: margin.top, @@ -402,7 +402,7 @@ }; } else { margin = { - top: 0, + top: 4, // for top tick text right: getCurrentPaddingRight(), bottom: xAxisHeight + subchartHeight + legendHeightForBottom, left: getCurrentPaddingLeft() @@ -471,8 +471,10 @@ return 0; } else if (__padding_left) { return __padding_left; + } else if (__axis_rotated) { + return !__axis_x_show ? 1 : getAxisWidthByAxisId('x'); } else { - return __axis_rotated || !__axis_y_show || __axis_y_inner ? 1 : getAxisWidthByAxisId('y'); + return !__axis_y_show || __axis_y_inner ? 1 : getAxisWidthByAxisId('y'); } } function getCurrentPaddingRight() { @@ -510,7 +512,7 @@ return forHorizontal ? -(1 + 4) : -(margin.left - 1); } function getAxisClipY(forHorizontal) { - return forHorizontal ? -20 : -1; + return forHorizontal ? -20 : -4; } function getXAxisClipX() { return getAxisClipX(!__axis_rotated); @@ -528,7 +530,7 @@ return forHorizontal ? width + 2 + 4 : margin.left + 20; } function getAxisClipHeight(forHorizontal) { - return forHorizontal ? (__axis_x_height ? __axis_x_height : 0) + 40 : height + 2; + return forHorizontal ? (__axis_x_height ? __axis_x_height : 0) + 80 : height + 8; } function getXAxisClipWidth() { return getAxisClipWidth(!__axis_rotated); @@ -579,11 +581,11 @@ subYMax = __axis_rotated ? width2 : 1; // update scales x = getX(xMin, xMax, forInit ? undefined : x.domain(), function () { return xAxis.tickOffset(); }); - y = getY(yMin, yMax); - y2 = getY(yMin, yMax); + y = getY(yMin, yMax, forInit ? undefined : y.domain()); + y2 = getY(yMin, yMax, forInit ? undefined : y2.domain()); subX = getX(xMin, xMax, orgXDomain, function (d) { return d % 1 ? 0 : subXAxis.tickOffset(); }); - subY = getY(subYMin, subYMax); - subY2 = getY(subYMin, subYMax); + subY = getY(subYMin, subYMax, forInit ? undefined : subY.domain()); + subY2 = getY(subYMin, subYMax, forInit ? undefined : subY2.domain()); // update axes xAxisTickFormat = getXAxisTickFormat(); xAxis = getXAxis(x, xOrient, xAxisTickFormat); @@ -607,7 +609,7 @@ var scale = ((isTimeSeries) ? d3.time.scale() : d3.scale.linear()).range([min, max]); // Set function and values for c3 scale.orgDomain = function () { return scale.domain(); }; - if (isDefined(domain)) { scale.domain(domain); } + if (domain) { scale.domain(domain); } if (isUndefined(offset)) { offset = function () { return 0; }; } // Define customized scale if categorized axis if (isCategorized) { @@ -630,8 +632,10 @@ } return scale; } - function getY(min, max) { - return d3.scale.linear().range([min, max]); + function getY(min, max, domain) { + var scale = d3.scale.linear().range([min, max]); + if (domain) { scale.domain(domain); } + return scale; } function getYScale(id) { return getAxisId(id) === 'y2' ? y2 : y; @@ -804,9 +808,9 @@ function dyForXAxisLabel() { var position = getXAxisLabelPosition(); if (__axis_rotated) { - return position.isInner ? "1.2em" : -30 - getMaxTickWidth('x'); + return position.isInner ? "1.2em" : -25 - getMaxTickWidth('x'); } else { - return position.isInner ? "-0.5em" : "3em"; + return position.isInner ? "-0.5em" : __axis_x_height ? __axis_x_height - 10 : "3em"; } } function dyForYAxisLabel() { @@ -840,12 +844,25 @@ var box = this.getBoundingClientRect(); if (maxWidth < box.width) { maxWidth = box.width; } }); - return maxWidth < 20 ? 20 : maxWidth; + return maxWidth < 30 ? 30 : maxWidth; } function updateAxisLabels() { - main.select('.' + CLASS.axisX + ' .' + CLASS.axisXLabel).attr("x", xForXAxisLabel).text(textForXAxisLabel); - main.select('.' + CLASS.axisY + ' .' + CLASS.axisYLabel).attr("x", xForYAxisLabel).attr("dy", dyForYAxisLabel).text(textForYAxisLabel); - main.select('.' + CLASS.axisY2 + ' .' + CLASS.axisY2Label).attr("x", xForY2AxisLabel).attr("dy", dyForY2AxisLabel).text(textForY2AxisLabel); + main.select('.' + CLASS.axisX + ' .' + CLASS.axisXLabel) + .attr("x", xForXAxisLabel) + .attr("dx", dxForXAxisLabel) + .attr("dy", dyForXAxisLabel) + .text(textForXAxisLabel); + main.select('.' + CLASS.axisY + ' .' + CLASS.axisYLabel) + .attr("x", xForYAxisLabel) + .attr("dx", dxForYAxisLabel) + .attr("dy", dyForYAxisLabel) + .attr("dy", dyForYAxisLabel) + .text(textForYAxisLabel); + main.select('.' + CLASS.axisY2 + ' .' + CLASS.axisY2Label) + .attr("x", xForY2AxisLabel) + .attr("dx", dxForY2AxisLabel) + .attr("dy", dyForY2AxisLabel) + .text(textForY2AxisLabel); } function categoryAxis() { @@ -2567,8 +2584,6 @@ .append("text") .attr("class", CLASS.axisXLabel) .attr("transform", __axis_rotated ? "rotate(-90)" : "") - .attr("dx", dxForXAxisLabel) - .attr("dy", dyForXAxisLabel) .style("text-anchor", textAnchorForXAxisLabel); } @@ -2580,8 +2595,6 @@ .append("text") .attr("class", CLASS.axisYLabel) .attr("transform", __axis_rotated ? "" : "rotate(-90)") - .attr("dx", dxForYAxisLabel) - .attr("dy", dyForYAxisLabel) .style("text-anchor", textAnchorForYAxisLabel); } @@ -2593,7 +2606,6 @@ .append("text") .attr("class", CLASS.axisY2Label) .attr("transform", __axis_rotated ? "" : "rotate(-90)") - .attr("dx", dxForY2AxisLabel) .style("text-anchor", textAnchorForY2AxisLabel); } @@ -2719,6 +2731,12 @@ main.select('.' + CLASS.axisY2).style("opacity", 0).call(yAxis2); } + // Update sizes according to tick width updated by above + updateSizes(); + updateScales(); + updateSvgSize(); + transformAll(); + // Draw with targets redraw({withTransform: true, withUpdateXDomain: true, withUpdateOrgXDomain: true, withTransitionForAxis: false}); @@ -3548,10 +3566,22 @@ function updateSvgSize() { svg.attr('width', currentWidth).attr('height', currentHeight); - svg.select('#' + clipId).select('rect').attr('width', width).attr('height', height); - svg.select('#' + clipIdForXAxis).select('rect').attr('width', getXAxisClipWidth); - svg.select('#' + clipIdForYAxis).select('rect').attr('width', getYAxisClipWidth); - svg.select('.' + CLASS.zoomRect).attr('width', width).attr('height', height); + svg.select('#' + clipId).select('rect') + .attr('width', width) + .attr('height', height); + svg.select('#' + clipIdForXAxis).select('rect') + .attr('x', getXAxisClipX) + .attr('y', getXAxisClipY) + .attr('width', getXAxisClipWidth) + .attr('height', getXAxisClipHeight); + svg.select('#' + clipIdForYAxis).select('rect') + .attr('x', getYAxisClipX) + .attr('y', getYAxisClipY) + .attr('width', getYAxisClipWidth) + .attr('height', getYAxisClipHeight); + svg.select('.' + CLASS.zoomRect) + .attr('width', width) + .attr('height', height); // MEMO: parent div's height will be bigger than svg when selectChart.style('max-height', currentHeight + "px"); } diff --git a/c3.min.js b/c3.min.js index b42a254..28a7940 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.32"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cMf&&(Mf=0),0>Of&&(Of=0),Nf=Yg?Jf.left-Si-Ti:Mf,Pf=Yg?Of:Rf-Kf.top-Kf.bottom,0>Nf&&(Nf=0),0>Pf&&(Pf=0),p(),Ni&&be(uf.data.targets)&&(Lf.left=Mf/2+Tf)}function o(){aj.select("line."+f.xgridFocus).attr("x1",Yg?0:-10).attr("x2",Yg?Mf:-10).attr("y1",Yg?-10:Jf.top).attr("y2",Yg?-10:Of)}function p(){Tf=Of/2,Sf=.95*Tf,Uf=ae(uf.data.targets)?.6*Sf:0}function q(){var a=Yg?f.axisX:f.axisY,b=tf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=tf.select(wf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return xf?xf:x()}function s(){var a=yf?yf:y();return a>0?a:320}function t(){return be(uf.data.targets)?0:zf?zf:Yg||!ph||uh?1:v("y")}function u(){var a=1;return be(uf.data.targets)?0:Af?Af:Ni?P()+(yh&&!Yg?v("y2"):a):yh?Dh||Yg?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||Zg?"x"===a&&mh?mh:"y"!==a||ph?"y2"!==a||yh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Ui:Sg&&!Ni?10:1:0}function x(){return+tf.select(wf).style("width").replace("px","")}function y(){return+tf.select(wf).style("height").replace("px","")}function z(a){return a?-5:-(Jf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Yg)}function C(){return A(!Yg)}function D(){return z(Yg)}function E(){return A(Yg)}function F(a){return a?Mf+2+4:Jf.left+20}function G(a){return a?(mh?mh:0)+40:Of+2}function H(){return F(!Yg)}function I(){return G(!Yg)}function J(){return F(Yg)}function K(){return G(Yg)}function L(){var a=Yg?Of:Mf,b=Ac(),c=Yb()*(Zd(uf.data.targets)?(b-(wi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){Oi=a}function N(a){Pi=a}function O(a){Qi=a}function P(){return Sg?Ni?Pi*(Oi+1):Qf:0}function Q(){return Sg?Ni?Rf:Qi*(Oi+1):0}function R(){var a,b=!fg;Zf=Yg?1:0,$f=Yg?Of:Mf,_f=Yg?0:Of,ag=Yg?Mf:1,bg=Zf,cg=$f,dg=Yg?0:Pf,eg=Yg?Nf:1,fg=T(Zf,$f,b?void 0:fg.domain(),function(){return lg.tickOffset()}),gg=U(_f,ag),hg=U(_f,ag),ig=T(Zf,$f,fj,function(a){return a%1?0:og.tickOffset()}),jg=U(dg,eg),kg=U(dg,eg),a=$(),lg=X(fg,Ii,a),og=X(ig,Li,a),mg=Y(gg,Ji,vh,xh),ng=Y(hg,Ki,Eh,Gh),b||(Vi.scale(ig),Bf&&Zi.scale(fg)),S()}function S(){Vf=Gb(),Wf=Hb(),Xf=Hb(.98)}function T(a,b,e,f){var g=(vi?tf.time.scale():tf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),wi){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return tf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?hg:gg}function W(a){return"y2"===Z(a)?kg:jg}function X(a,b,c){var d=(wi?Eb():tf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),wi?(d.tickCentered(bh),se(dh)&&(dh=!1)):d.tickOffset=function(){var a=Yg?Of:Mf;return a*Yb()/Ac()/2},wi&&d.categories(ah),d}function Y(a,b,c,d){return tf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in wg?wg[a]:"y"}function $(){var a=vi?Fi:wi?Tc:function(a){return 0>a?a.toFixed(0):a};return ch&&("function"==typeof ch?a=ch:vi&&(a=function(a){return a?Ei(ch)(a):""})),a}function _(a){var b;return"y"===a?b=th:"y2"===a?b=Ch:"x"===a&&(b=oh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?th=b:"y2"===a?Ch=b:"x"===a&&(oh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a){a.selectAll(".tick text").attr("y",db(ih)).attr("x",cb(ih)).attr("transform","rotate("+ih+")").style("text-anchor","start")}function fb(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 gb(){return fb("x",Yg?"inner-top":"inner-right")}function hb(){return fb("y",Yg?"inner-right":"inner-top")}function ib(){return fb("y2",Yg?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Mf/2:Mf:b.isBottom?-Of:b.isMiddle?-Of/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!Yg,gb())}function rb(){return nb(Yg,hb())}function sb(){return nb(Yg,ib())}function tb(){return ob(!Yg,gb())}function ub(){return ob(Yg,hb())}function vb(){return ob(Yg,ib())}function wb(){var a=gb();return Yg?a.isInner?"1.2em":-30-Cb("x"):a.isInner?"-0.5em":"3em"}function xb(){var a=hb();return Yg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return Yg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!Yg,gb())}function Ab(){return pb(Yg,hb())}function Bb(){return pb(Yg,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return tf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?20:b}function Db(){aj.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).text(kb),aj.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dy",xb).text(lb),aj.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dy",yb).text(mb)}function Eb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+o)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Rc(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 tf.min(Object.keys(i).map(function(a){return tf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(vg.length>0)for(g=Sc(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 tf.max(Object.keys(i).map(function(a){return tf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Ah:rh,n="y2"===c?zh:qh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Bh:sh,r=ud()&&Yg;return 0===l.length?"y2"===c?hg.domain():gg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=bc(gg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&wh&&(f=b(wh.top)?wh.top:e,g=b(wh.bottom)?wh.bottom:e),"y2"===c&&Fh&&(f=b(Fh.top)?Fh.top:e,g=b(Fh.bottom)?Fh.bottom:e),Zd(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){var b=bc(fj),c=bc(fg.domain());return a||0===c?1:b/c}function Zb(a){return kh?vi?oe(kh):kh:tf.min(a,function(a){return tf.min(a.values,function(a){return a.x})})}function $b(a){return jh?vi?oe(jh):jh:tf.max(a,function(a){return tf.max(a.values,function(a){return a.x})})}function _b(a,c){var d,e,f,g,h=c[0],i=c[1],j=Math.abs(h-i);return wi?e=0:Zd(a)?(d=Ac(),e=d>1?j/(d-1)/2:.5):e=.01*j,"object"==typeof lh&&te(lh)?(f=b(lh.left)?lh.left:e,g=b(lh.right)?lh.right:e):f=g="number"==typeof lh?lh:e,{left:f,right:g}}function ac(a){var b=[Zb(a),$b(a)],c=b[0],d=b[1],e=_b(a,b),f=0,g=0;return(c||0===c)&&(f=vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function bc(a){return a[1]-a[0]}function cc(a){for(var b=0;bb?0:b-c}function ic(a){var b,c=gc(a),d="y"===a.axis?gg:hg;return b="y"===a.axis||"y2"===a.axis?Yg?Of:"start"in a?d(a.start):Of:Yg?"end"in a?fg(vi?oe(a.end):a.end):Of:Of,c>b?0:b-c}function jc(a){return pg&&a===pg||te(qg)&&ue(qg,a)}function kc(a){return!jc(a)}function lc(a){return pg?pg:te(qg)?qg[a]:null}function mc(a,b){var c,d=b&&te(b)?Cc(b):[];return d.forEach(function(b){lc(b)===a&&(c=uf.data.xs[b])}),c}function nc(a,b){return a in uf.data.xs&&uf.data.xs[a]&&uf.data.xs[a][b]?uf.data.xs[a][b]:b}function oc(a){Object.keys(a).forEach(function(b){qg[b]=a[b]})}function pc(a){return 1===tf.set(Object.keys(a).map(function(b){return a[b]})).size()}function qc(a){var b;return a&&(b=tg[a.id],a.name=b?b:a.id),a}function rc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=tc(b[d],a.id,d)}),uf.data.xs[a.id]=b})}function sc(a,b){a.forEach(function(a){b[a.id]&&rc([a],b[a.id])})}function tc(a,b,c){var d;return d=vi?a?a instanceof Date?a:oe(a):oe(nc(b,c)):xi&&!wi?a?+a:nc(b,c):c}function uc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?uf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):pg?(d=Object.keys(uf.data.xs),uf.data.xs[c]=d.length>0?uf.data.xs[d[0]]:void 0):te(qg)&&(uf.data.xs[c]=mc(f,uf.data.targets)):uf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!uf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=sg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=lc(b),g=a[f],h=tc(g,b,e);return xi&&wi&&0===c&&g&&(0===e&&(ah=[]),ah.push(g)),("undefined"==typeof a[b]||uf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),xg&&Xd(Cc(c).filter(function(a){return!(a in yg)}),xg),c.forEach(function(a){dc(a.id_org,a)}),c}function xc(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 yc(a){return a>0&&uf.data.targets[0].values[a-1]?uf.data.targets[0].values[a-1].x:void 0}function zc(a){return a1?uf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?uf.data.targets[0]:null,a}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(uf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(vi?new Date(h):h);i.push(d)}return vi||(i=i.sort(function(a,b){return a-b})),i}function Lc(a){Gi=Gi.concat(a)}function Mc(a){Gi=Gi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Hi=Hi.concat(a)}function Oc(a){Hi=Hi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Dd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Dd(a,g))),Gd(e,b)):Ed(a,b,f,g)}function Fd(a,b){var c;return c=a.map(function(a){return Ed(a.values,b)}),Gd(c,b)}function Gd(a,b){var c,d;return a.forEach(function(a){var e=ve(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Hd(a,b){return tf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Id(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 Jd(){return Ag&&"desc"===Ag.toLowerCase()}function Kd(){return Ag&&"asc"===Ag.toLowerCase()}function Ld(a){var b=Kd(),c=Jd();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 Ag&&a.sort(Ag),a}function Md(a,c){var d,e,f,g,h,i,j,k=be(uf.data.targets),l=k?xd:wd,m=a.filter(function(a){return a&&b(a.value)});ii&&0!==m.length&&(dj.html(li(a,$(),l,Di)).style("display","block"),d=dj.property("offsetWidth"),e=dj.property("offsetHeight"),k?(g=Mf/2+c[0],i=Of/2+c[1]+20):(Yg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=fg(m[0].x)+20):(f=q(),g=f+t()+fg(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),dj.style("top",i+"px").style("left",g+"px"))}function Nd(){dj.style("display","none")}function Od(a){var c=a.filter(function(a){return a&&b(a.value)});ii&&($d(uf.data.targets)||be(uf.data.targets)||aj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Yg?"y1":"x1",zd).attr(Yg?"y2":"x2",zd))}function Pd(){aj.select("line."+f.xgridFocus).style("visibility","hidden")}function Qd(a){return a.x||0===a.x?fg(a.x):null}function Rd(a){return V(a.id)(a.value)}function Sd(){var a,b,d={},e=0;return Ic(Fc(ee)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Wd(a,b){return Uh?Uh:b?2*a.tickOffset()*Vh/b:0}function Xd(a,b){Dc(a).forEach(function(a){hj[a]=b===yg[a],yg[a]=b})}function Yd(a,b){var c=!1;return a.forEach(function(a){yg[a.id]===b&&(c=!0),a.id in yg||"line"!==b||(c=!0)}),c}function Zd(a){return Yd(a,"bar")}function $d(a){return Yd(a,"scatter")}function _d(a){return Yd(a,"pie")}function ae(a){return Yd(a,"donut")}function be(a){return _d(a)||ae(a)}function ce(a){var b="string"==typeof a?a:a.id;return!(b in yg)||"line"===yg[b]||"spline"===yg[b]||"area"===yg[b]||"area-spline"===yg[b]}function de(a){var b="string"==typeof a?a:a.id;return"spline"===yg[b]||"area-spline"===yg[b]}function ee(a){var b="string"==typeof a?a:a.id;return"bar"===yg[b]}function fe(a){var b="string"==typeof a?a:a.id;return"scatter"===yg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"pie"===yg[b]}function he(a){var b="string"==typeof a?a:a.id;return"donut"===yg[b]}function ie(a){return ge(a)||he(a)}function je(a){return ee(a)?a.values:[]}function ke(a){return ce(a)||fe(a)?a.values:[]}function le(a){return ee(a)||ce(a)?a.values:[]}function me(a){return he(a)&&ci||ge(a)&&Yh}function ne(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function oe(b){var c;try{c=rg?tf.time.format(rg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+rg)}return c}function pe(a,b){var c=tf.mouse(a),d=tf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function ue(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ve(a,b){var c="y"===Z(a.id)?gg:hg,d=Yg?1:0,e=Yg?0:1;return Math.pow(fg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function we(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function xe(a,b,c){Lg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd).attr("stroke",function(){return Di(b)}).attr("r",1.4*Sh).transition().duration(100).attr("r",Sh)}function ye(a,b,c){Mg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ze(a,b,c,d){a?xe(b,c,d):ye(b,c,d)}function Ae(a,b){Lg(b,a.node()),a.transition().duration(100).style("fill",function(){return tf.rgb(Di(b)).darker(1)})}function Be(a,b){Mg(b,a.node()),a.transition().duration(100).style("fill",function(){return Di(b)})}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a){return a.filter(function(a){return b(a.value)})}function Ee(a,c){return(c?aj.selectAll("."+f.circles+ld(c)):aj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Fe(a,b){Ee(a,b).classed(f.EXPANDED,!0).attr("r",Rh)}function Ge(a){Ee(a).filter(function(){return tf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oh)}function He(a){return aj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ie(a){He(a).classed(f.EXPANDED,!0)}function Je(a){He(a).classed(f.EXPANDED,!1)}function Ke(a,b){var c=Oe(a,b);return function(a,b){var d=c(a,b),e=Yg?1:0,f=Yg?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 Le(a,b){var c=Oe(a,!1),d=b?Me:Ne;return function(a,b){return d(c(a,b),a,this)}}function Me(a,b){var c;return Yg?(c=ee(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ne(a,b,c){var d=c.getBoundingClientRect();return Yg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ee(b)?-3:-6)}function Oe(a,b){var c=a.__max__+1,d=Wd(lg,c),e=Td(d,c,a,!!b),f=Ud(!!b),g=Vd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Yg&&(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 Pe(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 Qe(b){var c,d,e;if(ej=tf.select(wf),ej.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ej.html(""),ej.classed("c3",!0),uf.data.xs={},uf.data.targets=wc(b),n(),R(),fg.domain(tf.extent(ac(uf.data.targets))),gg.domain(Xb(uf.data.targets,"y")),hg.domain(Xb(uf.data.targets,"y2")),ig.domain(fg.domain()),jg.domain(gg.domain()),kg.domain(hg.domain()),fj=fg.domain(),Vi.scale(ig),Bf&&Zi.scale(fg),$i=ej.append("svg").attr("width",Mf+Jf.left+Jf.right).attr("height",Of+Jf.top+Jf.bottom).on("mouseenter",Ef).on("mouseleave",Ff),_i=$i.append("defs"),_i.append("clipPath").attr("id",pi).append("rect").attr("width",Mf).attr("height",Of),_i.append("clipPath").attr("id",qi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),_i.append("clipPath").attr("id",ri).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),aj=$i.append("g").attr("transform",Mi.main),bj=Pg?$i.append("g").attr("transform",Mi.context):null,cj=$i.append("g").attr("transform",Mi.legend),Sg||(cj.style("visibility","hidden"),Hi=Cc(uf.data.targets)),dj=tf.select(wf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),of(Cc(uf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Zg&&aj.append("g").attr("class",f.axisX).attr("clip-path",ti).attr("transform",Mi.x).append("text").attr("class",f.axisXLabel).attr("transform",Yg?"rotate(-90)":"").attr("dx",tb).attr("dy",wb).style("text-anchor",zb),ph&&aj.append("g").attr("class",f.axisY).attr("clip-path",ui).attr("transform",Mi.y).append("text").attr("class",f.axisYLabel).attr("transform",Yg?"":"rotate(-90)").attr("dx",ub).attr("dy",xb).style("text-anchor",Ab),yh&&aj.append("g").attr("class",f.axisY2).attr("transform",Mi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Yg?"":"rotate(-90)").attr("dx",vb).style("text-anchor",Bb),d=aj.append("g").attr("clip-path",si).attr("class",f.grid),Hh&&d.append("g").attr("class",f.xgrids),te(Jh)&&d.append("g").attr("class",f.xgridLines),Ph&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Kh&&d.append("g").attr("class",f.ygrids),te(Lh)&&d.append("g").attr("class",f.ygridLines),aj.append("g").attr("clip-path",si).attr("class",f.regions),aj.append("g").attr("clip-path",si).attr("class",f.chart),c=aj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Bf?Yg?"ns-resize":"ew-resize":null),aj.select("."+f.chart).append("g").attr("class",f.chartBars),aj.select("."+f.chart).append("g").attr("class",f.chartLines),aj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Mi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),aj.select("."+f.chart).append("g").attr("class",f.chartTexts),Bf&&aj.insert("rect",Df?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Mf).attr("height",Of).style("opacity",0).style("cursor",Yg?"ns-resize":"ew-resize").call(Zi).on("dblclick.zoom",null),nh&&Vi.extent("function"!=typeof nh?nh:nh(ac())),Pg&&(bj.append("g").attr("clip-path",si).attr("class",f.chart),bj.select("."+f.chart).append("g").attr("class",f.chartBars),bj.select("."+f.chart).append("g").attr("class",f.chartLines),bj.append("g").attr("clip-path",si).attr("class",f.brush).call(Vi).selectAll("rect").attr(Yg?"width":"height",Yg?Nf:Pf),bj.append("g").attr("class",f.axisX).attr("transform",Mi.subx).attr("clip-path",Yg?"":ti)),bf(uf.data.targets),Yg?aj.select("."+f.axisX).style("opacity",0).call(lg):(aj.select("."+f.axisY).style("opacity",0).call(mg),aj.select("."+f.axisY2).style("opacity",0).call(ng)),Xe({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),mi){if(vi&&"string"==typeof ni){for(ni=oe(ni),e=0;e0){d=[];for(var g in tg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Id(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ce,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 Ve(a){be(uf.data.targets)||Eg&&(yi=a,aj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),zi=!0,Ng())}function We(){be(uf.data.targets)||Eg&&(aj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),aj.selectAll("."+f.shape).classed(f.INCLUDED,!1),zi=!1,Og())}function Xe(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U=Sd(),V=be(uf.data.targets),W=Ic(uf.data.targets);if(0!==W.length){if(a=d(a)?a:{},z=d(a.withY)?a.withY:!0,A=d(a.withSubchart)?a.withSubchart:!0,B=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,C=d(a.withTransitionForExit)?a.withTransitionForExit:B,D=d(a.withTransitionForAxis)?a.withTransitionForAxis:B,E=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:B,O=B?If:0,P=C?O:0,Q=D?O:0,I&&Sg&&of(Cc(uf.data.targets),a),H&&(fg.domain(tf.extent(ac(W))),fj=fg.domain(),Bf&&Zi.scale(fg).updateScaleExtent(),ig.domain(fg.domain()),Vi.scale(ig)),G&&(fg.domain(Vi.empty()?fj:Vi.extent()),Bf&&Zi.scale(fg).updateScaleExtent()),gg.domain(Xb(W,"y")),hg.domain(Xb(W,"y2")),(gh||fh)&&(R=hh?hh:Kc(Jc(W)),lg.tickValues(R),og.tickValues(R)),c=aj.select("."+f.axisX).style("opacity",V?0:1),(Yg||E)&&(c=c.transition().duration(Q)),c.call(lg),g=aj.select("."+f.axisY).style("opacity",V?0:1),(!Yg||E)&&(g=g.transition().duration(Q)),g.call(mg),aj.select("."+f.axisY2).style("opacity",V?0:1).transition().duration(Q).call(ng),G)if(dh&&R){for(S=1;S=0&&tf.select(this).style("display",b%T?"none":"block")})}else tf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!Yg&&ih&&eb(c),J=Ke(U),M=Le(U,!0),N=Le(U,!1),Db(),jg.domain(gg.domain()),kg.domain(hg.domain()),dj.style("display","none"),o(),aj.select("line."+f.xgridFocus).style("visibility","hidden"),Hh){if("year"===Ih){i=[];for(var X=ac(),Y=X[0].getFullYear(),Z=X[1].getFullYear(),$=Y;Z>=$;$++)i.push(new Date($+"-01-01 00:00:00"))}else i=fg.ticks(10);h=aj.select("."+f.xgrids).selectAll("."+f.xgrid).data(i),h.enter().append("line").attr("class",f.xgrid),h.attr("x1",Yg?0:function(a){return fg(a)-lg.tickOffset()}).attr("x2",Yg?Mf:function(a){return fg(a)-lg.tickOffset()}).attr("y1",Yg?function(a){return fg(a)-lg.tickOffset()}:Jf.top).attr("y2",Yg?function(a){return fg(a)-lg.tickOffset()}:Of).style("opacity",function(){return+tf.select(this).attr(Yg?"y1":"x1")===(Yg?Of:0)?0:1}),h.exit().remove()}te(Jh)&&(j=aj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Jh),k=j.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),k.append("line").style("opacity",0),k.append("text").attr("text-anchor","end").attr("transform",Yg?"":"rotate(-90)").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),j.select("line").transition().duration(O).attr("x1",Yg?0:Ad).attr("x2",Yg?Mf:Ad).attr("y1",Yg?Ad:Jf.top).attr("y2",Yg?Ad:Of).style("opacity",1),j.select("text").transition().duration(O).attr("x",Yg?Mf:0).attr("y",Ad).text(function(a){return a.text}).style("opacity",1),j.exit().transition().duration(O).style("opacity",0).remove()),z&&Kh&&(l=aj.select("."+f.ygrids).selectAll("."+f.ygrid).data(gg.ticks(Mh)),l.enter().append("line").attr("class",f.ygrid),l.attr("x1",Yg?gg:0).attr("x2",Yg?gg:Mf).attr("y1",Yg?0:gg).attr("y2",Yg?Of:gg),l.exit().remove()),z&&te(Lh)&&(m=aj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Lh),n=m.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),n.append("line").style("opacity",0),n.append("text").attr("text-anchor","end").attr("transform",Yg?"rotate(-90)":"").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),m.select("line").transition().duration(O).attr("x1",Yg?Bd:0).attr("x2",Yg?Bd:Mf).attr("y1",Yg?0:Bd).attr("y2",Yg?Of:Bd).style("opacity",1),m.select("text").transition().duration(O).attr("x",Yg?0:Mf).attr("y",Bd).text(function(a){return a.text}).style("opacity",1),m.exit().transition().duration(O).style("opacity",0).remove()),q=aj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),q.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Di(a)}).attr("class",ad),q.style("opacity",qd).transition().duration(O).attr("d",J).style("opacity",1),q.exit().transition().duration(P).style("opacity",0).remove(),s=aj.selectAll("."+f.texts).selectAll("."+f.text).data(le),s.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return Yg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),s.text(function(a){return yd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(O).attr("x",M).attr("y",N).style("fill-opacity",td),s.exit().transition().duration(P).style("fill-opacity",0).remove(),aj.selectAll("."+f.line).style("opacity",qd).transition().duration(O).attr("d",Wi).style("opacity",1),aj.selectAll("."+f.area).style("opacity",0).transition().duration(O).attr("d",Xi).style("opacity",gj),p=aj.selectAll("."+f.circles).selectAll("."+f.circle).data(ke),p.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Oh),p.style("opacity",qd).transition().duration(O).style("opacity",sd).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),p.exit().remove(),aj.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(O).attrTween("d",function(a){var b,c=Fb(a);return c?(b=tf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1),aj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(O).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&ie(a.data)?1:0}),aj.select("."+f.chartArcsTitle).style("opacity",ae(uf.data.targets)?1:0),Pg&&(null!==tf.event&&"zoom"===tf.event.type&&Vi.extent(fg.orgDomain()).update(),A&&(e=bj.select("."+f.axisX).style("opacity",V?0:1),(Yg||E)&&(e=e.transition().duration(Q)),e.call(og),!Yg&&ih&&eb(e),Vi.empty()||Vi.extent(fg.orgDomain()).update(),K=Ke(U,!0),t=bj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),t.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Di(a)}).attr("class",ad),t.style("opacity",qd).transition().duration(O).attr("d",K).style("opacity",1),t.exit().transition().duration(O).style("opacity",0).remove(),bj.selectAll("."+f.line).style("opacity",qd).transition().duration(O).attr("d",Yi).style("opacity",1))),aj.selectAll("."+f.selectedCircles).filter(function(a){return ee(a)}).selectAll("circle").remove(),aj.selectAll("."+f.selectedCircle).transition().duration(O).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),u=aj.select("."+f.eventRects),te(qg)&&!pc(qg)?(u.classed(f.eventRectsMultiple)||u.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),v=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Se(v.enter()),v.attr("x",0).attr("y",0).attr("width",Mf).attr("height",Of)):(u.classed(f.eventRectsSingle)||u.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),xi&&!wi?(y=function(a,b){var c=yc(b),d=zc(b),e=uf.data.xs[a.id][b];return(fg(d?d:e+50)-fg(c?c:e-50))/2},x=function(a,b){var c=yc(b),d=uf.data.xs[a.id][b];return(fg(d)+fg(c?c:d-50))/2}):(y=L(),x=function(a){return fg(a.x)-y/2}),w=Bc(),aj.select("."+f.eventRects).datum(w?w.values:[]),v=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Re(v.enter()),v.attr("class",fd).attr("x",Yg?0:x).attr("y",Yg?x:0).attr("width",Yg?Mf:y).attr("height",Yg?y:Of),v.exit().remove()),r=aj.select("."+f.regions).selectAll("rect."+f.region).data(hi),r.enter().append("rect").style("fill-opacity",0),r.attr("class",ed).attr("x",fc).attr("y",gc).attr("width",hc).attr("height",ic).transition().duration(O).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Cc(uf.data.targets).forEach(function(a){hj[a]=!0})}}function Ye(){Xe({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ze(){return"mousemove"===tf.event.sourceEvent.type&&Zi.altDomain?(fg.domain(Zi.altDomain),void Zi.scale(fg).updateScaleExtent()):(wi&&fg.orgDomain()[0]===fj[0]&&fg.domain([fj[0]-1e-10,fg.orgDomain()[1]]),Xe({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===tf.event.sourceEvent.type&&(Ai=!0)))}function $e(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function _e(){$i.attr("width",Qf).attr("height",Rf),$i.select("#"+pi).select("rect").attr("width",Mf).attr("height",Of),$i.select("#"+qi).select("rect").attr("width",H),$i.select("#"+ri).select("rect").attr("width",J),$i.select("."+f.zoomRect).attr("width",Mf).attr("height",Of),ej.style("max-height",Rf+"px")}function af(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),_e(),m(a.withTransition),Xe(a)}function bf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=aj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Di(a)}),e=aj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("fill",function(a){return Di(a)}).style("stroke","none").style("cursor",function(a){return Gg(a)?"pointer":null}),c=aj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)}),b.append("path").attr("class",dd).style("opacity",function(){return gj=+tf.select(this).style("opacity"),0}).style("fill",function(a){return Di(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Di(a)}).style("cursor",function(a){return Gg(a)?"pointer":null}),a.forEach(function(a){aj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=aj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Yf(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Di(a.data)}).style("cursor",function(a){return Gg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Fb(a),d=Lb(c),e=Tb();Nb(c.data.id),jf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Fb(a),c=[Lb(b)];Md(c,tf.mouse(this))}).on("mouseout",function(a,b){var c=Fb(a),d=Lb(c),e=Ub();Ob(c.data.id),lf(),Nd(),e(d,b)}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Pg&&(n=bj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Di(a)}),l=bj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)})),$i.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function cf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Xd(a.id,b.types[a.id]):Xd(a.id,b.type)}),uf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Ni?j:i,l=Ni?Q():P();return d&&(w=0,C=0,t=0,u=0),Sg&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Ni?u:t,void(Xg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,Ni?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=cj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Ug?Ug(a):uf.toggle(a)}).on("mouseover",function(a){uf.focus(a),"function"==typeof Vg&&Vg(a)}).on("mouseout",function(a){uf.revert(),"function"==typeof Wg&&Wg(a)}),l.append("text").text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",Ni?g:-200).attr("y",Ni?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ni?h:-200).attr("y",Ni?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Di(a)}).attr("x",Ni?g:-200).attr("y",Ni?-200:i).attr("width",10).attr("height",10),cj.selectAll("text").data(a).text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),cj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),cj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),_e(),q&&m(p)}function pf(a){return Ec(uf.data.targets,a.id)}function qf(a){return"data"in a&&Ec(uf.data.targets,a.data.id)}function rf(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 sf(a,b,c){var d=!be(uf.data.targets);Xd(a,b),af(c?c:{withTransitionForAxis:d})}var tf=a.d3?a.d3:a.require?a.require("d3"):void 0,uf={data:{},axis:{},legend:{}},vf={},wf=h(["bindto"],"#chart"),xf=h(["size","width"]),yf=h(["size","height"]),zf=h(["padding","left"]),Af=h(["padding","right"]),Bf=h(["zoom","enabled"],!1),Cf=h(["zoom","extent"]),Df=h(["zoom","privileged"],!1),Ef=h(["onenter"],function(){}),Ff=h(["onleave"],function(){}),Gf=h(["onresize"],function(){}),Hf=h(["onresized"],function(){}),If=h(["transition","duration"],350);g("data","data is required in config");var Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg=h(["data","x"]),qg=h(["data","xs"],{}),rg=h(["data","x_format"]),sg=h(["data","id_converter"],function(a){return a}),tg=h(["data","names"],{}),ug=h(["data","classes"],{}),vg=h(["data","groups"],[]),wg=h(["data","axes"],{}),xg=h(["data","type"]),yg=h(["data","types"],{}),zg=h(["data","labels"],{}),Ag=h(["data","order"]),Bg=h(["data","regions"],{}),Cg=h(["data","color"]),Dg=h(["data","colors"],{}),Eg=h(["data","selection","enabled"],!1),Fg=h(["data","selection","grouped"],!1),Gg=h(["data","selection","isselectable"],function(){return!0}),Hg=h(["data","selection","multiple"],!0),Ig=h(["data","onclick"],function(){}),Jg=h(["data","onenter"],function(){}),Kg=h(["data","onleave"],function(){}),Lg=h(["data","onselected"],function(){}),Mg=h(["data","onunselected"],function(){}),Ng=h(["data","ondragstart"],function(){}),Og=h(["data","ondragend"],function(){}),Pg=h(["subchart","show"],!1),Qg=h(["subchart","size","height"],60),Rg=h(["color","pattern"],[]),Sg=h(["legend","show"],!0),Tg=h(["legend","position"],"bottom"),Ug=h(["legend","item","onclick"]),Vg=h(["legend","item","onmouseover"]),Wg=h(["legend","item","onmouseout"]),Xg=h(["legend","equally"],!1),Yg=h(["axis","rotated"],!1),Zg=h(["axis","x","show"],!0),$g=h(["axis","x","type"],"indexed"),_g=h(["axis","x","localtime"],!0),ah=h(["axis","x","categories"],[]),bh=h(["axis","x","tick","centered"],!1),ch=h(["axis","x","tick","format"]),dh=h(["axis","x","tick","culling"],{}),eh=h(["axis","x","tick","culling","max"],10),fh=h(["axis","x","tick","count"]),gh=h(["axis","x","tick","fit"],!0),hh=h(["axis","x","tick","values"],null),ih=h(["axis","x","tick","rotate"]),jh=h(["axis","x","max"],null),kh=h(["axis","x","min"],null),lh=h(["axis","x","padding"],{}),mh=h(["axis","x","height"]),nh=h(["axis","x","default"]),oh=h(["axis","x","label"],{}),ph=h(["axis","y","show"],!0),qh=h(["axis","y","max"]),rh=h(["axis","y","min"]),sh=h(["axis","y","center"]),th=h(["axis","y","label"],{}),uh=h(["axis","y","inner"],!1),vh=h(["axis","y","tick","format"]),wh=h(["axis","y","padding"],{}),xh=h(["axis","y","ticks"],10),yh=h(["axis","y2","show"],!1),zh=h(["axis","y2","max"]),Ah=h(["axis","y2","min"]),Bh=h(["axis","y2","center"]),Ch=h(["axis","y2","label"],{}),Dh=h(["axis","y2","inner"],!1),Eh=h(["axis","y2","tick","format"]),Fh=h(["axis","y2","padding"],{}),Gh=h(["axis","y2","ticks"],10),Hh=h(["grid","x","show"],!1),Ih=h(["grid","x","type"],"tick"),Jh=h(["grid","x","lines"],[]),Kh=h(["grid","y","show"],!1),Lh=h(["grid","y","lines"],[]),Mh=h(["grid","y","ticks"],10),Nh=h(["point","show"],!0),Oh=Nh?h(["point","r"],2.5):0,Ph=h(["point","focus","line","enabled"],!0),Qh=h(["point","focus","expand","enabled"],!0),Rh=h(["point","focus","expand","r"],Qh?4:Oh),Sh=h(["point","focus","select","r"],8),Th=h(["line","connect_null"],!1),Uh=h(["bar","width"]),Vh=h(["bar","width","ratio"],.6),Wh=h(["pie","label","show"],!0),Xh=h(["pie","label","format"]),Yh=h(["pie","expand"],!0),Zh=h(["pie","onclick"],function(){}),$h=h(["pie","onmouseover"],function(){}),_h=h(["pie","onmouseout"],function(){}),ai=h(["donut","label","show"],!0),bi=h(["donut","label","format"]),ci=h(["donut","expand"],!0),di=h(["donut","title"],""),ei=h(["donut","onclick"],function(){}),fi=h(["donut","onmouseover"],function(){}),gi=h(["donut","onmouseout"],function(){}),hi=h(["regions"],[]),ii=h(["tooltip","show"],!0),ji=h(["tooltip","format","title"]),ki=h(["tooltip","format","value"]),li=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ji?ji:b,l=ki?ki: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+""}),mi=h(["tooltip","init","show"],!1),ni=h(["tooltip","init","x"],0),oi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),pi=("string"==typeof wf?wf.replace("#",""):wf.id)+"-clip",qi=pi+"-xaxis",ri=pi+"-yaxis",si=i(pi),ti=i(qi),ui=i(ri),vi="timeseries"===$g,wi="categorized"===$g,xi=!vi&&(pg||te(qg)),yi=null,zi=!1,Ai=!1,Bi=!1,Ci=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Di=ne(Dg,te(Rg)?Rg:Ci,Cg),Ei=_g?tf.time.format:tf.time.format.utc,Fi=function(){var a=[[Ei("%Y/%-m/%-d"),function(){return!0}],[Ei("%-m/%-d"),function(a){return a.getMonth()}],[Ei("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ei("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ei("%I %p"),function(a){return a.getHours()}],[Ei("%I:%M"),function(a){return a.getMinutes()}],[Ei(":%S"),function(a){return a.getSeconds()}],[Ei(".%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)}}(),Gi=[],Hi=[],Ii=Yg?"left":"bottom",Ji=Yg?uh?"top":"bottom":uh?"right":"left",Ki=Yg?Dh?"bottom":"top":Dh?"left":"right",Li=Yg?"left":"bottom",Mi={main:function(){return"translate("+Jf.left+","+Jf.top+")"},context:function(){return"translate("+Kf.left+","+Kf.top+")"},legend:function(){return"translate("+Lf.left+","+Lf.top+")"},x:function(){return"translate(0,"+(Yg?0:Of)+")"},y:function(){return"translate(0,"+(Yg?Of:0)+")"},y2:function(){return"translate("+(Yg?0:Mf)+","+(Yg?1:0)+")"},subx:function(){return"translate(0,"+(Yg?0:Pf)+")"},arc:function(){return"translate("+Mf/2+","+Of/2+")"}},Ni="right"===Tg,Oi=0,Pi=0,Qi=0,Ri=.15,Si=30,Ti=Yg&&!Zg?0:30,Ui=5;Yf=tf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Vi,Wi=function(){var a=tf.svg.line().x(Yg?function(a){return V(a.id)(a.value)}:zd).y(Yg?zd:function(a){return V(a.id)(a.value)});return Th||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Th?De(b.values):b.values;return ce(b)?(a.interpolate(de(b)?"cardinal":"linear"),Bg[b.id]?Pe(e,fg,V(b.id),Bg[b.id]):a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Xi=function(){var a;return a=Yg?tf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(zd):tf.svg.area().x(zd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=De(b.values);return Yd([b],"area")||Yd([b],"area-spline")?(a.interpolate(de(b)?"cardinal":"linear"),a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Yi=function(){var a=tf.svg.line().x(Yg?function(a){return W(a.id)(a.value)}:Cd).y(Yg?Cd:function(a){return W(a.id)(a.value)});return function(b){var c=De(b.values);return ce(b)?a(c):"M "+ig(c[0].x)+" "+W(b.id)(c[0].value)}}(),Zi=function(){};Vi=tf.svg.brush().on("brush",Ye),Vi.update=function(){return bj&&bj.select("."+f.brush).call(this),this},Vi.scale=function(a){return Yg?this.y(a):this.x(a)},Bf&&(Zi=tf.behavior.zoom().on("zoomstart",function(){Zi.altDomain=tf.event.sourceEvent.altKey?fg.orgDomain():null}).on("zoom",Bf?Ze:null),Zi.scale=function(a){return Yg?this.y(a):this.x(a)},Zi.orgScaleExtent=function(){var a=Cf?Cf:[1,10];return[a[0],Math.max(Ac()/a[1],a[1])]},Zi.updateScaleExtent=function(){var a=bc(fg.orgDomain())/bc(fj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var $i,_i,aj,bj,cj,dj,ej,fj,gj,hj={};if(uf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),uf.defocus(),b(d.classed(f.focused,!0)),b(e),be(uf.data.targets)&&Nb(a,!0),jf(a)},uf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),kf(a)},uf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),lf()},uf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),$i.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?mf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},uf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),$i.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?nf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Ri),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},uf.toggle=function(a){Gc(a)?uf.hide(a):uf.show(a)},uf.unzoom=function(){Vi.clear().update(),Xe({withUpdateXDomain:!0})},uf.load=function(a){return a.xs&&oc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){ug[b]=a.classes[b]}),"categories"in a&&wi&&(ah=a.categories,lg.categories(ah)),"cacheIds"in a&&cc(a.cacheIds)?void cf(ec(a.cacheIds),a.done):void("unload"in a?ef(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){df(a)}):df(a))},uf.unload=function(a){ef(Dc(a),function(){Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},uf.selected=function(a){return tf.merge(aj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return tf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},uf.select=function(a,b,c){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=tf.select(this),i="circle"===this.nodeName?xe:Ae,j="circle"===this.nodeName?ye:Be,k=Fg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Gg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},uf.unselect=function(a,b){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=tf.select(this),g="circle"===this.nodeName?ye:Be,h=Fg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Gg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},uf.toLine=function(a){sf(a,"line")},uf.toSpline=function(a){sf(a,"spline")},uf.toBar=function(a){sf(a,"bar")},uf.toScatter=function(a){sf(a,"scatter")},uf.toArea=function(a){sf(a,"area")},uf.toAreaSpline=function(a){sf(a,"area-spline")},uf.toPie=function(a){sf(a,"pie",{withTransform:!0})},uf.toDonut=function(a){sf(a,"donut",{withTransform:!0})},uf.groups=function(a){return c(a)?vg:(vg=a,Xe(),vg)},uf.xgrids=function(a){return a?(Jh=a,Xe(),Jh):Jh},uf.xgrids.add=function(a){return a?uf.xgrids(Jh.concat(a)):void 0},uf.xgrids.remove=function(a){var b=rf(a);return uf.xgrids(Jh.filter(b))},uf.ygrids=function(a){return a?(Lh=a,Xe(),Lh):Lh},uf.ygrids.add=function(a){return a?uf.ygrids(Lh.concat(a)):void 0 -},uf.ygrids.remove=function(a){var b=rf(a);return uf.ygrids(Lh.filter(b))},uf.regions=function(a){return c(a)?hi:(hi=a,Xe(),hi)},uf.regions.add=function(a){return c(a)?hi:(hi=hi.concat(a),Xe(),hi)},uf.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;$i.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),hi=hi.filter(function(b){return b.classes.indexOf(a)<0})}),hi},uf.data.get=function(a){var b=uf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},uf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},uf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){tg[b]=a[b]}),of(Cc(uf.data.targets),{withTransition:!0}),tg):tg},uf.x=function(a){return arguments.length&&(rc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.xs=function(a){return arguments.length&&(sc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},uf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(qh=+a.y),b(a.y2)&&(zh=+a.y2)):qh=zh=+a,Xe())},uf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(rh=+a.y),b(a.y2)&&(Ah=+a.y2)):rh=Ah=+a,Xe())},uf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&uf.axis.max(a.max),"undefined"!=typeof a.min&&uf.axis.min(a.min))},uf.legend.show=function(a){Sg||(Sg=!0,cj.style("visibility","visible")),mf(Dc(a)),Xe({withTransitionForHorizontalAxis:!1})},uf.legend.hide=function(a){Sg&&se(a)&&(Sg=!1,cj.style("visibility","hidden")),nf(Dc(a)),Xe({withTransitionForHorizontalAxis:!1})},uf.resize=function(a){xf=a?a.width:null,yf=a?a.height:null,af({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},uf.destroy=function(){uf.data.targets=void 0,uf.data.xs={},ej.html(""),a.onresize=null},"url"in e.data)tf.xhr(e.data.url,function(a,b){var c,d=tf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=tf.csv.parse(b.response),Qe(c)});else if("rows"in e.data)Qe(uc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Qe(vc(e.data.columns))}return uf},"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.32"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cMf&&(Mf=0),0>Of&&(Of=0),Nf=Yg?Jf.left-Si-Ti:Mf,Pf=Yg?Of:Rf-Kf.top-Kf.bottom,0>Nf&&(Nf=0),0>Pf&&(Pf=0),p(),Ni&&be(uf.data.targets)&&(Lf.left=Mf/2+Tf)}function o(){aj.select("line."+f.xgridFocus).attr("x1",Yg?0:-10).attr("x2",Yg?Mf:-10).attr("y1",Yg?-10:Jf.top).attr("y2",Yg?-10:Of)}function p(){Tf=Of/2,Sf=.95*Tf,Uf=ae(uf.data.targets)?.6*Sf:0}function q(){var a=Yg?f.axisX:f.axisY,b=tf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=tf.select(wf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return xf?xf:x()}function s(){var a=yf?yf:y();return a>0?a:320}function t(){return be(uf.data.targets)?0:zf?zf:Yg?Zg?v("x"):1:!ph||uh?1:v("y")}function u(){var a=1;return be(uf.data.targets)?0:Af?Af:Ni?P()+(yh&&!Yg?v("y2"):a):yh?Dh||Yg?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||Zg?"x"===a&&mh?mh:"y"!==a||ph?"y2"!==a||yh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Ui:Sg&&!Ni?10:1:0}function x(){return+tf.select(wf).style("width").replace("px","")}function y(){return+tf.select(wf).style("height").replace("px","")}function z(a){return a?-5:-(Jf.left-1)}function A(a){return a?-20:-4}function B(){return z(!Yg)}function C(){return A(!Yg)}function D(){return z(Yg)}function E(){return A(Yg)}function F(a){return a?Mf+2+4:Jf.left+20}function G(a){return a?(mh?mh:0)+80:Of+8}function H(){return F(!Yg)}function I(){return G(!Yg)}function J(){return F(Yg)}function K(){return G(Yg)}function L(){var a=Yg?Of:Mf,b=Ac(),c=Yb()*(Zd(uf.data.targets)?(b-(wi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){Oi=a}function N(a){Pi=a}function O(a){Qi=a}function P(){return Sg?Ni?Pi*(Oi+1):Qf:0}function Q(){return Sg?Ni?Rf:Qi*(Oi+1):0}function R(){var a,b=!fg;Zf=Yg?1:0,$f=Yg?Of:Mf,_f=Yg?0:Of,ag=Yg?Mf:1,bg=Zf,cg=$f,dg=Yg?0:Pf,eg=Yg?Nf:1,fg=T(Zf,$f,b?void 0:fg.domain(),function(){return lg.tickOffset()}),gg=U(_f,ag,b?void 0:gg.domain()),hg=U(_f,ag,b?void 0:hg.domain()),ig=T(Zf,$f,fj,function(a){return a%1?0:og.tickOffset()}),jg=U(dg,eg,b?void 0:jg.domain()),kg=U(dg,eg,b?void 0:kg.domain()),a=$(),lg=X(fg,Ii,a),og=X(ig,Li,a),mg=Y(gg,Ji,vh,xh),ng=Y(hg,Ki,Eh,Gh),b||(Vi.scale(ig),Bf&&Zi.scale(fg)),S()}function S(){Vf=Gb(),Wf=Hb(),Xf=Hb(.98)}function T(a,b,d,e){var f=(vi?tf.time.scale():tf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),wi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=tf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?hg:gg}function W(a){return"y2"===Z(a)?kg:jg}function X(a,b,c){var d=(wi?Eb():tf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),wi?(d.tickCentered(bh),se(dh)&&(dh=!1)):d.tickOffset=function(){var a=Yg?Of:Mf;return a*Yb()/Ac()/2},wi&&d.categories(ah),d}function Y(a,b,c,d){return tf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in wg?wg[a]:"y"}function $(){var a=vi?Fi:wi?Tc:function(a){return 0>a?a.toFixed(0):a};return ch&&("function"==typeof ch?a=ch:vi&&(a=function(a){return a?Ei(ch)(a):""})),a}function _(a){var b;return"y"===a?b=th:"y2"===a?b=Ch:"x"===a&&(b=oh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?th=b:"y2"===a?Ch=b:"x"===a&&(oh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a){a.selectAll(".tick text").attr("y",db(ih)).attr("x",cb(ih)).attr("transform","rotate("+ih+")").style("text-anchor","start")}function fb(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 gb(){return fb("x",Yg?"inner-top":"inner-right")}function hb(){return fb("y",Yg?"inner-right":"inner-top")}function ib(){return fb("y2",Yg?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Mf/2:Mf:b.isBottom?-Of:b.isMiddle?-Of/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!Yg,gb())}function rb(){return nb(Yg,hb())}function sb(){return nb(Yg,ib())}function tb(){return ob(!Yg,gb())}function ub(){return ob(Yg,hb())}function vb(){return ob(Yg,ib())}function wb(){var a=gb();return Yg?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":mh?mh-10:"3em"}function xb(){var a=hb();return Yg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return Yg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!Yg,gb())}function Ab(){return pb(Yg,hb())}function Bb(){return pb(Yg,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return tf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?30:b}function Db(){aj.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),aj.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),aj.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+o)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Rc(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 tf.min(Object.keys(i).map(function(a){return tf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(vg.length>0)for(g=Sc(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 tf.max(Object.keys(i).map(function(a){return tf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Ah:rh,n="y2"===c?zh:qh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Bh:sh,r=ud()&&Yg;return 0===l.length?"y2"===c?hg.domain():gg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=bc(gg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&wh&&(f=b(wh.top)?wh.top:e,g=b(wh.bottom)?wh.bottom:e),"y2"===c&&Fh&&(f=b(Fh.top)?Fh.top:e,g=b(Fh.bottom)?Fh.bottom:e),Zd(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){var b=bc(fj),c=bc(fg.domain());return a||0===c?1:b/c}function Zb(a){return kh?vi?oe(kh):kh:tf.min(a,function(a){return tf.min(a.values,function(a){return a.x})})}function $b(a){return jh?vi?oe(jh):jh:tf.max(a,function(a){return tf.max(a.values,function(a){return a.x})})}function _b(a,c){var d,e,f,g,h=c[0],i=c[1],j=Math.abs(h-i);return wi?e=0:Zd(a)?(d=Ac(),e=d>1?j/(d-1)/2:.5):e=.01*j,"object"==typeof lh&&te(lh)?(f=b(lh.left)?lh.left:e,g=b(lh.right)?lh.right:e):f=g="number"==typeof lh?lh:e,{left:f,right:g}}function ac(a){var b=[Zb(a),$b(a)],c=b[0],d=b[1],e=_b(a,b),f=0,g=0;return(c||0===c)&&(f=vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function bc(a){return a[1]-a[0]}function cc(a){for(var b=0;bb?0:b-c}function ic(a){var b,c=gc(a),d="y"===a.axis?gg:hg;return b="y"===a.axis||"y2"===a.axis?Yg?Of:"start"in a?d(a.start):Of:Yg?"end"in a?fg(vi?oe(a.end):a.end):Of:Of,c>b?0:b-c}function jc(a){return pg&&a===pg||te(qg)&&ue(qg,a)}function kc(a){return!jc(a)}function lc(a){return pg?pg:te(qg)?qg[a]:null}function mc(a,b){var c,d=b&&te(b)?Cc(b):[];return d.forEach(function(b){lc(b)===a&&(c=uf.data.xs[b])}),c}function nc(a,b){return a in uf.data.xs&&uf.data.xs[a]&&uf.data.xs[a][b]?uf.data.xs[a][b]:b}function oc(a){Object.keys(a).forEach(function(b){qg[b]=a[b]})}function pc(a){return 1===tf.set(Object.keys(a).map(function(b){return a[b]})).size()}function qc(a){var b;return a&&(b=tg[a.id],a.name=b?b:a.id),a}function rc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=tc(b[d],a.id,d)}),uf.data.xs[a.id]=b})}function sc(a,b){a.forEach(function(a){b[a.id]&&rc([a],b[a.id])})}function tc(a,b,c){var d;return d=vi?a?a instanceof Date?a:oe(a):oe(nc(b,c)):xi&&!wi?a?+a:nc(b,c):c}function uc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?uf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):pg?(d=Object.keys(uf.data.xs),uf.data.xs[c]=d.length>0?uf.data.xs[d[0]]:void 0):te(qg)&&(uf.data.xs[c]=mc(f,uf.data.targets)):uf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!uf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=sg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=lc(b),g=a[f],h=tc(g,b,e);return xi&&wi&&0===c&&g&&(0===e&&(ah=[]),ah.push(g)),("undefined"==typeof a[b]||uf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),xg&&Xd(Cc(c).filter(function(a){return!(a in yg)}),xg),c.forEach(function(a){dc(a.id_org,a)}),c}function xc(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 yc(a){return a>0&&uf.data.targets[0].values[a-1]?uf.data.targets[0].values[a-1].x:void 0}function zc(a){return a1?uf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?uf.data.targets[0]:null,a}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(uf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(vi?new Date(h):h);i.push(d)}return vi||(i=i.sort(function(a,b){return a-b})),i}function Lc(a){Gi=Gi.concat(a)}function Mc(a){Gi=Gi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Hi=Hi.concat(a)}function Oc(a){Hi=Hi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Dd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Dd(a,g))),Gd(e,b)):Ed(a,b,f,g)}function Fd(a,b){var c;return c=a.map(function(a){return Ed(a.values,b)}),Gd(c,b)}function Gd(a,b){var c,d;return a.forEach(function(a){var e=ve(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Hd(a,b){return tf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Id(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 Jd(){return Ag&&"desc"===Ag.toLowerCase()}function Kd(){return Ag&&"asc"===Ag.toLowerCase()}function Ld(a){var b=Kd(),c=Jd();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 Ag&&a.sort(Ag),a}function Md(a,c){var d,e,f,g,h,i,j,k=be(uf.data.targets),l=k?xd:wd,m=a.filter(function(a){return a&&b(a.value)});ii&&0!==m.length&&(dj.html(li(a,$(),l,Di)).style("display","block"),d=dj.property("offsetWidth"),e=dj.property("offsetHeight"),k?(g=Mf/2+c[0],i=Of/2+c[1]+20):(Yg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=fg(m[0].x)+20):(f=q(),g=f+t()+fg(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),dj.style("top",i+"px").style("left",g+"px"))}function Nd(){dj.style("display","none")}function Od(a){var c=a.filter(function(a){return a&&b(a.value)});ii&&($d(uf.data.targets)||be(uf.data.targets)||aj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Yg?"y1":"x1",zd).attr(Yg?"y2":"x2",zd))}function Pd(){aj.select("line."+f.xgridFocus).style("visibility","hidden")}function Qd(a){return a.x||0===a.x?fg(a.x):null}function Rd(a){return V(a.id)(a.value)}function Sd(){var a,b,d={},e=0;return Ic(Fc(ee)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Wd(a,b){return Uh?Uh:b?2*a.tickOffset()*Vh/b:0}function Xd(a,b){Dc(a).forEach(function(a){hj[a]=b===yg[a],yg[a]=b})}function Yd(a,b){var c=!1;return a.forEach(function(a){yg[a.id]===b&&(c=!0),a.id in yg||"line"!==b||(c=!0)}),c}function Zd(a){return Yd(a,"bar")}function $d(a){return Yd(a,"scatter")}function _d(a){return Yd(a,"pie")}function ae(a){return Yd(a,"donut")}function be(a){return _d(a)||ae(a)}function ce(a){var b="string"==typeof a?a:a.id;return!(b in yg)||"line"===yg[b]||"spline"===yg[b]||"area"===yg[b]||"area-spline"===yg[b]}function de(a){var b="string"==typeof a?a:a.id;return"spline"===yg[b]||"area-spline"===yg[b]}function ee(a){var b="string"==typeof a?a:a.id;return"bar"===yg[b]}function fe(a){var b="string"==typeof a?a:a.id;return"scatter"===yg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"pie"===yg[b]}function he(a){var b="string"==typeof a?a:a.id;return"donut"===yg[b]}function ie(a){return ge(a)||he(a)}function je(a){return ee(a)?a.values:[]}function ke(a){return ce(a)||fe(a)?a.values:[]}function le(a){return ee(a)||ce(a)?a.values:[]}function me(a){return he(a)&&ci||ge(a)&&Yh}function ne(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function oe(b){var c;try{c=rg?tf.time.format(rg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+rg)}return c}function pe(a,b){var c=tf.mouse(a),d=tf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function ue(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ve(a,b){var c="y"===Z(a.id)?gg:hg,d=Yg?1:0,e=Yg?0:1;return Math.pow(fg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function we(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function xe(a,b,c){Lg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd).attr("stroke",function(){return Di(b)}).attr("r",1.4*Sh).transition().duration(100).attr("r",Sh)}function ye(a,b,c){Mg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ze(a,b,c,d){a?xe(b,c,d):ye(b,c,d)}function Ae(a,b){Lg(b,a.node()),a.transition().duration(100).style("fill",function(){return tf.rgb(Di(b)).darker(1)})}function Be(a,b){Mg(b,a.node()),a.transition().duration(100).style("fill",function(){return Di(b)})}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a){return a.filter(function(a){return b(a.value)})}function Ee(a,c){return(c?aj.selectAll("."+f.circles+ld(c)):aj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Fe(a,b){Ee(a,b).classed(f.EXPANDED,!0).attr("r",Rh)}function Ge(a){Ee(a).filter(function(){return tf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oh)}function He(a){return aj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ie(a){He(a).classed(f.EXPANDED,!0)}function Je(a){He(a).classed(f.EXPANDED,!1)}function Ke(a,b){var c=Oe(a,b);return function(a,b){var d=c(a,b),e=Yg?1:0,f=Yg?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 Le(a,b){var c=Oe(a,!1),d=b?Me:Ne;return function(a,b){return d(c(a,b),a,this)}}function Me(a,b){var c;return Yg?(c=ee(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ne(a,b,c){var d=c.getBoundingClientRect();return Yg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ee(b)?-3:-6)}function Oe(a,b){var c=a.__max__+1,d=Wd(lg,c),e=Td(d,c,a,!!b),f=Ud(!!b),g=Vd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Yg&&(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 Pe(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 Qe(b){var c,d,e;if(ej=tf.select(wf),ej.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ej.html(""),ej.classed("c3",!0),uf.data.xs={},uf.data.targets=wc(b),n(),R(),fg.domain(tf.extent(ac(uf.data.targets))),gg.domain(Xb(uf.data.targets,"y")),hg.domain(Xb(uf.data.targets,"y2")),ig.domain(fg.domain()),jg.domain(gg.domain()),kg.domain(hg.domain()),fj=fg.domain(),Vi.scale(ig),Bf&&Zi.scale(fg),$i=ej.append("svg").attr("width",Mf+Jf.left+Jf.right).attr("height",Of+Jf.top+Jf.bottom).on("mouseenter",Ef).on("mouseleave",Ff),_i=$i.append("defs"),_i.append("clipPath").attr("id",pi).append("rect").attr("width",Mf).attr("height",Of),_i.append("clipPath").attr("id",qi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),_i.append("clipPath").attr("id",ri).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),aj=$i.append("g").attr("transform",Mi.main),bj=Pg?$i.append("g").attr("transform",Mi.context):null,cj=$i.append("g").attr("transform",Mi.legend),Sg||(cj.style("visibility","hidden"),Hi=Cc(uf.data.targets)),dj=tf.select(wf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),of(Cc(uf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Zg&&aj.append("g").attr("class",f.axisX).attr("clip-path",ti).attr("transform",Mi.x).append("text").attr("class",f.axisXLabel).attr("transform",Yg?"rotate(-90)":"").style("text-anchor",zb),ph&&aj.append("g").attr("class",f.axisY).attr("clip-path",ui).attr("transform",Mi.y).append("text").attr("class",f.axisYLabel).attr("transform",Yg?"":"rotate(-90)").style("text-anchor",Ab),yh&&aj.append("g").attr("class",f.axisY2).attr("transform",Mi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Yg?"":"rotate(-90)").style("text-anchor",Bb),d=aj.append("g").attr("clip-path",si).attr("class",f.grid),Hh&&d.append("g").attr("class",f.xgrids),te(Jh)&&d.append("g").attr("class",f.xgridLines),Ph&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Kh&&d.append("g").attr("class",f.ygrids),te(Lh)&&d.append("g").attr("class",f.ygridLines),aj.append("g").attr("clip-path",si).attr("class",f.regions),aj.append("g").attr("clip-path",si).attr("class",f.chart),c=aj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Bf?Yg?"ns-resize":"ew-resize":null),aj.select("."+f.chart).append("g").attr("class",f.chartBars),aj.select("."+f.chart).append("g").attr("class",f.chartLines),aj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Mi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),aj.select("."+f.chart).append("g").attr("class",f.chartTexts),Bf&&aj.insert("rect",Df?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Mf).attr("height",Of).style("opacity",0).style("cursor",Yg?"ns-resize":"ew-resize").call(Zi).on("dblclick.zoom",null),nh&&Vi.extent("function"!=typeof nh?nh:nh(ac())),Pg&&(bj.append("g").attr("clip-path",si).attr("class",f.chart),bj.select("."+f.chart).append("g").attr("class",f.chartBars),bj.select("."+f.chart).append("g").attr("class",f.chartLines),bj.append("g").attr("clip-path",si).attr("class",f.brush).call(Vi).selectAll("rect").attr(Yg?"width":"height",Yg?Nf:Pf),bj.append("g").attr("class",f.axisX).attr("transform",Mi.subx).attr("clip-path",Yg?"":ti)),bf(uf.data.targets),Yg?aj.select("."+f.axisX).style("opacity",0).call(lg):(aj.select("."+f.axisY).style("opacity",0).call(mg),aj.select("."+f.axisY2).style("opacity",0).call(ng)),n(),R(),_e(),m(),Xe({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),mi){if(vi&&"string"==typeof ni){for(ni=oe(ni),e=0;e0){d=[];for(var g in tg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Id(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ce,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 Ve(a){be(uf.data.targets)||Eg&&(yi=a,aj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),zi=!0,Ng())}function We(){be(uf.data.targets)||Eg&&(aj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),aj.selectAll("."+f.shape).classed(f.INCLUDED,!1),zi=!1,Og())}function Xe(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U=Sd(),V=be(uf.data.targets),W=Ic(uf.data.targets);if(0!==W.length){if(a=d(a)?a:{},z=d(a.withY)?a.withY:!0,A=d(a.withSubchart)?a.withSubchart:!0,B=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,C=d(a.withTransitionForExit)?a.withTransitionForExit:B,D=d(a.withTransitionForAxis)?a.withTransitionForAxis:B,E=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:B,O=B?If:0,P=C?O:0,Q=D?O:0,I&&Sg&&of(Cc(uf.data.targets),a),H&&(fg.domain(tf.extent(ac(W))),fj=fg.domain(),Bf&&Zi.scale(fg).updateScaleExtent(),ig.domain(fg.domain()),Vi.scale(ig)),G&&(fg.domain(Vi.empty()?fj:Vi.extent()),Bf&&Zi.scale(fg).updateScaleExtent()),gg.domain(Xb(W,"y")),hg.domain(Xb(W,"y2")),(gh||fh)&&(R=hh?hh:Kc(Jc(W)),lg.tickValues(R),og.tickValues(R)),c=aj.select("."+f.axisX).style("opacity",V?0:1),(Yg||E)&&(c=c.transition().duration(Q)),c.call(lg),g=aj.select("."+f.axisY).style("opacity",V?0:1),(!Yg||E)&&(g=g.transition().duration(Q)),g.call(mg),aj.select("."+f.axisY2).style("opacity",V?0:1).transition().duration(Q).call(ng),G)if(dh&&R){for(S=1;S=0&&tf.select(this).style("display",b%T?"none":"block")})}else tf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!Yg&&ih&&eb(c),J=Ke(U),M=Le(U,!0),N=Le(U,!1),Db(),jg.domain(gg.domain()),kg.domain(hg.domain()),dj.style("display","none"),o(),aj.select("line."+f.xgridFocus).style("visibility","hidden"),Hh){if("year"===Ih){i=[];for(var X=ac(),Y=X[0].getFullYear(),Z=X[1].getFullYear(),$=Y;Z>=$;$++)i.push(new Date($+"-01-01 00:00:00"))}else i=fg.ticks(10);h=aj.select("."+f.xgrids).selectAll("."+f.xgrid).data(i),h.enter().append("line").attr("class",f.xgrid),h.attr("x1",Yg?0:function(a){return fg(a)-lg.tickOffset()}).attr("x2",Yg?Mf:function(a){return fg(a)-lg.tickOffset()}).attr("y1",Yg?function(a){return fg(a)-lg.tickOffset()}:Jf.top).attr("y2",Yg?function(a){return fg(a)-lg.tickOffset()}:Of).style("opacity",function(){return+tf.select(this).attr(Yg?"y1":"x1")===(Yg?Of:0)?0:1}),h.exit().remove()}te(Jh)&&(j=aj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Jh),k=j.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),k.append("line").style("opacity",0),k.append("text").attr("text-anchor","end").attr("transform",Yg?"":"rotate(-90)").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),j.select("line").transition().duration(O).attr("x1",Yg?0:Ad).attr("x2",Yg?Mf:Ad).attr("y1",Yg?Ad:Jf.top).attr("y2",Yg?Ad:Of).style("opacity",1),j.select("text").transition().duration(O).attr("x",Yg?Mf:0).attr("y",Ad).text(function(a){return a.text}).style("opacity",1),j.exit().transition().duration(O).style("opacity",0).remove()),z&&Kh&&(l=aj.select("."+f.ygrids).selectAll("."+f.ygrid).data(gg.ticks(Mh)),l.enter().append("line").attr("class",f.ygrid),l.attr("x1",Yg?gg:0).attr("x2",Yg?gg:Mf).attr("y1",Yg?0:gg).attr("y2",Yg?Of:gg),l.exit().remove()),z&&te(Lh)&&(m=aj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Lh),n=m.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),n.append("line").style("opacity",0),n.append("text").attr("text-anchor","end").attr("transform",Yg?"rotate(-90)":"").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),m.select("line").transition().duration(O).attr("x1",Yg?Bd:0).attr("x2",Yg?Bd:Mf).attr("y1",Yg?0:Bd).attr("y2",Yg?Of:Bd).style("opacity",1),m.select("text").transition().duration(O).attr("x",Yg?0:Mf).attr("y",Bd).text(function(a){return a.text}).style("opacity",1),m.exit().transition().duration(O).style("opacity",0).remove()),q=aj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),q.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Di(a)}).attr("class",ad),q.style("opacity",qd).transition().duration(O).attr("d",J).style("opacity",1),q.exit().transition().duration(P).style("opacity",0).remove(),s=aj.selectAll("."+f.texts).selectAll("."+f.text).data(le),s.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return Yg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),s.text(function(a){return yd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(O).attr("x",M).attr("y",N).style("fill-opacity",td),s.exit().transition().duration(P).style("fill-opacity",0).remove(),aj.selectAll("."+f.line).style("opacity",qd).transition().duration(O).attr("d",Wi).style("opacity",1),aj.selectAll("."+f.area).style("opacity",0).transition().duration(O).attr("d",Xi).style("opacity",gj),p=aj.selectAll("."+f.circles).selectAll("."+f.circle).data(ke),p.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Oh),p.style("opacity",qd).transition().duration(O).style("opacity",sd).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),p.exit().remove(),aj.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(O).attrTween("d",function(a){var b,c=Fb(a);return c?(b=tf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1),aj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(O).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&ie(a.data)?1:0}),aj.select("."+f.chartArcsTitle).style("opacity",ae(uf.data.targets)?1:0),Pg&&(null!==tf.event&&"zoom"===tf.event.type&&Vi.extent(fg.orgDomain()).update(),A&&(e=bj.select("."+f.axisX).style("opacity",V?0:1),(Yg||E)&&(e=e.transition().duration(Q)),e.call(og),!Yg&&ih&&eb(e),Vi.empty()||Vi.extent(fg.orgDomain()).update(),K=Ke(U,!0),t=bj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),t.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Di(a)}).attr("class",ad),t.style("opacity",qd).transition().duration(O).attr("d",K).style("opacity",1),t.exit().transition().duration(O).style("opacity",0).remove(),bj.selectAll("."+f.line).style("opacity",qd).transition().duration(O).attr("d",Yi).style("opacity",1))),aj.selectAll("."+f.selectedCircles).filter(function(a){return ee(a)}).selectAll("circle").remove(),aj.selectAll("."+f.selectedCircle).transition().duration(O).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),u=aj.select("."+f.eventRects),te(qg)&&!pc(qg)?(u.classed(f.eventRectsMultiple)||u.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),v=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Se(v.enter()),v.attr("x",0).attr("y",0).attr("width",Mf).attr("height",Of)):(u.classed(f.eventRectsSingle)||u.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),xi&&!wi?(y=function(a,b){var c=yc(b),d=zc(b),e=uf.data.xs[a.id][b];return(fg(d?d:e+50)-fg(c?c:e-50))/2},x=function(a,b){var c=yc(b),d=uf.data.xs[a.id][b];return(fg(d)+fg(c?c:d-50))/2}):(y=L(),x=function(a){return fg(a.x)-y/2}),w=Bc(),aj.select("."+f.eventRects).datum(w?w.values:[]),v=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Re(v.enter()),v.attr("class",fd).attr("x",Yg?0:x).attr("y",Yg?x:0).attr("width",Yg?Mf:y).attr("height",Yg?y:Of),v.exit().remove()),r=aj.select("."+f.regions).selectAll("rect."+f.region).data(hi),r.enter().append("rect").style("fill-opacity",0),r.attr("class",ed).attr("x",fc).attr("y",gc).attr("width",hc).attr("height",ic).transition().duration(O).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Cc(uf.data.targets).forEach(function(a){hj[a]=!0})}}function Ye(){Xe({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ze(){return"mousemove"===tf.event.sourceEvent.type&&Zi.altDomain?(fg.domain(Zi.altDomain),void Zi.scale(fg).updateScaleExtent()):(wi&&fg.orgDomain()[0]===fj[0]&&fg.domain([fj[0]-1e-10,fg.orgDomain()[1]]),Xe({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===tf.event.sourceEvent.type&&(Ai=!0)))}function $e(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function _e(){$i.attr("width",Qf).attr("height",Rf),$i.select("#"+pi).select("rect").attr("width",Mf).attr("height",Of),$i.select("#"+qi).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),$i.select("#"+ri).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),$i.select("."+f.zoomRect).attr("width",Mf).attr("height",Of),ej.style("max-height",Rf+"px")}function af(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),_e(),m(a.withTransition),Xe(a)}function bf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=aj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Di(a)}),e=aj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("fill",function(a){return Di(a)}).style("stroke","none").style("cursor",function(a){return Gg(a)?"pointer":null}),c=aj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)}),b.append("path").attr("class",dd).style("opacity",function(){return gj=+tf.select(this).style("opacity"),0}).style("fill",function(a){return Di(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Di(a)}).style("cursor",function(a){return Gg(a)?"pointer":null}),a.forEach(function(a){aj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=aj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Yf(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Di(a.data)}).style("cursor",function(a){return Gg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Fb(a),d=Lb(c),e=Tb();Nb(c.data.id),jf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Fb(a),c=[Lb(b)];Md(c,tf.mouse(this))}).on("mouseout",function(a,b){var c=Fb(a),d=Lb(c),e=Ub();Ob(c.data.id),lf(),Nd(),e(d,b)}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Pg&&(n=bj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Di(a)}),l=bj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)})),$i.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function cf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Xd(a.id,b.types[a.id]):Xd(a.id,b.type)}),uf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Ni?j:i,l=Ni?Q():P();return d&&(w=0,C=0,t=0,u=0),Sg&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Ni?u:t,void(Xg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,Ni?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=cj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Ug?Ug(a):uf.toggle(a)}).on("mouseover",function(a){uf.focus(a),"function"==typeof Vg&&Vg(a)}).on("mouseout",function(a){uf.revert(),"function"==typeof Wg&&Wg(a)}),l.append("text").text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",Ni?g:-200).attr("y",Ni?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ni?h:-200).attr("y",Ni?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Di(a)}).attr("x",Ni?g:-200).attr("y",Ni?-200:i).attr("width",10).attr("height",10),cj.selectAll("text").data(a).text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),cj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),cj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),_e(),q&&m(p)}function pf(a){return Ec(uf.data.targets,a.id)}function qf(a){return"data"in a&&Ec(uf.data.targets,a.data.id)}function rf(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 sf(a,b,c){var d=!be(uf.data.targets);Xd(a,b),af(c?c:{withTransitionForAxis:d})}var tf=a.d3?a.d3:a.require?a.require("d3"):void 0,uf={data:{},axis:{},legend:{}},vf={},wf=h(["bindto"],"#chart"),xf=h(["size","width"]),yf=h(["size","height"]),zf=h(["padding","left"]),Af=h(["padding","right"]),Bf=h(["zoom","enabled"],!1),Cf=h(["zoom","extent"]),Df=h(["zoom","privileged"],!1),Ef=h(["onenter"],function(){}),Ff=h(["onleave"],function(){}),Gf=h(["onresize"],function(){}),Hf=h(["onresized"],function(){}),If=h(["transition","duration"],350);g("data","data is required in config");var Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg=h(["data","x"]),qg=h(["data","xs"],{}),rg=h(["data","x_format"]),sg=h(["data","id_converter"],function(a){return a}),tg=h(["data","names"],{}),ug=h(["data","classes"],{}),vg=h(["data","groups"],[]),wg=h(["data","axes"],{}),xg=h(["data","type"]),yg=h(["data","types"],{}),zg=h(["data","labels"],{}),Ag=h(["data","order"]),Bg=h(["data","regions"],{}),Cg=h(["data","color"]),Dg=h(["data","colors"],{}),Eg=h(["data","selection","enabled"],!1),Fg=h(["data","selection","grouped"],!1),Gg=h(["data","selection","isselectable"],function(){return!0}),Hg=h(["data","selection","multiple"],!0),Ig=h(["data","onclick"],function(){}),Jg=h(["data","onenter"],function(){}),Kg=h(["data","onleave"],function(){}),Lg=h(["data","onselected"],function(){}),Mg=h(["data","onunselected"],function(){}),Ng=h(["data","ondragstart"],function(){}),Og=h(["data","ondragend"],function(){}),Pg=h(["subchart","show"],!1),Qg=h(["subchart","size","height"],60),Rg=h(["color","pattern"],[]),Sg=h(["legend","show"],!0),Tg=h(["legend","position"],"bottom"),Ug=h(["legend","item","onclick"]),Vg=h(["legend","item","onmouseover"]),Wg=h(["legend","item","onmouseout"]),Xg=h(["legend","equally"],!1),Yg=h(["axis","rotated"],!1),Zg=h(["axis","x","show"],!0),$g=h(["axis","x","type"],"indexed"),_g=h(["axis","x","localtime"],!0),ah=h(["axis","x","categories"],[]),bh=h(["axis","x","tick","centered"],!1),ch=h(["axis","x","tick","format"]),dh=h(["axis","x","tick","culling"],{}),eh=h(["axis","x","tick","culling","max"],10),fh=h(["axis","x","tick","count"]),gh=h(["axis","x","tick","fit"],!0),hh=h(["axis","x","tick","values"],null),ih=h(["axis","x","tick","rotate"]),jh=h(["axis","x","max"],null),kh=h(["axis","x","min"],null),lh=h(["axis","x","padding"],{}),mh=h(["axis","x","height"]),nh=h(["axis","x","default"]),oh=h(["axis","x","label"],{}),ph=h(["axis","y","show"],!0),qh=h(["axis","y","max"]),rh=h(["axis","y","min"]),sh=h(["axis","y","center"]),th=h(["axis","y","label"],{}),uh=h(["axis","y","inner"],!1),vh=h(["axis","y","tick","format"]),wh=h(["axis","y","padding"],{}),xh=h(["axis","y","ticks"],10),yh=h(["axis","y2","show"],!1),zh=h(["axis","y2","max"]),Ah=h(["axis","y2","min"]),Bh=h(["axis","y2","center"]),Ch=h(["axis","y2","label"],{}),Dh=h(["axis","y2","inner"],!1),Eh=h(["axis","y2","tick","format"]),Fh=h(["axis","y2","padding"],{}),Gh=h(["axis","y2","ticks"],10),Hh=h(["grid","x","show"],!1),Ih=h(["grid","x","type"],"tick"),Jh=h(["grid","x","lines"],[]),Kh=h(["grid","y","show"],!1),Lh=h(["grid","y","lines"],[]),Mh=h(["grid","y","ticks"],10),Nh=h(["point","show"],!0),Oh=Nh?h(["point","r"],2.5):0,Ph=h(["point","focus","line","enabled"],!0),Qh=h(["point","focus","expand","enabled"],!0),Rh=h(["point","focus","expand","r"],Qh?4:Oh),Sh=h(["point","focus","select","r"],8),Th=h(["line","connect_null"],!1),Uh=h(["bar","width"]),Vh=h(["bar","width","ratio"],.6),Wh=h(["pie","label","show"],!0),Xh=h(["pie","label","format"]),Yh=h(["pie","expand"],!0),Zh=h(["pie","onclick"],function(){}),$h=h(["pie","onmouseover"],function(){}),_h=h(["pie","onmouseout"],function(){}),ai=h(["donut","label","show"],!0),bi=h(["donut","label","format"]),ci=h(["donut","expand"],!0),di=h(["donut","title"],""),ei=h(["donut","onclick"],function(){}),fi=h(["donut","onmouseover"],function(){}),gi=h(["donut","onmouseout"],function(){}),hi=h(["regions"],[]),ii=h(["tooltip","show"],!0),ji=h(["tooltip","format","title"]),ki=h(["tooltip","format","value"]),li=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ji?ji:b,l=ki?ki: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+""}),mi=h(["tooltip","init","show"],!1),ni=h(["tooltip","init","x"],0),oi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),pi=("string"==typeof wf?wf.replace("#",""):wf.id)+"-clip",qi=pi+"-xaxis",ri=pi+"-yaxis",si=i(pi),ti=i(qi),ui=i(ri),vi="timeseries"===$g,wi="categorized"===$g,xi=!vi&&(pg||te(qg)),yi=null,zi=!1,Ai=!1,Bi=!1,Ci=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Di=ne(Dg,te(Rg)?Rg:Ci,Cg),Ei=_g?tf.time.format:tf.time.format.utc,Fi=function(){var a=[[Ei("%Y/%-m/%-d"),function(){return!0}],[Ei("%-m/%-d"),function(a){return a.getMonth()}],[Ei("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ei("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ei("%I %p"),function(a){return a.getHours()}],[Ei("%I:%M"),function(a){return a.getMinutes()}],[Ei(":%S"),function(a){return a.getSeconds()}],[Ei(".%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)}}(),Gi=[],Hi=[],Ii=Yg?"left":"bottom",Ji=Yg?uh?"top":"bottom":uh?"right":"left",Ki=Yg?Dh?"bottom":"top":Dh?"left":"right",Li=Yg?"left":"bottom",Mi={main:function(){return"translate("+Jf.left+","+Jf.top+")"},context:function(){return"translate("+Kf.left+","+Kf.top+")"},legend:function(){return"translate("+Lf.left+","+Lf.top+")"},x:function(){return"translate(0,"+(Yg?0:Of)+")"},y:function(){return"translate(0,"+(Yg?Of:0)+")"},y2:function(){return"translate("+(Yg?0:Mf)+","+(Yg?1:0)+")"},subx:function(){return"translate(0,"+(Yg?0:Pf)+")"},arc:function(){return"translate("+Mf/2+","+Of/2+")"}},Ni="right"===Tg,Oi=0,Pi=0,Qi=0,Ri=.15,Si=30,Ti=Yg&&!Zg?0:30,Ui=5;Yf=tf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Vi,Wi=function(){var a=tf.svg.line().x(Yg?function(a){return V(a.id)(a.value)}:zd).y(Yg?zd:function(a){return V(a.id)(a.value)});return Th||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Th?De(b.values):b.values;return ce(b)?(a.interpolate(de(b)?"cardinal":"linear"),Bg[b.id]?Pe(e,fg,V(b.id),Bg[b.id]):a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Xi=function(){var a;return a=Yg?tf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(zd):tf.svg.area().x(zd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=De(b.values);return Yd([b],"area")||Yd([b],"area-spline")?(a.interpolate(de(b)?"cardinal":"linear"),a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Yi=function(){var a=tf.svg.line().x(Yg?function(a){return W(a.id)(a.value)}:Cd).y(Yg?Cd:function(a){return W(a.id)(a.value)});return function(b){var c=De(b.values);return ce(b)?a(c):"M "+ig(c[0].x)+" "+W(b.id)(c[0].value)}}(),Zi=function(){};Vi=tf.svg.brush().on("brush",Ye),Vi.update=function(){return bj&&bj.select("."+f.brush).call(this),this},Vi.scale=function(a){return Yg?this.y(a):this.x(a)},Bf&&(Zi=tf.behavior.zoom().on("zoomstart",function(){Zi.altDomain=tf.event.sourceEvent.altKey?fg.orgDomain():null}).on("zoom",Bf?Ze:null),Zi.scale=function(a){return Yg?this.y(a):this.x(a)},Zi.orgScaleExtent=function(){var a=Cf?Cf:[1,10];return[a[0],Math.max(Ac()/a[1],a[1])]},Zi.updateScaleExtent=function(){var a=bc(fg.orgDomain())/bc(fj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var $i,_i,aj,bj,cj,dj,ej,fj,gj,hj={};if(uf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),uf.defocus(),b(d.classed(f.focused,!0)),b(e),be(uf.data.targets)&&Nb(a,!0),jf(a)},uf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),kf(a)},uf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),lf()},uf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),$i.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?mf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},uf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),$i.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?nf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Ri),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},uf.toggle=function(a){Gc(a)?uf.hide(a):uf.show(a)},uf.unzoom=function(){Vi.clear().update(),Xe({withUpdateXDomain:!0})},uf.load=function(a){return a.xs&&oc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){ug[b]=a.classes[b]}),"categories"in a&&wi&&(ah=a.categories,lg.categories(ah)),"cacheIds"in a&&cc(a.cacheIds)?void cf(ec(a.cacheIds),a.done):void("unload"in a?ef(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){df(a)}):df(a))},uf.unload=function(a){ef(Dc(a),function(){Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},uf.selected=function(a){return tf.merge(aj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return tf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},uf.select=function(a,b,c){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=tf.select(this),i="circle"===this.nodeName?xe:Ae,j="circle"===this.nodeName?ye:Be,k=Fg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Gg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},uf.unselect=function(a,b){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=tf.select(this),g="circle"===this.nodeName?ye:Be,h=Fg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Gg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},uf.toLine=function(a){sf(a,"line")},uf.toSpline=function(a){sf(a,"spline")},uf.toBar=function(a){sf(a,"bar")},uf.toScatter=function(a){sf(a,"scatter")},uf.toArea=function(a){sf(a,"area")},uf.toAreaSpline=function(a){sf(a,"area-spline")},uf.toPie=function(a){sf(a,"pie",{withTransform:!0})},uf.toDonut=function(a){sf(a,"donut",{withTransform:!0})},uf.groups=function(a){return c(a)?vg:(vg=a,Xe(),vg)},uf.xgrids=function(a){return a?(Jh=a,Xe(),Jh):Jh},uf.xgrids.add=function(a){return a?uf.xgrids(Jh.concat(a)):void 0},uf.xgrids.remove=function(a){var b=rf(a);return uf.xgrids(Jh.filter(b))},uf.ygrids=function(a){return a?(Lh=a,Xe(),Lh):Lh +},uf.ygrids.add=function(a){return a?uf.ygrids(Lh.concat(a)):void 0},uf.ygrids.remove=function(a){var b=rf(a);return uf.ygrids(Lh.filter(b))},uf.regions=function(a){return c(a)?hi:(hi=a,Xe(),hi)},uf.regions.add=function(a){return c(a)?hi:(hi=hi.concat(a),Xe(),hi)},uf.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;$i.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),hi=hi.filter(function(b){return b.classes.indexOf(a)<0})}),hi},uf.data.get=function(a){var b=uf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},uf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},uf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){tg[b]=a[b]}),of(Cc(uf.data.targets),{withTransition:!0}),tg):tg},uf.x=function(a){return arguments.length&&(rc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.xs=function(a){return arguments.length&&(sc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},uf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(qh=+a.y),b(a.y2)&&(zh=+a.y2)):qh=zh=+a,Xe())},uf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(rh=+a.y),b(a.y2)&&(Ah=+a.y2)):rh=Ah=+a,Xe())},uf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&uf.axis.max(a.max),"undefined"!=typeof a.min&&uf.axis.min(a.min))},uf.legend.show=function(a){Sg||(Sg=!0,cj.style("visibility","visible")),mf(Dc(a)),Xe({withTransitionForHorizontalAxis:!1})},uf.legend.hide=function(a){Sg&&se(a)&&(Sg=!1,cj.style("visibility","hidden")),nf(Dc(a)),Xe({withTransitionForHorizontalAxis:!1})},uf.resize=function(a){xf=a?a.width:null,yf=a?a.height:null,af({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},uf.destroy=function(){uf.data.targets=void 0,uf.data.xs={},ej.html(""),a.onresize=null},"url"in e.data)tf.xhr(e.data.url,function(a,b){var c,d=tf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=tf.csv.parse(b.response),Qe(c)});else if("rows"in e.data)Qe(uc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Qe(vc(e.data.columns))}return uf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From a009c7d756d6c7132c6a0a76f2fb90823e431013 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Sat, 26 Apr 2014 20:57:03 +0900 Subject: [PATCH 065/178] Fix event rect when x max/min specified - #171 --- c3.js | 36 ++++++++++++++++++++---------------- c3.min.js | 6 +++--- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/c3.js b/c3.js index bd8a91a..ed6092d 100644 --- a/c3.js +++ b/c3.js @@ -545,9 +545,11 @@ return getAxisClipHeight(__axis_rotated); } function getEventRectWidth() { - var base = __axis_rotated ? height : width, + var target = getMaxDataCountTarget(c3.data.targets), + firstData = target.values[0], lastData = target.values[target.values.length - 1], + base = x(lastData.x) - x(firstData.x), maxDataCount = getMaxDataCount(), - ratio = getXDomainRatio() * (hasBarType(c3.data.targets) ? (maxDataCount - (isCategorized ? 0.25 : 1)) / maxDataCount : 0.98); + ratio = (hasBarType(c3.data.targets) ? (maxDataCount - (isCategorized ? 0.25 : 1)) / maxDataCount : 1); return maxDataCount > 1 ? (base * ratio) / (maxDataCount - 1) : base; } function updateLegendStep(step) { @@ -658,8 +660,8 @@ } } else { axis.tickOffset = function () { - var base = __axis_rotated ? height : width; - return ((base * getXDomainRatio()) / getMaxDataCount()) / 2; + var edgeX = getEdgeX(c3.data.targets), base = x(edgeX[1]) - x(edgeX[0]); + return (base / getMaxDataCount()) / 2; }; } @@ -1258,18 +1260,15 @@ } return [yDomainMin - padding_bottom, yDomainMax + padding_top]; } - function getXDomainRatio(isSub) { - var orgDiff = diffDomain(orgXDomain), currentDiff = diffDomain(x.domain()); - return isSub || currentDiff === 0 ? 1 : orgDiff / currentDiff; - } function getXDomainMin(targets) { return __axis_x_min ? (isTimeSeries ? parseDate(__axis_x_min) : __axis_x_min) : d3.min(targets, function (t) { return d3.min(t.values, function (v) { return v.x; }); }); } function getXDomainMax(targets) { return __axis_x_max ? (isTimeSeries ? parseDate(__axis_x_max) : __axis_x_max) : d3.max(targets, function (t) { return d3.max(t.values, function (v) { return v.x; }); }); } - function getXDomainPadding(targets, domain) { - var firstX = domain[0], lastX = domain[1], diff = Math.abs(firstX - lastX), maxDataCount, padding, paddingLeft, paddingRight; + function getXDomainPadding(targets) { + var edgeX = getEdgeX(targets), diff = edgeX[1] - edgeX[0], + maxDataCount, padding, paddingLeft, paddingRight; if (isCategorized) { padding = 0; } else if (hasBarType(targets)) { @@ -1291,7 +1290,7 @@ function getXDomain(targets) { var xDomain = [getXDomainMin(targets), getXDomainMax(targets)], firstX = xDomain[0], lastX = xDomain[1], - padding = getXDomainPadding(targets, xDomain), + padding = getXDomainPadding(targets), min = 0, max = 0; if (firstX || firstX === 0) { min = isTimeSeries ? new Date(firstX.getTime() - padding.left) : firstX - padding.left; @@ -1558,20 +1557,25 @@ function getMaxDataCount() { return d3.max(c3.data.targets, function (t) { return t.values.length; }); } - function getMaxDataCountTarget() { - var length = c3.data.targets.length, max = 0, maxTarget; + function getMaxDataCountTarget(targets) { + var length = targets.length, max = 0, maxTarget; if (length > 1) { - c3.data.targets.forEach(function (t) { + targets.forEach(function (t) { if (t.values.length > max) { maxTarget = t; max = t.values.length; } }); } else { - maxTarget = length ? c3.data.targets[0] : null; + maxTarget = length ? targets[0] : null; } return maxTarget; } + function getEdgeX(targets) { + var target = getMaxDataCountTarget(targets), + firstData = target.values[0], lastData = target.values[target.values.length - 1]; + return [firstData.x, lastData.x]; + } function mapToIds(targets) { return targets.map(function (d) { return d.id; }); } @@ -3483,7 +3487,7 @@ }; } // Set data - maxDataCountTarget = getMaxDataCountTarget(); + maxDataCountTarget = getMaxDataCountTarget(c3.data.targets); main.select('.' + CLASS.eventRects) .datum(maxDataCountTarget ? maxDataCountTarget.values : []); // Update rects diff --git a/c3.min.js b/c3.min.js index 28a7940..d88c2b5 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.32"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cMf&&(Mf=0),0>Of&&(Of=0),Nf=Yg?Jf.left-Si-Ti:Mf,Pf=Yg?Of:Rf-Kf.top-Kf.bottom,0>Nf&&(Nf=0),0>Pf&&(Pf=0),p(),Ni&&be(uf.data.targets)&&(Lf.left=Mf/2+Tf)}function o(){aj.select("line."+f.xgridFocus).attr("x1",Yg?0:-10).attr("x2",Yg?Mf:-10).attr("y1",Yg?-10:Jf.top).attr("y2",Yg?-10:Of)}function p(){Tf=Of/2,Sf=.95*Tf,Uf=ae(uf.data.targets)?.6*Sf:0}function q(){var a=Yg?f.axisX:f.axisY,b=tf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=tf.select(wf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return xf?xf:x()}function s(){var a=yf?yf:y();return a>0?a:320}function t(){return be(uf.data.targets)?0:zf?zf:Yg?Zg?v("x"):1:!ph||uh?1:v("y")}function u(){var a=1;return be(uf.data.targets)?0:Af?Af:Ni?P()+(yh&&!Yg?v("y2"):a):yh?Dh||Yg?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||Zg?"x"===a&&mh?mh:"y"!==a||ph?"y2"!==a||yh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Ui:Sg&&!Ni?10:1:0}function x(){return+tf.select(wf).style("width").replace("px","")}function y(){return+tf.select(wf).style("height").replace("px","")}function z(a){return a?-5:-(Jf.left-1)}function A(a){return a?-20:-4}function B(){return z(!Yg)}function C(){return A(!Yg)}function D(){return z(Yg)}function E(){return A(Yg)}function F(a){return a?Mf+2+4:Jf.left+20}function G(a){return a?(mh?mh:0)+80:Of+8}function H(){return F(!Yg)}function I(){return G(!Yg)}function J(){return F(Yg)}function K(){return G(Yg)}function L(){var a=Yg?Of:Mf,b=Ac(),c=Yb()*(Zd(uf.data.targets)?(b-(wi?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){Oi=a}function N(a){Pi=a}function O(a){Qi=a}function P(){return Sg?Ni?Pi*(Oi+1):Qf:0}function Q(){return Sg?Ni?Rf:Qi*(Oi+1):0}function R(){var a,b=!fg;Zf=Yg?1:0,$f=Yg?Of:Mf,_f=Yg?0:Of,ag=Yg?Mf:1,bg=Zf,cg=$f,dg=Yg?0:Pf,eg=Yg?Nf:1,fg=T(Zf,$f,b?void 0:fg.domain(),function(){return lg.tickOffset()}),gg=U(_f,ag,b?void 0:gg.domain()),hg=U(_f,ag,b?void 0:hg.domain()),ig=T(Zf,$f,fj,function(a){return a%1?0:og.tickOffset()}),jg=U(dg,eg,b?void 0:jg.domain()),kg=U(dg,eg,b?void 0:kg.domain()),a=$(),lg=X(fg,Ii,a),og=X(ig,Li,a),mg=Y(gg,Ji,vh,xh),ng=Y(hg,Ki,Eh,Gh),b||(Vi.scale(ig),Bf&&Zi.scale(fg)),S()}function S(){Vf=Gb(),Wf=Hb(),Xf=Hb(.98)}function T(a,b,d,e){var f=(vi?tf.time.scale():tf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),wi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=tf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?hg:gg}function W(a){return"y2"===Z(a)?kg:jg}function X(a,b,c){var d=(wi?Eb():tf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),wi?(d.tickCentered(bh),se(dh)&&(dh=!1)):d.tickOffset=function(){var a=Yg?Of:Mf;return a*Yb()/Ac()/2},wi&&d.categories(ah),d}function Y(a,b,c,d){return tf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in wg?wg[a]:"y"}function $(){var a=vi?Fi:wi?Tc:function(a){return 0>a?a.toFixed(0):a};return ch&&("function"==typeof ch?a=ch:vi&&(a=function(a){return a?Ei(ch)(a):""})),a}function _(a){var b;return"y"===a?b=th:"y2"===a?b=Ch:"x"===a&&(b=oh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?th=b:"y2"===a?Ch=b:"x"===a&&(oh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a){a.selectAll(".tick text").attr("y",db(ih)).attr("x",cb(ih)).attr("transform","rotate("+ih+")").style("text-anchor","start")}function fb(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 gb(){return fb("x",Yg?"inner-top":"inner-right")}function hb(){return fb("y",Yg?"inner-right":"inner-top")}function ib(){return fb("y2",Yg?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Mf/2:Mf:b.isBottom?-Of:b.isMiddle?-Of/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!Yg,gb())}function rb(){return nb(Yg,hb())}function sb(){return nb(Yg,ib())}function tb(){return ob(!Yg,gb())}function ub(){return ob(Yg,hb())}function vb(){return ob(Yg,ib())}function wb(){var a=gb();return Yg?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":mh?mh-10:"3em"}function xb(){var a=hb();return Yg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return Yg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!Yg,gb())}function Ab(){return pb(Yg,hb())}function Bb(){return pb(Yg,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return tf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?30:b}function Db(){aj.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),aj.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),aj.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+o)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Rc(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 tf.min(Object.keys(i).map(function(a){return tf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(vg.length>0)for(g=Sc(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 tf.max(Object.keys(i).map(function(a){return tf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Ah:rh,n="y2"===c?zh:qh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Bh:sh,r=ud()&&Yg;return 0===l.length?"y2"===c?hg.domain():gg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=bc(gg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&wh&&(f=b(wh.top)?wh.top:e,g=b(wh.bottom)?wh.bottom:e),"y2"===c&&Fh&&(f=b(Fh.top)?Fh.top:e,g=b(Fh.bottom)?Fh.bottom:e),Zd(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){var b=bc(fj),c=bc(fg.domain());return a||0===c?1:b/c}function Zb(a){return kh?vi?oe(kh):kh:tf.min(a,function(a){return tf.min(a.values,function(a){return a.x})})}function $b(a){return jh?vi?oe(jh):jh:tf.max(a,function(a){return tf.max(a.values,function(a){return a.x})})}function _b(a,c){var d,e,f,g,h=c[0],i=c[1],j=Math.abs(h-i);return wi?e=0:Zd(a)?(d=Ac(),e=d>1?j/(d-1)/2:.5):e=.01*j,"object"==typeof lh&&te(lh)?(f=b(lh.left)?lh.left:e,g=b(lh.right)?lh.right:e):f=g="number"==typeof lh?lh:e,{left:f,right:g}}function ac(a){var b=[Zb(a),$b(a)],c=b[0],d=b[1],e=_b(a,b),f=0,g=0;return(c||0===c)&&(f=vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function bc(a){return a[1]-a[0]}function cc(a){for(var b=0;bb?0:b-c}function ic(a){var b,c=gc(a),d="y"===a.axis?gg:hg;return b="y"===a.axis||"y2"===a.axis?Yg?Of:"start"in a?d(a.start):Of:Yg?"end"in a?fg(vi?oe(a.end):a.end):Of:Of,c>b?0:b-c}function jc(a){return pg&&a===pg||te(qg)&&ue(qg,a)}function kc(a){return!jc(a)}function lc(a){return pg?pg:te(qg)?qg[a]:null}function mc(a,b){var c,d=b&&te(b)?Cc(b):[];return d.forEach(function(b){lc(b)===a&&(c=uf.data.xs[b])}),c}function nc(a,b){return a in uf.data.xs&&uf.data.xs[a]&&uf.data.xs[a][b]?uf.data.xs[a][b]:b}function oc(a){Object.keys(a).forEach(function(b){qg[b]=a[b]})}function pc(a){return 1===tf.set(Object.keys(a).map(function(b){return a[b]})).size()}function qc(a){var b;return a&&(b=tg[a.id],a.name=b?b:a.id),a}function rc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=tc(b[d],a.id,d)}),uf.data.xs[a.id]=b})}function sc(a,b){a.forEach(function(a){b[a.id]&&rc([a],b[a.id])})}function tc(a,b,c){var d;return d=vi?a?a instanceof Date?a:oe(a):oe(nc(b,c)):xi&&!wi?a?+a:nc(b,c):c}function uc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?uf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):pg?(d=Object.keys(uf.data.xs),uf.data.xs[c]=d.length>0?uf.data.xs[d[0]]:void 0):te(qg)&&(uf.data.xs[c]=mc(f,uf.data.targets)):uf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!uf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=sg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=lc(b),g=a[f],h=tc(g,b,e);return xi&&wi&&0===c&&g&&(0===e&&(ah=[]),ah.push(g)),("undefined"==typeof a[b]||uf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),xg&&Xd(Cc(c).filter(function(a){return!(a in yg)}),xg),c.forEach(function(a){dc(a.id_org,a)}),c}function xc(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 yc(a){return a>0&&uf.data.targets[0].values[a-1]?uf.data.targets[0].values[a-1].x:void 0}function zc(a){return a1?uf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?uf.data.targets[0]:null,a}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(uf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(vi?new Date(h):h);i.push(d)}return vi||(i=i.sort(function(a,b){return a-b})),i}function Lc(a){Gi=Gi.concat(a)}function Mc(a){Gi=Gi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Hi=Hi.concat(a)}function Oc(a){Hi=Hi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Dd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Dd(a,g))),Gd(e,b)):Ed(a,b,f,g)}function Fd(a,b){var c;return c=a.map(function(a){return Ed(a.values,b)}),Gd(c,b)}function Gd(a,b){var c,d;return a.forEach(function(a){var e=ve(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Hd(a,b){return tf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Id(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 Jd(){return Ag&&"desc"===Ag.toLowerCase()}function Kd(){return Ag&&"asc"===Ag.toLowerCase()}function Ld(a){var b=Kd(),c=Jd();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 Ag&&a.sort(Ag),a}function Md(a,c){var d,e,f,g,h,i,j,k=be(uf.data.targets),l=k?xd:wd,m=a.filter(function(a){return a&&b(a.value)});ii&&0!==m.length&&(dj.html(li(a,$(),l,Di)).style("display","block"),d=dj.property("offsetWidth"),e=dj.property("offsetHeight"),k?(g=Mf/2+c[0],i=Of/2+c[1]+20):(Yg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=fg(m[0].x)+20):(f=q(),g=f+t()+fg(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),dj.style("top",i+"px").style("left",g+"px"))}function Nd(){dj.style("display","none")}function Od(a){var c=a.filter(function(a){return a&&b(a.value)});ii&&($d(uf.data.targets)||be(uf.data.targets)||aj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Yg?"y1":"x1",zd).attr(Yg?"y2":"x2",zd))}function Pd(){aj.select("line."+f.xgridFocus).style("visibility","hidden")}function Qd(a){return a.x||0===a.x?fg(a.x):null}function Rd(a){return V(a.id)(a.value)}function Sd(){var a,b,d={},e=0;return Ic(Fc(ee)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Wd(a,b){return Uh?Uh:b?2*a.tickOffset()*Vh/b:0}function Xd(a,b){Dc(a).forEach(function(a){hj[a]=b===yg[a],yg[a]=b})}function Yd(a,b){var c=!1;return a.forEach(function(a){yg[a.id]===b&&(c=!0),a.id in yg||"line"!==b||(c=!0)}),c}function Zd(a){return Yd(a,"bar")}function $d(a){return Yd(a,"scatter")}function _d(a){return Yd(a,"pie")}function ae(a){return Yd(a,"donut")}function be(a){return _d(a)||ae(a)}function ce(a){var b="string"==typeof a?a:a.id;return!(b in yg)||"line"===yg[b]||"spline"===yg[b]||"area"===yg[b]||"area-spline"===yg[b]}function de(a){var b="string"==typeof a?a:a.id;return"spline"===yg[b]||"area-spline"===yg[b]}function ee(a){var b="string"==typeof a?a:a.id;return"bar"===yg[b]}function fe(a){var b="string"==typeof a?a:a.id;return"scatter"===yg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"pie"===yg[b]}function he(a){var b="string"==typeof a?a:a.id;return"donut"===yg[b]}function ie(a){return ge(a)||he(a)}function je(a){return ee(a)?a.values:[]}function ke(a){return ce(a)||fe(a)?a.values:[]}function le(a){return ee(a)||ce(a)?a.values:[]}function me(a){return he(a)&&ci||ge(a)&&Yh}function ne(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function oe(b){var c;try{c=rg?tf.time.format(rg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+rg)}return c}function pe(a,b){var c=tf.mouse(a),d=tf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function ue(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ve(a,b){var c="y"===Z(a.id)?gg:hg,d=Yg?1:0,e=Yg?0:1;return Math.pow(fg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function we(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function xe(a,b,c){Lg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd).attr("stroke",function(){return Di(b)}).attr("r",1.4*Sh).transition().duration(100).attr("r",Sh)}function ye(a,b,c){Mg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ze(a,b,c,d){a?xe(b,c,d):ye(b,c,d)}function Ae(a,b){Lg(b,a.node()),a.transition().duration(100).style("fill",function(){return tf.rgb(Di(b)).darker(1)})}function Be(a,b){Mg(b,a.node()),a.transition().duration(100).style("fill",function(){return Di(b)})}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a){return a.filter(function(a){return b(a.value)})}function Ee(a,c){return(c?aj.selectAll("."+f.circles+ld(c)):aj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Fe(a,b){Ee(a,b).classed(f.EXPANDED,!0).attr("r",Rh)}function Ge(a){Ee(a).filter(function(){return tf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oh)}function He(a){return aj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ie(a){He(a).classed(f.EXPANDED,!0)}function Je(a){He(a).classed(f.EXPANDED,!1)}function Ke(a,b){var c=Oe(a,b);return function(a,b){var d=c(a,b),e=Yg?1:0,f=Yg?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 Le(a,b){var c=Oe(a,!1),d=b?Me:Ne;return function(a,b){return d(c(a,b),a,this)}}function Me(a,b){var c;return Yg?(c=ee(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ne(a,b,c){var d=c.getBoundingClientRect();return Yg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ee(b)?-3:-6)}function Oe(a,b){var c=a.__max__+1,d=Wd(lg,c),e=Td(d,c,a,!!b),f=Ud(!!b),g=Vd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Yg&&(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 Pe(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 Qe(b){var c,d,e;if(ej=tf.select(wf),ej.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ej.html(""),ej.classed("c3",!0),uf.data.xs={},uf.data.targets=wc(b),n(),R(),fg.domain(tf.extent(ac(uf.data.targets))),gg.domain(Xb(uf.data.targets,"y")),hg.domain(Xb(uf.data.targets,"y2")),ig.domain(fg.domain()),jg.domain(gg.domain()),kg.domain(hg.domain()),fj=fg.domain(),Vi.scale(ig),Bf&&Zi.scale(fg),$i=ej.append("svg").attr("width",Mf+Jf.left+Jf.right).attr("height",Of+Jf.top+Jf.bottom).on("mouseenter",Ef).on("mouseleave",Ff),_i=$i.append("defs"),_i.append("clipPath").attr("id",pi).append("rect").attr("width",Mf).attr("height",Of),_i.append("clipPath").attr("id",qi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),_i.append("clipPath").attr("id",ri).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),aj=$i.append("g").attr("transform",Mi.main),bj=Pg?$i.append("g").attr("transform",Mi.context):null,cj=$i.append("g").attr("transform",Mi.legend),Sg||(cj.style("visibility","hidden"),Hi=Cc(uf.data.targets)),dj=tf.select(wf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),of(Cc(uf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Zg&&aj.append("g").attr("class",f.axisX).attr("clip-path",ti).attr("transform",Mi.x).append("text").attr("class",f.axisXLabel).attr("transform",Yg?"rotate(-90)":"").style("text-anchor",zb),ph&&aj.append("g").attr("class",f.axisY).attr("clip-path",ui).attr("transform",Mi.y).append("text").attr("class",f.axisYLabel).attr("transform",Yg?"":"rotate(-90)").style("text-anchor",Ab),yh&&aj.append("g").attr("class",f.axisY2).attr("transform",Mi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Yg?"":"rotate(-90)").style("text-anchor",Bb),d=aj.append("g").attr("clip-path",si).attr("class",f.grid),Hh&&d.append("g").attr("class",f.xgrids),te(Jh)&&d.append("g").attr("class",f.xgridLines),Ph&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Kh&&d.append("g").attr("class",f.ygrids),te(Lh)&&d.append("g").attr("class",f.ygridLines),aj.append("g").attr("clip-path",si).attr("class",f.regions),aj.append("g").attr("clip-path",si).attr("class",f.chart),c=aj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Bf?Yg?"ns-resize":"ew-resize":null),aj.select("."+f.chart).append("g").attr("class",f.chartBars),aj.select("."+f.chart).append("g").attr("class",f.chartLines),aj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Mi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),aj.select("."+f.chart).append("g").attr("class",f.chartTexts),Bf&&aj.insert("rect",Df?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Mf).attr("height",Of).style("opacity",0).style("cursor",Yg?"ns-resize":"ew-resize").call(Zi).on("dblclick.zoom",null),nh&&Vi.extent("function"!=typeof nh?nh:nh(ac())),Pg&&(bj.append("g").attr("clip-path",si).attr("class",f.chart),bj.select("."+f.chart).append("g").attr("class",f.chartBars),bj.select("."+f.chart).append("g").attr("class",f.chartLines),bj.append("g").attr("clip-path",si).attr("class",f.brush).call(Vi).selectAll("rect").attr(Yg?"width":"height",Yg?Nf:Pf),bj.append("g").attr("class",f.axisX).attr("transform",Mi.subx).attr("clip-path",Yg?"":ti)),bf(uf.data.targets),Yg?aj.select("."+f.axisX).style("opacity",0).call(lg):(aj.select("."+f.axisY).style("opacity",0).call(mg),aj.select("."+f.axisY2).style("opacity",0).call(ng)),n(),R(),_e(),m(),Xe({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),mi){if(vi&&"string"==typeof ni){for(ni=oe(ni),e=0;e0){d=[];for(var g in tg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Id(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ce,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 Ve(a){be(uf.data.targets)||Eg&&(yi=a,aj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),zi=!0,Ng())}function We(){be(uf.data.targets)||Eg&&(aj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),aj.selectAll("."+f.shape).classed(f.INCLUDED,!1),zi=!1,Og())}function Xe(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U=Sd(),V=be(uf.data.targets),W=Ic(uf.data.targets);if(0!==W.length){if(a=d(a)?a:{},z=d(a.withY)?a.withY:!0,A=d(a.withSubchart)?a.withSubchart:!0,B=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,C=d(a.withTransitionForExit)?a.withTransitionForExit:B,D=d(a.withTransitionForAxis)?a.withTransitionForAxis:B,E=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:B,O=B?If:0,P=C?O:0,Q=D?O:0,I&&Sg&&of(Cc(uf.data.targets),a),H&&(fg.domain(tf.extent(ac(W))),fj=fg.domain(),Bf&&Zi.scale(fg).updateScaleExtent(),ig.domain(fg.domain()),Vi.scale(ig)),G&&(fg.domain(Vi.empty()?fj:Vi.extent()),Bf&&Zi.scale(fg).updateScaleExtent()),gg.domain(Xb(W,"y")),hg.domain(Xb(W,"y2")),(gh||fh)&&(R=hh?hh:Kc(Jc(W)),lg.tickValues(R),og.tickValues(R)),c=aj.select("."+f.axisX).style("opacity",V?0:1),(Yg||E)&&(c=c.transition().duration(Q)),c.call(lg),g=aj.select("."+f.axisY).style("opacity",V?0:1),(!Yg||E)&&(g=g.transition().duration(Q)),g.call(mg),aj.select("."+f.axisY2).style("opacity",V?0:1).transition().duration(Q).call(ng),G)if(dh&&R){for(S=1;S=0&&tf.select(this).style("display",b%T?"none":"block")})}else tf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!Yg&&ih&&eb(c),J=Ke(U),M=Le(U,!0),N=Le(U,!1),Db(),jg.domain(gg.domain()),kg.domain(hg.domain()),dj.style("display","none"),o(),aj.select("line."+f.xgridFocus).style("visibility","hidden"),Hh){if("year"===Ih){i=[];for(var X=ac(),Y=X[0].getFullYear(),Z=X[1].getFullYear(),$=Y;Z>=$;$++)i.push(new Date($+"-01-01 00:00:00"))}else i=fg.ticks(10);h=aj.select("."+f.xgrids).selectAll("."+f.xgrid).data(i),h.enter().append("line").attr("class",f.xgrid),h.attr("x1",Yg?0:function(a){return fg(a)-lg.tickOffset()}).attr("x2",Yg?Mf:function(a){return fg(a)-lg.tickOffset()}).attr("y1",Yg?function(a){return fg(a)-lg.tickOffset()}:Jf.top).attr("y2",Yg?function(a){return fg(a)-lg.tickOffset()}:Of).style("opacity",function(){return+tf.select(this).attr(Yg?"y1":"x1")===(Yg?Of:0)?0:1}),h.exit().remove()}te(Jh)&&(j=aj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Jh),k=j.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),k.append("line").style("opacity",0),k.append("text").attr("text-anchor","end").attr("transform",Yg?"":"rotate(-90)").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),j.select("line").transition().duration(O).attr("x1",Yg?0:Ad).attr("x2",Yg?Mf:Ad).attr("y1",Yg?Ad:Jf.top).attr("y2",Yg?Ad:Of).style("opacity",1),j.select("text").transition().duration(O).attr("x",Yg?Mf:0).attr("y",Ad).text(function(a){return a.text}).style("opacity",1),j.exit().transition().duration(O).style("opacity",0).remove()),z&&Kh&&(l=aj.select("."+f.ygrids).selectAll("."+f.ygrid).data(gg.ticks(Mh)),l.enter().append("line").attr("class",f.ygrid),l.attr("x1",Yg?gg:0).attr("x2",Yg?gg:Mf).attr("y1",Yg?0:gg).attr("y2",Yg?Of:gg),l.exit().remove()),z&&te(Lh)&&(m=aj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Lh),n=m.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),n.append("line").style("opacity",0),n.append("text").attr("text-anchor","end").attr("transform",Yg?"rotate(-90)":"").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),m.select("line").transition().duration(O).attr("x1",Yg?Bd:0).attr("x2",Yg?Bd:Mf).attr("y1",Yg?0:Bd).attr("y2",Yg?Of:Bd).style("opacity",1),m.select("text").transition().duration(O).attr("x",Yg?0:Mf).attr("y",Bd).text(function(a){return a.text}).style("opacity",1),m.exit().transition().duration(O).style("opacity",0).remove()),q=aj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),q.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Di(a)}).attr("class",ad),q.style("opacity",qd).transition().duration(O).attr("d",J).style("opacity",1),q.exit().transition().duration(P).style("opacity",0).remove(),s=aj.selectAll("."+f.texts).selectAll("."+f.text).data(le),s.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return Yg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),s.text(function(a){return yd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(O).attr("x",M).attr("y",N).style("fill-opacity",td),s.exit().transition().duration(P).style("fill-opacity",0).remove(),aj.selectAll("."+f.line).style("opacity",qd).transition().duration(O).attr("d",Wi).style("opacity",1),aj.selectAll("."+f.area).style("opacity",0).transition().duration(O).attr("d",Xi).style("opacity",gj),p=aj.selectAll("."+f.circles).selectAll("."+f.circle).data(ke),p.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Oh),p.style("opacity",qd).transition().duration(O).style("opacity",sd).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),p.exit().remove(),aj.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(O).attrTween("d",function(a){var b,c=Fb(a);return c?(b=tf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1),aj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(O).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&ie(a.data)?1:0}),aj.select("."+f.chartArcsTitle).style("opacity",ae(uf.data.targets)?1:0),Pg&&(null!==tf.event&&"zoom"===tf.event.type&&Vi.extent(fg.orgDomain()).update(),A&&(e=bj.select("."+f.axisX).style("opacity",V?0:1),(Yg||E)&&(e=e.transition().duration(Q)),e.call(og),!Yg&&ih&&eb(e),Vi.empty()||Vi.extent(fg.orgDomain()).update(),K=Ke(U,!0),t=bj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),t.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Di(a)}).attr("class",ad),t.style("opacity",qd).transition().duration(O).attr("d",K).style("opacity",1),t.exit().transition().duration(O).style("opacity",0).remove(),bj.selectAll("."+f.line).style("opacity",qd).transition().duration(O).attr("d",Yi).style("opacity",1))),aj.selectAll("."+f.selectedCircles).filter(function(a){return ee(a)}).selectAll("circle").remove(),aj.selectAll("."+f.selectedCircle).transition().duration(O).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),u=aj.select("."+f.eventRects),te(qg)&&!pc(qg)?(u.classed(f.eventRectsMultiple)||u.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),v=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Se(v.enter()),v.attr("x",0).attr("y",0).attr("width",Mf).attr("height",Of)):(u.classed(f.eventRectsSingle)||u.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),xi&&!wi?(y=function(a,b){var c=yc(b),d=zc(b),e=uf.data.xs[a.id][b];return(fg(d?d:e+50)-fg(c?c:e-50))/2},x=function(a,b){var c=yc(b),d=uf.data.xs[a.id][b];return(fg(d)+fg(c?c:d-50))/2}):(y=L(),x=function(a){return fg(a.x)-y/2}),w=Bc(),aj.select("."+f.eventRects).datum(w?w.values:[]),v=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Re(v.enter()),v.attr("class",fd).attr("x",Yg?0:x).attr("y",Yg?x:0).attr("width",Yg?Mf:y).attr("height",Yg?y:Of),v.exit().remove()),r=aj.select("."+f.regions).selectAll("rect."+f.region).data(hi),r.enter().append("rect").style("fill-opacity",0),r.attr("class",ed).attr("x",fc).attr("y",gc).attr("width",hc).attr("height",ic).transition().duration(O).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Cc(uf.data.targets).forEach(function(a){hj[a]=!0})}}function Ye(){Xe({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ze(){return"mousemove"===tf.event.sourceEvent.type&&Zi.altDomain?(fg.domain(Zi.altDomain),void Zi.scale(fg).updateScaleExtent()):(wi&&fg.orgDomain()[0]===fj[0]&&fg.domain([fj[0]-1e-10,fg.orgDomain()[1]]),Xe({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===tf.event.sourceEvent.type&&(Ai=!0)))}function $e(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function _e(){$i.attr("width",Qf).attr("height",Rf),$i.select("#"+pi).select("rect").attr("width",Mf).attr("height",Of),$i.select("#"+qi).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),$i.select("#"+ri).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),$i.select("."+f.zoomRect).attr("width",Mf).attr("height",Of),ej.style("max-height",Rf+"px")}function af(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),_e(),m(a.withTransition),Xe(a)}function bf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=aj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Di(a)}),e=aj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("fill",function(a){return Di(a)}).style("stroke","none").style("cursor",function(a){return Gg(a)?"pointer":null}),c=aj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)}),b.append("path").attr("class",dd).style("opacity",function(){return gj=+tf.select(this).style("opacity"),0}).style("fill",function(a){return Di(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Di(a)}).style("cursor",function(a){return Gg(a)?"pointer":null}),a.forEach(function(a){aj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=aj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Yf(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Di(a.data)}).style("cursor",function(a){return Gg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Fb(a),d=Lb(c),e=Tb();Nb(c.data.id),jf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Fb(a),c=[Lb(b)];Md(c,tf.mouse(this))}).on("mouseout",function(a,b){var c=Fb(a),d=Lb(c),e=Ub();Ob(c.data.id),lf(),Nd(),e(d,b)}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Pg&&(n=bj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Di(a)}),l=bj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)})),$i.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function cf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Xd(a.id,b.types[a.id]):Xd(a.id,b.type)}),uf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Ni?j:i,l=Ni?Q():P();return d&&(w=0,C=0,t=0,u=0),Sg&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Ni?u:t,void(Xg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,Ni?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=cj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Ug?Ug(a):uf.toggle(a)}).on("mouseover",function(a){uf.focus(a),"function"==typeof Vg&&Vg(a)}).on("mouseout",function(a){uf.revert(),"function"==typeof Wg&&Wg(a)}),l.append("text").text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",Ni?g:-200).attr("y",Ni?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ni?h:-200).attr("y",Ni?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Di(a)}).attr("x",Ni?g:-200).attr("y",Ni?-200:i).attr("width",10).attr("height",10),cj.selectAll("text").data(a).text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),cj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),cj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),_e(),q&&m(p)}function pf(a){return Ec(uf.data.targets,a.id)}function qf(a){return"data"in a&&Ec(uf.data.targets,a.data.id)}function rf(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 sf(a,b,c){var d=!be(uf.data.targets);Xd(a,b),af(c?c:{withTransitionForAxis:d})}var tf=a.d3?a.d3:a.require?a.require("d3"):void 0,uf={data:{},axis:{},legend:{}},vf={},wf=h(["bindto"],"#chart"),xf=h(["size","width"]),yf=h(["size","height"]),zf=h(["padding","left"]),Af=h(["padding","right"]),Bf=h(["zoom","enabled"],!1),Cf=h(["zoom","extent"]),Df=h(["zoom","privileged"],!1),Ef=h(["onenter"],function(){}),Ff=h(["onleave"],function(){}),Gf=h(["onresize"],function(){}),Hf=h(["onresized"],function(){}),If=h(["transition","duration"],350);g("data","data is required in config");var Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg=h(["data","x"]),qg=h(["data","xs"],{}),rg=h(["data","x_format"]),sg=h(["data","id_converter"],function(a){return a}),tg=h(["data","names"],{}),ug=h(["data","classes"],{}),vg=h(["data","groups"],[]),wg=h(["data","axes"],{}),xg=h(["data","type"]),yg=h(["data","types"],{}),zg=h(["data","labels"],{}),Ag=h(["data","order"]),Bg=h(["data","regions"],{}),Cg=h(["data","color"]),Dg=h(["data","colors"],{}),Eg=h(["data","selection","enabled"],!1),Fg=h(["data","selection","grouped"],!1),Gg=h(["data","selection","isselectable"],function(){return!0}),Hg=h(["data","selection","multiple"],!0),Ig=h(["data","onclick"],function(){}),Jg=h(["data","onenter"],function(){}),Kg=h(["data","onleave"],function(){}),Lg=h(["data","onselected"],function(){}),Mg=h(["data","onunselected"],function(){}),Ng=h(["data","ondragstart"],function(){}),Og=h(["data","ondragend"],function(){}),Pg=h(["subchart","show"],!1),Qg=h(["subchart","size","height"],60),Rg=h(["color","pattern"],[]),Sg=h(["legend","show"],!0),Tg=h(["legend","position"],"bottom"),Ug=h(["legend","item","onclick"]),Vg=h(["legend","item","onmouseover"]),Wg=h(["legend","item","onmouseout"]),Xg=h(["legend","equally"],!1),Yg=h(["axis","rotated"],!1),Zg=h(["axis","x","show"],!0),$g=h(["axis","x","type"],"indexed"),_g=h(["axis","x","localtime"],!0),ah=h(["axis","x","categories"],[]),bh=h(["axis","x","tick","centered"],!1),ch=h(["axis","x","tick","format"]),dh=h(["axis","x","tick","culling"],{}),eh=h(["axis","x","tick","culling","max"],10),fh=h(["axis","x","tick","count"]),gh=h(["axis","x","tick","fit"],!0),hh=h(["axis","x","tick","values"],null),ih=h(["axis","x","tick","rotate"]),jh=h(["axis","x","max"],null),kh=h(["axis","x","min"],null),lh=h(["axis","x","padding"],{}),mh=h(["axis","x","height"]),nh=h(["axis","x","default"]),oh=h(["axis","x","label"],{}),ph=h(["axis","y","show"],!0),qh=h(["axis","y","max"]),rh=h(["axis","y","min"]),sh=h(["axis","y","center"]),th=h(["axis","y","label"],{}),uh=h(["axis","y","inner"],!1),vh=h(["axis","y","tick","format"]),wh=h(["axis","y","padding"],{}),xh=h(["axis","y","ticks"],10),yh=h(["axis","y2","show"],!1),zh=h(["axis","y2","max"]),Ah=h(["axis","y2","min"]),Bh=h(["axis","y2","center"]),Ch=h(["axis","y2","label"],{}),Dh=h(["axis","y2","inner"],!1),Eh=h(["axis","y2","tick","format"]),Fh=h(["axis","y2","padding"],{}),Gh=h(["axis","y2","ticks"],10),Hh=h(["grid","x","show"],!1),Ih=h(["grid","x","type"],"tick"),Jh=h(["grid","x","lines"],[]),Kh=h(["grid","y","show"],!1),Lh=h(["grid","y","lines"],[]),Mh=h(["grid","y","ticks"],10),Nh=h(["point","show"],!0),Oh=Nh?h(["point","r"],2.5):0,Ph=h(["point","focus","line","enabled"],!0),Qh=h(["point","focus","expand","enabled"],!0),Rh=h(["point","focus","expand","r"],Qh?4:Oh),Sh=h(["point","focus","select","r"],8),Th=h(["line","connect_null"],!1),Uh=h(["bar","width"]),Vh=h(["bar","width","ratio"],.6),Wh=h(["pie","label","show"],!0),Xh=h(["pie","label","format"]),Yh=h(["pie","expand"],!0),Zh=h(["pie","onclick"],function(){}),$h=h(["pie","onmouseover"],function(){}),_h=h(["pie","onmouseout"],function(){}),ai=h(["donut","label","show"],!0),bi=h(["donut","label","format"]),ci=h(["donut","expand"],!0),di=h(["donut","title"],""),ei=h(["donut","onclick"],function(){}),fi=h(["donut","onmouseover"],function(){}),gi=h(["donut","onmouseout"],function(){}),hi=h(["regions"],[]),ii=h(["tooltip","show"],!0),ji=h(["tooltip","format","title"]),ki=h(["tooltip","format","value"]),li=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ji?ji:b,l=ki?ki: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+""}),mi=h(["tooltip","init","show"],!1),ni=h(["tooltip","init","x"],0),oi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),pi=("string"==typeof wf?wf.replace("#",""):wf.id)+"-clip",qi=pi+"-xaxis",ri=pi+"-yaxis",si=i(pi),ti=i(qi),ui=i(ri),vi="timeseries"===$g,wi="categorized"===$g,xi=!vi&&(pg||te(qg)),yi=null,zi=!1,Ai=!1,Bi=!1,Ci=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Di=ne(Dg,te(Rg)?Rg:Ci,Cg),Ei=_g?tf.time.format:tf.time.format.utc,Fi=function(){var a=[[Ei("%Y/%-m/%-d"),function(){return!0}],[Ei("%-m/%-d"),function(a){return a.getMonth()}],[Ei("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ei("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ei("%I %p"),function(a){return a.getHours()}],[Ei("%I:%M"),function(a){return a.getMinutes()}],[Ei(":%S"),function(a){return a.getSeconds()}],[Ei(".%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)}}(),Gi=[],Hi=[],Ii=Yg?"left":"bottom",Ji=Yg?uh?"top":"bottom":uh?"right":"left",Ki=Yg?Dh?"bottom":"top":Dh?"left":"right",Li=Yg?"left":"bottom",Mi={main:function(){return"translate("+Jf.left+","+Jf.top+")"},context:function(){return"translate("+Kf.left+","+Kf.top+")"},legend:function(){return"translate("+Lf.left+","+Lf.top+")"},x:function(){return"translate(0,"+(Yg?0:Of)+")"},y:function(){return"translate(0,"+(Yg?Of:0)+")"},y2:function(){return"translate("+(Yg?0:Mf)+","+(Yg?1:0)+")"},subx:function(){return"translate(0,"+(Yg?0:Pf)+")"},arc:function(){return"translate("+Mf/2+","+Of/2+")"}},Ni="right"===Tg,Oi=0,Pi=0,Qi=0,Ri=.15,Si=30,Ti=Yg&&!Zg?0:30,Ui=5;Yf=tf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Vi,Wi=function(){var a=tf.svg.line().x(Yg?function(a){return V(a.id)(a.value)}:zd).y(Yg?zd:function(a){return V(a.id)(a.value)});return Th||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Th?De(b.values):b.values;return ce(b)?(a.interpolate(de(b)?"cardinal":"linear"),Bg[b.id]?Pe(e,fg,V(b.id),Bg[b.id]):a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Xi=function(){var a;return a=Yg?tf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(zd):tf.svg.area().x(zd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=De(b.values);return Yd([b],"area")||Yd([b],"area-spline")?(a.interpolate(de(b)?"cardinal":"linear"),a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Yi=function(){var a=tf.svg.line().x(Yg?function(a){return W(a.id)(a.value)}:Cd).y(Yg?Cd:function(a){return W(a.id)(a.value)});return function(b){var c=De(b.values);return ce(b)?a(c):"M "+ig(c[0].x)+" "+W(b.id)(c[0].value)}}(),Zi=function(){};Vi=tf.svg.brush().on("brush",Ye),Vi.update=function(){return bj&&bj.select("."+f.brush).call(this),this},Vi.scale=function(a){return Yg?this.y(a):this.x(a)},Bf&&(Zi=tf.behavior.zoom().on("zoomstart",function(){Zi.altDomain=tf.event.sourceEvent.altKey?fg.orgDomain():null}).on("zoom",Bf?Ze:null),Zi.scale=function(a){return Yg?this.y(a):this.x(a)},Zi.orgScaleExtent=function(){var a=Cf?Cf:[1,10];return[a[0],Math.max(Ac()/a[1],a[1])]},Zi.updateScaleExtent=function(){var a=bc(fg.orgDomain())/bc(fj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var $i,_i,aj,bj,cj,dj,ej,fj,gj,hj={};if(uf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),uf.defocus(),b(d.classed(f.focused,!0)),b(e),be(uf.data.targets)&&Nb(a,!0),jf(a)},uf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),kf(a)},uf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),lf()},uf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),$i.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?mf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},uf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),$i.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?nf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Ri),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},uf.toggle=function(a){Gc(a)?uf.hide(a):uf.show(a)},uf.unzoom=function(){Vi.clear().update(),Xe({withUpdateXDomain:!0})},uf.load=function(a){return a.xs&&oc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){ug[b]=a.classes[b]}),"categories"in a&&wi&&(ah=a.categories,lg.categories(ah)),"cacheIds"in a&&cc(a.cacheIds)?void cf(ec(a.cacheIds),a.done):void("unload"in a?ef(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){df(a)}):df(a))},uf.unload=function(a){ef(Dc(a),function(){Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},uf.selected=function(a){return tf.merge(aj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return tf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},uf.select=function(a,b,c){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=tf.select(this),i="circle"===this.nodeName?xe:Ae,j="circle"===this.nodeName?ye:Be,k=Fg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Gg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},uf.unselect=function(a,b){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=tf.select(this),g="circle"===this.nodeName?ye:Be,h=Fg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Gg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},uf.toLine=function(a){sf(a,"line")},uf.toSpline=function(a){sf(a,"spline")},uf.toBar=function(a){sf(a,"bar")},uf.toScatter=function(a){sf(a,"scatter")},uf.toArea=function(a){sf(a,"area")},uf.toAreaSpline=function(a){sf(a,"area-spline")},uf.toPie=function(a){sf(a,"pie",{withTransform:!0})},uf.toDonut=function(a){sf(a,"donut",{withTransform:!0})},uf.groups=function(a){return c(a)?vg:(vg=a,Xe(),vg)},uf.xgrids=function(a){return a?(Jh=a,Xe(),Jh):Jh},uf.xgrids.add=function(a){return a?uf.xgrids(Jh.concat(a)):void 0},uf.xgrids.remove=function(a){var b=rf(a);return uf.xgrids(Jh.filter(b))},uf.ygrids=function(a){return a?(Lh=a,Xe(),Lh):Lh -},uf.ygrids.add=function(a){return a?uf.ygrids(Lh.concat(a)):void 0},uf.ygrids.remove=function(a){var b=rf(a);return uf.ygrids(Lh.filter(b))},uf.regions=function(a){return c(a)?hi:(hi=a,Xe(),hi)},uf.regions.add=function(a){return c(a)?hi:(hi=hi.concat(a),Xe(),hi)},uf.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;$i.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),hi=hi.filter(function(b){return b.classes.indexOf(a)<0})}),hi},uf.data.get=function(a){var b=uf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},uf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},uf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){tg[b]=a[b]}),of(Cc(uf.data.targets),{withTransition:!0}),tg):tg},uf.x=function(a){return arguments.length&&(rc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.xs=function(a){return arguments.length&&(sc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},uf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(qh=+a.y),b(a.y2)&&(zh=+a.y2)):qh=zh=+a,Xe())},uf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(rh=+a.y),b(a.y2)&&(Ah=+a.y2)):rh=Ah=+a,Xe())},uf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&uf.axis.max(a.max),"undefined"!=typeof a.min&&uf.axis.min(a.min))},uf.legend.show=function(a){Sg||(Sg=!0,cj.style("visibility","visible")),mf(Dc(a)),Xe({withTransitionForHorizontalAxis:!1})},uf.legend.hide=function(a){Sg&&se(a)&&(Sg=!1,cj.style("visibility","hidden")),nf(Dc(a)),Xe({withTransitionForHorizontalAxis:!1})},uf.resize=function(a){xf=a?a.width:null,yf=a?a.height:null,af({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},uf.destroy=function(){uf.data.targets=void 0,uf.data.xs={},ej.html(""),a.onresize=null},"url"in e.data)tf.xhr(e.data.url,function(a,b){var c,d=tf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=tf.csv.parse(b.response),Qe(c)});else if("rows"in e.data)Qe(uc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Qe(vc(e.data.columns))}return uf},"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.32"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cMf&&(Mf=0),0>Of&&(Of=0),Nf=Yg?Jf.left-Si-Ti:Mf,Pf=Yg?Of:Rf-Kf.top-Kf.bottom,0>Nf&&(Nf=0),0>Pf&&(Pf=0),p(),Ni&&be(uf.data.targets)&&(Lf.left=Mf/2+Tf)}function o(){aj.select("line."+f.xgridFocus).attr("x1",Yg?0:-10).attr("x2",Yg?Mf:-10).attr("y1",Yg?-10:Jf.top).attr("y2",Yg?-10:Of)}function p(){Tf=Of/2,Sf=.95*Tf,Uf=ae(uf.data.targets)?.6*Sf:0}function q(){var a=Yg?f.axisX:f.axisY,b=tf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=tf.select(wf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return xf?xf:x()}function s(){var a=yf?yf:y();return a>0?a:320}function t(){return be(uf.data.targets)?0:zf?zf:Yg?Zg?v("x"):1:!ph||uh?1:v("y")}function u(){var a=1;return be(uf.data.targets)?0:Af?Af:Ni?P()+(yh&&!Yg?v("y2"):a):yh?Dh||Yg?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||Zg?"x"===a&&mh?mh:"y"!==a||ph?"y2"!==a||yh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Ui:Sg&&!Ni?10:1:0}function x(){return+tf.select(wf).style("width").replace("px","")}function y(){return+tf.select(wf).style("height").replace("px","")}function z(a){return a?-5:-(Jf.left-1)}function A(a){return a?-20:-4}function B(){return z(!Yg)}function C(){return A(!Yg)}function D(){return z(Yg)}function E(){return A(Yg)}function F(a){return a?Mf+2+4:Jf.left+20}function G(a){return a?(mh?mh:0)+80:Of+8}function H(){return F(!Yg)}function I(){return G(!Yg)}function J(){return F(Yg)}function K(){return G(Yg)}function L(){var a=Ac(uf.data.targets),b=a.values[0],c=a.values[a.values.length-1],d=fg(c.x)-fg(b.x),e=zc(),f=Zd(uf.data.targets)?(e-(wi?.25:1))/e:1;return e>1?d*f/(e-1):d}function M(a){Oi=a}function N(a){Pi=a}function O(a){Qi=a}function P(){return Sg?Ni?Pi*(Oi+1):Qf:0}function Q(){return Sg?Ni?Rf:Qi*(Oi+1):0}function R(){var a,b=!fg;Zf=Yg?1:0,$f=Yg?Of:Mf,_f=Yg?0:Of,ag=Yg?Mf:1,bg=Zf,cg=$f,dg=Yg?0:Pf,eg=Yg?Nf:1,fg=T(Zf,$f,b?void 0:fg.domain(),function(){return lg.tickOffset()}),gg=U(_f,ag,b?void 0:gg.domain()),hg=U(_f,ag,b?void 0:hg.domain()),ig=T(Zf,$f,fj,function(a){return a%1?0:og.tickOffset()}),jg=U(dg,eg,b?void 0:jg.domain()),kg=U(dg,eg,b?void 0:kg.domain()),a=$(),lg=X(fg,Ii,a),og=X(ig,Li,a),mg=Y(gg,Ji,vh,xh),ng=Y(hg,Ki,Eh,Gh),b||(Vi.scale(ig),Bf&&Zi.scale(fg)),S()}function S(){Vf=Gb(),Wf=Hb(),Xf=Hb(.98)}function T(a,b,d,e){var f=(vi?tf.time.scale():tf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),wi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=tf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?hg:gg}function W(a){return"y2"===Z(a)?kg:jg}function X(a,b,c){var d=(wi?Eb():tf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),wi?(d.tickCentered(bh),se(dh)&&(dh=!1)):d.tickOffset=function(){var a=Bc(uf.data.targets),b=fg(a[1])-fg(a[0]);return b/zc()/2},wi&&d.categories(ah),d}function Y(a,b,c,d){return tf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in wg?wg[a]:"y"}function $(){var a=vi?Fi:wi?Tc:function(a){return 0>a?a.toFixed(0):a};return ch&&("function"==typeof ch?a=ch:vi&&(a=function(a){return a?Ei(ch)(a):""})),a}function _(a){var b;return"y"===a?b=th:"y2"===a?b=Ch:"x"===a&&(b=oh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?th=b:"y2"===a?Ch=b:"x"===a&&(oh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a){a.selectAll(".tick text").attr("y",db(ih)).attr("x",cb(ih)).attr("transform","rotate("+ih+")").style("text-anchor","start")}function fb(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 gb(){return fb("x",Yg?"inner-top":"inner-right")}function hb(){return fb("y",Yg?"inner-right":"inner-top")}function ib(){return fb("y2",Yg?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Mf/2:Mf:b.isBottom?-Of:b.isMiddle?-Of/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!Yg,gb())}function rb(){return nb(Yg,hb())}function sb(){return nb(Yg,ib())}function tb(){return ob(!Yg,gb())}function ub(){return ob(Yg,hb())}function vb(){return ob(Yg,ib())}function wb(){var a=gb();return Yg?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":mh?mh-10:"3em"}function xb(){var a=hb();return Yg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return Yg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!Yg,gb())}function Ab(){return pb(Yg,hb())}function Bb(){return pb(Yg,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return tf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?30:b}function Db(){aj.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),aj.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),aj.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+o)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Rc(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 tf.min(Object.keys(i).map(function(a){return tf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(vg.length>0)for(g=Sc(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 tf.max(Object.keys(i).map(function(a){return tf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Ah:rh,n="y2"===c?zh:qh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Bh:sh,r=ud()&&Yg;return 0===l.length?"y2"===c?hg.domain():gg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(gg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&wh&&(f=b(wh.top)?wh.top:e,g=b(wh.bottom)?wh.bottom:e),"y2"===c&&Fh&&(f=b(Fh.top)?Fh.top:e,g=b(Fh.bottom)?Fh.bottom:e),Zd(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return kh?vi?oe(kh):kh:tf.min(a,function(a){return tf.min(a.values,function(a){return a.x})})}function Zb(a){return jh?vi?oe(jh):jh:tf.max(a,function(a){return tf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return wi?d=0:Zd(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof lh&&te(lh)?(e=b(lh.left)?lh.left:d,f=b(lh.right)?lh.right:d):e=f="number"==typeof lh?lh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?gg:hg;return b="y"===a.axis||"y2"===a.axis?Yg?Of:"start"in a?d(a.start):Of:Yg?"end"in a?fg(vi?oe(a.end):a.end):Of:Of,c>b?0:b-c}function ic(a){return pg&&a===pg||te(qg)&&ue(qg,a)}function jc(a){return!ic(a)}function kc(a){return pg?pg:te(qg)?qg[a]:null}function lc(a,b){var c,d=b&&te(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=uf.data.xs[b])}),c}function mc(a,b){return a in uf.data.xs&&uf.data.xs[a]&&uf.data.xs[a][b]?uf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){qg[b]=a[b]})}function oc(a){return 1===tf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=tg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),uf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,b,c){var d;return d=vi?a?a instanceof Date?a:oe(a):oe(mc(b,c)):xi&&!wi?a?+a:mc(b,c):c}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?uf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):pg?(d=Object.keys(uf.data.xs),uf.data.xs[c]=d.length>0?uf.data.xs[d[0]]:void 0):te(qg)&&(uf.data.xs[c]=lc(f,uf.data.targets)):uf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!uf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=sg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return xi&&wi&&0===c&&g&&(0===e&&(ah=[]),ah.push(g)),("undefined"==typeof a[b]||uf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),xg&&Xd(Cc(c).filter(function(a){return!(a in yg)}),xg),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&uf.data.targets[0].values[a-1]?uf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b=Ac(a),c=b.values[0],d=b.values[b.values.length-1];return[c.x,d.x]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(uf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(vi?new Date(h):h);i.push(d)}return vi||(i=i.sort(function(a,b){return a-b})),i}function Lc(a){Gi=Gi.concat(a)}function Mc(a){Gi=Gi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Hi=Hi.concat(a)}function Oc(a){Hi=Hi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Dd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Dd(a,g))),Gd(e,b)):Ed(a,b,f,g)}function Fd(a,b){var c;return c=a.map(function(a){return Ed(a.values,b)}),Gd(c,b)}function Gd(a,b){var c,d;return a.forEach(function(a){var e=ve(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Hd(a,b){return tf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Id(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 Jd(){return Ag&&"desc"===Ag.toLowerCase()}function Kd(){return Ag&&"asc"===Ag.toLowerCase()}function Ld(a){var b=Kd(),c=Jd();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 Ag&&a.sort(Ag),a}function Md(a,c){var d,e,f,g,h,i,j,k=be(uf.data.targets),l=k?xd:wd,m=a.filter(function(a){return a&&b(a.value)});ii&&0!==m.length&&(dj.html(li(a,$(),l,Di)).style("display","block"),d=dj.property("offsetWidth"),e=dj.property("offsetHeight"),k?(g=Mf/2+c[0],i=Of/2+c[1]+20):(Yg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=fg(m[0].x)+20):(f=q(),g=f+t()+fg(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),dj.style("top",i+"px").style("left",g+"px"))}function Nd(){dj.style("display","none")}function Od(a){var c=a.filter(function(a){return a&&b(a.value)});ii&&($d(uf.data.targets)||be(uf.data.targets)||aj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Yg?"y1":"x1",zd).attr(Yg?"y2":"x2",zd))}function Pd(){aj.select("line."+f.xgridFocus).style("visibility","hidden")}function Qd(a){return a.x||0===a.x?fg(a.x):null}function Rd(a){return V(a.id)(a.value)}function Sd(){var a,b,d={},e=0;return Ic(Fc(ee)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Wd(a,b){return Uh?Uh:b?2*a.tickOffset()*Vh/b:0}function Xd(a,b){Dc(a).forEach(function(a){hj[a]=b===yg[a],yg[a]=b})}function Yd(a,b){var c=!1;return a.forEach(function(a){yg[a.id]===b&&(c=!0),a.id in yg||"line"!==b||(c=!0)}),c}function Zd(a){return Yd(a,"bar")}function $d(a){return Yd(a,"scatter")}function _d(a){return Yd(a,"pie")}function ae(a){return Yd(a,"donut")}function be(a){return _d(a)||ae(a)}function ce(a){var b="string"==typeof a?a:a.id;return!(b in yg)||"line"===yg[b]||"spline"===yg[b]||"area"===yg[b]||"area-spline"===yg[b]}function de(a){var b="string"==typeof a?a:a.id;return"spline"===yg[b]||"area-spline"===yg[b]}function ee(a){var b="string"==typeof a?a:a.id;return"bar"===yg[b]}function fe(a){var b="string"==typeof a?a:a.id;return"scatter"===yg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"pie"===yg[b]}function he(a){var b="string"==typeof a?a:a.id;return"donut"===yg[b]}function ie(a){return ge(a)||he(a)}function je(a){return ee(a)?a.values:[]}function ke(a){return ce(a)||fe(a)?a.values:[]}function le(a){return ee(a)||ce(a)?a.values:[]}function me(a){return he(a)&&ci||ge(a)&&Yh}function ne(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function oe(b){var c;try{c=rg?tf.time.format(rg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+rg)}return c}function pe(a,b){var c=tf.mouse(a),d=tf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function ue(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ve(a,b){var c="y"===Z(a.id)?gg:hg,d=Yg?1:0,e=Yg?0:1;return Math.pow(fg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function we(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function xe(a,b,c){Lg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd).attr("stroke",function(){return Di(b)}).attr("r",1.4*Sh).transition().duration(100).attr("r",Sh)}function ye(a,b,c){Mg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ze(a,b,c,d){a?xe(b,c,d):ye(b,c,d)}function Ae(a,b){Lg(b,a.node()),a.transition().duration(100).style("fill",function(){return tf.rgb(Di(b)).darker(1)})}function Be(a,b){Mg(b,a.node()),a.transition().duration(100).style("fill",function(){return Di(b)})}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a){return a.filter(function(a){return b(a.value)})}function Ee(a,c){return(c?aj.selectAll("."+f.circles+ld(c)):aj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Fe(a,b){Ee(a,b).classed(f.EXPANDED,!0).attr("r",Rh)}function Ge(a){Ee(a).filter(function(){return tf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oh)}function He(a){return aj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ie(a){He(a).classed(f.EXPANDED,!0)}function Je(a){He(a).classed(f.EXPANDED,!1)}function Ke(a,b){var c=Oe(a,b);return function(a,b){var d=c(a,b),e=Yg?1:0,f=Yg?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 Le(a,b){var c=Oe(a,!1),d=b?Me:Ne;return function(a,b){return d(c(a,b),a,this)}}function Me(a,b){var c;return Yg?(c=ee(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ne(a,b,c){var d=c.getBoundingClientRect();return Yg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ee(b)?-3:-6)}function Oe(a,b){var c=a.__max__+1,d=Wd(lg,c),e=Td(d,c,a,!!b),f=Ud(!!b),g=Vd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Yg&&(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 Pe(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 Qe(b){var c,d,e;if(ej=tf.select(wf),ej.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ej.html(""),ej.classed("c3",!0),uf.data.xs={},uf.data.targets=vc(b),n(),R(),fg.domain(tf.extent(_b(uf.data.targets))),gg.domain(Xb(uf.data.targets,"y")),hg.domain(Xb(uf.data.targets,"y2")),ig.domain(fg.domain()),jg.domain(gg.domain()),kg.domain(hg.domain()),fj=fg.domain(),Vi.scale(ig),Bf&&Zi.scale(fg),$i=ej.append("svg").attr("width",Mf+Jf.left+Jf.right).attr("height",Of+Jf.top+Jf.bottom).on("mouseenter",Ef).on("mouseleave",Ff),_i=$i.append("defs"),_i.append("clipPath").attr("id",pi).append("rect").attr("width",Mf).attr("height",Of),_i.append("clipPath").attr("id",qi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),_i.append("clipPath").attr("id",ri).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),aj=$i.append("g").attr("transform",Mi.main),bj=Pg?$i.append("g").attr("transform",Mi.context):null,cj=$i.append("g").attr("transform",Mi.legend),Sg||(cj.style("visibility","hidden"),Hi=Cc(uf.data.targets)),dj=tf.select(wf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),of(Cc(uf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Zg&&aj.append("g").attr("class",f.axisX).attr("clip-path",ti).attr("transform",Mi.x).append("text").attr("class",f.axisXLabel).attr("transform",Yg?"rotate(-90)":"").style("text-anchor",zb),ph&&aj.append("g").attr("class",f.axisY).attr("clip-path",ui).attr("transform",Mi.y).append("text").attr("class",f.axisYLabel).attr("transform",Yg?"":"rotate(-90)").style("text-anchor",Ab),yh&&aj.append("g").attr("class",f.axisY2).attr("transform",Mi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Yg?"":"rotate(-90)").style("text-anchor",Bb),d=aj.append("g").attr("clip-path",si).attr("class",f.grid),Hh&&d.append("g").attr("class",f.xgrids),te(Jh)&&d.append("g").attr("class",f.xgridLines),Ph&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Kh&&d.append("g").attr("class",f.ygrids),te(Lh)&&d.append("g").attr("class",f.ygridLines),aj.append("g").attr("clip-path",si).attr("class",f.regions),aj.append("g").attr("clip-path",si).attr("class",f.chart),c=aj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Bf?Yg?"ns-resize":"ew-resize":null),aj.select("."+f.chart).append("g").attr("class",f.chartBars),aj.select("."+f.chart).append("g").attr("class",f.chartLines),aj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Mi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),aj.select("."+f.chart).append("g").attr("class",f.chartTexts),Bf&&aj.insert("rect",Df?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Mf).attr("height",Of).style("opacity",0).style("cursor",Yg?"ns-resize":"ew-resize").call(Zi).on("dblclick.zoom",null),nh&&Vi.extent("function"!=typeof nh?nh:nh(_b())),Pg&&(bj.append("g").attr("clip-path",si).attr("class",f.chart),bj.select("."+f.chart).append("g").attr("class",f.chartBars),bj.select("."+f.chart).append("g").attr("class",f.chartLines),bj.append("g").attr("clip-path",si).attr("class",f.brush).call(Vi).selectAll("rect").attr(Yg?"width":"height",Yg?Nf:Pf),bj.append("g").attr("class",f.axisX).attr("transform",Mi.subx).attr("clip-path",Yg?"":ti)),bf(uf.data.targets),Yg?aj.select("."+f.axisX).style("opacity",0).call(lg):(aj.select("."+f.axisY).style("opacity",0).call(mg),aj.select("."+f.axisY2).style("opacity",0).call(ng)),n(),R(),_e(),m(),Xe({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),mi){if(vi&&"string"==typeof ni){for(ni=oe(ni),e=0;e0){d=[];for(var g in tg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Id(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ce,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 Ve(a){be(uf.data.targets)||Eg&&(yi=a,aj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),zi=!0,Ng())}function We(){be(uf.data.targets)||Eg&&(aj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),aj.selectAll("."+f.shape).classed(f.INCLUDED,!1),zi=!1,Og())}function Xe(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U=Sd(),V=be(uf.data.targets),W=Ic(uf.data.targets);if(0!==W.length){if(a=d(a)?a:{},z=d(a.withY)?a.withY:!0,A=d(a.withSubchart)?a.withSubchart:!0,B=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,C=d(a.withTransitionForExit)?a.withTransitionForExit:B,D=d(a.withTransitionForAxis)?a.withTransitionForAxis:B,E=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:B,O=B?If:0,P=C?O:0,Q=D?O:0,I&&Sg&&of(Cc(uf.data.targets),a),H&&(fg.domain(tf.extent(_b(W))),fj=fg.domain(),Bf&&Zi.scale(fg).updateScaleExtent(),ig.domain(fg.domain()),Vi.scale(ig)),G&&(fg.domain(Vi.empty()?fj:Vi.extent()),Bf&&Zi.scale(fg).updateScaleExtent()),gg.domain(Xb(W,"y")),hg.domain(Xb(W,"y2")),(gh||fh)&&(R=hh?hh:Kc(Jc(W)),lg.tickValues(R),og.tickValues(R)),c=aj.select("."+f.axisX).style("opacity",V?0:1),(Yg||E)&&(c=c.transition().duration(Q)),c.call(lg),g=aj.select("."+f.axisY).style("opacity",V?0:1),(!Yg||E)&&(g=g.transition().duration(Q)),g.call(mg),aj.select("."+f.axisY2).style("opacity",V?0:1).transition().duration(Q).call(ng),G)if(dh&&R){for(S=1;S=0&&tf.select(this).style("display",b%T?"none":"block")})}else tf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!Yg&&ih&&eb(c),J=Ke(U),M=Le(U,!0),N=Le(U,!1),Db(),jg.domain(gg.domain()),kg.domain(hg.domain()),dj.style("display","none"),o(),aj.select("line."+f.xgridFocus).style("visibility","hidden"),Hh){if("year"===Ih){i=[];for(var X=_b(),Y=X[0].getFullYear(),Z=X[1].getFullYear(),$=Y;Z>=$;$++)i.push(new Date($+"-01-01 00:00:00"))}else i=fg.ticks(10);h=aj.select("."+f.xgrids).selectAll("."+f.xgrid).data(i),h.enter().append("line").attr("class",f.xgrid),h.attr("x1",Yg?0:function(a){return fg(a)-lg.tickOffset()}).attr("x2",Yg?Mf:function(a){return fg(a)-lg.tickOffset()}).attr("y1",Yg?function(a){return fg(a)-lg.tickOffset()}:Jf.top).attr("y2",Yg?function(a){return fg(a)-lg.tickOffset()}:Of).style("opacity",function(){return+tf.select(this).attr(Yg?"y1":"x1")===(Yg?Of:0)?0:1}),h.exit().remove()}te(Jh)&&(j=aj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Jh),k=j.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),k.append("line").style("opacity",0),k.append("text").attr("text-anchor","end").attr("transform",Yg?"":"rotate(-90)").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),j.select("line").transition().duration(O).attr("x1",Yg?0:Ad).attr("x2",Yg?Mf:Ad).attr("y1",Yg?Ad:Jf.top).attr("y2",Yg?Ad:Of).style("opacity",1),j.select("text").transition().duration(O).attr("x",Yg?Mf:0).attr("y",Ad).text(function(a){return a.text}).style("opacity",1),j.exit().transition().duration(O).style("opacity",0).remove()),z&&Kh&&(l=aj.select("."+f.ygrids).selectAll("."+f.ygrid).data(gg.ticks(Mh)),l.enter().append("line").attr("class",f.ygrid),l.attr("x1",Yg?gg:0).attr("x2",Yg?gg:Mf).attr("y1",Yg?0:gg).attr("y2",Yg?Of:gg),l.exit().remove()),z&&te(Lh)&&(m=aj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Lh),n=m.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),n.append("line").style("opacity",0),n.append("text").attr("text-anchor","end").attr("transform",Yg?"rotate(-90)":"").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),m.select("line").transition().duration(O).attr("x1",Yg?Bd:0).attr("x2",Yg?Bd:Mf).attr("y1",Yg?0:Bd).attr("y2",Yg?Of:Bd).style("opacity",1),m.select("text").transition().duration(O).attr("x",Yg?0:Mf).attr("y",Bd).text(function(a){return a.text}).style("opacity",1),m.exit().transition().duration(O).style("opacity",0).remove()),q=aj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),q.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Di(a)}).attr("class",ad),q.style("opacity",qd).transition().duration(O).attr("d",J).style("opacity",1),q.exit().transition().duration(P).style("opacity",0).remove(),s=aj.selectAll("."+f.texts).selectAll("."+f.text).data(le),s.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return Yg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),s.text(function(a){return yd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(O).attr("x",M).attr("y",N).style("fill-opacity",td),s.exit().transition().duration(P).style("fill-opacity",0).remove(),aj.selectAll("."+f.line).style("opacity",qd).transition().duration(O).attr("d",Wi).style("opacity",1),aj.selectAll("."+f.area).style("opacity",0).transition().duration(O).attr("d",Xi).style("opacity",gj),p=aj.selectAll("."+f.circles).selectAll("."+f.circle).data(ke),p.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Oh),p.style("opacity",qd).transition().duration(O).style("opacity",sd).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),p.exit().remove(),aj.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(O).attrTween("d",function(a){var b,c=Fb(a);return c?(b=tf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1),aj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(O).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&ie(a.data)?1:0}),aj.select("."+f.chartArcsTitle).style("opacity",ae(uf.data.targets)?1:0),Pg&&(null!==tf.event&&"zoom"===tf.event.type&&Vi.extent(fg.orgDomain()).update(),A&&(e=bj.select("."+f.axisX).style("opacity",V?0:1),(Yg||E)&&(e=e.transition().duration(Q)),e.call(og),!Yg&&ih&&eb(e),Vi.empty()||Vi.extent(fg.orgDomain()).update(),K=Ke(U,!0),t=bj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),t.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Di(a)}).attr("class",ad),t.style("opacity",qd).transition().duration(O).attr("d",K).style("opacity",1),t.exit().transition().duration(O).style("opacity",0).remove(),bj.selectAll("."+f.line).style("opacity",qd).transition().duration(O).attr("d",Yi).style("opacity",1))),aj.selectAll("."+f.selectedCircles).filter(function(a){return ee(a)}).selectAll("circle").remove(),aj.selectAll("."+f.selectedCircle).transition().duration(O).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),u=aj.select("."+f.eventRects),te(qg)&&!oc(qg)?(u.classed(f.eventRectsMultiple)||u.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),v=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Se(v.enter()),v.attr("x",0).attr("y",0).attr("width",Mf).attr("height",Of)):(u.classed(f.eventRectsSingle)||u.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),xi&&!wi?(y=function(a,b){var c=xc(b),d=yc(b),e=uf.data.xs[a.id][b];return(fg(d?d:e+50)-fg(c?c:e-50))/2},x=function(a,b){var c=xc(b),d=uf.data.xs[a.id][b];return(fg(d)+fg(c?c:d-50))/2}):(y=L(),x=function(a){return fg(a.x)-y/2}),w=Ac(uf.data.targets),aj.select("."+f.eventRects).datum(w?w.values:[]),v=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Re(v.enter()),v.attr("class",fd).attr("x",Yg?0:x).attr("y",Yg?x:0).attr("width",Yg?Mf:y).attr("height",Yg?y:Of),v.exit().remove()),r=aj.select("."+f.regions).selectAll("rect."+f.region).data(hi),r.enter().append("rect").style("fill-opacity",0),r.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(O).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Cc(uf.data.targets).forEach(function(a){hj[a]=!0})}}function Ye(){Xe({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ze(){return"mousemove"===tf.event.sourceEvent.type&&Zi.altDomain?(fg.domain(Zi.altDomain),void Zi.scale(fg).updateScaleExtent()):(wi&&fg.orgDomain()[0]===fj[0]&&fg.domain([fj[0]-1e-10,fg.orgDomain()[1]]),Xe({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===tf.event.sourceEvent.type&&(Ai=!0)))}function $e(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function _e(){$i.attr("width",Qf).attr("height",Rf),$i.select("#"+pi).select("rect").attr("width",Mf).attr("height",Of),$i.select("#"+qi).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),$i.select("#"+ri).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),$i.select("."+f.zoomRect).attr("width",Mf).attr("height",Of),ej.style("max-height",Rf+"px")}function af(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),_e(),m(a.withTransition),Xe(a)}function bf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=aj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Di(a)}),e=aj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("fill",function(a){return Di(a)}).style("stroke","none").style("cursor",function(a){return Gg(a)?"pointer":null}),c=aj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)}),b.append("path").attr("class",dd).style("opacity",function(){return gj=+tf.select(this).style("opacity"),0}).style("fill",function(a){return Di(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Di(a)}).style("cursor",function(a){return Gg(a)?"pointer":null}),a.forEach(function(a){aj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=aj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Yf(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Di(a.data)}).style("cursor",function(a){return Gg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Fb(a),d=Lb(c),e=Tb();Nb(c.data.id),jf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Fb(a),c=[Lb(b)];Md(c,tf.mouse(this))}).on("mouseout",function(a,b){var c=Fb(a),d=Lb(c),e=Ub();Ob(c.data.id),lf(),Nd(),e(d,b)}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Pg&&(n=bj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Di(a)}),l=bj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)})),$i.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function cf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Xd(a.id,b.types[a.id]):Xd(a.id,b.type)}),uf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Ni?j:i,l=Ni?Q():P();return d&&(w=0,C=0,t=0,u=0),Sg&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Ni?u:t,void(Xg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,Ni?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=cj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Ug?Ug(a):uf.toggle(a)}).on("mouseover",function(a){uf.focus(a),"function"==typeof Vg&&Vg(a)}).on("mouseout",function(a){uf.revert(),"function"==typeof Wg&&Wg(a)}),l.append("text").text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",Ni?g:-200).attr("y",Ni?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ni?h:-200).attr("y",Ni?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Di(a)}).attr("x",Ni?g:-200).attr("y",Ni?-200:i).attr("width",10).attr("height",10),cj.selectAll("text").data(a).text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),cj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),cj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),_e(),q&&m(p)}function pf(a){return Ec(uf.data.targets,a.id)}function qf(a){return"data"in a&&Ec(uf.data.targets,a.data.id)}function rf(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 sf(a,b,c){var d=!be(uf.data.targets);Xd(a,b),af(c?c:{withTransitionForAxis:d})}var tf=a.d3?a.d3:a.require?a.require("d3"):void 0,uf={data:{},axis:{},legend:{}},vf={},wf=h(["bindto"],"#chart"),xf=h(["size","width"]),yf=h(["size","height"]),zf=h(["padding","left"]),Af=h(["padding","right"]),Bf=h(["zoom","enabled"],!1),Cf=h(["zoom","extent"]),Df=h(["zoom","privileged"],!1),Ef=h(["onenter"],function(){}),Ff=h(["onleave"],function(){}),Gf=h(["onresize"],function(){}),Hf=h(["onresized"],function(){}),If=h(["transition","duration"],350);g("data","data is required in config");var Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg=h(["data","x"]),qg=h(["data","xs"],{}),rg=h(["data","x_format"]),sg=h(["data","id_converter"],function(a){return a}),tg=h(["data","names"],{}),ug=h(["data","classes"],{}),vg=h(["data","groups"],[]),wg=h(["data","axes"],{}),xg=h(["data","type"]),yg=h(["data","types"],{}),zg=h(["data","labels"],{}),Ag=h(["data","order"]),Bg=h(["data","regions"],{}),Cg=h(["data","color"]),Dg=h(["data","colors"],{}),Eg=h(["data","selection","enabled"],!1),Fg=h(["data","selection","grouped"],!1),Gg=h(["data","selection","isselectable"],function(){return!0}),Hg=h(["data","selection","multiple"],!0),Ig=h(["data","onclick"],function(){}),Jg=h(["data","onenter"],function(){}),Kg=h(["data","onleave"],function(){}),Lg=h(["data","onselected"],function(){}),Mg=h(["data","onunselected"],function(){}),Ng=h(["data","ondragstart"],function(){}),Og=h(["data","ondragend"],function(){}),Pg=h(["subchart","show"],!1),Qg=h(["subchart","size","height"],60),Rg=h(["color","pattern"],[]),Sg=h(["legend","show"],!0),Tg=h(["legend","position"],"bottom"),Ug=h(["legend","item","onclick"]),Vg=h(["legend","item","onmouseover"]),Wg=h(["legend","item","onmouseout"]),Xg=h(["legend","equally"],!1),Yg=h(["axis","rotated"],!1),Zg=h(["axis","x","show"],!0),$g=h(["axis","x","type"],"indexed"),_g=h(["axis","x","localtime"],!0),ah=h(["axis","x","categories"],[]),bh=h(["axis","x","tick","centered"],!1),ch=h(["axis","x","tick","format"]),dh=h(["axis","x","tick","culling"],{}),eh=h(["axis","x","tick","culling","max"],10),fh=h(["axis","x","tick","count"]),gh=h(["axis","x","tick","fit"],!0),hh=h(["axis","x","tick","values"],null),ih=h(["axis","x","tick","rotate"]),jh=h(["axis","x","max"],null),kh=h(["axis","x","min"],null),lh=h(["axis","x","padding"],{}),mh=h(["axis","x","height"]),nh=h(["axis","x","default"]),oh=h(["axis","x","label"],{}),ph=h(["axis","y","show"],!0),qh=h(["axis","y","max"]),rh=h(["axis","y","min"]),sh=h(["axis","y","center"]),th=h(["axis","y","label"],{}),uh=h(["axis","y","inner"],!1),vh=h(["axis","y","tick","format"]),wh=h(["axis","y","padding"],{}),xh=h(["axis","y","ticks"],10),yh=h(["axis","y2","show"],!1),zh=h(["axis","y2","max"]),Ah=h(["axis","y2","min"]),Bh=h(["axis","y2","center"]),Ch=h(["axis","y2","label"],{}),Dh=h(["axis","y2","inner"],!1),Eh=h(["axis","y2","tick","format"]),Fh=h(["axis","y2","padding"],{}),Gh=h(["axis","y2","ticks"],10),Hh=h(["grid","x","show"],!1),Ih=h(["grid","x","type"],"tick"),Jh=h(["grid","x","lines"],[]),Kh=h(["grid","y","show"],!1),Lh=h(["grid","y","lines"],[]),Mh=h(["grid","y","ticks"],10),Nh=h(["point","show"],!0),Oh=Nh?h(["point","r"],2.5):0,Ph=h(["point","focus","line","enabled"],!0),Qh=h(["point","focus","expand","enabled"],!0),Rh=h(["point","focus","expand","r"],Qh?4:Oh),Sh=h(["point","focus","select","r"],8),Th=h(["line","connect_null"],!1),Uh=h(["bar","width"]),Vh=h(["bar","width","ratio"],.6),Wh=h(["pie","label","show"],!0),Xh=h(["pie","label","format"]),Yh=h(["pie","expand"],!0),Zh=h(["pie","onclick"],function(){}),$h=h(["pie","onmouseover"],function(){}),_h=h(["pie","onmouseout"],function(){}),ai=h(["donut","label","show"],!0),bi=h(["donut","label","format"]),ci=h(["donut","expand"],!0),di=h(["donut","title"],""),ei=h(["donut","onclick"],function(){}),fi=h(["donut","onmouseover"],function(){}),gi=h(["donut","onmouseout"],function(){}),hi=h(["regions"],[]),ii=h(["tooltip","show"],!0),ji=h(["tooltip","format","title"]),ki=h(["tooltip","format","value"]),li=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ji?ji:b,l=ki?ki: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+""}),mi=h(["tooltip","init","show"],!1),ni=h(["tooltip","init","x"],0),oi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),pi=("string"==typeof wf?wf.replace("#",""):wf.id)+"-clip",qi=pi+"-xaxis",ri=pi+"-yaxis",si=i(pi),ti=i(qi),ui=i(ri),vi="timeseries"===$g,wi="categorized"===$g,xi=!vi&&(pg||te(qg)),yi=null,zi=!1,Ai=!1,Bi=!1,Ci=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Di=ne(Dg,te(Rg)?Rg:Ci,Cg),Ei=_g?tf.time.format:tf.time.format.utc,Fi=function(){var a=[[Ei("%Y/%-m/%-d"),function(){return!0}],[Ei("%-m/%-d"),function(a){return a.getMonth()}],[Ei("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ei("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ei("%I %p"),function(a){return a.getHours()}],[Ei("%I:%M"),function(a){return a.getMinutes()}],[Ei(":%S"),function(a){return a.getSeconds()}],[Ei(".%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)}}(),Gi=[],Hi=[],Ii=Yg?"left":"bottom",Ji=Yg?uh?"top":"bottom":uh?"right":"left",Ki=Yg?Dh?"bottom":"top":Dh?"left":"right",Li=Yg?"left":"bottom",Mi={main:function(){return"translate("+Jf.left+","+Jf.top+")"},context:function(){return"translate("+Kf.left+","+Kf.top+")"},legend:function(){return"translate("+Lf.left+","+Lf.top+")"},x:function(){return"translate(0,"+(Yg?0:Of)+")"},y:function(){return"translate(0,"+(Yg?Of:0)+")"},y2:function(){return"translate("+(Yg?0:Mf)+","+(Yg?1:0)+")"},subx:function(){return"translate(0,"+(Yg?0:Pf)+")"},arc:function(){return"translate("+Mf/2+","+Of/2+")"}},Ni="right"===Tg,Oi=0,Pi=0,Qi=0,Ri=.15,Si=30,Ti=Yg&&!Zg?0:30,Ui=5;Yf=tf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Vi,Wi=function(){var a=tf.svg.line().x(Yg?function(a){return V(a.id)(a.value)}:zd).y(Yg?zd:function(a){return V(a.id)(a.value)});return Th||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Th?De(b.values):b.values;return ce(b)?(a.interpolate(de(b)?"cardinal":"linear"),Bg[b.id]?Pe(e,fg,V(b.id),Bg[b.id]):a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Xi=function(){var a;return a=Yg?tf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(zd):tf.svg.area().x(zd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=De(b.values);return Yd([b],"area")||Yd([b],"area-spline")?(a.interpolate(de(b)?"cardinal":"linear"),a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Yi=function(){var a=tf.svg.line().x(Yg?function(a){return W(a.id)(a.value)}:Cd).y(Yg?Cd:function(a){return W(a.id)(a.value)});return function(b){var c=De(b.values);return ce(b)?a(c):"M "+ig(c[0].x)+" "+W(b.id)(c[0].value)}}(),Zi=function(){};Vi=tf.svg.brush().on("brush",Ye),Vi.update=function(){return bj&&bj.select("."+f.brush).call(this),this},Vi.scale=function(a){return Yg?this.y(a):this.x(a)},Bf&&(Zi=tf.behavior.zoom().on("zoomstart",function(){Zi.altDomain=tf.event.sourceEvent.altKey?fg.orgDomain():null}).on("zoom",Bf?Ze:null),Zi.scale=function(a){return Yg?this.y(a):this.x(a)},Zi.orgScaleExtent=function(){var a=Cf?Cf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},Zi.updateScaleExtent=function(){var a=ac(fg.orgDomain())/ac(fj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var $i,_i,aj,bj,cj,dj,ej,fj,gj,hj={};if(uf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),uf.defocus(),b(d.classed(f.focused,!0)),b(e),be(uf.data.targets)&&Nb(a,!0),jf(a)},uf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),kf(a)},uf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),lf()},uf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),$i.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?mf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},uf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),$i.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?nf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Ri),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},uf.toggle=function(a){Gc(a)?uf.hide(a):uf.show(a)},uf.unzoom=function(){Vi.clear().update(),Xe({withUpdateXDomain:!0})},uf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){ug[b]=a.classes[b]}),"categories"in a&&wi&&(ah=a.categories,lg.categories(ah)),"cacheIds"in a&&bc(a.cacheIds)?void cf(dc(a.cacheIds),a.done):void("unload"in a?ef(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){df(a)}):df(a))},uf.unload=function(a){ef(Dc(a),function(){Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},uf.selected=function(a){return tf.merge(aj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return tf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},uf.select=function(a,b,c){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=tf.select(this),i="circle"===this.nodeName?xe:Ae,j="circle"===this.nodeName?ye:Be,k=Fg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Gg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},uf.unselect=function(a,b){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=tf.select(this),g="circle"===this.nodeName?ye:Be,h=Fg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Gg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},uf.toLine=function(a){sf(a,"line")},uf.toSpline=function(a){sf(a,"spline")},uf.toBar=function(a){sf(a,"bar")},uf.toScatter=function(a){sf(a,"scatter")},uf.toArea=function(a){sf(a,"area")},uf.toAreaSpline=function(a){sf(a,"area-spline")},uf.toPie=function(a){sf(a,"pie",{withTransform:!0})},uf.toDonut=function(a){sf(a,"donut",{withTransform:!0})},uf.groups=function(a){return c(a)?vg:(vg=a,Xe(),vg)},uf.xgrids=function(a){return a?(Jh=a,Xe(),Jh):Jh},uf.xgrids.add=function(a){return a?uf.xgrids(Jh.concat(a)):void 0},uf.xgrids.remove=function(a){var b=rf(a);return uf.xgrids(Jh.filter(b))},uf.ygrids=function(a){return a?(Lh=a,Xe(),Lh):Lh +},uf.ygrids.add=function(a){return a?uf.ygrids(Lh.concat(a)):void 0},uf.ygrids.remove=function(a){var b=rf(a);return uf.ygrids(Lh.filter(b))},uf.regions=function(a){return c(a)?hi:(hi=a,Xe(),hi)},uf.regions.add=function(a){return c(a)?hi:(hi=hi.concat(a),Xe(),hi)},uf.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;$i.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),hi=hi.filter(function(b){return b.classes.indexOf(a)<0})}),hi},uf.data.get=function(a){var b=uf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},uf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},uf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){tg[b]=a[b]}),of(Cc(uf.data.targets),{withTransition:!0}),tg):tg},uf.x=function(a){return arguments.length&&(qc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.xs=function(a){return arguments.length&&(rc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},uf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(qh=+a.y),b(a.y2)&&(zh=+a.y2)):qh=zh=+a,Xe())},uf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(rh=+a.y),b(a.y2)&&(Ah=+a.y2)):rh=Ah=+a,Xe())},uf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&uf.axis.max(a.max),"undefined"!=typeof a.min&&uf.axis.min(a.min))},uf.legend.show=function(a){Sg||(Sg=!0,cj.style("visibility","visible")),mf(Dc(a)),Xe({withTransitionForHorizontalAxis:!1})},uf.legend.hide=function(a){Sg&&se(a)&&(Sg=!1,cj.style("visibility","hidden")),nf(Dc(a)),Xe({withTransitionForHorizontalAxis:!1})},uf.resize=function(a){xf=a?a.width:null,yf=a?a.height:null,af({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},uf.destroy=function(){uf.data.targets=void 0,uf.data.xs={},ej.html(""),a.onresize=null},"url"in e.data)tf.xhr(e.data.url,function(a,b){var c,d=tf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=tf.csv.parse(b.response),Qe(c)});else if("rows"in e.data)Qe(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Qe(uc(e.data.columns))}return uf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From ed8f8888931d573f1d6c12f1fe57e3a253cae50e Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Sat, 26 Apr 2014 21:19:49 +0900 Subject: [PATCH 066/178] Hide tooltip when hidden on custom xs - #154 --- c3.js | 16 +++++++++++----- c3.min.js | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/c3.js b/c3.js index ed6092d..0255f14 100644 --- a/c3.js +++ b/c3.js @@ -2894,18 +2894,21 @@ unexpandCircles(); }) .on('mousemove', function () { + var targetsToShow = filterTargetsToShow(c3.data.targets); var mouse, closest, sameXData, selectedData; if (dragging) { return; } // do nothing when dragging - if (hasArcType(c3.data.targets)) { return; } + if (hasArcType(targetsToShow)) { return; } mouse = d3.mouse(this); - closest = findClosestFromTargets(c3.data.targets, mouse); + closest = findClosestFromTargets(targetsToShow, mouse); + + if (! closest) { return; } if (isScatterType(closest)) { sameXData = [closest]; } else { - sameXData = filterSameX(c3.data.targets, closest.x); + sameXData = filterSameX(targetsToShow, closest.x); } // show tooltip when cursor is close to some point @@ -2937,12 +2940,15 @@ } }) .on('click', function () { + var targetsToShow = filterTargetsToShow(c3.data.targets); var mouse, closest; - if (hasArcType(c3.data.targets)) { return; } + if (hasArcType(targetsToShow)) { return; } mouse = d3.mouse(this); - closest = findClosestFromTargets(c3.data.targets, mouse); + closest = findClosestFromTargets(targetsToShow, mouse); + + if (! closest) { return; } // select if selection enabled if (dist(closest, mouse) < 100) { diff --git a/c3.min.js b/c3.min.js index d88c2b5..95cd973 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ !function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.32"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cMf&&(Mf=0),0>Of&&(Of=0),Nf=Yg?Jf.left-Si-Ti:Mf,Pf=Yg?Of:Rf-Kf.top-Kf.bottom,0>Nf&&(Nf=0),0>Pf&&(Pf=0),p(),Ni&&be(uf.data.targets)&&(Lf.left=Mf/2+Tf)}function o(){aj.select("line."+f.xgridFocus).attr("x1",Yg?0:-10).attr("x2",Yg?Mf:-10).attr("y1",Yg?-10:Jf.top).attr("y2",Yg?-10:Of)}function p(){Tf=Of/2,Sf=.95*Tf,Uf=ae(uf.data.targets)?.6*Sf:0}function q(){var a=Yg?f.axisX:f.axisY,b=tf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=tf.select(wf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return xf?xf:x()}function s(){var a=yf?yf:y();return a>0?a:320}function t(){return be(uf.data.targets)?0:zf?zf:Yg?Zg?v("x"):1:!ph||uh?1:v("y")}function u(){var a=1;return be(uf.data.targets)?0:Af?Af:Ni?P()+(yh&&!Yg?v("y2"):a):yh?Dh||Yg?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||Zg?"x"===a&&mh?mh:"y"!==a||ph?"y2"!==a||yh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Ui:Sg&&!Ni?10:1:0}function x(){return+tf.select(wf).style("width").replace("px","")}function y(){return+tf.select(wf).style("height").replace("px","")}function z(a){return a?-5:-(Jf.left-1)}function A(a){return a?-20:-4}function B(){return z(!Yg)}function C(){return A(!Yg)}function D(){return z(Yg)}function E(){return A(Yg)}function F(a){return a?Mf+2+4:Jf.left+20}function G(a){return a?(mh?mh:0)+80:Of+8}function H(){return F(!Yg)}function I(){return G(!Yg)}function J(){return F(Yg)}function K(){return G(Yg)}function L(){var a=Ac(uf.data.targets),b=a.values[0],c=a.values[a.values.length-1],d=fg(c.x)-fg(b.x),e=zc(),f=Zd(uf.data.targets)?(e-(wi?.25:1))/e:1;return e>1?d*f/(e-1):d}function M(a){Oi=a}function N(a){Pi=a}function O(a){Qi=a}function P(){return Sg?Ni?Pi*(Oi+1):Qf:0}function Q(){return Sg?Ni?Rf:Qi*(Oi+1):0}function R(){var a,b=!fg;Zf=Yg?1:0,$f=Yg?Of:Mf,_f=Yg?0:Of,ag=Yg?Mf:1,bg=Zf,cg=$f,dg=Yg?0:Pf,eg=Yg?Nf:1,fg=T(Zf,$f,b?void 0:fg.domain(),function(){return lg.tickOffset()}),gg=U(_f,ag,b?void 0:gg.domain()),hg=U(_f,ag,b?void 0:hg.domain()),ig=T(Zf,$f,fj,function(a){return a%1?0:og.tickOffset()}),jg=U(dg,eg,b?void 0:jg.domain()),kg=U(dg,eg,b?void 0:kg.domain()),a=$(),lg=X(fg,Ii,a),og=X(ig,Li,a),mg=Y(gg,Ji,vh,xh),ng=Y(hg,Ki,Eh,Gh),b||(Vi.scale(ig),Bf&&Zi.scale(fg)),S()}function S(){Vf=Gb(),Wf=Hb(),Xf=Hb(.98)}function T(a,b,d,e){var f=(vi?tf.time.scale():tf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),wi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=tf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?hg:gg}function W(a){return"y2"===Z(a)?kg:jg}function X(a,b,c){var d=(wi?Eb():tf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),wi?(d.tickCentered(bh),se(dh)&&(dh=!1)):d.tickOffset=function(){var a=Bc(uf.data.targets),b=fg(a[1])-fg(a[0]);return b/zc()/2},wi&&d.categories(ah),d}function Y(a,b,c,d){return tf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in wg?wg[a]:"y"}function $(){var a=vi?Fi:wi?Tc:function(a){return 0>a?a.toFixed(0):a};return ch&&("function"==typeof ch?a=ch:vi&&(a=function(a){return a?Ei(ch)(a):""})),a}function _(a){var b;return"y"===a?b=th:"y2"===a?b=Ch:"x"===a&&(b=oh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?th=b:"y2"===a?Ch=b:"x"===a&&(oh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a){a.selectAll(".tick text").attr("y",db(ih)).attr("x",cb(ih)).attr("transform","rotate("+ih+")").style("text-anchor","start")}function fb(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 gb(){return fb("x",Yg?"inner-top":"inner-right")}function hb(){return fb("y",Yg?"inner-right":"inner-top")}function ib(){return fb("y2",Yg?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Mf/2:Mf:b.isBottom?-Of:b.isMiddle?-Of/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!Yg,gb())}function rb(){return nb(Yg,hb())}function sb(){return nb(Yg,ib())}function tb(){return ob(!Yg,gb())}function ub(){return ob(Yg,hb())}function vb(){return ob(Yg,ib())}function wb(){var a=gb();return Yg?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":mh?mh-10:"3em"}function xb(){var a=hb();return Yg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return Yg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!Yg,gb())}function Ab(){return pb(Yg,hb())}function Bb(){return pb(Yg,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return tf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?30:b}function Db(){aj.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),aj.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),aj.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+o)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Rc(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 tf.min(Object.keys(i).map(function(a){return tf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(vg.length>0)for(g=Sc(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 tf.max(Object.keys(i).map(function(a){return tf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Ah:rh,n="y2"===c?zh:qh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Bh:sh,r=ud()&&Yg;return 0===l.length?"y2"===c?hg.domain():gg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(gg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&wh&&(f=b(wh.top)?wh.top:e,g=b(wh.bottom)?wh.bottom:e),"y2"===c&&Fh&&(f=b(Fh.top)?Fh.top:e,g=b(Fh.bottom)?Fh.bottom:e),Zd(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return kh?vi?oe(kh):kh:tf.min(a,function(a){return tf.min(a.values,function(a){return a.x})})}function Zb(a){return jh?vi?oe(jh):jh:tf.max(a,function(a){return tf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return wi?d=0:Zd(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof lh&&te(lh)?(e=b(lh.left)?lh.left:d,f=b(lh.right)?lh.right:d):e=f="number"==typeof lh?lh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?gg:hg;return b="y"===a.axis||"y2"===a.axis?Yg?Of:"start"in a?d(a.start):Of:Yg?"end"in a?fg(vi?oe(a.end):a.end):Of:Of,c>b?0:b-c}function ic(a){return pg&&a===pg||te(qg)&&ue(qg,a)}function jc(a){return!ic(a)}function kc(a){return pg?pg:te(qg)?qg[a]:null}function lc(a,b){var c,d=b&&te(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=uf.data.xs[b])}),c}function mc(a,b){return a in uf.data.xs&&uf.data.xs[a]&&uf.data.xs[a][b]?uf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){qg[b]=a[b]})}function oc(a){return 1===tf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=tg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),uf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,b,c){var d;return d=vi?a?a instanceof Date?a:oe(a):oe(mc(b,c)):xi&&!wi?a?+a:mc(b,c):c}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?uf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):pg?(d=Object.keys(uf.data.xs),uf.data.xs[c]=d.length>0?uf.data.xs[d[0]]:void 0):te(qg)&&(uf.data.xs[c]=lc(f,uf.data.targets)):uf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!uf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=sg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return xi&&wi&&0===c&&g&&(0===e&&(ah=[]),ah.push(g)),("undefined"==typeof a[b]||uf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),xg&&Xd(Cc(c).filter(function(a){return!(a in yg)}),xg),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&uf.data.targets[0].values[a-1]?uf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b=Ac(a),c=b.values[0],d=b.values[b.values.length-1];return[c.x,d.x]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(uf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(vi?new Date(h):h);i.push(d)}return vi||(i=i.sort(function(a,b){return a-b})),i}function Lc(a){Gi=Gi.concat(a)}function Mc(a){Gi=Gi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Hi=Hi.concat(a)}function Oc(a){Hi=Hi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Dd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Dd(a,g))),Gd(e,b)):Ed(a,b,f,g)}function Fd(a,b){var c;return c=a.map(function(a){return Ed(a.values,b)}),Gd(c,b)}function Gd(a,b){var c,d;return a.forEach(function(a){var e=ve(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Hd(a,b){return tf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Id(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 Jd(){return Ag&&"desc"===Ag.toLowerCase()}function Kd(){return Ag&&"asc"===Ag.toLowerCase()}function Ld(a){var b=Kd(),c=Jd();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 Ag&&a.sort(Ag),a}function Md(a,c){var d,e,f,g,h,i,j,k=be(uf.data.targets),l=k?xd:wd,m=a.filter(function(a){return a&&b(a.value)});ii&&0!==m.length&&(dj.html(li(a,$(),l,Di)).style("display","block"),d=dj.property("offsetWidth"),e=dj.property("offsetHeight"),k?(g=Mf/2+c[0],i=Of/2+c[1]+20):(Yg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=fg(m[0].x)+20):(f=q(),g=f+t()+fg(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),dj.style("top",i+"px").style("left",g+"px"))}function Nd(){dj.style("display","none")}function Od(a){var c=a.filter(function(a){return a&&b(a.value)});ii&&($d(uf.data.targets)||be(uf.data.targets)||aj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Yg?"y1":"x1",zd).attr(Yg?"y2":"x2",zd))}function Pd(){aj.select("line."+f.xgridFocus).style("visibility","hidden")}function Qd(a){return a.x||0===a.x?fg(a.x):null}function Rd(a){return V(a.id)(a.value)}function Sd(){var a,b,d={},e=0;return Ic(Fc(ee)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Wd(a,b){return Uh?Uh:b?2*a.tickOffset()*Vh/b:0}function Xd(a,b){Dc(a).forEach(function(a){hj[a]=b===yg[a],yg[a]=b})}function Yd(a,b){var c=!1;return a.forEach(function(a){yg[a.id]===b&&(c=!0),a.id in yg||"line"!==b||(c=!0)}),c}function Zd(a){return Yd(a,"bar")}function $d(a){return Yd(a,"scatter")}function _d(a){return Yd(a,"pie")}function ae(a){return Yd(a,"donut")}function be(a){return _d(a)||ae(a)}function ce(a){var b="string"==typeof a?a:a.id;return!(b in yg)||"line"===yg[b]||"spline"===yg[b]||"area"===yg[b]||"area-spline"===yg[b]}function de(a){var b="string"==typeof a?a:a.id;return"spline"===yg[b]||"area-spline"===yg[b]}function ee(a){var b="string"==typeof a?a:a.id;return"bar"===yg[b]}function fe(a){var b="string"==typeof a?a:a.id;return"scatter"===yg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"pie"===yg[b]}function he(a){var b="string"==typeof a?a:a.id;return"donut"===yg[b]}function ie(a){return ge(a)||he(a)}function je(a){return ee(a)?a.values:[]}function ke(a){return ce(a)||fe(a)?a.values:[]}function le(a){return ee(a)||ce(a)?a.values:[]}function me(a){return he(a)&&ci||ge(a)&&Yh}function ne(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function oe(b){var c;try{c=rg?tf.time.format(rg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+rg)}return c}function pe(a,b){var c=tf.mouse(a),d=tf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function ue(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ve(a,b){var c="y"===Z(a.id)?gg:hg,d=Yg?1:0,e=Yg?0:1;return Math.pow(fg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function we(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function xe(a,b,c){Lg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd).attr("stroke",function(){return Di(b)}).attr("r",1.4*Sh).transition().duration(100).attr("r",Sh)}function ye(a,b,c){Mg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ze(a,b,c,d){a?xe(b,c,d):ye(b,c,d)}function Ae(a,b){Lg(b,a.node()),a.transition().duration(100).style("fill",function(){return tf.rgb(Di(b)).darker(1)})}function Be(a,b){Mg(b,a.node()),a.transition().duration(100).style("fill",function(){return Di(b)})}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a){return a.filter(function(a){return b(a.value)})}function Ee(a,c){return(c?aj.selectAll("."+f.circles+ld(c)):aj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Fe(a,b){Ee(a,b).classed(f.EXPANDED,!0).attr("r",Rh)}function Ge(a){Ee(a).filter(function(){return tf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oh)}function He(a){return aj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ie(a){He(a).classed(f.EXPANDED,!0)}function Je(a){He(a).classed(f.EXPANDED,!1)}function Ke(a,b){var c=Oe(a,b);return function(a,b){var d=c(a,b),e=Yg?1:0,f=Yg?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 Le(a,b){var c=Oe(a,!1),d=b?Me:Ne;return function(a,b){return d(c(a,b),a,this)}}function Me(a,b){var c;return Yg?(c=ee(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ne(a,b,c){var d=c.getBoundingClientRect();return Yg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ee(b)?-3:-6)}function Oe(a,b){var c=a.__max__+1,d=Wd(lg,c),e=Td(d,c,a,!!b),f=Ud(!!b),g=Vd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Yg&&(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 Pe(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 Qe(b){var c,d,e;if(ej=tf.select(wf),ej.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ej.html(""),ej.classed("c3",!0),uf.data.xs={},uf.data.targets=vc(b),n(),R(),fg.domain(tf.extent(_b(uf.data.targets))),gg.domain(Xb(uf.data.targets,"y")),hg.domain(Xb(uf.data.targets,"y2")),ig.domain(fg.domain()),jg.domain(gg.domain()),kg.domain(hg.domain()),fj=fg.domain(),Vi.scale(ig),Bf&&Zi.scale(fg),$i=ej.append("svg").attr("width",Mf+Jf.left+Jf.right).attr("height",Of+Jf.top+Jf.bottom).on("mouseenter",Ef).on("mouseleave",Ff),_i=$i.append("defs"),_i.append("clipPath").attr("id",pi).append("rect").attr("width",Mf).attr("height",Of),_i.append("clipPath").attr("id",qi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),_i.append("clipPath").attr("id",ri).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),aj=$i.append("g").attr("transform",Mi.main),bj=Pg?$i.append("g").attr("transform",Mi.context):null,cj=$i.append("g").attr("transform",Mi.legend),Sg||(cj.style("visibility","hidden"),Hi=Cc(uf.data.targets)),dj=tf.select(wf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),of(Cc(uf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Zg&&aj.append("g").attr("class",f.axisX).attr("clip-path",ti).attr("transform",Mi.x).append("text").attr("class",f.axisXLabel).attr("transform",Yg?"rotate(-90)":"").style("text-anchor",zb),ph&&aj.append("g").attr("class",f.axisY).attr("clip-path",ui).attr("transform",Mi.y).append("text").attr("class",f.axisYLabel).attr("transform",Yg?"":"rotate(-90)").style("text-anchor",Ab),yh&&aj.append("g").attr("class",f.axisY2).attr("transform",Mi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Yg?"":"rotate(-90)").style("text-anchor",Bb),d=aj.append("g").attr("clip-path",si).attr("class",f.grid),Hh&&d.append("g").attr("class",f.xgrids),te(Jh)&&d.append("g").attr("class",f.xgridLines),Ph&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Kh&&d.append("g").attr("class",f.ygrids),te(Lh)&&d.append("g").attr("class",f.ygridLines),aj.append("g").attr("clip-path",si).attr("class",f.regions),aj.append("g").attr("clip-path",si).attr("class",f.chart),c=aj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Bf?Yg?"ns-resize":"ew-resize":null),aj.select("."+f.chart).append("g").attr("class",f.chartBars),aj.select("."+f.chart).append("g").attr("class",f.chartLines),aj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Mi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),aj.select("."+f.chart).append("g").attr("class",f.chartTexts),Bf&&aj.insert("rect",Df?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Mf).attr("height",Of).style("opacity",0).style("cursor",Yg?"ns-resize":"ew-resize").call(Zi).on("dblclick.zoom",null),nh&&Vi.extent("function"!=typeof nh?nh:nh(_b())),Pg&&(bj.append("g").attr("clip-path",si).attr("class",f.chart),bj.select("."+f.chart).append("g").attr("class",f.chartBars),bj.select("."+f.chart).append("g").attr("class",f.chartLines),bj.append("g").attr("clip-path",si).attr("class",f.brush).call(Vi).selectAll("rect").attr(Yg?"width":"height",Yg?Nf:Pf),bj.append("g").attr("class",f.axisX).attr("transform",Mi.subx).attr("clip-path",Yg?"":ti)),bf(uf.data.targets),Yg?aj.select("."+f.axisX).style("opacity",0).call(lg):(aj.select("."+f.axisY).style("opacity",0).call(mg),aj.select("."+f.axisY2).style("opacity",0).call(ng)),n(),R(),_e(),m(),Xe({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),mi){if(vi&&"string"==typeof ni){for(ni=oe(ni),e=0;e0){d=[];for(var g in tg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Id(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ce,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 Ve(a){be(uf.data.targets)||Eg&&(yi=a,aj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),zi=!0,Ng())}function We(){be(uf.data.targets)||Eg&&(aj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),aj.selectAll("."+f.shape).classed(f.INCLUDED,!1),zi=!1,Og())}function Xe(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U=Sd(),V=be(uf.data.targets),W=Ic(uf.data.targets);if(0!==W.length){if(a=d(a)?a:{},z=d(a.withY)?a.withY:!0,A=d(a.withSubchart)?a.withSubchart:!0,B=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,C=d(a.withTransitionForExit)?a.withTransitionForExit:B,D=d(a.withTransitionForAxis)?a.withTransitionForAxis:B,E=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:B,O=B?If:0,P=C?O:0,Q=D?O:0,I&&Sg&&of(Cc(uf.data.targets),a),H&&(fg.domain(tf.extent(_b(W))),fj=fg.domain(),Bf&&Zi.scale(fg).updateScaleExtent(),ig.domain(fg.domain()),Vi.scale(ig)),G&&(fg.domain(Vi.empty()?fj:Vi.extent()),Bf&&Zi.scale(fg).updateScaleExtent()),gg.domain(Xb(W,"y")),hg.domain(Xb(W,"y2")),(gh||fh)&&(R=hh?hh:Kc(Jc(W)),lg.tickValues(R),og.tickValues(R)),c=aj.select("."+f.axisX).style("opacity",V?0:1),(Yg||E)&&(c=c.transition().duration(Q)),c.call(lg),g=aj.select("."+f.axisY).style("opacity",V?0:1),(!Yg||E)&&(g=g.transition().duration(Q)),g.call(mg),aj.select("."+f.axisY2).style("opacity",V?0:1).transition().duration(Q).call(ng),G)if(dh&&R){for(S=1;S=0&&tf.select(this).style("display",b%T?"none":"block")})}else tf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!Yg&&ih&&eb(c),J=Ke(U),M=Le(U,!0),N=Le(U,!1),Db(),jg.domain(gg.domain()),kg.domain(hg.domain()),dj.style("display","none"),o(),aj.select("line."+f.xgridFocus).style("visibility","hidden"),Hh){if("year"===Ih){i=[];for(var X=_b(),Y=X[0].getFullYear(),Z=X[1].getFullYear(),$=Y;Z>=$;$++)i.push(new Date($+"-01-01 00:00:00"))}else i=fg.ticks(10);h=aj.select("."+f.xgrids).selectAll("."+f.xgrid).data(i),h.enter().append("line").attr("class",f.xgrid),h.attr("x1",Yg?0:function(a){return fg(a)-lg.tickOffset()}).attr("x2",Yg?Mf:function(a){return fg(a)-lg.tickOffset()}).attr("y1",Yg?function(a){return fg(a)-lg.tickOffset()}:Jf.top).attr("y2",Yg?function(a){return fg(a)-lg.tickOffset()}:Of).style("opacity",function(){return+tf.select(this).attr(Yg?"y1":"x1")===(Yg?Of:0)?0:1}),h.exit().remove()}te(Jh)&&(j=aj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Jh),k=j.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),k.append("line").style("opacity",0),k.append("text").attr("text-anchor","end").attr("transform",Yg?"":"rotate(-90)").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),j.select("line").transition().duration(O).attr("x1",Yg?0:Ad).attr("x2",Yg?Mf:Ad).attr("y1",Yg?Ad:Jf.top).attr("y2",Yg?Ad:Of).style("opacity",1),j.select("text").transition().duration(O).attr("x",Yg?Mf:0).attr("y",Ad).text(function(a){return a.text}).style("opacity",1),j.exit().transition().duration(O).style("opacity",0).remove()),z&&Kh&&(l=aj.select("."+f.ygrids).selectAll("."+f.ygrid).data(gg.ticks(Mh)),l.enter().append("line").attr("class",f.ygrid),l.attr("x1",Yg?gg:0).attr("x2",Yg?gg:Mf).attr("y1",Yg?0:gg).attr("y2",Yg?Of:gg),l.exit().remove()),z&&te(Lh)&&(m=aj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Lh),n=m.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),n.append("line").style("opacity",0),n.append("text").attr("text-anchor","end").attr("transform",Yg?"rotate(-90)":"").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),m.select("line").transition().duration(O).attr("x1",Yg?Bd:0).attr("x2",Yg?Bd:Mf).attr("y1",Yg?0:Bd).attr("y2",Yg?Of:Bd).style("opacity",1),m.select("text").transition().duration(O).attr("x",Yg?0:Mf).attr("y",Bd).text(function(a){return a.text}).style("opacity",1),m.exit().transition().duration(O).style("opacity",0).remove()),q=aj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),q.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Di(a)}).attr("class",ad),q.style("opacity",qd).transition().duration(O).attr("d",J).style("opacity",1),q.exit().transition().duration(P).style("opacity",0).remove(),s=aj.selectAll("."+f.texts).selectAll("."+f.text).data(le),s.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return Yg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),s.text(function(a){return yd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(O).attr("x",M).attr("y",N).style("fill-opacity",td),s.exit().transition().duration(P).style("fill-opacity",0).remove(),aj.selectAll("."+f.line).style("opacity",qd).transition().duration(O).attr("d",Wi).style("opacity",1),aj.selectAll("."+f.area).style("opacity",0).transition().duration(O).attr("d",Xi).style("opacity",gj),p=aj.selectAll("."+f.circles).selectAll("."+f.circle).data(ke),p.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Oh),p.style("opacity",qd).transition().duration(O).style("opacity",sd).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),p.exit().remove(),aj.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(O).attrTween("d",function(a){var b,c=Fb(a);return c?(b=tf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1),aj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(O).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&ie(a.data)?1:0}),aj.select("."+f.chartArcsTitle).style("opacity",ae(uf.data.targets)?1:0),Pg&&(null!==tf.event&&"zoom"===tf.event.type&&Vi.extent(fg.orgDomain()).update(),A&&(e=bj.select("."+f.axisX).style("opacity",V?0:1),(Yg||E)&&(e=e.transition().duration(Q)),e.call(og),!Yg&&ih&&eb(e),Vi.empty()||Vi.extent(fg.orgDomain()).update(),K=Ke(U,!0),t=bj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),t.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Di(a)}).attr("class",ad),t.style("opacity",qd).transition().duration(O).attr("d",K).style("opacity",1),t.exit().transition().duration(O).style("opacity",0).remove(),bj.selectAll("."+f.line).style("opacity",qd).transition().duration(O).attr("d",Yi).style("opacity",1))),aj.selectAll("."+f.selectedCircles).filter(function(a){return ee(a)}).selectAll("circle").remove(),aj.selectAll("."+f.selectedCircle).transition().duration(O).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),u=aj.select("."+f.eventRects),te(qg)&&!oc(qg)?(u.classed(f.eventRectsMultiple)||u.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),v=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Se(v.enter()),v.attr("x",0).attr("y",0).attr("width",Mf).attr("height",Of)):(u.classed(f.eventRectsSingle)||u.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),xi&&!wi?(y=function(a,b){var c=xc(b),d=yc(b),e=uf.data.xs[a.id][b];return(fg(d?d:e+50)-fg(c?c:e-50))/2},x=function(a,b){var c=xc(b),d=uf.data.xs[a.id][b];return(fg(d)+fg(c?c:d-50))/2}):(y=L(),x=function(a){return fg(a.x)-y/2}),w=Ac(uf.data.targets),aj.select("."+f.eventRects).datum(w?w.values:[]),v=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Re(v.enter()),v.attr("class",fd).attr("x",Yg?0:x).attr("y",Yg?x:0).attr("width",Yg?Mf:y).attr("height",Yg?y:Of),v.exit().remove()),r=aj.select("."+f.regions).selectAll("rect."+f.region).data(hi),r.enter().append("rect").style("fill-opacity",0),r.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(O).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Cc(uf.data.targets).forEach(function(a){hj[a]=!0})}}function Ye(){Xe({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ze(){return"mousemove"===tf.event.sourceEvent.type&&Zi.altDomain?(fg.domain(Zi.altDomain),void Zi.scale(fg).updateScaleExtent()):(wi&&fg.orgDomain()[0]===fj[0]&&fg.domain([fj[0]-1e-10,fg.orgDomain()[1]]),Xe({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===tf.event.sourceEvent.type&&(Ai=!0)))}function $e(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function _e(){$i.attr("width",Qf).attr("height",Rf),$i.select("#"+pi).select("rect").attr("width",Mf).attr("height",Of),$i.select("#"+qi).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),$i.select("#"+ri).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),$i.select("."+f.zoomRect).attr("width",Mf).attr("height",Of),ej.style("max-height",Rf+"px")}function af(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),_e(),m(a.withTransition),Xe(a)}function bf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=aj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Di(a)}),e=aj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("fill",function(a){return Di(a)}).style("stroke","none").style("cursor",function(a){return Gg(a)?"pointer":null}),c=aj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)}),b.append("path").attr("class",dd).style("opacity",function(){return gj=+tf.select(this).style("opacity"),0}).style("fill",function(a){return Di(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Di(a)}).style("cursor",function(a){return Gg(a)?"pointer":null}),a.forEach(function(a){aj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=aj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Yf(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Di(a.data)}).style("cursor",function(a){return Gg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Fb(a),d=Lb(c),e=Tb();Nb(c.data.id),jf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Fb(a),c=[Lb(b)];Md(c,tf.mouse(this))}).on("mouseout",function(a,b){var c=Fb(a),d=Lb(c),e=Ub();Ob(c.data.id),lf(),Nd(),e(d,b)}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Pg&&(n=bj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Di(a)}),l=bj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)})),$i.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function cf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Xd(a.id,b.types[a.id]):Xd(a.id,b.type)}),uf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Ni?j:i,l=Ni?Q():P();return d&&(w=0,C=0,t=0,u=0),Sg&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Ni?u:t,void(Xg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,Ni?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=cj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Ug?Ug(a):uf.toggle(a)}).on("mouseover",function(a){uf.focus(a),"function"==typeof Vg&&Vg(a)}).on("mouseout",function(a){uf.revert(),"function"==typeof Wg&&Wg(a)}),l.append("text").text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",Ni?g:-200).attr("y",Ni?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ni?h:-200).attr("y",Ni?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Di(a)}).attr("x",Ni?g:-200).attr("y",Ni?-200:i).attr("width",10).attr("height",10),cj.selectAll("text").data(a).text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),cj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),cj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),_e(),q&&m(p)}function pf(a){return Ec(uf.data.targets,a.id)}function qf(a){return"data"in a&&Ec(uf.data.targets,a.data.id)}function rf(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 sf(a,b,c){var d=!be(uf.data.targets);Xd(a,b),af(c?c:{withTransitionForAxis:d})}var tf=a.d3?a.d3:a.require?a.require("d3"):void 0,uf={data:{},axis:{},legend:{}},vf={},wf=h(["bindto"],"#chart"),xf=h(["size","width"]),yf=h(["size","height"]),zf=h(["padding","left"]),Af=h(["padding","right"]),Bf=h(["zoom","enabled"],!1),Cf=h(["zoom","extent"]),Df=h(["zoom","privileged"],!1),Ef=h(["onenter"],function(){}),Ff=h(["onleave"],function(){}),Gf=h(["onresize"],function(){}),Hf=h(["onresized"],function(){}),If=h(["transition","duration"],350);g("data","data is required in config");var Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg=h(["data","x"]),qg=h(["data","xs"],{}),rg=h(["data","x_format"]),sg=h(["data","id_converter"],function(a){return a}),tg=h(["data","names"],{}),ug=h(["data","classes"],{}),vg=h(["data","groups"],[]),wg=h(["data","axes"],{}),xg=h(["data","type"]),yg=h(["data","types"],{}),zg=h(["data","labels"],{}),Ag=h(["data","order"]),Bg=h(["data","regions"],{}),Cg=h(["data","color"]),Dg=h(["data","colors"],{}),Eg=h(["data","selection","enabled"],!1),Fg=h(["data","selection","grouped"],!1),Gg=h(["data","selection","isselectable"],function(){return!0}),Hg=h(["data","selection","multiple"],!0),Ig=h(["data","onclick"],function(){}),Jg=h(["data","onenter"],function(){}),Kg=h(["data","onleave"],function(){}),Lg=h(["data","onselected"],function(){}),Mg=h(["data","onunselected"],function(){}),Ng=h(["data","ondragstart"],function(){}),Og=h(["data","ondragend"],function(){}),Pg=h(["subchart","show"],!1),Qg=h(["subchart","size","height"],60),Rg=h(["color","pattern"],[]),Sg=h(["legend","show"],!0),Tg=h(["legend","position"],"bottom"),Ug=h(["legend","item","onclick"]),Vg=h(["legend","item","onmouseover"]),Wg=h(["legend","item","onmouseout"]),Xg=h(["legend","equally"],!1),Yg=h(["axis","rotated"],!1),Zg=h(["axis","x","show"],!0),$g=h(["axis","x","type"],"indexed"),_g=h(["axis","x","localtime"],!0),ah=h(["axis","x","categories"],[]),bh=h(["axis","x","tick","centered"],!1),ch=h(["axis","x","tick","format"]),dh=h(["axis","x","tick","culling"],{}),eh=h(["axis","x","tick","culling","max"],10),fh=h(["axis","x","tick","count"]),gh=h(["axis","x","tick","fit"],!0),hh=h(["axis","x","tick","values"],null),ih=h(["axis","x","tick","rotate"]),jh=h(["axis","x","max"],null),kh=h(["axis","x","min"],null),lh=h(["axis","x","padding"],{}),mh=h(["axis","x","height"]),nh=h(["axis","x","default"]),oh=h(["axis","x","label"],{}),ph=h(["axis","y","show"],!0),qh=h(["axis","y","max"]),rh=h(["axis","y","min"]),sh=h(["axis","y","center"]),th=h(["axis","y","label"],{}),uh=h(["axis","y","inner"],!1),vh=h(["axis","y","tick","format"]),wh=h(["axis","y","padding"],{}),xh=h(["axis","y","ticks"],10),yh=h(["axis","y2","show"],!1),zh=h(["axis","y2","max"]),Ah=h(["axis","y2","min"]),Bh=h(["axis","y2","center"]),Ch=h(["axis","y2","label"],{}),Dh=h(["axis","y2","inner"],!1),Eh=h(["axis","y2","tick","format"]),Fh=h(["axis","y2","padding"],{}),Gh=h(["axis","y2","ticks"],10),Hh=h(["grid","x","show"],!1),Ih=h(["grid","x","type"],"tick"),Jh=h(["grid","x","lines"],[]),Kh=h(["grid","y","show"],!1),Lh=h(["grid","y","lines"],[]),Mh=h(["grid","y","ticks"],10),Nh=h(["point","show"],!0),Oh=Nh?h(["point","r"],2.5):0,Ph=h(["point","focus","line","enabled"],!0),Qh=h(["point","focus","expand","enabled"],!0),Rh=h(["point","focus","expand","r"],Qh?4:Oh),Sh=h(["point","focus","select","r"],8),Th=h(["line","connect_null"],!1),Uh=h(["bar","width"]),Vh=h(["bar","width","ratio"],.6),Wh=h(["pie","label","show"],!0),Xh=h(["pie","label","format"]),Yh=h(["pie","expand"],!0),Zh=h(["pie","onclick"],function(){}),$h=h(["pie","onmouseover"],function(){}),_h=h(["pie","onmouseout"],function(){}),ai=h(["donut","label","show"],!0),bi=h(["donut","label","format"]),ci=h(["donut","expand"],!0),di=h(["donut","title"],""),ei=h(["donut","onclick"],function(){}),fi=h(["donut","onmouseover"],function(){}),gi=h(["donut","onmouseout"],function(){}),hi=h(["regions"],[]),ii=h(["tooltip","show"],!0),ji=h(["tooltip","format","title"]),ki=h(["tooltip","format","value"]),li=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ji?ji:b,l=ki?ki: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+""}),mi=h(["tooltip","init","show"],!1),ni=h(["tooltip","init","x"],0),oi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),pi=("string"==typeof wf?wf.replace("#",""):wf.id)+"-clip",qi=pi+"-xaxis",ri=pi+"-yaxis",si=i(pi),ti=i(qi),ui=i(ri),vi="timeseries"===$g,wi="categorized"===$g,xi=!vi&&(pg||te(qg)),yi=null,zi=!1,Ai=!1,Bi=!1,Ci=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Di=ne(Dg,te(Rg)?Rg:Ci,Cg),Ei=_g?tf.time.format:tf.time.format.utc,Fi=function(){var a=[[Ei("%Y/%-m/%-d"),function(){return!0}],[Ei("%-m/%-d"),function(a){return a.getMonth()}],[Ei("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ei("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ei("%I %p"),function(a){return a.getHours()}],[Ei("%I:%M"),function(a){return a.getMinutes()}],[Ei(":%S"),function(a){return a.getSeconds()}],[Ei(".%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)}}(),Gi=[],Hi=[],Ii=Yg?"left":"bottom",Ji=Yg?uh?"top":"bottom":uh?"right":"left",Ki=Yg?Dh?"bottom":"top":Dh?"left":"right",Li=Yg?"left":"bottom",Mi={main:function(){return"translate("+Jf.left+","+Jf.top+")"},context:function(){return"translate("+Kf.left+","+Kf.top+")"},legend:function(){return"translate("+Lf.left+","+Lf.top+")"},x:function(){return"translate(0,"+(Yg?0:Of)+")"},y:function(){return"translate(0,"+(Yg?Of:0)+")"},y2:function(){return"translate("+(Yg?0:Mf)+","+(Yg?1:0)+")"},subx:function(){return"translate(0,"+(Yg?0:Pf)+")"},arc:function(){return"translate("+Mf/2+","+Of/2+")"}},Ni="right"===Tg,Oi=0,Pi=0,Qi=0,Ri=.15,Si=30,Ti=Yg&&!Zg?0:30,Ui=5;Yf=tf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Vi,Wi=function(){var a=tf.svg.line().x(Yg?function(a){return V(a.id)(a.value)}:zd).y(Yg?zd:function(a){return V(a.id)(a.value)});return Th||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Th?De(b.values):b.values;return ce(b)?(a.interpolate(de(b)?"cardinal":"linear"),Bg[b.id]?Pe(e,fg,V(b.id),Bg[b.id]):a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Xi=function(){var a;return a=Yg?tf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(zd):tf.svg.area().x(zd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=De(b.values);return Yd([b],"area")||Yd([b],"area-spline")?(a.interpolate(de(b)?"cardinal":"linear"),a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Yi=function(){var a=tf.svg.line().x(Yg?function(a){return W(a.id)(a.value)}:Cd).y(Yg?Cd:function(a){return W(a.id)(a.value)});return function(b){var c=De(b.values);return ce(b)?a(c):"M "+ig(c[0].x)+" "+W(b.id)(c[0].value)}}(),Zi=function(){};Vi=tf.svg.brush().on("brush",Ye),Vi.update=function(){return bj&&bj.select("."+f.brush).call(this),this},Vi.scale=function(a){return Yg?this.y(a):this.x(a)},Bf&&(Zi=tf.behavior.zoom().on("zoomstart",function(){Zi.altDomain=tf.event.sourceEvent.altKey?fg.orgDomain():null}).on("zoom",Bf?Ze:null),Zi.scale=function(a){return Yg?this.y(a):this.x(a)},Zi.orgScaleExtent=function(){var a=Cf?Cf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},Zi.updateScaleExtent=function(){var a=ac(fg.orgDomain())/ac(fj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var $i,_i,aj,bj,cj,dj,ej,fj,gj,hj={};if(uf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),uf.defocus(),b(d.classed(f.focused,!0)),b(e),be(uf.data.targets)&&Nb(a,!0),jf(a)},uf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),kf(a)},uf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),lf()},uf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),$i.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?mf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},uf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),$i.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?nf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Ri),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},uf.toggle=function(a){Gc(a)?uf.hide(a):uf.show(a)},uf.unzoom=function(){Vi.clear().update(),Xe({withUpdateXDomain:!0})},uf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){ug[b]=a.classes[b]}),"categories"in a&&wi&&(ah=a.categories,lg.categories(ah)),"cacheIds"in a&&bc(a.cacheIds)?void cf(dc(a.cacheIds),a.done):void("unload"in a?ef(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){df(a)}):df(a))},uf.unload=function(a){ef(Dc(a),function(){Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},uf.selected=function(a){return tf.merge(aj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return tf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},uf.select=function(a,b,c){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=tf.select(this),i="circle"===this.nodeName?xe:Ae,j="circle"===this.nodeName?ye:Be,k=Fg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Gg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},uf.unselect=function(a,b){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=tf.select(this),g="circle"===this.nodeName?ye:Be,h=Fg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Gg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},uf.toLine=function(a){sf(a,"line")},uf.toSpline=function(a){sf(a,"spline")},uf.toBar=function(a){sf(a,"bar")},uf.toScatter=function(a){sf(a,"scatter")},uf.toArea=function(a){sf(a,"area")},uf.toAreaSpline=function(a){sf(a,"area-spline")},uf.toPie=function(a){sf(a,"pie",{withTransform:!0})},uf.toDonut=function(a){sf(a,"donut",{withTransform:!0})},uf.groups=function(a){return c(a)?vg:(vg=a,Xe(),vg)},uf.xgrids=function(a){return a?(Jh=a,Xe(),Jh):Jh},uf.xgrids.add=function(a){return a?uf.xgrids(Jh.concat(a)):void 0},uf.xgrids.remove=function(a){var b=rf(a);return uf.xgrids(Jh.filter(b))},uf.ygrids=function(a){return a?(Lh=a,Xe(),Lh):Lh +}dj.html(li(uf.data.targets.map(function(a){return pc(a.values[ni])}),$(),wd,Di)),dj.style("top",oi.top).style("left",oi.left).style("display","block")}null==a.onresize&&(a.onresize=$e()),a.onresize.add&&(a.onresize.add(Gf),a.onresize.add(function(){af({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})}),a.onresize.add(Hf))}function Re(a){a.append("rect").attr("class",fd).style("cursor",Eg&&Fg?"pointer":null).on("mouseover",function(a,b){if(!zi&&!be(uf.data.targets)){var c,d,e=uf.data.targets.map(function(a){return pc(a.values[b])});if(Object.keys(tg).length>0){d=[];for(var g in tg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Id(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ce,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 Ve(a){be(uf.data.targets)||Eg&&(yi=a,aj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),zi=!0,Ng())}function We(){be(uf.data.targets)||Eg&&(aj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),aj.selectAll("."+f.shape).classed(f.INCLUDED,!1),zi=!1,Og())}function Xe(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U=Sd(),V=be(uf.data.targets),W=Ic(uf.data.targets);if(0!==W.length){if(a=d(a)?a:{},z=d(a.withY)?a.withY:!0,A=d(a.withSubchart)?a.withSubchart:!0,B=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,C=d(a.withTransitionForExit)?a.withTransitionForExit:B,D=d(a.withTransitionForAxis)?a.withTransitionForAxis:B,E=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:B,O=B?If:0,P=C?O:0,Q=D?O:0,I&&Sg&&of(Cc(uf.data.targets),a),H&&(fg.domain(tf.extent(_b(W))),fj=fg.domain(),Bf&&Zi.scale(fg).updateScaleExtent(),ig.domain(fg.domain()),Vi.scale(ig)),G&&(fg.domain(Vi.empty()?fj:Vi.extent()),Bf&&Zi.scale(fg).updateScaleExtent()),gg.domain(Xb(W,"y")),hg.domain(Xb(W,"y2")),(gh||fh)&&(R=hh?hh:Kc(Jc(W)),lg.tickValues(R),og.tickValues(R)),c=aj.select("."+f.axisX).style("opacity",V?0:1),(Yg||E)&&(c=c.transition().duration(Q)),c.call(lg),g=aj.select("."+f.axisY).style("opacity",V?0:1),(!Yg||E)&&(g=g.transition().duration(Q)),g.call(mg),aj.select("."+f.axisY2).style("opacity",V?0:1).transition().duration(Q).call(ng),G)if(dh&&R){for(S=1;S=0&&tf.select(this).style("display",b%T?"none":"block")})}else tf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!Yg&&ih&&eb(c),J=Ke(U),M=Le(U,!0),N=Le(U,!1),Db(),jg.domain(gg.domain()),kg.domain(hg.domain()),dj.style("display","none"),o(),aj.select("line."+f.xgridFocus).style("visibility","hidden"),Hh){if("year"===Ih){i=[];for(var X=_b(),Y=X[0].getFullYear(),Z=X[1].getFullYear(),$=Y;Z>=$;$++)i.push(new Date($+"-01-01 00:00:00"))}else i=fg.ticks(10);h=aj.select("."+f.xgrids).selectAll("."+f.xgrid).data(i),h.enter().append("line").attr("class",f.xgrid),h.attr("x1",Yg?0:function(a){return fg(a)-lg.tickOffset()}).attr("x2",Yg?Mf:function(a){return fg(a)-lg.tickOffset()}).attr("y1",Yg?function(a){return fg(a)-lg.tickOffset()}:Jf.top).attr("y2",Yg?function(a){return fg(a)-lg.tickOffset()}:Of).style("opacity",function(){return+tf.select(this).attr(Yg?"y1":"x1")===(Yg?Of:0)?0:1}),h.exit().remove()}te(Jh)&&(j=aj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Jh),k=j.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),k.append("line").style("opacity",0),k.append("text").attr("text-anchor","end").attr("transform",Yg?"":"rotate(-90)").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),j.select("line").transition().duration(O).attr("x1",Yg?0:Ad).attr("x2",Yg?Mf:Ad).attr("y1",Yg?Ad:Jf.top).attr("y2",Yg?Ad:Of).style("opacity",1),j.select("text").transition().duration(O).attr("x",Yg?Mf:0).attr("y",Ad).text(function(a){return a.text}).style("opacity",1),j.exit().transition().duration(O).style("opacity",0).remove()),z&&Kh&&(l=aj.select("."+f.ygrids).selectAll("."+f.ygrid).data(gg.ticks(Mh)),l.enter().append("line").attr("class",f.ygrid),l.attr("x1",Yg?gg:0).attr("x2",Yg?gg:Mf).attr("y1",Yg?0:gg).attr("y2",Yg?Of:gg),l.exit().remove()),z&&te(Lh)&&(m=aj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Lh),n=m.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),n.append("line").style("opacity",0),n.append("text").attr("text-anchor","end").attr("transform",Yg?"rotate(-90)":"").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),m.select("line").transition().duration(O).attr("x1",Yg?Bd:0).attr("x2",Yg?Bd:Mf).attr("y1",Yg?0:Bd).attr("y2",Yg?Of:Bd).style("opacity",1),m.select("text").transition().duration(O).attr("x",Yg?0:Mf).attr("y",Bd).text(function(a){return a.text}).style("opacity",1),m.exit().transition().duration(O).style("opacity",0).remove()),q=aj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),q.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Di(a)}).attr("class",ad),q.style("opacity",qd).transition().duration(O).attr("d",J).style("opacity",1),q.exit().transition().duration(P).style("opacity",0).remove(),s=aj.selectAll("."+f.texts).selectAll("."+f.text).data(le),s.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return Yg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),s.text(function(a){return yd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(O).attr("x",M).attr("y",N).style("fill-opacity",td),s.exit().transition().duration(P).style("fill-opacity",0).remove(),aj.selectAll("."+f.line).style("opacity",qd).transition().duration(O).attr("d",Wi).style("opacity",1),aj.selectAll("."+f.area).style("opacity",0).transition().duration(O).attr("d",Xi).style("opacity",gj),p=aj.selectAll("."+f.circles).selectAll("."+f.circle).data(ke),p.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Oh),p.style("opacity",qd).transition().duration(O).style("opacity",sd).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),p.exit().remove(),aj.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(O).attrTween("d",function(a){var b,c=Fb(a);return c?(b=tf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1),aj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(O).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&ie(a.data)?1:0}),aj.select("."+f.chartArcsTitle).style("opacity",ae(uf.data.targets)?1:0),Pg&&(null!==tf.event&&"zoom"===tf.event.type&&Vi.extent(fg.orgDomain()).update(),A&&(e=bj.select("."+f.axisX).style("opacity",V?0:1),(Yg||E)&&(e=e.transition().duration(Q)),e.call(og),!Yg&&ih&&eb(e),Vi.empty()||Vi.extent(fg.orgDomain()).update(),K=Ke(U,!0),t=bj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),t.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Di(a)}).attr("class",ad),t.style("opacity",qd).transition().duration(O).attr("d",K).style("opacity",1),t.exit().transition().duration(O).style("opacity",0).remove(),bj.selectAll("."+f.line).style("opacity",qd).transition().duration(O).attr("d",Yi).style("opacity",1))),aj.selectAll("."+f.selectedCircles).filter(function(a){return ee(a)}).selectAll("circle").remove(),aj.selectAll("."+f.selectedCircle).transition().duration(O).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),u=aj.select("."+f.eventRects),te(qg)&&!oc(qg)?(u.classed(f.eventRectsMultiple)||u.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),v=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Se(v.enter()),v.attr("x",0).attr("y",0).attr("width",Mf).attr("height",Of)):(u.classed(f.eventRectsSingle)||u.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),xi&&!wi?(y=function(a,b){var c=xc(b),d=yc(b),e=uf.data.xs[a.id][b];return(fg(d?d:e+50)-fg(c?c:e-50))/2},x=function(a,b){var c=xc(b),d=uf.data.xs[a.id][b];return(fg(d)+fg(c?c:d-50))/2}):(y=L(),x=function(a){return fg(a.x)-y/2}),w=Ac(uf.data.targets),aj.select("."+f.eventRects).datum(w?w.values:[]),v=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Re(v.enter()),v.attr("class",fd).attr("x",Yg?0:x).attr("y",Yg?x:0).attr("width",Yg?Mf:y).attr("height",Yg?y:Of),v.exit().remove()),r=aj.select("."+f.regions).selectAll("rect."+f.region).data(hi),r.enter().append("rect").style("fill-opacity",0),r.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(O).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Cc(uf.data.targets).forEach(function(a){hj[a]=!0})}}function Ye(){Xe({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ze(){return"mousemove"===tf.event.sourceEvent.type&&Zi.altDomain?(fg.domain(Zi.altDomain),void Zi.scale(fg).updateScaleExtent()):(wi&&fg.orgDomain()[0]===fj[0]&&fg.domain([fj[0]-1e-10,fg.orgDomain()[1]]),Xe({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===tf.event.sourceEvent.type&&(Ai=!0)))}function $e(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function _e(){$i.attr("width",Qf).attr("height",Rf),$i.select("#"+pi).select("rect").attr("width",Mf).attr("height",Of),$i.select("#"+qi).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),$i.select("#"+ri).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),$i.select("."+f.zoomRect).attr("width",Mf).attr("height",Of),ej.style("max-height",Rf+"px")}function af(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),_e(),m(a.withTransition),Xe(a)}function bf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=aj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Di(a)}),e=aj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("fill",function(a){return Di(a)}).style("stroke","none").style("cursor",function(a){return Gg(a)?"pointer":null}),c=aj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)}),b.append("path").attr("class",dd).style("opacity",function(){return gj=+tf.select(this).style("opacity"),0}).style("fill",function(a){return Di(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Di(a)}).style("cursor",function(a){return Gg(a)?"pointer":null}),a.forEach(function(a){aj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=aj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Yf(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Di(a.data)}).style("cursor",function(a){return Gg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Fb(a),d=Lb(c),e=Tb();Nb(c.data.id),jf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Fb(a),c=[Lb(b)];Md(c,tf.mouse(this))}).on("mouseout",function(a,b){var c=Fb(a),d=Lb(c),e=Ub();Ob(c.data.id),lf(),Nd(),e(d,b)}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Pg&&(n=bj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Di(a)}),l=bj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)})),$i.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function cf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Xd(a.id,b.types[a.id]):Xd(a.id,b.type)}),uf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Ni?j:i,l=Ni?Q():P();return d&&(w=0,C=0,t=0,u=0),Sg&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Ni?u:t,void(Xg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,Ni?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=cj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Ug?Ug(a):uf.toggle(a)}).on("mouseover",function(a){uf.focus(a),"function"==typeof Vg&&Vg(a)}).on("mouseout",function(a){uf.revert(),"function"==typeof Wg&&Wg(a)}),l.append("text").text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",Ni?g:-200).attr("y",Ni?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ni?h:-200).attr("y",Ni?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Di(a)}).attr("x",Ni?g:-200).attr("y",Ni?-200:i).attr("width",10).attr("height",10),cj.selectAll("text").data(a).text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),cj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),cj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),_e(),q&&m(p)}function pf(a){return Ec(uf.data.targets,a.id)}function qf(a){return"data"in a&&Ec(uf.data.targets,a.data.id)}function rf(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 sf(a,b,c){var d=!be(uf.data.targets);Xd(a,b),af(c?c:{withTransitionForAxis:d})}var tf=a.d3?a.d3:a.require?a.require("d3"):void 0,uf={data:{},axis:{},legend:{}},vf={},wf=h(["bindto"],"#chart"),xf=h(["size","width"]),yf=h(["size","height"]),zf=h(["padding","left"]),Af=h(["padding","right"]),Bf=h(["zoom","enabled"],!1),Cf=h(["zoom","extent"]),Df=h(["zoom","privileged"],!1),Ef=h(["onenter"],function(){}),Ff=h(["onleave"],function(){}),Gf=h(["onresize"],function(){}),Hf=h(["onresized"],function(){}),If=h(["transition","duration"],350);g("data","data is required in config");var Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg=h(["data","x"]),qg=h(["data","xs"],{}),rg=h(["data","x_format"]),sg=h(["data","id_converter"],function(a){return a}),tg=h(["data","names"],{}),ug=h(["data","classes"],{}),vg=h(["data","groups"],[]),wg=h(["data","axes"],{}),xg=h(["data","type"]),yg=h(["data","types"],{}),zg=h(["data","labels"],{}),Ag=h(["data","order"]),Bg=h(["data","regions"],{}),Cg=h(["data","color"]),Dg=h(["data","colors"],{}),Eg=h(["data","selection","enabled"],!1),Fg=h(["data","selection","grouped"],!1),Gg=h(["data","selection","isselectable"],function(){return!0}),Hg=h(["data","selection","multiple"],!0),Ig=h(["data","onclick"],function(){}),Jg=h(["data","onenter"],function(){}),Kg=h(["data","onleave"],function(){}),Lg=h(["data","onselected"],function(){}),Mg=h(["data","onunselected"],function(){}),Ng=h(["data","ondragstart"],function(){}),Og=h(["data","ondragend"],function(){}),Pg=h(["subchart","show"],!1),Qg=h(["subchart","size","height"],60),Rg=h(["color","pattern"],[]),Sg=h(["legend","show"],!0),Tg=h(["legend","position"],"bottom"),Ug=h(["legend","item","onclick"]),Vg=h(["legend","item","onmouseover"]),Wg=h(["legend","item","onmouseout"]),Xg=h(["legend","equally"],!1),Yg=h(["axis","rotated"],!1),Zg=h(["axis","x","show"],!0),$g=h(["axis","x","type"],"indexed"),_g=h(["axis","x","localtime"],!0),ah=h(["axis","x","categories"],[]),bh=h(["axis","x","tick","centered"],!1),ch=h(["axis","x","tick","format"]),dh=h(["axis","x","tick","culling"],{}),eh=h(["axis","x","tick","culling","max"],10),fh=h(["axis","x","tick","count"]),gh=h(["axis","x","tick","fit"],!0),hh=h(["axis","x","tick","values"],null),ih=h(["axis","x","tick","rotate"]),jh=h(["axis","x","max"],null),kh=h(["axis","x","min"],null),lh=h(["axis","x","padding"],{}),mh=h(["axis","x","height"]),nh=h(["axis","x","default"]),oh=h(["axis","x","label"],{}),ph=h(["axis","y","show"],!0),qh=h(["axis","y","max"]),rh=h(["axis","y","min"]),sh=h(["axis","y","center"]),th=h(["axis","y","label"],{}),uh=h(["axis","y","inner"],!1),vh=h(["axis","y","tick","format"]),wh=h(["axis","y","padding"],{}),xh=h(["axis","y","ticks"],10),yh=h(["axis","y2","show"],!1),zh=h(["axis","y2","max"]),Ah=h(["axis","y2","min"]),Bh=h(["axis","y2","center"]),Ch=h(["axis","y2","label"],{}),Dh=h(["axis","y2","inner"],!1),Eh=h(["axis","y2","tick","format"]),Fh=h(["axis","y2","padding"],{}),Gh=h(["axis","y2","ticks"],10),Hh=h(["grid","x","show"],!1),Ih=h(["grid","x","type"],"tick"),Jh=h(["grid","x","lines"],[]),Kh=h(["grid","y","show"],!1),Lh=h(["grid","y","lines"],[]),Mh=h(["grid","y","ticks"],10),Nh=h(["point","show"],!0),Oh=Nh?h(["point","r"],2.5):0,Ph=h(["point","focus","line","enabled"],!0),Qh=h(["point","focus","expand","enabled"],!0),Rh=h(["point","focus","expand","r"],Qh?4:Oh),Sh=h(["point","focus","select","r"],8),Th=h(["line","connect_null"],!1),Uh=h(["bar","width"]),Vh=h(["bar","width","ratio"],.6),Wh=h(["pie","label","show"],!0),Xh=h(["pie","label","format"]),Yh=h(["pie","expand"],!0),Zh=h(["pie","onclick"],function(){}),$h=h(["pie","onmouseover"],function(){}),_h=h(["pie","onmouseout"],function(){}),ai=h(["donut","label","show"],!0),bi=h(["donut","label","format"]),ci=h(["donut","expand"],!0),di=h(["donut","title"],""),ei=h(["donut","onclick"],function(){}),fi=h(["donut","onmouseover"],function(){}),gi=h(["donut","onmouseout"],function(){}),hi=h(["regions"],[]),ii=h(["tooltip","show"],!0),ji=h(["tooltip","format","title"]),ki=h(["tooltip","format","value"]),li=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ji?ji:b,l=ki?ki: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+""}),mi=h(["tooltip","init","show"],!1),ni=h(["tooltip","init","x"],0),oi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),pi=("string"==typeof wf?wf.replace("#",""):wf.id)+"-clip",qi=pi+"-xaxis",ri=pi+"-yaxis",si=i(pi),ti=i(qi),ui=i(ri),vi="timeseries"===$g,wi="categorized"===$g,xi=!vi&&(pg||te(qg)),yi=null,zi=!1,Ai=!1,Bi=!1,Ci=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Di=ne(Dg,te(Rg)?Rg:Ci,Cg),Ei=_g?tf.time.format:tf.time.format.utc,Fi=function(){var a=[[Ei("%Y/%-m/%-d"),function(){return!0}],[Ei("%-m/%-d"),function(a){return a.getMonth()}],[Ei("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ei("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ei("%I %p"),function(a){return a.getHours()}],[Ei("%I:%M"),function(a){return a.getMinutes()}],[Ei(":%S"),function(a){return a.getSeconds()}],[Ei(".%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)}}(),Gi=[],Hi=[],Ii=Yg?"left":"bottom",Ji=Yg?uh?"top":"bottom":uh?"right":"left",Ki=Yg?Dh?"bottom":"top":Dh?"left":"right",Li=Yg?"left":"bottom",Mi={main:function(){return"translate("+Jf.left+","+Jf.top+")"},context:function(){return"translate("+Kf.left+","+Kf.top+")"},legend:function(){return"translate("+Lf.left+","+Lf.top+")"},x:function(){return"translate(0,"+(Yg?0:Of)+")"},y:function(){return"translate(0,"+(Yg?Of:0)+")"},y2:function(){return"translate("+(Yg?0:Mf)+","+(Yg?1:0)+")"},subx:function(){return"translate(0,"+(Yg?0:Pf)+")"},arc:function(){return"translate("+Mf/2+","+Of/2+")"}},Ni="right"===Tg,Oi=0,Pi=0,Qi=0,Ri=.15,Si=30,Ti=Yg&&!Zg?0:30,Ui=5;Yf=tf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Vi,Wi=function(){var a=tf.svg.line().x(Yg?function(a){return V(a.id)(a.value)}:zd).y(Yg?zd:function(a){return V(a.id)(a.value)});return Th||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Th?De(b.values):b.values;return ce(b)?(a.interpolate(de(b)?"cardinal":"linear"),Bg[b.id]?Pe(e,fg,V(b.id),Bg[b.id]):a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Xi=function(){var a;return a=Yg?tf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(zd):tf.svg.area().x(zd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=De(b.values);return Yd([b],"area")||Yd([b],"area-spline")?(a.interpolate(de(b)?"cardinal":"linear"),a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Yi=function(){var a=tf.svg.line().x(Yg?function(a){return W(a.id)(a.value)}:Cd).y(Yg?Cd:function(a){return W(a.id)(a.value)});return function(b){var c=De(b.values);return ce(b)?a(c):"M "+ig(c[0].x)+" "+W(b.id)(c[0].value)}}(),Zi=function(){};Vi=tf.svg.brush().on("brush",Ye),Vi.update=function(){return bj&&bj.select("."+f.brush).call(this),this},Vi.scale=function(a){return Yg?this.y(a):this.x(a)},Bf&&(Zi=tf.behavior.zoom().on("zoomstart",function(){Zi.altDomain=tf.event.sourceEvent.altKey?fg.orgDomain():null}).on("zoom",Bf?Ze:null),Zi.scale=function(a){return Yg?this.y(a):this.x(a)},Zi.orgScaleExtent=function(){var a=Cf?Cf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},Zi.updateScaleExtent=function(){var a=ac(fg.orgDomain())/ac(fj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var $i,_i,aj,bj,cj,dj,ej,fj,gj,hj={};if(uf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),uf.defocus(),b(d.classed(f.focused,!0)),b(e),be(uf.data.targets)&&Nb(a,!0),jf(a)},uf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),kf(a)},uf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),lf()},uf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),$i.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?mf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},uf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),$i.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?nf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Ri),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},uf.toggle=function(a){Gc(a)?uf.hide(a):uf.show(a)},uf.unzoom=function(){Vi.clear().update(),Xe({withUpdateXDomain:!0})},uf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){ug[b]=a.classes[b]}),"categories"in a&&wi&&(ah=a.categories,lg.categories(ah)),"cacheIds"in a&&bc(a.cacheIds)?void cf(dc(a.cacheIds),a.done):void("unload"in a?ef(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){df(a)}):df(a))},uf.unload=function(a){ef(Dc(a),function(){Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},uf.selected=function(a){return tf.merge(aj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return tf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},uf.select=function(a,b,c){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=tf.select(this),i="circle"===this.nodeName?xe:Ae,j="circle"===this.nodeName?ye:Be,k=Fg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Gg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},uf.unselect=function(a,b){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=tf.select(this),g="circle"===this.nodeName?ye:Be,h=Fg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Gg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},uf.toLine=function(a){sf(a,"line")},uf.toSpline=function(a){sf(a,"spline")},uf.toBar=function(a){sf(a,"bar")},uf.toScatter=function(a){sf(a,"scatter")},uf.toArea=function(a){sf(a,"area")},uf.toAreaSpline=function(a){sf(a,"area-spline")},uf.toPie=function(a){sf(a,"pie",{withTransform:!0})},uf.toDonut=function(a){sf(a,"donut",{withTransform:!0})},uf.groups=function(a){return c(a)?vg:(vg=a,Xe(),vg)},uf.xgrids=function(a){return a?(Jh=a,Xe(),Jh):Jh},uf.xgrids.add=function(a){return a?uf.xgrids(Jh.concat(a)):void 0},uf.xgrids.remove=function(a){var b=rf(a);return uf.xgrids(Jh.filter(b))},uf.ygrids=function(a){return a?(Lh=a,Xe(),Lh):Lh },uf.ygrids.add=function(a){return a?uf.ygrids(Lh.concat(a)):void 0},uf.ygrids.remove=function(a){var b=rf(a);return uf.ygrids(Lh.filter(b))},uf.regions=function(a){return c(a)?hi:(hi=a,Xe(),hi)},uf.regions.add=function(a){return c(a)?hi:(hi=hi.concat(a),Xe(),hi)},uf.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;$i.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),hi=hi.filter(function(b){return b.classes.indexOf(a)<0})}),hi},uf.data.get=function(a){var b=uf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},uf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},uf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){tg[b]=a[b]}),of(Cc(uf.data.targets),{withTransition:!0}),tg):tg},uf.x=function(a){return arguments.length&&(qc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.xs=function(a){return arguments.length&&(rc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},uf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(qh=+a.y),b(a.y2)&&(zh=+a.y2)):qh=zh=+a,Xe())},uf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(rh=+a.y),b(a.y2)&&(Ah=+a.y2)):rh=Ah=+a,Xe())},uf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&uf.axis.max(a.max),"undefined"!=typeof a.min&&uf.axis.min(a.min))},uf.legend.show=function(a){Sg||(Sg=!0,cj.style("visibility","visible")),mf(Dc(a)),Xe({withTransitionForHorizontalAxis:!1})},uf.legend.hide=function(a){Sg&&se(a)&&(Sg=!1,cj.style("visibility","hidden")),nf(Dc(a)),Xe({withTransitionForHorizontalAxis:!1})},uf.resize=function(a){xf=a?a.width:null,yf=a?a.height:null,af({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},uf.destroy=function(){uf.data.targets=void 0,uf.data.xs={},ej.html(""),a.onresize=null},"url"in e.data)tf.xhr(e.data.url,function(a,b){var c,d=tf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=tf.csv.parse(b.response),Qe(c)});else if("rows"in e.data)Qe(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Qe(uc(e.data.columns))}return uf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From c9ce0d5b754e36852aa28ab0a3a9c3daa78ea264 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Sat, 26 Apr 2014 21:24:32 +0900 Subject: [PATCH 067/178] Fix custom xs when 0 - #154 --- c3.js | 2 +- c3.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/c3.js b/c3.js index 0255f14..b6b2d13 100644 --- a/c3.js +++ b/c3.js @@ -1424,7 +1424,7 @@ x = rawX ? rawX instanceof Date ? rawX : parseDate(rawX) : parseDate(getXValue(id, index)); } else if (isCustomX && !isCategorized) { - x = rawX ? +rawX : getXValue(id, index); + x = isValue(rawX) ? +rawX : getXValue(id, index); } else { x = index; diff --git a/c3.min.js b/c3.min.js index 95cd973..e8e36d8 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.32"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cMf&&(Mf=0),0>Of&&(Of=0),Nf=Yg?Jf.left-Si-Ti:Mf,Pf=Yg?Of:Rf-Kf.top-Kf.bottom,0>Nf&&(Nf=0),0>Pf&&(Pf=0),p(),Ni&&be(uf.data.targets)&&(Lf.left=Mf/2+Tf)}function o(){aj.select("line."+f.xgridFocus).attr("x1",Yg?0:-10).attr("x2",Yg?Mf:-10).attr("y1",Yg?-10:Jf.top).attr("y2",Yg?-10:Of)}function p(){Tf=Of/2,Sf=.95*Tf,Uf=ae(uf.data.targets)?.6*Sf:0}function q(){var a=Yg?f.axisX:f.axisY,b=tf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=tf.select(wf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return xf?xf:x()}function s(){var a=yf?yf:y();return a>0?a:320}function t(){return be(uf.data.targets)?0:zf?zf:Yg?Zg?v("x"):1:!ph||uh?1:v("y")}function u(){var a=1;return be(uf.data.targets)?0:Af?Af:Ni?P()+(yh&&!Yg?v("y2"):a):yh?Dh||Yg?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||Zg?"x"===a&&mh?mh:"y"!==a||ph?"y2"!==a||yh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Ui:Sg&&!Ni?10:1:0}function x(){return+tf.select(wf).style("width").replace("px","")}function y(){return+tf.select(wf).style("height").replace("px","")}function z(a){return a?-5:-(Jf.left-1)}function A(a){return a?-20:-4}function B(){return z(!Yg)}function C(){return A(!Yg)}function D(){return z(Yg)}function E(){return A(Yg)}function F(a){return a?Mf+2+4:Jf.left+20}function G(a){return a?(mh?mh:0)+80:Of+8}function H(){return F(!Yg)}function I(){return G(!Yg)}function J(){return F(Yg)}function K(){return G(Yg)}function L(){var a=Ac(uf.data.targets),b=a.values[0],c=a.values[a.values.length-1],d=fg(c.x)-fg(b.x),e=zc(),f=Zd(uf.data.targets)?(e-(wi?.25:1))/e:1;return e>1?d*f/(e-1):d}function M(a){Oi=a}function N(a){Pi=a}function O(a){Qi=a}function P(){return Sg?Ni?Pi*(Oi+1):Qf:0}function Q(){return Sg?Ni?Rf:Qi*(Oi+1):0}function R(){var a,b=!fg;Zf=Yg?1:0,$f=Yg?Of:Mf,_f=Yg?0:Of,ag=Yg?Mf:1,bg=Zf,cg=$f,dg=Yg?0:Pf,eg=Yg?Nf:1,fg=T(Zf,$f,b?void 0:fg.domain(),function(){return lg.tickOffset()}),gg=U(_f,ag,b?void 0:gg.domain()),hg=U(_f,ag,b?void 0:hg.domain()),ig=T(Zf,$f,fj,function(a){return a%1?0:og.tickOffset()}),jg=U(dg,eg,b?void 0:jg.domain()),kg=U(dg,eg,b?void 0:kg.domain()),a=$(),lg=X(fg,Ii,a),og=X(ig,Li,a),mg=Y(gg,Ji,vh,xh),ng=Y(hg,Ki,Eh,Gh),b||(Vi.scale(ig),Bf&&Zi.scale(fg)),S()}function S(){Vf=Gb(),Wf=Hb(),Xf=Hb(.98)}function T(a,b,d,e){var f=(vi?tf.time.scale():tf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),wi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=tf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?hg:gg}function W(a){return"y2"===Z(a)?kg:jg}function X(a,b,c){var d=(wi?Eb():tf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),wi?(d.tickCentered(bh),se(dh)&&(dh=!1)):d.tickOffset=function(){var a=Bc(uf.data.targets),b=fg(a[1])-fg(a[0]);return b/zc()/2},wi&&d.categories(ah),d}function Y(a,b,c,d){return tf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in wg?wg[a]:"y"}function $(){var a=vi?Fi:wi?Tc:function(a){return 0>a?a.toFixed(0):a};return ch&&("function"==typeof ch?a=ch:vi&&(a=function(a){return a?Ei(ch)(a):""})),a}function _(a){var b;return"y"===a?b=th:"y2"===a?b=Ch:"x"===a&&(b=oh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?th=b:"y2"===a?Ch=b:"x"===a&&(oh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a){a.selectAll(".tick text").attr("y",db(ih)).attr("x",cb(ih)).attr("transform","rotate("+ih+")").style("text-anchor","start")}function fb(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 gb(){return fb("x",Yg?"inner-top":"inner-right")}function hb(){return fb("y",Yg?"inner-right":"inner-top")}function ib(){return fb("y2",Yg?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Mf/2:Mf:b.isBottom?-Of:b.isMiddle?-Of/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!Yg,gb())}function rb(){return nb(Yg,hb())}function sb(){return nb(Yg,ib())}function tb(){return ob(!Yg,gb())}function ub(){return ob(Yg,hb())}function vb(){return ob(Yg,ib())}function wb(){var a=gb();return Yg?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":mh?mh-10:"3em"}function xb(){var a=hb();return Yg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return Yg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!Yg,gb())}function Ab(){return pb(Yg,hb())}function Bb(){return pb(Yg,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return tf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?30:b}function Db(){aj.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),aj.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),aj.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+o)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Rc(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 tf.min(Object.keys(i).map(function(a){return tf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(vg.length>0)for(g=Sc(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 tf.max(Object.keys(i).map(function(a){return tf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Ah:rh,n="y2"===c?zh:qh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Bh:sh,r=ud()&&Yg;return 0===l.length?"y2"===c?hg.domain():gg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(gg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&wh&&(f=b(wh.top)?wh.top:e,g=b(wh.bottom)?wh.bottom:e),"y2"===c&&Fh&&(f=b(Fh.top)?Fh.top:e,g=b(Fh.bottom)?Fh.bottom:e),Zd(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return kh?vi?oe(kh):kh:tf.min(a,function(a){return tf.min(a.values,function(a){return a.x})})}function Zb(a){return jh?vi?oe(jh):jh:tf.max(a,function(a){return tf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return wi?d=0:Zd(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof lh&&te(lh)?(e=b(lh.left)?lh.left:d,f=b(lh.right)?lh.right:d):e=f="number"==typeof lh?lh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?gg:hg;return b="y"===a.axis||"y2"===a.axis?Yg?Of:"start"in a?d(a.start):Of:Yg?"end"in a?fg(vi?oe(a.end):a.end):Of:Of,c>b?0:b-c}function ic(a){return pg&&a===pg||te(qg)&&ue(qg,a)}function jc(a){return!ic(a)}function kc(a){return pg?pg:te(qg)?qg[a]:null}function lc(a,b){var c,d=b&&te(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=uf.data.xs[b])}),c}function mc(a,b){return a in uf.data.xs&&uf.data.xs[a]&&uf.data.xs[a][b]?uf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){qg[b]=a[b]})}function oc(a){return 1===tf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=tg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),uf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,b,c){var d;return d=vi?a?a instanceof Date?a:oe(a):oe(mc(b,c)):xi&&!wi?a?+a:mc(b,c):c}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?uf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):pg?(d=Object.keys(uf.data.xs),uf.data.xs[c]=d.length>0?uf.data.xs[d[0]]:void 0):te(qg)&&(uf.data.xs[c]=lc(f,uf.data.targets)):uf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!uf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=sg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return xi&&wi&&0===c&&g&&(0===e&&(ah=[]),ah.push(g)),("undefined"==typeof a[b]||uf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),xg&&Xd(Cc(c).filter(function(a){return!(a in yg)}),xg),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&uf.data.targets[0].values[a-1]?uf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b=Ac(a),c=b.values[0],d=b.values[b.values.length-1];return[c.x,d.x]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(uf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(vi?new Date(h):h);i.push(d)}return vi||(i=i.sort(function(a,b){return a-b})),i}function Lc(a){Gi=Gi.concat(a)}function Mc(a){Gi=Gi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Hi=Hi.concat(a)}function Oc(a){Hi=Hi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Dd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Dd(a,g))),Gd(e,b)):Ed(a,b,f,g)}function Fd(a,b){var c;return c=a.map(function(a){return Ed(a.values,b)}),Gd(c,b)}function Gd(a,b){var c,d;return a.forEach(function(a){var e=ve(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Hd(a,b){return tf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Id(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 Jd(){return Ag&&"desc"===Ag.toLowerCase()}function Kd(){return Ag&&"asc"===Ag.toLowerCase()}function Ld(a){var b=Kd(),c=Jd();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 Ag&&a.sort(Ag),a}function Md(a,c){var d,e,f,g,h,i,j,k=be(uf.data.targets),l=k?xd:wd,m=a.filter(function(a){return a&&b(a.value)});ii&&0!==m.length&&(dj.html(li(a,$(),l,Di)).style("display","block"),d=dj.property("offsetWidth"),e=dj.property("offsetHeight"),k?(g=Mf/2+c[0],i=Of/2+c[1]+20):(Yg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=fg(m[0].x)+20):(f=q(),g=f+t()+fg(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),dj.style("top",i+"px").style("left",g+"px"))}function Nd(){dj.style("display","none")}function Od(a){var c=a.filter(function(a){return a&&b(a.value)});ii&&($d(uf.data.targets)||be(uf.data.targets)||aj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Yg?"y1":"x1",zd).attr(Yg?"y2":"x2",zd))}function Pd(){aj.select("line."+f.xgridFocus).style("visibility","hidden")}function Qd(a){return a.x||0===a.x?fg(a.x):null}function Rd(a){return V(a.id)(a.value)}function Sd(){var a,b,d={},e=0;return Ic(Fc(ee)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Wd(a,b){return Uh?Uh:b?2*a.tickOffset()*Vh/b:0}function Xd(a,b){Dc(a).forEach(function(a){hj[a]=b===yg[a],yg[a]=b})}function Yd(a,b){var c=!1;return a.forEach(function(a){yg[a.id]===b&&(c=!0),a.id in yg||"line"!==b||(c=!0)}),c}function Zd(a){return Yd(a,"bar")}function $d(a){return Yd(a,"scatter")}function _d(a){return Yd(a,"pie")}function ae(a){return Yd(a,"donut")}function be(a){return _d(a)||ae(a)}function ce(a){var b="string"==typeof a?a:a.id;return!(b in yg)||"line"===yg[b]||"spline"===yg[b]||"area"===yg[b]||"area-spline"===yg[b]}function de(a){var b="string"==typeof a?a:a.id;return"spline"===yg[b]||"area-spline"===yg[b]}function ee(a){var b="string"==typeof a?a:a.id;return"bar"===yg[b]}function fe(a){var b="string"==typeof a?a:a.id;return"scatter"===yg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"pie"===yg[b]}function he(a){var b="string"==typeof a?a:a.id;return"donut"===yg[b]}function ie(a){return ge(a)||he(a)}function je(a){return ee(a)?a.values:[]}function ke(a){return ce(a)||fe(a)?a.values:[]}function le(a){return ee(a)||ce(a)?a.values:[]}function me(a){return he(a)&&ci||ge(a)&&Yh}function ne(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function oe(b){var c;try{c=rg?tf.time.format(rg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+rg)}return c}function pe(a,b){var c=tf.mouse(a),d=tf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function ue(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ve(a,b){var c="y"===Z(a.id)?gg:hg,d=Yg?1:0,e=Yg?0:1;return Math.pow(fg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function we(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function xe(a,b,c){Lg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd).attr("stroke",function(){return Di(b)}).attr("r",1.4*Sh).transition().duration(100).attr("r",Sh)}function ye(a,b,c){Mg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ze(a,b,c,d){a?xe(b,c,d):ye(b,c,d)}function Ae(a,b){Lg(b,a.node()),a.transition().duration(100).style("fill",function(){return tf.rgb(Di(b)).darker(1)})}function Be(a,b){Mg(b,a.node()),a.transition().duration(100).style("fill",function(){return Di(b)})}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a){return a.filter(function(a){return b(a.value)})}function Ee(a,c){return(c?aj.selectAll("."+f.circles+ld(c)):aj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Fe(a,b){Ee(a,b).classed(f.EXPANDED,!0).attr("r",Rh)}function Ge(a){Ee(a).filter(function(){return tf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oh)}function He(a){return aj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ie(a){He(a).classed(f.EXPANDED,!0)}function Je(a){He(a).classed(f.EXPANDED,!1)}function Ke(a,b){var c=Oe(a,b);return function(a,b){var d=c(a,b),e=Yg?1:0,f=Yg?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 Le(a,b){var c=Oe(a,!1),d=b?Me:Ne;return function(a,b){return d(c(a,b),a,this)}}function Me(a,b){var c;return Yg?(c=ee(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ne(a,b,c){var d=c.getBoundingClientRect();return Yg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ee(b)?-3:-6)}function Oe(a,b){var c=a.__max__+1,d=Wd(lg,c),e=Td(d,c,a,!!b),f=Ud(!!b),g=Vd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Yg&&(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 Pe(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 Qe(b){var c,d,e;if(ej=tf.select(wf),ej.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ej.html(""),ej.classed("c3",!0),uf.data.xs={},uf.data.targets=vc(b),n(),R(),fg.domain(tf.extent(_b(uf.data.targets))),gg.domain(Xb(uf.data.targets,"y")),hg.domain(Xb(uf.data.targets,"y2")),ig.domain(fg.domain()),jg.domain(gg.domain()),kg.domain(hg.domain()),fj=fg.domain(),Vi.scale(ig),Bf&&Zi.scale(fg),$i=ej.append("svg").attr("width",Mf+Jf.left+Jf.right).attr("height",Of+Jf.top+Jf.bottom).on("mouseenter",Ef).on("mouseleave",Ff),_i=$i.append("defs"),_i.append("clipPath").attr("id",pi).append("rect").attr("width",Mf).attr("height",Of),_i.append("clipPath").attr("id",qi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),_i.append("clipPath").attr("id",ri).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),aj=$i.append("g").attr("transform",Mi.main),bj=Pg?$i.append("g").attr("transform",Mi.context):null,cj=$i.append("g").attr("transform",Mi.legend),Sg||(cj.style("visibility","hidden"),Hi=Cc(uf.data.targets)),dj=tf.select(wf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),of(Cc(uf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Zg&&aj.append("g").attr("class",f.axisX).attr("clip-path",ti).attr("transform",Mi.x).append("text").attr("class",f.axisXLabel).attr("transform",Yg?"rotate(-90)":"").style("text-anchor",zb),ph&&aj.append("g").attr("class",f.axisY).attr("clip-path",ui).attr("transform",Mi.y).append("text").attr("class",f.axisYLabel).attr("transform",Yg?"":"rotate(-90)").style("text-anchor",Ab),yh&&aj.append("g").attr("class",f.axisY2).attr("transform",Mi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Yg?"":"rotate(-90)").style("text-anchor",Bb),d=aj.append("g").attr("clip-path",si).attr("class",f.grid),Hh&&d.append("g").attr("class",f.xgrids),te(Jh)&&d.append("g").attr("class",f.xgridLines),Ph&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Kh&&d.append("g").attr("class",f.ygrids),te(Lh)&&d.append("g").attr("class",f.ygridLines),aj.append("g").attr("clip-path",si).attr("class",f.regions),aj.append("g").attr("clip-path",si).attr("class",f.chart),c=aj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Bf?Yg?"ns-resize":"ew-resize":null),aj.select("."+f.chart).append("g").attr("class",f.chartBars),aj.select("."+f.chart).append("g").attr("class",f.chartLines),aj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Mi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),aj.select("."+f.chart).append("g").attr("class",f.chartTexts),Bf&&aj.insert("rect",Df?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Mf).attr("height",Of).style("opacity",0).style("cursor",Yg?"ns-resize":"ew-resize").call(Zi).on("dblclick.zoom",null),nh&&Vi.extent("function"!=typeof nh?nh:nh(_b())),Pg&&(bj.append("g").attr("clip-path",si).attr("class",f.chart),bj.select("."+f.chart).append("g").attr("class",f.chartBars),bj.select("."+f.chart).append("g").attr("class",f.chartLines),bj.append("g").attr("clip-path",si).attr("class",f.brush).call(Vi).selectAll("rect").attr(Yg?"width":"height",Yg?Nf:Pf),bj.append("g").attr("class",f.axisX).attr("transform",Mi.subx).attr("clip-path",Yg?"":ti)),bf(uf.data.targets),Yg?aj.select("."+f.axisX).style("opacity",0).call(lg):(aj.select("."+f.axisY).style("opacity",0).call(mg),aj.select("."+f.axisY2).style("opacity",0).call(ng)),n(),R(),_e(),m(),Xe({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),mi){if(vi&&"string"==typeof ni){for(ni=oe(ni),e=0;eMf&&(Mf=0),0>Of&&(Of=0),Nf=Yg?Jf.left-Si-Ti:Mf,Pf=Yg?Of:Rf-Kf.top-Kf.bottom,0>Nf&&(Nf=0),0>Pf&&(Pf=0),p(),Ni&&be(uf.data.targets)&&(Lf.left=Mf/2+Tf)}function o(){aj.select("line."+f.xgridFocus).attr("x1",Yg?0:-10).attr("x2",Yg?Mf:-10).attr("y1",Yg?-10:Jf.top).attr("y2",Yg?-10:Of)}function p(){Tf=Of/2,Sf=.95*Tf,Uf=ae(uf.data.targets)?.6*Sf:0}function q(){var a=Yg?f.axisX:f.axisY,b=tf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=tf.select(wf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return xf?xf:x()}function s(){var a=yf?yf:y();return a>0?a:320}function t(){return be(uf.data.targets)?0:zf?zf:Yg?Zg?v("x"):1:!ph||uh?1:v("y")}function u(){var a=1;return be(uf.data.targets)?0:Af?Af:Ni?P()+(yh&&!Yg?v("y2"):a):yh?Dh||Yg?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||Zg?"x"===a&&mh?mh:"y"!==a||ph?"y2"!==a||yh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Ui:Sg&&!Ni?10:1:0}function x(){return+tf.select(wf).style("width").replace("px","")}function y(){return+tf.select(wf).style("height").replace("px","")}function z(a){return a?-5:-(Jf.left-1)}function A(a){return a?-20:-4}function B(){return z(!Yg)}function C(){return A(!Yg)}function D(){return z(Yg)}function E(){return A(Yg)}function F(a){return a?Mf+2+4:Jf.left+20}function G(a){return a?(mh?mh:0)+80:Of+8}function H(){return F(!Yg)}function I(){return G(!Yg)}function J(){return F(Yg)}function K(){return G(Yg)}function L(){var a=Ac(uf.data.targets),b=a.values[0],c=a.values[a.values.length-1],d=fg(c.x)-fg(b.x),e=zc(),f=Zd(uf.data.targets)?(e-(wi?.25:1))/e:1;return e>1?d*f/(e-1):d}function M(a){Oi=a}function N(a){Pi=a}function O(a){Qi=a}function P(){return Sg?Ni?Pi*(Oi+1):Qf:0}function Q(){return Sg?Ni?Rf:Qi*(Oi+1):0}function R(){var a,b=!fg;Zf=Yg?1:0,$f=Yg?Of:Mf,_f=Yg?0:Of,ag=Yg?Mf:1,bg=Zf,cg=$f,dg=Yg?0:Pf,eg=Yg?Nf:1,fg=T(Zf,$f,b?void 0:fg.domain(),function(){return lg.tickOffset()}),gg=U(_f,ag,b?void 0:gg.domain()),hg=U(_f,ag,b?void 0:hg.domain()),ig=T(Zf,$f,fj,function(a){return a%1?0:og.tickOffset()}),jg=U(dg,eg,b?void 0:jg.domain()),kg=U(dg,eg,b?void 0:kg.domain()),a=$(),lg=X(fg,Ii,a),og=X(ig,Li,a),mg=Y(gg,Ji,vh,xh),ng=Y(hg,Ki,Eh,Gh),b||(Vi.scale(ig),Bf&&Zi.scale(fg)),S()}function S(){Vf=Gb(),Wf=Hb(),Xf=Hb(.98)}function T(a,b,d,e){var f=(vi?tf.time.scale():tf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),wi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=tf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?hg:gg}function W(a){return"y2"===Z(a)?kg:jg}function X(a,b,c){var d=(wi?Eb():tf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),wi?(d.tickCentered(bh),se(dh)&&(dh=!1)):d.tickOffset=function(){var a=Bc(uf.data.targets),b=fg(a[1])-fg(a[0]);return b/zc()/2},wi&&d.categories(ah),d}function Y(a,b,c,d){return tf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in wg?wg[a]:"y"}function $(){var a=vi?Fi:wi?Tc:function(a){return 0>a?a.toFixed(0):a};return ch&&("function"==typeof ch?a=ch:vi&&(a=function(a){return a?Ei(ch)(a):""})),a}function _(a){var b;return"y"===a?b=th:"y2"===a?b=Ch:"x"===a&&(b=oh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?th=b:"y2"===a?Ch=b:"x"===a&&(oh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a){a.selectAll(".tick text").attr("y",db(ih)).attr("x",cb(ih)).attr("transform","rotate("+ih+")").style("text-anchor","start")}function fb(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 gb(){return fb("x",Yg?"inner-top":"inner-right")}function hb(){return fb("y",Yg?"inner-right":"inner-top")}function ib(){return fb("y2",Yg?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Mf/2:Mf:b.isBottom?-Of:b.isMiddle?-Of/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!Yg,gb())}function rb(){return nb(Yg,hb())}function sb(){return nb(Yg,ib())}function tb(){return ob(!Yg,gb())}function ub(){return ob(Yg,hb())}function vb(){return ob(Yg,ib())}function wb(){var a=gb();return Yg?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":mh?mh-10:"3em"}function xb(){var a=hb();return Yg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return Yg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!Yg,gb())}function Ab(){return pb(Yg,hb())}function Bb(){return pb(Yg,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return tf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?30:b}function Db(){aj.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),aj.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),aj.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+o)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Rc(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 tf.min(Object.keys(i).map(function(a){return tf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(vg.length>0)for(g=Sc(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 tf.max(Object.keys(i).map(function(a){return tf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Ah:rh,n="y2"===c?zh:qh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Bh:sh,r=ud()&&Yg;return 0===l.length?"y2"===c?hg.domain():gg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(gg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&wh&&(f=b(wh.top)?wh.top:e,g=b(wh.bottom)?wh.bottom:e),"y2"===c&&Fh&&(f=b(Fh.top)?Fh.top:e,g=b(Fh.bottom)?Fh.bottom:e),Zd(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return kh?vi?oe(kh):kh:tf.min(a,function(a){return tf.min(a.values,function(a){return a.x})})}function Zb(a){return jh?vi?oe(jh):jh:tf.max(a,function(a){return tf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return wi?d=0:Zd(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof lh&&te(lh)?(e=b(lh.left)?lh.left:d,f=b(lh.right)?lh.right:d):e=f="number"==typeof lh?lh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?gg:hg;return b="y"===a.axis||"y2"===a.axis?Yg?Of:"start"in a?d(a.start):Of:Yg?"end"in a?fg(vi?oe(a.end):a.end):Of:Of,c>b?0:b-c}function ic(a){return pg&&a===pg||te(qg)&&ue(qg,a)}function jc(a){return!ic(a)}function kc(a){return pg?pg:te(qg)?qg[a]:null}function lc(a,b){var c,d=b&&te(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=uf.data.xs[b])}),c}function mc(a,b){return a in uf.data.xs&&uf.data.xs[a]&&uf.data.xs[a][b]?uf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){qg[b]=a[b]})}function oc(a){return 1===tf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=tg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),uf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=vi?a?a instanceof Date?a:oe(a):oe(mc(c,d)):xi&&!wi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?uf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):pg?(d=Object.keys(uf.data.xs),uf.data.xs[c]=d.length>0?uf.data.xs[d[0]]:void 0):te(qg)&&(uf.data.xs[c]=lc(f,uf.data.targets)):uf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!uf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=sg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return xi&&wi&&0===c&&g&&(0===e&&(ah=[]),ah.push(g)),("undefined"==typeof a[b]||uf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),xg&&Xd(Cc(c).filter(function(a){return!(a in yg)}),xg),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&uf.data.targets[0].values[a-1]?uf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b=Ac(a),c=b.values[0],d=b.values[b.values.length-1];return[c.x,d.x]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(uf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(vi?new Date(h):h);i.push(d)}return vi||(i=i.sort(function(a,b){return a-b})),i}function Lc(a){Gi=Gi.concat(a)}function Mc(a){Gi=Gi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Hi=Hi.concat(a)}function Oc(a){Hi=Hi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Dd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Dd(a,g))),Gd(e,b)):Ed(a,b,f,g)}function Fd(a,b){var c;return c=a.map(function(a){return Ed(a.values,b)}),Gd(c,b)}function Gd(a,b){var c,d;return a.forEach(function(a){var e=ve(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Hd(a,b){return tf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Id(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 Jd(){return Ag&&"desc"===Ag.toLowerCase()}function Kd(){return Ag&&"asc"===Ag.toLowerCase()}function Ld(a){var b=Kd(),c=Jd();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 Ag&&a.sort(Ag),a}function Md(a,c){var d,e,f,g,h,i,j,k=be(uf.data.targets),l=k?xd:wd,m=a.filter(function(a){return a&&b(a.value)});ii&&0!==m.length&&(dj.html(li(a,$(),l,Di)).style("display","block"),d=dj.property("offsetWidth"),e=dj.property("offsetHeight"),k?(g=Mf/2+c[0],i=Of/2+c[1]+20):(Yg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=fg(m[0].x)+20):(f=q(),g=f+t()+fg(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),dj.style("top",i+"px").style("left",g+"px"))}function Nd(){dj.style("display","none")}function Od(a){var c=a.filter(function(a){return a&&b(a.value)});ii&&($d(uf.data.targets)||be(uf.data.targets)||aj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Yg?"y1":"x1",zd).attr(Yg?"y2":"x2",zd))}function Pd(){aj.select("line."+f.xgridFocus).style("visibility","hidden")}function Qd(a){return a.x||0===a.x?fg(a.x):null}function Rd(a){return V(a.id)(a.value)}function Sd(){var a,b,d={},e=0;return Ic(Fc(ee)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Wd(a,b){return Uh?Uh:b?2*a.tickOffset()*Vh/b:0}function Xd(a,b){Dc(a).forEach(function(a){hj[a]=b===yg[a],yg[a]=b})}function Yd(a,b){var c=!1;return a.forEach(function(a){yg[a.id]===b&&(c=!0),a.id in yg||"line"!==b||(c=!0)}),c}function Zd(a){return Yd(a,"bar")}function $d(a){return Yd(a,"scatter")}function _d(a){return Yd(a,"pie")}function ae(a){return Yd(a,"donut")}function be(a){return _d(a)||ae(a)}function ce(a){var b="string"==typeof a?a:a.id;return!(b in yg)||"line"===yg[b]||"spline"===yg[b]||"area"===yg[b]||"area-spline"===yg[b]}function de(a){var b="string"==typeof a?a:a.id;return"spline"===yg[b]||"area-spline"===yg[b]}function ee(a){var b="string"==typeof a?a:a.id;return"bar"===yg[b]}function fe(a){var b="string"==typeof a?a:a.id;return"scatter"===yg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"pie"===yg[b]}function he(a){var b="string"==typeof a?a:a.id;return"donut"===yg[b]}function ie(a){return ge(a)||he(a)}function je(a){return ee(a)?a.values:[]}function ke(a){return ce(a)||fe(a)?a.values:[]}function le(a){return ee(a)||ce(a)?a.values:[]}function me(a){return he(a)&&ci||ge(a)&&Yh}function ne(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function oe(b){var c;try{c=rg?tf.time.format(rg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+rg)}return c}function pe(a,b){var c=tf.mouse(a),d=tf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function ue(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ve(a,b){var c="y"===Z(a.id)?gg:hg,d=Yg?1:0,e=Yg?0:1;return Math.pow(fg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function we(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function xe(a,b,c){Lg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd).attr("stroke",function(){return Di(b)}).attr("r",1.4*Sh).transition().duration(100).attr("r",Sh)}function ye(a,b,c){Mg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ze(a,b,c,d){a?xe(b,c,d):ye(b,c,d)}function Ae(a,b){Lg(b,a.node()),a.transition().duration(100).style("fill",function(){return tf.rgb(Di(b)).darker(1)})}function Be(a,b){Mg(b,a.node()),a.transition().duration(100).style("fill",function(){return Di(b)})}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a){return a.filter(function(a){return b(a.value)})}function Ee(a,c){return(c?aj.selectAll("."+f.circles+ld(c)):aj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Fe(a,b){Ee(a,b).classed(f.EXPANDED,!0).attr("r",Rh)}function Ge(a){Ee(a).filter(function(){return tf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oh)}function He(a){return aj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ie(a){He(a).classed(f.EXPANDED,!0)}function Je(a){He(a).classed(f.EXPANDED,!1)}function Ke(a,b){var c=Oe(a,b);return function(a,b){var d=c(a,b),e=Yg?1:0,f=Yg?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 Le(a,b){var c=Oe(a,!1),d=b?Me:Ne;return function(a,b){return d(c(a,b),a,this)}}function Me(a,b){var c;return Yg?(c=ee(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ne(a,b,c){var d=c.getBoundingClientRect();return Yg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ee(b)?-3:-6)}function Oe(a,b){var c=a.__max__+1,d=Wd(lg,c),e=Td(d,c,a,!!b),f=Ud(!!b),g=Vd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Yg&&(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 Pe(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 Qe(b){var c,d,e;if(ej=tf.select(wf),ej.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ej.html(""),ej.classed("c3",!0),uf.data.xs={},uf.data.targets=vc(b),n(),R(),fg.domain(tf.extent(_b(uf.data.targets))),gg.domain(Xb(uf.data.targets,"y")),hg.domain(Xb(uf.data.targets,"y2")),ig.domain(fg.domain()),jg.domain(gg.domain()),kg.domain(hg.domain()),fj=fg.domain(),Vi.scale(ig),Bf&&Zi.scale(fg),$i=ej.append("svg").attr("width",Mf+Jf.left+Jf.right).attr("height",Of+Jf.top+Jf.bottom).on("mouseenter",Ef).on("mouseleave",Ff),_i=$i.append("defs"),_i.append("clipPath").attr("id",pi).append("rect").attr("width",Mf).attr("height",Of),_i.append("clipPath").attr("id",qi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),_i.append("clipPath").attr("id",ri).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),aj=$i.append("g").attr("transform",Mi.main),bj=Pg?$i.append("g").attr("transform",Mi.context):null,cj=$i.append("g").attr("transform",Mi.legend),Sg||(cj.style("visibility","hidden"),Hi=Cc(uf.data.targets)),dj=tf.select(wf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),of(Cc(uf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Zg&&aj.append("g").attr("class",f.axisX).attr("clip-path",ti).attr("transform",Mi.x).append("text").attr("class",f.axisXLabel).attr("transform",Yg?"rotate(-90)":"").style("text-anchor",zb),ph&&aj.append("g").attr("class",f.axisY).attr("clip-path",ui).attr("transform",Mi.y).append("text").attr("class",f.axisYLabel).attr("transform",Yg?"":"rotate(-90)").style("text-anchor",Ab),yh&&aj.append("g").attr("class",f.axisY2).attr("transform",Mi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Yg?"":"rotate(-90)").style("text-anchor",Bb),d=aj.append("g").attr("clip-path",si).attr("class",f.grid),Hh&&d.append("g").attr("class",f.xgrids),te(Jh)&&d.append("g").attr("class",f.xgridLines),Ph&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Kh&&d.append("g").attr("class",f.ygrids),te(Lh)&&d.append("g").attr("class",f.ygridLines),aj.append("g").attr("clip-path",si).attr("class",f.regions),aj.append("g").attr("clip-path",si).attr("class",f.chart),c=aj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Bf?Yg?"ns-resize":"ew-resize":null),aj.select("."+f.chart).append("g").attr("class",f.chartBars),aj.select("."+f.chart).append("g").attr("class",f.chartLines),aj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Mi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),aj.select("."+f.chart).append("g").attr("class",f.chartTexts),Bf&&aj.insert("rect",Df?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Mf).attr("height",Of).style("opacity",0).style("cursor",Yg?"ns-resize":"ew-resize").call(Zi).on("dblclick.zoom",null),nh&&Vi.extent("function"!=typeof nh?nh:nh(_b())),Pg&&(bj.append("g").attr("clip-path",si).attr("class",f.chart),bj.select("."+f.chart).append("g").attr("class",f.chartBars),bj.select("."+f.chart).append("g").attr("class",f.chartLines),bj.append("g").attr("clip-path",si).attr("class",f.brush).call(Vi).selectAll("rect").attr(Yg?"width":"height",Yg?Nf:Pf),bj.append("g").attr("class",f.axisX).attr("transform",Mi.subx).attr("clip-path",Yg?"":ti)),bf(uf.data.targets),Yg?aj.select("."+f.axisX).style("opacity",0).call(lg):(aj.select("."+f.axisY).style("opacity",0).call(mg),aj.select("."+f.axisY2).style("opacity",0).call(ng)),n(),R(),_e(),m(),Xe({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),mi){if(vi&&"string"==typeof ni){for(ni=oe(ni),e=0;e0){d=[];for(var g in tg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Id(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ce,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 Ve(a){be(uf.data.targets)||Eg&&(yi=a,aj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),zi=!0,Ng())}function We(){be(uf.data.targets)||Eg&&(aj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),aj.selectAll("."+f.shape).classed(f.INCLUDED,!1),zi=!1,Og())}function Xe(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U=Sd(),V=be(uf.data.targets),W=Ic(uf.data.targets);if(0!==W.length){if(a=d(a)?a:{},z=d(a.withY)?a.withY:!0,A=d(a.withSubchart)?a.withSubchart:!0,B=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,C=d(a.withTransitionForExit)?a.withTransitionForExit:B,D=d(a.withTransitionForAxis)?a.withTransitionForAxis:B,E=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:B,O=B?If:0,P=C?O:0,Q=D?O:0,I&&Sg&&of(Cc(uf.data.targets),a),H&&(fg.domain(tf.extent(_b(W))),fj=fg.domain(),Bf&&Zi.scale(fg).updateScaleExtent(),ig.domain(fg.domain()),Vi.scale(ig)),G&&(fg.domain(Vi.empty()?fj:Vi.extent()),Bf&&Zi.scale(fg).updateScaleExtent()),gg.domain(Xb(W,"y")),hg.domain(Xb(W,"y2")),(gh||fh)&&(R=hh?hh:Kc(Jc(W)),lg.tickValues(R),og.tickValues(R)),c=aj.select("."+f.axisX).style("opacity",V?0:1),(Yg||E)&&(c=c.transition().duration(Q)),c.call(lg),g=aj.select("."+f.axisY).style("opacity",V?0:1),(!Yg||E)&&(g=g.transition().duration(Q)),g.call(mg),aj.select("."+f.axisY2).style("opacity",V?0:1).transition().duration(Q).call(ng),G)if(dh&&R){for(S=1;S=0&&tf.select(this).style("display",b%T?"none":"block")})}else tf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!Yg&&ih&&eb(c),J=Ke(U),M=Le(U,!0),N=Le(U,!1),Db(),jg.domain(gg.domain()),kg.domain(hg.domain()),dj.style("display","none"),o(),aj.select("line."+f.xgridFocus).style("visibility","hidden"),Hh){if("year"===Ih){i=[];for(var X=_b(),Y=X[0].getFullYear(),Z=X[1].getFullYear(),$=Y;Z>=$;$++)i.push(new Date($+"-01-01 00:00:00"))}else i=fg.ticks(10);h=aj.select("."+f.xgrids).selectAll("."+f.xgrid).data(i),h.enter().append("line").attr("class",f.xgrid),h.attr("x1",Yg?0:function(a){return fg(a)-lg.tickOffset()}).attr("x2",Yg?Mf:function(a){return fg(a)-lg.tickOffset()}).attr("y1",Yg?function(a){return fg(a)-lg.tickOffset()}:Jf.top).attr("y2",Yg?function(a){return fg(a)-lg.tickOffset()}:Of).style("opacity",function(){return+tf.select(this).attr(Yg?"y1":"x1")===(Yg?Of:0)?0:1}),h.exit().remove()}te(Jh)&&(j=aj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Jh),k=j.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),k.append("line").style("opacity",0),k.append("text").attr("text-anchor","end").attr("transform",Yg?"":"rotate(-90)").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),j.select("line").transition().duration(O).attr("x1",Yg?0:Ad).attr("x2",Yg?Mf:Ad).attr("y1",Yg?Ad:Jf.top).attr("y2",Yg?Ad:Of).style("opacity",1),j.select("text").transition().duration(O).attr("x",Yg?Mf:0).attr("y",Ad).text(function(a){return a.text}).style("opacity",1),j.exit().transition().duration(O).style("opacity",0).remove()),z&&Kh&&(l=aj.select("."+f.ygrids).selectAll("."+f.ygrid).data(gg.ticks(Mh)),l.enter().append("line").attr("class",f.ygrid),l.attr("x1",Yg?gg:0).attr("x2",Yg?gg:Mf).attr("y1",Yg?0:gg).attr("y2",Yg?Of:gg),l.exit().remove()),z&&te(Lh)&&(m=aj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Lh),n=m.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),n.append("line").style("opacity",0),n.append("text").attr("text-anchor","end").attr("transform",Yg?"rotate(-90)":"").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),m.select("line").transition().duration(O).attr("x1",Yg?Bd:0).attr("x2",Yg?Bd:Mf).attr("y1",Yg?0:Bd).attr("y2",Yg?Of:Bd).style("opacity",1),m.select("text").transition().duration(O).attr("x",Yg?0:Mf).attr("y",Bd).text(function(a){return a.text}).style("opacity",1),m.exit().transition().duration(O).style("opacity",0).remove()),q=aj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),q.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Di(a)}).attr("class",ad),q.style("opacity",qd).transition().duration(O).attr("d",J).style("opacity",1),q.exit().transition().duration(P).style("opacity",0).remove(),s=aj.selectAll("."+f.texts).selectAll("."+f.text).data(le),s.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return Yg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),s.text(function(a){return yd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(O).attr("x",M).attr("y",N).style("fill-opacity",td),s.exit().transition().duration(P).style("fill-opacity",0).remove(),aj.selectAll("."+f.line).style("opacity",qd).transition().duration(O).attr("d",Wi).style("opacity",1),aj.selectAll("."+f.area).style("opacity",0).transition().duration(O).attr("d",Xi).style("opacity",gj),p=aj.selectAll("."+f.circles).selectAll("."+f.circle).data(ke),p.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Oh),p.style("opacity",qd).transition().duration(O).style("opacity",sd).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),p.exit().remove(),aj.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(O).attrTween("d",function(a){var b,c=Fb(a);return c?(b=tf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1),aj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(O).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&ie(a.data)?1:0}),aj.select("."+f.chartArcsTitle).style("opacity",ae(uf.data.targets)?1:0),Pg&&(null!==tf.event&&"zoom"===tf.event.type&&Vi.extent(fg.orgDomain()).update(),A&&(e=bj.select("."+f.axisX).style("opacity",V?0:1),(Yg||E)&&(e=e.transition().duration(Q)),e.call(og),!Yg&&ih&&eb(e),Vi.empty()||Vi.extent(fg.orgDomain()).update(),K=Ke(U,!0),t=bj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),t.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Di(a)}).attr("class",ad),t.style("opacity",qd).transition().duration(O).attr("d",K).style("opacity",1),t.exit().transition().duration(O).style("opacity",0).remove(),bj.selectAll("."+f.line).style("opacity",qd).transition().duration(O).attr("d",Yi).style("opacity",1))),aj.selectAll("."+f.selectedCircles).filter(function(a){return ee(a)}).selectAll("circle").remove(),aj.selectAll("."+f.selectedCircle).transition().duration(O).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),u=aj.select("."+f.eventRects),te(qg)&&!oc(qg)?(u.classed(f.eventRectsMultiple)||u.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),v=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Se(v.enter()),v.attr("x",0).attr("y",0).attr("width",Mf).attr("height",Of)):(u.classed(f.eventRectsSingle)||u.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),xi&&!wi?(y=function(a,b){var c=xc(b),d=yc(b),e=uf.data.xs[a.id][b];return(fg(d?d:e+50)-fg(c?c:e-50))/2},x=function(a,b){var c=xc(b),d=uf.data.xs[a.id][b];return(fg(d)+fg(c?c:d-50))/2}):(y=L(),x=function(a){return fg(a.x)-y/2}),w=Ac(uf.data.targets),aj.select("."+f.eventRects).datum(w?w.values:[]),v=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Re(v.enter()),v.attr("class",fd).attr("x",Yg?0:x).attr("y",Yg?x:0).attr("width",Yg?Mf:y).attr("height",Yg?y:Of),v.exit().remove()),r=aj.select("."+f.regions).selectAll("rect."+f.region).data(hi),r.enter().append("rect").style("fill-opacity",0),r.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(O).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Cc(uf.data.targets).forEach(function(a){hj[a]=!0})}}function Ye(){Xe({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ze(){return"mousemove"===tf.event.sourceEvent.type&&Zi.altDomain?(fg.domain(Zi.altDomain),void Zi.scale(fg).updateScaleExtent()):(wi&&fg.orgDomain()[0]===fj[0]&&fg.domain([fj[0]-1e-10,fg.orgDomain()[1]]),Xe({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===tf.event.sourceEvent.type&&(Ai=!0)))}function $e(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function _e(){$i.attr("width",Qf).attr("height",Rf),$i.select("#"+pi).select("rect").attr("width",Mf).attr("height",Of),$i.select("#"+qi).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),$i.select("#"+ri).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),$i.select("."+f.zoomRect).attr("width",Mf).attr("height",Of),ej.style("max-height",Rf+"px")}function af(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),_e(),m(a.withTransition),Xe(a)}function bf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=aj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Di(a)}),e=aj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("fill",function(a){return Di(a)}).style("stroke","none").style("cursor",function(a){return Gg(a)?"pointer":null}),c=aj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)}),b.append("path").attr("class",dd).style("opacity",function(){return gj=+tf.select(this).style("opacity"),0}).style("fill",function(a){return Di(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Di(a)}).style("cursor",function(a){return Gg(a)?"pointer":null}),a.forEach(function(a){aj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=aj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Yf(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Di(a.data)}).style("cursor",function(a){return Gg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Fb(a),d=Lb(c),e=Tb();Nb(c.data.id),jf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Fb(a),c=[Lb(b)];Md(c,tf.mouse(this))}).on("mouseout",function(a,b){var c=Fb(a),d=Lb(c),e=Ub();Ob(c.data.id),lf(),Nd(),e(d,b)}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Pg&&(n=bj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Di(a)}),l=bj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)})),$i.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function cf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Xd(a.id,b.types[a.id]):Xd(a.id,b.type)}),uf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Ni?j:i,l=Ni?Q():P();return d&&(w=0,C=0,t=0,u=0),Sg&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Ni?u:t,void(Xg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,Ni?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=cj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Ug?Ug(a):uf.toggle(a)}).on("mouseover",function(a){uf.focus(a),"function"==typeof Vg&&Vg(a)}).on("mouseout",function(a){uf.revert(),"function"==typeof Wg&&Wg(a)}),l.append("text").text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",Ni?g:-200).attr("y",Ni?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ni?h:-200).attr("y",Ni?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Di(a)}).attr("x",Ni?g:-200).attr("y",Ni?-200:i).attr("width",10).attr("height",10),cj.selectAll("text").data(a).text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),cj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),cj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),_e(),q&&m(p)}function pf(a){return Ec(uf.data.targets,a.id)}function qf(a){return"data"in a&&Ec(uf.data.targets,a.data.id)}function rf(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 sf(a,b,c){var d=!be(uf.data.targets);Xd(a,b),af(c?c:{withTransitionForAxis:d})}var tf=a.d3?a.d3:a.require?a.require("d3"):void 0,uf={data:{},axis:{},legend:{}},vf={},wf=h(["bindto"],"#chart"),xf=h(["size","width"]),yf=h(["size","height"]),zf=h(["padding","left"]),Af=h(["padding","right"]),Bf=h(["zoom","enabled"],!1),Cf=h(["zoom","extent"]),Df=h(["zoom","privileged"],!1),Ef=h(["onenter"],function(){}),Ff=h(["onleave"],function(){}),Gf=h(["onresize"],function(){}),Hf=h(["onresized"],function(){}),If=h(["transition","duration"],350);g("data","data is required in config");var Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg=h(["data","x"]),qg=h(["data","xs"],{}),rg=h(["data","x_format"]),sg=h(["data","id_converter"],function(a){return a}),tg=h(["data","names"],{}),ug=h(["data","classes"],{}),vg=h(["data","groups"],[]),wg=h(["data","axes"],{}),xg=h(["data","type"]),yg=h(["data","types"],{}),zg=h(["data","labels"],{}),Ag=h(["data","order"]),Bg=h(["data","regions"],{}),Cg=h(["data","color"]),Dg=h(["data","colors"],{}),Eg=h(["data","selection","enabled"],!1),Fg=h(["data","selection","grouped"],!1),Gg=h(["data","selection","isselectable"],function(){return!0}),Hg=h(["data","selection","multiple"],!0),Ig=h(["data","onclick"],function(){}),Jg=h(["data","onenter"],function(){}),Kg=h(["data","onleave"],function(){}),Lg=h(["data","onselected"],function(){}),Mg=h(["data","onunselected"],function(){}),Ng=h(["data","ondragstart"],function(){}),Og=h(["data","ondragend"],function(){}),Pg=h(["subchart","show"],!1),Qg=h(["subchart","size","height"],60),Rg=h(["color","pattern"],[]),Sg=h(["legend","show"],!0),Tg=h(["legend","position"],"bottom"),Ug=h(["legend","item","onclick"]),Vg=h(["legend","item","onmouseover"]),Wg=h(["legend","item","onmouseout"]),Xg=h(["legend","equally"],!1),Yg=h(["axis","rotated"],!1),Zg=h(["axis","x","show"],!0),$g=h(["axis","x","type"],"indexed"),_g=h(["axis","x","localtime"],!0),ah=h(["axis","x","categories"],[]),bh=h(["axis","x","tick","centered"],!1),ch=h(["axis","x","tick","format"]),dh=h(["axis","x","tick","culling"],{}),eh=h(["axis","x","tick","culling","max"],10),fh=h(["axis","x","tick","count"]),gh=h(["axis","x","tick","fit"],!0),hh=h(["axis","x","tick","values"],null),ih=h(["axis","x","tick","rotate"]),jh=h(["axis","x","max"],null),kh=h(["axis","x","min"],null),lh=h(["axis","x","padding"],{}),mh=h(["axis","x","height"]),nh=h(["axis","x","default"]),oh=h(["axis","x","label"],{}),ph=h(["axis","y","show"],!0),qh=h(["axis","y","max"]),rh=h(["axis","y","min"]),sh=h(["axis","y","center"]),th=h(["axis","y","label"],{}),uh=h(["axis","y","inner"],!1),vh=h(["axis","y","tick","format"]),wh=h(["axis","y","padding"],{}),xh=h(["axis","y","ticks"],10),yh=h(["axis","y2","show"],!1),zh=h(["axis","y2","max"]),Ah=h(["axis","y2","min"]),Bh=h(["axis","y2","center"]),Ch=h(["axis","y2","label"],{}),Dh=h(["axis","y2","inner"],!1),Eh=h(["axis","y2","tick","format"]),Fh=h(["axis","y2","padding"],{}),Gh=h(["axis","y2","ticks"],10),Hh=h(["grid","x","show"],!1),Ih=h(["grid","x","type"],"tick"),Jh=h(["grid","x","lines"],[]),Kh=h(["grid","y","show"],!1),Lh=h(["grid","y","lines"],[]),Mh=h(["grid","y","ticks"],10),Nh=h(["point","show"],!0),Oh=Nh?h(["point","r"],2.5):0,Ph=h(["point","focus","line","enabled"],!0),Qh=h(["point","focus","expand","enabled"],!0),Rh=h(["point","focus","expand","r"],Qh?4:Oh),Sh=h(["point","focus","select","r"],8),Th=h(["line","connect_null"],!1),Uh=h(["bar","width"]),Vh=h(["bar","width","ratio"],.6),Wh=h(["pie","label","show"],!0),Xh=h(["pie","label","format"]),Yh=h(["pie","expand"],!0),Zh=h(["pie","onclick"],function(){}),$h=h(["pie","onmouseover"],function(){}),_h=h(["pie","onmouseout"],function(){}),ai=h(["donut","label","show"],!0),bi=h(["donut","label","format"]),ci=h(["donut","expand"],!0),di=h(["donut","title"],""),ei=h(["donut","onclick"],function(){}),fi=h(["donut","onmouseover"],function(){}),gi=h(["donut","onmouseout"],function(){}),hi=h(["regions"],[]),ii=h(["tooltip","show"],!0),ji=h(["tooltip","format","title"]),ki=h(["tooltip","format","value"]),li=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ji?ji:b,l=ki?ki: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+""}),mi=h(["tooltip","init","show"],!1),ni=h(["tooltip","init","x"],0),oi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),pi=("string"==typeof wf?wf.replace("#",""):wf.id)+"-clip",qi=pi+"-xaxis",ri=pi+"-yaxis",si=i(pi),ti=i(qi),ui=i(ri),vi="timeseries"===$g,wi="categorized"===$g,xi=!vi&&(pg||te(qg)),yi=null,zi=!1,Ai=!1,Bi=!1,Ci=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Di=ne(Dg,te(Rg)?Rg:Ci,Cg),Ei=_g?tf.time.format:tf.time.format.utc,Fi=function(){var a=[[Ei("%Y/%-m/%-d"),function(){return!0}],[Ei("%-m/%-d"),function(a){return a.getMonth()}],[Ei("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ei("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ei("%I %p"),function(a){return a.getHours()}],[Ei("%I:%M"),function(a){return a.getMinutes()}],[Ei(":%S"),function(a){return a.getSeconds()}],[Ei(".%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)}}(),Gi=[],Hi=[],Ii=Yg?"left":"bottom",Ji=Yg?uh?"top":"bottom":uh?"right":"left",Ki=Yg?Dh?"bottom":"top":Dh?"left":"right",Li=Yg?"left":"bottom",Mi={main:function(){return"translate("+Jf.left+","+Jf.top+")"},context:function(){return"translate("+Kf.left+","+Kf.top+")"},legend:function(){return"translate("+Lf.left+","+Lf.top+")"},x:function(){return"translate(0,"+(Yg?0:Of)+")"},y:function(){return"translate(0,"+(Yg?Of:0)+")"},y2:function(){return"translate("+(Yg?0:Mf)+","+(Yg?1:0)+")"},subx:function(){return"translate(0,"+(Yg?0:Pf)+")"},arc:function(){return"translate("+Mf/2+","+Of/2+")"}},Ni="right"===Tg,Oi=0,Pi=0,Qi=0,Ri=.15,Si=30,Ti=Yg&&!Zg?0:30,Ui=5;Yf=tf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Vi,Wi=function(){var a=tf.svg.line().x(Yg?function(a){return V(a.id)(a.value)}:zd).y(Yg?zd:function(a){return V(a.id)(a.value)});return Th||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Th?De(b.values):b.values;return ce(b)?(a.interpolate(de(b)?"cardinal":"linear"),Bg[b.id]?Pe(e,fg,V(b.id),Bg[b.id]):a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Xi=function(){var a;return a=Yg?tf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(zd):tf.svg.area().x(zd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=De(b.values);return Yd([b],"area")||Yd([b],"area-spline")?(a.interpolate(de(b)?"cardinal":"linear"),a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Yi=function(){var a=tf.svg.line().x(Yg?function(a){return W(a.id)(a.value)}:Cd).y(Yg?Cd:function(a){return W(a.id)(a.value)});return function(b){var c=De(b.values);return ce(b)?a(c):"M "+ig(c[0].x)+" "+W(b.id)(c[0].value)}}(),Zi=function(){};Vi=tf.svg.brush().on("brush",Ye),Vi.update=function(){return bj&&bj.select("."+f.brush).call(this),this},Vi.scale=function(a){return Yg?this.y(a):this.x(a)},Bf&&(Zi=tf.behavior.zoom().on("zoomstart",function(){Zi.altDomain=tf.event.sourceEvent.altKey?fg.orgDomain():null}).on("zoom",Bf?Ze:null),Zi.scale=function(a){return Yg?this.y(a):this.x(a)},Zi.orgScaleExtent=function(){var a=Cf?Cf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},Zi.updateScaleExtent=function(){var a=ac(fg.orgDomain())/ac(fj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var $i,_i,aj,bj,cj,dj,ej,fj,gj,hj={};if(uf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),uf.defocus(),b(d.classed(f.focused,!0)),b(e),be(uf.data.targets)&&Nb(a,!0),jf(a)},uf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),kf(a)},uf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),lf()},uf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),$i.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?mf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},uf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),$i.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?nf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Ri),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},uf.toggle=function(a){Gc(a)?uf.hide(a):uf.show(a)},uf.unzoom=function(){Vi.clear().update(),Xe({withUpdateXDomain:!0})},uf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){ug[b]=a.classes[b]}),"categories"in a&&wi&&(ah=a.categories,lg.categories(ah)),"cacheIds"in a&&bc(a.cacheIds)?void cf(dc(a.cacheIds),a.done):void("unload"in a?ef(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){df(a)}):df(a))},uf.unload=function(a){ef(Dc(a),function(){Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},uf.selected=function(a){return tf.merge(aj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return tf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},uf.select=function(a,b,c){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=tf.select(this),i="circle"===this.nodeName?xe:Ae,j="circle"===this.nodeName?ye:Be,k=Fg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Gg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},uf.unselect=function(a,b){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=tf.select(this),g="circle"===this.nodeName?ye:Be,h=Fg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Gg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},uf.toLine=function(a){sf(a,"line")},uf.toSpline=function(a){sf(a,"spline")},uf.toBar=function(a){sf(a,"bar")},uf.toScatter=function(a){sf(a,"scatter")},uf.toArea=function(a){sf(a,"area")},uf.toAreaSpline=function(a){sf(a,"area-spline")},uf.toPie=function(a){sf(a,"pie",{withTransform:!0})},uf.toDonut=function(a){sf(a,"donut",{withTransform:!0})},uf.groups=function(a){return c(a)?vg:(vg=a,Xe(),vg)},uf.xgrids=function(a){return a?(Jh=a,Xe(),Jh):Jh},uf.xgrids.add=function(a){return a?uf.xgrids(Jh.concat(a)):void 0},uf.xgrids.remove=function(a){var b=rf(a);return uf.xgrids(Jh.filter(b))},uf.ygrids=function(a){return a?(Lh=a,Xe(),Lh):Lh },uf.ygrids.add=function(a){return a?uf.ygrids(Lh.concat(a)):void 0},uf.ygrids.remove=function(a){var b=rf(a);return uf.ygrids(Lh.filter(b))},uf.regions=function(a){return c(a)?hi:(hi=a,Xe(),hi)},uf.regions.add=function(a){return c(a)?hi:(hi=hi.concat(a),Xe(),hi)},uf.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;$i.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),hi=hi.filter(function(b){return b.classes.indexOf(a)<0})}),hi},uf.data.get=function(a){var b=uf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},uf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},uf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){tg[b]=a[b]}),of(Cc(uf.data.targets),{withTransition:!0}),tg):tg},uf.x=function(a){return arguments.length&&(qc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.xs=function(a){return arguments.length&&(rc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},uf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(qh=+a.y),b(a.y2)&&(zh=+a.y2)):qh=zh=+a,Xe())},uf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(rh=+a.y),b(a.y2)&&(Ah=+a.y2)):rh=Ah=+a,Xe())},uf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&uf.axis.max(a.max),"undefined"!=typeof a.min&&uf.axis.min(a.min))},uf.legend.show=function(a){Sg||(Sg=!0,cj.style("visibility","visible")),mf(Dc(a)),Xe({withTransitionForHorizontalAxis:!1})},uf.legend.hide=function(a){Sg&&se(a)&&(Sg=!1,cj.style("visibility","hidden")),nf(Dc(a)),Xe({withTransitionForHorizontalAxis:!1})},uf.resize=function(a){xf=a?a.width:null,yf=a?a.height:null,af({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},uf.destroy=function(){uf.data.targets=void 0,uf.data.xs={},ej.html(""),a.onresize=null},"url"in e.data)tf.xhr(e.data.url,function(a,b){var c,d=tf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=tf.csv.parse(b.response),Qe(c)});else if("rows"in e.data)Qe(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Qe(uc(e.data.columns))}return uf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From d482cd34da2523e324e3d881374c53cf20b277d0 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Sun, 27 Apr 2014 15:38:01 +0900 Subject: [PATCH 068/178] Fix resize when no data shown - #151 --- c3.js | 256 +++++++++++++++++++++++++++++++----------------------- c3.min.js | 6 +- 2 files changed, 151 insertions(+), 111 deletions(-) diff --git a/c3.js b/c3.js index b6b2d13..c624edc 100644 --- a/c3.js +++ b/c3.js @@ -321,7 +321,7 @@ var margin, margin2, margin3, width, width2, height, height2, currentWidth, currentHeight; var radius, radiusExpanded, innerRadius, svgArc, svgArcExpanded, svgArcExpandedSub, pie; var xMin, xMax, yMin, yMax, subXMin, subXMax, subYMin, subYMax; - var x, y, y2, subX, subY, subY2, xAxis, yAxis, yAxis2, subXAxis; + var x, y, y2, subX, subY, subY2, xAxis, yAxis, y2Axis, subXAxis; var xOrient = __axis_rotated ? "left" : "bottom", yOrient = __axis_rotated ? (__axis_y_inner ? "top" : "bottom") : (__axis_y_inner ? "right" : "left"), @@ -348,27 +348,30 @@ return "url(" + document.URL.split('#')[0] + "#" + id + ")"; } - function transformMain(withTransition) { - var duration = withTransition !== false ? 250 : 0; + function transformMain(withTransition, transitions) { + var duration = withTransition !== false ? 250 : 0, + xAxis = (transitions && transitions.axisX) ? transitions.axisX : main.select('.' + CLASS.axisX).transition().duration(duration), + yAxis = (transitions && transitions.axisY) ? transitions.axisY : main.select('.' + CLASS.axisY).transition().duration(duration), + y2Axis = (transitions && transitions.axisYs) ? transitions.axisY2 : main.select('.' + CLASS.axisY2).transition().duration(duration); main.attr("transform", translate.main); - main.select('.' + CLASS.axisX).transition().duration(duration).attr("transform", translate.x); - main.select('.' + CLASS.axisY).transition().duration(duration).attr("transform", translate.y); - main.select('.' + CLASS.axisY2).attr("transform", translate.y2); + xAxis.attr("transform", translate.x); + yAxis.attr("transform", translate.y); + y2Axis.attr("transform", translate.y2); main.select('.' + CLASS.chartArcs).attr("transform", translate.arc); } - function transformContext() { - if (__subchart_show) { - context.attr("transform", translate.context); - context.select('.' + CLASS.axisX).attr("transform", translate.subx); - } + function transformContext(withTransition, transitions) { + var duration = withTransition !== false ? 250 : 0, + subXAxis = (transitions && transitions.axisSubX) ? transitions.axisSubX : context.select('.' + CLASS.axisX).transition().duration(duration); + context.attr("transform", translate.context); + subXAxis.attr("transform", translate.subx); } function transformLegend(withTransition) { var duration = withTransition !== false ? 250 : 0; legend.transition().duration(duration).attr("transform", translate.legend); } - function transformAll(withTransition) { - transformMain(withTransition); - transformContext(withTransition); + function transformAll(withTransition, transitions) { + transformMain(withTransition, transitions); + if (__subchart_show) { transformContext(withTransition, transitions); } transformLegend(withTransition); } @@ -593,7 +596,7 @@ xAxis = getXAxis(x, xOrient, xAxisTickFormat); subXAxis = getXAxis(subX, subXOrient, xAxisTickFormat); yAxis = getYAxis(y, yOrient, __axis_y_tick_format, __axis_y_ticks); - yAxis2 = getYAxis(y2, y2Orient, __axis_y2_tick_format, __axis_y2_ticks); + y2Axis = getYAxis(y2, y2Orient, __axis_y2_tick_format, __axis_y2_ticks); // Set initialized scales to brush and zoom if (!forInit) { brush.scale(subX); @@ -902,32 +905,42 @@ var c = category(i); return tickFormat ? tickFormat(c) : c; } + function copyScale() { + var newScale = scale.copy(), domain = scale.domain(); + newScale.domain([domain[0], domain[1] - 1]); + return newScale; + } function axis(g) { g.each(function () { var g = d3.select(this); - var ticks = generateTicks(scale.domain()); - var tick = g.selectAll(".tick.major").data(ticks, String), + var scale1 = copyScale(), scale0 = this.__chart__ || scale1; + var tick = g.selectAll(".tick.major").data(generateTicks(scale1.domain()), String), tickEnter = tick.enter().insert("g", "path").attr("class", "tick major").style("opacity", 1e-6), tickExit = d3.transition(tick.exit()).style("opacity", 1e-6).remove(), tickUpdate = d3.transition(tick).style("opacity", 1), tickTransform, tickX; - var range = scale.rangeExtent ? scale.rangeExtent() : scaleExtent(scale.range()), - path = g.selectAll(".domain").data([ 0 ]); + var range = scale.rangeExtent ? scale.rangeExtent() : scaleExtent(scale.range()); + var path = g.selectAll(".domain").data([ 0 ]), pathUpdate; + var lineEnter, lineUpdate, text, textEnter, textUpdate; path.enter().append("path").attr("class", "domain"); + pathUpdate = d3.transition(path); - var pathUpdate = d3.transition(path); - - var scale1 = scale.copy(), scale0 = this.__chart__ || scale1; - this.__chart__ = scale1; tickEnter.append("line"); tickEnter.append("text"); - var lineEnter = tickEnter.select("line"), lineUpdate = tickUpdate.select("line"), text = tick.select("text"), textEnter = tickEnter.select("text"), textUpdate = tickUpdate.select("text"); + + lineEnter = tickEnter.select("line"); + lineUpdate = tickUpdate.select("line"); + text = tick.select("text"); + textEnter = tickEnter.select("text"); + textUpdate = tickUpdate.select("text"); tickOffset = (scale1(1) - scale1(0)) / 2; tickX = tickCentered ? 0 : tickOffset; + this.__chart__ = scale1; + switch (orient) { case "bottom": { @@ -1572,8 +1585,11 @@ return maxTarget; } function getEdgeX(targets) { - var target = getMaxDataCountTarget(targets), - firstData = target.values[0], lastData = target.values[target.values.length - 1]; + var target = getMaxDataCountTarget(targets), firstData, lastData; + if (!target) { + return [0, 0]; + } + firstData = target.values[0], lastData = target.values[target.values.length - 1]; return [firstData.x, lastData.x]; } function mapToIds(targets) { @@ -2556,9 +2572,13 @@ // Define regions main = svg.append("g").attr("transform", translate.main); - context = __subchart_show ? svg.append("g").attr("transform", translate.context) : null; + context = svg.append("g").attr("transform", translate.context); legend = svg.append("g").attr("transform", translate.legend); + if (!__subchart_show) { + context.style('visibility', 'hidden'); + } + if (!__legend_show) { legend.style('visibility', 'hidden'); hiddenLegendIds = mapToIds(c3.data.targets); @@ -2694,35 +2714,34 @@ /*-- Context Region --*/ - if (__subchart_show) { - // Define g for chart area - context.append('g') - .attr("clip-path", clipPath) - .attr('class', CLASS.chart); - - // Define g for bar chart area - context.select('.' + CLASS.chart).append("g") - .attr("class", CLASS.chartBars); - - // Define g for line chart area - context.select('.' + CLASS.chart).append("g") - .attr("class", CLASS.chartLines); - - // Add extent rect for Brush - context.append("g") - .attr("clip-path", clipPath) - .attr("class", CLASS.brush) - .call(brush) - .selectAll("rect") - .attr(__axis_rotated ? "width" : "height", __axis_rotated ? width2 : height2); - - // ATTENTION: This must be called AFTER chart added - // Add Axis - context.append("g") - .attr("class", CLASS.axisX) - .attr("transform", translate.subx) - .attr("clip-path", __axis_rotated ? "" : clipPathForXAxis); - } + // Define g for chart area + context.append('g') + .attr("clip-path", clipPath) + .attr('class', CLASS.chart) + .attr("display", "none"); + + // Define g for bar chart area + context.select('.' + CLASS.chart).append("g") + .attr("class", CLASS.chartBars); + + // Define g for line chart area + context.select('.' + CLASS.chart).append("g") + .attr("class", CLASS.chartLines); + + // Add extent rect for Brush + context.append("g") + .attr("clip-path", clipPath) + .attr("class", CLASS.brush) + .call(brush) + .selectAll("rect") + .attr(__axis_rotated ? "width" : "height", __axis_rotated ? width2 : height2); + + // ATTENTION: This must be called AFTER chart added + // Add Axis + context.append("g") + .attr("class", CLASS.axisX) + .attr("transform", translate.subx) + .attr("clip-path", __axis_rotated ? "" : clipPathForXAxis); // Set targets updateTargets(c3.data.targets); @@ -2732,14 +2751,14 @@ main.select('.' + CLASS.axisX).style("opacity", 0).call(xAxis); } else { main.select('.' + CLASS.axisY).style("opacity", 0).call(yAxis); - main.select('.' + CLASS.axisY2).style("opacity", 0).call(yAxis2); + main.select('.' + CLASS.axisY2).style("opacity", 0).call(y2Axis); } // Update sizes according to tick width updated by above updateSizes(); updateScales(); updateSvgSize(); - transformAll(); + transformAll(false); // Draw with targets redraw({withTransform: true, withUpdateXDomain: true, withUpdateOrgXDomain: true, withTransitionForAxis: false}); @@ -3072,21 +3091,16 @@ } function redraw(options) { - var xaxis, subxaxis, yaxis, xgrid, xgridData, xgridLines, xgridLine, ygrid, ygridLines, ygridLine; + var xaxis, subxaxis, yaxis, y2axis, xgrid, xgridData, xgridLines, xgridLine, ygrid, ygridLines, ygridLine; var mainCircle, mainBar, mainRegion, mainText, contextBar, eventRect, eventRectUpdate; var barIndices = getBarIndices(), maxDataCountTarget; var rectX, rectW; var withY, withSubchart, withTransition, withTransitionForExit, withTransitionForAxis, withTransitionForHorizontalAxis, withTransform, withUpdateXDomain, withUpdateOrgXDomain, withLegend; var hideAxis = hasArcType(c3.data.targets); var drawBar, drawBarOnSub, xForText, yForText; - var duration, durationForExit, durationForAxis; + var transitions, duration, durationForExit, durationForAxis; var targetsToShow = filterTargetsToShow(c3.data.targets), tickValues, i, intervalForCulling; - // abort if no targets to show - if (targetsToShow.length === 0) { - return; - } - options = isDefined(options) ? options : {}; withY = isDefined(options.withY) ? options.withY : true; withSubchart = isDefined(options.withSubchart) ? options.withSubchart : true; @@ -3104,24 +3118,43 @@ durationForExit = withTransitionForExit ? duration : 0; durationForAxis = withTransitionForAxis ? duration : 0; + xaxis = main.select('.' + CLASS.axisX); + yaxis = main.select('.' + CLASS.axisY); + y2axis = main.select('.' + CLASS.axisY2); + subxaxis = context.select('.' + CLASS.axisX); + + transitions = { + axisX: xaxis.transition().duration(durationForAxis), + axisY: yaxis.transition().duration(durationForAxis), + axisY2: y2axis.transition().duration(durationForAxis), + axisSubX: subxaxis.transition().duration(durationForAxis), + }; + // update legend and transform each g if (withLegend && __legend_show) { - updateLegend(mapToIds(c3.data.targets), options); + updateLegend(mapToIds(c3.data.targets), options, transitions); } - if (withUpdateOrgXDomain) { - x.domain(d3.extent(getXDomain(targetsToShow))); - orgXDomain = x.domain(); - if (__zoom_enabled) { zoom.scale(x).updateScaleExtent(); } - subX.domain(x.domain()); - brush.scale(subX); + if (targetsToShow.length) { + if (withUpdateOrgXDomain) { + x.domain(d3.extent(getXDomain(targetsToShow))); + orgXDomain = x.domain(); + if (__zoom_enabled) { zoom.scale(x).updateScaleExtent(); } + subX.domain(x.domain()); + brush.scale(subX); + } + // ATTENTION: call here to update tickOffset + if (withUpdateXDomain) { + x.domain(brush.empty() ? orgXDomain : brush.extent()); + if (__zoom_enabled) { zoom.scale(x).updateScaleExtent(); } + } + } else { + // ticks increase without this when no data shown + if (isCategorized) { + x.domain([0, xaxis.selectAll('.tick').size()]); + } } - // ATTENTION: call here to update tickOffset - if (withUpdateXDomain) { - x.domain(brush.empty() ? orgXDomain : brush.extent()); - if (__zoom_enabled) { zoom.scale(x).updateScaleExtent(); } - } y.domain(getYDomain(targetsToShow, 'y')); y2.domain(getYDomain(targetsToShow, 'y2')); @@ -3133,19 +3166,32 @@ } // x axis - xaxis = main.select('.' + CLASS.axisX).style("opacity", hideAxis ? 0 : 1); + xaxis.style("opacity", hideAxis ? 0 : 1); if (__axis_rotated || withTransitionForHorizontalAxis) { - xaxis = xaxis.transition().duration(durationForAxis); + xaxis = transitions.axisX; } xaxis.call(xAxis); + // y axis - yaxis = main.select('.' + CLASS.axisY).style("opacity", hideAxis ? 0 : 1); + yaxis.style("opacity", hideAxis ? 0 : 1); if (!__axis_rotated || withTransitionForHorizontalAxis) { - yaxis = yaxis.transition().duration(durationForAxis); + yaxis = transitions.axisY; } yaxis.call(yAxis); + // y2 axis - main.select('.' + CLASS.axisY2).style("opacity", hideAxis ? 0 : 1).transition().duration(durationForAxis).call(yAxis2); + y2axis.style("opacity", hideAxis ? 0 : 1); + if (!__axis_rotated || withTransitionForHorizontalAxis) { + y2axis = transitions.axisY2; + } + y2axis.call(y2Axis); + + // sub x axis + subxaxis.style("opacity", hideAxis ? 0 : 1); + if (__axis_rotated || withTransitionForHorizontalAxis) { + subxaxis = transitions.axisSubX; + } + subxaxis.call(subXAxis); // show/hide if manual culling needed if (withUpdateXDomain) { @@ -3294,6 +3340,23 @@ .remove(); } + // rect for regions + mainRegion = main.select('.' + CLASS.regions).selectAll('rect.' + CLASS.region) + .data(__regions); + mainRegion.enter().append('rect') + .style("fill-opacity", 0); + mainRegion + .attr('class', classRegion) + .attr("x", regionX) + .attr("y", regionY) + .attr("width", regionWidth) + .attr("height", regionHeight) + .transition().duration(duration) + .style("fill-opacity", function (d) { return isValue(d.opacity) ? d.opacity : 0.1; }); + mainRegion.exit().transition().duration(duration) + .style("fill-opacity", 0) + .remove(); + // bars mainBar = main.selectAll('.' + CLASS.bars).selectAll('.' + CLASS.bar) .data(barData); @@ -3397,12 +3460,6 @@ } // update subchart elements if needed if (withSubchart) { - // axes - subxaxis = context.select('.' + CLASS.axisX).style("opacity", hideAxis ? 0 : 1); - if (__axis_rotated || withTransitionForHorizontalAxis) { - subxaxis = subxaxis.transition().duration(durationForAxis); - } - subxaxis.call(subXAxis); // rotate tick text if needed if (!__axis_rotated && __axis_x_tick_rotate) { @@ -3512,23 +3569,6 @@ eventRectUpdate.exit().remove(); } - // rect for regions - mainRegion = main.select('.' + CLASS.regions).selectAll('rect.' + CLASS.region) - .data(__regions); - mainRegion.enter().append('rect') - .style("fill-opacity", 0); - mainRegion - .attr('class', classRegion) - .attr("x", regionX) - .attr("y", regionY) - .attr("width", regionWidth) - .attr("height", regionHeight) - .transition().duration(duration) - .style("fill-opacity", function (d) { return isValue(d.opacity) ? d.opacity : 0.1; }); - mainRegion.exit().transition().duration(duration) - .style("fill-opacity", 0) - .remove(); - // update fadein condition mapToIds(c3.data.targets).forEach(function (id) { withoutFadeIn[id] = true; @@ -3877,7 +3917,7 @@ updateLegend(mapToIds(c3.data.targets)); } - function updateLegend(targetIds, options) { + function updateLegend(targetIds, options, transitions) { var xForLegend, xForLegendText, xForLegendRect, yForLegend, yForLegendText, yForLegendRect; var paddingTop = 4, paddingRight = 26, maxWidth = 0, maxHeight = 0, posMin = 10; var l, totalLength = 0, offsets = {}, widths = {}, heights = {}, margins = [0], steps = {}, step = 0; @@ -4034,7 +4074,7 @@ updateSvgSize(); // Update g positions if (withTransformAll) { - transformAll(withTransitionForTransform); + transformAll(withTransitionForTransform, transitions); } } @@ -4054,7 +4094,7 @@ function transformTo(targetIds, type, optionsForRedraw) { var withTransitionForAxis = !hasArcType(c3.data.targets); setTargetType(targetIds, type); - updateAndRedraw(optionsForRedraw ? optionsForRedraw : {withTransitionForAxis: withTransitionForAxis}); + updateAndRedraw(optionsForRedraw || {withTransitionForAxis: withTransitionForAxis}); } c3.focus = function (targetId) { diff --git a/c3.min.js b/c3.min.js index e8e36d8..989807c 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.32"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cMf&&(Mf=0),0>Of&&(Of=0),Nf=Yg?Jf.left-Si-Ti:Mf,Pf=Yg?Of:Rf-Kf.top-Kf.bottom,0>Nf&&(Nf=0),0>Pf&&(Pf=0),p(),Ni&&be(uf.data.targets)&&(Lf.left=Mf/2+Tf)}function o(){aj.select("line."+f.xgridFocus).attr("x1",Yg?0:-10).attr("x2",Yg?Mf:-10).attr("y1",Yg?-10:Jf.top).attr("y2",Yg?-10:Of)}function p(){Tf=Of/2,Sf=.95*Tf,Uf=ae(uf.data.targets)?.6*Sf:0}function q(){var a=Yg?f.axisX:f.axisY,b=tf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=tf.select(wf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return xf?xf:x()}function s(){var a=yf?yf:y();return a>0?a:320}function t(){return be(uf.data.targets)?0:zf?zf:Yg?Zg?v("x"):1:!ph||uh?1:v("y")}function u(){var a=1;return be(uf.data.targets)?0:Af?Af:Ni?P()+(yh&&!Yg?v("y2"):a):yh?Dh||Yg?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||Zg?"x"===a&&mh?mh:"y"!==a||ph?"y2"!==a||yh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Ui:Sg&&!Ni?10:1:0}function x(){return+tf.select(wf).style("width").replace("px","")}function y(){return+tf.select(wf).style("height").replace("px","")}function z(a){return a?-5:-(Jf.left-1)}function A(a){return a?-20:-4}function B(){return z(!Yg)}function C(){return A(!Yg)}function D(){return z(Yg)}function E(){return A(Yg)}function F(a){return a?Mf+2+4:Jf.left+20}function G(a){return a?(mh?mh:0)+80:Of+8}function H(){return F(!Yg)}function I(){return G(!Yg)}function J(){return F(Yg)}function K(){return G(Yg)}function L(){var a=Ac(uf.data.targets),b=a.values[0],c=a.values[a.values.length-1],d=fg(c.x)-fg(b.x),e=zc(),f=Zd(uf.data.targets)?(e-(wi?.25:1))/e:1;return e>1?d*f/(e-1):d}function M(a){Oi=a}function N(a){Pi=a}function O(a){Qi=a}function P(){return Sg?Ni?Pi*(Oi+1):Qf:0}function Q(){return Sg?Ni?Rf:Qi*(Oi+1):0}function R(){var a,b=!fg;Zf=Yg?1:0,$f=Yg?Of:Mf,_f=Yg?0:Of,ag=Yg?Mf:1,bg=Zf,cg=$f,dg=Yg?0:Pf,eg=Yg?Nf:1,fg=T(Zf,$f,b?void 0:fg.domain(),function(){return lg.tickOffset()}),gg=U(_f,ag,b?void 0:gg.domain()),hg=U(_f,ag,b?void 0:hg.domain()),ig=T(Zf,$f,fj,function(a){return a%1?0:og.tickOffset()}),jg=U(dg,eg,b?void 0:jg.domain()),kg=U(dg,eg,b?void 0:kg.domain()),a=$(),lg=X(fg,Ii,a),og=X(ig,Li,a),mg=Y(gg,Ji,vh,xh),ng=Y(hg,Ki,Eh,Gh),b||(Vi.scale(ig),Bf&&Zi.scale(fg)),S()}function S(){Vf=Gb(),Wf=Hb(),Xf=Hb(.98)}function T(a,b,d,e){var f=(vi?tf.time.scale():tf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),wi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=tf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?hg:gg}function W(a){return"y2"===Z(a)?kg:jg}function X(a,b,c){var d=(wi?Eb():tf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),wi?(d.tickCentered(bh),se(dh)&&(dh=!1)):d.tickOffset=function(){var a=Bc(uf.data.targets),b=fg(a[1])-fg(a[0]);return b/zc()/2},wi&&d.categories(ah),d}function Y(a,b,c,d){return tf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in wg?wg[a]:"y"}function $(){var a=vi?Fi:wi?Tc:function(a){return 0>a?a.toFixed(0):a};return ch&&("function"==typeof ch?a=ch:vi&&(a=function(a){return a?Ei(ch)(a):""})),a}function _(a){var b;return"y"===a?b=th:"y2"===a?b=Ch:"x"===a&&(b=oh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?th=b:"y2"===a?Ch=b:"x"===a&&(oh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a){a.selectAll(".tick text").attr("y",db(ih)).attr("x",cb(ih)).attr("transform","rotate("+ih+")").style("text-anchor","start")}function fb(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 gb(){return fb("x",Yg?"inner-top":"inner-right")}function hb(){return fb("y",Yg?"inner-right":"inner-top")}function ib(){return fb("y2",Yg?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Mf/2:Mf:b.isBottom?-Of:b.isMiddle?-Of/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!Yg,gb())}function rb(){return nb(Yg,hb())}function sb(){return nb(Yg,ib())}function tb(){return ob(!Yg,gb())}function ub(){return ob(Yg,hb())}function vb(){return ob(Yg,ib())}function wb(){var a=gb();return Yg?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":mh?mh-10:"3em"}function xb(){var a=hb();return Yg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return Yg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!Yg,gb())}function Ab(){return pb(Yg,hb())}function Bb(){return pb(Yg,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return tf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?30:b}function Db(){aj.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),aj.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),aj.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+o)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Rc(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 tf.min(Object.keys(i).map(function(a){return tf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(vg.length>0)for(g=Sc(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 tf.max(Object.keys(i).map(function(a){return tf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Ah:rh,n="y2"===c?zh:qh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Bh:sh,r=ud()&&Yg;return 0===l.length?"y2"===c?hg.domain():gg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(gg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&wh&&(f=b(wh.top)?wh.top:e,g=b(wh.bottom)?wh.bottom:e),"y2"===c&&Fh&&(f=b(Fh.top)?Fh.top:e,g=b(Fh.bottom)?Fh.bottom:e),Zd(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return kh?vi?oe(kh):kh:tf.min(a,function(a){return tf.min(a.values,function(a){return a.x})})}function Zb(a){return jh?vi?oe(jh):jh:tf.max(a,function(a){return tf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return wi?d=0:Zd(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof lh&&te(lh)?(e=b(lh.left)?lh.left:d,f=b(lh.right)?lh.right:d):e=f="number"==typeof lh?lh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?gg:hg;return b="y"===a.axis||"y2"===a.axis?Yg?Of:"start"in a?d(a.start):Of:Yg?"end"in a?fg(vi?oe(a.end):a.end):Of:Of,c>b?0:b-c}function ic(a){return pg&&a===pg||te(qg)&&ue(qg,a)}function jc(a){return!ic(a)}function kc(a){return pg?pg:te(qg)?qg[a]:null}function lc(a,b){var c,d=b&&te(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=uf.data.xs[b])}),c}function mc(a,b){return a in uf.data.xs&&uf.data.xs[a]&&uf.data.xs[a][b]?uf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){qg[b]=a[b]})}function oc(a){return 1===tf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=tg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),uf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=vi?a?a instanceof Date?a:oe(a):oe(mc(c,d)):xi&&!wi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?uf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):pg?(d=Object.keys(uf.data.xs),uf.data.xs[c]=d.length>0?uf.data.xs[d[0]]:void 0):te(qg)&&(uf.data.xs[c]=lc(f,uf.data.targets)):uf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!uf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=sg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return xi&&wi&&0===c&&g&&(0===e&&(ah=[]),ah.push(g)),("undefined"==typeof a[b]||uf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),xg&&Xd(Cc(c).filter(function(a){return!(a in yg)}),xg),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&uf.data.targets[0].values[a-1]?uf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b=Ac(a),c=b.values[0],d=b.values[b.values.length-1];return[c.x,d.x]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(uf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(vi?new Date(h):h);i.push(d)}return vi||(i=i.sort(function(a,b){return a-b})),i}function Lc(a){Gi=Gi.concat(a)}function Mc(a){Gi=Gi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Hi=Hi.concat(a)}function Oc(a){Hi=Hi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Dd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Dd(a,g))),Gd(e,b)):Ed(a,b,f,g)}function Fd(a,b){var c;return c=a.map(function(a){return Ed(a.values,b)}),Gd(c,b)}function Gd(a,b){var c,d;return a.forEach(function(a){var e=ve(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Hd(a,b){return tf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Id(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 Jd(){return Ag&&"desc"===Ag.toLowerCase()}function Kd(){return Ag&&"asc"===Ag.toLowerCase()}function Ld(a){var b=Kd(),c=Jd();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 Ag&&a.sort(Ag),a}function Md(a,c){var d,e,f,g,h,i,j,k=be(uf.data.targets),l=k?xd:wd,m=a.filter(function(a){return a&&b(a.value)});ii&&0!==m.length&&(dj.html(li(a,$(),l,Di)).style("display","block"),d=dj.property("offsetWidth"),e=dj.property("offsetHeight"),k?(g=Mf/2+c[0],i=Of/2+c[1]+20):(Yg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=fg(m[0].x)+20):(f=q(),g=f+t()+fg(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),dj.style("top",i+"px").style("left",g+"px"))}function Nd(){dj.style("display","none")}function Od(a){var c=a.filter(function(a){return a&&b(a.value)});ii&&($d(uf.data.targets)||be(uf.data.targets)||aj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Yg?"y1":"x1",zd).attr(Yg?"y2":"x2",zd))}function Pd(){aj.select("line."+f.xgridFocus).style("visibility","hidden")}function Qd(a){return a.x||0===a.x?fg(a.x):null}function Rd(a){return V(a.id)(a.value)}function Sd(){var a,b,d={},e=0;return Ic(Fc(ee)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Wd(a,b){return Uh?Uh:b?2*a.tickOffset()*Vh/b:0}function Xd(a,b){Dc(a).forEach(function(a){hj[a]=b===yg[a],yg[a]=b})}function Yd(a,b){var c=!1;return a.forEach(function(a){yg[a.id]===b&&(c=!0),a.id in yg||"line"!==b||(c=!0)}),c}function Zd(a){return Yd(a,"bar")}function $d(a){return Yd(a,"scatter")}function _d(a){return Yd(a,"pie")}function ae(a){return Yd(a,"donut")}function be(a){return _d(a)||ae(a)}function ce(a){var b="string"==typeof a?a:a.id;return!(b in yg)||"line"===yg[b]||"spline"===yg[b]||"area"===yg[b]||"area-spline"===yg[b]}function de(a){var b="string"==typeof a?a:a.id;return"spline"===yg[b]||"area-spline"===yg[b]}function ee(a){var b="string"==typeof a?a:a.id;return"bar"===yg[b]}function fe(a){var b="string"==typeof a?a:a.id;return"scatter"===yg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"pie"===yg[b]}function he(a){var b="string"==typeof a?a:a.id;return"donut"===yg[b]}function ie(a){return ge(a)||he(a)}function je(a){return ee(a)?a.values:[]}function ke(a){return ce(a)||fe(a)?a.values:[]}function le(a){return ee(a)||ce(a)?a.values:[]}function me(a){return he(a)&&ci||ge(a)&&Yh}function ne(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function oe(b){var c;try{c=rg?tf.time.format(rg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+rg)}return c}function pe(a,b){var c=tf.mouse(a),d=tf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function ue(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ve(a,b){var c="y"===Z(a.id)?gg:hg,d=Yg?1:0,e=Yg?0:1;return Math.pow(fg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function we(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function xe(a,b,c){Lg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd).attr("stroke",function(){return Di(b)}).attr("r",1.4*Sh).transition().duration(100).attr("r",Sh)}function ye(a,b,c){Mg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ze(a,b,c,d){a?xe(b,c,d):ye(b,c,d)}function Ae(a,b){Lg(b,a.node()),a.transition().duration(100).style("fill",function(){return tf.rgb(Di(b)).darker(1)})}function Be(a,b){Mg(b,a.node()),a.transition().duration(100).style("fill",function(){return Di(b)})}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a){return a.filter(function(a){return b(a.value)})}function Ee(a,c){return(c?aj.selectAll("."+f.circles+ld(c)):aj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Fe(a,b){Ee(a,b).classed(f.EXPANDED,!0).attr("r",Rh)}function Ge(a){Ee(a).filter(function(){return tf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oh)}function He(a){return aj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ie(a){He(a).classed(f.EXPANDED,!0)}function Je(a){He(a).classed(f.EXPANDED,!1)}function Ke(a,b){var c=Oe(a,b);return function(a,b){var d=c(a,b),e=Yg?1:0,f=Yg?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 Le(a,b){var c=Oe(a,!1),d=b?Me:Ne;return function(a,b){return d(c(a,b),a,this)}}function Me(a,b){var c;return Yg?(c=ee(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ne(a,b,c){var d=c.getBoundingClientRect();return Yg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ee(b)?-3:-6)}function Oe(a,b){var c=a.__max__+1,d=Wd(lg,c),e=Td(d,c,a,!!b),f=Ud(!!b),g=Vd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Yg&&(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 Pe(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 Qe(b){var c,d,e;if(ej=tf.select(wf),ej.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ej.html(""),ej.classed("c3",!0),uf.data.xs={},uf.data.targets=vc(b),n(),R(),fg.domain(tf.extent(_b(uf.data.targets))),gg.domain(Xb(uf.data.targets,"y")),hg.domain(Xb(uf.data.targets,"y2")),ig.domain(fg.domain()),jg.domain(gg.domain()),kg.domain(hg.domain()),fj=fg.domain(),Vi.scale(ig),Bf&&Zi.scale(fg),$i=ej.append("svg").attr("width",Mf+Jf.left+Jf.right).attr("height",Of+Jf.top+Jf.bottom).on("mouseenter",Ef).on("mouseleave",Ff),_i=$i.append("defs"),_i.append("clipPath").attr("id",pi).append("rect").attr("width",Mf).attr("height",Of),_i.append("clipPath").attr("id",qi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),_i.append("clipPath").attr("id",ri).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),aj=$i.append("g").attr("transform",Mi.main),bj=Pg?$i.append("g").attr("transform",Mi.context):null,cj=$i.append("g").attr("transform",Mi.legend),Sg||(cj.style("visibility","hidden"),Hi=Cc(uf.data.targets)),dj=tf.select(wf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),of(Cc(uf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Zg&&aj.append("g").attr("class",f.axisX).attr("clip-path",ti).attr("transform",Mi.x).append("text").attr("class",f.axisXLabel).attr("transform",Yg?"rotate(-90)":"").style("text-anchor",zb),ph&&aj.append("g").attr("class",f.axisY).attr("clip-path",ui).attr("transform",Mi.y).append("text").attr("class",f.axisYLabel).attr("transform",Yg?"":"rotate(-90)").style("text-anchor",Ab),yh&&aj.append("g").attr("class",f.axisY2).attr("transform",Mi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Yg?"":"rotate(-90)").style("text-anchor",Bb),d=aj.append("g").attr("clip-path",si).attr("class",f.grid),Hh&&d.append("g").attr("class",f.xgrids),te(Jh)&&d.append("g").attr("class",f.xgridLines),Ph&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Kh&&d.append("g").attr("class",f.ygrids),te(Lh)&&d.append("g").attr("class",f.ygridLines),aj.append("g").attr("clip-path",si).attr("class",f.regions),aj.append("g").attr("clip-path",si).attr("class",f.chart),c=aj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Bf?Yg?"ns-resize":"ew-resize":null),aj.select("."+f.chart).append("g").attr("class",f.chartBars),aj.select("."+f.chart).append("g").attr("class",f.chartLines),aj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Mi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),aj.select("."+f.chart).append("g").attr("class",f.chartTexts),Bf&&aj.insert("rect",Df?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Mf).attr("height",Of).style("opacity",0).style("cursor",Yg?"ns-resize":"ew-resize").call(Zi).on("dblclick.zoom",null),nh&&Vi.extent("function"!=typeof nh?nh:nh(_b())),Pg&&(bj.append("g").attr("clip-path",si).attr("class",f.chart),bj.select("."+f.chart).append("g").attr("class",f.chartBars),bj.select("."+f.chart).append("g").attr("class",f.chartLines),bj.append("g").attr("clip-path",si).attr("class",f.brush).call(Vi).selectAll("rect").attr(Yg?"width":"height",Yg?Nf:Pf),bj.append("g").attr("class",f.axisX).attr("transform",Mi.subx).attr("clip-path",Yg?"":ti)),bf(uf.data.targets),Yg?aj.select("."+f.axisX).style("opacity",0).call(lg):(aj.select("."+f.axisY).style("opacity",0).call(mg),aj.select("."+f.axisY2).style("opacity",0).call(ng)),n(),R(),_e(),m(),Xe({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),mi){if(vi&&"string"==typeof ni){for(ni=oe(ni),e=0;e0){d=[];for(var g in tg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Id(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ce,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 Ve(a){be(uf.data.targets)||Eg&&(yi=a,aj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),zi=!0,Ng())}function We(){be(uf.data.targets)||Eg&&(aj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),aj.selectAll("."+f.shape).classed(f.INCLUDED,!1),zi=!1,Og())}function Xe(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U=Sd(),V=be(uf.data.targets),W=Ic(uf.data.targets);if(0!==W.length){if(a=d(a)?a:{},z=d(a.withY)?a.withY:!0,A=d(a.withSubchart)?a.withSubchart:!0,B=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,C=d(a.withTransitionForExit)?a.withTransitionForExit:B,D=d(a.withTransitionForAxis)?a.withTransitionForAxis:B,E=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:B,O=B?If:0,P=C?O:0,Q=D?O:0,I&&Sg&&of(Cc(uf.data.targets),a),H&&(fg.domain(tf.extent(_b(W))),fj=fg.domain(),Bf&&Zi.scale(fg).updateScaleExtent(),ig.domain(fg.domain()),Vi.scale(ig)),G&&(fg.domain(Vi.empty()?fj:Vi.extent()),Bf&&Zi.scale(fg).updateScaleExtent()),gg.domain(Xb(W,"y")),hg.domain(Xb(W,"y2")),(gh||fh)&&(R=hh?hh:Kc(Jc(W)),lg.tickValues(R),og.tickValues(R)),c=aj.select("."+f.axisX).style("opacity",V?0:1),(Yg||E)&&(c=c.transition().duration(Q)),c.call(lg),g=aj.select("."+f.axisY).style("opacity",V?0:1),(!Yg||E)&&(g=g.transition().duration(Q)),g.call(mg),aj.select("."+f.axisY2).style("opacity",V?0:1).transition().duration(Q).call(ng),G)if(dh&&R){for(S=1;S=0&&tf.select(this).style("display",b%T?"none":"block")})}else tf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!Yg&&ih&&eb(c),J=Ke(U),M=Le(U,!0),N=Le(U,!1),Db(),jg.domain(gg.domain()),kg.domain(hg.domain()),dj.style("display","none"),o(),aj.select("line."+f.xgridFocus).style("visibility","hidden"),Hh){if("year"===Ih){i=[];for(var X=_b(),Y=X[0].getFullYear(),Z=X[1].getFullYear(),$=Y;Z>=$;$++)i.push(new Date($+"-01-01 00:00:00"))}else i=fg.ticks(10);h=aj.select("."+f.xgrids).selectAll("."+f.xgrid).data(i),h.enter().append("line").attr("class",f.xgrid),h.attr("x1",Yg?0:function(a){return fg(a)-lg.tickOffset()}).attr("x2",Yg?Mf:function(a){return fg(a)-lg.tickOffset()}).attr("y1",Yg?function(a){return fg(a)-lg.tickOffset()}:Jf.top).attr("y2",Yg?function(a){return fg(a)-lg.tickOffset()}:Of).style("opacity",function(){return+tf.select(this).attr(Yg?"y1":"x1")===(Yg?Of:0)?0:1}),h.exit().remove()}te(Jh)&&(j=aj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Jh),k=j.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),k.append("line").style("opacity",0),k.append("text").attr("text-anchor","end").attr("transform",Yg?"":"rotate(-90)").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),j.select("line").transition().duration(O).attr("x1",Yg?0:Ad).attr("x2",Yg?Mf:Ad).attr("y1",Yg?Ad:Jf.top).attr("y2",Yg?Ad:Of).style("opacity",1),j.select("text").transition().duration(O).attr("x",Yg?Mf:0).attr("y",Ad).text(function(a){return a.text}).style("opacity",1),j.exit().transition().duration(O).style("opacity",0).remove()),z&&Kh&&(l=aj.select("."+f.ygrids).selectAll("."+f.ygrid).data(gg.ticks(Mh)),l.enter().append("line").attr("class",f.ygrid),l.attr("x1",Yg?gg:0).attr("x2",Yg?gg:Mf).attr("y1",Yg?0:gg).attr("y2",Yg?Of:gg),l.exit().remove()),z&&te(Lh)&&(m=aj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Lh),n=m.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),n.append("line").style("opacity",0),n.append("text").attr("text-anchor","end").attr("transform",Yg?"rotate(-90)":"").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),m.select("line").transition().duration(O).attr("x1",Yg?Bd:0).attr("x2",Yg?Bd:Mf).attr("y1",Yg?0:Bd).attr("y2",Yg?Of:Bd).style("opacity",1),m.select("text").transition().duration(O).attr("x",Yg?0:Mf).attr("y",Bd).text(function(a){return a.text}).style("opacity",1),m.exit().transition().duration(O).style("opacity",0).remove()),q=aj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),q.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Di(a)}).attr("class",ad),q.style("opacity",qd).transition().duration(O).attr("d",J).style("opacity",1),q.exit().transition().duration(P).style("opacity",0).remove(),s=aj.selectAll("."+f.texts).selectAll("."+f.text).data(le),s.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return Yg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),s.text(function(a){return yd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(O).attr("x",M).attr("y",N).style("fill-opacity",td),s.exit().transition().duration(P).style("fill-opacity",0).remove(),aj.selectAll("."+f.line).style("opacity",qd).transition().duration(O).attr("d",Wi).style("opacity",1),aj.selectAll("."+f.area).style("opacity",0).transition().duration(O).attr("d",Xi).style("opacity",gj),p=aj.selectAll("."+f.circles).selectAll("."+f.circle).data(ke),p.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Oh),p.style("opacity",qd).transition().duration(O).style("opacity",sd).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),p.exit().remove(),aj.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(O).attrTween("d",function(a){var b,c=Fb(a);return c?(b=tf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1),aj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(O).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&ie(a.data)?1:0}),aj.select("."+f.chartArcsTitle).style("opacity",ae(uf.data.targets)?1:0),Pg&&(null!==tf.event&&"zoom"===tf.event.type&&Vi.extent(fg.orgDomain()).update(),A&&(e=bj.select("."+f.axisX).style("opacity",V?0:1),(Yg||E)&&(e=e.transition().duration(Q)),e.call(og),!Yg&&ih&&eb(e),Vi.empty()||Vi.extent(fg.orgDomain()).update(),K=Ke(U,!0),t=bj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),t.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Di(a)}).attr("class",ad),t.style("opacity",qd).transition().duration(O).attr("d",K).style("opacity",1),t.exit().transition().duration(O).style("opacity",0).remove(),bj.selectAll("."+f.line).style("opacity",qd).transition().duration(O).attr("d",Yi).style("opacity",1))),aj.selectAll("."+f.selectedCircles).filter(function(a){return ee(a)}).selectAll("circle").remove(),aj.selectAll("."+f.selectedCircle).transition().duration(O).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),u=aj.select("."+f.eventRects),te(qg)&&!oc(qg)?(u.classed(f.eventRectsMultiple)||u.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),v=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Se(v.enter()),v.attr("x",0).attr("y",0).attr("width",Mf).attr("height",Of)):(u.classed(f.eventRectsSingle)||u.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),xi&&!wi?(y=function(a,b){var c=xc(b),d=yc(b),e=uf.data.xs[a.id][b];return(fg(d?d:e+50)-fg(c?c:e-50))/2},x=function(a,b){var c=xc(b),d=uf.data.xs[a.id][b];return(fg(d)+fg(c?c:d-50))/2}):(y=L(),x=function(a){return fg(a.x)-y/2}),w=Ac(uf.data.targets),aj.select("."+f.eventRects).datum(w?w.values:[]),v=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Re(v.enter()),v.attr("class",fd).attr("x",Yg?0:x).attr("y",Yg?x:0).attr("width",Yg?Mf:y).attr("height",Yg?y:Of),v.exit().remove()),r=aj.select("."+f.regions).selectAll("rect."+f.region).data(hi),r.enter().append("rect").style("fill-opacity",0),r.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(O).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),r.exit().transition().duration(O).style("fill-opacity",0).remove(),Cc(uf.data.targets).forEach(function(a){hj[a]=!0})}}function Ye(){Xe({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ze(){return"mousemove"===tf.event.sourceEvent.type&&Zi.altDomain?(fg.domain(Zi.altDomain),void Zi.scale(fg).updateScaleExtent()):(wi&&fg.orgDomain()[0]===fj[0]&&fg.domain([fj[0]-1e-10,fg.orgDomain()[1]]),Xe({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===tf.event.sourceEvent.type&&(Ai=!0)))}function $e(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function _e(){$i.attr("width",Qf).attr("height",Rf),$i.select("#"+pi).select("rect").attr("width",Mf).attr("height",Of),$i.select("#"+qi).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),$i.select("#"+ri).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),$i.select("."+f.zoomRect).attr("width",Mf).attr("height",Of),ej.style("max-height",Rf+"px")}function af(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),_e(),m(a.withTransition),Xe(a)}function bf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=aj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Di(a)}),e=aj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("fill",function(a){return Di(a)}).style("stroke","none").style("cursor",function(a){return Gg(a)?"pointer":null}),c=aj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)}),b.append("path").attr("class",dd).style("opacity",function(){return gj=+tf.select(this).style("opacity"),0}).style("fill",function(a){return Di(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Di(a)}).style("cursor",function(a){return Gg(a)?"pointer":null}),a.forEach(function(a){aj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=aj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Yf(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Di(a.data)}).style("cursor",function(a){return Gg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Fb(a),d=Lb(c),e=Tb();Nb(c.data.id),jf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Fb(a),c=[Lb(b)];Md(c,tf.mouse(this))}).on("mouseout",function(a,b){var c=Fb(a),d=Lb(c),e=Ub();Ob(c.data.id),lf(),Nd(),e(d,b)}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Pg&&(n=bj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Di(a)}),l=bj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)})),$i.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function cf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Xd(a.id,b.types[a.id]):Xd(a.id,b.type)}),uf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Ni?j:i,l=Ni?Q():P();return d&&(w=0,C=0,t=0,u=0),Sg&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Ni?u:t,void(Xg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,Ni?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=cj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Ug?Ug(a):uf.toggle(a)}).on("mouseover",function(a){uf.focus(a),"function"==typeof Vg&&Vg(a)}).on("mouseout",function(a){uf.revert(),"function"==typeof Wg&&Wg(a)}),l.append("text").text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",Ni?g:-200).attr("y",Ni?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ni?h:-200).attr("y",Ni?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Di(a)}).attr("x",Ni?g:-200).attr("y",Ni?-200:i).attr("width",10).attr("height",10),cj.selectAll("text").data(a).text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),cj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),cj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),_e(),q&&m(p)}function pf(a){return Ec(uf.data.targets,a.id)}function qf(a){return"data"in a&&Ec(uf.data.targets,a.data.id)}function rf(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 sf(a,b,c){var d=!be(uf.data.targets);Xd(a,b),af(c?c:{withTransitionForAxis:d})}var tf=a.d3?a.d3:a.require?a.require("d3"):void 0,uf={data:{},axis:{},legend:{}},vf={},wf=h(["bindto"],"#chart"),xf=h(["size","width"]),yf=h(["size","height"]),zf=h(["padding","left"]),Af=h(["padding","right"]),Bf=h(["zoom","enabled"],!1),Cf=h(["zoom","extent"]),Df=h(["zoom","privileged"],!1),Ef=h(["onenter"],function(){}),Ff=h(["onleave"],function(){}),Gf=h(["onresize"],function(){}),Hf=h(["onresized"],function(){}),If=h(["transition","duration"],350);g("data","data is required in config");var Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg=h(["data","x"]),qg=h(["data","xs"],{}),rg=h(["data","x_format"]),sg=h(["data","id_converter"],function(a){return a}),tg=h(["data","names"],{}),ug=h(["data","classes"],{}),vg=h(["data","groups"],[]),wg=h(["data","axes"],{}),xg=h(["data","type"]),yg=h(["data","types"],{}),zg=h(["data","labels"],{}),Ag=h(["data","order"]),Bg=h(["data","regions"],{}),Cg=h(["data","color"]),Dg=h(["data","colors"],{}),Eg=h(["data","selection","enabled"],!1),Fg=h(["data","selection","grouped"],!1),Gg=h(["data","selection","isselectable"],function(){return!0}),Hg=h(["data","selection","multiple"],!0),Ig=h(["data","onclick"],function(){}),Jg=h(["data","onenter"],function(){}),Kg=h(["data","onleave"],function(){}),Lg=h(["data","onselected"],function(){}),Mg=h(["data","onunselected"],function(){}),Ng=h(["data","ondragstart"],function(){}),Og=h(["data","ondragend"],function(){}),Pg=h(["subchart","show"],!1),Qg=h(["subchart","size","height"],60),Rg=h(["color","pattern"],[]),Sg=h(["legend","show"],!0),Tg=h(["legend","position"],"bottom"),Ug=h(["legend","item","onclick"]),Vg=h(["legend","item","onmouseover"]),Wg=h(["legend","item","onmouseout"]),Xg=h(["legend","equally"],!1),Yg=h(["axis","rotated"],!1),Zg=h(["axis","x","show"],!0),$g=h(["axis","x","type"],"indexed"),_g=h(["axis","x","localtime"],!0),ah=h(["axis","x","categories"],[]),bh=h(["axis","x","tick","centered"],!1),ch=h(["axis","x","tick","format"]),dh=h(["axis","x","tick","culling"],{}),eh=h(["axis","x","tick","culling","max"],10),fh=h(["axis","x","tick","count"]),gh=h(["axis","x","tick","fit"],!0),hh=h(["axis","x","tick","values"],null),ih=h(["axis","x","tick","rotate"]),jh=h(["axis","x","max"],null),kh=h(["axis","x","min"],null),lh=h(["axis","x","padding"],{}),mh=h(["axis","x","height"]),nh=h(["axis","x","default"]),oh=h(["axis","x","label"],{}),ph=h(["axis","y","show"],!0),qh=h(["axis","y","max"]),rh=h(["axis","y","min"]),sh=h(["axis","y","center"]),th=h(["axis","y","label"],{}),uh=h(["axis","y","inner"],!1),vh=h(["axis","y","tick","format"]),wh=h(["axis","y","padding"],{}),xh=h(["axis","y","ticks"],10),yh=h(["axis","y2","show"],!1),zh=h(["axis","y2","max"]),Ah=h(["axis","y2","min"]),Bh=h(["axis","y2","center"]),Ch=h(["axis","y2","label"],{}),Dh=h(["axis","y2","inner"],!1),Eh=h(["axis","y2","tick","format"]),Fh=h(["axis","y2","padding"],{}),Gh=h(["axis","y2","ticks"],10),Hh=h(["grid","x","show"],!1),Ih=h(["grid","x","type"],"tick"),Jh=h(["grid","x","lines"],[]),Kh=h(["grid","y","show"],!1),Lh=h(["grid","y","lines"],[]),Mh=h(["grid","y","ticks"],10),Nh=h(["point","show"],!0),Oh=Nh?h(["point","r"],2.5):0,Ph=h(["point","focus","line","enabled"],!0),Qh=h(["point","focus","expand","enabled"],!0),Rh=h(["point","focus","expand","r"],Qh?4:Oh),Sh=h(["point","focus","select","r"],8),Th=h(["line","connect_null"],!1),Uh=h(["bar","width"]),Vh=h(["bar","width","ratio"],.6),Wh=h(["pie","label","show"],!0),Xh=h(["pie","label","format"]),Yh=h(["pie","expand"],!0),Zh=h(["pie","onclick"],function(){}),$h=h(["pie","onmouseover"],function(){}),_h=h(["pie","onmouseout"],function(){}),ai=h(["donut","label","show"],!0),bi=h(["donut","label","format"]),ci=h(["donut","expand"],!0),di=h(["donut","title"],""),ei=h(["donut","onclick"],function(){}),fi=h(["donut","onmouseover"],function(){}),gi=h(["donut","onmouseout"],function(){}),hi=h(["regions"],[]),ii=h(["tooltip","show"],!0),ji=h(["tooltip","format","title"]),ki=h(["tooltip","format","value"]),li=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ji?ji:b,l=ki?ki: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+""}),mi=h(["tooltip","init","show"],!1),ni=h(["tooltip","init","x"],0),oi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),pi=("string"==typeof wf?wf.replace("#",""):wf.id)+"-clip",qi=pi+"-xaxis",ri=pi+"-yaxis",si=i(pi),ti=i(qi),ui=i(ri),vi="timeseries"===$g,wi="categorized"===$g,xi=!vi&&(pg||te(qg)),yi=null,zi=!1,Ai=!1,Bi=!1,Ci=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Di=ne(Dg,te(Rg)?Rg:Ci,Cg),Ei=_g?tf.time.format:tf.time.format.utc,Fi=function(){var a=[[Ei("%Y/%-m/%-d"),function(){return!0}],[Ei("%-m/%-d"),function(a){return a.getMonth()}],[Ei("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ei("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ei("%I %p"),function(a){return a.getHours()}],[Ei("%I:%M"),function(a){return a.getMinutes()}],[Ei(":%S"),function(a){return a.getSeconds()}],[Ei(".%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)}}(),Gi=[],Hi=[],Ii=Yg?"left":"bottom",Ji=Yg?uh?"top":"bottom":uh?"right":"left",Ki=Yg?Dh?"bottom":"top":Dh?"left":"right",Li=Yg?"left":"bottom",Mi={main:function(){return"translate("+Jf.left+","+Jf.top+")"},context:function(){return"translate("+Kf.left+","+Kf.top+")"},legend:function(){return"translate("+Lf.left+","+Lf.top+")"},x:function(){return"translate(0,"+(Yg?0:Of)+")"},y:function(){return"translate(0,"+(Yg?Of:0)+")"},y2:function(){return"translate("+(Yg?0:Mf)+","+(Yg?1:0)+")"},subx:function(){return"translate(0,"+(Yg?0:Pf)+")"},arc:function(){return"translate("+Mf/2+","+Of/2+")"}},Ni="right"===Tg,Oi=0,Pi=0,Qi=0,Ri=.15,Si=30,Ti=Yg&&!Zg?0:30,Ui=5;Yf=tf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Vi,Wi=function(){var a=tf.svg.line().x(Yg?function(a){return V(a.id)(a.value)}:zd).y(Yg?zd:function(a){return V(a.id)(a.value)});return Th||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Th?De(b.values):b.values;return ce(b)?(a.interpolate(de(b)?"cardinal":"linear"),Bg[b.id]?Pe(e,fg,V(b.id),Bg[b.id]):a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Xi=function(){var a;return a=Yg?tf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(zd):tf.svg.area().x(zd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=De(b.values);return Yd([b],"area")||Yd([b],"area-spline")?(a.interpolate(de(b)?"cardinal":"linear"),a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Yi=function(){var a=tf.svg.line().x(Yg?function(a){return W(a.id)(a.value)}:Cd).y(Yg?Cd:function(a){return W(a.id)(a.value)});return function(b){var c=De(b.values);return ce(b)?a(c):"M "+ig(c[0].x)+" "+W(b.id)(c[0].value)}}(),Zi=function(){};Vi=tf.svg.brush().on("brush",Ye),Vi.update=function(){return bj&&bj.select("."+f.brush).call(this),this},Vi.scale=function(a){return Yg?this.y(a):this.x(a)},Bf&&(Zi=tf.behavior.zoom().on("zoomstart",function(){Zi.altDomain=tf.event.sourceEvent.altKey?fg.orgDomain():null}).on("zoom",Bf?Ze:null),Zi.scale=function(a){return Yg?this.y(a):this.x(a)},Zi.orgScaleExtent=function(){var a=Cf?Cf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},Zi.updateScaleExtent=function(){var a=ac(fg.orgDomain())/ac(fj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var $i,_i,aj,bj,cj,dj,ej,fj,gj,hj={};if(uf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),uf.defocus(),b(d.classed(f.focused,!0)),b(e),be(uf.data.targets)&&Nb(a,!0),jf(a)},uf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),kf(a)},uf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),lf()},uf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),$i.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?mf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},uf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),$i.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?nf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Ri),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},uf.toggle=function(a){Gc(a)?uf.hide(a):uf.show(a)},uf.unzoom=function(){Vi.clear().update(),Xe({withUpdateXDomain:!0})},uf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){ug[b]=a.classes[b]}),"categories"in a&&wi&&(ah=a.categories,lg.categories(ah)),"cacheIds"in a&&bc(a.cacheIds)?void cf(dc(a.cacheIds),a.done):void("unload"in a?ef(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){df(a)}):df(a))},uf.unload=function(a){ef(Dc(a),function(){Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},uf.selected=function(a){return tf.merge(aj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return tf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},uf.select=function(a,b,c){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=tf.select(this),i="circle"===this.nodeName?xe:Ae,j="circle"===this.nodeName?ye:Be,k=Fg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Gg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},uf.unselect=function(a,b){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=tf.select(this),g="circle"===this.nodeName?ye:Be,h=Fg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Gg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},uf.toLine=function(a){sf(a,"line")},uf.toSpline=function(a){sf(a,"spline")},uf.toBar=function(a){sf(a,"bar")},uf.toScatter=function(a){sf(a,"scatter")},uf.toArea=function(a){sf(a,"area")},uf.toAreaSpline=function(a){sf(a,"area-spline")},uf.toPie=function(a){sf(a,"pie",{withTransform:!0})},uf.toDonut=function(a){sf(a,"donut",{withTransform:!0})},uf.groups=function(a){return c(a)?vg:(vg=a,Xe(),vg)},uf.xgrids=function(a){return a?(Jh=a,Xe(),Jh):Jh},uf.xgrids.add=function(a){return a?uf.xgrids(Jh.concat(a)):void 0},uf.xgrids.remove=function(a){var b=rf(a);return uf.xgrids(Jh.filter(b))},uf.ygrids=function(a){return a?(Lh=a,Xe(),Lh):Lh -},uf.ygrids.add=function(a){return a?uf.ygrids(Lh.concat(a)):void 0},uf.ygrids.remove=function(a){var b=rf(a);return uf.ygrids(Lh.filter(b))},uf.regions=function(a){return c(a)?hi:(hi=a,Xe(),hi)},uf.regions.add=function(a){return c(a)?hi:(hi=hi.concat(a),Xe(),hi)},uf.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;$i.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),hi=hi.filter(function(b){return b.classes.indexOf(a)<0})}),hi},uf.data.get=function(a){var b=uf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},uf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},uf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){tg[b]=a[b]}),of(Cc(uf.data.targets),{withTransition:!0}),tg):tg},uf.x=function(a){return arguments.length&&(qc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.xs=function(a){return arguments.length&&(rc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},uf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(qh=+a.y),b(a.y2)&&(zh=+a.y2)):qh=zh=+a,Xe())},uf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(rh=+a.y),b(a.y2)&&(Ah=+a.y2)):rh=Ah=+a,Xe())},uf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&uf.axis.max(a.max),"undefined"!=typeof a.min&&uf.axis.min(a.min))},uf.legend.show=function(a){Sg||(Sg=!0,cj.style("visibility","visible")),mf(Dc(a)),Xe({withTransitionForHorizontalAxis:!1})},uf.legend.hide=function(a){Sg&&se(a)&&(Sg=!1,cj.style("visibility","hidden")),nf(Dc(a)),Xe({withTransitionForHorizontalAxis:!1})},uf.resize=function(a){xf=a?a.width:null,yf=a?a.height:null,af({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},uf.destroy=function(){uf.data.targets=void 0,uf.data.xs={},ej.html(""),a.onresize=null},"url"in e.data)tf.xhr(e.data.url,function(a,b){var c,d=tf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=tf.csv.parse(b.response),Qe(c)});else if("rows"in e.data)Qe(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Qe(uc(e.data.columns))}return uf},"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.32"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cMf&&(Mf=0),0>Of&&(Of=0),Nf=Yg?Jf.left-Si-Ti:Mf,Pf=Yg?Of:Rf-Kf.top-Kf.bottom,0>Nf&&(Nf=0),0>Pf&&(Pf=0),p(),Ni&&be(uf.data.targets)&&(Lf.left=Mf/2+Tf)}function o(){aj.select("line."+f.xgridFocus).attr("x1",Yg?0:-10).attr("x2",Yg?Mf:-10).attr("y1",Yg?-10:Jf.top).attr("y2",Yg?-10:Of)}function p(){Tf=Of/2,Sf=.95*Tf,Uf=ae(uf.data.targets)?.6*Sf:0}function q(){var a=Yg?f.axisX:f.axisY,b=tf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=tf.select(wf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return xf?xf:x()}function s(){var a=yf?yf:y();return a>0?a:320}function t(){return be(uf.data.targets)?0:zf?zf:Yg?Zg?v("x"):1:!ph||uh?1:v("y")}function u(){var a=1;return be(uf.data.targets)?0:Af?Af:Ni?P()+(yh&&!Yg?v("y2"):a):yh?Dh||Yg?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||Zg?"x"===a&&mh?mh:"y"!==a||ph?"y2"!==a||yh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Ui:Sg&&!Ni?10:1:0}function x(){return+tf.select(wf).style("width").replace("px","")}function y(){return+tf.select(wf).style("height").replace("px","")}function z(a){return a?-5:-(Jf.left-1)}function A(a){return a?-20:-4}function B(){return z(!Yg)}function C(){return A(!Yg)}function D(){return z(Yg)}function E(){return A(Yg)}function F(a){return a?Mf+2+4:Jf.left+20}function G(a){return a?(mh?mh:0)+80:Of+8}function H(){return F(!Yg)}function I(){return G(!Yg)}function J(){return F(Yg)}function K(){return G(Yg)}function L(){var a=Ac(uf.data.targets),b=a.values[0],c=a.values[a.values.length-1],d=fg(c.x)-fg(b.x),e=zc(),f=Zd(uf.data.targets)?(e-(wi?.25:1))/e:1;return e>1?d*f/(e-1):d}function M(a){Oi=a}function N(a){Pi=a}function O(a){Qi=a}function P(){return Sg?Ni?Pi*(Oi+1):Qf:0}function Q(){return Sg?Ni?Rf:Qi*(Oi+1):0}function R(){var a,b=!fg;Zf=Yg?1:0,$f=Yg?Of:Mf,_f=Yg?0:Of,ag=Yg?Mf:1,bg=Zf,cg=$f,dg=Yg?0:Pf,eg=Yg?Nf:1,fg=T(Zf,$f,b?void 0:fg.domain(),function(){return lg.tickOffset()}),gg=U(_f,ag,b?void 0:gg.domain()),hg=U(_f,ag,b?void 0:hg.domain()),ig=T(Zf,$f,fj,function(a){return a%1?0:og.tickOffset()}),jg=U(dg,eg,b?void 0:jg.domain()),kg=U(dg,eg,b?void 0:kg.domain()),a=$(),lg=X(fg,Ii,a),og=X(ig,Li,a),mg=Y(gg,Ji,vh,xh),ng=Y(hg,Ki,Eh,Gh),b||(Vi.scale(ig),Bf&&Zi.scale(fg)),S()}function S(){Vf=Gb(),Wf=Hb(),Xf=Hb(.98)}function T(a,b,d,e){var f=(vi?tf.time.scale():tf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),wi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=tf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?hg:gg}function W(a){return"y2"===Z(a)?kg:jg}function X(a,b,c){var d=(wi?Eb():tf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),wi?(d.tickCentered(bh),se(dh)&&(dh=!1)):d.tickOffset=function(){var a=Bc(uf.data.targets),b=fg(a[1])-fg(a[0]);return b/zc()/2},wi&&d.categories(ah),d}function Y(a,b,c,d){return tf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in wg?wg[a]:"y"}function $(){var a=vi?Fi:wi?Tc:function(a){return 0>a?a.toFixed(0):a};return ch&&("function"==typeof ch?a=ch:vi&&(a=function(a){return a?Ei(ch)(a):""})),a}function _(a){var b;return"y"===a?b=th:"y2"===a?b=Ch:"x"===a&&(b=oh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?th=b:"y2"===a?Ch=b:"x"===a&&(oh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a){a.selectAll(".tick text").attr("y",db(ih)).attr("x",cb(ih)).attr("transform","rotate("+ih+")").style("text-anchor","start")}function fb(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 gb(){return fb("x",Yg?"inner-top":"inner-right")}function hb(){return fb("y",Yg?"inner-right":"inner-top")}function ib(){return fb("y2",Yg?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Mf/2:Mf:b.isBottom?-Of:b.isMiddle?-Of/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!Yg,gb())}function rb(){return nb(Yg,hb())}function sb(){return nb(Yg,ib())}function tb(){return ob(!Yg,gb())}function ub(){return ob(Yg,hb())}function vb(){return ob(Yg,ib())}function wb(){var a=gb();return Yg?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":mh?mh-10:"3em"}function xb(){var a=hb();return Yg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return Yg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!Yg,gb())}function Ab(){return pb(Yg,hb())}function Bb(){return pb(Yg,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return tf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?30:b}function Db(){aj.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),aj.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),aj.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 tf.min(Object.keys(i).map(function(a){return tf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(vg.length>0)for(g=Sc(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 tf.max(Object.keys(i).map(function(a){return tf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Ah:rh,n="y2"===c?zh:qh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Bh:sh,r=ud()&&Yg;return 0===l.length?"y2"===c?hg.domain():gg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(gg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&wh&&(f=b(wh.top)?wh.top:e,g=b(wh.bottom)?wh.bottom:e),"y2"===c&&Fh&&(f=b(Fh.top)?Fh.top:e,g=b(Fh.bottom)?Fh.bottom:e),Zd(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return kh?vi?oe(kh):kh:tf.min(a,function(a){return tf.min(a.values,function(a){return a.x})})}function Zb(a){return jh?vi?oe(jh):jh:tf.max(a,function(a){return tf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return wi?d=0:Zd(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof lh&&te(lh)?(e=b(lh.left)?lh.left:d,f=b(lh.right)?lh.right:d):e=f="number"==typeof lh?lh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?gg:hg;return b="y"===a.axis||"y2"===a.axis?Yg?Of:"start"in a?d(a.start):Of:Yg?"end"in a?fg(vi?oe(a.end):a.end):Of:Of,c>b?0:b-c}function ic(a){return pg&&a===pg||te(qg)&&ue(qg,a)}function jc(a){return!ic(a)}function kc(a){return pg?pg:te(qg)?qg[a]:null}function lc(a,b){var c,d=b&&te(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=uf.data.xs[b])}),c}function mc(a,b){return a in uf.data.xs&&uf.data.xs[a]&&uf.data.xs[a][b]?uf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){qg[b]=a[b]})}function oc(a){return 1===tf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=tg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),uf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=vi?a?a instanceof Date?a:oe(a):oe(mc(c,d)):xi&&!wi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?uf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):pg?(d=Object.keys(uf.data.xs),uf.data.xs[c]=d.length>0?uf.data.xs[d[0]]:void 0):te(qg)&&(uf.data.xs[c]=lc(f,uf.data.targets)):uf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!uf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=sg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return xi&&wi&&0===c&&g&&(0===e&&(ah=[]),ah.push(g)),("undefined"==typeof a[b]||uf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),xg&&Xd(Cc(c).filter(function(a){return!(a in yg)}),xg),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&uf.data.targets[0].values[a-1]?uf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(uf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(vi?new Date(h):h);i.push(d)}return vi||(i=i.sort(function(a,b){return a-b})),i}function Lc(a){Gi=Gi.concat(a)}function Mc(a){Gi=Gi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Hi=Hi.concat(a)}function Oc(a){Hi=Hi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Dd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Dd(a,g))),Gd(e,b)):Ed(a,b,f,g)}function Fd(a,b){var c;return c=a.map(function(a){return Ed(a.values,b)}),Gd(c,b)}function Gd(a,b){var c,d;return a.forEach(function(a){var e=ve(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Hd(a,b){return tf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Id(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 Jd(){return Ag&&"desc"===Ag.toLowerCase()}function Kd(){return Ag&&"asc"===Ag.toLowerCase()}function Ld(a){var b=Kd(),c=Jd();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 Ag&&a.sort(Ag),a}function Md(a,c){var d,e,f,g,h,i,j,k=be(uf.data.targets),l=k?xd:wd,m=a.filter(function(a){return a&&b(a.value)});ii&&0!==m.length&&(dj.html(li(a,$(),l,Di)).style("display","block"),d=dj.property("offsetWidth"),e=dj.property("offsetHeight"),k?(g=Mf/2+c[0],i=Of/2+c[1]+20):(Yg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=fg(m[0].x)+20):(f=q(),g=f+t()+fg(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),dj.style("top",i+"px").style("left",g+"px"))}function Nd(){dj.style("display","none")}function Od(a){var c=a.filter(function(a){return a&&b(a.value)});ii&&($d(uf.data.targets)||be(uf.data.targets)||aj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Yg?"y1":"x1",zd).attr(Yg?"y2":"x2",zd))}function Pd(){aj.select("line."+f.xgridFocus).style("visibility","hidden")}function Qd(a){return a.x||0===a.x?fg(a.x):null}function Rd(a){return V(a.id)(a.value)}function Sd(){var a,b,d={},e=0;return Ic(Fc(ee)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Wd(a,b){return Uh?Uh:b?2*a.tickOffset()*Vh/b:0}function Xd(a,b){Dc(a).forEach(function(a){hj[a]=b===yg[a],yg[a]=b})}function Yd(a,b){var c=!1;return a.forEach(function(a){yg[a.id]===b&&(c=!0),a.id in yg||"line"!==b||(c=!0)}),c}function Zd(a){return Yd(a,"bar")}function $d(a){return Yd(a,"scatter")}function _d(a){return Yd(a,"pie")}function ae(a){return Yd(a,"donut")}function be(a){return _d(a)||ae(a)}function ce(a){var b="string"==typeof a?a:a.id;return!(b in yg)||"line"===yg[b]||"spline"===yg[b]||"area"===yg[b]||"area-spline"===yg[b]}function de(a){var b="string"==typeof a?a:a.id;return"spline"===yg[b]||"area-spline"===yg[b]}function ee(a){var b="string"==typeof a?a:a.id;return"bar"===yg[b]}function fe(a){var b="string"==typeof a?a:a.id;return"scatter"===yg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"pie"===yg[b]}function he(a){var b="string"==typeof a?a:a.id;return"donut"===yg[b]}function ie(a){return ge(a)||he(a)}function je(a){return ee(a)?a.values:[]}function ke(a){return ce(a)||fe(a)?a.values:[]}function le(a){return ee(a)||ce(a)?a.values:[]}function me(a){return he(a)&&ci||ge(a)&&Yh}function ne(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function oe(b){var c;try{c=rg?tf.time.format(rg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+rg)}return c}function pe(a,b){var c=tf.mouse(a),d=tf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function ue(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ve(a,b){var c="y"===Z(a.id)?gg:hg,d=Yg?1:0,e=Yg?0:1;return Math.pow(fg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function we(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function xe(a,b,c){Lg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd).attr("stroke",function(){return Di(b)}).attr("r",1.4*Sh).transition().duration(100).attr("r",Sh)}function ye(a,b,c){Mg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ze(a,b,c,d){a?xe(b,c,d):ye(b,c,d)}function Ae(a,b){Lg(b,a.node()),a.transition().duration(100).style("fill",function(){return tf.rgb(Di(b)).darker(1)})}function Be(a,b){Mg(b,a.node()),a.transition().duration(100).style("fill",function(){return Di(b)})}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a){return a.filter(function(a){return b(a.value)})}function Ee(a,c){return(c?aj.selectAll("."+f.circles+ld(c)):aj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Fe(a,b){Ee(a,b).classed(f.EXPANDED,!0).attr("r",Rh)}function Ge(a){Ee(a).filter(function(){return tf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oh)}function He(a){return aj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ie(a){He(a).classed(f.EXPANDED,!0)}function Je(a){He(a).classed(f.EXPANDED,!1)}function Ke(a,b){var c=Oe(a,b);return function(a,b){var d=c(a,b),e=Yg?1:0,f=Yg?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 Le(a,b){var c=Oe(a,!1),d=b?Me:Ne;return function(a,b){return d(c(a,b),a,this)}}function Me(a,b){var c;return Yg?(c=ee(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ne(a,b,c){var d=c.getBoundingClientRect();return Yg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ee(b)?-3:-6)}function Oe(a,b){var c=a.__max__+1,d=Wd(lg,c),e=Td(d,c,a,!!b),f=Ud(!!b),g=Vd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Yg&&(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 Pe(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 Qe(b){var c,d,e;if(ej=tf.select(wf),ej.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ej.html(""),ej.classed("c3",!0),uf.data.xs={},uf.data.targets=vc(b),n(),R(),fg.domain(tf.extent(_b(uf.data.targets))),gg.domain(Xb(uf.data.targets,"y")),hg.domain(Xb(uf.data.targets,"y2")),ig.domain(fg.domain()),jg.domain(gg.domain()),kg.domain(hg.domain()),fj=fg.domain(),Vi.scale(ig),Bf&&Zi.scale(fg),$i=ej.append("svg").attr("width",Mf+Jf.left+Jf.right).attr("height",Of+Jf.top+Jf.bottom).on("mouseenter",Ef).on("mouseleave",Ff),_i=$i.append("defs"),_i.append("clipPath").attr("id",pi).append("rect").attr("width",Mf).attr("height",Of),_i.append("clipPath").attr("id",qi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),_i.append("clipPath").attr("id",ri).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),aj=$i.append("g").attr("transform",Mi.main),bj=$i.append("g").attr("transform",Mi.context),cj=$i.append("g").attr("transform",Mi.legend),Pg||bj.style("visibility","hidden"),Sg||(cj.style("visibility","hidden"),Hi=Cc(uf.data.targets)),dj=tf.select(wf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),of(Cc(uf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Zg&&aj.append("g").attr("class",f.axisX).attr("clip-path",ti).attr("transform",Mi.x).append("text").attr("class",f.axisXLabel).attr("transform",Yg?"rotate(-90)":"").style("text-anchor",zb),ph&&aj.append("g").attr("class",f.axisY).attr("clip-path",ui).attr("transform",Mi.y).append("text").attr("class",f.axisYLabel).attr("transform",Yg?"":"rotate(-90)").style("text-anchor",Ab),yh&&aj.append("g").attr("class",f.axisY2).attr("transform",Mi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Yg?"":"rotate(-90)").style("text-anchor",Bb),d=aj.append("g").attr("clip-path",si).attr("class",f.grid),Hh&&d.append("g").attr("class",f.xgrids),te(Jh)&&d.append("g").attr("class",f.xgridLines),Ph&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Kh&&d.append("g").attr("class",f.ygrids),te(Lh)&&d.append("g").attr("class",f.ygridLines),aj.append("g").attr("clip-path",si).attr("class",f.regions),aj.append("g").attr("clip-path",si).attr("class",f.chart),c=aj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Bf?Yg?"ns-resize":"ew-resize":null),aj.select("."+f.chart).append("g").attr("class",f.chartBars),aj.select("."+f.chart).append("g").attr("class",f.chartLines),aj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Mi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),aj.select("."+f.chart).append("g").attr("class",f.chartTexts),Bf&&aj.insert("rect",Df?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Mf).attr("height",Of).style("opacity",0).style("cursor",Yg?"ns-resize":"ew-resize").call(Zi).on("dblclick.zoom",null),nh&&Vi.extent("function"!=typeof nh?nh:nh(_b())),bj.append("g").attr("clip-path",si).attr("class",f.chart).attr("display","none"),bj.select("."+f.chart).append("g").attr("class",f.chartBars),bj.select("."+f.chart).append("g").attr("class",f.chartLines),bj.append("g").attr("clip-path",si).attr("class",f.brush).call(Vi).selectAll("rect").attr(Yg?"width":"height",Yg?Nf:Pf),bj.append("g").attr("class",f.axisX).attr("transform",Mi.subx).attr("clip-path",Yg?"":ti),bf(uf.data.targets),Yg?aj.select("."+f.axisX).style("opacity",0).call(lg):(aj.select("."+f.axisY).style("opacity",0).call(mg),aj.select("."+f.axisY2).style("opacity",0).call(ng)),n(),R(),_e(),m(!1),Xe({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),mi){if(vi&&"string"==typeof ni){for(ni=oe(ni),e=0;e0){d=[];for(var g in tg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Id(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ce,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 Ve(a){be(uf.data.targets)||Eg&&(yi=a,aj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),zi=!0,Ng())}function We(){be(uf.data.targets)||Eg&&(aj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),aj.selectAll("."+f.shape).classed(f.INCLUDED,!1),zi=!1,Og())}function Xe(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V,W=Sd(),X=be(uf.data.targets),Y=Ic(uf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,G=d(a.withTransform)?a.withTransform:!1,H=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,I=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,J=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,F=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:C,Q=C?If:0,R=D?Q:0,S=E?Q:0,c=aj.select("."+f.axisX),g=aj.select("."+f.axisY),h=aj.select("."+f.axisY2),e=bj.select("."+f.axisX),P={axisX:c.transition().duration(S),axisY:g.transition().duration(S),axisY2:h.transition().duration(S),axisSubX:e.transition().duration(S)},J&&Sg&&of(Cc(uf.data.targets),a,P),Y.length?(I&&(fg.domain(tf.extent(_b(Y))),fj=fg.domain(),Bf&&Zi.scale(fg).updateScaleExtent(),ig.domain(fg.domain()),Vi.scale(ig)),H&&(fg.domain(Vi.empty()?fj:Vi.extent()),Bf&&Zi.scale(fg).updateScaleExtent())):wi&&fg.domain([0,c.selectAll(".tick").size()]),gg.domain(Xb(Y,"y")),hg.domain(Xb(Y,"y2")),(gh||fh)&&(T=hh?hh:Kc(Jc(Y)),lg.tickValues(T),og.tickValues(T)),c.style("opacity",X?0:1),(Yg||F)&&(c=P.axisX),c.call(lg),g.style("opacity",X?0:1),(!Yg||F)&&(g=P.axisY),g.call(mg),h.style("opacity",X?0:1),(!Yg||F)&&(h=P.axisY2),h.call(ng),e.style("opacity",X?0:1),(Yg||F)&&(e=P.axisSubX),e.call(og),H)if(dh&&T){for(U=1;U=0&&tf.select(this).style("display",b%V?"none":"block")})}else tf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!Yg&&ih&&eb(c),K=Ke(W),N=Le(W,!0),O=Le(W,!1),Db(),jg.domain(gg.domain()),kg.domain(hg.domain()),dj.style("display","none"),o(),aj.select("line."+f.xgridFocus).style("visibility","hidden"),Hh){if("year"===Ih){j=[];for(var Z=_b(),$=Z[0].getFullYear(),_=Z[1].getFullYear(),ab=$;_>=ab;ab++)j.push(new Date(ab+"-01-01 00:00:00"))}else j=fg.ticks(10);i=aj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",Yg?0:function(a){return fg(a)-lg.tickOffset()}).attr("x2",Yg?Mf:function(a){return fg(a)-lg.tickOffset()}).attr("y1",Yg?function(a){return fg(a)-lg.tickOffset()}:Jf.top).attr("y2",Yg?function(a){return fg(a)-lg.tickOffset()}:Of).style("opacity",function(){return+tf.select(this).attr(Yg?"y1":"x1")===(Yg?Of:0)?0:1}),i.exit().remove()}te(Jh)&&(k=aj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Jh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",Yg?"":"rotate(-90)").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(Q).attr("x1",Yg?0:Ad).attr("x2",Yg?Mf:Ad).attr("y1",Yg?Ad:Jf.top).attr("y2",Yg?Ad:Of).style("opacity",1),k.select("text").transition().duration(Q).attr("x",Yg?Mf:0).attr("y",Ad).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(Q).style("opacity",0).remove()),A&&Kh&&(m=aj.select("."+f.ygrids).selectAll("."+f.ygrid).data(gg.ticks(Mh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",Yg?gg:0).attr("x2",Yg?gg:Mf).attr("y1",Yg?0:gg).attr("y2",Yg?Of:gg),m.exit().remove()),A&&te(Lh)&&(n=aj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Lh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",Yg?"rotate(-90)":"").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(Q).attr("x1",Yg?Bd:0).attr("x2",Yg?Bd:Mf).attr("y1",Yg?0:Bd).attr("y2",Yg?Of:Bd).style("opacity",1),n.select("text").transition().duration(Q).attr("x",Yg?0:Mf).attr("y",Bd).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(Q).style("opacity",0).remove()),s=aj.select("."+f.regions).selectAll("rect."+f.region).data(hi),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(Q).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(Q).style("fill-opacity",0).remove(),r=aj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),r.enter().append("path").attr("d",K).style("stroke","none").style("opacity",0).style("fill",function(a){return Di(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(Q).attr("d",K).style("opacity",1),r.exit().transition().duration(R).style("opacity",0).remove(),t=aj.selectAll("."+f.texts).selectAll("."+f.text).data(le),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return Yg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return yd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(Q).attr("x",N).attr("y",O).style("fill-opacity",td),t.exit().transition().duration(R).style("fill-opacity",0).remove(),aj.selectAll("."+f.line).style("opacity",qd).transition().duration(Q).attr("d",Wi).style("opacity",1),aj.selectAll("."+f.area).style("opacity",0).transition().duration(Q).attr("d",Xi).style("opacity",gj),q=aj.selectAll("."+f.circles).selectAll("."+f.circle).data(ke),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Oh),q.style("opacity",qd).transition().duration(Q).style("opacity",sd).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),q.exit().remove(),aj.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",G?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(Q).attrTween("d",function(a){var b,c=Fb(a);return c?(b=tf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",G?"scale(1)":"").style("opacity",1),aj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(Q).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&ie(a.data)?1:0}),aj.select("."+f.chartArcsTitle).style("opacity",ae(uf.data.targets)?1:0),Pg&&(null!==tf.event&&"zoom"===tf.event.type&&Vi.extent(fg.orgDomain()).update(),B&&(!Yg&&ih&&eb(e),Vi.empty()||Vi.extent(fg.orgDomain()).update(),M=Ke(W,!0),u=bj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),u.enter().append("path").attr("d",M).style("stroke","none").style("fill",function(a){return Di(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(Q).attr("d",M).style("opacity",1),u.exit().transition().duration(Q).style("opacity",0).remove(),bj.selectAll("."+f.line).style("opacity",qd).transition().duration(Q).attr("d",Yi).style("opacity",1))),aj.selectAll("."+f.selectedCircles).filter(function(a){return ee(a)}).selectAll("circle").remove(),aj.selectAll("."+f.selectedCircle).transition().duration(Q).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),v=aj.select("."+f.eventRects),te(qg)&&!oc(qg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Se(w.enter()),w.attr("x",0).attr("y",0).attr("width",Mf).attr("height",Of)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),xi&&!wi?(z=function(a,b){var c=xc(b),d=yc(b),e=uf.data.xs[a.id][b];return(fg(d?d:e+50)-fg(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=uf.data.xs[a.id][b];return(fg(d)+fg(c?c:d-50))/2}):(z=L(),y=function(a){return fg(a.x)-z/2}),x=Ac(uf.data.targets),aj.select("."+f.eventRects).datum(x?x.values:[]),w=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Re(w.enter()),w.attr("class",fd).attr("x",Yg?0:y).attr("y",Yg?y:0).attr("width",Yg?Mf:z).attr("height",Yg?z:Of),w.exit().remove()),Cc(uf.data.targets).forEach(function(a){hj[a]=!0})}function Ye(){Xe({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ze(){return"mousemove"===tf.event.sourceEvent.type&&Zi.altDomain?(fg.domain(Zi.altDomain),void Zi.scale(fg).updateScaleExtent()):(wi&&fg.orgDomain()[0]===fj[0]&&fg.domain([fj[0]-1e-10,fg.orgDomain()[1]]),Xe({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===tf.event.sourceEvent.type&&(Ai=!0)))}function $e(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function _e(){$i.attr("width",Qf).attr("height",Rf),$i.select("#"+pi).select("rect").attr("width",Mf).attr("height",Of),$i.select("#"+qi).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),$i.select("#"+ri).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),$i.select("."+f.zoomRect).attr("width",Mf).attr("height",Of),ej.style("max-height",Rf+"px")}function af(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),_e(),m(a.withTransition),Xe(a)}function bf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=aj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Di(a)}),e=aj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("fill",function(a){return Di(a)}).style("stroke","none").style("cursor",function(a){return Gg(a)?"pointer":null}),c=aj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)}),b.append("path").attr("class",dd).style("opacity",function(){return gj=+tf.select(this).style("opacity"),0}).style("fill",function(a){return Di(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Di(a)}).style("cursor",function(a){return Gg(a)?"pointer":null}),a.forEach(function(a){aj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=aj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Yf(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Di(a.data)}).style("cursor",function(a){return Gg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Fb(a),d=Lb(c),e=Tb();Nb(c.data.id),jf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Fb(a),c=[Lb(b)];Md(c,tf.mouse(this))}).on("mouseout",function(a,b){var c=Fb(a),d=Lb(c),e=Ub();Ob(c.data.id),lf(),Nd(),e(d,b)}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Pg&&(n=bj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Di(a)}),l=bj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)})),$i.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function cf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Xd(a.id,b.types[a.id]):Xd(a.id,b.type)}),uf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Ni?j:i,l=Ni?Q():P();return d&&(x=0,D=0,u=0,v=0),Sg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Ni?v:u,void(Xg?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Ni?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=cj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Ug?Ug(a):uf.toggle(a)}).on("mouseover",function(a){uf.focus(a),"function"==typeof Vg&&Vg(a)}).on("mouseout",function(a){uf.revert(),"function"==typeof Wg&&Wg(a)}),o.append("text").text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ni?h:-200).attr("y",Ni?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ni?i:-200).attr("y",Ni?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Di(a)}).attr("x",Ni?h:-200).attr("y",Ni?-200:j).attr("width",10).attr("height",10),cj.selectAll("text").data(a).text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),cj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),cj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),N(u),O(v),M(D),n(),R(),_e(),r&&m(q,c)}function pf(a){return Ec(uf.data.targets,a.id)}function qf(a){return"data"in a&&Ec(uf.data.targets,a.data.id)}function rf(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 sf(a,b,c){var d=!be(uf.data.targets);Xd(a,b),af(c||{withTransitionForAxis:d})}var tf=a.d3?a.d3:a.require?a.require("d3"):void 0,uf={data:{},axis:{},legend:{}},vf={},wf=h(["bindto"],"#chart"),xf=h(["size","width"]),yf=h(["size","height"]),zf=h(["padding","left"]),Af=h(["padding","right"]),Bf=h(["zoom","enabled"],!1),Cf=h(["zoom","extent"]),Df=h(["zoom","privileged"],!1),Ef=h(["onenter"],function(){}),Ff=h(["onleave"],function(){}),Gf=h(["onresize"],function(){}),Hf=h(["onresized"],function(){}),If=h(["transition","duration"],350);g("data","data is required in config");var Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg=h(["data","x"]),qg=h(["data","xs"],{}),rg=h(["data","x_format"]),sg=h(["data","id_converter"],function(a){return a}),tg=h(["data","names"],{}),ug=h(["data","classes"],{}),vg=h(["data","groups"],[]),wg=h(["data","axes"],{}),xg=h(["data","type"]),yg=h(["data","types"],{}),zg=h(["data","labels"],{}),Ag=h(["data","order"]),Bg=h(["data","regions"],{}),Cg=h(["data","color"]),Dg=h(["data","colors"],{}),Eg=h(["data","selection","enabled"],!1),Fg=h(["data","selection","grouped"],!1),Gg=h(["data","selection","isselectable"],function(){return!0}),Hg=h(["data","selection","multiple"],!0),Ig=h(["data","onclick"],function(){}),Jg=h(["data","onenter"],function(){}),Kg=h(["data","onleave"],function(){}),Lg=h(["data","onselected"],function(){}),Mg=h(["data","onunselected"],function(){}),Ng=h(["data","ondragstart"],function(){}),Og=h(["data","ondragend"],function(){}),Pg=h(["subchart","show"],!1),Qg=h(["subchart","size","height"],60),Rg=h(["color","pattern"],[]),Sg=h(["legend","show"],!0),Tg=h(["legend","position"],"bottom"),Ug=h(["legend","item","onclick"]),Vg=h(["legend","item","onmouseover"]),Wg=h(["legend","item","onmouseout"]),Xg=h(["legend","equally"],!1),Yg=h(["axis","rotated"],!1),Zg=h(["axis","x","show"],!0),$g=h(["axis","x","type"],"indexed"),_g=h(["axis","x","localtime"],!0),ah=h(["axis","x","categories"],[]),bh=h(["axis","x","tick","centered"],!1),ch=h(["axis","x","tick","format"]),dh=h(["axis","x","tick","culling"],{}),eh=h(["axis","x","tick","culling","max"],10),fh=h(["axis","x","tick","count"]),gh=h(["axis","x","tick","fit"],!0),hh=h(["axis","x","tick","values"],null),ih=h(["axis","x","tick","rotate"]),jh=h(["axis","x","max"],null),kh=h(["axis","x","min"],null),lh=h(["axis","x","padding"],{}),mh=h(["axis","x","height"]),nh=h(["axis","x","default"]),oh=h(["axis","x","label"],{}),ph=h(["axis","y","show"],!0),qh=h(["axis","y","max"]),rh=h(["axis","y","min"]),sh=h(["axis","y","center"]),th=h(["axis","y","label"],{}),uh=h(["axis","y","inner"],!1),vh=h(["axis","y","tick","format"]),wh=h(["axis","y","padding"],{}),xh=h(["axis","y","ticks"],10),yh=h(["axis","y2","show"],!1),zh=h(["axis","y2","max"]),Ah=h(["axis","y2","min"]),Bh=h(["axis","y2","center"]),Ch=h(["axis","y2","label"],{}),Dh=h(["axis","y2","inner"],!1),Eh=h(["axis","y2","tick","format"]),Fh=h(["axis","y2","padding"],{}),Gh=h(["axis","y2","ticks"],10),Hh=h(["grid","x","show"],!1),Ih=h(["grid","x","type"],"tick"),Jh=h(["grid","x","lines"],[]),Kh=h(["grid","y","show"],!1),Lh=h(["grid","y","lines"],[]),Mh=h(["grid","y","ticks"],10),Nh=h(["point","show"],!0),Oh=Nh?h(["point","r"],2.5):0,Ph=h(["point","focus","line","enabled"],!0),Qh=h(["point","focus","expand","enabled"],!0),Rh=h(["point","focus","expand","r"],Qh?4:Oh),Sh=h(["point","focus","select","r"],8),Th=h(["line","connect_null"],!1),Uh=h(["bar","width"]),Vh=h(["bar","width","ratio"],.6),Wh=h(["pie","label","show"],!0),Xh=h(["pie","label","format"]),Yh=h(["pie","expand"],!0),Zh=h(["pie","onclick"],function(){}),$h=h(["pie","onmouseover"],function(){}),_h=h(["pie","onmouseout"],function(){}),ai=h(["donut","label","show"],!0),bi=h(["donut","label","format"]),ci=h(["donut","expand"],!0),di=h(["donut","title"],""),ei=h(["donut","onclick"],function(){}),fi=h(["donut","onmouseover"],function(){}),gi=h(["donut","onmouseout"],function(){}),hi=h(["regions"],[]),ii=h(["tooltip","show"],!0),ji=h(["tooltip","format","title"]),ki=h(["tooltip","format","value"]),li=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ji?ji:b,l=ki?ki: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+""}),mi=h(["tooltip","init","show"],!1),ni=h(["tooltip","init","x"],0),oi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),pi=("string"==typeof wf?wf.replace("#",""):wf.id)+"-clip",qi=pi+"-xaxis",ri=pi+"-yaxis",si=i(pi),ti=i(qi),ui=i(ri),vi="timeseries"===$g,wi="categorized"===$g,xi=!vi&&(pg||te(qg)),yi=null,zi=!1,Ai=!1,Bi=!1,Ci=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Di=ne(Dg,te(Rg)?Rg:Ci,Cg),Ei=_g?tf.time.format:tf.time.format.utc,Fi=function(){var a=[[Ei("%Y/%-m/%-d"),function(){return!0}],[Ei("%-m/%-d"),function(a){return a.getMonth()}],[Ei("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ei("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ei("%I %p"),function(a){return a.getHours()}],[Ei("%I:%M"),function(a){return a.getMinutes()}],[Ei(":%S"),function(a){return a.getSeconds()}],[Ei(".%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)}}(),Gi=[],Hi=[],Ii=Yg?"left":"bottom",Ji=Yg?uh?"top":"bottom":uh?"right":"left",Ki=Yg?Dh?"bottom":"top":Dh?"left":"right",Li=Yg?"left":"bottom",Mi={main:function(){return"translate("+Jf.left+","+Jf.top+")"},context:function(){return"translate("+Kf.left+","+Kf.top+")"},legend:function(){return"translate("+Lf.left+","+Lf.top+")"},x:function(){return"translate(0,"+(Yg?0:Of)+")"},y:function(){return"translate(0,"+(Yg?Of:0)+")"},y2:function(){return"translate("+(Yg?0:Mf)+","+(Yg?1:0)+")"},subx:function(){return"translate(0,"+(Yg?0:Pf)+")"},arc:function(){return"translate("+Mf/2+","+Of/2+")"}},Ni="right"===Tg,Oi=0,Pi=0,Qi=0,Ri=.15,Si=30,Ti=Yg&&!Zg?0:30,Ui=5;Yf=tf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Vi,Wi=function(){var a=tf.svg.line().x(Yg?function(a){return V(a.id)(a.value)}:zd).y(Yg?zd:function(a){return V(a.id)(a.value)});return Th||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Th?De(b.values):b.values;return ce(b)?(a.interpolate(de(b)?"cardinal":"linear"),Bg[b.id]?Pe(e,fg,V(b.id),Bg[b.id]):a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Xi=function(){var a;return a=Yg?tf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(zd):tf.svg.area().x(zd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=De(b.values);return Yd([b],"area")||Yd([b],"area-spline")?(a.interpolate(de(b)?"cardinal":"linear"),a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Yi=function(){var a=tf.svg.line().x(Yg?function(a){return W(a.id)(a.value)}:Cd).y(Yg?Cd:function(a){return W(a.id)(a.value)});return function(b){var c=De(b.values);return ce(b)?a(c):"M "+ig(c[0].x)+" "+W(b.id)(c[0].value)}}(),Zi=function(){};Vi=tf.svg.brush().on("brush",Ye),Vi.update=function(){return bj&&bj.select("."+f.brush).call(this),this},Vi.scale=function(a){return Yg?this.y(a):this.x(a)},Bf&&(Zi=tf.behavior.zoom().on("zoomstart",function(){Zi.altDomain=tf.event.sourceEvent.altKey?fg.orgDomain():null}).on("zoom",Bf?Ze:null),Zi.scale=function(a){return Yg?this.y(a):this.x(a)},Zi.orgScaleExtent=function(){var a=Cf?Cf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},Zi.updateScaleExtent=function(){var a=ac(fg.orgDomain())/ac(fj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var $i,_i,aj,bj,cj,dj,ej,fj,gj,hj={};if(uf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),uf.defocus(),b(d.classed(f.focused,!0)),b(e),be(uf.data.targets)&&Nb(a,!0),jf(a)},uf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),kf(a)},uf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),lf()},uf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),$i.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?mf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},uf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),$i.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?nf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Ri),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},uf.toggle=function(a){Gc(a)?uf.hide(a):uf.show(a)},uf.unzoom=function(){Vi.clear().update(),Xe({withUpdateXDomain:!0})},uf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){ug[b]=a.classes[b]}),"categories"in a&&wi&&(ah=a.categories,lg.categories(ah)),"cacheIds"in a&&bc(a.cacheIds)?void cf(dc(a.cacheIds),a.done):void("unload"in a?ef(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){df(a)}):df(a))},uf.unload=function(a){ef(Dc(a),function(){Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},uf.selected=function(a){return tf.merge(aj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return tf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},uf.select=function(a,b,c){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=tf.select(this),i="circle"===this.nodeName?xe:Ae,j="circle"===this.nodeName?ye:Be,k=Fg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Gg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},uf.unselect=function(a,b){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=tf.select(this),g="circle"===this.nodeName?ye:Be,h=Fg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Gg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},uf.toLine=function(a){sf(a,"line")},uf.toSpline=function(a){sf(a,"spline")},uf.toBar=function(a){sf(a,"bar")},uf.toScatter=function(a){sf(a,"scatter")},uf.toArea=function(a){sf(a,"area")},uf.toAreaSpline=function(a){sf(a,"area-spline")},uf.toPie=function(a){sf(a,"pie",{withTransform:!0})},uf.toDonut=function(a){sf(a,"donut",{withTransform:!0})},uf.groups=function(a){return c(a)?vg:(vg=a,Xe(),vg)},uf.xgrids=function(a){return a?(Jh=a,Xe(),Jh):Jh},uf.xgrids.add=function(a){return a?uf.xgrids(Jh.concat(a)):void 0 +},uf.xgrids.remove=function(a){var b=rf(a);return uf.xgrids(Jh.filter(b))},uf.ygrids=function(a){return a?(Lh=a,Xe(),Lh):Lh},uf.ygrids.add=function(a){return a?uf.ygrids(Lh.concat(a)):void 0},uf.ygrids.remove=function(a){var b=rf(a);return uf.ygrids(Lh.filter(b))},uf.regions=function(a){return c(a)?hi:(hi=a,Xe(),hi)},uf.regions.add=function(a){return c(a)?hi:(hi=hi.concat(a),Xe(),hi)},uf.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;$i.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),hi=hi.filter(function(b){return b.classes.indexOf(a)<0})}),hi},uf.data.get=function(a){var b=uf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},uf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},uf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){tg[b]=a[b]}),of(Cc(uf.data.targets),{withTransition:!0}),tg):tg},uf.x=function(a){return arguments.length&&(qc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.xs=function(a){return arguments.length&&(rc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},uf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(qh=+a.y),b(a.y2)&&(zh=+a.y2)):qh=zh=+a,Xe())},uf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(rh=+a.y),b(a.y2)&&(Ah=+a.y2)):rh=Ah=+a,Xe())},uf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&uf.axis.max(a.max),"undefined"!=typeof a.min&&uf.axis.min(a.min))},uf.legend.show=function(a){Sg||(Sg=!0,cj.style("visibility","visible")),mf(Dc(a)),Xe({withTransitionForHorizontalAxis:!1})},uf.legend.hide=function(a){Sg&&se(a)&&(Sg=!1,cj.style("visibility","hidden")),nf(Dc(a)),Xe({withTransitionForHorizontalAxis:!1})},uf.resize=function(a){xf=a?a.width:null,yf=a?a.height:null,af({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},uf.destroy=function(){uf.data.targets=void 0,uf.data.xs={},ej.html(""),a.onresize=null},"url"in e.data)tf.xhr(e.data.url,function(a,b){var c,d=tf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=tf.csv.parse(b.response),Qe(c)});else if("rows"in e.data)Qe(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Qe(uc(e.data.columns))}return uf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 9643a7aea9dc7a8bbb37634b280851274f678baf Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Sun, 27 Apr 2014 16:30:30 +0900 Subject: [PATCH 069/178] Refactor redraw --- c3.js | 67 ++++++++++++++++++------------------------------------- c3.min.js | 4 ++-- 2 files changed, 24 insertions(+), 47 deletions(-) diff --git a/c3.js b/c3.js index c624edc..66209db 100644 --- a/c3.js +++ b/c3.js @@ -3095,7 +3095,7 @@ var mainCircle, mainBar, mainRegion, mainText, contextBar, eventRect, eventRectUpdate; var barIndices = getBarIndices(), maxDataCountTarget; var rectX, rectW; - var withY, withSubchart, withTransition, withTransitionForExit, withTransitionForAxis, withTransitionForHorizontalAxis, 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 transitions, duration, durationForExit, durationForAxis; @@ -3112,16 +3112,15 @@ withTransitionForExit = isDefined(options.withTransitionForExit) ? options.withTransitionForExit : withTransition; withTransitionForAxis = isDefined(options.withTransitionForAxis) ? options.withTransitionForAxis : withTransition; - withTransitionForHorizontalAxis = isDefined(options.withTransitionForHorizontalAxis) ? options.withTransitionForHorizontalAxis : withTransition; duration = withTransition ? __transition_duration : 0; durationForExit = withTransitionForExit ? duration : 0; durationForAxis = withTransitionForAxis ? duration : 0; - xaxis = main.select('.' + CLASS.axisX); - yaxis = main.select('.' + CLASS.axisY); - y2axis = main.select('.' + CLASS.axisY2); - subxaxis = context.select('.' + CLASS.axisX); + xaxis = main.select('.' + CLASS.axisX).style("opacity", hideAxis ? 0 : 1); + yaxis = main.select('.' + CLASS.axisY).style("opacity", hideAxis ? 0 : 1); + y2axis = main.select('.' + CLASS.axisY2).style("opacity", hideAxis ? 0 : 1); + subxaxis = context.select('.' + CLASS.axisX).style("opacity", hideAxis ? 0 : 1); transitions = { axisX: xaxis.transition().duration(durationForAxis), @@ -3135,6 +3134,13 @@ updateLegend(mapToIds(c3.data.targets), options, transitions); } + if (isCategorized) { + // ATTENTION: need to update domain with current domain when categoryAxis + if (targetsToShow.length === 0 || !withUpdateOrgXDomain || withUpdateXDomain) { + x.domain([0, xaxis.selectAll('.tick').size()]); + } + } + if (targetsToShow.length) { if (withUpdateOrgXDomain) { x.domain(d3.extent(getXDomain(targetsToShow))); @@ -3148,11 +3154,6 @@ x.domain(brush.empty() ? orgXDomain : brush.extent()); if (__zoom_enabled) { zoom.scale(x).updateScaleExtent(); } } - } else { - // ticks increase without this when no data shown - if (isCategorized) { - x.domain([0, xaxis.selectAll('.tick').size()]); - } } y.domain(getYDomain(targetsToShow, 'y')); @@ -3165,33 +3166,11 @@ subXAxis.tickValues(tickValues); } - // x axis - xaxis.style("opacity", hideAxis ? 0 : 1); - if (__axis_rotated || withTransitionForHorizontalAxis) { - xaxis = transitions.axisX; - } - xaxis.call(xAxis); - - // y axis - yaxis.style("opacity", hideAxis ? 0 : 1); - if (!__axis_rotated || withTransitionForHorizontalAxis) { - yaxis = transitions.axisY; - } - yaxis.call(yAxis); - - // y2 axis - y2axis.style("opacity", hideAxis ? 0 : 1); - if (!__axis_rotated || withTransitionForHorizontalAxis) { - y2axis = transitions.axisY2; - } - y2axis.call(y2Axis); - - // sub x axis - subxaxis.style("opacity", hideAxis ? 0 : 1); - if (__axis_rotated || withTransitionForHorizontalAxis) { - subxaxis = transitions.axisSubX; - } - subxaxis.call(subXAxis); + // axes + transitions.axisX.call(xAxis); + transitions.axisY.call(yAxis); + transitions.axisY2.call(y2Axis); + transitions.axisSubX.call(subXAxis); // show/hide if manual culling needed if (withUpdateXDomain) { @@ -3907,14 +3886,12 @@ .style('visibility', 'visible') .transition() .style('opacity', opacityForLegend); - updateLegend(mapToIds(c3.data.targets)); } function hideLegend(targetIds) { addHiddenLegendIds(targetIds); legend.selectAll(selectorLegends(targetIds)) .style('opacity', 0) .style('visibility', 'hidden'); - updateLegend(mapToIds(c3.data.targets)); } function updateLegend(targetIds, options, transitions) { @@ -4163,7 +4140,7 @@ .style('opacity', 1); } - redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withTransitionForHorizontalAxis: false}); + redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: true}); }; c3.hide = function (targetIds, options) { @@ -4184,7 +4161,7 @@ .style('opacity', legendOpacityForHidden); } - redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withTransitionForHorizontalAxis: false}); + redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: true}); }; c3.toggle = function (targetId) { @@ -4454,15 +4431,15 @@ legend.style('visibility', 'visible'); } showLegend(mapToTargetIds(targetIds)); - redraw({withTransitionForHorizontalAxis: false}); + redraw({withLegend: true}); }; c3.legend.hide = function (targetIds) { + hideLegend(mapToTargetIds(targetIds)); + redraw({withLegend: true}); if (__legend_show && isEmpty(targetIds)) { __legend_show = false; legend.style('visibility', 'hidden'); } - hideLegend(mapToTargetIds(targetIds)); - redraw({withTransitionForHorizontalAxis: false}); }; c3.resize = function (size) { diff --git a/c3.min.js b/c3.min.js index 989807c..660a1d4 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ !function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.32"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cMf&&(Mf=0),0>Of&&(Of=0),Nf=Yg?Jf.left-Si-Ti:Mf,Pf=Yg?Of:Rf-Kf.top-Kf.bottom,0>Nf&&(Nf=0),0>Pf&&(Pf=0),p(),Ni&&be(uf.data.targets)&&(Lf.left=Mf/2+Tf)}function o(){aj.select("line."+f.xgridFocus).attr("x1",Yg?0:-10).attr("x2",Yg?Mf:-10).attr("y1",Yg?-10:Jf.top).attr("y2",Yg?-10:Of)}function p(){Tf=Of/2,Sf=.95*Tf,Uf=ae(uf.data.targets)?.6*Sf:0}function q(){var a=Yg?f.axisX:f.axisY,b=tf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=tf.select(wf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return xf?xf:x()}function s(){var a=yf?yf:y();return a>0?a:320}function t(){return be(uf.data.targets)?0:zf?zf:Yg?Zg?v("x"):1:!ph||uh?1:v("y")}function u(){var a=1;return be(uf.data.targets)?0:Af?Af:Ni?P()+(yh&&!Yg?v("y2"):a):yh?Dh||Yg?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||Zg?"x"===a&&mh?mh:"y"!==a||ph?"y2"!==a||yh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Ui:Sg&&!Ni?10:1:0}function x(){return+tf.select(wf).style("width").replace("px","")}function y(){return+tf.select(wf).style("height").replace("px","")}function z(a){return a?-5:-(Jf.left-1)}function A(a){return a?-20:-4}function B(){return z(!Yg)}function C(){return A(!Yg)}function D(){return z(Yg)}function E(){return A(Yg)}function F(a){return a?Mf+2+4:Jf.left+20}function G(a){return a?(mh?mh:0)+80:Of+8}function H(){return F(!Yg)}function I(){return G(!Yg)}function J(){return F(Yg)}function K(){return G(Yg)}function L(){var a=Ac(uf.data.targets),b=a.values[0],c=a.values[a.values.length-1],d=fg(c.x)-fg(b.x),e=zc(),f=Zd(uf.data.targets)?(e-(wi?.25:1))/e:1;return e>1?d*f/(e-1):d}function M(a){Oi=a}function N(a){Pi=a}function O(a){Qi=a}function P(){return Sg?Ni?Pi*(Oi+1):Qf:0}function Q(){return Sg?Ni?Rf:Qi*(Oi+1):0}function R(){var a,b=!fg;Zf=Yg?1:0,$f=Yg?Of:Mf,_f=Yg?0:Of,ag=Yg?Mf:1,bg=Zf,cg=$f,dg=Yg?0:Pf,eg=Yg?Nf:1,fg=T(Zf,$f,b?void 0:fg.domain(),function(){return lg.tickOffset()}),gg=U(_f,ag,b?void 0:gg.domain()),hg=U(_f,ag,b?void 0:hg.domain()),ig=T(Zf,$f,fj,function(a){return a%1?0:og.tickOffset()}),jg=U(dg,eg,b?void 0:jg.domain()),kg=U(dg,eg,b?void 0:kg.domain()),a=$(),lg=X(fg,Ii,a),og=X(ig,Li,a),mg=Y(gg,Ji,vh,xh),ng=Y(hg,Ki,Eh,Gh),b||(Vi.scale(ig),Bf&&Zi.scale(fg)),S()}function S(){Vf=Gb(),Wf=Hb(),Xf=Hb(.98)}function T(a,b,d,e){var f=(vi?tf.time.scale():tf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),wi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=tf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?hg:gg}function W(a){return"y2"===Z(a)?kg:jg}function X(a,b,c){var d=(wi?Eb():tf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),wi?(d.tickCentered(bh),se(dh)&&(dh=!1)):d.tickOffset=function(){var a=Bc(uf.data.targets),b=fg(a[1])-fg(a[0]);return b/zc()/2},wi&&d.categories(ah),d}function Y(a,b,c,d){return tf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in wg?wg[a]:"y"}function $(){var a=vi?Fi:wi?Tc:function(a){return 0>a?a.toFixed(0):a};return ch&&("function"==typeof ch?a=ch:vi&&(a=function(a){return a?Ei(ch)(a):""})),a}function _(a){var b;return"y"===a?b=th:"y2"===a?b=Ch:"x"===a&&(b=oh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?th=b:"y2"===a?Ch=b:"x"===a&&(oh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a){a.selectAll(".tick text").attr("y",db(ih)).attr("x",cb(ih)).attr("transform","rotate("+ih+")").style("text-anchor","start")}function fb(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 gb(){return fb("x",Yg?"inner-top":"inner-right")}function hb(){return fb("y",Yg?"inner-right":"inner-top")}function ib(){return fb("y2",Yg?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Mf/2:Mf:b.isBottom?-Of:b.isMiddle?-Of/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!Yg,gb())}function rb(){return nb(Yg,hb())}function sb(){return nb(Yg,ib())}function tb(){return ob(!Yg,gb())}function ub(){return ob(Yg,hb())}function vb(){return ob(Yg,ib())}function wb(){var a=gb();return Yg?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":mh?mh-10:"3em"}function xb(){var a=hb();return Yg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return Yg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!Yg,gb())}function Ab(){return pb(Yg,hb())}function Bb(){return pb(Yg,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return tf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?30:b}function Db(){aj.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),aj.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),aj.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 tf.min(Object.keys(i).map(function(a){return tf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(vg.length>0)for(g=Sc(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 tf.max(Object.keys(i).map(function(a){return tf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Ah:rh,n="y2"===c?zh:qh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Bh:sh,r=ud()&&Yg;return 0===l.length?"y2"===c?hg.domain():gg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(gg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&wh&&(f=b(wh.top)?wh.top:e,g=b(wh.bottom)?wh.bottom:e),"y2"===c&&Fh&&(f=b(Fh.top)?Fh.top:e,g=b(Fh.bottom)?Fh.bottom:e),Zd(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return kh?vi?oe(kh):kh:tf.min(a,function(a){return tf.min(a.values,function(a){return a.x})})}function Zb(a){return jh?vi?oe(jh):jh:tf.max(a,function(a){return tf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return wi?d=0:Zd(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof lh&&te(lh)?(e=b(lh.left)?lh.left:d,f=b(lh.right)?lh.right:d):e=f="number"==typeof lh?lh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?gg:hg;return b="y"===a.axis||"y2"===a.axis?Yg?Of:"start"in a?d(a.start):Of:Yg?"end"in a?fg(vi?oe(a.end):a.end):Of:Of,c>b?0:b-c}function ic(a){return pg&&a===pg||te(qg)&&ue(qg,a)}function jc(a){return!ic(a)}function kc(a){return pg?pg:te(qg)?qg[a]:null}function lc(a,b){var c,d=b&&te(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=uf.data.xs[b])}),c}function mc(a,b){return a in uf.data.xs&&uf.data.xs[a]&&uf.data.xs[a][b]?uf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){qg[b]=a[b]})}function oc(a){return 1===tf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=tg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),uf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=vi?a?a instanceof Date?a:oe(a):oe(mc(c,d)):xi&&!wi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?uf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):pg?(d=Object.keys(uf.data.xs),uf.data.xs[c]=d.length>0?uf.data.xs[d[0]]:void 0):te(qg)&&(uf.data.xs[c]=lc(f,uf.data.targets)):uf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!uf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=sg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return xi&&wi&&0===c&&g&&(0===e&&(ah=[]),ah.push(g)),("undefined"==typeof a[b]||uf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),xg&&Xd(Cc(c).filter(function(a){return!(a in yg)}),xg),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&uf.data.targets[0].values[a-1]?uf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(uf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(vi?new Date(h):h);i.push(d)}return vi||(i=i.sort(function(a,b){return a-b})),i}function Lc(a){Gi=Gi.concat(a)}function Mc(a){Gi=Gi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Hi=Hi.concat(a)}function Oc(a){Hi=Hi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Dd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Dd(a,g))),Gd(e,b)):Ed(a,b,f,g)}function Fd(a,b){var c;return c=a.map(function(a){return Ed(a.values,b)}),Gd(c,b)}function Gd(a,b){var c,d;return a.forEach(function(a){var e=ve(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Hd(a,b){return tf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Id(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 Jd(){return Ag&&"desc"===Ag.toLowerCase()}function Kd(){return Ag&&"asc"===Ag.toLowerCase()}function Ld(a){var b=Kd(),c=Jd();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 Ag&&a.sort(Ag),a}function Md(a,c){var d,e,f,g,h,i,j,k=be(uf.data.targets),l=k?xd:wd,m=a.filter(function(a){return a&&b(a.value)});ii&&0!==m.length&&(dj.html(li(a,$(),l,Di)).style("display","block"),d=dj.property("offsetWidth"),e=dj.property("offsetHeight"),k?(g=Mf/2+c[0],i=Of/2+c[1]+20):(Yg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=fg(m[0].x)+20):(f=q(),g=f+t()+fg(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),dj.style("top",i+"px").style("left",g+"px"))}function Nd(){dj.style("display","none")}function Od(a){var c=a.filter(function(a){return a&&b(a.value)});ii&&($d(uf.data.targets)||be(uf.data.targets)||aj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Yg?"y1":"x1",zd).attr(Yg?"y2":"x2",zd))}function Pd(){aj.select("line."+f.xgridFocus).style("visibility","hidden")}function Qd(a){return a.x||0===a.x?fg(a.x):null}function Rd(a){return V(a.id)(a.value)}function Sd(){var a,b,d={},e=0;return Ic(Fc(ee)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Wd(a,b){return Uh?Uh:b?2*a.tickOffset()*Vh/b:0}function Xd(a,b){Dc(a).forEach(function(a){hj[a]=b===yg[a],yg[a]=b})}function Yd(a,b){var c=!1;return a.forEach(function(a){yg[a.id]===b&&(c=!0),a.id in yg||"line"!==b||(c=!0)}),c}function Zd(a){return Yd(a,"bar")}function $d(a){return Yd(a,"scatter")}function _d(a){return Yd(a,"pie")}function ae(a){return Yd(a,"donut")}function be(a){return _d(a)||ae(a)}function ce(a){var b="string"==typeof a?a:a.id;return!(b in yg)||"line"===yg[b]||"spline"===yg[b]||"area"===yg[b]||"area-spline"===yg[b]}function de(a){var b="string"==typeof a?a:a.id;return"spline"===yg[b]||"area-spline"===yg[b]}function ee(a){var b="string"==typeof a?a:a.id;return"bar"===yg[b]}function fe(a){var b="string"==typeof a?a:a.id;return"scatter"===yg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"pie"===yg[b]}function he(a){var b="string"==typeof a?a:a.id;return"donut"===yg[b]}function ie(a){return ge(a)||he(a)}function je(a){return ee(a)?a.values:[]}function ke(a){return ce(a)||fe(a)?a.values:[]}function le(a){return ee(a)||ce(a)?a.values:[]}function me(a){return he(a)&&ci||ge(a)&&Yh}function ne(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function oe(b){var c;try{c=rg?tf.time.format(rg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+rg)}return c}function pe(a,b){var c=tf.mouse(a),d=tf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function ue(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ve(a,b){var c="y"===Z(a.id)?gg:hg,d=Yg?1:0,e=Yg?0:1;return Math.pow(fg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function we(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function xe(a,b,c){Lg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd).attr("stroke",function(){return Di(b)}).attr("r",1.4*Sh).transition().duration(100).attr("r",Sh)}function ye(a,b,c){Mg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ze(a,b,c,d){a?xe(b,c,d):ye(b,c,d)}function Ae(a,b){Lg(b,a.node()),a.transition().duration(100).style("fill",function(){return tf.rgb(Di(b)).darker(1)})}function Be(a,b){Mg(b,a.node()),a.transition().duration(100).style("fill",function(){return Di(b)})}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a){return a.filter(function(a){return b(a.value)})}function Ee(a,c){return(c?aj.selectAll("."+f.circles+ld(c)):aj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Fe(a,b){Ee(a,b).classed(f.EXPANDED,!0).attr("r",Rh)}function Ge(a){Ee(a).filter(function(){return tf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oh)}function He(a){return aj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ie(a){He(a).classed(f.EXPANDED,!0)}function Je(a){He(a).classed(f.EXPANDED,!1)}function Ke(a,b){var c=Oe(a,b);return function(a,b){var d=c(a,b),e=Yg?1:0,f=Yg?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 Le(a,b){var c=Oe(a,!1),d=b?Me:Ne;return function(a,b){return d(c(a,b),a,this)}}function Me(a,b){var c;return Yg?(c=ee(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ne(a,b,c){var d=c.getBoundingClientRect();return Yg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ee(b)?-3:-6)}function Oe(a,b){var c=a.__max__+1,d=Wd(lg,c),e=Td(d,c,a,!!b),f=Ud(!!b),g=Vd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Yg&&(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 Pe(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 Qe(b){var c,d,e;if(ej=tf.select(wf),ej.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ej.html(""),ej.classed("c3",!0),uf.data.xs={},uf.data.targets=vc(b),n(),R(),fg.domain(tf.extent(_b(uf.data.targets))),gg.domain(Xb(uf.data.targets,"y")),hg.domain(Xb(uf.data.targets,"y2")),ig.domain(fg.domain()),jg.domain(gg.domain()),kg.domain(hg.domain()),fj=fg.domain(),Vi.scale(ig),Bf&&Zi.scale(fg),$i=ej.append("svg").attr("width",Mf+Jf.left+Jf.right).attr("height",Of+Jf.top+Jf.bottom).on("mouseenter",Ef).on("mouseleave",Ff),_i=$i.append("defs"),_i.append("clipPath").attr("id",pi).append("rect").attr("width",Mf).attr("height",Of),_i.append("clipPath").attr("id",qi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),_i.append("clipPath").attr("id",ri).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),aj=$i.append("g").attr("transform",Mi.main),bj=$i.append("g").attr("transform",Mi.context),cj=$i.append("g").attr("transform",Mi.legend),Pg||bj.style("visibility","hidden"),Sg||(cj.style("visibility","hidden"),Hi=Cc(uf.data.targets)),dj=tf.select(wf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),of(Cc(uf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Zg&&aj.append("g").attr("class",f.axisX).attr("clip-path",ti).attr("transform",Mi.x).append("text").attr("class",f.axisXLabel).attr("transform",Yg?"rotate(-90)":"").style("text-anchor",zb),ph&&aj.append("g").attr("class",f.axisY).attr("clip-path",ui).attr("transform",Mi.y).append("text").attr("class",f.axisYLabel).attr("transform",Yg?"":"rotate(-90)").style("text-anchor",Ab),yh&&aj.append("g").attr("class",f.axisY2).attr("transform",Mi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Yg?"":"rotate(-90)").style("text-anchor",Bb),d=aj.append("g").attr("clip-path",si).attr("class",f.grid),Hh&&d.append("g").attr("class",f.xgrids),te(Jh)&&d.append("g").attr("class",f.xgridLines),Ph&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Kh&&d.append("g").attr("class",f.ygrids),te(Lh)&&d.append("g").attr("class",f.ygridLines),aj.append("g").attr("clip-path",si).attr("class",f.regions),aj.append("g").attr("clip-path",si).attr("class",f.chart),c=aj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Bf?Yg?"ns-resize":"ew-resize":null),aj.select("."+f.chart).append("g").attr("class",f.chartBars),aj.select("."+f.chart).append("g").attr("class",f.chartLines),aj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Mi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),aj.select("."+f.chart).append("g").attr("class",f.chartTexts),Bf&&aj.insert("rect",Df?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Mf).attr("height",Of).style("opacity",0).style("cursor",Yg?"ns-resize":"ew-resize").call(Zi).on("dblclick.zoom",null),nh&&Vi.extent("function"!=typeof nh?nh:nh(_b())),bj.append("g").attr("clip-path",si).attr("class",f.chart).attr("display","none"),bj.select("."+f.chart).append("g").attr("class",f.chartBars),bj.select("."+f.chart).append("g").attr("class",f.chartLines),bj.append("g").attr("clip-path",si).attr("class",f.brush).call(Vi).selectAll("rect").attr(Yg?"width":"height",Yg?Nf:Pf),bj.append("g").attr("class",f.axisX).attr("transform",Mi.subx).attr("clip-path",Yg?"":ti),bf(uf.data.targets),Yg?aj.select("."+f.axisX).style("opacity",0).call(lg):(aj.select("."+f.axisY).style("opacity",0).call(mg),aj.select("."+f.axisY2).style("opacity",0).call(ng)),n(),R(),_e(),m(!1),Xe({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),mi){if(vi&&"string"==typeof ni){for(ni=oe(ni),e=0;e0){d=[];for(var g in tg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Id(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ce,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 Ve(a){be(uf.data.targets)||Eg&&(yi=a,aj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),zi=!0,Ng())}function We(){be(uf.data.targets)||Eg&&(aj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),aj.selectAll("."+f.shape).classed(f.INCLUDED,!1),zi=!1,Og())}function Xe(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V,W=Sd(),X=be(uf.data.targets),Y=Ic(uf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,G=d(a.withTransform)?a.withTransform:!1,H=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,I=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,J=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,F=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:C,Q=C?If:0,R=D?Q:0,S=E?Q:0,c=aj.select("."+f.axisX),g=aj.select("."+f.axisY),h=aj.select("."+f.axisY2),e=bj.select("."+f.axisX),P={axisX:c.transition().duration(S),axisY:g.transition().duration(S),axisY2:h.transition().duration(S),axisSubX:e.transition().duration(S)},J&&Sg&&of(Cc(uf.data.targets),a,P),Y.length?(I&&(fg.domain(tf.extent(_b(Y))),fj=fg.domain(),Bf&&Zi.scale(fg).updateScaleExtent(),ig.domain(fg.domain()),Vi.scale(ig)),H&&(fg.domain(Vi.empty()?fj:Vi.extent()),Bf&&Zi.scale(fg).updateScaleExtent())):wi&&fg.domain([0,c.selectAll(".tick").size()]),gg.domain(Xb(Y,"y")),hg.domain(Xb(Y,"y2")),(gh||fh)&&(T=hh?hh:Kc(Jc(Y)),lg.tickValues(T),og.tickValues(T)),c.style("opacity",X?0:1),(Yg||F)&&(c=P.axisX),c.call(lg),g.style("opacity",X?0:1),(!Yg||F)&&(g=P.axisY),g.call(mg),h.style("opacity",X?0:1),(!Yg||F)&&(h=P.axisY2),h.call(ng),e.style("opacity",X?0:1),(Yg||F)&&(e=P.axisSubX),e.call(og),H)if(dh&&T){for(U=1;U=0&&tf.select(this).style("display",b%V?"none":"block")})}else tf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!Yg&&ih&&eb(c),K=Ke(W),N=Le(W,!0),O=Le(W,!1),Db(),jg.domain(gg.domain()),kg.domain(hg.domain()),dj.style("display","none"),o(),aj.select("line."+f.xgridFocus).style("visibility","hidden"),Hh){if("year"===Ih){j=[];for(var Z=_b(),$=Z[0].getFullYear(),_=Z[1].getFullYear(),ab=$;_>=ab;ab++)j.push(new Date(ab+"-01-01 00:00:00"))}else j=fg.ticks(10);i=aj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",Yg?0:function(a){return fg(a)-lg.tickOffset()}).attr("x2",Yg?Mf:function(a){return fg(a)-lg.tickOffset()}).attr("y1",Yg?function(a){return fg(a)-lg.tickOffset()}:Jf.top).attr("y2",Yg?function(a){return fg(a)-lg.tickOffset()}:Of).style("opacity",function(){return+tf.select(this).attr(Yg?"y1":"x1")===(Yg?Of:0)?0:1}),i.exit().remove()}te(Jh)&&(k=aj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Jh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",Yg?"":"rotate(-90)").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(Q).attr("x1",Yg?0:Ad).attr("x2",Yg?Mf:Ad).attr("y1",Yg?Ad:Jf.top).attr("y2",Yg?Ad:Of).style("opacity",1),k.select("text").transition().duration(Q).attr("x",Yg?Mf:0).attr("y",Ad).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(Q).style("opacity",0).remove()),A&&Kh&&(m=aj.select("."+f.ygrids).selectAll("."+f.ygrid).data(gg.ticks(Mh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",Yg?gg:0).attr("x2",Yg?gg:Mf).attr("y1",Yg?0:gg).attr("y2",Yg?Of:gg),m.exit().remove()),A&&te(Lh)&&(n=aj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Lh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",Yg?"rotate(-90)":"").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(Q).attr("x1",Yg?Bd:0).attr("x2",Yg?Bd:Mf).attr("y1",Yg?0:Bd).attr("y2",Yg?Of:Bd).style("opacity",1),n.select("text").transition().duration(Q).attr("x",Yg?0:Mf).attr("y",Bd).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(Q).style("opacity",0).remove()),s=aj.select("."+f.regions).selectAll("rect."+f.region).data(hi),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(Q).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(Q).style("fill-opacity",0).remove(),r=aj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),r.enter().append("path").attr("d",K).style("stroke","none").style("opacity",0).style("fill",function(a){return Di(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(Q).attr("d",K).style("opacity",1),r.exit().transition().duration(R).style("opacity",0).remove(),t=aj.selectAll("."+f.texts).selectAll("."+f.text).data(le),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return Yg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return yd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(Q).attr("x",N).attr("y",O).style("fill-opacity",td),t.exit().transition().duration(R).style("fill-opacity",0).remove(),aj.selectAll("."+f.line).style("opacity",qd).transition().duration(Q).attr("d",Wi).style("opacity",1),aj.selectAll("."+f.area).style("opacity",0).transition().duration(Q).attr("d",Xi).style("opacity",gj),q=aj.selectAll("."+f.circles).selectAll("."+f.circle).data(ke),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Oh),q.style("opacity",qd).transition().duration(Q).style("opacity",sd).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),q.exit().remove(),aj.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",G?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(Q).attrTween("d",function(a){var b,c=Fb(a);return c?(b=tf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",G?"scale(1)":"").style("opacity",1),aj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(Q).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&ie(a.data)?1:0}),aj.select("."+f.chartArcsTitle).style("opacity",ae(uf.data.targets)?1:0),Pg&&(null!==tf.event&&"zoom"===tf.event.type&&Vi.extent(fg.orgDomain()).update(),B&&(!Yg&&ih&&eb(e),Vi.empty()||Vi.extent(fg.orgDomain()).update(),M=Ke(W,!0),u=bj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),u.enter().append("path").attr("d",M).style("stroke","none").style("fill",function(a){return Di(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(Q).attr("d",M).style("opacity",1),u.exit().transition().duration(Q).style("opacity",0).remove(),bj.selectAll("."+f.line).style("opacity",qd).transition().duration(Q).attr("d",Yi).style("opacity",1))),aj.selectAll("."+f.selectedCircles).filter(function(a){return ee(a)}).selectAll("circle").remove(),aj.selectAll("."+f.selectedCircle).transition().duration(Q).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),v=aj.select("."+f.eventRects),te(qg)&&!oc(qg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Se(w.enter()),w.attr("x",0).attr("y",0).attr("width",Mf).attr("height",Of)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),xi&&!wi?(z=function(a,b){var c=xc(b),d=yc(b),e=uf.data.xs[a.id][b];return(fg(d?d:e+50)-fg(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=uf.data.xs[a.id][b];return(fg(d)+fg(c?c:d-50))/2}):(z=L(),y=function(a){return fg(a.x)-z/2}),x=Ac(uf.data.targets),aj.select("."+f.eventRects).datum(x?x.values:[]),w=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Re(w.enter()),w.attr("class",fd).attr("x",Yg?0:y).attr("y",Yg?y:0).attr("width",Yg?Mf:z).attr("height",Yg?z:Of),w.exit().remove()),Cc(uf.data.targets).forEach(function(a){hj[a]=!0})}function Ye(){Xe({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ze(){return"mousemove"===tf.event.sourceEvent.type&&Zi.altDomain?(fg.domain(Zi.altDomain),void Zi.scale(fg).updateScaleExtent()):(wi&&fg.orgDomain()[0]===fj[0]&&fg.domain([fj[0]-1e-10,fg.orgDomain()[1]]),Xe({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===tf.event.sourceEvent.type&&(Ai=!0)))}function $e(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function _e(){$i.attr("width",Qf).attr("height",Rf),$i.select("#"+pi).select("rect").attr("width",Mf).attr("height",Of),$i.select("#"+qi).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),$i.select("#"+ri).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),$i.select("."+f.zoomRect).attr("width",Mf).attr("height",Of),ej.style("max-height",Rf+"px")}function af(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),_e(),m(a.withTransition),Xe(a)}function bf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=aj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Di(a)}),e=aj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("fill",function(a){return Di(a)}).style("stroke","none").style("cursor",function(a){return Gg(a)?"pointer":null}),c=aj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)}),b.append("path").attr("class",dd).style("opacity",function(){return gj=+tf.select(this).style("opacity"),0}).style("fill",function(a){return Di(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Di(a)}).style("cursor",function(a){return Gg(a)?"pointer":null}),a.forEach(function(a){aj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=aj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Yf(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Di(a.data)}).style("cursor",function(a){return Gg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Fb(a),d=Lb(c),e=Tb();Nb(c.data.id),jf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Fb(a),c=[Lb(b)];Md(c,tf.mouse(this))}).on("mouseout",function(a,b){var c=Fb(a),d=Lb(c),e=Ub();Ob(c.data.id),lf(),Nd(),e(d,b)}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Pg&&(n=bj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Di(a)}),l=bj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)})),$i.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function cf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Xd(a.id,b.types[a.id]):Xd(a.id,b.type)}),uf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Ni?j:i,l=Ni?Q():P();return d&&(x=0,D=0,u=0,v=0),Sg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Ni?v:u,void(Xg?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Ni?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=cj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Ug?Ug(a):uf.toggle(a)}).on("mouseover",function(a){uf.focus(a),"function"==typeof Vg&&Vg(a)}).on("mouseout",function(a){uf.revert(),"function"==typeof Wg&&Wg(a)}),o.append("text").text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ni?h:-200).attr("y",Ni?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ni?i:-200).attr("y",Ni?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Di(a)}).attr("x",Ni?h:-200).attr("y",Ni?-200:j).attr("width",10).attr("height",10),cj.selectAll("text").data(a).text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),cj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),cj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),N(u),O(v),M(D),n(),R(),_e(),r&&m(q,c)}function pf(a){return Ec(uf.data.targets,a.id)}function qf(a){return"data"in a&&Ec(uf.data.targets,a.data.id)}function rf(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 sf(a,b,c){var d=!be(uf.data.targets);Xd(a,b),af(c||{withTransitionForAxis:d})}var tf=a.d3?a.d3:a.require?a.require("d3"):void 0,uf={data:{},axis:{},legend:{}},vf={},wf=h(["bindto"],"#chart"),xf=h(["size","width"]),yf=h(["size","height"]),zf=h(["padding","left"]),Af=h(["padding","right"]),Bf=h(["zoom","enabled"],!1),Cf=h(["zoom","extent"]),Df=h(["zoom","privileged"],!1),Ef=h(["onenter"],function(){}),Ff=h(["onleave"],function(){}),Gf=h(["onresize"],function(){}),Hf=h(["onresized"],function(){}),If=h(["transition","duration"],350);g("data","data is required in config");var Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg=h(["data","x"]),qg=h(["data","xs"],{}),rg=h(["data","x_format"]),sg=h(["data","id_converter"],function(a){return a}),tg=h(["data","names"],{}),ug=h(["data","classes"],{}),vg=h(["data","groups"],[]),wg=h(["data","axes"],{}),xg=h(["data","type"]),yg=h(["data","types"],{}),zg=h(["data","labels"],{}),Ag=h(["data","order"]),Bg=h(["data","regions"],{}),Cg=h(["data","color"]),Dg=h(["data","colors"],{}),Eg=h(["data","selection","enabled"],!1),Fg=h(["data","selection","grouped"],!1),Gg=h(["data","selection","isselectable"],function(){return!0}),Hg=h(["data","selection","multiple"],!0),Ig=h(["data","onclick"],function(){}),Jg=h(["data","onenter"],function(){}),Kg=h(["data","onleave"],function(){}),Lg=h(["data","onselected"],function(){}),Mg=h(["data","onunselected"],function(){}),Ng=h(["data","ondragstart"],function(){}),Og=h(["data","ondragend"],function(){}),Pg=h(["subchart","show"],!1),Qg=h(["subchart","size","height"],60),Rg=h(["color","pattern"],[]),Sg=h(["legend","show"],!0),Tg=h(["legend","position"],"bottom"),Ug=h(["legend","item","onclick"]),Vg=h(["legend","item","onmouseover"]),Wg=h(["legend","item","onmouseout"]),Xg=h(["legend","equally"],!1),Yg=h(["axis","rotated"],!1),Zg=h(["axis","x","show"],!0),$g=h(["axis","x","type"],"indexed"),_g=h(["axis","x","localtime"],!0),ah=h(["axis","x","categories"],[]),bh=h(["axis","x","tick","centered"],!1),ch=h(["axis","x","tick","format"]),dh=h(["axis","x","tick","culling"],{}),eh=h(["axis","x","tick","culling","max"],10),fh=h(["axis","x","tick","count"]),gh=h(["axis","x","tick","fit"],!0),hh=h(["axis","x","tick","values"],null),ih=h(["axis","x","tick","rotate"]),jh=h(["axis","x","max"],null),kh=h(["axis","x","min"],null),lh=h(["axis","x","padding"],{}),mh=h(["axis","x","height"]),nh=h(["axis","x","default"]),oh=h(["axis","x","label"],{}),ph=h(["axis","y","show"],!0),qh=h(["axis","y","max"]),rh=h(["axis","y","min"]),sh=h(["axis","y","center"]),th=h(["axis","y","label"],{}),uh=h(["axis","y","inner"],!1),vh=h(["axis","y","tick","format"]),wh=h(["axis","y","padding"],{}),xh=h(["axis","y","ticks"],10),yh=h(["axis","y2","show"],!1),zh=h(["axis","y2","max"]),Ah=h(["axis","y2","min"]),Bh=h(["axis","y2","center"]),Ch=h(["axis","y2","label"],{}),Dh=h(["axis","y2","inner"],!1),Eh=h(["axis","y2","tick","format"]),Fh=h(["axis","y2","padding"],{}),Gh=h(["axis","y2","ticks"],10),Hh=h(["grid","x","show"],!1),Ih=h(["grid","x","type"],"tick"),Jh=h(["grid","x","lines"],[]),Kh=h(["grid","y","show"],!1),Lh=h(["grid","y","lines"],[]),Mh=h(["grid","y","ticks"],10),Nh=h(["point","show"],!0),Oh=Nh?h(["point","r"],2.5):0,Ph=h(["point","focus","line","enabled"],!0),Qh=h(["point","focus","expand","enabled"],!0),Rh=h(["point","focus","expand","r"],Qh?4:Oh),Sh=h(["point","focus","select","r"],8),Th=h(["line","connect_null"],!1),Uh=h(["bar","width"]),Vh=h(["bar","width","ratio"],.6),Wh=h(["pie","label","show"],!0),Xh=h(["pie","label","format"]),Yh=h(["pie","expand"],!0),Zh=h(["pie","onclick"],function(){}),$h=h(["pie","onmouseover"],function(){}),_h=h(["pie","onmouseout"],function(){}),ai=h(["donut","label","show"],!0),bi=h(["donut","label","format"]),ci=h(["donut","expand"],!0),di=h(["donut","title"],""),ei=h(["donut","onclick"],function(){}),fi=h(["donut","onmouseover"],function(){}),gi=h(["donut","onmouseout"],function(){}),hi=h(["regions"],[]),ii=h(["tooltip","show"],!0),ji=h(["tooltip","format","title"]),ki=h(["tooltip","format","value"]),li=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ji?ji:b,l=ki?ki: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+""}),mi=h(["tooltip","init","show"],!1),ni=h(["tooltip","init","x"],0),oi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),pi=("string"==typeof wf?wf.replace("#",""):wf.id)+"-clip",qi=pi+"-xaxis",ri=pi+"-yaxis",si=i(pi),ti=i(qi),ui=i(ri),vi="timeseries"===$g,wi="categorized"===$g,xi=!vi&&(pg||te(qg)),yi=null,zi=!1,Ai=!1,Bi=!1,Ci=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Di=ne(Dg,te(Rg)?Rg:Ci,Cg),Ei=_g?tf.time.format:tf.time.format.utc,Fi=function(){var a=[[Ei("%Y/%-m/%-d"),function(){return!0}],[Ei("%-m/%-d"),function(a){return a.getMonth()}],[Ei("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ei("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ei("%I %p"),function(a){return a.getHours()}],[Ei("%I:%M"),function(a){return a.getMinutes()}],[Ei(":%S"),function(a){return a.getSeconds()}],[Ei(".%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)}}(),Gi=[],Hi=[],Ii=Yg?"left":"bottom",Ji=Yg?uh?"top":"bottom":uh?"right":"left",Ki=Yg?Dh?"bottom":"top":Dh?"left":"right",Li=Yg?"left":"bottom",Mi={main:function(){return"translate("+Jf.left+","+Jf.top+")"},context:function(){return"translate("+Kf.left+","+Kf.top+")"},legend:function(){return"translate("+Lf.left+","+Lf.top+")"},x:function(){return"translate(0,"+(Yg?0:Of)+")"},y:function(){return"translate(0,"+(Yg?Of:0)+")"},y2:function(){return"translate("+(Yg?0:Mf)+","+(Yg?1:0)+")"},subx:function(){return"translate(0,"+(Yg?0:Pf)+")"},arc:function(){return"translate("+Mf/2+","+Of/2+")"}},Ni="right"===Tg,Oi=0,Pi=0,Qi=0,Ri=.15,Si=30,Ti=Yg&&!Zg?0:30,Ui=5;Yf=tf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Vi,Wi=function(){var a=tf.svg.line().x(Yg?function(a){return V(a.id)(a.value)}:zd).y(Yg?zd:function(a){return V(a.id)(a.value)});return Th||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Th?De(b.values):b.values;return ce(b)?(a.interpolate(de(b)?"cardinal":"linear"),Bg[b.id]?Pe(e,fg,V(b.id),Bg[b.id]):a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Xi=function(){var a;return a=Yg?tf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(zd):tf.svg.area().x(zd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=De(b.values);return Yd([b],"area")||Yd([b],"area-spline")?(a.interpolate(de(b)?"cardinal":"linear"),a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Yi=function(){var a=tf.svg.line().x(Yg?function(a){return W(a.id)(a.value)}:Cd).y(Yg?Cd:function(a){return W(a.id)(a.value)});return function(b){var c=De(b.values);return ce(b)?a(c):"M "+ig(c[0].x)+" "+W(b.id)(c[0].value)}}(),Zi=function(){};Vi=tf.svg.brush().on("brush",Ye),Vi.update=function(){return bj&&bj.select("."+f.brush).call(this),this},Vi.scale=function(a){return Yg?this.y(a):this.x(a)},Bf&&(Zi=tf.behavior.zoom().on("zoomstart",function(){Zi.altDomain=tf.event.sourceEvent.altKey?fg.orgDomain():null}).on("zoom",Bf?Ze:null),Zi.scale=function(a){return Yg?this.y(a):this.x(a)},Zi.orgScaleExtent=function(){var a=Cf?Cf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},Zi.updateScaleExtent=function(){var a=ac(fg.orgDomain())/ac(fj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var $i,_i,aj,bj,cj,dj,ej,fj,gj,hj={};if(uf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),uf.defocus(),b(d.classed(f.focused,!0)),b(e),be(uf.data.targets)&&Nb(a,!0),jf(a)},uf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),kf(a)},uf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),lf()},uf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),$i.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?mf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},uf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),$i.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?nf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Ri),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},uf.toggle=function(a){Gc(a)?uf.hide(a):uf.show(a)},uf.unzoom=function(){Vi.clear().update(),Xe({withUpdateXDomain:!0})},uf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){ug[b]=a.classes[b]}),"categories"in a&&wi&&(ah=a.categories,lg.categories(ah)),"cacheIds"in a&&bc(a.cacheIds)?void cf(dc(a.cacheIds),a.done):void("unload"in a?ef(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){df(a)}):df(a))},uf.unload=function(a){ef(Dc(a),function(){Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},uf.selected=function(a){return tf.merge(aj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return tf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},uf.select=function(a,b,c){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=tf.select(this),i="circle"===this.nodeName?xe:Ae,j="circle"===this.nodeName?ye:Be,k=Fg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Gg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},uf.unselect=function(a,b){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=tf.select(this),g="circle"===this.nodeName?ye:Be,h=Fg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Gg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},uf.toLine=function(a){sf(a,"line")},uf.toSpline=function(a){sf(a,"spline")},uf.toBar=function(a){sf(a,"bar")},uf.toScatter=function(a){sf(a,"scatter")},uf.toArea=function(a){sf(a,"area")},uf.toAreaSpline=function(a){sf(a,"area-spline")},uf.toPie=function(a){sf(a,"pie",{withTransform:!0})},uf.toDonut=function(a){sf(a,"donut",{withTransform:!0})},uf.groups=function(a){return c(a)?vg:(vg=a,Xe(),vg)},uf.xgrids=function(a){return a?(Jh=a,Xe(),Jh):Jh},uf.xgrids.add=function(a){return a?uf.xgrids(Jh.concat(a)):void 0 -},uf.xgrids.remove=function(a){var b=rf(a);return uf.xgrids(Jh.filter(b))},uf.ygrids=function(a){return a?(Lh=a,Xe(),Lh):Lh},uf.ygrids.add=function(a){return a?uf.ygrids(Lh.concat(a)):void 0},uf.ygrids.remove=function(a){var b=rf(a);return uf.ygrids(Lh.filter(b))},uf.regions=function(a){return c(a)?hi:(hi=a,Xe(),hi)},uf.regions.add=function(a){return c(a)?hi:(hi=hi.concat(a),Xe(),hi)},uf.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;$i.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),hi=hi.filter(function(b){return b.classes.indexOf(a)<0})}),hi},uf.data.get=function(a){var b=uf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},uf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},uf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){tg[b]=a[b]}),of(Cc(uf.data.targets),{withTransition:!0}),tg):tg},uf.x=function(a){return arguments.length&&(qc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.xs=function(a){return arguments.length&&(rc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},uf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(qh=+a.y),b(a.y2)&&(zh=+a.y2)):qh=zh=+a,Xe())},uf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(rh=+a.y),b(a.y2)&&(Ah=+a.y2)):rh=Ah=+a,Xe())},uf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&uf.axis.max(a.max),"undefined"!=typeof a.min&&uf.axis.min(a.min))},uf.legend.show=function(a){Sg||(Sg=!0,cj.style("visibility","visible")),mf(Dc(a)),Xe({withTransitionForHorizontalAxis:!1})},uf.legend.hide=function(a){Sg&&se(a)&&(Sg=!1,cj.style("visibility","hidden")),nf(Dc(a)),Xe({withTransitionForHorizontalAxis:!1})},uf.resize=function(a){xf=a?a.width:null,yf=a?a.height:null,af({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},uf.destroy=function(){uf.data.targets=void 0,uf.data.xs={},ej.html(""),a.onresize=null},"url"in e.data)tf.xhr(e.data.url,function(a,b){var c,d=tf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=tf.csv.parse(b.response),Qe(c)});else if("rows"in e.data)Qe(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Qe(uc(e.data.columns))}return uf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file +}dj.html(li(uf.data.targets.map(function(a){return pc(a.values[ni])}),$(),wd,Di)),dj.style("top",oi.top).style("left",oi.left).style("display","block")}null==a.onresize&&(a.onresize=$e()),a.onresize.add&&(a.onresize.add(Gf),a.onresize.add(function(){af({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})}),a.onresize.add(Hf))}function Re(a){a.append("rect").attr("class",fd).style("cursor",Eg&&Fg?"pointer":null).on("mouseover",function(a,b){if(!zi&&!be(uf.data.targets)){var c,d,e=uf.data.targets.map(function(a){return pc(a.values[b])});if(Object.keys(tg).length>0){d=[];for(var g in tg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Id(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ce,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 Ve(a){be(uf.data.targets)||Eg&&(yi=a,aj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),zi=!0,Ng())}function We(){be(uf.data.targets)||Eg&&(aj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),aj.selectAll("."+f.shape).classed(f.INCLUDED,!1),zi=!1,Og())}function Xe(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Sd(),W=be(uf.data.targets),X=Ic(uf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?If:0,Q=D?P:0,R=E?P:0,c=aj.select("."+f.axisX).style("opacity",W?0:1),g=aj.select("."+f.axisY).style("opacity",W?0:1),h=aj.select("."+f.axisY2).style("opacity",W?0:1),e=bj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Sg&&of(Cc(uf.data.targets),a,O),wi&&(0===X.length||!H||G)&&fg.domain([0,c.selectAll(".tick").size()]),X.length&&(H&&(fg.domain(tf.extent(_b(X))),fj=fg.domain(),Bf&&Zi.scale(fg).updateScaleExtent(),ig.domain(fg.domain()),Vi.scale(ig)),G&&(fg.domain(Vi.empty()?fj:Vi.extent()),Bf&&Zi.scale(fg).updateScaleExtent())),gg.domain(Xb(X,"y")),hg.domain(Xb(X,"y2")),(gh||fh)&&(S=hh?hh:Kc(Jc(X)),lg.tickValues(S),og.tickValues(S)),O.axisX.call(lg),O.axisY.call(mg),O.axisY2.call(ng),O.axisSubX.call(og),G)if(dh&&S){for(T=1;T=0&&tf.select(this).style("display",b%U?"none":"block")})}else tf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!Yg&&ih&&eb(c),J=Ke(V),M=Le(V,!0),N=Le(V,!1),Db(),jg.domain(gg.domain()),kg.domain(hg.domain()),dj.style("display","none"),o(),aj.select("line."+f.xgridFocus).style("visibility","hidden"),Hh){if("year"===Ih){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=fg.ticks(10);i=aj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",Yg?0:function(a){return fg(a)-lg.tickOffset()}).attr("x2",Yg?Mf:function(a){return fg(a)-lg.tickOffset()}).attr("y1",Yg?function(a){return fg(a)-lg.tickOffset()}:Jf.top).attr("y2",Yg?function(a){return fg(a)-lg.tickOffset()}:Of).style("opacity",function(){return+tf.select(this).attr(Yg?"y1":"x1")===(Yg?Of:0)?0:1}),i.exit().remove()}te(Jh)&&(k=aj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Jh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",Yg?"":"rotate(-90)").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",Yg?0:Ad).attr("x2",Yg?Mf:Ad).attr("y1",Yg?Ad:Jf.top).attr("y2",Yg?Ad:Of).style("opacity",1),k.select("text").transition().duration(P).attr("x",Yg?Mf:0).attr("y",Ad).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Kh&&(m=aj.select("."+f.ygrids).selectAll("."+f.ygrid).data(gg.ticks(Mh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",Yg?gg:0).attr("x2",Yg?gg:Mf).attr("y1",Yg?0:gg).attr("y2",Yg?Of:gg),m.exit().remove()),A&&te(Lh)&&(n=aj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Lh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",Yg?"rotate(-90)":"").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",Yg?Bd:0).attr("x2",Yg?Bd:Mf).attr("y1",Yg?0:Bd).attr("y2",Yg?Of:Bd).style("opacity",1),n.select("text").transition().duration(P).attr("x",Yg?0:Mf).attr("y",Bd).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=aj.select("."+f.regions).selectAll("rect."+f.region).data(hi),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=aj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Di(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=aj.selectAll("."+f.texts).selectAll("."+f.text).data(le),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return Yg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return yd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),aj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",Wi).style("opacity",1),aj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",Xi).style("opacity",gj),q=aj.selectAll("."+f.circles).selectAll("."+f.circle).data(ke),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Oh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),q.exit().remove(),aj.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=tf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1),aj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&ie(a.data)?1:0}),aj.select("."+f.chartArcsTitle).style("opacity",ae(uf.data.targets)?1:0),Pg&&(null!==tf.event&&"zoom"===tf.event.type&&Vi.extent(fg.orgDomain()).update(),B&&(!Yg&&ih&&eb(e),Vi.empty()||Vi.extent(fg.orgDomain()).update(),K=Ke(V,!0),u=bj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Di(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),bj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",Yi).style("opacity",1))),aj.selectAll("."+f.selectedCircles).filter(function(a){return ee(a)}).selectAll("circle").remove(),aj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),v=aj.select("."+f.eventRects),te(qg)&&!oc(qg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Se(w.enter()),w.attr("x",0).attr("y",0).attr("width",Mf).attr("height",Of)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),xi&&!wi?(z=function(a,b){var c=xc(b),d=yc(b),e=uf.data.xs[a.id][b];return(fg(d?d:e+50)-fg(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=uf.data.xs[a.id][b];return(fg(d)+fg(c?c:d-50))/2}):(z=L(),y=function(a){return fg(a.x)-z/2}),x=Ac(uf.data.targets),aj.select("."+f.eventRects).datum(x?x.values:[]),w=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Re(w.enter()),w.attr("class",fd).attr("x",Yg?0:y).attr("y",Yg?y:0).attr("width",Yg?Mf:z).attr("height",Yg?z:Of),w.exit().remove()),Cc(uf.data.targets).forEach(function(a){hj[a]=!0})}function Ye(){Xe({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ze(){return"mousemove"===tf.event.sourceEvent.type&&Zi.altDomain?(fg.domain(Zi.altDomain),void Zi.scale(fg).updateScaleExtent()):(wi&&fg.orgDomain()[0]===fj[0]&&fg.domain([fj[0]-1e-10,fg.orgDomain()[1]]),Xe({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===tf.event.sourceEvent.type&&(Ai=!0)))}function $e(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function _e(){$i.attr("width",Qf).attr("height",Rf),$i.select("#"+pi).select("rect").attr("width",Mf).attr("height",Of),$i.select("#"+qi).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),$i.select("#"+ri).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),$i.select("."+f.zoomRect).attr("width",Mf).attr("height",Of),ej.style("max-height",Rf+"px")}function af(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),_e(),m(a.withTransition),Xe(a)}function bf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=aj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Di(a)}),e=aj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("fill",function(a){return Di(a)}).style("stroke","none").style("cursor",function(a){return Gg(a)?"pointer":null}),c=aj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)}),b.append("path").attr("class",dd).style("opacity",function(){return gj=+tf.select(this).style("opacity"),0}).style("fill",function(a){return Di(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Di(a)}).style("cursor",function(a){return Gg(a)?"pointer":null}),a.forEach(function(a){aj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=aj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Yf(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Di(a.data)}).style("cursor",function(a){return Gg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Fb(a),d=Lb(c),e=Tb();Nb(c.data.id),jf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Fb(a),c=[Lb(b)];Md(c,tf.mouse(this))}).on("mouseout",function(a,b){var c=Fb(a),d=Lb(c),e=Ub();Ob(c.data.id),lf(),Nd(),e(d,b)}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Pg&&(n=bj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Di(a)}),l=bj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)})),$i.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function cf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Xd(a.id,b.types[a.id]):Xd(a.id,b.type)}),uf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Ni?j:i,l=Ni?Q():P();return d&&(x=0,D=0,u=0,v=0),Sg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Ni?v:u,void(Xg?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Ni?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=cj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Ug?Ug(a):uf.toggle(a)}).on("mouseover",function(a){uf.focus(a),"function"==typeof Vg&&Vg(a)}).on("mouseout",function(a){uf.revert(),"function"==typeof Wg&&Wg(a)}),o.append("text").text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ni?h:-200).attr("y",Ni?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ni?i:-200).attr("y",Ni?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Di(a)}).attr("x",Ni?h:-200).attr("y",Ni?-200:j).attr("width",10).attr("height",10),cj.selectAll("text").data(a).text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),cj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),cj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),N(u),O(v),M(D),n(),R(),_e(),r&&m(q,c)}function pf(a){return Ec(uf.data.targets,a.id)}function qf(a){return"data"in a&&Ec(uf.data.targets,a.data.id)}function rf(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 sf(a,b,c){var d=!be(uf.data.targets);Xd(a,b),af(c||{withTransitionForAxis:d})}var tf=a.d3?a.d3:a.require?a.require("d3"):void 0,uf={data:{},axis:{},legend:{}},vf={},wf=h(["bindto"],"#chart"),xf=h(["size","width"]),yf=h(["size","height"]),zf=h(["padding","left"]),Af=h(["padding","right"]),Bf=h(["zoom","enabled"],!1),Cf=h(["zoom","extent"]),Df=h(["zoom","privileged"],!1),Ef=h(["onenter"],function(){}),Ff=h(["onleave"],function(){}),Gf=h(["onresize"],function(){}),Hf=h(["onresized"],function(){}),If=h(["transition","duration"],350);g("data","data is required in config");var Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg=h(["data","x"]),qg=h(["data","xs"],{}),rg=h(["data","x_format"]),sg=h(["data","id_converter"],function(a){return a}),tg=h(["data","names"],{}),ug=h(["data","classes"],{}),vg=h(["data","groups"],[]),wg=h(["data","axes"],{}),xg=h(["data","type"]),yg=h(["data","types"],{}),zg=h(["data","labels"],{}),Ag=h(["data","order"]),Bg=h(["data","regions"],{}),Cg=h(["data","color"]),Dg=h(["data","colors"],{}),Eg=h(["data","selection","enabled"],!1),Fg=h(["data","selection","grouped"],!1),Gg=h(["data","selection","isselectable"],function(){return!0}),Hg=h(["data","selection","multiple"],!0),Ig=h(["data","onclick"],function(){}),Jg=h(["data","onenter"],function(){}),Kg=h(["data","onleave"],function(){}),Lg=h(["data","onselected"],function(){}),Mg=h(["data","onunselected"],function(){}),Ng=h(["data","ondragstart"],function(){}),Og=h(["data","ondragend"],function(){}),Pg=h(["subchart","show"],!1),Qg=h(["subchart","size","height"],60),Rg=h(["color","pattern"],[]),Sg=h(["legend","show"],!0),Tg=h(["legend","position"],"bottom"),Ug=h(["legend","item","onclick"]),Vg=h(["legend","item","onmouseover"]),Wg=h(["legend","item","onmouseout"]),Xg=h(["legend","equally"],!1),Yg=h(["axis","rotated"],!1),Zg=h(["axis","x","show"],!0),$g=h(["axis","x","type"],"indexed"),_g=h(["axis","x","localtime"],!0),ah=h(["axis","x","categories"],[]),bh=h(["axis","x","tick","centered"],!1),ch=h(["axis","x","tick","format"]),dh=h(["axis","x","tick","culling"],{}),eh=h(["axis","x","tick","culling","max"],10),fh=h(["axis","x","tick","count"]),gh=h(["axis","x","tick","fit"],!0),hh=h(["axis","x","tick","values"],null),ih=h(["axis","x","tick","rotate"]),jh=h(["axis","x","max"],null),kh=h(["axis","x","min"],null),lh=h(["axis","x","padding"],{}),mh=h(["axis","x","height"]),nh=h(["axis","x","default"]),oh=h(["axis","x","label"],{}),ph=h(["axis","y","show"],!0),qh=h(["axis","y","max"]),rh=h(["axis","y","min"]),sh=h(["axis","y","center"]),th=h(["axis","y","label"],{}),uh=h(["axis","y","inner"],!1),vh=h(["axis","y","tick","format"]),wh=h(["axis","y","padding"],{}),xh=h(["axis","y","ticks"],10),yh=h(["axis","y2","show"],!1),zh=h(["axis","y2","max"]),Ah=h(["axis","y2","min"]),Bh=h(["axis","y2","center"]),Ch=h(["axis","y2","label"],{}),Dh=h(["axis","y2","inner"],!1),Eh=h(["axis","y2","tick","format"]),Fh=h(["axis","y2","padding"],{}),Gh=h(["axis","y2","ticks"],10),Hh=h(["grid","x","show"],!1),Ih=h(["grid","x","type"],"tick"),Jh=h(["grid","x","lines"],[]),Kh=h(["grid","y","show"],!1),Lh=h(["grid","y","lines"],[]),Mh=h(["grid","y","ticks"],10),Nh=h(["point","show"],!0),Oh=Nh?h(["point","r"],2.5):0,Ph=h(["point","focus","line","enabled"],!0),Qh=h(["point","focus","expand","enabled"],!0),Rh=h(["point","focus","expand","r"],Qh?4:Oh),Sh=h(["point","focus","select","r"],8),Th=h(["line","connect_null"],!1),Uh=h(["bar","width"]),Vh=h(["bar","width","ratio"],.6),Wh=h(["pie","label","show"],!0),Xh=h(["pie","label","format"]),Yh=h(["pie","expand"],!0),Zh=h(["pie","onclick"],function(){}),$h=h(["pie","onmouseover"],function(){}),_h=h(["pie","onmouseout"],function(){}),ai=h(["donut","label","show"],!0),bi=h(["donut","label","format"]),ci=h(["donut","expand"],!0),di=h(["donut","title"],""),ei=h(["donut","onclick"],function(){}),fi=h(["donut","onmouseover"],function(){}),gi=h(["donut","onmouseout"],function(){}),hi=h(["regions"],[]),ii=h(["tooltip","show"],!0),ji=h(["tooltip","format","title"]),ki=h(["tooltip","format","value"]),li=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ji?ji:b,l=ki?ki: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+""}),mi=h(["tooltip","init","show"],!1),ni=h(["tooltip","init","x"],0),oi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),pi=("string"==typeof wf?wf.replace("#",""):wf.id)+"-clip",qi=pi+"-xaxis",ri=pi+"-yaxis",si=i(pi),ti=i(qi),ui=i(ri),vi="timeseries"===$g,wi="categorized"===$g,xi=!vi&&(pg||te(qg)),yi=null,zi=!1,Ai=!1,Bi=!1,Ci=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Di=ne(Dg,te(Rg)?Rg:Ci,Cg),Ei=_g?tf.time.format:tf.time.format.utc,Fi=function(){var a=[[Ei("%Y/%-m/%-d"),function(){return!0}],[Ei("%-m/%-d"),function(a){return a.getMonth()}],[Ei("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ei("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ei("%I %p"),function(a){return a.getHours()}],[Ei("%I:%M"),function(a){return a.getMinutes()}],[Ei(":%S"),function(a){return a.getSeconds()}],[Ei(".%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)}}(),Gi=[],Hi=[],Ii=Yg?"left":"bottom",Ji=Yg?uh?"top":"bottom":uh?"right":"left",Ki=Yg?Dh?"bottom":"top":Dh?"left":"right",Li=Yg?"left":"bottom",Mi={main:function(){return"translate("+Jf.left+","+Jf.top+")"},context:function(){return"translate("+Kf.left+","+Kf.top+")"},legend:function(){return"translate("+Lf.left+","+Lf.top+")"},x:function(){return"translate(0,"+(Yg?0:Of)+")"},y:function(){return"translate(0,"+(Yg?Of:0)+")"},y2:function(){return"translate("+(Yg?0:Mf)+","+(Yg?1:0)+")"},subx:function(){return"translate(0,"+(Yg?0:Pf)+")"},arc:function(){return"translate("+Mf/2+","+Of/2+")"}},Ni="right"===Tg,Oi=0,Pi=0,Qi=0,Ri=.15,Si=30,Ti=Yg&&!Zg?0:30,Ui=5;Yf=tf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Vi,Wi=function(){var a=tf.svg.line().x(Yg?function(a){return V(a.id)(a.value)}:zd).y(Yg?zd:function(a){return V(a.id)(a.value)});return Th||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Th?De(b.values):b.values;return ce(b)?(a.interpolate(de(b)?"cardinal":"linear"),Bg[b.id]?Pe(e,fg,V(b.id),Bg[b.id]):a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Xi=function(){var a;return a=Yg?tf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(zd):tf.svg.area().x(zd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=De(b.values);return Yd([b],"area")||Yd([b],"area-spline")?(a.interpolate(de(b)?"cardinal":"linear"),a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Yi=function(){var a=tf.svg.line().x(Yg?function(a){return W(a.id)(a.value)}:Cd).y(Yg?Cd:function(a){return W(a.id)(a.value)});return function(b){var c=De(b.values);return ce(b)?a(c):"M "+ig(c[0].x)+" "+W(b.id)(c[0].value)}}(),Zi=function(){};Vi=tf.svg.brush().on("brush",Ye),Vi.update=function(){return bj&&bj.select("."+f.brush).call(this),this},Vi.scale=function(a){return Yg?this.y(a):this.x(a)},Bf&&(Zi=tf.behavior.zoom().on("zoomstart",function(){Zi.altDomain=tf.event.sourceEvent.altKey?fg.orgDomain():null}).on("zoom",Bf?Ze:null),Zi.scale=function(a){return Yg?this.y(a):this.x(a)},Zi.orgScaleExtent=function(){var a=Cf?Cf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},Zi.updateScaleExtent=function(){var a=ac(fg.orgDomain())/ac(fj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var $i,_i,aj,bj,cj,dj,ej,fj,gj,hj={};if(uf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),uf.defocus(),b(d.classed(f.focused,!0)),b(e),be(uf.data.targets)&&Nb(a,!0),jf(a)},uf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),kf(a)},uf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),lf()},uf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),$i.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?mf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},uf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),$i.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?nf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Ri),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},uf.toggle=function(a){Gc(a)?uf.hide(a):uf.show(a)},uf.unzoom=function(){Vi.clear().update(),Xe({withUpdateXDomain:!0})},uf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){ug[b]=a.classes[b]}),"categories"in a&&wi&&(ah=a.categories,lg.categories(ah)),"cacheIds"in a&&bc(a.cacheIds)?void cf(dc(a.cacheIds),a.done):void("unload"in a?ef(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){df(a)}):df(a))},uf.unload=function(a){ef(Dc(a),function(){Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},uf.selected=function(a){return tf.merge(aj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return tf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},uf.select=function(a,b,c){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=tf.select(this),i="circle"===this.nodeName?xe:Ae,j="circle"===this.nodeName?ye:Be,k=Fg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Gg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},uf.unselect=function(a,b){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=tf.select(this),g="circle"===this.nodeName?ye:Be,h=Fg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Gg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},uf.toLine=function(a){sf(a,"line")},uf.toSpline=function(a){sf(a,"spline")},uf.toBar=function(a){sf(a,"bar")},uf.toScatter=function(a){sf(a,"scatter")},uf.toArea=function(a){sf(a,"area")},uf.toAreaSpline=function(a){sf(a,"area-spline")},uf.toPie=function(a){sf(a,"pie",{withTransform:!0})},uf.toDonut=function(a){sf(a,"donut",{withTransform:!0})},uf.groups=function(a){return c(a)?vg:(vg=a,Xe(),vg)},uf.xgrids=function(a){return a?(Jh=a,Xe(),Jh):Jh},uf.xgrids.add=function(a){return a?uf.xgrids(Jh.concat(a)):void 0},uf.xgrids.remove=function(a){var b=rf(a);return uf.xgrids(Jh.filter(b))},uf.ygrids=function(a){return a?(Lh=a,Xe(),Lh):Lh},uf.ygrids.add=function(a){return a?uf.ygrids(Lh.concat(a)):void 0 +},uf.ygrids.remove=function(a){var b=rf(a);return uf.ygrids(Lh.filter(b))},uf.regions=function(a){return c(a)?hi:(hi=a,Xe(),hi)},uf.regions.add=function(a){return c(a)?hi:(hi=hi.concat(a),Xe(),hi)},uf.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;$i.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),hi=hi.filter(function(b){return b.classes.indexOf(a)<0})}),hi},uf.data.get=function(a){var b=uf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},uf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},uf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){tg[b]=a[b]}),of(Cc(uf.data.targets),{withTransition:!0}),tg):tg},uf.x=function(a){return arguments.length&&(qc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.xs=function(a){return arguments.length&&(rc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},uf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(qh=+a.y),b(a.y2)&&(zh=+a.y2)):qh=zh=+a,Xe())},uf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(rh=+a.y),b(a.y2)&&(Ah=+a.y2)):rh=Ah=+a,Xe())},uf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&uf.axis.max(a.max),"undefined"!=typeof a.min&&uf.axis.min(a.min))},uf.legend.show=function(a){Sg||(Sg=!0,cj.style("visibility","visible")),mf(Dc(a)),Xe({withLegend:!0})},uf.legend.hide=function(a){nf(Dc(a)),Xe({withLegend:!0}),Sg&&se(a)&&(Sg=!1,cj.style("visibility","hidden"))},uf.resize=function(a){xf=a?a.width:null,yf=a?a.height:null,af({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},uf.destroy=function(){uf.data.targets=void 0,uf.data.xs={},ej.html(""),a.onresize=null},"url"in e.data)tf.xhr(e.data.url,function(a,b){var c,d=tf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=tf.csv.parse(b.response),Qe(c)});else if("rows"in e.data)Qe(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Qe(uc(e.data.columns))}return uf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 18021443c354fca6c7809da81b447ede971a935e Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Sun, 27 Apr 2014 16:30:51 +0900 Subject: [PATCH 070/178] Fix subchart bug --- c3.js | 3 +-- c3.min.js | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/c3.js b/c3.js index 66209db..5b1c6f0 100644 --- a/c3.js +++ b/c3.js @@ -2717,8 +2717,7 @@ // Define g for chart area context.append('g') .attr("clip-path", clipPath) - .attr('class', CLASS.chart) - .attr("display", "none"); + .attr('class', CLASS.chart); // Define g for bar chart area context.select('.' + CLASS.chart).append("g") diff --git a/c3.min.js b/c3.min.js index 660a1d4..cc87211 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.32"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cMf&&(Mf=0),0>Of&&(Of=0),Nf=Yg?Jf.left-Si-Ti:Mf,Pf=Yg?Of:Rf-Kf.top-Kf.bottom,0>Nf&&(Nf=0),0>Pf&&(Pf=0),p(),Ni&&be(uf.data.targets)&&(Lf.left=Mf/2+Tf)}function o(){aj.select("line."+f.xgridFocus).attr("x1",Yg?0:-10).attr("x2",Yg?Mf:-10).attr("y1",Yg?-10:Jf.top).attr("y2",Yg?-10:Of)}function p(){Tf=Of/2,Sf=.95*Tf,Uf=ae(uf.data.targets)?.6*Sf:0}function q(){var a=Yg?f.axisX:f.axisY,b=tf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=tf.select(wf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return xf?xf:x()}function s(){var a=yf?yf:y();return a>0?a:320}function t(){return be(uf.data.targets)?0:zf?zf:Yg?Zg?v("x"):1:!ph||uh?1:v("y")}function u(){var a=1;return be(uf.data.targets)?0:Af?Af:Ni?P()+(yh&&!Yg?v("y2"):a):yh?Dh||Yg?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||Zg?"x"===a&&mh?mh:"y"!==a||ph?"y2"!==a||yh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Ui:Sg&&!Ni?10:1:0}function x(){return+tf.select(wf).style("width").replace("px","")}function y(){return+tf.select(wf).style("height").replace("px","")}function z(a){return a?-5:-(Jf.left-1)}function A(a){return a?-20:-4}function B(){return z(!Yg)}function C(){return A(!Yg)}function D(){return z(Yg)}function E(){return A(Yg)}function F(a){return a?Mf+2+4:Jf.left+20}function G(a){return a?(mh?mh:0)+80:Of+8}function H(){return F(!Yg)}function I(){return G(!Yg)}function J(){return F(Yg)}function K(){return G(Yg)}function L(){var a=Ac(uf.data.targets),b=a.values[0],c=a.values[a.values.length-1],d=fg(c.x)-fg(b.x),e=zc(),f=Zd(uf.data.targets)?(e-(wi?.25:1))/e:1;return e>1?d*f/(e-1):d}function M(a){Oi=a}function N(a){Pi=a}function O(a){Qi=a}function P(){return Sg?Ni?Pi*(Oi+1):Qf:0}function Q(){return Sg?Ni?Rf:Qi*(Oi+1):0}function R(){var a,b=!fg;Zf=Yg?1:0,$f=Yg?Of:Mf,_f=Yg?0:Of,ag=Yg?Mf:1,bg=Zf,cg=$f,dg=Yg?0:Pf,eg=Yg?Nf:1,fg=T(Zf,$f,b?void 0:fg.domain(),function(){return lg.tickOffset()}),gg=U(_f,ag,b?void 0:gg.domain()),hg=U(_f,ag,b?void 0:hg.domain()),ig=T(Zf,$f,fj,function(a){return a%1?0:og.tickOffset()}),jg=U(dg,eg,b?void 0:jg.domain()),kg=U(dg,eg,b?void 0:kg.domain()),a=$(),lg=X(fg,Ii,a),og=X(ig,Li,a),mg=Y(gg,Ji,vh,xh),ng=Y(hg,Ki,Eh,Gh),b||(Vi.scale(ig),Bf&&Zi.scale(fg)),S()}function S(){Vf=Gb(),Wf=Hb(),Xf=Hb(.98)}function T(a,b,d,e){var f=(vi?tf.time.scale():tf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),wi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=tf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?hg:gg}function W(a){return"y2"===Z(a)?kg:jg}function X(a,b,c){var d=(wi?Eb():tf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),wi?(d.tickCentered(bh),se(dh)&&(dh=!1)):d.tickOffset=function(){var a=Bc(uf.data.targets),b=fg(a[1])-fg(a[0]);return b/zc()/2},wi&&d.categories(ah),d}function Y(a,b,c,d){return tf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in wg?wg[a]:"y"}function $(){var a=vi?Fi:wi?Tc:function(a){return 0>a?a.toFixed(0):a};return ch&&("function"==typeof ch?a=ch:vi&&(a=function(a){return a?Ei(ch)(a):""})),a}function _(a){var b;return"y"===a?b=th:"y2"===a?b=Ch:"x"===a&&(b=oh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?th=b:"y2"===a?Ch=b:"x"===a&&(oh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a){a.selectAll(".tick text").attr("y",db(ih)).attr("x",cb(ih)).attr("transform","rotate("+ih+")").style("text-anchor","start")}function fb(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 gb(){return fb("x",Yg?"inner-top":"inner-right")}function hb(){return fb("y",Yg?"inner-right":"inner-top")}function ib(){return fb("y2",Yg?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Mf/2:Mf:b.isBottom?-Of:b.isMiddle?-Of/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!Yg,gb())}function rb(){return nb(Yg,hb())}function sb(){return nb(Yg,ib())}function tb(){return ob(!Yg,gb())}function ub(){return ob(Yg,hb())}function vb(){return ob(Yg,ib())}function wb(){var a=gb();return Yg?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":mh?mh-10:"3em"}function xb(){var a=hb();return Yg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return Yg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!Yg,gb())}function Ab(){return pb(Yg,hb())}function Bb(){return pb(Yg,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return tf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?30:b}function Db(){aj.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),aj.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),aj.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 tf.min(Object.keys(i).map(function(a){return tf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(vg.length>0)for(g=Sc(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 tf.max(Object.keys(i).map(function(a){return tf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Ah:rh,n="y2"===c?zh:qh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Bh:sh,r=ud()&&Yg;return 0===l.length?"y2"===c?hg.domain():gg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(gg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&wh&&(f=b(wh.top)?wh.top:e,g=b(wh.bottom)?wh.bottom:e),"y2"===c&&Fh&&(f=b(Fh.top)?Fh.top:e,g=b(Fh.bottom)?Fh.bottom:e),Zd(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return kh?vi?oe(kh):kh:tf.min(a,function(a){return tf.min(a.values,function(a){return a.x})})}function Zb(a){return jh?vi?oe(jh):jh:tf.max(a,function(a){return tf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return wi?d=0:Zd(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof lh&&te(lh)?(e=b(lh.left)?lh.left:d,f=b(lh.right)?lh.right:d):e=f="number"==typeof lh?lh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?gg:hg;return b="y"===a.axis||"y2"===a.axis?Yg?Of:"start"in a?d(a.start):Of:Yg?"end"in a?fg(vi?oe(a.end):a.end):Of:Of,c>b?0:b-c}function ic(a){return pg&&a===pg||te(qg)&&ue(qg,a)}function jc(a){return!ic(a)}function kc(a){return pg?pg:te(qg)?qg[a]:null}function lc(a,b){var c,d=b&&te(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=uf.data.xs[b])}),c}function mc(a,b){return a in uf.data.xs&&uf.data.xs[a]&&uf.data.xs[a][b]?uf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){qg[b]=a[b]})}function oc(a){return 1===tf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=tg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),uf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=vi?a?a instanceof Date?a:oe(a):oe(mc(c,d)):xi&&!wi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?uf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):pg?(d=Object.keys(uf.data.xs),uf.data.xs[c]=d.length>0?uf.data.xs[d[0]]:void 0):te(qg)&&(uf.data.xs[c]=lc(f,uf.data.targets)):uf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!uf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=sg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return xi&&wi&&0===c&&g&&(0===e&&(ah=[]),ah.push(g)),("undefined"==typeof a[b]||uf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),xg&&Xd(Cc(c).filter(function(a){return!(a in yg)}),xg),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&uf.data.targets[0].values[a-1]?uf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(uf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(vi?new Date(h):h);i.push(d)}return vi||(i=i.sort(function(a,b){return a-b})),i}function Lc(a){Gi=Gi.concat(a)}function Mc(a){Gi=Gi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Hi=Hi.concat(a)}function Oc(a){Hi=Hi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Dd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Dd(a,g))),Gd(e,b)):Ed(a,b,f,g)}function Fd(a,b){var c;return c=a.map(function(a){return Ed(a.values,b)}),Gd(c,b)}function Gd(a,b){var c,d;return a.forEach(function(a){var e=ve(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Hd(a,b){return tf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Id(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 Jd(){return Ag&&"desc"===Ag.toLowerCase()}function Kd(){return Ag&&"asc"===Ag.toLowerCase()}function Ld(a){var b=Kd(),c=Jd();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 Ag&&a.sort(Ag),a}function Md(a,c){var d,e,f,g,h,i,j,k=be(uf.data.targets),l=k?xd:wd,m=a.filter(function(a){return a&&b(a.value)});ii&&0!==m.length&&(dj.html(li(a,$(),l,Di)).style("display","block"),d=dj.property("offsetWidth"),e=dj.property("offsetHeight"),k?(g=Mf/2+c[0],i=Of/2+c[1]+20):(Yg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=fg(m[0].x)+20):(f=q(),g=f+t()+fg(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),dj.style("top",i+"px").style("left",g+"px"))}function Nd(){dj.style("display","none")}function Od(a){var c=a.filter(function(a){return a&&b(a.value)});ii&&($d(uf.data.targets)||be(uf.data.targets)||aj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Yg?"y1":"x1",zd).attr(Yg?"y2":"x2",zd))}function Pd(){aj.select("line."+f.xgridFocus).style("visibility","hidden")}function Qd(a){return a.x||0===a.x?fg(a.x):null}function Rd(a){return V(a.id)(a.value)}function Sd(){var a,b,d={},e=0;return Ic(Fc(ee)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Wd(a,b){return Uh?Uh:b?2*a.tickOffset()*Vh/b:0}function Xd(a,b){Dc(a).forEach(function(a){hj[a]=b===yg[a],yg[a]=b})}function Yd(a,b){var c=!1;return a.forEach(function(a){yg[a.id]===b&&(c=!0),a.id in yg||"line"!==b||(c=!0)}),c}function Zd(a){return Yd(a,"bar")}function $d(a){return Yd(a,"scatter")}function _d(a){return Yd(a,"pie")}function ae(a){return Yd(a,"donut")}function be(a){return _d(a)||ae(a)}function ce(a){var b="string"==typeof a?a:a.id;return!(b in yg)||"line"===yg[b]||"spline"===yg[b]||"area"===yg[b]||"area-spline"===yg[b]}function de(a){var b="string"==typeof a?a:a.id;return"spline"===yg[b]||"area-spline"===yg[b]}function ee(a){var b="string"==typeof a?a:a.id;return"bar"===yg[b]}function fe(a){var b="string"==typeof a?a:a.id;return"scatter"===yg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"pie"===yg[b]}function he(a){var b="string"==typeof a?a:a.id;return"donut"===yg[b]}function ie(a){return ge(a)||he(a)}function je(a){return ee(a)?a.values:[]}function ke(a){return ce(a)||fe(a)?a.values:[]}function le(a){return ee(a)||ce(a)?a.values:[]}function me(a){return he(a)&&ci||ge(a)&&Yh}function ne(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function oe(b){var c;try{c=rg?tf.time.format(rg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+rg)}return c}function pe(a,b){var c=tf.mouse(a),d=tf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function ue(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ve(a,b){var c="y"===Z(a.id)?gg:hg,d=Yg?1:0,e=Yg?0:1;return Math.pow(fg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function we(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function xe(a,b,c){Lg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd).attr("stroke",function(){return Di(b)}).attr("r",1.4*Sh).transition().duration(100).attr("r",Sh)}function ye(a,b,c){Mg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ze(a,b,c,d){a?xe(b,c,d):ye(b,c,d)}function Ae(a,b){Lg(b,a.node()),a.transition().duration(100).style("fill",function(){return tf.rgb(Di(b)).darker(1)})}function Be(a,b){Mg(b,a.node()),a.transition().duration(100).style("fill",function(){return Di(b)})}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a){return a.filter(function(a){return b(a.value)})}function Ee(a,c){return(c?aj.selectAll("."+f.circles+ld(c)):aj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Fe(a,b){Ee(a,b).classed(f.EXPANDED,!0).attr("r",Rh)}function Ge(a){Ee(a).filter(function(){return tf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oh)}function He(a){return aj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ie(a){He(a).classed(f.EXPANDED,!0)}function Je(a){He(a).classed(f.EXPANDED,!1)}function Ke(a,b){var c=Oe(a,b);return function(a,b){var d=c(a,b),e=Yg?1:0,f=Yg?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 Le(a,b){var c=Oe(a,!1),d=b?Me:Ne;return function(a,b){return d(c(a,b),a,this)}}function Me(a,b){var c;return Yg?(c=ee(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ne(a,b,c){var d=c.getBoundingClientRect();return Yg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ee(b)?-3:-6)}function Oe(a,b){var c=a.__max__+1,d=Wd(lg,c),e=Td(d,c,a,!!b),f=Ud(!!b),g=Vd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Yg&&(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 Pe(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 Qe(b){var c,d,e;if(ej=tf.select(wf),ej.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ej.html(""),ej.classed("c3",!0),uf.data.xs={},uf.data.targets=vc(b),n(),R(),fg.domain(tf.extent(_b(uf.data.targets))),gg.domain(Xb(uf.data.targets,"y")),hg.domain(Xb(uf.data.targets,"y2")),ig.domain(fg.domain()),jg.domain(gg.domain()),kg.domain(hg.domain()),fj=fg.domain(),Vi.scale(ig),Bf&&Zi.scale(fg),$i=ej.append("svg").attr("width",Mf+Jf.left+Jf.right).attr("height",Of+Jf.top+Jf.bottom).on("mouseenter",Ef).on("mouseleave",Ff),_i=$i.append("defs"),_i.append("clipPath").attr("id",pi).append("rect").attr("width",Mf).attr("height",Of),_i.append("clipPath").attr("id",qi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),_i.append("clipPath").attr("id",ri).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),aj=$i.append("g").attr("transform",Mi.main),bj=$i.append("g").attr("transform",Mi.context),cj=$i.append("g").attr("transform",Mi.legend),Pg||bj.style("visibility","hidden"),Sg||(cj.style("visibility","hidden"),Hi=Cc(uf.data.targets)),dj=tf.select(wf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),of(Cc(uf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Zg&&aj.append("g").attr("class",f.axisX).attr("clip-path",ti).attr("transform",Mi.x).append("text").attr("class",f.axisXLabel).attr("transform",Yg?"rotate(-90)":"").style("text-anchor",zb),ph&&aj.append("g").attr("class",f.axisY).attr("clip-path",ui).attr("transform",Mi.y).append("text").attr("class",f.axisYLabel).attr("transform",Yg?"":"rotate(-90)").style("text-anchor",Ab),yh&&aj.append("g").attr("class",f.axisY2).attr("transform",Mi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Yg?"":"rotate(-90)").style("text-anchor",Bb),d=aj.append("g").attr("clip-path",si).attr("class",f.grid),Hh&&d.append("g").attr("class",f.xgrids),te(Jh)&&d.append("g").attr("class",f.xgridLines),Ph&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Kh&&d.append("g").attr("class",f.ygrids),te(Lh)&&d.append("g").attr("class",f.ygridLines),aj.append("g").attr("clip-path",si).attr("class",f.regions),aj.append("g").attr("clip-path",si).attr("class",f.chart),c=aj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Bf?Yg?"ns-resize":"ew-resize":null),aj.select("."+f.chart).append("g").attr("class",f.chartBars),aj.select("."+f.chart).append("g").attr("class",f.chartLines),aj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Mi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),aj.select("."+f.chart).append("g").attr("class",f.chartTexts),Bf&&aj.insert("rect",Df?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Mf).attr("height",Of).style("opacity",0).style("cursor",Yg?"ns-resize":"ew-resize").call(Zi).on("dblclick.zoom",null),nh&&Vi.extent("function"!=typeof nh?nh:nh(_b())),bj.append("g").attr("clip-path",si).attr("class",f.chart).attr("display","none"),bj.select("."+f.chart).append("g").attr("class",f.chartBars),bj.select("."+f.chart).append("g").attr("class",f.chartLines),bj.append("g").attr("clip-path",si).attr("class",f.brush).call(Vi).selectAll("rect").attr(Yg?"width":"height",Yg?Nf:Pf),bj.append("g").attr("class",f.axisX).attr("transform",Mi.subx).attr("clip-path",Yg?"":ti),bf(uf.data.targets),Yg?aj.select("."+f.axisX).style("opacity",0).call(lg):(aj.select("."+f.axisY).style("opacity",0).call(mg),aj.select("."+f.axisY2).style("opacity",0).call(ng)),n(),R(),_e(),m(!1),Xe({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),mi){if(vi&&"string"==typeof ni){for(ni=oe(ni),e=0;eMf&&(Mf=0),0>Of&&(Of=0),Nf=Yg?Jf.left-Si-Ti:Mf,Pf=Yg?Of:Rf-Kf.top-Kf.bottom,0>Nf&&(Nf=0),0>Pf&&(Pf=0),p(),Ni&&be(uf.data.targets)&&(Lf.left=Mf/2+Tf)}function o(){aj.select("line."+f.xgridFocus).attr("x1",Yg?0:-10).attr("x2",Yg?Mf:-10).attr("y1",Yg?-10:Jf.top).attr("y2",Yg?-10:Of)}function p(){Tf=Of/2,Sf=.95*Tf,Uf=ae(uf.data.targets)?.6*Sf:0}function q(){var a=Yg?f.axisX:f.axisY,b=tf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=tf.select(wf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return xf?xf:x()}function s(){var a=yf?yf:y();return a>0?a:320}function t(){return be(uf.data.targets)?0:zf?zf:Yg?Zg?v("x"):1:!ph||uh?1:v("y")}function u(){var a=1;return be(uf.data.targets)?0:Af?Af:Ni?P()+(yh&&!Yg?v("y2"):a):yh?Dh||Yg?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||Zg?"x"===a&&mh?mh:"y"!==a||ph?"y2"!==a||yh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Ui:Sg&&!Ni?10:1:0}function x(){return+tf.select(wf).style("width").replace("px","")}function y(){return+tf.select(wf).style("height").replace("px","")}function z(a){return a?-5:-(Jf.left-1)}function A(a){return a?-20:-4}function B(){return z(!Yg)}function C(){return A(!Yg)}function D(){return z(Yg)}function E(){return A(Yg)}function F(a){return a?Mf+2+4:Jf.left+20}function G(a){return a?(mh?mh:0)+80:Of+8}function H(){return F(!Yg)}function I(){return G(!Yg)}function J(){return F(Yg)}function K(){return G(Yg)}function L(){var a=Ac(uf.data.targets),b=a.values[0],c=a.values[a.values.length-1],d=fg(c.x)-fg(b.x),e=zc(),f=Zd(uf.data.targets)?(e-(wi?.25:1))/e:1;return e>1?d*f/(e-1):d}function M(a){Oi=a}function N(a){Pi=a}function O(a){Qi=a}function P(){return Sg?Ni?Pi*(Oi+1):Qf:0}function Q(){return Sg?Ni?Rf:Qi*(Oi+1):0}function R(){var a,b=!fg;Zf=Yg?1:0,$f=Yg?Of:Mf,_f=Yg?0:Of,ag=Yg?Mf:1,bg=Zf,cg=$f,dg=Yg?0:Pf,eg=Yg?Nf:1,fg=T(Zf,$f,b?void 0:fg.domain(),function(){return lg.tickOffset()}),gg=U(_f,ag,b?void 0:gg.domain()),hg=U(_f,ag,b?void 0:hg.domain()),ig=T(Zf,$f,fj,function(a){return a%1?0:og.tickOffset()}),jg=U(dg,eg,b?void 0:jg.domain()),kg=U(dg,eg,b?void 0:kg.domain()),a=$(),lg=X(fg,Ii,a),og=X(ig,Li,a),mg=Y(gg,Ji,vh,xh),ng=Y(hg,Ki,Eh,Gh),b||(Vi.scale(ig),Bf&&Zi.scale(fg)),S()}function S(){Vf=Gb(),Wf=Hb(),Xf=Hb(.98)}function T(a,b,d,e){var f=(vi?tf.time.scale():tf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),wi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=tf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?hg:gg}function W(a){return"y2"===Z(a)?kg:jg}function X(a,b,c){var d=(wi?Eb():tf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),wi?(d.tickCentered(bh),se(dh)&&(dh=!1)):d.tickOffset=function(){var a=Bc(uf.data.targets),b=fg(a[1])-fg(a[0]);return b/zc()/2},wi&&d.categories(ah),d}function Y(a,b,c,d){return tf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in wg?wg[a]:"y"}function $(){var a=vi?Fi:wi?Tc:function(a){return 0>a?a.toFixed(0):a};return ch&&("function"==typeof ch?a=ch:vi&&(a=function(a){return a?Ei(ch)(a):""})),a}function _(a){var b;return"y"===a?b=th:"y2"===a?b=Ch:"x"===a&&(b=oh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?th=b:"y2"===a?Ch=b:"x"===a&&(oh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a){a.selectAll(".tick text").attr("y",db(ih)).attr("x",cb(ih)).attr("transform","rotate("+ih+")").style("text-anchor","start")}function fb(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 gb(){return fb("x",Yg?"inner-top":"inner-right")}function hb(){return fb("y",Yg?"inner-right":"inner-top")}function ib(){return fb("y2",Yg?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Mf/2:Mf:b.isBottom?-Of:b.isMiddle?-Of/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!Yg,gb())}function rb(){return nb(Yg,hb())}function sb(){return nb(Yg,ib())}function tb(){return ob(!Yg,gb())}function ub(){return ob(Yg,hb())}function vb(){return ob(Yg,ib())}function wb(){var a=gb();return Yg?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":mh?mh-10:"3em"}function xb(){var a=hb();return Yg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return Yg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!Yg,gb())}function Ab(){return pb(Yg,hb())}function Bb(){return pb(Yg,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return tf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?30:b}function Db(){aj.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),aj.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),aj.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 tf.min(Object.keys(i).map(function(a){return tf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(vg.length>0)for(g=Sc(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 tf.max(Object.keys(i).map(function(a){return tf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Ah:rh,n="y2"===c?zh:qh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Bh:sh,r=ud()&&Yg;return 0===l.length?"y2"===c?hg.domain():gg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(gg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&wh&&(f=b(wh.top)?wh.top:e,g=b(wh.bottom)?wh.bottom:e),"y2"===c&&Fh&&(f=b(Fh.top)?Fh.top:e,g=b(Fh.bottom)?Fh.bottom:e),Zd(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return kh?vi?oe(kh):kh:tf.min(a,function(a){return tf.min(a.values,function(a){return a.x})})}function Zb(a){return jh?vi?oe(jh):jh:tf.max(a,function(a){return tf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return wi?d=0:Zd(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof lh&&te(lh)?(e=b(lh.left)?lh.left:d,f=b(lh.right)?lh.right:d):e=f="number"==typeof lh?lh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?gg:hg;return b="y"===a.axis||"y2"===a.axis?Yg?Of:"start"in a?d(a.start):Of:Yg?"end"in a?fg(vi?oe(a.end):a.end):Of:Of,c>b?0:b-c}function ic(a){return pg&&a===pg||te(qg)&&ue(qg,a)}function jc(a){return!ic(a)}function kc(a){return pg?pg:te(qg)?qg[a]:null}function lc(a,b){var c,d=b&&te(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=uf.data.xs[b])}),c}function mc(a,b){return a in uf.data.xs&&uf.data.xs[a]&&uf.data.xs[a][b]?uf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){qg[b]=a[b]})}function oc(a){return 1===tf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=tg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),uf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=vi?a?a instanceof Date?a:oe(a):oe(mc(c,d)):xi&&!wi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?uf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):pg?(d=Object.keys(uf.data.xs),uf.data.xs[c]=d.length>0?uf.data.xs[d[0]]:void 0):te(qg)&&(uf.data.xs[c]=lc(f,uf.data.targets)):uf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!uf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=sg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return xi&&wi&&0===c&&g&&(0===e&&(ah=[]),ah.push(g)),("undefined"==typeof a[b]||uf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),xg&&Xd(Cc(c).filter(function(a){return!(a in yg)}),xg),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&uf.data.targets[0].values[a-1]?uf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(uf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(vi?new Date(h):h);i.push(d)}return vi||(i=i.sort(function(a,b){return a-b})),i}function Lc(a){Gi=Gi.concat(a)}function Mc(a){Gi=Gi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Hi=Hi.concat(a)}function Oc(a){Hi=Hi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Dd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Dd(a,g))),Gd(e,b)):Ed(a,b,f,g)}function Fd(a,b){var c;return c=a.map(function(a){return Ed(a.values,b)}),Gd(c,b)}function Gd(a,b){var c,d;return a.forEach(function(a){var e=ve(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Hd(a,b){return tf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Id(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 Jd(){return Ag&&"desc"===Ag.toLowerCase()}function Kd(){return Ag&&"asc"===Ag.toLowerCase()}function Ld(a){var b=Kd(),c=Jd();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 Ag&&a.sort(Ag),a}function Md(a,c){var d,e,f,g,h,i,j,k=be(uf.data.targets),l=k?xd:wd,m=a.filter(function(a){return a&&b(a.value)});ii&&0!==m.length&&(dj.html(li(a,$(),l,Di)).style("display","block"),d=dj.property("offsetWidth"),e=dj.property("offsetHeight"),k?(g=Mf/2+c[0],i=Of/2+c[1]+20):(Yg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=fg(m[0].x)+20):(f=q(),g=f+t()+fg(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),dj.style("top",i+"px").style("left",g+"px"))}function Nd(){dj.style("display","none")}function Od(a){var c=a.filter(function(a){return a&&b(a.value)});ii&&($d(uf.data.targets)||be(uf.data.targets)||aj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Yg?"y1":"x1",zd).attr(Yg?"y2":"x2",zd))}function Pd(){aj.select("line."+f.xgridFocus).style("visibility","hidden")}function Qd(a){return a.x||0===a.x?fg(a.x):null}function Rd(a){return V(a.id)(a.value)}function Sd(){var a,b,d={},e=0;return Ic(Fc(ee)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Wd(a,b){return Uh?Uh:b?2*a.tickOffset()*Vh/b:0}function Xd(a,b){Dc(a).forEach(function(a){hj[a]=b===yg[a],yg[a]=b})}function Yd(a,b){var c=!1;return a.forEach(function(a){yg[a.id]===b&&(c=!0),a.id in yg||"line"!==b||(c=!0)}),c}function Zd(a){return Yd(a,"bar")}function $d(a){return Yd(a,"scatter")}function _d(a){return Yd(a,"pie")}function ae(a){return Yd(a,"donut")}function be(a){return _d(a)||ae(a)}function ce(a){var b="string"==typeof a?a:a.id;return!(b in yg)||"line"===yg[b]||"spline"===yg[b]||"area"===yg[b]||"area-spline"===yg[b]}function de(a){var b="string"==typeof a?a:a.id;return"spline"===yg[b]||"area-spline"===yg[b]}function ee(a){var b="string"==typeof a?a:a.id;return"bar"===yg[b]}function fe(a){var b="string"==typeof a?a:a.id;return"scatter"===yg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"pie"===yg[b]}function he(a){var b="string"==typeof a?a:a.id;return"donut"===yg[b]}function ie(a){return ge(a)||he(a)}function je(a){return ee(a)?a.values:[]}function ke(a){return ce(a)||fe(a)?a.values:[]}function le(a){return ee(a)||ce(a)?a.values:[]}function me(a){return he(a)&&ci||ge(a)&&Yh}function ne(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function oe(b){var c;try{c=rg?tf.time.format(rg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+rg)}return c}function pe(a,b){var c=tf.mouse(a),d=tf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function ue(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ve(a,b){var c="y"===Z(a.id)?gg:hg,d=Yg?1:0,e=Yg?0:1;return Math.pow(fg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function we(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function xe(a,b,c){Lg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd).attr("stroke",function(){return Di(b)}).attr("r",1.4*Sh).transition().duration(100).attr("r",Sh)}function ye(a,b,c){Mg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ze(a,b,c,d){a?xe(b,c,d):ye(b,c,d)}function Ae(a,b){Lg(b,a.node()),a.transition().duration(100).style("fill",function(){return tf.rgb(Di(b)).darker(1)})}function Be(a,b){Mg(b,a.node()),a.transition().duration(100).style("fill",function(){return Di(b)})}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a){return a.filter(function(a){return b(a.value)})}function Ee(a,c){return(c?aj.selectAll("."+f.circles+ld(c)):aj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Fe(a,b){Ee(a,b).classed(f.EXPANDED,!0).attr("r",Rh)}function Ge(a){Ee(a).filter(function(){return tf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oh)}function He(a){return aj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ie(a){He(a).classed(f.EXPANDED,!0)}function Je(a){He(a).classed(f.EXPANDED,!1)}function Ke(a,b){var c=Oe(a,b);return function(a,b){var d=c(a,b),e=Yg?1:0,f=Yg?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 Le(a,b){var c=Oe(a,!1),d=b?Me:Ne;return function(a,b){return d(c(a,b),a,this)}}function Me(a,b){var c;return Yg?(c=ee(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ne(a,b,c){var d=c.getBoundingClientRect();return Yg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ee(b)?-3:-6)}function Oe(a,b){var c=a.__max__+1,d=Wd(lg,c),e=Td(d,c,a,!!b),f=Ud(!!b),g=Vd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Yg&&(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 Pe(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 Qe(b){var c,d,e;if(ej=tf.select(wf),ej.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ej.html(""),ej.classed("c3",!0),uf.data.xs={},uf.data.targets=vc(b),n(),R(),fg.domain(tf.extent(_b(uf.data.targets))),gg.domain(Xb(uf.data.targets,"y")),hg.domain(Xb(uf.data.targets,"y2")),ig.domain(fg.domain()),jg.domain(gg.domain()),kg.domain(hg.domain()),fj=fg.domain(),Vi.scale(ig),Bf&&Zi.scale(fg),$i=ej.append("svg").attr("width",Mf+Jf.left+Jf.right).attr("height",Of+Jf.top+Jf.bottom).on("mouseenter",Ef).on("mouseleave",Ff),_i=$i.append("defs"),_i.append("clipPath").attr("id",pi).append("rect").attr("width",Mf).attr("height",Of),_i.append("clipPath").attr("id",qi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),_i.append("clipPath").attr("id",ri).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),aj=$i.append("g").attr("transform",Mi.main),bj=$i.append("g").attr("transform",Mi.context),cj=$i.append("g").attr("transform",Mi.legend),Pg||bj.style("visibility","hidden"),Sg||(cj.style("visibility","hidden"),Hi=Cc(uf.data.targets)),dj=tf.select(wf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),of(Cc(uf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Zg&&aj.append("g").attr("class",f.axisX).attr("clip-path",ti).attr("transform",Mi.x).append("text").attr("class",f.axisXLabel).attr("transform",Yg?"rotate(-90)":"").style("text-anchor",zb),ph&&aj.append("g").attr("class",f.axisY).attr("clip-path",ui).attr("transform",Mi.y).append("text").attr("class",f.axisYLabel).attr("transform",Yg?"":"rotate(-90)").style("text-anchor",Ab),yh&&aj.append("g").attr("class",f.axisY2).attr("transform",Mi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Yg?"":"rotate(-90)").style("text-anchor",Bb),d=aj.append("g").attr("clip-path",si).attr("class",f.grid),Hh&&d.append("g").attr("class",f.xgrids),te(Jh)&&d.append("g").attr("class",f.xgridLines),Ph&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Kh&&d.append("g").attr("class",f.ygrids),te(Lh)&&d.append("g").attr("class",f.ygridLines),aj.append("g").attr("clip-path",si).attr("class",f.regions),aj.append("g").attr("clip-path",si).attr("class",f.chart),c=aj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Bf?Yg?"ns-resize":"ew-resize":null),aj.select("."+f.chart).append("g").attr("class",f.chartBars),aj.select("."+f.chart).append("g").attr("class",f.chartLines),aj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Mi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),aj.select("."+f.chart).append("g").attr("class",f.chartTexts),Bf&&aj.insert("rect",Df?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Mf).attr("height",Of).style("opacity",0).style("cursor",Yg?"ns-resize":"ew-resize").call(Zi).on("dblclick.zoom",null),nh&&Vi.extent("function"!=typeof nh?nh:nh(_b())),bj.append("g").attr("clip-path",si).attr("class",f.chart),bj.select("."+f.chart).append("g").attr("class",f.chartBars),bj.select("."+f.chart).append("g").attr("class",f.chartLines),bj.append("g").attr("clip-path",si).attr("class",f.brush).call(Vi).selectAll("rect").attr(Yg?"width":"height",Yg?Nf:Pf),bj.append("g").attr("class",f.axisX).attr("transform",Mi.subx).attr("clip-path",Yg?"":ti),bf(uf.data.targets),Yg?aj.select("."+f.axisX).style("opacity",0).call(lg):(aj.select("."+f.axisY).style("opacity",0).call(mg),aj.select("."+f.axisY2).style("opacity",0).call(ng)),n(),R(),_e(),m(!1),Xe({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),mi){if(vi&&"string"==typeof ni){for(ni=oe(ni),e=0;e0){d=[];for(var g in tg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Id(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ce,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 Ve(a){be(uf.data.targets)||Eg&&(yi=a,aj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),zi=!0,Ng())}function We(){be(uf.data.targets)||Eg&&(aj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),aj.selectAll("."+f.shape).classed(f.INCLUDED,!1),zi=!1,Og())}function Xe(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Sd(),W=be(uf.data.targets),X=Ic(uf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?If:0,Q=D?P:0,R=E?P:0,c=aj.select("."+f.axisX).style("opacity",W?0:1),g=aj.select("."+f.axisY).style("opacity",W?0:1),h=aj.select("."+f.axisY2).style("opacity",W?0:1),e=bj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Sg&&of(Cc(uf.data.targets),a,O),wi&&(0===X.length||!H||G)&&fg.domain([0,c.selectAll(".tick").size()]),X.length&&(H&&(fg.domain(tf.extent(_b(X))),fj=fg.domain(),Bf&&Zi.scale(fg).updateScaleExtent(),ig.domain(fg.domain()),Vi.scale(ig)),G&&(fg.domain(Vi.empty()?fj:Vi.extent()),Bf&&Zi.scale(fg).updateScaleExtent())),gg.domain(Xb(X,"y")),hg.domain(Xb(X,"y2")),(gh||fh)&&(S=hh?hh:Kc(Jc(X)),lg.tickValues(S),og.tickValues(S)),O.axisX.call(lg),O.axisY.call(mg),O.axisY2.call(ng),O.axisSubX.call(og),G)if(dh&&S){for(T=1;T=0&&tf.select(this).style("display",b%U?"none":"block")})}else tf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!Yg&&ih&&eb(c),J=Ke(V),M=Le(V,!0),N=Le(V,!1),Db(),jg.domain(gg.domain()),kg.domain(hg.domain()),dj.style("display","none"),o(),aj.select("line."+f.xgridFocus).style("visibility","hidden"),Hh){if("year"===Ih){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=fg.ticks(10);i=aj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",Yg?0:function(a){return fg(a)-lg.tickOffset()}).attr("x2",Yg?Mf:function(a){return fg(a)-lg.tickOffset()}).attr("y1",Yg?function(a){return fg(a)-lg.tickOffset()}:Jf.top).attr("y2",Yg?function(a){return fg(a)-lg.tickOffset()}:Of).style("opacity",function(){return+tf.select(this).attr(Yg?"y1":"x1")===(Yg?Of:0)?0:1}),i.exit().remove()}te(Jh)&&(k=aj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Jh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",Yg?"":"rotate(-90)").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",Yg?0:Ad).attr("x2",Yg?Mf:Ad).attr("y1",Yg?Ad:Jf.top).attr("y2",Yg?Ad:Of).style("opacity",1),k.select("text").transition().duration(P).attr("x",Yg?Mf:0).attr("y",Ad).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Kh&&(m=aj.select("."+f.ygrids).selectAll("."+f.ygrid).data(gg.ticks(Mh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",Yg?gg:0).attr("x2",Yg?gg:Mf).attr("y1",Yg?0:gg).attr("y2",Yg?Of:gg),m.exit().remove()),A&&te(Lh)&&(n=aj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Lh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",Yg?"rotate(-90)":"").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",Yg?Bd:0).attr("x2",Yg?Bd:Mf).attr("y1",Yg?0:Bd).attr("y2",Yg?Of:Bd).style("opacity",1),n.select("text").transition().duration(P).attr("x",Yg?0:Mf).attr("y",Bd).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=aj.select("."+f.regions).selectAll("rect."+f.region).data(hi),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=aj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Di(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=aj.selectAll("."+f.texts).selectAll("."+f.text).data(le),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return Yg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return yd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),aj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",Wi).style("opacity",1),aj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",Xi).style("opacity",gj),q=aj.selectAll("."+f.circles).selectAll("."+f.circle).data(ke),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Oh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),q.exit().remove(),aj.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=tf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1),aj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&ie(a.data)?1:0}),aj.select("."+f.chartArcsTitle).style("opacity",ae(uf.data.targets)?1:0),Pg&&(null!==tf.event&&"zoom"===tf.event.type&&Vi.extent(fg.orgDomain()).update(),B&&(!Yg&&ih&&eb(e),Vi.empty()||Vi.extent(fg.orgDomain()).update(),K=Ke(V,!0),u=bj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Di(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),bj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",Yi).style("opacity",1))),aj.selectAll("."+f.selectedCircles).filter(function(a){return ee(a)}).selectAll("circle").remove(),aj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),v=aj.select("."+f.eventRects),te(qg)&&!oc(qg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Se(w.enter()),w.attr("x",0).attr("y",0).attr("width",Mf).attr("height",Of)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),xi&&!wi?(z=function(a,b){var c=xc(b),d=yc(b),e=uf.data.xs[a.id][b];return(fg(d?d:e+50)-fg(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=uf.data.xs[a.id][b];return(fg(d)+fg(c?c:d-50))/2}):(z=L(),y=function(a){return fg(a.x)-z/2}),x=Ac(uf.data.targets),aj.select("."+f.eventRects).datum(x?x.values:[]),w=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Re(w.enter()),w.attr("class",fd).attr("x",Yg?0:y).attr("y",Yg?y:0).attr("width",Yg?Mf:z).attr("height",Yg?z:Of),w.exit().remove()),Cc(uf.data.targets).forEach(function(a){hj[a]=!0})}function Ye(){Xe({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ze(){return"mousemove"===tf.event.sourceEvent.type&&Zi.altDomain?(fg.domain(Zi.altDomain),void Zi.scale(fg).updateScaleExtent()):(wi&&fg.orgDomain()[0]===fj[0]&&fg.domain([fj[0]-1e-10,fg.orgDomain()[1]]),Xe({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===tf.event.sourceEvent.type&&(Ai=!0)))}function $e(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function _e(){$i.attr("width",Qf).attr("height",Rf),$i.select("#"+pi).select("rect").attr("width",Mf).attr("height",Of),$i.select("#"+qi).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),$i.select("#"+ri).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),$i.select("."+f.zoomRect).attr("width",Mf).attr("height",Of),ej.style("max-height",Rf+"px")}function af(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),_e(),m(a.withTransition),Xe(a)}function bf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=aj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Di(a)}),e=aj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("fill",function(a){return Di(a)}).style("stroke","none").style("cursor",function(a){return Gg(a)?"pointer":null}),c=aj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)}),b.append("path").attr("class",dd).style("opacity",function(){return gj=+tf.select(this).style("opacity"),0}).style("fill",function(a){return Di(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Di(a)}).style("cursor",function(a){return Gg(a)?"pointer":null}),a.forEach(function(a){aj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=aj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Yf(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Di(a.data)}).style("cursor",function(a){return Gg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Fb(a),d=Lb(c),e=Tb();Nb(c.data.id),jf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Fb(a),c=[Lb(b)];Md(c,tf.mouse(this))}).on("mouseout",function(a,b){var c=Fb(a),d=Lb(c),e=Ub();Ob(c.data.id),lf(),Nd(),e(d,b)}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Pg&&(n=bj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Di(a)}),l=bj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)})),$i.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function cf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Xd(a.id,b.types[a.id]):Xd(a.id,b.type)}),uf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Ni?j:i,l=Ni?Q():P();return d&&(x=0,D=0,u=0,v=0),Sg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Ni?v:u,void(Xg?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Ni?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=cj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Ug?Ug(a):uf.toggle(a)}).on("mouseover",function(a){uf.focus(a),"function"==typeof Vg&&Vg(a)}).on("mouseout",function(a){uf.revert(),"function"==typeof Wg&&Wg(a)}),o.append("text").text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ni?h:-200).attr("y",Ni?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ni?i:-200).attr("y",Ni?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Di(a)}).attr("x",Ni?h:-200).attr("y",Ni?-200:j).attr("width",10).attr("height",10),cj.selectAll("text").data(a).text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),cj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),cj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),N(u),O(v),M(D),n(),R(),_e(),r&&m(q,c)}function pf(a){return Ec(uf.data.targets,a.id)}function qf(a){return"data"in a&&Ec(uf.data.targets,a.data.id)}function rf(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 sf(a,b,c){var d=!be(uf.data.targets);Xd(a,b),af(c||{withTransitionForAxis:d})}var tf=a.d3?a.d3:a.require?a.require("d3"):void 0,uf={data:{},axis:{},legend:{}},vf={},wf=h(["bindto"],"#chart"),xf=h(["size","width"]),yf=h(["size","height"]),zf=h(["padding","left"]),Af=h(["padding","right"]),Bf=h(["zoom","enabled"],!1),Cf=h(["zoom","extent"]),Df=h(["zoom","privileged"],!1),Ef=h(["onenter"],function(){}),Ff=h(["onleave"],function(){}),Gf=h(["onresize"],function(){}),Hf=h(["onresized"],function(){}),If=h(["transition","duration"],350);g("data","data is required in config");var Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg=h(["data","x"]),qg=h(["data","xs"],{}),rg=h(["data","x_format"]),sg=h(["data","id_converter"],function(a){return a}),tg=h(["data","names"],{}),ug=h(["data","classes"],{}),vg=h(["data","groups"],[]),wg=h(["data","axes"],{}),xg=h(["data","type"]),yg=h(["data","types"],{}),zg=h(["data","labels"],{}),Ag=h(["data","order"]),Bg=h(["data","regions"],{}),Cg=h(["data","color"]),Dg=h(["data","colors"],{}),Eg=h(["data","selection","enabled"],!1),Fg=h(["data","selection","grouped"],!1),Gg=h(["data","selection","isselectable"],function(){return!0}),Hg=h(["data","selection","multiple"],!0),Ig=h(["data","onclick"],function(){}),Jg=h(["data","onenter"],function(){}),Kg=h(["data","onleave"],function(){}),Lg=h(["data","onselected"],function(){}),Mg=h(["data","onunselected"],function(){}),Ng=h(["data","ondragstart"],function(){}),Og=h(["data","ondragend"],function(){}),Pg=h(["subchart","show"],!1),Qg=h(["subchart","size","height"],60),Rg=h(["color","pattern"],[]),Sg=h(["legend","show"],!0),Tg=h(["legend","position"],"bottom"),Ug=h(["legend","item","onclick"]),Vg=h(["legend","item","onmouseover"]),Wg=h(["legend","item","onmouseout"]),Xg=h(["legend","equally"],!1),Yg=h(["axis","rotated"],!1),Zg=h(["axis","x","show"],!0),$g=h(["axis","x","type"],"indexed"),_g=h(["axis","x","localtime"],!0),ah=h(["axis","x","categories"],[]),bh=h(["axis","x","tick","centered"],!1),ch=h(["axis","x","tick","format"]),dh=h(["axis","x","tick","culling"],{}),eh=h(["axis","x","tick","culling","max"],10),fh=h(["axis","x","tick","count"]),gh=h(["axis","x","tick","fit"],!0),hh=h(["axis","x","tick","values"],null),ih=h(["axis","x","tick","rotate"]),jh=h(["axis","x","max"],null),kh=h(["axis","x","min"],null),lh=h(["axis","x","padding"],{}),mh=h(["axis","x","height"]),nh=h(["axis","x","default"]),oh=h(["axis","x","label"],{}),ph=h(["axis","y","show"],!0),qh=h(["axis","y","max"]),rh=h(["axis","y","min"]),sh=h(["axis","y","center"]),th=h(["axis","y","label"],{}),uh=h(["axis","y","inner"],!1),vh=h(["axis","y","tick","format"]),wh=h(["axis","y","padding"],{}),xh=h(["axis","y","ticks"],10),yh=h(["axis","y2","show"],!1),zh=h(["axis","y2","max"]),Ah=h(["axis","y2","min"]),Bh=h(["axis","y2","center"]),Ch=h(["axis","y2","label"],{}),Dh=h(["axis","y2","inner"],!1),Eh=h(["axis","y2","tick","format"]),Fh=h(["axis","y2","padding"],{}),Gh=h(["axis","y2","ticks"],10),Hh=h(["grid","x","show"],!1),Ih=h(["grid","x","type"],"tick"),Jh=h(["grid","x","lines"],[]),Kh=h(["grid","y","show"],!1),Lh=h(["grid","y","lines"],[]),Mh=h(["grid","y","ticks"],10),Nh=h(["point","show"],!0),Oh=Nh?h(["point","r"],2.5):0,Ph=h(["point","focus","line","enabled"],!0),Qh=h(["point","focus","expand","enabled"],!0),Rh=h(["point","focus","expand","r"],Qh?4:Oh),Sh=h(["point","focus","select","r"],8),Th=h(["line","connect_null"],!1),Uh=h(["bar","width"]),Vh=h(["bar","width","ratio"],.6),Wh=h(["pie","label","show"],!0),Xh=h(["pie","label","format"]),Yh=h(["pie","expand"],!0),Zh=h(["pie","onclick"],function(){}),$h=h(["pie","onmouseover"],function(){}),_h=h(["pie","onmouseout"],function(){}),ai=h(["donut","label","show"],!0),bi=h(["donut","label","format"]),ci=h(["donut","expand"],!0),di=h(["donut","title"],""),ei=h(["donut","onclick"],function(){}),fi=h(["donut","onmouseover"],function(){}),gi=h(["donut","onmouseout"],function(){}),hi=h(["regions"],[]),ii=h(["tooltip","show"],!0),ji=h(["tooltip","format","title"]),ki=h(["tooltip","format","value"]),li=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ji?ji:b,l=ki?ki: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+""}),mi=h(["tooltip","init","show"],!1),ni=h(["tooltip","init","x"],0),oi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),pi=("string"==typeof wf?wf.replace("#",""):wf.id)+"-clip",qi=pi+"-xaxis",ri=pi+"-yaxis",si=i(pi),ti=i(qi),ui=i(ri),vi="timeseries"===$g,wi="categorized"===$g,xi=!vi&&(pg||te(qg)),yi=null,zi=!1,Ai=!1,Bi=!1,Ci=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Di=ne(Dg,te(Rg)?Rg:Ci,Cg),Ei=_g?tf.time.format:tf.time.format.utc,Fi=function(){var a=[[Ei("%Y/%-m/%-d"),function(){return!0}],[Ei("%-m/%-d"),function(a){return a.getMonth()}],[Ei("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ei("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ei("%I %p"),function(a){return a.getHours()}],[Ei("%I:%M"),function(a){return a.getMinutes()}],[Ei(":%S"),function(a){return a.getSeconds()}],[Ei(".%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)}}(),Gi=[],Hi=[],Ii=Yg?"left":"bottom",Ji=Yg?uh?"top":"bottom":uh?"right":"left",Ki=Yg?Dh?"bottom":"top":Dh?"left":"right",Li=Yg?"left":"bottom",Mi={main:function(){return"translate("+Jf.left+","+Jf.top+")"},context:function(){return"translate("+Kf.left+","+Kf.top+")"},legend:function(){return"translate("+Lf.left+","+Lf.top+")"},x:function(){return"translate(0,"+(Yg?0:Of)+")"},y:function(){return"translate(0,"+(Yg?Of:0)+")"},y2:function(){return"translate("+(Yg?0:Mf)+","+(Yg?1:0)+")"},subx:function(){return"translate(0,"+(Yg?0:Pf)+")"},arc:function(){return"translate("+Mf/2+","+Of/2+")"}},Ni="right"===Tg,Oi=0,Pi=0,Qi=0,Ri=.15,Si=30,Ti=Yg&&!Zg?0:30,Ui=5;Yf=tf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Vi,Wi=function(){var a=tf.svg.line().x(Yg?function(a){return V(a.id)(a.value)}:zd).y(Yg?zd:function(a){return V(a.id)(a.value)});return Th||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Th?De(b.values):b.values;return ce(b)?(a.interpolate(de(b)?"cardinal":"linear"),Bg[b.id]?Pe(e,fg,V(b.id),Bg[b.id]):a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Xi=function(){var a;return a=Yg?tf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(zd):tf.svg.area().x(zd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=De(b.values);return Yd([b],"area")||Yd([b],"area-spline")?(a.interpolate(de(b)?"cardinal":"linear"),a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Yi=function(){var a=tf.svg.line().x(Yg?function(a){return W(a.id)(a.value)}:Cd).y(Yg?Cd:function(a){return W(a.id)(a.value)});return function(b){var c=De(b.values);return ce(b)?a(c):"M "+ig(c[0].x)+" "+W(b.id)(c[0].value)}}(),Zi=function(){};Vi=tf.svg.brush().on("brush",Ye),Vi.update=function(){return bj&&bj.select("."+f.brush).call(this),this},Vi.scale=function(a){return Yg?this.y(a):this.x(a)},Bf&&(Zi=tf.behavior.zoom().on("zoomstart",function(){Zi.altDomain=tf.event.sourceEvent.altKey?fg.orgDomain():null}).on("zoom",Bf?Ze:null),Zi.scale=function(a){return Yg?this.y(a):this.x(a)},Zi.orgScaleExtent=function(){var a=Cf?Cf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},Zi.updateScaleExtent=function(){var a=ac(fg.orgDomain())/ac(fj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var $i,_i,aj,bj,cj,dj,ej,fj,gj,hj={};if(uf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),uf.defocus(),b(d.classed(f.focused,!0)),b(e),be(uf.data.targets)&&Nb(a,!0),jf(a)},uf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),kf(a)},uf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),lf()},uf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),$i.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?mf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},uf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),$i.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?nf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Ri),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},uf.toggle=function(a){Gc(a)?uf.hide(a):uf.show(a)},uf.unzoom=function(){Vi.clear().update(),Xe({withUpdateXDomain:!0})},uf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){ug[b]=a.classes[b]}),"categories"in a&&wi&&(ah=a.categories,lg.categories(ah)),"cacheIds"in a&&bc(a.cacheIds)?void cf(dc(a.cacheIds),a.done):void("unload"in a?ef(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){df(a)}):df(a))},uf.unload=function(a){ef(Dc(a),function(){Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},uf.selected=function(a){return tf.merge(aj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return tf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},uf.select=function(a,b,c){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=tf.select(this),i="circle"===this.nodeName?xe:Ae,j="circle"===this.nodeName?ye:Be,k=Fg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Gg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},uf.unselect=function(a,b){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=tf.select(this),g="circle"===this.nodeName?ye:Be,h=Fg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Gg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},uf.toLine=function(a){sf(a,"line")},uf.toSpline=function(a){sf(a,"spline")},uf.toBar=function(a){sf(a,"bar")},uf.toScatter=function(a){sf(a,"scatter")},uf.toArea=function(a){sf(a,"area")},uf.toAreaSpline=function(a){sf(a,"area-spline")},uf.toPie=function(a){sf(a,"pie",{withTransform:!0})},uf.toDonut=function(a){sf(a,"donut",{withTransform:!0})},uf.groups=function(a){return c(a)?vg:(vg=a,Xe(),vg)},uf.xgrids=function(a){return a?(Jh=a,Xe(),Jh):Jh},uf.xgrids.add=function(a){return a?uf.xgrids(Jh.concat(a)):void 0},uf.xgrids.remove=function(a){var b=rf(a);return uf.xgrids(Jh.filter(b))},uf.ygrids=function(a){return a?(Lh=a,Xe(),Lh):Lh},uf.ygrids.add=function(a){return a?uf.ygrids(Lh.concat(a)):void 0 },uf.ygrids.remove=function(a){var b=rf(a);return uf.ygrids(Lh.filter(b))},uf.regions=function(a){return c(a)?hi:(hi=a,Xe(),hi)},uf.regions.add=function(a){return c(a)?hi:(hi=hi.concat(a),Xe(),hi)},uf.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;$i.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),hi=hi.filter(function(b){return b.classes.indexOf(a)<0})}),hi},uf.data.get=function(a){var b=uf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},uf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},uf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){tg[b]=a[b]}),of(Cc(uf.data.targets),{withTransition:!0}),tg):tg},uf.x=function(a){return arguments.length&&(qc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.xs=function(a){return arguments.length&&(rc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},uf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(qh=+a.y),b(a.y2)&&(zh=+a.y2)):qh=zh=+a,Xe())},uf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(rh=+a.y),b(a.y2)&&(Ah=+a.y2)):rh=Ah=+a,Xe())},uf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&uf.axis.max(a.max),"undefined"!=typeof a.min&&uf.axis.min(a.min))},uf.legend.show=function(a){Sg||(Sg=!0,cj.style("visibility","visible")),mf(Dc(a)),Xe({withLegend:!0})},uf.legend.hide=function(a){nf(Dc(a)),Xe({withLegend:!0}),Sg&&se(a)&&(Sg=!1,cj.style("visibility","hidden"))},uf.resize=function(a){xf=a?a.width:null,yf=a?a.height:null,af({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},uf.destroy=function(){uf.data.targets=void 0,uf.data.xs={},ej.html(""),a.onresize=null},"url"in e.data)tf.xhr(e.data.url,function(a,b){var c,d=tf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=tf.csv.parse(b.response),Qe(c)});else if("rows"in e.data)Qe(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Qe(uc(e.data.columns))}return uf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From f85494722815dc9f2fa37e52139f100d8ddeeba8 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Sun, 27 Apr 2014 16:38:20 +0900 Subject: [PATCH 071/178] Fix x tick rotate --- c3.js | 4 ++-- c3.min.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/c3.js b/c3.js index 5b1c6f0..0eafb80 100644 --- a/c3.js +++ b/c3.js @@ -3193,7 +3193,7 @@ // rotate tick text if needed if (!__axis_rotated && __axis_x_tick_rotate) { - rotateTickText(xaxis); + rotateTickText(transitions.axisX); } // setup drawer - MEMO: these must be called after axis updated @@ -3441,7 +3441,7 @@ // rotate tick text if needed if (!__axis_rotated && __axis_x_tick_rotate) { - rotateTickText(subxaxis); + rotateTickText(transitions.axisSubX); } // extent rect diff --git a/c3.min.js b/c3.min.js index cc87211..4a7112f 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ !function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.32"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cMf&&(Mf=0),0>Of&&(Of=0),Nf=Yg?Jf.left-Si-Ti:Mf,Pf=Yg?Of:Rf-Kf.top-Kf.bottom,0>Nf&&(Nf=0),0>Pf&&(Pf=0),p(),Ni&&be(uf.data.targets)&&(Lf.left=Mf/2+Tf)}function o(){aj.select("line."+f.xgridFocus).attr("x1",Yg?0:-10).attr("x2",Yg?Mf:-10).attr("y1",Yg?-10:Jf.top).attr("y2",Yg?-10:Of)}function p(){Tf=Of/2,Sf=.95*Tf,Uf=ae(uf.data.targets)?.6*Sf:0}function q(){var a=Yg?f.axisX:f.axisY,b=tf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=tf.select(wf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return xf?xf:x()}function s(){var a=yf?yf:y();return a>0?a:320}function t(){return be(uf.data.targets)?0:zf?zf:Yg?Zg?v("x"):1:!ph||uh?1:v("y")}function u(){var a=1;return be(uf.data.targets)?0:Af?Af:Ni?P()+(yh&&!Yg?v("y2"):a):yh?Dh||Yg?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||Zg?"x"===a&&mh?mh:"y"!==a||ph?"y2"!==a||yh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Ui:Sg&&!Ni?10:1:0}function x(){return+tf.select(wf).style("width").replace("px","")}function y(){return+tf.select(wf).style("height").replace("px","")}function z(a){return a?-5:-(Jf.left-1)}function A(a){return a?-20:-4}function B(){return z(!Yg)}function C(){return A(!Yg)}function D(){return z(Yg)}function E(){return A(Yg)}function F(a){return a?Mf+2+4:Jf.left+20}function G(a){return a?(mh?mh:0)+80:Of+8}function H(){return F(!Yg)}function I(){return G(!Yg)}function J(){return F(Yg)}function K(){return G(Yg)}function L(){var a=Ac(uf.data.targets),b=a.values[0],c=a.values[a.values.length-1],d=fg(c.x)-fg(b.x),e=zc(),f=Zd(uf.data.targets)?(e-(wi?.25:1))/e:1;return e>1?d*f/(e-1):d}function M(a){Oi=a}function N(a){Pi=a}function O(a){Qi=a}function P(){return Sg?Ni?Pi*(Oi+1):Qf:0}function Q(){return Sg?Ni?Rf:Qi*(Oi+1):0}function R(){var a,b=!fg;Zf=Yg?1:0,$f=Yg?Of:Mf,_f=Yg?0:Of,ag=Yg?Mf:1,bg=Zf,cg=$f,dg=Yg?0:Pf,eg=Yg?Nf:1,fg=T(Zf,$f,b?void 0:fg.domain(),function(){return lg.tickOffset()}),gg=U(_f,ag,b?void 0:gg.domain()),hg=U(_f,ag,b?void 0:hg.domain()),ig=T(Zf,$f,fj,function(a){return a%1?0:og.tickOffset()}),jg=U(dg,eg,b?void 0:jg.domain()),kg=U(dg,eg,b?void 0:kg.domain()),a=$(),lg=X(fg,Ii,a),og=X(ig,Li,a),mg=Y(gg,Ji,vh,xh),ng=Y(hg,Ki,Eh,Gh),b||(Vi.scale(ig),Bf&&Zi.scale(fg)),S()}function S(){Vf=Gb(),Wf=Hb(),Xf=Hb(.98)}function T(a,b,d,e){var f=(vi?tf.time.scale():tf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),wi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=tf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?hg:gg}function W(a){return"y2"===Z(a)?kg:jg}function X(a,b,c){var d=(wi?Eb():tf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),wi?(d.tickCentered(bh),se(dh)&&(dh=!1)):d.tickOffset=function(){var a=Bc(uf.data.targets),b=fg(a[1])-fg(a[0]);return b/zc()/2},wi&&d.categories(ah),d}function Y(a,b,c,d){return tf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in wg?wg[a]:"y"}function $(){var a=vi?Fi:wi?Tc:function(a){return 0>a?a.toFixed(0):a};return ch&&("function"==typeof ch?a=ch:vi&&(a=function(a){return a?Ei(ch)(a):""})),a}function _(a){var b;return"y"===a?b=th:"y2"===a?b=Ch:"x"===a&&(b=oh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?th=b:"y2"===a?Ch=b:"x"===a&&(oh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a){a.selectAll(".tick text").attr("y",db(ih)).attr("x",cb(ih)).attr("transform","rotate("+ih+")").style("text-anchor","start")}function fb(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 gb(){return fb("x",Yg?"inner-top":"inner-right")}function hb(){return fb("y",Yg?"inner-right":"inner-top")}function ib(){return fb("y2",Yg?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Mf/2:Mf:b.isBottom?-Of:b.isMiddle?-Of/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!Yg,gb())}function rb(){return nb(Yg,hb())}function sb(){return nb(Yg,ib())}function tb(){return ob(!Yg,gb())}function ub(){return ob(Yg,hb())}function vb(){return ob(Yg,ib())}function wb(){var a=gb();return Yg?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":mh?mh-10:"3em"}function xb(){var a=hb();return Yg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return Yg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!Yg,gb())}function Ab(){return pb(Yg,hb())}function Bb(){return pb(Yg,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return tf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?30:b}function Db(){aj.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),aj.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),aj.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 tf.min(Object.keys(i).map(function(a){return tf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(vg.length>0)for(g=Sc(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 tf.max(Object.keys(i).map(function(a){return tf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Ah:rh,n="y2"===c?zh:qh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Bh:sh,r=ud()&&Yg;return 0===l.length?"y2"===c?hg.domain():gg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(gg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&wh&&(f=b(wh.top)?wh.top:e,g=b(wh.bottom)?wh.bottom:e),"y2"===c&&Fh&&(f=b(Fh.top)?Fh.top:e,g=b(Fh.bottom)?Fh.bottom:e),Zd(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return kh?vi?oe(kh):kh:tf.min(a,function(a){return tf.min(a.values,function(a){return a.x})})}function Zb(a){return jh?vi?oe(jh):jh:tf.max(a,function(a){return tf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return wi?d=0:Zd(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof lh&&te(lh)?(e=b(lh.left)?lh.left:d,f=b(lh.right)?lh.right:d):e=f="number"==typeof lh?lh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?gg:hg;return b="y"===a.axis||"y2"===a.axis?Yg?Of:"start"in a?d(a.start):Of:Yg?"end"in a?fg(vi?oe(a.end):a.end):Of:Of,c>b?0:b-c}function ic(a){return pg&&a===pg||te(qg)&&ue(qg,a)}function jc(a){return!ic(a)}function kc(a){return pg?pg:te(qg)?qg[a]:null}function lc(a,b){var c,d=b&&te(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=uf.data.xs[b])}),c}function mc(a,b){return a in uf.data.xs&&uf.data.xs[a]&&uf.data.xs[a][b]?uf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){qg[b]=a[b]})}function oc(a){return 1===tf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=tg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),uf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=vi?a?a instanceof Date?a:oe(a):oe(mc(c,d)):xi&&!wi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?uf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):pg?(d=Object.keys(uf.data.xs),uf.data.xs[c]=d.length>0?uf.data.xs[d[0]]:void 0):te(qg)&&(uf.data.xs[c]=lc(f,uf.data.targets)):uf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!uf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=sg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return xi&&wi&&0===c&&g&&(0===e&&(ah=[]),ah.push(g)),("undefined"==typeof a[b]||uf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),xg&&Xd(Cc(c).filter(function(a){return!(a in yg)}),xg),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&uf.data.targets[0].values[a-1]?uf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(uf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(vi?new Date(h):h);i.push(d)}return vi||(i=i.sort(function(a,b){return a-b})),i}function Lc(a){Gi=Gi.concat(a)}function Mc(a){Gi=Gi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Hi=Hi.concat(a)}function Oc(a){Hi=Hi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Dd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Dd(a,g))),Gd(e,b)):Ed(a,b,f,g)}function Fd(a,b){var c;return c=a.map(function(a){return Ed(a.values,b)}),Gd(c,b)}function Gd(a,b){var c,d;return a.forEach(function(a){var e=ve(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Hd(a,b){return tf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Id(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 Jd(){return Ag&&"desc"===Ag.toLowerCase()}function Kd(){return Ag&&"asc"===Ag.toLowerCase()}function Ld(a){var b=Kd(),c=Jd();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 Ag&&a.sort(Ag),a}function Md(a,c){var d,e,f,g,h,i,j,k=be(uf.data.targets),l=k?xd:wd,m=a.filter(function(a){return a&&b(a.value)});ii&&0!==m.length&&(dj.html(li(a,$(),l,Di)).style("display","block"),d=dj.property("offsetWidth"),e=dj.property("offsetHeight"),k?(g=Mf/2+c[0],i=Of/2+c[1]+20):(Yg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=fg(m[0].x)+20):(f=q(),g=f+t()+fg(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),dj.style("top",i+"px").style("left",g+"px"))}function Nd(){dj.style("display","none")}function Od(a){var c=a.filter(function(a){return a&&b(a.value)});ii&&($d(uf.data.targets)||be(uf.data.targets)||aj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Yg?"y1":"x1",zd).attr(Yg?"y2":"x2",zd))}function Pd(){aj.select("line."+f.xgridFocus).style("visibility","hidden")}function Qd(a){return a.x||0===a.x?fg(a.x):null}function Rd(a){return V(a.id)(a.value)}function Sd(){var a,b,d={},e=0;return Ic(Fc(ee)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Wd(a,b){return Uh?Uh:b?2*a.tickOffset()*Vh/b:0}function Xd(a,b){Dc(a).forEach(function(a){hj[a]=b===yg[a],yg[a]=b})}function Yd(a,b){var c=!1;return a.forEach(function(a){yg[a.id]===b&&(c=!0),a.id in yg||"line"!==b||(c=!0)}),c}function Zd(a){return Yd(a,"bar")}function $d(a){return Yd(a,"scatter")}function _d(a){return Yd(a,"pie")}function ae(a){return Yd(a,"donut")}function be(a){return _d(a)||ae(a)}function ce(a){var b="string"==typeof a?a:a.id;return!(b in yg)||"line"===yg[b]||"spline"===yg[b]||"area"===yg[b]||"area-spline"===yg[b]}function de(a){var b="string"==typeof a?a:a.id;return"spline"===yg[b]||"area-spline"===yg[b]}function ee(a){var b="string"==typeof a?a:a.id;return"bar"===yg[b]}function fe(a){var b="string"==typeof a?a:a.id;return"scatter"===yg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"pie"===yg[b]}function he(a){var b="string"==typeof a?a:a.id;return"donut"===yg[b]}function ie(a){return ge(a)||he(a)}function je(a){return ee(a)?a.values:[]}function ke(a){return ce(a)||fe(a)?a.values:[]}function le(a){return ee(a)||ce(a)?a.values:[]}function me(a){return he(a)&&ci||ge(a)&&Yh}function ne(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function oe(b){var c;try{c=rg?tf.time.format(rg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+rg)}return c}function pe(a,b){var c=tf.mouse(a),d=tf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function ue(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ve(a,b){var c="y"===Z(a.id)?gg:hg,d=Yg?1:0,e=Yg?0:1;return Math.pow(fg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function we(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function xe(a,b,c){Lg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd).attr("stroke",function(){return Di(b)}).attr("r",1.4*Sh).transition().duration(100).attr("r",Sh)}function ye(a,b,c){Mg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ze(a,b,c,d){a?xe(b,c,d):ye(b,c,d)}function Ae(a,b){Lg(b,a.node()),a.transition().duration(100).style("fill",function(){return tf.rgb(Di(b)).darker(1)})}function Be(a,b){Mg(b,a.node()),a.transition().duration(100).style("fill",function(){return Di(b)})}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a){return a.filter(function(a){return b(a.value)})}function Ee(a,c){return(c?aj.selectAll("."+f.circles+ld(c)):aj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Fe(a,b){Ee(a,b).classed(f.EXPANDED,!0).attr("r",Rh)}function Ge(a){Ee(a).filter(function(){return tf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oh)}function He(a){return aj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ie(a){He(a).classed(f.EXPANDED,!0)}function Je(a){He(a).classed(f.EXPANDED,!1)}function Ke(a,b){var c=Oe(a,b);return function(a,b){var d=c(a,b),e=Yg?1:0,f=Yg?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 Le(a,b){var c=Oe(a,!1),d=b?Me:Ne;return function(a,b){return d(c(a,b),a,this)}}function Me(a,b){var c;return Yg?(c=ee(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ne(a,b,c){var d=c.getBoundingClientRect();return Yg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ee(b)?-3:-6)}function Oe(a,b){var c=a.__max__+1,d=Wd(lg,c),e=Td(d,c,a,!!b),f=Ud(!!b),g=Vd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Yg&&(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 Pe(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 Qe(b){var c,d,e;if(ej=tf.select(wf),ej.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ej.html(""),ej.classed("c3",!0),uf.data.xs={},uf.data.targets=vc(b),n(),R(),fg.domain(tf.extent(_b(uf.data.targets))),gg.domain(Xb(uf.data.targets,"y")),hg.domain(Xb(uf.data.targets,"y2")),ig.domain(fg.domain()),jg.domain(gg.domain()),kg.domain(hg.domain()),fj=fg.domain(),Vi.scale(ig),Bf&&Zi.scale(fg),$i=ej.append("svg").attr("width",Mf+Jf.left+Jf.right).attr("height",Of+Jf.top+Jf.bottom).on("mouseenter",Ef).on("mouseleave",Ff),_i=$i.append("defs"),_i.append("clipPath").attr("id",pi).append("rect").attr("width",Mf).attr("height",Of),_i.append("clipPath").attr("id",qi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),_i.append("clipPath").attr("id",ri).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),aj=$i.append("g").attr("transform",Mi.main),bj=$i.append("g").attr("transform",Mi.context),cj=$i.append("g").attr("transform",Mi.legend),Pg||bj.style("visibility","hidden"),Sg||(cj.style("visibility","hidden"),Hi=Cc(uf.data.targets)),dj=tf.select(wf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),of(Cc(uf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Zg&&aj.append("g").attr("class",f.axisX).attr("clip-path",ti).attr("transform",Mi.x).append("text").attr("class",f.axisXLabel).attr("transform",Yg?"rotate(-90)":"").style("text-anchor",zb),ph&&aj.append("g").attr("class",f.axisY).attr("clip-path",ui).attr("transform",Mi.y).append("text").attr("class",f.axisYLabel).attr("transform",Yg?"":"rotate(-90)").style("text-anchor",Ab),yh&&aj.append("g").attr("class",f.axisY2).attr("transform",Mi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Yg?"":"rotate(-90)").style("text-anchor",Bb),d=aj.append("g").attr("clip-path",si).attr("class",f.grid),Hh&&d.append("g").attr("class",f.xgrids),te(Jh)&&d.append("g").attr("class",f.xgridLines),Ph&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Kh&&d.append("g").attr("class",f.ygrids),te(Lh)&&d.append("g").attr("class",f.ygridLines),aj.append("g").attr("clip-path",si).attr("class",f.regions),aj.append("g").attr("clip-path",si).attr("class",f.chart),c=aj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Bf?Yg?"ns-resize":"ew-resize":null),aj.select("."+f.chart).append("g").attr("class",f.chartBars),aj.select("."+f.chart).append("g").attr("class",f.chartLines),aj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Mi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),aj.select("."+f.chart).append("g").attr("class",f.chartTexts),Bf&&aj.insert("rect",Df?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Mf).attr("height",Of).style("opacity",0).style("cursor",Yg?"ns-resize":"ew-resize").call(Zi).on("dblclick.zoom",null),nh&&Vi.extent("function"!=typeof nh?nh:nh(_b())),bj.append("g").attr("clip-path",si).attr("class",f.chart),bj.select("."+f.chart).append("g").attr("class",f.chartBars),bj.select("."+f.chart).append("g").attr("class",f.chartLines),bj.append("g").attr("clip-path",si).attr("class",f.brush).call(Vi).selectAll("rect").attr(Yg?"width":"height",Yg?Nf:Pf),bj.append("g").attr("class",f.axisX).attr("transform",Mi.subx).attr("clip-path",Yg?"":ti),bf(uf.data.targets),Yg?aj.select("."+f.axisX).style("opacity",0).call(lg):(aj.select("."+f.axisY).style("opacity",0).call(mg),aj.select("."+f.axisY2).style("opacity",0).call(ng)),n(),R(),_e(),m(!1),Xe({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),mi){if(vi&&"string"==typeof ni){for(ni=oe(ni),e=0;e0){d=[];for(var g in tg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Id(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ce,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 Ve(a){be(uf.data.targets)||Eg&&(yi=a,aj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),zi=!0,Ng())}function We(){be(uf.data.targets)||Eg&&(aj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),aj.selectAll("."+f.shape).classed(f.INCLUDED,!1),zi=!1,Og())}function Xe(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Sd(),W=be(uf.data.targets),X=Ic(uf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?If:0,Q=D?P:0,R=E?P:0,c=aj.select("."+f.axisX).style("opacity",W?0:1),g=aj.select("."+f.axisY).style("opacity",W?0:1),h=aj.select("."+f.axisY2).style("opacity",W?0:1),e=bj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Sg&&of(Cc(uf.data.targets),a,O),wi&&(0===X.length||!H||G)&&fg.domain([0,c.selectAll(".tick").size()]),X.length&&(H&&(fg.domain(tf.extent(_b(X))),fj=fg.domain(),Bf&&Zi.scale(fg).updateScaleExtent(),ig.domain(fg.domain()),Vi.scale(ig)),G&&(fg.domain(Vi.empty()?fj:Vi.extent()),Bf&&Zi.scale(fg).updateScaleExtent())),gg.domain(Xb(X,"y")),hg.domain(Xb(X,"y2")),(gh||fh)&&(S=hh?hh:Kc(Jc(X)),lg.tickValues(S),og.tickValues(S)),O.axisX.call(lg),O.axisY.call(mg),O.axisY2.call(ng),O.axisSubX.call(og),G)if(dh&&S){for(T=1;T=0&&tf.select(this).style("display",b%U?"none":"block")})}else tf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!Yg&&ih&&eb(c),J=Ke(V),M=Le(V,!0),N=Le(V,!1),Db(),jg.domain(gg.domain()),kg.domain(hg.domain()),dj.style("display","none"),o(),aj.select("line."+f.xgridFocus).style("visibility","hidden"),Hh){if("year"===Ih){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=fg.ticks(10);i=aj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",Yg?0:function(a){return fg(a)-lg.tickOffset()}).attr("x2",Yg?Mf:function(a){return fg(a)-lg.tickOffset()}).attr("y1",Yg?function(a){return fg(a)-lg.tickOffset()}:Jf.top).attr("y2",Yg?function(a){return fg(a)-lg.tickOffset()}:Of).style("opacity",function(){return+tf.select(this).attr(Yg?"y1":"x1")===(Yg?Of:0)?0:1}),i.exit().remove()}te(Jh)&&(k=aj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Jh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",Yg?"":"rotate(-90)").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",Yg?0:Ad).attr("x2",Yg?Mf:Ad).attr("y1",Yg?Ad:Jf.top).attr("y2",Yg?Ad:Of).style("opacity",1),k.select("text").transition().duration(P).attr("x",Yg?Mf:0).attr("y",Ad).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Kh&&(m=aj.select("."+f.ygrids).selectAll("."+f.ygrid).data(gg.ticks(Mh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",Yg?gg:0).attr("x2",Yg?gg:Mf).attr("y1",Yg?0:gg).attr("y2",Yg?Of:gg),m.exit().remove()),A&&te(Lh)&&(n=aj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Lh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",Yg?"rotate(-90)":"").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",Yg?Bd:0).attr("x2",Yg?Bd:Mf).attr("y1",Yg?0:Bd).attr("y2",Yg?Of:Bd).style("opacity",1),n.select("text").transition().duration(P).attr("x",Yg?0:Mf).attr("y",Bd).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=aj.select("."+f.regions).selectAll("rect."+f.region).data(hi),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=aj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Di(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=aj.selectAll("."+f.texts).selectAll("."+f.text).data(le),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return Yg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return yd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),aj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",Wi).style("opacity",1),aj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",Xi).style("opacity",gj),q=aj.selectAll("."+f.circles).selectAll("."+f.circle).data(ke),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Oh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),q.exit().remove(),aj.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=tf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1),aj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&ie(a.data)?1:0}),aj.select("."+f.chartArcsTitle).style("opacity",ae(uf.data.targets)?1:0),Pg&&(null!==tf.event&&"zoom"===tf.event.type&&Vi.extent(fg.orgDomain()).update(),B&&(!Yg&&ih&&eb(e),Vi.empty()||Vi.extent(fg.orgDomain()).update(),K=Ke(V,!0),u=bj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Di(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),bj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",Yi).style("opacity",1))),aj.selectAll("."+f.selectedCircles).filter(function(a){return ee(a)}).selectAll("circle").remove(),aj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),v=aj.select("."+f.eventRects),te(qg)&&!oc(qg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Se(w.enter()),w.attr("x",0).attr("y",0).attr("width",Mf).attr("height",Of)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),xi&&!wi?(z=function(a,b){var c=xc(b),d=yc(b),e=uf.data.xs[a.id][b];return(fg(d?d:e+50)-fg(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=uf.data.xs[a.id][b];return(fg(d)+fg(c?c:d-50))/2}):(z=L(),y=function(a){return fg(a.x)-z/2}),x=Ac(uf.data.targets),aj.select("."+f.eventRects).datum(x?x.values:[]),w=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Re(w.enter()),w.attr("class",fd).attr("x",Yg?0:y).attr("y",Yg?y:0).attr("width",Yg?Mf:z).attr("height",Yg?z:Of),w.exit().remove()),Cc(uf.data.targets).forEach(function(a){hj[a]=!0})}function Ye(){Xe({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ze(){return"mousemove"===tf.event.sourceEvent.type&&Zi.altDomain?(fg.domain(Zi.altDomain),void Zi.scale(fg).updateScaleExtent()):(wi&&fg.orgDomain()[0]===fj[0]&&fg.domain([fj[0]-1e-10,fg.orgDomain()[1]]),Xe({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===tf.event.sourceEvent.type&&(Ai=!0)))}function $e(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function _e(){$i.attr("width",Qf).attr("height",Rf),$i.select("#"+pi).select("rect").attr("width",Mf).attr("height",Of),$i.select("#"+qi).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),$i.select("#"+ri).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),$i.select("."+f.zoomRect).attr("width",Mf).attr("height",Of),ej.style("max-height",Rf+"px")}function af(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),_e(),m(a.withTransition),Xe(a)}function bf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=aj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Di(a)}),e=aj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("fill",function(a){return Di(a)}).style("stroke","none").style("cursor",function(a){return Gg(a)?"pointer":null}),c=aj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)}),b.append("path").attr("class",dd).style("opacity",function(){return gj=+tf.select(this).style("opacity"),0}).style("fill",function(a){return Di(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Di(a)}).style("cursor",function(a){return Gg(a)?"pointer":null}),a.forEach(function(a){aj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=aj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Yf(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Di(a.data)}).style("cursor",function(a){return Gg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Fb(a),d=Lb(c),e=Tb();Nb(c.data.id),jf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Fb(a),c=[Lb(b)];Md(c,tf.mouse(this))}).on("mouseout",function(a,b){var c=Fb(a),d=Lb(c),e=Ub();Ob(c.data.id),lf(),Nd(),e(d,b)}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Pg&&(n=bj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Di(a)}),l=bj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)})),$i.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function cf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Xd(a.id,b.types[a.id]):Xd(a.id,b.type)}),uf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Ni?j:i,l=Ni?Q():P();return d&&(x=0,D=0,u=0,v=0),Sg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Ni?v:u,void(Xg?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Ni?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=cj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Ug?Ug(a):uf.toggle(a)}).on("mouseover",function(a){uf.focus(a),"function"==typeof Vg&&Vg(a)}).on("mouseout",function(a){uf.revert(),"function"==typeof Wg&&Wg(a)}),o.append("text").text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ni?h:-200).attr("y",Ni?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ni?i:-200).attr("y",Ni?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Di(a)}).attr("x",Ni?h:-200).attr("y",Ni?-200:j).attr("width",10).attr("height",10),cj.selectAll("text").data(a).text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),cj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),cj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),N(u),O(v),M(D),n(),R(),_e(),r&&m(q,c)}function pf(a){return Ec(uf.data.targets,a.id)}function qf(a){return"data"in a&&Ec(uf.data.targets,a.data.id)}function rf(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 sf(a,b,c){var d=!be(uf.data.targets);Xd(a,b),af(c||{withTransitionForAxis:d})}var tf=a.d3?a.d3:a.require?a.require("d3"):void 0,uf={data:{},axis:{},legend:{}},vf={},wf=h(["bindto"],"#chart"),xf=h(["size","width"]),yf=h(["size","height"]),zf=h(["padding","left"]),Af=h(["padding","right"]),Bf=h(["zoom","enabled"],!1),Cf=h(["zoom","extent"]),Df=h(["zoom","privileged"],!1),Ef=h(["onenter"],function(){}),Ff=h(["onleave"],function(){}),Gf=h(["onresize"],function(){}),Hf=h(["onresized"],function(){}),If=h(["transition","duration"],350);g("data","data is required in config");var Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg=h(["data","x"]),qg=h(["data","xs"],{}),rg=h(["data","x_format"]),sg=h(["data","id_converter"],function(a){return a}),tg=h(["data","names"],{}),ug=h(["data","classes"],{}),vg=h(["data","groups"],[]),wg=h(["data","axes"],{}),xg=h(["data","type"]),yg=h(["data","types"],{}),zg=h(["data","labels"],{}),Ag=h(["data","order"]),Bg=h(["data","regions"],{}),Cg=h(["data","color"]),Dg=h(["data","colors"],{}),Eg=h(["data","selection","enabled"],!1),Fg=h(["data","selection","grouped"],!1),Gg=h(["data","selection","isselectable"],function(){return!0}),Hg=h(["data","selection","multiple"],!0),Ig=h(["data","onclick"],function(){}),Jg=h(["data","onenter"],function(){}),Kg=h(["data","onleave"],function(){}),Lg=h(["data","onselected"],function(){}),Mg=h(["data","onunselected"],function(){}),Ng=h(["data","ondragstart"],function(){}),Og=h(["data","ondragend"],function(){}),Pg=h(["subchart","show"],!1),Qg=h(["subchart","size","height"],60),Rg=h(["color","pattern"],[]),Sg=h(["legend","show"],!0),Tg=h(["legend","position"],"bottom"),Ug=h(["legend","item","onclick"]),Vg=h(["legend","item","onmouseover"]),Wg=h(["legend","item","onmouseout"]),Xg=h(["legend","equally"],!1),Yg=h(["axis","rotated"],!1),Zg=h(["axis","x","show"],!0),$g=h(["axis","x","type"],"indexed"),_g=h(["axis","x","localtime"],!0),ah=h(["axis","x","categories"],[]),bh=h(["axis","x","tick","centered"],!1),ch=h(["axis","x","tick","format"]),dh=h(["axis","x","tick","culling"],{}),eh=h(["axis","x","tick","culling","max"],10),fh=h(["axis","x","tick","count"]),gh=h(["axis","x","tick","fit"],!0),hh=h(["axis","x","tick","values"],null),ih=h(["axis","x","tick","rotate"]),jh=h(["axis","x","max"],null),kh=h(["axis","x","min"],null),lh=h(["axis","x","padding"],{}),mh=h(["axis","x","height"]),nh=h(["axis","x","default"]),oh=h(["axis","x","label"],{}),ph=h(["axis","y","show"],!0),qh=h(["axis","y","max"]),rh=h(["axis","y","min"]),sh=h(["axis","y","center"]),th=h(["axis","y","label"],{}),uh=h(["axis","y","inner"],!1),vh=h(["axis","y","tick","format"]),wh=h(["axis","y","padding"],{}),xh=h(["axis","y","ticks"],10),yh=h(["axis","y2","show"],!1),zh=h(["axis","y2","max"]),Ah=h(["axis","y2","min"]),Bh=h(["axis","y2","center"]),Ch=h(["axis","y2","label"],{}),Dh=h(["axis","y2","inner"],!1),Eh=h(["axis","y2","tick","format"]),Fh=h(["axis","y2","padding"],{}),Gh=h(["axis","y2","ticks"],10),Hh=h(["grid","x","show"],!1),Ih=h(["grid","x","type"],"tick"),Jh=h(["grid","x","lines"],[]),Kh=h(["grid","y","show"],!1),Lh=h(["grid","y","lines"],[]),Mh=h(["grid","y","ticks"],10),Nh=h(["point","show"],!0),Oh=Nh?h(["point","r"],2.5):0,Ph=h(["point","focus","line","enabled"],!0),Qh=h(["point","focus","expand","enabled"],!0),Rh=h(["point","focus","expand","r"],Qh?4:Oh),Sh=h(["point","focus","select","r"],8),Th=h(["line","connect_null"],!1),Uh=h(["bar","width"]),Vh=h(["bar","width","ratio"],.6),Wh=h(["pie","label","show"],!0),Xh=h(["pie","label","format"]),Yh=h(["pie","expand"],!0),Zh=h(["pie","onclick"],function(){}),$h=h(["pie","onmouseover"],function(){}),_h=h(["pie","onmouseout"],function(){}),ai=h(["donut","label","show"],!0),bi=h(["donut","label","format"]),ci=h(["donut","expand"],!0),di=h(["donut","title"],""),ei=h(["donut","onclick"],function(){}),fi=h(["donut","onmouseover"],function(){}),gi=h(["donut","onmouseout"],function(){}),hi=h(["regions"],[]),ii=h(["tooltip","show"],!0),ji=h(["tooltip","format","title"]),ki=h(["tooltip","format","value"]),li=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ji?ji:b,l=ki?ki: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+""}),mi=h(["tooltip","init","show"],!1),ni=h(["tooltip","init","x"],0),oi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),pi=("string"==typeof wf?wf.replace("#",""):wf.id)+"-clip",qi=pi+"-xaxis",ri=pi+"-yaxis",si=i(pi),ti=i(qi),ui=i(ri),vi="timeseries"===$g,wi="categorized"===$g,xi=!vi&&(pg||te(qg)),yi=null,zi=!1,Ai=!1,Bi=!1,Ci=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Di=ne(Dg,te(Rg)?Rg:Ci,Cg),Ei=_g?tf.time.format:tf.time.format.utc,Fi=function(){var a=[[Ei("%Y/%-m/%-d"),function(){return!0}],[Ei("%-m/%-d"),function(a){return a.getMonth()}],[Ei("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ei("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ei("%I %p"),function(a){return a.getHours()}],[Ei("%I:%M"),function(a){return a.getMinutes()}],[Ei(":%S"),function(a){return a.getSeconds()}],[Ei(".%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)}}(),Gi=[],Hi=[],Ii=Yg?"left":"bottom",Ji=Yg?uh?"top":"bottom":uh?"right":"left",Ki=Yg?Dh?"bottom":"top":Dh?"left":"right",Li=Yg?"left":"bottom",Mi={main:function(){return"translate("+Jf.left+","+Jf.top+")"},context:function(){return"translate("+Kf.left+","+Kf.top+")"},legend:function(){return"translate("+Lf.left+","+Lf.top+")"},x:function(){return"translate(0,"+(Yg?0:Of)+")"},y:function(){return"translate(0,"+(Yg?Of:0)+")"},y2:function(){return"translate("+(Yg?0:Mf)+","+(Yg?1:0)+")"},subx:function(){return"translate(0,"+(Yg?0:Pf)+")"},arc:function(){return"translate("+Mf/2+","+Of/2+")"}},Ni="right"===Tg,Oi=0,Pi=0,Qi=0,Ri=.15,Si=30,Ti=Yg&&!Zg?0:30,Ui=5;Yf=tf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Vi,Wi=function(){var a=tf.svg.line().x(Yg?function(a){return V(a.id)(a.value)}:zd).y(Yg?zd:function(a){return V(a.id)(a.value)});return Th||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Th?De(b.values):b.values;return ce(b)?(a.interpolate(de(b)?"cardinal":"linear"),Bg[b.id]?Pe(e,fg,V(b.id),Bg[b.id]):a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Xi=function(){var a;return a=Yg?tf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(zd):tf.svg.area().x(zd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=De(b.values);return Yd([b],"area")||Yd([b],"area-spline")?(a.interpolate(de(b)?"cardinal":"linear"),a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Yi=function(){var a=tf.svg.line().x(Yg?function(a){return W(a.id)(a.value)}:Cd).y(Yg?Cd:function(a){return W(a.id)(a.value)});return function(b){var c=De(b.values);return ce(b)?a(c):"M "+ig(c[0].x)+" "+W(b.id)(c[0].value)}}(),Zi=function(){};Vi=tf.svg.brush().on("brush",Ye),Vi.update=function(){return bj&&bj.select("."+f.brush).call(this),this},Vi.scale=function(a){return Yg?this.y(a):this.x(a)},Bf&&(Zi=tf.behavior.zoom().on("zoomstart",function(){Zi.altDomain=tf.event.sourceEvent.altKey?fg.orgDomain():null}).on("zoom",Bf?Ze:null),Zi.scale=function(a){return Yg?this.y(a):this.x(a)},Zi.orgScaleExtent=function(){var a=Cf?Cf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},Zi.updateScaleExtent=function(){var a=ac(fg.orgDomain())/ac(fj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var $i,_i,aj,bj,cj,dj,ej,fj,gj,hj={};if(uf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),uf.defocus(),b(d.classed(f.focused,!0)),b(e),be(uf.data.targets)&&Nb(a,!0),jf(a)},uf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),kf(a)},uf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),lf()},uf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),$i.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?mf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},uf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),$i.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?nf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Ri),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},uf.toggle=function(a){Gc(a)?uf.hide(a):uf.show(a)},uf.unzoom=function(){Vi.clear().update(),Xe({withUpdateXDomain:!0})},uf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){ug[b]=a.classes[b]}),"categories"in a&&wi&&(ah=a.categories,lg.categories(ah)),"cacheIds"in a&&bc(a.cacheIds)?void cf(dc(a.cacheIds),a.done):void("unload"in a?ef(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){df(a)}):df(a))},uf.unload=function(a){ef(Dc(a),function(){Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},uf.selected=function(a){return tf.merge(aj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return tf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},uf.select=function(a,b,c){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=tf.select(this),i="circle"===this.nodeName?xe:Ae,j="circle"===this.nodeName?ye:Be,k=Fg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Gg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},uf.unselect=function(a,b){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=tf.select(this),g="circle"===this.nodeName?ye:Be,h=Fg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Gg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},uf.toLine=function(a){sf(a,"line")},uf.toSpline=function(a){sf(a,"spline")},uf.toBar=function(a){sf(a,"bar")},uf.toScatter=function(a){sf(a,"scatter")},uf.toArea=function(a){sf(a,"area")},uf.toAreaSpline=function(a){sf(a,"area-spline")},uf.toPie=function(a){sf(a,"pie",{withTransform:!0})},uf.toDonut=function(a){sf(a,"donut",{withTransform:!0})},uf.groups=function(a){return c(a)?vg:(vg=a,Xe(),vg)},uf.xgrids=function(a){return a?(Jh=a,Xe(),Jh):Jh},uf.xgrids.add=function(a){return a?uf.xgrids(Jh.concat(a)):void 0},uf.xgrids.remove=function(a){var b=rf(a);return uf.xgrids(Jh.filter(b))},uf.ygrids=function(a){return a?(Lh=a,Xe(),Lh):Lh},uf.ygrids.add=function(a){return a?uf.ygrids(Lh.concat(a)):void 0 +}dj.html(li(uf.data.targets.map(function(a){return pc(a.values[ni])}),$(),wd,Di)),dj.style("top",oi.top).style("left",oi.left).style("display","block")}null==a.onresize&&(a.onresize=$e()),a.onresize.add&&(a.onresize.add(Gf),a.onresize.add(function(){af({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})}),a.onresize.add(Hf))}function Re(a){a.append("rect").attr("class",fd).style("cursor",Eg&&Fg?"pointer":null).on("mouseover",function(a,b){if(!zi&&!be(uf.data.targets)){var c,d,e=uf.data.targets.map(function(a){return pc(a.values[b])});if(Object.keys(tg).length>0){d=[];for(var g in tg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Id(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ce,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 Ve(a){be(uf.data.targets)||Eg&&(yi=a,aj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),zi=!0,Ng())}function We(){be(uf.data.targets)||Eg&&(aj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),aj.selectAll("."+f.shape).classed(f.INCLUDED,!1),zi=!1,Og())}function Xe(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Sd(),W=be(uf.data.targets),X=Ic(uf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?If:0,Q=D?P:0,R=E?P:0,c=aj.select("."+f.axisX).style("opacity",W?0:1),g=aj.select("."+f.axisY).style("opacity",W?0:1),h=aj.select("."+f.axisY2).style("opacity",W?0:1),e=bj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Sg&&of(Cc(uf.data.targets),a,O),wi&&(0===X.length||!H||G)&&fg.domain([0,c.selectAll(".tick").size()]),X.length&&(H&&(fg.domain(tf.extent(_b(X))),fj=fg.domain(),Bf&&Zi.scale(fg).updateScaleExtent(),ig.domain(fg.domain()),Vi.scale(ig)),G&&(fg.domain(Vi.empty()?fj:Vi.extent()),Bf&&Zi.scale(fg).updateScaleExtent())),gg.domain(Xb(X,"y")),hg.domain(Xb(X,"y2")),(gh||fh)&&(S=hh?hh:Kc(Jc(X)),lg.tickValues(S),og.tickValues(S)),O.axisX.call(lg),O.axisY.call(mg),O.axisY2.call(ng),O.axisSubX.call(og),G)if(dh&&S){for(T=1;T=0&&tf.select(this).style("display",b%U?"none":"block")})}else tf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!Yg&&ih&&eb(O.axisX),J=Ke(V),M=Le(V,!0),N=Le(V,!1),Db(),jg.domain(gg.domain()),kg.domain(hg.domain()),dj.style("display","none"),o(),aj.select("line."+f.xgridFocus).style("visibility","hidden"),Hh){if("year"===Ih){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=fg.ticks(10);i=aj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",Yg?0:function(a){return fg(a)-lg.tickOffset()}).attr("x2",Yg?Mf:function(a){return fg(a)-lg.tickOffset()}).attr("y1",Yg?function(a){return fg(a)-lg.tickOffset()}:Jf.top).attr("y2",Yg?function(a){return fg(a)-lg.tickOffset()}:Of).style("opacity",function(){return+tf.select(this).attr(Yg?"y1":"x1")===(Yg?Of:0)?0:1}),i.exit().remove()}te(Jh)&&(k=aj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Jh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",Yg?"":"rotate(-90)").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",Yg?0:Ad).attr("x2",Yg?Mf:Ad).attr("y1",Yg?Ad:Jf.top).attr("y2",Yg?Ad:Of).style("opacity",1),k.select("text").transition().duration(P).attr("x",Yg?Mf:0).attr("y",Ad).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Kh&&(m=aj.select("."+f.ygrids).selectAll("."+f.ygrid).data(gg.ticks(Mh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",Yg?gg:0).attr("x2",Yg?gg:Mf).attr("y1",Yg?0:gg).attr("y2",Yg?Of:gg),m.exit().remove()),A&&te(Lh)&&(n=aj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Lh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",Yg?"rotate(-90)":"").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",Yg?Bd:0).attr("x2",Yg?Bd:Mf).attr("y1",Yg?0:Bd).attr("y2",Yg?Of:Bd).style("opacity",1),n.select("text").transition().duration(P).attr("x",Yg?0:Mf).attr("y",Bd).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=aj.select("."+f.regions).selectAll("rect."+f.region).data(hi),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=aj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Di(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=aj.selectAll("."+f.texts).selectAll("."+f.text).data(le),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return Yg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return yd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),aj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",Wi).style("opacity",1),aj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",Xi).style("opacity",gj),q=aj.selectAll("."+f.circles).selectAll("."+f.circle).data(ke),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Oh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),q.exit().remove(),aj.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=tf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1),aj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&ie(a.data)?1:0}),aj.select("."+f.chartArcsTitle).style("opacity",ae(uf.data.targets)?1:0),Pg&&(null!==tf.event&&"zoom"===tf.event.type&&Vi.extent(fg.orgDomain()).update(),B&&(!Yg&&ih&&eb(O.axisSubX),Vi.empty()||Vi.extent(fg.orgDomain()).update(),K=Ke(V,!0),u=bj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Di(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),bj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",Yi).style("opacity",1))),aj.selectAll("."+f.selectedCircles).filter(function(a){return ee(a)}).selectAll("circle").remove(),aj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),v=aj.select("."+f.eventRects),te(qg)&&!oc(qg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Se(w.enter()),w.attr("x",0).attr("y",0).attr("width",Mf).attr("height",Of)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),xi&&!wi?(z=function(a,b){var c=xc(b),d=yc(b),e=uf.data.xs[a.id][b];return(fg(d?d:e+50)-fg(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=uf.data.xs[a.id][b];return(fg(d)+fg(c?c:d-50))/2}):(z=L(),y=function(a){return fg(a.x)-z/2}),x=Ac(uf.data.targets),aj.select("."+f.eventRects).datum(x?x.values:[]),w=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Re(w.enter()),w.attr("class",fd).attr("x",Yg?0:y).attr("y",Yg?y:0).attr("width",Yg?Mf:z).attr("height",Yg?z:Of),w.exit().remove()),Cc(uf.data.targets).forEach(function(a){hj[a]=!0})}function Ye(){Xe({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ze(){return"mousemove"===tf.event.sourceEvent.type&&Zi.altDomain?(fg.domain(Zi.altDomain),void Zi.scale(fg).updateScaleExtent()):(wi&&fg.orgDomain()[0]===fj[0]&&fg.domain([fj[0]-1e-10,fg.orgDomain()[1]]),Xe({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===tf.event.sourceEvent.type&&(Ai=!0)))}function $e(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function _e(){$i.attr("width",Qf).attr("height",Rf),$i.select("#"+pi).select("rect").attr("width",Mf).attr("height",Of),$i.select("#"+qi).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),$i.select("#"+ri).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),$i.select("."+f.zoomRect).attr("width",Mf).attr("height",Of),ej.style("max-height",Rf+"px")}function af(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),_e(),m(a.withTransition),Xe(a)}function bf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=aj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Di(a)}),e=aj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("fill",function(a){return Di(a)}).style("stroke","none").style("cursor",function(a){return Gg(a)?"pointer":null}),c=aj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)}),b.append("path").attr("class",dd).style("opacity",function(){return gj=+tf.select(this).style("opacity"),0}).style("fill",function(a){return Di(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Di(a)}).style("cursor",function(a){return Gg(a)?"pointer":null}),a.forEach(function(a){aj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=aj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Yf(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Di(a.data)}).style("cursor",function(a){return Gg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Fb(a),d=Lb(c),e=Tb();Nb(c.data.id),jf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Fb(a),c=[Lb(b)];Md(c,tf.mouse(this))}).on("mouseout",function(a,b){var c=Fb(a),d=Lb(c),e=Ub();Ob(c.data.id),lf(),Nd(),e(d,b)}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Pg&&(n=bj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Di(a)}),l=bj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)})),$i.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function cf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Xd(a.id,b.types[a.id]):Xd(a.id,b.type)}),uf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Ni?j:i,l=Ni?Q():P();return d&&(x=0,D=0,u=0,v=0),Sg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Ni?v:u,void(Xg?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Ni?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=cj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Ug?Ug(a):uf.toggle(a)}).on("mouseover",function(a){uf.focus(a),"function"==typeof Vg&&Vg(a)}).on("mouseout",function(a){uf.revert(),"function"==typeof Wg&&Wg(a)}),o.append("text").text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ni?h:-200).attr("y",Ni?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ni?i:-200).attr("y",Ni?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Di(a)}).attr("x",Ni?h:-200).attr("y",Ni?-200:j).attr("width",10).attr("height",10),cj.selectAll("text").data(a).text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),cj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),cj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),N(u),O(v),M(D),n(),R(),_e(),r&&m(q,c)}function pf(a){return Ec(uf.data.targets,a.id)}function qf(a){return"data"in a&&Ec(uf.data.targets,a.data.id)}function rf(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 sf(a,b,c){var d=!be(uf.data.targets);Xd(a,b),af(c||{withTransitionForAxis:d})}var tf=a.d3?a.d3:a.require?a.require("d3"):void 0,uf={data:{},axis:{},legend:{}},vf={},wf=h(["bindto"],"#chart"),xf=h(["size","width"]),yf=h(["size","height"]),zf=h(["padding","left"]),Af=h(["padding","right"]),Bf=h(["zoom","enabled"],!1),Cf=h(["zoom","extent"]),Df=h(["zoom","privileged"],!1),Ef=h(["onenter"],function(){}),Ff=h(["onleave"],function(){}),Gf=h(["onresize"],function(){}),Hf=h(["onresized"],function(){}),If=h(["transition","duration"],350);g("data","data is required in config");var Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg=h(["data","x"]),qg=h(["data","xs"],{}),rg=h(["data","x_format"]),sg=h(["data","id_converter"],function(a){return a}),tg=h(["data","names"],{}),ug=h(["data","classes"],{}),vg=h(["data","groups"],[]),wg=h(["data","axes"],{}),xg=h(["data","type"]),yg=h(["data","types"],{}),zg=h(["data","labels"],{}),Ag=h(["data","order"]),Bg=h(["data","regions"],{}),Cg=h(["data","color"]),Dg=h(["data","colors"],{}),Eg=h(["data","selection","enabled"],!1),Fg=h(["data","selection","grouped"],!1),Gg=h(["data","selection","isselectable"],function(){return!0}),Hg=h(["data","selection","multiple"],!0),Ig=h(["data","onclick"],function(){}),Jg=h(["data","onenter"],function(){}),Kg=h(["data","onleave"],function(){}),Lg=h(["data","onselected"],function(){}),Mg=h(["data","onunselected"],function(){}),Ng=h(["data","ondragstart"],function(){}),Og=h(["data","ondragend"],function(){}),Pg=h(["subchart","show"],!1),Qg=h(["subchart","size","height"],60),Rg=h(["color","pattern"],[]),Sg=h(["legend","show"],!0),Tg=h(["legend","position"],"bottom"),Ug=h(["legend","item","onclick"]),Vg=h(["legend","item","onmouseover"]),Wg=h(["legend","item","onmouseout"]),Xg=h(["legend","equally"],!1),Yg=h(["axis","rotated"],!1),Zg=h(["axis","x","show"],!0),$g=h(["axis","x","type"],"indexed"),_g=h(["axis","x","localtime"],!0),ah=h(["axis","x","categories"],[]),bh=h(["axis","x","tick","centered"],!1),ch=h(["axis","x","tick","format"]),dh=h(["axis","x","tick","culling"],{}),eh=h(["axis","x","tick","culling","max"],10),fh=h(["axis","x","tick","count"]),gh=h(["axis","x","tick","fit"],!0),hh=h(["axis","x","tick","values"],null),ih=h(["axis","x","tick","rotate"]),jh=h(["axis","x","max"],null),kh=h(["axis","x","min"],null),lh=h(["axis","x","padding"],{}),mh=h(["axis","x","height"]),nh=h(["axis","x","default"]),oh=h(["axis","x","label"],{}),ph=h(["axis","y","show"],!0),qh=h(["axis","y","max"]),rh=h(["axis","y","min"]),sh=h(["axis","y","center"]),th=h(["axis","y","label"],{}),uh=h(["axis","y","inner"],!1),vh=h(["axis","y","tick","format"]),wh=h(["axis","y","padding"],{}),xh=h(["axis","y","ticks"],10),yh=h(["axis","y2","show"],!1),zh=h(["axis","y2","max"]),Ah=h(["axis","y2","min"]),Bh=h(["axis","y2","center"]),Ch=h(["axis","y2","label"],{}),Dh=h(["axis","y2","inner"],!1),Eh=h(["axis","y2","tick","format"]),Fh=h(["axis","y2","padding"],{}),Gh=h(["axis","y2","ticks"],10),Hh=h(["grid","x","show"],!1),Ih=h(["grid","x","type"],"tick"),Jh=h(["grid","x","lines"],[]),Kh=h(["grid","y","show"],!1),Lh=h(["grid","y","lines"],[]),Mh=h(["grid","y","ticks"],10),Nh=h(["point","show"],!0),Oh=Nh?h(["point","r"],2.5):0,Ph=h(["point","focus","line","enabled"],!0),Qh=h(["point","focus","expand","enabled"],!0),Rh=h(["point","focus","expand","r"],Qh?4:Oh),Sh=h(["point","focus","select","r"],8),Th=h(["line","connect_null"],!1),Uh=h(["bar","width"]),Vh=h(["bar","width","ratio"],.6),Wh=h(["pie","label","show"],!0),Xh=h(["pie","label","format"]),Yh=h(["pie","expand"],!0),Zh=h(["pie","onclick"],function(){}),$h=h(["pie","onmouseover"],function(){}),_h=h(["pie","onmouseout"],function(){}),ai=h(["donut","label","show"],!0),bi=h(["donut","label","format"]),ci=h(["donut","expand"],!0),di=h(["donut","title"],""),ei=h(["donut","onclick"],function(){}),fi=h(["donut","onmouseover"],function(){}),gi=h(["donut","onmouseout"],function(){}),hi=h(["regions"],[]),ii=h(["tooltip","show"],!0),ji=h(["tooltip","format","title"]),ki=h(["tooltip","format","value"]),li=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ji?ji:b,l=ki?ki: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+""}),mi=h(["tooltip","init","show"],!1),ni=h(["tooltip","init","x"],0),oi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),pi=("string"==typeof wf?wf.replace("#",""):wf.id)+"-clip",qi=pi+"-xaxis",ri=pi+"-yaxis",si=i(pi),ti=i(qi),ui=i(ri),vi="timeseries"===$g,wi="categorized"===$g,xi=!vi&&(pg||te(qg)),yi=null,zi=!1,Ai=!1,Bi=!1,Ci=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Di=ne(Dg,te(Rg)?Rg:Ci,Cg),Ei=_g?tf.time.format:tf.time.format.utc,Fi=function(){var a=[[Ei("%Y/%-m/%-d"),function(){return!0}],[Ei("%-m/%-d"),function(a){return a.getMonth()}],[Ei("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ei("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ei("%I %p"),function(a){return a.getHours()}],[Ei("%I:%M"),function(a){return a.getMinutes()}],[Ei(":%S"),function(a){return a.getSeconds()}],[Ei(".%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)}}(),Gi=[],Hi=[],Ii=Yg?"left":"bottom",Ji=Yg?uh?"top":"bottom":uh?"right":"left",Ki=Yg?Dh?"bottom":"top":Dh?"left":"right",Li=Yg?"left":"bottom",Mi={main:function(){return"translate("+Jf.left+","+Jf.top+")"},context:function(){return"translate("+Kf.left+","+Kf.top+")"},legend:function(){return"translate("+Lf.left+","+Lf.top+")"},x:function(){return"translate(0,"+(Yg?0:Of)+")"},y:function(){return"translate(0,"+(Yg?Of:0)+")"},y2:function(){return"translate("+(Yg?0:Mf)+","+(Yg?1:0)+")"},subx:function(){return"translate(0,"+(Yg?0:Pf)+")"},arc:function(){return"translate("+Mf/2+","+Of/2+")"}},Ni="right"===Tg,Oi=0,Pi=0,Qi=0,Ri=.15,Si=30,Ti=Yg&&!Zg?0:30,Ui=5;Yf=tf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Vi,Wi=function(){var a=tf.svg.line().x(Yg?function(a){return V(a.id)(a.value)}:zd).y(Yg?zd:function(a){return V(a.id)(a.value)});return Th||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Th?De(b.values):b.values;return ce(b)?(a.interpolate(de(b)?"cardinal":"linear"),Bg[b.id]?Pe(e,fg,V(b.id),Bg[b.id]):a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Xi=function(){var a;return a=Yg?tf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(zd):tf.svg.area().x(zd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=De(b.values);return Yd([b],"area")||Yd([b],"area-spline")?(a.interpolate(de(b)?"cardinal":"linear"),a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Yi=function(){var a=tf.svg.line().x(Yg?function(a){return W(a.id)(a.value)}:Cd).y(Yg?Cd:function(a){return W(a.id)(a.value)});return function(b){var c=De(b.values);return ce(b)?a(c):"M "+ig(c[0].x)+" "+W(b.id)(c[0].value)}}(),Zi=function(){};Vi=tf.svg.brush().on("brush",Ye),Vi.update=function(){return bj&&bj.select("."+f.brush).call(this),this},Vi.scale=function(a){return Yg?this.y(a):this.x(a)},Bf&&(Zi=tf.behavior.zoom().on("zoomstart",function(){Zi.altDomain=tf.event.sourceEvent.altKey?fg.orgDomain():null}).on("zoom",Bf?Ze:null),Zi.scale=function(a){return Yg?this.y(a):this.x(a)},Zi.orgScaleExtent=function(){var a=Cf?Cf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},Zi.updateScaleExtent=function(){var a=ac(fg.orgDomain())/ac(fj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var $i,_i,aj,bj,cj,dj,ej,fj,gj,hj={};if(uf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),uf.defocus(),b(d.classed(f.focused,!0)),b(e),be(uf.data.targets)&&Nb(a,!0),jf(a)},uf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),kf(a)},uf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),lf()},uf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),$i.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?mf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},uf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),$i.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?nf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Ri),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},uf.toggle=function(a){Gc(a)?uf.hide(a):uf.show(a)},uf.unzoom=function(){Vi.clear().update(),Xe({withUpdateXDomain:!0})},uf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){ug[b]=a.classes[b]}),"categories"in a&&wi&&(ah=a.categories,lg.categories(ah)),"cacheIds"in a&&bc(a.cacheIds)?void cf(dc(a.cacheIds),a.done):void("unload"in a?ef(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){df(a)}):df(a))},uf.unload=function(a){ef(Dc(a),function(){Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},uf.selected=function(a){return tf.merge(aj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return tf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},uf.select=function(a,b,c){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=tf.select(this),i="circle"===this.nodeName?xe:Ae,j="circle"===this.nodeName?ye:Be,k=Fg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Gg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},uf.unselect=function(a,b){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=tf.select(this),g="circle"===this.nodeName?ye:Be,h=Fg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Gg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},uf.toLine=function(a){sf(a,"line")},uf.toSpline=function(a){sf(a,"spline")},uf.toBar=function(a){sf(a,"bar")},uf.toScatter=function(a){sf(a,"scatter")},uf.toArea=function(a){sf(a,"area")},uf.toAreaSpline=function(a){sf(a,"area-spline")},uf.toPie=function(a){sf(a,"pie",{withTransform:!0})},uf.toDonut=function(a){sf(a,"donut",{withTransform:!0})},uf.groups=function(a){return c(a)?vg:(vg=a,Xe(),vg)},uf.xgrids=function(a){return a?(Jh=a,Xe(),Jh):Jh},uf.xgrids.add=function(a){return a?uf.xgrids(Jh.concat(a)):void 0},uf.xgrids.remove=function(a){var b=rf(a);return uf.xgrids(Jh.filter(b))},uf.ygrids=function(a){return a?(Lh=a,Xe(),Lh):Lh},uf.ygrids.add=function(a){return a?uf.ygrids(Lh.concat(a)):void 0 },uf.ygrids.remove=function(a){var b=rf(a);return uf.ygrids(Lh.filter(b))},uf.regions=function(a){return c(a)?hi:(hi=a,Xe(),hi)},uf.regions.add=function(a){return c(a)?hi:(hi=hi.concat(a),Xe(),hi)},uf.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;$i.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),hi=hi.filter(function(b){return b.classes.indexOf(a)<0})}),hi},uf.data.get=function(a){var b=uf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},uf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},uf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){tg[b]=a[b]}),of(Cc(uf.data.targets),{withTransition:!0}),tg):tg},uf.x=function(a){return arguments.length&&(qc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.xs=function(a){return arguments.length&&(rc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},uf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(qh=+a.y),b(a.y2)&&(zh=+a.y2)):qh=zh=+a,Xe())},uf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(rh=+a.y),b(a.y2)&&(Ah=+a.y2)):rh=Ah=+a,Xe())},uf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&uf.axis.max(a.max),"undefined"!=typeof a.min&&uf.axis.min(a.min))},uf.legend.show=function(a){Sg||(Sg=!0,cj.style("visibility","visible")),mf(Dc(a)),Xe({withLegend:!0})},uf.legend.hide=function(a){nf(Dc(a)),Xe({withLegend:!0}),Sg&&se(a)&&(Sg=!1,cj.style("visibility","hidden"))},uf.resize=function(a){xf=a?a.width:null,yf=a?a.height:null,af({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},uf.destroy=function(){uf.data.targets=void 0,uf.data.xs={},ej.html(""),a.onresize=null},"url"in e.data)tf.xhr(e.data.url,function(a,b){var c,d=tf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=tf.csv.parse(b.response),Qe(c)});else if("rows"in e.data)Qe(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Qe(uc(e.data.columns))}return uf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 27254eaa9de44d173dc526aae5062211b91d7f9e Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Sun, 27 Apr 2014 21:29:50 +0900 Subject: [PATCH 072/178] Fix x tick rotate on Firefox --- c3.js | 13 +++++++------ c3.min.js | 4 ++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/c3.js b/c3.js index 0eafb80..b4f2eb4 100644 --- a/c3.js +++ b/c3.js @@ -729,12 +729,13 @@ function yForRotatedTickText(r) { return 11.5 - 2.5 * (r / 15); } - function rotateTickText(axis) { + function rotateTickText(axis, transition, rotate) { axis.selectAll('.tick text') - .attr("y", yForRotatedTickText(__axis_x_tick_rotate)) - .attr("x", xForRotatedTickText(__axis_x_tick_rotate)) - .attr("transform", "rotate(" + __axis_x_tick_rotate + ")") .style("text-anchor", "start"); + transition.selectAll('.tick text') + .attr("y", yForRotatedTickText(rotate)) + .attr("x", xForRotatedTickText(rotate)) + .attr("transform", "rotate(" + rotate + ")"); } function getAxisLabelPosition(axisId, defaultPosition) { var option = getAxisLabelOptionByAxisId(axisId), @@ -3193,7 +3194,7 @@ // rotate tick text if needed if (!__axis_rotated && __axis_x_tick_rotate) { - rotateTickText(transitions.axisX); + rotateTickText(xaxis, transitions.axisX, __axis_x_tick_rotate); } // setup drawer - MEMO: these must be called after axis updated @@ -3441,7 +3442,7 @@ // rotate tick text if needed if (!__axis_rotated && __axis_x_tick_rotate) { - rotateTickText(transitions.axisSubX); + rotateTickText(subxaxis, transitions.axisSubX, __axis_x_tick_rotate); } // extent rect diff --git a/c3.min.js b/c3.min.js index 4a7112f..f7845db 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.32"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cMf&&(Mf=0),0>Of&&(Of=0),Nf=Yg?Jf.left-Si-Ti:Mf,Pf=Yg?Of:Rf-Kf.top-Kf.bottom,0>Nf&&(Nf=0),0>Pf&&(Pf=0),p(),Ni&&be(uf.data.targets)&&(Lf.left=Mf/2+Tf)}function o(){aj.select("line."+f.xgridFocus).attr("x1",Yg?0:-10).attr("x2",Yg?Mf:-10).attr("y1",Yg?-10:Jf.top).attr("y2",Yg?-10:Of)}function p(){Tf=Of/2,Sf=.95*Tf,Uf=ae(uf.data.targets)?.6*Sf:0}function q(){var a=Yg?f.axisX:f.axisY,b=tf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=tf.select(wf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return xf?xf:x()}function s(){var a=yf?yf:y();return a>0?a:320}function t(){return be(uf.data.targets)?0:zf?zf:Yg?Zg?v("x"):1:!ph||uh?1:v("y")}function u(){var a=1;return be(uf.data.targets)?0:Af?Af:Ni?P()+(yh&&!Yg?v("y2"):a):yh?Dh||Yg?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||Zg?"x"===a&&mh?mh:"y"!==a||ph?"y2"!==a||yh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Ui:Sg&&!Ni?10:1:0}function x(){return+tf.select(wf).style("width").replace("px","")}function y(){return+tf.select(wf).style("height").replace("px","")}function z(a){return a?-5:-(Jf.left-1)}function A(a){return a?-20:-4}function B(){return z(!Yg)}function C(){return A(!Yg)}function D(){return z(Yg)}function E(){return A(Yg)}function F(a){return a?Mf+2+4:Jf.left+20}function G(a){return a?(mh?mh:0)+80:Of+8}function H(){return F(!Yg)}function I(){return G(!Yg)}function J(){return F(Yg)}function K(){return G(Yg)}function L(){var a=Ac(uf.data.targets),b=a.values[0],c=a.values[a.values.length-1],d=fg(c.x)-fg(b.x),e=zc(),f=Zd(uf.data.targets)?(e-(wi?.25:1))/e:1;return e>1?d*f/(e-1):d}function M(a){Oi=a}function N(a){Pi=a}function O(a){Qi=a}function P(){return Sg?Ni?Pi*(Oi+1):Qf:0}function Q(){return Sg?Ni?Rf:Qi*(Oi+1):0}function R(){var a,b=!fg;Zf=Yg?1:0,$f=Yg?Of:Mf,_f=Yg?0:Of,ag=Yg?Mf:1,bg=Zf,cg=$f,dg=Yg?0:Pf,eg=Yg?Nf:1,fg=T(Zf,$f,b?void 0:fg.domain(),function(){return lg.tickOffset()}),gg=U(_f,ag,b?void 0:gg.domain()),hg=U(_f,ag,b?void 0:hg.domain()),ig=T(Zf,$f,fj,function(a){return a%1?0:og.tickOffset()}),jg=U(dg,eg,b?void 0:jg.domain()),kg=U(dg,eg,b?void 0:kg.domain()),a=$(),lg=X(fg,Ii,a),og=X(ig,Li,a),mg=Y(gg,Ji,vh,xh),ng=Y(hg,Ki,Eh,Gh),b||(Vi.scale(ig),Bf&&Zi.scale(fg)),S()}function S(){Vf=Gb(),Wf=Hb(),Xf=Hb(.98)}function T(a,b,d,e){var f=(vi?tf.time.scale():tf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),wi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=tf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?hg:gg}function W(a){return"y2"===Z(a)?kg:jg}function X(a,b,c){var d=(wi?Eb():tf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),wi?(d.tickCentered(bh),se(dh)&&(dh=!1)):d.tickOffset=function(){var a=Bc(uf.data.targets),b=fg(a[1])-fg(a[0]);return b/zc()/2},wi&&d.categories(ah),d}function Y(a,b,c,d){return tf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in wg?wg[a]:"y"}function $(){var a=vi?Fi:wi?Tc:function(a){return 0>a?a.toFixed(0):a};return ch&&("function"==typeof ch?a=ch:vi&&(a=function(a){return a?Ei(ch)(a):""})),a}function _(a){var b;return"y"===a?b=th:"y2"===a?b=Ch:"x"===a&&(b=oh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?th=b:"y2"===a?Ch=b:"x"===a&&(oh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a){a.selectAll(".tick text").attr("y",db(ih)).attr("x",cb(ih)).attr("transform","rotate("+ih+")").style("text-anchor","start")}function fb(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 gb(){return fb("x",Yg?"inner-top":"inner-right")}function hb(){return fb("y",Yg?"inner-right":"inner-top")}function ib(){return fb("y2",Yg?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Mf/2:Mf:b.isBottom?-Of:b.isMiddle?-Of/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!Yg,gb())}function rb(){return nb(Yg,hb())}function sb(){return nb(Yg,ib())}function tb(){return ob(!Yg,gb())}function ub(){return ob(Yg,hb())}function vb(){return ob(Yg,ib())}function wb(){var a=gb();return Yg?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":mh?mh-10:"3em"}function xb(){var a=hb();return Yg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return Yg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!Yg,gb())}function Ab(){return pb(Yg,hb())}function Bb(){return pb(Yg,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return tf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?30:b}function Db(){aj.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),aj.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),aj.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 tf.min(Object.keys(i).map(function(a){return tf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(vg.length>0)for(g=Sc(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 tf.max(Object.keys(i).map(function(a){return tf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Ah:rh,n="y2"===c?zh:qh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Bh:sh,r=ud()&&Yg;return 0===l.length?"y2"===c?hg.domain():gg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(gg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&wh&&(f=b(wh.top)?wh.top:e,g=b(wh.bottom)?wh.bottom:e),"y2"===c&&Fh&&(f=b(Fh.top)?Fh.top:e,g=b(Fh.bottom)?Fh.bottom:e),Zd(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return kh?vi?oe(kh):kh:tf.min(a,function(a){return tf.min(a.values,function(a){return a.x})})}function Zb(a){return jh?vi?oe(jh):jh:tf.max(a,function(a){return tf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return wi?d=0:Zd(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof lh&&te(lh)?(e=b(lh.left)?lh.left:d,f=b(lh.right)?lh.right:d):e=f="number"==typeof lh?lh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?gg:hg;return b="y"===a.axis||"y2"===a.axis?Yg?Of:"start"in a?d(a.start):Of:Yg?"end"in a?fg(vi?oe(a.end):a.end):Of:Of,c>b?0:b-c}function ic(a){return pg&&a===pg||te(qg)&&ue(qg,a)}function jc(a){return!ic(a)}function kc(a){return pg?pg:te(qg)?qg[a]:null}function lc(a,b){var c,d=b&&te(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=uf.data.xs[b])}),c}function mc(a,b){return a in uf.data.xs&&uf.data.xs[a]&&uf.data.xs[a][b]?uf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){qg[b]=a[b]})}function oc(a){return 1===tf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=tg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),uf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=vi?a?a instanceof Date?a:oe(a):oe(mc(c,d)):xi&&!wi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?uf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):pg?(d=Object.keys(uf.data.xs),uf.data.xs[c]=d.length>0?uf.data.xs[d[0]]:void 0):te(qg)&&(uf.data.xs[c]=lc(f,uf.data.targets)):uf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!uf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=sg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return xi&&wi&&0===c&&g&&(0===e&&(ah=[]),ah.push(g)),("undefined"==typeof a[b]||uf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),xg&&Xd(Cc(c).filter(function(a){return!(a in yg)}),xg),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&uf.data.targets[0].values[a-1]?uf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(uf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(vi?new Date(h):h);i.push(d)}return vi||(i=i.sort(function(a,b){return a-b})),i}function Lc(a){Gi=Gi.concat(a)}function Mc(a){Gi=Gi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Hi=Hi.concat(a)}function Oc(a){Hi=Hi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Dd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Dd(a,g))),Gd(e,b)):Ed(a,b,f,g)}function Fd(a,b){var c;return c=a.map(function(a){return Ed(a.values,b)}),Gd(c,b)}function Gd(a,b){var c,d;return a.forEach(function(a){var e=ve(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Hd(a,b){return tf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Id(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 Jd(){return Ag&&"desc"===Ag.toLowerCase()}function Kd(){return Ag&&"asc"===Ag.toLowerCase()}function Ld(a){var b=Kd(),c=Jd();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 Ag&&a.sort(Ag),a}function Md(a,c){var d,e,f,g,h,i,j,k=be(uf.data.targets),l=k?xd:wd,m=a.filter(function(a){return a&&b(a.value)});ii&&0!==m.length&&(dj.html(li(a,$(),l,Di)).style("display","block"),d=dj.property("offsetWidth"),e=dj.property("offsetHeight"),k?(g=Mf/2+c[0],i=Of/2+c[1]+20):(Yg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=fg(m[0].x)+20):(f=q(),g=f+t()+fg(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),dj.style("top",i+"px").style("left",g+"px"))}function Nd(){dj.style("display","none")}function Od(a){var c=a.filter(function(a){return a&&b(a.value)});ii&&($d(uf.data.targets)||be(uf.data.targets)||aj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Yg?"y1":"x1",zd).attr(Yg?"y2":"x2",zd))}function Pd(){aj.select("line."+f.xgridFocus).style("visibility","hidden")}function Qd(a){return a.x||0===a.x?fg(a.x):null}function Rd(a){return V(a.id)(a.value)}function Sd(){var a,b,d={},e=0;return Ic(Fc(ee)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Wd(a,b){return Uh?Uh:b?2*a.tickOffset()*Vh/b:0}function Xd(a,b){Dc(a).forEach(function(a){hj[a]=b===yg[a],yg[a]=b})}function Yd(a,b){var c=!1;return a.forEach(function(a){yg[a.id]===b&&(c=!0),a.id in yg||"line"!==b||(c=!0)}),c}function Zd(a){return Yd(a,"bar")}function $d(a){return Yd(a,"scatter")}function _d(a){return Yd(a,"pie")}function ae(a){return Yd(a,"donut")}function be(a){return _d(a)||ae(a)}function ce(a){var b="string"==typeof a?a:a.id;return!(b in yg)||"line"===yg[b]||"spline"===yg[b]||"area"===yg[b]||"area-spline"===yg[b]}function de(a){var b="string"==typeof a?a:a.id;return"spline"===yg[b]||"area-spline"===yg[b]}function ee(a){var b="string"==typeof a?a:a.id;return"bar"===yg[b]}function fe(a){var b="string"==typeof a?a:a.id;return"scatter"===yg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"pie"===yg[b]}function he(a){var b="string"==typeof a?a:a.id;return"donut"===yg[b]}function ie(a){return ge(a)||he(a)}function je(a){return ee(a)?a.values:[]}function ke(a){return ce(a)||fe(a)?a.values:[]}function le(a){return ee(a)||ce(a)?a.values:[]}function me(a){return he(a)&&ci||ge(a)&&Yh}function ne(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function oe(b){var c;try{c=rg?tf.time.format(rg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+rg)}return c}function pe(a,b){var c=tf.mouse(a),d=tf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function ue(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ve(a,b){var c="y"===Z(a.id)?gg:hg,d=Yg?1:0,e=Yg?0:1;return Math.pow(fg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function we(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function xe(a,b,c){Lg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd).attr("stroke",function(){return Di(b)}).attr("r",1.4*Sh).transition().duration(100).attr("r",Sh)}function ye(a,b,c){Mg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ze(a,b,c,d){a?xe(b,c,d):ye(b,c,d)}function Ae(a,b){Lg(b,a.node()),a.transition().duration(100).style("fill",function(){return tf.rgb(Di(b)).darker(1)})}function Be(a,b){Mg(b,a.node()),a.transition().duration(100).style("fill",function(){return Di(b)})}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a){return a.filter(function(a){return b(a.value)})}function Ee(a,c){return(c?aj.selectAll("."+f.circles+ld(c)):aj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Fe(a,b){Ee(a,b).classed(f.EXPANDED,!0).attr("r",Rh)}function Ge(a){Ee(a).filter(function(){return tf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oh)}function He(a){return aj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ie(a){He(a).classed(f.EXPANDED,!0)}function Je(a){He(a).classed(f.EXPANDED,!1)}function Ke(a,b){var c=Oe(a,b);return function(a,b){var d=c(a,b),e=Yg?1:0,f=Yg?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 Le(a,b){var c=Oe(a,!1),d=b?Me:Ne;return function(a,b){return d(c(a,b),a,this)}}function Me(a,b){var c;return Yg?(c=ee(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ne(a,b,c){var d=c.getBoundingClientRect();return Yg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ee(b)?-3:-6)}function Oe(a,b){var c=a.__max__+1,d=Wd(lg,c),e=Td(d,c,a,!!b),f=Ud(!!b),g=Vd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Yg&&(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 Pe(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 Qe(b){var c,d,e;if(ej=tf.select(wf),ej.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ej.html(""),ej.classed("c3",!0),uf.data.xs={},uf.data.targets=vc(b),n(),R(),fg.domain(tf.extent(_b(uf.data.targets))),gg.domain(Xb(uf.data.targets,"y")),hg.domain(Xb(uf.data.targets,"y2")),ig.domain(fg.domain()),jg.domain(gg.domain()),kg.domain(hg.domain()),fj=fg.domain(),Vi.scale(ig),Bf&&Zi.scale(fg),$i=ej.append("svg").attr("width",Mf+Jf.left+Jf.right).attr("height",Of+Jf.top+Jf.bottom).on("mouseenter",Ef).on("mouseleave",Ff),_i=$i.append("defs"),_i.append("clipPath").attr("id",pi).append("rect").attr("width",Mf).attr("height",Of),_i.append("clipPath").attr("id",qi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),_i.append("clipPath").attr("id",ri).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),aj=$i.append("g").attr("transform",Mi.main),bj=$i.append("g").attr("transform",Mi.context),cj=$i.append("g").attr("transform",Mi.legend),Pg||bj.style("visibility","hidden"),Sg||(cj.style("visibility","hidden"),Hi=Cc(uf.data.targets)),dj=tf.select(wf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),of(Cc(uf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Zg&&aj.append("g").attr("class",f.axisX).attr("clip-path",ti).attr("transform",Mi.x).append("text").attr("class",f.axisXLabel).attr("transform",Yg?"rotate(-90)":"").style("text-anchor",zb),ph&&aj.append("g").attr("class",f.axisY).attr("clip-path",ui).attr("transform",Mi.y).append("text").attr("class",f.axisYLabel).attr("transform",Yg?"":"rotate(-90)").style("text-anchor",Ab),yh&&aj.append("g").attr("class",f.axisY2).attr("transform",Mi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Yg?"":"rotate(-90)").style("text-anchor",Bb),d=aj.append("g").attr("clip-path",si).attr("class",f.grid),Hh&&d.append("g").attr("class",f.xgrids),te(Jh)&&d.append("g").attr("class",f.xgridLines),Ph&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Kh&&d.append("g").attr("class",f.ygrids),te(Lh)&&d.append("g").attr("class",f.ygridLines),aj.append("g").attr("clip-path",si).attr("class",f.regions),aj.append("g").attr("clip-path",si).attr("class",f.chart),c=aj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Bf?Yg?"ns-resize":"ew-resize":null),aj.select("."+f.chart).append("g").attr("class",f.chartBars),aj.select("."+f.chart).append("g").attr("class",f.chartLines),aj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Mi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),aj.select("."+f.chart).append("g").attr("class",f.chartTexts),Bf&&aj.insert("rect",Df?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Mf).attr("height",Of).style("opacity",0).style("cursor",Yg?"ns-resize":"ew-resize").call(Zi).on("dblclick.zoom",null),nh&&Vi.extent("function"!=typeof nh?nh:nh(_b())),bj.append("g").attr("clip-path",si).attr("class",f.chart),bj.select("."+f.chart).append("g").attr("class",f.chartBars),bj.select("."+f.chart).append("g").attr("class",f.chartLines),bj.append("g").attr("clip-path",si).attr("class",f.brush).call(Vi).selectAll("rect").attr(Yg?"width":"height",Yg?Nf:Pf),bj.append("g").attr("class",f.axisX).attr("transform",Mi.subx).attr("clip-path",Yg?"":ti),bf(uf.data.targets),Yg?aj.select("."+f.axisX).style("opacity",0).call(lg):(aj.select("."+f.axisY).style("opacity",0).call(mg),aj.select("."+f.axisY2).style("opacity",0).call(ng)),n(),R(),_e(),m(!1),Xe({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),mi){if(vi&&"string"==typeof ni){for(ni=oe(ni),e=0;e0){d=[];for(var g in tg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Id(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ce,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 Ve(a){be(uf.data.targets)||Eg&&(yi=a,aj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),zi=!0,Ng())}function We(){be(uf.data.targets)||Eg&&(aj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),aj.selectAll("."+f.shape).classed(f.INCLUDED,!1),zi=!1,Og())}function Xe(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Sd(),W=be(uf.data.targets),X=Ic(uf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?If:0,Q=D?P:0,R=E?P:0,c=aj.select("."+f.axisX).style("opacity",W?0:1),g=aj.select("."+f.axisY).style("opacity",W?0:1),h=aj.select("."+f.axisY2).style("opacity",W?0:1),e=bj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Sg&&of(Cc(uf.data.targets),a,O),wi&&(0===X.length||!H||G)&&fg.domain([0,c.selectAll(".tick").size()]),X.length&&(H&&(fg.domain(tf.extent(_b(X))),fj=fg.domain(),Bf&&Zi.scale(fg).updateScaleExtent(),ig.domain(fg.domain()),Vi.scale(ig)),G&&(fg.domain(Vi.empty()?fj:Vi.extent()),Bf&&Zi.scale(fg).updateScaleExtent())),gg.domain(Xb(X,"y")),hg.domain(Xb(X,"y2")),(gh||fh)&&(S=hh?hh:Kc(Jc(X)),lg.tickValues(S),og.tickValues(S)),O.axisX.call(lg),O.axisY.call(mg),O.axisY2.call(ng),O.axisSubX.call(og),G)if(dh&&S){for(T=1;T=0&&tf.select(this).style("display",b%U?"none":"block")})}else tf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!Yg&&ih&&eb(O.axisX),J=Ke(V),M=Le(V,!0),N=Le(V,!1),Db(),jg.domain(gg.domain()),kg.domain(hg.domain()),dj.style("display","none"),o(),aj.select("line."+f.xgridFocus).style("visibility","hidden"),Hh){if("year"===Ih){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=fg.ticks(10);i=aj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",Yg?0:function(a){return fg(a)-lg.tickOffset()}).attr("x2",Yg?Mf:function(a){return fg(a)-lg.tickOffset()}).attr("y1",Yg?function(a){return fg(a)-lg.tickOffset()}:Jf.top).attr("y2",Yg?function(a){return fg(a)-lg.tickOffset()}:Of).style("opacity",function(){return+tf.select(this).attr(Yg?"y1":"x1")===(Yg?Of:0)?0:1}),i.exit().remove()}te(Jh)&&(k=aj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Jh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",Yg?"":"rotate(-90)").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",Yg?0:Ad).attr("x2",Yg?Mf:Ad).attr("y1",Yg?Ad:Jf.top).attr("y2",Yg?Ad:Of).style("opacity",1),k.select("text").transition().duration(P).attr("x",Yg?Mf:0).attr("y",Ad).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Kh&&(m=aj.select("."+f.ygrids).selectAll("."+f.ygrid).data(gg.ticks(Mh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",Yg?gg:0).attr("x2",Yg?gg:Mf).attr("y1",Yg?0:gg).attr("y2",Yg?Of:gg),m.exit().remove()),A&&te(Lh)&&(n=aj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Lh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",Yg?"rotate(-90)":"").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",Yg?Bd:0).attr("x2",Yg?Bd:Mf).attr("y1",Yg?0:Bd).attr("y2",Yg?Of:Bd).style("opacity",1),n.select("text").transition().duration(P).attr("x",Yg?0:Mf).attr("y",Bd).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=aj.select("."+f.regions).selectAll("rect."+f.region).data(hi),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=aj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Di(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=aj.selectAll("."+f.texts).selectAll("."+f.text).data(le),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return Yg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return yd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),aj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",Wi).style("opacity",1),aj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",Xi).style("opacity",gj),q=aj.selectAll("."+f.circles).selectAll("."+f.circle).data(ke),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Oh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),q.exit().remove(),aj.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=tf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1),aj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&ie(a.data)?1:0}),aj.select("."+f.chartArcsTitle).style("opacity",ae(uf.data.targets)?1:0),Pg&&(null!==tf.event&&"zoom"===tf.event.type&&Vi.extent(fg.orgDomain()).update(),B&&(!Yg&&ih&&eb(O.axisSubX),Vi.empty()||Vi.extent(fg.orgDomain()).update(),K=Ke(V,!0),u=bj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Di(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),bj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",Yi).style("opacity",1))),aj.selectAll("."+f.selectedCircles).filter(function(a){return ee(a)}).selectAll("circle").remove(),aj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),v=aj.select("."+f.eventRects),te(qg)&&!oc(qg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Se(w.enter()),w.attr("x",0).attr("y",0).attr("width",Mf).attr("height",Of)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),xi&&!wi?(z=function(a,b){var c=xc(b),d=yc(b),e=uf.data.xs[a.id][b];return(fg(d?d:e+50)-fg(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=uf.data.xs[a.id][b];return(fg(d)+fg(c?c:d-50))/2}):(z=L(),y=function(a){return fg(a.x)-z/2}),x=Ac(uf.data.targets),aj.select("."+f.eventRects).datum(x?x.values:[]),w=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Re(w.enter()),w.attr("class",fd).attr("x",Yg?0:y).attr("y",Yg?y:0).attr("width",Yg?Mf:z).attr("height",Yg?z:Of),w.exit().remove()),Cc(uf.data.targets).forEach(function(a){hj[a]=!0})}function Ye(){Xe({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ze(){return"mousemove"===tf.event.sourceEvent.type&&Zi.altDomain?(fg.domain(Zi.altDomain),void Zi.scale(fg).updateScaleExtent()):(wi&&fg.orgDomain()[0]===fj[0]&&fg.domain([fj[0]-1e-10,fg.orgDomain()[1]]),Xe({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===tf.event.sourceEvent.type&&(Ai=!0)))}function $e(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function _e(){$i.attr("width",Qf).attr("height",Rf),$i.select("#"+pi).select("rect").attr("width",Mf).attr("height",Of),$i.select("#"+qi).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),$i.select("#"+ri).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),$i.select("."+f.zoomRect).attr("width",Mf).attr("height",Of),ej.style("max-height",Rf+"px")}function af(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),_e(),m(a.withTransition),Xe(a)}function bf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=aj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Di(a)}),e=aj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("fill",function(a){return Di(a)}).style("stroke","none").style("cursor",function(a){return Gg(a)?"pointer":null}),c=aj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)}),b.append("path").attr("class",dd).style("opacity",function(){return gj=+tf.select(this).style("opacity"),0}).style("fill",function(a){return Di(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Di(a)}).style("cursor",function(a){return Gg(a)?"pointer":null}),a.forEach(function(a){aj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=aj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Yf(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Di(a.data)}).style("cursor",function(a){return Gg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Fb(a),d=Lb(c),e=Tb();Nb(c.data.id),jf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Fb(a),c=[Lb(b)];Md(c,tf.mouse(this))}).on("mouseout",function(a,b){var c=Fb(a),d=Lb(c),e=Ub();Ob(c.data.id),lf(),Nd(),e(d,b)}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Pg&&(n=bj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Di(a)}),l=bj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)})),$i.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function cf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Xd(a.id,b.types[a.id]):Xd(a.id,b.type)}),uf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Ni?j:i,l=Ni?Q():P();return d&&(x=0,D=0,u=0,v=0),Sg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Ni?v:u,void(Xg?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Ni?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=cj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Ug?Ug(a):uf.toggle(a)}).on("mouseover",function(a){uf.focus(a),"function"==typeof Vg&&Vg(a)}).on("mouseout",function(a){uf.revert(),"function"==typeof Wg&&Wg(a)}),o.append("text").text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ni?h:-200).attr("y",Ni?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ni?i:-200).attr("y",Ni?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Di(a)}).attr("x",Ni?h:-200).attr("y",Ni?-200:j).attr("width",10).attr("height",10),cj.selectAll("text").data(a).text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),cj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),cj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),N(u),O(v),M(D),n(),R(),_e(),r&&m(q,c)}function pf(a){return Ec(uf.data.targets,a.id)}function qf(a){return"data"in a&&Ec(uf.data.targets,a.data.id)}function rf(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 sf(a,b,c){var d=!be(uf.data.targets);Xd(a,b),af(c||{withTransitionForAxis:d})}var tf=a.d3?a.d3:a.require?a.require("d3"):void 0,uf={data:{},axis:{},legend:{}},vf={},wf=h(["bindto"],"#chart"),xf=h(["size","width"]),yf=h(["size","height"]),zf=h(["padding","left"]),Af=h(["padding","right"]),Bf=h(["zoom","enabled"],!1),Cf=h(["zoom","extent"]),Df=h(["zoom","privileged"],!1),Ef=h(["onenter"],function(){}),Ff=h(["onleave"],function(){}),Gf=h(["onresize"],function(){}),Hf=h(["onresized"],function(){}),If=h(["transition","duration"],350);g("data","data is required in config");var Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg=h(["data","x"]),qg=h(["data","xs"],{}),rg=h(["data","x_format"]),sg=h(["data","id_converter"],function(a){return a}),tg=h(["data","names"],{}),ug=h(["data","classes"],{}),vg=h(["data","groups"],[]),wg=h(["data","axes"],{}),xg=h(["data","type"]),yg=h(["data","types"],{}),zg=h(["data","labels"],{}),Ag=h(["data","order"]),Bg=h(["data","regions"],{}),Cg=h(["data","color"]),Dg=h(["data","colors"],{}),Eg=h(["data","selection","enabled"],!1),Fg=h(["data","selection","grouped"],!1),Gg=h(["data","selection","isselectable"],function(){return!0}),Hg=h(["data","selection","multiple"],!0),Ig=h(["data","onclick"],function(){}),Jg=h(["data","onenter"],function(){}),Kg=h(["data","onleave"],function(){}),Lg=h(["data","onselected"],function(){}),Mg=h(["data","onunselected"],function(){}),Ng=h(["data","ondragstart"],function(){}),Og=h(["data","ondragend"],function(){}),Pg=h(["subchart","show"],!1),Qg=h(["subchart","size","height"],60),Rg=h(["color","pattern"],[]),Sg=h(["legend","show"],!0),Tg=h(["legend","position"],"bottom"),Ug=h(["legend","item","onclick"]),Vg=h(["legend","item","onmouseover"]),Wg=h(["legend","item","onmouseout"]),Xg=h(["legend","equally"],!1),Yg=h(["axis","rotated"],!1),Zg=h(["axis","x","show"],!0),$g=h(["axis","x","type"],"indexed"),_g=h(["axis","x","localtime"],!0),ah=h(["axis","x","categories"],[]),bh=h(["axis","x","tick","centered"],!1),ch=h(["axis","x","tick","format"]),dh=h(["axis","x","tick","culling"],{}),eh=h(["axis","x","tick","culling","max"],10),fh=h(["axis","x","tick","count"]),gh=h(["axis","x","tick","fit"],!0),hh=h(["axis","x","tick","values"],null),ih=h(["axis","x","tick","rotate"]),jh=h(["axis","x","max"],null),kh=h(["axis","x","min"],null),lh=h(["axis","x","padding"],{}),mh=h(["axis","x","height"]),nh=h(["axis","x","default"]),oh=h(["axis","x","label"],{}),ph=h(["axis","y","show"],!0),qh=h(["axis","y","max"]),rh=h(["axis","y","min"]),sh=h(["axis","y","center"]),th=h(["axis","y","label"],{}),uh=h(["axis","y","inner"],!1),vh=h(["axis","y","tick","format"]),wh=h(["axis","y","padding"],{}),xh=h(["axis","y","ticks"],10),yh=h(["axis","y2","show"],!1),zh=h(["axis","y2","max"]),Ah=h(["axis","y2","min"]),Bh=h(["axis","y2","center"]),Ch=h(["axis","y2","label"],{}),Dh=h(["axis","y2","inner"],!1),Eh=h(["axis","y2","tick","format"]),Fh=h(["axis","y2","padding"],{}),Gh=h(["axis","y2","ticks"],10),Hh=h(["grid","x","show"],!1),Ih=h(["grid","x","type"],"tick"),Jh=h(["grid","x","lines"],[]),Kh=h(["grid","y","show"],!1),Lh=h(["grid","y","lines"],[]),Mh=h(["grid","y","ticks"],10),Nh=h(["point","show"],!0),Oh=Nh?h(["point","r"],2.5):0,Ph=h(["point","focus","line","enabled"],!0),Qh=h(["point","focus","expand","enabled"],!0),Rh=h(["point","focus","expand","r"],Qh?4:Oh),Sh=h(["point","focus","select","r"],8),Th=h(["line","connect_null"],!1),Uh=h(["bar","width"]),Vh=h(["bar","width","ratio"],.6),Wh=h(["pie","label","show"],!0),Xh=h(["pie","label","format"]),Yh=h(["pie","expand"],!0),Zh=h(["pie","onclick"],function(){}),$h=h(["pie","onmouseover"],function(){}),_h=h(["pie","onmouseout"],function(){}),ai=h(["donut","label","show"],!0),bi=h(["donut","label","format"]),ci=h(["donut","expand"],!0),di=h(["donut","title"],""),ei=h(["donut","onclick"],function(){}),fi=h(["donut","onmouseover"],function(){}),gi=h(["donut","onmouseout"],function(){}),hi=h(["regions"],[]),ii=h(["tooltip","show"],!0),ji=h(["tooltip","format","title"]),ki=h(["tooltip","format","value"]),li=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ji?ji:b,l=ki?ki: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+""}),mi=h(["tooltip","init","show"],!1),ni=h(["tooltip","init","x"],0),oi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),pi=("string"==typeof wf?wf.replace("#",""):wf.id)+"-clip",qi=pi+"-xaxis",ri=pi+"-yaxis",si=i(pi),ti=i(qi),ui=i(ri),vi="timeseries"===$g,wi="categorized"===$g,xi=!vi&&(pg||te(qg)),yi=null,zi=!1,Ai=!1,Bi=!1,Ci=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Di=ne(Dg,te(Rg)?Rg:Ci,Cg),Ei=_g?tf.time.format:tf.time.format.utc,Fi=function(){var a=[[Ei("%Y/%-m/%-d"),function(){return!0}],[Ei("%-m/%-d"),function(a){return a.getMonth()}],[Ei("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ei("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ei("%I %p"),function(a){return a.getHours()}],[Ei("%I:%M"),function(a){return a.getMinutes()}],[Ei(":%S"),function(a){return a.getSeconds()}],[Ei(".%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)}}(),Gi=[],Hi=[],Ii=Yg?"left":"bottom",Ji=Yg?uh?"top":"bottom":uh?"right":"left",Ki=Yg?Dh?"bottom":"top":Dh?"left":"right",Li=Yg?"left":"bottom",Mi={main:function(){return"translate("+Jf.left+","+Jf.top+")"},context:function(){return"translate("+Kf.left+","+Kf.top+")"},legend:function(){return"translate("+Lf.left+","+Lf.top+")"},x:function(){return"translate(0,"+(Yg?0:Of)+")"},y:function(){return"translate(0,"+(Yg?Of:0)+")"},y2:function(){return"translate("+(Yg?0:Mf)+","+(Yg?1:0)+")"},subx:function(){return"translate(0,"+(Yg?0:Pf)+")"},arc:function(){return"translate("+Mf/2+","+Of/2+")"}},Ni="right"===Tg,Oi=0,Pi=0,Qi=0,Ri=.15,Si=30,Ti=Yg&&!Zg?0:30,Ui=5;Yf=tf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Vi,Wi=function(){var a=tf.svg.line().x(Yg?function(a){return V(a.id)(a.value)}:zd).y(Yg?zd:function(a){return V(a.id)(a.value)});return Th||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Th?De(b.values):b.values;return ce(b)?(a.interpolate(de(b)?"cardinal":"linear"),Bg[b.id]?Pe(e,fg,V(b.id),Bg[b.id]):a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Xi=function(){var a;return a=Yg?tf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(zd):tf.svg.area().x(zd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=De(b.values);return Yd([b],"area")||Yd([b],"area-spline")?(a.interpolate(de(b)?"cardinal":"linear"),a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Yi=function(){var a=tf.svg.line().x(Yg?function(a){return W(a.id)(a.value)}:Cd).y(Yg?Cd:function(a){return W(a.id)(a.value)});return function(b){var c=De(b.values);return ce(b)?a(c):"M "+ig(c[0].x)+" "+W(b.id)(c[0].value)}}(),Zi=function(){};Vi=tf.svg.brush().on("brush",Ye),Vi.update=function(){return bj&&bj.select("."+f.brush).call(this),this},Vi.scale=function(a){return Yg?this.y(a):this.x(a)},Bf&&(Zi=tf.behavior.zoom().on("zoomstart",function(){Zi.altDomain=tf.event.sourceEvent.altKey?fg.orgDomain():null}).on("zoom",Bf?Ze:null),Zi.scale=function(a){return Yg?this.y(a):this.x(a)},Zi.orgScaleExtent=function(){var a=Cf?Cf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},Zi.updateScaleExtent=function(){var a=ac(fg.orgDomain())/ac(fj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var $i,_i,aj,bj,cj,dj,ej,fj,gj,hj={};if(uf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),uf.defocus(),b(d.classed(f.focused,!0)),b(e),be(uf.data.targets)&&Nb(a,!0),jf(a)},uf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),kf(a)},uf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),lf()},uf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),$i.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?mf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},uf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),$i.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?nf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Ri),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},uf.toggle=function(a){Gc(a)?uf.hide(a):uf.show(a)},uf.unzoom=function(){Vi.clear().update(),Xe({withUpdateXDomain:!0})},uf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){ug[b]=a.classes[b]}),"categories"in a&&wi&&(ah=a.categories,lg.categories(ah)),"cacheIds"in a&&bc(a.cacheIds)?void cf(dc(a.cacheIds),a.done):void("unload"in a?ef(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){df(a)}):df(a))},uf.unload=function(a){ef(Dc(a),function(){Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},uf.selected=function(a){return tf.merge(aj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return tf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},uf.select=function(a,b,c){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=tf.select(this),i="circle"===this.nodeName?xe:Ae,j="circle"===this.nodeName?ye:Be,k=Fg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Gg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},uf.unselect=function(a,b){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=tf.select(this),g="circle"===this.nodeName?ye:Be,h=Fg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Gg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},uf.toLine=function(a){sf(a,"line")},uf.toSpline=function(a){sf(a,"spline")},uf.toBar=function(a){sf(a,"bar")},uf.toScatter=function(a){sf(a,"scatter")},uf.toArea=function(a){sf(a,"area")},uf.toAreaSpline=function(a){sf(a,"area-spline")},uf.toPie=function(a){sf(a,"pie",{withTransform:!0})},uf.toDonut=function(a){sf(a,"donut",{withTransform:!0})},uf.groups=function(a){return c(a)?vg:(vg=a,Xe(),vg)},uf.xgrids=function(a){return a?(Jh=a,Xe(),Jh):Jh},uf.xgrids.add=function(a){return a?uf.xgrids(Jh.concat(a)):void 0},uf.xgrids.remove=function(a){var b=rf(a);return uf.xgrids(Jh.filter(b))},uf.ygrids=function(a){return a?(Lh=a,Xe(),Lh):Lh},uf.ygrids.add=function(a){return a?uf.ygrids(Lh.concat(a)):void 0 +!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.32"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cMf&&(Mf=0),0>Of&&(Of=0),Nf=Yg?Jf.left-Si-Ti:Mf,Pf=Yg?Of:Rf-Kf.top-Kf.bottom,0>Nf&&(Nf=0),0>Pf&&(Pf=0),p(),Ni&&be(uf.data.targets)&&(Lf.left=Mf/2+Tf)}function o(){aj.select("line."+f.xgridFocus).attr("x1",Yg?0:-10).attr("x2",Yg?Mf:-10).attr("y1",Yg?-10:Jf.top).attr("y2",Yg?-10:Of)}function p(){Tf=Of/2,Sf=.95*Tf,Uf=ae(uf.data.targets)?.6*Sf:0}function q(){var a=Yg?f.axisX:f.axisY,b=tf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=tf.select(wf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return xf?xf:x()}function s(){var a=yf?yf:y();return a>0?a:320}function t(){return be(uf.data.targets)?0:zf?zf:Yg?Zg?v("x"):1:!ph||uh?1:v("y")}function u(){var a=1;return be(uf.data.targets)?0:Af?Af:Ni?P()+(yh&&!Yg?v("y2"):a):yh?Dh||Yg?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||Zg?"x"===a&&mh?mh:"y"!==a||ph?"y2"!==a||yh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Ui:Sg&&!Ni?10:1:0}function x(){return+tf.select(wf).style("width").replace("px","")}function y(){return+tf.select(wf).style("height").replace("px","")}function z(a){return a?-5:-(Jf.left-1)}function A(a){return a?-20:-4}function B(){return z(!Yg)}function C(){return A(!Yg)}function D(){return z(Yg)}function E(){return A(Yg)}function F(a){return a?Mf+2+4:Jf.left+20}function G(a){return a?(mh?mh:0)+80:Of+8}function H(){return F(!Yg)}function I(){return G(!Yg)}function J(){return F(Yg)}function K(){return G(Yg)}function L(){var a=Ac(uf.data.targets),b=a.values[0],c=a.values[a.values.length-1],d=fg(c.x)-fg(b.x),e=zc(),f=Zd(uf.data.targets)?(e-(wi?.25:1))/e:1;return e>1?d*f/(e-1):d}function M(a){Oi=a}function N(a){Pi=a}function O(a){Qi=a}function P(){return Sg?Ni?Pi*(Oi+1):Qf:0}function Q(){return Sg?Ni?Rf:Qi*(Oi+1):0}function R(){var a,b=!fg;Zf=Yg?1:0,$f=Yg?Of:Mf,_f=Yg?0:Of,ag=Yg?Mf:1,bg=Zf,cg=$f,dg=Yg?0:Pf,eg=Yg?Nf:1,fg=T(Zf,$f,b?void 0:fg.domain(),function(){return lg.tickOffset()}),gg=U(_f,ag,b?void 0:gg.domain()),hg=U(_f,ag,b?void 0:hg.domain()),ig=T(Zf,$f,fj,function(a){return a%1?0:og.tickOffset()}),jg=U(dg,eg,b?void 0:jg.domain()),kg=U(dg,eg,b?void 0:kg.domain()),a=$(),lg=X(fg,Ii,a),og=X(ig,Li,a),mg=Y(gg,Ji,vh,xh),ng=Y(hg,Ki,Eh,Gh),b||(Vi.scale(ig),Bf&&Zi.scale(fg)),S()}function S(){Vf=Gb(),Wf=Hb(),Xf=Hb(.98)}function T(a,b,d,e){var f=(vi?tf.time.scale():tf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),wi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=tf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?hg:gg}function W(a){return"y2"===Z(a)?kg:jg}function X(a,b,c){var d=(wi?Eb():tf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),wi?(d.tickCentered(bh),se(dh)&&(dh=!1)):d.tickOffset=function(){var a=Bc(uf.data.targets),b=fg(a[1])-fg(a[0]);return b/zc()/2},wi&&d.categories(ah),d}function Y(a,b,c,d){return tf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in wg?wg[a]:"y"}function $(){var a=vi?Fi:wi?Tc:function(a){return 0>a?a.toFixed(0):a};return ch&&("function"==typeof ch?a=ch:vi&&(a=function(a){return a?Ei(ch)(a):""})),a}function _(a){var b;return"y"===a?b=th:"y2"===a?b=Ch:"x"===a&&(b=oh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?th=b:"y2"===a?Ch=b:"x"===a&&(oh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",Yg?"inner-top":"inner-right")}function hb(){return fb("y",Yg?"inner-right":"inner-top")}function ib(){return fb("y2",Yg?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Mf/2:Mf:b.isBottom?-Of:b.isMiddle?-Of/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!Yg,gb())}function rb(){return nb(Yg,hb())}function sb(){return nb(Yg,ib())}function tb(){return ob(!Yg,gb())}function ub(){return ob(Yg,hb())}function vb(){return ob(Yg,ib())}function wb(){var a=gb();return Yg?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":mh?mh-10:"3em"}function xb(){var a=hb();return Yg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return Yg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!Yg,gb())}function Ab(){return pb(Yg,hb())}function Bb(){return pb(Yg,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return tf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?30:b}function Db(){aj.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),aj.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),aj.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 tf.min(Object.keys(i).map(function(a){return tf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(vg.length>0)for(g=Sc(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 tf.max(Object.keys(i).map(function(a){return tf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Ah:rh,n="y2"===c?zh:qh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Bh:sh,r=ud()&&Yg;return 0===l.length?"y2"===c?hg.domain():gg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(gg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&wh&&(f=b(wh.top)?wh.top:e,g=b(wh.bottom)?wh.bottom:e),"y2"===c&&Fh&&(f=b(Fh.top)?Fh.top:e,g=b(Fh.bottom)?Fh.bottom:e),Zd(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return kh?vi?oe(kh):kh:tf.min(a,function(a){return tf.min(a.values,function(a){return a.x})})}function Zb(a){return jh?vi?oe(jh):jh:tf.max(a,function(a){return tf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return wi?d=0:Zd(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof lh&&te(lh)?(e=b(lh.left)?lh.left:d,f=b(lh.right)?lh.right:d):e=f="number"==typeof lh?lh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?gg:hg;return b="y"===a.axis||"y2"===a.axis?Yg?Of:"start"in a?d(a.start):Of:Yg?"end"in a?fg(vi?oe(a.end):a.end):Of:Of,c>b?0:b-c}function ic(a){return pg&&a===pg||te(qg)&&ue(qg,a)}function jc(a){return!ic(a)}function kc(a){return pg?pg:te(qg)?qg[a]:null}function lc(a,b){var c,d=b&&te(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=uf.data.xs[b])}),c}function mc(a,b){return a in uf.data.xs&&uf.data.xs[a]&&uf.data.xs[a][b]?uf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){qg[b]=a[b]})}function oc(a){return 1===tf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=tg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),uf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=vi?a?a instanceof Date?a:oe(a):oe(mc(c,d)):xi&&!wi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?uf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):pg?(d=Object.keys(uf.data.xs),uf.data.xs[c]=d.length>0?uf.data.xs[d[0]]:void 0):te(qg)&&(uf.data.xs[c]=lc(f,uf.data.targets)):uf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!uf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=sg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return xi&&wi&&0===c&&g&&(0===e&&(ah=[]),ah.push(g)),("undefined"==typeof a[b]||uf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),xg&&Xd(Cc(c).filter(function(a){return!(a in yg)}),xg),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&uf.data.targets[0].values[a-1]?uf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(uf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(vi?new Date(h):h);i.push(d)}return vi||(i=i.sort(function(a,b){return a-b})),i}function Lc(a){Gi=Gi.concat(a)}function Mc(a){Gi=Gi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Hi=Hi.concat(a)}function Oc(a){Hi=Hi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Dd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Dd(a,g))),Gd(e,b)):Ed(a,b,f,g)}function Fd(a,b){var c;return c=a.map(function(a){return Ed(a.values,b)}),Gd(c,b)}function Gd(a,b){var c,d;return a.forEach(function(a){var e=ve(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Hd(a,b){return tf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Id(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 Jd(){return Ag&&"desc"===Ag.toLowerCase()}function Kd(){return Ag&&"asc"===Ag.toLowerCase()}function Ld(a){var b=Kd(),c=Jd();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 Ag&&a.sort(Ag),a}function Md(a,c){var d,e,f,g,h,i,j,k=be(uf.data.targets),l=k?xd:wd,m=a.filter(function(a){return a&&b(a.value)});ii&&0!==m.length&&(dj.html(li(a,$(),l,Di)).style("display","block"),d=dj.property("offsetWidth"),e=dj.property("offsetHeight"),k?(g=Mf/2+c[0],i=Of/2+c[1]+20):(Yg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=fg(m[0].x)+20):(f=q(),g=f+t()+fg(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),dj.style("top",i+"px").style("left",g+"px"))}function Nd(){dj.style("display","none")}function Od(a){var c=a.filter(function(a){return a&&b(a.value)});ii&&($d(uf.data.targets)||be(uf.data.targets)||aj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Yg?"y1":"x1",zd).attr(Yg?"y2":"x2",zd))}function Pd(){aj.select("line."+f.xgridFocus).style("visibility","hidden")}function Qd(a){return a.x||0===a.x?fg(a.x):null}function Rd(a){return V(a.id)(a.value)}function Sd(){var a,b,d={},e=0;return Ic(Fc(ee)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Wd(a,b){return Uh?Uh:b?2*a.tickOffset()*Vh/b:0}function Xd(a,b){Dc(a).forEach(function(a){hj[a]=b===yg[a],yg[a]=b})}function Yd(a,b){var c=!1;return a.forEach(function(a){yg[a.id]===b&&(c=!0),a.id in yg||"line"!==b||(c=!0)}),c}function Zd(a){return Yd(a,"bar")}function $d(a){return Yd(a,"scatter")}function _d(a){return Yd(a,"pie")}function ae(a){return Yd(a,"donut")}function be(a){return _d(a)||ae(a)}function ce(a){var b="string"==typeof a?a:a.id;return!(b in yg)||"line"===yg[b]||"spline"===yg[b]||"area"===yg[b]||"area-spline"===yg[b]}function de(a){var b="string"==typeof a?a:a.id;return"spline"===yg[b]||"area-spline"===yg[b]}function ee(a){var b="string"==typeof a?a:a.id;return"bar"===yg[b]}function fe(a){var b="string"==typeof a?a:a.id;return"scatter"===yg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"pie"===yg[b]}function he(a){var b="string"==typeof a?a:a.id;return"donut"===yg[b]}function ie(a){return ge(a)||he(a)}function je(a){return ee(a)?a.values:[]}function ke(a){return ce(a)||fe(a)?a.values:[]}function le(a){return ee(a)||ce(a)?a.values:[]}function me(a){return he(a)&&ci||ge(a)&&Yh}function ne(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function oe(b){var c;try{c=rg?tf.time.format(rg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+rg)}return c}function pe(a,b){var c=tf.mouse(a),d=tf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function ue(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ve(a,b){var c="y"===Z(a.id)?gg:hg,d=Yg?1:0,e=Yg?0:1;return Math.pow(fg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function we(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function xe(a,b,c){Lg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd).attr("stroke",function(){return Di(b)}).attr("r",1.4*Sh).transition().duration(100).attr("r",Sh)}function ye(a,b,c){Mg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ze(a,b,c,d){a?xe(b,c,d):ye(b,c,d)}function Ae(a,b){Lg(b,a.node()),a.transition().duration(100).style("fill",function(){return tf.rgb(Di(b)).darker(1)})}function Be(a,b){Mg(b,a.node()),a.transition().duration(100).style("fill",function(){return Di(b)})}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a){return a.filter(function(a){return b(a.value)})}function Ee(a,c){return(c?aj.selectAll("."+f.circles+ld(c)):aj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Fe(a,b){Ee(a,b).classed(f.EXPANDED,!0).attr("r",Rh)}function Ge(a){Ee(a).filter(function(){return tf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oh)}function He(a){return aj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ie(a){He(a).classed(f.EXPANDED,!0)}function Je(a){He(a).classed(f.EXPANDED,!1)}function Ke(a,b){var c=Oe(a,b);return function(a,b){var d=c(a,b),e=Yg?1:0,f=Yg?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 Le(a,b){var c=Oe(a,!1),d=b?Me:Ne;return function(a,b){return d(c(a,b),a,this)}}function Me(a,b){var c;return Yg?(c=ee(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ne(a,b,c){var d=c.getBoundingClientRect();return Yg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ee(b)?-3:-6)}function Oe(a,b){var c=a.__max__+1,d=Wd(lg,c),e=Td(d,c,a,!!b),f=Ud(!!b),g=Vd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Yg&&(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 Pe(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 Qe(b){var c,d,e;if(ej=tf.select(wf),ej.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ej.html(""),ej.classed("c3",!0),uf.data.xs={},uf.data.targets=vc(b),n(),R(),fg.domain(tf.extent(_b(uf.data.targets))),gg.domain(Xb(uf.data.targets,"y")),hg.domain(Xb(uf.data.targets,"y2")),ig.domain(fg.domain()),jg.domain(gg.domain()),kg.domain(hg.domain()),fj=fg.domain(),Vi.scale(ig),Bf&&Zi.scale(fg),$i=ej.append("svg").attr("width",Mf+Jf.left+Jf.right).attr("height",Of+Jf.top+Jf.bottom).on("mouseenter",Ef).on("mouseleave",Ff),_i=$i.append("defs"),_i.append("clipPath").attr("id",pi).append("rect").attr("width",Mf).attr("height",Of),_i.append("clipPath").attr("id",qi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),_i.append("clipPath").attr("id",ri).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),aj=$i.append("g").attr("transform",Mi.main),bj=$i.append("g").attr("transform",Mi.context),cj=$i.append("g").attr("transform",Mi.legend),Pg||bj.style("visibility","hidden"),Sg||(cj.style("visibility","hidden"),Hi=Cc(uf.data.targets)),dj=tf.select(wf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),of(Cc(uf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Zg&&aj.append("g").attr("class",f.axisX).attr("clip-path",ti).attr("transform",Mi.x).append("text").attr("class",f.axisXLabel).attr("transform",Yg?"rotate(-90)":"").style("text-anchor",zb),ph&&aj.append("g").attr("class",f.axisY).attr("clip-path",ui).attr("transform",Mi.y).append("text").attr("class",f.axisYLabel).attr("transform",Yg?"":"rotate(-90)").style("text-anchor",Ab),yh&&aj.append("g").attr("class",f.axisY2).attr("transform",Mi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Yg?"":"rotate(-90)").style("text-anchor",Bb),d=aj.append("g").attr("clip-path",si).attr("class",f.grid),Hh&&d.append("g").attr("class",f.xgrids),te(Jh)&&d.append("g").attr("class",f.xgridLines),Ph&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Kh&&d.append("g").attr("class",f.ygrids),te(Lh)&&d.append("g").attr("class",f.ygridLines),aj.append("g").attr("clip-path",si).attr("class",f.regions),aj.append("g").attr("clip-path",si).attr("class",f.chart),c=aj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Bf?Yg?"ns-resize":"ew-resize":null),aj.select("."+f.chart).append("g").attr("class",f.chartBars),aj.select("."+f.chart).append("g").attr("class",f.chartLines),aj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Mi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),aj.select("."+f.chart).append("g").attr("class",f.chartTexts),Bf&&aj.insert("rect",Df?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Mf).attr("height",Of).style("opacity",0).style("cursor",Yg?"ns-resize":"ew-resize").call(Zi).on("dblclick.zoom",null),nh&&Vi.extent("function"!=typeof nh?nh:nh(_b())),bj.append("g").attr("clip-path",si).attr("class",f.chart),bj.select("."+f.chart).append("g").attr("class",f.chartBars),bj.select("."+f.chart).append("g").attr("class",f.chartLines),bj.append("g").attr("clip-path",si).attr("class",f.brush).call(Vi).selectAll("rect").attr(Yg?"width":"height",Yg?Nf:Pf),bj.append("g").attr("class",f.axisX).attr("transform",Mi.subx).attr("clip-path",Yg?"":ti),bf(uf.data.targets),Yg?aj.select("."+f.axisX).style("opacity",0).call(lg):(aj.select("."+f.axisY).style("opacity",0).call(mg),aj.select("."+f.axisY2).style("opacity",0).call(ng)),n(),R(),_e(),m(!1),Xe({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),mi){if(vi&&"string"==typeof ni){for(ni=oe(ni),e=0;e0){d=[];for(var g in tg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Id(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ce,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 Ve(a){be(uf.data.targets)||Eg&&(yi=a,aj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),zi=!0,Ng())}function We(){be(uf.data.targets)||Eg&&(aj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),aj.selectAll("."+f.shape).classed(f.INCLUDED,!1),zi=!1,Og())}function Xe(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Sd(),W=be(uf.data.targets),X=Ic(uf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?If:0,Q=D?P:0,R=E?P:0,c=aj.select("."+f.axisX).style("opacity",W?0:1),g=aj.select("."+f.axisY).style("opacity",W?0:1),h=aj.select("."+f.axisY2).style("opacity",W?0:1),e=bj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Sg&&of(Cc(uf.data.targets),a,O),wi&&(0===X.length||!H||G)&&fg.domain([0,c.selectAll(".tick").size()]),X.length&&(H&&(fg.domain(tf.extent(_b(X))),fj=fg.domain(),Bf&&Zi.scale(fg).updateScaleExtent(),ig.domain(fg.domain()),Vi.scale(ig)),G&&(fg.domain(Vi.empty()?fj:Vi.extent()),Bf&&Zi.scale(fg).updateScaleExtent())),gg.domain(Xb(X,"y")),hg.domain(Xb(X,"y2")),(gh||fh)&&(S=hh?hh:Kc(Jc(X)),lg.tickValues(S),og.tickValues(S)),O.axisX.call(lg),O.axisY.call(mg),O.axisY2.call(ng),O.axisSubX.call(og),G)if(dh&&S){for(T=1;T=0&&tf.select(this).style("display",b%U?"none":"block")})}else tf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!Yg&&ih&&eb(c,O.axisX,ih),J=Ke(V),M=Le(V,!0),N=Le(V,!1),Db(),jg.domain(gg.domain()),kg.domain(hg.domain()),dj.style("display","none"),o(),aj.select("line."+f.xgridFocus).style("visibility","hidden"),Hh){if("year"===Ih){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=fg.ticks(10);i=aj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",Yg?0:function(a){return fg(a)-lg.tickOffset()}).attr("x2",Yg?Mf:function(a){return fg(a)-lg.tickOffset()}).attr("y1",Yg?function(a){return fg(a)-lg.tickOffset()}:Jf.top).attr("y2",Yg?function(a){return fg(a)-lg.tickOffset()}:Of).style("opacity",function(){return+tf.select(this).attr(Yg?"y1":"x1")===(Yg?Of:0)?0:1}),i.exit().remove()}te(Jh)&&(k=aj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Jh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",Yg?"":"rotate(-90)").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",Yg?0:Ad).attr("x2",Yg?Mf:Ad).attr("y1",Yg?Ad:Jf.top).attr("y2",Yg?Ad:Of).style("opacity",1),k.select("text").transition().duration(P).attr("x",Yg?Mf:0).attr("y",Ad).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Kh&&(m=aj.select("."+f.ygrids).selectAll("."+f.ygrid).data(gg.ticks(Mh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",Yg?gg:0).attr("x2",Yg?gg:Mf).attr("y1",Yg?0:gg).attr("y2",Yg?Of:gg),m.exit().remove()),A&&te(Lh)&&(n=aj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Lh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",Yg?"rotate(-90)":"").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",Yg?Bd:0).attr("x2",Yg?Bd:Mf).attr("y1",Yg?0:Bd).attr("y2",Yg?Of:Bd).style("opacity",1),n.select("text").transition().duration(P).attr("x",Yg?0:Mf).attr("y",Bd).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=aj.select("."+f.regions).selectAll("rect."+f.region).data(hi),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=aj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Di(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=aj.selectAll("."+f.texts).selectAll("."+f.text).data(le),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return Yg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return yd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),aj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",Wi).style("opacity",1),aj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",Xi).style("opacity",gj),q=aj.selectAll("."+f.circles).selectAll("."+f.circle).data(ke),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Oh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),q.exit().remove(),aj.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=tf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1),aj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&ie(a.data)?1:0}),aj.select("."+f.chartArcsTitle).style("opacity",ae(uf.data.targets)?1:0),Pg&&(null!==tf.event&&"zoom"===tf.event.type&&Vi.extent(fg.orgDomain()).update(),B&&(!Yg&&ih&&eb(e,O.axisSubX,ih),Vi.empty()||Vi.extent(fg.orgDomain()).update(),K=Ke(V,!0),u=bj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Di(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),bj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",Yi).style("opacity",1))),aj.selectAll("."+f.selectedCircles).filter(function(a){return ee(a)}).selectAll("circle").remove(),aj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),v=aj.select("."+f.eventRects),te(qg)&&!oc(qg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Se(w.enter()),w.attr("x",0).attr("y",0).attr("width",Mf).attr("height",Of)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),xi&&!wi?(z=function(a,b){var c=xc(b),d=yc(b),e=uf.data.xs[a.id][b];return(fg(d?d:e+50)-fg(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=uf.data.xs[a.id][b];return(fg(d)+fg(c?c:d-50))/2}):(z=L(),y=function(a){return fg(a.x)-z/2}),x=Ac(uf.data.targets),aj.select("."+f.eventRects).datum(x?x.values:[]),w=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Re(w.enter()),w.attr("class",fd).attr("x",Yg?0:y).attr("y",Yg?y:0).attr("width",Yg?Mf:z).attr("height",Yg?z:Of),w.exit().remove()),Cc(uf.data.targets).forEach(function(a){hj[a]=!0})}function Ye(){Xe({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ze(){return"mousemove"===tf.event.sourceEvent.type&&Zi.altDomain?(fg.domain(Zi.altDomain),void Zi.scale(fg).updateScaleExtent()):(wi&&fg.orgDomain()[0]===fj[0]&&fg.domain([fj[0]-1e-10,fg.orgDomain()[1]]),Xe({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===tf.event.sourceEvent.type&&(Ai=!0)))}function $e(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function _e(){$i.attr("width",Qf).attr("height",Rf),$i.select("#"+pi).select("rect").attr("width",Mf).attr("height",Of),$i.select("#"+qi).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),$i.select("#"+ri).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),$i.select("."+f.zoomRect).attr("width",Mf).attr("height",Of),ej.style("max-height",Rf+"px")}function af(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),_e(),m(a.withTransition),Xe(a)}function bf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=aj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Di(a)}),e=aj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("fill",function(a){return Di(a)}).style("stroke","none").style("cursor",function(a){return Gg(a)?"pointer":null}),c=aj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)}),b.append("path").attr("class",dd).style("opacity",function(){return gj=+tf.select(this).style("opacity"),0}).style("fill",function(a){return Di(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Di(a)}).style("cursor",function(a){return Gg(a)?"pointer":null}),a.forEach(function(a){aj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=aj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Yf(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Di(a.data)}).style("cursor",function(a){return Gg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Fb(a),d=Lb(c),e=Tb();Nb(c.data.id),jf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Fb(a),c=[Lb(b)];Md(c,tf.mouse(this))}).on("mouseout",function(a,b){var c=Fb(a),d=Lb(c),e=Ub();Ob(c.data.id),lf(),Nd(),e(d,b)}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Pg&&(n=bj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Di(a)}),l=bj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)})),$i.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function cf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Xd(a.id,b.types[a.id]):Xd(a.id,b.type)}),uf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Ni?j:i,l=Ni?Q():P();return d&&(x=0,D=0,u=0,v=0),Sg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Ni?v:u,void(Xg?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Ni?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=cj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Ug?Ug(a):uf.toggle(a)}).on("mouseover",function(a){uf.focus(a),"function"==typeof Vg&&Vg(a)}).on("mouseout",function(a){uf.revert(),"function"==typeof Wg&&Wg(a)}),o.append("text").text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ni?h:-200).attr("y",Ni?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ni?i:-200).attr("y",Ni?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Di(a)}).attr("x",Ni?h:-200).attr("y",Ni?-200:j).attr("width",10).attr("height",10),cj.selectAll("text").data(a).text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),cj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),cj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),N(u),O(v),M(D),n(),R(),_e(),r&&m(q,c)}function pf(a){return Ec(uf.data.targets,a.id)}function qf(a){return"data"in a&&Ec(uf.data.targets,a.data.id)}function rf(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 sf(a,b,c){var d=!be(uf.data.targets);Xd(a,b),af(c||{withTransitionForAxis:d})}var tf=a.d3?a.d3:a.require?a.require("d3"):void 0,uf={data:{},axis:{},legend:{}},vf={},wf=h(["bindto"],"#chart"),xf=h(["size","width"]),yf=h(["size","height"]),zf=h(["padding","left"]),Af=h(["padding","right"]),Bf=h(["zoom","enabled"],!1),Cf=h(["zoom","extent"]),Df=h(["zoom","privileged"],!1),Ef=h(["onenter"],function(){}),Ff=h(["onleave"],function(){}),Gf=h(["onresize"],function(){}),Hf=h(["onresized"],function(){}),If=h(["transition","duration"],350);g("data","data is required in config");var Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg=h(["data","x"]),qg=h(["data","xs"],{}),rg=h(["data","x_format"]),sg=h(["data","id_converter"],function(a){return a}),tg=h(["data","names"],{}),ug=h(["data","classes"],{}),vg=h(["data","groups"],[]),wg=h(["data","axes"],{}),xg=h(["data","type"]),yg=h(["data","types"],{}),zg=h(["data","labels"],{}),Ag=h(["data","order"]),Bg=h(["data","regions"],{}),Cg=h(["data","color"]),Dg=h(["data","colors"],{}),Eg=h(["data","selection","enabled"],!1),Fg=h(["data","selection","grouped"],!1),Gg=h(["data","selection","isselectable"],function(){return!0}),Hg=h(["data","selection","multiple"],!0),Ig=h(["data","onclick"],function(){}),Jg=h(["data","onenter"],function(){}),Kg=h(["data","onleave"],function(){}),Lg=h(["data","onselected"],function(){}),Mg=h(["data","onunselected"],function(){}),Ng=h(["data","ondragstart"],function(){}),Og=h(["data","ondragend"],function(){}),Pg=h(["subchart","show"],!1),Qg=h(["subchart","size","height"],60),Rg=h(["color","pattern"],[]),Sg=h(["legend","show"],!0),Tg=h(["legend","position"],"bottom"),Ug=h(["legend","item","onclick"]),Vg=h(["legend","item","onmouseover"]),Wg=h(["legend","item","onmouseout"]),Xg=h(["legend","equally"],!1),Yg=h(["axis","rotated"],!1),Zg=h(["axis","x","show"],!0),$g=h(["axis","x","type"],"indexed"),_g=h(["axis","x","localtime"],!0),ah=h(["axis","x","categories"],[]),bh=h(["axis","x","tick","centered"],!1),ch=h(["axis","x","tick","format"]),dh=h(["axis","x","tick","culling"],{}),eh=h(["axis","x","tick","culling","max"],10),fh=h(["axis","x","tick","count"]),gh=h(["axis","x","tick","fit"],!0),hh=h(["axis","x","tick","values"],null),ih=h(["axis","x","tick","rotate"]),jh=h(["axis","x","max"],null),kh=h(["axis","x","min"],null),lh=h(["axis","x","padding"],{}),mh=h(["axis","x","height"]),nh=h(["axis","x","default"]),oh=h(["axis","x","label"],{}),ph=h(["axis","y","show"],!0),qh=h(["axis","y","max"]),rh=h(["axis","y","min"]),sh=h(["axis","y","center"]),th=h(["axis","y","label"],{}),uh=h(["axis","y","inner"],!1),vh=h(["axis","y","tick","format"]),wh=h(["axis","y","padding"],{}),xh=h(["axis","y","ticks"],10),yh=h(["axis","y2","show"],!1),zh=h(["axis","y2","max"]),Ah=h(["axis","y2","min"]),Bh=h(["axis","y2","center"]),Ch=h(["axis","y2","label"],{}),Dh=h(["axis","y2","inner"],!1),Eh=h(["axis","y2","tick","format"]),Fh=h(["axis","y2","padding"],{}),Gh=h(["axis","y2","ticks"],10),Hh=h(["grid","x","show"],!1),Ih=h(["grid","x","type"],"tick"),Jh=h(["grid","x","lines"],[]),Kh=h(["grid","y","show"],!1),Lh=h(["grid","y","lines"],[]),Mh=h(["grid","y","ticks"],10),Nh=h(["point","show"],!0),Oh=Nh?h(["point","r"],2.5):0,Ph=h(["point","focus","line","enabled"],!0),Qh=h(["point","focus","expand","enabled"],!0),Rh=h(["point","focus","expand","r"],Qh?4:Oh),Sh=h(["point","focus","select","r"],8),Th=h(["line","connect_null"],!1),Uh=h(["bar","width"]),Vh=h(["bar","width","ratio"],.6),Wh=h(["pie","label","show"],!0),Xh=h(["pie","label","format"]),Yh=h(["pie","expand"],!0),Zh=h(["pie","onclick"],function(){}),$h=h(["pie","onmouseover"],function(){}),_h=h(["pie","onmouseout"],function(){}),ai=h(["donut","label","show"],!0),bi=h(["donut","label","format"]),ci=h(["donut","expand"],!0),di=h(["donut","title"],""),ei=h(["donut","onclick"],function(){}),fi=h(["donut","onmouseover"],function(){}),gi=h(["donut","onmouseout"],function(){}),hi=h(["regions"],[]),ii=h(["tooltip","show"],!0),ji=h(["tooltip","format","title"]),ki=h(["tooltip","format","value"]),li=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ji?ji:b,l=ki?ki: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+""}),mi=h(["tooltip","init","show"],!1),ni=h(["tooltip","init","x"],0),oi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),pi=("string"==typeof wf?wf.replace("#",""):wf.id)+"-clip",qi=pi+"-xaxis",ri=pi+"-yaxis",si=i(pi),ti=i(qi),ui=i(ri),vi="timeseries"===$g,wi="categorized"===$g,xi=!vi&&(pg||te(qg)),yi=null,zi=!1,Ai=!1,Bi=!1,Ci=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Di=ne(Dg,te(Rg)?Rg:Ci,Cg),Ei=_g?tf.time.format:tf.time.format.utc,Fi=function(){var a=[[Ei("%Y/%-m/%-d"),function(){return!0}],[Ei("%-m/%-d"),function(a){return a.getMonth()}],[Ei("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ei("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ei("%I %p"),function(a){return a.getHours()}],[Ei("%I:%M"),function(a){return a.getMinutes()}],[Ei(":%S"),function(a){return a.getSeconds()}],[Ei(".%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)}}(),Gi=[],Hi=[],Ii=Yg?"left":"bottom",Ji=Yg?uh?"top":"bottom":uh?"right":"left",Ki=Yg?Dh?"bottom":"top":Dh?"left":"right",Li=Yg?"left":"bottom",Mi={main:function(){return"translate("+Jf.left+","+Jf.top+")"},context:function(){return"translate("+Kf.left+","+Kf.top+")"},legend:function(){return"translate("+Lf.left+","+Lf.top+")"},x:function(){return"translate(0,"+(Yg?0:Of)+")"},y:function(){return"translate(0,"+(Yg?Of:0)+")"},y2:function(){return"translate("+(Yg?0:Mf)+","+(Yg?1:0)+")"},subx:function(){return"translate(0,"+(Yg?0:Pf)+")"},arc:function(){return"translate("+Mf/2+","+Of/2+")"}},Ni="right"===Tg,Oi=0,Pi=0,Qi=0,Ri=.15,Si=30,Ti=Yg&&!Zg?0:30,Ui=5;Yf=tf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Vi,Wi=function(){var a=tf.svg.line().x(Yg?function(a){return V(a.id)(a.value)}:zd).y(Yg?zd:function(a){return V(a.id)(a.value)});return Th||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Th?De(b.values):b.values;return ce(b)?(a.interpolate(de(b)?"cardinal":"linear"),Bg[b.id]?Pe(e,fg,V(b.id),Bg[b.id]):a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Xi=function(){var a;return a=Yg?tf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(zd):tf.svg.area().x(zd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=De(b.values);return Yd([b],"area")||Yd([b],"area-spline")?(a.interpolate(de(b)?"cardinal":"linear"),a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Yi=function(){var a=tf.svg.line().x(Yg?function(a){return W(a.id)(a.value)}:Cd).y(Yg?Cd:function(a){return W(a.id)(a.value)});return function(b){var c=De(b.values);return ce(b)?a(c):"M "+ig(c[0].x)+" "+W(b.id)(c[0].value)}}(),Zi=function(){};Vi=tf.svg.brush().on("brush",Ye),Vi.update=function(){return bj&&bj.select("."+f.brush).call(this),this},Vi.scale=function(a){return Yg?this.y(a):this.x(a)},Bf&&(Zi=tf.behavior.zoom().on("zoomstart",function(){Zi.altDomain=tf.event.sourceEvent.altKey?fg.orgDomain():null}).on("zoom",Bf?Ze:null),Zi.scale=function(a){return Yg?this.y(a):this.x(a)},Zi.orgScaleExtent=function(){var a=Cf?Cf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},Zi.updateScaleExtent=function(){var a=ac(fg.orgDomain())/ac(fj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var $i,_i,aj,bj,cj,dj,ej,fj,gj,hj={};if(uf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),uf.defocus(),b(d.classed(f.focused,!0)),b(e),be(uf.data.targets)&&Nb(a,!0),jf(a)},uf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),kf(a)},uf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),lf()},uf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),$i.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?mf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},uf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),$i.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?nf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Ri),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},uf.toggle=function(a){Gc(a)?uf.hide(a):uf.show(a)},uf.unzoom=function(){Vi.clear().update(),Xe({withUpdateXDomain:!0})},uf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){ug[b]=a.classes[b]}),"categories"in a&&wi&&(ah=a.categories,lg.categories(ah)),"cacheIds"in a&&bc(a.cacheIds)?void cf(dc(a.cacheIds),a.done):void("unload"in a?ef(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){df(a)}):df(a))},uf.unload=function(a){ef(Dc(a),function(){Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},uf.selected=function(a){return tf.merge(aj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return tf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},uf.select=function(a,b,c){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=tf.select(this),i="circle"===this.nodeName?xe:Ae,j="circle"===this.nodeName?ye:Be,k=Fg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Gg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},uf.unselect=function(a,b){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=tf.select(this),g="circle"===this.nodeName?ye:Be,h=Fg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Gg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},uf.toLine=function(a){sf(a,"line")},uf.toSpline=function(a){sf(a,"spline")},uf.toBar=function(a){sf(a,"bar")},uf.toScatter=function(a){sf(a,"scatter")},uf.toArea=function(a){sf(a,"area")},uf.toAreaSpline=function(a){sf(a,"area-spline")},uf.toPie=function(a){sf(a,"pie",{withTransform:!0})},uf.toDonut=function(a){sf(a,"donut",{withTransform:!0})},uf.groups=function(a){return c(a)?vg:(vg=a,Xe(),vg)},uf.xgrids=function(a){return a?(Jh=a,Xe(),Jh):Jh},uf.xgrids.add=function(a){return a?uf.xgrids(Jh.concat(a)):void 0},uf.xgrids.remove=function(a){var b=rf(a);return uf.xgrids(Jh.filter(b))},uf.ygrids=function(a){return a?(Lh=a,Xe(),Lh):Lh},uf.ygrids.add=function(a){return a?uf.ygrids(Lh.concat(a)):void 0 },uf.ygrids.remove=function(a){var b=rf(a);return uf.ygrids(Lh.filter(b))},uf.regions=function(a){return c(a)?hi:(hi=a,Xe(),hi)},uf.regions.add=function(a){return c(a)?hi:(hi=hi.concat(a),Xe(),hi)},uf.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;$i.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),hi=hi.filter(function(b){return b.classes.indexOf(a)<0})}),hi},uf.data.get=function(a){var b=uf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},uf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},uf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){tg[b]=a[b]}),of(Cc(uf.data.targets),{withTransition:!0}),tg):tg},uf.x=function(a){return arguments.length&&(qc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.xs=function(a){return arguments.length&&(rc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},uf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(qh=+a.y),b(a.y2)&&(zh=+a.y2)):qh=zh=+a,Xe())},uf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(rh=+a.y),b(a.y2)&&(Ah=+a.y2)):rh=Ah=+a,Xe())},uf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&uf.axis.max(a.max),"undefined"!=typeof a.min&&uf.axis.min(a.min))},uf.legend.show=function(a){Sg||(Sg=!0,cj.style("visibility","visible")),mf(Dc(a)),Xe({withLegend:!0})},uf.legend.hide=function(a){nf(Dc(a)),Xe({withLegend:!0}),Sg&&se(a)&&(Sg=!1,cj.style("visibility","hidden"))},uf.resize=function(a){xf=a?a.width:null,yf=a?a.height:null,af({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},uf.destroy=function(){uf.data.targets=void 0,uf.data.xs={},ej.html(""),a.onresize=null},"url"in e.data)tf.xhr(e.data.url,function(a,b){var c,d=tf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=tf.csv.parse(b.response),Qe(c)});else if("rows"in e.data)Qe(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Qe(uc(e.data.columns))}return uf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 89049f47cf8a8d0b8af307ac4c009c9481817668 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Sun, 27 Apr 2014 22:20:23 +0900 Subject: [PATCH 073/178] Fix event rect width when no data --- c3.js | 12 ++++++++---- c3.min.js | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/c3.js b/c3.js index b4f2eb4..92fbb4c 100644 --- a/c3.js +++ b/c3.js @@ -549,10 +549,14 @@ } function getEventRectWidth() { var target = getMaxDataCountTarget(c3.data.targets), - firstData = target.values[0], lastData = target.values[target.values.length - 1], - base = x(lastData.x) - x(firstData.x), - maxDataCount = getMaxDataCount(), - ratio = (hasBarType(c3.data.targets) ? (maxDataCount - (isCategorized ? 0.25 : 1)) / maxDataCount : 1); + firstData, lastData, base, maxDataCount, ratio; + if (!target) { + return 0; + } + firstData = target.values[0], lastData = target.values[target.values.length - 1]; + base = x(lastData.x) - x(firstData.x); + maxDataCount = getMaxDataCount(); + ratio = (hasBarType(c3.data.targets) ? (maxDataCount - (isCategorized ? 0.25 : 1)) / maxDataCount : 1); return maxDataCount > 1 ? (base * ratio) / (maxDataCount - 1) : base; } function updateLegendStep(step) { diff --git a/c3.min.js b/c3.min.js index f7845db..f46b5a1 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.32"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cMf&&(Mf=0),0>Of&&(Of=0),Nf=Yg?Jf.left-Si-Ti:Mf,Pf=Yg?Of:Rf-Kf.top-Kf.bottom,0>Nf&&(Nf=0),0>Pf&&(Pf=0),p(),Ni&&be(uf.data.targets)&&(Lf.left=Mf/2+Tf)}function o(){aj.select("line."+f.xgridFocus).attr("x1",Yg?0:-10).attr("x2",Yg?Mf:-10).attr("y1",Yg?-10:Jf.top).attr("y2",Yg?-10:Of)}function p(){Tf=Of/2,Sf=.95*Tf,Uf=ae(uf.data.targets)?.6*Sf:0}function q(){var a=Yg?f.axisX:f.axisY,b=tf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=tf.select(wf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return xf?xf:x()}function s(){var a=yf?yf:y();return a>0?a:320}function t(){return be(uf.data.targets)?0:zf?zf:Yg?Zg?v("x"):1:!ph||uh?1:v("y")}function u(){var a=1;return be(uf.data.targets)?0:Af?Af:Ni?P()+(yh&&!Yg?v("y2"):a):yh?Dh||Yg?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||Zg?"x"===a&&mh?mh:"y"!==a||ph?"y2"!==a||yh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Ui:Sg&&!Ni?10:1:0}function x(){return+tf.select(wf).style("width").replace("px","")}function y(){return+tf.select(wf).style("height").replace("px","")}function z(a){return a?-5:-(Jf.left-1)}function A(a){return a?-20:-4}function B(){return z(!Yg)}function C(){return A(!Yg)}function D(){return z(Yg)}function E(){return A(Yg)}function F(a){return a?Mf+2+4:Jf.left+20}function G(a){return a?(mh?mh:0)+80:Of+8}function H(){return F(!Yg)}function I(){return G(!Yg)}function J(){return F(Yg)}function K(){return G(Yg)}function L(){var a=Ac(uf.data.targets),b=a.values[0],c=a.values[a.values.length-1],d=fg(c.x)-fg(b.x),e=zc(),f=Zd(uf.data.targets)?(e-(wi?.25:1))/e:1;return e>1?d*f/(e-1):d}function M(a){Oi=a}function N(a){Pi=a}function O(a){Qi=a}function P(){return Sg?Ni?Pi*(Oi+1):Qf:0}function Q(){return Sg?Ni?Rf:Qi*(Oi+1):0}function R(){var a,b=!fg;Zf=Yg?1:0,$f=Yg?Of:Mf,_f=Yg?0:Of,ag=Yg?Mf:1,bg=Zf,cg=$f,dg=Yg?0:Pf,eg=Yg?Nf:1,fg=T(Zf,$f,b?void 0:fg.domain(),function(){return lg.tickOffset()}),gg=U(_f,ag,b?void 0:gg.domain()),hg=U(_f,ag,b?void 0:hg.domain()),ig=T(Zf,$f,fj,function(a){return a%1?0:og.tickOffset()}),jg=U(dg,eg,b?void 0:jg.domain()),kg=U(dg,eg,b?void 0:kg.domain()),a=$(),lg=X(fg,Ii,a),og=X(ig,Li,a),mg=Y(gg,Ji,vh,xh),ng=Y(hg,Ki,Eh,Gh),b||(Vi.scale(ig),Bf&&Zi.scale(fg)),S()}function S(){Vf=Gb(),Wf=Hb(),Xf=Hb(.98)}function T(a,b,d,e){var f=(vi?tf.time.scale():tf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),wi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=tf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?hg:gg}function W(a){return"y2"===Z(a)?kg:jg}function X(a,b,c){var d=(wi?Eb():tf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),wi?(d.tickCentered(bh),se(dh)&&(dh=!1)):d.tickOffset=function(){var a=Bc(uf.data.targets),b=fg(a[1])-fg(a[0]);return b/zc()/2},wi&&d.categories(ah),d}function Y(a,b,c,d){return tf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in wg?wg[a]:"y"}function $(){var a=vi?Fi:wi?Tc:function(a){return 0>a?a.toFixed(0):a};return ch&&("function"==typeof ch?a=ch:vi&&(a=function(a){return a?Ei(ch)(a):""})),a}function _(a){var b;return"y"===a?b=th:"y2"===a?b=Ch:"x"===a&&(b=oh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?th=b:"y2"===a?Ch=b:"x"===a&&(oh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",Yg?"inner-top":"inner-right")}function hb(){return fb("y",Yg?"inner-right":"inner-top")}function ib(){return fb("y2",Yg?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Mf/2:Mf:b.isBottom?-Of:b.isMiddle?-Of/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!Yg,gb())}function rb(){return nb(Yg,hb())}function sb(){return nb(Yg,ib())}function tb(){return ob(!Yg,gb())}function ub(){return ob(Yg,hb())}function vb(){return ob(Yg,ib())}function wb(){var a=gb();return Yg?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":mh?mh-10:"3em"}function xb(){var a=hb();return Yg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return Yg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!Yg,gb())}function Ab(){return pb(Yg,hb())}function Bb(){return pb(Yg,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return tf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?30:b}function Db(){aj.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),aj.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),aj.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 tf.min(Object.keys(i).map(function(a){return tf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(vg.length>0)for(g=Sc(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 tf.max(Object.keys(i).map(function(a){return tf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Ah:rh,n="y2"===c?zh:qh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Bh:sh,r=ud()&&Yg;return 0===l.length?"y2"===c?hg.domain():gg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(gg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&wh&&(f=b(wh.top)?wh.top:e,g=b(wh.bottom)?wh.bottom:e),"y2"===c&&Fh&&(f=b(Fh.top)?Fh.top:e,g=b(Fh.bottom)?Fh.bottom:e),Zd(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return kh?vi?oe(kh):kh:tf.min(a,function(a){return tf.min(a.values,function(a){return a.x})})}function Zb(a){return jh?vi?oe(jh):jh:tf.max(a,function(a){return tf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return wi?d=0:Zd(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof lh&&te(lh)?(e=b(lh.left)?lh.left:d,f=b(lh.right)?lh.right:d):e=f="number"==typeof lh?lh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?gg:hg;return b="y"===a.axis||"y2"===a.axis?Yg?Of:"start"in a?d(a.start):Of:Yg?"end"in a?fg(vi?oe(a.end):a.end):Of:Of,c>b?0:b-c}function ic(a){return pg&&a===pg||te(qg)&&ue(qg,a)}function jc(a){return!ic(a)}function kc(a){return pg?pg:te(qg)?qg[a]:null}function lc(a,b){var c,d=b&&te(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=uf.data.xs[b])}),c}function mc(a,b){return a in uf.data.xs&&uf.data.xs[a]&&uf.data.xs[a][b]?uf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){qg[b]=a[b]})}function oc(a){return 1===tf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=tg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),uf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=vi?a?a instanceof Date?a:oe(a):oe(mc(c,d)):xi&&!wi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?uf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):pg?(d=Object.keys(uf.data.xs),uf.data.xs[c]=d.length>0?uf.data.xs[d[0]]:void 0):te(qg)&&(uf.data.xs[c]=lc(f,uf.data.targets)):uf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!uf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=sg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return xi&&wi&&0===c&&g&&(0===e&&(ah=[]),ah.push(g)),("undefined"==typeof a[b]||uf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),xg&&Xd(Cc(c).filter(function(a){return!(a in yg)}),xg),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&uf.data.targets[0].values[a-1]?uf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(uf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(vi?new Date(h):h);i.push(d)}return vi||(i=i.sort(function(a,b){return a-b})),i}function Lc(a){Gi=Gi.concat(a)}function Mc(a){Gi=Gi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Hi=Hi.concat(a)}function Oc(a){Hi=Hi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Dd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Dd(a,g))),Gd(e,b)):Ed(a,b,f,g)}function Fd(a,b){var c;return c=a.map(function(a){return Ed(a.values,b)}),Gd(c,b)}function Gd(a,b){var c,d;return a.forEach(function(a){var e=ve(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Hd(a,b){return tf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Id(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 Jd(){return Ag&&"desc"===Ag.toLowerCase()}function Kd(){return Ag&&"asc"===Ag.toLowerCase()}function Ld(a){var b=Kd(),c=Jd();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 Ag&&a.sort(Ag),a}function Md(a,c){var d,e,f,g,h,i,j,k=be(uf.data.targets),l=k?xd:wd,m=a.filter(function(a){return a&&b(a.value)});ii&&0!==m.length&&(dj.html(li(a,$(),l,Di)).style("display","block"),d=dj.property("offsetWidth"),e=dj.property("offsetHeight"),k?(g=Mf/2+c[0],i=Of/2+c[1]+20):(Yg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=fg(m[0].x)+20):(f=q(),g=f+t()+fg(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),dj.style("top",i+"px").style("left",g+"px"))}function Nd(){dj.style("display","none")}function Od(a){var c=a.filter(function(a){return a&&b(a.value)});ii&&($d(uf.data.targets)||be(uf.data.targets)||aj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Yg?"y1":"x1",zd).attr(Yg?"y2":"x2",zd))}function Pd(){aj.select("line."+f.xgridFocus).style("visibility","hidden")}function Qd(a){return a.x||0===a.x?fg(a.x):null}function Rd(a){return V(a.id)(a.value)}function Sd(){var a,b,d={},e=0;return Ic(Fc(ee)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Wd(a,b){return Uh?Uh:b?2*a.tickOffset()*Vh/b:0}function Xd(a,b){Dc(a).forEach(function(a){hj[a]=b===yg[a],yg[a]=b})}function Yd(a,b){var c=!1;return a.forEach(function(a){yg[a.id]===b&&(c=!0),a.id in yg||"line"!==b||(c=!0)}),c}function Zd(a){return Yd(a,"bar")}function $d(a){return Yd(a,"scatter")}function _d(a){return Yd(a,"pie")}function ae(a){return Yd(a,"donut")}function be(a){return _d(a)||ae(a)}function ce(a){var b="string"==typeof a?a:a.id;return!(b in yg)||"line"===yg[b]||"spline"===yg[b]||"area"===yg[b]||"area-spline"===yg[b]}function de(a){var b="string"==typeof a?a:a.id;return"spline"===yg[b]||"area-spline"===yg[b]}function ee(a){var b="string"==typeof a?a:a.id;return"bar"===yg[b]}function fe(a){var b="string"==typeof a?a:a.id;return"scatter"===yg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"pie"===yg[b]}function he(a){var b="string"==typeof a?a:a.id;return"donut"===yg[b]}function ie(a){return ge(a)||he(a)}function je(a){return ee(a)?a.values:[]}function ke(a){return ce(a)||fe(a)?a.values:[]}function le(a){return ee(a)||ce(a)?a.values:[]}function me(a){return he(a)&&ci||ge(a)&&Yh}function ne(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function oe(b){var c;try{c=rg?tf.time.format(rg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+rg)}return c}function pe(a,b){var c=tf.mouse(a),d=tf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function ue(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ve(a,b){var c="y"===Z(a.id)?gg:hg,d=Yg?1:0,e=Yg?0:1;return Math.pow(fg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function we(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function xe(a,b,c){Lg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd).attr("stroke",function(){return Di(b)}).attr("r",1.4*Sh).transition().duration(100).attr("r",Sh)}function ye(a,b,c){Mg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ze(a,b,c,d){a?xe(b,c,d):ye(b,c,d)}function Ae(a,b){Lg(b,a.node()),a.transition().duration(100).style("fill",function(){return tf.rgb(Di(b)).darker(1)})}function Be(a,b){Mg(b,a.node()),a.transition().duration(100).style("fill",function(){return Di(b)})}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a){return a.filter(function(a){return b(a.value)})}function Ee(a,c){return(c?aj.selectAll("."+f.circles+ld(c)):aj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Fe(a,b){Ee(a,b).classed(f.EXPANDED,!0).attr("r",Rh)}function Ge(a){Ee(a).filter(function(){return tf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oh)}function He(a){return aj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ie(a){He(a).classed(f.EXPANDED,!0)}function Je(a){He(a).classed(f.EXPANDED,!1)}function Ke(a,b){var c=Oe(a,b);return function(a,b){var d=c(a,b),e=Yg?1:0,f=Yg?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 Le(a,b){var c=Oe(a,!1),d=b?Me:Ne;return function(a,b){return d(c(a,b),a,this)}}function Me(a,b){var c;return Yg?(c=ee(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ne(a,b,c){var d=c.getBoundingClientRect();return Yg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ee(b)?-3:-6)}function Oe(a,b){var c=a.__max__+1,d=Wd(lg,c),e=Td(d,c,a,!!b),f=Ud(!!b),g=Vd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Yg&&(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 Pe(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 Qe(b){var c,d,e;if(ej=tf.select(wf),ej.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ej.html(""),ej.classed("c3",!0),uf.data.xs={},uf.data.targets=vc(b),n(),R(),fg.domain(tf.extent(_b(uf.data.targets))),gg.domain(Xb(uf.data.targets,"y")),hg.domain(Xb(uf.data.targets,"y2")),ig.domain(fg.domain()),jg.domain(gg.domain()),kg.domain(hg.domain()),fj=fg.domain(),Vi.scale(ig),Bf&&Zi.scale(fg),$i=ej.append("svg").attr("width",Mf+Jf.left+Jf.right).attr("height",Of+Jf.top+Jf.bottom).on("mouseenter",Ef).on("mouseleave",Ff),_i=$i.append("defs"),_i.append("clipPath").attr("id",pi).append("rect").attr("width",Mf).attr("height",Of),_i.append("clipPath").attr("id",qi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),_i.append("clipPath").attr("id",ri).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),aj=$i.append("g").attr("transform",Mi.main),bj=$i.append("g").attr("transform",Mi.context),cj=$i.append("g").attr("transform",Mi.legend),Pg||bj.style("visibility","hidden"),Sg||(cj.style("visibility","hidden"),Hi=Cc(uf.data.targets)),dj=tf.select(wf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),of(Cc(uf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Zg&&aj.append("g").attr("class",f.axisX).attr("clip-path",ti).attr("transform",Mi.x).append("text").attr("class",f.axisXLabel).attr("transform",Yg?"rotate(-90)":"").style("text-anchor",zb),ph&&aj.append("g").attr("class",f.axisY).attr("clip-path",ui).attr("transform",Mi.y).append("text").attr("class",f.axisYLabel).attr("transform",Yg?"":"rotate(-90)").style("text-anchor",Ab),yh&&aj.append("g").attr("class",f.axisY2).attr("transform",Mi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Yg?"":"rotate(-90)").style("text-anchor",Bb),d=aj.append("g").attr("clip-path",si).attr("class",f.grid),Hh&&d.append("g").attr("class",f.xgrids),te(Jh)&&d.append("g").attr("class",f.xgridLines),Ph&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Kh&&d.append("g").attr("class",f.ygrids),te(Lh)&&d.append("g").attr("class",f.ygridLines),aj.append("g").attr("clip-path",si).attr("class",f.regions),aj.append("g").attr("clip-path",si).attr("class",f.chart),c=aj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Bf?Yg?"ns-resize":"ew-resize":null),aj.select("."+f.chart).append("g").attr("class",f.chartBars),aj.select("."+f.chart).append("g").attr("class",f.chartLines),aj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Mi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),aj.select("."+f.chart).append("g").attr("class",f.chartTexts),Bf&&aj.insert("rect",Df?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Mf).attr("height",Of).style("opacity",0).style("cursor",Yg?"ns-resize":"ew-resize").call(Zi).on("dblclick.zoom",null),nh&&Vi.extent("function"!=typeof nh?nh:nh(_b())),bj.append("g").attr("clip-path",si).attr("class",f.chart),bj.select("."+f.chart).append("g").attr("class",f.chartBars),bj.select("."+f.chart).append("g").attr("class",f.chartLines),bj.append("g").attr("clip-path",si).attr("class",f.brush).call(Vi).selectAll("rect").attr(Yg?"width":"height",Yg?Nf:Pf),bj.append("g").attr("class",f.axisX).attr("transform",Mi.subx).attr("clip-path",Yg?"":ti),bf(uf.data.targets),Yg?aj.select("."+f.axisX).style("opacity",0).call(lg):(aj.select("."+f.axisY).style("opacity",0).call(mg),aj.select("."+f.axisY2).style("opacity",0).call(ng)),n(),R(),_e(),m(!1),Xe({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),mi){if(vi&&"string"==typeof ni){for(ni=oe(ni),e=0;eMf&&(Mf=0),0>Of&&(Of=0),Nf=Yg?Jf.left-Si-Ti:Mf,Pf=Yg?Of:Rf-Kf.top-Kf.bottom,0>Nf&&(Nf=0),0>Pf&&(Pf=0),p(),Ni&&be(uf.data.targets)&&(Lf.left=Mf/2+Tf)}function o(){aj.select("line."+f.xgridFocus).attr("x1",Yg?0:-10).attr("x2",Yg?Mf:-10).attr("y1",Yg?-10:Jf.top).attr("y2",Yg?-10:Of)}function p(){Tf=Of/2,Sf=.95*Tf,Uf=ae(uf.data.targets)?.6*Sf:0}function q(){var a=Yg?f.axisX:f.axisY,b=tf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=tf.select(wf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return xf?xf:x()}function s(){var a=yf?yf:y();return a>0?a:320}function t(){return be(uf.data.targets)?0:zf?zf:Yg?Zg?v("x"):1:!ph||uh?1:v("y")}function u(){var a=1;return be(uf.data.targets)?0:Af?Af:Ni?P()+(yh&&!Yg?v("y2"):a):yh?Dh||Yg?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||Zg?"x"===a&&mh?mh:"y"!==a||ph?"y2"!==a||yh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Ui:Sg&&!Ni?10:1:0}function x(){return+tf.select(wf).style("width").replace("px","")}function y(){return+tf.select(wf).style("height").replace("px","")}function z(a){return a?-5:-(Jf.left-1)}function A(a){return a?-20:-4}function B(){return z(!Yg)}function C(){return A(!Yg)}function D(){return z(Yg)}function E(){return A(Yg)}function F(a){return a?Mf+2+4:Jf.left+20}function G(a){return a?(mh?mh:0)+80:Of+8}function H(){return F(!Yg)}function I(){return G(!Yg)}function J(){return F(Yg)}function K(){return G(Yg)}function L(){var a,b,c,d,e,f=Ac(uf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=fg(b.x)-fg(a.x),d=zc(),e=Zd(uf.data.targets)?(d-(wi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Oi=a}function N(a){Pi=a}function O(a){Qi=a}function P(){return Sg?Ni?Pi*(Oi+1):Qf:0}function Q(){return Sg?Ni?Rf:Qi*(Oi+1):0}function R(){var a,b=!fg;Zf=Yg?1:0,$f=Yg?Of:Mf,_f=Yg?0:Of,ag=Yg?Mf:1,bg=Zf,cg=$f,dg=Yg?0:Pf,eg=Yg?Nf:1,fg=T(Zf,$f,b?void 0:fg.domain(),function(){return lg.tickOffset()}),gg=U(_f,ag,b?void 0:gg.domain()),hg=U(_f,ag,b?void 0:hg.domain()),ig=T(Zf,$f,fj,function(a){return a%1?0:og.tickOffset()}),jg=U(dg,eg,b?void 0:jg.domain()),kg=U(dg,eg,b?void 0:kg.domain()),a=$(),lg=X(fg,Ii,a),og=X(ig,Li,a),mg=Y(gg,Ji,vh,xh),ng=Y(hg,Ki,Eh,Gh),b||(Vi.scale(ig),Bf&&Zi.scale(fg)),S()}function S(){Vf=Gb(),Wf=Hb(),Xf=Hb(.98)}function T(a,b,d,e){var f=(vi?tf.time.scale():tf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),wi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=tf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?hg:gg}function W(a){return"y2"===Z(a)?kg:jg}function X(a,b,c){var d=(wi?Eb():tf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),wi?(d.tickCentered(bh),se(dh)&&(dh=!1)):d.tickOffset=function(){var a=Bc(uf.data.targets),b=fg(a[1])-fg(a[0]);return b/zc()/2},wi&&d.categories(ah),d}function Y(a,b,c,d){return tf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in wg?wg[a]:"y"}function $(){var a=vi?Fi:wi?Tc:function(a){return 0>a?a.toFixed(0):a};return ch&&("function"==typeof ch?a=ch:vi&&(a=function(a){return a?Ei(ch)(a):""})),a}function _(a){var b;return"y"===a?b=th:"y2"===a?b=Ch:"x"===a&&(b=oh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?th=b:"y2"===a?Ch=b:"x"===a&&(oh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",Yg?"inner-top":"inner-right")}function hb(){return fb("y",Yg?"inner-right":"inner-top")}function ib(){return fb("y2",Yg?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Mf/2:Mf:b.isBottom?-Of:b.isMiddle?-Of/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!Yg,gb())}function rb(){return nb(Yg,hb())}function sb(){return nb(Yg,ib())}function tb(){return ob(!Yg,gb())}function ub(){return ob(Yg,hb())}function vb(){return ob(Yg,ib())}function wb(){var a=gb();return Yg?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":mh?mh-10:"3em"}function xb(){var a=hb();return Yg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return Yg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!Yg,gb())}function Ab(){return pb(Yg,hb())}function Bb(){return pb(Yg,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return tf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?30:b}function Db(){aj.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),aj.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),aj.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 tf.min(Object.keys(i).map(function(a){return tf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(vg.length>0)for(g=Sc(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 tf.max(Object.keys(i).map(function(a){return tf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Ah:rh,n="y2"===c?zh:qh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Bh:sh,r=ud()&&Yg;return 0===l.length?"y2"===c?hg.domain():gg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(gg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&wh&&(f=b(wh.top)?wh.top:e,g=b(wh.bottom)?wh.bottom:e),"y2"===c&&Fh&&(f=b(Fh.top)?Fh.top:e,g=b(Fh.bottom)?Fh.bottom:e),Zd(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return kh?vi?oe(kh):kh:tf.min(a,function(a){return tf.min(a.values,function(a){return a.x})})}function Zb(a){return jh?vi?oe(jh):jh:tf.max(a,function(a){return tf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return wi?d=0:Zd(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof lh&&te(lh)?(e=b(lh.left)?lh.left:d,f=b(lh.right)?lh.right:d):e=f="number"==typeof lh?lh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?gg:hg;return b="y"===a.axis||"y2"===a.axis?Yg?Of:"start"in a?d(a.start):Of:Yg?"end"in a?fg(vi?oe(a.end):a.end):Of:Of,c>b?0:b-c}function ic(a){return pg&&a===pg||te(qg)&&ue(qg,a)}function jc(a){return!ic(a)}function kc(a){return pg?pg:te(qg)?qg[a]:null}function lc(a,b){var c,d=b&&te(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=uf.data.xs[b])}),c}function mc(a,b){return a in uf.data.xs&&uf.data.xs[a]&&uf.data.xs[a][b]?uf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){qg[b]=a[b]})}function oc(a){return 1===tf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=tg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),uf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=vi?a?a instanceof Date?a:oe(a):oe(mc(c,d)):xi&&!wi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?uf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):pg?(d=Object.keys(uf.data.xs),uf.data.xs[c]=d.length>0?uf.data.xs[d[0]]:void 0):te(qg)&&(uf.data.xs[c]=lc(f,uf.data.targets)):uf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!uf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=sg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return xi&&wi&&0===c&&g&&(0===e&&(ah=[]),ah.push(g)),("undefined"==typeof a[b]||uf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),xg&&Xd(Cc(c).filter(function(a){return!(a in yg)}),xg),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&uf.data.targets[0].values[a-1]?uf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(uf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(vi?new Date(h):h);i.push(d)}return vi||(i=i.sort(function(a,b){return a-b})),i}function Lc(a){Gi=Gi.concat(a)}function Mc(a){Gi=Gi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Hi=Hi.concat(a)}function Oc(a){Hi=Hi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Dd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Dd(a,g))),Gd(e,b)):Ed(a,b,f,g)}function Fd(a,b){var c;return c=a.map(function(a){return Ed(a.values,b)}),Gd(c,b)}function Gd(a,b){var c,d;return a.forEach(function(a){var e=ve(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Hd(a,b){return tf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Id(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 Jd(){return Ag&&"desc"===Ag.toLowerCase()}function Kd(){return Ag&&"asc"===Ag.toLowerCase()}function Ld(a){var b=Kd(),c=Jd();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 Ag&&a.sort(Ag),a}function Md(a,c){var d,e,f,g,h,i,j,k=be(uf.data.targets),l=k?xd:wd,m=a.filter(function(a){return a&&b(a.value)});ii&&0!==m.length&&(dj.html(li(a,$(),l,Di)).style("display","block"),d=dj.property("offsetWidth"),e=dj.property("offsetHeight"),k?(g=Mf/2+c[0],i=Of/2+c[1]+20):(Yg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=fg(m[0].x)+20):(f=q(),g=f+t()+fg(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),dj.style("top",i+"px").style("left",g+"px"))}function Nd(){dj.style("display","none")}function Od(a){var c=a.filter(function(a){return a&&b(a.value)});ii&&($d(uf.data.targets)||be(uf.data.targets)||aj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Yg?"y1":"x1",zd).attr(Yg?"y2":"x2",zd))}function Pd(){aj.select("line."+f.xgridFocus).style("visibility","hidden")}function Qd(a){return a.x||0===a.x?fg(a.x):null}function Rd(a){return V(a.id)(a.value)}function Sd(){var a,b,d={},e=0;return Ic(Fc(ee)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Wd(a,b){return Uh?Uh:b?2*a.tickOffset()*Vh/b:0}function Xd(a,b){Dc(a).forEach(function(a){hj[a]=b===yg[a],yg[a]=b})}function Yd(a,b){var c=!1;return a.forEach(function(a){yg[a.id]===b&&(c=!0),a.id in yg||"line"!==b||(c=!0)}),c}function Zd(a){return Yd(a,"bar")}function $d(a){return Yd(a,"scatter")}function _d(a){return Yd(a,"pie")}function ae(a){return Yd(a,"donut")}function be(a){return _d(a)||ae(a)}function ce(a){var b="string"==typeof a?a:a.id;return!(b in yg)||"line"===yg[b]||"spline"===yg[b]||"area"===yg[b]||"area-spline"===yg[b]}function de(a){var b="string"==typeof a?a:a.id;return"spline"===yg[b]||"area-spline"===yg[b]}function ee(a){var b="string"==typeof a?a:a.id;return"bar"===yg[b]}function fe(a){var b="string"==typeof a?a:a.id;return"scatter"===yg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"pie"===yg[b]}function he(a){var b="string"==typeof a?a:a.id;return"donut"===yg[b]}function ie(a){return ge(a)||he(a)}function je(a){return ee(a)?a.values:[]}function ke(a){return ce(a)||fe(a)?a.values:[]}function le(a){return ee(a)||ce(a)?a.values:[]}function me(a){return he(a)&&ci||ge(a)&&Yh}function ne(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function oe(b){var c;try{c=rg?tf.time.format(rg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+rg)}return c}function pe(a,b){var c=tf.mouse(a),d=tf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function ue(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ve(a,b){var c="y"===Z(a.id)?gg:hg,d=Yg?1:0,e=Yg?0:1;return Math.pow(fg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function we(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function xe(a,b,c){Lg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd).attr("stroke",function(){return Di(b)}).attr("r",1.4*Sh).transition().duration(100).attr("r",Sh)}function ye(a,b,c){Mg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ze(a,b,c,d){a?xe(b,c,d):ye(b,c,d)}function Ae(a,b){Lg(b,a.node()),a.transition().duration(100).style("fill",function(){return tf.rgb(Di(b)).darker(1)})}function Be(a,b){Mg(b,a.node()),a.transition().duration(100).style("fill",function(){return Di(b)})}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a){return a.filter(function(a){return b(a.value)})}function Ee(a,c){return(c?aj.selectAll("."+f.circles+ld(c)):aj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Fe(a,b){Ee(a,b).classed(f.EXPANDED,!0).attr("r",Rh)}function Ge(a){Ee(a).filter(function(){return tf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oh)}function He(a){return aj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ie(a){He(a).classed(f.EXPANDED,!0)}function Je(a){He(a).classed(f.EXPANDED,!1)}function Ke(a,b){var c=Oe(a,b);return function(a,b){var d=c(a,b),e=Yg?1:0,f=Yg?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 Le(a,b){var c=Oe(a,!1),d=b?Me:Ne;return function(a,b){return d(c(a,b),a,this)}}function Me(a,b){var c;return Yg?(c=ee(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ne(a,b,c){var d=c.getBoundingClientRect();return Yg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ee(b)?-3:-6)}function Oe(a,b){var c=a.__max__+1,d=Wd(lg,c),e=Td(d,c,a,!!b),f=Ud(!!b),g=Vd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Yg&&(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 Pe(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 Qe(b){var c,d,e;if(ej=tf.select(wf),ej.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ej.html(""),ej.classed("c3",!0),uf.data.xs={},uf.data.targets=vc(b),n(),R(),fg.domain(tf.extent(_b(uf.data.targets))),gg.domain(Xb(uf.data.targets,"y")),hg.domain(Xb(uf.data.targets,"y2")),ig.domain(fg.domain()),jg.domain(gg.domain()),kg.domain(hg.domain()),fj=fg.domain(),Vi.scale(ig),Bf&&Zi.scale(fg),$i=ej.append("svg").attr("width",Mf+Jf.left+Jf.right).attr("height",Of+Jf.top+Jf.bottom).on("mouseenter",Ef).on("mouseleave",Ff),_i=$i.append("defs"),_i.append("clipPath").attr("id",pi).append("rect").attr("width",Mf).attr("height",Of),_i.append("clipPath").attr("id",qi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),_i.append("clipPath").attr("id",ri).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),aj=$i.append("g").attr("transform",Mi.main),bj=$i.append("g").attr("transform",Mi.context),cj=$i.append("g").attr("transform",Mi.legend),Pg||bj.style("visibility","hidden"),Sg||(cj.style("visibility","hidden"),Hi=Cc(uf.data.targets)),dj=tf.select(wf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),of(Cc(uf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Zg&&aj.append("g").attr("class",f.axisX).attr("clip-path",ti).attr("transform",Mi.x).append("text").attr("class",f.axisXLabel).attr("transform",Yg?"rotate(-90)":"").style("text-anchor",zb),ph&&aj.append("g").attr("class",f.axisY).attr("clip-path",ui).attr("transform",Mi.y).append("text").attr("class",f.axisYLabel).attr("transform",Yg?"":"rotate(-90)").style("text-anchor",Ab),yh&&aj.append("g").attr("class",f.axisY2).attr("transform",Mi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Yg?"":"rotate(-90)").style("text-anchor",Bb),d=aj.append("g").attr("clip-path",si).attr("class",f.grid),Hh&&d.append("g").attr("class",f.xgrids),te(Jh)&&d.append("g").attr("class",f.xgridLines),Ph&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Kh&&d.append("g").attr("class",f.ygrids),te(Lh)&&d.append("g").attr("class",f.ygridLines),aj.append("g").attr("clip-path",si).attr("class",f.regions),aj.append("g").attr("clip-path",si).attr("class",f.chart),c=aj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Bf?Yg?"ns-resize":"ew-resize":null),aj.select("."+f.chart).append("g").attr("class",f.chartBars),aj.select("."+f.chart).append("g").attr("class",f.chartLines),aj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Mi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),aj.select("."+f.chart).append("g").attr("class",f.chartTexts),Bf&&aj.insert("rect",Df?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Mf).attr("height",Of).style("opacity",0).style("cursor",Yg?"ns-resize":"ew-resize").call(Zi).on("dblclick.zoom",null),nh&&Vi.extent("function"!=typeof nh?nh:nh(_b())),bj.append("g").attr("clip-path",si).attr("class",f.chart),bj.select("."+f.chart).append("g").attr("class",f.chartBars),bj.select("."+f.chart).append("g").attr("class",f.chartLines),bj.append("g").attr("clip-path",si).attr("class",f.brush).call(Vi).selectAll("rect").attr(Yg?"width":"height",Yg?Nf:Pf),bj.append("g").attr("class",f.axisX).attr("transform",Mi.subx).attr("clip-path",Yg?"":ti),bf(uf.data.targets),Yg?aj.select("."+f.axisX).style("opacity",0).call(lg):(aj.select("."+f.axisY).style("opacity",0).call(mg),aj.select("."+f.axisY2).style("opacity",0).call(ng)),n(),R(),_e(),m(!1),Xe({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),mi){if(vi&&"string"==typeof ni){for(ni=oe(ni),e=0;e0){d=[];for(var g in tg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Id(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ce,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 Ve(a){be(uf.data.targets)||Eg&&(yi=a,aj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),zi=!0,Ng())}function We(){be(uf.data.targets)||Eg&&(aj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),aj.selectAll("."+f.shape).classed(f.INCLUDED,!1),zi=!1,Og())}function Xe(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Sd(),W=be(uf.data.targets),X=Ic(uf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?If:0,Q=D?P:0,R=E?P:0,c=aj.select("."+f.axisX).style("opacity",W?0:1),g=aj.select("."+f.axisY).style("opacity",W?0:1),h=aj.select("."+f.axisY2).style("opacity",W?0:1),e=bj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Sg&&of(Cc(uf.data.targets),a,O),wi&&(0===X.length||!H||G)&&fg.domain([0,c.selectAll(".tick").size()]),X.length&&(H&&(fg.domain(tf.extent(_b(X))),fj=fg.domain(),Bf&&Zi.scale(fg).updateScaleExtent(),ig.domain(fg.domain()),Vi.scale(ig)),G&&(fg.domain(Vi.empty()?fj:Vi.extent()),Bf&&Zi.scale(fg).updateScaleExtent())),gg.domain(Xb(X,"y")),hg.domain(Xb(X,"y2")),(gh||fh)&&(S=hh?hh:Kc(Jc(X)),lg.tickValues(S),og.tickValues(S)),O.axisX.call(lg),O.axisY.call(mg),O.axisY2.call(ng),O.axisSubX.call(og),G)if(dh&&S){for(T=1;T=0&&tf.select(this).style("display",b%U?"none":"block")})}else tf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!Yg&&ih&&eb(c,O.axisX,ih),J=Ke(V),M=Le(V,!0),N=Le(V,!1),Db(),jg.domain(gg.domain()),kg.domain(hg.domain()),dj.style("display","none"),o(),aj.select("line."+f.xgridFocus).style("visibility","hidden"),Hh){if("year"===Ih){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=fg.ticks(10);i=aj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",Yg?0:function(a){return fg(a)-lg.tickOffset()}).attr("x2",Yg?Mf:function(a){return fg(a)-lg.tickOffset()}).attr("y1",Yg?function(a){return fg(a)-lg.tickOffset()}:Jf.top).attr("y2",Yg?function(a){return fg(a)-lg.tickOffset()}:Of).style("opacity",function(){return+tf.select(this).attr(Yg?"y1":"x1")===(Yg?Of:0)?0:1}),i.exit().remove()}te(Jh)&&(k=aj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Jh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",Yg?"":"rotate(-90)").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",Yg?0:Ad).attr("x2",Yg?Mf:Ad).attr("y1",Yg?Ad:Jf.top).attr("y2",Yg?Ad:Of).style("opacity",1),k.select("text").transition().duration(P).attr("x",Yg?Mf:0).attr("y",Ad).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Kh&&(m=aj.select("."+f.ygrids).selectAll("."+f.ygrid).data(gg.ticks(Mh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",Yg?gg:0).attr("x2",Yg?gg:Mf).attr("y1",Yg?0:gg).attr("y2",Yg?Of:gg),m.exit().remove()),A&&te(Lh)&&(n=aj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Lh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",Yg?"rotate(-90)":"").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",Yg?Bd:0).attr("x2",Yg?Bd:Mf).attr("y1",Yg?0:Bd).attr("y2",Yg?Of:Bd).style("opacity",1),n.select("text").transition().duration(P).attr("x",Yg?0:Mf).attr("y",Bd).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=aj.select("."+f.regions).selectAll("rect."+f.region).data(hi),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=aj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Di(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=aj.selectAll("."+f.texts).selectAll("."+f.text).data(le),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return Yg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return yd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),aj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",Wi).style("opacity",1),aj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",Xi).style("opacity",gj),q=aj.selectAll("."+f.circles).selectAll("."+f.circle).data(ke),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Oh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),q.exit().remove(),aj.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=tf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1),aj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&ie(a.data)?1:0}),aj.select("."+f.chartArcsTitle).style("opacity",ae(uf.data.targets)?1:0),Pg&&(null!==tf.event&&"zoom"===tf.event.type&&Vi.extent(fg.orgDomain()).update(),B&&(!Yg&&ih&&eb(e,O.axisSubX,ih),Vi.empty()||Vi.extent(fg.orgDomain()).update(),K=Ke(V,!0),u=bj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Di(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),bj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",Yi).style("opacity",1))),aj.selectAll("."+f.selectedCircles).filter(function(a){return ee(a)}).selectAll("circle").remove(),aj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),v=aj.select("."+f.eventRects),te(qg)&&!oc(qg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Se(w.enter()),w.attr("x",0).attr("y",0).attr("width",Mf).attr("height",Of)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),xi&&!wi?(z=function(a,b){var c=xc(b),d=yc(b),e=uf.data.xs[a.id][b];return(fg(d?d:e+50)-fg(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=uf.data.xs[a.id][b];return(fg(d)+fg(c?c:d-50))/2}):(z=L(),y=function(a){return fg(a.x)-z/2}),x=Ac(uf.data.targets),aj.select("."+f.eventRects).datum(x?x.values:[]),w=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Re(w.enter()),w.attr("class",fd).attr("x",Yg?0:y).attr("y",Yg?y:0).attr("width",Yg?Mf:z).attr("height",Yg?z:Of),w.exit().remove()),Cc(uf.data.targets).forEach(function(a){hj[a]=!0})}function Ye(){Xe({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ze(){return"mousemove"===tf.event.sourceEvent.type&&Zi.altDomain?(fg.domain(Zi.altDomain),void Zi.scale(fg).updateScaleExtent()):(wi&&fg.orgDomain()[0]===fj[0]&&fg.domain([fj[0]-1e-10,fg.orgDomain()[1]]),Xe({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===tf.event.sourceEvent.type&&(Ai=!0)))}function $e(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function _e(){$i.attr("width",Qf).attr("height",Rf),$i.select("#"+pi).select("rect").attr("width",Mf).attr("height",Of),$i.select("#"+qi).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),$i.select("#"+ri).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),$i.select("."+f.zoomRect).attr("width",Mf).attr("height",Of),ej.style("max-height",Rf+"px")}function af(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),_e(),m(a.withTransition),Xe(a)}function bf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=aj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Di(a)}),e=aj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("fill",function(a){return Di(a)}).style("stroke","none").style("cursor",function(a){return Gg(a)?"pointer":null}),c=aj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)}),b.append("path").attr("class",dd).style("opacity",function(){return gj=+tf.select(this).style("opacity"),0}).style("fill",function(a){return Di(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Di(a)}).style("cursor",function(a){return Gg(a)?"pointer":null}),a.forEach(function(a){aj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=aj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Yf(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Di(a.data)}).style("cursor",function(a){return Gg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Fb(a),d=Lb(c),e=Tb();Nb(c.data.id),jf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Fb(a),c=[Lb(b)];Md(c,tf.mouse(this))}).on("mouseout",function(a,b){var c=Fb(a),d=Lb(c),e=Ub();Ob(c.data.id),lf(),Nd(),e(d,b)}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Pg&&(n=bj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Di(a)}),l=bj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)})),$i.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function cf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Xd(a.id,b.types[a.id]):Xd(a.id,b.type)}),uf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Ni?j:i,l=Ni?Q():P();return d&&(x=0,D=0,u=0,v=0),Sg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Ni?v:u,void(Xg?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Ni?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=cj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Ug?Ug(a):uf.toggle(a)}).on("mouseover",function(a){uf.focus(a),"function"==typeof Vg&&Vg(a)}).on("mouseout",function(a){uf.revert(),"function"==typeof Wg&&Wg(a)}),o.append("text").text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ni?h:-200).attr("y",Ni?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ni?i:-200).attr("y",Ni?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Di(a)}).attr("x",Ni?h:-200).attr("y",Ni?-200:j).attr("width",10).attr("height",10),cj.selectAll("text").data(a).text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),cj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),cj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),N(u),O(v),M(D),n(),R(),_e(),r&&m(q,c)}function pf(a){return Ec(uf.data.targets,a.id)}function qf(a){return"data"in a&&Ec(uf.data.targets,a.data.id)}function rf(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 sf(a,b,c){var d=!be(uf.data.targets);Xd(a,b),af(c||{withTransitionForAxis:d})}var tf=a.d3?a.d3:a.require?a.require("d3"):void 0,uf={data:{},axis:{},legend:{}},vf={},wf=h(["bindto"],"#chart"),xf=h(["size","width"]),yf=h(["size","height"]),zf=h(["padding","left"]),Af=h(["padding","right"]),Bf=h(["zoom","enabled"],!1),Cf=h(["zoom","extent"]),Df=h(["zoom","privileged"],!1),Ef=h(["onenter"],function(){}),Ff=h(["onleave"],function(){}),Gf=h(["onresize"],function(){}),Hf=h(["onresized"],function(){}),If=h(["transition","duration"],350);g("data","data is required in config");var Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg=h(["data","x"]),qg=h(["data","xs"],{}),rg=h(["data","x_format"]),sg=h(["data","id_converter"],function(a){return a}),tg=h(["data","names"],{}),ug=h(["data","classes"],{}),vg=h(["data","groups"],[]),wg=h(["data","axes"],{}),xg=h(["data","type"]),yg=h(["data","types"],{}),zg=h(["data","labels"],{}),Ag=h(["data","order"]),Bg=h(["data","regions"],{}),Cg=h(["data","color"]),Dg=h(["data","colors"],{}),Eg=h(["data","selection","enabled"],!1),Fg=h(["data","selection","grouped"],!1),Gg=h(["data","selection","isselectable"],function(){return!0}),Hg=h(["data","selection","multiple"],!0),Ig=h(["data","onclick"],function(){}),Jg=h(["data","onenter"],function(){}),Kg=h(["data","onleave"],function(){}),Lg=h(["data","onselected"],function(){}),Mg=h(["data","onunselected"],function(){}),Ng=h(["data","ondragstart"],function(){}),Og=h(["data","ondragend"],function(){}),Pg=h(["subchart","show"],!1),Qg=h(["subchart","size","height"],60),Rg=h(["color","pattern"],[]),Sg=h(["legend","show"],!0),Tg=h(["legend","position"],"bottom"),Ug=h(["legend","item","onclick"]),Vg=h(["legend","item","onmouseover"]),Wg=h(["legend","item","onmouseout"]),Xg=h(["legend","equally"],!1),Yg=h(["axis","rotated"],!1),Zg=h(["axis","x","show"],!0),$g=h(["axis","x","type"],"indexed"),_g=h(["axis","x","localtime"],!0),ah=h(["axis","x","categories"],[]),bh=h(["axis","x","tick","centered"],!1),ch=h(["axis","x","tick","format"]),dh=h(["axis","x","tick","culling"],{}),eh=h(["axis","x","tick","culling","max"],10),fh=h(["axis","x","tick","count"]),gh=h(["axis","x","tick","fit"],!0),hh=h(["axis","x","tick","values"],null),ih=h(["axis","x","tick","rotate"]),jh=h(["axis","x","max"],null),kh=h(["axis","x","min"],null),lh=h(["axis","x","padding"],{}),mh=h(["axis","x","height"]),nh=h(["axis","x","default"]),oh=h(["axis","x","label"],{}),ph=h(["axis","y","show"],!0),qh=h(["axis","y","max"]),rh=h(["axis","y","min"]),sh=h(["axis","y","center"]),th=h(["axis","y","label"],{}),uh=h(["axis","y","inner"],!1),vh=h(["axis","y","tick","format"]),wh=h(["axis","y","padding"],{}),xh=h(["axis","y","ticks"],10),yh=h(["axis","y2","show"],!1),zh=h(["axis","y2","max"]),Ah=h(["axis","y2","min"]),Bh=h(["axis","y2","center"]),Ch=h(["axis","y2","label"],{}),Dh=h(["axis","y2","inner"],!1),Eh=h(["axis","y2","tick","format"]),Fh=h(["axis","y2","padding"],{}),Gh=h(["axis","y2","ticks"],10),Hh=h(["grid","x","show"],!1),Ih=h(["grid","x","type"],"tick"),Jh=h(["grid","x","lines"],[]),Kh=h(["grid","y","show"],!1),Lh=h(["grid","y","lines"],[]),Mh=h(["grid","y","ticks"],10),Nh=h(["point","show"],!0),Oh=Nh?h(["point","r"],2.5):0,Ph=h(["point","focus","line","enabled"],!0),Qh=h(["point","focus","expand","enabled"],!0),Rh=h(["point","focus","expand","r"],Qh?4:Oh),Sh=h(["point","focus","select","r"],8),Th=h(["line","connect_null"],!1),Uh=h(["bar","width"]),Vh=h(["bar","width","ratio"],.6),Wh=h(["pie","label","show"],!0),Xh=h(["pie","label","format"]),Yh=h(["pie","expand"],!0),Zh=h(["pie","onclick"],function(){}),$h=h(["pie","onmouseover"],function(){}),_h=h(["pie","onmouseout"],function(){}),ai=h(["donut","label","show"],!0),bi=h(["donut","label","format"]),ci=h(["donut","expand"],!0),di=h(["donut","title"],""),ei=h(["donut","onclick"],function(){}),fi=h(["donut","onmouseover"],function(){}),gi=h(["donut","onmouseout"],function(){}),hi=h(["regions"],[]),ii=h(["tooltip","show"],!0),ji=h(["tooltip","format","title"]),ki=h(["tooltip","format","value"]),li=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ji?ji:b,l=ki?ki: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+""}),mi=h(["tooltip","init","show"],!1),ni=h(["tooltip","init","x"],0),oi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),pi=("string"==typeof wf?wf.replace("#",""):wf.id)+"-clip",qi=pi+"-xaxis",ri=pi+"-yaxis",si=i(pi),ti=i(qi),ui=i(ri),vi="timeseries"===$g,wi="categorized"===$g,xi=!vi&&(pg||te(qg)),yi=null,zi=!1,Ai=!1,Bi=!1,Ci=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Di=ne(Dg,te(Rg)?Rg:Ci,Cg),Ei=_g?tf.time.format:tf.time.format.utc,Fi=function(){var a=[[Ei("%Y/%-m/%-d"),function(){return!0}],[Ei("%-m/%-d"),function(a){return a.getMonth()}],[Ei("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ei("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ei("%I %p"),function(a){return a.getHours()}],[Ei("%I:%M"),function(a){return a.getMinutes()}],[Ei(":%S"),function(a){return a.getSeconds()}],[Ei(".%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)}}(),Gi=[],Hi=[],Ii=Yg?"left":"bottom",Ji=Yg?uh?"top":"bottom":uh?"right":"left",Ki=Yg?Dh?"bottom":"top":Dh?"left":"right",Li=Yg?"left":"bottom",Mi={main:function(){return"translate("+Jf.left+","+Jf.top+")"},context:function(){return"translate("+Kf.left+","+Kf.top+")"},legend:function(){return"translate("+Lf.left+","+Lf.top+")"},x:function(){return"translate(0,"+(Yg?0:Of)+")"},y:function(){return"translate(0,"+(Yg?Of:0)+")"},y2:function(){return"translate("+(Yg?0:Mf)+","+(Yg?1:0)+")"},subx:function(){return"translate(0,"+(Yg?0:Pf)+")"},arc:function(){return"translate("+Mf/2+","+Of/2+")"}},Ni="right"===Tg,Oi=0,Pi=0,Qi=0,Ri=.15,Si=30,Ti=Yg&&!Zg?0:30,Ui=5;Yf=tf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Vi,Wi=function(){var a=tf.svg.line().x(Yg?function(a){return V(a.id)(a.value)}:zd).y(Yg?zd:function(a){return V(a.id)(a.value)});return Th||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Th?De(b.values):b.values;return ce(b)?(a.interpolate(de(b)?"cardinal":"linear"),Bg[b.id]?Pe(e,fg,V(b.id),Bg[b.id]):a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Xi=function(){var a;return a=Yg?tf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(zd):tf.svg.area().x(zd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=De(b.values);return Yd([b],"area")||Yd([b],"area-spline")?(a.interpolate(de(b)?"cardinal":"linear"),a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Yi=function(){var a=tf.svg.line().x(Yg?function(a){return W(a.id)(a.value)}:Cd).y(Yg?Cd:function(a){return W(a.id)(a.value)});return function(b){var c=De(b.values);return ce(b)?a(c):"M "+ig(c[0].x)+" "+W(b.id)(c[0].value)}}(),Zi=function(){};Vi=tf.svg.brush().on("brush",Ye),Vi.update=function(){return bj&&bj.select("."+f.brush).call(this),this},Vi.scale=function(a){return Yg?this.y(a):this.x(a)},Bf&&(Zi=tf.behavior.zoom().on("zoomstart",function(){Zi.altDomain=tf.event.sourceEvent.altKey?fg.orgDomain():null}).on("zoom",Bf?Ze:null),Zi.scale=function(a){return Yg?this.y(a):this.x(a)},Zi.orgScaleExtent=function(){var a=Cf?Cf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},Zi.updateScaleExtent=function(){var a=ac(fg.orgDomain())/ac(fj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var $i,_i,aj,bj,cj,dj,ej,fj,gj,hj={};if(uf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),uf.defocus(),b(d.classed(f.focused,!0)),b(e),be(uf.data.targets)&&Nb(a,!0),jf(a)},uf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),kf(a)},uf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),lf()},uf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),$i.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?mf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},uf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),$i.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?nf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Ri),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},uf.toggle=function(a){Gc(a)?uf.hide(a):uf.show(a)},uf.unzoom=function(){Vi.clear().update(),Xe({withUpdateXDomain:!0})},uf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){ug[b]=a.classes[b]}),"categories"in a&&wi&&(ah=a.categories,lg.categories(ah)),"cacheIds"in a&&bc(a.cacheIds)?void cf(dc(a.cacheIds),a.done):void("unload"in a?ef(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){df(a)}):df(a))},uf.unload=function(a){ef(Dc(a),function(){Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},uf.selected=function(a){return tf.merge(aj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return tf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},uf.select=function(a,b,c){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=tf.select(this),i="circle"===this.nodeName?xe:Ae,j="circle"===this.nodeName?ye:Be,k=Fg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Gg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},uf.unselect=function(a,b){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=tf.select(this),g="circle"===this.nodeName?ye:Be,h=Fg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Gg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},uf.toLine=function(a){sf(a,"line")},uf.toSpline=function(a){sf(a,"spline")},uf.toBar=function(a){sf(a,"bar")},uf.toScatter=function(a){sf(a,"scatter")},uf.toArea=function(a){sf(a,"area")},uf.toAreaSpline=function(a){sf(a,"area-spline")},uf.toPie=function(a){sf(a,"pie",{withTransform:!0})},uf.toDonut=function(a){sf(a,"donut",{withTransform:!0})},uf.groups=function(a){return c(a)?vg:(vg=a,Xe(),vg)},uf.xgrids=function(a){return a?(Jh=a,Xe(),Jh):Jh},uf.xgrids.add=function(a){return a?uf.xgrids(Jh.concat(a)):void 0},uf.xgrids.remove=function(a){var b=rf(a);return uf.xgrids(Jh.filter(b))},uf.ygrids=function(a){return a?(Lh=a,Xe(),Lh):Lh},uf.ygrids.add=function(a){return a?uf.ygrids(Lh.concat(a)):void 0 },uf.ygrids.remove=function(a){var b=rf(a);return uf.ygrids(Lh.filter(b))},uf.regions=function(a){return c(a)?hi:(hi=a,Xe(),hi)},uf.regions.add=function(a){return c(a)?hi:(hi=hi.concat(a),Xe(),hi)},uf.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;$i.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),hi=hi.filter(function(b){return b.classes.indexOf(a)<0})}),hi},uf.data.get=function(a){var b=uf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},uf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},uf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){tg[b]=a[b]}),of(Cc(uf.data.targets),{withTransition:!0}),tg):tg},uf.x=function(a){return arguments.length&&(qc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.xs=function(a){return arguments.length&&(rc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},uf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(qh=+a.y),b(a.y2)&&(zh=+a.y2)):qh=zh=+a,Xe())},uf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(rh=+a.y),b(a.y2)&&(Ah=+a.y2)):rh=Ah=+a,Xe())},uf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&uf.axis.max(a.max),"undefined"!=typeof a.min&&uf.axis.min(a.min))},uf.legend.show=function(a){Sg||(Sg=!0,cj.style("visibility","visible")),mf(Dc(a)),Xe({withLegend:!0})},uf.legend.hide=function(a){nf(Dc(a)),Xe({withLegend:!0}),Sg&&se(a)&&(Sg=!1,cj.style("visibility","hidden"))},uf.resize=function(a){xf=a?a.width:null,yf=a?a.height:null,af({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},uf.destroy=function(){uf.data.targets=void 0,uf.data.xs={},ej.html(""),a.onresize=null},"url"in e.data)tf.xhr(e.data.url,function(a,b){var c,d=tf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=tf.csv.parse(b.response),Qe(c)});else if("rows"in e.data)Qe(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Qe(uc(e.data.columns))}return uf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 9eb92e6387fc5850c6d97e59c0ea8b63298ad108 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Mon, 28 Apr 2014 12:44:39 +0900 Subject: [PATCH 074/178] Fix transition cancel on arc - #168 --- c3.js | 38 ++++++++++++++++++++++++++++++-------- c3.min.js | 6 +++--- 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/c3.js b/c3.js index 92fbb4c..aa744a7 100644 --- a/c3.js +++ b/c3.js @@ -290,7 +290,7 @@ isCategorized = (__axis_x_type === 'categorized'), isCustomX = !isTimeSeries && (__data_x || notEmpty(__data_xs)); - var dragStart = null, dragging = false, cancelClick = false, mouseover = false; + var dragStart = null, dragging = false, cancelClick = false, mouseover = false, transiting = false; var defaultColorPattern = ['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd', '#8c564b', '#e377c2', '#7f7f7f', '#bcbd22', '#17becf'], //same as d3.scale.category10() color = generateColor(__data_colors, notEmpty(__color_pattern) ? __color_pattern : defaultColorPattern, __data_color); @@ -3403,7 +3403,7 @@ mainCircle.exit().remove(); // arc - main.selectAll('.' + CLASS.chartArc).select('.' + CLASS.arc) + main.each(function () { transiting = true; }).selectAll('.' + CLASS.chartArc).select('.' + CLASS.arc) .attr("transform", withTransform ? "scale(0)" : "") .style("opacity", function (d) { return d === this._current ? 0 : 1; }) .transition().duration(duration) @@ -3425,7 +3425,10 @@ return function (t) { return getArc(interpolate(t), true); }; }) .attr("transform", withTransform ? "scale(1)" : "") - .style("opacity", 1); + .style("opacity", 1) + .call(endall, function () { + transiting = false; + }); main.selectAll('.' + CLASS.chartArc).select('text') .attr("transform", transformForArcLabel) .style("opacity", 0) @@ -3717,17 +3720,31 @@ .style("cursor", function (d) { return __data_selection_isselectable(d) ? "pointer" : null; }) .each(function (d) { this._current = d; }) .on('mouseover', function (d, i) { - var updated = updateAngle(d), arcData = convertToArcData(updated), callback = getArcOnMouseOver(); + var updated, arcData, callback; + if (transiting) { // skip while transiting + return; + } + updated = updateAngle(d); + arcData = convertToArcData(updated); + callback = getArcOnMouseOver(); + // transitions expandArc(updated.data.id); focusLegend(updated.data.id); callback(arcData, i); }) .on('mousemove', function (d) { - var updated = updateAngle(d), selectedData = [convertToArcData(updated)]; + var updated = updateAngle(d), arcData = convertToArcData(updated), selectedData = [arcData]; showTooltip(selectedData, d3.mouse(this)); }) .on('mouseout', function (d, i) { - var updated = updateAngle(d), arcData = convertToArcData(updated), callback = getArcOnMouseOut(); + var updated, arcData, callback; + if (transiting) { // skip while transiting + return; + } + updated = updateAngle(d); + arcData = convertToArcData(updated); + callback = getArcOnMouseOut(); + // transitions unexpandArc(updated.data.id); revertLegend(); hideTooltip(); @@ -3992,13 +4009,17 @@ typeof __legend_item_onclick === 'function' ? __legend_item_onclick(id) : c3.toggle(id); }) .on('mouseover', function (id) { - c3.focus(id); + if (!transiting) { + c3.focus(id); + } if (typeof __legend_item_onmouseover === 'function') { __legend_item_onmouseover(id); } }) .on('mouseout', function (id) { - c3.revert(); + if (!transiting) { + c3.revert(); + } if (typeof __legend_item_onmouseout === 'function') { __legend_item_onmouseout(id); } @@ -4074,6 +4095,7 @@ } function transformTo(targetIds, type, optionsForRedraw) { var withTransitionForAxis = !hasArcType(c3.data.targets); + transiting = false; setTargetType(targetIds, type); updateAndRedraw(optionsForRedraw || {withTransitionForAxis: withTransitionForAxis}); } diff --git a/c3.min.js b/c3.min.js index f46b5a1..5984b4b 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.32"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cMf&&(Mf=0),0>Of&&(Of=0),Nf=Yg?Jf.left-Si-Ti:Mf,Pf=Yg?Of:Rf-Kf.top-Kf.bottom,0>Nf&&(Nf=0),0>Pf&&(Pf=0),p(),Ni&&be(uf.data.targets)&&(Lf.left=Mf/2+Tf)}function o(){aj.select("line."+f.xgridFocus).attr("x1",Yg?0:-10).attr("x2",Yg?Mf:-10).attr("y1",Yg?-10:Jf.top).attr("y2",Yg?-10:Of)}function p(){Tf=Of/2,Sf=.95*Tf,Uf=ae(uf.data.targets)?.6*Sf:0}function q(){var a=Yg?f.axisX:f.axisY,b=tf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=tf.select(wf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return xf?xf:x()}function s(){var a=yf?yf:y();return a>0?a:320}function t(){return be(uf.data.targets)?0:zf?zf:Yg?Zg?v("x"):1:!ph||uh?1:v("y")}function u(){var a=1;return be(uf.data.targets)?0:Af?Af:Ni?P()+(yh&&!Yg?v("y2"):a):yh?Dh||Yg?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||Zg?"x"===a&&mh?mh:"y"!==a||ph?"y2"!==a||yh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Ui:Sg&&!Ni?10:1:0}function x(){return+tf.select(wf).style("width").replace("px","")}function y(){return+tf.select(wf).style("height").replace("px","")}function z(a){return a?-5:-(Jf.left-1)}function A(a){return a?-20:-4}function B(){return z(!Yg)}function C(){return A(!Yg)}function D(){return z(Yg)}function E(){return A(Yg)}function F(a){return a?Mf+2+4:Jf.left+20}function G(a){return a?(mh?mh:0)+80:Of+8}function H(){return F(!Yg)}function I(){return G(!Yg)}function J(){return F(Yg)}function K(){return G(Yg)}function L(){var a,b,c,d,e,f=Ac(uf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=fg(b.x)-fg(a.x),d=zc(),e=Zd(uf.data.targets)?(d-(wi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Oi=a}function N(a){Pi=a}function O(a){Qi=a}function P(){return Sg?Ni?Pi*(Oi+1):Qf:0}function Q(){return Sg?Ni?Rf:Qi*(Oi+1):0}function R(){var a,b=!fg;Zf=Yg?1:0,$f=Yg?Of:Mf,_f=Yg?0:Of,ag=Yg?Mf:1,bg=Zf,cg=$f,dg=Yg?0:Pf,eg=Yg?Nf:1,fg=T(Zf,$f,b?void 0:fg.domain(),function(){return lg.tickOffset()}),gg=U(_f,ag,b?void 0:gg.domain()),hg=U(_f,ag,b?void 0:hg.domain()),ig=T(Zf,$f,fj,function(a){return a%1?0:og.tickOffset()}),jg=U(dg,eg,b?void 0:jg.domain()),kg=U(dg,eg,b?void 0:kg.domain()),a=$(),lg=X(fg,Ii,a),og=X(ig,Li,a),mg=Y(gg,Ji,vh,xh),ng=Y(hg,Ki,Eh,Gh),b||(Vi.scale(ig),Bf&&Zi.scale(fg)),S()}function S(){Vf=Gb(),Wf=Hb(),Xf=Hb(.98)}function T(a,b,d,e){var f=(vi?tf.time.scale():tf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),wi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=tf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?hg:gg}function W(a){return"y2"===Z(a)?kg:jg}function X(a,b,c){var d=(wi?Eb():tf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),wi?(d.tickCentered(bh),se(dh)&&(dh=!1)):d.tickOffset=function(){var a=Bc(uf.data.targets),b=fg(a[1])-fg(a[0]);return b/zc()/2},wi&&d.categories(ah),d}function Y(a,b,c,d){return tf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in wg?wg[a]:"y"}function $(){var a=vi?Fi:wi?Tc:function(a){return 0>a?a.toFixed(0):a};return ch&&("function"==typeof ch?a=ch:vi&&(a=function(a){return a?Ei(ch)(a):""})),a}function _(a){var b;return"y"===a?b=th:"y2"===a?b=Ch:"x"===a&&(b=oh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?th=b:"y2"===a?Ch=b:"x"===a&&(oh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",Yg?"inner-top":"inner-right")}function hb(){return fb("y",Yg?"inner-right":"inner-top")}function ib(){return fb("y2",Yg?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Mf/2:Mf:b.isBottom?-Of:b.isMiddle?-Of/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!Yg,gb())}function rb(){return nb(Yg,hb())}function sb(){return nb(Yg,ib())}function tb(){return ob(!Yg,gb())}function ub(){return ob(Yg,hb())}function vb(){return ob(Yg,ib())}function wb(){var a=gb();return Yg?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":mh?mh-10:"3em"}function xb(){var a=hb();return Yg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return Yg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!Yg,gb())}function Ab(){return pb(Yg,hb())}function Bb(){return pb(Yg,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return tf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?30:b}function Db(){aj.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),aj.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),aj.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 tf.min(Object.keys(i).map(function(a){return tf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(vg.length>0)for(g=Sc(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 tf.max(Object.keys(i).map(function(a){return tf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Ah:rh,n="y2"===c?zh:qh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Bh:sh,r=ud()&&Yg;return 0===l.length?"y2"===c?hg.domain():gg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(gg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&wh&&(f=b(wh.top)?wh.top:e,g=b(wh.bottom)?wh.bottom:e),"y2"===c&&Fh&&(f=b(Fh.top)?Fh.top:e,g=b(Fh.bottom)?Fh.bottom:e),Zd(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return kh?vi?oe(kh):kh:tf.min(a,function(a){return tf.min(a.values,function(a){return a.x})})}function Zb(a){return jh?vi?oe(jh):jh:tf.max(a,function(a){return tf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return wi?d=0:Zd(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof lh&&te(lh)?(e=b(lh.left)?lh.left:d,f=b(lh.right)?lh.right:d):e=f="number"==typeof lh?lh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?gg:hg;return b="y"===a.axis||"y2"===a.axis?Yg?Of:"start"in a?d(a.start):Of:Yg?"end"in a?fg(vi?oe(a.end):a.end):Of:Of,c>b?0:b-c}function ic(a){return pg&&a===pg||te(qg)&&ue(qg,a)}function jc(a){return!ic(a)}function kc(a){return pg?pg:te(qg)?qg[a]:null}function lc(a,b){var c,d=b&&te(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=uf.data.xs[b])}),c}function mc(a,b){return a in uf.data.xs&&uf.data.xs[a]&&uf.data.xs[a][b]?uf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){qg[b]=a[b]})}function oc(a){return 1===tf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=tg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),uf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=vi?a?a instanceof Date?a:oe(a):oe(mc(c,d)):xi&&!wi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?uf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):pg?(d=Object.keys(uf.data.xs),uf.data.xs[c]=d.length>0?uf.data.xs[d[0]]:void 0):te(qg)&&(uf.data.xs[c]=lc(f,uf.data.targets)):uf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!uf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=sg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return xi&&wi&&0===c&&g&&(0===e&&(ah=[]),ah.push(g)),("undefined"==typeof a[b]||uf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),xg&&Xd(Cc(c).filter(function(a){return!(a in yg)}),xg),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&uf.data.targets[0].values[a-1]?uf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(uf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(vi?new Date(h):h);i.push(d)}return vi||(i=i.sort(function(a,b){return a-b})),i}function Lc(a){Gi=Gi.concat(a)}function Mc(a){Gi=Gi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Hi=Hi.concat(a)}function Oc(a){Hi=Hi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Dd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Dd(a,g))),Gd(e,b)):Ed(a,b,f,g)}function Fd(a,b){var c;return c=a.map(function(a){return Ed(a.values,b)}),Gd(c,b)}function Gd(a,b){var c,d;return a.forEach(function(a){var e=ve(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Hd(a,b){return tf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Id(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 Jd(){return Ag&&"desc"===Ag.toLowerCase()}function Kd(){return Ag&&"asc"===Ag.toLowerCase()}function Ld(a){var b=Kd(),c=Jd();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 Ag&&a.sort(Ag),a}function Md(a,c){var d,e,f,g,h,i,j,k=be(uf.data.targets),l=k?xd:wd,m=a.filter(function(a){return a&&b(a.value)});ii&&0!==m.length&&(dj.html(li(a,$(),l,Di)).style("display","block"),d=dj.property("offsetWidth"),e=dj.property("offsetHeight"),k?(g=Mf/2+c[0],i=Of/2+c[1]+20):(Yg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=fg(m[0].x)+20):(f=q(),g=f+t()+fg(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),dj.style("top",i+"px").style("left",g+"px"))}function Nd(){dj.style("display","none")}function Od(a){var c=a.filter(function(a){return a&&b(a.value)});ii&&($d(uf.data.targets)||be(uf.data.targets)||aj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Yg?"y1":"x1",zd).attr(Yg?"y2":"x2",zd))}function Pd(){aj.select("line."+f.xgridFocus).style("visibility","hidden")}function Qd(a){return a.x||0===a.x?fg(a.x):null}function Rd(a){return V(a.id)(a.value)}function Sd(){var a,b,d={},e=0;return Ic(Fc(ee)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Wd(a,b){return Uh?Uh:b?2*a.tickOffset()*Vh/b:0}function Xd(a,b){Dc(a).forEach(function(a){hj[a]=b===yg[a],yg[a]=b})}function Yd(a,b){var c=!1;return a.forEach(function(a){yg[a.id]===b&&(c=!0),a.id in yg||"line"!==b||(c=!0)}),c}function Zd(a){return Yd(a,"bar")}function $d(a){return Yd(a,"scatter")}function _d(a){return Yd(a,"pie")}function ae(a){return Yd(a,"donut")}function be(a){return _d(a)||ae(a)}function ce(a){var b="string"==typeof a?a:a.id;return!(b in yg)||"line"===yg[b]||"spline"===yg[b]||"area"===yg[b]||"area-spline"===yg[b]}function de(a){var b="string"==typeof a?a:a.id;return"spline"===yg[b]||"area-spline"===yg[b]}function ee(a){var b="string"==typeof a?a:a.id;return"bar"===yg[b]}function fe(a){var b="string"==typeof a?a:a.id;return"scatter"===yg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"pie"===yg[b]}function he(a){var b="string"==typeof a?a:a.id;return"donut"===yg[b]}function ie(a){return ge(a)||he(a)}function je(a){return ee(a)?a.values:[]}function ke(a){return ce(a)||fe(a)?a.values:[]}function le(a){return ee(a)||ce(a)?a.values:[]}function me(a){return he(a)&&ci||ge(a)&&Yh}function ne(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function oe(b){var c;try{c=rg?tf.time.format(rg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+rg)}return c}function pe(a,b){var c=tf.mouse(a),d=tf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function ue(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ve(a,b){var c="y"===Z(a.id)?gg:hg,d=Yg?1:0,e=Yg?0:1;return Math.pow(fg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function we(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function xe(a,b,c){Lg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd).attr("stroke",function(){return Di(b)}).attr("r",1.4*Sh).transition().duration(100).attr("r",Sh)}function ye(a,b,c){Mg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ze(a,b,c,d){a?xe(b,c,d):ye(b,c,d)}function Ae(a,b){Lg(b,a.node()),a.transition().duration(100).style("fill",function(){return tf.rgb(Di(b)).darker(1)})}function Be(a,b){Mg(b,a.node()),a.transition().duration(100).style("fill",function(){return Di(b)})}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a){return a.filter(function(a){return b(a.value)})}function Ee(a,c){return(c?aj.selectAll("."+f.circles+ld(c)):aj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Fe(a,b){Ee(a,b).classed(f.EXPANDED,!0).attr("r",Rh)}function Ge(a){Ee(a).filter(function(){return tf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oh)}function He(a){return aj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ie(a){He(a).classed(f.EXPANDED,!0)}function Je(a){He(a).classed(f.EXPANDED,!1)}function Ke(a,b){var c=Oe(a,b);return function(a,b){var d=c(a,b),e=Yg?1:0,f=Yg?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 Le(a,b){var c=Oe(a,!1),d=b?Me:Ne;return function(a,b){return d(c(a,b),a,this)}}function Me(a,b){var c;return Yg?(c=ee(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ne(a,b,c){var d=c.getBoundingClientRect();return Yg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ee(b)?-3:-6)}function Oe(a,b){var c=a.__max__+1,d=Wd(lg,c),e=Td(d,c,a,!!b),f=Ud(!!b),g=Vd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Yg&&(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 Pe(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 Qe(b){var c,d,e;if(ej=tf.select(wf),ej.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ej.html(""),ej.classed("c3",!0),uf.data.xs={},uf.data.targets=vc(b),n(),R(),fg.domain(tf.extent(_b(uf.data.targets))),gg.domain(Xb(uf.data.targets,"y")),hg.domain(Xb(uf.data.targets,"y2")),ig.domain(fg.domain()),jg.domain(gg.domain()),kg.domain(hg.domain()),fj=fg.domain(),Vi.scale(ig),Bf&&Zi.scale(fg),$i=ej.append("svg").attr("width",Mf+Jf.left+Jf.right).attr("height",Of+Jf.top+Jf.bottom).on("mouseenter",Ef).on("mouseleave",Ff),_i=$i.append("defs"),_i.append("clipPath").attr("id",pi).append("rect").attr("width",Mf).attr("height",Of),_i.append("clipPath").attr("id",qi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),_i.append("clipPath").attr("id",ri).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),aj=$i.append("g").attr("transform",Mi.main),bj=$i.append("g").attr("transform",Mi.context),cj=$i.append("g").attr("transform",Mi.legend),Pg||bj.style("visibility","hidden"),Sg||(cj.style("visibility","hidden"),Hi=Cc(uf.data.targets)),dj=tf.select(wf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),of(Cc(uf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Zg&&aj.append("g").attr("class",f.axisX).attr("clip-path",ti).attr("transform",Mi.x).append("text").attr("class",f.axisXLabel).attr("transform",Yg?"rotate(-90)":"").style("text-anchor",zb),ph&&aj.append("g").attr("class",f.axisY).attr("clip-path",ui).attr("transform",Mi.y).append("text").attr("class",f.axisYLabel).attr("transform",Yg?"":"rotate(-90)").style("text-anchor",Ab),yh&&aj.append("g").attr("class",f.axisY2).attr("transform",Mi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Yg?"":"rotate(-90)").style("text-anchor",Bb),d=aj.append("g").attr("clip-path",si).attr("class",f.grid),Hh&&d.append("g").attr("class",f.xgrids),te(Jh)&&d.append("g").attr("class",f.xgridLines),Ph&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Kh&&d.append("g").attr("class",f.ygrids),te(Lh)&&d.append("g").attr("class",f.ygridLines),aj.append("g").attr("clip-path",si).attr("class",f.regions),aj.append("g").attr("clip-path",si).attr("class",f.chart),c=aj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Bf?Yg?"ns-resize":"ew-resize":null),aj.select("."+f.chart).append("g").attr("class",f.chartBars),aj.select("."+f.chart).append("g").attr("class",f.chartLines),aj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Mi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),aj.select("."+f.chart).append("g").attr("class",f.chartTexts),Bf&&aj.insert("rect",Df?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Mf).attr("height",Of).style("opacity",0).style("cursor",Yg?"ns-resize":"ew-resize").call(Zi).on("dblclick.zoom",null),nh&&Vi.extent("function"!=typeof nh?nh:nh(_b())),bj.append("g").attr("clip-path",si).attr("class",f.chart),bj.select("."+f.chart).append("g").attr("class",f.chartBars),bj.select("."+f.chart).append("g").attr("class",f.chartLines),bj.append("g").attr("clip-path",si).attr("class",f.brush).call(Vi).selectAll("rect").attr(Yg?"width":"height",Yg?Nf:Pf),bj.append("g").attr("class",f.axisX).attr("transform",Mi.subx).attr("clip-path",Yg?"":ti),bf(uf.data.targets),Yg?aj.select("."+f.axisX).style("opacity",0).call(lg):(aj.select("."+f.axisY).style("opacity",0).call(mg),aj.select("."+f.axisY2).style("opacity",0).call(ng)),n(),R(),_e(),m(!1),Xe({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),mi){if(vi&&"string"==typeof ni){for(ni=oe(ni),e=0;e0){d=[];for(var g in tg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Id(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ce,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 Ve(a){be(uf.data.targets)||Eg&&(yi=a,aj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),zi=!0,Ng())}function We(){be(uf.data.targets)||Eg&&(aj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),aj.selectAll("."+f.shape).classed(f.INCLUDED,!1),zi=!1,Og())}function Xe(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Sd(),W=be(uf.data.targets),X=Ic(uf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?If:0,Q=D?P:0,R=E?P:0,c=aj.select("."+f.axisX).style("opacity",W?0:1),g=aj.select("."+f.axisY).style("opacity",W?0:1),h=aj.select("."+f.axisY2).style("opacity",W?0:1),e=bj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Sg&&of(Cc(uf.data.targets),a,O),wi&&(0===X.length||!H||G)&&fg.domain([0,c.selectAll(".tick").size()]),X.length&&(H&&(fg.domain(tf.extent(_b(X))),fj=fg.domain(),Bf&&Zi.scale(fg).updateScaleExtent(),ig.domain(fg.domain()),Vi.scale(ig)),G&&(fg.domain(Vi.empty()?fj:Vi.extent()),Bf&&Zi.scale(fg).updateScaleExtent())),gg.domain(Xb(X,"y")),hg.domain(Xb(X,"y2")),(gh||fh)&&(S=hh?hh:Kc(Jc(X)),lg.tickValues(S),og.tickValues(S)),O.axisX.call(lg),O.axisY.call(mg),O.axisY2.call(ng),O.axisSubX.call(og),G)if(dh&&S){for(T=1;T=0&&tf.select(this).style("display",b%U?"none":"block")})}else tf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!Yg&&ih&&eb(c,O.axisX,ih),J=Ke(V),M=Le(V,!0),N=Le(V,!1),Db(),jg.domain(gg.domain()),kg.domain(hg.domain()),dj.style("display","none"),o(),aj.select("line."+f.xgridFocus).style("visibility","hidden"),Hh){if("year"===Ih){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=fg.ticks(10);i=aj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",Yg?0:function(a){return fg(a)-lg.tickOffset()}).attr("x2",Yg?Mf:function(a){return fg(a)-lg.tickOffset()}).attr("y1",Yg?function(a){return fg(a)-lg.tickOffset()}:Jf.top).attr("y2",Yg?function(a){return fg(a)-lg.tickOffset()}:Of).style("opacity",function(){return+tf.select(this).attr(Yg?"y1":"x1")===(Yg?Of:0)?0:1}),i.exit().remove()}te(Jh)&&(k=aj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Jh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",Yg?"":"rotate(-90)").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",Yg?0:Ad).attr("x2",Yg?Mf:Ad).attr("y1",Yg?Ad:Jf.top).attr("y2",Yg?Ad:Of).style("opacity",1),k.select("text").transition().duration(P).attr("x",Yg?Mf:0).attr("y",Ad).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Kh&&(m=aj.select("."+f.ygrids).selectAll("."+f.ygrid).data(gg.ticks(Mh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",Yg?gg:0).attr("x2",Yg?gg:Mf).attr("y1",Yg?0:gg).attr("y2",Yg?Of:gg),m.exit().remove()),A&&te(Lh)&&(n=aj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Lh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",Yg?"rotate(-90)":"").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",Yg?Bd:0).attr("x2",Yg?Bd:Mf).attr("y1",Yg?0:Bd).attr("y2",Yg?Of:Bd).style("opacity",1),n.select("text").transition().duration(P).attr("x",Yg?0:Mf).attr("y",Bd).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=aj.select("."+f.regions).selectAll("rect."+f.region).data(hi),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=aj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Di(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=aj.selectAll("."+f.texts).selectAll("."+f.text).data(le),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return Yg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return yd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),aj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",Wi).style("opacity",1),aj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",Xi).style("opacity",gj),q=aj.selectAll("."+f.circles).selectAll("."+f.circle).data(ke),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Oh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),q.exit().remove(),aj.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=tf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1),aj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&ie(a.data)?1:0}),aj.select("."+f.chartArcsTitle).style("opacity",ae(uf.data.targets)?1:0),Pg&&(null!==tf.event&&"zoom"===tf.event.type&&Vi.extent(fg.orgDomain()).update(),B&&(!Yg&&ih&&eb(e,O.axisSubX,ih),Vi.empty()||Vi.extent(fg.orgDomain()).update(),K=Ke(V,!0),u=bj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Di(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),bj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",Yi).style("opacity",1))),aj.selectAll("."+f.selectedCircles).filter(function(a){return ee(a)}).selectAll("circle").remove(),aj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),v=aj.select("."+f.eventRects),te(qg)&&!oc(qg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Se(w.enter()),w.attr("x",0).attr("y",0).attr("width",Mf).attr("height",Of)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),xi&&!wi?(z=function(a,b){var c=xc(b),d=yc(b),e=uf.data.xs[a.id][b];return(fg(d?d:e+50)-fg(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=uf.data.xs[a.id][b];return(fg(d)+fg(c?c:d-50))/2}):(z=L(),y=function(a){return fg(a.x)-z/2}),x=Ac(uf.data.targets),aj.select("."+f.eventRects).datum(x?x.values:[]),w=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Re(w.enter()),w.attr("class",fd).attr("x",Yg?0:y).attr("y",Yg?y:0).attr("width",Yg?Mf:z).attr("height",Yg?z:Of),w.exit().remove()),Cc(uf.data.targets).forEach(function(a){hj[a]=!0})}function Ye(){Xe({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ze(){return"mousemove"===tf.event.sourceEvent.type&&Zi.altDomain?(fg.domain(Zi.altDomain),void Zi.scale(fg).updateScaleExtent()):(wi&&fg.orgDomain()[0]===fj[0]&&fg.domain([fj[0]-1e-10,fg.orgDomain()[1]]),Xe({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===tf.event.sourceEvent.type&&(Ai=!0)))}function $e(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function _e(){$i.attr("width",Qf).attr("height",Rf),$i.select("#"+pi).select("rect").attr("width",Mf).attr("height",Of),$i.select("#"+qi).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),$i.select("#"+ri).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),$i.select("."+f.zoomRect).attr("width",Mf).attr("height",Of),ej.style("max-height",Rf+"px")}function af(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),_e(),m(a.withTransition),Xe(a)}function bf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=aj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Di(a)}),e=aj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("fill",function(a){return Di(a)}).style("stroke","none").style("cursor",function(a){return Gg(a)?"pointer":null}),c=aj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)}),b.append("path").attr("class",dd).style("opacity",function(){return gj=+tf.select(this).style("opacity"),0}).style("fill",function(a){return Di(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Di(a)}).style("cursor",function(a){return Gg(a)?"pointer":null}),a.forEach(function(a){aj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=aj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Yf(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Di(a.data)}).style("cursor",function(a){return Gg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Fb(a),d=Lb(c),e=Tb();Nb(c.data.id),jf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Fb(a),c=[Lb(b)];Md(c,tf.mouse(this))}).on("mouseout",function(a,b){var c=Fb(a),d=Lb(c),e=Ub();Ob(c.data.id),lf(),Nd(),e(d,b)}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Pg&&(n=bj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Di(a)}),l=bj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)})),$i.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function cf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Xd(a.id,b.types[a.id]):Xd(a.id,b.type)}),uf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Ni?j:i,l=Ni?Q():P();return d&&(x=0,D=0,u=0,v=0),Sg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Ni?v:u,void(Xg?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Ni?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=cj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Ug?Ug(a):uf.toggle(a)}).on("mouseover",function(a){uf.focus(a),"function"==typeof Vg&&Vg(a)}).on("mouseout",function(a){uf.revert(),"function"==typeof Wg&&Wg(a)}),o.append("text").text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ni?h:-200).attr("y",Ni?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ni?i:-200).attr("y",Ni?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Di(a)}).attr("x",Ni?h:-200).attr("y",Ni?-200:j).attr("width",10).attr("height",10),cj.selectAll("text").data(a).text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),cj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),cj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),N(u),O(v),M(D),n(),R(),_e(),r&&m(q,c)}function pf(a){return Ec(uf.data.targets,a.id)}function qf(a){return"data"in a&&Ec(uf.data.targets,a.data.id)}function rf(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 sf(a,b,c){var d=!be(uf.data.targets);Xd(a,b),af(c||{withTransitionForAxis:d})}var tf=a.d3?a.d3:a.require?a.require("d3"):void 0,uf={data:{},axis:{},legend:{}},vf={},wf=h(["bindto"],"#chart"),xf=h(["size","width"]),yf=h(["size","height"]),zf=h(["padding","left"]),Af=h(["padding","right"]),Bf=h(["zoom","enabled"],!1),Cf=h(["zoom","extent"]),Df=h(["zoom","privileged"],!1),Ef=h(["onenter"],function(){}),Ff=h(["onleave"],function(){}),Gf=h(["onresize"],function(){}),Hf=h(["onresized"],function(){}),If=h(["transition","duration"],350);g("data","data is required in config");var Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg=h(["data","x"]),qg=h(["data","xs"],{}),rg=h(["data","x_format"]),sg=h(["data","id_converter"],function(a){return a}),tg=h(["data","names"],{}),ug=h(["data","classes"],{}),vg=h(["data","groups"],[]),wg=h(["data","axes"],{}),xg=h(["data","type"]),yg=h(["data","types"],{}),zg=h(["data","labels"],{}),Ag=h(["data","order"]),Bg=h(["data","regions"],{}),Cg=h(["data","color"]),Dg=h(["data","colors"],{}),Eg=h(["data","selection","enabled"],!1),Fg=h(["data","selection","grouped"],!1),Gg=h(["data","selection","isselectable"],function(){return!0}),Hg=h(["data","selection","multiple"],!0),Ig=h(["data","onclick"],function(){}),Jg=h(["data","onenter"],function(){}),Kg=h(["data","onleave"],function(){}),Lg=h(["data","onselected"],function(){}),Mg=h(["data","onunselected"],function(){}),Ng=h(["data","ondragstart"],function(){}),Og=h(["data","ondragend"],function(){}),Pg=h(["subchart","show"],!1),Qg=h(["subchart","size","height"],60),Rg=h(["color","pattern"],[]),Sg=h(["legend","show"],!0),Tg=h(["legend","position"],"bottom"),Ug=h(["legend","item","onclick"]),Vg=h(["legend","item","onmouseover"]),Wg=h(["legend","item","onmouseout"]),Xg=h(["legend","equally"],!1),Yg=h(["axis","rotated"],!1),Zg=h(["axis","x","show"],!0),$g=h(["axis","x","type"],"indexed"),_g=h(["axis","x","localtime"],!0),ah=h(["axis","x","categories"],[]),bh=h(["axis","x","tick","centered"],!1),ch=h(["axis","x","tick","format"]),dh=h(["axis","x","tick","culling"],{}),eh=h(["axis","x","tick","culling","max"],10),fh=h(["axis","x","tick","count"]),gh=h(["axis","x","tick","fit"],!0),hh=h(["axis","x","tick","values"],null),ih=h(["axis","x","tick","rotate"]),jh=h(["axis","x","max"],null),kh=h(["axis","x","min"],null),lh=h(["axis","x","padding"],{}),mh=h(["axis","x","height"]),nh=h(["axis","x","default"]),oh=h(["axis","x","label"],{}),ph=h(["axis","y","show"],!0),qh=h(["axis","y","max"]),rh=h(["axis","y","min"]),sh=h(["axis","y","center"]),th=h(["axis","y","label"],{}),uh=h(["axis","y","inner"],!1),vh=h(["axis","y","tick","format"]),wh=h(["axis","y","padding"],{}),xh=h(["axis","y","ticks"],10),yh=h(["axis","y2","show"],!1),zh=h(["axis","y2","max"]),Ah=h(["axis","y2","min"]),Bh=h(["axis","y2","center"]),Ch=h(["axis","y2","label"],{}),Dh=h(["axis","y2","inner"],!1),Eh=h(["axis","y2","tick","format"]),Fh=h(["axis","y2","padding"],{}),Gh=h(["axis","y2","ticks"],10),Hh=h(["grid","x","show"],!1),Ih=h(["grid","x","type"],"tick"),Jh=h(["grid","x","lines"],[]),Kh=h(["grid","y","show"],!1),Lh=h(["grid","y","lines"],[]),Mh=h(["grid","y","ticks"],10),Nh=h(["point","show"],!0),Oh=Nh?h(["point","r"],2.5):0,Ph=h(["point","focus","line","enabled"],!0),Qh=h(["point","focus","expand","enabled"],!0),Rh=h(["point","focus","expand","r"],Qh?4:Oh),Sh=h(["point","focus","select","r"],8),Th=h(["line","connect_null"],!1),Uh=h(["bar","width"]),Vh=h(["bar","width","ratio"],.6),Wh=h(["pie","label","show"],!0),Xh=h(["pie","label","format"]),Yh=h(["pie","expand"],!0),Zh=h(["pie","onclick"],function(){}),$h=h(["pie","onmouseover"],function(){}),_h=h(["pie","onmouseout"],function(){}),ai=h(["donut","label","show"],!0),bi=h(["donut","label","format"]),ci=h(["donut","expand"],!0),di=h(["donut","title"],""),ei=h(["donut","onclick"],function(){}),fi=h(["donut","onmouseover"],function(){}),gi=h(["donut","onmouseout"],function(){}),hi=h(["regions"],[]),ii=h(["tooltip","show"],!0),ji=h(["tooltip","format","title"]),ki=h(["tooltip","format","value"]),li=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ji?ji:b,l=ki?ki: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+""}),mi=h(["tooltip","init","show"],!1),ni=h(["tooltip","init","x"],0),oi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),pi=("string"==typeof wf?wf.replace("#",""):wf.id)+"-clip",qi=pi+"-xaxis",ri=pi+"-yaxis",si=i(pi),ti=i(qi),ui=i(ri),vi="timeseries"===$g,wi="categorized"===$g,xi=!vi&&(pg||te(qg)),yi=null,zi=!1,Ai=!1,Bi=!1,Ci=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Di=ne(Dg,te(Rg)?Rg:Ci,Cg),Ei=_g?tf.time.format:tf.time.format.utc,Fi=function(){var a=[[Ei("%Y/%-m/%-d"),function(){return!0}],[Ei("%-m/%-d"),function(a){return a.getMonth()}],[Ei("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ei("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ei("%I %p"),function(a){return a.getHours()}],[Ei("%I:%M"),function(a){return a.getMinutes()}],[Ei(":%S"),function(a){return a.getSeconds()}],[Ei(".%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)}}(),Gi=[],Hi=[],Ii=Yg?"left":"bottom",Ji=Yg?uh?"top":"bottom":uh?"right":"left",Ki=Yg?Dh?"bottom":"top":Dh?"left":"right",Li=Yg?"left":"bottom",Mi={main:function(){return"translate("+Jf.left+","+Jf.top+")"},context:function(){return"translate("+Kf.left+","+Kf.top+")"},legend:function(){return"translate("+Lf.left+","+Lf.top+")"},x:function(){return"translate(0,"+(Yg?0:Of)+")"},y:function(){return"translate(0,"+(Yg?Of:0)+")"},y2:function(){return"translate("+(Yg?0:Mf)+","+(Yg?1:0)+")"},subx:function(){return"translate(0,"+(Yg?0:Pf)+")"},arc:function(){return"translate("+Mf/2+","+Of/2+")"}},Ni="right"===Tg,Oi=0,Pi=0,Qi=0,Ri=.15,Si=30,Ti=Yg&&!Zg?0:30,Ui=5;Yf=tf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Vi,Wi=function(){var a=tf.svg.line().x(Yg?function(a){return V(a.id)(a.value)}:zd).y(Yg?zd:function(a){return V(a.id)(a.value)});return Th||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Th?De(b.values):b.values;return ce(b)?(a.interpolate(de(b)?"cardinal":"linear"),Bg[b.id]?Pe(e,fg,V(b.id),Bg[b.id]):a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Xi=function(){var a;return a=Yg?tf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(zd):tf.svg.area().x(zd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=De(b.values);return Yd([b],"area")||Yd([b],"area-spline")?(a.interpolate(de(b)?"cardinal":"linear"),a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Yi=function(){var a=tf.svg.line().x(Yg?function(a){return W(a.id)(a.value)}:Cd).y(Yg?Cd:function(a){return W(a.id)(a.value)});return function(b){var c=De(b.values);return ce(b)?a(c):"M "+ig(c[0].x)+" "+W(b.id)(c[0].value)}}(),Zi=function(){};Vi=tf.svg.brush().on("brush",Ye),Vi.update=function(){return bj&&bj.select("."+f.brush).call(this),this},Vi.scale=function(a){return Yg?this.y(a):this.x(a)},Bf&&(Zi=tf.behavior.zoom().on("zoomstart",function(){Zi.altDomain=tf.event.sourceEvent.altKey?fg.orgDomain():null}).on("zoom",Bf?Ze:null),Zi.scale=function(a){return Yg?this.y(a):this.x(a)},Zi.orgScaleExtent=function(){var a=Cf?Cf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},Zi.updateScaleExtent=function(){var a=ac(fg.orgDomain())/ac(fj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var $i,_i,aj,bj,cj,dj,ej,fj,gj,hj={};if(uf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),uf.defocus(),b(d.classed(f.focused,!0)),b(e),be(uf.data.targets)&&Nb(a,!0),jf(a)},uf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),kf(a)},uf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),lf()},uf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),$i.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?mf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},uf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),$i.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?nf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Ri),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},uf.toggle=function(a){Gc(a)?uf.hide(a):uf.show(a)},uf.unzoom=function(){Vi.clear().update(),Xe({withUpdateXDomain:!0})},uf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){ug[b]=a.classes[b]}),"categories"in a&&wi&&(ah=a.categories,lg.categories(ah)),"cacheIds"in a&&bc(a.cacheIds)?void cf(dc(a.cacheIds),a.done):void("unload"in a?ef(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){df(a)}):df(a))},uf.unload=function(a){ef(Dc(a),function(){Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},uf.selected=function(a){return tf.merge(aj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return tf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},uf.select=function(a,b,c){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=tf.select(this),i="circle"===this.nodeName?xe:Ae,j="circle"===this.nodeName?ye:Be,k=Fg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Gg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},uf.unselect=function(a,b){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=tf.select(this),g="circle"===this.nodeName?ye:Be,h=Fg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Gg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},uf.toLine=function(a){sf(a,"line")},uf.toSpline=function(a){sf(a,"spline")},uf.toBar=function(a){sf(a,"bar")},uf.toScatter=function(a){sf(a,"scatter")},uf.toArea=function(a){sf(a,"area")},uf.toAreaSpline=function(a){sf(a,"area-spline")},uf.toPie=function(a){sf(a,"pie",{withTransform:!0})},uf.toDonut=function(a){sf(a,"donut",{withTransform:!0})},uf.groups=function(a){return c(a)?vg:(vg=a,Xe(),vg)},uf.xgrids=function(a){return a?(Jh=a,Xe(),Jh):Jh},uf.xgrids.add=function(a){return a?uf.xgrids(Jh.concat(a)):void 0},uf.xgrids.remove=function(a){var b=rf(a);return uf.xgrids(Jh.filter(b))},uf.ygrids=function(a){return a?(Lh=a,Xe(),Lh):Lh},uf.ygrids.add=function(a){return a?uf.ygrids(Lh.concat(a)):void 0 -},uf.ygrids.remove=function(a){var b=rf(a);return uf.ygrids(Lh.filter(b))},uf.regions=function(a){return c(a)?hi:(hi=a,Xe(),hi)},uf.regions.add=function(a){return c(a)?hi:(hi=hi.concat(a),Xe(),hi)},uf.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;$i.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),hi=hi.filter(function(b){return b.classes.indexOf(a)<0})}),hi},uf.data.get=function(a){var b=uf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},uf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},uf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){tg[b]=a[b]}),of(Cc(uf.data.targets),{withTransition:!0}),tg):tg},uf.x=function(a){return arguments.length&&(qc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.xs=function(a){return arguments.length&&(rc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},uf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(qh=+a.y),b(a.y2)&&(zh=+a.y2)):qh=zh=+a,Xe())},uf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(rh=+a.y),b(a.y2)&&(Ah=+a.y2)):rh=Ah=+a,Xe())},uf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&uf.axis.max(a.max),"undefined"!=typeof a.min&&uf.axis.min(a.min))},uf.legend.show=function(a){Sg||(Sg=!0,cj.style("visibility","visible")),mf(Dc(a)),Xe({withLegend:!0})},uf.legend.hide=function(a){nf(Dc(a)),Xe({withLegend:!0}),Sg&&se(a)&&(Sg=!1,cj.style("visibility","hidden"))},uf.resize=function(a){xf=a?a.width:null,yf=a?a.height:null,af({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},uf.destroy=function(){uf.data.targets=void 0,uf.data.xs={},ej.html(""),a.onresize=null},"url"in e.data)tf.xhr(e.data.url,function(a,b){var c,d=tf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=tf.csv.parse(b.response),Qe(c)});else if("rows"in e.data)Qe(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Qe(uc(e.data.columns))}return uf},"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.32"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cMf&&(Mf=0),0>Of&&(Of=0),Nf=Yg?Jf.left-Ti-Ui:Mf,Pf=Yg?Of:Rf-Kf.top-Kf.bottom,0>Nf&&(Nf=0),0>Pf&&(Pf=0),p(),Oi&&be(uf.data.targets)&&(Lf.left=Mf/2+Tf)}function o(){bj.select("line."+f.xgridFocus).attr("x1",Yg?0:-10).attr("x2",Yg?Mf:-10).attr("y1",Yg?-10:Jf.top).attr("y2",Yg?-10:Of)}function p(){Tf=Of/2,Sf=.95*Tf,Uf=ae(uf.data.targets)?.6*Sf:0}function q(){var a=Yg?f.axisX:f.axisY,b=tf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=tf.select(wf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return xf?xf:x()}function s(){var a=yf?yf:y();return a>0?a:320}function t(){return be(uf.data.targets)?0:zf?zf:Yg?Zg?v("x"):1:!ph||uh?1:v("y")}function u(){var a=1;return be(uf.data.targets)?0:Af?Af:Oi?P()+(yh&&!Yg?v("y2"):a):yh?Dh||Yg?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||Zg?"x"===a&&mh?mh:"y"!==a||ph?"y2"!==a||yh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Vi:Sg&&!Oi?10:1:0}function x(){return+tf.select(wf).style("width").replace("px","")}function y(){return+tf.select(wf).style("height").replace("px","")}function z(a){return a?-5:-(Jf.left-1)}function A(a){return a?-20:-4}function B(){return z(!Yg)}function C(){return A(!Yg)}function D(){return z(Yg)}function E(){return A(Yg)}function F(a){return a?Mf+2+4:Jf.left+20}function G(a){return a?(mh?mh:0)+80:Of+8}function H(){return F(!Yg)}function I(){return G(!Yg)}function J(){return F(Yg)}function K(){return G(Yg)}function L(){var a,b,c,d,e,f=Ac(uf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=fg(b.x)-fg(a.x),d=zc(),e=Zd(uf.data.targets)?(d-(wi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Pi=a}function N(a){Qi=a}function O(a){Ri=a}function P(){return Sg?Oi?Qi*(Pi+1):Qf:0}function Q(){return Sg?Oi?Rf:Ri*(Pi+1):0}function R(){var a,b=!fg;Zf=Yg?1:0,$f=Yg?Of:Mf,_f=Yg?0:Of,ag=Yg?Mf:1,bg=Zf,cg=$f,dg=Yg?0:Pf,eg=Yg?Nf:1,fg=T(Zf,$f,b?void 0:fg.domain(),function(){return lg.tickOffset()}),gg=U(_f,ag,b?void 0:gg.domain()),hg=U(_f,ag,b?void 0:hg.domain()),ig=T(Zf,$f,gj,function(a){return a%1?0:og.tickOffset()}),jg=U(dg,eg,b?void 0:jg.domain()),kg=U(dg,eg,b?void 0:kg.domain()),a=$(),lg=X(fg,Ji,a),og=X(ig,Mi,a),mg=Y(gg,Ki,vh,xh),ng=Y(hg,Li,Eh,Gh),b||(Wi.scale(ig),Bf&&$i.scale(fg)),S()}function S(){Vf=Gb(),Wf=Hb(),Xf=Hb(.98)}function T(a,b,d,e){var f=(vi?tf.time.scale():tf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),wi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=tf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?hg:gg}function W(a){return"y2"===Z(a)?kg:jg}function X(a,b,c){var d=(wi?Eb():tf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),wi?(d.tickCentered(bh),se(dh)&&(dh=!1)):d.tickOffset=function(){var a=Bc(uf.data.targets),b=fg(a[1])-fg(a[0]);return b/zc()/2},wi&&d.categories(ah),d}function Y(a,b,c,d){return tf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in wg?wg[a]:"y"}function $(){var a=vi?Gi:wi?Tc:function(a){return 0>a?a.toFixed(0):a};return ch&&("function"==typeof ch?a=ch:vi&&(a=function(a){return a?Fi(ch)(a):""})),a}function _(a){var b;return"y"===a?b=th:"y2"===a?b=Ch:"x"===a&&(b=oh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?th=b:"y2"===a?Ch=b:"x"===a&&(oh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",Yg?"inner-top":"inner-right")}function hb(){return fb("y",Yg?"inner-right":"inner-top")}function ib(){return fb("y2",Yg?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Mf/2:Mf:b.isBottom?-Of:b.isMiddle?-Of/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!Yg,gb())}function rb(){return nb(Yg,hb())}function sb(){return nb(Yg,ib())}function tb(){return ob(!Yg,gb())}function ub(){return ob(Yg,hb())}function vb(){return ob(Yg,ib())}function wb(){var a=gb();return Yg?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":mh?mh-10:"3em"}function xb(){var a=hb();return Yg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return Yg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!Yg,gb())}function Ab(){return pb(Yg,hb())}function Bb(){return pb(Yg,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return tf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?30:b}function Db(){bj.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),bj.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),bj.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 tf.min(Object.keys(i).map(function(a){return tf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(vg.length>0)for(g=Sc(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 tf.max(Object.keys(i).map(function(a){return tf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Ah:rh,n="y2"===c?zh:qh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Bh:sh,r=ud()&&Yg;return 0===l.length?"y2"===c?hg.domain():gg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(gg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&wh&&(f=b(wh.top)?wh.top:e,g=b(wh.bottom)?wh.bottom:e),"y2"===c&&Fh&&(f=b(Fh.top)?Fh.top:e,g=b(Fh.bottom)?Fh.bottom:e),Zd(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return kh?vi?oe(kh):kh:tf.min(a,function(a){return tf.min(a.values,function(a){return a.x})})}function Zb(a){return jh?vi?oe(jh):jh:tf.max(a,function(a){return tf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return wi?d=0:Zd(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof lh&&te(lh)?(e=b(lh.left)?lh.left:d,f=b(lh.right)?lh.right:d):e=f="number"==typeof lh?lh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?gg:hg;return b="y"===a.axis||"y2"===a.axis?Yg?Of:"start"in a?d(a.start):Of:Yg?"end"in a?fg(vi?oe(a.end):a.end):Of:Of,c>b?0:b-c}function ic(a){return pg&&a===pg||te(qg)&&ue(qg,a)}function jc(a){return!ic(a)}function kc(a){return pg?pg:te(qg)?qg[a]:null}function lc(a,b){var c,d=b&&te(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=uf.data.xs[b])}),c}function mc(a,b){return a in uf.data.xs&&uf.data.xs[a]&&uf.data.xs[a][b]?uf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){qg[b]=a[b]})}function oc(a){return 1===tf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=tg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),uf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=vi?a?a instanceof Date?a:oe(a):oe(mc(c,d)):xi&&!wi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?uf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):pg?(d=Object.keys(uf.data.xs),uf.data.xs[c]=d.length>0?uf.data.xs[d[0]]:void 0):te(qg)&&(uf.data.xs[c]=lc(f,uf.data.targets)):uf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!uf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=sg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return xi&&wi&&0===c&&g&&(0===e&&(ah=[]),ah.push(g)),("undefined"==typeof a[b]||uf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),xg&&Xd(Cc(c).filter(function(a){return!(a in yg)}),xg),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&uf.data.targets[0].values[a-1]?uf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(uf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(vi?new Date(h):h);i.push(d)}return vi||(i=i.sort(function(a,b){return a-b})),i}function Lc(a){Hi=Hi.concat(a)}function Mc(a){Hi=Hi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Ii=Ii.concat(a)}function Oc(a){Ii=Ii.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Dd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Dd(a,g))),Gd(e,b)):Ed(a,b,f,g)}function Fd(a,b){var c;return c=a.map(function(a){return Ed(a.values,b)}),Gd(c,b)}function Gd(a,b){var c,d;return a.forEach(function(a){var e=ve(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Hd(a,b){return tf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Id(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 Jd(){return Ag&&"desc"===Ag.toLowerCase()}function Kd(){return Ag&&"asc"===Ag.toLowerCase()}function Ld(a){var b=Kd(),c=Jd();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 Ag&&a.sort(Ag),a}function Md(a,c){var d,e,f,g,h,i,j,k=be(uf.data.targets),l=k?xd:wd,m=a.filter(function(a){return a&&b(a.value)});ii&&0!==m.length&&(ej.html(li(a,$(),l,Ei)).style("display","block"),d=ej.property("offsetWidth"),e=ej.property("offsetHeight"),k?(g=Mf/2+c[0],i=Of/2+c[1]+20):(Yg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=fg(m[0].x)+20):(f=q(),g=f+t()+fg(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),ej.style("top",i+"px").style("left",g+"px"))}function Nd(){ej.style("display","none")}function Od(a){var c=a.filter(function(a){return a&&b(a.value)});ii&&($d(uf.data.targets)||be(uf.data.targets)||bj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Yg?"y1":"x1",zd).attr(Yg?"y2":"x2",zd))}function Pd(){bj.select("line."+f.xgridFocus).style("visibility","hidden")}function Qd(a){return a.x||0===a.x?fg(a.x):null}function Rd(a){return V(a.id)(a.value)}function Sd(){var a,b,d={},e=0;return Ic(Fc(ee)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Wd(a,b){return Uh?Uh:b?2*a.tickOffset()*Vh/b:0}function Xd(a,b){Dc(a).forEach(function(a){ij[a]=b===yg[a],yg[a]=b})}function Yd(a,b){var c=!1;return a.forEach(function(a){yg[a.id]===b&&(c=!0),a.id in yg||"line"!==b||(c=!0)}),c}function Zd(a){return Yd(a,"bar")}function $d(a){return Yd(a,"scatter")}function _d(a){return Yd(a,"pie")}function ae(a){return Yd(a,"donut")}function be(a){return _d(a)||ae(a)}function ce(a){var b="string"==typeof a?a:a.id;return!(b in yg)||"line"===yg[b]||"spline"===yg[b]||"area"===yg[b]||"area-spline"===yg[b]}function de(a){var b="string"==typeof a?a:a.id;return"spline"===yg[b]||"area-spline"===yg[b]}function ee(a){var b="string"==typeof a?a:a.id;return"bar"===yg[b]}function fe(a){var b="string"==typeof a?a:a.id;return"scatter"===yg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"pie"===yg[b]}function he(a){var b="string"==typeof a?a:a.id;return"donut"===yg[b]}function ie(a){return ge(a)||he(a)}function je(a){return ee(a)?a.values:[]}function ke(a){return ce(a)||fe(a)?a.values:[]}function le(a){return ee(a)||ce(a)?a.values:[]}function me(a){return he(a)&&ci||ge(a)&&Yh}function ne(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function oe(b){var c;try{c=rg?tf.time.format(rg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+rg)}return c}function pe(a,b){var c=tf.mouse(a),d=tf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function ue(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ve(a,b){var c="y"===Z(a.id)?gg:hg,d=Yg?1:0,e=Yg?0:1;return Math.pow(fg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function we(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function xe(a,b,c){Lg(b,a.node()),bj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd).attr("stroke",function(){return Ei(b)}).attr("r",1.4*Sh).transition().duration(100).attr("r",Sh)}function ye(a,b,c){Mg(b,a.node()),bj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ze(a,b,c,d){a?xe(b,c,d):ye(b,c,d)}function Ae(a,b){Lg(b,a.node()),a.transition().duration(100).style("fill",function(){return tf.rgb(Ei(b)).darker(1)})}function Be(a,b){Mg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ei(b)})}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a){return a.filter(function(a){return b(a.value)})}function Ee(a,c){return(c?bj.selectAll("."+f.circles+ld(c)):bj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Fe(a,b){Ee(a,b).classed(f.EXPANDED,!0).attr("r",Rh)}function Ge(a){Ee(a).filter(function(){return tf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oh)}function He(a){return bj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ie(a){He(a).classed(f.EXPANDED,!0)}function Je(a){He(a).classed(f.EXPANDED,!1)}function Ke(a,b){var c=Oe(a,b);return function(a,b){var d=c(a,b),e=Yg?1:0,f=Yg?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 Le(a,b){var c=Oe(a,!1),d=b?Me:Ne;return function(a,b){return d(c(a,b),a,this)}}function Me(a,b){var c;return Yg?(c=ee(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ne(a,b,c){var d=c.getBoundingClientRect();return Yg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ee(b)?-3:-6)}function Oe(a,b){var c=a.__max__+1,d=Wd(lg,c),e=Td(d,c,a,!!b),f=Ud(!!b),g=Vd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Yg&&(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 Pe(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 Qe(b){var c,d,e;if(fj=tf.select(wf),fj.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(fj.html(""),fj.classed("c3",!0),uf.data.xs={},uf.data.targets=vc(b),n(),R(),fg.domain(tf.extent(_b(uf.data.targets))),gg.domain(Xb(uf.data.targets,"y")),hg.domain(Xb(uf.data.targets,"y2")),ig.domain(fg.domain()),jg.domain(gg.domain()),kg.domain(hg.domain()),gj=fg.domain(),Wi.scale(ig),Bf&&$i.scale(fg),_i=fj.append("svg").attr("width",Mf+Jf.left+Jf.right).attr("height",Of+Jf.top+Jf.bottom).on("mouseenter",Ef).on("mouseleave",Ff),aj=_i.append("defs"),aj.append("clipPath").attr("id",pi).append("rect").attr("width",Mf).attr("height",Of),aj.append("clipPath").attr("id",qi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),aj.append("clipPath").attr("id",ri).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),bj=_i.append("g").attr("transform",Ni.main),cj=_i.append("g").attr("transform",Ni.context),dj=_i.append("g").attr("transform",Ni.legend),Pg||cj.style("visibility","hidden"),Sg||(dj.style("visibility","hidden"),Ii=Cc(uf.data.targets)),ej=tf.select(wf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),of(Cc(uf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Zg&&bj.append("g").attr("class",f.axisX).attr("clip-path",ti).attr("transform",Ni.x).append("text").attr("class",f.axisXLabel).attr("transform",Yg?"rotate(-90)":"").style("text-anchor",zb),ph&&bj.append("g").attr("class",f.axisY).attr("clip-path",ui).attr("transform",Ni.y).append("text").attr("class",f.axisYLabel).attr("transform",Yg?"":"rotate(-90)").style("text-anchor",Ab),yh&&bj.append("g").attr("class",f.axisY2).attr("transform",Ni.y2).append("text").attr("class",f.axisY2Label).attr("transform",Yg?"":"rotate(-90)").style("text-anchor",Bb),d=bj.append("g").attr("clip-path",si).attr("class",f.grid),Hh&&d.append("g").attr("class",f.xgrids),te(Jh)&&d.append("g").attr("class",f.xgridLines),Ph&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Kh&&d.append("g").attr("class",f.ygrids),te(Lh)&&d.append("g").attr("class",f.ygridLines),bj.append("g").attr("clip-path",si).attr("class",f.regions),bj.append("g").attr("clip-path",si).attr("class",f.chart),c=bj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Bf?Yg?"ns-resize":"ew-resize":null),bj.select("."+f.chart).append("g").attr("class",f.chartBars),bj.select("."+f.chart).append("g").attr("class",f.chartLines),bj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Ni.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),bj.select("."+f.chart).append("g").attr("class",f.chartTexts),Bf&&bj.insert("rect",Df?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Mf).attr("height",Of).style("opacity",0).style("cursor",Yg?"ns-resize":"ew-resize").call($i).on("dblclick.zoom",null),nh&&Wi.extent("function"!=typeof nh?nh:nh(_b())),cj.append("g").attr("clip-path",si).attr("class",f.chart),cj.select("."+f.chart).append("g").attr("class",f.chartBars),cj.select("."+f.chart).append("g").attr("class",f.chartLines),cj.append("g").attr("clip-path",si).attr("class",f.brush).call(Wi).selectAll("rect").attr(Yg?"width":"height",Yg?Nf:Pf),cj.append("g").attr("class",f.axisX).attr("transform",Ni.subx).attr("clip-path",Yg?"":ti),bf(uf.data.targets),Yg?bj.select("."+f.axisX).style("opacity",0).call(lg):(bj.select("."+f.axisY).style("opacity",0).call(mg),bj.select("."+f.axisY2).style("opacity",0).call(ng)),n(),R(),_e(),m(!1),Xe({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),mi){if(vi&&"string"==typeof ni){for(ni=oe(ni),e=0;e0){d=[];for(var g in tg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Id(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ce,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 Ve(a){be(uf.data.targets)||Eg&&(yi=a,bj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),zi=!0,Ng())}function We(){be(uf.data.targets)||Eg&&(bj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),bj.selectAll("."+f.shape).classed(f.INCLUDED,!1),zi=!1,Og())}function Xe(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Sd(),W=be(uf.data.targets),X=Ic(uf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?If:0,Q=D?P:0,R=E?P:0,c=bj.select("."+f.axisX).style("opacity",W?0:1),g=bj.select("."+f.axisY).style("opacity",W?0:1),h=bj.select("."+f.axisY2).style("opacity",W?0:1),e=cj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Sg&&of(Cc(uf.data.targets),a,O),wi&&(0===X.length||!H||G)&&fg.domain([0,c.selectAll(".tick").size()]),X.length&&(H&&(fg.domain(tf.extent(_b(X))),gj=fg.domain(),Bf&&$i.scale(fg).updateScaleExtent(),ig.domain(fg.domain()),Wi.scale(ig)),G&&(fg.domain(Wi.empty()?gj:Wi.extent()),Bf&&$i.scale(fg).updateScaleExtent())),gg.domain(Xb(X,"y")),hg.domain(Xb(X,"y2")),(gh||fh)&&(S=hh?hh:Kc(Jc(X)),lg.tickValues(S),og.tickValues(S)),O.axisX.call(lg),O.axisY.call(mg),O.axisY2.call(ng),O.axisSubX.call(og),G)if(dh&&S){for(T=1;T=0&&tf.select(this).style("display",b%U?"none":"block")})}else tf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!Yg&&ih&&eb(c,O.axisX,ih),J=Ke(V),M=Le(V,!0),N=Le(V,!1),Db(),jg.domain(gg.domain()),kg.domain(hg.domain()),ej.style("display","none"),o(),bj.select("line."+f.xgridFocus).style("visibility","hidden"),Hh){if("year"===Ih){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=fg.ticks(10);i=bj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",Yg?0:function(a){return fg(a)-lg.tickOffset()}).attr("x2",Yg?Mf:function(a){return fg(a)-lg.tickOffset()}).attr("y1",Yg?function(a){return fg(a)-lg.tickOffset()}:Jf.top).attr("y2",Yg?function(a){return fg(a)-lg.tickOffset()}:Of).style("opacity",function(){return+tf.select(this).attr(Yg?"y1":"x1")===(Yg?Of:0)?0:1}),i.exit().remove()}te(Jh)&&(k=bj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Jh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",Yg?"":"rotate(-90)").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",Yg?0:Ad).attr("x2",Yg?Mf:Ad).attr("y1",Yg?Ad:Jf.top).attr("y2",Yg?Ad:Of).style("opacity",1),k.select("text").transition().duration(P).attr("x",Yg?Mf:0).attr("y",Ad).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Kh&&(m=bj.select("."+f.ygrids).selectAll("."+f.ygrid).data(gg.ticks(Mh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",Yg?gg:0).attr("x2",Yg?gg:Mf).attr("y1",Yg?0:gg).attr("y2",Yg?Of:gg),m.exit().remove()),A&&te(Lh)&&(n=bj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Lh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",Yg?"rotate(-90)":"").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",Yg?Bd:0).attr("x2",Yg?Bd:Mf).attr("y1",Yg?0:Bd).attr("y2",Yg?Of:Bd).style("opacity",1),n.select("text").transition().duration(P).attr("x",Yg?0:Mf).attr("y",Bd).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=bj.select("."+f.regions).selectAll("rect."+f.region).data(hi),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=bj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Ei(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=bj.selectAll("."+f.texts).selectAll("."+f.text).data(le),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return Yg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return yd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),bj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",Xi).style("opacity",1),bj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",Yi).style("opacity",hj),q=bj.selectAll("."+f.circles).selectAll("."+f.circle).data(ke),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Oh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),q.exit().remove(),bj.each(function(){Ci=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=tf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(we,function(){Ci=!1}),bj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&ie(a.data)?1:0}),bj.select("."+f.chartArcsTitle).style("opacity",ae(uf.data.targets)?1:0),Pg&&(null!==tf.event&&"zoom"===tf.event.type&&Wi.extent(fg.orgDomain()).update(),B&&(!Yg&&ih&&eb(e,O.axisSubX,ih),Wi.empty()||Wi.extent(fg.orgDomain()).update(),K=Ke(V,!0),u=cj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Ei(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),cj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",Zi).style("opacity",1))),bj.selectAll("."+f.selectedCircles).filter(function(a){return ee(a)}).selectAll("circle").remove(),bj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),v=bj.select("."+f.eventRects),te(qg)&&!oc(qg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=bj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Se(w.enter()),w.attr("x",0).attr("y",0).attr("width",Mf).attr("height",Of)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),xi&&!wi?(z=function(a,b){var c=xc(b),d=yc(b),e=uf.data.xs[a.id][b];return(fg(d?d:e+50)-fg(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=uf.data.xs[a.id][b];return(fg(d)+fg(c?c:d-50))/2}):(z=L(),y=function(a){return fg(a.x)-z/2}),x=Ac(uf.data.targets),bj.select("."+f.eventRects).datum(x?x.values:[]),w=bj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Re(w.enter()),w.attr("class",fd).attr("x",Yg?0:y).attr("y",Yg?y:0).attr("width",Yg?Mf:z).attr("height",Yg?z:Of),w.exit().remove()),Cc(uf.data.targets).forEach(function(a){ij[a]=!0})}function Ye(){Xe({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ze(){return"mousemove"===tf.event.sourceEvent.type&&$i.altDomain?(fg.domain($i.altDomain),void $i.scale(fg).updateScaleExtent()):(wi&&fg.orgDomain()[0]===gj[0]&&fg.domain([gj[0]-1e-10,fg.orgDomain()[1]]),Xe({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===tf.event.sourceEvent.type&&(Ai=!0)))}function $e(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function _e(){_i.attr("width",Qf).attr("height",Rf),_i.select("#"+pi).select("rect").attr("width",Mf).attr("height",Of),_i.select("#"+qi).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),_i.select("#"+ri).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),_i.select("."+f.zoomRect).attr("width",Mf).attr("height",Of),fj.style("max-height",Rf+"px")}function af(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),_e(),m(a.withTransition),Xe(a)}function bf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=bj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Ei(a)}),e=bj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("fill",function(a){return Ei(a)}).style("stroke","none").style("cursor",function(a){return Gg(a)?"pointer":null}),c=bj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ei(a)}),b.append("path").attr("class",dd).style("opacity",function(){return hj=+tf.select(this).style("opacity"),0}).style("fill",function(a){return Ei(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Ei(a)}).style("cursor",function(a){return Gg(a)?"pointer":null}),a.forEach(function(a){bj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=bj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Yf(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Ei(a.data)}).style("cursor",function(a){return Gg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Ci||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),jf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Md(d,tf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Ci||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),lf(),Nd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Pg&&(n=cj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Ei(a)}),l=cj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ei(a)})),_i.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function cf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Xd(a.id,b.types[a.id]):Xd(a.id,b.type)}),uf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Oi?j:i,l=Oi?Q():P();return d&&(x=0,D=0,u=0,v=0),Sg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Oi?v:u,void(Xg?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Oi?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=dj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Ug?Ug(a):uf.toggle(a)}).on("mouseover",function(a){Ci||uf.focus(a),"function"==typeof Vg&&Vg(a)}).on("mouseout",function(a){Ci||uf.revert(),"function"==typeof Wg&&Wg(a)}),o.append("text").text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Oi?h:-200).attr("y",Oi?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Oi?i:-200).attr("y",Oi?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Ei(a)}).attr("x",Oi?h:-200).attr("y",Oi?-200:j).attr("width",10).attr("height",10),dj.selectAll("text").data(a).text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),dj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),dj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),N(u),O(v),M(D),n(),R(),_e(),r&&m(q,c)}function pf(a){return Ec(uf.data.targets,a.id)}function qf(a){return"data"in a&&Ec(uf.data.targets,a.data.id)}function rf(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 sf(a,b,c){var d=!be(uf.data.targets);Ci=!1,Xd(a,b),af(c||{withTransitionForAxis:d})}var tf=a.d3?a.d3:a.require?a.require("d3"):void 0,uf={data:{},axis:{},legend:{}},vf={},wf=h(["bindto"],"#chart"),xf=h(["size","width"]),yf=h(["size","height"]),zf=h(["padding","left"]),Af=h(["padding","right"]),Bf=h(["zoom","enabled"],!1),Cf=h(["zoom","extent"]),Df=h(["zoom","privileged"],!1),Ef=h(["onenter"],function(){}),Ff=h(["onleave"],function(){}),Gf=h(["onresize"],function(){}),Hf=h(["onresized"],function(){}),If=h(["transition","duration"],350);g("data","data is required in config");var Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg=h(["data","x"]),qg=h(["data","xs"],{}),rg=h(["data","x_format"]),sg=h(["data","id_converter"],function(a){return a}),tg=h(["data","names"],{}),ug=h(["data","classes"],{}),vg=h(["data","groups"],[]),wg=h(["data","axes"],{}),xg=h(["data","type"]),yg=h(["data","types"],{}),zg=h(["data","labels"],{}),Ag=h(["data","order"]),Bg=h(["data","regions"],{}),Cg=h(["data","color"]),Dg=h(["data","colors"],{}),Eg=h(["data","selection","enabled"],!1),Fg=h(["data","selection","grouped"],!1),Gg=h(["data","selection","isselectable"],function(){return!0}),Hg=h(["data","selection","multiple"],!0),Ig=h(["data","onclick"],function(){}),Jg=h(["data","onenter"],function(){}),Kg=h(["data","onleave"],function(){}),Lg=h(["data","onselected"],function(){}),Mg=h(["data","onunselected"],function(){}),Ng=h(["data","ondragstart"],function(){}),Og=h(["data","ondragend"],function(){}),Pg=h(["subchart","show"],!1),Qg=h(["subchart","size","height"],60),Rg=h(["color","pattern"],[]),Sg=h(["legend","show"],!0),Tg=h(["legend","position"],"bottom"),Ug=h(["legend","item","onclick"]),Vg=h(["legend","item","onmouseover"]),Wg=h(["legend","item","onmouseout"]),Xg=h(["legend","equally"],!1),Yg=h(["axis","rotated"],!1),Zg=h(["axis","x","show"],!0),$g=h(["axis","x","type"],"indexed"),_g=h(["axis","x","localtime"],!0),ah=h(["axis","x","categories"],[]),bh=h(["axis","x","tick","centered"],!1),ch=h(["axis","x","tick","format"]),dh=h(["axis","x","tick","culling"],{}),eh=h(["axis","x","tick","culling","max"],10),fh=h(["axis","x","tick","count"]),gh=h(["axis","x","tick","fit"],!0),hh=h(["axis","x","tick","values"],null),ih=h(["axis","x","tick","rotate"]),jh=h(["axis","x","max"],null),kh=h(["axis","x","min"],null),lh=h(["axis","x","padding"],{}),mh=h(["axis","x","height"]),nh=h(["axis","x","default"]),oh=h(["axis","x","label"],{}),ph=h(["axis","y","show"],!0),qh=h(["axis","y","max"]),rh=h(["axis","y","min"]),sh=h(["axis","y","center"]),th=h(["axis","y","label"],{}),uh=h(["axis","y","inner"],!1),vh=h(["axis","y","tick","format"]),wh=h(["axis","y","padding"],{}),xh=h(["axis","y","ticks"],10),yh=h(["axis","y2","show"],!1),zh=h(["axis","y2","max"]),Ah=h(["axis","y2","min"]),Bh=h(["axis","y2","center"]),Ch=h(["axis","y2","label"],{}),Dh=h(["axis","y2","inner"],!1),Eh=h(["axis","y2","tick","format"]),Fh=h(["axis","y2","padding"],{}),Gh=h(["axis","y2","ticks"],10),Hh=h(["grid","x","show"],!1),Ih=h(["grid","x","type"],"tick"),Jh=h(["grid","x","lines"],[]),Kh=h(["grid","y","show"],!1),Lh=h(["grid","y","lines"],[]),Mh=h(["grid","y","ticks"],10),Nh=h(["point","show"],!0),Oh=Nh?h(["point","r"],2.5):0,Ph=h(["point","focus","line","enabled"],!0),Qh=h(["point","focus","expand","enabled"],!0),Rh=h(["point","focus","expand","r"],Qh?4:Oh),Sh=h(["point","focus","select","r"],8),Th=h(["line","connect_null"],!1),Uh=h(["bar","width"]),Vh=h(["bar","width","ratio"],.6),Wh=h(["pie","label","show"],!0),Xh=h(["pie","label","format"]),Yh=h(["pie","expand"],!0),Zh=h(["pie","onclick"],function(){}),$h=h(["pie","onmouseover"],function(){}),_h=h(["pie","onmouseout"],function(){}),ai=h(["donut","label","show"],!0),bi=h(["donut","label","format"]),ci=h(["donut","expand"],!0),di=h(["donut","title"],""),ei=h(["donut","onclick"],function(){}),fi=h(["donut","onmouseover"],function(){}),gi=h(["donut","onmouseout"],function(){}),hi=h(["regions"],[]),ii=h(["tooltip","show"],!0),ji=h(["tooltip","format","title"]),ki=h(["tooltip","format","value"]),li=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ji?ji:b,l=ki?ki: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+""}),mi=h(["tooltip","init","show"],!1),ni=h(["tooltip","init","x"],0),oi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),pi=("string"==typeof wf?wf.replace("#",""):wf.id)+"-clip",qi=pi+"-xaxis",ri=pi+"-yaxis",si=i(pi),ti=i(qi),ui=i(ri),vi="timeseries"===$g,wi="categorized"===$g,xi=!vi&&(pg||te(qg)),yi=null,zi=!1,Ai=!1,Bi=!1,Ci=!1,Di=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ei=ne(Dg,te(Rg)?Rg:Di,Cg),Fi=_g?tf.time.format:tf.time.format.utc,Gi=function(){var a=[[Fi("%Y/%-m/%-d"),function(){return!0}],[Fi("%-m/%-d"),function(a){return a.getMonth()}],[Fi("%-m/%-d"),function(a){return 1!==a.getDate()}],[Fi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Fi("%I %p"),function(a){return a.getHours()}],[Fi("%I:%M"),function(a){return a.getMinutes()}],[Fi(":%S"),function(a){return a.getSeconds()}],[Fi(".%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)}}(),Hi=[],Ii=[],Ji=Yg?"left":"bottom",Ki=Yg?uh?"top":"bottom":uh?"right":"left",Li=Yg?Dh?"bottom":"top":Dh?"left":"right",Mi=Yg?"left":"bottom",Ni={main:function(){return"translate("+Jf.left+","+Jf.top+")"},context:function(){return"translate("+Kf.left+","+Kf.top+")"},legend:function(){return"translate("+Lf.left+","+Lf.top+")"},x:function(){return"translate(0,"+(Yg?0:Of)+")"},y:function(){return"translate(0,"+(Yg?Of:0)+")"},y2:function(){return"translate("+(Yg?0:Mf)+","+(Yg?1:0)+")"},subx:function(){return"translate(0,"+(Yg?0:Pf)+")"},arc:function(){return"translate("+Mf/2+","+Of/2+")"}},Oi="right"===Tg,Pi=0,Qi=0,Ri=0,Si=.15,Ti=30,Ui=Yg&&!Zg?0:30,Vi=5;Yf=tf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Wi,Xi=function(){var a=tf.svg.line().x(Yg?function(a){return V(a.id)(a.value)}:zd).y(Yg?zd:function(a){return V(a.id)(a.value)});return Th||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Th?De(b.values):b.values;return ce(b)?(a.interpolate(de(b)?"cardinal":"linear"),Bg[b.id]?Pe(e,fg,V(b.id),Bg[b.id]):a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Yi=function(){var a;return a=Yg?tf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(zd):tf.svg.area().x(zd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=De(b.values);return Yd([b],"area")||Yd([b],"area-spline")?(a.interpolate(de(b)?"cardinal":"linear"),a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Zi=function(){var a=tf.svg.line().x(Yg?function(a){return W(a.id)(a.value)}:Cd).y(Yg?Cd:function(a){return W(a.id)(a.value)});return function(b){var c=De(b.values);return ce(b)?a(c):"M "+ig(c[0].x)+" "+W(b.id)(c[0].value)}}(),$i=function(){};Wi=tf.svg.brush().on("brush",Ye),Wi.update=function(){return cj&&cj.select("."+f.brush).call(this),this},Wi.scale=function(a){return Yg?this.y(a):this.x(a)},Bf&&($i=tf.behavior.zoom().on("zoomstart",function(){$i.altDomain=tf.event.sourceEvent.altKey?fg.orgDomain():null}).on("zoom",Bf?Ze:null),$i.scale=function(a){return Yg?this.y(a):this.x(a)},$i.orgScaleExtent=function(){var a=Cf?Cf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},$i.updateScaleExtent=function(){var a=ac(fg.orgDomain())/ac(gj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var _i,aj,bj,cj,dj,ej,fj,gj,hj,ij={};if(uf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=_i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),uf.defocus(),b(d.classed(f.focused,!0)),b(e),be(uf.data.targets)&&Nb(a,!0),jf(a)},uf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=_i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),kf(a)},uf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=_i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),lf()},uf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),_i.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?mf(a):dj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},uf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),_i.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?nf(a):dj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Si),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},uf.toggle=function(a){Gc(a)?uf.hide(a):uf.show(a)},uf.unzoom=function(){Wi.clear().update(),Xe({withUpdateXDomain:!0})},uf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){ug[b]=a.classes[b]}),"categories"in a&&wi&&(ah=a.categories,lg.categories(ah)),"cacheIds"in a&&bc(a.cacheIds)?void cf(dc(a.cacheIds),a.done):void("unload"in a?ef(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){df(a)}):df(a))},uf.unload=function(a){ef(Dc(a),function(){Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},uf.selected=function(a){return tf.merge(bj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return tf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},uf.select=function(a,b,c){Eg&&bj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=tf.select(this),i="circle"===this.nodeName?xe:Ae,j="circle"===this.nodeName?ye:Be,k=Fg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Gg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},uf.unselect=function(a,b){Eg&&bj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=tf.select(this),g="circle"===this.nodeName?ye:Be,h=Fg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Gg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},uf.toLine=function(a){sf(a,"line")},uf.toSpline=function(a){sf(a,"spline")},uf.toBar=function(a){sf(a,"bar")},uf.toScatter=function(a){sf(a,"scatter")},uf.toArea=function(a){sf(a,"area")},uf.toAreaSpline=function(a){sf(a,"area-spline")},uf.toPie=function(a){sf(a,"pie",{withTransform:!0})},uf.toDonut=function(a){sf(a,"donut",{withTransform:!0})},uf.groups=function(a){return c(a)?vg:(vg=a,Xe(),vg)},uf.xgrids=function(a){return a?(Jh=a,Xe(),Jh):Jh},uf.xgrids.add=function(a){return a?uf.xgrids(Jh.concat(a)):void 0},uf.xgrids.remove=function(a){var b=rf(a);return uf.xgrids(Jh.filter(b)) +},uf.ygrids=function(a){return a?(Lh=a,Xe(),Lh):Lh},uf.ygrids.add=function(a){return a?uf.ygrids(Lh.concat(a)):void 0},uf.ygrids.remove=function(a){var b=rf(a);return uf.ygrids(Lh.filter(b))},uf.regions=function(a){return c(a)?hi:(hi=a,Xe(),hi)},uf.regions.add=function(a){return c(a)?hi:(hi=hi.concat(a),Xe(),hi)},uf.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;_i.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),hi=hi.filter(function(b){return b.classes.indexOf(a)<0})}),hi},uf.data.get=function(a){var b=uf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},uf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},uf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){tg[b]=a[b]}),of(Cc(uf.data.targets),{withTransition:!0}),tg):tg},uf.x=function(a){return arguments.length&&(qc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.xs=function(a){return arguments.length&&(rc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},uf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(qh=+a.y),b(a.y2)&&(zh=+a.y2)):qh=zh=+a,Xe())},uf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(rh=+a.y),b(a.y2)&&(Ah=+a.y2)):rh=Ah=+a,Xe())},uf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&uf.axis.max(a.max),"undefined"!=typeof a.min&&uf.axis.min(a.min))},uf.legend.show=function(a){Sg||(Sg=!0,dj.style("visibility","visible")),mf(Dc(a)),Xe({withLegend:!0})},uf.legend.hide=function(a){nf(Dc(a)),Xe({withLegend:!0}),Sg&&se(a)&&(Sg=!1,dj.style("visibility","hidden"))},uf.resize=function(a){xf=a?a.width:null,yf=a?a.height:null,af({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},uf.destroy=function(){uf.data.targets=void 0,uf.data.xs={},fj.html(""),a.onresize=null},"url"in e.data)tf.xhr(e.data.url,function(a,b){var c,d=tf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=tf.csv.parse(b.response),Qe(c)});else if("rows"in e.data)Qe(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Qe(uc(e.data.columns))}return uf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 691e17ebd8577853eb869145b438833d5c98ca92 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Mon, 28 Apr 2014 13:25:26 +0900 Subject: [PATCH 075/178] Fix tooltip value format for y2 - #159 --- c3.js | 41 ++++++++++++++++++++++++++--------------- c3.min.js | 6 +++--- 2 files changed, 29 insertions(+), 18 deletions(-) diff --git a/c3.js b/c3.js index aa744a7..56547fb 100644 --- a/c3.js +++ b/c3.js @@ -264,7 +264,7 @@ } name = d[i].name; - value = valueFormat(d[i].value, d[i].ratio); + value = valueFormat(d[i].value, d[i].ratio, d[i].id); text += ""; text += "" + name + ""; @@ -1765,10 +1765,24 @@ .remove(); return widths; } - + function getYFormat(forArc) { + var formatForY = forArc ? defaultArcValueFormat : yFormat, + formatForY2 = forArc ? defaultArcValueFormat : y2Format; + return function (v, ratio, id) { + var format = getAxisId(id) === 'y2' ? formatForY2 : formatForY; + return format(v, ratio); + }; + } + function yFormat(v) { + var format = __axis_y_tick_format ? __axis_y_tick_format : defaultValueFormat; + return format(v); + } + function y2Format(v) { + var format = __axis_y2_tick_format ? __axis_y2_tick_format : defaultValueFormat; + return format(v); + } function defaultValueFormat(v) { - var yFormat = __axis_y_tick_format ? __axis_y_tick_format : function (v) { return isValue(v) ? +v : ""; }; - return yFormat(v); + return isValue(v) ? +v : ""; } function defaultArcValueFormat(v, ratio) { return (ratio * 100).toFixed(1) + '%'; @@ -1899,16 +1913,13 @@ //-- Tooltip --// function showTooltip(selectedData, mouse) { - var tWidth, tHeight; - var svgLeft, tooltipLeft, tooltipRight, tooltipTop, chartRight; - var forArc = hasArcType(c3.data.targets); - var valueFormat = forArc ? defaultArcValueFormat : defaultValueFormat; - var dataToShow = selectedData.filter(function (d) { return d && isValue(d.value); }); - if (! __tooltip_show) { return; } - // don't show tooltip when no data - if (dataToShow.length === 0) { return; } - // Construct tooltip - tooltip.html(__tooltip_contents(selectedData, getXAxisTickFormat(), valueFormat, color)).style("display", "block"); + var tWidth, tHeight, svgLeft, tooltipLeft, tooltipRight, tooltipTop, chartRight; + var forArc = hasArcType(c3.data.targets), + dataToShow = selectedData.filter(function (d) { return d && isValue(d.value); }); + if (dataToShow.length === 0 || !__tooltip_show) { + return; + } + tooltip.html(__tooltip_contents(selectedData, getXAxisTickFormat(), getYFormat(forArc), color)).style("display", "block"); // Get tooltip dimensions tWidth = tooltip.property('offsetWidth'); tHeight = tooltip.property('offsetHeight'); @@ -2778,7 +2789,7 @@ } tooltip.html(__tooltip_contents(c3.data.targets.map(function (d) { return addName(d.values[__tooltip_init_x]); - }), getXAxisTickFormat(), defaultValueFormat, color)); + }), getXAxisTickFormat(), getYFormat(hasArcType(c3.data.targets)), color)); tooltip.style("top", __tooltip_init_position.top) .style("left", __tooltip_init_position.left) .style("display", "block"); diff --git a/c3.min.js b/c3.min.js index 5984b4b..482a75c 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.32"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cMf&&(Mf=0),0>Of&&(Of=0),Nf=Yg?Jf.left-Ti-Ui:Mf,Pf=Yg?Of:Rf-Kf.top-Kf.bottom,0>Nf&&(Nf=0),0>Pf&&(Pf=0),p(),Oi&&be(uf.data.targets)&&(Lf.left=Mf/2+Tf)}function o(){bj.select("line."+f.xgridFocus).attr("x1",Yg?0:-10).attr("x2",Yg?Mf:-10).attr("y1",Yg?-10:Jf.top).attr("y2",Yg?-10:Of)}function p(){Tf=Of/2,Sf=.95*Tf,Uf=ae(uf.data.targets)?.6*Sf:0}function q(){var a=Yg?f.axisX:f.axisY,b=tf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=tf.select(wf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return xf?xf:x()}function s(){var a=yf?yf:y();return a>0?a:320}function t(){return be(uf.data.targets)?0:zf?zf:Yg?Zg?v("x"):1:!ph||uh?1:v("y")}function u(){var a=1;return be(uf.data.targets)?0:Af?Af:Oi?P()+(yh&&!Yg?v("y2"):a):yh?Dh||Yg?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||Zg?"x"===a&&mh?mh:"y"!==a||ph?"y2"!==a||yh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Vi:Sg&&!Oi?10:1:0}function x(){return+tf.select(wf).style("width").replace("px","")}function y(){return+tf.select(wf).style("height").replace("px","")}function z(a){return a?-5:-(Jf.left-1)}function A(a){return a?-20:-4}function B(){return z(!Yg)}function C(){return A(!Yg)}function D(){return z(Yg)}function E(){return A(Yg)}function F(a){return a?Mf+2+4:Jf.left+20}function G(a){return a?(mh?mh:0)+80:Of+8}function H(){return F(!Yg)}function I(){return G(!Yg)}function J(){return F(Yg)}function K(){return G(Yg)}function L(){var a,b,c,d,e,f=Ac(uf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=fg(b.x)-fg(a.x),d=zc(),e=Zd(uf.data.targets)?(d-(wi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Pi=a}function N(a){Qi=a}function O(a){Ri=a}function P(){return Sg?Oi?Qi*(Pi+1):Qf:0}function Q(){return Sg?Oi?Rf:Ri*(Pi+1):0}function R(){var a,b=!fg;Zf=Yg?1:0,$f=Yg?Of:Mf,_f=Yg?0:Of,ag=Yg?Mf:1,bg=Zf,cg=$f,dg=Yg?0:Pf,eg=Yg?Nf:1,fg=T(Zf,$f,b?void 0:fg.domain(),function(){return lg.tickOffset()}),gg=U(_f,ag,b?void 0:gg.domain()),hg=U(_f,ag,b?void 0:hg.domain()),ig=T(Zf,$f,gj,function(a){return a%1?0:og.tickOffset()}),jg=U(dg,eg,b?void 0:jg.domain()),kg=U(dg,eg,b?void 0:kg.domain()),a=$(),lg=X(fg,Ji,a),og=X(ig,Mi,a),mg=Y(gg,Ki,vh,xh),ng=Y(hg,Li,Eh,Gh),b||(Wi.scale(ig),Bf&&$i.scale(fg)),S()}function S(){Vf=Gb(),Wf=Hb(),Xf=Hb(.98)}function T(a,b,d,e){var f=(vi?tf.time.scale():tf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),wi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=tf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?hg:gg}function W(a){return"y2"===Z(a)?kg:jg}function X(a,b,c){var d=(wi?Eb():tf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),wi?(d.tickCentered(bh),se(dh)&&(dh=!1)):d.tickOffset=function(){var a=Bc(uf.data.targets),b=fg(a[1])-fg(a[0]);return b/zc()/2},wi&&d.categories(ah),d}function Y(a,b,c,d){return tf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in wg?wg[a]:"y"}function $(){var a=vi?Gi:wi?Tc:function(a){return 0>a?a.toFixed(0):a};return ch&&("function"==typeof ch?a=ch:vi&&(a=function(a){return a?Fi(ch)(a):""})),a}function _(a){var b;return"y"===a?b=th:"y2"===a?b=Ch:"x"===a&&(b=oh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?th=b:"y2"===a?Ch=b:"x"===a&&(oh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",Yg?"inner-top":"inner-right")}function hb(){return fb("y",Yg?"inner-right":"inner-top")}function ib(){return fb("y2",Yg?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Mf/2:Mf:b.isBottom?-Of:b.isMiddle?-Of/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!Yg,gb())}function rb(){return nb(Yg,hb())}function sb(){return nb(Yg,ib())}function tb(){return ob(!Yg,gb())}function ub(){return ob(Yg,hb())}function vb(){return ob(Yg,ib())}function wb(){var a=gb();return Yg?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":mh?mh-10:"3em"}function xb(){var a=hb();return Yg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return Yg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!Yg,gb())}function Ab(){return pb(Yg,hb())}function Bb(){return pb(Yg,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return tf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?30:b}function Db(){bj.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),bj.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),bj.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 tf.min(Object.keys(i).map(function(a){return tf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(vg.length>0)for(g=Sc(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 tf.max(Object.keys(i).map(function(a){return tf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Ah:rh,n="y2"===c?zh:qh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Bh:sh,r=ud()&&Yg;return 0===l.length?"y2"===c?hg.domain():gg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(gg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&wh&&(f=b(wh.top)?wh.top:e,g=b(wh.bottom)?wh.bottom:e),"y2"===c&&Fh&&(f=b(Fh.top)?Fh.top:e,g=b(Fh.bottom)?Fh.bottom:e),Zd(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return kh?vi?oe(kh):kh:tf.min(a,function(a){return tf.min(a.values,function(a){return a.x})})}function Zb(a){return jh?vi?oe(jh):jh:tf.max(a,function(a){return tf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return wi?d=0:Zd(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof lh&&te(lh)?(e=b(lh.left)?lh.left:d,f=b(lh.right)?lh.right:d):e=f="number"==typeof lh?lh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?gg:hg;return b="y"===a.axis||"y2"===a.axis?Yg?Of:"start"in a?d(a.start):Of:Yg?"end"in a?fg(vi?oe(a.end):a.end):Of:Of,c>b?0:b-c}function ic(a){return pg&&a===pg||te(qg)&&ue(qg,a)}function jc(a){return!ic(a)}function kc(a){return pg?pg:te(qg)?qg[a]:null}function lc(a,b){var c,d=b&&te(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=uf.data.xs[b])}),c}function mc(a,b){return a in uf.data.xs&&uf.data.xs[a]&&uf.data.xs[a][b]?uf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){qg[b]=a[b]})}function oc(a){return 1===tf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=tg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),uf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=vi?a?a instanceof Date?a:oe(a):oe(mc(c,d)):xi&&!wi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?uf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):pg?(d=Object.keys(uf.data.xs),uf.data.xs[c]=d.length>0?uf.data.xs[d[0]]:void 0):te(qg)&&(uf.data.xs[c]=lc(f,uf.data.targets)):uf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!uf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=sg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return xi&&wi&&0===c&&g&&(0===e&&(ah=[]),ah.push(g)),("undefined"==typeof a[b]||uf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),xg&&Xd(Cc(c).filter(function(a){return!(a in yg)}),xg),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&uf.data.targets[0].values[a-1]?uf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(uf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(vi?new Date(h):h);i.push(d)}return vi||(i=i.sort(function(a,b){return a-b})),i}function Lc(a){Hi=Hi.concat(a)}function Mc(a){Hi=Hi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Ii=Ii.concat(a)}function Oc(a){Ii=Ii.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Dd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Dd(a,g))),Gd(e,b)):Ed(a,b,f,g)}function Fd(a,b){var c;return c=a.map(function(a){return Ed(a.values,b)}),Gd(c,b)}function Gd(a,b){var c,d;return a.forEach(function(a){var e=ve(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Hd(a,b){return tf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Id(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 Jd(){return Ag&&"desc"===Ag.toLowerCase()}function Kd(){return Ag&&"asc"===Ag.toLowerCase()}function Ld(a){var b=Kd(),c=Jd();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 Ag&&a.sort(Ag),a}function Md(a,c){var d,e,f,g,h,i,j,k=be(uf.data.targets),l=k?xd:wd,m=a.filter(function(a){return a&&b(a.value)});ii&&0!==m.length&&(ej.html(li(a,$(),l,Ei)).style("display","block"),d=ej.property("offsetWidth"),e=ej.property("offsetHeight"),k?(g=Mf/2+c[0],i=Of/2+c[1]+20):(Yg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=fg(m[0].x)+20):(f=q(),g=f+t()+fg(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),ej.style("top",i+"px").style("left",g+"px"))}function Nd(){ej.style("display","none")}function Od(a){var c=a.filter(function(a){return a&&b(a.value)});ii&&($d(uf.data.targets)||be(uf.data.targets)||bj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Yg?"y1":"x1",zd).attr(Yg?"y2":"x2",zd))}function Pd(){bj.select("line."+f.xgridFocus).style("visibility","hidden")}function Qd(a){return a.x||0===a.x?fg(a.x):null}function Rd(a){return V(a.id)(a.value)}function Sd(){var a,b,d={},e=0;return Ic(Fc(ee)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Wd(a,b){return Uh?Uh:b?2*a.tickOffset()*Vh/b:0}function Xd(a,b){Dc(a).forEach(function(a){ij[a]=b===yg[a],yg[a]=b})}function Yd(a,b){var c=!1;return a.forEach(function(a){yg[a.id]===b&&(c=!0),a.id in yg||"line"!==b||(c=!0)}),c}function Zd(a){return Yd(a,"bar")}function $d(a){return Yd(a,"scatter")}function _d(a){return Yd(a,"pie")}function ae(a){return Yd(a,"donut")}function be(a){return _d(a)||ae(a)}function ce(a){var b="string"==typeof a?a:a.id;return!(b in yg)||"line"===yg[b]||"spline"===yg[b]||"area"===yg[b]||"area-spline"===yg[b]}function de(a){var b="string"==typeof a?a:a.id;return"spline"===yg[b]||"area-spline"===yg[b]}function ee(a){var b="string"==typeof a?a:a.id;return"bar"===yg[b]}function fe(a){var b="string"==typeof a?a:a.id;return"scatter"===yg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"pie"===yg[b]}function he(a){var b="string"==typeof a?a:a.id;return"donut"===yg[b]}function ie(a){return ge(a)||he(a)}function je(a){return ee(a)?a.values:[]}function ke(a){return ce(a)||fe(a)?a.values:[]}function le(a){return ee(a)||ce(a)?a.values:[]}function me(a){return he(a)&&ci||ge(a)&&Yh}function ne(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function oe(b){var c;try{c=rg?tf.time.format(rg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+rg)}return c}function pe(a,b){var c=tf.mouse(a),d=tf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function ue(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ve(a,b){var c="y"===Z(a.id)?gg:hg,d=Yg?1:0,e=Yg?0:1;return Math.pow(fg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function we(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function xe(a,b,c){Lg(b,a.node()),bj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd).attr("stroke",function(){return Ei(b)}).attr("r",1.4*Sh).transition().duration(100).attr("r",Sh)}function ye(a,b,c){Mg(b,a.node()),bj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ze(a,b,c,d){a?xe(b,c,d):ye(b,c,d)}function Ae(a,b){Lg(b,a.node()),a.transition().duration(100).style("fill",function(){return tf.rgb(Ei(b)).darker(1)})}function Be(a,b){Mg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ei(b)})}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a){return a.filter(function(a){return b(a.value)})}function Ee(a,c){return(c?bj.selectAll("."+f.circles+ld(c)):bj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Fe(a,b){Ee(a,b).classed(f.EXPANDED,!0).attr("r",Rh)}function Ge(a){Ee(a).filter(function(){return tf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oh)}function He(a){return bj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ie(a){He(a).classed(f.EXPANDED,!0)}function Je(a){He(a).classed(f.EXPANDED,!1)}function Ke(a,b){var c=Oe(a,b);return function(a,b){var d=c(a,b),e=Yg?1:0,f=Yg?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 Le(a,b){var c=Oe(a,!1),d=b?Me:Ne;return function(a,b){return d(c(a,b),a,this)}}function Me(a,b){var c;return Yg?(c=ee(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ne(a,b,c){var d=c.getBoundingClientRect();return Yg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ee(b)?-3:-6)}function Oe(a,b){var c=a.__max__+1,d=Wd(lg,c),e=Td(d,c,a,!!b),f=Ud(!!b),g=Vd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Yg&&(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 Pe(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 Qe(b){var c,d,e;if(fj=tf.select(wf),fj.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(fj.html(""),fj.classed("c3",!0),uf.data.xs={},uf.data.targets=vc(b),n(),R(),fg.domain(tf.extent(_b(uf.data.targets))),gg.domain(Xb(uf.data.targets,"y")),hg.domain(Xb(uf.data.targets,"y2")),ig.domain(fg.domain()),jg.domain(gg.domain()),kg.domain(hg.domain()),gj=fg.domain(),Wi.scale(ig),Bf&&$i.scale(fg),_i=fj.append("svg").attr("width",Mf+Jf.left+Jf.right).attr("height",Of+Jf.top+Jf.bottom).on("mouseenter",Ef).on("mouseleave",Ff),aj=_i.append("defs"),aj.append("clipPath").attr("id",pi).append("rect").attr("width",Mf).attr("height",Of),aj.append("clipPath").attr("id",qi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),aj.append("clipPath").attr("id",ri).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),bj=_i.append("g").attr("transform",Ni.main),cj=_i.append("g").attr("transform",Ni.context),dj=_i.append("g").attr("transform",Ni.legend),Pg||cj.style("visibility","hidden"),Sg||(dj.style("visibility","hidden"),Ii=Cc(uf.data.targets)),ej=tf.select(wf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),of(Cc(uf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Zg&&bj.append("g").attr("class",f.axisX).attr("clip-path",ti).attr("transform",Ni.x).append("text").attr("class",f.axisXLabel).attr("transform",Yg?"rotate(-90)":"").style("text-anchor",zb),ph&&bj.append("g").attr("class",f.axisY).attr("clip-path",ui).attr("transform",Ni.y).append("text").attr("class",f.axisYLabel).attr("transform",Yg?"":"rotate(-90)").style("text-anchor",Ab),yh&&bj.append("g").attr("class",f.axisY2).attr("transform",Ni.y2).append("text").attr("class",f.axisY2Label).attr("transform",Yg?"":"rotate(-90)").style("text-anchor",Bb),d=bj.append("g").attr("clip-path",si).attr("class",f.grid),Hh&&d.append("g").attr("class",f.xgrids),te(Jh)&&d.append("g").attr("class",f.xgridLines),Ph&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Kh&&d.append("g").attr("class",f.ygrids),te(Lh)&&d.append("g").attr("class",f.ygridLines),bj.append("g").attr("clip-path",si).attr("class",f.regions),bj.append("g").attr("clip-path",si).attr("class",f.chart),c=bj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Bf?Yg?"ns-resize":"ew-resize":null),bj.select("."+f.chart).append("g").attr("class",f.chartBars),bj.select("."+f.chart).append("g").attr("class",f.chartLines),bj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Ni.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),bj.select("."+f.chart).append("g").attr("class",f.chartTexts),Bf&&bj.insert("rect",Df?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Mf).attr("height",Of).style("opacity",0).style("cursor",Yg?"ns-resize":"ew-resize").call($i).on("dblclick.zoom",null),nh&&Wi.extent("function"!=typeof nh?nh:nh(_b())),cj.append("g").attr("clip-path",si).attr("class",f.chart),cj.select("."+f.chart).append("g").attr("class",f.chartBars),cj.select("."+f.chart).append("g").attr("class",f.chartLines),cj.append("g").attr("clip-path",si).attr("class",f.brush).call(Wi).selectAll("rect").attr(Yg?"width":"height",Yg?Nf:Pf),cj.append("g").attr("class",f.axisX).attr("transform",Ni.subx).attr("clip-path",Yg?"":ti),bf(uf.data.targets),Yg?bj.select("."+f.axisX).style("opacity",0).call(lg):(bj.select("."+f.axisY).style("opacity",0).call(mg),bj.select("."+f.axisY2).style("opacity",0).call(ng)),n(),R(),_e(),m(!1),Xe({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),mi){if(vi&&"string"==typeof ni){for(ni=oe(ni),e=0;e0){d=[];for(var g in tg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Id(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ce,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 Ve(a){be(uf.data.targets)||Eg&&(yi=a,bj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),zi=!0,Ng())}function We(){be(uf.data.targets)||Eg&&(bj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),bj.selectAll("."+f.shape).classed(f.INCLUDED,!1),zi=!1,Og())}function Xe(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Sd(),W=be(uf.data.targets),X=Ic(uf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?If:0,Q=D?P:0,R=E?P:0,c=bj.select("."+f.axisX).style("opacity",W?0:1),g=bj.select("."+f.axisY).style("opacity",W?0:1),h=bj.select("."+f.axisY2).style("opacity",W?0:1),e=cj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Sg&&of(Cc(uf.data.targets),a,O),wi&&(0===X.length||!H||G)&&fg.domain([0,c.selectAll(".tick").size()]),X.length&&(H&&(fg.domain(tf.extent(_b(X))),gj=fg.domain(),Bf&&$i.scale(fg).updateScaleExtent(),ig.domain(fg.domain()),Wi.scale(ig)),G&&(fg.domain(Wi.empty()?gj:Wi.extent()),Bf&&$i.scale(fg).updateScaleExtent())),gg.domain(Xb(X,"y")),hg.domain(Xb(X,"y2")),(gh||fh)&&(S=hh?hh:Kc(Jc(X)),lg.tickValues(S),og.tickValues(S)),O.axisX.call(lg),O.axisY.call(mg),O.axisY2.call(ng),O.axisSubX.call(og),G)if(dh&&S){for(T=1;T=0&&tf.select(this).style("display",b%U?"none":"block")})}else tf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!Yg&&ih&&eb(c,O.axisX,ih),J=Ke(V),M=Le(V,!0),N=Le(V,!1),Db(),jg.domain(gg.domain()),kg.domain(hg.domain()),ej.style("display","none"),o(),bj.select("line."+f.xgridFocus).style("visibility","hidden"),Hh){if("year"===Ih){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=fg.ticks(10);i=bj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",Yg?0:function(a){return fg(a)-lg.tickOffset()}).attr("x2",Yg?Mf:function(a){return fg(a)-lg.tickOffset()}).attr("y1",Yg?function(a){return fg(a)-lg.tickOffset()}:Jf.top).attr("y2",Yg?function(a){return fg(a)-lg.tickOffset()}:Of).style("opacity",function(){return+tf.select(this).attr(Yg?"y1":"x1")===(Yg?Of:0)?0:1}),i.exit().remove()}te(Jh)&&(k=bj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Jh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",Yg?"":"rotate(-90)").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",Yg?0:Ad).attr("x2",Yg?Mf:Ad).attr("y1",Yg?Ad:Jf.top).attr("y2",Yg?Ad:Of).style("opacity",1),k.select("text").transition().duration(P).attr("x",Yg?Mf:0).attr("y",Ad).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Kh&&(m=bj.select("."+f.ygrids).selectAll("."+f.ygrid).data(gg.ticks(Mh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",Yg?gg:0).attr("x2",Yg?gg:Mf).attr("y1",Yg?0:gg).attr("y2",Yg?Of:gg),m.exit().remove()),A&&te(Lh)&&(n=bj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Lh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",Yg?"rotate(-90)":"").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",Yg?Bd:0).attr("x2",Yg?Bd:Mf).attr("y1",Yg?0:Bd).attr("y2",Yg?Of:Bd).style("opacity",1),n.select("text").transition().duration(P).attr("x",Yg?0:Mf).attr("y",Bd).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=bj.select("."+f.regions).selectAll("rect."+f.region).data(hi),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=bj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Ei(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=bj.selectAll("."+f.texts).selectAll("."+f.text).data(le),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return Yg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return yd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),bj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",Xi).style("opacity",1),bj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",Yi).style("opacity",hj),q=bj.selectAll("."+f.circles).selectAll("."+f.circle).data(ke),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Oh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),q.exit().remove(),bj.each(function(){Ci=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=tf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(we,function(){Ci=!1}),bj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&ie(a.data)?1:0}),bj.select("."+f.chartArcsTitle).style("opacity",ae(uf.data.targets)?1:0),Pg&&(null!==tf.event&&"zoom"===tf.event.type&&Wi.extent(fg.orgDomain()).update(),B&&(!Yg&&ih&&eb(e,O.axisSubX,ih),Wi.empty()||Wi.extent(fg.orgDomain()).update(),K=Ke(V,!0),u=cj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Ei(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),cj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",Zi).style("opacity",1))),bj.selectAll("."+f.selectedCircles).filter(function(a){return ee(a)}).selectAll("circle").remove(),bj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),v=bj.select("."+f.eventRects),te(qg)&&!oc(qg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=bj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Se(w.enter()),w.attr("x",0).attr("y",0).attr("width",Mf).attr("height",Of)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),xi&&!wi?(z=function(a,b){var c=xc(b),d=yc(b),e=uf.data.xs[a.id][b];return(fg(d?d:e+50)-fg(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=uf.data.xs[a.id][b];return(fg(d)+fg(c?c:d-50))/2}):(z=L(),y=function(a){return fg(a.x)-z/2}),x=Ac(uf.data.targets),bj.select("."+f.eventRects).datum(x?x.values:[]),w=bj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Re(w.enter()),w.attr("class",fd).attr("x",Yg?0:y).attr("y",Yg?y:0).attr("width",Yg?Mf:z).attr("height",Yg?z:Of),w.exit().remove()),Cc(uf.data.targets).forEach(function(a){ij[a]=!0})}function Ye(){Xe({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ze(){return"mousemove"===tf.event.sourceEvent.type&&$i.altDomain?(fg.domain($i.altDomain),void $i.scale(fg).updateScaleExtent()):(wi&&fg.orgDomain()[0]===gj[0]&&fg.domain([gj[0]-1e-10,fg.orgDomain()[1]]),Xe({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===tf.event.sourceEvent.type&&(Ai=!0)))}function $e(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function _e(){_i.attr("width",Qf).attr("height",Rf),_i.select("#"+pi).select("rect").attr("width",Mf).attr("height",Of),_i.select("#"+qi).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),_i.select("#"+ri).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),_i.select("."+f.zoomRect).attr("width",Mf).attr("height",Of),fj.style("max-height",Rf+"px")}function af(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),_e(),m(a.withTransition),Xe(a)}function bf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=bj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Ei(a)}),e=bj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("fill",function(a){return Ei(a)}).style("stroke","none").style("cursor",function(a){return Gg(a)?"pointer":null}),c=bj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ei(a)}),b.append("path").attr("class",dd).style("opacity",function(){return hj=+tf.select(this).style("opacity"),0}).style("fill",function(a){return Ei(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Ei(a)}).style("cursor",function(a){return Gg(a)?"pointer":null}),a.forEach(function(a){bj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=bj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Yf(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Ei(a.data)}).style("cursor",function(a){return Gg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Ci||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),jf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Md(d,tf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Ci||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),lf(),Nd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Pg&&(n=cj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Ei(a)}),l=cj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ei(a)})),_i.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function cf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Xd(a.id,b.types[a.id]):Xd(a.id,b.type)}),uf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Oi?j:i,l=Oi?Q():P();return d&&(x=0,D=0,u=0,v=0),Sg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Oi?v:u,void(Xg?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Oi?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=dj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Ug?Ug(a):uf.toggle(a)}).on("mouseover",function(a){Ci||uf.focus(a),"function"==typeof Vg&&Vg(a)}).on("mouseout",function(a){Ci||uf.revert(),"function"==typeof Wg&&Wg(a)}),o.append("text").text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Oi?h:-200).attr("y",Oi?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Oi?i:-200).attr("y",Oi?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Ei(a)}).attr("x",Oi?h:-200).attr("y",Oi?-200:j).attr("width",10).attr("height",10),dj.selectAll("text").data(a).text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),dj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),dj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),N(u),O(v),M(D),n(),R(),_e(),r&&m(q,c)}function pf(a){return Ec(uf.data.targets,a.id)}function qf(a){return"data"in a&&Ec(uf.data.targets,a.data.id)}function rf(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 sf(a,b,c){var d=!be(uf.data.targets);Ci=!1,Xd(a,b),af(c||{withTransitionForAxis:d})}var tf=a.d3?a.d3:a.require?a.require("d3"):void 0,uf={data:{},axis:{},legend:{}},vf={},wf=h(["bindto"],"#chart"),xf=h(["size","width"]),yf=h(["size","height"]),zf=h(["padding","left"]),Af=h(["padding","right"]),Bf=h(["zoom","enabled"],!1),Cf=h(["zoom","extent"]),Df=h(["zoom","privileged"],!1),Ef=h(["onenter"],function(){}),Ff=h(["onleave"],function(){}),Gf=h(["onresize"],function(){}),Hf=h(["onresized"],function(){}),If=h(["transition","duration"],350);g("data","data is required in config");var Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg=h(["data","x"]),qg=h(["data","xs"],{}),rg=h(["data","x_format"]),sg=h(["data","id_converter"],function(a){return a}),tg=h(["data","names"],{}),ug=h(["data","classes"],{}),vg=h(["data","groups"],[]),wg=h(["data","axes"],{}),xg=h(["data","type"]),yg=h(["data","types"],{}),zg=h(["data","labels"],{}),Ag=h(["data","order"]),Bg=h(["data","regions"],{}),Cg=h(["data","color"]),Dg=h(["data","colors"],{}),Eg=h(["data","selection","enabled"],!1),Fg=h(["data","selection","grouped"],!1),Gg=h(["data","selection","isselectable"],function(){return!0}),Hg=h(["data","selection","multiple"],!0),Ig=h(["data","onclick"],function(){}),Jg=h(["data","onenter"],function(){}),Kg=h(["data","onleave"],function(){}),Lg=h(["data","onselected"],function(){}),Mg=h(["data","onunselected"],function(){}),Ng=h(["data","ondragstart"],function(){}),Og=h(["data","ondragend"],function(){}),Pg=h(["subchart","show"],!1),Qg=h(["subchart","size","height"],60),Rg=h(["color","pattern"],[]),Sg=h(["legend","show"],!0),Tg=h(["legend","position"],"bottom"),Ug=h(["legend","item","onclick"]),Vg=h(["legend","item","onmouseover"]),Wg=h(["legend","item","onmouseout"]),Xg=h(["legend","equally"],!1),Yg=h(["axis","rotated"],!1),Zg=h(["axis","x","show"],!0),$g=h(["axis","x","type"],"indexed"),_g=h(["axis","x","localtime"],!0),ah=h(["axis","x","categories"],[]),bh=h(["axis","x","tick","centered"],!1),ch=h(["axis","x","tick","format"]),dh=h(["axis","x","tick","culling"],{}),eh=h(["axis","x","tick","culling","max"],10),fh=h(["axis","x","tick","count"]),gh=h(["axis","x","tick","fit"],!0),hh=h(["axis","x","tick","values"],null),ih=h(["axis","x","tick","rotate"]),jh=h(["axis","x","max"],null),kh=h(["axis","x","min"],null),lh=h(["axis","x","padding"],{}),mh=h(["axis","x","height"]),nh=h(["axis","x","default"]),oh=h(["axis","x","label"],{}),ph=h(["axis","y","show"],!0),qh=h(["axis","y","max"]),rh=h(["axis","y","min"]),sh=h(["axis","y","center"]),th=h(["axis","y","label"],{}),uh=h(["axis","y","inner"],!1),vh=h(["axis","y","tick","format"]),wh=h(["axis","y","padding"],{}),xh=h(["axis","y","ticks"],10),yh=h(["axis","y2","show"],!1),zh=h(["axis","y2","max"]),Ah=h(["axis","y2","min"]),Bh=h(["axis","y2","center"]),Ch=h(["axis","y2","label"],{}),Dh=h(["axis","y2","inner"],!1),Eh=h(["axis","y2","tick","format"]),Fh=h(["axis","y2","padding"],{}),Gh=h(["axis","y2","ticks"],10),Hh=h(["grid","x","show"],!1),Ih=h(["grid","x","type"],"tick"),Jh=h(["grid","x","lines"],[]),Kh=h(["grid","y","show"],!1),Lh=h(["grid","y","lines"],[]),Mh=h(["grid","y","ticks"],10),Nh=h(["point","show"],!0),Oh=Nh?h(["point","r"],2.5):0,Ph=h(["point","focus","line","enabled"],!0),Qh=h(["point","focus","expand","enabled"],!0),Rh=h(["point","focus","expand","r"],Qh?4:Oh),Sh=h(["point","focus","select","r"],8),Th=h(["line","connect_null"],!1),Uh=h(["bar","width"]),Vh=h(["bar","width","ratio"],.6),Wh=h(["pie","label","show"],!0),Xh=h(["pie","label","format"]),Yh=h(["pie","expand"],!0),Zh=h(["pie","onclick"],function(){}),$h=h(["pie","onmouseover"],function(){}),_h=h(["pie","onmouseout"],function(){}),ai=h(["donut","label","show"],!0),bi=h(["donut","label","format"]),ci=h(["donut","expand"],!0),di=h(["donut","title"],""),ei=h(["donut","onclick"],function(){}),fi=h(["donut","onmouseover"],function(){}),gi=h(["donut","onmouseout"],function(){}),hi=h(["regions"],[]),ii=h(["tooltip","show"],!0),ji=h(["tooltip","format","title"]),ki=h(["tooltip","format","value"]),li=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ji?ji:b,l=ki?ki: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+""}),mi=h(["tooltip","init","show"],!1),ni=h(["tooltip","init","x"],0),oi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),pi=("string"==typeof wf?wf.replace("#",""):wf.id)+"-clip",qi=pi+"-xaxis",ri=pi+"-yaxis",si=i(pi),ti=i(qi),ui=i(ri),vi="timeseries"===$g,wi="categorized"===$g,xi=!vi&&(pg||te(qg)),yi=null,zi=!1,Ai=!1,Bi=!1,Ci=!1,Di=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ei=ne(Dg,te(Rg)?Rg:Di,Cg),Fi=_g?tf.time.format:tf.time.format.utc,Gi=function(){var a=[[Fi("%Y/%-m/%-d"),function(){return!0}],[Fi("%-m/%-d"),function(a){return a.getMonth()}],[Fi("%-m/%-d"),function(a){return 1!==a.getDate()}],[Fi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Fi("%I %p"),function(a){return a.getHours()}],[Fi("%I:%M"),function(a){return a.getMinutes()}],[Fi(":%S"),function(a){return a.getSeconds()}],[Fi(".%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)}}(),Hi=[],Ii=[],Ji=Yg?"left":"bottom",Ki=Yg?uh?"top":"bottom":uh?"right":"left",Li=Yg?Dh?"bottom":"top":Dh?"left":"right",Mi=Yg?"left":"bottom",Ni={main:function(){return"translate("+Jf.left+","+Jf.top+")"},context:function(){return"translate("+Kf.left+","+Kf.top+")"},legend:function(){return"translate("+Lf.left+","+Lf.top+")"},x:function(){return"translate(0,"+(Yg?0:Of)+")"},y:function(){return"translate(0,"+(Yg?Of:0)+")"},y2:function(){return"translate("+(Yg?0:Mf)+","+(Yg?1:0)+")"},subx:function(){return"translate(0,"+(Yg?0:Pf)+")"},arc:function(){return"translate("+Mf/2+","+Of/2+")"}},Oi="right"===Tg,Pi=0,Qi=0,Ri=0,Si=.15,Ti=30,Ui=Yg&&!Zg?0:30,Vi=5;Yf=tf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Wi,Xi=function(){var a=tf.svg.line().x(Yg?function(a){return V(a.id)(a.value)}:zd).y(Yg?zd:function(a){return V(a.id)(a.value)});return Th||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Th?De(b.values):b.values;return ce(b)?(a.interpolate(de(b)?"cardinal":"linear"),Bg[b.id]?Pe(e,fg,V(b.id),Bg[b.id]):a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Yi=function(){var a;return a=Yg?tf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(zd):tf.svg.area().x(zd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=De(b.values);return Yd([b],"area")||Yd([b],"area-spline")?(a.interpolate(de(b)?"cardinal":"linear"),a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Zi=function(){var a=tf.svg.line().x(Yg?function(a){return W(a.id)(a.value)}:Cd).y(Yg?Cd:function(a){return W(a.id)(a.value)});return function(b){var c=De(b.values);return ce(b)?a(c):"M "+ig(c[0].x)+" "+W(b.id)(c[0].value)}}(),$i=function(){};Wi=tf.svg.brush().on("brush",Ye),Wi.update=function(){return cj&&cj.select("."+f.brush).call(this),this},Wi.scale=function(a){return Yg?this.y(a):this.x(a)},Bf&&($i=tf.behavior.zoom().on("zoomstart",function(){$i.altDomain=tf.event.sourceEvent.altKey?fg.orgDomain():null}).on("zoom",Bf?Ze:null),$i.scale=function(a){return Yg?this.y(a):this.x(a)},$i.orgScaleExtent=function(){var a=Cf?Cf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},$i.updateScaleExtent=function(){var a=ac(fg.orgDomain())/ac(gj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var _i,aj,bj,cj,dj,ej,fj,gj,hj,ij={};if(uf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=_i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),uf.defocus(),b(d.classed(f.focused,!0)),b(e),be(uf.data.targets)&&Nb(a,!0),jf(a)},uf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=_i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),kf(a)},uf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=_i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),lf()},uf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),_i.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?mf(a):dj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},uf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),_i.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?nf(a):dj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Si),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},uf.toggle=function(a){Gc(a)?uf.hide(a):uf.show(a)},uf.unzoom=function(){Wi.clear().update(),Xe({withUpdateXDomain:!0})},uf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){ug[b]=a.classes[b]}),"categories"in a&&wi&&(ah=a.categories,lg.categories(ah)),"cacheIds"in a&&bc(a.cacheIds)?void cf(dc(a.cacheIds),a.done):void("unload"in a?ef(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){df(a)}):df(a))},uf.unload=function(a){ef(Dc(a),function(){Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},uf.selected=function(a){return tf.merge(bj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return tf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},uf.select=function(a,b,c){Eg&&bj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=tf.select(this),i="circle"===this.nodeName?xe:Ae,j="circle"===this.nodeName?ye:Be,k=Fg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Gg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},uf.unselect=function(a,b){Eg&&bj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=tf.select(this),g="circle"===this.nodeName?ye:Be,h=Fg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Gg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},uf.toLine=function(a){sf(a,"line")},uf.toSpline=function(a){sf(a,"spline")},uf.toBar=function(a){sf(a,"bar")},uf.toScatter=function(a){sf(a,"scatter")},uf.toArea=function(a){sf(a,"area")},uf.toAreaSpline=function(a){sf(a,"area-spline")},uf.toPie=function(a){sf(a,"pie",{withTransform:!0})},uf.toDonut=function(a){sf(a,"donut",{withTransform:!0})},uf.groups=function(a){return c(a)?vg:(vg=a,Xe(),vg)},uf.xgrids=function(a){return a?(Jh=a,Xe(),Jh):Jh},uf.xgrids.add=function(a){return a?uf.xgrids(Jh.concat(a)):void 0},uf.xgrids.remove=function(a){var b=rf(a);return uf.xgrids(Jh.filter(b)) -},uf.ygrids=function(a){return a?(Lh=a,Xe(),Lh):Lh},uf.ygrids.add=function(a){return a?uf.ygrids(Lh.concat(a)):void 0},uf.ygrids.remove=function(a){var b=rf(a);return uf.ygrids(Lh.filter(b))},uf.regions=function(a){return c(a)?hi:(hi=a,Xe(),hi)},uf.regions.add=function(a){return c(a)?hi:(hi=hi.concat(a),Xe(),hi)},uf.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;_i.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),hi=hi.filter(function(b){return b.classes.indexOf(a)<0})}),hi},uf.data.get=function(a){var b=uf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},uf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},uf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){tg[b]=a[b]}),of(Cc(uf.data.targets),{withTransition:!0}),tg):tg},uf.x=function(a){return arguments.length&&(qc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.xs=function(a){return arguments.length&&(rc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},uf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(qh=+a.y),b(a.y2)&&(zh=+a.y2)):qh=zh=+a,Xe())},uf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(rh=+a.y),b(a.y2)&&(Ah=+a.y2)):rh=Ah=+a,Xe())},uf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&uf.axis.max(a.max),"undefined"!=typeof a.min&&uf.axis.min(a.min))},uf.legend.show=function(a){Sg||(Sg=!0,dj.style("visibility","visible")),mf(Dc(a)),Xe({withLegend:!0})},uf.legend.hide=function(a){nf(Dc(a)),Xe({withLegend:!0}),Sg&&se(a)&&(Sg=!1,dj.style("visibility","hidden"))},uf.resize=function(a){xf=a?a.width:null,yf=a?a.height:null,af({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},uf.destroy=function(){uf.data.targets=void 0,uf.data.xs={},fj.html(""),a.onresize=null},"url"in e.data)tf.xhr(e.data.url,function(a,b){var c,d=tf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=tf.csv.parse(b.response),Qe(c)});else if("rows"in e.data)Qe(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Qe(uc(e.data.columns))}return uf},"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.32"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cPf&&(Pf=0),0>Rf&&(Rf=0),Qf=_g?Mf.left-Wi-Xi:Pf,Sf=_g?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Ri&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){ej.select("line."+f.xgridFocus).attr("x1",_g?0:-10).attr("x2",_g?Pf:-10).attr("y1",_g?-10:Mf.top).attr("y2",_g?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=_g?f.axisX:f.axisY,b=wf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:_g?ah?v("x"):1:!sh||xh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Ri?P()+(Bh&&!_g?v("y2"):a):Bh?Gh||_g?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||ah?"x"===a&&ph?ph:"y"!==a||sh?"y2"!==a||Bh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Yi:Vg&&!Ri?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!_g)}function C(){return A(!_g)}function D(){return z(_g)}function E(){return A(_g)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(ph?ph:0)+80:Rf+8}function H(){return F(!_g)}function I(){return G(!_g)}function J(){return F(_g)}function K(){return G(_g)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(zi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Si=a}function N(a){Ti=a}function O(a){Ui=a}function P(){return Vg?Ri?Ti*(Si+1):Tf:0}function Q(){return Vg?Ri?Uf:Ui*(Si+1):0}function R(){var a,b=!ig;ag=_g?1:0,bg=_g?Rf:Pf,cg=_g?0:Rf,dg=_g?Pf:1,eg=ag,fg=bg,gg=_g?0:Sf,hg=_g?Qf:1,ig=T(ag,bg,b?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,b?void 0:jg.domain()),kg=U(cg,dg,b?void 0:kg.domain()),lg=T(ag,bg,jj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,b?void 0:mg.domain()),ng=U(gg,hg,b?void 0:ng.domain()),a=$(),og=X(ig,Mi,a),rg=X(lg,Pi,a),pg=Y(jg,Ni,yh,Ah),qg=Y(kg,Oi,Hh,Jh),b||(Zi.scale(lg),Ef&&bj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(yi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),zi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c){var d=(zi?Eb():wf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),zi?(d.tickCentered(eh),ve(gh)&&(gh=!1)):d.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},zi&&d.categories(dh),d}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=yi?Ji:zi?Tc:function(a){return 0>a?a.toFixed(0):a};return fh&&("function"==typeof fh?a=fh:yi&&(a=function(a){return a?Ii(fh)(a):""})),a}function _(a){var b;return"y"===a?b=wh:"y2"===a?b=Fh:"x"===a&&(b=rh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?wh=b:"y2"===a?Fh=b:"x"===a&&(rh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",_g?"inner-top":"inner-right")}function hb(){return fb("y",_g?"inner-right":"inner-top")}function ib(){return fb("y2",_g?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!_g,gb())}function rb(){return nb(_g,hb())}function sb(){return nb(_g,ib())}function tb(){return ob(!_g,gb())}function ub(){return ob(_g,hb())}function vb(){return ob(_g,ib())}function wb(){var a=gb();return _g?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":ph?ph-10:"3em"}function xb(){var a=hb();return _g?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return _g?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!_g,gb())}function Ab(){return pb(_g,hb())}function Bb(){return pb(_g,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?30:b}function Db(){ej.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),ej.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),ej.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.length>0)for(g=Sc(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 wf.max(Object.keys(i).map(function(a){return wf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Dh:uh,n="y2"===c?Ch:th,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Eh:vh,r=ud()&&_g;return 0===l.length?"y2"===c?kg.domain():jg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(jg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&zh&&(f=b(zh.top)?zh.top:e,g=b(zh.bottom)?zh.bottom:e),"y2"===c&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return nh?yi?re(nh):nh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return mh?yi?re(mh):mh:wf.max(a,function(a){return wf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return zi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof oh&&we(oh)?(e=b(oh.left)?oh.left:d,f=b(oh.right)?oh.right:d):e=f="number"==typeof oh?oh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=yi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=yi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?jg:kg;return b="y"===a.axis||"y2"===a.axis?_g?Rf:"start"in a?d(a.start):Rf:_g?"end"in a?ig(yi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),xf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=yi?a?a instanceof Date?a:re(a):re(mc(c,d)):Ai&&!zi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ai&&zi&&0===c&&g&&(0===e&&(dh=[]),dh.push(g)),("undefined"==typeof a[b]||xf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&xf.data.targets[0].values[a-1]?xf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(xf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(yi?new Date(h):h);i.push(d)}return yi||(i=i.sort(function(a,b){return a-b})),i}function Lc(a){Ki=Ki.concat(a)}function Mc(a){Ki=Ki.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Li=Li.concat(a)}function Oc(a){Li=Li.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&li&&(hj.html(oi(a,$(),wd(k),Hi)).style("display","block"),d=hj.property("offsetWidth"),e=hj.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(_g?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),hj.style("top",i+"px").style("left",g+"px"))}function Qd(){hj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});li&&(be(xf.data.targets)||ee(xf.data.targets)||ej.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(_g?"y1":"x1",Cd).attr(_g?"y2":"x2",Cd))}function Sd(){ej.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return Xh?Xh:b?2*a.tickOffset()*Yh/b:0}function $d(a,b){Dc(a).forEach(function(a){lj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&fi||je(a)&&_h}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=_g?1:0,e=_g?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Og(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud).attr("stroke",function(){return Hi(b)}).attr("r",1.4*Vh).transition().duration(100).attr("r",Vh)}function Be(a,b,c){Pg(b,a.node()),ej.select("."+f.selectedCircles+ld(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){Og(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Hi(b)).darker(1)})}function Ee(a,b){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return Hi(b)})}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?ej.selectAll("."+f.circles+ld(c)):ej).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Uh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Rh)}function Ke(a){return ej.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=_g?1:0,f=_g?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 _g?(c=he(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.getBoundingClientRect();return _g?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return _g&&(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(ij=wf.select(zf),ij.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ij.html(""),ij.classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),jj=ig.domain(),Zi.scale(lg),Ef&&bj.scale(ig),cj=ij.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),dj=cj.append("defs"),dj.append("clipPath").attr("id",si).append("rect").attr("width",Pf).attr("height",Rf),dj.append("clipPath").attr("id",ti).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.append("clipPath").attr("id",ui).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej=cj.append("g").attr("transform",Qi.main),fj=cj.append("g").attr("transform",Qi.context),gj=cj.append("g").attr("transform",Qi.legend),Sg||fj.style("visibility","hidden"),Vg||(gj.style("visibility","hidden"),Li=Cc(xf.data.targets)),hj=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),ah&&ej.append("g").attr("class",f.axisX).attr("clip-path",wi).attr("transform",Qi.x).append("text").attr("class",f.axisXLabel).attr("transform",_g?"rotate(-90)":"").style("text-anchor",zb),sh&&ej.append("g").attr("class",f.axisY).attr("clip-path",xi).attr("transform",Qi.y).append("text").attr("class",f.axisYLabel).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Ab),Bh&&ej.append("g").attr("class",f.axisY2).attr("transform",Qi.y2).append("text").attr("class",f.axisY2Label).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Bb),d=ej.append("g").attr("clip-path",vi).attr("class",f.grid),Kh&&d.append("g").attr("class",f.xgrids),we(Mh)&&d.append("g").attr("class",f.xgridLines),Sh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Nh&&d.append("g").attr("class",f.ygrids),we(Oh)&&d.append("g").attr("class",f.ygridLines),ej.append("g").attr("clip-path",vi).attr("class",f.regions),ej.append("g").attr("clip-path",vi).attr("class",f.chart),c=ej.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?_g?"ns-resize":"ew-resize":null),ej.select("."+f.chart).append("g").attr("class",f.chartBars),ej.select("."+f.chart).append("g").attr("class",f.chartLines),ej.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Qi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),ej.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&ej.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",_g?"ns-resize":"ew-resize").call(bj).on("dblclick.zoom",null),qh&&Zi.extent("function"!=typeof qh?qh:qh(_b())),fj.append("g").attr("clip-path",vi).attr("class",f.chart),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.append("g").attr("clip-path",vi).attr("class",f.brush).call(Zi).selectAll("rect").attr(_g?"width":"height",_g?Qf:Sf),fj.append("g").attr("class",f.axisX).attr("transform",Qi.subx).attr("clip-path",_g?"":wi),ef(xf.data.targets),_g?ej.select("."+f.axisX).style("opacity",0).call(og):(ej.select("."+f.axisY).style("opacity",0).call(pg),ej.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),pi){if(yi&&"string"==typeof qi){for(qi=re(qi),e=0;e0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(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){ee(xf.data.targets)||Hg&&(Bi=a,ej.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ci=!0,Qg())}function Ze(){ee(xf.data.targets)||Hg&&(ej.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),ej.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ci=!1,Rg())}function $e(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=ej.select("."+f.axisX).style("opacity",W?0:1),g=ej.select("."+f.axisY).style("opacity",W?0:1),h=ej.select("."+f.axisY2).style("opacity",W?0:1),e=fj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Vg&&rf(Cc(xf.data.targets),a,O),zi&&(0===X.length||!H||G)&&ig.domain([0,c.selectAll(".tick").size()]),X.length&&(H&&(ig.domain(wf.extent(_b(X))),jj=ig.domain(),Ef&&bj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),Zi.scale(lg)),G&&(ig.domain(Zi.empty()?jj:Zi.extent()),Ef&&bj.scale(ig).updateScaleExtent())),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),(jh||ih)&&(S=kh?kh:Kc(Jc(X)),og.tickValues(S),rg.tickValues(S)),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G)if(gh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!_g&&lh&&eb(c,O.axisX,lh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),hj.style("display","none"),o(),ej.select("line."+f.xgridFocus).style("visibility","hidden"),Kh){if("year"===Lh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=ej.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",_g?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",_g?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",_g?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",_g?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(_g?"y1":"x1")===(_g?Rf:0)?0:1}),i.exit().remove()}we(Mh)&&(k=ej.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Mh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",_g?"":"rotate(-90)").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",_g?0:Dd).attr("x2",_g?Pf:Dd).attr("y1",_g?Dd:Mf.top).attr("y2",_g?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",_g?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Nh&&(m=ej.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Ph)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",_g?jg:0).attr("x2",_g?jg:Pf).attr("y1",_g?0:jg).attr("y2",_g?Rf:jg),m.exit().remove()),A&&we(Oh)&&(n=ej.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Oh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",_g?"rotate(-90)":"").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",_g?Ed:0).attr("x2",_g?Ed:Pf).attr("y1",_g?0:Ed).attr("y2",_g?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",_g?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=ej.select("."+f.regions).selectAll("rect."+f.region).data(ki),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=ej.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Hi(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=ej.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return _g?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),ej.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",$i).style("opacity",1),ej.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",_i).style("opacity",kj),q=ej.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Rh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),q.exit().remove(),ej.each(function(){Fi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Fi=!1}),ej.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),ej.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Sg&&(null!==wf.event&&"zoom"===wf.event.type&&Zi.extent(ig.orgDomain()).update(),B&&(!_g&&lh&&eb(e,O.axisSubX,lh),Zi.empty()||Zi.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Hi(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1))),ej.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),ej.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),v=ej.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ai&&!zi?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),ej.select("."+f.eventRects).datum(x?x.values:[]),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",_g?0:y).attr("y",_g?y:0).attr("width",_g?Pf:z).attr("height",_g?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){lj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&bj.altDomain?(ig.domain(bj.altDomain),void bj.scale(ig).updateScaleExtent()):(zi&&ig.orgDomain()[0]===jj[0]&&ig.domain([jj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Di=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){cj.attr("width",Tf).attr("height",Uf),cj.select("#"+si).select("rect").attr("width",Pf).attr("height",Rf),cj.select("#"+ti).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),cj.select("#"+ui).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),cj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),ij.style("max-height",Uf+"px")}function df(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=ej.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Hi(a)}),e=ej.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("fill",function(a){return Hi(a)}).style("stroke","none").style("cursor",function(a){return Jg(a)?"pointer":null}),c=ej.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)}),b.append("path").attr("class",dd).style("opacity",function(){return kj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Hi(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Hi(a)}).style("cursor",function(a){return Jg(a)?"pointer":null}),a.forEach(function(a){ej.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=ej.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Hi(a.data)}).style("cursor",function(a){return Jg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Sg&&(n=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Hi(a)}),l=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)})),cj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Ri?j:i,l=Ri?Q():P();return d&&(x=0,D=0,u=0,v=0),Vg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Ri?v:u,void($g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Ri?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=gj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Xg?Xg(a):xf.toggle(a)}).on("mouseover",function(a){Fi||xf.focus(a),"function"==typeof Yg&&Yg(a)}).on("mouseout",function(a){Fi||xf.revert(),"function"==typeof Zg&&Zg(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ri?h:-200).attr("y",Ri?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ri?i:-200).attr("y",Ri?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Hi(a)}).attr("x",Ri?h:-200).attr("y",Ri?-200:j).attr("width",10).attr("height",10),gj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),gj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),gj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Fi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"]),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","selection","enabled"],!1),Ig=h(["data","selection","grouped"],!1),Jg=h(["data","selection","isselectable"],function(){return!0}),Kg=h(["data","selection","multiple"],!0),Lg=h(["data","onclick"],function(){}),Mg=h(["data","onenter"],function(){}),Ng=h(["data","onleave"],function(){}),Og=h(["data","onselected"],function(){}),Pg=h(["data","onunselected"],function(){}),Qg=h(["data","ondragstart"],function(){}),Rg=h(["data","ondragend"],function(){}),Sg=h(["subchart","show"],!1),Tg=h(["subchart","size","height"],60),Ug=h(["color","pattern"],[]),Vg=h(["legend","show"],!0),Wg=h(["legend","position"],"bottom"),Xg=h(["legend","item","onclick"]),Yg=h(["legend","item","onmouseover"]),Zg=h(["legend","item","onmouseout"]),$g=h(["legend","equally"],!1),_g=h(["axis","rotated"],!1),ah=h(["axis","x","show"],!0),bh=h(["axis","x","type"],"indexed"),ch=h(["axis","x","localtime"],!0),dh=h(["axis","x","categories"],[]),eh=h(["axis","x","tick","centered"],!1),fh=h(["axis","x","tick","format"]),gh=h(["axis","x","tick","culling"],{}),hh=h(["axis","x","tick","culling","max"],10),ih=h(["axis","x","tick","count"]),jh=h(["axis","x","tick","fit"],!0),kh=h(["axis","x","tick","values"],null),lh=h(["axis","x","tick","rotate"]),mh=h(["axis","x","max"],null),nh=h(["axis","x","min"],null),oh=h(["axis","x","padding"],{}),ph=h(["axis","x","height"]),qh=h(["axis","x","default"]),rh=h(["axis","x","label"],{}),sh=h(["axis","y","show"],!0),th=h(["axis","y","max"]),uh=h(["axis","y","min"]),vh=h(["axis","y","center"]),wh=h(["axis","y","label"],{}),xh=h(["axis","y","inner"],!1),yh=h(["axis","y","tick","format"]),zh=h(["axis","y","padding"],{}),Ah=h(["axis","y","ticks"],10),Bh=h(["axis","y2","show"],!1),Ch=h(["axis","y2","max"]),Dh=h(["axis","y2","min"]),Eh=h(["axis","y2","center"]),Fh=h(["axis","y2","label"],{}),Gh=h(["axis","y2","inner"],!1),Hh=h(["axis","y2","tick","format"]),Ih=h(["axis","y2","padding"],{}),Jh=h(["axis","y2","ticks"],10),Kh=h(["grid","x","show"],!1),Lh=h(["grid","x","type"],"tick"),Mh=h(["grid","x","lines"],[]),Nh=h(["grid","y","show"],!1),Oh=h(["grid","y","lines"],[]),Ph=h(["grid","y","ticks"],10),Qh=h(["point","show"],!0),Rh=Qh?h(["point","r"],2.5):0,Sh=h(["point","focus","line","enabled"],!0),Th=h(["point","focus","expand","enabled"],!0),Uh=h(["point","focus","expand","r"],Th?4:Rh),Vh=h(["point","focus","select","r"],8),Wh=h(["line","connect_null"],!1),Xh=h(["bar","width"]),Yh=h(["bar","width","ratio"],.6),Zh=h(["pie","label","show"],!0),$h=h(["pie","label","format"]),_h=h(["pie","expand"],!0),ai=h(["pie","onclick"],function(){}),bi=h(["pie","onmouseover"],function(){}),ci=h(["pie","onmouseout"],function(){}),di=h(["donut","label","show"],!0),ei=h(["donut","label","format"]),fi=h(["donut","expand"],!0),gi=h(["donut","title"],""),hi=h(["donut","onclick"],function(){}),ii=h(["donut","onmouseover"],function(){}),ji=h(["donut","onmouseout"],function(){}),ki=h(["regions"],[]),li=h(["tooltip","show"],!0),mi=h(["tooltip","format","title"]),ni=h(["tooltip","format","value"]),oi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=mi?mi:b,l=ni?ni:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),pi=h(["tooltip","init","show"],!1),qi=h(["tooltip","init","x"],0),ri=h(["tooltip","init","position"],{top:"0px",left:"50px"}),si=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ti=si+"-xaxis",ui=si+"-yaxis",vi=i(si),wi=i(ti),xi=i(ui),yi="timeseries"===bh,zi="categorized"===bh,Ai=!yi&&(sg||we(tg)),Bi=null,Ci=!1,Di=!1,Ei=!1,Fi=!1,Gi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Hi=qe(Gg,we(Ug)?Ug:Gi,Fg),Ii=ch?wf.time.format:wf.time.format.utc,Ji=function(){var a=[[Ii("%Y/%-m/%-d"),function(){return!0}],[Ii("%-m/%-d"),function(a){return a.getMonth()}],[Ii("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ii("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ii("%I %p"),function(a){return a.getHours()}],[Ii("%I:%M"),function(a){return a.getMinutes()}],[Ii(":%S"),function(a){return a.getSeconds()}],[Ii(".%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)}}(),Ki=[],Li=[],Mi=_g?"left":"bottom",Ni=_g?xh?"top":"bottom":xh?"right":"left",Oi=_g?Gh?"bottom":"top":Gh?"left":"right",Pi=_g?"left":"bottom",Qi={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(_g?0:Rf)+")"},y:function(){return"translate(0,"+(_g?Rf:0)+")"},y2:function(){return"translate("+(_g?0:Pf)+","+(_g?1:0)+")"},subx:function(){return"translate(0,"+(_g?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Ri="right"===Wg,Si=0,Ti=0,Ui=0,Vi=.15,Wi=30,Xi=_g&&!ah?0:30,Yi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Zi,$i=function(){var a=wf.svg.line().x(_g?function(a){return V(a.id)(a.value)}:Cd).y(_g?Cd:function(a){return V(a.id)(a.value)});return Wh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Wh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),_i=function(){var a;return a=_g?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a=wf.svg.line().x(_g?function(a){return W(a.id)(a.value)}:Fd).y(_g?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),bj=function(){};Zi=wf.svg.brush().on("brush",_e),Zi.update=function(){return fj&&fj.select("."+f.brush).call(this),this},Zi.scale=function(a){return _g?this.y(a):this.x(a)},Ef&&(bj=wf.behavior.zoom().on("zoomstart",function(){bj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),bj.scale=function(a){return _g?this.y(a):this.x(a)},bj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},bj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(jj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var cj,dj,ej,fj,gj,hj,ij,jj,kj,lj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),cj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?pf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),cj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?qf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Vi),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){Zi.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&zi&&(dh=a.categories,og.categories(dh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},xf.selected=function(a){return wf.merge(ej.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Ig||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Jg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Ig||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Jg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0})},xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Mh=a,$e(),Mh):Mh},xf.xgrids.add=function(a){return a?xf.xgrids(Mh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a); +return xf.xgrids(Mh.filter(b))},xf.ygrids=function(a){return a?(Oh=a,$e(),Oh):Oh},xf.ygrids.add=function(a){return a?xf.ygrids(Oh.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Oh.filter(b))},xf.regions=function(a){return c(a)?ki:(ki=a,$e(),ki)},xf.regions.add=function(a){return c(a)?ki:(ki=ki.concat(a),$e(),ki)},xf.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;cj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ki=ki.filter(function(b){return b.classes.indexOf(a)<0})}),ki},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(th=+a.y),b(a.y2)&&(Ch=+a.y2)):th=Ch=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){Vg||(Vg=!0,gj.style("visibility","visible")),pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0}),Vg&&ve(a)&&(Vg=!1,gj.style("visibility","hidden"))},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},ij.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 17f3725c80f9bb7610f0b0bdd868745fcd3b54f6 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Mon, 28 Apr 2014 14:02:05 +0900 Subject: [PATCH 076/178] Fix bug for tooltip position - #166 --- c3.js | 2 +- c3.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/c3.js b/c3.js index 56547fb..b6938e2 100644 --- a/c3.js +++ b/c3.js @@ -456,7 +456,7 @@ } function getSvgLeft() { var leftAxisClass = __axis_rotated ? CLASS.axisX : CLASS.axisY, - leftAxis = d3.select('.' + leftAxisClass).node(), + leftAxis = main.select('.' + leftAxisClass).node(), svgRect = leftAxis ? leftAxis.getBoundingClientRect() : {right: 0}, chartRect = d3.select(__bindto).node().getBoundingClientRect(), svgLeft = svgRect.right - chartRect.left - getCurrentPaddingLeft(); diff --git a/c3.min.js b/c3.min.js index 482a75c..bdf34fa 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.32"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cPf&&(Pf=0),0>Rf&&(Rf=0),Qf=_g?Mf.left-Wi-Xi:Pf,Sf=_g?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Ri&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){ej.select("line."+f.xgridFocus).attr("x1",_g?0:-10).attr("x2",_g?Pf:-10).attr("y1",_g?-10:Mf.top).attr("y2",_g?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=_g?f.axisX:f.axisY,b=wf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:_g?ah?v("x"):1:!sh||xh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Ri?P()+(Bh&&!_g?v("y2"):a):Bh?Gh||_g?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||ah?"x"===a&&ph?ph:"y"!==a||sh?"y2"!==a||Bh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Yi:Vg&&!Ri?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!_g)}function C(){return A(!_g)}function D(){return z(_g)}function E(){return A(_g)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(ph?ph:0)+80:Rf+8}function H(){return F(!_g)}function I(){return G(!_g)}function J(){return F(_g)}function K(){return G(_g)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(zi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Si=a}function N(a){Ti=a}function O(a){Ui=a}function P(){return Vg?Ri?Ti*(Si+1):Tf:0}function Q(){return Vg?Ri?Uf:Ui*(Si+1):0}function R(){var a,b=!ig;ag=_g?1:0,bg=_g?Rf:Pf,cg=_g?0:Rf,dg=_g?Pf:1,eg=ag,fg=bg,gg=_g?0:Sf,hg=_g?Qf:1,ig=T(ag,bg,b?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,b?void 0:jg.domain()),kg=U(cg,dg,b?void 0:kg.domain()),lg=T(ag,bg,jj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,b?void 0:mg.domain()),ng=U(gg,hg,b?void 0:ng.domain()),a=$(),og=X(ig,Mi,a),rg=X(lg,Pi,a),pg=Y(jg,Ni,yh,Ah),qg=Y(kg,Oi,Hh,Jh),b||(Zi.scale(lg),Ef&&bj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(yi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),zi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c){var d=(zi?Eb():wf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),zi?(d.tickCentered(eh),ve(gh)&&(gh=!1)):d.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},zi&&d.categories(dh),d}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=yi?Ji:zi?Tc:function(a){return 0>a?a.toFixed(0):a};return fh&&("function"==typeof fh?a=fh:yi&&(a=function(a){return a?Ii(fh)(a):""})),a}function _(a){var b;return"y"===a?b=wh:"y2"===a?b=Fh:"x"===a&&(b=rh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?wh=b:"y2"===a?Fh=b:"x"===a&&(rh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",_g?"inner-top":"inner-right")}function hb(){return fb("y",_g?"inner-right":"inner-top")}function ib(){return fb("y2",_g?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!_g,gb())}function rb(){return nb(_g,hb())}function sb(){return nb(_g,ib())}function tb(){return ob(!_g,gb())}function ub(){return ob(_g,hb())}function vb(){return ob(_g,ib())}function wb(){var a=gb();return _g?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":ph?ph-10:"3em"}function xb(){var a=hb();return _g?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return _g?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!_g,gb())}function Ab(){return pb(_g,hb())}function Bb(){return pb(_g,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?30:b}function Db(){ej.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),ej.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),ej.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.length>0)for(g=Sc(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 wf.max(Object.keys(i).map(function(a){return wf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Dh:uh,n="y2"===c?Ch:th,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Eh:vh,r=ud()&&_g;return 0===l.length?"y2"===c?kg.domain():jg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(jg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&zh&&(f=b(zh.top)?zh.top:e,g=b(zh.bottom)?zh.bottom:e),"y2"===c&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return nh?yi?re(nh):nh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return mh?yi?re(mh):mh:wf.max(a,function(a){return wf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return zi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof oh&&we(oh)?(e=b(oh.left)?oh.left:d,f=b(oh.right)?oh.right:d):e=f="number"==typeof oh?oh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=yi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=yi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?jg:kg;return b="y"===a.axis||"y2"===a.axis?_g?Rf:"start"in a?d(a.start):Rf:_g?"end"in a?ig(yi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),xf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=yi?a?a instanceof Date?a:re(a):re(mc(c,d)):Ai&&!zi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ai&&zi&&0===c&&g&&(0===e&&(dh=[]),dh.push(g)),("undefined"==typeof a[b]||xf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&xf.data.targets[0].values[a-1]?xf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(xf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(yi?new Date(h):h);i.push(d)}return yi||(i=i.sort(function(a,b){return a-b})),i}function Lc(a){Ki=Ki.concat(a)}function Mc(a){Ki=Ki.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Li=Li.concat(a)}function Oc(a){Li=Li.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&li&&(hj.html(oi(a,$(),wd(k),Hi)).style("display","block"),d=hj.property("offsetWidth"),e=hj.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(_g?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),hj.style("top",i+"px").style("left",g+"px"))}function Qd(){hj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});li&&(be(xf.data.targets)||ee(xf.data.targets)||ej.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(_g?"y1":"x1",Cd).attr(_g?"y2":"x2",Cd))}function Sd(){ej.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return Xh?Xh:b?2*a.tickOffset()*Yh/b:0}function $d(a,b){Dc(a).forEach(function(a){lj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&fi||je(a)&&_h}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=_g?1:0,e=_g?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Og(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud).attr("stroke",function(){return Hi(b)}).attr("r",1.4*Vh).transition().duration(100).attr("r",Vh)}function Be(a,b,c){Pg(b,a.node()),ej.select("."+f.selectedCircles+ld(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){Og(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Hi(b)).darker(1)})}function Ee(a,b){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return Hi(b)})}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?ej.selectAll("."+f.circles+ld(c)):ej).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Uh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Rh)}function Ke(a){return ej.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=_g?1:0,f=_g?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 _g?(c=he(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.getBoundingClientRect();return _g?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return _g&&(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(ij=wf.select(zf),ij.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ij.html(""),ij.classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),jj=ig.domain(),Zi.scale(lg),Ef&&bj.scale(ig),cj=ij.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),dj=cj.append("defs"),dj.append("clipPath").attr("id",si).append("rect").attr("width",Pf).attr("height",Rf),dj.append("clipPath").attr("id",ti).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.append("clipPath").attr("id",ui).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej=cj.append("g").attr("transform",Qi.main),fj=cj.append("g").attr("transform",Qi.context),gj=cj.append("g").attr("transform",Qi.legend),Sg||fj.style("visibility","hidden"),Vg||(gj.style("visibility","hidden"),Li=Cc(xf.data.targets)),hj=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),ah&&ej.append("g").attr("class",f.axisX).attr("clip-path",wi).attr("transform",Qi.x).append("text").attr("class",f.axisXLabel).attr("transform",_g?"rotate(-90)":"").style("text-anchor",zb),sh&&ej.append("g").attr("class",f.axisY).attr("clip-path",xi).attr("transform",Qi.y).append("text").attr("class",f.axisYLabel).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Ab),Bh&&ej.append("g").attr("class",f.axisY2).attr("transform",Qi.y2).append("text").attr("class",f.axisY2Label).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Bb),d=ej.append("g").attr("clip-path",vi).attr("class",f.grid),Kh&&d.append("g").attr("class",f.xgrids),we(Mh)&&d.append("g").attr("class",f.xgridLines),Sh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Nh&&d.append("g").attr("class",f.ygrids),we(Oh)&&d.append("g").attr("class",f.ygridLines),ej.append("g").attr("clip-path",vi).attr("class",f.regions),ej.append("g").attr("clip-path",vi).attr("class",f.chart),c=ej.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?_g?"ns-resize":"ew-resize":null),ej.select("."+f.chart).append("g").attr("class",f.chartBars),ej.select("."+f.chart).append("g").attr("class",f.chartLines),ej.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Qi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),ej.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&ej.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",_g?"ns-resize":"ew-resize").call(bj).on("dblclick.zoom",null),qh&&Zi.extent("function"!=typeof qh?qh:qh(_b())),fj.append("g").attr("clip-path",vi).attr("class",f.chart),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.append("g").attr("clip-path",vi).attr("class",f.brush).call(Zi).selectAll("rect").attr(_g?"width":"height",_g?Qf:Sf),fj.append("g").attr("class",f.axisX).attr("transform",Qi.subx).attr("clip-path",_g?"":wi),ef(xf.data.targets),_g?ej.select("."+f.axisX).style("opacity",0).call(og):(ej.select("."+f.axisY).style("opacity",0).call(pg),ej.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),pi){if(yi&&"string"==typeof qi){for(qi=re(qi),e=0;ePf&&(Pf=0),0>Rf&&(Rf=0),Qf=_g?Mf.left-Wi-Xi:Pf,Sf=_g?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Ri&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){ej.select("line."+f.xgridFocus).attr("x1",_g?0:-10).attr("x2",_g?Pf:-10).attr("y1",_g?-10:Mf.top).attr("y2",_g?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=_g?f.axisX:f.axisY,b=ej.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:_g?ah?v("x"):1:!sh||xh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Ri?P()+(Bh&&!_g?v("y2"):a):Bh?Gh||_g?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||ah?"x"===a&&ph?ph:"y"!==a||sh?"y2"!==a||Bh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Yi:Vg&&!Ri?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!_g)}function C(){return A(!_g)}function D(){return z(_g)}function E(){return A(_g)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(ph?ph:0)+80:Rf+8}function H(){return F(!_g)}function I(){return G(!_g)}function J(){return F(_g)}function K(){return G(_g)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(zi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Si=a}function N(a){Ti=a}function O(a){Ui=a}function P(){return Vg?Ri?Ti*(Si+1):Tf:0}function Q(){return Vg?Ri?Uf:Ui*(Si+1):0}function R(){var a,b=!ig;ag=_g?1:0,bg=_g?Rf:Pf,cg=_g?0:Rf,dg=_g?Pf:1,eg=ag,fg=bg,gg=_g?0:Sf,hg=_g?Qf:1,ig=T(ag,bg,b?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,b?void 0:jg.domain()),kg=U(cg,dg,b?void 0:kg.domain()),lg=T(ag,bg,jj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,b?void 0:mg.domain()),ng=U(gg,hg,b?void 0:ng.domain()),a=$(),og=X(ig,Mi,a),rg=X(lg,Pi,a),pg=Y(jg,Ni,yh,Ah),qg=Y(kg,Oi,Hh,Jh),b||(Zi.scale(lg),Ef&&bj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(yi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),zi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c){var d=(zi?Eb():wf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),zi?(d.tickCentered(eh),ve(gh)&&(gh=!1)):d.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},zi&&d.categories(dh),d}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=yi?Ji:zi?Tc:function(a){return 0>a?a.toFixed(0):a};return fh&&("function"==typeof fh?a=fh:yi&&(a=function(a){return a?Ii(fh)(a):""})),a}function _(a){var b;return"y"===a?b=wh:"y2"===a?b=Fh:"x"===a&&(b=rh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?wh=b:"y2"===a?Fh=b:"x"===a&&(rh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",_g?"inner-top":"inner-right")}function hb(){return fb("y",_g?"inner-right":"inner-top")}function ib(){return fb("y2",_g?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!_g,gb())}function rb(){return nb(_g,hb())}function sb(){return nb(_g,ib())}function tb(){return ob(!_g,gb())}function ub(){return ob(_g,hb())}function vb(){return ob(_g,ib())}function wb(){var a=gb();return _g?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":ph?ph-10:"3em"}function xb(){var a=hb();return _g?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return _g?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!_g,gb())}function Ab(){return pb(_g,hb())}function Bb(){return pb(_g,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?30:b}function Db(){ej.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),ej.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),ej.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.length>0)for(g=Sc(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 wf.max(Object.keys(i).map(function(a){return wf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Dh:uh,n="y2"===c?Ch:th,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Eh:vh,r=ud()&&_g;return 0===l.length?"y2"===c?kg.domain():jg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(jg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&zh&&(f=b(zh.top)?zh.top:e,g=b(zh.bottom)?zh.bottom:e),"y2"===c&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return nh?yi?re(nh):nh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return mh?yi?re(mh):mh:wf.max(a,function(a){return wf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return zi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof oh&&we(oh)?(e=b(oh.left)?oh.left:d,f=b(oh.right)?oh.right:d):e=f="number"==typeof oh?oh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=yi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=yi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?jg:kg;return b="y"===a.axis||"y2"===a.axis?_g?Rf:"start"in a?d(a.start):Rf:_g?"end"in a?ig(yi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),xf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=yi?a?a instanceof Date?a:re(a):re(mc(c,d)):Ai&&!zi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ai&&zi&&0===c&&g&&(0===e&&(dh=[]),dh.push(g)),("undefined"==typeof a[b]||xf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&xf.data.targets[0].values[a-1]?xf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(xf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(yi?new Date(h):h);i.push(d)}return yi||(i=i.sort(function(a,b){return a-b})),i}function Lc(a){Ki=Ki.concat(a)}function Mc(a){Ki=Ki.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Li=Li.concat(a)}function Oc(a){Li=Li.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&li&&(hj.html(oi(a,$(),wd(k),Hi)).style("display","block"),d=hj.property("offsetWidth"),e=hj.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(_g?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),hj.style("top",i+"px").style("left",g+"px"))}function Qd(){hj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});li&&(be(xf.data.targets)||ee(xf.data.targets)||ej.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(_g?"y1":"x1",Cd).attr(_g?"y2":"x2",Cd))}function Sd(){ej.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return Xh?Xh:b?2*a.tickOffset()*Yh/b:0}function $d(a,b){Dc(a).forEach(function(a){lj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&fi||je(a)&&_h}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=_g?1:0,e=_g?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Og(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud).attr("stroke",function(){return Hi(b)}).attr("r",1.4*Vh).transition().duration(100).attr("r",Vh)}function Be(a,b,c){Pg(b,a.node()),ej.select("."+f.selectedCircles+ld(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){Og(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Hi(b)).darker(1)})}function Ee(a,b){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return Hi(b)})}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?ej.selectAll("."+f.circles+ld(c)):ej).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Uh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Rh)}function Ke(a){return ej.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=_g?1:0,f=_g?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 _g?(c=he(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.getBoundingClientRect();return _g?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return _g&&(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(ij=wf.select(zf),ij.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ij.html(""),ij.classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),jj=ig.domain(),Zi.scale(lg),Ef&&bj.scale(ig),cj=ij.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),dj=cj.append("defs"),dj.append("clipPath").attr("id",si).append("rect").attr("width",Pf).attr("height",Rf),dj.append("clipPath").attr("id",ti).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.append("clipPath").attr("id",ui).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej=cj.append("g").attr("transform",Qi.main),fj=cj.append("g").attr("transform",Qi.context),gj=cj.append("g").attr("transform",Qi.legend),Sg||fj.style("visibility","hidden"),Vg||(gj.style("visibility","hidden"),Li=Cc(xf.data.targets)),hj=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),ah&&ej.append("g").attr("class",f.axisX).attr("clip-path",wi).attr("transform",Qi.x).append("text").attr("class",f.axisXLabel).attr("transform",_g?"rotate(-90)":"").style("text-anchor",zb),sh&&ej.append("g").attr("class",f.axisY).attr("clip-path",xi).attr("transform",Qi.y).append("text").attr("class",f.axisYLabel).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Ab),Bh&&ej.append("g").attr("class",f.axisY2).attr("transform",Qi.y2).append("text").attr("class",f.axisY2Label).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Bb),d=ej.append("g").attr("clip-path",vi).attr("class",f.grid),Kh&&d.append("g").attr("class",f.xgrids),we(Mh)&&d.append("g").attr("class",f.xgridLines),Sh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Nh&&d.append("g").attr("class",f.ygrids),we(Oh)&&d.append("g").attr("class",f.ygridLines),ej.append("g").attr("clip-path",vi).attr("class",f.regions),ej.append("g").attr("clip-path",vi).attr("class",f.chart),c=ej.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?_g?"ns-resize":"ew-resize":null),ej.select("."+f.chart).append("g").attr("class",f.chartBars),ej.select("."+f.chart).append("g").attr("class",f.chartLines),ej.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Qi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),ej.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&ej.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",_g?"ns-resize":"ew-resize").call(bj).on("dblclick.zoom",null),qh&&Zi.extent("function"!=typeof qh?qh:qh(_b())),fj.append("g").attr("clip-path",vi).attr("class",f.chart),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.append("g").attr("clip-path",vi).attr("class",f.brush).call(Zi).selectAll("rect").attr(_g?"width":"height",_g?Qf:Sf),fj.append("g").attr("class",f.axisX).attr("transform",Qi.subx).attr("clip-path",_g?"":wi),ef(xf.data.targets),_g?ej.select("."+f.axisX).style("opacity",0).call(og):(ej.select("."+f.axisY).style("opacity",0).call(pg),ej.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),pi){if(yi&&"string"==typeof qi){for(qi=re(qi),e=0;e0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(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){ee(xf.data.targets)||Hg&&(Bi=a,ej.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ci=!0,Qg())}function Ze(){ee(xf.data.targets)||Hg&&(ej.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),ej.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ci=!1,Rg())}function $e(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=ej.select("."+f.axisX).style("opacity",W?0:1),g=ej.select("."+f.axisY).style("opacity",W?0:1),h=ej.select("."+f.axisY2).style("opacity",W?0:1),e=fj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Vg&&rf(Cc(xf.data.targets),a,O),zi&&(0===X.length||!H||G)&&ig.domain([0,c.selectAll(".tick").size()]),X.length&&(H&&(ig.domain(wf.extent(_b(X))),jj=ig.domain(),Ef&&bj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),Zi.scale(lg)),G&&(ig.domain(Zi.empty()?jj:Zi.extent()),Ef&&bj.scale(ig).updateScaleExtent())),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),(jh||ih)&&(S=kh?kh:Kc(Jc(X)),og.tickValues(S),rg.tickValues(S)),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G)if(gh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!_g&&lh&&eb(c,O.axisX,lh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),hj.style("display","none"),o(),ej.select("line."+f.xgridFocus).style("visibility","hidden"),Kh){if("year"===Lh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=ej.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",_g?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",_g?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",_g?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",_g?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(_g?"y1":"x1")===(_g?Rf:0)?0:1}),i.exit().remove()}we(Mh)&&(k=ej.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Mh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",_g?"":"rotate(-90)").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",_g?0:Dd).attr("x2",_g?Pf:Dd).attr("y1",_g?Dd:Mf.top).attr("y2",_g?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",_g?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Nh&&(m=ej.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Ph)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",_g?jg:0).attr("x2",_g?jg:Pf).attr("y1",_g?0:jg).attr("y2",_g?Rf:jg),m.exit().remove()),A&&we(Oh)&&(n=ej.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Oh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",_g?"rotate(-90)":"").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",_g?Ed:0).attr("x2",_g?Ed:Pf).attr("y1",_g?0:Ed).attr("y2",_g?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",_g?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=ej.select("."+f.regions).selectAll("rect."+f.region).data(ki),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=ej.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Hi(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=ej.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return _g?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),ej.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",$i).style("opacity",1),ej.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",_i).style("opacity",kj),q=ej.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Rh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),q.exit().remove(),ej.each(function(){Fi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Fi=!1}),ej.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),ej.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Sg&&(null!==wf.event&&"zoom"===wf.event.type&&Zi.extent(ig.orgDomain()).update(),B&&(!_g&&lh&&eb(e,O.axisSubX,lh),Zi.empty()||Zi.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Hi(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1))),ej.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),ej.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),v=ej.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ai&&!zi?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),ej.select("."+f.eventRects).datum(x?x.values:[]),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",_g?0:y).attr("y",_g?y:0).attr("width",_g?Pf:z).attr("height",_g?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){lj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&bj.altDomain?(ig.domain(bj.altDomain),void bj.scale(ig).updateScaleExtent()):(zi&&ig.orgDomain()[0]===jj[0]&&ig.domain([jj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Di=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){cj.attr("width",Tf).attr("height",Uf),cj.select("#"+si).select("rect").attr("width",Pf).attr("height",Rf),cj.select("#"+ti).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),cj.select("#"+ui).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),cj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),ij.style("max-height",Uf+"px")}function df(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=ej.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Hi(a)}),e=ej.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("fill",function(a){return Hi(a)}).style("stroke","none").style("cursor",function(a){return Jg(a)?"pointer":null}),c=ej.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)}),b.append("path").attr("class",dd).style("opacity",function(){return kj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Hi(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Hi(a)}).style("cursor",function(a){return Jg(a)?"pointer":null}),a.forEach(function(a){ej.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=ej.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Hi(a.data)}).style("cursor",function(a){return Jg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Sg&&(n=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Hi(a)}),l=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)})),cj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Ri?j:i,l=Ri?Q():P();return d&&(x=0,D=0,u=0,v=0),Vg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Ri?v:u,void($g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Ri?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=gj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Xg?Xg(a):xf.toggle(a)}).on("mouseover",function(a){Fi||xf.focus(a),"function"==typeof Yg&&Yg(a)}).on("mouseout",function(a){Fi||xf.revert(),"function"==typeof Zg&&Zg(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ri?h:-200).attr("y",Ri?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ri?i:-200).attr("y",Ri?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Hi(a)}).attr("x",Ri?h:-200).attr("y",Ri?-200:j).attr("width",10).attr("height",10),gj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),gj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),gj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Fi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"]),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","selection","enabled"],!1),Ig=h(["data","selection","grouped"],!1),Jg=h(["data","selection","isselectable"],function(){return!0}),Kg=h(["data","selection","multiple"],!0),Lg=h(["data","onclick"],function(){}),Mg=h(["data","onenter"],function(){}),Ng=h(["data","onleave"],function(){}),Og=h(["data","onselected"],function(){}),Pg=h(["data","onunselected"],function(){}),Qg=h(["data","ondragstart"],function(){}),Rg=h(["data","ondragend"],function(){}),Sg=h(["subchart","show"],!1),Tg=h(["subchart","size","height"],60),Ug=h(["color","pattern"],[]),Vg=h(["legend","show"],!0),Wg=h(["legend","position"],"bottom"),Xg=h(["legend","item","onclick"]),Yg=h(["legend","item","onmouseover"]),Zg=h(["legend","item","onmouseout"]),$g=h(["legend","equally"],!1),_g=h(["axis","rotated"],!1),ah=h(["axis","x","show"],!0),bh=h(["axis","x","type"],"indexed"),ch=h(["axis","x","localtime"],!0),dh=h(["axis","x","categories"],[]),eh=h(["axis","x","tick","centered"],!1),fh=h(["axis","x","tick","format"]),gh=h(["axis","x","tick","culling"],{}),hh=h(["axis","x","tick","culling","max"],10),ih=h(["axis","x","tick","count"]),jh=h(["axis","x","tick","fit"],!0),kh=h(["axis","x","tick","values"],null),lh=h(["axis","x","tick","rotate"]),mh=h(["axis","x","max"],null),nh=h(["axis","x","min"],null),oh=h(["axis","x","padding"],{}),ph=h(["axis","x","height"]),qh=h(["axis","x","default"]),rh=h(["axis","x","label"],{}),sh=h(["axis","y","show"],!0),th=h(["axis","y","max"]),uh=h(["axis","y","min"]),vh=h(["axis","y","center"]),wh=h(["axis","y","label"],{}),xh=h(["axis","y","inner"],!1),yh=h(["axis","y","tick","format"]),zh=h(["axis","y","padding"],{}),Ah=h(["axis","y","ticks"],10),Bh=h(["axis","y2","show"],!1),Ch=h(["axis","y2","max"]),Dh=h(["axis","y2","min"]),Eh=h(["axis","y2","center"]),Fh=h(["axis","y2","label"],{}),Gh=h(["axis","y2","inner"],!1),Hh=h(["axis","y2","tick","format"]),Ih=h(["axis","y2","padding"],{}),Jh=h(["axis","y2","ticks"],10),Kh=h(["grid","x","show"],!1),Lh=h(["grid","x","type"],"tick"),Mh=h(["grid","x","lines"],[]),Nh=h(["grid","y","show"],!1),Oh=h(["grid","y","lines"],[]),Ph=h(["grid","y","ticks"],10),Qh=h(["point","show"],!0),Rh=Qh?h(["point","r"],2.5):0,Sh=h(["point","focus","line","enabled"],!0),Th=h(["point","focus","expand","enabled"],!0),Uh=h(["point","focus","expand","r"],Th?4:Rh),Vh=h(["point","focus","select","r"],8),Wh=h(["line","connect_null"],!1),Xh=h(["bar","width"]),Yh=h(["bar","width","ratio"],.6),Zh=h(["pie","label","show"],!0),$h=h(["pie","label","format"]),_h=h(["pie","expand"],!0),ai=h(["pie","onclick"],function(){}),bi=h(["pie","onmouseover"],function(){}),ci=h(["pie","onmouseout"],function(){}),di=h(["donut","label","show"],!0),ei=h(["donut","label","format"]),fi=h(["donut","expand"],!0),gi=h(["donut","title"],""),hi=h(["donut","onclick"],function(){}),ii=h(["donut","onmouseover"],function(){}),ji=h(["donut","onmouseout"],function(){}),ki=h(["regions"],[]),li=h(["tooltip","show"],!0),mi=h(["tooltip","format","title"]),ni=h(["tooltip","format","value"]),oi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=mi?mi:b,l=ni?ni:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),pi=h(["tooltip","init","show"],!1),qi=h(["tooltip","init","x"],0),ri=h(["tooltip","init","position"],{top:"0px",left:"50px"}),si=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ti=si+"-xaxis",ui=si+"-yaxis",vi=i(si),wi=i(ti),xi=i(ui),yi="timeseries"===bh,zi="categorized"===bh,Ai=!yi&&(sg||we(tg)),Bi=null,Ci=!1,Di=!1,Ei=!1,Fi=!1,Gi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Hi=qe(Gg,we(Ug)?Ug:Gi,Fg),Ii=ch?wf.time.format:wf.time.format.utc,Ji=function(){var a=[[Ii("%Y/%-m/%-d"),function(){return!0}],[Ii("%-m/%-d"),function(a){return a.getMonth()}],[Ii("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ii("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ii("%I %p"),function(a){return a.getHours()}],[Ii("%I:%M"),function(a){return a.getMinutes()}],[Ii(":%S"),function(a){return a.getSeconds()}],[Ii(".%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)}}(),Ki=[],Li=[],Mi=_g?"left":"bottom",Ni=_g?xh?"top":"bottom":xh?"right":"left",Oi=_g?Gh?"bottom":"top":Gh?"left":"right",Pi=_g?"left":"bottom",Qi={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(_g?0:Rf)+")"},y:function(){return"translate(0,"+(_g?Rf:0)+")"},y2:function(){return"translate("+(_g?0:Pf)+","+(_g?1:0)+")"},subx:function(){return"translate(0,"+(_g?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Ri="right"===Wg,Si=0,Ti=0,Ui=0,Vi=.15,Wi=30,Xi=_g&&!ah?0:30,Yi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Zi,$i=function(){var a=wf.svg.line().x(_g?function(a){return V(a.id)(a.value)}:Cd).y(_g?Cd:function(a){return V(a.id)(a.value)});return Wh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Wh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),_i=function(){var a;return a=_g?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a=wf.svg.line().x(_g?function(a){return W(a.id)(a.value)}:Fd).y(_g?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),bj=function(){};Zi=wf.svg.brush().on("brush",_e),Zi.update=function(){return fj&&fj.select("."+f.brush).call(this),this},Zi.scale=function(a){return _g?this.y(a):this.x(a)},Ef&&(bj=wf.behavior.zoom().on("zoomstart",function(){bj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),bj.scale=function(a){return _g?this.y(a):this.x(a)},bj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},bj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(jj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var cj,dj,ej,fj,gj,hj,ij,jj,kj,lj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),cj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?pf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),cj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?qf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Vi),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){Zi.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&zi&&(dh=a.categories,og.categories(dh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},xf.selected=function(a){return wf.merge(ej.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Ig||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Jg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Ig||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Jg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0})},xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Mh=a,$e(),Mh):Mh},xf.xgrids.add=function(a){return a?xf.xgrids(Mh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a); return xf.xgrids(Mh.filter(b))},xf.ygrids=function(a){return a?(Oh=a,$e(),Oh):Oh},xf.ygrids.add=function(a){return a?xf.ygrids(Oh.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Oh.filter(b))},xf.regions=function(a){return c(a)?ki:(ki=a,$e(),ki)},xf.regions.add=function(a){return c(a)?ki:(ki=ki.concat(a),$e(),ki)},xf.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;cj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ki=ki.filter(function(b){return b.classes.indexOf(a)<0})}),ki},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(th=+a.y),b(a.y2)&&(Ch=+a.y2)):th=Ch=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){Vg||(Vg=!0,gj.style("visibility","visible")),pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0}),Vg&&ve(a)&&(Vg=!1,gj.style("visibility","hidden"))},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},ij.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 40b1b76a4a43f1db6402f85fc2e5f4e997ca2893 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Mon, 28 Apr 2014 15:36:49 +0900 Subject: [PATCH 077/178] Do not hide ticks when no data shown - #151 --- c3.js | 4 ++-- c3.min.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/c3.js b/c3.js index b6938e2..f74812c 100644 --- a/c3.js +++ b/c3.js @@ -3175,7 +3175,7 @@ y2.domain(getYDomain(targetsToShow, 'y2')); // update axis tick values according to options - if (__axis_x_tick_fit || __axis_x_tick_count) { + if ((__axis_x_tick_fit || __axis_x_tick_count) && targetsToShow.length) { tickValues = __axis_x_tick_values ? __axis_x_tick_values : generateTickValues(mapTargetsToUniqueXs(targetsToShow)); xAxis.tickValues(tickValues); subXAxis.tickValues(tickValues); @@ -3188,7 +3188,7 @@ transitions.axisSubX.call(subXAxis); // show/hide if manual culling needed - if (withUpdateXDomain) { + if (withUpdateXDomain && targetsToShow.length) { if (__axis_x_tick_culling && tickValues) { for (i = 1; i < tickValues.length; i++) { if (tickValues.length / i < __axis_x_tick_culling_max) { diff --git a/c3.min.js b/c3.min.js index bdf34fa..9d9e28d 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ !function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.32"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cPf&&(Pf=0),0>Rf&&(Rf=0),Qf=_g?Mf.left-Wi-Xi:Pf,Sf=_g?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Ri&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){ej.select("line."+f.xgridFocus).attr("x1",_g?0:-10).attr("x2",_g?Pf:-10).attr("y1",_g?-10:Mf.top).attr("y2",_g?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=_g?f.axisX:f.axisY,b=ej.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:_g?ah?v("x"):1:!sh||xh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Ri?P()+(Bh&&!_g?v("y2"):a):Bh?Gh||_g?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||ah?"x"===a&&ph?ph:"y"!==a||sh?"y2"!==a||Bh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Yi:Vg&&!Ri?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!_g)}function C(){return A(!_g)}function D(){return z(_g)}function E(){return A(_g)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(ph?ph:0)+80:Rf+8}function H(){return F(!_g)}function I(){return G(!_g)}function J(){return F(_g)}function K(){return G(_g)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(zi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Si=a}function N(a){Ti=a}function O(a){Ui=a}function P(){return Vg?Ri?Ti*(Si+1):Tf:0}function Q(){return Vg?Ri?Uf:Ui*(Si+1):0}function R(){var a,b=!ig;ag=_g?1:0,bg=_g?Rf:Pf,cg=_g?0:Rf,dg=_g?Pf:1,eg=ag,fg=bg,gg=_g?0:Sf,hg=_g?Qf:1,ig=T(ag,bg,b?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,b?void 0:jg.domain()),kg=U(cg,dg,b?void 0:kg.domain()),lg=T(ag,bg,jj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,b?void 0:mg.domain()),ng=U(gg,hg,b?void 0:ng.domain()),a=$(),og=X(ig,Mi,a),rg=X(lg,Pi,a),pg=Y(jg,Ni,yh,Ah),qg=Y(kg,Oi,Hh,Jh),b||(Zi.scale(lg),Ef&&bj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(yi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),zi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c){var d=(zi?Eb():wf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),zi?(d.tickCentered(eh),ve(gh)&&(gh=!1)):d.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},zi&&d.categories(dh),d}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=yi?Ji:zi?Tc:function(a){return 0>a?a.toFixed(0):a};return fh&&("function"==typeof fh?a=fh:yi&&(a=function(a){return a?Ii(fh)(a):""})),a}function _(a){var b;return"y"===a?b=wh:"y2"===a?b=Fh:"x"===a&&(b=rh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?wh=b:"y2"===a?Fh=b:"x"===a&&(rh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",_g?"inner-top":"inner-right")}function hb(){return fb("y",_g?"inner-right":"inner-top")}function ib(){return fb("y2",_g?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!_g,gb())}function rb(){return nb(_g,hb())}function sb(){return nb(_g,ib())}function tb(){return ob(!_g,gb())}function ub(){return ob(_g,hb())}function vb(){return ob(_g,ib())}function wb(){var a=gb();return _g?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":ph?ph-10:"3em"}function xb(){var a=hb();return _g?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return _g?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!_g,gb())}function Ab(){return pb(_g,hb())}function Bb(){return pb(_g,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?30:b}function Db(){ej.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),ej.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),ej.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.length>0)for(g=Sc(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 wf.max(Object.keys(i).map(function(a){return wf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Dh:uh,n="y2"===c?Ch:th,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Eh:vh,r=ud()&&_g;return 0===l.length?"y2"===c?kg.domain():jg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(jg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&zh&&(f=b(zh.top)?zh.top:e,g=b(zh.bottom)?zh.bottom:e),"y2"===c&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return nh?yi?re(nh):nh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return mh?yi?re(mh):mh:wf.max(a,function(a){return wf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return zi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof oh&&we(oh)?(e=b(oh.left)?oh.left:d,f=b(oh.right)?oh.right:d):e=f="number"==typeof oh?oh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=yi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=yi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?jg:kg;return b="y"===a.axis||"y2"===a.axis?_g?Rf:"start"in a?d(a.start):Rf:_g?"end"in a?ig(yi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),xf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=yi?a?a instanceof Date?a:re(a):re(mc(c,d)):Ai&&!zi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ai&&zi&&0===c&&g&&(0===e&&(dh=[]),dh.push(g)),("undefined"==typeof a[b]||xf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&xf.data.targets[0].values[a-1]?xf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(xf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(yi?new Date(h):h);i.push(d)}return yi||(i=i.sort(function(a,b){return a-b})),i}function Lc(a){Ki=Ki.concat(a)}function Mc(a){Ki=Ki.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Li=Li.concat(a)}function Oc(a){Li=Li.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&li&&(hj.html(oi(a,$(),wd(k),Hi)).style("display","block"),d=hj.property("offsetWidth"),e=hj.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(_g?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),hj.style("top",i+"px").style("left",g+"px"))}function Qd(){hj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});li&&(be(xf.data.targets)||ee(xf.data.targets)||ej.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(_g?"y1":"x1",Cd).attr(_g?"y2":"x2",Cd))}function Sd(){ej.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return Xh?Xh:b?2*a.tickOffset()*Yh/b:0}function $d(a,b){Dc(a).forEach(function(a){lj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&fi||je(a)&&_h}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=_g?1:0,e=_g?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Og(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud).attr("stroke",function(){return Hi(b)}).attr("r",1.4*Vh).transition().duration(100).attr("r",Vh)}function Be(a,b,c){Pg(b,a.node()),ej.select("."+f.selectedCircles+ld(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){Og(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Hi(b)).darker(1)})}function Ee(a,b){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return Hi(b)})}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?ej.selectAll("."+f.circles+ld(c)):ej).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Uh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Rh)}function Ke(a){return ej.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=_g?1:0,f=_g?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 _g?(c=he(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.getBoundingClientRect();return _g?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return _g&&(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(ij=wf.select(zf),ij.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ij.html(""),ij.classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),jj=ig.domain(),Zi.scale(lg),Ef&&bj.scale(ig),cj=ij.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),dj=cj.append("defs"),dj.append("clipPath").attr("id",si).append("rect").attr("width",Pf).attr("height",Rf),dj.append("clipPath").attr("id",ti).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.append("clipPath").attr("id",ui).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej=cj.append("g").attr("transform",Qi.main),fj=cj.append("g").attr("transform",Qi.context),gj=cj.append("g").attr("transform",Qi.legend),Sg||fj.style("visibility","hidden"),Vg||(gj.style("visibility","hidden"),Li=Cc(xf.data.targets)),hj=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),ah&&ej.append("g").attr("class",f.axisX).attr("clip-path",wi).attr("transform",Qi.x).append("text").attr("class",f.axisXLabel).attr("transform",_g?"rotate(-90)":"").style("text-anchor",zb),sh&&ej.append("g").attr("class",f.axisY).attr("clip-path",xi).attr("transform",Qi.y).append("text").attr("class",f.axisYLabel).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Ab),Bh&&ej.append("g").attr("class",f.axisY2).attr("transform",Qi.y2).append("text").attr("class",f.axisY2Label).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Bb),d=ej.append("g").attr("clip-path",vi).attr("class",f.grid),Kh&&d.append("g").attr("class",f.xgrids),we(Mh)&&d.append("g").attr("class",f.xgridLines),Sh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Nh&&d.append("g").attr("class",f.ygrids),we(Oh)&&d.append("g").attr("class",f.ygridLines),ej.append("g").attr("clip-path",vi).attr("class",f.regions),ej.append("g").attr("clip-path",vi).attr("class",f.chart),c=ej.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?_g?"ns-resize":"ew-resize":null),ej.select("."+f.chart).append("g").attr("class",f.chartBars),ej.select("."+f.chart).append("g").attr("class",f.chartLines),ej.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Qi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),ej.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&ej.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",_g?"ns-resize":"ew-resize").call(bj).on("dblclick.zoom",null),qh&&Zi.extent("function"!=typeof qh?qh:qh(_b())),fj.append("g").attr("clip-path",vi).attr("class",f.chart),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.append("g").attr("clip-path",vi).attr("class",f.brush).call(Zi).selectAll("rect").attr(_g?"width":"height",_g?Qf:Sf),fj.append("g").attr("class",f.axisX).attr("transform",Qi.subx).attr("clip-path",_g?"":wi),ef(xf.data.targets),_g?ej.select("."+f.axisX).style("opacity",0).call(og):(ej.select("."+f.axisY).style("opacity",0).call(pg),ej.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),pi){if(yi&&"string"==typeof qi){for(qi=re(qi),e=0;e0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(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){ee(xf.data.targets)||Hg&&(Bi=a,ej.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ci=!0,Qg())}function Ze(){ee(xf.data.targets)||Hg&&(ej.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),ej.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ci=!1,Rg())}function $e(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=ej.select("."+f.axisX).style("opacity",W?0:1),g=ej.select("."+f.axisY).style("opacity",W?0:1),h=ej.select("."+f.axisY2).style("opacity",W?0:1),e=fj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Vg&&rf(Cc(xf.data.targets),a,O),zi&&(0===X.length||!H||G)&&ig.domain([0,c.selectAll(".tick").size()]),X.length&&(H&&(ig.domain(wf.extent(_b(X))),jj=ig.domain(),Ef&&bj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),Zi.scale(lg)),G&&(ig.domain(Zi.empty()?jj:Zi.extent()),Ef&&bj.scale(ig).updateScaleExtent())),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),(jh||ih)&&(S=kh?kh:Kc(Jc(X)),og.tickValues(S),rg.tickValues(S)),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G)if(gh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!_g&&lh&&eb(c,O.axisX,lh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),hj.style("display","none"),o(),ej.select("line."+f.xgridFocus).style("visibility","hidden"),Kh){if("year"===Lh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=ej.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",_g?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",_g?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",_g?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",_g?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(_g?"y1":"x1")===(_g?Rf:0)?0:1}),i.exit().remove()}we(Mh)&&(k=ej.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Mh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",_g?"":"rotate(-90)").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",_g?0:Dd).attr("x2",_g?Pf:Dd).attr("y1",_g?Dd:Mf.top).attr("y2",_g?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",_g?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Nh&&(m=ej.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Ph)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",_g?jg:0).attr("x2",_g?jg:Pf).attr("y1",_g?0:jg).attr("y2",_g?Rf:jg),m.exit().remove()),A&&we(Oh)&&(n=ej.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Oh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",_g?"rotate(-90)":"").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",_g?Ed:0).attr("x2",_g?Ed:Pf).attr("y1",_g?0:Ed).attr("y2",_g?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",_g?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=ej.select("."+f.regions).selectAll("rect."+f.region).data(ki),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=ej.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Hi(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=ej.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return _g?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),ej.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",$i).style("opacity",1),ej.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",_i).style("opacity",kj),q=ej.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Rh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),q.exit().remove(),ej.each(function(){Fi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Fi=!1}),ej.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),ej.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Sg&&(null!==wf.event&&"zoom"===wf.event.type&&Zi.extent(ig.orgDomain()).update(),B&&(!_g&&lh&&eb(e,O.axisSubX,lh),Zi.empty()||Zi.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Hi(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1))),ej.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),ej.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),v=ej.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ai&&!zi?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),ej.select("."+f.eventRects).datum(x?x.values:[]),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",_g?0:y).attr("y",_g?y:0).attr("width",_g?Pf:z).attr("height",_g?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){lj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&bj.altDomain?(ig.domain(bj.altDomain),void bj.scale(ig).updateScaleExtent()):(zi&&ig.orgDomain()[0]===jj[0]&&ig.domain([jj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Di=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){cj.attr("width",Tf).attr("height",Uf),cj.select("#"+si).select("rect").attr("width",Pf).attr("height",Rf),cj.select("#"+ti).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),cj.select("#"+ui).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),cj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),ij.style("max-height",Uf+"px")}function df(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=ej.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Hi(a)}),e=ej.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("fill",function(a){return Hi(a)}).style("stroke","none").style("cursor",function(a){return Jg(a)?"pointer":null}),c=ej.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)}),b.append("path").attr("class",dd).style("opacity",function(){return kj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Hi(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Hi(a)}).style("cursor",function(a){return Jg(a)?"pointer":null}),a.forEach(function(a){ej.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=ej.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Hi(a.data)}).style("cursor",function(a){return Jg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Sg&&(n=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Hi(a)}),l=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)})),cj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Ri?j:i,l=Ri?Q():P();return d&&(x=0,D=0,u=0,v=0),Vg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Ri?v:u,void($g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Ri?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=gj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Xg?Xg(a):xf.toggle(a)}).on("mouseover",function(a){Fi||xf.focus(a),"function"==typeof Yg&&Yg(a)}).on("mouseout",function(a){Fi||xf.revert(),"function"==typeof Zg&&Zg(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ri?h:-200).attr("y",Ri?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ri?i:-200).attr("y",Ri?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Hi(a)}).attr("x",Ri?h:-200).attr("y",Ri?-200:j).attr("width",10).attr("height",10),gj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),gj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),gj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Fi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"]),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","selection","enabled"],!1),Ig=h(["data","selection","grouped"],!1),Jg=h(["data","selection","isselectable"],function(){return!0}),Kg=h(["data","selection","multiple"],!0),Lg=h(["data","onclick"],function(){}),Mg=h(["data","onenter"],function(){}),Ng=h(["data","onleave"],function(){}),Og=h(["data","onselected"],function(){}),Pg=h(["data","onunselected"],function(){}),Qg=h(["data","ondragstart"],function(){}),Rg=h(["data","ondragend"],function(){}),Sg=h(["subchart","show"],!1),Tg=h(["subchart","size","height"],60),Ug=h(["color","pattern"],[]),Vg=h(["legend","show"],!0),Wg=h(["legend","position"],"bottom"),Xg=h(["legend","item","onclick"]),Yg=h(["legend","item","onmouseover"]),Zg=h(["legend","item","onmouseout"]),$g=h(["legend","equally"],!1),_g=h(["axis","rotated"],!1),ah=h(["axis","x","show"],!0),bh=h(["axis","x","type"],"indexed"),ch=h(["axis","x","localtime"],!0),dh=h(["axis","x","categories"],[]),eh=h(["axis","x","tick","centered"],!1),fh=h(["axis","x","tick","format"]),gh=h(["axis","x","tick","culling"],{}),hh=h(["axis","x","tick","culling","max"],10),ih=h(["axis","x","tick","count"]),jh=h(["axis","x","tick","fit"],!0),kh=h(["axis","x","tick","values"],null),lh=h(["axis","x","tick","rotate"]),mh=h(["axis","x","max"],null),nh=h(["axis","x","min"],null),oh=h(["axis","x","padding"],{}),ph=h(["axis","x","height"]),qh=h(["axis","x","default"]),rh=h(["axis","x","label"],{}),sh=h(["axis","y","show"],!0),th=h(["axis","y","max"]),uh=h(["axis","y","min"]),vh=h(["axis","y","center"]),wh=h(["axis","y","label"],{}),xh=h(["axis","y","inner"],!1),yh=h(["axis","y","tick","format"]),zh=h(["axis","y","padding"],{}),Ah=h(["axis","y","ticks"],10),Bh=h(["axis","y2","show"],!1),Ch=h(["axis","y2","max"]),Dh=h(["axis","y2","min"]),Eh=h(["axis","y2","center"]),Fh=h(["axis","y2","label"],{}),Gh=h(["axis","y2","inner"],!1),Hh=h(["axis","y2","tick","format"]),Ih=h(["axis","y2","padding"],{}),Jh=h(["axis","y2","ticks"],10),Kh=h(["grid","x","show"],!1),Lh=h(["grid","x","type"],"tick"),Mh=h(["grid","x","lines"],[]),Nh=h(["grid","y","show"],!1),Oh=h(["grid","y","lines"],[]),Ph=h(["grid","y","ticks"],10),Qh=h(["point","show"],!0),Rh=Qh?h(["point","r"],2.5):0,Sh=h(["point","focus","line","enabled"],!0),Th=h(["point","focus","expand","enabled"],!0),Uh=h(["point","focus","expand","r"],Th?4:Rh),Vh=h(["point","focus","select","r"],8),Wh=h(["line","connect_null"],!1),Xh=h(["bar","width"]),Yh=h(["bar","width","ratio"],.6),Zh=h(["pie","label","show"],!0),$h=h(["pie","label","format"]),_h=h(["pie","expand"],!0),ai=h(["pie","onclick"],function(){}),bi=h(["pie","onmouseover"],function(){}),ci=h(["pie","onmouseout"],function(){}),di=h(["donut","label","show"],!0),ei=h(["donut","label","format"]),fi=h(["donut","expand"],!0),gi=h(["donut","title"],""),hi=h(["donut","onclick"],function(){}),ii=h(["donut","onmouseover"],function(){}),ji=h(["donut","onmouseout"],function(){}),ki=h(["regions"],[]),li=h(["tooltip","show"],!0),mi=h(["tooltip","format","title"]),ni=h(["tooltip","format","value"]),oi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=mi?mi:b,l=ni?ni:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),pi=h(["tooltip","init","show"],!1),qi=h(["tooltip","init","x"],0),ri=h(["tooltip","init","position"],{top:"0px",left:"50px"}),si=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ti=si+"-xaxis",ui=si+"-yaxis",vi=i(si),wi=i(ti),xi=i(ui),yi="timeseries"===bh,zi="categorized"===bh,Ai=!yi&&(sg||we(tg)),Bi=null,Ci=!1,Di=!1,Ei=!1,Fi=!1,Gi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Hi=qe(Gg,we(Ug)?Ug:Gi,Fg),Ii=ch?wf.time.format:wf.time.format.utc,Ji=function(){var a=[[Ii("%Y/%-m/%-d"),function(){return!0}],[Ii("%-m/%-d"),function(a){return a.getMonth()}],[Ii("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ii("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ii("%I %p"),function(a){return a.getHours()}],[Ii("%I:%M"),function(a){return a.getMinutes()}],[Ii(":%S"),function(a){return a.getSeconds()}],[Ii(".%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)}}(),Ki=[],Li=[],Mi=_g?"left":"bottom",Ni=_g?xh?"top":"bottom":xh?"right":"left",Oi=_g?Gh?"bottom":"top":Gh?"left":"right",Pi=_g?"left":"bottom",Qi={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(_g?0:Rf)+")"},y:function(){return"translate(0,"+(_g?Rf:0)+")"},y2:function(){return"translate("+(_g?0:Pf)+","+(_g?1:0)+")"},subx:function(){return"translate(0,"+(_g?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Ri="right"===Wg,Si=0,Ti=0,Ui=0,Vi=.15,Wi=30,Xi=_g&&!ah?0:30,Yi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Zi,$i=function(){var a=wf.svg.line().x(_g?function(a){return V(a.id)(a.value)}:Cd).y(_g?Cd:function(a){return V(a.id)(a.value)});return Wh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Wh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),_i=function(){var a;return a=_g?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a=wf.svg.line().x(_g?function(a){return W(a.id)(a.value)}:Fd).y(_g?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),bj=function(){};Zi=wf.svg.brush().on("brush",_e),Zi.update=function(){return fj&&fj.select("."+f.brush).call(this),this},Zi.scale=function(a){return _g?this.y(a):this.x(a)},Ef&&(bj=wf.behavior.zoom().on("zoomstart",function(){bj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),bj.scale=function(a){return _g?this.y(a):this.x(a)},bj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},bj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(jj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var cj,dj,ej,fj,gj,hj,ij,jj,kj,lj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),cj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?pf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),cj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?qf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Vi),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){Zi.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&zi&&(dh=a.categories,og.categories(dh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},xf.selected=function(a){return wf.merge(ej.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Ig||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Jg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Ig||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Jg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0})},xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Mh=a,$e(),Mh):Mh},xf.xgrids.add=function(a){return a?xf.xgrids(Mh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a); -return xf.xgrids(Mh.filter(b))},xf.ygrids=function(a){return a?(Oh=a,$e(),Oh):Oh},xf.ygrids.add=function(a){return a?xf.ygrids(Oh.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Oh.filter(b))},xf.regions=function(a){return c(a)?ki:(ki=a,$e(),ki)},xf.regions.add=function(a){return c(a)?ki:(ki=ki.concat(a),$e(),ki)},xf.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;cj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ki=ki.filter(function(b){return b.classes.indexOf(a)<0})}),ki},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(th=+a.y),b(a.y2)&&(Ch=+a.y2)):th=Ch=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){Vg||(Vg=!0,gj.style("visibility","visible")),pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0}),Vg&&ve(a)&&(Vg=!1,gj.style("visibility","hidden"))},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},ij.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file +}hj.html(oi(xf.data.targets.map(function(a){return pc(a.values[qi])}),$(),wd(ee(xf.data.targets)),Hi)),hj.style("top",ri.top).style("left",ri.left).style("display","block")}null==a.onresize&&(a.onresize=bf()),a.onresize.add&&(a.onresize.add(Jf),a.onresize.add(function(){df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})}),a.onresize.add(Kf))}function Ue(a){a.append("rect").attr("class",fd).style("cursor",Hg&&Ig?"pointer":null).on("mouseover",function(a,b){if(!Ci&&!ee(xf.data.targets)){var c,d,e=xf.data.targets.map(function(a){return pc(a.values[b])});if(Object.keys(wg).length>0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(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){ee(xf.data.targets)||Hg&&(Bi=a,ej.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ci=!0,Qg())}function Ze(){ee(xf.data.targets)||Hg&&(ej.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),ej.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ci=!1,Rg())}function $e(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=ej.select("."+f.axisX).style("opacity",W?0:1),g=ej.select("."+f.axisY).style("opacity",W?0:1),h=ej.select("."+f.axisY2).style("opacity",W?0:1),e=fj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Vg&&rf(Cc(xf.data.targets),a,O),zi&&(0===X.length||!H||G)&&ig.domain([0,c.selectAll(".tick").size()]),X.length&&(H&&(ig.domain(wf.extent(_b(X))),jj=ig.domain(),Ef&&bj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),Zi.scale(lg)),G&&(ig.domain(Zi.empty()?jj:Zi.extent()),Ef&&bj.scale(ig).updateScaleExtent())),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),(jh||ih)&&X.length&&(S=kh?kh:Kc(Jc(X)),og.tickValues(S),rg.tickValues(S)),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(gh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!_g&&lh&&eb(c,O.axisX,lh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),hj.style("display","none"),o(),ej.select("line."+f.xgridFocus).style("visibility","hidden"),Kh){if("year"===Lh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=ej.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",_g?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",_g?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",_g?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",_g?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(_g?"y1":"x1")===(_g?Rf:0)?0:1}),i.exit().remove()}we(Mh)&&(k=ej.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Mh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",_g?"":"rotate(-90)").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",_g?0:Dd).attr("x2",_g?Pf:Dd).attr("y1",_g?Dd:Mf.top).attr("y2",_g?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",_g?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Nh&&(m=ej.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Ph)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",_g?jg:0).attr("x2",_g?jg:Pf).attr("y1",_g?0:jg).attr("y2",_g?Rf:jg),m.exit().remove()),A&&we(Oh)&&(n=ej.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Oh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",_g?"rotate(-90)":"").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",_g?Ed:0).attr("x2",_g?Ed:Pf).attr("y1",_g?0:Ed).attr("y2",_g?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",_g?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=ej.select("."+f.regions).selectAll("rect."+f.region).data(ki),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=ej.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Hi(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=ej.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return _g?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),ej.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",$i).style("opacity",1),ej.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",_i).style("opacity",kj),q=ej.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Rh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),q.exit().remove(),ej.each(function(){Fi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Fi=!1}),ej.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),ej.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Sg&&(null!==wf.event&&"zoom"===wf.event.type&&Zi.extent(ig.orgDomain()).update(),B&&(!_g&&lh&&eb(e,O.axisSubX,lh),Zi.empty()||Zi.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Hi(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1))),ej.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),ej.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),v=ej.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ai&&!zi?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),ej.select("."+f.eventRects).datum(x?x.values:[]),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",_g?0:y).attr("y",_g?y:0).attr("width",_g?Pf:z).attr("height",_g?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){lj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&bj.altDomain?(ig.domain(bj.altDomain),void bj.scale(ig).updateScaleExtent()):(zi&&ig.orgDomain()[0]===jj[0]&&ig.domain([jj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Di=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){cj.attr("width",Tf).attr("height",Uf),cj.select("#"+si).select("rect").attr("width",Pf).attr("height",Rf),cj.select("#"+ti).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),cj.select("#"+ui).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),cj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),ij.style("max-height",Uf+"px")}function df(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=ej.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Hi(a)}),e=ej.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("fill",function(a){return Hi(a)}).style("stroke","none").style("cursor",function(a){return Jg(a)?"pointer":null}),c=ej.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)}),b.append("path").attr("class",dd).style("opacity",function(){return kj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Hi(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Hi(a)}).style("cursor",function(a){return Jg(a)?"pointer":null}),a.forEach(function(a){ej.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=ej.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Hi(a.data)}).style("cursor",function(a){return Jg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Sg&&(n=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Hi(a)}),l=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)})),cj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Ri?j:i,l=Ri?Q():P();return d&&(x=0,D=0,u=0,v=0),Vg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Ri?v:u,void($g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Ri?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=gj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Xg?Xg(a):xf.toggle(a)}).on("mouseover",function(a){Fi||xf.focus(a),"function"==typeof Yg&&Yg(a)}).on("mouseout",function(a){Fi||xf.revert(),"function"==typeof Zg&&Zg(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ri?h:-200).attr("y",Ri?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ri?i:-200).attr("y",Ri?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Hi(a)}).attr("x",Ri?h:-200).attr("y",Ri?-200:j).attr("width",10).attr("height",10),gj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),gj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),gj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Fi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"]),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","selection","enabled"],!1),Ig=h(["data","selection","grouped"],!1),Jg=h(["data","selection","isselectable"],function(){return!0}),Kg=h(["data","selection","multiple"],!0),Lg=h(["data","onclick"],function(){}),Mg=h(["data","onenter"],function(){}),Ng=h(["data","onleave"],function(){}),Og=h(["data","onselected"],function(){}),Pg=h(["data","onunselected"],function(){}),Qg=h(["data","ondragstart"],function(){}),Rg=h(["data","ondragend"],function(){}),Sg=h(["subchart","show"],!1),Tg=h(["subchart","size","height"],60),Ug=h(["color","pattern"],[]),Vg=h(["legend","show"],!0),Wg=h(["legend","position"],"bottom"),Xg=h(["legend","item","onclick"]),Yg=h(["legend","item","onmouseover"]),Zg=h(["legend","item","onmouseout"]),$g=h(["legend","equally"],!1),_g=h(["axis","rotated"],!1),ah=h(["axis","x","show"],!0),bh=h(["axis","x","type"],"indexed"),ch=h(["axis","x","localtime"],!0),dh=h(["axis","x","categories"],[]),eh=h(["axis","x","tick","centered"],!1),fh=h(["axis","x","tick","format"]),gh=h(["axis","x","tick","culling"],{}),hh=h(["axis","x","tick","culling","max"],10),ih=h(["axis","x","tick","count"]),jh=h(["axis","x","tick","fit"],!0),kh=h(["axis","x","tick","values"],null),lh=h(["axis","x","tick","rotate"]),mh=h(["axis","x","max"],null),nh=h(["axis","x","min"],null),oh=h(["axis","x","padding"],{}),ph=h(["axis","x","height"]),qh=h(["axis","x","default"]),rh=h(["axis","x","label"],{}),sh=h(["axis","y","show"],!0),th=h(["axis","y","max"]),uh=h(["axis","y","min"]),vh=h(["axis","y","center"]),wh=h(["axis","y","label"],{}),xh=h(["axis","y","inner"],!1),yh=h(["axis","y","tick","format"]),zh=h(["axis","y","padding"],{}),Ah=h(["axis","y","ticks"],10),Bh=h(["axis","y2","show"],!1),Ch=h(["axis","y2","max"]),Dh=h(["axis","y2","min"]),Eh=h(["axis","y2","center"]),Fh=h(["axis","y2","label"],{}),Gh=h(["axis","y2","inner"],!1),Hh=h(["axis","y2","tick","format"]),Ih=h(["axis","y2","padding"],{}),Jh=h(["axis","y2","ticks"],10),Kh=h(["grid","x","show"],!1),Lh=h(["grid","x","type"],"tick"),Mh=h(["grid","x","lines"],[]),Nh=h(["grid","y","show"],!1),Oh=h(["grid","y","lines"],[]),Ph=h(["grid","y","ticks"],10),Qh=h(["point","show"],!0),Rh=Qh?h(["point","r"],2.5):0,Sh=h(["point","focus","line","enabled"],!0),Th=h(["point","focus","expand","enabled"],!0),Uh=h(["point","focus","expand","r"],Th?4:Rh),Vh=h(["point","focus","select","r"],8),Wh=h(["line","connect_null"],!1),Xh=h(["bar","width"]),Yh=h(["bar","width","ratio"],.6),Zh=h(["pie","label","show"],!0),$h=h(["pie","label","format"]),_h=h(["pie","expand"],!0),ai=h(["pie","onclick"],function(){}),bi=h(["pie","onmouseover"],function(){}),ci=h(["pie","onmouseout"],function(){}),di=h(["donut","label","show"],!0),ei=h(["donut","label","format"]),fi=h(["donut","expand"],!0),gi=h(["donut","title"],""),hi=h(["donut","onclick"],function(){}),ii=h(["donut","onmouseover"],function(){}),ji=h(["donut","onmouseout"],function(){}),ki=h(["regions"],[]),li=h(["tooltip","show"],!0),mi=h(["tooltip","format","title"]),ni=h(["tooltip","format","value"]),oi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=mi?mi:b,l=ni?ni:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),pi=h(["tooltip","init","show"],!1),qi=h(["tooltip","init","x"],0),ri=h(["tooltip","init","position"],{top:"0px",left:"50px"}),si=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ti=si+"-xaxis",ui=si+"-yaxis",vi=i(si),wi=i(ti),xi=i(ui),yi="timeseries"===bh,zi="categorized"===bh,Ai=!yi&&(sg||we(tg)),Bi=null,Ci=!1,Di=!1,Ei=!1,Fi=!1,Gi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Hi=qe(Gg,we(Ug)?Ug:Gi,Fg),Ii=ch?wf.time.format:wf.time.format.utc,Ji=function(){var a=[[Ii("%Y/%-m/%-d"),function(){return!0}],[Ii("%-m/%-d"),function(a){return a.getMonth()}],[Ii("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ii("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ii("%I %p"),function(a){return a.getHours()}],[Ii("%I:%M"),function(a){return a.getMinutes()}],[Ii(":%S"),function(a){return a.getSeconds()}],[Ii(".%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)}}(),Ki=[],Li=[],Mi=_g?"left":"bottom",Ni=_g?xh?"top":"bottom":xh?"right":"left",Oi=_g?Gh?"bottom":"top":Gh?"left":"right",Pi=_g?"left":"bottom",Qi={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(_g?0:Rf)+")"},y:function(){return"translate(0,"+(_g?Rf:0)+")"},y2:function(){return"translate("+(_g?0:Pf)+","+(_g?1:0)+")"},subx:function(){return"translate(0,"+(_g?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Ri="right"===Wg,Si=0,Ti=0,Ui=0,Vi=.15,Wi=30,Xi=_g&&!ah?0:30,Yi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Zi,$i=function(){var a=wf.svg.line().x(_g?function(a){return V(a.id)(a.value)}:Cd).y(_g?Cd:function(a){return V(a.id)(a.value)});return Wh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Wh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),_i=function(){var a;return a=_g?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a=wf.svg.line().x(_g?function(a){return W(a.id)(a.value)}:Fd).y(_g?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),bj=function(){};Zi=wf.svg.brush().on("brush",_e),Zi.update=function(){return fj&&fj.select("."+f.brush).call(this),this},Zi.scale=function(a){return _g?this.y(a):this.x(a)},Ef&&(bj=wf.behavior.zoom().on("zoomstart",function(){bj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),bj.scale=function(a){return _g?this.y(a):this.x(a)},bj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},bj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(jj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var cj,dj,ej,fj,gj,hj,ij,jj,kj,lj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),cj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?pf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),cj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?qf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Vi),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){Zi.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&zi&&(dh=a.categories,og.categories(dh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},xf.selected=function(a){return wf.merge(ej.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Ig||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Jg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Ig||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Jg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0})},xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Mh=a,$e(),Mh):Mh},xf.xgrids.add=function(a){return a?xf.xgrids(Mh.concat(a)):void 0 +},xf.xgrids.remove=function(a){var b=uf(a);return xf.xgrids(Mh.filter(b))},xf.ygrids=function(a){return a?(Oh=a,$e(),Oh):Oh},xf.ygrids.add=function(a){return a?xf.ygrids(Oh.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Oh.filter(b))},xf.regions=function(a){return c(a)?ki:(ki=a,$e(),ki)},xf.regions.add=function(a){return c(a)?ki:(ki=ki.concat(a),$e(),ki)},xf.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;cj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ki=ki.filter(function(b){return b.classes.indexOf(a)<0})}),ki},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(th=+a.y),b(a.y2)&&(Ch=+a.y2)):th=Ch=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){Vg||(Vg=!0,gj.style("visibility","visible")),pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0}),Vg&&ve(a)&&(Vg=!1,gj.style("visibility","hidden"))},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},ij.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 0ed8a67fd80c415c9d252d1e32a2fc21b06e7b68 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Mon, 28 Apr 2014 15:44:09 +0900 Subject: [PATCH 078/178] Fix trivial --- c3.js | 13 +++---------- c3.min.js | 2 +- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/c3.js b/c3.js index f74812c..4fc7e80 100644 --- a/c3.js +++ b/c3.js @@ -2517,25 +2517,18 @@ var orgAreaOpacity, withoutFadeIn = {}; function init(data) { - var eventRect, grid; - var i; + var eventRect, grid, i; selectChart = d3.select(__bindto); if (selectChart.empty()) { - throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".'); - } else { - selectChart.html(""); + throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".'); } - - // Set class - selectChart.classed("c3", true); + selectChart.html("").classed("c3", true); // Init data as targets c3.data.xs = {}; c3.data.targets = convertDataToTargets(data); - // TODO: set names if names not specified - // Init sizes and scales updateSizes(); updateScales(); diff --git a/c3.min.js b/c3.min.js index 9d9e28d..a805f3e 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.32"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cPf&&(Pf=0),0>Rf&&(Rf=0),Qf=_g?Mf.left-Wi-Xi:Pf,Sf=_g?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Ri&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){ej.select("line."+f.xgridFocus).attr("x1",_g?0:-10).attr("x2",_g?Pf:-10).attr("y1",_g?-10:Mf.top).attr("y2",_g?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=_g?f.axisX:f.axisY,b=ej.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:_g?ah?v("x"):1:!sh||xh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Ri?P()+(Bh&&!_g?v("y2"):a):Bh?Gh||_g?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||ah?"x"===a&&ph?ph:"y"!==a||sh?"y2"!==a||Bh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Yi:Vg&&!Ri?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!_g)}function C(){return A(!_g)}function D(){return z(_g)}function E(){return A(_g)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(ph?ph:0)+80:Rf+8}function H(){return F(!_g)}function I(){return G(!_g)}function J(){return F(_g)}function K(){return G(_g)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(zi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Si=a}function N(a){Ti=a}function O(a){Ui=a}function P(){return Vg?Ri?Ti*(Si+1):Tf:0}function Q(){return Vg?Ri?Uf:Ui*(Si+1):0}function R(){var a,b=!ig;ag=_g?1:0,bg=_g?Rf:Pf,cg=_g?0:Rf,dg=_g?Pf:1,eg=ag,fg=bg,gg=_g?0:Sf,hg=_g?Qf:1,ig=T(ag,bg,b?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,b?void 0:jg.domain()),kg=U(cg,dg,b?void 0:kg.domain()),lg=T(ag,bg,jj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,b?void 0:mg.domain()),ng=U(gg,hg,b?void 0:ng.domain()),a=$(),og=X(ig,Mi,a),rg=X(lg,Pi,a),pg=Y(jg,Ni,yh,Ah),qg=Y(kg,Oi,Hh,Jh),b||(Zi.scale(lg),Ef&&bj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(yi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),zi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c){var d=(zi?Eb():wf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),zi?(d.tickCentered(eh),ve(gh)&&(gh=!1)):d.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},zi&&d.categories(dh),d}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=yi?Ji:zi?Tc:function(a){return 0>a?a.toFixed(0):a};return fh&&("function"==typeof fh?a=fh:yi&&(a=function(a){return a?Ii(fh)(a):""})),a}function _(a){var b;return"y"===a?b=wh:"y2"===a?b=Fh:"x"===a&&(b=rh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?wh=b:"y2"===a?Fh=b:"x"===a&&(rh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",_g?"inner-top":"inner-right")}function hb(){return fb("y",_g?"inner-right":"inner-top")}function ib(){return fb("y2",_g?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!_g,gb())}function rb(){return nb(_g,hb())}function sb(){return nb(_g,ib())}function tb(){return ob(!_g,gb())}function ub(){return ob(_g,hb())}function vb(){return ob(_g,ib())}function wb(){var a=gb();return _g?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":ph?ph-10:"3em"}function xb(){var a=hb();return _g?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return _g?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!_g,gb())}function Ab(){return pb(_g,hb())}function Bb(){return pb(_g,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?30:b}function Db(){ej.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),ej.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),ej.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.length>0)for(g=Sc(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 wf.max(Object.keys(i).map(function(a){return wf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Dh:uh,n="y2"===c?Ch:th,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Eh:vh,r=ud()&&_g;return 0===l.length?"y2"===c?kg.domain():jg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(jg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&zh&&(f=b(zh.top)?zh.top:e,g=b(zh.bottom)?zh.bottom:e),"y2"===c&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return nh?yi?re(nh):nh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return mh?yi?re(mh):mh:wf.max(a,function(a){return wf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return zi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof oh&&we(oh)?(e=b(oh.left)?oh.left:d,f=b(oh.right)?oh.right:d):e=f="number"==typeof oh?oh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=yi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=yi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?jg:kg;return b="y"===a.axis||"y2"===a.axis?_g?Rf:"start"in a?d(a.start):Rf:_g?"end"in a?ig(yi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),xf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=yi?a?a instanceof Date?a:re(a):re(mc(c,d)):Ai&&!zi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ai&&zi&&0===c&&g&&(0===e&&(dh=[]),dh.push(g)),("undefined"==typeof a[b]||xf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&xf.data.targets[0].values[a-1]?xf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(xf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(yi?new Date(h):h);i.push(d)}return yi||(i=i.sort(function(a,b){return a-b})),i}function Lc(a){Ki=Ki.concat(a)}function Mc(a){Ki=Ki.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Li=Li.concat(a)}function Oc(a){Li=Li.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&li&&(hj.html(oi(a,$(),wd(k),Hi)).style("display","block"),d=hj.property("offsetWidth"),e=hj.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(_g?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),hj.style("top",i+"px").style("left",g+"px"))}function Qd(){hj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});li&&(be(xf.data.targets)||ee(xf.data.targets)||ej.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(_g?"y1":"x1",Cd).attr(_g?"y2":"x2",Cd))}function Sd(){ej.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return Xh?Xh:b?2*a.tickOffset()*Yh/b:0}function $d(a,b){Dc(a).forEach(function(a){lj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&fi||je(a)&&_h}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=_g?1:0,e=_g?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Og(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud).attr("stroke",function(){return Hi(b)}).attr("r",1.4*Vh).transition().duration(100).attr("r",Vh)}function Be(a,b,c){Pg(b,a.node()),ej.select("."+f.selectedCircles+ld(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){Og(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Hi(b)).darker(1)})}function Ee(a,b){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return Hi(b)})}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?ej.selectAll("."+f.circles+ld(c)):ej).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Uh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Rh)}function Ke(a){return ej.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=_g?1:0,f=_g?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 _g?(c=he(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.getBoundingClientRect();return _g?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return _g&&(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(ij=wf.select(zf),ij.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ij.html(""),ij.classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),jj=ig.domain(),Zi.scale(lg),Ef&&bj.scale(ig),cj=ij.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),dj=cj.append("defs"),dj.append("clipPath").attr("id",si).append("rect").attr("width",Pf).attr("height",Rf),dj.append("clipPath").attr("id",ti).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.append("clipPath").attr("id",ui).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej=cj.append("g").attr("transform",Qi.main),fj=cj.append("g").attr("transform",Qi.context),gj=cj.append("g").attr("transform",Qi.legend),Sg||fj.style("visibility","hidden"),Vg||(gj.style("visibility","hidden"),Li=Cc(xf.data.targets)),hj=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),ah&&ej.append("g").attr("class",f.axisX).attr("clip-path",wi).attr("transform",Qi.x).append("text").attr("class",f.axisXLabel).attr("transform",_g?"rotate(-90)":"").style("text-anchor",zb),sh&&ej.append("g").attr("class",f.axisY).attr("clip-path",xi).attr("transform",Qi.y).append("text").attr("class",f.axisYLabel).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Ab),Bh&&ej.append("g").attr("class",f.axisY2).attr("transform",Qi.y2).append("text").attr("class",f.axisY2Label).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Bb),d=ej.append("g").attr("clip-path",vi).attr("class",f.grid),Kh&&d.append("g").attr("class",f.xgrids),we(Mh)&&d.append("g").attr("class",f.xgridLines),Sh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Nh&&d.append("g").attr("class",f.ygrids),we(Oh)&&d.append("g").attr("class",f.ygridLines),ej.append("g").attr("clip-path",vi).attr("class",f.regions),ej.append("g").attr("clip-path",vi).attr("class",f.chart),c=ej.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?_g?"ns-resize":"ew-resize":null),ej.select("."+f.chart).append("g").attr("class",f.chartBars),ej.select("."+f.chart).append("g").attr("class",f.chartLines),ej.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Qi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),ej.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&ej.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",_g?"ns-resize":"ew-resize").call(bj).on("dblclick.zoom",null),qh&&Zi.extent("function"!=typeof qh?qh:qh(_b())),fj.append("g").attr("clip-path",vi).attr("class",f.chart),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.append("g").attr("clip-path",vi).attr("class",f.brush).call(Zi).selectAll("rect").attr(_g?"width":"height",_g?Qf:Sf),fj.append("g").attr("class",f.axisX).attr("transform",Qi.subx).attr("clip-path",_g?"":wi),ef(xf.data.targets),_g?ej.select("."+f.axisX).style("opacity",0).call(og):(ej.select("."+f.axisY).style("opacity",0).call(pg),ej.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),pi){if(yi&&"string"==typeof qi){for(qi=re(qi),e=0;ePf&&(Pf=0),0>Rf&&(Rf=0),Qf=_g?Mf.left-Wi-Xi:Pf,Sf=_g?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Ri&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){ej.select("line."+f.xgridFocus).attr("x1",_g?0:-10).attr("x2",_g?Pf:-10).attr("y1",_g?-10:Mf.top).attr("y2",_g?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=_g?f.axisX:f.axisY,b=ej.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:_g?ah?v("x"):1:!sh||xh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Ri?P()+(Bh&&!_g?v("y2"):a):Bh?Gh||_g?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||ah?"x"===a&&ph?ph:"y"!==a||sh?"y2"!==a||Bh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Yi:Vg&&!Ri?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!_g)}function C(){return A(!_g)}function D(){return z(_g)}function E(){return A(_g)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(ph?ph:0)+80:Rf+8}function H(){return F(!_g)}function I(){return G(!_g)}function J(){return F(_g)}function K(){return G(_g)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(zi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Si=a}function N(a){Ti=a}function O(a){Ui=a}function P(){return Vg?Ri?Ti*(Si+1):Tf:0}function Q(){return Vg?Ri?Uf:Ui*(Si+1):0}function R(){var a,b=!ig;ag=_g?1:0,bg=_g?Rf:Pf,cg=_g?0:Rf,dg=_g?Pf:1,eg=ag,fg=bg,gg=_g?0:Sf,hg=_g?Qf:1,ig=T(ag,bg,b?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,b?void 0:jg.domain()),kg=U(cg,dg,b?void 0:kg.domain()),lg=T(ag,bg,jj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,b?void 0:mg.domain()),ng=U(gg,hg,b?void 0:ng.domain()),a=$(),og=X(ig,Mi,a),rg=X(lg,Pi,a),pg=Y(jg,Ni,yh,Ah),qg=Y(kg,Oi,Hh,Jh),b||(Zi.scale(lg),Ef&&bj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(yi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),zi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c){var d=(zi?Eb():wf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),zi?(d.tickCentered(eh),ve(gh)&&(gh=!1)):d.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},zi&&d.categories(dh),d}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=yi?Ji:zi?Tc:function(a){return 0>a?a.toFixed(0):a};return fh&&("function"==typeof fh?a=fh:yi&&(a=function(a){return a?Ii(fh)(a):""})),a}function _(a){var b;return"y"===a?b=wh:"y2"===a?b=Fh:"x"===a&&(b=rh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?wh=b:"y2"===a?Fh=b:"x"===a&&(rh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",_g?"inner-top":"inner-right")}function hb(){return fb("y",_g?"inner-right":"inner-top")}function ib(){return fb("y2",_g?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!_g,gb())}function rb(){return nb(_g,hb())}function sb(){return nb(_g,ib())}function tb(){return ob(!_g,gb())}function ub(){return ob(_g,hb())}function vb(){return ob(_g,ib())}function wb(){var a=gb();return _g?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":ph?ph-10:"3em"}function xb(){var a=hb();return _g?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return _g?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!_g,gb())}function Ab(){return pb(_g,hb())}function Bb(){return pb(_g,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?30:b}function Db(){ej.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),ej.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),ej.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.length>0)for(g=Sc(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 wf.max(Object.keys(i).map(function(a){return wf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Dh:uh,n="y2"===c?Ch:th,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Eh:vh,r=ud()&&_g;return 0===l.length?"y2"===c?kg.domain():jg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(jg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&zh&&(f=b(zh.top)?zh.top:e,g=b(zh.bottom)?zh.bottom:e),"y2"===c&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return nh?yi?re(nh):nh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return mh?yi?re(mh):mh:wf.max(a,function(a){return wf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return zi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof oh&&we(oh)?(e=b(oh.left)?oh.left:d,f=b(oh.right)?oh.right:d):e=f="number"==typeof oh?oh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=yi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=yi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?jg:kg;return b="y"===a.axis||"y2"===a.axis?_g?Rf:"start"in a?d(a.start):Rf:_g?"end"in a?ig(yi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),xf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=yi?a?a instanceof Date?a:re(a):re(mc(c,d)):Ai&&!zi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ai&&zi&&0===c&&g&&(0===e&&(dh=[]),dh.push(g)),("undefined"==typeof a[b]||xf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&xf.data.targets[0].values[a-1]?xf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(xf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(yi?new Date(h):h);i.push(d)}return yi||(i=i.sort(function(a,b){return a-b})),i}function Lc(a){Ki=Ki.concat(a)}function Mc(a){Ki=Ki.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Li=Li.concat(a)}function Oc(a){Li=Li.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&li&&(hj.html(oi(a,$(),wd(k),Hi)).style("display","block"),d=hj.property("offsetWidth"),e=hj.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(_g?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),hj.style("top",i+"px").style("left",g+"px"))}function Qd(){hj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});li&&(be(xf.data.targets)||ee(xf.data.targets)||ej.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(_g?"y1":"x1",Cd).attr(_g?"y2":"x2",Cd))}function Sd(){ej.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return Xh?Xh:b?2*a.tickOffset()*Yh/b:0}function $d(a,b){Dc(a).forEach(function(a){lj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&fi||je(a)&&_h}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=_g?1:0,e=_g?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Og(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud).attr("stroke",function(){return Hi(b)}).attr("r",1.4*Vh).transition().duration(100).attr("r",Vh)}function Be(a,b,c){Pg(b,a.node()),ej.select("."+f.selectedCircles+ld(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){Og(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Hi(b)).darker(1)})}function Ee(a,b){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return Hi(b)})}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?ej.selectAll("."+f.circles+ld(c)):ej).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Uh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Rh)}function Ke(a){return ej.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=_g?1:0,f=_g?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 _g?(c=he(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.getBoundingClientRect();return _g?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return _g&&(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(ij=wf.select(zf),ij.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ij.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),jj=ig.domain(),Zi.scale(lg),Ef&&bj.scale(ig),cj=ij.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),dj=cj.append("defs"),dj.append("clipPath").attr("id",si).append("rect").attr("width",Pf).attr("height",Rf),dj.append("clipPath").attr("id",ti).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.append("clipPath").attr("id",ui).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej=cj.append("g").attr("transform",Qi.main),fj=cj.append("g").attr("transform",Qi.context),gj=cj.append("g").attr("transform",Qi.legend),Sg||fj.style("visibility","hidden"),Vg||(gj.style("visibility","hidden"),Li=Cc(xf.data.targets)),hj=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),ah&&ej.append("g").attr("class",f.axisX).attr("clip-path",wi).attr("transform",Qi.x).append("text").attr("class",f.axisXLabel).attr("transform",_g?"rotate(-90)":"").style("text-anchor",zb),sh&&ej.append("g").attr("class",f.axisY).attr("clip-path",xi).attr("transform",Qi.y).append("text").attr("class",f.axisYLabel).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Ab),Bh&&ej.append("g").attr("class",f.axisY2).attr("transform",Qi.y2).append("text").attr("class",f.axisY2Label).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Bb),d=ej.append("g").attr("clip-path",vi).attr("class",f.grid),Kh&&d.append("g").attr("class",f.xgrids),we(Mh)&&d.append("g").attr("class",f.xgridLines),Sh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Nh&&d.append("g").attr("class",f.ygrids),we(Oh)&&d.append("g").attr("class",f.ygridLines),ej.append("g").attr("clip-path",vi).attr("class",f.regions),ej.append("g").attr("clip-path",vi).attr("class",f.chart),c=ej.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?_g?"ns-resize":"ew-resize":null),ej.select("."+f.chart).append("g").attr("class",f.chartBars),ej.select("."+f.chart).append("g").attr("class",f.chartLines),ej.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Qi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),ej.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&ej.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",_g?"ns-resize":"ew-resize").call(bj).on("dblclick.zoom",null),qh&&Zi.extent("function"!=typeof qh?qh:qh(_b())),fj.append("g").attr("clip-path",vi).attr("class",f.chart),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.append("g").attr("clip-path",vi).attr("class",f.brush).call(Zi).selectAll("rect").attr(_g?"width":"height",_g?Qf:Sf),fj.append("g").attr("class",f.axisX).attr("transform",Qi.subx).attr("clip-path",_g?"":wi),ef(xf.data.targets),_g?ej.select("."+f.axisX).style("opacity",0).call(og):(ej.select("."+f.axisY).style("opacity",0).call(pg),ej.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),pi){if(yi&&"string"==typeof qi){for(qi=re(qi),e=0;e0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(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){ee(xf.data.targets)||Hg&&(Bi=a,ej.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ci=!0,Qg())}function Ze(){ee(xf.data.targets)||Hg&&(ej.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),ej.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ci=!1,Rg())}function $e(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=ej.select("."+f.axisX).style("opacity",W?0:1),g=ej.select("."+f.axisY).style("opacity",W?0:1),h=ej.select("."+f.axisY2).style("opacity",W?0:1),e=fj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Vg&&rf(Cc(xf.data.targets),a,O),zi&&(0===X.length||!H||G)&&ig.domain([0,c.selectAll(".tick").size()]),X.length&&(H&&(ig.domain(wf.extent(_b(X))),jj=ig.domain(),Ef&&bj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),Zi.scale(lg)),G&&(ig.domain(Zi.empty()?jj:Zi.extent()),Ef&&bj.scale(ig).updateScaleExtent())),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),(jh||ih)&&X.length&&(S=kh?kh:Kc(Jc(X)),og.tickValues(S),rg.tickValues(S)),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(gh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!_g&&lh&&eb(c,O.axisX,lh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),hj.style("display","none"),o(),ej.select("line."+f.xgridFocus).style("visibility","hidden"),Kh){if("year"===Lh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=ej.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",_g?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",_g?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",_g?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",_g?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(_g?"y1":"x1")===(_g?Rf:0)?0:1}),i.exit().remove()}we(Mh)&&(k=ej.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Mh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",_g?"":"rotate(-90)").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",_g?0:Dd).attr("x2",_g?Pf:Dd).attr("y1",_g?Dd:Mf.top).attr("y2",_g?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",_g?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Nh&&(m=ej.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Ph)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",_g?jg:0).attr("x2",_g?jg:Pf).attr("y1",_g?0:jg).attr("y2",_g?Rf:jg),m.exit().remove()),A&&we(Oh)&&(n=ej.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Oh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",_g?"rotate(-90)":"").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",_g?Ed:0).attr("x2",_g?Ed:Pf).attr("y1",_g?0:Ed).attr("y2",_g?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",_g?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=ej.select("."+f.regions).selectAll("rect."+f.region).data(ki),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=ej.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Hi(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=ej.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return _g?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),ej.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",$i).style("opacity",1),ej.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",_i).style("opacity",kj),q=ej.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Rh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),q.exit().remove(),ej.each(function(){Fi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Fi=!1}),ej.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),ej.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Sg&&(null!==wf.event&&"zoom"===wf.event.type&&Zi.extent(ig.orgDomain()).update(),B&&(!_g&&lh&&eb(e,O.axisSubX,lh),Zi.empty()||Zi.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Hi(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1))),ej.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),ej.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),v=ej.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ai&&!zi?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),ej.select("."+f.eventRects).datum(x?x.values:[]),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",_g?0:y).attr("y",_g?y:0).attr("width",_g?Pf:z).attr("height",_g?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){lj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&bj.altDomain?(ig.domain(bj.altDomain),void bj.scale(ig).updateScaleExtent()):(zi&&ig.orgDomain()[0]===jj[0]&&ig.domain([jj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Di=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){cj.attr("width",Tf).attr("height",Uf),cj.select("#"+si).select("rect").attr("width",Pf).attr("height",Rf),cj.select("#"+ti).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),cj.select("#"+ui).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),cj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),ij.style("max-height",Uf+"px")}function df(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=ej.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Hi(a)}),e=ej.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("fill",function(a){return Hi(a)}).style("stroke","none").style("cursor",function(a){return Jg(a)?"pointer":null}),c=ej.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)}),b.append("path").attr("class",dd).style("opacity",function(){return kj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Hi(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Hi(a)}).style("cursor",function(a){return Jg(a)?"pointer":null}),a.forEach(function(a){ej.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=ej.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Hi(a.data)}).style("cursor",function(a){return Jg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Sg&&(n=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Hi(a)}),l=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)})),cj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Ri?j:i,l=Ri?Q():P();return d&&(x=0,D=0,u=0,v=0),Vg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Ri?v:u,void($g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Ri?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=gj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Xg?Xg(a):xf.toggle(a)}).on("mouseover",function(a){Fi||xf.focus(a),"function"==typeof Yg&&Yg(a)}).on("mouseout",function(a){Fi||xf.revert(),"function"==typeof Zg&&Zg(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ri?h:-200).attr("y",Ri?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ri?i:-200).attr("y",Ri?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Hi(a)}).attr("x",Ri?h:-200).attr("y",Ri?-200:j).attr("width",10).attr("height",10),gj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),gj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),gj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Fi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"]),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","selection","enabled"],!1),Ig=h(["data","selection","grouped"],!1),Jg=h(["data","selection","isselectable"],function(){return!0}),Kg=h(["data","selection","multiple"],!0),Lg=h(["data","onclick"],function(){}),Mg=h(["data","onenter"],function(){}),Ng=h(["data","onleave"],function(){}),Og=h(["data","onselected"],function(){}),Pg=h(["data","onunselected"],function(){}),Qg=h(["data","ondragstart"],function(){}),Rg=h(["data","ondragend"],function(){}),Sg=h(["subchart","show"],!1),Tg=h(["subchart","size","height"],60),Ug=h(["color","pattern"],[]),Vg=h(["legend","show"],!0),Wg=h(["legend","position"],"bottom"),Xg=h(["legend","item","onclick"]),Yg=h(["legend","item","onmouseover"]),Zg=h(["legend","item","onmouseout"]),$g=h(["legend","equally"],!1),_g=h(["axis","rotated"],!1),ah=h(["axis","x","show"],!0),bh=h(["axis","x","type"],"indexed"),ch=h(["axis","x","localtime"],!0),dh=h(["axis","x","categories"],[]),eh=h(["axis","x","tick","centered"],!1),fh=h(["axis","x","tick","format"]),gh=h(["axis","x","tick","culling"],{}),hh=h(["axis","x","tick","culling","max"],10),ih=h(["axis","x","tick","count"]),jh=h(["axis","x","tick","fit"],!0),kh=h(["axis","x","tick","values"],null),lh=h(["axis","x","tick","rotate"]),mh=h(["axis","x","max"],null),nh=h(["axis","x","min"],null),oh=h(["axis","x","padding"],{}),ph=h(["axis","x","height"]),qh=h(["axis","x","default"]),rh=h(["axis","x","label"],{}),sh=h(["axis","y","show"],!0),th=h(["axis","y","max"]),uh=h(["axis","y","min"]),vh=h(["axis","y","center"]),wh=h(["axis","y","label"],{}),xh=h(["axis","y","inner"],!1),yh=h(["axis","y","tick","format"]),zh=h(["axis","y","padding"],{}),Ah=h(["axis","y","ticks"],10),Bh=h(["axis","y2","show"],!1),Ch=h(["axis","y2","max"]),Dh=h(["axis","y2","min"]),Eh=h(["axis","y2","center"]),Fh=h(["axis","y2","label"],{}),Gh=h(["axis","y2","inner"],!1),Hh=h(["axis","y2","tick","format"]),Ih=h(["axis","y2","padding"],{}),Jh=h(["axis","y2","ticks"],10),Kh=h(["grid","x","show"],!1),Lh=h(["grid","x","type"],"tick"),Mh=h(["grid","x","lines"],[]),Nh=h(["grid","y","show"],!1),Oh=h(["grid","y","lines"],[]),Ph=h(["grid","y","ticks"],10),Qh=h(["point","show"],!0),Rh=Qh?h(["point","r"],2.5):0,Sh=h(["point","focus","line","enabled"],!0),Th=h(["point","focus","expand","enabled"],!0),Uh=h(["point","focus","expand","r"],Th?4:Rh),Vh=h(["point","focus","select","r"],8),Wh=h(["line","connect_null"],!1),Xh=h(["bar","width"]),Yh=h(["bar","width","ratio"],.6),Zh=h(["pie","label","show"],!0),$h=h(["pie","label","format"]),_h=h(["pie","expand"],!0),ai=h(["pie","onclick"],function(){}),bi=h(["pie","onmouseover"],function(){}),ci=h(["pie","onmouseout"],function(){}),di=h(["donut","label","show"],!0),ei=h(["donut","label","format"]),fi=h(["donut","expand"],!0),gi=h(["donut","title"],""),hi=h(["donut","onclick"],function(){}),ii=h(["donut","onmouseover"],function(){}),ji=h(["donut","onmouseout"],function(){}),ki=h(["regions"],[]),li=h(["tooltip","show"],!0),mi=h(["tooltip","format","title"]),ni=h(["tooltip","format","value"]),oi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=mi?mi:b,l=ni?ni:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),pi=h(["tooltip","init","show"],!1),qi=h(["tooltip","init","x"],0),ri=h(["tooltip","init","position"],{top:"0px",left:"50px"}),si=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ti=si+"-xaxis",ui=si+"-yaxis",vi=i(si),wi=i(ti),xi=i(ui),yi="timeseries"===bh,zi="categorized"===bh,Ai=!yi&&(sg||we(tg)),Bi=null,Ci=!1,Di=!1,Ei=!1,Fi=!1,Gi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Hi=qe(Gg,we(Ug)?Ug:Gi,Fg),Ii=ch?wf.time.format:wf.time.format.utc,Ji=function(){var a=[[Ii("%Y/%-m/%-d"),function(){return!0}],[Ii("%-m/%-d"),function(a){return a.getMonth()}],[Ii("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ii("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ii("%I %p"),function(a){return a.getHours()}],[Ii("%I:%M"),function(a){return a.getMinutes()}],[Ii(":%S"),function(a){return a.getSeconds()}],[Ii(".%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)}}(),Ki=[],Li=[],Mi=_g?"left":"bottom",Ni=_g?xh?"top":"bottom":xh?"right":"left",Oi=_g?Gh?"bottom":"top":Gh?"left":"right",Pi=_g?"left":"bottom",Qi={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(_g?0:Rf)+")"},y:function(){return"translate(0,"+(_g?Rf:0)+")"},y2:function(){return"translate("+(_g?0:Pf)+","+(_g?1:0)+")"},subx:function(){return"translate(0,"+(_g?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Ri="right"===Wg,Si=0,Ti=0,Ui=0,Vi=.15,Wi=30,Xi=_g&&!ah?0:30,Yi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Zi,$i=function(){var a=wf.svg.line().x(_g?function(a){return V(a.id)(a.value)}:Cd).y(_g?Cd:function(a){return V(a.id)(a.value)});return Wh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Wh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),_i=function(){var a;return a=_g?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a=wf.svg.line().x(_g?function(a){return W(a.id)(a.value)}:Fd).y(_g?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),bj=function(){};Zi=wf.svg.brush().on("brush",_e),Zi.update=function(){return fj&&fj.select("."+f.brush).call(this),this},Zi.scale=function(a){return _g?this.y(a):this.x(a)},Ef&&(bj=wf.behavior.zoom().on("zoomstart",function(){bj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),bj.scale=function(a){return _g?this.y(a):this.x(a)},bj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},bj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(jj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var cj,dj,ej,fj,gj,hj,ij,jj,kj,lj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),cj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?pf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),cj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?qf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Vi),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){Zi.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&zi&&(dh=a.categories,og.categories(dh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},xf.selected=function(a){return wf.merge(ej.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Ig||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Jg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Ig||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Jg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0})},xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Mh=a,$e(),Mh):Mh},xf.xgrids.add=function(a){return a?xf.xgrids(Mh.concat(a)):void 0 },xf.xgrids.remove=function(a){var b=uf(a);return xf.xgrids(Mh.filter(b))},xf.ygrids=function(a){return a?(Oh=a,$e(),Oh):Oh},xf.ygrids.add=function(a){return a?xf.ygrids(Oh.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Oh.filter(b))},xf.regions=function(a){return c(a)?ki:(ki=a,$e(),ki)},xf.regions.add=function(a){return c(a)?ki:(ki=ki.concat(a),$e(),ki)},xf.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;cj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ki=ki.filter(function(b){return b.classes.indexOf(a)<0})}),ki},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(th=+a.y),b(a.y2)&&(Ch=+a.y2)):th=Ch=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){Vg||(Vg=!0,gj.style("visibility","visible")),pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0}),Vg&&ve(a)&&(Vg=!1,gj.style("visibility","hidden"))},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},ij.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From dd3667ff241b9138c317be3ff0b884a70c6aefcb Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Mon, 28 Apr 2014 15:53:45 +0900 Subject: [PATCH 079/178] Fix condition for tick update of category axis --- c3.js | 2 +- c3.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/c3.js b/c3.js index 4fc7e80..3c2c00a 100644 --- a/c3.js +++ b/c3.js @@ -3144,7 +3144,7 @@ if (isCategorized) { // ATTENTION: need to update domain with current domain when categoryAxis - if (targetsToShow.length === 0 || !withUpdateOrgXDomain || withUpdateXDomain) { + if (targetsToShow.length === 0 || !withUpdateOrgXDomain || !withUpdateXDomain) { x.domain([0, xaxis.selectAll('.tick').size()]); } } diff --git a/c3.min.js b/c3.min.js index a805f3e..dfa4f09 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ !function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.32"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cPf&&(Pf=0),0>Rf&&(Rf=0),Qf=_g?Mf.left-Wi-Xi:Pf,Sf=_g?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Ri&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){ej.select("line."+f.xgridFocus).attr("x1",_g?0:-10).attr("x2",_g?Pf:-10).attr("y1",_g?-10:Mf.top).attr("y2",_g?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=_g?f.axisX:f.axisY,b=ej.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:_g?ah?v("x"):1:!sh||xh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Ri?P()+(Bh&&!_g?v("y2"):a):Bh?Gh||_g?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||ah?"x"===a&&ph?ph:"y"!==a||sh?"y2"!==a||Bh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Yi:Vg&&!Ri?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!_g)}function C(){return A(!_g)}function D(){return z(_g)}function E(){return A(_g)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(ph?ph:0)+80:Rf+8}function H(){return F(!_g)}function I(){return G(!_g)}function J(){return F(_g)}function K(){return G(_g)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(zi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Si=a}function N(a){Ti=a}function O(a){Ui=a}function P(){return Vg?Ri?Ti*(Si+1):Tf:0}function Q(){return Vg?Ri?Uf:Ui*(Si+1):0}function R(){var a,b=!ig;ag=_g?1:0,bg=_g?Rf:Pf,cg=_g?0:Rf,dg=_g?Pf:1,eg=ag,fg=bg,gg=_g?0:Sf,hg=_g?Qf:1,ig=T(ag,bg,b?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,b?void 0:jg.domain()),kg=U(cg,dg,b?void 0:kg.domain()),lg=T(ag,bg,jj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,b?void 0:mg.domain()),ng=U(gg,hg,b?void 0:ng.domain()),a=$(),og=X(ig,Mi,a),rg=X(lg,Pi,a),pg=Y(jg,Ni,yh,Ah),qg=Y(kg,Oi,Hh,Jh),b||(Zi.scale(lg),Ef&&bj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(yi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),zi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c){var d=(zi?Eb():wf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),zi?(d.tickCentered(eh),ve(gh)&&(gh=!1)):d.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},zi&&d.categories(dh),d}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=yi?Ji:zi?Tc:function(a){return 0>a?a.toFixed(0):a};return fh&&("function"==typeof fh?a=fh:yi&&(a=function(a){return a?Ii(fh)(a):""})),a}function _(a){var b;return"y"===a?b=wh:"y2"===a?b=Fh:"x"===a&&(b=rh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?wh=b:"y2"===a?Fh=b:"x"===a&&(rh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",_g?"inner-top":"inner-right")}function hb(){return fb("y",_g?"inner-right":"inner-top")}function ib(){return fb("y2",_g?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!_g,gb())}function rb(){return nb(_g,hb())}function sb(){return nb(_g,ib())}function tb(){return ob(!_g,gb())}function ub(){return ob(_g,hb())}function vb(){return ob(_g,ib())}function wb(){var a=gb();return _g?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":ph?ph-10:"3em"}function xb(){var a=hb();return _g?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return _g?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!_g,gb())}function Ab(){return pb(_g,hb())}function Bb(){return pb(_g,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?30:b}function Db(){ej.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),ej.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),ej.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.length>0)for(g=Sc(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 wf.max(Object.keys(i).map(function(a){return wf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Dh:uh,n="y2"===c?Ch:th,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Eh:vh,r=ud()&&_g;return 0===l.length?"y2"===c?kg.domain():jg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(jg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&zh&&(f=b(zh.top)?zh.top:e,g=b(zh.bottom)?zh.bottom:e),"y2"===c&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return nh?yi?re(nh):nh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return mh?yi?re(mh):mh:wf.max(a,function(a){return wf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return zi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof oh&&we(oh)?(e=b(oh.left)?oh.left:d,f=b(oh.right)?oh.right:d):e=f="number"==typeof oh?oh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=yi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=yi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?jg:kg;return b="y"===a.axis||"y2"===a.axis?_g?Rf:"start"in a?d(a.start):Rf:_g?"end"in a?ig(yi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),xf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=yi?a?a instanceof Date?a:re(a):re(mc(c,d)):Ai&&!zi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ai&&zi&&0===c&&g&&(0===e&&(dh=[]),dh.push(g)),("undefined"==typeof a[b]||xf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&xf.data.targets[0].values[a-1]?xf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(xf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(yi?new Date(h):h);i.push(d)}return yi||(i=i.sort(function(a,b){return a-b})),i}function Lc(a){Ki=Ki.concat(a)}function Mc(a){Ki=Ki.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Li=Li.concat(a)}function Oc(a){Li=Li.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&li&&(hj.html(oi(a,$(),wd(k),Hi)).style("display","block"),d=hj.property("offsetWidth"),e=hj.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(_g?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),hj.style("top",i+"px").style("left",g+"px"))}function Qd(){hj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});li&&(be(xf.data.targets)||ee(xf.data.targets)||ej.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(_g?"y1":"x1",Cd).attr(_g?"y2":"x2",Cd))}function Sd(){ej.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return Xh?Xh:b?2*a.tickOffset()*Yh/b:0}function $d(a,b){Dc(a).forEach(function(a){lj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&fi||je(a)&&_h}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=_g?1:0,e=_g?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Og(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud).attr("stroke",function(){return Hi(b)}).attr("r",1.4*Vh).transition().duration(100).attr("r",Vh)}function Be(a,b,c){Pg(b,a.node()),ej.select("."+f.selectedCircles+ld(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){Og(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Hi(b)).darker(1)})}function Ee(a,b){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return Hi(b)})}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?ej.selectAll("."+f.circles+ld(c)):ej).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Uh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Rh)}function Ke(a){return ej.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=_g?1:0,f=_g?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 _g?(c=he(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.getBoundingClientRect();return _g?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return _g&&(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(ij=wf.select(zf),ij.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ij.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),jj=ig.domain(),Zi.scale(lg),Ef&&bj.scale(ig),cj=ij.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),dj=cj.append("defs"),dj.append("clipPath").attr("id",si).append("rect").attr("width",Pf).attr("height",Rf),dj.append("clipPath").attr("id",ti).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.append("clipPath").attr("id",ui).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej=cj.append("g").attr("transform",Qi.main),fj=cj.append("g").attr("transform",Qi.context),gj=cj.append("g").attr("transform",Qi.legend),Sg||fj.style("visibility","hidden"),Vg||(gj.style("visibility","hidden"),Li=Cc(xf.data.targets)),hj=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),ah&&ej.append("g").attr("class",f.axisX).attr("clip-path",wi).attr("transform",Qi.x).append("text").attr("class",f.axisXLabel).attr("transform",_g?"rotate(-90)":"").style("text-anchor",zb),sh&&ej.append("g").attr("class",f.axisY).attr("clip-path",xi).attr("transform",Qi.y).append("text").attr("class",f.axisYLabel).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Ab),Bh&&ej.append("g").attr("class",f.axisY2).attr("transform",Qi.y2).append("text").attr("class",f.axisY2Label).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Bb),d=ej.append("g").attr("clip-path",vi).attr("class",f.grid),Kh&&d.append("g").attr("class",f.xgrids),we(Mh)&&d.append("g").attr("class",f.xgridLines),Sh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Nh&&d.append("g").attr("class",f.ygrids),we(Oh)&&d.append("g").attr("class",f.ygridLines),ej.append("g").attr("clip-path",vi).attr("class",f.regions),ej.append("g").attr("clip-path",vi).attr("class",f.chart),c=ej.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?_g?"ns-resize":"ew-resize":null),ej.select("."+f.chart).append("g").attr("class",f.chartBars),ej.select("."+f.chart).append("g").attr("class",f.chartLines),ej.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Qi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),ej.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&ej.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",_g?"ns-resize":"ew-resize").call(bj).on("dblclick.zoom",null),qh&&Zi.extent("function"!=typeof qh?qh:qh(_b())),fj.append("g").attr("clip-path",vi).attr("class",f.chart),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.append("g").attr("clip-path",vi).attr("class",f.brush).call(Zi).selectAll("rect").attr(_g?"width":"height",_g?Qf:Sf),fj.append("g").attr("class",f.axisX).attr("transform",Qi.subx).attr("clip-path",_g?"":wi),ef(xf.data.targets),_g?ej.select("."+f.axisX).style("opacity",0).call(og):(ej.select("."+f.axisY).style("opacity",0).call(pg),ej.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),pi){if(yi&&"string"==typeof qi){for(qi=re(qi),e=0;e0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(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){ee(xf.data.targets)||Hg&&(Bi=a,ej.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ci=!0,Qg())}function Ze(){ee(xf.data.targets)||Hg&&(ej.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),ej.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ci=!1,Rg())}function $e(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=ej.select("."+f.axisX).style("opacity",W?0:1),g=ej.select("."+f.axisY).style("opacity",W?0:1),h=ej.select("."+f.axisY2).style("opacity",W?0:1),e=fj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Vg&&rf(Cc(xf.data.targets),a,O),zi&&(0===X.length||!H||G)&&ig.domain([0,c.selectAll(".tick").size()]),X.length&&(H&&(ig.domain(wf.extent(_b(X))),jj=ig.domain(),Ef&&bj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),Zi.scale(lg)),G&&(ig.domain(Zi.empty()?jj:Zi.extent()),Ef&&bj.scale(ig).updateScaleExtent())),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),(jh||ih)&&X.length&&(S=kh?kh:Kc(Jc(X)),og.tickValues(S),rg.tickValues(S)),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(gh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!_g&&lh&&eb(c,O.axisX,lh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),hj.style("display","none"),o(),ej.select("line."+f.xgridFocus).style("visibility","hidden"),Kh){if("year"===Lh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=ej.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",_g?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",_g?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",_g?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",_g?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(_g?"y1":"x1")===(_g?Rf:0)?0:1}),i.exit().remove()}we(Mh)&&(k=ej.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Mh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",_g?"":"rotate(-90)").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",_g?0:Dd).attr("x2",_g?Pf:Dd).attr("y1",_g?Dd:Mf.top).attr("y2",_g?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",_g?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Nh&&(m=ej.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Ph)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",_g?jg:0).attr("x2",_g?jg:Pf).attr("y1",_g?0:jg).attr("y2",_g?Rf:jg),m.exit().remove()),A&&we(Oh)&&(n=ej.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Oh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",_g?"rotate(-90)":"").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",_g?Ed:0).attr("x2",_g?Ed:Pf).attr("y1",_g?0:Ed).attr("y2",_g?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",_g?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=ej.select("."+f.regions).selectAll("rect."+f.region).data(ki),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=ej.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Hi(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=ej.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return _g?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),ej.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",$i).style("opacity",1),ej.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",_i).style("opacity",kj),q=ej.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Rh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),q.exit().remove(),ej.each(function(){Fi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Fi=!1}),ej.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),ej.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Sg&&(null!==wf.event&&"zoom"===wf.event.type&&Zi.extent(ig.orgDomain()).update(),B&&(!_g&&lh&&eb(e,O.axisSubX,lh),Zi.empty()||Zi.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Hi(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1))),ej.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),ej.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),v=ej.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ai&&!zi?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),ej.select("."+f.eventRects).datum(x?x.values:[]),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",_g?0:y).attr("y",_g?y:0).attr("width",_g?Pf:z).attr("height",_g?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){lj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&bj.altDomain?(ig.domain(bj.altDomain),void bj.scale(ig).updateScaleExtent()):(zi&&ig.orgDomain()[0]===jj[0]&&ig.domain([jj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Di=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){cj.attr("width",Tf).attr("height",Uf),cj.select("#"+si).select("rect").attr("width",Pf).attr("height",Rf),cj.select("#"+ti).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),cj.select("#"+ui).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),cj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),ij.style("max-height",Uf+"px")}function df(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=ej.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Hi(a)}),e=ej.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("fill",function(a){return Hi(a)}).style("stroke","none").style("cursor",function(a){return Jg(a)?"pointer":null}),c=ej.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)}),b.append("path").attr("class",dd).style("opacity",function(){return kj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Hi(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Hi(a)}).style("cursor",function(a){return Jg(a)?"pointer":null}),a.forEach(function(a){ej.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=ej.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Hi(a.data)}).style("cursor",function(a){return Jg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Sg&&(n=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Hi(a)}),l=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)})),cj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Ri?j:i,l=Ri?Q():P();return d&&(x=0,D=0,u=0,v=0),Vg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Ri?v:u,void($g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Ri?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=gj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Xg?Xg(a):xf.toggle(a)}).on("mouseover",function(a){Fi||xf.focus(a),"function"==typeof Yg&&Yg(a)}).on("mouseout",function(a){Fi||xf.revert(),"function"==typeof Zg&&Zg(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ri?h:-200).attr("y",Ri?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ri?i:-200).attr("y",Ri?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Hi(a)}).attr("x",Ri?h:-200).attr("y",Ri?-200:j).attr("width",10).attr("height",10),gj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),gj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),gj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Fi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"]),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","selection","enabled"],!1),Ig=h(["data","selection","grouped"],!1),Jg=h(["data","selection","isselectable"],function(){return!0}),Kg=h(["data","selection","multiple"],!0),Lg=h(["data","onclick"],function(){}),Mg=h(["data","onenter"],function(){}),Ng=h(["data","onleave"],function(){}),Og=h(["data","onselected"],function(){}),Pg=h(["data","onunselected"],function(){}),Qg=h(["data","ondragstart"],function(){}),Rg=h(["data","ondragend"],function(){}),Sg=h(["subchart","show"],!1),Tg=h(["subchart","size","height"],60),Ug=h(["color","pattern"],[]),Vg=h(["legend","show"],!0),Wg=h(["legend","position"],"bottom"),Xg=h(["legend","item","onclick"]),Yg=h(["legend","item","onmouseover"]),Zg=h(["legend","item","onmouseout"]),$g=h(["legend","equally"],!1),_g=h(["axis","rotated"],!1),ah=h(["axis","x","show"],!0),bh=h(["axis","x","type"],"indexed"),ch=h(["axis","x","localtime"],!0),dh=h(["axis","x","categories"],[]),eh=h(["axis","x","tick","centered"],!1),fh=h(["axis","x","tick","format"]),gh=h(["axis","x","tick","culling"],{}),hh=h(["axis","x","tick","culling","max"],10),ih=h(["axis","x","tick","count"]),jh=h(["axis","x","tick","fit"],!0),kh=h(["axis","x","tick","values"],null),lh=h(["axis","x","tick","rotate"]),mh=h(["axis","x","max"],null),nh=h(["axis","x","min"],null),oh=h(["axis","x","padding"],{}),ph=h(["axis","x","height"]),qh=h(["axis","x","default"]),rh=h(["axis","x","label"],{}),sh=h(["axis","y","show"],!0),th=h(["axis","y","max"]),uh=h(["axis","y","min"]),vh=h(["axis","y","center"]),wh=h(["axis","y","label"],{}),xh=h(["axis","y","inner"],!1),yh=h(["axis","y","tick","format"]),zh=h(["axis","y","padding"],{}),Ah=h(["axis","y","ticks"],10),Bh=h(["axis","y2","show"],!1),Ch=h(["axis","y2","max"]),Dh=h(["axis","y2","min"]),Eh=h(["axis","y2","center"]),Fh=h(["axis","y2","label"],{}),Gh=h(["axis","y2","inner"],!1),Hh=h(["axis","y2","tick","format"]),Ih=h(["axis","y2","padding"],{}),Jh=h(["axis","y2","ticks"],10),Kh=h(["grid","x","show"],!1),Lh=h(["grid","x","type"],"tick"),Mh=h(["grid","x","lines"],[]),Nh=h(["grid","y","show"],!1),Oh=h(["grid","y","lines"],[]),Ph=h(["grid","y","ticks"],10),Qh=h(["point","show"],!0),Rh=Qh?h(["point","r"],2.5):0,Sh=h(["point","focus","line","enabled"],!0),Th=h(["point","focus","expand","enabled"],!0),Uh=h(["point","focus","expand","r"],Th?4:Rh),Vh=h(["point","focus","select","r"],8),Wh=h(["line","connect_null"],!1),Xh=h(["bar","width"]),Yh=h(["bar","width","ratio"],.6),Zh=h(["pie","label","show"],!0),$h=h(["pie","label","format"]),_h=h(["pie","expand"],!0),ai=h(["pie","onclick"],function(){}),bi=h(["pie","onmouseover"],function(){}),ci=h(["pie","onmouseout"],function(){}),di=h(["donut","label","show"],!0),ei=h(["donut","label","format"]),fi=h(["donut","expand"],!0),gi=h(["donut","title"],""),hi=h(["donut","onclick"],function(){}),ii=h(["donut","onmouseover"],function(){}),ji=h(["donut","onmouseout"],function(){}),ki=h(["regions"],[]),li=h(["tooltip","show"],!0),mi=h(["tooltip","format","title"]),ni=h(["tooltip","format","value"]),oi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=mi?mi:b,l=ni?ni:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),pi=h(["tooltip","init","show"],!1),qi=h(["tooltip","init","x"],0),ri=h(["tooltip","init","position"],{top:"0px",left:"50px"}),si=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ti=si+"-xaxis",ui=si+"-yaxis",vi=i(si),wi=i(ti),xi=i(ui),yi="timeseries"===bh,zi="categorized"===bh,Ai=!yi&&(sg||we(tg)),Bi=null,Ci=!1,Di=!1,Ei=!1,Fi=!1,Gi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Hi=qe(Gg,we(Ug)?Ug:Gi,Fg),Ii=ch?wf.time.format:wf.time.format.utc,Ji=function(){var a=[[Ii("%Y/%-m/%-d"),function(){return!0}],[Ii("%-m/%-d"),function(a){return a.getMonth()}],[Ii("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ii("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ii("%I %p"),function(a){return a.getHours()}],[Ii("%I:%M"),function(a){return a.getMinutes()}],[Ii(":%S"),function(a){return a.getSeconds()}],[Ii(".%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)}}(),Ki=[],Li=[],Mi=_g?"left":"bottom",Ni=_g?xh?"top":"bottom":xh?"right":"left",Oi=_g?Gh?"bottom":"top":Gh?"left":"right",Pi=_g?"left":"bottom",Qi={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(_g?0:Rf)+")"},y:function(){return"translate(0,"+(_g?Rf:0)+")"},y2:function(){return"translate("+(_g?0:Pf)+","+(_g?1:0)+")"},subx:function(){return"translate(0,"+(_g?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Ri="right"===Wg,Si=0,Ti=0,Ui=0,Vi=.15,Wi=30,Xi=_g&&!ah?0:30,Yi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Zi,$i=function(){var a=wf.svg.line().x(_g?function(a){return V(a.id)(a.value)}:Cd).y(_g?Cd:function(a){return V(a.id)(a.value)});return Wh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Wh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),_i=function(){var a;return a=_g?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a=wf.svg.line().x(_g?function(a){return W(a.id)(a.value)}:Fd).y(_g?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),bj=function(){};Zi=wf.svg.brush().on("brush",_e),Zi.update=function(){return fj&&fj.select("."+f.brush).call(this),this},Zi.scale=function(a){return _g?this.y(a):this.x(a)},Ef&&(bj=wf.behavior.zoom().on("zoomstart",function(){bj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),bj.scale=function(a){return _g?this.y(a):this.x(a)},bj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},bj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(jj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var cj,dj,ej,fj,gj,hj,ij,jj,kj,lj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),cj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?pf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),cj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?qf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Vi),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){Zi.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&zi&&(dh=a.categories,og.categories(dh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},xf.selected=function(a){return wf.merge(ej.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Ig||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Jg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Ig||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Jg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0})},xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Mh=a,$e(),Mh):Mh},xf.xgrids.add=function(a){return a?xf.xgrids(Mh.concat(a)):void 0 +}hj.html(oi(xf.data.targets.map(function(a){return pc(a.values[qi])}),$(),wd(ee(xf.data.targets)),Hi)),hj.style("top",ri.top).style("left",ri.left).style("display","block")}null==a.onresize&&(a.onresize=bf()),a.onresize.add&&(a.onresize.add(Jf),a.onresize.add(function(){df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})}),a.onresize.add(Kf))}function Ue(a){a.append("rect").attr("class",fd).style("cursor",Hg&&Ig?"pointer":null).on("mouseover",function(a,b){if(!Ci&&!ee(xf.data.targets)){var c,d,e=xf.data.targets.map(function(a){return pc(a.values[b])});if(Object.keys(wg).length>0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(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){ee(xf.data.targets)||Hg&&(Bi=a,ej.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ci=!0,Qg())}function Ze(){ee(xf.data.targets)||Hg&&(ej.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),ej.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ci=!1,Rg())}function $e(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=ej.select("."+f.axisX).style("opacity",W?0:1),g=ej.select("."+f.axisY).style("opacity",W?0:1),h=ej.select("."+f.axisY2).style("opacity",W?0:1),e=fj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Vg&&rf(Cc(xf.data.targets),a,O),zi&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),jj=ig.domain(),Ef&&bj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),Zi.scale(lg)),G&&(ig.domain(Zi.empty()?jj:Zi.extent()),Ef&&bj.scale(ig).updateScaleExtent())),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),(jh||ih)&&X.length&&(S=kh?kh:Kc(Jc(X)),og.tickValues(S),rg.tickValues(S)),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(gh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!_g&&lh&&eb(c,O.axisX,lh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),hj.style("display","none"),o(),ej.select("line."+f.xgridFocus).style("visibility","hidden"),Kh){if("year"===Lh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=ej.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",_g?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",_g?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",_g?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",_g?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(_g?"y1":"x1")===(_g?Rf:0)?0:1}),i.exit().remove()}we(Mh)&&(k=ej.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Mh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",_g?"":"rotate(-90)").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",_g?0:Dd).attr("x2",_g?Pf:Dd).attr("y1",_g?Dd:Mf.top).attr("y2",_g?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",_g?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Nh&&(m=ej.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Ph)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",_g?jg:0).attr("x2",_g?jg:Pf).attr("y1",_g?0:jg).attr("y2",_g?Rf:jg),m.exit().remove()),A&&we(Oh)&&(n=ej.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Oh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",_g?"rotate(-90)":"").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",_g?Ed:0).attr("x2",_g?Ed:Pf).attr("y1",_g?0:Ed).attr("y2",_g?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",_g?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=ej.select("."+f.regions).selectAll("rect."+f.region).data(ki),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=ej.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Hi(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=ej.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return _g?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),ej.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",$i).style("opacity",1),ej.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",_i).style("opacity",kj),q=ej.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Rh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),q.exit().remove(),ej.each(function(){Fi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Fi=!1}),ej.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),ej.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Sg&&(null!==wf.event&&"zoom"===wf.event.type&&Zi.extent(ig.orgDomain()).update(),B&&(!_g&&lh&&eb(e,O.axisSubX,lh),Zi.empty()||Zi.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Hi(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1))),ej.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),ej.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),v=ej.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ai&&!zi?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),ej.select("."+f.eventRects).datum(x?x.values:[]),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",_g?0:y).attr("y",_g?y:0).attr("width",_g?Pf:z).attr("height",_g?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){lj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&bj.altDomain?(ig.domain(bj.altDomain),void bj.scale(ig).updateScaleExtent()):(zi&&ig.orgDomain()[0]===jj[0]&&ig.domain([jj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Di=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){cj.attr("width",Tf).attr("height",Uf),cj.select("#"+si).select("rect").attr("width",Pf).attr("height",Rf),cj.select("#"+ti).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),cj.select("#"+ui).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),cj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),ij.style("max-height",Uf+"px")}function df(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=ej.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Hi(a)}),e=ej.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("fill",function(a){return Hi(a)}).style("stroke","none").style("cursor",function(a){return Jg(a)?"pointer":null}),c=ej.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)}),b.append("path").attr("class",dd).style("opacity",function(){return kj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Hi(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Hi(a)}).style("cursor",function(a){return Jg(a)?"pointer":null}),a.forEach(function(a){ej.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=ej.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Hi(a.data)}).style("cursor",function(a){return Jg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Sg&&(n=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Hi(a)}),l=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)})),cj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Ri?j:i,l=Ri?Q():P();return d&&(x=0,D=0,u=0,v=0),Vg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Ri?v:u,void($g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Ri?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=gj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Xg?Xg(a):xf.toggle(a)}).on("mouseover",function(a){Fi||xf.focus(a),"function"==typeof Yg&&Yg(a)}).on("mouseout",function(a){Fi||xf.revert(),"function"==typeof Zg&&Zg(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ri?h:-200).attr("y",Ri?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ri?i:-200).attr("y",Ri?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Hi(a)}).attr("x",Ri?h:-200).attr("y",Ri?-200:j).attr("width",10).attr("height",10),gj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),gj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),gj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Fi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"]),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","selection","enabled"],!1),Ig=h(["data","selection","grouped"],!1),Jg=h(["data","selection","isselectable"],function(){return!0}),Kg=h(["data","selection","multiple"],!0),Lg=h(["data","onclick"],function(){}),Mg=h(["data","onenter"],function(){}),Ng=h(["data","onleave"],function(){}),Og=h(["data","onselected"],function(){}),Pg=h(["data","onunselected"],function(){}),Qg=h(["data","ondragstart"],function(){}),Rg=h(["data","ondragend"],function(){}),Sg=h(["subchart","show"],!1),Tg=h(["subchart","size","height"],60),Ug=h(["color","pattern"],[]),Vg=h(["legend","show"],!0),Wg=h(["legend","position"],"bottom"),Xg=h(["legend","item","onclick"]),Yg=h(["legend","item","onmouseover"]),Zg=h(["legend","item","onmouseout"]),$g=h(["legend","equally"],!1),_g=h(["axis","rotated"],!1),ah=h(["axis","x","show"],!0),bh=h(["axis","x","type"],"indexed"),ch=h(["axis","x","localtime"],!0),dh=h(["axis","x","categories"],[]),eh=h(["axis","x","tick","centered"],!1),fh=h(["axis","x","tick","format"]),gh=h(["axis","x","tick","culling"],{}),hh=h(["axis","x","tick","culling","max"],10),ih=h(["axis","x","tick","count"]),jh=h(["axis","x","tick","fit"],!0),kh=h(["axis","x","tick","values"],null),lh=h(["axis","x","tick","rotate"]),mh=h(["axis","x","max"],null),nh=h(["axis","x","min"],null),oh=h(["axis","x","padding"],{}),ph=h(["axis","x","height"]),qh=h(["axis","x","default"]),rh=h(["axis","x","label"],{}),sh=h(["axis","y","show"],!0),th=h(["axis","y","max"]),uh=h(["axis","y","min"]),vh=h(["axis","y","center"]),wh=h(["axis","y","label"],{}),xh=h(["axis","y","inner"],!1),yh=h(["axis","y","tick","format"]),zh=h(["axis","y","padding"],{}),Ah=h(["axis","y","ticks"],10),Bh=h(["axis","y2","show"],!1),Ch=h(["axis","y2","max"]),Dh=h(["axis","y2","min"]),Eh=h(["axis","y2","center"]),Fh=h(["axis","y2","label"],{}),Gh=h(["axis","y2","inner"],!1),Hh=h(["axis","y2","tick","format"]),Ih=h(["axis","y2","padding"],{}),Jh=h(["axis","y2","ticks"],10),Kh=h(["grid","x","show"],!1),Lh=h(["grid","x","type"],"tick"),Mh=h(["grid","x","lines"],[]),Nh=h(["grid","y","show"],!1),Oh=h(["grid","y","lines"],[]),Ph=h(["grid","y","ticks"],10),Qh=h(["point","show"],!0),Rh=Qh?h(["point","r"],2.5):0,Sh=h(["point","focus","line","enabled"],!0),Th=h(["point","focus","expand","enabled"],!0),Uh=h(["point","focus","expand","r"],Th?4:Rh),Vh=h(["point","focus","select","r"],8),Wh=h(["line","connect_null"],!1),Xh=h(["bar","width"]),Yh=h(["bar","width","ratio"],.6),Zh=h(["pie","label","show"],!0),$h=h(["pie","label","format"]),_h=h(["pie","expand"],!0),ai=h(["pie","onclick"],function(){}),bi=h(["pie","onmouseover"],function(){}),ci=h(["pie","onmouseout"],function(){}),di=h(["donut","label","show"],!0),ei=h(["donut","label","format"]),fi=h(["donut","expand"],!0),gi=h(["donut","title"],""),hi=h(["donut","onclick"],function(){}),ii=h(["donut","onmouseover"],function(){}),ji=h(["donut","onmouseout"],function(){}),ki=h(["regions"],[]),li=h(["tooltip","show"],!0),mi=h(["tooltip","format","title"]),ni=h(["tooltip","format","value"]),oi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=mi?mi:b,l=ni?ni:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),pi=h(["tooltip","init","show"],!1),qi=h(["tooltip","init","x"],0),ri=h(["tooltip","init","position"],{top:"0px",left:"50px"}),si=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ti=si+"-xaxis",ui=si+"-yaxis",vi=i(si),wi=i(ti),xi=i(ui),yi="timeseries"===bh,zi="categorized"===bh,Ai=!yi&&(sg||we(tg)),Bi=null,Ci=!1,Di=!1,Ei=!1,Fi=!1,Gi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Hi=qe(Gg,we(Ug)?Ug:Gi,Fg),Ii=ch?wf.time.format:wf.time.format.utc,Ji=function(){var a=[[Ii("%Y/%-m/%-d"),function(){return!0}],[Ii("%-m/%-d"),function(a){return a.getMonth()}],[Ii("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ii("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ii("%I %p"),function(a){return a.getHours()}],[Ii("%I:%M"),function(a){return a.getMinutes()}],[Ii(":%S"),function(a){return a.getSeconds()}],[Ii(".%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)}}(),Ki=[],Li=[],Mi=_g?"left":"bottom",Ni=_g?xh?"top":"bottom":xh?"right":"left",Oi=_g?Gh?"bottom":"top":Gh?"left":"right",Pi=_g?"left":"bottom",Qi={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(_g?0:Rf)+")"},y:function(){return"translate(0,"+(_g?Rf:0)+")"},y2:function(){return"translate("+(_g?0:Pf)+","+(_g?1:0)+")"},subx:function(){return"translate(0,"+(_g?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Ri="right"===Wg,Si=0,Ti=0,Ui=0,Vi=.15,Wi=30,Xi=_g&&!ah?0:30,Yi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Zi,$i=function(){var a=wf.svg.line().x(_g?function(a){return V(a.id)(a.value)}:Cd).y(_g?Cd:function(a){return V(a.id)(a.value)});return Wh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Wh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),_i=function(){var a;return a=_g?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a=wf.svg.line().x(_g?function(a){return W(a.id)(a.value)}:Fd).y(_g?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),bj=function(){};Zi=wf.svg.brush().on("brush",_e),Zi.update=function(){return fj&&fj.select("."+f.brush).call(this),this},Zi.scale=function(a){return _g?this.y(a):this.x(a)},Ef&&(bj=wf.behavior.zoom().on("zoomstart",function(){bj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),bj.scale=function(a){return _g?this.y(a):this.x(a)},bj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},bj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(jj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var cj,dj,ej,fj,gj,hj,ij,jj,kj,lj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),cj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?pf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),cj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?qf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Vi),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){Zi.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&zi&&(dh=a.categories,og.categories(dh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},xf.selected=function(a){return wf.merge(ej.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Ig||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Jg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Ig||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Jg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0})},xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Mh=a,$e(),Mh):Mh},xf.xgrids.add=function(a){return a?xf.xgrids(Mh.concat(a)):void 0 },xf.xgrids.remove=function(a){var b=uf(a);return xf.xgrids(Mh.filter(b))},xf.ygrids=function(a){return a?(Oh=a,$e(),Oh):Oh},xf.ygrids.add=function(a){return a?xf.ygrids(Oh.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Oh.filter(b))},xf.regions=function(a){return c(a)?ki:(ki=a,$e(),ki)},xf.regions.add=function(a){return c(a)?ki:(ki=ki.concat(a),$e(),ki)},xf.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;cj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ki=ki.filter(function(b){return b.classes.indexOf(a)<0})}),ki},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(th=+a.y),b(a.y2)&&(Ch=+a.y2)):th=Ch=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){Vg||(Vg=!0,gj.style("visibility","visible")),pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0}),Vg&&ve(a)&&(Vg=!1,gj.style("visibility","hidden"))},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},ij.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 96979be2f836cb2f72b4c989423f4119b908d5f4 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Mon, 28 Apr 2014 16:42:38 +0900 Subject: [PATCH 080/178] Fix x axis tick logic - #151 --- c3.js | 31 +++++++++++++++---------------- c3.min.js | 6 +++--- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/c3.js b/c3.js index 3c2c00a..03a40f6 100644 --- a/c3.js +++ b/c3.js @@ -578,7 +578,7 @@ //-- Scales --// function updateScales() { - var xAxisTickFormat, forInit = !x; + var xAxisTickFormat, xAxisTickValues, forInit = !x; // update edges xMin = __axis_rotated ? 1 : 0; xMax = __axis_rotated ? height : width; @@ -597,8 +597,9 @@ subY2 = getY(subYMin, subYMax, forInit ? undefined : subY2.domain()); // update axes xAxisTickFormat = getXAxisTickFormat(); - xAxis = getXAxis(x, xOrient, xAxisTickFormat); - subXAxis = getXAxis(subX, subXOrient, xAxisTickFormat); + xAxisTickValues = __axis_x_tick_values ? __axis_x_tick_values : (forInit ? undefined : xAxis.tickValues()); + xAxis = getXAxis(x, xOrient, xAxisTickFormat, xAxisTickValues); + subXAxis = getXAxis(subX, subXOrient, xAxisTickFormat, xAxisTickValues); yAxis = getYAxis(y, yOrient, __axis_y_tick_format, __axis_y_ticks); y2Axis = getYAxis(y2, y2Orient, __axis_y2_tick_format, __axis_y2_ticks); // Set initialized scales to brush and zoom @@ -655,11 +656,11 @@ //-- Axes --// - function getXAxis(scale, orient, tickFormat) { + function getXAxis(scale, orient, tickFormat, tickValues) { var axis = (isCategorized ? categoryAxis() : d3.svg.axis()).scale(scale).orient(orient); // Set tick - axis.tickFormat(tickFormat); + axis.tickFormat(tickFormat).tickValues(tickValues); if (isCategorized) { axis.tickCentered(__axis_x_tick_centered); if (isEmpty(__axis_x_tick_culling)) { @@ -1628,11 +1629,10 @@ var xs = d3.set(d3.merge(targets.map(function (t) { return t.values.map(function (v) { return v.x; }); }))).values(); return isTimeSeries ? xs.map(function (x) { return new Date(x); }) : xs.map(function (x) { return +x; }); } - function generateTickValues(xs) { + function generateTickValues(xs, tickCount) { var tickValues = xs, targetCount, start, end, count, interval, i, tickValue; - if (__axis_x_tick_count) { - // TODO: need some arguments for __axis_x_tick_count()? - targetCount = typeof __axis_x_tick_count === 'function' ? __axis_x_tick_count() : __axis_x_tick_count; + if (tickCount) { + targetCount = typeof tickCount === 'function' ? tickCount() : tickCount; // compute ticks according to __axis_x_tick_count if (targetCount === 1) { tickValues = [xs[0]]; @@ -3162,18 +3162,17 @@ x.domain(brush.empty() ? orgXDomain : brush.extent()); if (__zoom_enabled) { zoom.scale(x).updateScaleExtent(); } } + // update axis tick values according to options + if (!__axis_x_tick_values && (__axis_x_tick_fit || __axis_x_tick_count)) { + tickValues = generateTickValues(mapTargetsToUniqueXs(targetsToShow), __axis_x_tick_count); + xAxis.tickValues(tickValues); + subXAxis.tickValues(tickValues); + } } y.domain(getYDomain(targetsToShow, 'y')); y2.domain(getYDomain(targetsToShow, 'y2')); - // update axis tick values according to options - if ((__axis_x_tick_fit || __axis_x_tick_count) && targetsToShow.length) { - tickValues = __axis_x_tick_values ? __axis_x_tick_values : generateTickValues(mapTargetsToUniqueXs(targetsToShow)); - xAxis.tickValues(tickValues); - subXAxis.tickValues(tickValues); - } - // axes transitions.axisX.call(xAxis); transitions.axisY.call(yAxis); diff --git a/c3.min.js b/c3.min.js index dfa4f09..1f0ebff 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.32"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cPf&&(Pf=0),0>Rf&&(Rf=0),Qf=_g?Mf.left-Wi-Xi:Pf,Sf=_g?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Ri&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){ej.select("line."+f.xgridFocus).attr("x1",_g?0:-10).attr("x2",_g?Pf:-10).attr("y1",_g?-10:Mf.top).attr("y2",_g?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=_g?f.axisX:f.axisY,b=ej.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:_g?ah?v("x"):1:!sh||xh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Ri?P()+(Bh&&!_g?v("y2"):a):Bh?Gh||_g?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||ah?"x"===a&&ph?ph:"y"!==a||sh?"y2"!==a||Bh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Yi:Vg&&!Ri?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!_g)}function C(){return A(!_g)}function D(){return z(_g)}function E(){return A(_g)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(ph?ph:0)+80:Rf+8}function H(){return F(!_g)}function I(){return G(!_g)}function J(){return F(_g)}function K(){return G(_g)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(zi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Si=a}function N(a){Ti=a}function O(a){Ui=a}function P(){return Vg?Ri?Ti*(Si+1):Tf:0}function Q(){return Vg?Ri?Uf:Ui*(Si+1):0}function R(){var a,b=!ig;ag=_g?1:0,bg=_g?Rf:Pf,cg=_g?0:Rf,dg=_g?Pf:1,eg=ag,fg=bg,gg=_g?0:Sf,hg=_g?Qf:1,ig=T(ag,bg,b?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,b?void 0:jg.domain()),kg=U(cg,dg,b?void 0:kg.domain()),lg=T(ag,bg,jj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,b?void 0:mg.domain()),ng=U(gg,hg,b?void 0:ng.domain()),a=$(),og=X(ig,Mi,a),rg=X(lg,Pi,a),pg=Y(jg,Ni,yh,Ah),qg=Y(kg,Oi,Hh,Jh),b||(Zi.scale(lg),Ef&&bj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(yi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),zi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c){var d=(zi?Eb():wf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),zi?(d.tickCentered(eh),ve(gh)&&(gh=!1)):d.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},zi&&d.categories(dh),d}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=yi?Ji:zi?Tc:function(a){return 0>a?a.toFixed(0):a};return fh&&("function"==typeof fh?a=fh:yi&&(a=function(a){return a?Ii(fh)(a):""})),a}function _(a){var b;return"y"===a?b=wh:"y2"===a?b=Fh:"x"===a&&(b=rh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?wh=b:"y2"===a?Fh=b:"x"===a&&(rh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",_g?"inner-top":"inner-right")}function hb(){return fb("y",_g?"inner-right":"inner-top")}function ib(){return fb("y2",_g?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!_g,gb())}function rb(){return nb(_g,hb())}function sb(){return nb(_g,ib())}function tb(){return ob(!_g,gb())}function ub(){return ob(_g,hb())}function vb(){return ob(_g,ib())}function wb(){var a=gb();return _g?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":ph?ph-10:"3em"}function xb(){var a=hb();return _g?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return _g?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!_g,gb())}function Ab(){return pb(_g,hb())}function Bb(){return pb(_g,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?30:b}function Db(){ej.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),ej.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),ej.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.length>0)for(g=Sc(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 wf.max(Object.keys(i).map(function(a){return wf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Dh:uh,n="y2"===c?Ch:th,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Eh:vh,r=ud()&&_g;return 0===l.length?"y2"===c?kg.domain():jg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(jg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&zh&&(f=b(zh.top)?zh.top:e,g=b(zh.bottom)?zh.bottom:e),"y2"===c&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return nh?yi?re(nh):nh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return mh?yi?re(mh):mh:wf.max(a,function(a){return wf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return zi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof oh&&we(oh)?(e=b(oh.left)?oh.left:d,f=b(oh.right)?oh.right:d):e=f="number"==typeof oh?oh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=yi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=yi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?jg:kg;return b="y"===a.axis||"y2"===a.axis?_g?Rf:"start"in a?d(a.start):Rf:_g?"end"in a?ig(yi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),xf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=yi?a?a instanceof Date?a:re(a):re(mc(c,d)):Ai&&!zi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ai&&zi&&0===c&&g&&(0===e&&(dh=[]),dh.push(g)),("undefined"==typeof a[b]||xf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&xf.data.targets[0].values[a-1]?xf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(xf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(yi?new Date(h):h);i.push(d)}return yi||(i=i.sort(function(a,b){return a-b})),i}function Lc(a){Ki=Ki.concat(a)}function Mc(a){Ki=Ki.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Li=Li.concat(a)}function Oc(a){Li=Li.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&li&&(hj.html(oi(a,$(),wd(k),Hi)).style("display","block"),d=hj.property("offsetWidth"),e=hj.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(_g?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),hj.style("top",i+"px").style("left",g+"px"))}function Qd(){hj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});li&&(be(xf.data.targets)||ee(xf.data.targets)||ej.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(_g?"y1":"x1",Cd).attr(_g?"y2":"x2",Cd))}function Sd(){ej.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return Xh?Xh:b?2*a.tickOffset()*Yh/b:0}function $d(a,b){Dc(a).forEach(function(a){lj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&fi||je(a)&&_h}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=_g?1:0,e=_g?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Og(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud).attr("stroke",function(){return Hi(b)}).attr("r",1.4*Vh).transition().duration(100).attr("r",Vh)}function Be(a,b,c){Pg(b,a.node()),ej.select("."+f.selectedCircles+ld(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){Og(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Hi(b)).darker(1)})}function Ee(a,b){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return Hi(b)})}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?ej.selectAll("."+f.circles+ld(c)):ej).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Uh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Rh)}function Ke(a){return ej.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=_g?1:0,f=_g?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 _g?(c=he(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.getBoundingClientRect();return _g?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return _g&&(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(ij=wf.select(zf),ij.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ij.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),jj=ig.domain(),Zi.scale(lg),Ef&&bj.scale(ig),cj=ij.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),dj=cj.append("defs"),dj.append("clipPath").attr("id",si).append("rect").attr("width",Pf).attr("height",Rf),dj.append("clipPath").attr("id",ti).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.append("clipPath").attr("id",ui).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej=cj.append("g").attr("transform",Qi.main),fj=cj.append("g").attr("transform",Qi.context),gj=cj.append("g").attr("transform",Qi.legend),Sg||fj.style("visibility","hidden"),Vg||(gj.style("visibility","hidden"),Li=Cc(xf.data.targets)),hj=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),ah&&ej.append("g").attr("class",f.axisX).attr("clip-path",wi).attr("transform",Qi.x).append("text").attr("class",f.axisXLabel).attr("transform",_g?"rotate(-90)":"").style("text-anchor",zb),sh&&ej.append("g").attr("class",f.axisY).attr("clip-path",xi).attr("transform",Qi.y).append("text").attr("class",f.axisYLabel).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Ab),Bh&&ej.append("g").attr("class",f.axisY2).attr("transform",Qi.y2).append("text").attr("class",f.axisY2Label).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Bb),d=ej.append("g").attr("clip-path",vi).attr("class",f.grid),Kh&&d.append("g").attr("class",f.xgrids),we(Mh)&&d.append("g").attr("class",f.xgridLines),Sh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Nh&&d.append("g").attr("class",f.ygrids),we(Oh)&&d.append("g").attr("class",f.ygridLines),ej.append("g").attr("clip-path",vi).attr("class",f.regions),ej.append("g").attr("clip-path",vi).attr("class",f.chart),c=ej.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?_g?"ns-resize":"ew-resize":null),ej.select("."+f.chart).append("g").attr("class",f.chartBars),ej.select("."+f.chart).append("g").attr("class",f.chartLines),ej.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Qi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),ej.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&ej.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",_g?"ns-resize":"ew-resize").call(bj).on("dblclick.zoom",null),qh&&Zi.extent("function"!=typeof qh?qh:qh(_b())),fj.append("g").attr("clip-path",vi).attr("class",f.chart),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.append("g").attr("clip-path",vi).attr("class",f.brush).call(Zi).selectAll("rect").attr(_g?"width":"height",_g?Qf:Sf),fj.append("g").attr("class",f.axisX).attr("transform",Qi.subx).attr("clip-path",_g?"":wi),ef(xf.data.targets),_g?ej.select("."+f.axisX).style("opacity",0).call(og):(ej.select("."+f.axisY).style("opacity",0).call(pg),ej.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),pi){if(yi&&"string"==typeof qi){for(qi=re(qi),e=0;e0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(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){ee(xf.data.targets)||Hg&&(Bi=a,ej.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ci=!0,Qg())}function Ze(){ee(xf.data.targets)||Hg&&(ej.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),ej.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ci=!1,Rg())}function $e(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=ej.select("."+f.axisX).style("opacity",W?0:1),g=ej.select("."+f.axisY).style("opacity",W?0:1),h=ej.select("."+f.axisY2).style("opacity",W?0:1),e=fj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Vg&&rf(Cc(xf.data.targets),a,O),zi&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),jj=ig.domain(),Ef&&bj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),Zi.scale(lg)),G&&(ig.domain(Zi.empty()?jj:Zi.extent()),Ef&&bj.scale(ig).updateScaleExtent())),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),(jh||ih)&&X.length&&(S=kh?kh:Kc(Jc(X)),og.tickValues(S),rg.tickValues(S)),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(gh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!_g&&lh&&eb(c,O.axisX,lh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),hj.style("display","none"),o(),ej.select("line."+f.xgridFocus).style("visibility","hidden"),Kh){if("year"===Lh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=ej.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",_g?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",_g?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",_g?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",_g?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(_g?"y1":"x1")===(_g?Rf:0)?0:1}),i.exit().remove()}we(Mh)&&(k=ej.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Mh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",_g?"":"rotate(-90)").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",_g?0:Dd).attr("x2",_g?Pf:Dd).attr("y1",_g?Dd:Mf.top).attr("y2",_g?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",_g?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Nh&&(m=ej.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Ph)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",_g?jg:0).attr("x2",_g?jg:Pf).attr("y1",_g?0:jg).attr("y2",_g?Rf:jg),m.exit().remove()),A&&we(Oh)&&(n=ej.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Oh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",_g?"rotate(-90)":"").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",_g?Ed:0).attr("x2",_g?Ed:Pf).attr("y1",_g?0:Ed).attr("y2",_g?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",_g?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=ej.select("."+f.regions).selectAll("rect."+f.region).data(ki),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=ej.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Hi(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=ej.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return _g?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),ej.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",$i).style("opacity",1),ej.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",_i).style("opacity",kj),q=ej.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Rh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),q.exit().remove(),ej.each(function(){Fi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Fi=!1}),ej.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),ej.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Sg&&(null!==wf.event&&"zoom"===wf.event.type&&Zi.extent(ig.orgDomain()).update(),B&&(!_g&&lh&&eb(e,O.axisSubX,lh),Zi.empty()||Zi.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Hi(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1))),ej.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),ej.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),v=ej.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ai&&!zi?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),ej.select("."+f.eventRects).datum(x?x.values:[]),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",_g?0:y).attr("y",_g?y:0).attr("width",_g?Pf:z).attr("height",_g?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){lj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&bj.altDomain?(ig.domain(bj.altDomain),void bj.scale(ig).updateScaleExtent()):(zi&&ig.orgDomain()[0]===jj[0]&&ig.domain([jj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Di=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){cj.attr("width",Tf).attr("height",Uf),cj.select("#"+si).select("rect").attr("width",Pf).attr("height",Rf),cj.select("#"+ti).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),cj.select("#"+ui).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),cj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),ij.style("max-height",Uf+"px")}function df(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=ej.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Hi(a)}),e=ej.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("fill",function(a){return Hi(a)}).style("stroke","none").style("cursor",function(a){return Jg(a)?"pointer":null}),c=ej.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)}),b.append("path").attr("class",dd).style("opacity",function(){return kj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Hi(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Hi(a)}).style("cursor",function(a){return Jg(a)?"pointer":null}),a.forEach(function(a){ej.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=ej.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Hi(a.data)}).style("cursor",function(a){return Jg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Sg&&(n=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Hi(a)}),l=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)})),cj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Ri?j:i,l=Ri?Q():P();return d&&(x=0,D=0,u=0,v=0),Vg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Ri?v:u,void($g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Ri?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=gj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Xg?Xg(a):xf.toggle(a)}).on("mouseover",function(a){Fi||xf.focus(a),"function"==typeof Yg&&Yg(a)}).on("mouseout",function(a){Fi||xf.revert(),"function"==typeof Zg&&Zg(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ri?h:-200).attr("y",Ri?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ri?i:-200).attr("y",Ri?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Hi(a)}).attr("x",Ri?h:-200).attr("y",Ri?-200:j).attr("width",10).attr("height",10),gj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),gj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),gj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Fi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"]),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","selection","enabled"],!1),Ig=h(["data","selection","grouped"],!1),Jg=h(["data","selection","isselectable"],function(){return!0}),Kg=h(["data","selection","multiple"],!0),Lg=h(["data","onclick"],function(){}),Mg=h(["data","onenter"],function(){}),Ng=h(["data","onleave"],function(){}),Og=h(["data","onselected"],function(){}),Pg=h(["data","onunselected"],function(){}),Qg=h(["data","ondragstart"],function(){}),Rg=h(["data","ondragend"],function(){}),Sg=h(["subchart","show"],!1),Tg=h(["subchart","size","height"],60),Ug=h(["color","pattern"],[]),Vg=h(["legend","show"],!0),Wg=h(["legend","position"],"bottom"),Xg=h(["legend","item","onclick"]),Yg=h(["legend","item","onmouseover"]),Zg=h(["legend","item","onmouseout"]),$g=h(["legend","equally"],!1),_g=h(["axis","rotated"],!1),ah=h(["axis","x","show"],!0),bh=h(["axis","x","type"],"indexed"),ch=h(["axis","x","localtime"],!0),dh=h(["axis","x","categories"],[]),eh=h(["axis","x","tick","centered"],!1),fh=h(["axis","x","tick","format"]),gh=h(["axis","x","tick","culling"],{}),hh=h(["axis","x","tick","culling","max"],10),ih=h(["axis","x","tick","count"]),jh=h(["axis","x","tick","fit"],!0),kh=h(["axis","x","tick","values"],null),lh=h(["axis","x","tick","rotate"]),mh=h(["axis","x","max"],null),nh=h(["axis","x","min"],null),oh=h(["axis","x","padding"],{}),ph=h(["axis","x","height"]),qh=h(["axis","x","default"]),rh=h(["axis","x","label"],{}),sh=h(["axis","y","show"],!0),th=h(["axis","y","max"]),uh=h(["axis","y","min"]),vh=h(["axis","y","center"]),wh=h(["axis","y","label"],{}),xh=h(["axis","y","inner"],!1),yh=h(["axis","y","tick","format"]),zh=h(["axis","y","padding"],{}),Ah=h(["axis","y","ticks"],10),Bh=h(["axis","y2","show"],!1),Ch=h(["axis","y2","max"]),Dh=h(["axis","y2","min"]),Eh=h(["axis","y2","center"]),Fh=h(["axis","y2","label"],{}),Gh=h(["axis","y2","inner"],!1),Hh=h(["axis","y2","tick","format"]),Ih=h(["axis","y2","padding"],{}),Jh=h(["axis","y2","ticks"],10),Kh=h(["grid","x","show"],!1),Lh=h(["grid","x","type"],"tick"),Mh=h(["grid","x","lines"],[]),Nh=h(["grid","y","show"],!1),Oh=h(["grid","y","lines"],[]),Ph=h(["grid","y","ticks"],10),Qh=h(["point","show"],!0),Rh=Qh?h(["point","r"],2.5):0,Sh=h(["point","focus","line","enabled"],!0),Th=h(["point","focus","expand","enabled"],!0),Uh=h(["point","focus","expand","r"],Th?4:Rh),Vh=h(["point","focus","select","r"],8),Wh=h(["line","connect_null"],!1),Xh=h(["bar","width"]),Yh=h(["bar","width","ratio"],.6),Zh=h(["pie","label","show"],!0),$h=h(["pie","label","format"]),_h=h(["pie","expand"],!0),ai=h(["pie","onclick"],function(){}),bi=h(["pie","onmouseover"],function(){}),ci=h(["pie","onmouseout"],function(){}),di=h(["donut","label","show"],!0),ei=h(["donut","label","format"]),fi=h(["donut","expand"],!0),gi=h(["donut","title"],""),hi=h(["donut","onclick"],function(){}),ii=h(["donut","onmouseover"],function(){}),ji=h(["donut","onmouseout"],function(){}),ki=h(["regions"],[]),li=h(["tooltip","show"],!0),mi=h(["tooltip","format","title"]),ni=h(["tooltip","format","value"]),oi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=mi?mi:b,l=ni?ni:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),pi=h(["tooltip","init","show"],!1),qi=h(["tooltip","init","x"],0),ri=h(["tooltip","init","position"],{top:"0px",left:"50px"}),si=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ti=si+"-xaxis",ui=si+"-yaxis",vi=i(si),wi=i(ti),xi=i(ui),yi="timeseries"===bh,zi="categorized"===bh,Ai=!yi&&(sg||we(tg)),Bi=null,Ci=!1,Di=!1,Ei=!1,Fi=!1,Gi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Hi=qe(Gg,we(Ug)?Ug:Gi,Fg),Ii=ch?wf.time.format:wf.time.format.utc,Ji=function(){var a=[[Ii("%Y/%-m/%-d"),function(){return!0}],[Ii("%-m/%-d"),function(a){return a.getMonth()}],[Ii("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ii("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ii("%I %p"),function(a){return a.getHours()}],[Ii("%I:%M"),function(a){return a.getMinutes()}],[Ii(":%S"),function(a){return a.getSeconds()}],[Ii(".%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)}}(),Ki=[],Li=[],Mi=_g?"left":"bottom",Ni=_g?xh?"top":"bottom":xh?"right":"left",Oi=_g?Gh?"bottom":"top":Gh?"left":"right",Pi=_g?"left":"bottom",Qi={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(_g?0:Rf)+")"},y:function(){return"translate(0,"+(_g?Rf:0)+")"},y2:function(){return"translate("+(_g?0:Pf)+","+(_g?1:0)+")"},subx:function(){return"translate(0,"+(_g?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Ri="right"===Wg,Si=0,Ti=0,Ui=0,Vi=.15,Wi=30,Xi=_g&&!ah?0:30,Yi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Zi,$i=function(){var a=wf.svg.line().x(_g?function(a){return V(a.id)(a.value)}:Cd).y(_g?Cd:function(a){return V(a.id)(a.value)});return Wh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Wh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),_i=function(){var a;return a=_g?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a=wf.svg.line().x(_g?function(a){return W(a.id)(a.value)}:Fd).y(_g?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),bj=function(){};Zi=wf.svg.brush().on("brush",_e),Zi.update=function(){return fj&&fj.select("."+f.brush).call(this),this},Zi.scale=function(a){return _g?this.y(a):this.x(a)},Ef&&(bj=wf.behavior.zoom().on("zoomstart",function(){bj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),bj.scale=function(a){return _g?this.y(a):this.x(a)},bj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},bj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(jj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var cj,dj,ej,fj,gj,hj,ij,jj,kj,lj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),cj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?pf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),cj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?qf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Vi),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){Zi.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&zi&&(dh=a.categories,og.categories(dh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},xf.selected=function(a){return wf.merge(ej.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Ig||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Jg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Ig||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Jg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0})},xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Mh=a,$e(),Mh):Mh},xf.xgrids.add=function(a){return a?xf.xgrids(Mh.concat(a)):void 0 -},xf.xgrids.remove=function(a){var b=uf(a);return xf.xgrids(Mh.filter(b))},xf.ygrids=function(a){return a?(Oh=a,$e(),Oh):Oh},xf.ygrids.add=function(a){return a?xf.ygrids(Oh.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Oh.filter(b))},xf.regions=function(a){return c(a)?ki:(ki=a,$e(),ki)},xf.regions.add=function(a){return c(a)?ki:(ki=ki.concat(a),$e(),ki)},xf.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;cj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ki=ki.filter(function(b){return b.classes.indexOf(a)<0})}),ki},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(th=+a.y),b(a.y2)&&(Ch=+a.y2)):th=Ch=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){Vg||(Vg=!0,gj.style("visibility","visible")),pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0}),Vg&&ve(a)&&(Vg=!1,gj.style("visibility","hidden"))},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},ij.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"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.32"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cPf&&(Pf=0),0>Rf&&(Rf=0),Qf=_g?Mf.left-Wi-Xi:Pf,Sf=_g?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Ri&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){ej.select("line."+f.xgridFocus).attr("x1",_g?0:-10).attr("x2",_g?Pf:-10).attr("y1",_g?-10:Mf.top).attr("y2",_g?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=_g?f.axisX:f.axisY,b=ej.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:_g?ah?v("x"):1:!sh||xh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Ri?P()+(Bh&&!_g?v("y2"):a):Bh?Gh||_g?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||ah?"x"===a&&ph?ph:"y"!==a||sh?"y2"!==a||Bh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Yi:Vg&&!Ri?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!_g)}function C(){return A(!_g)}function D(){return z(_g)}function E(){return A(_g)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(ph?ph:0)+80:Rf+8}function H(){return F(!_g)}function I(){return G(!_g)}function J(){return F(_g)}function K(){return G(_g)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(zi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Si=a}function N(a){Ti=a}function O(a){Ui=a}function P(){return Vg?Ri?Ti*(Si+1):Tf:0}function Q(){return Vg?Ri?Uf:Ui*(Si+1):0}function R(){var a,b,c=!ig;ag=_g?1:0,bg=_g?Rf:Pf,cg=_g?0:Rf,dg=_g?Pf:1,eg=ag,fg=bg,gg=_g?0:Sf,hg=_g?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,jj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=kh?kh:c?void 0:og.tickValues(),og=X(ig,Mi,a,b),rg=X(lg,Pi,a,b),pg=Y(jg,Ni,yh,Ah),qg=Y(kg,Oi,Hh,Jh),c||(Zi.scale(lg),Ef&&bj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(yi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),zi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(zi?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),zi?(e.tickCentered(eh),ve(gh)&&(gh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},zi&&e.categories(dh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=yi?Ji:zi?Tc:function(a){return 0>a?a.toFixed(0):a};return fh&&("function"==typeof fh?a=fh:yi&&(a=function(a){return a?Ii(fh)(a):""})),a}function _(a){var b;return"y"===a?b=wh:"y2"===a?b=Fh:"x"===a&&(b=rh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?wh=b:"y2"===a?Fh=b:"x"===a&&(rh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",_g?"inner-top":"inner-right")}function hb(){return fb("y",_g?"inner-right":"inner-top")}function ib(){return fb("y2",_g?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!_g,gb())}function rb(){return nb(_g,hb())}function sb(){return nb(_g,ib())}function tb(){return ob(!_g,gb())}function ub(){return ob(_g,hb())}function vb(){return ob(_g,ib())}function wb(){var a=gb();return _g?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":ph?ph-10:"3em"}function xb(){var a=hb();return _g?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return _g?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!_g,gb())}function Ab(){return pb(_g,hb())}function Bb(){return pb(_g,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?30:b}function Db(){ej.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),ej.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),ej.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.length>0)for(g=Sc(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 wf.max(Object.keys(i).map(function(a){return wf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Dh:uh,n="y2"===c?Ch:th,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Eh:vh,r=ud()&&_g;return 0===l.length?"y2"===c?kg.domain():jg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(jg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&zh&&(f=b(zh.top)?zh.top:e,g=b(zh.bottom)?zh.bottom:e),"y2"===c&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return nh?yi?re(nh):nh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return mh?yi?re(mh):mh:wf.max(a,function(a){return wf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return zi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof oh&&we(oh)?(e=b(oh.left)?oh.left:d,f=b(oh.right)?oh.right:d):e=f="number"==typeof oh?oh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=yi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=yi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?jg:kg;return b="y"===a.axis||"y2"===a.axis?_g?Rf:"start"in a?d(a.start):Rf:_g?"end"in a?ig(yi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),xf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=yi?a?a instanceof Date?a:re(a):re(mc(c,d)):Ai&&!zi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ai&&zi&&0===c&&g&&(0===e&&(dh=[]),dh.push(g)),("undefined"==typeof a[b]||xf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&xf.data.targets[0].values[a-1]?xf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(xf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(yi?new Date(i):i);j.push(e)}return yi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Ki=Ki.concat(a)}function Mc(a){Ki=Ki.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Li=Li.concat(a)}function Oc(a){Li=Li.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&li&&(hj.html(oi(a,$(),wd(k),Hi)).style("display","block"),d=hj.property("offsetWidth"),e=hj.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(_g?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),hj.style("top",i+"px").style("left",g+"px"))}function Qd(){hj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});li&&(be(xf.data.targets)||ee(xf.data.targets)||ej.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(_g?"y1":"x1",Cd).attr(_g?"y2":"x2",Cd))}function Sd(){ej.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return Xh?Xh:b?2*a.tickOffset()*Yh/b:0}function $d(a,b){Dc(a).forEach(function(a){lj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&fi||je(a)&&_h}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=_g?1:0,e=_g?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Og(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud).attr("stroke",function(){return Hi(b)}).attr("r",1.4*Vh).transition().duration(100).attr("r",Vh)}function Be(a,b,c){Pg(b,a.node()),ej.select("."+f.selectedCircles+ld(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){Og(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Hi(b)).darker(1)})}function Ee(a,b){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return Hi(b)})}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?ej.selectAll("."+f.circles+ld(c)):ej).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Uh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Rh)}function Ke(a){return ej.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=_g?1:0,f=_g?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 _g?(c=he(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.getBoundingClientRect();return _g?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return _g&&(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(ij=wf.select(zf),ij.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ij.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),jj=ig.domain(),Zi.scale(lg),Ef&&bj.scale(ig),cj=ij.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),dj=cj.append("defs"),dj.append("clipPath").attr("id",si).append("rect").attr("width",Pf).attr("height",Rf),dj.append("clipPath").attr("id",ti).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.append("clipPath").attr("id",ui).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej=cj.append("g").attr("transform",Qi.main),fj=cj.append("g").attr("transform",Qi.context),gj=cj.append("g").attr("transform",Qi.legend),Sg||fj.style("visibility","hidden"),Vg||(gj.style("visibility","hidden"),Li=Cc(xf.data.targets)),hj=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),ah&&ej.append("g").attr("class",f.axisX).attr("clip-path",wi).attr("transform",Qi.x).append("text").attr("class",f.axisXLabel).attr("transform",_g?"rotate(-90)":"").style("text-anchor",zb),sh&&ej.append("g").attr("class",f.axisY).attr("clip-path",xi).attr("transform",Qi.y).append("text").attr("class",f.axisYLabel).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Ab),Bh&&ej.append("g").attr("class",f.axisY2).attr("transform",Qi.y2).append("text").attr("class",f.axisY2Label).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Bb),d=ej.append("g").attr("clip-path",vi).attr("class",f.grid),Kh&&d.append("g").attr("class",f.xgrids),we(Mh)&&d.append("g").attr("class",f.xgridLines),Sh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Nh&&d.append("g").attr("class",f.ygrids),we(Oh)&&d.append("g").attr("class",f.ygridLines),ej.append("g").attr("clip-path",vi).attr("class",f.regions),ej.append("g").attr("clip-path",vi).attr("class",f.chart),c=ej.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?_g?"ns-resize":"ew-resize":null),ej.select("."+f.chart).append("g").attr("class",f.chartBars),ej.select("."+f.chart).append("g").attr("class",f.chartLines),ej.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Qi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),ej.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&ej.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",_g?"ns-resize":"ew-resize").call(bj).on("dblclick.zoom",null),qh&&Zi.extent("function"!=typeof qh?qh:qh(_b())),fj.append("g").attr("clip-path",vi).attr("class",f.chart),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.append("g").attr("clip-path",vi).attr("class",f.brush).call(Zi).selectAll("rect").attr(_g?"width":"height",_g?Qf:Sf),fj.append("g").attr("class",f.axisX).attr("transform",Qi.subx).attr("clip-path",_g?"":wi),ef(xf.data.targets),_g?ej.select("."+f.axisX).style("opacity",0).call(og):(ej.select("."+f.axisY).style("opacity",0).call(pg),ej.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),pi){if(yi&&"string"==typeof qi){for(qi=re(qi),e=0;e0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(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){ee(xf.data.targets)||Hg&&(Bi=a,ej.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ci=!0,Qg())}function Ze(){ee(xf.data.targets)||Hg&&(ej.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),ej.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ci=!1,Rg())}function $e(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=ej.select("."+f.axisX).style("opacity",W?0:1),g=ej.select("."+f.axisY).style("opacity",W?0:1),h=ej.select("."+f.axisY2).style("opacity",W?0:1),e=fj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Vg&&rf(Cc(xf.data.targets),a,O),zi&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),jj=ig.domain(),Ef&&bj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),Zi.scale(lg)),G&&(ig.domain(Zi.empty()?jj:Zi.extent()),Ef&&bj.scale(ig).updateScaleExtent()),kh||!jh&&!ih||(S=Kc(Jc(X),ih),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(gh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!_g&&lh&&eb(c,O.axisX,lh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),hj.style("display","none"),o(),ej.select("line."+f.xgridFocus).style("visibility","hidden"),Kh){if("year"===Lh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=ej.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",_g?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",_g?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",_g?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",_g?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(_g?"y1":"x1")===(_g?Rf:0)?0:1}),i.exit().remove()}we(Mh)&&(k=ej.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Mh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",_g?"":"rotate(-90)").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",_g?0:Dd).attr("x2",_g?Pf:Dd).attr("y1",_g?Dd:Mf.top).attr("y2",_g?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",_g?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Nh&&(m=ej.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Ph)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",_g?jg:0).attr("x2",_g?jg:Pf).attr("y1",_g?0:jg).attr("y2",_g?Rf:jg),m.exit().remove()),A&&we(Oh)&&(n=ej.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Oh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",_g?"rotate(-90)":"").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",_g?Ed:0).attr("x2",_g?Ed:Pf).attr("y1",_g?0:Ed).attr("y2",_g?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",_g?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=ej.select("."+f.regions).selectAll("rect."+f.region).data(ki),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=ej.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Hi(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=ej.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return _g?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),ej.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",$i).style("opacity",1),ej.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",_i).style("opacity",kj),q=ej.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Rh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),q.exit().remove(),ej.each(function(){Fi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Fi=!1}),ej.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),ej.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Sg&&(null!==wf.event&&"zoom"===wf.event.type&&Zi.extent(ig.orgDomain()).update(),B&&(!_g&&lh&&eb(e,O.axisSubX,lh),Zi.empty()||Zi.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Hi(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1))),ej.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),ej.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),v=ej.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ai&&!zi?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),ej.select("."+f.eventRects).datum(x?x.values:[]),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",_g?0:y).attr("y",_g?y:0).attr("width",_g?Pf:z).attr("height",_g?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){lj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&bj.altDomain?(ig.domain(bj.altDomain),void bj.scale(ig).updateScaleExtent()):(zi&&ig.orgDomain()[0]===jj[0]&&ig.domain([jj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Di=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){cj.attr("width",Tf).attr("height",Uf),cj.select("#"+si).select("rect").attr("width",Pf).attr("height",Rf),cj.select("#"+ti).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),cj.select("#"+ui).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),cj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),ij.style("max-height",Uf+"px")}function df(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=ej.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Hi(a)}),e=ej.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("fill",function(a){return Hi(a)}).style("stroke","none").style("cursor",function(a){return Jg(a)?"pointer":null}),c=ej.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)}),b.append("path").attr("class",dd).style("opacity",function(){return kj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Hi(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Hi(a)}).style("cursor",function(a){return Jg(a)?"pointer":null}),a.forEach(function(a){ej.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=ej.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Hi(a.data)}).style("cursor",function(a){return Jg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Sg&&(n=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Hi(a)}),l=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)})),cj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Ri?j:i,l=Ri?Q():P();return d&&(x=0,D=0,u=0,v=0),Vg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Ri?v:u,void($g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Ri?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=gj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Xg?Xg(a):xf.toggle(a)}).on("mouseover",function(a){Fi||xf.focus(a),"function"==typeof Yg&&Yg(a)}).on("mouseout",function(a){Fi||xf.revert(),"function"==typeof Zg&&Zg(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ri?h:-200).attr("y",Ri?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ri?i:-200).attr("y",Ri?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Hi(a)}).attr("x",Ri?h:-200).attr("y",Ri?-200:j).attr("width",10).attr("height",10),gj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),gj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),gj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Fi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"]),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","selection","enabled"],!1),Ig=h(["data","selection","grouped"],!1),Jg=h(["data","selection","isselectable"],function(){return!0}),Kg=h(["data","selection","multiple"],!0),Lg=h(["data","onclick"],function(){}),Mg=h(["data","onenter"],function(){}),Ng=h(["data","onleave"],function(){}),Og=h(["data","onselected"],function(){}),Pg=h(["data","onunselected"],function(){}),Qg=h(["data","ondragstart"],function(){}),Rg=h(["data","ondragend"],function(){}),Sg=h(["subchart","show"],!1),Tg=h(["subchart","size","height"],60),Ug=h(["color","pattern"],[]),Vg=h(["legend","show"],!0),Wg=h(["legend","position"],"bottom"),Xg=h(["legend","item","onclick"]),Yg=h(["legend","item","onmouseover"]),Zg=h(["legend","item","onmouseout"]),$g=h(["legend","equally"],!1),_g=h(["axis","rotated"],!1),ah=h(["axis","x","show"],!0),bh=h(["axis","x","type"],"indexed"),ch=h(["axis","x","localtime"],!0),dh=h(["axis","x","categories"],[]),eh=h(["axis","x","tick","centered"],!1),fh=h(["axis","x","tick","format"]),gh=h(["axis","x","tick","culling"],{}),hh=h(["axis","x","tick","culling","max"],10),ih=h(["axis","x","tick","count"]),jh=h(["axis","x","tick","fit"],!0),kh=h(["axis","x","tick","values"],null),lh=h(["axis","x","tick","rotate"]),mh=h(["axis","x","max"],null),nh=h(["axis","x","min"],null),oh=h(["axis","x","padding"],{}),ph=h(["axis","x","height"]),qh=h(["axis","x","default"]),rh=h(["axis","x","label"],{}),sh=h(["axis","y","show"],!0),th=h(["axis","y","max"]),uh=h(["axis","y","min"]),vh=h(["axis","y","center"]),wh=h(["axis","y","label"],{}),xh=h(["axis","y","inner"],!1),yh=h(["axis","y","tick","format"]),zh=h(["axis","y","padding"],{}),Ah=h(["axis","y","ticks"],10),Bh=h(["axis","y2","show"],!1),Ch=h(["axis","y2","max"]),Dh=h(["axis","y2","min"]),Eh=h(["axis","y2","center"]),Fh=h(["axis","y2","label"],{}),Gh=h(["axis","y2","inner"],!1),Hh=h(["axis","y2","tick","format"]),Ih=h(["axis","y2","padding"],{}),Jh=h(["axis","y2","ticks"],10),Kh=h(["grid","x","show"],!1),Lh=h(["grid","x","type"],"tick"),Mh=h(["grid","x","lines"],[]),Nh=h(["grid","y","show"],!1),Oh=h(["grid","y","lines"],[]),Ph=h(["grid","y","ticks"],10),Qh=h(["point","show"],!0),Rh=Qh?h(["point","r"],2.5):0,Sh=h(["point","focus","line","enabled"],!0),Th=h(["point","focus","expand","enabled"],!0),Uh=h(["point","focus","expand","r"],Th?4:Rh),Vh=h(["point","focus","select","r"],8),Wh=h(["line","connect_null"],!1),Xh=h(["bar","width"]),Yh=h(["bar","width","ratio"],.6),Zh=h(["pie","label","show"],!0),$h=h(["pie","label","format"]),_h=h(["pie","expand"],!0),ai=h(["pie","onclick"],function(){}),bi=h(["pie","onmouseover"],function(){}),ci=h(["pie","onmouseout"],function(){}),di=h(["donut","label","show"],!0),ei=h(["donut","label","format"]),fi=h(["donut","expand"],!0),gi=h(["donut","title"],""),hi=h(["donut","onclick"],function(){}),ii=h(["donut","onmouseover"],function(){}),ji=h(["donut","onmouseout"],function(){}),ki=h(["regions"],[]),li=h(["tooltip","show"],!0),mi=h(["tooltip","format","title"]),ni=h(["tooltip","format","value"]),oi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=mi?mi:b,l=ni?ni:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),pi=h(["tooltip","init","show"],!1),qi=h(["tooltip","init","x"],0),ri=h(["tooltip","init","position"],{top:"0px",left:"50px"}),si=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ti=si+"-xaxis",ui=si+"-yaxis",vi=i(si),wi=i(ti),xi=i(ui),yi="timeseries"===bh,zi="categorized"===bh,Ai=!yi&&(sg||we(tg)),Bi=null,Ci=!1,Di=!1,Ei=!1,Fi=!1,Gi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Hi=qe(Gg,we(Ug)?Ug:Gi,Fg),Ii=ch?wf.time.format:wf.time.format.utc,Ji=function(){var a=[[Ii("%Y/%-m/%-d"),function(){return!0}],[Ii("%-m/%-d"),function(a){return a.getMonth()}],[Ii("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ii("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ii("%I %p"),function(a){return a.getHours()}],[Ii("%I:%M"),function(a){return a.getMinutes()}],[Ii(":%S"),function(a){return a.getSeconds()}],[Ii(".%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)}}(),Ki=[],Li=[],Mi=_g?"left":"bottom",Ni=_g?xh?"top":"bottom":xh?"right":"left",Oi=_g?Gh?"bottom":"top":Gh?"left":"right",Pi=_g?"left":"bottom",Qi={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(_g?0:Rf)+")"},y:function(){return"translate(0,"+(_g?Rf:0)+")"},y2:function(){return"translate("+(_g?0:Pf)+","+(_g?1:0)+")"},subx:function(){return"translate(0,"+(_g?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Ri="right"===Wg,Si=0,Ti=0,Ui=0,Vi=.15,Wi=30,Xi=_g&&!ah?0:30,Yi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Zi,$i=function(){var a=wf.svg.line().x(_g?function(a){return V(a.id)(a.value)}:Cd).y(_g?Cd:function(a){return V(a.id)(a.value)});return Wh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Wh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),_i=function(){var a;return a=_g?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a=wf.svg.line().x(_g?function(a){return W(a.id)(a.value)}:Fd).y(_g?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),bj=function(){};Zi=wf.svg.brush().on("brush",_e),Zi.update=function(){return fj&&fj.select("."+f.brush).call(this),this},Zi.scale=function(a){return _g?this.y(a):this.x(a)},Ef&&(bj=wf.behavior.zoom().on("zoomstart",function(){bj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),bj.scale=function(a){return _g?this.y(a):this.x(a)},bj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},bj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(jj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var cj,dj,ej,fj,gj,hj,ij,jj,kj,lj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),cj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?pf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),cj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?qf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Vi),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){Zi.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&zi&&(dh=a.categories,og.categories(dh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},xf.selected=function(a){return wf.merge(ej.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Ig||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Jg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Ig||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Jg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0})},xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Mh=a,$e(),Mh):Mh},xf.xgrids.add=function(a){return a?xf.xgrids(Mh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a); +return xf.xgrids(Mh.filter(b))},xf.ygrids=function(a){return a?(Oh=a,$e(),Oh):Oh},xf.ygrids.add=function(a){return a?xf.ygrids(Oh.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Oh.filter(b))},xf.regions=function(a){return c(a)?ki:(ki=a,$e(),ki)},xf.regions.add=function(a){return c(a)?ki:(ki=ki.concat(a),$e(),ki)},xf.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;cj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ki=ki.filter(function(b){return b.classes.indexOf(a)<0})}),ki},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(th=+a.y),b(a.y2)&&(Ch=+a.y2)):th=Ch=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){Vg||(Vg=!0,gj.style("visibility","visible")),pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0}),Vg&&ve(a)&&(Vg=!1,gj.style("visibility","hidden"))},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},ij.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From b8b89a6ea1a9ef6f7c098f870c68a1880d8543b2 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Tue, 29 Apr 2014 16:48:31 +0900 Subject: [PATCH 081/178] Remove useless fill style for bar --- c3.js | 1 - 1 file changed, 1 deletion(-) diff --git a/c3.js b/c3.js index 03a40f6..c9e0a45 100644 --- a/c3.js +++ b/c3.js @@ -3672,7 +3672,6 @@ // Bars for each data mainBarEnter.append('g') .attr("class", classBars) - .style("fill", function (d) { return color(d); }) .style("stroke", "none") .style("cursor", function (d) { return __data_selection_isselectable(d) ? "pointer" : null; }); From 3a55f7dff91150fef5c38da1f7e5d9a614a7b1cf Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Tue, 29 Apr 2014 17:09:45 +0900 Subject: [PATCH 082/178] Add done callback for unload - #182 --- c3.js | 3 ++- c3.min.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/c3.js b/c3.js index c9e0a45..ca8f613 100644 --- a/c3.js +++ b/c3.js @@ -4233,9 +4233,10 @@ } }; - c3.unload = function (targetIds) { + c3.unload = function (targetIds, done) { unload(mapToTargetIds(targetIds), function () { redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: true}); + if (typeof done === 'function') { done(); } }); }; diff --git a/c3.min.js b/c3.min.js index 1f0ebff..5d0abce 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ !function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.32"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cPf&&(Pf=0),0>Rf&&(Rf=0),Qf=_g?Mf.left-Wi-Xi:Pf,Sf=_g?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Ri&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){ej.select("line."+f.xgridFocus).attr("x1",_g?0:-10).attr("x2",_g?Pf:-10).attr("y1",_g?-10:Mf.top).attr("y2",_g?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=_g?f.axisX:f.axisY,b=ej.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:_g?ah?v("x"):1:!sh||xh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Ri?P()+(Bh&&!_g?v("y2"):a):Bh?Gh||_g?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||ah?"x"===a&&ph?ph:"y"!==a||sh?"y2"!==a||Bh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Yi:Vg&&!Ri?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!_g)}function C(){return A(!_g)}function D(){return z(_g)}function E(){return A(_g)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(ph?ph:0)+80:Rf+8}function H(){return F(!_g)}function I(){return G(!_g)}function J(){return F(_g)}function K(){return G(_g)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(zi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Si=a}function N(a){Ti=a}function O(a){Ui=a}function P(){return Vg?Ri?Ti*(Si+1):Tf:0}function Q(){return Vg?Ri?Uf:Ui*(Si+1):0}function R(){var a,b,c=!ig;ag=_g?1:0,bg=_g?Rf:Pf,cg=_g?0:Rf,dg=_g?Pf:1,eg=ag,fg=bg,gg=_g?0:Sf,hg=_g?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,jj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=kh?kh:c?void 0:og.tickValues(),og=X(ig,Mi,a,b),rg=X(lg,Pi,a,b),pg=Y(jg,Ni,yh,Ah),qg=Y(kg,Oi,Hh,Jh),c||(Zi.scale(lg),Ef&&bj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(yi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),zi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(zi?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),zi?(e.tickCentered(eh),ve(gh)&&(gh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},zi&&e.categories(dh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=yi?Ji:zi?Tc:function(a){return 0>a?a.toFixed(0):a};return fh&&("function"==typeof fh?a=fh:yi&&(a=function(a){return a?Ii(fh)(a):""})),a}function _(a){var b;return"y"===a?b=wh:"y2"===a?b=Fh:"x"===a&&(b=rh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?wh=b:"y2"===a?Fh=b:"x"===a&&(rh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",_g?"inner-top":"inner-right")}function hb(){return fb("y",_g?"inner-right":"inner-top")}function ib(){return fb("y2",_g?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!_g,gb())}function rb(){return nb(_g,hb())}function sb(){return nb(_g,ib())}function tb(){return ob(!_g,gb())}function ub(){return ob(_g,hb())}function vb(){return ob(_g,ib())}function wb(){var a=gb();return _g?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":ph?ph-10:"3em"}function xb(){var a=hb();return _g?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return _g?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!_g,gb())}function Ab(){return pb(_g,hb())}function Bb(){return pb(_g,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?30:b}function Db(){ej.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),ej.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),ej.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.length>0)for(g=Sc(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 wf.max(Object.keys(i).map(function(a){return wf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Dh:uh,n="y2"===c?Ch:th,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Eh:vh,r=ud()&&_g;return 0===l.length?"y2"===c?kg.domain():jg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(jg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&zh&&(f=b(zh.top)?zh.top:e,g=b(zh.bottom)?zh.bottom:e),"y2"===c&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return nh?yi?re(nh):nh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return mh?yi?re(mh):mh:wf.max(a,function(a){return wf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return zi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof oh&&we(oh)?(e=b(oh.left)?oh.left:d,f=b(oh.right)?oh.right:d):e=f="number"==typeof oh?oh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=yi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=yi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?jg:kg;return b="y"===a.axis||"y2"===a.axis?_g?Rf:"start"in a?d(a.start):Rf:_g?"end"in a?ig(yi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),xf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=yi?a?a instanceof Date?a:re(a):re(mc(c,d)):Ai&&!zi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ai&&zi&&0===c&&g&&(0===e&&(dh=[]),dh.push(g)),("undefined"==typeof a[b]||xf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&xf.data.targets[0].values[a-1]?xf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(xf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(yi?new Date(i):i);j.push(e)}return yi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Ki=Ki.concat(a)}function Mc(a){Ki=Ki.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Li=Li.concat(a)}function Oc(a){Li=Li.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&li&&(hj.html(oi(a,$(),wd(k),Hi)).style("display","block"),d=hj.property("offsetWidth"),e=hj.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(_g?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),hj.style("top",i+"px").style("left",g+"px"))}function Qd(){hj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});li&&(be(xf.data.targets)||ee(xf.data.targets)||ej.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(_g?"y1":"x1",Cd).attr(_g?"y2":"x2",Cd))}function Sd(){ej.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return Xh?Xh:b?2*a.tickOffset()*Yh/b:0}function $d(a,b){Dc(a).forEach(function(a){lj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&fi||je(a)&&_h}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=_g?1:0,e=_g?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Og(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud).attr("stroke",function(){return Hi(b)}).attr("r",1.4*Vh).transition().duration(100).attr("r",Vh)}function Be(a,b,c){Pg(b,a.node()),ej.select("."+f.selectedCircles+ld(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){Og(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Hi(b)).darker(1)})}function Ee(a,b){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return Hi(b)})}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?ej.selectAll("."+f.circles+ld(c)):ej).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Uh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Rh)}function Ke(a){return ej.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=_g?1:0,f=_g?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 _g?(c=he(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.getBoundingClientRect();return _g?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return _g&&(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(ij=wf.select(zf),ij.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ij.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),jj=ig.domain(),Zi.scale(lg),Ef&&bj.scale(ig),cj=ij.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),dj=cj.append("defs"),dj.append("clipPath").attr("id",si).append("rect").attr("width",Pf).attr("height",Rf),dj.append("clipPath").attr("id",ti).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.append("clipPath").attr("id",ui).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej=cj.append("g").attr("transform",Qi.main),fj=cj.append("g").attr("transform",Qi.context),gj=cj.append("g").attr("transform",Qi.legend),Sg||fj.style("visibility","hidden"),Vg||(gj.style("visibility","hidden"),Li=Cc(xf.data.targets)),hj=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),ah&&ej.append("g").attr("class",f.axisX).attr("clip-path",wi).attr("transform",Qi.x).append("text").attr("class",f.axisXLabel).attr("transform",_g?"rotate(-90)":"").style("text-anchor",zb),sh&&ej.append("g").attr("class",f.axisY).attr("clip-path",xi).attr("transform",Qi.y).append("text").attr("class",f.axisYLabel).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Ab),Bh&&ej.append("g").attr("class",f.axisY2).attr("transform",Qi.y2).append("text").attr("class",f.axisY2Label).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Bb),d=ej.append("g").attr("clip-path",vi).attr("class",f.grid),Kh&&d.append("g").attr("class",f.xgrids),we(Mh)&&d.append("g").attr("class",f.xgridLines),Sh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Nh&&d.append("g").attr("class",f.ygrids),we(Oh)&&d.append("g").attr("class",f.ygridLines),ej.append("g").attr("clip-path",vi).attr("class",f.regions),ej.append("g").attr("clip-path",vi).attr("class",f.chart),c=ej.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?_g?"ns-resize":"ew-resize":null),ej.select("."+f.chart).append("g").attr("class",f.chartBars),ej.select("."+f.chart).append("g").attr("class",f.chartLines),ej.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Qi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),ej.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&ej.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",_g?"ns-resize":"ew-resize").call(bj).on("dblclick.zoom",null),qh&&Zi.extent("function"!=typeof qh?qh:qh(_b())),fj.append("g").attr("clip-path",vi).attr("class",f.chart),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.append("g").attr("clip-path",vi).attr("class",f.brush).call(Zi).selectAll("rect").attr(_g?"width":"height",_g?Qf:Sf),fj.append("g").attr("class",f.axisX).attr("transform",Qi.subx).attr("clip-path",_g?"":wi),ef(xf.data.targets),_g?ej.select("."+f.axisX).style("opacity",0).call(og):(ej.select("."+f.axisY).style("opacity",0).call(pg),ej.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),pi){if(yi&&"string"==typeof qi){for(qi=re(qi),e=0;e0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(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){ee(xf.data.targets)||Hg&&(Bi=a,ej.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ci=!0,Qg())}function Ze(){ee(xf.data.targets)||Hg&&(ej.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),ej.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ci=!1,Rg())}function $e(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=ej.select("."+f.axisX).style("opacity",W?0:1),g=ej.select("."+f.axisY).style("opacity",W?0:1),h=ej.select("."+f.axisY2).style("opacity",W?0:1),e=fj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Vg&&rf(Cc(xf.data.targets),a,O),zi&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),jj=ig.domain(),Ef&&bj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),Zi.scale(lg)),G&&(ig.domain(Zi.empty()?jj:Zi.extent()),Ef&&bj.scale(ig).updateScaleExtent()),kh||!jh&&!ih||(S=Kc(Jc(X),ih),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(gh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!_g&&lh&&eb(c,O.axisX,lh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),hj.style("display","none"),o(),ej.select("line."+f.xgridFocus).style("visibility","hidden"),Kh){if("year"===Lh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=ej.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",_g?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",_g?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",_g?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",_g?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(_g?"y1":"x1")===(_g?Rf:0)?0:1}),i.exit().remove()}we(Mh)&&(k=ej.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Mh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",_g?"":"rotate(-90)").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",_g?0:Dd).attr("x2",_g?Pf:Dd).attr("y1",_g?Dd:Mf.top).attr("y2",_g?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",_g?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Nh&&(m=ej.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Ph)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",_g?jg:0).attr("x2",_g?jg:Pf).attr("y1",_g?0:jg).attr("y2",_g?Rf:jg),m.exit().remove()),A&&we(Oh)&&(n=ej.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Oh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",_g?"rotate(-90)":"").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",_g?Ed:0).attr("x2",_g?Ed:Pf).attr("y1",_g?0:Ed).attr("y2",_g?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",_g?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=ej.select("."+f.regions).selectAll("rect."+f.region).data(ki),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=ej.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Hi(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=ej.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return _g?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),ej.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",$i).style("opacity",1),ej.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",_i).style("opacity",kj),q=ej.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Rh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),q.exit().remove(),ej.each(function(){Fi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Fi=!1}),ej.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),ej.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Sg&&(null!==wf.event&&"zoom"===wf.event.type&&Zi.extent(ig.orgDomain()).update(),B&&(!_g&&lh&&eb(e,O.axisSubX,lh),Zi.empty()||Zi.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Hi(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1))),ej.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),ej.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),v=ej.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ai&&!zi?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),ej.select("."+f.eventRects).datum(x?x.values:[]),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",_g?0:y).attr("y",_g?y:0).attr("width",_g?Pf:z).attr("height",_g?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){lj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&bj.altDomain?(ig.domain(bj.altDomain),void bj.scale(ig).updateScaleExtent()):(zi&&ig.orgDomain()[0]===jj[0]&&ig.domain([jj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Di=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){cj.attr("width",Tf).attr("height",Uf),cj.select("#"+si).select("rect").attr("width",Pf).attr("height",Rf),cj.select("#"+ti).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),cj.select("#"+ui).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),cj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),ij.style("max-height",Uf+"px")}function df(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=ej.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Hi(a)}),e=ej.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("fill",function(a){return Hi(a)}).style("stroke","none").style("cursor",function(a){return Jg(a)?"pointer":null}),c=ej.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)}),b.append("path").attr("class",dd).style("opacity",function(){return kj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Hi(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Hi(a)}).style("cursor",function(a){return Jg(a)?"pointer":null}),a.forEach(function(a){ej.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=ej.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Hi(a.data)}).style("cursor",function(a){return Jg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Sg&&(n=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Hi(a)}),l=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)})),cj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Ri?j:i,l=Ri?Q():P();return d&&(x=0,D=0,u=0,v=0),Vg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Ri?v:u,void($g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Ri?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=gj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Xg?Xg(a):xf.toggle(a)}).on("mouseover",function(a){Fi||xf.focus(a),"function"==typeof Yg&&Yg(a)}).on("mouseout",function(a){Fi||xf.revert(),"function"==typeof Zg&&Zg(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ri?h:-200).attr("y",Ri?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ri?i:-200).attr("y",Ri?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Hi(a)}).attr("x",Ri?h:-200).attr("y",Ri?-200:j).attr("width",10).attr("height",10),gj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),gj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),gj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Fi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"]),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","selection","enabled"],!1),Ig=h(["data","selection","grouped"],!1),Jg=h(["data","selection","isselectable"],function(){return!0}),Kg=h(["data","selection","multiple"],!0),Lg=h(["data","onclick"],function(){}),Mg=h(["data","onenter"],function(){}),Ng=h(["data","onleave"],function(){}),Og=h(["data","onselected"],function(){}),Pg=h(["data","onunselected"],function(){}),Qg=h(["data","ondragstart"],function(){}),Rg=h(["data","ondragend"],function(){}),Sg=h(["subchart","show"],!1),Tg=h(["subchart","size","height"],60),Ug=h(["color","pattern"],[]),Vg=h(["legend","show"],!0),Wg=h(["legend","position"],"bottom"),Xg=h(["legend","item","onclick"]),Yg=h(["legend","item","onmouseover"]),Zg=h(["legend","item","onmouseout"]),$g=h(["legend","equally"],!1),_g=h(["axis","rotated"],!1),ah=h(["axis","x","show"],!0),bh=h(["axis","x","type"],"indexed"),ch=h(["axis","x","localtime"],!0),dh=h(["axis","x","categories"],[]),eh=h(["axis","x","tick","centered"],!1),fh=h(["axis","x","tick","format"]),gh=h(["axis","x","tick","culling"],{}),hh=h(["axis","x","tick","culling","max"],10),ih=h(["axis","x","tick","count"]),jh=h(["axis","x","tick","fit"],!0),kh=h(["axis","x","tick","values"],null),lh=h(["axis","x","tick","rotate"]),mh=h(["axis","x","max"],null),nh=h(["axis","x","min"],null),oh=h(["axis","x","padding"],{}),ph=h(["axis","x","height"]),qh=h(["axis","x","default"]),rh=h(["axis","x","label"],{}),sh=h(["axis","y","show"],!0),th=h(["axis","y","max"]),uh=h(["axis","y","min"]),vh=h(["axis","y","center"]),wh=h(["axis","y","label"],{}),xh=h(["axis","y","inner"],!1),yh=h(["axis","y","tick","format"]),zh=h(["axis","y","padding"],{}),Ah=h(["axis","y","ticks"],10),Bh=h(["axis","y2","show"],!1),Ch=h(["axis","y2","max"]),Dh=h(["axis","y2","min"]),Eh=h(["axis","y2","center"]),Fh=h(["axis","y2","label"],{}),Gh=h(["axis","y2","inner"],!1),Hh=h(["axis","y2","tick","format"]),Ih=h(["axis","y2","padding"],{}),Jh=h(["axis","y2","ticks"],10),Kh=h(["grid","x","show"],!1),Lh=h(["grid","x","type"],"tick"),Mh=h(["grid","x","lines"],[]),Nh=h(["grid","y","show"],!1),Oh=h(["grid","y","lines"],[]),Ph=h(["grid","y","ticks"],10),Qh=h(["point","show"],!0),Rh=Qh?h(["point","r"],2.5):0,Sh=h(["point","focus","line","enabled"],!0),Th=h(["point","focus","expand","enabled"],!0),Uh=h(["point","focus","expand","r"],Th?4:Rh),Vh=h(["point","focus","select","r"],8),Wh=h(["line","connect_null"],!1),Xh=h(["bar","width"]),Yh=h(["bar","width","ratio"],.6),Zh=h(["pie","label","show"],!0),$h=h(["pie","label","format"]),_h=h(["pie","expand"],!0),ai=h(["pie","onclick"],function(){}),bi=h(["pie","onmouseover"],function(){}),ci=h(["pie","onmouseout"],function(){}),di=h(["donut","label","show"],!0),ei=h(["donut","label","format"]),fi=h(["donut","expand"],!0),gi=h(["donut","title"],""),hi=h(["donut","onclick"],function(){}),ii=h(["donut","onmouseover"],function(){}),ji=h(["donut","onmouseout"],function(){}),ki=h(["regions"],[]),li=h(["tooltip","show"],!0),mi=h(["tooltip","format","title"]),ni=h(["tooltip","format","value"]),oi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=mi?mi:b,l=ni?ni:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),pi=h(["tooltip","init","show"],!1),qi=h(["tooltip","init","x"],0),ri=h(["tooltip","init","position"],{top:"0px",left:"50px"}),si=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ti=si+"-xaxis",ui=si+"-yaxis",vi=i(si),wi=i(ti),xi=i(ui),yi="timeseries"===bh,zi="categorized"===bh,Ai=!yi&&(sg||we(tg)),Bi=null,Ci=!1,Di=!1,Ei=!1,Fi=!1,Gi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Hi=qe(Gg,we(Ug)?Ug:Gi,Fg),Ii=ch?wf.time.format:wf.time.format.utc,Ji=function(){var a=[[Ii("%Y/%-m/%-d"),function(){return!0}],[Ii("%-m/%-d"),function(a){return a.getMonth()}],[Ii("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ii("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ii("%I %p"),function(a){return a.getHours()}],[Ii("%I:%M"),function(a){return a.getMinutes()}],[Ii(":%S"),function(a){return a.getSeconds()}],[Ii(".%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)}}(),Ki=[],Li=[],Mi=_g?"left":"bottom",Ni=_g?xh?"top":"bottom":xh?"right":"left",Oi=_g?Gh?"bottom":"top":Gh?"left":"right",Pi=_g?"left":"bottom",Qi={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(_g?0:Rf)+")"},y:function(){return"translate(0,"+(_g?Rf:0)+")"},y2:function(){return"translate("+(_g?0:Pf)+","+(_g?1:0)+")"},subx:function(){return"translate(0,"+(_g?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Ri="right"===Wg,Si=0,Ti=0,Ui=0,Vi=.15,Wi=30,Xi=_g&&!ah?0:30,Yi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Zi,$i=function(){var a=wf.svg.line().x(_g?function(a){return V(a.id)(a.value)}:Cd).y(_g?Cd:function(a){return V(a.id)(a.value)});return Wh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Wh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),_i=function(){var a;return a=_g?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a=wf.svg.line().x(_g?function(a){return W(a.id)(a.value)}:Fd).y(_g?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),bj=function(){};Zi=wf.svg.brush().on("brush",_e),Zi.update=function(){return fj&&fj.select("."+f.brush).call(this),this},Zi.scale=function(a){return _g?this.y(a):this.x(a)},Ef&&(bj=wf.behavior.zoom().on("zoomstart",function(){bj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),bj.scale=function(a){return _g?this.y(a):this.x(a)},bj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},bj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(jj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var cj,dj,ej,fj,gj,hj,ij,jj,kj,lj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),cj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?pf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),cj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?qf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Vi),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){Zi.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&zi&&(dh=a.categories,og.categories(dh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},xf.selected=function(a){return wf.merge(ej.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Ig||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Jg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Ig||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Jg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0})},xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Mh=a,$e(),Mh):Mh},xf.xgrids.add=function(a){return a?xf.xgrids(Mh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a); +}hj.html(oi(xf.data.targets.map(function(a){return pc(a.values[qi])}),$(),wd(ee(xf.data.targets)),Hi)),hj.style("top",ri.top).style("left",ri.left).style("display","block")}null==a.onresize&&(a.onresize=bf()),a.onresize.add&&(a.onresize.add(Jf),a.onresize.add(function(){df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})}),a.onresize.add(Kf))}function Ue(a){a.append("rect").attr("class",fd).style("cursor",Hg&&Ig?"pointer":null).on("mouseover",function(a,b){if(!Ci&&!ee(xf.data.targets)){var c,d,e=xf.data.targets.map(function(a){return pc(a.values[b])});if(Object.keys(wg).length>0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(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){ee(xf.data.targets)||Hg&&(Bi=a,ej.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ci=!0,Qg())}function Ze(){ee(xf.data.targets)||Hg&&(ej.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),ej.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ci=!1,Rg())}function $e(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=ej.select("."+f.axisX).style("opacity",W?0:1),g=ej.select("."+f.axisY).style("opacity",W?0:1),h=ej.select("."+f.axisY2).style("opacity",W?0:1),e=fj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Vg&&rf(Cc(xf.data.targets),a,O),zi&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),jj=ig.domain(),Ef&&bj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),Zi.scale(lg)),G&&(ig.domain(Zi.empty()?jj:Zi.extent()),Ef&&bj.scale(ig).updateScaleExtent()),kh||!jh&&!ih||(S=Kc(Jc(X),ih),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(gh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!_g&&lh&&eb(c,O.axisX,lh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),hj.style("display","none"),o(),ej.select("line."+f.xgridFocus).style("visibility","hidden"),Kh){if("year"===Lh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=ej.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",_g?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",_g?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",_g?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",_g?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(_g?"y1":"x1")===(_g?Rf:0)?0:1}),i.exit().remove()}we(Mh)&&(k=ej.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Mh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",_g?"":"rotate(-90)").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",_g?0:Dd).attr("x2",_g?Pf:Dd).attr("y1",_g?Dd:Mf.top).attr("y2",_g?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",_g?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Nh&&(m=ej.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Ph)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",_g?jg:0).attr("x2",_g?jg:Pf).attr("y1",_g?0:jg).attr("y2",_g?Rf:jg),m.exit().remove()),A&&we(Oh)&&(n=ej.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Oh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",_g?"rotate(-90)":"").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",_g?Ed:0).attr("x2",_g?Ed:Pf).attr("y1",_g?0:Ed).attr("y2",_g?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",_g?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=ej.select("."+f.regions).selectAll("rect."+f.region).data(ki),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=ej.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Hi(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=ej.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return _g?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),ej.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",$i).style("opacity",1),ej.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",_i).style("opacity",kj),q=ej.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Rh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),q.exit().remove(),ej.each(function(){Fi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Fi=!1}),ej.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),ej.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Sg&&(null!==wf.event&&"zoom"===wf.event.type&&Zi.extent(ig.orgDomain()).update(),B&&(!_g&&lh&&eb(e,O.axisSubX,lh),Zi.empty()||Zi.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Hi(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1))),ej.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),ej.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),v=ej.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ai&&!zi?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),ej.select("."+f.eventRects).datum(x?x.values:[]),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",_g?0:y).attr("y",_g?y:0).attr("width",_g?Pf:z).attr("height",_g?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){lj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&bj.altDomain?(ig.domain(bj.altDomain),void bj.scale(ig).updateScaleExtent()):(zi&&ig.orgDomain()[0]===jj[0]&&ig.domain([jj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Di=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){cj.attr("width",Tf).attr("height",Uf),cj.select("#"+si).select("rect").attr("width",Pf).attr("height",Rf),cj.select("#"+ti).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),cj.select("#"+ui).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),cj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),ij.style("max-height",Uf+"px")}function df(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=ej.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Hi(a)}),e=ej.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Jg(a)?"pointer":null}),c=ej.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)}),b.append("path").attr("class",dd).style("opacity",function(){return kj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Hi(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Hi(a)}).style("cursor",function(a){return Jg(a)?"pointer":null}),a.forEach(function(a){ej.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=ej.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Hi(a.data)}).style("cursor",function(a){return Jg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Sg&&(n=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Hi(a)}),l=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)})),cj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Ri?j:i,l=Ri?Q():P();return d&&(x=0,D=0,u=0,v=0),Vg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Ri?v:u,void($g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Ri?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=gj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Xg?Xg(a):xf.toggle(a)}).on("mouseover",function(a){Fi||xf.focus(a),"function"==typeof Yg&&Yg(a)}).on("mouseout",function(a){Fi||xf.revert(),"function"==typeof Zg&&Zg(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ri?h:-200).attr("y",Ri?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ri?i:-200).attr("y",Ri?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Hi(a)}).attr("x",Ri?h:-200).attr("y",Ri?-200:j).attr("width",10).attr("height",10),gj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),gj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),gj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Fi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"]),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","selection","enabled"],!1),Ig=h(["data","selection","grouped"],!1),Jg=h(["data","selection","isselectable"],function(){return!0}),Kg=h(["data","selection","multiple"],!0),Lg=h(["data","onclick"],function(){}),Mg=h(["data","onenter"],function(){}),Ng=h(["data","onleave"],function(){}),Og=h(["data","onselected"],function(){}),Pg=h(["data","onunselected"],function(){}),Qg=h(["data","ondragstart"],function(){}),Rg=h(["data","ondragend"],function(){}),Sg=h(["subchart","show"],!1),Tg=h(["subchart","size","height"],60),Ug=h(["color","pattern"],[]),Vg=h(["legend","show"],!0),Wg=h(["legend","position"],"bottom"),Xg=h(["legend","item","onclick"]),Yg=h(["legend","item","onmouseover"]),Zg=h(["legend","item","onmouseout"]),$g=h(["legend","equally"],!1),_g=h(["axis","rotated"],!1),ah=h(["axis","x","show"],!0),bh=h(["axis","x","type"],"indexed"),ch=h(["axis","x","localtime"],!0),dh=h(["axis","x","categories"],[]),eh=h(["axis","x","tick","centered"],!1),fh=h(["axis","x","tick","format"]),gh=h(["axis","x","tick","culling"],{}),hh=h(["axis","x","tick","culling","max"],10),ih=h(["axis","x","tick","count"]),jh=h(["axis","x","tick","fit"],!0),kh=h(["axis","x","tick","values"],null),lh=h(["axis","x","tick","rotate"]),mh=h(["axis","x","max"],null),nh=h(["axis","x","min"],null),oh=h(["axis","x","padding"],{}),ph=h(["axis","x","height"]),qh=h(["axis","x","default"]),rh=h(["axis","x","label"],{}),sh=h(["axis","y","show"],!0),th=h(["axis","y","max"]),uh=h(["axis","y","min"]),vh=h(["axis","y","center"]),wh=h(["axis","y","label"],{}),xh=h(["axis","y","inner"],!1),yh=h(["axis","y","tick","format"]),zh=h(["axis","y","padding"],{}),Ah=h(["axis","y","ticks"],10),Bh=h(["axis","y2","show"],!1),Ch=h(["axis","y2","max"]),Dh=h(["axis","y2","min"]),Eh=h(["axis","y2","center"]),Fh=h(["axis","y2","label"],{}),Gh=h(["axis","y2","inner"],!1),Hh=h(["axis","y2","tick","format"]),Ih=h(["axis","y2","padding"],{}),Jh=h(["axis","y2","ticks"],10),Kh=h(["grid","x","show"],!1),Lh=h(["grid","x","type"],"tick"),Mh=h(["grid","x","lines"],[]),Nh=h(["grid","y","show"],!1),Oh=h(["grid","y","lines"],[]),Ph=h(["grid","y","ticks"],10),Qh=h(["point","show"],!0),Rh=Qh?h(["point","r"],2.5):0,Sh=h(["point","focus","line","enabled"],!0),Th=h(["point","focus","expand","enabled"],!0),Uh=h(["point","focus","expand","r"],Th?4:Rh),Vh=h(["point","focus","select","r"],8),Wh=h(["line","connect_null"],!1),Xh=h(["bar","width"]),Yh=h(["bar","width","ratio"],.6),Zh=h(["pie","label","show"],!0),$h=h(["pie","label","format"]),_h=h(["pie","expand"],!0),ai=h(["pie","onclick"],function(){}),bi=h(["pie","onmouseover"],function(){}),ci=h(["pie","onmouseout"],function(){}),di=h(["donut","label","show"],!0),ei=h(["donut","label","format"]),fi=h(["donut","expand"],!0),gi=h(["donut","title"],""),hi=h(["donut","onclick"],function(){}),ii=h(["donut","onmouseover"],function(){}),ji=h(["donut","onmouseout"],function(){}),ki=h(["regions"],[]),li=h(["tooltip","show"],!0),mi=h(["tooltip","format","title"]),ni=h(["tooltip","format","value"]),oi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=mi?mi:b,l=ni?ni:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),pi=h(["tooltip","init","show"],!1),qi=h(["tooltip","init","x"],0),ri=h(["tooltip","init","position"],{top:"0px",left:"50px"}),si=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ti=si+"-xaxis",ui=si+"-yaxis",vi=i(si),wi=i(ti),xi=i(ui),yi="timeseries"===bh,zi="categorized"===bh,Ai=!yi&&(sg||we(tg)),Bi=null,Ci=!1,Di=!1,Ei=!1,Fi=!1,Gi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Hi=qe(Gg,we(Ug)?Ug:Gi,Fg),Ii=ch?wf.time.format:wf.time.format.utc,Ji=function(){var a=[[Ii("%Y/%-m/%-d"),function(){return!0}],[Ii("%-m/%-d"),function(a){return a.getMonth()}],[Ii("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ii("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ii("%I %p"),function(a){return a.getHours()}],[Ii("%I:%M"),function(a){return a.getMinutes()}],[Ii(":%S"),function(a){return a.getSeconds()}],[Ii(".%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)}}(),Ki=[],Li=[],Mi=_g?"left":"bottom",Ni=_g?xh?"top":"bottom":xh?"right":"left",Oi=_g?Gh?"bottom":"top":Gh?"left":"right",Pi=_g?"left":"bottom",Qi={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(_g?0:Rf)+")"},y:function(){return"translate(0,"+(_g?Rf:0)+")"},y2:function(){return"translate("+(_g?0:Pf)+","+(_g?1:0)+")"},subx:function(){return"translate(0,"+(_g?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Ri="right"===Wg,Si=0,Ti=0,Ui=0,Vi=.15,Wi=30,Xi=_g&&!ah?0:30,Yi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Zi,$i=function(){var a=wf.svg.line().x(_g?function(a){return V(a.id)(a.value)}:Cd).y(_g?Cd:function(a){return V(a.id)(a.value)});return Wh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Wh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),_i=function(){var a;return a=_g?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a=wf.svg.line().x(_g?function(a){return W(a.id)(a.value)}:Fd).y(_g?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),bj=function(){};Zi=wf.svg.brush().on("brush",_e),Zi.update=function(){return fj&&fj.select("."+f.brush).call(this),this},Zi.scale=function(a){return _g?this.y(a):this.x(a)},Ef&&(bj=wf.behavior.zoom().on("zoomstart",function(){bj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),bj.scale=function(a){return _g?this.y(a):this.x(a)},bj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},bj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(jj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var cj,dj,ej,fj,gj,hj,ij,jj,kj,lj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),cj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?pf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),cj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?qf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Vi),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){Zi.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&zi&&(dh=a.categories,og.categories(dh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(ej.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Ig||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Jg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Ig||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Jg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0})},xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Mh=a,$e(),Mh):Mh},xf.xgrids.add=function(a){return a?xf.xgrids(Mh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a); return xf.xgrids(Mh.filter(b))},xf.ygrids=function(a){return a?(Oh=a,$e(),Oh):Oh},xf.ygrids.add=function(a){return a?xf.ygrids(Oh.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Oh.filter(b))},xf.regions=function(a){return c(a)?ki:(ki=a,$e(),ki)},xf.regions.add=function(a){return c(a)?ki:(ki=ki.concat(a),$e(),ki)},xf.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;cj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ki=ki.filter(function(b){return b.classes.indexOf(a)<0})}),ki},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(th=+a.y),b(a.y2)&&(Ch=+a.y2)):th=Ch=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){Vg||(Vg=!0,gj.style("visibility","visible")),pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0}),Vg&&ve(a)&&(Vg=!1,gj.style("visibility","hidden"))},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},ij.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 3c9901e82a2c668617a6dc0602b30b3b0b87c5a5 Mon Sep 17 00:00:00 2001 From: Mattia Larentis Date: Tue, 29 Apr 2014 10:26:32 +0200 Subject: [PATCH 083/178] Lable -> Label --- htdocs/samples/grid_x_lines.html | 8 ++++---- htdocs/samples/grid_y_lines.html | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/samples/grid_x_lines.html b/htdocs/samples/grid_x_lines.html index 0b65e54..6f1e3fe 100644 --- a/htdocs/samples/grid_x_lines.html +++ b/htdocs/samples/grid_x_lines.html @@ -20,21 +20,21 @@ }, grid: { x: { - lines: [{value: 3, text:'Lable 3'}, {value: 4.5, text: 'Lable 4.5'}] + lines: [{value: 3, text:'Label 3'}, {value: 4.5, text: 'Label 4.5'}] } } }); setTimeout(function () { - chart.xgrids([{value: 1, text:'Lable 1'}, {value: 4, text: 'Lable 4'}]); + chart.xgrids([{value: 1, text:'Label 1'}, {value: 4, text: 'Label 4'}]); }, 1000); setTimeout(function () { - chart.xgrids([{value: 2, text:'Lable 2'}]); + chart.xgrids([{value: 2, text:'Label 2'}]); }, 2000); setTimeout(function () { - chart.xgrids.add([{value: 3, text:'Lable 3', class:'hoge'}]); + chart.xgrids.add([{value: 3, text:'Label 3', class:'hoge'}]); }, 3000); setTimeout(function () { diff --git a/htdocs/samples/grid_y_lines.html b/htdocs/samples/grid_y_lines.html index 260bd19..e1e7207 100644 --- a/htdocs/samples/grid_y_lines.html +++ b/htdocs/samples/grid_y_lines.html @@ -20,21 +20,21 @@ }, grid: { y: { - lines: [{value: 30, text:'Lable 30'}, {value: 250, text: 'Lable 250'}] + lines: [{value: 30, text:'Label 30'}, {value: 250, text: 'Label 250'}] } } }); setTimeout(function () { - chart.ygrids([{value: 130, text:'Lable 130'}, {value: 50, text: 'Lable 50'}]); + chart.ygrids([{value: 130, text:'Label 130'}, {value: 50, text: 'Label 50'}]); }, 1000); setTimeout(function () { - chart.ygrids([{value: 130, text:'Lable 130', class: 'hoge'}]); + chart.ygrids([{value: 130, text:'Label 130', class: 'hoge'}]); }, 2000); setTimeout(function () { - chart.ygrids.add([{value: 230, text:'Lable 230'}]); + chart.ygrids.add([{value: 230, text:'Label 230'}]); }, 3000); setTimeout(function () { From 44bfd0a7447d64c54c532784423a870b98db51bf Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Tue, 29 Apr 2014 17:50:02 +0900 Subject: [PATCH 084/178] Remove default padding for tick width of vertical axis - #151 --- c3.js | 2 +- c3.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/c3.js b/c3.js index ca8f613..6cb57c6 100644 --- a/c3.js +++ b/c3.js @@ -855,7 +855,7 @@ var box = this.getBoundingClientRect(); if (maxWidth < box.width) { maxWidth = box.width; } }); - return maxWidth < 30 ? 30 : maxWidth; + return maxWidth < 0 ? 0 : maxWidth; } function updateAxisLabels() { main.select('.' + CLASS.axisX + ' .' + CLASS.axisXLabel) diff --git a/c3.min.js b/c3.min.js index 5d0abce..f3f6672 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.32"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cPf&&(Pf=0),0>Rf&&(Rf=0),Qf=_g?Mf.left-Wi-Xi:Pf,Sf=_g?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Ri&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){ej.select("line."+f.xgridFocus).attr("x1",_g?0:-10).attr("x2",_g?Pf:-10).attr("y1",_g?-10:Mf.top).attr("y2",_g?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=_g?f.axisX:f.axisY,b=ej.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:_g?ah?v("x"):1:!sh||xh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Ri?P()+(Bh&&!_g?v("y2"):a):Bh?Gh||_g?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||ah?"x"===a&&ph?ph:"y"!==a||sh?"y2"!==a||Bh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Yi:Vg&&!Ri?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!_g)}function C(){return A(!_g)}function D(){return z(_g)}function E(){return A(_g)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(ph?ph:0)+80:Rf+8}function H(){return F(!_g)}function I(){return G(!_g)}function J(){return F(_g)}function K(){return G(_g)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(zi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Si=a}function N(a){Ti=a}function O(a){Ui=a}function P(){return Vg?Ri?Ti*(Si+1):Tf:0}function Q(){return Vg?Ri?Uf:Ui*(Si+1):0}function R(){var a,b,c=!ig;ag=_g?1:0,bg=_g?Rf:Pf,cg=_g?0:Rf,dg=_g?Pf:1,eg=ag,fg=bg,gg=_g?0:Sf,hg=_g?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,jj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=kh?kh:c?void 0:og.tickValues(),og=X(ig,Mi,a,b),rg=X(lg,Pi,a,b),pg=Y(jg,Ni,yh,Ah),qg=Y(kg,Oi,Hh,Jh),c||(Zi.scale(lg),Ef&&bj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(yi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),zi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(zi?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),zi?(e.tickCentered(eh),ve(gh)&&(gh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},zi&&e.categories(dh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=yi?Ji:zi?Tc:function(a){return 0>a?a.toFixed(0):a};return fh&&("function"==typeof fh?a=fh:yi&&(a=function(a){return a?Ii(fh)(a):""})),a}function _(a){var b;return"y"===a?b=wh:"y2"===a?b=Fh:"x"===a&&(b=rh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?wh=b:"y2"===a?Fh=b:"x"===a&&(rh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",_g?"inner-top":"inner-right")}function hb(){return fb("y",_g?"inner-right":"inner-top")}function ib(){return fb("y2",_g?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!_g,gb())}function rb(){return nb(_g,hb())}function sb(){return nb(_g,ib())}function tb(){return ob(!_g,gb())}function ub(){return ob(_g,hb())}function vb(){return ob(_g,ib())}function wb(){var a=gb();return _g?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":ph?ph-10:"3em"}function xb(){var a=hb();return _g?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return _g?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!_g,gb())}function Ab(){return pb(_g,hb())}function Bb(){return pb(_g,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?30:b}function Db(){ej.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),ej.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),ej.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.length>0)for(g=Sc(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 wf.max(Object.keys(i).map(function(a){return wf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Dh:uh,n="y2"===c?Ch:th,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Eh:vh,r=ud()&&_g;return 0===l.length?"y2"===c?kg.domain():jg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(jg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&zh&&(f=b(zh.top)?zh.top:e,g=b(zh.bottom)?zh.bottom:e),"y2"===c&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return nh?yi?re(nh):nh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return mh?yi?re(mh):mh:wf.max(a,function(a){return wf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return zi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof oh&&we(oh)?(e=b(oh.left)?oh.left:d,f=b(oh.right)?oh.right:d):e=f="number"==typeof oh?oh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=yi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=yi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?jg:kg;return b="y"===a.axis||"y2"===a.axis?_g?Rf:"start"in a?d(a.start):Rf:_g?"end"in a?ig(yi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),xf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=yi?a?a instanceof Date?a:re(a):re(mc(c,d)):Ai&&!zi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ai&&zi&&0===c&&g&&(0===e&&(dh=[]),dh.push(g)),("undefined"==typeof a[b]||xf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&xf.data.targets[0].values[a-1]?xf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(xf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(yi?new Date(i):i);j.push(e)}return yi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Ki=Ki.concat(a)}function Mc(a){Ki=Ki.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Li=Li.concat(a)}function Oc(a){Li=Li.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&li&&(hj.html(oi(a,$(),wd(k),Hi)).style("display","block"),d=hj.property("offsetWidth"),e=hj.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(_g?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),hj.style("top",i+"px").style("left",g+"px"))}function Qd(){hj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});li&&(be(xf.data.targets)||ee(xf.data.targets)||ej.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(_g?"y1":"x1",Cd).attr(_g?"y2":"x2",Cd))}function Sd(){ej.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return Xh?Xh:b?2*a.tickOffset()*Yh/b:0}function $d(a,b){Dc(a).forEach(function(a){lj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&fi||je(a)&&_h}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=_g?1:0,e=_g?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Og(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud).attr("stroke",function(){return Hi(b)}).attr("r",1.4*Vh).transition().duration(100).attr("r",Vh)}function Be(a,b,c){Pg(b,a.node()),ej.select("."+f.selectedCircles+ld(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){Og(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Hi(b)).darker(1)})}function Ee(a,b){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return Hi(b)})}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?ej.selectAll("."+f.circles+ld(c)):ej).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Uh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Rh)}function Ke(a){return ej.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=_g?1:0,f=_g?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 _g?(c=he(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.getBoundingClientRect();return _g?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return _g&&(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(ij=wf.select(zf),ij.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ij.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),jj=ig.domain(),Zi.scale(lg),Ef&&bj.scale(ig),cj=ij.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),dj=cj.append("defs"),dj.append("clipPath").attr("id",si).append("rect").attr("width",Pf).attr("height",Rf),dj.append("clipPath").attr("id",ti).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.append("clipPath").attr("id",ui).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej=cj.append("g").attr("transform",Qi.main),fj=cj.append("g").attr("transform",Qi.context),gj=cj.append("g").attr("transform",Qi.legend),Sg||fj.style("visibility","hidden"),Vg||(gj.style("visibility","hidden"),Li=Cc(xf.data.targets)),hj=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),ah&&ej.append("g").attr("class",f.axisX).attr("clip-path",wi).attr("transform",Qi.x).append("text").attr("class",f.axisXLabel).attr("transform",_g?"rotate(-90)":"").style("text-anchor",zb),sh&&ej.append("g").attr("class",f.axisY).attr("clip-path",xi).attr("transform",Qi.y).append("text").attr("class",f.axisYLabel).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Ab),Bh&&ej.append("g").attr("class",f.axisY2).attr("transform",Qi.y2).append("text").attr("class",f.axisY2Label).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Bb),d=ej.append("g").attr("clip-path",vi).attr("class",f.grid),Kh&&d.append("g").attr("class",f.xgrids),we(Mh)&&d.append("g").attr("class",f.xgridLines),Sh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Nh&&d.append("g").attr("class",f.ygrids),we(Oh)&&d.append("g").attr("class",f.ygridLines),ej.append("g").attr("clip-path",vi).attr("class",f.regions),ej.append("g").attr("clip-path",vi).attr("class",f.chart),c=ej.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?_g?"ns-resize":"ew-resize":null),ej.select("."+f.chart).append("g").attr("class",f.chartBars),ej.select("."+f.chart).append("g").attr("class",f.chartLines),ej.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Qi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),ej.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&ej.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",_g?"ns-resize":"ew-resize").call(bj).on("dblclick.zoom",null),qh&&Zi.extent("function"!=typeof qh?qh:qh(_b())),fj.append("g").attr("clip-path",vi).attr("class",f.chart),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.append("g").attr("clip-path",vi).attr("class",f.brush).call(Zi).selectAll("rect").attr(_g?"width":"height",_g?Qf:Sf),fj.append("g").attr("class",f.axisX).attr("transform",Qi.subx).attr("clip-path",_g?"":wi),ef(xf.data.targets),_g?ej.select("."+f.axisX).style("opacity",0).call(og):(ej.select("."+f.axisY).style("opacity",0).call(pg),ej.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),pi){if(yi&&"string"==typeof qi){for(qi=re(qi),e=0;ePf&&(Pf=0),0>Rf&&(Rf=0),Qf=_g?Mf.left-Wi-Xi:Pf,Sf=_g?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Ri&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){ej.select("line."+f.xgridFocus).attr("x1",_g?0:-10).attr("x2",_g?Pf:-10).attr("y1",_g?-10:Mf.top).attr("y2",_g?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=_g?f.axisX:f.axisY,b=ej.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:_g?ah?v("x"):1:!sh||xh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Ri?P()+(Bh&&!_g?v("y2"):a):Bh?Gh||_g?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||ah?"x"===a&&ph?ph:"y"!==a||sh?"y2"!==a||Bh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Yi:Vg&&!Ri?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!_g)}function C(){return A(!_g)}function D(){return z(_g)}function E(){return A(_g)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(ph?ph:0)+80:Rf+8}function H(){return F(!_g)}function I(){return G(!_g)}function J(){return F(_g)}function K(){return G(_g)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(zi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Si=a}function N(a){Ti=a}function O(a){Ui=a}function P(){return Vg?Ri?Ti*(Si+1):Tf:0}function Q(){return Vg?Ri?Uf:Ui*(Si+1):0}function R(){var a,b,c=!ig;ag=_g?1:0,bg=_g?Rf:Pf,cg=_g?0:Rf,dg=_g?Pf:1,eg=ag,fg=bg,gg=_g?0:Sf,hg=_g?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,jj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=kh?kh:c?void 0:og.tickValues(),og=X(ig,Mi,a,b),rg=X(lg,Pi,a,b),pg=Y(jg,Ni,yh,Ah),qg=Y(kg,Oi,Hh,Jh),c||(Zi.scale(lg),Ef&&bj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(yi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),zi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(zi?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),zi?(e.tickCentered(eh),ve(gh)&&(gh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},zi&&e.categories(dh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=yi?Ji:zi?Tc:function(a){return 0>a?a.toFixed(0):a};return fh&&("function"==typeof fh?a=fh:yi&&(a=function(a){return a?Ii(fh)(a):""})),a}function _(a){var b;return"y"===a?b=wh:"y2"===a?b=Fh:"x"===a&&(b=rh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?wh=b:"y2"===a?Fh=b:"x"===a&&(rh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",_g?"inner-top":"inner-right")}function hb(){return fb("y",_g?"inner-right":"inner-top")}function ib(){return fb("y2",_g?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!_g,gb())}function rb(){return nb(_g,hb())}function sb(){return nb(_g,ib())}function tb(){return ob(!_g,gb())}function ub(){return ob(_g,hb())}function vb(){return ob(_g,ib())}function wb(){var a=gb();return _g?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":ph?ph-10:"3em"}function xb(){var a=hb();return _g?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return _g?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!_g,gb())}function Ab(){return pb(_g,hb())}function Bb(){return pb(_g,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){ej.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),ej.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),ej.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.length>0)for(g=Sc(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 wf.max(Object.keys(i).map(function(a){return wf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Dh:uh,n="y2"===c?Ch:th,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Eh:vh,r=ud()&&_g;return 0===l.length?"y2"===c?kg.domain():jg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(jg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&zh&&(f=b(zh.top)?zh.top:e,g=b(zh.bottom)?zh.bottom:e),"y2"===c&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return nh?yi?re(nh):nh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return mh?yi?re(mh):mh:wf.max(a,function(a){return wf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return zi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof oh&&we(oh)?(e=b(oh.left)?oh.left:d,f=b(oh.right)?oh.right:d):e=f="number"==typeof oh?oh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=yi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=yi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?jg:kg;return b="y"===a.axis||"y2"===a.axis?_g?Rf:"start"in a?d(a.start):Rf:_g?"end"in a?ig(yi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),xf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=yi?a?a instanceof Date?a:re(a):re(mc(c,d)):Ai&&!zi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ai&&zi&&0===c&&g&&(0===e&&(dh=[]),dh.push(g)),("undefined"==typeof a[b]||xf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&xf.data.targets[0].values[a-1]?xf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(xf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(yi?new Date(i):i);j.push(e)}return yi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Ki=Ki.concat(a)}function Mc(a){Ki=Ki.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Li=Li.concat(a)}function Oc(a){Li=Li.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&li&&(hj.html(oi(a,$(),wd(k),Hi)).style("display","block"),d=hj.property("offsetWidth"),e=hj.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(_g?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),hj.style("top",i+"px").style("left",g+"px"))}function Qd(){hj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});li&&(be(xf.data.targets)||ee(xf.data.targets)||ej.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(_g?"y1":"x1",Cd).attr(_g?"y2":"x2",Cd))}function Sd(){ej.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return Xh?Xh:b?2*a.tickOffset()*Yh/b:0}function $d(a,b){Dc(a).forEach(function(a){lj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&fi||je(a)&&_h}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=_g?1:0,e=_g?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Og(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud).attr("stroke",function(){return Hi(b)}).attr("r",1.4*Vh).transition().duration(100).attr("r",Vh)}function Be(a,b,c){Pg(b,a.node()),ej.select("."+f.selectedCircles+ld(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){Og(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Hi(b)).darker(1)})}function Ee(a,b){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return Hi(b)})}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?ej.selectAll("."+f.circles+ld(c)):ej).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Uh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Rh)}function Ke(a){return ej.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=_g?1:0,f=_g?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 _g?(c=he(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.getBoundingClientRect();return _g?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return _g&&(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(ij=wf.select(zf),ij.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ij.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),jj=ig.domain(),Zi.scale(lg),Ef&&bj.scale(ig),cj=ij.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),dj=cj.append("defs"),dj.append("clipPath").attr("id",si).append("rect").attr("width",Pf).attr("height",Rf),dj.append("clipPath").attr("id",ti).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.append("clipPath").attr("id",ui).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej=cj.append("g").attr("transform",Qi.main),fj=cj.append("g").attr("transform",Qi.context),gj=cj.append("g").attr("transform",Qi.legend),Sg||fj.style("visibility","hidden"),Vg||(gj.style("visibility","hidden"),Li=Cc(xf.data.targets)),hj=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),ah&&ej.append("g").attr("class",f.axisX).attr("clip-path",wi).attr("transform",Qi.x).append("text").attr("class",f.axisXLabel).attr("transform",_g?"rotate(-90)":"").style("text-anchor",zb),sh&&ej.append("g").attr("class",f.axisY).attr("clip-path",xi).attr("transform",Qi.y).append("text").attr("class",f.axisYLabel).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Ab),Bh&&ej.append("g").attr("class",f.axisY2).attr("transform",Qi.y2).append("text").attr("class",f.axisY2Label).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Bb),d=ej.append("g").attr("clip-path",vi).attr("class",f.grid),Kh&&d.append("g").attr("class",f.xgrids),we(Mh)&&d.append("g").attr("class",f.xgridLines),Sh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Nh&&d.append("g").attr("class",f.ygrids),we(Oh)&&d.append("g").attr("class",f.ygridLines),ej.append("g").attr("clip-path",vi).attr("class",f.regions),ej.append("g").attr("clip-path",vi).attr("class",f.chart),c=ej.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?_g?"ns-resize":"ew-resize":null),ej.select("."+f.chart).append("g").attr("class",f.chartBars),ej.select("."+f.chart).append("g").attr("class",f.chartLines),ej.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Qi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),ej.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&ej.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",_g?"ns-resize":"ew-resize").call(bj).on("dblclick.zoom",null),qh&&Zi.extent("function"!=typeof qh?qh:qh(_b())),fj.append("g").attr("clip-path",vi).attr("class",f.chart),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.append("g").attr("clip-path",vi).attr("class",f.brush).call(Zi).selectAll("rect").attr(_g?"width":"height",_g?Qf:Sf),fj.append("g").attr("class",f.axisX).attr("transform",Qi.subx).attr("clip-path",_g?"":wi),ef(xf.data.targets),_g?ej.select("."+f.axisX).style("opacity",0).call(og):(ej.select("."+f.axisY).style("opacity",0).call(pg),ej.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),pi){if(yi&&"string"==typeof qi){for(qi=re(qi),e=0;e0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(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){ee(xf.data.targets)||Hg&&(Bi=a,ej.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ci=!0,Qg())}function Ze(){ee(xf.data.targets)||Hg&&(ej.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),ej.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ci=!1,Rg())}function $e(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=ej.select("."+f.axisX).style("opacity",W?0:1),g=ej.select("."+f.axisY).style("opacity",W?0:1),h=ej.select("."+f.axisY2).style("opacity",W?0:1),e=fj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Vg&&rf(Cc(xf.data.targets),a,O),zi&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),jj=ig.domain(),Ef&&bj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),Zi.scale(lg)),G&&(ig.domain(Zi.empty()?jj:Zi.extent()),Ef&&bj.scale(ig).updateScaleExtent()),kh||!jh&&!ih||(S=Kc(Jc(X),ih),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(gh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!_g&&lh&&eb(c,O.axisX,lh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),hj.style("display","none"),o(),ej.select("line."+f.xgridFocus).style("visibility","hidden"),Kh){if("year"===Lh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=ej.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",_g?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",_g?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",_g?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",_g?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(_g?"y1":"x1")===(_g?Rf:0)?0:1}),i.exit().remove()}we(Mh)&&(k=ej.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Mh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",_g?"":"rotate(-90)").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",_g?0:Dd).attr("x2",_g?Pf:Dd).attr("y1",_g?Dd:Mf.top).attr("y2",_g?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",_g?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Nh&&(m=ej.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Ph)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",_g?jg:0).attr("x2",_g?jg:Pf).attr("y1",_g?0:jg).attr("y2",_g?Rf:jg),m.exit().remove()),A&&we(Oh)&&(n=ej.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Oh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",_g?"rotate(-90)":"").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",_g?Ed:0).attr("x2",_g?Ed:Pf).attr("y1",_g?0:Ed).attr("y2",_g?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",_g?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=ej.select("."+f.regions).selectAll("rect."+f.region).data(ki),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=ej.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Hi(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=ej.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return _g?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),ej.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",$i).style("opacity",1),ej.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",_i).style("opacity",kj),q=ej.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Rh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),q.exit().remove(),ej.each(function(){Fi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Fi=!1}),ej.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),ej.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Sg&&(null!==wf.event&&"zoom"===wf.event.type&&Zi.extent(ig.orgDomain()).update(),B&&(!_g&&lh&&eb(e,O.axisSubX,lh),Zi.empty()||Zi.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Hi(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1))),ej.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),ej.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),v=ej.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ai&&!zi?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),ej.select("."+f.eventRects).datum(x?x.values:[]),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",_g?0:y).attr("y",_g?y:0).attr("width",_g?Pf:z).attr("height",_g?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){lj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&bj.altDomain?(ig.domain(bj.altDomain),void bj.scale(ig).updateScaleExtent()):(zi&&ig.orgDomain()[0]===jj[0]&&ig.domain([jj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Di=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){cj.attr("width",Tf).attr("height",Uf),cj.select("#"+si).select("rect").attr("width",Pf).attr("height",Rf),cj.select("#"+ti).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),cj.select("#"+ui).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),cj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),ij.style("max-height",Uf+"px")}function df(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=ej.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Hi(a)}),e=ej.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Jg(a)?"pointer":null}),c=ej.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)}),b.append("path").attr("class",dd).style("opacity",function(){return kj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Hi(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Hi(a)}).style("cursor",function(a){return Jg(a)?"pointer":null}),a.forEach(function(a){ej.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=ej.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Hi(a.data)}).style("cursor",function(a){return Jg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Sg&&(n=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Hi(a)}),l=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)})),cj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Ri?j:i,l=Ri?Q():P();return d&&(x=0,D=0,u=0,v=0),Vg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Ri?v:u,void($g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Ri?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=gj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Xg?Xg(a):xf.toggle(a)}).on("mouseover",function(a){Fi||xf.focus(a),"function"==typeof Yg&&Yg(a)}).on("mouseout",function(a){Fi||xf.revert(),"function"==typeof Zg&&Zg(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ri?h:-200).attr("y",Ri?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ri?i:-200).attr("y",Ri?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Hi(a)}).attr("x",Ri?h:-200).attr("y",Ri?-200:j).attr("width",10).attr("height",10),gj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),gj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),gj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Fi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"]),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","selection","enabled"],!1),Ig=h(["data","selection","grouped"],!1),Jg=h(["data","selection","isselectable"],function(){return!0}),Kg=h(["data","selection","multiple"],!0),Lg=h(["data","onclick"],function(){}),Mg=h(["data","onenter"],function(){}),Ng=h(["data","onleave"],function(){}),Og=h(["data","onselected"],function(){}),Pg=h(["data","onunselected"],function(){}),Qg=h(["data","ondragstart"],function(){}),Rg=h(["data","ondragend"],function(){}),Sg=h(["subchart","show"],!1),Tg=h(["subchart","size","height"],60),Ug=h(["color","pattern"],[]),Vg=h(["legend","show"],!0),Wg=h(["legend","position"],"bottom"),Xg=h(["legend","item","onclick"]),Yg=h(["legend","item","onmouseover"]),Zg=h(["legend","item","onmouseout"]),$g=h(["legend","equally"],!1),_g=h(["axis","rotated"],!1),ah=h(["axis","x","show"],!0),bh=h(["axis","x","type"],"indexed"),ch=h(["axis","x","localtime"],!0),dh=h(["axis","x","categories"],[]),eh=h(["axis","x","tick","centered"],!1),fh=h(["axis","x","tick","format"]),gh=h(["axis","x","tick","culling"],{}),hh=h(["axis","x","tick","culling","max"],10),ih=h(["axis","x","tick","count"]),jh=h(["axis","x","tick","fit"],!0),kh=h(["axis","x","tick","values"],null),lh=h(["axis","x","tick","rotate"]),mh=h(["axis","x","max"],null),nh=h(["axis","x","min"],null),oh=h(["axis","x","padding"],{}),ph=h(["axis","x","height"]),qh=h(["axis","x","default"]),rh=h(["axis","x","label"],{}),sh=h(["axis","y","show"],!0),th=h(["axis","y","max"]),uh=h(["axis","y","min"]),vh=h(["axis","y","center"]),wh=h(["axis","y","label"],{}),xh=h(["axis","y","inner"],!1),yh=h(["axis","y","tick","format"]),zh=h(["axis","y","padding"],{}),Ah=h(["axis","y","ticks"],10),Bh=h(["axis","y2","show"],!1),Ch=h(["axis","y2","max"]),Dh=h(["axis","y2","min"]),Eh=h(["axis","y2","center"]),Fh=h(["axis","y2","label"],{}),Gh=h(["axis","y2","inner"],!1),Hh=h(["axis","y2","tick","format"]),Ih=h(["axis","y2","padding"],{}),Jh=h(["axis","y2","ticks"],10),Kh=h(["grid","x","show"],!1),Lh=h(["grid","x","type"],"tick"),Mh=h(["grid","x","lines"],[]),Nh=h(["grid","y","show"],!1),Oh=h(["grid","y","lines"],[]),Ph=h(["grid","y","ticks"],10),Qh=h(["point","show"],!0),Rh=Qh?h(["point","r"],2.5):0,Sh=h(["point","focus","line","enabled"],!0),Th=h(["point","focus","expand","enabled"],!0),Uh=h(["point","focus","expand","r"],Th?4:Rh),Vh=h(["point","focus","select","r"],8),Wh=h(["line","connect_null"],!1),Xh=h(["bar","width"]),Yh=h(["bar","width","ratio"],.6),Zh=h(["pie","label","show"],!0),$h=h(["pie","label","format"]),_h=h(["pie","expand"],!0),ai=h(["pie","onclick"],function(){}),bi=h(["pie","onmouseover"],function(){}),ci=h(["pie","onmouseout"],function(){}),di=h(["donut","label","show"],!0),ei=h(["donut","label","format"]),fi=h(["donut","expand"],!0),gi=h(["donut","title"],""),hi=h(["donut","onclick"],function(){}),ii=h(["donut","onmouseover"],function(){}),ji=h(["donut","onmouseout"],function(){}),ki=h(["regions"],[]),li=h(["tooltip","show"],!0),mi=h(["tooltip","format","title"]),ni=h(["tooltip","format","value"]),oi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=mi?mi:b,l=ni?ni:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),pi=h(["tooltip","init","show"],!1),qi=h(["tooltip","init","x"],0),ri=h(["tooltip","init","position"],{top:"0px",left:"50px"}),si=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ti=si+"-xaxis",ui=si+"-yaxis",vi=i(si),wi=i(ti),xi=i(ui),yi="timeseries"===bh,zi="categorized"===bh,Ai=!yi&&(sg||we(tg)),Bi=null,Ci=!1,Di=!1,Ei=!1,Fi=!1,Gi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Hi=qe(Gg,we(Ug)?Ug:Gi,Fg),Ii=ch?wf.time.format:wf.time.format.utc,Ji=function(){var a=[[Ii("%Y/%-m/%-d"),function(){return!0}],[Ii("%-m/%-d"),function(a){return a.getMonth()}],[Ii("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ii("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ii("%I %p"),function(a){return a.getHours()}],[Ii("%I:%M"),function(a){return a.getMinutes()}],[Ii(":%S"),function(a){return a.getSeconds()}],[Ii(".%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)}}(),Ki=[],Li=[],Mi=_g?"left":"bottom",Ni=_g?xh?"top":"bottom":xh?"right":"left",Oi=_g?Gh?"bottom":"top":Gh?"left":"right",Pi=_g?"left":"bottom",Qi={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(_g?0:Rf)+")"},y:function(){return"translate(0,"+(_g?Rf:0)+")"},y2:function(){return"translate("+(_g?0:Pf)+","+(_g?1:0)+")"},subx:function(){return"translate(0,"+(_g?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Ri="right"===Wg,Si=0,Ti=0,Ui=0,Vi=.15,Wi=30,Xi=_g&&!ah?0:30,Yi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Zi,$i=function(){var a=wf.svg.line().x(_g?function(a){return V(a.id)(a.value)}:Cd).y(_g?Cd:function(a){return V(a.id)(a.value)});return Wh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Wh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),_i=function(){var a;return a=_g?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a=wf.svg.line().x(_g?function(a){return W(a.id)(a.value)}:Fd).y(_g?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),bj=function(){};Zi=wf.svg.brush().on("brush",_e),Zi.update=function(){return fj&&fj.select("."+f.brush).call(this),this},Zi.scale=function(a){return _g?this.y(a):this.x(a)},Ef&&(bj=wf.behavior.zoom().on("zoomstart",function(){bj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),bj.scale=function(a){return _g?this.y(a):this.x(a)},bj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},bj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(jj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var cj,dj,ej,fj,gj,hj,ij,jj,kj,lj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),cj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?pf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),cj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?qf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Vi),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){Zi.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&zi&&(dh=a.categories,og.categories(dh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(ej.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Ig||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Jg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Ig||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Jg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0})},xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Mh=a,$e(),Mh):Mh},xf.xgrids.add=function(a){return a?xf.xgrids(Mh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a); return xf.xgrids(Mh.filter(b))},xf.ygrids=function(a){return a?(Oh=a,$e(),Oh):Oh},xf.ygrids.add=function(a){return a?xf.ygrids(Oh.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Oh.filter(b))},xf.regions=function(a){return c(a)?ki:(ki=a,$e(),ki)},xf.regions.add=function(a){return c(a)?ki:(ki=ki.concat(a),$e(),ki)},xf.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;cj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ki=ki.filter(function(b){return b.classes.indexOf(a)<0})}),ki},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(th=+a.y),b(a.y2)&&(Ch=+a.y2)):th=Ch=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){Vg||(Vg=!0,gj.style("visibility","visible")),pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0}),Vg&&ve(a)&&(Vg=!1,gj.style("visibility","hidden"))},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},ij.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 5d7672410bfce78886d3405892930dbded2da557 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Tue, 29 Apr 2014 18:08:11 +0900 Subject: [PATCH 085/178] Update samples --- htdocs/data/c3_test2_ts.csv | 6 +++ htdocs/data/c3_test_ts.csv | 6 +++ htdocs/samples/custom_x_scale.html | 9 ++++ htdocs/samples/custom_xs_scale.html | 24 ++++++++--- htdocs/samples/data_load_timeseries.html | 53 ++++++++++++++++++++++++ 5 files changed, 93 insertions(+), 5 deletions(-) create mode 100644 htdocs/data/c3_test2_ts.csv create mode 100644 htdocs/data/c3_test_ts.csv create mode 100644 htdocs/samples/data_load_timeseries.html diff --git a/htdocs/data/c3_test2_ts.csv b/htdocs/data/c3_test2_ts.csv new file mode 100644 index 0000000..2b8d00e --- /dev/null +++ b/htdocs/data/c3_test2_ts.csv @@ -0,0 +1,6 @@ +x,data1,data2,data3 +2013-04-01,20,180,400 +2013-04-02,40,150,310 +2013-04-03,70,120,470 +2013-04-04,50,170,400 +2013-04-05,80,200,380 \ No newline at end of file diff --git a/htdocs/data/c3_test_ts.csv b/htdocs/data/c3_test_ts.csv new file mode 100644 index 0000000..5bfbd34 --- /dev/null +++ b/htdocs/data/c3_test_ts.csv @@ -0,0 +1,6 @@ +x,data1,data2,data3 +2012-12-31,120,80,200 +2013-01-01,140,50,210 +2013-01-02,170,100,250 +2013-01-03,150,70,300 +2013-01-04,180,120,280 \ No newline at end of file diff --git a/htdocs/samples/custom_x_scale.html b/htdocs/samples/custom_x_scale.html index 6c8aecc..f56569e 100644 --- a/htdocs/samples/custom_x_scale.html +++ b/htdocs/samples/custom_x_scale.html @@ -36,6 +36,15 @@ setTimeout(function () { chart.x([200, 210, 350, 400, 550, 750]); }, 2000); + + setTimeout(function () { + chart.load({ + columns: [ + ['data3', 300, 410, 350, 400, 500, 350], + ] + }); + }, 3000); + diff --git a/htdocs/samples/custom_xs_scale.html b/htdocs/samples/custom_xs_scale.html index 8bd7715..5dd78b8 100644 --- a/htdocs/samples/custom_xs_scale.html +++ b/htdocs/samples/custom_xs_scale.html @@ -26,24 +26,38 @@ }, onenter: function (d) { console.log("onenter", d); }, onleave: function (d) { console.log("onleave", d); } - }, + } }); setTimeout(function () { chart.load({ columns: [ - ['data1', 100, 210, 150, 200, null, 150], + ['data1', 100, 210, 150, null, 200, 150], ['data2', 200, 310, 50, 400, 120, 250, 10], ] }); }, 1000); setTimeout(function () { - chart.xs({ - 'data1': [200, 210, 350, 400, 600, 750] -// 'data2': [200, 210, 350, 400, 550, 750, 900] + chart.load({ + columns: [ + ['x2', 150, 220, 230, 400, 540, 600, 800], + ['data2', 200, 310, 50, 400, 120, 250, 10], + ['data3', 300, 410, 350, 600, 420, 550, 310], + ], + xs: { + data3: 'x2' + } }); }, 2000); + + setTimeout(function () { + chart.xs({ + 'data1': [200, 210, 350, 400, 600, 750], + 'data2': [200, 210, 350, 400, 550, 750, 900] + }); + }, 3000); + diff --git a/htdocs/samples/data_load_timeseries.html b/htdocs/samples/data_load_timeseries.html new file mode 100644 index 0000000..46d2fcc --- /dev/null +++ b/htdocs/samples/data_load_timeseries.html @@ -0,0 +1,53 @@ + + + + + +
+ + + + + + From 9f1660125058d74bdf531206fd43d3a3d1a6178c Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Tue, 29 Apr 2014 21:07:32 +0900 Subject: [PATCH 086/178] Fix y2 axis --- c3.js | 25 +++++++++++++++++++++---- c3.min.js | 2 +- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/c3.js b/c3.js index 6cb57c6..8f794c3 100644 --- a/c3.js +++ b/c3.js @@ -349,10 +349,27 @@ } function transformMain(withTransition, transitions) { - var duration = withTransition !== false ? 250 : 0, - xAxis = (transitions && transitions.axisX) ? transitions.axisX : main.select('.' + CLASS.axisX).transition().duration(duration), - yAxis = (transitions && transitions.axisY) ? transitions.axisY : main.select('.' + CLASS.axisY).transition().duration(duration), - y2Axis = (transitions && transitions.axisYs) ? transitions.axisY2 : main.select('.' + CLASS.axisY2).transition().duration(duration); + var xAxis, yAxis, y2Axis; + + if (transitions && transitions.axisX) { + xAxis = transitions.axisX; + } else { + xAxis = main.select('.' + CLASS.axisX); + if (withTransition) { xAxis = xAxis.transition(); } + } + if (transitions && transitions.axisY) { + yAxis = transitions.axisY; + } else { + yAxis = main.select('.' + CLASS.axisY); + if (withTransition) { yAxis = yAxis.transition(); } + } + if (transitions && transitions.axisY2) { + y2Axis = transitions.axisY2; + } else { + y2Axis = main.select('.' + CLASS.axisY2); + if (withTransition) { y2Axis = y2Axis.transition(); } + } + main.attr("transform", translate.main); xAxis.attr("transform", translate.x); yAxis.attr("transform", translate.y); diff --git a/c3.min.js b/c3.min.js index f3f6672..7bcad33 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.32"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cPf&&(Pf=0),0>Rf&&(Rf=0),Qf=_g?Mf.left-Wi-Xi:Pf,Sf=_g?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Ri&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){ej.select("line."+f.xgridFocus).attr("x1",_g?0:-10).attr("x2",_g?Pf:-10).attr("y1",_g?-10:Mf.top).attr("y2",_g?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=_g?f.axisX:f.axisY,b=ej.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:_g?ah?v("x"):1:!sh||xh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Ri?P()+(Bh&&!_g?v("y2"):a):Bh?Gh||_g?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||ah?"x"===a&&ph?ph:"y"!==a||sh?"y2"!==a||Bh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Yi:Vg&&!Ri?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!_g)}function C(){return A(!_g)}function D(){return z(_g)}function E(){return A(_g)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(ph?ph:0)+80:Rf+8}function H(){return F(!_g)}function I(){return G(!_g)}function J(){return F(_g)}function K(){return G(_g)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(zi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Si=a}function N(a){Ti=a}function O(a){Ui=a}function P(){return Vg?Ri?Ti*(Si+1):Tf:0}function Q(){return Vg?Ri?Uf:Ui*(Si+1):0}function R(){var a,b,c=!ig;ag=_g?1:0,bg=_g?Rf:Pf,cg=_g?0:Rf,dg=_g?Pf:1,eg=ag,fg=bg,gg=_g?0:Sf,hg=_g?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,jj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=kh?kh:c?void 0:og.tickValues(),og=X(ig,Mi,a,b),rg=X(lg,Pi,a,b),pg=Y(jg,Ni,yh,Ah),qg=Y(kg,Oi,Hh,Jh),c||(Zi.scale(lg),Ef&&bj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(yi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),zi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(zi?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),zi?(e.tickCentered(eh),ve(gh)&&(gh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},zi&&e.categories(dh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=yi?Ji:zi?Tc:function(a){return 0>a?a.toFixed(0):a};return fh&&("function"==typeof fh?a=fh:yi&&(a=function(a){return a?Ii(fh)(a):""})),a}function _(a){var b;return"y"===a?b=wh:"y2"===a?b=Fh:"x"===a&&(b=rh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?wh=b:"y2"===a?Fh=b:"x"===a&&(rh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",_g?"inner-top":"inner-right")}function hb(){return fb("y",_g?"inner-right":"inner-top")}function ib(){return fb("y2",_g?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!_g,gb())}function rb(){return nb(_g,hb())}function sb(){return nb(_g,ib())}function tb(){return ob(!_g,gb())}function ub(){return ob(_g,hb())}function vb(){return ob(_g,ib())}function wb(){var a=gb();return _g?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":ph?ph-10:"3em"}function xb(){var a=hb();return _g?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return _g?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!_g,gb())}function Ab(){return pb(_g,hb())}function Bb(){return pb(_g,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){ej.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),ej.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),ej.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.length>0)for(g=Sc(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 wf.max(Object.keys(i).map(function(a){return wf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Dh:uh,n="y2"===c?Ch:th,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Eh:vh,r=ud()&&_g;return 0===l.length?"y2"===c?kg.domain():jg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(jg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&zh&&(f=b(zh.top)?zh.top:e,g=b(zh.bottom)?zh.bottom:e),"y2"===c&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return nh?yi?re(nh):nh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return mh?yi?re(mh):mh:wf.max(a,function(a){return wf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return zi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof oh&&we(oh)?(e=b(oh.left)?oh.left:d,f=b(oh.right)?oh.right:d):e=f="number"==typeof oh?oh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=yi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=yi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?jg:kg;return b="y"===a.axis||"y2"===a.axis?_g?Rf:"start"in a?d(a.start):Rf:_g?"end"in a?ig(yi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),xf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=yi?a?a instanceof Date?a:re(a):re(mc(c,d)):Ai&&!zi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ai&&zi&&0===c&&g&&(0===e&&(dh=[]),dh.push(g)),("undefined"==typeof a[b]||xf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&xf.data.targets[0].values[a-1]?xf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(xf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(yi?new Date(i):i);j.push(e)}return yi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Ki=Ki.concat(a)}function Mc(a){Ki=Ki.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Li=Li.concat(a)}function Oc(a){Li=Li.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&li&&(hj.html(oi(a,$(),wd(k),Hi)).style("display","block"),d=hj.property("offsetWidth"),e=hj.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(_g?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),hj.style("top",i+"px").style("left",g+"px"))}function Qd(){hj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});li&&(be(xf.data.targets)||ee(xf.data.targets)||ej.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(_g?"y1":"x1",Cd).attr(_g?"y2":"x2",Cd))}function Sd(){ej.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return Xh?Xh:b?2*a.tickOffset()*Yh/b:0}function $d(a,b){Dc(a).forEach(function(a){lj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&fi||je(a)&&_h}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=_g?1:0,e=_g?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Og(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud).attr("stroke",function(){return Hi(b)}).attr("r",1.4*Vh).transition().duration(100).attr("r",Vh)}function Be(a,b,c){Pg(b,a.node()),ej.select("."+f.selectedCircles+ld(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){Og(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Hi(b)).darker(1)})}function Ee(a,b){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return Hi(b)})}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?ej.selectAll("."+f.circles+ld(c)):ej).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Uh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Rh)}function Ke(a){return ej.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=_g?1:0,f=_g?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 _g?(c=he(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.getBoundingClientRect();return _g?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return _g&&(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(ij=wf.select(zf),ij.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ij.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),jj=ig.domain(),Zi.scale(lg),Ef&&bj.scale(ig),cj=ij.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),dj=cj.append("defs"),dj.append("clipPath").attr("id",si).append("rect").attr("width",Pf).attr("height",Rf),dj.append("clipPath").attr("id",ti).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.append("clipPath").attr("id",ui).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej=cj.append("g").attr("transform",Qi.main),fj=cj.append("g").attr("transform",Qi.context),gj=cj.append("g").attr("transform",Qi.legend),Sg||fj.style("visibility","hidden"),Vg||(gj.style("visibility","hidden"),Li=Cc(xf.data.targets)),hj=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),ah&&ej.append("g").attr("class",f.axisX).attr("clip-path",wi).attr("transform",Qi.x).append("text").attr("class",f.axisXLabel).attr("transform",_g?"rotate(-90)":"").style("text-anchor",zb),sh&&ej.append("g").attr("class",f.axisY).attr("clip-path",xi).attr("transform",Qi.y).append("text").attr("class",f.axisYLabel).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Ab),Bh&&ej.append("g").attr("class",f.axisY2).attr("transform",Qi.y2).append("text").attr("class",f.axisY2Label).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Bb),d=ej.append("g").attr("clip-path",vi).attr("class",f.grid),Kh&&d.append("g").attr("class",f.xgrids),we(Mh)&&d.append("g").attr("class",f.xgridLines),Sh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Nh&&d.append("g").attr("class",f.ygrids),we(Oh)&&d.append("g").attr("class",f.ygridLines),ej.append("g").attr("clip-path",vi).attr("class",f.regions),ej.append("g").attr("clip-path",vi).attr("class",f.chart),c=ej.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?_g?"ns-resize":"ew-resize":null),ej.select("."+f.chart).append("g").attr("class",f.chartBars),ej.select("."+f.chart).append("g").attr("class",f.chartLines),ej.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Qi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),ej.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&ej.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",_g?"ns-resize":"ew-resize").call(bj).on("dblclick.zoom",null),qh&&Zi.extent("function"!=typeof qh?qh:qh(_b())),fj.append("g").attr("clip-path",vi).attr("class",f.chart),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.append("g").attr("clip-path",vi).attr("class",f.brush).call(Zi).selectAll("rect").attr(_g?"width":"height",_g?Qf:Sf),fj.append("g").attr("class",f.axisX).attr("transform",Qi.subx).attr("clip-path",_g?"":wi),ef(xf.data.targets),_g?ej.select("."+f.axisX).style("opacity",0).call(og):(ej.select("."+f.axisY).style("opacity",0).call(pg),ej.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),pi){if(yi&&"string"==typeof qi){for(qi=re(qi),e=0;ePf&&(Pf=0),0>Rf&&(Rf=0),Qf=_g?Mf.left-Wi-Xi:Pf,Sf=_g?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Ri&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){ej.select("line."+f.xgridFocus).attr("x1",_g?0:-10).attr("x2",_g?Pf:-10).attr("y1",_g?-10:Mf.top).attr("y2",_g?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=_g?f.axisX:f.axisY,b=ej.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:_g?ah?v("x"):1:!sh||xh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Ri?P()+(Bh&&!_g?v("y2"):a):Bh?Gh||_g?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||ah?"x"===a&&ph?ph:"y"!==a||sh?"y2"!==a||Bh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Yi:Vg&&!Ri?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!_g)}function C(){return A(!_g)}function D(){return z(_g)}function E(){return A(_g)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(ph?ph:0)+80:Rf+8}function H(){return F(!_g)}function I(){return G(!_g)}function J(){return F(_g)}function K(){return G(_g)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(zi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Si=a}function N(a){Ti=a}function O(a){Ui=a}function P(){return Vg?Ri?Ti*(Si+1):Tf:0}function Q(){return Vg?Ri?Uf:Ui*(Si+1):0}function R(){var a,b,c=!ig;ag=_g?1:0,bg=_g?Rf:Pf,cg=_g?0:Rf,dg=_g?Pf:1,eg=ag,fg=bg,gg=_g?0:Sf,hg=_g?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,jj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=kh?kh:c?void 0:og.tickValues(),og=X(ig,Mi,a,b),rg=X(lg,Pi,a,b),pg=Y(jg,Ni,yh,Ah),qg=Y(kg,Oi,Hh,Jh),c||(Zi.scale(lg),Ef&&bj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(yi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),zi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(zi?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),zi?(e.tickCentered(eh),ve(gh)&&(gh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},zi&&e.categories(dh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=yi?Ji:zi?Tc:function(a){return 0>a?a.toFixed(0):a};return fh&&("function"==typeof fh?a=fh:yi&&(a=function(a){return a?Ii(fh)(a):""})),a}function _(a){var b;return"y"===a?b=wh:"y2"===a?b=Fh:"x"===a&&(b=rh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?wh=b:"y2"===a?Fh=b:"x"===a&&(rh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",_g?"inner-top":"inner-right")}function hb(){return fb("y",_g?"inner-right":"inner-top")}function ib(){return fb("y2",_g?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!_g,gb())}function rb(){return nb(_g,hb())}function sb(){return nb(_g,ib())}function tb(){return ob(!_g,gb())}function ub(){return ob(_g,hb())}function vb(){return ob(_g,ib())}function wb(){var a=gb();return _g?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":ph?ph-10:"3em"}function xb(){var a=hb();return _g?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return _g?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!_g,gb())}function Ab(){return pb(_g,hb())}function Bb(){return pb(_g,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){ej.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),ej.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),ej.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.length>0)for(g=Sc(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 wf.max(Object.keys(i).map(function(a){return wf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Dh:uh,n="y2"===c?Ch:th,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Eh:vh,r=ud()&&_g;return 0===l.length?"y2"===c?kg.domain():jg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(jg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&zh&&(f=b(zh.top)?zh.top:e,g=b(zh.bottom)?zh.bottom:e),"y2"===c&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return nh?yi?re(nh):nh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return mh?yi?re(mh):mh:wf.max(a,function(a){return wf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return zi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof oh&&we(oh)?(e=b(oh.left)?oh.left:d,f=b(oh.right)?oh.right:d):e=f="number"==typeof oh?oh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=yi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=yi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?jg:kg;return b="y"===a.axis||"y2"===a.axis?_g?Rf:"start"in a?d(a.start):Rf:_g?"end"in a?ig(yi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),xf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=yi?a?a instanceof Date?a:re(a):re(mc(c,d)):Ai&&!zi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ai&&zi&&0===c&&g&&(0===e&&(dh=[]),dh.push(g)),("undefined"==typeof a[b]||xf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&xf.data.targets[0].values[a-1]?xf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(xf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(yi?new Date(i):i);j.push(e)}return yi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Ki=Ki.concat(a)}function Mc(a){Ki=Ki.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Li=Li.concat(a)}function Oc(a){Li=Li.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&li&&(hj.html(oi(a,$(),wd(k),Hi)).style("display","block"),d=hj.property("offsetWidth"),e=hj.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(_g?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),hj.style("top",i+"px").style("left",g+"px"))}function Qd(){hj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});li&&(be(xf.data.targets)||ee(xf.data.targets)||ej.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(_g?"y1":"x1",Cd).attr(_g?"y2":"x2",Cd))}function Sd(){ej.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return Xh?Xh:b?2*a.tickOffset()*Yh/b:0}function $d(a,b){Dc(a).forEach(function(a){lj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&fi||je(a)&&_h}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=_g?1:0,e=_g?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Og(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud).attr("stroke",function(){return Hi(b)}).attr("r",1.4*Vh).transition().duration(100).attr("r",Vh)}function Be(a,b,c){Pg(b,a.node()),ej.select("."+f.selectedCircles+ld(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){Og(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Hi(b)).darker(1)})}function Ee(a,b){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return Hi(b)})}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?ej.selectAll("."+f.circles+ld(c)):ej).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Uh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Rh)}function Ke(a){return ej.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=_g?1:0,f=_g?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 _g?(c=he(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.getBoundingClientRect();return _g?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return _g&&(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(ij=wf.select(zf),ij.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ij.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),jj=ig.domain(),Zi.scale(lg),Ef&&bj.scale(ig),cj=ij.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),dj=cj.append("defs"),dj.append("clipPath").attr("id",si).append("rect").attr("width",Pf).attr("height",Rf),dj.append("clipPath").attr("id",ti).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.append("clipPath").attr("id",ui).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej=cj.append("g").attr("transform",Qi.main),fj=cj.append("g").attr("transform",Qi.context),gj=cj.append("g").attr("transform",Qi.legend),Sg||fj.style("visibility","hidden"),Vg||(gj.style("visibility","hidden"),Li=Cc(xf.data.targets)),hj=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),ah&&ej.append("g").attr("class",f.axisX).attr("clip-path",wi).attr("transform",Qi.x).append("text").attr("class",f.axisXLabel).attr("transform",_g?"rotate(-90)":"").style("text-anchor",zb),sh&&ej.append("g").attr("class",f.axisY).attr("clip-path",xi).attr("transform",Qi.y).append("text").attr("class",f.axisYLabel).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Ab),Bh&&ej.append("g").attr("class",f.axisY2).attr("transform",Qi.y2).append("text").attr("class",f.axisY2Label).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Bb),d=ej.append("g").attr("clip-path",vi).attr("class",f.grid),Kh&&d.append("g").attr("class",f.xgrids),we(Mh)&&d.append("g").attr("class",f.xgridLines),Sh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Nh&&d.append("g").attr("class",f.ygrids),we(Oh)&&d.append("g").attr("class",f.ygridLines),ej.append("g").attr("clip-path",vi).attr("class",f.regions),ej.append("g").attr("clip-path",vi).attr("class",f.chart),c=ej.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?_g?"ns-resize":"ew-resize":null),ej.select("."+f.chart).append("g").attr("class",f.chartBars),ej.select("."+f.chart).append("g").attr("class",f.chartLines),ej.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Qi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),ej.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&ej.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",_g?"ns-resize":"ew-resize").call(bj).on("dblclick.zoom",null),qh&&Zi.extent("function"!=typeof qh?qh:qh(_b())),fj.append("g").attr("clip-path",vi).attr("class",f.chart),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.append("g").attr("clip-path",vi).attr("class",f.brush).call(Zi).selectAll("rect").attr(_g?"width":"height",_g?Qf:Sf),fj.append("g").attr("class",f.axisX).attr("transform",Qi.subx).attr("clip-path",_g?"":wi),ef(xf.data.targets),_g?ej.select("."+f.axisX).style("opacity",0).call(og):(ej.select("."+f.axisY).style("opacity",0).call(pg),ej.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),pi){if(yi&&"string"==typeof qi){for(qi=re(qi),e=0;e0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(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){ee(xf.data.targets)||Hg&&(Bi=a,ej.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ci=!0,Qg())}function Ze(){ee(xf.data.targets)||Hg&&(ej.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),ej.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ci=!1,Rg())}function $e(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=ej.select("."+f.axisX).style("opacity",W?0:1),g=ej.select("."+f.axisY).style("opacity",W?0:1),h=ej.select("."+f.axisY2).style("opacity",W?0:1),e=fj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Vg&&rf(Cc(xf.data.targets),a,O),zi&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),jj=ig.domain(),Ef&&bj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),Zi.scale(lg)),G&&(ig.domain(Zi.empty()?jj:Zi.extent()),Ef&&bj.scale(ig).updateScaleExtent()),kh||!jh&&!ih||(S=Kc(Jc(X),ih),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(gh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!_g&&lh&&eb(c,O.axisX,lh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),hj.style("display","none"),o(),ej.select("line."+f.xgridFocus).style("visibility","hidden"),Kh){if("year"===Lh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=ej.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",_g?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",_g?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",_g?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",_g?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(_g?"y1":"x1")===(_g?Rf:0)?0:1}),i.exit().remove()}we(Mh)&&(k=ej.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Mh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",_g?"":"rotate(-90)").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",_g?0:Dd).attr("x2",_g?Pf:Dd).attr("y1",_g?Dd:Mf.top).attr("y2",_g?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",_g?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Nh&&(m=ej.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Ph)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",_g?jg:0).attr("x2",_g?jg:Pf).attr("y1",_g?0:jg).attr("y2",_g?Rf:jg),m.exit().remove()),A&&we(Oh)&&(n=ej.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Oh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",_g?"rotate(-90)":"").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",_g?Ed:0).attr("x2",_g?Ed:Pf).attr("y1",_g?0:Ed).attr("y2",_g?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",_g?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=ej.select("."+f.regions).selectAll("rect."+f.region).data(ki),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=ej.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Hi(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=ej.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return _g?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),ej.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",$i).style("opacity",1),ej.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",_i).style("opacity",kj),q=ej.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Rh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),q.exit().remove(),ej.each(function(){Fi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Fi=!1}),ej.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),ej.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Sg&&(null!==wf.event&&"zoom"===wf.event.type&&Zi.extent(ig.orgDomain()).update(),B&&(!_g&&lh&&eb(e,O.axisSubX,lh),Zi.empty()||Zi.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Hi(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1))),ej.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),ej.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),v=ej.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ai&&!zi?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),ej.select("."+f.eventRects).datum(x?x.values:[]),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",_g?0:y).attr("y",_g?y:0).attr("width",_g?Pf:z).attr("height",_g?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){lj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&bj.altDomain?(ig.domain(bj.altDomain),void bj.scale(ig).updateScaleExtent()):(zi&&ig.orgDomain()[0]===jj[0]&&ig.domain([jj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Di=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){cj.attr("width",Tf).attr("height",Uf),cj.select("#"+si).select("rect").attr("width",Pf).attr("height",Rf),cj.select("#"+ti).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),cj.select("#"+ui).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),cj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),ij.style("max-height",Uf+"px")}function df(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=ej.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Hi(a)}),e=ej.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Jg(a)?"pointer":null}),c=ej.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)}),b.append("path").attr("class",dd).style("opacity",function(){return kj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Hi(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Hi(a)}).style("cursor",function(a){return Jg(a)?"pointer":null}),a.forEach(function(a){ej.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=ej.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Hi(a.data)}).style("cursor",function(a){return Jg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Sg&&(n=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Hi(a)}),l=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)})),cj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Ri?j:i,l=Ri?Q():P();return d&&(x=0,D=0,u=0,v=0),Vg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Ri?v:u,void($g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Ri?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=gj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Xg?Xg(a):xf.toggle(a)}).on("mouseover",function(a){Fi||xf.focus(a),"function"==typeof Yg&&Yg(a)}).on("mouseout",function(a){Fi||xf.revert(),"function"==typeof Zg&&Zg(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ri?h:-200).attr("y",Ri?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ri?i:-200).attr("y",Ri?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Hi(a)}).attr("x",Ri?h:-200).attr("y",Ri?-200:j).attr("width",10).attr("height",10),gj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),gj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),gj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Fi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"]),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","selection","enabled"],!1),Ig=h(["data","selection","grouped"],!1),Jg=h(["data","selection","isselectable"],function(){return!0}),Kg=h(["data","selection","multiple"],!0),Lg=h(["data","onclick"],function(){}),Mg=h(["data","onenter"],function(){}),Ng=h(["data","onleave"],function(){}),Og=h(["data","onselected"],function(){}),Pg=h(["data","onunselected"],function(){}),Qg=h(["data","ondragstart"],function(){}),Rg=h(["data","ondragend"],function(){}),Sg=h(["subchart","show"],!1),Tg=h(["subchart","size","height"],60),Ug=h(["color","pattern"],[]),Vg=h(["legend","show"],!0),Wg=h(["legend","position"],"bottom"),Xg=h(["legend","item","onclick"]),Yg=h(["legend","item","onmouseover"]),Zg=h(["legend","item","onmouseout"]),$g=h(["legend","equally"],!1),_g=h(["axis","rotated"],!1),ah=h(["axis","x","show"],!0),bh=h(["axis","x","type"],"indexed"),ch=h(["axis","x","localtime"],!0),dh=h(["axis","x","categories"],[]),eh=h(["axis","x","tick","centered"],!1),fh=h(["axis","x","tick","format"]),gh=h(["axis","x","tick","culling"],{}),hh=h(["axis","x","tick","culling","max"],10),ih=h(["axis","x","tick","count"]),jh=h(["axis","x","tick","fit"],!0),kh=h(["axis","x","tick","values"],null),lh=h(["axis","x","tick","rotate"]),mh=h(["axis","x","max"],null),nh=h(["axis","x","min"],null),oh=h(["axis","x","padding"],{}),ph=h(["axis","x","height"]),qh=h(["axis","x","default"]),rh=h(["axis","x","label"],{}),sh=h(["axis","y","show"],!0),th=h(["axis","y","max"]),uh=h(["axis","y","min"]),vh=h(["axis","y","center"]),wh=h(["axis","y","label"],{}),xh=h(["axis","y","inner"],!1),yh=h(["axis","y","tick","format"]),zh=h(["axis","y","padding"],{}),Ah=h(["axis","y","ticks"],10),Bh=h(["axis","y2","show"],!1),Ch=h(["axis","y2","max"]),Dh=h(["axis","y2","min"]),Eh=h(["axis","y2","center"]),Fh=h(["axis","y2","label"],{}),Gh=h(["axis","y2","inner"],!1),Hh=h(["axis","y2","tick","format"]),Ih=h(["axis","y2","padding"],{}),Jh=h(["axis","y2","ticks"],10),Kh=h(["grid","x","show"],!1),Lh=h(["grid","x","type"],"tick"),Mh=h(["grid","x","lines"],[]),Nh=h(["grid","y","show"],!1),Oh=h(["grid","y","lines"],[]),Ph=h(["grid","y","ticks"],10),Qh=h(["point","show"],!0),Rh=Qh?h(["point","r"],2.5):0,Sh=h(["point","focus","line","enabled"],!0),Th=h(["point","focus","expand","enabled"],!0),Uh=h(["point","focus","expand","r"],Th?4:Rh),Vh=h(["point","focus","select","r"],8),Wh=h(["line","connect_null"],!1),Xh=h(["bar","width"]),Yh=h(["bar","width","ratio"],.6),Zh=h(["pie","label","show"],!0),$h=h(["pie","label","format"]),_h=h(["pie","expand"],!0),ai=h(["pie","onclick"],function(){}),bi=h(["pie","onmouseover"],function(){}),ci=h(["pie","onmouseout"],function(){}),di=h(["donut","label","show"],!0),ei=h(["donut","label","format"]),fi=h(["donut","expand"],!0),gi=h(["donut","title"],""),hi=h(["donut","onclick"],function(){}),ii=h(["donut","onmouseover"],function(){}),ji=h(["donut","onmouseout"],function(){}),ki=h(["regions"],[]),li=h(["tooltip","show"],!0),mi=h(["tooltip","format","title"]),ni=h(["tooltip","format","value"]),oi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=mi?mi:b,l=ni?ni:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),pi=h(["tooltip","init","show"],!1),qi=h(["tooltip","init","x"],0),ri=h(["tooltip","init","position"],{top:"0px",left:"50px"}),si=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ti=si+"-xaxis",ui=si+"-yaxis",vi=i(si),wi=i(ti),xi=i(ui),yi="timeseries"===bh,zi="categorized"===bh,Ai=!yi&&(sg||we(tg)),Bi=null,Ci=!1,Di=!1,Ei=!1,Fi=!1,Gi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Hi=qe(Gg,we(Ug)?Ug:Gi,Fg),Ii=ch?wf.time.format:wf.time.format.utc,Ji=function(){var a=[[Ii("%Y/%-m/%-d"),function(){return!0}],[Ii("%-m/%-d"),function(a){return a.getMonth()}],[Ii("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ii("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ii("%I %p"),function(a){return a.getHours()}],[Ii("%I:%M"),function(a){return a.getMinutes()}],[Ii(":%S"),function(a){return a.getSeconds()}],[Ii(".%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)}}(),Ki=[],Li=[],Mi=_g?"left":"bottom",Ni=_g?xh?"top":"bottom":xh?"right":"left",Oi=_g?Gh?"bottom":"top":Gh?"left":"right",Pi=_g?"left":"bottom",Qi={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(_g?0:Rf)+")"},y:function(){return"translate(0,"+(_g?Rf:0)+")"},y2:function(){return"translate("+(_g?0:Pf)+","+(_g?1:0)+")"},subx:function(){return"translate(0,"+(_g?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Ri="right"===Wg,Si=0,Ti=0,Ui=0,Vi=.15,Wi=30,Xi=_g&&!ah?0:30,Yi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Zi,$i=function(){var a=wf.svg.line().x(_g?function(a){return V(a.id)(a.value)}:Cd).y(_g?Cd:function(a){return V(a.id)(a.value)});return Wh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Wh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),_i=function(){var a;return a=_g?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a=wf.svg.line().x(_g?function(a){return W(a.id)(a.value)}:Fd).y(_g?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),bj=function(){};Zi=wf.svg.brush().on("brush",_e),Zi.update=function(){return fj&&fj.select("."+f.brush).call(this),this},Zi.scale=function(a){return _g?this.y(a):this.x(a)},Ef&&(bj=wf.behavior.zoom().on("zoomstart",function(){bj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),bj.scale=function(a){return _g?this.y(a):this.x(a)},bj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},bj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(jj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var cj,dj,ej,fj,gj,hj,ij,jj,kj,lj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),cj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?pf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),cj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?qf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Vi),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){Zi.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&zi&&(dh=a.categories,og.categories(dh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(ej.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Ig||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Jg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Ig||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Jg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0})},xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Mh=a,$e(),Mh):Mh},xf.xgrids.add=function(a){return a?xf.xgrids(Mh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a); return xf.xgrids(Mh.filter(b))},xf.ygrids=function(a){return a?(Oh=a,$e(),Oh):Oh},xf.ygrids.add=function(a){return a?xf.ygrids(Oh.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Oh.filter(b))},xf.regions=function(a){return c(a)?ki:(ki=a,$e(),ki)},xf.regions.add=function(a){return c(a)?ki:(ki=ki.concat(a),$e(),ki)},xf.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;cj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ki=ki.filter(function(b){return b.classes.indexOf(a)<0})}),ki},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(th=+a.y),b(a.y2)&&(Ch=+a.y2)):th=Ch=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){Vg||(Vg=!0,gj.style("visibility","visible")),pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0}),Vg&&ve(a)&&(Vg=!1,gj.style("visibility","hidden"))},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},ij.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 7f4e03c676d51e48d0dc78381a4ad3e6ec04be7b Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Tue, 29 Apr 2014 21:10:43 +0900 Subject: [PATCH 087/178] Update version to 0.1.33 --- bower.json | 2 +- c3.js | 2 +- c3.min.js | 2 +- package.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bower.json b/bower.json index b6a0675..069e26d 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "c3", "main": "c3.min.js", - "version": "0.1.32", + "version": "0.1.33", "homepage": "https://github.com/masayuki0812/c3", "authors": [ "Masayuki Tanaka " diff --git a/c3.js b/c3.js index 8f794c3..c1838de 100644 --- a/c3.js +++ b/c3.js @@ -2,7 +2,7 @@ 'use strict'; var c3 = { - version: "0.1.32" + version: "0.1.33" }; var CLASS = { diff --git a/c3.min.js b/c3.min.js index 7bcad33..099413e 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.32"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cPf&&(Pf=0),0>Rf&&(Rf=0),Qf=_g?Mf.left-Wi-Xi:Pf,Sf=_g?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Ri&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){ej.select("line."+f.xgridFocus).attr("x1",_g?0:-10).attr("x2",_g?Pf:-10).attr("y1",_g?-10:Mf.top).attr("y2",_g?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=_g?f.axisX:f.axisY,b=ej.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:_g?ah?v("x"):1:!sh||xh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Ri?P()+(Bh&&!_g?v("y2"):a):Bh?Gh||_g?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||ah?"x"===a&&ph?ph:"y"!==a||sh?"y2"!==a||Bh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Yi:Vg&&!Ri?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!_g)}function C(){return A(!_g)}function D(){return z(_g)}function E(){return A(_g)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(ph?ph:0)+80:Rf+8}function H(){return F(!_g)}function I(){return G(!_g)}function J(){return F(_g)}function K(){return G(_g)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(zi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Si=a}function N(a){Ti=a}function O(a){Ui=a}function P(){return Vg?Ri?Ti*(Si+1):Tf:0}function Q(){return Vg?Ri?Uf:Ui*(Si+1):0}function R(){var a,b,c=!ig;ag=_g?1:0,bg=_g?Rf:Pf,cg=_g?0:Rf,dg=_g?Pf:1,eg=ag,fg=bg,gg=_g?0:Sf,hg=_g?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,jj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=kh?kh:c?void 0:og.tickValues(),og=X(ig,Mi,a,b),rg=X(lg,Pi,a,b),pg=Y(jg,Ni,yh,Ah),qg=Y(kg,Oi,Hh,Jh),c||(Zi.scale(lg),Ef&&bj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(yi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),zi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(zi?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),zi?(e.tickCentered(eh),ve(gh)&&(gh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},zi&&e.categories(dh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=yi?Ji:zi?Tc:function(a){return 0>a?a.toFixed(0):a};return fh&&("function"==typeof fh?a=fh:yi&&(a=function(a){return a?Ii(fh)(a):""})),a}function _(a){var b;return"y"===a?b=wh:"y2"===a?b=Fh:"x"===a&&(b=rh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?wh=b:"y2"===a?Fh=b:"x"===a&&(rh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",_g?"inner-top":"inner-right")}function hb(){return fb("y",_g?"inner-right":"inner-top")}function ib(){return fb("y2",_g?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!_g,gb())}function rb(){return nb(_g,hb())}function sb(){return nb(_g,ib())}function tb(){return ob(!_g,gb())}function ub(){return ob(_g,hb())}function vb(){return ob(_g,ib())}function wb(){var a=gb();return _g?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":ph?ph-10:"3em"}function xb(){var a=hb();return _g?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return _g?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!_g,gb())}function Ab(){return pb(_g,hb())}function Bb(){return pb(_g,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){ej.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),ej.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),ej.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.length>0)for(g=Sc(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 wf.max(Object.keys(i).map(function(a){return wf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Dh:uh,n="y2"===c?Ch:th,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Eh:vh,r=ud()&&_g;return 0===l.length?"y2"===c?kg.domain():jg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(jg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&zh&&(f=b(zh.top)?zh.top:e,g=b(zh.bottom)?zh.bottom:e),"y2"===c&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return nh?yi?re(nh):nh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return mh?yi?re(mh):mh:wf.max(a,function(a){return wf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return zi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof oh&&we(oh)?(e=b(oh.left)?oh.left:d,f=b(oh.right)?oh.right:d):e=f="number"==typeof oh?oh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=yi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=yi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?jg:kg;return b="y"===a.axis||"y2"===a.axis?_g?Rf:"start"in a?d(a.start):Rf:_g?"end"in a?ig(yi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),xf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=yi?a?a instanceof Date?a:re(a):re(mc(c,d)):Ai&&!zi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ai&&zi&&0===c&&g&&(0===e&&(dh=[]),dh.push(g)),("undefined"==typeof a[b]||xf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&xf.data.targets[0].values[a-1]?xf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(xf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(yi?new Date(i):i);j.push(e)}return yi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Ki=Ki.concat(a)}function Mc(a){Ki=Ki.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Li=Li.concat(a)}function Oc(a){Li=Li.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&li&&(hj.html(oi(a,$(),wd(k),Hi)).style("display","block"),d=hj.property("offsetWidth"),e=hj.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(_g?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),hj.style("top",i+"px").style("left",g+"px"))}function Qd(){hj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});li&&(be(xf.data.targets)||ee(xf.data.targets)||ej.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(_g?"y1":"x1",Cd).attr(_g?"y2":"x2",Cd))}function Sd(){ej.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return Xh?Xh:b?2*a.tickOffset()*Yh/b:0}function $d(a,b){Dc(a).forEach(function(a){lj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&fi||je(a)&&_h}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=_g?1:0,e=_g?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Og(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud).attr("stroke",function(){return Hi(b)}).attr("r",1.4*Vh).transition().duration(100).attr("r",Vh)}function Be(a,b,c){Pg(b,a.node()),ej.select("."+f.selectedCircles+ld(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){Og(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Hi(b)).darker(1)})}function Ee(a,b){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return Hi(b)})}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?ej.selectAll("."+f.circles+ld(c)):ej).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Uh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Rh)}function Ke(a){return ej.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=_g?1:0,f=_g?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 _g?(c=he(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.getBoundingClientRect();return _g?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return _g&&(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(ij=wf.select(zf),ij.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ij.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),jj=ig.domain(),Zi.scale(lg),Ef&&bj.scale(ig),cj=ij.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),dj=cj.append("defs"),dj.append("clipPath").attr("id",si).append("rect").attr("width",Pf).attr("height",Rf),dj.append("clipPath").attr("id",ti).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.append("clipPath").attr("id",ui).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej=cj.append("g").attr("transform",Qi.main),fj=cj.append("g").attr("transform",Qi.context),gj=cj.append("g").attr("transform",Qi.legend),Sg||fj.style("visibility","hidden"),Vg||(gj.style("visibility","hidden"),Li=Cc(xf.data.targets)),hj=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),ah&&ej.append("g").attr("class",f.axisX).attr("clip-path",wi).attr("transform",Qi.x).append("text").attr("class",f.axisXLabel).attr("transform",_g?"rotate(-90)":"").style("text-anchor",zb),sh&&ej.append("g").attr("class",f.axisY).attr("clip-path",xi).attr("transform",Qi.y).append("text").attr("class",f.axisYLabel).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Ab),Bh&&ej.append("g").attr("class",f.axisY2).attr("transform",Qi.y2).append("text").attr("class",f.axisY2Label).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Bb),d=ej.append("g").attr("clip-path",vi).attr("class",f.grid),Kh&&d.append("g").attr("class",f.xgrids),we(Mh)&&d.append("g").attr("class",f.xgridLines),Sh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Nh&&d.append("g").attr("class",f.ygrids),we(Oh)&&d.append("g").attr("class",f.ygridLines),ej.append("g").attr("clip-path",vi).attr("class",f.regions),ej.append("g").attr("clip-path",vi).attr("class",f.chart),c=ej.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?_g?"ns-resize":"ew-resize":null),ej.select("."+f.chart).append("g").attr("class",f.chartBars),ej.select("."+f.chart).append("g").attr("class",f.chartLines),ej.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Qi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),ej.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&ej.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",_g?"ns-resize":"ew-resize").call(bj).on("dblclick.zoom",null),qh&&Zi.extent("function"!=typeof qh?qh:qh(_b())),fj.append("g").attr("clip-path",vi).attr("class",f.chart),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.append("g").attr("clip-path",vi).attr("class",f.brush).call(Zi).selectAll("rect").attr(_g?"width":"height",_g?Qf:Sf),fj.append("g").attr("class",f.axisX).attr("transform",Qi.subx).attr("clip-path",_g?"":wi),ef(xf.data.targets),_g?ej.select("."+f.axisX).style("opacity",0).call(og):(ej.select("."+f.axisY).style("opacity",0).call(pg),ej.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),pi){if(yi&&"string"==typeof qi){for(qi=re(qi),e=0;ePf&&(Pf=0),0>Rf&&(Rf=0),Qf=_g?Mf.left-Wi-Xi:Pf,Sf=_g?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Ri&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){ej.select("line."+f.xgridFocus).attr("x1",_g?0:-10).attr("x2",_g?Pf:-10).attr("y1",_g?-10:Mf.top).attr("y2",_g?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=_g?f.axisX:f.axisY,b=ej.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:_g?ah?v("x"):1:!sh||xh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Ri?P()+(Bh&&!_g?v("y2"):a):Bh?Gh||_g?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||ah?"x"===a&&ph?ph:"y"!==a||sh?"y2"!==a||Bh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Yi:Vg&&!Ri?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!_g)}function C(){return A(!_g)}function D(){return z(_g)}function E(){return A(_g)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(ph?ph:0)+80:Rf+8}function H(){return F(!_g)}function I(){return G(!_g)}function J(){return F(_g)}function K(){return G(_g)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(zi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Si=a}function N(a){Ti=a}function O(a){Ui=a}function P(){return Vg?Ri?Ti*(Si+1):Tf:0}function Q(){return Vg?Ri?Uf:Ui*(Si+1):0}function R(){var a,b,c=!ig;ag=_g?1:0,bg=_g?Rf:Pf,cg=_g?0:Rf,dg=_g?Pf:1,eg=ag,fg=bg,gg=_g?0:Sf,hg=_g?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,jj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=kh?kh:c?void 0:og.tickValues(),og=X(ig,Mi,a,b),rg=X(lg,Pi,a,b),pg=Y(jg,Ni,yh,Ah),qg=Y(kg,Oi,Hh,Jh),c||(Zi.scale(lg),Ef&&bj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(yi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),zi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(zi?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),zi?(e.tickCentered(eh),ve(gh)&&(gh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},zi&&e.categories(dh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=yi?Ji:zi?Tc:function(a){return 0>a?a.toFixed(0):a};return fh&&("function"==typeof fh?a=fh:yi&&(a=function(a){return a?Ii(fh)(a):""})),a}function _(a){var b;return"y"===a?b=wh:"y2"===a?b=Fh:"x"===a&&(b=rh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?wh=b:"y2"===a?Fh=b:"x"===a&&(rh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",_g?"inner-top":"inner-right")}function hb(){return fb("y",_g?"inner-right":"inner-top")}function ib(){return fb("y2",_g?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!_g,gb())}function rb(){return nb(_g,hb())}function sb(){return nb(_g,ib())}function tb(){return ob(!_g,gb())}function ub(){return ob(_g,hb())}function vb(){return ob(_g,ib())}function wb(){var a=gb();return _g?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":ph?ph-10:"3em"}function xb(){var a=hb();return _g?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return _g?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!_g,gb())}function Ab(){return pb(_g,hb())}function Bb(){return pb(_g,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){ej.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),ej.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),ej.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.length>0)for(g=Sc(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 wf.max(Object.keys(i).map(function(a){return wf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Dh:uh,n="y2"===c?Ch:th,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Eh:vh,r=ud()&&_g;return 0===l.length?"y2"===c?kg.domain():jg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(jg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&zh&&(f=b(zh.top)?zh.top:e,g=b(zh.bottom)?zh.bottom:e),"y2"===c&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return nh?yi?re(nh):nh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return mh?yi?re(mh):mh:wf.max(a,function(a){return wf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return zi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof oh&&we(oh)?(e=b(oh.left)?oh.left:d,f=b(oh.right)?oh.right:d):e=f="number"==typeof oh?oh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=yi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=yi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?jg:kg;return b="y"===a.axis||"y2"===a.axis?_g?Rf:"start"in a?d(a.start):Rf:_g?"end"in a?ig(yi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),xf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=yi?a?a instanceof Date?a:re(a):re(mc(c,d)):Ai&&!zi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ai&&zi&&0===c&&g&&(0===e&&(dh=[]),dh.push(g)),("undefined"==typeof a[b]||xf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&xf.data.targets[0].values[a-1]?xf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(xf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(yi?new Date(i):i);j.push(e)}return yi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Ki=Ki.concat(a)}function Mc(a){Ki=Ki.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Li=Li.concat(a)}function Oc(a){Li=Li.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&li&&(hj.html(oi(a,$(),wd(k),Hi)).style("display","block"),d=hj.property("offsetWidth"),e=hj.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(_g?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),hj.style("top",i+"px").style("left",g+"px"))}function Qd(){hj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});li&&(be(xf.data.targets)||ee(xf.data.targets)||ej.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(_g?"y1":"x1",Cd).attr(_g?"y2":"x2",Cd))}function Sd(){ej.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return Xh?Xh:b?2*a.tickOffset()*Yh/b:0}function $d(a,b){Dc(a).forEach(function(a){lj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&fi||je(a)&&_h}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=_g?1:0,e=_g?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Og(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud).attr("stroke",function(){return Hi(b)}).attr("r",1.4*Vh).transition().duration(100).attr("r",Vh)}function Be(a,b,c){Pg(b,a.node()),ej.select("."+f.selectedCircles+ld(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){Og(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Hi(b)).darker(1)})}function Ee(a,b){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return Hi(b)})}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?ej.selectAll("."+f.circles+ld(c)):ej).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Uh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Rh)}function Ke(a){return ej.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=_g?1:0,f=_g?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 _g?(c=he(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.getBoundingClientRect();return _g?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return _g&&(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(ij=wf.select(zf),ij.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ij.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),jj=ig.domain(),Zi.scale(lg),Ef&&bj.scale(ig),cj=ij.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),dj=cj.append("defs"),dj.append("clipPath").attr("id",si).append("rect").attr("width",Pf).attr("height",Rf),dj.append("clipPath").attr("id",ti).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.append("clipPath").attr("id",ui).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej=cj.append("g").attr("transform",Qi.main),fj=cj.append("g").attr("transform",Qi.context),gj=cj.append("g").attr("transform",Qi.legend),Sg||fj.style("visibility","hidden"),Vg||(gj.style("visibility","hidden"),Li=Cc(xf.data.targets)),hj=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),ah&&ej.append("g").attr("class",f.axisX).attr("clip-path",wi).attr("transform",Qi.x).append("text").attr("class",f.axisXLabel).attr("transform",_g?"rotate(-90)":"").style("text-anchor",zb),sh&&ej.append("g").attr("class",f.axisY).attr("clip-path",xi).attr("transform",Qi.y).append("text").attr("class",f.axisYLabel).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Ab),Bh&&ej.append("g").attr("class",f.axisY2).attr("transform",Qi.y2).append("text").attr("class",f.axisY2Label).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Bb),d=ej.append("g").attr("clip-path",vi).attr("class",f.grid),Kh&&d.append("g").attr("class",f.xgrids),we(Mh)&&d.append("g").attr("class",f.xgridLines),Sh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Nh&&d.append("g").attr("class",f.ygrids),we(Oh)&&d.append("g").attr("class",f.ygridLines),ej.append("g").attr("clip-path",vi).attr("class",f.regions),ej.append("g").attr("clip-path",vi).attr("class",f.chart),c=ej.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?_g?"ns-resize":"ew-resize":null),ej.select("."+f.chart).append("g").attr("class",f.chartBars),ej.select("."+f.chart).append("g").attr("class",f.chartLines),ej.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Qi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),ej.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&ej.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",_g?"ns-resize":"ew-resize").call(bj).on("dblclick.zoom",null),qh&&Zi.extent("function"!=typeof qh?qh:qh(_b())),fj.append("g").attr("clip-path",vi).attr("class",f.chart),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.append("g").attr("clip-path",vi).attr("class",f.brush).call(Zi).selectAll("rect").attr(_g?"width":"height",_g?Qf:Sf),fj.append("g").attr("class",f.axisX).attr("transform",Qi.subx).attr("clip-path",_g?"":wi),ef(xf.data.targets),_g?ej.select("."+f.axisX).style("opacity",0).call(og):(ej.select("."+f.axisY).style("opacity",0).call(pg),ej.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),pi){if(yi&&"string"==typeof qi){for(qi=re(qi),e=0;e0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(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){ee(xf.data.targets)||Hg&&(Bi=a,ej.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ci=!0,Qg())}function Ze(){ee(xf.data.targets)||Hg&&(ej.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),ej.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ci=!1,Rg())}function $e(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=ej.select("."+f.axisX).style("opacity",W?0:1),g=ej.select("."+f.axisY).style("opacity",W?0:1),h=ej.select("."+f.axisY2).style("opacity",W?0:1),e=fj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Vg&&rf(Cc(xf.data.targets),a,O),zi&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),jj=ig.domain(),Ef&&bj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),Zi.scale(lg)),G&&(ig.domain(Zi.empty()?jj:Zi.extent()),Ef&&bj.scale(ig).updateScaleExtent()),kh||!jh&&!ih||(S=Kc(Jc(X),ih),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(gh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!_g&&lh&&eb(c,O.axisX,lh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),hj.style("display","none"),o(),ej.select("line."+f.xgridFocus).style("visibility","hidden"),Kh){if("year"===Lh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=ej.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",_g?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",_g?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",_g?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",_g?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(_g?"y1":"x1")===(_g?Rf:0)?0:1}),i.exit().remove()}we(Mh)&&(k=ej.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Mh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",_g?"":"rotate(-90)").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",_g?0:Dd).attr("x2",_g?Pf:Dd).attr("y1",_g?Dd:Mf.top).attr("y2",_g?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",_g?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Nh&&(m=ej.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Ph)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",_g?jg:0).attr("x2",_g?jg:Pf).attr("y1",_g?0:jg).attr("y2",_g?Rf:jg),m.exit().remove()),A&&we(Oh)&&(n=ej.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Oh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",_g?"rotate(-90)":"").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",_g?Ed:0).attr("x2",_g?Ed:Pf).attr("y1",_g?0:Ed).attr("y2",_g?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",_g?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=ej.select("."+f.regions).selectAll("rect."+f.region).data(ki),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=ej.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Hi(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=ej.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return _g?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),ej.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",$i).style("opacity",1),ej.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",_i).style("opacity",kj),q=ej.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Rh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),q.exit().remove(),ej.each(function(){Fi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Fi=!1}),ej.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),ej.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Sg&&(null!==wf.event&&"zoom"===wf.event.type&&Zi.extent(ig.orgDomain()).update(),B&&(!_g&&lh&&eb(e,O.axisSubX,lh),Zi.empty()||Zi.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Hi(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1))),ej.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),ej.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),v=ej.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ai&&!zi?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),ej.select("."+f.eventRects).datum(x?x.values:[]),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",_g?0:y).attr("y",_g?y:0).attr("width",_g?Pf:z).attr("height",_g?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){lj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&bj.altDomain?(ig.domain(bj.altDomain),void bj.scale(ig).updateScaleExtent()):(zi&&ig.orgDomain()[0]===jj[0]&&ig.domain([jj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Di=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){cj.attr("width",Tf).attr("height",Uf),cj.select("#"+si).select("rect").attr("width",Pf).attr("height",Rf),cj.select("#"+ti).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),cj.select("#"+ui).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),cj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),ij.style("max-height",Uf+"px")}function df(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=ej.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Hi(a)}),e=ej.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Jg(a)?"pointer":null}),c=ej.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)}),b.append("path").attr("class",dd).style("opacity",function(){return kj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Hi(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Hi(a)}).style("cursor",function(a){return Jg(a)?"pointer":null}),a.forEach(function(a){ej.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=ej.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Hi(a.data)}).style("cursor",function(a){return Jg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Sg&&(n=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Hi(a)}),l=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)})),cj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Ri?j:i,l=Ri?Q():P();return d&&(x=0,D=0,u=0,v=0),Vg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Ri?v:u,void($g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Ri?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=gj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Xg?Xg(a):xf.toggle(a)}).on("mouseover",function(a){Fi||xf.focus(a),"function"==typeof Yg&&Yg(a)}).on("mouseout",function(a){Fi||xf.revert(),"function"==typeof Zg&&Zg(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ri?h:-200).attr("y",Ri?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ri?i:-200).attr("y",Ri?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Hi(a)}).attr("x",Ri?h:-200).attr("y",Ri?-200:j).attr("width",10).attr("height",10),gj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),gj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),gj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Fi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"]),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","selection","enabled"],!1),Ig=h(["data","selection","grouped"],!1),Jg=h(["data","selection","isselectable"],function(){return!0}),Kg=h(["data","selection","multiple"],!0),Lg=h(["data","onclick"],function(){}),Mg=h(["data","onenter"],function(){}),Ng=h(["data","onleave"],function(){}),Og=h(["data","onselected"],function(){}),Pg=h(["data","onunselected"],function(){}),Qg=h(["data","ondragstart"],function(){}),Rg=h(["data","ondragend"],function(){}),Sg=h(["subchart","show"],!1),Tg=h(["subchart","size","height"],60),Ug=h(["color","pattern"],[]),Vg=h(["legend","show"],!0),Wg=h(["legend","position"],"bottom"),Xg=h(["legend","item","onclick"]),Yg=h(["legend","item","onmouseover"]),Zg=h(["legend","item","onmouseout"]),$g=h(["legend","equally"],!1),_g=h(["axis","rotated"],!1),ah=h(["axis","x","show"],!0),bh=h(["axis","x","type"],"indexed"),ch=h(["axis","x","localtime"],!0),dh=h(["axis","x","categories"],[]),eh=h(["axis","x","tick","centered"],!1),fh=h(["axis","x","tick","format"]),gh=h(["axis","x","tick","culling"],{}),hh=h(["axis","x","tick","culling","max"],10),ih=h(["axis","x","tick","count"]),jh=h(["axis","x","tick","fit"],!0),kh=h(["axis","x","tick","values"],null),lh=h(["axis","x","tick","rotate"]),mh=h(["axis","x","max"],null),nh=h(["axis","x","min"],null),oh=h(["axis","x","padding"],{}),ph=h(["axis","x","height"]),qh=h(["axis","x","default"]),rh=h(["axis","x","label"],{}),sh=h(["axis","y","show"],!0),th=h(["axis","y","max"]),uh=h(["axis","y","min"]),vh=h(["axis","y","center"]),wh=h(["axis","y","label"],{}),xh=h(["axis","y","inner"],!1),yh=h(["axis","y","tick","format"]),zh=h(["axis","y","padding"],{}),Ah=h(["axis","y","ticks"],10),Bh=h(["axis","y2","show"],!1),Ch=h(["axis","y2","max"]),Dh=h(["axis","y2","min"]),Eh=h(["axis","y2","center"]),Fh=h(["axis","y2","label"],{}),Gh=h(["axis","y2","inner"],!1),Hh=h(["axis","y2","tick","format"]),Ih=h(["axis","y2","padding"],{}),Jh=h(["axis","y2","ticks"],10),Kh=h(["grid","x","show"],!1),Lh=h(["grid","x","type"],"tick"),Mh=h(["grid","x","lines"],[]),Nh=h(["grid","y","show"],!1),Oh=h(["grid","y","lines"],[]),Ph=h(["grid","y","ticks"],10),Qh=h(["point","show"],!0),Rh=Qh?h(["point","r"],2.5):0,Sh=h(["point","focus","line","enabled"],!0),Th=h(["point","focus","expand","enabled"],!0),Uh=h(["point","focus","expand","r"],Th?4:Rh),Vh=h(["point","focus","select","r"],8),Wh=h(["line","connect_null"],!1),Xh=h(["bar","width"]),Yh=h(["bar","width","ratio"],.6),Zh=h(["pie","label","show"],!0),$h=h(["pie","label","format"]),_h=h(["pie","expand"],!0),ai=h(["pie","onclick"],function(){}),bi=h(["pie","onmouseover"],function(){}),ci=h(["pie","onmouseout"],function(){}),di=h(["donut","label","show"],!0),ei=h(["donut","label","format"]),fi=h(["donut","expand"],!0),gi=h(["donut","title"],""),hi=h(["donut","onclick"],function(){}),ii=h(["donut","onmouseover"],function(){}),ji=h(["donut","onmouseout"],function(){}),ki=h(["regions"],[]),li=h(["tooltip","show"],!0),mi=h(["tooltip","format","title"]),ni=h(["tooltip","format","value"]),oi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=mi?mi:b,l=ni?ni:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),pi=h(["tooltip","init","show"],!1),qi=h(["tooltip","init","x"],0),ri=h(["tooltip","init","position"],{top:"0px",left:"50px"}),si=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ti=si+"-xaxis",ui=si+"-yaxis",vi=i(si),wi=i(ti),xi=i(ui),yi="timeseries"===bh,zi="categorized"===bh,Ai=!yi&&(sg||we(tg)),Bi=null,Ci=!1,Di=!1,Ei=!1,Fi=!1,Gi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Hi=qe(Gg,we(Ug)?Ug:Gi,Fg),Ii=ch?wf.time.format:wf.time.format.utc,Ji=function(){var a=[[Ii("%Y/%-m/%-d"),function(){return!0}],[Ii("%-m/%-d"),function(a){return a.getMonth()}],[Ii("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ii("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ii("%I %p"),function(a){return a.getHours()}],[Ii("%I:%M"),function(a){return a.getMinutes()}],[Ii(":%S"),function(a){return a.getSeconds()}],[Ii(".%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)}}(),Ki=[],Li=[],Mi=_g?"left":"bottom",Ni=_g?xh?"top":"bottom":xh?"right":"left",Oi=_g?Gh?"bottom":"top":Gh?"left":"right",Pi=_g?"left":"bottom",Qi={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(_g?0:Rf)+")"},y:function(){return"translate(0,"+(_g?Rf:0)+")"},y2:function(){return"translate("+(_g?0:Pf)+","+(_g?1:0)+")"},subx:function(){return"translate(0,"+(_g?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Ri="right"===Wg,Si=0,Ti=0,Ui=0,Vi=.15,Wi=30,Xi=_g&&!ah?0:30,Yi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Zi,$i=function(){var a=wf.svg.line().x(_g?function(a){return V(a.id)(a.value)}:Cd).y(_g?Cd:function(a){return V(a.id)(a.value)});return Wh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Wh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),_i=function(){var a;return a=_g?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a=wf.svg.line().x(_g?function(a){return W(a.id)(a.value)}:Fd).y(_g?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),bj=function(){};Zi=wf.svg.brush().on("brush",_e),Zi.update=function(){return fj&&fj.select("."+f.brush).call(this),this},Zi.scale=function(a){return _g?this.y(a):this.x(a)},Ef&&(bj=wf.behavior.zoom().on("zoomstart",function(){bj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),bj.scale=function(a){return _g?this.y(a):this.x(a)},bj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},bj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(jj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var cj,dj,ej,fj,gj,hj,ij,jj,kj,lj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),cj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?pf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),cj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?qf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Vi),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){Zi.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&zi&&(dh=a.categories,og.categories(dh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(ej.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Ig||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Jg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Ig||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Jg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0})},xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Mh=a,$e(),Mh):Mh},xf.xgrids.add=function(a){return a?xf.xgrids(Mh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a); return xf.xgrids(Mh.filter(b))},xf.ygrids=function(a){return a?(Oh=a,$e(),Oh):Oh},xf.ygrids.add=function(a){return a?xf.ygrids(Oh.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Oh.filter(b))},xf.regions=function(a){return c(a)?ki:(ki=a,$e(),ki)},xf.regions.add=function(a){return c(a)?ki:(ki=ki.concat(a),$e(),ki)},xf.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;cj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ki=ki.filter(function(b){return b.classes.indexOf(a)<0})}),ki},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(th=+a.y),b(a.y2)&&(Ch=+a.y2)):th=Ch=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){Vg||(Vg=!0,gj.style("visibility","visible")),pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0}),Vg&&ve(a)&&(Vg=!1,gj.style("visibility","hidden"))},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},ij.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file diff --git a/package.json b/package.json index 84d69d5..fd94236 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "c3", - "version": "0.1.32", + "version": "0.1.33", "description": "D3-based reusable chart library", "main": "c3.js", "scripts": { From 0121bb7ee7cda3011066482ae1e10c585ebef0a4 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 30 Apr 2014 13:35:12 +0900 Subject: [PATCH 088/178] Fix transition --- c3.js | 7 ++++++- c3.min.js | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/c3.js b/c3.js index c1838de..b8145f4 100644 --- a/c3.js +++ b/c3.js @@ -3674,6 +3674,7 @@ .attr('class', classChartText); mainTextEnter = mainTextUpdate.enter().append('g') .attr('class', classChartText) + .style('opacity', 0) .style("pointer-events", "none"); mainTextEnter.append('g') .attr('class', classTexts) @@ -3685,6 +3686,7 @@ .attr('class', classChartBar); mainBarEnter = mainBarUpdate.enter().append('g') .attr('class', classChartBar) + .style('opacity', 0) .style("pointer-events", "none"); // Bars for each data mainBarEnter.append('g') @@ -3699,6 +3701,7 @@ .attr('class', classChartLine); mainLineEnter = mainLineUpdate.enter().append('g') .attr('class', classChartLine) + .style('opacity', 0) .style("pointer-events", "none"); // Lines for each data mainLineEnter.append("path") @@ -3789,6 +3792,7 @@ .data(targets) .attr('class', classChartBar); contextBarEnter = contextBarUpdate.enter().append('g') + .style('opacity', 0) .attr('class', classChartBar); // Bars for each data contextBarEnter.append('g') @@ -3800,6 +3804,7 @@ .data(targets) .attr('class', classChartLine); contextLineEnter = contextLineUpdate.enter().append('g') + .style('opacity', 0) .attr('class', classChartLine); // Lines for each data contextLineEnter.append("path") @@ -3812,7 +3817,7 @@ // Fade-in each chart svg.selectAll('.' + CLASS.target).filter(function (d) { return isTargetToShow(d.id); }) - .transition() + .transition().duration(750) .style("opacity", 1); } diff --git a/c3.min.js b/c3.min.js index 099413e..dbe2e38 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ !function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.33"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cPf&&(Pf=0),0>Rf&&(Rf=0),Qf=_g?Mf.left-Wi-Xi:Pf,Sf=_g?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Ri&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){ej.select("line."+f.xgridFocus).attr("x1",_g?0:-10).attr("x2",_g?Pf:-10).attr("y1",_g?-10:Mf.top).attr("y2",_g?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=_g?f.axisX:f.axisY,b=ej.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:_g?ah?v("x"):1:!sh||xh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Ri?P()+(Bh&&!_g?v("y2"):a):Bh?Gh||_g?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||ah?"x"===a&&ph?ph:"y"!==a||sh?"y2"!==a||Bh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Yi:Vg&&!Ri?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!_g)}function C(){return A(!_g)}function D(){return z(_g)}function E(){return A(_g)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(ph?ph:0)+80:Rf+8}function H(){return F(!_g)}function I(){return G(!_g)}function J(){return F(_g)}function K(){return G(_g)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(zi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Si=a}function N(a){Ti=a}function O(a){Ui=a}function P(){return Vg?Ri?Ti*(Si+1):Tf:0}function Q(){return Vg?Ri?Uf:Ui*(Si+1):0}function R(){var a,b,c=!ig;ag=_g?1:0,bg=_g?Rf:Pf,cg=_g?0:Rf,dg=_g?Pf:1,eg=ag,fg=bg,gg=_g?0:Sf,hg=_g?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,jj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=kh?kh:c?void 0:og.tickValues(),og=X(ig,Mi,a,b),rg=X(lg,Pi,a,b),pg=Y(jg,Ni,yh,Ah),qg=Y(kg,Oi,Hh,Jh),c||(Zi.scale(lg),Ef&&bj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(yi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),zi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(zi?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),zi?(e.tickCentered(eh),ve(gh)&&(gh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},zi&&e.categories(dh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=yi?Ji:zi?Tc:function(a){return 0>a?a.toFixed(0):a};return fh&&("function"==typeof fh?a=fh:yi&&(a=function(a){return a?Ii(fh)(a):""})),a}function _(a){var b;return"y"===a?b=wh:"y2"===a?b=Fh:"x"===a&&(b=rh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?wh=b:"y2"===a?Fh=b:"x"===a&&(rh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",_g?"inner-top":"inner-right")}function hb(){return fb("y",_g?"inner-right":"inner-top")}function ib(){return fb("y2",_g?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!_g,gb())}function rb(){return nb(_g,hb())}function sb(){return nb(_g,ib())}function tb(){return ob(!_g,gb())}function ub(){return ob(_g,hb())}function vb(){return ob(_g,ib())}function wb(){var a=gb();return _g?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":ph?ph-10:"3em"}function xb(){var a=hb();return _g?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return _g?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!_g,gb())}function Ab(){return pb(_g,hb())}function Bb(){return pb(_g,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){ej.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),ej.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),ej.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.length>0)for(g=Sc(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 wf.max(Object.keys(i).map(function(a){return wf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Dh:uh,n="y2"===c?Ch:th,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Eh:vh,r=ud()&&_g;return 0===l.length?"y2"===c?kg.domain():jg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(jg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&zh&&(f=b(zh.top)?zh.top:e,g=b(zh.bottom)?zh.bottom:e),"y2"===c&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return nh?yi?re(nh):nh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return mh?yi?re(mh):mh:wf.max(a,function(a){return wf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return zi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof oh&&we(oh)?(e=b(oh.left)?oh.left:d,f=b(oh.right)?oh.right:d):e=f="number"==typeof oh?oh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=yi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=yi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?jg:kg;return b="y"===a.axis||"y2"===a.axis?_g?Rf:"start"in a?d(a.start):Rf:_g?"end"in a?ig(yi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),xf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=yi?a?a instanceof Date?a:re(a):re(mc(c,d)):Ai&&!zi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ai&&zi&&0===c&&g&&(0===e&&(dh=[]),dh.push(g)),("undefined"==typeof a[b]||xf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&xf.data.targets[0].values[a-1]?xf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(xf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(yi?new Date(i):i);j.push(e)}return yi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Ki=Ki.concat(a)}function Mc(a){Ki=Ki.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Li=Li.concat(a)}function Oc(a){Li=Li.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&li&&(hj.html(oi(a,$(),wd(k),Hi)).style("display","block"),d=hj.property("offsetWidth"),e=hj.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(_g?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),hj.style("top",i+"px").style("left",g+"px"))}function Qd(){hj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});li&&(be(xf.data.targets)||ee(xf.data.targets)||ej.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(_g?"y1":"x1",Cd).attr(_g?"y2":"x2",Cd))}function Sd(){ej.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return Xh?Xh:b?2*a.tickOffset()*Yh/b:0}function $d(a,b){Dc(a).forEach(function(a){lj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&fi||je(a)&&_h}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=_g?1:0,e=_g?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Og(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud).attr("stroke",function(){return Hi(b)}).attr("r",1.4*Vh).transition().duration(100).attr("r",Vh)}function Be(a,b,c){Pg(b,a.node()),ej.select("."+f.selectedCircles+ld(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){Og(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Hi(b)).darker(1)})}function Ee(a,b){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return Hi(b)})}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?ej.selectAll("."+f.circles+ld(c)):ej).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Uh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Rh)}function Ke(a){return ej.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=_g?1:0,f=_g?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 _g?(c=he(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.getBoundingClientRect();return _g?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return _g&&(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(ij=wf.select(zf),ij.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ij.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),jj=ig.domain(),Zi.scale(lg),Ef&&bj.scale(ig),cj=ij.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),dj=cj.append("defs"),dj.append("clipPath").attr("id",si).append("rect").attr("width",Pf).attr("height",Rf),dj.append("clipPath").attr("id",ti).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.append("clipPath").attr("id",ui).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej=cj.append("g").attr("transform",Qi.main),fj=cj.append("g").attr("transform",Qi.context),gj=cj.append("g").attr("transform",Qi.legend),Sg||fj.style("visibility","hidden"),Vg||(gj.style("visibility","hidden"),Li=Cc(xf.data.targets)),hj=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),ah&&ej.append("g").attr("class",f.axisX).attr("clip-path",wi).attr("transform",Qi.x).append("text").attr("class",f.axisXLabel).attr("transform",_g?"rotate(-90)":"").style("text-anchor",zb),sh&&ej.append("g").attr("class",f.axisY).attr("clip-path",xi).attr("transform",Qi.y).append("text").attr("class",f.axisYLabel).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Ab),Bh&&ej.append("g").attr("class",f.axisY2).attr("transform",Qi.y2).append("text").attr("class",f.axisY2Label).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Bb),d=ej.append("g").attr("clip-path",vi).attr("class",f.grid),Kh&&d.append("g").attr("class",f.xgrids),we(Mh)&&d.append("g").attr("class",f.xgridLines),Sh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Nh&&d.append("g").attr("class",f.ygrids),we(Oh)&&d.append("g").attr("class",f.ygridLines),ej.append("g").attr("clip-path",vi).attr("class",f.regions),ej.append("g").attr("clip-path",vi).attr("class",f.chart),c=ej.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?_g?"ns-resize":"ew-resize":null),ej.select("."+f.chart).append("g").attr("class",f.chartBars),ej.select("."+f.chart).append("g").attr("class",f.chartLines),ej.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Qi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),ej.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&ej.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",_g?"ns-resize":"ew-resize").call(bj).on("dblclick.zoom",null),qh&&Zi.extent("function"!=typeof qh?qh:qh(_b())),fj.append("g").attr("clip-path",vi).attr("class",f.chart),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.append("g").attr("clip-path",vi).attr("class",f.brush).call(Zi).selectAll("rect").attr(_g?"width":"height",_g?Qf:Sf),fj.append("g").attr("class",f.axisX).attr("transform",Qi.subx).attr("clip-path",_g?"":wi),ef(xf.data.targets),_g?ej.select("."+f.axisX).style("opacity",0).call(og):(ej.select("."+f.axisY).style("opacity",0).call(pg),ej.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),pi){if(yi&&"string"==typeof qi){for(qi=re(qi),e=0;e0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(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){ee(xf.data.targets)||Hg&&(Bi=a,ej.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ci=!0,Qg())}function Ze(){ee(xf.data.targets)||Hg&&(ej.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),ej.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ci=!1,Rg())}function $e(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=ej.select("."+f.axisX).style("opacity",W?0:1),g=ej.select("."+f.axisY).style("opacity",W?0:1),h=ej.select("."+f.axisY2).style("opacity",W?0:1),e=fj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Vg&&rf(Cc(xf.data.targets),a,O),zi&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),jj=ig.domain(),Ef&&bj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),Zi.scale(lg)),G&&(ig.domain(Zi.empty()?jj:Zi.extent()),Ef&&bj.scale(ig).updateScaleExtent()),kh||!jh&&!ih||(S=Kc(Jc(X),ih),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(gh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!_g&&lh&&eb(c,O.axisX,lh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),hj.style("display","none"),o(),ej.select("line."+f.xgridFocus).style("visibility","hidden"),Kh){if("year"===Lh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=ej.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",_g?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",_g?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",_g?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",_g?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(_g?"y1":"x1")===(_g?Rf:0)?0:1}),i.exit().remove()}we(Mh)&&(k=ej.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Mh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",_g?"":"rotate(-90)").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",_g?0:Dd).attr("x2",_g?Pf:Dd).attr("y1",_g?Dd:Mf.top).attr("y2",_g?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",_g?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Nh&&(m=ej.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Ph)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",_g?jg:0).attr("x2",_g?jg:Pf).attr("y1",_g?0:jg).attr("y2",_g?Rf:jg),m.exit().remove()),A&&we(Oh)&&(n=ej.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Oh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",_g?"rotate(-90)":"").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",_g?Ed:0).attr("x2",_g?Ed:Pf).attr("y1",_g?0:Ed).attr("y2",_g?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",_g?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=ej.select("."+f.regions).selectAll("rect."+f.region).data(ki),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=ej.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Hi(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=ej.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return _g?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),ej.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",$i).style("opacity",1),ej.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",_i).style("opacity",kj),q=ej.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Rh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),q.exit().remove(),ej.each(function(){Fi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Fi=!1}),ej.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),ej.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Sg&&(null!==wf.event&&"zoom"===wf.event.type&&Zi.extent(ig.orgDomain()).update(),B&&(!_g&&lh&&eb(e,O.axisSubX,lh),Zi.empty()||Zi.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Hi(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1))),ej.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),ej.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),v=ej.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ai&&!zi?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),ej.select("."+f.eventRects).datum(x?x.values:[]),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",_g?0:y).attr("y",_g?y:0).attr("width",_g?Pf:z).attr("height",_g?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){lj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&bj.altDomain?(ig.domain(bj.altDomain),void bj.scale(ig).updateScaleExtent()):(zi&&ig.orgDomain()[0]===jj[0]&&ig.domain([jj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Di=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){cj.attr("width",Tf).attr("height",Uf),cj.select("#"+si).select("rect").attr("width",Pf).attr("height",Rf),cj.select("#"+ti).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),cj.select("#"+ui).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),cj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),ij.style("max-height",Uf+"px")}function df(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=ej.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Hi(a)}),e=ej.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Jg(a)?"pointer":null}),c=ej.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)}),b.append("path").attr("class",dd).style("opacity",function(){return kj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Hi(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Hi(a)}).style("cursor",function(a){return Jg(a)?"pointer":null}),a.forEach(function(a){ej.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=ej.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Hi(a.data)}).style("cursor",function(a){return Jg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Sg&&(n=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Hi(a)}),l=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)})),cj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Ri?j:i,l=Ri?Q():P();return d&&(x=0,D=0,u=0,v=0),Vg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Ri?v:u,void($g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Ri?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=gj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Xg?Xg(a):xf.toggle(a)}).on("mouseover",function(a){Fi||xf.focus(a),"function"==typeof Yg&&Yg(a)}).on("mouseout",function(a){Fi||xf.revert(),"function"==typeof Zg&&Zg(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ri?h:-200).attr("y",Ri?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ri?i:-200).attr("y",Ri?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Hi(a)}).attr("x",Ri?h:-200).attr("y",Ri?-200:j).attr("width",10).attr("height",10),gj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),gj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),gj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Fi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"]),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","selection","enabled"],!1),Ig=h(["data","selection","grouped"],!1),Jg=h(["data","selection","isselectable"],function(){return!0}),Kg=h(["data","selection","multiple"],!0),Lg=h(["data","onclick"],function(){}),Mg=h(["data","onenter"],function(){}),Ng=h(["data","onleave"],function(){}),Og=h(["data","onselected"],function(){}),Pg=h(["data","onunselected"],function(){}),Qg=h(["data","ondragstart"],function(){}),Rg=h(["data","ondragend"],function(){}),Sg=h(["subchart","show"],!1),Tg=h(["subchart","size","height"],60),Ug=h(["color","pattern"],[]),Vg=h(["legend","show"],!0),Wg=h(["legend","position"],"bottom"),Xg=h(["legend","item","onclick"]),Yg=h(["legend","item","onmouseover"]),Zg=h(["legend","item","onmouseout"]),$g=h(["legend","equally"],!1),_g=h(["axis","rotated"],!1),ah=h(["axis","x","show"],!0),bh=h(["axis","x","type"],"indexed"),ch=h(["axis","x","localtime"],!0),dh=h(["axis","x","categories"],[]),eh=h(["axis","x","tick","centered"],!1),fh=h(["axis","x","tick","format"]),gh=h(["axis","x","tick","culling"],{}),hh=h(["axis","x","tick","culling","max"],10),ih=h(["axis","x","tick","count"]),jh=h(["axis","x","tick","fit"],!0),kh=h(["axis","x","tick","values"],null),lh=h(["axis","x","tick","rotate"]),mh=h(["axis","x","max"],null),nh=h(["axis","x","min"],null),oh=h(["axis","x","padding"],{}),ph=h(["axis","x","height"]),qh=h(["axis","x","default"]),rh=h(["axis","x","label"],{}),sh=h(["axis","y","show"],!0),th=h(["axis","y","max"]),uh=h(["axis","y","min"]),vh=h(["axis","y","center"]),wh=h(["axis","y","label"],{}),xh=h(["axis","y","inner"],!1),yh=h(["axis","y","tick","format"]),zh=h(["axis","y","padding"],{}),Ah=h(["axis","y","ticks"],10),Bh=h(["axis","y2","show"],!1),Ch=h(["axis","y2","max"]),Dh=h(["axis","y2","min"]),Eh=h(["axis","y2","center"]),Fh=h(["axis","y2","label"],{}),Gh=h(["axis","y2","inner"],!1),Hh=h(["axis","y2","tick","format"]),Ih=h(["axis","y2","padding"],{}),Jh=h(["axis","y2","ticks"],10),Kh=h(["grid","x","show"],!1),Lh=h(["grid","x","type"],"tick"),Mh=h(["grid","x","lines"],[]),Nh=h(["grid","y","show"],!1),Oh=h(["grid","y","lines"],[]),Ph=h(["grid","y","ticks"],10),Qh=h(["point","show"],!0),Rh=Qh?h(["point","r"],2.5):0,Sh=h(["point","focus","line","enabled"],!0),Th=h(["point","focus","expand","enabled"],!0),Uh=h(["point","focus","expand","r"],Th?4:Rh),Vh=h(["point","focus","select","r"],8),Wh=h(["line","connect_null"],!1),Xh=h(["bar","width"]),Yh=h(["bar","width","ratio"],.6),Zh=h(["pie","label","show"],!0),$h=h(["pie","label","format"]),_h=h(["pie","expand"],!0),ai=h(["pie","onclick"],function(){}),bi=h(["pie","onmouseover"],function(){}),ci=h(["pie","onmouseout"],function(){}),di=h(["donut","label","show"],!0),ei=h(["donut","label","format"]),fi=h(["donut","expand"],!0),gi=h(["donut","title"],""),hi=h(["donut","onclick"],function(){}),ii=h(["donut","onmouseover"],function(){}),ji=h(["donut","onmouseout"],function(){}),ki=h(["regions"],[]),li=h(["tooltip","show"],!0),mi=h(["tooltip","format","title"]),ni=h(["tooltip","format","value"]),oi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=mi?mi:b,l=ni?ni:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),pi=h(["tooltip","init","show"],!1),qi=h(["tooltip","init","x"],0),ri=h(["tooltip","init","position"],{top:"0px",left:"50px"}),si=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ti=si+"-xaxis",ui=si+"-yaxis",vi=i(si),wi=i(ti),xi=i(ui),yi="timeseries"===bh,zi="categorized"===bh,Ai=!yi&&(sg||we(tg)),Bi=null,Ci=!1,Di=!1,Ei=!1,Fi=!1,Gi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Hi=qe(Gg,we(Ug)?Ug:Gi,Fg),Ii=ch?wf.time.format:wf.time.format.utc,Ji=function(){var a=[[Ii("%Y/%-m/%-d"),function(){return!0}],[Ii("%-m/%-d"),function(a){return a.getMonth()}],[Ii("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ii("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ii("%I %p"),function(a){return a.getHours()}],[Ii("%I:%M"),function(a){return a.getMinutes()}],[Ii(":%S"),function(a){return a.getSeconds()}],[Ii(".%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)}}(),Ki=[],Li=[],Mi=_g?"left":"bottom",Ni=_g?xh?"top":"bottom":xh?"right":"left",Oi=_g?Gh?"bottom":"top":Gh?"left":"right",Pi=_g?"left":"bottom",Qi={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(_g?0:Rf)+")"},y:function(){return"translate(0,"+(_g?Rf:0)+")"},y2:function(){return"translate("+(_g?0:Pf)+","+(_g?1:0)+")"},subx:function(){return"translate(0,"+(_g?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Ri="right"===Wg,Si=0,Ti=0,Ui=0,Vi=.15,Wi=30,Xi=_g&&!ah?0:30,Yi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Zi,$i=function(){var a=wf.svg.line().x(_g?function(a){return V(a.id)(a.value)}:Cd).y(_g?Cd:function(a){return V(a.id)(a.value)});return Wh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Wh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),_i=function(){var a;return a=_g?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a=wf.svg.line().x(_g?function(a){return W(a.id)(a.value)}:Fd).y(_g?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),bj=function(){};Zi=wf.svg.brush().on("brush",_e),Zi.update=function(){return fj&&fj.select("."+f.brush).call(this),this},Zi.scale=function(a){return _g?this.y(a):this.x(a)},Ef&&(bj=wf.behavior.zoom().on("zoomstart",function(){bj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),bj.scale=function(a){return _g?this.y(a):this.x(a)},bj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},bj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(jj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var cj,dj,ej,fj,gj,hj,ij,jj,kj,lj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),cj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?pf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),cj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?qf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Vi),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){Zi.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&zi&&(dh=a.categories,og.categories(dh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(ej.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Ig||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Jg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Ig||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Jg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0})},xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Mh=a,$e(),Mh):Mh},xf.xgrids.add=function(a){return a?xf.xgrids(Mh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a); -return xf.xgrids(Mh.filter(b))},xf.ygrids=function(a){return a?(Oh=a,$e(),Oh):Oh},xf.ygrids.add=function(a){return a?xf.ygrids(Oh.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Oh.filter(b))},xf.regions=function(a){return c(a)?ki:(ki=a,$e(),ki)},xf.regions.add=function(a){return c(a)?ki:(ki=ki.concat(a),$e(),ki)},xf.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;cj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ki=ki.filter(function(b){return b.classes.indexOf(a)<0})}),ki},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(th=+a.y),b(a.y2)&&(Ch=+a.y2)):th=Ch=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){Vg||(Vg=!0,gj.style("visibility","visible")),pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0}),Vg&&ve(a)&&(Vg=!1,gj.style("visibility","hidden"))},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},ij.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file +}hj.html(oi(xf.data.targets.map(function(a){return pc(a.values[qi])}),$(),wd(ee(xf.data.targets)),Hi)),hj.style("top",ri.top).style("left",ri.left).style("display","block")}null==a.onresize&&(a.onresize=bf()),a.onresize.add&&(a.onresize.add(Jf),a.onresize.add(function(){df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})}),a.onresize.add(Kf))}function Ue(a){a.append("rect").attr("class",fd).style("cursor",Hg&&Ig?"pointer":null).on("mouseover",function(a,b){if(!Ci&&!ee(xf.data.targets)){var c,d,e=xf.data.targets.map(function(a){return pc(a.values[b])});if(Object.keys(wg).length>0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(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){ee(xf.data.targets)||Hg&&(Bi=a,ej.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ci=!0,Qg())}function Ze(){ee(xf.data.targets)||Hg&&(ej.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),ej.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ci=!1,Rg())}function $e(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=ej.select("."+f.axisX).style("opacity",W?0:1),g=ej.select("."+f.axisY).style("opacity",W?0:1),h=ej.select("."+f.axisY2).style("opacity",W?0:1),e=fj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Vg&&rf(Cc(xf.data.targets),a,O),zi&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),jj=ig.domain(),Ef&&bj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),Zi.scale(lg)),G&&(ig.domain(Zi.empty()?jj:Zi.extent()),Ef&&bj.scale(ig).updateScaleExtent()),kh||!jh&&!ih||(S=Kc(Jc(X),ih),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(gh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!_g&&lh&&eb(c,O.axisX,lh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),hj.style("display","none"),o(),ej.select("line."+f.xgridFocus).style("visibility","hidden"),Kh){if("year"===Lh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=ej.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",_g?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",_g?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",_g?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",_g?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(_g?"y1":"x1")===(_g?Rf:0)?0:1}),i.exit().remove()}we(Mh)&&(k=ej.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Mh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",_g?"":"rotate(-90)").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",_g?0:Dd).attr("x2",_g?Pf:Dd).attr("y1",_g?Dd:Mf.top).attr("y2",_g?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",_g?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Nh&&(m=ej.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Ph)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",_g?jg:0).attr("x2",_g?jg:Pf).attr("y1",_g?0:jg).attr("y2",_g?Rf:jg),m.exit().remove()),A&&we(Oh)&&(n=ej.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Oh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",_g?"rotate(-90)":"").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",_g?Ed:0).attr("x2",_g?Ed:Pf).attr("y1",_g?0:Ed).attr("y2",_g?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",_g?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=ej.select("."+f.regions).selectAll("rect."+f.region).data(ki),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=ej.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Hi(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=ej.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return _g?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),ej.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",$i).style("opacity",1),ej.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",_i).style("opacity",kj),q=ej.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Rh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),q.exit().remove(),ej.each(function(){Fi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Fi=!1}),ej.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),ej.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Sg&&(null!==wf.event&&"zoom"===wf.event.type&&Zi.extent(ig.orgDomain()).update(),B&&(!_g&&lh&&eb(e,O.axisSubX,lh),Zi.empty()||Zi.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Hi(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1))),ej.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),ej.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),v=ej.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ai&&!zi?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),ej.select("."+f.eventRects).datum(x?x.values:[]),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",_g?0:y).attr("y",_g?y:0).attr("width",_g?Pf:z).attr("height",_g?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){lj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&bj.altDomain?(ig.domain(bj.altDomain),void bj.scale(ig).updateScaleExtent()):(zi&&ig.orgDomain()[0]===jj[0]&&ig.domain([jj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Di=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){cj.attr("width",Tf).attr("height",Uf),cj.select("#"+si).select("rect").attr("width",Pf).attr("height",Rf),cj.select("#"+ti).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),cj.select("#"+ui).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),cj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),ij.style("max-height",Uf+"px")}function df(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=ej.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Hi(a)}),e=ej.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Jg(a)?"pointer":null}),c=ej.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)}),b.append("path").attr("class",dd).style("opacity",function(){return kj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Hi(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Hi(a)}).style("cursor",function(a){return Jg(a)?"pointer":null}),a.forEach(function(a){ej.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=ej.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Hi(a.data)}).style("cursor",function(a){return Jg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Sg&&(n=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Hi(a)}),l=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)})),cj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(750).style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Ri?j:i,l=Ri?Q():P();return d&&(x=0,D=0,u=0,v=0),Vg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Ri?v:u,void($g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Ri?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=gj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Xg?Xg(a):xf.toggle(a)}).on("mouseover",function(a){Fi||xf.focus(a),"function"==typeof Yg&&Yg(a)}).on("mouseout",function(a){Fi||xf.revert(),"function"==typeof Zg&&Zg(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ri?h:-200).attr("y",Ri?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ri?i:-200).attr("y",Ri?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Hi(a)}).attr("x",Ri?h:-200).attr("y",Ri?-200:j).attr("width",10).attr("height",10),gj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),gj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),gj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Fi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"]),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","selection","enabled"],!1),Ig=h(["data","selection","grouped"],!1),Jg=h(["data","selection","isselectable"],function(){return!0}),Kg=h(["data","selection","multiple"],!0),Lg=h(["data","onclick"],function(){}),Mg=h(["data","onenter"],function(){}),Ng=h(["data","onleave"],function(){}),Og=h(["data","onselected"],function(){}),Pg=h(["data","onunselected"],function(){}),Qg=h(["data","ondragstart"],function(){}),Rg=h(["data","ondragend"],function(){}),Sg=h(["subchart","show"],!1),Tg=h(["subchart","size","height"],60),Ug=h(["color","pattern"],[]),Vg=h(["legend","show"],!0),Wg=h(["legend","position"],"bottom"),Xg=h(["legend","item","onclick"]),Yg=h(["legend","item","onmouseover"]),Zg=h(["legend","item","onmouseout"]),$g=h(["legend","equally"],!1),_g=h(["axis","rotated"],!1),ah=h(["axis","x","show"],!0),bh=h(["axis","x","type"],"indexed"),ch=h(["axis","x","localtime"],!0),dh=h(["axis","x","categories"],[]),eh=h(["axis","x","tick","centered"],!1),fh=h(["axis","x","tick","format"]),gh=h(["axis","x","tick","culling"],{}),hh=h(["axis","x","tick","culling","max"],10),ih=h(["axis","x","tick","count"]),jh=h(["axis","x","tick","fit"],!0),kh=h(["axis","x","tick","values"],null),lh=h(["axis","x","tick","rotate"]),mh=h(["axis","x","max"],null),nh=h(["axis","x","min"],null),oh=h(["axis","x","padding"],{}),ph=h(["axis","x","height"]),qh=h(["axis","x","default"]),rh=h(["axis","x","label"],{}),sh=h(["axis","y","show"],!0),th=h(["axis","y","max"]),uh=h(["axis","y","min"]),vh=h(["axis","y","center"]),wh=h(["axis","y","label"],{}),xh=h(["axis","y","inner"],!1),yh=h(["axis","y","tick","format"]),zh=h(["axis","y","padding"],{}),Ah=h(["axis","y","ticks"],10),Bh=h(["axis","y2","show"],!1),Ch=h(["axis","y2","max"]),Dh=h(["axis","y2","min"]),Eh=h(["axis","y2","center"]),Fh=h(["axis","y2","label"],{}),Gh=h(["axis","y2","inner"],!1),Hh=h(["axis","y2","tick","format"]),Ih=h(["axis","y2","padding"],{}),Jh=h(["axis","y2","ticks"],10),Kh=h(["grid","x","show"],!1),Lh=h(["grid","x","type"],"tick"),Mh=h(["grid","x","lines"],[]),Nh=h(["grid","y","show"],!1),Oh=h(["grid","y","lines"],[]),Ph=h(["grid","y","ticks"],10),Qh=h(["point","show"],!0),Rh=Qh?h(["point","r"],2.5):0,Sh=h(["point","focus","line","enabled"],!0),Th=h(["point","focus","expand","enabled"],!0),Uh=h(["point","focus","expand","r"],Th?4:Rh),Vh=h(["point","focus","select","r"],8),Wh=h(["line","connect_null"],!1),Xh=h(["bar","width"]),Yh=h(["bar","width","ratio"],.6),Zh=h(["pie","label","show"],!0),$h=h(["pie","label","format"]),_h=h(["pie","expand"],!0),ai=h(["pie","onclick"],function(){}),bi=h(["pie","onmouseover"],function(){}),ci=h(["pie","onmouseout"],function(){}),di=h(["donut","label","show"],!0),ei=h(["donut","label","format"]),fi=h(["donut","expand"],!0),gi=h(["donut","title"],""),hi=h(["donut","onclick"],function(){}),ii=h(["donut","onmouseover"],function(){}),ji=h(["donut","onmouseout"],function(){}),ki=h(["regions"],[]),li=h(["tooltip","show"],!0),mi=h(["tooltip","format","title"]),ni=h(["tooltip","format","value"]),oi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=mi?mi:b,l=ni?ni:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),pi=h(["tooltip","init","show"],!1),qi=h(["tooltip","init","x"],0),ri=h(["tooltip","init","position"],{top:"0px",left:"50px"}),si=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ti=si+"-xaxis",ui=si+"-yaxis",vi=i(si),wi=i(ti),xi=i(ui),yi="timeseries"===bh,zi="categorized"===bh,Ai=!yi&&(sg||we(tg)),Bi=null,Ci=!1,Di=!1,Ei=!1,Fi=!1,Gi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Hi=qe(Gg,we(Ug)?Ug:Gi,Fg),Ii=ch?wf.time.format:wf.time.format.utc,Ji=function(){var a=[[Ii("%Y/%-m/%-d"),function(){return!0}],[Ii("%-m/%-d"),function(a){return a.getMonth()}],[Ii("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ii("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ii("%I %p"),function(a){return a.getHours()}],[Ii("%I:%M"),function(a){return a.getMinutes()}],[Ii(":%S"),function(a){return a.getSeconds()}],[Ii(".%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)}}(),Ki=[],Li=[],Mi=_g?"left":"bottom",Ni=_g?xh?"top":"bottom":xh?"right":"left",Oi=_g?Gh?"bottom":"top":Gh?"left":"right",Pi=_g?"left":"bottom",Qi={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(_g?0:Rf)+")"},y:function(){return"translate(0,"+(_g?Rf:0)+")"},y2:function(){return"translate("+(_g?0:Pf)+","+(_g?1:0)+")"},subx:function(){return"translate(0,"+(_g?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Ri="right"===Wg,Si=0,Ti=0,Ui=0,Vi=.15,Wi=30,Xi=_g&&!ah?0:30,Yi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Zi,$i=function(){var a=wf.svg.line().x(_g?function(a){return V(a.id)(a.value)}:Cd).y(_g?Cd:function(a){return V(a.id)(a.value)});return Wh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Wh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),_i=function(){var a;return a=_g?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a=wf.svg.line().x(_g?function(a){return W(a.id)(a.value)}:Fd).y(_g?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),bj=function(){};Zi=wf.svg.brush().on("brush",_e),Zi.update=function(){return fj&&fj.select("."+f.brush).call(this),this},Zi.scale=function(a){return _g?this.y(a):this.x(a)},Ef&&(bj=wf.behavior.zoom().on("zoomstart",function(){bj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),bj.scale=function(a){return _g?this.y(a):this.x(a)},bj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},bj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(jj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var cj,dj,ej,fj,gj,hj,ij,jj,kj,lj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),cj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?pf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),cj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?qf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Vi),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){Zi.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&zi&&(dh=a.categories,og.categories(dh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(ej.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Ig||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Jg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Ig||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Jg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0})},xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Mh=a,$e(),Mh):Mh +},xf.xgrids.add=function(a){return a?xf.xgrids(Mh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a);return xf.xgrids(Mh.filter(b))},xf.ygrids=function(a){return a?(Oh=a,$e(),Oh):Oh},xf.ygrids.add=function(a){return a?xf.ygrids(Oh.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Oh.filter(b))},xf.regions=function(a){return c(a)?ki:(ki=a,$e(),ki)},xf.regions.add=function(a){return c(a)?ki:(ki=ki.concat(a),$e(),ki)},xf.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;cj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ki=ki.filter(function(b){return b.classes.indexOf(a)<0})}),ki},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(th=+a.y),b(a.y2)&&(Ch=+a.y2)):th=Ch=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){Vg||(Vg=!0,gj.style("visibility","visible")),pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0}),Vg&&ve(a)&&(Vg=!1,gj.style("visibility","hidden"))},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},ij.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 740b558194e57ae0e6a88436c30f3e15e35599a5 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 30 Apr 2014 14:11:50 +0900 Subject: [PATCH 089/178] Revert chart state when legend clicked --- c3.js | 22 ++++++++++------------ c3.min.js | 4 ++-- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/c3.js b/c3.js index b8145f4..1947e84 100644 --- a/c3.js +++ b/c3.js @@ -1747,9 +1747,9 @@ return targetId || targetId === 0 ? '-' + (targetId.replace ? targetId.replace(/([^a-zA-Z0-9-_])/g, '-') : targetId) : ''; } function selectorTarget(id) { return '.' + CLASS.target + getTargetSelectorSuffix(id); } - function selectorTargets(ids) { return ids.map(function (id) { return selectorTarget(id); }); } + function selectorTargets(ids) { return ids.length ? ids.map(function (id) { return selectorTarget(id); }) : null; } function selectorLegend(id) { return '.' + CLASS.legendItem + getTargetSelectorSuffix(id); } - function selectorLegends(ids) { return ids.map(function (id) { return selectorLegend(id); }); } + function selectorLegends(ids) { return ids.length ? ids.map(function (id) { return selectorLegend(id); }) : null; } function initialOpacity(d) { return d.value !== null && withoutFadeIn[d.id] ? 1 : 0; @@ -4090,6 +4090,12 @@ .attr('x', xForLegend) .attr('y', yForLegend); + // toggle legend state + legend.selectAll('.' + CLASS.legendItem) + .classed(CLASS.legendItemHidden, function (id) { return !isTargetToShow(id); }) + .transition() + .style('opacity', function (id) { return isTargetToShow(id) ? 1 : legendOpacityForHidden; }); + // Update all to reflect change of legend updateLegendItemWidth(maxWidth); updateLegendItemHeight(maxHeight); @@ -4183,14 +4189,10 @@ if (options.withLegend) { showLegend(targetIds); - } else { - legend.selectAll(selectorLegends(targetIds)) - .classed(CLASS.legendItemHidden, false) - .transition() - .style('opacity', 1); } redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: true}); + c3.revert(); }; c3.hide = function (targetIds, options) { @@ -4204,14 +4206,10 @@ if (options.withLegend) { hideLegend(targetIds); - } else { - legend.selectAll(selectorLegends(targetIds)) - .classed(CLASS.legendItemHidden, true) - .transition() - .style('opacity', legendOpacityForHidden); } redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: true}); + c3.revert(); }; c3.toggle = function (targetId) { diff --git a/c3.min.js b/c3.min.js index dbe2e38..5dd04dd 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.33"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cPf&&(Pf=0),0>Rf&&(Rf=0),Qf=_g?Mf.left-Wi-Xi:Pf,Sf=_g?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Ri&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){ej.select("line."+f.xgridFocus).attr("x1",_g?0:-10).attr("x2",_g?Pf:-10).attr("y1",_g?-10:Mf.top).attr("y2",_g?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=_g?f.axisX:f.axisY,b=ej.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:_g?ah?v("x"):1:!sh||xh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Ri?P()+(Bh&&!_g?v("y2"):a):Bh?Gh||_g?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||ah?"x"===a&&ph?ph:"y"!==a||sh?"y2"!==a||Bh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Yi:Vg&&!Ri?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!_g)}function C(){return A(!_g)}function D(){return z(_g)}function E(){return A(_g)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(ph?ph:0)+80:Rf+8}function H(){return F(!_g)}function I(){return G(!_g)}function J(){return F(_g)}function K(){return G(_g)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(zi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Si=a}function N(a){Ti=a}function O(a){Ui=a}function P(){return Vg?Ri?Ti*(Si+1):Tf:0}function Q(){return Vg?Ri?Uf:Ui*(Si+1):0}function R(){var a,b,c=!ig;ag=_g?1:0,bg=_g?Rf:Pf,cg=_g?0:Rf,dg=_g?Pf:1,eg=ag,fg=bg,gg=_g?0:Sf,hg=_g?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,jj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=kh?kh:c?void 0:og.tickValues(),og=X(ig,Mi,a,b),rg=X(lg,Pi,a,b),pg=Y(jg,Ni,yh,Ah),qg=Y(kg,Oi,Hh,Jh),c||(Zi.scale(lg),Ef&&bj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(yi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),zi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(zi?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),zi?(e.tickCentered(eh),ve(gh)&&(gh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},zi&&e.categories(dh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=yi?Ji:zi?Tc:function(a){return 0>a?a.toFixed(0):a};return fh&&("function"==typeof fh?a=fh:yi&&(a=function(a){return a?Ii(fh)(a):""})),a}function _(a){var b;return"y"===a?b=wh:"y2"===a?b=Fh:"x"===a&&(b=rh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?wh=b:"y2"===a?Fh=b:"x"===a&&(rh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",_g?"inner-top":"inner-right")}function hb(){return fb("y",_g?"inner-right":"inner-top")}function ib(){return fb("y2",_g?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!_g,gb())}function rb(){return nb(_g,hb())}function sb(){return nb(_g,ib())}function tb(){return ob(!_g,gb())}function ub(){return ob(_g,hb())}function vb(){return ob(_g,ib())}function wb(){var a=gb();return _g?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":ph?ph-10:"3em"}function xb(){var a=hb();return _g?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return _g?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!_g,gb())}function Ab(){return pb(_g,hb())}function Bb(){return pb(_g,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){ej.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),ej.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),ej.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.length>0)for(g=Sc(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 wf.max(Object.keys(i).map(function(a){return wf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Dh:uh,n="y2"===c?Ch:th,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Eh:vh,r=ud()&&_g;return 0===l.length?"y2"===c?kg.domain():jg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(jg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&zh&&(f=b(zh.top)?zh.top:e,g=b(zh.bottom)?zh.bottom:e),"y2"===c&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return nh?yi?re(nh):nh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return mh?yi?re(mh):mh:wf.max(a,function(a){return wf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return zi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof oh&&we(oh)?(e=b(oh.left)?oh.left:d,f=b(oh.right)?oh.right:d):e=f="number"==typeof oh?oh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=yi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=yi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?jg:kg;return b="y"===a.axis||"y2"===a.axis?_g?Rf:"start"in a?d(a.start):Rf:_g?"end"in a?ig(yi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),xf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=yi?a?a instanceof Date?a:re(a):re(mc(c,d)):Ai&&!zi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ai&&zi&&0===c&&g&&(0===e&&(dh=[]),dh.push(g)),("undefined"==typeof a[b]||xf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&xf.data.targets[0].values[a-1]?xf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(xf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(yi?new Date(i):i);j.push(e)}return yi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Ki=Ki.concat(a)}function Mc(a){Ki=Ki.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Li=Li.concat(a)}function Oc(a){Li=Li.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&li&&(hj.html(oi(a,$(),wd(k),Hi)).style("display","block"),d=hj.property("offsetWidth"),e=hj.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(_g?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),hj.style("top",i+"px").style("left",g+"px"))}function Qd(){hj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});li&&(be(xf.data.targets)||ee(xf.data.targets)||ej.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(_g?"y1":"x1",Cd).attr(_g?"y2":"x2",Cd))}function Sd(){ej.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return Xh?Xh:b?2*a.tickOffset()*Yh/b:0}function $d(a,b){Dc(a).forEach(function(a){lj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&fi||je(a)&&_h}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=_g?1:0,e=_g?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Og(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud).attr("stroke",function(){return Hi(b)}).attr("r",1.4*Vh).transition().duration(100).attr("r",Vh)}function Be(a,b,c){Pg(b,a.node()),ej.select("."+f.selectedCircles+ld(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){Og(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Hi(b)).darker(1)})}function Ee(a,b){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return Hi(b)})}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?ej.selectAll("."+f.circles+ld(c)):ej).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Uh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Rh)}function Ke(a){return ej.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=_g?1:0,f=_g?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 _g?(c=he(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.getBoundingClientRect();return _g?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return _g&&(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(ij=wf.select(zf),ij.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ij.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),jj=ig.domain(),Zi.scale(lg),Ef&&bj.scale(ig),cj=ij.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),dj=cj.append("defs"),dj.append("clipPath").attr("id",si).append("rect").attr("width",Pf).attr("height",Rf),dj.append("clipPath").attr("id",ti).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.append("clipPath").attr("id",ui).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej=cj.append("g").attr("transform",Qi.main),fj=cj.append("g").attr("transform",Qi.context),gj=cj.append("g").attr("transform",Qi.legend),Sg||fj.style("visibility","hidden"),Vg||(gj.style("visibility","hidden"),Li=Cc(xf.data.targets)),hj=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),ah&&ej.append("g").attr("class",f.axisX).attr("clip-path",wi).attr("transform",Qi.x).append("text").attr("class",f.axisXLabel).attr("transform",_g?"rotate(-90)":"").style("text-anchor",zb),sh&&ej.append("g").attr("class",f.axisY).attr("clip-path",xi).attr("transform",Qi.y).append("text").attr("class",f.axisYLabel).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Ab),Bh&&ej.append("g").attr("class",f.axisY2).attr("transform",Qi.y2).append("text").attr("class",f.axisY2Label).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Bb),d=ej.append("g").attr("clip-path",vi).attr("class",f.grid),Kh&&d.append("g").attr("class",f.xgrids),we(Mh)&&d.append("g").attr("class",f.xgridLines),Sh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Nh&&d.append("g").attr("class",f.ygrids),we(Oh)&&d.append("g").attr("class",f.ygridLines),ej.append("g").attr("clip-path",vi).attr("class",f.regions),ej.append("g").attr("clip-path",vi).attr("class",f.chart),c=ej.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?_g?"ns-resize":"ew-resize":null),ej.select("."+f.chart).append("g").attr("class",f.chartBars),ej.select("."+f.chart).append("g").attr("class",f.chartLines),ej.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Qi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),ej.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&ej.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",_g?"ns-resize":"ew-resize").call(bj).on("dblclick.zoom",null),qh&&Zi.extent("function"!=typeof qh?qh:qh(_b())),fj.append("g").attr("clip-path",vi).attr("class",f.chart),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.append("g").attr("clip-path",vi).attr("class",f.brush).call(Zi).selectAll("rect").attr(_g?"width":"height",_g?Qf:Sf),fj.append("g").attr("class",f.axisX).attr("transform",Qi.subx).attr("clip-path",_g?"":wi),ef(xf.data.targets),_g?ej.select("."+f.axisX).style("opacity",0).call(og):(ej.select("."+f.axisY).style("opacity",0).call(pg),ej.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),pi){if(yi&&"string"==typeof qi){for(qi=re(qi),e=0;e0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(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){ee(xf.data.targets)||Hg&&(Bi=a,ej.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ci=!0,Qg())}function Ze(){ee(xf.data.targets)||Hg&&(ej.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),ej.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ci=!1,Rg())}function $e(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=ej.select("."+f.axisX).style("opacity",W?0:1),g=ej.select("."+f.axisY).style("opacity",W?0:1),h=ej.select("."+f.axisY2).style("opacity",W?0:1),e=fj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Vg&&rf(Cc(xf.data.targets),a,O),zi&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),jj=ig.domain(),Ef&&bj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),Zi.scale(lg)),G&&(ig.domain(Zi.empty()?jj:Zi.extent()),Ef&&bj.scale(ig).updateScaleExtent()),kh||!jh&&!ih||(S=Kc(Jc(X),ih),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(gh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!_g&&lh&&eb(c,O.axisX,lh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),hj.style("display","none"),o(),ej.select("line."+f.xgridFocus).style("visibility","hidden"),Kh){if("year"===Lh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=ej.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",_g?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",_g?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",_g?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",_g?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(_g?"y1":"x1")===(_g?Rf:0)?0:1}),i.exit().remove()}we(Mh)&&(k=ej.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Mh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",_g?"":"rotate(-90)").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",_g?0:Dd).attr("x2",_g?Pf:Dd).attr("y1",_g?Dd:Mf.top).attr("y2",_g?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",_g?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Nh&&(m=ej.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Ph)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",_g?jg:0).attr("x2",_g?jg:Pf).attr("y1",_g?0:jg).attr("y2",_g?Rf:jg),m.exit().remove()),A&&we(Oh)&&(n=ej.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Oh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",_g?"rotate(-90)":"").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",_g?Ed:0).attr("x2",_g?Ed:Pf).attr("y1",_g?0:Ed).attr("y2",_g?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",_g?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=ej.select("."+f.regions).selectAll("rect."+f.region).data(ki),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=ej.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Hi(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=ej.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return _g?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),ej.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",$i).style("opacity",1),ej.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",_i).style("opacity",kj),q=ej.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Rh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),q.exit().remove(),ej.each(function(){Fi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Fi=!1}),ej.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),ej.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Sg&&(null!==wf.event&&"zoom"===wf.event.type&&Zi.extent(ig.orgDomain()).update(),B&&(!_g&&lh&&eb(e,O.axisSubX,lh),Zi.empty()||Zi.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Hi(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1))),ej.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),ej.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),v=ej.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ai&&!zi?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),ej.select("."+f.eventRects).datum(x?x.values:[]),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",_g?0:y).attr("y",_g?y:0).attr("width",_g?Pf:z).attr("height",_g?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){lj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&bj.altDomain?(ig.domain(bj.altDomain),void bj.scale(ig).updateScaleExtent()):(zi&&ig.orgDomain()[0]===jj[0]&&ig.domain([jj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Di=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){cj.attr("width",Tf).attr("height",Uf),cj.select("#"+si).select("rect").attr("width",Pf).attr("height",Rf),cj.select("#"+ti).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),cj.select("#"+ui).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),cj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),ij.style("max-height",Uf+"px")}function df(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=ej.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Hi(a)}),e=ej.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Jg(a)?"pointer":null}),c=ej.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)}),b.append("path").attr("class",dd).style("opacity",function(){return kj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Hi(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Hi(a)}).style("cursor",function(a){return Jg(a)?"pointer":null}),a.forEach(function(a){ej.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=ej.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Hi(a.data)}).style("cursor",function(a){return Jg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Sg&&(n=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Hi(a)}),l=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)})),cj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(750).style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Ri?j:i,l=Ri?Q():P();return d&&(x=0,D=0,u=0,v=0),Vg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Ri?v:u,void($g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Ri?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=gj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Xg?Xg(a):xf.toggle(a)}).on("mouseover",function(a){Fi||xf.focus(a),"function"==typeof Yg&&Yg(a)}).on("mouseout",function(a){Fi||xf.revert(),"function"==typeof Zg&&Zg(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ri?h:-200).attr("y",Ri?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ri?i:-200).attr("y",Ri?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Hi(a)}).attr("x",Ri?h:-200).attr("y",Ri?-200:j).attr("width",10).attr("height",10),gj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),gj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),gj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Fi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"]),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","selection","enabled"],!1),Ig=h(["data","selection","grouped"],!1),Jg=h(["data","selection","isselectable"],function(){return!0}),Kg=h(["data","selection","multiple"],!0),Lg=h(["data","onclick"],function(){}),Mg=h(["data","onenter"],function(){}),Ng=h(["data","onleave"],function(){}),Og=h(["data","onselected"],function(){}),Pg=h(["data","onunselected"],function(){}),Qg=h(["data","ondragstart"],function(){}),Rg=h(["data","ondragend"],function(){}),Sg=h(["subchart","show"],!1),Tg=h(["subchart","size","height"],60),Ug=h(["color","pattern"],[]),Vg=h(["legend","show"],!0),Wg=h(["legend","position"],"bottom"),Xg=h(["legend","item","onclick"]),Yg=h(["legend","item","onmouseover"]),Zg=h(["legend","item","onmouseout"]),$g=h(["legend","equally"],!1),_g=h(["axis","rotated"],!1),ah=h(["axis","x","show"],!0),bh=h(["axis","x","type"],"indexed"),ch=h(["axis","x","localtime"],!0),dh=h(["axis","x","categories"],[]),eh=h(["axis","x","tick","centered"],!1),fh=h(["axis","x","tick","format"]),gh=h(["axis","x","tick","culling"],{}),hh=h(["axis","x","tick","culling","max"],10),ih=h(["axis","x","tick","count"]),jh=h(["axis","x","tick","fit"],!0),kh=h(["axis","x","tick","values"],null),lh=h(["axis","x","tick","rotate"]),mh=h(["axis","x","max"],null),nh=h(["axis","x","min"],null),oh=h(["axis","x","padding"],{}),ph=h(["axis","x","height"]),qh=h(["axis","x","default"]),rh=h(["axis","x","label"],{}),sh=h(["axis","y","show"],!0),th=h(["axis","y","max"]),uh=h(["axis","y","min"]),vh=h(["axis","y","center"]),wh=h(["axis","y","label"],{}),xh=h(["axis","y","inner"],!1),yh=h(["axis","y","tick","format"]),zh=h(["axis","y","padding"],{}),Ah=h(["axis","y","ticks"],10),Bh=h(["axis","y2","show"],!1),Ch=h(["axis","y2","max"]),Dh=h(["axis","y2","min"]),Eh=h(["axis","y2","center"]),Fh=h(["axis","y2","label"],{}),Gh=h(["axis","y2","inner"],!1),Hh=h(["axis","y2","tick","format"]),Ih=h(["axis","y2","padding"],{}),Jh=h(["axis","y2","ticks"],10),Kh=h(["grid","x","show"],!1),Lh=h(["grid","x","type"],"tick"),Mh=h(["grid","x","lines"],[]),Nh=h(["grid","y","show"],!1),Oh=h(["grid","y","lines"],[]),Ph=h(["grid","y","ticks"],10),Qh=h(["point","show"],!0),Rh=Qh?h(["point","r"],2.5):0,Sh=h(["point","focus","line","enabled"],!0),Th=h(["point","focus","expand","enabled"],!0),Uh=h(["point","focus","expand","r"],Th?4:Rh),Vh=h(["point","focus","select","r"],8),Wh=h(["line","connect_null"],!1),Xh=h(["bar","width"]),Yh=h(["bar","width","ratio"],.6),Zh=h(["pie","label","show"],!0),$h=h(["pie","label","format"]),_h=h(["pie","expand"],!0),ai=h(["pie","onclick"],function(){}),bi=h(["pie","onmouseover"],function(){}),ci=h(["pie","onmouseout"],function(){}),di=h(["donut","label","show"],!0),ei=h(["donut","label","format"]),fi=h(["donut","expand"],!0),gi=h(["donut","title"],""),hi=h(["donut","onclick"],function(){}),ii=h(["donut","onmouseover"],function(){}),ji=h(["donut","onmouseout"],function(){}),ki=h(["regions"],[]),li=h(["tooltip","show"],!0),mi=h(["tooltip","format","title"]),ni=h(["tooltip","format","value"]),oi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=mi?mi:b,l=ni?ni:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),pi=h(["tooltip","init","show"],!1),qi=h(["tooltip","init","x"],0),ri=h(["tooltip","init","position"],{top:"0px",left:"50px"}),si=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ti=si+"-xaxis",ui=si+"-yaxis",vi=i(si),wi=i(ti),xi=i(ui),yi="timeseries"===bh,zi="categorized"===bh,Ai=!yi&&(sg||we(tg)),Bi=null,Ci=!1,Di=!1,Ei=!1,Fi=!1,Gi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Hi=qe(Gg,we(Ug)?Ug:Gi,Fg),Ii=ch?wf.time.format:wf.time.format.utc,Ji=function(){var a=[[Ii("%Y/%-m/%-d"),function(){return!0}],[Ii("%-m/%-d"),function(a){return a.getMonth()}],[Ii("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ii("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ii("%I %p"),function(a){return a.getHours()}],[Ii("%I:%M"),function(a){return a.getMinutes()}],[Ii(":%S"),function(a){return a.getSeconds()}],[Ii(".%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)}}(),Ki=[],Li=[],Mi=_g?"left":"bottom",Ni=_g?xh?"top":"bottom":xh?"right":"left",Oi=_g?Gh?"bottom":"top":Gh?"left":"right",Pi=_g?"left":"bottom",Qi={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(_g?0:Rf)+")"},y:function(){return"translate(0,"+(_g?Rf:0)+")"},y2:function(){return"translate("+(_g?0:Pf)+","+(_g?1:0)+")"},subx:function(){return"translate(0,"+(_g?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Ri="right"===Wg,Si=0,Ti=0,Ui=0,Vi=.15,Wi=30,Xi=_g&&!ah?0:30,Yi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Zi,$i=function(){var a=wf.svg.line().x(_g?function(a){return V(a.id)(a.value)}:Cd).y(_g?Cd:function(a){return V(a.id)(a.value)});return Wh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Wh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),_i=function(){var a;return a=_g?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a=wf.svg.line().x(_g?function(a){return W(a.id)(a.value)}:Fd).y(_g?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),bj=function(){};Zi=wf.svg.brush().on("brush",_e),Zi.update=function(){return fj&&fj.select("."+f.brush).call(this),this},Zi.scale=function(a){return _g?this.y(a):this.x(a)},Ef&&(bj=wf.behavior.zoom().on("zoomstart",function(){bj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),bj.scale=function(a){return _g?this.y(a):this.x(a)},bj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},bj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(jj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var cj,dj,ej,fj,gj,hj,ij,jj,kj,lj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),cj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?pf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),cj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?qf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Vi),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){Zi.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&zi&&(dh=a.categories,og.categories(dh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(ej.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Ig||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Jg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Ig||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Jg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0})},xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Mh=a,$e(),Mh):Mh +!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.33"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cPf&&(Pf=0),0>Rf&&(Rf=0),Qf=_g?Mf.left-Wi-Xi:Pf,Sf=_g?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Ri&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){ej.select("line."+f.xgridFocus).attr("x1",_g?0:-10).attr("x2",_g?Pf:-10).attr("y1",_g?-10:Mf.top).attr("y2",_g?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=_g?f.axisX:f.axisY,b=ej.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:_g?ah?v("x"):1:!sh||xh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Ri?P()+(Bh&&!_g?v("y2"):a):Bh?Gh||_g?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||ah?"x"===a&&ph?ph:"y"!==a||sh?"y2"!==a||Bh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Yi:Vg&&!Ri?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!_g)}function C(){return A(!_g)}function D(){return z(_g)}function E(){return A(_g)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(ph?ph:0)+80:Rf+8}function H(){return F(!_g)}function I(){return G(!_g)}function J(){return F(_g)}function K(){return G(_g)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(zi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Si=a}function N(a){Ti=a}function O(a){Ui=a}function P(){return Vg?Ri?Ti*(Si+1):Tf:0}function Q(){return Vg?Ri?Uf:Ui*(Si+1):0}function R(){var a,b,c=!ig;ag=_g?1:0,bg=_g?Rf:Pf,cg=_g?0:Rf,dg=_g?Pf:1,eg=ag,fg=bg,gg=_g?0:Sf,hg=_g?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,jj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=kh?kh:c?void 0:og.tickValues(),og=X(ig,Mi,a,b),rg=X(lg,Pi,a,b),pg=Y(jg,Ni,yh,Ah),qg=Y(kg,Oi,Hh,Jh),c||(Zi.scale(lg),Ef&&bj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(yi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),zi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(zi?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),zi?(e.tickCentered(eh),ve(gh)&&(gh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},zi&&e.categories(dh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=yi?Ji:zi?Tc:function(a){return 0>a?a.toFixed(0):a};return fh&&("function"==typeof fh?a=fh:yi&&(a=function(a){return a?Ii(fh)(a):""})),a}function _(a){var b;return"y"===a?b=wh:"y2"===a?b=Fh:"x"===a&&(b=rh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?wh=b:"y2"===a?Fh=b:"x"===a&&(rh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",_g?"inner-top":"inner-right")}function hb(){return fb("y",_g?"inner-right":"inner-top")}function ib(){return fb("y2",_g?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!_g,gb())}function rb(){return nb(_g,hb())}function sb(){return nb(_g,ib())}function tb(){return ob(!_g,gb())}function ub(){return ob(_g,hb())}function vb(){return ob(_g,ib())}function wb(){var a=gb();return _g?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":ph?ph-10:"3em"}function xb(){var a=hb();return _g?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return _g?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!_g,gb())}function Ab(){return pb(_g,hb())}function Bb(){return pb(_g,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){ej.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),ej.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),ej.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.length>0)for(g=Sc(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 wf.max(Object.keys(i).map(function(a){return wf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Dh:uh,n="y2"===c?Ch:th,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Eh:vh,r=ud()&&_g;return 0===l.length?"y2"===c?kg.domain():jg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(jg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&zh&&(f=b(zh.top)?zh.top:e,g=b(zh.bottom)?zh.bottom:e),"y2"===c&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return nh?yi?re(nh):nh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return mh?yi?re(mh):mh:wf.max(a,function(a){return wf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return zi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof oh&&we(oh)?(e=b(oh.left)?oh.left:d,f=b(oh.right)?oh.right:d):e=f="number"==typeof oh?oh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=yi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=yi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?jg:kg;return b="y"===a.axis||"y2"===a.axis?_g?Rf:"start"in a?d(a.start):Rf:_g?"end"in a?ig(yi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),xf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=yi?a?a instanceof Date?a:re(a):re(mc(c,d)):Ai&&!zi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ai&&zi&&0===c&&g&&(0===e&&(dh=[]),dh.push(g)),("undefined"==typeof a[b]||xf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&xf.data.targets[0].values[a-1]?xf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(xf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(yi?new Date(i):i);j.push(e)}return yi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Ki=Ki.concat(a)}function Mc(a){Ki=Ki.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Li=Li.concat(a)}function Oc(a){Li=Li.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&li&&(hj.html(oi(a,$(),wd(k),Hi)).style("display","block"),d=hj.property("offsetWidth"),e=hj.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(_g?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),hj.style("top",i+"px").style("left",g+"px"))}function Qd(){hj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});li&&(be(xf.data.targets)||ee(xf.data.targets)||ej.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(_g?"y1":"x1",Cd).attr(_g?"y2":"x2",Cd))}function Sd(){ej.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return Xh?Xh:b?2*a.tickOffset()*Yh/b:0}function $d(a,b){Dc(a).forEach(function(a){lj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&fi||je(a)&&_h}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=_g?1:0,e=_g?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Og(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud).attr("stroke",function(){return Hi(b)}).attr("r",1.4*Vh).transition().duration(100).attr("r",Vh)}function Be(a,b,c){Pg(b,a.node()),ej.select("."+f.selectedCircles+ld(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){Og(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Hi(b)).darker(1)})}function Ee(a,b){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return Hi(b)})}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?ej.selectAll("."+f.circles+ld(c)):ej).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Uh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Rh)}function Ke(a){return ej.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=_g?1:0,f=_g?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 _g?(c=he(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.getBoundingClientRect();return _g?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return _g&&(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(ij=wf.select(zf),ij.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ij.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),jj=ig.domain(),Zi.scale(lg),Ef&&bj.scale(ig),cj=ij.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),dj=cj.append("defs"),dj.append("clipPath").attr("id",si).append("rect").attr("width",Pf).attr("height",Rf),dj.append("clipPath").attr("id",ti).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.append("clipPath").attr("id",ui).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej=cj.append("g").attr("transform",Qi.main),fj=cj.append("g").attr("transform",Qi.context),gj=cj.append("g").attr("transform",Qi.legend),Sg||fj.style("visibility","hidden"),Vg||(gj.style("visibility","hidden"),Li=Cc(xf.data.targets)),hj=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),ah&&ej.append("g").attr("class",f.axisX).attr("clip-path",wi).attr("transform",Qi.x).append("text").attr("class",f.axisXLabel).attr("transform",_g?"rotate(-90)":"").style("text-anchor",zb),sh&&ej.append("g").attr("class",f.axisY).attr("clip-path",xi).attr("transform",Qi.y).append("text").attr("class",f.axisYLabel).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Ab),Bh&&ej.append("g").attr("class",f.axisY2).attr("transform",Qi.y2).append("text").attr("class",f.axisY2Label).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Bb),d=ej.append("g").attr("clip-path",vi).attr("class",f.grid),Kh&&d.append("g").attr("class",f.xgrids),we(Mh)&&d.append("g").attr("class",f.xgridLines),Sh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Nh&&d.append("g").attr("class",f.ygrids),we(Oh)&&d.append("g").attr("class",f.ygridLines),ej.append("g").attr("clip-path",vi).attr("class",f.regions),ej.append("g").attr("clip-path",vi).attr("class",f.chart),c=ej.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?_g?"ns-resize":"ew-resize":null),ej.select("."+f.chart).append("g").attr("class",f.chartBars),ej.select("."+f.chart).append("g").attr("class",f.chartLines),ej.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Qi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),ej.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&ej.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",_g?"ns-resize":"ew-resize").call(bj).on("dblclick.zoom",null),qh&&Zi.extent("function"!=typeof qh?qh:qh(_b())),fj.append("g").attr("clip-path",vi).attr("class",f.chart),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.append("g").attr("clip-path",vi).attr("class",f.brush).call(Zi).selectAll("rect").attr(_g?"width":"height",_g?Qf:Sf),fj.append("g").attr("class",f.axisX).attr("transform",Qi.subx).attr("clip-path",_g?"":wi),ef(xf.data.targets),_g?ej.select("."+f.axisX).style("opacity",0).call(og):(ej.select("."+f.axisY).style("opacity",0).call(pg),ej.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),pi){if(yi&&"string"==typeof qi){for(qi=re(qi),e=0;e0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(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){ee(xf.data.targets)||Hg&&(Bi=a,ej.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ci=!0,Qg())}function Ze(){ee(xf.data.targets)||Hg&&(ej.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),ej.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ci=!1,Rg())}function $e(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=ej.select("."+f.axisX).style("opacity",W?0:1),g=ej.select("."+f.axisY).style("opacity",W?0:1),h=ej.select("."+f.axisY2).style("opacity",W?0:1),e=fj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Vg&&rf(Cc(xf.data.targets),a,O),zi&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),jj=ig.domain(),Ef&&bj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),Zi.scale(lg)),G&&(ig.domain(Zi.empty()?jj:Zi.extent()),Ef&&bj.scale(ig).updateScaleExtent()),kh||!jh&&!ih||(S=Kc(Jc(X),ih),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(gh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!_g&&lh&&eb(c,O.axisX,lh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),hj.style("display","none"),o(),ej.select("line."+f.xgridFocus).style("visibility","hidden"),Kh){if("year"===Lh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=ej.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",_g?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",_g?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",_g?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",_g?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(_g?"y1":"x1")===(_g?Rf:0)?0:1}),i.exit().remove()}we(Mh)&&(k=ej.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Mh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",_g?"":"rotate(-90)").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",_g?0:Dd).attr("x2",_g?Pf:Dd).attr("y1",_g?Dd:Mf.top).attr("y2",_g?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",_g?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Nh&&(m=ej.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Ph)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",_g?jg:0).attr("x2",_g?jg:Pf).attr("y1",_g?0:jg).attr("y2",_g?Rf:jg),m.exit().remove()),A&&we(Oh)&&(n=ej.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Oh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",_g?"rotate(-90)":"").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",_g?Ed:0).attr("x2",_g?Ed:Pf).attr("y1",_g?0:Ed).attr("y2",_g?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",_g?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=ej.select("."+f.regions).selectAll("rect."+f.region).data(ki),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=ej.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Hi(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=ej.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return _g?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),ej.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",$i).style("opacity",1),ej.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",_i).style("opacity",kj),q=ej.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Rh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),q.exit().remove(),ej.each(function(){Fi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Fi=!1}),ej.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),ej.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Sg&&(null!==wf.event&&"zoom"===wf.event.type&&Zi.extent(ig.orgDomain()).update(),B&&(!_g&&lh&&eb(e,O.axisSubX,lh),Zi.empty()||Zi.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Hi(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1))),ej.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),ej.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),v=ej.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ai&&!zi?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),ej.select("."+f.eventRects).datum(x?x.values:[]),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",_g?0:y).attr("y",_g?y:0).attr("width",_g?Pf:z).attr("height",_g?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){lj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&bj.altDomain?(ig.domain(bj.altDomain),void bj.scale(ig).updateScaleExtent()):(zi&&ig.orgDomain()[0]===jj[0]&&ig.domain([jj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Di=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){cj.attr("width",Tf).attr("height",Uf),cj.select("#"+si).select("rect").attr("width",Pf).attr("height",Rf),cj.select("#"+ti).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),cj.select("#"+ui).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),cj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),ij.style("max-height",Uf+"px")}function df(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=ej.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Hi(a)}),e=ej.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Jg(a)?"pointer":null}),c=ej.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)}),b.append("path").attr("class",dd).style("opacity",function(){return kj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Hi(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Hi(a)}).style("cursor",function(a){return Jg(a)?"pointer":null}),a.forEach(function(a){ej.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=ej.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Hi(a.data)}).style("cursor",function(a){return Jg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Sg&&(n=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Hi(a)}),l=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)})),cj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(750).style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Ri?j:i,l=Ri?Q():P();return d&&(x=0,D=0,u=0,v=0),Vg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Ri?v:u,void($g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Ri?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=gj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Xg?Xg(a):xf.toggle(a)}).on("mouseover",function(a){Fi||xf.focus(a),"function"==typeof Yg&&Yg(a)}).on("mouseout",function(a){Fi||xf.revert(),"function"==typeof Zg&&Zg(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ri?h:-200).attr("y",Ri?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ri?i:-200).attr("y",Ri?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Hi(a)}).attr("x",Ri?h:-200).attr("y",Ri?-200:j).attr("width",10).attr("height",10),gj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),gj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),gj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),gj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){return Gc(a)?1:Vi}),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Fi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"]),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","selection","enabled"],!1),Ig=h(["data","selection","grouped"],!1),Jg=h(["data","selection","isselectable"],function(){return!0}),Kg=h(["data","selection","multiple"],!0),Lg=h(["data","onclick"],function(){}),Mg=h(["data","onenter"],function(){}),Ng=h(["data","onleave"],function(){}),Og=h(["data","onselected"],function(){}),Pg=h(["data","onunselected"],function(){}),Qg=h(["data","ondragstart"],function(){}),Rg=h(["data","ondragend"],function(){}),Sg=h(["subchart","show"],!1),Tg=h(["subchart","size","height"],60),Ug=h(["color","pattern"],[]),Vg=h(["legend","show"],!0),Wg=h(["legend","position"],"bottom"),Xg=h(["legend","item","onclick"]),Yg=h(["legend","item","onmouseover"]),Zg=h(["legend","item","onmouseout"]),$g=h(["legend","equally"],!1),_g=h(["axis","rotated"],!1),ah=h(["axis","x","show"],!0),bh=h(["axis","x","type"],"indexed"),ch=h(["axis","x","localtime"],!0),dh=h(["axis","x","categories"],[]),eh=h(["axis","x","tick","centered"],!1),fh=h(["axis","x","tick","format"]),gh=h(["axis","x","tick","culling"],{}),hh=h(["axis","x","tick","culling","max"],10),ih=h(["axis","x","tick","count"]),jh=h(["axis","x","tick","fit"],!0),kh=h(["axis","x","tick","values"],null),lh=h(["axis","x","tick","rotate"]),mh=h(["axis","x","max"],null),nh=h(["axis","x","min"],null),oh=h(["axis","x","padding"],{}),ph=h(["axis","x","height"]),qh=h(["axis","x","default"]),rh=h(["axis","x","label"],{}),sh=h(["axis","y","show"],!0),th=h(["axis","y","max"]),uh=h(["axis","y","min"]),vh=h(["axis","y","center"]),wh=h(["axis","y","label"],{}),xh=h(["axis","y","inner"],!1),yh=h(["axis","y","tick","format"]),zh=h(["axis","y","padding"],{}),Ah=h(["axis","y","ticks"],10),Bh=h(["axis","y2","show"],!1),Ch=h(["axis","y2","max"]),Dh=h(["axis","y2","min"]),Eh=h(["axis","y2","center"]),Fh=h(["axis","y2","label"],{}),Gh=h(["axis","y2","inner"],!1),Hh=h(["axis","y2","tick","format"]),Ih=h(["axis","y2","padding"],{}),Jh=h(["axis","y2","ticks"],10),Kh=h(["grid","x","show"],!1),Lh=h(["grid","x","type"],"tick"),Mh=h(["grid","x","lines"],[]),Nh=h(["grid","y","show"],!1),Oh=h(["grid","y","lines"],[]),Ph=h(["grid","y","ticks"],10),Qh=h(["point","show"],!0),Rh=Qh?h(["point","r"],2.5):0,Sh=h(["point","focus","line","enabled"],!0),Th=h(["point","focus","expand","enabled"],!0),Uh=h(["point","focus","expand","r"],Th?4:Rh),Vh=h(["point","focus","select","r"],8),Wh=h(["line","connect_null"],!1),Xh=h(["bar","width"]),Yh=h(["bar","width","ratio"],.6),Zh=h(["pie","label","show"],!0),$h=h(["pie","label","format"]),_h=h(["pie","expand"],!0),ai=h(["pie","onclick"],function(){}),bi=h(["pie","onmouseover"],function(){}),ci=h(["pie","onmouseout"],function(){}),di=h(["donut","label","show"],!0),ei=h(["donut","label","format"]),fi=h(["donut","expand"],!0),gi=h(["donut","title"],""),hi=h(["donut","onclick"],function(){}),ii=h(["donut","onmouseover"],function(){}),ji=h(["donut","onmouseout"],function(){}),ki=h(["regions"],[]),li=h(["tooltip","show"],!0),mi=h(["tooltip","format","title"]),ni=h(["tooltip","format","value"]),oi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=mi?mi:b,l=ni?ni:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),pi=h(["tooltip","init","show"],!1),qi=h(["tooltip","init","x"],0),ri=h(["tooltip","init","position"],{top:"0px",left:"50px"}),si=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ti=si+"-xaxis",ui=si+"-yaxis",vi=i(si),wi=i(ti),xi=i(ui),yi="timeseries"===bh,zi="categorized"===bh,Ai=!yi&&(sg||we(tg)),Bi=null,Ci=!1,Di=!1,Ei=!1,Fi=!1,Gi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Hi=qe(Gg,we(Ug)?Ug:Gi,Fg),Ii=ch?wf.time.format:wf.time.format.utc,Ji=function(){var a=[[Ii("%Y/%-m/%-d"),function(){return!0}],[Ii("%-m/%-d"),function(a){return a.getMonth()}],[Ii("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ii("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ii("%I %p"),function(a){return a.getHours()}],[Ii("%I:%M"),function(a){return a.getMinutes()}],[Ii(":%S"),function(a){return a.getSeconds()}],[Ii(".%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)}}(),Ki=[],Li=[],Mi=_g?"left":"bottom",Ni=_g?xh?"top":"bottom":xh?"right":"left",Oi=_g?Gh?"bottom":"top":Gh?"left":"right",Pi=_g?"left":"bottom",Qi={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(_g?0:Rf)+")"},y:function(){return"translate(0,"+(_g?Rf:0)+")"},y2:function(){return"translate("+(_g?0:Pf)+","+(_g?1:0)+")"},subx:function(){return"translate(0,"+(_g?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Ri="right"===Wg,Si=0,Ti=0,Ui=0,Vi=.15,Wi=30,Xi=_g&&!ah?0:30,Yi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Zi,$i=function(){var a=wf.svg.line().x(_g?function(a){return V(a.id)(a.value)}:Cd).y(_g?Cd:function(a){return V(a.id)(a.value)});return Wh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Wh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),_i=function(){var a;return a=_g?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a=wf.svg.line().x(_g?function(a){return W(a.id)(a.value)}:Fd).y(_g?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),bj=function(){};Zi=wf.svg.brush().on("brush",_e),Zi.update=function(){return fj&&fj.select("."+f.brush).call(this),this},Zi.scale=function(a){return _g?this.y(a):this.x(a)},Ef&&(bj=wf.behavior.zoom().on("zoomstart",function(){bj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),bj.scale=function(a){return _g?this.y(a):this.x(a)},bj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},bj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(jj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var cj,dj,ej,fj,gj,hj,ij,jj,kj,lj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),cj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&pf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),xf.revert()},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),cj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&qf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),xf.revert()},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){Zi.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&zi&&(dh=a.categories,og.categories(dh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(ej.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Ig||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Jg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Ig||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Jg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0})},xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Mh=a,$e(),Mh):Mh },xf.xgrids.add=function(a){return a?xf.xgrids(Mh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a);return xf.xgrids(Mh.filter(b))},xf.ygrids=function(a){return a?(Oh=a,$e(),Oh):Oh},xf.ygrids.add=function(a){return a?xf.ygrids(Oh.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Oh.filter(b))},xf.regions=function(a){return c(a)?ki:(ki=a,$e(),ki)},xf.regions.add=function(a){return c(a)?ki:(ki=ki.concat(a),$e(),ki)},xf.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;cj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ki=ki.filter(function(b){return b.classes.indexOf(a)<0})}),ki},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(th=+a.y),b(a.y2)&&(Ch=+a.y2)):th=Ch=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){Vg||(Vg=!0,gj.style("visibility","visible")),pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0}),Vg&&ve(a)&&(Vg=!1,gj.style("visibility","hidden"))},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},ij.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 36c3553ca3fa77809e64edcdeb73b236bff9c557 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 30 Apr 2014 14:26:38 +0900 Subject: [PATCH 090/178] Fix withLegend on show/hide --- c3.js | 16 ++++++++-------- c3.min.js | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/c3.js b/c3.js index 1947e84..10f0a38 100644 --- a/c3.js +++ b/c3.js @@ -3926,6 +3926,10 @@ .style('opacity', opacityForLegend); } function showLegend(targetIds) { + if (!__legend_show) { + __legend_show = true; + legend.style('visibility', 'visible'); + } removeHiddenLegendIds(targetIds); legend.selectAll(selectorLegends(targetIds)) .style('visibility', 'visible') @@ -3933,6 +3937,10 @@ .style('opacity', opacityForLegend); } function hideLegend(targetIds) { + if (__legend_show && isEmpty(targetIds)) { + __legend_show = false; + legend.style('visibility', 'hidden'); + } addHiddenLegendIds(targetIds); legend.selectAll(selectorLegends(targetIds)) .style('opacity', 0) @@ -4475,20 +4483,12 @@ }; c3.legend.show = function (targetIds) { - if (!__legend_show) { - __legend_show = true; - legend.style('visibility', 'visible'); - } showLegend(mapToTargetIds(targetIds)); redraw({withLegend: true}); }; c3.legend.hide = function (targetIds) { hideLegend(mapToTargetIds(targetIds)); redraw({withLegend: true}); - if (__legend_show && isEmpty(targetIds)) { - __legend_show = false; - legend.style('visibility', 'hidden'); - } }; c3.resize = function (size) { diff --git a/c3.min.js b/c3.min.js index 5dd04dd..b97e9ab 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ !function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.33"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cPf&&(Pf=0),0>Rf&&(Rf=0),Qf=_g?Mf.left-Wi-Xi:Pf,Sf=_g?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Ri&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){ej.select("line."+f.xgridFocus).attr("x1",_g?0:-10).attr("x2",_g?Pf:-10).attr("y1",_g?-10:Mf.top).attr("y2",_g?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=_g?f.axisX:f.axisY,b=ej.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:_g?ah?v("x"):1:!sh||xh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Ri?P()+(Bh&&!_g?v("y2"):a):Bh?Gh||_g?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||ah?"x"===a&&ph?ph:"y"!==a||sh?"y2"!==a||Bh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Yi:Vg&&!Ri?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!_g)}function C(){return A(!_g)}function D(){return z(_g)}function E(){return A(_g)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(ph?ph:0)+80:Rf+8}function H(){return F(!_g)}function I(){return G(!_g)}function J(){return F(_g)}function K(){return G(_g)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(zi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Si=a}function N(a){Ti=a}function O(a){Ui=a}function P(){return Vg?Ri?Ti*(Si+1):Tf:0}function Q(){return Vg?Ri?Uf:Ui*(Si+1):0}function R(){var a,b,c=!ig;ag=_g?1:0,bg=_g?Rf:Pf,cg=_g?0:Rf,dg=_g?Pf:1,eg=ag,fg=bg,gg=_g?0:Sf,hg=_g?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,jj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=kh?kh:c?void 0:og.tickValues(),og=X(ig,Mi,a,b),rg=X(lg,Pi,a,b),pg=Y(jg,Ni,yh,Ah),qg=Y(kg,Oi,Hh,Jh),c||(Zi.scale(lg),Ef&&bj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(yi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),zi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(zi?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),zi?(e.tickCentered(eh),ve(gh)&&(gh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},zi&&e.categories(dh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=yi?Ji:zi?Tc:function(a){return 0>a?a.toFixed(0):a};return fh&&("function"==typeof fh?a=fh:yi&&(a=function(a){return a?Ii(fh)(a):""})),a}function _(a){var b;return"y"===a?b=wh:"y2"===a?b=Fh:"x"===a&&(b=rh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?wh=b:"y2"===a?Fh=b:"x"===a&&(rh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",_g?"inner-top":"inner-right")}function hb(){return fb("y",_g?"inner-right":"inner-top")}function ib(){return fb("y2",_g?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!_g,gb())}function rb(){return nb(_g,hb())}function sb(){return nb(_g,ib())}function tb(){return ob(!_g,gb())}function ub(){return ob(_g,hb())}function vb(){return ob(_g,ib())}function wb(){var a=gb();return _g?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":ph?ph-10:"3em"}function xb(){var a=hb();return _g?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return _g?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!_g,gb())}function Ab(){return pb(_g,hb())}function Bb(){return pb(_g,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){ej.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),ej.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),ej.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.length>0)for(g=Sc(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 wf.max(Object.keys(i).map(function(a){return wf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Dh:uh,n="y2"===c?Ch:th,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Eh:vh,r=ud()&&_g;return 0===l.length?"y2"===c?kg.domain():jg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(jg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&zh&&(f=b(zh.top)?zh.top:e,g=b(zh.bottom)?zh.bottom:e),"y2"===c&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return nh?yi?re(nh):nh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return mh?yi?re(mh):mh:wf.max(a,function(a){return wf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return zi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof oh&&we(oh)?(e=b(oh.left)?oh.left:d,f=b(oh.right)?oh.right:d):e=f="number"==typeof oh?oh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=yi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=yi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?jg:kg;return b="y"===a.axis||"y2"===a.axis?_g?Rf:"start"in a?d(a.start):Rf:_g?"end"in a?ig(yi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),xf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=yi?a?a instanceof Date?a:re(a):re(mc(c,d)):Ai&&!zi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ai&&zi&&0===c&&g&&(0===e&&(dh=[]),dh.push(g)),("undefined"==typeof a[b]||xf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&xf.data.targets[0].values[a-1]?xf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(xf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(yi?new Date(i):i);j.push(e)}return yi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Ki=Ki.concat(a)}function Mc(a){Ki=Ki.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Li=Li.concat(a)}function Oc(a){Li=Li.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&li&&(hj.html(oi(a,$(),wd(k),Hi)).style("display","block"),d=hj.property("offsetWidth"),e=hj.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(_g?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),hj.style("top",i+"px").style("left",g+"px"))}function Qd(){hj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});li&&(be(xf.data.targets)||ee(xf.data.targets)||ej.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(_g?"y1":"x1",Cd).attr(_g?"y2":"x2",Cd))}function Sd(){ej.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return Xh?Xh:b?2*a.tickOffset()*Yh/b:0}function $d(a,b){Dc(a).forEach(function(a){lj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&fi||je(a)&&_h}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=_g?1:0,e=_g?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Og(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud).attr("stroke",function(){return Hi(b)}).attr("r",1.4*Vh).transition().duration(100).attr("r",Vh)}function Be(a,b,c){Pg(b,a.node()),ej.select("."+f.selectedCircles+ld(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){Og(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Hi(b)).darker(1)})}function Ee(a,b){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return Hi(b)})}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?ej.selectAll("."+f.circles+ld(c)):ej).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Uh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Rh)}function Ke(a){return ej.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=_g?1:0,f=_g?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 _g?(c=he(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.getBoundingClientRect();return _g?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return _g&&(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(ij=wf.select(zf),ij.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ij.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),jj=ig.domain(),Zi.scale(lg),Ef&&bj.scale(ig),cj=ij.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),dj=cj.append("defs"),dj.append("clipPath").attr("id",si).append("rect").attr("width",Pf).attr("height",Rf),dj.append("clipPath").attr("id",ti).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.append("clipPath").attr("id",ui).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej=cj.append("g").attr("transform",Qi.main),fj=cj.append("g").attr("transform",Qi.context),gj=cj.append("g").attr("transform",Qi.legend),Sg||fj.style("visibility","hidden"),Vg||(gj.style("visibility","hidden"),Li=Cc(xf.data.targets)),hj=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),ah&&ej.append("g").attr("class",f.axisX).attr("clip-path",wi).attr("transform",Qi.x).append("text").attr("class",f.axisXLabel).attr("transform",_g?"rotate(-90)":"").style("text-anchor",zb),sh&&ej.append("g").attr("class",f.axisY).attr("clip-path",xi).attr("transform",Qi.y).append("text").attr("class",f.axisYLabel).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Ab),Bh&&ej.append("g").attr("class",f.axisY2).attr("transform",Qi.y2).append("text").attr("class",f.axisY2Label).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Bb),d=ej.append("g").attr("clip-path",vi).attr("class",f.grid),Kh&&d.append("g").attr("class",f.xgrids),we(Mh)&&d.append("g").attr("class",f.xgridLines),Sh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Nh&&d.append("g").attr("class",f.ygrids),we(Oh)&&d.append("g").attr("class",f.ygridLines),ej.append("g").attr("clip-path",vi).attr("class",f.regions),ej.append("g").attr("clip-path",vi).attr("class",f.chart),c=ej.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?_g?"ns-resize":"ew-resize":null),ej.select("."+f.chart).append("g").attr("class",f.chartBars),ej.select("."+f.chart).append("g").attr("class",f.chartLines),ej.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Qi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),ej.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&ej.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",_g?"ns-resize":"ew-resize").call(bj).on("dblclick.zoom",null),qh&&Zi.extent("function"!=typeof qh?qh:qh(_b())),fj.append("g").attr("clip-path",vi).attr("class",f.chart),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.append("g").attr("clip-path",vi).attr("class",f.brush).call(Zi).selectAll("rect").attr(_g?"width":"height",_g?Qf:Sf),fj.append("g").attr("class",f.axisX).attr("transform",Qi.subx).attr("clip-path",_g?"":wi),ef(xf.data.targets),_g?ej.select("."+f.axisX).style("opacity",0).call(og):(ej.select("."+f.axisY).style("opacity",0).call(pg),ej.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),pi){if(yi&&"string"==typeof qi){for(qi=re(qi),e=0;e0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(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){ee(xf.data.targets)||Hg&&(Bi=a,ej.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ci=!0,Qg())}function Ze(){ee(xf.data.targets)||Hg&&(ej.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),ej.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ci=!1,Rg())}function $e(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=ej.select("."+f.axisX).style("opacity",W?0:1),g=ej.select("."+f.axisY).style("opacity",W?0:1),h=ej.select("."+f.axisY2).style("opacity",W?0:1),e=fj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Vg&&rf(Cc(xf.data.targets),a,O),zi&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),jj=ig.domain(),Ef&&bj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),Zi.scale(lg)),G&&(ig.domain(Zi.empty()?jj:Zi.extent()),Ef&&bj.scale(ig).updateScaleExtent()),kh||!jh&&!ih||(S=Kc(Jc(X),ih),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(gh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!_g&&lh&&eb(c,O.axisX,lh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),hj.style("display","none"),o(),ej.select("line."+f.xgridFocus).style("visibility","hidden"),Kh){if("year"===Lh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=ej.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",_g?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",_g?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",_g?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",_g?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(_g?"y1":"x1")===(_g?Rf:0)?0:1}),i.exit().remove()}we(Mh)&&(k=ej.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Mh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",_g?"":"rotate(-90)").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",_g?0:Dd).attr("x2",_g?Pf:Dd).attr("y1",_g?Dd:Mf.top).attr("y2",_g?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",_g?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Nh&&(m=ej.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Ph)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",_g?jg:0).attr("x2",_g?jg:Pf).attr("y1",_g?0:jg).attr("y2",_g?Rf:jg),m.exit().remove()),A&&we(Oh)&&(n=ej.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Oh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",_g?"rotate(-90)":"").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",_g?Ed:0).attr("x2",_g?Ed:Pf).attr("y1",_g?0:Ed).attr("y2",_g?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",_g?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=ej.select("."+f.regions).selectAll("rect."+f.region).data(ki),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=ej.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Hi(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=ej.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return _g?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),ej.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",$i).style("opacity",1),ej.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",_i).style("opacity",kj),q=ej.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Rh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),q.exit().remove(),ej.each(function(){Fi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Fi=!1}),ej.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),ej.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Sg&&(null!==wf.event&&"zoom"===wf.event.type&&Zi.extent(ig.orgDomain()).update(),B&&(!_g&&lh&&eb(e,O.axisSubX,lh),Zi.empty()||Zi.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Hi(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1))),ej.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),ej.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),v=ej.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ai&&!zi?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),ej.select("."+f.eventRects).datum(x?x.values:[]),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",_g?0:y).attr("y",_g?y:0).attr("width",_g?Pf:z).attr("height",_g?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){lj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&bj.altDomain?(ig.domain(bj.altDomain),void bj.scale(ig).updateScaleExtent()):(zi&&ig.orgDomain()[0]===jj[0]&&ig.domain([jj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Di=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){cj.attr("width",Tf).attr("height",Uf),cj.select("#"+si).select("rect").attr("width",Pf).attr("height",Rf),cj.select("#"+ti).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),cj.select("#"+ui).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),cj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),ij.style("max-height",Uf+"px")}function df(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=ej.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Hi(a)}),e=ej.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Jg(a)?"pointer":null}),c=ej.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)}),b.append("path").attr("class",dd).style("opacity",function(){return kj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Hi(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Hi(a)}).style("cursor",function(a){return Jg(a)?"pointer":null}),a.forEach(function(a){ej.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=ej.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Hi(a.data)}).style("cursor",function(a){return Jg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Sg&&(n=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Hi(a)}),l=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)})),cj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(750).style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Ri?j:i,l=Ri?Q():P();return d&&(x=0,D=0,u=0,v=0),Vg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Ri?v:u,void($g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Ri?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=gj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Xg?Xg(a):xf.toggle(a)}).on("mouseover",function(a){Fi||xf.focus(a),"function"==typeof Yg&&Yg(a)}).on("mouseout",function(a){Fi||xf.revert(),"function"==typeof Zg&&Zg(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ri?h:-200).attr("y",Ri?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ri?i:-200).attr("y",Ri?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Hi(a)}).attr("x",Ri?h:-200).attr("y",Ri?-200:j).attr("width",10).attr("height",10),gj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),gj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),gj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),gj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){return Gc(a)?1:Vi}),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Fi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"]),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","selection","enabled"],!1),Ig=h(["data","selection","grouped"],!1),Jg=h(["data","selection","isselectable"],function(){return!0}),Kg=h(["data","selection","multiple"],!0),Lg=h(["data","onclick"],function(){}),Mg=h(["data","onenter"],function(){}),Ng=h(["data","onleave"],function(){}),Og=h(["data","onselected"],function(){}),Pg=h(["data","onunselected"],function(){}),Qg=h(["data","ondragstart"],function(){}),Rg=h(["data","ondragend"],function(){}),Sg=h(["subchart","show"],!1),Tg=h(["subchart","size","height"],60),Ug=h(["color","pattern"],[]),Vg=h(["legend","show"],!0),Wg=h(["legend","position"],"bottom"),Xg=h(["legend","item","onclick"]),Yg=h(["legend","item","onmouseover"]),Zg=h(["legend","item","onmouseout"]),$g=h(["legend","equally"],!1),_g=h(["axis","rotated"],!1),ah=h(["axis","x","show"],!0),bh=h(["axis","x","type"],"indexed"),ch=h(["axis","x","localtime"],!0),dh=h(["axis","x","categories"],[]),eh=h(["axis","x","tick","centered"],!1),fh=h(["axis","x","tick","format"]),gh=h(["axis","x","tick","culling"],{}),hh=h(["axis","x","tick","culling","max"],10),ih=h(["axis","x","tick","count"]),jh=h(["axis","x","tick","fit"],!0),kh=h(["axis","x","tick","values"],null),lh=h(["axis","x","tick","rotate"]),mh=h(["axis","x","max"],null),nh=h(["axis","x","min"],null),oh=h(["axis","x","padding"],{}),ph=h(["axis","x","height"]),qh=h(["axis","x","default"]),rh=h(["axis","x","label"],{}),sh=h(["axis","y","show"],!0),th=h(["axis","y","max"]),uh=h(["axis","y","min"]),vh=h(["axis","y","center"]),wh=h(["axis","y","label"],{}),xh=h(["axis","y","inner"],!1),yh=h(["axis","y","tick","format"]),zh=h(["axis","y","padding"],{}),Ah=h(["axis","y","ticks"],10),Bh=h(["axis","y2","show"],!1),Ch=h(["axis","y2","max"]),Dh=h(["axis","y2","min"]),Eh=h(["axis","y2","center"]),Fh=h(["axis","y2","label"],{}),Gh=h(["axis","y2","inner"],!1),Hh=h(["axis","y2","tick","format"]),Ih=h(["axis","y2","padding"],{}),Jh=h(["axis","y2","ticks"],10),Kh=h(["grid","x","show"],!1),Lh=h(["grid","x","type"],"tick"),Mh=h(["grid","x","lines"],[]),Nh=h(["grid","y","show"],!1),Oh=h(["grid","y","lines"],[]),Ph=h(["grid","y","ticks"],10),Qh=h(["point","show"],!0),Rh=Qh?h(["point","r"],2.5):0,Sh=h(["point","focus","line","enabled"],!0),Th=h(["point","focus","expand","enabled"],!0),Uh=h(["point","focus","expand","r"],Th?4:Rh),Vh=h(["point","focus","select","r"],8),Wh=h(["line","connect_null"],!1),Xh=h(["bar","width"]),Yh=h(["bar","width","ratio"],.6),Zh=h(["pie","label","show"],!0),$h=h(["pie","label","format"]),_h=h(["pie","expand"],!0),ai=h(["pie","onclick"],function(){}),bi=h(["pie","onmouseover"],function(){}),ci=h(["pie","onmouseout"],function(){}),di=h(["donut","label","show"],!0),ei=h(["donut","label","format"]),fi=h(["donut","expand"],!0),gi=h(["donut","title"],""),hi=h(["donut","onclick"],function(){}),ii=h(["donut","onmouseover"],function(){}),ji=h(["donut","onmouseout"],function(){}),ki=h(["regions"],[]),li=h(["tooltip","show"],!0),mi=h(["tooltip","format","title"]),ni=h(["tooltip","format","value"]),oi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=mi?mi:b,l=ni?ni:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),pi=h(["tooltip","init","show"],!1),qi=h(["tooltip","init","x"],0),ri=h(["tooltip","init","position"],{top:"0px",left:"50px"}),si=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ti=si+"-xaxis",ui=si+"-yaxis",vi=i(si),wi=i(ti),xi=i(ui),yi="timeseries"===bh,zi="categorized"===bh,Ai=!yi&&(sg||we(tg)),Bi=null,Ci=!1,Di=!1,Ei=!1,Fi=!1,Gi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Hi=qe(Gg,we(Ug)?Ug:Gi,Fg),Ii=ch?wf.time.format:wf.time.format.utc,Ji=function(){var a=[[Ii("%Y/%-m/%-d"),function(){return!0}],[Ii("%-m/%-d"),function(a){return a.getMonth()}],[Ii("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ii("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ii("%I %p"),function(a){return a.getHours()}],[Ii("%I:%M"),function(a){return a.getMinutes()}],[Ii(":%S"),function(a){return a.getSeconds()}],[Ii(".%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)}}(),Ki=[],Li=[],Mi=_g?"left":"bottom",Ni=_g?xh?"top":"bottom":xh?"right":"left",Oi=_g?Gh?"bottom":"top":Gh?"left":"right",Pi=_g?"left":"bottom",Qi={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(_g?0:Rf)+")"},y:function(){return"translate(0,"+(_g?Rf:0)+")"},y2:function(){return"translate("+(_g?0:Pf)+","+(_g?1:0)+")"},subx:function(){return"translate(0,"+(_g?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Ri="right"===Wg,Si=0,Ti=0,Ui=0,Vi=.15,Wi=30,Xi=_g&&!ah?0:30,Yi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Zi,$i=function(){var a=wf.svg.line().x(_g?function(a){return V(a.id)(a.value)}:Cd).y(_g?Cd:function(a){return V(a.id)(a.value)});return Wh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Wh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),_i=function(){var a;return a=_g?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a=wf.svg.line().x(_g?function(a){return W(a.id)(a.value)}:Fd).y(_g?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),bj=function(){};Zi=wf.svg.brush().on("brush",_e),Zi.update=function(){return fj&&fj.select("."+f.brush).call(this),this},Zi.scale=function(a){return _g?this.y(a):this.x(a)},Ef&&(bj=wf.behavior.zoom().on("zoomstart",function(){bj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),bj.scale=function(a){return _g?this.y(a):this.x(a)},bj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},bj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(jj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var cj,dj,ej,fj,gj,hj,ij,jj,kj,lj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),cj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&pf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),xf.revert()},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),cj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&qf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),xf.revert()},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){Zi.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&zi&&(dh=a.categories,og.categories(dh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(ej.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Ig||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Jg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Ig||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Jg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0})},xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Mh=a,$e(),Mh):Mh -},xf.xgrids.add=function(a){return a?xf.xgrids(Mh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a);return xf.xgrids(Mh.filter(b))},xf.ygrids=function(a){return a?(Oh=a,$e(),Oh):Oh},xf.ygrids.add=function(a){return a?xf.ygrids(Oh.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Oh.filter(b))},xf.regions=function(a){return c(a)?ki:(ki=a,$e(),ki)},xf.regions.add=function(a){return c(a)?ki:(ki=ki.concat(a),$e(),ki)},xf.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;cj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ki=ki.filter(function(b){return b.classes.indexOf(a)<0})}),ki},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(th=+a.y),b(a.y2)&&(Ch=+a.y2)):th=Ch=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){Vg||(Vg=!0,gj.style("visibility","visible")),pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0}),Vg&&ve(a)&&(Vg=!1,gj.style("visibility","hidden"))},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},ij.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file +}hj.html(oi(xf.data.targets.map(function(a){return pc(a.values[qi])}),$(),wd(ee(xf.data.targets)),Hi)),hj.style("top",ri.top).style("left",ri.left).style("display","block")}null==a.onresize&&(a.onresize=bf()),a.onresize.add&&(a.onresize.add(Jf),a.onresize.add(function(){df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})}),a.onresize.add(Kf))}function Ue(a){a.append("rect").attr("class",fd).style("cursor",Hg&&Ig?"pointer":null).on("mouseover",function(a,b){if(!Ci&&!ee(xf.data.targets)){var c,d,e=xf.data.targets.map(function(a){return pc(a.values[b])});if(Object.keys(wg).length>0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(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){ee(xf.data.targets)||Hg&&(Bi=a,ej.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ci=!0,Qg())}function Ze(){ee(xf.data.targets)||Hg&&(ej.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),ej.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ci=!1,Rg())}function $e(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=ej.select("."+f.axisX).style("opacity",W?0:1),g=ej.select("."+f.axisY).style("opacity",W?0:1),h=ej.select("."+f.axisY2).style("opacity",W?0:1),e=fj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Vg&&rf(Cc(xf.data.targets),a,O),zi&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),jj=ig.domain(),Ef&&bj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),Zi.scale(lg)),G&&(ig.domain(Zi.empty()?jj:Zi.extent()),Ef&&bj.scale(ig).updateScaleExtent()),kh||!jh&&!ih||(S=Kc(Jc(X),ih),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(gh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!_g&&lh&&eb(c,O.axisX,lh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),hj.style("display","none"),o(),ej.select("line."+f.xgridFocus).style("visibility","hidden"),Kh){if("year"===Lh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=ej.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",_g?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",_g?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",_g?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",_g?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(_g?"y1":"x1")===(_g?Rf:0)?0:1}),i.exit().remove()}we(Mh)&&(k=ej.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Mh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",_g?"":"rotate(-90)").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",_g?0:Dd).attr("x2",_g?Pf:Dd).attr("y1",_g?Dd:Mf.top).attr("y2",_g?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",_g?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Nh&&(m=ej.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Ph)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",_g?jg:0).attr("x2",_g?jg:Pf).attr("y1",_g?0:jg).attr("y2",_g?Rf:jg),m.exit().remove()),A&&we(Oh)&&(n=ej.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Oh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",_g?"rotate(-90)":"").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",_g?Ed:0).attr("x2",_g?Ed:Pf).attr("y1",_g?0:Ed).attr("y2",_g?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",_g?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=ej.select("."+f.regions).selectAll("rect."+f.region).data(ki),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=ej.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Hi(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=ej.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return _g?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),ej.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",$i).style("opacity",1),ej.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",_i).style("opacity",kj),q=ej.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Rh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),q.exit().remove(),ej.each(function(){Fi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Fi=!1}),ej.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),ej.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Sg&&(null!==wf.event&&"zoom"===wf.event.type&&Zi.extent(ig.orgDomain()).update(),B&&(!_g&&lh&&eb(e,O.axisSubX,lh),Zi.empty()||Zi.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Hi(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1))),ej.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),ej.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),v=ej.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ai&&!zi?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),ej.select("."+f.eventRects).datum(x?x.values:[]),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",_g?0:y).attr("y",_g?y:0).attr("width",_g?Pf:z).attr("height",_g?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){lj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&bj.altDomain?(ig.domain(bj.altDomain),void bj.scale(ig).updateScaleExtent()):(zi&&ig.orgDomain()[0]===jj[0]&&ig.domain([jj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Di=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){cj.attr("width",Tf).attr("height",Uf),cj.select("#"+si).select("rect").attr("width",Pf).attr("height",Rf),cj.select("#"+ti).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),cj.select("#"+ui).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),cj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),ij.style("max-height",Uf+"px")}function df(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=ej.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Hi(a)}),e=ej.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Jg(a)?"pointer":null}),c=ej.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)}),b.append("path").attr("class",dd).style("opacity",function(){return kj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Hi(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Hi(a)}).style("cursor",function(a){return Jg(a)?"pointer":null}),a.forEach(function(a){ej.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=ej.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Hi(a.data)}).style("cursor",function(a){return Jg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Sg&&(n=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Hi(a)}),l=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)})),cj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(750).style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Ri?j:i,l=Ri?Q():P();return d&&(x=0,D=0,u=0,v=0),Vg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Ri?v:u,void($g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Ri?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=gj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Xg?Xg(a):xf.toggle(a)}).on("mouseover",function(a){Fi||xf.focus(a),"function"==typeof Yg&&Yg(a)}).on("mouseout",function(a){Fi||xf.revert(),"function"==typeof Zg&&Zg(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ri?h:-200).attr("y",Ri?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ri?i:-200).attr("y",Ri?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Hi(a)}).attr("x",Ri?h:-200).attr("y",Ri?-200:j).attr("width",10).attr("height",10),gj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),gj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),gj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),gj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){return Gc(a)?1:Vi}),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Fi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"]),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","selection","enabled"],!1),Ig=h(["data","selection","grouped"],!1),Jg=h(["data","selection","isselectable"],function(){return!0}),Kg=h(["data","selection","multiple"],!0),Lg=h(["data","onclick"],function(){}),Mg=h(["data","onenter"],function(){}),Ng=h(["data","onleave"],function(){}),Og=h(["data","onselected"],function(){}),Pg=h(["data","onunselected"],function(){}),Qg=h(["data","ondragstart"],function(){}),Rg=h(["data","ondragend"],function(){}),Sg=h(["subchart","show"],!1),Tg=h(["subchart","size","height"],60),Ug=h(["color","pattern"],[]),Vg=h(["legend","show"],!0),Wg=h(["legend","position"],"bottom"),Xg=h(["legend","item","onclick"]),Yg=h(["legend","item","onmouseover"]),Zg=h(["legend","item","onmouseout"]),$g=h(["legend","equally"],!1),_g=h(["axis","rotated"],!1),ah=h(["axis","x","show"],!0),bh=h(["axis","x","type"],"indexed"),ch=h(["axis","x","localtime"],!0),dh=h(["axis","x","categories"],[]),eh=h(["axis","x","tick","centered"],!1),fh=h(["axis","x","tick","format"]),gh=h(["axis","x","tick","culling"],{}),hh=h(["axis","x","tick","culling","max"],10),ih=h(["axis","x","tick","count"]),jh=h(["axis","x","tick","fit"],!0),kh=h(["axis","x","tick","values"],null),lh=h(["axis","x","tick","rotate"]),mh=h(["axis","x","max"],null),nh=h(["axis","x","min"],null),oh=h(["axis","x","padding"],{}),ph=h(["axis","x","height"]),qh=h(["axis","x","default"]),rh=h(["axis","x","label"],{}),sh=h(["axis","y","show"],!0),th=h(["axis","y","max"]),uh=h(["axis","y","min"]),vh=h(["axis","y","center"]),wh=h(["axis","y","label"],{}),xh=h(["axis","y","inner"],!1),yh=h(["axis","y","tick","format"]),zh=h(["axis","y","padding"],{}),Ah=h(["axis","y","ticks"],10),Bh=h(["axis","y2","show"],!1),Ch=h(["axis","y2","max"]),Dh=h(["axis","y2","min"]),Eh=h(["axis","y2","center"]),Fh=h(["axis","y2","label"],{}),Gh=h(["axis","y2","inner"],!1),Hh=h(["axis","y2","tick","format"]),Ih=h(["axis","y2","padding"],{}),Jh=h(["axis","y2","ticks"],10),Kh=h(["grid","x","show"],!1),Lh=h(["grid","x","type"],"tick"),Mh=h(["grid","x","lines"],[]),Nh=h(["grid","y","show"],!1),Oh=h(["grid","y","lines"],[]),Ph=h(["grid","y","ticks"],10),Qh=h(["point","show"],!0),Rh=Qh?h(["point","r"],2.5):0,Sh=h(["point","focus","line","enabled"],!0),Th=h(["point","focus","expand","enabled"],!0),Uh=h(["point","focus","expand","r"],Th?4:Rh),Vh=h(["point","focus","select","r"],8),Wh=h(["line","connect_null"],!1),Xh=h(["bar","width"]),Yh=h(["bar","width","ratio"],.6),Zh=h(["pie","label","show"],!0),$h=h(["pie","label","format"]),_h=h(["pie","expand"],!0),ai=h(["pie","onclick"],function(){}),bi=h(["pie","onmouseover"],function(){}),ci=h(["pie","onmouseout"],function(){}),di=h(["donut","label","show"],!0),ei=h(["donut","label","format"]),fi=h(["donut","expand"],!0),gi=h(["donut","title"],""),hi=h(["donut","onclick"],function(){}),ii=h(["donut","onmouseover"],function(){}),ji=h(["donut","onmouseout"],function(){}),ki=h(["regions"],[]),li=h(["tooltip","show"],!0),mi=h(["tooltip","format","title"]),ni=h(["tooltip","format","value"]),oi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=mi?mi:b,l=ni?ni:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),pi=h(["tooltip","init","show"],!1),qi=h(["tooltip","init","x"],0),ri=h(["tooltip","init","position"],{top:"0px",left:"50px"}),si=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ti=si+"-xaxis",ui=si+"-yaxis",vi=i(si),wi=i(ti),xi=i(ui),yi="timeseries"===bh,zi="categorized"===bh,Ai=!yi&&(sg||we(tg)),Bi=null,Ci=!1,Di=!1,Ei=!1,Fi=!1,Gi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Hi=qe(Gg,we(Ug)?Ug:Gi,Fg),Ii=ch?wf.time.format:wf.time.format.utc,Ji=function(){var a=[[Ii("%Y/%-m/%-d"),function(){return!0}],[Ii("%-m/%-d"),function(a){return a.getMonth()}],[Ii("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ii("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ii("%I %p"),function(a){return a.getHours()}],[Ii("%I:%M"),function(a){return a.getMinutes()}],[Ii(":%S"),function(a){return a.getSeconds()}],[Ii(".%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)}}(),Ki=[],Li=[],Mi=_g?"left":"bottom",Ni=_g?xh?"top":"bottom":xh?"right":"left",Oi=_g?Gh?"bottom":"top":Gh?"left":"right",Pi=_g?"left":"bottom",Qi={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(_g?0:Rf)+")"},y:function(){return"translate(0,"+(_g?Rf:0)+")"},y2:function(){return"translate("+(_g?0:Pf)+","+(_g?1:0)+")"},subx:function(){return"translate(0,"+(_g?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Ri="right"===Wg,Si=0,Ti=0,Ui=0,Vi=.15,Wi=30,Xi=_g&&!ah?0:30,Yi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Zi,$i=function(){var a=wf.svg.line().x(_g?function(a){return V(a.id)(a.value)}:Cd).y(_g?Cd:function(a){return V(a.id)(a.value)});return Wh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Wh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),_i=function(){var a;return a=_g?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a=wf.svg.line().x(_g?function(a){return W(a.id)(a.value)}:Fd).y(_g?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),bj=function(){};Zi=wf.svg.brush().on("brush",_e),Zi.update=function(){return fj&&fj.select("."+f.brush).call(this),this},Zi.scale=function(a){return _g?this.y(a):this.x(a)},Ef&&(bj=wf.behavior.zoom().on("zoomstart",function(){bj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),bj.scale=function(a){return _g?this.y(a):this.x(a)},bj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},bj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(jj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var cj,dj,ej,fj,gj,hj,ij,jj,kj,lj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),cj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&pf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),xf.revert()},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),cj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&qf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),xf.revert()},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){Zi.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&zi&&(dh=a.categories,og.categories(dh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(ej.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Ig||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Jg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Ig||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Jg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0}) +},xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Mh=a,$e(),Mh):Mh},xf.xgrids.add=function(a){return a?xf.xgrids(Mh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a);return xf.xgrids(Mh.filter(b))},xf.ygrids=function(a){return a?(Oh=a,$e(),Oh):Oh},xf.ygrids.add=function(a){return a?xf.ygrids(Oh.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Oh.filter(b))},xf.regions=function(a){return c(a)?ki:(ki=a,$e(),ki)},xf.regions.add=function(a){return c(a)?ki:(ki=ki.concat(a),$e(),ki)},xf.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;cj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ki=ki.filter(function(b){return b.classes.indexOf(a)<0})}),ki},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(th=+a.y),b(a.y2)&&(Ch=+a.y2)):th=Ch=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0})},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},ij.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 97beb21a33ce7c002bdaf80711ad638b4e9104f6 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 30 Apr 2014 14:43:30 +0900 Subject: [PATCH 091/178] Add data.hide option - #151 --- c3.js | 6 ++++++ c3.min.js | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/c3.js b/c3.js index 10f0a38..33aaa9d 100644 --- a/c3.js +++ b/c3.js @@ -137,6 +137,7 @@ __data_regions = getConfig(['data', 'regions'], {}), __data_color = getConfig(['data', 'color']), __data_colors = getConfig(['data', 'colors'], {}), + __data_hide = getConfig(['data', 'hide'], false), __data_selection_enabled = getConfig(['data', 'selection', 'enabled'], false), __data_selection_grouped = getConfig(['data', 'selection', 'grouped'], false), __data_selection_isselectable = getConfig(['data', 'selection', 'isselectable'], function () { return true; }), @@ -2546,6 +2547,11 @@ c3.data.xs = {}; c3.data.targets = convertDataToTargets(data); + // Set targets to hide if needed + if (__data_hide) { + addHiddenTargetIds(__data_hide === true ? mapToIds(c3.data.targets) : __data_hide); + } + // Init sizes and scales updateSizes(); updateScales(); diff --git a/c3.min.js b/c3.min.js index b97e9ab..bbddace 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.33"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cPf&&(Pf=0),0>Rf&&(Rf=0),Qf=_g?Mf.left-Wi-Xi:Pf,Sf=_g?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Ri&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){ej.select("line."+f.xgridFocus).attr("x1",_g?0:-10).attr("x2",_g?Pf:-10).attr("y1",_g?-10:Mf.top).attr("y2",_g?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=_g?f.axisX:f.axisY,b=ej.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:_g?ah?v("x"):1:!sh||xh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Ri?P()+(Bh&&!_g?v("y2"):a):Bh?Gh||_g?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||ah?"x"===a&&ph?ph:"y"!==a||sh?"y2"!==a||Bh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Yi:Vg&&!Ri?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!_g)}function C(){return A(!_g)}function D(){return z(_g)}function E(){return A(_g)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(ph?ph:0)+80:Rf+8}function H(){return F(!_g)}function I(){return G(!_g)}function J(){return F(_g)}function K(){return G(_g)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(zi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Si=a}function N(a){Ti=a}function O(a){Ui=a}function P(){return Vg?Ri?Ti*(Si+1):Tf:0}function Q(){return Vg?Ri?Uf:Ui*(Si+1):0}function R(){var a,b,c=!ig;ag=_g?1:0,bg=_g?Rf:Pf,cg=_g?0:Rf,dg=_g?Pf:1,eg=ag,fg=bg,gg=_g?0:Sf,hg=_g?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,jj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=kh?kh:c?void 0:og.tickValues(),og=X(ig,Mi,a,b),rg=X(lg,Pi,a,b),pg=Y(jg,Ni,yh,Ah),qg=Y(kg,Oi,Hh,Jh),c||(Zi.scale(lg),Ef&&bj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(yi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),zi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(zi?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),zi?(e.tickCentered(eh),ve(gh)&&(gh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},zi&&e.categories(dh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=yi?Ji:zi?Tc:function(a){return 0>a?a.toFixed(0):a};return fh&&("function"==typeof fh?a=fh:yi&&(a=function(a){return a?Ii(fh)(a):""})),a}function _(a){var b;return"y"===a?b=wh:"y2"===a?b=Fh:"x"===a&&(b=rh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?wh=b:"y2"===a?Fh=b:"x"===a&&(rh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",_g?"inner-top":"inner-right")}function hb(){return fb("y",_g?"inner-right":"inner-top")}function ib(){return fb("y2",_g?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!_g,gb())}function rb(){return nb(_g,hb())}function sb(){return nb(_g,ib())}function tb(){return ob(!_g,gb())}function ub(){return ob(_g,hb())}function vb(){return ob(_g,ib())}function wb(){var a=gb();return _g?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":ph?ph-10:"3em"}function xb(){var a=hb();return _g?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return _g?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!_g,gb())}function Ab(){return pb(_g,hb())}function Bb(){return pb(_g,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){ej.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),ej.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),ej.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.length>0)for(g=Sc(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 wf.max(Object.keys(i).map(function(a){return wf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Dh:uh,n="y2"===c?Ch:th,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Eh:vh,r=ud()&&_g;return 0===l.length?"y2"===c?kg.domain():jg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(jg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&zh&&(f=b(zh.top)?zh.top:e,g=b(zh.bottom)?zh.bottom:e),"y2"===c&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return nh?yi?re(nh):nh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return mh?yi?re(mh):mh:wf.max(a,function(a){return wf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return zi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof oh&&we(oh)?(e=b(oh.left)?oh.left:d,f=b(oh.right)?oh.right:d):e=f="number"==typeof oh?oh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=yi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=yi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?jg:kg;return b="y"===a.axis||"y2"===a.axis?_g?Rf:"start"in a?d(a.start):Rf:_g?"end"in a?ig(yi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),xf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=yi?a?a instanceof Date?a:re(a):re(mc(c,d)):Ai&&!zi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ai&&zi&&0===c&&g&&(0===e&&(dh=[]),dh.push(g)),("undefined"==typeof a[b]||xf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&xf.data.targets[0].values[a-1]?xf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(xf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(yi?new Date(i):i);j.push(e)}return yi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Ki=Ki.concat(a)}function Mc(a){Ki=Ki.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Li=Li.concat(a)}function Oc(a){Li=Li.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&li&&(hj.html(oi(a,$(),wd(k),Hi)).style("display","block"),d=hj.property("offsetWidth"),e=hj.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(_g?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),hj.style("top",i+"px").style("left",g+"px"))}function Qd(){hj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});li&&(be(xf.data.targets)||ee(xf.data.targets)||ej.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(_g?"y1":"x1",Cd).attr(_g?"y2":"x2",Cd))}function Sd(){ej.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return Xh?Xh:b?2*a.tickOffset()*Yh/b:0}function $d(a,b){Dc(a).forEach(function(a){lj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&fi||je(a)&&_h}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=_g?1:0,e=_g?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Og(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud).attr("stroke",function(){return Hi(b)}).attr("r",1.4*Vh).transition().duration(100).attr("r",Vh)}function Be(a,b,c){Pg(b,a.node()),ej.select("."+f.selectedCircles+ld(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){Og(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Hi(b)).darker(1)})}function Ee(a,b){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return Hi(b)})}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?ej.selectAll("."+f.circles+ld(c)):ej).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Uh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Rh)}function Ke(a){return ej.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=_g?1:0,f=_g?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 _g?(c=he(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.getBoundingClientRect();return _g?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return _g&&(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(ij=wf.select(zf),ij.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ij.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),jj=ig.domain(),Zi.scale(lg),Ef&&bj.scale(ig),cj=ij.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),dj=cj.append("defs"),dj.append("clipPath").attr("id",si).append("rect").attr("width",Pf).attr("height",Rf),dj.append("clipPath").attr("id",ti).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.append("clipPath").attr("id",ui).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej=cj.append("g").attr("transform",Qi.main),fj=cj.append("g").attr("transform",Qi.context),gj=cj.append("g").attr("transform",Qi.legend),Sg||fj.style("visibility","hidden"),Vg||(gj.style("visibility","hidden"),Li=Cc(xf.data.targets)),hj=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),ah&&ej.append("g").attr("class",f.axisX).attr("clip-path",wi).attr("transform",Qi.x).append("text").attr("class",f.axisXLabel).attr("transform",_g?"rotate(-90)":"").style("text-anchor",zb),sh&&ej.append("g").attr("class",f.axisY).attr("clip-path",xi).attr("transform",Qi.y).append("text").attr("class",f.axisYLabel).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Ab),Bh&&ej.append("g").attr("class",f.axisY2).attr("transform",Qi.y2).append("text").attr("class",f.axisY2Label).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Bb),d=ej.append("g").attr("clip-path",vi).attr("class",f.grid),Kh&&d.append("g").attr("class",f.xgrids),we(Mh)&&d.append("g").attr("class",f.xgridLines),Sh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Nh&&d.append("g").attr("class",f.ygrids),we(Oh)&&d.append("g").attr("class",f.ygridLines),ej.append("g").attr("clip-path",vi).attr("class",f.regions),ej.append("g").attr("clip-path",vi).attr("class",f.chart),c=ej.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?_g?"ns-resize":"ew-resize":null),ej.select("."+f.chart).append("g").attr("class",f.chartBars),ej.select("."+f.chart).append("g").attr("class",f.chartLines),ej.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Qi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),ej.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&ej.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",_g?"ns-resize":"ew-resize").call(bj).on("dblclick.zoom",null),qh&&Zi.extent("function"!=typeof qh?qh:qh(_b())),fj.append("g").attr("clip-path",vi).attr("class",f.chart),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.append("g").attr("clip-path",vi).attr("class",f.brush).call(Zi).selectAll("rect").attr(_g?"width":"height",_g?Qf:Sf),fj.append("g").attr("class",f.axisX).attr("transform",Qi.subx).attr("clip-path",_g?"":wi),ef(xf.data.targets),_g?ej.select("."+f.axisX).style("opacity",0).call(og):(ej.select("."+f.axisY).style("opacity",0).call(pg),ej.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),pi){if(yi&&"string"==typeof qi){for(qi=re(qi),e=0;e0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(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){ee(xf.data.targets)||Hg&&(Bi=a,ej.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ci=!0,Qg())}function Ze(){ee(xf.data.targets)||Hg&&(ej.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),ej.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ci=!1,Rg())}function $e(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=ej.select("."+f.axisX).style("opacity",W?0:1),g=ej.select("."+f.axisY).style("opacity",W?0:1),h=ej.select("."+f.axisY2).style("opacity",W?0:1),e=fj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Vg&&rf(Cc(xf.data.targets),a,O),zi&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),jj=ig.domain(),Ef&&bj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),Zi.scale(lg)),G&&(ig.domain(Zi.empty()?jj:Zi.extent()),Ef&&bj.scale(ig).updateScaleExtent()),kh||!jh&&!ih||(S=Kc(Jc(X),ih),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(gh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!_g&&lh&&eb(c,O.axisX,lh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),hj.style("display","none"),o(),ej.select("line."+f.xgridFocus).style("visibility","hidden"),Kh){if("year"===Lh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=ej.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",_g?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",_g?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",_g?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",_g?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(_g?"y1":"x1")===(_g?Rf:0)?0:1}),i.exit().remove()}we(Mh)&&(k=ej.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Mh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",_g?"":"rotate(-90)").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",_g?0:Dd).attr("x2",_g?Pf:Dd).attr("y1",_g?Dd:Mf.top).attr("y2",_g?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",_g?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Nh&&(m=ej.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Ph)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",_g?jg:0).attr("x2",_g?jg:Pf).attr("y1",_g?0:jg).attr("y2",_g?Rf:jg),m.exit().remove()),A&&we(Oh)&&(n=ej.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Oh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",_g?"rotate(-90)":"").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",_g?Ed:0).attr("x2",_g?Ed:Pf).attr("y1",_g?0:Ed).attr("y2",_g?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",_g?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=ej.select("."+f.regions).selectAll("rect."+f.region).data(ki),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=ej.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Hi(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=ej.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return _g?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),ej.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",$i).style("opacity",1),ej.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",_i).style("opacity",kj),q=ej.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Rh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),q.exit().remove(),ej.each(function(){Fi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Fi=!1}),ej.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),ej.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Sg&&(null!==wf.event&&"zoom"===wf.event.type&&Zi.extent(ig.orgDomain()).update(),B&&(!_g&&lh&&eb(e,O.axisSubX,lh),Zi.empty()||Zi.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Hi(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1))),ej.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),ej.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),v=ej.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ai&&!zi?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),ej.select("."+f.eventRects).datum(x?x.values:[]),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",_g?0:y).attr("y",_g?y:0).attr("width",_g?Pf:z).attr("height",_g?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){lj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&bj.altDomain?(ig.domain(bj.altDomain),void bj.scale(ig).updateScaleExtent()):(zi&&ig.orgDomain()[0]===jj[0]&&ig.domain([jj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Di=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){cj.attr("width",Tf).attr("height",Uf),cj.select("#"+si).select("rect").attr("width",Pf).attr("height",Rf),cj.select("#"+ti).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),cj.select("#"+ui).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),cj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),ij.style("max-height",Uf+"px")}function df(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=ej.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Hi(a)}),e=ej.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Jg(a)?"pointer":null}),c=ej.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)}),b.append("path").attr("class",dd).style("opacity",function(){return kj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Hi(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Hi(a)}).style("cursor",function(a){return Jg(a)?"pointer":null}),a.forEach(function(a){ej.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=ej.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Hi(a.data)}).style("cursor",function(a){return Jg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Sg&&(n=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Hi(a)}),l=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)})),cj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(750).style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Ri?j:i,l=Ri?Q():P();return d&&(x=0,D=0,u=0,v=0),Vg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Ri?v:u,void($g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Ri?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=gj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Xg?Xg(a):xf.toggle(a)}).on("mouseover",function(a){Fi||xf.focus(a),"function"==typeof Yg&&Yg(a)}).on("mouseout",function(a){Fi||xf.revert(),"function"==typeof Zg&&Zg(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ri?h:-200).attr("y",Ri?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ri?i:-200).attr("y",Ri?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Hi(a)}).attr("x",Ri?h:-200).attr("y",Ri?-200:j).attr("width",10).attr("height",10),gj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),gj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),gj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),gj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){return Gc(a)?1:Vi}),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Fi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"]),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","selection","enabled"],!1),Ig=h(["data","selection","grouped"],!1),Jg=h(["data","selection","isselectable"],function(){return!0}),Kg=h(["data","selection","multiple"],!0),Lg=h(["data","onclick"],function(){}),Mg=h(["data","onenter"],function(){}),Ng=h(["data","onleave"],function(){}),Og=h(["data","onselected"],function(){}),Pg=h(["data","onunselected"],function(){}),Qg=h(["data","ondragstart"],function(){}),Rg=h(["data","ondragend"],function(){}),Sg=h(["subchart","show"],!1),Tg=h(["subchart","size","height"],60),Ug=h(["color","pattern"],[]),Vg=h(["legend","show"],!0),Wg=h(["legend","position"],"bottom"),Xg=h(["legend","item","onclick"]),Yg=h(["legend","item","onmouseover"]),Zg=h(["legend","item","onmouseout"]),$g=h(["legend","equally"],!1),_g=h(["axis","rotated"],!1),ah=h(["axis","x","show"],!0),bh=h(["axis","x","type"],"indexed"),ch=h(["axis","x","localtime"],!0),dh=h(["axis","x","categories"],[]),eh=h(["axis","x","tick","centered"],!1),fh=h(["axis","x","tick","format"]),gh=h(["axis","x","tick","culling"],{}),hh=h(["axis","x","tick","culling","max"],10),ih=h(["axis","x","tick","count"]),jh=h(["axis","x","tick","fit"],!0),kh=h(["axis","x","tick","values"],null),lh=h(["axis","x","tick","rotate"]),mh=h(["axis","x","max"],null),nh=h(["axis","x","min"],null),oh=h(["axis","x","padding"],{}),ph=h(["axis","x","height"]),qh=h(["axis","x","default"]),rh=h(["axis","x","label"],{}),sh=h(["axis","y","show"],!0),th=h(["axis","y","max"]),uh=h(["axis","y","min"]),vh=h(["axis","y","center"]),wh=h(["axis","y","label"],{}),xh=h(["axis","y","inner"],!1),yh=h(["axis","y","tick","format"]),zh=h(["axis","y","padding"],{}),Ah=h(["axis","y","ticks"],10),Bh=h(["axis","y2","show"],!1),Ch=h(["axis","y2","max"]),Dh=h(["axis","y2","min"]),Eh=h(["axis","y2","center"]),Fh=h(["axis","y2","label"],{}),Gh=h(["axis","y2","inner"],!1),Hh=h(["axis","y2","tick","format"]),Ih=h(["axis","y2","padding"],{}),Jh=h(["axis","y2","ticks"],10),Kh=h(["grid","x","show"],!1),Lh=h(["grid","x","type"],"tick"),Mh=h(["grid","x","lines"],[]),Nh=h(["grid","y","show"],!1),Oh=h(["grid","y","lines"],[]),Ph=h(["grid","y","ticks"],10),Qh=h(["point","show"],!0),Rh=Qh?h(["point","r"],2.5):0,Sh=h(["point","focus","line","enabled"],!0),Th=h(["point","focus","expand","enabled"],!0),Uh=h(["point","focus","expand","r"],Th?4:Rh),Vh=h(["point","focus","select","r"],8),Wh=h(["line","connect_null"],!1),Xh=h(["bar","width"]),Yh=h(["bar","width","ratio"],.6),Zh=h(["pie","label","show"],!0),$h=h(["pie","label","format"]),_h=h(["pie","expand"],!0),ai=h(["pie","onclick"],function(){}),bi=h(["pie","onmouseover"],function(){}),ci=h(["pie","onmouseout"],function(){}),di=h(["donut","label","show"],!0),ei=h(["donut","label","format"]),fi=h(["donut","expand"],!0),gi=h(["donut","title"],""),hi=h(["donut","onclick"],function(){}),ii=h(["donut","onmouseover"],function(){}),ji=h(["donut","onmouseout"],function(){}),ki=h(["regions"],[]),li=h(["tooltip","show"],!0),mi=h(["tooltip","format","title"]),ni=h(["tooltip","format","value"]),oi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=mi?mi:b,l=ni?ni:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),pi=h(["tooltip","init","show"],!1),qi=h(["tooltip","init","x"],0),ri=h(["tooltip","init","position"],{top:"0px",left:"50px"}),si=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ti=si+"-xaxis",ui=si+"-yaxis",vi=i(si),wi=i(ti),xi=i(ui),yi="timeseries"===bh,zi="categorized"===bh,Ai=!yi&&(sg||we(tg)),Bi=null,Ci=!1,Di=!1,Ei=!1,Fi=!1,Gi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Hi=qe(Gg,we(Ug)?Ug:Gi,Fg),Ii=ch?wf.time.format:wf.time.format.utc,Ji=function(){var a=[[Ii("%Y/%-m/%-d"),function(){return!0}],[Ii("%-m/%-d"),function(a){return a.getMonth()}],[Ii("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ii("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ii("%I %p"),function(a){return a.getHours()}],[Ii("%I:%M"),function(a){return a.getMinutes()}],[Ii(":%S"),function(a){return a.getSeconds()}],[Ii(".%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)}}(),Ki=[],Li=[],Mi=_g?"left":"bottom",Ni=_g?xh?"top":"bottom":xh?"right":"left",Oi=_g?Gh?"bottom":"top":Gh?"left":"right",Pi=_g?"left":"bottom",Qi={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(_g?0:Rf)+")"},y:function(){return"translate(0,"+(_g?Rf:0)+")"},y2:function(){return"translate("+(_g?0:Pf)+","+(_g?1:0)+")"},subx:function(){return"translate(0,"+(_g?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Ri="right"===Wg,Si=0,Ti=0,Ui=0,Vi=.15,Wi=30,Xi=_g&&!ah?0:30,Yi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Zi,$i=function(){var a=wf.svg.line().x(_g?function(a){return V(a.id)(a.value)}:Cd).y(_g?Cd:function(a){return V(a.id)(a.value)});return Wh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Wh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),_i=function(){var a;return a=_g?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a=wf.svg.line().x(_g?function(a){return W(a.id)(a.value)}:Fd).y(_g?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),bj=function(){};Zi=wf.svg.brush().on("brush",_e),Zi.update=function(){return fj&&fj.select("."+f.brush).call(this),this},Zi.scale=function(a){return _g?this.y(a):this.x(a)},Ef&&(bj=wf.behavior.zoom().on("zoomstart",function(){bj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),bj.scale=function(a){return _g?this.y(a):this.x(a)},bj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},bj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(jj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var cj,dj,ej,fj,gj,hj,ij,jj,kj,lj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),cj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&pf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),xf.revert()},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),cj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&qf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),xf.revert()},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){Zi.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&zi&&(dh=a.categories,og.categories(dh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(ej.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Ig||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Jg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Ig||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Jg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0}) -},xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Mh=a,$e(),Mh):Mh},xf.xgrids.add=function(a){return a?xf.xgrids(Mh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a);return xf.xgrids(Mh.filter(b))},xf.ygrids=function(a){return a?(Oh=a,$e(),Oh):Oh},xf.ygrids.add=function(a){return a?xf.ygrids(Oh.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Oh.filter(b))},xf.regions=function(a){return c(a)?ki:(ki=a,$e(),ki)},xf.regions.add=function(a){return c(a)?ki:(ki=ki.concat(a),$e(),ki)},xf.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;cj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ki=ki.filter(function(b){return b.classes.indexOf(a)<0})}),ki},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(th=+a.y),b(a.y2)&&(Ch=+a.y2)):th=Ch=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0})},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},ij.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"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.33"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cPf&&(Pf=0),0>Rf&&(Rf=0),Qf=ah?Mf.left-Xi-Yi:Pf,Sf=ah?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Si&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){fj.select("line."+f.xgridFocus).attr("x1",ah?0:-10).attr("x2",ah?Pf:-10).attr("y1",ah?-10:Mf.top).attr("y2",ah?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=ah?f.axisX:f.axisY,b=fj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:ah?bh?v("x"):1:!th||yh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Si?P()+(Ch&&!ah?v("y2"):a):Ch?Hh||ah?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||bh?"x"===a&&qh?qh:"y"!==a||th?"y2"!==a||Ch?(jb(a).isInner?30:40)+("y2"===a?-10:0):Zi:Wg&&!Si?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!ah)}function C(){return A(!ah)}function D(){return z(ah)}function E(){return A(ah)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(qh?qh:0)+80:Rf+8}function H(){return F(!ah)}function I(){return G(!ah)}function J(){return F(ah)}function K(){return G(ah)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(Ai?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Ti=a}function N(a){Ui=a}function O(a){Vi=a}function P(){return Wg?Si?Ui*(Ti+1):Tf:0}function Q(){return Wg?Si?Uf:Vi*(Ti+1):0}function R(){var a,b,c=!ig;ag=ah?1:0,bg=ah?Rf:Pf,cg=ah?0:Rf,dg=ah?Pf:1,eg=ag,fg=bg,gg=ah?0:Sf,hg=ah?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,kj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=lh?lh:c?void 0:og.tickValues(),og=X(ig,Ni,a,b),rg=X(lg,Qi,a,b),pg=Y(jg,Oi,zh,Bh),qg=Y(kg,Pi,Ih,Kh),c||($i.scale(lg),Ef&&cj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(zi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Ai){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(Ai?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Ai?(e.tickCentered(fh),ve(hh)&&(hh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},Ai&&e.categories(eh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=zi?Ki:Ai?Tc:function(a){return 0>a?a.toFixed(0):a};return gh&&("function"==typeof gh?a=gh:zi&&(a=function(a){return a?Ji(gh)(a):""})),a}function _(a){var b;return"y"===a?b=xh:"y2"===a?b=Gh:"x"===a&&(b=sh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?xh=b:"y2"===a?Gh=b:"x"===a&&(sh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",ah?"inner-top":"inner-right")}function hb(){return fb("y",ah?"inner-right":"inner-top")}function ib(){return fb("y2",ah?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!ah,gb())}function rb(){return nb(ah,hb())}function sb(){return nb(ah,ib())}function tb(){return ob(!ah,gb())}function ub(){return ob(ah,hb())}function vb(){return ob(ah,ib())}function wb(){var a=gb();return ah?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":qh?qh-10:"3em"}function xb(){var a=hb();return ah?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return ah?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!ah,gb())}function Ab(){return pb(ah,hb())}function Bb(){return pb(ah,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){fj.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),fj.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),fj.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.length>0)for(g=Sc(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 wf.max(Object.keys(i).map(function(a){return wf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Eh:vh,n="y2"===c?Dh:uh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Fh:wh,r=ud()&&ah;return 0===l.length?"y2"===c?kg.domain():jg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(jg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Ah&&(f=b(Ah.top)?Ah.top:e,g=b(Ah.bottom)?Ah.bottom:e),"y2"===c&&Jh&&(f=b(Jh.top)?Jh.top:e,g=b(Jh.bottom)?Jh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return oh?zi?re(oh):oh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return nh?zi?re(nh):nh:wf.max(a,function(a){return wf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Ai?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof ph&&we(ph)?(e=b(ph.left)?ph.left:d,f=b(ph.right)?ph.right:d):e=f="number"==typeof ph?ph:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=zi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=zi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?jg:kg;return b="y"===a.axis||"y2"===a.axis?ah?Rf:"start"in a?d(a.start):Rf:ah?"end"in a?ig(zi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),xf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=zi?a?a instanceof Date?a:re(a):re(mc(c,d)):Bi&&!Ai?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Bi&&Ai&&0===c&&g&&(0===e&&(eh=[]),eh.push(g)),("undefined"==typeof a[b]||xf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&xf.data.targets[0].values[a-1]?xf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(xf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(zi?new Date(i):i);j.push(e)}return zi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Li=Li.concat(a)}function Mc(a){Li=Li.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Mi=Mi.concat(a)}function Oc(a){Mi=Mi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&mi&&(ij.html(pi(a,$(),wd(k),Ii)).style("display","block"),d=ij.property("offsetWidth"),e=ij.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(ah?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),ij.style("top",i+"px").style("left",g+"px"))}function Qd(){ij.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});mi&&(be(xf.data.targets)||ee(xf.data.targets)||fj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(ah?"y1":"x1",Cd).attr(ah?"y2":"x2",Cd))}function Sd(){fj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return Yh?Yh:b?2*a.tickOffset()*Zh/b:0}function $d(a,b){Dc(a).forEach(function(a){mj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&gi||je(a)&&ai}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=ah?1:0,e=ah?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Pg(b,a.node()),fj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud).attr("stroke",function(){return Ii(b)}).attr("r",1.4*Wh).transition().duration(100).attr("r",Wh)}function Be(a,b,c){Qg(b,a.node()),fj.select("."+f.selectedCircles+ld(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){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Ii(b)).darker(1)})}function Ee(a,b){Qg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ii(b)})}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?fj.selectAll("."+f.circles+ld(c)):fj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Vh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Sh)}function Ke(a){return fj.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=ah?1:0,f=ah?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 ah?(c=he(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.getBoundingClientRect();return ah?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return ah&&(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(jj=wf.select(zf),jj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(jj.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),Hg&&Lc(Hg===!0?Cc(xf.data.targets):Hg),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),kj=ig.domain(),$i.scale(lg),Ef&&cj.scale(ig),dj=jj.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),ej=dj.append("defs"),ej.append("clipPath").attr("id",ti).append("rect").attr("width",Pf).attr("height",Rf),ej.append("clipPath").attr("id",ui).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),ej.append("clipPath").attr("id",vi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),fj=dj.append("g").attr("transform",Ri.main),gj=dj.append("g").attr("transform",Ri.context),hj=dj.append("g").attr("transform",Ri.legend),Tg||gj.style("visibility","hidden"),Wg||(hj.style("visibility","hidden"),Mi=Cc(xf.data.targets)),ij=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),bh&&fj.append("g").attr("class",f.axisX).attr("clip-path",xi).attr("transform",Ri.x).append("text").attr("class",f.axisXLabel).attr("transform",ah?"rotate(-90)":"").style("text-anchor",zb),th&&fj.append("g").attr("class",f.axisY).attr("clip-path",yi).attr("transform",Ri.y).append("text").attr("class",f.axisYLabel).attr("transform",ah?"":"rotate(-90)").style("text-anchor",Ab),Ch&&fj.append("g").attr("class",f.axisY2).attr("transform",Ri.y2).append("text").attr("class",f.axisY2Label).attr("transform",ah?"":"rotate(-90)").style("text-anchor",Bb),d=fj.append("g").attr("clip-path",wi).attr("class",f.grid),Lh&&d.append("g").attr("class",f.xgrids),we(Nh)&&d.append("g").attr("class",f.xgridLines),Th&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Oh&&d.append("g").attr("class",f.ygrids),we(Ph)&&d.append("g").attr("class",f.ygridLines),fj.append("g").attr("clip-path",wi).attr("class",f.regions),fj.append("g").attr("clip-path",wi).attr("class",f.chart),c=fj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?ah?"ns-resize":"ew-resize":null),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Ri.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),fj.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&fj.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",ah?"ns-resize":"ew-resize").call(cj).on("dblclick.zoom",null),rh&&$i.extent("function"!=typeof rh?rh:rh(_b())),gj.append("g").attr("clip-path",wi).attr("class",f.chart),gj.select("."+f.chart).append("g").attr("class",f.chartBars),gj.select("."+f.chart).append("g").attr("class",f.chartLines),gj.append("g").attr("clip-path",wi).attr("class",f.brush).call($i).selectAll("rect").attr(ah?"width":"height",ah?Qf:Sf),gj.append("g").attr("class",f.axisX).attr("transform",Ri.subx).attr("clip-path",ah?"":xi),ef(xf.data.targets),ah?fj.select("."+f.axisX).style("opacity",0).call(og):(fj.select("."+f.axisY).style("opacity",0).call(pg),fj.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),qi){if(zi&&"string"==typeof ri){for(ri=re(ri),e=0;e0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(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){ee(xf.data.targets)||Ig&&(Ci=a,fj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Di=!0,Rg())}function Ze(){ee(xf.data.targets)||Ig&&(fj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),fj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Di=!1,Sg())}function $e(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=fj.select("."+f.axisX).style("opacity",W?0:1),g=fj.select("."+f.axisY).style("opacity",W?0:1),h=fj.select("."+f.axisY2).style("opacity",W?0:1),e=gj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Wg&&rf(Cc(xf.data.targets),a,O),Ai&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),kj=ig.domain(),Ef&&cj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),$i.scale(lg)),G&&(ig.domain($i.empty()?kj:$i.extent()),Ef&&cj.scale(ig).updateScaleExtent()),lh||!kh&&!jh||(S=Kc(Jc(X),jh),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(hh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!ah&&mh&&eb(c,O.axisX,mh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),ij.style("display","none"),o(),fj.select("line."+f.xgridFocus).style("visibility","hidden"),Lh){if("year"===Mh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=fj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",ah?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",ah?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",ah?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",ah?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(ah?"y1":"x1")===(ah?Rf:0)?0:1}),i.exit().remove()}we(Nh)&&(k=fj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Nh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",ah?"":"rotate(-90)").attr("dx",ah?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",ah?0:Dd).attr("x2",ah?Pf:Dd).attr("y1",ah?Dd:Mf.top).attr("y2",ah?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",ah?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Oh&&(m=fj.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Qh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",ah?jg:0).attr("x2",ah?jg:Pf).attr("y1",ah?0:jg).attr("y2",ah?Rf:jg),m.exit().remove()),A&&we(Ph)&&(n=fj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Ph),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",ah?"rotate(-90)":"").attr("dx",ah?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",ah?Ed:0).attr("x2",ah?Ed:Pf).attr("y1",ah?0:Ed).attr("y2",ah?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",ah?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=fj.select("."+f.regions).selectAll("rect."+f.region).data(li),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Ii(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=fj.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return ah?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",_i).style("opacity",1),fj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",aj).style("opacity",lj),q=fj.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Sh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud),q.exit().remove(),fj.each(function(){Gi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Gi=!1}),fj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),fj.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Tg&&(null!==wf.event&&"zoom"===wf.event.type&&$i.extent(ig.orgDomain()).update(),B&&(!ah&&mh&&eb(e,O.axisSubX,mh),$i.empty()||$i.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=gj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Ii(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),gj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",bj).style("opacity",1))),fj.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),fj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud),v=fj.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=fj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Bi&&!Ai?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),fj.select("."+f.eventRects).datum(x?x.values:[]),w=fj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",ah?0:y).attr("y",ah?y:0).attr("width",ah?Pf:z).attr("height",ah?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){mj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&cj.altDomain?(ig.domain(cj.altDomain),void cj.scale(ig).updateScaleExtent()):(Ai&&ig.orgDomain()[0]===kj[0]&&ig.domain([kj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Ei=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){dj.attr("width",Tf).attr("height",Uf),dj.select("#"+ti).select("rect").attr("width",Pf).attr("height",Rf),dj.select("#"+ui).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.select("#"+vi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),dj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),jj.style("max-height",Uf+"px")}function df(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=fj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Ii(a)}),e=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Kg(a)?"pointer":null}),c=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ii(a)}),b.append("path").attr("class",dd).style("opacity",function(){return lj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Ii(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Ii(a)}).style("cursor",function(a){return Kg(a)?"pointer":null}),a.forEach(function(a){fj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=fj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Ii(a.data)}).style("cursor",function(a){return Kg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Gi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Gi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Tg&&(n=gj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Ii(a)}),l=gj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ii(a)})),dj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(750).style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Si?j:i,l=Si?Q():P();return d&&(x=0,D=0,u=0,v=0),Wg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Si?v:u,void(_g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Si?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=hj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Yg?Yg(a):xf.toggle(a)}).on("mouseover",function(a){Gi||xf.focus(a),"function"==typeof Zg&&Zg(a)}).on("mouseout",function(a){Gi||xf.revert(),"function"==typeof $g&&$g(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Si?h:-200).attr("y",Si?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Si?i:-200).attr("y",Si?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Ii(a)}).attr("x",Si?h:-200).attr("y",Si?-200:j).attr("width",10).attr("height",10),hj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),hj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),hj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),hj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){return Gc(a)?1:Wi}),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Gi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"]),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","hide"],!1),Ig=h(["data","selection","enabled"],!1),Jg=h(["data","selection","grouped"],!1),Kg=h(["data","selection","isselectable"],function(){return!0}),Lg=h(["data","selection","multiple"],!0),Mg=h(["data","onclick"],function(){}),Ng=h(["data","onenter"],function(){}),Og=h(["data","onleave"],function(){}),Pg=h(["data","onselected"],function(){}),Qg=h(["data","onunselected"],function(){}),Rg=h(["data","ondragstart"],function(){}),Sg=h(["data","ondragend"],function(){}),Tg=h(["subchart","show"],!1),Ug=h(["subchart","size","height"],60),Vg=h(["color","pattern"],[]),Wg=h(["legend","show"],!0),Xg=h(["legend","position"],"bottom"),Yg=h(["legend","item","onclick"]),Zg=h(["legend","item","onmouseover"]),$g=h(["legend","item","onmouseout"]),_g=h(["legend","equally"],!1),ah=h(["axis","rotated"],!1),bh=h(["axis","x","show"],!0),ch=h(["axis","x","type"],"indexed"),dh=h(["axis","x","localtime"],!0),eh=h(["axis","x","categories"],[]),fh=h(["axis","x","tick","centered"],!1),gh=h(["axis","x","tick","format"]),hh=h(["axis","x","tick","culling"],{}),ih=h(["axis","x","tick","culling","max"],10),jh=h(["axis","x","tick","count"]),kh=h(["axis","x","tick","fit"],!0),lh=h(["axis","x","tick","values"],null),mh=h(["axis","x","tick","rotate"]),nh=h(["axis","x","max"],null),oh=h(["axis","x","min"],null),ph=h(["axis","x","padding"],{}),qh=h(["axis","x","height"]),rh=h(["axis","x","default"]),sh=h(["axis","x","label"],{}),th=h(["axis","y","show"],!0),uh=h(["axis","y","max"]),vh=h(["axis","y","min"]),wh=h(["axis","y","center"]),xh=h(["axis","y","label"],{}),yh=h(["axis","y","inner"],!1),zh=h(["axis","y","tick","format"]),Ah=h(["axis","y","padding"],{}),Bh=h(["axis","y","ticks"],10),Ch=h(["axis","y2","show"],!1),Dh=h(["axis","y2","max"]),Eh=h(["axis","y2","min"]),Fh=h(["axis","y2","center"]),Gh=h(["axis","y2","label"],{}),Hh=h(["axis","y2","inner"],!1),Ih=h(["axis","y2","tick","format"]),Jh=h(["axis","y2","padding"],{}),Kh=h(["axis","y2","ticks"],10),Lh=h(["grid","x","show"],!1),Mh=h(["grid","x","type"],"tick"),Nh=h(["grid","x","lines"],[]),Oh=h(["grid","y","show"],!1),Ph=h(["grid","y","lines"],[]),Qh=h(["grid","y","ticks"],10),Rh=h(["point","show"],!0),Sh=Rh?h(["point","r"],2.5):0,Th=h(["point","focus","line","enabled"],!0),Uh=h(["point","focus","expand","enabled"],!0),Vh=h(["point","focus","expand","r"],Uh?4:Sh),Wh=h(["point","focus","select","r"],8),Xh=h(["line","connect_null"],!1),Yh=h(["bar","width"]),Zh=h(["bar","width","ratio"],.6),$h=h(["pie","label","show"],!0),_h=h(["pie","label","format"]),ai=h(["pie","expand"],!0),bi=h(["pie","onclick"],function(){}),ci=h(["pie","onmouseover"],function(){}),di=h(["pie","onmouseout"],function(){}),ei=h(["donut","label","show"],!0),fi=h(["donut","label","format"]),gi=h(["donut","expand"],!0),hi=h(["donut","title"],""),ii=h(["donut","onclick"],function(){}),ji=h(["donut","onmouseover"],function(){}),ki=h(["donut","onmouseout"],function(){}),li=h(["regions"],[]),mi=h(["tooltip","show"],!0),ni=h(["tooltip","format","title"]),oi=h(["tooltip","format","value"]),pi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ni?ni:b,l=oi?oi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),qi=h(["tooltip","init","show"],!1),ri=h(["tooltip","init","x"],0),si=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ti=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ui=ti+"-xaxis",vi=ti+"-yaxis",wi=i(ti),xi=i(ui),yi=i(vi),zi="timeseries"===ch,Ai="categorized"===ch,Bi=!zi&&(sg||we(tg)),Ci=null,Di=!1,Ei=!1,Fi=!1,Gi=!1,Hi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ii=qe(Gg,we(Vg)?Vg:Hi,Fg),Ji=dh?wf.time.format:wf.time.format.utc,Ki=function(){var a=[[Ji("%Y/%-m/%-d"),function(){return!0}],[Ji("%-m/%-d"),function(a){return a.getMonth()}],[Ji("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ji("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ji("%I %p"),function(a){return a.getHours()}],[Ji("%I:%M"),function(a){return a.getMinutes()}],[Ji(":%S"),function(a){return a.getSeconds()}],[Ji(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),Li=[],Mi=[],Ni=ah?"left":"bottom",Oi=ah?yh?"top":"bottom":yh?"right":"left",Pi=ah?Hh?"bottom":"top":Hh?"left":"right",Qi=ah?"left":"bottom",Ri={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(ah?0:Rf)+")"},y:function(){return"translate(0,"+(ah?Rf:0)+")"},y2:function(){return"translate("+(ah?0:Pf)+","+(ah?1:0)+")"},subx:function(){return"translate(0,"+(ah?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Si="right"===Xg,Ti=0,Ui=0,Vi=0,Wi=.15,Xi=30,Yi=ah&&!bh?0:30,Zi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var $i,_i=function(){var a=wf.svg.line().x(ah?function(a){return V(a.id)(a.value)}:Cd).y(ah?Cd:function(a){return V(a.id)(a.value)});return Xh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Xh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ah?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a;return a=ah?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ah?"M "+d+" "+c:"M "+c+" "+d)}}(),bj=function(){var a=wf.svg.line().x(ah?function(a){return W(a.id)(a.value)}:Fd).y(ah?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),cj=function(){};$i=wf.svg.brush().on("brush",_e),$i.update=function(){return gj&&gj.select("."+f.brush).call(this),this},$i.scale=function(a){return ah?this.y(a):this.x(a)},Ef&&(cj=wf.behavior.zoom().on("zoomstart",function(){cj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),cj.scale=function(a){return ah?this.y(a):this.x(a)},cj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},cj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(kj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var dj,ej,fj,gj,hj,ij,jj,kj,lj,mj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),dj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&pf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),xf.revert()},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),dj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&qf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),xf.revert()},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){$i.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&Ai&&(eh=a.categories,og.categories(eh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(fj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Ig&&fj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Jg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Kg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Ig&&fj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Jg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Kg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0}) +},xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Nh=a,$e(),Nh):Nh},xf.xgrids.add=function(a){return a?xf.xgrids(Nh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a);return xf.xgrids(Nh.filter(b))},xf.ygrids=function(a){return a?(Ph=a,$e(),Ph):Ph},xf.ygrids.add=function(a){return a?xf.ygrids(Ph.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Ph.filter(b))},xf.regions=function(a){return c(a)?li:(li=a,$e(),li)},xf.regions.add=function(a){return c(a)?li:(li=li.concat(a),$e(),li)},xf.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;dj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),li=li.filter(function(b){return b.classes.indexOf(a)<0})}),li},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(vh=+a.y),b(a.y2)&&(Eh=+a.y2)):vh=Eh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0})},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},jj.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From a81982f27d536f2c9266391392cdb52dbe8770f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Go=CC=88bel?= Date: Wed, 30 Apr 2014 08:50:05 +0200 Subject: [PATCH 092/178] added 'index' to tooltip:format:value arguments --- c3.js | 2 +- c3.min.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/c3.js b/c3.js index c1838de..e6bb3e0 100644 --- a/c3.js +++ b/c3.js @@ -264,7 +264,7 @@ } name = d[i].name; - value = valueFormat(d[i].value, d[i].ratio, d[i].id); + value = valueFormat(d[i].value, d[i].ratio, d[i].id, d[i].index); text += ""; text += "" + name + ""; diff --git a/c3.min.js b/c3.min.js index 099413e..7f00d5b 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.33"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cPf&&(Pf=0),0>Rf&&(Rf=0),Qf=_g?Mf.left-Wi-Xi:Pf,Sf=_g?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Ri&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){ej.select("line."+f.xgridFocus).attr("x1",_g?0:-10).attr("x2",_g?Pf:-10).attr("y1",_g?-10:Mf.top).attr("y2",_g?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=_g?f.axisX:f.axisY,b=ej.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:_g?ah?v("x"):1:!sh||xh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Ri?P()+(Bh&&!_g?v("y2"):a):Bh?Gh||_g?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||ah?"x"===a&&ph?ph:"y"!==a||sh?"y2"!==a||Bh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Yi:Vg&&!Ri?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!_g)}function C(){return A(!_g)}function D(){return z(_g)}function E(){return A(_g)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(ph?ph:0)+80:Rf+8}function H(){return F(!_g)}function I(){return G(!_g)}function J(){return F(_g)}function K(){return G(_g)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(zi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Si=a}function N(a){Ti=a}function O(a){Ui=a}function P(){return Vg?Ri?Ti*(Si+1):Tf:0}function Q(){return Vg?Ri?Uf:Ui*(Si+1):0}function R(){var a,b,c=!ig;ag=_g?1:0,bg=_g?Rf:Pf,cg=_g?0:Rf,dg=_g?Pf:1,eg=ag,fg=bg,gg=_g?0:Sf,hg=_g?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,jj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=kh?kh:c?void 0:og.tickValues(),og=X(ig,Mi,a,b),rg=X(lg,Pi,a,b),pg=Y(jg,Ni,yh,Ah),qg=Y(kg,Oi,Hh,Jh),c||(Zi.scale(lg),Ef&&bj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(yi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),zi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(zi?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),zi?(e.tickCentered(eh),ve(gh)&&(gh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},zi&&e.categories(dh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=yi?Ji:zi?Tc:function(a){return 0>a?a.toFixed(0):a};return fh&&("function"==typeof fh?a=fh:yi&&(a=function(a){return a?Ii(fh)(a):""})),a}function _(a){var b;return"y"===a?b=wh:"y2"===a?b=Fh:"x"===a&&(b=rh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?wh=b:"y2"===a?Fh=b:"x"===a&&(rh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",_g?"inner-top":"inner-right")}function hb(){return fb("y",_g?"inner-right":"inner-top")}function ib(){return fb("y2",_g?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!_g,gb())}function rb(){return nb(_g,hb())}function sb(){return nb(_g,ib())}function tb(){return ob(!_g,gb())}function ub(){return ob(_g,hb())}function vb(){return ob(_g,ib())}function wb(){var a=gb();return _g?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":ph?ph-10:"3em"}function xb(){var a=hb();return _g?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return _g?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!_g,gb())}function Ab(){return pb(_g,hb())}function Bb(){return pb(_g,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){ej.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),ej.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),ej.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.length>0)for(g=Sc(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 wf.max(Object.keys(i).map(function(a){return wf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Dh:uh,n="y2"===c?Ch:th,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Eh:vh,r=ud()&&_g;return 0===l.length?"y2"===c?kg.domain():jg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(jg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&zh&&(f=b(zh.top)?zh.top:e,g=b(zh.bottom)?zh.bottom:e),"y2"===c&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return nh?yi?re(nh):nh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return mh?yi?re(mh):mh:wf.max(a,function(a){return wf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return zi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof oh&&we(oh)?(e=b(oh.left)?oh.left:d,f=b(oh.right)?oh.right:d):e=f="number"==typeof oh?oh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=yi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=yi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?jg:kg;return b="y"===a.axis||"y2"===a.axis?_g?Rf:"start"in a?d(a.start):Rf:_g?"end"in a?ig(yi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),xf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=yi?a?a instanceof Date?a:re(a):re(mc(c,d)):Ai&&!zi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ai&&zi&&0===c&&g&&(0===e&&(dh=[]),dh.push(g)),("undefined"==typeof a[b]||xf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&xf.data.targets[0].values[a-1]?xf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(xf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(yi?new Date(i):i);j.push(e)}return yi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Ki=Ki.concat(a)}function Mc(a){Ki=Ki.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Li=Li.concat(a)}function Oc(a){Li=Li.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&li&&(hj.html(oi(a,$(),wd(k),Hi)).style("display","block"),d=hj.property("offsetWidth"),e=hj.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(_g?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),hj.style("top",i+"px").style("left",g+"px"))}function Qd(){hj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});li&&(be(xf.data.targets)||ee(xf.data.targets)||ej.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(_g?"y1":"x1",Cd).attr(_g?"y2":"x2",Cd))}function Sd(){ej.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return Xh?Xh:b?2*a.tickOffset()*Yh/b:0}function $d(a,b){Dc(a).forEach(function(a){lj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&fi||je(a)&&_h}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=_g?1:0,e=_g?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Og(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud).attr("stroke",function(){return Hi(b)}).attr("r",1.4*Vh).transition().duration(100).attr("r",Vh)}function Be(a,b,c){Pg(b,a.node()),ej.select("."+f.selectedCircles+ld(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){Og(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Hi(b)).darker(1)})}function Ee(a,b){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return Hi(b)})}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?ej.selectAll("."+f.circles+ld(c)):ej).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Uh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Rh)}function Ke(a){return ej.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=_g?1:0,f=_g?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 _g?(c=he(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.getBoundingClientRect();return _g?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return _g&&(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(ij=wf.select(zf),ij.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ij.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),jj=ig.domain(),Zi.scale(lg),Ef&&bj.scale(ig),cj=ij.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),dj=cj.append("defs"),dj.append("clipPath").attr("id",si).append("rect").attr("width",Pf).attr("height",Rf),dj.append("clipPath").attr("id",ti).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.append("clipPath").attr("id",ui).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej=cj.append("g").attr("transform",Qi.main),fj=cj.append("g").attr("transform",Qi.context),gj=cj.append("g").attr("transform",Qi.legend),Sg||fj.style("visibility","hidden"),Vg||(gj.style("visibility","hidden"),Li=Cc(xf.data.targets)),hj=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),ah&&ej.append("g").attr("class",f.axisX).attr("clip-path",wi).attr("transform",Qi.x).append("text").attr("class",f.axisXLabel).attr("transform",_g?"rotate(-90)":"").style("text-anchor",zb),sh&&ej.append("g").attr("class",f.axisY).attr("clip-path",xi).attr("transform",Qi.y).append("text").attr("class",f.axisYLabel).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Ab),Bh&&ej.append("g").attr("class",f.axisY2).attr("transform",Qi.y2).append("text").attr("class",f.axisY2Label).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Bb),d=ej.append("g").attr("clip-path",vi).attr("class",f.grid),Kh&&d.append("g").attr("class",f.xgrids),we(Mh)&&d.append("g").attr("class",f.xgridLines),Sh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Nh&&d.append("g").attr("class",f.ygrids),we(Oh)&&d.append("g").attr("class",f.ygridLines),ej.append("g").attr("clip-path",vi).attr("class",f.regions),ej.append("g").attr("clip-path",vi).attr("class",f.chart),c=ej.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?_g?"ns-resize":"ew-resize":null),ej.select("."+f.chart).append("g").attr("class",f.chartBars),ej.select("."+f.chart).append("g").attr("class",f.chartLines),ej.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Qi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),ej.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&ej.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",_g?"ns-resize":"ew-resize").call(bj).on("dblclick.zoom",null),qh&&Zi.extent("function"!=typeof qh?qh:qh(_b())),fj.append("g").attr("clip-path",vi).attr("class",f.chart),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.append("g").attr("clip-path",vi).attr("class",f.brush).call(Zi).selectAll("rect").attr(_g?"width":"height",_g?Qf:Sf),fj.append("g").attr("class",f.axisX).attr("transform",Qi.subx).attr("clip-path",_g?"":wi),ef(xf.data.targets),_g?ej.select("."+f.axisX).style("opacity",0).call(og):(ej.select("."+f.axisY).style("opacity",0).call(pg),ej.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),pi){if(yi&&"string"==typeof qi){for(qi=re(qi),e=0;e0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(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){ee(xf.data.targets)||Hg&&(Bi=a,ej.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ci=!0,Qg())}function Ze(){ee(xf.data.targets)||Hg&&(ej.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),ej.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ci=!1,Rg())}function $e(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=ej.select("."+f.axisX).style("opacity",W?0:1),g=ej.select("."+f.axisY).style("opacity",W?0:1),h=ej.select("."+f.axisY2).style("opacity",W?0:1),e=fj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Vg&&rf(Cc(xf.data.targets),a,O),zi&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),jj=ig.domain(),Ef&&bj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),Zi.scale(lg)),G&&(ig.domain(Zi.empty()?jj:Zi.extent()),Ef&&bj.scale(ig).updateScaleExtent()),kh||!jh&&!ih||(S=Kc(Jc(X),ih),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(gh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!_g&&lh&&eb(c,O.axisX,lh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),hj.style("display","none"),o(),ej.select("line."+f.xgridFocus).style("visibility","hidden"),Kh){if("year"===Lh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=ej.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",_g?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",_g?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",_g?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",_g?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(_g?"y1":"x1")===(_g?Rf:0)?0:1}),i.exit().remove()}we(Mh)&&(k=ej.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Mh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",_g?"":"rotate(-90)").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",_g?0:Dd).attr("x2",_g?Pf:Dd).attr("y1",_g?Dd:Mf.top).attr("y2",_g?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",_g?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Nh&&(m=ej.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Ph)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",_g?jg:0).attr("x2",_g?jg:Pf).attr("y1",_g?0:jg).attr("y2",_g?Rf:jg),m.exit().remove()),A&&we(Oh)&&(n=ej.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Oh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",_g?"rotate(-90)":"").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",_g?Ed:0).attr("x2",_g?Ed:Pf).attr("y1",_g?0:Ed).attr("y2",_g?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",_g?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=ej.select("."+f.regions).selectAll("rect."+f.region).data(ki),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=ej.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Hi(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=ej.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return _g?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),ej.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",$i).style("opacity",1),ej.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",_i).style("opacity",kj),q=ej.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Rh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),q.exit().remove(),ej.each(function(){Fi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Fi=!1}),ej.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),ej.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Sg&&(null!==wf.event&&"zoom"===wf.event.type&&Zi.extent(ig.orgDomain()).update(),B&&(!_g&&lh&&eb(e,O.axisSubX,lh),Zi.empty()||Zi.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Hi(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1))),ej.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),ej.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),v=ej.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ai&&!zi?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),ej.select("."+f.eventRects).datum(x?x.values:[]),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",_g?0:y).attr("y",_g?y:0).attr("width",_g?Pf:z).attr("height",_g?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){lj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&bj.altDomain?(ig.domain(bj.altDomain),void bj.scale(ig).updateScaleExtent()):(zi&&ig.orgDomain()[0]===jj[0]&&ig.domain([jj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Di=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){cj.attr("width",Tf).attr("height",Uf),cj.select("#"+si).select("rect").attr("width",Pf).attr("height",Rf),cj.select("#"+ti).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),cj.select("#"+ui).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),cj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),ij.style("max-height",Uf+"px")}function df(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=ej.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Hi(a)}),e=ej.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Jg(a)?"pointer":null}),c=ej.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)}),b.append("path").attr("class",dd).style("opacity",function(){return kj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Hi(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Hi(a)}).style("cursor",function(a){return Jg(a)?"pointer":null}),a.forEach(function(a){ej.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=ej.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Hi(a.data)}).style("cursor",function(a){return Jg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Sg&&(n=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Hi(a)}),l=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)})),cj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Ri?j:i,l=Ri?Q():P();return d&&(x=0,D=0,u=0,v=0),Vg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Ri?v:u,void($g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Ri?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=gj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Xg?Xg(a):xf.toggle(a)}).on("mouseover",function(a){Fi||xf.focus(a),"function"==typeof Yg&&Yg(a)}).on("mouseout",function(a){Fi||xf.revert(),"function"==typeof Zg&&Zg(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ri?h:-200).attr("y",Ri?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ri?i:-200).attr("y",Ri?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Hi(a)}).attr("x",Ri?h:-200).attr("y",Ri?-200:j).attr("width",10).attr("height",10),gj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),gj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),gj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Fi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"]),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","selection","enabled"],!1),Ig=h(["data","selection","grouped"],!1),Jg=h(["data","selection","isselectable"],function(){return!0}),Kg=h(["data","selection","multiple"],!0),Lg=h(["data","onclick"],function(){}),Mg=h(["data","onenter"],function(){}),Ng=h(["data","onleave"],function(){}),Og=h(["data","onselected"],function(){}),Pg=h(["data","onunselected"],function(){}),Qg=h(["data","ondragstart"],function(){}),Rg=h(["data","ondragend"],function(){}),Sg=h(["subchart","show"],!1),Tg=h(["subchart","size","height"],60),Ug=h(["color","pattern"],[]),Vg=h(["legend","show"],!0),Wg=h(["legend","position"],"bottom"),Xg=h(["legend","item","onclick"]),Yg=h(["legend","item","onmouseover"]),Zg=h(["legend","item","onmouseout"]),$g=h(["legend","equally"],!1),_g=h(["axis","rotated"],!1),ah=h(["axis","x","show"],!0),bh=h(["axis","x","type"],"indexed"),ch=h(["axis","x","localtime"],!0),dh=h(["axis","x","categories"],[]),eh=h(["axis","x","tick","centered"],!1),fh=h(["axis","x","tick","format"]),gh=h(["axis","x","tick","culling"],{}),hh=h(["axis","x","tick","culling","max"],10),ih=h(["axis","x","tick","count"]),jh=h(["axis","x","tick","fit"],!0),kh=h(["axis","x","tick","values"],null),lh=h(["axis","x","tick","rotate"]),mh=h(["axis","x","max"],null),nh=h(["axis","x","min"],null),oh=h(["axis","x","padding"],{}),ph=h(["axis","x","height"]),qh=h(["axis","x","default"]),rh=h(["axis","x","label"],{}),sh=h(["axis","y","show"],!0),th=h(["axis","y","max"]),uh=h(["axis","y","min"]),vh=h(["axis","y","center"]),wh=h(["axis","y","label"],{}),xh=h(["axis","y","inner"],!1),yh=h(["axis","y","tick","format"]),zh=h(["axis","y","padding"],{}),Ah=h(["axis","y","ticks"],10),Bh=h(["axis","y2","show"],!1),Ch=h(["axis","y2","max"]),Dh=h(["axis","y2","min"]),Eh=h(["axis","y2","center"]),Fh=h(["axis","y2","label"],{}),Gh=h(["axis","y2","inner"],!1),Hh=h(["axis","y2","tick","format"]),Ih=h(["axis","y2","padding"],{}),Jh=h(["axis","y2","ticks"],10),Kh=h(["grid","x","show"],!1),Lh=h(["grid","x","type"],"tick"),Mh=h(["grid","x","lines"],[]),Nh=h(["grid","y","show"],!1),Oh=h(["grid","y","lines"],[]),Ph=h(["grid","y","ticks"],10),Qh=h(["point","show"],!0),Rh=Qh?h(["point","r"],2.5):0,Sh=h(["point","focus","line","enabled"],!0),Th=h(["point","focus","expand","enabled"],!0),Uh=h(["point","focus","expand","r"],Th?4:Rh),Vh=h(["point","focus","select","r"],8),Wh=h(["line","connect_null"],!1),Xh=h(["bar","width"]),Yh=h(["bar","width","ratio"],.6),Zh=h(["pie","label","show"],!0),$h=h(["pie","label","format"]),_h=h(["pie","expand"],!0),ai=h(["pie","onclick"],function(){}),bi=h(["pie","onmouseover"],function(){}),ci=h(["pie","onmouseout"],function(){}),di=h(["donut","label","show"],!0),ei=h(["donut","label","format"]),fi=h(["donut","expand"],!0),gi=h(["donut","title"],""),hi=h(["donut","onclick"],function(){}),ii=h(["donut","onmouseover"],function(){}),ji=h(["donut","onmouseout"],function(){}),ki=h(["regions"],[]),li=h(["tooltip","show"],!0),mi=h(["tooltip","format","title"]),ni=h(["tooltip","format","value"]),oi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=mi?mi:b,l=ni?ni:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),pi=h(["tooltip","init","show"],!1),qi=h(["tooltip","init","x"],0),ri=h(["tooltip","init","position"],{top:"0px",left:"50px"}),si=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ti=si+"-xaxis",ui=si+"-yaxis",vi=i(si),wi=i(ti),xi=i(ui),yi="timeseries"===bh,zi="categorized"===bh,Ai=!yi&&(sg||we(tg)),Bi=null,Ci=!1,Di=!1,Ei=!1,Fi=!1,Gi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Hi=qe(Gg,we(Ug)?Ug:Gi,Fg),Ii=ch?wf.time.format:wf.time.format.utc,Ji=function(){var a=[[Ii("%Y/%-m/%-d"),function(){return!0}],[Ii("%-m/%-d"),function(a){return a.getMonth()}],[Ii("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ii("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ii("%I %p"),function(a){return a.getHours()}],[Ii("%I:%M"),function(a){return a.getMinutes()}],[Ii(":%S"),function(a){return a.getSeconds()}],[Ii(".%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)}}(),Ki=[],Li=[],Mi=_g?"left":"bottom",Ni=_g?xh?"top":"bottom":xh?"right":"left",Oi=_g?Gh?"bottom":"top":Gh?"left":"right",Pi=_g?"left":"bottom",Qi={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(_g?0:Rf)+")"},y:function(){return"translate(0,"+(_g?Rf:0)+")"},y2:function(){return"translate("+(_g?0:Pf)+","+(_g?1:0)+")"},subx:function(){return"translate(0,"+(_g?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Ri="right"===Wg,Si=0,Ti=0,Ui=0,Vi=.15,Wi=30,Xi=_g&&!ah?0:30,Yi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Zi,$i=function(){var a=wf.svg.line().x(_g?function(a){return V(a.id)(a.value)}:Cd).y(_g?Cd:function(a){return V(a.id)(a.value)});return Wh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Wh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),_i=function(){var a;return a=_g?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a=wf.svg.line().x(_g?function(a){return W(a.id)(a.value)}:Fd).y(_g?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),bj=function(){};Zi=wf.svg.brush().on("brush",_e),Zi.update=function(){return fj&&fj.select("."+f.brush).call(this),this},Zi.scale=function(a){return _g?this.y(a):this.x(a)},Ef&&(bj=wf.behavior.zoom().on("zoomstart",function(){bj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),bj.scale=function(a){return _g?this.y(a):this.x(a)},bj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},bj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(jj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var cj,dj,ej,fj,gj,hj,ij,jj,kj,lj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),cj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?pf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),cj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?qf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Vi),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){Zi.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&zi&&(dh=a.categories,og.categories(dh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(ej.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Ig||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Jg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Ig||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Jg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0})},xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Mh=a,$e(),Mh):Mh},xf.xgrids.add=function(a){return a?xf.xgrids(Mh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a); +!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.33"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cPf&&(Pf=0),0>Rf&&(Rf=0),Qf=_g?Mf.left-Wi-Xi:Pf,Sf=_g?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Ri&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){ej.select("line."+f.xgridFocus).attr("x1",_g?0:-10).attr("x2",_g?Pf:-10).attr("y1",_g?-10:Mf.top).attr("y2",_g?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=_g?f.axisX:f.axisY,b=ej.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:_g?ah?v("x"):1:!sh||xh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Ri?P()+(Bh&&!_g?v("y2"):a):Bh?Gh||_g?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||ah?"x"===a&&ph?ph:"y"!==a||sh?"y2"!==a||Bh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Yi:Vg&&!Ri?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!_g)}function C(){return A(!_g)}function D(){return z(_g)}function E(){return A(_g)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(ph?ph:0)+80:Rf+8}function H(){return F(!_g)}function I(){return G(!_g)}function J(){return F(_g)}function K(){return G(_g)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(zi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Si=a}function N(a){Ti=a}function O(a){Ui=a}function P(){return Vg?Ri?Ti*(Si+1):Tf:0}function Q(){return Vg?Ri?Uf:Ui*(Si+1):0}function R(){var a,b,c=!ig;ag=_g?1:0,bg=_g?Rf:Pf,cg=_g?0:Rf,dg=_g?Pf:1,eg=ag,fg=bg,gg=_g?0:Sf,hg=_g?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,jj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=kh?kh:c?void 0:og.tickValues(),og=X(ig,Mi,a,b),rg=X(lg,Pi,a,b),pg=Y(jg,Ni,yh,Ah),qg=Y(kg,Oi,Hh,Jh),c||(Zi.scale(lg),Ef&&bj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(yi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),zi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(zi?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),zi?(e.tickCentered(eh),ve(gh)&&(gh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},zi&&e.categories(dh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=yi?Ji:zi?Tc:function(a){return 0>a?a.toFixed(0):a};return fh&&("function"==typeof fh?a=fh:yi&&(a=function(a){return a?Ii(fh)(a):""})),a}function _(a){var b;return"y"===a?b=wh:"y2"===a?b=Fh:"x"===a&&(b=rh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?wh=b:"y2"===a?Fh=b:"x"===a&&(rh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",_g?"inner-top":"inner-right")}function hb(){return fb("y",_g?"inner-right":"inner-top")}function ib(){return fb("y2",_g?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!_g,gb())}function rb(){return nb(_g,hb())}function sb(){return nb(_g,ib())}function tb(){return ob(!_g,gb())}function ub(){return ob(_g,hb())}function vb(){return ob(_g,ib())}function wb(){var a=gb();return _g?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":ph?ph-10:"3em"}function xb(){var a=hb();return _g?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return _g?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!_g,gb())}function Ab(){return pb(_g,hb())}function Bb(){return pb(_g,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){ej.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),ej.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),ej.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.length>0)for(g=Sc(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 wf.max(Object.keys(i).map(function(a){return wf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Dh:uh,n="y2"===c?Ch:th,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Eh:vh,r=ud()&&_g;return 0===l.length?"y2"===c?kg.domain():jg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(jg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&zh&&(f=b(zh.top)?zh.top:e,g=b(zh.bottom)?zh.bottom:e),"y2"===c&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return nh?yi?re(nh):nh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return mh?yi?re(mh):mh:wf.max(a,function(a){return wf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return zi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof oh&&we(oh)?(e=b(oh.left)?oh.left:d,f=b(oh.right)?oh.right:d):e=f="number"==typeof oh?oh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=yi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=yi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?jg:kg;return b="y"===a.axis||"y2"===a.axis?_g?Rf:"start"in a?d(a.start):Rf:_g&&"end"in a?ig(yi?re(a.end):a.end):Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),xf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=yi?a?a instanceof Date?a:re(a):re(mc(c,d)):Ai&&!zi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ai&&zi&&0===c&&g&&(0===e&&(dh=[]),dh.push(g)),("undefined"==typeof a[b]||xf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&xf.data.targets[0].values[a-1]?xf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(xf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(yi?new Date(i):i);j.push(e)}return yi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Ki=Ki.concat(a)}function Mc(a){Ki=Ki.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Li=Li.concat(a)}function Oc(a){Li=Li.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&li&&(hj.html(oi(a,$(),wd(k),Hi)).style("display","block"),d=hj.property("offsetWidth"),e=hj.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(_g?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),hj.style("top",i+"px").style("left",g+"px"))}function Qd(){hj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});li&&(be(xf.data.targets)||ee(xf.data.targets)||ej.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(_g?"y1":"x1",Cd).attr(_g?"y2":"x2",Cd))}function Sd(){ej.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return Xh?Xh:b?2*a.tickOffset()*Yh/b:0}function $d(a,b){Dc(a).forEach(function(a){lj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&fi||je(a)&&_h}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=_g?1:0,e=_g?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Og(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud).attr("stroke",function(){return Hi(b)}).attr("r",1.4*Vh).transition().duration(100).attr("r",Vh)}function Be(a,b,c){Pg(b,a.node()),ej.select("."+f.selectedCircles+ld(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){Og(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Hi(b)).darker(1)})}function Ee(a,b){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return Hi(b)})}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?ej.selectAll("."+f.circles+ld(c)):ej).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Uh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Rh)}function Ke(a){return ej.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=_g?1:0,f=_g?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 _g?(c=he(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.getBoundingClientRect();return _g?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return _g&&(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(ij=wf.select(zf),ij.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ij.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),jj=ig.domain(),Zi.scale(lg),Ef&&bj.scale(ig),cj=ij.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),dj=cj.append("defs"),dj.append("clipPath").attr("id",si).append("rect").attr("width",Pf).attr("height",Rf),dj.append("clipPath").attr("id",ti).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.append("clipPath").attr("id",ui).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej=cj.append("g").attr("transform",Qi.main),fj=cj.append("g").attr("transform",Qi.context),gj=cj.append("g").attr("transform",Qi.legend),Sg||fj.style("visibility","hidden"),Vg||(gj.style("visibility","hidden"),Li=Cc(xf.data.targets)),hj=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),ah&&ej.append("g").attr("class",f.axisX).attr("clip-path",wi).attr("transform",Qi.x).append("text").attr("class",f.axisXLabel).attr("transform",_g?"rotate(-90)":"").style("text-anchor",zb),sh&&ej.append("g").attr("class",f.axisY).attr("clip-path",xi).attr("transform",Qi.y).append("text").attr("class",f.axisYLabel).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Ab),Bh&&ej.append("g").attr("class",f.axisY2).attr("transform",Qi.y2).append("text").attr("class",f.axisY2Label).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Bb),d=ej.append("g").attr("clip-path",vi).attr("class",f.grid),Kh&&d.append("g").attr("class",f.xgrids),we(Mh)&&d.append("g").attr("class",f.xgridLines),Sh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Nh&&d.append("g").attr("class",f.ygrids),we(Oh)&&d.append("g").attr("class",f.ygridLines),ej.append("g").attr("clip-path",vi).attr("class",f.regions),ej.append("g").attr("clip-path",vi).attr("class",f.chart),c=ej.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?_g?"ns-resize":"ew-resize":null),ej.select("."+f.chart).append("g").attr("class",f.chartBars),ej.select("."+f.chart).append("g").attr("class",f.chartLines),ej.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Qi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),ej.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&ej.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",_g?"ns-resize":"ew-resize").call(bj).on("dblclick.zoom",null),qh&&Zi.extent("function"!=typeof qh?qh:qh(_b())),fj.append("g").attr("clip-path",vi).attr("class",f.chart),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.append("g").attr("clip-path",vi).attr("class",f.brush).call(Zi).selectAll("rect").attr(_g?"width":"height",_g?Qf:Sf),fj.append("g").attr("class",f.axisX).attr("transform",Qi.subx).attr("clip-path",_g?"":wi),ef(xf.data.targets),_g?ej.select("."+f.axisX).style("opacity",0).call(og):(ej.select("."+f.axisY).style("opacity",0).call(pg),ej.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),pi){if(yi&&"string"==typeof qi){for(qi=re(qi),e=0;e0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(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){ee(xf.data.targets)||Hg&&(Bi=a,ej.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ci=!0,Qg())}function Ze(){ee(xf.data.targets)||Hg&&(ej.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),ej.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ci=!1,Rg())}function $e(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=ej.select("."+f.axisX).style("opacity",W?0:1),g=ej.select("."+f.axisY).style("opacity",W?0:1),h=ej.select("."+f.axisY2).style("opacity",W?0:1),e=fj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Vg&&rf(Cc(xf.data.targets),a,O),zi&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),jj=ig.domain(),Ef&&bj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),Zi.scale(lg)),G&&(ig.domain(Zi.empty()?jj:Zi.extent()),Ef&&bj.scale(ig).updateScaleExtent()),kh||!jh&&!ih||(S=Kc(Jc(X),ih),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(gh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!_g&&lh&&eb(c,O.axisX,lh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),hj.style("display","none"),o(),ej.select("line."+f.xgridFocus).style("visibility","hidden"),Kh){if("year"===Lh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=ej.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",_g?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",_g?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",_g?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",_g?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(_g?"y1":"x1")===(_g?Rf:0)?0:1}),i.exit().remove()}we(Mh)&&(k=ej.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Mh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",_g?"":"rotate(-90)").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",_g?0:Dd).attr("x2",_g?Pf:Dd).attr("y1",_g?Dd:Mf.top).attr("y2",_g?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",_g?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Nh&&(m=ej.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Ph)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",_g?jg:0).attr("x2",_g?jg:Pf).attr("y1",_g?0:jg).attr("y2",_g?Rf:jg),m.exit().remove()),A&&we(Oh)&&(n=ej.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Oh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",_g?"rotate(-90)":"").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",_g?Ed:0).attr("x2",_g?Ed:Pf).attr("y1",_g?0:Ed).attr("y2",_g?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",_g?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=ej.select("."+f.regions).selectAll("rect."+f.region).data(ki),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=ej.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Hi(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=ej.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return _g?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),ej.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",$i).style("opacity",1),ej.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",_i).style("opacity",kj),q=ej.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Rh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),q.exit().remove(),ej.each(function(){Fi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Fi=!1}),ej.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),ej.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Sg&&(null!==wf.event&&"zoom"===wf.event.type&&Zi.extent(ig.orgDomain()).update(),B&&(!_g&&lh&&eb(e,O.axisSubX,lh),Zi.empty()||Zi.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Hi(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1))),ej.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),ej.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),v=ej.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ai&&!zi?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),ej.select("."+f.eventRects).datum(x?x.values:[]),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",_g?0:y).attr("y",_g?y:0).attr("width",_g?Pf:z).attr("height",_g?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){lj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&bj.altDomain?(ig.domain(bj.altDomain),void bj.scale(ig).updateScaleExtent()):(zi&&ig.orgDomain()[0]===jj[0]&&ig.domain([jj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Di=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){cj.attr("width",Tf).attr("height",Uf),cj.select("#"+si).select("rect").attr("width",Pf).attr("height",Rf),cj.select("#"+ti).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),cj.select("#"+ui).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),cj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),ij.style("max-height",Uf+"px")}function df(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=ej.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Hi(a)}),e=ej.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Jg(a)?"pointer":null}),c=ej.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)}),b.append("path").attr("class",dd).style("opacity",function(){return kj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Hi(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Hi(a)}).style("cursor",function(a){return Jg(a)?"pointer":null}),a.forEach(function(a){ej.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=ej.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Hi(a.data)}).style("cursor",function(a){return Jg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Sg&&(n=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Hi(a)}),l=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)})),cj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Ri?j:i,l=Ri?Q():P();return d&&(x=0,D=0,u=0,v=0),Vg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Ri?v:u,void($g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Ri?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=gj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Xg?Xg(a):xf.toggle(a)}).on("mouseover",function(a){Fi||xf.focus(a),"function"==typeof Yg&&Yg(a)}).on("mouseout",function(a){Fi||xf.revert(),"function"==typeof Zg&&Zg(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ri?h:-200).attr("y",Ri?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ri?i:-200).attr("y",Ri?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Hi(a)}).attr("x",Ri?h:-200).attr("y",Ri?-200:j).attr("width",10).attr("height",10),gj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),gj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),gj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Fi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"]),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","selection","enabled"],!1),Ig=h(["data","selection","grouped"],!1),Jg=h(["data","selection","isselectable"],function(){return!0}),Kg=h(["data","selection","multiple"],!0),Lg=h(["data","onclick"],function(){}),Mg=h(["data","onenter"],function(){}),Ng=h(["data","onleave"],function(){}),Og=h(["data","onselected"],function(){}),Pg=h(["data","onunselected"],function(){}),Qg=h(["data","ondragstart"],function(){}),Rg=h(["data","ondragend"],function(){}),Sg=h(["subchart","show"],!1),Tg=h(["subchart","size","height"],60),Ug=h(["color","pattern"],[]),Vg=h(["legend","show"],!0),Wg=h(["legend","position"],"bottom"),Xg=h(["legend","item","onclick"]),Yg=h(["legend","item","onmouseover"]),Zg=h(["legend","item","onmouseout"]),$g=h(["legend","equally"],!1),_g=h(["axis","rotated"],!1),ah=h(["axis","x","show"],!0),bh=h(["axis","x","type"],"indexed"),ch=h(["axis","x","localtime"],!0),dh=h(["axis","x","categories"],[]),eh=h(["axis","x","tick","centered"],!1),fh=h(["axis","x","tick","format"]),gh=h(["axis","x","tick","culling"],{}),hh=h(["axis","x","tick","culling","max"],10),ih=h(["axis","x","tick","count"]),jh=h(["axis","x","tick","fit"],!0),kh=h(["axis","x","tick","values"],null),lh=h(["axis","x","tick","rotate"]),mh=h(["axis","x","max"],null),nh=h(["axis","x","min"],null),oh=h(["axis","x","padding"],{}),ph=h(["axis","x","height"]),qh=h(["axis","x","default"]),rh=h(["axis","x","label"],{}),sh=h(["axis","y","show"],!0),th=h(["axis","y","max"]),uh=h(["axis","y","min"]),vh=h(["axis","y","center"]),wh=h(["axis","y","label"],{}),xh=h(["axis","y","inner"],!1),yh=h(["axis","y","tick","format"]),zh=h(["axis","y","padding"],{}),Ah=h(["axis","y","ticks"],10),Bh=h(["axis","y2","show"],!1),Ch=h(["axis","y2","max"]),Dh=h(["axis","y2","min"]),Eh=h(["axis","y2","center"]),Fh=h(["axis","y2","label"],{}),Gh=h(["axis","y2","inner"],!1),Hh=h(["axis","y2","tick","format"]),Ih=h(["axis","y2","padding"],{}),Jh=h(["axis","y2","ticks"],10),Kh=h(["grid","x","show"],!1),Lh=h(["grid","x","type"],"tick"),Mh=h(["grid","x","lines"],[]),Nh=h(["grid","y","show"],!1),Oh=h(["grid","y","lines"],[]),Ph=h(["grid","y","ticks"],10),Qh=h(["point","show"],!0),Rh=Qh?h(["point","r"],2.5):0,Sh=h(["point","focus","line","enabled"],!0),Th=h(["point","focus","expand","enabled"],!0),Uh=h(["point","focus","expand","r"],Th?4:Rh),Vh=h(["point","focus","select","r"],8),Wh=h(["line","connect_null"],!1),Xh=h(["bar","width"]),Yh=h(["bar","width","ratio"],.6),Zh=h(["pie","label","show"],!0),$h=h(["pie","label","format"]),_h=h(["pie","expand"],!0),ai=h(["pie","onclick"],function(){}),bi=h(["pie","onmouseover"],function(){}),ci=h(["pie","onmouseout"],function(){}),di=h(["donut","label","show"],!0),ei=h(["donut","label","format"]),fi=h(["donut","expand"],!0),gi=h(["donut","title"],""),hi=h(["donut","onclick"],function(){}),ii=h(["donut","onmouseover"],function(){}),ji=h(["donut","onmouseout"],function(){}),ki=h(["regions"],[]),li=h(["tooltip","show"],!0),mi=h(["tooltip","format","title"]),ni=h(["tooltip","format","value"]),oi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=mi?mi:b,l=ni?ni:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id,a[g].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),pi=h(["tooltip","init","show"],!1),qi=h(["tooltip","init","x"],0),ri=h(["tooltip","init","position"],{top:"0px",left:"50px"}),si=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ti=si+"-xaxis",ui=si+"-yaxis",vi=i(si),wi=i(ti),xi=i(ui),yi="timeseries"===bh,zi="categorized"===bh,Ai=!yi&&(sg||we(tg)),Bi=null,Ci=!1,Di=!1,Ei=!1,Fi=!1,Gi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Hi=qe(Gg,we(Ug)?Ug:Gi,Fg),Ii=ch?wf.time.format:wf.time.format.utc,Ji=function(){var a=[[Ii("%Y/%-m/%-d"),function(){return!0}],[Ii("%-m/%-d"),function(a){return a.getMonth()}],[Ii("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ii("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ii("%I %p"),function(a){return a.getHours()}],[Ii("%I:%M"),function(a){return a.getMinutes()}],[Ii(":%S"),function(a){return a.getSeconds()}],[Ii(".%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)}}(),Ki=[],Li=[],Mi=_g?"left":"bottom",Ni=_g?xh?"top":"bottom":xh?"right":"left",Oi=_g?Gh?"bottom":"top":Gh?"left":"right",Pi=_g?"left":"bottom",Qi={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(_g?0:Rf)+")"},y:function(){return"translate(0,"+(_g?Rf:0)+")"},y2:function(){return"translate("+(_g?0:Pf)+","+(_g?1:0)+")"},subx:function(){return"translate(0,"+(_g?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Ri="right"===Wg,Si=0,Ti=0,Ui=0,Vi=.15,Wi=30,Xi=_g&&!ah?0:30,Yi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Zi,$i=function(){var a=wf.svg.line().x(_g?function(a){return V(a.id)(a.value)}:Cd).y(_g?Cd:function(a){return V(a.id)(a.value)});return Wh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Wh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),_i=function(){var a;return a=_g?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a=wf.svg.line().x(_g?function(a){return W(a.id)(a.value)}:Fd).y(_g?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),bj=function(){};Zi=wf.svg.brush().on("brush",_e),Zi.update=function(){return fj&&fj.select("."+f.brush).call(this),this},Zi.scale=function(a){return _g?this.y(a):this.x(a)},Ef&&(bj=wf.behavior.zoom().on("zoomstart",function(){bj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),bj.scale=function(a){return _g?this.y(a):this.x(a)},bj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},bj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(jj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var cj,dj,ej,fj,gj,hj,ij,jj,kj,lj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),cj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?pf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),cj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?qf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Vi),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){Zi.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&zi&&(dh=a.categories,og.categories(dh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(ej.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Ig||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Jg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Ig||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Jg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0})},xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Mh=a,$e(),Mh):Mh},xf.xgrids.add=function(a){return a?xf.xgrids(Mh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a); return xf.xgrids(Mh.filter(b))},xf.ygrids=function(a){return a?(Oh=a,$e(),Oh):Oh},xf.ygrids.add=function(a){return a?xf.ygrids(Oh.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Oh.filter(b))},xf.regions=function(a){return c(a)?ki:(ki=a,$e(),ki)},xf.regions.add=function(a){return c(a)?ki:(ki=ki.concat(a),$e(),ki)},xf.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;cj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ki=ki.filter(function(b){return b.classes.indexOf(a)<0})}),ki},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(th=+a.y),b(a.y2)&&(Ch=+a.y2)):th=Ch=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){Vg||(Vg=!0,gj.style("visibility","visible")),pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0}),Vg&&ve(a)&&(Vg=!1,gj.style("visibility","hidden"))},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},ij.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From d5181f1db7d10b679d04befa7573523056608f38 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 30 Apr 2014 16:55:05 +0900 Subject: [PATCH 093/178] Modify config logic --- c3.js | 4 ++-- c3.min.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/c3.js b/c3.js index 33aaa9d..60fcb07 100644 --- a/c3.js +++ b/c3.js @@ -91,7 +91,7 @@ // Check next key's value isLast = (i === keys.length - 1); nextTarget = target[keys[i]]; - if ((!isLast && typeof nextTarget !== 'object') || (isLast && typeof defaultValue !== 'object' && typeof nextTarget === 'object' && nextTarget !== null)) { + if (!isLast && typeof nextTarget !== 'object') { return defaultValue; } target = nextTarget; @@ -2048,7 +2048,7 @@ }; } function getBarW(axis, barTargetsNum) { - return __bar_width ? __bar_width : barTargetsNum ? (axis.tickOffset() * 2 * __bar_width_ratio) / barTargetsNum : 0; + return typeof __bar_width === 'number' ? __bar_width : barTargetsNum ? (axis.tickOffset() * 2 * __bar_width_ratio) / barTargetsNum : 0; } //-- Type --// diff --git a/c3.min.js b/c3.min.js index bbddace..2a9b990 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.33"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cPf&&(Pf=0),0>Rf&&(Rf=0),Qf=ah?Mf.left-Xi-Yi:Pf,Sf=ah?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Si&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){fj.select("line."+f.xgridFocus).attr("x1",ah?0:-10).attr("x2",ah?Pf:-10).attr("y1",ah?-10:Mf.top).attr("y2",ah?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=ah?f.axisX:f.axisY,b=fj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:ah?bh?v("x"):1:!th||yh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Si?P()+(Ch&&!ah?v("y2"):a):Ch?Hh||ah?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||bh?"x"===a&&qh?qh:"y"!==a||th?"y2"!==a||Ch?(jb(a).isInner?30:40)+("y2"===a?-10:0):Zi:Wg&&!Si?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!ah)}function C(){return A(!ah)}function D(){return z(ah)}function E(){return A(ah)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(qh?qh:0)+80:Rf+8}function H(){return F(!ah)}function I(){return G(!ah)}function J(){return F(ah)}function K(){return G(ah)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(Ai?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Ti=a}function N(a){Ui=a}function O(a){Vi=a}function P(){return Wg?Si?Ui*(Ti+1):Tf:0}function Q(){return Wg?Si?Uf:Vi*(Ti+1):0}function R(){var a,b,c=!ig;ag=ah?1:0,bg=ah?Rf:Pf,cg=ah?0:Rf,dg=ah?Pf:1,eg=ag,fg=bg,gg=ah?0:Sf,hg=ah?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,kj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=lh?lh:c?void 0:og.tickValues(),og=X(ig,Ni,a,b),rg=X(lg,Qi,a,b),pg=Y(jg,Oi,zh,Bh),qg=Y(kg,Pi,Ih,Kh),c||($i.scale(lg),Ef&&cj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(zi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Ai){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(Ai?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Ai?(e.tickCentered(fh),ve(hh)&&(hh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},Ai&&e.categories(eh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=zi?Ki:Ai?Tc:function(a){return 0>a?a.toFixed(0):a};return gh&&("function"==typeof gh?a=gh:zi&&(a=function(a){return a?Ji(gh)(a):""})),a}function _(a){var b;return"y"===a?b=xh:"y2"===a?b=Gh:"x"===a&&(b=sh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?xh=b:"y2"===a?Gh=b:"x"===a&&(sh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",ah?"inner-top":"inner-right")}function hb(){return fb("y",ah?"inner-right":"inner-top")}function ib(){return fb("y2",ah?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!ah,gb())}function rb(){return nb(ah,hb())}function sb(){return nb(ah,ib())}function tb(){return ob(!ah,gb())}function ub(){return ob(ah,hb())}function vb(){return ob(ah,ib())}function wb(){var a=gb();return ah?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":qh?qh-10:"3em"}function xb(){var a=hb();return ah?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return ah?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!ah,gb())}function Ab(){return pb(ah,hb())}function Bb(){return pb(ah,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){fj.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),fj.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),fj.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.length>0)for(g=Sc(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 wf.max(Object.keys(i).map(function(a){return wf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Eh:vh,n="y2"===c?Dh:uh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Fh:wh,r=ud()&&ah;return 0===l.length?"y2"===c?kg.domain():jg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(jg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Ah&&(f=b(Ah.top)?Ah.top:e,g=b(Ah.bottom)?Ah.bottom:e),"y2"===c&&Jh&&(f=b(Jh.top)?Jh.top:e,g=b(Jh.bottom)?Jh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return oh?zi?re(oh):oh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return nh?zi?re(nh):nh:wf.max(a,function(a){return wf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Ai?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof ph&&we(ph)?(e=b(ph.left)?ph.left:d,f=b(ph.right)?ph.right:d):e=f="number"==typeof ph?ph:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=zi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=zi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?jg:kg;return b="y"===a.axis||"y2"===a.axis?ah?Rf:"start"in a?d(a.start):Rf:ah?"end"in a?ig(zi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),xf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=zi?a?a instanceof Date?a:re(a):re(mc(c,d)):Bi&&!Ai?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Bi&&Ai&&0===c&&g&&(0===e&&(eh=[]),eh.push(g)),("undefined"==typeof a[b]||xf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&xf.data.targets[0].values[a-1]?xf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(xf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(zi?new Date(i):i);j.push(e)}return zi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Li=Li.concat(a)}function Mc(a){Li=Li.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Mi=Mi.concat(a)}function Oc(a){Mi=Mi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&mi&&(ij.html(pi(a,$(),wd(k),Ii)).style("display","block"),d=ij.property("offsetWidth"),e=ij.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(ah?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),ij.style("top",i+"px").style("left",g+"px"))}function Qd(){ij.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});mi&&(be(xf.data.targets)||ee(xf.data.targets)||fj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(ah?"y1":"x1",Cd).attr(ah?"y2":"x2",Cd))}function Sd(){fj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return Yh?Yh:b?2*a.tickOffset()*Zh/b:0}function $d(a,b){Dc(a).forEach(function(a){mj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&gi||je(a)&&ai}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=ah?1:0,e=ah?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Pg(b,a.node()),fj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud).attr("stroke",function(){return Ii(b)}).attr("r",1.4*Wh).transition().duration(100).attr("r",Wh)}function Be(a,b,c){Qg(b,a.node()),fj.select("."+f.selectedCircles+ld(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){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Ii(b)).darker(1)})}function Ee(a,b){Qg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ii(b)})}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?fj.selectAll("."+f.circles+ld(c)):fj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Vh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Sh)}function Ke(a){return fj.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=ah?1:0,f=ah?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 ah?(c=he(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.getBoundingClientRect();return ah?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return ah&&(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(jj=wf.select(zf),jj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(jj.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),Hg&&Lc(Hg===!0?Cc(xf.data.targets):Hg),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),kj=ig.domain(),$i.scale(lg),Ef&&cj.scale(ig),dj=jj.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),ej=dj.append("defs"),ej.append("clipPath").attr("id",ti).append("rect").attr("width",Pf).attr("height",Rf),ej.append("clipPath").attr("id",ui).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),ej.append("clipPath").attr("id",vi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),fj=dj.append("g").attr("transform",Ri.main),gj=dj.append("g").attr("transform",Ri.context),hj=dj.append("g").attr("transform",Ri.legend),Tg||gj.style("visibility","hidden"),Wg||(hj.style("visibility","hidden"),Mi=Cc(xf.data.targets)),ij=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),bh&&fj.append("g").attr("class",f.axisX).attr("clip-path",xi).attr("transform",Ri.x).append("text").attr("class",f.axisXLabel).attr("transform",ah?"rotate(-90)":"").style("text-anchor",zb),th&&fj.append("g").attr("class",f.axisY).attr("clip-path",yi).attr("transform",Ri.y).append("text").attr("class",f.axisYLabel).attr("transform",ah?"":"rotate(-90)").style("text-anchor",Ab),Ch&&fj.append("g").attr("class",f.axisY2).attr("transform",Ri.y2).append("text").attr("class",f.axisY2Label).attr("transform",ah?"":"rotate(-90)").style("text-anchor",Bb),d=fj.append("g").attr("clip-path",wi).attr("class",f.grid),Lh&&d.append("g").attr("class",f.xgrids),we(Nh)&&d.append("g").attr("class",f.xgridLines),Th&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Oh&&d.append("g").attr("class",f.ygrids),we(Ph)&&d.append("g").attr("class",f.ygridLines),fj.append("g").attr("clip-path",wi).attr("class",f.regions),fj.append("g").attr("clip-path",wi).attr("class",f.chart),c=fj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?ah?"ns-resize":"ew-resize":null),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Ri.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),fj.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&fj.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",ah?"ns-resize":"ew-resize").call(cj).on("dblclick.zoom",null),rh&&$i.extent("function"!=typeof rh?rh:rh(_b())),gj.append("g").attr("clip-path",wi).attr("class",f.chart),gj.select("."+f.chart).append("g").attr("class",f.chartBars),gj.select("."+f.chart).append("g").attr("class",f.chartLines),gj.append("g").attr("clip-path",wi).attr("class",f.brush).call($i).selectAll("rect").attr(ah?"width":"height",ah?Qf:Sf),gj.append("g").attr("class",f.axisX).attr("transform",Ri.subx).attr("clip-path",ah?"":xi),ef(xf.data.targets),ah?fj.select("."+f.axisX).style("opacity",0).call(og):(fj.select("."+f.axisY).style("opacity",0).call(pg),fj.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),qi){if(zi&&"string"==typeof ri){for(ri=re(ri),e=0;ePf&&(Pf=0),0>Rf&&(Rf=0),Qf=ah?Mf.left-Xi-Yi:Pf,Sf=ah?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Si&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){fj.select("line."+f.xgridFocus).attr("x1",ah?0:-10).attr("x2",ah?Pf:-10).attr("y1",ah?-10:Mf.top).attr("y2",ah?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=ah?f.axisX:f.axisY,b=fj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:ah?bh?v("x"):1:!th||yh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Si?P()+(Ch&&!ah?v("y2"):a):Ch?Hh||ah?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||bh?"x"===a&&qh?qh:"y"!==a||th?"y2"!==a||Ch?(jb(a).isInner?30:40)+("y2"===a?-10:0):Zi:Wg&&!Si?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!ah)}function C(){return A(!ah)}function D(){return z(ah)}function E(){return A(ah)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(qh?qh:0)+80:Rf+8}function H(){return F(!ah)}function I(){return G(!ah)}function J(){return F(ah)}function K(){return G(ah)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(Ai?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Ti=a}function N(a){Ui=a}function O(a){Vi=a}function P(){return Wg?Si?Ui*(Ti+1):Tf:0}function Q(){return Wg?Si?Uf:Vi*(Ti+1):0}function R(){var a,b,c=!ig;ag=ah?1:0,bg=ah?Rf:Pf,cg=ah?0:Rf,dg=ah?Pf:1,eg=ag,fg=bg,gg=ah?0:Sf,hg=ah?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,kj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=lh?lh:c?void 0:og.tickValues(),og=X(ig,Ni,a,b),rg=X(lg,Qi,a,b),pg=Y(jg,Oi,zh,Bh),qg=Y(kg,Pi,Ih,Kh),c||($i.scale(lg),Ef&&cj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(zi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Ai){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(Ai?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Ai?(e.tickCentered(fh),ve(hh)&&(hh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},Ai&&e.categories(eh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=zi?Ki:Ai?Tc:function(a){return 0>a?a.toFixed(0):a};return gh&&("function"==typeof gh?a=gh:zi&&(a=function(a){return a?Ji(gh)(a):""})),a}function _(a){var b;return"y"===a?b=xh:"y2"===a?b=Gh:"x"===a&&(b=sh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?xh=b:"y2"===a?Gh=b:"x"===a&&(sh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",ah?"inner-top":"inner-right")}function hb(){return fb("y",ah?"inner-right":"inner-top")}function ib(){return fb("y2",ah?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!ah,gb())}function rb(){return nb(ah,hb())}function sb(){return nb(ah,ib())}function tb(){return ob(!ah,gb())}function ub(){return ob(ah,hb())}function vb(){return ob(ah,ib())}function wb(){var a=gb();return ah?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":qh?qh-10:"3em"}function xb(){var a=hb();return ah?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return ah?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!ah,gb())}function Ab(){return pb(ah,hb())}function Bb(){return pb(ah,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){fj.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),fj.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),fj.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.length>0)for(g=Sc(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 wf.max(Object.keys(i).map(function(a){return wf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Eh:vh,n="y2"===c?Dh:uh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Fh:wh,r=ud()&&ah;return 0===l.length?"y2"===c?kg.domain():jg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(jg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Ah&&(f=b(Ah.top)?Ah.top:e,g=b(Ah.bottom)?Ah.bottom:e),"y2"===c&&Jh&&(f=b(Jh.top)?Jh.top:e,g=b(Jh.bottom)?Jh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return oh?zi?re(oh):oh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return nh?zi?re(nh):nh:wf.max(a,function(a){return wf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Ai?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof ph&&we(ph)?(e=b(ph.left)?ph.left:d,f=b(ph.right)?ph.right:d):e=f="number"==typeof ph?ph:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=zi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=zi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?jg:kg;return b="y"===a.axis||"y2"===a.axis?ah?Rf:"start"in a?d(a.start):Rf:ah?"end"in a?ig(zi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),xf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=zi?a?a instanceof Date?a:re(a):re(mc(c,d)):Bi&&!Ai?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Bi&&Ai&&0===c&&g&&(0===e&&(eh=[]),eh.push(g)),("undefined"==typeof a[b]||xf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&xf.data.targets[0].values[a-1]?xf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(xf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(zi?new Date(i):i);j.push(e)}return zi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Li=Li.concat(a)}function Mc(a){Li=Li.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Mi=Mi.concat(a)}function Oc(a){Mi=Mi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&mi&&(ij.html(pi(a,$(),wd(k),Ii)).style("display","block"),d=ij.property("offsetWidth"),e=ij.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(ah?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),ij.style("top",i+"px").style("left",g+"px"))}function Qd(){ij.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});mi&&(be(xf.data.targets)||ee(xf.data.targets)||fj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(ah?"y1":"x1",Cd).attr(ah?"y2":"x2",Cd))}function Sd(){fj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return"number"==typeof Yh?Yh:b?2*a.tickOffset()*Zh/b:0}function $d(a,b){Dc(a).forEach(function(a){mj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&gi||je(a)&&ai}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=ah?1:0,e=ah?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Pg(b,a.node()),fj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud).attr("stroke",function(){return Ii(b)}).attr("r",1.4*Wh).transition().duration(100).attr("r",Wh)}function Be(a,b,c){Qg(b,a.node()),fj.select("."+f.selectedCircles+ld(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){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Ii(b)).darker(1)})}function Ee(a,b){Qg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ii(b)})}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?fj.selectAll("."+f.circles+ld(c)):fj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Vh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Sh)}function Ke(a){return fj.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=ah?1:0,f=ah?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 ah?(c=he(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.getBoundingClientRect();return ah?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return ah&&(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(jj=wf.select(zf),jj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(jj.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),Hg&&Lc(Hg===!0?Cc(xf.data.targets):Hg),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),kj=ig.domain(),$i.scale(lg),Ef&&cj.scale(ig),dj=jj.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),ej=dj.append("defs"),ej.append("clipPath").attr("id",ti).append("rect").attr("width",Pf).attr("height",Rf),ej.append("clipPath").attr("id",ui).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),ej.append("clipPath").attr("id",vi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),fj=dj.append("g").attr("transform",Ri.main),gj=dj.append("g").attr("transform",Ri.context),hj=dj.append("g").attr("transform",Ri.legend),Tg||gj.style("visibility","hidden"),Wg||(hj.style("visibility","hidden"),Mi=Cc(xf.data.targets)),ij=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),bh&&fj.append("g").attr("class",f.axisX).attr("clip-path",xi).attr("transform",Ri.x).append("text").attr("class",f.axisXLabel).attr("transform",ah?"rotate(-90)":"").style("text-anchor",zb),th&&fj.append("g").attr("class",f.axisY).attr("clip-path",yi).attr("transform",Ri.y).append("text").attr("class",f.axisYLabel).attr("transform",ah?"":"rotate(-90)").style("text-anchor",Ab),Ch&&fj.append("g").attr("class",f.axisY2).attr("transform",Ri.y2).append("text").attr("class",f.axisY2Label).attr("transform",ah?"":"rotate(-90)").style("text-anchor",Bb),d=fj.append("g").attr("clip-path",wi).attr("class",f.grid),Lh&&d.append("g").attr("class",f.xgrids),we(Nh)&&d.append("g").attr("class",f.xgridLines),Th&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Oh&&d.append("g").attr("class",f.ygrids),we(Ph)&&d.append("g").attr("class",f.ygridLines),fj.append("g").attr("clip-path",wi).attr("class",f.regions),fj.append("g").attr("clip-path",wi).attr("class",f.chart),c=fj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?ah?"ns-resize":"ew-resize":null),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Ri.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),fj.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&fj.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",ah?"ns-resize":"ew-resize").call(cj).on("dblclick.zoom",null),rh&&$i.extent("function"!=typeof rh?rh:rh(_b())),gj.append("g").attr("clip-path",wi).attr("class",f.chart),gj.select("."+f.chart).append("g").attr("class",f.chartBars),gj.select("."+f.chart).append("g").attr("class",f.chartLines),gj.append("g").attr("clip-path",wi).attr("class",f.brush).call($i).selectAll("rect").attr(ah?"width":"height",ah?Qf:Sf),gj.append("g").attr("class",f.axisX).attr("transform",Ri.subx).attr("clip-path",ah?"":xi),ef(xf.data.targets),ah?fj.select("."+f.axisX).style("opacity",0).call(og):(fj.select("."+f.axisY).style("opacity",0).call(pg),fj.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),qi){if(zi&&"string"==typeof ri){for(ri=re(ri),e=0;e0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(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){ee(xf.data.targets)||Ig&&(Ci=a,fj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Di=!0,Rg())}function Ze(){ee(xf.data.targets)||Ig&&(fj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),fj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Di=!1,Sg())}function $e(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=fj.select("."+f.axisX).style("opacity",W?0:1),g=fj.select("."+f.axisY).style("opacity",W?0:1),h=fj.select("."+f.axisY2).style("opacity",W?0:1),e=gj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Wg&&rf(Cc(xf.data.targets),a,O),Ai&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),kj=ig.domain(),Ef&&cj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),$i.scale(lg)),G&&(ig.domain($i.empty()?kj:$i.extent()),Ef&&cj.scale(ig).updateScaleExtent()),lh||!kh&&!jh||(S=Kc(Jc(X),jh),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(hh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!ah&&mh&&eb(c,O.axisX,mh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),ij.style("display","none"),o(),fj.select("line."+f.xgridFocus).style("visibility","hidden"),Lh){if("year"===Mh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=fj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",ah?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",ah?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",ah?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",ah?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(ah?"y1":"x1")===(ah?Rf:0)?0:1}),i.exit().remove()}we(Nh)&&(k=fj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Nh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",ah?"":"rotate(-90)").attr("dx",ah?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",ah?0:Dd).attr("x2",ah?Pf:Dd).attr("y1",ah?Dd:Mf.top).attr("y2",ah?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",ah?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Oh&&(m=fj.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Qh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",ah?jg:0).attr("x2",ah?jg:Pf).attr("y1",ah?0:jg).attr("y2",ah?Rf:jg),m.exit().remove()),A&&we(Ph)&&(n=fj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Ph),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",ah?"rotate(-90)":"").attr("dx",ah?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",ah?Ed:0).attr("x2",ah?Ed:Pf).attr("y1",ah?0:Ed).attr("y2",ah?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",ah?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=fj.select("."+f.regions).selectAll("rect."+f.region).data(li),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Ii(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=fj.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return ah?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",_i).style("opacity",1),fj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",aj).style("opacity",lj),q=fj.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Sh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud),q.exit().remove(),fj.each(function(){Gi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Gi=!1}),fj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),fj.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Tg&&(null!==wf.event&&"zoom"===wf.event.type&&$i.extent(ig.orgDomain()).update(),B&&(!ah&&mh&&eb(e,O.axisSubX,mh),$i.empty()||$i.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=gj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Ii(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),gj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",bj).style("opacity",1))),fj.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),fj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud),v=fj.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=fj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Bi&&!Ai?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),fj.select("."+f.eventRects).datum(x?x.values:[]),w=fj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",ah?0:y).attr("y",ah?y:0).attr("width",ah?Pf:z).attr("height",ah?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){mj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&cj.altDomain?(ig.domain(cj.altDomain),void cj.scale(ig).updateScaleExtent()):(Ai&&ig.orgDomain()[0]===kj[0]&&ig.domain([kj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Ei=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){dj.attr("width",Tf).attr("height",Uf),dj.select("#"+ti).select("rect").attr("width",Pf).attr("height",Rf),dj.select("#"+ui).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.select("#"+vi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),dj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),jj.style("max-height",Uf+"px")}function df(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=fj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Ii(a)}),e=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Kg(a)?"pointer":null}),c=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ii(a)}),b.append("path").attr("class",dd).style("opacity",function(){return lj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Ii(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Ii(a)}).style("cursor",function(a){return Kg(a)?"pointer":null}),a.forEach(function(a){fj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=fj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Ii(a.data)}).style("cursor",function(a){return Kg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Gi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Gi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Tg&&(n=gj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Ii(a)}),l=gj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ii(a)})),dj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(750).style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Si?j:i,l=Si?Q():P();return d&&(x=0,D=0,u=0,v=0),Wg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Si?v:u,void(_g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Si?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=hj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Yg?Yg(a):xf.toggle(a)}).on("mouseover",function(a){Gi||xf.focus(a),"function"==typeof Zg&&Zg(a)}).on("mouseout",function(a){Gi||xf.revert(),"function"==typeof $g&&$g(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Si?h:-200).attr("y",Si?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Si?i:-200).attr("y",Si?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Ii(a)}).attr("x",Si?h:-200).attr("y",Si?-200:j).attr("width",10).attr("height",10),hj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),hj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),hj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),hj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){return Gc(a)?1:Wi}),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Gi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"]),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","hide"],!1),Ig=h(["data","selection","enabled"],!1),Jg=h(["data","selection","grouped"],!1),Kg=h(["data","selection","isselectable"],function(){return!0}),Lg=h(["data","selection","multiple"],!0),Mg=h(["data","onclick"],function(){}),Ng=h(["data","onenter"],function(){}),Og=h(["data","onleave"],function(){}),Pg=h(["data","onselected"],function(){}),Qg=h(["data","onunselected"],function(){}),Rg=h(["data","ondragstart"],function(){}),Sg=h(["data","ondragend"],function(){}),Tg=h(["subchart","show"],!1),Ug=h(["subchart","size","height"],60),Vg=h(["color","pattern"],[]),Wg=h(["legend","show"],!0),Xg=h(["legend","position"],"bottom"),Yg=h(["legend","item","onclick"]),Zg=h(["legend","item","onmouseover"]),$g=h(["legend","item","onmouseout"]),_g=h(["legend","equally"],!1),ah=h(["axis","rotated"],!1),bh=h(["axis","x","show"],!0),ch=h(["axis","x","type"],"indexed"),dh=h(["axis","x","localtime"],!0),eh=h(["axis","x","categories"],[]),fh=h(["axis","x","tick","centered"],!1),gh=h(["axis","x","tick","format"]),hh=h(["axis","x","tick","culling"],{}),ih=h(["axis","x","tick","culling","max"],10),jh=h(["axis","x","tick","count"]),kh=h(["axis","x","tick","fit"],!0),lh=h(["axis","x","tick","values"],null),mh=h(["axis","x","tick","rotate"]),nh=h(["axis","x","max"],null),oh=h(["axis","x","min"],null),ph=h(["axis","x","padding"],{}),qh=h(["axis","x","height"]),rh=h(["axis","x","default"]),sh=h(["axis","x","label"],{}),th=h(["axis","y","show"],!0),uh=h(["axis","y","max"]),vh=h(["axis","y","min"]),wh=h(["axis","y","center"]),xh=h(["axis","y","label"],{}),yh=h(["axis","y","inner"],!1),zh=h(["axis","y","tick","format"]),Ah=h(["axis","y","padding"],{}),Bh=h(["axis","y","ticks"],10),Ch=h(["axis","y2","show"],!1),Dh=h(["axis","y2","max"]),Eh=h(["axis","y2","min"]),Fh=h(["axis","y2","center"]),Gh=h(["axis","y2","label"],{}),Hh=h(["axis","y2","inner"],!1),Ih=h(["axis","y2","tick","format"]),Jh=h(["axis","y2","padding"],{}),Kh=h(["axis","y2","ticks"],10),Lh=h(["grid","x","show"],!1),Mh=h(["grid","x","type"],"tick"),Nh=h(["grid","x","lines"],[]),Oh=h(["grid","y","show"],!1),Ph=h(["grid","y","lines"],[]),Qh=h(["grid","y","ticks"],10),Rh=h(["point","show"],!0),Sh=Rh?h(["point","r"],2.5):0,Th=h(["point","focus","line","enabled"],!0),Uh=h(["point","focus","expand","enabled"],!0),Vh=h(["point","focus","expand","r"],Uh?4:Sh),Wh=h(["point","focus","select","r"],8),Xh=h(["line","connect_null"],!1),Yh=h(["bar","width"]),Zh=h(["bar","width","ratio"],.6),$h=h(["pie","label","show"],!0),_h=h(["pie","label","format"]),ai=h(["pie","expand"],!0),bi=h(["pie","onclick"],function(){}),ci=h(["pie","onmouseover"],function(){}),di=h(["pie","onmouseout"],function(){}),ei=h(["donut","label","show"],!0),fi=h(["donut","label","format"]),gi=h(["donut","expand"],!0),hi=h(["donut","title"],""),ii=h(["donut","onclick"],function(){}),ji=h(["donut","onmouseover"],function(){}),ki=h(["donut","onmouseout"],function(){}),li=h(["regions"],[]),mi=h(["tooltip","show"],!0),ni=h(["tooltip","format","title"]),oi=h(["tooltip","format","value"]),pi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ni?ni:b,l=oi?oi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),qi=h(["tooltip","init","show"],!1),ri=h(["tooltip","init","x"],0),si=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ti=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ui=ti+"-xaxis",vi=ti+"-yaxis",wi=i(ti),xi=i(ui),yi=i(vi),zi="timeseries"===ch,Ai="categorized"===ch,Bi=!zi&&(sg||we(tg)),Ci=null,Di=!1,Ei=!1,Fi=!1,Gi=!1,Hi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ii=qe(Gg,we(Vg)?Vg:Hi,Fg),Ji=dh?wf.time.format:wf.time.format.utc,Ki=function(){var a=[[Ji("%Y/%-m/%-d"),function(){return!0}],[Ji("%-m/%-d"),function(a){return a.getMonth()}],[Ji("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ji("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ji("%I %p"),function(a){return a.getHours()}],[Ji("%I:%M"),function(a){return a.getMinutes()}],[Ji(":%S"),function(a){return a.getSeconds()}],[Ji(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),Li=[],Mi=[],Ni=ah?"left":"bottom",Oi=ah?yh?"top":"bottom":yh?"right":"left",Pi=ah?Hh?"bottom":"top":Hh?"left":"right",Qi=ah?"left":"bottom",Ri={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(ah?0:Rf)+")"},y:function(){return"translate(0,"+(ah?Rf:0)+")"},y2:function(){return"translate("+(ah?0:Pf)+","+(ah?1:0)+")"},subx:function(){return"translate(0,"+(ah?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Si="right"===Xg,Ti=0,Ui=0,Vi=0,Wi=.15,Xi=30,Yi=ah&&!bh?0:30,Zi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var $i,_i=function(){var a=wf.svg.line().x(ah?function(a){return V(a.id)(a.value)}:Cd).y(ah?Cd:function(a){return V(a.id)(a.value)});return Xh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Xh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ah?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a;return a=ah?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ah?"M "+d+" "+c:"M "+c+" "+d)}}(),bj=function(){var a=wf.svg.line().x(ah?function(a){return W(a.id)(a.value)}:Fd).y(ah?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),cj=function(){};$i=wf.svg.brush().on("brush",_e),$i.update=function(){return gj&&gj.select("."+f.brush).call(this),this},$i.scale=function(a){return ah?this.y(a):this.x(a)},Ef&&(cj=wf.behavior.zoom().on("zoomstart",function(){cj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),cj.scale=function(a){return ah?this.y(a):this.x(a)},cj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},cj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(kj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var dj,ej,fj,gj,hj,ij,jj,kj,lj,mj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),dj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&pf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),xf.revert()},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),dj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&qf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),xf.revert()},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){$i.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&Ai&&(eh=a.categories,og.categories(eh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(fj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Ig&&fj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Jg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Kg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Ig&&fj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Jg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Kg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0}) },xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Nh=a,$e(),Nh):Nh},xf.xgrids.add=function(a){return a?xf.xgrids(Nh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a);return xf.xgrids(Nh.filter(b))},xf.ygrids=function(a){return a?(Ph=a,$e(),Ph):Ph},xf.ygrids.add=function(a){return a?xf.ygrids(Ph.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Ph.filter(b))},xf.regions=function(a){return c(a)?li:(li=a,$e(),li)},xf.regions.add=function(a){return c(a)?li:(li=li.concat(a),$e(),li)},xf.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;dj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),li=li.filter(function(b){return b.classes.indexOf(a)<0})}),li},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(vh=+a.y),b(a.y2)&&(Eh=+a.y2)):vh=Eh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0})},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},jj.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From d62c5f360a165c7561211046318d575fc2ba2efd Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 30 Apr 2014 18:36:19 +0900 Subject: [PATCH 094/178] Fix transition --- c3.js | 2 +- c3.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/c3.js b/c3.js index 60fcb07..9bf967b 100644 --- a/c3.js +++ b/c3.js @@ -3823,7 +3823,7 @@ // Fade-in each chart svg.selectAll('.' + CLASS.target).filter(function (d) { return isTargetToShow(d.id); }) - .transition().duration(750) + .transition().duration(__transition_duration) .style("opacity", 1); } diff --git a/c3.min.js b/c3.min.js index 2a9b990..c451a36 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ !function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.33"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cPf&&(Pf=0),0>Rf&&(Rf=0),Qf=ah?Mf.left-Xi-Yi:Pf,Sf=ah?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Si&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){fj.select("line."+f.xgridFocus).attr("x1",ah?0:-10).attr("x2",ah?Pf:-10).attr("y1",ah?-10:Mf.top).attr("y2",ah?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=ah?f.axisX:f.axisY,b=fj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:ah?bh?v("x"):1:!th||yh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Si?P()+(Ch&&!ah?v("y2"):a):Ch?Hh||ah?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||bh?"x"===a&&qh?qh:"y"!==a||th?"y2"!==a||Ch?(jb(a).isInner?30:40)+("y2"===a?-10:0):Zi:Wg&&!Si?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!ah)}function C(){return A(!ah)}function D(){return z(ah)}function E(){return A(ah)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(qh?qh:0)+80:Rf+8}function H(){return F(!ah)}function I(){return G(!ah)}function J(){return F(ah)}function K(){return G(ah)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(Ai?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Ti=a}function N(a){Ui=a}function O(a){Vi=a}function P(){return Wg?Si?Ui*(Ti+1):Tf:0}function Q(){return Wg?Si?Uf:Vi*(Ti+1):0}function R(){var a,b,c=!ig;ag=ah?1:0,bg=ah?Rf:Pf,cg=ah?0:Rf,dg=ah?Pf:1,eg=ag,fg=bg,gg=ah?0:Sf,hg=ah?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,kj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=lh?lh:c?void 0:og.tickValues(),og=X(ig,Ni,a,b),rg=X(lg,Qi,a,b),pg=Y(jg,Oi,zh,Bh),qg=Y(kg,Pi,Ih,Kh),c||($i.scale(lg),Ef&&cj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(zi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Ai){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(Ai?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Ai?(e.tickCentered(fh),ve(hh)&&(hh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},Ai&&e.categories(eh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=zi?Ki:Ai?Tc:function(a){return 0>a?a.toFixed(0):a};return gh&&("function"==typeof gh?a=gh:zi&&(a=function(a){return a?Ji(gh)(a):""})),a}function _(a){var b;return"y"===a?b=xh:"y2"===a?b=Gh:"x"===a&&(b=sh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?xh=b:"y2"===a?Gh=b:"x"===a&&(sh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",ah?"inner-top":"inner-right")}function hb(){return fb("y",ah?"inner-right":"inner-top")}function ib(){return fb("y2",ah?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!ah,gb())}function rb(){return nb(ah,hb())}function sb(){return nb(ah,ib())}function tb(){return ob(!ah,gb())}function ub(){return ob(ah,hb())}function vb(){return ob(ah,ib())}function wb(){var a=gb();return ah?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":qh?qh-10:"3em"}function xb(){var a=hb();return ah?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return ah?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!ah,gb())}function Ab(){return pb(ah,hb())}function Bb(){return pb(ah,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){fj.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),fj.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),fj.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.length>0)for(g=Sc(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 wf.max(Object.keys(i).map(function(a){return wf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Eh:vh,n="y2"===c?Dh:uh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Fh:wh,r=ud()&&ah;return 0===l.length?"y2"===c?kg.domain():jg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(jg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Ah&&(f=b(Ah.top)?Ah.top:e,g=b(Ah.bottom)?Ah.bottom:e),"y2"===c&&Jh&&(f=b(Jh.top)?Jh.top:e,g=b(Jh.bottom)?Jh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return oh?zi?re(oh):oh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return nh?zi?re(nh):nh:wf.max(a,function(a){return wf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Ai?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof ph&&we(ph)?(e=b(ph.left)?ph.left:d,f=b(ph.right)?ph.right:d):e=f="number"==typeof ph?ph:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=zi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=zi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?jg:kg;return b="y"===a.axis||"y2"===a.axis?ah?Rf:"start"in a?d(a.start):Rf:ah?"end"in a?ig(zi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),xf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=zi?a?a instanceof Date?a:re(a):re(mc(c,d)):Bi&&!Ai?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Bi&&Ai&&0===c&&g&&(0===e&&(eh=[]),eh.push(g)),("undefined"==typeof a[b]||xf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&xf.data.targets[0].values[a-1]?xf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(xf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(zi?new Date(i):i);j.push(e)}return zi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Li=Li.concat(a)}function Mc(a){Li=Li.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Mi=Mi.concat(a)}function Oc(a){Mi=Mi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&mi&&(ij.html(pi(a,$(),wd(k),Ii)).style("display","block"),d=ij.property("offsetWidth"),e=ij.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(ah?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),ij.style("top",i+"px").style("left",g+"px"))}function Qd(){ij.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});mi&&(be(xf.data.targets)||ee(xf.data.targets)||fj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(ah?"y1":"x1",Cd).attr(ah?"y2":"x2",Cd))}function Sd(){fj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return"number"==typeof Yh?Yh:b?2*a.tickOffset()*Zh/b:0}function $d(a,b){Dc(a).forEach(function(a){mj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&gi||je(a)&&ai}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=ah?1:0,e=ah?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Pg(b,a.node()),fj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud).attr("stroke",function(){return Ii(b)}).attr("r",1.4*Wh).transition().duration(100).attr("r",Wh)}function Be(a,b,c){Qg(b,a.node()),fj.select("."+f.selectedCircles+ld(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){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Ii(b)).darker(1)})}function Ee(a,b){Qg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ii(b)})}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?fj.selectAll("."+f.circles+ld(c)):fj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Vh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Sh)}function Ke(a){return fj.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=ah?1:0,f=ah?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 ah?(c=he(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.getBoundingClientRect();return ah?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return ah&&(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(jj=wf.select(zf),jj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(jj.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),Hg&&Lc(Hg===!0?Cc(xf.data.targets):Hg),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),kj=ig.domain(),$i.scale(lg),Ef&&cj.scale(ig),dj=jj.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),ej=dj.append("defs"),ej.append("clipPath").attr("id",ti).append("rect").attr("width",Pf).attr("height",Rf),ej.append("clipPath").attr("id",ui).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),ej.append("clipPath").attr("id",vi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),fj=dj.append("g").attr("transform",Ri.main),gj=dj.append("g").attr("transform",Ri.context),hj=dj.append("g").attr("transform",Ri.legend),Tg||gj.style("visibility","hidden"),Wg||(hj.style("visibility","hidden"),Mi=Cc(xf.data.targets)),ij=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),bh&&fj.append("g").attr("class",f.axisX).attr("clip-path",xi).attr("transform",Ri.x).append("text").attr("class",f.axisXLabel).attr("transform",ah?"rotate(-90)":"").style("text-anchor",zb),th&&fj.append("g").attr("class",f.axisY).attr("clip-path",yi).attr("transform",Ri.y).append("text").attr("class",f.axisYLabel).attr("transform",ah?"":"rotate(-90)").style("text-anchor",Ab),Ch&&fj.append("g").attr("class",f.axisY2).attr("transform",Ri.y2).append("text").attr("class",f.axisY2Label).attr("transform",ah?"":"rotate(-90)").style("text-anchor",Bb),d=fj.append("g").attr("clip-path",wi).attr("class",f.grid),Lh&&d.append("g").attr("class",f.xgrids),we(Nh)&&d.append("g").attr("class",f.xgridLines),Th&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Oh&&d.append("g").attr("class",f.ygrids),we(Ph)&&d.append("g").attr("class",f.ygridLines),fj.append("g").attr("clip-path",wi).attr("class",f.regions),fj.append("g").attr("clip-path",wi).attr("class",f.chart),c=fj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?ah?"ns-resize":"ew-resize":null),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Ri.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),fj.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&fj.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",ah?"ns-resize":"ew-resize").call(cj).on("dblclick.zoom",null),rh&&$i.extent("function"!=typeof rh?rh:rh(_b())),gj.append("g").attr("clip-path",wi).attr("class",f.chart),gj.select("."+f.chart).append("g").attr("class",f.chartBars),gj.select("."+f.chart).append("g").attr("class",f.chartLines),gj.append("g").attr("clip-path",wi).attr("class",f.brush).call($i).selectAll("rect").attr(ah?"width":"height",ah?Qf:Sf),gj.append("g").attr("class",f.axisX).attr("transform",Ri.subx).attr("clip-path",ah?"":xi),ef(xf.data.targets),ah?fj.select("."+f.axisX).style("opacity",0).call(og):(fj.select("."+f.axisY).style("opacity",0).call(pg),fj.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),qi){if(zi&&"string"==typeof ri){for(ri=re(ri),e=0;e0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(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){ee(xf.data.targets)||Ig&&(Ci=a,fj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Di=!0,Rg())}function Ze(){ee(xf.data.targets)||Ig&&(fj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),fj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Di=!1,Sg())}function $e(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=fj.select("."+f.axisX).style("opacity",W?0:1),g=fj.select("."+f.axisY).style("opacity",W?0:1),h=fj.select("."+f.axisY2).style("opacity",W?0:1),e=gj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Wg&&rf(Cc(xf.data.targets),a,O),Ai&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),kj=ig.domain(),Ef&&cj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),$i.scale(lg)),G&&(ig.domain($i.empty()?kj:$i.extent()),Ef&&cj.scale(ig).updateScaleExtent()),lh||!kh&&!jh||(S=Kc(Jc(X),jh),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(hh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!ah&&mh&&eb(c,O.axisX,mh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),ij.style("display","none"),o(),fj.select("line."+f.xgridFocus).style("visibility","hidden"),Lh){if("year"===Mh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=fj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",ah?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",ah?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",ah?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",ah?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(ah?"y1":"x1")===(ah?Rf:0)?0:1}),i.exit().remove()}we(Nh)&&(k=fj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Nh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",ah?"":"rotate(-90)").attr("dx",ah?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",ah?0:Dd).attr("x2",ah?Pf:Dd).attr("y1",ah?Dd:Mf.top).attr("y2",ah?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",ah?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Oh&&(m=fj.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Qh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",ah?jg:0).attr("x2",ah?jg:Pf).attr("y1",ah?0:jg).attr("y2",ah?Rf:jg),m.exit().remove()),A&&we(Ph)&&(n=fj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Ph),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",ah?"rotate(-90)":"").attr("dx",ah?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",ah?Ed:0).attr("x2",ah?Ed:Pf).attr("y1",ah?0:Ed).attr("y2",ah?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",ah?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=fj.select("."+f.regions).selectAll("rect."+f.region).data(li),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Ii(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=fj.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return ah?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",_i).style("opacity",1),fj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",aj).style("opacity",lj),q=fj.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Sh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud),q.exit().remove(),fj.each(function(){Gi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Gi=!1}),fj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),fj.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Tg&&(null!==wf.event&&"zoom"===wf.event.type&&$i.extent(ig.orgDomain()).update(),B&&(!ah&&mh&&eb(e,O.axisSubX,mh),$i.empty()||$i.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=gj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Ii(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),gj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",bj).style("opacity",1))),fj.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),fj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud),v=fj.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=fj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Bi&&!Ai?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),fj.select("."+f.eventRects).datum(x?x.values:[]),w=fj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",ah?0:y).attr("y",ah?y:0).attr("width",ah?Pf:z).attr("height",ah?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){mj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&cj.altDomain?(ig.domain(cj.altDomain),void cj.scale(ig).updateScaleExtent()):(Ai&&ig.orgDomain()[0]===kj[0]&&ig.domain([kj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Ei=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){dj.attr("width",Tf).attr("height",Uf),dj.select("#"+ti).select("rect").attr("width",Pf).attr("height",Rf),dj.select("#"+ui).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.select("#"+vi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),dj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),jj.style("max-height",Uf+"px")}function df(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=fj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Ii(a)}),e=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Kg(a)?"pointer":null}),c=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ii(a)}),b.append("path").attr("class",dd).style("opacity",function(){return lj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Ii(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Ii(a)}).style("cursor",function(a){return Kg(a)?"pointer":null}),a.forEach(function(a){fj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=fj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Ii(a.data)}).style("cursor",function(a){return Kg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Gi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Gi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Tg&&(n=gj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Ii(a)}),l=gj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ii(a)})),dj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(750).style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Si?j:i,l=Si?Q():P();return d&&(x=0,D=0,u=0,v=0),Wg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Si?v:u,void(_g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Si?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=hj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Yg?Yg(a):xf.toggle(a)}).on("mouseover",function(a){Gi||xf.focus(a),"function"==typeof Zg&&Zg(a)}).on("mouseout",function(a){Gi||xf.revert(),"function"==typeof $g&&$g(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Si?h:-200).attr("y",Si?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Si?i:-200).attr("y",Si?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Ii(a)}).attr("x",Si?h:-200).attr("y",Si?-200:j).attr("width",10).attr("height",10),hj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),hj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),hj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),hj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){return Gc(a)?1:Wi}),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Gi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"]),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","hide"],!1),Ig=h(["data","selection","enabled"],!1),Jg=h(["data","selection","grouped"],!1),Kg=h(["data","selection","isselectable"],function(){return!0}),Lg=h(["data","selection","multiple"],!0),Mg=h(["data","onclick"],function(){}),Ng=h(["data","onenter"],function(){}),Og=h(["data","onleave"],function(){}),Pg=h(["data","onselected"],function(){}),Qg=h(["data","onunselected"],function(){}),Rg=h(["data","ondragstart"],function(){}),Sg=h(["data","ondragend"],function(){}),Tg=h(["subchart","show"],!1),Ug=h(["subchart","size","height"],60),Vg=h(["color","pattern"],[]),Wg=h(["legend","show"],!0),Xg=h(["legend","position"],"bottom"),Yg=h(["legend","item","onclick"]),Zg=h(["legend","item","onmouseover"]),$g=h(["legend","item","onmouseout"]),_g=h(["legend","equally"],!1),ah=h(["axis","rotated"],!1),bh=h(["axis","x","show"],!0),ch=h(["axis","x","type"],"indexed"),dh=h(["axis","x","localtime"],!0),eh=h(["axis","x","categories"],[]),fh=h(["axis","x","tick","centered"],!1),gh=h(["axis","x","tick","format"]),hh=h(["axis","x","tick","culling"],{}),ih=h(["axis","x","tick","culling","max"],10),jh=h(["axis","x","tick","count"]),kh=h(["axis","x","tick","fit"],!0),lh=h(["axis","x","tick","values"],null),mh=h(["axis","x","tick","rotate"]),nh=h(["axis","x","max"],null),oh=h(["axis","x","min"],null),ph=h(["axis","x","padding"],{}),qh=h(["axis","x","height"]),rh=h(["axis","x","default"]),sh=h(["axis","x","label"],{}),th=h(["axis","y","show"],!0),uh=h(["axis","y","max"]),vh=h(["axis","y","min"]),wh=h(["axis","y","center"]),xh=h(["axis","y","label"],{}),yh=h(["axis","y","inner"],!1),zh=h(["axis","y","tick","format"]),Ah=h(["axis","y","padding"],{}),Bh=h(["axis","y","ticks"],10),Ch=h(["axis","y2","show"],!1),Dh=h(["axis","y2","max"]),Eh=h(["axis","y2","min"]),Fh=h(["axis","y2","center"]),Gh=h(["axis","y2","label"],{}),Hh=h(["axis","y2","inner"],!1),Ih=h(["axis","y2","tick","format"]),Jh=h(["axis","y2","padding"],{}),Kh=h(["axis","y2","ticks"],10),Lh=h(["grid","x","show"],!1),Mh=h(["grid","x","type"],"tick"),Nh=h(["grid","x","lines"],[]),Oh=h(["grid","y","show"],!1),Ph=h(["grid","y","lines"],[]),Qh=h(["grid","y","ticks"],10),Rh=h(["point","show"],!0),Sh=Rh?h(["point","r"],2.5):0,Th=h(["point","focus","line","enabled"],!0),Uh=h(["point","focus","expand","enabled"],!0),Vh=h(["point","focus","expand","r"],Uh?4:Sh),Wh=h(["point","focus","select","r"],8),Xh=h(["line","connect_null"],!1),Yh=h(["bar","width"]),Zh=h(["bar","width","ratio"],.6),$h=h(["pie","label","show"],!0),_h=h(["pie","label","format"]),ai=h(["pie","expand"],!0),bi=h(["pie","onclick"],function(){}),ci=h(["pie","onmouseover"],function(){}),di=h(["pie","onmouseout"],function(){}),ei=h(["donut","label","show"],!0),fi=h(["donut","label","format"]),gi=h(["donut","expand"],!0),hi=h(["donut","title"],""),ii=h(["donut","onclick"],function(){}),ji=h(["donut","onmouseover"],function(){}),ki=h(["donut","onmouseout"],function(){}),li=h(["regions"],[]),mi=h(["tooltip","show"],!0),ni=h(["tooltip","format","title"]),oi=h(["tooltip","format","value"]),pi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ni?ni:b,l=oi?oi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),qi=h(["tooltip","init","show"],!1),ri=h(["tooltip","init","x"],0),si=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ti=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ui=ti+"-xaxis",vi=ti+"-yaxis",wi=i(ti),xi=i(ui),yi=i(vi),zi="timeseries"===ch,Ai="categorized"===ch,Bi=!zi&&(sg||we(tg)),Ci=null,Di=!1,Ei=!1,Fi=!1,Gi=!1,Hi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ii=qe(Gg,we(Vg)?Vg:Hi,Fg),Ji=dh?wf.time.format:wf.time.format.utc,Ki=function(){var a=[[Ji("%Y/%-m/%-d"),function(){return!0}],[Ji("%-m/%-d"),function(a){return a.getMonth()}],[Ji("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ji("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ji("%I %p"),function(a){return a.getHours()}],[Ji("%I:%M"),function(a){return a.getMinutes()}],[Ji(":%S"),function(a){return a.getSeconds()}],[Ji(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),Li=[],Mi=[],Ni=ah?"left":"bottom",Oi=ah?yh?"top":"bottom":yh?"right":"left",Pi=ah?Hh?"bottom":"top":Hh?"left":"right",Qi=ah?"left":"bottom",Ri={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(ah?0:Rf)+")"},y:function(){return"translate(0,"+(ah?Rf:0)+")"},y2:function(){return"translate("+(ah?0:Pf)+","+(ah?1:0)+")"},subx:function(){return"translate(0,"+(ah?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Si="right"===Xg,Ti=0,Ui=0,Vi=0,Wi=.15,Xi=30,Yi=ah&&!bh?0:30,Zi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var $i,_i=function(){var a=wf.svg.line().x(ah?function(a){return V(a.id)(a.value)}:Cd).y(ah?Cd:function(a){return V(a.id)(a.value)});return Xh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Xh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ah?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a;return a=ah?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ah?"M "+d+" "+c:"M "+c+" "+d)}}(),bj=function(){var a=wf.svg.line().x(ah?function(a){return W(a.id)(a.value)}:Fd).y(ah?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),cj=function(){};$i=wf.svg.brush().on("brush",_e),$i.update=function(){return gj&&gj.select("."+f.brush).call(this),this},$i.scale=function(a){return ah?this.y(a):this.x(a)},Ef&&(cj=wf.behavior.zoom().on("zoomstart",function(){cj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),cj.scale=function(a){return ah?this.y(a):this.x(a)},cj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},cj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(kj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var dj,ej,fj,gj,hj,ij,jj,kj,lj,mj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),dj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&pf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),xf.revert()},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),dj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&qf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),xf.revert()},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){$i.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&Ai&&(eh=a.categories,og.categories(eh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(fj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Ig&&fj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Jg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Kg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Ig&&fj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Jg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Kg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0}) +}ij.html(pi(xf.data.targets.map(function(a){return pc(a.values[ri])}),$(),wd(ee(xf.data.targets)),Ii)),ij.style("top",si.top).style("left",si.left).style("display","block")}null==a.onresize&&(a.onresize=bf()),a.onresize.add&&(a.onresize.add(Jf),a.onresize.add(function(){df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})}),a.onresize.add(Kf))}function Ue(a){a.append("rect").attr("class",fd).style("cursor",Ig&&Jg?"pointer":null).on("mouseover",function(a,b){if(!Di&&!ee(xf.data.targets)){var c,d,e=xf.data.targets.map(function(a){return pc(a.values[b])});if(Object.keys(wg).length>0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(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){ee(xf.data.targets)||Ig&&(Ci=a,fj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Di=!0,Rg())}function Ze(){ee(xf.data.targets)||Ig&&(fj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),fj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Di=!1,Sg())}function $e(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=fj.select("."+f.axisX).style("opacity",W?0:1),g=fj.select("."+f.axisY).style("opacity",W?0:1),h=fj.select("."+f.axisY2).style("opacity",W?0:1),e=gj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Wg&&rf(Cc(xf.data.targets),a,O),Ai&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),kj=ig.domain(),Ef&&cj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),$i.scale(lg)),G&&(ig.domain($i.empty()?kj:$i.extent()),Ef&&cj.scale(ig).updateScaleExtent()),lh||!kh&&!jh||(S=Kc(Jc(X),jh),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(hh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!ah&&mh&&eb(c,O.axisX,mh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),ij.style("display","none"),o(),fj.select("line."+f.xgridFocus).style("visibility","hidden"),Lh){if("year"===Mh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=fj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",ah?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",ah?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",ah?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",ah?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(ah?"y1":"x1")===(ah?Rf:0)?0:1}),i.exit().remove()}we(Nh)&&(k=fj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Nh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",ah?"":"rotate(-90)").attr("dx",ah?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",ah?0:Dd).attr("x2",ah?Pf:Dd).attr("y1",ah?Dd:Mf.top).attr("y2",ah?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",ah?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Oh&&(m=fj.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Qh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",ah?jg:0).attr("x2",ah?jg:Pf).attr("y1",ah?0:jg).attr("y2",ah?Rf:jg),m.exit().remove()),A&&we(Ph)&&(n=fj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Ph),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",ah?"rotate(-90)":"").attr("dx",ah?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",ah?Ed:0).attr("x2",ah?Ed:Pf).attr("y1",ah?0:Ed).attr("y2",ah?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",ah?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=fj.select("."+f.regions).selectAll("rect."+f.region).data(li),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Ii(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=fj.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return ah?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",_i).style("opacity",1),fj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",aj).style("opacity",lj),q=fj.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Sh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud),q.exit().remove(),fj.each(function(){Gi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Gi=!1}),fj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),fj.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Tg&&(null!==wf.event&&"zoom"===wf.event.type&&$i.extent(ig.orgDomain()).update(),B&&(!ah&&mh&&eb(e,O.axisSubX,mh),$i.empty()||$i.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=gj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Ii(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),gj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",bj).style("opacity",1))),fj.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),fj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud),v=fj.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=fj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Bi&&!Ai?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),fj.select("."+f.eventRects).datum(x?x.values:[]),w=fj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",ah?0:y).attr("y",ah?y:0).attr("width",ah?Pf:z).attr("height",ah?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){mj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&cj.altDomain?(ig.domain(cj.altDomain),void cj.scale(ig).updateScaleExtent()):(Ai&&ig.orgDomain()[0]===kj[0]&&ig.domain([kj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Ei=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){dj.attr("width",Tf).attr("height",Uf),dj.select("#"+ti).select("rect").attr("width",Pf).attr("height",Rf),dj.select("#"+ui).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.select("#"+vi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),dj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),jj.style("max-height",Uf+"px")}function df(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=fj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Ii(a)}),e=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Kg(a)?"pointer":null}),c=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ii(a)}),b.append("path").attr("class",dd).style("opacity",function(){return lj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Ii(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Ii(a)}).style("cursor",function(a){return Kg(a)?"pointer":null}),a.forEach(function(a){fj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=fj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Ii(a.data)}).style("cursor",function(a){return Kg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Gi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Gi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Tg&&(n=gj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Ii(a)}),l=gj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ii(a)})),dj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Lf).style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Si?j:i,l=Si?Q():P();return d&&(x=0,D=0,u=0,v=0),Wg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Si?v:u,void(_g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Si?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=hj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Yg?Yg(a):xf.toggle(a)}).on("mouseover",function(a){Gi||xf.focus(a),"function"==typeof Zg&&Zg(a)}).on("mouseout",function(a){Gi||xf.revert(),"function"==typeof $g&&$g(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Si?h:-200).attr("y",Si?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Si?i:-200).attr("y",Si?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Ii(a)}).attr("x",Si?h:-200).attr("y",Si?-200:j).attr("width",10).attr("height",10),hj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),hj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),hj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),hj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){return Gc(a)?1:Wi}),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Gi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"]),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","hide"],!1),Ig=h(["data","selection","enabled"],!1),Jg=h(["data","selection","grouped"],!1),Kg=h(["data","selection","isselectable"],function(){return!0}),Lg=h(["data","selection","multiple"],!0),Mg=h(["data","onclick"],function(){}),Ng=h(["data","onenter"],function(){}),Og=h(["data","onleave"],function(){}),Pg=h(["data","onselected"],function(){}),Qg=h(["data","onunselected"],function(){}),Rg=h(["data","ondragstart"],function(){}),Sg=h(["data","ondragend"],function(){}),Tg=h(["subchart","show"],!1),Ug=h(["subchart","size","height"],60),Vg=h(["color","pattern"],[]),Wg=h(["legend","show"],!0),Xg=h(["legend","position"],"bottom"),Yg=h(["legend","item","onclick"]),Zg=h(["legend","item","onmouseover"]),$g=h(["legend","item","onmouseout"]),_g=h(["legend","equally"],!1),ah=h(["axis","rotated"],!1),bh=h(["axis","x","show"],!0),ch=h(["axis","x","type"],"indexed"),dh=h(["axis","x","localtime"],!0),eh=h(["axis","x","categories"],[]),fh=h(["axis","x","tick","centered"],!1),gh=h(["axis","x","tick","format"]),hh=h(["axis","x","tick","culling"],{}),ih=h(["axis","x","tick","culling","max"],10),jh=h(["axis","x","tick","count"]),kh=h(["axis","x","tick","fit"],!0),lh=h(["axis","x","tick","values"],null),mh=h(["axis","x","tick","rotate"]),nh=h(["axis","x","max"],null),oh=h(["axis","x","min"],null),ph=h(["axis","x","padding"],{}),qh=h(["axis","x","height"]),rh=h(["axis","x","default"]),sh=h(["axis","x","label"],{}),th=h(["axis","y","show"],!0),uh=h(["axis","y","max"]),vh=h(["axis","y","min"]),wh=h(["axis","y","center"]),xh=h(["axis","y","label"],{}),yh=h(["axis","y","inner"],!1),zh=h(["axis","y","tick","format"]),Ah=h(["axis","y","padding"],{}),Bh=h(["axis","y","ticks"],10),Ch=h(["axis","y2","show"],!1),Dh=h(["axis","y2","max"]),Eh=h(["axis","y2","min"]),Fh=h(["axis","y2","center"]),Gh=h(["axis","y2","label"],{}),Hh=h(["axis","y2","inner"],!1),Ih=h(["axis","y2","tick","format"]),Jh=h(["axis","y2","padding"],{}),Kh=h(["axis","y2","ticks"],10),Lh=h(["grid","x","show"],!1),Mh=h(["grid","x","type"],"tick"),Nh=h(["grid","x","lines"],[]),Oh=h(["grid","y","show"],!1),Ph=h(["grid","y","lines"],[]),Qh=h(["grid","y","ticks"],10),Rh=h(["point","show"],!0),Sh=Rh?h(["point","r"],2.5):0,Th=h(["point","focus","line","enabled"],!0),Uh=h(["point","focus","expand","enabled"],!0),Vh=h(["point","focus","expand","r"],Uh?4:Sh),Wh=h(["point","focus","select","r"],8),Xh=h(["line","connect_null"],!1),Yh=h(["bar","width"]),Zh=h(["bar","width","ratio"],.6),$h=h(["pie","label","show"],!0),_h=h(["pie","label","format"]),ai=h(["pie","expand"],!0),bi=h(["pie","onclick"],function(){}),ci=h(["pie","onmouseover"],function(){}),di=h(["pie","onmouseout"],function(){}),ei=h(["donut","label","show"],!0),fi=h(["donut","label","format"]),gi=h(["donut","expand"],!0),hi=h(["donut","title"],""),ii=h(["donut","onclick"],function(){}),ji=h(["donut","onmouseover"],function(){}),ki=h(["donut","onmouseout"],function(){}),li=h(["regions"],[]),mi=h(["tooltip","show"],!0),ni=h(["tooltip","format","title"]),oi=h(["tooltip","format","value"]),pi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ni?ni:b,l=oi?oi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),qi=h(["tooltip","init","show"],!1),ri=h(["tooltip","init","x"],0),si=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ti=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ui=ti+"-xaxis",vi=ti+"-yaxis",wi=i(ti),xi=i(ui),yi=i(vi),zi="timeseries"===ch,Ai="categorized"===ch,Bi=!zi&&(sg||we(tg)),Ci=null,Di=!1,Ei=!1,Fi=!1,Gi=!1,Hi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ii=qe(Gg,we(Vg)?Vg:Hi,Fg),Ji=dh?wf.time.format:wf.time.format.utc,Ki=function(){var a=[[Ji("%Y/%-m/%-d"),function(){return!0}],[Ji("%-m/%-d"),function(a){return a.getMonth()}],[Ji("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ji("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ji("%I %p"),function(a){return a.getHours()}],[Ji("%I:%M"),function(a){return a.getMinutes()}],[Ji(":%S"),function(a){return a.getSeconds()}],[Ji(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),Li=[],Mi=[],Ni=ah?"left":"bottom",Oi=ah?yh?"top":"bottom":yh?"right":"left",Pi=ah?Hh?"bottom":"top":Hh?"left":"right",Qi=ah?"left":"bottom",Ri={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(ah?0:Rf)+")"},y:function(){return"translate(0,"+(ah?Rf:0)+")"},y2:function(){return"translate("+(ah?0:Pf)+","+(ah?1:0)+")"},subx:function(){return"translate(0,"+(ah?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Si="right"===Xg,Ti=0,Ui=0,Vi=0,Wi=.15,Xi=30,Yi=ah&&!bh?0:30,Zi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var $i,_i=function(){var a=wf.svg.line().x(ah?function(a){return V(a.id)(a.value)}:Cd).y(ah?Cd:function(a){return V(a.id)(a.value)});return Xh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Xh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ah?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a;return a=ah?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ah?"M "+d+" "+c:"M "+c+" "+d)}}(),bj=function(){var a=wf.svg.line().x(ah?function(a){return W(a.id)(a.value)}:Fd).y(ah?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),cj=function(){};$i=wf.svg.brush().on("brush",_e),$i.update=function(){return gj&&gj.select("."+f.brush).call(this),this},$i.scale=function(a){return ah?this.y(a):this.x(a)},Ef&&(cj=wf.behavior.zoom().on("zoomstart",function(){cj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),cj.scale=function(a){return ah?this.y(a):this.x(a)},cj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},cj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(kj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var dj,ej,fj,gj,hj,ij,jj,kj,lj,mj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),dj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&pf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),xf.revert()},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),dj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&qf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),xf.revert()},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){$i.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&Ai&&(eh=a.categories,og.categories(eh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(fj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Ig&&fj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Jg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Kg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Ig&&fj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Jg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Kg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0}) },xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Nh=a,$e(),Nh):Nh},xf.xgrids.add=function(a){return a?xf.xgrids(Nh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a);return xf.xgrids(Nh.filter(b))},xf.ygrids=function(a){return a?(Ph=a,$e(),Ph):Ph},xf.ygrids.add=function(a){return a?xf.ygrids(Ph.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Ph.filter(b))},xf.regions=function(a){return c(a)?li:(li=a,$e(),li)},xf.regions.add=function(a){return c(a)?li:(li=li.concat(a),$e(),li)},xf.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;dj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),li=li.filter(function(b){return b.classes.indexOf(a)<0})}),li},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(vh=+a.y),b(a.y2)&&(Eh=+a.y2)):vh=Eh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0})},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},jj.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 47b13dadcc394db99c3630131809940550d9576a Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 30 Apr 2014 18:39:30 +0900 Subject: [PATCH 095/178] Set default padding.left --- c3.js | 2 +- c3.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/c3.js b/c3.js index 9bf967b..9072ad8 100644 --- a/c3.js +++ b/c3.js @@ -105,7 +105,7 @@ var __size_width = getConfig(['size', 'width']), __size_height = getConfig(['size', 'height']); - var __padding_left = getConfig(['padding', 'left']), + var __padding_left = getConfig(['padding', 'left'], 50), __padding_right = getConfig(['padding', 'right']); var __zoom_enabled = getConfig(['zoom', 'enabled'], false), diff --git a/c3.min.js b/c3.min.js index c451a36..400fa4b 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ !function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.33"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cPf&&(Pf=0),0>Rf&&(Rf=0),Qf=ah?Mf.left-Xi-Yi:Pf,Sf=ah?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Si&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){fj.select("line."+f.xgridFocus).attr("x1",ah?0:-10).attr("x2",ah?Pf:-10).attr("y1",ah?-10:Mf.top).attr("y2",ah?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=ah?f.axisX:f.axisY,b=fj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:ah?bh?v("x"):1:!th||yh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Si?P()+(Ch&&!ah?v("y2"):a):Ch?Hh||ah?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||bh?"x"===a&&qh?qh:"y"!==a||th?"y2"!==a||Ch?(jb(a).isInner?30:40)+("y2"===a?-10:0):Zi:Wg&&!Si?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!ah)}function C(){return A(!ah)}function D(){return z(ah)}function E(){return A(ah)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(qh?qh:0)+80:Rf+8}function H(){return F(!ah)}function I(){return G(!ah)}function J(){return F(ah)}function K(){return G(ah)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(Ai?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Ti=a}function N(a){Ui=a}function O(a){Vi=a}function P(){return Wg?Si?Ui*(Ti+1):Tf:0}function Q(){return Wg?Si?Uf:Vi*(Ti+1):0}function R(){var a,b,c=!ig;ag=ah?1:0,bg=ah?Rf:Pf,cg=ah?0:Rf,dg=ah?Pf:1,eg=ag,fg=bg,gg=ah?0:Sf,hg=ah?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,kj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=lh?lh:c?void 0:og.tickValues(),og=X(ig,Ni,a,b),rg=X(lg,Qi,a,b),pg=Y(jg,Oi,zh,Bh),qg=Y(kg,Pi,Ih,Kh),c||($i.scale(lg),Ef&&cj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(zi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Ai){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(Ai?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Ai?(e.tickCentered(fh),ve(hh)&&(hh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},Ai&&e.categories(eh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=zi?Ki:Ai?Tc:function(a){return 0>a?a.toFixed(0):a};return gh&&("function"==typeof gh?a=gh:zi&&(a=function(a){return a?Ji(gh)(a):""})),a}function _(a){var b;return"y"===a?b=xh:"y2"===a?b=Gh:"x"===a&&(b=sh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?xh=b:"y2"===a?Gh=b:"x"===a&&(sh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",ah?"inner-top":"inner-right")}function hb(){return fb("y",ah?"inner-right":"inner-top")}function ib(){return fb("y2",ah?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!ah,gb())}function rb(){return nb(ah,hb())}function sb(){return nb(ah,ib())}function tb(){return ob(!ah,gb())}function ub(){return ob(ah,hb())}function vb(){return ob(ah,ib())}function wb(){var a=gb();return ah?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":qh?qh-10:"3em"}function xb(){var a=hb();return ah?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return ah?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!ah,gb())}function Ab(){return pb(ah,hb())}function Bb(){return pb(ah,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){fj.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),fj.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),fj.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.length>0)for(g=Sc(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 wf.max(Object.keys(i).map(function(a){return wf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Eh:vh,n="y2"===c?Dh:uh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Fh:wh,r=ud()&&ah;return 0===l.length?"y2"===c?kg.domain():jg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(jg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Ah&&(f=b(Ah.top)?Ah.top:e,g=b(Ah.bottom)?Ah.bottom:e),"y2"===c&&Jh&&(f=b(Jh.top)?Jh.top:e,g=b(Jh.bottom)?Jh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return oh?zi?re(oh):oh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return nh?zi?re(nh):nh:wf.max(a,function(a){return wf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Ai?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof ph&&we(ph)?(e=b(ph.left)?ph.left:d,f=b(ph.right)?ph.right:d):e=f="number"==typeof ph?ph:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=zi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=zi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?jg:kg;return b="y"===a.axis||"y2"===a.axis?ah?Rf:"start"in a?d(a.start):Rf:ah?"end"in a?ig(zi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),xf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=zi?a?a instanceof Date?a:re(a):re(mc(c,d)):Bi&&!Ai?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Bi&&Ai&&0===c&&g&&(0===e&&(eh=[]),eh.push(g)),("undefined"==typeof a[b]||xf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&xf.data.targets[0].values[a-1]?xf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(xf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(zi?new Date(i):i);j.push(e)}return zi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Li=Li.concat(a)}function Mc(a){Li=Li.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Mi=Mi.concat(a)}function Oc(a){Mi=Mi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&mi&&(ij.html(pi(a,$(),wd(k),Ii)).style("display","block"),d=ij.property("offsetWidth"),e=ij.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(ah?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),ij.style("top",i+"px").style("left",g+"px"))}function Qd(){ij.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});mi&&(be(xf.data.targets)||ee(xf.data.targets)||fj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(ah?"y1":"x1",Cd).attr(ah?"y2":"x2",Cd))}function Sd(){fj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return"number"==typeof Yh?Yh:b?2*a.tickOffset()*Zh/b:0}function $d(a,b){Dc(a).forEach(function(a){mj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&gi||je(a)&&ai}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=ah?1:0,e=ah?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Pg(b,a.node()),fj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud).attr("stroke",function(){return Ii(b)}).attr("r",1.4*Wh).transition().duration(100).attr("r",Wh)}function Be(a,b,c){Qg(b,a.node()),fj.select("."+f.selectedCircles+ld(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){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Ii(b)).darker(1)})}function Ee(a,b){Qg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ii(b)})}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?fj.selectAll("."+f.circles+ld(c)):fj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Vh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Sh)}function Ke(a){return fj.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=ah?1:0,f=ah?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 ah?(c=he(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.getBoundingClientRect();return ah?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return ah&&(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(jj=wf.select(zf),jj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(jj.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),Hg&&Lc(Hg===!0?Cc(xf.data.targets):Hg),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),kj=ig.domain(),$i.scale(lg),Ef&&cj.scale(ig),dj=jj.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),ej=dj.append("defs"),ej.append("clipPath").attr("id",ti).append("rect").attr("width",Pf).attr("height",Rf),ej.append("clipPath").attr("id",ui).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),ej.append("clipPath").attr("id",vi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),fj=dj.append("g").attr("transform",Ri.main),gj=dj.append("g").attr("transform",Ri.context),hj=dj.append("g").attr("transform",Ri.legend),Tg||gj.style("visibility","hidden"),Wg||(hj.style("visibility","hidden"),Mi=Cc(xf.data.targets)),ij=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),bh&&fj.append("g").attr("class",f.axisX).attr("clip-path",xi).attr("transform",Ri.x).append("text").attr("class",f.axisXLabel).attr("transform",ah?"rotate(-90)":"").style("text-anchor",zb),th&&fj.append("g").attr("class",f.axisY).attr("clip-path",yi).attr("transform",Ri.y).append("text").attr("class",f.axisYLabel).attr("transform",ah?"":"rotate(-90)").style("text-anchor",Ab),Ch&&fj.append("g").attr("class",f.axisY2).attr("transform",Ri.y2).append("text").attr("class",f.axisY2Label).attr("transform",ah?"":"rotate(-90)").style("text-anchor",Bb),d=fj.append("g").attr("clip-path",wi).attr("class",f.grid),Lh&&d.append("g").attr("class",f.xgrids),we(Nh)&&d.append("g").attr("class",f.xgridLines),Th&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Oh&&d.append("g").attr("class",f.ygrids),we(Ph)&&d.append("g").attr("class",f.ygridLines),fj.append("g").attr("clip-path",wi).attr("class",f.regions),fj.append("g").attr("clip-path",wi).attr("class",f.chart),c=fj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?ah?"ns-resize":"ew-resize":null),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Ri.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),fj.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&fj.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",ah?"ns-resize":"ew-resize").call(cj).on("dblclick.zoom",null),rh&&$i.extent("function"!=typeof rh?rh:rh(_b())),gj.append("g").attr("clip-path",wi).attr("class",f.chart),gj.select("."+f.chart).append("g").attr("class",f.chartBars),gj.select("."+f.chart).append("g").attr("class",f.chartLines),gj.append("g").attr("clip-path",wi).attr("class",f.brush).call($i).selectAll("rect").attr(ah?"width":"height",ah?Qf:Sf),gj.append("g").attr("class",f.axisX).attr("transform",Ri.subx).attr("clip-path",ah?"":xi),ef(xf.data.targets),ah?fj.select("."+f.axisX).style("opacity",0).call(og):(fj.select("."+f.axisY).style("opacity",0).call(pg),fj.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),qi){if(zi&&"string"==typeof ri){for(ri=re(ri),e=0;e0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(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){ee(xf.data.targets)||Ig&&(Ci=a,fj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Di=!0,Rg())}function Ze(){ee(xf.data.targets)||Ig&&(fj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),fj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Di=!1,Sg())}function $e(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=fj.select("."+f.axisX).style("opacity",W?0:1),g=fj.select("."+f.axisY).style("opacity",W?0:1),h=fj.select("."+f.axisY2).style("opacity",W?0:1),e=gj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Wg&&rf(Cc(xf.data.targets),a,O),Ai&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),kj=ig.domain(),Ef&&cj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),$i.scale(lg)),G&&(ig.domain($i.empty()?kj:$i.extent()),Ef&&cj.scale(ig).updateScaleExtent()),lh||!kh&&!jh||(S=Kc(Jc(X),jh),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(hh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!ah&&mh&&eb(c,O.axisX,mh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),ij.style("display","none"),o(),fj.select("line."+f.xgridFocus).style("visibility","hidden"),Lh){if("year"===Mh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=fj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",ah?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",ah?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",ah?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",ah?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(ah?"y1":"x1")===(ah?Rf:0)?0:1}),i.exit().remove()}we(Nh)&&(k=fj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Nh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",ah?"":"rotate(-90)").attr("dx",ah?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",ah?0:Dd).attr("x2",ah?Pf:Dd).attr("y1",ah?Dd:Mf.top).attr("y2",ah?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",ah?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Oh&&(m=fj.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Qh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",ah?jg:0).attr("x2",ah?jg:Pf).attr("y1",ah?0:jg).attr("y2",ah?Rf:jg),m.exit().remove()),A&&we(Ph)&&(n=fj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Ph),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",ah?"rotate(-90)":"").attr("dx",ah?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",ah?Ed:0).attr("x2",ah?Ed:Pf).attr("y1",ah?0:Ed).attr("y2",ah?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",ah?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=fj.select("."+f.regions).selectAll("rect."+f.region).data(li),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Ii(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=fj.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return ah?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",_i).style("opacity",1),fj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",aj).style("opacity",lj),q=fj.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Sh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud),q.exit().remove(),fj.each(function(){Gi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Gi=!1}),fj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),fj.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Tg&&(null!==wf.event&&"zoom"===wf.event.type&&$i.extent(ig.orgDomain()).update(),B&&(!ah&&mh&&eb(e,O.axisSubX,mh),$i.empty()||$i.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=gj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Ii(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),gj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",bj).style("opacity",1))),fj.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),fj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud),v=fj.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=fj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Bi&&!Ai?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),fj.select("."+f.eventRects).datum(x?x.values:[]),w=fj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",ah?0:y).attr("y",ah?y:0).attr("width",ah?Pf:z).attr("height",ah?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){mj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&cj.altDomain?(ig.domain(cj.altDomain),void cj.scale(ig).updateScaleExtent()):(Ai&&ig.orgDomain()[0]===kj[0]&&ig.domain([kj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Ei=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){dj.attr("width",Tf).attr("height",Uf),dj.select("#"+ti).select("rect").attr("width",Pf).attr("height",Rf),dj.select("#"+ui).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.select("#"+vi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),dj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),jj.style("max-height",Uf+"px")}function df(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=fj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Ii(a)}),e=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Kg(a)?"pointer":null}),c=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ii(a)}),b.append("path").attr("class",dd).style("opacity",function(){return lj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Ii(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Ii(a)}).style("cursor",function(a){return Kg(a)?"pointer":null}),a.forEach(function(a){fj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=fj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Ii(a.data)}).style("cursor",function(a){return Kg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Gi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Gi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Tg&&(n=gj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Ii(a)}),l=gj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ii(a)})),dj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Lf).style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Si?j:i,l=Si?Q():P();return d&&(x=0,D=0,u=0,v=0),Wg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Si?v:u,void(_g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Si?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=hj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Yg?Yg(a):xf.toggle(a)}).on("mouseover",function(a){Gi||xf.focus(a),"function"==typeof Zg&&Zg(a)}).on("mouseout",function(a){Gi||xf.revert(),"function"==typeof $g&&$g(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Si?h:-200).attr("y",Si?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Si?i:-200).attr("y",Si?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Ii(a)}).attr("x",Si?h:-200).attr("y",Si?-200:j).attr("width",10).attr("height",10),hj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),hj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),hj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),hj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){return Gc(a)?1:Wi}),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Gi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"]),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","hide"],!1),Ig=h(["data","selection","enabled"],!1),Jg=h(["data","selection","grouped"],!1),Kg=h(["data","selection","isselectable"],function(){return!0}),Lg=h(["data","selection","multiple"],!0),Mg=h(["data","onclick"],function(){}),Ng=h(["data","onenter"],function(){}),Og=h(["data","onleave"],function(){}),Pg=h(["data","onselected"],function(){}),Qg=h(["data","onunselected"],function(){}),Rg=h(["data","ondragstart"],function(){}),Sg=h(["data","ondragend"],function(){}),Tg=h(["subchart","show"],!1),Ug=h(["subchart","size","height"],60),Vg=h(["color","pattern"],[]),Wg=h(["legend","show"],!0),Xg=h(["legend","position"],"bottom"),Yg=h(["legend","item","onclick"]),Zg=h(["legend","item","onmouseover"]),$g=h(["legend","item","onmouseout"]),_g=h(["legend","equally"],!1),ah=h(["axis","rotated"],!1),bh=h(["axis","x","show"],!0),ch=h(["axis","x","type"],"indexed"),dh=h(["axis","x","localtime"],!0),eh=h(["axis","x","categories"],[]),fh=h(["axis","x","tick","centered"],!1),gh=h(["axis","x","tick","format"]),hh=h(["axis","x","tick","culling"],{}),ih=h(["axis","x","tick","culling","max"],10),jh=h(["axis","x","tick","count"]),kh=h(["axis","x","tick","fit"],!0),lh=h(["axis","x","tick","values"],null),mh=h(["axis","x","tick","rotate"]),nh=h(["axis","x","max"],null),oh=h(["axis","x","min"],null),ph=h(["axis","x","padding"],{}),qh=h(["axis","x","height"]),rh=h(["axis","x","default"]),sh=h(["axis","x","label"],{}),th=h(["axis","y","show"],!0),uh=h(["axis","y","max"]),vh=h(["axis","y","min"]),wh=h(["axis","y","center"]),xh=h(["axis","y","label"],{}),yh=h(["axis","y","inner"],!1),zh=h(["axis","y","tick","format"]),Ah=h(["axis","y","padding"],{}),Bh=h(["axis","y","ticks"],10),Ch=h(["axis","y2","show"],!1),Dh=h(["axis","y2","max"]),Eh=h(["axis","y2","min"]),Fh=h(["axis","y2","center"]),Gh=h(["axis","y2","label"],{}),Hh=h(["axis","y2","inner"],!1),Ih=h(["axis","y2","tick","format"]),Jh=h(["axis","y2","padding"],{}),Kh=h(["axis","y2","ticks"],10),Lh=h(["grid","x","show"],!1),Mh=h(["grid","x","type"],"tick"),Nh=h(["grid","x","lines"],[]),Oh=h(["grid","y","show"],!1),Ph=h(["grid","y","lines"],[]),Qh=h(["grid","y","ticks"],10),Rh=h(["point","show"],!0),Sh=Rh?h(["point","r"],2.5):0,Th=h(["point","focus","line","enabled"],!0),Uh=h(["point","focus","expand","enabled"],!0),Vh=h(["point","focus","expand","r"],Uh?4:Sh),Wh=h(["point","focus","select","r"],8),Xh=h(["line","connect_null"],!1),Yh=h(["bar","width"]),Zh=h(["bar","width","ratio"],.6),$h=h(["pie","label","show"],!0),_h=h(["pie","label","format"]),ai=h(["pie","expand"],!0),bi=h(["pie","onclick"],function(){}),ci=h(["pie","onmouseover"],function(){}),di=h(["pie","onmouseout"],function(){}),ei=h(["donut","label","show"],!0),fi=h(["donut","label","format"]),gi=h(["donut","expand"],!0),hi=h(["donut","title"],""),ii=h(["donut","onclick"],function(){}),ji=h(["donut","onmouseover"],function(){}),ki=h(["donut","onmouseout"],function(){}),li=h(["regions"],[]),mi=h(["tooltip","show"],!0),ni=h(["tooltip","format","title"]),oi=h(["tooltip","format","value"]),pi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ni?ni:b,l=oi?oi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),qi=h(["tooltip","init","show"],!1),ri=h(["tooltip","init","x"],0),si=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ti=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ui=ti+"-xaxis",vi=ti+"-yaxis",wi=i(ti),xi=i(ui),yi=i(vi),zi="timeseries"===ch,Ai="categorized"===ch,Bi=!zi&&(sg||we(tg)),Ci=null,Di=!1,Ei=!1,Fi=!1,Gi=!1,Hi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ii=qe(Gg,we(Vg)?Vg:Hi,Fg),Ji=dh?wf.time.format:wf.time.format.utc,Ki=function(){var a=[[Ji("%Y/%-m/%-d"),function(){return!0}],[Ji("%-m/%-d"),function(a){return a.getMonth()}],[Ji("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ji("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ji("%I %p"),function(a){return a.getHours()}],[Ji("%I:%M"),function(a){return a.getMinutes()}],[Ji(":%S"),function(a){return a.getSeconds()}],[Ji(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),Li=[],Mi=[],Ni=ah?"left":"bottom",Oi=ah?yh?"top":"bottom":yh?"right":"left",Pi=ah?Hh?"bottom":"top":Hh?"left":"right",Qi=ah?"left":"bottom",Ri={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(ah?0:Rf)+")"},y:function(){return"translate(0,"+(ah?Rf:0)+")"},y2:function(){return"translate("+(ah?0:Pf)+","+(ah?1:0)+")"},subx:function(){return"translate(0,"+(ah?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Si="right"===Xg,Ti=0,Ui=0,Vi=0,Wi=.15,Xi=30,Yi=ah&&!bh?0:30,Zi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var $i,_i=function(){var a=wf.svg.line().x(ah?function(a){return V(a.id)(a.value)}:Cd).y(ah?Cd:function(a){return V(a.id)(a.value)});return Xh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Xh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ah?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a;return a=ah?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ah?"M "+d+" "+c:"M "+c+" "+d)}}(),bj=function(){var a=wf.svg.line().x(ah?function(a){return W(a.id)(a.value)}:Fd).y(ah?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),cj=function(){};$i=wf.svg.brush().on("brush",_e),$i.update=function(){return gj&&gj.select("."+f.brush).call(this),this},$i.scale=function(a){return ah?this.y(a):this.x(a)},Ef&&(cj=wf.behavior.zoom().on("zoomstart",function(){cj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),cj.scale=function(a){return ah?this.y(a):this.x(a)},cj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},cj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(kj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var dj,ej,fj,gj,hj,ij,jj,kj,lj,mj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),dj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&pf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),xf.revert()},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),dj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&qf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),xf.revert()},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){$i.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&Ai&&(eh=a.categories,og.categories(eh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(fj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Ig&&fj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Jg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Kg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Ig&&fj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Jg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Kg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0}) +}ij.html(pi(xf.data.targets.map(function(a){return pc(a.values[ri])}),$(),wd(ee(xf.data.targets)),Ii)),ij.style("top",si.top).style("left",si.left).style("display","block")}null==a.onresize&&(a.onresize=bf()),a.onresize.add&&(a.onresize.add(Jf),a.onresize.add(function(){df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})}),a.onresize.add(Kf))}function Ue(a){a.append("rect").attr("class",fd).style("cursor",Ig&&Jg?"pointer":null).on("mouseover",function(a,b){if(!Di&&!ee(xf.data.targets)){var c,d,e=xf.data.targets.map(function(a){return pc(a.values[b])});if(Object.keys(wg).length>0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(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){ee(xf.data.targets)||Ig&&(Ci=a,fj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Di=!0,Rg())}function Ze(){ee(xf.data.targets)||Ig&&(fj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),fj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Di=!1,Sg())}function $e(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=fj.select("."+f.axisX).style("opacity",W?0:1),g=fj.select("."+f.axisY).style("opacity",W?0:1),h=fj.select("."+f.axisY2).style("opacity",W?0:1),e=gj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Wg&&rf(Cc(xf.data.targets),a,O),Ai&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),kj=ig.domain(),Ef&&cj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),$i.scale(lg)),G&&(ig.domain($i.empty()?kj:$i.extent()),Ef&&cj.scale(ig).updateScaleExtent()),lh||!kh&&!jh||(S=Kc(Jc(X),jh),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(hh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!ah&&mh&&eb(c,O.axisX,mh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),ij.style("display","none"),o(),fj.select("line."+f.xgridFocus).style("visibility","hidden"),Lh){if("year"===Mh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=fj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",ah?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",ah?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",ah?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",ah?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(ah?"y1":"x1")===(ah?Rf:0)?0:1}),i.exit().remove()}we(Nh)&&(k=fj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Nh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",ah?"":"rotate(-90)").attr("dx",ah?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",ah?0:Dd).attr("x2",ah?Pf:Dd).attr("y1",ah?Dd:Mf.top).attr("y2",ah?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",ah?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Oh&&(m=fj.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Qh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",ah?jg:0).attr("x2",ah?jg:Pf).attr("y1",ah?0:jg).attr("y2",ah?Rf:jg),m.exit().remove()),A&&we(Ph)&&(n=fj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Ph),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",ah?"rotate(-90)":"").attr("dx",ah?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",ah?Ed:0).attr("x2",ah?Ed:Pf).attr("y1",ah?0:Ed).attr("y2",ah?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",ah?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=fj.select("."+f.regions).selectAll("rect."+f.region).data(li),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Ii(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=fj.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return ah?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",_i).style("opacity",1),fj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",aj).style("opacity",lj),q=fj.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Sh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud),q.exit().remove(),fj.each(function(){Gi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Gi=!1}),fj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),fj.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Tg&&(null!==wf.event&&"zoom"===wf.event.type&&$i.extent(ig.orgDomain()).update(),B&&(!ah&&mh&&eb(e,O.axisSubX,mh),$i.empty()||$i.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=gj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Ii(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),gj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",bj).style("opacity",1))),fj.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),fj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud),v=fj.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=fj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Bi&&!Ai?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),fj.select("."+f.eventRects).datum(x?x.values:[]),w=fj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",ah?0:y).attr("y",ah?y:0).attr("width",ah?Pf:z).attr("height",ah?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){mj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&cj.altDomain?(ig.domain(cj.altDomain),void cj.scale(ig).updateScaleExtent()):(Ai&&ig.orgDomain()[0]===kj[0]&&ig.domain([kj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Ei=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){dj.attr("width",Tf).attr("height",Uf),dj.select("#"+ti).select("rect").attr("width",Pf).attr("height",Rf),dj.select("#"+ui).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.select("#"+vi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),dj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),jj.style("max-height",Uf+"px")}function df(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=fj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Ii(a)}),e=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Kg(a)?"pointer":null}),c=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ii(a)}),b.append("path").attr("class",dd).style("opacity",function(){return lj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Ii(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Ii(a)}).style("cursor",function(a){return Kg(a)?"pointer":null}),a.forEach(function(a){fj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=fj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Ii(a.data)}).style("cursor",function(a){return Kg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Gi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Gi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Tg&&(n=gj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Ii(a)}),l=gj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ii(a)})),dj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Lf).style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Si?j:i,l=Si?Q():P();return d&&(x=0,D=0,u=0,v=0),Wg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Si?v:u,void(_g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Si?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=hj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Yg?Yg(a):xf.toggle(a)}).on("mouseover",function(a){Gi||xf.focus(a),"function"==typeof Zg&&Zg(a)}).on("mouseout",function(a){Gi||xf.revert(),"function"==typeof $g&&$g(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Si?h:-200).attr("y",Si?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Si?i:-200).attr("y",Si?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Ii(a)}).attr("x",Si?h:-200).attr("y",Si?-200:j).attr("width",10).attr("height",10),hj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),hj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),hj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),hj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){return Gc(a)?1:Wi}),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Gi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"],50),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","hide"],!1),Ig=h(["data","selection","enabled"],!1),Jg=h(["data","selection","grouped"],!1),Kg=h(["data","selection","isselectable"],function(){return!0}),Lg=h(["data","selection","multiple"],!0),Mg=h(["data","onclick"],function(){}),Ng=h(["data","onenter"],function(){}),Og=h(["data","onleave"],function(){}),Pg=h(["data","onselected"],function(){}),Qg=h(["data","onunselected"],function(){}),Rg=h(["data","ondragstart"],function(){}),Sg=h(["data","ondragend"],function(){}),Tg=h(["subchart","show"],!1),Ug=h(["subchart","size","height"],60),Vg=h(["color","pattern"],[]),Wg=h(["legend","show"],!0),Xg=h(["legend","position"],"bottom"),Yg=h(["legend","item","onclick"]),Zg=h(["legend","item","onmouseover"]),$g=h(["legend","item","onmouseout"]),_g=h(["legend","equally"],!1),ah=h(["axis","rotated"],!1),bh=h(["axis","x","show"],!0),ch=h(["axis","x","type"],"indexed"),dh=h(["axis","x","localtime"],!0),eh=h(["axis","x","categories"],[]),fh=h(["axis","x","tick","centered"],!1),gh=h(["axis","x","tick","format"]),hh=h(["axis","x","tick","culling"],{}),ih=h(["axis","x","tick","culling","max"],10),jh=h(["axis","x","tick","count"]),kh=h(["axis","x","tick","fit"],!0),lh=h(["axis","x","tick","values"],null),mh=h(["axis","x","tick","rotate"]),nh=h(["axis","x","max"],null),oh=h(["axis","x","min"],null),ph=h(["axis","x","padding"],{}),qh=h(["axis","x","height"]),rh=h(["axis","x","default"]),sh=h(["axis","x","label"],{}),th=h(["axis","y","show"],!0),uh=h(["axis","y","max"]),vh=h(["axis","y","min"]),wh=h(["axis","y","center"]),xh=h(["axis","y","label"],{}),yh=h(["axis","y","inner"],!1),zh=h(["axis","y","tick","format"]),Ah=h(["axis","y","padding"],{}),Bh=h(["axis","y","ticks"],10),Ch=h(["axis","y2","show"],!1),Dh=h(["axis","y2","max"]),Eh=h(["axis","y2","min"]),Fh=h(["axis","y2","center"]),Gh=h(["axis","y2","label"],{}),Hh=h(["axis","y2","inner"],!1),Ih=h(["axis","y2","tick","format"]),Jh=h(["axis","y2","padding"],{}),Kh=h(["axis","y2","ticks"],10),Lh=h(["grid","x","show"],!1),Mh=h(["grid","x","type"],"tick"),Nh=h(["grid","x","lines"],[]),Oh=h(["grid","y","show"],!1),Ph=h(["grid","y","lines"],[]),Qh=h(["grid","y","ticks"],10),Rh=h(["point","show"],!0),Sh=Rh?h(["point","r"],2.5):0,Th=h(["point","focus","line","enabled"],!0),Uh=h(["point","focus","expand","enabled"],!0),Vh=h(["point","focus","expand","r"],Uh?4:Sh),Wh=h(["point","focus","select","r"],8),Xh=h(["line","connect_null"],!1),Yh=h(["bar","width"]),Zh=h(["bar","width","ratio"],.6),$h=h(["pie","label","show"],!0),_h=h(["pie","label","format"]),ai=h(["pie","expand"],!0),bi=h(["pie","onclick"],function(){}),ci=h(["pie","onmouseover"],function(){}),di=h(["pie","onmouseout"],function(){}),ei=h(["donut","label","show"],!0),fi=h(["donut","label","format"]),gi=h(["donut","expand"],!0),hi=h(["donut","title"],""),ii=h(["donut","onclick"],function(){}),ji=h(["donut","onmouseover"],function(){}),ki=h(["donut","onmouseout"],function(){}),li=h(["regions"],[]),mi=h(["tooltip","show"],!0),ni=h(["tooltip","format","title"]),oi=h(["tooltip","format","value"]),pi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ni?ni:b,l=oi?oi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),qi=h(["tooltip","init","show"],!1),ri=h(["tooltip","init","x"],0),si=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ti=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ui=ti+"-xaxis",vi=ti+"-yaxis",wi=i(ti),xi=i(ui),yi=i(vi),zi="timeseries"===ch,Ai="categorized"===ch,Bi=!zi&&(sg||we(tg)),Ci=null,Di=!1,Ei=!1,Fi=!1,Gi=!1,Hi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ii=qe(Gg,we(Vg)?Vg:Hi,Fg),Ji=dh?wf.time.format:wf.time.format.utc,Ki=function(){var a=[[Ji("%Y/%-m/%-d"),function(){return!0}],[Ji("%-m/%-d"),function(a){return a.getMonth()}],[Ji("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ji("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ji("%I %p"),function(a){return a.getHours()}],[Ji("%I:%M"),function(a){return a.getMinutes()}],[Ji(":%S"),function(a){return a.getSeconds()}],[Ji(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),Li=[],Mi=[],Ni=ah?"left":"bottom",Oi=ah?yh?"top":"bottom":yh?"right":"left",Pi=ah?Hh?"bottom":"top":Hh?"left":"right",Qi=ah?"left":"bottom",Ri={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(ah?0:Rf)+")"},y:function(){return"translate(0,"+(ah?Rf:0)+")"},y2:function(){return"translate("+(ah?0:Pf)+","+(ah?1:0)+")"},subx:function(){return"translate(0,"+(ah?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Si="right"===Xg,Ti=0,Ui=0,Vi=0,Wi=.15,Xi=30,Yi=ah&&!bh?0:30,Zi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var $i,_i=function(){var a=wf.svg.line().x(ah?function(a){return V(a.id)(a.value)}:Cd).y(ah?Cd:function(a){return V(a.id)(a.value)});return Xh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Xh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ah?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a;return a=ah?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ah?"M "+d+" "+c:"M "+c+" "+d)}}(),bj=function(){var a=wf.svg.line().x(ah?function(a){return W(a.id)(a.value)}:Fd).y(ah?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),cj=function(){};$i=wf.svg.brush().on("brush",_e),$i.update=function(){return gj&&gj.select("."+f.brush).call(this),this},$i.scale=function(a){return ah?this.y(a):this.x(a)},Ef&&(cj=wf.behavior.zoom().on("zoomstart",function(){cj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),cj.scale=function(a){return ah?this.y(a):this.x(a)},cj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},cj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(kj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var dj,ej,fj,gj,hj,ij,jj,kj,lj,mj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),dj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&pf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),xf.revert()},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),dj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&qf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),xf.revert()},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){$i.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&Ai&&(eh=a.categories,og.categories(eh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(fj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Ig&&fj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Jg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Kg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Ig&&fj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Jg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Kg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0}) },xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Nh=a,$e(),Nh):Nh},xf.xgrids.add=function(a){return a?xf.xgrids(Nh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a);return xf.xgrids(Nh.filter(b))},xf.ygrids=function(a){return a?(Ph=a,$e(),Ph):Ph},xf.ygrids.add=function(a){return a?xf.ygrids(Ph.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Ph.filter(b))},xf.regions=function(a){return c(a)?li:(li=a,$e(),li)},xf.regions.add=function(a){return c(a)?li:(li=li.concat(a),$e(),li)},xf.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;dj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),li=li.filter(function(b){return b.classes.indexOf(a)<0})}),li},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(vh=+a.y),b(a.y2)&&(Eh=+a.y2)):vh=Eh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0})},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},jj.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 94976e507f261a8c60030610e63ff18bc10ca1ab Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 30 Apr 2014 18:43:13 +0900 Subject: [PATCH 096/178] Add transition for axis label --- c3.js | 3 +++ c3.min.js | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/c3.js b/c3.js index 9072ad8..6141a80 100644 --- a/c3.js +++ b/c3.js @@ -877,17 +877,20 @@ } function updateAxisLabels() { main.select('.' + CLASS.axisX + ' .' + CLASS.axisXLabel) + .transition() .attr("x", xForXAxisLabel) .attr("dx", dxForXAxisLabel) .attr("dy", dyForXAxisLabel) .text(textForXAxisLabel); main.select('.' + CLASS.axisY + ' .' + CLASS.axisYLabel) + .transition() .attr("x", xForYAxisLabel) .attr("dx", dxForYAxisLabel) .attr("dy", dyForYAxisLabel) .attr("dy", dyForYAxisLabel) .text(textForYAxisLabel); main.select('.' + CLASS.axisY2 + ' .' + CLASS.axisY2Label) + .transition() .attr("x", xForY2AxisLabel) .attr("dx", dxForY2AxisLabel) .attr("dy", dyForY2AxisLabel) diff --git a/c3.min.js b/c3.min.js index 400fa4b..699521b 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.33"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cPf&&(Pf=0),0>Rf&&(Rf=0),Qf=ah?Mf.left-Xi-Yi:Pf,Sf=ah?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Si&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){fj.select("line."+f.xgridFocus).attr("x1",ah?0:-10).attr("x2",ah?Pf:-10).attr("y1",ah?-10:Mf.top).attr("y2",ah?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=ah?f.axisX:f.axisY,b=fj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:ah?bh?v("x"):1:!th||yh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Si?P()+(Ch&&!ah?v("y2"):a):Ch?Hh||ah?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||bh?"x"===a&&qh?qh:"y"!==a||th?"y2"!==a||Ch?(jb(a).isInner?30:40)+("y2"===a?-10:0):Zi:Wg&&!Si?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!ah)}function C(){return A(!ah)}function D(){return z(ah)}function E(){return A(ah)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(qh?qh:0)+80:Rf+8}function H(){return F(!ah)}function I(){return G(!ah)}function J(){return F(ah)}function K(){return G(ah)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(Ai?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Ti=a}function N(a){Ui=a}function O(a){Vi=a}function P(){return Wg?Si?Ui*(Ti+1):Tf:0}function Q(){return Wg?Si?Uf:Vi*(Ti+1):0}function R(){var a,b,c=!ig;ag=ah?1:0,bg=ah?Rf:Pf,cg=ah?0:Rf,dg=ah?Pf:1,eg=ag,fg=bg,gg=ah?0:Sf,hg=ah?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,kj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=lh?lh:c?void 0:og.tickValues(),og=X(ig,Ni,a,b),rg=X(lg,Qi,a,b),pg=Y(jg,Oi,zh,Bh),qg=Y(kg,Pi,Ih,Kh),c||($i.scale(lg),Ef&&cj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(zi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Ai){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(Ai?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Ai?(e.tickCentered(fh),ve(hh)&&(hh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},Ai&&e.categories(eh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=zi?Ki:Ai?Tc:function(a){return 0>a?a.toFixed(0):a};return gh&&("function"==typeof gh?a=gh:zi&&(a=function(a){return a?Ji(gh)(a):""})),a}function _(a){var b;return"y"===a?b=xh:"y2"===a?b=Gh:"x"===a&&(b=sh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?xh=b:"y2"===a?Gh=b:"x"===a&&(sh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",ah?"inner-top":"inner-right")}function hb(){return fb("y",ah?"inner-right":"inner-top")}function ib(){return fb("y2",ah?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!ah,gb())}function rb(){return nb(ah,hb())}function sb(){return nb(ah,ib())}function tb(){return ob(!ah,gb())}function ub(){return ob(ah,hb())}function vb(){return ob(ah,ib())}function wb(){var a=gb();return ah?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":qh?qh-10:"3em"}function xb(){var a=hb();return ah?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return ah?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!ah,gb())}function Ab(){return pb(ah,hb())}function Bb(){return pb(ah,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){fj.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),fj.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),fj.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.length>0)for(g=Sc(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 wf.max(Object.keys(i).map(function(a){return wf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Eh:vh,n="y2"===c?Dh:uh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Fh:wh,r=ud()&&ah;return 0===l.length?"y2"===c?kg.domain():jg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(jg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Ah&&(f=b(Ah.top)?Ah.top:e,g=b(Ah.bottom)?Ah.bottom:e),"y2"===c&&Jh&&(f=b(Jh.top)?Jh.top:e,g=b(Jh.bottom)?Jh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return oh?zi?re(oh):oh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return nh?zi?re(nh):nh:wf.max(a,function(a){return wf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Ai?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof ph&&we(ph)?(e=b(ph.left)?ph.left:d,f=b(ph.right)?ph.right:d):e=f="number"==typeof ph?ph:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=zi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=zi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?jg:kg;return b="y"===a.axis||"y2"===a.axis?ah?Rf:"start"in a?d(a.start):Rf:ah?"end"in a?ig(zi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),xf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=zi?a?a instanceof Date?a:re(a):re(mc(c,d)):Bi&&!Ai?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Bi&&Ai&&0===c&&g&&(0===e&&(eh=[]),eh.push(g)),("undefined"==typeof a[b]||xf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&xf.data.targets[0].values[a-1]?xf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(xf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(zi?new Date(i):i);j.push(e)}return zi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Li=Li.concat(a)}function Mc(a){Li=Li.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Mi=Mi.concat(a)}function Oc(a){Mi=Mi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&mi&&(ij.html(pi(a,$(),wd(k),Ii)).style("display","block"),d=ij.property("offsetWidth"),e=ij.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(ah?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),ij.style("top",i+"px").style("left",g+"px"))}function Qd(){ij.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});mi&&(be(xf.data.targets)||ee(xf.data.targets)||fj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(ah?"y1":"x1",Cd).attr(ah?"y2":"x2",Cd))}function Sd(){fj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return"number"==typeof Yh?Yh:b?2*a.tickOffset()*Zh/b:0}function $d(a,b){Dc(a).forEach(function(a){mj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&gi||je(a)&&ai}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=ah?1:0,e=ah?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Pg(b,a.node()),fj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud).attr("stroke",function(){return Ii(b)}).attr("r",1.4*Wh).transition().duration(100).attr("r",Wh)}function Be(a,b,c){Qg(b,a.node()),fj.select("."+f.selectedCircles+ld(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){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Ii(b)).darker(1)})}function Ee(a,b){Qg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ii(b)})}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?fj.selectAll("."+f.circles+ld(c)):fj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Vh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Sh)}function Ke(a){return fj.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=ah?1:0,f=ah?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 ah?(c=he(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.getBoundingClientRect();return ah?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return ah&&(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(jj=wf.select(zf),jj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(jj.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),Hg&&Lc(Hg===!0?Cc(xf.data.targets):Hg),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),kj=ig.domain(),$i.scale(lg),Ef&&cj.scale(ig),dj=jj.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),ej=dj.append("defs"),ej.append("clipPath").attr("id",ti).append("rect").attr("width",Pf).attr("height",Rf),ej.append("clipPath").attr("id",ui).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),ej.append("clipPath").attr("id",vi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),fj=dj.append("g").attr("transform",Ri.main),gj=dj.append("g").attr("transform",Ri.context),hj=dj.append("g").attr("transform",Ri.legend),Tg||gj.style("visibility","hidden"),Wg||(hj.style("visibility","hidden"),Mi=Cc(xf.data.targets)),ij=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),bh&&fj.append("g").attr("class",f.axisX).attr("clip-path",xi).attr("transform",Ri.x).append("text").attr("class",f.axisXLabel).attr("transform",ah?"rotate(-90)":"").style("text-anchor",zb),th&&fj.append("g").attr("class",f.axisY).attr("clip-path",yi).attr("transform",Ri.y).append("text").attr("class",f.axisYLabel).attr("transform",ah?"":"rotate(-90)").style("text-anchor",Ab),Ch&&fj.append("g").attr("class",f.axisY2).attr("transform",Ri.y2).append("text").attr("class",f.axisY2Label).attr("transform",ah?"":"rotate(-90)").style("text-anchor",Bb),d=fj.append("g").attr("clip-path",wi).attr("class",f.grid),Lh&&d.append("g").attr("class",f.xgrids),we(Nh)&&d.append("g").attr("class",f.xgridLines),Th&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Oh&&d.append("g").attr("class",f.ygrids),we(Ph)&&d.append("g").attr("class",f.ygridLines),fj.append("g").attr("clip-path",wi).attr("class",f.regions),fj.append("g").attr("clip-path",wi).attr("class",f.chart),c=fj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?ah?"ns-resize":"ew-resize":null),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Ri.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),fj.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&fj.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",ah?"ns-resize":"ew-resize").call(cj).on("dblclick.zoom",null),rh&&$i.extent("function"!=typeof rh?rh:rh(_b())),gj.append("g").attr("clip-path",wi).attr("class",f.chart),gj.select("."+f.chart).append("g").attr("class",f.chartBars),gj.select("."+f.chart).append("g").attr("class",f.chartLines),gj.append("g").attr("clip-path",wi).attr("class",f.brush).call($i).selectAll("rect").attr(ah?"width":"height",ah?Qf:Sf),gj.append("g").attr("class",f.axisX).attr("transform",Ri.subx).attr("clip-path",ah?"":xi),ef(xf.data.targets),ah?fj.select("."+f.axisX).style("opacity",0).call(og):(fj.select("."+f.axisY).style("opacity",0).call(pg),fj.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),qi){if(zi&&"string"==typeof ri){for(ri=re(ri),e=0;ePf&&(Pf=0),0>Rf&&(Rf=0),Qf=ah?Mf.left-Xi-Yi:Pf,Sf=ah?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Si&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){fj.select("line."+f.xgridFocus).attr("x1",ah?0:-10).attr("x2",ah?Pf:-10).attr("y1",ah?-10:Mf.top).attr("y2",ah?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=ah?f.axisX:f.axisY,b=fj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:ah?bh?v("x"):1:!th||yh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Si?P()+(Ch&&!ah?v("y2"):a):Ch?Hh||ah?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||bh?"x"===a&&qh?qh:"y"!==a||th?"y2"!==a||Ch?(jb(a).isInner?30:40)+("y2"===a?-10:0):Zi:Wg&&!Si?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!ah)}function C(){return A(!ah)}function D(){return z(ah)}function E(){return A(ah)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(qh?qh:0)+80:Rf+8}function H(){return F(!ah)}function I(){return G(!ah)}function J(){return F(ah)}function K(){return G(ah)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(Ai?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Ti=a}function N(a){Ui=a}function O(a){Vi=a}function P(){return Wg?Si?Ui*(Ti+1):Tf:0}function Q(){return Wg?Si?Uf:Vi*(Ti+1):0}function R(){var a,b,c=!ig;ag=ah?1:0,bg=ah?Rf:Pf,cg=ah?0:Rf,dg=ah?Pf:1,eg=ag,fg=bg,gg=ah?0:Sf,hg=ah?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,kj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=lh?lh:c?void 0:og.tickValues(),og=X(ig,Ni,a,b),rg=X(lg,Qi,a,b),pg=Y(jg,Oi,zh,Bh),qg=Y(kg,Pi,Ih,Kh),c||($i.scale(lg),Ef&&cj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(zi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Ai){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(Ai?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Ai?(e.tickCentered(fh),ve(hh)&&(hh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},Ai&&e.categories(eh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=zi?Ki:Ai?Tc:function(a){return 0>a?a.toFixed(0):a};return gh&&("function"==typeof gh?a=gh:zi&&(a=function(a){return a?Ji(gh)(a):""})),a}function _(a){var b;return"y"===a?b=xh:"y2"===a?b=Gh:"x"===a&&(b=sh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?xh=b:"y2"===a?Gh=b:"x"===a&&(sh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",ah?"inner-top":"inner-right")}function hb(){return fb("y",ah?"inner-right":"inner-top")}function ib(){return fb("y2",ah?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!ah,gb())}function rb(){return nb(ah,hb())}function sb(){return nb(ah,ib())}function tb(){return ob(!ah,gb())}function ub(){return ob(ah,hb())}function vb(){return ob(ah,ib())}function wb(){var a=gb();return ah?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":qh?qh-10:"3em"}function xb(){var a=hb();return ah?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return ah?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!ah,gb())}function Ab(){return pb(ah,hb())}function Bb(){return pb(ah,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){fj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),fj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),fj.select("."+f.axisY2+" ."+f.axisY2Label).transition().attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.length>0)for(g=Sc(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 wf.max(Object.keys(i).map(function(a){return wf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Eh:vh,n="y2"===c?Dh:uh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Fh:wh,r=ud()&&ah;return 0===l.length?"y2"===c?kg.domain():jg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(jg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Ah&&(f=b(Ah.top)?Ah.top:e,g=b(Ah.bottom)?Ah.bottom:e),"y2"===c&&Jh&&(f=b(Jh.top)?Jh.top:e,g=b(Jh.bottom)?Jh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return oh?zi?re(oh):oh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return nh?zi?re(nh):nh:wf.max(a,function(a){return wf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Ai?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof ph&&we(ph)?(e=b(ph.left)?ph.left:d,f=b(ph.right)?ph.right:d):e=f="number"==typeof ph?ph:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=zi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=zi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?jg:kg;return b="y"===a.axis||"y2"===a.axis?ah?Rf:"start"in a?d(a.start):Rf:ah?"end"in a?ig(zi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),xf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=zi?a?a instanceof Date?a:re(a):re(mc(c,d)):Bi&&!Ai?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Bi&&Ai&&0===c&&g&&(0===e&&(eh=[]),eh.push(g)),("undefined"==typeof a[b]||xf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&xf.data.targets[0].values[a-1]?xf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(xf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(zi?new Date(i):i);j.push(e)}return zi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Li=Li.concat(a)}function Mc(a){Li=Li.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Mi=Mi.concat(a)}function Oc(a){Mi=Mi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&mi&&(ij.html(pi(a,$(),wd(k),Ii)).style("display","block"),d=ij.property("offsetWidth"),e=ij.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(ah?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),ij.style("top",i+"px").style("left",g+"px"))}function Qd(){ij.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});mi&&(be(xf.data.targets)||ee(xf.data.targets)||fj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(ah?"y1":"x1",Cd).attr(ah?"y2":"x2",Cd))}function Sd(){fj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return"number"==typeof Yh?Yh:b?2*a.tickOffset()*Zh/b:0}function $d(a,b){Dc(a).forEach(function(a){mj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&gi||je(a)&&ai}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=ah?1:0,e=ah?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Pg(b,a.node()),fj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud).attr("stroke",function(){return Ii(b)}).attr("r",1.4*Wh).transition().duration(100).attr("r",Wh)}function Be(a,b,c){Qg(b,a.node()),fj.select("."+f.selectedCircles+ld(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){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Ii(b)).darker(1)})}function Ee(a,b){Qg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ii(b)})}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?fj.selectAll("."+f.circles+ld(c)):fj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Vh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Sh)}function Ke(a){return fj.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=ah?1:0,f=ah?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 ah?(c=he(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.getBoundingClientRect();return ah?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return ah&&(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(jj=wf.select(zf),jj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(jj.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),Hg&&Lc(Hg===!0?Cc(xf.data.targets):Hg),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),kj=ig.domain(),$i.scale(lg),Ef&&cj.scale(ig),dj=jj.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),ej=dj.append("defs"),ej.append("clipPath").attr("id",ti).append("rect").attr("width",Pf).attr("height",Rf),ej.append("clipPath").attr("id",ui).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),ej.append("clipPath").attr("id",vi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),fj=dj.append("g").attr("transform",Ri.main),gj=dj.append("g").attr("transform",Ri.context),hj=dj.append("g").attr("transform",Ri.legend),Tg||gj.style("visibility","hidden"),Wg||(hj.style("visibility","hidden"),Mi=Cc(xf.data.targets)),ij=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),bh&&fj.append("g").attr("class",f.axisX).attr("clip-path",xi).attr("transform",Ri.x).append("text").attr("class",f.axisXLabel).attr("transform",ah?"rotate(-90)":"").style("text-anchor",zb),th&&fj.append("g").attr("class",f.axisY).attr("clip-path",yi).attr("transform",Ri.y).append("text").attr("class",f.axisYLabel).attr("transform",ah?"":"rotate(-90)").style("text-anchor",Ab),Ch&&fj.append("g").attr("class",f.axisY2).attr("transform",Ri.y2).append("text").attr("class",f.axisY2Label).attr("transform",ah?"":"rotate(-90)").style("text-anchor",Bb),d=fj.append("g").attr("clip-path",wi).attr("class",f.grid),Lh&&d.append("g").attr("class",f.xgrids),we(Nh)&&d.append("g").attr("class",f.xgridLines),Th&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Oh&&d.append("g").attr("class",f.ygrids),we(Ph)&&d.append("g").attr("class",f.ygridLines),fj.append("g").attr("clip-path",wi).attr("class",f.regions),fj.append("g").attr("clip-path",wi).attr("class",f.chart),c=fj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?ah?"ns-resize":"ew-resize":null),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Ri.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),fj.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&fj.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",ah?"ns-resize":"ew-resize").call(cj).on("dblclick.zoom",null),rh&&$i.extent("function"!=typeof rh?rh:rh(_b())),gj.append("g").attr("clip-path",wi).attr("class",f.chart),gj.select("."+f.chart).append("g").attr("class",f.chartBars),gj.select("."+f.chart).append("g").attr("class",f.chartLines),gj.append("g").attr("clip-path",wi).attr("class",f.brush).call($i).selectAll("rect").attr(ah?"width":"height",ah?Qf:Sf),gj.append("g").attr("class",f.axisX).attr("transform",Ri.subx).attr("clip-path",ah?"":xi),ef(xf.data.targets),ah?fj.select("."+f.axisX).style("opacity",0).call(og):(fj.select("."+f.axisY).style("opacity",0).call(pg),fj.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),qi){if(zi&&"string"==typeof ri){for(ri=re(ri),e=0;e0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(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){ee(xf.data.targets)||Ig&&(Ci=a,fj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Di=!0,Rg())}function Ze(){ee(xf.data.targets)||Ig&&(fj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),fj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Di=!1,Sg())}function $e(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=fj.select("."+f.axisX).style("opacity",W?0:1),g=fj.select("."+f.axisY).style("opacity",W?0:1),h=fj.select("."+f.axisY2).style("opacity",W?0:1),e=gj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Wg&&rf(Cc(xf.data.targets),a,O),Ai&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),kj=ig.domain(),Ef&&cj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),$i.scale(lg)),G&&(ig.domain($i.empty()?kj:$i.extent()),Ef&&cj.scale(ig).updateScaleExtent()),lh||!kh&&!jh||(S=Kc(Jc(X),jh),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(hh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!ah&&mh&&eb(c,O.axisX,mh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),ij.style("display","none"),o(),fj.select("line."+f.xgridFocus).style("visibility","hidden"),Lh){if("year"===Mh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=fj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",ah?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",ah?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",ah?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",ah?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(ah?"y1":"x1")===(ah?Rf:0)?0:1}),i.exit().remove()}we(Nh)&&(k=fj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Nh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",ah?"":"rotate(-90)").attr("dx",ah?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",ah?0:Dd).attr("x2",ah?Pf:Dd).attr("y1",ah?Dd:Mf.top).attr("y2",ah?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",ah?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Oh&&(m=fj.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Qh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",ah?jg:0).attr("x2",ah?jg:Pf).attr("y1",ah?0:jg).attr("y2",ah?Rf:jg),m.exit().remove()),A&&we(Ph)&&(n=fj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Ph),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",ah?"rotate(-90)":"").attr("dx",ah?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",ah?Ed:0).attr("x2",ah?Ed:Pf).attr("y1",ah?0:Ed).attr("y2",ah?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",ah?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=fj.select("."+f.regions).selectAll("rect."+f.region).data(li),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Ii(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=fj.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return ah?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",_i).style("opacity",1),fj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",aj).style("opacity",lj),q=fj.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Sh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud),q.exit().remove(),fj.each(function(){Gi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Gi=!1}),fj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),fj.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Tg&&(null!==wf.event&&"zoom"===wf.event.type&&$i.extent(ig.orgDomain()).update(),B&&(!ah&&mh&&eb(e,O.axisSubX,mh),$i.empty()||$i.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=gj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Ii(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),gj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",bj).style("opacity",1))),fj.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),fj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud),v=fj.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=fj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Bi&&!Ai?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),fj.select("."+f.eventRects).datum(x?x.values:[]),w=fj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",ah?0:y).attr("y",ah?y:0).attr("width",ah?Pf:z).attr("height",ah?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){mj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&cj.altDomain?(ig.domain(cj.altDomain),void cj.scale(ig).updateScaleExtent()):(Ai&&ig.orgDomain()[0]===kj[0]&&ig.domain([kj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Ei=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){dj.attr("width",Tf).attr("height",Uf),dj.select("#"+ti).select("rect").attr("width",Pf).attr("height",Rf),dj.select("#"+ui).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.select("#"+vi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),dj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),jj.style("max-height",Uf+"px")}function df(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=fj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Ii(a)}),e=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Kg(a)?"pointer":null}),c=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ii(a)}),b.append("path").attr("class",dd).style("opacity",function(){return lj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Ii(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Ii(a)}).style("cursor",function(a){return Kg(a)?"pointer":null}),a.forEach(function(a){fj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=fj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Ii(a.data)}).style("cursor",function(a){return Kg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Gi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Gi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Tg&&(n=gj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Ii(a)}),l=gj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ii(a)})),dj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Lf).style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Si?j:i,l=Si?Q():P();return d&&(x=0,D=0,u=0,v=0),Wg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Si?v:u,void(_g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Si?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=hj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Yg?Yg(a):xf.toggle(a)}).on("mouseover",function(a){Gi||xf.focus(a),"function"==typeof Zg&&Zg(a)}).on("mouseout",function(a){Gi||xf.revert(),"function"==typeof $g&&$g(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Si?h:-200).attr("y",Si?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Si?i:-200).attr("y",Si?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Ii(a)}).attr("x",Si?h:-200).attr("y",Si?-200:j).attr("width",10).attr("height",10),hj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),hj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),hj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),hj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){return Gc(a)?1:Wi}),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Gi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"],50),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","hide"],!1),Ig=h(["data","selection","enabled"],!1),Jg=h(["data","selection","grouped"],!1),Kg=h(["data","selection","isselectable"],function(){return!0}),Lg=h(["data","selection","multiple"],!0),Mg=h(["data","onclick"],function(){}),Ng=h(["data","onenter"],function(){}),Og=h(["data","onleave"],function(){}),Pg=h(["data","onselected"],function(){}),Qg=h(["data","onunselected"],function(){}),Rg=h(["data","ondragstart"],function(){}),Sg=h(["data","ondragend"],function(){}),Tg=h(["subchart","show"],!1),Ug=h(["subchart","size","height"],60),Vg=h(["color","pattern"],[]),Wg=h(["legend","show"],!0),Xg=h(["legend","position"],"bottom"),Yg=h(["legend","item","onclick"]),Zg=h(["legend","item","onmouseover"]),$g=h(["legend","item","onmouseout"]),_g=h(["legend","equally"],!1),ah=h(["axis","rotated"],!1),bh=h(["axis","x","show"],!0),ch=h(["axis","x","type"],"indexed"),dh=h(["axis","x","localtime"],!0),eh=h(["axis","x","categories"],[]),fh=h(["axis","x","tick","centered"],!1),gh=h(["axis","x","tick","format"]),hh=h(["axis","x","tick","culling"],{}),ih=h(["axis","x","tick","culling","max"],10),jh=h(["axis","x","tick","count"]),kh=h(["axis","x","tick","fit"],!0),lh=h(["axis","x","tick","values"],null),mh=h(["axis","x","tick","rotate"]),nh=h(["axis","x","max"],null),oh=h(["axis","x","min"],null),ph=h(["axis","x","padding"],{}),qh=h(["axis","x","height"]),rh=h(["axis","x","default"]),sh=h(["axis","x","label"],{}),th=h(["axis","y","show"],!0),uh=h(["axis","y","max"]),vh=h(["axis","y","min"]),wh=h(["axis","y","center"]),xh=h(["axis","y","label"],{}),yh=h(["axis","y","inner"],!1),zh=h(["axis","y","tick","format"]),Ah=h(["axis","y","padding"],{}),Bh=h(["axis","y","ticks"],10),Ch=h(["axis","y2","show"],!1),Dh=h(["axis","y2","max"]),Eh=h(["axis","y2","min"]),Fh=h(["axis","y2","center"]),Gh=h(["axis","y2","label"],{}),Hh=h(["axis","y2","inner"],!1),Ih=h(["axis","y2","tick","format"]),Jh=h(["axis","y2","padding"],{}),Kh=h(["axis","y2","ticks"],10),Lh=h(["grid","x","show"],!1),Mh=h(["grid","x","type"],"tick"),Nh=h(["grid","x","lines"],[]),Oh=h(["grid","y","show"],!1),Ph=h(["grid","y","lines"],[]),Qh=h(["grid","y","ticks"],10),Rh=h(["point","show"],!0),Sh=Rh?h(["point","r"],2.5):0,Th=h(["point","focus","line","enabled"],!0),Uh=h(["point","focus","expand","enabled"],!0),Vh=h(["point","focus","expand","r"],Uh?4:Sh),Wh=h(["point","focus","select","r"],8),Xh=h(["line","connect_null"],!1),Yh=h(["bar","width"]),Zh=h(["bar","width","ratio"],.6),$h=h(["pie","label","show"],!0),_h=h(["pie","label","format"]),ai=h(["pie","expand"],!0),bi=h(["pie","onclick"],function(){}),ci=h(["pie","onmouseover"],function(){}),di=h(["pie","onmouseout"],function(){}),ei=h(["donut","label","show"],!0),fi=h(["donut","label","format"]),gi=h(["donut","expand"],!0),hi=h(["donut","title"],""),ii=h(["donut","onclick"],function(){}),ji=h(["donut","onmouseover"],function(){}),ki=h(["donut","onmouseout"],function(){}),li=h(["regions"],[]),mi=h(["tooltip","show"],!0),ni=h(["tooltip","format","title"]),oi=h(["tooltip","format","value"]),pi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ni?ni:b,l=oi?oi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),qi=h(["tooltip","init","show"],!1),ri=h(["tooltip","init","x"],0),si=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ti=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ui=ti+"-xaxis",vi=ti+"-yaxis",wi=i(ti),xi=i(ui),yi=i(vi),zi="timeseries"===ch,Ai="categorized"===ch,Bi=!zi&&(sg||we(tg)),Ci=null,Di=!1,Ei=!1,Fi=!1,Gi=!1,Hi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ii=qe(Gg,we(Vg)?Vg:Hi,Fg),Ji=dh?wf.time.format:wf.time.format.utc,Ki=function(){var a=[[Ji("%Y/%-m/%-d"),function(){return!0}],[Ji("%-m/%-d"),function(a){return a.getMonth()}],[Ji("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ji("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ji("%I %p"),function(a){return a.getHours()}],[Ji("%I:%M"),function(a){return a.getMinutes()}],[Ji(":%S"),function(a){return a.getSeconds()}],[Ji(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),Li=[],Mi=[],Ni=ah?"left":"bottom",Oi=ah?yh?"top":"bottom":yh?"right":"left",Pi=ah?Hh?"bottom":"top":Hh?"left":"right",Qi=ah?"left":"bottom",Ri={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(ah?0:Rf)+")"},y:function(){return"translate(0,"+(ah?Rf:0)+")"},y2:function(){return"translate("+(ah?0:Pf)+","+(ah?1:0)+")"},subx:function(){return"translate(0,"+(ah?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Si="right"===Xg,Ti=0,Ui=0,Vi=0,Wi=.15,Xi=30,Yi=ah&&!bh?0:30,Zi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var $i,_i=function(){var a=wf.svg.line().x(ah?function(a){return V(a.id)(a.value)}:Cd).y(ah?Cd:function(a){return V(a.id)(a.value)});return Xh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Xh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ah?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a;return a=ah?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ah?"M "+d+" "+c:"M "+c+" "+d)}}(),bj=function(){var a=wf.svg.line().x(ah?function(a){return W(a.id)(a.value)}:Fd).y(ah?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),cj=function(){};$i=wf.svg.brush().on("brush",_e),$i.update=function(){return gj&&gj.select("."+f.brush).call(this),this},$i.scale=function(a){return ah?this.y(a):this.x(a)},Ef&&(cj=wf.behavior.zoom().on("zoomstart",function(){cj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),cj.scale=function(a){return ah?this.y(a):this.x(a)},cj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},cj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(kj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var dj,ej,fj,gj,hj,ij,jj,kj,lj,mj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),dj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&pf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),xf.revert()},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),dj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&qf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),xf.revert()},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){$i.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&Ai&&(eh=a.categories,og.categories(eh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(fj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Ig&&fj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Jg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Kg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Ig&&fj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Jg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Kg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0}) },xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Nh=a,$e(),Nh):Nh},xf.xgrids.add=function(a){return a?xf.xgrids(Nh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a);return xf.xgrids(Nh.filter(b))},xf.ygrids=function(a){return a?(Ph=a,$e(),Ph):Ph},xf.ygrids.add=function(a){return a?xf.ygrids(Ph.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Ph.filter(b))},xf.regions=function(a){return c(a)?li:(li=a,$e(),li)},xf.regions.add=function(a){return c(a)?li:(li=li.concat(a),$e(),li)},xf.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;dj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),li=li.filter(function(b){return b.classes.indexOf(a)<0})}),li},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(vh=+a.y),b(a.y2)&&(Eh=+a.y2)):vh=Eh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0})},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},jj.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 71a74885def39708b62916b8a35f265814206119 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 30 Apr 2014 19:37:34 +0900 Subject: [PATCH 097/178] Remove revert when show/hide --- c3.js | 21 +++++++++------------ c3.min.js | 6 +++--- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/c3.js b/c3.js index 6141a80..40398a7 100644 --- a/c3.js +++ b/c3.js @@ -2630,7 +2630,7 @@ // MEMO: call here to update legend box and tranlate for all // MEMO: translate will be upated by this, so transform not needed in updateLegend() - updateLegend(mapToIds(c3.data.targets), {withTransform: false, withTransitionForTransform: false}); + updateLegend(mapToIds(c3.data.targets), {withTransform: false, withTransitionForTransform: false, withLegendState: true}); /*-- Main Region --*/ @@ -3960,12 +3960,11 @@ var xForLegend, xForLegendText, xForLegendRect, yForLegend, yForLegendText, yForLegendRect; var paddingTop = 4, paddingRight = 26, maxWidth = 0, maxHeight = 0, posMin = 10; var l, totalLength = 0, offsets = {}, widths = {}, heights = {}, margins = [0], steps = {}, step = 0; - var withTransition, withTransitionForTransform, withTransformAll; + var withTransition, withTransitionForTransform; options = options || {}; withTransition = isDefined(options.withTransition) ? options.withTransition : true; withTransitionForTransform = isDefined(options.withTransitionForTransform) ? options.withTransitionForTransform : true; - withTransformAll = isDefined(options.withTransformAll) ? options.withTransformAll : true; function updatePositions(textElement, id, reset) { var box = textElement.getBoundingClientRect(), @@ -4108,10 +4107,12 @@ .attr('y', yForLegend); // toggle legend state - legend.selectAll('.' + CLASS.legendItem) - .classed(CLASS.legendItemHidden, function (id) { return !isTargetToShow(id); }) - .transition() - .style('opacity', function (id) { return isTargetToShow(id) ? 1 : legendOpacityForHidden; }); + if (options.withLegendState) { + legend.selectAll('.' + CLASS.legendItem) + .classed(CLASS.legendItemHidden, function (id) { return !isTargetToShow(id); }) + .transition() + .style('opacity', function (id) { return isTargetToShow(id) ? 1 : legendOpacityForHidden; }); + } // Update all to reflect change of legend updateLegendItemWidth(maxWidth); @@ -4122,9 +4123,7 @@ updateScales(); updateSvgSize(); // Update g positions - if (withTransformAll) { - transformAll(withTransitionForTransform, transitions); - } + transformAll(withTransitionForTransform, transitions); } /*-- Event Handling --*/ @@ -4209,7 +4208,6 @@ } redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: true}); - c3.revert(); }; c3.hide = function (targetIds, options) { @@ -4226,7 +4224,6 @@ } redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: true}); - c3.revert(); }; c3.toggle = function (targetId) { diff --git a/c3.min.js b/c3.min.js index 699521b..9fe583e 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.33"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cPf&&(Pf=0),0>Rf&&(Rf=0),Qf=ah?Mf.left-Xi-Yi:Pf,Sf=ah?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Si&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){fj.select("line."+f.xgridFocus).attr("x1",ah?0:-10).attr("x2",ah?Pf:-10).attr("y1",ah?-10:Mf.top).attr("y2",ah?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=ah?f.axisX:f.axisY,b=fj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:ah?bh?v("x"):1:!th||yh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Si?P()+(Ch&&!ah?v("y2"):a):Ch?Hh||ah?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||bh?"x"===a&&qh?qh:"y"!==a||th?"y2"!==a||Ch?(jb(a).isInner?30:40)+("y2"===a?-10:0):Zi:Wg&&!Si?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!ah)}function C(){return A(!ah)}function D(){return z(ah)}function E(){return A(ah)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(qh?qh:0)+80:Rf+8}function H(){return F(!ah)}function I(){return G(!ah)}function J(){return F(ah)}function K(){return G(ah)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(Ai?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Ti=a}function N(a){Ui=a}function O(a){Vi=a}function P(){return Wg?Si?Ui*(Ti+1):Tf:0}function Q(){return Wg?Si?Uf:Vi*(Ti+1):0}function R(){var a,b,c=!ig;ag=ah?1:0,bg=ah?Rf:Pf,cg=ah?0:Rf,dg=ah?Pf:1,eg=ag,fg=bg,gg=ah?0:Sf,hg=ah?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,kj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=lh?lh:c?void 0:og.tickValues(),og=X(ig,Ni,a,b),rg=X(lg,Qi,a,b),pg=Y(jg,Oi,zh,Bh),qg=Y(kg,Pi,Ih,Kh),c||($i.scale(lg),Ef&&cj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(zi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Ai){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(Ai?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Ai?(e.tickCentered(fh),ve(hh)&&(hh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},Ai&&e.categories(eh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=zi?Ki:Ai?Tc:function(a){return 0>a?a.toFixed(0):a};return gh&&("function"==typeof gh?a=gh:zi&&(a=function(a){return a?Ji(gh)(a):""})),a}function _(a){var b;return"y"===a?b=xh:"y2"===a?b=Gh:"x"===a&&(b=sh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?xh=b:"y2"===a?Gh=b:"x"===a&&(sh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",ah?"inner-top":"inner-right")}function hb(){return fb("y",ah?"inner-right":"inner-top")}function ib(){return fb("y2",ah?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!ah,gb())}function rb(){return nb(ah,hb())}function sb(){return nb(ah,ib())}function tb(){return ob(!ah,gb())}function ub(){return ob(ah,hb())}function vb(){return ob(ah,ib())}function wb(){var a=gb();return ah?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":qh?qh-10:"3em"}function xb(){var a=hb();return ah?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return ah?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!ah,gb())}function Ab(){return pb(ah,hb())}function Bb(){return pb(ah,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){fj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),fj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),fj.select("."+f.axisY2+" ."+f.axisY2Label).transition().attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.length>0)for(g=Sc(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 wf.max(Object.keys(i).map(function(a){return wf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Eh:vh,n="y2"===c?Dh:uh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Fh:wh,r=ud()&&ah;return 0===l.length?"y2"===c?kg.domain():jg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(jg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Ah&&(f=b(Ah.top)?Ah.top:e,g=b(Ah.bottom)?Ah.bottom:e),"y2"===c&&Jh&&(f=b(Jh.top)?Jh.top:e,g=b(Jh.bottom)?Jh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return oh?zi?re(oh):oh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return nh?zi?re(nh):nh:wf.max(a,function(a){return wf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Ai?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof ph&&we(ph)?(e=b(ph.left)?ph.left:d,f=b(ph.right)?ph.right:d):e=f="number"==typeof ph?ph:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=zi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=zi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?jg:kg;return b="y"===a.axis||"y2"===a.axis?ah?Rf:"start"in a?d(a.start):Rf:ah?"end"in a?ig(zi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),xf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=zi?a?a instanceof Date?a:re(a):re(mc(c,d)):Bi&&!Ai?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Bi&&Ai&&0===c&&g&&(0===e&&(eh=[]),eh.push(g)),("undefined"==typeof a[b]||xf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&xf.data.targets[0].values[a-1]?xf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(xf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(zi?new Date(i):i);j.push(e)}return zi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Li=Li.concat(a)}function Mc(a){Li=Li.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Mi=Mi.concat(a)}function Oc(a){Mi=Mi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&mi&&(ij.html(pi(a,$(),wd(k),Ii)).style("display","block"),d=ij.property("offsetWidth"),e=ij.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(ah?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),ij.style("top",i+"px").style("left",g+"px"))}function Qd(){ij.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});mi&&(be(xf.data.targets)||ee(xf.data.targets)||fj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(ah?"y1":"x1",Cd).attr(ah?"y2":"x2",Cd))}function Sd(){fj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return"number"==typeof Yh?Yh:b?2*a.tickOffset()*Zh/b:0}function $d(a,b){Dc(a).forEach(function(a){mj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&gi||je(a)&&ai}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=ah?1:0,e=ah?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Pg(b,a.node()),fj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud).attr("stroke",function(){return Ii(b)}).attr("r",1.4*Wh).transition().duration(100).attr("r",Wh)}function Be(a,b,c){Qg(b,a.node()),fj.select("."+f.selectedCircles+ld(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){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Ii(b)).darker(1)})}function Ee(a,b){Qg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ii(b)})}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?fj.selectAll("."+f.circles+ld(c)):fj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Vh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Sh)}function Ke(a){return fj.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=ah?1:0,f=ah?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 ah?(c=he(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.getBoundingClientRect();return ah?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return ah&&(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(jj=wf.select(zf),jj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(jj.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),Hg&&Lc(Hg===!0?Cc(xf.data.targets):Hg),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),kj=ig.domain(),$i.scale(lg),Ef&&cj.scale(ig),dj=jj.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),ej=dj.append("defs"),ej.append("clipPath").attr("id",ti).append("rect").attr("width",Pf).attr("height",Rf),ej.append("clipPath").attr("id",ui).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),ej.append("clipPath").attr("id",vi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),fj=dj.append("g").attr("transform",Ri.main),gj=dj.append("g").attr("transform",Ri.context),hj=dj.append("g").attr("transform",Ri.legend),Tg||gj.style("visibility","hidden"),Wg||(hj.style("visibility","hidden"),Mi=Cc(xf.data.targets)),ij=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),bh&&fj.append("g").attr("class",f.axisX).attr("clip-path",xi).attr("transform",Ri.x).append("text").attr("class",f.axisXLabel).attr("transform",ah?"rotate(-90)":"").style("text-anchor",zb),th&&fj.append("g").attr("class",f.axisY).attr("clip-path",yi).attr("transform",Ri.y).append("text").attr("class",f.axisYLabel).attr("transform",ah?"":"rotate(-90)").style("text-anchor",Ab),Ch&&fj.append("g").attr("class",f.axisY2).attr("transform",Ri.y2).append("text").attr("class",f.axisY2Label).attr("transform",ah?"":"rotate(-90)").style("text-anchor",Bb),d=fj.append("g").attr("clip-path",wi).attr("class",f.grid),Lh&&d.append("g").attr("class",f.xgrids),we(Nh)&&d.append("g").attr("class",f.xgridLines),Th&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Oh&&d.append("g").attr("class",f.ygrids),we(Ph)&&d.append("g").attr("class",f.ygridLines),fj.append("g").attr("clip-path",wi).attr("class",f.regions),fj.append("g").attr("clip-path",wi).attr("class",f.chart),c=fj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?ah?"ns-resize":"ew-resize":null),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Ri.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),fj.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&fj.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",ah?"ns-resize":"ew-resize").call(cj).on("dblclick.zoom",null),rh&&$i.extent("function"!=typeof rh?rh:rh(_b())),gj.append("g").attr("clip-path",wi).attr("class",f.chart),gj.select("."+f.chart).append("g").attr("class",f.chartBars),gj.select("."+f.chart).append("g").attr("class",f.chartLines),gj.append("g").attr("clip-path",wi).attr("class",f.brush).call($i).selectAll("rect").attr(ah?"width":"height",ah?Qf:Sf),gj.append("g").attr("class",f.axisX).attr("transform",Ri.subx).attr("clip-path",ah?"":xi),ef(xf.data.targets),ah?fj.select("."+f.axisX).style("opacity",0).call(og):(fj.select("."+f.axisY).style("opacity",0).call(pg),fj.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),qi){if(zi&&"string"==typeof ri){for(ri=re(ri),e=0;e0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(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){ee(xf.data.targets)||Ig&&(Ci=a,fj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Di=!0,Rg())}function Ze(){ee(xf.data.targets)||Ig&&(fj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),fj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Di=!1,Sg())}function $e(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=fj.select("."+f.axisX).style("opacity",W?0:1),g=fj.select("."+f.axisY).style("opacity",W?0:1),h=fj.select("."+f.axisY2).style("opacity",W?0:1),e=gj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Wg&&rf(Cc(xf.data.targets),a,O),Ai&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),kj=ig.domain(),Ef&&cj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),$i.scale(lg)),G&&(ig.domain($i.empty()?kj:$i.extent()),Ef&&cj.scale(ig).updateScaleExtent()),lh||!kh&&!jh||(S=Kc(Jc(X),jh),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(hh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!ah&&mh&&eb(c,O.axisX,mh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),ij.style("display","none"),o(),fj.select("line."+f.xgridFocus).style("visibility","hidden"),Lh){if("year"===Mh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=fj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",ah?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",ah?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",ah?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",ah?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(ah?"y1":"x1")===(ah?Rf:0)?0:1}),i.exit().remove()}we(Nh)&&(k=fj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Nh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",ah?"":"rotate(-90)").attr("dx",ah?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",ah?0:Dd).attr("x2",ah?Pf:Dd).attr("y1",ah?Dd:Mf.top).attr("y2",ah?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",ah?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Oh&&(m=fj.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Qh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",ah?jg:0).attr("x2",ah?jg:Pf).attr("y1",ah?0:jg).attr("y2",ah?Rf:jg),m.exit().remove()),A&&we(Ph)&&(n=fj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Ph),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",ah?"rotate(-90)":"").attr("dx",ah?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",ah?Ed:0).attr("x2",ah?Ed:Pf).attr("y1",ah?0:Ed).attr("y2",ah?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",ah?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=fj.select("."+f.regions).selectAll("rect."+f.region).data(li),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Ii(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=fj.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return ah?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",_i).style("opacity",1),fj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",aj).style("opacity",lj),q=fj.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Sh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud),q.exit().remove(),fj.each(function(){Gi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Gi=!1}),fj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),fj.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Tg&&(null!==wf.event&&"zoom"===wf.event.type&&$i.extent(ig.orgDomain()).update(),B&&(!ah&&mh&&eb(e,O.axisSubX,mh),$i.empty()||$i.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=gj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Ii(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),gj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",bj).style("opacity",1))),fj.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),fj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud),v=fj.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=fj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Bi&&!Ai?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),fj.select("."+f.eventRects).datum(x?x.values:[]),w=fj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",ah?0:y).attr("y",ah?y:0).attr("width",ah?Pf:z).attr("height",ah?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){mj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&cj.altDomain?(ig.domain(cj.altDomain),void cj.scale(ig).updateScaleExtent()):(Ai&&ig.orgDomain()[0]===kj[0]&&ig.domain([kj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Ei=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){dj.attr("width",Tf).attr("height",Uf),dj.select("#"+ti).select("rect").attr("width",Pf).attr("height",Rf),dj.select("#"+ui).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.select("#"+vi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),dj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),jj.style("max-height",Uf+"px")}function df(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=fj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Ii(a)}),e=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Kg(a)?"pointer":null}),c=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ii(a)}),b.append("path").attr("class",dd).style("opacity",function(){return lj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Ii(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Ii(a)}).style("cursor",function(a){return Kg(a)?"pointer":null}),a.forEach(function(a){fj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=fj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Ii(a.data)}).style("cursor",function(a){return Kg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Gi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Gi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Tg&&(n=gj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Ii(a)}),l=gj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ii(a)})),dj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Lf).style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Si?j:i,l=Si?Q():P();return d&&(x=0,D=0,u=0,v=0),Wg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Si?v:u,void(_g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Si?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=hj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Yg?Yg(a):xf.toggle(a)}).on("mouseover",function(a){Gi||xf.focus(a),"function"==typeof Zg&&Zg(a)}).on("mouseout",function(a){Gi||xf.revert(),"function"==typeof $g&&$g(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Si?h:-200).attr("y",Si?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Si?i:-200).attr("y",Si?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Ii(a)}).attr("x",Si?h:-200).attr("y",Si?-200:j).attr("width",10).attr("height",10),hj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),hj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),hj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),hj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){return Gc(a)?1:Wi}),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Gi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"],50),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","hide"],!1),Ig=h(["data","selection","enabled"],!1),Jg=h(["data","selection","grouped"],!1),Kg=h(["data","selection","isselectable"],function(){return!0}),Lg=h(["data","selection","multiple"],!0),Mg=h(["data","onclick"],function(){}),Ng=h(["data","onenter"],function(){}),Og=h(["data","onleave"],function(){}),Pg=h(["data","onselected"],function(){}),Qg=h(["data","onunselected"],function(){}),Rg=h(["data","ondragstart"],function(){}),Sg=h(["data","ondragend"],function(){}),Tg=h(["subchart","show"],!1),Ug=h(["subchart","size","height"],60),Vg=h(["color","pattern"],[]),Wg=h(["legend","show"],!0),Xg=h(["legend","position"],"bottom"),Yg=h(["legend","item","onclick"]),Zg=h(["legend","item","onmouseover"]),$g=h(["legend","item","onmouseout"]),_g=h(["legend","equally"],!1),ah=h(["axis","rotated"],!1),bh=h(["axis","x","show"],!0),ch=h(["axis","x","type"],"indexed"),dh=h(["axis","x","localtime"],!0),eh=h(["axis","x","categories"],[]),fh=h(["axis","x","tick","centered"],!1),gh=h(["axis","x","tick","format"]),hh=h(["axis","x","tick","culling"],{}),ih=h(["axis","x","tick","culling","max"],10),jh=h(["axis","x","tick","count"]),kh=h(["axis","x","tick","fit"],!0),lh=h(["axis","x","tick","values"],null),mh=h(["axis","x","tick","rotate"]),nh=h(["axis","x","max"],null),oh=h(["axis","x","min"],null),ph=h(["axis","x","padding"],{}),qh=h(["axis","x","height"]),rh=h(["axis","x","default"]),sh=h(["axis","x","label"],{}),th=h(["axis","y","show"],!0),uh=h(["axis","y","max"]),vh=h(["axis","y","min"]),wh=h(["axis","y","center"]),xh=h(["axis","y","label"],{}),yh=h(["axis","y","inner"],!1),zh=h(["axis","y","tick","format"]),Ah=h(["axis","y","padding"],{}),Bh=h(["axis","y","ticks"],10),Ch=h(["axis","y2","show"],!1),Dh=h(["axis","y2","max"]),Eh=h(["axis","y2","min"]),Fh=h(["axis","y2","center"]),Gh=h(["axis","y2","label"],{}),Hh=h(["axis","y2","inner"],!1),Ih=h(["axis","y2","tick","format"]),Jh=h(["axis","y2","padding"],{}),Kh=h(["axis","y2","ticks"],10),Lh=h(["grid","x","show"],!1),Mh=h(["grid","x","type"],"tick"),Nh=h(["grid","x","lines"],[]),Oh=h(["grid","y","show"],!1),Ph=h(["grid","y","lines"],[]),Qh=h(["grid","y","ticks"],10),Rh=h(["point","show"],!0),Sh=Rh?h(["point","r"],2.5):0,Th=h(["point","focus","line","enabled"],!0),Uh=h(["point","focus","expand","enabled"],!0),Vh=h(["point","focus","expand","r"],Uh?4:Sh),Wh=h(["point","focus","select","r"],8),Xh=h(["line","connect_null"],!1),Yh=h(["bar","width"]),Zh=h(["bar","width","ratio"],.6),$h=h(["pie","label","show"],!0),_h=h(["pie","label","format"]),ai=h(["pie","expand"],!0),bi=h(["pie","onclick"],function(){}),ci=h(["pie","onmouseover"],function(){}),di=h(["pie","onmouseout"],function(){}),ei=h(["donut","label","show"],!0),fi=h(["donut","label","format"]),gi=h(["donut","expand"],!0),hi=h(["donut","title"],""),ii=h(["donut","onclick"],function(){}),ji=h(["donut","onmouseover"],function(){}),ki=h(["donut","onmouseout"],function(){}),li=h(["regions"],[]),mi=h(["tooltip","show"],!0),ni=h(["tooltip","format","title"]),oi=h(["tooltip","format","value"]),pi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ni?ni:b,l=oi?oi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),qi=h(["tooltip","init","show"],!1),ri=h(["tooltip","init","x"],0),si=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ti=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ui=ti+"-xaxis",vi=ti+"-yaxis",wi=i(ti),xi=i(ui),yi=i(vi),zi="timeseries"===ch,Ai="categorized"===ch,Bi=!zi&&(sg||we(tg)),Ci=null,Di=!1,Ei=!1,Fi=!1,Gi=!1,Hi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ii=qe(Gg,we(Vg)?Vg:Hi,Fg),Ji=dh?wf.time.format:wf.time.format.utc,Ki=function(){var a=[[Ji("%Y/%-m/%-d"),function(){return!0}],[Ji("%-m/%-d"),function(a){return a.getMonth()}],[Ji("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ji("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ji("%I %p"),function(a){return a.getHours()}],[Ji("%I:%M"),function(a){return a.getMinutes()}],[Ji(":%S"),function(a){return a.getSeconds()}],[Ji(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),Li=[],Mi=[],Ni=ah?"left":"bottom",Oi=ah?yh?"top":"bottom":yh?"right":"left",Pi=ah?Hh?"bottom":"top":Hh?"left":"right",Qi=ah?"left":"bottom",Ri={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(ah?0:Rf)+")"},y:function(){return"translate(0,"+(ah?Rf:0)+")"},y2:function(){return"translate("+(ah?0:Pf)+","+(ah?1:0)+")"},subx:function(){return"translate(0,"+(ah?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Si="right"===Xg,Ti=0,Ui=0,Vi=0,Wi=.15,Xi=30,Yi=ah&&!bh?0:30,Zi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var $i,_i=function(){var a=wf.svg.line().x(ah?function(a){return V(a.id)(a.value)}:Cd).y(ah?Cd:function(a){return V(a.id)(a.value)});return Xh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Xh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ah?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a;return a=ah?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ah?"M "+d+" "+c:"M "+c+" "+d)}}(),bj=function(){var a=wf.svg.line().x(ah?function(a){return W(a.id)(a.value)}:Fd).y(ah?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),cj=function(){};$i=wf.svg.brush().on("brush",_e),$i.update=function(){return gj&&gj.select("."+f.brush).call(this),this},$i.scale=function(a){return ah?this.y(a):this.x(a)},Ef&&(cj=wf.behavior.zoom().on("zoomstart",function(){cj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),cj.scale=function(a){return ah?this.y(a):this.x(a)},cj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},cj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(kj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var dj,ej,fj,gj,hj,ij,jj,kj,lj,mj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),dj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&pf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),xf.revert()},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),dj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&qf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),xf.revert()},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){$i.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&Ai&&(eh=a.categories,og.categories(eh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(fj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Ig&&fj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Jg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Kg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Ig&&fj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Jg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Kg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0}) -},xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Nh=a,$e(),Nh):Nh},xf.xgrids.add=function(a){return a?xf.xgrids(Nh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a);return xf.xgrids(Nh.filter(b))},xf.ygrids=function(a){return a?(Ph=a,$e(),Ph):Ph},xf.ygrids.add=function(a){return a?xf.ygrids(Ph.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Ph.filter(b))},xf.regions=function(a){return c(a)?li:(li=a,$e(),li)},xf.regions.add=function(a){return c(a)?li:(li=li.concat(a),$e(),li)},xf.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;dj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),li=li.filter(function(b){return b.classes.indexOf(a)<0})}),li},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(vh=+a.y),b(a.y2)&&(Eh=+a.y2)):vh=Eh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0})},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},jj.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"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.33"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cPf&&(Pf=0),0>Rf&&(Rf=0),Qf=ah?Mf.left-Xi-Yi:Pf,Sf=ah?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Si&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){fj.select("line."+f.xgridFocus).attr("x1",ah?0:-10).attr("x2",ah?Pf:-10).attr("y1",ah?-10:Mf.top).attr("y2",ah?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=ah?f.axisX:f.axisY,b=fj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:ah?bh?v("x"):1:!th||yh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Si?P()+(Ch&&!ah?v("y2"):a):Ch?Hh||ah?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||bh?"x"===a&&qh?qh:"y"!==a||th?"y2"!==a||Ch?(jb(a).isInner?30:40)+("y2"===a?-10:0):Zi:Wg&&!Si?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!ah)}function C(){return A(!ah)}function D(){return z(ah)}function E(){return A(ah)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(qh?qh:0)+80:Rf+8}function H(){return F(!ah)}function I(){return G(!ah)}function J(){return F(ah)}function K(){return G(ah)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(Ai?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Ti=a}function N(a){Ui=a}function O(a){Vi=a}function P(){return Wg?Si?Ui*(Ti+1):Tf:0}function Q(){return Wg?Si?Uf:Vi*(Ti+1):0}function R(){var a,b,c=!ig;ag=ah?1:0,bg=ah?Rf:Pf,cg=ah?0:Rf,dg=ah?Pf:1,eg=ag,fg=bg,gg=ah?0:Sf,hg=ah?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,kj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=lh?lh:c?void 0:og.tickValues(),og=X(ig,Ni,a,b),rg=X(lg,Qi,a,b),pg=Y(jg,Oi,zh,Bh),qg=Y(kg,Pi,Ih,Kh),c||($i.scale(lg),Ef&&cj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(zi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Ai){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(Ai?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Ai?(e.tickCentered(fh),ve(hh)&&(hh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},Ai&&e.categories(eh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=zi?Ki:Ai?Tc:function(a){return 0>a?a.toFixed(0):a};return gh&&("function"==typeof gh?a=gh:zi&&(a=function(a){return a?Ji(gh)(a):""})),a}function _(a){var b;return"y"===a?b=xh:"y2"===a?b=Gh:"x"===a&&(b=sh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?xh=b:"y2"===a?Gh=b:"x"===a&&(sh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",ah?"inner-top":"inner-right")}function hb(){return fb("y",ah?"inner-right":"inner-top")}function ib(){return fb("y2",ah?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!ah,gb())}function rb(){return nb(ah,hb())}function sb(){return nb(ah,ib())}function tb(){return ob(!ah,gb())}function ub(){return ob(ah,hb())}function vb(){return ob(ah,ib())}function wb(){var a=gb();return ah?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":qh?qh-10:"3em"}function xb(){var a=hb();return ah?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return ah?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!ah,gb())}function Ab(){return pb(ah,hb())}function Bb(){return pb(ah,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){fj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),fj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),fj.select("."+f.axisY2+" ."+f.axisY2Label).transition().attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.length>0)for(g=Sc(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 wf.max(Object.keys(i).map(function(a){return wf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Eh:vh,n="y2"===c?Dh:uh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Fh:wh,r=ud()&&ah;return 0===l.length?"y2"===c?kg.domain():jg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(jg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Ah&&(f=b(Ah.top)?Ah.top:e,g=b(Ah.bottom)?Ah.bottom:e),"y2"===c&&Jh&&(f=b(Jh.top)?Jh.top:e,g=b(Jh.bottom)?Jh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return oh?zi?re(oh):oh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return nh?zi?re(nh):nh:wf.max(a,function(a){return wf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Ai?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof ph&&we(ph)?(e=b(ph.left)?ph.left:d,f=b(ph.right)?ph.right:d):e=f="number"==typeof ph?ph:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=zi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=zi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?jg:kg;return b="y"===a.axis||"y2"===a.axis?ah?Rf:"start"in a?d(a.start):Rf:ah?"end"in a?ig(zi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),xf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=zi?a?a instanceof Date?a:re(a):re(mc(c,d)):Bi&&!Ai?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Bi&&Ai&&0===c&&g&&(0===e&&(eh=[]),eh.push(g)),("undefined"==typeof a[b]||xf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&xf.data.targets[0].values[a-1]?xf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(xf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(zi?new Date(i):i);j.push(e)}return zi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Li=Li.concat(a)}function Mc(a){Li=Li.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Mi=Mi.concat(a)}function Oc(a){Mi=Mi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&mi&&(ij.html(pi(a,$(),wd(k),Ii)).style("display","block"),d=ij.property("offsetWidth"),e=ij.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(ah?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),ij.style("top",i+"px").style("left",g+"px"))}function Qd(){ij.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});mi&&(be(xf.data.targets)||ee(xf.data.targets)||fj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(ah?"y1":"x1",Cd).attr(ah?"y2":"x2",Cd))}function Sd(){fj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return"number"==typeof Yh?Yh:b?2*a.tickOffset()*Zh/b:0}function $d(a,b){Dc(a).forEach(function(a){mj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&gi||je(a)&&ai}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=ah?1:0,e=ah?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Pg(b,a.node()),fj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud).attr("stroke",function(){return Ii(b)}).attr("r",1.4*Wh).transition().duration(100).attr("r",Wh)}function Be(a,b,c){Qg(b,a.node()),fj.select("."+f.selectedCircles+ld(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){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Ii(b)).darker(1)})}function Ee(a,b){Qg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ii(b)})}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?fj.selectAll("."+f.circles+ld(c)):fj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Vh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Sh)}function Ke(a){return fj.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=ah?1:0,f=ah?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 ah?(c=he(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.getBoundingClientRect();return ah?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return ah&&(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(jj=wf.select(zf),jj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(jj.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),Hg&&Lc(Hg===!0?Cc(xf.data.targets):Hg),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),kj=ig.domain(),$i.scale(lg),Ef&&cj.scale(ig),dj=jj.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),ej=dj.append("defs"),ej.append("clipPath").attr("id",ti).append("rect").attr("width",Pf).attr("height",Rf),ej.append("clipPath").attr("id",ui).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),ej.append("clipPath").attr("id",vi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),fj=dj.append("g").attr("transform",Ri.main),gj=dj.append("g").attr("transform",Ri.context),hj=dj.append("g").attr("transform",Ri.legend),Tg||gj.style("visibility","hidden"),Wg||(hj.style("visibility","hidden"),Mi=Cc(xf.data.targets)),ij=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1,withLegendState:!0}),bh&&fj.append("g").attr("class",f.axisX).attr("clip-path",xi).attr("transform",Ri.x).append("text").attr("class",f.axisXLabel).attr("transform",ah?"rotate(-90)":"").style("text-anchor",zb),th&&fj.append("g").attr("class",f.axisY).attr("clip-path",yi).attr("transform",Ri.y).append("text").attr("class",f.axisYLabel).attr("transform",ah?"":"rotate(-90)").style("text-anchor",Ab),Ch&&fj.append("g").attr("class",f.axisY2).attr("transform",Ri.y2).append("text").attr("class",f.axisY2Label).attr("transform",ah?"":"rotate(-90)").style("text-anchor",Bb),d=fj.append("g").attr("clip-path",wi).attr("class",f.grid),Lh&&d.append("g").attr("class",f.xgrids),we(Nh)&&d.append("g").attr("class",f.xgridLines),Th&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Oh&&d.append("g").attr("class",f.ygrids),we(Ph)&&d.append("g").attr("class",f.ygridLines),fj.append("g").attr("clip-path",wi).attr("class",f.regions),fj.append("g").attr("clip-path",wi).attr("class",f.chart),c=fj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?ah?"ns-resize":"ew-resize":null),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Ri.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),fj.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&fj.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",ah?"ns-resize":"ew-resize").call(cj).on("dblclick.zoom",null),rh&&$i.extent("function"!=typeof rh?rh:rh(_b())),gj.append("g").attr("clip-path",wi).attr("class",f.chart),gj.select("."+f.chart).append("g").attr("class",f.chartBars),gj.select("."+f.chart).append("g").attr("class",f.chartLines),gj.append("g").attr("clip-path",wi).attr("class",f.brush).call($i).selectAll("rect").attr(ah?"width":"height",ah?Qf:Sf),gj.append("g").attr("class",f.axisX).attr("transform",Ri.subx).attr("clip-path",ah?"":xi),ef(xf.data.targets),ah?fj.select("."+f.axisX).style("opacity",0).call(og):(fj.select("."+f.axisY).style("opacity",0).call(pg),fj.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),qi){if(zi&&"string"==typeof ri){for(ri=re(ri),e=0;e0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(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){ee(xf.data.targets)||Ig&&(Ci=a,fj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Di=!0,Rg())}function Ze(){ee(xf.data.targets)||Ig&&(fj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),fj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Di=!1,Sg())}function $e(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=fj.select("."+f.axisX).style("opacity",W?0:1),g=fj.select("."+f.axisY).style("opacity",W?0:1),h=fj.select("."+f.axisY2).style("opacity",W?0:1),e=gj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Wg&&rf(Cc(xf.data.targets),a,O),Ai&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),kj=ig.domain(),Ef&&cj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),$i.scale(lg)),G&&(ig.domain($i.empty()?kj:$i.extent()),Ef&&cj.scale(ig).updateScaleExtent()),lh||!kh&&!jh||(S=Kc(Jc(X),jh),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(hh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!ah&&mh&&eb(c,O.axisX,mh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),ij.style("display","none"),o(),fj.select("line."+f.xgridFocus).style("visibility","hidden"),Lh){if("year"===Mh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=fj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",ah?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",ah?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",ah?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",ah?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(ah?"y1":"x1")===(ah?Rf:0)?0:1}),i.exit().remove()}we(Nh)&&(k=fj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Nh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",ah?"":"rotate(-90)").attr("dx",ah?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",ah?0:Dd).attr("x2",ah?Pf:Dd).attr("y1",ah?Dd:Mf.top).attr("y2",ah?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",ah?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Oh&&(m=fj.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Qh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",ah?jg:0).attr("x2",ah?jg:Pf).attr("y1",ah?0:jg).attr("y2",ah?Rf:jg),m.exit().remove()),A&&we(Ph)&&(n=fj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Ph),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",ah?"rotate(-90)":"").attr("dx",ah?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",ah?Ed:0).attr("x2",ah?Ed:Pf).attr("y1",ah?0:Ed).attr("y2",ah?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",ah?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=fj.select("."+f.regions).selectAll("rect."+f.region).data(li),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Ii(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=fj.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return ah?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",_i).style("opacity",1),fj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",aj).style("opacity",lj),q=fj.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Sh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud),q.exit().remove(),fj.each(function(){Gi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Gi=!1}),fj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),fj.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Tg&&(null!==wf.event&&"zoom"===wf.event.type&&$i.extent(ig.orgDomain()).update(),B&&(!ah&&mh&&eb(e,O.axisSubX,mh),$i.empty()||$i.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=gj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Ii(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),gj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",bj).style("opacity",1))),fj.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),fj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud),v=fj.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=fj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Bi&&!Ai?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),fj.select("."+f.eventRects).datum(x?x.values:[]),w=fj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",ah?0:y).attr("y",ah?y:0).attr("width",ah?Pf:z).attr("height",ah?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){mj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&cj.altDomain?(ig.domain(cj.altDomain),void cj.scale(ig).updateScaleExtent()):(Ai&&ig.orgDomain()[0]===kj[0]&&ig.domain([kj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Ei=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){dj.attr("width",Tf).attr("height",Uf),dj.select("#"+ti).select("rect").attr("width",Pf).attr("height",Rf),dj.select("#"+ui).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.select("#"+vi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),dj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),jj.style("max-height",Uf+"px")}function df(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=fj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Ii(a)}),e=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Kg(a)?"pointer":null}),c=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ii(a)}),b.append("path").attr("class",dd).style("opacity",function(){return lj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Ii(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Ii(a)}).style("cursor",function(a){return Kg(a)?"pointer":null}),a.forEach(function(a){fj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=fj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Ii(a.data)}).style("cursor",function(a){return Kg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Gi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Gi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Tg&&(n=gj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Ii(a)}),l=gj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ii(a)})),dj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Lf).style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Si?j:i,l=Si?Q():P();return d&&(w=0,C=0,t=0,u=0),Wg&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Si?u:t,void(_g?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,Si?(g=function(a){return t*(.2+B[a])},j=function(a){return A[B[a]]+x[a]}):(g=function(a){return A[B[a]]+x[a]},j=function(a){return u*(.2+B[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=hj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Yg?Yg(a):xf.toggle(a)}).on("mouseover",function(a){Gi||xf.focus(a),"function"==typeof Zg&&Zg(a)}).on("mouseout",function(a){Gi||xf.revert(),"function"==typeof $g&&$g(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Si?h:-200).attr("y",Si?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Si?i:-200).attr("y",Si?-200:l).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Ii(a)}).attr("x",Si?h:-200).attr("y",Si?-200:j).attr("width",10).attr("height",10),hj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),hj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),hj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),b.withLegendState&&hj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){return Gc(a)?1:Wi}),N(t),O(u),M(C),n(),R(),cf(),m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Gi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"],50),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","hide"],!1),Ig=h(["data","selection","enabled"],!1),Jg=h(["data","selection","grouped"],!1),Kg=h(["data","selection","isselectable"],function(){return!0}),Lg=h(["data","selection","multiple"],!0),Mg=h(["data","onclick"],function(){}),Ng=h(["data","onenter"],function(){}),Og=h(["data","onleave"],function(){}),Pg=h(["data","onselected"],function(){}),Qg=h(["data","onunselected"],function(){}),Rg=h(["data","ondragstart"],function(){}),Sg=h(["data","ondragend"],function(){}),Tg=h(["subchart","show"],!1),Ug=h(["subchart","size","height"],60),Vg=h(["color","pattern"],[]),Wg=h(["legend","show"],!0),Xg=h(["legend","position"],"bottom"),Yg=h(["legend","item","onclick"]),Zg=h(["legend","item","onmouseover"]),$g=h(["legend","item","onmouseout"]),_g=h(["legend","equally"],!1),ah=h(["axis","rotated"],!1),bh=h(["axis","x","show"],!0),ch=h(["axis","x","type"],"indexed"),dh=h(["axis","x","localtime"],!0),eh=h(["axis","x","categories"],[]),fh=h(["axis","x","tick","centered"],!1),gh=h(["axis","x","tick","format"]),hh=h(["axis","x","tick","culling"],{}),ih=h(["axis","x","tick","culling","max"],10),jh=h(["axis","x","tick","count"]),kh=h(["axis","x","tick","fit"],!0),lh=h(["axis","x","tick","values"],null),mh=h(["axis","x","tick","rotate"]),nh=h(["axis","x","max"],null),oh=h(["axis","x","min"],null),ph=h(["axis","x","padding"],{}),qh=h(["axis","x","height"]),rh=h(["axis","x","default"]),sh=h(["axis","x","label"],{}),th=h(["axis","y","show"],!0),uh=h(["axis","y","max"]),vh=h(["axis","y","min"]),wh=h(["axis","y","center"]),xh=h(["axis","y","label"],{}),yh=h(["axis","y","inner"],!1),zh=h(["axis","y","tick","format"]),Ah=h(["axis","y","padding"],{}),Bh=h(["axis","y","ticks"],10),Ch=h(["axis","y2","show"],!1),Dh=h(["axis","y2","max"]),Eh=h(["axis","y2","min"]),Fh=h(["axis","y2","center"]),Gh=h(["axis","y2","label"],{}),Hh=h(["axis","y2","inner"],!1),Ih=h(["axis","y2","tick","format"]),Jh=h(["axis","y2","padding"],{}),Kh=h(["axis","y2","ticks"],10),Lh=h(["grid","x","show"],!1),Mh=h(["grid","x","type"],"tick"),Nh=h(["grid","x","lines"],[]),Oh=h(["grid","y","show"],!1),Ph=h(["grid","y","lines"],[]),Qh=h(["grid","y","ticks"],10),Rh=h(["point","show"],!0),Sh=Rh?h(["point","r"],2.5):0,Th=h(["point","focus","line","enabled"],!0),Uh=h(["point","focus","expand","enabled"],!0),Vh=h(["point","focus","expand","r"],Uh?4:Sh),Wh=h(["point","focus","select","r"],8),Xh=h(["line","connect_null"],!1),Yh=h(["bar","width"]),Zh=h(["bar","width","ratio"],.6),$h=h(["pie","label","show"],!0),_h=h(["pie","label","format"]),ai=h(["pie","expand"],!0),bi=h(["pie","onclick"],function(){}),ci=h(["pie","onmouseover"],function(){}),di=h(["pie","onmouseout"],function(){}),ei=h(["donut","label","show"],!0),fi=h(["donut","label","format"]),gi=h(["donut","expand"],!0),hi=h(["donut","title"],""),ii=h(["donut","onclick"],function(){}),ji=h(["donut","onmouseover"],function(){}),ki=h(["donut","onmouseout"],function(){}),li=h(["regions"],[]),mi=h(["tooltip","show"],!0),ni=h(["tooltip","format","title"]),oi=h(["tooltip","format","value"]),pi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ni?ni:b,l=oi?oi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),qi=h(["tooltip","init","show"],!1),ri=h(["tooltip","init","x"],0),si=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ti=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ui=ti+"-xaxis",vi=ti+"-yaxis",wi=i(ti),xi=i(ui),yi=i(vi),zi="timeseries"===ch,Ai="categorized"===ch,Bi=!zi&&(sg||we(tg)),Ci=null,Di=!1,Ei=!1,Fi=!1,Gi=!1,Hi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ii=qe(Gg,we(Vg)?Vg:Hi,Fg),Ji=dh?wf.time.format:wf.time.format.utc,Ki=function(){var a=[[Ji("%Y/%-m/%-d"),function(){return!0}],[Ji("%-m/%-d"),function(a){return a.getMonth()}],[Ji("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ji("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ji("%I %p"),function(a){return a.getHours()}],[Ji("%I:%M"),function(a){return a.getMinutes()}],[Ji(":%S"),function(a){return a.getSeconds()}],[Ji(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),Li=[],Mi=[],Ni=ah?"left":"bottom",Oi=ah?yh?"top":"bottom":yh?"right":"left",Pi=ah?Hh?"bottom":"top":Hh?"left":"right",Qi=ah?"left":"bottom",Ri={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(ah?0:Rf)+")"},y:function(){return"translate(0,"+(ah?Rf:0)+")"},y2:function(){return"translate("+(ah?0:Pf)+","+(ah?1:0)+")"},subx:function(){return"translate(0,"+(ah?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Si="right"===Xg,Ti=0,Ui=0,Vi=0,Wi=.15,Xi=30,Yi=ah&&!bh?0:30,Zi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var $i,_i=function(){var a=wf.svg.line().x(ah?function(a){return V(a.id)(a.value)}:Cd).y(ah?Cd:function(a){return V(a.id)(a.value)});return Xh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Xh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ah?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a;return a=ah?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ah?"M "+d+" "+c:"M "+c+" "+d)}}(),bj=function(){var a=wf.svg.line().x(ah?function(a){return W(a.id)(a.value)}:Fd).y(ah?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),cj=function(){};$i=wf.svg.brush().on("brush",_e),$i.update=function(){return gj&&gj.select("."+f.brush).call(this),this},$i.scale=function(a){return ah?this.y(a):this.x(a)},Ef&&(cj=wf.behavior.zoom().on("zoomstart",function(){cj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),cj.scale=function(a){return ah?this.y(a):this.x(a)},cj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},cj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(kj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var dj,ej,fj,gj,hj,ij,jj,kj,lj,mj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),dj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&pf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),dj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&qf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){$i.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&Ai&&(eh=a.categories,og.categories(eh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(fj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Ig&&fj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Jg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Kg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Ig&&fj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Jg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Kg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0})},xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg) +},xf.xgrids=function(a){return a?(Nh=a,$e(),Nh):Nh},xf.xgrids.add=function(a){return a?xf.xgrids(Nh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a);return xf.xgrids(Nh.filter(b))},xf.ygrids=function(a){return a?(Ph=a,$e(),Ph):Ph},xf.ygrids.add=function(a){return a?xf.ygrids(Ph.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Ph.filter(b))},xf.regions=function(a){return c(a)?li:(li=a,$e(),li)},xf.regions.add=function(a){return c(a)?li:(li=li.concat(a),$e(),li)},xf.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;dj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),li=li.filter(function(b){return b.classes.indexOf(a)<0})}),li},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(vh=+a.y),b(a.y2)&&(Eh=+a.y2)):vh=Eh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0})},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},jj.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From a4bee876973b8650a72ee4f9a8da43540cedfacb Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 30 Apr 2014 22:18:45 +0900 Subject: [PATCH 098/178] Refactor legend --- c3.js | 64 ++++++++++++++++++++++++++++++++++--------------------- c3.min.js | 6 +++--- 2 files changed, 43 insertions(+), 27 deletions(-) diff --git a/c3.js b/c3.js index 40398a7..a5e3d97 100644 --- a/c3.js +++ b/c3.js @@ -61,6 +61,7 @@ legendItemEvent: 'c3-legend-item-event', legendItemTile: 'c3-legend-item-tile', legendItemHidden: 'c3-legend-item-hidden', + legendItemFocused: 'c3-legend-item-focused', dragarea: 'c3-dragarea', EXPANDED: '_expanded_', SELECTED: '_selected_', @@ -351,7 +352,6 @@ function transformMain(withTransition, transitions) { var xAxis, yAxis, y2Axis; - if (transitions && transitions.axisX) { xAxis = transitions.axisX; } else { @@ -370,7 +370,6 @@ y2Axis = main.select('.' + CLASS.axisY2); if (withTransition) { y2Axis = y2Axis.transition(); } } - main.attr("transform", translate.main); xAxis.attr("transform", translate.x); yAxis.attr("transform", translate.y); @@ -378,14 +377,18 @@ main.select('.' + CLASS.chartArcs).attr("transform", translate.arc); } function transformContext(withTransition, transitions) { - var duration = withTransition !== false ? 250 : 0, - subXAxis = (transitions && transitions.axisSubX) ? transitions.axisSubX : context.select('.' + CLASS.axisX).transition().duration(duration); + var subXAxis; + if (transitions && transitions.axisSubX) { + subXAxis = transitions.axisSubX; + } else { + subXAxis = context.select('.' + CLASS.axisX); + if (withTransition) { subXAxis = subXAxis.transition(); } + } context.attr("transform", translate.context); subXAxis.attr("transform", translate.subx); } function transformLegend(withTransition) { - var duration = withTransition !== false ? 250 : 0; - legend.transition().duration(duration).attr("transform", translate.legend); + (withTransition ? legend.transition() : legend).attr("transform", translate.legend); } function transformAll(withTransition, transitions) { transformMain(withTransition, transitions); @@ -2630,7 +2633,7 @@ // MEMO: call here to update legend box and tranlate for all // MEMO: translate will be upated by this, so transform not needed in updateLegend() - updateLegend(mapToIds(c3.data.targets), {withTransform: false, withTransitionForTransform: false, withLegendState: true}); + updateLegend(mapToIds(c3.data.targets), {withTransform: false, withTransitionForTransform: false}); /*-- Main Region --*/ @@ -3910,18 +3913,23 @@ /*-- Draw Legend --*/ - function opacityForLegend(id) { - return d3.select(selectorLegend(id)).classed(CLASS.legendItemHidden) ? legendOpacityForHidden : 1; + function opacityForLegend(legendItem) { + return legendItem.classed(CLASS.legendItemHidden) ? legendOpacityForHidden : 1; } - function opacityForUnfocusedLegend(id) { - return d3.select(selectorLegend(id)).classed(CLASS.legendItemHidden) ? legendOpacityForHidden : 0.3; + function opacityForUnfocusedLegend(legendItem) { + return legendItem.classed(CLASS.legendItemHidden) ? legendOpacityForHidden : 0.3; } function toggleFocusLegend(id, focus) { - var legendItem = legend.selectAll('.' + CLASS.legendItem), - isTarget = function (d) { return (!id || d === id); }, - notTarget = function (d) { return !isTarget(d); }; - legendItem.filter(notTarget).transition().duration(100).style('opacity', focus ? opacityForUnfocusedLegend : opacityForLegend); - legendItem.filter(isTarget).transition().duration(100).style('opacity', focus ? opacityForLegend : opacityForUnfocusedLegend); + legend.selectAll('.' + CLASS.legendItem) + .transition().duration(100) + .style('opacity', function (_id) { + var This = d3.select(this); + if (id && _id !== id) { + return focus ? opacityForUnfocusedLegend(This) : opacityForLegend(This); + } else { + return focus ? opacityForLegend(This) : opacityForUnfocusedLegend(This); + } + }); } function focusLegend(id) { toggleFocusLegend(id, true); @@ -3932,7 +3940,7 @@ function revertLegend() { legend.selectAll('.' + CLASS.legendItem) .transition().duration(100) - .style('opacity', opacityForLegend); + .style('opacity', function () { return opacityForLegend(d3.select(this)); }); } function showLegend(targetIds) { if (!__legend_show) { @@ -3943,7 +3951,7 @@ legend.selectAll(selectorLegends(targetIds)) .style('visibility', 'visible') .transition() - .style('opacity', opacityForLegend); + .style('opacity', function () { return opacityForLegend(d3.select(this)); }); } function hideLegend(targetIds) { if (__legend_show && isEmpty(targetIds)) { @@ -3961,6 +3969,7 @@ var paddingTop = 4, paddingRight = 26, maxWidth = 0, maxHeight = 0, posMin = 10; var l, totalLength = 0, offsets = {}, widths = {}, heights = {}, margins = [0], steps = {}, step = 0; var withTransition, withTransitionForTransform; + var hasFocused = legend.selectAll('.' + CLASS.legendItemFocused).size(); options = options || {}; withTransition = isDefined(options.withTransition) ? options.withTransition : true; @@ -4049,6 +4058,7 @@ typeof __legend_item_onclick === 'function' ? __legend_item_onclick(id) : c3.toggle(id); }) .on('mouseover', function (id) { + d3.select(this).classed(CLASS.legendItemFocused, true); if (!transiting) { c3.focus(id); } @@ -4057,6 +4067,7 @@ } }) .on('mouseout', function (id) { + d3.select(this).classed(CLASS.legendItemFocused, false); if (!transiting) { c3.revert(); } @@ -4107,12 +4118,17 @@ .attr('y', yForLegend); // toggle legend state - if (options.withLegendState) { - legend.selectAll('.' + CLASS.legendItem) - .classed(CLASS.legendItemHidden, function (id) { return !isTargetToShow(id); }) - .transition() - .style('opacity', function (id) { return isTargetToShow(id) ? 1 : legendOpacityForHidden; }); - } + legend.selectAll('.' + CLASS.legendItem) + .classed(CLASS.legendItemHidden, function (id) { return !isTargetToShow(id); }) + .transition() + .style('opacity', function (id) { + var This = d3.select(this); + if (isTargetToShow(id)) { + return !hasFocused || This.classed(CLASS.legendItemFocused) ? opacityForLegend(This) : opacityForUnfocusedLegend(This); + } else { + return legendOpacityForHidden; + } + }); // Update all to reflect change of legend updateLegendItemWidth(maxWidth); diff --git a/c3.min.js b/c3.min.js index 9fe583e..051f91b 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.33"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cPf&&(Pf=0),0>Rf&&(Rf=0),Qf=ah?Mf.left-Xi-Yi:Pf,Sf=ah?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Si&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){fj.select("line."+f.xgridFocus).attr("x1",ah?0:-10).attr("x2",ah?Pf:-10).attr("y1",ah?-10:Mf.top).attr("y2",ah?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=ah?f.axisX:f.axisY,b=fj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:ah?bh?v("x"):1:!th||yh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Si?P()+(Ch&&!ah?v("y2"):a):Ch?Hh||ah?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||bh?"x"===a&&qh?qh:"y"!==a||th?"y2"!==a||Ch?(jb(a).isInner?30:40)+("y2"===a?-10:0):Zi:Wg&&!Si?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!ah)}function C(){return A(!ah)}function D(){return z(ah)}function E(){return A(ah)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(qh?qh:0)+80:Rf+8}function H(){return F(!ah)}function I(){return G(!ah)}function J(){return F(ah)}function K(){return G(ah)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(Ai?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Ti=a}function N(a){Ui=a}function O(a){Vi=a}function P(){return Wg?Si?Ui*(Ti+1):Tf:0}function Q(){return Wg?Si?Uf:Vi*(Ti+1):0}function R(){var a,b,c=!ig;ag=ah?1:0,bg=ah?Rf:Pf,cg=ah?0:Rf,dg=ah?Pf:1,eg=ag,fg=bg,gg=ah?0:Sf,hg=ah?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,kj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=lh?lh:c?void 0:og.tickValues(),og=X(ig,Ni,a,b),rg=X(lg,Qi,a,b),pg=Y(jg,Oi,zh,Bh),qg=Y(kg,Pi,Ih,Kh),c||($i.scale(lg),Ef&&cj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(zi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Ai){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(Ai?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Ai?(e.tickCentered(fh),ve(hh)&&(hh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},Ai&&e.categories(eh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=zi?Ki:Ai?Tc:function(a){return 0>a?a.toFixed(0):a};return gh&&("function"==typeof gh?a=gh:zi&&(a=function(a){return a?Ji(gh)(a):""})),a}function _(a){var b;return"y"===a?b=xh:"y2"===a?b=Gh:"x"===a&&(b=sh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?xh=b:"y2"===a?Gh=b:"x"===a&&(sh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",ah?"inner-top":"inner-right")}function hb(){return fb("y",ah?"inner-right":"inner-top")}function ib(){return fb("y2",ah?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!ah,gb())}function rb(){return nb(ah,hb())}function sb(){return nb(ah,ib())}function tb(){return ob(!ah,gb())}function ub(){return ob(ah,hb())}function vb(){return ob(ah,ib())}function wb(){var a=gb();return ah?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":qh?qh-10:"3em"}function xb(){var a=hb();return ah?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return ah?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!ah,gb())}function Ab(){return pb(ah,hb())}function Bb(){return pb(ah,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){fj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),fj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),fj.select("."+f.axisY2+" ."+f.axisY2Label).transition().attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.length>0)for(g=Sc(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 wf.max(Object.keys(i).map(function(a){return wf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Eh:vh,n="y2"===c?Dh:uh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Fh:wh,r=ud()&&ah;return 0===l.length?"y2"===c?kg.domain():jg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(jg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Ah&&(f=b(Ah.top)?Ah.top:e,g=b(Ah.bottom)?Ah.bottom:e),"y2"===c&&Jh&&(f=b(Jh.top)?Jh.top:e,g=b(Jh.bottom)?Jh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return oh?zi?re(oh):oh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return nh?zi?re(nh):nh:wf.max(a,function(a){return wf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Ai?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof ph&&we(ph)?(e=b(ph.left)?ph.left:d,f=b(ph.right)?ph.right:d):e=f="number"==typeof ph?ph:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=zi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=zi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?jg:kg;return b="y"===a.axis||"y2"===a.axis?ah?Rf:"start"in a?d(a.start):Rf:ah?"end"in a?ig(zi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),xf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=zi?a?a instanceof Date?a:re(a):re(mc(c,d)):Bi&&!Ai?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Bi&&Ai&&0===c&&g&&(0===e&&(eh=[]),eh.push(g)),("undefined"==typeof a[b]||xf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&xf.data.targets[0].values[a-1]?xf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(xf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(zi?new Date(i):i);j.push(e)}return zi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Li=Li.concat(a)}function Mc(a){Li=Li.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Mi=Mi.concat(a)}function Oc(a){Mi=Mi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&mi&&(ij.html(pi(a,$(),wd(k),Ii)).style("display","block"),d=ij.property("offsetWidth"),e=ij.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(ah?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),ij.style("top",i+"px").style("left",g+"px"))}function Qd(){ij.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});mi&&(be(xf.data.targets)||ee(xf.data.targets)||fj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(ah?"y1":"x1",Cd).attr(ah?"y2":"x2",Cd))}function Sd(){fj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return"number"==typeof Yh?Yh:b?2*a.tickOffset()*Zh/b:0}function $d(a,b){Dc(a).forEach(function(a){mj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&gi||je(a)&&ai}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=ah?1:0,e=ah?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Pg(b,a.node()),fj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud).attr("stroke",function(){return Ii(b)}).attr("r",1.4*Wh).transition().duration(100).attr("r",Wh)}function Be(a,b,c){Qg(b,a.node()),fj.select("."+f.selectedCircles+ld(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){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Ii(b)).darker(1)})}function Ee(a,b){Qg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ii(b)})}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?fj.selectAll("."+f.circles+ld(c)):fj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Vh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Sh)}function Ke(a){return fj.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=ah?1:0,f=ah?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 ah?(c=he(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.getBoundingClientRect();return ah?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return ah&&(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(jj=wf.select(zf),jj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(jj.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),Hg&&Lc(Hg===!0?Cc(xf.data.targets):Hg),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),kj=ig.domain(),$i.scale(lg),Ef&&cj.scale(ig),dj=jj.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),ej=dj.append("defs"),ej.append("clipPath").attr("id",ti).append("rect").attr("width",Pf).attr("height",Rf),ej.append("clipPath").attr("id",ui).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),ej.append("clipPath").attr("id",vi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),fj=dj.append("g").attr("transform",Ri.main),gj=dj.append("g").attr("transform",Ri.context),hj=dj.append("g").attr("transform",Ri.legend),Tg||gj.style("visibility","hidden"),Wg||(hj.style("visibility","hidden"),Mi=Cc(xf.data.targets)),ij=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1,withLegendState:!0}),bh&&fj.append("g").attr("class",f.axisX).attr("clip-path",xi).attr("transform",Ri.x).append("text").attr("class",f.axisXLabel).attr("transform",ah?"rotate(-90)":"").style("text-anchor",zb),th&&fj.append("g").attr("class",f.axisY).attr("clip-path",yi).attr("transform",Ri.y).append("text").attr("class",f.axisYLabel).attr("transform",ah?"":"rotate(-90)").style("text-anchor",Ab),Ch&&fj.append("g").attr("class",f.axisY2).attr("transform",Ri.y2).append("text").attr("class",f.axisY2Label).attr("transform",ah?"":"rotate(-90)").style("text-anchor",Bb),d=fj.append("g").attr("clip-path",wi).attr("class",f.grid),Lh&&d.append("g").attr("class",f.xgrids),we(Nh)&&d.append("g").attr("class",f.xgridLines),Th&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Oh&&d.append("g").attr("class",f.ygrids),we(Ph)&&d.append("g").attr("class",f.ygridLines),fj.append("g").attr("clip-path",wi).attr("class",f.regions),fj.append("g").attr("clip-path",wi).attr("class",f.chart),c=fj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?ah?"ns-resize":"ew-resize":null),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Ri.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),fj.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&fj.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",ah?"ns-resize":"ew-resize").call(cj).on("dblclick.zoom",null),rh&&$i.extent("function"!=typeof rh?rh:rh(_b())),gj.append("g").attr("clip-path",wi).attr("class",f.chart),gj.select("."+f.chart).append("g").attr("class",f.chartBars),gj.select("."+f.chart).append("g").attr("class",f.chartLines),gj.append("g").attr("clip-path",wi).attr("class",f.brush).call($i).selectAll("rect").attr(ah?"width":"height",ah?Qf:Sf),gj.append("g").attr("class",f.axisX).attr("transform",Ri.subx).attr("clip-path",ah?"":xi),ef(xf.data.targets),ah?fj.select("."+f.axisX).style("opacity",0).call(og):(fj.select("."+f.axisY).style("opacity",0).call(pg),fj.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),qi){if(zi&&"string"==typeof ri){for(ri=re(ri),e=0;e0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(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){ee(xf.data.targets)||Ig&&(Ci=a,fj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Di=!0,Rg())}function Ze(){ee(xf.data.targets)||Ig&&(fj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),fj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Di=!1,Sg())}function $e(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=fj.select("."+f.axisX).style("opacity",W?0:1),g=fj.select("."+f.axisY).style("opacity",W?0:1),h=fj.select("."+f.axisY2).style("opacity",W?0:1),e=gj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Wg&&rf(Cc(xf.data.targets),a,O),Ai&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),kj=ig.domain(),Ef&&cj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),$i.scale(lg)),G&&(ig.domain($i.empty()?kj:$i.extent()),Ef&&cj.scale(ig).updateScaleExtent()),lh||!kh&&!jh||(S=Kc(Jc(X),jh),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(hh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!ah&&mh&&eb(c,O.axisX,mh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),ij.style("display","none"),o(),fj.select("line."+f.xgridFocus).style("visibility","hidden"),Lh){if("year"===Mh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=fj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",ah?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",ah?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",ah?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",ah?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(ah?"y1":"x1")===(ah?Rf:0)?0:1}),i.exit().remove()}we(Nh)&&(k=fj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Nh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",ah?"":"rotate(-90)").attr("dx",ah?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",ah?0:Dd).attr("x2",ah?Pf:Dd).attr("y1",ah?Dd:Mf.top).attr("y2",ah?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",ah?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Oh&&(m=fj.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Qh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",ah?jg:0).attr("x2",ah?jg:Pf).attr("y1",ah?0:jg).attr("y2",ah?Rf:jg),m.exit().remove()),A&&we(Ph)&&(n=fj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Ph),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",ah?"rotate(-90)":"").attr("dx",ah?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",ah?Ed:0).attr("x2",ah?Ed:Pf).attr("y1",ah?0:Ed).attr("y2",ah?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",ah?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=fj.select("."+f.regions).selectAll("rect."+f.region).data(li),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Ii(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=fj.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return ah?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",_i).style("opacity",1),fj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",aj).style("opacity",lj),q=fj.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Sh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud),q.exit().remove(),fj.each(function(){Gi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Gi=!1}),fj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),fj.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Tg&&(null!==wf.event&&"zoom"===wf.event.type&&$i.extent(ig.orgDomain()).update(),B&&(!ah&&mh&&eb(e,O.axisSubX,mh),$i.empty()||$i.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=gj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Ii(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),gj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",bj).style("opacity",1))),fj.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),fj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud),v=fj.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=fj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Bi&&!Ai?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),fj.select("."+f.eventRects).datum(x?x.values:[]),w=fj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",ah?0:y).attr("y",ah?y:0).attr("width",ah?Pf:z).attr("height",ah?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){mj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&cj.altDomain?(ig.domain(cj.altDomain),void cj.scale(ig).updateScaleExtent()):(Ai&&ig.orgDomain()[0]===kj[0]&&ig.domain([kj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Ei=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){dj.attr("width",Tf).attr("height",Uf),dj.select("#"+ti).select("rect").attr("width",Pf).attr("height",Rf),dj.select("#"+ui).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.select("#"+vi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),dj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),jj.style("max-height",Uf+"px")}function df(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=fj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Ii(a)}),e=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Kg(a)?"pointer":null}),c=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ii(a)}),b.append("path").attr("class",dd).style("opacity",function(){return lj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Ii(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Ii(a)}).style("cursor",function(a){return Kg(a)?"pointer":null}),a.forEach(function(a){fj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=fj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Ii(a.data)}).style("cursor",function(a){return Kg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Gi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Gi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Tg&&(n=gj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Ii(a)}),l=gj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ii(a)})),dj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Lf).style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Si?j:i,l=Si?Q():P();return d&&(w=0,C=0,t=0,u=0),Wg&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Si?u:t,void(_g?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,Si?(g=function(a){return t*(.2+B[a])},j=function(a){return A[B[a]]+x[a]}):(g=function(a){return A[B[a]]+x[a]},j=function(a){return u*(.2+B[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=hj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Yg?Yg(a):xf.toggle(a)}).on("mouseover",function(a){Gi||xf.focus(a),"function"==typeof Zg&&Zg(a)}).on("mouseout",function(a){Gi||xf.revert(),"function"==typeof $g&&$g(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Si?h:-200).attr("y",Si?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Si?i:-200).attr("y",Si?-200:l).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Ii(a)}).attr("x",Si?h:-200).attr("y",Si?-200:j).attr("width",10).attr("height",10),hj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),hj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),hj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),b.withLegendState&&hj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){return Gc(a)?1:Wi}),N(t),O(u),M(C),n(),R(),cf(),m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Gi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"],50),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","hide"],!1),Ig=h(["data","selection","enabled"],!1),Jg=h(["data","selection","grouped"],!1),Kg=h(["data","selection","isselectable"],function(){return!0}),Lg=h(["data","selection","multiple"],!0),Mg=h(["data","onclick"],function(){}),Ng=h(["data","onenter"],function(){}),Og=h(["data","onleave"],function(){}),Pg=h(["data","onselected"],function(){}),Qg=h(["data","onunselected"],function(){}),Rg=h(["data","ondragstart"],function(){}),Sg=h(["data","ondragend"],function(){}),Tg=h(["subchart","show"],!1),Ug=h(["subchart","size","height"],60),Vg=h(["color","pattern"],[]),Wg=h(["legend","show"],!0),Xg=h(["legend","position"],"bottom"),Yg=h(["legend","item","onclick"]),Zg=h(["legend","item","onmouseover"]),$g=h(["legend","item","onmouseout"]),_g=h(["legend","equally"],!1),ah=h(["axis","rotated"],!1),bh=h(["axis","x","show"],!0),ch=h(["axis","x","type"],"indexed"),dh=h(["axis","x","localtime"],!0),eh=h(["axis","x","categories"],[]),fh=h(["axis","x","tick","centered"],!1),gh=h(["axis","x","tick","format"]),hh=h(["axis","x","tick","culling"],{}),ih=h(["axis","x","tick","culling","max"],10),jh=h(["axis","x","tick","count"]),kh=h(["axis","x","tick","fit"],!0),lh=h(["axis","x","tick","values"],null),mh=h(["axis","x","tick","rotate"]),nh=h(["axis","x","max"],null),oh=h(["axis","x","min"],null),ph=h(["axis","x","padding"],{}),qh=h(["axis","x","height"]),rh=h(["axis","x","default"]),sh=h(["axis","x","label"],{}),th=h(["axis","y","show"],!0),uh=h(["axis","y","max"]),vh=h(["axis","y","min"]),wh=h(["axis","y","center"]),xh=h(["axis","y","label"],{}),yh=h(["axis","y","inner"],!1),zh=h(["axis","y","tick","format"]),Ah=h(["axis","y","padding"],{}),Bh=h(["axis","y","ticks"],10),Ch=h(["axis","y2","show"],!1),Dh=h(["axis","y2","max"]),Eh=h(["axis","y2","min"]),Fh=h(["axis","y2","center"]),Gh=h(["axis","y2","label"],{}),Hh=h(["axis","y2","inner"],!1),Ih=h(["axis","y2","tick","format"]),Jh=h(["axis","y2","padding"],{}),Kh=h(["axis","y2","ticks"],10),Lh=h(["grid","x","show"],!1),Mh=h(["grid","x","type"],"tick"),Nh=h(["grid","x","lines"],[]),Oh=h(["grid","y","show"],!1),Ph=h(["grid","y","lines"],[]),Qh=h(["grid","y","ticks"],10),Rh=h(["point","show"],!0),Sh=Rh?h(["point","r"],2.5):0,Th=h(["point","focus","line","enabled"],!0),Uh=h(["point","focus","expand","enabled"],!0),Vh=h(["point","focus","expand","r"],Uh?4:Sh),Wh=h(["point","focus","select","r"],8),Xh=h(["line","connect_null"],!1),Yh=h(["bar","width"]),Zh=h(["bar","width","ratio"],.6),$h=h(["pie","label","show"],!0),_h=h(["pie","label","format"]),ai=h(["pie","expand"],!0),bi=h(["pie","onclick"],function(){}),ci=h(["pie","onmouseover"],function(){}),di=h(["pie","onmouseout"],function(){}),ei=h(["donut","label","show"],!0),fi=h(["donut","label","format"]),gi=h(["donut","expand"],!0),hi=h(["donut","title"],""),ii=h(["donut","onclick"],function(){}),ji=h(["donut","onmouseover"],function(){}),ki=h(["donut","onmouseout"],function(){}),li=h(["regions"],[]),mi=h(["tooltip","show"],!0),ni=h(["tooltip","format","title"]),oi=h(["tooltip","format","value"]),pi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ni?ni:b,l=oi?oi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),qi=h(["tooltip","init","show"],!1),ri=h(["tooltip","init","x"],0),si=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ti=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ui=ti+"-xaxis",vi=ti+"-yaxis",wi=i(ti),xi=i(ui),yi=i(vi),zi="timeseries"===ch,Ai="categorized"===ch,Bi=!zi&&(sg||we(tg)),Ci=null,Di=!1,Ei=!1,Fi=!1,Gi=!1,Hi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ii=qe(Gg,we(Vg)?Vg:Hi,Fg),Ji=dh?wf.time.format:wf.time.format.utc,Ki=function(){var a=[[Ji("%Y/%-m/%-d"),function(){return!0}],[Ji("%-m/%-d"),function(a){return a.getMonth()}],[Ji("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ji("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ji("%I %p"),function(a){return a.getHours()}],[Ji("%I:%M"),function(a){return a.getMinutes()}],[Ji(":%S"),function(a){return a.getSeconds()}],[Ji(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),Li=[],Mi=[],Ni=ah?"left":"bottom",Oi=ah?yh?"top":"bottom":yh?"right":"left",Pi=ah?Hh?"bottom":"top":Hh?"left":"right",Qi=ah?"left":"bottom",Ri={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(ah?0:Rf)+")"},y:function(){return"translate(0,"+(ah?Rf:0)+")"},y2:function(){return"translate("+(ah?0:Pf)+","+(ah?1:0)+")"},subx:function(){return"translate(0,"+(ah?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Si="right"===Xg,Ti=0,Ui=0,Vi=0,Wi=.15,Xi=30,Yi=ah&&!bh?0:30,Zi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var $i,_i=function(){var a=wf.svg.line().x(ah?function(a){return V(a.id)(a.value)}:Cd).y(ah?Cd:function(a){return V(a.id)(a.value)});return Xh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Xh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ah?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a;return a=ah?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ah?"M "+d+" "+c:"M "+c+" "+d)}}(),bj=function(){var a=wf.svg.line().x(ah?function(a){return W(a.id)(a.value)}:Fd).y(ah?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),cj=function(){};$i=wf.svg.brush().on("brush",_e),$i.update=function(){return gj&&gj.select("."+f.brush).call(this),this},$i.scale=function(a){return ah?this.y(a):this.x(a)},Ef&&(cj=wf.behavior.zoom().on("zoomstart",function(){cj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),cj.scale=function(a){return ah?this.y(a):this.x(a)},cj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},cj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(kj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var dj,ej,fj,gj,hj,ij,jj,kj,lj,mj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),dj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&pf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),dj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&qf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){$i.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&Ai&&(eh=a.categories,og.categories(eh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(fj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Ig&&fj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Jg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Kg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Ig&&fj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Jg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Kg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0})},xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg) -},xf.xgrids=function(a){return a?(Nh=a,$e(),Nh):Nh},xf.xgrids.add=function(a){return a?xf.xgrids(Nh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a);return xf.xgrids(Nh.filter(b))},xf.ygrids=function(a){return a?(Ph=a,$e(),Ph):Ph},xf.ygrids.add=function(a){return a?xf.ygrids(Ph.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Ph.filter(b))},xf.regions=function(a){return c(a)?li:(li=a,$e(),li)},xf.regions.add=function(a){return c(a)?li:(li=li.concat(a),$e(),li)},xf.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;dj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),li=li.filter(function(b){return b.classes.indexOf(a)<0})}),li},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(vh=+a.y),b(a.y2)&&(Eh=+a.y2)):vh=Eh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0})},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},jj.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"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.33"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",legendItemFocused:"c3-legend-item-focused",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;cPf&&(Pf=0),0>Rf&&(Rf=0),Qf=ah?Mf.left-Xi-Yi:Pf,Sf=ah?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Si&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){fj.select("line."+f.xgridFocus).attr("x1",ah?0:-10).attr("x2",ah?Pf:-10).attr("y1",ah?-10:Mf.top).attr("y2",ah?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=ah?f.axisX:f.axisY,b=fj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:ah?bh?v("x"):1:!th||yh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Si?P()+(Ch&&!ah?v("y2"):a):Ch?Hh||ah?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||bh?"x"===a&&qh?qh:"y"!==a||th?"y2"!==a||Ch?(jb(a).isInner?30:40)+("y2"===a?-10:0):Zi:Wg&&!Si?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!ah)}function C(){return A(!ah)}function D(){return z(ah)}function E(){return A(ah)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(qh?qh:0)+80:Rf+8}function H(){return F(!ah)}function I(){return G(!ah)}function J(){return F(ah)}function K(){return G(ah)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(Ai?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Ti=a}function N(a){Ui=a}function O(a){Vi=a}function P(){return Wg?Si?Ui*(Ti+1):Tf:0}function Q(){return Wg?Si?Uf:Vi*(Ti+1):0}function R(){var a,b,c=!ig;ag=ah?1:0,bg=ah?Rf:Pf,cg=ah?0:Rf,dg=ah?Pf:1,eg=ag,fg=bg,gg=ah?0:Sf,hg=ah?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,kj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=lh?lh:c?void 0:og.tickValues(),og=X(ig,Ni,a,b),rg=X(lg,Qi,a,b),pg=Y(jg,Oi,zh,Bh),qg=Y(kg,Pi,Ih,Kh),c||($i.scale(lg),Ef&&cj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(zi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Ai){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(Ai?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Ai?(e.tickCentered(fh),ve(hh)&&(hh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},Ai&&e.categories(eh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=zi?Ki:Ai?Tc:function(a){return 0>a?a.toFixed(0):a};return gh&&("function"==typeof gh?a=gh:zi&&(a=function(a){return a?Ji(gh)(a):""})),a}function _(a){var b;return"y"===a?b=xh:"y2"===a?b=Gh:"x"===a&&(b=sh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?xh=b:"y2"===a?Gh=b:"x"===a&&(sh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",ah?"inner-top":"inner-right")}function hb(){return fb("y",ah?"inner-right":"inner-top")}function ib(){return fb("y2",ah?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!ah,gb())}function rb(){return nb(ah,hb())}function sb(){return nb(ah,ib())}function tb(){return ob(!ah,gb())}function ub(){return ob(ah,hb())}function vb(){return ob(ah,ib())}function wb(){var a=gb();return ah?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":qh?qh-10:"3em"}function xb(){var a=hb();return ah?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return ah?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!ah,gb())}function Ab(){return pb(ah,hb())}function Bb(){return pb(ah,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){fj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),fj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),fj.select("."+f.axisY2+" ."+f.axisY2Label).transition().attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.length>0)for(g=Sc(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 wf.max(Object.keys(i).map(function(a){return wf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Eh:vh,n="y2"===c?Dh:uh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Fh:wh,r=ud()&&ah;return 0===l.length?"y2"===c?kg.domain():jg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(jg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Ah&&(f=b(Ah.top)?Ah.top:e,g=b(Ah.bottom)?Ah.bottom:e),"y2"===c&&Jh&&(f=b(Jh.top)?Jh.top:e,g=b(Jh.bottom)?Jh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return oh?zi?re(oh):oh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return nh?zi?re(nh):nh:wf.max(a,function(a){return wf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Ai?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof ph&&we(ph)?(e=b(ph.left)?ph.left:d,f=b(ph.right)?ph.right:d):e=f="number"==typeof ph?ph:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=zi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=zi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?jg:kg;return b="y"===a.axis||"y2"===a.axis?ah?Rf:"start"in a?d(a.start):Rf:ah?"end"in a?ig(zi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),xf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=zi?a?a instanceof Date?a:re(a):re(mc(c,d)):Bi&&!Ai?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Bi&&Ai&&0===c&&g&&(0===e&&(eh=[]),eh.push(g)),("undefined"==typeof a[b]||xf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&xf.data.targets[0].values[a-1]?xf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(xf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(zi?new Date(i):i);j.push(e)}return zi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Li=Li.concat(a)}function Mc(a){Li=Li.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Mi=Mi.concat(a)}function Oc(a){Mi=Mi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&mi&&(ij.html(pi(a,$(),wd(k),Ii)).style("display","block"),d=ij.property("offsetWidth"),e=ij.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(ah?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),ij.style("top",i+"px").style("left",g+"px"))}function Qd(){ij.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});mi&&(be(xf.data.targets)||ee(xf.data.targets)||fj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(ah?"y1":"x1",Cd).attr(ah?"y2":"x2",Cd))}function Sd(){fj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return"number"==typeof Yh?Yh:b?2*a.tickOffset()*Zh/b:0}function $d(a,b){Dc(a).forEach(function(a){mj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&gi||je(a)&&ai}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=ah?1:0,e=ah?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Pg(b,a.node()),fj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud).attr("stroke",function(){return Ii(b)}).attr("r",1.4*Wh).transition().duration(100).attr("r",Wh)}function Be(a,b,c){Qg(b,a.node()),fj.select("."+f.selectedCircles+ld(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){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Ii(b)).darker(1)})}function Ee(a,b){Qg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ii(b)})}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?fj.selectAll("."+f.circles+ld(c)):fj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Vh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Sh)}function Ke(a){return fj.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=ah?1:0,f=ah?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 ah?(c=he(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.getBoundingClientRect();return ah?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return ah&&(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(jj=wf.select(zf),jj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(jj.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),Hg&&Lc(Hg===!0?Cc(xf.data.targets):Hg),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),kj=ig.domain(),$i.scale(lg),Ef&&cj.scale(ig),dj=jj.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),ej=dj.append("defs"),ej.append("clipPath").attr("id",ti).append("rect").attr("width",Pf).attr("height",Rf),ej.append("clipPath").attr("id",ui).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),ej.append("clipPath").attr("id",vi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),fj=dj.append("g").attr("transform",Ri.main),gj=dj.append("g").attr("transform",Ri.context),hj=dj.append("g").attr("transform",Ri.legend),Tg||gj.style("visibility","hidden"),Wg||(hj.style("visibility","hidden"),Mi=Cc(xf.data.targets)),ij=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),bh&&fj.append("g").attr("class",f.axisX).attr("clip-path",xi).attr("transform",Ri.x).append("text").attr("class",f.axisXLabel).attr("transform",ah?"rotate(-90)":"").style("text-anchor",zb),th&&fj.append("g").attr("class",f.axisY).attr("clip-path",yi).attr("transform",Ri.y).append("text").attr("class",f.axisYLabel).attr("transform",ah?"":"rotate(-90)").style("text-anchor",Ab),Ch&&fj.append("g").attr("class",f.axisY2).attr("transform",Ri.y2).append("text").attr("class",f.axisY2Label).attr("transform",ah?"":"rotate(-90)").style("text-anchor",Bb),d=fj.append("g").attr("clip-path",wi).attr("class",f.grid),Lh&&d.append("g").attr("class",f.xgrids),we(Nh)&&d.append("g").attr("class",f.xgridLines),Th&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Oh&&d.append("g").attr("class",f.ygrids),we(Ph)&&d.append("g").attr("class",f.ygridLines),fj.append("g").attr("clip-path",wi).attr("class",f.regions),fj.append("g").attr("clip-path",wi).attr("class",f.chart),c=fj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?ah?"ns-resize":"ew-resize":null),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Ri.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),fj.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&fj.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",ah?"ns-resize":"ew-resize").call(cj).on("dblclick.zoom",null),rh&&$i.extent("function"!=typeof rh?rh:rh(_b())),gj.append("g").attr("clip-path",wi).attr("class",f.chart),gj.select("."+f.chart).append("g").attr("class",f.chartBars),gj.select("."+f.chart).append("g").attr("class",f.chartLines),gj.append("g").attr("clip-path",wi).attr("class",f.brush).call($i).selectAll("rect").attr(ah?"width":"height",ah?Qf:Sf),gj.append("g").attr("class",f.axisX).attr("transform",Ri.subx).attr("clip-path",ah?"":xi),ef(xf.data.targets),ah?fj.select("."+f.axisX).style("opacity",0).call(og):(fj.select("."+f.axisY).style("opacity",0).call(pg),fj.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),qi){if(zi&&"string"==typeof ri){for(ri=re(ri),e=0;e0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(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){ee(xf.data.targets)||Ig&&(Ci=a,fj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Di=!0,Rg())}function Ze(){ee(xf.data.targets)||Ig&&(fj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),fj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Di=!1,Sg())}function $e(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=fj.select("."+f.axisX).style("opacity",W?0:1),g=fj.select("."+f.axisY).style("opacity",W?0:1),h=fj.select("."+f.axisY2).style("opacity",W?0:1),e=gj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Wg&&rf(Cc(xf.data.targets),a,O),Ai&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),kj=ig.domain(),Ef&&cj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),$i.scale(lg)),G&&(ig.domain($i.empty()?kj:$i.extent()),Ef&&cj.scale(ig).updateScaleExtent()),lh||!kh&&!jh||(S=Kc(Jc(X),jh),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(hh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!ah&&mh&&eb(c,O.axisX,mh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),ij.style("display","none"),o(),fj.select("line."+f.xgridFocus).style("visibility","hidden"),Lh){if("year"===Mh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=fj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",ah?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",ah?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",ah?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",ah?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(ah?"y1":"x1")===(ah?Rf:0)?0:1}),i.exit().remove()}we(Nh)&&(k=fj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Nh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",ah?"":"rotate(-90)").attr("dx",ah?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",ah?0:Dd).attr("x2",ah?Pf:Dd).attr("y1",ah?Dd:Mf.top).attr("y2",ah?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",ah?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Oh&&(m=fj.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Qh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",ah?jg:0).attr("x2",ah?jg:Pf).attr("y1",ah?0:jg).attr("y2",ah?Rf:jg),m.exit().remove()),A&&we(Ph)&&(n=fj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Ph),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",ah?"rotate(-90)":"").attr("dx",ah?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",ah?Ed:0).attr("x2",ah?Ed:Pf).attr("y1",ah?0:Ed).attr("y2",ah?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",ah?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=fj.select("."+f.regions).selectAll("rect."+f.region).data(li),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Ii(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=fj.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return ah?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",_i).style("opacity",1),fj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",aj).style("opacity",lj),q=fj.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Sh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud),q.exit().remove(),fj.each(function(){Gi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Gi=!1}),fj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),fj.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Tg&&(null!==wf.event&&"zoom"===wf.event.type&&$i.extent(ig.orgDomain()).update(),B&&(!ah&&mh&&eb(e,O.axisSubX,mh),$i.empty()||$i.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=gj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Ii(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),gj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",bj).style("opacity",1))),fj.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),fj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud),v=fj.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=fj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Bi&&!Ai?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),fj.select("."+f.eventRects).datum(x?x.values:[]),w=fj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",ah?0:y).attr("y",ah?y:0).attr("width",ah?Pf:z).attr("height",ah?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){mj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&cj.altDomain?(ig.domain(cj.altDomain),void cj.scale(ig).updateScaleExtent()):(Ai&&ig.orgDomain()[0]===kj[0]&&ig.domain([kj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Ei=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){dj.attr("width",Tf).attr("height",Uf),dj.select("#"+ti).select("rect").attr("width",Pf).attr("height",Rf),dj.select("#"+ui).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.select("#"+vi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),dj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),jj.style("max-height",Uf+"px")}function df(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=fj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Ii(a)}),e=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Kg(a)?"pointer":null}),c=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ii(a)}),b.append("path").attr("class",dd).style("opacity",function(){return lj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Ii(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Ii(a)}).style("cursor",function(a){return Kg(a)?"pointer":null}),a.forEach(function(a){fj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=fj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Ii(a.data)}).style("cursor",function(a){return Kg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Gi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Gi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Tg&&(n=gj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Ii(a)}),l=gj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ii(a)})),dj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Lf).style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Si?j:i,l=Si?Q():P();return d&&(w=0,C=0,t=0,u=0),Wg&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Si?u:t,void(_g?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=hj.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,Si?(g=function(a){return t*(.2+B[a])},j=function(a){return A[B[a]]+x[a]}):(g=function(a){return A[B[a]]+x[a]},j=function(a){return u*(.2+B[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=hj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Yg?Yg(a):xf.toggle(a)}).on("mouseover",function(a){wf.select(this).classed(f.legendItemFocused,!0),Gi||xf.focus(a),"function"==typeof Zg&&Zg(a)}).on("mouseout",function(a){wf.select(this).classed(f.legendItemFocused,!1),Gi||xf.revert(),"function"==typeof $g&&$g(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Si?h:-200).attr("y",Si?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Si?i:-200).attr("y",Si?-200:l).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Ii(a)}).attr("x",Si?h:-200).attr("y",Si?-200:j).attr("width",10).attr("height",10),hj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),hj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),hj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),hj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=wf.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?jf(b):kf(b):Wi}),N(t),O(u),M(C),n(),R(),cf(),m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Gi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"],50),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","hide"],!1),Ig=h(["data","selection","enabled"],!1),Jg=h(["data","selection","grouped"],!1),Kg=h(["data","selection","isselectable"],function(){return!0}),Lg=h(["data","selection","multiple"],!0),Mg=h(["data","onclick"],function(){}),Ng=h(["data","onenter"],function(){}),Og=h(["data","onleave"],function(){}),Pg=h(["data","onselected"],function(){}),Qg=h(["data","onunselected"],function(){}),Rg=h(["data","ondragstart"],function(){}),Sg=h(["data","ondragend"],function(){}),Tg=h(["subchart","show"],!1),Ug=h(["subchart","size","height"],60),Vg=h(["color","pattern"],[]),Wg=h(["legend","show"],!0),Xg=h(["legend","position"],"bottom"),Yg=h(["legend","item","onclick"]),Zg=h(["legend","item","onmouseover"]),$g=h(["legend","item","onmouseout"]),_g=h(["legend","equally"],!1),ah=h(["axis","rotated"],!1),bh=h(["axis","x","show"],!0),ch=h(["axis","x","type"],"indexed"),dh=h(["axis","x","localtime"],!0),eh=h(["axis","x","categories"],[]),fh=h(["axis","x","tick","centered"],!1),gh=h(["axis","x","tick","format"]),hh=h(["axis","x","tick","culling"],{}),ih=h(["axis","x","tick","culling","max"],10),jh=h(["axis","x","tick","count"]),kh=h(["axis","x","tick","fit"],!0),lh=h(["axis","x","tick","values"],null),mh=h(["axis","x","tick","rotate"]),nh=h(["axis","x","max"],null),oh=h(["axis","x","min"],null),ph=h(["axis","x","padding"],{}),qh=h(["axis","x","height"]),rh=h(["axis","x","default"]),sh=h(["axis","x","label"],{}),th=h(["axis","y","show"],!0),uh=h(["axis","y","max"]),vh=h(["axis","y","min"]),wh=h(["axis","y","center"]),xh=h(["axis","y","label"],{}),yh=h(["axis","y","inner"],!1),zh=h(["axis","y","tick","format"]),Ah=h(["axis","y","padding"],{}),Bh=h(["axis","y","ticks"],10),Ch=h(["axis","y2","show"],!1),Dh=h(["axis","y2","max"]),Eh=h(["axis","y2","min"]),Fh=h(["axis","y2","center"]),Gh=h(["axis","y2","label"],{}),Hh=h(["axis","y2","inner"],!1),Ih=h(["axis","y2","tick","format"]),Jh=h(["axis","y2","padding"],{}),Kh=h(["axis","y2","ticks"],10),Lh=h(["grid","x","show"],!1),Mh=h(["grid","x","type"],"tick"),Nh=h(["grid","x","lines"],[]),Oh=h(["grid","y","show"],!1),Ph=h(["grid","y","lines"],[]),Qh=h(["grid","y","ticks"],10),Rh=h(["point","show"],!0),Sh=Rh?h(["point","r"],2.5):0,Th=h(["point","focus","line","enabled"],!0),Uh=h(["point","focus","expand","enabled"],!0),Vh=h(["point","focus","expand","r"],Uh?4:Sh),Wh=h(["point","focus","select","r"],8),Xh=h(["line","connect_null"],!1),Yh=h(["bar","width"]),Zh=h(["bar","width","ratio"],.6),$h=h(["pie","label","show"],!0),_h=h(["pie","label","format"]),ai=h(["pie","expand"],!0),bi=h(["pie","onclick"],function(){}),ci=h(["pie","onmouseover"],function(){}),di=h(["pie","onmouseout"],function(){}),ei=h(["donut","label","show"],!0),fi=h(["donut","label","format"]),gi=h(["donut","expand"],!0),hi=h(["donut","title"],""),ii=h(["donut","onclick"],function(){}),ji=h(["donut","onmouseover"],function(){}),ki=h(["donut","onmouseout"],function(){}),li=h(["regions"],[]),mi=h(["tooltip","show"],!0),ni=h(["tooltip","format","title"]),oi=h(["tooltip","format","value"]),pi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ni?ni:b,l=oi?oi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),qi=h(["tooltip","init","show"],!1),ri=h(["tooltip","init","x"],0),si=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ti=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ui=ti+"-xaxis",vi=ti+"-yaxis",wi=i(ti),xi=i(ui),yi=i(vi),zi="timeseries"===ch,Ai="categorized"===ch,Bi=!zi&&(sg||we(tg)),Ci=null,Di=!1,Ei=!1,Fi=!1,Gi=!1,Hi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ii=qe(Gg,we(Vg)?Vg:Hi,Fg),Ji=dh?wf.time.format:wf.time.format.utc,Ki=function(){var a=[[Ji("%Y/%-m/%-d"),function(){return!0}],[Ji("%-m/%-d"),function(a){return a.getMonth()}],[Ji("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ji("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ji("%I %p"),function(a){return a.getHours()}],[Ji("%I:%M"),function(a){return a.getMinutes()}],[Ji(":%S"),function(a){return a.getSeconds()}],[Ji(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),Li=[],Mi=[],Ni=ah?"left":"bottom",Oi=ah?yh?"top":"bottom":yh?"right":"left",Pi=ah?Hh?"bottom":"top":Hh?"left":"right",Qi=ah?"left":"bottom",Ri={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(ah?0:Rf)+")"},y:function(){return"translate(0,"+(ah?Rf:0)+")"},y2:function(){return"translate("+(ah?0:Pf)+","+(ah?1:0)+")"},subx:function(){return"translate(0,"+(ah?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Si="right"===Xg,Ti=0,Ui=0,Vi=0,Wi=.15,Xi=30,Yi=ah&&!bh?0:30,Zi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var $i,_i=function(){var a=wf.svg.line().x(ah?function(a){return V(a.id)(a.value)}:Cd).y(ah?Cd:function(a){return V(a.id)(a.value)});return Xh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Xh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ah?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a;return a=ah?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ah?"M "+d+" "+c:"M "+c+" "+d)}}(),bj=function(){var a=wf.svg.line().x(ah?function(a){return W(a.id)(a.value)}:Fd).y(ah?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),cj=function(){};$i=wf.svg.brush().on("brush",_e),$i.update=function(){return gj&&gj.select("."+f.brush).call(this),this},$i.scale=function(a){return ah?this.y(a):this.x(a)},Ef&&(cj=wf.behavior.zoom().on("zoomstart",function(){cj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),cj.scale=function(a){return ah?this.y(a):this.x(a)},cj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},cj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(kj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var dj,ej,fj,gj,hj,ij,jj,kj,lj,mj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),dj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&pf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),dj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&qf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){$i.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&Ai&&(eh=a.categories,og.categories(eh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(fj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Ig&&fj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Jg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Kg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Ig&&fj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Jg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Kg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline") +},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0})},xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Nh=a,$e(),Nh):Nh},xf.xgrids.add=function(a){return a?xf.xgrids(Nh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a);return xf.xgrids(Nh.filter(b))},xf.ygrids=function(a){return a?(Ph=a,$e(),Ph):Ph},xf.ygrids.add=function(a){return a?xf.ygrids(Ph.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Ph.filter(b))},xf.regions=function(a){return c(a)?li:(li=a,$e(),li)},xf.regions.add=function(a){return c(a)?li:(li=li.concat(a),$e(),li)},xf.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;dj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),li=li.filter(function(b){return b.classes.indexOf(a)<0})}),li},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(vh=+a.y),b(a.y2)&&(Eh=+a.y2)):vh=Eh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0})},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},jj.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From eb08e08b0758aba10d06e4147dfd3d3a9de7077e Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 30 Apr 2014 22:24:42 +0900 Subject: [PATCH 099/178] Refactor focus/defocus legend item --- c3.js | 12 +++--------- c3.min.js | 6 +++--- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/c3.js b/c3.js index a5e3d97..45e6624 100644 --- a/c3.js +++ b/c3.js @@ -3763,7 +3763,7 @@ callback = getArcOnMouseOver(); // transitions expandArc(updated.data.id); - focusLegend(updated.data.id); + toggleFocusLegend(updated.data.id, true); callback(arcData, i); }) .on('mousemove', function (d) { @@ -3931,12 +3931,6 @@ } }); } - function focusLegend(id) { - toggleFocusLegend(id, true); - } - function defocusLegend(id) { - toggleFocusLegend(id, false); - } function revertLegend() { legend.selectAll('.' + CLASS.legendItem) .transition().duration(100) @@ -4176,7 +4170,7 @@ if (hasArcType(c3.data.targets)) { expandArc(targetId, true); } - focusLegend(targetId); + toggleFocusLegend(targetId, true); }; c3.defocus = function (targetId) { @@ -4192,7 +4186,7 @@ if (hasArcType(c3.data.targets)) { unexpandArc(targetId); } - defocusLegend(targetId); + toggleFocusLegend(targetId, false); }; c3.revert = function (targetId) { diff --git a/c3.min.js b/c3.min.js index 051f91b..fd57c23 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.33"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",legendItemFocused:"c3-legend-item-focused",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;cPf&&(Pf=0),0>Rf&&(Rf=0),Qf=ah?Mf.left-Xi-Yi:Pf,Sf=ah?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Si&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){fj.select("line."+f.xgridFocus).attr("x1",ah?0:-10).attr("x2",ah?Pf:-10).attr("y1",ah?-10:Mf.top).attr("y2",ah?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=ah?f.axisX:f.axisY,b=fj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:ah?bh?v("x"):1:!th||yh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Si?P()+(Ch&&!ah?v("y2"):a):Ch?Hh||ah?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||bh?"x"===a&&qh?qh:"y"!==a||th?"y2"!==a||Ch?(jb(a).isInner?30:40)+("y2"===a?-10:0):Zi:Wg&&!Si?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!ah)}function C(){return A(!ah)}function D(){return z(ah)}function E(){return A(ah)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(qh?qh:0)+80:Rf+8}function H(){return F(!ah)}function I(){return G(!ah)}function J(){return F(ah)}function K(){return G(ah)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(Ai?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Ti=a}function N(a){Ui=a}function O(a){Vi=a}function P(){return Wg?Si?Ui*(Ti+1):Tf:0}function Q(){return Wg?Si?Uf:Vi*(Ti+1):0}function R(){var a,b,c=!ig;ag=ah?1:0,bg=ah?Rf:Pf,cg=ah?0:Rf,dg=ah?Pf:1,eg=ag,fg=bg,gg=ah?0:Sf,hg=ah?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,kj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=lh?lh:c?void 0:og.tickValues(),og=X(ig,Ni,a,b),rg=X(lg,Qi,a,b),pg=Y(jg,Oi,zh,Bh),qg=Y(kg,Pi,Ih,Kh),c||($i.scale(lg),Ef&&cj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(zi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Ai){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(Ai?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Ai?(e.tickCentered(fh),ve(hh)&&(hh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},Ai&&e.categories(eh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=zi?Ki:Ai?Tc:function(a){return 0>a?a.toFixed(0):a};return gh&&("function"==typeof gh?a=gh:zi&&(a=function(a){return a?Ji(gh)(a):""})),a}function _(a){var b;return"y"===a?b=xh:"y2"===a?b=Gh:"x"===a&&(b=sh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?xh=b:"y2"===a?Gh=b:"x"===a&&(sh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",ah?"inner-top":"inner-right")}function hb(){return fb("y",ah?"inner-right":"inner-top")}function ib(){return fb("y2",ah?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!ah,gb())}function rb(){return nb(ah,hb())}function sb(){return nb(ah,ib())}function tb(){return ob(!ah,gb())}function ub(){return ob(ah,hb())}function vb(){return ob(ah,ib())}function wb(){var a=gb();return ah?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":qh?qh-10:"3em"}function xb(){var a=hb();return ah?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return ah?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!ah,gb())}function Ab(){return pb(ah,hb())}function Bb(){return pb(ah,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){fj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),fj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),fj.select("."+f.axisY2+" ."+f.axisY2Label).transition().attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.length>0)for(g=Sc(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 wf.max(Object.keys(i).map(function(a){return wf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Eh:vh,n="y2"===c?Dh:uh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Fh:wh,r=ud()&&ah;return 0===l.length?"y2"===c?kg.domain():jg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(jg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Ah&&(f=b(Ah.top)?Ah.top:e,g=b(Ah.bottom)?Ah.bottom:e),"y2"===c&&Jh&&(f=b(Jh.top)?Jh.top:e,g=b(Jh.bottom)?Jh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return oh?zi?re(oh):oh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return nh?zi?re(nh):nh:wf.max(a,function(a){return wf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Ai?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof ph&&we(ph)?(e=b(ph.left)?ph.left:d,f=b(ph.right)?ph.right:d):e=f="number"==typeof ph?ph:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=zi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=zi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?jg:kg;return b="y"===a.axis||"y2"===a.axis?ah?Rf:"start"in a?d(a.start):Rf:ah?"end"in a?ig(zi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),xf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=zi?a?a instanceof Date?a:re(a):re(mc(c,d)):Bi&&!Ai?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Bi&&Ai&&0===c&&g&&(0===e&&(eh=[]),eh.push(g)),("undefined"==typeof a[b]||xf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&xf.data.targets[0].values[a-1]?xf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(xf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(zi?new Date(i):i);j.push(e)}return zi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Li=Li.concat(a)}function Mc(a){Li=Li.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Mi=Mi.concat(a)}function Oc(a){Mi=Mi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&mi&&(ij.html(pi(a,$(),wd(k),Ii)).style("display","block"),d=ij.property("offsetWidth"),e=ij.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(ah?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),ij.style("top",i+"px").style("left",g+"px"))}function Qd(){ij.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});mi&&(be(xf.data.targets)||ee(xf.data.targets)||fj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(ah?"y1":"x1",Cd).attr(ah?"y2":"x2",Cd))}function Sd(){fj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return"number"==typeof Yh?Yh:b?2*a.tickOffset()*Zh/b:0}function $d(a,b){Dc(a).forEach(function(a){mj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&gi||je(a)&&ai}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=ah?1:0,e=ah?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Pg(b,a.node()),fj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud).attr("stroke",function(){return Ii(b)}).attr("r",1.4*Wh).transition().duration(100).attr("r",Wh)}function Be(a,b,c){Qg(b,a.node()),fj.select("."+f.selectedCircles+ld(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){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Ii(b)).darker(1)})}function Ee(a,b){Qg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ii(b)})}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?fj.selectAll("."+f.circles+ld(c)):fj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Vh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Sh)}function Ke(a){return fj.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=ah?1:0,f=ah?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 ah?(c=he(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.getBoundingClientRect();return ah?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return ah&&(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(jj=wf.select(zf),jj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(jj.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),Hg&&Lc(Hg===!0?Cc(xf.data.targets):Hg),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),kj=ig.domain(),$i.scale(lg),Ef&&cj.scale(ig),dj=jj.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),ej=dj.append("defs"),ej.append("clipPath").attr("id",ti).append("rect").attr("width",Pf).attr("height",Rf),ej.append("clipPath").attr("id",ui).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),ej.append("clipPath").attr("id",vi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),fj=dj.append("g").attr("transform",Ri.main),gj=dj.append("g").attr("transform",Ri.context),hj=dj.append("g").attr("transform",Ri.legend),Tg||gj.style("visibility","hidden"),Wg||(hj.style("visibility","hidden"),Mi=Cc(xf.data.targets)),ij=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),bh&&fj.append("g").attr("class",f.axisX).attr("clip-path",xi).attr("transform",Ri.x).append("text").attr("class",f.axisXLabel).attr("transform",ah?"rotate(-90)":"").style("text-anchor",zb),th&&fj.append("g").attr("class",f.axisY).attr("clip-path",yi).attr("transform",Ri.y).append("text").attr("class",f.axisYLabel).attr("transform",ah?"":"rotate(-90)").style("text-anchor",Ab),Ch&&fj.append("g").attr("class",f.axisY2).attr("transform",Ri.y2).append("text").attr("class",f.axisY2Label).attr("transform",ah?"":"rotate(-90)").style("text-anchor",Bb),d=fj.append("g").attr("clip-path",wi).attr("class",f.grid),Lh&&d.append("g").attr("class",f.xgrids),we(Nh)&&d.append("g").attr("class",f.xgridLines),Th&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Oh&&d.append("g").attr("class",f.ygrids),we(Ph)&&d.append("g").attr("class",f.ygridLines),fj.append("g").attr("clip-path",wi).attr("class",f.regions),fj.append("g").attr("clip-path",wi).attr("class",f.chart),c=fj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?ah?"ns-resize":"ew-resize":null),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Ri.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),fj.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&fj.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",ah?"ns-resize":"ew-resize").call(cj).on("dblclick.zoom",null),rh&&$i.extent("function"!=typeof rh?rh:rh(_b())),gj.append("g").attr("clip-path",wi).attr("class",f.chart),gj.select("."+f.chart).append("g").attr("class",f.chartBars),gj.select("."+f.chart).append("g").attr("class",f.chartLines),gj.append("g").attr("clip-path",wi).attr("class",f.brush).call($i).selectAll("rect").attr(ah?"width":"height",ah?Qf:Sf),gj.append("g").attr("class",f.axisX).attr("transform",Ri.subx).attr("clip-path",ah?"":xi),ef(xf.data.targets),ah?fj.select("."+f.axisX).style("opacity",0).call(og):(fj.select("."+f.axisY).style("opacity",0).call(pg),fj.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),qi){if(zi&&"string"==typeof ri){for(ri=re(ri),e=0;e0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(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){ee(xf.data.targets)||Ig&&(Ci=a,fj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Di=!0,Rg())}function Ze(){ee(xf.data.targets)||Ig&&(fj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),fj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Di=!1,Sg())}function $e(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=fj.select("."+f.axisX).style("opacity",W?0:1),g=fj.select("."+f.axisY).style("opacity",W?0:1),h=fj.select("."+f.axisY2).style("opacity",W?0:1),e=gj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Wg&&rf(Cc(xf.data.targets),a,O),Ai&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),kj=ig.domain(),Ef&&cj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),$i.scale(lg)),G&&(ig.domain($i.empty()?kj:$i.extent()),Ef&&cj.scale(ig).updateScaleExtent()),lh||!kh&&!jh||(S=Kc(Jc(X),jh),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(hh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!ah&&mh&&eb(c,O.axisX,mh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),ij.style("display","none"),o(),fj.select("line."+f.xgridFocus).style("visibility","hidden"),Lh){if("year"===Mh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=fj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",ah?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",ah?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",ah?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",ah?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(ah?"y1":"x1")===(ah?Rf:0)?0:1}),i.exit().remove()}we(Nh)&&(k=fj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Nh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",ah?"":"rotate(-90)").attr("dx",ah?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",ah?0:Dd).attr("x2",ah?Pf:Dd).attr("y1",ah?Dd:Mf.top).attr("y2",ah?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",ah?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Oh&&(m=fj.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Qh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",ah?jg:0).attr("x2",ah?jg:Pf).attr("y1",ah?0:jg).attr("y2",ah?Rf:jg),m.exit().remove()),A&&we(Ph)&&(n=fj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Ph),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",ah?"rotate(-90)":"").attr("dx",ah?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",ah?Ed:0).attr("x2",ah?Ed:Pf).attr("y1",ah?0:Ed).attr("y2",ah?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",ah?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=fj.select("."+f.regions).selectAll("rect."+f.region).data(li),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Ii(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=fj.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return ah?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",_i).style("opacity",1),fj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",aj).style("opacity",lj),q=fj.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Sh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud),q.exit().remove(),fj.each(function(){Gi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Gi=!1}),fj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),fj.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Tg&&(null!==wf.event&&"zoom"===wf.event.type&&$i.extent(ig.orgDomain()).update(),B&&(!ah&&mh&&eb(e,O.axisSubX,mh),$i.empty()||$i.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=gj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Ii(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),gj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",bj).style("opacity",1))),fj.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),fj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud),v=fj.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=fj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Bi&&!Ai?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),fj.select("."+f.eventRects).datum(x?x.values:[]),w=fj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",ah?0:y).attr("y",ah?y:0).attr("width",ah?Pf:z).attr("height",ah?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){mj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&cj.altDomain?(ig.domain(cj.altDomain),void cj.scale(ig).updateScaleExtent()):(Ai&&ig.orgDomain()[0]===kj[0]&&ig.domain([kj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Ei=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){dj.attr("width",Tf).attr("height",Uf),dj.select("#"+ti).select("rect").attr("width",Pf).attr("height",Rf),dj.select("#"+ui).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.select("#"+vi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),dj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),jj.style("max-height",Uf+"px")}function df(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=fj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Ii(a)}),e=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Kg(a)?"pointer":null}),c=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ii(a)}),b.append("path").attr("class",dd).style("opacity",function(){return lj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Ii(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Ii(a)}).style("cursor",function(a){return Kg(a)?"pointer":null}),a.forEach(function(a){fj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=fj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Ii(a.data)}).style("cursor",function(a){return Kg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Gi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Gi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Tg&&(n=gj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Ii(a)}),l=gj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ii(a)})),dj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Lf).style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Si?j:i,l=Si?Q():P();return d&&(w=0,C=0,t=0,u=0),Wg&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Si?u:t,void(_g?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=hj.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,Si?(g=function(a){return t*(.2+B[a])},j=function(a){return A[B[a]]+x[a]}):(g=function(a){return A[B[a]]+x[a]},j=function(a){return u*(.2+B[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=hj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Yg?Yg(a):xf.toggle(a)}).on("mouseover",function(a){wf.select(this).classed(f.legendItemFocused,!0),Gi||xf.focus(a),"function"==typeof Zg&&Zg(a)}).on("mouseout",function(a){wf.select(this).classed(f.legendItemFocused,!1),Gi||xf.revert(),"function"==typeof $g&&$g(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Si?h:-200).attr("y",Si?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Si?i:-200).attr("y",Si?-200:l).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Ii(a)}).attr("x",Si?h:-200).attr("y",Si?-200:j).attr("width",10).attr("height",10),hj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),hj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),hj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),hj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=wf.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?jf(b):kf(b):Wi}),N(t),O(u),M(C),n(),R(),cf(),m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Gi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"],50),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","hide"],!1),Ig=h(["data","selection","enabled"],!1),Jg=h(["data","selection","grouped"],!1),Kg=h(["data","selection","isselectable"],function(){return!0}),Lg=h(["data","selection","multiple"],!0),Mg=h(["data","onclick"],function(){}),Ng=h(["data","onenter"],function(){}),Og=h(["data","onleave"],function(){}),Pg=h(["data","onselected"],function(){}),Qg=h(["data","onunselected"],function(){}),Rg=h(["data","ondragstart"],function(){}),Sg=h(["data","ondragend"],function(){}),Tg=h(["subchart","show"],!1),Ug=h(["subchart","size","height"],60),Vg=h(["color","pattern"],[]),Wg=h(["legend","show"],!0),Xg=h(["legend","position"],"bottom"),Yg=h(["legend","item","onclick"]),Zg=h(["legend","item","onmouseover"]),$g=h(["legend","item","onmouseout"]),_g=h(["legend","equally"],!1),ah=h(["axis","rotated"],!1),bh=h(["axis","x","show"],!0),ch=h(["axis","x","type"],"indexed"),dh=h(["axis","x","localtime"],!0),eh=h(["axis","x","categories"],[]),fh=h(["axis","x","tick","centered"],!1),gh=h(["axis","x","tick","format"]),hh=h(["axis","x","tick","culling"],{}),ih=h(["axis","x","tick","culling","max"],10),jh=h(["axis","x","tick","count"]),kh=h(["axis","x","tick","fit"],!0),lh=h(["axis","x","tick","values"],null),mh=h(["axis","x","tick","rotate"]),nh=h(["axis","x","max"],null),oh=h(["axis","x","min"],null),ph=h(["axis","x","padding"],{}),qh=h(["axis","x","height"]),rh=h(["axis","x","default"]),sh=h(["axis","x","label"],{}),th=h(["axis","y","show"],!0),uh=h(["axis","y","max"]),vh=h(["axis","y","min"]),wh=h(["axis","y","center"]),xh=h(["axis","y","label"],{}),yh=h(["axis","y","inner"],!1),zh=h(["axis","y","tick","format"]),Ah=h(["axis","y","padding"],{}),Bh=h(["axis","y","ticks"],10),Ch=h(["axis","y2","show"],!1),Dh=h(["axis","y2","max"]),Eh=h(["axis","y2","min"]),Fh=h(["axis","y2","center"]),Gh=h(["axis","y2","label"],{}),Hh=h(["axis","y2","inner"],!1),Ih=h(["axis","y2","tick","format"]),Jh=h(["axis","y2","padding"],{}),Kh=h(["axis","y2","ticks"],10),Lh=h(["grid","x","show"],!1),Mh=h(["grid","x","type"],"tick"),Nh=h(["grid","x","lines"],[]),Oh=h(["grid","y","show"],!1),Ph=h(["grid","y","lines"],[]),Qh=h(["grid","y","ticks"],10),Rh=h(["point","show"],!0),Sh=Rh?h(["point","r"],2.5):0,Th=h(["point","focus","line","enabled"],!0),Uh=h(["point","focus","expand","enabled"],!0),Vh=h(["point","focus","expand","r"],Uh?4:Sh),Wh=h(["point","focus","select","r"],8),Xh=h(["line","connect_null"],!1),Yh=h(["bar","width"]),Zh=h(["bar","width","ratio"],.6),$h=h(["pie","label","show"],!0),_h=h(["pie","label","format"]),ai=h(["pie","expand"],!0),bi=h(["pie","onclick"],function(){}),ci=h(["pie","onmouseover"],function(){}),di=h(["pie","onmouseout"],function(){}),ei=h(["donut","label","show"],!0),fi=h(["donut","label","format"]),gi=h(["donut","expand"],!0),hi=h(["donut","title"],""),ii=h(["donut","onclick"],function(){}),ji=h(["donut","onmouseover"],function(){}),ki=h(["donut","onmouseout"],function(){}),li=h(["regions"],[]),mi=h(["tooltip","show"],!0),ni=h(["tooltip","format","title"]),oi=h(["tooltip","format","value"]),pi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ni?ni:b,l=oi?oi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),qi=h(["tooltip","init","show"],!1),ri=h(["tooltip","init","x"],0),si=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ti=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ui=ti+"-xaxis",vi=ti+"-yaxis",wi=i(ti),xi=i(ui),yi=i(vi),zi="timeseries"===ch,Ai="categorized"===ch,Bi=!zi&&(sg||we(tg)),Ci=null,Di=!1,Ei=!1,Fi=!1,Gi=!1,Hi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ii=qe(Gg,we(Vg)?Vg:Hi,Fg),Ji=dh?wf.time.format:wf.time.format.utc,Ki=function(){var a=[[Ji("%Y/%-m/%-d"),function(){return!0}],[Ji("%-m/%-d"),function(a){return a.getMonth()}],[Ji("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ji("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ji("%I %p"),function(a){return a.getHours()}],[Ji("%I:%M"),function(a){return a.getMinutes()}],[Ji(":%S"),function(a){return a.getSeconds()}],[Ji(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),Li=[],Mi=[],Ni=ah?"left":"bottom",Oi=ah?yh?"top":"bottom":yh?"right":"left",Pi=ah?Hh?"bottom":"top":Hh?"left":"right",Qi=ah?"left":"bottom",Ri={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(ah?0:Rf)+")"},y:function(){return"translate(0,"+(ah?Rf:0)+")"},y2:function(){return"translate("+(ah?0:Pf)+","+(ah?1:0)+")"},subx:function(){return"translate(0,"+(ah?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Si="right"===Xg,Ti=0,Ui=0,Vi=0,Wi=.15,Xi=30,Yi=ah&&!bh?0:30,Zi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var $i,_i=function(){var a=wf.svg.line().x(ah?function(a){return V(a.id)(a.value)}:Cd).y(ah?Cd:function(a){return V(a.id)(a.value)});return Xh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Xh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ah?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a;return a=ah?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ah?"M "+d+" "+c:"M "+c+" "+d)}}(),bj=function(){var a=wf.svg.line().x(ah?function(a){return W(a.id)(a.value)}:Fd).y(ah?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),cj=function(){};$i=wf.svg.brush().on("brush",_e),$i.update=function(){return gj&&gj.select("."+f.brush).call(this),this},$i.scale=function(a){return ah?this.y(a):this.x(a)},Ef&&(cj=wf.behavior.zoom().on("zoomstart",function(){cj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),cj.scale=function(a){return ah?this.y(a):this.x(a)},cj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},cj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(kj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var dj,ej,fj,gj,hj,ij,jj,kj,lj,mj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),dj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&pf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),dj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&qf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){$i.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&Ai&&(eh=a.categories,og.categories(eh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(fj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Ig&&fj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Jg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Kg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Ig&&fj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Jg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Kg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline") -},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0})},xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Nh=a,$e(),Nh):Nh},xf.xgrids.add=function(a){return a?xf.xgrids(Nh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a);return xf.xgrids(Nh.filter(b))},xf.ygrids=function(a){return a?(Ph=a,$e(),Ph):Ph},xf.ygrids.add=function(a){return a?xf.ygrids(Ph.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Ph.filter(b))},xf.regions=function(a){return c(a)?li:(li=a,$e(),li)},xf.regions.add=function(a){return c(a)?li:(li=li.concat(a),$e(),li)},xf.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;dj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),li=li.filter(function(b){return b.classes.indexOf(a)<0})}),li},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(vh=+a.y),b(a.y2)&&(Eh=+a.y2)):vh=Eh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0})},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},jj.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"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.33"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",legendItemFocused:"c3-legend-item-focused",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;cNf&&(Nf=0),0>Pf&&(Pf=0),Of=$g?Kf.left-Vi-Wi:Nf,Qf=$g?Pf:Sf-Lf.top-Lf.bottom,0>Of&&(Of=0),0>Qf&&(Qf=0),p(),Qi&&ee(vf.data.targets)&&(Mf.left=Nf/2+Uf)}function o(){dj.select("line."+f.xgridFocus).attr("x1",$g?0:-10).attr("x2",$g?Nf:-10).attr("y1",$g?-10:Kf.top).attr("y2",$g?-10:Pf)}function p(){Uf=Pf/2,Tf=.95*Uf,Vf=de(vf.data.targets)?.6*Tf:0}function q(){var a=$g?f.axisX:f.axisY,b=dj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=uf.select(xf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return yf?yf:x()}function s(){var a=zf?zf:y();return a>0?a:320}function t(){return ee(vf.data.targets)?0:Af?Af:$g?_g?v("x"):1:!rh||wh?1:v("y")}function u(){var a=1;return ee(vf.data.targets)?0:Bf?Bf:Qi?P()+(Ah&&!$g?v("y2"):a):Ah?Fh||$g?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||_g?"x"===a&&oh?oh:"y"!==a||rh?"y2"!==a||Ah?(jb(a).isInner?30:40)+("y2"===a?-10:0):Xi:Ug&&!Qi?10:1:0}function x(){return+uf.select(xf).style("width").replace("px","")}function y(){return+uf.select(xf).style("height").replace("px","")}function z(a){return a?-5:-(Kf.left-1)}function A(a){return a?-20:-4}function B(){return z(!$g)}function C(){return A(!$g)}function D(){return z($g)}function E(){return A($g)}function F(a){return a?Nf+2+4:Kf.left+20}function G(a){return a?(oh?oh:0)+80:Pf+8}function H(){return F(!$g)}function I(){return G(!$g)}function J(){return F($g)}function K(){return G($g)}function L(){var a,b,c,d,e,f=Ac(vf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=gg(b.x)-gg(a.x),d=zc(),e=ae(vf.data.targets)?(d-(yi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Ri=a}function N(a){Si=a}function O(a){Ti=a}function P(){return Ug?Qi?Si*(Ri+1):Rf:0}function Q(){return Ug?Qi?Sf:Ti*(Ri+1):0}function R(){var a,b,c=!gg;$f=$g?1:0,_f=$g?Pf:Nf,ag=$g?0:Pf,bg=$g?Nf:1,cg=$f,dg=_f,eg=$g?0:Qf,fg=$g?Of:1,gg=T($f,_f,c?void 0:gg.domain(),function(){return mg.tickOffset()}),hg=U(ag,bg,c?void 0:hg.domain()),ig=U(ag,bg,c?void 0:ig.domain()),jg=T($f,_f,ij,function(a){return a%1?0:pg.tickOffset()}),kg=U(eg,fg,c?void 0:kg.domain()),lg=U(eg,fg,c?void 0:lg.domain()),a=$(),b=jh?jh:c?void 0:mg.tickValues(),mg=X(gg,Li,a,b),pg=X(jg,Oi,a,b),ng=Y(hg,Mi,xh,zh),og=Y(ig,Ni,Gh,Ih),c||(Yi.scale(jg),Cf&&aj.scale(gg)),S()}function S(){Wf=Gb(),Xf=Hb(),Yf=Hb(.98)}function T(a,b,d,e){var f=(xi?uf.time.scale():uf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),yi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=uf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?ig:hg}function W(a){return"y2"===Z(a)?lg:kg}function X(a,b,c,d){var e=(yi?Eb():uf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),yi?(e.tickCentered(dh),ve(fh)&&(fh=!1)):e.tickOffset=function(){var a=Bc(vf.data.targets),b=gg(a[1])-gg(a[0]);return b/zc()/2},yi&&e.categories(ch),e}function Y(a,b,c,d){return uf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in xg?xg[a]:"y"}function $(){var a=xi?Ii:yi?Tc:function(a){return 0>a?a.toFixed(0):a};return eh&&("function"==typeof eh?a=eh:xi&&(a=function(a){return a?Hi(eh)(a):""})),a}function _(a){var b;return"y"===a?b=vh:"y2"===a?b=Eh:"x"===a&&(b=qh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?vh=b:"y2"===a?Eh=b:"x"===a&&(qh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",$g?"inner-top":"inner-right")}function hb(){return fb("y",$g?"inner-right":"inner-top")}function ib(){return fb("y2",$g?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Nf/2:Nf:b.isBottom?-Pf:b.isMiddle?-Pf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!$g,gb())}function rb(){return nb($g,hb())}function sb(){return nb($g,ib())}function tb(){return ob(!$g,gb())}function ub(){return ob($g,hb())}function vb(){return ob($g,ib())}function wb(){var a=gb();return $g?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":oh?oh-10:"3em"}function xb(){var a=hb();return $g?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return $g?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!$g,gb())}function Ab(){return pb($g,hb())}function Bb(){return pb($g,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return uf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){dj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),dj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),dj.select("."+f.axisY2+" ."+f.axisY2Label).transition().attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 uf.min(Object.keys(i).map(function(a){return uf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(wg.length>0)for(g=Sc(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 uf.max(Object.keys(i).map(function(a){return uf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Ch:th,n="y2"===c?Bh:sh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Dh:uh,r=ud()&&$g;return 0===l.length?"y2"===c?ig.domain():hg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(hg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&yh&&(f=b(yh.top)?yh.top:e,g=b(yh.bottom)?yh.bottom:e),"y2"===c&&Hh&&(f=b(Hh.top)?Hh.top:e,g=b(Hh.bottom)?Hh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return mh?xi?re(mh):mh:uf.min(a,function(a){return uf.min(a.values,function(a){return a.x})})}function Zb(a){return lh?xi?re(lh):lh:uf.max(a,function(a){return uf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return yi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof nh&&we(nh)?(e=b(nh.left)?nh.left:d,f=b(nh.right)?nh.right:d):e=f="number"==typeof nh?nh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=xi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=xi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?hg:ig;return b="y"===a.axis||"y2"===a.axis?$g?Pf:"start"in a?d(a.start):Pf:$g?"end"in a?gg(xi?re(a.end):a.end):Pf:Pf,c>b?0:b-c}function ic(a){return qg&&a===qg||we(rg)&&xe(rg,a)}function jc(a){return!ic(a)}function kc(a){return qg?qg:we(rg)?rg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=vf.data.xs[b])}),c}function mc(a,b){return a in vf.data.xs&&vf.data.xs[a]&&vf.data.xs[a][b]?vf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){rg[b]=a[b]})}function oc(a){return 1===uf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=ug[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),vf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=xi?a?a instanceof Date?a:re(a):re(mc(c,d)):zi&&!yi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?vf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):qg?(d=Object.keys(vf.data.xs),vf.data.xs[c]=d.length>0?vf.data.xs[d[0]]:void 0):we(rg)&&(vf.data.xs[c]=lc(f,vf.data.targets)):vf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!vf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=tg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return zi&&yi&&0===c&&g&&(0===e&&(ch=[]),ch.push(g)),("undefined"==typeof a[b]||vf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),yg&&$d(Cc(c).filter(function(a){return!(a in zg)}),yg),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&vf.data.targets[0].values[a-1]?vf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(vf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(xi?new Date(i):i);j.push(e)}return xi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Ji=Ji.concat(a)}function Mc(a){Ji=Ji.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Ki=Ki.concat(a)}function Oc(a){Ki=Ki.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return uf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Bg&&"desc"===Bg.toLowerCase()}function Nd(){return Bg&&"asc"===Bg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Bg&&a.sort(Bg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(vf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&ki&&(gj.html(ni(a,$(),wd(k),Gi)).style("display","block"),d=gj.property("offsetWidth"),e=gj.property("offsetHeight"),k?(g=Nf/2+c[0],i=Pf/2+c[1]+20):($g?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=gg(l[0].x)+20):(f=q(),g=f+t()+gg(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),gj.style("top",i+"px").style("left",g+"px"))}function Qd(){gj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});ki&&(be(vf.data.targets)||ee(vf.data.targets)||dj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr($g?"y1":"x1",Cd).attr($g?"y2":"x2",Cd))}function Sd(){dj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?gg(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return"number"==typeof Wh?Wh:b?2*a.tickOffset()*Xh/b:0}function $d(a,b){Dc(a).forEach(function(a){kj[a]=b===zg[a],zg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){zg[a.id]===b&&(c=!0),a.id in zg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in zg)||"line"===zg[b]||"spline"===zg[b]||"area"===zg[b]||"area-spline"===zg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===zg[b]||"area-spline"===zg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===zg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===zg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===zg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===zg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&ei||je(a)&&$h}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function re(b){var c;try{c=sg?uf.time.format(sg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+sg)}return c}function se(a,b){var c=uf.mouse(a),d=uf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?hg:ig,d=$g?1:0,e=$g?0:1;return Math.pow(gg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Ng(b,a.node()),dj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",$g?Ud:Td).attr("cy",$g?Td:Ud).attr("stroke",function(){return Gi(b)}).attr("r",1.4*Uh).transition().duration(100).attr("r",Uh)}function Be(a,b,c){Og(b,a.node()),dj.select("."+f.selectedCircles+ld(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){Ng(b,a.node()),a.transition().duration(100).style("fill",function(){return uf.rgb(Gi(b)).darker(1)})}function Ee(a,b){Og(b,a.node()),a.transition().duration(100).style("fill",function(){return Gi(b)})}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?dj.selectAll("."+f.circles+ld(c)):dj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Th)}function Je(a){He(a).filter(function(){return uf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Qh)}function Ke(a){return dj.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=$g?1:0,f=$g?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 $g?(c=he(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.getBoundingClientRect();return $g?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(mg,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return $g&&(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(hj=uf.select(xf),hj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(hj.html("").classed("c3",!0),vf.data.xs={},vf.data.targets=vc(b),Fg&&Lc(Fg===!0?Cc(vf.data.targets):Fg),n(),R(),gg.domain(uf.extent(_b(vf.data.targets))),hg.domain(Xb(vf.data.targets,"y")),ig.domain(Xb(vf.data.targets,"y2")),jg.domain(gg.domain()),kg.domain(hg.domain()),lg.domain(ig.domain()),ij=gg.domain(),Yi.scale(jg),Cf&&aj.scale(gg),bj=hj.append("svg").attr("width",Nf+Kf.left+Kf.right).attr("height",Pf+Kf.top+Kf.bottom).on("mouseenter",Ff).on("mouseleave",Gf),cj=bj.append("defs"),cj.append("clipPath").attr("id",ri).append("rect").attr("width",Nf).attr("height",Pf),cj.append("clipPath").attr("id",si).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),cj.append("clipPath").attr("id",ti).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),dj=bj.append("g").attr("transform",Pi.main),ej=bj.append("g").attr("transform",Pi.context),fj=bj.append("g").attr("transform",Pi.legend),Rg||ej.style("visibility","hidden"),Ug||(fj.style("visibility","hidden"),Ki=Cc(vf.data.targets)),gj=uf.select(xf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),pf(Cc(vf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),_g&&dj.append("g").attr("class",f.axisX).attr("clip-path",vi).attr("transform",Pi.x).append("text").attr("class",f.axisXLabel).attr("transform",$g?"rotate(-90)":"").style("text-anchor",zb),rh&&dj.append("g").attr("class",f.axisY).attr("clip-path",wi).attr("transform",Pi.y).append("text").attr("class",f.axisYLabel).attr("transform",$g?"":"rotate(-90)").style("text-anchor",Ab),Ah&&dj.append("g").attr("class",f.axisY2).attr("transform",Pi.y2).append("text").attr("class",f.axisY2Label).attr("transform",$g?"":"rotate(-90)").style("text-anchor",Bb),d=dj.append("g").attr("clip-path",ui).attr("class",f.grid),Jh&&d.append("g").attr("class",f.xgrids),we(Lh)&&d.append("g").attr("class",f.xgridLines),Rh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Mh&&d.append("g").attr("class",f.ygrids),we(Nh)&&d.append("g").attr("class",f.ygridLines),dj.append("g").attr("clip-path",ui).attr("class",f.regions),dj.append("g").attr("clip-path",ui).attr("class",f.chart),c=dj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Cf?$g?"ns-resize":"ew-resize":null),dj.select("."+f.chart).append("g").attr("class",f.chartBars),dj.select("."+f.chart).append("g").attr("class",f.chartLines),dj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Pi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),dj.select("."+f.chart).append("g").attr("class",f.chartTexts),Cf&&dj.insert("rect",Ef?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Nf).attr("height",Pf).style("opacity",0).style("cursor",$g?"ns-resize":"ew-resize").call(aj).on("dblclick.zoom",null),ph&&Yi.extent("function"!=typeof ph?ph:ph(_b())),ej.append("g").attr("clip-path",ui).attr("class",f.chart),ej.select("."+f.chart).append("g").attr("class",f.chartBars),ej.select("."+f.chart).append("g").attr("class",f.chartLines),ej.append("g").attr("clip-path",ui).attr("class",f.brush).call(Yi).selectAll("rect").attr($g?"width":"height",$g?Of:Qf),ej.append("g").attr("class",f.axisX).attr("transform",Pi.subx).attr("clip-path",$g?"":vi),ef(vf.data.targets),$g?dj.select("."+f.axisX).style("opacity",0).call(mg):(dj.select("."+f.axisY).style("opacity",0).call(ng),dj.select("."+f.axisY2).style("opacity",0).call(og)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),oi){if(xi&&"string"==typeof pi){for(pi=re(pi),e=0;e0){d=[];for(var g in ug)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(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){ee(vf.data.targets)||Gg&&(Ai=a,dj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Bi=!0,Pg())}function Ze(){ee(vf.data.targets)||Gg&&(dj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),dj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Bi=!1,Qg())}function $e(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Vd(),W=ee(vf.data.targets),X=Ic(vf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Jf:0,Q=D?P:0,R=E?P:0,c=dj.select("."+f.axisX).style("opacity",W?0:1),g=dj.select("."+f.axisY).style("opacity",W?0:1),h=dj.select("."+f.axisY2).style("opacity",W?0:1),e=ej.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Ug&&pf(Cc(vf.data.targets),a,O),yi&&(0!==X.length&&H&&G||gg.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(gg.domain(uf.extent(_b(X))),ij=gg.domain(),Cf&&aj.scale(gg).updateScaleExtent(),jg.domain(gg.domain()),Yi.scale(jg)),G&&(gg.domain(Yi.empty()?ij:Yi.extent()),Cf&&aj.scale(gg).updateScaleExtent()),jh||!ih&&!hh||(S=Kc(Jc(X),hh),mg.tickValues(S),pg.tickValues(S))),hg.domain(Xb(X,"y")),ig.domain(Xb(X,"y2")),O.axisX.call(mg),O.axisY.call(ng),O.axisY2.call(og),O.axisSubX.call(pg),G&&X.length)if(fh&&S){for(T=1;T=0&&uf.select(this).style("display",b%U?"none":"block")})}else uf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!$g&&kh&&eb(c,O.axisX,kh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),kg.domain(hg.domain()),lg.domain(ig.domain()),gj.style("display","none"),o(),dj.select("line."+f.xgridFocus).style("visibility","hidden"),Jh){if("year"===Kh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=gg.ticks(10);i=dj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",$g?0:function(a){return gg(a)-mg.tickOffset()}).attr("x2",$g?Nf:function(a){return gg(a)-mg.tickOffset()}).attr("y1",$g?function(a){return gg(a)-mg.tickOffset()}:Kf.top).attr("y2",$g?function(a){return gg(a)-mg.tickOffset()}:Pf).style("opacity",function(){return+uf.select(this).attr($g?"y1":"x1")===($g?Pf:0)?0:1}),i.exit().remove()}we(Lh)&&(k=dj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Lh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",$g?"":"rotate(-90)").attr("dx",$g?0:-Kf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",$g?0:Dd).attr("x2",$g?Nf:Dd).attr("y1",$g?Dd:Kf.top).attr("y2",$g?Dd:Pf).style("opacity",1),k.select("text").transition().duration(P).attr("x",$g?Nf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Mh&&(m=dj.select("."+f.ygrids).selectAll("."+f.ygrid).data(hg.ticks(Oh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",$g?hg:0).attr("x2",$g?hg:Nf).attr("y1",$g?0:hg).attr("y2",$g?Pf:hg),m.exit().remove()),A&&we(Nh)&&(n=dj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Nh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",$g?"rotate(-90)":"").attr("dx",$g?0:-Kf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",$g?Ed:0).attr("x2",$g?Ed:Nf).attr("y1",$g?0:Ed).attr("y2",$g?Pf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",$g?0:Nf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=dj.select("."+f.regions).selectAll("rect."+f.region).data(ji),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=dj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Gi(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=dj.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return $g?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),dj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",Zi).style("opacity",1),dj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",$i).style("opacity",jj),q=dj.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Qh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",$g?Ud:Td).attr("cy",$g?Td:Ud),q.exit().remove(),dj.each(function(){Ei=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=uf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Ei=!1}),dj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),dj.select("."+f.chartArcsTitle).style("opacity",de(vf.data.targets)?1:0),Rg&&(null!==uf.event&&"zoom"===uf.event.type&&Yi.extent(gg.orgDomain()).update(),B&&(!$g&&kh&&eb(e,O.axisSubX,kh),Yi.empty()||Yi.extent(gg.orgDomain()).update(),K=Ne(V,!0),u=ej.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Gi(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),ej.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",_i).style("opacity",1))),dj.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),dj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",$g?Ud:Td).attr("cy",$g?Td:Ud),v=dj.select("."+f.eventRects),we(rg)&&!oc(rg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=dj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Nf).attr("height",Pf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),zi&&!yi?(z=function(a,b){var c=xc(b),d=yc(b),e=vf.data.xs[a.id][b];return(gg(d?d:e+50)-gg(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=vf.data.xs[a.id][b];return(gg(d)+gg(c?c:d-50))/2}):(z=L(),y=function(a){return gg(a.x)-z/2}),x=Ac(vf.data.targets),dj.select("."+f.eventRects).datum(x?x.values:[]),w=dj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",$g?0:y).attr("y",$g?y:0).attr("width",$g?Nf:z).attr("height",$g?z:Pf),w.exit().remove()),Cc(vf.data.targets).forEach(function(a){kj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===uf.event.sourceEvent.type&&aj.altDomain?(gg.domain(aj.altDomain),void aj.scale(gg).updateScaleExtent()):(yi&&gg.orgDomain()[0]===ij[0]&&gg.domain([ij[0]-1e-10,gg.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===uf.event.sourceEvent.type&&(Ci=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){bj.attr("width",Rf).attr("height",Sf),bj.select("#"+ri).select("rect").attr("width",Nf).attr("height",Pf),bj.select("#"+si).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),bj.select("#"+ti).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),bj.select("."+f.zoomRect).attr("width",Nf).attr("height",Pf),hj.style("max-height",Sf+"px")}function df(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=dj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Gi(a)}),e=dj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Ig(a)?"pointer":null}),c=dj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Gi(a)}),b.append("path").attr("class",dd).style("opacity",function(){return jj=+uf.select(this).style("opacity"),0}).style("fill",function(a){return Gi(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Gi(a)}).style("cursor",function(a){return Ig(a)?"pointer":null}),a.forEach(function(a){dj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=dj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Zf(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Gi(a.data)}).style("cursor",function(a){return Ig(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Ei||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),lf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,uf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Ei||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),mf(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Rg&&(n=ej.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Gi(a)}),l=ej.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Gi(a)})),bj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Jf).style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),vf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Qi?j:i,l=Qi?Q():P();return d&&(w=0,C=0,t=0,u=0),Ug&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Qi?u:t,void(Zg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=fj.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,Qi?(g=function(a){return t*(.2+B[a])},j=function(a){return A[B[a]]+x[a]}):(g=function(a){return A[B[a]]+x[a]},j=function(a){return u*(.2+B[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=fj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Wg?Wg(a):vf.toggle(a)}).on("mouseover",function(a){uf.select(this).classed(f.legendItemFocused,!0),Ei||vf.focus(a),"function"==typeof Xg&&Xg(a)}).on("mouseout",function(a){uf.select(this).classed(f.legendItemFocused,!1),Ei||vf.revert(),"function"==typeof Yg&&Yg(a)}),o.append("text").text(function(a){return d(ug[a])?ug[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Qi?h:-200).attr("y",Qi?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Qi?i:-200).attr("y",Qi?-200:l).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Gi(a)}).attr("x",Qi?h:-200).attr("y",Qi?-200:j).attr("width",10).attr("height",10),fj.selectAll("text").data(a).text(function(a){return d(ug[a])?ug[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),fj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),fj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),fj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=uf.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?jf(b):kf(b):Ui}),N(t),O(u),M(C),n(),R(),cf(),m(q,c)}function qf(a){return Ec(vf.data.targets,a.id)}function rf(a){return"data"in a&&Ec(vf.data.targets,a.data.id)}function sf(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 tf(a,b,c){var d=!ee(vf.data.targets);Ei=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var uf=a.d3?a.d3:a.require?a.require("d3"):void 0,vf={data:{},axis:{},legend:{}},wf={},xf=h(["bindto"],"#chart"),yf=h(["size","width"]),zf=h(["size","height"]),Af=h(["padding","left"],50),Bf=h(["padding","right"]),Cf=h(["zoom","enabled"],!1),Df=h(["zoom","extent"]),Ef=h(["zoom","privileged"],!1),Ff=h(["onenter"],function(){}),Gf=h(["onleave"],function(){}),Hf=h(["onresize"],function(){}),If=h(["onresized"],function(){}),Jf=h(["transition","duration"],350);g("data","data is required in config");var Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg=h(["data","x"]),rg=h(["data","xs"],{}),sg=h(["data","x_format"]),tg=h(["data","id_converter"],function(a){return a}),ug=h(["data","names"],{}),vg=h(["data","classes"],{}),wg=h(["data","groups"],[]),xg=h(["data","axes"],{}),yg=h(["data","type"]),zg=h(["data","types"],{}),Ag=h(["data","labels"],{}),Bg=h(["data","order"]),Cg=h(["data","regions"],{}),Dg=h(["data","color"]),Eg=h(["data","colors"],{}),Fg=h(["data","hide"],!1),Gg=h(["data","selection","enabled"],!1),Hg=h(["data","selection","grouped"],!1),Ig=h(["data","selection","isselectable"],function(){return!0}),Jg=h(["data","selection","multiple"],!0),Kg=h(["data","onclick"],function(){}),Lg=h(["data","onenter"],function(){}),Mg=h(["data","onleave"],function(){}),Ng=h(["data","onselected"],function(){}),Og=h(["data","onunselected"],function(){}),Pg=h(["data","ondragstart"],function(){}),Qg=h(["data","ondragend"],function(){}),Rg=h(["subchart","show"],!1),Sg=h(["subchart","size","height"],60),Tg=h(["color","pattern"],[]),Ug=h(["legend","show"],!0),Vg=h(["legend","position"],"bottom"),Wg=h(["legend","item","onclick"]),Xg=h(["legend","item","onmouseover"]),Yg=h(["legend","item","onmouseout"]),Zg=h(["legend","equally"],!1),$g=h(["axis","rotated"],!1),_g=h(["axis","x","show"],!0),ah=h(["axis","x","type"],"indexed"),bh=h(["axis","x","localtime"],!0),ch=h(["axis","x","categories"],[]),dh=h(["axis","x","tick","centered"],!1),eh=h(["axis","x","tick","format"]),fh=h(["axis","x","tick","culling"],{}),gh=h(["axis","x","tick","culling","max"],10),hh=h(["axis","x","tick","count"]),ih=h(["axis","x","tick","fit"],!0),jh=h(["axis","x","tick","values"],null),kh=h(["axis","x","tick","rotate"]),lh=h(["axis","x","max"],null),mh=h(["axis","x","min"],null),nh=h(["axis","x","padding"],{}),oh=h(["axis","x","height"]),ph=h(["axis","x","default"]),qh=h(["axis","x","label"],{}),rh=h(["axis","y","show"],!0),sh=h(["axis","y","max"]),th=h(["axis","y","min"]),uh=h(["axis","y","center"]),vh=h(["axis","y","label"],{}),wh=h(["axis","y","inner"],!1),xh=h(["axis","y","tick","format"]),yh=h(["axis","y","padding"],{}),zh=h(["axis","y","ticks"],10),Ah=h(["axis","y2","show"],!1),Bh=h(["axis","y2","max"]),Ch=h(["axis","y2","min"]),Dh=h(["axis","y2","center"]),Eh=h(["axis","y2","label"],{}),Fh=h(["axis","y2","inner"],!1),Gh=h(["axis","y2","tick","format"]),Hh=h(["axis","y2","padding"],{}),Ih=h(["axis","y2","ticks"],10),Jh=h(["grid","x","show"],!1),Kh=h(["grid","x","type"],"tick"),Lh=h(["grid","x","lines"],[]),Mh=h(["grid","y","show"],!1),Nh=h(["grid","y","lines"],[]),Oh=h(["grid","y","ticks"],10),Ph=h(["point","show"],!0),Qh=Ph?h(["point","r"],2.5):0,Rh=h(["point","focus","line","enabled"],!0),Sh=h(["point","focus","expand","enabled"],!0),Th=h(["point","focus","expand","r"],Sh?4:Qh),Uh=h(["point","focus","select","r"],8),Vh=h(["line","connect_null"],!1),Wh=h(["bar","width"]),Xh=h(["bar","width","ratio"],.6),Yh=h(["pie","label","show"],!0),Zh=h(["pie","label","format"]),$h=h(["pie","expand"],!0),_h=h(["pie","onclick"],function(){}),ai=h(["pie","onmouseover"],function(){}),bi=h(["pie","onmouseout"],function(){}),ci=h(["donut","label","show"],!0),di=h(["donut","label","format"]),ei=h(["donut","expand"],!0),fi=h(["donut","title"],""),gi=h(["donut","onclick"],function(){}),hi=h(["donut","onmouseover"],function(){}),ii=h(["donut","onmouseout"],function(){}),ji=h(["regions"],[]),ki=h(["tooltip","show"],!0),li=h(["tooltip","format","title"]),mi=h(["tooltip","format","value"]),ni=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=li?li:b,l=mi?mi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),oi=h(["tooltip","init","show"],!1),pi=h(["tooltip","init","x"],0),qi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ri=("string"==typeof xf?xf.replace("#",""):xf.id)+"-clip",si=ri+"-xaxis",ti=ri+"-yaxis",ui=i(ri),vi=i(si),wi=i(ti),xi="timeseries"===ah,yi="categorized"===ah,zi=!xi&&(qg||we(rg)),Ai=null,Bi=!1,Ci=!1,Di=!1,Ei=!1,Fi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Gi=qe(Eg,we(Tg)?Tg:Fi,Dg),Hi=bh?uf.time.format:uf.time.format.utc,Ii=function(){var a=[[Hi("%Y/%-m/%-d"),function(){return!0}],[Hi("%-m/%-d"),function(a){return a.getMonth()}],[Hi("%-m/%-d"),function(a){return 1!==a.getDate()}],[Hi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Hi("%I %p"),function(a){return a.getHours()}],[Hi("%I:%M"),function(a){return a.getMinutes()}],[Hi(":%S"),function(a){return a.getSeconds()}],[Hi(".%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)}}(),Ji=[],Ki=[],Li=$g?"left":"bottom",Mi=$g?wh?"top":"bottom":wh?"right":"left",Ni=$g?Fh?"bottom":"top":Fh?"left":"right",Oi=$g?"left":"bottom",Pi={main:function(){return"translate("+Kf.left+","+Kf.top+")"},context:function(){return"translate("+Lf.left+","+Lf.top+")"},legend:function(){return"translate("+Mf.left+","+Mf.top+")"},x:function(){return"translate(0,"+($g?0:Pf)+")"},y:function(){return"translate(0,"+($g?Pf:0)+")"},y2:function(){return"translate("+($g?0:Nf)+","+($g?1:0)+")"},subx:function(){return"translate(0,"+($g?0:Qf)+")"},arc:function(){return"translate("+Nf/2+","+Pf/2+")"}},Qi="right"===Vg,Ri=0,Si=0,Ti=0,Ui=.15,Vi=30,Wi=$g&&!_g?0:30,Xi=5;Zf=uf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Yi,Zi=function(){var a=uf.svg.line().x($g?function(a){return V(a.id)(a.value)}:Cd).y($g?Cd:function(a){return V(a.id)(a.value)});return Vh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Vh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Cg[b.id]?Se(e,gg,V(b.id),Cg[b.id]):a(e)):(c=e[0]?gg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,$g?"M "+d+" "+c:"M "+c+" "+d)}}(),$i=function(){var a;return a=$g?uf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):uf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?gg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,$g?"M "+d+" "+c:"M "+c+" "+d)}}(),_i=function(){var a=uf.svg.line().x($g?function(a){return W(a.id)(a.value)}:Fd).y($g?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+jg(c[0].x)+" "+W(b.id)(c[0].value)}}(),aj=function(){};Yi=uf.svg.brush().on("brush",_e),Yi.update=function(){return ej&&ej.select("."+f.brush).call(this),this},Yi.scale=function(a){return $g?this.y(a):this.x(a)},Cf&&(aj=uf.behavior.zoom().on("zoomstart",function(){aj.altDomain=uf.event.sourceEvent.altKey?gg.orgDomain():null}).on("zoom",Cf?af:null),aj.scale=function(a){return $g?this.y(a):this.x(a)},aj.orgScaleExtent=function(){var a=Df?Df:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},aj.updateScaleExtent=function(){var a=ac(gg.orgDomain())/ac(ij),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var bj,cj,dj,ej,fj,gj,hj,ij,jj,kj={};if(vf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=bj.selectAll(md(a)),d=c.filter(qf),e=c.filter(rf);vf.revert(),vf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(vf.data.targets)&&Nb(a,!0),lf(a,!0)},vf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=bj.selectAll(md(a)),d=c.filter(qf),e=c.filter(rf);vf.revert(),b(d.classed(f.focused,!1)),b(e),ee(vf.data.targets)&&Ob(a),lf(a,!1)},vf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=bj.selectAll(md(a)),d=c.filter(qf),e=c.filter(rf);b(d.classed(f.focused,!1)),b(e),ee(vf.data.targets)&&Ob(a),mf()},vf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),bj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&nf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},vf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),bj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&of(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},vf.toggle=function(a){Gc(a)?vf.hide(a):vf.show(a)},vf.unzoom=function(){Yi.clear().update(),$e({withUpdateXDomain:!0})},vf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){vg[b]=a.classes[b]}),"categories"in a&&yi&&(ch=a.categories,mg.categories(ch)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},vf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},vf.selected=function(a){return uf.merge(dj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return uf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},vf.select=function(a,b,c){Gg&&dj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=uf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Hg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Ig(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},vf.unselect=function(a,b){Gg&&dj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=uf.select(this),g="circle"===this.nodeName?Be:Ee,h=Hg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Ig(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},vf.toLine=function(a){tf(a,"line")},vf.toSpline=function(a){tf(a,"spline")},vf.toBar=function(a){tf(a,"bar")},vf.toScatter=function(a){tf(a,"scatter")},vf.toArea=function(a){tf(a,"area")},vf.toAreaSpline=function(a){tf(a,"area-spline") +},vf.toPie=function(a){tf(a,"pie",{withTransform:!0})},vf.toDonut=function(a){tf(a,"donut",{withTransform:!0})},vf.groups=function(a){return c(a)?wg:(wg=a,$e(),wg)},vf.xgrids=function(a){return a?(Lh=a,$e(),Lh):Lh},vf.xgrids.add=function(a){return a?vf.xgrids(Lh.concat(a)):void 0},vf.xgrids.remove=function(a){var b=sf(a);return vf.xgrids(Lh.filter(b))},vf.ygrids=function(a){return a?(Nh=a,$e(),Nh):Nh},vf.ygrids.add=function(a){return a?vf.ygrids(Nh.concat(a)):void 0},vf.ygrids.remove=function(a){var b=sf(a);return vf.ygrids(Nh.filter(b))},vf.regions=function(a){return c(a)?ji:(ji=a,$e(),ji)},vf.regions.add=function(a){return c(a)?ji:(ji=ji.concat(a),$e(),ji)},vf.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;bj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ji=ji.filter(function(b){return b.classes.indexOf(a)<0})}),ji},vf.data.get=function(a){var b=vf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},vf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},vf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){ug[b]=a[b]}),pf(Cc(vf.data.targets),{withTransition:!0}),ug):ug},vf.x=function(a){return arguments.length&&(qc(vf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),vf.data.xs},vf.xs=function(a){return arguments.length&&(rc(vf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),vf.data.xs},vf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},vf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(sh=+a.y),b(a.y2)&&(Bh=+a.y2)):sh=Bh=+a,$e())},vf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(th=+a.y),b(a.y2)&&(Ch=+a.y2)):th=Ch=+a,$e())},vf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&vf.axis.max(a.max),"undefined"!=typeof a.min&&vf.axis.min(a.min))},vf.legend.show=function(a){nf(Dc(a)),$e({withLegend:!0})},vf.legend.hide=function(a){of(Dc(a)),$e({withLegend:!0})},vf.resize=function(a){yf=a?a.width:null,zf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},vf.destroy=function(){vf.data.targets=void 0,vf.data.xs={},hj.html(""),a.onresize=null},"url"in e.data)uf.xhr(e.data.url,function(a,b){var c,d=uf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=uf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return vf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From a96966859972ea5b3cd19d6bcce01c097ea47642 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 30 Apr 2014 22:32:36 +0900 Subject: [PATCH 100/178] Add sample for data.hide - #151 --- htdocs/samples/data_hide.html | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 htdocs/samples/data_hide.html diff --git a/htdocs/samples/data_hide.html b/htdocs/samples/data_hide.html new file mode 100644 index 0000000..b7db333 --- /dev/null +++ b/htdocs/samples/data_hide.html @@ -0,0 +1,24 @@ + + + + + +
+ + + + + + From 3b4c50085a7dcdace4b80c9545366d0121775b88 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 30 Apr 2014 22:34:36 +0900 Subject: [PATCH 101/178] Fix sample --- htdocs/samples/data_hide.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/samples/data_hide.html b/htdocs/samples/data_hide.html index b7db333..fb3469b 100644 --- a/htdocs/samples/data_hide.html +++ b/htdocs/samples/data_hide.html @@ -16,7 +16,7 @@ ['data3', 300, 200, 160, 400, 250, 250] ], // hide: ['data1', 'data3'] - hide: false // hide all data + hide: true // hide all data } }); From 54c456e1af6e4a644744982c31dfd815a19858a3 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 30 Apr 2014 22:59:32 +0900 Subject: [PATCH 102/178] Refactor point radius - #179 --- c3.js | 38 +++++++++++++++++++++++++------------- c3.min.js | 6 +++--- 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/c3.js b/c3.js index 45e6624..04fdab1 100644 --- a/c3.js +++ b/c3.js @@ -217,11 +217,11 @@ // point - point of each data var __point_show = getConfig(['point', 'show'], true), - __point_r = __point_show ? getConfig(['point', 'r'], 2.5) : 0, + __point_r = getConfig(['point', 'r'], 2.5), __point_focus_line_enabled = getConfig(['point', 'focus', 'line', 'enabled'], true), __point_focus_expand_enabled = getConfig(['point', 'focus', 'expand', 'enabled'], true), - __point_focus_expand_r = getConfig(['point', 'focus', 'expand', 'r'], __point_focus_expand_enabled ? 4 : __point_r), - __point_select_r = getConfig(['point', 'focus', 'select', 'r'], 8); + __point_focus_expand_r = getConfig(['point', 'focus', 'expand', 'r']), + __point_select_r = getConfig(['point', 'focus', 'select', 'r']); var __line_connect_null = getConfig(['line', 'connect_null'], false); @@ -2244,9 +2244,9 @@ .attr("cx", __axis_rotated ? circleY : circleX) .attr("cy", __axis_rotated ? circleX : circleY) .attr("stroke", function () { return color(d); }) - .attr("r", __point_select_r * 1.4) + .attr("r", pointSelectR(d) * 1.4) .transition().duration(100) - .attr("r", __point_select_r); + .attr("r", pointSelectR); } function unselectPoint(target, d, i) { __data_onunselected(d, target.node()); @@ -2275,6 +2275,18 @@ return data.filter(function (d) { return isValue(d.value); }); } + //-- Point --// + + function pointR(d) { + return __point_show ? (typeof __point_r === 'function' ? __point_r(d) : __point_r) : 0; + } + function pointExpandedR(d) { + return __point_focus_expand_enabled ? (__point_focus_expand_r ? __point_focus_expand_r : pointR(d) * 1.75) : pointR(d); + } + function pointSelectR(d) { + return __point_select_r ? __point_select_r : pointR(d) * 4; + } + //-- Shape --// function getCircles(i, id) { @@ -2283,13 +2295,13 @@ function expandCircles(i, id) { getCircles(i, id) .classed(CLASS.EXPANDED, true) - .attr('r', __point_focus_expand_r); + .attr('r', pointExpandedR); } function unexpandCircles(i) { getCircles(i) .filter(function () { return d3.select(this).classed(CLASS.EXPANDED); }) .classed(CLASS.EXPANDED, false) - .attr('r', __point_r); + .attr('r', pointR); } function getBars(i) { return main.selectAll('.' + CLASS.bar + (isValue(i) ? '-' + i : '')); @@ -2899,12 +2911,12 @@ .filter(function (d) { return __data_selection_isselectable(d); }) .each(function () { var _this = d3.select(this).classed(CLASS.EXPANDED, true); - if (this.nodeName === 'circle') { _this.attr('r', __point_focus_expand_r); } + if (this.nodeName === 'circle') { _this.attr('r', pointExpandedR); } svg.select('.' + CLASS.eventRect + '-' + i).style('cursor', null); }) - .filter(function () { + .filter(function (d) { if (this.nodeName === 'circle') { - return isWithinCircle(this, __point_select_r); + return isWithinCircle(this, pointSelectR(d)); } else if (this.nodeName === 'path') { return isWithinBar(this); @@ -2914,7 +2926,7 @@ var _this = d3.select(this); if (! _this.classed(CLASS.EXPANDED)) { _this.classed(CLASS.EXPANDED, true); - if (this.nodeName === 'circle') { _this.attr('r', __point_select_r); } + if (this.nodeName === 'circle') { _this.attr('r', pointSelectR); } } svg.select('.' + CLASS.eventRect + '-' + i).style('cursor', 'pointer'); }); @@ -3027,7 +3039,7 @@ isSelected = shape.classed(CLASS.SELECTED); var isWithin = false, toggle; if (target.nodeName === 'circle') { - isWithin = isWithinCircle(target, __point_select_r * 1.5); + isWithin = isWithinCircle(target, pointSelectR(d) * 1.5); toggle = togglePoint; } else if (target.nodeName === 'path') { @@ -3425,7 +3437,7 @@ mainCircle.enter().append("circle") .attr("class", classCircle) .style('opacity', 0) - .attr("r", __point_r); + .attr("r", pointR); mainCircle .style("opacity", initialOpacity) .transition().duration(duration) diff --git a/c3.min.js b/c3.min.js index fd57c23..789e8a8 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.33"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",legendItemFocused:"c3-legend-item-focused",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;cNf&&(Nf=0),0>Pf&&(Pf=0),Of=$g?Kf.left-Vi-Wi:Nf,Qf=$g?Pf:Sf-Lf.top-Lf.bottom,0>Of&&(Of=0),0>Qf&&(Qf=0),p(),Qi&&ee(vf.data.targets)&&(Mf.left=Nf/2+Uf)}function o(){dj.select("line."+f.xgridFocus).attr("x1",$g?0:-10).attr("x2",$g?Nf:-10).attr("y1",$g?-10:Kf.top).attr("y2",$g?-10:Pf)}function p(){Uf=Pf/2,Tf=.95*Uf,Vf=de(vf.data.targets)?.6*Tf:0}function q(){var a=$g?f.axisX:f.axisY,b=dj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=uf.select(xf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return yf?yf:x()}function s(){var a=zf?zf:y();return a>0?a:320}function t(){return ee(vf.data.targets)?0:Af?Af:$g?_g?v("x"):1:!rh||wh?1:v("y")}function u(){var a=1;return ee(vf.data.targets)?0:Bf?Bf:Qi?P()+(Ah&&!$g?v("y2"):a):Ah?Fh||$g?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||_g?"x"===a&&oh?oh:"y"!==a||rh?"y2"!==a||Ah?(jb(a).isInner?30:40)+("y2"===a?-10:0):Xi:Ug&&!Qi?10:1:0}function x(){return+uf.select(xf).style("width").replace("px","")}function y(){return+uf.select(xf).style("height").replace("px","")}function z(a){return a?-5:-(Kf.left-1)}function A(a){return a?-20:-4}function B(){return z(!$g)}function C(){return A(!$g)}function D(){return z($g)}function E(){return A($g)}function F(a){return a?Nf+2+4:Kf.left+20}function G(a){return a?(oh?oh:0)+80:Pf+8}function H(){return F(!$g)}function I(){return G(!$g)}function J(){return F($g)}function K(){return G($g)}function L(){var a,b,c,d,e,f=Ac(vf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=gg(b.x)-gg(a.x),d=zc(),e=ae(vf.data.targets)?(d-(yi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Ri=a}function N(a){Si=a}function O(a){Ti=a}function P(){return Ug?Qi?Si*(Ri+1):Rf:0}function Q(){return Ug?Qi?Sf:Ti*(Ri+1):0}function R(){var a,b,c=!gg;$f=$g?1:0,_f=$g?Pf:Nf,ag=$g?0:Pf,bg=$g?Nf:1,cg=$f,dg=_f,eg=$g?0:Qf,fg=$g?Of:1,gg=T($f,_f,c?void 0:gg.domain(),function(){return mg.tickOffset()}),hg=U(ag,bg,c?void 0:hg.domain()),ig=U(ag,bg,c?void 0:ig.domain()),jg=T($f,_f,ij,function(a){return a%1?0:pg.tickOffset()}),kg=U(eg,fg,c?void 0:kg.domain()),lg=U(eg,fg,c?void 0:lg.domain()),a=$(),b=jh?jh:c?void 0:mg.tickValues(),mg=X(gg,Li,a,b),pg=X(jg,Oi,a,b),ng=Y(hg,Mi,xh,zh),og=Y(ig,Ni,Gh,Ih),c||(Yi.scale(jg),Cf&&aj.scale(gg)),S()}function S(){Wf=Gb(),Xf=Hb(),Yf=Hb(.98)}function T(a,b,d,e){var f=(xi?uf.time.scale():uf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),yi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=uf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?ig:hg}function W(a){return"y2"===Z(a)?lg:kg}function X(a,b,c,d){var e=(yi?Eb():uf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),yi?(e.tickCentered(dh),ve(fh)&&(fh=!1)):e.tickOffset=function(){var a=Bc(vf.data.targets),b=gg(a[1])-gg(a[0]);return b/zc()/2},yi&&e.categories(ch),e}function Y(a,b,c,d){return uf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in xg?xg[a]:"y"}function $(){var a=xi?Ii:yi?Tc:function(a){return 0>a?a.toFixed(0):a};return eh&&("function"==typeof eh?a=eh:xi&&(a=function(a){return a?Hi(eh)(a):""})),a}function _(a){var b;return"y"===a?b=vh:"y2"===a?b=Eh:"x"===a&&(b=qh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?vh=b:"y2"===a?Eh=b:"x"===a&&(qh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",$g?"inner-top":"inner-right")}function hb(){return fb("y",$g?"inner-right":"inner-top")}function ib(){return fb("y2",$g?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Nf/2:Nf:b.isBottom?-Pf:b.isMiddle?-Pf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!$g,gb())}function rb(){return nb($g,hb())}function sb(){return nb($g,ib())}function tb(){return ob(!$g,gb())}function ub(){return ob($g,hb())}function vb(){return ob($g,ib())}function wb(){var a=gb();return $g?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":oh?oh-10:"3em"}function xb(){var a=hb();return $g?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return $g?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!$g,gb())}function Ab(){return pb($g,hb())}function Bb(){return pb($g,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return uf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){dj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),dj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),dj.select("."+f.axisY2+" ."+f.axisY2Label).transition().attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 uf.min(Object.keys(i).map(function(a){return uf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(wg.length>0)for(g=Sc(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 uf.max(Object.keys(i).map(function(a){return uf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Ch:th,n="y2"===c?Bh:sh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Dh:uh,r=ud()&&$g;return 0===l.length?"y2"===c?ig.domain():hg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(hg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&yh&&(f=b(yh.top)?yh.top:e,g=b(yh.bottom)?yh.bottom:e),"y2"===c&&Hh&&(f=b(Hh.top)?Hh.top:e,g=b(Hh.bottom)?Hh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return mh?xi?re(mh):mh:uf.min(a,function(a){return uf.min(a.values,function(a){return a.x})})}function Zb(a){return lh?xi?re(lh):lh:uf.max(a,function(a){return uf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return yi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof nh&&we(nh)?(e=b(nh.left)?nh.left:d,f=b(nh.right)?nh.right:d):e=f="number"==typeof nh?nh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=xi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=xi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?hg:ig;return b="y"===a.axis||"y2"===a.axis?$g?Pf:"start"in a?d(a.start):Pf:$g?"end"in a?gg(xi?re(a.end):a.end):Pf:Pf,c>b?0:b-c}function ic(a){return qg&&a===qg||we(rg)&&xe(rg,a)}function jc(a){return!ic(a)}function kc(a){return qg?qg:we(rg)?rg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=vf.data.xs[b])}),c}function mc(a,b){return a in vf.data.xs&&vf.data.xs[a]&&vf.data.xs[a][b]?vf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){rg[b]=a[b]})}function oc(a){return 1===uf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=ug[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),vf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=xi?a?a instanceof Date?a:re(a):re(mc(c,d)):zi&&!yi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?vf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):qg?(d=Object.keys(vf.data.xs),vf.data.xs[c]=d.length>0?vf.data.xs[d[0]]:void 0):we(rg)&&(vf.data.xs[c]=lc(f,vf.data.targets)):vf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!vf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=tg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return zi&&yi&&0===c&&g&&(0===e&&(ch=[]),ch.push(g)),("undefined"==typeof a[b]||vf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),yg&&$d(Cc(c).filter(function(a){return!(a in zg)}),yg),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&vf.data.targets[0].values[a-1]?vf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(vf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(xi?new Date(i):i);j.push(e)}return xi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Ji=Ji.concat(a)}function Mc(a){Ji=Ji.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Ki=Ki.concat(a)}function Oc(a){Ki=Ki.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return uf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Bg&&"desc"===Bg.toLowerCase()}function Nd(){return Bg&&"asc"===Bg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Bg&&a.sort(Bg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(vf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&ki&&(gj.html(ni(a,$(),wd(k),Gi)).style("display","block"),d=gj.property("offsetWidth"),e=gj.property("offsetHeight"),k?(g=Nf/2+c[0],i=Pf/2+c[1]+20):($g?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=gg(l[0].x)+20):(f=q(),g=f+t()+gg(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),gj.style("top",i+"px").style("left",g+"px"))}function Qd(){gj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});ki&&(be(vf.data.targets)||ee(vf.data.targets)||dj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr($g?"y1":"x1",Cd).attr($g?"y2":"x2",Cd))}function Sd(){dj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?gg(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return"number"==typeof Wh?Wh:b?2*a.tickOffset()*Xh/b:0}function $d(a,b){Dc(a).forEach(function(a){kj[a]=b===zg[a],zg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){zg[a.id]===b&&(c=!0),a.id in zg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in zg)||"line"===zg[b]||"spline"===zg[b]||"area"===zg[b]||"area-spline"===zg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===zg[b]||"area-spline"===zg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===zg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===zg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===zg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===zg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&ei||je(a)&&$h}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function re(b){var c;try{c=sg?uf.time.format(sg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+sg)}return c}function se(a,b){var c=uf.mouse(a),d=uf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?hg:ig,d=$g?1:0,e=$g?0:1;return Math.pow(gg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Ng(b,a.node()),dj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",$g?Ud:Td).attr("cy",$g?Td:Ud).attr("stroke",function(){return Gi(b)}).attr("r",1.4*Uh).transition().duration(100).attr("r",Uh)}function Be(a,b,c){Og(b,a.node()),dj.select("."+f.selectedCircles+ld(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){Ng(b,a.node()),a.transition().duration(100).style("fill",function(){return uf.rgb(Gi(b)).darker(1)})}function Ee(a,b){Og(b,a.node()),a.transition().duration(100).style("fill",function(){return Gi(b)})}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?dj.selectAll("."+f.circles+ld(c)):dj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Th)}function Je(a){He(a).filter(function(){return uf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Qh)}function Ke(a){return dj.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=$g?1:0,f=$g?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 $g?(c=he(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.getBoundingClientRect();return $g?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(mg,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return $g&&(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(hj=uf.select(xf),hj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(hj.html("").classed("c3",!0),vf.data.xs={},vf.data.targets=vc(b),Fg&&Lc(Fg===!0?Cc(vf.data.targets):Fg),n(),R(),gg.domain(uf.extent(_b(vf.data.targets))),hg.domain(Xb(vf.data.targets,"y")),ig.domain(Xb(vf.data.targets,"y2")),jg.domain(gg.domain()),kg.domain(hg.domain()),lg.domain(ig.domain()),ij=gg.domain(),Yi.scale(jg),Cf&&aj.scale(gg),bj=hj.append("svg").attr("width",Nf+Kf.left+Kf.right).attr("height",Pf+Kf.top+Kf.bottom).on("mouseenter",Ff).on("mouseleave",Gf),cj=bj.append("defs"),cj.append("clipPath").attr("id",ri).append("rect").attr("width",Nf).attr("height",Pf),cj.append("clipPath").attr("id",si).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),cj.append("clipPath").attr("id",ti).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),dj=bj.append("g").attr("transform",Pi.main),ej=bj.append("g").attr("transform",Pi.context),fj=bj.append("g").attr("transform",Pi.legend),Rg||ej.style("visibility","hidden"),Ug||(fj.style("visibility","hidden"),Ki=Cc(vf.data.targets)),gj=uf.select(xf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),pf(Cc(vf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),_g&&dj.append("g").attr("class",f.axisX).attr("clip-path",vi).attr("transform",Pi.x).append("text").attr("class",f.axisXLabel).attr("transform",$g?"rotate(-90)":"").style("text-anchor",zb),rh&&dj.append("g").attr("class",f.axisY).attr("clip-path",wi).attr("transform",Pi.y).append("text").attr("class",f.axisYLabel).attr("transform",$g?"":"rotate(-90)").style("text-anchor",Ab),Ah&&dj.append("g").attr("class",f.axisY2).attr("transform",Pi.y2).append("text").attr("class",f.axisY2Label).attr("transform",$g?"":"rotate(-90)").style("text-anchor",Bb),d=dj.append("g").attr("clip-path",ui).attr("class",f.grid),Jh&&d.append("g").attr("class",f.xgrids),we(Lh)&&d.append("g").attr("class",f.xgridLines),Rh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Mh&&d.append("g").attr("class",f.ygrids),we(Nh)&&d.append("g").attr("class",f.ygridLines),dj.append("g").attr("clip-path",ui).attr("class",f.regions),dj.append("g").attr("clip-path",ui).attr("class",f.chart),c=dj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Cf?$g?"ns-resize":"ew-resize":null),dj.select("."+f.chart).append("g").attr("class",f.chartBars),dj.select("."+f.chart).append("g").attr("class",f.chartLines),dj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Pi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),dj.select("."+f.chart).append("g").attr("class",f.chartTexts),Cf&&dj.insert("rect",Ef?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Nf).attr("height",Pf).style("opacity",0).style("cursor",$g?"ns-resize":"ew-resize").call(aj).on("dblclick.zoom",null),ph&&Yi.extent("function"!=typeof ph?ph:ph(_b())),ej.append("g").attr("clip-path",ui).attr("class",f.chart),ej.select("."+f.chart).append("g").attr("class",f.chartBars),ej.select("."+f.chart).append("g").attr("class",f.chartLines),ej.append("g").attr("clip-path",ui).attr("class",f.brush).call(Yi).selectAll("rect").attr($g?"width":"height",$g?Of:Qf),ej.append("g").attr("class",f.axisX).attr("transform",Pi.subx).attr("clip-path",$g?"":vi),ef(vf.data.targets),$g?dj.select("."+f.axisX).style("opacity",0).call(mg):(dj.select("."+f.axisY).style("opacity",0).call(ng),dj.select("."+f.axisY2).style("opacity",0).call(og)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),oi){if(xi&&"string"==typeof pi){for(pi=re(pi),e=0;e0){d=[];for(var g in ug)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(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){ee(vf.data.targets)||Gg&&(Ai=a,dj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Bi=!0,Pg())}function Ze(){ee(vf.data.targets)||Gg&&(dj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),dj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Bi=!1,Qg())}function $e(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Vd(),W=ee(vf.data.targets),X=Ic(vf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Jf:0,Q=D?P:0,R=E?P:0,c=dj.select("."+f.axisX).style("opacity",W?0:1),g=dj.select("."+f.axisY).style("opacity",W?0:1),h=dj.select("."+f.axisY2).style("opacity",W?0:1),e=ej.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Ug&&pf(Cc(vf.data.targets),a,O),yi&&(0!==X.length&&H&&G||gg.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(gg.domain(uf.extent(_b(X))),ij=gg.domain(),Cf&&aj.scale(gg).updateScaleExtent(),jg.domain(gg.domain()),Yi.scale(jg)),G&&(gg.domain(Yi.empty()?ij:Yi.extent()),Cf&&aj.scale(gg).updateScaleExtent()),jh||!ih&&!hh||(S=Kc(Jc(X),hh),mg.tickValues(S),pg.tickValues(S))),hg.domain(Xb(X,"y")),ig.domain(Xb(X,"y2")),O.axisX.call(mg),O.axisY.call(ng),O.axisY2.call(og),O.axisSubX.call(pg),G&&X.length)if(fh&&S){for(T=1;T=0&&uf.select(this).style("display",b%U?"none":"block")})}else uf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!$g&&kh&&eb(c,O.axisX,kh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),kg.domain(hg.domain()),lg.domain(ig.domain()),gj.style("display","none"),o(),dj.select("line."+f.xgridFocus).style("visibility","hidden"),Jh){if("year"===Kh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=gg.ticks(10);i=dj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",$g?0:function(a){return gg(a)-mg.tickOffset()}).attr("x2",$g?Nf:function(a){return gg(a)-mg.tickOffset()}).attr("y1",$g?function(a){return gg(a)-mg.tickOffset()}:Kf.top).attr("y2",$g?function(a){return gg(a)-mg.tickOffset()}:Pf).style("opacity",function(){return+uf.select(this).attr($g?"y1":"x1")===($g?Pf:0)?0:1}),i.exit().remove()}we(Lh)&&(k=dj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Lh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",$g?"":"rotate(-90)").attr("dx",$g?0:-Kf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",$g?0:Dd).attr("x2",$g?Nf:Dd).attr("y1",$g?Dd:Kf.top).attr("y2",$g?Dd:Pf).style("opacity",1),k.select("text").transition().duration(P).attr("x",$g?Nf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Mh&&(m=dj.select("."+f.ygrids).selectAll("."+f.ygrid).data(hg.ticks(Oh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",$g?hg:0).attr("x2",$g?hg:Nf).attr("y1",$g?0:hg).attr("y2",$g?Pf:hg),m.exit().remove()),A&&we(Nh)&&(n=dj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Nh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",$g?"rotate(-90)":"").attr("dx",$g?0:-Kf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",$g?Ed:0).attr("x2",$g?Ed:Nf).attr("y1",$g?0:Ed).attr("y2",$g?Pf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",$g?0:Nf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=dj.select("."+f.regions).selectAll("rect."+f.region).data(ji),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=dj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Gi(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=dj.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return $g?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),dj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",Zi).style("opacity",1),dj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",$i).style("opacity",jj),q=dj.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Qh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",$g?Ud:Td).attr("cy",$g?Td:Ud),q.exit().remove(),dj.each(function(){Ei=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=uf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Ei=!1}),dj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),dj.select("."+f.chartArcsTitle).style("opacity",de(vf.data.targets)?1:0),Rg&&(null!==uf.event&&"zoom"===uf.event.type&&Yi.extent(gg.orgDomain()).update(),B&&(!$g&&kh&&eb(e,O.axisSubX,kh),Yi.empty()||Yi.extent(gg.orgDomain()).update(),K=Ne(V,!0),u=ej.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Gi(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),ej.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",_i).style("opacity",1))),dj.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),dj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",$g?Ud:Td).attr("cy",$g?Td:Ud),v=dj.select("."+f.eventRects),we(rg)&&!oc(rg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=dj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Nf).attr("height",Pf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),zi&&!yi?(z=function(a,b){var c=xc(b),d=yc(b),e=vf.data.xs[a.id][b];return(gg(d?d:e+50)-gg(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=vf.data.xs[a.id][b];return(gg(d)+gg(c?c:d-50))/2}):(z=L(),y=function(a){return gg(a.x)-z/2}),x=Ac(vf.data.targets),dj.select("."+f.eventRects).datum(x?x.values:[]),w=dj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",$g?0:y).attr("y",$g?y:0).attr("width",$g?Nf:z).attr("height",$g?z:Pf),w.exit().remove()),Cc(vf.data.targets).forEach(function(a){kj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===uf.event.sourceEvent.type&&aj.altDomain?(gg.domain(aj.altDomain),void aj.scale(gg).updateScaleExtent()):(yi&&gg.orgDomain()[0]===ij[0]&&gg.domain([ij[0]-1e-10,gg.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===uf.event.sourceEvent.type&&(Ci=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){bj.attr("width",Rf).attr("height",Sf),bj.select("#"+ri).select("rect").attr("width",Nf).attr("height",Pf),bj.select("#"+si).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),bj.select("#"+ti).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),bj.select("."+f.zoomRect).attr("width",Nf).attr("height",Pf),hj.style("max-height",Sf+"px")}function df(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=dj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Gi(a)}),e=dj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Ig(a)?"pointer":null}),c=dj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Gi(a)}),b.append("path").attr("class",dd).style("opacity",function(){return jj=+uf.select(this).style("opacity"),0}).style("fill",function(a){return Gi(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Gi(a)}).style("cursor",function(a){return Ig(a)?"pointer":null}),a.forEach(function(a){dj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=dj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Zf(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Gi(a.data)}).style("cursor",function(a){return Ig(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Ei||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),lf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,uf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Ei||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),mf(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Rg&&(n=ej.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Gi(a)}),l=ej.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Gi(a)})),bj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Jf).style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),vf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Qi?j:i,l=Qi?Q():P();return d&&(w=0,C=0,t=0,u=0),Ug&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Qi?u:t,void(Zg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=fj.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,Qi?(g=function(a){return t*(.2+B[a])},j=function(a){return A[B[a]]+x[a]}):(g=function(a){return A[B[a]]+x[a]},j=function(a){return u*(.2+B[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=fj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Wg?Wg(a):vf.toggle(a)}).on("mouseover",function(a){uf.select(this).classed(f.legendItemFocused,!0),Ei||vf.focus(a),"function"==typeof Xg&&Xg(a)}).on("mouseout",function(a){uf.select(this).classed(f.legendItemFocused,!1),Ei||vf.revert(),"function"==typeof Yg&&Yg(a)}),o.append("text").text(function(a){return d(ug[a])?ug[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Qi?h:-200).attr("y",Qi?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Qi?i:-200).attr("y",Qi?-200:l).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Gi(a)}).attr("x",Qi?h:-200).attr("y",Qi?-200:j).attr("width",10).attr("height",10),fj.selectAll("text").data(a).text(function(a){return d(ug[a])?ug[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),fj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),fj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),fj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=uf.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?jf(b):kf(b):Ui}),N(t),O(u),M(C),n(),R(),cf(),m(q,c)}function qf(a){return Ec(vf.data.targets,a.id)}function rf(a){return"data"in a&&Ec(vf.data.targets,a.data.id)}function sf(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 tf(a,b,c){var d=!ee(vf.data.targets);Ei=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var uf=a.d3?a.d3:a.require?a.require("d3"):void 0,vf={data:{},axis:{},legend:{}},wf={},xf=h(["bindto"],"#chart"),yf=h(["size","width"]),zf=h(["size","height"]),Af=h(["padding","left"],50),Bf=h(["padding","right"]),Cf=h(["zoom","enabled"],!1),Df=h(["zoom","extent"]),Ef=h(["zoom","privileged"],!1),Ff=h(["onenter"],function(){}),Gf=h(["onleave"],function(){}),Hf=h(["onresize"],function(){}),If=h(["onresized"],function(){}),Jf=h(["transition","duration"],350);g("data","data is required in config");var Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg=h(["data","x"]),rg=h(["data","xs"],{}),sg=h(["data","x_format"]),tg=h(["data","id_converter"],function(a){return a}),ug=h(["data","names"],{}),vg=h(["data","classes"],{}),wg=h(["data","groups"],[]),xg=h(["data","axes"],{}),yg=h(["data","type"]),zg=h(["data","types"],{}),Ag=h(["data","labels"],{}),Bg=h(["data","order"]),Cg=h(["data","regions"],{}),Dg=h(["data","color"]),Eg=h(["data","colors"],{}),Fg=h(["data","hide"],!1),Gg=h(["data","selection","enabled"],!1),Hg=h(["data","selection","grouped"],!1),Ig=h(["data","selection","isselectable"],function(){return!0}),Jg=h(["data","selection","multiple"],!0),Kg=h(["data","onclick"],function(){}),Lg=h(["data","onenter"],function(){}),Mg=h(["data","onleave"],function(){}),Ng=h(["data","onselected"],function(){}),Og=h(["data","onunselected"],function(){}),Pg=h(["data","ondragstart"],function(){}),Qg=h(["data","ondragend"],function(){}),Rg=h(["subchart","show"],!1),Sg=h(["subchart","size","height"],60),Tg=h(["color","pattern"],[]),Ug=h(["legend","show"],!0),Vg=h(["legend","position"],"bottom"),Wg=h(["legend","item","onclick"]),Xg=h(["legend","item","onmouseover"]),Yg=h(["legend","item","onmouseout"]),Zg=h(["legend","equally"],!1),$g=h(["axis","rotated"],!1),_g=h(["axis","x","show"],!0),ah=h(["axis","x","type"],"indexed"),bh=h(["axis","x","localtime"],!0),ch=h(["axis","x","categories"],[]),dh=h(["axis","x","tick","centered"],!1),eh=h(["axis","x","tick","format"]),fh=h(["axis","x","tick","culling"],{}),gh=h(["axis","x","tick","culling","max"],10),hh=h(["axis","x","tick","count"]),ih=h(["axis","x","tick","fit"],!0),jh=h(["axis","x","tick","values"],null),kh=h(["axis","x","tick","rotate"]),lh=h(["axis","x","max"],null),mh=h(["axis","x","min"],null),nh=h(["axis","x","padding"],{}),oh=h(["axis","x","height"]),ph=h(["axis","x","default"]),qh=h(["axis","x","label"],{}),rh=h(["axis","y","show"],!0),sh=h(["axis","y","max"]),th=h(["axis","y","min"]),uh=h(["axis","y","center"]),vh=h(["axis","y","label"],{}),wh=h(["axis","y","inner"],!1),xh=h(["axis","y","tick","format"]),yh=h(["axis","y","padding"],{}),zh=h(["axis","y","ticks"],10),Ah=h(["axis","y2","show"],!1),Bh=h(["axis","y2","max"]),Ch=h(["axis","y2","min"]),Dh=h(["axis","y2","center"]),Eh=h(["axis","y2","label"],{}),Fh=h(["axis","y2","inner"],!1),Gh=h(["axis","y2","tick","format"]),Hh=h(["axis","y2","padding"],{}),Ih=h(["axis","y2","ticks"],10),Jh=h(["grid","x","show"],!1),Kh=h(["grid","x","type"],"tick"),Lh=h(["grid","x","lines"],[]),Mh=h(["grid","y","show"],!1),Nh=h(["grid","y","lines"],[]),Oh=h(["grid","y","ticks"],10),Ph=h(["point","show"],!0),Qh=Ph?h(["point","r"],2.5):0,Rh=h(["point","focus","line","enabled"],!0),Sh=h(["point","focus","expand","enabled"],!0),Th=h(["point","focus","expand","r"],Sh?4:Qh),Uh=h(["point","focus","select","r"],8),Vh=h(["line","connect_null"],!1),Wh=h(["bar","width"]),Xh=h(["bar","width","ratio"],.6),Yh=h(["pie","label","show"],!0),Zh=h(["pie","label","format"]),$h=h(["pie","expand"],!0),_h=h(["pie","onclick"],function(){}),ai=h(["pie","onmouseover"],function(){}),bi=h(["pie","onmouseout"],function(){}),ci=h(["donut","label","show"],!0),di=h(["donut","label","format"]),ei=h(["donut","expand"],!0),fi=h(["donut","title"],""),gi=h(["donut","onclick"],function(){}),hi=h(["donut","onmouseover"],function(){}),ii=h(["donut","onmouseout"],function(){}),ji=h(["regions"],[]),ki=h(["tooltip","show"],!0),li=h(["tooltip","format","title"]),mi=h(["tooltip","format","value"]),ni=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=li?li:b,l=mi?mi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),oi=h(["tooltip","init","show"],!1),pi=h(["tooltip","init","x"],0),qi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ri=("string"==typeof xf?xf.replace("#",""):xf.id)+"-clip",si=ri+"-xaxis",ti=ri+"-yaxis",ui=i(ri),vi=i(si),wi=i(ti),xi="timeseries"===ah,yi="categorized"===ah,zi=!xi&&(qg||we(rg)),Ai=null,Bi=!1,Ci=!1,Di=!1,Ei=!1,Fi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Gi=qe(Eg,we(Tg)?Tg:Fi,Dg),Hi=bh?uf.time.format:uf.time.format.utc,Ii=function(){var a=[[Hi("%Y/%-m/%-d"),function(){return!0}],[Hi("%-m/%-d"),function(a){return a.getMonth()}],[Hi("%-m/%-d"),function(a){return 1!==a.getDate()}],[Hi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Hi("%I %p"),function(a){return a.getHours()}],[Hi("%I:%M"),function(a){return a.getMinutes()}],[Hi(":%S"),function(a){return a.getSeconds()}],[Hi(".%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)}}(),Ji=[],Ki=[],Li=$g?"left":"bottom",Mi=$g?wh?"top":"bottom":wh?"right":"left",Ni=$g?Fh?"bottom":"top":Fh?"left":"right",Oi=$g?"left":"bottom",Pi={main:function(){return"translate("+Kf.left+","+Kf.top+")"},context:function(){return"translate("+Lf.left+","+Lf.top+")"},legend:function(){return"translate("+Mf.left+","+Mf.top+")"},x:function(){return"translate(0,"+($g?0:Pf)+")"},y:function(){return"translate(0,"+($g?Pf:0)+")"},y2:function(){return"translate("+($g?0:Nf)+","+($g?1:0)+")"},subx:function(){return"translate(0,"+($g?0:Qf)+")"},arc:function(){return"translate("+Nf/2+","+Pf/2+")"}},Qi="right"===Vg,Ri=0,Si=0,Ti=0,Ui=.15,Vi=30,Wi=$g&&!_g?0:30,Xi=5;Zf=uf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Yi,Zi=function(){var a=uf.svg.line().x($g?function(a){return V(a.id)(a.value)}:Cd).y($g?Cd:function(a){return V(a.id)(a.value)});return Vh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Vh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Cg[b.id]?Se(e,gg,V(b.id),Cg[b.id]):a(e)):(c=e[0]?gg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,$g?"M "+d+" "+c:"M "+c+" "+d)}}(),$i=function(){var a;return a=$g?uf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):uf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?gg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,$g?"M "+d+" "+c:"M "+c+" "+d)}}(),_i=function(){var a=uf.svg.line().x($g?function(a){return W(a.id)(a.value)}:Fd).y($g?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+jg(c[0].x)+" "+W(b.id)(c[0].value)}}(),aj=function(){};Yi=uf.svg.brush().on("brush",_e),Yi.update=function(){return ej&&ej.select("."+f.brush).call(this),this},Yi.scale=function(a){return $g?this.y(a):this.x(a)},Cf&&(aj=uf.behavior.zoom().on("zoomstart",function(){aj.altDomain=uf.event.sourceEvent.altKey?gg.orgDomain():null}).on("zoom",Cf?af:null),aj.scale=function(a){return $g?this.y(a):this.x(a)},aj.orgScaleExtent=function(){var a=Df?Df:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},aj.updateScaleExtent=function(){var a=ac(gg.orgDomain())/ac(ij),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var bj,cj,dj,ej,fj,gj,hj,ij,jj,kj={};if(vf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=bj.selectAll(md(a)),d=c.filter(qf),e=c.filter(rf);vf.revert(),vf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(vf.data.targets)&&Nb(a,!0),lf(a,!0)},vf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=bj.selectAll(md(a)),d=c.filter(qf),e=c.filter(rf);vf.revert(),b(d.classed(f.focused,!1)),b(e),ee(vf.data.targets)&&Ob(a),lf(a,!1)},vf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=bj.selectAll(md(a)),d=c.filter(qf),e=c.filter(rf);b(d.classed(f.focused,!1)),b(e),ee(vf.data.targets)&&Ob(a),mf()},vf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),bj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&nf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},vf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),bj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&of(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},vf.toggle=function(a){Gc(a)?vf.hide(a):vf.show(a)},vf.unzoom=function(){Yi.clear().update(),$e({withUpdateXDomain:!0})},vf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){vg[b]=a.classes[b]}),"categories"in a&&yi&&(ch=a.categories,mg.categories(ch)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},vf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},vf.selected=function(a){return uf.merge(dj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return uf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},vf.select=function(a,b,c){Gg&&dj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=uf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Hg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Ig(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},vf.unselect=function(a,b){Gg&&dj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=uf.select(this),g="circle"===this.nodeName?Be:Ee,h=Hg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Ig(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},vf.toLine=function(a){tf(a,"line")},vf.toSpline=function(a){tf(a,"spline")},vf.toBar=function(a){tf(a,"bar")},vf.toScatter=function(a){tf(a,"scatter")},vf.toArea=function(a){tf(a,"area")},vf.toAreaSpline=function(a){tf(a,"area-spline") -},vf.toPie=function(a){tf(a,"pie",{withTransform:!0})},vf.toDonut=function(a){tf(a,"donut",{withTransform:!0})},vf.groups=function(a){return c(a)?wg:(wg=a,$e(),wg)},vf.xgrids=function(a){return a?(Lh=a,$e(),Lh):Lh},vf.xgrids.add=function(a){return a?vf.xgrids(Lh.concat(a)):void 0},vf.xgrids.remove=function(a){var b=sf(a);return vf.xgrids(Lh.filter(b))},vf.ygrids=function(a){return a?(Nh=a,$e(),Nh):Nh},vf.ygrids.add=function(a){return a?vf.ygrids(Nh.concat(a)):void 0},vf.ygrids.remove=function(a){var b=sf(a);return vf.ygrids(Nh.filter(b))},vf.regions=function(a){return c(a)?ji:(ji=a,$e(),ji)},vf.regions.add=function(a){return c(a)?ji:(ji=ji.concat(a),$e(),ji)},vf.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;bj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ji=ji.filter(function(b){return b.classes.indexOf(a)<0})}),ji},vf.data.get=function(a){var b=vf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},vf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},vf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){ug[b]=a[b]}),pf(Cc(vf.data.targets),{withTransition:!0}),ug):ug},vf.x=function(a){return arguments.length&&(qc(vf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),vf.data.xs},vf.xs=function(a){return arguments.length&&(rc(vf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),vf.data.xs},vf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},vf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(sh=+a.y),b(a.y2)&&(Bh=+a.y2)):sh=Bh=+a,$e())},vf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(th=+a.y),b(a.y2)&&(Ch=+a.y2)):th=Ch=+a,$e())},vf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&vf.axis.max(a.max),"undefined"!=typeof a.min&&vf.axis.min(a.min))},vf.legend.show=function(a){nf(Dc(a)),$e({withLegend:!0})},vf.legend.hide=function(a){of(Dc(a)),$e({withLegend:!0})},vf.resize=function(a){yf=a?a.width:null,zf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},vf.destroy=function(){vf.data.targets=void 0,vf.data.xs={},hj.html(""),a.onresize=null},"url"in e.data)uf.xhr(e.data.url,function(a,b){var c,d=uf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=uf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return vf},"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.33"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",legendItemFocused:"c3-legend-item-focused",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;cQf&&(Qf=0),0>Sf&&(Sf=0),Rf=bh?Nf.left-Yi-Zi:Qf,Tf=bh?Sf:Vf-Of.top-Of.bottom,0>Rf&&(Rf=0),0>Tf&&(Tf=0),p(),Ti&&ee(yf.data.targets)&&(Pf.left=Qf/2+Xf)}function o(){gj.select("line."+f.xgridFocus).attr("x1",bh?0:-10).attr("x2",bh?Qf:-10).attr("y1",bh?-10:Nf.top).attr("y2",bh?-10:Sf)}function p(){Xf=Sf/2,Wf=.95*Xf,Yf=de(yf.data.targets)?.6*Wf:0}function q(){var a=bh?f.axisX:f.axisY,b=gj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=xf.select(Af).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Bf?Bf:x()}function s(){var a=Cf?Cf:y();return a>0?a:320}function t(){return ee(yf.data.targets)?0:Df?Df:bh?ch?v("x"):1:!uh||zh?1:v("y")}function u(){var a=1;return ee(yf.data.targets)?0:Ef?Ef:Ti?P()+(Dh&&!bh?v("y2"):a):Dh?Ih||bh?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||ch?"x"===a&&rh?rh:"y"!==a||uh?"y2"!==a||Dh?(jb(a).isInner?30:40)+("y2"===a?-10:0):$i:Xg&&!Ti?10:1:0}function x(){return+xf.select(Af).style("width").replace("px","")}function y(){return+xf.select(Af).style("height").replace("px","")}function z(a){return a?-5:-(Nf.left-1)}function A(a){return a?-20:-4}function B(){return z(!bh)}function C(){return A(!bh)}function D(){return z(bh)}function E(){return A(bh)}function F(a){return a?Qf+2+4:Nf.left+20}function G(a){return a?(rh?rh:0)+80:Sf+8}function H(){return F(!bh)}function I(){return G(!bh)}function J(){return F(bh)}function K(){return G(bh)}function L(){var a,b,c,d,e,f=Ac(yf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=jg(b.x)-jg(a.x),d=zc(),e=ae(yf.data.targets)?(d-(Bi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Ui=a}function N(a){Vi=a}function O(a){Wi=a}function P(){return Xg?Ti?Vi*(Ui+1):Uf:0}function Q(){return Xg?Ti?Vf:Wi*(Ui+1):0}function R(){var a,b,c=!jg;bg=bh?1:0,cg=bh?Sf:Qf,dg=bh?0:Sf,eg=bh?Qf:1,fg=bg,gg=cg,hg=bh?0:Tf,ig=bh?Rf:1,jg=T(bg,cg,c?void 0:jg.domain(),function(){return pg.tickOffset()}),kg=U(dg,eg,c?void 0:kg.domain()),lg=U(dg,eg,c?void 0:lg.domain()),mg=T(bg,cg,lj,function(a){return a%1?0:sg.tickOffset()}),ng=U(hg,ig,c?void 0:ng.domain()),og=U(hg,ig,c?void 0:og.domain()),a=$(),b=mh?mh:c?void 0:pg.tickValues(),pg=X(jg,Oi,a,b),sg=X(mg,Ri,a,b),qg=Y(kg,Pi,Ah,Ch),rg=Y(lg,Qi,Jh,Lh),c||(_i.scale(mg),Ff&&dj.scale(jg)),S()}function S(){Zf=Gb(),$f=Hb(),_f=Hb(.98)}function T(a,b,d,e){var f=(Ai?xf.time.scale():xf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Bi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=xf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?lg:kg}function W(a){return"y2"===Z(a)?og:ng}function X(a,b,c,d){var e=(Bi?Eb():xf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Bi?(e.tickCentered(gh),ve(ih)&&(ih=!1)):e.tickOffset=function(){var a=Bc(yf.data.targets),b=jg(a[1])-jg(a[0]);return b/zc()/2},Bi&&e.categories(fh),e}function Y(a,b,c,d){return xf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Ag?Ag[a]:"y"}function $(){var a=Ai?Li:Bi?Tc:function(a){return 0>a?a.toFixed(0):a};return hh&&("function"==typeof hh?a=hh:Ai&&(a=function(a){return a?Ki(hh)(a):""})),a}function _(a){var b;return"y"===a?b=yh:"y2"===a?b=Hh:"x"===a&&(b=th),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?yh=b:"y2"===a?Hh=b:"x"===a&&(th=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",bh?"inner-top":"inner-right")}function hb(){return fb("y",bh?"inner-right":"inner-top")}function ib(){return fb("y2",bh?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Qf/2:Qf:b.isBottom?-Sf:b.isMiddle?-Sf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!bh,gb())}function rb(){return nb(bh,hb())}function sb(){return nb(bh,ib())}function tb(){return ob(!bh,gb())}function ub(){return ob(bh,hb())}function vb(){return ob(bh,ib())}function wb(){var a=gb();return bh?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":rh?rh-10:"3em"}function xb(){var a=hb();return bh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return bh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!bh,gb())}function Ab(){return pb(bh,hb())}function Bb(){return pb(bh,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return xf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){gj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),gj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),gj.select("."+f.axisY2+" ."+f.axisY2Label).transition().attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 xf.min(Object.keys(i).map(function(a){return xf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(zg.length>0)for(g=Sc(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 xf.max(Object.keys(i).map(function(a){return xf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Fh:wh,n="y2"===c?Eh:vh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Gh:xh,r=ud()&&bh;return 0===l.length?"y2"===c?lg.domain():kg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(kg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Bh&&(f=b(Bh.top)?Bh.top:e,g=b(Bh.bottom)?Bh.bottom:e),"y2"===c&&Kh&&(f=b(Kh.top)?Kh.top:e,g=b(Kh.bottom)?Kh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return ph?Ai?re(ph):ph:xf.min(a,function(a){return xf.min(a.values,function(a){return a.x})})}function Zb(a){return oh?Ai?re(oh):oh:xf.max(a,function(a){return xf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Bi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof qh&&we(qh)?(e=b(qh.left)?qh.left:d,f=b(qh.right)?qh.right:d):e=f="number"==typeof qh?qh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=Ai?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Ai?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?kg:lg;return b="y"===a.axis||"y2"===a.axis?bh?Sf:"start"in a?d(a.start):Sf:bh?"end"in a?jg(Ai?re(a.end):a.end):Sf:Sf,c>b?0:b-c}function ic(a){return tg&&a===tg||we(ug)&&xe(ug,a)}function jc(a){return!ic(a)}function kc(a){return tg?tg:we(ug)?ug[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=yf.data.xs[b])}),c}function mc(a,b){return a in yf.data.xs&&yf.data.xs[a]&&yf.data.xs[a][b]?yf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){ug[b]=a[b]})}function oc(a){return 1===xf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=xg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),yf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=Ai?a?a instanceof Date?a:re(a):re(mc(c,d)):Ci&&!Bi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?yf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):tg?(d=Object.keys(yf.data.xs),yf.data.xs[c]=d.length>0?yf.data.xs[d[0]]:void 0):we(ug)&&(yf.data.xs[c]=lc(f,yf.data.targets)):yf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!yf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=wg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ci&&Bi&&0===c&&g&&(0===e&&(fh=[]),fh.push(g)),("undefined"==typeof a[b]||yf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Bg&&$d(Cc(c).filter(function(a){return!(a in Cg)}),Bg),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&yf.data.targets[0].values[a-1]?yf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(yf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Ai?new Date(i):i);j.push(e)}return Ai||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Mi=Mi.concat(a)}function Mc(a){Mi=Mi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Ni=Ni.concat(a)}function Oc(a){Ni=Ni.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return xf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Eg&&"desc"===Eg.toLowerCase()}function Nd(){return Eg&&"asc"===Eg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Eg&&a.sort(Eg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(yf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&ni&&(jj.html(qi(a,$(),wd(k),Ji)).style("display","block"),d=jj.property("offsetWidth"),e=jj.property("offsetHeight"),k?(g=Qf/2+c[0],i=Sf/2+c[1]+20):(bh?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=jg(l[0].x)+20):(f=q(),g=f+t()+jg(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),jj.style("top",i+"px").style("left",g+"px"))}function Qd(){jj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});ni&&(be(yf.data.targets)||ee(yf.data.targets)||gj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(bh?"y1":"x1",Cd).attr(bh?"y2":"x2",Cd))}function Sd(){gj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?jg(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return"number"==typeof Zh?Zh:b?2*a.tickOffset()*$h/b:0}function $d(a,b){Dc(a).forEach(function(a){nj[a]=b===Cg[a],Cg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Cg[a.id]===b&&(c=!0),a.id in Cg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Cg)||"line"===Cg[b]||"spline"===Cg[b]||"area"===Cg[b]||"area-spline"===Cg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Cg[b]||"area-spline"===Cg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Cg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Cg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Cg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Cg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&hi||je(a)&&bi}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function re(b){var c;try{c=vg?xf.time.format(vg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+vg)}return c}function se(a,b){var c=xf.mouse(a),d=xf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?kg:lg,d=bh?1:0,e=bh?0:1;return Math.pow(jg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Qg(b,a.node()),gj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud).attr("stroke",function(){return Ji(b)}).attr("r",1.4*Je(b)).transition().duration(100).attr("r",Je)}function Be(a,b,c){Rg(b,a.node()),gj.select("."+f.selectedCircles+ld(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){Qg(b,a.node()),a.transition().duration(100).style("fill",function(){return xf.rgb(Ji(b)).darker(1)})}function Ee(a,b){Rg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ji(b)})}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){return Sh?"function"==typeof Th?Th(a):Th:0}function Ie(a){return Vh?Wh?Wh:1.75*He(a):He(a)}function Je(a){return Xh?Xh:4*He(a)}function Ke(a,c){return(c?gj.selectAll("."+f.circles+ld(c)):gj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Le(a,b){Ke(a,b).classed(f.EXPANDED,!0).attr("r",Ie)}function Me(a){Ke(a).filter(function(){return xf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",He)}function Ne(a){return gj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Oe(a){Ne(a).classed(f.EXPANDED,!0)}function Pe(a){Ne(a).classed(f.EXPANDED,!1)}function Qe(a,b){var c=Ue(a,b);return function(a,b){var d=c(a,b),e=bh?1:0,f=bh?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 Re(a,b){var c=Ue(a,!1),d=b?Se:Te;return function(a,b){return d(c(a,b),a,this)}}function Se(a,b){var c;return bh?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Te(a,b,c){var d=c.getBoundingClientRect();return bh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Ue(a,b){var c=a.__max__+1,d=Zd(pg,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return bh&&(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 Ve(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 We(b){var c,d,e;if(kj=xf.select(Af),kj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(kj.html("").classed("c3",!0),yf.data.xs={},yf.data.targets=vc(b),Ig&&Lc(Ig===!0?Cc(yf.data.targets):Ig),n(),R(),jg.domain(xf.extent(_b(yf.data.targets))),kg.domain(Xb(yf.data.targets,"y")),lg.domain(Xb(yf.data.targets,"y2")),mg.domain(jg.domain()),ng.domain(kg.domain()),og.domain(lg.domain()),lj=jg.domain(),_i.scale(mg),Ff&&dj.scale(jg),ej=kj.append("svg").attr("width",Qf+Nf.left+Nf.right).attr("height",Sf+Nf.top+Nf.bottom).on("mouseenter",If).on("mouseleave",Jf),fj=ej.append("defs"),fj.append("clipPath").attr("id",ui).append("rect").attr("width",Qf).attr("height",Sf),fj.append("clipPath").attr("id",vi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),fj.append("clipPath").attr("id",wi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),gj=ej.append("g").attr("transform",Si.main),hj=ej.append("g").attr("transform",Si.context),ij=ej.append("g").attr("transform",Si.legend),Ug||hj.style("visibility","hidden"),Xg||(ij.style("visibility","hidden"),Ni=Cc(yf.data.targets)),jj=xf.select(Af).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),sf(Cc(yf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),ch&&gj.append("g").attr("class",f.axisX).attr("clip-path",yi).attr("transform",Si.x).append("text").attr("class",f.axisXLabel).attr("transform",bh?"rotate(-90)":"").style("text-anchor",zb),uh&&gj.append("g").attr("class",f.axisY).attr("clip-path",zi).attr("transform",Si.y).append("text").attr("class",f.axisYLabel).attr("transform",bh?"":"rotate(-90)").style("text-anchor",Ab),Dh&&gj.append("g").attr("class",f.axisY2).attr("transform",Si.y2).append("text").attr("class",f.axisY2Label).attr("transform",bh?"":"rotate(-90)").style("text-anchor",Bb),d=gj.append("g").attr("clip-path",xi).attr("class",f.grid),Mh&&d.append("g").attr("class",f.xgrids),we(Oh)&&d.append("g").attr("class",f.xgridLines),Uh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Ph&&d.append("g").attr("class",f.ygrids),we(Qh)&&d.append("g").attr("class",f.ygridLines),gj.append("g").attr("clip-path",xi).attr("class",f.regions),gj.append("g").attr("clip-path",xi).attr("class",f.chart),c=gj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ff?bh?"ns-resize":"ew-resize":null),gj.select("."+f.chart).append("g").attr("class",f.chartBars),gj.select("."+f.chart).append("g").attr("class",f.chartLines),gj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Si.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),gj.select("."+f.chart).append("g").attr("class",f.chartTexts),Ff&&gj.insert("rect",Hf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Qf).attr("height",Sf).style("opacity",0).style("cursor",bh?"ns-resize":"ew-resize").call(dj).on("dblclick.zoom",null),sh&&_i.extent("function"!=typeof sh?sh:sh(_b())),hj.append("g").attr("clip-path",xi).attr("class",f.chart),hj.select("."+f.chart).append("g").attr("class",f.chartBars),hj.select("."+f.chart).append("g").attr("class",f.chartLines),hj.append("g").attr("clip-path",xi).attr("class",f.brush).call(_i).selectAll("rect").attr(bh?"width":"height",bh?Rf:Tf),hj.append("g").attr("class",f.axisX).attr("transform",Si.subx).attr("clip-path",bh?"":yi),hf(yf.data.targets),bh?gj.select("."+f.axisX).style("opacity",0).call(pg):(gj.select("."+f.axisY).style("opacity",0).call(qg),gj.select("."+f.axisY2).style("opacity",0).call(rg)),n(),R(),ff(),m(!1),bf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),ri){if(Ai&&"string"==typeof si){for(si=re(si),e=0;e0){d=[];for(var g in xg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(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 _e(a){ee(yf.data.targets)||Jg&&(Di=a,gj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ei=!0,Sg())}function af(){ee(yf.data.targets)||Jg&&(gj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),gj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ei=!1,Tg())}function bf(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Vd(),W=ee(yf.data.targets),X=Ic(yf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Mf:0,Q=D?P:0,R=E?P:0,c=gj.select("."+f.axisX).style("opacity",W?0:1),g=gj.select("."+f.axisY).style("opacity",W?0:1),h=gj.select("."+f.axisY2).style("opacity",W?0:1),e=hj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Xg&&sf(Cc(yf.data.targets),a,O),Bi&&(0!==X.length&&H&&G||jg.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(jg.domain(xf.extent(_b(X))),lj=jg.domain(),Ff&&dj.scale(jg).updateScaleExtent(),mg.domain(jg.domain()),_i.scale(mg)),G&&(jg.domain(_i.empty()?lj:_i.extent()),Ff&&dj.scale(jg).updateScaleExtent()),mh||!lh&&!kh||(S=Kc(Jc(X),kh),pg.tickValues(S),sg.tickValues(S))),kg.domain(Xb(X,"y")),lg.domain(Xb(X,"y2")),O.axisX.call(pg),O.axisY.call(qg),O.axisY2.call(rg),O.axisSubX.call(sg),G&&X.length)if(ih&&S){for(T=1;T=0&&xf.select(this).style("display",b%U?"none":"block")})}else xf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!bh&&nh&&eb(c,O.axisX,nh),J=Qe(V),M=Re(V,!0),N=Re(V,!1),Db(),ng.domain(kg.domain()),og.domain(lg.domain()),jj.style("display","none"),o(),gj.select("line."+f.xgridFocus).style("visibility","hidden"),Mh){if("year"===Nh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=jg.ticks(10);i=gj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",bh?0:function(a){return jg(a)-pg.tickOffset()}).attr("x2",bh?Qf:function(a){return jg(a)-pg.tickOffset()}).attr("y1",bh?function(a){return jg(a)-pg.tickOffset()}:Nf.top).attr("y2",bh?function(a){return jg(a)-pg.tickOffset()}:Sf).style("opacity",function(){return+xf.select(this).attr(bh?"y1":"x1")===(bh?Sf:0)?0:1}),i.exit().remove()}we(Oh)&&(k=gj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Oh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",bh?"":"rotate(-90)").attr("dx",bh?0:-Nf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",bh?0:Dd).attr("x2",bh?Qf:Dd).attr("y1",bh?Dd:Nf.top).attr("y2",bh?Dd:Sf).style("opacity",1),k.select("text").transition().duration(P).attr("x",bh?Qf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Ph&&(m=gj.select("."+f.ygrids).selectAll("."+f.ygrid).data(kg.ticks(Rh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",bh?kg:0).attr("x2",bh?kg:Qf).attr("y1",bh?0:kg).attr("y2",bh?Sf:kg),m.exit().remove()),A&&we(Qh)&&(n=gj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Qh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",bh?"rotate(-90)":"").attr("dx",bh?0:-Nf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",bh?Ed:0).attr("x2",bh?Ed:Qf).attr("y1",bh?0:Ed).attr("y2",bh?Sf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",bh?0:Qf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=gj.select("."+f.regions).selectAll("rect."+f.region).data(mi),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=gj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Ji(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=gj.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return bh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),gj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1),gj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",bj).style("opacity",mj),q=gj.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",He),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud),q.exit().remove(),gj.each(function(){Hi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=xf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Hi=!1}),gj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),gj.select("."+f.chartArcsTitle).style("opacity",de(yf.data.targets)?1:0),Ug&&(null!==xf.event&&"zoom"===xf.event.type&&_i.extent(jg.orgDomain()).update(),B&&(!bh&&nh&&eb(e,O.axisSubX,nh),_i.empty()||_i.extent(jg.orgDomain()).update(),K=Qe(V,!0),u=hj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Ji(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),hj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",cj).style("opacity",1))),gj.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),gj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud),v=gj.select("."+f.eventRects),we(ug)&&!oc(ug)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=gj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ye(w.enter()),w.attr("x",0).attr("y",0).attr("width",Qf).attr("height",Sf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ci&&!Bi?(z=function(a,b){var c=xc(b),d=yc(b),e=yf.data.xs[a.id][b];return(jg(d?d:e+50)-jg(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=yf.data.xs[a.id][b];return(jg(d)+jg(c?c:d-50))/2}):(z=L(),y=function(a){return jg(a.x)-z/2}),x=Ac(yf.data.targets),gj.select("."+f.eventRects).datum(x?x.values:[]),w=gj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Xe(w.enter()),w.attr("class",fd).attr("x",bh?0:y).attr("y",bh?y:0).attr("width",bh?Qf:z).attr("height",bh?z:Sf),w.exit().remove()),Cc(yf.data.targets).forEach(function(a){nj[a]=!0})}function cf(){bf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function df(){return"mousemove"===xf.event.sourceEvent.type&&dj.altDomain?(jg.domain(dj.altDomain),void dj.scale(jg).updateScaleExtent()):(Bi&&jg.orgDomain()[0]===lj[0]&&jg.domain([lj[0]-1e-10,jg.orgDomain()[1]]),bf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===xf.event.sourceEvent.type&&(Fi=!0)))}function ef(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function ff(){ej.attr("width",Uf).attr("height",Vf),ej.select("#"+ui).select("rect").attr("width",Qf).attr("height",Sf),ej.select("#"+vi).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),ej.select("#"+wi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej.select("."+f.zoomRect).attr("width",Qf).attr("height",Sf),kj.style("max-height",Vf+"px")}function gf(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),ff(),m(a.withTransition),bf(a)}function hf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=gj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Ji(a)}),e=gj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Lg(a)?"pointer":null}),c=gj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ji(a)}),b.append("path").attr("class",dd).style("opacity",function(){return mj=+xf.select(this).style("opacity"),0}).style("fill",function(a){return Ji(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Ji(a)}).style("cursor",function(a){return Lg(a)?"pointer":null}),a.forEach(function(a){gj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=gj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(ag(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Ji(a.data)}).style("cursor",function(a){return Lg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Hi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),of(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,xf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Hi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),pf(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Ug&&(n=hj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Ji(a)}),l=hj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ji(a)})),ej.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Mf).style("opacity",1)}function jf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),yf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Ti?j:i,l=Ti?Q():P();return d&&(w=0,C=0,t=0,u=0),Xg&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Ti?u:t,void(ah?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=ij.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,Ti?(g=function(a){return t*(.2+B[a])},j=function(a){return A[B[a]]+x[a]}):(g=function(a){return A[B[a]]+x[a]},j=function(a){return u*(.2+B[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=ij.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Zg?Zg(a):yf.toggle(a)}).on("mouseover",function(a){xf.select(this).classed(f.legendItemFocused,!0),Hi||yf.focus(a),"function"==typeof $g&&$g(a)}).on("mouseout",function(a){xf.select(this).classed(f.legendItemFocused,!1),Hi||yf.revert(),"function"==typeof _g&&_g(a)}),o.append("text").text(function(a){return d(xg[a])?xg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ti?h:-200).attr("y",Ti?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ti?i:-200).attr("y",Ti?-200:l).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Ji(a)}).attr("x",Ti?h:-200).attr("y",Ti?-200:j).attr("width",10).attr("height",10),ij.selectAll("text").data(a).text(function(a){return d(xg[a])?xg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),ij.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),ij.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),ij.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=xf.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?mf(b):nf(b):Xi}),N(t),O(u),M(C),n(),R(),ff(),m(q,c)}function tf(a){return Ec(yf.data.targets,a.id)}function uf(a){return"data"in a&&Ec(yf.data.targets,a.data.id)}function vf(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 wf(a,b,c){var d=!ee(yf.data.targets);Hi=!1,$d(a,b),gf(c||{withTransitionForAxis:d})}var xf=a.d3?a.d3:a.require?a.require("d3"):void 0,yf={data:{},axis:{},legend:{}},zf={},Af=h(["bindto"],"#chart"),Bf=h(["size","width"]),Cf=h(["size","height"]),Df=h(["padding","left"],50),Ef=h(["padding","right"]),Ff=h(["zoom","enabled"],!1),Gf=h(["zoom","extent"]),Hf=h(["zoom","privileged"],!1),If=h(["onenter"],function(){}),Jf=h(["onleave"],function(){}),Kf=h(["onresize"],function(){}),Lf=h(["onresized"],function(){}),Mf=h(["transition","duration"],350);g("data","data is required in config");var Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg=h(["data","x"]),ug=h(["data","xs"],{}),vg=h(["data","x_format"]),wg=h(["data","id_converter"],function(a){return a}),xg=h(["data","names"],{}),yg=h(["data","classes"],{}),zg=h(["data","groups"],[]),Ag=h(["data","axes"],{}),Bg=h(["data","type"]),Cg=h(["data","types"],{}),Dg=h(["data","labels"],{}),Eg=h(["data","order"]),Fg=h(["data","regions"],{}),Gg=h(["data","color"]),Hg=h(["data","colors"],{}),Ig=h(["data","hide"],!1),Jg=h(["data","selection","enabled"],!1),Kg=h(["data","selection","grouped"],!1),Lg=h(["data","selection","isselectable"],function(){return!0}),Mg=h(["data","selection","multiple"],!0),Ng=h(["data","onclick"],function(){}),Og=h(["data","onenter"],function(){}),Pg=h(["data","onleave"],function(){}),Qg=h(["data","onselected"],function(){}),Rg=h(["data","onunselected"],function(){}),Sg=h(["data","ondragstart"],function(){}),Tg=h(["data","ondragend"],function(){}),Ug=h(["subchart","show"],!1),Vg=h(["subchart","size","height"],60),Wg=h(["color","pattern"],[]),Xg=h(["legend","show"],!0),Yg=h(["legend","position"],"bottom"),Zg=h(["legend","item","onclick"]),$g=h(["legend","item","onmouseover"]),_g=h(["legend","item","onmouseout"]),ah=h(["legend","equally"],!1),bh=h(["axis","rotated"],!1),ch=h(["axis","x","show"],!0),dh=h(["axis","x","type"],"indexed"),eh=h(["axis","x","localtime"],!0),fh=h(["axis","x","categories"],[]),gh=h(["axis","x","tick","centered"],!1),hh=h(["axis","x","tick","format"]),ih=h(["axis","x","tick","culling"],{}),jh=h(["axis","x","tick","culling","max"],10),kh=h(["axis","x","tick","count"]),lh=h(["axis","x","tick","fit"],!0),mh=h(["axis","x","tick","values"],null),nh=h(["axis","x","tick","rotate"]),oh=h(["axis","x","max"],null),ph=h(["axis","x","min"],null),qh=h(["axis","x","padding"],{}),rh=h(["axis","x","height"]),sh=h(["axis","x","default"]),th=h(["axis","x","label"],{}),uh=h(["axis","y","show"],!0),vh=h(["axis","y","max"]),wh=h(["axis","y","min"]),xh=h(["axis","y","center"]),yh=h(["axis","y","label"],{}),zh=h(["axis","y","inner"],!1),Ah=h(["axis","y","tick","format"]),Bh=h(["axis","y","padding"],{}),Ch=h(["axis","y","ticks"],10),Dh=h(["axis","y2","show"],!1),Eh=h(["axis","y2","max"]),Fh=h(["axis","y2","min"]),Gh=h(["axis","y2","center"]),Hh=h(["axis","y2","label"],{}),Ih=h(["axis","y2","inner"],!1),Jh=h(["axis","y2","tick","format"]),Kh=h(["axis","y2","padding"],{}),Lh=h(["axis","y2","ticks"],10),Mh=h(["grid","x","show"],!1),Nh=h(["grid","x","type"],"tick"),Oh=h(["grid","x","lines"],[]),Ph=h(["grid","y","show"],!1),Qh=h(["grid","y","lines"],[]),Rh=h(["grid","y","ticks"],10),Sh=h(["point","show"],!0),Th=h(["point","r"],2.5),Uh=h(["point","focus","line","enabled"],!0),Vh=h(["point","focus","expand","enabled"],!0),Wh=h(["point","focus","expand","r"]),Xh=h(["point","focus","select","r"]),Yh=h(["line","connect_null"],!1),Zh=h(["bar","width"]),$h=h(["bar","width","ratio"],.6),_h=h(["pie","label","show"],!0),ai=h(["pie","label","format"]),bi=h(["pie","expand"],!0),ci=h(["pie","onclick"],function(){}),di=h(["pie","onmouseover"],function(){}),ei=h(["pie","onmouseout"],function(){}),fi=h(["donut","label","show"],!0),gi=h(["donut","label","format"]),hi=h(["donut","expand"],!0),ii=h(["donut","title"],""),ji=h(["donut","onclick"],function(){}),ki=h(["donut","onmouseover"],function(){}),li=h(["donut","onmouseout"],function(){}),mi=h(["regions"],[]),ni=h(["tooltip","show"],!0),oi=h(["tooltip","format","title"]),pi=h(["tooltip","format","value"]),qi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=oi?oi:b,l=pi?pi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),ri=h(["tooltip","init","show"],!1),si=h(["tooltip","init","x"],0),ti=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ui=("string"==typeof Af?Af.replace("#",""):Af.id)+"-clip",vi=ui+"-xaxis",wi=ui+"-yaxis",xi=i(ui),yi=i(vi),zi=i(wi),Ai="timeseries"===dh,Bi="categorized"===dh,Ci=!Ai&&(tg||we(ug)),Di=null,Ei=!1,Fi=!1,Gi=!1,Hi=!1,Ii=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ji=qe(Hg,we(Wg)?Wg:Ii,Gg),Ki=eh?xf.time.format:xf.time.format.utc,Li=function(){var a=[[Ki("%Y/%-m/%-d"),function(){return!0}],[Ki("%-m/%-d"),function(a){return a.getMonth()}],[Ki("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ki("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ki("%I %p"),function(a){return a.getHours()}],[Ki("%I:%M"),function(a){return a.getMinutes()}],[Ki(":%S"),function(a){return a.getSeconds()}],[Ki(".%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)}}(),Mi=[],Ni=[],Oi=bh?"left":"bottom",Pi=bh?zh?"top":"bottom":zh?"right":"left",Qi=bh?Ih?"bottom":"top":Ih?"left":"right",Ri=bh?"left":"bottom",Si={main:function(){return"translate("+Nf.left+","+Nf.top+")"},context:function(){return"translate("+Of.left+","+Of.top+")"},legend:function(){return"translate("+Pf.left+","+Pf.top+")"},x:function(){return"translate(0,"+(bh?0:Sf)+")"},y:function(){return"translate(0,"+(bh?Sf:0)+")"},y2:function(){return"translate("+(bh?0:Qf)+","+(bh?1:0)+")"},subx:function(){return"translate(0,"+(bh?0:Tf)+")"},arc:function(){return"translate("+Qf/2+","+Sf/2+")"}},Ti="right"===Yg,Ui=0,Vi=0,Wi=0,Xi=.15,Yi=30,Zi=bh&&!ch?0:30,$i=5;ag=xf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var _i,aj=function(){var a=xf.svg.line().x(bh?function(a){return V(a.id)(a.value)}:Cd).y(bh?Cd:function(a){return V(a.id)(a.value)});return Yh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Yh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Fg[b.id]?Ve(e,jg,V(b.id),Fg[b.id]):a(e)):(c=e[0]?jg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,bh?"M "+d+" "+c:"M "+c+" "+d)}}(),bj=function(){var a;return a=bh?xf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):xf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?jg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,bh?"M "+d+" "+c:"M "+c+" "+d)}}(),cj=function(){var a=xf.svg.line().x(bh?function(a){return W(a.id)(a.value)}:Fd).y(bh?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+mg(c[0].x)+" "+W(b.id)(c[0].value)}}(),dj=function(){};_i=xf.svg.brush().on("brush",cf),_i.update=function(){return hj&&hj.select("."+f.brush).call(this),this},_i.scale=function(a){return bh?this.y(a):this.x(a)},Ff&&(dj=xf.behavior.zoom().on("zoomstart",function(){dj.altDomain=xf.event.sourceEvent.altKey?jg.orgDomain():null}).on("zoom",Ff?df:null),dj.scale=function(a){return bh?this.y(a):this.x(a)},dj.orgScaleExtent=function(){var a=Gf?Gf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},dj.updateScaleExtent=function(){var a=ac(jg.orgDomain())/ac(lj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var ej,fj,gj,hj,ij,jj,kj,lj,mj,nj={};if(yf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);yf.revert(),yf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(yf.data.targets)&&Nb(a,!0),of(a,!0)},yf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);yf.revert(),b(d.classed(f.focused,!1)),b(e),ee(yf.data.targets)&&Ob(a),of(a,!1)},yf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);b(d.classed(f.focused,!1)),b(e),ee(yf.data.targets)&&Ob(a),pf()},yf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),ej.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&qf(a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},yf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),ej.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&rf(a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},yf.toggle=function(a){Gc(a)?yf.hide(a):yf.show(a)},yf.unzoom=function(){_i.clear().update(),bf({withUpdateXDomain:!0})},yf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){yg[b]=a.classes[b]}),"categories"in a&&Bi&&(fh=a.categories,pg.categories(fh)),"cacheIds"in a&&bc(a.cacheIds)?void jf(dc(a.cacheIds),a.done):void("unload"in a?lf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){kf(a)}):kf(a))},yf.unload=function(a,b){lf(Dc(a),function(){bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},yf.selected=function(a){return xf.merge(gj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return xf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},yf.select=function(a,b,c){Jg&&gj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=xf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Kg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Lg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},yf.unselect=function(a,b){Jg&&gj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=xf.select(this),g="circle"===this.nodeName?Be:Ee,h=Kg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Lg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},yf.toLine=function(a){wf(a,"line")},yf.toSpline=function(a){wf(a,"spline")},yf.toBar=function(a){wf(a,"bar")},yf.toScatter=function(a){wf(a,"scatter")},yf.toArea=function(a){wf(a,"area")},yf.toAreaSpline=function(a){wf(a,"area-spline")},yf.toPie=function(a){wf(a,"pie",{withTransform:!0}) +},yf.toDonut=function(a){wf(a,"donut",{withTransform:!0})},yf.groups=function(a){return c(a)?zg:(zg=a,bf(),zg)},yf.xgrids=function(a){return a?(Oh=a,bf(),Oh):Oh},yf.xgrids.add=function(a){return a?yf.xgrids(Oh.concat(a)):void 0},yf.xgrids.remove=function(a){var b=vf(a);return yf.xgrids(Oh.filter(b))},yf.ygrids=function(a){return a?(Qh=a,bf(),Qh):Qh},yf.ygrids.add=function(a){return a?yf.ygrids(Qh.concat(a)):void 0},yf.ygrids.remove=function(a){var b=vf(a);return yf.ygrids(Qh.filter(b))},yf.regions=function(a){return c(a)?mi:(mi=a,bf(),mi)},yf.regions.add=function(a){return c(a)?mi:(mi=mi.concat(a),bf(),mi)},yf.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;ej.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),mi=mi.filter(function(b){return b.classes.indexOf(a)<0})}),mi},yf.data.get=function(a){var b=yf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},yf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},yf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){xg[b]=a[b]}),sf(Cc(yf.data.targets),{withTransition:!0}),xg):xg},yf.x=function(a){return arguments.length&&(qc(yf.data.targets,a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),yf.data.xs},yf.xs=function(a){return arguments.length&&(rc(yf.data.targets,a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),yf.data.xs},yf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},yf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(vh=+a.y),b(a.y2)&&(Eh=+a.y2)):vh=Eh=+a,bf())},yf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(wh=+a.y),b(a.y2)&&(Fh=+a.y2)):wh=Fh=+a,bf())},yf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&yf.axis.max(a.max),"undefined"!=typeof a.min&&yf.axis.min(a.min))},yf.legend.show=function(a){qf(Dc(a)),bf({withLegend:!0})},yf.legend.hide=function(a){rf(Dc(a)),bf({withLegend:!0})},yf.resize=function(a){Bf=a?a.width:null,Cf=a?a.height:null,gf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},yf.destroy=function(){yf.data.targets=void 0,yf.data.xs={},kj.html(""),a.onresize=null},"url"in e.data)xf.xhr(e.data.url,function(a,b){var c,d=xf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=xf.csv.parse(b.response),We(c)});else if("rows"in e.data)We(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");We(uc(e.data.columns))}return yf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From f8c309f4f633d43a6447b1c6d234b417b4ec5d9a Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 30 Apr 2014 23:03:27 +0900 Subject: [PATCH 103/178] Add sample for point.r - #179 --- htdocs/samples/point_r.html | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 htdocs/samples/point_r.html diff --git a/htdocs/samples/point_r.html b/htdocs/samples/point_r.html new file mode 100644 index 0000000..46ee3ec --- /dev/null +++ b/htdocs/samples/point_r.html @@ -0,0 +1,28 @@ + + + + + +
+ + + + + + From 18675fe75962bc00a6065ec3ed7d52d777caaf9e Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Thu, 1 May 2014 00:00:28 +0900 Subject: [PATCH 104/178] Fix bug about same x check - #181 --- c3.js | 2 +- c3.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/c3.js b/c3.js index 04fdab1..ca882f1 100644 --- a/c3.js +++ b/c3.js @@ -1903,7 +1903,7 @@ return closest; } function filterSameX(targets, x) { - return d3.merge(targets.map(function (t) { return t.values; })).filter(function (v) { return v.x === x; }); + return d3.merge(targets.map(function (t) { return t.values; })).filter(function (v) { return v.x - x === 0; }); } function getPathBox(path) { diff --git a/c3.min.js b/c3.min.js index 789e8a8..e8bd1ea 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.33"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",legendItemFocused:"c3-legend-item-focused",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;cQf&&(Qf=0),0>Sf&&(Sf=0),Rf=bh?Nf.left-Yi-Zi:Qf,Tf=bh?Sf:Vf-Of.top-Of.bottom,0>Rf&&(Rf=0),0>Tf&&(Tf=0),p(),Ti&&ee(yf.data.targets)&&(Pf.left=Qf/2+Xf)}function o(){gj.select("line."+f.xgridFocus).attr("x1",bh?0:-10).attr("x2",bh?Qf:-10).attr("y1",bh?-10:Nf.top).attr("y2",bh?-10:Sf)}function p(){Xf=Sf/2,Wf=.95*Xf,Yf=de(yf.data.targets)?.6*Wf:0}function q(){var a=bh?f.axisX:f.axisY,b=gj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=xf.select(Af).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Bf?Bf:x()}function s(){var a=Cf?Cf:y();return a>0?a:320}function t(){return ee(yf.data.targets)?0:Df?Df:bh?ch?v("x"):1:!uh||zh?1:v("y")}function u(){var a=1;return ee(yf.data.targets)?0:Ef?Ef:Ti?P()+(Dh&&!bh?v("y2"):a):Dh?Ih||bh?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||ch?"x"===a&&rh?rh:"y"!==a||uh?"y2"!==a||Dh?(jb(a).isInner?30:40)+("y2"===a?-10:0):$i:Xg&&!Ti?10:1:0}function x(){return+xf.select(Af).style("width").replace("px","")}function y(){return+xf.select(Af).style("height").replace("px","")}function z(a){return a?-5:-(Nf.left-1)}function A(a){return a?-20:-4}function B(){return z(!bh)}function C(){return A(!bh)}function D(){return z(bh)}function E(){return A(bh)}function F(a){return a?Qf+2+4:Nf.left+20}function G(a){return a?(rh?rh:0)+80:Sf+8}function H(){return F(!bh)}function I(){return G(!bh)}function J(){return F(bh)}function K(){return G(bh)}function L(){var a,b,c,d,e,f=Ac(yf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=jg(b.x)-jg(a.x),d=zc(),e=ae(yf.data.targets)?(d-(Bi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Ui=a}function N(a){Vi=a}function O(a){Wi=a}function P(){return Xg?Ti?Vi*(Ui+1):Uf:0}function Q(){return Xg?Ti?Vf:Wi*(Ui+1):0}function R(){var a,b,c=!jg;bg=bh?1:0,cg=bh?Sf:Qf,dg=bh?0:Sf,eg=bh?Qf:1,fg=bg,gg=cg,hg=bh?0:Tf,ig=bh?Rf:1,jg=T(bg,cg,c?void 0:jg.domain(),function(){return pg.tickOffset()}),kg=U(dg,eg,c?void 0:kg.domain()),lg=U(dg,eg,c?void 0:lg.domain()),mg=T(bg,cg,lj,function(a){return a%1?0:sg.tickOffset()}),ng=U(hg,ig,c?void 0:ng.domain()),og=U(hg,ig,c?void 0:og.domain()),a=$(),b=mh?mh:c?void 0:pg.tickValues(),pg=X(jg,Oi,a,b),sg=X(mg,Ri,a,b),qg=Y(kg,Pi,Ah,Ch),rg=Y(lg,Qi,Jh,Lh),c||(_i.scale(mg),Ff&&dj.scale(jg)),S()}function S(){Zf=Gb(),$f=Hb(),_f=Hb(.98)}function T(a,b,d,e){var f=(Ai?xf.time.scale():xf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Bi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=xf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?lg:kg}function W(a){return"y2"===Z(a)?og:ng}function X(a,b,c,d){var e=(Bi?Eb():xf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Bi?(e.tickCentered(gh),ve(ih)&&(ih=!1)):e.tickOffset=function(){var a=Bc(yf.data.targets),b=jg(a[1])-jg(a[0]);return b/zc()/2},Bi&&e.categories(fh),e}function Y(a,b,c,d){return xf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Ag?Ag[a]:"y"}function $(){var a=Ai?Li:Bi?Tc:function(a){return 0>a?a.toFixed(0):a};return hh&&("function"==typeof hh?a=hh:Ai&&(a=function(a){return a?Ki(hh)(a):""})),a}function _(a){var b;return"y"===a?b=yh:"y2"===a?b=Hh:"x"===a&&(b=th),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?yh=b:"y2"===a?Hh=b:"x"===a&&(th=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",bh?"inner-top":"inner-right")}function hb(){return fb("y",bh?"inner-right":"inner-top")}function ib(){return fb("y2",bh?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Qf/2:Qf:b.isBottom?-Sf:b.isMiddle?-Sf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!bh,gb())}function rb(){return nb(bh,hb())}function sb(){return nb(bh,ib())}function tb(){return ob(!bh,gb())}function ub(){return ob(bh,hb())}function vb(){return ob(bh,ib())}function wb(){var a=gb();return bh?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":rh?rh-10:"3em"}function xb(){var a=hb();return bh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return bh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!bh,gb())}function Ab(){return pb(bh,hb())}function Bb(){return pb(bh,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return xf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){gj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),gj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),gj.select("."+f.axisY2+" ."+f.axisY2Label).transition().attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 xf.min(Object.keys(i).map(function(a){return xf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(zg.length>0)for(g=Sc(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 xf.max(Object.keys(i).map(function(a){return xf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Fh:wh,n="y2"===c?Eh:vh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Gh:xh,r=ud()&&bh;return 0===l.length?"y2"===c?lg.domain():kg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(kg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Bh&&(f=b(Bh.top)?Bh.top:e,g=b(Bh.bottom)?Bh.bottom:e),"y2"===c&&Kh&&(f=b(Kh.top)?Kh.top:e,g=b(Kh.bottom)?Kh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return ph?Ai?re(ph):ph:xf.min(a,function(a){return xf.min(a.values,function(a){return a.x})})}function Zb(a){return oh?Ai?re(oh):oh:xf.max(a,function(a){return xf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Bi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof qh&&we(qh)?(e=b(qh.left)?qh.left:d,f=b(qh.right)?qh.right:d):e=f="number"==typeof qh?qh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=Ai?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Ai?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?kg:lg;return b="y"===a.axis||"y2"===a.axis?bh?Sf:"start"in a?d(a.start):Sf:bh?"end"in a?jg(Ai?re(a.end):a.end):Sf:Sf,c>b?0:b-c}function ic(a){return tg&&a===tg||we(ug)&&xe(ug,a)}function jc(a){return!ic(a)}function kc(a){return tg?tg:we(ug)?ug[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=yf.data.xs[b])}),c}function mc(a,b){return a in yf.data.xs&&yf.data.xs[a]&&yf.data.xs[a][b]?yf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){ug[b]=a[b]})}function oc(a){return 1===xf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=xg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),yf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=Ai?a?a instanceof Date?a:re(a):re(mc(c,d)):Ci&&!Bi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?yf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):tg?(d=Object.keys(yf.data.xs),yf.data.xs[c]=d.length>0?yf.data.xs[d[0]]:void 0):we(ug)&&(yf.data.xs[c]=lc(f,yf.data.targets)):yf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!yf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=wg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ci&&Bi&&0===c&&g&&(0===e&&(fh=[]),fh.push(g)),("undefined"==typeof a[b]||yf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Bg&&$d(Cc(c).filter(function(a){return!(a in Cg)}),Bg),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&yf.data.targets[0].values[a-1]?yf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(yf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Ai?new Date(i):i);j.push(e)}return Ai||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Mi=Mi.concat(a)}function Mc(a){Mi=Mi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Ni=Ni.concat(a)}function Oc(a){Ni=Ni.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return xf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Eg&&"desc"===Eg.toLowerCase()}function Nd(){return Eg&&"asc"===Eg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Eg&&a.sort(Eg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(yf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&ni&&(jj.html(qi(a,$(),wd(k),Ji)).style("display","block"),d=jj.property("offsetWidth"),e=jj.property("offsetHeight"),k?(g=Qf/2+c[0],i=Sf/2+c[1]+20):(bh?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=jg(l[0].x)+20):(f=q(),g=f+t()+jg(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),jj.style("top",i+"px").style("left",g+"px"))}function Qd(){jj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});ni&&(be(yf.data.targets)||ee(yf.data.targets)||gj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(bh?"y1":"x1",Cd).attr(bh?"y2":"x2",Cd))}function Sd(){gj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?jg(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return"number"==typeof Zh?Zh:b?2*a.tickOffset()*$h/b:0}function $d(a,b){Dc(a).forEach(function(a){nj[a]=b===Cg[a],Cg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Cg[a.id]===b&&(c=!0),a.id in Cg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Cg)||"line"===Cg[b]||"spline"===Cg[b]||"area"===Cg[b]||"area-spline"===Cg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Cg[b]||"area-spline"===Cg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Cg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Cg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Cg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Cg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&hi||je(a)&&bi}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function re(b){var c;try{c=vg?xf.time.format(vg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+vg)}return c}function se(a,b){var c=xf.mouse(a),d=xf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?kg:lg,d=bh?1:0,e=bh?0:1;return Math.pow(jg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Qg(b,a.node()),gj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud).attr("stroke",function(){return Ji(b)}).attr("r",1.4*Je(b)).transition().duration(100).attr("r",Je)}function Be(a,b,c){Rg(b,a.node()),gj.select("."+f.selectedCircles+ld(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){Qg(b,a.node()),a.transition().duration(100).style("fill",function(){return xf.rgb(Ji(b)).darker(1)})}function Ee(a,b){Rg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ji(b)})}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){return Sh?"function"==typeof Th?Th(a):Th:0}function Ie(a){return Vh?Wh?Wh:1.75*He(a):He(a)}function Je(a){return Xh?Xh:4*He(a)}function Ke(a,c){return(c?gj.selectAll("."+f.circles+ld(c)):gj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Le(a,b){Ke(a,b).classed(f.EXPANDED,!0).attr("r",Ie)}function Me(a){Ke(a).filter(function(){return xf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",He)}function Ne(a){return gj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Oe(a){Ne(a).classed(f.EXPANDED,!0)}function Pe(a){Ne(a).classed(f.EXPANDED,!1)}function Qe(a,b){var c=Ue(a,b);return function(a,b){var d=c(a,b),e=bh?1:0,f=bh?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 Re(a,b){var c=Ue(a,!1),d=b?Se:Te;return function(a,b){return d(c(a,b),a,this)}}function Se(a,b){var c;return bh?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Te(a,b,c){var d=c.getBoundingClientRect();return bh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Ue(a,b){var c=a.__max__+1,d=Zd(pg,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return bh&&(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 Ve(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 We(b){var c,d,e;if(kj=xf.select(Af),kj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(kj.html("").classed("c3",!0),yf.data.xs={},yf.data.targets=vc(b),Ig&&Lc(Ig===!0?Cc(yf.data.targets):Ig),n(),R(),jg.domain(xf.extent(_b(yf.data.targets))),kg.domain(Xb(yf.data.targets,"y")),lg.domain(Xb(yf.data.targets,"y2")),mg.domain(jg.domain()),ng.domain(kg.domain()),og.domain(lg.domain()),lj=jg.domain(),_i.scale(mg),Ff&&dj.scale(jg),ej=kj.append("svg").attr("width",Qf+Nf.left+Nf.right).attr("height",Sf+Nf.top+Nf.bottom).on("mouseenter",If).on("mouseleave",Jf),fj=ej.append("defs"),fj.append("clipPath").attr("id",ui).append("rect").attr("width",Qf).attr("height",Sf),fj.append("clipPath").attr("id",vi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),fj.append("clipPath").attr("id",wi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),gj=ej.append("g").attr("transform",Si.main),hj=ej.append("g").attr("transform",Si.context),ij=ej.append("g").attr("transform",Si.legend),Ug||hj.style("visibility","hidden"),Xg||(ij.style("visibility","hidden"),Ni=Cc(yf.data.targets)),jj=xf.select(Af).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),sf(Cc(yf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),ch&&gj.append("g").attr("class",f.axisX).attr("clip-path",yi).attr("transform",Si.x).append("text").attr("class",f.axisXLabel).attr("transform",bh?"rotate(-90)":"").style("text-anchor",zb),uh&&gj.append("g").attr("class",f.axisY).attr("clip-path",zi).attr("transform",Si.y).append("text").attr("class",f.axisYLabel).attr("transform",bh?"":"rotate(-90)").style("text-anchor",Ab),Dh&&gj.append("g").attr("class",f.axisY2).attr("transform",Si.y2).append("text").attr("class",f.axisY2Label).attr("transform",bh?"":"rotate(-90)").style("text-anchor",Bb),d=gj.append("g").attr("clip-path",xi).attr("class",f.grid),Mh&&d.append("g").attr("class",f.xgrids),we(Oh)&&d.append("g").attr("class",f.xgridLines),Uh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Ph&&d.append("g").attr("class",f.ygrids),we(Qh)&&d.append("g").attr("class",f.ygridLines),gj.append("g").attr("clip-path",xi).attr("class",f.regions),gj.append("g").attr("clip-path",xi).attr("class",f.chart),c=gj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ff?bh?"ns-resize":"ew-resize":null),gj.select("."+f.chart).append("g").attr("class",f.chartBars),gj.select("."+f.chart).append("g").attr("class",f.chartLines),gj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Si.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),gj.select("."+f.chart).append("g").attr("class",f.chartTexts),Ff&&gj.insert("rect",Hf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Qf).attr("height",Sf).style("opacity",0).style("cursor",bh?"ns-resize":"ew-resize").call(dj).on("dblclick.zoom",null),sh&&_i.extent("function"!=typeof sh?sh:sh(_b())),hj.append("g").attr("clip-path",xi).attr("class",f.chart),hj.select("."+f.chart).append("g").attr("class",f.chartBars),hj.select("."+f.chart).append("g").attr("class",f.chartLines),hj.append("g").attr("clip-path",xi).attr("class",f.brush).call(_i).selectAll("rect").attr(bh?"width":"height",bh?Rf:Tf),hj.append("g").attr("class",f.axisX).attr("transform",Si.subx).attr("clip-path",bh?"":yi),hf(yf.data.targets),bh?gj.select("."+f.axisX).style("opacity",0).call(pg):(gj.select("."+f.axisY).style("opacity",0).call(qg),gj.select("."+f.axisY2).style("opacity",0).call(rg)),n(),R(),ff(),m(!1),bf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),ri){if(Ai&&"string"==typeof si){for(si=re(si),e=0;eQf&&(Qf=0),0>Sf&&(Sf=0),Rf=bh?Nf.left-Yi-Zi:Qf,Tf=bh?Sf:Vf-Of.top-Of.bottom,0>Rf&&(Rf=0),0>Tf&&(Tf=0),p(),Ti&&ee(yf.data.targets)&&(Pf.left=Qf/2+Xf)}function o(){gj.select("line."+f.xgridFocus).attr("x1",bh?0:-10).attr("x2",bh?Qf:-10).attr("y1",bh?-10:Nf.top).attr("y2",bh?-10:Sf)}function p(){Xf=Sf/2,Wf=.95*Xf,Yf=de(yf.data.targets)?.6*Wf:0}function q(){var a=bh?f.axisX:f.axisY,b=gj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=xf.select(Af).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Bf?Bf:x()}function s(){var a=Cf?Cf:y();return a>0?a:320}function t(){return ee(yf.data.targets)?0:Df?Df:bh?ch?v("x"):1:!uh||zh?1:v("y")}function u(){var a=1;return ee(yf.data.targets)?0:Ef?Ef:Ti?P()+(Dh&&!bh?v("y2"):a):Dh?Ih||bh?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||ch?"x"===a&&rh?rh:"y"!==a||uh?"y2"!==a||Dh?(jb(a).isInner?30:40)+("y2"===a?-10:0):$i:Xg&&!Ti?10:1:0}function x(){return+xf.select(Af).style("width").replace("px","")}function y(){return+xf.select(Af).style("height").replace("px","")}function z(a){return a?-5:-(Nf.left-1)}function A(a){return a?-20:-4}function B(){return z(!bh)}function C(){return A(!bh)}function D(){return z(bh)}function E(){return A(bh)}function F(a){return a?Qf+2+4:Nf.left+20}function G(a){return a?(rh?rh:0)+80:Sf+8}function H(){return F(!bh)}function I(){return G(!bh)}function J(){return F(bh)}function K(){return G(bh)}function L(){var a,b,c,d,e,f=Ac(yf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=jg(b.x)-jg(a.x),d=zc(),e=ae(yf.data.targets)?(d-(Bi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Ui=a}function N(a){Vi=a}function O(a){Wi=a}function P(){return Xg?Ti?Vi*(Ui+1):Uf:0}function Q(){return Xg?Ti?Vf:Wi*(Ui+1):0}function R(){var a,b,c=!jg;bg=bh?1:0,cg=bh?Sf:Qf,dg=bh?0:Sf,eg=bh?Qf:1,fg=bg,gg=cg,hg=bh?0:Tf,ig=bh?Rf:1,jg=T(bg,cg,c?void 0:jg.domain(),function(){return pg.tickOffset()}),kg=U(dg,eg,c?void 0:kg.domain()),lg=U(dg,eg,c?void 0:lg.domain()),mg=T(bg,cg,lj,function(a){return a%1?0:sg.tickOffset()}),ng=U(hg,ig,c?void 0:ng.domain()),og=U(hg,ig,c?void 0:og.domain()),a=$(),b=mh?mh:c?void 0:pg.tickValues(),pg=X(jg,Oi,a,b),sg=X(mg,Ri,a,b),qg=Y(kg,Pi,Ah,Ch),rg=Y(lg,Qi,Jh,Lh),c||(_i.scale(mg),Ff&&dj.scale(jg)),S()}function S(){Zf=Gb(),$f=Hb(),_f=Hb(.98)}function T(a,b,d,e){var f=(Ai?xf.time.scale():xf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Bi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=xf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?lg:kg}function W(a){return"y2"===Z(a)?og:ng}function X(a,b,c,d){var e=(Bi?Eb():xf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Bi?(e.tickCentered(gh),ve(ih)&&(ih=!1)):e.tickOffset=function(){var a=Bc(yf.data.targets),b=jg(a[1])-jg(a[0]);return b/zc()/2},Bi&&e.categories(fh),e}function Y(a,b,c,d){return xf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Ag?Ag[a]:"y"}function $(){var a=Ai?Li:Bi?Tc:function(a){return 0>a?a.toFixed(0):a};return hh&&("function"==typeof hh?a=hh:Ai&&(a=function(a){return a?Ki(hh)(a):""})),a}function _(a){var b;return"y"===a?b=yh:"y2"===a?b=Hh:"x"===a&&(b=th),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?yh=b:"y2"===a?Hh=b:"x"===a&&(th=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",bh?"inner-top":"inner-right")}function hb(){return fb("y",bh?"inner-right":"inner-top")}function ib(){return fb("y2",bh?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Qf/2:Qf:b.isBottom?-Sf:b.isMiddle?-Sf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!bh,gb())}function rb(){return nb(bh,hb())}function sb(){return nb(bh,ib())}function tb(){return ob(!bh,gb())}function ub(){return ob(bh,hb())}function vb(){return ob(bh,ib())}function wb(){var a=gb();return bh?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":rh?rh-10:"3em"}function xb(){var a=hb();return bh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return bh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!bh,gb())}function Ab(){return pb(bh,hb())}function Bb(){return pb(bh,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return xf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){gj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),gj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),gj.select("."+f.axisY2+" ."+f.axisY2Label).transition().attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 xf.min(Object.keys(i).map(function(a){return xf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(zg.length>0)for(g=Sc(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 xf.max(Object.keys(i).map(function(a){return xf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Fh:wh,n="y2"===c?Eh:vh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Gh:xh,r=ud()&&bh;return 0===l.length?"y2"===c?lg.domain():kg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(kg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Bh&&(f=b(Bh.top)?Bh.top:e,g=b(Bh.bottom)?Bh.bottom:e),"y2"===c&&Kh&&(f=b(Kh.top)?Kh.top:e,g=b(Kh.bottom)?Kh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return ph?Ai?re(ph):ph:xf.min(a,function(a){return xf.min(a.values,function(a){return a.x})})}function Zb(a){return oh?Ai?re(oh):oh:xf.max(a,function(a){return xf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Bi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof qh&&we(qh)?(e=b(qh.left)?qh.left:d,f=b(qh.right)?qh.right:d):e=f="number"==typeof qh?qh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=Ai?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Ai?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?kg:lg;return b="y"===a.axis||"y2"===a.axis?bh?Sf:"start"in a?d(a.start):Sf:bh?"end"in a?jg(Ai?re(a.end):a.end):Sf:Sf,c>b?0:b-c}function ic(a){return tg&&a===tg||we(ug)&&xe(ug,a)}function jc(a){return!ic(a)}function kc(a){return tg?tg:we(ug)?ug[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=yf.data.xs[b])}),c}function mc(a,b){return a in yf.data.xs&&yf.data.xs[a]&&yf.data.xs[a][b]?yf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){ug[b]=a[b]})}function oc(a){return 1===xf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=xg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),yf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=Ai?a?a instanceof Date?a:re(a):re(mc(c,d)):Ci&&!Bi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?yf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):tg?(d=Object.keys(yf.data.xs),yf.data.xs[c]=d.length>0?yf.data.xs[d[0]]:void 0):we(ug)&&(yf.data.xs[c]=lc(f,yf.data.targets)):yf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!yf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=wg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ci&&Bi&&0===c&&g&&(0===e&&(fh=[]),fh.push(g)),("undefined"==typeof a[b]||yf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Bg&&$d(Cc(c).filter(function(a){return!(a in Cg)}),Bg),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&yf.data.targets[0].values[a-1]?yf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(yf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Ai?new Date(i):i);j.push(e)}return Ai||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Mi=Mi.concat(a)}function Mc(a){Mi=Mi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Ni=Ni.concat(a)}function Oc(a){Ni=Ni.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return xf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Ld(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 Md(){return Eg&&"desc"===Eg.toLowerCase()}function Nd(){return Eg&&"asc"===Eg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Eg&&a.sort(Eg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(yf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&ni&&(jj.html(qi(a,$(),wd(k),Ji)).style("display","block"),d=jj.property("offsetWidth"),e=jj.property("offsetHeight"),k?(g=Qf/2+c[0],i=Sf/2+c[1]+20):(bh?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=jg(l[0].x)+20):(f=q(),g=f+t()+jg(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),jj.style("top",i+"px").style("left",g+"px"))}function Qd(){jj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});ni&&(be(yf.data.targets)||ee(yf.data.targets)||gj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(bh?"y1":"x1",Cd).attr(bh?"y2":"x2",Cd))}function Sd(){gj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?jg(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return"number"==typeof Zh?Zh:b?2*a.tickOffset()*$h/b:0}function $d(a,b){Dc(a).forEach(function(a){nj[a]=b===Cg[a],Cg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Cg[a.id]===b&&(c=!0),a.id in Cg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Cg)||"line"===Cg[b]||"spline"===Cg[b]||"area"===Cg[b]||"area-spline"===Cg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Cg[b]||"area-spline"===Cg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Cg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Cg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Cg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Cg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&hi||je(a)&&bi}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function re(b){var c;try{c=vg?xf.time.format(vg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+vg)}return c}function se(a,b){var c=xf.mouse(a),d=xf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?kg:lg,d=bh?1:0,e=bh?0:1;return Math.pow(jg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Qg(b,a.node()),gj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud).attr("stroke",function(){return Ji(b)}).attr("r",1.4*Je(b)).transition().duration(100).attr("r",Je)}function Be(a,b,c){Rg(b,a.node()),gj.select("."+f.selectedCircles+ld(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){Qg(b,a.node()),a.transition().duration(100).style("fill",function(){return xf.rgb(Ji(b)).darker(1)})}function Ee(a,b){Rg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ji(b)})}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){return Sh?"function"==typeof Th?Th(a):Th:0}function Ie(a){return Vh?Wh?Wh:1.75*He(a):He(a)}function Je(a){return Xh?Xh:4*He(a)}function Ke(a,c){return(c?gj.selectAll("."+f.circles+ld(c)):gj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Le(a,b){Ke(a,b).classed(f.EXPANDED,!0).attr("r",Ie)}function Me(a){Ke(a).filter(function(){return xf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",He)}function Ne(a){return gj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Oe(a){Ne(a).classed(f.EXPANDED,!0)}function Pe(a){Ne(a).classed(f.EXPANDED,!1)}function Qe(a,b){var c=Ue(a,b);return function(a,b){var d=c(a,b),e=bh?1:0,f=bh?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 Re(a,b){var c=Ue(a,!1),d=b?Se:Te;return function(a,b){return d(c(a,b),a,this)}}function Se(a,b){var c;return bh?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Te(a,b,c){var d=c.getBoundingClientRect();return bh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Ue(a,b){var c=a.__max__+1,d=Zd(pg,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return bh&&(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 Ve(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 We(b){var c,d,e;if(kj=xf.select(Af),kj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(kj.html("").classed("c3",!0),yf.data.xs={},yf.data.targets=vc(b),Ig&&Lc(Ig===!0?Cc(yf.data.targets):Ig),n(),R(),jg.domain(xf.extent(_b(yf.data.targets))),kg.domain(Xb(yf.data.targets,"y")),lg.domain(Xb(yf.data.targets,"y2")),mg.domain(jg.domain()),ng.domain(kg.domain()),og.domain(lg.domain()),lj=jg.domain(),_i.scale(mg),Ff&&dj.scale(jg),ej=kj.append("svg").attr("width",Qf+Nf.left+Nf.right).attr("height",Sf+Nf.top+Nf.bottom).on("mouseenter",If).on("mouseleave",Jf),fj=ej.append("defs"),fj.append("clipPath").attr("id",ui).append("rect").attr("width",Qf).attr("height",Sf),fj.append("clipPath").attr("id",vi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),fj.append("clipPath").attr("id",wi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),gj=ej.append("g").attr("transform",Si.main),hj=ej.append("g").attr("transform",Si.context),ij=ej.append("g").attr("transform",Si.legend),Ug||hj.style("visibility","hidden"),Xg||(ij.style("visibility","hidden"),Ni=Cc(yf.data.targets)),jj=xf.select(Af).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),sf(Cc(yf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),ch&&gj.append("g").attr("class",f.axisX).attr("clip-path",yi).attr("transform",Si.x).append("text").attr("class",f.axisXLabel).attr("transform",bh?"rotate(-90)":"").style("text-anchor",zb),uh&&gj.append("g").attr("class",f.axisY).attr("clip-path",zi).attr("transform",Si.y).append("text").attr("class",f.axisYLabel).attr("transform",bh?"":"rotate(-90)").style("text-anchor",Ab),Dh&&gj.append("g").attr("class",f.axisY2).attr("transform",Si.y2).append("text").attr("class",f.axisY2Label).attr("transform",bh?"":"rotate(-90)").style("text-anchor",Bb),d=gj.append("g").attr("clip-path",xi).attr("class",f.grid),Mh&&d.append("g").attr("class",f.xgrids),we(Oh)&&d.append("g").attr("class",f.xgridLines),Uh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Ph&&d.append("g").attr("class",f.ygrids),we(Qh)&&d.append("g").attr("class",f.ygridLines),gj.append("g").attr("clip-path",xi).attr("class",f.regions),gj.append("g").attr("clip-path",xi).attr("class",f.chart),c=gj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ff?bh?"ns-resize":"ew-resize":null),gj.select("."+f.chart).append("g").attr("class",f.chartBars),gj.select("."+f.chart).append("g").attr("class",f.chartLines),gj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Si.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),gj.select("."+f.chart).append("g").attr("class",f.chartTexts),Ff&&gj.insert("rect",Hf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Qf).attr("height",Sf).style("opacity",0).style("cursor",bh?"ns-resize":"ew-resize").call(dj).on("dblclick.zoom",null),sh&&_i.extent("function"!=typeof sh?sh:sh(_b())),hj.append("g").attr("clip-path",xi).attr("class",f.chart),hj.select("."+f.chart).append("g").attr("class",f.chartBars),hj.select("."+f.chart).append("g").attr("class",f.chartLines),hj.append("g").attr("clip-path",xi).attr("class",f.brush).call(_i).selectAll("rect").attr(bh?"width":"height",bh?Rf:Tf),hj.append("g").attr("class",f.axisX).attr("transform",Si.subx).attr("clip-path",bh?"":yi),hf(yf.data.targets),bh?gj.select("."+f.axisX).style("opacity",0).call(pg):(gj.select("."+f.axisY).style("opacity",0).call(qg),gj.select("."+f.axisY2).style("opacity",0).call(rg)),n(),R(),ff(),m(!1),bf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),ri){if(Ai&&"string"==typeof si){for(si=re(si),e=0;e0){d=[];for(var g in xg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(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 _e(a){ee(yf.data.targets)||Jg&&(Di=a,gj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ei=!0,Sg())}function af(){ee(yf.data.targets)||Jg&&(gj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),gj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ei=!1,Tg())}function bf(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Vd(),W=ee(yf.data.targets),X=Ic(yf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Mf:0,Q=D?P:0,R=E?P:0,c=gj.select("."+f.axisX).style("opacity",W?0:1),g=gj.select("."+f.axisY).style("opacity",W?0:1),h=gj.select("."+f.axisY2).style("opacity",W?0:1),e=hj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Xg&&sf(Cc(yf.data.targets),a,O),Bi&&(0!==X.length&&H&&G||jg.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(jg.domain(xf.extent(_b(X))),lj=jg.domain(),Ff&&dj.scale(jg).updateScaleExtent(),mg.domain(jg.domain()),_i.scale(mg)),G&&(jg.domain(_i.empty()?lj:_i.extent()),Ff&&dj.scale(jg).updateScaleExtent()),mh||!lh&&!kh||(S=Kc(Jc(X),kh),pg.tickValues(S),sg.tickValues(S))),kg.domain(Xb(X,"y")),lg.domain(Xb(X,"y2")),O.axisX.call(pg),O.axisY.call(qg),O.axisY2.call(rg),O.axisSubX.call(sg),G&&X.length)if(ih&&S){for(T=1;T=0&&xf.select(this).style("display",b%U?"none":"block")})}else xf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!bh&&nh&&eb(c,O.axisX,nh),J=Qe(V),M=Re(V,!0),N=Re(V,!1),Db(),ng.domain(kg.domain()),og.domain(lg.domain()),jj.style("display","none"),o(),gj.select("line."+f.xgridFocus).style("visibility","hidden"),Mh){if("year"===Nh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=jg.ticks(10);i=gj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",bh?0:function(a){return jg(a)-pg.tickOffset()}).attr("x2",bh?Qf:function(a){return jg(a)-pg.tickOffset()}).attr("y1",bh?function(a){return jg(a)-pg.tickOffset()}:Nf.top).attr("y2",bh?function(a){return jg(a)-pg.tickOffset()}:Sf).style("opacity",function(){return+xf.select(this).attr(bh?"y1":"x1")===(bh?Sf:0)?0:1}),i.exit().remove()}we(Oh)&&(k=gj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Oh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",bh?"":"rotate(-90)").attr("dx",bh?0:-Nf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",bh?0:Dd).attr("x2",bh?Qf:Dd).attr("y1",bh?Dd:Nf.top).attr("y2",bh?Dd:Sf).style("opacity",1),k.select("text").transition().duration(P).attr("x",bh?Qf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Ph&&(m=gj.select("."+f.ygrids).selectAll("."+f.ygrid).data(kg.ticks(Rh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",bh?kg:0).attr("x2",bh?kg:Qf).attr("y1",bh?0:kg).attr("y2",bh?Sf:kg),m.exit().remove()),A&&we(Qh)&&(n=gj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Qh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",bh?"rotate(-90)":"").attr("dx",bh?0:-Nf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",bh?Ed:0).attr("x2",bh?Ed:Qf).attr("y1",bh?0:Ed).attr("y2",bh?Sf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",bh?0:Qf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=gj.select("."+f.regions).selectAll("rect."+f.region).data(mi),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=gj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Ji(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=gj.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return bh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),gj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1),gj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",bj).style("opacity",mj),q=gj.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",He),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud),q.exit().remove(),gj.each(function(){Hi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=xf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Hi=!1}),gj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),gj.select("."+f.chartArcsTitle).style("opacity",de(yf.data.targets)?1:0),Ug&&(null!==xf.event&&"zoom"===xf.event.type&&_i.extent(jg.orgDomain()).update(),B&&(!bh&&nh&&eb(e,O.axisSubX,nh),_i.empty()||_i.extent(jg.orgDomain()).update(),K=Qe(V,!0),u=hj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Ji(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),hj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",cj).style("opacity",1))),gj.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),gj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud),v=gj.select("."+f.eventRects),we(ug)&&!oc(ug)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=gj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ye(w.enter()),w.attr("x",0).attr("y",0).attr("width",Qf).attr("height",Sf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ci&&!Bi?(z=function(a,b){var c=xc(b),d=yc(b),e=yf.data.xs[a.id][b];return(jg(d?d:e+50)-jg(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=yf.data.xs[a.id][b];return(jg(d)+jg(c?c:d-50))/2}):(z=L(),y=function(a){return jg(a.x)-z/2}),x=Ac(yf.data.targets),gj.select("."+f.eventRects).datum(x?x.values:[]),w=gj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Xe(w.enter()),w.attr("class",fd).attr("x",bh?0:y).attr("y",bh?y:0).attr("width",bh?Qf:z).attr("height",bh?z:Sf),w.exit().remove()),Cc(yf.data.targets).forEach(function(a){nj[a]=!0})}function cf(){bf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function df(){return"mousemove"===xf.event.sourceEvent.type&&dj.altDomain?(jg.domain(dj.altDomain),void dj.scale(jg).updateScaleExtent()):(Bi&&jg.orgDomain()[0]===lj[0]&&jg.domain([lj[0]-1e-10,jg.orgDomain()[1]]),bf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===xf.event.sourceEvent.type&&(Fi=!0)))}function ef(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function ff(){ej.attr("width",Uf).attr("height",Vf),ej.select("#"+ui).select("rect").attr("width",Qf).attr("height",Sf),ej.select("#"+vi).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),ej.select("#"+wi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej.select("."+f.zoomRect).attr("width",Qf).attr("height",Sf),kj.style("max-height",Vf+"px")}function gf(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),ff(),m(a.withTransition),bf(a)}function hf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=gj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Ji(a)}),e=gj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Lg(a)?"pointer":null}),c=gj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ji(a)}),b.append("path").attr("class",dd).style("opacity",function(){return mj=+xf.select(this).style("opacity"),0}).style("fill",function(a){return Ji(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Ji(a)}).style("cursor",function(a){return Lg(a)?"pointer":null}),a.forEach(function(a){gj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=gj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(ag(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Ji(a.data)}).style("cursor",function(a){return Lg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Hi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),of(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,xf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Hi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),pf(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Ug&&(n=hj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Ji(a)}),l=hj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ji(a)})),ej.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Mf).style("opacity",1)}function jf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),yf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Ti?j:i,l=Ti?Q():P();return d&&(w=0,C=0,t=0,u=0),Xg&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Ti?u:t,void(ah?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=ij.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,Ti?(g=function(a){return t*(.2+B[a])},j=function(a){return A[B[a]]+x[a]}):(g=function(a){return A[B[a]]+x[a]},j=function(a){return u*(.2+B[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=ij.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Zg?Zg(a):yf.toggle(a)}).on("mouseover",function(a){xf.select(this).classed(f.legendItemFocused,!0),Hi||yf.focus(a),"function"==typeof $g&&$g(a)}).on("mouseout",function(a){xf.select(this).classed(f.legendItemFocused,!1),Hi||yf.revert(),"function"==typeof _g&&_g(a)}),o.append("text").text(function(a){return d(xg[a])?xg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ti?h:-200).attr("y",Ti?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ti?i:-200).attr("y",Ti?-200:l).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Ji(a)}).attr("x",Ti?h:-200).attr("y",Ti?-200:j).attr("width",10).attr("height",10),ij.selectAll("text").data(a).text(function(a){return d(xg[a])?xg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),ij.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),ij.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),ij.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=xf.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?mf(b):nf(b):Xi}),N(t),O(u),M(C),n(),R(),ff(),m(q,c)}function tf(a){return Ec(yf.data.targets,a.id)}function uf(a){return"data"in a&&Ec(yf.data.targets,a.data.id)}function vf(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 wf(a,b,c){var d=!ee(yf.data.targets);Hi=!1,$d(a,b),gf(c||{withTransitionForAxis:d})}var xf=a.d3?a.d3:a.require?a.require("d3"):void 0,yf={data:{},axis:{},legend:{}},zf={},Af=h(["bindto"],"#chart"),Bf=h(["size","width"]),Cf=h(["size","height"]),Df=h(["padding","left"],50),Ef=h(["padding","right"]),Ff=h(["zoom","enabled"],!1),Gf=h(["zoom","extent"]),Hf=h(["zoom","privileged"],!1),If=h(["onenter"],function(){}),Jf=h(["onleave"],function(){}),Kf=h(["onresize"],function(){}),Lf=h(["onresized"],function(){}),Mf=h(["transition","duration"],350);g("data","data is required in config");var Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg=h(["data","x"]),ug=h(["data","xs"],{}),vg=h(["data","x_format"]),wg=h(["data","id_converter"],function(a){return a}),xg=h(["data","names"],{}),yg=h(["data","classes"],{}),zg=h(["data","groups"],[]),Ag=h(["data","axes"],{}),Bg=h(["data","type"]),Cg=h(["data","types"],{}),Dg=h(["data","labels"],{}),Eg=h(["data","order"]),Fg=h(["data","regions"],{}),Gg=h(["data","color"]),Hg=h(["data","colors"],{}),Ig=h(["data","hide"],!1),Jg=h(["data","selection","enabled"],!1),Kg=h(["data","selection","grouped"],!1),Lg=h(["data","selection","isselectable"],function(){return!0}),Mg=h(["data","selection","multiple"],!0),Ng=h(["data","onclick"],function(){}),Og=h(["data","onenter"],function(){}),Pg=h(["data","onleave"],function(){}),Qg=h(["data","onselected"],function(){}),Rg=h(["data","onunselected"],function(){}),Sg=h(["data","ondragstart"],function(){}),Tg=h(["data","ondragend"],function(){}),Ug=h(["subchart","show"],!1),Vg=h(["subchart","size","height"],60),Wg=h(["color","pattern"],[]),Xg=h(["legend","show"],!0),Yg=h(["legend","position"],"bottom"),Zg=h(["legend","item","onclick"]),$g=h(["legend","item","onmouseover"]),_g=h(["legend","item","onmouseout"]),ah=h(["legend","equally"],!1),bh=h(["axis","rotated"],!1),ch=h(["axis","x","show"],!0),dh=h(["axis","x","type"],"indexed"),eh=h(["axis","x","localtime"],!0),fh=h(["axis","x","categories"],[]),gh=h(["axis","x","tick","centered"],!1),hh=h(["axis","x","tick","format"]),ih=h(["axis","x","tick","culling"],{}),jh=h(["axis","x","tick","culling","max"],10),kh=h(["axis","x","tick","count"]),lh=h(["axis","x","tick","fit"],!0),mh=h(["axis","x","tick","values"],null),nh=h(["axis","x","tick","rotate"]),oh=h(["axis","x","max"],null),ph=h(["axis","x","min"],null),qh=h(["axis","x","padding"],{}),rh=h(["axis","x","height"]),sh=h(["axis","x","default"]),th=h(["axis","x","label"],{}),uh=h(["axis","y","show"],!0),vh=h(["axis","y","max"]),wh=h(["axis","y","min"]),xh=h(["axis","y","center"]),yh=h(["axis","y","label"],{}),zh=h(["axis","y","inner"],!1),Ah=h(["axis","y","tick","format"]),Bh=h(["axis","y","padding"],{}),Ch=h(["axis","y","ticks"],10),Dh=h(["axis","y2","show"],!1),Eh=h(["axis","y2","max"]),Fh=h(["axis","y2","min"]),Gh=h(["axis","y2","center"]),Hh=h(["axis","y2","label"],{}),Ih=h(["axis","y2","inner"],!1),Jh=h(["axis","y2","tick","format"]),Kh=h(["axis","y2","padding"],{}),Lh=h(["axis","y2","ticks"],10),Mh=h(["grid","x","show"],!1),Nh=h(["grid","x","type"],"tick"),Oh=h(["grid","x","lines"],[]),Ph=h(["grid","y","show"],!1),Qh=h(["grid","y","lines"],[]),Rh=h(["grid","y","ticks"],10),Sh=h(["point","show"],!0),Th=h(["point","r"],2.5),Uh=h(["point","focus","line","enabled"],!0),Vh=h(["point","focus","expand","enabled"],!0),Wh=h(["point","focus","expand","r"]),Xh=h(["point","focus","select","r"]),Yh=h(["line","connect_null"],!1),Zh=h(["bar","width"]),$h=h(["bar","width","ratio"],.6),_h=h(["pie","label","show"],!0),ai=h(["pie","label","format"]),bi=h(["pie","expand"],!0),ci=h(["pie","onclick"],function(){}),di=h(["pie","onmouseover"],function(){}),ei=h(["pie","onmouseout"],function(){}),fi=h(["donut","label","show"],!0),gi=h(["donut","label","format"]),hi=h(["donut","expand"],!0),ii=h(["donut","title"],""),ji=h(["donut","onclick"],function(){}),ki=h(["donut","onmouseover"],function(){}),li=h(["donut","onmouseout"],function(){}),mi=h(["regions"],[]),ni=h(["tooltip","show"],!0),oi=h(["tooltip","format","title"]),pi=h(["tooltip","format","value"]),qi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=oi?oi:b,l=pi?pi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),ri=h(["tooltip","init","show"],!1),si=h(["tooltip","init","x"],0),ti=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ui=("string"==typeof Af?Af.replace("#",""):Af.id)+"-clip",vi=ui+"-xaxis",wi=ui+"-yaxis",xi=i(ui),yi=i(vi),zi=i(wi),Ai="timeseries"===dh,Bi="categorized"===dh,Ci=!Ai&&(tg||we(ug)),Di=null,Ei=!1,Fi=!1,Gi=!1,Hi=!1,Ii=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ji=qe(Hg,we(Wg)?Wg:Ii,Gg),Ki=eh?xf.time.format:xf.time.format.utc,Li=function(){var a=[[Ki("%Y/%-m/%-d"),function(){return!0}],[Ki("%-m/%-d"),function(a){return a.getMonth()}],[Ki("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ki("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ki("%I %p"),function(a){return a.getHours()}],[Ki("%I:%M"),function(a){return a.getMinutes()}],[Ki(":%S"),function(a){return a.getSeconds()}],[Ki(".%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)}}(),Mi=[],Ni=[],Oi=bh?"left":"bottom",Pi=bh?zh?"top":"bottom":zh?"right":"left",Qi=bh?Ih?"bottom":"top":Ih?"left":"right",Ri=bh?"left":"bottom",Si={main:function(){return"translate("+Nf.left+","+Nf.top+")"},context:function(){return"translate("+Of.left+","+Of.top+")"},legend:function(){return"translate("+Pf.left+","+Pf.top+")"},x:function(){return"translate(0,"+(bh?0:Sf)+")"},y:function(){return"translate(0,"+(bh?Sf:0)+")"},y2:function(){return"translate("+(bh?0:Qf)+","+(bh?1:0)+")"},subx:function(){return"translate(0,"+(bh?0:Tf)+")"},arc:function(){return"translate("+Qf/2+","+Sf/2+")"}},Ti="right"===Yg,Ui=0,Vi=0,Wi=0,Xi=.15,Yi=30,Zi=bh&&!ch?0:30,$i=5;ag=xf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var _i,aj=function(){var a=xf.svg.line().x(bh?function(a){return V(a.id)(a.value)}:Cd).y(bh?Cd:function(a){return V(a.id)(a.value)});return Yh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Yh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Fg[b.id]?Ve(e,jg,V(b.id),Fg[b.id]):a(e)):(c=e[0]?jg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,bh?"M "+d+" "+c:"M "+c+" "+d)}}(),bj=function(){var a;return a=bh?xf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):xf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?jg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,bh?"M "+d+" "+c:"M "+c+" "+d)}}(),cj=function(){var a=xf.svg.line().x(bh?function(a){return W(a.id)(a.value)}:Fd).y(bh?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+mg(c[0].x)+" "+W(b.id)(c[0].value)}}(),dj=function(){};_i=xf.svg.brush().on("brush",cf),_i.update=function(){return hj&&hj.select("."+f.brush).call(this),this},_i.scale=function(a){return bh?this.y(a):this.x(a)},Ff&&(dj=xf.behavior.zoom().on("zoomstart",function(){dj.altDomain=xf.event.sourceEvent.altKey?jg.orgDomain():null}).on("zoom",Ff?df:null),dj.scale=function(a){return bh?this.y(a):this.x(a)},dj.orgScaleExtent=function(){var a=Gf?Gf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},dj.updateScaleExtent=function(){var a=ac(jg.orgDomain())/ac(lj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var ej,fj,gj,hj,ij,jj,kj,lj,mj,nj={};if(yf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);yf.revert(),yf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(yf.data.targets)&&Nb(a,!0),of(a,!0)},yf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);yf.revert(),b(d.classed(f.focused,!1)),b(e),ee(yf.data.targets)&&Ob(a),of(a,!1)},yf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);b(d.classed(f.focused,!1)),b(e),ee(yf.data.targets)&&Ob(a),pf()},yf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),ej.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&qf(a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},yf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),ej.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&rf(a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},yf.toggle=function(a){Gc(a)?yf.hide(a):yf.show(a)},yf.unzoom=function(){_i.clear().update(),bf({withUpdateXDomain:!0})},yf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){yg[b]=a.classes[b]}),"categories"in a&&Bi&&(fh=a.categories,pg.categories(fh)),"cacheIds"in a&&bc(a.cacheIds)?void jf(dc(a.cacheIds),a.done):void("unload"in a?lf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){kf(a)}):kf(a))},yf.unload=function(a,b){lf(Dc(a),function(){bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},yf.selected=function(a){return xf.merge(gj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return xf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},yf.select=function(a,b,c){Jg&&gj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=xf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Kg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Lg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},yf.unselect=function(a,b){Jg&&gj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=xf.select(this),g="circle"===this.nodeName?Be:Ee,h=Kg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Lg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},yf.toLine=function(a){wf(a,"line")},yf.toSpline=function(a){wf(a,"spline")},yf.toBar=function(a){wf(a,"bar")},yf.toScatter=function(a){wf(a,"scatter")},yf.toArea=function(a){wf(a,"area")},yf.toAreaSpline=function(a){wf(a,"area-spline")},yf.toPie=function(a){wf(a,"pie",{withTransform:!0}) },yf.toDonut=function(a){wf(a,"donut",{withTransform:!0})},yf.groups=function(a){return c(a)?zg:(zg=a,bf(),zg)},yf.xgrids=function(a){return a?(Oh=a,bf(),Oh):Oh},yf.xgrids.add=function(a){return a?yf.xgrids(Oh.concat(a)):void 0},yf.xgrids.remove=function(a){var b=vf(a);return yf.xgrids(Oh.filter(b))},yf.ygrids=function(a){return a?(Qh=a,bf(),Qh):Qh},yf.ygrids.add=function(a){return a?yf.ygrids(Qh.concat(a)):void 0},yf.ygrids.remove=function(a){var b=vf(a);return yf.ygrids(Qh.filter(b))},yf.regions=function(a){return c(a)?mi:(mi=a,bf(),mi)},yf.regions.add=function(a){return c(a)?mi:(mi=mi.concat(a),bf(),mi)},yf.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;ej.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),mi=mi.filter(function(b){return b.classes.indexOf(a)<0})}),mi},yf.data.get=function(a){var b=yf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},yf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},yf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){xg[b]=a[b]}),sf(Cc(yf.data.targets),{withTransition:!0}),xg):xg},yf.x=function(a){return arguments.length&&(qc(yf.data.targets,a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),yf.data.xs},yf.xs=function(a){return arguments.length&&(rc(yf.data.targets,a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),yf.data.xs},yf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},yf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(vh=+a.y),b(a.y2)&&(Eh=+a.y2)):vh=Eh=+a,bf())},yf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(wh=+a.y),b(a.y2)&&(Fh=+a.y2)):wh=Fh=+a,bf())},yf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&yf.axis.max(a.max),"undefined"!=typeof a.min&&yf.axis.min(a.min))},yf.legend.show=function(a){qf(Dc(a)),bf({withLegend:!0})},yf.legend.hide=function(a){rf(Dc(a)),bf({withLegend:!0})},yf.resize=function(a){Bf=a?a.width:null,Cf=a?a.height:null,gf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},yf.destroy=function(){yf.data.targets=void 0,yf.data.xs={},kj.html(""),a.onresize=null},"url"in e.data)xf.xhr(e.data.url,function(a,b){var c,d=xf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=xf.csv.parse(b.response),We(c)});else if("rows"in e.data)We(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");We(uc(e.data.columns))}return yf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From b10fec74e21273be10a7eda0f31e926aa8d50a91 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Thu, 1 May 2014 14:24:41 +0900 Subject: [PATCH 105/178] Fix overlap of grid on axis - #187 --- c3.js | 54 +++++++++++++++++++++++++++--------------------------- c3.min.js | 2 +- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/c3.js b/c3.js index b924849..3214410 100644 --- a/c3.js +++ b/c3.js @@ -2649,6 +2649,33 @@ /*-- Main Region --*/ + // Grids + grid = main.append('g') + .attr("clip-path", clipPath) + .attr('class', CLASS.grid); + + // X-Grid + if (__grid_x_show) { + grid.append("g").attr("class", CLASS.xgrids); + } + if (notEmpty(__grid_x_lines)) { + grid.append('g').attr("class", CLASS.xgridLines); + } + if (__point_focus_line_enabled) { + grid.append('g') + .attr("class", CLASS.xgridFocus) + .append('line') + .attr('class', CLASS.xgridFocus); + } + + // Y-Grid + if (__grid_y_show) { + grid.append('g').attr('class', CLASS.ygrids); + } + if (notEmpty(__grid_y_lines)) { + grid.append('g').attr('class', CLASS.ygridLines); + } + // Add Axis if (__axis_x_show) { main.append("g") @@ -2683,33 +2710,6 @@ .style("text-anchor", textAnchorForY2AxisLabel); } - // Grids - grid = main.append('g') - .attr("clip-path", clipPath) - .attr('class', CLASS.grid); - - // X-Grid - if (__grid_x_show) { - grid.append("g").attr("class", CLASS.xgrids); - } - if (notEmpty(__grid_x_lines)) { - grid.append('g').attr("class", CLASS.xgridLines); - } - if (__point_focus_line_enabled) { - grid.append('g') - .attr("class", CLASS.xgridFocus) - .append('line') - .attr('class', CLASS.xgridFocus); - } - - // Y-Grid - if (__grid_y_show) { - grid.append('g').attr('class', CLASS.ygrids); - } - if (notEmpty(__grid_y_lines)) { - grid.append('g').attr('class', CLASS.ygridLines); - } - // Regions main.append('g') .attr("clip-path", clipPath) diff --git a/c3.min.js b/c3.min.js index eb29e4c..b6f53b1 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.33"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",legendItemFocused:"c3-legend-item-focused",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;cQf&&(Qf=0),0>Sf&&(Sf=0),Rf=bh?Nf.left-Yi-Zi:Qf,Tf=bh?Sf:Vf-Of.top-Of.bottom,0>Rf&&(Rf=0),0>Tf&&(Tf=0),p(),Ti&&ee(yf.data.targets)&&(Pf.left=Qf/2+Xf)}function o(){gj.select("line."+f.xgridFocus).attr("x1",bh?0:-10).attr("x2",bh?Qf:-10).attr("y1",bh?-10:Nf.top).attr("y2",bh?-10:Sf)}function p(){Xf=Sf/2,Wf=.95*Xf,Yf=de(yf.data.targets)?.6*Wf:0}function q(){var a=bh?f.axisX:f.axisY,b=gj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=xf.select(Af).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Bf?Bf:x()}function s(){var a=Cf?Cf:y();return a>0?a:320}function t(){return ee(yf.data.targets)?0:Df?Df:bh?ch?v("x"):1:!uh||zh?1:v("y")}function u(){var a=1;return ee(yf.data.targets)?0:Ef?Ef:Ti?P()+(Dh&&!bh?v("y2"):a):Dh?Ih||bh?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||ch?"x"===a&&rh?rh:"y"!==a||uh?"y2"!==a||Dh?(jb(a).isInner?30:40)+("y2"===a?-10:0):$i:Xg&&!Ti?10:1:0}function x(){return+xf.select(Af).style("width").replace("px","")}function y(){return+xf.select(Af).style("height").replace("px","")}function z(a){return a?-5:-(Nf.left-1)}function A(a){return a?-20:-4}function B(){return z(!bh)}function C(){return A(!bh)}function D(){return z(bh)}function E(){return A(bh)}function F(a){return a?Qf+2+4:Nf.left+20}function G(a){return a?(rh?rh:0)+80:Sf+8}function H(){return F(!bh)}function I(){return G(!bh)}function J(){return F(bh)}function K(){return G(bh)}function L(){var a,b,c,d,e,f=Ac(yf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=jg(b.x)-jg(a.x),d=zc(),e=ae(yf.data.targets)?(d-(Bi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Ui=a}function N(a){Vi=a}function O(a){Wi=a}function P(){return Xg?Ti?Vi*(Ui+1):Uf:0}function Q(){return Xg?Ti?Vf:Wi*(Ui+1):0}function R(){var a,b,c=!jg;bg=bh?1:0,cg=bh?Sf:Qf,dg=bh?0:Sf,eg=bh?Qf:1,fg=bg,gg=cg,hg=bh?0:Tf,ig=bh?Rf:1,jg=T(bg,cg,c?void 0:jg.domain(),function(){return pg.tickOffset()}),kg=U(dg,eg,c?void 0:kg.domain()),lg=U(dg,eg,c?void 0:lg.domain()),mg=T(bg,cg,lj,function(a){return a%1?0:sg.tickOffset()}),ng=U(hg,ig,c?void 0:ng.domain()),og=U(hg,ig,c?void 0:og.domain()),a=$(),b=mh?mh:c?void 0:pg.tickValues(),pg=X(jg,Oi,a,b),sg=X(mg,Ri,a,b),qg=Y(kg,Pi,Ah,Ch),rg=Y(lg,Qi,Jh,Lh),c||(_i.scale(mg),Ff&&dj.scale(jg)),S()}function S(){Zf=Gb(),$f=Hb(),_f=Hb(.98)}function T(a,b,d,e){var f=(Ai?xf.time.scale():xf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Bi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=xf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?lg:kg}function W(a){return"y2"===Z(a)?og:ng}function X(a,b,c,d){var e=(Bi?Eb():xf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Bi?(e.tickCentered(gh),ve(ih)&&(ih=!1)):e.tickOffset=function(){var a=Bc(yf.data.targets),b=jg(a[1])-jg(a[0]);return b/zc()/2},Bi&&e.categories(fh),e}function Y(a,b,c,d){return xf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Ag?Ag[a]:"y"}function $(){var a=Ai?Li:Bi?Tc:function(a){return 0>a?a.toFixed(0):a};return hh&&("function"==typeof hh?a=hh:Ai&&(a=function(a){return a?Ki(hh)(a):""})),a}function _(a){var b;return"y"===a?b=yh:"y2"===a?b=Hh:"x"===a&&(b=th),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?yh=b:"y2"===a?Hh=b:"x"===a&&(th=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",bh?"inner-top":"inner-right")}function hb(){return fb("y",bh?"inner-right":"inner-top")}function ib(){return fb("y2",bh?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Qf/2:Qf:b.isBottom?-Sf:b.isMiddle?-Sf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!bh,gb())}function rb(){return nb(bh,hb())}function sb(){return nb(bh,ib())}function tb(){return ob(!bh,gb())}function ub(){return ob(bh,hb())}function vb(){return ob(bh,ib())}function wb(){var a=gb();return bh?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":rh?rh-10:"3em"}function xb(){var a=hb();return bh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return bh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!bh,gb())}function Ab(){return pb(bh,hb())}function Bb(){return pb(bh,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return xf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){gj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),gj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),gj.select("."+f.axisY2+" ."+f.axisY2Label).transition().attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 xf.min(Object.keys(i).map(function(a){return xf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(zg.length>0)for(g=Sc(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 xf.max(Object.keys(i).map(function(a){return xf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Fh:wh,n="y2"===c?Eh:vh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Gh:xh,r=ud()&&bh;return 0===l.length?"y2"===c?lg.domain():kg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(kg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Bh&&(f=b(Bh.top)?Bh.top:e,g=b(Bh.bottom)?Bh.bottom:e),"y2"===c&&Kh&&(f=b(Kh.top)?Kh.top:e,g=b(Kh.bottom)?Kh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return ph?Ai?re(ph):ph:xf.min(a,function(a){return xf.min(a.values,function(a){return a.x})})}function Zb(a){return oh?Ai?re(oh):oh:xf.max(a,function(a){return xf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Bi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof qh&&we(qh)?(e=b(qh.left)?qh.left:d,f=b(qh.right)?qh.right:d):e=f="number"==typeof qh?qh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=Ai?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Ai?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?kg:lg;return b="y"===a.axis||"y2"===a.axis?bh?Sf:"start"in a?d(a.start):Sf:bh?"end"in a?jg(Ai?re(a.end):a.end):Sf:Sf,c>b?0:b-c}function ic(a){return tg&&a===tg||we(ug)&&xe(ug,a)}function jc(a){return!ic(a)}function kc(a){return tg?tg:we(ug)?ug[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=yf.data.xs[b])}),c}function mc(a,b){return a in yf.data.xs&&yf.data.xs[a]&&yf.data.xs[a][b]?yf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){ug[b]=a[b]})}function oc(a){return 1===xf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=xg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),yf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=Ai?a?a instanceof Date?a:re(a):re(mc(c,d)):Ci&&!Bi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?yf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):tg?(d=Object.keys(yf.data.xs),yf.data.xs[c]=d.length>0?yf.data.xs[d[0]]:void 0):we(ug)&&(yf.data.xs[c]=lc(f,yf.data.targets)):yf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!yf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=wg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ci&&Bi&&0===c&&g&&(0===e&&(fh=[]),fh.push(g)),("undefined"==typeof a[b]||yf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Bg&&$d(Cc(c).filter(function(a){return!(a in Cg)}),Bg),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&yf.data.targets[0].values[a-1]?yf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(yf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Ai?new Date(i):i);j.push(e)}return Ai||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Mi=Mi.concat(a)}function Mc(a){Mi=Mi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Ni=Ni.concat(a)}function Oc(a){Ni=Ni.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return xf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Ld(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 Md(){return Eg&&"desc"===Eg.toLowerCase()}function Nd(){return Eg&&"asc"===Eg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Eg&&a.sort(Eg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(yf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&ni&&(jj.html(qi(a,$(),wd(k),Ji)).style("display","block"),d=jj.property("offsetWidth"),e=jj.property("offsetHeight"),k?(g=Qf/2+c[0],i=Sf/2+c[1]+20):(bh?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=jg(l[0].x)+20):(f=q(),g=f+t()+jg(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),jj.style("top",i+"px").style("left",g+"px"))}function Qd(){jj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});ni&&(be(yf.data.targets)||ee(yf.data.targets)||gj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(bh?"y1":"x1",Cd).attr(bh?"y2":"x2",Cd))}function Sd(){gj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?jg(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return"number"==typeof Zh?Zh:b?2*a.tickOffset()*$h/b:0}function $d(a,b){Dc(a).forEach(function(a){nj[a]=b===Cg[a],Cg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Cg[a.id]===b&&(c=!0),a.id in Cg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Cg)||"line"===Cg[b]||"spline"===Cg[b]||"area"===Cg[b]||"area-spline"===Cg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Cg[b]||"area-spline"===Cg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Cg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Cg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Cg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Cg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&hi||je(a)&&bi}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function re(b){var c;try{c=vg?xf.time.format(vg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+vg)}return c}function se(a,b){var c=xf.mouse(a),d=xf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?kg:lg,d=bh?1:0,e=bh?0:1;return Math.pow(jg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Qg(b,a.node()),gj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud).attr("stroke",function(){return Ji(b)}).attr("r",1.4*Je(b)).transition().duration(100).attr("r",Je)}function Be(a,b,c){Rg(b,a.node()),gj.select("."+f.selectedCircles+ld(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){Qg(b,a.node()),a.transition().duration(100).style("fill",function(){return xf.rgb(Ji(b)).darker(1)})}function Ee(a,b){Rg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ji(b)})}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){return Sh?"function"==typeof Th?Th(a):Th:0}function Ie(a){return Vh?Wh?Wh:1.75*He(a):He(a)}function Je(a){return Xh?Xh:4*He(a)}function Ke(a,c){return(c?gj.selectAll("."+f.circles+ld(c)):gj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Le(a,b){Ke(a,b).classed(f.EXPANDED,!0).attr("r",Ie)}function Me(a){Ke(a).filter(function(){return xf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",He)}function Ne(a){return gj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Oe(a){Ne(a).classed(f.EXPANDED,!0)}function Pe(a){Ne(a).classed(f.EXPANDED,!1)}function Qe(a,b){var c=Ue(a,b);return function(a,b){var d=c(a,b),e=bh?1:0,f=bh?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 Re(a,b){var c=Ue(a,!1),d=b?Se:Te;return function(a,b){return d(c(a,b),a,this)}}function Se(a,b){var c;return bh?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Te(a,b,c){var d=c.getBoundingClientRect();return bh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Ue(a,b){var c=a.__max__+1,d=Zd(pg,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return bh&&(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 Ve(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 We(b){var c,d,e;if(kj=xf.select(Af),kj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(kj.html("").classed("c3",!0),yf.data.xs={},yf.data.targets=vc(b),Ig&&Lc(Ig===!0?Cc(yf.data.targets):Ig),n(),R(),jg.domain(xf.extent(_b(yf.data.targets))),kg.domain(Xb(yf.data.targets,"y")),lg.domain(Xb(yf.data.targets,"y2")),mg.domain(jg.domain()),ng.domain(kg.domain()),og.domain(lg.domain()),lj=jg.domain(),_i.scale(mg),Ff&&dj.scale(jg),ej=kj.append("svg").attr("width",Qf+Nf.left+Nf.right).attr("height",Sf+Nf.top+Nf.bottom).on("mouseenter",If).on("mouseleave",Jf),fj=ej.append("defs"),fj.append("clipPath").attr("id",ui).append("rect").attr("width",Qf).attr("height",Sf),fj.append("clipPath").attr("id",vi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),fj.append("clipPath").attr("id",wi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),gj=ej.append("g").attr("transform",Si.main),hj=ej.append("g").attr("transform",Si.context),ij=ej.append("g").attr("transform",Si.legend),Ug||hj.style("visibility","hidden"),Xg||(ij.style("visibility","hidden"),Ni=Cc(yf.data.targets)),jj=xf.select(Af).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),sf(Cc(yf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),ch&&gj.append("g").attr("class",f.axisX).attr("clip-path",yi).attr("transform",Si.x).append("text").attr("class",f.axisXLabel).attr("transform",bh?"rotate(-90)":"").style("text-anchor",zb),uh&&gj.append("g").attr("class",f.axisY).attr("clip-path",zi).attr("transform",Si.y).append("text").attr("class",f.axisYLabel).attr("transform",bh?"":"rotate(-90)").style("text-anchor",Ab),Dh&&gj.append("g").attr("class",f.axisY2).attr("transform",Si.y2).append("text").attr("class",f.axisY2Label).attr("transform",bh?"":"rotate(-90)").style("text-anchor",Bb),d=gj.append("g").attr("clip-path",xi).attr("class",f.grid),Mh&&d.append("g").attr("class",f.xgrids),we(Oh)&&d.append("g").attr("class",f.xgridLines),Uh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Ph&&d.append("g").attr("class",f.ygrids),we(Qh)&&d.append("g").attr("class",f.ygridLines),gj.append("g").attr("clip-path",xi).attr("class",f.regions),gj.append("g").attr("clip-path",xi).attr("class",f.chart),c=gj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ff?bh?"ns-resize":"ew-resize":null),gj.select("."+f.chart).append("g").attr("class",f.chartBars),gj.select("."+f.chart).append("g").attr("class",f.chartLines),gj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Si.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),gj.select("."+f.chart).append("g").attr("class",f.chartTexts),Ff&&gj.insert("rect",Hf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Qf).attr("height",Sf).style("opacity",0).style("cursor",bh?"ns-resize":"ew-resize").call(dj).on("dblclick.zoom",null),sh&&_i.extent("function"!=typeof sh?sh:sh(_b())),hj.append("g").attr("clip-path",xi).attr("class",f.chart),hj.select("."+f.chart).append("g").attr("class",f.chartBars),hj.select("."+f.chart).append("g").attr("class",f.chartLines),hj.append("g").attr("clip-path",xi).attr("class",f.brush).call(_i).selectAll("rect").attr(bh?"width":"height",bh?Rf:Tf),hj.append("g").attr("class",f.axisX).attr("transform",Si.subx).attr("clip-path",bh?"":yi),hf(yf.data.targets),bh?gj.select("."+f.axisX).style("opacity",0).call(pg):(gj.select("."+f.axisY).style("opacity",0).call(qg),gj.select("."+f.axisY2).style("opacity",0).call(rg)),n(),R(),ff(),m(!1),bf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),ri){if(Ai&&"string"==typeof si){for(si=re(si),e=0;eQf&&(Qf=0),0>Sf&&(Sf=0),Rf=bh?Nf.left-Yi-Zi:Qf,Tf=bh?Sf:Vf-Of.top-Of.bottom,0>Rf&&(Rf=0),0>Tf&&(Tf=0),p(),Ti&&ee(yf.data.targets)&&(Pf.left=Qf/2+Xf)}function o(){gj.select("line."+f.xgridFocus).attr("x1",bh?0:-10).attr("x2",bh?Qf:-10).attr("y1",bh?-10:Nf.top).attr("y2",bh?-10:Sf)}function p(){Xf=Sf/2,Wf=.95*Xf,Yf=de(yf.data.targets)?.6*Wf:0}function q(){var a=bh?f.axisX:f.axisY,b=gj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=xf.select(Af).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Bf?Bf:x()}function s(){var a=Cf?Cf:y();return a>0?a:320}function t(){return ee(yf.data.targets)?0:Df?Df:bh?ch?v("x"):1:!uh||zh?1:v("y")}function u(){var a=1;return ee(yf.data.targets)?0:Ef?Ef:Ti?P()+(Dh&&!bh?v("y2"):a):Dh?Ih||bh?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||ch?"x"===a&&rh?rh:"y"!==a||uh?"y2"!==a||Dh?(jb(a).isInner?30:40)+("y2"===a?-10:0):$i:Xg&&!Ti?10:1:0}function x(){return+xf.select(Af).style("width").replace("px","")}function y(){return+xf.select(Af).style("height").replace("px","")}function z(a){return a?-5:-(Nf.left-1)}function A(a){return a?-20:-4}function B(){return z(!bh)}function C(){return A(!bh)}function D(){return z(bh)}function E(){return A(bh)}function F(a){return a?Qf+2+4:Nf.left+20}function G(a){return a?(rh?rh:0)+80:Sf+8}function H(){return F(!bh)}function I(){return G(!bh)}function J(){return F(bh)}function K(){return G(bh)}function L(){var a,b,c,d,e,f=Ac(yf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=jg(b.x)-jg(a.x),d=zc(),e=ae(yf.data.targets)?(d-(Bi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Ui=a}function N(a){Vi=a}function O(a){Wi=a}function P(){return Xg?Ti?Vi*(Ui+1):Uf:0}function Q(){return Xg?Ti?Vf:Wi*(Ui+1):0}function R(){var a,b,c=!jg;bg=bh?1:0,cg=bh?Sf:Qf,dg=bh?0:Sf,eg=bh?Qf:1,fg=bg,gg=cg,hg=bh?0:Tf,ig=bh?Rf:1,jg=T(bg,cg,c?void 0:jg.domain(),function(){return pg.tickOffset()}),kg=U(dg,eg,c?void 0:kg.domain()),lg=U(dg,eg,c?void 0:lg.domain()),mg=T(bg,cg,lj,function(a){return a%1?0:sg.tickOffset()}),ng=U(hg,ig,c?void 0:ng.domain()),og=U(hg,ig,c?void 0:og.domain()),a=$(),b=mh?mh:c?void 0:pg.tickValues(),pg=X(jg,Oi,a,b),sg=X(mg,Ri,a,b),qg=Y(kg,Pi,Ah,Ch),rg=Y(lg,Qi,Jh,Lh),c||(_i.scale(mg),Ff&&dj.scale(jg)),S()}function S(){Zf=Gb(),$f=Hb(),_f=Hb(.98)}function T(a,b,d,e){var f=(Ai?xf.time.scale():xf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Bi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=xf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?lg:kg}function W(a){return"y2"===Z(a)?og:ng}function X(a,b,c,d){var e=(Bi?Eb():xf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Bi?(e.tickCentered(gh),ve(ih)&&(ih=!1)):e.tickOffset=function(){var a=Bc(yf.data.targets),b=jg(a[1])-jg(a[0]);return b/zc()/2},Bi&&e.categories(fh),e}function Y(a,b,c,d){return xf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Ag?Ag[a]:"y"}function $(){var a=Ai?Li:Bi?Tc:function(a){return 0>a?a.toFixed(0):a};return hh&&("function"==typeof hh?a=hh:Ai&&(a=function(a){return a?Ki(hh)(a):""})),a}function _(a){var b;return"y"===a?b=yh:"y2"===a?b=Hh:"x"===a&&(b=th),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?yh=b:"y2"===a?Hh=b:"x"===a&&(th=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",bh?"inner-top":"inner-right")}function hb(){return fb("y",bh?"inner-right":"inner-top")}function ib(){return fb("y2",bh?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Qf/2:Qf:b.isBottom?-Sf:b.isMiddle?-Sf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!bh,gb())}function rb(){return nb(bh,hb())}function sb(){return nb(bh,ib())}function tb(){return ob(!bh,gb())}function ub(){return ob(bh,hb())}function vb(){return ob(bh,ib())}function wb(){var a=gb();return bh?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":rh?rh-10:"3em"}function xb(){var a=hb();return bh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return bh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!bh,gb())}function Ab(){return pb(bh,hb())}function Bb(){return pb(bh,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return xf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){gj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),gj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),gj.select("."+f.axisY2+" ."+f.axisY2Label).transition().attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 xf.min(Object.keys(i).map(function(a){return xf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(zg.length>0)for(g=Sc(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 xf.max(Object.keys(i).map(function(a){return xf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Fh:wh,n="y2"===c?Eh:vh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Gh:xh,r=ud()&&bh;return 0===l.length?"y2"===c?lg.domain():kg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(kg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Bh&&(f=b(Bh.top)?Bh.top:e,g=b(Bh.bottom)?Bh.bottom:e),"y2"===c&&Kh&&(f=b(Kh.top)?Kh.top:e,g=b(Kh.bottom)?Kh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return ph?Ai?re(ph):ph:xf.min(a,function(a){return xf.min(a.values,function(a){return a.x})})}function Zb(a){return oh?Ai?re(oh):oh:xf.max(a,function(a){return xf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Bi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof qh&&we(qh)?(e=b(qh.left)?qh.left:d,f=b(qh.right)?qh.right:d):e=f="number"==typeof qh?qh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=Ai?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Ai?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?kg:lg;return b="y"===a.axis||"y2"===a.axis?bh?Sf:"start"in a?d(a.start):Sf:bh?"end"in a?jg(Ai?re(a.end):a.end):Sf:Sf,c>b?0:b-c}function ic(a){return tg&&a===tg||we(ug)&&xe(ug,a)}function jc(a){return!ic(a)}function kc(a){return tg?tg:we(ug)?ug[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=yf.data.xs[b])}),c}function mc(a,b){return a in yf.data.xs&&yf.data.xs[a]&&yf.data.xs[a][b]?yf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){ug[b]=a[b]})}function oc(a){return 1===xf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=xg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),yf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=Ai?a?a instanceof Date?a:re(a):re(mc(c,d)):Ci&&!Bi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?yf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):tg?(d=Object.keys(yf.data.xs),yf.data.xs[c]=d.length>0?yf.data.xs[d[0]]:void 0):we(ug)&&(yf.data.xs[c]=lc(f,yf.data.targets)):yf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!yf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=wg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ci&&Bi&&0===c&&g&&(0===e&&(fh=[]),fh.push(g)),("undefined"==typeof a[b]||yf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Bg&&$d(Cc(c).filter(function(a){return!(a in Cg)}),Bg),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&yf.data.targets[0].values[a-1]?yf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(yf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Ai?new Date(i):i);j.push(e)}return Ai||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Mi=Mi.concat(a)}function Mc(a){Mi=Mi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Ni=Ni.concat(a)}function Oc(a){Ni=Ni.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return xf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Ld(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 Md(){return Eg&&"desc"===Eg.toLowerCase()}function Nd(){return Eg&&"asc"===Eg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Eg&&a.sort(Eg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(yf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&ni&&(jj.html(qi(a,$(),wd(k),Ji)).style("display","block"),d=jj.property("offsetWidth"),e=jj.property("offsetHeight"),k?(g=Qf/2+c[0],i=Sf/2+c[1]+20):(bh?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=jg(l[0].x)+20):(f=q(),g=f+t()+jg(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),jj.style("top",i+"px").style("left",g+"px"))}function Qd(){jj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});ni&&(be(yf.data.targets)||ee(yf.data.targets)||gj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(bh?"y1":"x1",Cd).attr(bh?"y2":"x2",Cd))}function Sd(){gj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?jg(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return"number"==typeof Zh?Zh:b?2*a.tickOffset()*$h/b:0}function $d(a,b){Dc(a).forEach(function(a){nj[a]=b===Cg[a],Cg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Cg[a.id]===b&&(c=!0),a.id in Cg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Cg)||"line"===Cg[b]||"spline"===Cg[b]||"area"===Cg[b]||"area-spline"===Cg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Cg[b]||"area-spline"===Cg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Cg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Cg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Cg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Cg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&hi||je(a)&&bi}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function re(b){var c;try{c=vg?xf.time.format(vg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+vg)}return c}function se(a,b){var c=xf.mouse(a),d=xf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?kg:lg,d=bh?1:0,e=bh?0:1;return Math.pow(jg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Qg(b,a.node()),gj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud).attr("stroke",function(){return Ji(b)}).attr("r",1.4*Je(b)).transition().duration(100).attr("r",Je)}function Be(a,b,c){Rg(b,a.node()),gj.select("."+f.selectedCircles+ld(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){Qg(b,a.node()),a.transition().duration(100).style("fill",function(){return xf.rgb(Ji(b)).darker(1)})}function Ee(a,b){Rg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ji(b)})}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){return Sh?"function"==typeof Th?Th(a):Th:0}function Ie(a){return Vh?Wh?Wh:1.75*He(a):He(a)}function Je(a){return Xh?Xh:4*He(a)}function Ke(a,c){return(c?gj.selectAll("."+f.circles+ld(c)):gj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Le(a,b){Ke(a,b).classed(f.EXPANDED,!0).attr("r",Ie)}function Me(a){Ke(a).filter(function(){return xf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",He)}function Ne(a){return gj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Oe(a){Ne(a).classed(f.EXPANDED,!0)}function Pe(a){Ne(a).classed(f.EXPANDED,!1)}function Qe(a,b){var c=Ue(a,b);return function(a,b){var d=c(a,b),e=bh?1:0,f=bh?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 Re(a,b){var c=Ue(a,!1),d=b?Se:Te;return function(a,b){return d(c(a,b),a,this)}}function Se(a,b){var c;return bh?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Te(a,b,c){var d=c.getBoundingClientRect();return bh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Ue(a,b){var c=a.__max__+1,d=Zd(pg,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return bh&&(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 Ve(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 We(b){var c,d,e;if(kj=xf.select(Af),kj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(kj.html("").classed("c3",!0),yf.data.xs={},yf.data.targets=vc(b),Ig&&Lc(Ig===!0?Cc(yf.data.targets):Ig),n(),R(),jg.domain(xf.extent(_b(yf.data.targets))),kg.domain(Xb(yf.data.targets,"y")),lg.domain(Xb(yf.data.targets,"y2")),mg.domain(jg.domain()),ng.domain(kg.domain()),og.domain(lg.domain()),lj=jg.domain(),_i.scale(mg),Ff&&dj.scale(jg),ej=kj.append("svg").attr("width",Qf+Nf.left+Nf.right).attr("height",Sf+Nf.top+Nf.bottom).on("mouseenter",If).on("mouseleave",Jf),fj=ej.append("defs"),fj.append("clipPath").attr("id",ui).append("rect").attr("width",Qf).attr("height",Sf),fj.append("clipPath").attr("id",vi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),fj.append("clipPath").attr("id",wi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),gj=ej.append("g").attr("transform",Si.main),hj=ej.append("g").attr("transform",Si.context),ij=ej.append("g").attr("transform",Si.legend),Ug||hj.style("visibility","hidden"),Xg||(ij.style("visibility","hidden"),Ni=Cc(yf.data.targets)),jj=xf.select(Af).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),sf(Cc(yf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=gj.append("g").attr("clip-path",xi).attr("class",f.grid),Mh&&d.append("g").attr("class",f.xgrids),we(Oh)&&d.append("g").attr("class",f.xgridLines),Uh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Ph&&d.append("g").attr("class",f.ygrids),we(Qh)&&d.append("g").attr("class",f.ygridLines),ch&&gj.append("g").attr("class",f.axisX).attr("clip-path",yi).attr("transform",Si.x).append("text").attr("class",f.axisXLabel).attr("transform",bh?"rotate(-90)":"").style("text-anchor",zb),uh&&gj.append("g").attr("class",f.axisY).attr("clip-path",zi).attr("transform",Si.y).append("text").attr("class",f.axisYLabel).attr("transform",bh?"":"rotate(-90)").style("text-anchor",Ab),Dh&&gj.append("g").attr("class",f.axisY2).attr("transform",Si.y2).append("text").attr("class",f.axisY2Label).attr("transform",bh?"":"rotate(-90)").style("text-anchor",Bb),gj.append("g").attr("clip-path",xi).attr("class",f.regions),gj.append("g").attr("clip-path",xi).attr("class",f.chart),c=gj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ff?bh?"ns-resize":"ew-resize":null),gj.select("."+f.chart).append("g").attr("class",f.chartBars),gj.select("."+f.chart).append("g").attr("class",f.chartLines),gj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Si.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),gj.select("."+f.chart).append("g").attr("class",f.chartTexts),Ff&&gj.insert("rect",Hf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Qf).attr("height",Sf).style("opacity",0).style("cursor",bh?"ns-resize":"ew-resize").call(dj).on("dblclick.zoom",null),sh&&_i.extent("function"!=typeof sh?sh:sh(_b())),hj.append("g").attr("clip-path",xi).attr("class",f.chart),hj.select("."+f.chart).append("g").attr("class",f.chartBars),hj.select("."+f.chart).append("g").attr("class",f.chartLines),hj.append("g").attr("clip-path",xi).attr("class",f.brush).call(_i).selectAll("rect").attr(bh?"width":"height",bh?Rf:Tf),hj.append("g").attr("class",f.axisX).attr("transform",Si.subx).attr("clip-path",bh?"":yi),hf(yf.data.targets),bh?gj.select("."+f.axisX).style("opacity",0).call(pg):(gj.select("."+f.axisY).style("opacity",0).call(qg),gj.select("."+f.axisY2).style("opacity",0).call(rg)),n(),R(),ff(),m(!1),bf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),ri){if(Ai&&"string"==typeof si){for(si=re(si),e=0;e0){d=[];for(var g in xg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(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 _e(a){ee(yf.data.targets)||Jg&&(Di=a,gj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ei=!0,Sg())}function af(){ee(yf.data.targets)||Jg&&(gj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),gj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ei=!1,Tg())}function bf(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Vd(),W=ee(yf.data.targets),X=Ic(yf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Mf:0,Q=D?P:0,R=E?P:0,c=gj.select("."+f.axisX).style("opacity",W?0:1),g=gj.select("."+f.axisY).style("opacity",W?0:1),h=gj.select("."+f.axisY2).style("opacity",W?0:1),e=hj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Xg&&sf(Cc(yf.data.targets),a,O),Bi&&(0!==X.length&&H&&G||jg.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(jg.domain(xf.extent(_b(X))),lj=jg.domain(),Ff&&dj.scale(jg).updateScaleExtent(),mg.domain(jg.domain()),_i.scale(mg)),G&&(jg.domain(_i.empty()?lj:_i.extent()),Ff&&dj.scale(jg).updateScaleExtent()),mh||!lh&&!kh||(S=Kc(Jc(X),kh),pg.tickValues(S),sg.tickValues(S))),kg.domain(Xb(X,"y")),lg.domain(Xb(X,"y2")),O.axisX.call(pg),O.axisY.call(qg),O.axisY2.call(rg),O.axisSubX.call(sg),G&&X.length)if(ih&&S){for(T=1;T=0&&xf.select(this).style("display",b%U?"none":"block")})}else xf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!bh&&nh&&eb(c,O.axisX,nh),J=Qe(V),M=Re(V,!0),N=Re(V,!1),Db(),ng.domain(kg.domain()),og.domain(lg.domain()),jj.style("display","none"),o(),gj.select("line."+f.xgridFocus).style("visibility","hidden"),Mh){if("year"===Nh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=jg.ticks(10);i=gj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",bh?0:function(a){return jg(a)-pg.tickOffset()}).attr("x2",bh?Qf:function(a){return jg(a)-pg.tickOffset()}).attr("y1",bh?function(a){return jg(a)-pg.tickOffset()}:Nf.top).attr("y2",bh?function(a){return jg(a)-pg.tickOffset()}:Sf).style("opacity",function(){return+xf.select(this).attr(bh?"y1":"x1")===(bh?Sf:0)?0:1}),i.exit().remove()}we(Oh)&&(k=gj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Oh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",bh?"":"rotate(-90)").attr("dx",bh?0:-Nf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",bh?0:Dd).attr("x2",bh?Qf:Dd).attr("y1",bh?Dd:Nf.top).attr("y2",bh?Dd:Sf).style("opacity",1),k.select("text").transition().duration(P).attr("x",bh?Qf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Ph&&(m=gj.select("."+f.ygrids).selectAll("."+f.ygrid).data(kg.ticks(Rh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",bh?kg:0).attr("x2",bh?kg:Qf).attr("y1",bh?0:kg).attr("y2",bh?Sf:kg),m.exit().remove()),A&&we(Qh)&&(n=gj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Qh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",bh?"rotate(-90)":"").attr("dx",bh?0:-Nf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",bh?Ed:0).attr("x2",bh?Ed:Qf).attr("y1",bh?0:Ed).attr("y2",bh?Sf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",bh?0:Qf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=gj.select("."+f.regions).selectAll("rect."+f.region).data(mi),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=gj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Ji(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=gj.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return bh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),gj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1),gj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",bj).style("opacity",mj),q=gj.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",He),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud),q.exit().remove(),gj.each(function(){Hi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=xf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Hi=!1}),gj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),gj.select("."+f.chartArcsTitle).style("opacity",de(yf.data.targets)?1:0),Ug&&(null!==xf.event&&"zoom"===xf.event.type&&_i.extent(jg.orgDomain()).update(),B&&(!bh&&nh&&eb(e,O.axisSubX,nh),_i.empty()||_i.extent(jg.orgDomain()).update(),K=Qe(V,!0),u=hj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Ji(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),hj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",cj).style("opacity",1))),gj.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),gj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud),v=gj.select("."+f.eventRects),we(ug)&&!oc(ug)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=gj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ye(w.enter()),w.attr("x",0).attr("y",0).attr("width",Qf).attr("height",Sf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ci&&!Bi?(z=function(a,b){var c=xc(b),d=yc(b),e=yf.data.xs[a.id][b];return(jg(d?d:e+50)-jg(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=yf.data.xs[a.id][b];return(jg(d)+jg(c?c:d-50))/2}):(z=L(),y=function(a){return jg(a.x)-z/2}),x=Ac(yf.data.targets),gj.select("."+f.eventRects).datum(x?x.values:[]),w=gj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Xe(w.enter()),w.attr("class",fd).attr("x",bh?0:y).attr("y",bh?y:0).attr("width",bh?Qf:z).attr("height",bh?z:Sf),w.exit().remove()),Cc(yf.data.targets).forEach(function(a){nj[a]=!0})}function cf(){bf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function df(){return"mousemove"===xf.event.sourceEvent.type&&dj.altDomain?(jg.domain(dj.altDomain),void dj.scale(jg).updateScaleExtent()):(Bi&&jg.orgDomain()[0]===lj[0]&&jg.domain([lj[0]-1e-10,jg.orgDomain()[1]]),bf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===xf.event.sourceEvent.type&&(Fi=!0)))}function ef(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function ff(){ej.attr("width",Uf).attr("height",Vf),ej.select("#"+ui).select("rect").attr("width",Qf).attr("height",Sf),ej.select("#"+vi).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),ej.select("#"+wi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej.select("."+f.zoomRect).attr("width",Qf).attr("height",Sf),kj.style("max-height",Vf+"px")}function gf(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),ff(),m(a.withTransition),bf(a)}function hf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=gj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Ji(a)}),e=gj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Lg(a)?"pointer":null}),c=gj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ji(a)}),b.append("path").attr("class",dd).style("opacity",function(){return mj=+xf.select(this).style("opacity"),0}).style("fill",function(a){return Ji(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Ji(a)}).style("cursor",function(a){return Lg(a)?"pointer":null}),a.forEach(function(a){gj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=gj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(ag(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Ji(a.data)}).style("cursor",function(a){return Lg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Hi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),of(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,xf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Hi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),pf(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Ug&&(n=hj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Ji(a)}),l=hj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ji(a)})),ej.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Mf).style("opacity",1)}function jf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),yf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Ti?j:i,l=Ti?Q():P();return d&&(w=0,C=0,t=0,u=0),Xg&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Ti?u:t,void(ah?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=ij.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,Ti?(g=function(a){return t*(.2+B[a])},j=function(a){return A[B[a]]+x[a]}):(g=function(a){return A[B[a]]+x[a]},j=function(a){return u*(.2+B[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=ij.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Zg?Zg(a):yf.toggle(a)}).on("mouseover",function(a){xf.select(this).classed(f.legendItemFocused,!0),Hi||yf.focus(a),"function"==typeof $g&&$g(a)}).on("mouseout",function(a){xf.select(this).classed(f.legendItemFocused,!1),Hi||yf.revert(),"function"==typeof _g&&_g(a)}),o.append("text").text(function(a){return d(xg[a])?xg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ti?h:-200).attr("y",Ti?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ti?i:-200).attr("y",Ti?-200:l).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Ji(a)}).attr("x",Ti?h:-200).attr("y",Ti?-200:j).attr("width",10).attr("height",10),ij.selectAll("text").data(a).text(function(a){return d(xg[a])?xg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),ij.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),ij.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),ij.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=xf.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?mf(b):nf(b):Xi}),N(t),O(u),M(C),n(),R(),ff(),m(q,c)}function tf(a){return Ec(yf.data.targets,a.id)}function uf(a){return"data"in a&&Ec(yf.data.targets,a.data.id)}function vf(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 wf(a,b,c){var d=!ee(yf.data.targets);Hi=!1,$d(a,b),gf(c||{withTransitionForAxis:d})}var xf=a.d3?a.d3:a.require?a.require("d3"):void 0,yf={data:{},axis:{},legend:{}},zf={},Af=h(["bindto"],"#chart"),Bf=h(["size","width"]),Cf=h(["size","height"]),Df=h(["padding","left"],50),Ef=h(["padding","right"]),Ff=h(["zoom","enabled"],!1),Gf=h(["zoom","extent"]),Hf=h(["zoom","privileged"],!1),If=h(["onenter"],function(){}),Jf=h(["onleave"],function(){}),Kf=h(["onresize"],function(){}),Lf=h(["onresized"],function(){}),Mf=h(["transition","duration"],350);g("data","data is required in config");var Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg=h(["data","x"]),ug=h(["data","xs"],{}),vg=h(["data","x_format"]),wg=h(["data","id_converter"],function(a){return a}),xg=h(["data","names"],{}),yg=h(["data","classes"],{}),zg=h(["data","groups"],[]),Ag=h(["data","axes"],{}),Bg=h(["data","type"]),Cg=h(["data","types"],{}),Dg=h(["data","labels"],{}),Eg=h(["data","order"]),Fg=h(["data","regions"],{}),Gg=h(["data","color"]),Hg=h(["data","colors"],{}),Ig=h(["data","hide"],!1),Jg=h(["data","selection","enabled"],!1),Kg=h(["data","selection","grouped"],!1),Lg=h(["data","selection","isselectable"],function(){return!0}),Mg=h(["data","selection","multiple"],!0),Ng=h(["data","onclick"],function(){}),Og=h(["data","onenter"],function(){}),Pg=h(["data","onleave"],function(){}),Qg=h(["data","onselected"],function(){}),Rg=h(["data","onunselected"],function(){}),Sg=h(["data","ondragstart"],function(){}),Tg=h(["data","ondragend"],function(){}),Ug=h(["subchart","show"],!1),Vg=h(["subchart","size","height"],60),Wg=h(["color","pattern"],[]),Xg=h(["legend","show"],!0),Yg=h(["legend","position"],"bottom"),Zg=h(["legend","item","onclick"]),$g=h(["legend","item","onmouseover"]),_g=h(["legend","item","onmouseout"]),ah=h(["legend","equally"],!1),bh=h(["axis","rotated"],!1),ch=h(["axis","x","show"],!0),dh=h(["axis","x","type"],"indexed"),eh=h(["axis","x","localtime"],!0),fh=h(["axis","x","categories"],[]),gh=h(["axis","x","tick","centered"],!1),hh=h(["axis","x","tick","format"]),ih=h(["axis","x","tick","culling"],{}),jh=h(["axis","x","tick","culling","max"],10),kh=h(["axis","x","tick","count"]),lh=h(["axis","x","tick","fit"],!0),mh=h(["axis","x","tick","values"],null),nh=h(["axis","x","tick","rotate"]),oh=h(["axis","x","max"],null),ph=h(["axis","x","min"],null),qh=h(["axis","x","padding"],{}),rh=h(["axis","x","height"]),sh=h(["axis","x","default"]),th=h(["axis","x","label"],{}),uh=h(["axis","y","show"],!0),vh=h(["axis","y","max"]),wh=h(["axis","y","min"]),xh=h(["axis","y","center"]),yh=h(["axis","y","label"],{}),zh=h(["axis","y","inner"],!1),Ah=h(["axis","y","tick","format"]),Bh=h(["axis","y","padding"],{}),Ch=h(["axis","y","ticks"],10),Dh=h(["axis","y2","show"],!1),Eh=h(["axis","y2","max"]),Fh=h(["axis","y2","min"]),Gh=h(["axis","y2","center"]),Hh=h(["axis","y2","label"],{}),Ih=h(["axis","y2","inner"],!1),Jh=h(["axis","y2","tick","format"]),Kh=h(["axis","y2","padding"],{}),Lh=h(["axis","y2","ticks"],10),Mh=h(["grid","x","show"],!1),Nh=h(["grid","x","type"],"tick"),Oh=h(["grid","x","lines"],[]),Ph=h(["grid","y","show"],!1),Qh=h(["grid","y","lines"],[]),Rh=h(["grid","y","ticks"],10),Sh=h(["point","show"],!0),Th=h(["point","r"],2.5),Uh=h(["point","focus","line","enabled"],!0),Vh=h(["point","focus","expand","enabled"],!0),Wh=h(["point","focus","expand","r"]),Xh=h(["point","focus","select","r"]),Yh=h(["line","connect_null"],!1),Zh=h(["bar","width"]),$h=h(["bar","width","ratio"],.6),_h=h(["pie","label","show"],!0),ai=h(["pie","label","format"]),bi=h(["pie","expand"],!0),ci=h(["pie","onclick"],function(){}),di=h(["pie","onmouseover"],function(){}),ei=h(["pie","onmouseout"],function(){}),fi=h(["donut","label","show"],!0),gi=h(["donut","label","format"]),hi=h(["donut","expand"],!0),ii=h(["donut","title"],""),ji=h(["donut","onclick"],function(){}),ki=h(["donut","onmouseover"],function(){}),li=h(["donut","onmouseout"],function(){}),mi=h(["regions"],[]),ni=h(["tooltip","show"],!0),oi=h(["tooltip","format","title"]),pi=h(["tooltip","format","value"]),qi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=oi?oi:b,l=pi?pi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id,a[g].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),ri=h(["tooltip","init","show"],!1),si=h(["tooltip","init","x"],0),ti=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ui=("string"==typeof Af?Af.replace("#",""):Af.id)+"-clip",vi=ui+"-xaxis",wi=ui+"-yaxis",xi=i(ui),yi=i(vi),zi=i(wi),Ai="timeseries"===dh,Bi="categorized"===dh,Ci=!Ai&&(tg||we(ug)),Di=null,Ei=!1,Fi=!1,Gi=!1,Hi=!1,Ii=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ji=qe(Hg,we(Wg)?Wg:Ii,Gg),Ki=eh?xf.time.format:xf.time.format.utc,Li=function(){var a=[[Ki("%Y/%-m/%-d"),function(){return!0}],[Ki("%-m/%-d"),function(a){return a.getMonth()}],[Ki("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ki("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ki("%I %p"),function(a){return a.getHours()}],[Ki("%I:%M"),function(a){return a.getMinutes()}],[Ki(":%S"),function(a){return a.getSeconds()}],[Ki(".%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)}}(),Mi=[],Ni=[],Oi=bh?"left":"bottom",Pi=bh?zh?"top":"bottom":zh?"right":"left",Qi=bh?Ih?"bottom":"top":Ih?"left":"right",Ri=bh?"left":"bottom",Si={main:function(){return"translate("+Nf.left+","+Nf.top+")"},context:function(){return"translate("+Of.left+","+Of.top+")"},legend:function(){return"translate("+Pf.left+","+Pf.top+")"},x:function(){return"translate(0,"+(bh?0:Sf)+")"},y:function(){return"translate(0,"+(bh?Sf:0)+")"},y2:function(){return"translate("+(bh?0:Qf)+","+(bh?1:0)+")"},subx:function(){return"translate(0,"+(bh?0:Tf)+")"},arc:function(){return"translate("+Qf/2+","+Sf/2+")"}},Ti="right"===Yg,Ui=0,Vi=0,Wi=0,Xi=.15,Yi=30,Zi=bh&&!ch?0:30,$i=5;ag=xf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var _i,aj=function(){var a=xf.svg.line().x(bh?function(a){return V(a.id)(a.value)}:Cd).y(bh?Cd:function(a){return V(a.id)(a.value)});return Yh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Yh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Fg[b.id]?Ve(e,jg,V(b.id),Fg[b.id]):a(e)):(c=e[0]?jg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,bh?"M "+d+" "+c:"M "+c+" "+d)}}(),bj=function(){var a;return a=bh?xf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):xf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?jg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,bh?"M "+d+" "+c:"M "+c+" "+d)}}(),cj=function(){var a=xf.svg.line().x(bh?function(a){return W(a.id)(a.value)}:Fd).y(bh?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+mg(c[0].x)+" "+W(b.id)(c[0].value)}}(),dj=function(){};_i=xf.svg.brush().on("brush",cf),_i.update=function(){return hj&&hj.select("."+f.brush).call(this),this},_i.scale=function(a){return bh?this.y(a):this.x(a)},Ff&&(dj=xf.behavior.zoom().on("zoomstart",function(){dj.altDomain=xf.event.sourceEvent.altKey?jg.orgDomain():null}).on("zoom",Ff?df:null),dj.scale=function(a){return bh?this.y(a):this.x(a)},dj.orgScaleExtent=function(){var a=Gf?Gf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},dj.updateScaleExtent=function(){var a=ac(jg.orgDomain())/ac(lj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var ej,fj,gj,hj,ij,jj,kj,lj,mj,nj={};if(yf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);yf.revert(),yf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(yf.data.targets)&&Nb(a,!0),of(a,!0)},yf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);yf.revert(),b(d.classed(f.focused,!1)),b(e),ee(yf.data.targets)&&Ob(a),of(a,!1)},yf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);b(d.classed(f.focused,!1)),b(e),ee(yf.data.targets)&&Ob(a),pf()},yf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),ej.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&qf(a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},yf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),ej.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&rf(a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},yf.toggle=function(a){Gc(a)?yf.hide(a):yf.show(a)},yf.unzoom=function(){_i.clear().update(),bf({withUpdateXDomain:!0})},yf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){yg[b]=a.classes[b]}),"categories"in a&&Bi&&(fh=a.categories,pg.categories(fh)),"cacheIds"in a&&bc(a.cacheIds)?void jf(dc(a.cacheIds),a.done):void("unload"in a?lf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){kf(a)}):kf(a))},yf.unload=function(a,b){lf(Dc(a),function(){bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},yf.selected=function(a){return xf.merge(gj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return xf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},yf.select=function(a,b,c){Jg&&gj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=xf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Kg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Lg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},yf.unselect=function(a,b){Jg&&gj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=xf.select(this),g="circle"===this.nodeName?Be:Ee,h=Kg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Lg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},yf.toLine=function(a){wf(a,"line")},yf.toSpline=function(a){wf(a,"spline")},yf.toBar=function(a){wf(a,"bar")},yf.toScatter=function(a){wf(a,"scatter")},yf.toArea=function(a){wf(a,"area")},yf.toAreaSpline=function(a){wf(a,"area-spline") },yf.toPie=function(a){wf(a,"pie",{withTransform:!0})},yf.toDonut=function(a){wf(a,"donut",{withTransform:!0})},yf.groups=function(a){return c(a)?zg:(zg=a,bf(),zg)},yf.xgrids=function(a){return a?(Oh=a,bf(),Oh):Oh},yf.xgrids.add=function(a){return a?yf.xgrids(Oh.concat(a)):void 0},yf.xgrids.remove=function(a){var b=vf(a);return yf.xgrids(Oh.filter(b))},yf.ygrids=function(a){return a?(Qh=a,bf(),Qh):Qh},yf.ygrids.add=function(a){return a?yf.ygrids(Qh.concat(a)):void 0},yf.ygrids.remove=function(a){var b=vf(a);return yf.ygrids(Qh.filter(b))},yf.regions=function(a){return c(a)?mi:(mi=a,bf(),mi)},yf.regions.add=function(a){return c(a)?mi:(mi=mi.concat(a),bf(),mi)},yf.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;ej.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),mi=mi.filter(function(b){return b.classes.indexOf(a)<0})}),mi},yf.data.get=function(a){var b=yf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},yf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},yf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){xg[b]=a[b]}),sf(Cc(yf.data.targets),{withTransition:!0}),xg):xg},yf.x=function(a){return arguments.length&&(qc(yf.data.targets,a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),yf.data.xs},yf.xs=function(a){return arguments.length&&(rc(yf.data.targets,a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),yf.data.xs},yf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},yf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(vh=+a.y),b(a.y2)&&(Eh=+a.y2)):vh=Eh=+a,bf())},yf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(wh=+a.y),b(a.y2)&&(Fh=+a.y2)):wh=Fh=+a,bf())},yf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&yf.axis.max(a.max),"undefined"!=typeof a.min&&yf.axis.min(a.min))},yf.legend.show=function(a){qf(Dc(a)),bf({withLegend:!0})},yf.legend.hide=function(a){rf(Dc(a)),bf({withLegend:!0})},yf.resize=function(a){Bf=a?a.width:null,Cf=a?a.height:null,gf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},yf.destroy=function(){yf.data.targets=void 0,yf.data.xs={},kj.html(""),a.onresize=null},"url"in e.data)xf.xhr(e.data.url,function(a,b){var c,d=xf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=xf.csv.parse(b.response),We(c)});else if("rows"in e.data)We(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");We(uc(e.data.columns))}return yf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From fe21f1e7c4a7254e675e051b1b7134e47c18889c Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Thu, 1 May 2014 15:20:21 +0900 Subject: [PATCH 106/178] Fix bar stack - #192 --- c3.js | 14 +++++++------- c3.min.js | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/c3.js b/c3.js index 3214410..b19d548 100644 --- a/c3.js +++ b/c3.js @@ -193,7 +193,7 @@ __axis_y_label = getConfig(['axis', 'y', 'label'], {}), __axis_y_inner = getConfig(['axis', 'y', 'inner'], false), __axis_y_tick_format = getConfig(['axis', 'y', 'tick', 'format']), - __axis_y_padding = getConfig(['axis', 'y', 'padding'], {}), + __axis_y_padding = getConfig(['axis', 'y', 'padding']), __axis_y_ticks = getConfig(['axis', 'y', 'ticks'], 10), __axis_y2_show = getConfig(['axis', 'y2', 'show'], false), __axis_y2_max = getConfig(['axis', 'y2', 'max']), @@ -202,7 +202,7 @@ __axis_y2_label = getConfig(['axis', 'y2', 'label'], {}), __axis_y2_inner = getConfig(['axis', 'y2', 'inner'], false), __axis_y2_tick_format = getConfig(['axis', 'y2', 'tick', 'format']), - __axis_y2_padding = getConfig(['axis', 'y2', 'padding'], {}), + __axis_y2_padding = getConfig(['axis', 'y2', 'padding']), __axis_y2_ticks = getConfig(['axis', 'y2', 'ticks'], 10); // grid @@ -1781,7 +1781,7 @@ } function getDataLabelWidth(min, max) { var widths = [], paddingCoef = 1.3; - d3.select('svg').selectAll('.dummy') + selectChart.select('svg').selectAll('.dummy') .data([min, max]) .enter().append('text') .text(function (d) { return d; }) @@ -2408,17 +2408,17 @@ function generateGetBarPoints(barIndices, isSub) { var barTargetsNum = barIndices.__max__ + 1, barW = getBarW(xAxis, barTargetsNum), - x = getBarX(barW, barTargetsNum, barIndices, !!isSub), - y = getBarY(!!isSub), + barX = getBarX(barW, barTargetsNum, barIndices, !!isSub), + barY = getBarY(!!isSub), barOffset = getBarOffset(barIndices, !!isSub), yScale = isSub ? getSubYScale : getYScale; return function (d, i) { var y0 = yScale(d.id)(0), offset = barOffset(d, i) || y0, // offset is for stacked bar chart - posX = x(d), posY = y(d); + posX = barX(d), posY = barY(d); // fix posY not to overflow opposite quadrant if (__axis_rotated) { - if ((d.value > 0 && posY < offset) || (d.value < 0 && posY > offset)) { posY = offset; } + if ((0 < d.value && posY < y0) || (d.value < 0 && y0 < posY)) { posY = y0; } } // 4 points that make a bar return [ diff --git a/c3.min.js b/c3.min.js index b6f53b1..bf1e359 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.33"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",legendItemFocused:"c3-legend-item-focused",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;cQf&&(Qf=0),0>Sf&&(Sf=0),Rf=bh?Nf.left-Yi-Zi:Qf,Tf=bh?Sf:Vf-Of.top-Of.bottom,0>Rf&&(Rf=0),0>Tf&&(Tf=0),p(),Ti&&ee(yf.data.targets)&&(Pf.left=Qf/2+Xf)}function o(){gj.select("line."+f.xgridFocus).attr("x1",bh?0:-10).attr("x2",bh?Qf:-10).attr("y1",bh?-10:Nf.top).attr("y2",bh?-10:Sf)}function p(){Xf=Sf/2,Wf=.95*Xf,Yf=de(yf.data.targets)?.6*Wf:0}function q(){var a=bh?f.axisX:f.axisY,b=gj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=xf.select(Af).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Bf?Bf:x()}function s(){var a=Cf?Cf:y();return a>0?a:320}function t(){return ee(yf.data.targets)?0:Df?Df:bh?ch?v("x"):1:!uh||zh?1:v("y")}function u(){var a=1;return ee(yf.data.targets)?0:Ef?Ef:Ti?P()+(Dh&&!bh?v("y2"):a):Dh?Ih||bh?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||ch?"x"===a&&rh?rh:"y"!==a||uh?"y2"!==a||Dh?(jb(a).isInner?30:40)+("y2"===a?-10:0):$i:Xg&&!Ti?10:1:0}function x(){return+xf.select(Af).style("width").replace("px","")}function y(){return+xf.select(Af).style("height").replace("px","")}function z(a){return a?-5:-(Nf.left-1)}function A(a){return a?-20:-4}function B(){return z(!bh)}function C(){return A(!bh)}function D(){return z(bh)}function E(){return A(bh)}function F(a){return a?Qf+2+4:Nf.left+20}function G(a){return a?(rh?rh:0)+80:Sf+8}function H(){return F(!bh)}function I(){return G(!bh)}function J(){return F(bh)}function K(){return G(bh)}function L(){var a,b,c,d,e,f=Ac(yf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=jg(b.x)-jg(a.x),d=zc(),e=ae(yf.data.targets)?(d-(Bi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Ui=a}function N(a){Vi=a}function O(a){Wi=a}function P(){return Xg?Ti?Vi*(Ui+1):Uf:0}function Q(){return Xg?Ti?Vf:Wi*(Ui+1):0}function R(){var a,b,c=!jg;bg=bh?1:0,cg=bh?Sf:Qf,dg=bh?0:Sf,eg=bh?Qf:1,fg=bg,gg=cg,hg=bh?0:Tf,ig=bh?Rf:1,jg=T(bg,cg,c?void 0:jg.domain(),function(){return pg.tickOffset()}),kg=U(dg,eg,c?void 0:kg.domain()),lg=U(dg,eg,c?void 0:lg.domain()),mg=T(bg,cg,lj,function(a){return a%1?0:sg.tickOffset()}),ng=U(hg,ig,c?void 0:ng.domain()),og=U(hg,ig,c?void 0:og.domain()),a=$(),b=mh?mh:c?void 0:pg.tickValues(),pg=X(jg,Oi,a,b),sg=X(mg,Ri,a,b),qg=Y(kg,Pi,Ah,Ch),rg=Y(lg,Qi,Jh,Lh),c||(_i.scale(mg),Ff&&dj.scale(jg)),S()}function S(){Zf=Gb(),$f=Hb(),_f=Hb(.98)}function T(a,b,d,e){var f=(Ai?xf.time.scale():xf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Bi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=xf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?lg:kg}function W(a){return"y2"===Z(a)?og:ng}function X(a,b,c,d){var e=(Bi?Eb():xf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Bi?(e.tickCentered(gh),ve(ih)&&(ih=!1)):e.tickOffset=function(){var a=Bc(yf.data.targets),b=jg(a[1])-jg(a[0]);return b/zc()/2},Bi&&e.categories(fh),e}function Y(a,b,c,d){return xf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Ag?Ag[a]:"y"}function $(){var a=Ai?Li:Bi?Tc:function(a){return 0>a?a.toFixed(0):a};return hh&&("function"==typeof hh?a=hh:Ai&&(a=function(a){return a?Ki(hh)(a):""})),a}function _(a){var b;return"y"===a?b=yh:"y2"===a?b=Hh:"x"===a&&(b=th),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?yh=b:"y2"===a?Hh=b:"x"===a&&(th=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",bh?"inner-top":"inner-right")}function hb(){return fb("y",bh?"inner-right":"inner-top")}function ib(){return fb("y2",bh?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Qf/2:Qf:b.isBottom?-Sf:b.isMiddle?-Sf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!bh,gb())}function rb(){return nb(bh,hb())}function sb(){return nb(bh,ib())}function tb(){return ob(!bh,gb())}function ub(){return ob(bh,hb())}function vb(){return ob(bh,ib())}function wb(){var a=gb();return bh?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":rh?rh-10:"3em"}function xb(){var a=hb();return bh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return bh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!bh,gb())}function Ab(){return pb(bh,hb())}function Bb(){return pb(bh,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return xf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){gj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),gj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),gj.select("."+f.axisY2+" ."+f.axisY2Label).transition().attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 xf.min(Object.keys(i).map(function(a){return xf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(zg.length>0)for(g=Sc(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 xf.max(Object.keys(i).map(function(a){return xf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Fh:wh,n="y2"===c?Eh:vh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Gh:xh,r=ud()&&bh;return 0===l.length?"y2"===c?lg.domain():kg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(kg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Bh&&(f=b(Bh.top)?Bh.top:e,g=b(Bh.bottom)?Bh.bottom:e),"y2"===c&&Kh&&(f=b(Kh.top)?Kh.top:e,g=b(Kh.bottom)?Kh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return ph?Ai?re(ph):ph:xf.min(a,function(a){return xf.min(a.values,function(a){return a.x})})}function Zb(a){return oh?Ai?re(oh):oh:xf.max(a,function(a){return xf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Bi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof qh&&we(qh)?(e=b(qh.left)?qh.left:d,f=b(qh.right)?qh.right:d):e=f="number"==typeof qh?qh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=Ai?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Ai?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?kg:lg;return b="y"===a.axis||"y2"===a.axis?bh?Sf:"start"in a?d(a.start):Sf:bh?"end"in a?jg(Ai?re(a.end):a.end):Sf:Sf,c>b?0:b-c}function ic(a){return tg&&a===tg||we(ug)&&xe(ug,a)}function jc(a){return!ic(a)}function kc(a){return tg?tg:we(ug)?ug[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=yf.data.xs[b])}),c}function mc(a,b){return a in yf.data.xs&&yf.data.xs[a]&&yf.data.xs[a][b]?yf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){ug[b]=a[b]})}function oc(a){return 1===xf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=xg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),yf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=Ai?a?a instanceof Date?a:re(a):re(mc(c,d)):Ci&&!Bi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?yf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):tg?(d=Object.keys(yf.data.xs),yf.data.xs[c]=d.length>0?yf.data.xs[d[0]]:void 0):we(ug)&&(yf.data.xs[c]=lc(f,yf.data.targets)):yf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!yf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=wg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ci&&Bi&&0===c&&g&&(0===e&&(fh=[]),fh.push(g)),("undefined"==typeof a[b]||yf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Bg&&$d(Cc(c).filter(function(a){return!(a in Cg)}),Bg),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&yf.data.targets[0].values[a-1]?yf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(yf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Ai?new Date(i):i);j.push(e)}return Ai||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Mi=Mi.concat(a)}function Mc(a){Mi=Mi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Ni=Ni.concat(a)}function Oc(a){Ni=Ni.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return xf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Ld(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 Md(){return Eg&&"desc"===Eg.toLowerCase()}function Nd(){return Eg&&"asc"===Eg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Eg&&a.sort(Eg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(yf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&ni&&(jj.html(qi(a,$(),wd(k),Ji)).style("display","block"),d=jj.property("offsetWidth"),e=jj.property("offsetHeight"),k?(g=Qf/2+c[0],i=Sf/2+c[1]+20):(bh?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=jg(l[0].x)+20):(f=q(),g=f+t()+jg(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),jj.style("top",i+"px").style("left",g+"px"))}function Qd(){jj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});ni&&(be(yf.data.targets)||ee(yf.data.targets)||gj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(bh?"y1":"x1",Cd).attr(bh?"y2":"x2",Cd))}function Sd(){gj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?jg(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return"number"==typeof Zh?Zh:b?2*a.tickOffset()*$h/b:0}function $d(a,b){Dc(a).forEach(function(a){nj[a]=b===Cg[a],Cg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Cg[a.id]===b&&(c=!0),a.id in Cg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Cg)||"line"===Cg[b]||"spline"===Cg[b]||"area"===Cg[b]||"area-spline"===Cg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Cg[b]||"area-spline"===Cg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Cg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Cg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Cg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Cg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&hi||je(a)&&bi}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function re(b){var c;try{c=vg?xf.time.format(vg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+vg)}return c}function se(a,b){var c=xf.mouse(a),d=xf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?kg:lg,d=bh?1:0,e=bh?0:1;return Math.pow(jg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Qg(b,a.node()),gj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud).attr("stroke",function(){return Ji(b)}).attr("r",1.4*Je(b)).transition().duration(100).attr("r",Je)}function Be(a,b,c){Rg(b,a.node()),gj.select("."+f.selectedCircles+ld(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){Qg(b,a.node()),a.transition().duration(100).style("fill",function(){return xf.rgb(Ji(b)).darker(1)})}function Ee(a,b){Rg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ji(b)})}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){return Sh?"function"==typeof Th?Th(a):Th:0}function Ie(a){return Vh?Wh?Wh:1.75*He(a):He(a)}function Je(a){return Xh?Xh:4*He(a)}function Ke(a,c){return(c?gj.selectAll("."+f.circles+ld(c)):gj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Le(a,b){Ke(a,b).classed(f.EXPANDED,!0).attr("r",Ie)}function Me(a){Ke(a).filter(function(){return xf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",He)}function Ne(a){return gj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Oe(a){Ne(a).classed(f.EXPANDED,!0)}function Pe(a){Ne(a).classed(f.EXPANDED,!1)}function Qe(a,b){var c=Ue(a,b);return function(a,b){var d=c(a,b),e=bh?1:0,f=bh?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 Re(a,b){var c=Ue(a,!1),d=b?Se:Te;return function(a,b){return d(c(a,b),a,this)}}function Se(a,b){var c;return bh?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Te(a,b,c){var d=c.getBoundingClientRect();return bh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Ue(a,b){var c=a.__max__+1,d=Zd(pg,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return bh&&(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 Ve(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 We(b){var c,d,e;if(kj=xf.select(Af),kj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(kj.html("").classed("c3",!0),yf.data.xs={},yf.data.targets=vc(b),Ig&&Lc(Ig===!0?Cc(yf.data.targets):Ig),n(),R(),jg.domain(xf.extent(_b(yf.data.targets))),kg.domain(Xb(yf.data.targets,"y")),lg.domain(Xb(yf.data.targets,"y2")),mg.domain(jg.domain()),ng.domain(kg.domain()),og.domain(lg.domain()),lj=jg.domain(),_i.scale(mg),Ff&&dj.scale(jg),ej=kj.append("svg").attr("width",Qf+Nf.left+Nf.right).attr("height",Sf+Nf.top+Nf.bottom).on("mouseenter",If).on("mouseleave",Jf),fj=ej.append("defs"),fj.append("clipPath").attr("id",ui).append("rect").attr("width",Qf).attr("height",Sf),fj.append("clipPath").attr("id",vi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),fj.append("clipPath").attr("id",wi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),gj=ej.append("g").attr("transform",Si.main),hj=ej.append("g").attr("transform",Si.context),ij=ej.append("g").attr("transform",Si.legend),Ug||hj.style("visibility","hidden"),Xg||(ij.style("visibility","hidden"),Ni=Cc(yf.data.targets)),jj=xf.select(Af).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),sf(Cc(yf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=gj.append("g").attr("clip-path",xi).attr("class",f.grid),Mh&&d.append("g").attr("class",f.xgrids),we(Oh)&&d.append("g").attr("class",f.xgridLines),Uh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Ph&&d.append("g").attr("class",f.ygrids),we(Qh)&&d.append("g").attr("class",f.ygridLines),ch&&gj.append("g").attr("class",f.axisX).attr("clip-path",yi).attr("transform",Si.x).append("text").attr("class",f.axisXLabel).attr("transform",bh?"rotate(-90)":"").style("text-anchor",zb),uh&&gj.append("g").attr("class",f.axisY).attr("clip-path",zi).attr("transform",Si.y).append("text").attr("class",f.axisYLabel).attr("transform",bh?"":"rotate(-90)").style("text-anchor",Ab),Dh&&gj.append("g").attr("class",f.axisY2).attr("transform",Si.y2).append("text").attr("class",f.axisY2Label).attr("transform",bh?"":"rotate(-90)").style("text-anchor",Bb),gj.append("g").attr("clip-path",xi).attr("class",f.regions),gj.append("g").attr("clip-path",xi).attr("class",f.chart),c=gj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ff?bh?"ns-resize":"ew-resize":null),gj.select("."+f.chart).append("g").attr("class",f.chartBars),gj.select("."+f.chart).append("g").attr("class",f.chartLines),gj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Si.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),gj.select("."+f.chart).append("g").attr("class",f.chartTexts),Ff&&gj.insert("rect",Hf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Qf).attr("height",Sf).style("opacity",0).style("cursor",bh?"ns-resize":"ew-resize").call(dj).on("dblclick.zoom",null),sh&&_i.extent("function"!=typeof sh?sh:sh(_b())),hj.append("g").attr("clip-path",xi).attr("class",f.chart),hj.select("."+f.chart).append("g").attr("class",f.chartBars),hj.select("."+f.chart).append("g").attr("class",f.chartLines),hj.append("g").attr("clip-path",xi).attr("class",f.brush).call(_i).selectAll("rect").attr(bh?"width":"height",bh?Rf:Tf),hj.append("g").attr("class",f.axisX).attr("transform",Si.subx).attr("clip-path",bh?"":yi),hf(yf.data.targets),bh?gj.select("."+f.axisX).style("opacity",0).call(pg):(gj.select("."+f.axisY).style("opacity",0).call(qg),gj.select("."+f.axisY2).style("opacity",0).call(rg)),n(),R(),ff(),m(!1),bf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),ri){if(Ai&&"string"==typeof si){for(si=re(si),e=0;e0){d=[];for(var g in xg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(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 _e(a){ee(yf.data.targets)||Jg&&(Di=a,gj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ei=!0,Sg())}function af(){ee(yf.data.targets)||Jg&&(gj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),gj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ei=!1,Tg())}function bf(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Vd(),W=ee(yf.data.targets),X=Ic(yf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Mf:0,Q=D?P:0,R=E?P:0,c=gj.select("."+f.axisX).style("opacity",W?0:1),g=gj.select("."+f.axisY).style("opacity",W?0:1),h=gj.select("."+f.axisY2).style("opacity",W?0:1),e=hj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Xg&&sf(Cc(yf.data.targets),a,O),Bi&&(0!==X.length&&H&&G||jg.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(jg.domain(xf.extent(_b(X))),lj=jg.domain(),Ff&&dj.scale(jg).updateScaleExtent(),mg.domain(jg.domain()),_i.scale(mg)),G&&(jg.domain(_i.empty()?lj:_i.extent()),Ff&&dj.scale(jg).updateScaleExtent()),mh||!lh&&!kh||(S=Kc(Jc(X),kh),pg.tickValues(S),sg.tickValues(S))),kg.domain(Xb(X,"y")),lg.domain(Xb(X,"y2")),O.axisX.call(pg),O.axisY.call(qg),O.axisY2.call(rg),O.axisSubX.call(sg),G&&X.length)if(ih&&S){for(T=1;T=0&&xf.select(this).style("display",b%U?"none":"block")})}else xf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!bh&&nh&&eb(c,O.axisX,nh),J=Qe(V),M=Re(V,!0),N=Re(V,!1),Db(),ng.domain(kg.domain()),og.domain(lg.domain()),jj.style("display","none"),o(),gj.select("line."+f.xgridFocus).style("visibility","hidden"),Mh){if("year"===Nh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=jg.ticks(10);i=gj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",bh?0:function(a){return jg(a)-pg.tickOffset()}).attr("x2",bh?Qf:function(a){return jg(a)-pg.tickOffset()}).attr("y1",bh?function(a){return jg(a)-pg.tickOffset()}:Nf.top).attr("y2",bh?function(a){return jg(a)-pg.tickOffset()}:Sf).style("opacity",function(){return+xf.select(this).attr(bh?"y1":"x1")===(bh?Sf:0)?0:1}),i.exit().remove()}we(Oh)&&(k=gj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Oh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",bh?"":"rotate(-90)").attr("dx",bh?0:-Nf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",bh?0:Dd).attr("x2",bh?Qf:Dd).attr("y1",bh?Dd:Nf.top).attr("y2",bh?Dd:Sf).style("opacity",1),k.select("text").transition().duration(P).attr("x",bh?Qf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Ph&&(m=gj.select("."+f.ygrids).selectAll("."+f.ygrid).data(kg.ticks(Rh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",bh?kg:0).attr("x2",bh?kg:Qf).attr("y1",bh?0:kg).attr("y2",bh?Sf:kg),m.exit().remove()),A&&we(Qh)&&(n=gj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Qh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",bh?"rotate(-90)":"").attr("dx",bh?0:-Nf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",bh?Ed:0).attr("x2",bh?Ed:Qf).attr("y1",bh?0:Ed).attr("y2",bh?Sf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",bh?0:Qf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=gj.select("."+f.regions).selectAll("rect."+f.region).data(mi),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=gj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Ji(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=gj.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return bh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),gj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1),gj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",bj).style("opacity",mj),q=gj.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",He),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud),q.exit().remove(),gj.each(function(){Hi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=xf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Hi=!1}),gj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),gj.select("."+f.chartArcsTitle).style("opacity",de(yf.data.targets)?1:0),Ug&&(null!==xf.event&&"zoom"===xf.event.type&&_i.extent(jg.orgDomain()).update(),B&&(!bh&&nh&&eb(e,O.axisSubX,nh),_i.empty()||_i.extent(jg.orgDomain()).update(),K=Qe(V,!0),u=hj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Ji(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),hj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",cj).style("opacity",1))),gj.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),gj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud),v=gj.select("."+f.eventRects),we(ug)&&!oc(ug)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=gj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ye(w.enter()),w.attr("x",0).attr("y",0).attr("width",Qf).attr("height",Sf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ci&&!Bi?(z=function(a,b){var c=xc(b),d=yc(b),e=yf.data.xs[a.id][b];return(jg(d?d:e+50)-jg(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=yf.data.xs[a.id][b];return(jg(d)+jg(c?c:d-50))/2}):(z=L(),y=function(a){return jg(a.x)-z/2}),x=Ac(yf.data.targets),gj.select("."+f.eventRects).datum(x?x.values:[]),w=gj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Xe(w.enter()),w.attr("class",fd).attr("x",bh?0:y).attr("y",bh?y:0).attr("width",bh?Qf:z).attr("height",bh?z:Sf),w.exit().remove()),Cc(yf.data.targets).forEach(function(a){nj[a]=!0})}function cf(){bf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function df(){return"mousemove"===xf.event.sourceEvent.type&&dj.altDomain?(jg.domain(dj.altDomain),void dj.scale(jg).updateScaleExtent()):(Bi&&jg.orgDomain()[0]===lj[0]&&jg.domain([lj[0]-1e-10,jg.orgDomain()[1]]),bf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===xf.event.sourceEvent.type&&(Fi=!0)))}function ef(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function ff(){ej.attr("width",Uf).attr("height",Vf),ej.select("#"+ui).select("rect").attr("width",Qf).attr("height",Sf),ej.select("#"+vi).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),ej.select("#"+wi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej.select("."+f.zoomRect).attr("width",Qf).attr("height",Sf),kj.style("max-height",Vf+"px")}function gf(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),ff(),m(a.withTransition),bf(a)}function hf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=gj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Ji(a)}),e=gj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Lg(a)?"pointer":null}),c=gj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ji(a)}),b.append("path").attr("class",dd).style("opacity",function(){return mj=+xf.select(this).style("opacity"),0}).style("fill",function(a){return Ji(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Ji(a)}).style("cursor",function(a){return Lg(a)?"pointer":null}),a.forEach(function(a){gj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=gj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(ag(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Ji(a.data)}).style("cursor",function(a){return Lg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Hi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),of(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,xf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Hi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),pf(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Ug&&(n=hj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Ji(a)}),l=hj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ji(a)})),ej.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Mf).style("opacity",1)}function jf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),yf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Ti?j:i,l=Ti?Q():P();return d&&(w=0,C=0,t=0,u=0),Xg&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Ti?u:t,void(ah?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=ij.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,Ti?(g=function(a){return t*(.2+B[a])},j=function(a){return A[B[a]]+x[a]}):(g=function(a){return A[B[a]]+x[a]},j=function(a){return u*(.2+B[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=ij.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Zg?Zg(a):yf.toggle(a)}).on("mouseover",function(a){xf.select(this).classed(f.legendItemFocused,!0),Hi||yf.focus(a),"function"==typeof $g&&$g(a)}).on("mouseout",function(a){xf.select(this).classed(f.legendItemFocused,!1),Hi||yf.revert(),"function"==typeof _g&&_g(a)}),o.append("text").text(function(a){return d(xg[a])?xg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ti?h:-200).attr("y",Ti?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ti?i:-200).attr("y",Ti?-200:l).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Ji(a)}).attr("x",Ti?h:-200).attr("y",Ti?-200:j).attr("width",10).attr("height",10),ij.selectAll("text").data(a).text(function(a){return d(xg[a])?xg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),ij.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),ij.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),ij.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=xf.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?mf(b):nf(b):Xi}),N(t),O(u),M(C),n(),R(),ff(),m(q,c)}function tf(a){return Ec(yf.data.targets,a.id)}function uf(a){return"data"in a&&Ec(yf.data.targets,a.data.id)}function vf(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 wf(a,b,c){var d=!ee(yf.data.targets);Hi=!1,$d(a,b),gf(c||{withTransitionForAxis:d})}var xf=a.d3?a.d3:a.require?a.require("d3"):void 0,yf={data:{},axis:{},legend:{}},zf={},Af=h(["bindto"],"#chart"),Bf=h(["size","width"]),Cf=h(["size","height"]),Df=h(["padding","left"],50),Ef=h(["padding","right"]),Ff=h(["zoom","enabled"],!1),Gf=h(["zoom","extent"]),Hf=h(["zoom","privileged"],!1),If=h(["onenter"],function(){}),Jf=h(["onleave"],function(){}),Kf=h(["onresize"],function(){}),Lf=h(["onresized"],function(){}),Mf=h(["transition","duration"],350);g("data","data is required in config");var Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg=h(["data","x"]),ug=h(["data","xs"],{}),vg=h(["data","x_format"]),wg=h(["data","id_converter"],function(a){return a}),xg=h(["data","names"],{}),yg=h(["data","classes"],{}),zg=h(["data","groups"],[]),Ag=h(["data","axes"],{}),Bg=h(["data","type"]),Cg=h(["data","types"],{}),Dg=h(["data","labels"],{}),Eg=h(["data","order"]),Fg=h(["data","regions"],{}),Gg=h(["data","color"]),Hg=h(["data","colors"],{}),Ig=h(["data","hide"],!1),Jg=h(["data","selection","enabled"],!1),Kg=h(["data","selection","grouped"],!1),Lg=h(["data","selection","isselectable"],function(){return!0}),Mg=h(["data","selection","multiple"],!0),Ng=h(["data","onclick"],function(){}),Og=h(["data","onenter"],function(){}),Pg=h(["data","onleave"],function(){}),Qg=h(["data","onselected"],function(){}),Rg=h(["data","onunselected"],function(){}),Sg=h(["data","ondragstart"],function(){}),Tg=h(["data","ondragend"],function(){}),Ug=h(["subchart","show"],!1),Vg=h(["subchart","size","height"],60),Wg=h(["color","pattern"],[]),Xg=h(["legend","show"],!0),Yg=h(["legend","position"],"bottom"),Zg=h(["legend","item","onclick"]),$g=h(["legend","item","onmouseover"]),_g=h(["legend","item","onmouseout"]),ah=h(["legend","equally"],!1),bh=h(["axis","rotated"],!1),ch=h(["axis","x","show"],!0),dh=h(["axis","x","type"],"indexed"),eh=h(["axis","x","localtime"],!0),fh=h(["axis","x","categories"],[]),gh=h(["axis","x","tick","centered"],!1),hh=h(["axis","x","tick","format"]),ih=h(["axis","x","tick","culling"],{}),jh=h(["axis","x","tick","culling","max"],10),kh=h(["axis","x","tick","count"]),lh=h(["axis","x","tick","fit"],!0),mh=h(["axis","x","tick","values"],null),nh=h(["axis","x","tick","rotate"]),oh=h(["axis","x","max"],null),ph=h(["axis","x","min"],null),qh=h(["axis","x","padding"],{}),rh=h(["axis","x","height"]),sh=h(["axis","x","default"]),th=h(["axis","x","label"],{}),uh=h(["axis","y","show"],!0),vh=h(["axis","y","max"]),wh=h(["axis","y","min"]),xh=h(["axis","y","center"]),yh=h(["axis","y","label"],{}),zh=h(["axis","y","inner"],!1),Ah=h(["axis","y","tick","format"]),Bh=h(["axis","y","padding"],{}),Ch=h(["axis","y","ticks"],10),Dh=h(["axis","y2","show"],!1),Eh=h(["axis","y2","max"]),Fh=h(["axis","y2","min"]),Gh=h(["axis","y2","center"]),Hh=h(["axis","y2","label"],{}),Ih=h(["axis","y2","inner"],!1),Jh=h(["axis","y2","tick","format"]),Kh=h(["axis","y2","padding"],{}),Lh=h(["axis","y2","ticks"],10),Mh=h(["grid","x","show"],!1),Nh=h(["grid","x","type"],"tick"),Oh=h(["grid","x","lines"],[]),Ph=h(["grid","y","show"],!1),Qh=h(["grid","y","lines"],[]),Rh=h(["grid","y","ticks"],10),Sh=h(["point","show"],!0),Th=h(["point","r"],2.5),Uh=h(["point","focus","line","enabled"],!0),Vh=h(["point","focus","expand","enabled"],!0),Wh=h(["point","focus","expand","r"]),Xh=h(["point","focus","select","r"]),Yh=h(["line","connect_null"],!1),Zh=h(["bar","width"]),$h=h(["bar","width","ratio"],.6),_h=h(["pie","label","show"],!0),ai=h(["pie","label","format"]),bi=h(["pie","expand"],!0),ci=h(["pie","onclick"],function(){}),di=h(["pie","onmouseover"],function(){}),ei=h(["pie","onmouseout"],function(){}),fi=h(["donut","label","show"],!0),gi=h(["donut","label","format"]),hi=h(["donut","expand"],!0),ii=h(["donut","title"],""),ji=h(["donut","onclick"],function(){}),ki=h(["donut","onmouseover"],function(){}),li=h(["donut","onmouseout"],function(){}),mi=h(["regions"],[]),ni=h(["tooltip","show"],!0),oi=h(["tooltip","format","title"]),pi=h(["tooltip","format","value"]),qi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=oi?oi:b,l=pi?pi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id,a[g].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),ri=h(["tooltip","init","show"],!1),si=h(["tooltip","init","x"],0),ti=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ui=("string"==typeof Af?Af.replace("#",""):Af.id)+"-clip",vi=ui+"-xaxis",wi=ui+"-yaxis",xi=i(ui),yi=i(vi),zi=i(wi),Ai="timeseries"===dh,Bi="categorized"===dh,Ci=!Ai&&(tg||we(ug)),Di=null,Ei=!1,Fi=!1,Gi=!1,Hi=!1,Ii=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ji=qe(Hg,we(Wg)?Wg:Ii,Gg),Ki=eh?xf.time.format:xf.time.format.utc,Li=function(){var a=[[Ki("%Y/%-m/%-d"),function(){return!0}],[Ki("%-m/%-d"),function(a){return a.getMonth()}],[Ki("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ki("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ki("%I %p"),function(a){return a.getHours()}],[Ki("%I:%M"),function(a){return a.getMinutes()}],[Ki(":%S"),function(a){return a.getSeconds()}],[Ki(".%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)}}(),Mi=[],Ni=[],Oi=bh?"left":"bottom",Pi=bh?zh?"top":"bottom":zh?"right":"left",Qi=bh?Ih?"bottom":"top":Ih?"left":"right",Ri=bh?"left":"bottom",Si={main:function(){return"translate("+Nf.left+","+Nf.top+")"},context:function(){return"translate("+Of.left+","+Of.top+")"},legend:function(){return"translate("+Pf.left+","+Pf.top+")"},x:function(){return"translate(0,"+(bh?0:Sf)+")"},y:function(){return"translate(0,"+(bh?Sf:0)+")"},y2:function(){return"translate("+(bh?0:Qf)+","+(bh?1:0)+")"},subx:function(){return"translate(0,"+(bh?0:Tf)+")"},arc:function(){return"translate("+Qf/2+","+Sf/2+")"}},Ti="right"===Yg,Ui=0,Vi=0,Wi=0,Xi=.15,Yi=30,Zi=bh&&!ch?0:30,$i=5;ag=xf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var _i,aj=function(){var a=xf.svg.line().x(bh?function(a){return V(a.id)(a.value)}:Cd).y(bh?Cd:function(a){return V(a.id)(a.value)});return Yh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Yh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Fg[b.id]?Ve(e,jg,V(b.id),Fg[b.id]):a(e)):(c=e[0]?jg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,bh?"M "+d+" "+c:"M "+c+" "+d)}}(),bj=function(){var a;return a=bh?xf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):xf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?jg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,bh?"M "+d+" "+c:"M "+c+" "+d)}}(),cj=function(){var a=xf.svg.line().x(bh?function(a){return W(a.id)(a.value)}:Fd).y(bh?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+mg(c[0].x)+" "+W(b.id)(c[0].value)}}(),dj=function(){};_i=xf.svg.brush().on("brush",cf),_i.update=function(){return hj&&hj.select("."+f.brush).call(this),this},_i.scale=function(a){return bh?this.y(a):this.x(a)},Ff&&(dj=xf.behavior.zoom().on("zoomstart",function(){dj.altDomain=xf.event.sourceEvent.altKey?jg.orgDomain():null}).on("zoom",Ff?df:null),dj.scale=function(a){return bh?this.y(a):this.x(a)},dj.orgScaleExtent=function(){var a=Gf?Gf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},dj.updateScaleExtent=function(){var a=ac(jg.orgDomain())/ac(lj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var ej,fj,gj,hj,ij,jj,kj,lj,mj,nj={};if(yf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);yf.revert(),yf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(yf.data.targets)&&Nb(a,!0),of(a,!0)},yf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);yf.revert(),b(d.classed(f.focused,!1)),b(e),ee(yf.data.targets)&&Ob(a),of(a,!1)},yf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);b(d.classed(f.focused,!1)),b(e),ee(yf.data.targets)&&Ob(a),pf()},yf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),ej.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&qf(a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},yf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),ej.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&rf(a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},yf.toggle=function(a){Gc(a)?yf.hide(a):yf.show(a)},yf.unzoom=function(){_i.clear().update(),bf({withUpdateXDomain:!0})},yf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){yg[b]=a.classes[b]}),"categories"in a&&Bi&&(fh=a.categories,pg.categories(fh)),"cacheIds"in a&&bc(a.cacheIds)?void jf(dc(a.cacheIds),a.done):void("unload"in a?lf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){kf(a)}):kf(a))},yf.unload=function(a,b){lf(Dc(a),function(){bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},yf.selected=function(a){return xf.merge(gj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return xf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},yf.select=function(a,b,c){Jg&&gj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=xf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Kg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Lg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},yf.unselect=function(a,b){Jg&&gj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=xf.select(this),g="circle"===this.nodeName?Be:Ee,h=Kg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Lg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},yf.toLine=function(a){wf(a,"line")},yf.toSpline=function(a){wf(a,"spline")},yf.toBar=function(a){wf(a,"bar")},yf.toScatter=function(a){wf(a,"scatter")},yf.toArea=function(a){wf(a,"area")},yf.toAreaSpline=function(a){wf(a,"area-spline") +!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.33"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",legendItemFocused:"c3-legend-item-focused",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;cQf&&(Qf=0),0>Sf&&(Sf=0),Rf=bh?Nf.left-Yi-Zi:Qf,Tf=bh?Sf:Vf-Of.top-Of.bottom,0>Rf&&(Rf=0),0>Tf&&(Tf=0),p(),Ti&&ee(yf.data.targets)&&(Pf.left=Qf/2+Xf)}function o(){gj.select("line."+f.xgridFocus).attr("x1",bh?0:-10).attr("x2",bh?Qf:-10).attr("y1",bh?-10:Nf.top).attr("y2",bh?-10:Sf)}function p(){Xf=Sf/2,Wf=.95*Xf,Yf=de(yf.data.targets)?.6*Wf:0}function q(){var a=bh?f.axisX:f.axisY,b=gj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=xf.select(Af).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Bf?Bf:x()}function s(){var a=Cf?Cf:y();return a>0?a:320}function t(){return ee(yf.data.targets)?0:Df?Df:bh?ch?v("x"):1:!uh||zh?1:v("y")}function u(){var a=1;return ee(yf.data.targets)?0:Ef?Ef:Ti?P()+(Dh&&!bh?v("y2"):a):Dh?Ih||bh?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||ch?"x"===a&&rh?rh:"y"!==a||uh?"y2"!==a||Dh?(jb(a).isInner?30:40)+("y2"===a?-10:0):$i:Xg&&!Ti?10:1:0}function x(){return+xf.select(Af).style("width").replace("px","")}function y(){return+xf.select(Af).style("height").replace("px","")}function z(a){return a?-5:-(Nf.left-1)}function A(a){return a?-20:-4}function B(){return z(!bh)}function C(){return A(!bh)}function D(){return z(bh)}function E(){return A(bh)}function F(a){return a?Qf+2+4:Nf.left+20}function G(a){return a?(rh?rh:0)+80:Sf+8}function H(){return F(!bh)}function I(){return G(!bh)}function J(){return F(bh)}function K(){return G(bh)}function L(){var a,b,c,d,e,f=Ac(yf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=jg(b.x)-jg(a.x),d=zc(),e=ae(yf.data.targets)?(d-(Bi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Ui=a}function N(a){Vi=a}function O(a){Wi=a}function P(){return Xg?Ti?Vi*(Ui+1):Uf:0}function Q(){return Xg?Ti?Vf:Wi*(Ui+1):0}function R(){var a,b,c=!jg;bg=bh?1:0,cg=bh?Sf:Qf,dg=bh?0:Sf,eg=bh?Qf:1,fg=bg,gg=cg,hg=bh?0:Tf,ig=bh?Rf:1,jg=T(bg,cg,c?void 0:jg.domain(),function(){return pg.tickOffset()}),kg=U(dg,eg,c?void 0:kg.domain()),lg=U(dg,eg,c?void 0:lg.domain()),mg=T(bg,cg,lj,function(a){return a%1?0:sg.tickOffset()}),ng=U(hg,ig,c?void 0:ng.domain()),og=U(hg,ig,c?void 0:og.domain()),a=$(),b=mh?mh:c?void 0:pg.tickValues(),pg=X(jg,Oi,a,b),sg=X(mg,Ri,a,b),qg=Y(kg,Pi,Ah,Ch),rg=Y(lg,Qi,Jh,Lh),c||(_i.scale(mg),Ff&&dj.scale(jg)),S()}function S(){Zf=Gb(),$f=Hb(),_f=Hb(.98)}function T(a,b,d,e){var f=(Ai?xf.time.scale():xf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Bi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=xf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?lg:kg}function W(a){return"y2"===Z(a)?og:ng}function X(a,b,c,d){var e=(Bi?Eb():xf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Bi?(e.tickCentered(gh),ve(ih)&&(ih=!1)):e.tickOffset=function(){var a=Bc(yf.data.targets),b=jg(a[1])-jg(a[0]);return b/zc()/2},Bi&&e.categories(fh),e}function Y(a,b,c,d){return xf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Ag?Ag[a]:"y"}function $(){var a=Ai?Li:Bi?Tc:function(a){return 0>a?a.toFixed(0):a};return hh&&("function"==typeof hh?a=hh:Ai&&(a=function(a){return a?Ki(hh)(a):""})),a}function _(a){var b;return"y"===a?b=yh:"y2"===a?b=Hh:"x"===a&&(b=th),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?yh=b:"y2"===a?Hh=b:"x"===a&&(th=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",bh?"inner-top":"inner-right")}function hb(){return fb("y",bh?"inner-right":"inner-top")}function ib(){return fb("y2",bh?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Qf/2:Qf:b.isBottom?-Sf:b.isMiddle?-Sf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!bh,gb())}function rb(){return nb(bh,hb())}function sb(){return nb(bh,ib())}function tb(){return ob(!bh,gb())}function ub(){return ob(bh,hb())}function vb(){return ob(bh,ib())}function wb(){var a=gb();return bh?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":rh?rh-10:"3em"}function xb(){var a=hb();return bh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return bh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!bh,gb())}function Ab(){return pb(bh,hb())}function Bb(){return pb(bh,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return xf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){gj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),gj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),gj.select("."+f.axisY2+" ."+f.axisY2Label).transition().attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 xf.min(Object.keys(i).map(function(a){return xf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(zg.length>0)for(g=Sc(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 xf.max(Object.keys(i).map(function(a){return xf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Fh:wh,n="y2"===c?Eh:vh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Gh:xh,r=ud()&&bh;return 0===l.length?"y2"===c?lg.domain():kg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(kg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Bh&&(f=b(Bh.top)?Bh.top:e,g=b(Bh.bottom)?Bh.bottom:e),"y2"===c&&Kh&&(f=b(Kh.top)?Kh.top:e,g=b(Kh.bottom)?Kh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return ph?Ai?re(ph):ph:xf.min(a,function(a){return xf.min(a.values,function(a){return a.x})})}function Zb(a){return oh?Ai?re(oh):oh:xf.max(a,function(a){return xf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Bi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof qh&&we(qh)?(e=b(qh.left)?qh.left:d,f=b(qh.right)?qh.right:d):e=f="number"==typeof qh?qh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=Ai?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Ai?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?kg:lg;return b="y"===a.axis||"y2"===a.axis?bh?Sf:"start"in a?d(a.start):Sf:bh?"end"in a?jg(Ai?re(a.end):a.end):Sf:Sf,c>b?0:b-c}function ic(a){return tg&&a===tg||we(ug)&&xe(ug,a)}function jc(a){return!ic(a)}function kc(a){return tg?tg:we(ug)?ug[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=yf.data.xs[b])}),c}function mc(a,b){return a in yf.data.xs&&yf.data.xs[a]&&yf.data.xs[a][b]?yf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){ug[b]=a[b]})}function oc(a){return 1===xf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=xg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),yf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=Ai?a?a instanceof Date?a:re(a):re(mc(c,d)):Ci&&!Bi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?yf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):tg?(d=Object.keys(yf.data.xs),yf.data.xs[c]=d.length>0?yf.data.xs[d[0]]:void 0):we(ug)&&(yf.data.xs[c]=lc(f,yf.data.targets)):yf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!yf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=wg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ci&&Bi&&0===c&&g&&(0===e&&(fh=[]),fh.push(g)),("undefined"==typeof a[b]||yf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Bg&&$d(Cc(c).filter(function(a){return!(a in Cg)}),Bg),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&yf.data.targets[0].values[a-1]?yf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(yf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Ai?new Date(i):i);j.push(e)}return Ai||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Mi=Mi.concat(a)}function Mc(a){Mi=Mi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Ni=Ni.concat(a)}function Oc(a){Ni=Ni.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return xf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Ld(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 Md(){return Eg&&"desc"===Eg.toLowerCase()}function Nd(){return Eg&&"asc"===Eg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Eg&&a.sort(Eg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(yf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&ni&&(jj.html(qi(a,$(),wd(k),Ji)).style("display","block"),d=jj.property("offsetWidth"),e=jj.property("offsetHeight"),k?(g=Qf/2+c[0],i=Sf/2+c[1]+20):(bh?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=jg(l[0].x)+20):(f=q(),g=f+t()+jg(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),jj.style("top",i+"px").style("left",g+"px"))}function Qd(){jj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});ni&&(be(yf.data.targets)||ee(yf.data.targets)||gj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(bh?"y1":"x1",Cd).attr(bh?"y2":"x2",Cd))}function Sd(){gj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?jg(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return"number"==typeof Zh?Zh:b?2*a.tickOffset()*$h/b:0}function $d(a,b){Dc(a).forEach(function(a){nj[a]=b===Cg[a],Cg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Cg[a.id]===b&&(c=!0),a.id in Cg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Cg)||"line"===Cg[b]||"spline"===Cg[b]||"area"===Cg[b]||"area-spline"===Cg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Cg[b]||"area-spline"===Cg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Cg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Cg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Cg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Cg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&hi||je(a)&&bi}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function re(b){var c;try{c=vg?xf.time.format(vg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+vg)}return c}function se(a,b){var c=xf.mouse(a),d=xf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?kg:lg,d=bh?1:0,e=bh?0:1;return Math.pow(jg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Qg(b,a.node()),gj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud).attr("stroke",function(){return Ji(b)}).attr("r",1.4*Je(b)).transition().duration(100).attr("r",Je)}function Be(a,b,c){Rg(b,a.node()),gj.select("."+f.selectedCircles+ld(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){Qg(b,a.node()),a.transition().duration(100).style("fill",function(){return xf.rgb(Ji(b)).darker(1)})}function Ee(a,b){Rg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ji(b)})}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){return Sh?"function"==typeof Th?Th(a):Th:0}function Ie(a){return Vh?Wh?Wh:1.75*He(a):He(a)}function Je(a){return Xh?Xh:4*He(a)}function Ke(a,c){return(c?gj.selectAll("."+f.circles+ld(c)):gj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Le(a,b){Ke(a,b).classed(f.EXPANDED,!0).attr("r",Ie)}function Me(a){Ke(a).filter(function(){return xf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",He)}function Ne(a){return gj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Oe(a){Ne(a).classed(f.EXPANDED,!0)}function Pe(a){Ne(a).classed(f.EXPANDED,!1)}function Qe(a,b){var c=Ue(a,b);return function(a,b){var d=c(a,b),e=bh?1:0,f=bh?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 Re(a,b){var c=Ue(a,!1),d=b?Se:Te;return function(a,b){return d(c(a,b),a,this)}}function Se(a,b){var c;return bh?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Te(a,b,c){var d=c.getBoundingClientRect();return bh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Ue(a,b){var c=a.__max__+1,d=Zd(pg,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return bh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Ve(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 We(b){var c,d,e;if(kj=xf.select(Af),kj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(kj.html("").classed("c3",!0),yf.data.xs={},yf.data.targets=vc(b),Ig&&Lc(Ig===!0?Cc(yf.data.targets):Ig),n(),R(),jg.domain(xf.extent(_b(yf.data.targets))),kg.domain(Xb(yf.data.targets,"y")),lg.domain(Xb(yf.data.targets,"y2")),mg.domain(jg.domain()),ng.domain(kg.domain()),og.domain(lg.domain()),lj=jg.domain(),_i.scale(mg),Ff&&dj.scale(jg),ej=kj.append("svg").attr("width",Qf+Nf.left+Nf.right).attr("height",Sf+Nf.top+Nf.bottom).on("mouseenter",If).on("mouseleave",Jf),fj=ej.append("defs"),fj.append("clipPath").attr("id",ui).append("rect").attr("width",Qf).attr("height",Sf),fj.append("clipPath").attr("id",vi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),fj.append("clipPath").attr("id",wi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),gj=ej.append("g").attr("transform",Si.main),hj=ej.append("g").attr("transform",Si.context),ij=ej.append("g").attr("transform",Si.legend),Ug||hj.style("visibility","hidden"),Xg||(ij.style("visibility","hidden"),Ni=Cc(yf.data.targets)),jj=xf.select(Af).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),sf(Cc(yf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=gj.append("g").attr("clip-path",xi).attr("class",f.grid),Mh&&d.append("g").attr("class",f.xgrids),we(Oh)&&d.append("g").attr("class",f.xgridLines),Uh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Ph&&d.append("g").attr("class",f.ygrids),we(Qh)&&d.append("g").attr("class",f.ygridLines),ch&&gj.append("g").attr("class",f.axisX).attr("clip-path",yi).attr("transform",Si.x).append("text").attr("class",f.axisXLabel).attr("transform",bh?"rotate(-90)":"").style("text-anchor",zb),uh&&gj.append("g").attr("class",f.axisY).attr("clip-path",zi).attr("transform",Si.y).append("text").attr("class",f.axisYLabel).attr("transform",bh?"":"rotate(-90)").style("text-anchor",Ab),Dh&&gj.append("g").attr("class",f.axisY2).attr("transform",Si.y2).append("text").attr("class",f.axisY2Label).attr("transform",bh?"":"rotate(-90)").style("text-anchor",Bb),gj.append("g").attr("clip-path",xi).attr("class",f.regions),gj.append("g").attr("clip-path",xi).attr("class",f.chart),c=gj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ff?bh?"ns-resize":"ew-resize":null),gj.select("."+f.chart).append("g").attr("class",f.chartBars),gj.select("."+f.chart).append("g").attr("class",f.chartLines),gj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Si.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),gj.select("."+f.chart).append("g").attr("class",f.chartTexts),Ff&&gj.insert("rect",Hf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Qf).attr("height",Sf).style("opacity",0).style("cursor",bh?"ns-resize":"ew-resize").call(dj).on("dblclick.zoom",null),sh&&_i.extent("function"!=typeof sh?sh:sh(_b())),hj.append("g").attr("clip-path",xi).attr("class",f.chart),hj.select("."+f.chart).append("g").attr("class",f.chartBars),hj.select("."+f.chart).append("g").attr("class",f.chartLines),hj.append("g").attr("clip-path",xi).attr("class",f.brush).call(_i).selectAll("rect").attr(bh?"width":"height",bh?Rf:Tf),hj.append("g").attr("class",f.axisX).attr("transform",Si.subx).attr("clip-path",bh?"":yi),hf(yf.data.targets),bh?gj.select("."+f.axisX).style("opacity",0).call(pg):(gj.select("."+f.axisY).style("opacity",0).call(qg),gj.select("."+f.axisY2).style("opacity",0).call(rg)),n(),R(),ff(),m(!1),bf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),ri){if(Ai&&"string"==typeof si){for(si=re(si),e=0;e0){d=[];for(var g in xg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(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 _e(a){ee(yf.data.targets)||Jg&&(Di=a,gj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ei=!0,Sg())}function af(){ee(yf.data.targets)||Jg&&(gj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),gj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ei=!1,Tg())}function bf(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Vd(),W=ee(yf.data.targets),X=Ic(yf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Mf:0,Q=D?P:0,R=E?P:0,c=gj.select("."+f.axisX).style("opacity",W?0:1),g=gj.select("."+f.axisY).style("opacity",W?0:1),h=gj.select("."+f.axisY2).style("opacity",W?0:1),e=hj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Xg&&sf(Cc(yf.data.targets),a,O),Bi&&(0!==X.length&&H&&G||jg.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(jg.domain(xf.extent(_b(X))),lj=jg.domain(),Ff&&dj.scale(jg).updateScaleExtent(),mg.domain(jg.domain()),_i.scale(mg)),G&&(jg.domain(_i.empty()?lj:_i.extent()),Ff&&dj.scale(jg).updateScaleExtent()),mh||!lh&&!kh||(S=Kc(Jc(X),kh),pg.tickValues(S),sg.tickValues(S))),kg.domain(Xb(X,"y")),lg.domain(Xb(X,"y2")),O.axisX.call(pg),O.axisY.call(qg),O.axisY2.call(rg),O.axisSubX.call(sg),G&&X.length)if(ih&&S){for(T=1;T=0&&xf.select(this).style("display",b%U?"none":"block")})}else xf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!bh&&nh&&eb(c,O.axisX,nh),J=Qe(V),M=Re(V,!0),N=Re(V,!1),Db(),ng.domain(kg.domain()),og.domain(lg.domain()),jj.style("display","none"),o(),gj.select("line."+f.xgridFocus).style("visibility","hidden"),Mh){if("year"===Nh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=jg.ticks(10);i=gj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",bh?0:function(a){return jg(a)-pg.tickOffset()}).attr("x2",bh?Qf:function(a){return jg(a)-pg.tickOffset()}).attr("y1",bh?function(a){return jg(a)-pg.tickOffset()}:Nf.top).attr("y2",bh?function(a){return jg(a)-pg.tickOffset()}:Sf).style("opacity",function(){return+xf.select(this).attr(bh?"y1":"x1")===(bh?Sf:0)?0:1}),i.exit().remove()}we(Oh)&&(k=gj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Oh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",bh?"":"rotate(-90)").attr("dx",bh?0:-Nf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",bh?0:Dd).attr("x2",bh?Qf:Dd).attr("y1",bh?Dd:Nf.top).attr("y2",bh?Dd:Sf).style("opacity",1),k.select("text").transition().duration(P).attr("x",bh?Qf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Ph&&(m=gj.select("."+f.ygrids).selectAll("."+f.ygrid).data(kg.ticks(Rh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",bh?kg:0).attr("x2",bh?kg:Qf).attr("y1",bh?0:kg).attr("y2",bh?Sf:kg),m.exit().remove()),A&&we(Qh)&&(n=gj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Qh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",bh?"rotate(-90)":"").attr("dx",bh?0:-Nf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",bh?Ed:0).attr("x2",bh?Ed:Qf).attr("y1",bh?0:Ed).attr("y2",bh?Sf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",bh?0:Qf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=gj.select("."+f.regions).selectAll("rect."+f.region).data(mi),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=gj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Ji(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=gj.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return bh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),gj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1),gj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",bj).style("opacity",mj),q=gj.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",He),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud),q.exit().remove(),gj.each(function(){Hi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=xf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Hi=!1}),gj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),gj.select("."+f.chartArcsTitle).style("opacity",de(yf.data.targets)?1:0),Ug&&(null!==xf.event&&"zoom"===xf.event.type&&_i.extent(jg.orgDomain()).update(),B&&(!bh&&nh&&eb(e,O.axisSubX,nh),_i.empty()||_i.extent(jg.orgDomain()).update(),K=Qe(V,!0),u=hj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Ji(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),hj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",cj).style("opacity",1))),gj.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),gj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud),v=gj.select("."+f.eventRects),we(ug)&&!oc(ug)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=gj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ye(w.enter()),w.attr("x",0).attr("y",0).attr("width",Qf).attr("height",Sf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ci&&!Bi?(z=function(a,b){var c=xc(b),d=yc(b),e=yf.data.xs[a.id][b];return(jg(d?d:e+50)-jg(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=yf.data.xs[a.id][b];return(jg(d)+jg(c?c:d-50))/2}):(z=L(),y=function(a){return jg(a.x)-z/2}),x=Ac(yf.data.targets),gj.select("."+f.eventRects).datum(x?x.values:[]),w=gj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Xe(w.enter()),w.attr("class",fd).attr("x",bh?0:y).attr("y",bh?y:0).attr("width",bh?Qf:z).attr("height",bh?z:Sf),w.exit().remove()),Cc(yf.data.targets).forEach(function(a){nj[a]=!0})}function cf(){bf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function df(){return"mousemove"===xf.event.sourceEvent.type&&dj.altDomain?(jg.domain(dj.altDomain),void dj.scale(jg).updateScaleExtent()):(Bi&&jg.orgDomain()[0]===lj[0]&&jg.domain([lj[0]-1e-10,jg.orgDomain()[1]]),bf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===xf.event.sourceEvent.type&&(Fi=!0)))}function ef(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function ff(){ej.attr("width",Uf).attr("height",Vf),ej.select("#"+ui).select("rect").attr("width",Qf).attr("height",Sf),ej.select("#"+vi).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),ej.select("#"+wi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej.select("."+f.zoomRect).attr("width",Qf).attr("height",Sf),kj.style("max-height",Vf+"px")}function gf(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),ff(),m(a.withTransition),bf(a)}function hf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=gj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Ji(a)}),e=gj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Lg(a)?"pointer":null}),c=gj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ji(a)}),b.append("path").attr("class",dd).style("opacity",function(){return mj=+xf.select(this).style("opacity"),0}).style("fill",function(a){return Ji(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Ji(a)}).style("cursor",function(a){return Lg(a)?"pointer":null}),a.forEach(function(a){gj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=gj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(ag(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Ji(a.data)}).style("cursor",function(a){return Lg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Hi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),of(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,xf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Hi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),pf(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Ug&&(n=hj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Ji(a)}),l=hj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ji(a)})),ej.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Mf).style("opacity",1)}function jf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),yf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Ti?j:i,l=Ti?Q():P();return d&&(w=0,C=0,t=0,u=0),Xg&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Ti?u:t,void(ah?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=ij.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,Ti?(g=function(a){return t*(.2+B[a])},j=function(a){return A[B[a]]+x[a]}):(g=function(a){return A[B[a]]+x[a]},j=function(a){return u*(.2+B[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=ij.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Zg?Zg(a):yf.toggle(a)}).on("mouseover",function(a){xf.select(this).classed(f.legendItemFocused,!0),Hi||yf.focus(a),"function"==typeof $g&&$g(a)}).on("mouseout",function(a){xf.select(this).classed(f.legendItemFocused,!1),Hi||yf.revert(),"function"==typeof _g&&_g(a)}),o.append("text").text(function(a){return d(xg[a])?xg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ti?h:-200).attr("y",Ti?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ti?i:-200).attr("y",Ti?-200:l).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Ji(a)}).attr("x",Ti?h:-200).attr("y",Ti?-200:j).attr("width",10).attr("height",10),ij.selectAll("text").data(a).text(function(a){return d(xg[a])?xg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),ij.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),ij.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),ij.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=xf.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?mf(b):nf(b):Xi}),N(t),O(u),M(C),n(),R(),ff(),m(q,c)}function tf(a){return Ec(yf.data.targets,a.id)}function uf(a){return"data"in a&&Ec(yf.data.targets,a.data.id)}function vf(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 wf(a,b,c){var d=!ee(yf.data.targets);Hi=!1,$d(a,b),gf(c||{withTransitionForAxis:d})}var xf=a.d3?a.d3:a.require?a.require("d3"):void 0,yf={data:{},axis:{},legend:{}},zf={},Af=h(["bindto"],"#chart"),Bf=h(["size","width"]),Cf=h(["size","height"]),Df=h(["padding","left"],50),Ef=h(["padding","right"]),Ff=h(["zoom","enabled"],!1),Gf=h(["zoom","extent"]),Hf=h(["zoom","privileged"],!1),If=h(["onenter"],function(){}),Jf=h(["onleave"],function(){}),Kf=h(["onresize"],function(){}),Lf=h(["onresized"],function(){}),Mf=h(["transition","duration"],350);g("data","data is required in config");var Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg=h(["data","x"]),ug=h(["data","xs"],{}),vg=h(["data","x_format"]),wg=h(["data","id_converter"],function(a){return a}),xg=h(["data","names"],{}),yg=h(["data","classes"],{}),zg=h(["data","groups"],[]),Ag=h(["data","axes"],{}),Bg=h(["data","type"]),Cg=h(["data","types"],{}),Dg=h(["data","labels"],{}),Eg=h(["data","order"]),Fg=h(["data","regions"],{}),Gg=h(["data","color"]),Hg=h(["data","colors"],{}),Ig=h(["data","hide"],!1),Jg=h(["data","selection","enabled"],!1),Kg=h(["data","selection","grouped"],!1),Lg=h(["data","selection","isselectable"],function(){return!0}),Mg=h(["data","selection","multiple"],!0),Ng=h(["data","onclick"],function(){}),Og=h(["data","onenter"],function(){}),Pg=h(["data","onleave"],function(){}),Qg=h(["data","onselected"],function(){}),Rg=h(["data","onunselected"],function(){}),Sg=h(["data","ondragstart"],function(){}),Tg=h(["data","ondragend"],function(){}),Ug=h(["subchart","show"],!1),Vg=h(["subchart","size","height"],60),Wg=h(["color","pattern"],[]),Xg=h(["legend","show"],!0),Yg=h(["legend","position"],"bottom"),Zg=h(["legend","item","onclick"]),$g=h(["legend","item","onmouseover"]),_g=h(["legend","item","onmouseout"]),ah=h(["legend","equally"],!1),bh=h(["axis","rotated"],!1),ch=h(["axis","x","show"],!0),dh=h(["axis","x","type"],"indexed"),eh=h(["axis","x","localtime"],!0),fh=h(["axis","x","categories"],[]),gh=h(["axis","x","tick","centered"],!1),hh=h(["axis","x","tick","format"]),ih=h(["axis","x","tick","culling"],{}),jh=h(["axis","x","tick","culling","max"],10),kh=h(["axis","x","tick","count"]),lh=h(["axis","x","tick","fit"],!0),mh=h(["axis","x","tick","values"],null),nh=h(["axis","x","tick","rotate"]),oh=h(["axis","x","max"],null),ph=h(["axis","x","min"],null),qh=h(["axis","x","padding"],{}),rh=h(["axis","x","height"]),sh=h(["axis","x","default"]),th=h(["axis","x","label"],{}),uh=h(["axis","y","show"],!0),vh=h(["axis","y","max"]),wh=h(["axis","y","min"]),xh=h(["axis","y","center"]),yh=h(["axis","y","label"],{}),zh=h(["axis","y","inner"],!1),Ah=h(["axis","y","tick","format"]),Bh=h(["axis","y","padding"]),Ch=h(["axis","y","ticks"],10),Dh=h(["axis","y2","show"],!1),Eh=h(["axis","y2","max"]),Fh=h(["axis","y2","min"]),Gh=h(["axis","y2","center"]),Hh=h(["axis","y2","label"],{}),Ih=h(["axis","y2","inner"],!1),Jh=h(["axis","y2","tick","format"]),Kh=h(["axis","y2","padding"]),Lh=h(["axis","y2","ticks"],10),Mh=h(["grid","x","show"],!1),Nh=h(["grid","x","type"],"tick"),Oh=h(["grid","x","lines"],[]),Ph=h(["grid","y","show"],!1),Qh=h(["grid","y","lines"],[]),Rh=h(["grid","y","ticks"],10),Sh=h(["point","show"],!0),Th=h(["point","r"],2.5),Uh=h(["point","focus","line","enabled"],!0),Vh=h(["point","focus","expand","enabled"],!0),Wh=h(["point","focus","expand","r"]),Xh=h(["point","focus","select","r"]),Yh=h(["line","connect_null"],!1),Zh=h(["bar","width"]),$h=h(["bar","width","ratio"],.6),_h=h(["pie","label","show"],!0),ai=h(["pie","label","format"]),bi=h(["pie","expand"],!0),ci=h(["pie","onclick"],function(){}),di=h(["pie","onmouseover"],function(){}),ei=h(["pie","onmouseout"],function(){}),fi=h(["donut","label","show"],!0),gi=h(["donut","label","format"]),hi=h(["donut","expand"],!0),ii=h(["donut","title"],""),ji=h(["donut","onclick"],function(){}),ki=h(["donut","onmouseover"],function(){}),li=h(["donut","onmouseout"],function(){}),mi=h(["regions"],[]),ni=h(["tooltip","show"],!0),oi=h(["tooltip","format","title"]),pi=h(["tooltip","format","value"]),qi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=oi?oi:b,l=pi?pi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id,a[g].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),ri=h(["tooltip","init","show"],!1),si=h(["tooltip","init","x"],0),ti=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ui=("string"==typeof Af?Af.replace("#",""):Af.id)+"-clip",vi=ui+"-xaxis",wi=ui+"-yaxis",xi=i(ui),yi=i(vi),zi=i(wi),Ai="timeseries"===dh,Bi="categorized"===dh,Ci=!Ai&&(tg||we(ug)),Di=null,Ei=!1,Fi=!1,Gi=!1,Hi=!1,Ii=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ji=qe(Hg,we(Wg)?Wg:Ii,Gg),Ki=eh?xf.time.format:xf.time.format.utc,Li=function(){var a=[[Ki("%Y/%-m/%-d"),function(){return!0}],[Ki("%-m/%-d"),function(a){return a.getMonth()}],[Ki("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ki("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ki("%I %p"),function(a){return a.getHours()}],[Ki("%I:%M"),function(a){return a.getMinutes()}],[Ki(":%S"),function(a){return a.getSeconds()}],[Ki(".%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)}}(),Mi=[],Ni=[],Oi=bh?"left":"bottom",Pi=bh?zh?"top":"bottom":zh?"right":"left",Qi=bh?Ih?"bottom":"top":Ih?"left":"right",Ri=bh?"left":"bottom",Si={main:function(){return"translate("+Nf.left+","+Nf.top+")"},context:function(){return"translate("+Of.left+","+Of.top+")"},legend:function(){return"translate("+Pf.left+","+Pf.top+")"},x:function(){return"translate(0,"+(bh?0:Sf)+")"},y:function(){return"translate(0,"+(bh?Sf:0)+")"},y2:function(){return"translate("+(bh?0:Qf)+","+(bh?1:0)+")"},subx:function(){return"translate(0,"+(bh?0:Tf)+")"},arc:function(){return"translate("+Qf/2+","+Sf/2+")"}},Ti="right"===Yg,Ui=0,Vi=0,Wi=0,Xi=.15,Yi=30,Zi=bh&&!ch?0:30,$i=5;ag=xf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var _i,aj=function(){var a=xf.svg.line().x(bh?function(a){return V(a.id)(a.value)}:Cd).y(bh?Cd:function(a){return V(a.id)(a.value)});return Yh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Yh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Fg[b.id]?Ve(e,jg,V(b.id),Fg[b.id]):a(e)):(c=e[0]?jg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,bh?"M "+d+" "+c:"M "+c+" "+d)}}(),bj=function(){var a;return a=bh?xf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):xf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?jg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,bh?"M "+d+" "+c:"M "+c+" "+d)}}(),cj=function(){var a=xf.svg.line().x(bh?function(a){return W(a.id)(a.value)}:Fd).y(bh?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+mg(c[0].x)+" "+W(b.id)(c[0].value)}}(),dj=function(){};_i=xf.svg.brush().on("brush",cf),_i.update=function(){return hj&&hj.select("."+f.brush).call(this),this},_i.scale=function(a){return bh?this.y(a):this.x(a)},Ff&&(dj=xf.behavior.zoom().on("zoomstart",function(){dj.altDomain=xf.event.sourceEvent.altKey?jg.orgDomain():null}).on("zoom",Ff?df:null),dj.scale=function(a){return bh?this.y(a):this.x(a)},dj.orgScaleExtent=function(){var a=Gf?Gf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},dj.updateScaleExtent=function(){var a=ac(jg.orgDomain())/ac(lj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var ej,fj,gj,hj,ij,jj,kj,lj,mj,nj={};if(yf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);yf.revert(),yf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(yf.data.targets)&&Nb(a,!0),of(a,!0)},yf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);yf.revert(),b(d.classed(f.focused,!1)),b(e),ee(yf.data.targets)&&Ob(a),of(a,!1)},yf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);b(d.classed(f.focused,!1)),b(e),ee(yf.data.targets)&&Ob(a),pf()},yf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),ej.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&qf(a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},yf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),ej.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&rf(a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},yf.toggle=function(a){Gc(a)?yf.hide(a):yf.show(a)},yf.unzoom=function(){_i.clear().update(),bf({withUpdateXDomain:!0})},yf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){yg[b]=a.classes[b]}),"categories"in a&&Bi&&(fh=a.categories,pg.categories(fh)),"cacheIds"in a&&bc(a.cacheIds)?void jf(dc(a.cacheIds),a.done):void("unload"in a?lf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){kf(a)}):kf(a))},yf.unload=function(a,b){lf(Dc(a),function(){bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},yf.selected=function(a){return xf.merge(gj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return xf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},yf.select=function(a,b,c){Jg&&gj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=xf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Kg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Lg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},yf.unselect=function(a,b){Jg&&gj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=xf.select(this),g="circle"===this.nodeName?Be:Ee,h=Kg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Lg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},yf.toLine=function(a){wf(a,"line")},yf.toSpline=function(a){wf(a,"spline")},yf.toBar=function(a){wf(a,"bar")},yf.toScatter=function(a){wf(a,"scatter")},yf.toArea=function(a){wf(a,"area")},yf.toAreaSpline=function(a){wf(a,"area-spline") },yf.toPie=function(a){wf(a,"pie",{withTransform:!0})},yf.toDonut=function(a){wf(a,"donut",{withTransform:!0})},yf.groups=function(a){return c(a)?zg:(zg=a,bf(),zg)},yf.xgrids=function(a){return a?(Oh=a,bf(),Oh):Oh},yf.xgrids.add=function(a){return a?yf.xgrids(Oh.concat(a)):void 0},yf.xgrids.remove=function(a){var b=vf(a);return yf.xgrids(Oh.filter(b))},yf.ygrids=function(a){return a?(Qh=a,bf(),Qh):Qh},yf.ygrids.add=function(a){return a?yf.ygrids(Qh.concat(a)):void 0},yf.ygrids.remove=function(a){var b=vf(a);return yf.ygrids(Qh.filter(b))},yf.regions=function(a){return c(a)?mi:(mi=a,bf(),mi)},yf.regions.add=function(a){return c(a)?mi:(mi=mi.concat(a),bf(),mi)},yf.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;ej.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),mi=mi.filter(function(b){return b.classes.indexOf(a)<0})}),mi},yf.data.get=function(a){var b=yf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},yf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},yf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){xg[b]=a[b]}),sf(Cc(yf.data.targets),{withTransition:!0}),xg):xg},yf.x=function(a){return arguments.length&&(qc(yf.data.targets,a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),yf.data.xs},yf.xs=function(a){return arguments.length&&(rc(yf.data.targets,a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),yf.data.xs},yf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},yf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(vh=+a.y),b(a.y2)&&(Eh=+a.y2)):vh=Eh=+a,bf())},yf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(wh=+a.y),b(a.y2)&&(Fh=+a.y2)):wh=Fh=+a,bf())},yf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&yf.axis.max(a.max),"undefined"!=typeof a.min&&yf.axis.min(a.min))},yf.legend.show=function(a){qf(Dc(a)),bf({withLegend:!0})},yf.legend.hide=function(a){rf(Dc(a)),bf({withLegend:!0})},yf.resize=function(a){Bf=a?a.width:null,Cf=a?a.height:null,gf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},yf.destroy=function(){yf.data.targets=void 0,yf.data.xs={},kj.html(""),a.onresize=null},"url"in e.data)xf.xhr(e.data.url,function(a,b){var c,d=xf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=xf.csv.parse(b.response),We(c)});else if("rows"in e.data)We(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");We(uc(e.data.columns))}return yf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 4679fda580b17fd995f33d0a029a37fb70d7e46a Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Thu, 1 May 2014 15:53:07 +0900 Subject: [PATCH 107/178] Fix sample --- htdocs/samples/simple.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/samples/simple.html b/htdocs/samples/simple.html index 31918eb..dc83518 100644 --- a/htdocs/samples/simple.html +++ b/htdocs/samples/simple.html @@ -6,7 +6,7 @@
- + + + + + From fdbfc05e6a27ddf3736461ac8b6b31eae96b3c86 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Thu, 1 May 2014 16:12:38 +0900 Subject: [PATCH 110/178] Fix global x tick culling - #186 --- c3.js | 4 ++-- c3.min.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/c3.js b/c3.js index 349f144..e3a8be3 100644 --- a/c3.js +++ b/c3.js @@ -3238,14 +3238,14 @@ break; } } - d3.selectAll('.' + CLASS.axisX + ' .tick text').each(function (e) { + svg.selectAll('.' + CLASS.axisX + ' .tick text').each(function (e) { var index = tickValues.indexOf(e); if (index >= 0) { d3.select(this).style('display', index % intervalForCulling ? 'none' : 'block'); } }); } else { - d3.selectAll('.' + CLASS.axisX + ' .tick text').style('display', 'block'); + svg.selectAll('.' + CLASS.axisX + ' .tick text').style('display', 'block'); } } diff --git a/c3.min.js b/c3.min.js index d9d7633..9bc9bc2 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ !function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.33"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",legendItemFocused:"c3-legend-item-focused",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;cQf&&(Qf=0),0>Sf&&(Sf=0),Rf=bh?Nf.left-Yi-Zi:Qf,Tf=bh?Sf:Vf-Of.top-Of.bottom,0>Rf&&(Rf=0),0>Tf&&(Tf=0),p(),Ti&&ee(yf.data.targets)&&(Pf.left=Qf/2+Xf)}function o(){gj.select("line."+f.xgridFocus).attr("x1",bh?0:-10).attr("x2",bh?Qf:-10).attr("y1",bh?-10:Nf.top).attr("y2",bh?-10:Sf)}function p(){Xf=Sf/2,Wf=.95*Xf,Yf=de(yf.data.targets)?.6*Wf:0}function q(){var a=bh?f.axisX:f.axisY,b=gj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=xf.select(Af).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Bf?Bf:x()}function s(){var a=Cf?Cf:y();return a>0?a:320}function t(){return ee(yf.data.targets)?0:Df?Df:bh?ch?v("x"):1:!uh||zh?1:v("y")}function u(){var a=1;return ee(yf.data.targets)?0:Ef?Ef:Ti?P()+(Dh&&!bh?v("y2"):a):Dh?Ih||bh?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||ch?"x"===a&&rh?rh:"y"!==a||uh?"y2"!==a||Dh?(jb(a).isInner?30:40)+("y2"===a?-10:0):$i:Xg&&!Ti?10:1:0}function x(){return+xf.select(Af).style("width").replace("px","")}function y(){return+xf.select(Af).style("height").replace("px","")}function z(a){return a?-5:-(Nf.left-1)}function A(a){return a?-20:-4}function B(){return z(!bh)}function C(){return A(!bh)}function D(){return z(bh)}function E(){return A(bh)}function F(a){return a?Qf+2+4:Nf.left+20}function G(a){return a?(rh?rh:0)+80:Sf+8}function H(){return F(!bh)}function I(){return G(!bh)}function J(){return F(bh)}function K(){return G(bh)}function L(){var a,b,c,d,e,f=Ac(yf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=jg(b.x)-jg(a.x),0===c?bh?Sf:Qf:(d=zc(),e=ae(yf.data.targets)?(d-(Bi?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function M(a){Ui=a}function N(a){Vi=a}function O(a){Wi=a}function P(){return Xg?Ti?Vi*(Ui+1):Uf:0}function Q(){return Xg?Ti?Vf:Wi*(Ui+1):0}function R(){var a,b,c=!jg;bg=bh?1:0,cg=bh?Sf:Qf,dg=bh?0:Sf,eg=bh?Qf:1,fg=bg,gg=cg,hg=bh?0:Tf,ig=bh?Rf:1,jg=T(bg,cg,c?void 0:jg.domain(),function(){return pg.tickOffset()}),kg=U(dg,eg,c?void 0:kg.domain()),lg=U(dg,eg,c?void 0:lg.domain()),mg=T(bg,cg,lj,function(a){return a%1?0:sg.tickOffset()}),ng=U(hg,ig,c?void 0:ng.domain()),og=U(hg,ig,c?void 0:og.domain()),a=$(),b=mh?mh:c?void 0:pg.tickValues(),pg=X(jg,Oi,a,b),sg=X(mg,Ri,a,b),qg=Y(kg,Pi,Ah,Ch),rg=Y(lg,Qi,Jh,Lh),c||(_i.scale(mg),Ff&&dj.scale(jg)),S()}function S(){Zf=Gb(),$f=Hb(),_f=Hb(.98)}function T(a,b,d,e){var f=(Ai?xf.time.scale():xf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Bi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=xf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?lg:kg}function W(a){return"y2"===Z(a)?og:ng}function X(a,b,c,d){var e=(Bi?Eb():xf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Bi?(e.tickCentered(gh),ve(ih)&&(ih=!1)):e.tickOffset=function(){var a=Bc(yf.data.targets),b=jg(a[1])-jg(a[0]),c=b?b:bh?Sf:Qf;return c/zc()/2},Bi&&e.categories(fh),e}function Y(a,b,c,d){return xf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Ag?Ag[a]:"y"}function $(){var a=Ai?Li:Bi?Tc:function(a){return 0>a?a.toFixed(0):a};return hh&&("function"==typeof hh?a=hh:Ai&&(a=function(a){return a?Ki(hh)(a):""})),a}function _(a){var b;return"y"===a?b=yh:"y2"===a?b=Hh:"x"===a&&(b=th),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?yh=b:"y2"===a?Hh=b:"x"===a&&(th=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",bh?"inner-top":"inner-right")}function hb(){return fb("y",bh?"inner-right":"inner-top")}function ib(){return fb("y2",bh?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Qf/2:Qf:b.isBottom?-Sf:b.isMiddle?-Sf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!bh,gb())}function rb(){return nb(bh,hb())}function sb(){return nb(bh,ib())}function tb(){return ob(!bh,gb())}function ub(){return ob(bh,hb())}function vb(){return ob(bh,ib())}function wb(){var a=gb();return bh?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":rh?rh-10:"3em"}function xb(){var a=hb();return bh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return bh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!bh,gb())}function Ab(){return pb(bh,hb())}function Bb(){return pb(bh,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return xf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){gj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),gj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),gj.select("."+f.axisY2+" ."+f.axisY2Label).transition().attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 xf.min(Object.keys(i).map(function(a){return xf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(zg.length>0)for(g=Sc(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 xf.max(Object.keys(i).map(function(a){return xf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Fh:wh,n="y2"===c?Eh:vh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Gh:xh,r=ud()&&bh;return 0===l.length?"y2"===c?lg.domain():kg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(kg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Bh&&(f=b(Bh.top)?Bh.top:e,g=b(Bh.bottom)?Bh.bottom:e),"y2"===c&&Kh&&(f=b(Kh.top)?Kh.top:e,g=b(Kh.bottom)?Kh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return ph?Ai?re(ph):ph:xf.min(a,function(a){return xf.min(a.values,function(a){return a.x})})}function Zb(a){return oh?Ai?re(oh):oh:xf.max(a,function(a){return xf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Bi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof qh&&we(qh)?(e=b(qh.left)?qh.left:d,f=b(qh.right)?qh.right:d):e=f="number"==typeof qh?qh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return c-d===0&&(c=Ai?new Date(.5*c.getTime()):-.5,d=Ai?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Ai?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Ai?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?kg:lg;return b="y"===a.axis||"y2"===a.axis?bh?Sf:"start"in a?d(a.start):Sf:bh?"end"in a?jg(Ai?re(a.end):a.end):Sf:Sf,c>b?0:b-c}function ic(a){return tg&&a===tg||we(ug)&&xe(ug,a)}function jc(a){return!ic(a)}function kc(a){return tg?tg:we(ug)?ug[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=yf.data.xs[b])}),c}function mc(a,b){return a in yf.data.xs&&yf.data.xs[a]&&yf.data.xs[a][b]?yf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){ug[b]=a[b]})}function oc(a){return 1===xf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=xg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),yf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=Ai?a?a instanceof Date?a:re(a):re(mc(c,d)):Ci&&!Bi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?yf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):tg?(d=Object.keys(yf.data.xs),yf.data.xs[c]=d.length>0?yf.data.xs[d[0]]:void 0):we(ug)&&(yf.data.xs[c]=lc(f,yf.data.targets)):yf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!yf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=wg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ci&&Bi&&0===c&&g&&(0===e&&(fh=[]),fh.push(g)),("undefined"==typeof a[b]||yf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Bg&&$d(Cc(c).filter(function(a){return!(a in Cg)}),Bg),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&yf.data.targets[0].values[a-1]?yf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(yf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Ai?new Date(i):i);j.push(e)}return Ai||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Mi=Mi.concat(a)}function Mc(a){Mi=Mi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Ni=Ni.concat(a)}function Oc(a){Ni=Ni.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return xf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Ld(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 Md(){return Eg&&"desc"===Eg.toLowerCase()}function Nd(){return Eg&&"asc"===Eg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Eg&&a.sort(Eg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(yf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&ni&&(jj.html(qi(a,$(),wd(k),Ji)).style("display","block"),d=jj.property("offsetWidth"),e=jj.property("offsetHeight"),k?(g=Qf/2+c[0],i=Sf/2+c[1]+20):(bh?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=jg(l[0].x)+20):(f=q(),g=f+t()+jg(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),jj.style("top",i+"px").style("left",g+"px"))}function Qd(){jj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});ni&&(be(yf.data.targets)||ee(yf.data.targets)||gj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(bh?"y1":"x1",Cd).attr(bh?"y2":"x2",Cd))}function Sd(){gj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?jg(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return"number"==typeof Zh?Zh:b?2*a.tickOffset()*$h/b:0}function $d(a,b){Dc(a).forEach(function(a){nj[a]=b===Cg[a],Cg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Cg[a.id]===b&&(c=!0),a.id in Cg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Cg)||"line"===Cg[b]||"spline"===Cg[b]||"area"===Cg[b]||"area-spline"===Cg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Cg[b]||"area-spline"===Cg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Cg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Cg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Cg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Cg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&hi||je(a)&&bi}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function re(b){var c;try{c=vg?xf.time.format(vg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+vg)}return c}function se(a,b){var c=xf.mouse(a),d=xf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?kg:lg,d=bh?1:0,e=bh?0:1;return Math.pow(jg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Qg(b,a.node()),gj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud).attr("stroke",function(){return Ji(b)}).attr("r",1.4*Je(b)).transition().duration(100).attr("r",Je)}function Be(a,b,c){Rg(b,a.node()),gj.select("."+f.selectedCircles+ld(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){Qg(b,a.node()),a.transition().duration(100).style("fill",function(){return xf.rgb(Ji(b)).darker(1)})}function Ee(a,b){Rg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ji(b)})}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){return Sh?"function"==typeof Th?Th(a):Th:0}function Ie(a){return Vh?Wh?Wh:1.75*He(a):He(a)}function Je(a){return Xh?Xh:4*He(a)}function Ke(a,c){return(c?gj.selectAll("."+f.circles+ld(c)):gj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Le(a,b){Ke(a,b).classed(f.EXPANDED,!0).attr("r",Ie)}function Me(a){Ke(a).filter(function(){return xf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",He)}function Ne(a){return gj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Oe(a){Ne(a).classed(f.EXPANDED,!0)}function Pe(a){Ne(a).classed(f.EXPANDED,!1)}function Qe(a,b){var c=Ue(a,b);return function(a,b){var d=c(a,b),e=bh?1:0,f=bh?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 Re(a,b){var c=Ue(a,!1),d=b?Se:Te;return function(a,b){return d(c(a,b),a,this)}}function Se(a,b){var c;return bh?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Te(a,b,c){var d=c.getBoundingClientRect();return bh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Ue(a,b){var c=a.__max__+1,d=Zd(pg,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return bh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Ve(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 We(b){var c,d,e;if(kj=xf.select(Af),kj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(kj.html("").classed("c3",!0),yf.data.xs={},yf.data.targets=vc(b),Ig&&Lc(Ig===!0?Cc(yf.data.targets):Ig),n(),R(),jg.domain(xf.extent(_b(yf.data.targets))),kg.domain(Xb(yf.data.targets,"y")),lg.domain(Xb(yf.data.targets,"y2")),mg.domain(jg.domain()),ng.domain(kg.domain()),og.domain(lg.domain()),lj=jg.domain(),_i.scale(mg),Ff&&dj.scale(jg),ej=kj.append("svg").attr("width",Qf+Nf.left+Nf.right).attr("height",Sf+Nf.top+Nf.bottom).on("mouseenter",If).on("mouseleave",Jf),fj=ej.append("defs"),fj.append("clipPath").attr("id",ui).append("rect").attr("width",Qf).attr("height",Sf),fj.append("clipPath").attr("id",vi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),fj.append("clipPath").attr("id",wi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),gj=ej.append("g").attr("transform",Si.main),hj=ej.append("g").attr("transform",Si.context),ij=ej.append("g").attr("transform",Si.legend),Ug||hj.style("visibility","hidden"),Xg||(ij.style("visibility","hidden"),Ni=Cc(yf.data.targets)),jj=xf.select(Af).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),sf(Cc(yf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=gj.append("g").attr("clip-path",xi).attr("class",f.grid),Mh&&d.append("g").attr("class",f.xgrids),we(Oh)&&d.append("g").attr("class",f.xgridLines),Uh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Ph&&d.append("g").attr("class",f.ygrids),we(Qh)&&d.append("g").attr("class",f.ygridLines),ch&&gj.append("g").attr("class",f.axisX).attr("clip-path",yi).attr("transform",Si.x).append("text").attr("class",f.axisXLabel).attr("transform",bh?"rotate(-90)":"").style("text-anchor",zb),uh&&gj.append("g").attr("class",f.axisY).attr("clip-path",zi).attr("transform",Si.y).append("text").attr("class",f.axisYLabel).attr("transform",bh?"":"rotate(-90)").style("text-anchor",Ab),Dh&&gj.append("g").attr("class",f.axisY2).attr("transform",Si.y2).append("text").attr("class",f.axisY2Label).attr("transform",bh?"":"rotate(-90)").style("text-anchor",Bb),gj.append("g").attr("clip-path",xi).attr("class",f.regions),gj.append("g").attr("clip-path",xi).attr("class",f.chart),c=gj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ff?bh?"ns-resize":"ew-resize":null),gj.select("."+f.chart).append("g").attr("class",f.chartBars),gj.select("."+f.chart).append("g").attr("class",f.chartLines),gj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Si.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),gj.select("."+f.chart).append("g").attr("class",f.chartTexts),Ff&&gj.insert("rect",Hf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Qf).attr("height",Sf).style("opacity",0).style("cursor",bh?"ns-resize":"ew-resize").call(dj).on("dblclick.zoom",null),sh&&_i.extent("function"!=typeof sh?sh:sh(_b())),hj.append("g").attr("clip-path",xi).attr("class",f.chart),hj.select("."+f.chart).append("g").attr("class",f.chartBars),hj.select("."+f.chart).append("g").attr("class",f.chartLines),hj.append("g").attr("clip-path",xi).attr("class",f.brush).call(_i).selectAll("rect").attr(bh?"width":"height",bh?Rf:Tf),hj.append("g").attr("class",f.axisX).attr("transform",Si.subx).attr("clip-path",bh?"":yi),hf(yf.data.targets),bh?gj.select("."+f.axisX).style("opacity",0).call(pg):(gj.select("."+f.axisY).style("opacity",0).call(qg),gj.select("."+f.axisY2).style("opacity",0).call(rg)),n(),R(),ff(),m(!1),bf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),ri){if(Ai&&"string"==typeof si){for(si=re(si),e=0;e0){d=[];for(var g in xg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(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 _e(a){ee(yf.data.targets)||Jg&&(Di=a,gj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ei=!0,Sg())}function af(){ee(yf.data.targets)||Jg&&(gj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),gj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ei=!1,Tg())}function bf(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Vd(),W=ee(yf.data.targets),X=Ic(yf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Mf:0,Q=D?P:0,R=E?P:0,c=gj.select("."+f.axisX).style("opacity",W?0:1),g=gj.select("."+f.axisY).style("opacity",W?0:1),h=gj.select("."+f.axisY2).style("opacity",W?0:1),e=hj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Xg&&sf(Cc(yf.data.targets),a,O),Bi&&(0!==X.length&&H&&G||jg.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(jg.domain(xf.extent(_b(X))),lj=jg.domain(),Ff&&dj.scale(jg).updateScaleExtent(),mg.domain(jg.domain()),_i.scale(mg)),G&&(jg.domain(_i.empty()?lj:_i.extent()),Ff&&dj.scale(jg).updateScaleExtent()),mh||!lh&&!kh||(S=Kc(Jc(X),kh),pg.tickValues(S),sg.tickValues(S))),kg.domain(Xb(X,"y")),lg.domain(Xb(X,"y2")),O.axisX.call(pg),O.axisY.call(qg),O.axisY2.call(rg),O.axisSubX.call(sg),G&&X.length)if(ih&&S){for(T=1;T=0&&xf.select(this).style("display",b%U?"none":"block")})}else xf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!bh&&nh&&eb(c,O.axisX,nh),J=Qe(V),M=Re(V,!0),N=Re(V,!1),Db(),ng.domain(kg.domain()),og.domain(lg.domain()),jj.style("display","none"),o(),gj.select("line."+f.xgridFocus).style("visibility","hidden"),Mh){if("year"===Nh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=jg.ticks(10);i=gj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",bh?0:function(a){return jg(a)-pg.tickOffset()}).attr("x2",bh?Qf:function(a){return jg(a)-pg.tickOffset()}).attr("y1",bh?function(a){return jg(a)-pg.tickOffset()}:Nf.top).attr("y2",bh?function(a){return jg(a)-pg.tickOffset()}:Sf).style("opacity",function(){return+xf.select(this).attr(bh?"y1":"x1")===(bh?Sf:0)?0:1}),i.exit().remove()}we(Oh)&&(k=gj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Oh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",bh?"":"rotate(-90)").attr("dx",bh?0:-Nf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",bh?0:Dd).attr("x2",bh?Qf:Dd).attr("y1",bh?Dd:Nf.top).attr("y2",bh?Dd:Sf).style("opacity",1),k.select("text").transition().duration(P).attr("x",bh?Qf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Ph&&(m=gj.select("."+f.ygrids).selectAll("."+f.ygrid).data(kg.ticks(Rh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",bh?kg:0).attr("x2",bh?kg:Qf).attr("y1",bh?0:kg).attr("y2",bh?Sf:kg),m.exit().remove()),A&&we(Qh)&&(n=gj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Qh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",bh?"rotate(-90)":"").attr("dx",bh?0:-Nf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",bh?Ed:0).attr("x2",bh?Ed:Qf).attr("y1",bh?0:Ed).attr("y2",bh?Sf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",bh?0:Qf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=gj.select("."+f.regions).selectAll("rect."+f.region).data(mi),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=gj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Ji(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=gj.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return bh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),gj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1),gj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",bj).style("opacity",mj),q=gj.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",He),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud),q.exit().remove(),gj.each(function(){Hi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=xf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Hi=!1}),gj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),gj.select("."+f.chartArcsTitle).style("opacity",de(yf.data.targets)?1:0),Ug&&(null!==xf.event&&"zoom"===xf.event.type&&_i.extent(jg.orgDomain()).update(),B&&(!bh&&nh&&eb(e,O.axisSubX,nh),_i.empty()||_i.extent(jg.orgDomain()).update(),K=Qe(V,!0),u=hj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Ji(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),hj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",cj).style("opacity",1))),gj.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),gj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud),v=gj.select("."+f.eventRects),we(ug)&&!oc(ug)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=gj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ye(w.enter()),w.attr("x",0).attr("y",0).attr("width",Qf).attr("height",Sf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ci&&!Bi?(z=function(a,b){var c=xc(b),d=yc(b),e=yf.data.xs[a.id][b];return(jg(d?d:e+50)-jg(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=yf.data.xs[a.id][b];return(jg(d)+jg(c?c:d-50))/2}):(z=L(),y=function(a){return jg(a.x)-z/2}),x=Ac(yf.data.targets),gj.select("."+f.eventRects).datum(x?x.values:[]),w=gj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Xe(w.enter()),w.attr("class",fd).attr("x",bh?0:y).attr("y",bh?y:0).attr("width",bh?Qf:z).attr("height",bh?z:Sf),w.exit().remove()),Cc(yf.data.targets).forEach(function(a){nj[a]=!0})}function cf(){bf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function df(){return"mousemove"===xf.event.sourceEvent.type&&dj.altDomain?(jg.domain(dj.altDomain),void dj.scale(jg).updateScaleExtent()):(Bi&&jg.orgDomain()[0]===lj[0]&&jg.domain([lj[0]-1e-10,jg.orgDomain()[1]]),bf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===xf.event.sourceEvent.type&&(Fi=!0)))}function ef(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function ff(){ej.attr("width",Uf).attr("height",Vf),ej.select("#"+ui).select("rect").attr("width",Qf).attr("height",Sf),ej.select("#"+vi).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),ej.select("#"+wi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej.select("."+f.zoomRect).attr("width",Qf).attr("height",Sf),kj.style("max-height",Vf+"px")}function gf(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),ff(),m(a.withTransition),bf(a)}function hf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=gj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Ji(a)}),e=gj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Lg(a)?"pointer":null}),c=gj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ji(a)}),b.append("path").attr("class",dd).style("opacity",function(){return mj=+xf.select(this).style("opacity"),0}).style("fill",function(a){return Ji(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Ji(a)}).style("cursor",function(a){return Lg(a)?"pointer":null}),a.forEach(function(a){gj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=gj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(ag(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Ji(a.data)}).style("cursor",function(a){return Lg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Hi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),of(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,xf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Hi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),pf(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Ug&&(n=hj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Ji(a)}),l=hj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ji(a)})),ej.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Mf).style("opacity",1)}function jf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),yf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Ti?j:i,l=Ti?Q():P();return d&&(w=0,C=0,t=0,u=0),Xg&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Ti?u:t,void(ah?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=ij.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,Ti?(g=function(a){return t*(.2+B[a])},j=function(a){return A[B[a]]+x[a]}):(g=function(a){return A[B[a]]+x[a]},j=function(a){return u*(.2+B[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=ij.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Zg?Zg(a):yf.toggle(a)}).on("mouseover",function(a){xf.select(this).classed(f.legendItemFocused,!0),Hi||yf.focus(a),"function"==typeof $g&&$g(a)}).on("mouseout",function(a){xf.select(this).classed(f.legendItemFocused,!1),Hi||yf.revert(),"function"==typeof _g&&_g(a)}),o.append("text").text(function(a){return d(xg[a])?xg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ti?h:-200).attr("y",Ti?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ti?i:-200).attr("y",Ti?-200:l).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Ji(a)}).attr("x",Ti?h:-200).attr("y",Ti?-200:j).attr("width",10).attr("height",10),ij.selectAll("text").data(a).text(function(a){return d(xg[a])?xg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),ij.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),ij.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),ij.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=xf.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?mf(b):nf(b):Xi}),N(t),O(u),M(C),n(),R(),ff(),m(q,c)}function tf(a){return Ec(yf.data.targets,a.id)}function uf(a){return"data"in a&&Ec(yf.data.targets,a.data.id)}function vf(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 wf(a,b,c){var d=!ee(yf.data.targets);Hi=!1,$d(a,b),gf(c||{withTransitionForAxis:d})}var xf=a.d3?a.d3:a.require?a.require("d3"):void 0,yf={data:{},axis:{},legend:{}},zf={},Af=h(["bindto"],"#chart"),Bf=h(["size","width"]),Cf=h(["size","height"]),Df=h(["padding","left"],50),Ef=h(["padding","right"]),Ff=h(["zoom","enabled"],!1),Gf=h(["zoom","extent"]),Hf=h(["zoom","privileged"],!1),If=h(["onenter"],function(){}),Jf=h(["onleave"],function(){}),Kf=h(["onresize"],function(){}),Lf=h(["onresized"],function(){}),Mf=h(["transition","duration"],350);g("data","data is required in config");var Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg=h(["data","x"]),ug=h(["data","xs"],{}),vg=h(["data","x_format"]),wg=h(["data","id_converter"],function(a){return a}),xg=h(["data","names"],{}),yg=h(["data","classes"],{}),zg=h(["data","groups"],[]),Ag=h(["data","axes"],{}),Bg=h(["data","type"]),Cg=h(["data","types"],{}),Dg=h(["data","labels"],{}),Eg=h(["data","order"]),Fg=h(["data","regions"],{}),Gg=h(["data","color"]),Hg=h(["data","colors"],{}),Ig=h(["data","hide"],!1),Jg=h(["data","selection","enabled"],!1),Kg=h(["data","selection","grouped"],!1),Lg=h(["data","selection","isselectable"],function(){return!0}),Mg=h(["data","selection","multiple"],!0),Ng=h(["data","onclick"],function(){}),Og=h(["data","onenter"],function(){}),Pg=h(["data","onleave"],function(){}),Qg=h(["data","onselected"],function(){}),Rg=h(["data","onunselected"],function(){}),Sg=h(["data","ondragstart"],function(){}),Tg=h(["data","ondragend"],function(){}),Ug=h(["subchart","show"],!1),Vg=h(["subchart","size","height"],60),Wg=h(["color","pattern"],[]),Xg=h(["legend","show"],!0),Yg=h(["legend","position"],"bottom"),Zg=h(["legend","item","onclick"]),$g=h(["legend","item","onmouseover"]),_g=h(["legend","item","onmouseout"]),ah=h(["legend","equally"],!1),bh=h(["axis","rotated"],!1),ch=h(["axis","x","show"],!0),dh=h(["axis","x","type"],"indexed"),eh=h(["axis","x","localtime"],!0),fh=h(["axis","x","categories"],[]),gh=h(["axis","x","tick","centered"],!1),hh=h(["axis","x","tick","format"]),ih=h(["axis","x","tick","culling"],{}),jh=h(["axis","x","tick","culling","max"],10),kh=h(["axis","x","tick","count"]),lh=h(["axis","x","tick","fit"],!0),mh=h(["axis","x","tick","values"],null),nh=h(["axis","x","tick","rotate"]),oh=h(["axis","x","max"],null),ph=h(["axis","x","min"],null),qh=h(["axis","x","padding"],{}),rh=h(["axis","x","height"]),sh=h(["axis","x","default"]),th=h(["axis","x","label"],{}),uh=h(["axis","y","show"],!0),vh=h(["axis","y","max"]),wh=h(["axis","y","min"]),xh=h(["axis","y","center"]),yh=h(["axis","y","label"],{}),zh=h(["axis","y","inner"],!1),Ah=h(["axis","y","tick","format"]),Bh=h(["axis","y","padding"]),Ch=h(["axis","y","ticks"],10),Dh=h(["axis","y2","show"],!1),Eh=h(["axis","y2","max"]),Fh=h(["axis","y2","min"]),Gh=h(["axis","y2","center"]),Hh=h(["axis","y2","label"],{}),Ih=h(["axis","y2","inner"],!1),Jh=h(["axis","y2","tick","format"]),Kh=h(["axis","y2","padding"]),Lh=h(["axis","y2","ticks"],10),Mh=h(["grid","x","show"],!1),Nh=h(["grid","x","type"],"tick"),Oh=h(["grid","x","lines"],[]),Ph=h(["grid","y","show"],!1),Qh=h(["grid","y","lines"],[]),Rh=h(["grid","y","ticks"],10),Sh=h(["point","show"],!0),Th=h(["point","r"],2.5),Uh=h(["point","focus","line","enabled"],!0),Vh=h(["point","focus","expand","enabled"],!0),Wh=h(["point","focus","expand","r"]),Xh=h(["point","focus","select","r"]),Yh=h(["line","connect_null"],!1),Zh=h(["bar","width"]),$h=h(["bar","width","ratio"],.6),_h=h(["pie","label","show"],!0),ai=h(["pie","label","format"]),bi=h(["pie","expand"],!0),ci=h(["pie","onclick"],function(){}),di=h(["pie","onmouseover"],function(){}),ei=h(["pie","onmouseout"],function(){}),fi=h(["donut","label","show"],!0),gi=h(["donut","label","format"]),hi=h(["donut","expand"],!0),ii=h(["donut","title"],""),ji=h(["donut","onclick"],function(){}),ki=h(["donut","onmouseover"],function(){}),li=h(["donut","onmouseout"],function(){}),mi=h(["regions"],[]),ni=h(["tooltip","show"],!0),oi=h(["tooltip","format","title"]),pi=h(["tooltip","format","value"]),qi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=oi?oi:b,l=pi?pi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id,a[g].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),ri=h(["tooltip","init","show"],!1),si=h(["tooltip","init","x"],0),ti=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ui=("string"==typeof Af?Af.replace("#",""):Af.id)+"-clip",vi=ui+"-xaxis",wi=ui+"-yaxis",xi=i(ui),yi=i(vi),zi=i(wi),Ai="timeseries"===dh,Bi="categorized"===dh,Ci=!Ai&&(tg||we(ug)),Di=null,Ei=!1,Fi=!1,Gi=!1,Hi=!1,Ii=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ji=qe(Hg,we(Wg)?Wg:Ii,Gg),Ki=eh?xf.time.format:xf.time.format.utc,Li=function(){var a=[[Ki("%Y/%-m/%-d"),function(){return!0}],[Ki("%-m/%-d"),function(a){return a.getMonth()}],[Ki("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ki("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ki("%I %p"),function(a){return a.getHours()}],[Ki("%I:%M"),function(a){return a.getMinutes()}],[Ki(":%S"),function(a){return a.getSeconds()}],[Ki(".%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)}}(),Mi=[],Ni=[],Oi=bh?"left":"bottom",Pi=bh?zh?"top":"bottom":zh?"right":"left",Qi=bh?Ih?"bottom":"top":Ih?"left":"right",Ri=bh?"left":"bottom",Si={main:function(){return"translate("+Nf.left+","+Nf.top+")"},context:function(){return"translate("+Of.left+","+Of.top+")"},legend:function(){return"translate("+Pf.left+","+Pf.top+")"},x:function(){return"translate(0,"+(bh?0:Sf)+")"},y:function(){return"translate(0,"+(bh?Sf:0)+")"},y2:function(){return"translate("+(bh?0:Qf)+","+(bh?1:0)+")"},subx:function(){return"translate(0,"+(bh?0:Tf)+")"},arc:function(){return"translate("+Qf/2+","+Sf/2+")"}},Ti="right"===Yg,Ui=0,Vi=0,Wi=0,Xi=.15,Yi=30,Zi=bh&&!ch?0:30,$i=5;ag=xf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var _i,aj=function(){var a=xf.svg.line().x(bh?function(a){return V(a.id)(a.value)}:Cd).y(bh?Cd:function(a){return V(a.id)(a.value)});return Yh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Yh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Fg[b.id]?Ve(e,jg,V(b.id),Fg[b.id]):a(e)):(c=e[0]?jg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,bh?"M "+d+" "+c:"M "+c+" "+d)}}(),bj=function(){var a;return a=bh?xf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):xf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?jg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,bh?"M "+d+" "+c:"M "+c+" "+d)}}(),cj=function(){var a=xf.svg.line().x(bh?function(a){return W(a.id)(a.value)}:Fd).y(bh?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+mg(c[0].x)+" "+W(b.id)(c[0].value)}}(),dj=function(){};_i=xf.svg.brush().on("brush",cf),_i.update=function(){return hj&&hj.select("."+f.brush).call(this),this},_i.scale=function(a){return bh?this.y(a):this.x(a)},Ff&&(dj=xf.behavior.zoom().on("zoomstart",function(){dj.altDomain=xf.event.sourceEvent.altKey?jg.orgDomain():null}).on("zoom",Ff?df:null),dj.scale=function(a){return bh?this.y(a):this.x(a)},dj.orgScaleExtent=function(){var a=Gf?Gf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},dj.updateScaleExtent=function(){var a=ac(jg.orgDomain())/ac(lj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var ej,fj,gj,hj,ij,jj,kj,lj,mj,nj={};if(yf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);yf.revert(),yf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(yf.data.targets)&&Nb(a,!0),of(a,!0)},yf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);yf.revert(),b(d.classed(f.focused,!1)),b(e),ee(yf.data.targets)&&Ob(a),of(a,!1)},yf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);b(d.classed(f.focused,!1)),b(e),ee(yf.data.targets)&&Ob(a),pf()},yf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),ej.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&qf(a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},yf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),ej.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&rf(a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},yf.toggle=function(a){Gc(a)?yf.hide(a):yf.show(a)},yf.unzoom=function(){_i.clear().update(),bf({withUpdateXDomain:!0})},yf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){yg[b]=a.classes[b]}),"categories"in a&&Bi&&(fh=a.categories,pg.categories(fh)),"cacheIds"in a&&bc(a.cacheIds)?void jf(dc(a.cacheIds),a.done):void("unload"in a?lf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){kf(a)}):kf(a))},yf.unload=function(a,b){lf(Dc(a),function(){bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},yf.selected=function(a){return xf.merge(gj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return xf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},yf.select=function(a,b,c){Jg&&gj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=xf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Kg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Lg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},yf.unselect=function(a,b){Jg&&gj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=xf.select(this),g="circle"===this.nodeName?Be:Ee,h=Kg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Lg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},yf.toLine=function(a){wf(a,"line")},yf.toSpline=function(a){wf(a,"spline")},yf.toBar=function(a){wf(a,"bar")},yf.toScatter=function(a){wf(a,"scatter")},yf.toArea=function(a){wf(a,"area")},yf.toAreaSpline=function(a){wf(a,"area-spline") +}jj.html(qi(yf.data.targets.map(function(a){return pc(a.values[si])}),$(),wd(ee(yf.data.targets)),Ji)),jj.style("top",ti.top).style("left",ti.left).style("display","block")}null==a.onresize&&(a.onresize=ef()),a.onresize.add&&(a.onresize.add(Kf),a.onresize.add(function(){gf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})}),a.onresize.add(Lf))}function Xe(a){a.append("rect").attr("class",fd).style("cursor",Jg&&Kg?"pointer":null).on("mouseover",function(a,b){if(!Ei&&!ee(yf.data.targets)){var c,d,e=yf.data.targets.map(function(a){return pc(a.values[b])});if(Object.keys(xg).length>0){d=[];for(var g in xg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(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 _e(a){ee(yf.data.targets)||Jg&&(Di=a,gj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ei=!0,Sg())}function af(){ee(yf.data.targets)||Jg&&(gj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),gj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ei=!1,Tg())}function bf(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Vd(),W=ee(yf.data.targets),X=Ic(yf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Mf:0,Q=D?P:0,R=E?P:0,c=gj.select("."+f.axisX).style("opacity",W?0:1),g=gj.select("."+f.axisY).style("opacity",W?0:1),h=gj.select("."+f.axisY2).style("opacity",W?0:1),e=hj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Xg&&sf(Cc(yf.data.targets),a,O),Bi&&(0!==X.length&&H&&G||jg.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(jg.domain(xf.extent(_b(X))),lj=jg.domain(),Ff&&dj.scale(jg).updateScaleExtent(),mg.domain(jg.domain()),_i.scale(mg)),G&&(jg.domain(_i.empty()?lj:_i.extent()),Ff&&dj.scale(jg).updateScaleExtent()),mh||!lh&&!kh||(S=Kc(Jc(X),kh),pg.tickValues(S),sg.tickValues(S))),kg.domain(Xb(X,"y")),lg.domain(Xb(X,"y2")),O.axisX.call(pg),O.axisY.call(qg),O.axisY2.call(rg),O.axisSubX.call(sg),G&&X.length)if(ih&&S){for(T=1;T=0&&xf.select(this).style("display",b%U?"none":"block")})}else ej.selectAll("."+f.axisX+" .tick text").style("display","block");if(!bh&&nh&&eb(c,O.axisX,nh),J=Qe(V),M=Re(V,!0),N=Re(V,!1),Db(),ng.domain(kg.domain()),og.domain(lg.domain()),jj.style("display","none"),o(),gj.select("line."+f.xgridFocus).style("visibility","hidden"),Mh){if("year"===Nh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=jg.ticks(10);i=gj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",bh?0:function(a){return jg(a)-pg.tickOffset()}).attr("x2",bh?Qf:function(a){return jg(a)-pg.tickOffset()}).attr("y1",bh?function(a){return jg(a)-pg.tickOffset()}:Nf.top).attr("y2",bh?function(a){return jg(a)-pg.tickOffset()}:Sf).style("opacity",function(){return+xf.select(this).attr(bh?"y1":"x1")===(bh?Sf:0)?0:1}),i.exit().remove()}we(Oh)&&(k=gj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Oh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",bh?"":"rotate(-90)").attr("dx",bh?0:-Nf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",bh?0:Dd).attr("x2",bh?Qf:Dd).attr("y1",bh?Dd:Nf.top).attr("y2",bh?Dd:Sf).style("opacity",1),k.select("text").transition().duration(P).attr("x",bh?Qf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Ph&&(m=gj.select("."+f.ygrids).selectAll("."+f.ygrid).data(kg.ticks(Rh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",bh?kg:0).attr("x2",bh?kg:Qf).attr("y1",bh?0:kg).attr("y2",bh?Sf:kg),m.exit().remove()),A&&we(Qh)&&(n=gj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Qh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",bh?"rotate(-90)":"").attr("dx",bh?0:-Nf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",bh?Ed:0).attr("x2",bh?Ed:Qf).attr("y1",bh?0:Ed).attr("y2",bh?Sf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",bh?0:Qf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=gj.select("."+f.regions).selectAll("rect."+f.region).data(mi),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=gj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Ji(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=gj.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return bh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),gj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1),gj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",bj).style("opacity",mj),q=gj.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",He),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud),q.exit().remove(),gj.each(function(){Hi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=xf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Hi=!1}),gj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),gj.select("."+f.chartArcsTitle).style("opacity",de(yf.data.targets)?1:0),Ug&&(null!==xf.event&&"zoom"===xf.event.type&&_i.extent(jg.orgDomain()).update(),B&&(!bh&&nh&&eb(e,O.axisSubX,nh),_i.empty()||_i.extent(jg.orgDomain()).update(),K=Qe(V,!0),u=hj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Ji(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),hj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",cj).style("opacity",1))),gj.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),gj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud),v=gj.select("."+f.eventRects),we(ug)&&!oc(ug)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=gj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ye(w.enter()),w.attr("x",0).attr("y",0).attr("width",Qf).attr("height",Sf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ci&&!Bi?(z=function(a,b){var c=xc(b),d=yc(b),e=yf.data.xs[a.id][b];return(jg(d?d:e+50)-jg(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=yf.data.xs[a.id][b];return(jg(d)+jg(c?c:d-50))/2}):(z=L(),y=function(a){return jg(a.x)-z/2}),x=Ac(yf.data.targets),gj.select("."+f.eventRects).datum(x?x.values:[]),w=gj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Xe(w.enter()),w.attr("class",fd).attr("x",bh?0:y).attr("y",bh?y:0).attr("width",bh?Qf:z).attr("height",bh?z:Sf),w.exit().remove()),Cc(yf.data.targets).forEach(function(a){nj[a]=!0})}function cf(){bf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function df(){return"mousemove"===xf.event.sourceEvent.type&&dj.altDomain?(jg.domain(dj.altDomain),void dj.scale(jg).updateScaleExtent()):(Bi&&jg.orgDomain()[0]===lj[0]&&jg.domain([lj[0]-1e-10,jg.orgDomain()[1]]),bf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===xf.event.sourceEvent.type&&(Fi=!0)))}function ef(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function ff(){ej.attr("width",Uf).attr("height",Vf),ej.select("#"+ui).select("rect").attr("width",Qf).attr("height",Sf),ej.select("#"+vi).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),ej.select("#"+wi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej.select("."+f.zoomRect).attr("width",Qf).attr("height",Sf),kj.style("max-height",Vf+"px")}function gf(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),ff(),m(a.withTransition),bf(a)}function hf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=gj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Ji(a)}),e=gj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Lg(a)?"pointer":null}),c=gj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ji(a)}),b.append("path").attr("class",dd).style("opacity",function(){return mj=+xf.select(this).style("opacity"),0}).style("fill",function(a){return Ji(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Ji(a)}).style("cursor",function(a){return Lg(a)?"pointer":null}),a.forEach(function(a){gj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=gj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(ag(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Ji(a.data)}).style("cursor",function(a){return Lg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Hi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),of(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,xf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Hi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),pf(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Ug&&(n=hj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Ji(a)}),l=hj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ji(a)})),ej.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Mf).style("opacity",1)}function jf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),yf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Ti?j:i,l=Ti?Q():P();return d&&(w=0,C=0,t=0,u=0),Xg&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Ti?u:t,void(ah?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=ij.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,Ti?(g=function(a){return t*(.2+B[a])},j=function(a){return A[B[a]]+x[a]}):(g=function(a){return A[B[a]]+x[a]},j=function(a){return u*(.2+B[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=ij.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Zg?Zg(a):yf.toggle(a)}).on("mouseover",function(a){xf.select(this).classed(f.legendItemFocused,!0),Hi||yf.focus(a),"function"==typeof $g&&$g(a)}).on("mouseout",function(a){xf.select(this).classed(f.legendItemFocused,!1),Hi||yf.revert(),"function"==typeof _g&&_g(a)}),o.append("text").text(function(a){return d(xg[a])?xg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ti?h:-200).attr("y",Ti?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ti?i:-200).attr("y",Ti?-200:l).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Ji(a)}).attr("x",Ti?h:-200).attr("y",Ti?-200:j).attr("width",10).attr("height",10),ij.selectAll("text").data(a).text(function(a){return d(xg[a])?xg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),ij.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),ij.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),ij.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=xf.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?mf(b):nf(b):Xi}),N(t),O(u),M(C),n(),R(),ff(),m(q,c)}function tf(a){return Ec(yf.data.targets,a.id)}function uf(a){return"data"in a&&Ec(yf.data.targets,a.data.id)}function vf(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 wf(a,b,c){var d=!ee(yf.data.targets);Hi=!1,$d(a,b),gf(c||{withTransitionForAxis:d})}var xf=a.d3?a.d3:a.require?a.require("d3"):void 0,yf={data:{},axis:{},legend:{}},zf={},Af=h(["bindto"],"#chart"),Bf=h(["size","width"]),Cf=h(["size","height"]),Df=h(["padding","left"],50),Ef=h(["padding","right"]),Ff=h(["zoom","enabled"],!1),Gf=h(["zoom","extent"]),Hf=h(["zoom","privileged"],!1),If=h(["onenter"],function(){}),Jf=h(["onleave"],function(){}),Kf=h(["onresize"],function(){}),Lf=h(["onresized"],function(){}),Mf=h(["transition","duration"],350);g("data","data is required in config");var Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg=h(["data","x"]),ug=h(["data","xs"],{}),vg=h(["data","x_format"]),wg=h(["data","id_converter"],function(a){return a}),xg=h(["data","names"],{}),yg=h(["data","classes"],{}),zg=h(["data","groups"],[]),Ag=h(["data","axes"],{}),Bg=h(["data","type"]),Cg=h(["data","types"],{}),Dg=h(["data","labels"],{}),Eg=h(["data","order"]),Fg=h(["data","regions"],{}),Gg=h(["data","color"]),Hg=h(["data","colors"],{}),Ig=h(["data","hide"],!1),Jg=h(["data","selection","enabled"],!1),Kg=h(["data","selection","grouped"],!1),Lg=h(["data","selection","isselectable"],function(){return!0}),Mg=h(["data","selection","multiple"],!0),Ng=h(["data","onclick"],function(){}),Og=h(["data","onenter"],function(){}),Pg=h(["data","onleave"],function(){}),Qg=h(["data","onselected"],function(){}),Rg=h(["data","onunselected"],function(){}),Sg=h(["data","ondragstart"],function(){}),Tg=h(["data","ondragend"],function(){}),Ug=h(["subchart","show"],!1),Vg=h(["subchart","size","height"],60),Wg=h(["color","pattern"],[]),Xg=h(["legend","show"],!0),Yg=h(["legend","position"],"bottom"),Zg=h(["legend","item","onclick"]),$g=h(["legend","item","onmouseover"]),_g=h(["legend","item","onmouseout"]),ah=h(["legend","equally"],!1),bh=h(["axis","rotated"],!1),ch=h(["axis","x","show"],!0),dh=h(["axis","x","type"],"indexed"),eh=h(["axis","x","localtime"],!0),fh=h(["axis","x","categories"],[]),gh=h(["axis","x","tick","centered"],!1),hh=h(["axis","x","tick","format"]),ih=h(["axis","x","tick","culling"],{}),jh=h(["axis","x","tick","culling","max"],10),kh=h(["axis","x","tick","count"]),lh=h(["axis","x","tick","fit"],!0),mh=h(["axis","x","tick","values"],null),nh=h(["axis","x","tick","rotate"]),oh=h(["axis","x","max"],null),ph=h(["axis","x","min"],null),qh=h(["axis","x","padding"],{}),rh=h(["axis","x","height"]),sh=h(["axis","x","default"]),th=h(["axis","x","label"],{}),uh=h(["axis","y","show"],!0),vh=h(["axis","y","max"]),wh=h(["axis","y","min"]),xh=h(["axis","y","center"]),yh=h(["axis","y","label"],{}),zh=h(["axis","y","inner"],!1),Ah=h(["axis","y","tick","format"]),Bh=h(["axis","y","padding"]),Ch=h(["axis","y","ticks"],10),Dh=h(["axis","y2","show"],!1),Eh=h(["axis","y2","max"]),Fh=h(["axis","y2","min"]),Gh=h(["axis","y2","center"]),Hh=h(["axis","y2","label"],{}),Ih=h(["axis","y2","inner"],!1),Jh=h(["axis","y2","tick","format"]),Kh=h(["axis","y2","padding"]),Lh=h(["axis","y2","ticks"],10),Mh=h(["grid","x","show"],!1),Nh=h(["grid","x","type"],"tick"),Oh=h(["grid","x","lines"],[]),Ph=h(["grid","y","show"],!1),Qh=h(["grid","y","lines"],[]),Rh=h(["grid","y","ticks"],10),Sh=h(["point","show"],!0),Th=h(["point","r"],2.5),Uh=h(["point","focus","line","enabled"],!0),Vh=h(["point","focus","expand","enabled"],!0),Wh=h(["point","focus","expand","r"]),Xh=h(["point","focus","select","r"]),Yh=h(["line","connect_null"],!1),Zh=h(["bar","width"]),$h=h(["bar","width","ratio"],.6),_h=h(["pie","label","show"],!0),ai=h(["pie","label","format"]),bi=h(["pie","expand"],!0),ci=h(["pie","onclick"],function(){}),di=h(["pie","onmouseover"],function(){}),ei=h(["pie","onmouseout"],function(){}),fi=h(["donut","label","show"],!0),gi=h(["donut","label","format"]),hi=h(["donut","expand"],!0),ii=h(["donut","title"],""),ji=h(["donut","onclick"],function(){}),ki=h(["donut","onmouseover"],function(){}),li=h(["donut","onmouseout"],function(){}),mi=h(["regions"],[]),ni=h(["tooltip","show"],!0),oi=h(["tooltip","format","title"]),pi=h(["tooltip","format","value"]),qi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=oi?oi:b,l=pi?pi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id,a[g].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),ri=h(["tooltip","init","show"],!1),si=h(["tooltip","init","x"],0),ti=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ui=("string"==typeof Af?Af.replace("#",""):Af.id)+"-clip",vi=ui+"-xaxis",wi=ui+"-yaxis",xi=i(ui),yi=i(vi),zi=i(wi),Ai="timeseries"===dh,Bi="categorized"===dh,Ci=!Ai&&(tg||we(ug)),Di=null,Ei=!1,Fi=!1,Gi=!1,Hi=!1,Ii=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ji=qe(Hg,we(Wg)?Wg:Ii,Gg),Ki=eh?xf.time.format:xf.time.format.utc,Li=function(){var a=[[Ki("%Y/%-m/%-d"),function(){return!0}],[Ki("%-m/%-d"),function(a){return a.getMonth()}],[Ki("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ki("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ki("%I %p"),function(a){return a.getHours()}],[Ki("%I:%M"),function(a){return a.getMinutes()}],[Ki(":%S"),function(a){return a.getSeconds()}],[Ki(".%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)}}(),Mi=[],Ni=[],Oi=bh?"left":"bottom",Pi=bh?zh?"top":"bottom":zh?"right":"left",Qi=bh?Ih?"bottom":"top":Ih?"left":"right",Ri=bh?"left":"bottom",Si={main:function(){return"translate("+Nf.left+","+Nf.top+")"},context:function(){return"translate("+Of.left+","+Of.top+")"},legend:function(){return"translate("+Pf.left+","+Pf.top+")"},x:function(){return"translate(0,"+(bh?0:Sf)+")"},y:function(){return"translate(0,"+(bh?Sf:0)+")"},y2:function(){return"translate("+(bh?0:Qf)+","+(bh?1:0)+")"},subx:function(){return"translate(0,"+(bh?0:Tf)+")"},arc:function(){return"translate("+Qf/2+","+Sf/2+")"}},Ti="right"===Yg,Ui=0,Vi=0,Wi=0,Xi=.15,Yi=30,Zi=bh&&!ch?0:30,$i=5;ag=xf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var _i,aj=function(){var a=xf.svg.line().x(bh?function(a){return V(a.id)(a.value)}:Cd).y(bh?Cd:function(a){return V(a.id)(a.value)});return Yh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Yh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Fg[b.id]?Ve(e,jg,V(b.id),Fg[b.id]):a(e)):(c=e[0]?jg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,bh?"M "+d+" "+c:"M "+c+" "+d)}}(),bj=function(){var a;return a=bh?xf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):xf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?jg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,bh?"M "+d+" "+c:"M "+c+" "+d)}}(),cj=function(){var a=xf.svg.line().x(bh?function(a){return W(a.id)(a.value)}:Fd).y(bh?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+mg(c[0].x)+" "+W(b.id)(c[0].value)}}(),dj=function(){};_i=xf.svg.brush().on("brush",cf),_i.update=function(){return hj&&hj.select("."+f.brush).call(this),this},_i.scale=function(a){return bh?this.y(a):this.x(a)},Ff&&(dj=xf.behavior.zoom().on("zoomstart",function(){dj.altDomain=xf.event.sourceEvent.altKey?jg.orgDomain():null}).on("zoom",Ff?df:null),dj.scale=function(a){return bh?this.y(a):this.x(a)},dj.orgScaleExtent=function(){var a=Gf?Gf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},dj.updateScaleExtent=function(){var a=ac(jg.orgDomain())/ac(lj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var ej,fj,gj,hj,ij,jj,kj,lj,mj,nj={};if(yf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);yf.revert(),yf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(yf.data.targets)&&Nb(a,!0),of(a,!0)},yf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);yf.revert(),b(d.classed(f.focused,!1)),b(e),ee(yf.data.targets)&&Ob(a),of(a,!1)},yf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);b(d.classed(f.focused,!1)),b(e),ee(yf.data.targets)&&Ob(a),pf()},yf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),ej.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&qf(a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},yf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),ej.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&rf(a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},yf.toggle=function(a){Gc(a)?yf.hide(a):yf.show(a)},yf.unzoom=function(){_i.clear().update(),bf({withUpdateXDomain:!0})},yf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){yg[b]=a.classes[b]}),"categories"in a&&Bi&&(fh=a.categories,pg.categories(fh)),"cacheIds"in a&&bc(a.cacheIds)?void jf(dc(a.cacheIds),a.done):void("unload"in a?lf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){kf(a)}):kf(a))},yf.unload=function(a,b){lf(Dc(a),function(){bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},yf.selected=function(a){return xf.merge(gj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return xf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},yf.select=function(a,b,c){Jg&&gj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=xf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Kg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Lg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},yf.unselect=function(a,b){Jg&&gj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=xf.select(this),g="circle"===this.nodeName?Be:Ee,h=Kg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Lg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},yf.toLine=function(a){wf(a,"line")},yf.toSpline=function(a){wf(a,"spline")},yf.toBar=function(a){wf(a,"bar")},yf.toScatter=function(a){wf(a,"scatter")},yf.toArea=function(a){wf(a,"area")},yf.toAreaSpline=function(a){wf(a,"area-spline") },yf.toPie=function(a){wf(a,"pie",{withTransform:!0})},yf.toDonut=function(a){wf(a,"donut",{withTransform:!0})},yf.groups=function(a){return c(a)?zg:(zg=a,bf(),zg)},yf.xgrids=function(a){return a?(Oh=a,bf(),Oh):Oh},yf.xgrids.add=function(a){return a?yf.xgrids(Oh.concat(a)):void 0},yf.xgrids.remove=function(a){var b=vf(a);return yf.xgrids(Oh.filter(b))},yf.ygrids=function(a){return a?(Qh=a,bf(),Qh):Qh},yf.ygrids.add=function(a){return a?yf.ygrids(Qh.concat(a)):void 0},yf.ygrids.remove=function(a){var b=vf(a);return yf.ygrids(Qh.filter(b))},yf.regions=function(a){return c(a)?mi:(mi=a,bf(),mi)},yf.regions.add=function(a){return c(a)?mi:(mi=mi.concat(a),bf(),mi)},yf.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;ej.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),mi=mi.filter(function(b){return b.classes.indexOf(a)<0})}),mi},yf.data.get=function(a){var b=yf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},yf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},yf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){xg[b]=a[b]}),sf(Cc(yf.data.targets),{withTransition:!0}),xg):xg},yf.x=function(a){return arguments.length&&(qc(yf.data.targets,a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),yf.data.xs},yf.xs=function(a){return arguments.length&&(rc(yf.data.targets,a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),yf.data.xs},yf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},yf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(vh=+a.y),b(a.y2)&&(Eh=+a.y2)):vh=Eh=+a,bf())},yf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(wh=+a.y),b(a.y2)&&(Fh=+a.y2)):wh=Fh=+a,bf())},yf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&yf.axis.max(a.max),"undefined"!=typeof a.min&&yf.axis.min(a.min))},yf.legend.show=function(a){qf(Dc(a)),bf({withLegend:!0})},yf.legend.hide=function(a){rf(Dc(a)),bf({withLegend:!0})},yf.resize=function(a){Bf=a?a.width:null,Cf=a?a.height:null,gf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},yf.destroy=function(){yf.data.targets=void 0,yf.data.xs={},kj.html(""),a.onresize=null},"url"in e.data)xf.xhr(e.data.url,function(a,b){var c,d=xf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=xf.csv.parse(b.response),We(c)});else if("rows"in e.data)We(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");We(uc(e.data.columns))}return yf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 9516a9a99bd2c5f0a6b09c22006f668823d2f72f Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Thu, 1 May 2014 16:13:24 +0900 Subject: [PATCH 111/178] Add samples --- htdocs/samples/axes_x_tick_culling.html | 39 +++++++++++++++++++++++++ htdocs/samples/grids.html | 32 ++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 htdocs/samples/axes_x_tick_culling.html create mode 100644 htdocs/samples/grids.html diff --git a/htdocs/samples/axes_x_tick_culling.html b/htdocs/samples/axes_x_tick_culling.html new file mode 100644 index 0000000..f0f54ca --- /dev/null +++ b/htdocs/samples/axes_x_tick_culling.html @@ -0,0 +1,39 @@ + + + + + +
+ + + + + + diff --git a/htdocs/samples/grids.html b/htdocs/samples/grids.html new file mode 100644 index 0000000..04c06da --- /dev/null +++ b/htdocs/samples/grids.html @@ -0,0 +1,32 @@ + + + + + +
+ + + + + + From 271ddb556983f7950c6bb32d049828678835a182 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Thu, 1 May 2014 16:36:55 +0900 Subject: [PATCH 112/178] Refactor clip path --- c3.js | 25 ++++--------------------- c3.min.js | 2 +- 2 files changed, 5 insertions(+), 22 deletions(-) diff --git a/c3.js b/c3.js index e3a8be3..9b0bbeb 100644 --- a/c3.js +++ b/c3.js @@ -2602,32 +2602,15 @@ // Define svgs svg = selectChart.append("svg") - .attr("width", width + margin.left + margin.right) - .attr("height", height + margin.top + margin.bottom) .on('mouseenter', __onenter) .on('mouseleave', __onleave); // Define defs defs = svg.append("defs"); - defs.append("clipPath") - .attr("id", clipId) - .append("rect") - .attr("width", width) - .attr("height", height); - defs.append("clipPath") - .attr("id", clipIdForXAxis) - .append("rect") - .attr("x", getXAxisClipX) - .attr("y", getXAxisClipY) - .attr("width", getXAxisClipWidth) - .attr("height", getXAxisClipHeight); - defs.append("clipPath") - .attr("id", clipIdForYAxis) - .append("rect") - .attr("x", getYAxisClipX) - .attr("y", getYAxisClipY) - .attr("width", getYAxisClipWidth) - .attr("height", getYAxisClipHeight); + defs.append("clipPath").attr("id", clipId).append("rect"); + defs.append("clipPath").attr("id", clipIdForXAxis).append("rect"); + defs.append("clipPath").attr("id", clipIdForYAxis).append("rect"); + updateSvgSize(); // Define regions main = svg.append("g").attr("transform", translate.main); diff --git a/c3.min.js b/c3.min.js index 9bc9bc2..77cbfda 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.33"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",legendItemFocused:"c3-legend-item-focused",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;cQf&&(Qf=0),0>Sf&&(Sf=0),Rf=bh?Nf.left-Yi-Zi:Qf,Tf=bh?Sf:Vf-Of.top-Of.bottom,0>Rf&&(Rf=0),0>Tf&&(Tf=0),p(),Ti&&ee(yf.data.targets)&&(Pf.left=Qf/2+Xf)}function o(){gj.select("line."+f.xgridFocus).attr("x1",bh?0:-10).attr("x2",bh?Qf:-10).attr("y1",bh?-10:Nf.top).attr("y2",bh?-10:Sf)}function p(){Xf=Sf/2,Wf=.95*Xf,Yf=de(yf.data.targets)?.6*Wf:0}function q(){var a=bh?f.axisX:f.axisY,b=gj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=xf.select(Af).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Bf?Bf:x()}function s(){var a=Cf?Cf:y();return a>0?a:320}function t(){return ee(yf.data.targets)?0:Df?Df:bh?ch?v("x"):1:!uh||zh?1:v("y")}function u(){var a=1;return ee(yf.data.targets)?0:Ef?Ef:Ti?P()+(Dh&&!bh?v("y2"):a):Dh?Ih||bh?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||ch?"x"===a&&rh?rh:"y"!==a||uh?"y2"!==a||Dh?(jb(a).isInner?30:40)+("y2"===a?-10:0):$i:Xg&&!Ti?10:1:0}function x(){return+xf.select(Af).style("width").replace("px","")}function y(){return+xf.select(Af).style("height").replace("px","")}function z(a){return a?-5:-(Nf.left-1)}function A(a){return a?-20:-4}function B(){return z(!bh)}function C(){return A(!bh)}function D(){return z(bh)}function E(){return A(bh)}function F(a){return a?Qf+2+4:Nf.left+20}function G(a){return a?(rh?rh:0)+80:Sf+8}function H(){return F(!bh)}function I(){return G(!bh)}function J(){return F(bh)}function K(){return G(bh)}function L(){var a,b,c,d,e,f=Ac(yf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=jg(b.x)-jg(a.x),0===c?bh?Sf:Qf:(d=zc(),e=ae(yf.data.targets)?(d-(Bi?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function M(a){Ui=a}function N(a){Vi=a}function O(a){Wi=a}function P(){return Xg?Ti?Vi*(Ui+1):Uf:0}function Q(){return Xg?Ti?Vf:Wi*(Ui+1):0}function R(){var a,b,c=!jg;bg=bh?1:0,cg=bh?Sf:Qf,dg=bh?0:Sf,eg=bh?Qf:1,fg=bg,gg=cg,hg=bh?0:Tf,ig=bh?Rf:1,jg=T(bg,cg,c?void 0:jg.domain(),function(){return pg.tickOffset()}),kg=U(dg,eg,c?void 0:kg.domain()),lg=U(dg,eg,c?void 0:lg.domain()),mg=T(bg,cg,lj,function(a){return a%1?0:sg.tickOffset()}),ng=U(hg,ig,c?void 0:ng.domain()),og=U(hg,ig,c?void 0:og.domain()),a=$(),b=mh?mh:c?void 0:pg.tickValues(),pg=X(jg,Oi,a,b),sg=X(mg,Ri,a,b),qg=Y(kg,Pi,Ah,Ch),rg=Y(lg,Qi,Jh,Lh),c||(_i.scale(mg),Ff&&dj.scale(jg)),S()}function S(){Zf=Gb(),$f=Hb(),_f=Hb(.98)}function T(a,b,d,e){var f=(Ai?xf.time.scale():xf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Bi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=xf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?lg:kg}function W(a){return"y2"===Z(a)?og:ng}function X(a,b,c,d){var e=(Bi?Eb():xf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Bi?(e.tickCentered(gh),ve(ih)&&(ih=!1)):e.tickOffset=function(){var a=Bc(yf.data.targets),b=jg(a[1])-jg(a[0]),c=b?b:bh?Sf:Qf;return c/zc()/2},Bi&&e.categories(fh),e}function Y(a,b,c,d){return xf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Ag?Ag[a]:"y"}function $(){var a=Ai?Li:Bi?Tc:function(a){return 0>a?a.toFixed(0):a};return hh&&("function"==typeof hh?a=hh:Ai&&(a=function(a){return a?Ki(hh)(a):""})),a}function _(a){var b;return"y"===a?b=yh:"y2"===a?b=Hh:"x"===a&&(b=th),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?yh=b:"y2"===a?Hh=b:"x"===a&&(th=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",bh?"inner-top":"inner-right")}function hb(){return fb("y",bh?"inner-right":"inner-top")}function ib(){return fb("y2",bh?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Qf/2:Qf:b.isBottom?-Sf:b.isMiddle?-Sf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!bh,gb())}function rb(){return nb(bh,hb())}function sb(){return nb(bh,ib())}function tb(){return ob(!bh,gb())}function ub(){return ob(bh,hb())}function vb(){return ob(bh,ib())}function wb(){var a=gb();return bh?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":rh?rh-10:"3em"}function xb(){var a=hb();return bh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return bh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!bh,gb())}function Ab(){return pb(bh,hb())}function Bb(){return pb(bh,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return xf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){gj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),gj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),gj.select("."+f.axisY2+" ."+f.axisY2Label).transition().attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 xf.min(Object.keys(i).map(function(a){return xf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(zg.length>0)for(g=Sc(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 xf.max(Object.keys(i).map(function(a){return xf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Fh:wh,n="y2"===c?Eh:vh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Gh:xh,r=ud()&&bh;return 0===l.length?"y2"===c?lg.domain():kg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(kg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Bh&&(f=b(Bh.top)?Bh.top:e,g=b(Bh.bottom)?Bh.bottom:e),"y2"===c&&Kh&&(f=b(Kh.top)?Kh.top:e,g=b(Kh.bottom)?Kh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return ph?Ai?re(ph):ph:xf.min(a,function(a){return xf.min(a.values,function(a){return a.x})})}function Zb(a){return oh?Ai?re(oh):oh:xf.max(a,function(a){return xf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Bi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof qh&&we(qh)?(e=b(qh.left)?qh.left:d,f=b(qh.right)?qh.right:d):e=f="number"==typeof qh?qh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return c-d===0&&(c=Ai?new Date(.5*c.getTime()):-.5,d=Ai?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Ai?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Ai?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?kg:lg;return b="y"===a.axis||"y2"===a.axis?bh?Sf:"start"in a?d(a.start):Sf:bh?"end"in a?jg(Ai?re(a.end):a.end):Sf:Sf,c>b?0:b-c}function ic(a){return tg&&a===tg||we(ug)&&xe(ug,a)}function jc(a){return!ic(a)}function kc(a){return tg?tg:we(ug)?ug[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=yf.data.xs[b])}),c}function mc(a,b){return a in yf.data.xs&&yf.data.xs[a]&&yf.data.xs[a][b]?yf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){ug[b]=a[b]})}function oc(a){return 1===xf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=xg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),yf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=Ai?a?a instanceof Date?a:re(a):re(mc(c,d)):Ci&&!Bi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?yf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):tg?(d=Object.keys(yf.data.xs),yf.data.xs[c]=d.length>0?yf.data.xs[d[0]]:void 0):we(ug)&&(yf.data.xs[c]=lc(f,yf.data.targets)):yf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!yf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=wg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ci&&Bi&&0===c&&g&&(0===e&&(fh=[]),fh.push(g)),("undefined"==typeof a[b]||yf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Bg&&$d(Cc(c).filter(function(a){return!(a in Cg)}),Bg),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&yf.data.targets[0].values[a-1]?yf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(yf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Ai?new Date(i):i);j.push(e)}return Ai||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Mi=Mi.concat(a)}function Mc(a){Mi=Mi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Ni=Ni.concat(a)}function Oc(a){Ni=Ni.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return xf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Ld(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 Md(){return Eg&&"desc"===Eg.toLowerCase()}function Nd(){return Eg&&"asc"===Eg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Eg&&a.sort(Eg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(yf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&ni&&(jj.html(qi(a,$(),wd(k),Ji)).style("display","block"),d=jj.property("offsetWidth"),e=jj.property("offsetHeight"),k?(g=Qf/2+c[0],i=Sf/2+c[1]+20):(bh?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=jg(l[0].x)+20):(f=q(),g=f+t()+jg(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),jj.style("top",i+"px").style("left",g+"px"))}function Qd(){jj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});ni&&(be(yf.data.targets)||ee(yf.data.targets)||gj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(bh?"y1":"x1",Cd).attr(bh?"y2":"x2",Cd))}function Sd(){gj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?jg(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return"number"==typeof Zh?Zh:b?2*a.tickOffset()*$h/b:0}function $d(a,b){Dc(a).forEach(function(a){nj[a]=b===Cg[a],Cg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Cg[a.id]===b&&(c=!0),a.id in Cg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Cg)||"line"===Cg[b]||"spline"===Cg[b]||"area"===Cg[b]||"area-spline"===Cg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Cg[b]||"area-spline"===Cg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Cg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Cg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Cg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Cg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&hi||je(a)&&bi}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function re(b){var c;try{c=vg?xf.time.format(vg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+vg)}return c}function se(a,b){var c=xf.mouse(a),d=xf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?kg:lg,d=bh?1:0,e=bh?0:1;return Math.pow(jg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Qg(b,a.node()),gj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud).attr("stroke",function(){return Ji(b)}).attr("r",1.4*Je(b)).transition().duration(100).attr("r",Je)}function Be(a,b,c){Rg(b,a.node()),gj.select("."+f.selectedCircles+ld(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){Qg(b,a.node()),a.transition().duration(100).style("fill",function(){return xf.rgb(Ji(b)).darker(1)})}function Ee(a,b){Rg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ji(b)})}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){return Sh?"function"==typeof Th?Th(a):Th:0}function Ie(a){return Vh?Wh?Wh:1.75*He(a):He(a)}function Je(a){return Xh?Xh:4*He(a)}function Ke(a,c){return(c?gj.selectAll("."+f.circles+ld(c)):gj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Le(a,b){Ke(a,b).classed(f.EXPANDED,!0).attr("r",Ie)}function Me(a){Ke(a).filter(function(){return xf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",He)}function Ne(a){return gj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Oe(a){Ne(a).classed(f.EXPANDED,!0)}function Pe(a){Ne(a).classed(f.EXPANDED,!1)}function Qe(a,b){var c=Ue(a,b);return function(a,b){var d=c(a,b),e=bh?1:0,f=bh?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 Re(a,b){var c=Ue(a,!1),d=b?Se:Te;return function(a,b){return d(c(a,b),a,this)}}function Se(a,b){var c;return bh?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Te(a,b,c){var d=c.getBoundingClientRect();return bh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Ue(a,b){var c=a.__max__+1,d=Zd(pg,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return bh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Ve(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 We(b){var c,d,e;if(kj=xf.select(Af),kj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(kj.html("").classed("c3",!0),yf.data.xs={},yf.data.targets=vc(b),Ig&&Lc(Ig===!0?Cc(yf.data.targets):Ig),n(),R(),jg.domain(xf.extent(_b(yf.data.targets))),kg.domain(Xb(yf.data.targets,"y")),lg.domain(Xb(yf.data.targets,"y2")),mg.domain(jg.domain()),ng.domain(kg.domain()),og.domain(lg.domain()),lj=jg.domain(),_i.scale(mg),Ff&&dj.scale(jg),ej=kj.append("svg").attr("width",Qf+Nf.left+Nf.right).attr("height",Sf+Nf.top+Nf.bottom).on("mouseenter",If).on("mouseleave",Jf),fj=ej.append("defs"),fj.append("clipPath").attr("id",ui).append("rect").attr("width",Qf).attr("height",Sf),fj.append("clipPath").attr("id",vi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),fj.append("clipPath").attr("id",wi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),gj=ej.append("g").attr("transform",Si.main),hj=ej.append("g").attr("transform",Si.context),ij=ej.append("g").attr("transform",Si.legend),Ug||hj.style("visibility","hidden"),Xg||(ij.style("visibility","hidden"),Ni=Cc(yf.data.targets)),jj=xf.select(Af).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),sf(Cc(yf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=gj.append("g").attr("clip-path",xi).attr("class",f.grid),Mh&&d.append("g").attr("class",f.xgrids),we(Oh)&&d.append("g").attr("class",f.xgridLines),Uh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Ph&&d.append("g").attr("class",f.ygrids),we(Qh)&&d.append("g").attr("class",f.ygridLines),ch&&gj.append("g").attr("class",f.axisX).attr("clip-path",yi).attr("transform",Si.x).append("text").attr("class",f.axisXLabel).attr("transform",bh?"rotate(-90)":"").style("text-anchor",zb),uh&&gj.append("g").attr("class",f.axisY).attr("clip-path",zi).attr("transform",Si.y).append("text").attr("class",f.axisYLabel).attr("transform",bh?"":"rotate(-90)").style("text-anchor",Ab),Dh&&gj.append("g").attr("class",f.axisY2).attr("transform",Si.y2).append("text").attr("class",f.axisY2Label).attr("transform",bh?"":"rotate(-90)").style("text-anchor",Bb),gj.append("g").attr("clip-path",xi).attr("class",f.regions),gj.append("g").attr("clip-path",xi).attr("class",f.chart),c=gj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ff?bh?"ns-resize":"ew-resize":null),gj.select("."+f.chart).append("g").attr("class",f.chartBars),gj.select("."+f.chart).append("g").attr("class",f.chartLines),gj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Si.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),gj.select("."+f.chart).append("g").attr("class",f.chartTexts),Ff&&gj.insert("rect",Hf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Qf).attr("height",Sf).style("opacity",0).style("cursor",bh?"ns-resize":"ew-resize").call(dj).on("dblclick.zoom",null),sh&&_i.extent("function"!=typeof sh?sh:sh(_b())),hj.append("g").attr("clip-path",xi).attr("class",f.chart),hj.select("."+f.chart).append("g").attr("class",f.chartBars),hj.select("."+f.chart).append("g").attr("class",f.chartLines),hj.append("g").attr("clip-path",xi).attr("class",f.brush).call(_i).selectAll("rect").attr(bh?"width":"height",bh?Rf:Tf),hj.append("g").attr("class",f.axisX).attr("transform",Si.subx).attr("clip-path",bh?"":yi),hf(yf.data.targets),bh?gj.select("."+f.axisX).style("opacity",0).call(pg):(gj.select("."+f.axisY).style("opacity",0).call(qg),gj.select("."+f.axisY2).style("opacity",0).call(rg)),n(),R(),ff(),m(!1),bf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),ri){if(Ai&&"string"==typeof si){for(si=re(si),e=0;eQf&&(Qf=0),0>Sf&&(Sf=0),Rf=bh?Nf.left-Yi-Zi:Qf,Tf=bh?Sf:Vf-Of.top-Of.bottom,0>Rf&&(Rf=0),0>Tf&&(Tf=0),p(),Ti&&ee(yf.data.targets)&&(Pf.left=Qf/2+Xf)}function o(){gj.select("line."+f.xgridFocus).attr("x1",bh?0:-10).attr("x2",bh?Qf:-10).attr("y1",bh?-10:Nf.top).attr("y2",bh?-10:Sf)}function p(){Xf=Sf/2,Wf=.95*Xf,Yf=de(yf.data.targets)?.6*Wf:0}function q(){var a=bh?f.axisX:f.axisY,b=gj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=xf.select(Af).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Bf?Bf:x()}function s(){var a=Cf?Cf:y();return a>0?a:320}function t(){return ee(yf.data.targets)?0:Df?Df:bh?ch?v("x"):1:!uh||zh?1:v("y")}function u(){var a=1;return ee(yf.data.targets)?0:Ef?Ef:Ti?P()+(Dh&&!bh?v("y2"):a):Dh?Ih||bh?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||ch?"x"===a&&rh?rh:"y"!==a||uh?"y2"!==a||Dh?(jb(a).isInner?30:40)+("y2"===a?-10:0):$i:Xg&&!Ti?10:1:0}function x(){return+xf.select(Af).style("width").replace("px","")}function y(){return+xf.select(Af).style("height").replace("px","")}function z(a){return a?-5:-(Nf.left-1)}function A(a){return a?-20:-4}function B(){return z(!bh)}function C(){return A(!bh)}function D(){return z(bh)}function E(){return A(bh)}function F(a){return a?Qf+2+4:Nf.left+20}function G(a){return a?(rh?rh:0)+80:Sf+8}function H(){return F(!bh)}function I(){return G(!bh)}function J(){return F(bh)}function K(){return G(bh)}function L(){var a,b,c,d,e,f=Ac(yf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=jg(b.x)-jg(a.x),0===c?bh?Sf:Qf:(d=zc(),e=ae(yf.data.targets)?(d-(Bi?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function M(a){Ui=a}function N(a){Vi=a}function O(a){Wi=a}function P(){return Xg?Ti?Vi*(Ui+1):Uf:0}function Q(){return Xg?Ti?Vf:Wi*(Ui+1):0}function R(){var a,b,c=!jg;bg=bh?1:0,cg=bh?Sf:Qf,dg=bh?0:Sf,eg=bh?Qf:1,fg=bg,gg=cg,hg=bh?0:Tf,ig=bh?Rf:1,jg=T(bg,cg,c?void 0:jg.domain(),function(){return pg.tickOffset()}),kg=U(dg,eg,c?void 0:kg.domain()),lg=U(dg,eg,c?void 0:lg.domain()),mg=T(bg,cg,lj,function(a){return a%1?0:sg.tickOffset()}),ng=U(hg,ig,c?void 0:ng.domain()),og=U(hg,ig,c?void 0:og.domain()),a=$(),b=mh?mh:c?void 0:pg.tickValues(),pg=X(jg,Oi,a,b),sg=X(mg,Ri,a,b),qg=Y(kg,Pi,Ah,Ch),rg=Y(lg,Qi,Jh,Lh),c||(_i.scale(mg),Ff&&dj.scale(jg)),S()}function S(){Zf=Gb(),$f=Hb(),_f=Hb(.98)}function T(a,b,d,e){var f=(Ai?xf.time.scale():xf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Bi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=xf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?lg:kg}function W(a){return"y2"===Z(a)?og:ng}function X(a,b,c,d){var e=(Bi?Eb():xf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Bi?(e.tickCentered(gh),ve(ih)&&(ih=!1)):e.tickOffset=function(){var a=Bc(yf.data.targets),b=jg(a[1])-jg(a[0]),c=b?b:bh?Sf:Qf;return c/zc()/2},Bi&&e.categories(fh),e}function Y(a,b,c,d){return xf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Ag?Ag[a]:"y"}function $(){var a=Ai?Li:Bi?Tc:function(a){return 0>a?a.toFixed(0):a};return hh&&("function"==typeof hh?a=hh:Ai&&(a=function(a){return a?Ki(hh)(a):""})),a}function _(a){var b;return"y"===a?b=yh:"y2"===a?b=Hh:"x"===a&&(b=th),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?yh=b:"y2"===a?Hh=b:"x"===a&&(th=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",bh?"inner-top":"inner-right")}function hb(){return fb("y",bh?"inner-right":"inner-top")}function ib(){return fb("y2",bh?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Qf/2:Qf:b.isBottom?-Sf:b.isMiddle?-Sf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!bh,gb())}function rb(){return nb(bh,hb())}function sb(){return nb(bh,ib())}function tb(){return ob(!bh,gb())}function ub(){return ob(bh,hb())}function vb(){return ob(bh,ib())}function wb(){var a=gb();return bh?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":rh?rh-10:"3em"}function xb(){var a=hb();return bh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return bh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!bh,gb())}function Ab(){return pb(bh,hb())}function Bb(){return pb(bh,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return xf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){gj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),gj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),gj.select("."+f.axisY2+" ."+f.axisY2Label).transition().attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 xf.min(Object.keys(i).map(function(a){return xf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(zg.length>0)for(g=Sc(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 xf.max(Object.keys(i).map(function(a){return xf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Fh:wh,n="y2"===c?Eh:vh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Gh:xh,r=ud()&&bh;return 0===l.length?"y2"===c?lg.domain():kg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(kg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Bh&&(f=b(Bh.top)?Bh.top:e,g=b(Bh.bottom)?Bh.bottom:e),"y2"===c&&Kh&&(f=b(Kh.top)?Kh.top:e,g=b(Kh.bottom)?Kh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return ph?Ai?re(ph):ph:xf.min(a,function(a){return xf.min(a.values,function(a){return a.x})})}function Zb(a){return oh?Ai?re(oh):oh:xf.max(a,function(a){return xf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Bi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof qh&&we(qh)?(e=b(qh.left)?qh.left:d,f=b(qh.right)?qh.right:d):e=f="number"==typeof qh?qh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return c-d===0&&(c=Ai?new Date(.5*c.getTime()):-.5,d=Ai?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Ai?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Ai?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?kg:lg;return b="y"===a.axis||"y2"===a.axis?bh?Sf:"start"in a?d(a.start):Sf:bh?"end"in a?jg(Ai?re(a.end):a.end):Sf:Sf,c>b?0:b-c}function ic(a){return tg&&a===tg||we(ug)&&xe(ug,a)}function jc(a){return!ic(a)}function kc(a){return tg?tg:we(ug)?ug[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=yf.data.xs[b])}),c}function mc(a,b){return a in yf.data.xs&&yf.data.xs[a]&&yf.data.xs[a][b]?yf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){ug[b]=a[b]})}function oc(a){return 1===xf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=xg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),yf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=Ai?a?a instanceof Date?a:re(a):re(mc(c,d)):Ci&&!Bi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?yf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):tg?(d=Object.keys(yf.data.xs),yf.data.xs[c]=d.length>0?yf.data.xs[d[0]]:void 0):we(ug)&&(yf.data.xs[c]=lc(f,yf.data.targets)):yf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!yf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=wg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ci&&Bi&&0===c&&g&&(0===e&&(fh=[]),fh.push(g)),("undefined"==typeof a[b]||yf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Bg&&$d(Cc(c).filter(function(a){return!(a in Cg)}),Bg),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&yf.data.targets[0].values[a-1]?yf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(yf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Ai?new Date(i):i);j.push(e)}return Ai||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Mi=Mi.concat(a)}function Mc(a){Mi=Mi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Ni=Ni.concat(a)}function Oc(a){Ni=Ni.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return xf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Ld(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 Md(){return Eg&&"desc"===Eg.toLowerCase()}function Nd(){return Eg&&"asc"===Eg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Eg&&a.sort(Eg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(yf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&ni&&(jj.html(qi(a,$(),wd(k),Ji)).style("display","block"),d=jj.property("offsetWidth"),e=jj.property("offsetHeight"),k?(g=Qf/2+c[0],i=Sf/2+c[1]+20):(bh?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=jg(l[0].x)+20):(f=q(),g=f+t()+jg(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),jj.style("top",i+"px").style("left",g+"px"))}function Qd(){jj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});ni&&(be(yf.data.targets)||ee(yf.data.targets)||gj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(bh?"y1":"x1",Cd).attr(bh?"y2":"x2",Cd))}function Sd(){gj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?jg(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return"number"==typeof Zh?Zh:b?2*a.tickOffset()*$h/b:0}function $d(a,b){Dc(a).forEach(function(a){nj[a]=b===Cg[a],Cg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Cg[a.id]===b&&(c=!0),a.id in Cg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Cg)||"line"===Cg[b]||"spline"===Cg[b]||"area"===Cg[b]||"area-spline"===Cg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Cg[b]||"area-spline"===Cg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Cg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Cg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Cg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Cg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&hi||je(a)&&bi}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function re(b){var c;try{c=vg?xf.time.format(vg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+vg)}return c}function se(a,b){var c=xf.mouse(a),d=xf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?kg:lg,d=bh?1:0,e=bh?0:1;return Math.pow(jg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Qg(b,a.node()),gj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud).attr("stroke",function(){return Ji(b)}).attr("r",1.4*Je(b)).transition().duration(100).attr("r",Je)}function Be(a,b,c){Rg(b,a.node()),gj.select("."+f.selectedCircles+ld(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){Qg(b,a.node()),a.transition().duration(100).style("fill",function(){return xf.rgb(Ji(b)).darker(1)})}function Ee(a,b){Rg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ji(b)})}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){return Sh?"function"==typeof Th?Th(a):Th:0}function Ie(a){return Vh?Wh?Wh:1.75*He(a):He(a)}function Je(a){return Xh?Xh:4*He(a)}function Ke(a,c){return(c?gj.selectAll("."+f.circles+ld(c)):gj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Le(a,b){Ke(a,b).classed(f.EXPANDED,!0).attr("r",Ie)}function Me(a){Ke(a).filter(function(){return xf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",He)}function Ne(a){return gj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Oe(a){Ne(a).classed(f.EXPANDED,!0)}function Pe(a){Ne(a).classed(f.EXPANDED,!1)}function Qe(a,b){var c=Ue(a,b);return function(a,b){var d=c(a,b),e=bh?1:0,f=bh?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 Re(a,b){var c=Ue(a,!1),d=b?Se:Te;return function(a,b){return d(c(a,b),a,this)}}function Se(a,b){var c;return bh?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Te(a,b,c){var d=c.getBoundingClientRect();return bh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Ue(a,b){var c=a.__max__+1,d=Zd(pg,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return bh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Ve(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 We(b){var c,d,e;if(kj=xf.select(Af),kj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(kj.html("").classed("c3",!0),yf.data.xs={},yf.data.targets=vc(b),Ig&&Lc(Ig===!0?Cc(yf.data.targets):Ig),n(),R(),jg.domain(xf.extent(_b(yf.data.targets))),kg.domain(Xb(yf.data.targets,"y")),lg.domain(Xb(yf.data.targets,"y2")),mg.domain(jg.domain()),ng.domain(kg.domain()),og.domain(lg.domain()),lj=jg.domain(),_i.scale(mg),Ff&&dj.scale(jg),ej=kj.append("svg").on("mouseenter",If).on("mouseleave",Jf),fj=ej.append("defs"),fj.append("clipPath").attr("id",ui).append("rect"),fj.append("clipPath").attr("id",vi).append("rect"),fj.append("clipPath").attr("id",wi).append("rect"),ff(),gj=ej.append("g").attr("transform",Si.main),hj=ej.append("g").attr("transform",Si.context),ij=ej.append("g").attr("transform",Si.legend),Ug||hj.style("visibility","hidden"),Xg||(ij.style("visibility","hidden"),Ni=Cc(yf.data.targets)),jj=xf.select(Af).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),sf(Cc(yf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=gj.append("g").attr("clip-path",xi).attr("class",f.grid),Mh&&d.append("g").attr("class",f.xgrids),we(Oh)&&d.append("g").attr("class",f.xgridLines),Uh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Ph&&d.append("g").attr("class",f.ygrids),we(Qh)&&d.append("g").attr("class",f.ygridLines),ch&&gj.append("g").attr("class",f.axisX).attr("clip-path",yi).attr("transform",Si.x).append("text").attr("class",f.axisXLabel).attr("transform",bh?"rotate(-90)":"").style("text-anchor",zb),uh&&gj.append("g").attr("class",f.axisY).attr("clip-path",zi).attr("transform",Si.y).append("text").attr("class",f.axisYLabel).attr("transform",bh?"":"rotate(-90)").style("text-anchor",Ab),Dh&&gj.append("g").attr("class",f.axisY2).attr("transform",Si.y2).append("text").attr("class",f.axisY2Label).attr("transform",bh?"":"rotate(-90)").style("text-anchor",Bb),gj.append("g").attr("clip-path",xi).attr("class",f.regions),gj.append("g").attr("clip-path",xi).attr("class",f.chart),c=gj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ff?bh?"ns-resize":"ew-resize":null),gj.select("."+f.chart).append("g").attr("class",f.chartBars),gj.select("."+f.chart).append("g").attr("class",f.chartLines),gj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Si.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),gj.select("."+f.chart).append("g").attr("class",f.chartTexts),Ff&&gj.insert("rect",Hf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Qf).attr("height",Sf).style("opacity",0).style("cursor",bh?"ns-resize":"ew-resize").call(dj).on("dblclick.zoom",null),sh&&_i.extent("function"!=typeof sh?sh:sh(_b())),hj.append("g").attr("clip-path",xi).attr("class",f.chart),hj.select("."+f.chart).append("g").attr("class",f.chartBars),hj.select("."+f.chart).append("g").attr("class",f.chartLines),hj.append("g").attr("clip-path",xi).attr("class",f.brush).call(_i).selectAll("rect").attr(bh?"width":"height",bh?Rf:Tf),hj.append("g").attr("class",f.axisX).attr("transform",Si.subx).attr("clip-path",bh?"":yi),hf(yf.data.targets),bh?gj.select("."+f.axisX).style("opacity",0).call(pg):(gj.select("."+f.axisY).style("opacity",0).call(qg),gj.select("."+f.axisY2).style("opacity",0).call(rg)),n(),R(),ff(),m(!1),bf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),ri){if(Ai&&"string"==typeof si){for(si=re(si),e=0;e0){d=[];for(var g in xg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(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 _e(a){ee(yf.data.targets)||Jg&&(Di=a,gj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ei=!0,Sg())}function af(){ee(yf.data.targets)||Jg&&(gj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),gj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ei=!1,Tg())}function bf(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Vd(),W=ee(yf.data.targets),X=Ic(yf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Mf:0,Q=D?P:0,R=E?P:0,c=gj.select("."+f.axisX).style("opacity",W?0:1),g=gj.select("."+f.axisY).style("opacity",W?0:1),h=gj.select("."+f.axisY2).style("opacity",W?0:1),e=hj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Xg&&sf(Cc(yf.data.targets),a,O),Bi&&(0!==X.length&&H&&G||jg.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(jg.domain(xf.extent(_b(X))),lj=jg.domain(),Ff&&dj.scale(jg).updateScaleExtent(),mg.domain(jg.domain()),_i.scale(mg)),G&&(jg.domain(_i.empty()?lj:_i.extent()),Ff&&dj.scale(jg).updateScaleExtent()),mh||!lh&&!kh||(S=Kc(Jc(X),kh),pg.tickValues(S),sg.tickValues(S))),kg.domain(Xb(X,"y")),lg.domain(Xb(X,"y2")),O.axisX.call(pg),O.axisY.call(qg),O.axisY2.call(rg),O.axisSubX.call(sg),G&&X.length)if(ih&&S){for(T=1;T=0&&xf.select(this).style("display",b%U?"none":"block")})}else ej.selectAll("."+f.axisX+" .tick text").style("display","block");if(!bh&&nh&&eb(c,O.axisX,nh),J=Qe(V),M=Re(V,!0),N=Re(V,!1),Db(),ng.domain(kg.domain()),og.domain(lg.domain()),jj.style("display","none"),o(),gj.select("line."+f.xgridFocus).style("visibility","hidden"),Mh){if("year"===Nh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=jg.ticks(10);i=gj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",bh?0:function(a){return jg(a)-pg.tickOffset()}).attr("x2",bh?Qf:function(a){return jg(a)-pg.tickOffset()}).attr("y1",bh?function(a){return jg(a)-pg.tickOffset()}:Nf.top).attr("y2",bh?function(a){return jg(a)-pg.tickOffset()}:Sf).style("opacity",function(){return+xf.select(this).attr(bh?"y1":"x1")===(bh?Sf:0)?0:1}),i.exit().remove()}we(Oh)&&(k=gj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Oh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",bh?"":"rotate(-90)").attr("dx",bh?0:-Nf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",bh?0:Dd).attr("x2",bh?Qf:Dd).attr("y1",bh?Dd:Nf.top).attr("y2",bh?Dd:Sf).style("opacity",1),k.select("text").transition().duration(P).attr("x",bh?Qf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Ph&&(m=gj.select("."+f.ygrids).selectAll("."+f.ygrid).data(kg.ticks(Rh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",bh?kg:0).attr("x2",bh?kg:Qf).attr("y1",bh?0:kg).attr("y2",bh?Sf:kg),m.exit().remove()),A&&we(Qh)&&(n=gj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Qh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",bh?"rotate(-90)":"").attr("dx",bh?0:-Nf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",bh?Ed:0).attr("x2",bh?Ed:Qf).attr("y1",bh?0:Ed).attr("y2",bh?Sf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",bh?0:Qf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=gj.select("."+f.regions).selectAll("rect."+f.region).data(mi),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=gj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Ji(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=gj.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return bh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),gj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1),gj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",bj).style("opacity",mj),q=gj.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",He),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud),q.exit().remove(),gj.each(function(){Hi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=xf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Hi=!1}),gj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),gj.select("."+f.chartArcsTitle).style("opacity",de(yf.data.targets)?1:0),Ug&&(null!==xf.event&&"zoom"===xf.event.type&&_i.extent(jg.orgDomain()).update(),B&&(!bh&&nh&&eb(e,O.axisSubX,nh),_i.empty()||_i.extent(jg.orgDomain()).update(),K=Qe(V,!0),u=hj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Ji(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),hj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",cj).style("opacity",1))),gj.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),gj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud),v=gj.select("."+f.eventRects),we(ug)&&!oc(ug)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=gj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ye(w.enter()),w.attr("x",0).attr("y",0).attr("width",Qf).attr("height",Sf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ci&&!Bi?(z=function(a,b){var c=xc(b),d=yc(b),e=yf.data.xs[a.id][b];return(jg(d?d:e+50)-jg(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=yf.data.xs[a.id][b];return(jg(d)+jg(c?c:d-50))/2}):(z=L(),y=function(a){return jg(a.x)-z/2}),x=Ac(yf.data.targets),gj.select("."+f.eventRects).datum(x?x.values:[]),w=gj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Xe(w.enter()),w.attr("class",fd).attr("x",bh?0:y).attr("y",bh?y:0).attr("width",bh?Qf:z).attr("height",bh?z:Sf),w.exit().remove()),Cc(yf.data.targets).forEach(function(a){nj[a]=!0})}function cf(){bf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function df(){return"mousemove"===xf.event.sourceEvent.type&&dj.altDomain?(jg.domain(dj.altDomain),void dj.scale(jg).updateScaleExtent()):(Bi&&jg.orgDomain()[0]===lj[0]&&jg.domain([lj[0]-1e-10,jg.orgDomain()[1]]),bf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===xf.event.sourceEvent.type&&(Fi=!0)))}function ef(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function ff(){ej.attr("width",Uf).attr("height",Vf),ej.select("#"+ui).select("rect").attr("width",Qf).attr("height",Sf),ej.select("#"+vi).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),ej.select("#"+wi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej.select("."+f.zoomRect).attr("width",Qf).attr("height",Sf),kj.style("max-height",Vf+"px")}function gf(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),ff(),m(a.withTransition),bf(a)}function hf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=gj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Ji(a)}),e=gj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Lg(a)?"pointer":null}),c=gj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ji(a)}),b.append("path").attr("class",dd).style("opacity",function(){return mj=+xf.select(this).style("opacity"),0}).style("fill",function(a){return Ji(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Ji(a)}).style("cursor",function(a){return Lg(a)?"pointer":null}),a.forEach(function(a){gj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=gj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(ag(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Ji(a.data)}).style("cursor",function(a){return Lg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Hi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),of(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,xf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Hi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),pf(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Ug&&(n=hj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Ji(a)}),l=hj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ji(a)})),ej.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Mf).style("opacity",1)}function jf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),yf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Ti?j:i,l=Ti?Q():P();return d&&(w=0,C=0,t=0,u=0),Xg&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Ti?u:t,void(ah?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=ij.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,Ti?(g=function(a){return t*(.2+B[a])},j=function(a){return A[B[a]]+x[a]}):(g=function(a){return A[B[a]]+x[a]},j=function(a){return u*(.2+B[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=ij.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Zg?Zg(a):yf.toggle(a)}).on("mouseover",function(a){xf.select(this).classed(f.legendItemFocused,!0),Hi||yf.focus(a),"function"==typeof $g&&$g(a)}).on("mouseout",function(a){xf.select(this).classed(f.legendItemFocused,!1),Hi||yf.revert(),"function"==typeof _g&&_g(a)}),o.append("text").text(function(a){return d(xg[a])?xg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ti?h:-200).attr("y",Ti?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ti?i:-200).attr("y",Ti?-200:l).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Ji(a)}).attr("x",Ti?h:-200).attr("y",Ti?-200:j).attr("width",10).attr("height",10),ij.selectAll("text").data(a).text(function(a){return d(xg[a])?xg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),ij.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),ij.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),ij.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=xf.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?mf(b):nf(b):Xi}),N(t),O(u),M(C),n(),R(),ff(),m(q,c)}function tf(a){return Ec(yf.data.targets,a.id)}function uf(a){return"data"in a&&Ec(yf.data.targets,a.data.id)}function vf(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 wf(a,b,c){var d=!ee(yf.data.targets);Hi=!1,$d(a,b),gf(c||{withTransitionForAxis:d})}var xf=a.d3?a.d3:a.require?a.require("d3"):void 0,yf={data:{},axis:{},legend:{}},zf={},Af=h(["bindto"],"#chart"),Bf=h(["size","width"]),Cf=h(["size","height"]),Df=h(["padding","left"],50),Ef=h(["padding","right"]),Ff=h(["zoom","enabled"],!1),Gf=h(["zoom","extent"]),Hf=h(["zoom","privileged"],!1),If=h(["onenter"],function(){}),Jf=h(["onleave"],function(){}),Kf=h(["onresize"],function(){}),Lf=h(["onresized"],function(){}),Mf=h(["transition","duration"],350);g("data","data is required in config");var Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg=h(["data","x"]),ug=h(["data","xs"],{}),vg=h(["data","x_format"]),wg=h(["data","id_converter"],function(a){return a}),xg=h(["data","names"],{}),yg=h(["data","classes"],{}),zg=h(["data","groups"],[]),Ag=h(["data","axes"],{}),Bg=h(["data","type"]),Cg=h(["data","types"],{}),Dg=h(["data","labels"],{}),Eg=h(["data","order"]),Fg=h(["data","regions"],{}),Gg=h(["data","color"]),Hg=h(["data","colors"],{}),Ig=h(["data","hide"],!1),Jg=h(["data","selection","enabled"],!1),Kg=h(["data","selection","grouped"],!1),Lg=h(["data","selection","isselectable"],function(){return!0}),Mg=h(["data","selection","multiple"],!0),Ng=h(["data","onclick"],function(){}),Og=h(["data","onenter"],function(){}),Pg=h(["data","onleave"],function(){}),Qg=h(["data","onselected"],function(){}),Rg=h(["data","onunselected"],function(){}),Sg=h(["data","ondragstart"],function(){}),Tg=h(["data","ondragend"],function(){}),Ug=h(["subchart","show"],!1),Vg=h(["subchart","size","height"],60),Wg=h(["color","pattern"],[]),Xg=h(["legend","show"],!0),Yg=h(["legend","position"],"bottom"),Zg=h(["legend","item","onclick"]),$g=h(["legend","item","onmouseover"]),_g=h(["legend","item","onmouseout"]),ah=h(["legend","equally"],!1),bh=h(["axis","rotated"],!1),ch=h(["axis","x","show"],!0),dh=h(["axis","x","type"],"indexed"),eh=h(["axis","x","localtime"],!0),fh=h(["axis","x","categories"],[]),gh=h(["axis","x","tick","centered"],!1),hh=h(["axis","x","tick","format"]),ih=h(["axis","x","tick","culling"],{}),jh=h(["axis","x","tick","culling","max"],10),kh=h(["axis","x","tick","count"]),lh=h(["axis","x","tick","fit"],!0),mh=h(["axis","x","tick","values"],null),nh=h(["axis","x","tick","rotate"]),oh=h(["axis","x","max"],null),ph=h(["axis","x","min"],null),qh=h(["axis","x","padding"],{}),rh=h(["axis","x","height"]),sh=h(["axis","x","default"]),th=h(["axis","x","label"],{}),uh=h(["axis","y","show"],!0),vh=h(["axis","y","max"]),wh=h(["axis","y","min"]),xh=h(["axis","y","center"]),yh=h(["axis","y","label"],{}),zh=h(["axis","y","inner"],!1),Ah=h(["axis","y","tick","format"]),Bh=h(["axis","y","padding"]),Ch=h(["axis","y","ticks"],10),Dh=h(["axis","y2","show"],!1),Eh=h(["axis","y2","max"]),Fh=h(["axis","y2","min"]),Gh=h(["axis","y2","center"]),Hh=h(["axis","y2","label"],{}),Ih=h(["axis","y2","inner"],!1),Jh=h(["axis","y2","tick","format"]),Kh=h(["axis","y2","padding"]),Lh=h(["axis","y2","ticks"],10),Mh=h(["grid","x","show"],!1),Nh=h(["grid","x","type"],"tick"),Oh=h(["grid","x","lines"],[]),Ph=h(["grid","y","show"],!1),Qh=h(["grid","y","lines"],[]),Rh=h(["grid","y","ticks"],10),Sh=h(["point","show"],!0),Th=h(["point","r"],2.5),Uh=h(["point","focus","line","enabled"],!0),Vh=h(["point","focus","expand","enabled"],!0),Wh=h(["point","focus","expand","r"]),Xh=h(["point","focus","select","r"]),Yh=h(["line","connect_null"],!1),Zh=h(["bar","width"]),$h=h(["bar","width","ratio"],.6),_h=h(["pie","label","show"],!0),ai=h(["pie","label","format"]),bi=h(["pie","expand"],!0),ci=h(["pie","onclick"],function(){}),di=h(["pie","onmouseover"],function(){}),ei=h(["pie","onmouseout"],function(){}),fi=h(["donut","label","show"],!0),gi=h(["donut","label","format"]),hi=h(["donut","expand"],!0),ii=h(["donut","title"],""),ji=h(["donut","onclick"],function(){}),ki=h(["donut","onmouseover"],function(){}),li=h(["donut","onmouseout"],function(){}),mi=h(["regions"],[]),ni=h(["tooltip","show"],!0),oi=h(["tooltip","format","title"]),pi=h(["tooltip","format","value"]),qi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=oi?oi:b,l=pi?pi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id,a[g].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),ri=h(["tooltip","init","show"],!1),si=h(["tooltip","init","x"],0),ti=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ui=("string"==typeof Af?Af.replace("#",""):Af.id)+"-clip",vi=ui+"-xaxis",wi=ui+"-yaxis",xi=i(ui),yi=i(vi),zi=i(wi),Ai="timeseries"===dh,Bi="categorized"===dh,Ci=!Ai&&(tg||we(ug)),Di=null,Ei=!1,Fi=!1,Gi=!1,Hi=!1,Ii=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ji=qe(Hg,we(Wg)?Wg:Ii,Gg),Ki=eh?xf.time.format:xf.time.format.utc,Li=function(){var a=[[Ki("%Y/%-m/%-d"),function(){return!0}],[Ki("%-m/%-d"),function(a){return a.getMonth()}],[Ki("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ki("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ki("%I %p"),function(a){return a.getHours()}],[Ki("%I:%M"),function(a){return a.getMinutes()}],[Ki(":%S"),function(a){return a.getSeconds()}],[Ki(".%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)}}(),Mi=[],Ni=[],Oi=bh?"left":"bottom",Pi=bh?zh?"top":"bottom":zh?"right":"left",Qi=bh?Ih?"bottom":"top":Ih?"left":"right",Ri=bh?"left":"bottom",Si={main:function(){return"translate("+Nf.left+","+Nf.top+")"},context:function(){return"translate("+Of.left+","+Of.top+")"},legend:function(){return"translate("+Pf.left+","+Pf.top+")"},x:function(){return"translate(0,"+(bh?0:Sf)+")"},y:function(){return"translate(0,"+(bh?Sf:0)+")"},y2:function(){return"translate("+(bh?0:Qf)+","+(bh?1:0)+")"},subx:function(){return"translate(0,"+(bh?0:Tf)+")"},arc:function(){return"translate("+Qf/2+","+Sf/2+")"}},Ti="right"===Yg,Ui=0,Vi=0,Wi=0,Xi=.15,Yi=30,Zi=bh&&!ch?0:30,$i=5;ag=xf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var _i,aj=function(){var a=xf.svg.line().x(bh?function(a){return V(a.id)(a.value)}:Cd).y(bh?Cd:function(a){return V(a.id)(a.value)});return Yh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Yh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Fg[b.id]?Ve(e,jg,V(b.id),Fg[b.id]):a(e)):(c=e[0]?jg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,bh?"M "+d+" "+c:"M "+c+" "+d)}}(),bj=function(){var a;return a=bh?xf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):xf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?jg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,bh?"M "+d+" "+c:"M "+c+" "+d)}}(),cj=function(){var a=xf.svg.line().x(bh?function(a){return W(a.id)(a.value)}:Fd).y(bh?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+mg(c[0].x)+" "+W(b.id)(c[0].value)}}(),dj=function(){};_i=xf.svg.brush().on("brush",cf),_i.update=function(){return hj&&hj.select("."+f.brush).call(this),this},_i.scale=function(a){return bh?this.y(a):this.x(a)},Ff&&(dj=xf.behavior.zoom().on("zoomstart",function(){dj.altDomain=xf.event.sourceEvent.altKey?jg.orgDomain():null}).on("zoom",Ff?df:null),dj.scale=function(a){return bh?this.y(a):this.x(a)},dj.orgScaleExtent=function(){var a=Gf?Gf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},dj.updateScaleExtent=function(){var a=ac(jg.orgDomain())/ac(lj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var ej,fj,gj,hj,ij,jj,kj,lj,mj,nj={};if(yf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);yf.revert(),yf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(yf.data.targets)&&Nb(a,!0),of(a,!0)},yf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);yf.revert(),b(d.classed(f.focused,!1)),b(e),ee(yf.data.targets)&&Ob(a),of(a,!1)},yf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);b(d.classed(f.focused,!1)),b(e),ee(yf.data.targets)&&Ob(a),pf()},yf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),ej.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&qf(a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},yf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),ej.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&rf(a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},yf.toggle=function(a){Gc(a)?yf.hide(a):yf.show(a)},yf.unzoom=function(){_i.clear().update(),bf({withUpdateXDomain:!0})},yf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){yg[b]=a.classes[b]}),"categories"in a&&Bi&&(fh=a.categories,pg.categories(fh)),"cacheIds"in a&&bc(a.cacheIds)?void jf(dc(a.cacheIds),a.done):void("unload"in a?lf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){kf(a)}):kf(a))},yf.unload=function(a,b){lf(Dc(a),function(){bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},yf.selected=function(a){return xf.merge(gj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return xf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},yf.select=function(a,b,c){Jg&&gj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=xf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Kg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Lg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},yf.unselect=function(a,b){Jg&&gj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=xf.select(this),g="circle"===this.nodeName?Be:Ee,h=Kg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Lg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},yf.toLine=function(a){wf(a,"line")},yf.toSpline=function(a){wf(a,"spline")},yf.toBar=function(a){wf(a,"bar")},yf.toScatter=function(a){wf(a,"scatter")},yf.toArea=function(a){wf(a,"area")},yf.toAreaSpline=function(a){wf(a,"area-spline") },yf.toPie=function(a){wf(a,"pie",{withTransform:!0})},yf.toDonut=function(a){wf(a,"donut",{withTransform:!0})},yf.groups=function(a){return c(a)?zg:(zg=a,bf(),zg)},yf.xgrids=function(a){return a?(Oh=a,bf(),Oh):Oh},yf.xgrids.add=function(a){return a?yf.xgrids(Oh.concat(a)):void 0},yf.xgrids.remove=function(a){var b=vf(a);return yf.xgrids(Oh.filter(b))},yf.ygrids=function(a){return a?(Qh=a,bf(),Qh):Qh},yf.ygrids.add=function(a){return a?yf.ygrids(Qh.concat(a)):void 0},yf.ygrids.remove=function(a){var b=vf(a);return yf.ygrids(Qh.filter(b))},yf.regions=function(a){return c(a)?mi:(mi=a,bf(),mi)},yf.regions.add=function(a){return c(a)?mi:(mi=mi.concat(a),bf(),mi)},yf.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;ej.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),mi=mi.filter(function(b){return b.classes.indexOf(a)<0})}),mi},yf.data.get=function(a){var b=yf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},yf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},yf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){xg[b]=a[b]}),sf(Cc(yf.data.targets),{withTransition:!0}),xg):xg},yf.x=function(a){return arguments.length&&(qc(yf.data.targets,a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),yf.data.xs},yf.xs=function(a){return arguments.length&&(rc(yf.data.targets,a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),yf.data.xs},yf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},yf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(vh=+a.y),b(a.y2)&&(Eh=+a.y2)):vh=Eh=+a,bf())},yf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(wh=+a.y),b(a.y2)&&(Fh=+a.y2)):wh=Fh=+a,bf())},yf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&yf.axis.max(a.max),"undefined"!=typeof a.min&&yf.axis.min(a.min))},yf.legend.show=function(a){qf(Dc(a)),bf({withLegend:!0})},yf.legend.hide=function(a){rf(Dc(a)),bf({withLegend:!0})},yf.resize=function(a){Bf=a?a.width:null,Cf=a?a.height:null,gf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},yf.destroy=function(){yf.data.targets=void 0,yf.data.xs={},kj.html(""),a.onresize=null},"url"in e.data)xf.xhr(e.data.url,function(a,b){var c,d=xf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=xf.csv.parse(b.response),We(c)});else if("rows"in e.data)We(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");We(uc(e.data.columns))}return yf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 0bbdad66d201bfb6b9697de4bd1601e5904a2260 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Fri, 2 May 2014 10:10:48 +0900 Subject: [PATCH 113/178] Modify structure of element and enable selection of pie - #158 --- c3.js | 256 +++++++++++++++++++++++++++++++----------------------- c3.min.js | 6 +- 2 files changed, 150 insertions(+), 112 deletions(-) diff --git a/c3.js b/c3.js index 9b0bbeb..ff845e5 100644 --- a/c3.js +++ b/c3.js @@ -33,12 +33,15 @@ shape: 'c3-shape', shapes: 'c3-shapes', line: 'c3-line', + lines: 'c3-lines', bar: 'c3-bar', bars: 'c3-bars', circle: 'c3-circle', circles: 'c3-circles', arc: 'c3-arc', + arcs: 'c3-arcs', area: 'c3-area', + areas: 'c3-areas', text: 'c3-text', texts: 'c3-texts', grid: 'c3-grid', @@ -1738,13 +1741,16 @@ function classTexts(d) { return generateClass(CLASS.texts, d.id); } function classShape(d, i) { return generateClass(CLASS.shape, i); } function classShapes(d) { return generateClass(CLASS.shapes, d.id); } - function classLine(d) { return classShapes(d) + generateClass(CLASS.line, d.id); } + function classLine(d) { return classShape(d) + generateClass(CLASS.line, d.id); } + function classLines(d) { return classShapes(d) + generateClass(CLASS.lines, d.id); } function classCircle(d, i) { return classShape(d, i) + generateClass(CLASS.circle, i); } function classCircles(d) { return classShapes(d) + generateClass(CLASS.circles, d.id); } function classBar(d, i) { return classShape(d, i) + generateClass(CLASS.bar, i); } function classBars(d) { return classShapes(d) + generateClass(CLASS.bars, d.id); } - function classArc(d) { return classShapes(d.data) + generateClass(CLASS.arc, d.data.id); } - function classArea(d) { return classShapes(d) + generateClass(CLASS.area, d.id); } + function classArc(d) { return classShape(d.data) + generateClass(CLASS.arc, d.data.id); } + function classArcs(d) { return classShapes(d.data) + generateClass(CLASS.arcs, d.data.id); } + function classArea(d) { return classShape(d) + generateClass(CLASS.area, d.id); } + function classAreas(d) { return classShapes(d) + generateClass(CLASS.areas, d.id); } function classRegion(d, i) { return generateClass(CLASS.region, i) + ' ' + ('class' in d ? d.class : ''); } function classEvent(d, i) { return generateClass(CLASS.eventRect, i); } function classTarget(id) { @@ -2130,10 +2136,13 @@ function isArcType(d) { return isPieType(d) || isDonutType(d); } - /* not used function lineData(d) { - return isLineType(d) ? d.values : []; + return isLineType(d) ? [d] : []; + } + function arcData(d) { + return isArcType(d.data) ? [d] : []; } + /* not used function scatterData(d) { return isScatterType(d) ? d.values : []; } @@ -2270,7 +2279,7 @@ function selectBar(target, d) { __data_onselected(d, target.node()); - target.transition().duration(100).style("fill", function () { return d3.rgb(color(d)).darker(1); }); + target.transition().duration(100).style("fill", function () { return d3.rgb(color(d)).brighter(0.75); }); } function unselectBar(target, d) { __data_onunselected(d, target.node()); @@ -2279,6 +2288,9 @@ function toggleBar(selected, target, d, i) { selected ? selectBar(target, d, i) : unselectBar(target, d, i); } + function toggleArc(selected, target, d, i) { + toggleBar(selected, target, d.data, i); + } function filterRemoveNull(data) { return data.filter(function (d) { return isValue(d.value); }); @@ -3026,17 +3038,20 @@ .call(zoom).on("dblclick.zoom", null); } - function toggleShape(target, d, i) { - var shape = d3.select(target), - isSelected = shape.classed(CLASS.SELECTED); - var isWithin = false, toggle; - if (target.nodeName === 'circle') { - isWithin = isWithinCircle(target, pointSelectR(d) * 1.5); + function toggleShape(that, d, i) { + var shape = d3.select(that), isSelected = shape.classed(CLASS.SELECTED), isWithin, toggle; + if (that.nodeName === 'circle') { + isWithin = isWithinCircle(that, pointSelectR(d) * 1.5); toggle = togglePoint; } - else if (target.nodeName === 'path') { - isWithin = isWithinBar(target); - toggle = toggleBar; + else if (that.nodeName === 'path') { + if (shape.classed(CLASS.bar)) { + isWithin = isWithinBar(that); + toggle = toggleBar; + } else { // would be arc + isWithin = true; + toggle = toggleArc; + } } if (__data_selection_grouped || isWithin) { if (__data_selection_enabled && __data_selection_isselectable(d)) { @@ -3049,7 +3064,7 @@ shape.classed(CLASS.SELECTED, !isSelected); toggle(!isSelected, shape, d, i); } - __data_onclick(d, target); + __data_onclick(d, that); } } @@ -3133,7 +3148,7 @@ function redraw(options) { var xaxis, subxaxis, yaxis, y2axis, xgrid, xgridData, xgridLines, xgridLine, ygrid, ygridLines, ygridLine; - var mainCircle, mainBar, mainRegion, mainText, contextBar, eventRect, eventRectUpdate; + var mainLine, mainArea, mainCircle, mainBar, mainArc, mainRegion, mainText, contextLine, contextBar, eventRect, eventRectUpdate; var barIndices = getBarIndices(), maxDataCountTarget; var rectX, rectW; var withY, withSubchart, withTransition, withTransitionForExit, withTransitionForAxis, withTransform, withUpdateXDomain, withUpdateOrgXDomain, withLegend; @@ -3380,11 +3395,9 @@ mainBar = main.selectAll('.' + CLASS.bars).selectAll('.' + CLASS.bar) .data(barData); mainBar.enter().append('path') - .attr('d', drawBar) + .attr("class", classBar) .style("stroke", 'none') - .style("opacity", 0) - .style("fill", function (d) { return color(d); }) - .attr("class", classBar); + .style("fill", color); mainBar .style("opacity", initialOpacity) .transition().duration(duration) @@ -3394,41 +3407,40 @@ .style('opacity', 0) .remove(); - mainText = main.selectAll('.' + CLASS.texts).selectAll('.' + CLASS.text) - .data(barOrLineData); - mainText.enter().append('text') - .attr("class", classText) - .attr('text-anchor', function (d) { return __axis_rotated ? (d.value < 0 ? 'end' : 'start') : 'middle'; }) - .style("stroke", 'none') - .style("fill-opacity", 0); - mainText - .text(function (d) { return formatByAxisId(d.id)(d.value); }) - .style("fill-opacity", initialOpacityForText) - .transition().duration(duration) - .attr('x', xForText) - .attr('y', yForText) - .style("fill-opacity", opacityForText); - mainText.exit() - .transition().duration(durationForExit) - .style('fill-opacity', 0) - .remove(); - // lines and cricles - main.selectAll('.' + CLASS.line) + mainLine = main.selectAll('.' + CLASS.lines).selectAll('.' + CLASS.line) + .data(lineData); + mainLine.enter().append('path') + .attr('class', classLine) + .style("stroke", color); + mainLine .style("opacity", initialOpacity) .transition().duration(duration) .attr("d", lineOnMain) .style("opacity", 1); - main.selectAll('.' + CLASS.area) + mainLine.exit().transition().duration(durationForExit) + .style('opacity', 0) + .remove(); + + mainArea = main.selectAll('.' + CLASS.areas).selectAll('.' + CLASS.area) + .data(lineData); + mainArea.enter().append('path') + .attr("class", classArea) + .style("fill", color) + .style("opacity", function () { orgAreaOpacity = +d3.select(this).style('opacity'); return 0; }); + mainArea .style("opacity", 0) .transition().duration(duration) .attr("d", areaOnMain) .style("opacity", orgAreaOpacity); + mainArea.exit().transition().duration(durationForExit) + .style('opacity', 0) + .remove(); + mainCircle = main.selectAll('.' + CLASS.circles).selectAll('.' + CLASS.circle) .data(lineOrScatterData); mainCircle.enter().append("circle") .attr("class", classCircle) - .style('opacity', 0) .attr("r", pointR); mainCircle .style("opacity", initialOpacity) @@ -3438,10 +3450,74 @@ .attr("cy", __axis_rotated ? circleX : circleY); mainCircle.exit().remove(); + mainText = main.selectAll('.' + CLASS.texts).selectAll('.' + CLASS.text) + .data(barOrLineData); + mainText.enter().append('text') + .attr("class", classText) + .attr('text-anchor', function (d) { return __axis_rotated ? (d.value < 0 ? 'end' : 'start') : 'middle'; }) + .style("stroke", 'none') + .style("fill-opacity", 0); + mainText + .text(function (d) { return formatByAxisId(d.id)(d.value); }) + .style("fill-opacity", initialOpacityForText) + .transition().duration(duration) + .attr('x', xForText) + .attr('y', yForText) + .style("fill-opacity", opacityForText); + mainText.exit() + .transition().duration(durationForExit) + .style('fill-opacity', 0) + .remove(); + // arc - main.each(function () { transiting = true; }).selectAll('.' + CLASS.chartArc).select('.' + CLASS.arc) + mainArc = main.selectAll('.' + CLASS.arcs).selectAll('.' + CLASS.arc) + .data(arcData); + mainArc.enter().append('path') + .attr("class", classArc) + .style("fill", function (d) { return color(d.data); }) + .style("cursor", function (d) { return __data_selection_isselectable(d) ? "pointer" : null; }) + .style("opacity", 0) + .each(function (d) { this._current = d; }) + .on('mouseover', function (d, i) { + var updated, arcData, callback; + if (transiting) { // skip while transiting + return; + } + updated = updateAngle(d); + arcData = convertToArcData(updated); + callback = getArcOnMouseOver(); + // transitions + expandArc(updated.data.id); + toggleFocusLegend(updated.data.id, true); + callback(arcData, i); + }) + .on('mousemove', function (d) { + var updated = updateAngle(d), arcData = convertToArcData(updated), selectedData = [arcData]; + showTooltip(selectedData, d3.mouse(this)); + }) + .on('mouseout', function (d, i) { + var updated, arcData, callback; + if (transiting) { // skip while transiting + return; + } + updated = updateAngle(d); + arcData = convertToArcData(updated); + callback = getArcOnMouseOut(); + // transitions + unexpandArc(updated.data.id); + revertLegend(); + hideTooltip(); + callback(arcData, i); + }) + .on('click', function (d, i) { + var updated = updateAngle(d), arcData = convertToArcData(updated), callback = getArcOnClick(); + toggleShape(this, d, i); + callback(arcData, i); + }); + mainArc .attr("transform", withTransform ? "scale(0)" : "") .style("opacity", function (d) { return d === this._current ? 0 : 1; }) + .each(function () { transiting = true; }) .transition().duration(duration) .attrTween("d", function (d) { var updated = updateAngle(d), interpolate; @@ -3465,6 +3541,9 @@ .call(endall, function () { transiting = false; }); + mainArc.exit().transition().duration(durationForExit) + .style('opacity', 0) + .remove(); main.selectAll('.' + CLASS.chartArc).select('text') .attr("transform", transformForArcLabel) .style("opacity", 0) @@ -3498,10 +3577,9 @@ contextBar = context.selectAll('.' + CLASS.bars).selectAll('.' + CLASS.bar) .data(barData); contextBar.enter().append('path') - .attr('d', drawBarOnSub) + .attr("class", classBar) .style("stroke", 'none') - .style("fill", function (d) { return color(d); }) - .attr("class", classBar); + .style("fill", color); contextBar .style("opacity", initialOpacity) .transition().duration(duration) @@ -3511,11 +3589,19 @@ .style('opacity', 0) .remove(); // lines - context.selectAll('.' + CLASS.line) + contextLine = context.selectAll('.' + CLASS.lines).selectAll('.' + CLASS.line) + .data(lineData); + contextLine.enter().append('path') + .attr('class', classLine) + .style('stroke', color); + contextLine .style("opacity", initialOpacity) .transition().duration(duration) .attr("d", lineOnSub) .style('opacity', 1); + contextLine.exit().transition().duration(duration) + .style('opacity', 0) + .remove(); } } @@ -3707,34 +3793,28 @@ // Bars for each data mainBarEnter.append('g') .attr("class", classBars) - .style("stroke", "none") .style("cursor", function (d) { return __data_selection_isselectable(d) ? "pointer" : null; }); //-- Line --// - mainLineUpdate = main.select('.' + CLASS.chartLines) - .selectAll('.' + CLASS.chartLine) + mainLineUpdate = main.select('.' + CLASS.chartLines).selectAll('.' + CLASS.chartLine) .data(targets) - .attr('class', classChartLine); + .attr('class', classChartLine); mainLineEnter = mainLineUpdate.enter().append('g') .attr('class', classChartLine) .style('opacity', 0) .style("pointer-events", "none"); // Lines for each data - mainLineEnter.append("path") - .attr("class", classLine) - .style("opacity", 0) - .style("stroke", function (d) { return color(d); }); + mainLineEnter.append('g') + .attr("class", classLines); // Areas - mainLineEnter.append("path") - .attr("class", classArea) - .style("opacity", function () { orgAreaOpacity = +d3.select(this).style('opacity'); return 0; }) - .style("fill", function (d) { return color(d); }); + mainLineEnter.append('g') + .attr('class', classAreas); // Circles for each data point on lines mainLineEnter.append('g') .attr("class", function (d) { return generateClass(CLASS.selectedCircles, d.id); }); mainLineEnter.append('g') .attr("class", classCircles) - .style("fill", function (d) { return color(d); }) + .style("fill", color) .style("cursor", function (d) { return __data_selection_isselectable(d) ? "pointer" : null; }); // Update date for selected circles targets.forEach(function (t) { @@ -3751,47 +3831,8 @@ .attr("class", classChartArc); mainPieEnter = mainPieUpdate.enter().append("g") .attr("class", classChartArc); - mainPieEnter.append("path") - .attr("class", classArc) - .style("opacity", 0) - .style("fill", function (d) { return color(d.data); }) - .style("cursor", function (d) { return __data_selection_isselectable(d) ? "pointer" : null; }) - .each(function (d) { this._current = d; }) - .on('mouseover', function (d, i) { - var updated, arcData, callback; - if (transiting) { // skip while transiting - return; - } - updated = updateAngle(d); - arcData = convertToArcData(updated); - callback = getArcOnMouseOver(); - // transitions - expandArc(updated.data.id); - toggleFocusLegend(updated.data.id, true); - callback(arcData, i); - }) - .on('mousemove', function (d) { - var updated = updateAngle(d), arcData = convertToArcData(updated), selectedData = [arcData]; - showTooltip(selectedData, d3.mouse(this)); - }) - .on('mouseout', function (d, i) { - var updated, arcData, callback; - if (transiting) { // skip while transiting - return; - } - updated = updateAngle(d); - arcData = convertToArcData(updated); - callback = getArcOnMouseOut(); - // transitions - unexpandArc(updated.data.id); - revertLegend(); - hideTooltip(); - callback(arcData, i); - }) - .on('click', function (d, i) { - var updated = updateAngle(d), arcData = convertToArcData(updated), callback = getArcOnClick(); - callback(arcData, i); - }); + mainPieEnter.append('g') + .attr('class', classArcs); mainPieEnter.append("text") .attr("dy", ".35em") .style("opacity", 0) @@ -3812,8 +3853,7 @@ .attr('class', classChartBar); // Bars for each data contextBarEnter.append('g') - .attr("class", classBars) - .style("fill", function (d) { return color(d); }); + .attr("class", classBars); //-- Line --// contextLineUpdate = context.select('.' + CLASS.chartLines).selectAll('.' + CLASS.chartLine) @@ -3823,10 +3863,8 @@ .style('opacity', 0) .attr('class', classChartLine); // Lines for each data - contextLineEnter.append("path") - .attr("class", classLine) - .style("opacity", 0) - .style("stroke", function (d) { return color(d); }); + contextLineEnter.append('g') + .attr("class", classLines); } /*-- Show --*/ @@ -4292,7 +4330,7 @@ return d3.merge( main.selectAll('.' + CLASS.shapes + getTargetSelectorSuffix(targetId)).selectAll('.' + CLASS.shape) .filter(function () { return d3.select(this).classed(CLASS.SELECTED); }) - .map(function (d) { return d.map(function (_d) { return _d.__data__; }); }) + .map(function (d) { return d.map(function (d) { var data = d.__data__; return data.data ? data.data : data; }); }) ); }; diff --git a/c3.min.js b/c3.min.js index 77cbfda..4db0ab2 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.33"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",legendItemFocused:"c3-legend-item-focused",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;cQf&&(Qf=0),0>Sf&&(Sf=0),Rf=bh?Nf.left-Yi-Zi:Qf,Tf=bh?Sf:Vf-Of.top-Of.bottom,0>Rf&&(Rf=0),0>Tf&&(Tf=0),p(),Ti&&ee(yf.data.targets)&&(Pf.left=Qf/2+Xf)}function o(){gj.select("line."+f.xgridFocus).attr("x1",bh?0:-10).attr("x2",bh?Qf:-10).attr("y1",bh?-10:Nf.top).attr("y2",bh?-10:Sf)}function p(){Xf=Sf/2,Wf=.95*Xf,Yf=de(yf.data.targets)?.6*Wf:0}function q(){var a=bh?f.axisX:f.axisY,b=gj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=xf.select(Af).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Bf?Bf:x()}function s(){var a=Cf?Cf:y();return a>0?a:320}function t(){return ee(yf.data.targets)?0:Df?Df:bh?ch?v("x"):1:!uh||zh?1:v("y")}function u(){var a=1;return ee(yf.data.targets)?0:Ef?Ef:Ti?P()+(Dh&&!bh?v("y2"):a):Dh?Ih||bh?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||ch?"x"===a&&rh?rh:"y"!==a||uh?"y2"!==a||Dh?(jb(a).isInner?30:40)+("y2"===a?-10:0):$i:Xg&&!Ti?10:1:0}function x(){return+xf.select(Af).style("width").replace("px","")}function y(){return+xf.select(Af).style("height").replace("px","")}function z(a){return a?-5:-(Nf.left-1)}function A(a){return a?-20:-4}function B(){return z(!bh)}function C(){return A(!bh)}function D(){return z(bh)}function E(){return A(bh)}function F(a){return a?Qf+2+4:Nf.left+20}function G(a){return a?(rh?rh:0)+80:Sf+8}function H(){return F(!bh)}function I(){return G(!bh)}function J(){return F(bh)}function K(){return G(bh)}function L(){var a,b,c,d,e,f=Ac(yf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=jg(b.x)-jg(a.x),0===c?bh?Sf:Qf:(d=zc(),e=ae(yf.data.targets)?(d-(Bi?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function M(a){Ui=a}function N(a){Vi=a}function O(a){Wi=a}function P(){return Xg?Ti?Vi*(Ui+1):Uf:0}function Q(){return Xg?Ti?Vf:Wi*(Ui+1):0}function R(){var a,b,c=!jg;bg=bh?1:0,cg=bh?Sf:Qf,dg=bh?0:Sf,eg=bh?Qf:1,fg=bg,gg=cg,hg=bh?0:Tf,ig=bh?Rf:1,jg=T(bg,cg,c?void 0:jg.domain(),function(){return pg.tickOffset()}),kg=U(dg,eg,c?void 0:kg.domain()),lg=U(dg,eg,c?void 0:lg.domain()),mg=T(bg,cg,lj,function(a){return a%1?0:sg.tickOffset()}),ng=U(hg,ig,c?void 0:ng.domain()),og=U(hg,ig,c?void 0:og.domain()),a=$(),b=mh?mh:c?void 0:pg.tickValues(),pg=X(jg,Oi,a,b),sg=X(mg,Ri,a,b),qg=Y(kg,Pi,Ah,Ch),rg=Y(lg,Qi,Jh,Lh),c||(_i.scale(mg),Ff&&dj.scale(jg)),S()}function S(){Zf=Gb(),$f=Hb(),_f=Hb(.98)}function T(a,b,d,e){var f=(Ai?xf.time.scale():xf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Bi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=xf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?lg:kg}function W(a){return"y2"===Z(a)?og:ng}function X(a,b,c,d){var e=(Bi?Eb():xf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Bi?(e.tickCentered(gh),ve(ih)&&(ih=!1)):e.tickOffset=function(){var a=Bc(yf.data.targets),b=jg(a[1])-jg(a[0]),c=b?b:bh?Sf:Qf;return c/zc()/2},Bi&&e.categories(fh),e}function Y(a,b,c,d){return xf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Ag?Ag[a]:"y"}function $(){var a=Ai?Li:Bi?Tc:function(a){return 0>a?a.toFixed(0):a};return hh&&("function"==typeof hh?a=hh:Ai&&(a=function(a){return a?Ki(hh)(a):""})),a}function _(a){var b;return"y"===a?b=yh:"y2"===a?b=Hh:"x"===a&&(b=th),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?yh=b:"y2"===a?Hh=b:"x"===a&&(th=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",bh?"inner-top":"inner-right")}function hb(){return fb("y",bh?"inner-right":"inner-top")}function ib(){return fb("y2",bh?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Qf/2:Qf:b.isBottom?-Sf:b.isMiddle?-Sf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!bh,gb())}function rb(){return nb(bh,hb())}function sb(){return nb(bh,ib())}function tb(){return ob(!bh,gb())}function ub(){return ob(bh,hb())}function vb(){return ob(bh,ib())}function wb(){var a=gb();return bh?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":rh?rh-10:"3em"}function xb(){var a=hb();return bh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return bh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!bh,gb())}function Ab(){return pb(bh,hb())}function Bb(){return pb(bh,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return xf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){gj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),gj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),gj.select("."+f.axisY2+" ."+f.axisY2Label).transition().attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 xf.min(Object.keys(i).map(function(a){return xf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(zg.length>0)for(g=Sc(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 xf.max(Object.keys(i).map(function(a){return xf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Fh:wh,n="y2"===c?Eh:vh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Gh:xh,r=ud()&&bh;return 0===l.length?"y2"===c?lg.domain():kg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(kg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Bh&&(f=b(Bh.top)?Bh.top:e,g=b(Bh.bottom)?Bh.bottom:e),"y2"===c&&Kh&&(f=b(Kh.top)?Kh.top:e,g=b(Kh.bottom)?Kh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return ph?Ai?re(ph):ph:xf.min(a,function(a){return xf.min(a.values,function(a){return a.x})})}function Zb(a){return oh?Ai?re(oh):oh:xf.max(a,function(a){return xf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Bi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof qh&&we(qh)?(e=b(qh.left)?qh.left:d,f=b(qh.right)?qh.right:d):e=f="number"==typeof qh?qh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return c-d===0&&(c=Ai?new Date(.5*c.getTime()):-.5,d=Ai?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Ai?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Ai?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?kg:lg;return b="y"===a.axis||"y2"===a.axis?bh?Sf:"start"in a?d(a.start):Sf:bh?"end"in a?jg(Ai?re(a.end):a.end):Sf:Sf,c>b?0:b-c}function ic(a){return tg&&a===tg||we(ug)&&xe(ug,a)}function jc(a){return!ic(a)}function kc(a){return tg?tg:we(ug)?ug[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=yf.data.xs[b])}),c}function mc(a,b){return a in yf.data.xs&&yf.data.xs[a]&&yf.data.xs[a][b]?yf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){ug[b]=a[b]})}function oc(a){return 1===xf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=xg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),yf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=Ai?a?a instanceof Date?a:re(a):re(mc(c,d)):Ci&&!Bi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?yf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):tg?(d=Object.keys(yf.data.xs),yf.data.xs[c]=d.length>0?yf.data.xs[d[0]]:void 0):we(ug)&&(yf.data.xs[c]=lc(f,yf.data.targets)):yf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!yf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=wg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ci&&Bi&&0===c&&g&&(0===e&&(fh=[]),fh.push(g)),("undefined"==typeof a[b]||yf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Bg&&$d(Cc(c).filter(function(a){return!(a in Cg)}),Bg),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&yf.data.targets[0].values[a-1]?yf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(yf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Ai?new Date(i):i);j.push(e)}return Ai||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Mi=Mi.concat(a)}function Mc(a){Mi=Mi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Ni=Ni.concat(a)}function Oc(a){Ni=Ni.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return xf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Ld(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 Md(){return Eg&&"desc"===Eg.toLowerCase()}function Nd(){return Eg&&"asc"===Eg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Eg&&a.sort(Eg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(yf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&ni&&(jj.html(qi(a,$(),wd(k),Ji)).style("display","block"),d=jj.property("offsetWidth"),e=jj.property("offsetHeight"),k?(g=Qf/2+c[0],i=Sf/2+c[1]+20):(bh?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=jg(l[0].x)+20):(f=q(),g=f+t()+jg(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),jj.style("top",i+"px").style("left",g+"px"))}function Qd(){jj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});ni&&(be(yf.data.targets)||ee(yf.data.targets)||gj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(bh?"y1":"x1",Cd).attr(bh?"y2":"x2",Cd))}function Sd(){gj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?jg(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return"number"==typeof Zh?Zh:b?2*a.tickOffset()*$h/b:0}function $d(a,b){Dc(a).forEach(function(a){nj[a]=b===Cg[a],Cg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Cg[a.id]===b&&(c=!0),a.id in Cg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Cg)||"line"===Cg[b]||"spline"===Cg[b]||"area"===Cg[b]||"area-spline"===Cg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Cg[b]||"area-spline"===Cg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Cg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Cg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Cg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Cg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&hi||je(a)&&bi}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function re(b){var c;try{c=vg?xf.time.format(vg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+vg)}return c}function se(a,b){var c=xf.mouse(a),d=xf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?kg:lg,d=bh?1:0,e=bh?0:1;return Math.pow(jg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Qg(b,a.node()),gj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud).attr("stroke",function(){return Ji(b)}).attr("r",1.4*Je(b)).transition().duration(100).attr("r",Je)}function Be(a,b,c){Rg(b,a.node()),gj.select("."+f.selectedCircles+ld(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){Qg(b,a.node()),a.transition().duration(100).style("fill",function(){return xf.rgb(Ji(b)).darker(1)})}function Ee(a,b){Rg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ji(b)})}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){return Sh?"function"==typeof Th?Th(a):Th:0}function Ie(a){return Vh?Wh?Wh:1.75*He(a):He(a)}function Je(a){return Xh?Xh:4*He(a)}function Ke(a,c){return(c?gj.selectAll("."+f.circles+ld(c)):gj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Le(a,b){Ke(a,b).classed(f.EXPANDED,!0).attr("r",Ie)}function Me(a){Ke(a).filter(function(){return xf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",He)}function Ne(a){return gj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Oe(a){Ne(a).classed(f.EXPANDED,!0)}function Pe(a){Ne(a).classed(f.EXPANDED,!1)}function Qe(a,b){var c=Ue(a,b);return function(a,b){var d=c(a,b),e=bh?1:0,f=bh?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 Re(a,b){var c=Ue(a,!1),d=b?Se:Te;return function(a,b){return d(c(a,b),a,this)}}function Se(a,b){var c;return bh?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Te(a,b,c){var d=c.getBoundingClientRect();return bh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Ue(a,b){var c=a.__max__+1,d=Zd(pg,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return bh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Ve(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 We(b){var c,d,e;if(kj=xf.select(Af),kj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(kj.html("").classed("c3",!0),yf.data.xs={},yf.data.targets=vc(b),Ig&&Lc(Ig===!0?Cc(yf.data.targets):Ig),n(),R(),jg.domain(xf.extent(_b(yf.data.targets))),kg.domain(Xb(yf.data.targets,"y")),lg.domain(Xb(yf.data.targets,"y2")),mg.domain(jg.domain()),ng.domain(kg.domain()),og.domain(lg.domain()),lj=jg.domain(),_i.scale(mg),Ff&&dj.scale(jg),ej=kj.append("svg").on("mouseenter",If).on("mouseleave",Jf),fj=ej.append("defs"),fj.append("clipPath").attr("id",ui).append("rect"),fj.append("clipPath").attr("id",vi).append("rect"),fj.append("clipPath").attr("id",wi).append("rect"),ff(),gj=ej.append("g").attr("transform",Si.main),hj=ej.append("g").attr("transform",Si.context),ij=ej.append("g").attr("transform",Si.legend),Ug||hj.style("visibility","hidden"),Xg||(ij.style("visibility","hidden"),Ni=Cc(yf.data.targets)),jj=xf.select(Af).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),sf(Cc(yf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=gj.append("g").attr("clip-path",xi).attr("class",f.grid),Mh&&d.append("g").attr("class",f.xgrids),we(Oh)&&d.append("g").attr("class",f.xgridLines),Uh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Ph&&d.append("g").attr("class",f.ygrids),we(Qh)&&d.append("g").attr("class",f.ygridLines),ch&&gj.append("g").attr("class",f.axisX).attr("clip-path",yi).attr("transform",Si.x).append("text").attr("class",f.axisXLabel).attr("transform",bh?"rotate(-90)":"").style("text-anchor",zb),uh&&gj.append("g").attr("class",f.axisY).attr("clip-path",zi).attr("transform",Si.y).append("text").attr("class",f.axisYLabel).attr("transform",bh?"":"rotate(-90)").style("text-anchor",Ab),Dh&&gj.append("g").attr("class",f.axisY2).attr("transform",Si.y2).append("text").attr("class",f.axisY2Label).attr("transform",bh?"":"rotate(-90)").style("text-anchor",Bb),gj.append("g").attr("clip-path",xi).attr("class",f.regions),gj.append("g").attr("clip-path",xi).attr("class",f.chart),c=gj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ff?bh?"ns-resize":"ew-resize":null),gj.select("."+f.chart).append("g").attr("class",f.chartBars),gj.select("."+f.chart).append("g").attr("class",f.chartLines),gj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Si.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),gj.select("."+f.chart).append("g").attr("class",f.chartTexts),Ff&&gj.insert("rect",Hf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Qf).attr("height",Sf).style("opacity",0).style("cursor",bh?"ns-resize":"ew-resize").call(dj).on("dblclick.zoom",null),sh&&_i.extent("function"!=typeof sh?sh:sh(_b())),hj.append("g").attr("clip-path",xi).attr("class",f.chart),hj.select("."+f.chart).append("g").attr("class",f.chartBars),hj.select("."+f.chart).append("g").attr("class",f.chartLines),hj.append("g").attr("clip-path",xi).attr("class",f.brush).call(_i).selectAll("rect").attr(bh?"width":"height",bh?Rf:Tf),hj.append("g").attr("class",f.axisX).attr("transform",Si.subx).attr("clip-path",bh?"":yi),hf(yf.data.targets),bh?gj.select("."+f.axisX).style("opacity",0).call(pg):(gj.select("."+f.axisY).style("opacity",0).call(qg),gj.select("."+f.axisY2).style("opacity",0).call(rg)),n(),R(),ff(),m(!1),bf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),ri){if(Ai&&"string"==typeof si){for(si=re(si),e=0;e0){d=[];for(var g in xg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(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 _e(a){ee(yf.data.targets)||Jg&&(Di=a,gj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ei=!0,Sg())}function af(){ee(yf.data.targets)||Jg&&(gj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),gj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ei=!1,Tg())}function bf(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Vd(),W=ee(yf.data.targets),X=Ic(yf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Mf:0,Q=D?P:0,R=E?P:0,c=gj.select("."+f.axisX).style("opacity",W?0:1),g=gj.select("."+f.axisY).style("opacity",W?0:1),h=gj.select("."+f.axisY2).style("opacity",W?0:1),e=hj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Xg&&sf(Cc(yf.data.targets),a,O),Bi&&(0!==X.length&&H&&G||jg.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(jg.domain(xf.extent(_b(X))),lj=jg.domain(),Ff&&dj.scale(jg).updateScaleExtent(),mg.domain(jg.domain()),_i.scale(mg)),G&&(jg.domain(_i.empty()?lj:_i.extent()),Ff&&dj.scale(jg).updateScaleExtent()),mh||!lh&&!kh||(S=Kc(Jc(X),kh),pg.tickValues(S),sg.tickValues(S))),kg.domain(Xb(X,"y")),lg.domain(Xb(X,"y2")),O.axisX.call(pg),O.axisY.call(qg),O.axisY2.call(rg),O.axisSubX.call(sg),G&&X.length)if(ih&&S){for(T=1;T=0&&xf.select(this).style("display",b%U?"none":"block")})}else ej.selectAll("."+f.axisX+" .tick text").style("display","block");if(!bh&&nh&&eb(c,O.axisX,nh),J=Qe(V),M=Re(V,!0),N=Re(V,!1),Db(),ng.domain(kg.domain()),og.domain(lg.domain()),jj.style("display","none"),o(),gj.select("line."+f.xgridFocus).style("visibility","hidden"),Mh){if("year"===Nh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=jg.ticks(10);i=gj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",bh?0:function(a){return jg(a)-pg.tickOffset()}).attr("x2",bh?Qf:function(a){return jg(a)-pg.tickOffset()}).attr("y1",bh?function(a){return jg(a)-pg.tickOffset()}:Nf.top).attr("y2",bh?function(a){return jg(a)-pg.tickOffset()}:Sf).style("opacity",function(){return+xf.select(this).attr(bh?"y1":"x1")===(bh?Sf:0)?0:1}),i.exit().remove()}we(Oh)&&(k=gj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Oh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",bh?"":"rotate(-90)").attr("dx",bh?0:-Nf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",bh?0:Dd).attr("x2",bh?Qf:Dd).attr("y1",bh?Dd:Nf.top).attr("y2",bh?Dd:Sf).style("opacity",1),k.select("text").transition().duration(P).attr("x",bh?Qf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Ph&&(m=gj.select("."+f.ygrids).selectAll("."+f.ygrid).data(kg.ticks(Rh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",bh?kg:0).attr("x2",bh?kg:Qf).attr("y1",bh?0:kg).attr("y2",bh?Sf:kg),m.exit().remove()),A&&we(Qh)&&(n=gj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Qh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",bh?"rotate(-90)":"").attr("dx",bh?0:-Nf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",bh?Ed:0).attr("x2",bh?Ed:Qf).attr("y1",bh?0:Ed).attr("y2",bh?Sf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",bh?0:Qf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=gj.select("."+f.regions).selectAll("rect."+f.region).data(mi),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=gj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Ji(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=gj.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return bh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),gj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1),gj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",bj).style("opacity",mj),q=gj.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",He),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud),q.exit().remove(),gj.each(function(){Hi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=xf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Hi=!1}),gj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),gj.select("."+f.chartArcsTitle).style("opacity",de(yf.data.targets)?1:0),Ug&&(null!==xf.event&&"zoom"===xf.event.type&&_i.extent(jg.orgDomain()).update(),B&&(!bh&&nh&&eb(e,O.axisSubX,nh),_i.empty()||_i.extent(jg.orgDomain()).update(),K=Qe(V,!0),u=hj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Ji(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),hj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",cj).style("opacity",1))),gj.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),gj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud),v=gj.select("."+f.eventRects),we(ug)&&!oc(ug)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=gj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ye(w.enter()),w.attr("x",0).attr("y",0).attr("width",Qf).attr("height",Sf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ci&&!Bi?(z=function(a,b){var c=xc(b),d=yc(b),e=yf.data.xs[a.id][b];return(jg(d?d:e+50)-jg(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=yf.data.xs[a.id][b];return(jg(d)+jg(c?c:d-50))/2}):(z=L(),y=function(a){return jg(a.x)-z/2}),x=Ac(yf.data.targets),gj.select("."+f.eventRects).datum(x?x.values:[]),w=gj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Xe(w.enter()),w.attr("class",fd).attr("x",bh?0:y).attr("y",bh?y:0).attr("width",bh?Qf:z).attr("height",bh?z:Sf),w.exit().remove()),Cc(yf.data.targets).forEach(function(a){nj[a]=!0})}function cf(){bf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function df(){return"mousemove"===xf.event.sourceEvent.type&&dj.altDomain?(jg.domain(dj.altDomain),void dj.scale(jg).updateScaleExtent()):(Bi&&jg.orgDomain()[0]===lj[0]&&jg.domain([lj[0]-1e-10,jg.orgDomain()[1]]),bf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===xf.event.sourceEvent.type&&(Fi=!0)))}function ef(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function ff(){ej.attr("width",Uf).attr("height",Vf),ej.select("#"+ui).select("rect").attr("width",Qf).attr("height",Sf),ej.select("#"+vi).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),ej.select("#"+wi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej.select("."+f.zoomRect).attr("width",Qf).attr("height",Sf),kj.style("max-height",Vf+"px")}function gf(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),ff(),m(a.withTransition),bf(a)}function hf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=gj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Ji(a)}),e=gj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Lg(a)?"pointer":null}),c=gj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ji(a)}),b.append("path").attr("class",dd).style("opacity",function(){return mj=+xf.select(this).style("opacity"),0}).style("fill",function(a){return Ji(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Ji(a)}).style("cursor",function(a){return Lg(a)?"pointer":null}),a.forEach(function(a){gj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=gj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(ag(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Ji(a.data)}).style("cursor",function(a){return Lg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Hi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),of(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,xf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Hi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),pf(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Ug&&(n=hj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Ji(a)}),l=hj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ji(a)})),ej.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Mf).style("opacity",1)}function jf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),yf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Ti?j:i,l=Ti?Q():P();return d&&(w=0,C=0,t=0,u=0),Xg&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Ti?u:t,void(ah?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=ij.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,Ti?(g=function(a){return t*(.2+B[a])},j=function(a){return A[B[a]]+x[a]}):(g=function(a){return A[B[a]]+x[a]},j=function(a){return u*(.2+B[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=ij.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Zg?Zg(a):yf.toggle(a)}).on("mouseover",function(a){xf.select(this).classed(f.legendItemFocused,!0),Hi||yf.focus(a),"function"==typeof $g&&$g(a)}).on("mouseout",function(a){xf.select(this).classed(f.legendItemFocused,!1),Hi||yf.revert(),"function"==typeof _g&&_g(a)}),o.append("text").text(function(a){return d(xg[a])?xg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ti?h:-200).attr("y",Ti?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ti?i:-200).attr("y",Ti?-200:l).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Ji(a)}).attr("x",Ti?h:-200).attr("y",Ti?-200:j).attr("width",10).attr("height",10),ij.selectAll("text").data(a).text(function(a){return d(xg[a])?xg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),ij.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),ij.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),ij.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=xf.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?mf(b):nf(b):Xi}),N(t),O(u),M(C),n(),R(),ff(),m(q,c)}function tf(a){return Ec(yf.data.targets,a.id)}function uf(a){return"data"in a&&Ec(yf.data.targets,a.data.id)}function vf(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 wf(a,b,c){var d=!ee(yf.data.targets);Hi=!1,$d(a,b),gf(c||{withTransitionForAxis:d})}var xf=a.d3?a.d3:a.require?a.require("d3"):void 0,yf={data:{},axis:{},legend:{}},zf={},Af=h(["bindto"],"#chart"),Bf=h(["size","width"]),Cf=h(["size","height"]),Df=h(["padding","left"],50),Ef=h(["padding","right"]),Ff=h(["zoom","enabled"],!1),Gf=h(["zoom","extent"]),Hf=h(["zoom","privileged"],!1),If=h(["onenter"],function(){}),Jf=h(["onleave"],function(){}),Kf=h(["onresize"],function(){}),Lf=h(["onresized"],function(){}),Mf=h(["transition","duration"],350);g("data","data is required in config");var Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg=h(["data","x"]),ug=h(["data","xs"],{}),vg=h(["data","x_format"]),wg=h(["data","id_converter"],function(a){return a}),xg=h(["data","names"],{}),yg=h(["data","classes"],{}),zg=h(["data","groups"],[]),Ag=h(["data","axes"],{}),Bg=h(["data","type"]),Cg=h(["data","types"],{}),Dg=h(["data","labels"],{}),Eg=h(["data","order"]),Fg=h(["data","regions"],{}),Gg=h(["data","color"]),Hg=h(["data","colors"],{}),Ig=h(["data","hide"],!1),Jg=h(["data","selection","enabled"],!1),Kg=h(["data","selection","grouped"],!1),Lg=h(["data","selection","isselectable"],function(){return!0}),Mg=h(["data","selection","multiple"],!0),Ng=h(["data","onclick"],function(){}),Og=h(["data","onenter"],function(){}),Pg=h(["data","onleave"],function(){}),Qg=h(["data","onselected"],function(){}),Rg=h(["data","onunselected"],function(){}),Sg=h(["data","ondragstart"],function(){}),Tg=h(["data","ondragend"],function(){}),Ug=h(["subchart","show"],!1),Vg=h(["subchart","size","height"],60),Wg=h(["color","pattern"],[]),Xg=h(["legend","show"],!0),Yg=h(["legend","position"],"bottom"),Zg=h(["legend","item","onclick"]),$g=h(["legend","item","onmouseover"]),_g=h(["legend","item","onmouseout"]),ah=h(["legend","equally"],!1),bh=h(["axis","rotated"],!1),ch=h(["axis","x","show"],!0),dh=h(["axis","x","type"],"indexed"),eh=h(["axis","x","localtime"],!0),fh=h(["axis","x","categories"],[]),gh=h(["axis","x","tick","centered"],!1),hh=h(["axis","x","tick","format"]),ih=h(["axis","x","tick","culling"],{}),jh=h(["axis","x","tick","culling","max"],10),kh=h(["axis","x","tick","count"]),lh=h(["axis","x","tick","fit"],!0),mh=h(["axis","x","tick","values"],null),nh=h(["axis","x","tick","rotate"]),oh=h(["axis","x","max"],null),ph=h(["axis","x","min"],null),qh=h(["axis","x","padding"],{}),rh=h(["axis","x","height"]),sh=h(["axis","x","default"]),th=h(["axis","x","label"],{}),uh=h(["axis","y","show"],!0),vh=h(["axis","y","max"]),wh=h(["axis","y","min"]),xh=h(["axis","y","center"]),yh=h(["axis","y","label"],{}),zh=h(["axis","y","inner"],!1),Ah=h(["axis","y","tick","format"]),Bh=h(["axis","y","padding"]),Ch=h(["axis","y","ticks"],10),Dh=h(["axis","y2","show"],!1),Eh=h(["axis","y2","max"]),Fh=h(["axis","y2","min"]),Gh=h(["axis","y2","center"]),Hh=h(["axis","y2","label"],{}),Ih=h(["axis","y2","inner"],!1),Jh=h(["axis","y2","tick","format"]),Kh=h(["axis","y2","padding"]),Lh=h(["axis","y2","ticks"],10),Mh=h(["grid","x","show"],!1),Nh=h(["grid","x","type"],"tick"),Oh=h(["grid","x","lines"],[]),Ph=h(["grid","y","show"],!1),Qh=h(["grid","y","lines"],[]),Rh=h(["grid","y","ticks"],10),Sh=h(["point","show"],!0),Th=h(["point","r"],2.5),Uh=h(["point","focus","line","enabled"],!0),Vh=h(["point","focus","expand","enabled"],!0),Wh=h(["point","focus","expand","r"]),Xh=h(["point","focus","select","r"]),Yh=h(["line","connect_null"],!1),Zh=h(["bar","width"]),$h=h(["bar","width","ratio"],.6),_h=h(["pie","label","show"],!0),ai=h(["pie","label","format"]),bi=h(["pie","expand"],!0),ci=h(["pie","onclick"],function(){}),di=h(["pie","onmouseover"],function(){}),ei=h(["pie","onmouseout"],function(){}),fi=h(["donut","label","show"],!0),gi=h(["donut","label","format"]),hi=h(["donut","expand"],!0),ii=h(["donut","title"],""),ji=h(["donut","onclick"],function(){}),ki=h(["donut","onmouseover"],function(){}),li=h(["donut","onmouseout"],function(){}),mi=h(["regions"],[]),ni=h(["tooltip","show"],!0),oi=h(["tooltip","format","title"]),pi=h(["tooltip","format","value"]),qi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=oi?oi:b,l=pi?pi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id,a[g].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),ri=h(["tooltip","init","show"],!1),si=h(["tooltip","init","x"],0),ti=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ui=("string"==typeof Af?Af.replace("#",""):Af.id)+"-clip",vi=ui+"-xaxis",wi=ui+"-yaxis",xi=i(ui),yi=i(vi),zi=i(wi),Ai="timeseries"===dh,Bi="categorized"===dh,Ci=!Ai&&(tg||we(ug)),Di=null,Ei=!1,Fi=!1,Gi=!1,Hi=!1,Ii=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ji=qe(Hg,we(Wg)?Wg:Ii,Gg),Ki=eh?xf.time.format:xf.time.format.utc,Li=function(){var a=[[Ki("%Y/%-m/%-d"),function(){return!0}],[Ki("%-m/%-d"),function(a){return a.getMonth()}],[Ki("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ki("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ki("%I %p"),function(a){return a.getHours()}],[Ki("%I:%M"),function(a){return a.getMinutes()}],[Ki(":%S"),function(a){return a.getSeconds()}],[Ki(".%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)}}(),Mi=[],Ni=[],Oi=bh?"left":"bottom",Pi=bh?zh?"top":"bottom":zh?"right":"left",Qi=bh?Ih?"bottom":"top":Ih?"left":"right",Ri=bh?"left":"bottom",Si={main:function(){return"translate("+Nf.left+","+Nf.top+")"},context:function(){return"translate("+Of.left+","+Of.top+")"},legend:function(){return"translate("+Pf.left+","+Pf.top+")"},x:function(){return"translate(0,"+(bh?0:Sf)+")"},y:function(){return"translate(0,"+(bh?Sf:0)+")"},y2:function(){return"translate("+(bh?0:Qf)+","+(bh?1:0)+")"},subx:function(){return"translate(0,"+(bh?0:Tf)+")"},arc:function(){return"translate("+Qf/2+","+Sf/2+")"}},Ti="right"===Yg,Ui=0,Vi=0,Wi=0,Xi=.15,Yi=30,Zi=bh&&!ch?0:30,$i=5;ag=xf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var _i,aj=function(){var a=xf.svg.line().x(bh?function(a){return V(a.id)(a.value)}:Cd).y(bh?Cd:function(a){return V(a.id)(a.value)});return Yh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Yh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Fg[b.id]?Ve(e,jg,V(b.id),Fg[b.id]):a(e)):(c=e[0]?jg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,bh?"M "+d+" "+c:"M "+c+" "+d)}}(),bj=function(){var a;return a=bh?xf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):xf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?jg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,bh?"M "+d+" "+c:"M "+c+" "+d)}}(),cj=function(){var a=xf.svg.line().x(bh?function(a){return W(a.id)(a.value)}:Fd).y(bh?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+mg(c[0].x)+" "+W(b.id)(c[0].value)}}(),dj=function(){};_i=xf.svg.brush().on("brush",cf),_i.update=function(){return hj&&hj.select("."+f.brush).call(this),this},_i.scale=function(a){return bh?this.y(a):this.x(a)},Ff&&(dj=xf.behavior.zoom().on("zoomstart",function(){dj.altDomain=xf.event.sourceEvent.altKey?jg.orgDomain():null}).on("zoom",Ff?df:null),dj.scale=function(a){return bh?this.y(a):this.x(a)},dj.orgScaleExtent=function(){var a=Gf?Gf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},dj.updateScaleExtent=function(){var a=ac(jg.orgDomain())/ac(lj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var ej,fj,gj,hj,ij,jj,kj,lj,mj,nj={};if(yf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);yf.revert(),yf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(yf.data.targets)&&Nb(a,!0),of(a,!0)},yf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);yf.revert(),b(d.classed(f.focused,!1)),b(e),ee(yf.data.targets)&&Ob(a),of(a,!1)},yf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);b(d.classed(f.focused,!1)),b(e),ee(yf.data.targets)&&Ob(a),pf()},yf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),ej.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&qf(a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},yf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),ej.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&rf(a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},yf.toggle=function(a){Gc(a)?yf.hide(a):yf.show(a)},yf.unzoom=function(){_i.clear().update(),bf({withUpdateXDomain:!0})},yf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){yg[b]=a.classes[b]}),"categories"in a&&Bi&&(fh=a.categories,pg.categories(fh)),"cacheIds"in a&&bc(a.cacheIds)?void jf(dc(a.cacheIds),a.done):void("unload"in a?lf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){kf(a)}):kf(a))},yf.unload=function(a,b){lf(Dc(a),function(){bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},yf.selected=function(a){return xf.merge(gj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return xf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},yf.select=function(a,b,c){Jg&&gj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=xf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Kg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Lg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},yf.unselect=function(a,b){Jg&&gj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=xf.select(this),g="circle"===this.nodeName?Be:Ee,h=Kg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Lg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},yf.toLine=function(a){wf(a,"line")},yf.toSpline=function(a){wf(a,"spline")},yf.toBar=function(a){wf(a,"bar")},yf.toScatter=function(a){wf(a,"scatter")},yf.toArea=function(a){wf(a,"area")},yf.toAreaSpline=function(a){wf(a,"area-spline") -},yf.toPie=function(a){wf(a,"pie",{withTransform:!0})},yf.toDonut=function(a){wf(a,"donut",{withTransform:!0})},yf.groups=function(a){return c(a)?zg:(zg=a,bf(),zg)},yf.xgrids=function(a){return a?(Oh=a,bf(),Oh):Oh},yf.xgrids.add=function(a){return a?yf.xgrids(Oh.concat(a)):void 0},yf.xgrids.remove=function(a){var b=vf(a);return yf.xgrids(Oh.filter(b))},yf.ygrids=function(a){return a?(Qh=a,bf(),Qh):Qh},yf.ygrids.add=function(a){return a?yf.ygrids(Qh.concat(a)):void 0},yf.ygrids.remove=function(a){var b=vf(a);return yf.ygrids(Qh.filter(b))},yf.regions=function(a){return c(a)?mi:(mi=a,bf(),mi)},yf.regions.add=function(a){return c(a)?mi:(mi=mi.concat(a),bf(),mi)},yf.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;ej.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),mi=mi.filter(function(b){return b.classes.indexOf(a)<0})}),mi},yf.data.get=function(a){var b=yf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},yf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},yf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){xg[b]=a[b]}),sf(Cc(yf.data.targets),{withTransition:!0}),xg):xg},yf.x=function(a){return arguments.length&&(qc(yf.data.targets,a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),yf.data.xs},yf.xs=function(a){return arguments.length&&(rc(yf.data.targets,a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),yf.data.xs},yf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},yf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(vh=+a.y),b(a.y2)&&(Eh=+a.y2)):vh=Eh=+a,bf())},yf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(wh=+a.y),b(a.y2)&&(Fh=+a.y2)):wh=Fh=+a,bf())},yf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&yf.axis.max(a.max),"undefined"!=typeof a.min&&yf.axis.min(a.min))},yf.legend.show=function(a){qf(Dc(a)),bf({withLegend:!0})},yf.legend.hide=function(a){rf(Dc(a)),bf({withLegend:!0})},yf.resize=function(a){Bf=a?a.width:null,Cf=a?a.height:null,gf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},yf.destroy=function(){yf.data.targets=void 0,yf.data.xs={},kj.html(""),a.onresize=null},"url"in e.data)xf.xhr(e.data.url,function(a,b){var c,d=xf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=xf.csv.parse(b.response),We(c)});else if("rows"in e.data)We(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");We(uc(e.data.columns))}return yf},"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.33"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",lines:"c3-lines",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",arcs:"c3-arcs",area:"c3-area",areas:"c3-areas",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",legendItemFocused:"c3-legend-item-focused",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;cWf&&(Wf=0),0>Yf&&(Yf=0),Xf=hh?Tf.left-cj-dj:Wf,Zf=hh?Yf:_f-Uf.top-Uf.bottom,0>Xf&&(Xf=0),0>Zf&&(Zf=0),p(),Zi&&he(Ef.data.targets)&&(Vf.left=Wf/2+bg)}function o(){mj.select("line."+f.xgridFocus).attr("x1",hh?0:-10).attr("x2",hh?Wf:-10).attr("y1",hh?-10:Tf.top).attr("y2",hh?-10:Yf)}function p(){bg=Yf/2,ag=.95*bg,cg=ge(Ef.data.targets)?.6*ag:0}function q(){var a=hh?f.axisX:f.axisY,b=mj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Df.select(Gf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Hf?Hf:x()}function s(){var a=If?If:y();return a>0?a:320}function t(){return he(Ef.data.targets)?0:Jf?Jf:hh?ih?v("x"):1:!Ah||Fh?1:v("y")}function u(){var a=1;return he(Ef.data.targets)?0:Kf?Kf:Zi?P()+(Jh&&!hh?v("y2"):a):Jh?Oh||hh?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||ih?"x"===a&&xh?xh:"y"!==a||Ah?"y2"!==a||Jh?(jb(a).isInner?30:40)+("y2"===a?-10:0):ej:bh&&!Zi?10:1:0}function x(){return+Df.select(Gf).style("width").replace("px","")}function y(){return+Df.select(Gf).style("height").replace("px","")}function z(a){return a?-5:-(Tf.left-1)}function A(a){return a?-20:-4}function B(){return z(!hh)}function C(){return A(!hh)}function D(){return z(hh)}function E(){return A(hh)}function F(a){return a?Wf+2+4:Tf.left+20}function G(a){return a?(xh?xh:0)+80:Yf+8}function H(){return F(!hh)}function I(){return G(!hh)}function J(){return F(hh)}function K(){return G(hh)}function L(){var a,b,c,d,e,f=Ac(Ef.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=pg(b.x)-pg(a.x),0===c?hh?Yf:Wf:(d=zc(),e=de(Ef.data.targets)?(d-(Hi?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function M(a){$i=a}function N(a){_i=a}function O(a){aj=a}function P(){return bh?Zi?_i*($i+1):$f:0}function Q(){return bh?Zi?_f:aj*($i+1):0}function R(){var a,b,c=!pg;hg=hh?1:0,ig=hh?Yf:Wf,jg=hh?0:Yf,kg=hh?Wf:1,lg=hg,mg=ig,ng=hh?0:Zf,og=hh?Xf:1,pg=T(hg,ig,c?void 0:pg.domain(),function(){return vg.tickOffset()}),qg=U(jg,kg,c?void 0:qg.domain()),rg=U(jg,kg,c?void 0:rg.domain()),sg=T(hg,ig,rj,function(a){return a%1?0:yg.tickOffset()}),tg=U(ng,og,c?void 0:tg.domain()),ug=U(ng,og,c?void 0:ug.domain()),a=$(),b=sh?sh:c?void 0:vg.tickValues(),vg=X(pg,Ui,a,b),yg=X(sg,Xi,a,b),wg=Y(qg,Vi,Gh,Ih),xg=Y(rg,Wi,Ph,Rh),c||(fj.scale(sg),Lf&&jj.scale(pg)),S()}function S(){dg=Gb(),eg=Hb(),fg=Hb(.98)}function T(a,b,d,e){var f=(Gi?Df.time.scale():Df.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Hi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=Df.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?rg:qg}function W(a){return"y2"===Z(a)?ug:tg}function X(a,b,c,d){var e=(Hi?Eb():Df.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Hi?(e.tickCentered(mh),Ae(oh)&&(oh=!1)):e.tickOffset=function(){var a=Bc(Ef.data.targets),b=pg(a[1])-pg(a[0]),c=b?b:hh?Yf:Wf;return c/zc()/2},Hi&&e.categories(lh),e}function Y(a,b,c,d){return Df.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Gg?Gg[a]:"y"}function $(){var a=Gi?Ri:Hi?Tc:function(a){return 0>a?a.toFixed(0):a};return nh&&("function"==typeof nh?a=nh:Gi&&(a=function(a){return a?Qi(nh)(a):""})),a}function _(a){var b;return"y"===a?b=Eh:"y2"===a?b=Nh:"x"===a&&(b=zh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Eh=b:"y2"===a?Nh=b:"x"===a&&(zh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",hh?"inner-top":"inner-right")}function hb(){return fb("y",hh?"inner-right":"inner-top")}function ib(){return fb("y2",hh?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Wf/2:Wf:b.isBottom?-Yf:b.isMiddle?-Yf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!hh,gb())}function rb(){return nb(hh,hb())}function sb(){return nb(hh,ib())}function tb(){return ob(!hh,gb())}function ub(){return ob(hh,hb())}function vb(){return ob(hh,ib())}function wb(){var a=gb();return hh?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":xh?xh-10:"3em"}function xb(){var a=hb();return hh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return hh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!hh,gb())}function Ab(){return pb(hh,hb())}function Bb(){return pb(hh,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return Df.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){mj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),mj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),mj.select("."+f.axisY2+" ."+f.axisY2Label).transition().attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 Df.min(Object.keys(i).map(function(a){return Df.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(Fg.length>0)for(g=Sc(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 Df.max(Object.keys(i).map(function(a){return Df.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Lh:Ch,n="y2"===c?Kh:Bh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Mh:Dh,r=xd()&&hh;return 0===l.length?"y2"===c?rg.domain():qg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=yd(o,p),j=ac(qg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Hh&&(f=b(Hh.top)?Hh.top:e,g=b(Hh.bottom)?Hh.bottom:e),"y2"===c&&Qh&&(f=b(Qh.top)?Qh.top:e,g=b(Qh.bottom)?Qh.bottom:e),de(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return vh?Gi?we(vh):vh:Df.min(a,function(a){return Df.min(a.values,function(a){return a.x})})}function Zb(a){return uh?Gi?we(uh):uh:Df.max(a,function(a){return Df.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Hi?d=0:de(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof wh&&Be(wh)?(e=b(wh.left)?wh.left:d,f=b(wh.right)?wh.right:d):e=f="number"==typeof wh?wh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return c-d===0&&(c=Gi?new Date(.5*c.getTime()):-.5,d=Gi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Gi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Gi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?qg:rg;return b="y"===a.axis||"y2"===a.axis?hh?Yf:"start"in a?d(a.start):Yf:hh?"end"in a?pg(Gi?we(a.end):a.end):Yf:Yf,c>b?0:b-c}function ic(a){return zg&&a===zg||Be(Ag)&&Ce(Ag,a)}function jc(a){return!ic(a)}function kc(a){return zg?zg:Be(Ag)?Ag[a]:null}function lc(a,b){var c,d=b&&Be(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=Ef.data.xs[b])}),c}function mc(a,b){return a in Ef.data.xs&&Ef.data.xs[a]&&Ef.data.xs[a][b]?Ef.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){Ag[b]=a[b]})}function oc(a){return 1===Df.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=Dg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),Ef.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=Gi?a?a instanceof Date?a:we(a):we(mc(c,d)):Ii&&!Hi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Ef.data.xs[c]=a.map(function(a){return a[f]}).filter(b):zg?(d=Object.keys(Ef.data.xs),Ef.data.xs[c]=d.length>0?Ef.data.xs[d[0]]:void 0):Be(Ag)&&(Ef.data.xs[c]=lc(f,Ef.data.targets)):Ef.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Ef.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Cg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ii&&Hi&&0===c&&g&&(0===e&&(lh=[]),lh.push(g)),("undefined"==typeof a[b]||Ef.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Hg&&be(Cc(c).filter(function(a){return!(a in Ig)}),Hg),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&Ef.data.targets[0].values[a-1]?Ef.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(Ef.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Gi?new Date(i):i);j.push(e)}return Gi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Si=Si.concat(a)}function Mc(a){Si=Si.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Ti=Ti.concat(a)}function Oc(a){Ti=Ti.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Jd(a,f))),(a[g].x||0===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=De(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Nd(a,b){return Df.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Od(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 Pd(){return Kg&&"desc"===Kg.toLowerCase()}function Qd(){return Kg&&"asc"===Kg.toLowerCase()}function Rd(a){var b=Qd(),c=Pd();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 Kg&&a.sort(Kg),a}function Sd(a,c){var d,e,f,g,h,i,j,k=he(Ef.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&ti&&(pj.html(wi(a,$(),zd(k),Pi)).style("display","block"),d=pj.property("offsetWidth"),e=pj.property("offsetHeight"),k?(g=Wf/2+c[0],i=Yf/2+c[1]+20):(hh?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=pg(l[0].x)+20):(f=q(),g=f+t()+pg(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),pj.style("top",i+"px").style("left",g+"px"))}function Td(){pj.style("display","none")}function Ud(a){var c=a.filter(function(a){return a&&b(a.value)});ti&&(ee(Ef.data.targets)||he(Ef.data.targets)||mj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(hh?"y1":"x1",Fd).attr(hh?"y2":"x2",Fd))}function Vd(){mj.select("line."+f.xgridFocus).style("visibility","hidden")}function Wd(a){return a.x||0===a.x?pg(a.x):null}function Xd(a){return V(a.id)(a.value)}function Yd(){var a,b,d={},e=0;return Ic(Fc(ke)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ae(a,b){return"number"==typeof di?di:b?2*a.tickOffset()*ei/b:0}function be(a,b){Dc(a).forEach(function(a){tj[a]=b===Ig[a],Ig[a]=b})}function ce(a,b){var c=!1;return a.forEach(function(a){Ig[a.id]===b&&(c=!0),a.id in Ig||"line"!==b||(c=!0)}),c}function de(a){return ce(a,"bar")}function ee(a){return ce(a,"scatter")}function fe(a){return ce(a,"pie")}function ge(a){return ce(a,"donut")}function he(a){return fe(a)||ge(a)}function ie(a){var b="string"==typeof a?a:a.id;return!(b in Ig)||"line"===Ig[b]||"spline"===Ig[b]||"area"===Ig[b]||"area-spline"===Ig[b]}function je(a){var b="string"==typeof a?a:a.id;return"spline"===Ig[b]||"area-spline"===Ig[b]}function ke(a){var b="string"==typeof a?a:a.id;return"bar"===Ig[b]}function le(a){var b="string"==typeof a?a:a.id;return"scatter"===Ig[b]}function me(a){var b="string"==typeof a?a:a.id;return"pie"===Ig[b]}function ne(a){var b="string"==typeof a?a:a.id;return"donut"===Ig[b]}function oe(a){return me(a)||ne(a)}function pe(a){return ie(a)?[a]:[]}function qe(a){return oe(a.data)?[a]:[]}function re(a){return ke(a)?a.values:[]}function se(a){return ie(a)||le(a)?a.values:[]}function te(a){return ke(a)||ie(a)?a.values:[]}function ue(a){return ne(a)&&ni||me(a)&&hi}function ve(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function we(b){var c;try{c=Bg?Df.time.format(Bg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Bg)}return c}function xe(a,b){var c=Df.mouse(a),d=Df.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ce(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function De(a,b){var c="y"===Z(a.id)?qg:rg,d=hh?1:0,e=hh?0:1;return Math.pow(pg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ee(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Fe(a,b,c){Wg(b,a.node()),mj.select("."+f.selectedCircles+od(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",hh?Xd:Wd).attr("cy",hh?Wd:Xd).attr("stroke",function(){return Pi(b)}).attr("r",1.4*Pe(b)).transition().duration(100).attr("r",Pe)}function Ge(a,b,c){Xg(b,a.node()),mj.select("."+f.selectedCircles+od(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function He(a,b,c,d){a?Fe(b,c,d):Ge(b,c,d)}function Ie(a,b){Wg(b,a.node()),a.transition().duration(100).style("fill",function(){return Df.rgb(Pi(b)).brighter(.75)})}function Je(a,b){Xg(b,a.node()),a.transition().duration(100).style("fill",function(){return Pi(b)})}function Ke(a,b,c,d){a?Ie(b,c,d):Je(b,c,d)}function Le(a,b,c,d){Ke(a,b,c.data,d)}function Me(a){return a.filter(function(a){return b(a.value)})}function Ne(a){return Yh?"function"==typeof Zh?Zh(a):Zh:0}function Oe(a){return _h?ai?ai:1.75*Ne(a):Ne(a)}function Pe(a){return bi?bi:4*Ne(a)}function Qe(a,c){return(c?mj.selectAll("."+f.circles+od(c)):mj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Re(a,b){Qe(a,b).classed(f.EXPANDED,!0).attr("r",Oe)}function Se(a){Qe(a).filter(function(){return Df.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Ne)}function Te(a){return mj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ue(a){Te(a).classed(f.EXPANDED,!0)}function Ve(a){Te(a).classed(f.EXPANDED,!1)}function We(a,b){var c=$e(a,b);return function(a,b){var d=c(a,b),e=hh?1:0,f=hh?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 Xe(a,b){var c=$e(a,!1),d=b?Ye:Ze;return function(a,b){return d(c(a,b),a,this)}}function Ye(a,b){var c;return hh?(c=ke(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ze(a,b,c){var d=c.getBoundingClientRect();return hh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ke(b)?-3:-6)}function $e(a,b){var c=a.__max__+1,d=ae(vg,c),e=Zd(d,c,a,!!b),f=$d(!!b),g=_d(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return hh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function _e(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 af(b){var c,d,e;if(qj=Df.select(Gf),qj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(qj.html("").classed("c3",!0),Ef.data.xs={},Ef.data.targets=vc(b),Og&&Lc(Og===!0?Cc(Ef.data.targets):Og),n(),R(),pg.domain(Df.extent(_b(Ef.data.targets))),qg.domain(Xb(Ef.data.targets,"y")),rg.domain(Xb(Ef.data.targets,"y2")),sg.domain(pg.domain()),tg.domain(qg.domain()),ug.domain(rg.domain()),rj=pg.domain(),fj.scale(sg),Lf&&jj.scale(pg),kj=qj.append("svg").on("mouseenter",Of).on("mouseleave",Pf),lj=kj.append("defs"),lj.append("clipPath").attr("id",Ai).append("rect"),lj.append("clipPath").attr("id",Bi).append("rect"),lj.append("clipPath").attr("id",Ci).append("rect"),mf(),mj=kj.append("g").attr("transform",Yi.main),nj=kj.append("g").attr("transform",Yi.context),oj=kj.append("g").attr("transform",Yi.legend),$g||nj.style("visibility","hidden"),bh||(oj.style("visibility","hidden"),Ti=Cc(Ef.data.targets)),pj=Df.select(Gf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),yf(Cc(Ef.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=mj.append("g").attr("clip-path",Di).attr("class",f.grid),Sh&&d.append("g").attr("class",f.xgrids),Be(Uh)&&d.append("g").attr("class",f.xgridLines),$h&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Vh&&d.append("g").attr("class",f.ygrids),Be(Wh)&&d.append("g").attr("class",f.ygridLines),ih&&mj.append("g").attr("class",f.axisX).attr("clip-path",Ei).attr("transform",Yi.x).append("text").attr("class",f.axisXLabel).attr("transform",hh?"rotate(-90)":"").style("text-anchor",zb),Ah&&mj.append("g").attr("class",f.axisY).attr("clip-path",Fi).attr("transform",Yi.y).append("text").attr("class",f.axisYLabel).attr("transform",hh?"":"rotate(-90)").style("text-anchor",Ab),Jh&&mj.append("g").attr("class",f.axisY2).attr("transform",Yi.y2).append("text").attr("class",f.axisY2Label).attr("transform",hh?"":"rotate(-90)").style("text-anchor",Bb),mj.append("g").attr("clip-path",Di).attr("class",f.regions),mj.append("g").attr("clip-path",Di).attr("class",f.chart),c=mj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Lf?hh?"ns-resize":"ew-resize":null),mj.select("."+f.chart).append("g").attr("class",f.chartBars),mj.select("."+f.chart).append("g").attr("class",f.chartLines),mj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Yi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),mj.select("."+f.chart).append("g").attr("class",f.chartTexts),Lf&&mj.insert("rect",Nf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Wf).attr("height",Yf).style("opacity",0).style("cursor",hh?"ns-resize":"ew-resize").call(jj).on("dblclick.zoom",null),yh&&fj.extent("function"!=typeof yh?yh:yh(_b())),nj.append("g").attr("clip-path",Di).attr("class",f.chart),nj.select("."+f.chart).append("g").attr("class",f.chartBars),nj.select("."+f.chart).append("g").attr("class",f.chartLines),nj.append("g").attr("clip-path",Di).attr("class",f.brush).call(fj).selectAll("rect").attr(hh?"width":"height",hh?Xf:Zf),nj.append("g").attr("class",f.axisX).attr("transform",Yi.subx).attr("clip-path",hh?"":Ei),of(Ef.data.targets),hh?mj.select("."+f.axisX).style("opacity",0).call(vg):(mj.select("."+f.axisY).style("opacity",0).call(wg),mj.select("."+f.axisY2).style("opacity",0).call(xg)),n(),R(),mf(),m(!1),hf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),xi){if(Gi&&"string"==typeof yi){for(yi=we(yi),e=0;e0){d=[];for(var g in Dg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Od(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ke,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 ff(a){he(Ef.data.targets)||Pg&&(Ji=a,mj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ki=!0,Yg())}function gf(){he(Ef.data.targets)||Pg&&(mj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),mj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ki=!1,Zg())}function hf(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z=Yd(),$=he(Ef.data.targets),_=Ic(Ef.data.targets);if(a=d(a)?a:{},E=d(a.withY)?a.withY:!0,F=d(a.withSubchart)?a.withSubchart:!0,G=d(a.withTransition)?a.withTransition:!0,J=d(a.withTransform)?a.withTransform:!1,K=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,M=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,N=d(a.withLegend)?a.withLegend:!1,H=d(a.withTransitionForExit)?a.withTransitionForExit:G,I=d(a.withTransitionForAxis)?a.withTransitionForAxis:G,T=G?Sf:0,U=H?T:0,V=I?T:0,c=mj.select("."+f.axisX).style("opacity",$?0:1),g=mj.select("."+f.axisY).style("opacity",$?0:1),h=mj.select("."+f.axisY2).style("opacity",$?0:1),e=nj.select("."+f.axisX).style("opacity",$?0:1),S={axisX:c.transition().duration(V),axisY:g.transition().duration(V),axisY2:h.transition().duration(V),axisSubX:e.transition().duration(V)},N&&bh&&yf(Cc(Ef.data.targets),a,S),Hi&&(0!==_.length&&M&&K||pg.domain([0,c.selectAll(".tick").size()])),_.length&&(M&&(pg.domain(Df.extent(_b(_))),rj=pg.domain(),Lf&&jj.scale(pg).updateScaleExtent(),sg.domain(pg.domain()),fj.scale(sg)),K&&(pg.domain(fj.empty()?rj:fj.extent()),Lf&&jj.scale(pg).updateScaleExtent()),sh||!rh&&!qh||(W=Kc(Jc(_),qh),vg.tickValues(W),yg.tickValues(W))),qg.domain(Xb(_,"y")),rg.domain(Xb(_,"y2")),S.axisX.call(vg),S.axisY.call(wg),S.axisY2.call(xg),S.axisSubX.call(yg),K&&_.length)if(oh&&W){for(X=1;X=0&&Df.select(this).style("display",b%Y?"none":"block")})}else kj.selectAll("."+f.axisX+" .tick text").style("display","block");if(!hh&&th&&eb(c,S.axisX,th),O=We(Z),Q=Xe(Z,!0),R=Xe(Z,!1),Db(),tg.domain(qg.domain()),ug.domain(rg.domain()),pj.style("display","none"),o(),mj.select("line."+f.xgridFocus).style("visibility","hidden"),Sh){if("year"===Th){j=[];for(var ab=_b(),bb=ab[0].getFullYear(),cb=ab[1].getFullYear(),db=bb;cb>=db;db++)j.push(new Date(db+"-01-01 00:00:00"))}else j=pg.ticks(10);i=mj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",hh?0:function(a){return pg(a)-vg.tickOffset()}).attr("x2",hh?Wf:function(a){return pg(a)-vg.tickOffset()}).attr("y1",hh?function(a){return pg(a)-vg.tickOffset()}:Tf.top).attr("y2",hh?function(a){return pg(a)-vg.tickOffset()}:Yf).style("opacity",function(){return+Df.select(this).attr(hh?"y1":"x1")===(hh?Yf:0)?0:1}),i.exit().remove()}Be(Uh)&&(k=mj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Uh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",hh?"":"rotate(-90)").attr("dx",hh?0:-Tf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",hh?0:Gd).attr("x2",hh?Wf:Gd).attr("y1",hh?Gd:Tf.top).attr("y2",hh?Gd:Yf).style("opacity",1),k.select("text").transition().duration(T).attr("x",hh?Wf:0).attr("y",Gd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),E&&Vh&&(m=mj.select("."+f.ygrids).selectAll("."+f.ygrid).data(qg.ticks(Xh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",hh?qg:0).attr("x2",hh?qg:Wf).attr("y1",hh?0:qg).attr("y2",hh?Yf:qg),m.exit().remove()),E&&Be(Wh)&&(n=mj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Wh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",hh?"rotate(-90)":"").attr("dx",hh?0:-Tf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(T).attr("x1",hh?Hd:0).attr("x2",hh?Hd:Wf).attr("y1",hh?0:Hd).attr("y2",hh?Yf:Hd).style("opacity",1),n.select("text").transition().duration(T).attr("x",hh?0:Wf).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(T).style("opacity",0).remove()),v=mj.select("."+f.regions).selectAll("rect."+f.region).data(si),v.enter().append("rect").style("fill-opacity",0),v.attr("class",hd).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(T).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),v.exit().transition().duration(T).style("fill-opacity",0).remove(),t=mj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),t.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Pi),t.style("opacity",td).transition().duration(T).attr("d",O).style("opacity",1),t.exit().transition().duration(U).style("opacity",0).remove(),q=mj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),q.enter().append("path").attr("class",Zc).style("stroke",Pi),q.style("opacity",td).transition().duration(T).attr("d",gj).style("opacity",1),q.exit().transition().duration(U).style("opacity",0).remove(),r=mj.selectAll("."+f.areas).selectAll("."+f.area).data(pe),r.enter().append("path").attr("class",fd).style("fill",Pi).style("opacity",function(){return sj=+Df.select(this).style("opacity"),0}),r.style("opacity",0).transition().duration(T).attr("d",hj).style("opacity",sj),r.exit().transition().duration(U).style("opacity",0).remove(),s=mj.selectAll("."+f.circles).selectAll("."+f.circle).data(se),s.enter().append("circle").attr("class",_c).attr("r",Ne),s.style("opacity",td).transition().duration(T).style("opacity",vd).attr("cx",hh?Xd:Wd).attr("cy",hh?Wd:Xd),s.exit().remove(),w=mj.selectAll("."+f.texts).selectAll("."+f.text).data(te),w.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return hh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),w.text(function(a){return Ed(a.id)(a.value)}).style("fill-opacity",ud).transition().duration(T).attr("x",Q).attr("y",R).style("fill-opacity",wd),w.exit().transition().duration(U).style("fill-opacity",0).remove(),u=mj.selectAll("."+f.arcs).selectAll("."+f.arc).data(qe),u.enter().append("path").attr("class",dd).style("fill",function(a){return Pi(a.data)}).style("cursor",function(a){return Rg(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Ni||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),uf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Sd(d,Df.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Ni||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),vf(),Td(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();df(this,a,b),e(d,b)}),u.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Ni=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Fb(a);return c?(b=Df.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("opacity",1).call(Ee,function(){Ni=!1}),u.exit().transition().duration(U).style("opacity",0).remove(),mj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(T).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&oe(a.data)?1:0}),mj.select("."+f.chartArcsTitle).style("opacity",ge(Ef.data.targets)?1:0),$g&&(null!==Df.event&&"zoom"===Df.event.type&&fj.extent(pg.orgDomain()).update(),F&&(!hh&&th&&eb(e,S.axisSubX,th),fj.empty()||fj.extent(pg.orgDomain()).update(),P=We(Z,!0),y=nj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),y.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Pi),y.style("opacity",td).transition().duration(T).attr("d",P).style("opacity",1),y.exit().transition().duration(T).style("opacity",0).remove(),x=nj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),x.enter().append("path").attr("class",Zc).style("stroke",Pi),x.style("opacity",td).transition().duration(T).attr("d",ij).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove())),mj.selectAll("."+f.selectedCircles).filter(function(a){return ke(a)}).selectAll("circle").remove(),mj.selectAll("."+f.selectedCircle).transition().duration(T).attr("cx",hh?Xd:Wd).attr("cy",hh?Wd:Xd),z=mj.select("."+f.eventRects),Be(Ag)&&!oc(Ag)?(z.classed(f.eventRectsMultiple)||z.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),A=mj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),cf(A.enter()),A.attr("x",0).attr("y",0).attr("width",Wf).attr("height",Yf)):(z.classed(f.eventRectsSingle)||z.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ii&&!Hi?(D=function(a,b){var c=xc(b),d=yc(b),e=Ef.data.xs[a.id][b];return(pg(d?d:e+50)-pg(c?c:e-50))/2},C=function(a,b){var c=xc(b),d=Ef.data.xs[a.id][b];return(pg(d)+pg(c?c:d-50))/2}):(D=L(),C=function(a){return pg(a.x)-D/2}),B=Ac(Ef.data.targets),mj.select("."+f.eventRects).datum(B?B.values:[]),A=mj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),bf(A.enter()),A.attr("class",id).attr("x",hh?0:C).attr("y",hh?C:0).attr("width",hh?Wf:D).attr("height",hh?D:Yf),A.exit().remove()),Cc(Ef.data.targets).forEach(function(a){tj[a]=!0})}function jf(){hf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function kf(){return"mousemove"===Df.event.sourceEvent.type&&jj.altDomain?(pg.domain(jj.altDomain),void jj.scale(pg).updateScaleExtent()):(Hi&&pg.orgDomain()[0]===rj[0]&&pg.domain([rj[0]-1e-10,pg.orgDomain()[1]]),hf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Df.event.sourceEvent.type&&(Li=!0)))}function lf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function mf(){kj.attr("width",$f).attr("height",_f),kj.select("#"+Ai).select("rect").attr("width",Wf).attr("height",Yf),kj.select("#"+Bi).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),kj.select("#"+Ci).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),kj.select("."+f.zoomRect).attr("width",Wf).attr("height",Yf),qj.style("max-height",_f+"px")}function nf(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),mf(),m(a.withTransition),hf(a)}function of(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=mj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",kd),j=i.enter().append("g").attr("class",kd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Pi(a)}),e=mj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",md),d=e.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",cd).style("cursor",function(a){return Rg(a)?"pointer":null}),c=mj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",ld),b=c.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",$c),b.append("g").attr("class",gd),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",ad).style("fill",Pi).style("cursor",function(a){return Rg(a)?"pointer":null}),a.forEach(function(a){mj.selectAll("."+f.selectedCircles+od(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=mj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(gg(a)).attr("class",nd),g=h.enter().append("g").attr("class",nd),g.append("g").attr("class",ed),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),$g&&(n=nj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",md),m=n.enter().append("g").style("opacity",0).attr("class",md),m.append("g").attr("class",cd),l=nj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",ld),k=l.enter().append("g").style("opacity",0).attr("class",ld),k.append("g").attr("class",$c)),kj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Sf).style("opacity",1)}function pf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?be(a.id,b.types[a.id]):be(a.id,b.type)}),Ef.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Zi?j:i,l=Zi?Q():P();return d&&(w=0,C=0,t=0,u=0),bh&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Zi?u:t,void(gh?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=oj.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,Zi?(g=function(a){return t*(.2+B[a])},j=function(a){return A[B[a]]+x[a]}):(g=function(a){return A[B[a]]+x[a]},j=function(a){return u*(.2+B[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=oj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof dh?dh(a):Ef.toggle(a)}).on("mouseover",function(a){Df.select(this).classed(f.legendItemFocused,!0),Ni||Ef.focus(a),"function"==typeof eh&&eh(a)}).on("mouseout",function(a){Df.select(this).classed(f.legendItemFocused,!1),Ni||Ef.revert(),"function"==typeof fh&&fh(a)}),o.append("text").text(function(a){return d(Dg[a])?Dg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Zi?h:-200).attr("y",Zi?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Zi?i:-200).attr("y",Zi?-200:l).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Pi(a)}).attr("x",Zi?h:-200).attr("y",Zi?-200:j).attr("width",10).attr("height",10),oj.selectAll("text").data(a).text(function(a){return d(Dg[a])?Dg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),oj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),oj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),oj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=Df.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?sf(b):tf(b):bj}),N(t),O(u),M(C),n(),R(),mf(),m(q,c)}function zf(a){return Ec(Ef.data.targets,a.id)}function Af(a){return"data"in a&&Ec(Ef.data.targets,a.data.id)}function Bf(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 Cf(a,b,c){var d=!he(Ef.data.targets);Ni=!1,be(a,b),nf(c||{withTransitionForAxis:d})}var Df=a.d3?a.d3:a.require?a.require("d3"):void 0,Ef={data:{},axis:{},legend:{}},Ff={},Gf=h(["bindto"],"#chart"),Hf=h(["size","width"]),If=h(["size","height"]),Jf=h(["padding","left"],50),Kf=h(["padding","right"]),Lf=h(["zoom","enabled"],!1),Mf=h(["zoom","extent"]),Nf=h(["zoom","privileged"],!1),Of=h(["onenter"],function(){}),Pf=h(["onleave"],function(){}),Qf=h(["onresize"],function(){}),Rf=h(["onresized"],function(){}),Sf=h(["transition","duration"],350);g("data","data is required in config");var Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg=h(["data","x"]),Ag=h(["data","xs"],{}),Bg=h(["data","x_format"]),Cg=h(["data","id_converter"],function(a){return a}),Dg=h(["data","names"],{}),Eg=h(["data","classes"],{}),Fg=h(["data","groups"],[]),Gg=h(["data","axes"],{}),Hg=h(["data","type"]),Ig=h(["data","types"],{}),Jg=h(["data","labels"],{}),Kg=h(["data","order"]),Lg=h(["data","regions"],{}),Mg=h(["data","color"]),Ng=h(["data","colors"],{}),Og=h(["data","hide"],!1),Pg=h(["data","selection","enabled"],!1),Qg=h(["data","selection","grouped"],!1),Rg=h(["data","selection","isselectable"],function(){return!0}),Sg=h(["data","selection","multiple"],!0),Tg=h(["data","onclick"],function(){}),Ug=h(["data","onenter"],function(){}),Vg=h(["data","onleave"],function(){}),Wg=h(["data","onselected"],function(){}),Xg=h(["data","onunselected"],function(){}),Yg=h(["data","ondragstart"],function(){}),Zg=h(["data","ondragend"],function(){}),$g=h(["subchart","show"],!1),_g=h(["subchart","size","height"],60),ah=h(["color","pattern"],[]),bh=h(["legend","show"],!0),ch=h(["legend","position"],"bottom"),dh=h(["legend","item","onclick"]),eh=h(["legend","item","onmouseover"]),fh=h(["legend","item","onmouseout"]),gh=h(["legend","equally"],!1),hh=h(["axis","rotated"],!1),ih=h(["axis","x","show"],!0),jh=h(["axis","x","type"],"indexed"),kh=h(["axis","x","localtime"],!0),lh=h(["axis","x","categories"],[]),mh=h(["axis","x","tick","centered"],!1),nh=h(["axis","x","tick","format"]),oh=h(["axis","x","tick","culling"],{}),ph=h(["axis","x","tick","culling","max"],10),qh=h(["axis","x","tick","count"]),rh=h(["axis","x","tick","fit"],!0),sh=h(["axis","x","tick","values"],null),th=h(["axis","x","tick","rotate"]),uh=h(["axis","x","max"],null),vh=h(["axis","x","min"],null),wh=h(["axis","x","padding"],{}),xh=h(["axis","x","height"]),yh=h(["axis","x","default"]),zh=h(["axis","x","label"],{}),Ah=h(["axis","y","show"],!0),Bh=h(["axis","y","max"]),Ch=h(["axis","y","min"]),Dh=h(["axis","y","center"]),Eh=h(["axis","y","label"],{}),Fh=h(["axis","y","inner"],!1),Gh=h(["axis","y","tick","format"]),Hh=h(["axis","y","padding"]),Ih=h(["axis","y","ticks"],10),Jh=h(["axis","y2","show"],!1),Kh=h(["axis","y2","max"]),Lh=h(["axis","y2","min"]),Mh=h(["axis","y2","center"]),Nh=h(["axis","y2","label"],{}),Oh=h(["axis","y2","inner"],!1),Ph=h(["axis","y2","tick","format"]),Qh=h(["axis","y2","padding"]),Rh=h(["axis","y2","ticks"],10),Sh=h(["grid","x","show"],!1),Th=h(["grid","x","type"],"tick"),Uh=h(["grid","x","lines"],[]),Vh=h(["grid","y","show"],!1),Wh=h(["grid","y","lines"],[]),Xh=h(["grid","y","ticks"],10),Yh=h(["point","show"],!0),Zh=h(["point","r"],2.5),$h=h(["point","focus","line","enabled"],!0),_h=h(["point","focus","expand","enabled"],!0),ai=h(["point","focus","expand","r"]),bi=h(["point","focus","select","r"]),ci=h(["line","connect_null"],!1),di=h(["bar","width"]),ei=h(["bar","width","ratio"],.6),fi=h(["pie","label","show"],!0),gi=h(["pie","label","format"]),hi=h(["pie","expand"],!0),ii=h(["pie","onclick"],function(){}),ji=h(["pie","onmouseover"],function(){}),ki=h(["pie","onmouseout"],function(){}),li=h(["donut","label","show"],!0),mi=h(["donut","label","format"]),ni=h(["donut","expand"],!0),oi=h(["donut","title"],""),pi=h(["donut","onclick"],function(){}),qi=h(["donut","onmouseover"],function(){}),ri=h(["donut","onmouseout"],function(){}),si=h(["regions"],[]),ti=h(["tooltip","show"],!0),ui=h(["tooltip","format","title"]),vi=h(["tooltip","format","value"]),wi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ui?ui:b,l=vi?vi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id,a[g].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),xi=h(["tooltip","init","show"],!1),yi=h(["tooltip","init","x"],0),zi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Ai=("string"==typeof Gf?Gf.replace("#",""):Gf.id)+"-clip",Bi=Ai+"-xaxis",Ci=Ai+"-yaxis",Di=i(Ai),Ei=i(Bi),Fi=i(Ci),Gi="timeseries"===jh,Hi="categorized"===jh,Ii=!Gi&&(zg||Be(Ag)),Ji=null,Ki=!1,Li=!1,Mi=!1,Ni=!1,Oi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Pi=ve(Ng,Be(ah)?ah:Oi,Mg),Qi=kh?Df.time.format:Df.time.format.utc,Ri=function(){var a=[[Qi("%Y/%-m/%-d"),function(){return!0}],[Qi("%-m/%-d"),function(a){return a.getMonth()}],[Qi("%-m/%-d"),function(a){return 1!==a.getDate()}],[Qi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Qi("%I %p"),function(a){return a.getHours()}],[Qi("%I:%M"),function(a){return a.getMinutes()}],[Qi(":%S"),function(a){return a.getSeconds()}],[Qi(".%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)}}(),Si=[],Ti=[],Ui=hh?"left":"bottom",Vi=hh?Fh?"top":"bottom":Fh?"right":"left",Wi=hh?Oh?"bottom":"top":Oh?"left":"right",Xi=hh?"left":"bottom",Yi={main:function(){return"translate("+Tf.left+","+Tf.top+")"},context:function(){return"translate("+Uf.left+","+Uf.top+")"},legend:function(){return"translate("+Vf.left+","+Vf.top+")"},x:function(){return"translate(0,"+(hh?0:Yf)+")"},y:function(){return"translate(0,"+(hh?Yf:0)+")"},y2:function(){return"translate("+(hh?0:Wf)+","+(hh?1:0)+")"},subx:function(){return"translate(0,"+(hh?0:Zf)+")"},arc:function(){return"translate("+Wf/2+","+Yf/2+")"}},Zi="right"===ch,$i=0,_i=0,aj=0,bj=.15,cj=30,dj=hh&&!ih?0:30,ej=5;gg=Df.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var fj,gj=function(){var a=Df.svg.line().x(hh?function(a){return V(a.id)(a.value)}:Fd).y(hh?Fd:function(a){return V(a.id)(a.value)});return ci||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ci?Me(b.values):b.values;return ie(b)?(a.interpolate(je(b)?"cardinal":"linear"),Lg[b.id]?_e(e,pg,V(b.id),Lg[b.id]):a(e)):(c=e[0]?pg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,hh?"M "+d+" "+c:"M "+c+" "+d)}}(),hj=function(){var a;return a=hh?Df.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Fd):Df.svg.area().x(Fd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Me(b.values);return ce([b],"area")||ce([b],"area-spline")?(a.interpolate(je(b)?"cardinal":"linear"),a(e)):(c=e[0]?pg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,hh?"M "+d+" "+c:"M "+c+" "+d)}}(),ij=function(){var a=Df.svg.line().x(hh?function(a){return W(a.id)(a.value)}:Id).y(hh?Id:function(a){return W(a.id)(a.value)});return function(b){var c=Me(b.values);return ie(b)?a(c):"M "+sg(c[0].x)+" "+W(b.id)(c[0].value)}}(),jj=function(){};fj=Df.svg.brush().on("brush",jf),fj.update=function(){return nj&&nj.select("."+f.brush).call(this),this},fj.scale=function(a){return hh?this.y(a):this.x(a)},Lf&&(jj=Df.behavior.zoom().on("zoomstart",function(){jj.altDomain=Df.event.sourceEvent.altKey?pg.orgDomain():null}).on("zoom",Lf?kf:null),jj.scale=function(a){return hh?this.y(a):this.x(a)},jj.orgScaleExtent=function(){var a=Mf?Mf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},jj.updateScaleExtent=function(){var a=ac(pg.orgDomain())/ac(rj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var kj,lj,mj,nj,oj,pj,qj,rj,sj,tj={};if(Ef.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=kj.selectAll(pd(a)),d=c.filter(zf),e=c.filter(Af);Ef.revert(),Ef.defocus(),b(d.classed(f.focused,!0)),b(e),he(Ef.data.targets)&&Nb(a,!0),uf(a,!0)},Ef.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=kj.selectAll(pd(a)),d=c.filter(zf),e=c.filter(Af);Ef.revert(),b(d.classed(f.focused,!1)),b(e),he(Ef.data.targets)&&Ob(a),uf(a,!1)},Ef.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=kj.selectAll(pd(a)),d=c.filter(zf),e=c.filter(Af);b(d.classed(f.focused,!1)),b(e),he(Ef.data.targets)&&Ob(a),vf()},Ef.show=function(a,b){a=Dc(a),b=b||{},Mc(a),kj.selectAll(qd(a)).transition().style("opacity",1),b.withLegend&&wf(a),hf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ef.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),kj.selectAll(qd(a)).transition().style("opacity",0),b.withLegend&&xf(a),hf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ef.toggle=function(a){Gc(a)?Ef.hide(a):Ef.show(a)},Ef.unzoom=function(){fj.clear().update(),hf({withUpdateXDomain:!0})},Ef.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Eg[b]=a.classes[b]}),"categories"in a&&Hi&&(lh=a.categories,vg.categories(lh)),"cacheIds"in a&&bc(a.cacheIds)?void pf(dc(a.cacheIds),a.done):void("unload"in a?rf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){qf(a)}):qf(a))},Ef.unload=function(a,b){rf(Dc(a),function(){hf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Ef.selected=function(a){return Df.merge(mj.selectAll("."+f.shapes+od(a)).selectAll("."+f.shape).filter(function(){return Df.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Ef.select=function(a,b,c){Pg&&mj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=Df.select(this),i="circle"===this.nodeName?Fe:Ie,j="circle"===this.nodeName?Ge:Je,k=Qg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Rg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},Ef.unselect=function(a,b){Pg&&mj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=Df.select(this),g="circle"===this.nodeName?Ge:Je,h=Qg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED); +h&&i&&Rg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},Ef.toLine=function(a){Cf(a,"line")},Ef.toSpline=function(a){Cf(a,"spline")},Ef.toBar=function(a){Cf(a,"bar")},Ef.toScatter=function(a){Cf(a,"scatter")},Ef.toArea=function(a){Cf(a,"area")},Ef.toAreaSpline=function(a){Cf(a,"area-spline")},Ef.toPie=function(a){Cf(a,"pie",{withTransform:!0})},Ef.toDonut=function(a){Cf(a,"donut",{withTransform:!0})},Ef.groups=function(a){return c(a)?Fg:(Fg=a,hf(),Fg)},Ef.xgrids=function(a){return a?(Uh=a,hf(),Uh):Uh},Ef.xgrids.add=function(a){return a?Ef.xgrids(Uh.concat(a)):void 0},Ef.xgrids.remove=function(a){var b=Bf(a);return Ef.xgrids(Uh.filter(b))},Ef.ygrids=function(a){return a?(Wh=a,hf(),Wh):Wh},Ef.ygrids.add=function(a){return a?Ef.ygrids(Wh.concat(a)):void 0},Ef.ygrids.remove=function(a){var b=Bf(a);return Ef.ygrids(Wh.filter(b))},Ef.regions=function(a){return c(a)?si:(si=a,hf(),si)},Ef.regions.add=function(a){return c(a)?si:(si=si.concat(a),hf(),si)},Ef.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;kj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),si=si.filter(function(b){return b.classes.indexOf(a)<0})}),si},Ef.data.get=function(a){var b=Ef.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Ef.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},Ef.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Dg[b]=a[b]}),yf(Cc(Ef.data.targets),{withTransition:!0}),Dg):Dg},Ef.x=function(a){return arguments.length&&(qc(Ef.data.targets,a),hf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ef.data.xs},Ef.xs=function(a){return arguments.length&&(rc(Ef.data.targets,a),hf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ef.data.xs},Ef.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},Ef.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Bh=+a.y),b(a.y2)&&(Kh=+a.y2)):Bh=Kh=+a,hf())},Ef.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Ch=+a.y),b(a.y2)&&(Lh=+a.y2)):Ch=Lh=+a,hf())},Ef.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Ef.axis.max(a.max),"undefined"!=typeof a.min&&Ef.axis.min(a.min))},Ef.legend.show=function(a){wf(Dc(a)),hf({withLegend:!0})},Ef.legend.hide=function(a){xf(Dc(a)),hf({withLegend:!0})},Ef.resize=function(a){Hf=a?a.width:null,If=a?a.height:null,nf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Ef.destroy=function(){Ef.data.targets=void 0,Ef.data.xs={},qj.html(""),a.onresize=null},"url"in e.data)Df.xhr(e.data.url,function(a,b){var c,d=Df.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Df.csv.parse(b.response),af(c)});else if("rows"in e.data)af(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");af(uc(e.data.columns))}return Ef},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From a57b5d681a245b2c274abfa9baa7cfa68b6b26ad Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Fri, 2 May 2014 10:34:11 +0900 Subject: [PATCH 114/178] Fix select/unselect for arc - #158 --- c3.js | 20 ++++++++++---------- c3.min.js | 6 +++--- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/c3.js b/c3.js index ff845e5..34f188a 100644 --- a/c3.js +++ b/c3.js @@ -2291,6 +2291,9 @@ function toggleArc(selected, target, d, i) { toggleBar(selected, target, d.data, i); } + function getToggle(that) { + return that.nodeName === 'circle' ? togglePoint : (d3.select(that).classed(CLASS.bar) ? toggleBar : toggleArc); + } function filterRemoveNull(data) { return data.filter(function (d) { return isValue(d.value); }); @@ -4337,19 +4340,17 @@ c3.select = function (ids, indices, resetOther) { if (! __data_selection_enabled) { return; } main.selectAll('.' + CLASS.shapes).selectAll('.' + CLASS.shape).each(function (d, i) { - var shape = d3.select(this), - select = (this.nodeName === 'circle') ? selectPoint : selectBar, - unselect = (this.nodeName === 'circle') ? unselectPoint : unselectBar, - isTargetId = __data_selection_grouped || !ids || ids.indexOf(d.id) >= 0, + var shape = d3.select(this), id = d.data ? d.data.id : d.id, toggle = getToggle(this), + isTargetId = __data_selection_grouped || !ids || ids.indexOf(id) >= 0, isTargetIndex = !indices || indices.indexOf(i) >= 0, isSelected = shape.classed(CLASS.SELECTED); if (isTargetId && isTargetIndex) { if (__data_selection_isselectable(d) && !isSelected) { - select(shape.classed(CLASS.SELECTED, true), d, i); + toggle(true, shape.classed(CLASS.SELECTED, true), d, i); } } else if (isDefined(resetOther) && resetOther) { if (isSelected) { - unselect(shape.classed(CLASS.SELECTED, false), d, i); + toggle(false, shape.classed(CLASS.SELECTED, false), d, i); } } }); @@ -4358,15 +4359,14 @@ c3.unselect = function (ids, indices) { if (! __data_selection_enabled) { return; } main.selectAll('.' + CLASS.shapes).selectAll('.' + CLASS.shape).each(function (d, i) { - var shape = d3.select(this), - unselect = (this.nodeName === 'circle') ? unselectPoint : unselectBar, - isTargetId = __data_selection_grouped || !ids || ids.indexOf(d.id) >= 0, + var shape = d3.select(this), id = d.data ? d.data.id : d.id, toggle = getToggle(this), + isTargetId = __data_selection_grouped || !ids || ids.indexOf(id) >= 0, isTargetIndex = !indices || indices.indexOf(i) >= 0, isSelected = shape.classed(CLASS.SELECTED); if (isTargetId && isTargetIndex) { if (__data_selection_isselectable(d)) { if (isSelected) { - unselect(shape.classed(CLASS.SELECTED, false), d, i); + toggle(false, shape.classed(CLASS.SELECTED, false), d, i); } } } diff --git a/c3.min.js b/c3.min.js index 4db0ab2..29ba482 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.33"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",lines:"c3-lines",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",arcs:"c3-arcs",area:"c3-area",areas:"c3-areas",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",legendItemFocused:"c3-legend-item-focused",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;cWf&&(Wf=0),0>Yf&&(Yf=0),Xf=hh?Tf.left-cj-dj:Wf,Zf=hh?Yf:_f-Uf.top-Uf.bottom,0>Xf&&(Xf=0),0>Zf&&(Zf=0),p(),Zi&&he(Ef.data.targets)&&(Vf.left=Wf/2+bg)}function o(){mj.select("line."+f.xgridFocus).attr("x1",hh?0:-10).attr("x2",hh?Wf:-10).attr("y1",hh?-10:Tf.top).attr("y2",hh?-10:Yf)}function p(){bg=Yf/2,ag=.95*bg,cg=ge(Ef.data.targets)?.6*ag:0}function q(){var a=hh?f.axisX:f.axisY,b=mj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Df.select(Gf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Hf?Hf:x()}function s(){var a=If?If:y();return a>0?a:320}function t(){return he(Ef.data.targets)?0:Jf?Jf:hh?ih?v("x"):1:!Ah||Fh?1:v("y")}function u(){var a=1;return he(Ef.data.targets)?0:Kf?Kf:Zi?P()+(Jh&&!hh?v("y2"):a):Jh?Oh||hh?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||ih?"x"===a&&xh?xh:"y"!==a||Ah?"y2"!==a||Jh?(jb(a).isInner?30:40)+("y2"===a?-10:0):ej:bh&&!Zi?10:1:0}function x(){return+Df.select(Gf).style("width").replace("px","")}function y(){return+Df.select(Gf).style("height").replace("px","")}function z(a){return a?-5:-(Tf.left-1)}function A(a){return a?-20:-4}function B(){return z(!hh)}function C(){return A(!hh)}function D(){return z(hh)}function E(){return A(hh)}function F(a){return a?Wf+2+4:Tf.left+20}function G(a){return a?(xh?xh:0)+80:Yf+8}function H(){return F(!hh)}function I(){return G(!hh)}function J(){return F(hh)}function K(){return G(hh)}function L(){var a,b,c,d,e,f=Ac(Ef.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=pg(b.x)-pg(a.x),0===c?hh?Yf:Wf:(d=zc(),e=de(Ef.data.targets)?(d-(Hi?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function M(a){$i=a}function N(a){_i=a}function O(a){aj=a}function P(){return bh?Zi?_i*($i+1):$f:0}function Q(){return bh?Zi?_f:aj*($i+1):0}function R(){var a,b,c=!pg;hg=hh?1:0,ig=hh?Yf:Wf,jg=hh?0:Yf,kg=hh?Wf:1,lg=hg,mg=ig,ng=hh?0:Zf,og=hh?Xf:1,pg=T(hg,ig,c?void 0:pg.domain(),function(){return vg.tickOffset()}),qg=U(jg,kg,c?void 0:qg.domain()),rg=U(jg,kg,c?void 0:rg.domain()),sg=T(hg,ig,rj,function(a){return a%1?0:yg.tickOffset()}),tg=U(ng,og,c?void 0:tg.domain()),ug=U(ng,og,c?void 0:ug.domain()),a=$(),b=sh?sh:c?void 0:vg.tickValues(),vg=X(pg,Ui,a,b),yg=X(sg,Xi,a,b),wg=Y(qg,Vi,Gh,Ih),xg=Y(rg,Wi,Ph,Rh),c||(fj.scale(sg),Lf&&jj.scale(pg)),S()}function S(){dg=Gb(),eg=Hb(),fg=Hb(.98)}function T(a,b,d,e){var f=(Gi?Df.time.scale():Df.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Hi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=Df.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?rg:qg}function W(a){return"y2"===Z(a)?ug:tg}function X(a,b,c,d){var e=(Hi?Eb():Df.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Hi?(e.tickCentered(mh),Ae(oh)&&(oh=!1)):e.tickOffset=function(){var a=Bc(Ef.data.targets),b=pg(a[1])-pg(a[0]),c=b?b:hh?Yf:Wf;return c/zc()/2},Hi&&e.categories(lh),e}function Y(a,b,c,d){return Df.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Gg?Gg[a]:"y"}function $(){var a=Gi?Ri:Hi?Tc:function(a){return 0>a?a.toFixed(0):a};return nh&&("function"==typeof nh?a=nh:Gi&&(a=function(a){return a?Qi(nh)(a):""})),a}function _(a){var b;return"y"===a?b=Eh:"y2"===a?b=Nh:"x"===a&&(b=zh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Eh=b:"y2"===a?Nh=b:"x"===a&&(zh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",hh?"inner-top":"inner-right")}function hb(){return fb("y",hh?"inner-right":"inner-top")}function ib(){return fb("y2",hh?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Wf/2:Wf:b.isBottom?-Yf:b.isMiddle?-Yf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!hh,gb())}function rb(){return nb(hh,hb())}function sb(){return nb(hh,ib())}function tb(){return ob(!hh,gb())}function ub(){return ob(hh,hb())}function vb(){return ob(hh,ib())}function wb(){var a=gb();return hh?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":xh?xh-10:"3em"}function xb(){var a=hb();return hh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return hh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!hh,gb())}function Ab(){return pb(hh,hb())}function Bb(){return pb(hh,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return Df.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){mj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),mj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),mj.select("."+f.axisY2+" ."+f.axisY2Label).transition().attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 Df.min(Object.keys(i).map(function(a){return Df.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(Fg.length>0)for(g=Sc(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 Df.max(Object.keys(i).map(function(a){return Df.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Lh:Ch,n="y2"===c?Kh:Bh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Mh:Dh,r=xd()&&hh;return 0===l.length?"y2"===c?rg.domain():qg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=yd(o,p),j=ac(qg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Hh&&(f=b(Hh.top)?Hh.top:e,g=b(Hh.bottom)?Hh.bottom:e),"y2"===c&&Qh&&(f=b(Qh.top)?Qh.top:e,g=b(Qh.bottom)?Qh.bottom:e),de(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return vh?Gi?we(vh):vh:Df.min(a,function(a){return Df.min(a.values,function(a){return a.x})})}function Zb(a){return uh?Gi?we(uh):uh:Df.max(a,function(a){return Df.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Hi?d=0:de(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof wh&&Be(wh)?(e=b(wh.left)?wh.left:d,f=b(wh.right)?wh.right:d):e=f="number"==typeof wh?wh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return c-d===0&&(c=Gi?new Date(.5*c.getTime()):-.5,d=Gi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Gi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Gi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?qg:rg;return b="y"===a.axis||"y2"===a.axis?hh?Yf:"start"in a?d(a.start):Yf:hh?"end"in a?pg(Gi?we(a.end):a.end):Yf:Yf,c>b?0:b-c}function ic(a){return zg&&a===zg||Be(Ag)&&Ce(Ag,a)}function jc(a){return!ic(a)}function kc(a){return zg?zg:Be(Ag)?Ag[a]:null}function lc(a,b){var c,d=b&&Be(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=Ef.data.xs[b])}),c}function mc(a,b){return a in Ef.data.xs&&Ef.data.xs[a]&&Ef.data.xs[a][b]?Ef.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){Ag[b]=a[b]})}function oc(a){return 1===Df.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=Dg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),Ef.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=Gi?a?a instanceof Date?a:we(a):we(mc(c,d)):Ii&&!Hi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Ef.data.xs[c]=a.map(function(a){return a[f]}).filter(b):zg?(d=Object.keys(Ef.data.xs),Ef.data.xs[c]=d.length>0?Ef.data.xs[d[0]]:void 0):Be(Ag)&&(Ef.data.xs[c]=lc(f,Ef.data.targets)):Ef.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Ef.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Cg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ii&&Hi&&0===c&&g&&(0===e&&(lh=[]),lh.push(g)),("undefined"==typeof a[b]||Ef.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Hg&&be(Cc(c).filter(function(a){return!(a in Ig)}),Hg),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&Ef.data.targets[0].values[a-1]?Ef.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(Ef.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Gi?new Date(i):i);j.push(e)}return Gi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Si=Si.concat(a)}function Mc(a){Si=Si.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Ti=Ti.concat(a)}function Oc(a){Ti=Ti.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Jd(a,f))),(a[g].x||0===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=De(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Nd(a,b){return Df.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Od(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 Pd(){return Kg&&"desc"===Kg.toLowerCase()}function Qd(){return Kg&&"asc"===Kg.toLowerCase()}function Rd(a){var b=Qd(),c=Pd();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 Kg&&a.sort(Kg),a}function Sd(a,c){var d,e,f,g,h,i,j,k=he(Ef.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&ti&&(pj.html(wi(a,$(),zd(k),Pi)).style("display","block"),d=pj.property("offsetWidth"),e=pj.property("offsetHeight"),k?(g=Wf/2+c[0],i=Yf/2+c[1]+20):(hh?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=pg(l[0].x)+20):(f=q(),g=f+t()+pg(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),pj.style("top",i+"px").style("left",g+"px"))}function Td(){pj.style("display","none")}function Ud(a){var c=a.filter(function(a){return a&&b(a.value)});ti&&(ee(Ef.data.targets)||he(Ef.data.targets)||mj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(hh?"y1":"x1",Fd).attr(hh?"y2":"x2",Fd))}function Vd(){mj.select("line."+f.xgridFocus).style("visibility","hidden")}function Wd(a){return a.x||0===a.x?pg(a.x):null}function Xd(a){return V(a.id)(a.value)}function Yd(){var a,b,d={},e=0;return Ic(Fc(ke)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ae(a,b){return"number"==typeof di?di:b?2*a.tickOffset()*ei/b:0}function be(a,b){Dc(a).forEach(function(a){tj[a]=b===Ig[a],Ig[a]=b})}function ce(a,b){var c=!1;return a.forEach(function(a){Ig[a.id]===b&&(c=!0),a.id in Ig||"line"!==b||(c=!0)}),c}function de(a){return ce(a,"bar")}function ee(a){return ce(a,"scatter")}function fe(a){return ce(a,"pie")}function ge(a){return ce(a,"donut")}function he(a){return fe(a)||ge(a)}function ie(a){var b="string"==typeof a?a:a.id;return!(b in Ig)||"line"===Ig[b]||"spline"===Ig[b]||"area"===Ig[b]||"area-spline"===Ig[b]}function je(a){var b="string"==typeof a?a:a.id;return"spline"===Ig[b]||"area-spline"===Ig[b]}function ke(a){var b="string"==typeof a?a:a.id;return"bar"===Ig[b]}function le(a){var b="string"==typeof a?a:a.id;return"scatter"===Ig[b]}function me(a){var b="string"==typeof a?a:a.id;return"pie"===Ig[b]}function ne(a){var b="string"==typeof a?a:a.id;return"donut"===Ig[b]}function oe(a){return me(a)||ne(a)}function pe(a){return ie(a)?[a]:[]}function qe(a){return oe(a.data)?[a]:[]}function re(a){return ke(a)?a.values:[]}function se(a){return ie(a)||le(a)?a.values:[]}function te(a){return ke(a)||ie(a)?a.values:[]}function ue(a){return ne(a)&&ni||me(a)&&hi}function ve(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function we(b){var c;try{c=Bg?Df.time.format(Bg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Bg)}return c}function xe(a,b){var c=Df.mouse(a),d=Df.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ce(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function De(a,b){var c="y"===Z(a.id)?qg:rg,d=hh?1:0,e=hh?0:1;return Math.pow(pg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ee(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Fe(a,b,c){Wg(b,a.node()),mj.select("."+f.selectedCircles+od(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",hh?Xd:Wd).attr("cy",hh?Wd:Xd).attr("stroke",function(){return Pi(b)}).attr("r",1.4*Pe(b)).transition().duration(100).attr("r",Pe)}function Ge(a,b,c){Xg(b,a.node()),mj.select("."+f.selectedCircles+od(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function He(a,b,c,d){a?Fe(b,c,d):Ge(b,c,d)}function Ie(a,b){Wg(b,a.node()),a.transition().duration(100).style("fill",function(){return Df.rgb(Pi(b)).brighter(.75)})}function Je(a,b){Xg(b,a.node()),a.transition().duration(100).style("fill",function(){return Pi(b)})}function Ke(a,b,c,d){a?Ie(b,c,d):Je(b,c,d)}function Le(a,b,c,d){Ke(a,b,c.data,d)}function Me(a){return a.filter(function(a){return b(a.value)})}function Ne(a){return Yh?"function"==typeof Zh?Zh(a):Zh:0}function Oe(a){return _h?ai?ai:1.75*Ne(a):Ne(a)}function Pe(a){return bi?bi:4*Ne(a)}function Qe(a,c){return(c?mj.selectAll("."+f.circles+od(c)):mj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Re(a,b){Qe(a,b).classed(f.EXPANDED,!0).attr("r",Oe)}function Se(a){Qe(a).filter(function(){return Df.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Ne)}function Te(a){return mj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ue(a){Te(a).classed(f.EXPANDED,!0)}function Ve(a){Te(a).classed(f.EXPANDED,!1)}function We(a,b){var c=$e(a,b);return function(a,b){var d=c(a,b),e=hh?1:0,f=hh?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 Xe(a,b){var c=$e(a,!1),d=b?Ye:Ze;return function(a,b){return d(c(a,b),a,this)}}function Ye(a,b){var c;return hh?(c=ke(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ze(a,b,c){var d=c.getBoundingClientRect();return hh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ke(b)?-3:-6)}function $e(a,b){var c=a.__max__+1,d=ae(vg,c),e=Zd(d,c,a,!!b),f=$d(!!b),g=_d(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return hh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function _e(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 af(b){var c,d,e;if(qj=Df.select(Gf),qj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(qj.html("").classed("c3",!0),Ef.data.xs={},Ef.data.targets=vc(b),Og&&Lc(Og===!0?Cc(Ef.data.targets):Og),n(),R(),pg.domain(Df.extent(_b(Ef.data.targets))),qg.domain(Xb(Ef.data.targets,"y")),rg.domain(Xb(Ef.data.targets,"y2")),sg.domain(pg.domain()),tg.domain(qg.domain()),ug.domain(rg.domain()),rj=pg.domain(),fj.scale(sg),Lf&&jj.scale(pg),kj=qj.append("svg").on("mouseenter",Of).on("mouseleave",Pf),lj=kj.append("defs"),lj.append("clipPath").attr("id",Ai).append("rect"),lj.append("clipPath").attr("id",Bi).append("rect"),lj.append("clipPath").attr("id",Ci).append("rect"),mf(),mj=kj.append("g").attr("transform",Yi.main),nj=kj.append("g").attr("transform",Yi.context),oj=kj.append("g").attr("transform",Yi.legend),$g||nj.style("visibility","hidden"),bh||(oj.style("visibility","hidden"),Ti=Cc(Ef.data.targets)),pj=Df.select(Gf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),yf(Cc(Ef.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=mj.append("g").attr("clip-path",Di).attr("class",f.grid),Sh&&d.append("g").attr("class",f.xgrids),Be(Uh)&&d.append("g").attr("class",f.xgridLines),$h&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Vh&&d.append("g").attr("class",f.ygrids),Be(Wh)&&d.append("g").attr("class",f.ygridLines),ih&&mj.append("g").attr("class",f.axisX).attr("clip-path",Ei).attr("transform",Yi.x).append("text").attr("class",f.axisXLabel).attr("transform",hh?"rotate(-90)":"").style("text-anchor",zb),Ah&&mj.append("g").attr("class",f.axisY).attr("clip-path",Fi).attr("transform",Yi.y).append("text").attr("class",f.axisYLabel).attr("transform",hh?"":"rotate(-90)").style("text-anchor",Ab),Jh&&mj.append("g").attr("class",f.axisY2).attr("transform",Yi.y2).append("text").attr("class",f.axisY2Label).attr("transform",hh?"":"rotate(-90)").style("text-anchor",Bb),mj.append("g").attr("clip-path",Di).attr("class",f.regions),mj.append("g").attr("clip-path",Di).attr("class",f.chart),c=mj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Lf?hh?"ns-resize":"ew-resize":null),mj.select("."+f.chart).append("g").attr("class",f.chartBars),mj.select("."+f.chart).append("g").attr("class",f.chartLines),mj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Yi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),mj.select("."+f.chart).append("g").attr("class",f.chartTexts),Lf&&mj.insert("rect",Nf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Wf).attr("height",Yf).style("opacity",0).style("cursor",hh?"ns-resize":"ew-resize").call(jj).on("dblclick.zoom",null),yh&&fj.extent("function"!=typeof yh?yh:yh(_b())),nj.append("g").attr("clip-path",Di).attr("class",f.chart),nj.select("."+f.chart).append("g").attr("class",f.chartBars),nj.select("."+f.chart).append("g").attr("class",f.chartLines),nj.append("g").attr("clip-path",Di).attr("class",f.brush).call(fj).selectAll("rect").attr(hh?"width":"height",hh?Xf:Zf),nj.append("g").attr("class",f.axisX).attr("transform",Yi.subx).attr("clip-path",hh?"":Ei),of(Ef.data.targets),hh?mj.select("."+f.axisX).style("opacity",0).call(vg):(mj.select("."+f.axisY).style("opacity",0).call(wg),mj.select("."+f.axisY2).style("opacity",0).call(xg)),n(),R(),mf(),m(!1),hf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),xi){if(Gi&&"string"==typeof yi){for(yi=we(yi),e=0;e0){d=[];for(var g in Dg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Od(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ke,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 ff(a){he(Ef.data.targets)||Pg&&(Ji=a,mj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ki=!0,Yg())}function gf(){he(Ef.data.targets)||Pg&&(mj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),mj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ki=!1,Zg())}function hf(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z=Yd(),$=he(Ef.data.targets),_=Ic(Ef.data.targets);if(a=d(a)?a:{},E=d(a.withY)?a.withY:!0,F=d(a.withSubchart)?a.withSubchart:!0,G=d(a.withTransition)?a.withTransition:!0,J=d(a.withTransform)?a.withTransform:!1,K=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,M=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,N=d(a.withLegend)?a.withLegend:!1,H=d(a.withTransitionForExit)?a.withTransitionForExit:G,I=d(a.withTransitionForAxis)?a.withTransitionForAxis:G,T=G?Sf:0,U=H?T:0,V=I?T:0,c=mj.select("."+f.axisX).style("opacity",$?0:1),g=mj.select("."+f.axisY).style("opacity",$?0:1),h=mj.select("."+f.axisY2).style("opacity",$?0:1),e=nj.select("."+f.axisX).style("opacity",$?0:1),S={axisX:c.transition().duration(V),axisY:g.transition().duration(V),axisY2:h.transition().duration(V),axisSubX:e.transition().duration(V)},N&&bh&&yf(Cc(Ef.data.targets),a,S),Hi&&(0!==_.length&&M&&K||pg.domain([0,c.selectAll(".tick").size()])),_.length&&(M&&(pg.domain(Df.extent(_b(_))),rj=pg.domain(),Lf&&jj.scale(pg).updateScaleExtent(),sg.domain(pg.domain()),fj.scale(sg)),K&&(pg.domain(fj.empty()?rj:fj.extent()),Lf&&jj.scale(pg).updateScaleExtent()),sh||!rh&&!qh||(W=Kc(Jc(_),qh),vg.tickValues(W),yg.tickValues(W))),qg.domain(Xb(_,"y")),rg.domain(Xb(_,"y2")),S.axisX.call(vg),S.axisY.call(wg),S.axisY2.call(xg),S.axisSubX.call(yg),K&&_.length)if(oh&&W){for(X=1;X=0&&Df.select(this).style("display",b%Y?"none":"block")})}else kj.selectAll("."+f.axisX+" .tick text").style("display","block");if(!hh&&th&&eb(c,S.axisX,th),O=We(Z),Q=Xe(Z,!0),R=Xe(Z,!1),Db(),tg.domain(qg.domain()),ug.domain(rg.domain()),pj.style("display","none"),o(),mj.select("line."+f.xgridFocus).style("visibility","hidden"),Sh){if("year"===Th){j=[];for(var ab=_b(),bb=ab[0].getFullYear(),cb=ab[1].getFullYear(),db=bb;cb>=db;db++)j.push(new Date(db+"-01-01 00:00:00"))}else j=pg.ticks(10);i=mj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",hh?0:function(a){return pg(a)-vg.tickOffset()}).attr("x2",hh?Wf:function(a){return pg(a)-vg.tickOffset()}).attr("y1",hh?function(a){return pg(a)-vg.tickOffset()}:Tf.top).attr("y2",hh?function(a){return pg(a)-vg.tickOffset()}:Yf).style("opacity",function(){return+Df.select(this).attr(hh?"y1":"x1")===(hh?Yf:0)?0:1}),i.exit().remove()}Be(Uh)&&(k=mj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Uh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",hh?"":"rotate(-90)").attr("dx",hh?0:-Tf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",hh?0:Gd).attr("x2",hh?Wf:Gd).attr("y1",hh?Gd:Tf.top).attr("y2",hh?Gd:Yf).style("opacity",1),k.select("text").transition().duration(T).attr("x",hh?Wf:0).attr("y",Gd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),E&&Vh&&(m=mj.select("."+f.ygrids).selectAll("."+f.ygrid).data(qg.ticks(Xh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",hh?qg:0).attr("x2",hh?qg:Wf).attr("y1",hh?0:qg).attr("y2",hh?Yf:qg),m.exit().remove()),E&&Be(Wh)&&(n=mj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Wh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",hh?"rotate(-90)":"").attr("dx",hh?0:-Tf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(T).attr("x1",hh?Hd:0).attr("x2",hh?Hd:Wf).attr("y1",hh?0:Hd).attr("y2",hh?Yf:Hd).style("opacity",1),n.select("text").transition().duration(T).attr("x",hh?0:Wf).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(T).style("opacity",0).remove()),v=mj.select("."+f.regions).selectAll("rect."+f.region).data(si),v.enter().append("rect").style("fill-opacity",0),v.attr("class",hd).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(T).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),v.exit().transition().duration(T).style("fill-opacity",0).remove(),t=mj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),t.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Pi),t.style("opacity",td).transition().duration(T).attr("d",O).style("opacity",1),t.exit().transition().duration(U).style("opacity",0).remove(),q=mj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),q.enter().append("path").attr("class",Zc).style("stroke",Pi),q.style("opacity",td).transition().duration(T).attr("d",gj).style("opacity",1),q.exit().transition().duration(U).style("opacity",0).remove(),r=mj.selectAll("."+f.areas).selectAll("."+f.area).data(pe),r.enter().append("path").attr("class",fd).style("fill",Pi).style("opacity",function(){return sj=+Df.select(this).style("opacity"),0}),r.style("opacity",0).transition().duration(T).attr("d",hj).style("opacity",sj),r.exit().transition().duration(U).style("opacity",0).remove(),s=mj.selectAll("."+f.circles).selectAll("."+f.circle).data(se),s.enter().append("circle").attr("class",_c).attr("r",Ne),s.style("opacity",td).transition().duration(T).style("opacity",vd).attr("cx",hh?Xd:Wd).attr("cy",hh?Wd:Xd),s.exit().remove(),w=mj.selectAll("."+f.texts).selectAll("."+f.text).data(te),w.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return hh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),w.text(function(a){return Ed(a.id)(a.value)}).style("fill-opacity",ud).transition().duration(T).attr("x",Q).attr("y",R).style("fill-opacity",wd),w.exit().transition().duration(U).style("fill-opacity",0).remove(),u=mj.selectAll("."+f.arcs).selectAll("."+f.arc).data(qe),u.enter().append("path").attr("class",dd).style("fill",function(a){return Pi(a.data)}).style("cursor",function(a){return Rg(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Ni||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),uf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Sd(d,Df.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Ni||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),vf(),Td(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();df(this,a,b),e(d,b)}),u.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Ni=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Fb(a);return c?(b=Df.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("opacity",1).call(Ee,function(){Ni=!1}),u.exit().transition().duration(U).style("opacity",0).remove(),mj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(T).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&oe(a.data)?1:0}),mj.select("."+f.chartArcsTitle).style("opacity",ge(Ef.data.targets)?1:0),$g&&(null!==Df.event&&"zoom"===Df.event.type&&fj.extent(pg.orgDomain()).update(),F&&(!hh&&th&&eb(e,S.axisSubX,th),fj.empty()||fj.extent(pg.orgDomain()).update(),P=We(Z,!0),y=nj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),y.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Pi),y.style("opacity",td).transition().duration(T).attr("d",P).style("opacity",1),y.exit().transition().duration(T).style("opacity",0).remove(),x=nj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),x.enter().append("path").attr("class",Zc).style("stroke",Pi),x.style("opacity",td).transition().duration(T).attr("d",ij).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove())),mj.selectAll("."+f.selectedCircles).filter(function(a){return ke(a)}).selectAll("circle").remove(),mj.selectAll("."+f.selectedCircle).transition().duration(T).attr("cx",hh?Xd:Wd).attr("cy",hh?Wd:Xd),z=mj.select("."+f.eventRects),Be(Ag)&&!oc(Ag)?(z.classed(f.eventRectsMultiple)||z.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),A=mj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),cf(A.enter()),A.attr("x",0).attr("y",0).attr("width",Wf).attr("height",Yf)):(z.classed(f.eventRectsSingle)||z.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ii&&!Hi?(D=function(a,b){var c=xc(b),d=yc(b),e=Ef.data.xs[a.id][b];return(pg(d?d:e+50)-pg(c?c:e-50))/2},C=function(a,b){var c=xc(b),d=Ef.data.xs[a.id][b];return(pg(d)+pg(c?c:d-50))/2}):(D=L(),C=function(a){return pg(a.x)-D/2}),B=Ac(Ef.data.targets),mj.select("."+f.eventRects).datum(B?B.values:[]),A=mj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),bf(A.enter()),A.attr("class",id).attr("x",hh?0:C).attr("y",hh?C:0).attr("width",hh?Wf:D).attr("height",hh?D:Yf),A.exit().remove()),Cc(Ef.data.targets).forEach(function(a){tj[a]=!0})}function jf(){hf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function kf(){return"mousemove"===Df.event.sourceEvent.type&&jj.altDomain?(pg.domain(jj.altDomain),void jj.scale(pg).updateScaleExtent()):(Hi&&pg.orgDomain()[0]===rj[0]&&pg.domain([rj[0]-1e-10,pg.orgDomain()[1]]),hf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Df.event.sourceEvent.type&&(Li=!0)))}function lf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function mf(){kj.attr("width",$f).attr("height",_f),kj.select("#"+Ai).select("rect").attr("width",Wf).attr("height",Yf),kj.select("#"+Bi).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),kj.select("#"+Ci).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),kj.select("."+f.zoomRect).attr("width",Wf).attr("height",Yf),qj.style("max-height",_f+"px")}function nf(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),mf(),m(a.withTransition),hf(a)}function of(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=mj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",kd),j=i.enter().append("g").attr("class",kd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Pi(a)}),e=mj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",md),d=e.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",cd).style("cursor",function(a){return Rg(a)?"pointer":null}),c=mj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",ld),b=c.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",$c),b.append("g").attr("class",gd),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",ad).style("fill",Pi).style("cursor",function(a){return Rg(a)?"pointer":null}),a.forEach(function(a){mj.selectAll("."+f.selectedCircles+od(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=mj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(gg(a)).attr("class",nd),g=h.enter().append("g").attr("class",nd),g.append("g").attr("class",ed),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),$g&&(n=nj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",md),m=n.enter().append("g").style("opacity",0).attr("class",md),m.append("g").attr("class",cd),l=nj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",ld),k=l.enter().append("g").style("opacity",0).attr("class",ld),k.append("g").attr("class",$c)),kj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Sf).style("opacity",1)}function pf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?be(a.id,b.types[a.id]):be(a.id,b.type)}),Ef.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=Zi?j:i,l=Zi?Q():P();return d&&(w=0,C=0,t=0,u=0),bh&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=Zi?u:t,void(gh?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=oj.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,Zi?(g=function(a){return t*(.2+B[a])},j=function(a){return A[B[a]]+x[a]}):(g=function(a){return A[B[a]]+x[a]},j=function(a){return u*(.2+B[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=oj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof dh?dh(a):Ef.toggle(a)}).on("mouseover",function(a){Df.select(this).classed(f.legendItemFocused,!0),Ni||Ef.focus(a),"function"==typeof eh&&eh(a)}).on("mouseout",function(a){Df.select(this).classed(f.legendItemFocused,!1),Ni||Ef.revert(),"function"==typeof fh&&fh(a)}),o.append("text").text(function(a){return d(Dg[a])?Dg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Zi?h:-200).attr("y",Zi?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Zi?i:-200).attr("y",Zi?-200:l).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Pi(a)}).attr("x",Zi?h:-200).attr("y",Zi?-200:j).attr("width",10).attr("height",10),oj.selectAll("text").data(a).text(function(a){return d(Dg[a])?Dg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),oj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),oj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),oj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=Df.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?sf(b):tf(b):bj}),N(t),O(u),M(C),n(),R(),mf(),m(q,c)}function zf(a){return Ec(Ef.data.targets,a.id)}function Af(a){return"data"in a&&Ec(Ef.data.targets,a.data.id)}function Bf(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 Cf(a,b,c){var d=!he(Ef.data.targets);Ni=!1,be(a,b),nf(c||{withTransitionForAxis:d})}var Df=a.d3?a.d3:a.require?a.require("d3"):void 0,Ef={data:{},axis:{},legend:{}},Ff={},Gf=h(["bindto"],"#chart"),Hf=h(["size","width"]),If=h(["size","height"]),Jf=h(["padding","left"],50),Kf=h(["padding","right"]),Lf=h(["zoom","enabled"],!1),Mf=h(["zoom","extent"]),Nf=h(["zoom","privileged"],!1),Of=h(["onenter"],function(){}),Pf=h(["onleave"],function(){}),Qf=h(["onresize"],function(){}),Rf=h(["onresized"],function(){}),Sf=h(["transition","duration"],350);g("data","data is required in config");var Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg=h(["data","x"]),Ag=h(["data","xs"],{}),Bg=h(["data","x_format"]),Cg=h(["data","id_converter"],function(a){return a}),Dg=h(["data","names"],{}),Eg=h(["data","classes"],{}),Fg=h(["data","groups"],[]),Gg=h(["data","axes"],{}),Hg=h(["data","type"]),Ig=h(["data","types"],{}),Jg=h(["data","labels"],{}),Kg=h(["data","order"]),Lg=h(["data","regions"],{}),Mg=h(["data","color"]),Ng=h(["data","colors"],{}),Og=h(["data","hide"],!1),Pg=h(["data","selection","enabled"],!1),Qg=h(["data","selection","grouped"],!1),Rg=h(["data","selection","isselectable"],function(){return!0}),Sg=h(["data","selection","multiple"],!0),Tg=h(["data","onclick"],function(){}),Ug=h(["data","onenter"],function(){}),Vg=h(["data","onleave"],function(){}),Wg=h(["data","onselected"],function(){}),Xg=h(["data","onunselected"],function(){}),Yg=h(["data","ondragstart"],function(){}),Zg=h(["data","ondragend"],function(){}),$g=h(["subchart","show"],!1),_g=h(["subchart","size","height"],60),ah=h(["color","pattern"],[]),bh=h(["legend","show"],!0),ch=h(["legend","position"],"bottom"),dh=h(["legend","item","onclick"]),eh=h(["legend","item","onmouseover"]),fh=h(["legend","item","onmouseout"]),gh=h(["legend","equally"],!1),hh=h(["axis","rotated"],!1),ih=h(["axis","x","show"],!0),jh=h(["axis","x","type"],"indexed"),kh=h(["axis","x","localtime"],!0),lh=h(["axis","x","categories"],[]),mh=h(["axis","x","tick","centered"],!1),nh=h(["axis","x","tick","format"]),oh=h(["axis","x","tick","culling"],{}),ph=h(["axis","x","tick","culling","max"],10),qh=h(["axis","x","tick","count"]),rh=h(["axis","x","tick","fit"],!0),sh=h(["axis","x","tick","values"],null),th=h(["axis","x","tick","rotate"]),uh=h(["axis","x","max"],null),vh=h(["axis","x","min"],null),wh=h(["axis","x","padding"],{}),xh=h(["axis","x","height"]),yh=h(["axis","x","default"]),zh=h(["axis","x","label"],{}),Ah=h(["axis","y","show"],!0),Bh=h(["axis","y","max"]),Ch=h(["axis","y","min"]),Dh=h(["axis","y","center"]),Eh=h(["axis","y","label"],{}),Fh=h(["axis","y","inner"],!1),Gh=h(["axis","y","tick","format"]),Hh=h(["axis","y","padding"]),Ih=h(["axis","y","ticks"],10),Jh=h(["axis","y2","show"],!1),Kh=h(["axis","y2","max"]),Lh=h(["axis","y2","min"]),Mh=h(["axis","y2","center"]),Nh=h(["axis","y2","label"],{}),Oh=h(["axis","y2","inner"],!1),Ph=h(["axis","y2","tick","format"]),Qh=h(["axis","y2","padding"]),Rh=h(["axis","y2","ticks"],10),Sh=h(["grid","x","show"],!1),Th=h(["grid","x","type"],"tick"),Uh=h(["grid","x","lines"],[]),Vh=h(["grid","y","show"],!1),Wh=h(["grid","y","lines"],[]),Xh=h(["grid","y","ticks"],10),Yh=h(["point","show"],!0),Zh=h(["point","r"],2.5),$h=h(["point","focus","line","enabled"],!0),_h=h(["point","focus","expand","enabled"],!0),ai=h(["point","focus","expand","r"]),bi=h(["point","focus","select","r"]),ci=h(["line","connect_null"],!1),di=h(["bar","width"]),ei=h(["bar","width","ratio"],.6),fi=h(["pie","label","show"],!0),gi=h(["pie","label","format"]),hi=h(["pie","expand"],!0),ii=h(["pie","onclick"],function(){}),ji=h(["pie","onmouseover"],function(){}),ki=h(["pie","onmouseout"],function(){}),li=h(["donut","label","show"],!0),mi=h(["donut","label","format"]),ni=h(["donut","expand"],!0),oi=h(["donut","title"],""),pi=h(["donut","onclick"],function(){}),qi=h(["donut","onmouseover"],function(){}),ri=h(["donut","onmouseout"],function(){}),si=h(["regions"],[]),ti=h(["tooltip","show"],!0),ui=h(["tooltip","format","title"]),vi=h(["tooltip","format","value"]),wi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ui?ui:b,l=vi?vi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id,a[g].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),xi=h(["tooltip","init","show"],!1),yi=h(["tooltip","init","x"],0),zi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Ai=("string"==typeof Gf?Gf.replace("#",""):Gf.id)+"-clip",Bi=Ai+"-xaxis",Ci=Ai+"-yaxis",Di=i(Ai),Ei=i(Bi),Fi=i(Ci),Gi="timeseries"===jh,Hi="categorized"===jh,Ii=!Gi&&(zg||Be(Ag)),Ji=null,Ki=!1,Li=!1,Mi=!1,Ni=!1,Oi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Pi=ve(Ng,Be(ah)?ah:Oi,Mg),Qi=kh?Df.time.format:Df.time.format.utc,Ri=function(){var a=[[Qi("%Y/%-m/%-d"),function(){return!0}],[Qi("%-m/%-d"),function(a){return a.getMonth()}],[Qi("%-m/%-d"),function(a){return 1!==a.getDate()}],[Qi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Qi("%I %p"),function(a){return a.getHours()}],[Qi("%I:%M"),function(a){return a.getMinutes()}],[Qi(":%S"),function(a){return a.getSeconds()}],[Qi(".%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)}}(),Si=[],Ti=[],Ui=hh?"left":"bottom",Vi=hh?Fh?"top":"bottom":Fh?"right":"left",Wi=hh?Oh?"bottom":"top":Oh?"left":"right",Xi=hh?"left":"bottom",Yi={main:function(){return"translate("+Tf.left+","+Tf.top+")"},context:function(){return"translate("+Uf.left+","+Uf.top+")"},legend:function(){return"translate("+Vf.left+","+Vf.top+")"},x:function(){return"translate(0,"+(hh?0:Yf)+")"},y:function(){return"translate(0,"+(hh?Yf:0)+")"},y2:function(){return"translate("+(hh?0:Wf)+","+(hh?1:0)+")"},subx:function(){return"translate(0,"+(hh?0:Zf)+")"},arc:function(){return"translate("+Wf/2+","+Yf/2+")"}},Zi="right"===ch,$i=0,_i=0,aj=0,bj=.15,cj=30,dj=hh&&!ih?0:30,ej=5;gg=Df.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var fj,gj=function(){var a=Df.svg.line().x(hh?function(a){return V(a.id)(a.value)}:Fd).y(hh?Fd:function(a){return V(a.id)(a.value)});return ci||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ci?Me(b.values):b.values;return ie(b)?(a.interpolate(je(b)?"cardinal":"linear"),Lg[b.id]?_e(e,pg,V(b.id),Lg[b.id]):a(e)):(c=e[0]?pg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,hh?"M "+d+" "+c:"M "+c+" "+d)}}(),hj=function(){var a;return a=hh?Df.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Fd):Df.svg.area().x(Fd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Me(b.values);return ce([b],"area")||ce([b],"area-spline")?(a.interpolate(je(b)?"cardinal":"linear"),a(e)):(c=e[0]?pg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,hh?"M "+d+" "+c:"M "+c+" "+d)}}(),ij=function(){var a=Df.svg.line().x(hh?function(a){return W(a.id)(a.value)}:Id).y(hh?Id:function(a){return W(a.id)(a.value)});return function(b){var c=Me(b.values);return ie(b)?a(c):"M "+sg(c[0].x)+" "+W(b.id)(c[0].value)}}(),jj=function(){};fj=Df.svg.brush().on("brush",jf),fj.update=function(){return nj&&nj.select("."+f.brush).call(this),this},fj.scale=function(a){return hh?this.y(a):this.x(a)},Lf&&(jj=Df.behavior.zoom().on("zoomstart",function(){jj.altDomain=Df.event.sourceEvent.altKey?pg.orgDomain():null}).on("zoom",Lf?kf:null),jj.scale=function(a){return hh?this.y(a):this.x(a)},jj.orgScaleExtent=function(){var a=Mf?Mf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},jj.updateScaleExtent=function(){var a=ac(pg.orgDomain())/ac(rj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var kj,lj,mj,nj,oj,pj,qj,rj,sj,tj={};if(Ef.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=kj.selectAll(pd(a)),d=c.filter(zf),e=c.filter(Af);Ef.revert(),Ef.defocus(),b(d.classed(f.focused,!0)),b(e),he(Ef.data.targets)&&Nb(a,!0),uf(a,!0)},Ef.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=kj.selectAll(pd(a)),d=c.filter(zf),e=c.filter(Af);Ef.revert(),b(d.classed(f.focused,!1)),b(e),he(Ef.data.targets)&&Ob(a),uf(a,!1)},Ef.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=kj.selectAll(pd(a)),d=c.filter(zf),e=c.filter(Af);b(d.classed(f.focused,!1)),b(e),he(Ef.data.targets)&&Ob(a),vf()},Ef.show=function(a,b){a=Dc(a),b=b||{},Mc(a),kj.selectAll(qd(a)).transition().style("opacity",1),b.withLegend&&wf(a),hf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ef.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),kj.selectAll(qd(a)).transition().style("opacity",0),b.withLegend&&xf(a),hf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ef.toggle=function(a){Gc(a)?Ef.hide(a):Ef.show(a)},Ef.unzoom=function(){fj.clear().update(),hf({withUpdateXDomain:!0})},Ef.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Eg[b]=a.classes[b]}),"categories"in a&&Hi&&(lh=a.categories,vg.categories(lh)),"cacheIds"in a&&bc(a.cacheIds)?void pf(dc(a.cacheIds),a.done):void("unload"in a?rf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){qf(a)}):qf(a))},Ef.unload=function(a,b){rf(Dc(a),function(){hf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Ef.selected=function(a){return Df.merge(mj.selectAll("."+f.shapes+od(a)).selectAll("."+f.shape).filter(function(){return Df.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Ef.select=function(a,b,c){Pg&&mj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=Df.select(this),i="circle"===this.nodeName?Fe:Ie,j="circle"===this.nodeName?Ge:Je,k=Qg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Rg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},Ef.unselect=function(a,b){Pg&&mj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=Df.select(this),g="circle"===this.nodeName?Ge:Je,h=Qg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED); -h&&i&&Rg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},Ef.toLine=function(a){Cf(a,"line")},Ef.toSpline=function(a){Cf(a,"spline")},Ef.toBar=function(a){Cf(a,"bar")},Ef.toScatter=function(a){Cf(a,"scatter")},Ef.toArea=function(a){Cf(a,"area")},Ef.toAreaSpline=function(a){Cf(a,"area-spline")},Ef.toPie=function(a){Cf(a,"pie",{withTransform:!0})},Ef.toDonut=function(a){Cf(a,"donut",{withTransform:!0})},Ef.groups=function(a){return c(a)?Fg:(Fg=a,hf(),Fg)},Ef.xgrids=function(a){return a?(Uh=a,hf(),Uh):Uh},Ef.xgrids.add=function(a){return a?Ef.xgrids(Uh.concat(a)):void 0},Ef.xgrids.remove=function(a){var b=Bf(a);return Ef.xgrids(Uh.filter(b))},Ef.ygrids=function(a){return a?(Wh=a,hf(),Wh):Wh},Ef.ygrids.add=function(a){return a?Ef.ygrids(Wh.concat(a)):void 0},Ef.ygrids.remove=function(a){var b=Bf(a);return Ef.ygrids(Wh.filter(b))},Ef.regions=function(a){return c(a)?si:(si=a,hf(),si)},Ef.regions.add=function(a){return c(a)?si:(si=si.concat(a),hf(),si)},Ef.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;kj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),si=si.filter(function(b){return b.classes.indexOf(a)<0})}),si},Ef.data.get=function(a){var b=Ef.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Ef.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},Ef.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Dg[b]=a[b]}),yf(Cc(Ef.data.targets),{withTransition:!0}),Dg):Dg},Ef.x=function(a){return arguments.length&&(qc(Ef.data.targets,a),hf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ef.data.xs},Ef.xs=function(a){return arguments.length&&(rc(Ef.data.targets,a),hf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ef.data.xs},Ef.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},Ef.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Bh=+a.y),b(a.y2)&&(Kh=+a.y2)):Bh=Kh=+a,hf())},Ef.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Ch=+a.y),b(a.y2)&&(Lh=+a.y2)):Ch=Lh=+a,hf())},Ef.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Ef.axis.max(a.max),"undefined"!=typeof a.min&&Ef.axis.min(a.min))},Ef.legend.show=function(a){wf(Dc(a)),hf({withLegend:!0})},Ef.legend.hide=function(a){xf(Dc(a)),hf({withLegend:!0})},Ef.resize=function(a){Hf=a?a.width:null,If=a?a.height:null,nf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Ef.destroy=function(){Ef.data.targets=void 0,Ef.data.xs={},qj.html(""),a.onresize=null},"url"in e.data)Df.xhr(e.data.url,function(a,b){var c,d=Df.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Df.csv.parse(b.response),af(c)});else if("rows"in e.data)af(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");af(uc(e.data.columns))}return Ef},"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.33"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",lines:"c3-lines",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",arcs:"c3-arcs",area:"c3-area",areas:"c3-areas",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",legendItemFocused:"c3-legend-item-focused",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;cXf&&(Xf=0),0>Zf&&(Zf=0),Yf=ih?Uf.left-dj-ej:Xf,$f=ih?Zf:ag-Vf.top-Vf.bottom,0>Yf&&(Yf=0),0>$f&&($f=0),p(),$i&&he(Ff.data.targets)&&(Wf.left=Xf/2+cg)}function o(){nj.select("line."+f.xgridFocus).attr("x1",ih?0:-10).attr("x2",ih?Xf:-10).attr("y1",ih?-10:Uf.top).attr("y2",ih?-10:Zf)}function p(){cg=Zf/2,bg=.95*cg,dg=ge(Ff.data.targets)?.6*bg:0}function q(){var a=ih?f.axisX:f.axisY,b=nj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Ef.select(Hf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return If?If:x()}function s(){var a=Jf?Jf:y();return a>0?a:320}function t(){return he(Ff.data.targets)?0:Kf?Kf:ih?jh?v("x"):1:!Bh||Gh?1:v("y")}function u(){var a=1;return he(Ff.data.targets)?0:Lf?Lf:$i?P()+(Kh&&!ih?v("y2"):a):Kh?Ph||ih?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||jh?"x"===a&&yh?yh:"y"!==a||Bh?"y2"!==a||Kh?(jb(a).isInner?30:40)+("y2"===a?-10:0):fj:ch&&!$i?10:1:0}function x(){return+Ef.select(Hf).style("width").replace("px","")}function y(){return+Ef.select(Hf).style("height").replace("px","")}function z(a){return a?-5:-(Uf.left-1)}function A(a){return a?-20:-4}function B(){return z(!ih)}function C(){return A(!ih)}function D(){return z(ih)}function E(){return A(ih)}function F(a){return a?Xf+2+4:Uf.left+20}function G(a){return a?(yh?yh:0)+80:Zf+8}function H(){return F(!ih)}function I(){return G(!ih)}function J(){return F(ih)}function K(){return G(ih)}function L(){var a,b,c,d,e,f=Ac(Ff.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=qg(b.x)-qg(a.x),0===c?ih?Zf:Xf:(d=zc(),e=de(Ff.data.targets)?(d-(Ii?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function M(a){_i=a}function N(a){aj=a}function O(a){bj=a}function P(){return ch?$i?aj*(_i+1):_f:0}function Q(){return ch?$i?ag:bj*(_i+1):0}function R(){var a,b,c=!qg;ig=ih?1:0,jg=ih?Zf:Xf,kg=ih?0:Zf,lg=ih?Xf:1,mg=ig,ng=jg,og=ih?0:$f,pg=ih?Yf:1,qg=T(ig,jg,c?void 0:qg.domain(),function(){return wg.tickOffset()}),rg=U(kg,lg,c?void 0:rg.domain()),sg=U(kg,lg,c?void 0:sg.domain()),tg=T(ig,jg,sj,function(a){return a%1?0:zg.tickOffset()}),ug=U(og,pg,c?void 0:ug.domain()),vg=U(og,pg,c?void 0:vg.domain()),a=$(),b=th?th:c?void 0:wg.tickValues(),wg=X(qg,Vi,a,b),zg=X(tg,Yi,a,b),xg=Y(rg,Wi,Hh,Jh),yg=Y(sg,Xi,Qh,Sh),c||(gj.scale(tg),Mf&&kj.scale(qg)),S()}function S(){eg=Gb(),fg=Hb(),gg=Hb(.98)}function T(a,b,d,e){var f=(Hi?Ef.time.scale():Ef.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Ii){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=Ef.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?sg:rg}function W(a){return"y2"===Z(a)?vg:ug}function X(a,b,c,d){var e=(Ii?Eb():Ef.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Ii?(e.tickCentered(nh),Ae(ph)&&(ph=!1)):e.tickOffset=function(){var a=Bc(Ff.data.targets),b=qg(a[1])-qg(a[0]),c=b?b:ih?Zf:Xf;return c/zc()/2},Ii&&e.categories(mh),e}function Y(a,b,c,d){return Ef.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Hg?Hg[a]:"y"}function $(){var a=Hi?Si:Ii?Tc:function(a){return 0>a?a.toFixed(0):a};return oh&&("function"==typeof oh?a=oh:Hi&&(a=function(a){return a?Ri(oh)(a):""})),a}function _(a){var b;return"y"===a?b=Fh:"y2"===a?b=Oh:"x"===a&&(b=Ah),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Fh=b:"y2"===a?Oh=b:"x"===a&&(Ah=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",ih?"inner-top":"inner-right")}function hb(){return fb("y",ih?"inner-right":"inner-top")}function ib(){return fb("y2",ih?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Xf/2:Xf:b.isBottom?-Zf:b.isMiddle?-Zf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!ih,gb())}function rb(){return nb(ih,hb())}function sb(){return nb(ih,ib())}function tb(){return ob(!ih,gb())}function ub(){return ob(ih,hb())}function vb(){return ob(ih,ib())}function wb(){var a=gb();return ih?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":yh?yh-10:"3em"}function xb(){var a=hb();return ih?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return ih?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!ih,gb())}function Ab(){return pb(ih,hb())}function Bb(){return pb(ih,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return Ef.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){nj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),nj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),nj.select("."+f.axisY2+" ."+f.axisY2Label).transition().attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 Ef.min(Object.keys(i).map(function(a){return Ef.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(Gg.length>0)for(g=Sc(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 Ef.max(Object.keys(i).map(function(a){return Ef.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Mh:Dh,n="y2"===c?Lh:Ch,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Nh:Eh,r=xd()&&ih;return 0===l.length?"y2"===c?sg.domain():rg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=yd(o,p),j=ac(rg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),"y2"===c&&Rh&&(f=b(Rh.top)?Rh.top:e,g=b(Rh.bottom)?Rh.bottom:e),de(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return wh?Hi?we(wh):wh:Ef.min(a,function(a){return Ef.min(a.values,function(a){return a.x})})}function Zb(a){return vh?Hi?we(vh):vh:Ef.max(a,function(a){return Ef.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Ii?d=0:de(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof xh&&Be(xh)?(e=b(xh.left)?xh.left:d,f=b(xh.right)?xh.right:d):e=f="number"==typeof xh?xh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return c-d===0&&(c=Hi?new Date(.5*c.getTime()):-.5,d=Hi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Hi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Hi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?rg:sg;return b="y"===a.axis||"y2"===a.axis?ih?Zf:"start"in a?d(a.start):Zf:ih?"end"in a?qg(Hi?we(a.end):a.end):Zf:Zf,c>b?0:b-c}function ic(a){return Ag&&a===Ag||Be(Bg)&&Ce(Bg,a)}function jc(a){return!ic(a)}function kc(a){return Ag?Ag:Be(Bg)?Bg[a]:null}function lc(a,b){var c,d=b&&Be(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=Ff.data.xs[b])}),c}function mc(a,b){return a in Ff.data.xs&&Ff.data.xs[a]&&Ff.data.xs[a][b]?Ff.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){Bg[b]=a[b]})}function oc(a){return 1===Ef.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=Eg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),Ff.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=Hi?a?a instanceof Date?a:we(a):we(mc(c,d)):Ji&&!Ii?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Ff.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Ag?(d=Object.keys(Ff.data.xs),Ff.data.xs[c]=d.length>0?Ff.data.xs[d[0]]:void 0):Be(Bg)&&(Ff.data.xs[c]=lc(f,Ff.data.targets)):Ff.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Ff.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Dg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ji&&Ii&&0===c&&g&&(0===e&&(mh=[]),mh.push(g)),("undefined"==typeof a[b]||Ff.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ig&&be(Cc(c).filter(function(a){return!(a in Jg)}),Ig),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&Ff.data.targets[0].values[a-1]?Ff.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(Ff.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Hi?new Date(i):i);j.push(e)}return Hi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Ti=Ti.concat(a)}function Mc(a){Ti=Ti.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Ui=Ui.concat(a)}function Oc(a){Ui=Ui.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Jd(a,f))),(a[g].x||0===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=De(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Nd(a,b){return Ef.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Od(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 Pd(){return Lg&&"desc"===Lg.toLowerCase()}function Qd(){return Lg&&"asc"===Lg.toLowerCase()}function Rd(a){var b=Qd(),c=Pd();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 Lg&&a.sort(Lg),a}function Sd(a,c){var d,e,f,g,h,i,j,k=he(Ff.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&ui&&(qj.html(xi(a,$(),zd(k),Qi)).style("display","block"),d=qj.property("offsetWidth"),e=qj.property("offsetHeight"),k?(g=Xf/2+c[0],i=Zf/2+c[1]+20):(ih?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=qg(l[0].x)+20):(f=q(),g=f+t()+qg(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),qj.style("top",i+"px").style("left",g+"px"))}function Td(){qj.style("display","none")}function Ud(a){var c=a.filter(function(a){return a&&b(a.value)});ui&&(ee(Ff.data.targets)||he(Ff.data.targets)||nj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(ih?"y1":"x1",Fd).attr(ih?"y2":"x2",Fd))}function Vd(){nj.select("line."+f.xgridFocus).style("visibility","hidden")}function Wd(a){return a.x||0===a.x?qg(a.x):null}function Xd(a){return V(a.id)(a.value)}function Yd(){var a,b,d={},e=0;return Ic(Fc(ke)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ae(a,b){return"number"==typeof ei?ei:b?2*a.tickOffset()*fi/b:0}function be(a,b){Dc(a).forEach(function(a){uj[a]=b===Jg[a],Jg[a]=b})}function ce(a,b){var c=!1;return a.forEach(function(a){Jg[a.id]===b&&(c=!0),a.id in Jg||"line"!==b||(c=!0)}),c}function de(a){return ce(a,"bar")}function ee(a){return ce(a,"scatter")}function fe(a){return ce(a,"pie")}function ge(a){return ce(a,"donut")}function he(a){return fe(a)||ge(a)}function ie(a){var b="string"==typeof a?a:a.id;return!(b in Jg)||"line"===Jg[b]||"spline"===Jg[b]||"area"===Jg[b]||"area-spline"===Jg[b]}function je(a){var b="string"==typeof a?a:a.id;return"spline"===Jg[b]||"area-spline"===Jg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"bar"===Jg[b]}function le(a){var b="string"==typeof a?a:a.id;return"scatter"===Jg[b]}function me(a){var b="string"==typeof a?a:a.id;return"pie"===Jg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"donut"===Jg[b]}function oe(a){return me(a)||ne(a)}function pe(a){return ie(a)?[a]:[]}function qe(a){return oe(a.data)?[a]:[]}function re(a){return ke(a)?a.values:[]}function se(a){return ie(a)||le(a)?a.values:[]}function te(a){return ke(a)||ie(a)?a.values:[]}function ue(a){return ne(a)&&oi||me(a)&&ii}function ve(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function we(b){var c;try{c=Cg?Ef.time.format(Cg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Cg)}return c}function xe(a,b){var c=Ef.mouse(a),d=Ef.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ce(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function De(a,b){var c="y"===Z(a.id)?rg:sg,d=ih?1:0,e=ih?0:1;return Math.pow(qg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ee(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Fe(a,b,c){Xg(b,a.node()),nj.select("."+f.selectedCircles+od(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",ih?Xd:Wd).attr("cy",ih?Wd:Xd).attr("stroke",function(){return Qi(b)}).attr("r",1.4*Qe(b)).transition().duration(100).attr("r",Qe)}function Ge(a,b,c){Yg(b,a.node()),nj.select("."+f.selectedCircles+od(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function He(a,b,c,d){a?Fe(b,c,d):Ge(b,c,d)}function Ie(a,b){Xg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ef.rgb(Qi(b)).brighter(.75)})}function Je(a,b){Yg(b,a.node()),a.transition().duration(100).style("fill",function(){return Qi(b)})}function Ke(a,b,c,d){a?Ie(b,c,d):Je(b,c,d)}function Le(a,b,c,d){Ke(a,b,c.data,d)}function Me(a){return"circle"===a.nodeName?He:Ef.select(a).classed(f.bar)?Ke:Le}function Ne(a){return a.filter(function(a){return b(a.value)})}function Oe(a){return Zh?"function"==typeof $h?$h(a):$h:0}function Pe(a){return ai?bi?bi:1.75*Oe(a):Oe(a)}function Qe(a){return ci?ci:4*Oe(a)}function Re(a,c){return(c?nj.selectAll("."+f.circles+od(c)):nj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Se(a,b){Re(a,b).classed(f.EXPANDED,!0).attr("r",Pe)}function Te(a){Re(a).filter(function(){return Ef.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oe)}function Ue(a){return nj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ve(a){Ue(a).classed(f.EXPANDED,!0)}function We(a){Ue(a).classed(f.EXPANDED,!1)}function Xe(a,b){var c=_e(a,b);return function(a,b){var d=c(a,b),e=ih?1:0,f=ih?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 Ye(a,b){var c=_e(a,!1),d=b?Ze:$e;return function(a,b){return d(c(a,b),a,this)}}function Ze(a,b){var c;return ih?(c=ke(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function $e(a,b,c){var d=c.getBoundingClientRect();return ih?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ke(b)?-3:-6)}function _e(a,b){var c=a.__max__+1,d=ae(wg,c),e=Zd(d,c,a,!!b),f=$d(!!b),g=_d(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return ih&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function af(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 bf(b){var c,d,e;if(rj=Ef.select(Hf),rj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(rj.html("").classed("c3",!0),Ff.data.xs={},Ff.data.targets=vc(b),Pg&&Lc(Pg===!0?Cc(Ff.data.targets):Pg),n(),R(),qg.domain(Ef.extent(_b(Ff.data.targets))),rg.domain(Xb(Ff.data.targets,"y")),sg.domain(Xb(Ff.data.targets,"y2")),tg.domain(qg.domain()),ug.domain(rg.domain()),vg.domain(sg.domain()),sj=qg.domain(),gj.scale(tg),Mf&&kj.scale(qg),lj=rj.append("svg").on("mouseenter",Pf).on("mouseleave",Qf),mj=lj.append("defs"),mj.append("clipPath").attr("id",Bi).append("rect"),mj.append("clipPath").attr("id",Ci).append("rect"),mj.append("clipPath").attr("id",Di).append("rect"),nf(),nj=lj.append("g").attr("transform",Zi.main),oj=lj.append("g").attr("transform",Zi.context),pj=lj.append("g").attr("transform",Zi.legend),_g||oj.style("visibility","hidden"),ch||(pj.style("visibility","hidden"),Ui=Cc(Ff.data.targets)),qj=Ef.select(Hf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),zf(Cc(Ff.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=nj.append("g").attr("clip-path",Ei).attr("class",f.grid),Th&&d.append("g").attr("class",f.xgrids),Be(Vh)&&d.append("g").attr("class",f.xgridLines),_h&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Wh&&d.append("g").attr("class",f.ygrids),Be(Xh)&&d.append("g").attr("class",f.ygridLines),jh&&nj.append("g").attr("class",f.axisX).attr("clip-path",Fi).attr("transform",Zi.x).append("text").attr("class",f.axisXLabel).attr("transform",ih?"rotate(-90)":"").style("text-anchor",zb),Bh&&nj.append("g").attr("class",f.axisY).attr("clip-path",Gi).attr("transform",Zi.y).append("text").attr("class",f.axisYLabel).attr("transform",ih?"":"rotate(-90)").style("text-anchor",Ab),Kh&&nj.append("g").attr("class",f.axisY2).attr("transform",Zi.y2).append("text").attr("class",f.axisY2Label).attr("transform",ih?"":"rotate(-90)").style("text-anchor",Bb),nj.append("g").attr("clip-path",Ei).attr("class",f.regions),nj.append("g").attr("clip-path",Ei).attr("class",f.chart),c=nj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Mf?ih?"ns-resize":"ew-resize":null),nj.select("."+f.chart).append("g").attr("class",f.chartBars),nj.select("."+f.chart).append("g").attr("class",f.chartLines),nj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Zi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),nj.select("."+f.chart).append("g").attr("class",f.chartTexts),Mf&&nj.insert("rect",Of?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Xf).attr("height",Zf).style("opacity",0).style("cursor",ih?"ns-resize":"ew-resize").call(kj).on("dblclick.zoom",null),zh&&gj.extent("function"!=typeof zh?zh:zh(_b())),oj.append("g").attr("clip-path",Ei).attr("class",f.chart),oj.select("."+f.chart).append("g").attr("class",f.chartBars),oj.select("."+f.chart).append("g").attr("class",f.chartLines),oj.append("g").attr("clip-path",Ei).attr("class",f.brush).call(gj).selectAll("rect").attr(ih?"width":"height",ih?Yf:$f),oj.append("g").attr("class",f.axisX).attr("transform",Zi.subx).attr("clip-path",ih?"":Fi),pf(Ff.data.targets),ih?nj.select("."+f.axisX).style("opacity",0).call(wg):(nj.select("."+f.axisY).style("opacity",0).call(xg),nj.select("."+f.axisY2).style("opacity",0).call(yg)),n(),R(),nf(),m(!1),jf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),yi){if(Hi&&"string"==typeof zi){for(zi=we(zi),e=0;e0){d=[];for(var g in Eg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Od(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ke,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 gf(a){he(Ff.data.targets)||Qg&&(Ki=a,nj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Li=!0,Zg())}function hf(){he(Ff.data.targets)||Qg&&(nj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),nj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Li=!1,$g())}function jf(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z=Yd(),$=he(Ff.data.targets),_=Ic(Ff.data.targets);if(a=d(a)?a:{},E=d(a.withY)?a.withY:!0,F=d(a.withSubchart)?a.withSubchart:!0,G=d(a.withTransition)?a.withTransition:!0,J=d(a.withTransform)?a.withTransform:!1,K=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,M=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,N=d(a.withLegend)?a.withLegend:!1,H=d(a.withTransitionForExit)?a.withTransitionForExit:G,I=d(a.withTransitionForAxis)?a.withTransitionForAxis:G,T=G?Tf:0,U=H?T:0,V=I?T:0,c=nj.select("."+f.axisX).style("opacity",$?0:1),g=nj.select("."+f.axisY).style("opacity",$?0:1),h=nj.select("."+f.axisY2).style("opacity",$?0:1),e=oj.select("."+f.axisX).style("opacity",$?0:1),S={axisX:c.transition().duration(V),axisY:g.transition().duration(V),axisY2:h.transition().duration(V),axisSubX:e.transition().duration(V)},N&&ch&&zf(Cc(Ff.data.targets),a,S),Ii&&(0!==_.length&&M&&K||qg.domain([0,c.selectAll(".tick").size()])),_.length&&(M&&(qg.domain(Ef.extent(_b(_))),sj=qg.domain(),Mf&&kj.scale(qg).updateScaleExtent(),tg.domain(qg.domain()),gj.scale(tg)),K&&(qg.domain(gj.empty()?sj:gj.extent()),Mf&&kj.scale(qg).updateScaleExtent()),th||!sh&&!rh||(W=Kc(Jc(_),rh),wg.tickValues(W),zg.tickValues(W))),rg.domain(Xb(_,"y")),sg.domain(Xb(_,"y2")),S.axisX.call(wg),S.axisY.call(xg),S.axisY2.call(yg),S.axisSubX.call(zg),K&&_.length)if(ph&&W){for(X=1;X=0&&Ef.select(this).style("display",b%Y?"none":"block")})}else lj.selectAll("."+f.axisX+" .tick text").style("display","block");if(!ih&&uh&&eb(c,S.axisX,uh),O=Xe(Z),Q=Ye(Z,!0),R=Ye(Z,!1),Db(),ug.domain(rg.domain()),vg.domain(sg.domain()),qj.style("display","none"),o(),nj.select("line."+f.xgridFocus).style("visibility","hidden"),Th){if("year"===Uh){j=[];for(var ab=_b(),bb=ab[0].getFullYear(),cb=ab[1].getFullYear(),db=bb;cb>=db;db++)j.push(new Date(db+"-01-01 00:00:00"))}else j=qg.ticks(10);i=nj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",ih?0:function(a){return qg(a)-wg.tickOffset()}).attr("x2",ih?Xf:function(a){return qg(a)-wg.tickOffset()}).attr("y1",ih?function(a){return qg(a)-wg.tickOffset()}:Uf.top).attr("y2",ih?function(a){return qg(a)-wg.tickOffset()}:Zf).style("opacity",function(){return+Ef.select(this).attr(ih?"y1":"x1")===(ih?Zf:0)?0:1}),i.exit().remove()}Be(Vh)&&(k=nj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Vh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",ih?"":"rotate(-90)").attr("dx",ih?0:-Uf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",ih?0:Gd).attr("x2",ih?Xf:Gd).attr("y1",ih?Gd:Uf.top).attr("y2",ih?Gd:Zf).style("opacity",1),k.select("text").transition().duration(T).attr("x",ih?Xf:0).attr("y",Gd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),E&&Wh&&(m=nj.select("."+f.ygrids).selectAll("."+f.ygrid).data(rg.ticks(Yh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",ih?rg:0).attr("x2",ih?rg:Xf).attr("y1",ih?0:rg).attr("y2",ih?Zf:rg),m.exit().remove()),E&&Be(Xh)&&(n=nj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Xh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",ih?"rotate(-90)":"").attr("dx",ih?0:-Uf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(T).attr("x1",ih?Hd:0).attr("x2",ih?Hd:Xf).attr("y1",ih?0:Hd).attr("y2",ih?Zf:Hd).style("opacity",1),n.select("text").transition().duration(T).attr("x",ih?0:Xf).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(T).style("opacity",0).remove()),v=nj.select("."+f.regions).selectAll("rect."+f.region).data(ti),v.enter().append("rect").style("fill-opacity",0),v.attr("class",hd).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(T).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),v.exit().transition().duration(T).style("fill-opacity",0).remove(),t=nj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),t.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Qi),t.style("opacity",td).transition().duration(T).attr("d",O).style("opacity",1),t.exit().transition().duration(U).style("opacity",0).remove(),q=nj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),q.enter().append("path").attr("class",Zc).style("stroke",Qi),q.style("opacity",td).transition().duration(T).attr("d",hj).style("opacity",1),q.exit().transition().duration(U).style("opacity",0).remove(),r=nj.selectAll("."+f.areas).selectAll("."+f.area).data(pe),r.enter().append("path").attr("class",fd).style("fill",Qi).style("opacity",function(){return tj=+Ef.select(this).style("opacity"),0}),r.style("opacity",0).transition().duration(T).attr("d",ij).style("opacity",tj),r.exit().transition().duration(U).style("opacity",0).remove(),s=nj.selectAll("."+f.circles).selectAll("."+f.circle).data(se),s.enter().append("circle").attr("class",_c).attr("r",Oe),s.style("opacity",td).transition().duration(T).style("opacity",vd).attr("cx",ih?Xd:Wd).attr("cy",ih?Wd:Xd),s.exit().remove(),w=nj.selectAll("."+f.texts).selectAll("."+f.text).data(te),w.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return ih?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),w.text(function(a){return Ed(a.id)(a.value)}).style("fill-opacity",ud).transition().duration(T).attr("x",Q).attr("y",R).style("fill-opacity",wd),w.exit().transition().duration(U).style("fill-opacity",0).remove(),u=nj.selectAll("."+f.arcs).selectAll("."+f.arc).data(qe),u.enter().append("path").attr("class",dd).style("fill",function(a){return Qi(a.data)}).style("cursor",function(a){return Sg(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Oi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),vf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Sd(d,Ef.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Oi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),wf(),Td(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();ef(this,a,b),e(d,b)}),u.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Oi=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Fb(a);return c?(b=Ef.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("opacity",1).call(Ee,function(){Oi=!1}),u.exit().transition().duration(U).style("opacity",0).remove(),nj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(T).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&oe(a.data)?1:0}),nj.select("."+f.chartArcsTitle).style("opacity",ge(Ff.data.targets)?1:0),_g&&(null!==Ef.event&&"zoom"===Ef.event.type&&gj.extent(qg.orgDomain()).update(),F&&(!ih&&uh&&eb(e,S.axisSubX,uh),gj.empty()||gj.extent(qg.orgDomain()).update(),P=Xe(Z,!0),y=oj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),y.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Qi),y.style("opacity",td).transition().duration(T).attr("d",P).style("opacity",1),y.exit().transition().duration(T).style("opacity",0).remove(),x=oj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),x.enter().append("path").attr("class",Zc).style("stroke",Qi),x.style("opacity",td).transition().duration(T).attr("d",jj).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove())),nj.selectAll("."+f.selectedCircles).filter(function(a){return ke(a)}).selectAll("circle").remove(),nj.selectAll("."+f.selectedCircle).transition().duration(T).attr("cx",ih?Xd:Wd).attr("cy",ih?Wd:Xd),z=nj.select("."+f.eventRects),Be(Bg)&&!oc(Bg)?(z.classed(f.eventRectsMultiple)||z.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),A=nj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),df(A.enter()),A.attr("x",0).attr("y",0).attr("width",Xf).attr("height",Zf)):(z.classed(f.eventRectsSingle)||z.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ji&&!Ii?(D=function(a,b){var c=xc(b),d=yc(b),e=Ff.data.xs[a.id][b];return(qg(d?d:e+50)-qg(c?c:e-50))/2},C=function(a,b){var c=xc(b),d=Ff.data.xs[a.id][b];return(qg(d)+qg(c?c:d-50))/2}):(D=L(),C=function(a){return qg(a.x)-D/2}),B=Ac(Ff.data.targets),nj.select("."+f.eventRects).datum(B?B.values:[]),A=nj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),cf(A.enter()),A.attr("class",id).attr("x",ih?0:C).attr("y",ih?C:0).attr("width",ih?Xf:D).attr("height",ih?D:Zf),A.exit().remove()),Cc(Ff.data.targets).forEach(function(a){uj[a]=!0})}function kf(){jf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function lf(){return"mousemove"===Ef.event.sourceEvent.type&&kj.altDomain?(qg.domain(kj.altDomain),void kj.scale(qg).updateScaleExtent()):(Ii&&qg.orgDomain()[0]===sj[0]&&qg.domain([sj[0]-1e-10,qg.orgDomain()[1]]),jf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Ef.event.sourceEvent.type&&(Mi=!0)))}function mf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function nf(){lj.attr("width",_f).attr("height",ag),lj.select("#"+Bi).select("rect").attr("width",Xf).attr("height",Zf),lj.select("#"+Ci).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),lj.select("#"+Di).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),lj.select("."+f.zoomRect).attr("width",Xf).attr("height",Zf),rj.style("max-height",ag+"px")}function of(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),nf(),m(a.withTransition),jf(a)}function pf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=nj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",kd),j=i.enter().append("g").attr("class",kd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Qi(a)}),e=nj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",md),d=e.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",cd).style("cursor",function(a){return Sg(a)?"pointer":null}),c=nj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",ld),b=c.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",$c),b.append("g").attr("class",gd),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",ad).style("fill",Qi).style("cursor",function(a){return Sg(a)?"pointer":null}),a.forEach(function(a){nj.selectAll("."+f.selectedCircles+od(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=nj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(hg(a)).attr("class",nd),g=h.enter().append("g").attr("class",nd),g.append("g").attr("class",ed),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),_g&&(n=oj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",md),m=n.enter().append("g").style("opacity",0).attr("class",md),m.append("g").attr("class",cd),l=oj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",ld),k=l.enter().append("g").style("opacity",0).attr("class",ld),k.append("g").attr("class",$c)),lj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Tf).style("opacity",1)}function qf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?be(a.id,b.types[a.id]):be(a.id,b.type)}),Ff.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=$i?j:i,l=$i?Q():P();return d&&(w=0,C=0,t=0,u=0),ch&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=$i?u:t,void(hh?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=pj.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,$i?(g=function(a){return t*(.2+B[a])},j=function(a){return A[B[a]]+x[a]}):(g=function(a){return A[B[a]]+x[a]},j=function(a){return u*(.2+B[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=pj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof eh?eh(a):Ff.toggle(a)}).on("mouseover",function(a){Ef.select(this).classed(f.legendItemFocused,!0),Oi||Ff.focus(a),"function"==typeof fh&&fh(a)}).on("mouseout",function(a){Ef.select(this).classed(f.legendItemFocused,!1),Oi||Ff.revert(),"function"==typeof gh&&gh(a)}),o.append("text").text(function(a){return d(Eg[a])?Eg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",$i?h:-200).attr("y",$i?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",$i?i:-200).attr("y",$i?-200:l).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Qi(a)}).attr("x",$i?h:-200).attr("y",$i?-200:j).attr("width",10).attr("height",10),pj.selectAll("text").data(a).text(function(a){return d(Eg[a])?Eg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),pj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),pj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),pj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=Ef.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?tf(b):uf(b):cj}),N(t),O(u),M(C),n(),R(),nf(),m(q,c)}function Af(a){return Ec(Ff.data.targets,a.id)}function Bf(a){return"data"in a&&Ec(Ff.data.targets,a.data.id)}function Cf(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 Df(a,b,c){var d=!he(Ff.data.targets);Oi=!1,be(a,b),of(c||{withTransitionForAxis:d})}var Ef=a.d3?a.d3:a.require?a.require("d3"):void 0,Ff={data:{},axis:{},legend:{}},Gf={},Hf=h(["bindto"],"#chart"),If=h(["size","width"]),Jf=h(["size","height"]),Kf=h(["padding","left"],50),Lf=h(["padding","right"]),Mf=h(["zoom","enabled"],!1),Nf=h(["zoom","extent"]),Of=h(["zoom","privileged"],!1),Pf=h(["onenter"],function(){}),Qf=h(["onleave"],function(){}),Rf=h(["onresize"],function(){}),Sf=h(["onresized"],function(){}),Tf=h(["transition","duration"],350);g("data","data is required in config");var Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag=h(["data","x"]),Bg=h(["data","xs"],{}),Cg=h(["data","x_format"]),Dg=h(["data","id_converter"],function(a){return a}),Eg=h(["data","names"],{}),Fg=h(["data","classes"],{}),Gg=h(["data","groups"],[]),Hg=h(["data","axes"],{}),Ig=h(["data","type"]),Jg=h(["data","types"],{}),Kg=h(["data","labels"],{}),Lg=h(["data","order"]),Mg=h(["data","regions"],{}),Ng=h(["data","color"]),Og=h(["data","colors"],{}),Pg=h(["data","hide"],!1),Qg=h(["data","selection","enabled"],!1),Rg=h(["data","selection","grouped"],!1),Sg=h(["data","selection","isselectable"],function(){return!0}),Tg=h(["data","selection","multiple"],!0),Ug=h(["data","onclick"],function(){}),Vg=h(["data","onenter"],function(){}),Wg=h(["data","onleave"],function(){}),Xg=h(["data","onselected"],function(){}),Yg=h(["data","onunselected"],function(){}),Zg=h(["data","ondragstart"],function(){}),$g=h(["data","ondragend"],function(){}),_g=h(["subchart","show"],!1),ah=h(["subchart","size","height"],60),bh=h(["color","pattern"],[]),ch=h(["legend","show"],!0),dh=h(["legend","position"],"bottom"),eh=h(["legend","item","onclick"]),fh=h(["legend","item","onmouseover"]),gh=h(["legend","item","onmouseout"]),hh=h(["legend","equally"],!1),ih=h(["axis","rotated"],!1),jh=h(["axis","x","show"],!0),kh=h(["axis","x","type"],"indexed"),lh=h(["axis","x","localtime"],!0),mh=h(["axis","x","categories"],[]),nh=h(["axis","x","tick","centered"],!1),oh=h(["axis","x","tick","format"]),ph=h(["axis","x","tick","culling"],{}),qh=h(["axis","x","tick","culling","max"],10),rh=h(["axis","x","tick","count"]),sh=h(["axis","x","tick","fit"],!0),th=h(["axis","x","tick","values"],null),uh=h(["axis","x","tick","rotate"]),vh=h(["axis","x","max"],null),wh=h(["axis","x","min"],null),xh=h(["axis","x","padding"],{}),yh=h(["axis","x","height"]),zh=h(["axis","x","default"]),Ah=h(["axis","x","label"],{}),Bh=h(["axis","y","show"],!0),Ch=h(["axis","y","max"]),Dh=h(["axis","y","min"]),Eh=h(["axis","y","center"]),Fh=h(["axis","y","label"],{}),Gh=h(["axis","y","inner"],!1),Hh=h(["axis","y","tick","format"]),Ih=h(["axis","y","padding"]),Jh=h(["axis","y","ticks"],10),Kh=h(["axis","y2","show"],!1),Lh=h(["axis","y2","max"]),Mh=h(["axis","y2","min"]),Nh=h(["axis","y2","center"]),Oh=h(["axis","y2","label"],{}),Ph=h(["axis","y2","inner"],!1),Qh=h(["axis","y2","tick","format"]),Rh=h(["axis","y2","padding"]),Sh=h(["axis","y2","ticks"],10),Th=h(["grid","x","show"],!1),Uh=h(["grid","x","type"],"tick"),Vh=h(["grid","x","lines"],[]),Wh=h(["grid","y","show"],!1),Xh=h(["grid","y","lines"],[]),Yh=h(["grid","y","ticks"],10),Zh=h(["point","show"],!0),$h=h(["point","r"],2.5),_h=h(["point","focus","line","enabled"],!0),ai=h(["point","focus","expand","enabled"],!0),bi=h(["point","focus","expand","r"]),ci=h(["point","focus","select","r"]),di=h(["line","connect_null"],!1),ei=h(["bar","width"]),fi=h(["bar","width","ratio"],.6),gi=h(["pie","label","show"],!0),hi=h(["pie","label","format"]),ii=h(["pie","expand"],!0),ji=h(["pie","onclick"],function(){}),ki=h(["pie","onmouseover"],function(){}),li=h(["pie","onmouseout"],function(){}),mi=h(["donut","label","show"],!0),ni=h(["donut","label","format"]),oi=h(["donut","expand"],!0),pi=h(["donut","title"],""),qi=h(["donut","onclick"],function(){}),ri=h(["donut","onmouseover"],function(){}),si=h(["donut","onmouseout"],function(){}),ti=h(["regions"],[]),ui=h(["tooltip","show"],!0),vi=h(["tooltip","format","title"]),wi=h(["tooltip","format","value"]),xi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=vi?vi:b,l=wi?wi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id,a[g].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),yi=h(["tooltip","init","show"],!1),zi=h(["tooltip","init","x"],0),Ai=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Bi=("string"==typeof Hf?Hf.replace("#",""):Hf.id)+"-clip",Ci=Bi+"-xaxis",Di=Bi+"-yaxis",Ei=i(Bi),Fi=i(Ci),Gi=i(Di),Hi="timeseries"===kh,Ii="categorized"===kh,Ji=!Hi&&(Ag||Be(Bg)),Ki=null,Li=!1,Mi=!1,Ni=!1,Oi=!1,Pi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Qi=ve(Og,Be(bh)?bh:Pi,Ng),Ri=lh?Ef.time.format:Ef.time.format.utc,Si=function(){var a=[[Ri("%Y/%-m/%-d"),function(){return!0}],[Ri("%-m/%-d"),function(a){return a.getMonth()}],[Ri("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ri("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ri("%I %p"),function(a){return a.getHours()}],[Ri("%I:%M"),function(a){return a.getMinutes()}],[Ri(":%S"),function(a){return a.getSeconds()}],[Ri(".%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)}}(),Ti=[],Ui=[],Vi=ih?"left":"bottom",Wi=ih?Gh?"top":"bottom":Gh?"right":"left",Xi=ih?Ph?"bottom":"top":Ph?"left":"right",Yi=ih?"left":"bottom",Zi={main:function(){return"translate("+Uf.left+","+Uf.top+")"},context:function(){return"translate("+Vf.left+","+Vf.top+")"},legend:function(){return"translate("+Wf.left+","+Wf.top+")"},x:function(){return"translate(0,"+(ih?0:Zf)+")"},y:function(){return"translate(0,"+(ih?Zf:0)+")"},y2:function(){return"translate("+(ih?0:Xf)+","+(ih?1:0)+")"},subx:function(){return"translate(0,"+(ih?0:$f)+")"},arc:function(){return"translate("+Xf/2+","+Zf/2+")"}},$i="right"===dh,_i=0,aj=0,bj=0,cj=.15,dj=30,ej=ih&&!jh?0:30,fj=5;hg=Ef.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var gj,hj=function(){var a=Ef.svg.line().x(ih?function(a){return V(a.id)(a.value)}:Fd).y(ih?Fd:function(a){return V(a.id)(a.value)});return di||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=di?Ne(b.values):b.values;return ie(b)?(a.interpolate(je(b)?"cardinal":"linear"),Mg[b.id]?af(e,qg,V(b.id),Mg[b.id]):a(e)):(c=e[0]?qg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ih?"M "+d+" "+c:"M "+c+" "+d)}}(),ij=function(){var a;return a=ih?Ef.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Fd):Ef.svg.area().x(Fd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ne(b.values);return ce([b],"area")||ce([b],"area-spline")?(a.interpolate(je(b)?"cardinal":"linear"),a(e)):(c=e[0]?qg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ih?"M "+d+" "+c:"M "+c+" "+d)}}(),jj=function(){var a=Ef.svg.line().x(ih?function(a){return W(a.id)(a.value)}:Id).y(ih?Id:function(a){return W(a.id)(a.value)});return function(b){var c=Ne(b.values);return ie(b)?a(c):"M "+tg(c[0].x)+" "+W(b.id)(c[0].value)}}(),kj=function(){};gj=Ef.svg.brush().on("brush",kf),gj.update=function(){return oj&&oj.select("."+f.brush).call(this),this},gj.scale=function(a){return ih?this.y(a):this.x(a)},Mf&&(kj=Ef.behavior.zoom().on("zoomstart",function(){kj.altDomain=Ef.event.sourceEvent.altKey?qg.orgDomain():null}).on("zoom",Mf?lf:null),kj.scale=function(a){return ih?this.y(a):this.x(a)},kj.orgScaleExtent=function(){var a=Nf?Nf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},kj.updateScaleExtent=function(){var a=ac(qg.orgDomain())/ac(sj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var lj,mj,nj,oj,pj,qj,rj,sj,tj,uj={};if(Ff.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=lj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);Ff.revert(),Ff.defocus(),b(d.classed(f.focused,!0)),b(e),he(Ff.data.targets)&&Nb(a,!0),vf(a,!0)},Ff.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=lj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);Ff.revert(),b(d.classed(f.focused,!1)),b(e),he(Ff.data.targets)&&Ob(a),vf(a,!1)},Ff.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=lj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);b(d.classed(f.focused,!1)),b(e),he(Ff.data.targets)&&Ob(a),wf()},Ff.show=function(a,b){a=Dc(a),b=b||{},Mc(a),lj.selectAll(qd(a)).transition().style("opacity",1),b.withLegend&&xf(a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ff.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),lj.selectAll(qd(a)).transition().style("opacity",0),b.withLegend&&yf(a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ff.toggle=function(a){Gc(a)?Ff.hide(a):Ff.show(a)},Ff.unzoom=function(){gj.clear().update(),jf({withUpdateXDomain:!0})},Ff.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Fg[b]=a.classes[b]}),"categories"in a&&Ii&&(mh=a.categories,wg.categories(mh)),"cacheIds"in a&&bc(a.cacheIds)?void qf(dc(a.cacheIds),a.done):void("unload"in a?sf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){rf(a)}):rf(a))},Ff.unload=function(a,b){sf(Dc(a),function(){jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Ff.selected=function(a){return Ef.merge(nj.selectAll("."+f.shapes+od(a)).selectAll("."+f.shape).filter(function(){return Ef.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Ff.select=function(a,b,c){Qg&&nj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=Ef.select(this),i=e.data?e.data.id:e.id,j=Me(this),k=Rg||!a||a.indexOf(i)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Sg(e)&&!m&&j(!0,h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(!1,h.classed(f.SELECTED,!1),e,g)})},Ff.unselect=function(a,b){Qg&&nj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=Ef.select(this),g=c.data?c.data.id:c.id,h=Me(this),i=Rg||!a||a.indexOf(g)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(f.SELECTED);i&&j&&Sg(c)&&k&&h(!1,e.classed(f.SELECTED,!1),c,d) +})},Ff.toLine=function(a){Df(a,"line")},Ff.toSpline=function(a){Df(a,"spline")},Ff.toBar=function(a){Df(a,"bar")},Ff.toScatter=function(a){Df(a,"scatter")},Ff.toArea=function(a){Df(a,"area")},Ff.toAreaSpline=function(a){Df(a,"area-spline")},Ff.toPie=function(a){Df(a,"pie",{withTransform:!0})},Ff.toDonut=function(a){Df(a,"donut",{withTransform:!0})},Ff.groups=function(a){return c(a)?Gg:(Gg=a,jf(),Gg)},Ff.xgrids=function(a){return a?(Vh=a,jf(),Vh):Vh},Ff.xgrids.add=function(a){return a?Ff.xgrids(Vh.concat(a)):void 0},Ff.xgrids.remove=function(a){var b=Cf(a);return Ff.xgrids(Vh.filter(b))},Ff.ygrids=function(a){return a?(Xh=a,jf(),Xh):Xh},Ff.ygrids.add=function(a){return a?Ff.ygrids(Xh.concat(a)):void 0},Ff.ygrids.remove=function(a){var b=Cf(a);return Ff.ygrids(Xh.filter(b))},Ff.regions=function(a){return c(a)?ti:(ti=a,jf(),ti)},Ff.regions.add=function(a){return c(a)?ti:(ti=ti.concat(a),jf(),ti)},Ff.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;lj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ti=ti.filter(function(b){return b.classes.indexOf(a)<0})}),ti},Ff.data.get=function(a){var b=Ff.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Ff.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},Ff.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Eg[b]=a[b]}),zf(Cc(Ff.data.targets),{withTransition:!0}),Eg):Eg},Ff.x=function(a){return arguments.length&&(qc(Ff.data.targets,a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ff.data.xs},Ff.xs=function(a){return arguments.length&&(rc(Ff.data.targets,a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ff.data.xs},Ff.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},Ff.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Ch=+a.y),b(a.y2)&&(Lh=+a.y2)):Ch=Lh=+a,jf())},Ff.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Dh=+a.y),b(a.y2)&&(Mh=+a.y2)):Dh=Mh=+a,jf())},Ff.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Ff.axis.max(a.max),"undefined"!=typeof a.min&&Ff.axis.min(a.min))},Ff.legend.show=function(a){xf(Dc(a)),jf({withLegend:!0})},Ff.legend.hide=function(a){yf(Dc(a)),jf({withLegend:!0})},Ff.resize=function(a){If=a?a.width:null,Jf=a?a.height:null,of({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Ff.destroy=function(){Ff.data.targets=void 0,Ff.data.xs={},rj.html(""),a.onresize=null},"url"in e.data)Ef.xhr(e.data.url,function(a,b){var c,d=Ef.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Ef.csv.parse(b.response),bf(c)});else if("rows"in e.data)bf(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");bf(uc(e.data.columns))}return Ff},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 18b5178a0083b92468fff626c75e72903247a1b3 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Fri, 2 May 2014 10:45:02 +0900 Subject: [PATCH 115/178] Update version to 0.1.34 --- bower.json | 2 +- c3.js | 2 +- c3.min.js | 2 +- package.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bower.json b/bower.json index 069e26d..a918d0e 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "c3", "main": "c3.min.js", - "version": "0.1.33", + "version": "0.1.34", "homepage": "https://github.com/masayuki0812/c3", "authors": [ "Masayuki Tanaka " diff --git a/c3.js b/c3.js index 34f188a..cb28135 100644 --- a/c3.js +++ b/c3.js @@ -2,7 +2,7 @@ 'use strict'; var c3 = { - version: "0.1.33" + version: "0.1.34" }; var CLASS = { diff --git a/c3.min.js b/c3.min.js index 29ba482..29a26bd 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.33"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",lines:"c3-lines",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",arcs:"c3-arcs",area:"c3-area",areas:"c3-areas",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",legendItemFocused:"c3-legend-item-focused",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;cXf&&(Xf=0),0>Zf&&(Zf=0),Yf=ih?Uf.left-dj-ej:Xf,$f=ih?Zf:ag-Vf.top-Vf.bottom,0>Yf&&(Yf=0),0>$f&&($f=0),p(),$i&&he(Ff.data.targets)&&(Wf.left=Xf/2+cg)}function o(){nj.select("line."+f.xgridFocus).attr("x1",ih?0:-10).attr("x2",ih?Xf:-10).attr("y1",ih?-10:Uf.top).attr("y2",ih?-10:Zf)}function p(){cg=Zf/2,bg=.95*cg,dg=ge(Ff.data.targets)?.6*bg:0}function q(){var a=ih?f.axisX:f.axisY,b=nj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Ef.select(Hf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return If?If:x()}function s(){var a=Jf?Jf:y();return a>0?a:320}function t(){return he(Ff.data.targets)?0:Kf?Kf:ih?jh?v("x"):1:!Bh||Gh?1:v("y")}function u(){var a=1;return he(Ff.data.targets)?0:Lf?Lf:$i?P()+(Kh&&!ih?v("y2"):a):Kh?Ph||ih?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||jh?"x"===a&&yh?yh:"y"!==a||Bh?"y2"!==a||Kh?(jb(a).isInner?30:40)+("y2"===a?-10:0):fj:ch&&!$i?10:1:0}function x(){return+Ef.select(Hf).style("width").replace("px","")}function y(){return+Ef.select(Hf).style("height").replace("px","")}function z(a){return a?-5:-(Uf.left-1)}function A(a){return a?-20:-4}function B(){return z(!ih)}function C(){return A(!ih)}function D(){return z(ih)}function E(){return A(ih)}function F(a){return a?Xf+2+4:Uf.left+20}function G(a){return a?(yh?yh:0)+80:Zf+8}function H(){return F(!ih)}function I(){return G(!ih)}function J(){return F(ih)}function K(){return G(ih)}function L(){var a,b,c,d,e,f=Ac(Ff.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=qg(b.x)-qg(a.x),0===c?ih?Zf:Xf:(d=zc(),e=de(Ff.data.targets)?(d-(Ii?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function M(a){_i=a}function N(a){aj=a}function O(a){bj=a}function P(){return ch?$i?aj*(_i+1):_f:0}function Q(){return ch?$i?ag:bj*(_i+1):0}function R(){var a,b,c=!qg;ig=ih?1:0,jg=ih?Zf:Xf,kg=ih?0:Zf,lg=ih?Xf:1,mg=ig,ng=jg,og=ih?0:$f,pg=ih?Yf:1,qg=T(ig,jg,c?void 0:qg.domain(),function(){return wg.tickOffset()}),rg=U(kg,lg,c?void 0:rg.domain()),sg=U(kg,lg,c?void 0:sg.domain()),tg=T(ig,jg,sj,function(a){return a%1?0:zg.tickOffset()}),ug=U(og,pg,c?void 0:ug.domain()),vg=U(og,pg,c?void 0:vg.domain()),a=$(),b=th?th:c?void 0:wg.tickValues(),wg=X(qg,Vi,a,b),zg=X(tg,Yi,a,b),xg=Y(rg,Wi,Hh,Jh),yg=Y(sg,Xi,Qh,Sh),c||(gj.scale(tg),Mf&&kj.scale(qg)),S()}function S(){eg=Gb(),fg=Hb(),gg=Hb(.98)}function T(a,b,d,e){var f=(Hi?Ef.time.scale():Ef.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Ii){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=Ef.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?sg:rg}function W(a){return"y2"===Z(a)?vg:ug}function X(a,b,c,d){var e=(Ii?Eb():Ef.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Ii?(e.tickCentered(nh),Ae(ph)&&(ph=!1)):e.tickOffset=function(){var a=Bc(Ff.data.targets),b=qg(a[1])-qg(a[0]),c=b?b:ih?Zf:Xf;return c/zc()/2},Ii&&e.categories(mh),e}function Y(a,b,c,d){return Ef.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Hg?Hg[a]:"y"}function $(){var a=Hi?Si:Ii?Tc:function(a){return 0>a?a.toFixed(0):a};return oh&&("function"==typeof oh?a=oh:Hi&&(a=function(a){return a?Ri(oh)(a):""})),a}function _(a){var b;return"y"===a?b=Fh:"y2"===a?b=Oh:"x"===a&&(b=Ah),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Fh=b:"y2"===a?Oh=b:"x"===a&&(Ah=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",ih?"inner-top":"inner-right")}function hb(){return fb("y",ih?"inner-right":"inner-top")}function ib(){return fb("y2",ih?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Xf/2:Xf:b.isBottom?-Zf:b.isMiddle?-Zf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!ih,gb())}function rb(){return nb(ih,hb())}function sb(){return nb(ih,ib())}function tb(){return ob(!ih,gb())}function ub(){return ob(ih,hb())}function vb(){return ob(ih,ib())}function wb(){var a=gb();return ih?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":yh?yh-10:"3em"}function xb(){var a=hb();return ih?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return ih?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!ih,gb())}function Ab(){return pb(ih,hb())}function Bb(){return pb(ih,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return Ef.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){nj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),nj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),nj.select("."+f.axisY2+" ."+f.axisY2Label).transition().attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 Ef.min(Object.keys(i).map(function(a){return Ef.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(Gg.length>0)for(g=Sc(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 Ef.max(Object.keys(i).map(function(a){return Ef.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Mh:Dh,n="y2"===c?Lh:Ch,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Nh:Eh,r=xd()&&ih;return 0===l.length?"y2"===c?sg.domain():rg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=yd(o,p),j=ac(rg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),"y2"===c&&Rh&&(f=b(Rh.top)?Rh.top:e,g=b(Rh.bottom)?Rh.bottom:e),de(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return wh?Hi?we(wh):wh:Ef.min(a,function(a){return Ef.min(a.values,function(a){return a.x})})}function Zb(a){return vh?Hi?we(vh):vh:Ef.max(a,function(a){return Ef.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Ii?d=0:de(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof xh&&Be(xh)?(e=b(xh.left)?xh.left:d,f=b(xh.right)?xh.right:d):e=f="number"==typeof xh?xh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return c-d===0&&(c=Hi?new Date(.5*c.getTime()):-.5,d=Hi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Hi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Hi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?rg:sg;return b="y"===a.axis||"y2"===a.axis?ih?Zf:"start"in a?d(a.start):Zf:ih?"end"in a?qg(Hi?we(a.end):a.end):Zf:Zf,c>b?0:b-c}function ic(a){return Ag&&a===Ag||Be(Bg)&&Ce(Bg,a)}function jc(a){return!ic(a)}function kc(a){return Ag?Ag:Be(Bg)?Bg[a]:null}function lc(a,b){var c,d=b&&Be(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=Ff.data.xs[b])}),c}function mc(a,b){return a in Ff.data.xs&&Ff.data.xs[a]&&Ff.data.xs[a][b]?Ff.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){Bg[b]=a[b]})}function oc(a){return 1===Ef.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=Eg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),Ff.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=Hi?a?a instanceof Date?a:we(a):we(mc(c,d)):Ji&&!Ii?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Ff.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Ag?(d=Object.keys(Ff.data.xs),Ff.data.xs[c]=d.length>0?Ff.data.xs[d[0]]:void 0):Be(Bg)&&(Ff.data.xs[c]=lc(f,Ff.data.targets)):Ff.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Ff.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Dg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ji&&Ii&&0===c&&g&&(0===e&&(mh=[]),mh.push(g)),("undefined"==typeof a[b]||Ff.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ig&&be(Cc(c).filter(function(a){return!(a in Jg)}),Ig),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&Ff.data.targets[0].values[a-1]?Ff.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(Ff.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Hi?new Date(i):i);j.push(e)}return Hi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Ti=Ti.concat(a)}function Mc(a){Ti=Ti.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Ui=Ui.concat(a)}function Oc(a){Ui=Ui.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Jd(a,f))),(a[g].x||0===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=De(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Nd(a,b){return Ef.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Od(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 Pd(){return Lg&&"desc"===Lg.toLowerCase()}function Qd(){return Lg&&"asc"===Lg.toLowerCase()}function Rd(a){var b=Qd(),c=Pd();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 Lg&&a.sort(Lg),a}function Sd(a,c){var d,e,f,g,h,i,j,k=he(Ff.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&ui&&(qj.html(xi(a,$(),zd(k),Qi)).style("display","block"),d=qj.property("offsetWidth"),e=qj.property("offsetHeight"),k?(g=Xf/2+c[0],i=Zf/2+c[1]+20):(ih?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=qg(l[0].x)+20):(f=q(),g=f+t()+qg(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),qj.style("top",i+"px").style("left",g+"px"))}function Td(){qj.style("display","none")}function Ud(a){var c=a.filter(function(a){return a&&b(a.value)});ui&&(ee(Ff.data.targets)||he(Ff.data.targets)||nj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(ih?"y1":"x1",Fd).attr(ih?"y2":"x2",Fd))}function Vd(){nj.select("line."+f.xgridFocus).style("visibility","hidden")}function Wd(a){return a.x||0===a.x?qg(a.x):null}function Xd(a){return V(a.id)(a.value)}function Yd(){var a,b,d={},e=0;return Ic(Fc(ke)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ae(a,b){return"number"==typeof ei?ei:b?2*a.tickOffset()*fi/b:0}function be(a,b){Dc(a).forEach(function(a){uj[a]=b===Jg[a],Jg[a]=b})}function ce(a,b){var c=!1;return a.forEach(function(a){Jg[a.id]===b&&(c=!0),a.id in Jg||"line"!==b||(c=!0)}),c}function de(a){return ce(a,"bar")}function ee(a){return ce(a,"scatter")}function fe(a){return ce(a,"pie")}function ge(a){return ce(a,"donut")}function he(a){return fe(a)||ge(a)}function ie(a){var b="string"==typeof a?a:a.id;return!(b in Jg)||"line"===Jg[b]||"spline"===Jg[b]||"area"===Jg[b]||"area-spline"===Jg[b]}function je(a){var b="string"==typeof a?a:a.id;return"spline"===Jg[b]||"area-spline"===Jg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"bar"===Jg[b]}function le(a){var b="string"==typeof a?a:a.id;return"scatter"===Jg[b]}function me(a){var b="string"==typeof a?a:a.id;return"pie"===Jg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"donut"===Jg[b]}function oe(a){return me(a)||ne(a)}function pe(a){return ie(a)?[a]:[]}function qe(a){return oe(a.data)?[a]:[]}function re(a){return ke(a)?a.values:[]}function se(a){return ie(a)||le(a)?a.values:[]}function te(a){return ke(a)||ie(a)?a.values:[]}function ue(a){return ne(a)&&oi||me(a)&&ii}function ve(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function we(b){var c;try{c=Cg?Ef.time.format(Cg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Cg)}return c}function xe(a,b){var c=Ef.mouse(a),d=Ef.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ce(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function De(a,b){var c="y"===Z(a.id)?rg:sg,d=ih?1:0,e=ih?0:1;return Math.pow(qg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ee(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Fe(a,b,c){Xg(b,a.node()),nj.select("."+f.selectedCircles+od(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",ih?Xd:Wd).attr("cy",ih?Wd:Xd).attr("stroke",function(){return Qi(b)}).attr("r",1.4*Qe(b)).transition().duration(100).attr("r",Qe)}function Ge(a,b,c){Yg(b,a.node()),nj.select("."+f.selectedCircles+od(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function He(a,b,c,d){a?Fe(b,c,d):Ge(b,c,d)}function Ie(a,b){Xg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ef.rgb(Qi(b)).brighter(.75)})}function Je(a,b){Yg(b,a.node()),a.transition().duration(100).style("fill",function(){return Qi(b)})}function Ke(a,b,c,d){a?Ie(b,c,d):Je(b,c,d)}function Le(a,b,c,d){Ke(a,b,c.data,d)}function Me(a){return"circle"===a.nodeName?He:Ef.select(a).classed(f.bar)?Ke:Le}function Ne(a){return a.filter(function(a){return b(a.value)})}function Oe(a){return Zh?"function"==typeof $h?$h(a):$h:0}function Pe(a){return ai?bi?bi:1.75*Oe(a):Oe(a)}function Qe(a){return ci?ci:4*Oe(a)}function Re(a,c){return(c?nj.selectAll("."+f.circles+od(c)):nj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Se(a,b){Re(a,b).classed(f.EXPANDED,!0).attr("r",Pe)}function Te(a){Re(a).filter(function(){return Ef.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oe)}function Ue(a){return nj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ve(a){Ue(a).classed(f.EXPANDED,!0)}function We(a){Ue(a).classed(f.EXPANDED,!1)}function Xe(a,b){var c=_e(a,b);return function(a,b){var d=c(a,b),e=ih?1:0,f=ih?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 Ye(a,b){var c=_e(a,!1),d=b?Ze:$e;return function(a,b){return d(c(a,b),a,this)}}function Ze(a,b){var c;return ih?(c=ke(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function $e(a,b,c){var d=c.getBoundingClientRect();return ih?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ke(b)?-3:-6)}function _e(a,b){var c=a.__max__+1,d=ae(wg,c),e=Zd(d,c,a,!!b),f=$d(!!b),g=_d(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return ih&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function af(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 bf(b){var c,d,e;if(rj=Ef.select(Hf),rj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(rj.html("").classed("c3",!0),Ff.data.xs={},Ff.data.targets=vc(b),Pg&&Lc(Pg===!0?Cc(Ff.data.targets):Pg),n(),R(),qg.domain(Ef.extent(_b(Ff.data.targets))),rg.domain(Xb(Ff.data.targets,"y")),sg.domain(Xb(Ff.data.targets,"y2")),tg.domain(qg.domain()),ug.domain(rg.domain()),vg.domain(sg.domain()),sj=qg.domain(),gj.scale(tg),Mf&&kj.scale(qg),lj=rj.append("svg").on("mouseenter",Pf).on("mouseleave",Qf),mj=lj.append("defs"),mj.append("clipPath").attr("id",Bi).append("rect"),mj.append("clipPath").attr("id",Ci).append("rect"),mj.append("clipPath").attr("id",Di).append("rect"),nf(),nj=lj.append("g").attr("transform",Zi.main),oj=lj.append("g").attr("transform",Zi.context),pj=lj.append("g").attr("transform",Zi.legend),_g||oj.style("visibility","hidden"),ch||(pj.style("visibility","hidden"),Ui=Cc(Ff.data.targets)),qj=Ef.select(Hf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),zf(Cc(Ff.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=nj.append("g").attr("clip-path",Ei).attr("class",f.grid),Th&&d.append("g").attr("class",f.xgrids),Be(Vh)&&d.append("g").attr("class",f.xgridLines),_h&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Wh&&d.append("g").attr("class",f.ygrids),Be(Xh)&&d.append("g").attr("class",f.ygridLines),jh&&nj.append("g").attr("class",f.axisX).attr("clip-path",Fi).attr("transform",Zi.x).append("text").attr("class",f.axisXLabel).attr("transform",ih?"rotate(-90)":"").style("text-anchor",zb),Bh&&nj.append("g").attr("class",f.axisY).attr("clip-path",Gi).attr("transform",Zi.y).append("text").attr("class",f.axisYLabel).attr("transform",ih?"":"rotate(-90)").style("text-anchor",Ab),Kh&&nj.append("g").attr("class",f.axisY2).attr("transform",Zi.y2).append("text").attr("class",f.axisY2Label).attr("transform",ih?"":"rotate(-90)").style("text-anchor",Bb),nj.append("g").attr("clip-path",Ei).attr("class",f.regions),nj.append("g").attr("clip-path",Ei).attr("class",f.chart),c=nj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Mf?ih?"ns-resize":"ew-resize":null),nj.select("."+f.chart).append("g").attr("class",f.chartBars),nj.select("."+f.chart).append("g").attr("class",f.chartLines),nj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Zi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),nj.select("."+f.chart).append("g").attr("class",f.chartTexts),Mf&&nj.insert("rect",Of?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Xf).attr("height",Zf).style("opacity",0).style("cursor",ih?"ns-resize":"ew-resize").call(kj).on("dblclick.zoom",null),zh&&gj.extent("function"!=typeof zh?zh:zh(_b())),oj.append("g").attr("clip-path",Ei).attr("class",f.chart),oj.select("."+f.chart).append("g").attr("class",f.chartBars),oj.select("."+f.chart).append("g").attr("class",f.chartLines),oj.append("g").attr("clip-path",Ei).attr("class",f.brush).call(gj).selectAll("rect").attr(ih?"width":"height",ih?Yf:$f),oj.append("g").attr("class",f.axisX).attr("transform",Zi.subx).attr("clip-path",ih?"":Fi),pf(Ff.data.targets),ih?nj.select("."+f.axisX).style("opacity",0).call(wg):(nj.select("."+f.axisY).style("opacity",0).call(xg),nj.select("."+f.axisY2).style("opacity",0).call(yg)),n(),R(),nf(),m(!1),jf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),yi){if(Hi&&"string"==typeof zi){for(zi=we(zi),e=0;eXf&&(Xf=0),0>Zf&&(Zf=0),Yf=ih?Uf.left-dj-ej:Xf,$f=ih?Zf:ag-Vf.top-Vf.bottom,0>Yf&&(Yf=0),0>$f&&($f=0),p(),$i&&he(Ff.data.targets)&&(Wf.left=Xf/2+cg)}function o(){nj.select("line."+f.xgridFocus).attr("x1",ih?0:-10).attr("x2",ih?Xf:-10).attr("y1",ih?-10:Uf.top).attr("y2",ih?-10:Zf)}function p(){cg=Zf/2,bg=.95*cg,dg=ge(Ff.data.targets)?.6*bg:0}function q(){var a=ih?f.axisX:f.axisY,b=nj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Ef.select(Hf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return If?If:x()}function s(){var a=Jf?Jf:y();return a>0?a:320}function t(){return he(Ff.data.targets)?0:Kf?Kf:ih?jh?v("x"):1:!Bh||Gh?1:v("y")}function u(){var a=1;return he(Ff.data.targets)?0:Lf?Lf:$i?P()+(Kh&&!ih?v("y2"):a):Kh?Ph||ih?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||jh?"x"===a&&yh?yh:"y"!==a||Bh?"y2"!==a||Kh?(jb(a).isInner?30:40)+("y2"===a?-10:0):fj:ch&&!$i?10:1:0}function x(){return+Ef.select(Hf).style("width").replace("px","")}function y(){return+Ef.select(Hf).style("height").replace("px","")}function z(a){return a?-5:-(Uf.left-1)}function A(a){return a?-20:-4}function B(){return z(!ih)}function C(){return A(!ih)}function D(){return z(ih)}function E(){return A(ih)}function F(a){return a?Xf+2+4:Uf.left+20}function G(a){return a?(yh?yh:0)+80:Zf+8}function H(){return F(!ih)}function I(){return G(!ih)}function J(){return F(ih)}function K(){return G(ih)}function L(){var a,b,c,d,e,f=Ac(Ff.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=qg(b.x)-qg(a.x),0===c?ih?Zf:Xf:(d=zc(),e=de(Ff.data.targets)?(d-(Ii?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function M(a){_i=a}function N(a){aj=a}function O(a){bj=a}function P(){return ch?$i?aj*(_i+1):_f:0}function Q(){return ch?$i?ag:bj*(_i+1):0}function R(){var a,b,c=!qg;ig=ih?1:0,jg=ih?Zf:Xf,kg=ih?0:Zf,lg=ih?Xf:1,mg=ig,ng=jg,og=ih?0:$f,pg=ih?Yf:1,qg=T(ig,jg,c?void 0:qg.domain(),function(){return wg.tickOffset()}),rg=U(kg,lg,c?void 0:rg.domain()),sg=U(kg,lg,c?void 0:sg.domain()),tg=T(ig,jg,sj,function(a){return a%1?0:zg.tickOffset()}),ug=U(og,pg,c?void 0:ug.domain()),vg=U(og,pg,c?void 0:vg.domain()),a=$(),b=th?th:c?void 0:wg.tickValues(),wg=X(qg,Vi,a,b),zg=X(tg,Yi,a,b),xg=Y(rg,Wi,Hh,Jh),yg=Y(sg,Xi,Qh,Sh),c||(gj.scale(tg),Mf&&kj.scale(qg)),S()}function S(){eg=Gb(),fg=Hb(),gg=Hb(.98)}function T(a,b,d,e){var f=(Hi?Ef.time.scale():Ef.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Ii){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=Ef.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?sg:rg}function W(a){return"y2"===Z(a)?vg:ug}function X(a,b,c,d){var e=(Ii?Eb():Ef.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Ii?(e.tickCentered(nh),Ae(ph)&&(ph=!1)):e.tickOffset=function(){var a=Bc(Ff.data.targets),b=qg(a[1])-qg(a[0]),c=b?b:ih?Zf:Xf;return c/zc()/2},Ii&&e.categories(mh),e}function Y(a,b,c,d){return Ef.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Hg?Hg[a]:"y"}function $(){var a=Hi?Si:Ii?Tc:function(a){return 0>a?a.toFixed(0):a};return oh&&("function"==typeof oh?a=oh:Hi&&(a=function(a){return a?Ri(oh)(a):""})),a}function _(a){var b;return"y"===a?b=Fh:"y2"===a?b=Oh:"x"===a&&(b=Ah),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Fh=b:"y2"===a?Oh=b:"x"===a&&(Ah=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",ih?"inner-top":"inner-right")}function hb(){return fb("y",ih?"inner-right":"inner-top")}function ib(){return fb("y2",ih?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Xf/2:Xf:b.isBottom?-Zf:b.isMiddle?-Zf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!ih,gb())}function rb(){return nb(ih,hb())}function sb(){return nb(ih,ib())}function tb(){return ob(!ih,gb())}function ub(){return ob(ih,hb())}function vb(){return ob(ih,ib())}function wb(){var a=gb();return ih?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":yh?yh-10:"3em"}function xb(){var a=hb();return ih?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return ih?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!ih,gb())}function Ab(){return pb(ih,hb())}function Bb(){return pb(ih,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return Ef.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){nj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),nj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),nj.select("."+f.axisY2+" ."+f.axisY2Label).transition().attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 Ef.min(Object.keys(i).map(function(a){return Ef.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(Gg.length>0)for(g=Sc(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 Ef.max(Object.keys(i).map(function(a){return Ef.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Mh:Dh,n="y2"===c?Lh:Ch,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Nh:Eh,r=xd()&&ih;return 0===l.length?"y2"===c?sg.domain():rg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=yd(o,p),j=ac(rg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),"y2"===c&&Rh&&(f=b(Rh.top)?Rh.top:e,g=b(Rh.bottom)?Rh.bottom:e),de(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return wh?Hi?we(wh):wh:Ef.min(a,function(a){return Ef.min(a.values,function(a){return a.x})})}function Zb(a){return vh?Hi?we(vh):vh:Ef.max(a,function(a){return Ef.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Ii?d=0:de(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof xh&&Be(xh)?(e=b(xh.left)?xh.left:d,f=b(xh.right)?xh.right:d):e=f="number"==typeof xh?xh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return c-d===0&&(c=Hi?new Date(.5*c.getTime()):-.5,d=Hi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Hi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Hi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?rg:sg;return b="y"===a.axis||"y2"===a.axis?ih?Zf:"start"in a?d(a.start):Zf:ih?"end"in a?qg(Hi?we(a.end):a.end):Zf:Zf,c>b?0:b-c}function ic(a){return Ag&&a===Ag||Be(Bg)&&Ce(Bg,a)}function jc(a){return!ic(a)}function kc(a){return Ag?Ag:Be(Bg)?Bg[a]:null}function lc(a,b){var c,d=b&&Be(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=Ff.data.xs[b])}),c}function mc(a,b){return a in Ff.data.xs&&Ff.data.xs[a]&&Ff.data.xs[a][b]?Ff.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){Bg[b]=a[b]})}function oc(a){return 1===Ef.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=Eg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),Ff.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=Hi?a?a instanceof Date?a:we(a):we(mc(c,d)):Ji&&!Ii?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Ff.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Ag?(d=Object.keys(Ff.data.xs),Ff.data.xs[c]=d.length>0?Ff.data.xs[d[0]]:void 0):Be(Bg)&&(Ff.data.xs[c]=lc(f,Ff.data.targets)):Ff.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Ff.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Dg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ji&&Ii&&0===c&&g&&(0===e&&(mh=[]),mh.push(g)),("undefined"==typeof a[b]||Ff.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ig&&be(Cc(c).filter(function(a){return!(a in Jg)}),Ig),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&Ff.data.targets[0].values[a-1]?Ff.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(Ff.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Hi?new Date(i):i);j.push(e)}return Hi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Ti=Ti.concat(a)}function Mc(a){Ti=Ti.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Ui=Ui.concat(a)}function Oc(a){Ui=Ui.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Jd(a,f))),(a[g].x||0===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=De(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Nd(a,b){return Ef.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Od(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 Pd(){return Lg&&"desc"===Lg.toLowerCase()}function Qd(){return Lg&&"asc"===Lg.toLowerCase()}function Rd(a){var b=Qd(),c=Pd();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 Lg&&a.sort(Lg),a}function Sd(a,c){var d,e,f,g,h,i,j,k=he(Ff.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&ui&&(qj.html(xi(a,$(),zd(k),Qi)).style("display","block"),d=qj.property("offsetWidth"),e=qj.property("offsetHeight"),k?(g=Xf/2+c[0],i=Zf/2+c[1]+20):(ih?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=qg(l[0].x)+20):(f=q(),g=f+t()+qg(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),qj.style("top",i+"px").style("left",g+"px"))}function Td(){qj.style("display","none")}function Ud(a){var c=a.filter(function(a){return a&&b(a.value)});ui&&(ee(Ff.data.targets)||he(Ff.data.targets)||nj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(ih?"y1":"x1",Fd).attr(ih?"y2":"x2",Fd))}function Vd(){nj.select("line."+f.xgridFocus).style("visibility","hidden")}function Wd(a){return a.x||0===a.x?qg(a.x):null}function Xd(a){return V(a.id)(a.value)}function Yd(){var a,b,d={},e=0;return Ic(Fc(ke)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ae(a,b){return"number"==typeof ei?ei:b?2*a.tickOffset()*fi/b:0}function be(a,b){Dc(a).forEach(function(a){uj[a]=b===Jg[a],Jg[a]=b})}function ce(a,b){var c=!1;return a.forEach(function(a){Jg[a.id]===b&&(c=!0),a.id in Jg||"line"!==b||(c=!0)}),c}function de(a){return ce(a,"bar")}function ee(a){return ce(a,"scatter")}function fe(a){return ce(a,"pie")}function ge(a){return ce(a,"donut")}function he(a){return fe(a)||ge(a)}function ie(a){var b="string"==typeof a?a:a.id;return!(b in Jg)||"line"===Jg[b]||"spline"===Jg[b]||"area"===Jg[b]||"area-spline"===Jg[b]}function je(a){var b="string"==typeof a?a:a.id;return"spline"===Jg[b]||"area-spline"===Jg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"bar"===Jg[b]}function le(a){var b="string"==typeof a?a:a.id;return"scatter"===Jg[b]}function me(a){var b="string"==typeof a?a:a.id;return"pie"===Jg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"donut"===Jg[b]}function oe(a){return me(a)||ne(a)}function pe(a){return ie(a)?[a]:[]}function qe(a){return oe(a.data)?[a]:[]}function re(a){return ke(a)?a.values:[]}function se(a){return ie(a)||le(a)?a.values:[]}function te(a){return ke(a)||ie(a)?a.values:[]}function ue(a){return ne(a)&&oi||me(a)&&ii}function ve(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function we(b){var c;try{c=Cg?Ef.time.format(Cg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Cg)}return c}function xe(a,b){var c=Ef.mouse(a),d=Ef.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ce(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function De(a,b){var c="y"===Z(a.id)?rg:sg,d=ih?1:0,e=ih?0:1;return Math.pow(qg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ee(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Fe(a,b,c){Xg(b,a.node()),nj.select("."+f.selectedCircles+od(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",ih?Xd:Wd).attr("cy",ih?Wd:Xd).attr("stroke",function(){return Qi(b)}).attr("r",1.4*Qe(b)).transition().duration(100).attr("r",Qe)}function Ge(a,b,c){Yg(b,a.node()),nj.select("."+f.selectedCircles+od(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function He(a,b,c,d){a?Fe(b,c,d):Ge(b,c,d)}function Ie(a,b){Xg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ef.rgb(Qi(b)).brighter(.75)})}function Je(a,b){Yg(b,a.node()),a.transition().duration(100).style("fill",function(){return Qi(b)})}function Ke(a,b,c,d){a?Ie(b,c,d):Je(b,c,d)}function Le(a,b,c,d){Ke(a,b,c.data,d)}function Me(a){return"circle"===a.nodeName?He:Ef.select(a).classed(f.bar)?Ke:Le}function Ne(a){return a.filter(function(a){return b(a.value)})}function Oe(a){return Zh?"function"==typeof $h?$h(a):$h:0}function Pe(a){return ai?bi?bi:1.75*Oe(a):Oe(a)}function Qe(a){return ci?ci:4*Oe(a)}function Re(a,c){return(c?nj.selectAll("."+f.circles+od(c)):nj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Se(a,b){Re(a,b).classed(f.EXPANDED,!0).attr("r",Pe)}function Te(a){Re(a).filter(function(){return Ef.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oe)}function Ue(a){return nj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ve(a){Ue(a).classed(f.EXPANDED,!0)}function We(a){Ue(a).classed(f.EXPANDED,!1)}function Xe(a,b){var c=_e(a,b);return function(a,b){var d=c(a,b),e=ih?1:0,f=ih?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 Ye(a,b){var c=_e(a,!1),d=b?Ze:$e;return function(a,b){return d(c(a,b),a,this)}}function Ze(a,b){var c;return ih?(c=ke(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function $e(a,b,c){var d=c.getBoundingClientRect();return ih?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ke(b)?-3:-6)}function _e(a,b){var c=a.__max__+1,d=ae(wg,c),e=Zd(d,c,a,!!b),f=$d(!!b),g=_d(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return ih&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function af(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 bf(b){var c,d,e;if(rj=Ef.select(Hf),rj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(rj.html("").classed("c3",!0),Ff.data.xs={},Ff.data.targets=vc(b),Pg&&Lc(Pg===!0?Cc(Ff.data.targets):Pg),n(),R(),qg.domain(Ef.extent(_b(Ff.data.targets))),rg.domain(Xb(Ff.data.targets,"y")),sg.domain(Xb(Ff.data.targets,"y2")),tg.domain(qg.domain()),ug.domain(rg.domain()),vg.domain(sg.domain()),sj=qg.domain(),gj.scale(tg),Mf&&kj.scale(qg),lj=rj.append("svg").on("mouseenter",Pf).on("mouseleave",Qf),mj=lj.append("defs"),mj.append("clipPath").attr("id",Bi).append("rect"),mj.append("clipPath").attr("id",Ci).append("rect"),mj.append("clipPath").attr("id",Di).append("rect"),nf(),nj=lj.append("g").attr("transform",Zi.main),oj=lj.append("g").attr("transform",Zi.context),pj=lj.append("g").attr("transform",Zi.legend),_g||oj.style("visibility","hidden"),ch||(pj.style("visibility","hidden"),Ui=Cc(Ff.data.targets)),qj=Ef.select(Hf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),zf(Cc(Ff.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=nj.append("g").attr("clip-path",Ei).attr("class",f.grid),Th&&d.append("g").attr("class",f.xgrids),Be(Vh)&&d.append("g").attr("class",f.xgridLines),_h&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Wh&&d.append("g").attr("class",f.ygrids),Be(Xh)&&d.append("g").attr("class",f.ygridLines),jh&&nj.append("g").attr("class",f.axisX).attr("clip-path",Fi).attr("transform",Zi.x).append("text").attr("class",f.axisXLabel).attr("transform",ih?"rotate(-90)":"").style("text-anchor",zb),Bh&&nj.append("g").attr("class",f.axisY).attr("clip-path",Gi).attr("transform",Zi.y).append("text").attr("class",f.axisYLabel).attr("transform",ih?"":"rotate(-90)").style("text-anchor",Ab),Kh&&nj.append("g").attr("class",f.axisY2).attr("transform",Zi.y2).append("text").attr("class",f.axisY2Label).attr("transform",ih?"":"rotate(-90)").style("text-anchor",Bb),nj.append("g").attr("clip-path",Ei).attr("class",f.regions),nj.append("g").attr("clip-path",Ei).attr("class",f.chart),c=nj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Mf?ih?"ns-resize":"ew-resize":null),nj.select("."+f.chart).append("g").attr("class",f.chartBars),nj.select("."+f.chart).append("g").attr("class",f.chartLines),nj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Zi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),nj.select("."+f.chart).append("g").attr("class",f.chartTexts),Mf&&nj.insert("rect",Of?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Xf).attr("height",Zf).style("opacity",0).style("cursor",ih?"ns-resize":"ew-resize").call(kj).on("dblclick.zoom",null),zh&&gj.extent("function"!=typeof zh?zh:zh(_b())),oj.append("g").attr("clip-path",Ei).attr("class",f.chart),oj.select("."+f.chart).append("g").attr("class",f.chartBars),oj.select("."+f.chart).append("g").attr("class",f.chartLines),oj.append("g").attr("clip-path",Ei).attr("class",f.brush).call(gj).selectAll("rect").attr(ih?"width":"height",ih?Yf:$f),oj.append("g").attr("class",f.axisX).attr("transform",Zi.subx).attr("clip-path",ih?"":Fi),pf(Ff.data.targets),ih?nj.select("."+f.axisX).style("opacity",0).call(wg):(nj.select("."+f.axisY).style("opacity",0).call(xg),nj.select("."+f.axisY2).style("opacity",0).call(yg)),n(),R(),nf(),m(!1),jf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),yi){if(Hi&&"string"==typeof zi){for(zi=we(zi),e=0;e0){d=[];for(var g in Eg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Od(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ke,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 gf(a){he(Ff.data.targets)||Qg&&(Ki=a,nj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Li=!0,Zg())}function hf(){he(Ff.data.targets)||Qg&&(nj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),nj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Li=!1,$g())}function jf(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z=Yd(),$=he(Ff.data.targets),_=Ic(Ff.data.targets);if(a=d(a)?a:{},E=d(a.withY)?a.withY:!0,F=d(a.withSubchart)?a.withSubchart:!0,G=d(a.withTransition)?a.withTransition:!0,J=d(a.withTransform)?a.withTransform:!1,K=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,M=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,N=d(a.withLegend)?a.withLegend:!1,H=d(a.withTransitionForExit)?a.withTransitionForExit:G,I=d(a.withTransitionForAxis)?a.withTransitionForAxis:G,T=G?Tf:0,U=H?T:0,V=I?T:0,c=nj.select("."+f.axisX).style("opacity",$?0:1),g=nj.select("."+f.axisY).style("opacity",$?0:1),h=nj.select("."+f.axisY2).style("opacity",$?0:1),e=oj.select("."+f.axisX).style("opacity",$?0:1),S={axisX:c.transition().duration(V),axisY:g.transition().duration(V),axisY2:h.transition().duration(V),axisSubX:e.transition().duration(V)},N&&ch&&zf(Cc(Ff.data.targets),a,S),Ii&&(0!==_.length&&M&&K||qg.domain([0,c.selectAll(".tick").size()])),_.length&&(M&&(qg.domain(Ef.extent(_b(_))),sj=qg.domain(),Mf&&kj.scale(qg).updateScaleExtent(),tg.domain(qg.domain()),gj.scale(tg)),K&&(qg.domain(gj.empty()?sj:gj.extent()),Mf&&kj.scale(qg).updateScaleExtent()),th||!sh&&!rh||(W=Kc(Jc(_),rh),wg.tickValues(W),zg.tickValues(W))),rg.domain(Xb(_,"y")),sg.domain(Xb(_,"y2")),S.axisX.call(wg),S.axisY.call(xg),S.axisY2.call(yg),S.axisSubX.call(zg),K&&_.length)if(ph&&W){for(X=1;X=0&&Ef.select(this).style("display",b%Y?"none":"block")})}else lj.selectAll("."+f.axisX+" .tick text").style("display","block");if(!ih&&uh&&eb(c,S.axisX,uh),O=Xe(Z),Q=Ye(Z,!0),R=Ye(Z,!1),Db(),ug.domain(rg.domain()),vg.domain(sg.domain()),qj.style("display","none"),o(),nj.select("line."+f.xgridFocus).style("visibility","hidden"),Th){if("year"===Uh){j=[];for(var ab=_b(),bb=ab[0].getFullYear(),cb=ab[1].getFullYear(),db=bb;cb>=db;db++)j.push(new Date(db+"-01-01 00:00:00"))}else j=qg.ticks(10);i=nj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",ih?0:function(a){return qg(a)-wg.tickOffset()}).attr("x2",ih?Xf:function(a){return qg(a)-wg.tickOffset()}).attr("y1",ih?function(a){return qg(a)-wg.tickOffset()}:Uf.top).attr("y2",ih?function(a){return qg(a)-wg.tickOffset()}:Zf).style("opacity",function(){return+Ef.select(this).attr(ih?"y1":"x1")===(ih?Zf:0)?0:1}),i.exit().remove()}Be(Vh)&&(k=nj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Vh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",ih?"":"rotate(-90)").attr("dx",ih?0:-Uf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",ih?0:Gd).attr("x2",ih?Xf:Gd).attr("y1",ih?Gd:Uf.top).attr("y2",ih?Gd:Zf).style("opacity",1),k.select("text").transition().duration(T).attr("x",ih?Xf:0).attr("y",Gd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),E&&Wh&&(m=nj.select("."+f.ygrids).selectAll("."+f.ygrid).data(rg.ticks(Yh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",ih?rg:0).attr("x2",ih?rg:Xf).attr("y1",ih?0:rg).attr("y2",ih?Zf:rg),m.exit().remove()),E&&Be(Xh)&&(n=nj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Xh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",ih?"rotate(-90)":"").attr("dx",ih?0:-Uf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(T).attr("x1",ih?Hd:0).attr("x2",ih?Hd:Xf).attr("y1",ih?0:Hd).attr("y2",ih?Zf:Hd).style("opacity",1),n.select("text").transition().duration(T).attr("x",ih?0:Xf).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(T).style("opacity",0).remove()),v=nj.select("."+f.regions).selectAll("rect."+f.region).data(ti),v.enter().append("rect").style("fill-opacity",0),v.attr("class",hd).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(T).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),v.exit().transition().duration(T).style("fill-opacity",0).remove(),t=nj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),t.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Qi),t.style("opacity",td).transition().duration(T).attr("d",O).style("opacity",1),t.exit().transition().duration(U).style("opacity",0).remove(),q=nj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),q.enter().append("path").attr("class",Zc).style("stroke",Qi),q.style("opacity",td).transition().duration(T).attr("d",hj).style("opacity",1),q.exit().transition().duration(U).style("opacity",0).remove(),r=nj.selectAll("."+f.areas).selectAll("."+f.area).data(pe),r.enter().append("path").attr("class",fd).style("fill",Qi).style("opacity",function(){return tj=+Ef.select(this).style("opacity"),0}),r.style("opacity",0).transition().duration(T).attr("d",ij).style("opacity",tj),r.exit().transition().duration(U).style("opacity",0).remove(),s=nj.selectAll("."+f.circles).selectAll("."+f.circle).data(se),s.enter().append("circle").attr("class",_c).attr("r",Oe),s.style("opacity",td).transition().duration(T).style("opacity",vd).attr("cx",ih?Xd:Wd).attr("cy",ih?Wd:Xd),s.exit().remove(),w=nj.selectAll("."+f.texts).selectAll("."+f.text).data(te),w.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return ih?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),w.text(function(a){return Ed(a.id)(a.value)}).style("fill-opacity",ud).transition().duration(T).attr("x",Q).attr("y",R).style("fill-opacity",wd),w.exit().transition().duration(U).style("fill-opacity",0).remove(),u=nj.selectAll("."+f.arcs).selectAll("."+f.arc).data(qe),u.enter().append("path").attr("class",dd).style("fill",function(a){return Qi(a.data)}).style("cursor",function(a){return Sg(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Oi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),vf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Sd(d,Ef.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Oi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),wf(),Td(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();ef(this,a,b),e(d,b)}),u.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Oi=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Fb(a);return c?(b=Ef.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("opacity",1).call(Ee,function(){Oi=!1}),u.exit().transition().duration(U).style("opacity",0).remove(),nj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(T).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&oe(a.data)?1:0}),nj.select("."+f.chartArcsTitle).style("opacity",ge(Ff.data.targets)?1:0),_g&&(null!==Ef.event&&"zoom"===Ef.event.type&&gj.extent(qg.orgDomain()).update(),F&&(!ih&&uh&&eb(e,S.axisSubX,uh),gj.empty()||gj.extent(qg.orgDomain()).update(),P=Xe(Z,!0),y=oj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),y.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Qi),y.style("opacity",td).transition().duration(T).attr("d",P).style("opacity",1),y.exit().transition().duration(T).style("opacity",0).remove(),x=oj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),x.enter().append("path").attr("class",Zc).style("stroke",Qi),x.style("opacity",td).transition().duration(T).attr("d",jj).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove())),nj.selectAll("."+f.selectedCircles).filter(function(a){return ke(a)}).selectAll("circle").remove(),nj.selectAll("."+f.selectedCircle).transition().duration(T).attr("cx",ih?Xd:Wd).attr("cy",ih?Wd:Xd),z=nj.select("."+f.eventRects),Be(Bg)&&!oc(Bg)?(z.classed(f.eventRectsMultiple)||z.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),A=nj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),df(A.enter()),A.attr("x",0).attr("y",0).attr("width",Xf).attr("height",Zf)):(z.classed(f.eventRectsSingle)||z.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ji&&!Ii?(D=function(a,b){var c=xc(b),d=yc(b),e=Ff.data.xs[a.id][b];return(qg(d?d:e+50)-qg(c?c:e-50))/2},C=function(a,b){var c=xc(b),d=Ff.data.xs[a.id][b];return(qg(d)+qg(c?c:d-50))/2}):(D=L(),C=function(a){return qg(a.x)-D/2}),B=Ac(Ff.data.targets),nj.select("."+f.eventRects).datum(B?B.values:[]),A=nj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),cf(A.enter()),A.attr("class",id).attr("x",ih?0:C).attr("y",ih?C:0).attr("width",ih?Xf:D).attr("height",ih?D:Zf),A.exit().remove()),Cc(Ff.data.targets).forEach(function(a){uj[a]=!0})}function kf(){jf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function lf(){return"mousemove"===Ef.event.sourceEvent.type&&kj.altDomain?(qg.domain(kj.altDomain),void kj.scale(qg).updateScaleExtent()):(Ii&&qg.orgDomain()[0]===sj[0]&&qg.domain([sj[0]-1e-10,qg.orgDomain()[1]]),jf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Ef.event.sourceEvent.type&&(Mi=!0)))}function mf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function nf(){lj.attr("width",_f).attr("height",ag),lj.select("#"+Bi).select("rect").attr("width",Xf).attr("height",Zf),lj.select("#"+Ci).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),lj.select("#"+Di).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),lj.select("."+f.zoomRect).attr("width",Xf).attr("height",Zf),rj.style("max-height",ag+"px")}function of(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),nf(),m(a.withTransition),jf(a)}function pf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=nj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",kd),j=i.enter().append("g").attr("class",kd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Qi(a)}),e=nj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",md),d=e.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",cd).style("cursor",function(a){return Sg(a)?"pointer":null}),c=nj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",ld),b=c.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",$c),b.append("g").attr("class",gd),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",ad).style("fill",Qi).style("cursor",function(a){return Sg(a)?"pointer":null}),a.forEach(function(a){nj.selectAll("."+f.selectedCircles+od(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=nj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(hg(a)).attr("class",nd),g=h.enter().append("g").attr("class",nd),g.append("g").attr("class",ed),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),_g&&(n=oj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",md),m=n.enter().append("g").style("opacity",0).attr("class",md),m.append("g").attr("class",cd),l=oj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",ld),k=l.enter().append("g").style("opacity",0).attr("class",ld),k.append("g").attr("class",$c)),lj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Tf).style("opacity",1)}function qf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?be(a.id,b.types[a.id]):be(a.id,b.type)}),Ff.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=$i?j:i,l=$i?Q():P();return d&&(w=0,C=0,t=0,u=0),ch&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=$i?u:t,void(hh?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=pj.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,$i?(g=function(a){return t*(.2+B[a])},j=function(a){return A[B[a]]+x[a]}):(g=function(a){return A[B[a]]+x[a]},j=function(a){return u*(.2+B[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=pj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof eh?eh(a):Ff.toggle(a)}).on("mouseover",function(a){Ef.select(this).classed(f.legendItemFocused,!0),Oi||Ff.focus(a),"function"==typeof fh&&fh(a)}).on("mouseout",function(a){Ef.select(this).classed(f.legendItemFocused,!1),Oi||Ff.revert(),"function"==typeof gh&&gh(a)}),o.append("text").text(function(a){return d(Eg[a])?Eg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",$i?h:-200).attr("y",$i?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",$i?i:-200).attr("y",$i?-200:l).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Qi(a)}).attr("x",$i?h:-200).attr("y",$i?-200:j).attr("width",10).attr("height",10),pj.selectAll("text").data(a).text(function(a){return d(Eg[a])?Eg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),pj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),pj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),pj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=Ef.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?tf(b):uf(b):cj}),N(t),O(u),M(C),n(),R(),nf(),m(q,c)}function Af(a){return Ec(Ff.data.targets,a.id)}function Bf(a){return"data"in a&&Ec(Ff.data.targets,a.data.id)}function Cf(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 Df(a,b,c){var d=!he(Ff.data.targets);Oi=!1,be(a,b),of(c||{withTransitionForAxis:d})}var Ef=a.d3?a.d3:a.require?a.require("d3"):void 0,Ff={data:{},axis:{},legend:{}},Gf={},Hf=h(["bindto"],"#chart"),If=h(["size","width"]),Jf=h(["size","height"]),Kf=h(["padding","left"],50),Lf=h(["padding","right"]),Mf=h(["zoom","enabled"],!1),Nf=h(["zoom","extent"]),Of=h(["zoom","privileged"],!1),Pf=h(["onenter"],function(){}),Qf=h(["onleave"],function(){}),Rf=h(["onresize"],function(){}),Sf=h(["onresized"],function(){}),Tf=h(["transition","duration"],350);g("data","data is required in config");var Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag=h(["data","x"]),Bg=h(["data","xs"],{}),Cg=h(["data","x_format"]),Dg=h(["data","id_converter"],function(a){return a}),Eg=h(["data","names"],{}),Fg=h(["data","classes"],{}),Gg=h(["data","groups"],[]),Hg=h(["data","axes"],{}),Ig=h(["data","type"]),Jg=h(["data","types"],{}),Kg=h(["data","labels"],{}),Lg=h(["data","order"]),Mg=h(["data","regions"],{}),Ng=h(["data","color"]),Og=h(["data","colors"],{}),Pg=h(["data","hide"],!1),Qg=h(["data","selection","enabled"],!1),Rg=h(["data","selection","grouped"],!1),Sg=h(["data","selection","isselectable"],function(){return!0}),Tg=h(["data","selection","multiple"],!0),Ug=h(["data","onclick"],function(){}),Vg=h(["data","onenter"],function(){}),Wg=h(["data","onleave"],function(){}),Xg=h(["data","onselected"],function(){}),Yg=h(["data","onunselected"],function(){}),Zg=h(["data","ondragstart"],function(){}),$g=h(["data","ondragend"],function(){}),_g=h(["subchart","show"],!1),ah=h(["subchart","size","height"],60),bh=h(["color","pattern"],[]),ch=h(["legend","show"],!0),dh=h(["legend","position"],"bottom"),eh=h(["legend","item","onclick"]),fh=h(["legend","item","onmouseover"]),gh=h(["legend","item","onmouseout"]),hh=h(["legend","equally"],!1),ih=h(["axis","rotated"],!1),jh=h(["axis","x","show"],!0),kh=h(["axis","x","type"],"indexed"),lh=h(["axis","x","localtime"],!0),mh=h(["axis","x","categories"],[]),nh=h(["axis","x","tick","centered"],!1),oh=h(["axis","x","tick","format"]),ph=h(["axis","x","tick","culling"],{}),qh=h(["axis","x","tick","culling","max"],10),rh=h(["axis","x","tick","count"]),sh=h(["axis","x","tick","fit"],!0),th=h(["axis","x","tick","values"],null),uh=h(["axis","x","tick","rotate"]),vh=h(["axis","x","max"],null),wh=h(["axis","x","min"],null),xh=h(["axis","x","padding"],{}),yh=h(["axis","x","height"]),zh=h(["axis","x","default"]),Ah=h(["axis","x","label"],{}),Bh=h(["axis","y","show"],!0),Ch=h(["axis","y","max"]),Dh=h(["axis","y","min"]),Eh=h(["axis","y","center"]),Fh=h(["axis","y","label"],{}),Gh=h(["axis","y","inner"],!1),Hh=h(["axis","y","tick","format"]),Ih=h(["axis","y","padding"]),Jh=h(["axis","y","ticks"],10),Kh=h(["axis","y2","show"],!1),Lh=h(["axis","y2","max"]),Mh=h(["axis","y2","min"]),Nh=h(["axis","y2","center"]),Oh=h(["axis","y2","label"],{}),Ph=h(["axis","y2","inner"],!1),Qh=h(["axis","y2","tick","format"]),Rh=h(["axis","y2","padding"]),Sh=h(["axis","y2","ticks"],10),Th=h(["grid","x","show"],!1),Uh=h(["grid","x","type"],"tick"),Vh=h(["grid","x","lines"],[]),Wh=h(["grid","y","show"],!1),Xh=h(["grid","y","lines"],[]),Yh=h(["grid","y","ticks"],10),Zh=h(["point","show"],!0),$h=h(["point","r"],2.5),_h=h(["point","focus","line","enabled"],!0),ai=h(["point","focus","expand","enabled"],!0),bi=h(["point","focus","expand","r"]),ci=h(["point","focus","select","r"]),di=h(["line","connect_null"],!1),ei=h(["bar","width"]),fi=h(["bar","width","ratio"],.6),gi=h(["pie","label","show"],!0),hi=h(["pie","label","format"]),ii=h(["pie","expand"],!0),ji=h(["pie","onclick"],function(){}),ki=h(["pie","onmouseover"],function(){}),li=h(["pie","onmouseout"],function(){}),mi=h(["donut","label","show"],!0),ni=h(["donut","label","format"]),oi=h(["donut","expand"],!0),pi=h(["donut","title"],""),qi=h(["donut","onclick"],function(){}),ri=h(["donut","onmouseover"],function(){}),si=h(["donut","onmouseout"],function(){}),ti=h(["regions"],[]),ui=h(["tooltip","show"],!0),vi=h(["tooltip","format","title"]),wi=h(["tooltip","format","value"]),xi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=vi?vi:b,l=wi?wi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id,a[g].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),yi=h(["tooltip","init","show"],!1),zi=h(["tooltip","init","x"],0),Ai=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Bi=("string"==typeof Hf?Hf.replace("#",""):Hf.id)+"-clip",Ci=Bi+"-xaxis",Di=Bi+"-yaxis",Ei=i(Bi),Fi=i(Ci),Gi=i(Di),Hi="timeseries"===kh,Ii="categorized"===kh,Ji=!Hi&&(Ag||Be(Bg)),Ki=null,Li=!1,Mi=!1,Ni=!1,Oi=!1,Pi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Qi=ve(Og,Be(bh)?bh:Pi,Ng),Ri=lh?Ef.time.format:Ef.time.format.utc,Si=function(){var a=[[Ri("%Y/%-m/%-d"),function(){return!0}],[Ri("%-m/%-d"),function(a){return a.getMonth()}],[Ri("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ri("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ri("%I %p"),function(a){return a.getHours()}],[Ri("%I:%M"),function(a){return a.getMinutes()}],[Ri(":%S"),function(a){return a.getSeconds()}],[Ri(".%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)}}(),Ti=[],Ui=[],Vi=ih?"left":"bottom",Wi=ih?Gh?"top":"bottom":Gh?"right":"left",Xi=ih?Ph?"bottom":"top":Ph?"left":"right",Yi=ih?"left":"bottom",Zi={main:function(){return"translate("+Uf.left+","+Uf.top+")"},context:function(){return"translate("+Vf.left+","+Vf.top+")"},legend:function(){return"translate("+Wf.left+","+Wf.top+")"},x:function(){return"translate(0,"+(ih?0:Zf)+")"},y:function(){return"translate(0,"+(ih?Zf:0)+")"},y2:function(){return"translate("+(ih?0:Xf)+","+(ih?1:0)+")"},subx:function(){return"translate(0,"+(ih?0:$f)+")"},arc:function(){return"translate("+Xf/2+","+Zf/2+")"}},$i="right"===dh,_i=0,aj=0,bj=0,cj=.15,dj=30,ej=ih&&!jh?0:30,fj=5;hg=Ef.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var gj,hj=function(){var a=Ef.svg.line().x(ih?function(a){return V(a.id)(a.value)}:Fd).y(ih?Fd:function(a){return V(a.id)(a.value)});return di||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=di?Ne(b.values):b.values;return ie(b)?(a.interpolate(je(b)?"cardinal":"linear"),Mg[b.id]?af(e,qg,V(b.id),Mg[b.id]):a(e)):(c=e[0]?qg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ih?"M "+d+" "+c:"M "+c+" "+d)}}(),ij=function(){var a;return a=ih?Ef.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Fd):Ef.svg.area().x(Fd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ne(b.values);return ce([b],"area")||ce([b],"area-spline")?(a.interpolate(je(b)?"cardinal":"linear"),a(e)):(c=e[0]?qg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ih?"M "+d+" "+c:"M "+c+" "+d)}}(),jj=function(){var a=Ef.svg.line().x(ih?function(a){return W(a.id)(a.value)}:Id).y(ih?Id:function(a){return W(a.id)(a.value)});return function(b){var c=Ne(b.values);return ie(b)?a(c):"M "+tg(c[0].x)+" "+W(b.id)(c[0].value)}}(),kj=function(){};gj=Ef.svg.brush().on("brush",kf),gj.update=function(){return oj&&oj.select("."+f.brush).call(this),this},gj.scale=function(a){return ih?this.y(a):this.x(a)},Mf&&(kj=Ef.behavior.zoom().on("zoomstart",function(){kj.altDomain=Ef.event.sourceEvent.altKey?qg.orgDomain():null}).on("zoom",Mf?lf:null),kj.scale=function(a){return ih?this.y(a):this.x(a)},kj.orgScaleExtent=function(){var a=Nf?Nf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},kj.updateScaleExtent=function(){var a=ac(qg.orgDomain())/ac(sj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var lj,mj,nj,oj,pj,qj,rj,sj,tj,uj={};if(Ff.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=lj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);Ff.revert(),Ff.defocus(),b(d.classed(f.focused,!0)),b(e),he(Ff.data.targets)&&Nb(a,!0),vf(a,!0)},Ff.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=lj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);Ff.revert(),b(d.classed(f.focused,!1)),b(e),he(Ff.data.targets)&&Ob(a),vf(a,!1)},Ff.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=lj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);b(d.classed(f.focused,!1)),b(e),he(Ff.data.targets)&&Ob(a),wf()},Ff.show=function(a,b){a=Dc(a),b=b||{},Mc(a),lj.selectAll(qd(a)).transition().style("opacity",1),b.withLegend&&xf(a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ff.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),lj.selectAll(qd(a)).transition().style("opacity",0),b.withLegend&&yf(a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ff.toggle=function(a){Gc(a)?Ff.hide(a):Ff.show(a)},Ff.unzoom=function(){gj.clear().update(),jf({withUpdateXDomain:!0})},Ff.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Fg[b]=a.classes[b]}),"categories"in a&&Ii&&(mh=a.categories,wg.categories(mh)),"cacheIds"in a&&bc(a.cacheIds)?void qf(dc(a.cacheIds),a.done):void("unload"in a?sf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){rf(a)}):rf(a))},Ff.unload=function(a,b){sf(Dc(a),function(){jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Ff.selected=function(a){return Ef.merge(nj.selectAll("."+f.shapes+od(a)).selectAll("."+f.shape).filter(function(){return Ef.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Ff.select=function(a,b,c){Qg&&nj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=Ef.select(this),i=e.data?e.data.id:e.id,j=Me(this),k=Rg||!a||a.indexOf(i)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Sg(e)&&!m&&j(!0,h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(!1,h.classed(f.SELECTED,!1),e,g)})},Ff.unselect=function(a,b){Qg&&nj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=Ef.select(this),g=c.data?c.data.id:c.id,h=Me(this),i=Rg||!a||a.indexOf(g)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(f.SELECTED);i&&j&&Sg(c)&&k&&h(!1,e.classed(f.SELECTED,!1),c,d) })},Ff.toLine=function(a){Df(a,"line")},Ff.toSpline=function(a){Df(a,"spline")},Ff.toBar=function(a){Df(a,"bar")},Ff.toScatter=function(a){Df(a,"scatter")},Ff.toArea=function(a){Df(a,"area")},Ff.toAreaSpline=function(a){Df(a,"area-spline")},Ff.toPie=function(a){Df(a,"pie",{withTransform:!0})},Ff.toDonut=function(a){Df(a,"donut",{withTransform:!0})},Ff.groups=function(a){return c(a)?Gg:(Gg=a,jf(),Gg)},Ff.xgrids=function(a){return a?(Vh=a,jf(),Vh):Vh},Ff.xgrids.add=function(a){return a?Ff.xgrids(Vh.concat(a)):void 0},Ff.xgrids.remove=function(a){var b=Cf(a);return Ff.xgrids(Vh.filter(b))},Ff.ygrids=function(a){return a?(Xh=a,jf(),Xh):Xh},Ff.ygrids.add=function(a){return a?Ff.ygrids(Xh.concat(a)):void 0},Ff.ygrids.remove=function(a){var b=Cf(a);return Ff.ygrids(Xh.filter(b))},Ff.regions=function(a){return c(a)?ti:(ti=a,jf(),ti)},Ff.regions.add=function(a){return c(a)?ti:(ti=ti.concat(a),jf(),ti)},Ff.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;lj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ti=ti.filter(function(b){return b.classes.indexOf(a)<0})}),ti},Ff.data.get=function(a){var b=Ff.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Ff.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},Ff.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Eg[b]=a[b]}),zf(Cc(Ff.data.targets),{withTransition:!0}),Eg):Eg},Ff.x=function(a){return arguments.length&&(qc(Ff.data.targets,a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ff.data.xs},Ff.xs=function(a){return arguments.length&&(rc(Ff.data.targets,a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ff.data.xs},Ff.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},Ff.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Ch=+a.y),b(a.y2)&&(Lh=+a.y2)):Ch=Lh=+a,jf())},Ff.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Dh=+a.y),b(a.y2)&&(Mh=+a.y2)):Dh=Mh=+a,jf())},Ff.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Ff.axis.max(a.max),"undefined"!=typeof a.min&&Ff.axis.min(a.min))},Ff.legend.show=function(a){xf(Dc(a)),jf({withLegend:!0})},Ff.legend.hide=function(a){yf(Dc(a)),jf({withLegend:!0})},Ff.resize=function(a){If=a?a.width:null,Jf=a?a.height:null,of({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Ff.destroy=function(){Ff.data.targets=void 0,Ff.data.xs={},rj.html(""),a.onresize=null},"url"in e.data)Ef.xhr(e.data.url,function(a,b){var c,d=Ef.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Ef.csv.parse(b.response),bf(c)});else if("rows"in e.data)bf(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");bf(uc(e.data.columns))}return Ff},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file diff --git a/package.json b/package.json index fd94236..f43f502 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "c3", - "version": "0.1.33", + "version": "0.1.34", "description": "D3-based reusable chart library", "main": "c3.js", "scripts": { From 150dd26ff31132140a0decf86d3c04d0e271d4be Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Fri, 2 May 2014 14:17:48 +0900 Subject: [PATCH 116/178] Fix trivial --- c3.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c3.js b/c3.js index cb28135..a325256 100644 --- a/c3.js +++ b/c3.js @@ -3783,7 +3783,7 @@ .style("pointer-events", "none"); mainTextEnter.append('g') .attr('class', classTexts) - .style("fill", function (d) { return color(d); }); + .style("fill", color); //-- Bar --// mainBarUpdate = main.select('.' + CLASS.chartBars).selectAll('.' + CLASS.chartBar) From 7bead89c743068ec954de4739ced94f2e78bf81f Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Fri, 2 May 2014 14:25:19 +0900 Subject: [PATCH 117/178] Update color of bar when update - #196 --- c3.js | 1 + c3.min.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/c3.js b/c3.js index a325256..3da8586 100644 --- a/c3.js +++ b/c3.js @@ -3405,6 +3405,7 @@ .style("opacity", initialOpacity) .transition().duration(duration) .attr('d', drawBar) + .style("fill", color) .style("opacity", 1); mainBar.exit().transition().duration(durationForExit) .style('opacity', 0) diff --git a/c3.min.js b/c3.min.js index 29a26bd..aa6b5fb 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ !function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.34"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",lines:"c3-lines",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",arcs:"c3-arcs",area:"c3-area",areas:"c3-areas",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",legendItemFocused:"c3-legend-item-focused",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;cXf&&(Xf=0),0>Zf&&(Zf=0),Yf=ih?Uf.left-dj-ej:Xf,$f=ih?Zf:ag-Vf.top-Vf.bottom,0>Yf&&(Yf=0),0>$f&&($f=0),p(),$i&&he(Ff.data.targets)&&(Wf.left=Xf/2+cg)}function o(){nj.select("line."+f.xgridFocus).attr("x1",ih?0:-10).attr("x2",ih?Xf:-10).attr("y1",ih?-10:Uf.top).attr("y2",ih?-10:Zf)}function p(){cg=Zf/2,bg=.95*cg,dg=ge(Ff.data.targets)?.6*bg:0}function q(){var a=ih?f.axisX:f.axisY,b=nj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Ef.select(Hf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return If?If:x()}function s(){var a=Jf?Jf:y();return a>0?a:320}function t(){return he(Ff.data.targets)?0:Kf?Kf:ih?jh?v("x"):1:!Bh||Gh?1:v("y")}function u(){var a=1;return he(Ff.data.targets)?0:Lf?Lf:$i?P()+(Kh&&!ih?v("y2"):a):Kh?Ph||ih?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||jh?"x"===a&&yh?yh:"y"!==a||Bh?"y2"!==a||Kh?(jb(a).isInner?30:40)+("y2"===a?-10:0):fj:ch&&!$i?10:1:0}function x(){return+Ef.select(Hf).style("width").replace("px","")}function y(){return+Ef.select(Hf).style("height").replace("px","")}function z(a){return a?-5:-(Uf.left-1)}function A(a){return a?-20:-4}function B(){return z(!ih)}function C(){return A(!ih)}function D(){return z(ih)}function E(){return A(ih)}function F(a){return a?Xf+2+4:Uf.left+20}function G(a){return a?(yh?yh:0)+80:Zf+8}function H(){return F(!ih)}function I(){return G(!ih)}function J(){return F(ih)}function K(){return G(ih)}function L(){var a,b,c,d,e,f=Ac(Ff.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=qg(b.x)-qg(a.x),0===c?ih?Zf:Xf:(d=zc(),e=de(Ff.data.targets)?(d-(Ii?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function M(a){_i=a}function N(a){aj=a}function O(a){bj=a}function P(){return ch?$i?aj*(_i+1):_f:0}function Q(){return ch?$i?ag:bj*(_i+1):0}function R(){var a,b,c=!qg;ig=ih?1:0,jg=ih?Zf:Xf,kg=ih?0:Zf,lg=ih?Xf:1,mg=ig,ng=jg,og=ih?0:$f,pg=ih?Yf:1,qg=T(ig,jg,c?void 0:qg.domain(),function(){return wg.tickOffset()}),rg=U(kg,lg,c?void 0:rg.domain()),sg=U(kg,lg,c?void 0:sg.domain()),tg=T(ig,jg,sj,function(a){return a%1?0:zg.tickOffset()}),ug=U(og,pg,c?void 0:ug.domain()),vg=U(og,pg,c?void 0:vg.domain()),a=$(),b=th?th:c?void 0:wg.tickValues(),wg=X(qg,Vi,a,b),zg=X(tg,Yi,a,b),xg=Y(rg,Wi,Hh,Jh),yg=Y(sg,Xi,Qh,Sh),c||(gj.scale(tg),Mf&&kj.scale(qg)),S()}function S(){eg=Gb(),fg=Hb(),gg=Hb(.98)}function T(a,b,d,e){var f=(Hi?Ef.time.scale():Ef.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Ii){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=Ef.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?sg:rg}function W(a){return"y2"===Z(a)?vg:ug}function X(a,b,c,d){var e=(Ii?Eb():Ef.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Ii?(e.tickCentered(nh),Ae(ph)&&(ph=!1)):e.tickOffset=function(){var a=Bc(Ff.data.targets),b=qg(a[1])-qg(a[0]),c=b?b:ih?Zf:Xf;return c/zc()/2},Ii&&e.categories(mh),e}function Y(a,b,c,d){return Ef.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Hg?Hg[a]:"y"}function $(){var a=Hi?Si:Ii?Tc:function(a){return 0>a?a.toFixed(0):a};return oh&&("function"==typeof oh?a=oh:Hi&&(a=function(a){return a?Ri(oh)(a):""})),a}function _(a){var b;return"y"===a?b=Fh:"y2"===a?b=Oh:"x"===a&&(b=Ah),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Fh=b:"y2"===a?Oh=b:"x"===a&&(Ah=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",ih?"inner-top":"inner-right")}function hb(){return fb("y",ih?"inner-right":"inner-top")}function ib(){return fb("y2",ih?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Xf/2:Xf:b.isBottom?-Zf:b.isMiddle?-Zf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!ih,gb())}function rb(){return nb(ih,hb())}function sb(){return nb(ih,ib())}function tb(){return ob(!ih,gb())}function ub(){return ob(ih,hb())}function vb(){return ob(ih,ib())}function wb(){var a=gb();return ih?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":yh?yh-10:"3em"}function xb(){var a=hb();return ih?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return ih?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!ih,gb())}function Ab(){return pb(ih,hb())}function Bb(){return pb(ih,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return Ef.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){nj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),nj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),nj.select("."+f.axisY2+" ."+f.axisY2Label).transition().attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 Ef.min(Object.keys(i).map(function(a){return Ef.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(Gg.length>0)for(g=Sc(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 Ef.max(Object.keys(i).map(function(a){return Ef.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Mh:Dh,n="y2"===c?Lh:Ch,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Nh:Eh,r=xd()&&ih;return 0===l.length?"y2"===c?sg.domain():rg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=yd(o,p),j=ac(rg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),"y2"===c&&Rh&&(f=b(Rh.top)?Rh.top:e,g=b(Rh.bottom)?Rh.bottom:e),de(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return wh?Hi?we(wh):wh:Ef.min(a,function(a){return Ef.min(a.values,function(a){return a.x})})}function Zb(a){return vh?Hi?we(vh):vh:Ef.max(a,function(a){return Ef.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Ii?d=0:de(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof xh&&Be(xh)?(e=b(xh.left)?xh.left:d,f=b(xh.right)?xh.right:d):e=f="number"==typeof xh?xh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return c-d===0&&(c=Hi?new Date(.5*c.getTime()):-.5,d=Hi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Hi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Hi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?rg:sg;return b="y"===a.axis||"y2"===a.axis?ih?Zf:"start"in a?d(a.start):Zf:ih?"end"in a?qg(Hi?we(a.end):a.end):Zf:Zf,c>b?0:b-c}function ic(a){return Ag&&a===Ag||Be(Bg)&&Ce(Bg,a)}function jc(a){return!ic(a)}function kc(a){return Ag?Ag:Be(Bg)?Bg[a]:null}function lc(a,b){var c,d=b&&Be(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=Ff.data.xs[b])}),c}function mc(a,b){return a in Ff.data.xs&&Ff.data.xs[a]&&Ff.data.xs[a][b]?Ff.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){Bg[b]=a[b]})}function oc(a){return 1===Ef.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=Eg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),Ff.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=Hi?a?a instanceof Date?a:we(a):we(mc(c,d)):Ji&&!Ii?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Ff.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Ag?(d=Object.keys(Ff.data.xs),Ff.data.xs[c]=d.length>0?Ff.data.xs[d[0]]:void 0):Be(Bg)&&(Ff.data.xs[c]=lc(f,Ff.data.targets)):Ff.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Ff.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Dg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ji&&Ii&&0===c&&g&&(0===e&&(mh=[]),mh.push(g)),("undefined"==typeof a[b]||Ff.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ig&&be(Cc(c).filter(function(a){return!(a in Jg)}),Ig),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&Ff.data.targets[0].values[a-1]?Ff.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(Ff.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Hi?new Date(i):i);j.push(e)}return Hi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Ti=Ti.concat(a)}function Mc(a){Ti=Ti.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Ui=Ui.concat(a)}function Oc(a){Ui=Ui.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Jd(a,f))),(a[g].x||0===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=De(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Nd(a,b){return Ef.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Od(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 Pd(){return Lg&&"desc"===Lg.toLowerCase()}function Qd(){return Lg&&"asc"===Lg.toLowerCase()}function Rd(a){var b=Qd(),c=Pd();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 Lg&&a.sort(Lg),a}function Sd(a,c){var d,e,f,g,h,i,j,k=he(Ff.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&ui&&(qj.html(xi(a,$(),zd(k),Qi)).style("display","block"),d=qj.property("offsetWidth"),e=qj.property("offsetHeight"),k?(g=Xf/2+c[0],i=Zf/2+c[1]+20):(ih?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=qg(l[0].x)+20):(f=q(),g=f+t()+qg(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),qj.style("top",i+"px").style("left",g+"px"))}function Td(){qj.style("display","none")}function Ud(a){var c=a.filter(function(a){return a&&b(a.value)});ui&&(ee(Ff.data.targets)||he(Ff.data.targets)||nj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(ih?"y1":"x1",Fd).attr(ih?"y2":"x2",Fd))}function Vd(){nj.select("line."+f.xgridFocus).style("visibility","hidden")}function Wd(a){return a.x||0===a.x?qg(a.x):null}function Xd(a){return V(a.id)(a.value)}function Yd(){var a,b,d={},e=0;return Ic(Fc(ke)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ae(a,b){return"number"==typeof ei?ei:b?2*a.tickOffset()*fi/b:0}function be(a,b){Dc(a).forEach(function(a){uj[a]=b===Jg[a],Jg[a]=b})}function ce(a,b){var c=!1;return a.forEach(function(a){Jg[a.id]===b&&(c=!0),a.id in Jg||"line"!==b||(c=!0)}),c}function de(a){return ce(a,"bar")}function ee(a){return ce(a,"scatter")}function fe(a){return ce(a,"pie")}function ge(a){return ce(a,"donut")}function he(a){return fe(a)||ge(a)}function ie(a){var b="string"==typeof a?a:a.id;return!(b in Jg)||"line"===Jg[b]||"spline"===Jg[b]||"area"===Jg[b]||"area-spline"===Jg[b]}function je(a){var b="string"==typeof a?a:a.id;return"spline"===Jg[b]||"area-spline"===Jg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"bar"===Jg[b]}function le(a){var b="string"==typeof a?a:a.id;return"scatter"===Jg[b]}function me(a){var b="string"==typeof a?a:a.id;return"pie"===Jg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"donut"===Jg[b]}function oe(a){return me(a)||ne(a)}function pe(a){return ie(a)?[a]:[]}function qe(a){return oe(a.data)?[a]:[]}function re(a){return ke(a)?a.values:[]}function se(a){return ie(a)||le(a)?a.values:[]}function te(a){return ke(a)||ie(a)?a.values:[]}function ue(a){return ne(a)&&oi||me(a)&&ii}function ve(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function we(b){var c;try{c=Cg?Ef.time.format(Cg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Cg)}return c}function xe(a,b){var c=Ef.mouse(a),d=Ef.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ce(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function De(a,b){var c="y"===Z(a.id)?rg:sg,d=ih?1:0,e=ih?0:1;return Math.pow(qg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ee(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Fe(a,b,c){Xg(b,a.node()),nj.select("."+f.selectedCircles+od(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",ih?Xd:Wd).attr("cy",ih?Wd:Xd).attr("stroke",function(){return Qi(b)}).attr("r",1.4*Qe(b)).transition().duration(100).attr("r",Qe)}function Ge(a,b,c){Yg(b,a.node()),nj.select("."+f.selectedCircles+od(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function He(a,b,c,d){a?Fe(b,c,d):Ge(b,c,d)}function Ie(a,b){Xg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ef.rgb(Qi(b)).brighter(.75)})}function Je(a,b){Yg(b,a.node()),a.transition().duration(100).style("fill",function(){return Qi(b)})}function Ke(a,b,c,d){a?Ie(b,c,d):Je(b,c,d)}function Le(a,b,c,d){Ke(a,b,c.data,d)}function Me(a){return"circle"===a.nodeName?He:Ef.select(a).classed(f.bar)?Ke:Le}function Ne(a){return a.filter(function(a){return b(a.value)})}function Oe(a){return Zh?"function"==typeof $h?$h(a):$h:0}function Pe(a){return ai?bi?bi:1.75*Oe(a):Oe(a)}function Qe(a){return ci?ci:4*Oe(a)}function Re(a,c){return(c?nj.selectAll("."+f.circles+od(c)):nj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Se(a,b){Re(a,b).classed(f.EXPANDED,!0).attr("r",Pe)}function Te(a){Re(a).filter(function(){return Ef.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oe)}function Ue(a){return nj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ve(a){Ue(a).classed(f.EXPANDED,!0)}function We(a){Ue(a).classed(f.EXPANDED,!1)}function Xe(a,b){var c=_e(a,b);return function(a,b){var d=c(a,b),e=ih?1:0,f=ih?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 Ye(a,b){var c=_e(a,!1),d=b?Ze:$e;return function(a,b){return d(c(a,b),a,this)}}function Ze(a,b){var c;return ih?(c=ke(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function $e(a,b,c){var d=c.getBoundingClientRect();return ih?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ke(b)?-3:-6)}function _e(a,b){var c=a.__max__+1,d=ae(wg,c),e=Zd(d,c,a,!!b),f=$d(!!b),g=_d(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return ih&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function af(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 bf(b){var c,d,e;if(rj=Ef.select(Hf),rj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(rj.html("").classed("c3",!0),Ff.data.xs={},Ff.data.targets=vc(b),Pg&&Lc(Pg===!0?Cc(Ff.data.targets):Pg),n(),R(),qg.domain(Ef.extent(_b(Ff.data.targets))),rg.domain(Xb(Ff.data.targets,"y")),sg.domain(Xb(Ff.data.targets,"y2")),tg.domain(qg.domain()),ug.domain(rg.domain()),vg.domain(sg.domain()),sj=qg.domain(),gj.scale(tg),Mf&&kj.scale(qg),lj=rj.append("svg").on("mouseenter",Pf).on("mouseleave",Qf),mj=lj.append("defs"),mj.append("clipPath").attr("id",Bi).append("rect"),mj.append("clipPath").attr("id",Ci).append("rect"),mj.append("clipPath").attr("id",Di).append("rect"),nf(),nj=lj.append("g").attr("transform",Zi.main),oj=lj.append("g").attr("transform",Zi.context),pj=lj.append("g").attr("transform",Zi.legend),_g||oj.style("visibility","hidden"),ch||(pj.style("visibility","hidden"),Ui=Cc(Ff.data.targets)),qj=Ef.select(Hf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),zf(Cc(Ff.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=nj.append("g").attr("clip-path",Ei).attr("class",f.grid),Th&&d.append("g").attr("class",f.xgrids),Be(Vh)&&d.append("g").attr("class",f.xgridLines),_h&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Wh&&d.append("g").attr("class",f.ygrids),Be(Xh)&&d.append("g").attr("class",f.ygridLines),jh&&nj.append("g").attr("class",f.axisX).attr("clip-path",Fi).attr("transform",Zi.x).append("text").attr("class",f.axisXLabel).attr("transform",ih?"rotate(-90)":"").style("text-anchor",zb),Bh&&nj.append("g").attr("class",f.axisY).attr("clip-path",Gi).attr("transform",Zi.y).append("text").attr("class",f.axisYLabel).attr("transform",ih?"":"rotate(-90)").style("text-anchor",Ab),Kh&&nj.append("g").attr("class",f.axisY2).attr("transform",Zi.y2).append("text").attr("class",f.axisY2Label).attr("transform",ih?"":"rotate(-90)").style("text-anchor",Bb),nj.append("g").attr("clip-path",Ei).attr("class",f.regions),nj.append("g").attr("clip-path",Ei).attr("class",f.chart),c=nj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Mf?ih?"ns-resize":"ew-resize":null),nj.select("."+f.chart).append("g").attr("class",f.chartBars),nj.select("."+f.chart).append("g").attr("class",f.chartLines),nj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Zi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),nj.select("."+f.chart).append("g").attr("class",f.chartTexts),Mf&&nj.insert("rect",Of?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Xf).attr("height",Zf).style("opacity",0).style("cursor",ih?"ns-resize":"ew-resize").call(kj).on("dblclick.zoom",null),zh&&gj.extent("function"!=typeof zh?zh:zh(_b())),oj.append("g").attr("clip-path",Ei).attr("class",f.chart),oj.select("."+f.chart).append("g").attr("class",f.chartBars),oj.select("."+f.chart).append("g").attr("class",f.chartLines),oj.append("g").attr("clip-path",Ei).attr("class",f.brush).call(gj).selectAll("rect").attr(ih?"width":"height",ih?Yf:$f),oj.append("g").attr("class",f.axisX).attr("transform",Zi.subx).attr("clip-path",ih?"":Fi),pf(Ff.data.targets),ih?nj.select("."+f.axisX).style("opacity",0).call(wg):(nj.select("."+f.axisY).style("opacity",0).call(xg),nj.select("."+f.axisY2).style("opacity",0).call(yg)),n(),R(),nf(),m(!1),jf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),yi){if(Hi&&"string"==typeof zi){for(zi=we(zi),e=0;e0){d=[];for(var g in Eg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Od(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ke,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 gf(a){he(Ff.data.targets)||Qg&&(Ki=a,nj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Li=!0,Zg())}function hf(){he(Ff.data.targets)||Qg&&(nj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),nj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Li=!1,$g())}function jf(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z=Yd(),$=he(Ff.data.targets),_=Ic(Ff.data.targets);if(a=d(a)?a:{},E=d(a.withY)?a.withY:!0,F=d(a.withSubchart)?a.withSubchart:!0,G=d(a.withTransition)?a.withTransition:!0,J=d(a.withTransform)?a.withTransform:!1,K=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,M=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,N=d(a.withLegend)?a.withLegend:!1,H=d(a.withTransitionForExit)?a.withTransitionForExit:G,I=d(a.withTransitionForAxis)?a.withTransitionForAxis:G,T=G?Tf:0,U=H?T:0,V=I?T:0,c=nj.select("."+f.axisX).style("opacity",$?0:1),g=nj.select("."+f.axisY).style("opacity",$?0:1),h=nj.select("."+f.axisY2).style("opacity",$?0:1),e=oj.select("."+f.axisX).style("opacity",$?0:1),S={axisX:c.transition().duration(V),axisY:g.transition().duration(V),axisY2:h.transition().duration(V),axisSubX:e.transition().duration(V)},N&&ch&&zf(Cc(Ff.data.targets),a,S),Ii&&(0!==_.length&&M&&K||qg.domain([0,c.selectAll(".tick").size()])),_.length&&(M&&(qg.domain(Ef.extent(_b(_))),sj=qg.domain(),Mf&&kj.scale(qg).updateScaleExtent(),tg.domain(qg.domain()),gj.scale(tg)),K&&(qg.domain(gj.empty()?sj:gj.extent()),Mf&&kj.scale(qg).updateScaleExtent()),th||!sh&&!rh||(W=Kc(Jc(_),rh),wg.tickValues(W),zg.tickValues(W))),rg.domain(Xb(_,"y")),sg.domain(Xb(_,"y2")),S.axisX.call(wg),S.axisY.call(xg),S.axisY2.call(yg),S.axisSubX.call(zg),K&&_.length)if(ph&&W){for(X=1;X=0&&Ef.select(this).style("display",b%Y?"none":"block")})}else lj.selectAll("."+f.axisX+" .tick text").style("display","block");if(!ih&&uh&&eb(c,S.axisX,uh),O=Xe(Z),Q=Ye(Z,!0),R=Ye(Z,!1),Db(),ug.domain(rg.domain()),vg.domain(sg.domain()),qj.style("display","none"),o(),nj.select("line."+f.xgridFocus).style("visibility","hidden"),Th){if("year"===Uh){j=[];for(var ab=_b(),bb=ab[0].getFullYear(),cb=ab[1].getFullYear(),db=bb;cb>=db;db++)j.push(new Date(db+"-01-01 00:00:00"))}else j=qg.ticks(10);i=nj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",ih?0:function(a){return qg(a)-wg.tickOffset()}).attr("x2",ih?Xf:function(a){return qg(a)-wg.tickOffset()}).attr("y1",ih?function(a){return qg(a)-wg.tickOffset()}:Uf.top).attr("y2",ih?function(a){return qg(a)-wg.tickOffset()}:Zf).style("opacity",function(){return+Ef.select(this).attr(ih?"y1":"x1")===(ih?Zf:0)?0:1}),i.exit().remove()}Be(Vh)&&(k=nj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Vh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",ih?"":"rotate(-90)").attr("dx",ih?0:-Uf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",ih?0:Gd).attr("x2",ih?Xf:Gd).attr("y1",ih?Gd:Uf.top).attr("y2",ih?Gd:Zf).style("opacity",1),k.select("text").transition().duration(T).attr("x",ih?Xf:0).attr("y",Gd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),E&&Wh&&(m=nj.select("."+f.ygrids).selectAll("."+f.ygrid).data(rg.ticks(Yh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",ih?rg:0).attr("x2",ih?rg:Xf).attr("y1",ih?0:rg).attr("y2",ih?Zf:rg),m.exit().remove()),E&&Be(Xh)&&(n=nj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Xh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",ih?"rotate(-90)":"").attr("dx",ih?0:-Uf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(T).attr("x1",ih?Hd:0).attr("x2",ih?Hd:Xf).attr("y1",ih?0:Hd).attr("y2",ih?Zf:Hd).style("opacity",1),n.select("text").transition().duration(T).attr("x",ih?0:Xf).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(T).style("opacity",0).remove()),v=nj.select("."+f.regions).selectAll("rect."+f.region).data(ti),v.enter().append("rect").style("fill-opacity",0),v.attr("class",hd).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(T).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),v.exit().transition().duration(T).style("fill-opacity",0).remove(),t=nj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),t.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Qi),t.style("opacity",td).transition().duration(T).attr("d",O).style("opacity",1),t.exit().transition().duration(U).style("opacity",0).remove(),q=nj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),q.enter().append("path").attr("class",Zc).style("stroke",Qi),q.style("opacity",td).transition().duration(T).attr("d",hj).style("opacity",1),q.exit().transition().duration(U).style("opacity",0).remove(),r=nj.selectAll("."+f.areas).selectAll("."+f.area).data(pe),r.enter().append("path").attr("class",fd).style("fill",Qi).style("opacity",function(){return tj=+Ef.select(this).style("opacity"),0}),r.style("opacity",0).transition().duration(T).attr("d",ij).style("opacity",tj),r.exit().transition().duration(U).style("opacity",0).remove(),s=nj.selectAll("."+f.circles).selectAll("."+f.circle).data(se),s.enter().append("circle").attr("class",_c).attr("r",Oe),s.style("opacity",td).transition().duration(T).style("opacity",vd).attr("cx",ih?Xd:Wd).attr("cy",ih?Wd:Xd),s.exit().remove(),w=nj.selectAll("."+f.texts).selectAll("."+f.text).data(te),w.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return ih?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),w.text(function(a){return Ed(a.id)(a.value)}).style("fill-opacity",ud).transition().duration(T).attr("x",Q).attr("y",R).style("fill-opacity",wd),w.exit().transition().duration(U).style("fill-opacity",0).remove(),u=nj.selectAll("."+f.arcs).selectAll("."+f.arc).data(qe),u.enter().append("path").attr("class",dd).style("fill",function(a){return Qi(a.data)}).style("cursor",function(a){return Sg(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Oi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),vf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Sd(d,Ef.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Oi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),wf(),Td(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();ef(this,a,b),e(d,b)}),u.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Oi=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Fb(a);return c?(b=Ef.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("opacity",1).call(Ee,function(){Oi=!1}),u.exit().transition().duration(U).style("opacity",0).remove(),nj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(T).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&oe(a.data)?1:0}),nj.select("."+f.chartArcsTitle).style("opacity",ge(Ff.data.targets)?1:0),_g&&(null!==Ef.event&&"zoom"===Ef.event.type&&gj.extent(qg.orgDomain()).update(),F&&(!ih&&uh&&eb(e,S.axisSubX,uh),gj.empty()||gj.extent(qg.orgDomain()).update(),P=Xe(Z,!0),y=oj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),y.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Qi),y.style("opacity",td).transition().duration(T).attr("d",P).style("opacity",1),y.exit().transition().duration(T).style("opacity",0).remove(),x=oj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),x.enter().append("path").attr("class",Zc).style("stroke",Qi),x.style("opacity",td).transition().duration(T).attr("d",jj).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove())),nj.selectAll("."+f.selectedCircles).filter(function(a){return ke(a)}).selectAll("circle").remove(),nj.selectAll("."+f.selectedCircle).transition().duration(T).attr("cx",ih?Xd:Wd).attr("cy",ih?Wd:Xd),z=nj.select("."+f.eventRects),Be(Bg)&&!oc(Bg)?(z.classed(f.eventRectsMultiple)||z.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),A=nj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),df(A.enter()),A.attr("x",0).attr("y",0).attr("width",Xf).attr("height",Zf)):(z.classed(f.eventRectsSingle)||z.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ji&&!Ii?(D=function(a,b){var c=xc(b),d=yc(b),e=Ff.data.xs[a.id][b];return(qg(d?d:e+50)-qg(c?c:e-50))/2},C=function(a,b){var c=xc(b),d=Ff.data.xs[a.id][b];return(qg(d)+qg(c?c:d-50))/2}):(D=L(),C=function(a){return qg(a.x)-D/2}),B=Ac(Ff.data.targets),nj.select("."+f.eventRects).datum(B?B.values:[]),A=nj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),cf(A.enter()),A.attr("class",id).attr("x",ih?0:C).attr("y",ih?C:0).attr("width",ih?Xf:D).attr("height",ih?D:Zf),A.exit().remove()),Cc(Ff.data.targets).forEach(function(a){uj[a]=!0})}function kf(){jf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function lf(){return"mousemove"===Ef.event.sourceEvent.type&&kj.altDomain?(qg.domain(kj.altDomain),void kj.scale(qg).updateScaleExtent()):(Ii&&qg.orgDomain()[0]===sj[0]&&qg.domain([sj[0]-1e-10,qg.orgDomain()[1]]),jf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Ef.event.sourceEvent.type&&(Mi=!0)))}function mf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function nf(){lj.attr("width",_f).attr("height",ag),lj.select("#"+Bi).select("rect").attr("width",Xf).attr("height",Zf),lj.select("#"+Ci).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),lj.select("#"+Di).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),lj.select("."+f.zoomRect).attr("width",Xf).attr("height",Zf),rj.style("max-height",ag+"px")}function of(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),nf(),m(a.withTransition),jf(a)}function pf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=nj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",kd),j=i.enter().append("g").attr("class",kd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Qi(a)}),e=nj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",md),d=e.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",cd).style("cursor",function(a){return Sg(a)?"pointer":null}),c=nj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",ld),b=c.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",$c),b.append("g").attr("class",gd),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",ad).style("fill",Qi).style("cursor",function(a){return Sg(a)?"pointer":null}),a.forEach(function(a){nj.selectAll("."+f.selectedCircles+od(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=nj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(hg(a)).attr("class",nd),g=h.enter().append("g").attr("class",nd),g.append("g").attr("class",ed),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),_g&&(n=oj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",md),m=n.enter().append("g").style("opacity",0).attr("class",md),m.append("g").attr("class",cd),l=oj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",ld),k=l.enter().append("g").style("opacity",0).attr("class",ld),k.append("g").attr("class",$c)),lj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Tf).style("opacity",1)}function qf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?be(a.id,b.types[a.id]):be(a.id,b.type)}),Ff.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=$i?j:i,l=$i?Q():P();return d&&(w=0,C=0,t=0,u=0),ch&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=$i?u:t,void(hh?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=pj.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,$i?(g=function(a){return t*(.2+B[a])},j=function(a){return A[B[a]]+x[a]}):(g=function(a){return A[B[a]]+x[a]},j=function(a){return u*(.2+B[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=pj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof eh?eh(a):Ff.toggle(a)}).on("mouseover",function(a){Ef.select(this).classed(f.legendItemFocused,!0),Oi||Ff.focus(a),"function"==typeof fh&&fh(a)}).on("mouseout",function(a){Ef.select(this).classed(f.legendItemFocused,!1),Oi||Ff.revert(),"function"==typeof gh&&gh(a)}),o.append("text").text(function(a){return d(Eg[a])?Eg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",$i?h:-200).attr("y",$i?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",$i?i:-200).attr("y",$i?-200:l).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Qi(a)}).attr("x",$i?h:-200).attr("y",$i?-200:j).attr("width",10).attr("height",10),pj.selectAll("text").data(a).text(function(a){return d(Eg[a])?Eg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),pj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),pj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),pj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=Ef.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?tf(b):uf(b):cj}),N(t),O(u),M(C),n(),R(),nf(),m(q,c)}function Af(a){return Ec(Ff.data.targets,a.id)}function Bf(a){return"data"in a&&Ec(Ff.data.targets,a.data.id)}function Cf(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 Df(a,b,c){var d=!he(Ff.data.targets);Oi=!1,be(a,b),of(c||{withTransitionForAxis:d})}var Ef=a.d3?a.d3:a.require?a.require("d3"):void 0,Ff={data:{},axis:{},legend:{}},Gf={},Hf=h(["bindto"],"#chart"),If=h(["size","width"]),Jf=h(["size","height"]),Kf=h(["padding","left"],50),Lf=h(["padding","right"]),Mf=h(["zoom","enabled"],!1),Nf=h(["zoom","extent"]),Of=h(["zoom","privileged"],!1),Pf=h(["onenter"],function(){}),Qf=h(["onleave"],function(){}),Rf=h(["onresize"],function(){}),Sf=h(["onresized"],function(){}),Tf=h(["transition","duration"],350);g("data","data is required in config");var Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag=h(["data","x"]),Bg=h(["data","xs"],{}),Cg=h(["data","x_format"]),Dg=h(["data","id_converter"],function(a){return a}),Eg=h(["data","names"],{}),Fg=h(["data","classes"],{}),Gg=h(["data","groups"],[]),Hg=h(["data","axes"],{}),Ig=h(["data","type"]),Jg=h(["data","types"],{}),Kg=h(["data","labels"],{}),Lg=h(["data","order"]),Mg=h(["data","regions"],{}),Ng=h(["data","color"]),Og=h(["data","colors"],{}),Pg=h(["data","hide"],!1),Qg=h(["data","selection","enabled"],!1),Rg=h(["data","selection","grouped"],!1),Sg=h(["data","selection","isselectable"],function(){return!0}),Tg=h(["data","selection","multiple"],!0),Ug=h(["data","onclick"],function(){}),Vg=h(["data","onenter"],function(){}),Wg=h(["data","onleave"],function(){}),Xg=h(["data","onselected"],function(){}),Yg=h(["data","onunselected"],function(){}),Zg=h(["data","ondragstart"],function(){}),$g=h(["data","ondragend"],function(){}),_g=h(["subchart","show"],!1),ah=h(["subchart","size","height"],60),bh=h(["color","pattern"],[]),ch=h(["legend","show"],!0),dh=h(["legend","position"],"bottom"),eh=h(["legend","item","onclick"]),fh=h(["legend","item","onmouseover"]),gh=h(["legend","item","onmouseout"]),hh=h(["legend","equally"],!1),ih=h(["axis","rotated"],!1),jh=h(["axis","x","show"],!0),kh=h(["axis","x","type"],"indexed"),lh=h(["axis","x","localtime"],!0),mh=h(["axis","x","categories"],[]),nh=h(["axis","x","tick","centered"],!1),oh=h(["axis","x","tick","format"]),ph=h(["axis","x","tick","culling"],{}),qh=h(["axis","x","tick","culling","max"],10),rh=h(["axis","x","tick","count"]),sh=h(["axis","x","tick","fit"],!0),th=h(["axis","x","tick","values"],null),uh=h(["axis","x","tick","rotate"]),vh=h(["axis","x","max"],null),wh=h(["axis","x","min"],null),xh=h(["axis","x","padding"],{}),yh=h(["axis","x","height"]),zh=h(["axis","x","default"]),Ah=h(["axis","x","label"],{}),Bh=h(["axis","y","show"],!0),Ch=h(["axis","y","max"]),Dh=h(["axis","y","min"]),Eh=h(["axis","y","center"]),Fh=h(["axis","y","label"],{}),Gh=h(["axis","y","inner"],!1),Hh=h(["axis","y","tick","format"]),Ih=h(["axis","y","padding"]),Jh=h(["axis","y","ticks"],10),Kh=h(["axis","y2","show"],!1),Lh=h(["axis","y2","max"]),Mh=h(["axis","y2","min"]),Nh=h(["axis","y2","center"]),Oh=h(["axis","y2","label"],{}),Ph=h(["axis","y2","inner"],!1),Qh=h(["axis","y2","tick","format"]),Rh=h(["axis","y2","padding"]),Sh=h(["axis","y2","ticks"],10),Th=h(["grid","x","show"],!1),Uh=h(["grid","x","type"],"tick"),Vh=h(["grid","x","lines"],[]),Wh=h(["grid","y","show"],!1),Xh=h(["grid","y","lines"],[]),Yh=h(["grid","y","ticks"],10),Zh=h(["point","show"],!0),$h=h(["point","r"],2.5),_h=h(["point","focus","line","enabled"],!0),ai=h(["point","focus","expand","enabled"],!0),bi=h(["point","focus","expand","r"]),ci=h(["point","focus","select","r"]),di=h(["line","connect_null"],!1),ei=h(["bar","width"]),fi=h(["bar","width","ratio"],.6),gi=h(["pie","label","show"],!0),hi=h(["pie","label","format"]),ii=h(["pie","expand"],!0),ji=h(["pie","onclick"],function(){}),ki=h(["pie","onmouseover"],function(){}),li=h(["pie","onmouseout"],function(){}),mi=h(["donut","label","show"],!0),ni=h(["donut","label","format"]),oi=h(["donut","expand"],!0),pi=h(["donut","title"],""),qi=h(["donut","onclick"],function(){}),ri=h(["donut","onmouseover"],function(){}),si=h(["donut","onmouseout"],function(){}),ti=h(["regions"],[]),ui=h(["tooltip","show"],!0),vi=h(["tooltip","format","title"]),wi=h(["tooltip","format","value"]),xi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=vi?vi:b,l=wi?wi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id,a[g].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),yi=h(["tooltip","init","show"],!1),zi=h(["tooltip","init","x"],0),Ai=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Bi=("string"==typeof Hf?Hf.replace("#",""):Hf.id)+"-clip",Ci=Bi+"-xaxis",Di=Bi+"-yaxis",Ei=i(Bi),Fi=i(Ci),Gi=i(Di),Hi="timeseries"===kh,Ii="categorized"===kh,Ji=!Hi&&(Ag||Be(Bg)),Ki=null,Li=!1,Mi=!1,Ni=!1,Oi=!1,Pi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Qi=ve(Og,Be(bh)?bh:Pi,Ng),Ri=lh?Ef.time.format:Ef.time.format.utc,Si=function(){var a=[[Ri("%Y/%-m/%-d"),function(){return!0}],[Ri("%-m/%-d"),function(a){return a.getMonth()}],[Ri("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ri("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ri("%I %p"),function(a){return a.getHours()}],[Ri("%I:%M"),function(a){return a.getMinutes()}],[Ri(":%S"),function(a){return a.getSeconds()}],[Ri(".%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)}}(),Ti=[],Ui=[],Vi=ih?"left":"bottom",Wi=ih?Gh?"top":"bottom":Gh?"right":"left",Xi=ih?Ph?"bottom":"top":Ph?"left":"right",Yi=ih?"left":"bottom",Zi={main:function(){return"translate("+Uf.left+","+Uf.top+")"},context:function(){return"translate("+Vf.left+","+Vf.top+")"},legend:function(){return"translate("+Wf.left+","+Wf.top+")"},x:function(){return"translate(0,"+(ih?0:Zf)+")"},y:function(){return"translate(0,"+(ih?Zf:0)+")"},y2:function(){return"translate("+(ih?0:Xf)+","+(ih?1:0)+")"},subx:function(){return"translate(0,"+(ih?0:$f)+")"},arc:function(){return"translate("+Xf/2+","+Zf/2+")"}},$i="right"===dh,_i=0,aj=0,bj=0,cj=.15,dj=30,ej=ih&&!jh?0:30,fj=5;hg=Ef.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var gj,hj=function(){var a=Ef.svg.line().x(ih?function(a){return V(a.id)(a.value)}:Fd).y(ih?Fd:function(a){return V(a.id)(a.value)});return di||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=di?Ne(b.values):b.values;return ie(b)?(a.interpolate(je(b)?"cardinal":"linear"),Mg[b.id]?af(e,qg,V(b.id),Mg[b.id]):a(e)):(c=e[0]?qg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ih?"M "+d+" "+c:"M "+c+" "+d)}}(),ij=function(){var a;return a=ih?Ef.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Fd):Ef.svg.area().x(Fd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ne(b.values);return ce([b],"area")||ce([b],"area-spline")?(a.interpolate(je(b)?"cardinal":"linear"),a(e)):(c=e[0]?qg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ih?"M "+d+" "+c:"M "+c+" "+d)}}(),jj=function(){var a=Ef.svg.line().x(ih?function(a){return W(a.id)(a.value)}:Id).y(ih?Id:function(a){return W(a.id)(a.value)});return function(b){var c=Ne(b.values);return ie(b)?a(c):"M "+tg(c[0].x)+" "+W(b.id)(c[0].value)}}(),kj=function(){};gj=Ef.svg.brush().on("brush",kf),gj.update=function(){return oj&&oj.select("."+f.brush).call(this),this},gj.scale=function(a){return ih?this.y(a):this.x(a)},Mf&&(kj=Ef.behavior.zoom().on("zoomstart",function(){kj.altDomain=Ef.event.sourceEvent.altKey?qg.orgDomain():null}).on("zoom",Mf?lf:null),kj.scale=function(a){return ih?this.y(a):this.x(a)},kj.orgScaleExtent=function(){var a=Nf?Nf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},kj.updateScaleExtent=function(){var a=ac(qg.orgDomain())/ac(sj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var lj,mj,nj,oj,pj,qj,rj,sj,tj,uj={};if(Ff.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=lj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);Ff.revert(),Ff.defocus(),b(d.classed(f.focused,!0)),b(e),he(Ff.data.targets)&&Nb(a,!0),vf(a,!0)},Ff.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=lj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);Ff.revert(),b(d.classed(f.focused,!1)),b(e),he(Ff.data.targets)&&Ob(a),vf(a,!1)},Ff.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=lj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);b(d.classed(f.focused,!1)),b(e),he(Ff.data.targets)&&Ob(a),wf()},Ff.show=function(a,b){a=Dc(a),b=b||{},Mc(a),lj.selectAll(qd(a)).transition().style("opacity",1),b.withLegend&&xf(a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ff.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),lj.selectAll(qd(a)).transition().style("opacity",0),b.withLegend&&yf(a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ff.toggle=function(a){Gc(a)?Ff.hide(a):Ff.show(a)},Ff.unzoom=function(){gj.clear().update(),jf({withUpdateXDomain:!0})},Ff.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Fg[b]=a.classes[b]}),"categories"in a&&Ii&&(mh=a.categories,wg.categories(mh)),"cacheIds"in a&&bc(a.cacheIds)?void qf(dc(a.cacheIds),a.done):void("unload"in a?sf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){rf(a)}):rf(a))},Ff.unload=function(a,b){sf(Dc(a),function(){jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Ff.selected=function(a){return Ef.merge(nj.selectAll("."+f.shapes+od(a)).selectAll("."+f.shape).filter(function(){return Ef.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Ff.select=function(a,b,c){Qg&&nj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=Ef.select(this),i=e.data?e.data.id:e.id,j=Me(this),k=Rg||!a||a.indexOf(i)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Sg(e)&&!m&&j(!0,h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(!1,h.classed(f.SELECTED,!1),e,g)})},Ff.unselect=function(a,b){Qg&&nj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=Ef.select(this),g=c.data?c.data.id:c.id,h=Me(this),i=Rg||!a||a.indexOf(g)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(f.SELECTED);i&&j&&Sg(c)&&k&&h(!1,e.classed(f.SELECTED,!1),c,d) +}qj.html(xi(Ff.data.targets.map(function(a){return pc(a.values[zi])}),$(),zd(he(Ff.data.targets)),Qi)),qj.style("top",Ai.top).style("left",Ai.left).style("display","block")}null==a.onresize&&(a.onresize=mf()),a.onresize.add&&(a.onresize.add(Rf),a.onresize.add(function(){of({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})}),a.onresize.add(Sf))}function cf(a){a.append("rect").attr("class",id).style("cursor",Qg&&Rg?"pointer":null).on("mouseover",function(a,b){if(!Li&&!he(Ff.data.targets)){var c,d,e=Ff.data.targets.map(function(a){return pc(a.values[b])});if(Object.keys(Eg).length>0){d=[];for(var g in Eg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Od(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ke,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 gf(a){he(Ff.data.targets)||Qg&&(Ki=a,nj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Li=!0,Zg())}function hf(){he(Ff.data.targets)||Qg&&(nj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),nj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Li=!1,$g())}function jf(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z=Yd(),$=he(Ff.data.targets),_=Ic(Ff.data.targets);if(a=d(a)?a:{},E=d(a.withY)?a.withY:!0,F=d(a.withSubchart)?a.withSubchart:!0,G=d(a.withTransition)?a.withTransition:!0,J=d(a.withTransform)?a.withTransform:!1,K=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,M=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,N=d(a.withLegend)?a.withLegend:!1,H=d(a.withTransitionForExit)?a.withTransitionForExit:G,I=d(a.withTransitionForAxis)?a.withTransitionForAxis:G,T=G?Tf:0,U=H?T:0,V=I?T:0,c=nj.select("."+f.axisX).style("opacity",$?0:1),g=nj.select("."+f.axisY).style("opacity",$?0:1),h=nj.select("."+f.axisY2).style("opacity",$?0:1),e=oj.select("."+f.axisX).style("opacity",$?0:1),S={axisX:c.transition().duration(V),axisY:g.transition().duration(V),axisY2:h.transition().duration(V),axisSubX:e.transition().duration(V)},N&&ch&&zf(Cc(Ff.data.targets),a,S),Ii&&(0!==_.length&&M&&K||qg.domain([0,c.selectAll(".tick").size()])),_.length&&(M&&(qg.domain(Ef.extent(_b(_))),sj=qg.domain(),Mf&&kj.scale(qg).updateScaleExtent(),tg.domain(qg.domain()),gj.scale(tg)),K&&(qg.domain(gj.empty()?sj:gj.extent()),Mf&&kj.scale(qg).updateScaleExtent()),th||!sh&&!rh||(W=Kc(Jc(_),rh),wg.tickValues(W),zg.tickValues(W))),rg.domain(Xb(_,"y")),sg.domain(Xb(_,"y2")),S.axisX.call(wg),S.axisY.call(xg),S.axisY2.call(yg),S.axisSubX.call(zg),K&&_.length)if(ph&&W){for(X=1;X=0&&Ef.select(this).style("display",b%Y?"none":"block")})}else lj.selectAll("."+f.axisX+" .tick text").style("display","block");if(!ih&&uh&&eb(c,S.axisX,uh),O=Xe(Z),Q=Ye(Z,!0),R=Ye(Z,!1),Db(),ug.domain(rg.domain()),vg.domain(sg.domain()),qj.style("display","none"),o(),nj.select("line."+f.xgridFocus).style("visibility","hidden"),Th){if("year"===Uh){j=[];for(var ab=_b(),bb=ab[0].getFullYear(),cb=ab[1].getFullYear(),db=bb;cb>=db;db++)j.push(new Date(db+"-01-01 00:00:00"))}else j=qg.ticks(10);i=nj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",ih?0:function(a){return qg(a)-wg.tickOffset()}).attr("x2",ih?Xf:function(a){return qg(a)-wg.tickOffset()}).attr("y1",ih?function(a){return qg(a)-wg.tickOffset()}:Uf.top).attr("y2",ih?function(a){return qg(a)-wg.tickOffset()}:Zf).style("opacity",function(){return+Ef.select(this).attr(ih?"y1":"x1")===(ih?Zf:0)?0:1}),i.exit().remove()}Be(Vh)&&(k=nj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Vh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",ih?"":"rotate(-90)").attr("dx",ih?0:-Uf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",ih?0:Gd).attr("x2",ih?Xf:Gd).attr("y1",ih?Gd:Uf.top).attr("y2",ih?Gd:Zf).style("opacity",1),k.select("text").transition().duration(T).attr("x",ih?Xf:0).attr("y",Gd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),E&&Wh&&(m=nj.select("."+f.ygrids).selectAll("."+f.ygrid).data(rg.ticks(Yh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",ih?rg:0).attr("x2",ih?rg:Xf).attr("y1",ih?0:rg).attr("y2",ih?Zf:rg),m.exit().remove()),E&&Be(Xh)&&(n=nj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Xh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",ih?"rotate(-90)":"").attr("dx",ih?0:-Uf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(T).attr("x1",ih?Hd:0).attr("x2",ih?Hd:Xf).attr("y1",ih?0:Hd).attr("y2",ih?Zf:Hd).style("opacity",1),n.select("text").transition().duration(T).attr("x",ih?0:Xf).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(T).style("opacity",0).remove()),v=nj.select("."+f.regions).selectAll("rect."+f.region).data(ti),v.enter().append("rect").style("fill-opacity",0),v.attr("class",hd).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(T).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),v.exit().transition().duration(T).style("fill-opacity",0).remove(),t=nj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),t.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Qi),t.style("opacity",td).transition().duration(T).attr("d",O).style("fill",Qi).style("opacity",1),t.exit().transition().duration(U).style("opacity",0).remove(),q=nj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),q.enter().append("path").attr("class",Zc).style("stroke",Qi),q.style("opacity",td).transition().duration(T).attr("d",hj).style("opacity",1),q.exit().transition().duration(U).style("opacity",0).remove(),r=nj.selectAll("."+f.areas).selectAll("."+f.area).data(pe),r.enter().append("path").attr("class",fd).style("fill",Qi).style("opacity",function(){return tj=+Ef.select(this).style("opacity"),0}),r.style("opacity",0).transition().duration(T).attr("d",ij).style("opacity",tj),r.exit().transition().duration(U).style("opacity",0).remove(),s=nj.selectAll("."+f.circles).selectAll("."+f.circle).data(se),s.enter().append("circle").attr("class",_c).attr("r",Oe),s.style("opacity",td).transition().duration(T).style("opacity",vd).attr("cx",ih?Xd:Wd).attr("cy",ih?Wd:Xd),s.exit().remove(),w=nj.selectAll("."+f.texts).selectAll("."+f.text).data(te),w.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return ih?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),w.text(function(a){return Ed(a.id)(a.value)}).style("fill-opacity",ud).transition().duration(T).attr("x",Q).attr("y",R).style("fill-opacity",wd),w.exit().transition().duration(U).style("fill-opacity",0).remove(),u=nj.selectAll("."+f.arcs).selectAll("."+f.arc).data(qe),u.enter().append("path").attr("class",dd).style("fill",function(a){return Qi(a.data)}).style("cursor",function(a){return Sg(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Oi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),vf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Sd(d,Ef.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Oi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),wf(),Td(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();ef(this,a,b),e(d,b)}),u.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Oi=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Fb(a);return c?(b=Ef.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("opacity",1).call(Ee,function(){Oi=!1}),u.exit().transition().duration(U).style("opacity",0).remove(),nj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(T).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&oe(a.data)?1:0}),nj.select("."+f.chartArcsTitle).style("opacity",ge(Ff.data.targets)?1:0),_g&&(null!==Ef.event&&"zoom"===Ef.event.type&&gj.extent(qg.orgDomain()).update(),F&&(!ih&&uh&&eb(e,S.axisSubX,uh),gj.empty()||gj.extent(qg.orgDomain()).update(),P=Xe(Z,!0),y=oj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),y.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Qi),y.style("opacity",td).transition().duration(T).attr("d",P).style("opacity",1),y.exit().transition().duration(T).style("opacity",0).remove(),x=oj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),x.enter().append("path").attr("class",Zc).style("stroke",Qi),x.style("opacity",td).transition().duration(T).attr("d",jj).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove())),nj.selectAll("."+f.selectedCircles).filter(function(a){return ke(a)}).selectAll("circle").remove(),nj.selectAll("."+f.selectedCircle).transition().duration(T).attr("cx",ih?Xd:Wd).attr("cy",ih?Wd:Xd),z=nj.select("."+f.eventRects),Be(Bg)&&!oc(Bg)?(z.classed(f.eventRectsMultiple)||z.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),A=nj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),df(A.enter()),A.attr("x",0).attr("y",0).attr("width",Xf).attr("height",Zf)):(z.classed(f.eventRectsSingle)||z.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ji&&!Ii?(D=function(a,b){var c=xc(b),d=yc(b),e=Ff.data.xs[a.id][b];return(qg(d?d:e+50)-qg(c?c:e-50))/2},C=function(a,b){var c=xc(b),d=Ff.data.xs[a.id][b];return(qg(d)+qg(c?c:d-50))/2}):(D=L(),C=function(a){return qg(a.x)-D/2}),B=Ac(Ff.data.targets),nj.select("."+f.eventRects).datum(B?B.values:[]),A=nj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),cf(A.enter()),A.attr("class",id).attr("x",ih?0:C).attr("y",ih?C:0).attr("width",ih?Xf:D).attr("height",ih?D:Zf),A.exit().remove()),Cc(Ff.data.targets).forEach(function(a){uj[a]=!0})}function kf(){jf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function lf(){return"mousemove"===Ef.event.sourceEvent.type&&kj.altDomain?(qg.domain(kj.altDomain),void kj.scale(qg).updateScaleExtent()):(Ii&&qg.orgDomain()[0]===sj[0]&&qg.domain([sj[0]-1e-10,qg.orgDomain()[1]]),jf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Ef.event.sourceEvent.type&&(Mi=!0)))}function mf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function nf(){lj.attr("width",_f).attr("height",ag),lj.select("#"+Bi).select("rect").attr("width",Xf).attr("height",Zf),lj.select("#"+Ci).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),lj.select("#"+Di).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),lj.select("."+f.zoomRect).attr("width",Xf).attr("height",Zf),rj.style("max-height",ag+"px")}function of(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),nf(),m(a.withTransition),jf(a)}function pf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=nj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",kd),j=i.enter().append("g").attr("class",kd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",Qi),e=nj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",md),d=e.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",cd).style("cursor",function(a){return Sg(a)?"pointer":null}),c=nj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",ld),b=c.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",$c),b.append("g").attr("class",gd),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",ad).style("fill",Qi).style("cursor",function(a){return Sg(a)?"pointer":null}),a.forEach(function(a){nj.selectAll("."+f.selectedCircles+od(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=nj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(hg(a)).attr("class",nd),g=h.enter().append("g").attr("class",nd),g.append("g").attr("class",ed),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),_g&&(n=oj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",md),m=n.enter().append("g").style("opacity",0).attr("class",md),m.append("g").attr("class",cd),l=oj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",ld),k=l.enter().append("g").style("opacity",0).attr("class",ld),k.append("g").attr("class",$c)),lj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Tf).style("opacity",1)}function qf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?be(a.id,b.types[a.id]):be(a.id,b.type)}),Ff.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=$i?j:i,l=$i?Q():P();return d&&(w=0,C=0,t=0,u=0),ch&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=$i?u:t,void(hh?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=pj.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,$i?(g=function(a){return t*(.2+B[a])},j=function(a){return A[B[a]]+x[a]}):(g=function(a){return A[B[a]]+x[a]},j=function(a){return u*(.2+B[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=pj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof eh?eh(a):Ff.toggle(a)}).on("mouseover",function(a){Ef.select(this).classed(f.legendItemFocused,!0),Oi||Ff.focus(a),"function"==typeof fh&&fh(a)}).on("mouseout",function(a){Ef.select(this).classed(f.legendItemFocused,!1),Oi||Ff.revert(),"function"==typeof gh&&gh(a)}),o.append("text").text(function(a){return d(Eg[a])?Eg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",$i?h:-200).attr("y",$i?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",$i?i:-200).attr("y",$i?-200:l).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Qi(a)}).attr("x",$i?h:-200).attr("y",$i?-200:j).attr("width",10).attr("height",10),pj.selectAll("text").data(a).text(function(a){return d(Eg[a])?Eg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),pj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),pj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),pj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=Ef.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?tf(b):uf(b):cj}),N(t),O(u),M(C),n(),R(),nf(),m(q,c)}function Af(a){return Ec(Ff.data.targets,a.id)}function Bf(a){return"data"in a&&Ec(Ff.data.targets,a.data.id)}function Cf(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 Df(a,b,c){var d=!he(Ff.data.targets);Oi=!1,be(a,b),of(c||{withTransitionForAxis:d})}var Ef=a.d3?a.d3:a.require?a.require("d3"):void 0,Ff={data:{},axis:{},legend:{}},Gf={},Hf=h(["bindto"],"#chart"),If=h(["size","width"]),Jf=h(["size","height"]),Kf=h(["padding","left"],50),Lf=h(["padding","right"]),Mf=h(["zoom","enabled"],!1),Nf=h(["zoom","extent"]),Of=h(["zoom","privileged"],!1),Pf=h(["onenter"],function(){}),Qf=h(["onleave"],function(){}),Rf=h(["onresize"],function(){}),Sf=h(["onresized"],function(){}),Tf=h(["transition","duration"],350);g("data","data is required in config");var Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag=h(["data","x"]),Bg=h(["data","xs"],{}),Cg=h(["data","x_format"]),Dg=h(["data","id_converter"],function(a){return a}),Eg=h(["data","names"],{}),Fg=h(["data","classes"],{}),Gg=h(["data","groups"],[]),Hg=h(["data","axes"],{}),Ig=h(["data","type"]),Jg=h(["data","types"],{}),Kg=h(["data","labels"],{}),Lg=h(["data","order"]),Mg=h(["data","regions"],{}),Ng=h(["data","color"]),Og=h(["data","colors"],{}),Pg=h(["data","hide"],!1),Qg=h(["data","selection","enabled"],!1),Rg=h(["data","selection","grouped"],!1),Sg=h(["data","selection","isselectable"],function(){return!0}),Tg=h(["data","selection","multiple"],!0),Ug=h(["data","onclick"],function(){}),Vg=h(["data","onenter"],function(){}),Wg=h(["data","onleave"],function(){}),Xg=h(["data","onselected"],function(){}),Yg=h(["data","onunselected"],function(){}),Zg=h(["data","ondragstart"],function(){}),$g=h(["data","ondragend"],function(){}),_g=h(["subchart","show"],!1),ah=h(["subchart","size","height"],60),bh=h(["color","pattern"],[]),ch=h(["legend","show"],!0),dh=h(["legend","position"],"bottom"),eh=h(["legend","item","onclick"]),fh=h(["legend","item","onmouseover"]),gh=h(["legend","item","onmouseout"]),hh=h(["legend","equally"],!1),ih=h(["axis","rotated"],!1),jh=h(["axis","x","show"],!0),kh=h(["axis","x","type"],"indexed"),lh=h(["axis","x","localtime"],!0),mh=h(["axis","x","categories"],[]),nh=h(["axis","x","tick","centered"],!1),oh=h(["axis","x","tick","format"]),ph=h(["axis","x","tick","culling"],{}),qh=h(["axis","x","tick","culling","max"],10),rh=h(["axis","x","tick","count"]),sh=h(["axis","x","tick","fit"],!0),th=h(["axis","x","tick","values"],null),uh=h(["axis","x","tick","rotate"]),vh=h(["axis","x","max"],null),wh=h(["axis","x","min"],null),xh=h(["axis","x","padding"],{}),yh=h(["axis","x","height"]),zh=h(["axis","x","default"]),Ah=h(["axis","x","label"],{}),Bh=h(["axis","y","show"],!0),Ch=h(["axis","y","max"]),Dh=h(["axis","y","min"]),Eh=h(["axis","y","center"]),Fh=h(["axis","y","label"],{}),Gh=h(["axis","y","inner"],!1),Hh=h(["axis","y","tick","format"]),Ih=h(["axis","y","padding"]),Jh=h(["axis","y","ticks"],10),Kh=h(["axis","y2","show"],!1),Lh=h(["axis","y2","max"]),Mh=h(["axis","y2","min"]),Nh=h(["axis","y2","center"]),Oh=h(["axis","y2","label"],{}),Ph=h(["axis","y2","inner"],!1),Qh=h(["axis","y2","tick","format"]),Rh=h(["axis","y2","padding"]),Sh=h(["axis","y2","ticks"],10),Th=h(["grid","x","show"],!1),Uh=h(["grid","x","type"],"tick"),Vh=h(["grid","x","lines"],[]),Wh=h(["grid","y","show"],!1),Xh=h(["grid","y","lines"],[]),Yh=h(["grid","y","ticks"],10),Zh=h(["point","show"],!0),$h=h(["point","r"],2.5),_h=h(["point","focus","line","enabled"],!0),ai=h(["point","focus","expand","enabled"],!0),bi=h(["point","focus","expand","r"]),ci=h(["point","focus","select","r"]),di=h(["line","connect_null"],!1),ei=h(["bar","width"]),fi=h(["bar","width","ratio"],.6),gi=h(["pie","label","show"],!0),hi=h(["pie","label","format"]),ii=h(["pie","expand"],!0),ji=h(["pie","onclick"],function(){}),ki=h(["pie","onmouseover"],function(){}),li=h(["pie","onmouseout"],function(){}),mi=h(["donut","label","show"],!0),ni=h(["donut","label","format"]),oi=h(["donut","expand"],!0),pi=h(["donut","title"],""),qi=h(["donut","onclick"],function(){}),ri=h(["donut","onmouseover"],function(){}),si=h(["donut","onmouseout"],function(){}),ti=h(["regions"],[]),ui=h(["tooltip","show"],!0),vi=h(["tooltip","format","title"]),wi=h(["tooltip","format","value"]),xi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=vi?vi:b,l=wi?wi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id,a[g].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),yi=h(["tooltip","init","show"],!1),zi=h(["tooltip","init","x"],0),Ai=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Bi=("string"==typeof Hf?Hf.replace("#",""):Hf.id)+"-clip",Ci=Bi+"-xaxis",Di=Bi+"-yaxis",Ei=i(Bi),Fi=i(Ci),Gi=i(Di),Hi="timeseries"===kh,Ii="categorized"===kh,Ji=!Hi&&(Ag||Be(Bg)),Ki=null,Li=!1,Mi=!1,Ni=!1,Oi=!1,Pi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Qi=ve(Og,Be(bh)?bh:Pi,Ng),Ri=lh?Ef.time.format:Ef.time.format.utc,Si=function(){var a=[[Ri("%Y/%-m/%-d"),function(){return!0}],[Ri("%-m/%-d"),function(a){return a.getMonth()}],[Ri("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ri("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ri("%I %p"),function(a){return a.getHours()}],[Ri("%I:%M"),function(a){return a.getMinutes()}],[Ri(":%S"),function(a){return a.getSeconds()}],[Ri(".%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)}}(),Ti=[],Ui=[],Vi=ih?"left":"bottom",Wi=ih?Gh?"top":"bottom":Gh?"right":"left",Xi=ih?Ph?"bottom":"top":Ph?"left":"right",Yi=ih?"left":"bottom",Zi={main:function(){return"translate("+Uf.left+","+Uf.top+")"},context:function(){return"translate("+Vf.left+","+Vf.top+")"},legend:function(){return"translate("+Wf.left+","+Wf.top+")"},x:function(){return"translate(0,"+(ih?0:Zf)+")"},y:function(){return"translate(0,"+(ih?Zf:0)+")"},y2:function(){return"translate("+(ih?0:Xf)+","+(ih?1:0)+")"},subx:function(){return"translate(0,"+(ih?0:$f)+")"},arc:function(){return"translate("+Xf/2+","+Zf/2+")"}},$i="right"===dh,_i=0,aj=0,bj=0,cj=.15,dj=30,ej=ih&&!jh?0:30,fj=5;hg=Ef.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var gj,hj=function(){var a=Ef.svg.line().x(ih?function(a){return V(a.id)(a.value)}:Fd).y(ih?Fd:function(a){return V(a.id)(a.value)});return di||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=di?Ne(b.values):b.values;return ie(b)?(a.interpolate(je(b)?"cardinal":"linear"),Mg[b.id]?af(e,qg,V(b.id),Mg[b.id]):a(e)):(c=e[0]?qg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ih?"M "+d+" "+c:"M "+c+" "+d)}}(),ij=function(){var a;return a=ih?Ef.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Fd):Ef.svg.area().x(Fd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ne(b.values);return ce([b],"area")||ce([b],"area-spline")?(a.interpolate(je(b)?"cardinal":"linear"),a(e)):(c=e[0]?qg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ih?"M "+d+" "+c:"M "+c+" "+d)}}(),jj=function(){var a=Ef.svg.line().x(ih?function(a){return W(a.id)(a.value)}:Id).y(ih?Id:function(a){return W(a.id)(a.value)});return function(b){var c=Ne(b.values);return ie(b)?a(c):"M "+tg(c[0].x)+" "+W(b.id)(c[0].value)}}(),kj=function(){};gj=Ef.svg.brush().on("brush",kf),gj.update=function(){return oj&&oj.select("."+f.brush).call(this),this},gj.scale=function(a){return ih?this.y(a):this.x(a)},Mf&&(kj=Ef.behavior.zoom().on("zoomstart",function(){kj.altDomain=Ef.event.sourceEvent.altKey?qg.orgDomain():null}).on("zoom",Mf?lf:null),kj.scale=function(a){return ih?this.y(a):this.x(a)},kj.orgScaleExtent=function(){var a=Nf?Nf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},kj.updateScaleExtent=function(){var a=ac(qg.orgDomain())/ac(sj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var lj,mj,nj,oj,pj,qj,rj,sj,tj,uj={};if(Ff.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=lj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);Ff.revert(),Ff.defocus(),b(d.classed(f.focused,!0)),b(e),he(Ff.data.targets)&&Nb(a,!0),vf(a,!0)},Ff.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=lj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);Ff.revert(),b(d.classed(f.focused,!1)),b(e),he(Ff.data.targets)&&Ob(a),vf(a,!1)},Ff.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=lj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);b(d.classed(f.focused,!1)),b(e),he(Ff.data.targets)&&Ob(a),wf()},Ff.show=function(a,b){a=Dc(a),b=b||{},Mc(a),lj.selectAll(qd(a)).transition().style("opacity",1),b.withLegend&&xf(a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ff.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),lj.selectAll(qd(a)).transition().style("opacity",0),b.withLegend&&yf(a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ff.toggle=function(a){Gc(a)?Ff.hide(a):Ff.show(a)},Ff.unzoom=function(){gj.clear().update(),jf({withUpdateXDomain:!0})},Ff.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Fg[b]=a.classes[b]}),"categories"in a&&Ii&&(mh=a.categories,wg.categories(mh)),"cacheIds"in a&&bc(a.cacheIds)?void qf(dc(a.cacheIds),a.done):void("unload"in a?sf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){rf(a)}):rf(a))},Ff.unload=function(a,b){sf(Dc(a),function(){jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Ff.selected=function(a){return Ef.merge(nj.selectAll("."+f.shapes+od(a)).selectAll("."+f.shape).filter(function(){return Ef.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Ff.select=function(a,b,c){Qg&&nj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=Ef.select(this),i=e.data?e.data.id:e.id,j=Me(this),k=Rg||!a||a.indexOf(i)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Sg(e)&&!m&&j(!0,h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(!1,h.classed(f.SELECTED,!1),e,g)})},Ff.unselect=function(a,b){Qg&&nj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=Ef.select(this),g=c.data?c.data.id:c.id,h=Me(this),i=Rg||!a||a.indexOf(g)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(f.SELECTED);i&&j&&Sg(c)&&k&&h(!1,e.classed(f.SELECTED,!1),c,d) })},Ff.toLine=function(a){Df(a,"line")},Ff.toSpline=function(a){Df(a,"spline")},Ff.toBar=function(a){Df(a,"bar")},Ff.toScatter=function(a){Df(a,"scatter")},Ff.toArea=function(a){Df(a,"area")},Ff.toAreaSpline=function(a){Df(a,"area-spline")},Ff.toPie=function(a){Df(a,"pie",{withTransform:!0})},Ff.toDonut=function(a){Df(a,"donut",{withTransform:!0})},Ff.groups=function(a){return c(a)?Gg:(Gg=a,jf(),Gg)},Ff.xgrids=function(a){return a?(Vh=a,jf(),Vh):Vh},Ff.xgrids.add=function(a){return a?Ff.xgrids(Vh.concat(a)):void 0},Ff.xgrids.remove=function(a){var b=Cf(a);return Ff.xgrids(Vh.filter(b))},Ff.ygrids=function(a){return a?(Xh=a,jf(),Xh):Xh},Ff.ygrids.add=function(a){return a?Ff.ygrids(Xh.concat(a)):void 0},Ff.ygrids.remove=function(a){var b=Cf(a);return Ff.ygrids(Xh.filter(b))},Ff.regions=function(a){return c(a)?ti:(ti=a,jf(),ti)},Ff.regions.add=function(a){return c(a)?ti:(ti=ti.concat(a),jf(),ti)},Ff.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;lj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ti=ti.filter(function(b){return b.classes.indexOf(a)<0})}),ti},Ff.data.get=function(a){var b=Ff.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Ff.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},Ff.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Eg[b]=a[b]}),zf(Cc(Ff.data.targets),{withTransition:!0}),Eg):Eg},Ff.x=function(a){return arguments.length&&(qc(Ff.data.targets,a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ff.data.xs},Ff.xs=function(a){return arguments.length&&(rc(Ff.data.targets,a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ff.data.xs},Ff.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},Ff.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Ch=+a.y),b(a.y2)&&(Lh=+a.y2)):Ch=Lh=+a,jf())},Ff.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Dh=+a.y),b(a.y2)&&(Mh=+a.y2)):Dh=Mh=+a,jf())},Ff.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Ff.axis.max(a.max),"undefined"!=typeof a.min&&Ff.axis.min(a.min))},Ff.legend.show=function(a){xf(Dc(a)),jf({withLegend:!0})},Ff.legend.hide=function(a){yf(Dc(a)),jf({withLegend:!0})},Ff.resize=function(a){If=a?a.width:null,Jf=a?a.height:null,of({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Ff.destroy=function(){Ff.data.targets=void 0,Ff.data.xs={},rj.html(""),a.onresize=null},"url"in e.data)Ef.xhr(e.data.url,function(a,b){var c,d=Ef.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Ef.csv.parse(b.response),bf(c)});else if("rows"in e.data)bf(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");bf(uc(e.data.columns))}return Ff},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From c8cec6f6bf978c5ea722d683c2f947d6c1cf3371 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Fri, 2 May 2014 15:19:43 +0900 Subject: [PATCH 118/178] Add id for data.labels.format - #190 --- c3.js | 2 +- c3.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/c3.js b/c3.js index 3da8586..4ab19e7 100644 --- a/c3.js +++ b/c3.js @@ -3462,7 +3462,7 @@ .style("stroke", 'none') .style("fill-opacity", 0); mainText - .text(function (d) { return formatByAxisId(d.id)(d.value); }) + .text(function (d) { return formatByAxisId(d.id)(d.value, d.id); }) .style("fill-opacity", initialOpacityForText) .transition().duration(duration) .attr('x', xForText) diff --git a/c3.min.js b/c3.min.js index aa6b5fb..4fe0f02 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ !function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.34"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",lines:"c3-lines",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",arcs:"c3-arcs",area:"c3-area",areas:"c3-areas",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",legendItemFocused:"c3-legend-item-focused",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;cXf&&(Xf=0),0>Zf&&(Zf=0),Yf=ih?Uf.left-dj-ej:Xf,$f=ih?Zf:ag-Vf.top-Vf.bottom,0>Yf&&(Yf=0),0>$f&&($f=0),p(),$i&&he(Ff.data.targets)&&(Wf.left=Xf/2+cg)}function o(){nj.select("line."+f.xgridFocus).attr("x1",ih?0:-10).attr("x2",ih?Xf:-10).attr("y1",ih?-10:Uf.top).attr("y2",ih?-10:Zf)}function p(){cg=Zf/2,bg=.95*cg,dg=ge(Ff.data.targets)?.6*bg:0}function q(){var a=ih?f.axisX:f.axisY,b=nj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Ef.select(Hf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return If?If:x()}function s(){var a=Jf?Jf:y();return a>0?a:320}function t(){return he(Ff.data.targets)?0:Kf?Kf:ih?jh?v("x"):1:!Bh||Gh?1:v("y")}function u(){var a=1;return he(Ff.data.targets)?0:Lf?Lf:$i?P()+(Kh&&!ih?v("y2"):a):Kh?Ph||ih?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||jh?"x"===a&&yh?yh:"y"!==a||Bh?"y2"!==a||Kh?(jb(a).isInner?30:40)+("y2"===a?-10:0):fj:ch&&!$i?10:1:0}function x(){return+Ef.select(Hf).style("width").replace("px","")}function y(){return+Ef.select(Hf).style("height").replace("px","")}function z(a){return a?-5:-(Uf.left-1)}function A(a){return a?-20:-4}function B(){return z(!ih)}function C(){return A(!ih)}function D(){return z(ih)}function E(){return A(ih)}function F(a){return a?Xf+2+4:Uf.left+20}function G(a){return a?(yh?yh:0)+80:Zf+8}function H(){return F(!ih)}function I(){return G(!ih)}function J(){return F(ih)}function K(){return G(ih)}function L(){var a,b,c,d,e,f=Ac(Ff.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=qg(b.x)-qg(a.x),0===c?ih?Zf:Xf:(d=zc(),e=de(Ff.data.targets)?(d-(Ii?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function M(a){_i=a}function N(a){aj=a}function O(a){bj=a}function P(){return ch?$i?aj*(_i+1):_f:0}function Q(){return ch?$i?ag:bj*(_i+1):0}function R(){var a,b,c=!qg;ig=ih?1:0,jg=ih?Zf:Xf,kg=ih?0:Zf,lg=ih?Xf:1,mg=ig,ng=jg,og=ih?0:$f,pg=ih?Yf:1,qg=T(ig,jg,c?void 0:qg.domain(),function(){return wg.tickOffset()}),rg=U(kg,lg,c?void 0:rg.domain()),sg=U(kg,lg,c?void 0:sg.domain()),tg=T(ig,jg,sj,function(a){return a%1?0:zg.tickOffset()}),ug=U(og,pg,c?void 0:ug.domain()),vg=U(og,pg,c?void 0:vg.domain()),a=$(),b=th?th:c?void 0:wg.tickValues(),wg=X(qg,Vi,a,b),zg=X(tg,Yi,a,b),xg=Y(rg,Wi,Hh,Jh),yg=Y(sg,Xi,Qh,Sh),c||(gj.scale(tg),Mf&&kj.scale(qg)),S()}function S(){eg=Gb(),fg=Hb(),gg=Hb(.98)}function T(a,b,d,e){var f=(Hi?Ef.time.scale():Ef.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Ii){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=Ef.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?sg:rg}function W(a){return"y2"===Z(a)?vg:ug}function X(a,b,c,d){var e=(Ii?Eb():Ef.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Ii?(e.tickCentered(nh),Ae(ph)&&(ph=!1)):e.tickOffset=function(){var a=Bc(Ff.data.targets),b=qg(a[1])-qg(a[0]),c=b?b:ih?Zf:Xf;return c/zc()/2},Ii&&e.categories(mh),e}function Y(a,b,c,d){return Ef.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Hg?Hg[a]:"y"}function $(){var a=Hi?Si:Ii?Tc:function(a){return 0>a?a.toFixed(0):a};return oh&&("function"==typeof oh?a=oh:Hi&&(a=function(a){return a?Ri(oh)(a):""})),a}function _(a){var b;return"y"===a?b=Fh:"y2"===a?b=Oh:"x"===a&&(b=Ah),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Fh=b:"y2"===a?Oh=b:"x"===a&&(Ah=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",ih?"inner-top":"inner-right")}function hb(){return fb("y",ih?"inner-right":"inner-top")}function ib(){return fb("y2",ih?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Xf/2:Xf:b.isBottom?-Zf:b.isMiddle?-Zf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!ih,gb())}function rb(){return nb(ih,hb())}function sb(){return nb(ih,ib())}function tb(){return ob(!ih,gb())}function ub(){return ob(ih,hb())}function vb(){return ob(ih,ib())}function wb(){var a=gb();return ih?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":yh?yh-10:"3em"}function xb(){var a=hb();return ih?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return ih?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!ih,gb())}function Ab(){return pb(ih,hb())}function Bb(){return pb(ih,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return Ef.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){nj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),nj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),nj.select("."+f.axisY2+" ."+f.axisY2Label).transition().attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 Ef.min(Object.keys(i).map(function(a){return Ef.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(Gg.length>0)for(g=Sc(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 Ef.max(Object.keys(i).map(function(a){return Ef.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Mh:Dh,n="y2"===c?Lh:Ch,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Nh:Eh,r=xd()&&ih;return 0===l.length?"y2"===c?sg.domain():rg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=yd(o,p),j=ac(rg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),"y2"===c&&Rh&&(f=b(Rh.top)?Rh.top:e,g=b(Rh.bottom)?Rh.bottom:e),de(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return wh?Hi?we(wh):wh:Ef.min(a,function(a){return Ef.min(a.values,function(a){return a.x})})}function Zb(a){return vh?Hi?we(vh):vh:Ef.max(a,function(a){return Ef.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Ii?d=0:de(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof xh&&Be(xh)?(e=b(xh.left)?xh.left:d,f=b(xh.right)?xh.right:d):e=f="number"==typeof xh?xh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return c-d===0&&(c=Hi?new Date(.5*c.getTime()):-.5,d=Hi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Hi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Hi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?rg:sg;return b="y"===a.axis||"y2"===a.axis?ih?Zf:"start"in a?d(a.start):Zf:ih?"end"in a?qg(Hi?we(a.end):a.end):Zf:Zf,c>b?0:b-c}function ic(a){return Ag&&a===Ag||Be(Bg)&&Ce(Bg,a)}function jc(a){return!ic(a)}function kc(a){return Ag?Ag:Be(Bg)?Bg[a]:null}function lc(a,b){var c,d=b&&Be(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=Ff.data.xs[b])}),c}function mc(a,b){return a in Ff.data.xs&&Ff.data.xs[a]&&Ff.data.xs[a][b]?Ff.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){Bg[b]=a[b]})}function oc(a){return 1===Ef.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=Eg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),Ff.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=Hi?a?a instanceof Date?a:we(a):we(mc(c,d)):Ji&&!Ii?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Ff.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Ag?(d=Object.keys(Ff.data.xs),Ff.data.xs[c]=d.length>0?Ff.data.xs[d[0]]:void 0):Be(Bg)&&(Ff.data.xs[c]=lc(f,Ff.data.targets)):Ff.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Ff.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Dg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ji&&Ii&&0===c&&g&&(0===e&&(mh=[]),mh.push(g)),("undefined"==typeof a[b]||Ff.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ig&&be(Cc(c).filter(function(a){return!(a in Jg)}),Ig),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&Ff.data.targets[0].values[a-1]?Ff.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(Ff.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Hi?new Date(i):i);j.push(e)}return Hi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Ti=Ti.concat(a)}function Mc(a){Ti=Ti.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Ui=Ui.concat(a)}function Oc(a){Ui=Ui.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Jd(a,f))),(a[g].x||0===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=De(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Nd(a,b){return Ef.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Od(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 Pd(){return Lg&&"desc"===Lg.toLowerCase()}function Qd(){return Lg&&"asc"===Lg.toLowerCase()}function Rd(a){var b=Qd(),c=Pd();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 Lg&&a.sort(Lg),a}function Sd(a,c){var d,e,f,g,h,i,j,k=he(Ff.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&ui&&(qj.html(xi(a,$(),zd(k),Qi)).style("display","block"),d=qj.property("offsetWidth"),e=qj.property("offsetHeight"),k?(g=Xf/2+c[0],i=Zf/2+c[1]+20):(ih?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=qg(l[0].x)+20):(f=q(),g=f+t()+qg(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),qj.style("top",i+"px").style("left",g+"px"))}function Td(){qj.style("display","none")}function Ud(a){var c=a.filter(function(a){return a&&b(a.value)});ui&&(ee(Ff.data.targets)||he(Ff.data.targets)||nj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(ih?"y1":"x1",Fd).attr(ih?"y2":"x2",Fd))}function Vd(){nj.select("line."+f.xgridFocus).style("visibility","hidden")}function Wd(a){return a.x||0===a.x?qg(a.x):null}function Xd(a){return V(a.id)(a.value)}function Yd(){var a,b,d={},e=0;return Ic(Fc(ke)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ae(a,b){return"number"==typeof ei?ei:b?2*a.tickOffset()*fi/b:0}function be(a,b){Dc(a).forEach(function(a){uj[a]=b===Jg[a],Jg[a]=b})}function ce(a,b){var c=!1;return a.forEach(function(a){Jg[a.id]===b&&(c=!0),a.id in Jg||"line"!==b||(c=!0)}),c}function de(a){return ce(a,"bar")}function ee(a){return ce(a,"scatter")}function fe(a){return ce(a,"pie")}function ge(a){return ce(a,"donut")}function he(a){return fe(a)||ge(a)}function ie(a){var b="string"==typeof a?a:a.id;return!(b in Jg)||"line"===Jg[b]||"spline"===Jg[b]||"area"===Jg[b]||"area-spline"===Jg[b]}function je(a){var b="string"==typeof a?a:a.id;return"spline"===Jg[b]||"area-spline"===Jg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"bar"===Jg[b]}function le(a){var b="string"==typeof a?a:a.id;return"scatter"===Jg[b]}function me(a){var b="string"==typeof a?a:a.id;return"pie"===Jg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"donut"===Jg[b]}function oe(a){return me(a)||ne(a)}function pe(a){return ie(a)?[a]:[]}function qe(a){return oe(a.data)?[a]:[]}function re(a){return ke(a)?a.values:[]}function se(a){return ie(a)||le(a)?a.values:[]}function te(a){return ke(a)||ie(a)?a.values:[]}function ue(a){return ne(a)&&oi||me(a)&&ii}function ve(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function we(b){var c;try{c=Cg?Ef.time.format(Cg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Cg)}return c}function xe(a,b){var c=Ef.mouse(a),d=Ef.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ce(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function De(a,b){var c="y"===Z(a.id)?rg:sg,d=ih?1:0,e=ih?0:1;return Math.pow(qg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ee(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Fe(a,b,c){Xg(b,a.node()),nj.select("."+f.selectedCircles+od(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",ih?Xd:Wd).attr("cy",ih?Wd:Xd).attr("stroke",function(){return Qi(b)}).attr("r",1.4*Qe(b)).transition().duration(100).attr("r",Qe)}function Ge(a,b,c){Yg(b,a.node()),nj.select("."+f.selectedCircles+od(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function He(a,b,c,d){a?Fe(b,c,d):Ge(b,c,d)}function Ie(a,b){Xg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ef.rgb(Qi(b)).brighter(.75)})}function Je(a,b){Yg(b,a.node()),a.transition().duration(100).style("fill",function(){return Qi(b)})}function Ke(a,b,c,d){a?Ie(b,c,d):Je(b,c,d)}function Le(a,b,c,d){Ke(a,b,c.data,d)}function Me(a){return"circle"===a.nodeName?He:Ef.select(a).classed(f.bar)?Ke:Le}function Ne(a){return a.filter(function(a){return b(a.value)})}function Oe(a){return Zh?"function"==typeof $h?$h(a):$h:0}function Pe(a){return ai?bi?bi:1.75*Oe(a):Oe(a)}function Qe(a){return ci?ci:4*Oe(a)}function Re(a,c){return(c?nj.selectAll("."+f.circles+od(c)):nj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Se(a,b){Re(a,b).classed(f.EXPANDED,!0).attr("r",Pe)}function Te(a){Re(a).filter(function(){return Ef.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oe)}function Ue(a){return nj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ve(a){Ue(a).classed(f.EXPANDED,!0)}function We(a){Ue(a).classed(f.EXPANDED,!1)}function Xe(a,b){var c=_e(a,b);return function(a,b){var d=c(a,b),e=ih?1:0,f=ih?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 Ye(a,b){var c=_e(a,!1),d=b?Ze:$e;return function(a,b){return d(c(a,b),a,this)}}function Ze(a,b){var c;return ih?(c=ke(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function $e(a,b,c){var d=c.getBoundingClientRect();return ih?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ke(b)?-3:-6)}function _e(a,b){var c=a.__max__+1,d=ae(wg,c),e=Zd(d,c,a,!!b),f=$d(!!b),g=_d(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return ih&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function af(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 bf(b){var c,d,e;if(rj=Ef.select(Hf),rj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(rj.html("").classed("c3",!0),Ff.data.xs={},Ff.data.targets=vc(b),Pg&&Lc(Pg===!0?Cc(Ff.data.targets):Pg),n(),R(),qg.domain(Ef.extent(_b(Ff.data.targets))),rg.domain(Xb(Ff.data.targets,"y")),sg.domain(Xb(Ff.data.targets,"y2")),tg.domain(qg.domain()),ug.domain(rg.domain()),vg.domain(sg.domain()),sj=qg.domain(),gj.scale(tg),Mf&&kj.scale(qg),lj=rj.append("svg").on("mouseenter",Pf).on("mouseleave",Qf),mj=lj.append("defs"),mj.append("clipPath").attr("id",Bi).append("rect"),mj.append("clipPath").attr("id",Ci).append("rect"),mj.append("clipPath").attr("id",Di).append("rect"),nf(),nj=lj.append("g").attr("transform",Zi.main),oj=lj.append("g").attr("transform",Zi.context),pj=lj.append("g").attr("transform",Zi.legend),_g||oj.style("visibility","hidden"),ch||(pj.style("visibility","hidden"),Ui=Cc(Ff.data.targets)),qj=Ef.select(Hf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),zf(Cc(Ff.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=nj.append("g").attr("clip-path",Ei).attr("class",f.grid),Th&&d.append("g").attr("class",f.xgrids),Be(Vh)&&d.append("g").attr("class",f.xgridLines),_h&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Wh&&d.append("g").attr("class",f.ygrids),Be(Xh)&&d.append("g").attr("class",f.ygridLines),jh&&nj.append("g").attr("class",f.axisX).attr("clip-path",Fi).attr("transform",Zi.x).append("text").attr("class",f.axisXLabel).attr("transform",ih?"rotate(-90)":"").style("text-anchor",zb),Bh&&nj.append("g").attr("class",f.axisY).attr("clip-path",Gi).attr("transform",Zi.y).append("text").attr("class",f.axisYLabel).attr("transform",ih?"":"rotate(-90)").style("text-anchor",Ab),Kh&&nj.append("g").attr("class",f.axisY2).attr("transform",Zi.y2).append("text").attr("class",f.axisY2Label).attr("transform",ih?"":"rotate(-90)").style("text-anchor",Bb),nj.append("g").attr("clip-path",Ei).attr("class",f.regions),nj.append("g").attr("clip-path",Ei).attr("class",f.chart),c=nj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Mf?ih?"ns-resize":"ew-resize":null),nj.select("."+f.chart).append("g").attr("class",f.chartBars),nj.select("."+f.chart).append("g").attr("class",f.chartLines),nj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Zi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),nj.select("."+f.chart).append("g").attr("class",f.chartTexts),Mf&&nj.insert("rect",Of?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Xf).attr("height",Zf).style("opacity",0).style("cursor",ih?"ns-resize":"ew-resize").call(kj).on("dblclick.zoom",null),zh&&gj.extent("function"!=typeof zh?zh:zh(_b())),oj.append("g").attr("clip-path",Ei).attr("class",f.chart),oj.select("."+f.chart).append("g").attr("class",f.chartBars),oj.select("."+f.chart).append("g").attr("class",f.chartLines),oj.append("g").attr("clip-path",Ei).attr("class",f.brush).call(gj).selectAll("rect").attr(ih?"width":"height",ih?Yf:$f),oj.append("g").attr("class",f.axisX).attr("transform",Zi.subx).attr("clip-path",ih?"":Fi),pf(Ff.data.targets),ih?nj.select("."+f.axisX).style("opacity",0).call(wg):(nj.select("."+f.axisY).style("opacity",0).call(xg),nj.select("."+f.axisY2).style("opacity",0).call(yg)),n(),R(),nf(),m(!1),jf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),yi){if(Hi&&"string"==typeof zi){for(zi=we(zi),e=0;e0){d=[];for(var g in Eg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Od(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ke,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 gf(a){he(Ff.data.targets)||Qg&&(Ki=a,nj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Li=!0,Zg())}function hf(){he(Ff.data.targets)||Qg&&(nj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),nj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Li=!1,$g())}function jf(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z=Yd(),$=he(Ff.data.targets),_=Ic(Ff.data.targets);if(a=d(a)?a:{},E=d(a.withY)?a.withY:!0,F=d(a.withSubchart)?a.withSubchart:!0,G=d(a.withTransition)?a.withTransition:!0,J=d(a.withTransform)?a.withTransform:!1,K=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,M=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,N=d(a.withLegend)?a.withLegend:!1,H=d(a.withTransitionForExit)?a.withTransitionForExit:G,I=d(a.withTransitionForAxis)?a.withTransitionForAxis:G,T=G?Tf:0,U=H?T:0,V=I?T:0,c=nj.select("."+f.axisX).style("opacity",$?0:1),g=nj.select("."+f.axisY).style("opacity",$?0:1),h=nj.select("."+f.axisY2).style("opacity",$?0:1),e=oj.select("."+f.axisX).style("opacity",$?0:1),S={axisX:c.transition().duration(V),axisY:g.transition().duration(V),axisY2:h.transition().duration(V),axisSubX:e.transition().duration(V)},N&&ch&&zf(Cc(Ff.data.targets),a,S),Ii&&(0!==_.length&&M&&K||qg.domain([0,c.selectAll(".tick").size()])),_.length&&(M&&(qg.domain(Ef.extent(_b(_))),sj=qg.domain(),Mf&&kj.scale(qg).updateScaleExtent(),tg.domain(qg.domain()),gj.scale(tg)),K&&(qg.domain(gj.empty()?sj:gj.extent()),Mf&&kj.scale(qg).updateScaleExtent()),th||!sh&&!rh||(W=Kc(Jc(_),rh),wg.tickValues(W),zg.tickValues(W))),rg.domain(Xb(_,"y")),sg.domain(Xb(_,"y2")),S.axisX.call(wg),S.axisY.call(xg),S.axisY2.call(yg),S.axisSubX.call(zg),K&&_.length)if(ph&&W){for(X=1;X=0&&Ef.select(this).style("display",b%Y?"none":"block")})}else lj.selectAll("."+f.axisX+" .tick text").style("display","block");if(!ih&&uh&&eb(c,S.axisX,uh),O=Xe(Z),Q=Ye(Z,!0),R=Ye(Z,!1),Db(),ug.domain(rg.domain()),vg.domain(sg.domain()),qj.style("display","none"),o(),nj.select("line."+f.xgridFocus).style("visibility","hidden"),Th){if("year"===Uh){j=[];for(var ab=_b(),bb=ab[0].getFullYear(),cb=ab[1].getFullYear(),db=bb;cb>=db;db++)j.push(new Date(db+"-01-01 00:00:00"))}else j=qg.ticks(10);i=nj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",ih?0:function(a){return qg(a)-wg.tickOffset()}).attr("x2",ih?Xf:function(a){return qg(a)-wg.tickOffset()}).attr("y1",ih?function(a){return qg(a)-wg.tickOffset()}:Uf.top).attr("y2",ih?function(a){return qg(a)-wg.tickOffset()}:Zf).style("opacity",function(){return+Ef.select(this).attr(ih?"y1":"x1")===(ih?Zf:0)?0:1}),i.exit().remove()}Be(Vh)&&(k=nj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Vh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",ih?"":"rotate(-90)").attr("dx",ih?0:-Uf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",ih?0:Gd).attr("x2",ih?Xf:Gd).attr("y1",ih?Gd:Uf.top).attr("y2",ih?Gd:Zf).style("opacity",1),k.select("text").transition().duration(T).attr("x",ih?Xf:0).attr("y",Gd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),E&&Wh&&(m=nj.select("."+f.ygrids).selectAll("."+f.ygrid).data(rg.ticks(Yh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",ih?rg:0).attr("x2",ih?rg:Xf).attr("y1",ih?0:rg).attr("y2",ih?Zf:rg),m.exit().remove()),E&&Be(Xh)&&(n=nj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Xh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",ih?"rotate(-90)":"").attr("dx",ih?0:-Uf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(T).attr("x1",ih?Hd:0).attr("x2",ih?Hd:Xf).attr("y1",ih?0:Hd).attr("y2",ih?Zf:Hd).style("opacity",1),n.select("text").transition().duration(T).attr("x",ih?0:Xf).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(T).style("opacity",0).remove()),v=nj.select("."+f.regions).selectAll("rect."+f.region).data(ti),v.enter().append("rect").style("fill-opacity",0),v.attr("class",hd).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(T).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),v.exit().transition().duration(T).style("fill-opacity",0).remove(),t=nj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),t.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Qi),t.style("opacity",td).transition().duration(T).attr("d",O).style("fill",Qi).style("opacity",1),t.exit().transition().duration(U).style("opacity",0).remove(),q=nj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),q.enter().append("path").attr("class",Zc).style("stroke",Qi),q.style("opacity",td).transition().duration(T).attr("d",hj).style("opacity",1),q.exit().transition().duration(U).style("opacity",0).remove(),r=nj.selectAll("."+f.areas).selectAll("."+f.area).data(pe),r.enter().append("path").attr("class",fd).style("fill",Qi).style("opacity",function(){return tj=+Ef.select(this).style("opacity"),0}),r.style("opacity",0).transition().duration(T).attr("d",ij).style("opacity",tj),r.exit().transition().duration(U).style("opacity",0).remove(),s=nj.selectAll("."+f.circles).selectAll("."+f.circle).data(se),s.enter().append("circle").attr("class",_c).attr("r",Oe),s.style("opacity",td).transition().duration(T).style("opacity",vd).attr("cx",ih?Xd:Wd).attr("cy",ih?Wd:Xd),s.exit().remove(),w=nj.selectAll("."+f.texts).selectAll("."+f.text).data(te),w.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return ih?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),w.text(function(a){return Ed(a.id)(a.value)}).style("fill-opacity",ud).transition().duration(T).attr("x",Q).attr("y",R).style("fill-opacity",wd),w.exit().transition().duration(U).style("fill-opacity",0).remove(),u=nj.selectAll("."+f.arcs).selectAll("."+f.arc).data(qe),u.enter().append("path").attr("class",dd).style("fill",function(a){return Qi(a.data)}).style("cursor",function(a){return Sg(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Oi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),vf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Sd(d,Ef.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Oi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),wf(),Td(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();ef(this,a,b),e(d,b)}),u.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Oi=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Fb(a);return c?(b=Ef.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("opacity",1).call(Ee,function(){Oi=!1}),u.exit().transition().duration(U).style("opacity",0).remove(),nj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(T).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&oe(a.data)?1:0}),nj.select("."+f.chartArcsTitle).style("opacity",ge(Ff.data.targets)?1:0),_g&&(null!==Ef.event&&"zoom"===Ef.event.type&&gj.extent(qg.orgDomain()).update(),F&&(!ih&&uh&&eb(e,S.axisSubX,uh),gj.empty()||gj.extent(qg.orgDomain()).update(),P=Xe(Z,!0),y=oj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),y.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Qi),y.style("opacity",td).transition().duration(T).attr("d",P).style("opacity",1),y.exit().transition().duration(T).style("opacity",0).remove(),x=oj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),x.enter().append("path").attr("class",Zc).style("stroke",Qi),x.style("opacity",td).transition().duration(T).attr("d",jj).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove())),nj.selectAll("."+f.selectedCircles).filter(function(a){return ke(a)}).selectAll("circle").remove(),nj.selectAll("."+f.selectedCircle).transition().duration(T).attr("cx",ih?Xd:Wd).attr("cy",ih?Wd:Xd),z=nj.select("."+f.eventRects),Be(Bg)&&!oc(Bg)?(z.classed(f.eventRectsMultiple)||z.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),A=nj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),df(A.enter()),A.attr("x",0).attr("y",0).attr("width",Xf).attr("height",Zf)):(z.classed(f.eventRectsSingle)||z.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ji&&!Ii?(D=function(a,b){var c=xc(b),d=yc(b),e=Ff.data.xs[a.id][b];return(qg(d?d:e+50)-qg(c?c:e-50))/2},C=function(a,b){var c=xc(b),d=Ff.data.xs[a.id][b];return(qg(d)+qg(c?c:d-50))/2}):(D=L(),C=function(a){return qg(a.x)-D/2}),B=Ac(Ff.data.targets),nj.select("."+f.eventRects).datum(B?B.values:[]),A=nj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),cf(A.enter()),A.attr("class",id).attr("x",ih?0:C).attr("y",ih?C:0).attr("width",ih?Xf:D).attr("height",ih?D:Zf),A.exit().remove()),Cc(Ff.data.targets).forEach(function(a){uj[a]=!0})}function kf(){jf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function lf(){return"mousemove"===Ef.event.sourceEvent.type&&kj.altDomain?(qg.domain(kj.altDomain),void kj.scale(qg).updateScaleExtent()):(Ii&&qg.orgDomain()[0]===sj[0]&&qg.domain([sj[0]-1e-10,qg.orgDomain()[1]]),jf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Ef.event.sourceEvent.type&&(Mi=!0)))}function mf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function nf(){lj.attr("width",_f).attr("height",ag),lj.select("#"+Bi).select("rect").attr("width",Xf).attr("height",Zf),lj.select("#"+Ci).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),lj.select("#"+Di).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),lj.select("."+f.zoomRect).attr("width",Xf).attr("height",Zf),rj.style("max-height",ag+"px")}function of(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),nf(),m(a.withTransition),jf(a)}function pf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=nj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",kd),j=i.enter().append("g").attr("class",kd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",Qi),e=nj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",md),d=e.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",cd).style("cursor",function(a){return Sg(a)?"pointer":null}),c=nj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",ld),b=c.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",$c),b.append("g").attr("class",gd),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",ad).style("fill",Qi).style("cursor",function(a){return Sg(a)?"pointer":null}),a.forEach(function(a){nj.selectAll("."+f.selectedCircles+od(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=nj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(hg(a)).attr("class",nd),g=h.enter().append("g").attr("class",nd),g.append("g").attr("class",ed),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),_g&&(n=oj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",md),m=n.enter().append("g").style("opacity",0).attr("class",md),m.append("g").attr("class",cd),l=oj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",ld),k=l.enter().append("g").style("opacity",0).attr("class",ld),k.append("g").attr("class",$c)),lj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Tf).style("opacity",1)}function qf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?be(a.id,b.types[a.id]):be(a.id,b.type)}),Ff.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=$i?j:i,l=$i?Q():P();return d&&(w=0,C=0,t=0,u=0),ch&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=$i?u:t,void(hh?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=pj.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,$i?(g=function(a){return t*(.2+B[a])},j=function(a){return A[B[a]]+x[a]}):(g=function(a){return A[B[a]]+x[a]},j=function(a){return u*(.2+B[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=pj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof eh?eh(a):Ff.toggle(a)}).on("mouseover",function(a){Ef.select(this).classed(f.legendItemFocused,!0),Oi||Ff.focus(a),"function"==typeof fh&&fh(a)}).on("mouseout",function(a){Ef.select(this).classed(f.legendItemFocused,!1),Oi||Ff.revert(),"function"==typeof gh&&gh(a)}),o.append("text").text(function(a){return d(Eg[a])?Eg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",$i?h:-200).attr("y",$i?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",$i?i:-200).attr("y",$i?-200:l).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Qi(a)}).attr("x",$i?h:-200).attr("y",$i?-200:j).attr("width",10).attr("height",10),pj.selectAll("text").data(a).text(function(a){return d(Eg[a])?Eg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),pj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),pj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),pj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=Ef.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?tf(b):uf(b):cj}),N(t),O(u),M(C),n(),R(),nf(),m(q,c)}function Af(a){return Ec(Ff.data.targets,a.id)}function Bf(a){return"data"in a&&Ec(Ff.data.targets,a.data.id)}function Cf(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 Df(a,b,c){var d=!he(Ff.data.targets);Oi=!1,be(a,b),of(c||{withTransitionForAxis:d})}var Ef=a.d3?a.d3:a.require?a.require("d3"):void 0,Ff={data:{},axis:{},legend:{}},Gf={},Hf=h(["bindto"],"#chart"),If=h(["size","width"]),Jf=h(["size","height"]),Kf=h(["padding","left"],50),Lf=h(["padding","right"]),Mf=h(["zoom","enabled"],!1),Nf=h(["zoom","extent"]),Of=h(["zoom","privileged"],!1),Pf=h(["onenter"],function(){}),Qf=h(["onleave"],function(){}),Rf=h(["onresize"],function(){}),Sf=h(["onresized"],function(){}),Tf=h(["transition","duration"],350);g("data","data is required in config");var Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag=h(["data","x"]),Bg=h(["data","xs"],{}),Cg=h(["data","x_format"]),Dg=h(["data","id_converter"],function(a){return a}),Eg=h(["data","names"],{}),Fg=h(["data","classes"],{}),Gg=h(["data","groups"],[]),Hg=h(["data","axes"],{}),Ig=h(["data","type"]),Jg=h(["data","types"],{}),Kg=h(["data","labels"],{}),Lg=h(["data","order"]),Mg=h(["data","regions"],{}),Ng=h(["data","color"]),Og=h(["data","colors"],{}),Pg=h(["data","hide"],!1),Qg=h(["data","selection","enabled"],!1),Rg=h(["data","selection","grouped"],!1),Sg=h(["data","selection","isselectable"],function(){return!0}),Tg=h(["data","selection","multiple"],!0),Ug=h(["data","onclick"],function(){}),Vg=h(["data","onenter"],function(){}),Wg=h(["data","onleave"],function(){}),Xg=h(["data","onselected"],function(){}),Yg=h(["data","onunselected"],function(){}),Zg=h(["data","ondragstart"],function(){}),$g=h(["data","ondragend"],function(){}),_g=h(["subchart","show"],!1),ah=h(["subchart","size","height"],60),bh=h(["color","pattern"],[]),ch=h(["legend","show"],!0),dh=h(["legend","position"],"bottom"),eh=h(["legend","item","onclick"]),fh=h(["legend","item","onmouseover"]),gh=h(["legend","item","onmouseout"]),hh=h(["legend","equally"],!1),ih=h(["axis","rotated"],!1),jh=h(["axis","x","show"],!0),kh=h(["axis","x","type"],"indexed"),lh=h(["axis","x","localtime"],!0),mh=h(["axis","x","categories"],[]),nh=h(["axis","x","tick","centered"],!1),oh=h(["axis","x","tick","format"]),ph=h(["axis","x","tick","culling"],{}),qh=h(["axis","x","tick","culling","max"],10),rh=h(["axis","x","tick","count"]),sh=h(["axis","x","tick","fit"],!0),th=h(["axis","x","tick","values"],null),uh=h(["axis","x","tick","rotate"]),vh=h(["axis","x","max"],null),wh=h(["axis","x","min"],null),xh=h(["axis","x","padding"],{}),yh=h(["axis","x","height"]),zh=h(["axis","x","default"]),Ah=h(["axis","x","label"],{}),Bh=h(["axis","y","show"],!0),Ch=h(["axis","y","max"]),Dh=h(["axis","y","min"]),Eh=h(["axis","y","center"]),Fh=h(["axis","y","label"],{}),Gh=h(["axis","y","inner"],!1),Hh=h(["axis","y","tick","format"]),Ih=h(["axis","y","padding"]),Jh=h(["axis","y","ticks"],10),Kh=h(["axis","y2","show"],!1),Lh=h(["axis","y2","max"]),Mh=h(["axis","y2","min"]),Nh=h(["axis","y2","center"]),Oh=h(["axis","y2","label"],{}),Ph=h(["axis","y2","inner"],!1),Qh=h(["axis","y2","tick","format"]),Rh=h(["axis","y2","padding"]),Sh=h(["axis","y2","ticks"],10),Th=h(["grid","x","show"],!1),Uh=h(["grid","x","type"],"tick"),Vh=h(["grid","x","lines"],[]),Wh=h(["grid","y","show"],!1),Xh=h(["grid","y","lines"],[]),Yh=h(["grid","y","ticks"],10),Zh=h(["point","show"],!0),$h=h(["point","r"],2.5),_h=h(["point","focus","line","enabled"],!0),ai=h(["point","focus","expand","enabled"],!0),bi=h(["point","focus","expand","r"]),ci=h(["point","focus","select","r"]),di=h(["line","connect_null"],!1),ei=h(["bar","width"]),fi=h(["bar","width","ratio"],.6),gi=h(["pie","label","show"],!0),hi=h(["pie","label","format"]),ii=h(["pie","expand"],!0),ji=h(["pie","onclick"],function(){}),ki=h(["pie","onmouseover"],function(){}),li=h(["pie","onmouseout"],function(){}),mi=h(["donut","label","show"],!0),ni=h(["donut","label","format"]),oi=h(["donut","expand"],!0),pi=h(["donut","title"],""),qi=h(["donut","onclick"],function(){}),ri=h(["donut","onmouseover"],function(){}),si=h(["donut","onmouseout"],function(){}),ti=h(["regions"],[]),ui=h(["tooltip","show"],!0),vi=h(["tooltip","format","title"]),wi=h(["tooltip","format","value"]),xi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=vi?vi:b,l=wi?wi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id,a[g].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),yi=h(["tooltip","init","show"],!1),zi=h(["tooltip","init","x"],0),Ai=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Bi=("string"==typeof Hf?Hf.replace("#",""):Hf.id)+"-clip",Ci=Bi+"-xaxis",Di=Bi+"-yaxis",Ei=i(Bi),Fi=i(Ci),Gi=i(Di),Hi="timeseries"===kh,Ii="categorized"===kh,Ji=!Hi&&(Ag||Be(Bg)),Ki=null,Li=!1,Mi=!1,Ni=!1,Oi=!1,Pi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Qi=ve(Og,Be(bh)?bh:Pi,Ng),Ri=lh?Ef.time.format:Ef.time.format.utc,Si=function(){var a=[[Ri("%Y/%-m/%-d"),function(){return!0}],[Ri("%-m/%-d"),function(a){return a.getMonth()}],[Ri("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ri("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ri("%I %p"),function(a){return a.getHours()}],[Ri("%I:%M"),function(a){return a.getMinutes()}],[Ri(":%S"),function(a){return a.getSeconds()}],[Ri(".%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)}}(),Ti=[],Ui=[],Vi=ih?"left":"bottom",Wi=ih?Gh?"top":"bottom":Gh?"right":"left",Xi=ih?Ph?"bottom":"top":Ph?"left":"right",Yi=ih?"left":"bottom",Zi={main:function(){return"translate("+Uf.left+","+Uf.top+")"},context:function(){return"translate("+Vf.left+","+Vf.top+")"},legend:function(){return"translate("+Wf.left+","+Wf.top+")"},x:function(){return"translate(0,"+(ih?0:Zf)+")"},y:function(){return"translate(0,"+(ih?Zf:0)+")"},y2:function(){return"translate("+(ih?0:Xf)+","+(ih?1:0)+")"},subx:function(){return"translate(0,"+(ih?0:$f)+")"},arc:function(){return"translate("+Xf/2+","+Zf/2+")"}},$i="right"===dh,_i=0,aj=0,bj=0,cj=.15,dj=30,ej=ih&&!jh?0:30,fj=5;hg=Ef.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var gj,hj=function(){var a=Ef.svg.line().x(ih?function(a){return V(a.id)(a.value)}:Fd).y(ih?Fd:function(a){return V(a.id)(a.value)});return di||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=di?Ne(b.values):b.values;return ie(b)?(a.interpolate(je(b)?"cardinal":"linear"),Mg[b.id]?af(e,qg,V(b.id),Mg[b.id]):a(e)):(c=e[0]?qg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ih?"M "+d+" "+c:"M "+c+" "+d)}}(),ij=function(){var a;return a=ih?Ef.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Fd):Ef.svg.area().x(Fd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ne(b.values);return ce([b],"area")||ce([b],"area-spline")?(a.interpolate(je(b)?"cardinal":"linear"),a(e)):(c=e[0]?qg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ih?"M "+d+" "+c:"M "+c+" "+d)}}(),jj=function(){var a=Ef.svg.line().x(ih?function(a){return W(a.id)(a.value)}:Id).y(ih?Id:function(a){return W(a.id)(a.value)});return function(b){var c=Ne(b.values);return ie(b)?a(c):"M "+tg(c[0].x)+" "+W(b.id)(c[0].value)}}(),kj=function(){};gj=Ef.svg.brush().on("brush",kf),gj.update=function(){return oj&&oj.select("."+f.brush).call(this),this},gj.scale=function(a){return ih?this.y(a):this.x(a)},Mf&&(kj=Ef.behavior.zoom().on("zoomstart",function(){kj.altDomain=Ef.event.sourceEvent.altKey?qg.orgDomain():null}).on("zoom",Mf?lf:null),kj.scale=function(a){return ih?this.y(a):this.x(a)},kj.orgScaleExtent=function(){var a=Nf?Nf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},kj.updateScaleExtent=function(){var a=ac(qg.orgDomain())/ac(sj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var lj,mj,nj,oj,pj,qj,rj,sj,tj,uj={};if(Ff.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=lj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);Ff.revert(),Ff.defocus(),b(d.classed(f.focused,!0)),b(e),he(Ff.data.targets)&&Nb(a,!0),vf(a,!0)},Ff.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=lj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);Ff.revert(),b(d.classed(f.focused,!1)),b(e),he(Ff.data.targets)&&Ob(a),vf(a,!1)},Ff.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=lj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);b(d.classed(f.focused,!1)),b(e),he(Ff.data.targets)&&Ob(a),wf()},Ff.show=function(a,b){a=Dc(a),b=b||{},Mc(a),lj.selectAll(qd(a)).transition().style("opacity",1),b.withLegend&&xf(a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ff.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),lj.selectAll(qd(a)).transition().style("opacity",0),b.withLegend&&yf(a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ff.toggle=function(a){Gc(a)?Ff.hide(a):Ff.show(a)},Ff.unzoom=function(){gj.clear().update(),jf({withUpdateXDomain:!0})},Ff.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Fg[b]=a.classes[b]}),"categories"in a&&Ii&&(mh=a.categories,wg.categories(mh)),"cacheIds"in a&&bc(a.cacheIds)?void qf(dc(a.cacheIds),a.done):void("unload"in a?sf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){rf(a)}):rf(a))},Ff.unload=function(a,b){sf(Dc(a),function(){jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Ff.selected=function(a){return Ef.merge(nj.selectAll("."+f.shapes+od(a)).selectAll("."+f.shape).filter(function(){return Ef.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Ff.select=function(a,b,c){Qg&&nj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=Ef.select(this),i=e.data?e.data.id:e.id,j=Me(this),k=Rg||!a||a.indexOf(i)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Sg(e)&&!m&&j(!0,h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(!1,h.classed(f.SELECTED,!1),e,g)})},Ff.unselect=function(a,b){Qg&&nj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=Ef.select(this),g=c.data?c.data.id:c.id,h=Me(this),i=Rg||!a||a.indexOf(g)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(f.SELECTED);i&&j&&Sg(c)&&k&&h(!1,e.classed(f.SELECTED,!1),c,d) +}qj.html(xi(Ff.data.targets.map(function(a){return pc(a.values[zi])}),$(),zd(he(Ff.data.targets)),Qi)),qj.style("top",Ai.top).style("left",Ai.left).style("display","block")}null==a.onresize&&(a.onresize=mf()),a.onresize.add&&(a.onresize.add(Rf),a.onresize.add(function(){of({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})}),a.onresize.add(Sf))}function cf(a){a.append("rect").attr("class",id).style("cursor",Qg&&Rg?"pointer":null).on("mouseover",function(a,b){if(!Li&&!he(Ff.data.targets)){var c,d,e=Ff.data.targets.map(function(a){return pc(a.values[b])});if(Object.keys(Eg).length>0){d=[];for(var g in Eg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Od(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ke,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 gf(a){he(Ff.data.targets)||Qg&&(Ki=a,nj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Li=!0,Zg())}function hf(){he(Ff.data.targets)||Qg&&(nj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),nj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Li=!1,$g())}function jf(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z=Yd(),$=he(Ff.data.targets),_=Ic(Ff.data.targets);if(a=d(a)?a:{},E=d(a.withY)?a.withY:!0,F=d(a.withSubchart)?a.withSubchart:!0,G=d(a.withTransition)?a.withTransition:!0,J=d(a.withTransform)?a.withTransform:!1,K=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,M=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,N=d(a.withLegend)?a.withLegend:!1,H=d(a.withTransitionForExit)?a.withTransitionForExit:G,I=d(a.withTransitionForAxis)?a.withTransitionForAxis:G,T=G?Tf:0,U=H?T:0,V=I?T:0,c=nj.select("."+f.axisX).style("opacity",$?0:1),g=nj.select("."+f.axisY).style("opacity",$?0:1),h=nj.select("."+f.axisY2).style("opacity",$?0:1),e=oj.select("."+f.axisX).style("opacity",$?0:1),S={axisX:c.transition().duration(V),axisY:g.transition().duration(V),axisY2:h.transition().duration(V),axisSubX:e.transition().duration(V)},N&&ch&&zf(Cc(Ff.data.targets),a,S),Ii&&(0!==_.length&&M&&K||qg.domain([0,c.selectAll(".tick").size()])),_.length&&(M&&(qg.domain(Ef.extent(_b(_))),sj=qg.domain(),Mf&&kj.scale(qg).updateScaleExtent(),tg.domain(qg.domain()),gj.scale(tg)),K&&(qg.domain(gj.empty()?sj:gj.extent()),Mf&&kj.scale(qg).updateScaleExtent()),th||!sh&&!rh||(W=Kc(Jc(_),rh),wg.tickValues(W),zg.tickValues(W))),rg.domain(Xb(_,"y")),sg.domain(Xb(_,"y2")),S.axisX.call(wg),S.axisY.call(xg),S.axisY2.call(yg),S.axisSubX.call(zg),K&&_.length)if(ph&&W){for(X=1;X=0&&Ef.select(this).style("display",b%Y?"none":"block")})}else lj.selectAll("."+f.axisX+" .tick text").style("display","block");if(!ih&&uh&&eb(c,S.axisX,uh),O=Xe(Z),Q=Ye(Z,!0),R=Ye(Z,!1),Db(),ug.domain(rg.domain()),vg.domain(sg.domain()),qj.style("display","none"),o(),nj.select("line."+f.xgridFocus).style("visibility","hidden"),Th){if("year"===Uh){j=[];for(var ab=_b(),bb=ab[0].getFullYear(),cb=ab[1].getFullYear(),db=bb;cb>=db;db++)j.push(new Date(db+"-01-01 00:00:00"))}else j=qg.ticks(10);i=nj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",ih?0:function(a){return qg(a)-wg.tickOffset()}).attr("x2",ih?Xf:function(a){return qg(a)-wg.tickOffset()}).attr("y1",ih?function(a){return qg(a)-wg.tickOffset()}:Uf.top).attr("y2",ih?function(a){return qg(a)-wg.tickOffset()}:Zf).style("opacity",function(){return+Ef.select(this).attr(ih?"y1":"x1")===(ih?Zf:0)?0:1}),i.exit().remove()}Be(Vh)&&(k=nj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Vh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",ih?"":"rotate(-90)").attr("dx",ih?0:-Uf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",ih?0:Gd).attr("x2",ih?Xf:Gd).attr("y1",ih?Gd:Uf.top).attr("y2",ih?Gd:Zf).style("opacity",1),k.select("text").transition().duration(T).attr("x",ih?Xf:0).attr("y",Gd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),E&&Wh&&(m=nj.select("."+f.ygrids).selectAll("."+f.ygrid).data(rg.ticks(Yh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",ih?rg:0).attr("x2",ih?rg:Xf).attr("y1",ih?0:rg).attr("y2",ih?Zf:rg),m.exit().remove()),E&&Be(Xh)&&(n=nj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Xh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",ih?"rotate(-90)":"").attr("dx",ih?0:-Uf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(T).attr("x1",ih?Hd:0).attr("x2",ih?Hd:Xf).attr("y1",ih?0:Hd).attr("y2",ih?Zf:Hd).style("opacity",1),n.select("text").transition().duration(T).attr("x",ih?0:Xf).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(T).style("opacity",0).remove()),v=nj.select("."+f.regions).selectAll("rect."+f.region).data(ti),v.enter().append("rect").style("fill-opacity",0),v.attr("class",hd).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(T).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),v.exit().transition().duration(T).style("fill-opacity",0).remove(),t=nj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),t.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Qi),t.style("opacity",td).transition().duration(T).attr("d",O).style("fill",Qi).style("opacity",1),t.exit().transition().duration(U).style("opacity",0).remove(),q=nj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),q.enter().append("path").attr("class",Zc).style("stroke",Qi),q.style("opacity",td).transition().duration(T).attr("d",hj).style("opacity",1),q.exit().transition().duration(U).style("opacity",0).remove(),r=nj.selectAll("."+f.areas).selectAll("."+f.area).data(pe),r.enter().append("path").attr("class",fd).style("fill",Qi).style("opacity",function(){return tj=+Ef.select(this).style("opacity"),0}),r.style("opacity",0).transition().duration(T).attr("d",ij).style("opacity",tj),r.exit().transition().duration(U).style("opacity",0).remove(),s=nj.selectAll("."+f.circles).selectAll("."+f.circle).data(se),s.enter().append("circle").attr("class",_c).attr("r",Oe),s.style("opacity",td).transition().duration(T).style("opacity",vd).attr("cx",ih?Xd:Wd).attr("cy",ih?Wd:Xd),s.exit().remove(),w=nj.selectAll("."+f.texts).selectAll("."+f.text).data(te),w.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return ih?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),w.text(function(a){return Ed(a.id)(a.value,a.id)}).style("fill-opacity",ud).transition().duration(T).attr("x",Q).attr("y",R).style("fill-opacity",wd),w.exit().transition().duration(U).style("fill-opacity",0).remove(),u=nj.selectAll("."+f.arcs).selectAll("."+f.arc).data(qe),u.enter().append("path").attr("class",dd).style("fill",function(a){return Qi(a.data)}).style("cursor",function(a){return Sg(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Oi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),vf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Sd(d,Ef.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Oi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),wf(),Td(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();ef(this,a,b),e(d,b)}),u.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Oi=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Fb(a);return c?(b=Ef.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("opacity",1).call(Ee,function(){Oi=!1}),u.exit().transition().duration(U).style("opacity",0).remove(),nj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(T).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&oe(a.data)?1:0}),nj.select("."+f.chartArcsTitle).style("opacity",ge(Ff.data.targets)?1:0),_g&&(null!==Ef.event&&"zoom"===Ef.event.type&&gj.extent(qg.orgDomain()).update(),F&&(!ih&&uh&&eb(e,S.axisSubX,uh),gj.empty()||gj.extent(qg.orgDomain()).update(),P=Xe(Z,!0),y=oj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),y.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Qi),y.style("opacity",td).transition().duration(T).attr("d",P).style("opacity",1),y.exit().transition().duration(T).style("opacity",0).remove(),x=oj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),x.enter().append("path").attr("class",Zc).style("stroke",Qi),x.style("opacity",td).transition().duration(T).attr("d",jj).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove())),nj.selectAll("."+f.selectedCircles).filter(function(a){return ke(a)}).selectAll("circle").remove(),nj.selectAll("."+f.selectedCircle).transition().duration(T).attr("cx",ih?Xd:Wd).attr("cy",ih?Wd:Xd),z=nj.select("."+f.eventRects),Be(Bg)&&!oc(Bg)?(z.classed(f.eventRectsMultiple)||z.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),A=nj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),df(A.enter()),A.attr("x",0).attr("y",0).attr("width",Xf).attr("height",Zf)):(z.classed(f.eventRectsSingle)||z.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ji&&!Ii?(D=function(a,b){var c=xc(b),d=yc(b),e=Ff.data.xs[a.id][b];return(qg(d?d:e+50)-qg(c?c:e-50))/2},C=function(a,b){var c=xc(b),d=Ff.data.xs[a.id][b];return(qg(d)+qg(c?c:d-50))/2}):(D=L(),C=function(a){return qg(a.x)-D/2}),B=Ac(Ff.data.targets),nj.select("."+f.eventRects).datum(B?B.values:[]),A=nj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),cf(A.enter()),A.attr("class",id).attr("x",ih?0:C).attr("y",ih?C:0).attr("width",ih?Xf:D).attr("height",ih?D:Zf),A.exit().remove()),Cc(Ff.data.targets).forEach(function(a){uj[a]=!0})}function kf(){jf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function lf(){return"mousemove"===Ef.event.sourceEvent.type&&kj.altDomain?(qg.domain(kj.altDomain),void kj.scale(qg).updateScaleExtent()):(Ii&&qg.orgDomain()[0]===sj[0]&&qg.domain([sj[0]-1e-10,qg.orgDomain()[1]]),jf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Ef.event.sourceEvent.type&&(Mi=!0)))}function mf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function nf(){lj.attr("width",_f).attr("height",ag),lj.select("#"+Bi).select("rect").attr("width",Xf).attr("height",Zf),lj.select("#"+Ci).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),lj.select("#"+Di).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),lj.select("."+f.zoomRect).attr("width",Xf).attr("height",Zf),rj.style("max-height",ag+"px")}function of(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),nf(),m(a.withTransition),jf(a)}function pf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=nj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",kd),j=i.enter().append("g").attr("class",kd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",Qi),e=nj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",md),d=e.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",cd).style("cursor",function(a){return Sg(a)?"pointer":null}),c=nj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",ld),b=c.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",$c),b.append("g").attr("class",gd),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",ad).style("fill",Qi).style("cursor",function(a){return Sg(a)?"pointer":null}),a.forEach(function(a){nj.selectAll("."+f.selectedCircles+od(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=nj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(hg(a)).attr("class",nd),g=h.enter().append("g").attr("class",nd),g.append("g").attr("class",ed),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),_g&&(n=oj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",md),m=n.enter().append("g").style("opacity",0).attr("class",md),m.append("g").attr("class",cd),l=oj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",ld),k=l.enter().append("g").style("opacity",0).attr("class",ld),k.append("g").attr("class",$c)),lj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Tf).style("opacity",1)}function qf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?be(a.id,b.types[a.id]):be(a.id,b.type)}),Ff.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=$i?j:i,l=$i?Q():P();return d&&(w=0,C=0,t=0,u=0),ch&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=$i?u:t,void(hh?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=pj.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,$i?(g=function(a){return t*(.2+B[a])},j=function(a){return A[B[a]]+x[a]}):(g=function(a){return A[B[a]]+x[a]},j=function(a){return u*(.2+B[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=pj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof eh?eh(a):Ff.toggle(a)}).on("mouseover",function(a){Ef.select(this).classed(f.legendItemFocused,!0),Oi||Ff.focus(a),"function"==typeof fh&&fh(a)}).on("mouseout",function(a){Ef.select(this).classed(f.legendItemFocused,!1),Oi||Ff.revert(),"function"==typeof gh&&gh(a)}),o.append("text").text(function(a){return d(Eg[a])?Eg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",$i?h:-200).attr("y",$i?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",$i?i:-200).attr("y",$i?-200:l).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Qi(a)}).attr("x",$i?h:-200).attr("y",$i?-200:j).attr("width",10).attr("height",10),pj.selectAll("text").data(a).text(function(a){return d(Eg[a])?Eg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),pj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),pj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),pj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=Ef.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?tf(b):uf(b):cj}),N(t),O(u),M(C),n(),R(),nf(),m(q,c)}function Af(a){return Ec(Ff.data.targets,a.id)}function Bf(a){return"data"in a&&Ec(Ff.data.targets,a.data.id)}function Cf(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 Df(a,b,c){var d=!he(Ff.data.targets);Oi=!1,be(a,b),of(c||{withTransitionForAxis:d})}var Ef=a.d3?a.d3:a.require?a.require("d3"):void 0,Ff={data:{},axis:{},legend:{}},Gf={},Hf=h(["bindto"],"#chart"),If=h(["size","width"]),Jf=h(["size","height"]),Kf=h(["padding","left"],50),Lf=h(["padding","right"]),Mf=h(["zoom","enabled"],!1),Nf=h(["zoom","extent"]),Of=h(["zoom","privileged"],!1),Pf=h(["onenter"],function(){}),Qf=h(["onleave"],function(){}),Rf=h(["onresize"],function(){}),Sf=h(["onresized"],function(){}),Tf=h(["transition","duration"],350);g("data","data is required in config");var Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag=h(["data","x"]),Bg=h(["data","xs"],{}),Cg=h(["data","x_format"]),Dg=h(["data","id_converter"],function(a){return a}),Eg=h(["data","names"],{}),Fg=h(["data","classes"],{}),Gg=h(["data","groups"],[]),Hg=h(["data","axes"],{}),Ig=h(["data","type"]),Jg=h(["data","types"],{}),Kg=h(["data","labels"],{}),Lg=h(["data","order"]),Mg=h(["data","regions"],{}),Ng=h(["data","color"]),Og=h(["data","colors"],{}),Pg=h(["data","hide"],!1),Qg=h(["data","selection","enabled"],!1),Rg=h(["data","selection","grouped"],!1),Sg=h(["data","selection","isselectable"],function(){return!0}),Tg=h(["data","selection","multiple"],!0),Ug=h(["data","onclick"],function(){}),Vg=h(["data","onenter"],function(){}),Wg=h(["data","onleave"],function(){}),Xg=h(["data","onselected"],function(){}),Yg=h(["data","onunselected"],function(){}),Zg=h(["data","ondragstart"],function(){}),$g=h(["data","ondragend"],function(){}),_g=h(["subchart","show"],!1),ah=h(["subchart","size","height"],60),bh=h(["color","pattern"],[]),ch=h(["legend","show"],!0),dh=h(["legend","position"],"bottom"),eh=h(["legend","item","onclick"]),fh=h(["legend","item","onmouseover"]),gh=h(["legend","item","onmouseout"]),hh=h(["legend","equally"],!1),ih=h(["axis","rotated"],!1),jh=h(["axis","x","show"],!0),kh=h(["axis","x","type"],"indexed"),lh=h(["axis","x","localtime"],!0),mh=h(["axis","x","categories"],[]),nh=h(["axis","x","tick","centered"],!1),oh=h(["axis","x","tick","format"]),ph=h(["axis","x","tick","culling"],{}),qh=h(["axis","x","tick","culling","max"],10),rh=h(["axis","x","tick","count"]),sh=h(["axis","x","tick","fit"],!0),th=h(["axis","x","tick","values"],null),uh=h(["axis","x","tick","rotate"]),vh=h(["axis","x","max"],null),wh=h(["axis","x","min"],null),xh=h(["axis","x","padding"],{}),yh=h(["axis","x","height"]),zh=h(["axis","x","default"]),Ah=h(["axis","x","label"],{}),Bh=h(["axis","y","show"],!0),Ch=h(["axis","y","max"]),Dh=h(["axis","y","min"]),Eh=h(["axis","y","center"]),Fh=h(["axis","y","label"],{}),Gh=h(["axis","y","inner"],!1),Hh=h(["axis","y","tick","format"]),Ih=h(["axis","y","padding"]),Jh=h(["axis","y","ticks"],10),Kh=h(["axis","y2","show"],!1),Lh=h(["axis","y2","max"]),Mh=h(["axis","y2","min"]),Nh=h(["axis","y2","center"]),Oh=h(["axis","y2","label"],{}),Ph=h(["axis","y2","inner"],!1),Qh=h(["axis","y2","tick","format"]),Rh=h(["axis","y2","padding"]),Sh=h(["axis","y2","ticks"],10),Th=h(["grid","x","show"],!1),Uh=h(["grid","x","type"],"tick"),Vh=h(["grid","x","lines"],[]),Wh=h(["grid","y","show"],!1),Xh=h(["grid","y","lines"],[]),Yh=h(["grid","y","ticks"],10),Zh=h(["point","show"],!0),$h=h(["point","r"],2.5),_h=h(["point","focus","line","enabled"],!0),ai=h(["point","focus","expand","enabled"],!0),bi=h(["point","focus","expand","r"]),ci=h(["point","focus","select","r"]),di=h(["line","connect_null"],!1),ei=h(["bar","width"]),fi=h(["bar","width","ratio"],.6),gi=h(["pie","label","show"],!0),hi=h(["pie","label","format"]),ii=h(["pie","expand"],!0),ji=h(["pie","onclick"],function(){}),ki=h(["pie","onmouseover"],function(){}),li=h(["pie","onmouseout"],function(){}),mi=h(["donut","label","show"],!0),ni=h(["donut","label","format"]),oi=h(["donut","expand"],!0),pi=h(["donut","title"],""),qi=h(["donut","onclick"],function(){}),ri=h(["donut","onmouseover"],function(){}),si=h(["donut","onmouseout"],function(){}),ti=h(["regions"],[]),ui=h(["tooltip","show"],!0),vi=h(["tooltip","format","title"]),wi=h(["tooltip","format","value"]),xi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=vi?vi:b,l=wi?wi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id,a[g].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),yi=h(["tooltip","init","show"],!1),zi=h(["tooltip","init","x"],0),Ai=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Bi=("string"==typeof Hf?Hf.replace("#",""):Hf.id)+"-clip",Ci=Bi+"-xaxis",Di=Bi+"-yaxis",Ei=i(Bi),Fi=i(Ci),Gi=i(Di),Hi="timeseries"===kh,Ii="categorized"===kh,Ji=!Hi&&(Ag||Be(Bg)),Ki=null,Li=!1,Mi=!1,Ni=!1,Oi=!1,Pi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Qi=ve(Og,Be(bh)?bh:Pi,Ng),Ri=lh?Ef.time.format:Ef.time.format.utc,Si=function(){var a=[[Ri("%Y/%-m/%-d"),function(){return!0}],[Ri("%-m/%-d"),function(a){return a.getMonth()}],[Ri("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ri("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ri("%I %p"),function(a){return a.getHours()}],[Ri("%I:%M"),function(a){return a.getMinutes()}],[Ri(":%S"),function(a){return a.getSeconds()}],[Ri(".%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)}}(),Ti=[],Ui=[],Vi=ih?"left":"bottom",Wi=ih?Gh?"top":"bottom":Gh?"right":"left",Xi=ih?Ph?"bottom":"top":Ph?"left":"right",Yi=ih?"left":"bottom",Zi={main:function(){return"translate("+Uf.left+","+Uf.top+")"},context:function(){return"translate("+Vf.left+","+Vf.top+")"},legend:function(){return"translate("+Wf.left+","+Wf.top+")"},x:function(){return"translate(0,"+(ih?0:Zf)+")"},y:function(){return"translate(0,"+(ih?Zf:0)+")"},y2:function(){return"translate("+(ih?0:Xf)+","+(ih?1:0)+")"},subx:function(){return"translate(0,"+(ih?0:$f)+")"},arc:function(){return"translate("+Xf/2+","+Zf/2+")"}},$i="right"===dh,_i=0,aj=0,bj=0,cj=.15,dj=30,ej=ih&&!jh?0:30,fj=5;hg=Ef.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var gj,hj=function(){var a=Ef.svg.line().x(ih?function(a){return V(a.id)(a.value)}:Fd).y(ih?Fd:function(a){return V(a.id)(a.value)});return di||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=di?Ne(b.values):b.values;return ie(b)?(a.interpolate(je(b)?"cardinal":"linear"),Mg[b.id]?af(e,qg,V(b.id),Mg[b.id]):a(e)):(c=e[0]?qg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ih?"M "+d+" "+c:"M "+c+" "+d)}}(),ij=function(){var a;return a=ih?Ef.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Fd):Ef.svg.area().x(Fd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ne(b.values);return ce([b],"area")||ce([b],"area-spline")?(a.interpolate(je(b)?"cardinal":"linear"),a(e)):(c=e[0]?qg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ih?"M "+d+" "+c:"M "+c+" "+d)}}(),jj=function(){var a=Ef.svg.line().x(ih?function(a){return W(a.id)(a.value)}:Id).y(ih?Id:function(a){return W(a.id)(a.value)});return function(b){var c=Ne(b.values);return ie(b)?a(c):"M "+tg(c[0].x)+" "+W(b.id)(c[0].value)}}(),kj=function(){};gj=Ef.svg.brush().on("brush",kf),gj.update=function(){return oj&&oj.select("."+f.brush).call(this),this},gj.scale=function(a){return ih?this.y(a):this.x(a)},Mf&&(kj=Ef.behavior.zoom().on("zoomstart",function(){kj.altDomain=Ef.event.sourceEvent.altKey?qg.orgDomain():null}).on("zoom",Mf?lf:null),kj.scale=function(a){return ih?this.y(a):this.x(a)},kj.orgScaleExtent=function(){var a=Nf?Nf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},kj.updateScaleExtent=function(){var a=ac(qg.orgDomain())/ac(sj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var lj,mj,nj,oj,pj,qj,rj,sj,tj,uj={};if(Ff.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=lj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);Ff.revert(),Ff.defocus(),b(d.classed(f.focused,!0)),b(e),he(Ff.data.targets)&&Nb(a,!0),vf(a,!0)},Ff.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=lj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);Ff.revert(),b(d.classed(f.focused,!1)),b(e),he(Ff.data.targets)&&Ob(a),vf(a,!1)},Ff.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=lj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);b(d.classed(f.focused,!1)),b(e),he(Ff.data.targets)&&Ob(a),wf()},Ff.show=function(a,b){a=Dc(a),b=b||{},Mc(a),lj.selectAll(qd(a)).transition().style("opacity",1),b.withLegend&&xf(a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ff.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),lj.selectAll(qd(a)).transition().style("opacity",0),b.withLegend&&yf(a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ff.toggle=function(a){Gc(a)?Ff.hide(a):Ff.show(a)},Ff.unzoom=function(){gj.clear().update(),jf({withUpdateXDomain:!0})},Ff.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Fg[b]=a.classes[b]}),"categories"in a&&Ii&&(mh=a.categories,wg.categories(mh)),"cacheIds"in a&&bc(a.cacheIds)?void qf(dc(a.cacheIds),a.done):void("unload"in a?sf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){rf(a)}):rf(a))},Ff.unload=function(a,b){sf(Dc(a),function(){jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Ff.selected=function(a){return Ef.merge(nj.selectAll("."+f.shapes+od(a)).selectAll("."+f.shape).filter(function(){return Ef.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Ff.select=function(a,b,c){Qg&&nj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=Ef.select(this),i=e.data?e.data.id:e.id,j=Me(this),k=Rg||!a||a.indexOf(i)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Sg(e)&&!m&&j(!0,h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(!1,h.classed(f.SELECTED,!1),e,g)})},Ff.unselect=function(a,b){Qg&&nj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=Ef.select(this),g=c.data?c.data.id:c.id,h=Me(this),i=Rg||!a||a.indexOf(g)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(f.SELECTED);i&&j&&Sg(c)&&k&&h(!1,e.classed(f.SELECTED,!1),c,d) })},Ff.toLine=function(a){Df(a,"line")},Ff.toSpline=function(a){Df(a,"spline")},Ff.toBar=function(a){Df(a,"bar")},Ff.toScatter=function(a){Df(a,"scatter")},Ff.toArea=function(a){Df(a,"area")},Ff.toAreaSpline=function(a){Df(a,"area-spline")},Ff.toPie=function(a){Df(a,"pie",{withTransform:!0})},Ff.toDonut=function(a){Df(a,"donut",{withTransform:!0})},Ff.groups=function(a){return c(a)?Gg:(Gg=a,jf(),Gg)},Ff.xgrids=function(a){return a?(Vh=a,jf(),Vh):Vh},Ff.xgrids.add=function(a){return a?Ff.xgrids(Vh.concat(a)):void 0},Ff.xgrids.remove=function(a){var b=Cf(a);return Ff.xgrids(Vh.filter(b))},Ff.ygrids=function(a){return a?(Xh=a,jf(),Xh):Xh},Ff.ygrids.add=function(a){return a?Ff.ygrids(Xh.concat(a)):void 0},Ff.ygrids.remove=function(a){var b=Cf(a);return Ff.ygrids(Xh.filter(b))},Ff.regions=function(a){return c(a)?ti:(ti=a,jf(),ti)},Ff.regions.add=function(a){return c(a)?ti:(ti=ti.concat(a),jf(),ti)},Ff.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;lj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ti=ti.filter(function(b){return b.classes.indexOf(a)<0})}),ti},Ff.data.get=function(a){var b=Ff.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Ff.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},Ff.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Eg[b]=a[b]}),zf(Cc(Ff.data.targets),{withTransition:!0}),Eg):Eg},Ff.x=function(a){return arguments.length&&(qc(Ff.data.targets,a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ff.data.xs},Ff.xs=function(a){return arguments.length&&(rc(Ff.data.targets,a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ff.data.xs},Ff.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},Ff.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Ch=+a.y),b(a.y2)&&(Lh=+a.y2)):Ch=Lh=+a,jf())},Ff.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Dh=+a.y),b(a.y2)&&(Mh=+a.y2)):Dh=Mh=+a,jf())},Ff.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Ff.axis.max(a.max),"undefined"!=typeof a.min&&Ff.axis.min(a.min))},Ff.legend.show=function(a){xf(Dc(a)),jf({withLegend:!0})},Ff.legend.hide=function(a){yf(Dc(a)),jf({withLegend:!0})},Ff.resize=function(a){If=a?a.width:null,Jf=a?a.height:null,of({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Ff.destroy=function(){Ff.data.targets=void 0,Ff.data.xs={},rj.html(""),a.onresize=null},"url"in e.data)Ef.xhr(e.data.url,function(a,b){var c,d=Ef.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Ef.csv.parse(b.response),bf(c)});else if("rows"in e.data)bf(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");bf(uc(e.data.columns))}return Ff},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 156d06f722be100f4c843ed3fc6b7dd219f3216e Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Fri, 2 May 2014 18:47:17 +0900 Subject: [PATCH 119/178] Add data.color API - #177 --- c3.js | 26 ++++++++++++++++++++------ c3.min.js | 6 +++--- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/c3.js b/c3.js index 4ab19e7..042ba68 100644 --- a/c3.js +++ b/c3.js @@ -2174,7 +2174,7 @@ color = colors[id](d); } // if specified, choose that color - else if (id in colors) { + else if (colors[id]) { color = colors[id]; } // if not specified, choose from pattern @@ -3421,6 +3421,7 @@ .style("opacity", initialOpacity) .transition().duration(duration) .attr("d", lineOnMain) + .style("stroke", color) .style("opacity", 1); mainLine.exit().transition().duration(durationForExit) .style('opacity', 0) @@ -3436,6 +3437,7 @@ .style("opacity", 0) .transition().duration(duration) .attr("d", areaOnMain) + .style("fill", color) .style("opacity", orgAreaOpacity); mainArea.exit().transition().duration(durationForExit) .style('opacity', 0) @@ -3445,11 +3447,13 @@ .data(lineOrScatterData); mainCircle.enter().append("circle") .attr("class", classCircle) - .attr("r", pointR); + .attr("r", pointR) + .style("fill", color); mainCircle .style("opacity", initialOpacity) .transition().duration(duration) .style('opacity', opacityForCircle) + .style("fill", color) .attr("cx", __axis_rotated ? circleY : circleX) .attr("cy", __axis_rotated ? circleX : circleY); mainCircle.exit().remove(); @@ -3460,6 +3464,7 @@ .attr("class", classText) .attr('text-anchor', function (d) { return __axis_rotated ? (d.value < 0 ? 'end' : 'start') : 'middle'; }) .style("stroke", 'none') + .style("fill", color) .style("fill-opacity", 0); mainText .text(function (d) { return formatByAxisId(d.id)(d.value, d.id); }) @@ -3467,6 +3472,7 @@ .transition().duration(duration) .attr('x', xForText) .attr('y', yForText) + .style("fill", color) .style("fill-opacity", opacityForText); mainText.exit() .transition().duration(durationForExit) @@ -3541,6 +3547,7 @@ return function (t) { return getArc(interpolate(t), true); }; }) .attr("transform", withTransform ? "scale(1)" : "") + .style("fill", function (d) { return color(d.data); }) .style("opacity", 1) .call(endall, function () { transiting = false; @@ -3783,8 +3790,7 @@ .style('opacity', 0) .style("pointer-events", "none"); mainTextEnter.append('g') - .attr('class', classTexts) - .style("fill", color); + .attr('class', classTexts); //-- Bar --// mainBarUpdate = main.select('.' + CLASS.chartBars).selectAll('.' + CLASS.chartBar) @@ -3818,7 +3824,6 @@ .attr("class", function (d) { return generateClass(CLASS.selectedCircles, d.id); }); mainLineEnter.append('g') .attr("class", classCircles) - .style("fill", color) .style("cursor", function (d) { return __data_selection_isselectable(d) ? "pointer" : null; }); // Update date for selected circles targets.forEach(function (t) { @@ -4131,7 +4136,7 @@ l.append('rect') .attr("class", CLASS.legendItemTile) .style("pointer-events", "none") - .style('fill', function (id) { return color(id); }) + .style('fill', color) .attr('x', isLegendRight ? xForLegendText : -200) .attr('y', isLegendRight ? -200 : yForLegend) .attr('width', 10) @@ -4154,6 +4159,7 @@ legend.selectAll('rect.' + CLASS.legendItemTile) .data(targetIds) .transition().duration(withTransition ? 250 : 0) + .style('fill', color) .attr('x', xForLegend) .attr('y', yForLegend); @@ -4487,6 +4493,14 @@ updateLegend(mapToIds(c3.data.targets), {withTransition: true}); return __data_names; }; + c3.data.colors = function (colors) { + if (!arguments.length) { return __data_colors; } + Object.keys(colors).forEach(function (id) { + __data_colors[id] = colors[id]; + }); + redraw({withLegend: true}); + return __data_colors; + }; c3.x = function (x) { if (arguments.length) { diff --git a/c3.min.js b/c3.min.js index 4fe0f02..56ec73a 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.34"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",lines:"c3-lines",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",arcs:"c3-arcs",area:"c3-area",areas:"c3-areas",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",legendItemFocused:"c3-legend-item-focused",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;cXf&&(Xf=0),0>Zf&&(Zf=0),Yf=ih?Uf.left-dj-ej:Xf,$f=ih?Zf:ag-Vf.top-Vf.bottom,0>Yf&&(Yf=0),0>$f&&($f=0),p(),$i&&he(Ff.data.targets)&&(Wf.left=Xf/2+cg)}function o(){nj.select("line."+f.xgridFocus).attr("x1",ih?0:-10).attr("x2",ih?Xf:-10).attr("y1",ih?-10:Uf.top).attr("y2",ih?-10:Zf)}function p(){cg=Zf/2,bg=.95*cg,dg=ge(Ff.data.targets)?.6*bg:0}function q(){var a=ih?f.axisX:f.axisY,b=nj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Ef.select(Hf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return If?If:x()}function s(){var a=Jf?Jf:y();return a>0?a:320}function t(){return he(Ff.data.targets)?0:Kf?Kf:ih?jh?v("x"):1:!Bh||Gh?1:v("y")}function u(){var a=1;return he(Ff.data.targets)?0:Lf?Lf:$i?P()+(Kh&&!ih?v("y2"):a):Kh?Ph||ih?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||jh?"x"===a&&yh?yh:"y"!==a||Bh?"y2"!==a||Kh?(jb(a).isInner?30:40)+("y2"===a?-10:0):fj:ch&&!$i?10:1:0}function x(){return+Ef.select(Hf).style("width").replace("px","")}function y(){return+Ef.select(Hf).style("height").replace("px","")}function z(a){return a?-5:-(Uf.left-1)}function A(a){return a?-20:-4}function B(){return z(!ih)}function C(){return A(!ih)}function D(){return z(ih)}function E(){return A(ih)}function F(a){return a?Xf+2+4:Uf.left+20}function G(a){return a?(yh?yh:0)+80:Zf+8}function H(){return F(!ih)}function I(){return G(!ih)}function J(){return F(ih)}function K(){return G(ih)}function L(){var a,b,c,d,e,f=Ac(Ff.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=qg(b.x)-qg(a.x),0===c?ih?Zf:Xf:(d=zc(),e=de(Ff.data.targets)?(d-(Ii?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function M(a){_i=a}function N(a){aj=a}function O(a){bj=a}function P(){return ch?$i?aj*(_i+1):_f:0}function Q(){return ch?$i?ag:bj*(_i+1):0}function R(){var a,b,c=!qg;ig=ih?1:0,jg=ih?Zf:Xf,kg=ih?0:Zf,lg=ih?Xf:1,mg=ig,ng=jg,og=ih?0:$f,pg=ih?Yf:1,qg=T(ig,jg,c?void 0:qg.domain(),function(){return wg.tickOffset()}),rg=U(kg,lg,c?void 0:rg.domain()),sg=U(kg,lg,c?void 0:sg.domain()),tg=T(ig,jg,sj,function(a){return a%1?0:zg.tickOffset()}),ug=U(og,pg,c?void 0:ug.domain()),vg=U(og,pg,c?void 0:vg.domain()),a=$(),b=th?th:c?void 0:wg.tickValues(),wg=X(qg,Vi,a,b),zg=X(tg,Yi,a,b),xg=Y(rg,Wi,Hh,Jh),yg=Y(sg,Xi,Qh,Sh),c||(gj.scale(tg),Mf&&kj.scale(qg)),S()}function S(){eg=Gb(),fg=Hb(),gg=Hb(.98)}function T(a,b,d,e){var f=(Hi?Ef.time.scale():Ef.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Ii){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=Ef.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?sg:rg}function W(a){return"y2"===Z(a)?vg:ug}function X(a,b,c,d){var e=(Ii?Eb():Ef.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Ii?(e.tickCentered(nh),Ae(ph)&&(ph=!1)):e.tickOffset=function(){var a=Bc(Ff.data.targets),b=qg(a[1])-qg(a[0]),c=b?b:ih?Zf:Xf;return c/zc()/2},Ii&&e.categories(mh),e}function Y(a,b,c,d){return Ef.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Hg?Hg[a]:"y"}function $(){var a=Hi?Si:Ii?Tc:function(a){return 0>a?a.toFixed(0):a};return oh&&("function"==typeof oh?a=oh:Hi&&(a=function(a){return a?Ri(oh)(a):""})),a}function _(a){var b;return"y"===a?b=Fh:"y2"===a?b=Oh:"x"===a&&(b=Ah),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Fh=b:"y2"===a?Oh=b:"x"===a&&(Ah=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",ih?"inner-top":"inner-right")}function hb(){return fb("y",ih?"inner-right":"inner-top")}function ib(){return fb("y2",ih?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Xf/2:Xf:b.isBottom?-Zf:b.isMiddle?-Zf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!ih,gb())}function rb(){return nb(ih,hb())}function sb(){return nb(ih,ib())}function tb(){return ob(!ih,gb())}function ub(){return ob(ih,hb())}function vb(){return ob(ih,ib())}function wb(){var a=gb();return ih?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":yh?yh-10:"3em"}function xb(){var a=hb();return ih?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return ih?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!ih,gb())}function Ab(){return pb(ih,hb())}function Bb(){return pb(ih,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return Ef.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){nj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),nj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),nj.select("."+f.axisY2+" ."+f.axisY2Label).transition().attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 Ef.min(Object.keys(i).map(function(a){return Ef.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(Gg.length>0)for(g=Sc(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 Ef.max(Object.keys(i).map(function(a){return Ef.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Mh:Dh,n="y2"===c?Lh:Ch,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Nh:Eh,r=xd()&&ih;return 0===l.length?"y2"===c?sg.domain():rg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=yd(o,p),j=ac(rg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),"y2"===c&&Rh&&(f=b(Rh.top)?Rh.top:e,g=b(Rh.bottom)?Rh.bottom:e),de(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return wh?Hi?we(wh):wh:Ef.min(a,function(a){return Ef.min(a.values,function(a){return a.x})})}function Zb(a){return vh?Hi?we(vh):vh:Ef.max(a,function(a){return Ef.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Ii?d=0:de(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof xh&&Be(xh)?(e=b(xh.left)?xh.left:d,f=b(xh.right)?xh.right:d):e=f="number"==typeof xh?xh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return c-d===0&&(c=Hi?new Date(.5*c.getTime()):-.5,d=Hi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Hi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Hi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?rg:sg;return b="y"===a.axis||"y2"===a.axis?ih?Zf:"start"in a?d(a.start):Zf:ih?"end"in a?qg(Hi?we(a.end):a.end):Zf:Zf,c>b?0:b-c}function ic(a){return Ag&&a===Ag||Be(Bg)&&Ce(Bg,a)}function jc(a){return!ic(a)}function kc(a){return Ag?Ag:Be(Bg)?Bg[a]:null}function lc(a,b){var c,d=b&&Be(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=Ff.data.xs[b])}),c}function mc(a,b){return a in Ff.data.xs&&Ff.data.xs[a]&&Ff.data.xs[a][b]?Ff.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){Bg[b]=a[b]})}function oc(a){return 1===Ef.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=Eg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),Ff.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=Hi?a?a instanceof Date?a:we(a):we(mc(c,d)):Ji&&!Ii?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Ff.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Ag?(d=Object.keys(Ff.data.xs),Ff.data.xs[c]=d.length>0?Ff.data.xs[d[0]]:void 0):Be(Bg)&&(Ff.data.xs[c]=lc(f,Ff.data.targets)):Ff.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Ff.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Dg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ji&&Ii&&0===c&&g&&(0===e&&(mh=[]),mh.push(g)),("undefined"==typeof a[b]||Ff.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ig&&be(Cc(c).filter(function(a){return!(a in Jg)}),Ig),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&Ff.data.targets[0].values[a-1]?Ff.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(Ff.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Hi?new Date(i):i);j.push(e)}return Hi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Ti=Ti.concat(a)}function Mc(a){Ti=Ti.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Ui=Ui.concat(a)}function Oc(a){Ui=Ui.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Jd(a,f))),(a[g].x||0===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=De(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Nd(a,b){return Ef.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Od(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 Pd(){return Lg&&"desc"===Lg.toLowerCase()}function Qd(){return Lg&&"asc"===Lg.toLowerCase()}function Rd(a){var b=Qd(),c=Pd();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 Lg&&a.sort(Lg),a}function Sd(a,c){var d,e,f,g,h,i,j,k=he(Ff.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&ui&&(qj.html(xi(a,$(),zd(k),Qi)).style("display","block"),d=qj.property("offsetWidth"),e=qj.property("offsetHeight"),k?(g=Xf/2+c[0],i=Zf/2+c[1]+20):(ih?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=qg(l[0].x)+20):(f=q(),g=f+t()+qg(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),qj.style("top",i+"px").style("left",g+"px"))}function Td(){qj.style("display","none")}function Ud(a){var c=a.filter(function(a){return a&&b(a.value)});ui&&(ee(Ff.data.targets)||he(Ff.data.targets)||nj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(ih?"y1":"x1",Fd).attr(ih?"y2":"x2",Fd))}function Vd(){nj.select("line."+f.xgridFocus).style("visibility","hidden")}function Wd(a){return a.x||0===a.x?qg(a.x):null}function Xd(a){return V(a.id)(a.value)}function Yd(){var a,b,d={},e=0;return Ic(Fc(ke)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ae(a,b){return"number"==typeof ei?ei:b?2*a.tickOffset()*fi/b:0}function be(a,b){Dc(a).forEach(function(a){uj[a]=b===Jg[a],Jg[a]=b})}function ce(a,b){var c=!1;return a.forEach(function(a){Jg[a.id]===b&&(c=!0),a.id in Jg||"line"!==b||(c=!0)}),c}function de(a){return ce(a,"bar")}function ee(a){return ce(a,"scatter")}function fe(a){return ce(a,"pie")}function ge(a){return ce(a,"donut")}function he(a){return fe(a)||ge(a)}function ie(a){var b="string"==typeof a?a:a.id;return!(b in Jg)||"line"===Jg[b]||"spline"===Jg[b]||"area"===Jg[b]||"area-spline"===Jg[b]}function je(a){var b="string"==typeof a?a:a.id;return"spline"===Jg[b]||"area-spline"===Jg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"bar"===Jg[b]}function le(a){var b="string"==typeof a?a:a.id;return"scatter"===Jg[b]}function me(a){var b="string"==typeof a?a:a.id;return"pie"===Jg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"donut"===Jg[b]}function oe(a){return me(a)||ne(a)}function pe(a){return ie(a)?[a]:[]}function qe(a){return oe(a.data)?[a]:[]}function re(a){return ke(a)?a.values:[]}function se(a){return ie(a)||le(a)?a.values:[]}function te(a){return ke(a)||ie(a)?a.values:[]}function ue(a){return ne(a)&&oi||me(a)&&ii}function ve(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function we(b){var c;try{c=Cg?Ef.time.format(Cg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Cg)}return c}function xe(a,b){var c=Ef.mouse(a),d=Ef.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ce(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function De(a,b){var c="y"===Z(a.id)?rg:sg,d=ih?1:0,e=ih?0:1;return Math.pow(qg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ee(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Fe(a,b,c){Xg(b,a.node()),nj.select("."+f.selectedCircles+od(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",ih?Xd:Wd).attr("cy",ih?Wd:Xd).attr("stroke",function(){return Qi(b)}).attr("r",1.4*Qe(b)).transition().duration(100).attr("r",Qe)}function Ge(a,b,c){Yg(b,a.node()),nj.select("."+f.selectedCircles+od(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function He(a,b,c,d){a?Fe(b,c,d):Ge(b,c,d)}function Ie(a,b){Xg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ef.rgb(Qi(b)).brighter(.75)})}function Je(a,b){Yg(b,a.node()),a.transition().duration(100).style("fill",function(){return Qi(b)})}function Ke(a,b,c,d){a?Ie(b,c,d):Je(b,c,d)}function Le(a,b,c,d){Ke(a,b,c.data,d)}function Me(a){return"circle"===a.nodeName?He:Ef.select(a).classed(f.bar)?Ke:Le}function Ne(a){return a.filter(function(a){return b(a.value)})}function Oe(a){return Zh?"function"==typeof $h?$h(a):$h:0}function Pe(a){return ai?bi?bi:1.75*Oe(a):Oe(a)}function Qe(a){return ci?ci:4*Oe(a)}function Re(a,c){return(c?nj.selectAll("."+f.circles+od(c)):nj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Se(a,b){Re(a,b).classed(f.EXPANDED,!0).attr("r",Pe)}function Te(a){Re(a).filter(function(){return Ef.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oe)}function Ue(a){return nj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ve(a){Ue(a).classed(f.EXPANDED,!0)}function We(a){Ue(a).classed(f.EXPANDED,!1)}function Xe(a,b){var c=_e(a,b);return function(a,b){var d=c(a,b),e=ih?1:0,f=ih?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 Ye(a,b){var c=_e(a,!1),d=b?Ze:$e;return function(a,b){return d(c(a,b),a,this)}}function Ze(a,b){var c;return ih?(c=ke(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function $e(a,b,c){var d=c.getBoundingClientRect();return ih?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ke(b)?-3:-6)}function _e(a,b){var c=a.__max__+1,d=ae(wg,c),e=Zd(d,c,a,!!b),f=$d(!!b),g=_d(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return ih&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function af(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 bf(b){var c,d,e;if(rj=Ef.select(Hf),rj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(rj.html("").classed("c3",!0),Ff.data.xs={},Ff.data.targets=vc(b),Pg&&Lc(Pg===!0?Cc(Ff.data.targets):Pg),n(),R(),qg.domain(Ef.extent(_b(Ff.data.targets))),rg.domain(Xb(Ff.data.targets,"y")),sg.domain(Xb(Ff.data.targets,"y2")),tg.domain(qg.domain()),ug.domain(rg.domain()),vg.domain(sg.domain()),sj=qg.domain(),gj.scale(tg),Mf&&kj.scale(qg),lj=rj.append("svg").on("mouseenter",Pf).on("mouseleave",Qf),mj=lj.append("defs"),mj.append("clipPath").attr("id",Bi).append("rect"),mj.append("clipPath").attr("id",Ci).append("rect"),mj.append("clipPath").attr("id",Di).append("rect"),nf(),nj=lj.append("g").attr("transform",Zi.main),oj=lj.append("g").attr("transform",Zi.context),pj=lj.append("g").attr("transform",Zi.legend),_g||oj.style("visibility","hidden"),ch||(pj.style("visibility","hidden"),Ui=Cc(Ff.data.targets)),qj=Ef.select(Hf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),zf(Cc(Ff.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=nj.append("g").attr("clip-path",Ei).attr("class",f.grid),Th&&d.append("g").attr("class",f.xgrids),Be(Vh)&&d.append("g").attr("class",f.xgridLines),_h&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Wh&&d.append("g").attr("class",f.ygrids),Be(Xh)&&d.append("g").attr("class",f.ygridLines),jh&&nj.append("g").attr("class",f.axisX).attr("clip-path",Fi).attr("transform",Zi.x).append("text").attr("class",f.axisXLabel).attr("transform",ih?"rotate(-90)":"").style("text-anchor",zb),Bh&&nj.append("g").attr("class",f.axisY).attr("clip-path",Gi).attr("transform",Zi.y).append("text").attr("class",f.axisYLabel).attr("transform",ih?"":"rotate(-90)").style("text-anchor",Ab),Kh&&nj.append("g").attr("class",f.axisY2).attr("transform",Zi.y2).append("text").attr("class",f.axisY2Label).attr("transform",ih?"":"rotate(-90)").style("text-anchor",Bb),nj.append("g").attr("clip-path",Ei).attr("class",f.regions),nj.append("g").attr("clip-path",Ei).attr("class",f.chart),c=nj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Mf?ih?"ns-resize":"ew-resize":null),nj.select("."+f.chart).append("g").attr("class",f.chartBars),nj.select("."+f.chart).append("g").attr("class",f.chartLines),nj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Zi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),nj.select("."+f.chart).append("g").attr("class",f.chartTexts),Mf&&nj.insert("rect",Of?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Xf).attr("height",Zf).style("opacity",0).style("cursor",ih?"ns-resize":"ew-resize").call(kj).on("dblclick.zoom",null),zh&&gj.extent("function"!=typeof zh?zh:zh(_b())),oj.append("g").attr("clip-path",Ei).attr("class",f.chart),oj.select("."+f.chart).append("g").attr("class",f.chartBars),oj.select("."+f.chart).append("g").attr("class",f.chartLines),oj.append("g").attr("clip-path",Ei).attr("class",f.brush).call(gj).selectAll("rect").attr(ih?"width":"height",ih?Yf:$f),oj.append("g").attr("class",f.axisX).attr("transform",Zi.subx).attr("clip-path",ih?"":Fi),pf(Ff.data.targets),ih?nj.select("."+f.axisX).style("opacity",0).call(wg):(nj.select("."+f.axisY).style("opacity",0).call(xg),nj.select("."+f.axisY2).style("opacity",0).call(yg)),n(),R(),nf(),m(!1),jf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),yi){if(Hi&&"string"==typeof zi){for(zi=we(zi),e=0;e0){d=[];for(var g in Eg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Od(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ke,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 gf(a){he(Ff.data.targets)||Qg&&(Ki=a,nj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Li=!0,Zg())}function hf(){he(Ff.data.targets)||Qg&&(nj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),nj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Li=!1,$g())}function jf(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z=Yd(),$=he(Ff.data.targets),_=Ic(Ff.data.targets);if(a=d(a)?a:{},E=d(a.withY)?a.withY:!0,F=d(a.withSubchart)?a.withSubchart:!0,G=d(a.withTransition)?a.withTransition:!0,J=d(a.withTransform)?a.withTransform:!1,K=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,M=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,N=d(a.withLegend)?a.withLegend:!1,H=d(a.withTransitionForExit)?a.withTransitionForExit:G,I=d(a.withTransitionForAxis)?a.withTransitionForAxis:G,T=G?Tf:0,U=H?T:0,V=I?T:0,c=nj.select("."+f.axisX).style("opacity",$?0:1),g=nj.select("."+f.axisY).style("opacity",$?0:1),h=nj.select("."+f.axisY2).style("opacity",$?0:1),e=oj.select("."+f.axisX).style("opacity",$?0:1),S={axisX:c.transition().duration(V),axisY:g.transition().duration(V),axisY2:h.transition().duration(V),axisSubX:e.transition().duration(V)},N&&ch&&zf(Cc(Ff.data.targets),a,S),Ii&&(0!==_.length&&M&&K||qg.domain([0,c.selectAll(".tick").size()])),_.length&&(M&&(qg.domain(Ef.extent(_b(_))),sj=qg.domain(),Mf&&kj.scale(qg).updateScaleExtent(),tg.domain(qg.domain()),gj.scale(tg)),K&&(qg.domain(gj.empty()?sj:gj.extent()),Mf&&kj.scale(qg).updateScaleExtent()),th||!sh&&!rh||(W=Kc(Jc(_),rh),wg.tickValues(W),zg.tickValues(W))),rg.domain(Xb(_,"y")),sg.domain(Xb(_,"y2")),S.axisX.call(wg),S.axisY.call(xg),S.axisY2.call(yg),S.axisSubX.call(zg),K&&_.length)if(ph&&W){for(X=1;X=0&&Ef.select(this).style("display",b%Y?"none":"block")})}else lj.selectAll("."+f.axisX+" .tick text").style("display","block");if(!ih&&uh&&eb(c,S.axisX,uh),O=Xe(Z),Q=Ye(Z,!0),R=Ye(Z,!1),Db(),ug.domain(rg.domain()),vg.domain(sg.domain()),qj.style("display","none"),o(),nj.select("line."+f.xgridFocus).style("visibility","hidden"),Th){if("year"===Uh){j=[];for(var ab=_b(),bb=ab[0].getFullYear(),cb=ab[1].getFullYear(),db=bb;cb>=db;db++)j.push(new Date(db+"-01-01 00:00:00"))}else j=qg.ticks(10);i=nj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",ih?0:function(a){return qg(a)-wg.tickOffset()}).attr("x2",ih?Xf:function(a){return qg(a)-wg.tickOffset()}).attr("y1",ih?function(a){return qg(a)-wg.tickOffset()}:Uf.top).attr("y2",ih?function(a){return qg(a)-wg.tickOffset()}:Zf).style("opacity",function(){return+Ef.select(this).attr(ih?"y1":"x1")===(ih?Zf:0)?0:1}),i.exit().remove()}Be(Vh)&&(k=nj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Vh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",ih?"":"rotate(-90)").attr("dx",ih?0:-Uf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",ih?0:Gd).attr("x2",ih?Xf:Gd).attr("y1",ih?Gd:Uf.top).attr("y2",ih?Gd:Zf).style("opacity",1),k.select("text").transition().duration(T).attr("x",ih?Xf:0).attr("y",Gd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),E&&Wh&&(m=nj.select("."+f.ygrids).selectAll("."+f.ygrid).data(rg.ticks(Yh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",ih?rg:0).attr("x2",ih?rg:Xf).attr("y1",ih?0:rg).attr("y2",ih?Zf:rg),m.exit().remove()),E&&Be(Xh)&&(n=nj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Xh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",ih?"rotate(-90)":"").attr("dx",ih?0:-Uf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(T).attr("x1",ih?Hd:0).attr("x2",ih?Hd:Xf).attr("y1",ih?0:Hd).attr("y2",ih?Zf:Hd).style("opacity",1),n.select("text").transition().duration(T).attr("x",ih?0:Xf).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(T).style("opacity",0).remove()),v=nj.select("."+f.regions).selectAll("rect."+f.region).data(ti),v.enter().append("rect").style("fill-opacity",0),v.attr("class",hd).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(T).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),v.exit().transition().duration(T).style("fill-opacity",0).remove(),t=nj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),t.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Qi),t.style("opacity",td).transition().duration(T).attr("d",O).style("fill",Qi).style("opacity",1),t.exit().transition().duration(U).style("opacity",0).remove(),q=nj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),q.enter().append("path").attr("class",Zc).style("stroke",Qi),q.style("opacity",td).transition().duration(T).attr("d",hj).style("opacity",1),q.exit().transition().duration(U).style("opacity",0).remove(),r=nj.selectAll("."+f.areas).selectAll("."+f.area).data(pe),r.enter().append("path").attr("class",fd).style("fill",Qi).style("opacity",function(){return tj=+Ef.select(this).style("opacity"),0}),r.style("opacity",0).transition().duration(T).attr("d",ij).style("opacity",tj),r.exit().transition().duration(U).style("opacity",0).remove(),s=nj.selectAll("."+f.circles).selectAll("."+f.circle).data(se),s.enter().append("circle").attr("class",_c).attr("r",Oe),s.style("opacity",td).transition().duration(T).style("opacity",vd).attr("cx",ih?Xd:Wd).attr("cy",ih?Wd:Xd),s.exit().remove(),w=nj.selectAll("."+f.texts).selectAll("."+f.text).data(te),w.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return ih?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),w.text(function(a){return Ed(a.id)(a.value,a.id)}).style("fill-opacity",ud).transition().duration(T).attr("x",Q).attr("y",R).style("fill-opacity",wd),w.exit().transition().duration(U).style("fill-opacity",0).remove(),u=nj.selectAll("."+f.arcs).selectAll("."+f.arc).data(qe),u.enter().append("path").attr("class",dd).style("fill",function(a){return Qi(a.data)}).style("cursor",function(a){return Sg(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Oi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),vf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Sd(d,Ef.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Oi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),wf(),Td(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();ef(this,a,b),e(d,b)}),u.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Oi=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Fb(a);return c?(b=Ef.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("opacity",1).call(Ee,function(){Oi=!1}),u.exit().transition().duration(U).style("opacity",0).remove(),nj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(T).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&oe(a.data)?1:0}),nj.select("."+f.chartArcsTitle).style("opacity",ge(Ff.data.targets)?1:0),_g&&(null!==Ef.event&&"zoom"===Ef.event.type&&gj.extent(qg.orgDomain()).update(),F&&(!ih&&uh&&eb(e,S.axisSubX,uh),gj.empty()||gj.extent(qg.orgDomain()).update(),P=Xe(Z,!0),y=oj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),y.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Qi),y.style("opacity",td).transition().duration(T).attr("d",P).style("opacity",1),y.exit().transition().duration(T).style("opacity",0).remove(),x=oj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),x.enter().append("path").attr("class",Zc).style("stroke",Qi),x.style("opacity",td).transition().duration(T).attr("d",jj).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove())),nj.selectAll("."+f.selectedCircles).filter(function(a){return ke(a)}).selectAll("circle").remove(),nj.selectAll("."+f.selectedCircle).transition().duration(T).attr("cx",ih?Xd:Wd).attr("cy",ih?Wd:Xd),z=nj.select("."+f.eventRects),Be(Bg)&&!oc(Bg)?(z.classed(f.eventRectsMultiple)||z.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),A=nj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),df(A.enter()),A.attr("x",0).attr("y",0).attr("width",Xf).attr("height",Zf)):(z.classed(f.eventRectsSingle)||z.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ji&&!Ii?(D=function(a,b){var c=xc(b),d=yc(b),e=Ff.data.xs[a.id][b];return(qg(d?d:e+50)-qg(c?c:e-50))/2},C=function(a,b){var c=xc(b),d=Ff.data.xs[a.id][b];return(qg(d)+qg(c?c:d-50))/2}):(D=L(),C=function(a){return qg(a.x)-D/2}),B=Ac(Ff.data.targets),nj.select("."+f.eventRects).datum(B?B.values:[]),A=nj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),cf(A.enter()),A.attr("class",id).attr("x",ih?0:C).attr("y",ih?C:0).attr("width",ih?Xf:D).attr("height",ih?D:Zf),A.exit().remove()),Cc(Ff.data.targets).forEach(function(a){uj[a]=!0})}function kf(){jf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function lf(){return"mousemove"===Ef.event.sourceEvent.type&&kj.altDomain?(qg.domain(kj.altDomain),void kj.scale(qg).updateScaleExtent()):(Ii&&qg.orgDomain()[0]===sj[0]&&qg.domain([sj[0]-1e-10,qg.orgDomain()[1]]),jf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Ef.event.sourceEvent.type&&(Mi=!0)))}function mf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function nf(){lj.attr("width",_f).attr("height",ag),lj.select("#"+Bi).select("rect").attr("width",Xf).attr("height",Zf),lj.select("#"+Ci).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),lj.select("#"+Di).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),lj.select("."+f.zoomRect).attr("width",Xf).attr("height",Zf),rj.style("max-height",ag+"px")}function of(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),nf(),m(a.withTransition),jf(a)}function pf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=nj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",kd),j=i.enter().append("g").attr("class",kd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",Qi),e=nj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",md),d=e.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",cd).style("cursor",function(a){return Sg(a)?"pointer":null}),c=nj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",ld),b=c.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",$c),b.append("g").attr("class",gd),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",ad).style("fill",Qi).style("cursor",function(a){return Sg(a)?"pointer":null}),a.forEach(function(a){nj.selectAll("."+f.selectedCircles+od(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=nj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(hg(a)).attr("class",nd),g=h.enter().append("g").attr("class",nd),g.append("g").attr("class",ed),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),_g&&(n=oj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",md),m=n.enter().append("g").style("opacity",0).attr("class",md),m.append("g").attr("class",cd),l=oj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",ld),k=l.enter().append("g").style("opacity",0).attr("class",ld),k.append("g").attr("class",$c)),lj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Tf).style("opacity",1)}function qf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?be(a.id,b.types[a.id]):be(a.id,b.type)}),Ff.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=$i?j:i,l=$i?Q():P();return d&&(w=0,C=0,t=0,u=0),ch&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=$i?u:t,void(hh?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=pj.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,$i?(g=function(a){return t*(.2+B[a])},j=function(a){return A[B[a]]+x[a]}):(g=function(a){return A[B[a]]+x[a]},j=function(a){return u*(.2+B[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=pj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof eh?eh(a):Ff.toggle(a)}).on("mouseover",function(a){Ef.select(this).classed(f.legendItemFocused,!0),Oi||Ff.focus(a),"function"==typeof fh&&fh(a)}).on("mouseout",function(a){Ef.select(this).classed(f.legendItemFocused,!1),Oi||Ff.revert(),"function"==typeof gh&&gh(a)}),o.append("text").text(function(a){return d(Eg[a])?Eg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",$i?h:-200).attr("y",$i?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",$i?i:-200).attr("y",$i?-200:l).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Qi(a)}).attr("x",$i?h:-200).attr("y",$i?-200:j).attr("width",10).attr("height",10),pj.selectAll("text").data(a).text(function(a){return d(Eg[a])?Eg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),pj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),pj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),pj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=Ef.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?tf(b):uf(b):cj}),N(t),O(u),M(C),n(),R(),nf(),m(q,c)}function Af(a){return Ec(Ff.data.targets,a.id)}function Bf(a){return"data"in a&&Ec(Ff.data.targets,a.data.id)}function Cf(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 Df(a,b,c){var d=!he(Ff.data.targets);Oi=!1,be(a,b),of(c||{withTransitionForAxis:d})}var Ef=a.d3?a.d3:a.require?a.require("d3"):void 0,Ff={data:{},axis:{},legend:{}},Gf={},Hf=h(["bindto"],"#chart"),If=h(["size","width"]),Jf=h(["size","height"]),Kf=h(["padding","left"],50),Lf=h(["padding","right"]),Mf=h(["zoom","enabled"],!1),Nf=h(["zoom","extent"]),Of=h(["zoom","privileged"],!1),Pf=h(["onenter"],function(){}),Qf=h(["onleave"],function(){}),Rf=h(["onresize"],function(){}),Sf=h(["onresized"],function(){}),Tf=h(["transition","duration"],350);g("data","data is required in config");var Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag=h(["data","x"]),Bg=h(["data","xs"],{}),Cg=h(["data","x_format"]),Dg=h(["data","id_converter"],function(a){return a}),Eg=h(["data","names"],{}),Fg=h(["data","classes"],{}),Gg=h(["data","groups"],[]),Hg=h(["data","axes"],{}),Ig=h(["data","type"]),Jg=h(["data","types"],{}),Kg=h(["data","labels"],{}),Lg=h(["data","order"]),Mg=h(["data","regions"],{}),Ng=h(["data","color"]),Og=h(["data","colors"],{}),Pg=h(["data","hide"],!1),Qg=h(["data","selection","enabled"],!1),Rg=h(["data","selection","grouped"],!1),Sg=h(["data","selection","isselectable"],function(){return!0}),Tg=h(["data","selection","multiple"],!0),Ug=h(["data","onclick"],function(){}),Vg=h(["data","onenter"],function(){}),Wg=h(["data","onleave"],function(){}),Xg=h(["data","onselected"],function(){}),Yg=h(["data","onunselected"],function(){}),Zg=h(["data","ondragstart"],function(){}),$g=h(["data","ondragend"],function(){}),_g=h(["subchart","show"],!1),ah=h(["subchart","size","height"],60),bh=h(["color","pattern"],[]),ch=h(["legend","show"],!0),dh=h(["legend","position"],"bottom"),eh=h(["legend","item","onclick"]),fh=h(["legend","item","onmouseover"]),gh=h(["legend","item","onmouseout"]),hh=h(["legend","equally"],!1),ih=h(["axis","rotated"],!1),jh=h(["axis","x","show"],!0),kh=h(["axis","x","type"],"indexed"),lh=h(["axis","x","localtime"],!0),mh=h(["axis","x","categories"],[]),nh=h(["axis","x","tick","centered"],!1),oh=h(["axis","x","tick","format"]),ph=h(["axis","x","tick","culling"],{}),qh=h(["axis","x","tick","culling","max"],10),rh=h(["axis","x","tick","count"]),sh=h(["axis","x","tick","fit"],!0),th=h(["axis","x","tick","values"],null),uh=h(["axis","x","tick","rotate"]),vh=h(["axis","x","max"],null),wh=h(["axis","x","min"],null),xh=h(["axis","x","padding"],{}),yh=h(["axis","x","height"]),zh=h(["axis","x","default"]),Ah=h(["axis","x","label"],{}),Bh=h(["axis","y","show"],!0),Ch=h(["axis","y","max"]),Dh=h(["axis","y","min"]),Eh=h(["axis","y","center"]),Fh=h(["axis","y","label"],{}),Gh=h(["axis","y","inner"],!1),Hh=h(["axis","y","tick","format"]),Ih=h(["axis","y","padding"]),Jh=h(["axis","y","ticks"],10),Kh=h(["axis","y2","show"],!1),Lh=h(["axis","y2","max"]),Mh=h(["axis","y2","min"]),Nh=h(["axis","y2","center"]),Oh=h(["axis","y2","label"],{}),Ph=h(["axis","y2","inner"],!1),Qh=h(["axis","y2","tick","format"]),Rh=h(["axis","y2","padding"]),Sh=h(["axis","y2","ticks"],10),Th=h(["grid","x","show"],!1),Uh=h(["grid","x","type"],"tick"),Vh=h(["grid","x","lines"],[]),Wh=h(["grid","y","show"],!1),Xh=h(["grid","y","lines"],[]),Yh=h(["grid","y","ticks"],10),Zh=h(["point","show"],!0),$h=h(["point","r"],2.5),_h=h(["point","focus","line","enabled"],!0),ai=h(["point","focus","expand","enabled"],!0),bi=h(["point","focus","expand","r"]),ci=h(["point","focus","select","r"]),di=h(["line","connect_null"],!1),ei=h(["bar","width"]),fi=h(["bar","width","ratio"],.6),gi=h(["pie","label","show"],!0),hi=h(["pie","label","format"]),ii=h(["pie","expand"],!0),ji=h(["pie","onclick"],function(){}),ki=h(["pie","onmouseover"],function(){}),li=h(["pie","onmouseout"],function(){}),mi=h(["donut","label","show"],!0),ni=h(["donut","label","format"]),oi=h(["donut","expand"],!0),pi=h(["donut","title"],""),qi=h(["donut","onclick"],function(){}),ri=h(["donut","onmouseover"],function(){}),si=h(["donut","onmouseout"],function(){}),ti=h(["regions"],[]),ui=h(["tooltip","show"],!0),vi=h(["tooltip","format","title"]),wi=h(["tooltip","format","value"]),xi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=vi?vi:b,l=wi?wi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id,a[g].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),yi=h(["tooltip","init","show"],!1),zi=h(["tooltip","init","x"],0),Ai=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Bi=("string"==typeof Hf?Hf.replace("#",""):Hf.id)+"-clip",Ci=Bi+"-xaxis",Di=Bi+"-yaxis",Ei=i(Bi),Fi=i(Ci),Gi=i(Di),Hi="timeseries"===kh,Ii="categorized"===kh,Ji=!Hi&&(Ag||Be(Bg)),Ki=null,Li=!1,Mi=!1,Ni=!1,Oi=!1,Pi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Qi=ve(Og,Be(bh)?bh:Pi,Ng),Ri=lh?Ef.time.format:Ef.time.format.utc,Si=function(){var a=[[Ri("%Y/%-m/%-d"),function(){return!0}],[Ri("%-m/%-d"),function(a){return a.getMonth()}],[Ri("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ri("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ri("%I %p"),function(a){return a.getHours()}],[Ri("%I:%M"),function(a){return a.getMinutes()}],[Ri(":%S"),function(a){return a.getSeconds()}],[Ri(".%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)}}(),Ti=[],Ui=[],Vi=ih?"left":"bottom",Wi=ih?Gh?"top":"bottom":Gh?"right":"left",Xi=ih?Ph?"bottom":"top":Ph?"left":"right",Yi=ih?"left":"bottom",Zi={main:function(){return"translate("+Uf.left+","+Uf.top+")"},context:function(){return"translate("+Vf.left+","+Vf.top+")"},legend:function(){return"translate("+Wf.left+","+Wf.top+")"},x:function(){return"translate(0,"+(ih?0:Zf)+")"},y:function(){return"translate(0,"+(ih?Zf:0)+")"},y2:function(){return"translate("+(ih?0:Xf)+","+(ih?1:0)+")"},subx:function(){return"translate(0,"+(ih?0:$f)+")"},arc:function(){return"translate("+Xf/2+","+Zf/2+")"}},$i="right"===dh,_i=0,aj=0,bj=0,cj=.15,dj=30,ej=ih&&!jh?0:30,fj=5;hg=Ef.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var gj,hj=function(){var a=Ef.svg.line().x(ih?function(a){return V(a.id)(a.value)}:Fd).y(ih?Fd:function(a){return V(a.id)(a.value)});return di||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=di?Ne(b.values):b.values;return ie(b)?(a.interpolate(je(b)?"cardinal":"linear"),Mg[b.id]?af(e,qg,V(b.id),Mg[b.id]):a(e)):(c=e[0]?qg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ih?"M "+d+" "+c:"M "+c+" "+d)}}(),ij=function(){var a;return a=ih?Ef.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Fd):Ef.svg.area().x(Fd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ne(b.values);return ce([b],"area")||ce([b],"area-spline")?(a.interpolate(je(b)?"cardinal":"linear"),a(e)):(c=e[0]?qg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ih?"M "+d+" "+c:"M "+c+" "+d)}}(),jj=function(){var a=Ef.svg.line().x(ih?function(a){return W(a.id)(a.value)}:Id).y(ih?Id:function(a){return W(a.id)(a.value)});return function(b){var c=Ne(b.values);return ie(b)?a(c):"M "+tg(c[0].x)+" "+W(b.id)(c[0].value)}}(),kj=function(){};gj=Ef.svg.brush().on("brush",kf),gj.update=function(){return oj&&oj.select("."+f.brush).call(this),this},gj.scale=function(a){return ih?this.y(a):this.x(a)},Mf&&(kj=Ef.behavior.zoom().on("zoomstart",function(){kj.altDomain=Ef.event.sourceEvent.altKey?qg.orgDomain():null}).on("zoom",Mf?lf:null),kj.scale=function(a){return ih?this.y(a):this.x(a)},kj.orgScaleExtent=function(){var a=Nf?Nf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},kj.updateScaleExtent=function(){var a=ac(qg.orgDomain())/ac(sj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var lj,mj,nj,oj,pj,qj,rj,sj,tj,uj={};if(Ff.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=lj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);Ff.revert(),Ff.defocus(),b(d.classed(f.focused,!0)),b(e),he(Ff.data.targets)&&Nb(a,!0),vf(a,!0)},Ff.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=lj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);Ff.revert(),b(d.classed(f.focused,!1)),b(e),he(Ff.data.targets)&&Ob(a),vf(a,!1)},Ff.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=lj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);b(d.classed(f.focused,!1)),b(e),he(Ff.data.targets)&&Ob(a),wf()},Ff.show=function(a,b){a=Dc(a),b=b||{},Mc(a),lj.selectAll(qd(a)).transition().style("opacity",1),b.withLegend&&xf(a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ff.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),lj.selectAll(qd(a)).transition().style("opacity",0),b.withLegend&&yf(a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ff.toggle=function(a){Gc(a)?Ff.hide(a):Ff.show(a)},Ff.unzoom=function(){gj.clear().update(),jf({withUpdateXDomain:!0})},Ff.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Fg[b]=a.classes[b]}),"categories"in a&&Ii&&(mh=a.categories,wg.categories(mh)),"cacheIds"in a&&bc(a.cacheIds)?void qf(dc(a.cacheIds),a.done):void("unload"in a?sf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){rf(a)}):rf(a))},Ff.unload=function(a,b){sf(Dc(a),function(){jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Ff.selected=function(a){return Ef.merge(nj.selectAll("."+f.shapes+od(a)).selectAll("."+f.shape).filter(function(){return Ef.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Ff.select=function(a,b,c){Qg&&nj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=Ef.select(this),i=e.data?e.data.id:e.id,j=Me(this),k=Rg||!a||a.indexOf(i)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Sg(e)&&!m&&j(!0,h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(!1,h.classed(f.SELECTED,!1),e,g)})},Ff.unselect=function(a,b){Qg&&nj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=Ef.select(this),g=c.data?c.data.id:c.id,h=Me(this),i=Rg||!a||a.indexOf(g)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(f.SELECTED);i&&j&&Sg(c)&&k&&h(!1,e.classed(f.SELECTED,!1),c,d) -})},Ff.toLine=function(a){Df(a,"line")},Ff.toSpline=function(a){Df(a,"spline")},Ff.toBar=function(a){Df(a,"bar")},Ff.toScatter=function(a){Df(a,"scatter")},Ff.toArea=function(a){Df(a,"area")},Ff.toAreaSpline=function(a){Df(a,"area-spline")},Ff.toPie=function(a){Df(a,"pie",{withTransform:!0})},Ff.toDonut=function(a){Df(a,"donut",{withTransform:!0})},Ff.groups=function(a){return c(a)?Gg:(Gg=a,jf(),Gg)},Ff.xgrids=function(a){return a?(Vh=a,jf(),Vh):Vh},Ff.xgrids.add=function(a){return a?Ff.xgrids(Vh.concat(a)):void 0},Ff.xgrids.remove=function(a){var b=Cf(a);return Ff.xgrids(Vh.filter(b))},Ff.ygrids=function(a){return a?(Xh=a,jf(),Xh):Xh},Ff.ygrids.add=function(a){return a?Ff.ygrids(Xh.concat(a)):void 0},Ff.ygrids.remove=function(a){var b=Cf(a);return Ff.ygrids(Xh.filter(b))},Ff.regions=function(a){return c(a)?ti:(ti=a,jf(),ti)},Ff.regions.add=function(a){return c(a)?ti:(ti=ti.concat(a),jf(),ti)},Ff.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;lj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ti=ti.filter(function(b){return b.classes.indexOf(a)<0})}),ti},Ff.data.get=function(a){var b=Ff.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Ff.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},Ff.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Eg[b]=a[b]}),zf(Cc(Ff.data.targets),{withTransition:!0}),Eg):Eg},Ff.x=function(a){return arguments.length&&(qc(Ff.data.targets,a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ff.data.xs},Ff.xs=function(a){return arguments.length&&(rc(Ff.data.targets,a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ff.data.xs},Ff.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},Ff.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Ch=+a.y),b(a.y2)&&(Lh=+a.y2)):Ch=Lh=+a,jf())},Ff.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Dh=+a.y),b(a.y2)&&(Mh=+a.y2)):Dh=Mh=+a,jf())},Ff.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Ff.axis.max(a.max),"undefined"!=typeof a.min&&Ff.axis.min(a.min))},Ff.legend.show=function(a){xf(Dc(a)),jf({withLegend:!0})},Ff.legend.hide=function(a){yf(Dc(a)),jf({withLegend:!0})},Ff.resize=function(a){If=a?a.width:null,Jf=a?a.height:null,of({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Ff.destroy=function(){Ff.data.targets=void 0,Ff.data.xs={},rj.html(""),a.onresize=null},"url"in e.data)Ef.xhr(e.data.url,function(a,b){var c,d=Ef.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Ef.csv.parse(b.response),bf(c)});else if("rows"in e.data)bf(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");bf(uc(e.data.columns))}return Ff},"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.34"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",lines:"c3-lines",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",arcs:"c3-arcs",area:"c3-area",areas:"c3-areas",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",legendItemFocused:"c3-legend-item-focused",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;cXf&&(Xf=0),0>Zf&&(Zf=0),Yf=ih?Uf.left-dj-ej:Xf,$f=ih?Zf:ag-Vf.top-Vf.bottom,0>Yf&&(Yf=0),0>$f&&($f=0),p(),$i&&he(Ff.data.targets)&&(Wf.left=Xf/2+cg)}function o(){nj.select("line."+f.xgridFocus).attr("x1",ih?0:-10).attr("x2",ih?Xf:-10).attr("y1",ih?-10:Uf.top).attr("y2",ih?-10:Zf)}function p(){cg=Zf/2,bg=.95*cg,dg=ge(Ff.data.targets)?.6*bg:0}function q(){var a=ih?f.axisX:f.axisY,b=nj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Ef.select(Hf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return If?If:x()}function s(){var a=Jf?Jf:y();return a>0?a:320}function t(){return he(Ff.data.targets)?0:Kf?Kf:ih?jh?v("x"):1:!Bh||Gh?1:v("y")}function u(){var a=1;return he(Ff.data.targets)?0:Lf?Lf:$i?P()+(Kh&&!ih?v("y2"):a):Kh?Ph||ih?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||jh?"x"===a&&yh?yh:"y"!==a||Bh?"y2"!==a||Kh?(jb(a).isInner?30:40)+("y2"===a?-10:0):fj:ch&&!$i?10:1:0}function x(){return+Ef.select(Hf).style("width").replace("px","")}function y(){return+Ef.select(Hf).style("height").replace("px","")}function z(a){return a?-5:-(Uf.left-1)}function A(a){return a?-20:-4}function B(){return z(!ih)}function C(){return A(!ih)}function D(){return z(ih)}function E(){return A(ih)}function F(a){return a?Xf+2+4:Uf.left+20}function G(a){return a?(yh?yh:0)+80:Zf+8}function H(){return F(!ih)}function I(){return G(!ih)}function J(){return F(ih)}function K(){return G(ih)}function L(){var a,b,c,d,e,f=Ac(Ff.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=qg(b.x)-qg(a.x),0===c?ih?Zf:Xf:(d=zc(),e=de(Ff.data.targets)?(d-(Ii?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function M(a){_i=a}function N(a){aj=a}function O(a){bj=a}function P(){return ch?$i?aj*(_i+1):_f:0}function Q(){return ch?$i?ag:bj*(_i+1):0}function R(){var a,b,c=!qg;ig=ih?1:0,jg=ih?Zf:Xf,kg=ih?0:Zf,lg=ih?Xf:1,mg=ig,ng=jg,og=ih?0:$f,pg=ih?Yf:1,qg=T(ig,jg,c?void 0:qg.domain(),function(){return wg.tickOffset()}),rg=U(kg,lg,c?void 0:rg.domain()),sg=U(kg,lg,c?void 0:sg.domain()),tg=T(ig,jg,sj,function(a){return a%1?0:zg.tickOffset()}),ug=U(og,pg,c?void 0:ug.domain()),vg=U(og,pg,c?void 0:vg.domain()),a=$(),b=th?th:c?void 0:wg.tickValues(),wg=X(qg,Vi,a,b),zg=X(tg,Yi,a,b),xg=Y(rg,Wi,Hh,Jh),yg=Y(sg,Xi,Qh,Sh),c||(gj.scale(tg),Mf&&kj.scale(qg)),S()}function S(){eg=Gb(),fg=Hb(),gg=Hb(.98)}function T(a,b,d,e){var f=(Hi?Ef.time.scale():Ef.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Ii){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=Ef.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?sg:rg}function W(a){return"y2"===Z(a)?vg:ug}function X(a,b,c,d){var e=(Ii?Eb():Ef.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Ii?(e.tickCentered(nh),Ae(ph)&&(ph=!1)):e.tickOffset=function(){var a=Bc(Ff.data.targets),b=qg(a[1])-qg(a[0]),c=b?b:ih?Zf:Xf;return c/zc()/2},Ii&&e.categories(mh),e}function Y(a,b,c,d){return Ef.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Hg?Hg[a]:"y"}function $(){var a=Hi?Si:Ii?Tc:function(a){return 0>a?a.toFixed(0):a};return oh&&("function"==typeof oh?a=oh:Hi&&(a=function(a){return a?Ri(oh)(a):""})),a}function _(a){var b;return"y"===a?b=Fh:"y2"===a?b=Oh:"x"===a&&(b=Ah),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Fh=b:"y2"===a?Oh=b:"x"===a&&(Ah=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",ih?"inner-top":"inner-right")}function hb(){return fb("y",ih?"inner-right":"inner-top")}function ib(){return fb("y2",ih?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Xf/2:Xf:b.isBottom?-Zf:b.isMiddle?-Zf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!ih,gb())}function rb(){return nb(ih,hb())}function sb(){return nb(ih,ib())}function tb(){return ob(!ih,gb())}function ub(){return ob(ih,hb())}function vb(){return ob(ih,ib())}function wb(){var a=gb();return ih?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":yh?yh-10:"3em"}function xb(){var a=hb();return ih?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return ih?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!ih,gb())}function Ab(){return pb(ih,hb())}function Bb(){return pb(ih,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return Ef.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){nj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),nj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),nj.select("."+f.axisY2+" ."+f.axisY2Label).transition().attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 Ef.min(Object.keys(i).map(function(a){return Ef.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(Gg.length>0)for(g=Sc(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 Ef.max(Object.keys(i).map(function(a){return Ef.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Mh:Dh,n="y2"===c?Lh:Ch,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Nh:Eh,r=xd()&&ih;return 0===l.length?"y2"===c?sg.domain():rg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=yd(o,p),j=ac(rg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),"y2"===c&&Rh&&(f=b(Rh.top)?Rh.top:e,g=b(Rh.bottom)?Rh.bottom:e),de(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return wh?Hi?we(wh):wh:Ef.min(a,function(a){return Ef.min(a.values,function(a){return a.x})})}function Zb(a){return vh?Hi?we(vh):vh:Ef.max(a,function(a){return Ef.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Ii?d=0:de(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof xh&&Be(xh)?(e=b(xh.left)?xh.left:d,f=b(xh.right)?xh.right:d):e=f="number"==typeof xh?xh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return c-d===0&&(c=Hi?new Date(.5*c.getTime()):-.5,d=Hi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Hi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Hi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?rg:sg;return b="y"===a.axis||"y2"===a.axis?ih?Zf:"start"in a?d(a.start):Zf:ih?"end"in a?qg(Hi?we(a.end):a.end):Zf:Zf,c>b?0:b-c}function ic(a){return Ag&&a===Ag||Be(Bg)&&Ce(Bg,a)}function jc(a){return!ic(a)}function kc(a){return Ag?Ag:Be(Bg)?Bg[a]:null}function lc(a,b){var c,d=b&&Be(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=Ff.data.xs[b])}),c}function mc(a,b){return a in Ff.data.xs&&Ff.data.xs[a]&&Ff.data.xs[a][b]?Ff.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){Bg[b]=a[b]})}function oc(a){return 1===Ef.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=Eg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),Ff.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=Hi?a?a instanceof Date?a:we(a):we(mc(c,d)):Ji&&!Ii?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Ff.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Ag?(d=Object.keys(Ff.data.xs),Ff.data.xs[c]=d.length>0?Ff.data.xs[d[0]]:void 0):Be(Bg)&&(Ff.data.xs[c]=lc(f,Ff.data.targets)):Ff.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Ff.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Dg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ji&&Ii&&0===c&&g&&(0===e&&(mh=[]),mh.push(g)),("undefined"==typeof a[b]||Ff.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ig&&be(Cc(c).filter(function(a){return!(a in Jg)}),Ig),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&Ff.data.targets[0].values[a-1]?Ff.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(Ff.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Hi?new Date(i):i);j.push(e)}return Hi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Ti=Ti.concat(a)}function Mc(a){Ti=Ti.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Ui=Ui.concat(a)}function Oc(a){Ui=Ui.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Jd(a,f))),(a[g].x||0===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=De(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Nd(a,b){return Ef.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Od(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 Pd(){return Lg&&"desc"===Lg.toLowerCase()}function Qd(){return Lg&&"asc"===Lg.toLowerCase()}function Rd(a){var b=Qd(),c=Pd();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 Lg&&a.sort(Lg),a}function Sd(a,c){var d,e,f,g,h,i,j,k=he(Ff.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&ui&&(qj.html(xi(a,$(),zd(k),Qi)).style("display","block"),d=qj.property("offsetWidth"),e=qj.property("offsetHeight"),k?(g=Xf/2+c[0],i=Zf/2+c[1]+20):(ih?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=qg(l[0].x)+20):(f=q(),g=f+t()+qg(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),qj.style("top",i+"px").style("left",g+"px"))}function Td(){qj.style("display","none")}function Ud(a){var c=a.filter(function(a){return a&&b(a.value)});ui&&(ee(Ff.data.targets)||he(Ff.data.targets)||nj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(ih?"y1":"x1",Fd).attr(ih?"y2":"x2",Fd))}function Vd(){nj.select("line."+f.xgridFocus).style("visibility","hidden")}function Wd(a){return a.x||0===a.x?qg(a.x):null}function Xd(a){return V(a.id)(a.value)}function Yd(){var a,b,d={},e=0;return Ic(Fc(ke)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ae(a,b){return"number"==typeof ei?ei:b?2*a.tickOffset()*fi/b:0}function be(a,b){Dc(a).forEach(function(a){uj[a]=b===Jg[a],Jg[a]=b})}function ce(a,b){var c=!1;return a.forEach(function(a){Jg[a.id]===b&&(c=!0),a.id in Jg||"line"!==b||(c=!0)}),c}function de(a){return ce(a,"bar")}function ee(a){return ce(a,"scatter")}function fe(a){return ce(a,"pie")}function ge(a){return ce(a,"donut")}function he(a){return fe(a)||ge(a)}function ie(a){var b="string"==typeof a?a:a.id;return!(b in Jg)||"line"===Jg[b]||"spline"===Jg[b]||"area"===Jg[b]||"area-spline"===Jg[b]}function je(a){var b="string"==typeof a?a:a.id;return"spline"===Jg[b]||"area-spline"===Jg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"bar"===Jg[b]}function le(a){var b="string"==typeof a?a:a.id;return"scatter"===Jg[b]}function me(a){var b="string"==typeof a?a:a.id;return"pie"===Jg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"donut"===Jg[b]}function oe(a){return me(a)||ne(a)}function pe(a){return ie(a)?[a]:[]}function qe(a){return oe(a.data)?[a]:[]}function re(a){return ke(a)?a.values:[]}function se(a){return ie(a)||le(a)?a.values:[]}function te(a){return ke(a)||ie(a)?a.values:[]}function ue(a){return ne(a)&&oi||me(a)&&ii}function ve(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function we(b){var c;try{c=Cg?Ef.time.format(Cg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Cg)}return c}function xe(a,b){var c=Ef.mouse(a),d=Ef.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ce(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function De(a,b){var c="y"===Z(a.id)?rg:sg,d=ih?1:0,e=ih?0:1;return Math.pow(qg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ee(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Fe(a,b,c){Xg(b,a.node()),nj.select("."+f.selectedCircles+od(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",ih?Xd:Wd).attr("cy",ih?Wd:Xd).attr("stroke",function(){return Qi(b)}).attr("r",1.4*Qe(b)).transition().duration(100).attr("r",Qe)}function Ge(a,b,c){Yg(b,a.node()),nj.select("."+f.selectedCircles+od(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function He(a,b,c,d){a?Fe(b,c,d):Ge(b,c,d)}function Ie(a,b){Xg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ef.rgb(Qi(b)).brighter(.75)})}function Je(a,b){Yg(b,a.node()),a.transition().duration(100).style("fill",function(){return Qi(b)})}function Ke(a,b,c,d){a?Ie(b,c,d):Je(b,c,d)}function Le(a,b,c,d){Ke(a,b,c.data,d)}function Me(a){return"circle"===a.nodeName?He:Ef.select(a).classed(f.bar)?Ke:Le}function Ne(a){return a.filter(function(a){return b(a.value)})}function Oe(a){return Zh?"function"==typeof $h?$h(a):$h:0}function Pe(a){return ai?bi?bi:1.75*Oe(a):Oe(a)}function Qe(a){return ci?ci:4*Oe(a)}function Re(a,c){return(c?nj.selectAll("."+f.circles+od(c)):nj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Se(a,b){Re(a,b).classed(f.EXPANDED,!0).attr("r",Pe)}function Te(a){Re(a).filter(function(){return Ef.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oe)}function Ue(a){return nj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ve(a){Ue(a).classed(f.EXPANDED,!0)}function We(a){Ue(a).classed(f.EXPANDED,!1)}function Xe(a,b){var c=_e(a,b);return function(a,b){var d=c(a,b),e=ih?1:0,f=ih?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 Ye(a,b){var c=_e(a,!1),d=b?Ze:$e;return function(a,b){return d(c(a,b),a,this)}}function Ze(a,b){var c;return ih?(c=ke(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function $e(a,b,c){var d=c.getBoundingClientRect();return ih?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ke(b)?-3:-6)}function _e(a,b){var c=a.__max__+1,d=ae(wg,c),e=Zd(d,c,a,!!b),f=$d(!!b),g=_d(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return ih&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function af(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 bf(b){var c,d,e;if(rj=Ef.select(Hf),rj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(rj.html("").classed("c3",!0),Ff.data.xs={},Ff.data.targets=vc(b),Pg&&Lc(Pg===!0?Cc(Ff.data.targets):Pg),n(),R(),qg.domain(Ef.extent(_b(Ff.data.targets))),rg.domain(Xb(Ff.data.targets,"y")),sg.domain(Xb(Ff.data.targets,"y2")),tg.domain(qg.domain()),ug.domain(rg.domain()),vg.domain(sg.domain()),sj=qg.domain(),gj.scale(tg),Mf&&kj.scale(qg),lj=rj.append("svg").on("mouseenter",Pf).on("mouseleave",Qf),mj=lj.append("defs"),mj.append("clipPath").attr("id",Bi).append("rect"),mj.append("clipPath").attr("id",Ci).append("rect"),mj.append("clipPath").attr("id",Di).append("rect"),nf(),nj=lj.append("g").attr("transform",Zi.main),oj=lj.append("g").attr("transform",Zi.context),pj=lj.append("g").attr("transform",Zi.legend),_g||oj.style("visibility","hidden"),ch||(pj.style("visibility","hidden"),Ui=Cc(Ff.data.targets)),qj=Ef.select(Hf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),zf(Cc(Ff.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=nj.append("g").attr("clip-path",Ei).attr("class",f.grid),Th&&d.append("g").attr("class",f.xgrids),Be(Vh)&&d.append("g").attr("class",f.xgridLines),_h&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Wh&&d.append("g").attr("class",f.ygrids),Be(Xh)&&d.append("g").attr("class",f.ygridLines),jh&&nj.append("g").attr("class",f.axisX).attr("clip-path",Fi).attr("transform",Zi.x).append("text").attr("class",f.axisXLabel).attr("transform",ih?"rotate(-90)":"").style("text-anchor",zb),Bh&&nj.append("g").attr("class",f.axisY).attr("clip-path",Gi).attr("transform",Zi.y).append("text").attr("class",f.axisYLabel).attr("transform",ih?"":"rotate(-90)").style("text-anchor",Ab),Kh&&nj.append("g").attr("class",f.axisY2).attr("transform",Zi.y2).append("text").attr("class",f.axisY2Label).attr("transform",ih?"":"rotate(-90)").style("text-anchor",Bb),nj.append("g").attr("clip-path",Ei).attr("class",f.regions),nj.append("g").attr("clip-path",Ei).attr("class",f.chart),c=nj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Mf?ih?"ns-resize":"ew-resize":null),nj.select("."+f.chart).append("g").attr("class",f.chartBars),nj.select("."+f.chart).append("g").attr("class",f.chartLines),nj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Zi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),nj.select("."+f.chart).append("g").attr("class",f.chartTexts),Mf&&nj.insert("rect",Of?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Xf).attr("height",Zf).style("opacity",0).style("cursor",ih?"ns-resize":"ew-resize").call(kj).on("dblclick.zoom",null),zh&&gj.extent("function"!=typeof zh?zh:zh(_b())),oj.append("g").attr("clip-path",Ei).attr("class",f.chart),oj.select("."+f.chart).append("g").attr("class",f.chartBars),oj.select("."+f.chart).append("g").attr("class",f.chartLines),oj.append("g").attr("clip-path",Ei).attr("class",f.brush).call(gj).selectAll("rect").attr(ih?"width":"height",ih?Yf:$f),oj.append("g").attr("class",f.axisX).attr("transform",Zi.subx).attr("clip-path",ih?"":Fi),pf(Ff.data.targets),ih?nj.select("."+f.axisX).style("opacity",0).call(wg):(nj.select("."+f.axisY).style("opacity",0).call(xg),nj.select("."+f.axisY2).style("opacity",0).call(yg)),n(),R(),nf(),m(!1),jf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),yi){if(Hi&&"string"==typeof zi){for(zi=we(zi),e=0;e0){d=[];for(var g in Eg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Od(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ke,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 gf(a){he(Ff.data.targets)||Qg&&(Ki=a,nj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Li=!0,Zg())}function hf(){he(Ff.data.targets)||Qg&&(nj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),nj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Li=!1,$g())}function jf(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z=Yd(),$=he(Ff.data.targets),_=Ic(Ff.data.targets);if(a=d(a)?a:{},E=d(a.withY)?a.withY:!0,F=d(a.withSubchart)?a.withSubchart:!0,G=d(a.withTransition)?a.withTransition:!0,J=d(a.withTransform)?a.withTransform:!1,K=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,M=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,N=d(a.withLegend)?a.withLegend:!1,H=d(a.withTransitionForExit)?a.withTransitionForExit:G,I=d(a.withTransitionForAxis)?a.withTransitionForAxis:G,T=G?Tf:0,U=H?T:0,V=I?T:0,c=nj.select("."+f.axisX).style("opacity",$?0:1),g=nj.select("."+f.axisY).style("opacity",$?0:1),h=nj.select("."+f.axisY2).style("opacity",$?0:1),e=oj.select("."+f.axisX).style("opacity",$?0:1),S={axisX:c.transition().duration(V),axisY:g.transition().duration(V),axisY2:h.transition().duration(V),axisSubX:e.transition().duration(V)},N&&ch&&zf(Cc(Ff.data.targets),a,S),Ii&&(0!==_.length&&M&&K||qg.domain([0,c.selectAll(".tick").size()])),_.length&&(M&&(qg.domain(Ef.extent(_b(_))),sj=qg.domain(),Mf&&kj.scale(qg).updateScaleExtent(),tg.domain(qg.domain()),gj.scale(tg)),K&&(qg.domain(gj.empty()?sj:gj.extent()),Mf&&kj.scale(qg).updateScaleExtent()),th||!sh&&!rh||(W=Kc(Jc(_),rh),wg.tickValues(W),zg.tickValues(W))),rg.domain(Xb(_,"y")),sg.domain(Xb(_,"y2")),S.axisX.call(wg),S.axisY.call(xg),S.axisY2.call(yg),S.axisSubX.call(zg),K&&_.length)if(ph&&W){for(X=1;X=0&&Ef.select(this).style("display",b%Y?"none":"block")})}else lj.selectAll("."+f.axisX+" .tick text").style("display","block");if(!ih&&uh&&eb(c,S.axisX,uh),O=Xe(Z),Q=Ye(Z,!0),R=Ye(Z,!1),Db(),ug.domain(rg.domain()),vg.domain(sg.domain()),qj.style("display","none"),o(),nj.select("line."+f.xgridFocus).style("visibility","hidden"),Th){if("year"===Uh){j=[];for(var ab=_b(),bb=ab[0].getFullYear(),cb=ab[1].getFullYear(),db=bb;cb>=db;db++)j.push(new Date(db+"-01-01 00:00:00"))}else j=qg.ticks(10);i=nj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",ih?0:function(a){return qg(a)-wg.tickOffset()}).attr("x2",ih?Xf:function(a){return qg(a)-wg.tickOffset()}).attr("y1",ih?function(a){return qg(a)-wg.tickOffset()}:Uf.top).attr("y2",ih?function(a){return qg(a)-wg.tickOffset()}:Zf).style("opacity",function(){return+Ef.select(this).attr(ih?"y1":"x1")===(ih?Zf:0)?0:1}),i.exit().remove()}Be(Vh)&&(k=nj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Vh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",ih?"":"rotate(-90)").attr("dx",ih?0:-Uf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",ih?0:Gd).attr("x2",ih?Xf:Gd).attr("y1",ih?Gd:Uf.top).attr("y2",ih?Gd:Zf).style("opacity",1),k.select("text").transition().duration(T).attr("x",ih?Xf:0).attr("y",Gd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),E&&Wh&&(m=nj.select("."+f.ygrids).selectAll("."+f.ygrid).data(rg.ticks(Yh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",ih?rg:0).attr("x2",ih?rg:Xf).attr("y1",ih?0:rg).attr("y2",ih?Zf:rg),m.exit().remove()),E&&Be(Xh)&&(n=nj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Xh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",ih?"rotate(-90)":"").attr("dx",ih?0:-Uf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(T).attr("x1",ih?Hd:0).attr("x2",ih?Hd:Xf).attr("y1",ih?0:Hd).attr("y2",ih?Zf:Hd).style("opacity",1),n.select("text").transition().duration(T).attr("x",ih?0:Xf).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(T).style("opacity",0).remove()),v=nj.select("."+f.regions).selectAll("rect."+f.region).data(ti),v.enter().append("rect").style("fill-opacity",0),v.attr("class",hd).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(T).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),v.exit().transition().duration(T).style("fill-opacity",0).remove(),t=nj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),t.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Qi),t.style("opacity",td).transition().duration(T).attr("d",O).style("fill",Qi).style("opacity",1),t.exit().transition().duration(U).style("opacity",0).remove(),q=nj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),q.enter().append("path").attr("class",Zc).style("stroke",Qi),q.style("opacity",td).transition().duration(T).attr("d",hj).style("stroke",Qi).style("opacity",1),q.exit().transition().duration(U).style("opacity",0).remove(),r=nj.selectAll("."+f.areas).selectAll("."+f.area).data(pe),r.enter().append("path").attr("class",fd).style("fill",Qi).style("opacity",function(){return tj=+Ef.select(this).style("opacity"),0}),r.style("opacity",0).transition().duration(T).attr("d",ij).style("fill",Qi).style("opacity",tj),r.exit().transition().duration(U).style("opacity",0).remove(),s=nj.selectAll("."+f.circles).selectAll("."+f.circle).data(se),s.enter().append("circle").attr("class",_c).attr("r",Oe).style("fill",Qi),s.style("opacity",td).transition().duration(T).style("opacity",vd).style("fill",Qi).attr("cx",ih?Xd:Wd).attr("cy",ih?Wd:Xd),s.exit().remove(),w=nj.selectAll("."+f.texts).selectAll("."+f.text).data(te),w.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return ih?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",Qi).style("fill-opacity",0),w.text(function(a){return Ed(a.id)(a.value,a.id)}).style("fill-opacity",ud).transition().duration(T).attr("x",Q).attr("y",R).style("fill",Qi).style("fill-opacity",wd),w.exit().transition().duration(U).style("fill-opacity",0).remove(),u=nj.selectAll("."+f.arcs).selectAll("."+f.arc).data(qe),u.enter().append("path").attr("class",dd).style("fill",function(a){return Qi(a.data)}).style("cursor",function(a){return Sg(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Oi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),vf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Sd(d,Ef.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Oi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),wf(),Td(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();ef(this,a,b),e(d,b)}),u.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Oi=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Fb(a);return c?(b=Ef.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("fill",function(a){return Qi(a.data)}).style("opacity",1).call(Ee,function(){Oi=!1}),u.exit().transition().duration(U).style("opacity",0).remove(),nj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(T).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&oe(a.data)?1:0}),nj.select("."+f.chartArcsTitle).style("opacity",ge(Ff.data.targets)?1:0),_g&&(null!==Ef.event&&"zoom"===Ef.event.type&&gj.extent(qg.orgDomain()).update(),F&&(!ih&&uh&&eb(e,S.axisSubX,uh),gj.empty()||gj.extent(qg.orgDomain()).update(),P=Xe(Z,!0),y=oj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),y.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Qi),y.style("opacity",td).transition().duration(T).attr("d",P).style("opacity",1),y.exit().transition().duration(T).style("opacity",0).remove(),x=oj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),x.enter().append("path").attr("class",Zc).style("stroke",Qi),x.style("opacity",td).transition().duration(T).attr("d",jj).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove())),nj.selectAll("."+f.selectedCircles).filter(function(a){return ke(a)}).selectAll("circle").remove(),nj.selectAll("."+f.selectedCircle).transition().duration(T).attr("cx",ih?Xd:Wd).attr("cy",ih?Wd:Xd),z=nj.select("."+f.eventRects),Be(Bg)&&!oc(Bg)?(z.classed(f.eventRectsMultiple)||z.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),A=nj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),df(A.enter()),A.attr("x",0).attr("y",0).attr("width",Xf).attr("height",Zf)):(z.classed(f.eventRectsSingle)||z.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ji&&!Ii?(D=function(a,b){var c=xc(b),d=yc(b),e=Ff.data.xs[a.id][b];return(qg(d?d:e+50)-qg(c?c:e-50))/2},C=function(a,b){var c=xc(b),d=Ff.data.xs[a.id][b];return(qg(d)+qg(c?c:d-50))/2}):(D=L(),C=function(a){return qg(a.x)-D/2}),B=Ac(Ff.data.targets),nj.select("."+f.eventRects).datum(B?B.values:[]),A=nj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),cf(A.enter()),A.attr("class",id).attr("x",ih?0:C).attr("y",ih?C:0).attr("width",ih?Xf:D).attr("height",ih?D:Zf),A.exit().remove()),Cc(Ff.data.targets).forEach(function(a){uj[a]=!0})}function kf(){jf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function lf(){return"mousemove"===Ef.event.sourceEvent.type&&kj.altDomain?(qg.domain(kj.altDomain),void kj.scale(qg).updateScaleExtent()):(Ii&&qg.orgDomain()[0]===sj[0]&&qg.domain([sj[0]-1e-10,qg.orgDomain()[1]]),jf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Ef.event.sourceEvent.type&&(Mi=!0)))}function mf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function nf(){lj.attr("width",_f).attr("height",ag),lj.select("#"+Bi).select("rect").attr("width",Xf).attr("height",Zf),lj.select("#"+Ci).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),lj.select("#"+Di).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),lj.select("."+f.zoomRect).attr("width",Xf).attr("height",Zf),rj.style("max-height",ag+"px")}function of(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),nf(),m(a.withTransition),jf(a)}function pf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=nj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",kd),j=i.enter().append("g").attr("class",kd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc),e=nj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",md),d=e.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",cd).style("cursor",function(a){return Sg(a)?"pointer":null}),c=nj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",ld),b=c.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",$c),b.append("g").attr("class",gd),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",ad).style("cursor",function(a){return Sg(a)?"pointer":null}),a.forEach(function(a){nj.selectAll("."+f.selectedCircles+od(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=nj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(hg(a)).attr("class",nd),g=h.enter().append("g").attr("class",nd),g.append("g").attr("class",ed),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),_g&&(n=oj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",md),m=n.enter().append("g").style("opacity",0).attr("class",md),m.append("g").attr("class",cd),l=oj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",ld),k=l.enter().append("g").style("opacity",0).attr("class",ld),k.append("g").attr("class",$c)),lj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Tf).style("opacity",1)}function qf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?be(a.id,b.types[a.id]):be(a.id,b.type)}),Ff.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=$i?j:i,l=$i?Q():P();return d&&(w=0,C=0,t=0,u=0),ch&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=$i?u:t,void(hh?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=pj.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,$i?(g=function(a){return t*(.2+B[a])},j=function(a){return A[B[a]]+x[a]}):(g=function(a){return A[B[a]]+x[a]},j=function(a){return u*(.2+B[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=pj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof eh?eh(a):Ff.toggle(a)}).on("mouseover",function(a){Ef.select(this).classed(f.legendItemFocused,!0),Oi||Ff.focus(a),"function"==typeof fh&&fh(a)}).on("mouseout",function(a){Ef.select(this).classed(f.legendItemFocused,!1),Oi||Ff.revert(),"function"==typeof gh&&gh(a)}),o.append("text").text(function(a){return d(Eg[a])?Eg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",$i?h:-200).attr("y",$i?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",$i?i:-200).attr("y",$i?-200:l).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",Qi).attr("x",$i?h:-200).attr("y",$i?-200:j).attr("width",10).attr("height",10),pj.selectAll("text").data(a).text(function(a){return d(Eg[a])?Eg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),pj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),pj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).style("fill",Qi).attr("x",g).attr("y",j),pj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=Ef.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?tf(b):uf(b):cj}),N(t),O(u),M(C),n(),R(),nf(),m(q,c)}function Af(a){return Ec(Ff.data.targets,a.id)}function Bf(a){return"data"in a&&Ec(Ff.data.targets,a.data.id)}function Cf(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 Df(a,b,c){var d=!he(Ff.data.targets);Oi=!1,be(a,b),of(c||{withTransitionForAxis:d})}var Ef=a.d3?a.d3:a.require?a.require("d3"):void 0,Ff={data:{},axis:{},legend:{}},Gf={},Hf=h(["bindto"],"#chart"),If=h(["size","width"]),Jf=h(["size","height"]),Kf=h(["padding","left"],50),Lf=h(["padding","right"]),Mf=h(["zoom","enabled"],!1),Nf=h(["zoom","extent"]),Of=h(["zoom","privileged"],!1),Pf=h(["onenter"],function(){}),Qf=h(["onleave"],function(){}),Rf=h(["onresize"],function(){}),Sf=h(["onresized"],function(){}),Tf=h(["transition","duration"],350);g("data","data is required in config");var Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag=h(["data","x"]),Bg=h(["data","xs"],{}),Cg=h(["data","x_format"]),Dg=h(["data","id_converter"],function(a){return a}),Eg=h(["data","names"],{}),Fg=h(["data","classes"],{}),Gg=h(["data","groups"],[]),Hg=h(["data","axes"],{}),Ig=h(["data","type"]),Jg=h(["data","types"],{}),Kg=h(["data","labels"],{}),Lg=h(["data","order"]),Mg=h(["data","regions"],{}),Ng=h(["data","color"]),Og=h(["data","colors"],{}),Pg=h(["data","hide"],!1),Qg=h(["data","selection","enabled"],!1),Rg=h(["data","selection","grouped"],!1),Sg=h(["data","selection","isselectable"],function(){return!0}),Tg=h(["data","selection","multiple"],!0),Ug=h(["data","onclick"],function(){}),Vg=h(["data","onenter"],function(){}),Wg=h(["data","onleave"],function(){}),Xg=h(["data","onselected"],function(){}),Yg=h(["data","onunselected"],function(){}),Zg=h(["data","ondragstart"],function(){}),$g=h(["data","ondragend"],function(){}),_g=h(["subchart","show"],!1),ah=h(["subchart","size","height"],60),bh=h(["color","pattern"],[]),ch=h(["legend","show"],!0),dh=h(["legend","position"],"bottom"),eh=h(["legend","item","onclick"]),fh=h(["legend","item","onmouseover"]),gh=h(["legend","item","onmouseout"]),hh=h(["legend","equally"],!1),ih=h(["axis","rotated"],!1),jh=h(["axis","x","show"],!0),kh=h(["axis","x","type"],"indexed"),lh=h(["axis","x","localtime"],!0),mh=h(["axis","x","categories"],[]),nh=h(["axis","x","tick","centered"],!1),oh=h(["axis","x","tick","format"]),ph=h(["axis","x","tick","culling"],{}),qh=h(["axis","x","tick","culling","max"],10),rh=h(["axis","x","tick","count"]),sh=h(["axis","x","tick","fit"],!0),th=h(["axis","x","tick","values"],null),uh=h(["axis","x","tick","rotate"]),vh=h(["axis","x","max"],null),wh=h(["axis","x","min"],null),xh=h(["axis","x","padding"],{}),yh=h(["axis","x","height"]),zh=h(["axis","x","default"]),Ah=h(["axis","x","label"],{}),Bh=h(["axis","y","show"],!0),Ch=h(["axis","y","max"]),Dh=h(["axis","y","min"]),Eh=h(["axis","y","center"]),Fh=h(["axis","y","label"],{}),Gh=h(["axis","y","inner"],!1),Hh=h(["axis","y","tick","format"]),Ih=h(["axis","y","padding"]),Jh=h(["axis","y","ticks"],10),Kh=h(["axis","y2","show"],!1),Lh=h(["axis","y2","max"]),Mh=h(["axis","y2","min"]),Nh=h(["axis","y2","center"]),Oh=h(["axis","y2","label"],{}),Ph=h(["axis","y2","inner"],!1),Qh=h(["axis","y2","tick","format"]),Rh=h(["axis","y2","padding"]),Sh=h(["axis","y2","ticks"],10),Th=h(["grid","x","show"],!1),Uh=h(["grid","x","type"],"tick"),Vh=h(["grid","x","lines"],[]),Wh=h(["grid","y","show"],!1),Xh=h(["grid","y","lines"],[]),Yh=h(["grid","y","ticks"],10),Zh=h(["point","show"],!0),$h=h(["point","r"],2.5),_h=h(["point","focus","line","enabled"],!0),ai=h(["point","focus","expand","enabled"],!0),bi=h(["point","focus","expand","r"]),ci=h(["point","focus","select","r"]),di=h(["line","connect_null"],!1),ei=h(["bar","width"]),fi=h(["bar","width","ratio"],.6),gi=h(["pie","label","show"],!0),hi=h(["pie","label","format"]),ii=h(["pie","expand"],!0),ji=h(["pie","onclick"],function(){}),ki=h(["pie","onmouseover"],function(){}),li=h(["pie","onmouseout"],function(){}),mi=h(["donut","label","show"],!0),ni=h(["donut","label","format"]),oi=h(["donut","expand"],!0),pi=h(["donut","title"],""),qi=h(["donut","onclick"],function(){}),ri=h(["donut","onmouseover"],function(){}),si=h(["donut","onmouseout"],function(){}),ti=h(["regions"],[]),ui=h(["tooltip","show"],!0),vi=h(["tooltip","format","title"]),wi=h(["tooltip","format","value"]),xi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=vi?vi:b,l=wi?wi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id,a[g].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),yi=h(["tooltip","init","show"],!1),zi=h(["tooltip","init","x"],0),Ai=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Bi=("string"==typeof Hf?Hf.replace("#",""):Hf.id)+"-clip",Ci=Bi+"-xaxis",Di=Bi+"-yaxis",Ei=i(Bi),Fi=i(Ci),Gi=i(Di),Hi="timeseries"===kh,Ii="categorized"===kh,Ji=!Hi&&(Ag||Be(Bg)),Ki=null,Li=!1,Mi=!1,Ni=!1,Oi=!1,Pi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Qi=ve(Og,Be(bh)?bh:Pi,Ng),Ri=lh?Ef.time.format:Ef.time.format.utc,Si=function(){var a=[[Ri("%Y/%-m/%-d"),function(){return!0}],[Ri("%-m/%-d"),function(a){return a.getMonth()}],[Ri("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ri("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ri("%I %p"),function(a){return a.getHours()}],[Ri("%I:%M"),function(a){return a.getMinutes()}],[Ri(":%S"),function(a){return a.getSeconds()}],[Ri(".%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)}}(),Ti=[],Ui=[],Vi=ih?"left":"bottom",Wi=ih?Gh?"top":"bottom":Gh?"right":"left",Xi=ih?Ph?"bottom":"top":Ph?"left":"right",Yi=ih?"left":"bottom",Zi={main:function(){return"translate("+Uf.left+","+Uf.top+")"},context:function(){return"translate("+Vf.left+","+Vf.top+")"},legend:function(){return"translate("+Wf.left+","+Wf.top+")"},x:function(){return"translate(0,"+(ih?0:Zf)+")"},y:function(){return"translate(0,"+(ih?Zf:0)+")"},y2:function(){return"translate("+(ih?0:Xf)+","+(ih?1:0)+")"},subx:function(){return"translate(0,"+(ih?0:$f)+")"},arc:function(){return"translate("+Xf/2+","+Zf/2+")"}},$i="right"===dh,_i=0,aj=0,bj=0,cj=.15,dj=30,ej=ih&&!jh?0:30,fj=5;hg=Ef.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var gj,hj=function(){var a=Ef.svg.line().x(ih?function(a){return V(a.id)(a.value)}:Fd).y(ih?Fd:function(a){return V(a.id)(a.value)});return di||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=di?Ne(b.values):b.values;return ie(b)?(a.interpolate(je(b)?"cardinal":"linear"),Mg[b.id]?af(e,qg,V(b.id),Mg[b.id]):a(e)):(c=e[0]?qg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ih?"M "+d+" "+c:"M "+c+" "+d)}}(),ij=function(){var a;return a=ih?Ef.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Fd):Ef.svg.area().x(Fd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ne(b.values);return ce([b],"area")||ce([b],"area-spline")?(a.interpolate(je(b)?"cardinal":"linear"),a(e)):(c=e[0]?qg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ih?"M "+d+" "+c:"M "+c+" "+d)}}(),jj=function(){var a=Ef.svg.line().x(ih?function(a){return W(a.id)(a.value)}:Id).y(ih?Id:function(a){return W(a.id)(a.value)});return function(b){var c=Ne(b.values);return ie(b)?a(c):"M "+tg(c[0].x)+" "+W(b.id)(c[0].value)}}(),kj=function(){};gj=Ef.svg.brush().on("brush",kf),gj.update=function(){return oj&&oj.select("."+f.brush).call(this),this},gj.scale=function(a){return ih?this.y(a):this.x(a)},Mf&&(kj=Ef.behavior.zoom().on("zoomstart",function(){kj.altDomain=Ef.event.sourceEvent.altKey?qg.orgDomain():null}).on("zoom",Mf?lf:null),kj.scale=function(a){return ih?this.y(a):this.x(a)},kj.orgScaleExtent=function(){var a=Nf?Nf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},kj.updateScaleExtent=function(){var a=ac(qg.orgDomain())/ac(sj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var lj,mj,nj,oj,pj,qj,rj,sj,tj,uj={};if(Ff.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=lj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);Ff.revert(),Ff.defocus(),b(d.classed(f.focused,!0)),b(e),he(Ff.data.targets)&&Nb(a,!0),vf(a,!0)},Ff.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=lj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);Ff.revert(),b(d.classed(f.focused,!1)),b(e),he(Ff.data.targets)&&Ob(a),vf(a,!1)},Ff.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=lj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);b(d.classed(f.focused,!1)),b(e),he(Ff.data.targets)&&Ob(a),wf()},Ff.show=function(a,b){a=Dc(a),b=b||{},Mc(a),lj.selectAll(qd(a)).transition().style("opacity",1),b.withLegend&&xf(a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ff.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),lj.selectAll(qd(a)).transition().style("opacity",0),b.withLegend&&yf(a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ff.toggle=function(a){Gc(a)?Ff.hide(a):Ff.show(a)},Ff.unzoom=function(){gj.clear().update(),jf({withUpdateXDomain:!0})},Ff.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Fg[b]=a.classes[b]}),"categories"in a&&Ii&&(mh=a.categories,wg.categories(mh)),"cacheIds"in a&&bc(a.cacheIds)?void qf(dc(a.cacheIds),a.done):void("unload"in a?sf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){rf(a)}):rf(a))},Ff.unload=function(a,b){sf(Dc(a),function(){jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Ff.selected=function(a){return Ef.merge(nj.selectAll("."+f.shapes+od(a)).selectAll("."+f.shape).filter(function(){return Ef.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Ff.select=function(a,b,c){Qg&&nj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=Ef.select(this),i=e.data?e.data.id:e.id,j=Me(this),k=Rg||!a||a.indexOf(i)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Sg(e)&&!m&&j(!0,h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(!1,h.classed(f.SELECTED,!1),e,g)})},Ff.unselect=function(a,b){Qg&&nj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=Ef.select(this),g=c.data?c.data.id:c.id,h=Me(this),i=Rg||!a||a.indexOf(g)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(f.SELECTED); +i&&j&&Sg(c)&&k&&h(!1,e.classed(f.SELECTED,!1),c,d)})},Ff.toLine=function(a){Df(a,"line")},Ff.toSpline=function(a){Df(a,"spline")},Ff.toBar=function(a){Df(a,"bar")},Ff.toScatter=function(a){Df(a,"scatter")},Ff.toArea=function(a){Df(a,"area")},Ff.toAreaSpline=function(a){Df(a,"area-spline")},Ff.toPie=function(a){Df(a,"pie",{withTransform:!0})},Ff.toDonut=function(a){Df(a,"donut",{withTransform:!0})},Ff.groups=function(a){return c(a)?Gg:(Gg=a,jf(),Gg)},Ff.xgrids=function(a){return a?(Vh=a,jf(),Vh):Vh},Ff.xgrids.add=function(a){return a?Ff.xgrids(Vh.concat(a)):void 0},Ff.xgrids.remove=function(a){var b=Cf(a);return Ff.xgrids(Vh.filter(b))},Ff.ygrids=function(a){return a?(Xh=a,jf(),Xh):Xh},Ff.ygrids.add=function(a){return a?Ff.ygrids(Xh.concat(a)):void 0},Ff.ygrids.remove=function(a){var b=Cf(a);return Ff.ygrids(Xh.filter(b))},Ff.regions=function(a){return c(a)?ti:(ti=a,jf(),ti)},Ff.regions.add=function(a){return c(a)?ti:(ti=ti.concat(a),jf(),ti)},Ff.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;lj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ti=ti.filter(function(b){return b.classes.indexOf(a)<0})}),ti},Ff.data.get=function(a){var b=Ff.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Ff.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},Ff.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Eg[b]=a[b]}),zf(Cc(Ff.data.targets),{withTransition:!0}),Eg):Eg},Ff.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Og[b]=a[b]}),jf({withLegend:!0}),Og):Og},Ff.x=function(a){return arguments.length&&(qc(Ff.data.targets,a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ff.data.xs},Ff.xs=function(a){return arguments.length&&(rc(Ff.data.targets,a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ff.data.xs},Ff.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},Ff.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Ch=+a.y),b(a.y2)&&(Lh=+a.y2)):Ch=Lh=+a,jf())},Ff.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Dh=+a.y),b(a.y2)&&(Mh=+a.y2)):Dh=Mh=+a,jf())},Ff.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Ff.axis.max(a.max),"undefined"!=typeof a.min&&Ff.axis.min(a.min))},Ff.legend.show=function(a){xf(Dc(a)),jf({withLegend:!0})},Ff.legend.hide=function(a){yf(Dc(a)),jf({withLegend:!0})},Ff.resize=function(a){If=a?a.width:null,Jf=a?a.height:null,of({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Ff.destroy=function(){Ff.data.targets=void 0,Ff.data.xs={},rj.html(""),a.onresize=null},"url"in e.data)Ef.xhr(e.data.url,function(a,b){var c,d=Ef.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Ef.csv.parse(b.response),bf(c)});else if("rows"in e.data)bf(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");bf(uc(e.data.columns))}return Ff},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From e7a57774a9b339cdd221ad6bcd12345af76ccb98 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Fri, 2 May 2014 19:12:37 +0900 Subject: [PATCH 120/178] Update sample for data.lable.format --- htdocs/samples/data_label_format.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/samples/data_label_format.html b/htdocs/samples/data_label_format.html index 17fb19d..466a4a0 100644 --- a/htdocs/samples/data_label_format.html +++ b/htdocs/samples/data_label_format.html @@ -15,10 +15,10 @@ ['data2', 50, 20, 10, 40, 15, 25] ], labels: { -// format: function (v) { return "Default Format"; }, +// format: function (v, id) { return "Default Format on " + id; }, format: { - y: function (v) { return "Y Format"; }, - y2: function (v) { return "Y2 Format"; } + y: function (v, id) { return "Y Format on " + id; }, + y2: function (v, id) { return "Y2 Format on " + id; } } }, axes: { From 1c81c418cb0d302886ecbff078514040aa6e016d Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Fri, 2 May 2014 19:15:29 +0900 Subject: [PATCH 121/178] Fix legend positioning - #176 --- c3.js | 6 +++--- c3.min.js | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/c3.js b/c3.js index 042ba68..752a651 100644 --- a/c3.js +++ b/c3.js @@ -511,7 +511,7 @@ } else if (__padding_right) { return __padding_right; } else if (isLegendRight) { - return getLegendWidth() + (__axis_y2_show && !__axis_rotated ? getAxisWidthByAxisId('y2') : defaultPadding); + return getLegendWidth() + 20 + (__axis_y2_show && !__axis_rotated ? getAxisWidthByAxisId('y2') : defaultPadding); } else if (__axis_y2_show) { return __axis_y2_inner || __axis_rotated ? defaultPadding : getAxisWidthByAxisId('y2'); } else { @@ -4081,11 +4081,11 @@ } if (isLegendRight) { - xForLegend = function (id) { return maxWidth * (0.2 + steps[id]); }; + xForLegend = function (id) { return maxWidth * steps[id]; }; yForLegend = function (id) { return margins[steps[id]] + offsets[id]; }; } else { xForLegend = function (id) { return margins[steps[id]] + offsets[id]; }; - yForLegend = function (id) { return maxHeight * (0.2 + steps[id]); }; + yForLegend = function (id) { return maxHeight * steps[id]; }; } xForLegendText = function (id, i) { return xForLegend(id, i) + 14; }; yForLegendText = function (id, i) { return yForLegend(id, i) + 9; }; diff --git a/c3.min.js b/c3.min.js index 56ec73a..806dcc8 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.34"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",lines:"c3-lines",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",arcs:"c3-arcs",area:"c3-area",areas:"c3-areas",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",legendItemFocused:"c3-legend-item-focused",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;cXf&&(Xf=0),0>Zf&&(Zf=0),Yf=ih?Uf.left-dj-ej:Xf,$f=ih?Zf:ag-Vf.top-Vf.bottom,0>Yf&&(Yf=0),0>$f&&($f=0),p(),$i&&he(Ff.data.targets)&&(Wf.left=Xf/2+cg)}function o(){nj.select("line."+f.xgridFocus).attr("x1",ih?0:-10).attr("x2",ih?Xf:-10).attr("y1",ih?-10:Uf.top).attr("y2",ih?-10:Zf)}function p(){cg=Zf/2,bg=.95*cg,dg=ge(Ff.data.targets)?.6*bg:0}function q(){var a=ih?f.axisX:f.axisY,b=nj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Ef.select(Hf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return If?If:x()}function s(){var a=Jf?Jf:y();return a>0?a:320}function t(){return he(Ff.data.targets)?0:Kf?Kf:ih?jh?v("x"):1:!Bh||Gh?1:v("y")}function u(){var a=1;return he(Ff.data.targets)?0:Lf?Lf:$i?P()+(Kh&&!ih?v("y2"):a):Kh?Ph||ih?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||jh?"x"===a&&yh?yh:"y"!==a||Bh?"y2"!==a||Kh?(jb(a).isInner?30:40)+("y2"===a?-10:0):fj:ch&&!$i?10:1:0}function x(){return+Ef.select(Hf).style("width").replace("px","")}function y(){return+Ef.select(Hf).style("height").replace("px","")}function z(a){return a?-5:-(Uf.left-1)}function A(a){return a?-20:-4}function B(){return z(!ih)}function C(){return A(!ih)}function D(){return z(ih)}function E(){return A(ih)}function F(a){return a?Xf+2+4:Uf.left+20}function G(a){return a?(yh?yh:0)+80:Zf+8}function H(){return F(!ih)}function I(){return G(!ih)}function J(){return F(ih)}function K(){return G(ih)}function L(){var a,b,c,d,e,f=Ac(Ff.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=qg(b.x)-qg(a.x),0===c?ih?Zf:Xf:(d=zc(),e=de(Ff.data.targets)?(d-(Ii?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function M(a){_i=a}function N(a){aj=a}function O(a){bj=a}function P(){return ch?$i?aj*(_i+1):_f:0}function Q(){return ch?$i?ag:bj*(_i+1):0}function R(){var a,b,c=!qg;ig=ih?1:0,jg=ih?Zf:Xf,kg=ih?0:Zf,lg=ih?Xf:1,mg=ig,ng=jg,og=ih?0:$f,pg=ih?Yf:1,qg=T(ig,jg,c?void 0:qg.domain(),function(){return wg.tickOffset()}),rg=U(kg,lg,c?void 0:rg.domain()),sg=U(kg,lg,c?void 0:sg.domain()),tg=T(ig,jg,sj,function(a){return a%1?0:zg.tickOffset()}),ug=U(og,pg,c?void 0:ug.domain()),vg=U(og,pg,c?void 0:vg.domain()),a=$(),b=th?th:c?void 0:wg.tickValues(),wg=X(qg,Vi,a,b),zg=X(tg,Yi,a,b),xg=Y(rg,Wi,Hh,Jh),yg=Y(sg,Xi,Qh,Sh),c||(gj.scale(tg),Mf&&kj.scale(qg)),S()}function S(){eg=Gb(),fg=Hb(),gg=Hb(.98)}function T(a,b,d,e){var f=(Hi?Ef.time.scale():Ef.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Ii){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=Ef.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?sg:rg}function W(a){return"y2"===Z(a)?vg:ug}function X(a,b,c,d){var e=(Ii?Eb():Ef.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Ii?(e.tickCentered(nh),Ae(ph)&&(ph=!1)):e.tickOffset=function(){var a=Bc(Ff.data.targets),b=qg(a[1])-qg(a[0]),c=b?b:ih?Zf:Xf;return c/zc()/2},Ii&&e.categories(mh),e}function Y(a,b,c,d){return Ef.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Hg?Hg[a]:"y"}function $(){var a=Hi?Si:Ii?Tc:function(a){return 0>a?a.toFixed(0):a};return oh&&("function"==typeof oh?a=oh:Hi&&(a=function(a){return a?Ri(oh)(a):""})),a}function _(a){var b;return"y"===a?b=Fh:"y2"===a?b=Oh:"x"===a&&(b=Ah),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Fh=b:"y2"===a?Oh=b:"x"===a&&(Ah=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",ih?"inner-top":"inner-right")}function hb(){return fb("y",ih?"inner-right":"inner-top")}function ib(){return fb("y2",ih?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Xf/2:Xf:b.isBottom?-Zf:b.isMiddle?-Zf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!ih,gb())}function rb(){return nb(ih,hb())}function sb(){return nb(ih,ib())}function tb(){return ob(!ih,gb())}function ub(){return ob(ih,hb())}function vb(){return ob(ih,ib())}function wb(){var a=gb();return ih?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":yh?yh-10:"3em"}function xb(){var a=hb();return ih?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return ih?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!ih,gb())}function Ab(){return pb(ih,hb())}function Bb(){return pb(ih,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return Ef.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){nj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),nj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),nj.select("."+f.axisY2+" ."+f.axisY2Label).transition().attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 Ef.min(Object.keys(i).map(function(a){return Ef.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(Gg.length>0)for(g=Sc(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 Ef.max(Object.keys(i).map(function(a){return Ef.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Mh:Dh,n="y2"===c?Lh:Ch,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Nh:Eh,r=xd()&&ih;return 0===l.length?"y2"===c?sg.domain():rg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=yd(o,p),j=ac(rg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),"y2"===c&&Rh&&(f=b(Rh.top)?Rh.top:e,g=b(Rh.bottom)?Rh.bottom:e),de(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return wh?Hi?we(wh):wh:Ef.min(a,function(a){return Ef.min(a.values,function(a){return a.x})})}function Zb(a){return vh?Hi?we(vh):vh:Ef.max(a,function(a){return Ef.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Ii?d=0:de(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof xh&&Be(xh)?(e=b(xh.left)?xh.left:d,f=b(xh.right)?xh.right:d):e=f="number"==typeof xh?xh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return c-d===0&&(c=Hi?new Date(.5*c.getTime()):-.5,d=Hi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Hi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Hi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?rg:sg;return b="y"===a.axis||"y2"===a.axis?ih?Zf:"start"in a?d(a.start):Zf:ih?"end"in a?qg(Hi?we(a.end):a.end):Zf:Zf,c>b?0:b-c}function ic(a){return Ag&&a===Ag||Be(Bg)&&Ce(Bg,a)}function jc(a){return!ic(a)}function kc(a){return Ag?Ag:Be(Bg)?Bg[a]:null}function lc(a,b){var c,d=b&&Be(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=Ff.data.xs[b])}),c}function mc(a,b){return a in Ff.data.xs&&Ff.data.xs[a]&&Ff.data.xs[a][b]?Ff.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){Bg[b]=a[b]})}function oc(a){return 1===Ef.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=Eg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),Ff.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=Hi?a?a instanceof Date?a:we(a):we(mc(c,d)):Ji&&!Ii?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Ff.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Ag?(d=Object.keys(Ff.data.xs),Ff.data.xs[c]=d.length>0?Ff.data.xs[d[0]]:void 0):Be(Bg)&&(Ff.data.xs[c]=lc(f,Ff.data.targets)):Ff.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Ff.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Dg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ji&&Ii&&0===c&&g&&(0===e&&(mh=[]),mh.push(g)),("undefined"==typeof a[b]||Ff.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ig&&be(Cc(c).filter(function(a){return!(a in Jg)}),Ig),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&Ff.data.targets[0].values[a-1]?Ff.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(Ff.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Hi?new Date(i):i);j.push(e)}return Hi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Ti=Ti.concat(a)}function Mc(a){Ti=Ti.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Ui=Ui.concat(a)}function Oc(a){Ui=Ui.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Jd(a,f))),(a[g].x||0===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=De(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Nd(a,b){return Ef.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Od(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 Pd(){return Lg&&"desc"===Lg.toLowerCase()}function Qd(){return Lg&&"asc"===Lg.toLowerCase()}function Rd(a){var b=Qd(),c=Pd();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 Lg&&a.sort(Lg),a}function Sd(a,c){var d,e,f,g,h,i,j,k=he(Ff.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&ui&&(qj.html(xi(a,$(),zd(k),Qi)).style("display","block"),d=qj.property("offsetWidth"),e=qj.property("offsetHeight"),k?(g=Xf/2+c[0],i=Zf/2+c[1]+20):(ih?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=qg(l[0].x)+20):(f=q(),g=f+t()+qg(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),qj.style("top",i+"px").style("left",g+"px"))}function Td(){qj.style("display","none")}function Ud(a){var c=a.filter(function(a){return a&&b(a.value)});ui&&(ee(Ff.data.targets)||he(Ff.data.targets)||nj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(ih?"y1":"x1",Fd).attr(ih?"y2":"x2",Fd))}function Vd(){nj.select("line."+f.xgridFocus).style("visibility","hidden")}function Wd(a){return a.x||0===a.x?qg(a.x):null}function Xd(a){return V(a.id)(a.value)}function Yd(){var a,b,d={},e=0;return Ic(Fc(ke)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ae(a,b){return"number"==typeof ei?ei:b?2*a.tickOffset()*fi/b:0}function be(a,b){Dc(a).forEach(function(a){uj[a]=b===Jg[a],Jg[a]=b})}function ce(a,b){var c=!1;return a.forEach(function(a){Jg[a.id]===b&&(c=!0),a.id in Jg||"line"!==b||(c=!0)}),c}function de(a){return ce(a,"bar")}function ee(a){return ce(a,"scatter")}function fe(a){return ce(a,"pie")}function ge(a){return ce(a,"donut")}function he(a){return fe(a)||ge(a)}function ie(a){var b="string"==typeof a?a:a.id;return!(b in Jg)||"line"===Jg[b]||"spline"===Jg[b]||"area"===Jg[b]||"area-spline"===Jg[b]}function je(a){var b="string"==typeof a?a:a.id;return"spline"===Jg[b]||"area-spline"===Jg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"bar"===Jg[b]}function le(a){var b="string"==typeof a?a:a.id;return"scatter"===Jg[b]}function me(a){var b="string"==typeof a?a:a.id;return"pie"===Jg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"donut"===Jg[b]}function oe(a){return me(a)||ne(a)}function pe(a){return ie(a)?[a]:[]}function qe(a){return oe(a.data)?[a]:[]}function re(a){return ke(a)?a.values:[]}function se(a){return ie(a)||le(a)?a.values:[]}function te(a){return ke(a)||ie(a)?a.values:[]}function ue(a){return ne(a)&&oi||me(a)&&ii}function ve(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function we(b){var c;try{c=Cg?Ef.time.format(Cg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Cg)}return c}function xe(a,b){var c=Ef.mouse(a),d=Ef.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ce(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function De(a,b){var c="y"===Z(a.id)?rg:sg,d=ih?1:0,e=ih?0:1;return Math.pow(qg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ee(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Fe(a,b,c){Xg(b,a.node()),nj.select("."+f.selectedCircles+od(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",ih?Xd:Wd).attr("cy",ih?Wd:Xd).attr("stroke",function(){return Qi(b)}).attr("r",1.4*Qe(b)).transition().duration(100).attr("r",Qe)}function Ge(a,b,c){Yg(b,a.node()),nj.select("."+f.selectedCircles+od(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function He(a,b,c,d){a?Fe(b,c,d):Ge(b,c,d)}function Ie(a,b){Xg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ef.rgb(Qi(b)).brighter(.75)})}function Je(a,b){Yg(b,a.node()),a.transition().duration(100).style("fill",function(){return Qi(b)})}function Ke(a,b,c,d){a?Ie(b,c,d):Je(b,c,d)}function Le(a,b,c,d){Ke(a,b,c.data,d)}function Me(a){return"circle"===a.nodeName?He:Ef.select(a).classed(f.bar)?Ke:Le}function Ne(a){return a.filter(function(a){return b(a.value)})}function Oe(a){return Zh?"function"==typeof $h?$h(a):$h:0}function Pe(a){return ai?bi?bi:1.75*Oe(a):Oe(a)}function Qe(a){return ci?ci:4*Oe(a)}function Re(a,c){return(c?nj.selectAll("."+f.circles+od(c)):nj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Se(a,b){Re(a,b).classed(f.EXPANDED,!0).attr("r",Pe)}function Te(a){Re(a).filter(function(){return Ef.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oe)}function Ue(a){return nj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ve(a){Ue(a).classed(f.EXPANDED,!0)}function We(a){Ue(a).classed(f.EXPANDED,!1)}function Xe(a,b){var c=_e(a,b);return function(a,b){var d=c(a,b),e=ih?1:0,f=ih?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 Ye(a,b){var c=_e(a,!1),d=b?Ze:$e;return function(a,b){return d(c(a,b),a,this)}}function Ze(a,b){var c;return ih?(c=ke(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function $e(a,b,c){var d=c.getBoundingClientRect();return ih?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ke(b)?-3:-6)}function _e(a,b){var c=a.__max__+1,d=ae(wg,c),e=Zd(d,c,a,!!b),f=$d(!!b),g=_d(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return ih&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function af(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 bf(b){var c,d,e;if(rj=Ef.select(Hf),rj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(rj.html("").classed("c3",!0),Ff.data.xs={},Ff.data.targets=vc(b),Pg&&Lc(Pg===!0?Cc(Ff.data.targets):Pg),n(),R(),qg.domain(Ef.extent(_b(Ff.data.targets))),rg.domain(Xb(Ff.data.targets,"y")),sg.domain(Xb(Ff.data.targets,"y2")),tg.domain(qg.domain()),ug.domain(rg.domain()),vg.domain(sg.domain()),sj=qg.domain(),gj.scale(tg),Mf&&kj.scale(qg),lj=rj.append("svg").on("mouseenter",Pf).on("mouseleave",Qf),mj=lj.append("defs"),mj.append("clipPath").attr("id",Bi).append("rect"),mj.append("clipPath").attr("id",Ci).append("rect"),mj.append("clipPath").attr("id",Di).append("rect"),nf(),nj=lj.append("g").attr("transform",Zi.main),oj=lj.append("g").attr("transform",Zi.context),pj=lj.append("g").attr("transform",Zi.legend),_g||oj.style("visibility","hidden"),ch||(pj.style("visibility","hidden"),Ui=Cc(Ff.data.targets)),qj=Ef.select(Hf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),zf(Cc(Ff.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=nj.append("g").attr("clip-path",Ei).attr("class",f.grid),Th&&d.append("g").attr("class",f.xgrids),Be(Vh)&&d.append("g").attr("class",f.xgridLines),_h&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Wh&&d.append("g").attr("class",f.ygrids),Be(Xh)&&d.append("g").attr("class",f.ygridLines),jh&&nj.append("g").attr("class",f.axisX).attr("clip-path",Fi).attr("transform",Zi.x).append("text").attr("class",f.axisXLabel).attr("transform",ih?"rotate(-90)":"").style("text-anchor",zb),Bh&&nj.append("g").attr("class",f.axisY).attr("clip-path",Gi).attr("transform",Zi.y).append("text").attr("class",f.axisYLabel).attr("transform",ih?"":"rotate(-90)").style("text-anchor",Ab),Kh&&nj.append("g").attr("class",f.axisY2).attr("transform",Zi.y2).append("text").attr("class",f.axisY2Label).attr("transform",ih?"":"rotate(-90)").style("text-anchor",Bb),nj.append("g").attr("clip-path",Ei).attr("class",f.regions),nj.append("g").attr("clip-path",Ei).attr("class",f.chart),c=nj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Mf?ih?"ns-resize":"ew-resize":null),nj.select("."+f.chart).append("g").attr("class",f.chartBars),nj.select("."+f.chart).append("g").attr("class",f.chartLines),nj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Zi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),nj.select("."+f.chart).append("g").attr("class",f.chartTexts),Mf&&nj.insert("rect",Of?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Xf).attr("height",Zf).style("opacity",0).style("cursor",ih?"ns-resize":"ew-resize").call(kj).on("dblclick.zoom",null),zh&&gj.extent("function"!=typeof zh?zh:zh(_b())),oj.append("g").attr("clip-path",Ei).attr("class",f.chart),oj.select("."+f.chart).append("g").attr("class",f.chartBars),oj.select("."+f.chart).append("g").attr("class",f.chartLines),oj.append("g").attr("clip-path",Ei).attr("class",f.brush).call(gj).selectAll("rect").attr(ih?"width":"height",ih?Yf:$f),oj.append("g").attr("class",f.axisX).attr("transform",Zi.subx).attr("clip-path",ih?"":Fi),pf(Ff.data.targets),ih?nj.select("."+f.axisX).style("opacity",0).call(wg):(nj.select("."+f.axisY).style("opacity",0).call(xg),nj.select("."+f.axisY2).style("opacity",0).call(yg)),n(),R(),nf(),m(!1),jf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),yi){if(Hi&&"string"==typeof zi){for(zi=we(zi),e=0;e0){d=[];for(var g in Eg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Od(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ke,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 gf(a){he(Ff.data.targets)||Qg&&(Ki=a,nj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Li=!0,Zg())}function hf(){he(Ff.data.targets)||Qg&&(nj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),nj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Li=!1,$g())}function jf(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z=Yd(),$=he(Ff.data.targets),_=Ic(Ff.data.targets);if(a=d(a)?a:{},E=d(a.withY)?a.withY:!0,F=d(a.withSubchart)?a.withSubchart:!0,G=d(a.withTransition)?a.withTransition:!0,J=d(a.withTransform)?a.withTransform:!1,K=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,M=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,N=d(a.withLegend)?a.withLegend:!1,H=d(a.withTransitionForExit)?a.withTransitionForExit:G,I=d(a.withTransitionForAxis)?a.withTransitionForAxis:G,T=G?Tf:0,U=H?T:0,V=I?T:0,c=nj.select("."+f.axisX).style("opacity",$?0:1),g=nj.select("."+f.axisY).style("opacity",$?0:1),h=nj.select("."+f.axisY2).style("opacity",$?0:1),e=oj.select("."+f.axisX).style("opacity",$?0:1),S={axisX:c.transition().duration(V),axisY:g.transition().duration(V),axisY2:h.transition().duration(V),axisSubX:e.transition().duration(V)},N&&ch&&zf(Cc(Ff.data.targets),a,S),Ii&&(0!==_.length&&M&&K||qg.domain([0,c.selectAll(".tick").size()])),_.length&&(M&&(qg.domain(Ef.extent(_b(_))),sj=qg.domain(),Mf&&kj.scale(qg).updateScaleExtent(),tg.domain(qg.domain()),gj.scale(tg)),K&&(qg.domain(gj.empty()?sj:gj.extent()),Mf&&kj.scale(qg).updateScaleExtent()),th||!sh&&!rh||(W=Kc(Jc(_),rh),wg.tickValues(W),zg.tickValues(W))),rg.domain(Xb(_,"y")),sg.domain(Xb(_,"y2")),S.axisX.call(wg),S.axisY.call(xg),S.axisY2.call(yg),S.axisSubX.call(zg),K&&_.length)if(ph&&W){for(X=1;X=0&&Ef.select(this).style("display",b%Y?"none":"block")})}else lj.selectAll("."+f.axisX+" .tick text").style("display","block");if(!ih&&uh&&eb(c,S.axisX,uh),O=Xe(Z),Q=Ye(Z,!0),R=Ye(Z,!1),Db(),ug.domain(rg.domain()),vg.domain(sg.domain()),qj.style("display","none"),o(),nj.select("line."+f.xgridFocus).style("visibility","hidden"),Th){if("year"===Uh){j=[];for(var ab=_b(),bb=ab[0].getFullYear(),cb=ab[1].getFullYear(),db=bb;cb>=db;db++)j.push(new Date(db+"-01-01 00:00:00"))}else j=qg.ticks(10);i=nj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",ih?0:function(a){return qg(a)-wg.tickOffset()}).attr("x2",ih?Xf:function(a){return qg(a)-wg.tickOffset()}).attr("y1",ih?function(a){return qg(a)-wg.tickOffset()}:Uf.top).attr("y2",ih?function(a){return qg(a)-wg.tickOffset()}:Zf).style("opacity",function(){return+Ef.select(this).attr(ih?"y1":"x1")===(ih?Zf:0)?0:1}),i.exit().remove()}Be(Vh)&&(k=nj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Vh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",ih?"":"rotate(-90)").attr("dx",ih?0:-Uf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",ih?0:Gd).attr("x2",ih?Xf:Gd).attr("y1",ih?Gd:Uf.top).attr("y2",ih?Gd:Zf).style("opacity",1),k.select("text").transition().duration(T).attr("x",ih?Xf:0).attr("y",Gd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),E&&Wh&&(m=nj.select("."+f.ygrids).selectAll("."+f.ygrid).data(rg.ticks(Yh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",ih?rg:0).attr("x2",ih?rg:Xf).attr("y1",ih?0:rg).attr("y2",ih?Zf:rg),m.exit().remove()),E&&Be(Xh)&&(n=nj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Xh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",ih?"rotate(-90)":"").attr("dx",ih?0:-Uf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(T).attr("x1",ih?Hd:0).attr("x2",ih?Hd:Xf).attr("y1",ih?0:Hd).attr("y2",ih?Zf:Hd).style("opacity",1),n.select("text").transition().duration(T).attr("x",ih?0:Xf).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(T).style("opacity",0).remove()),v=nj.select("."+f.regions).selectAll("rect."+f.region).data(ti),v.enter().append("rect").style("fill-opacity",0),v.attr("class",hd).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(T).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),v.exit().transition().duration(T).style("fill-opacity",0).remove(),t=nj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),t.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Qi),t.style("opacity",td).transition().duration(T).attr("d",O).style("fill",Qi).style("opacity",1),t.exit().transition().duration(U).style("opacity",0).remove(),q=nj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),q.enter().append("path").attr("class",Zc).style("stroke",Qi),q.style("opacity",td).transition().duration(T).attr("d",hj).style("stroke",Qi).style("opacity",1),q.exit().transition().duration(U).style("opacity",0).remove(),r=nj.selectAll("."+f.areas).selectAll("."+f.area).data(pe),r.enter().append("path").attr("class",fd).style("fill",Qi).style("opacity",function(){return tj=+Ef.select(this).style("opacity"),0}),r.style("opacity",0).transition().duration(T).attr("d",ij).style("fill",Qi).style("opacity",tj),r.exit().transition().duration(U).style("opacity",0).remove(),s=nj.selectAll("."+f.circles).selectAll("."+f.circle).data(se),s.enter().append("circle").attr("class",_c).attr("r",Oe).style("fill",Qi),s.style("opacity",td).transition().duration(T).style("opacity",vd).style("fill",Qi).attr("cx",ih?Xd:Wd).attr("cy",ih?Wd:Xd),s.exit().remove(),w=nj.selectAll("."+f.texts).selectAll("."+f.text).data(te),w.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return ih?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",Qi).style("fill-opacity",0),w.text(function(a){return Ed(a.id)(a.value,a.id)}).style("fill-opacity",ud).transition().duration(T).attr("x",Q).attr("y",R).style("fill",Qi).style("fill-opacity",wd),w.exit().transition().duration(U).style("fill-opacity",0).remove(),u=nj.selectAll("."+f.arcs).selectAll("."+f.arc).data(qe),u.enter().append("path").attr("class",dd).style("fill",function(a){return Qi(a.data)}).style("cursor",function(a){return Sg(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Oi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),vf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Sd(d,Ef.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Oi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),wf(),Td(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();ef(this,a,b),e(d,b)}),u.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Oi=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Fb(a);return c?(b=Ef.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("fill",function(a){return Qi(a.data)}).style("opacity",1).call(Ee,function(){Oi=!1}),u.exit().transition().duration(U).style("opacity",0).remove(),nj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(T).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&oe(a.data)?1:0}),nj.select("."+f.chartArcsTitle).style("opacity",ge(Ff.data.targets)?1:0),_g&&(null!==Ef.event&&"zoom"===Ef.event.type&&gj.extent(qg.orgDomain()).update(),F&&(!ih&&uh&&eb(e,S.axisSubX,uh),gj.empty()||gj.extent(qg.orgDomain()).update(),P=Xe(Z,!0),y=oj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),y.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Qi),y.style("opacity",td).transition().duration(T).attr("d",P).style("opacity",1),y.exit().transition().duration(T).style("opacity",0).remove(),x=oj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),x.enter().append("path").attr("class",Zc).style("stroke",Qi),x.style("opacity",td).transition().duration(T).attr("d",jj).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove())),nj.selectAll("."+f.selectedCircles).filter(function(a){return ke(a)}).selectAll("circle").remove(),nj.selectAll("."+f.selectedCircle).transition().duration(T).attr("cx",ih?Xd:Wd).attr("cy",ih?Wd:Xd),z=nj.select("."+f.eventRects),Be(Bg)&&!oc(Bg)?(z.classed(f.eventRectsMultiple)||z.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),A=nj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),df(A.enter()),A.attr("x",0).attr("y",0).attr("width",Xf).attr("height",Zf)):(z.classed(f.eventRectsSingle)||z.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ji&&!Ii?(D=function(a,b){var c=xc(b),d=yc(b),e=Ff.data.xs[a.id][b];return(qg(d?d:e+50)-qg(c?c:e-50))/2},C=function(a,b){var c=xc(b),d=Ff.data.xs[a.id][b];return(qg(d)+qg(c?c:d-50))/2}):(D=L(),C=function(a){return qg(a.x)-D/2}),B=Ac(Ff.data.targets),nj.select("."+f.eventRects).datum(B?B.values:[]),A=nj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),cf(A.enter()),A.attr("class",id).attr("x",ih?0:C).attr("y",ih?C:0).attr("width",ih?Xf:D).attr("height",ih?D:Zf),A.exit().remove()),Cc(Ff.data.targets).forEach(function(a){uj[a]=!0})}function kf(){jf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function lf(){return"mousemove"===Ef.event.sourceEvent.type&&kj.altDomain?(qg.domain(kj.altDomain),void kj.scale(qg).updateScaleExtent()):(Ii&&qg.orgDomain()[0]===sj[0]&&qg.domain([sj[0]-1e-10,qg.orgDomain()[1]]),jf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Ef.event.sourceEvent.type&&(Mi=!0)))}function mf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function nf(){lj.attr("width",_f).attr("height",ag),lj.select("#"+Bi).select("rect").attr("width",Xf).attr("height",Zf),lj.select("#"+Ci).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),lj.select("#"+Di).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),lj.select("."+f.zoomRect).attr("width",Xf).attr("height",Zf),rj.style("max-height",ag+"px")}function of(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),nf(),m(a.withTransition),jf(a)}function pf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=nj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",kd),j=i.enter().append("g").attr("class",kd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc),e=nj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",md),d=e.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",cd).style("cursor",function(a){return Sg(a)?"pointer":null}),c=nj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",ld),b=c.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",$c),b.append("g").attr("class",gd),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",ad).style("cursor",function(a){return Sg(a)?"pointer":null}),a.forEach(function(a){nj.selectAll("."+f.selectedCircles+od(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=nj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(hg(a)).attr("class",nd),g=h.enter().append("g").attr("class",nd),g.append("g").attr("class",ed),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),_g&&(n=oj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",md),m=n.enter().append("g").style("opacity",0).attr("class",md),m.append("g").attr("class",cd),l=oj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",ld),k=l.enter().append("g").style("opacity",0).attr("class",ld),k.append("g").attr("class",$c)),lj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Tf).style("opacity",1)}function qf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?be(a.id,b.types[a.id]):be(a.id,b.type)}),Ff.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=$i?j:i,l=$i?Q():P();return d&&(w=0,C=0,t=0,u=0),ch&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=$i?u:t,void(hh?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=pj.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,$i?(g=function(a){return t*(.2+B[a])},j=function(a){return A[B[a]]+x[a]}):(g=function(a){return A[B[a]]+x[a]},j=function(a){return u*(.2+B[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=pj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof eh?eh(a):Ff.toggle(a)}).on("mouseover",function(a){Ef.select(this).classed(f.legendItemFocused,!0),Oi||Ff.focus(a),"function"==typeof fh&&fh(a)}).on("mouseout",function(a){Ef.select(this).classed(f.legendItemFocused,!1),Oi||Ff.revert(),"function"==typeof gh&&gh(a)}),o.append("text").text(function(a){return d(Eg[a])?Eg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",$i?h:-200).attr("y",$i?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",$i?i:-200).attr("y",$i?-200:l).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",Qi).attr("x",$i?h:-200).attr("y",$i?-200:j).attr("width",10).attr("height",10),pj.selectAll("text").data(a).text(function(a){return d(Eg[a])?Eg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),pj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),pj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).style("fill",Qi).attr("x",g).attr("y",j),pj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=Ef.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?tf(b):uf(b):cj}),N(t),O(u),M(C),n(),R(),nf(),m(q,c)}function Af(a){return Ec(Ff.data.targets,a.id)}function Bf(a){return"data"in a&&Ec(Ff.data.targets,a.data.id)}function Cf(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 Df(a,b,c){var d=!he(Ff.data.targets);Oi=!1,be(a,b),of(c||{withTransitionForAxis:d})}var Ef=a.d3?a.d3:a.require?a.require("d3"):void 0,Ff={data:{},axis:{},legend:{}},Gf={},Hf=h(["bindto"],"#chart"),If=h(["size","width"]),Jf=h(["size","height"]),Kf=h(["padding","left"],50),Lf=h(["padding","right"]),Mf=h(["zoom","enabled"],!1),Nf=h(["zoom","extent"]),Of=h(["zoom","privileged"],!1),Pf=h(["onenter"],function(){}),Qf=h(["onleave"],function(){}),Rf=h(["onresize"],function(){}),Sf=h(["onresized"],function(){}),Tf=h(["transition","duration"],350);g("data","data is required in config");var Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag=h(["data","x"]),Bg=h(["data","xs"],{}),Cg=h(["data","x_format"]),Dg=h(["data","id_converter"],function(a){return a}),Eg=h(["data","names"],{}),Fg=h(["data","classes"],{}),Gg=h(["data","groups"],[]),Hg=h(["data","axes"],{}),Ig=h(["data","type"]),Jg=h(["data","types"],{}),Kg=h(["data","labels"],{}),Lg=h(["data","order"]),Mg=h(["data","regions"],{}),Ng=h(["data","color"]),Og=h(["data","colors"],{}),Pg=h(["data","hide"],!1),Qg=h(["data","selection","enabled"],!1),Rg=h(["data","selection","grouped"],!1),Sg=h(["data","selection","isselectable"],function(){return!0}),Tg=h(["data","selection","multiple"],!0),Ug=h(["data","onclick"],function(){}),Vg=h(["data","onenter"],function(){}),Wg=h(["data","onleave"],function(){}),Xg=h(["data","onselected"],function(){}),Yg=h(["data","onunselected"],function(){}),Zg=h(["data","ondragstart"],function(){}),$g=h(["data","ondragend"],function(){}),_g=h(["subchart","show"],!1),ah=h(["subchart","size","height"],60),bh=h(["color","pattern"],[]),ch=h(["legend","show"],!0),dh=h(["legend","position"],"bottom"),eh=h(["legend","item","onclick"]),fh=h(["legend","item","onmouseover"]),gh=h(["legend","item","onmouseout"]),hh=h(["legend","equally"],!1),ih=h(["axis","rotated"],!1),jh=h(["axis","x","show"],!0),kh=h(["axis","x","type"],"indexed"),lh=h(["axis","x","localtime"],!0),mh=h(["axis","x","categories"],[]),nh=h(["axis","x","tick","centered"],!1),oh=h(["axis","x","tick","format"]),ph=h(["axis","x","tick","culling"],{}),qh=h(["axis","x","tick","culling","max"],10),rh=h(["axis","x","tick","count"]),sh=h(["axis","x","tick","fit"],!0),th=h(["axis","x","tick","values"],null),uh=h(["axis","x","tick","rotate"]),vh=h(["axis","x","max"],null),wh=h(["axis","x","min"],null),xh=h(["axis","x","padding"],{}),yh=h(["axis","x","height"]),zh=h(["axis","x","default"]),Ah=h(["axis","x","label"],{}),Bh=h(["axis","y","show"],!0),Ch=h(["axis","y","max"]),Dh=h(["axis","y","min"]),Eh=h(["axis","y","center"]),Fh=h(["axis","y","label"],{}),Gh=h(["axis","y","inner"],!1),Hh=h(["axis","y","tick","format"]),Ih=h(["axis","y","padding"]),Jh=h(["axis","y","ticks"],10),Kh=h(["axis","y2","show"],!1),Lh=h(["axis","y2","max"]),Mh=h(["axis","y2","min"]),Nh=h(["axis","y2","center"]),Oh=h(["axis","y2","label"],{}),Ph=h(["axis","y2","inner"],!1),Qh=h(["axis","y2","tick","format"]),Rh=h(["axis","y2","padding"]),Sh=h(["axis","y2","ticks"],10),Th=h(["grid","x","show"],!1),Uh=h(["grid","x","type"],"tick"),Vh=h(["grid","x","lines"],[]),Wh=h(["grid","y","show"],!1),Xh=h(["grid","y","lines"],[]),Yh=h(["grid","y","ticks"],10),Zh=h(["point","show"],!0),$h=h(["point","r"],2.5),_h=h(["point","focus","line","enabled"],!0),ai=h(["point","focus","expand","enabled"],!0),bi=h(["point","focus","expand","r"]),ci=h(["point","focus","select","r"]),di=h(["line","connect_null"],!1),ei=h(["bar","width"]),fi=h(["bar","width","ratio"],.6),gi=h(["pie","label","show"],!0),hi=h(["pie","label","format"]),ii=h(["pie","expand"],!0),ji=h(["pie","onclick"],function(){}),ki=h(["pie","onmouseover"],function(){}),li=h(["pie","onmouseout"],function(){}),mi=h(["donut","label","show"],!0),ni=h(["donut","label","format"]),oi=h(["donut","expand"],!0),pi=h(["donut","title"],""),qi=h(["donut","onclick"],function(){}),ri=h(["donut","onmouseover"],function(){}),si=h(["donut","onmouseout"],function(){}),ti=h(["regions"],[]),ui=h(["tooltip","show"],!0),vi=h(["tooltip","format","title"]),wi=h(["tooltip","format","value"]),xi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=vi?vi:b,l=wi?wi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id,a[g].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),yi=h(["tooltip","init","show"],!1),zi=h(["tooltip","init","x"],0),Ai=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Bi=("string"==typeof Hf?Hf.replace("#",""):Hf.id)+"-clip",Ci=Bi+"-xaxis",Di=Bi+"-yaxis",Ei=i(Bi),Fi=i(Ci),Gi=i(Di),Hi="timeseries"===kh,Ii="categorized"===kh,Ji=!Hi&&(Ag||Be(Bg)),Ki=null,Li=!1,Mi=!1,Ni=!1,Oi=!1,Pi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Qi=ve(Og,Be(bh)?bh:Pi,Ng),Ri=lh?Ef.time.format:Ef.time.format.utc,Si=function(){var a=[[Ri("%Y/%-m/%-d"),function(){return!0}],[Ri("%-m/%-d"),function(a){return a.getMonth()}],[Ri("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ri("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ri("%I %p"),function(a){return a.getHours()}],[Ri("%I:%M"),function(a){return a.getMinutes()}],[Ri(":%S"),function(a){return a.getSeconds()}],[Ri(".%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)}}(),Ti=[],Ui=[],Vi=ih?"left":"bottom",Wi=ih?Gh?"top":"bottom":Gh?"right":"left",Xi=ih?Ph?"bottom":"top":Ph?"left":"right",Yi=ih?"left":"bottom",Zi={main:function(){return"translate("+Uf.left+","+Uf.top+")"},context:function(){return"translate("+Vf.left+","+Vf.top+")"},legend:function(){return"translate("+Wf.left+","+Wf.top+")"},x:function(){return"translate(0,"+(ih?0:Zf)+")"},y:function(){return"translate(0,"+(ih?Zf:0)+")"},y2:function(){return"translate("+(ih?0:Xf)+","+(ih?1:0)+")"},subx:function(){return"translate(0,"+(ih?0:$f)+")"},arc:function(){return"translate("+Xf/2+","+Zf/2+")"}},$i="right"===dh,_i=0,aj=0,bj=0,cj=.15,dj=30,ej=ih&&!jh?0:30,fj=5;hg=Ef.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var gj,hj=function(){var a=Ef.svg.line().x(ih?function(a){return V(a.id)(a.value)}:Fd).y(ih?Fd:function(a){return V(a.id)(a.value)});return di||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=di?Ne(b.values):b.values;return ie(b)?(a.interpolate(je(b)?"cardinal":"linear"),Mg[b.id]?af(e,qg,V(b.id),Mg[b.id]):a(e)):(c=e[0]?qg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ih?"M "+d+" "+c:"M "+c+" "+d)}}(),ij=function(){var a;return a=ih?Ef.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Fd):Ef.svg.area().x(Fd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ne(b.values);return ce([b],"area")||ce([b],"area-spline")?(a.interpolate(je(b)?"cardinal":"linear"),a(e)):(c=e[0]?qg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ih?"M "+d+" "+c:"M "+c+" "+d)}}(),jj=function(){var a=Ef.svg.line().x(ih?function(a){return W(a.id)(a.value)}:Id).y(ih?Id:function(a){return W(a.id)(a.value)});return function(b){var c=Ne(b.values);return ie(b)?a(c):"M "+tg(c[0].x)+" "+W(b.id)(c[0].value)}}(),kj=function(){};gj=Ef.svg.brush().on("brush",kf),gj.update=function(){return oj&&oj.select("."+f.brush).call(this),this},gj.scale=function(a){return ih?this.y(a):this.x(a)},Mf&&(kj=Ef.behavior.zoom().on("zoomstart",function(){kj.altDomain=Ef.event.sourceEvent.altKey?qg.orgDomain():null}).on("zoom",Mf?lf:null),kj.scale=function(a){return ih?this.y(a):this.x(a)},kj.orgScaleExtent=function(){var a=Nf?Nf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},kj.updateScaleExtent=function(){var a=ac(qg.orgDomain())/ac(sj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var lj,mj,nj,oj,pj,qj,rj,sj,tj,uj={};if(Ff.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=lj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);Ff.revert(),Ff.defocus(),b(d.classed(f.focused,!0)),b(e),he(Ff.data.targets)&&Nb(a,!0),vf(a,!0)},Ff.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=lj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);Ff.revert(),b(d.classed(f.focused,!1)),b(e),he(Ff.data.targets)&&Ob(a),vf(a,!1)},Ff.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=lj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);b(d.classed(f.focused,!1)),b(e),he(Ff.data.targets)&&Ob(a),wf()},Ff.show=function(a,b){a=Dc(a),b=b||{},Mc(a),lj.selectAll(qd(a)).transition().style("opacity",1),b.withLegend&&xf(a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ff.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),lj.selectAll(qd(a)).transition().style("opacity",0),b.withLegend&&yf(a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ff.toggle=function(a){Gc(a)?Ff.hide(a):Ff.show(a)},Ff.unzoom=function(){gj.clear().update(),jf({withUpdateXDomain:!0})},Ff.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Fg[b]=a.classes[b]}),"categories"in a&&Ii&&(mh=a.categories,wg.categories(mh)),"cacheIds"in a&&bc(a.cacheIds)?void qf(dc(a.cacheIds),a.done):void("unload"in a?sf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){rf(a)}):rf(a))},Ff.unload=function(a,b){sf(Dc(a),function(){jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Ff.selected=function(a){return Ef.merge(nj.selectAll("."+f.shapes+od(a)).selectAll("."+f.shape).filter(function(){return Ef.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Ff.select=function(a,b,c){Qg&&nj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=Ef.select(this),i=e.data?e.data.id:e.id,j=Me(this),k=Rg||!a||a.indexOf(i)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Sg(e)&&!m&&j(!0,h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(!1,h.classed(f.SELECTED,!1),e,g)})},Ff.unselect=function(a,b){Qg&&nj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=Ef.select(this),g=c.data?c.data.id:c.id,h=Me(this),i=Rg||!a||a.indexOf(g)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(f.SELECTED); +!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.34"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",lines:"c3-lines",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",arcs:"c3-arcs",area:"c3-area",areas:"c3-areas",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",legendItemFocused:"c3-legend-item-focused",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;cXf&&(Xf=0),0>Zf&&(Zf=0),Yf=ih?Uf.left-dj-ej:Xf,$f=ih?Zf:ag-Vf.top-Vf.bottom,0>Yf&&(Yf=0),0>$f&&($f=0),p(),$i&&he(Ff.data.targets)&&(Wf.left=Xf/2+cg)}function o(){nj.select("line."+f.xgridFocus).attr("x1",ih?0:-10).attr("x2",ih?Xf:-10).attr("y1",ih?-10:Uf.top).attr("y2",ih?-10:Zf)}function p(){cg=Zf/2,bg=.95*cg,dg=ge(Ff.data.targets)?.6*bg:0}function q(){var a=ih?f.axisX:f.axisY,b=nj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Ef.select(Hf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return If?If:x()}function s(){var a=Jf?Jf:y();return a>0?a:320}function t(){return he(Ff.data.targets)?0:Kf?Kf:ih?jh?v("x"):1:!Bh||Gh?1:v("y")}function u(){var a=1;return he(Ff.data.targets)?0:Lf?Lf:$i?P()+20+(Kh&&!ih?v("y2"):a):Kh?Ph||ih?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||jh?"x"===a&&yh?yh:"y"!==a||Bh?"y2"!==a||Kh?(jb(a).isInner?30:40)+("y2"===a?-10:0):fj:ch&&!$i?10:1:0}function x(){return+Ef.select(Hf).style("width").replace("px","")}function y(){return+Ef.select(Hf).style("height").replace("px","")}function z(a){return a?-5:-(Uf.left-1)}function A(a){return a?-20:-4}function B(){return z(!ih)}function C(){return A(!ih)}function D(){return z(ih)}function E(){return A(ih)}function F(a){return a?Xf+2+4:Uf.left+20}function G(a){return a?(yh?yh:0)+80:Zf+8}function H(){return F(!ih)}function I(){return G(!ih)}function J(){return F(ih)}function K(){return G(ih)}function L(){var a,b,c,d,e,f=Ac(Ff.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=qg(b.x)-qg(a.x),0===c?ih?Zf:Xf:(d=zc(),e=de(Ff.data.targets)?(d-(Ii?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function M(a){_i=a}function N(a){aj=a}function O(a){bj=a}function P(){return ch?$i?aj*(_i+1):_f:0}function Q(){return ch?$i?ag:bj*(_i+1):0}function R(){var a,b,c=!qg;ig=ih?1:0,jg=ih?Zf:Xf,kg=ih?0:Zf,lg=ih?Xf:1,mg=ig,ng=jg,og=ih?0:$f,pg=ih?Yf:1,qg=T(ig,jg,c?void 0:qg.domain(),function(){return wg.tickOffset()}),rg=U(kg,lg,c?void 0:rg.domain()),sg=U(kg,lg,c?void 0:sg.domain()),tg=T(ig,jg,sj,function(a){return a%1?0:zg.tickOffset()}),ug=U(og,pg,c?void 0:ug.domain()),vg=U(og,pg,c?void 0:vg.domain()),a=$(),b=th?th:c?void 0:wg.tickValues(),wg=X(qg,Vi,a,b),zg=X(tg,Yi,a,b),xg=Y(rg,Wi,Hh,Jh),yg=Y(sg,Xi,Qh,Sh),c||(gj.scale(tg),Mf&&kj.scale(qg)),S()}function S(){eg=Gb(),fg=Hb(),gg=Hb(.98)}function T(a,b,d,e){var f=(Hi?Ef.time.scale():Ef.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Ii){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=Ef.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?sg:rg}function W(a){return"y2"===Z(a)?vg:ug}function X(a,b,c,d){var e=(Ii?Eb():Ef.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Ii?(e.tickCentered(nh),Ae(ph)&&(ph=!1)):e.tickOffset=function(){var a=Bc(Ff.data.targets),b=qg(a[1])-qg(a[0]),c=b?b:ih?Zf:Xf;return c/zc()/2},Ii&&e.categories(mh),e}function Y(a,b,c,d){return Ef.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Hg?Hg[a]:"y"}function $(){var a=Hi?Si:Ii?Tc:function(a){return 0>a?a.toFixed(0):a};return oh&&("function"==typeof oh?a=oh:Hi&&(a=function(a){return a?Ri(oh)(a):""})),a}function _(a){var b;return"y"===a?b=Fh:"y2"===a?b=Oh:"x"===a&&(b=Ah),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Fh=b:"y2"===a?Oh=b:"x"===a&&(Ah=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",ih?"inner-top":"inner-right")}function hb(){return fb("y",ih?"inner-right":"inner-top")}function ib(){return fb("y2",ih?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Xf/2:Xf:b.isBottom?-Zf:b.isMiddle?-Zf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!ih,gb())}function rb(){return nb(ih,hb())}function sb(){return nb(ih,ib())}function tb(){return ob(!ih,gb())}function ub(){return ob(ih,hb())}function vb(){return ob(ih,ib())}function wb(){var a=gb();return ih?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":yh?yh-10:"3em"}function xb(){var a=hb();return ih?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return ih?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!ih,gb())}function Ab(){return pb(ih,hb())}function Bb(){return pb(ih,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return Ef.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){nj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),nj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),nj.select("."+f.axisY2+" ."+f.axisY2Label).transition().attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 Ef.min(Object.keys(i).map(function(a){return Ef.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(Gg.length>0)for(g=Sc(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 Ef.max(Object.keys(i).map(function(a){return Ef.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Mh:Dh,n="y2"===c?Lh:Ch,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Nh:Eh,r=xd()&&ih;return 0===l.length?"y2"===c?sg.domain():rg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=yd(o,p),j=ac(rg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),"y2"===c&&Rh&&(f=b(Rh.top)?Rh.top:e,g=b(Rh.bottom)?Rh.bottom:e),de(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return wh?Hi?we(wh):wh:Ef.min(a,function(a){return Ef.min(a.values,function(a){return a.x})})}function Zb(a){return vh?Hi?we(vh):vh:Ef.max(a,function(a){return Ef.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Ii?d=0:de(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof xh&&Be(xh)?(e=b(xh.left)?xh.left:d,f=b(xh.right)?xh.right:d):e=f="number"==typeof xh?xh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return c-d===0&&(c=Hi?new Date(.5*c.getTime()):-.5,d=Hi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Hi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Hi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?rg:sg;return b="y"===a.axis||"y2"===a.axis?ih?Zf:"start"in a?d(a.start):Zf:ih?"end"in a?qg(Hi?we(a.end):a.end):Zf:Zf,c>b?0:b-c}function ic(a){return Ag&&a===Ag||Be(Bg)&&Ce(Bg,a)}function jc(a){return!ic(a)}function kc(a){return Ag?Ag:Be(Bg)?Bg[a]:null}function lc(a,b){var c,d=b&&Be(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=Ff.data.xs[b])}),c}function mc(a,b){return a in Ff.data.xs&&Ff.data.xs[a]&&Ff.data.xs[a][b]?Ff.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){Bg[b]=a[b]})}function oc(a){return 1===Ef.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=Eg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),Ff.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=Hi?a?a instanceof Date?a:we(a):we(mc(c,d)):Ji&&!Ii?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Ff.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Ag?(d=Object.keys(Ff.data.xs),Ff.data.xs[c]=d.length>0?Ff.data.xs[d[0]]:void 0):Be(Bg)&&(Ff.data.xs[c]=lc(f,Ff.data.targets)):Ff.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Ff.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Dg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ji&&Ii&&0===c&&g&&(0===e&&(mh=[]),mh.push(g)),("undefined"==typeof a[b]||Ff.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ig&&be(Cc(c).filter(function(a){return!(a in Jg)}),Ig),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&Ff.data.targets[0].values[a-1]?Ff.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(Ff.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Hi?new Date(i):i);j.push(e)}return Hi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Ti=Ti.concat(a)}function Mc(a){Ti=Ti.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Ui=Ui.concat(a)}function Oc(a){Ui=Ui.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Jd(a,f))),(a[g].x||0===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=De(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Nd(a,b){return Ef.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Od(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 Pd(){return Lg&&"desc"===Lg.toLowerCase()}function Qd(){return Lg&&"asc"===Lg.toLowerCase()}function Rd(a){var b=Qd(),c=Pd();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 Lg&&a.sort(Lg),a}function Sd(a,c){var d,e,f,g,h,i,j,k=he(Ff.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&ui&&(qj.html(xi(a,$(),zd(k),Qi)).style("display","block"),d=qj.property("offsetWidth"),e=qj.property("offsetHeight"),k?(g=Xf/2+c[0],i=Zf/2+c[1]+20):(ih?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=qg(l[0].x)+20):(f=q(),g=f+t()+qg(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),qj.style("top",i+"px").style("left",g+"px"))}function Td(){qj.style("display","none")}function Ud(a){var c=a.filter(function(a){return a&&b(a.value)});ui&&(ee(Ff.data.targets)||he(Ff.data.targets)||nj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(ih?"y1":"x1",Fd).attr(ih?"y2":"x2",Fd))}function Vd(){nj.select("line."+f.xgridFocus).style("visibility","hidden")}function Wd(a){return a.x||0===a.x?qg(a.x):null}function Xd(a){return V(a.id)(a.value)}function Yd(){var a,b,d={},e=0;return Ic(Fc(ke)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ae(a,b){return"number"==typeof ei?ei:b?2*a.tickOffset()*fi/b:0}function be(a,b){Dc(a).forEach(function(a){uj[a]=b===Jg[a],Jg[a]=b})}function ce(a,b){var c=!1;return a.forEach(function(a){Jg[a.id]===b&&(c=!0),a.id in Jg||"line"!==b||(c=!0)}),c}function de(a){return ce(a,"bar")}function ee(a){return ce(a,"scatter")}function fe(a){return ce(a,"pie")}function ge(a){return ce(a,"donut")}function he(a){return fe(a)||ge(a)}function ie(a){var b="string"==typeof a?a:a.id;return!(b in Jg)||"line"===Jg[b]||"spline"===Jg[b]||"area"===Jg[b]||"area-spline"===Jg[b]}function je(a){var b="string"==typeof a?a:a.id;return"spline"===Jg[b]||"area-spline"===Jg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"bar"===Jg[b]}function le(a){var b="string"==typeof a?a:a.id;return"scatter"===Jg[b]}function me(a){var b="string"==typeof a?a:a.id;return"pie"===Jg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"donut"===Jg[b]}function oe(a){return me(a)||ne(a)}function pe(a){return ie(a)?[a]:[]}function qe(a){return oe(a.data)?[a]:[]}function re(a){return ke(a)?a.values:[]}function se(a){return ie(a)||le(a)?a.values:[]}function te(a){return ke(a)||ie(a)?a.values:[]}function ue(a){return ne(a)&&oi||me(a)&&ii}function ve(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function we(b){var c;try{c=Cg?Ef.time.format(Cg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Cg)}return c}function xe(a,b){var c=Ef.mouse(a),d=Ef.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ce(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function De(a,b){var c="y"===Z(a.id)?rg:sg,d=ih?1:0,e=ih?0:1;return Math.pow(qg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ee(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Fe(a,b,c){Xg(b,a.node()),nj.select("."+f.selectedCircles+od(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",ih?Xd:Wd).attr("cy",ih?Wd:Xd).attr("stroke",function(){return Qi(b)}).attr("r",1.4*Qe(b)).transition().duration(100).attr("r",Qe)}function Ge(a,b,c){Yg(b,a.node()),nj.select("."+f.selectedCircles+od(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function He(a,b,c,d){a?Fe(b,c,d):Ge(b,c,d)}function Ie(a,b){Xg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ef.rgb(Qi(b)).brighter(.75)})}function Je(a,b){Yg(b,a.node()),a.transition().duration(100).style("fill",function(){return Qi(b)})}function Ke(a,b,c,d){a?Ie(b,c,d):Je(b,c,d)}function Le(a,b,c,d){Ke(a,b,c.data,d)}function Me(a){return"circle"===a.nodeName?He:Ef.select(a).classed(f.bar)?Ke:Le}function Ne(a){return a.filter(function(a){return b(a.value)})}function Oe(a){return Zh?"function"==typeof $h?$h(a):$h:0}function Pe(a){return ai?bi?bi:1.75*Oe(a):Oe(a)}function Qe(a){return ci?ci:4*Oe(a)}function Re(a,c){return(c?nj.selectAll("."+f.circles+od(c)):nj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Se(a,b){Re(a,b).classed(f.EXPANDED,!0).attr("r",Pe)}function Te(a){Re(a).filter(function(){return Ef.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oe)}function Ue(a){return nj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ve(a){Ue(a).classed(f.EXPANDED,!0)}function We(a){Ue(a).classed(f.EXPANDED,!1)}function Xe(a,b){var c=_e(a,b);return function(a,b){var d=c(a,b),e=ih?1:0,f=ih?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 Ye(a,b){var c=_e(a,!1),d=b?Ze:$e;return function(a,b){return d(c(a,b),a,this)}}function Ze(a,b){var c;return ih?(c=ke(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function $e(a,b,c){var d=c.getBoundingClientRect();return ih?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ke(b)?-3:-6)}function _e(a,b){var c=a.__max__+1,d=ae(wg,c),e=Zd(d,c,a,!!b),f=$d(!!b),g=_d(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return ih&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function af(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 bf(b){var c,d,e;if(rj=Ef.select(Hf),rj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(rj.html("").classed("c3",!0),Ff.data.xs={},Ff.data.targets=vc(b),Pg&&Lc(Pg===!0?Cc(Ff.data.targets):Pg),n(),R(),qg.domain(Ef.extent(_b(Ff.data.targets))),rg.domain(Xb(Ff.data.targets,"y")),sg.domain(Xb(Ff.data.targets,"y2")),tg.domain(qg.domain()),ug.domain(rg.domain()),vg.domain(sg.domain()),sj=qg.domain(),gj.scale(tg),Mf&&kj.scale(qg),lj=rj.append("svg").on("mouseenter",Pf).on("mouseleave",Qf),mj=lj.append("defs"),mj.append("clipPath").attr("id",Bi).append("rect"),mj.append("clipPath").attr("id",Ci).append("rect"),mj.append("clipPath").attr("id",Di).append("rect"),nf(),nj=lj.append("g").attr("transform",Zi.main),oj=lj.append("g").attr("transform",Zi.context),pj=lj.append("g").attr("transform",Zi.legend),_g||oj.style("visibility","hidden"),ch||(pj.style("visibility","hidden"),Ui=Cc(Ff.data.targets)),qj=Ef.select(Hf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),zf(Cc(Ff.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=nj.append("g").attr("clip-path",Ei).attr("class",f.grid),Th&&d.append("g").attr("class",f.xgrids),Be(Vh)&&d.append("g").attr("class",f.xgridLines),_h&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Wh&&d.append("g").attr("class",f.ygrids),Be(Xh)&&d.append("g").attr("class",f.ygridLines),jh&&nj.append("g").attr("class",f.axisX).attr("clip-path",Fi).attr("transform",Zi.x).append("text").attr("class",f.axisXLabel).attr("transform",ih?"rotate(-90)":"").style("text-anchor",zb),Bh&&nj.append("g").attr("class",f.axisY).attr("clip-path",Gi).attr("transform",Zi.y).append("text").attr("class",f.axisYLabel).attr("transform",ih?"":"rotate(-90)").style("text-anchor",Ab),Kh&&nj.append("g").attr("class",f.axisY2).attr("transform",Zi.y2).append("text").attr("class",f.axisY2Label).attr("transform",ih?"":"rotate(-90)").style("text-anchor",Bb),nj.append("g").attr("clip-path",Ei).attr("class",f.regions),nj.append("g").attr("clip-path",Ei).attr("class",f.chart),c=nj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Mf?ih?"ns-resize":"ew-resize":null),nj.select("."+f.chart).append("g").attr("class",f.chartBars),nj.select("."+f.chart).append("g").attr("class",f.chartLines),nj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Zi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),nj.select("."+f.chart).append("g").attr("class",f.chartTexts),Mf&&nj.insert("rect",Of?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Xf).attr("height",Zf).style("opacity",0).style("cursor",ih?"ns-resize":"ew-resize").call(kj).on("dblclick.zoom",null),zh&&gj.extent("function"!=typeof zh?zh:zh(_b())),oj.append("g").attr("clip-path",Ei).attr("class",f.chart),oj.select("."+f.chart).append("g").attr("class",f.chartBars),oj.select("."+f.chart).append("g").attr("class",f.chartLines),oj.append("g").attr("clip-path",Ei).attr("class",f.brush).call(gj).selectAll("rect").attr(ih?"width":"height",ih?Yf:$f),oj.append("g").attr("class",f.axisX).attr("transform",Zi.subx).attr("clip-path",ih?"":Fi),pf(Ff.data.targets),ih?nj.select("."+f.axisX).style("opacity",0).call(wg):(nj.select("."+f.axisY).style("opacity",0).call(xg),nj.select("."+f.axisY2).style("opacity",0).call(yg)),n(),R(),nf(),m(!1),jf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),yi){if(Hi&&"string"==typeof zi){for(zi=we(zi),e=0;e0){d=[];for(var g in Eg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Od(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ke,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 gf(a){he(Ff.data.targets)||Qg&&(Ki=a,nj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Li=!0,Zg())}function hf(){he(Ff.data.targets)||Qg&&(nj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),nj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Li=!1,$g())}function jf(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z=Yd(),$=he(Ff.data.targets),_=Ic(Ff.data.targets);if(a=d(a)?a:{},E=d(a.withY)?a.withY:!0,F=d(a.withSubchart)?a.withSubchart:!0,G=d(a.withTransition)?a.withTransition:!0,J=d(a.withTransform)?a.withTransform:!1,K=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,M=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,N=d(a.withLegend)?a.withLegend:!1,H=d(a.withTransitionForExit)?a.withTransitionForExit:G,I=d(a.withTransitionForAxis)?a.withTransitionForAxis:G,T=G?Tf:0,U=H?T:0,V=I?T:0,c=nj.select("."+f.axisX).style("opacity",$?0:1),g=nj.select("."+f.axisY).style("opacity",$?0:1),h=nj.select("."+f.axisY2).style("opacity",$?0:1),e=oj.select("."+f.axisX).style("opacity",$?0:1),S={axisX:c.transition().duration(V),axisY:g.transition().duration(V),axisY2:h.transition().duration(V),axisSubX:e.transition().duration(V)},N&&ch&&zf(Cc(Ff.data.targets),a,S),Ii&&(0!==_.length&&M&&K||qg.domain([0,c.selectAll(".tick").size()])),_.length&&(M&&(qg.domain(Ef.extent(_b(_))),sj=qg.domain(),Mf&&kj.scale(qg).updateScaleExtent(),tg.domain(qg.domain()),gj.scale(tg)),K&&(qg.domain(gj.empty()?sj:gj.extent()),Mf&&kj.scale(qg).updateScaleExtent()),th||!sh&&!rh||(W=Kc(Jc(_),rh),wg.tickValues(W),zg.tickValues(W))),rg.domain(Xb(_,"y")),sg.domain(Xb(_,"y2")),S.axisX.call(wg),S.axisY.call(xg),S.axisY2.call(yg),S.axisSubX.call(zg),K&&_.length)if(ph&&W){for(X=1;X=0&&Ef.select(this).style("display",b%Y?"none":"block")})}else lj.selectAll("."+f.axisX+" .tick text").style("display","block");if(!ih&&uh&&eb(c,S.axisX,uh),O=Xe(Z),Q=Ye(Z,!0),R=Ye(Z,!1),Db(),ug.domain(rg.domain()),vg.domain(sg.domain()),qj.style("display","none"),o(),nj.select("line."+f.xgridFocus).style("visibility","hidden"),Th){if("year"===Uh){j=[];for(var ab=_b(),bb=ab[0].getFullYear(),cb=ab[1].getFullYear(),db=bb;cb>=db;db++)j.push(new Date(db+"-01-01 00:00:00"))}else j=qg.ticks(10);i=nj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",ih?0:function(a){return qg(a)-wg.tickOffset()}).attr("x2",ih?Xf:function(a){return qg(a)-wg.tickOffset()}).attr("y1",ih?function(a){return qg(a)-wg.tickOffset()}:Uf.top).attr("y2",ih?function(a){return qg(a)-wg.tickOffset()}:Zf).style("opacity",function(){return+Ef.select(this).attr(ih?"y1":"x1")===(ih?Zf:0)?0:1}),i.exit().remove()}Be(Vh)&&(k=nj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Vh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",ih?"":"rotate(-90)").attr("dx",ih?0:-Uf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",ih?0:Gd).attr("x2",ih?Xf:Gd).attr("y1",ih?Gd:Uf.top).attr("y2",ih?Gd:Zf).style("opacity",1),k.select("text").transition().duration(T).attr("x",ih?Xf:0).attr("y",Gd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),E&&Wh&&(m=nj.select("."+f.ygrids).selectAll("."+f.ygrid).data(rg.ticks(Yh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",ih?rg:0).attr("x2",ih?rg:Xf).attr("y1",ih?0:rg).attr("y2",ih?Zf:rg),m.exit().remove()),E&&Be(Xh)&&(n=nj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Xh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",ih?"rotate(-90)":"").attr("dx",ih?0:-Uf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(T).attr("x1",ih?Hd:0).attr("x2",ih?Hd:Xf).attr("y1",ih?0:Hd).attr("y2",ih?Zf:Hd).style("opacity",1),n.select("text").transition().duration(T).attr("x",ih?0:Xf).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(T).style("opacity",0).remove()),v=nj.select("."+f.regions).selectAll("rect."+f.region).data(ti),v.enter().append("rect").style("fill-opacity",0),v.attr("class",hd).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(T).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),v.exit().transition().duration(T).style("fill-opacity",0).remove(),t=nj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),t.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Qi),t.style("opacity",td).transition().duration(T).attr("d",O).style("fill",Qi).style("opacity",1),t.exit().transition().duration(U).style("opacity",0).remove(),q=nj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),q.enter().append("path").attr("class",Zc).style("stroke",Qi),q.style("opacity",td).transition().duration(T).attr("d",hj).style("stroke",Qi).style("opacity",1),q.exit().transition().duration(U).style("opacity",0).remove(),r=nj.selectAll("."+f.areas).selectAll("."+f.area).data(pe),r.enter().append("path").attr("class",fd).style("fill",Qi).style("opacity",function(){return tj=+Ef.select(this).style("opacity"),0}),r.style("opacity",0).transition().duration(T).attr("d",ij).style("fill",Qi).style("opacity",tj),r.exit().transition().duration(U).style("opacity",0).remove(),s=nj.selectAll("."+f.circles).selectAll("."+f.circle).data(se),s.enter().append("circle").attr("class",_c).attr("r",Oe).style("fill",Qi),s.style("opacity",td).transition().duration(T).style("opacity",vd).style("fill",Qi).attr("cx",ih?Xd:Wd).attr("cy",ih?Wd:Xd),s.exit().remove(),w=nj.selectAll("."+f.texts).selectAll("."+f.text).data(te),w.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return ih?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",Qi).style("fill-opacity",0),w.text(function(a){return Ed(a.id)(a.value,a.id)}).style("fill-opacity",ud).transition().duration(T).attr("x",Q).attr("y",R).style("fill",Qi).style("fill-opacity",wd),w.exit().transition().duration(U).style("fill-opacity",0).remove(),u=nj.selectAll("."+f.arcs).selectAll("."+f.arc).data(qe),u.enter().append("path").attr("class",dd).style("fill",function(a){return Qi(a.data)}).style("cursor",function(a){return Sg(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Oi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),vf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Sd(d,Ef.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Oi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),wf(),Td(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();ef(this,a,b),e(d,b)}),u.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Oi=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Fb(a);return c?(b=Ef.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("fill",function(a){return Qi(a.data)}).style("opacity",1).call(Ee,function(){Oi=!1}),u.exit().transition().duration(U).style("opacity",0).remove(),nj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(T).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&oe(a.data)?1:0}),nj.select("."+f.chartArcsTitle).style("opacity",ge(Ff.data.targets)?1:0),_g&&(null!==Ef.event&&"zoom"===Ef.event.type&&gj.extent(qg.orgDomain()).update(),F&&(!ih&&uh&&eb(e,S.axisSubX,uh),gj.empty()||gj.extent(qg.orgDomain()).update(),P=Xe(Z,!0),y=oj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),y.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Qi),y.style("opacity",td).transition().duration(T).attr("d",P).style("opacity",1),y.exit().transition().duration(T).style("opacity",0).remove(),x=oj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),x.enter().append("path").attr("class",Zc).style("stroke",Qi),x.style("opacity",td).transition().duration(T).attr("d",jj).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove())),nj.selectAll("."+f.selectedCircles).filter(function(a){return ke(a)}).selectAll("circle").remove(),nj.selectAll("."+f.selectedCircle).transition().duration(T).attr("cx",ih?Xd:Wd).attr("cy",ih?Wd:Xd),z=nj.select("."+f.eventRects),Be(Bg)&&!oc(Bg)?(z.classed(f.eventRectsMultiple)||z.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),A=nj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),df(A.enter()),A.attr("x",0).attr("y",0).attr("width",Xf).attr("height",Zf)):(z.classed(f.eventRectsSingle)||z.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ji&&!Ii?(D=function(a,b){var c=xc(b),d=yc(b),e=Ff.data.xs[a.id][b];return(qg(d?d:e+50)-qg(c?c:e-50))/2},C=function(a,b){var c=xc(b),d=Ff.data.xs[a.id][b];return(qg(d)+qg(c?c:d-50))/2}):(D=L(),C=function(a){return qg(a.x)-D/2}),B=Ac(Ff.data.targets),nj.select("."+f.eventRects).datum(B?B.values:[]),A=nj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),cf(A.enter()),A.attr("class",id).attr("x",ih?0:C).attr("y",ih?C:0).attr("width",ih?Xf:D).attr("height",ih?D:Zf),A.exit().remove()),Cc(Ff.data.targets).forEach(function(a){uj[a]=!0})}function kf(){jf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function lf(){return"mousemove"===Ef.event.sourceEvent.type&&kj.altDomain?(qg.domain(kj.altDomain),void kj.scale(qg).updateScaleExtent()):(Ii&&qg.orgDomain()[0]===sj[0]&&qg.domain([sj[0]-1e-10,qg.orgDomain()[1]]),jf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Ef.event.sourceEvent.type&&(Mi=!0)))}function mf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function nf(){lj.attr("width",_f).attr("height",ag),lj.select("#"+Bi).select("rect").attr("width",Xf).attr("height",Zf),lj.select("#"+Ci).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),lj.select("#"+Di).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),lj.select("."+f.zoomRect).attr("width",Xf).attr("height",Zf),rj.style("max-height",ag+"px")}function of(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),nf(),m(a.withTransition),jf(a)}function pf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=nj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",kd),j=i.enter().append("g").attr("class",kd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc),e=nj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",md),d=e.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",cd).style("cursor",function(a){return Sg(a)?"pointer":null}),c=nj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",ld),b=c.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",$c),b.append("g").attr("class",gd),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",ad).style("cursor",function(a){return Sg(a)?"pointer":null}),a.forEach(function(a){nj.selectAll("."+f.selectedCircles+od(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=nj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(hg(a)).attr("class",nd),g=h.enter().append("g").attr("class",nd),g.append("g").attr("class",ed),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),_g&&(n=oj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",md),m=n.enter().append("g").style("opacity",0).attr("class",md),m.append("g").attr("class",cd),l=oj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",ld),k=l.enter().append("g").style("opacity",0).attr("class",ld),k.append("g").attr("class",$c)),lj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Tf).style("opacity",1)}function qf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?be(a.id,b.types[a.id]):be(a.id,b.type)}),Ff.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=$i?j:i,l=$i?Q():P();return d&&(w=0,C=0,t=0,u=0),ch&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=$i?u:t,void(hh?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=pj.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,$i?(g=function(a){return t*B[a]},j=function(a){return A[B[a]]+x[a]}):(g=function(a){return A[B[a]]+x[a]},j=function(a){return u*B[a]}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=pj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof eh?eh(a):Ff.toggle(a)}).on("mouseover",function(a){Ef.select(this).classed(f.legendItemFocused,!0),Oi||Ff.focus(a),"function"==typeof fh&&fh(a)}).on("mouseout",function(a){Ef.select(this).classed(f.legendItemFocused,!1),Oi||Ff.revert(),"function"==typeof gh&&gh(a)}),o.append("text").text(function(a){return d(Eg[a])?Eg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",$i?h:-200).attr("y",$i?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",$i?i:-200).attr("y",$i?-200:l).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",Qi).attr("x",$i?h:-200).attr("y",$i?-200:j).attr("width",10).attr("height",10),pj.selectAll("text").data(a).text(function(a){return d(Eg[a])?Eg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),pj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),pj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).style("fill",Qi).attr("x",g).attr("y",j),pj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=Ef.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?tf(b):uf(b):cj}),N(t),O(u),M(C),n(),R(),nf(),m(q,c)}function Af(a){return Ec(Ff.data.targets,a.id)}function Bf(a){return"data"in a&&Ec(Ff.data.targets,a.data.id)}function Cf(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 Df(a,b,c){var d=!he(Ff.data.targets);Oi=!1,be(a,b),of(c||{withTransitionForAxis:d})}var Ef=a.d3?a.d3:a.require?a.require("d3"):void 0,Ff={data:{},axis:{},legend:{}},Gf={},Hf=h(["bindto"],"#chart"),If=h(["size","width"]),Jf=h(["size","height"]),Kf=h(["padding","left"],50),Lf=h(["padding","right"]),Mf=h(["zoom","enabled"],!1),Nf=h(["zoom","extent"]),Of=h(["zoom","privileged"],!1),Pf=h(["onenter"],function(){}),Qf=h(["onleave"],function(){}),Rf=h(["onresize"],function(){}),Sf=h(["onresized"],function(){}),Tf=h(["transition","duration"],350);g("data","data is required in config");var Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag=h(["data","x"]),Bg=h(["data","xs"],{}),Cg=h(["data","x_format"]),Dg=h(["data","id_converter"],function(a){return a}),Eg=h(["data","names"],{}),Fg=h(["data","classes"],{}),Gg=h(["data","groups"],[]),Hg=h(["data","axes"],{}),Ig=h(["data","type"]),Jg=h(["data","types"],{}),Kg=h(["data","labels"],{}),Lg=h(["data","order"]),Mg=h(["data","regions"],{}),Ng=h(["data","color"]),Og=h(["data","colors"],{}),Pg=h(["data","hide"],!1),Qg=h(["data","selection","enabled"],!1),Rg=h(["data","selection","grouped"],!1),Sg=h(["data","selection","isselectable"],function(){return!0}),Tg=h(["data","selection","multiple"],!0),Ug=h(["data","onclick"],function(){}),Vg=h(["data","onenter"],function(){}),Wg=h(["data","onleave"],function(){}),Xg=h(["data","onselected"],function(){}),Yg=h(["data","onunselected"],function(){}),Zg=h(["data","ondragstart"],function(){}),$g=h(["data","ondragend"],function(){}),_g=h(["subchart","show"],!1),ah=h(["subchart","size","height"],60),bh=h(["color","pattern"],[]),ch=h(["legend","show"],!0),dh=h(["legend","position"],"bottom"),eh=h(["legend","item","onclick"]),fh=h(["legend","item","onmouseover"]),gh=h(["legend","item","onmouseout"]),hh=h(["legend","equally"],!1),ih=h(["axis","rotated"],!1),jh=h(["axis","x","show"],!0),kh=h(["axis","x","type"],"indexed"),lh=h(["axis","x","localtime"],!0),mh=h(["axis","x","categories"],[]),nh=h(["axis","x","tick","centered"],!1),oh=h(["axis","x","tick","format"]),ph=h(["axis","x","tick","culling"],{}),qh=h(["axis","x","tick","culling","max"],10),rh=h(["axis","x","tick","count"]),sh=h(["axis","x","tick","fit"],!0),th=h(["axis","x","tick","values"],null),uh=h(["axis","x","tick","rotate"]),vh=h(["axis","x","max"],null),wh=h(["axis","x","min"],null),xh=h(["axis","x","padding"],{}),yh=h(["axis","x","height"]),zh=h(["axis","x","default"]),Ah=h(["axis","x","label"],{}),Bh=h(["axis","y","show"],!0),Ch=h(["axis","y","max"]),Dh=h(["axis","y","min"]),Eh=h(["axis","y","center"]),Fh=h(["axis","y","label"],{}),Gh=h(["axis","y","inner"],!1),Hh=h(["axis","y","tick","format"]),Ih=h(["axis","y","padding"]),Jh=h(["axis","y","ticks"],10),Kh=h(["axis","y2","show"],!1),Lh=h(["axis","y2","max"]),Mh=h(["axis","y2","min"]),Nh=h(["axis","y2","center"]),Oh=h(["axis","y2","label"],{}),Ph=h(["axis","y2","inner"],!1),Qh=h(["axis","y2","tick","format"]),Rh=h(["axis","y2","padding"]),Sh=h(["axis","y2","ticks"],10),Th=h(["grid","x","show"],!1),Uh=h(["grid","x","type"],"tick"),Vh=h(["grid","x","lines"],[]),Wh=h(["grid","y","show"],!1),Xh=h(["grid","y","lines"],[]),Yh=h(["grid","y","ticks"],10),Zh=h(["point","show"],!0),$h=h(["point","r"],2.5),_h=h(["point","focus","line","enabled"],!0),ai=h(["point","focus","expand","enabled"],!0),bi=h(["point","focus","expand","r"]),ci=h(["point","focus","select","r"]),di=h(["line","connect_null"],!1),ei=h(["bar","width"]),fi=h(["bar","width","ratio"],.6),gi=h(["pie","label","show"],!0),hi=h(["pie","label","format"]),ii=h(["pie","expand"],!0),ji=h(["pie","onclick"],function(){}),ki=h(["pie","onmouseover"],function(){}),li=h(["pie","onmouseout"],function(){}),mi=h(["donut","label","show"],!0),ni=h(["donut","label","format"]),oi=h(["donut","expand"],!0),pi=h(["donut","title"],""),qi=h(["donut","onclick"],function(){}),ri=h(["donut","onmouseover"],function(){}),si=h(["donut","onmouseout"],function(){}),ti=h(["regions"],[]),ui=h(["tooltip","show"],!0),vi=h(["tooltip","format","title"]),wi=h(["tooltip","format","value"]),xi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=vi?vi:b,l=wi?wi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id,a[g].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),yi=h(["tooltip","init","show"],!1),zi=h(["tooltip","init","x"],0),Ai=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Bi=("string"==typeof Hf?Hf.replace("#",""):Hf.id)+"-clip",Ci=Bi+"-xaxis",Di=Bi+"-yaxis",Ei=i(Bi),Fi=i(Ci),Gi=i(Di),Hi="timeseries"===kh,Ii="categorized"===kh,Ji=!Hi&&(Ag||Be(Bg)),Ki=null,Li=!1,Mi=!1,Ni=!1,Oi=!1,Pi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Qi=ve(Og,Be(bh)?bh:Pi,Ng),Ri=lh?Ef.time.format:Ef.time.format.utc,Si=function(){var a=[[Ri("%Y/%-m/%-d"),function(){return!0}],[Ri("%-m/%-d"),function(a){return a.getMonth()}],[Ri("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ri("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ri("%I %p"),function(a){return a.getHours()}],[Ri("%I:%M"),function(a){return a.getMinutes()}],[Ri(":%S"),function(a){return a.getSeconds()}],[Ri(".%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)}}(),Ti=[],Ui=[],Vi=ih?"left":"bottom",Wi=ih?Gh?"top":"bottom":Gh?"right":"left",Xi=ih?Ph?"bottom":"top":Ph?"left":"right",Yi=ih?"left":"bottom",Zi={main:function(){return"translate("+Uf.left+","+Uf.top+")"},context:function(){return"translate("+Vf.left+","+Vf.top+")"},legend:function(){return"translate("+Wf.left+","+Wf.top+")"},x:function(){return"translate(0,"+(ih?0:Zf)+")"},y:function(){return"translate(0,"+(ih?Zf:0)+")"},y2:function(){return"translate("+(ih?0:Xf)+","+(ih?1:0)+")"},subx:function(){return"translate(0,"+(ih?0:$f)+")"},arc:function(){return"translate("+Xf/2+","+Zf/2+")"}},$i="right"===dh,_i=0,aj=0,bj=0,cj=.15,dj=30,ej=ih&&!jh?0:30,fj=5;hg=Ef.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var gj,hj=function(){var a=Ef.svg.line().x(ih?function(a){return V(a.id)(a.value)}:Fd).y(ih?Fd:function(a){return V(a.id)(a.value)});return di||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=di?Ne(b.values):b.values;return ie(b)?(a.interpolate(je(b)?"cardinal":"linear"),Mg[b.id]?af(e,qg,V(b.id),Mg[b.id]):a(e)):(c=e[0]?qg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ih?"M "+d+" "+c:"M "+c+" "+d)}}(),ij=function(){var a;return a=ih?Ef.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Fd):Ef.svg.area().x(Fd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ne(b.values);return ce([b],"area")||ce([b],"area-spline")?(a.interpolate(je(b)?"cardinal":"linear"),a(e)):(c=e[0]?qg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ih?"M "+d+" "+c:"M "+c+" "+d)}}(),jj=function(){var a=Ef.svg.line().x(ih?function(a){return W(a.id)(a.value)}:Id).y(ih?Id:function(a){return W(a.id)(a.value)});return function(b){var c=Ne(b.values);return ie(b)?a(c):"M "+tg(c[0].x)+" "+W(b.id)(c[0].value)}}(),kj=function(){};gj=Ef.svg.brush().on("brush",kf),gj.update=function(){return oj&&oj.select("."+f.brush).call(this),this},gj.scale=function(a){return ih?this.y(a):this.x(a)},Mf&&(kj=Ef.behavior.zoom().on("zoomstart",function(){kj.altDomain=Ef.event.sourceEvent.altKey?qg.orgDomain():null}).on("zoom",Mf?lf:null),kj.scale=function(a){return ih?this.y(a):this.x(a)},kj.orgScaleExtent=function(){var a=Nf?Nf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},kj.updateScaleExtent=function(){var a=ac(qg.orgDomain())/ac(sj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var lj,mj,nj,oj,pj,qj,rj,sj,tj,uj={};if(Ff.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=lj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);Ff.revert(),Ff.defocus(),b(d.classed(f.focused,!0)),b(e),he(Ff.data.targets)&&Nb(a,!0),vf(a,!0)},Ff.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=lj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);Ff.revert(),b(d.classed(f.focused,!1)),b(e),he(Ff.data.targets)&&Ob(a),vf(a,!1)},Ff.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=lj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);b(d.classed(f.focused,!1)),b(e),he(Ff.data.targets)&&Ob(a),wf()},Ff.show=function(a,b){a=Dc(a),b=b||{},Mc(a),lj.selectAll(qd(a)).transition().style("opacity",1),b.withLegend&&xf(a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ff.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),lj.selectAll(qd(a)).transition().style("opacity",0),b.withLegend&&yf(a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ff.toggle=function(a){Gc(a)?Ff.hide(a):Ff.show(a)},Ff.unzoom=function(){gj.clear().update(),jf({withUpdateXDomain:!0})},Ff.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Fg[b]=a.classes[b]}),"categories"in a&&Ii&&(mh=a.categories,wg.categories(mh)),"cacheIds"in a&&bc(a.cacheIds)?void qf(dc(a.cacheIds),a.done):void("unload"in a?sf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){rf(a)}):rf(a))},Ff.unload=function(a,b){sf(Dc(a),function(){jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Ff.selected=function(a){return Ef.merge(nj.selectAll("."+f.shapes+od(a)).selectAll("."+f.shape).filter(function(){return Ef.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Ff.select=function(a,b,c){Qg&&nj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=Ef.select(this),i=e.data?e.data.id:e.id,j=Me(this),k=Rg||!a||a.indexOf(i)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Sg(e)&&!m&&j(!0,h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(!1,h.classed(f.SELECTED,!1),e,g)})},Ff.unselect=function(a,b){Qg&&nj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=Ef.select(this),g=c.data?c.data.id:c.id,h=Me(this),i=Rg||!a||a.indexOf(g)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(f.SELECTED); i&&j&&Sg(c)&&k&&h(!1,e.classed(f.SELECTED,!1),c,d)})},Ff.toLine=function(a){Df(a,"line")},Ff.toSpline=function(a){Df(a,"spline")},Ff.toBar=function(a){Df(a,"bar")},Ff.toScatter=function(a){Df(a,"scatter")},Ff.toArea=function(a){Df(a,"area")},Ff.toAreaSpline=function(a){Df(a,"area-spline")},Ff.toPie=function(a){Df(a,"pie",{withTransform:!0})},Ff.toDonut=function(a){Df(a,"donut",{withTransform:!0})},Ff.groups=function(a){return c(a)?Gg:(Gg=a,jf(),Gg)},Ff.xgrids=function(a){return a?(Vh=a,jf(),Vh):Vh},Ff.xgrids.add=function(a){return a?Ff.xgrids(Vh.concat(a)):void 0},Ff.xgrids.remove=function(a){var b=Cf(a);return Ff.xgrids(Vh.filter(b))},Ff.ygrids=function(a){return a?(Xh=a,jf(),Xh):Xh},Ff.ygrids.add=function(a){return a?Ff.ygrids(Xh.concat(a)):void 0},Ff.ygrids.remove=function(a){var b=Cf(a);return Ff.ygrids(Xh.filter(b))},Ff.regions=function(a){return c(a)?ti:(ti=a,jf(),ti)},Ff.regions.add=function(a){return c(a)?ti:(ti=ti.concat(a),jf(),ti)},Ff.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;lj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ti=ti.filter(function(b){return b.classes.indexOf(a)<0})}),ti},Ff.data.get=function(a){var b=Ff.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Ff.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},Ff.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Eg[b]=a[b]}),zf(Cc(Ff.data.targets),{withTransition:!0}),Eg):Eg},Ff.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Og[b]=a[b]}),jf({withLegend:!0}),Og):Og},Ff.x=function(a){return arguments.length&&(qc(Ff.data.targets,a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ff.data.xs},Ff.xs=function(a){return arguments.length&&(rc(Ff.data.targets,a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ff.data.xs},Ff.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},Ff.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Ch=+a.y),b(a.y2)&&(Lh=+a.y2)):Ch=Lh=+a,jf())},Ff.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Dh=+a.y),b(a.y2)&&(Mh=+a.y2)):Dh=Mh=+a,jf())},Ff.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Ff.axis.max(a.max),"undefined"!=typeof a.min&&Ff.axis.min(a.min))},Ff.legend.show=function(a){xf(Dc(a)),jf({withLegend:!0})},Ff.legend.hide=function(a){yf(Dc(a)),jf({withLegend:!0})},Ff.resize=function(a){If=a?a.width:null,Jf=a?a.height:null,of({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Ff.destroy=function(){Ff.data.targets=void 0,Ff.data.xs={},rj.html(""),a.onresize=null},"url"in e.data)Ef.xhr(e.data.url,function(a,b){var c,d=Ef.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Ef.csv.parse(b.response),bf(c)});else if("rows"in e.data)bf(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");bf(uc(e.data.columns))}return Ff},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 009d4c76f96237ed2f4968ff5482b520b5c2d8de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Go=CC=88bel?= Date: Fri, 2 May 2014 14:21:33 +0200 Subject: [PATCH 122/178] charts now look much sharper To get everything looks sharper, move the main container 0.5 pixels in each direction. It's a known issue on D3 (check http://mbostock.github.io/d3/tutorial/bar-2.html). Half-pixel offsets disable anti-aliasing. Additionally, some values gets rounded and some elements get sharpened by CSS. Know bugs: - grid-lines sometimes have an offset of 1px - does not work after windows.resize --- c3.css | 8 ++++ c3.js | 111 +++++++++++++++++++++++++++++++++++++++--------------- c3.min.js | 6 +-- 3 files changed, 91 insertions(+), 34 deletions(-) diff --git a/c3.css b/c3.css index 737e783..29c7e60 100644 --- a/c3.css +++ b/c3.css @@ -13,6 +13,14 @@ user-select: none; } +.c3-legend-item-tile, +.c3-xgrid-focus, +.c3-ygrid, +.c3-event-rect, +.c3-bars path { + shape-rendering: crispEdges; +} + .c3-chart-arc path { stroke: #fff; diff --git a/c3.js b/c3.js index 4ab19e7..e85eabb 100644 --- a/c3.js +++ b/c3.js @@ -334,13 +334,13 @@ subXOrient = __axis_rotated ? "left" : "bottom"; var translate = { - main : function () { return "translate(" + margin.left + "," + margin.top + ")"; }, - context : function () { return "translate(" + margin2.left + "," + margin2.top + ")"; }, + main : function () { return "translate(" + (Math.ceil(margin.left) + 0.5) + "," + (Math.ceil(margin.top) + 0.5) + ")"; }, + context : function () { return "translate(" + (Math.ceil(margin2.left) + 0.5) + "," + (Math.ceil(margin2.top) + 0.5) + ")"; }, legend : function () { return "translate(" + margin3.left + "," + margin3.top + ")"; }, x : function () { return "translate(0," + (__axis_rotated ? 0 : height) + ")"; }, y : function () { return "translate(0," + (__axis_rotated ? height : 0) + ")"; }, y2 : function () { return "translate(" + (__axis_rotated ? 0 : width) + "," + (__axis_rotated ? 1 : 0) + ")"; }, - subx : function () { return "translate(0," + (__axis_rotated ? 0 : height2) + ")"; }, + subx : function () { return "translate(0," + (__axis_rotated ? 0 : Math.ceil(height2)) + ")"; }, arc: function () { return "translate(" + width / 2 + "," + height / 2 + ")"; } }; @@ -469,9 +469,9 @@ function updateXgridFocus() { main.select('line.' + CLASS.xgridFocus) .attr("x1", __axis_rotated ? 0 : -10) - .attr("x2", __axis_rotated ? width : -10) - .attr("y1", __axis_rotated ? -10 : margin.top) - .attr("y2", __axis_rotated ? -10 : height); + .attr("x2", __axis_rotated ? Math.ceil(width) : -10) + .attr("y1", __axis_rotated ? -10 : Math.ceil(margin.top)) + .attr("y2", __axis_rotated ? -10 : Math.ceil(height)); } function updateRadius() { radiusExpanded = height / 2; @@ -982,10 +982,10 @@ case "bottom": { tickTransform = axisX; - lineEnter.attr("y2", tickMajorSize); - textEnter.attr("y", Math.max(tickMajorSize, 0) + tickPadding); - lineUpdate.attr("x1", tickX).attr("x2", tickX).attr("y2", tickMajorSize); - textUpdate.attr("x", 0).attr("y", Math.max(tickMajorSize, 0) + tickPadding); + lineEnter.attr("y2", Math.ceil(tickMajorSize)); + textEnter.attr("y", Math.ceil(Math.max(tickMajorSize, 0) + tickPadding)); + lineUpdate.attr("x1", Math.ceil(tickX)).attr("x2", Math.ceil(tickX)).attr("y2", Math.ceil(tickMajorSize)); + textUpdate.attr("x", 0).attr("y", Math.ceil(Math.max(tickMajorSize, 0) + tickPadding)); text.attr("dy", ".71em").style("text-anchor", "middle"); text.text(formattedCategory); pathUpdate.attr("d", "M" + range[0] + "," + tickEndSize + "V0H" + range[1] + "V" + tickEndSize); @@ -1007,10 +1007,10 @@ case "left": { tickTransform = axisY; - lineEnter.attr("x2", -tickMajorSize); - textEnter.attr("x", -(Math.max(tickMajorSize, 0) + tickPadding)); - lineUpdate.attr("x2", -tickMajorSize).attr("y2", 0); - textUpdate.attr("x", -(Math.max(tickMajorSize, 0) + tickPadding)).attr("y", tickOffset); + lineEnter.attr("x2", -(Math.ceil(tickMajorSize))); + textEnter.attr("x", -(Math.ceil(Math.max(tickMajorSize, 0) + tickPadding))); + lineUpdate.attr("x2", -(Math.ceil(tickMajorSize))).attr("y2", 0); + textUpdate.attr("x", -(Math.ceil(Math.max(tickMajorSize, 0) + tickPadding))).attr("y", Math.ceil(tickOffset)); text.attr("dy", ".32em").style("text-anchor", "end"); text.text(formattedCategory); pathUpdate.attr("d", "M" + -tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + -tickEndSize); @@ -2002,11 +2002,14 @@ if (! __tooltip_show) { return; } // Hide when scatter plot exists if (hasScatterType(c3.data.targets) || hasArcType(c3.data.targets)) { return; } - main.selectAll('line.' + CLASS.xgridFocus) + var focusEl = main.selectAll('line.' + CLASS.xgridFocus); + focusEl .style("visibility", "visible") .data([dataToShow[0]]) .attr(__axis_rotated ? 'y1' : 'x1', xx) .attr(__axis_rotated ? 'y2' : 'x2', xx); + smoothLines(focusEl, 'grid'); + } function hideXGridFocus() { main.select('line.' + CLASS.xgridFocus).style("visibility", "hidden"); @@ -3149,7 +3152,31 @@ __data_ondragend(); } + function smoothLines(el, type) { + if (type === 'tick') { + var t = d3.transform(el.attr("transform")), + x = t.translate[0], + y = t.translate[1]; + el.attr("transform", "translate(" + Math.ceil(x) + "," + Math.ceil(y) + ")"); + } else if (type === 'grid') { + el.each(function () { + var g = d3.select(this), + x1 = g.attr('x1'), + x2 = g.attr('x2'), + y1 = g.attr('y1'), + y2 = g.attr('y2'); + g.attr({ + 'x1': Math.ceil(x1), + 'x2': Math.ceil(x2), + 'y1': Math.ceil(y1), + 'y2': Math.ceil(y2), + }); + }); + } + } + function redraw(options) { + var xaxis, subxaxis, yaxis, y2axis, xgrid, xgridData, xgridLines, xgridLine, ygrid, ygridLines, ygridLine; var mainLine, mainArea, mainCircle, mainBar, mainArc, mainRegion, mainText, contextLine, contextBar, eventRect, eventRectUpdate; var barIndices = getBarIndices(), maxDataCountTarget; @@ -3225,10 +3252,29 @@ y2.domain(getYDomain(targetsToShow, 'y2')); // axes - transitions.axisX.call(xAxis); - transitions.axisY.call(yAxis); - transitions.axisY2.call(y2Axis); - transitions.axisSubX.call(subXAxis); + transitions.axisX.call(xAxis).each('end', function () { + d3.select(this).selectAll('.tick').each(function () { + smoothLines(d3.select(this), 'tick'); + }); + }); + + transitions.axisY.call(yAxis).each('end', function () { + d3.select(this).selectAll('.tick').each(function () { + smoothLines(d3.select(this), 'tick'); + }); + }); + + transitions.axisY2.call(y2Axis).each('end', function () { + d3.select(this).selectAll('.tick').each(function () { + smoothLines(d3.select(this), 'tick'); + }); + }); + + transitions.axisSubX.call(subXAxis).each('end', function () { + d3.select(this).selectAll('.tick').each(function () { + smoothLines(d3.select(this), 'tick'); + }); + }); // show/hide if manual culling needed if (withUpdateXDomain && targetsToShow.length) { @@ -3291,10 +3337,10 @@ xgrid = main.select('.' + CLASS.xgrids).selectAll('.' + CLASS.xgrid) .data(xgridData); xgrid.enter().append('line').attr("class", CLASS.xgrid); - xgrid.attr("x1", __axis_rotated ? 0 : function (d) { return x(d) - xAxis.tickOffset(); }) - .attr("x2", __axis_rotated ? width : function (d) { return x(d) - xAxis.tickOffset(); }) - .attr("y1", __axis_rotated ? function (d) { return x(d) - xAxis.tickOffset(); } : margin.top) - .attr("y2", __axis_rotated ? function (d) { return x(d) - xAxis.tickOffset(); } : height) + xgrid.attr("x1", __axis_rotated ? 0 : function (d) { return Math.ceil(x(d) - xAxis.tickOffset()); }) + .attr("x2", __axis_rotated ? Math.ceil(width) : function (d) { return Math.ceil(x(d) - xAxis.tickOffset()); }) + .attr("y1", __axis_rotated ? function (d) { return Math.ceil(x(d) - xAxis.tickOffset()); } : Math.ceil(margin.top)) + .attr("y2", __axis_rotated ? function (d) { return Math.ceil(x(d) - xAxis.tickOffset()); } : Math.ceil(height)) .style("opacity", function () { return +d3.select(this).attr(__axis_rotated ? 'y1' : 'x1') === (__axis_rotated ? height : 0) ? 0 : 1; }); xgrid.exit().remove(); } @@ -3315,10 +3361,10 @@ // udpate xgridLines.select('line') .transition().duration(duration) - .attr("x1", __axis_rotated ? 0 : xv) - .attr("x2", __axis_rotated ? width : xv) - .attr("y1", __axis_rotated ? xv : margin.top) - .attr("y2", __axis_rotated ? xv : height) + .attr("x1", __axis_rotated ? 0 : Math.ceil(xv)) + .attr("x2", __axis_rotated ? Math.ceil(width) : Math.ceil(xv)) + .attr("y1", __axis_rotated ? Math.ceil(xv) : Math.ceil(margin.top)) + .attr("y2", __axis_rotated ? Math.ceil(xv) : Math.ceil(height)) .style("opacity", 1); xgridLines.select('text') .transition().duration(duration) @@ -3342,6 +3388,9 @@ .attr("y1", __axis_rotated ? 0 : y) .attr("y2", __axis_rotated ? height : y); ygrid.exit().remove(); + + smoothLines(ygrid, 'grid'); + } if (withY && notEmpty(__grid_y_lines)) { ygridLines = main.select('.' + CLASS.ygridLines).selectAll('.' + CLASS.ygridLine) @@ -3360,10 +3409,10 @@ // update ygridLines.select('line') .transition().duration(duration) - .attr("x1", __axis_rotated ? yv : 0) - .attr("x2", __axis_rotated ? yv : width) - .attr("y1", __axis_rotated ? 0 : yv) - .attr("y2", __axis_rotated ? height : yv) + .attr("x1", __axis_rotated ? Math.ceil(yv) : 0) + .attr("x2", __axis_rotated ? Math.ceil(yv) : Math.ceil(width)) + .attr("y1", __axis_rotated ? 0 : Math.ceil(yv)) + .attr("y2", __axis_rotated ? Math.ceil(height) : Math.ceil(yv)) .style("opacity", 1); ygridLines.select('text') .transition().duration(duration) diff --git a/c3.min.js b/c3.min.js index 4fe0f02..cd05424 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.34"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",lines:"c3-lines",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",arcs:"c3-arcs",area:"c3-area",areas:"c3-areas",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",legendItemFocused:"c3-legend-item-focused",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;cXf&&(Xf=0),0>Zf&&(Zf=0),Yf=ih?Uf.left-dj-ej:Xf,$f=ih?Zf:ag-Vf.top-Vf.bottom,0>Yf&&(Yf=0),0>$f&&($f=0),p(),$i&&he(Ff.data.targets)&&(Wf.left=Xf/2+cg)}function o(){nj.select("line."+f.xgridFocus).attr("x1",ih?0:-10).attr("x2",ih?Xf:-10).attr("y1",ih?-10:Uf.top).attr("y2",ih?-10:Zf)}function p(){cg=Zf/2,bg=.95*cg,dg=ge(Ff.data.targets)?.6*bg:0}function q(){var a=ih?f.axisX:f.axisY,b=nj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Ef.select(Hf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return If?If:x()}function s(){var a=Jf?Jf:y();return a>0?a:320}function t(){return he(Ff.data.targets)?0:Kf?Kf:ih?jh?v("x"):1:!Bh||Gh?1:v("y")}function u(){var a=1;return he(Ff.data.targets)?0:Lf?Lf:$i?P()+(Kh&&!ih?v("y2"):a):Kh?Ph||ih?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||jh?"x"===a&&yh?yh:"y"!==a||Bh?"y2"!==a||Kh?(jb(a).isInner?30:40)+("y2"===a?-10:0):fj:ch&&!$i?10:1:0}function x(){return+Ef.select(Hf).style("width").replace("px","")}function y(){return+Ef.select(Hf).style("height").replace("px","")}function z(a){return a?-5:-(Uf.left-1)}function A(a){return a?-20:-4}function B(){return z(!ih)}function C(){return A(!ih)}function D(){return z(ih)}function E(){return A(ih)}function F(a){return a?Xf+2+4:Uf.left+20}function G(a){return a?(yh?yh:0)+80:Zf+8}function H(){return F(!ih)}function I(){return G(!ih)}function J(){return F(ih)}function K(){return G(ih)}function L(){var a,b,c,d,e,f=Ac(Ff.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=qg(b.x)-qg(a.x),0===c?ih?Zf:Xf:(d=zc(),e=de(Ff.data.targets)?(d-(Ii?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function M(a){_i=a}function N(a){aj=a}function O(a){bj=a}function P(){return ch?$i?aj*(_i+1):_f:0}function Q(){return ch?$i?ag:bj*(_i+1):0}function R(){var a,b,c=!qg;ig=ih?1:0,jg=ih?Zf:Xf,kg=ih?0:Zf,lg=ih?Xf:1,mg=ig,ng=jg,og=ih?0:$f,pg=ih?Yf:1,qg=T(ig,jg,c?void 0:qg.domain(),function(){return wg.tickOffset()}),rg=U(kg,lg,c?void 0:rg.domain()),sg=U(kg,lg,c?void 0:sg.domain()),tg=T(ig,jg,sj,function(a){return a%1?0:zg.tickOffset()}),ug=U(og,pg,c?void 0:ug.domain()),vg=U(og,pg,c?void 0:vg.domain()),a=$(),b=th?th:c?void 0:wg.tickValues(),wg=X(qg,Vi,a,b),zg=X(tg,Yi,a,b),xg=Y(rg,Wi,Hh,Jh),yg=Y(sg,Xi,Qh,Sh),c||(gj.scale(tg),Mf&&kj.scale(qg)),S()}function S(){eg=Gb(),fg=Hb(),gg=Hb(.98)}function T(a,b,d,e){var f=(Hi?Ef.time.scale():Ef.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Ii){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=Ef.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?sg:rg}function W(a){return"y2"===Z(a)?vg:ug}function X(a,b,c,d){var e=(Ii?Eb():Ef.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Ii?(e.tickCentered(nh),Ae(ph)&&(ph=!1)):e.tickOffset=function(){var a=Bc(Ff.data.targets),b=qg(a[1])-qg(a[0]),c=b?b:ih?Zf:Xf;return c/zc()/2},Ii&&e.categories(mh),e}function Y(a,b,c,d){return Ef.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Hg?Hg[a]:"y"}function $(){var a=Hi?Si:Ii?Tc:function(a){return 0>a?a.toFixed(0):a};return oh&&("function"==typeof oh?a=oh:Hi&&(a=function(a){return a?Ri(oh)(a):""})),a}function _(a){var b;return"y"===a?b=Fh:"y2"===a?b=Oh:"x"===a&&(b=Ah),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Fh=b:"y2"===a?Oh=b:"x"===a&&(Ah=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",ih?"inner-top":"inner-right")}function hb(){return fb("y",ih?"inner-right":"inner-top")}function ib(){return fb("y2",ih?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Xf/2:Xf:b.isBottom?-Zf:b.isMiddle?-Zf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!ih,gb())}function rb(){return nb(ih,hb())}function sb(){return nb(ih,ib())}function tb(){return ob(!ih,gb())}function ub(){return ob(ih,hb())}function vb(){return ob(ih,ib())}function wb(){var a=gb();return ih?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":yh?yh-10:"3em"}function xb(){var a=hb();return ih?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return ih?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!ih,gb())}function Ab(){return pb(ih,hb())}function Bb(){return pb(ih,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return Ef.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){nj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),nj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),nj.select("."+f.axisY2+" ."+f.axisY2Label).transition().attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 Ef.min(Object.keys(i).map(function(a){return Ef.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(Gg.length>0)for(g=Sc(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 Ef.max(Object.keys(i).map(function(a){return Ef.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Mh:Dh,n="y2"===c?Lh:Ch,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Nh:Eh,r=xd()&&ih;return 0===l.length?"y2"===c?sg.domain():rg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=yd(o,p),j=ac(rg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),"y2"===c&&Rh&&(f=b(Rh.top)?Rh.top:e,g=b(Rh.bottom)?Rh.bottom:e),de(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return wh?Hi?we(wh):wh:Ef.min(a,function(a){return Ef.min(a.values,function(a){return a.x})})}function Zb(a){return vh?Hi?we(vh):vh:Ef.max(a,function(a){return Ef.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Ii?d=0:de(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof xh&&Be(xh)?(e=b(xh.left)?xh.left:d,f=b(xh.right)?xh.right:d):e=f="number"==typeof xh?xh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return c-d===0&&(c=Hi?new Date(.5*c.getTime()):-.5,d=Hi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Hi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Hi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?rg:sg;return b="y"===a.axis||"y2"===a.axis?ih?Zf:"start"in a?d(a.start):Zf:ih?"end"in a?qg(Hi?we(a.end):a.end):Zf:Zf,c>b?0:b-c}function ic(a){return Ag&&a===Ag||Be(Bg)&&Ce(Bg,a)}function jc(a){return!ic(a)}function kc(a){return Ag?Ag:Be(Bg)?Bg[a]:null}function lc(a,b){var c,d=b&&Be(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=Ff.data.xs[b])}),c}function mc(a,b){return a in Ff.data.xs&&Ff.data.xs[a]&&Ff.data.xs[a][b]?Ff.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){Bg[b]=a[b]})}function oc(a){return 1===Ef.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=Eg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),Ff.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=Hi?a?a instanceof Date?a:we(a):we(mc(c,d)):Ji&&!Ii?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Ff.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Ag?(d=Object.keys(Ff.data.xs),Ff.data.xs[c]=d.length>0?Ff.data.xs[d[0]]:void 0):Be(Bg)&&(Ff.data.xs[c]=lc(f,Ff.data.targets)):Ff.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Ff.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Dg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ji&&Ii&&0===c&&g&&(0===e&&(mh=[]),mh.push(g)),("undefined"==typeof a[b]||Ff.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ig&&be(Cc(c).filter(function(a){return!(a in Jg)}),Ig),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&Ff.data.targets[0].values[a-1]?Ff.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(Ff.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Hi?new Date(i):i);j.push(e)}return Hi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Ti=Ti.concat(a)}function Mc(a){Ti=Ti.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Ui=Ui.concat(a)}function Oc(a){Ui=Ui.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Jd(a,f))),(a[g].x||0===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=De(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Nd(a,b){return Ef.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Od(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 Pd(){return Lg&&"desc"===Lg.toLowerCase()}function Qd(){return Lg&&"asc"===Lg.toLowerCase()}function Rd(a){var b=Qd(),c=Pd();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 Lg&&a.sort(Lg),a}function Sd(a,c){var d,e,f,g,h,i,j,k=he(Ff.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&ui&&(qj.html(xi(a,$(),zd(k),Qi)).style("display","block"),d=qj.property("offsetWidth"),e=qj.property("offsetHeight"),k?(g=Xf/2+c[0],i=Zf/2+c[1]+20):(ih?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=qg(l[0].x)+20):(f=q(),g=f+t()+qg(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),qj.style("top",i+"px").style("left",g+"px"))}function Td(){qj.style("display","none")}function Ud(a){var c=a.filter(function(a){return a&&b(a.value)});ui&&(ee(Ff.data.targets)||he(Ff.data.targets)||nj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(ih?"y1":"x1",Fd).attr(ih?"y2":"x2",Fd))}function Vd(){nj.select("line."+f.xgridFocus).style("visibility","hidden")}function Wd(a){return a.x||0===a.x?qg(a.x):null}function Xd(a){return V(a.id)(a.value)}function Yd(){var a,b,d={},e=0;return Ic(Fc(ke)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ae(a,b){return"number"==typeof ei?ei:b?2*a.tickOffset()*fi/b:0}function be(a,b){Dc(a).forEach(function(a){uj[a]=b===Jg[a],Jg[a]=b})}function ce(a,b){var c=!1;return a.forEach(function(a){Jg[a.id]===b&&(c=!0),a.id in Jg||"line"!==b||(c=!0)}),c}function de(a){return ce(a,"bar")}function ee(a){return ce(a,"scatter")}function fe(a){return ce(a,"pie")}function ge(a){return ce(a,"donut")}function he(a){return fe(a)||ge(a)}function ie(a){var b="string"==typeof a?a:a.id;return!(b in Jg)||"line"===Jg[b]||"spline"===Jg[b]||"area"===Jg[b]||"area-spline"===Jg[b]}function je(a){var b="string"==typeof a?a:a.id;return"spline"===Jg[b]||"area-spline"===Jg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"bar"===Jg[b]}function le(a){var b="string"==typeof a?a:a.id;return"scatter"===Jg[b]}function me(a){var b="string"==typeof a?a:a.id;return"pie"===Jg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"donut"===Jg[b]}function oe(a){return me(a)||ne(a)}function pe(a){return ie(a)?[a]:[]}function qe(a){return oe(a.data)?[a]:[]}function re(a){return ke(a)?a.values:[]}function se(a){return ie(a)||le(a)?a.values:[]}function te(a){return ke(a)||ie(a)?a.values:[]}function ue(a){return ne(a)&&oi||me(a)&&ii}function ve(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function we(b){var c;try{c=Cg?Ef.time.format(Cg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Cg)}return c}function xe(a,b){var c=Ef.mouse(a),d=Ef.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ce(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function De(a,b){var c="y"===Z(a.id)?rg:sg,d=ih?1:0,e=ih?0:1;return Math.pow(qg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ee(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Fe(a,b,c){Xg(b,a.node()),nj.select("."+f.selectedCircles+od(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",ih?Xd:Wd).attr("cy",ih?Wd:Xd).attr("stroke",function(){return Qi(b)}).attr("r",1.4*Qe(b)).transition().duration(100).attr("r",Qe)}function Ge(a,b,c){Yg(b,a.node()),nj.select("."+f.selectedCircles+od(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function He(a,b,c,d){a?Fe(b,c,d):Ge(b,c,d)}function Ie(a,b){Xg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ef.rgb(Qi(b)).brighter(.75)})}function Je(a,b){Yg(b,a.node()),a.transition().duration(100).style("fill",function(){return Qi(b)})}function Ke(a,b,c,d){a?Ie(b,c,d):Je(b,c,d)}function Le(a,b,c,d){Ke(a,b,c.data,d)}function Me(a){return"circle"===a.nodeName?He:Ef.select(a).classed(f.bar)?Ke:Le}function Ne(a){return a.filter(function(a){return b(a.value)})}function Oe(a){return Zh?"function"==typeof $h?$h(a):$h:0}function Pe(a){return ai?bi?bi:1.75*Oe(a):Oe(a)}function Qe(a){return ci?ci:4*Oe(a)}function Re(a,c){return(c?nj.selectAll("."+f.circles+od(c)):nj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Se(a,b){Re(a,b).classed(f.EXPANDED,!0).attr("r",Pe)}function Te(a){Re(a).filter(function(){return Ef.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oe)}function Ue(a){return nj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ve(a){Ue(a).classed(f.EXPANDED,!0)}function We(a){Ue(a).classed(f.EXPANDED,!1)}function Xe(a,b){var c=_e(a,b);return function(a,b){var d=c(a,b),e=ih?1:0,f=ih?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 Ye(a,b){var c=_e(a,!1),d=b?Ze:$e;return function(a,b){return d(c(a,b),a,this)}}function Ze(a,b){var c;return ih?(c=ke(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function $e(a,b,c){var d=c.getBoundingClientRect();return ih?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ke(b)?-3:-6)}function _e(a,b){var c=a.__max__+1,d=ae(wg,c),e=Zd(d,c,a,!!b),f=$d(!!b),g=_d(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return ih&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function af(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 bf(b){var c,d,e;if(rj=Ef.select(Hf),rj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(rj.html("").classed("c3",!0),Ff.data.xs={},Ff.data.targets=vc(b),Pg&&Lc(Pg===!0?Cc(Ff.data.targets):Pg),n(),R(),qg.domain(Ef.extent(_b(Ff.data.targets))),rg.domain(Xb(Ff.data.targets,"y")),sg.domain(Xb(Ff.data.targets,"y2")),tg.domain(qg.domain()),ug.domain(rg.domain()),vg.domain(sg.domain()),sj=qg.domain(),gj.scale(tg),Mf&&kj.scale(qg),lj=rj.append("svg").on("mouseenter",Pf).on("mouseleave",Qf),mj=lj.append("defs"),mj.append("clipPath").attr("id",Bi).append("rect"),mj.append("clipPath").attr("id",Ci).append("rect"),mj.append("clipPath").attr("id",Di).append("rect"),nf(),nj=lj.append("g").attr("transform",Zi.main),oj=lj.append("g").attr("transform",Zi.context),pj=lj.append("g").attr("transform",Zi.legend),_g||oj.style("visibility","hidden"),ch||(pj.style("visibility","hidden"),Ui=Cc(Ff.data.targets)),qj=Ef.select(Hf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),zf(Cc(Ff.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=nj.append("g").attr("clip-path",Ei).attr("class",f.grid),Th&&d.append("g").attr("class",f.xgrids),Be(Vh)&&d.append("g").attr("class",f.xgridLines),_h&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Wh&&d.append("g").attr("class",f.ygrids),Be(Xh)&&d.append("g").attr("class",f.ygridLines),jh&&nj.append("g").attr("class",f.axisX).attr("clip-path",Fi).attr("transform",Zi.x).append("text").attr("class",f.axisXLabel).attr("transform",ih?"rotate(-90)":"").style("text-anchor",zb),Bh&&nj.append("g").attr("class",f.axisY).attr("clip-path",Gi).attr("transform",Zi.y).append("text").attr("class",f.axisYLabel).attr("transform",ih?"":"rotate(-90)").style("text-anchor",Ab),Kh&&nj.append("g").attr("class",f.axisY2).attr("transform",Zi.y2).append("text").attr("class",f.axisY2Label).attr("transform",ih?"":"rotate(-90)").style("text-anchor",Bb),nj.append("g").attr("clip-path",Ei).attr("class",f.regions),nj.append("g").attr("clip-path",Ei).attr("class",f.chart),c=nj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Mf?ih?"ns-resize":"ew-resize":null),nj.select("."+f.chart).append("g").attr("class",f.chartBars),nj.select("."+f.chart).append("g").attr("class",f.chartLines),nj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Zi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),nj.select("."+f.chart).append("g").attr("class",f.chartTexts),Mf&&nj.insert("rect",Of?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Xf).attr("height",Zf).style("opacity",0).style("cursor",ih?"ns-resize":"ew-resize").call(kj).on("dblclick.zoom",null),zh&&gj.extent("function"!=typeof zh?zh:zh(_b())),oj.append("g").attr("clip-path",Ei).attr("class",f.chart),oj.select("."+f.chart).append("g").attr("class",f.chartBars),oj.select("."+f.chart).append("g").attr("class",f.chartLines),oj.append("g").attr("clip-path",Ei).attr("class",f.brush).call(gj).selectAll("rect").attr(ih?"width":"height",ih?Yf:$f),oj.append("g").attr("class",f.axisX).attr("transform",Zi.subx).attr("clip-path",ih?"":Fi),pf(Ff.data.targets),ih?nj.select("."+f.axisX).style("opacity",0).call(wg):(nj.select("."+f.axisY).style("opacity",0).call(xg),nj.select("."+f.axisY2).style("opacity",0).call(yg)),n(),R(),nf(),m(!1),jf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),yi){if(Hi&&"string"==typeof zi){for(zi=we(zi),e=0;e0){d=[];for(var g in Eg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Od(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ke,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 gf(a){he(Ff.data.targets)||Qg&&(Ki=a,nj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Li=!0,Zg())}function hf(){he(Ff.data.targets)||Qg&&(nj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),nj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Li=!1,$g())}function jf(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z=Yd(),$=he(Ff.data.targets),_=Ic(Ff.data.targets);if(a=d(a)?a:{},E=d(a.withY)?a.withY:!0,F=d(a.withSubchart)?a.withSubchart:!0,G=d(a.withTransition)?a.withTransition:!0,J=d(a.withTransform)?a.withTransform:!1,K=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,M=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,N=d(a.withLegend)?a.withLegend:!1,H=d(a.withTransitionForExit)?a.withTransitionForExit:G,I=d(a.withTransitionForAxis)?a.withTransitionForAxis:G,T=G?Tf:0,U=H?T:0,V=I?T:0,c=nj.select("."+f.axisX).style("opacity",$?0:1),g=nj.select("."+f.axisY).style("opacity",$?0:1),h=nj.select("."+f.axisY2).style("opacity",$?0:1),e=oj.select("."+f.axisX).style("opacity",$?0:1),S={axisX:c.transition().duration(V),axisY:g.transition().duration(V),axisY2:h.transition().duration(V),axisSubX:e.transition().duration(V)},N&&ch&&zf(Cc(Ff.data.targets),a,S),Ii&&(0!==_.length&&M&&K||qg.domain([0,c.selectAll(".tick").size()])),_.length&&(M&&(qg.domain(Ef.extent(_b(_))),sj=qg.domain(),Mf&&kj.scale(qg).updateScaleExtent(),tg.domain(qg.domain()),gj.scale(tg)),K&&(qg.domain(gj.empty()?sj:gj.extent()),Mf&&kj.scale(qg).updateScaleExtent()),th||!sh&&!rh||(W=Kc(Jc(_),rh),wg.tickValues(W),zg.tickValues(W))),rg.domain(Xb(_,"y")),sg.domain(Xb(_,"y2")),S.axisX.call(wg),S.axisY.call(xg),S.axisY2.call(yg),S.axisSubX.call(zg),K&&_.length)if(ph&&W){for(X=1;X=0&&Ef.select(this).style("display",b%Y?"none":"block")})}else lj.selectAll("."+f.axisX+" .tick text").style("display","block");if(!ih&&uh&&eb(c,S.axisX,uh),O=Xe(Z),Q=Ye(Z,!0),R=Ye(Z,!1),Db(),ug.domain(rg.domain()),vg.domain(sg.domain()),qj.style("display","none"),o(),nj.select("line."+f.xgridFocus).style("visibility","hidden"),Th){if("year"===Uh){j=[];for(var ab=_b(),bb=ab[0].getFullYear(),cb=ab[1].getFullYear(),db=bb;cb>=db;db++)j.push(new Date(db+"-01-01 00:00:00"))}else j=qg.ticks(10);i=nj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",ih?0:function(a){return qg(a)-wg.tickOffset()}).attr("x2",ih?Xf:function(a){return qg(a)-wg.tickOffset()}).attr("y1",ih?function(a){return qg(a)-wg.tickOffset()}:Uf.top).attr("y2",ih?function(a){return qg(a)-wg.tickOffset()}:Zf).style("opacity",function(){return+Ef.select(this).attr(ih?"y1":"x1")===(ih?Zf:0)?0:1}),i.exit().remove()}Be(Vh)&&(k=nj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Vh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",ih?"":"rotate(-90)").attr("dx",ih?0:-Uf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",ih?0:Gd).attr("x2",ih?Xf:Gd).attr("y1",ih?Gd:Uf.top).attr("y2",ih?Gd:Zf).style("opacity",1),k.select("text").transition().duration(T).attr("x",ih?Xf:0).attr("y",Gd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),E&&Wh&&(m=nj.select("."+f.ygrids).selectAll("."+f.ygrid).data(rg.ticks(Yh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",ih?rg:0).attr("x2",ih?rg:Xf).attr("y1",ih?0:rg).attr("y2",ih?Zf:rg),m.exit().remove()),E&&Be(Xh)&&(n=nj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Xh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",ih?"rotate(-90)":"").attr("dx",ih?0:-Uf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(T).attr("x1",ih?Hd:0).attr("x2",ih?Hd:Xf).attr("y1",ih?0:Hd).attr("y2",ih?Zf:Hd).style("opacity",1),n.select("text").transition().duration(T).attr("x",ih?0:Xf).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(T).style("opacity",0).remove()),v=nj.select("."+f.regions).selectAll("rect."+f.region).data(ti),v.enter().append("rect").style("fill-opacity",0),v.attr("class",hd).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(T).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),v.exit().transition().duration(T).style("fill-opacity",0).remove(),t=nj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),t.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Qi),t.style("opacity",td).transition().duration(T).attr("d",O).style("fill",Qi).style("opacity",1),t.exit().transition().duration(U).style("opacity",0).remove(),q=nj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),q.enter().append("path").attr("class",Zc).style("stroke",Qi),q.style("opacity",td).transition().duration(T).attr("d",hj).style("opacity",1),q.exit().transition().duration(U).style("opacity",0).remove(),r=nj.selectAll("."+f.areas).selectAll("."+f.area).data(pe),r.enter().append("path").attr("class",fd).style("fill",Qi).style("opacity",function(){return tj=+Ef.select(this).style("opacity"),0}),r.style("opacity",0).transition().duration(T).attr("d",ij).style("opacity",tj),r.exit().transition().duration(U).style("opacity",0).remove(),s=nj.selectAll("."+f.circles).selectAll("."+f.circle).data(se),s.enter().append("circle").attr("class",_c).attr("r",Oe),s.style("opacity",td).transition().duration(T).style("opacity",vd).attr("cx",ih?Xd:Wd).attr("cy",ih?Wd:Xd),s.exit().remove(),w=nj.selectAll("."+f.texts).selectAll("."+f.text).data(te),w.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return ih?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),w.text(function(a){return Ed(a.id)(a.value,a.id)}).style("fill-opacity",ud).transition().duration(T).attr("x",Q).attr("y",R).style("fill-opacity",wd),w.exit().transition().duration(U).style("fill-opacity",0).remove(),u=nj.selectAll("."+f.arcs).selectAll("."+f.arc).data(qe),u.enter().append("path").attr("class",dd).style("fill",function(a){return Qi(a.data)}).style("cursor",function(a){return Sg(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Oi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),vf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Sd(d,Ef.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Oi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),wf(),Td(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();ef(this,a,b),e(d,b)}),u.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Oi=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Fb(a);return c?(b=Ef.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("opacity",1).call(Ee,function(){Oi=!1}),u.exit().transition().duration(U).style("opacity",0).remove(),nj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(T).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&oe(a.data)?1:0}),nj.select("."+f.chartArcsTitle).style("opacity",ge(Ff.data.targets)?1:0),_g&&(null!==Ef.event&&"zoom"===Ef.event.type&&gj.extent(qg.orgDomain()).update(),F&&(!ih&&uh&&eb(e,S.axisSubX,uh),gj.empty()||gj.extent(qg.orgDomain()).update(),P=Xe(Z,!0),y=oj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),y.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Qi),y.style("opacity",td).transition().duration(T).attr("d",P).style("opacity",1),y.exit().transition().duration(T).style("opacity",0).remove(),x=oj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),x.enter().append("path").attr("class",Zc).style("stroke",Qi),x.style("opacity",td).transition().duration(T).attr("d",jj).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove())),nj.selectAll("."+f.selectedCircles).filter(function(a){return ke(a)}).selectAll("circle").remove(),nj.selectAll("."+f.selectedCircle).transition().duration(T).attr("cx",ih?Xd:Wd).attr("cy",ih?Wd:Xd),z=nj.select("."+f.eventRects),Be(Bg)&&!oc(Bg)?(z.classed(f.eventRectsMultiple)||z.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),A=nj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),df(A.enter()),A.attr("x",0).attr("y",0).attr("width",Xf).attr("height",Zf)):(z.classed(f.eventRectsSingle)||z.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ji&&!Ii?(D=function(a,b){var c=xc(b),d=yc(b),e=Ff.data.xs[a.id][b];return(qg(d?d:e+50)-qg(c?c:e-50))/2},C=function(a,b){var c=xc(b),d=Ff.data.xs[a.id][b];return(qg(d)+qg(c?c:d-50))/2}):(D=L(),C=function(a){return qg(a.x)-D/2}),B=Ac(Ff.data.targets),nj.select("."+f.eventRects).datum(B?B.values:[]),A=nj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),cf(A.enter()),A.attr("class",id).attr("x",ih?0:C).attr("y",ih?C:0).attr("width",ih?Xf:D).attr("height",ih?D:Zf),A.exit().remove()),Cc(Ff.data.targets).forEach(function(a){uj[a]=!0})}function kf(){jf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function lf(){return"mousemove"===Ef.event.sourceEvent.type&&kj.altDomain?(qg.domain(kj.altDomain),void kj.scale(qg).updateScaleExtent()):(Ii&&qg.orgDomain()[0]===sj[0]&&qg.domain([sj[0]-1e-10,qg.orgDomain()[1]]),jf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Ef.event.sourceEvent.type&&(Mi=!0)))}function mf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function nf(){lj.attr("width",_f).attr("height",ag),lj.select("#"+Bi).select("rect").attr("width",Xf).attr("height",Zf),lj.select("#"+Ci).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),lj.select("#"+Di).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),lj.select("."+f.zoomRect).attr("width",Xf).attr("height",Zf),rj.style("max-height",ag+"px")}function of(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),nf(),m(a.withTransition),jf(a)}function pf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=nj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",kd),j=i.enter().append("g").attr("class",kd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",Qi),e=nj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",md),d=e.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",cd).style("cursor",function(a){return Sg(a)?"pointer":null}),c=nj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",ld),b=c.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",$c),b.append("g").attr("class",gd),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",ad).style("fill",Qi).style("cursor",function(a){return Sg(a)?"pointer":null}),a.forEach(function(a){nj.selectAll("."+f.selectedCircles+od(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=nj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(hg(a)).attr("class",nd),g=h.enter().append("g").attr("class",nd),g.append("g").attr("class",ed),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),_g&&(n=oj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",md),m=n.enter().append("g").style("opacity",0).attr("class",md),m.append("g").attr("class",cd),l=oj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",ld),k=l.enter().append("g").style("opacity",0).attr("class",ld),k.append("g").attr("class",$c)),lj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Tf).style("opacity",1)}function qf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?be(a.id,b.types[a.id]):be(a.id,b.type)}),Ff.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=$i?j:i,l=$i?Q():P();return d&&(w=0,C=0,t=0,u=0),ch&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=$i?u:t,void(hh?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=pj.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,$i?(g=function(a){return t*(.2+B[a])},j=function(a){return A[B[a]]+x[a]}):(g=function(a){return A[B[a]]+x[a]},j=function(a){return u*(.2+B[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=pj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof eh?eh(a):Ff.toggle(a)}).on("mouseover",function(a){Ef.select(this).classed(f.legendItemFocused,!0),Oi||Ff.focus(a),"function"==typeof fh&&fh(a)}).on("mouseout",function(a){Ef.select(this).classed(f.legendItemFocused,!1),Oi||Ff.revert(),"function"==typeof gh&&gh(a)}),o.append("text").text(function(a){return d(Eg[a])?Eg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",$i?h:-200).attr("y",$i?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",$i?i:-200).attr("y",$i?-200:l).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Qi(a)}).attr("x",$i?h:-200).attr("y",$i?-200:j).attr("width",10).attr("height",10),pj.selectAll("text").data(a).text(function(a){return d(Eg[a])?Eg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),pj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),pj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),pj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=Ef.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?tf(b):uf(b):cj}),N(t),O(u),M(C),n(),R(),nf(),m(q,c)}function Af(a){return Ec(Ff.data.targets,a.id)}function Bf(a){return"data"in a&&Ec(Ff.data.targets,a.data.id)}function Cf(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 Df(a,b,c){var d=!he(Ff.data.targets);Oi=!1,be(a,b),of(c||{withTransitionForAxis:d})}var Ef=a.d3?a.d3:a.require?a.require("d3"):void 0,Ff={data:{},axis:{},legend:{}},Gf={},Hf=h(["bindto"],"#chart"),If=h(["size","width"]),Jf=h(["size","height"]),Kf=h(["padding","left"],50),Lf=h(["padding","right"]),Mf=h(["zoom","enabled"],!1),Nf=h(["zoom","extent"]),Of=h(["zoom","privileged"],!1),Pf=h(["onenter"],function(){}),Qf=h(["onleave"],function(){}),Rf=h(["onresize"],function(){}),Sf=h(["onresized"],function(){}),Tf=h(["transition","duration"],350);g("data","data is required in config");var Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag=h(["data","x"]),Bg=h(["data","xs"],{}),Cg=h(["data","x_format"]),Dg=h(["data","id_converter"],function(a){return a}),Eg=h(["data","names"],{}),Fg=h(["data","classes"],{}),Gg=h(["data","groups"],[]),Hg=h(["data","axes"],{}),Ig=h(["data","type"]),Jg=h(["data","types"],{}),Kg=h(["data","labels"],{}),Lg=h(["data","order"]),Mg=h(["data","regions"],{}),Ng=h(["data","color"]),Og=h(["data","colors"],{}),Pg=h(["data","hide"],!1),Qg=h(["data","selection","enabled"],!1),Rg=h(["data","selection","grouped"],!1),Sg=h(["data","selection","isselectable"],function(){return!0}),Tg=h(["data","selection","multiple"],!0),Ug=h(["data","onclick"],function(){}),Vg=h(["data","onenter"],function(){}),Wg=h(["data","onleave"],function(){}),Xg=h(["data","onselected"],function(){}),Yg=h(["data","onunselected"],function(){}),Zg=h(["data","ondragstart"],function(){}),$g=h(["data","ondragend"],function(){}),_g=h(["subchart","show"],!1),ah=h(["subchart","size","height"],60),bh=h(["color","pattern"],[]),ch=h(["legend","show"],!0),dh=h(["legend","position"],"bottom"),eh=h(["legend","item","onclick"]),fh=h(["legend","item","onmouseover"]),gh=h(["legend","item","onmouseout"]),hh=h(["legend","equally"],!1),ih=h(["axis","rotated"],!1),jh=h(["axis","x","show"],!0),kh=h(["axis","x","type"],"indexed"),lh=h(["axis","x","localtime"],!0),mh=h(["axis","x","categories"],[]),nh=h(["axis","x","tick","centered"],!1),oh=h(["axis","x","tick","format"]),ph=h(["axis","x","tick","culling"],{}),qh=h(["axis","x","tick","culling","max"],10),rh=h(["axis","x","tick","count"]),sh=h(["axis","x","tick","fit"],!0),th=h(["axis","x","tick","values"],null),uh=h(["axis","x","tick","rotate"]),vh=h(["axis","x","max"],null),wh=h(["axis","x","min"],null),xh=h(["axis","x","padding"],{}),yh=h(["axis","x","height"]),zh=h(["axis","x","default"]),Ah=h(["axis","x","label"],{}),Bh=h(["axis","y","show"],!0),Ch=h(["axis","y","max"]),Dh=h(["axis","y","min"]),Eh=h(["axis","y","center"]),Fh=h(["axis","y","label"],{}),Gh=h(["axis","y","inner"],!1),Hh=h(["axis","y","tick","format"]),Ih=h(["axis","y","padding"]),Jh=h(["axis","y","ticks"],10),Kh=h(["axis","y2","show"],!1),Lh=h(["axis","y2","max"]),Mh=h(["axis","y2","min"]),Nh=h(["axis","y2","center"]),Oh=h(["axis","y2","label"],{}),Ph=h(["axis","y2","inner"],!1),Qh=h(["axis","y2","tick","format"]),Rh=h(["axis","y2","padding"]),Sh=h(["axis","y2","ticks"],10),Th=h(["grid","x","show"],!1),Uh=h(["grid","x","type"],"tick"),Vh=h(["grid","x","lines"],[]),Wh=h(["grid","y","show"],!1),Xh=h(["grid","y","lines"],[]),Yh=h(["grid","y","ticks"],10),Zh=h(["point","show"],!0),$h=h(["point","r"],2.5),_h=h(["point","focus","line","enabled"],!0),ai=h(["point","focus","expand","enabled"],!0),bi=h(["point","focus","expand","r"]),ci=h(["point","focus","select","r"]),di=h(["line","connect_null"],!1),ei=h(["bar","width"]),fi=h(["bar","width","ratio"],.6),gi=h(["pie","label","show"],!0),hi=h(["pie","label","format"]),ii=h(["pie","expand"],!0),ji=h(["pie","onclick"],function(){}),ki=h(["pie","onmouseover"],function(){}),li=h(["pie","onmouseout"],function(){}),mi=h(["donut","label","show"],!0),ni=h(["donut","label","format"]),oi=h(["donut","expand"],!0),pi=h(["donut","title"],""),qi=h(["donut","onclick"],function(){}),ri=h(["donut","onmouseover"],function(){}),si=h(["donut","onmouseout"],function(){}),ti=h(["regions"],[]),ui=h(["tooltip","show"],!0),vi=h(["tooltip","format","title"]),wi=h(["tooltip","format","value"]),xi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=vi?vi:b,l=wi?wi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id,a[g].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),yi=h(["tooltip","init","show"],!1),zi=h(["tooltip","init","x"],0),Ai=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Bi=("string"==typeof Hf?Hf.replace("#",""):Hf.id)+"-clip",Ci=Bi+"-xaxis",Di=Bi+"-yaxis",Ei=i(Bi),Fi=i(Ci),Gi=i(Di),Hi="timeseries"===kh,Ii="categorized"===kh,Ji=!Hi&&(Ag||Be(Bg)),Ki=null,Li=!1,Mi=!1,Ni=!1,Oi=!1,Pi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Qi=ve(Og,Be(bh)?bh:Pi,Ng),Ri=lh?Ef.time.format:Ef.time.format.utc,Si=function(){var a=[[Ri("%Y/%-m/%-d"),function(){return!0}],[Ri("%-m/%-d"),function(a){return a.getMonth()}],[Ri("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ri("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ri("%I %p"),function(a){return a.getHours()}],[Ri("%I:%M"),function(a){return a.getMinutes()}],[Ri(":%S"),function(a){return a.getSeconds()}],[Ri(".%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)}}(),Ti=[],Ui=[],Vi=ih?"left":"bottom",Wi=ih?Gh?"top":"bottom":Gh?"right":"left",Xi=ih?Ph?"bottom":"top":Ph?"left":"right",Yi=ih?"left":"bottom",Zi={main:function(){return"translate("+Uf.left+","+Uf.top+")"},context:function(){return"translate("+Vf.left+","+Vf.top+")"},legend:function(){return"translate("+Wf.left+","+Wf.top+")"},x:function(){return"translate(0,"+(ih?0:Zf)+")"},y:function(){return"translate(0,"+(ih?Zf:0)+")"},y2:function(){return"translate("+(ih?0:Xf)+","+(ih?1:0)+")"},subx:function(){return"translate(0,"+(ih?0:$f)+")"},arc:function(){return"translate("+Xf/2+","+Zf/2+")"}},$i="right"===dh,_i=0,aj=0,bj=0,cj=.15,dj=30,ej=ih&&!jh?0:30,fj=5;hg=Ef.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var gj,hj=function(){var a=Ef.svg.line().x(ih?function(a){return V(a.id)(a.value)}:Fd).y(ih?Fd:function(a){return V(a.id)(a.value)});return di||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=di?Ne(b.values):b.values;return ie(b)?(a.interpolate(je(b)?"cardinal":"linear"),Mg[b.id]?af(e,qg,V(b.id),Mg[b.id]):a(e)):(c=e[0]?qg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ih?"M "+d+" "+c:"M "+c+" "+d)}}(),ij=function(){var a;return a=ih?Ef.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Fd):Ef.svg.area().x(Fd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ne(b.values);return ce([b],"area")||ce([b],"area-spline")?(a.interpolate(je(b)?"cardinal":"linear"),a(e)):(c=e[0]?qg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ih?"M "+d+" "+c:"M "+c+" "+d)}}(),jj=function(){var a=Ef.svg.line().x(ih?function(a){return W(a.id)(a.value)}:Id).y(ih?Id:function(a){return W(a.id)(a.value)});return function(b){var c=Ne(b.values);return ie(b)?a(c):"M "+tg(c[0].x)+" "+W(b.id)(c[0].value)}}(),kj=function(){};gj=Ef.svg.brush().on("brush",kf),gj.update=function(){return oj&&oj.select("."+f.brush).call(this),this},gj.scale=function(a){return ih?this.y(a):this.x(a)},Mf&&(kj=Ef.behavior.zoom().on("zoomstart",function(){kj.altDomain=Ef.event.sourceEvent.altKey?qg.orgDomain():null}).on("zoom",Mf?lf:null),kj.scale=function(a){return ih?this.y(a):this.x(a)},kj.orgScaleExtent=function(){var a=Nf?Nf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},kj.updateScaleExtent=function(){var a=ac(qg.orgDomain())/ac(sj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var lj,mj,nj,oj,pj,qj,rj,sj,tj,uj={};if(Ff.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=lj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);Ff.revert(),Ff.defocus(),b(d.classed(f.focused,!0)),b(e),he(Ff.data.targets)&&Nb(a,!0),vf(a,!0)},Ff.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=lj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);Ff.revert(),b(d.classed(f.focused,!1)),b(e),he(Ff.data.targets)&&Ob(a),vf(a,!1)},Ff.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=lj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);b(d.classed(f.focused,!1)),b(e),he(Ff.data.targets)&&Ob(a),wf()},Ff.show=function(a,b){a=Dc(a),b=b||{},Mc(a),lj.selectAll(qd(a)).transition().style("opacity",1),b.withLegend&&xf(a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ff.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),lj.selectAll(qd(a)).transition().style("opacity",0),b.withLegend&&yf(a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ff.toggle=function(a){Gc(a)?Ff.hide(a):Ff.show(a)},Ff.unzoom=function(){gj.clear().update(),jf({withUpdateXDomain:!0})},Ff.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Fg[b]=a.classes[b]}),"categories"in a&&Ii&&(mh=a.categories,wg.categories(mh)),"cacheIds"in a&&bc(a.cacheIds)?void qf(dc(a.cacheIds),a.done):void("unload"in a?sf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){rf(a)}):rf(a))},Ff.unload=function(a,b){sf(Dc(a),function(){jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Ff.selected=function(a){return Ef.merge(nj.selectAll("."+f.shapes+od(a)).selectAll("."+f.shape).filter(function(){return Ef.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Ff.select=function(a,b,c){Qg&&nj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=Ef.select(this),i=e.data?e.data.id:e.id,j=Me(this),k=Rg||!a||a.indexOf(i)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Sg(e)&&!m&&j(!0,h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(!1,h.classed(f.SELECTED,!1),e,g)})},Ff.unselect=function(a,b){Qg&&nj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=Ef.select(this),g=c.data?c.data.id:c.id,h=Me(this),i=Rg||!a||a.indexOf(g)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(f.SELECTED);i&&j&&Sg(c)&&k&&h(!1,e.classed(f.SELECTED,!1),c,d) -})},Ff.toLine=function(a){Df(a,"line")},Ff.toSpline=function(a){Df(a,"spline")},Ff.toBar=function(a){Df(a,"bar")},Ff.toScatter=function(a){Df(a,"scatter")},Ff.toArea=function(a){Df(a,"area")},Ff.toAreaSpline=function(a){Df(a,"area-spline")},Ff.toPie=function(a){Df(a,"pie",{withTransform:!0})},Ff.toDonut=function(a){Df(a,"donut",{withTransform:!0})},Ff.groups=function(a){return c(a)?Gg:(Gg=a,jf(),Gg)},Ff.xgrids=function(a){return a?(Vh=a,jf(),Vh):Vh},Ff.xgrids.add=function(a){return a?Ff.xgrids(Vh.concat(a)):void 0},Ff.xgrids.remove=function(a){var b=Cf(a);return Ff.xgrids(Vh.filter(b))},Ff.ygrids=function(a){return a?(Xh=a,jf(),Xh):Xh},Ff.ygrids.add=function(a){return a?Ff.ygrids(Xh.concat(a)):void 0},Ff.ygrids.remove=function(a){var b=Cf(a);return Ff.ygrids(Xh.filter(b))},Ff.regions=function(a){return c(a)?ti:(ti=a,jf(),ti)},Ff.regions.add=function(a){return c(a)?ti:(ti=ti.concat(a),jf(),ti)},Ff.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;lj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ti=ti.filter(function(b){return b.classes.indexOf(a)<0})}),ti},Ff.data.get=function(a){var b=Ff.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Ff.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},Ff.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Eg[b]=a[b]}),zf(Cc(Ff.data.targets),{withTransition:!0}),Eg):Eg},Ff.x=function(a){return arguments.length&&(qc(Ff.data.targets,a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ff.data.xs},Ff.xs=function(a){return arguments.length&&(rc(Ff.data.targets,a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ff.data.xs},Ff.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},Ff.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Ch=+a.y),b(a.y2)&&(Lh=+a.y2)):Ch=Lh=+a,jf())},Ff.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Dh=+a.y),b(a.y2)&&(Mh=+a.y2)):Dh=Mh=+a,jf())},Ff.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Ff.axis.max(a.max),"undefined"!=typeof a.min&&Ff.axis.min(a.min))},Ff.legend.show=function(a){xf(Dc(a)),jf({withLegend:!0})},Ff.legend.hide=function(a){yf(Dc(a)),jf({withLegend:!0})},Ff.resize=function(a){If=a?a.width:null,Jf=a?a.height:null,of({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Ff.destroy=function(){Ff.data.targets=void 0,Ff.data.xs={},rj.html(""),a.onresize=null},"url"in e.data)Ef.xhr(e.data.url,function(a,b){var c,d=Ef.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Ef.csv.parse(b.response),bf(c)});else if("rows"in e.data)bf(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");bf(uc(e.data.columns))}return Ff},"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.34"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",lines:"c3-lines",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",arcs:"c3-arcs",area:"c3-area",areas:"c3-areas",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",legendItemFocused:"c3-legend-item-focused",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;cYf&&(Yf=0),0>$f&&($f=0),Zf=jh?Vf.left-ej-fj:Yf,_f=jh?$f:bg-Wf.top-Wf.bottom,0>Zf&&(Zf=0),0>_f&&(_f=0),p(),_i&&he(Gf.data.targets)&&(Xf.left=Yf/2+dg)}function o(){oj.select("line."+f.xgridFocus).attr("x1",jh?0:-10).attr("x2",jh?Math.ceil(Yf):-10).attr("y1",jh?-10:Math.ceil(Vf.top)).attr("y2",jh?-10:Math.ceil($f))}function p(){dg=$f/2,cg=.95*dg,eg=ge(Gf.data.targets)?.6*cg:0}function q(){var a=jh?f.axisX:f.axisY,b=oj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Ff.select(If).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Jf?Jf:x()}function s(){var a=Kf?Kf:y();return a>0?a:320}function t(){return he(Gf.data.targets)?0:Lf?Lf:jh?kh?v("x"):1:!Ch||Hh?1:v("y")}function u(){var a=1;return he(Gf.data.targets)?0:Mf?Mf:_i?P()+(Lh&&!jh?v("y2"):a):Lh?Qh||jh?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||kh?"x"===a&&zh?zh:"y"!==a||Ch?"y2"!==a||Lh?(jb(a).isInner?30:40)+("y2"===a?-10:0):gj:dh&&!_i?10:1:0}function x(){return+Ff.select(If).style("width").replace("px","")}function y(){return+Ff.select(If).style("height").replace("px","")}function z(a){return a?-5:-(Vf.left-1)}function A(a){return a?-20:-4}function B(){return z(!jh)}function C(){return A(!jh)}function D(){return z(jh)}function E(){return A(jh)}function F(a){return a?Yf+2+4:Vf.left+20}function G(a){return a?(zh?zh:0)+80:$f+8}function H(){return F(!jh)}function I(){return G(!jh)}function J(){return F(jh)}function K(){return G(jh)}function L(){var a,b,c,d,e,f=Ac(Gf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=rg(b.x)-rg(a.x),0===c?jh?$f:Yf:(d=zc(),e=de(Gf.data.targets)?(d-(Ji?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function M(a){aj=a}function N(a){bj=a}function O(a){cj=a}function P(){return dh?_i?bj*(aj+1):ag:0}function Q(){return dh?_i?bg:cj*(aj+1):0}function R(){var a,b,c=!rg;jg=jh?1:0,kg=jh?$f:Yf,lg=jh?0:$f,mg=jh?Yf:1,ng=jg,og=kg,pg=jh?0:_f,qg=jh?Zf:1,rg=T(jg,kg,c?void 0:rg.domain(),function(){return xg.tickOffset()}),sg=U(lg,mg,c?void 0:sg.domain()),tg=U(lg,mg,c?void 0:tg.domain()),ug=T(jg,kg,tj,function(a){return a%1?0:Ag.tickOffset()}),vg=U(pg,qg,c?void 0:vg.domain()),wg=U(pg,qg,c?void 0:wg.domain()),a=$(),b=uh?uh:c?void 0:xg.tickValues(),xg=X(rg,Wi,a,b),Ag=X(ug,Zi,a,b),yg=Y(sg,Xi,Ih,Kh),zg=Y(tg,Yi,Rh,Th),c||(hj.scale(ug),Nf&&lj.scale(rg)),S()}function S(){fg=Gb(),gg=Hb(),hg=Hb(.98)}function T(a,b,d,e){var f=(Ii?Ff.time.scale():Ff.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Ji){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=Ff.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?tg:sg}function W(a){return"y2"===Z(a)?wg:vg}function X(a,b,c,d){var e=(Ji?Eb():Ff.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Ji?(e.tickCentered(oh),Ae(qh)&&(qh=!1)):e.tickOffset=function(){var a=Bc(Gf.data.targets),b=rg(a[1])-rg(a[0]),c=b?b:jh?$f:Yf;return c/zc()/2},Ji&&e.categories(nh),e}function Y(a,b,c,d){return Ff.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Ig?Ig[a]:"y"}function $(){var a=Ii?Ti:Ji?Tc:function(a){return 0>a?a.toFixed(0):a};return ph&&("function"==typeof ph?a=ph:Ii&&(a=function(a){return a?Si(ph)(a):""})),a}function _(a){var b;return"y"===a?b=Gh:"y2"===a?b=Ph:"x"===a&&(b=Bh),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Gh=b:"y2"===a?Ph=b:"x"===a&&(Bh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",jh?"inner-top":"inner-right")}function hb(){return fb("y",jh?"inner-right":"inner-top")}function ib(){return fb("y2",jh?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Yf/2:Yf:b.isBottom?-$f:b.isMiddle?-$f/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!jh,gb())}function rb(){return nb(jh,hb())}function sb(){return nb(jh,ib())}function tb(){return ob(!jh,gb())}function ub(){return ob(jh,hb())}function vb(){return ob(jh,ib())}function wb(){var a=gb();return jh?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":zh?zh-10:"3em"}function xb(){var a=hb();return jh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return jh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!jh,gb())}function Ab(){return pb(jh,hb())}function Bb(){return pb(jh,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return Ff.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){oj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),oj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),oj.select("."+f.axisY2+" ."+f.axisY2Label).transition().attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 Ff.min(Object.keys(i).map(function(a){return Ff.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(Hg.length>0)for(g=Sc(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 Ff.max(Object.keys(i).map(function(a){return Ff.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Nh:Eh,n="y2"===c?Mh:Dh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Oh:Fh,r=xd()&&jh;return 0===l.length?"y2"===c?tg.domain():sg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=yd(o,p),j=ac(sg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Jh&&(f=b(Jh.top)?Jh.top:e,g=b(Jh.bottom)?Jh.bottom:e),"y2"===c&&Sh&&(f=b(Sh.top)?Sh.top:e,g=b(Sh.bottom)?Sh.bottom:e),de(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return xh?Ii?we(xh):xh:Ff.min(a,function(a){return Ff.min(a.values,function(a){return a.x})})}function Zb(a){return wh?Ii?we(wh):wh:Ff.max(a,function(a){return Ff.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Ji?d=0:de(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof yh&&Be(yh)?(e=b(yh.left)?yh.left:d,f=b(yh.right)?yh.right:d):e=f="number"==typeof yh?yh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return c-d===0&&(c=Ii?new Date(.5*c.getTime()):-.5,d=Ii?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Ii?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Ii?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?sg:tg;return b="y"===a.axis||"y2"===a.axis?jh?$f:"start"in a?d(a.start):$f:jh&&"end"in a?rg(Ii?we(a.end):a.end):$f,c>b?0:b-c}function ic(a){return Bg&&a===Bg||Be(Cg)&&Ce(Cg,a)}function jc(a){return!ic(a)}function kc(a){return Bg?Bg:Be(Cg)?Cg[a]:null}function lc(a,b){var c,d=b&&Be(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=Gf.data.xs[b])}),c}function mc(a,b){return a in Gf.data.xs&&Gf.data.xs[a]&&Gf.data.xs[a][b]?Gf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){Cg[b]=a[b]})}function oc(a){return 1===Ff.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=Fg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),Gf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=Ii?a?a instanceof Date?a:we(a):we(mc(c,d)):Ki&&!Ji?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Gf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Bg?(d=Object.keys(Gf.data.xs),Gf.data.xs[c]=d.length>0?Gf.data.xs[d[0]]:void 0):Be(Cg)&&(Gf.data.xs[c]=lc(f,Gf.data.targets)):Gf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Gf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Eg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ki&&Ji&&0===c&&g&&(0===e&&(nh=[]),nh.push(g)),("undefined"==typeof a[b]||Gf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Jg&&be(Cc(c).filter(function(a){return!(a in Kg)}),Jg),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&Gf.data.targets[0].values[a-1]?Gf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(Gf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Ii?new Date(i):i);j.push(e)}return Ii||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Ui=Ui.concat(a)}function Mc(a){Ui=Ui.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Vi=Vi.concat(a)}function Oc(a){Vi=Vi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Jd(a,f))),(a[g].x||0===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=De(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Nd(a,b){return Ff.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Od(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 Pd(){return Mg&&"desc"===Mg.toLowerCase()}function Qd(){return Mg&&"asc"===Mg.toLowerCase()}function Rd(a){var b=Qd(),c=Pd();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 Mg&&a.sort(Mg),a}function Sd(a,c){var d,e,f,g,h,i,j,k=he(Gf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&vi&&(rj.html(yi(a,$(),zd(k),Ri)).style("display","block"),d=rj.property("offsetWidth"),e=rj.property("offsetHeight"),k?(g=Yf/2+c[0],i=$f/2+c[1]+20):(jh?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=rg(l[0].x)+20):(f=q(),g=f+t()+rg(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),rj.style("top",i+"px").style("left",g+"px"))}function Td(){rj.style("display","none")}function Ud(a){var c=a.filter(function(a){return a&&b(a.value)});if(vi&&!ee(Gf.data.targets)&&!he(Gf.data.targets)){var d=oj.selectAll("line."+f.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(jh?"y1":"x1",Fd).attr(jh?"y2":"x2",Fd),jf(d,"grid")}}function Vd(){oj.select("line."+f.xgridFocus).style("visibility","hidden")}function Wd(a){return a.x||0===a.x?rg(a.x):null}function Xd(a){return V(a.id)(a.value)}function Yd(){var a,b,d={},e=0;return Ic(Fc(ke)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ae(a,b){return"number"==typeof fi?fi:b?2*a.tickOffset()*gi/b:0}function be(a,b){Dc(a).forEach(function(a){vj[a]=b===Kg[a],Kg[a]=b})}function ce(a,b){var c=!1;return a.forEach(function(a){Kg[a.id]===b&&(c=!0),a.id in Kg||"line"!==b||(c=!0)}),c}function de(a){return ce(a,"bar")}function ee(a){return ce(a,"scatter")}function fe(a){return ce(a,"pie")}function ge(a){return ce(a,"donut")}function he(a){return fe(a)||ge(a)}function ie(a){var b="string"==typeof a?a:a.id;return!(b in Kg)||"line"===Kg[b]||"spline"===Kg[b]||"area"===Kg[b]||"area-spline"===Kg[b]}function je(a){var b="string"==typeof a?a:a.id;return"spline"===Kg[b]||"area-spline"===Kg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"bar"===Kg[b]}function le(a){var b="string"==typeof a?a:a.id;return"scatter"===Kg[b]}function me(a){var b="string"==typeof a?a:a.id;return"pie"===Kg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"donut"===Kg[b]}function oe(a){return me(a)||ne(a)}function pe(a){return ie(a)?[a]:[]}function qe(a){return oe(a.data)?[a]:[]}function re(a){return ke(a)?a.values:[]}function se(a){return ie(a)||le(a)?a.values:[]}function te(a){return ke(a)||ie(a)?a.values:[]}function ue(a){return ne(a)&&pi||me(a)&&ji}function ve(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function we(b){var c;try{c=Dg?Ff.time.format(Dg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Dg)}return c}function xe(a,b){var c=Ff.mouse(a),d=Ff.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ce(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function De(a,b){var c="y"===Z(a.id)?sg:tg,d=jh?1:0,e=jh?0:1;return Math.pow(rg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ee(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Fe(a,b,c){Yg(b,a.node()),oj.select("."+f.selectedCircles+od(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",jh?Xd:Wd).attr("cy",jh?Wd:Xd).attr("stroke",function(){return Ri(b)}).attr("r",1.4*Qe(b)).transition().duration(100).attr("r",Qe)}function Ge(a,b,c){Zg(b,a.node()),oj.select("."+f.selectedCircles+od(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function He(a,b,c,d){a?Fe(b,c,d):Ge(b,c,d)}function Ie(a,b){Yg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ff.rgb(Ri(b)).brighter(.75)})}function Je(a,b){Zg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ri(b)})}function Ke(a,b,c,d){a?Ie(b,c,d):Je(b,c,d)}function Le(a,b,c,d){Ke(a,b,c.data,d)}function Me(a){return"circle"===a.nodeName?He:Ff.select(a).classed(f.bar)?Ke:Le}function Ne(a){return a.filter(function(a){return b(a.value)})}function Oe(a){return $h?"function"==typeof _h?_h(a):_h:0}function Pe(a){return bi?ci?ci:1.75*Oe(a):Oe(a)}function Qe(a){return di?di:4*Oe(a)}function Re(a,c){return(c?oj.selectAll("."+f.circles+od(c)):oj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Se(a,b){Re(a,b).classed(f.EXPANDED,!0).attr("r",Pe)}function Te(a){Re(a).filter(function(){return Ff.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oe)}function Ue(a){return oj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ve(a){Ue(a).classed(f.EXPANDED,!0)}function We(a){Ue(a).classed(f.EXPANDED,!1)}function Xe(a,b){var c=_e(a,b);return function(a,b){var d=c(a,b),e=jh?1:0,f=jh?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 Ye(a,b){var c=_e(a,!1),d=b?Ze:$e;return function(a,b){return d(c(a,b),a,this)}}function Ze(a,b){var c;return jh?(c=ke(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function $e(a,b,c){var d=c.getBoundingClientRect();return jh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ke(b)?-3:-6)}function _e(a,b){var c=a.__max__+1,d=ae(xg,c),e=Zd(d,c,a,!!b),f=$d(!!b),g=_d(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return jh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function af(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 bf(b){var c,d,e;if(sj=Ff.select(If),sj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(sj.html("").classed("c3",!0),Gf.data.xs={},Gf.data.targets=vc(b),Qg&&Lc(Qg===!0?Cc(Gf.data.targets):Qg),n(),R(),rg.domain(Ff.extent(_b(Gf.data.targets))),sg.domain(Xb(Gf.data.targets,"y")),tg.domain(Xb(Gf.data.targets,"y2")),ug.domain(rg.domain()),vg.domain(sg.domain()),wg.domain(tg.domain()),tj=rg.domain(),hj.scale(ug),Nf&&lj.scale(rg),mj=sj.append("svg").on("mouseenter",Qf).on("mouseleave",Rf),nj=mj.append("defs"),nj.append("clipPath").attr("id",Ci).append("rect"),nj.append("clipPath").attr("id",Di).append("rect"),nj.append("clipPath").attr("id",Ei).append("rect"),of(),oj=mj.append("g").attr("transform",$i.main),pj=mj.append("g").attr("transform",$i.context),qj=mj.append("g").attr("transform",$i.legend),ah||pj.style("visibility","hidden"),dh||(qj.style("visibility","hidden"),Vi=Cc(Gf.data.targets)),rj=Ff.select(If).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Af(Cc(Gf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=oj.append("g").attr("clip-path",Fi).attr("class",f.grid),Uh&&d.append("g").attr("class",f.xgrids),Be(Wh)&&d.append("g").attr("class",f.xgridLines),ai&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Xh&&d.append("g").attr("class",f.ygrids),Be(Yh)&&d.append("g").attr("class",f.ygridLines),kh&&oj.append("g").attr("class",f.axisX).attr("clip-path",Gi).attr("transform",$i.x).append("text").attr("class",f.axisXLabel).attr("transform",jh?"rotate(-90)":"").style("text-anchor",zb),Ch&&oj.append("g").attr("class",f.axisY).attr("clip-path",Hi).attr("transform",$i.y).append("text").attr("class",f.axisYLabel).attr("transform",jh?"":"rotate(-90)").style("text-anchor",Ab),Lh&&oj.append("g").attr("class",f.axisY2).attr("transform",$i.y2).append("text").attr("class",f.axisY2Label).attr("transform",jh?"":"rotate(-90)").style("text-anchor",Bb),oj.append("g").attr("clip-path",Fi).attr("class",f.regions),oj.append("g").attr("clip-path",Fi).attr("class",f.chart),c=oj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Nf?jh?"ns-resize":"ew-resize":null),oj.select("."+f.chart).append("g").attr("class",f.chartBars),oj.select("."+f.chart).append("g").attr("class",f.chartLines),oj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",$i.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),oj.select("."+f.chart).append("g").attr("class",f.chartTexts),Nf&&oj.insert("rect",Pf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Yf).attr("height",$f).style("opacity",0).style("cursor",jh?"ns-resize":"ew-resize").call(lj).on("dblclick.zoom",null),Ah&&hj.extent("function"!=typeof Ah?Ah:Ah(_b())),pj.append("g").attr("clip-path",Fi).attr("class",f.chart),pj.select("."+f.chart).append("g").attr("class",f.chartBars),pj.select("."+f.chart).append("g").attr("class",f.chartLines),pj.append("g").attr("clip-path",Fi).attr("class",f.brush).call(hj).selectAll("rect").attr(jh?"width":"height",jh?Zf:_f),pj.append("g").attr("class",f.axisX).attr("transform",$i.subx).attr("clip-path",jh?"":Gi),qf(Gf.data.targets),jh?oj.select("."+f.axisX).style("opacity",0).call(xg):(oj.select("."+f.axisY).style("opacity",0).call(yg),oj.select("."+f.axisY2).style("opacity",0).call(zg)),n(),R(),of(),m(!1),kf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),zi){if(Ii&&"string"==typeof Ai){for(Ai=we(Ai),e=0;e0){d=[];for(var g in Fg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Od(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ke,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 gf(a){he(Gf.data.targets)||Rg&&(Li=a,oj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Mi=!0,$g())}function hf(){he(Gf.data.targets)||Rg&&(oj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),oj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Mi=!1,_g())}function jf(a,b){if("tick"===b){var c=Ff.transform(a.attr("transform")),d=c.translate[0],e=c.translate[1];a.attr("transform","translate("+Math.ceil(d)+","+Math.ceil(e)+")")}else"grid"===b&&a.each(function(){var a=Ff.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function kf(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z=Yd(),$=he(Gf.data.targets),_=Ic(Gf.data.targets);if(a=d(a)?a:{},E=d(a.withY)?a.withY:!0,F=d(a.withSubchart)?a.withSubchart:!0,G=d(a.withTransition)?a.withTransition:!0,J=d(a.withTransform)?a.withTransform:!1,K=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,M=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,N=d(a.withLegend)?a.withLegend:!1,H=d(a.withTransitionForExit)?a.withTransitionForExit:G,I=d(a.withTransitionForAxis)?a.withTransitionForAxis:G,T=G?Uf:0,U=H?T:0,V=I?T:0,c=oj.select("."+f.axisX).style("opacity",$?0:1),g=oj.select("."+f.axisY).style("opacity",$?0:1),h=oj.select("."+f.axisY2).style("opacity",$?0:1),e=pj.select("."+f.axisX).style("opacity",$?0:1),S={axisX:c.transition().duration(V),axisY:g.transition().duration(V),axisY2:h.transition().duration(V),axisSubX:e.transition().duration(V)},N&&dh&&Af(Cc(Gf.data.targets),a,S),Ji&&(0!==_.length&&M&&K||rg.domain([0,c.selectAll(".tick").size()])),_.length&&(M&&(rg.domain(Ff.extent(_b(_))),tj=rg.domain(),Nf&&lj.scale(rg).updateScaleExtent(),ug.domain(rg.domain()),hj.scale(ug)),K&&(rg.domain(hj.empty()?tj:hj.extent()),Nf&&lj.scale(rg).updateScaleExtent()),uh||!th&&!sh||(W=Kc(Jc(_),sh),xg.tickValues(W),Ag.tickValues(W))),sg.domain(Xb(_,"y")),tg.domain(Xb(_,"y2")),S.axisX.call(xg).each("end",function(){Ff.select(this).selectAll(".tick").each(function(){jf(Ff.select(this),"tick")})}),S.axisY.call(yg).each("end",function(){Ff.select(this).selectAll(".tick").each(function(){jf(Ff.select(this),"tick")})}),S.axisY2.call(zg).each("end",function(){Ff.select(this).selectAll(".tick").each(function(){jf(Ff.select(this),"tick")})}),S.axisSubX.call(Ag).each("end",function(){Ff.select(this).selectAll(".tick").each(function(){jf(Ff.select(this),"tick")})}),K&&_.length)if(qh&&W){for(X=1;X=0&&Ff.select(this).style("display",b%Y?"none":"block")})}else mj.selectAll("."+f.axisX+" .tick text").style("display","block");if(!jh&&vh&&eb(c,S.axisX,vh),O=Xe(Z),Q=Ye(Z,!0),R=Ye(Z,!1),Db(),vg.domain(sg.domain()),wg.domain(tg.domain()),rj.style("display","none"),o(),oj.select("line."+f.xgridFocus).style("visibility","hidden"),Uh){if("year"===Vh){j=[];for(var ab=_b(),bb=ab[0].getFullYear(),cb=ab[1].getFullYear(),db=bb;cb>=db;db++)j.push(new Date(db+"-01-01 00:00:00"))}else j=rg.ticks(10);i=oj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",jh?0:function(a){return Math.ceil(rg(a)-xg.tickOffset())}).attr("x2",jh?Math.ceil(Yf):function(a){return Math.ceil(rg(a)-xg.tickOffset())}).attr("y1",jh?function(a){return Math.ceil(rg(a)-xg.tickOffset())}:Math.ceil(Vf.top)).attr("y2",jh?function(a){return Math.ceil(rg(a)-xg.tickOffset())}:Math.ceil($f)).style("opacity",function(){return+Ff.select(this).attr(jh?"y1":"x1")===(jh?$f:0)?0:1}),i.exit().remove()}Be(Wh)&&(k=oj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Wh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",jh?"":"rotate(-90)").attr("dx",jh?0:-Vf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",jh?0:Math.ceil(Gd)).attr("x2",Math.ceil(jh?Yf:Gd)).attr("y1",Math.ceil(jh?Gd:Vf.top)).attr("y2",Math.ceil(jh?Gd:$f)).style("opacity",1),k.select("text").transition().duration(T).attr("x",jh?Yf:0).attr("y",Gd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),E&&Xh&&(m=oj.select("."+f.ygrids).selectAll("."+f.ygrid).data(sg.ticks(Zh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",jh?sg:0).attr("x2",jh?sg:Yf).attr("y1",jh?0:sg).attr("y2",jh?$f:sg),m.exit().remove(),jf(m,"grid")),E&&Be(Yh)&&(n=oj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Yh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",jh?"rotate(-90)":"").attr("dx",jh?0:-Vf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(T).attr("x1",jh?Math.ceil(Hd):0).attr("x2",Math.ceil(jh?Hd:Yf)).attr("y1",jh?0:Math.ceil(Hd)).attr("y2",Math.ceil(jh?$f:Hd)).style("opacity",1),n.select("text").transition().duration(T).attr("x",jh?0:Yf).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(T).style("opacity",0).remove()),v=oj.select("."+f.regions).selectAll("rect."+f.region).data(ui),v.enter().append("rect").style("fill-opacity",0),v.attr("class",hd).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(T).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),v.exit().transition().duration(T).style("fill-opacity",0).remove(),t=oj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),t.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Ri),t.style("opacity",td).transition().duration(T).attr("d",O).style("fill",Ri).style("opacity",1),t.exit().transition().duration(U).style("opacity",0).remove(),q=oj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),q.enter().append("path").attr("class",Zc).style("stroke",Ri),q.style("opacity",td).transition().duration(T).attr("d",ij).style("opacity",1),q.exit().transition().duration(U).style("opacity",0).remove(),r=oj.selectAll("."+f.areas).selectAll("."+f.area).data(pe),r.enter().append("path").attr("class",fd).style("fill",Ri).style("opacity",function(){return uj=+Ff.select(this).style("opacity"),0}),r.style("opacity",0).transition().duration(T).attr("d",jj).style("opacity",uj),r.exit().transition().duration(U).style("opacity",0).remove(),s=oj.selectAll("."+f.circles).selectAll("."+f.circle).data(se),s.enter().append("circle").attr("class",_c).attr("r",Oe),s.style("opacity",td).transition().duration(T).style("opacity",vd).attr("cx",jh?Xd:Wd).attr("cy",jh?Wd:Xd),s.exit().remove(),w=oj.selectAll("."+f.texts).selectAll("."+f.text).data(te),w.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return jh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),w.text(function(a){return Ed(a.id)(a.value,a.id)}).style("fill-opacity",ud).transition().duration(T).attr("x",Q).attr("y",R).style("fill-opacity",wd),w.exit().transition().duration(U).style("fill-opacity",0).remove(),u=oj.selectAll("."+f.arcs).selectAll("."+f.arc).data(qe),u.enter().append("path").attr("class",dd).style("fill",function(a){return Ri(a.data)}).style("cursor",function(a){return Tg(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Pi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),wf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Sd(d,Ff.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Pi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),xf(),Td(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();ef(this,a,b),e(d,b)}),u.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Pi=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Fb(a);return c?(b=Ff.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("opacity",1).call(Ee,function(){Pi=!1}),u.exit().transition().duration(U).style("opacity",0).remove(),oj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(T).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&oe(a.data)?1:0}),oj.select("."+f.chartArcsTitle).style("opacity",ge(Gf.data.targets)?1:0),ah&&(null!==Ff.event&&"zoom"===Ff.event.type&&hj.extent(rg.orgDomain()).update(),F&&(!jh&&vh&&eb(e,S.axisSubX,vh),hj.empty()||hj.extent(rg.orgDomain()).update(),P=Xe(Z,!0),y=pj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),y.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Ri),y.style("opacity",td).transition().duration(T).attr("d",P).style("opacity",1),y.exit().transition().duration(T).style("opacity",0).remove(),x=pj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),x.enter().append("path").attr("class",Zc).style("stroke",Ri),x.style("opacity",td).transition().duration(T).attr("d",kj).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove())),oj.selectAll("."+f.selectedCircles).filter(function(a){return ke(a)}).selectAll("circle").remove(),oj.selectAll("."+f.selectedCircle).transition().duration(T).attr("cx",jh?Xd:Wd).attr("cy",jh?Wd:Xd),z=oj.select("."+f.eventRects),Be(Cg)&&!oc(Cg)?(z.classed(f.eventRectsMultiple)||z.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),A=oj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),df(A.enter()),A.attr("x",0).attr("y",0).attr("width",Yf).attr("height",$f)):(z.classed(f.eventRectsSingle)||z.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ki&&!Ji?(D=function(a,b){var c=xc(b),d=yc(b),e=Gf.data.xs[a.id][b];return(rg(d?d:e+50)-rg(c?c:e-50))/2},C=function(a,b){var c=xc(b),d=Gf.data.xs[a.id][b];return(rg(d)+rg(c?c:d-50))/2}):(D=L(),C=function(a){return rg(a.x)-D/2}),B=Ac(Gf.data.targets),oj.select("."+f.eventRects).datum(B?B.values:[]),A=oj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),cf(A.enter()),A.attr("class",id).attr("x",jh?0:C).attr("y",jh?C:0).attr("width",jh?Yf:D).attr("height",jh?D:$f),A.exit().remove()),Cc(Gf.data.targets).forEach(function(a){vj[a]=!0})}function lf(){kf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function mf(){return"mousemove"===Ff.event.sourceEvent.type&&lj.altDomain?(rg.domain(lj.altDomain),void lj.scale(rg).updateScaleExtent()):(Ji&&rg.orgDomain()[0]===tj[0]&&rg.domain([tj[0]-1e-10,rg.orgDomain()[1]]),kf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Ff.event.sourceEvent.type&&(Ni=!0)))}function nf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function of(){mj.attr("width",ag).attr("height",bg),mj.select("#"+Ci).select("rect").attr("width",Yf).attr("height",$f),mj.select("#"+Di).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),mj.select("#"+Ei).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),mj.select("."+f.zoomRect).attr("width",Yf).attr("height",$f),sj.style("max-height",bg+"px")}function pf(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),of(),m(a.withTransition),kf(a)}function qf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=oj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",kd),j=i.enter().append("g").attr("class",kd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",Ri),e=oj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",md),d=e.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",cd).style("cursor",function(a){return Tg(a)?"pointer":null}),c=oj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",ld),b=c.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",$c),b.append("g").attr("class",gd),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",ad).style("fill",Ri).style("cursor",function(a){return Tg(a)?"pointer":null}),a.forEach(function(a){oj.selectAll("."+f.selectedCircles+od(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=oj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(ig(a)).attr("class",nd),g=h.enter().append("g").attr("class",nd),g.append("g").attr("class",ed),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),ah&&(n=pj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",md),m=n.enter().append("g").style("opacity",0).attr("class",md),m.append("g").attr("class",cd),l=pj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",ld),k=l.enter().append("g").style("opacity",0).attr("class",ld),k.append("g").attr("class",$c)),mj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Uf).style("opacity",1)}function rf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?be(a.id,b.types[a.id]):be(a.id,b.type)}),Gf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=_i?j:i,l=_i?Q():P();return d&&(w=0,C=0,t=0,u=0),dh&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=_i?u:t,void(ih?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=qj.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,_i?(g=function(a){return t*(.2+B[a])},j=function(a){return A[B[a]]+x[a]}):(g=function(a){return A[B[a]]+x[a]},j=function(a){return u*(.2+B[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=qj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof fh?fh(a):Gf.toggle(a)}).on("mouseover",function(a){Ff.select(this).classed(f.legendItemFocused,!0),Pi||Gf.focus(a),"function"==typeof gh&&gh(a)}).on("mouseout",function(a){Ff.select(this).classed(f.legendItemFocused,!1),Pi||Gf.revert(),"function"==typeof hh&&hh(a)}),o.append("text").text(function(a){return d(Fg[a])?Fg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",_i?h:-200).attr("y",_i?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",_i?i:-200).attr("y",_i?-200:l).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Ri(a)}).attr("x",_i?h:-200).attr("y",_i?-200:j).attr("width",10).attr("height",10),qj.selectAll("text").data(a).text(function(a){return d(Fg[a])?Fg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),qj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),qj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),qj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=Ff.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?uf(b):vf(b):dj}),N(t),O(u),M(C),n(),R(),of(),m(q,c)}function Bf(a){return Ec(Gf.data.targets,a.id)}function Cf(a){return"data"in a&&Ec(Gf.data.targets,a.data.id)}function Df(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 Ef(a,b,c){var d=!he(Gf.data.targets);Pi=!1,be(a,b),pf(c||{withTransitionForAxis:d})}var Ff=a.d3?a.d3:a.require?a.require("d3"):void 0,Gf={data:{},axis:{},legend:{}},Hf={},If=h(["bindto"],"#chart"),Jf=h(["size","width"]),Kf=h(["size","height"]),Lf=h(["padding","left"],50),Mf=h(["padding","right"]),Nf=h(["zoom","enabled"],!1),Of=h(["zoom","extent"]),Pf=h(["zoom","privileged"],!1),Qf=h(["onenter"],function(){}),Rf=h(["onleave"],function(){}),Sf=h(["onresize"],function(){}),Tf=h(["onresized"],function(){}),Uf=h(["transition","duration"],350);g("data","data is required in config");var Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg=h(["data","x"]),Cg=h(["data","xs"],{}),Dg=h(["data","x_format"]),Eg=h(["data","id_converter"],function(a){return a}),Fg=h(["data","names"],{}),Gg=h(["data","classes"],{}),Hg=h(["data","groups"],[]),Ig=h(["data","axes"],{}),Jg=h(["data","type"]),Kg=h(["data","types"],{}),Lg=h(["data","labels"],{}),Mg=h(["data","order"]),Ng=h(["data","regions"],{}),Og=h(["data","color"]),Pg=h(["data","colors"],{}),Qg=h(["data","hide"],!1),Rg=h(["data","selection","enabled"],!1),Sg=h(["data","selection","grouped"],!1),Tg=h(["data","selection","isselectable"],function(){return!0}),Ug=h(["data","selection","multiple"],!0),Vg=h(["data","onclick"],function(){}),Wg=h(["data","onenter"],function(){}),Xg=h(["data","onleave"],function(){}),Yg=h(["data","onselected"],function(){}),Zg=h(["data","onunselected"],function(){}),$g=h(["data","ondragstart"],function(){}),_g=h(["data","ondragend"],function(){}),ah=h(["subchart","show"],!1),bh=h(["subchart","size","height"],60),ch=h(["color","pattern"],[]),dh=h(["legend","show"],!0),eh=h(["legend","position"],"bottom"),fh=h(["legend","item","onclick"]),gh=h(["legend","item","onmouseover"]),hh=h(["legend","item","onmouseout"]),ih=h(["legend","equally"],!1),jh=h(["axis","rotated"],!1),kh=h(["axis","x","show"],!0),lh=h(["axis","x","type"],"indexed"),mh=h(["axis","x","localtime"],!0),nh=h(["axis","x","categories"],[]),oh=h(["axis","x","tick","centered"],!1),ph=h(["axis","x","tick","format"]),qh=h(["axis","x","tick","culling"],{}),rh=h(["axis","x","tick","culling","max"],10),sh=h(["axis","x","tick","count"]),th=h(["axis","x","tick","fit"],!0),uh=h(["axis","x","tick","values"],null),vh=h(["axis","x","tick","rotate"]),wh=h(["axis","x","max"],null),xh=h(["axis","x","min"],null),yh=h(["axis","x","padding"],{}),zh=h(["axis","x","height"]),Ah=h(["axis","x","default"]),Bh=h(["axis","x","label"],{}),Ch=h(["axis","y","show"],!0),Dh=h(["axis","y","max"]),Eh=h(["axis","y","min"]),Fh=h(["axis","y","center"]),Gh=h(["axis","y","label"],{}),Hh=h(["axis","y","inner"],!1),Ih=h(["axis","y","tick","format"]),Jh=h(["axis","y","padding"]),Kh=h(["axis","y","ticks"],10),Lh=h(["axis","y2","show"],!1),Mh=h(["axis","y2","max"]),Nh=h(["axis","y2","min"]),Oh=h(["axis","y2","center"]),Ph=h(["axis","y2","label"],{}),Qh=h(["axis","y2","inner"],!1),Rh=h(["axis","y2","tick","format"]),Sh=h(["axis","y2","padding"]),Th=h(["axis","y2","ticks"],10),Uh=h(["grid","x","show"],!1),Vh=h(["grid","x","type"],"tick"),Wh=h(["grid","x","lines"],[]),Xh=h(["grid","y","show"],!1),Yh=h(["grid","y","lines"],[]),Zh=h(["grid","y","ticks"],10),$h=h(["point","show"],!0),_h=h(["point","r"],2.5),ai=h(["point","focus","line","enabled"],!0),bi=h(["point","focus","expand","enabled"],!0),ci=h(["point","focus","expand","r"]),di=h(["point","focus","select","r"]),ei=h(["line","connect_null"],!1),fi=h(["bar","width"]),gi=h(["bar","width","ratio"],.6),hi=h(["pie","label","show"],!0),ii=h(["pie","label","format"]),ji=h(["pie","expand"],!0),ki=h(["pie","onclick"],function(){}),li=h(["pie","onmouseover"],function(){}),mi=h(["pie","onmouseout"],function(){}),ni=h(["donut","label","show"],!0),oi=h(["donut","label","format"]),pi=h(["donut","expand"],!0),qi=h(["donut","title"],""),ri=h(["donut","onclick"],function(){}),si=h(["donut","onmouseover"],function(){}),ti=h(["donut","onmouseout"],function(){}),ui=h(["regions"],[]),vi=h(["tooltip","show"],!0),wi=h(["tooltip","format","title"]),xi=h(["tooltip","format","value"]),yi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=wi?wi:b,l=xi?xi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id,a[g].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),zi=h(["tooltip","init","show"],!1),Ai=h(["tooltip","init","x"],0),Bi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Ci=("string"==typeof If?If.replace("#",""):If.id)+"-clip",Di=Ci+"-xaxis",Ei=Ci+"-yaxis",Fi=i(Ci),Gi=i(Di),Hi=i(Ei),Ii="timeseries"===lh,Ji="categorized"===lh,Ki=!Ii&&(Bg||Be(Cg)),Li=null,Mi=!1,Ni=!1,Oi=!1,Pi=!1,Qi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ri=ve(Pg,Be(ch)?ch:Qi,Og),Si=mh?Ff.time.format:Ff.time.format.utc,Ti=function(){var a=[[Si("%Y/%-m/%-d"),function(){return!0}],[Si("%-m/%-d"),function(a){return a.getMonth()}],[Si("%-m/%-d"),function(a){return 1!==a.getDate()}],[Si("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Si("%I %p"),function(a){return a.getHours()}],[Si("%I:%M"),function(a){return a.getMinutes()}],[Si(":%S"),function(a){return a.getSeconds()}],[Si(".%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)}}(),Ui=[],Vi=[],Wi=jh?"left":"bottom",Xi=jh?Hh?"top":"bottom":Hh?"right":"left",Yi=jh?Qh?"bottom":"top":Qh?"left":"right",Zi=jh?"left":"bottom",$i={main:function(){return"translate("+(Math.ceil(Vf.left)+.5)+","+(Math.ceil(Vf.top)+.5)+")"},context:function(){return"translate("+(Math.ceil(Wf.left)+.5)+","+(Math.ceil(Wf.top)+.5)+")"},legend:function(){return"translate("+Xf.left+","+Xf.top+")"},x:function(){return"translate(0,"+(jh?0:$f)+")"},y:function(){return"translate(0,"+(jh?$f:0)+")"},y2:function(){return"translate("+(jh?0:Yf)+","+(jh?1:0)+")"},subx:function(){return"translate(0,"+(jh?0:Math.ceil(_f))+")"},arc:function(){return"translate("+Yf/2+","+$f/2+")"}},_i="right"===eh,aj=0,bj=0,cj=0,dj=.15,ej=30,fj=jh&&!kh?0:30,gj=5;ig=Ff.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var hj,ij=function(){var a=Ff.svg.line().x(jh?function(a){return V(a.id)(a.value)}:Fd).y(jh?Fd:function(a){return V(a.id)(a.value)});return ei||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ei?Ne(b.values):b.values;return ie(b)?(a.interpolate(je(b)?"cardinal":"linear"),Ng[b.id]?af(e,rg,V(b.id),Ng[b.id]):a(e)):(c=e[0]?rg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,jh?"M "+d+" "+c:"M "+c+" "+d)}}(),jj=function(){var a;return a=jh?Ff.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Fd):Ff.svg.area().x(Fd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ne(b.values);return ce([b],"area")||ce([b],"area-spline")?(a.interpolate(je(b)?"cardinal":"linear"),a(e)):(c=e[0]?rg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,jh?"M "+d+" "+c:"M "+c+" "+d)}}(),kj=function(){var a=Ff.svg.line().x(jh?function(a){return W(a.id)(a.value)}:Id).y(jh?Id:function(a){return W(a.id)(a.value)});return function(b){var c=Ne(b.values);return ie(b)?a(c):"M "+ug(c[0].x)+" "+W(b.id)(c[0].value)}}(),lj=function(){};hj=Ff.svg.brush().on("brush",lf),hj.update=function(){return pj&&pj.select("."+f.brush).call(this),this},hj.scale=function(a){return jh?this.y(a):this.x(a)},Nf&&(lj=Ff.behavior.zoom().on("zoomstart",function(){lj.altDomain=Ff.event.sourceEvent.altKey?rg.orgDomain():null}).on("zoom",Nf?mf:null),lj.scale=function(a){return jh?this.y(a):this.x(a)},lj.orgScaleExtent=function(){var a=Of?Of:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},lj.updateScaleExtent=function(){var a=ac(rg.orgDomain())/ac(tj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var mj,nj,oj,pj,qj,rj,sj,tj,uj,vj={};if(Gf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=mj.selectAll(pd(a)),d=c.filter(Bf),e=c.filter(Cf);Gf.revert(),Gf.defocus(),b(d.classed(f.focused,!0)),b(e),he(Gf.data.targets)&&Nb(a,!0),wf(a,!0)},Gf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=mj.selectAll(pd(a)),d=c.filter(Bf),e=c.filter(Cf);Gf.revert(),b(d.classed(f.focused,!1)),b(e),he(Gf.data.targets)&&Ob(a),wf(a,!1)},Gf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=mj.selectAll(pd(a)),d=c.filter(Bf),e=c.filter(Cf);b(d.classed(f.focused,!1)),b(e),he(Gf.data.targets)&&Ob(a),xf()},Gf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),mj.selectAll(qd(a)).transition().style("opacity",1),b.withLegend&&yf(a),kf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Gf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),mj.selectAll(qd(a)).transition().style("opacity",0),b.withLegend&&zf(a),kf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Gf.toggle=function(a){Gc(a)?Gf.hide(a):Gf.show(a)},Gf.unzoom=function(){hj.clear().update(),kf({withUpdateXDomain:!0})},Gf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Gg[b]=a.classes[b]}),"categories"in a&&Ji&&(nh=a.categories,xg.categories(nh)),"cacheIds"in a&&bc(a.cacheIds)?void rf(dc(a.cacheIds),a.done):void("unload"in a?tf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){sf(a) +}):sf(a))},Gf.unload=function(a,b){tf(Dc(a),function(){kf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Gf.selected=function(a){return Ff.merge(oj.selectAll("."+f.shapes+od(a)).selectAll("."+f.shape).filter(function(){return Ff.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Gf.select=function(a,b,c){Rg&&oj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=Ff.select(this),i=e.data?e.data.id:e.id,j=Me(this),k=Sg||!a||a.indexOf(i)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Tg(e)&&!m&&j(!0,h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(!1,h.classed(f.SELECTED,!1),e,g)})},Gf.unselect=function(a,b){Rg&&oj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=Ff.select(this),g=c.data?c.data.id:c.id,h=Me(this),i=Sg||!a||a.indexOf(g)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(f.SELECTED);i&&j&&Tg(c)&&k&&h(!1,e.classed(f.SELECTED,!1),c,d)})},Gf.toLine=function(a){Ef(a,"line")},Gf.toSpline=function(a){Ef(a,"spline")},Gf.toBar=function(a){Ef(a,"bar")},Gf.toScatter=function(a){Ef(a,"scatter")},Gf.toArea=function(a){Ef(a,"area")},Gf.toAreaSpline=function(a){Ef(a,"area-spline")},Gf.toPie=function(a){Ef(a,"pie",{withTransform:!0})},Gf.toDonut=function(a){Ef(a,"donut",{withTransform:!0})},Gf.groups=function(a){return c(a)?Hg:(Hg=a,kf(),Hg)},Gf.xgrids=function(a){return a?(Wh=a,kf(),Wh):Wh},Gf.xgrids.add=function(a){return a?Gf.xgrids(Wh.concat(a)):void 0},Gf.xgrids.remove=function(a){var b=Df(a);return Gf.xgrids(Wh.filter(b))},Gf.ygrids=function(a){return a?(Yh=a,kf(),Yh):Yh},Gf.ygrids.add=function(a){return a?Gf.ygrids(Yh.concat(a)):void 0},Gf.ygrids.remove=function(a){var b=Df(a);return Gf.ygrids(Yh.filter(b))},Gf.regions=function(a){return c(a)?ui:(ui=a,kf(),ui)},Gf.regions.add=function(a){return c(a)?ui:(ui=ui.concat(a),kf(),ui)},Gf.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;mj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ui=ui.filter(function(b){return b.classes.indexOf(a)<0})}),ui},Gf.data.get=function(a){var b=Gf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Gf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},Gf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Fg[b]=a[b]}),Af(Cc(Gf.data.targets),{withTransition:!0}),Fg):Fg},Gf.x=function(a){return arguments.length&&(qc(Gf.data.targets,a),kf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Gf.data.xs},Gf.xs=function(a){return arguments.length&&(rc(Gf.data.targets,a),kf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Gf.data.xs},Gf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},Gf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Dh=+a.y),b(a.y2)&&(Mh=+a.y2)):Dh=Mh=+a,kf())},Gf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Eh=+a.y),b(a.y2)&&(Nh=+a.y2)):Eh=Nh=+a,kf())},Gf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Gf.axis.max(a.max),"undefined"!=typeof a.min&&Gf.axis.min(a.min))},Gf.legend.show=function(a){yf(Dc(a)),kf({withLegend:!0})},Gf.legend.hide=function(a){zf(Dc(a)),kf({withLegend:!0})},Gf.resize=function(a){Jf=a?a.width:null,Kf=a?a.height:null,pf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Gf.destroy=function(){Gf.data.targets=void 0,Gf.data.xs={},sj.html(""),a.onresize=null},"url"in e.data)Ff.xhr(e.data.url,function(a,b){var c,d=Ff.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Ff.csv.parse(b.response),bf(c)});else if("rows"in e.data)bf(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");bf(uc(e.data.columns))}return Gf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 85a57161b94a5a1435ae9695ba1ee42cba3ae335 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Sat, 3 May 2014 22:40:44 +0900 Subject: [PATCH 123/178] Fix data.names API - #150 --- c3.js | 8 ++++---- c3.min.js | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/c3.js b/c3.js index 752a651..4566c30 100644 --- a/c3.js +++ b/c3.js @@ -4130,9 +4130,7 @@ .attr("class", CLASS.legendItemEvent) .style('fill-opacity', 0) .attr('x', isLegendRight ? xForLegendRect : -200) - .attr('y', isLegendRight ? -200 : yForLegendRect) - .attr('width', function (id) { return widths[id]; }) - .attr('height', function (id) { return heights[id]; }); + .attr('y', isLegendRight ? -200 : yForLegendRect); l.append('rect') .attr("class", CLASS.legendItemTile) .style("pointer-events", "none") @@ -4153,6 +4151,8 @@ legend.selectAll('rect.' + CLASS.legendItemEvent) .data(targetIds) .transition().duration(withTransition ? 250 : 0) + .attr('width', function (id) { return widths[id]; }) + .attr('height', function (id) { return heights[id]; }) .attr('x', xForLegendRect) .attr('y', yForLegendRect); @@ -4490,7 +4490,7 @@ Object.keys(names).forEach(function (id) { __data_names[id] = names[id]; }); - updateLegend(mapToIds(c3.data.targets), {withTransition: true}); + redraw({withLegend: true}); return __data_names; }; c3.data.colors = function (colors) { diff --git a/c3.min.js b/c3.min.js index 806dcc8..6c4dec5 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ !function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.34"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",lines:"c3-lines",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",arcs:"c3-arcs",area:"c3-area",areas:"c3-areas",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",legendItemFocused:"c3-legend-item-focused",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;cXf&&(Xf=0),0>Zf&&(Zf=0),Yf=ih?Uf.left-dj-ej:Xf,$f=ih?Zf:ag-Vf.top-Vf.bottom,0>Yf&&(Yf=0),0>$f&&($f=0),p(),$i&&he(Ff.data.targets)&&(Wf.left=Xf/2+cg)}function o(){nj.select("line."+f.xgridFocus).attr("x1",ih?0:-10).attr("x2",ih?Xf:-10).attr("y1",ih?-10:Uf.top).attr("y2",ih?-10:Zf)}function p(){cg=Zf/2,bg=.95*cg,dg=ge(Ff.data.targets)?.6*bg:0}function q(){var a=ih?f.axisX:f.axisY,b=nj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Ef.select(Hf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return If?If:x()}function s(){var a=Jf?Jf:y();return a>0?a:320}function t(){return he(Ff.data.targets)?0:Kf?Kf:ih?jh?v("x"):1:!Bh||Gh?1:v("y")}function u(){var a=1;return he(Ff.data.targets)?0:Lf?Lf:$i?P()+20+(Kh&&!ih?v("y2"):a):Kh?Ph||ih?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||jh?"x"===a&&yh?yh:"y"!==a||Bh?"y2"!==a||Kh?(jb(a).isInner?30:40)+("y2"===a?-10:0):fj:ch&&!$i?10:1:0}function x(){return+Ef.select(Hf).style("width").replace("px","")}function y(){return+Ef.select(Hf).style("height").replace("px","")}function z(a){return a?-5:-(Uf.left-1)}function A(a){return a?-20:-4}function B(){return z(!ih)}function C(){return A(!ih)}function D(){return z(ih)}function E(){return A(ih)}function F(a){return a?Xf+2+4:Uf.left+20}function G(a){return a?(yh?yh:0)+80:Zf+8}function H(){return F(!ih)}function I(){return G(!ih)}function J(){return F(ih)}function K(){return G(ih)}function L(){var a,b,c,d,e,f=Ac(Ff.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=qg(b.x)-qg(a.x),0===c?ih?Zf:Xf:(d=zc(),e=de(Ff.data.targets)?(d-(Ii?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function M(a){_i=a}function N(a){aj=a}function O(a){bj=a}function P(){return ch?$i?aj*(_i+1):_f:0}function Q(){return ch?$i?ag:bj*(_i+1):0}function R(){var a,b,c=!qg;ig=ih?1:0,jg=ih?Zf:Xf,kg=ih?0:Zf,lg=ih?Xf:1,mg=ig,ng=jg,og=ih?0:$f,pg=ih?Yf:1,qg=T(ig,jg,c?void 0:qg.domain(),function(){return wg.tickOffset()}),rg=U(kg,lg,c?void 0:rg.domain()),sg=U(kg,lg,c?void 0:sg.domain()),tg=T(ig,jg,sj,function(a){return a%1?0:zg.tickOffset()}),ug=U(og,pg,c?void 0:ug.domain()),vg=U(og,pg,c?void 0:vg.domain()),a=$(),b=th?th:c?void 0:wg.tickValues(),wg=X(qg,Vi,a,b),zg=X(tg,Yi,a,b),xg=Y(rg,Wi,Hh,Jh),yg=Y(sg,Xi,Qh,Sh),c||(gj.scale(tg),Mf&&kj.scale(qg)),S()}function S(){eg=Gb(),fg=Hb(),gg=Hb(.98)}function T(a,b,d,e){var f=(Hi?Ef.time.scale():Ef.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Ii){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=Ef.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?sg:rg}function W(a){return"y2"===Z(a)?vg:ug}function X(a,b,c,d){var e=(Ii?Eb():Ef.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Ii?(e.tickCentered(nh),Ae(ph)&&(ph=!1)):e.tickOffset=function(){var a=Bc(Ff.data.targets),b=qg(a[1])-qg(a[0]),c=b?b:ih?Zf:Xf;return c/zc()/2},Ii&&e.categories(mh),e}function Y(a,b,c,d){return Ef.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Hg?Hg[a]:"y"}function $(){var a=Hi?Si:Ii?Tc:function(a){return 0>a?a.toFixed(0):a};return oh&&("function"==typeof oh?a=oh:Hi&&(a=function(a){return a?Ri(oh)(a):""})),a}function _(a){var b;return"y"===a?b=Fh:"y2"===a?b=Oh:"x"===a&&(b=Ah),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Fh=b:"y2"===a?Oh=b:"x"===a&&(Ah=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",ih?"inner-top":"inner-right")}function hb(){return fb("y",ih?"inner-right":"inner-top")}function ib(){return fb("y2",ih?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Xf/2:Xf:b.isBottom?-Zf:b.isMiddle?-Zf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!ih,gb())}function rb(){return nb(ih,hb())}function sb(){return nb(ih,ib())}function tb(){return ob(!ih,gb())}function ub(){return ob(ih,hb())}function vb(){return ob(ih,ib())}function wb(){var a=gb();return ih?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":yh?yh-10:"3em"}function xb(){var a=hb();return ih?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return ih?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!ih,gb())}function Ab(){return pb(ih,hb())}function Bb(){return pb(ih,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return Ef.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){nj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),nj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),nj.select("."+f.axisY2+" ."+f.axisY2Label).transition().attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 Ef.min(Object.keys(i).map(function(a){return Ef.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(Gg.length>0)for(g=Sc(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 Ef.max(Object.keys(i).map(function(a){return Ef.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Mh:Dh,n="y2"===c?Lh:Ch,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Nh:Eh,r=xd()&&ih;return 0===l.length?"y2"===c?sg.domain():rg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=yd(o,p),j=ac(rg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),"y2"===c&&Rh&&(f=b(Rh.top)?Rh.top:e,g=b(Rh.bottom)?Rh.bottom:e),de(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return wh?Hi?we(wh):wh:Ef.min(a,function(a){return Ef.min(a.values,function(a){return a.x})})}function Zb(a){return vh?Hi?we(vh):vh:Ef.max(a,function(a){return Ef.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Ii?d=0:de(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof xh&&Be(xh)?(e=b(xh.left)?xh.left:d,f=b(xh.right)?xh.right:d):e=f="number"==typeof xh?xh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return c-d===0&&(c=Hi?new Date(.5*c.getTime()):-.5,d=Hi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Hi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Hi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?rg:sg;return b="y"===a.axis||"y2"===a.axis?ih?Zf:"start"in a?d(a.start):Zf:ih?"end"in a?qg(Hi?we(a.end):a.end):Zf:Zf,c>b?0:b-c}function ic(a){return Ag&&a===Ag||Be(Bg)&&Ce(Bg,a)}function jc(a){return!ic(a)}function kc(a){return Ag?Ag:Be(Bg)?Bg[a]:null}function lc(a,b){var c,d=b&&Be(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=Ff.data.xs[b])}),c}function mc(a,b){return a in Ff.data.xs&&Ff.data.xs[a]&&Ff.data.xs[a][b]?Ff.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){Bg[b]=a[b]})}function oc(a){return 1===Ef.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=Eg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),Ff.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=Hi?a?a instanceof Date?a:we(a):we(mc(c,d)):Ji&&!Ii?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Ff.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Ag?(d=Object.keys(Ff.data.xs),Ff.data.xs[c]=d.length>0?Ff.data.xs[d[0]]:void 0):Be(Bg)&&(Ff.data.xs[c]=lc(f,Ff.data.targets)):Ff.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Ff.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Dg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ji&&Ii&&0===c&&g&&(0===e&&(mh=[]),mh.push(g)),("undefined"==typeof a[b]||Ff.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ig&&be(Cc(c).filter(function(a){return!(a in Jg)}),Ig),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&Ff.data.targets[0].values[a-1]?Ff.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(Ff.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Hi?new Date(i):i);j.push(e)}return Hi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Ti=Ti.concat(a)}function Mc(a){Ti=Ti.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Ui=Ui.concat(a)}function Oc(a){Ui=Ui.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Jd(a,f))),(a[g].x||0===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=De(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Nd(a,b){return Ef.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Od(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 Pd(){return Lg&&"desc"===Lg.toLowerCase()}function Qd(){return Lg&&"asc"===Lg.toLowerCase()}function Rd(a){var b=Qd(),c=Pd();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 Lg&&a.sort(Lg),a}function Sd(a,c){var d,e,f,g,h,i,j,k=he(Ff.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&ui&&(qj.html(xi(a,$(),zd(k),Qi)).style("display","block"),d=qj.property("offsetWidth"),e=qj.property("offsetHeight"),k?(g=Xf/2+c[0],i=Zf/2+c[1]+20):(ih?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=qg(l[0].x)+20):(f=q(),g=f+t()+qg(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),qj.style("top",i+"px").style("left",g+"px"))}function Td(){qj.style("display","none")}function Ud(a){var c=a.filter(function(a){return a&&b(a.value)});ui&&(ee(Ff.data.targets)||he(Ff.data.targets)||nj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(ih?"y1":"x1",Fd).attr(ih?"y2":"x2",Fd))}function Vd(){nj.select("line."+f.xgridFocus).style("visibility","hidden")}function Wd(a){return a.x||0===a.x?qg(a.x):null}function Xd(a){return V(a.id)(a.value)}function Yd(){var a,b,d={},e=0;return Ic(Fc(ke)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ae(a,b){return"number"==typeof ei?ei:b?2*a.tickOffset()*fi/b:0}function be(a,b){Dc(a).forEach(function(a){uj[a]=b===Jg[a],Jg[a]=b})}function ce(a,b){var c=!1;return a.forEach(function(a){Jg[a.id]===b&&(c=!0),a.id in Jg||"line"!==b||(c=!0)}),c}function de(a){return ce(a,"bar")}function ee(a){return ce(a,"scatter")}function fe(a){return ce(a,"pie")}function ge(a){return ce(a,"donut")}function he(a){return fe(a)||ge(a)}function ie(a){var b="string"==typeof a?a:a.id;return!(b in Jg)||"line"===Jg[b]||"spline"===Jg[b]||"area"===Jg[b]||"area-spline"===Jg[b]}function je(a){var b="string"==typeof a?a:a.id;return"spline"===Jg[b]||"area-spline"===Jg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"bar"===Jg[b]}function le(a){var b="string"==typeof a?a:a.id;return"scatter"===Jg[b]}function me(a){var b="string"==typeof a?a:a.id;return"pie"===Jg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"donut"===Jg[b]}function oe(a){return me(a)||ne(a)}function pe(a){return ie(a)?[a]:[]}function qe(a){return oe(a.data)?[a]:[]}function re(a){return ke(a)?a.values:[]}function se(a){return ie(a)||le(a)?a.values:[]}function te(a){return ke(a)||ie(a)?a.values:[]}function ue(a){return ne(a)&&oi||me(a)&&ii}function ve(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function we(b){var c;try{c=Cg?Ef.time.format(Cg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Cg)}return c}function xe(a,b){var c=Ef.mouse(a),d=Ef.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ce(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function De(a,b){var c="y"===Z(a.id)?rg:sg,d=ih?1:0,e=ih?0:1;return Math.pow(qg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ee(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Fe(a,b,c){Xg(b,a.node()),nj.select("."+f.selectedCircles+od(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",ih?Xd:Wd).attr("cy",ih?Wd:Xd).attr("stroke",function(){return Qi(b)}).attr("r",1.4*Qe(b)).transition().duration(100).attr("r",Qe)}function Ge(a,b,c){Yg(b,a.node()),nj.select("."+f.selectedCircles+od(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function He(a,b,c,d){a?Fe(b,c,d):Ge(b,c,d)}function Ie(a,b){Xg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ef.rgb(Qi(b)).brighter(.75)})}function Je(a,b){Yg(b,a.node()),a.transition().duration(100).style("fill",function(){return Qi(b)})}function Ke(a,b,c,d){a?Ie(b,c,d):Je(b,c,d)}function Le(a,b,c,d){Ke(a,b,c.data,d)}function Me(a){return"circle"===a.nodeName?He:Ef.select(a).classed(f.bar)?Ke:Le}function Ne(a){return a.filter(function(a){return b(a.value)})}function Oe(a){return Zh?"function"==typeof $h?$h(a):$h:0}function Pe(a){return ai?bi?bi:1.75*Oe(a):Oe(a)}function Qe(a){return ci?ci:4*Oe(a)}function Re(a,c){return(c?nj.selectAll("."+f.circles+od(c)):nj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Se(a,b){Re(a,b).classed(f.EXPANDED,!0).attr("r",Pe)}function Te(a){Re(a).filter(function(){return Ef.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oe)}function Ue(a){return nj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ve(a){Ue(a).classed(f.EXPANDED,!0)}function We(a){Ue(a).classed(f.EXPANDED,!1)}function Xe(a,b){var c=_e(a,b);return function(a,b){var d=c(a,b),e=ih?1:0,f=ih?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 Ye(a,b){var c=_e(a,!1),d=b?Ze:$e;return function(a,b){return d(c(a,b),a,this)}}function Ze(a,b){var c;return ih?(c=ke(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function $e(a,b,c){var d=c.getBoundingClientRect();return ih?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ke(b)?-3:-6)}function _e(a,b){var c=a.__max__+1,d=ae(wg,c),e=Zd(d,c,a,!!b),f=$d(!!b),g=_d(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return ih&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function af(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 bf(b){var c,d,e;if(rj=Ef.select(Hf),rj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(rj.html("").classed("c3",!0),Ff.data.xs={},Ff.data.targets=vc(b),Pg&&Lc(Pg===!0?Cc(Ff.data.targets):Pg),n(),R(),qg.domain(Ef.extent(_b(Ff.data.targets))),rg.domain(Xb(Ff.data.targets,"y")),sg.domain(Xb(Ff.data.targets,"y2")),tg.domain(qg.domain()),ug.domain(rg.domain()),vg.domain(sg.domain()),sj=qg.domain(),gj.scale(tg),Mf&&kj.scale(qg),lj=rj.append("svg").on("mouseenter",Pf).on("mouseleave",Qf),mj=lj.append("defs"),mj.append("clipPath").attr("id",Bi).append("rect"),mj.append("clipPath").attr("id",Ci).append("rect"),mj.append("clipPath").attr("id",Di).append("rect"),nf(),nj=lj.append("g").attr("transform",Zi.main),oj=lj.append("g").attr("transform",Zi.context),pj=lj.append("g").attr("transform",Zi.legend),_g||oj.style("visibility","hidden"),ch||(pj.style("visibility","hidden"),Ui=Cc(Ff.data.targets)),qj=Ef.select(Hf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),zf(Cc(Ff.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=nj.append("g").attr("clip-path",Ei).attr("class",f.grid),Th&&d.append("g").attr("class",f.xgrids),Be(Vh)&&d.append("g").attr("class",f.xgridLines),_h&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Wh&&d.append("g").attr("class",f.ygrids),Be(Xh)&&d.append("g").attr("class",f.ygridLines),jh&&nj.append("g").attr("class",f.axisX).attr("clip-path",Fi).attr("transform",Zi.x).append("text").attr("class",f.axisXLabel).attr("transform",ih?"rotate(-90)":"").style("text-anchor",zb),Bh&&nj.append("g").attr("class",f.axisY).attr("clip-path",Gi).attr("transform",Zi.y).append("text").attr("class",f.axisYLabel).attr("transform",ih?"":"rotate(-90)").style("text-anchor",Ab),Kh&&nj.append("g").attr("class",f.axisY2).attr("transform",Zi.y2).append("text").attr("class",f.axisY2Label).attr("transform",ih?"":"rotate(-90)").style("text-anchor",Bb),nj.append("g").attr("clip-path",Ei).attr("class",f.regions),nj.append("g").attr("clip-path",Ei).attr("class",f.chart),c=nj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Mf?ih?"ns-resize":"ew-resize":null),nj.select("."+f.chart).append("g").attr("class",f.chartBars),nj.select("."+f.chart).append("g").attr("class",f.chartLines),nj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Zi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),nj.select("."+f.chart).append("g").attr("class",f.chartTexts),Mf&&nj.insert("rect",Of?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Xf).attr("height",Zf).style("opacity",0).style("cursor",ih?"ns-resize":"ew-resize").call(kj).on("dblclick.zoom",null),zh&&gj.extent("function"!=typeof zh?zh:zh(_b())),oj.append("g").attr("clip-path",Ei).attr("class",f.chart),oj.select("."+f.chart).append("g").attr("class",f.chartBars),oj.select("."+f.chart).append("g").attr("class",f.chartLines),oj.append("g").attr("clip-path",Ei).attr("class",f.brush).call(gj).selectAll("rect").attr(ih?"width":"height",ih?Yf:$f),oj.append("g").attr("class",f.axisX).attr("transform",Zi.subx).attr("clip-path",ih?"":Fi),pf(Ff.data.targets),ih?nj.select("."+f.axisX).style("opacity",0).call(wg):(nj.select("."+f.axisY).style("opacity",0).call(xg),nj.select("."+f.axisY2).style("opacity",0).call(yg)),n(),R(),nf(),m(!1),jf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),yi){if(Hi&&"string"==typeof zi){for(zi=we(zi),e=0;e0){d=[];for(var g in Eg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Od(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ke,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 gf(a){he(Ff.data.targets)||Qg&&(Ki=a,nj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Li=!0,Zg())}function hf(){he(Ff.data.targets)||Qg&&(nj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),nj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Li=!1,$g())}function jf(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z=Yd(),$=he(Ff.data.targets),_=Ic(Ff.data.targets);if(a=d(a)?a:{},E=d(a.withY)?a.withY:!0,F=d(a.withSubchart)?a.withSubchart:!0,G=d(a.withTransition)?a.withTransition:!0,J=d(a.withTransform)?a.withTransform:!1,K=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,M=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,N=d(a.withLegend)?a.withLegend:!1,H=d(a.withTransitionForExit)?a.withTransitionForExit:G,I=d(a.withTransitionForAxis)?a.withTransitionForAxis:G,T=G?Tf:0,U=H?T:0,V=I?T:0,c=nj.select("."+f.axisX).style("opacity",$?0:1),g=nj.select("."+f.axisY).style("opacity",$?0:1),h=nj.select("."+f.axisY2).style("opacity",$?0:1),e=oj.select("."+f.axisX).style("opacity",$?0:1),S={axisX:c.transition().duration(V),axisY:g.transition().duration(V),axisY2:h.transition().duration(V),axisSubX:e.transition().duration(V)},N&&ch&&zf(Cc(Ff.data.targets),a,S),Ii&&(0!==_.length&&M&&K||qg.domain([0,c.selectAll(".tick").size()])),_.length&&(M&&(qg.domain(Ef.extent(_b(_))),sj=qg.domain(),Mf&&kj.scale(qg).updateScaleExtent(),tg.domain(qg.domain()),gj.scale(tg)),K&&(qg.domain(gj.empty()?sj:gj.extent()),Mf&&kj.scale(qg).updateScaleExtent()),th||!sh&&!rh||(W=Kc(Jc(_),rh),wg.tickValues(W),zg.tickValues(W))),rg.domain(Xb(_,"y")),sg.domain(Xb(_,"y2")),S.axisX.call(wg),S.axisY.call(xg),S.axisY2.call(yg),S.axisSubX.call(zg),K&&_.length)if(ph&&W){for(X=1;X=0&&Ef.select(this).style("display",b%Y?"none":"block")})}else lj.selectAll("."+f.axisX+" .tick text").style("display","block");if(!ih&&uh&&eb(c,S.axisX,uh),O=Xe(Z),Q=Ye(Z,!0),R=Ye(Z,!1),Db(),ug.domain(rg.domain()),vg.domain(sg.domain()),qj.style("display","none"),o(),nj.select("line."+f.xgridFocus).style("visibility","hidden"),Th){if("year"===Uh){j=[];for(var ab=_b(),bb=ab[0].getFullYear(),cb=ab[1].getFullYear(),db=bb;cb>=db;db++)j.push(new Date(db+"-01-01 00:00:00"))}else j=qg.ticks(10);i=nj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",ih?0:function(a){return qg(a)-wg.tickOffset()}).attr("x2",ih?Xf:function(a){return qg(a)-wg.tickOffset()}).attr("y1",ih?function(a){return qg(a)-wg.tickOffset()}:Uf.top).attr("y2",ih?function(a){return qg(a)-wg.tickOffset()}:Zf).style("opacity",function(){return+Ef.select(this).attr(ih?"y1":"x1")===(ih?Zf:0)?0:1}),i.exit().remove()}Be(Vh)&&(k=nj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Vh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",ih?"":"rotate(-90)").attr("dx",ih?0:-Uf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",ih?0:Gd).attr("x2",ih?Xf:Gd).attr("y1",ih?Gd:Uf.top).attr("y2",ih?Gd:Zf).style("opacity",1),k.select("text").transition().duration(T).attr("x",ih?Xf:0).attr("y",Gd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),E&&Wh&&(m=nj.select("."+f.ygrids).selectAll("."+f.ygrid).data(rg.ticks(Yh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",ih?rg:0).attr("x2",ih?rg:Xf).attr("y1",ih?0:rg).attr("y2",ih?Zf:rg),m.exit().remove()),E&&Be(Xh)&&(n=nj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Xh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",ih?"rotate(-90)":"").attr("dx",ih?0:-Uf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(T).attr("x1",ih?Hd:0).attr("x2",ih?Hd:Xf).attr("y1",ih?0:Hd).attr("y2",ih?Zf:Hd).style("opacity",1),n.select("text").transition().duration(T).attr("x",ih?0:Xf).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(T).style("opacity",0).remove()),v=nj.select("."+f.regions).selectAll("rect."+f.region).data(ti),v.enter().append("rect").style("fill-opacity",0),v.attr("class",hd).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(T).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),v.exit().transition().duration(T).style("fill-opacity",0).remove(),t=nj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),t.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Qi),t.style("opacity",td).transition().duration(T).attr("d",O).style("fill",Qi).style("opacity",1),t.exit().transition().duration(U).style("opacity",0).remove(),q=nj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),q.enter().append("path").attr("class",Zc).style("stroke",Qi),q.style("opacity",td).transition().duration(T).attr("d",hj).style("stroke",Qi).style("opacity",1),q.exit().transition().duration(U).style("opacity",0).remove(),r=nj.selectAll("."+f.areas).selectAll("."+f.area).data(pe),r.enter().append("path").attr("class",fd).style("fill",Qi).style("opacity",function(){return tj=+Ef.select(this).style("opacity"),0}),r.style("opacity",0).transition().duration(T).attr("d",ij).style("fill",Qi).style("opacity",tj),r.exit().transition().duration(U).style("opacity",0).remove(),s=nj.selectAll("."+f.circles).selectAll("."+f.circle).data(se),s.enter().append("circle").attr("class",_c).attr("r",Oe).style("fill",Qi),s.style("opacity",td).transition().duration(T).style("opacity",vd).style("fill",Qi).attr("cx",ih?Xd:Wd).attr("cy",ih?Wd:Xd),s.exit().remove(),w=nj.selectAll("."+f.texts).selectAll("."+f.text).data(te),w.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return ih?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",Qi).style("fill-opacity",0),w.text(function(a){return Ed(a.id)(a.value,a.id)}).style("fill-opacity",ud).transition().duration(T).attr("x",Q).attr("y",R).style("fill",Qi).style("fill-opacity",wd),w.exit().transition().duration(U).style("fill-opacity",0).remove(),u=nj.selectAll("."+f.arcs).selectAll("."+f.arc).data(qe),u.enter().append("path").attr("class",dd).style("fill",function(a){return Qi(a.data)}).style("cursor",function(a){return Sg(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Oi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),vf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Sd(d,Ef.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Oi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),wf(),Td(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();ef(this,a,b),e(d,b)}),u.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Oi=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Fb(a);return c?(b=Ef.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("fill",function(a){return Qi(a.data)}).style("opacity",1).call(Ee,function(){Oi=!1}),u.exit().transition().duration(U).style("opacity",0).remove(),nj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(T).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&oe(a.data)?1:0}),nj.select("."+f.chartArcsTitle).style("opacity",ge(Ff.data.targets)?1:0),_g&&(null!==Ef.event&&"zoom"===Ef.event.type&&gj.extent(qg.orgDomain()).update(),F&&(!ih&&uh&&eb(e,S.axisSubX,uh),gj.empty()||gj.extent(qg.orgDomain()).update(),P=Xe(Z,!0),y=oj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),y.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Qi),y.style("opacity",td).transition().duration(T).attr("d",P).style("opacity",1),y.exit().transition().duration(T).style("opacity",0).remove(),x=oj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),x.enter().append("path").attr("class",Zc).style("stroke",Qi),x.style("opacity",td).transition().duration(T).attr("d",jj).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove())),nj.selectAll("."+f.selectedCircles).filter(function(a){return ke(a)}).selectAll("circle").remove(),nj.selectAll("."+f.selectedCircle).transition().duration(T).attr("cx",ih?Xd:Wd).attr("cy",ih?Wd:Xd),z=nj.select("."+f.eventRects),Be(Bg)&&!oc(Bg)?(z.classed(f.eventRectsMultiple)||z.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),A=nj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),df(A.enter()),A.attr("x",0).attr("y",0).attr("width",Xf).attr("height",Zf)):(z.classed(f.eventRectsSingle)||z.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ji&&!Ii?(D=function(a,b){var c=xc(b),d=yc(b),e=Ff.data.xs[a.id][b];return(qg(d?d:e+50)-qg(c?c:e-50))/2},C=function(a,b){var c=xc(b),d=Ff.data.xs[a.id][b];return(qg(d)+qg(c?c:d-50))/2}):(D=L(),C=function(a){return qg(a.x)-D/2}),B=Ac(Ff.data.targets),nj.select("."+f.eventRects).datum(B?B.values:[]),A=nj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),cf(A.enter()),A.attr("class",id).attr("x",ih?0:C).attr("y",ih?C:0).attr("width",ih?Xf:D).attr("height",ih?D:Zf),A.exit().remove()),Cc(Ff.data.targets).forEach(function(a){uj[a]=!0})}function kf(){jf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function lf(){return"mousemove"===Ef.event.sourceEvent.type&&kj.altDomain?(qg.domain(kj.altDomain),void kj.scale(qg).updateScaleExtent()):(Ii&&qg.orgDomain()[0]===sj[0]&&qg.domain([sj[0]-1e-10,qg.orgDomain()[1]]),jf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Ef.event.sourceEvent.type&&(Mi=!0)))}function mf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function nf(){lj.attr("width",_f).attr("height",ag),lj.select("#"+Bi).select("rect").attr("width",Xf).attr("height",Zf),lj.select("#"+Ci).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),lj.select("#"+Di).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),lj.select("."+f.zoomRect).attr("width",Xf).attr("height",Zf),rj.style("max-height",ag+"px")}function of(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),nf(),m(a.withTransition),jf(a)}function pf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=nj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",kd),j=i.enter().append("g").attr("class",kd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc),e=nj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",md),d=e.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",cd).style("cursor",function(a){return Sg(a)?"pointer":null}),c=nj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",ld),b=c.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",$c),b.append("g").attr("class",gd),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",ad).style("cursor",function(a){return Sg(a)?"pointer":null}),a.forEach(function(a){nj.selectAll("."+f.selectedCircles+od(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=nj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(hg(a)).attr("class",nd),g=h.enter().append("g").attr("class",nd),g.append("g").attr("class",ed),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),_g&&(n=oj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",md),m=n.enter().append("g").style("opacity",0).attr("class",md),m.append("g").attr("class",cd),l=oj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",ld),k=l.enter().append("g").style("opacity",0).attr("class",ld),k.append("g").attr("class",$c)),lj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Tf).style("opacity",1)}function qf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?be(a.id,b.types[a.id]):be(a.id,b.type)}),Ff.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=$i?j:i,l=$i?Q():P();return d&&(w=0,C=0,t=0,u=0),ch&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=$i?u:t,void(hh?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=pj.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,$i?(g=function(a){return t*B[a]},j=function(a){return A[B[a]]+x[a]}):(g=function(a){return A[B[a]]+x[a]},j=function(a){return u*B[a]}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=pj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof eh?eh(a):Ff.toggle(a)}).on("mouseover",function(a){Ef.select(this).classed(f.legendItemFocused,!0),Oi||Ff.focus(a),"function"==typeof fh&&fh(a)}).on("mouseout",function(a){Ef.select(this).classed(f.legendItemFocused,!1),Oi||Ff.revert(),"function"==typeof gh&&gh(a)}),o.append("text").text(function(a){return d(Eg[a])?Eg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",$i?h:-200).attr("y",$i?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",$i?i:-200).attr("y",$i?-200:l).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",Qi).attr("x",$i?h:-200).attr("y",$i?-200:j).attr("width",10).attr("height",10),pj.selectAll("text").data(a).text(function(a){return d(Eg[a])?Eg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),pj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),pj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).style("fill",Qi).attr("x",g).attr("y",j),pj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=Ef.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?tf(b):uf(b):cj}),N(t),O(u),M(C),n(),R(),nf(),m(q,c)}function Af(a){return Ec(Ff.data.targets,a.id)}function Bf(a){return"data"in a&&Ec(Ff.data.targets,a.data.id)}function Cf(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 Df(a,b,c){var d=!he(Ff.data.targets);Oi=!1,be(a,b),of(c||{withTransitionForAxis:d})}var Ef=a.d3?a.d3:a.require?a.require("d3"):void 0,Ff={data:{},axis:{},legend:{}},Gf={},Hf=h(["bindto"],"#chart"),If=h(["size","width"]),Jf=h(["size","height"]),Kf=h(["padding","left"],50),Lf=h(["padding","right"]),Mf=h(["zoom","enabled"],!1),Nf=h(["zoom","extent"]),Of=h(["zoom","privileged"],!1),Pf=h(["onenter"],function(){}),Qf=h(["onleave"],function(){}),Rf=h(["onresize"],function(){}),Sf=h(["onresized"],function(){}),Tf=h(["transition","duration"],350);g("data","data is required in config");var Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag=h(["data","x"]),Bg=h(["data","xs"],{}),Cg=h(["data","x_format"]),Dg=h(["data","id_converter"],function(a){return a}),Eg=h(["data","names"],{}),Fg=h(["data","classes"],{}),Gg=h(["data","groups"],[]),Hg=h(["data","axes"],{}),Ig=h(["data","type"]),Jg=h(["data","types"],{}),Kg=h(["data","labels"],{}),Lg=h(["data","order"]),Mg=h(["data","regions"],{}),Ng=h(["data","color"]),Og=h(["data","colors"],{}),Pg=h(["data","hide"],!1),Qg=h(["data","selection","enabled"],!1),Rg=h(["data","selection","grouped"],!1),Sg=h(["data","selection","isselectable"],function(){return!0}),Tg=h(["data","selection","multiple"],!0),Ug=h(["data","onclick"],function(){}),Vg=h(["data","onenter"],function(){}),Wg=h(["data","onleave"],function(){}),Xg=h(["data","onselected"],function(){}),Yg=h(["data","onunselected"],function(){}),Zg=h(["data","ondragstart"],function(){}),$g=h(["data","ondragend"],function(){}),_g=h(["subchart","show"],!1),ah=h(["subchart","size","height"],60),bh=h(["color","pattern"],[]),ch=h(["legend","show"],!0),dh=h(["legend","position"],"bottom"),eh=h(["legend","item","onclick"]),fh=h(["legend","item","onmouseover"]),gh=h(["legend","item","onmouseout"]),hh=h(["legend","equally"],!1),ih=h(["axis","rotated"],!1),jh=h(["axis","x","show"],!0),kh=h(["axis","x","type"],"indexed"),lh=h(["axis","x","localtime"],!0),mh=h(["axis","x","categories"],[]),nh=h(["axis","x","tick","centered"],!1),oh=h(["axis","x","tick","format"]),ph=h(["axis","x","tick","culling"],{}),qh=h(["axis","x","tick","culling","max"],10),rh=h(["axis","x","tick","count"]),sh=h(["axis","x","tick","fit"],!0),th=h(["axis","x","tick","values"],null),uh=h(["axis","x","tick","rotate"]),vh=h(["axis","x","max"],null),wh=h(["axis","x","min"],null),xh=h(["axis","x","padding"],{}),yh=h(["axis","x","height"]),zh=h(["axis","x","default"]),Ah=h(["axis","x","label"],{}),Bh=h(["axis","y","show"],!0),Ch=h(["axis","y","max"]),Dh=h(["axis","y","min"]),Eh=h(["axis","y","center"]),Fh=h(["axis","y","label"],{}),Gh=h(["axis","y","inner"],!1),Hh=h(["axis","y","tick","format"]),Ih=h(["axis","y","padding"]),Jh=h(["axis","y","ticks"],10),Kh=h(["axis","y2","show"],!1),Lh=h(["axis","y2","max"]),Mh=h(["axis","y2","min"]),Nh=h(["axis","y2","center"]),Oh=h(["axis","y2","label"],{}),Ph=h(["axis","y2","inner"],!1),Qh=h(["axis","y2","tick","format"]),Rh=h(["axis","y2","padding"]),Sh=h(["axis","y2","ticks"],10),Th=h(["grid","x","show"],!1),Uh=h(["grid","x","type"],"tick"),Vh=h(["grid","x","lines"],[]),Wh=h(["grid","y","show"],!1),Xh=h(["grid","y","lines"],[]),Yh=h(["grid","y","ticks"],10),Zh=h(["point","show"],!0),$h=h(["point","r"],2.5),_h=h(["point","focus","line","enabled"],!0),ai=h(["point","focus","expand","enabled"],!0),bi=h(["point","focus","expand","r"]),ci=h(["point","focus","select","r"]),di=h(["line","connect_null"],!1),ei=h(["bar","width"]),fi=h(["bar","width","ratio"],.6),gi=h(["pie","label","show"],!0),hi=h(["pie","label","format"]),ii=h(["pie","expand"],!0),ji=h(["pie","onclick"],function(){}),ki=h(["pie","onmouseover"],function(){}),li=h(["pie","onmouseout"],function(){}),mi=h(["donut","label","show"],!0),ni=h(["donut","label","format"]),oi=h(["donut","expand"],!0),pi=h(["donut","title"],""),qi=h(["donut","onclick"],function(){}),ri=h(["donut","onmouseover"],function(){}),si=h(["donut","onmouseout"],function(){}),ti=h(["regions"],[]),ui=h(["tooltip","show"],!0),vi=h(["tooltip","format","title"]),wi=h(["tooltip","format","value"]),xi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=vi?vi:b,l=wi?wi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id,a[g].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),yi=h(["tooltip","init","show"],!1),zi=h(["tooltip","init","x"],0),Ai=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Bi=("string"==typeof Hf?Hf.replace("#",""):Hf.id)+"-clip",Ci=Bi+"-xaxis",Di=Bi+"-yaxis",Ei=i(Bi),Fi=i(Ci),Gi=i(Di),Hi="timeseries"===kh,Ii="categorized"===kh,Ji=!Hi&&(Ag||Be(Bg)),Ki=null,Li=!1,Mi=!1,Ni=!1,Oi=!1,Pi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Qi=ve(Og,Be(bh)?bh:Pi,Ng),Ri=lh?Ef.time.format:Ef.time.format.utc,Si=function(){var a=[[Ri("%Y/%-m/%-d"),function(){return!0}],[Ri("%-m/%-d"),function(a){return a.getMonth()}],[Ri("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ri("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ri("%I %p"),function(a){return a.getHours()}],[Ri("%I:%M"),function(a){return a.getMinutes()}],[Ri(":%S"),function(a){return a.getSeconds()}],[Ri(".%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)}}(),Ti=[],Ui=[],Vi=ih?"left":"bottom",Wi=ih?Gh?"top":"bottom":Gh?"right":"left",Xi=ih?Ph?"bottom":"top":Ph?"left":"right",Yi=ih?"left":"bottom",Zi={main:function(){return"translate("+Uf.left+","+Uf.top+")"},context:function(){return"translate("+Vf.left+","+Vf.top+")"},legend:function(){return"translate("+Wf.left+","+Wf.top+")"},x:function(){return"translate(0,"+(ih?0:Zf)+")"},y:function(){return"translate(0,"+(ih?Zf:0)+")"},y2:function(){return"translate("+(ih?0:Xf)+","+(ih?1:0)+")"},subx:function(){return"translate(0,"+(ih?0:$f)+")"},arc:function(){return"translate("+Xf/2+","+Zf/2+")"}},$i="right"===dh,_i=0,aj=0,bj=0,cj=.15,dj=30,ej=ih&&!jh?0:30,fj=5;hg=Ef.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var gj,hj=function(){var a=Ef.svg.line().x(ih?function(a){return V(a.id)(a.value)}:Fd).y(ih?Fd:function(a){return V(a.id)(a.value)});return di||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=di?Ne(b.values):b.values;return ie(b)?(a.interpolate(je(b)?"cardinal":"linear"),Mg[b.id]?af(e,qg,V(b.id),Mg[b.id]):a(e)):(c=e[0]?qg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ih?"M "+d+" "+c:"M "+c+" "+d)}}(),ij=function(){var a;return a=ih?Ef.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Fd):Ef.svg.area().x(Fd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ne(b.values);return ce([b],"area")||ce([b],"area-spline")?(a.interpolate(je(b)?"cardinal":"linear"),a(e)):(c=e[0]?qg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ih?"M "+d+" "+c:"M "+c+" "+d)}}(),jj=function(){var a=Ef.svg.line().x(ih?function(a){return W(a.id)(a.value)}:Id).y(ih?Id:function(a){return W(a.id)(a.value)});return function(b){var c=Ne(b.values);return ie(b)?a(c):"M "+tg(c[0].x)+" "+W(b.id)(c[0].value)}}(),kj=function(){};gj=Ef.svg.brush().on("brush",kf),gj.update=function(){return oj&&oj.select("."+f.brush).call(this),this},gj.scale=function(a){return ih?this.y(a):this.x(a)},Mf&&(kj=Ef.behavior.zoom().on("zoomstart",function(){kj.altDomain=Ef.event.sourceEvent.altKey?qg.orgDomain():null}).on("zoom",Mf?lf:null),kj.scale=function(a){return ih?this.y(a):this.x(a)},kj.orgScaleExtent=function(){var a=Nf?Nf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},kj.updateScaleExtent=function(){var a=ac(qg.orgDomain())/ac(sj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var lj,mj,nj,oj,pj,qj,rj,sj,tj,uj={};if(Ff.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=lj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);Ff.revert(),Ff.defocus(),b(d.classed(f.focused,!0)),b(e),he(Ff.data.targets)&&Nb(a,!0),vf(a,!0)},Ff.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=lj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);Ff.revert(),b(d.classed(f.focused,!1)),b(e),he(Ff.data.targets)&&Ob(a),vf(a,!1)},Ff.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=lj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);b(d.classed(f.focused,!1)),b(e),he(Ff.data.targets)&&Ob(a),wf()},Ff.show=function(a,b){a=Dc(a),b=b||{},Mc(a),lj.selectAll(qd(a)).transition().style("opacity",1),b.withLegend&&xf(a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ff.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),lj.selectAll(qd(a)).transition().style("opacity",0),b.withLegend&&yf(a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ff.toggle=function(a){Gc(a)?Ff.hide(a):Ff.show(a)},Ff.unzoom=function(){gj.clear().update(),jf({withUpdateXDomain:!0})},Ff.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Fg[b]=a.classes[b]}),"categories"in a&&Ii&&(mh=a.categories,wg.categories(mh)),"cacheIds"in a&&bc(a.cacheIds)?void qf(dc(a.cacheIds),a.done):void("unload"in a?sf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){rf(a)}):rf(a))},Ff.unload=function(a,b){sf(Dc(a),function(){jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Ff.selected=function(a){return Ef.merge(nj.selectAll("."+f.shapes+od(a)).selectAll("."+f.shape).filter(function(){return Ef.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Ff.select=function(a,b,c){Qg&&nj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=Ef.select(this),i=e.data?e.data.id:e.id,j=Me(this),k=Rg||!a||a.indexOf(i)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Sg(e)&&!m&&j(!0,h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(!1,h.classed(f.SELECTED,!1),e,g)})},Ff.unselect=function(a,b){Qg&&nj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=Ef.select(this),g=c.data?c.data.id:c.id,h=Me(this),i=Rg||!a||a.indexOf(g)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(f.SELECTED); -i&&j&&Sg(c)&&k&&h(!1,e.classed(f.SELECTED,!1),c,d)})},Ff.toLine=function(a){Df(a,"line")},Ff.toSpline=function(a){Df(a,"spline")},Ff.toBar=function(a){Df(a,"bar")},Ff.toScatter=function(a){Df(a,"scatter")},Ff.toArea=function(a){Df(a,"area")},Ff.toAreaSpline=function(a){Df(a,"area-spline")},Ff.toPie=function(a){Df(a,"pie",{withTransform:!0})},Ff.toDonut=function(a){Df(a,"donut",{withTransform:!0})},Ff.groups=function(a){return c(a)?Gg:(Gg=a,jf(),Gg)},Ff.xgrids=function(a){return a?(Vh=a,jf(),Vh):Vh},Ff.xgrids.add=function(a){return a?Ff.xgrids(Vh.concat(a)):void 0},Ff.xgrids.remove=function(a){var b=Cf(a);return Ff.xgrids(Vh.filter(b))},Ff.ygrids=function(a){return a?(Xh=a,jf(),Xh):Xh},Ff.ygrids.add=function(a){return a?Ff.ygrids(Xh.concat(a)):void 0},Ff.ygrids.remove=function(a){var b=Cf(a);return Ff.ygrids(Xh.filter(b))},Ff.regions=function(a){return c(a)?ti:(ti=a,jf(),ti)},Ff.regions.add=function(a){return c(a)?ti:(ti=ti.concat(a),jf(),ti)},Ff.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;lj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ti=ti.filter(function(b){return b.classes.indexOf(a)<0})}),ti},Ff.data.get=function(a){var b=Ff.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Ff.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},Ff.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Eg[b]=a[b]}),zf(Cc(Ff.data.targets),{withTransition:!0}),Eg):Eg},Ff.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Og[b]=a[b]}),jf({withLegend:!0}),Og):Og},Ff.x=function(a){return arguments.length&&(qc(Ff.data.targets,a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ff.data.xs},Ff.xs=function(a){return arguments.length&&(rc(Ff.data.targets,a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ff.data.xs},Ff.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},Ff.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Ch=+a.y),b(a.y2)&&(Lh=+a.y2)):Ch=Lh=+a,jf())},Ff.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Dh=+a.y),b(a.y2)&&(Mh=+a.y2)):Dh=Mh=+a,jf())},Ff.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Ff.axis.max(a.max),"undefined"!=typeof a.min&&Ff.axis.min(a.min))},Ff.legend.show=function(a){xf(Dc(a)),jf({withLegend:!0})},Ff.legend.hide=function(a){yf(Dc(a)),jf({withLegend:!0})},Ff.resize=function(a){If=a?a.width:null,Jf=a?a.height:null,of({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Ff.destroy=function(){Ff.data.targets=void 0,Ff.data.xs={},rj.html(""),a.onresize=null},"url"in e.data)Ef.xhr(e.data.url,function(a,b){var c,d=Ef.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Ef.csv.parse(b.response),bf(c)});else if("rows"in e.data)bf(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");bf(uc(e.data.columns))}return Ff},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file +}qj.html(xi(Ff.data.targets.map(function(a){return pc(a.values[zi])}),$(),zd(he(Ff.data.targets)),Qi)),qj.style("top",Ai.top).style("left",Ai.left).style("display","block")}null==a.onresize&&(a.onresize=mf()),a.onresize.add&&(a.onresize.add(Rf),a.onresize.add(function(){of({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})}),a.onresize.add(Sf))}function cf(a){a.append("rect").attr("class",id).style("cursor",Qg&&Rg?"pointer":null).on("mouseover",function(a,b){if(!Li&&!he(Ff.data.targets)){var c,d,e=Ff.data.targets.map(function(a){return pc(a.values[b])});if(Object.keys(Eg).length>0){d=[];for(var g in Eg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Od(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ke,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 gf(a){he(Ff.data.targets)||Qg&&(Ki=a,nj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Li=!0,Zg())}function hf(){he(Ff.data.targets)||Qg&&(nj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),nj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Li=!1,$g())}function jf(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z=Yd(),$=he(Ff.data.targets),_=Ic(Ff.data.targets);if(a=d(a)?a:{},E=d(a.withY)?a.withY:!0,F=d(a.withSubchart)?a.withSubchart:!0,G=d(a.withTransition)?a.withTransition:!0,J=d(a.withTransform)?a.withTransform:!1,K=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,M=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,N=d(a.withLegend)?a.withLegend:!1,H=d(a.withTransitionForExit)?a.withTransitionForExit:G,I=d(a.withTransitionForAxis)?a.withTransitionForAxis:G,T=G?Tf:0,U=H?T:0,V=I?T:0,c=nj.select("."+f.axisX).style("opacity",$?0:1),g=nj.select("."+f.axisY).style("opacity",$?0:1),h=nj.select("."+f.axisY2).style("opacity",$?0:1),e=oj.select("."+f.axisX).style("opacity",$?0:1),S={axisX:c.transition().duration(V),axisY:g.transition().duration(V),axisY2:h.transition().duration(V),axisSubX:e.transition().duration(V)},N&&ch&&zf(Cc(Ff.data.targets),a,S),Ii&&(0!==_.length&&M&&K||qg.domain([0,c.selectAll(".tick").size()])),_.length&&(M&&(qg.domain(Ef.extent(_b(_))),sj=qg.domain(),Mf&&kj.scale(qg).updateScaleExtent(),tg.domain(qg.domain()),gj.scale(tg)),K&&(qg.domain(gj.empty()?sj:gj.extent()),Mf&&kj.scale(qg).updateScaleExtent()),th||!sh&&!rh||(W=Kc(Jc(_),rh),wg.tickValues(W),zg.tickValues(W))),rg.domain(Xb(_,"y")),sg.domain(Xb(_,"y2")),S.axisX.call(wg),S.axisY.call(xg),S.axisY2.call(yg),S.axisSubX.call(zg),K&&_.length)if(ph&&W){for(X=1;X=0&&Ef.select(this).style("display",b%Y?"none":"block")})}else lj.selectAll("."+f.axisX+" .tick text").style("display","block");if(!ih&&uh&&eb(c,S.axisX,uh),O=Xe(Z),Q=Ye(Z,!0),R=Ye(Z,!1),Db(),ug.domain(rg.domain()),vg.domain(sg.domain()),qj.style("display","none"),o(),nj.select("line."+f.xgridFocus).style("visibility","hidden"),Th){if("year"===Uh){j=[];for(var ab=_b(),bb=ab[0].getFullYear(),cb=ab[1].getFullYear(),db=bb;cb>=db;db++)j.push(new Date(db+"-01-01 00:00:00"))}else j=qg.ticks(10);i=nj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",ih?0:function(a){return qg(a)-wg.tickOffset()}).attr("x2",ih?Xf:function(a){return qg(a)-wg.tickOffset()}).attr("y1",ih?function(a){return qg(a)-wg.tickOffset()}:Uf.top).attr("y2",ih?function(a){return qg(a)-wg.tickOffset()}:Zf).style("opacity",function(){return+Ef.select(this).attr(ih?"y1":"x1")===(ih?Zf:0)?0:1}),i.exit().remove()}Be(Vh)&&(k=nj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Vh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",ih?"":"rotate(-90)").attr("dx",ih?0:-Uf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",ih?0:Gd).attr("x2",ih?Xf:Gd).attr("y1",ih?Gd:Uf.top).attr("y2",ih?Gd:Zf).style("opacity",1),k.select("text").transition().duration(T).attr("x",ih?Xf:0).attr("y",Gd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),E&&Wh&&(m=nj.select("."+f.ygrids).selectAll("."+f.ygrid).data(rg.ticks(Yh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",ih?rg:0).attr("x2",ih?rg:Xf).attr("y1",ih?0:rg).attr("y2",ih?Zf:rg),m.exit().remove()),E&&Be(Xh)&&(n=nj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Xh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",ih?"rotate(-90)":"").attr("dx",ih?0:-Uf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(T).attr("x1",ih?Hd:0).attr("x2",ih?Hd:Xf).attr("y1",ih?0:Hd).attr("y2",ih?Zf:Hd).style("opacity",1),n.select("text").transition().duration(T).attr("x",ih?0:Xf).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(T).style("opacity",0).remove()),v=nj.select("."+f.regions).selectAll("rect."+f.region).data(ti),v.enter().append("rect").style("fill-opacity",0),v.attr("class",hd).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(T).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),v.exit().transition().duration(T).style("fill-opacity",0).remove(),t=nj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),t.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Qi),t.style("opacity",td).transition().duration(T).attr("d",O).style("fill",Qi).style("opacity",1),t.exit().transition().duration(U).style("opacity",0).remove(),q=nj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),q.enter().append("path").attr("class",Zc).style("stroke",Qi),q.style("opacity",td).transition().duration(T).attr("d",hj).style("stroke",Qi).style("opacity",1),q.exit().transition().duration(U).style("opacity",0).remove(),r=nj.selectAll("."+f.areas).selectAll("."+f.area).data(pe),r.enter().append("path").attr("class",fd).style("fill",Qi).style("opacity",function(){return tj=+Ef.select(this).style("opacity"),0}),r.style("opacity",0).transition().duration(T).attr("d",ij).style("fill",Qi).style("opacity",tj),r.exit().transition().duration(U).style("opacity",0).remove(),s=nj.selectAll("."+f.circles).selectAll("."+f.circle).data(se),s.enter().append("circle").attr("class",_c).attr("r",Oe).style("fill",Qi),s.style("opacity",td).transition().duration(T).style("opacity",vd).style("fill",Qi).attr("cx",ih?Xd:Wd).attr("cy",ih?Wd:Xd),s.exit().remove(),w=nj.selectAll("."+f.texts).selectAll("."+f.text).data(te),w.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return ih?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",Qi).style("fill-opacity",0),w.text(function(a){return Ed(a.id)(a.value,a.id)}).style("fill-opacity",ud).transition().duration(T).attr("x",Q).attr("y",R).style("fill",Qi).style("fill-opacity",wd),w.exit().transition().duration(U).style("fill-opacity",0).remove(),u=nj.selectAll("."+f.arcs).selectAll("."+f.arc).data(qe),u.enter().append("path").attr("class",dd).style("fill",function(a){return Qi(a.data)}).style("cursor",function(a){return Sg(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Oi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),vf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Sd(d,Ef.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Oi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),wf(),Td(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();ef(this,a,b),e(d,b)}),u.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Oi=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Fb(a);return c?(b=Ef.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("fill",function(a){return Qi(a.data)}).style("opacity",1).call(Ee,function(){Oi=!1}),u.exit().transition().duration(U).style("opacity",0).remove(),nj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(T).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&oe(a.data)?1:0}),nj.select("."+f.chartArcsTitle).style("opacity",ge(Ff.data.targets)?1:0),_g&&(null!==Ef.event&&"zoom"===Ef.event.type&&gj.extent(qg.orgDomain()).update(),F&&(!ih&&uh&&eb(e,S.axisSubX,uh),gj.empty()||gj.extent(qg.orgDomain()).update(),P=Xe(Z,!0),y=oj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),y.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Qi),y.style("opacity",td).transition().duration(T).attr("d",P).style("opacity",1),y.exit().transition().duration(T).style("opacity",0).remove(),x=oj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),x.enter().append("path").attr("class",Zc).style("stroke",Qi),x.style("opacity",td).transition().duration(T).attr("d",jj).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove())),nj.selectAll("."+f.selectedCircles).filter(function(a){return ke(a)}).selectAll("circle").remove(),nj.selectAll("."+f.selectedCircle).transition().duration(T).attr("cx",ih?Xd:Wd).attr("cy",ih?Wd:Xd),z=nj.select("."+f.eventRects),Be(Bg)&&!oc(Bg)?(z.classed(f.eventRectsMultiple)||z.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),A=nj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),df(A.enter()),A.attr("x",0).attr("y",0).attr("width",Xf).attr("height",Zf)):(z.classed(f.eventRectsSingle)||z.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ji&&!Ii?(D=function(a,b){var c=xc(b),d=yc(b),e=Ff.data.xs[a.id][b];return(qg(d?d:e+50)-qg(c?c:e-50))/2},C=function(a,b){var c=xc(b),d=Ff.data.xs[a.id][b];return(qg(d)+qg(c?c:d-50))/2}):(D=L(),C=function(a){return qg(a.x)-D/2}),B=Ac(Ff.data.targets),nj.select("."+f.eventRects).datum(B?B.values:[]),A=nj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),cf(A.enter()),A.attr("class",id).attr("x",ih?0:C).attr("y",ih?C:0).attr("width",ih?Xf:D).attr("height",ih?D:Zf),A.exit().remove()),Cc(Ff.data.targets).forEach(function(a){uj[a]=!0})}function kf(){jf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function lf(){return"mousemove"===Ef.event.sourceEvent.type&&kj.altDomain?(qg.domain(kj.altDomain),void kj.scale(qg).updateScaleExtent()):(Ii&&qg.orgDomain()[0]===sj[0]&&qg.domain([sj[0]-1e-10,qg.orgDomain()[1]]),jf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Ef.event.sourceEvent.type&&(Mi=!0)))}function mf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function nf(){lj.attr("width",_f).attr("height",ag),lj.select("#"+Bi).select("rect").attr("width",Xf).attr("height",Zf),lj.select("#"+Ci).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),lj.select("#"+Di).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),lj.select("."+f.zoomRect).attr("width",Xf).attr("height",Zf),rj.style("max-height",ag+"px")}function of(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),nf(),m(a.withTransition),jf(a)}function pf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=nj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",kd),j=i.enter().append("g").attr("class",kd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc),e=nj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",md),d=e.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",cd).style("cursor",function(a){return Sg(a)?"pointer":null}),c=nj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",ld),b=c.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",$c),b.append("g").attr("class",gd),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",ad).style("cursor",function(a){return Sg(a)?"pointer":null}),a.forEach(function(a){nj.selectAll("."+f.selectedCircles+od(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=nj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(hg(a)).attr("class",nd),g=h.enter().append("g").attr("class",nd),g.append("g").attr("class",ed),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),_g&&(n=oj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",md),m=n.enter().append("g").style("opacity",0).attr("class",md),m.append("g").attr("class",cd),l=oj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",ld),k=l.enter().append("g").style("opacity",0).attr("class",ld),k.append("g").attr("class",$c)),lj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Tf).style("opacity",1)}function qf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?be(a.id,b.types[a.id]):be(a.id,b.type)}),Ff.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=$i?j:i,l=$i?Q():P();return d&&(w=0,C=0,t=0,u=0),ch&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=$i?u:t,void(hh?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=pj.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,$i?(g=function(a){return t*B[a]},j=function(a){return A[B[a]]+x[a]}):(g=function(a){return A[B[a]]+x[a]},j=function(a){return u*B[a]}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=pj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof eh?eh(a):Ff.toggle(a)}).on("mouseover",function(a){Ef.select(this).classed(f.legendItemFocused,!0),Oi||Ff.focus(a),"function"==typeof fh&&fh(a)}).on("mouseout",function(a){Ef.select(this).classed(f.legendItemFocused,!1),Oi||Ff.revert(),"function"==typeof gh&&gh(a)}),o.append("text").text(function(a){return d(Eg[a])?Eg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",$i?h:-200).attr("y",$i?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",$i?i:-200).attr("y",$i?-200:l),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",Qi).attr("x",$i?h:-200).attr("y",$i?-200:j).attr("width",10).attr("height",10),pj.selectAll("text").data(a).text(function(a){return d(Eg[a])?Eg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),pj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}).attr("x",i).attr("y",l),pj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).style("fill",Qi).attr("x",g).attr("y",j),pj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=Ef.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?tf(b):uf(b):cj}),N(t),O(u),M(C),n(),R(),nf(),m(q,c)}function Af(a){return Ec(Ff.data.targets,a.id)}function Bf(a){return"data"in a&&Ec(Ff.data.targets,a.data.id)}function Cf(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 Df(a,b,c){var d=!he(Ff.data.targets);Oi=!1,be(a,b),of(c||{withTransitionForAxis:d})}var Ef=a.d3?a.d3:a.require?a.require("d3"):void 0,Ff={data:{},axis:{},legend:{}},Gf={},Hf=h(["bindto"],"#chart"),If=h(["size","width"]),Jf=h(["size","height"]),Kf=h(["padding","left"],50),Lf=h(["padding","right"]),Mf=h(["zoom","enabled"],!1),Nf=h(["zoom","extent"]),Of=h(["zoom","privileged"],!1),Pf=h(["onenter"],function(){}),Qf=h(["onleave"],function(){}),Rf=h(["onresize"],function(){}),Sf=h(["onresized"],function(){}),Tf=h(["transition","duration"],350);g("data","data is required in config");var Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag=h(["data","x"]),Bg=h(["data","xs"],{}),Cg=h(["data","x_format"]),Dg=h(["data","id_converter"],function(a){return a}),Eg=h(["data","names"],{}),Fg=h(["data","classes"],{}),Gg=h(["data","groups"],[]),Hg=h(["data","axes"],{}),Ig=h(["data","type"]),Jg=h(["data","types"],{}),Kg=h(["data","labels"],{}),Lg=h(["data","order"]),Mg=h(["data","regions"],{}),Ng=h(["data","color"]),Og=h(["data","colors"],{}),Pg=h(["data","hide"],!1),Qg=h(["data","selection","enabled"],!1),Rg=h(["data","selection","grouped"],!1),Sg=h(["data","selection","isselectable"],function(){return!0}),Tg=h(["data","selection","multiple"],!0),Ug=h(["data","onclick"],function(){}),Vg=h(["data","onenter"],function(){}),Wg=h(["data","onleave"],function(){}),Xg=h(["data","onselected"],function(){}),Yg=h(["data","onunselected"],function(){}),Zg=h(["data","ondragstart"],function(){}),$g=h(["data","ondragend"],function(){}),_g=h(["subchart","show"],!1),ah=h(["subchart","size","height"],60),bh=h(["color","pattern"],[]),ch=h(["legend","show"],!0),dh=h(["legend","position"],"bottom"),eh=h(["legend","item","onclick"]),fh=h(["legend","item","onmouseover"]),gh=h(["legend","item","onmouseout"]),hh=h(["legend","equally"],!1),ih=h(["axis","rotated"],!1),jh=h(["axis","x","show"],!0),kh=h(["axis","x","type"],"indexed"),lh=h(["axis","x","localtime"],!0),mh=h(["axis","x","categories"],[]),nh=h(["axis","x","tick","centered"],!1),oh=h(["axis","x","tick","format"]),ph=h(["axis","x","tick","culling"],{}),qh=h(["axis","x","tick","culling","max"],10),rh=h(["axis","x","tick","count"]),sh=h(["axis","x","tick","fit"],!0),th=h(["axis","x","tick","values"],null),uh=h(["axis","x","tick","rotate"]),vh=h(["axis","x","max"],null),wh=h(["axis","x","min"],null),xh=h(["axis","x","padding"],{}),yh=h(["axis","x","height"]),zh=h(["axis","x","default"]),Ah=h(["axis","x","label"],{}),Bh=h(["axis","y","show"],!0),Ch=h(["axis","y","max"]),Dh=h(["axis","y","min"]),Eh=h(["axis","y","center"]),Fh=h(["axis","y","label"],{}),Gh=h(["axis","y","inner"],!1),Hh=h(["axis","y","tick","format"]),Ih=h(["axis","y","padding"]),Jh=h(["axis","y","ticks"],10),Kh=h(["axis","y2","show"],!1),Lh=h(["axis","y2","max"]),Mh=h(["axis","y2","min"]),Nh=h(["axis","y2","center"]),Oh=h(["axis","y2","label"],{}),Ph=h(["axis","y2","inner"],!1),Qh=h(["axis","y2","tick","format"]),Rh=h(["axis","y2","padding"]),Sh=h(["axis","y2","ticks"],10),Th=h(["grid","x","show"],!1),Uh=h(["grid","x","type"],"tick"),Vh=h(["grid","x","lines"],[]),Wh=h(["grid","y","show"],!1),Xh=h(["grid","y","lines"],[]),Yh=h(["grid","y","ticks"],10),Zh=h(["point","show"],!0),$h=h(["point","r"],2.5),_h=h(["point","focus","line","enabled"],!0),ai=h(["point","focus","expand","enabled"],!0),bi=h(["point","focus","expand","r"]),ci=h(["point","focus","select","r"]),di=h(["line","connect_null"],!1),ei=h(["bar","width"]),fi=h(["bar","width","ratio"],.6),gi=h(["pie","label","show"],!0),hi=h(["pie","label","format"]),ii=h(["pie","expand"],!0),ji=h(["pie","onclick"],function(){}),ki=h(["pie","onmouseover"],function(){}),li=h(["pie","onmouseout"],function(){}),mi=h(["donut","label","show"],!0),ni=h(["donut","label","format"]),oi=h(["donut","expand"],!0),pi=h(["donut","title"],""),qi=h(["donut","onclick"],function(){}),ri=h(["donut","onmouseover"],function(){}),si=h(["donut","onmouseout"],function(){}),ti=h(["regions"],[]),ui=h(["tooltip","show"],!0),vi=h(["tooltip","format","title"]),wi=h(["tooltip","format","value"]),xi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=vi?vi:b,l=wi?wi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id,a[g].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),yi=h(["tooltip","init","show"],!1),zi=h(["tooltip","init","x"],0),Ai=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Bi=("string"==typeof Hf?Hf.replace("#",""):Hf.id)+"-clip",Ci=Bi+"-xaxis",Di=Bi+"-yaxis",Ei=i(Bi),Fi=i(Ci),Gi=i(Di),Hi="timeseries"===kh,Ii="categorized"===kh,Ji=!Hi&&(Ag||Be(Bg)),Ki=null,Li=!1,Mi=!1,Ni=!1,Oi=!1,Pi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Qi=ve(Og,Be(bh)?bh:Pi,Ng),Ri=lh?Ef.time.format:Ef.time.format.utc,Si=function(){var a=[[Ri("%Y/%-m/%-d"),function(){return!0}],[Ri("%-m/%-d"),function(a){return a.getMonth()}],[Ri("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ri("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ri("%I %p"),function(a){return a.getHours()}],[Ri("%I:%M"),function(a){return a.getMinutes()}],[Ri(":%S"),function(a){return a.getSeconds()}],[Ri(".%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)}}(),Ti=[],Ui=[],Vi=ih?"left":"bottom",Wi=ih?Gh?"top":"bottom":Gh?"right":"left",Xi=ih?Ph?"bottom":"top":Ph?"left":"right",Yi=ih?"left":"bottom",Zi={main:function(){return"translate("+Uf.left+","+Uf.top+")"},context:function(){return"translate("+Vf.left+","+Vf.top+")"},legend:function(){return"translate("+Wf.left+","+Wf.top+")"},x:function(){return"translate(0,"+(ih?0:Zf)+")"},y:function(){return"translate(0,"+(ih?Zf:0)+")"},y2:function(){return"translate("+(ih?0:Xf)+","+(ih?1:0)+")"},subx:function(){return"translate(0,"+(ih?0:$f)+")"},arc:function(){return"translate("+Xf/2+","+Zf/2+")"}},$i="right"===dh,_i=0,aj=0,bj=0,cj=.15,dj=30,ej=ih&&!jh?0:30,fj=5;hg=Ef.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var gj,hj=function(){var a=Ef.svg.line().x(ih?function(a){return V(a.id)(a.value)}:Fd).y(ih?Fd:function(a){return V(a.id)(a.value)});return di||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=di?Ne(b.values):b.values;return ie(b)?(a.interpolate(je(b)?"cardinal":"linear"),Mg[b.id]?af(e,qg,V(b.id),Mg[b.id]):a(e)):(c=e[0]?qg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ih?"M "+d+" "+c:"M "+c+" "+d)}}(),ij=function(){var a;return a=ih?Ef.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Fd):Ef.svg.area().x(Fd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ne(b.values);return ce([b],"area")||ce([b],"area-spline")?(a.interpolate(je(b)?"cardinal":"linear"),a(e)):(c=e[0]?qg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ih?"M "+d+" "+c:"M "+c+" "+d)}}(),jj=function(){var a=Ef.svg.line().x(ih?function(a){return W(a.id)(a.value)}:Id).y(ih?Id:function(a){return W(a.id)(a.value)});return function(b){var c=Ne(b.values);return ie(b)?a(c):"M "+tg(c[0].x)+" "+W(b.id)(c[0].value)}}(),kj=function(){};gj=Ef.svg.brush().on("brush",kf),gj.update=function(){return oj&&oj.select("."+f.brush).call(this),this},gj.scale=function(a){return ih?this.y(a):this.x(a)},Mf&&(kj=Ef.behavior.zoom().on("zoomstart",function(){kj.altDomain=Ef.event.sourceEvent.altKey?qg.orgDomain():null}).on("zoom",Mf?lf:null),kj.scale=function(a){return ih?this.y(a):this.x(a)},kj.orgScaleExtent=function(){var a=Nf?Nf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},kj.updateScaleExtent=function(){var a=ac(qg.orgDomain())/ac(sj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var lj,mj,nj,oj,pj,qj,rj,sj,tj,uj={};if(Ff.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=lj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);Ff.revert(),Ff.defocus(),b(d.classed(f.focused,!0)),b(e),he(Ff.data.targets)&&Nb(a,!0),vf(a,!0)},Ff.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=lj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);Ff.revert(),b(d.classed(f.focused,!1)),b(e),he(Ff.data.targets)&&Ob(a),vf(a,!1)},Ff.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=lj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);b(d.classed(f.focused,!1)),b(e),he(Ff.data.targets)&&Ob(a),wf()},Ff.show=function(a,b){a=Dc(a),b=b||{},Mc(a),lj.selectAll(qd(a)).transition().style("opacity",1),b.withLegend&&xf(a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ff.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),lj.selectAll(qd(a)).transition().style("opacity",0),b.withLegend&&yf(a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ff.toggle=function(a){Gc(a)?Ff.hide(a):Ff.show(a)},Ff.unzoom=function(){gj.clear().update(),jf({withUpdateXDomain:!0})},Ff.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Fg[b]=a.classes[b]}),"categories"in a&&Ii&&(mh=a.categories,wg.categories(mh)),"cacheIds"in a&&bc(a.cacheIds)?void qf(dc(a.cacheIds),a.done):void("unload"in a?sf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){rf(a)}):rf(a))},Ff.unload=function(a,b){sf(Dc(a),function(){jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Ff.selected=function(a){return Ef.merge(nj.selectAll("."+f.shapes+od(a)).selectAll("."+f.shape).filter(function(){return Ef.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Ff.select=function(a,b,c){Qg&&nj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=Ef.select(this),i=e.data?e.data.id:e.id,j=Me(this),k=Rg||!a||a.indexOf(i)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Sg(e)&&!m&&j(!0,h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(!1,h.classed(f.SELECTED,!1),e,g)})},Ff.unselect=function(a,b){Qg&&nj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=Ef.select(this),g=c.data?c.data.id:c.id,h=Me(this),i=Rg||!a||a.indexOf(g)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(f.SELECTED); +i&&j&&Sg(c)&&k&&h(!1,e.classed(f.SELECTED,!1),c,d)})},Ff.toLine=function(a){Df(a,"line")},Ff.toSpline=function(a){Df(a,"spline")},Ff.toBar=function(a){Df(a,"bar")},Ff.toScatter=function(a){Df(a,"scatter")},Ff.toArea=function(a){Df(a,"area")},Ff.toAreaSpline=function(a){Df(a,"area-spline")},Ff.toPie=function(a){Df(a,"pie",{withTransform:!0})},Ff.toDonut=function(a){Df(a,"donut",{withTransform:!0})},Ff.groups=function(a){return c(a)?Gg:(Gg=a,jf(),Gg)},Ff.xgrids=function(a){return a?(Vh=a,jf(),Vh):Vh},Ff.xgrids.add=function(a){return a?Ff.xgrids(Vh.concat(a)):void 0},Ff.xgrids.remove=function(a){var b=Cf(a);return Ff.xgrids(Vh.filter(b))},Ff.ygrids=function(a){return a?(Xh=a,jf(),Xh):Xh},Ff.ygrids.add=function(a){return a?Ff.ygrids(Xh.concat(a)):void 0},Ff.ygrids.remove=function(a){var b=Cf(a);return Ff.ygrids(Xh.filter(b))},Ff.regions=function(a){return c(a)?ti:(ti=a,jf(),ti)},Ff.regions.add=function(a){return c(a)?ti:(ti=ti.concat(a),jf(),ti)},Ff.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;lj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ti=ti.filter(function(b){return b.classes.indexOf(a)<0})}),ti},Ff.data.get=function(a){var b=Ff.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Ff.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},Ff.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Eg[b]=a[b]}),jf({withLegend:!0}),Eg):Eg},Ff.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Og[b]=a[b]}),jf({withLegend:!0}),Og):Og},Ff.x=function(a){return arguments.length&&(qc(Ff.data.targets,a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ff.data.xs},Ff.xs=function(a){return arguments.length&&(rc(Ff.data.targets,a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ff.data.xs},Ff.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},Ff.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Ch=+a.y),b(a.y2)&&(Lh=+a.y2)):Ch=Lh=+a,jf())},Ff.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Dh=+a.y),b(a.y2)&&(Mh=+a.y2)):Dh=Mh=+a,jf())},Ff.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Ff.axis.max(a.max),"undefined"!=typeof a.min&&Ff.axis.min(a.min))},Ff.legend.show=function(a){xf(Dc(a)),jf({withLegend:!0})},Ff.legend.hide=function(a){yf(Dc(a)),jf({withLegend:!0})},Ff.resize=function(a){If=a?a.width:null,Jf=a?a.height:null,of({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Ff.destroy=function(){Ff.data.targets=void 0,Ff.data.xs={},rj.html(""),a.onresize=null},"url"in e.data)Ef.xhr(e.data.url,function(a,b){var c,d=Ef.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Ef.csv.parse(b.response),bf(c)});else if("rows"in e.data)bf(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");bf(uc(e.data.columns))}return Ff},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 2d6fbdbaa06824a5df8fb4012de36822eb2682ea Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Sun, 4 May 2014 15:10:10 +0900 Subject: [PATCH 124/178] Add padding.top/bottom and fix transition of axis label - #193 --- c3.js | 32 +++++++++++++++++--------------- c3.min.js | 6 +++--- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/c3.js b/c3.js index 4566c30..367cb1f 100644 --- a/c3.js +++ b/c3.js @@ -110,7 +110,9 @@ __size_height = getConfig(['size', 'height']); var __padding_left = getConfig(['padding', 'left'], 50), - __padding_right = getConfig(['padding', 'right']); + __padding_right = getConfig(['padding', 'right'], 0), + __padding_top = getConfig(['padding', 'top'], 0), + __padding_bottom = getConfig(['padding', 'bottom'], 0); var __zoom_enabled = getConfig(['zoom', 'enabled'], false), __zoom_extent = getConfig(['zoom', 'extent']), @@ -416,9 +418,9 @@ // for main, context if (__axis_rotated) { margin = { - top: getHorizontalAxisHeight('y2'), + top: getHorizontalAxisHeight('y2') + __padding_top, right: getCurrentPaddingRight(), - bottom: getHorizontalAxisHeight('y') + legendHeightForBottom, + bottom: getHorizontalAxisHeight('y') + legendHeightForBottom + __padding_bottom, left: subchartHeight + getCurrentPaddingLeft() }; margin2 = { @@ -429,9 +431,9 @@ }; } else { margin = { - top: 4, // for top tick text + top: 4 + __padding_top, // for top tick text right: getCurrentPaddingRight(), - bottom: xAxisHeight + subchartHeight + legendHeightForBottom, + bottom: xAxisHeight + subchartHeight + legendHeightForBottom + __padding_bottom, left: getCurrentPaddingLeft() }; margin2 = { @@ -885,22 +887,22 @@ }); return maxWidth < 0 ? 0 : maxWidth; } - function updateAxisLabels() { - main.select('.' + CLASS.axisX + ' .' + CLASS.axisXLabel) - .transition() + function updateAxisLabels(withTransition) { + var axisXLabel = main.select('.' + CLASS.axisX + ' .' + CLASS.axisXLabel), + axisYLabel = main.select('.' + CLASS.axisY + ' .' + CLASS.axisYLabel), + axisY2Label = main.select('.' + CLASS.axisY2 + ' .' + CLASS.axisY2Label); + (withTransition ? axisXLabel.transition() : axisXLabel) .attr("x", xForXAxisLabel) .attr("dx", dxForXAxisLabel) .attr("dy", dyForXAxisLabel) .text(textForXAxisLabel); - main.select('.' + CLASS.axisY + ' .' + CLASS.axisYLabel) - .transition() + (withTransition ? axisYLabel.transition() : axisYLabel) .attr("x", xForYAxisLabel) .attr("dx", dxForYAxisLabel) .attr("dy", dyForYAxisLabel) .attr("dy", dyForYAxisLabel) .text(textForYAxisLabel); - main.select('.' + CLASS.axisY2 + ' .' + CLASS.axisY2Label) - .transition() + (withTransition ? axisY2Label.transition() : axisY2Label) .attr("x", xForY2AxisLabel) .attr("dx", dxForY2AxisLabel) .attr("dy", dyForY2AxisLabel) @@ -3230,6 +3232,9 @@ transitions.axisY2.call(y2Axis); transitions.axisSubX.call(subXAxis); + // Update axis label + updateAxisLabels(withTransition); + // show/hide if manual culling needed if (withUpdateXDomain && targetsToShow.length) { if (__axis_x_tick_culling && tickValues) { @@ -3260,9 +3265,6 @@ xForText = generateXYForText(barIndices, true); yForText = generateXYForText(barIndices, false); - // Update axis label - updateAxisLabels(); - // Update sub domain subY.domain(y.domain()); subY2.domain(y2.domain()); diff --git a/c3.min.js b/c3.min.js index 6c4dec5..485a2eb 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.34"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",lines:"c3-lines",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",arcs:"c3-arcs",area:"c3-area",areas:"c3-areas",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",legendItemFocused:"c3-legend-item-focused",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;cXf&&(Xf=0),0>Zf&&(Zf=0),Yf=ih?Uf.left-dj-ej:Xf,$f=ih?Zf:ag-Vf.top-Vf.bottom,0>Yf&&(Yf=0),0>$f&&($f=0),p(),$i&&he(Ff.data.targets)&&(Wf.left=Xf/2+cg)}function o(){nj.select("line."+f.xgridFocus).attr("x1",ih?0:-10).attr("x2",ih?Xf:-10).attr("y1",ih?-10:Uf.top).attr("y2",ih?-10:Zf)}function p(){cg=Zf/2,bg=.95*cg,dg=ge(Ff.data.targets)?.6*bg:0}function q(){var a=ih?f.axisX:f.axisY,b=nj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Ef.select(Hf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return If?If:x()}function s(){var a=Jf?Jf:y();return a>0?a:320}function t(){return he(Ff.data.targets)?0:Kf?Kf:ih?jh?v("x"):1:!Bh||Gh?1:v("y")}function u(){var a=1;return he(Ff.data.targets)?0:Lf?Lf:$i?P()+20+(Kh&&!ih?v("y2"):a):Kh?Ph||ih?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||jh?"x"===a&&yh?yh:"y"!==a||Bh?"y2"!==a||Kh?(jb(a).isInner?30:40)+("y2"===a?-10:0):fj:ch&&!$i?10:1:0}function x(){return+Ef.select(Hf).style("width").replace("px","")}function y(){return+Ef.select(Hf).style("height").replace("px","")}function z(a){return a?-5:-(Uf.left-1)}function A(a){return a?-20:-4}function B(){return z(!ih)}function C(){return A(!ih)}function D(){return z(ih)}function E(){return A(ih)}function F(a){return a?Xf+2+4:Uf.left+20}function G(a){return a?(yh?yh:0)+80:Zf+8}function H(){return F(!ih)}function I(){return G(!ih)}function J(){return F(ih)}function K(){return G(ih)}function L(){var a,b,c,d,e,f=Ac(Ff.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=qg(b.x)-qg(a.x),0===c?ih?Zf:Xf:(d=zc(),e=de(Ff.data.targets)?(d-(Ii?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function M(a){_i=a}function N(a){aj=a}function O(a){bj=a}function P(){return ch?$i?aj*(_i+1):_f:0}function Q(){return ch?$i?ag:bj*(_i+1):0}function R(){var a,b,c=!qg;ig=ih?1:0,jg=ih?Zf:Xf,kg=ih?0:Zf,lg=ih?Xf:1,mg=ig,ng=jg,og=ih?0:$f,pg=ih?Yf:1,qg=T(ig,jg,c?void 0:qg.domain(),function(){return wg.tickOffset()}),rg=U(kg,lg,c?void 0:rg.domain()),sg=U(kg,lg,c?void 0:sg.domain()),tg=T(ig,jg,sj,function(a){return a%1?0:zg.tickOffset()}),ug=U(og,pg,c?void 0:ug.domain()),vg=U(og,pg,c?void 0:vg.domain()),a=$(),b=th?th:c?void 0:wg.tickValues(),wg=X(qg,Vi,a,b),zg=X(tg,Yi,a,b),xg=Y(rg,Wi,Hh,Jh),yg=Y(sg,Xi,Qh,Sh),c||(gj.scale(tg),Mf&&kj.scale(qg)),S()}function S(){eg=Gb(),fg=Hb(),gg=Hb(.98)}function T(a,b,d,e){var f=(Hi?Ef.time.scale():Ef.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Ii){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=Ef.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?sg:rg}function W(a){return"y2"===Z(a)?vg:ug}function X(a,b,c,d){var e=(Ii?Eb():Ef.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Ii?(e.tickCentered(nh),Ae(ph)&&(ph=!1)):e.tickOffset=function(){var a=Bc(Ff.data.targets),b=qg(a[1])-qg(a[0]),c=b?b:ih?Zf:Xf;return c/zc()/2},Ii&&e.categories(mh),e}function Y(a,b,c,d){return Ef.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Hg?Hg[a]:"y"}function $(){var a=Hi?Si:Ii?Tc:function(a){return 0>a?a.toFixed(0):a};return oh&&("function"==typeof oh?a=oh:Hi&&(a=function(a){return a?Ri(oh)(a):""})),a}function _(a){var b;return"y"===a?b=Fh:"y2"===a?b=Oh:"x"===a&&(b=Ah),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Fh=b:"y2"===a?Oh=b:"x"===a&&(Ah=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",ih?"inner-top":"inner-right")}function hb(){return fb("y",ih?"inner-right":"inner-top")}function ib(){return fb("y2",ih?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Xf/2:Xf:b.isBottom?-Zf:b.isMiddle?-Zf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!ih,gb())}function rb(){return nb(ih,hb())}function sb(){return nb(ih,ib())}function tb(){return ob(!ih,gb())}function ub(){return ob(ih,hb())}function vb(){return ob(ih,ib())}function wb(){var a=gb();return ih?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":yh?yh-10:"3em"}function xb(){var a=hb();return ih?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return ih?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!ih,gb())}function Ab(){return pb(ih,hb())}function Bb(){return pb(ih,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return Ef.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){nj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),nj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),nj.select("."+f.axisY2+" ."+f.axisY2Label).transition().attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 Ef.min(Object.keys(i).map(function(a){return Ef.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(Gg.length>0)for(g=Sc(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 Ef.max(Object.keys(i).map(function(a){return Ef.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Mh:Dh,n="y2"===c?Lh:Ch,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Nh:Eh,r=xd()&&ih;return 0===l.length?"y2"===c?sg.domain():rg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=yd(o,p),j=ac(rg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),"y2"===c&&Rh&&(f=b(Rh.top)?Rh.top:e,g=b(Rh.bottom)?Rh.bottom:e),de(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return wh?Hi?we(wh):wh:Ef.min(a,function(a){return Ef.min(a.values,function(a){return a.x})})}function Zb(a){return vh?Hi?we(vh):vh:Ef.max(a,function(a){return Ef.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Ii?d=0:de(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof xh&&Be(xh)?(e=b(xh.left)?xh.left:d,f=b(xh.right)?xh.right:d):e=f="number"==typeof xh?xh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return c-d===0&&(c=Hi?new Date(.5*c.getTime()):-.5,d=Hi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Hi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Hi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?rg:sg;return b="y"===a.axis||"y2"===a.axis?ih?Zf:"start"in a?d(a.start):Zf:ih?"end"in a?qg(Hi?we(a.end):a.end):Zf:Zf,c>b?0:b-c}function ic(a){return Ag&&a===Ag||Be(Bg)&&Ce(Bg,a)}function jc(a){return!ic(a)}function kc(a){return Ag?Ag:Be(Bg)?Bg[a]:null}function lc(a,b){var c,d=b&&Be(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=Ff.data.xs[b])}),c}function mc(a,b){return a in Ff.data.xs&&Ff.data.xs[a]&&Ff.data.xs[a][b]?Ff.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){Bg[b]=a[b]})}function oc(a){return 1===Ef.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=Eg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),Ff.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=Hi?a?a instanceof Date?a:we(a):we(mc(c,d)):Ji&&!Ii?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Ff.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Ag?(d=Object.keys(Ff.data.xs),Ff.data.xs[c]=d.length>0?Ff.data.xs[d[0]]:void 0):Be(Bg)&&(Ff.data.xs[c]=lc(f,Ff.data.targets)):Ff.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Ff.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Dg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ji&&Ii&&0===c&&g&&(0===e&&(mh=[]),mh.push(g)),("undefined"==typeof a[b]||Ff.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ig&&be(Cc(c).filter(function(a){return!(a in Jg)}),Ig),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&Ff.data.targets[0].values[a-1]?Ff.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(Ff.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Hi?new Date(i):i);j.push(e)}return Hi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Ti=Ti.concat(a)}function Mc(a){Ti=Ti.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Ui=Ui.concat(a)}function Oc(a){Ui=Ui.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Jd(a,f))),(a[g].x||0===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=De(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Nd(a,b){return Ef.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Od(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 Pd(){return Lg&&"desc"===Lg.toLowerCase()}function Qd(){return Lg&&"asc"===Lg.toLowerCase()}function Rd(a){var b=Qd(),c=Pd();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 Lg&&a.sort(Lg),a}function Sd(a,c){var d,e,f,g,h,i,j,k=he(Ff.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&ui&&(qj.html(xi(a,$(),zd(k),Qi)).style("display","block"),d=qj.property("offsetWidth"),e=qj.property("offsetHeight"),k?(g=Xf/2+c[0],i=Zf/2+c[1]+20):(ih?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=qg(l[0].x)+20):(f=q(),g=f+t()+qg(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),qj.style("top",i+"px").style("left",g+"px"))}function Td(){qj.style("display","none")}function Ud(a){var c=a.filter(function(a){return a&&b(a.value)});ui&&(ee(Ff.data.targets)||he(Ff.data.targets)||nj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(ih?"y1":"x1",Fd).attr(ih?"y2":"x2",Fd))}function Vd(){nj.select("line."+f.xgridFocus).style("visibility","hidden")}function Wd(a){return a.x||0===a.x?qg(a.x):null}function Xd(a){return V(a.id)(a.value)}function Yd(){var a,b,d={},e=0;return Ic(Fc(ke)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ae(a,b){return"number"==typeof ei?ei:b?2*a.tickOffset()*fi/b:0}function be(a,b){Dc(a).forEach(function(a){uj[a]=b===Jg[a],Jg[a]=b})}function ce(a,b){var c=!1;return a.forEach(function(a){Jg[a.id]===b&&(c=!0),a.id in Jg||"line"!==b||(c=!0)}),c}function de(a){return ce(a,"bar")}function ee(a){return ce(a,"scatter")}function fe(a){return ce(a,"pie")}function ge(a){return ce(a,"donut")}function he(a){return fe(a)||ge(a)}function ie(a){var b="string"==typeof a?a:a.id;return!(b in Jg)||"line"===Jg[b]||"spline"===Jg[b]||"area"===Jg[b]||"area-spline"===Jg[b]}function je(a){var b="string"==typeof a?a:a.id;return"spline"===Jg[b]||"area-spline"===Jg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"bar"===Jg[b]}function le(a){var b="string"==typeof a?a:a.id;return"scatter"===Jg[b]}function me(a){var b="string"==typeof a?a:a.id;return"pie"===Jg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"donut"===Jg[b]}function oe(a){return me(a)||ne(a)}function pe(a){return ie(a)?[a]:[]}function qe(a){return oe(a.data)?[a]:[]}function re(a){return ke(a)?a.values:[]}function se(a){return ie(a)||le(a)?a.values:[]}function te(a){return ke(a)||ie(a)?a.values:[]}function ue(a){return ne(a)&&oi||me(a)&&ii}function ve(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function we(b){var c;try{c=Cg?Ef.time.format(Cg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Cg)}return c}function xe(a,b){var c=Ef.mouse(a),d=Ef.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ce(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function De(a,b){var c="y"===Z(a.id)?rg:sg,d=ih?1:0,e=ih?0:1;return Math.pow(qg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ee(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Fe(a,b,c){Xg(b,a.node()),nj.select("."+f.selectedCircles+od(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",ih?Xd:Wd).attr("cy",ih?Wd:Xd).attr("stroke",function(){return Qi(b)}).attr("r",1.4*Qe(b)).transition().duration(100).attr("r",Qe)}function Ge(a,b,c){Yg(b,a.node()),nj.select("."+f.selectedCircles+od(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function He(a,b,c,d){a?Fe(b,c,d):Ge(b,c,d)}function Ie(a,b){Xg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ef.rgb(Qi(b)).brighter(.75)})}function Je(a,b){Yg(b,a.node()),a.transition().duration(100).style("fill",function(){return Qi(b)})}function Ke(a,b,c,d){a?Ie(b,c,d):Je(b,c,d)}function Le(a,b,c,d){Ke(a,b,c.data,d)}function Me(a){return"circle"===a.nodeName?He:Ef.select(a).classed(f.bar)?Ke:Le}function Ne(a){return a.filter(function(a){return b(a.value)})}function Oe(a){return Zh?"function"==typeof $h?$h(a):$h:0}function Pe(a){return ai?bi?bi:1.75*Oe(a):Oe(a)}function Qe(a){return ci?ci:4*Oe(a)}function Re(a,c){return(c?nj.selectAll("."+f.circles+od(c)):nj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Se(a,b){Re(a,b).classed(f.EXPANDED,!0).attr("r",Pe)}function Te(a){Re(a).filter(function(){return Ef.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oe)}function Ue(a){return nj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ve(a){Ue(a).classed(f.EXPANDED,!0)}function We(a){Ue(a).classed(f.EXPANDED,!1)}function Xe(a,b){var c=_e(a,b);return function(a,b){var d=c(a,b),e=ih?1:0,f=ih?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 Ye(a,b){var c=_e(a,!1),d=b?Ze:$e;return function(a,b){return d(c(a,b),a,this)}}function Ze(a,b){var c;return ih?(c=ke(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function $e(a,b,c){var d=c.getBoundingClientRect();return ih?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ke(b)?-3:-6)}function _e(a,b){var c=a.__max__+1,d=ae(wg,c),e=Zd(d,c,a,!!b),f=$d(!!b),g=_d(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return ih&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function af(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 bf(b){var c,d,e;if(rj=Ef.select(Hf),rj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(rj.html("").classed("c3",!0),Ff.data.xs={},Ff.data.targets=vc(b),Pg&&Lc(Pg===!0?Cc(Ff.data.targets):Pg),n(),R(),qg.domain(Ef.extent(_b(Ff.data.targets))),rg.domain(Xb(Ff.data.targets,"y")),sg.domain(Xb(Ff.data.targets,"y2")),tg.domain(qg.domain()),ug.domain(rg.domain()),vg.domain(sg.domain()),sj=qg.domain(),gj.scale(tg),Mf&&kj.scale(qg),lj=rj.append("svg").on("mouseenter",Pf).on("mouseleave",Qf),mj=lj.append("defs"),mj.append("clipPath").attr("id",Bi).append("rect"),mj.append("clipPath").attr("id",Ci).append("rect"),mj.append("clipPath").attr("id",Di).append("rect"),nf(),nj=lj.append("g").attr("transform",Zi.main),oj=lj.append("g").attr("transform",Zi.context),pj=lj.append("g").attr("transform",Zi.legend),_g||oj.style("visibility","hidden"),ch||(pj.style("visibility","hidden"),Ui=Cc(Ff.data.targets)),qj=Ef.select(Hf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),zf(Cc(Ff.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=nj.append("g").attr("clip-path",Ei).attr("class",f.grid),Th&&d.append("g").attr("class",f.xgrids),Be(Vh)&&d.append("g").attr("class",f.xgridLines),_h&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Wh&&d.append("g").attr("class",f.ygrids),Be(Xh)&&d.append("g").attr("class",f.ygridLines),jh&&nj.append("g").attr("class",f.axisX).attr("clip-path",Fi).attr("transform",Zi.x).append("text").attr("class",f.axisXLabel).attr("transform",ih?"rotate(-90)":"").style("text-anchor",zb),Bh&&nj.append("g").attr("class",f.axisY).attr("clip-path",Gi).attr("transform",Zi.y).append("text").attr("class",f.axisYLabel).attr("transform",ih?"":"rotate(-90)").style("text-anchor",Ab),Kh&&nj.append("g").attr("class",f.axisY2).attr("transform",Zi.y2).append("text").attr("class",f.axisY2Label).attr("transform",ih?"":"rotate(-90)").style("text-anchor",Bb),nj.append("g").attr("clip-path",Ei).attr("class",f.regions),nj.append("g").attr("clip-path",Ei).attr("class",f.chart),c=nj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Mf?ih?"ns-resize":"ew-resize":null),nj.select("."+f.chart).append("g").attr("class",f.chartBars),nj.select("."+f.chart).append("g").attr("class",f.chartLines),nj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Zi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),nj.select("."+f.chart).append("g").attr("class",f.chartTexts),Mf&&nj.insert("rect",Of?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Xf).attr("height",Zf).style("opacity",0).style("cursor",ih?"ns-resize":"ew-resize").call(kj).on("dblclick.zoom",null),zh&&gj.extent("function"!=typeof zh?zh:zh(_b())),oj.append("g").attr("clip-path",Ei).attr("class",f.chart),oj.select("."+f.chart).append("g").attr("class",f.chartBars),oj.select("."+f.chart).append("g").attr("class",f.chartLines),oj.append("g").attr("clip-path",Ei).attr("class",f.brush).call(gj).selectAll("rect").attr(ih?"width":"height",ih?Yf:$f),oj.append("g").attr("class",f.axisX).attr("transform",Zi.subx).attr("clip-path",ih?"":Fi),pf(Ff.data.targets),ih?nj.select("."+f.axisX).style("opacity",0).call(wg):(nj.select("."+f.axisY).style("opacity",0).call(xg),nj.select("."+f.axisY2).style("opacity",0).call(yg)),n(),R(),nf(),m(!1),jf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),yi){if(Hi&&"string"==typeof zi){for(zi=we(zi),e=0;e0){d=[];for(var g in Eg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Od(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ke,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 gf(a){he(Ff.data.targets)||Qg&&(Ki=a,nj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Li=!0,Zg())}function hf(){he(Ff.data.targets)||Qg&&(nj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),nj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Li=!1,$g())}function jf(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z=Yd(),$=he(Ff.data.targets),_=Ic(Ff.data.targets);if(a=d(a)?a:{},E=d(a.withY)?a.withY:!0,F=d(a.withSubchart)?a.withSubchart:!0,G=d(a.withTransition)?a.withTransition:!0,J=d(a.withTransform)?a.withTransform:!1,K=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,M=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,N=d(a.withLegend)?a.withLegend:!1,H=d(a.withTransitionForExit)?a.withTransitionForExit:G,I=d(a.withTransitionForAxis)?a.withTransitionForAxis:G,T=G?Tf:0,U=H?T:0,V=I?T:0,c=nj.select("."+f.axisX).style("opacity",$?0:1),g=nj.select("."+f.axisY).style("opacity",$?0:1),h=nj.select("."+f.axisY2).style("opacity",$?0:1),e=oj.select("."+f.axisX).style("opacity",$?0:1),S={axisX:c.transition().duration(V),axisY:g.transition().duration(V),axisY2:h.transition().duration(V),axisSubX:e.transition().duration(V)},N&&ch&&zf(Cc(Ff.data.targets),a,S),Ii&&(0!==_.length&&M&&K||qg.domain([0,c.selectAll(".tick").size()])),_.length&&(M&&(qg.domain(Ef.extent(_b(_))),sj=qg.domain(),Mf&&kj.scale(qg).updateScaleExtent(),tg.domain(qg.domain()),gj.scale(tg)),K&&(qg.domain(gj.empty()?sj:gj.extent()),Mf&&kj.scale(qg).updateScaleExtent()),th||!sh&&!rh||(W=Kc(Jc(_),rh),wg.tickValues(W),zg.tickValues(W))),rg.domain(Xb(_,"y")),sg.domain(Xb(_,"y2")),S.axisX.call(wg),S.axisY.call(xg),S.axisY2.call(yg),S.axisSubX.call(zg),K&&_.length)if(ph&&W){for(X=1;X=0&&Ef.select(this).style("display",b%Y?"none":"block")})}else lj.selectAll("."+f.axisX+" .tick text").style("display","block");if(!ih&&uh&&eb(c,S.axisX,uh),O=Xe(Z),Q=Ye(Z,!0),R=Ye(Z,!1),Db(),ug.domain(rg.domain()),vg.domain(sg.domain()),qj.style("display","none"),o(),nj.select("line."+f.xgridFocus).style("visibility","hidden"),Th){if("year"===Uh){j=[];for(var ab=_b(),bb=ab[0].getFullYear(),cb=ab[1].getFullYear(),db=bb;cb>=db;db++)j.push(new Date(db+"-01-01 00:00:00"))}else j=qg.ticks(10);i=nj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",ih?0:function(a){return qg(a)-wg.tickOffset()}).attr("x2",ih?Xf:function(a){return qg(a)-wg.tickOffset()}).attr("y1",ih?function(a){return qg(a)-wg.tickOffset()}:Uf.top).attr("y2",ih?function(a){return qg(a)-wg.tickOffset()}:Zf).style("opacity",function(){return+Ef.select(this).attr(ih?"y1":"x1")===(ih?Zf:0)?0:1}),i.exit().remove()}Be(Vh)&&(k=nj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Vh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",ih?"":"rotate(-90)").attr("dx",ih?0:-Uf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",ih?0:Gd).attr("x2",ih?Xf:Gd).attr("y1",ih?Gd:Uf.top).attr("y2",ih?Gd:Zf).style("opacity",1),k.select("text").transition().duration(T).attr("x",ih?Xf:0).attr("y",Gd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),E&&Wh&&(m=nj.select("."+f.ygrids).selectAll("."+f.ygrid).data(rg.ticks(Yh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",ih?rg:0).attr("x2",ih?rg:Xf).attr("y1",ih?0:rg).attr("y2",ih?Zf:rg),m.exit().remove()),E&&Be(Xh)&&(n=nj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Xh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",ih?"rotate(-90)":"").attr("dx",ih?0:-Uf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(T).attr("x1",ih?Hd:0).attr("x2",ih?Hd:Xf).attr("y1",ih?0:Hd).attr("y2",ih?Zf:Hd).style("opacity",1),n.select("text").transition().duration(T).attr("x",ih?0:Xf).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(T).style("opacity",0).remove()),v=nj.select("."+f.regions).selectAll("rect."+f.region).data(ti),v.enter().append("rect").style("fill-opacity",0),v.attr("class",hd).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(T).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),v.exit().transition().duration(T).style("fill-opacity",0).remove(),t=nj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),t.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Qi),t.style("opacity",td).transition().duration(T).attr("d",O).style("fill",Qi).style("opacity",1),t.exit().transition().duration(U).style("opacity",0).remove(),q=nj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),q.enter().append("path").attr("class",Zc).style("stroke",Qi),q.style("opacity",td).transition().duration(T).attr("d",hj).style("stroke",Qi).style("opacity",1),q.exit().transition().duration(U).style("opacity",0).remove(),r=nj.selectAll("."+f.areas).selectAll("."+f.area).data(pe),r.enter().append("path").attr("class",fd).style("fill",Qi).style("opacity",function(){return tj=+Ef.select(this).style("opacity"),0}),r.style("opacity",0).transition().duration(T).attr("d",ij).style("fill",Qi).style("opacity",tj),r.exit().transition().duration(U).style("opacity",0).remove(),s=nj.selectAll("."+f.circles).selectAll("."+f.circle).data(se),s.enter().append("circle").attr("class",_c).attr("r",Oe).style("fill",Qi),s.style("opacity",td).transition().duration(T).style("opacity",vd).style("fill",Qi).attr("cx",ih?Xd:Wd).attr("cy",ih?Wd:Xd),s.exit().remove(),w=nj.selectAll("."+f.texts).selectAll("."+f.text).data(te),w.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return ih?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",Qi).style("fill-opacity",0),w.text(function(a){return Ed(a.id)(a.value,a.id)}).style("fill-opacity",ud).transition().duration(T).attr("x",Q).attr("y",R).style("fill",Qi).style("fill-opacity",wd),w.exit().transition().duration(U).style("fill-opacity",0).remove(),u=nj.selectAll("."+f.arcs).selectAll("."+f.arc).data(qe),u.enter().append("path").attr("class",dd).style("fill",function(a){return Qi(a.data)}).style("cursor",function(a){return Sg(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Oi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),vf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Sd(d,Ef.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Oi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),wf(),Td(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();ef(this,a,b),e(d,b)}),u.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Oi=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Fb(a);return c?(b=Ef.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("fill",function(a){return Qi(a.data)}).style("opacity",1).call(Ee,function(){Oi=!1}),u.exit().transition().duration(U).style("opacity",0).remove(),nj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(T).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&oe(a.data)?1:0}),nj.select("."+f.chartArcsTitle).style("opacity",ge(Ff.data.targets)?1:0),_g&&(null!==Ef.event&&"zoom"===Ef.event.type&&gj.extent(qg.orgDomain()).update(),F&&(!ih&&uh&&eb(e,S.axisSubX,uh),gj.empty()||gj.extent(qg.orgDomain()).update(),P=Xe(Z,!0),y=oj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),y.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Qi),y.style("opacity",td).transition().duration(T).attr("d",P).style("opacity",1),y.exit().transition().duration(T).style("opacity",0).remove(),x=oj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),x.enter().append("path").attr("class",Zc).style("stroke",Qi),x.style("opacity",td).transition().duration(T).attr("d",jj).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove())),nj.selectAll("."+f.selectedCircles).filter(function(a){return ke(a)}).selectAll("circle").remove(),nj.selectAll("."+f.selectedCircle).transition().duration(T).attr("cx",ih?Xd:Wd).attr("cy",ih?Wd:Xd),z=nj.select("."+f.eventRects),Be(Bg)&&!oc(Bg)?(z.classed(f.eventRectsMultiple)||z.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),A=nj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),df(A.enter()),A.attr("x",0).attr("y",0).attr("width",Xf).attr("height",Zf)):(z.classed(f.eventRectsSingle)||z.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ji&&!Ii?(D=function(a,b){var c=xc(b),d=yc(b),e=Ff.data.xs[a.id][b];return(qg(d?d:e+50)-qg(c?c:e-50))/2},C=function(a,b){var c=xc(b),d=Ff.data.xs[a.id][b];return(qg(d)+qg(c?c:d-50))/2}):(D=L(),C=function(a){return qg(a.x)-D/2}),B=Ac(Ff.data.targets),nj.select("."+f.eventRects).datum(B?B.values:[]),A=nj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),cf(A.enter()),A.attr("class",id).attr("x",ih?0:C).attr("y",ih?C:0).attr("width",ih?Xf:D).attr("height",ih?D:Zf),A.exit().remove()),Cc(Ff.data.targets).forEach(function(a){uj[a]=!0})}function kf(){jf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function lf(){return"mousemove"===Ef.event.sourceEvent.type&&kj.altDomain?(qg.domain(kj.altDomain),void kj.scale(qg).updateScaleExtent()):(Ii&&qg.orgDomain()[0]===sj[0]&&qg.domain([sj[0]-1e-10,qg.orgDomain()[1]]),jf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Ef.event.sourceEvent.type&&(Mi=!0)))}function mf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function nf(){lj.attr("width",_f).attr("height",ag),lj.select("#"+Bi).select("rect").attr("width",Xf).attr("height",Zf),lj.select("#"+Ci).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),lj.select("#"+Di).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),lj.select("."+f.zoomRect).attr("width",Xf).attr("height",Zf),rj.style("max-height",ag+"px")}function of(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),nf(),m(a.withTransition),jf(a)}function pf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=nj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",kd),j=i.enter().append("g").attr("class",kd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc),e=nj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",md),d=e.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",cd).style("cursor",function(a){return Sg(a)?"pointer":null}),c=nj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",ld),b=c.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",$c),b.append("g").attr("class",gd),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",ad).style("cursor",function(a){return Sg(a)?"pointer":null}),a.forEach(function(a){nj.selectAll("."+f.selectedCircles+od(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=nj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(hg(a)).attr("class",nd),g=h.enter().append("g").attr("class",nd),g.append("g").attr("class",ed),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),_g&&(n=oj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",md),m=n.enter().append("g").style("opacity",0).attr("class",md),m.append("g").attr("class",cd),l=oj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",ld),k=l.enter().append("g").style("opacity",0).attr("class",ld),k.append("g").attr("class",$c)),lj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Tf).style("opacity",1)}function qf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?be(a.id,b.types[a.id]):be(a.id,b.type)}),Ff.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=$i?j:i,l=$i?Q():P();return d&&(w=0,C=0,t=0,u=0),ch&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=$i?u:t,void(hh?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=pj.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,$i?(g=function(a){return t*B[a]},j=function(a){return A[B[a]]+x[a]}):(g=function(a){return A[B[a]]+x[a]},j=function(a){return u*B[a]}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=pj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof eh?eh(a):Ff.toggle(a)}).on("mouseover",function(a){Ef.select(this).classed(f.legendItemFocused,!0),Oi||Ff.focus(a),"function"==typeof fh&&fh(a)}).on("mouseout",function(a){Ef.select(this).classed(f.legendItemFocused,!1),Oi||Ff.revert(),"function"==typeof gh&&gh(a)}),o.append("text").text(function(a){return d(Eg[a])?Eg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",$i?h:-200).attr("y",$i?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",$i?i:-200).attr("y",$i?-200:l),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",Qi).attr("x",$i?h:-200).attr("y",$i?-200:j).attr("width",10).attr("height",10),pj.selectAll("text").data(a).text(function(a){return d(Eg[a])?Eg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),pj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}).attr("x",i).attr("y",l),pj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).style("fill",Qi).attr("x",g).attr("y",j),pj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=Ef.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?tf(b):uf(b):cj}),N(t),O(u),M(C),n(),R(),nf(),m(q,c)}function Af(a){return Ec(Ff.data.targets,a.id)}function Bf(a){return"data"in a&&Ec(Ff.data.targets,a.data.id)}function Cf(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 Df(a,b,c){var d=!he(Ff.data.targets);Oi=!1,be(a,b),of(c||{withTransitionForAxis:d})}var Ef=a.d3?a.d3:a.require?a.require("d3"):void 0,Ff={data:{},axis:{},legend:{}},Gf={},Hf=h(["bindto"],"#chart"),If=h(["size","width"]),Jf=h(["size","height"]),Kf=h(["padding","left"],50),Lf=h(["padding","right"]),Mf=h(["zoom","enabled"],!1),Nf=h(["zoom","extent"]),Of=h(["zoom","privileged"],!1),Pf=h(["onenter"],function(){}),Qf=h(["onleave"],function(){}),Rf=h(["onresize"],function(){}),Sf=h(["onresized"],function(){}),Tf=h(["transition","duration"],350);g("data","data is required in config");var Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag=h(["data","x"]),Bg=h(["data","xs"],{}),Cg=h(["data","x_format"]),Dg=h(["data","id_converter"],function(a){return a}),Eg=h(["data","names"],{}),Fg=h(["data","classes"],{}),Gg=h(["data","groups"],[]),Hg=h(["data","axes"],{}),Ig=h(["data","type"]),Jg=h(["data","types"],{}),Kg=h(["data","labels"],{}),Lg=h(["data","order"]),Mg=h(["data","regions"],{}),Ng=h(["data","color"]),Og=h(["data","colors"],{}),Pg=h(["data","hide"],!1),Qg=h(["data","selection","enabled"],!1),Rg=h(["data","selection","grouped"],!1),Sg=h(["data","selection","isselectable"],function(){return!0}),Tg=h(["data","selection","multiple"],!0),Ug=h(["data","onclick"],function(){}),Vg=h(["data","onenter"],function(){}),Wg=h(["data","onleave"],function(){}),Xg=h(["data","onselected"],function(){}),Yg=h(["data","onunselected"],function(){}),Zg=h(["data","ondragstart"],function(){}),$g=h(["data","ondragend"],function(){}),_g=h(["subchart","show"],!1),ah=h(["subchart","size","height"],60),bh=h(["color","pattern"],[]),ch=h(["legend","show"],!0),dh=h(["legend","position"],"bottom"),eh=h(["legend","item","onclick"]),fh=h(["legend","item","onmouseover"]),gh=h(["legend","item","onmouseout"]),hh=h(["legend","equally"],!1),ih=h(["axis","rotated"],!1),jh=h(["axis","x","show"],!0),kh=h(["axis","x","type"],"indexed"),lh=h(["axis","x","localtime"],!0),mh=h(["axis","x","categories"],[]),nh=h(["axis","x","tick","centered"],!1),oh=h(["axis","x","tick","format"]),ph=h(["axis","x","tick","culling"],{}),qh=h(["axis","x","tick","culling","max"],10),rh=h(["axis","x","tick","count"]),sh=h(["axis","x","tick","fit"],!0),th=h(["axis","x","tick","values"],null),uh=h(["axis","x","tick","rotate"]),vh=h(["axis","x","max"],null),wh=h(["axis","x","min"],null),xh=h(["axis","x","padding"],{}),yh=h(["axis","x","height"]),zh=h(["axis","x","default"]),Ah=h(["axis","x","label"],{}),Bh=h(["axis","y","show"],!0),Ch=h(["axis","y","max"]),Dh=h(["axis","y","min"]),Eh=h(["axis","y","center"]),Fh=h(["axis","y","label"],{}),Gh=h(["axis","y","inner"],!1),Hh=h(["axis","y","tick","format"]),Ih=h(["axis","y","padding"]),Jh=h(["axis","y","ticks"],10),Kh=h(["axis","y2","show"],!1),Lh=h(["axis","y2","max"]),Mh=h(["axis","y2","min"]),Nh=h(["axis","y2","center"]),Oh=h(["axis","y2","label"],{}),Ph=h(["axis","y2","inner"],!1),Qh=h(["axis","y2","tick","format"]),Rh=h(["axis","y2","padding"]),Sh=h(["axis","y2","ticks"],10),Th=h(["grid","x","show"],!1),Uh=h(["grid","x","type"],"tick"),Vh=h(["grid","x","lines"],[]),Wh=h(["grid","y","show"],!1),Xh=h(["grid","y","lines"],[]),Yh=h(["grid","y","ticks"],10),Zh=h(["point","show"],!0),$h=h(["point","r"],2.5),_h=h(["point","focus","line","enabled"],!0),ai=h(["point","focus","expand","enabled"],!0),bi=h(["point","focus","expand","r"]),ci=h(["point","focus","select","r"]),di=h(["line","connect_null"],!1),ei=h(["bar","width"]),fi=h(["bar","width","ratio"],.6),gi=h(["pie","label","show"],!0),hi=h(["pie","label","format"]),ii=h(["pie","expand"],!0),ji=h(["pie","onclick"],function(){}),ki=h(["pie","onmouseover"],function(){}),li=h(["pie","onmouseout"],function(){}),mi=h(["donut","label","show"],!0),ni=h(["donut","label","format"]),oi=h(["donut","expand"],!0),pi=h(["donut","title"],""),qi=h(["donut","onclick"],function(){}),ri=h(["donut","onmouseover"],function(){}),si=h(["donut","onmouseout"],function(){}),ti=h(["regions"],[]),ui=h(["tooltip","show"],!0),vi=h(["tooltip","format","title"]),wi=h(["tooltip","format","value"]),xi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=vi?vi:b,l=wi?wi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id,a[g].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),yi=h(["tooltip","init","show"],!1),zi=h(["tooltip","init","x"],0),Ai=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Bi=("string"==typeof Hf?Hf.replace("#",""):Hf.id)+"-clip",Ci=Bi+"-xaxis",Di=Bi+"-yaxis",Ei=i(Bi),Fi=i(Ci),Gi=i(Di),Hi="timeseries"===kh,Ii="categorized"===kh,Ji=!Hi&&(Ag||Be(Bg)),Ki=null,Li=!1,Mi=!1,Ni=!1,Oi=!1,Pi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Qi=ve(Og,Be(bh)?bh:Pi,Ng),Ri=lh?Ef.time.format:Ef.time.format.utc,Si=function(){var a=[[Ri("%Y/%-m/%-d"),function(){return!0}],[Ri("%-m/%-d"),function(a){return a.getMonth()}],[Ri("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ri("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ri("%I %p"),function(a){return a.getHours()}],[Ri("%I:%M"),function(a){return a.getMinutes()}],[Ri(":%S"),function(a){return a.getSeconds()}],[Ri(".%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)}}(),Ti=[],Ui=[],Vi=ih?"left":"bottom",Wi=ih?Gh?"top":"bottom":Gh?"right":"left",Xi=ih?Ph?"bottom":"top":Ph?"left":"right",Yi=ih?"left":"bottom",Zi={main:function(){return"translate("+Uf.left+","+Uf.top+")"},context:function(){return"translate("+Vf.left+","+Vf.top+")"},legend:function(){return"translate("+Wf.left+","+Wf.top+")"},x:function(){return"translate(0,"+(ih?0:Zf)+")"},y:function(){return"translate(0,"+(ih?Zf:0)+")"},y2:function(){return"translate("+(ih?0:Xf)+","+(ih?1:0)+")"},subx:function(){return"translate(0,"+(ih?0:$f)+")"},arc:function(){return"translate("+Xf/2+","+Zf/2+")"}},$i="right"===dh,_i=0,aj=0,bj=0,cj=.15,dj=30,ej=ih&&!jh?0:30,fj=5;hg=Ef.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var gj,hj=function(){var a=Ef.svg.line().x(ih?function(a){return V(a.id)(a.value)}:Fd).y(ih?Fd:function(a){return V(a.id)(a.value)});return di||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=di?Ne(b.values):b.values;return ie(b)?(a.interpolate(je(b)?"cardinal":"linear"),Mg[b.id]?af(e,qg,V(b.id),Mg[b.id]):a(e)):(c=e[0]?qg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ih?"M "+d+" "+c:"M "+c+" "+d)}}(),ij=function(){var a;return a=ih?Ef.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Fd):Ef.svg.area().x(Fd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ne(b.values);return ce([b],"area")||ce([b],"area-spline")?(a.interpolate(je(b)?"cardinal":"linear"),a(e)):(c=e[0]?qg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ih?"M "+d+" "+c:"M "+c+" "+d)}}(),jj=function(){var a=Ef.svg.line().x(ih?function(a){return W(a.id)(a.value)}:Id).y(ih?Id:function(a){return W(a.id)(a.value)});return function(b){var c=Ne(b.values);return ie(b)?a(c):"M "+tg(c[0].x)+" "+W(b.id)(c[0].value)}}(),kj=function(){};gj=Ef.svg.brush().on("brush",kf),gj.update=function(){return oj&&oj.select("."+f.brush).call(this),this},gj.scale=function(a){return ih?this.y(a):this.x(a)},Mf&&(kj=Ef.behavior.zoom().on("zoomstart",function(){kj.altDomain=Ef.event.sourceEvent.altKey?qg.orgDomain():null}).on("zoom",Mf?lf:null),kj.scale=function(a){return ih?this.y(a):this.x(a)},kj.orgScaleExtent=function(){var a=Nf?Nf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},kj.updateScaleExtent=function(){var a=ac(qg.orgDomain())/ac(sj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var lj,mj,nj,oj,pj,qj,rj,sj,tj,uj={};if(Ff.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=lj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);Ff.revert(),Ff.defocus(),b(d.classed(f.focused,!0)),b(e),he(Ff.data.targets)&&Nb(a,!0),vf(a,!0)},Ff.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=lj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);Ff.revert(),b(d.classed(f.focused,!1)),b(e),he(Ff.data.targets)&&Ob(a),vf(a,!1)},Ff.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=lj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);b(d.classed(f.focused,!1)),b(e),he(Ff.data.targets)&&Ob(a),wf()},Ff.show=function(a,b){a=Dc(a),b=b||{},Mc(a),lj.selectAll(qd(a)).transition().style("opacity",1),b.withLegend&&xf(a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ff.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),lj.selectAll(qd(a)).transition().style("opacity",0),b.withLegend&&yf(a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ff.toggle=function(a){Gc(a)?Ff.hide(a):Ff.show(a)},Ff.unzoom=function(){gj.clear().update(),jf({withUpdateXDomain:!0})},Ff.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Fg[b]=a.classes[b]}),"categories"in a&&Ii&&(mh=a.categories,wg.categories(mh)),"cacheIds"in a&&bc(a.cacheIds)?void qf(dc(a.cacheIds),a.done):void("unload"in a?sf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){rf(a)}):rf(a))},Ff.unload=function(a,b){sf(Dc(a),function(){jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Ff.selected=function(a){return Ef.merge(nj.selectAll("."+f.shapes+od(a)).selectAll("."+f.shape).filter(function(){return Ef.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Ff.select=function(a,b,c){Qg&&nj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=Ef.select(this),i=e.data?e.data.id:e.id,j=Me(this),k=Rg||!a||a.indexOf(i)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Sg(e)&&!m&&j(!0,h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(!1,h.classed(f.SELECTED,!1),e,g)})},Ff.unselect=function(a,b){Qg&&nj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=Ef.select(this),g=c.data?c.data.id:c.id,h=Me(this),i=Rg||!a||a.indexOf(g)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(f.SELECTED); -i&&j&&Sg(c)&&k&&h(!1,e.classed(f.SELECTED,!1),c,d)})},Ff.toLine=function(a){Df(a,"line")},Ff.toSpline=function(a){Df(a,"spline")},Ff.toBar=function(a){Df(a,"bar")},Ff.toScatter=function(a){Df(a,"scatter")},Ff.toArea=function(a){Df(a,"area")},Ff.toAreaSpline=function(a){Df(a,"area-spline")},Ff.toPie=function(a){Df(a,"pie",{withTransform:!0})},Ff.toDonut=function(a){Df(a,"donut",{withTransform:!0})},Ff.groups=function(a){return c(a)?Gg:(Gg=a,jf(),Gg)},Ff.xgrids=function(a){return a?(Vh=a,jf(),Vh):Vh},Ff.xgrids.add=function(a){return a?Ff.xgrids(Vh.concat(a)):void 0},Ff.xgrids.remove=function(a){var b=Cf(a);return Ff.xgrids(Vh.filter(b))},Ff.ygrids=function(a){return a?(Xh=a,jf(),Xh):Xh},Ff.ygrids.add=function(a){return a?Ff.ygrids(Xh.concat(a)):void 0},Ff.ygrids.remove=function(a){var b=Cf(a);return Ff.ygrids(Xh.filter(b))},Ff.regions=function(a){return c(a)?ti:(ti=a,jf(),ti)},Ff.regions.add=function(a){return c(a)?ti:(ti=ti.concat(a),jf(),ti)},Ff.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;lj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ti=ti.filter(function(b){return b.classes.indexOf(a)<0})}),ti},Ff.data.get=function(a){var b=Ff.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Ff.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},Ff.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Eg[b]=a[b]}),jf({withLegend:!0}),Eg):Eg},Ff.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Og[b]=a[b]}),jf({withLegend:!0}),Og):Og},Ff.x=function(a){return arguments.length&&(qc(Ff.data.targets,a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ff.data.xs},Ff.xs=function(a){return arguments.length&&(rc(Ff.data.targets,a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ff.data.xs},Ff.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},Ff.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Ch=+a.y),b(a.y2)&&(Lh=+a.y2)):Ch=Lh=+a,jf())},Ff.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Dh=+a.y),b(a.y2)&&(Mh=+a.y2)):Dh=Mh=+a,jf())},Ff.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Ff.axis.max(a.max),"undefined"!=typeof a.min&&Ff.axis.min(a.min))},Ff.legend.show=function(a){xf(Dc(a)),jf({withLegend:!0})},Ff.legend.hide=function(a){yf(Dc(a)),jf({withLegend:!0})},Ff.resize=function(a){If=a?a.width:null,Jf=a?a.height:null,of({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Ff.destroy=function(){Ff.data.targets=void 0,Ff.data.xs={},rj.html(""),a.onresize=null},"url"in e.data)Ef.xhr(e.data.url,function(a,b){var c,d=Ef.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Ef.csv.parse(b.response),bf(c)});else if("rows"in e.data)bf(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");bf(uc(e.data.columns))}return Ff},"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.34"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",lines:"c3-lines",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",arcs:"c3-arcs",area:"c3-area",areas:"c3-areas",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",legendItemFocused:"c3-legend-item-focused",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;cZf&&(Zf=0),0>_f&&(_f=0),$f=kh?Wf.left-fj-gj:Zf,ag=kh?_f:cg-Xf.top-Xf.bottom,0>$f&&($f=0),0>ag&&(ag=0),p(),aj&&he(Ff.data.targets)&&(Yf.left=Zf/2+eg)}function o(){pj.select("line."+f.xgridFocus).attr("x1",kh?0:-10).attr("x2",kh?Zf:-10).attr("y1",kh?-10:Wf.top).attr("y2",kh?-10:_f)}function p(){eg=_f/2,dg=.95*eg,fg=ge(Ff.data.targets)?.6*dg:0}function q(){var a=kh?f.axisX:f.axisY,b=pj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Ef.select(Hf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return If?If:x()}function s(){var a=Jf?Jf:y();return a>0?a:320}function t(){return he(Ff.data.targets)?0:Kf?Kf:kh?lh?v("x"):1:!Dh||Ih?1:v("y")}function u(){var a=1;return he(Ff.data.targets)?0:Lf?Lf:aj?P()+20+(Mh&&!kh?v("y2"):a):Mh?Rh||kh?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||lh?"x"===a&&Ah?Ah:"y"!==a||Dh?"y2"!==a||Mh?(jb(a).isInner?30:40)+("y2"===a?-10:0):hj:eh&&!aj?10:1:0}function x(){return+Ef.select(Hf).style("width").replace("px","")}function y(){return+Ef.select(Hf).style("height").replace("px","")}function z(a){return a?-5:-(Wf.left-1)}function A(a){return a?-20:-4}function B(){return z(!kh)}function C(){return A(!kh)}function D(){return z(kh)}function E(){return A(kh)}function F(a){return a?Zf+2+4:Wf.left+20}function G(a){return a?(Ah?Ah:0)+80:_f+8}function H(){return F(!kh)}function I(){return G(!kh)}function J(){return F(kh)}function K(){return G(kh)}function L(){var a,b,c,d,e,f=Ac(Ff.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=sg(b.x)-sg(a.x),0===c?kh?_f:Zf:(d=zc(),e=de(Ff.data.targets)?(d-(Ki?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function M(a){bj=a}function N(a){cj=a}function O(a){dj=a}function P(){return eh?aj?cj*(bj+1):bg:0}function Q(){return eh?aj?cg:dj*(bj+1):0}function R(){var a,b,c=!sg;kg=kh?1:0,lg=kh?_f:Zf,mg=kh?0:_f,ng=kh?Zf:1,og=kg,pg=lg,qg=kh?0:ag,rg=kh?$f:1,sg=T(kg,lg,c?void 0:sg.domain(),function(){return yg.tickOffset()}),tg=U(mg,ng,c?void 0:tg.domain()),ug=U(mg,ng,c?void 0:ug.domain()),vg=T(kg,lg,uj,function(a){return a%1?0:Bg.tickOffset()}),wg=U(qg,rg,c?void 0:wg.domain()),xg=U(qg,rg,c?void 0:xg.domain()),a=$(),b=vh?vh:c?void 0:yg.tickValues(),yg=X(sg,Xi,a,b),Bg=X(vg,$i,a,b),zg=Y(tg,Yi,Jh,Lh),Ag=Y(ug,Zi,Sh,Uh),c||(ij.scale(vg),Of&&mj.scale(sg)),S()}function S(){gg=Gb(),hg=Hb(),ig=Hb(.98)}function T(a,b,d,e){var f=(Ji?Ef.time.scale():Ef.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Ki){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=Ef.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?ug:tg}function W(a){return"y2"===Z(a)?xg:wg}function X(a,b,c,d){var e=(Ki?Eb():Ef.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Ki?(e.tickCentered(ph),Ae(rh)&&(rh=!1)):e.tickOffset=function(){var a=Bc(Ff.data.targets),b=sg(a[1])-sg(a[0]),c=b?b:kh?_f:Zf;return c/zc()/2},Ki&&e.categories(oh),e}function Y(a,b,c,d){return Ef.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Jg?Jg[a]:"y"}function $(){var a=Ji?Ui:Ki?Tc:function(a){return 0>a?a.toFixed(0):a};return qh&&("function"==typeof qh?a=qh:Ji&&(a=function(a){return a?Ti(qh)(a):""})),a}function _(a){var b;return"y"===a?b=Hh:"y2"===a?b=Qh:"x"===a&&(b=Ch),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Hh=b:"y2"===a?Qh=b:"x"===a&&(Ch=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",kh?"inner-top":"inner-right")}function hb(){return fb("y",kh?"inner-right":"inner-top")}function ib(){return fb("y2",kh?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Zf/2:Zf:b.isBottom?-_f:b.isMiddle?-_f/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!kh,gb())}function rb(){return nb(kh,hb())}function sb(){return nb(kh,ib())}function tb(){return ob(!kh,gb())}function ub(){return ob(kh,hb())}function vb(){return ob(kh,ib())}function wb(){var a=gb();return kh?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":Ah?Ah-10:"3em"}function xb(){var a=hb();return kh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return kh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!kh,gb())}function Ab(){return pb(kh,hb())}function Bb(){return pb(kh,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return Ef.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(a){var b=pj.select("."+f.axisX+" ."+f.axisXLabel),c=pj.select("."+f.axisY+" ."+f.axisYLabel),d=pj.select("."+f.axisY2+" ."+f.axisY2Label);(a?b.transition():b).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),(a?c.transition():c).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),(a?d.transition():d).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 Ef.min(Object.keys(i).map(function(a){return Ef.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(Ig.length>0)for(g=Sc(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 Ef.max(Object.keys(i).map(function(a){return Ef.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Oh:Fh,n="y2"===c?Nh:Eh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Ph:Gh,r=xd()&&kh;return 0===l.length?"y2"===c?ug.domain():tg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=yd(o,p),j=ac(tg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Kh&&(f=b(Kh.top)?Kh.top:e,g=b(Kh.bottom)?Kh.bottom:e),"y2"===c&&Th&&(f=b(Th.top)?Th.top:e,g=b(Th.bottom)?Th.bottom:e),de(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return yh?Ji?we(yh):yh:Ef.min(a,function(a){return Ef.min(a.values,function(a){return a.x})})}function Zb(a){return xh?Ji?we(xh):xh:Ef.max(a,function(a){return Ef.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Ki?d=0:de(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof zh&&Be(zh)?(e=b(zh.left)?zh.left:d,f=b(zh.right)?zh.right:d):e=f="number"==typeof zh?zh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return c-d===0&&(c=Ji?new Date(.5*c.getTime()):-.5,d=Ji?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Ji?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Ji?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?tg:ug;return b="y"===a.axis||"y2"===a.axis?kh?_f:"start"in a?d(a.start):_f:kh?"end"in a?sg(Ji?we(a.end):a.end):_f:_f,c>b?0:b-c}function ic(a){return Cg&&a===Cg||Be(Dg)&&Ce(Dg,a)}function jc(a){return!ic(a)}function kc(a){return Cg?Cg:Be(Dg)?Dg[a]:null}function lc(a,b){var c,d=b&&Be(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=Ff.data.xs[b])}),c}function mc(a,b){return a in Ff.data.xs&&Ff.data.xs[a]&&Ff.data.xs[a][b]?Ff.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){Dg[b]=a[b]})}function oc(a){return 1===Ef.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=Gg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),Ff.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=Ji?a?a instanceof Date?a:we(a):we(mc(c,d)):Li&&!Ki?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Ff.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Cg?(d=Object.keys(Ff.data.xs),Ff.data.xs[c]=d.length>0?Ff.data.xs[d[0]]:void 0):Be(Dg)&&(Ff.data.xs[c]=lc(f,Ff.data.targets)):Ff.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Ff.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Fg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Li&&Ki&&0===c&&g&&(0===e&&(oh=[]),oh.push(g)),("undefined"==typeof a[b]||Ff.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Kg&&be(Cc(c).filter(function(a){return!(a in Lg)}),Kg),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&Ff.data.targets[0].values[a-1]?Ff.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(Ff.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Ji?new Date(i):i);j.push(e)}return Ji||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Vi=Vi.concat(a)}function Mc(a){Vi=Vi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Wi=Wi.concat(a)}function Oc(a){Wi=Wi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Jd(a,f))),(a[g].x||0===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=De(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Nd(a,b){return Ef.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Od(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 Pd(){return Ng&&"desc"===Ng.toLowerCase()}function Qd(){return Ng&&"asc"===Ng.toLowerCase()}function Rd(a){var b=Qd(),c=Pd();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 Ng&&a.sort(Ng),a}function Sd(a,c){var d,e,f,g,h,i,j,k=he(Ff.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&wi&&(sj.html(zi(a,$(),zd(k),Si)).style("display","block"),d=sj.property("offsetWidth"),e=sj.property("offsetHeight"),k?(g=Zf/2+c[0],i=_f/2+c[1]+20):(kh?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=sg(l[0].x)+20):(f=q(),g=f+t()+sg(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),sj.style("top",i+"px").style("left",g+"px"))}function Td(){sj.style("display","none")}function Ud(a){var c=a.filter(function(a){return a&&b(a.value)});wi&&(ee(Ff.data.targets)||he(Ff.data.targets)||pj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(kh?"y1":"x1",Fd).attr(kh?"y2":"x2",Fd))}function Vd(){pj.select("line."+f.xgridFocus).style("visibility","hidden")}function Wd(a){return a.x||0===a.x?sg(a.x):null}function Xd(a){return V(a.id)(a.value)}function Yd(){var a,b,d={},e=0;return Ic(Fc(ke)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ae(a,b){return"number"==typeof gi?gi:b?2*a.tickOffset()*hi/b:0}function be(a,b){Dc(a).forEach(function(a){wj[a]=b===Lg[a],Lg[a]=b})}function ce(a,b){var c=!1;return a.forEach(function(a){Lg[a.id]===b&&(c=!0),a.id in Lg||"line"!==b||(c=!0)}),c}function de(a){return ce(a,"bar")}function ee(a){return ce(a,"scatter")}function fe(a){return ce(a,"pie")}function ge(a){return ce(a,"donut")}function he(a){return fe(a)||ge(a)}function ie(a){var b="string"==typeof a?a:a.id;return!(b in Lg)||"line"===Lg[b]||"spline"===Lg[b]||"area"===Lg[b]||"area-spline"===Lg[b]}function je(a){var b="string"==typeof a?a:a.id;return"spline"===Lg[b]||"area-spline"===Lg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"bar"===Lg[b]}function le(a){var b="string"==typeof a?a:a.id;return"scatter"===Lg[b]}function me(a){var b="string"==typeof a?a:a.id;return"pie"===Lg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"donut"===Lg[b]}function oe(a){return me(a)||ne(a)}function pe(a){return ie(a)?[a]:[]}function qe(a){return oe(a.data)?[a]:[]}function re(a){return ke(a)?a.values:[]}function se(a){return ie(a)||le(a)?a.values:[]}function te(a){return ke(a)||ie(a)?a.values:[]}function ue(a){return ne(a)&&qi||me(a)&&ki}function ve(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function we(b){var c;try{c=Eg?Ef.time.format(Eg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Eg)}return c}function xe(a,b){var c=Ef.mouse(a),d=Ef.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ce(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function De(a,b){var c="y"===Z(a.id)?tg:ug,d=kh?1:0,e=kh?0:1;return Math.pow(sg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ee(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Fe(a,b,c){Zg(b,a.node()),pj.select("."+f.selectedCircles+od(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",kh?Xd:Wd).attr("cy",kh?Wd:Xd).attr("stroke",function(){return Si(b)}).attr("r",1.4*Qe(b)).transition().duration(100).attr("r",Qe)}function Ge(a,b,c){$g(b,a.node()),pj.select("."+f.selectedCircles+od(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function He(a,b,c,d){a?Fe(b,c,d):Ge(b,c,d)}function Ie(a,b){Zg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ef.rgb(Si(b)).brighter(.75)})}function Je(a,b){$g(b,a.node()),a.transition().duration(100).style("fill",function(){return Si(b)})}function Ke(a,b,c,d){a?Ie(b,c,d):Je(b,c,d)}function Le(a,b,c,d){Ke(a,b,c.data,d)}function Me(a){return"circle"===a.nodeName?He:Ef.select(a).classed(f.bar)?Ke:Le}function Ne(a){return a.filter(function(a){return b(a.value)})}function Oe(a){return _h?"function"==typeof ai?ai(a):ai:0}function Pe(a){return ci?di?di:1.75*Oe(a):Oe(a)}function Qe(a){return ei?ei:4*Oe(a)}function Re(a,c){return(c?pj.selectAll("."+f.circles+od(c)):pj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Se(a,b){Re(a,b).classed(f.EXPANDED,!0).attr("r",Pe)}function Te(a){Re(a).filter(function(){return Ef.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oe)}function Ue(a){return pj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ve(a){Ue(a).classed(f.EXPANDED,!0)}function We(a){Ue(a).classed(f.EXPANDED,!1)}function Xe(a,b){var c=_e(a,b);return function(a,b){var d=c(a,b),e=kh?1:0,f=kh?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 Ye(a,b){var c=_e(a,!1),d=b?Ze:$e;return function(a,b){return d(c(a,b),a,this)}}function Ze(a,b){var c;return kh?(c=ke(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function $e(a,b,c){var d=c.getBoundingClientRect();return kh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ke(b)?-3:-6)}function _e(a,b){var c=a.__max__+1,d=ae(yg,c),e=Zd(d,c,a,!!b),f=$d(!!b),g=_d(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return kh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function af(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 bf(b){var c,d,e;if(tj=Ef.select(Hf),tj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(tj.html("").classed("c3",!0),Ff.data.xs={},Ff.data.targets=vc(b),Rg&&Lc(Rg===!0?Cc(Ff.data.targets):Rg),n(),R(),sg.domain(Ef.extent(_b(Ff.data.targets))),tg.domain(Xb(Ff.data.targets,"y")),ug.domain(Xb(Ff.data.targets,"y2")),vg.domain(sg.domain()),wg.domain(tg.domain()),xg.domain(ug.domain()),uj=sg.domain(),ij.scale(vg),Of&&mj.scale(sg),nj=tj.append("svg").on("mouseenter",Rf).on("mouseleave",Sf),oj=nj.append("defs"),oj.append("clipPath").attr("id",Di).append("rect"),oj.append("clipPath").attr("id",Ei).append("rect"),oj.append("clipPath").attr("id",Fi).append("rect"),nf(),pj=nj.append("g").attr("transform",_i.main),qj=nj.append("g").attr("transform",_i.context),rj=nj.append("g").attr("transform",_i.legend),bh||qj.style("visibility","hidden"),eh||(rj.style("visibility","hidden"),Wi=Cc(Ff.data.targets)),sj=Ef.select(Hf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),zf(Cc(Ff.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=pj.append("g").attr("clip-path",Gi).attr("class",f.grid),Vh&&d.append("g").attr("class",f.xgrids),Be(Xh)&&d.append("g").attr("class",f.xgridLines),bi&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Yh&&d.append("g").attr("class",f.ygrids),Be(Zh)&&d.append("g").attr("class",f.ygridLines),lh&&pj.append("g").attr("class",f.axisX).attr("clip-path",Hi).attr("transform",_i.x).append("text").attr("class",f.axisXLabel).attr("transform",kh?"rotate(-90)":"").style("text-anchor",zb),Dh&&pj.append("g").attr("class",f.axisY).attr("clip-path",Ii).attr("transform",_i.y).append("text").attr("class",f.axisYLabel).attr("transform",kh?"":"rotate(-90)").style("text-anchor",Ab),Mh&&pj.append("g").attr("class",f.axisY2).attr("transform",_i.y2).append("text").attr("class",f.axisY2Label).attr("transform",kh?"":"rotate(-90)").style("text-anchor",Bb),pj.append("g").attr("clip-path",Gi).attr("class",f.regions),pj.append("g").attr("clip-path",Gi).attr("class",f.chart),c=pj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Of?kh?"ns-resize":"ew-resize":null),pj.select("."+f.chart).append("g").attr("class",f.chartBars),pj.select("."+f.chart).append("g").attr("class",f.chartLines),pj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",_i.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),pj.select("."+f.chart).append("g").attr("class",f.chartTexts),Of&&pj.insert("rect",Qf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Zf).attr("height",_f).style("opacity",0).style("cursor",kh?"ns-resize":"ew-resize").call(mj).on("dblclick.zoom",null),Bh&&ij.extent("function"!=typeof Bh?Bh:Bh(_b())),qj.append("g").attr("clip-path",Gi).attr("class",f.chart),qj.select("."+f.chart).append("g").attr("class",f.chartBars),qj.select("."+f.chart).append("g").attr("class",f.chartLines),qj.append("g").attr("clip-path",Gi).attr("class",f.brush).call(ij).selectAll("rect").attr(kh?"width":"height",kh?$f:ag),qj.append("g").attr("class",f.axisX).attr("transform",_i.subx).attr("clip-path",kh?"":Hi),pf(Ff.data.targets),kh?pj.select("."+f.axisX).style("opacity",0).call(yg):(pj.select("."+f.axisY).style("opacity",0).call(zg),pj.select("."+f.axisY2).style("opacity",0).call(Ag)),n(),R(),nf(),m(!1),jf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Ai){if(Ji&&"string"==typeof Bi){for(Bi=we(Bi),e=0;e0){d=[];for(var g in Gg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Od(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ke,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 gf(a){he(Ff.data.targets)||Sg&&(Mi=a,pj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ni=!0,_g())}function hf(){he(Ff.data.targets)||Sg&&(pj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),pj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ni=!1,ah())}function jf(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z=Yd(),$=he(Ff.data.targets),_=Ic(Ff.data.targets);if(a=d(a)?a:{},E=d(a.withY)?a.withY:!0,F=d(a.withSubchart)?a.withSubchart:!0,G=d(a.withTransition)?a.withTransition:!0,J=d(a.withTransform)?a.withTransform:!1,K=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,M=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,N=d(a.withLegend)?a.withLegend:!1,H=d(a.withTransitionForExit)?a.withTransitionForExit:G,I=d(a.withTransitionForAxis)?a.withTransitionForAxis:G,T=G?Vf:0,U=H?T:0,V=I?T:0,c=pj.select("."+f.axisX).style("opacity",$?0:1),g=pj.select("."+f.axisY).style("opacity",$?0:1),h=pj.select("."+f.axisY2).style("opacity",$?0:1),e=qj.select("."+f.axisX).style("opacity",$?0:1),S={axisX:c.transition().duration(V),axisY:g.transition().duration(V),axisY2:h.transition().duration(V),axisSubX:e.transition().duration(V)},N&&eh&&zf(Cc(Ff.data.targets),a,S),Ki&&(0!==_.length&&M&&K||sg.domain([0,c.selectAll(".tick").size()])),_.length&&(M&&(sg.domain(Ef.extent(_b(_))),uj=sg.domain(),Of&&mj.scale(sg).updateScaleExtent(),vg.domain(sg.domain()),ij.scale(vg)),K&&(sg.domain(ij.empty()?uj:ij.extent()),Of&&mj.scale(sg).updateScaleExtent()),vh||!uh&&!th||(W=Kc(Jc(_),th),yg.tickValues(W),Bg.tickValues(W))),tg.domain(Xb(_,"y")),ug.domain(Xb(_,"y2")),S.axisX.call(yg),S.axisY.call(zg),S.axisY2.call(Ag),S.axisSubX.call(Bg),Db(G),K&&_.length)if(rh&&W){for(X=1;X=0&&Ef.select(this).style("display",b%Y?"none":"block")})}else nj.selectAll("."+f.axisX+" .tick text").style("display","block");if(!kh&&wh&&eb(c,S.axisX,wh),O=Xe(Z),Q=Ye(Z,!0),R=Ye(Z,!1),wg.domain(tg.domain()),xg.domain(ug.domain()),sj.style("display","none"),o(),pj.select("line."+f.xgridFocus).style("visibility","hidden"),Vh){if("year"===Wh){j=[];for(var ab=_b(),bb=ab[0].getFullYear(),cb=ab[1].getFullYear(),db=bb;cb>=db;db++)j.push(new Date(db+"-01-01 00:00:00"))}else j=sg.ticks(10);i=pj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",kh?0:function(a){return sg(a)-yg.tickOffset()}).attr("x2",kh?Zf:function(a){return sg(a)-yg.tickOffset()}).attr("y1",kh?function(a){return sg(a)-yg.tickOffset()}:Wf.top).attr("y2",kh?function(a){return sg(a)-yg.tickOffset()}:_f).style("opacity",function(){return+Ef.select(this).attr(kh?"y1":"x1")===(kh?_f:0)?0:1}),i.exit().remove()}Be(Xh)&&(k=pj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Xh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",kh?"":"rotate(-90)").attr("dx",kh?0:-Wf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",kh?0:Gd).attr("x2",kh?Zf:Gd).attr("y1",kh?Gd:Wf.top).attr("y2",kh?Gd:_f).style("opacity",1),k.select("text").transition().duration(T).attr("x",kh?Zf:0).attr("y",Gd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),E&&Yh&&(m=pj.select("."+f.ygrids).selectAll("."+f.ygrid).data(tg.ticks($h)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",kh?tg:0).attr("x2",kh?tg:Zf).attr("y1",kh?0:tg).attr("y2",kh?_f:tg),m.exit().remove()),E&&Be(Zh)&&(n=pj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Zh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",kh?"rotate(-90)":"").attr("dx",kh?0:-Wf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(T).attr("x1",kh?Hd:0).attr("x2",kh?Hd:Zf).attr("y1",kh?0:Hd).attr("y2",kh?_f:Hd).style("opacity",1),n.select("text").transition().duration(T).attr("x",kh?0:Zf).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(T).style("opacity",0).remove()),v=pj.select("."+f.regions).selectAll("rect."+f.region).data(vi),v.enter().append("rect").style("fill-opacity",0),v.attr("class",hd).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(T).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),v.exit().transition().duration(T).style("fill-opacity",0).remove(),t=pj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),t.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Si),t.style("opacity",td).transition().duration(T).attr("d",O).style("fill",Si).style("opacity",1),t.exit().transition().duration(U).style("opacity",0).remove(),q=pj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),q.enter().append("path").attr("class",Zc).style("stroke",Si),q.style("opacity",td).transition().duration(T).attr("d",jj).style("stroke",Si).style("opacity",1),q.exit().transition().duration(U).style("opacity",0).remove(),r=pj.selectAll("."+f.areas).selectAll("."+f.area).data(pe),r.enter().append("path").attr("class",fd).style("fill",Si).style("opacity",function(){return vj=+Ef.select(this).style("opacity"),0}),r.style("opacity",0).transition().duration(T).attr("d",kj).style("fill",Si).style("opacity",vj),r.exit().transition().duration(U).style("opacity",0).remove(),s=pj.selectAll("."+f.circles).selectAll("."+f.circle).data(se),s.enter().append("circle").attr("class",_c).attr("r",Oe).style("fill",Si),s.style("opacity",td).transition().duration(T).style("opacity",vd).style("fill",Si).attr("cx",kh?Xd:Wd).attr("cy",kh?Wd:Xd),s.exit().remove(),w=pj.selectAll("."+f.texts).selectAll("."+f.text).data(te),w.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return kh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",Si).style("fill-opacity",0),w.text(function(a){return Ed(a.id)(a.value,a.id)}).style("fill-opacity",ud).transition().duration(T).attr("x",Q).attr("y",R).style("fill",Si).style("fill-opacity",wd),w.exit().transition().duration(U).style("fill-opacity",0).remove(),u=pj.selectAll("."+f.arcs).selectAll("."+f.arc).data(qe),u.enter().append("path").attr("class",dd).style("fill",function(a){return Si(a.data)}).style("cursor",function(a){return Ug(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Qi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),vf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Sd(d,Ef.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Qi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),wf(),Td(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();ef(this,a,b),e(d,b)}),u.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Qi=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Fb(a);return c?(b=Ef.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("fill",function(a){return Si(a.data)}).style("opacity",1).call(Ee,function(){Qi=!1}),u.exit().transition().duration(U).style("opacity",0).remove(),pj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(T).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&oe(a.data)?1:0}),pj.select("."+f.chartArcsTitle).style("opacity",ge(Ff.data.targets)?1:0),bh&&(null!==Ef.event&&"zoom"===Ef.event.type&&ij.extent(sg.orgDomain()).update(),F&&(!kh&&wh&&eb(e,S.axisSubX,wh),ij.empty()||ij.extent(sg.orgDomain()).update(),P=Xe(Z,!0),y=qj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),y.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Si),y.style("opacity",td).transition().duration(T).attr("d",P).style("opacity",1),y.exit().transition().duration(T).style("opacity",0).remove(),x=qj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),x.enter().append("path").attr("class",Zc).style("stroke",Si),x.style("opacity",td).transition().duration(T).attr("d",lj).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove())),pj.selectAll("."+f.selectedCircles).filter(function(a){return ke(a)}).selectAll("circle").remove(),pj.selectAll("."+f.selectedCircle).transition().duration(T).attr("cx",kh?Xd:Wd).attr("cy",kh?Wd:Xd),z=pj.select("."+f.eventRects),Be(Dg)&&!oc(Dg)?(z.classed(f.eventRectsMultiple)||z.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),A=pj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),df(A.enter()),A.attr("x",0).attr("y",0).attr("width",Zf).attr("height",_f)):(z.classed(f.eventRectsSingle)||z.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Li&&!Ki?(D=function(a,b){var c=xc(b),d=yc(b),e=Ff.data.xs[a.id][b];return(sg(d?d:e+50)-sg(c?c:e-50))/2},C=function(a,b){var c=xc(b),d=Ff.data.xs[a.id][b];return(sg(d)+sg(c?c:d-50))/2}):(D=L(),C=function(a){return sg(a.x)-D/2}),B=Ac(Ff.data.targets),pj.select("."+f.eventRects).datum(B?B.values:[]),A=pj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),cf(A.enter()),A.attr("class",id).attr("x",kh?0:C).attr("y",kh?C:0).attr("width",kh?Zf:D).attr("height",kh?D:_f),A.exit().remove()),Cc(Ff.data.targets).forEach(function(a){wj[a]=!0})}function kf(){jf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function lf(){return"mousemove"===Ef.event.sourceEvent.type&&mj.altDomain?(sg.domain(mj.altDomain),void mj.scale(sg).updateScaleExtent()):(Ki&&sg.orgDomain()[0]===uj[0]&&sg.domain([uj[0]-1e-10,sg.orgDomain()[1]]),jf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Ef.event.sourceEvent.type&&(Oi=!0)))}function mf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function nf(){nj.attr("width",bg).attr("height",cg),nj.select("#"+Di).select("rect").attr("width",Zf).attr("height",_f),nj.select("#"+Ei).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),nj.select("#"+Fi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),nj.select("."+f.zoomRect).attr("width",Zf).attr("height",_f),tj.style("max-height",cg+"px")}function of(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),nf(),m(a.withTransition),jf(a)}function pf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=pj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",kd),j=i.enter().append("g").attr("class",kd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc),e=pj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",md),d=e.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",cd).style("cursor",function(a){return Ug(a)?"pointer":null}),c=pj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",ld),b=c.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",$c),b.append("g").attr("class",gd),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",ad).style("cursor",function(a){return Ug(a)?"pointer":null}),a.forEach(function(a){pj.selectAll("."+f.selectedCircles+od(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=pj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(jg(a)).attr("class",nd),g=h.enter().append("g").attr("class",nd),g.append("g").attr("class",ed),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),bh&&(n=qj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",md),m=n.enter().append("g").style("opacity",0).attr("class",md),m.append("g").attr("class",cd),l=qj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",ld),k=l.enter().append("g").style("opacity",0).attr("class",ld),k.append("g").attr("class",$c)),nj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Vf).style("opacity",1)}function qf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?be(a.id,b.types[a.id]):be(a.id,b.type)}),Ff.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=aj?j:i,l=aj?Q():P();return d&&(w=0,C=0,t=0,u=0),eh&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=aj?u:t,void(jh?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=rj.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,aj?(g=function(a){return t*B[a]},j=function(a){return A[B[a]]+x[a]}):(g=function(a){return A[B[a]]+x[a]},j=function(a){return u*B[a]}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=rj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof gh?gh(a):Ff.toggle(a)}).on("mouseover",function(a){Ef.select(this).classed(f.legendItemFocused,!0),Qi||Ff.focus(a),"function"==typeof hh&&hh(a)}).on("mouseout",function(a){Ef.select(this).classed(f.legendItemFocused,!1),Qi||Ff.revert(),"function"==typeof ih&&ih(a)}),o.append("text").text(function(a){return d(Gg[a])?Gg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",aj?h:-200).attr("y",aj?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",aj?i:-200).attr("y",aj?-200:l),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",Si).attr("x",aj?h:-200).attr("y",aj?-200:j).attr("width",10).attr("height",10),rj.selectAll("text").data(a).text(function(a){return d(Gg[a])?Gg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),rj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}).attr("x",i).attr("y",l),rj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).style("fill",Si).attr("x",g).attr("y",j),rj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=Ef.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?tf(b):uf(b):ej}),N(t),O(u),M(C),n(),R(),nf(),m(q,c)}function Af(a){return Ec(Ff.data.targets,a.id)}function Bf(a){return"data"in a&&Ec(Ff.data.targets,a.data.id)}function Cf(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 Df(a,b,c){var d=!he(Ff.data.targets);Qi=!1,be(a,b),of(c||{withTransitionForAxis:d})}var Ef=a.d3?a.d3:a.require?a.require("d3"):void 0,Ff={data:{},axis:{},legend:{}},Gf={},Hf=h(["bindto"],"#chart"),If=h(["size","width"]),Jf=h(["size","height"]),Kf=h(["padding","left"],50),Lf=h(["padding","right"],0),Mf=h(["padding","top"],0),Nf=h(["padding","bottom"],0),Of=h(["zoom","enabled"],!1),Pf=h(["zoom","extent"]),Qf=h(["zoom","privileged"],!1),Rf=h(["onenter"],function(){}),Sf=h(["onleave"],function(){}),Tf=h(["onresize"],function(){}),Uf=h(["onresized"],function(){}),Vf=h(["transition","duration"],350);g("data","data is required in config");var Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg=h(["data","x"]),Dg=h(["data","xs"],{}),Eg=h(["data","x_format"]),Fg=h(["data","id_converter"],function(a){return a}),Gg=h(["data","names"],{}),Hg=h(["data","classes"],{}),Ig=h(["data","groups"],[]),Jg=h(["data","axes"],{}),Kg=h(["data","type"]),Lg=h(["data","types"],{}),Mg=h(["data","labels"],{}),Ng=h(["data","order"]),Og=h(["data","regions"],{}),Pg=h(["data","color"]),Qg=h(["data","colors"],{}),Rg=h(["data","hide"],!1),Sg=h(["data","selection","enabled"],!1),Tg=h(["data","selection","grouped"],!1),Ug=h(["data","selection","isselectable"],function(){return!0}),Vg=h(["data","selection","multiple"],!0),Wg=h(["data","onclick"],function(){}),Xg=h(["data","onenter"],function(){}),Yg=h(["data","onleave"],function(){}),Zg=h(["data","onselected"],function(){}),$g=h(["data","onunselected"],function(){}),_g=h(["data","ondragstart"],function(){}),ah=h(["data","ondragend"],function(){}),bh=h(["subchart","show"],!1),ch=h(["subchart","size","height"],60),dh=h(["color","pattern"],[]),eh=h(["legend","show"],!0),fh=h(["legend","position"],"bottom"),gh=h(["legend","item","onclick"]),hh=h(["legend","item","onmouseover"]),ih=h(["legend","item","onmouseout"]),jh=h(["legend","equally"],!1),kh=h(["axis","rotated"],!1),lh=h(["axis","x","show"],!0),mh=h(["axis","x","type"],"indexed"),nh=h(["axis","x","localtime"],!0),oh=h(["axis","x","categories"],[]),ph=h(["axis","x","tick","centered"],!1),qh=h(["axis","x","tick","format"]),rh=h(["axis","x","tick","culling"],{}),sh=h(["axis","x","tick","culling","max"],10),th=h(["axis","x","tick","count"]),uh=h(["axis","x","tick","fit"],!0),vh=h(["axis","x","tick","values"],null),wh=h(["axis","x","tick","rotate"]),xh=h(["axis","x","max"],null),yh=h(["axis","x","min"],null),zh=h(["axis","x","padding"],{}),Ah=h(["axis","x","height"]),Bh=h(["axis","x","default"]),Ch=h(["axis","x","label"],{}),Dh=h(["axis","y","show"],!0),Eh=h(["axis","y","max"]),Fh=h(["axis","y","min"]),Gh=h(["axis","y","center"]),Hh=h(["axis","y","label"],{}),Ih=h(["axis","y","inner"],!1),Jh=h(["axis","y","tick","format"]),Kh=h(["axis","y","padding"]),Lh=h(["axis","y","ticks"],10),Mh=h(["axis","y2","show"],!1),Nh=h(["axis","y2","max"]),Oh=h(["axis","y2","min"]),Ph=h(["axis","y2","center"]),Qh=h(["axis","y2","label"],{}),Rh=h(["axis","y2","inner"],!1),Sh=h(["axis","y2","tick","format"]),Th=h(["axis","y2","padding"]),Uh=h(["axis","y2","ticks"],10),Vh=h(["grid","x","show"],!1),Wh=h(["grid","x","type"],"tick"),Xh=h(["grid","x","lines"],[]),Yh=h(["grid","y","show"],!1),Zh=h(["grid","y","lines"],[]),$h=h(["grid","y","ticks"],10),_h=h(["point","show"],!0),ai=h(["point","r"],2.5),bi=h(["point","focus","line","enabled"],!0),ci=h(["point","focus","expand","enabled"],!0),di=h(["point","focus","expand","r"]),ei=h(["point","focus","select","r"]),fi=h(["line","connect_null"],!1),gi=h(["bar","width"]),hi=h(["bar","width","ratio"],.6),ii=h(["pie","label","show"],!0),ji=h(["pie","label","format"]),ki=h(["pie","expand"],!0),li=h(["pie","onclick"],function(){}),mi=h(["pie","onmouseover"],function(){}),ni=h(["pie","onmouseout"],function(){}),oi=h(["donut","label","show"],!0),pi=h(["donut","label","format"]),qi=h(["donut","expand"],!0),ri=h(["donut","title"],""),si=h(["donut","onclick"],function(){}),ti=h(["donut","onmouseover"],function(){}),ui=h(["donut","onmouseout"],function(){}),vi=h(["regions"],[]),wi=h(["tooltip","show"],!0),xi=h(["tooltip","format","title"]),yi=h(["tooltip","format","value"]),zi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=xi?xi:b,l=yi?yi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id,a[g].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Ai=h(["tooltip","init","show"],!1),Bi=h(["tooltip","init","x"],0),Ci=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Di=("string"==typeof Hf?Hf.replace("#",""):Hf.id)+"-clip",Ei=Di+"-xaxis",Fi=Di+"-yaxis",Gi=i(Di),Hi=i(Ei),Ii=i(Fi),Ji="timeseries"===mh,Ki="categorized"===mh,Li=!Ji&&(Cg||Be(Dg)),Mi=null,Ni=!1,Oi=!1,Pi=!1,Qi=!1,Ri=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Si=ve(Qg,Be(dh)?dh:Ri,Pg),Ti=nh?Ef.time.format:Ef.time.format.utc,Ui=function(){var a=[[Ti("%Y/%-m/%-d"),function(){return!0}],[Ti("%-m/%-d"),function(a){return a.getMonth()}],[Ti("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ti("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ti("%I %p"),function(a){return a.getHours()}],[Ti("%I:%M"),function(a){return a.getMinutes()}],[Ti(":%S"),function(a){return a.getSeconds()}],[Ti(".%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)}}(),Vi=[],Wi=[],Xi=kh?"left":"bottom",Yi=kh?Ih?"top":"bottom":Ih?"right":"left",Zi=kh?Rh?"bottom":"top":Rh?"left":"right",$i=kh?"left":"bottom",_i={main:function(){return"translate("+Wf.left+","+Wf.top+")"},context:function(){return"translate("+Xf.left+","+Xf.top+")"},legend:function(){return"translate("+Yf.left+","+Yf.top+")"},x:function(){return"translate(0,"+(kh?0:_f)+")"},y:function(){return"translate(0,"+(kh?_f:0)+")"},y2:function(){return"translate("+(kh?0:Zf)+","+(kh?1:0)+")"},subx:function(){return"translate(0,"+(kh?0:ag)+")"},arc:function(){return"translate("+Zf/2+","+_f/2+")"}},aj="right"===fh,bj=0,cj=0,dj=0,ej=.15,fj=30,gj=kh&&!lh?0:30,hj=5;jg=Ef.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var ij,jj=function(){var a=Ef.svg.line().x(kh?function(a){return V(a.id)(a.value)}:Fd).y(kh?Fd:function(a){return V(a.id)(a.value)});return fi||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=fi?Ne(b.values):b.values;return ie(b)?(a.interpolate(je(b)?"cardinal":"linear"),Og[b.id]?af(e,sg,V(b.id),Og[b.id]):a(e)):(c=e[0]?sg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,kh?"M "+d+" "+c:"M "+c+" "+d)}}(),kj=function(){var a;return a=kh?Ef.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Fd):Ef.svg.area().x(Fd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ne(b.values);return ce([b],"area")||ce([b],"area-spline")?(a.interpolate(je(b)?"cardinal":"linear"),a(e)):(c=e[0]?sg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,kh?"M "+d+" "+c:"M "+c+" "+d)}}(),lj=function(){var a=Ef.svg.line().x(kh?function(a){return W(a.id)(a.value)}:Id).y(kh?Id:function(a){return W(a.id)(a.value)});return function(b){var c=Ne(b.values);return ie(b)?a(c):"M "+vg(c[0].x)+" "+W(b.id)(c[0].value)}}(),mj=function(){};ij=Ef.svg.brush().on("brush",kf),ij.update=function(){return qj&&qj.select("."+f.brush).call(this),this},ij.scale=function(a){return kh?this.y(a):this.x(a)},Of&&(mj=Ef.behavior.zoom().on("zoomstart",function(){mj.altDomain=Ef.event.sourceEvent.altKey?sg.orgDomain():null}).on("zoom",Of?lf:null),mj.scale=function(a){return kh?this.y(a):this.x(a)},mj.orgScaleExtent=function(){var a=Pf?Pf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},mj.updateScaleExtent=function(){var a=ac(sg.orgDomain())/ac(uj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var nj,oj,pj,qj,rj,sj,tj,uj,vj,wj={};if(Ff.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=nj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);Ff.revert(),Ff.defocus(),b(d.classed(f.focused,!0)),b(e),he(Ff.data.targets)&&Nb(a,!0),vf(a,!0)},Ff.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=nj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);Ff.revert(),b(d.classed(f.focused,!1)),b(e),he(Ff.data.targets)&&Ob(a),vf(a,!1)},Ff.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=nj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);b(d.classed(f.focused,!1)),b(e),he(Ff.data.targets)&&Ob(a),wf()},Ff.show=function(a,b){a=Dc(a),b=b||{},Mc(a),nj.selectAll(qd(a)).transition().style("opacity",1),b.withLegend&&xf(a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ff.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),nj.selectAll(qd(a)).transition().style("opacity",0),b.withLegend&&yf(a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ff.toggle=function(a){Gc(a)?Ff.hide(a):Ff.show(a)},Ff.unzoom=function(){ij.clear().update(),jf({withUpdateXDomain:!0})},Ff.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Hg[b]=a.classes[b]}),"categories"in a&&Ki&&(oh=a.categories,yg.categories(oh)),"cacheIds"in a&&bc(a.cacheIds)?void qf(dc(a.cacheIds),a.done):void("unload"in a?sf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){rf(a)}):rf(a))},Ff.unload=function(a,b){sf(Dc(a),function(){jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Ff.selected=function(a){return Ef.merge(pj.selectAll("."+f.shapes+od(a)).selectAll("."+f.shape).filter(function(){return Ef.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Ff.select=function(a,b,c){Sg&&pj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=Ef.select(this),i=e.data?e.data.id:e.id,j=Me(this),k=Tg||!a||a.indexOf(i)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Ug(e)&&!m&&j(!0,h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(!1,h.classed(f.SELECTED,!1),e,g)})},Ff.unselect=function(a,b){Sg&&pj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=Ef.select(this),g=c.data?c.data.id:c.id,h=Me(this),i=Tg||!a||a.indexOf(g)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(f.SELECTED); +i&&j&&Ug(c)&&k&&h(!1,e.classed(f.SELECTED,!1),c,d)})},Ff.toLine=function(a){Df(a,"line")},Ff.toSpline=function(a){Df(a,"spline")},Ff.toBar=function(a){Df(a,"bar")},Ff.toScatter=function(a){Df(a,"scatter")},Ff.toArea=function(a){Df(a,"area")},Ff.toAreaSpline=function(a){Df(a,"area-spline")},Ff.toPie=function(a){Df(a,"pie",{withTransform:!0})},Ff.toDonut=function(a){Df(a,"donut",{withTransform:!0})},Ff.groups=function(a){return c(a)?Ig:(Ig=a,jf(),Ig)},Ff.xgrids=function(a){return a?(Xh=a,jf(),Xh):Xh},Ff.xgrids.add=function(a){return a?Ff.xgrids(Xh.concat(a)):void 0},Ff.xgrids.remove=function(a){var b=Cf(a);return Ff.xgrids(Xh.filter(b))},Ff.ygrids=function(a){return a?(Zh=a,jf(),Zh):Zh},Ff.ygrids.add=function(a){return a?Ff.ygrids(Zh.concat(a)):void 0},Ff.ygrids.remove=function(a){var b=Cf(a);return Ff.ygrids(Zh.filter(b))},Ff.regions=function(a){return c(a)?vi:(vi=a,jf(),vi)},Ff.regions.add=function(a){return c(a)?vi:(vi=vi.concat(a),jf(),vi)},Ff.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;nj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),vi=vi.filter(function(b){return b.classes.indexOf(a)<0})}),vi},Ff.data.get=function(a){var b=Ff.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Ff.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},Ff.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Gg[b]=a[b]}),jf({withLegend:!0}),Gg):Gg},Ff.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Qg[b]=a[b]}),jf({withLegend:!0}),Qg):Qg},Ff.x=function(a){return arguments.length&&(qc(Ff.data.targets,a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ff.data.xs},Ff.xs=function(a){return arguments.length&&(rc(Ff.data.targets,a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ff.data.xs},Ff.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},Ff.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Eh=+a.y),b(a.y2)&&(Nh=+a.y2)):Eh=Nh=+a,jf())},Ff.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Fh=+a.y),b(a.y2)&&(Oh=+a.y2)):Fh=Oh=+a,jf())},Ff.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Ff.axis.max(a.max),"undefined"!=typeof a.min&&Ff.axis.min(a.min))},Ff.legend.show=function(a){xf(Dc(a)),jf({withLegend:!0})},Ff.legend.hide=function(a){yf(Dc(a)),jf({withLegend:!0})},Ff.resize=function(a){If=a?a.width:null,Jf=a?a.height:null,of({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Ff.destroy=function(){Ff.data.targets=void 0,Ff.data.xs={},tj.html(""),a.onresize=null},"url"in e.data)Ef.xhr(e.data.url,function(a,b){var c,d=Ef.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Ef.csv.parse(b.response),bf(c)});else if("rows"in e.data)bf(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");bf(uc(e.data.columns))}return Ff},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 515f5bd9d8319c06387da3d100a365d739b7e903 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Sun, 4 May 2014 15:43:20 +0900 Subject: [PATCH 125/178] Add sample for padding --- htdocs/samples/padding.html | 59 +++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 htdocs/samples/padding.html diff --git a/htdocs/samples/padding.html b/htdocs/samples/padding.html new file mode 100644 index 0000000..da1f9bc --- /dev/null +++ b/htdocs/samples/padding.html @@ -0,0 +1,59 @@ + + + + + + +
+ + + + + + From 8c580629b8449492879377f2eaba37e0a3e9bc66 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Sun, 4 May 2014 15:45:36 +0900 Subject: [PATCH 126/178] Wrap rect for region by g - #194 --- c3.js | 9 +++++---- c3.min.js | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/c3.js b/c3.js index 367cb1f..f22c3f5 100644 --- a/c3.js +++ b/c3.js @@ -3380,12 +3380,13 @@ } // rect for regions - mainRegion = main.select('.' + CLASS.regions).selectAll('rect.' + CLASS.region) + mainRegion = main.select('.' + CLASS.regions).selectAll('.' + CLASS.region) .data(__regions); - mainRegion.enter().append('rect') - .style("fill-opacity", 0); - mainRegion + mainRegion.enter().append('g') .attr('class', classRegion) + .append('rect') + .style("fill-opacity", 0); + mainRegion.selectAll('rect') .attr("x", regionX) .attr("y", regionY) .attr("width", regionWidth) diff --git a/c3.min.js b/c3.min.js index 485a2eb..7b15d00 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ !function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.34"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",lines:"c3-lines",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",arcs:"c3-arcs",area:"c3-area",areas:"c3-areas",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",legendItemFocused:"c3-legend-item-focused",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;cZf&&(Zf=0),0>_f&&(_f=0),$f=kh?Wf.left-fj-gj:Zf,ag=kh?_f:cg-Xf.top-Xf.bottom,0>$f&&($f=0),0>ag&&(ag=0),p(),aj&&he(Ff.data.targets)&&(Yf.left=Zf/2+eg)}function o(){pj.select("line."+f.xgridFocus).attr("x1",kh?0:-10).attr("x2",kh?Zf:-10).attr("y1",kh?-10:Wf.top).attr("y2",kh?-10:_f)}function p(){eg=_f/2,dg=.95*eg,fg=ge(Ff.data.targets)?.6*dg:0}function q(){var a=kh?f.axisX:f.axisY,b=pj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Ef.select(Hf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return If?If:x()}function s(){var a=Jf?Jf:y();return a>0?a:320}function t(){return he(Ff.data.targets)?0:Kf?Kf:kh?lh?v("x"):1:!Dh||Ih?1:v("y")}function u(){var a=1;return he(Ff.data.targets)?0:Lf?Lf:aj?P()+20+(Mh&&!kh?v("y2"):a):Mh?Rh||kh?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||lh?"x"===a&&Ah?Ah:"y"!==a||Dh?"y2"!==a||Mh?(jb(a).isInner?30:40)+("y2"===a?-10:0):hj:eh&&!aj?10:1:0}function x(){return+Ef.select(Hf).style("width").replace("px","")}function y(){return+Ef.select(Hf).style("height").replace("px","")}function z(a){return a?-5:-(Wf.left-1)}function A(a){return a?-20:-4}function B(){return z(!kh)}function C(){return A(!kh)}function D(){return z(kh)}function E(){return A(kh)}function F(a){return a?Zf+2+4:Wf.left+20}function G(a){return a?(Ah?Ah:0)+80:_f+8}function H(){return F(!kh)}function I(){return G(!kh)}function J(){return F(kh)}function K(){return G(kh)}function L(){var a,b,c,d,e,f=Ac(Ff.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=sg(b.x)-sg(a.x),0===c?kh?_f:Zf:(d=zc(),e=de(Ff.data.targets)?(d-(Ki?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function M(a){bj=a}function N(a){cj=a}function O(a){dj=a}function P(){return eh?aj?cj*(bj+1):bg:0}function Q(){return eh?aj?cg:dj*(bj+1):0}function R(){var a,b,c=!sg;kg=kh?1:0,lg=kh?_f:Zf,mg=kh?0:_f,ng=kh?Zf:1,og=kg,pg=lg,qg=kh?0:ag,rg=kh?$f:1,sg=T(kg,lg,c?void 0:sg.domain(),function(){return yg.tickOffset()}),tg=U(mg,ng,c?void 0:tg.domain()),ug=U(mg,ng,c?void 0:ug.domain()),vg=T(kg,lg,uj,function(a){return a%1?0:Bg.tickOffset()}),wg=U(qg,rg,c?void 0:wg.domain()),xg=U(qg,rg,c?void 0:xg.domain()),a=$(),b=vh?vh:c?void 0:yg.tickValues(),yg=X(sg,Xi,a,b),Bg=X(vg,$i,a,b),zg=Y(tg,Yi,Jh,Lh),Ag=Y(ug,Zi,Sh,Uh),c||(ij.scale(vg),Of&&mj.scale(sg)),S()}function S(){gg=Gb(),hg=Hb(),ig=Hb(.98)}function T(a,b,d,e){var f=(Ji?Ef.time.scale():Ef.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Ki){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=Ef.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?ug:tg}function W(a){return"y2"===Z(a)?xg:wg}function X(a,b,c,d){var e=(Ki?Eb():Ef.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Ki?(e.tickCentered(ph),Ae(rh)&&(rh=!1)):e.tickOffset=function(){var a=Bc(Ff.data.targets),b=sg(a[1])-sg(a[0]),c=b?b:kh?_f:Zf;return c/zc()/2},Ki&&e.categories(oh),e}function Y(a,b,c,d){return Ef.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Jg?Jg[a]:"y"}function $(){var a=Ji?Ui:Ki?Tc:function(a){return 0>a?a.toFixed(0):a};return qh&&("function"==typeof qh?a=qh:Ji&&(a=function(a){return a?Ti(qh)(a):""})),a}function _(a){var b;return"y"===a?b=Hh:"y2"===a?b=Qh:"x"===a&&(b=Ch),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Hh=b:"y2"===a?Qh=b:"x"===a&&(Ch=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",kh?"inner-top":"inner-right")}function hb(){return fb("y",kh?"inner-right":"inner-top")}function ib(){return fb("y2",kh?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Zf/2:Zf:b.isBottom?-_f:b.isMiddle?-_f/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!kh,gb())}function rb(){return nb(kh,hb())}function sb(){return nb(kh,ib())}function tb(){return ob(!kh,gb())}function ub(){return ob(kh,hb())}function vb(){return ob(kh,ib())}function wb(){var a=gb();return kh?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":Ah?Ah-10:"3em"}function xb(){var a=hb();return kh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return kh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!kh,gb())}function Ab(){return pb(kh,hb())}function Bb(){return pb(kh,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return Ef.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(a){var b=pj.select("."+f.axisX+" ."+f.axisXLabel),c=pj.select("."+f.axisY+" ."+f.axisYLabel),d=pj.select("."+f.axisY2+" ."+f.axisY2Label);(a?b.transition():b).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),(a?c.transition():c).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),(a?d.transition():d).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 Ef.min(Object.keys(i).map(function(a){return Ef.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(Ig.length>0)for(g=Sc(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 Ef.max(Object.keys(i).map(function(a){return Ef.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Oh:Fh,n="y2"===c?Nh:Eh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Ph:Gh,r=xd()&&kh;return 0===l.length?"y2"===c?ug.domain():tg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=yd(o,p),j=ac(tg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Kh&&(f=b(Kh.top)?Kh.top:e,g=b(Kh.bottom)?Kh.bottom:e),"y2"===c&&Th&&(f=b(Th.top)?Th.top:e,g=b(Th.bottom)?Th.bottom:e),de(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return yh?Ji?we(yh):yh:Ef.min(a,function(a){return Ef.min(a.values,function(a){return a.x})})}function Zb(a){return xh?Ji?we(xh):xh:Ef.max(a,function(a){return Ef.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Ki?d=0:de(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof zh&&Be(zh)?(e=b(zh.left)?zh.left:d,f=b(zh.right)?zh.right:d):e=f="number"==typeof zh?zh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return c-d===0&&(c=Ji?new Date(.5*c.getTime()):-.5,d=Ji?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Ji?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Ji?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?tg:ug;return b="y"===a.axis||"y2"===a.axis?kh?_f:"start"in a?d(a.start):_f:kh?"end"in a?sg(Ji?we(a.end):a.end):_f:_f,c>b?0:b-c}function ic(a){return Cg&&a===Cg||Be(Dg)&&Ce(Dg,a)}function jc(a){return!ic(a)}function kc(a){return Cg?Cg:Be(Dg)?Dg[a]:null}function lc(a,b){var c,d=b&&Be(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=Ff.data.xs[b])}),c}function mc(a,b){return a in Ff.data.xs&&Ff.data.xs[a]&&Ff.data.xs[a][b]?Ff.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){Dg[b]=a[b]})}function oc(a){return 1===Ef.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=Gg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),Ff.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=Ji?a?a instanceof Date?a:we(a):we(mc(c,d)):Li&&!Ki?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Ff.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Cg?(d=Object.keys(Ff.data.xs),Ff.data.xs[c]=d.length>0?Ff.data.xs[d[0]]:void 0):Be(Dg)&&(Ff.data.xs[c]=lc(f,Ff.data.targets)):Ff.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Ff.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Fg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Li&&Ki&&0===c&&g&&(0===e&&(oh=[]),oh.push(g)),("undefined"==typeof a[b]||Ff.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Kg&&be(Cc(c).filter(function(a){return!(a in Lg)}),Kg),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&Ff.data.targets[0].values[a-1]?Ff.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(Ff.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Ji?new Date(i):i);j.push(e)}return Ji||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Vi=Vi.concat(a)}function Mc(a){Vi=Vi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Wi=Wi.concat(a)}function Oc(a){Wi=Wi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Jd(a,f))),(a[g].x||0===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=De(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Nd(a,b){return Ef.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Od(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 Pd(){return Ng&&"desc"===Ng.toLowerCase()}function Qd(){return Ng&&"asc"===Ng.toLowerCase()}function Rd(a){var b=Qd(),c=Pd();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 Ng&&a.sort(Ng),a}function Sd(a,c){var d,e,f,g,h,i,j,k=he(Ff.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&wi&&(sj.html(zi(a,$(),zd(k),Si)).style("display","block"),d=sj.property("offsetWidth"),e=sj.property("offsetHeight"),k?(g=Zf/2+c[0],i=_f/2+c[1]+20):(kh?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=sg(l[0].x)+20):(f=q(),g=f+t()+sg(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),sj.style("top",i+"px").style("left",g+"px"))}function Td(){sj.style("display","none")}function Ud(a){var c=a.filter(function(a){return a&&b(a.value)});wi&&(ee(Ff.data.targets)||he(Ff.data.targets)||pj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(kh?"y1":"x1",Fd).attr(kh?"y2":"x2",Fd))}function Vd(){pj.select("line."+f.xgridFocus).style("visibility","hidden")}function Wd(a){return a.x||0===a.x?sg(a.x):null}function Xd(a){return V(a.id)(a.value)}function Yd(){var a,b,d={},e=0;return Ic(Fc(ke)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ae(a,b){return"number"==typeof gi?gi:b?2*a.tickOffset()*hi/b:0}function be(a,b){Dc(a).forEach(function(a){wj[a]=b===Lg[a],Lg[a]=b})}function ce(a,b){var c=!1;return a.forEach(function(a){Lg[a.id]===b&&(c=!0),a.id in Lg||"line"!==b||(c=!0)}),c}function de(a){return ce(a,"bar")}function ee(a){return ce(a,"scatter")}function fe(a){return ce(a,"pie")}function ge(a){return ce(a,"donut")}function he(a){return fe(a)||ge(a)}function ie(a){var b="string"==typeof a?a:a.id;return!(b in Lg)||"line"===Lg[b]||"spline"===Lg[b]||"area"===Lg[b]||"area-spline"===Lg[b]}function je(a){var b="string"==typeof a?a:a.id;return"spline"===Lg[b]||"area-spline"===Lg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"bar"===Lg[b]}function le(a){var b="string"==typeof a?a:a.id;return"scatter"===Lg[b]}function me(a){var b="string"==typeof a?a:a.id;return"pie"===Lg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"donut"===Lg[b]}function oe(a){return me(a)||ne(a)}function pe(a){return ie(a)?[a]:[]}function qe(a){return oe(a.data)?[a]:[]}function re(a){return ke(a)?a.values:[]}function se(a){return ie(a)||le(a)?a.values:[]}function te(a){return ke(a)||ie(a)?a.values:[]}function ue(a){return ne(a)&&qi||me(a)&&ki}function ve(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function we(b){var c;try{c=Eg?Ef.time.format(Eg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Eg)}return c}function xe(a,b){var c=Ef.mouse(a),d=Ef.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ce(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function De(a,b){var c="y"===Z(a.id)?tg:ug,d=kh?1:0,e=kh?0:1;return Math.pow(sg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ee(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Fe(a,b,c){Zg(b,a.node()),pj.select("."+f.selectedCircles+od(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",kh?Xd:Wd).attr("cy",kh?Wd:Xd).attr("stroke",function(){return Si(b)}).attr("r",1.4*Qe(b)).transition().duration(100).attr("r",Qe)}function Ge(a,b,c){$g(b,a.node()),pj.select("."+f.selectedCircles+od(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function He(a,b,c,d){a?Fe(b,c,d):Ge(b,c,d)}function Ie(a,b){Zg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ef.rgb(Si(b)).brighter(.75)})}function Je(a,b){$g(b,a.node()),a.transition().duration(100).style("fill",function(){return Si(b)})}function Ke(a,b,c,d){a?Ie(b,c,d):Je(b,c,d)}function Le(a,b,c,d){Ke(a,b,c.data,d)}function Me(a){return"circle"===a.nodeName?He:Ef.select(a).classed(f.bar)?Ke:Le}function Ne(a){return a.filter(function(a){return b(a.value)})}function Oe(a){return _h?"function"==typeof ai?ai(a):ai:0}function Pe(a){return ci?di?di:1.75*Oe(a):Oe(a)}function Qe(a){return ei?ei:4*Oe(a)}function Re(a,c){return(c?pj.selectAll("."+f.circles+od(c)):pj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Se(a,b){Re(a,b).classed(f.EXPANDED,!0).attr("r",Pe)}function Te(a){Re(a).filter(function(){return Ef.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oe)}function Ue(a){return pj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ve(a){Ue(a).classed(f.EXPANDED,!0)}function We(a){Ue(a).classed(f.EXPANDED,!1)}function Xe(a,b){var c=_e(a,b);return function(a,b){var d=c(a,b),e=kh?1:0,f=kh?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 Ye(a,b){var c=_e(a,!1),d=b?Ze:$e;return function(a,b){return d(c(a,b),a,this)}}function Ze(a,b){var c;return kh?(c=ke(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function $e(a,b,c){var d=c.getBoundingClientRect();return kh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ke(b)?-3:-6)}function _e(a,b){var c=a.__max__+1,d=ae(yg,c),e=Zd(d,c,a,!!b),f=$d(!!b),g=_d(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return kh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function af(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 bf(b){var c,d,e;if(tj=Ef.select(Hf),tj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(tj.html("").classed("c3",!0),Ff.data.xs={},Ff.data.targets=vc(b),Rg&&Lc(Rg===!0?Cc(Ff.data.targets):Rg),n(),R(),sg.domain(Ef.extent(_b(Ff.data.targets))),tg.domain(Xb(Ff.data.targets,"y")),ug.domain(Xb(Ff.data.targets,"y2")),vg.domain(sg.domain()),wg.domain(tg.domain()),xg.domain(ug.domain()),uj=sg.domain(),ij.scale(vg),Of&&mj.scale(sg),nj=tj.append("svg").on("mouseenter",Rf).on("mouseleave",Sf),oj=nj.append("defs"),oj.append("clipPath").attr("id",Di).append("rect"),oj.append("clipPath").attr("id",Ei).append("rect"),oj.append("clipPath").attr("id",Fi).append("rect"),nf(),pj=nj.append("g").attr("transform",_i.main),qj=nj.append("g").attr("transform",_i.context),rj=nj.append("g").attr("transform",_i.legend),bh||qj.style("visibility","hidden"),eh||(rj.style("visibility","hidden"),Wi=Cc(Ff.data.targets)),sj=Ef.select(Hf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),zf(Cc(Ff.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=pj.append("g").attr("clip-path",Gi).attr("class",f.grid),Vh&&d.append("g").attr("class",f.xgrids),Be(Xh)&&d.append("g").attr("class",f.xgridLines),bi&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Yh&&d.append("g").attr("class",f.ygrids),Be(Zh)&&d.append("g").attr("class",f.ygridLines),lh&&pj.append("g").attr("class",f.axisX).attr("clip-path",Hi).attr("transform",_i.x).append("text").attr("class",f.axisXLabel).attr("transform",kh?"rotate(-90)":"").style("text-anchor",zb),Dh&&pj.append("g").attr("class",f.axisY).attr("clip-path",Ii).attr("transform",_i.y).append("text").attr("class",f.axisYLabel).attr("transform",kh?"":"rotate(-90)").style("text-anchor",Ab),Mh&&pj.append("g").attr("class",f.axisY2).attr("transform",_i.y2).append("text").attr("class",f.axisY2Label).attr("transform",kh?"":"rotate(-90)").style("text-anchor",Bb),pj.append("g").attr("clip-path",Gi).attr("class",f.regions),pj.append("g").attr("clip-path",Gi).attr("class",f.chart),c=pj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Of?kh?"ns-resize":"ew-resize":null),pj.select("."+f.chart).append("g").attr("class",f.chartBars),pj.select("."+f.chart).append("g").attr("class",f.chartLines),pj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",_i.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),pj.select("."+f.chart).append("g").attr("class",f.chartTexts),Of&&pj.insert("rect",Qf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Zf).attr("height",_f).style("opacity",0).style("cursor",kh?"ns-resize":"ew-resize").call(mj).on("dblclick.zoom",null),Bh&&ij.extent("function"!=typeof Bh?Bh:Bh(_b())),qj.append("g").attr("clip-path",Gi).attr("class",f.chart),qj.select("."+f.chart).append("g").attr("class",f.chartBars),qj.select("."+f.chart).append("g").attr("class",f.chartLines),qj.append("g").attr("clip-path",Gi).attr("class",f.brush).call(ij).selectAll("rect").attr(kh?"width":"height",kh?$f:ag),qj.append("g").attr("class",f.axisX).attr("transform",_i.subx).attr("clip-path",kh?"":Hi),pf(Ff.data.targets),kh?pj.select("."+f.axisX).style("opacity",0).call(yg):(pj.select("."+f.axisY).style("opacity",0).call(zg),pj.select("."+f.axisY2).style("opacity",0).call(Ag)),n(),R(),nf(),m(!1),jf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Ai){if(Ji&&"string"==typeof Bi){for(Bi=we(Bi),e=0;e0){d=[];for(var g in Gg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Od(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ke,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 gf(a){he(Ff.data.targets)||Sg&&(Mi=a,pj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ni=!0,_g())}function hf(){he(Ff.data.targets)||Sg&&(pj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),pj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ni=!1,ah())}function jf(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z=Yd(),$=he(Ff.data.targets),_=Ic(Ff.data.targets);if(a=d(a)?a:{},E=d(a.withY)?a.withY:!0,F=d(a.withSubchart)?a.withSubchart:!0,G=d(a.withTransition)?a.withTransition:!0,J=d(a.withTransform)?a.withTransform:!1,K=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,M=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,N=d(a.withLegend)?a.withLegend:!1,H=d(a.withTransitionForExit)?a.withTransitionForExit:G,I=d(a.withTransitionForAxis)?a.withTransitionForAxis:G,T=G?Vf:0,U=H?T:0,V=I?T:0,c=pj.select("."+f.axisX).style("opacity",$?0:1),g=pj.select("."+f.axisY).style("opacity",$?0:1),h=pj.select("."+f.axisY2).style("opacity",$?0:1),e=qj.select("."+f.axisX).style("opacity",$?0:1),S={axisX:c.transition().duration(V),axisY:g.transition().duration(V),axisY2:h.transition().duration(V),axisSubX:e.transition().duration(V)},N&&eh&&zf(Cc(Ff.data.targets),a,S),Ki&&(0!==_.length&&M&&K||sg.domain([0,c.selectAll(".tick").size()])),_.length&&(M&&(sg.domain(Ef.extent(_b(_))),uj=sg.domain(),Of&&mj.scale(sg).updateScaleExtent(),vg.domain(sg.domain()),ij.scale(vg)),K&&(sg.domain(ij.empty()?uj:ij.extent()),Of&&mj.scale(sg).updateScaleExtent()),vh||!uh&&!th||(W=Kc(Jc(_),th),yg.tickValues(W),Bg.tickValues(W))),tg.domain(Xb(_,"y")),ug.domain(Xb(_,"y2")),S.axisX.call(yg),S.axisY.call(zg),S.axisY2.call(Ag),S.axisSubX.call(Bg),Db(G),K&&_.length)if(rh&&W){for(X=1;X=0&&Ef.select(this).style("display",b%Y?"none":"block")})}else nj.selectAll("."+f.axisX+" .tick text").style("display","block");if(!kh&&wh&&eb(c,S.axisX,wh),O=Xe(Z),Q=Ye(Z,!0),R=Ye(Z,!1),wg.domain(tg.domain()),xg.domain(ug.domain()),sj.style("display","none"),o(),pj.select("line."+f.xgridFocus).style("visibility","hidden"),Vh){if("year"===Wh){j=[];for(var ab=_b(),bb=ab[0].getFullYear(),cb=ab[1].getFullYear(),db=bb;cb>=db;db++)j.push(new Date(db+"-01-01 00:00:00"))}else j=sg.ticks(10);i=pj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",kh?0:function(a){return sg(a)-yg.tickOffset()}).attr("x2",kh?Zf:function(a){return sg(a)-yg.tickOffset()}).attr("y1",kh?function(a){return sg(a)-yg.tickOffset()}:Wf.top).attr("y2",kh?function(a){return sg(a)-yg.tickOffset()}:_f).style("opacity",function(){return+Ef.select(this).attr(kh?"y1":"x1")===(kh?_f:0)?0:1}),i.exit().remove()}Be(Xh)&&(k=pj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Xh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",kh?"":"rotate(-90)").attr("dx",kh?0:-Wf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",kh?0:Gd).attr("x2",kh?Zf:Gd).attr("y1",kh?Gd:Wf.top).attr("y2",kh?Gd:_f).style("opacity",1),k.select("text").transition().duration(T).attr("x",kh?Zf:0).attr("y",Gd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),E&&Yh&&(m=pj.select("."+f.ygrids).selectAll("."+f.ygrid).data(tg.ticks($h)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",kh?tg:0).attr("x2",kh?tg:Zf).attr("y1",kh?0:tg).attr("y2",kh?_f:tg),m.exit().remove()),E&&Be(Zh)&&(n=pj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Zh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",kh?"rotate(-90)":"").attr("dx",kh?0:-Wf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(T).attr("x1",kh?Hd:0).attr("x2",kh?Hd:Zf).attr("y1",kh?0:Hd).attr("y2",kh?_f:Hd).style("opacity",1),n.select("text").transition().duration(T).attr("x",kh?0:Zf).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(T).style("opacity",0).remove()),v=pj.select("."+f.regions).selectAll("rect."+f.region).data(vi),v.enter().append("rect").style("fill-opacity",0),v.attr("class",hd).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(T).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),v.exit().transition().duration(T).style("fill-opacity",0).remove(),t=pj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),t.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Si),t.style("opacity",td).transition().duration(T).attr("d",O).style("fill",Si).style("opacity",1),t.exit().transition().duration(U).style("opacity",0).remove(),q=pj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),q.enter().append("path").attr("class",Zc).style("stroke",Si),q.style("opacity",td).transition().duration(T).attr("d",jj).style("stroke",Si).style("opacity",1),q.exit().transition().duration(U).style("opacity",0).remove(),r=pj.selectAll("."+f.areas).selectAll("."+f.area).data(pe),r.enter().append("path").attr("class",fd).style("fill",Si).style("opacity",function(){return vj=+Ef.select(this).style("opacity"),0}),r.style("opacity",0).transition().duration(T).attr("d",kj).style("fill",Si).style("opacity",vj),r.exit().transition().duration(U).style("opacity",0).remove(),s=pj.selectAll("."+f.circles).selectAll("."+f.circle).data(se),s.enter().append("circle").attr("class",_c).attr("r",Oe).style("fill",Si),s.style("opacity",td).transition().duration(T).style("opacity",vd).style("fill",Si).attr("cx",kh?Xd:Wd).attr("cy",kh?Wd:Xd),s.exit().remove(),w=pj.selectAll("."+f.texts).selectAll("."+f.text).data(te),w.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return kh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",Si).style("fill-opacity",0),w.text(function(a){return Ed(a.id)(a.value,a.id)}).style("fill-opacity",ud).transition().duration(T).attr("x",Q).attr("y",R).style("fill",Si).style("fill-opacity",wd),w.exit().transition().duration(U).style("fill-opacity",0).remove(),u=pj.selectAll("."+f.arcs).selectAll("."+f.arc).data(qe),u.enter().append("path").attr("class",dd).style("fill",function(a){return Si(a.data)}).style("cursor",function(a){return Ug(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Qi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),vf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Sd(d,Ef.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Qi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),wf(),Td(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();ef(this,a,b),e(d,b)}),u.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Qi=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Fb(a);return c?(b=Ef.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("fill",function(a){return Si(a.data)}).style("opacity",1).call(Ee,function(){Qi=!1}),u.exit().transition().duration(U).style("opacity",0).remove(),pj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(T).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&oe(a.data)?1:0}),pj.select("."+f.chartArcsTitle).style("opacity",ge(Ff.data.targets)?1:0),bh&&(null!==Ef.event&&"zoom"===Ef.event.type&&ij.extent(sg.orgDomain()).update(),F&&(!kh&&wh&&eb(e,S.axisSubX,wh),ij.empty()||ij.extent(sg.orgDomain()).update(),P=Xe(Z,!0),y=qj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),y.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Si),y.style("opacity",td).transition().duration(T).attr("d",P).style("opacity",1),y.exit().transition().duration(T).style("opacity",0).remove(),x=qj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),x.enter().append("path").attr("class",Zc).style("stroke",Si),x.style("opacity",td).transition().duration(T).attr("d",lj).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove())),pj.selectAll("."+f.selectedCircles).filter(function(a){return ke(a)}).selectAll("circle").remove(),pj.selectAll("."+f.selectedCircle).transition().duration(T).attr("cx",kh?Xd:Wd).attr("cy",kh?Wd:Xd),z=pj.select("."+f.eventRects),Be(Dg)&&!oc(Dg)?(z.classed(f.eventRectsMultiple)||z.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),A=pj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),df(A.enter()),A.attr("x",0).attr("y",0).attr("width",Zf).attr("height",_f)):(z.classed(f.eventRectsSingle)||z.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Li&&!Ki?(D=function(a,b){var c=xc(b),d=yc(b),e=Ff.data.xs[a.id][b];return(sg(d?d:e+50)-sg(c?c:e-50))/2},C=function(a,b){var c=xc(b),d=Ff.data.xs[a.id][b];return(sg(d)+sg(c?c:d-50))/2}):(D=L(),C=function(a){return sg(a.x)-D/2}),B=Ac(Ff.data.targets),pj.select("."+f.eventRects).datum(B?B.values:[]),A=pj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),cf(A.enter()),A.attr("class",id).attr("x",kh?0:C).attr("y",kh?C:0).attr("width",kh?Zf:D).attr("height",kh?D:_f),A.exit().remove()),Cc(Ff.data.targets).forEach(function(a){wj[a]=!0})}function kf(){jf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function lf(){return"mousemove"===Ef.event.sourceEvent.type&&mj.altDomain?(sg.domain(mj.altDomain),void mj.scale(sg).updateScaleExtent()):(Ki&&sg.orgDomain()[0]===uj[0]&&sg.domain([uj[0]-1e-10,sg.orgDomain()[1]]),jf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Ef.event.sourceEvent.type&&(Oi=!0)))}function mf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function nf(){nj.attr("width",bg).attr("height",cg),nj.select("#"+Di).select("rect").attr("width",Zf).attr("height",_f),nj.select("#"+Ei).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),nj.select("#"+Fi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),nj.select("."+f.zoomRect).attr("width",Zf).attr("height",_f),tj.style("max-height",cg+"px")}function of(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),nf(),m(a.withTransition),jf(a)}function pf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=pj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",kd),j=i.enter().append("g").attr("class",kd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc),e=pj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",md),d=e.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",cd).style("cursor",function(a){return Ug(a)?"pointer":null}),c=pj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",ld),b=c.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",$c),b.append("g").attr("class",gd),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",ad).style("cursor",function(a){return Ug(a)?"pointer":null}),a.forEach(function(a){pj.selectAll("."+f.selectedCircles+od(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=pj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(jg(a)).attr("class",nd),g=h.enter().append("g").attr("class",nd),g.append("g").attr("class",ed),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),bh&&(n=qj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",md),m=n.enter().append("g").style("opacity",0).attr("class",md),m.append("g").attr("class",cd),l=qj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",ld),k=l.enter().append("g").style("opacity",0).attr("class",ld),k.append("g").attr("class",$c)),nj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Vf).style("opacity",1)}function qf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?be(a.id,b.types[a.id]):be(a.id,b.type)}),Ff.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=aj?j:i,l=aj?Q():P();return d&&(w=0,C=0,t=0,u=0),eh&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=aj?u:t,void(jh?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=rj.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,aj?(g=function(a){return t*B[a]},j=function(a){return A[B[a]]+x[a]}):(g=function(a){return A[B[a]]+x[a]},j=function(a){return u*B[a]}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=rj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof gh?gh(a):Ff.toggle(a)}).on("mouseover",function(a){Ef.select(this).classed(f.legendItemFocused,!0),Qi||Ff.focus(a),"function"==typeof hh&&hh(a)}).on("mouseout",function(a){Ef.select(this).classed(f.legendItemFocused,!1),Qi||Ff.revert(),"function"==typeof ih&&ih(a)}),o.append("text").text(function(a){return d(Gg[a])?Gg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",aj?h:-200).attr("y",aj?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",aj?i:-200).attr("y",aj?-200:l),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",Si).attr("x",aj?h:-200).attr("y",aj?-200:j).attr("width",10).attr("height",10),rj.selectAll("text").data(a).text(function(a){return d(Gg[a])?Gg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),rj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}).attr("x",i).attr("y",l),rj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).style("fill",Si).attr("x",g).attr("y",j),rj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=Ef.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?tf(b):uf(b):ej}),N(t),O(u),M(C),n(),R(),nf(),m(q,c)}function Af(a){return Ec(Ff.data.targets,a.id)}function Bf(a){return"data"in a&&Ec(Ff.data.targets,a.data.id)}function Cf(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 Df(a,b,c){var d=!he(Ff.data.targets);Qi=!1,be(a,b),of(c||{withTransitionForAxis:d})}var Ef=a.d3?a.d3:a.require?a.require("d3"):void 0,Ff={data:{},axis:{},legend:{}},Gf={},Hf=h(["bindto"],"#chart"),If=h(["size","width"]),Jf=h(["size","height"]),Kf=h(["padding","left"],50),Lf=h(["padding","right"],0),Mf=h(["padding","top"],0),Nf=h(["padding","bottom"],0),Of=h(["zoom","enabled"],!1),Pf=h(["zoom","extent"]),Qf=h(["zoom","privileged"],!1),Rf=h(["onenter"],function(){}),Sf=h(["onleave"],function(){}),Tf=h(["onresize"],function(){}),Uf=h(["onresized"],function(){}),Vf=h(["transition","duration"],350);g("data","data is required in config");var Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg=h(["data","x"]),Dg=h(["data","xs"],{}),Eg=h(["data","x_format"]),Fg=h(["data","id_converter"],function(a){return a}),Gg=h(["data","names"],{}),Hg=h(["data","classes"],{}),Ig=h(["data","groups"],[]),Jg=h(["data","axes"],{}),Kg=h(["data","type"]),Lg=h(["data","types"],{}),Mg=h(["data","labels"],{}),Ng=h(["data","order"]),Og=h(["data","regions"],{}),Pg=h(["data","color"]),Qg=h(["data","colors"],{}),Rg=h(["data","hide"],!1),Sg=h(["data","selection","enabled"],!1),Tg=h(["data","selection","grouped"],!1),Ug=h(["data","selection","isselectable"],function(){return!0}),Vg=h(["data","selection","multiple"],!0),Wg=h(["data","onclick"],function(){}),Xg=h(["data","onenter"],function(){}),Yg=h(["data","onleave"],function(){}),Zg=h(["data","onselected"],function(){}),$g=h(["data","onunselected"],function(){}),_g=h(["data","ondragstart"],function(){}),ah=h(["data","ondragend"],function(){}),bh=h(["subchart","show"],!1),ch=h(["subchart","size","height"],60),dh=h(["color","pattern"],[]),eh=h(["legend","show"],!0),fh=h(["legend","position"],"bottom"),gh=h(["legend","item","onclick"]),hh=h(["legend","item","onmouseover"]),ih=h(["legend","item","onmouseout"]),jh=h(["legend","equally"],!1),kh=h(["axis","rotated"],!1),lh=h(["axis","x","show"],!0),mh=h(["axis","x","type"],"indexed"),nh=h(["axis","x","localtime"],!0),oh=h(["axis","x","categories"],[]),ph=h(["axis","x","tick","centered"],!1),qh=h(["axis","x","tick","format"]),rh=h(["axis","x","tick","culling"],{}),sh=h(["axis","x","tick","culling","max"],10),th=h(["axis","x","tick","count"]),uh=h(["axis","x","tick","fit"],!0),vh=h(["axis","x","tick","values"],null),wh=h(["axis","x","tick","rotate"]),xh=h(["axis","x","max"],null),yh=h(["axis","x","min"],null),zh=h(["axis","x","padding"],{}),Ah=h(["axis","x","height"]),Bh=h(["axis","x","default"]),Ch=h(["axis","x","label"],{}),Dh=h(["axis","y","show"],!0),Eh=h(["axis","y","max"]),Fh=h(["axis","y","min"]),Gh=h(["axis","y","center"]),Hh=h(["axis","y","label"],{}),Ih=h(["axis","y","inner"],!1),Jh=h(["axis","y","tick","format"]),Kh=h(["axis","y","padding"]),Lh=h(["axis","y","ticks"],10),Mh=h(["axis","y2","show"],!1),Nh=h(["axis","y2","max"]),Oh=h(["axis","y2","min"]),Ph=h(["axis","y2","center"]),Qh=h(["axis","y2","label"],{}),Rh=h(["axis","y2","inner"],!1),Sh=h(["axis","y2","tick","format"]),Th=h(["axis","y2","padding"]),Uh=h(["axis","y2","ticks"],10),Vh=h(["grid","x","show"],!1),Wh=h(["grid","x","type"],"tick"),Xh=h(["grid","x","lines"],[]),Yh=h(["grid","y","show"],!1),Zh=h(["grid","y","lines"],[]),$h=h(["grid","y","ticks"],10),_h=h(["point","show"],!0),ai=h(["point","r"],2.5),bi=h(["point","focus","line","enabled"],!0),ci=h(["point","focus","expand","enabled"],!0),di=h(["point","focus","expand","r"]),ei=h(["point","focus","select","r"]),fi=h(["line","connect_null"],!1),gi=h(["bar","width"]),hi=h(["bar","width","ratio"],.6),ii=h(["pie","label","show"],!0),ji=h(["pie","label","format"]),ki=h(["pie","expand"],!0),li=h(["pie","onclick"],function(){}),mi=h(["pie","onmouseover"],function(){}),ni=h(["pie","onmouseout"],function(){}),oi=h(["donut","label","show"],!0),pi=h(["donut","label","format"]),qi=h(["donut","expand"],!0),ri=h(["donut","title"],""),si=h(["donut","onclick"],function(){}),ti=h(["donut","onmouseover"],function(){}),ui=h(["donut","onmouseout"],function(){}),vi=h(["regions"],[]),wi=h(["tooltip","show"],!0),xi=h(["tooltip","format","title"]),yi=h(["tooltip","format","value"]),zi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=xi?xi:b,l=yi?yi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id,a[g].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Ai=h(["tooltip","init","show"],!1),Bi=h(["tooltip","init","x"],0),Ci=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Di=("string"==typeof Hf?Hf.replace("#",""):Hf.id)+"-clip",Ei=Di+"-xaxis",Fi=Di+"-yaxis",Gi=i(Di),Hi=i(Ei),Ii=i(Fi),Ji="timeseries"===mh,Ki="categorized"===mh,Li=!Ji&&(Cg||Be(Dg)),Mi=null,Ni=!1,Oi=!1,Pi=!1,Qi=!1,Ri=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Si=ve(Qg,Be(dh)?dh:Ri,Pg),Ti=nh?Ef.time.format:Ef.time.format.utc,Ui=function(){var a=[[Ti("%Y/%-m/%-d"),function(){return!0}],[Ti("%-m/%-d"),function(a){return a.getMonth()}],[Ti("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ti("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ti("%I %p"),function(a){return a.getHours()}],[Ti("%I:%M"),function(a){return a.getMinutes()}],[Ti(":%S"),function(a){return a.getSeconds()}],[Ti(".%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)}}(),Vi=[],Wi=[],Xi=kh?"left":"bottom",Yi=kh?Ih?"top":"bottom":Ih?"right":"left",Zi=kh?Rh?"bottom":"top":Rh?"left":"right",$i=kh?"left":"bottom",_i={main:function(){return"translate("+Wf.left+","+Wf.top+")"},context:function(){return"translate("+Xf.left+","+Xf.top+")"},legend:function(){return"translate("+Yf.left+","+Yf.top+")"},x:function(){return"translate(0,"+(kh?0:_f)+")"},y:function(){return"translate(0,"+(kh?_f:0)+")"},y2:function(){return"translate("+(kh?0:Zf)+","+(kh?1:0)+")"},subx:function(){return"translate(0,"+(kh?0:ag)+")"},arc:function(){return"translate("+Zf/2+","+_f/2+")"}},aj="right"===fh,bj=0,cj=0,dj=0,ej=.15,fj=30,gj=kh&&!lh?0:30,hj=5;jg=Ef.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var ij,jj=function(){var a=Ef.svg.line().x(kh?function(a){return V(a.id)(a.value)}:Fd).y(kh?Fd:function(a){return V(a.id)(a.value)});return fi||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=fi?Ne(b.values):b.values;return ie(b)?(a.interpolate(je(b)?"cardinal":"linear"),Og[b.id]?af(e,sg,V(b.id),Og[b.id]):a(e)):(c=e[0]?sg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,kh?"M "+d+" "+c:"M "+c+" "+d)}}(),kj=function(){var a;return a=kh?Ef.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Fd):Ef.svg.area().x(Fd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ne(b.values);return ce([b],"area")||ce([b],"area-spline")?(a.interpolate(je(b)?"cardinal":"linear"),a(e)):(c=e[0]?sg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,kh?"M "+d+" "+c:"M "+c+" "+d)}}(),lj=function(){var a=Ef.svg.line().x(kh?function(a){return W(a.id)(a.value)}:Id).y(kh?Id:function(a){return W(a.id)(a.value)});return function(b){var c=Ne(b.values);return ie(b)?a(c):"M "+vg(c[0].x)+" "+W(b.id)(c[0].value)}}(),mj=function(){};ij=Ef.svg.brush().on("brush",kf),ij.update=function(){return qj&&qj.select("."+f.brush).call(this),this},ij.scale=function(a){return kh?this.y(a):this.x(a)},Of&&(mj=Ef.behavior.zoom().on("zoomstart",function(){mj.altDomain=Ef.event.sourceEvent.altKey?sg.orgDomain():null}).on("zoom",Of?lf:null),mj.scale=function(a){return kh?this.y(a):this.x(a)},mj.orgScaleExtent=function(){var a=Pf?Pf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},mj.updateScaleExtent=function(){var a=ac(sg.orgDomain())/ac(uj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var nj,oj,pj,qj,rj,sj,tj,uj,vj,wj={};if(Ff.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=nj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);Ff.revert(),Ff.defocus(),b(d.classed(f.focused,!0)),b(e),he(Ff.data.targets)&&Nb(a,!0),vf(a,!0)},Ff.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=nj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);Ff.revert(),b(d.classed(f.focused,!1)),b(e),he(Ff.data.targets)&&Ob(a),vf(a,!1)},Ff.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=nj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);b(d.classed(f.focused,!1)),b(e),he(Ff.data.targets)&&Ob(a),wf()},Ff.show=function(a,b){a=Dc(a),b=b||{},Mc(a),nj.selectAll(qd(a)).transition().style("opacity",1),b.withLegend&&xf(a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ff.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),nj.selectAll(qd(a)).transition().style("opacity",0),b.withLegend&&yf(a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ff.toggle=function(a){Gc(a)?Ff.hide(a):Ff.show(a)},Ff.unzoom=function(){ij.clear().update(),jf({withUpdateXDomain:!0})},Ff.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Hg[b]=a.classes[b]}),"categories"in a&&Ki&&(oh=a.categories,yg.categories(oh)),"cacheIds"in a&&bc(a.cacheIds)?void qf(dc(a.cacheIds),a.done):void("unload"in a?sf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){rf(a)}):rf(a))},Ff.unload=function(a,b){sf(Dc(a),function(){jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Ff.selected=function(a){return Ef.merge(pj.selectAll("."+f.shapes+od(a)).selectAll("."+f.shape).filter(function(){return Ef.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Ff.select=function(a,b,c){Sg&&pj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=Ef.select(this),i=e.data?e.data.id:e.id,j=Me(this),k=Tg||!a||a.indexOf(i)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Ug(e)&&!m&&j(!0,h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(!1,h.classed(f.SELECTED,!1),e,g)})},Ff.unselect=function(a,b){Sg&&pj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=Ef.select(this),g=c.data?c.data.id:c.id,h=Me(this),i=Tg||!a||a.indexOf(g)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(f.SELECTED); +}sj.html(zi(Ff.data.targets.map(function(a){return pc(a.values[Bi])}),$(),zd(he(Ff.data.targets)),Si)),sj.style("top",Ci.top).style("left",Ci.left).style("display","block")}null==a.onresize&&(a.onresize=mf()),a.onresize.add&&(a.onresize.add(Tf),a.onresize.add(function(){of({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})}),a.onresize.add(Uf))}function cf(a){a.append("rect").attr("class",id).style("cursor",Sg&&Tg?"pointer":null).on("mouseover",function(a,b){if(!Ni&&!he(Ff.data.targets)){var c,d,e=Ff.data.targets.map(function(a){return pc(a.values[b])});if(Object.keys(Gg).length>0){d=[];for(var g in Gg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Od(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ke,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 gf(a){he(Ff.data.targets)||Sg&&(Mi=a,pj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ni=!0,_g())}function hf(){he(Ff.data.targets)||Sg&&(pj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),pj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ni=!1,ah())}function jf(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z=Yd(),$=he(Ff.data.targets),_=Ic(Ff.data.targets);if(a=d(a)?a:{},E=d(a.withY)?a.withY:!0,F=d(a.withSubchart)?a.withSubchart:!0,G=d(a.withTransition)?a.withTransition:!0,J=d(a.withTransform)?a.withTransform:!1,K=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,M=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,N=d(a.withLegend)?a.withLegend:!1,H=d(a.withTransitionForExit)?a.withTransitionForExit:G,I=d(a.withTransitionForAxis)?a.withTransitionForAxis:G,T=G?Vf:0,U=H?T:0,V=I?T:0,c=pj.select("."+f.axisX).style("opacity",$?0:1),g=pj.select("."+f.axisY).style("opacity",$?0:1),h=pj.select("."+f.axisY2).style("opacity",$?0:1),e=qj.select("."+f.axisX).style("opacity",$?0:1),S={axisX:c.transition().duration(V),axisY:g.transition().duration(V),axisY2:h.transition().duration(V),axisSubX:e.transition().duration(V)},N&&eh&&zf(Cc(Ff.data.targets),a,S),Ki&&(0!==_.length&&M&&K||sg.domain([0,c.selectAll(".tick").size()])),_.length&&(M&&(sg.domain(Ef.extent(_b(_))),uj=sg.domain(),Of&&mj.scale(sg).updateScaleExtent(),vg.domain(sg.domain()),ij.scale(vg)),K&&(sg.domain(ij.empty()?uj:ij.extent()),Of&&mj.scale(sg).updateScaleExtent()),vh||!uh&&!th||(W=Kc(Jc(_),th),yg.tickValues(W),Bg.tickValues(W))),tg.domain(Xb(_,"y")),ug.domain(Xb(_,"y2")),S.axisX.call(yg),S.axisY.call(zg),S.axisY2.call(Ag),S.axisSubX.call(Bg),Db(G),K&&_.length)if(rh&&W){for(X=1;X=0&&Ef.select(this).style("display",b%Y?"none":"block")})}else nj.selectAll("."+f.axisX+" .tick text").style("display","block");if(!kh&&wh&&eb(c,S.axisX,wh),O=Xe(Z),Q=Ye(Z,!0),R=Ye(Z,!1),wg.domain(tg.domain()),xg.domain(ug.domain()),sj.style("display","none"),o(),pj.select("line."+f.xgridFocus).style("visibility","hidden"),Vh){if("year"===Wh){j=[];for(var ab=_b(),bb=ab[0].getFullYear(),cb=ab[1].getFullYear(),db=bb;cb>=db;db++)j.push(new Date(db+"-01-01 00:00:00"))}else j=sg.ticks(10);i=pj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",kh?0:function(a){return sg(a)-yg.tickOffset()}).attr("x2",kh?Zf:function(a){return sg(a)-yg.tickOffset()}).attr("y1",kh?function(a){return sg(a)-yg.tickOffset()}:Wf.top).attr("y2",kh?function(a){return sg(a)-yg.tickOffset()}:_f).style("opacity",function(){return+Ef.select(this).attr(kh?"y1":"x1")===(kh?_f:0)?0:1}),i.exit().remove()}Be(Xh)&&(k=pj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Xh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",kh?"":"rotate(-90)").attr("dx",kh?0:-Wf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",kh?0:Gd).attr("x2",kh?Zf:Gd).attr("y1",kh?Gd:Wf.top).attr("y2",kh?Gd:_f).style("opacity",1),k.select("text").transition().duration(T).attr("x",kh?Zf:0).attr("y",Gd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),E&&Yh&&(m=pj.select("."+f.ygrids).selectAll("."+f.ygrid).data(tg.ticks($h)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",kh?tg:0).attr("x2",kh?tg:Zf).attr("y1",kh?0:tg).attr("y2",kh?_f:tg),m.exit().remove()),E&&Be(Zh)&&(n=pj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Zh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",kh?"rotate(-90)":"").attr("dx",kh?0:-Wf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(T).attr("x1",kh?Hd:0).attr("x2",kh?Hd:Zf).attr("y1",kh?0:Hd).attr("y2",kh?_f:Hd).style("opacity",1),n.select("text").transition().duration(T).attr("x",kh?0:Zf).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(T).style("opacity",0).remove()),v=pj.select("."+f.regions).selectAll("."+f.region).data(vi),v.enter().append("g").attr("class",hd).append("rect").style("fill-opacity",0),v.selectAll("rect").attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(T).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),v.exit().transition().duration(T).style("fill-opacity",0).remove(),t=pj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),t.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Si),t.style("opacity",td).transition().duration(T).attr("d",O).style("fill",Si).style("opacity",1),t.exit().transition().duration(U).style("opacity",0).remove(),q=pj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),q.enter().append("path").attr("class",Zc).style("stroke",Si),q.style("opacity",td).transition().duration(T).attr("d",jj).style("stroke",Si).style("opacity",1),q.exit().transition().duration(U).style("opacity",0).remove(),r=pj.selectAll("."+f.areas).selectAll("."+f.area).data(pe),r.enter().append("path").attr("class",fd).style("fill",Si).style("opacity",function(){return vj=+Ef.select(this).style("opacity"),0}),r.style("opacity",0).transition().duration(T).attr("d",kj).style("fill",Si).style("opacity",vj),r.exit().transition().duration(U).style("opacity",0).remove(),s=pj.selectAll("."+f.circles).selectAll("."+f.circle).data(se),s.enter().append("circle").attr("class",_c).attr("r",Oe).style("fill",Si),s.style("opacity",td).transition().duration(T).style("opacity",vd).style("fill",Si).attr("cx",kh?Xd:Wd).attr("cy",kh?Wd:Xd),s.exit().remove(),w=pj.selectAll("."+f.texts).selectAll("."+f.text).data(te),w.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return kh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",Si).style("fill-opacity",0),w.text(function(a){return Ed(a.id)(a.value,a.id)}).style("fill-opacity",ud).transition().duration(T).attr("x",Q).attr("y",R).style("fill",Si).style("fill-opacity",wd),w.exit().transition().duration(U).style("fill-opacity",0).remove(),u=pj.selectAll("."+f.arcs).selectAll("."+f.arc).data(qe),u.enter().append("path").attr("class",dd).style("fill",function(a){return Si(a.data)}).style("cursor",function(a){return Ug(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Qi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),vf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Sd(d,Ef.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Qi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),wf(),Td(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();ef(this,a,b),e(d,b)}),u.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Qi=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Fb(a);return c?(b=Ef.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("fill",function(a){return Si(a.data)}).style("opacity",1).call(Ee,function(){Qi=!1}),u.exit().transition().duration(U).style("opacity",0).remove(),pj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(T).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&oe(a.data)?1:0}),pj.select("."+f.chartArcsTitle).style("opacity",ge(Ff.data.targets)?1:0),bh&&(null!==Ef.event&&"zoom"===Ef.event.type&&ij.extent(sg.orgDomain()).update(),F&&(!kh&&wh&&eb(e,S.axisSubX,wh),ij.empty()||ij.extent(sg.orgDomain()).update(),P=Xe(Z,!0),y=qj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),y.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Si),y.style("opacity",td).transition().duration(T).attr("d",P).style("opacity",1),y.exit().transition().duration(T).style("opacity",0).remove(),x=qj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),x.enter().append("path").attr("class",Zc).style("stroke",Si),x.style("opacity",td).transition().duration(T).attr("d",lj).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove())),pj.selectAll("."+f.selectedCircles).filter(function(a){return ke(a)}).selectAll("circle").remove(),pj.selectAll("."+f.selectedCircle).transition().duration(T).attr("cx",kh?Xd:Wd).attr("cy",kh?Wd:Xd),z=pj.select("."+f.eventRects),Be(Dg)&&!oc(Dg)?(z.classed(f.eventRectsMultiple)||z.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),A=pj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),df(A.enter()),A.attr("x",0).attr("y",0).attr("width",Zf).attr("height",_f)):(z.classed(f.eventRectsSingle)||z.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Li&&!Ki?(D=function(a,b){var c=xc(b),d=yc(b),e=Ff.data.xs[a.id][b];return(sg(d?d:e+50)-sg(c?c:e-50))/2},C=function(a,b){var c=xc(b),d=Ff.data.xs[a.id][b];return(sg(d)+sg(c?c:d-50))/2}):(D=L(),C=function(a){return sg(a.x)-D/2}),B=Ac(Ff.data.targets),pj.select("."+f.eventRects).datum(B?B.values:[]),A=pj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),cf(A.enter()),A.attr("class",id).attr("x",kh?0:C).attr("y",kh?C:0).attr("width",kh?Zf:D).attr("height",kh?D:_f),A.exit().remove()),Cc(Ff.data.targets).forEach(function(a){wj[a]=!0})}function kf(){jf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function lf(){return"mousemove"===Ef.event.sourceEvent.type&&mj.altDomain?(sg.domain(mj.altDomain),void mj.scale(sg).updateScaleExtent()):(Ki&&sg.orgDomain()[0]===uj[0]&&sg.domain([uj[0]-1e-10,sg.orgDomain()[1]]),jf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Ef.event.sourceEvent.type&&(Oi=!0)))}function mf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function nf(){nj.attr("width",bg).attr("height",cg),nj.select("#"+Di).select("rect").attr("width",Zf).attr("height",_f),nj.select("#"+Ei).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),nj.select("#"+Fi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),nj.select("."+f.zoomRect).attr("width",Zf).attr("height",_f),tj.style("max-height",cg+"px")}function of(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),nf(),m(a.withTransition),jf(a)}function pf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=pj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",kd),j=i.enter().append("g").attr("class",kd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc),e=pj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",md),d=e.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",cd).style("cursor",function(a){return Ug(a)?"pointer":null}),c=pj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",ld),b=c.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",$c),b.append("g").attr("class",gd),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",ad).style("cursor",function(a){return Ug(a)?"pointer":null}),a.forEach(function(a){pj.selectAll("."+f.selectedCircles+od(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=pj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(jg(a)).attr("class",nd),g=h.enter().append("g").attr("class",nd),g.append("g").attr("class",ed),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),bh&&(n=qj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",md),m=n.enter().append("g").style("opacity",0).attr("class",md),m.append("g").attr("class",cd),l=qj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",ld),k=l.enter().append("g").style("opacity",0).attr("class",ld),k.append("g").attr("class",$c)),nj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Vf).style("opacity",1)}function qf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?be(a.id,b.types[a.id]):be(a.id,b.type)}),Ff.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=aj?j:i,l=aj?Q():P();return d&&(w=0,C=0,t=0,u=0),eh&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=aj?u:t,void(jh?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=rj.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,aj?(g=function(a){return t*B[a]},j=function(a){return A[B[a]]+x[a]}):(g=function(a){return A[B[a]]+x[a]},j=function(a){return u*B[a]}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=rj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof gh?gh(a):Ff.toggle(a)}).on("mouseover",function(a){Ef.select(this).classed(f.legendItemFocused,!0),Qi||Ff.focus(a),"function"==typeof hh&&hh(a)}).on("mouseout",function(a){Ef.select(this).classed(f.legendItemFocused,!1),Qi||Ff.revert(),"function"==typeof ih&&ih(a)}),o.append("text").text(function(a){return d(Gg[a])?Gg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",aj?h:-200).attr("y",aj?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",aj?i:-200).attr("y",aj?-200:l),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",Si).attr("x",aj?h:-200).attr("y",aj?-200:j).attr("width",10).attr("height",10),rj.selectAll("text").data(a).text(function(a){return d(Gg[a])?Gg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),rj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}).attr("x",i).attr("y",l),rj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).style("fill",Si).attr("x",g).attr("y",j),rj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=Ef.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?tf(b):uf(b):ej}),N(t),O(u),M(C),n(),R(),nf(),m(q,c)}function Af(a){return Ec(Ff.data.targets,a.id)}function Bf(a){return"data"in a&&Ec(Ff.data.targets,a.data.id)}function Cf(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 Df(a,b,c){var d=!he(Ff.data.targets);Qi=!1,be(a,b),of(c||{withTransitionForAxis:d})}var Ef=a.d3?a.d3:a.require?a.require("d3"):void 0,Ff={data:{},axis:{},legend:{}},Gf={},Hf=h(["bindto"],"#chart"),If=h(["size","width"]),Jf=h(["size","height"]),Kf=h(["padding","left"],50),Lf=h(["padding","right"],0),Mf=h(["padding","top"],0),Nf=h(["padding","bottom"],0),Of=h(["zoom","enabled"],!1),Pf=h(["zoom","extent"]),Qf=h(["zoom","privileged"],!1),Rf=h(["onenter"],function(){}),Sf=h(["onleave"],function(){}),Tf=h(["onresize"],function(){}),Uf=h(["onresized"],function(){}),Vf=h(["transition","duration"],350);g("data","data is required in config");var Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg=h(["data","x"]),Dg=h(["data","xs"],{}),Eg=h(["data","x_format"]),Fg=h(["data","id_converter"],function(a){return a}),Gg=h(["data","names"],{}),Hg=h(["data","classes"],{}),Ig=h(["data","groups"],[]),Jg=h(["data","axes"],{}),Kg=h(["data","type"]),Lg=h(["data","types"],{}),Mg=h(["data","labels"],{}),Ng=h(["data","order"]),Og=h(["data","regions"],{}),Pg=h(["data","color"]),Qg=h(["data","colors"],{}),Rg=h(["data","hide"],!1),Sg=h(["data","selection","enabled"],!1),Tg=h(["data","selection","grouped"],!1),Ug=h(["data","selection","isselectable"],function(){return!0}),Vg=h(["data","selection","multiple"],!0),Wg=h(["data","onclick"],function(){}),Xg=h(["data","onenter"],function(){}),Yg=h(["data","onleave"],function(){}),Zg=h(["data","onselected"],function(){}),$g=h(["data","onunselected"],function(){}),_g=h(["data","ondragstart"],function(){}),ah=h(["data","ondragend"],function(){}),bh=h(["subchart","show"],!1),ch=h(["subchart","size","height"],60),dh=h(["color","pattern"],[]),eh=h(["legend","show"],!0),fh=h(["legend","position"],"bottom"),gh=h(["legend","item","onclick"]),hh=h(["legend","item","onmouseover"]),ih=h(["legend","item","onmouseout"]),jh=h(["legend","equally"],!1),kh=h(["axis","rotated"],!1),lh=h(["axis","x","show"],!0),mh=h(["axis","x","type"],"indexed"),nh=h(["axis","x","localtime"],!0),oh=h(["axis","x","categories"],[]),ph=h(["axis","x","tick","centered"],!1),qh=h(["axis","x","tick","format"]),rh=h(["axis","x","tick","culling"],{}),sh=h(["axis","x","tick","culling","max"],10),th=h(["axis","x","tick","count"]),uh=h(["axis","x","tick","fit"],!0),vh=h(["axis","x","tick","values"],null),wh=h(["axis","x","tick","rotate"]),xh=h(["axis","x","max"],null),yh=h(["axis","x","min"],null),zh=h(["axis","x","padding"],{}),Ah=h(["axis","x","height"]),Bh=h(["axis","x","default"]),Ch=h(["axis","x","label"],{}),Dh=h(["axis","y","show"],!0),Eh=h(["axis","y","max"]),Fh=h(["axis","y","min"]),Gh=h(["axis","y","center"]),Hh=h(["axis","y","label"],{}),Ih=h(["axis","y","inner"],!1),Jh=h(["axis","y","tick","format"]),Kh=h(["axis","y","padding"]),Lh=h(["axis","y","ticks"],10),Mh=h(["axis","y2","show"],!1),Nh=h(["axis","y2","max"]),Oh=h(["axis","y2","min"]),Ph=h(["axis","y2","center"]),Qh=h(["axis","y2","label"],{}),Rh=h(["axis","y2","inner"],!1),Sh=h(["axis","y2","tick","format"]),Th=h(["axis","y2","padding"]),Uh=h(["axis","y2","ticks"],10),Vh=h(["grid","x","show"],!1),Wh=h(["grid","x","type"],"tick"),Xh=h(["grid","x","lines"],[]),Yh=h(["grid","y","show"],!1),Zh=h(["grid","y","lines"],[]),$h=h(["grid","y","ticks"],10),_h=h(["point","show"],!0),ai=h(["point","r"],2.5),bi=h(["point","focus","line","enabled"],!0),ci=h(["point","focus","expand","enabled"],!0),di=h(["point","focus","expand","r"]),ei=h(["point","focus","select","r"]),fi=h(["line","connect_null"],!1),gi=h(["bar","width"]),hi=h(["bar","width","ratio"],.6),ii=h(["pie","label","show"],!0),ji=h(["pie","label","format"]),ki=h(["pie","expand"],!0),li=h(["pie","onclick"],function(){}),mi=h(["pie","onmouseover"],function(){}),ni=h(["pie","onmouseout"],function(){}),oi=h(["donut","label","show"],!0),pi=h(["donut","label","format"]),qi=h(["donut","expand"],!0),ri=h(["donut","title"],""),si=h(["donut","onclick"],function(){}),ti=h(["donut","onmouseover"],function(){}),ui=h(["donut","onmouseout"],function(){}),vi=h(["regions"],[]),wi=h(["tooltip","show"],!0),xi=h(["tooltip","format","title"]),yi=h(["tooltip","format","value"]),zi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=xi?xi:b,l=yi?yi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id,a[g].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Ai=h(["tooltip","init","show"],!1),Bi=h(["tooltip","init","x"],0),Ci=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Di=("string"==typeof Hf?Hf.replace("#",""):Hf.id)+"-clip",Ei=Di+"-xaxis",Fi=Di+"-yaxis",Gi=i(Di),Hi=i(Ei),Ii=i(Fi),Ji="timeseries"===mh,Ki="categorized"===mh,Li=!Ji&&(Cg||Be(Dg)),Mi=null,Ni=!1,Oi=!1,Pi=!1,Qi=!1,Ri=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Si=ve(Qg,Be(dh)?dh:Ri,Pg),Ti=nh?Ef.time.format:Ef.time.format.utc,Ui=function(){var a=[[Ti("%Y/%-m/%-d"),function(){return!0}],[Ti("%-m/%-d"),function(a){return a.getMonth()}],[Ti("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ti("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ti("%I %p"),function(a){return a.getHours()}],[Ti("%I:%M"),function(a){return a.getMinutes()}],[Ti(":%S"),function(a){return a.getSeconds()}],[Ti(".%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)}}(),Vi=[],Wi=[],Xi=kh?"left":"bottom",Yi=kh?Ih?"top":"bottom":Ih?"right":"left",Zi=kh?Rh?"bottom":"top":Rh?"left":"right",$i=kh?"left":"bottom",_i={main:function(){return"translate("+Wf.left+","+Wf.top+")"},context:function(){return"translate("+Xf.left+","+Xf.top+")"},legend:function(){return"translate("+Yf.left+","+Yf.top+")"},x:function(){return"translate(0,"+(kh?0:_f)+")"},y:function(){return"translate(0,"+(kh?_f:0)+")"},y2:function(){return"translate("+(kh?0:Zf)+","+(kh?1:0)+")"},subx:function(){return"translate(0,"+(kh?0:ag)+")"},arc:function(){return"translate("+Zf/2+","+_f/2+")"}},aj="right"===fh,bj=0,cj=0,dj=0,ej=.15,fj=30,gj=kh&&!lh?0:30,hj=5;jg=Ef.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var ij,jj=function(){var a=Ef.svg.line().x(kh?function(a){return V(a.id)(a.value)}:Fd).y(kh?Fd:function(a){return V(a.id)(a.value)});return fi||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=fi?Ne(b.values):b.values;return ie(b)?(a.interpolate(je(b)?"cardinal":"linear"),Og[b.id]?af(e,sg,V(b.id),Og[b.id]):a(e)):(c=e[0]?sg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,kh?"M "+d+" "+c:"M "+c+" "+d)}}(),kj=function(){var a;return a=kh?Ef.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Fd):Ef.svg.area().x(Fd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ne(b.values);return ce([b],"area")||ce([b],"area-spline")?(a.interpolate(je(b)?"cardinal":"linear"),a(e)):(c=e[0]?sg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,kh?"M "+d+" "+c:"M "+c+" "+d)}}(),lj=function(){var a=Ef.svg.line().x(kh?function(a){return W(a.id)(a.value)}:Id).y(kh?Id:function(a){return W(a.id)(a.value)});return function(b){var c=Ne(b.values);return ie(b)?a(c):"M "+vg(c[0].x)+" "+W(b.id)(c[0].value)}}(),mj=function(){};ij=Ef.svg.brush().on("brush",kf),ij.update=function(){return qj&&qj.select("."+f.brush).call(this),this},ij.scale=function(a){return kh?this.y(a):this.x(a)},Of&&(mj=Ef.behavior.zoom().on("zoomstart",function(){mj.altDomain=Ef.event.sourceEvent.altKey?sg.orgDomain():null}).on("zoom",Of?lf:null),mj.scale=function(a){return kh?this.y(a):this.x(a)},mj.orgScaleExtent=function(){var a=Pf?Pf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},mj.updateScaleExtent=function(){var a=ac(sg.orgDomain())/ac(uj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var nj,oj,pj,qj,rj,sj,tj,uj,vj,wj={};if(Ff.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=nj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);Ff.revert(),Ff.defocus(),b(d.classed(f.focused,!0)),b(e),he(Ff.data.targets)&&Nb(a,!0),vf(a,!0)},Ff.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=nj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);Ff.revert(),b(d.classed(f.focused,!1)),b(e),he(Ff.data.targets)&&Ob(a),vf(a,!1)},Ff.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=nj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);b(d.classed(f.focused,!1)),b(e),he(Ff.data.targets)&&Ob(a),wf()},Ff.show=function(a,b){a=Dc(a),b=b||{},Mc(a),nj.selectAll(qd(a)).transition().style("opacity",1),b.withLegend&&xf(a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ff.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),nj.selectAll(qd(a)).transition().style("opacity",0),b.withLegend&&yf(a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ff.toggle=function(a){Gc(a)?Ff.hide(a):Ff.show(a)},Ff.unzoom=function(){ij.clear().update(),jf({withUpdateXDomain:!0})},Ff.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Hg[b]=a.classes[b]}),"categories"in a&&Ki&&(oh=a.categories,yg.categories(oh)),"cacheIds"in a&&bc(a.cacheIds)?void qf(dc(a.cacheIds),a.done):void("unload"in a?sf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){rf(a)}):rf(a))},Ff.unload=function(a,b){sf(Dc(a),function(){jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Ff.selected=function(a){return Ef.merge(pj.selectAll("."+f.shapes+od(a)).selectAll("."+f.shape).filter(function(){return Ef.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Ff.select=function(a,b,c){Sg&&pj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=Ef.select(this),i=e.data?e.data.id:e.id,j=Me(this),k=Tg||!a||a.indexOf(i)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Ug(e)&&!m&&j(!0,h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(!1,h.classed(f.SELECTED,!1),e,g)})},Ff.unselect=function(a,b){Sg&&pj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=Ef.select(this),g=c.data?c.data.id:c.id,h=Me(this),i=Tg||!a||a.indexOf(g)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(f.SELECTED); i&&j&&Ug(c)&&k&&h(!1,e.classed(f.SELECTED,!1),c,d)})},Ff.toLine=function(a){Df(a,"line")},Ff.toSpline=function(a){Df(a,"spline")},Ff.toBar=function(a){Df(a,"bar")},Ff.toScatter=function(a){Df(a,"scatter")},Ff.toArea=function(a){Df(a,"area")},Ff.toAreaSpline=function(a){Df(a,"area-spline")},Ff.toPie=function(a){Df(a,"pie",{withTransform:!0})},Ff.toDonut=function(a){Df(a,"donut",{withTransform:!0})},Ff.groups=function(a){return c(a)?Ig:(Ig=a,jf(),Ig)},Ff.xgrids=function(a){return a?(Xh=a,jf(),Xh):Xh},Ff.xgrids.add=function(a){return a?Ff.xgrids(Xh.concat(a)):void 0},Ff.xgrids.remove=function(a){var b=Cf(a);return Ff.xgrids(Xh.filter(b))},Ff.ygrids=function(a){return a?(Zh=a,jf(),Zh):Zh},Ff.ygrids.add=function(a){return a?Ff.ygrids(Zh.concat(a)):void 0},Ff.ygrids.remove=function(a){var b=Cf(a);return Ff.ygrids(Zh.filter(b))},Ff.regions=function(a){return c(a)?vi:(vi=a,jf(),vi)},Ff.regions.add=function(a){return c(a)?vi:(vi=vi.concat(a),jf(),vi)},Ff.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;nj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),vi=vi.filter(function(b){return b.classes.indexOf(a)<0})}),vi},Ff.data.get=function(a){var b=Ff.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Ff.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},Ff.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Gg[b]=a[b]}),jf({withLegend:!0}),Gg):Gg},Ff.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Qg[b]=a[b]}),jf({withLegend:!0}),Qg):Qg},Ff.x=function(a){return arguments.length&&(qc(Ff.data.targets,a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ff.data.xs},Ff.xs=function(a){return arguments.length&&(rc(Ff.data.targets,a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ff.data.xs},Ff.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},Ff.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Eh=+a.y),b(a.y2)&&(Nh=+a.y2)):Eh=Nh=+a,jf())},Ff.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Fh=+a.y),b(a.y2)&&(Oh=+a.y2)):Fh=Oh=+a,jf())},Ff.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Ff.axis.max(a.max),"undefined"!=typeof a.min&&Ff.axis.min(a.min))},Ff.legend.show=function(a){xf(Dc(a)),jf({withLegend:!0})},Ff.legend.hide=function(a){yf(Dc(a)),jf({withLegend:!0})},Ff.resize=function(a){If=a?a.width:null,Jf=a?a.height:null,of({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Ff.destroy=function(){Ff.data.targets=void 0,Ff.data.xs={},tj.html(""),a.onresize=null},"url"in e.data)Ef.xhr(e.data.url,function(a,b){var c,d=Ef.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Ef.csv.parse(b.response),bf(c)});else if("rows"in e.data)bf(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");bf(uc(e.data.columns))}return Ff},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 93c0082e9598fd9051d6253b05a21dab7ee0b814 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Sun, 4 May 2014 16:49:08 +0900 Subject: [PATCH 127/178] Accept min/max of axis x in axis.min/max - #202 --- c3.js | 6 ++- c3.min.js | 2 +- htdocs/samples/api_axis_range.html | 83 ++++++++++++++++++++++++++++++ 3 files changed, 88 insertions(+), 3 deletions(-) create mode 100644 htdocs/samples/api_axis_range.html diff --git a/c3.js b/c3.js index f22c3f5..cd683a8 100644 --- a/c3.js +++ b/c3.js @@ -4532,23 +4532,25 @@ c3.axis.max = function (max) { if (arguments.length) { if (typeof max === 'object') { + if (isValue(max.x)) { __axis_x_max = +max.x; } if (isValue(max.y)) { __axis_y_max = +max.y; } if (isValue(max.y2)) { __axis_y2_max = +max.y2; } } else { __axis_y_max = __axis_y2_max = +max; } - redraw(); + redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true}); } }; c3.axis.min = function (min) { if (arguments.length) { if (typeof min === 'object') { + if (isValue(min.x)) { __axis_x_min = +min.x; } if (isValue(min.y)) { __axis_y_min = +min.y; } if (isValue(min.y2)) { __axis_y2_min = +min.y2; } } else { __axis_y_min = __axis_y2_min = +min; } - redraw(); + redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true}); } }; c3.axis.range = function (range) { diff --git a/c3.min.js b/c3.min.js index 7b15d00..a181f94 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ !function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.34"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",lines:"c3-lines",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",arcs:"c3-arcs",area:"c3-area",areas:"c3-areas",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",legendItemFocused:"c3-legend-item-focused",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;cZf&&(Zf=0),0>_f&&(_f=0),$f=kh?Wf.left-fj-gj:Zf,ag=kh?_f:cg-Xf.top-Xf.bottom,0>$f&&($f=0),0>ag&&(ag=0),p(),aj&&he(Ff.data.targets)&&(Yf.left=Zf/2+eg)}function o(){pj.select("line."+f.xgridFocus).attr("x1",kh?0:-10).attr("x2",kh?Zf:-10).attr("y1",kh?-10:Wf.top).attr("y2",kh?-10:_f)}function p(){eg=_f/2,dg=.95*eg,fg=ge(Ff.data.targets)?.6*dg:0}function q(){var a=kh?f.axisX:f.axisY,b=pj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Ef.select(Hf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return If?If:x()}function s(){var a=Jf?Jf:y();return a>0?a:320}function t(){return he(Ff.data.targets)?0:Kf?Kf:kh?lh?v("x"):1:!Dh||Ih?1:v("y")}function u(){var a=1;return he(Ff.data.targets)?0:Lf?Lf:aj?P()+20+(Mh&&!kh?v("y2"):a):Mh?Rh||kh?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||lh?"x"===a&&Ah?Ah:"y"!==a||Dh?"y2"!==a||Mh?(jb(a).isInner?30:40)+("y2"===a?-10:0):hj:eh&&!aj?10:1:0}function x(){return+Ef.select(Hf).style("width").replace("px","")}function y(){return+Ef.select(Hf).style("height").replace("px","")}function z(a){return a?-5:-(Wf.left-1)}function A(a){return a?-20:-4}function B(){return z(!kh)}function C(){return A(!kh)}function D(){return z(kh)}function E(){return A(kh)}function F(a){return a?Zf+2+4:Wf.left+20}function G(a){return a?(Ah?Ah:0)+80:_f+8}function H(){return F(!kh)}function I(){return G(!kh)}function J(){return F(kh)}function K(){return G(kh)}function L(){var a,b,c,d,e,f=Ac(Ff.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=sg(b.x)-sg(a.x),0===c?kh?_f:Zf:(d=zc(),e=de(Ff.data.targets)?(d-(Ki?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function M(a){bj=a}function N(a){cj=a}function O(a){dj=a}function P(){return eh?aj?cj*(bj+1):bg:0}function Q(){return eh?aj?cg:dj*(bj+1):0}function R(){var a,b,c=!sg;kg=kh?1:0,lg=kh?_f:Zf,mg=kh?0:_f,ng=kh?Zf:1,og=kg,pg=lg,qg=kh?0:ag,rg=kh?$f:1,sg=T(kg,lg,c?void 0:sg.domain(),function(){return yg.tickOffset()}),tg=U(mg,ng,c?void 0:tg.domain()),ug=U(mg,ng,c?void 0:ug.domain()),vg=T(kg,lg,uj,function(a){return a%1?0:Bg.tickOffset()}),wg=U(qg,rg,c?void 0:wg.domain()),xg=U(qg,rg,c?void 0:xg.domain()),a=$(),b=vh?vh:c?void 0:yg.tickValues(),yg=X(sg,Xi,a,b),Bg=X(vg,$i,a,b),zg=Y(tg,Yi,Jh,Lh),Ag=Y(ug,Zi,Sh,Uh),c||(ij.scale(vg),Of&&mj.scale(sg)),S()}function S(){gg=Gb(),hg=Hb(),ig=Hb(.98)}function T(a,b,d,e){var f=(Ji?Ef.time.scale():Ef.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Ki){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=Ef.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?ug:tg}function W(a){return"y2"===Z(a)?xg:wg}function X(a,b,c,d){var e=(Ki?Eb():Ef.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Ki?(e.tickCentered(ph),Ae(rh)&&(rh=!1)):e.tickOffset=function(){var a=Bc(Ff.data.targets),b=sg(a[1])-sg(a[0]),c=b?b:kh?_f:Zf;return c/zc()/2},Ki&&e.categories(oh),e}function Y(a,b,c,d){return Ef.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Jg?Jg[a]:"y"}function $(){var a=Ji?Ui:Ki?Tc:function(a){return 0>a?a.toFixed(0):a};return qh&&("function"==typeof qh?a=qh:Ji&&(a=function(a){return a?Ti(qh)(a):""})),a}function _(a){var b;return"y"===a?b=Hh:"y2"===a?b=Qh:"x"===a&&(b=Ch),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Hh=b:"y2"===a?Qh=b:"x"===a&&(Ch=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",kh?"inner-top":"inner-right")}function hb(){return fb("y",kh?"inner-right":"inner-top")}function ib(){return fb("y2",kh?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Zf/2:Zf:b.isBottom?-_f:b.isMiddle?-_f/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!kh,gb())}function rb(){return nb(kh,hb())}function sb(){return nb(kh,ib())}function tb(){return ob(!kh,gb())}function ub(){return ob(kh,hb())}function vb(){return ob(kh,ib())}function wb(){var a=gb();return kh?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":Ah?Ah-10:"3em"}function xb(){var a=hb();return kh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return kh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!kh,gb())}function Ab(){return pb(kh,hb())}function Bb(){return pb(kh,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return Ef.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(a){var b=pj.select("."+f.axisX+" ."+f.axisXLabel),c=pj.select("."+f.axisY+" ."+f.axisYLabel),d=pj.select("."+f.axisY2+" ."+f.axisY2Label);(a?b.transition():b).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),(a?c.transition():c).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),(a?d.transition():d).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 Ef.min(Object.keys(i).map(function(a){return Ef.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(Ig.length>0)for(g=Sc(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 Ef.max(Object.keys(i).map(function(a){return Ef.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Oh:Fh,n="y2"===c?Nh:Eh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Ph:Gh,r=xd()&&kh;return 0===l.length?"y2"===c?ug.domain():tg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=yd(o,p),j=ac(tg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Kh&&(f=b(Kh.top)?Kh.top:e,g=b(Kh.bottom)?Kh.bottom:e),"y2"===c&&Th&&(f=b(Th.top)?Th.top:e,g=b(Th.bottom)?Th.bottom:e),de(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return yh?Ji?we(yh):yh:Ef.min(a,function(a){return Ef.min(a.values,function(a){return a.x})})}function Zb(a){return xh?Ji?we(xh):xh:Ef.max(a,function(a){return Ef.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Ki?d=0:de(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof zh&&Be(zh)?(e=b(zh.left)?zh.left:d,f=b(zh.right)?zh.right:d):e=f="number"==typeof zh?zh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return c-d===0&&(c=Ji?new Date(.5*c.getTime()):-.5,d=Ji?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Ji?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Ji?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?tg:ug;return b="y"===a.axis||"y2"===a.axis?kh?_f:"start"in a?d(a.start):_f:kh?"end"in a?sg(Ji?we(a.end):a.end):_f:_f,c>b?0:b-c}function ic(a){return Cg&&a===Cg||Be(Dg)&&Ce(Dg,a)}function jc(a){return!ic(a)}function kc(a){return Cg?Cg:Be(Dg)?Dg[a]:null}function lc(a,b){var c,d=b&&Be(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=Ff.data.xs[b])}),c}function mc(a,b){return a in Ff.data.xs&&Ff.data.xs[a]&&Ff.data.xs[a][b]?Ff.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){Dg[b]=a[b]})}function oc(a){return 1===Ef.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=Gg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),Ff.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=Ji?a?a instanceof Date?a:we(a):we(mc(c,d)):Li&&!Ki?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Ff.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Cg?(d=Object.keys(Ff.data.xs),Ff.data.xs[c]=d.length>0?Ff.data.xs[d[0]]:void 0):Be(Dg)&&(Ff.data.xs[c]=lc(f,Ff.data.targets)):Ff.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Ff.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Fg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Li&&Ki&&0===c&&g&&(0===e&&(oh=[]),oh.push(g)),("undefined"==typeof a[b]||Ff.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Kg&&be(Cc(c).filter(function(a){return!(a in Lg)}),Kg),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&Ff.data.targets[0].values[a-1]?Ff.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(Ff.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Ji?new Date(i):i);j.push(e)}return Ji||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Vi=Vi.concat(a)}function Mc(a){Vi=Vi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Wi=Wi.concat(a)}function Oc(a){Wi=Wi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Jd(a,f))),(a[g].x||0===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=De(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Nd(a,b){return Ef.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Od(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 Pd(){return Ng&&"desc"===Ng.toLowerCase()}function Qd(){return Ng&&"asc"===Ng.toLowerCase()}function Rd(a){var b=Qd(),c=Pd();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 Ng&&a.sort(Ng),a}function Sd(a,c){var d,e,f,g,h,i,j,k=he(Ff.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&wi&&(sj.html(zi(a,$(),zd(k),Si)).style("display","block"),d=sj.property("offsetWidth"),e=sj.property("offsetHeight"),k?(g=Zf/2+c[0],i=_f/2+c[1]+20):(kh?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=sg(l[0].x)+20):(f=q(),g=f+t()+sg(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),sj.style("top",i+"px").style("left",g+"px"))}function Td(){sj.style("display","none")}function Ud(a){var c=a.filter(function(a){return a&&b(a.value)});wi&&(ee(Ff.data.targets)||he(Ff.data.targets)||pj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(kh?"y1":"x1",Fd).attr(kh?"y2":"x2",Fd))}function Vd(){pj.select("line."+f.xgridFocus).style("visibility","hidden")}function Wd(a){return a.x||0===a.x?sg(a.x):null}function Xd(a){return V(a.id)(a.value)}function Yd(){var a,b,d={},e=0;return Ic(Fc(ke)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ae(a,b){return"number"==typeof gi?gi:b?2*a.tickOffset()*hi/b:0}function be(a,b){Dc(a).forEach(function(a){wj[a]=b===Lg[a],Lg[a]=b})}function ce(a,b){var c=!1;return a.forEach(function(a){Lg[a.id]===b&&(c=!0),a.id in Lg||"line"!==b||(c=!0)}),c}function de(a){return ce(a,"bar")}function ee(a){return ce(a,"scatter")}function fe(a){return ce(a,"pie")}function ge(a){return ce(a,"donut")}function he(a){return fe(a)||ge(a)}function ie(a){var b="string"==typeof a?a:a.id;return!(b in Lg)||"line"===Lg[b]||"spline"===Lg[b]||"area"===Lg[b]||"area-spline"===Lg[b]}function je(a){var b="string"==typeof a?a:a.id;return"spline"===Lg[b]||"area-spline"===Lg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"bar"===Lg[b]}function le(a){var b="string"==typeof a?a:a.id;return"scatter"===Lg[b]}function me(a){var b="string"==typeof a?a:a.id;return"pie"===Lg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"donut"===Lg[b]}function oe(a){return me(a)||ne(a)}function pe(a){return ie(a)?[a]:[]}function qe(a){return oe(a.data)?[a]:[]}function re(a){return ke(a)?a.values:[]}function se(a){return ie(a)||le(a)?a.values:[]}function te(a){return ke(a)||ie(a)?a.values:[]}function ue(a){return ne(a)&&qi||me(a)&&ki}function ve(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function we(b){var c;try{c=Eg?Ef.time.format(Eg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Eg)}return c}function xe(a,b){var c=Ef.mouse(a),d=Ef.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ce(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function De(a,b){var c="y"===Z(a.id)?tg:ug,d=kh?1:0,e=kh?0:1;return Math.pow(sg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ee(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Fe(a,b,c){Zg(b,a.node()),pj.select("."+f.selectedCircles+od(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",kh?Xd:Wd).attr("cy",kh?Wd:Xd).attr("stroke",function(){return Si(b)}).attr("r",1.4*Qe(b)).transition().duration(100).attr("r",Qe)}function Ge(a,b,c){$g(b,a.node()),pj.select("."+f.selectedCircles+od(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function He(a,b,c,d){a?Fe(b,c,d):Ge(b,c,d)}function Ie(a,b){Zg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ef.rgb(Si(b)).brighter(.75)})}function Je(a,b){$g(b,a.node()),a.transition().duration(100).style("fill",function(){return Si(b)})}function Ke(a,b,c,d){a?Ie(b,c,d):Je(b,c,d)}function Le(a,b,c,d){Ke(a,b,c.data,d)}function Me(a){return"circle"===a.nodeName?He:Ef.select(a).classed(f.bar)?Ke:Le}function Ne(a){return a.filter(function(a){return b(a.value)})}function Oe(a){return _h?"function"==typeof ai?ai(a):ai:0}function Pe(a){return ci?di?di:1.75*Oe(a):Oe(a)}function Qe(a){return ei?ei:4*Oe(a)}function Re(a,c){return(c?pj.selectAll("."+f.circles+od(c)):pj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Se(a,b){Re(a,b).classed(f.EXPANDED,!0).attr("r",Pe)}function Te(a){Re(a).filter(function(){return Ef.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oe)}function Ue(a){return pj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ve(a){Ue(a).classed(f.EXPANDED,!0)}function We(a){Ue(a).classed(f.EXPANDED,!1)}function Xe(a,b){var c=_e(a,b);return function(a,b){var d=c(a,b),e=kh?1:0,f=kh?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 Ye(a,b){var c=_e(a,!1),d=b?Ze:$e;return function(a,b){return d(c(a,b),a,this)}}function Ze(a,b){var c;return kh?(c=ke(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function $e(a,b,c){var d=c.getBoundingClientRect();return kh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ke(b)?-3:-6)}function _e(a,b){var c=a.__max__+1,d=ae(yg,c),e=Zd(d,c,a,!!b),f=$d(!!b),g=_d(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return kh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function af(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 bf(b){var c,d,e;if(tj=Ef.select(Hf),tj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(tj.html("").classed("c3",!0),Ff.data.xs={},Ff.data.targets=vc(b),Rg&&Lc(Rg===!0?Cc(Ff.data.targets):Rg),n(),R(),sg.domain(Ef.extent(_b(Ff.data.targets))),tg.domain(Xb(Ff.data.targets,"y")),ug.domain(Xb(Ff.data.targets,"y2")),vg.domain(sg.domain()),wg.domain(tg.domain()),xg.domain(ug.domain()),uj=sg.domain(),ij.scale(vg),Of&&mj.scale(sg),nj=tj.append("svg").on("mouseenter",Rf).on("mouseleave",Sf),oj=nj.append("defs"),oj.append("clipPath").attr("id",Di).append("rect"),oj.append("clipPath").attr("id",Ei).append("rect"),oj.append("clipPath").attr("id",Fi).append("rect"),nf(),pj=nj.append("g").attr("transform",_i.main),qj=nj.append("g").attr("transform",_i.context),rj=nj.append("g").attr("transform",_i.legend),bh||qj.style("visibility","hidden"),eh||(rj.style("visibility","hidden"),Wi=Cc(Ff.data.targets)),sj=Ef.select(Hf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),zf(Cc(Ff.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=pj.append("g").attr("clip-path",Gi).attr("class",f.grid),Vh&&d.append("g").attr("class",f.xgrids),Be(Xh)&&d.append("g").attr("class",f.xgridLines),bi&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Yh&&d.append("g").attr("class",f.ygrids),Be(Zh)&&d.append("g").attr("class",f.ygridLines),lh&&pj.append("g").attr("class",f.axisX).attr("clip-path",Hi).attr("transform",_i.x).append("text").attr("class",f.axisXLabel).attr("transform",kh?"rotate(-90)":"").style("text-anchor",zb),Dh&&pj.append("g").attr("class",f.axisY).attr("clip-path",Ii).attr("transform",_i.y).append("text").attr("class",f.axisYLabel).attr("transform",kh?"":"rotate(-90)").style("text-anchor",Ab),Mh&&pj.append("g").attr("class",f.axisY2).attr("transform",_i.y2).append("text").attr("class",f.axisY2Label).attr("transform",kh?"":"rotate(-90)").style("text-anchor",Bb),pj.append("g").attr("clip-path",Gi).attr("class",f.regions),pj.append("g").attr("clip-path",Gi).attr("class",f.chart),c=pj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Of?kh?"ns-resize":"ew-resize":null),pj.select("."+f.chart).append("g").attr("class",f.chartBars),pj.select("."+f.chart).append("g").attr("class",f.chartLines),pj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",_i.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),pj.select("."+f.chart).append("g").attr("class",f.chartTexts),Of&&pj.insert("rect",Qf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Zf).attr("height",_f).style("opacity",0).style("cursor",kh?"ns-resize":"ew-resize").call(mj).on("dblclick.zoom",null),Bh&&ij.extent("function"!=typeof Bh?Bh:Bh(_b())),qj.append("g").attr("clip-path",Gi).attr("class",f.chart),qj.select("."+f.chart).append("g").attr("class",f.chartBars),qj.select("."+f.chart).append("g").attr("class",f.chartLines),qj.append("g").attr("clip-path",Gi).attr("class",f.brush).call(ij).selectAll("rect").attr(kh?"width":"height",kh?$f:ag),qj.append("g").attr("class",f.axisX).attr("transform",_i.subx).attr("clip-path",kh?"":Hi),pf(Ff.data.targets),kh?pj.select("."+f.axisX).style("opacity",0).call(yg):(pj.select("."+f.axisY).style("opacity",0).call(zg),pj.select("."+f.axisY2).style("opacity",0).call(Ag)),n(),R(),nf(),m(!1),jf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Ai){if(Ji&&"string"==typeof Bi){for(Bi=we(Bi),e=0;e0){d=[];for(var g in Gg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Od(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ke,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 gf(a){he(Ff.data.targets)||Sg&&(Mi=a,pj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ni=!0,_g())}function hf(){he(Ff.data.targets)||Sg&&(pj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),pj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ni=!1,ah())}function jf(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z=Yd(),$=he(Ff.data.targets),_=Ic(Ff.data.targets);if(a=d(a)?a:{},E=d(a.withY)?a.withY:!0,F=d(a.withSubchart)?a.withSubchart:!0,G=d(a.withTransition)?a.withTransition:!0,J=d(a.withTransform)?a.withTransform:!1,K=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,M=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,N=d(a.withLegend)?a.withLegend:!1,H=d(a.withTransitionForExit)?a.withTransitionForExit:G,I=d(a.withTransitionForAxis)?a.withTransitionForAxis:G,T=G?Vf:0,U=H?T:0,V=I?T:0,c=pj.select("."+f.axisX).style("opacity",$?0:1),g=pj.select("."+f.axisY).style("opacity",$?0:1),h=pj.select("."+f.axisY2).style("opacity",$?0:1),e=qj.select("."+f.axisX).style("opacity",$?0:1),S={axisX:c.transition().duration(V),axisY:g.transition().duration(V),axisY2:h.transition().duration(V),axisSubX:e.transition().duration(V)},N&&eh&&zf(Cc(Ff.data.targets),a,S),Ki&&(0!==_.length&&M&&K||sg.domain([0,c.selectAll(".tick").size()])),_.length&&(M&&(sg.domain(Ef.extent(_b(_))),uj=sg.domain(),Of&&mj.scale(sg).updateScaleExtent(),vg.domain(sg.domain()),ij.scale(vg)),K&&(sg.domain(ij.empty()?uj:ij.extent()),Of&&mj.scale(sg).updateScaleExtent()),vh||!uh&&!th||(W=Kc(Jc(_),th),yg.tickValues(W),Bg.tickValues(W))),tg.domain(Xb(_,"y")),ug.domain(Xb(_,"y2")),S.axisX.call(yg),S.axisY.call(zg),S.axisY2.call(Ag),S.axisSubX.call(Bg),Db(G),K&&_.length)if(rh&&W){for(X=1;X=0&&Ef.select(this).style("display",b%Y?"none":"block")})}else nj.selectAll("."+f.axisX+" .tick text").style("display","block");if(!kh&&wh&&eb(c,S.axisX,wh),O=Xe(Z),Q=Ye(Z,!0),R=Ye(Z,!1),wg.domain(tg.domain()),xg.domain(ug.domain()),sj.style("display","none"),o(),pj.select("line."+f.xgridFocus).style("visibility","hidden"),Vh){if("year"===Wh){j=[];for(var ab=_b(),bb=ab[0].getFullYear(),cb=ab[1].getFullYear(),db=bb;cb>=db;db++)j.push(new Date(db+"-01-01 00:00:00"))}else j=sg.ticks(10);i=pj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",kh?0:function(a){return sg(a)-yg.tickOffset()}).attr("x2",kh?Zf:function(a){return sg(a)-yg.tickOffset()}).attr("y1",kh?function(a){return sg(a)-yg.tickOffset()}:Wf.top).attr("y2",kh?function(a){return sg(a)-yg.tickOffset()}:_f).style("opacity",function(){return+Ef.select(this).attr(kh?"y1":"x1")===(kh?_f:0)?0:1}),i.exit().remove()}Be(Xh)&&(k=pj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Xh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",kh?"":"rotate(-90)").attr("dx",kh?0:-Wf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",kh?0:Gd).attr("x2",kh?Zf:Gd).attr("y1",kh?Gd:Wf.top).attr("y2",kh?Gd:_f).style("opacity",1),k.select("text").transition().duration(T).attr("x",kh?Zf:0).attr("y",Gd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),E&&Yh&&(m=pj.select("."+f.ygrids).selectAll("."+f.ygrid).data(tg.ticks($h)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",kh?tg:0).attr("x2",kh?tg:Zf).attr("y1",kh?0:tg).attr("y2",kh?_f:tg),m.exit().remove()),E&&Be(Zh)&&(n=pj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Zh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",kh?"rotate(-90)":"").attr("dx",kh?0:-Wf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(T).attr("x1",kh?Hd:0).attr("x2",kh?Hd:Zf).attr("y1",kh?0:Hd).attr("y2",kh?_f:Hd).style("opacity",1),n.select("text").transition().duration(T).attr("x",kh?0:Zf).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(T).style("opacity",0).remove()),v=pj.select("."+f.regions).selectAll("."+f.region).data(vi),v.enter().append("g").attr("class",hd).append("rect").style("fill-opacity",0),v.selectAll("rect").attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(T).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),v.exit().transition().duration(T).style("fill-opacity",0).remove(),t=pj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),t.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Si),t.style("opacity",td).transition().duration(T).attr("d",O).style("fill",Si).style("opacity",1),t.exit().transition().duration(U).style("opacity",0).remove(),q=pj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),q.enter().append("path").attr("class",Zc).style("stroke",Si),q.style("opacity",td).transition().duration(T).attr("d",jj).style("stroke",Si).style("opacity",1),q.exit().transition().duration(U).style("opacity",0).remove(),r=pj.selectAll("."+f.areas).selectAll("."+f.area).data(pe),r.enter().append("path").attr("class",fd).style("fill",Si).style("opacity",function(){return vj=+Ef.select(this).style("opacity"),0}),r.style("opacity",0).transition().duration(T).attr("d",kj).style("fill",Si).style("opacity",vj),r.exit().transition().duration(U).style("opacity",0).remove(),s=pj.selectAll("."+f.circles).selectAll("."+f.circle).data(se),s.enter().append("circle").attr("class",_c).attr("r",Oe).style("fill",Si),s.style("opacity",td).transition().duration(T).style("opacity",vd).style("fill",Si).attr("cx",kh?Xd:Wd).attr("cy",kh?Wd:Xd),s.exit().remove(),w=pj.selectAll("."+f.texts).selectAll("."+f.text).data(te),w.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return kh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",Si).style("fill-opacity",0),w.text(function(a){return Ed(a.id)(a.value,a.id)}).style("fill-opacity",ud).transition().duration(T).attr("x",Q).attr("y",R).style("fill",Si).style("fill-opacity",wd),w.exit().transition().duration(U).style("fill-opacity",0).remove(),u=pj.selectAll("."+f.arcs).selectAll("."+f.arc).data(qe),u.enter().append("path").attr("class",dd).style("fill",function(a){return Si(a.data)}).style("cursor",function(a){return Ug(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Qi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),vf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Sd(d,Ef.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Qi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),wf(),Td(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();ef(this,a,b),e(d,b)}),u.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Qi=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Fb(a);return c?(b=Ef.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("fill",function(a){return Si(a.data)}).style("opacity",1).call(Ee,function(){Qi=!1}),u.exit().transition().duration(U).style("opacity",0).remove(),pj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(T).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&oe(a.data)?1:0}),pj.select("."+f.chartArcsTitle).style("opacity",ge(Ff.data.targets)?1:0),bh&&(null!==Ef.event&&"zoom"===Ef.event.type&&ij.extent(sg.orgDomain()).update(),F&&(!kh&&wh&&eb(e,S.axisSubX,wh),ij.empty()||ij.extent(sg.orgDomain()).update(),P=Xe(Z,!0),y=qj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),y.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Si),y.style("opacity",td).transition().duration(T).attr("d",P).style("opacity",1),y.exit().transition().duration(T).style("opacity",0).remove(),x=qj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),x.enter().append("path").attr("class",Zc).style("stroke",Si),x.style("opacity",td).transition().duration(T).attr("d",lj).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove())),pj.selectAll("."+f.selectedCircles).filter(function(a){return ke(a)}).selectAll("circle").remove(),pj.selectAll("."+f.selectedCircle).transition().duration(T).attr("cx",kh?Xd:Wd).attr("cy",kh?Wd:Xd),z=pj.select("."+f.eventRects),Be(Dg)&&!oc(Dg)?(z.classed(f.eventRectsMultiple)||z.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),A=pj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),df(A.enter()),A.attr("x",0).attr("y",0).attr("width",Zf).attr("height",_f)):(z.classed(f.eventRectsSingle)||z.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Li&&!Ki?(D=function(a,b){var c=xc(b),d=yc(b),e=Ff.data.xs[a.id][b];return(sg(d?d:e+50)-sg(c?c:e-50))/2},C=function(a,b){var c=xc(b),d=Ff.data.xs[a.id][b];return(sg(d)+sg(c?c:d-50))/2}):(D=L(),C=function(a){return sg(a.x)-D/2}),B=Ac(Ff.data.targets),pj.select("."+f.eventRects).datum(B?B.values:[]),A=pj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),cf(A.enter()),A.attr("class",id).attr("x",kh?0:C).attr("y",kh?C:0).attr("width",kh?Zf:D).attr("height",kh?D:_f),A.exit().remove()),Cc(Ff.data.targets).forEach(function(a){wj[a]=!0})}function kf(){jf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function lf(){return"mousemove"===Ef.event.sourceEvent.type&&mj.altDomain?(sg.domain(mj.altDomain),void mj.scale(sg).updateScaleExtent()):(Ki&&sg.orgDomain()[0]===uj[0]&&sg.domain([uj[0]-1e-10,sg.orgDomain()[1]]),jf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Ef.event.sourceEvent.type&&(Oi=!0)))}function mf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function nf(){nj.attr("width",bg).attr("height",cg),nj.select("#"+Di).select("rect").attr("width",Zf).attr("height",_f),nj.select("#"+Ei).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),nj.select("#"+Fi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),nj.select("."+f.zoomRect).attr("width",Zf).attr("height",_f),tj.style("max-height",cg+"px")}function of(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),nf(),m(a.withTransition),jf(a)}function pf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=pj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",kd),j=i.enter().append("g").attr("class",kd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc),e=pj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",md),d=e.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",cd).style("cursor",function(a){return Ug(a)?"pointer":null}),c=pj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",ld),b=c.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",$c),b.append("g").attr("class",gd),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",ad).style("cursor",function(a){return Ug(a)?"pointer":null}),a.forEach(function(a){pj.selectAll("."+f.selectedCircles+od(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=pj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(jg(a)).attr("class",nd),g=h.enter().append("g").attr("class",nd),g.append("g").attr("class",ed),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),bh&&(n=qj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",md),m=n.enter().append("g").style("opacity",0).attr("class",md),m.append("g").attr("class",cd),l=qj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",ld),k=l.enter().append("g").style("opacity",0).attr("class",ld),k.append("g").attr("class",$c)),nj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Vf).style("opacity",1)}function qf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?be(a.id,b.types[a.id]):be(a.id,b.type)}),Ff.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=aj?j:i,l=aj?Q():P();return d&&(w=0,C=0,t=0,u=0),eh&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=aj?u:t,void(jh?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=rj.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,aj?(g=function(a){return t*B[a]},j=function(a){return A[B[a]]+x[a]}):(g=function(a){return A[B[a]]+x[a]},j=function(a){return u*B[a]}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=rj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof gh?gh(a):Ff.toggle(a)}).on("mouseover",function(a){Ef.select(this).classed(f.legendItemFocused,!0),Qi||Ff.focus(a),"function"==typeof hh&&hh(a)}).on("mouseout",function(a){Ef.select(this).classed(f.legendItemFocused,!1),Qi||Ff.revert(),"function"==typeof ih&&ih(a)}),o.append("text").text(function(a){return d(Gg[a])?Gg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",aj?h:-200).attr("y",aj?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",aj?i:-200).attr("y",aj?-200:l),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",Si).attr("x",aj?h:-200).attr("y",aj?-200:j).attr("width",10).attr("height",10),rj.selectAll("text").data(a).text(function(a){return d(Gg[a])?Gg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),rj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}).attr("x",i).attr("y",l),rj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).style("fill",Si).attr("x",g).attr("y",j),rj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=Ef.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?tf(b):uf(b):ej}),N(t),O(u),M(C),n(),R(),nf(),m(q,c)}function Af(a){return Ec(Ff.data.targets,a.id)}function Bf(a){return"data"in a&&Ec(Ff.data.targets,a.data.id)}function Cf(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 Df(a,b,c){var d=!he(Ff.data.targets);Qi=!1,be(a,b),of(c||{withTransitionForAxis:d})}var Ef=a.d3?a.d3:a.require?a.require("d3"):void 0,Ff={data:{},axis:{},legend:{}},Gf={},Hf=h(["bindto"],"#chart"),If=h(["size","width"]),Jf=h(["size","height"]),Kf=h(["padding","left"],50),Lf=h(["padding","right"],0),Mf=h(["padding","top"],0),Nf=h(["padding","bottom"],0),Of=h(["zoom","enabled"],!1),Pf=h(["zoom","extent"]),Qf=h(["zoom","privileged"],!1),Rf=h(["onenter"],function(){}),Sf=h(["onleave"],function(){}),Tf=h(["onresize"],function(){}),Uf=h(["onresized"],function(){}),Vf=h(["transition","duration"],350);g("data","data is required in config");var Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg=h(["data","x"]),Dg=h(["data","xs"],{}),Eg=h(["data","x_format"]),Fg=h(["data","id_converter"],function(a){return a}),Gg=h(["data","names"],{}),Hg=h(["data","classes"],{}),Ig=h(["data","groups"],[]),Jg=h(["data","axes"],{}),Kg=h(["data","type"]),Lg=h(["data","types"],{}),Mg=h(["data","labels"],{}),Ng=h(["data","order"]),Og=h(["data","regions"],{}),Pg=h(["data","color"]),Qg=h(["data","colors"],{}),Rg=h(["data","hide"],!1),Sg=h(["data","selection","enabled"],!1),Tg=h(["data","selection","grouped"],!1),Ug=h(["data","selection","isselectable"],function(){return!0}),Vg=h(["data","selection","multiple"],!0),Wg=h(["data","onclick"],function(){}),Xg=h(["data","onenter"],function(){}),Yg=h(["data","onleave"],function(){}),Zg=h(["data","onselected"],function(){}),$g=h(["data","onunselected"],function(){}),_g=h(["data","ondragstart"],function(){}),ah=h(["data","ondragend"],function(){}),bh=h(["subchart","show"],!1),ch=h(["subchart","size","height"],60),dh=h(["color","pattern"],[]),eh=h(["legend","show"],!0),fh=h(["legend","position"],"bottom"),gh=h(["legend","item","onclick"]),hh=h(["legend","item","onmouseover"]),ih=h(["legend","item","onmouseout"]),jh=h(["legend","equally"],!1),kh=h(["axis","rotated"],!1),lh=h(["axis","x","show"],!0),mh=h(["axis","x","type"],"indexed"),nh=h(["axis","x","localtime"],!0),oh=h(["axis","x","categories"],[]),ph=h(["axis","x","tick","centered"],!1),qh=h(["axis","x","tick","format"]),rh=h(["axis","x","tick","culling"],{}),sh=h(["axis","x","tick","culling","max"],10),th=h(["axis","x","tick","count"]),uh=h(["axis","x","tick","fit"],!0),vh=h(["axis","x","tick","values"],null),wh=h(["axis","x","tick","rotate"]),xh=h(["axis","x","max"],null),yh=h(["axis","x","min"],null),zh=h(["axis","x","padding"],{}),Ah=h(["axis","x","height"]),Bh=h(["axis","x","default"]),Ch=h(["axis","x","label"],{}),Dh=h(["axis","y","show"],!0),Eh=h(["axis","y","max"]),Fh=h(["axis","y","min"]),Gh=h(["axis","y","center"]),Hh=h(["axis","y","label"],{}),Ih=h(["axis","y","inner"],!1),Jh=h(["axis","y","tick","format"]),Kh=h(["axis","y","padding"]),Lh=h(["axis","y","ticks"],10),Mh=h(["axis","y2","show"],!1),Nh=h(["axis","y2","max"]),Oh=h(["axis","y2","min"]),Ph=h(["axis","y2","center"]),Qh=h(["axis","y2","label"],{}),Rh=h(["axis","y2","inner"],!1),Sh=h(["axis","y2","tick","format"]),Th=h(["axis","y2","padding"]),Uh=h(["axis","y2","ticks"],10),Vh=h(["grid","x","show"],!1),Wh=h(["grid","x","type"],"tick"),Xh=h(["grid","x","lines"],[]),Yh=h(["grid","y","show"],!1),Zh=h(["grid","y","lines"],[]),$h=h(["grid","y","ticks"],10),_h=h(["point","show"],!0),ai=h(["point","r"],2.5),bi=h(["point","focus","line","enabled"],!0),ci=h(["point","focus","expand","enabled"],!0),di=h(["point","focus","expand","r"]),ei=h(["point","focus","select","r"]),fi=h(["line","connect_null"],!1),gi=h(["bar","width"]),hi=h(["bar","width","ratio"],.6),ii=h(["pie","label","show"],!0),ji=h(["pie","label","format"]),ki=h(["pie","expand"],!0),li=h(["pie","onclick"],function(){}),mi=h(["pie","onmouseover"],function(){}),ni=h(["pie","onmouseout"],function(){}),oi=h(["donut","label","show"],!0),pi=h(["donut","label","format"]),qi=h(["donut","expand"],!0),ri=h(["donut","title"],""),si=h(["donut","onclick"],function(){}),ti=h(["donut","onmouseover"],function(){}),ui=h(["donut","onmouseout"],function(){}),vi=h(["regions"],[]),wi=h(["tooltip","show"],!0),xi=h(["tooltip","format","title"]),yi=h(["tooltip","format","value"]),zi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=xi?xi:b,l=yi?yi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id,a[g].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Ai=h(["tooltip","init","show"],!1),Bi=h(["tooltip","init","x"],0),Ci=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Di=("string"==typeof Hf?Hf.replace("#",""):Hf.id)+"-clip",Ei=Di+"-xaxis",Fi=Di+"-yaxis",Gi=i(Di),Hi=i(Ei),Ii=i(Fi),Ji="timeseries"===mh,Ki="categorized"===mh,Li=!Ji&&(Cg||Be(Dg)),Mi=null,Ni=!1,Oi=!1,Pi=!1,Qi=!1,Ri=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Si=ve(Qg,Be(dh)?dh:Ri,Pg),Ti=nh?Ef.time.format:Ef.time.format.utc,Ui=function(){var a=[[Ti("%Y/%-m/%-d"),function(){return!0}],[Ti("%-m/%-d"),function(a){return a.getMonth()}],[Ti("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ti("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ti("%I %p"),function(a){return a.getHours()}],[Ti("%I:%M"),function(a){return a.getMinutes()}],[Ti(":%S"),function(a){return a.getSeconds()}],[Ti(".%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)}}(),Vi=[],Wi=[],Xi=kh?"left":"bottom",Yi=kh?Ih?"top":"bottom":Ih?"right":"left",Zi=kh?Rh?"bottom":"top":Rh?"left":"right",$i=kh?"left":"bottom",_i={main:function(){return"translate("+Wf.left+","+Wf.top+")"},context:function(){return"translate("+Xf.left+","+Xf.top+")"},legend:function(){return"translate("+Yf.left+","+Yf.top+")"},x:function(){return"translate(0,"+(kh?0:_f)+")"},y:function(){return"translate(0,"+(kh?_f:0)+")"},y2:function(){return"translate("+(kh?0:Zf)+","+(kh?1:0)+")"},subx:function(){return"translate(0,"+(kh?0:ag)+")"},arc:function(){return"translate("+Zf/2+","+_f/2+")"}},aj="right"===fh,bj=0,cj=0,dj=0,ej=.15,fj=30,gj=kh&&!lh?0:30,hj=5;jg=Ef.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var ij,jj=function(){var a=Ef.svg.line().x(kh?function(a){return V(a.id)(a.value)}:Fd).y(kh?Fd:function(a){return V(a.id)(a.value)});return fi||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=fi?Ne(b.values):b.values;return ie(b)?(a.interpolate(je(b)?"cardinal":"linear"),Og[b.id]?af(e,sg,V(b.id),Og[b.id]):a(e)):(c=e[0]?sg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,kh?"M "+d+" "+c:"M "+c+" "+d)}}(),kj=function(){var a;return a=kh?Ef.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Fd):Ef.svg.area().x(Fd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ne(b.values);return ce([b],"area")||ce([b],"area-spline")?(a.interpolate(je(b)?"cardinal":"linear"),a(e)):(c=e[0]?sg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,kh?"M "+d+" "+c:"M "+c+" "+d)}}(),lj=function(){var a=Ef.svg.line().x(kh?function(a){return W(a.id)(a.value)}:Id).y(kh?Id:function(a){return W(a.id)(a.value)});return function(b){var c=Ne(b.values);return ie(b)?a(c):"M "+vg(c[0].x)+" "+W(b.id)(c[0].value)}}(),mj=function(){};ij=Ef.svg.brush().on("brush",kf),ij.update=function(){return qj&&qj.select("."+f.brush).call(this),this},ij.scale=function(a){return kh?this.y(a):this.x(a)},Of&&(mj=Ef.behavior.zoom().on("zoomstart",function(){mj.altDomain=Ef.event.sourceEvent.altKey?sg.orgDomain():null}).on("zoom",Of?lf:null),mj.scale=function(a){return kh?this.y(a):this.x(a)},mj.orgScaleExtent=function(){var a=Pf?Pf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},mj.updateScaleExtent=function(){var a=ac(sg.orgDomain())/ac(uj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var nj,oj,pj,qj,rj,sj,tj,uj,vj,wj={};if(Ff.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=nj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);Ff.revert(),Ff.defocus(),b(d.classed(f.focused,!0)),b(e),he(Ff.data.targets)&&Nb(a,!0),vf(a,!0)},Ff.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=nj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);Ff.revert(),b(d.classed(f.focused,!1)),b(e),he(Ff.data.targets)&&Ob(a),vf(a,!1)},Ff.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=nj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);b(d.classed(f.focused,!1)),b(e),he(Ff.data.targets)&&Ob(a),wf()},Ff.show=function(a,b){a=Dc(a),b=b||{},Mc(a),nj.selectAll(qd(a)).transition().style("opacity",1),b.withLegend&&xf(a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ff.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),nj.selectAll(qd(a)).transition().style("opacity",0),b.withLegend&&yf(a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ff.toggle=function(a){Gc(a)?Ff.hide(a):Ff.show(a)},Ff.unzoom=function(){ij.clear().update(),jf({withUpdateXDomain:!0})},Ff.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Hg[b]=a.classes[b]}),"categories"in a&&Ki&&(oh=a.categories,yg.categories(oh)),"cacheIds"in a&&bc(a.cacheIds)?void qf(dc(a.cacheIds),a.done):void("unload"in a?sf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){rf(a)}):rf(a))},Ff.unload=function(a,b){sf(Dc(a),function(){jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Ff.selected=function(a){return Ef.merge(pj.selectAll("."+f.shapes+od(a)).selectAll("."+f.shape).filter(function(){return Ef.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Ff.select=function(a,b,c){Sg&&pj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=Ef.select(this),i=e.data?e.data.id:e.id,j=Me(this),k=Tg||!a||a.indexOf(i)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Ug(e)&&!m&&j(!0,h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(!1,h.classed(f.SELECTED,!1),e,g)})},Ff.unselect=function(a,b){Sg&&pj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=Ef.select(this),g=c.data?c.data.id:c.id,h=Me(this),i=Tg||!a||a.indexOf(g)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(f.SELECTED); -i&&j&&Ug(c)&&k&&h(!1,e.classed(f.SELECTED,!1),c,d)})},Ff.toLine=function(a){Df(a,"line")},Ff.toSpline=function(a){Df(a,"spline")},Ff.toBar=function(a){Df(a,"bar")},Ff.toScatter=function(a){Df(a,"scatter")},Ff.toArea=function(a){Df(a,"area")},Ff.toAreaSpline=function(a){Df(a,"area-spline")},Ff.toPie=function(a){Df(a,"pie",{withTransform:!0})},Ff.toDonut=function(a){Df(a,"donut",{withTransform:!0})},Ff.groups=function(a){return c(a)?Ig:(Ig=a,jf(),Ig)},Ff.xgrids=function(a){return a?(Xh=a,jf(),Xh):Xh},Ff.xgrids.add=function(a){return a?Ff.xgrids(Xh.concat(a)):void 0},Ff.xgrids.remove=function(a){var b=Cf(a);return Ff.xgrids(Xh.filter(b))},Ff.ygrids=function(a){return a?(Zh=a,jf(),Zh):Zh},Ff.ygrids.add=function(a){return a?Ff.ygrids(Zh.concat(a)):void 0},Ff.ygrids.remove=function(a){var b=Cf(a);return Ff.ygrids(Zh.filter(b))},Ff.regions=function(a){return c(a)?vi:(vi=a,jf(),vi)},Ff.regions.add=function(a){return c(a)?vi:(vi=vi.concat(a),jf(),vi)},Ff.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;nj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),vi=vi.filter(function(b){return b.classes.indexOf(a)<0})}),vi},Ff.data.get=function(a){var b=Ff.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Ff.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},Ff.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Gg[b]=a[b]}),jf({withLegend:!0}),Gg):Gg},Ff.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Qg[b]=a[b]}),jf({withLegend:!0}),Qg):Qg},Ff.x=function(a){return arguments.length&&(qc(Ff.data.targets,a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ff.data.xs},Ff.xs=function(a){return arguments.length&&(rc(Ff.data.targets,a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ff.data.xs},Ff.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},Ff.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Eh=+a.y),b(a.y2)&&(Nh=+a.y2)):Eh=Nh=+a,jf())},Ff.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Fh=+a.y),b(a.y2)&&(Oh=+a.y2)):Fh=Oh=+a,jf())},Ff.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Ff.axis.max(a.max),"undefined"!=typeof a.min&&Ff.axis.min(a.min))},Ff.legend.show=function(a){xf(Dc(a)),jf({withLegend:!0})},Ff.legend.hide=function(a){yf(Dc(a)),jf({withLegend:!0})},Ff.resize=function(a){If=a?a.width:null,Jf=a?a.height:null,of({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Ff.destroy=function(){Ff.data.targets=void 0,Ff.data.xs={},tj.html(""),a.onresize=null},"url"in e.data)Ef.xhr(e.data.url,function(a,b){var c,d=Ef.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Ef.csv.parse(b.response),bf(c)});else if("rows"in e.data)bf(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");bf(uc(e.data.columns))}return Ff},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file +i&&j&&Ug(c)&&k&&h(!1,e.classed(f.SELECTED,!1),c,d)})},Ff.toLine=function(a){Df(a,"line")},Ff.toSpline=function(a){Df(a,"spline")},Ff.toBar=function(a){Df(a,"bar")},Ff.toScatter=function(a){Df(a,"scatter")},Ff.toArea=function(a){Df(a,"area")},Ff.toAreaSpline=function(a){Df(a,"area-spline")},Ff.toPie=function(a){Df(a,"pie",{withTransform:!0})},Ff.toDonut=function(a){Df(a,"donut",{withTransform:!0})},Ff.groups=function(a){return c(a)?Ig:(Ig=a,jf(),Ig)},Ff.xgrids=function(a){return a?(Xh=a,jf(),Xh):Xh},Ff.xgrids.add=function(a){return a?Ff.xgrids(Xh.concat(a)):void 0},Ff.xgrids.remove=function(a){var b=Cf(a);return Ff.xgrids(Xh.filter(b))},Ff.ygrids=function(a){return a?(Zh=a,jf(),Zh):Zh},Ff.ygrids.add=function(a){return a?Ff.ygrids(Zh.concat(a)):void 0},Ff.ygrids.remove=function(a){var b=Cf(a);return Ff.ygrids(Zh.filter(b))},Ff.regions=function(a){return c(a)?vi:(vi=a,jf(),vi)},Ff.regions.add=function(a){return c(a)?vi:(vi=vi.concat(a),jf(),vi)},Ff.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;nj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),vi=vi.filter(function(b){return b.classes.indexOf(a)<0})}),vi},Ff.data.get=function(a){var b=Ff.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Ff.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},Ff.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Gg[b]=a[b]}),jf({withLegend:!0}),Gg):Gg},Ff.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Qg[b]=a[b]}),jf({withLegend:!0}),Qg):Qg},Ff.x=function(a){return arguments.length&&(qc(Ff.data.targets,a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ff.data.xs},Ff.xs=function(a){return arguments.length&&(rc(Ff.data.targets,a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ff.data.xs},Ff.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},Ff.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(xh=+a.x),b(a.y)&&(Eh=+a.y),b(a.y2)&&(Nh=+a.y2)):Eh=Nh=+a,jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Ff.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(yh=+a.x),b(a.y)&&(Fh=+a.y),b(a.y2)&&(Oh=+a.y2)):Fh=Oh=+a,jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Ff.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Ff.axis.max(a.max),"undefined"!=typeof a.min&&Ff.axis.min(a.min))},Ff.legend.show=function(a){xf(Dc(a)),jf({withLegend:!0})},Ff.legend.hide=function(a){yf(Dc(a)),jf({withLegend:!0})},Ff.resize=function(a){If=a?a.width:null,Jf=a?a.height:null,of({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Ff.destroy=function(){Ff.data.targets=void 0,Ff.data.xs={},tj.html(""),a.onresize=null},"url"in e.data)Ef.xhr(e.data.url,function(a,b){var c,d=Ef.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Ef.csv.parse(b.response),bf(c)});else if("rows"in e.data)bf(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");bf(uc(e.data.columns))}return Ff},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file diff --git a/htdocs/samples/api_axis_range.html b/htdocs/samples/api_axis_range.html new file mode 100644 index 0000000..c694c1b --- /dev/null +++ b/htdocs/samples/api_axis_range.html @@ -0,0 +1,83 @@ + + + + + +
+ + + + + + From ccfb296320de2cb7422690f04e0ed4e3558f7e99 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Sun, 4 May 2014 16:54:19 +0900 Subject: [PATCH 128/178] Fix x domain when only 1 data on category axis - #201 --- c3.js | 2 +- c3.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/c3.js b/c3.js index cd683a8..13d4949 100644 --- a/c3.js +++ b/c3.js @@ -1345,7 +1345,7 @@ padding = getXDomainPadding(targets), min = 0, max = 0; // show center of x domain if min and max are the same - if ((firstX - lastX) === 0) { + if ((firstX - lastX) === 0 && !isCategorized) { firstX = isTimeSeries ? new Date(firstX.getTime() * 0.5) : -0.5; lastX = isTimeSeries ? new Date(lastX.getTime() * 1.5) : 0.5; } diff --git a/c3.min.js b/c3.min.js index a181f94..9d9ae25 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.34"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",lines:"c3-lines",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",arcs:"c3-arcs",area:"c3-area",areas:"c3-areas",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",legendItemFocused:"c3-legend-item-focused",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;cZf&&(Zf=0),0>_f&&(_f=0),$f=kh?Wf.left-fj-gj:Zf,ag=kh?_f:cg-Xf.top-Xf.bottom,0>$f&&($f=0),0>ag&&(ag=0),p(),aj&&he(Ff.data.targets)&&(Yf.left=Zf/2+eg)}function o(){pj.select("line."+f.xgridFocus).attr("x1",kh?0:-10).attr("x2",kh?Zf:-10).attr("y1",kh?-10:Wf.top).attr("y2",kh?-10:_f)}function p(){eg=_f/2,dg=.95*eg,fg=ge(Ff.data.targets)?.6*dg:0}function q(){var a=kh?f.axisX:f.axisY,b=pj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Ef.select(Hf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return If?If:x()}function s(){var a=Jf?Jf:y();return a>0?a:320}function t(){return he(Ff.data.targets)?0:Kf?Kf:kh?lh?v("x"):1:!Dh||Ih?1:v("y")}function u(){var a=1;return he(Ff.data.targets)?0:Lf?Lf:aj?P()+20+(Mh&&!kh?v("y2"):a):Mh?Rh||kh?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||lh?"x"===a&&Ah?Ah:"y"!==a||Dh?"y2"!==a||Mh?(jb(a).isInner?30:40)+("y2"===a?-10:0):hj:eh&&!aj?10:1:0}function x(){return+Ef.select(Hf).style("width").replace("px","")}function y(){return+Ef.select(Hf).style("height").replace("px","")}function z(a){return a?-5:-(Wf.left-1)}function A(a){return a?-20:-4}function B(){return z(!kh)}function C(){return A(!kh)}function D(){return z(kh)}function E(){return A(kh)}function F(a){return a?Zf+2+4:Wf.left+20}function G(a){return a?(Ah?Ah:0)+80:_f+8}function H(){return F(!kh)}function I(){return G(!kh)}function J(){return F(kh)}function K(){return G(kh)}function L(){var a,b,c,d,e,f=Ac(Ff.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=sg(b.x)-sg(a.x),0===c?kh?_f:Zf:(d=zc(),e=de(Ff.data.targets)?(d-(Ki?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function M(a){bj=a}function N(a){cj=a}function O(a){dj=a}function P(){return eh?aj?cj*(bj+1):bg:0}function Q(){return eh?aj?cg:dj*(bj+1):0}function R(){var a,b,c=!sg;kg=kh?1:0,lg=kh?_f:Zf,mg=kh?0:_f,ng=kh?Zf:1,og=kg,pg=lg,qg=kh?0:ag,rg=kh?$f:1,sg=T(kg,lg,c?void 0:sg.domain(),function(){return yg.tickOffset()}),tg=U(mg,ng,c?void 0:tg.domain()),ug=U(mg,ng,c?void 0:ug.domain()),vg=T(kg,lg,uj,function(a){return a%1?0:Bg.tickOffset()}),wg=U(qg,rg,c?void 0:wg.domain()),xg=U(qg,rg,c?void 0:xg.domain()),a=$(),b=vh?vh:c?void 0:yg.tickValues(),yg=X(sg,Xi,a,b),Bg=X(vg,$i,a,b),zg=Y(tg,Yi,Jh,Lh),Ag=Y(ug,Zi,Sh,Uh),c||(ij.scale(vg),Of&&mj.scale(sg)),S()}function S(){gg=Gb(),hg=Hb(),ig=Hb(.98)}function T(a,b,d,e){var f=(Ji?Ef.time.scale():Ef.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Ki){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=Ef.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?ug:tg}function W(a){return"y2"===Z(a)?xg:wg}function X(a,b,c,d){var e=(Ki?Eb():Ef.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Ki?(e.tickCentered(ph),Ae(rh)&&(rh=!1)):e.tickOffset=function(){var a=Bc(Ff.data.targets),b=sg(a[1])-sg(a[0]),c=b?b:kh?_f:Zf;return c/zc()/2},Ki&&e.categories(oh),e}function Y(a,b,c,d){return Ef.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Jg?Jg[a]:"y"}function $(){var a=Ji?Ui:Ki?Tc:function(a){return 0>a?a.toFixed(0):a};return qh&&("function"==typeof qh?a=qh:Ji&&(a=function(a){return a?Ti(qh)(a):""})),a}function _(a){var b;return"y"===a?b=Hh:"y2"===a?b=Qh:"x"===a&&(b=Ch),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Hh=b:"y2"===a?Qh=b:"x"===a&&(Ch=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",kh?"inner-top":"inner-right")}function hb(){return fb("y",kh?"inner-right":"inner-top")}function ib(){return fb("y2",kh?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Zf/2:Zf:b.isBottom?-_f:b.isMiddle?-_f/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!kh,gb())}function rb(){return nb(kh,hb())}function sb(){return nb(kh,ib())}function tb(){return ob(!kh,gb())}function ub(){return ob(kh,hb())}function vb(){return ob(kh,ib())}function wb(){var a=gb();return kh?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":Ah?Ah-10:"3em"}function xb(){var a=hb();return kh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return kh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!kh,gb())}function Ab(){return pb(kh,hb())}function Bb(){return pb(kh,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return Ef.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(a){var b=pj.select("."+f.axisX+" ."+f.axisXLabel),c=pj.select("."+f.axisY+" ."+f.axisYLabel),d=pj.select("."+f.axisY2+" ."+f.axisY2Label);(a?b.transition():b).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),(a?c.transition():c).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),(a?d.transition():d).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 Ef.min(Object.keys(i).map(function(a){return Ef.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(Ig.length>0)for(g=Sc(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 Ef.max(Object.keys(i).map(function(a){return Ef.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Oh:Fh,n="y2"===c?Nh:Eh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Ph:Gh,r=xd()&&kh;return 0===l.length?"y2"===c?ug.domain():tg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=yd(o,p),j=ac(tg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Kh&&(f=b(Kh.top)?Kh.top:e,g=b(Kh.bottom)?Kh.bottom:e),"y2"===c&&Th&&(f=b(Th.top)?Th.top:e,g=b(Th.bottom)?Th.bottom:e),de(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return yh?Ji?we(yh):yh:Ef.min(a,function(a){return Ef.min(a.values,function(a){return a.x})})}function Zb(a){return xh?Ji?we(xh):xh:Ef.max(a,function(a){return Ef.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Ki?d=0:de(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof zh&&Be(zh)?(e=b(zh.left)?zh.left:d,f=b(zh.right)?zh.right:d):e=f="number"==typeof zh?zh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return c-d===0&&(c=Ji?new Date(.5*c.getTime()):-.5,d=Ji?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Ji?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Ji?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?tg:ug;return b="y"===a.axis||"y2"===a.axis?kh?_f:"start"in a?d(a.start):_f:kh?"end"in a?sg(Ji?we(a.end):a.end):_f:_f,c>b?0:b-c}function ic(a){return Cg&&a===Cg||Be(Dg)&&Ce(Dg,a)}function jc(a){return!ic(a)}function kc(a){return Cg?Cg:Be(Dg)?Dg[a]:null}function lc(a,b){var c,d=b&&Be(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=Ff.data.xs[b])}),c}function mc(a,b){return a in Ff.data.xs&&Ff.data.xs[a]&&Ff.data.xs[a][b]?Ff.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){Dg[b]=a[b]})}function oc(a){return 1===Ef.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=Gg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),Ff.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=Ji?a?a instanceof Date?a:we(a):we(mc(c,d)):Li&&!Ki?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Ff.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Cg?(d=Object.keys(Ff.data.xs),Ff.data.xs[c]=d.length>0?Ff.data.xs[d[0]]:void 0):Be(Dg)&&(Ff.data.xs[c]=lc(f,Ff.data.targets)):Ff.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Ff.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Fg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Li&&Ki&&0===c&&g&&(0===e&&(oh=[]),oh.push(g)),("undefined"==typeof a[b]||Ff.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Kg&&be(Cc(c).filter(function(a){return!(a in Lg)}),Kg),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&Ff.data.targets[0].values[a-1]?Ff.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(Ff.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Ji?new Date(i):i);j.push(e)}return Ji||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Vi=Vi.concat(a)}function Mc(a){Vi=Vi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Wi=Wi.concat(a)}function Oc(a){Wi=Wi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Jd(a,f))),(a[g].x||0===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=De(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Nd(a,b){return Ef.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Od(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 Pd(){return Ng&&"desc"===Ng.toLowerCase()}function Qd(){return Ng&&"asc"===Ng.toLowerCase()}function Rd(a){var b=Qd(),c=Pd();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 Ng&&a.sort(Ng),a}function Sd(a,c){var d,e,f,g,h,i,j,k=he(Ff.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&wi&&(sj.html(zi(a,$(),zd(k),Si)).style("display","block"),d=sj.property("offsetWidth"),e=sj.property("offsetHeight"),k?(g=Zf/2+c[0],i=_f/2+c[1]+20):(kh?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=sg(l[0].x)+20):(f=q(),g=f+t()+sg(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),sj.style("top",i+"px").style("left",g+"px"))}function Td(){sj.style("display","none")}function Ud(a){var c=a.filter(function(a){return a&&b(a.value)});wi&&(ee(Ff.data.targets)||he(Ff.data.targets)||pj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(kh?"y1":"x1",Fd).attr(kh?"y2":"x2",Fd))}function Vd(){pj.select("line."+f.xgridFocus).style("visibility","hidden")}function Wd(a){return a.x||0===a.x?sg(a.x):null}function Xd(a){return V(a.id)(a.value)}function Yd(){var a,b,d={},e=0;return Ic(Fc(ke)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ae(a,b){return"number"==typeof gi?gi:b?2*a.tickOffset()*hi/b:0}function be(a,b){Dc(a).forEach(function(a){wj[a]=b===Lg[a],Lg[a]=b})}function ce(a,b){var c=!1;return a.forEach(function(a){Lg[a.id]===b&&(c=!0),a.id in Lg||"line"!==b||(c=!0)}),c}function de(a){return ce(a,"bar")}function ee(a){return ce(a,"scatter")}function fe(a){return ce(a,"pie")}function ge(a){return ce(a,"donut")}function he(a){return fe(a)||ge(a)}function ie(a){var b="string"==typeof a?a:a.id;return!(b in Lg)||"line"===Lg[b]||"spline"===Lg[b]||"area"===Lg[b]||"area-spline"===Lg[b]}function je(a){var b="string"==typeof a?a:a.id;return"spline"===Lg[b]||"area-spline"===Lg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"bar"===Lg[b]}function le(a){var b="string"==typeof a?a:a.id;return"scatter"===Lg[b]}function me(a){var b="string"==typeof a?a:a.id;return"pie"===Lg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"donut"===Lg[b]}function oe(a){return me(a)||ne(a)}function pe(a){return ie(a)?[a]:[]}function qe(a){return oe(a.data)?[a]:[]}function re(a){return ke(a)?a.values:[]}function se(a){return ie(a)||le(a)?a.values:[]}function te(a){return ke(a)||ie(a)?a.values:[]}function ue(a){return ne(a)&&qi||me(a)&&ki}function ve(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function we(b){var c;try{c=Eg?Ef.time.format(Eg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Eg)}return c}function xe(a,b){var c=Ef.mouse(a),d=Ef.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ce(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function De(a,b){var c="y"===Z(a.id)?tg:ug,d=kh?1:0,e=kh?0:1;return Math.pow(sg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ee(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Fe(a,b,c){Zg(b,a.node()),pj.select("."+f.selectedCircles+od(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",kh?Xd:Wd).attr("cy",kh?Wd:Xd).attr("stroke",function(){return Si(b)}).attr("r",1.4*Qe(b)).transition().duration(100).attr("r",Qe)}function Ge(a,b,c){$g(b,a.node()),pj.select("."+f.selectedCircles+od(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function He(a,b,c,d){a?Fe(b,c,d):Ge(b,c,d)}function Ie(a,b){Zg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ef.rgb(Si(b)).brighter(.75)})}function Je(a,b){$g(b,a.node()),a.transition().duration(100).style("fill",function(){return Si(b)})}function Ke(a,b,c,d){a?Ie(b,c,d):Je(b,c,d)}function Le(a,b,c,d){Ke(a,b,c.data,d)}function Me(a){return"circle"===a.nodeName?He:Ef.select(a).classed(f.bar)?Ke:Le}function Ne(a){return a.filter(function(a){return b(a.value)})}function Oe(a){return _h?"function"==typeof ai?ai(a):ai:0}function Pe(a){return ci?di?di:1.75*Oe(a):Oe(a)}function Qe(a){return ei?ei:4*Oe(a)}function Re(a,c){return(c?pj.selectAll("."+f.circles+od(c)):pj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Se(a,b){Re(a,b).classed(f.EXPANDED,!0).attr("r",Pe)}function Te(a){Re(a).filter(function(){return Ef.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oe)}function Ue(a){return pj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ve(a){Ue(a).classed(f.EXPANDED,!0)}function We(a){Ue(a).classed(f.EXPANDED,!1)}function Xe(a,b){var c=_e(a,b);return function(a,b){var d=c(a,b),e=kh?1:0,f=kh?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 Ye(a,b){var c=_e(a,!1),d=b?Ze:$e;return function(a,b){return d(c(a,b),a,this)}}function Ze(a,b){var c;return kh?(c=ke(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function $e(a,b,c){var d=c.getBoundingClientRect();return kh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ke(b)?-3:-6)}function _e(a,b){var c=a.__max__+1,d=ae(yg,c),e=Zd(d,c,a,!!b),f=$d(!!b),g=_d(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return kh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function af(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 bf(b){var c,d,e;if(tj=Ef.select(Hf),tj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(tj.html("").classed("c3",!0),Ff.data.xs={},Ff.data.targets=vc(b),Rg&&Lc(Rg===!0?Cc(Ff.data.targets):Rg),n(),R(),sg.domain(Ef.extent(_b(Ff.data.targets))),tg.domain(Xb(Ff.data.targets,"y")),ug.domain(Xb(Ff.data.targets,"y2")),vg.domain(sg.domain()),wg.domain(tg.domain()),xg.domain(ug.domain()),uj=sg.domain(),ij.scale(vg),Of&&mj.scale(sg),nj=tj.append("svg").on("mouseenter",Rf).on("mouseleave",Sf),oj=nj.append("defs"),oj.append("clipPath").attr("id",Di).append("rect"),oj.append("clipPath").attr("id",Ei).append("rect"),oj.append("clipPath").attr("id",Fi).append("rect"),nf(),pj=nj.append("g").attr("transform",_i.main),qj=nj.append("g").attr("transform",_i.context),rj=nj.append("g").attr("transform",_i.legend),bh||qj.style("visibility","hidden"),eh||(rj.style("visibility","hidden"),Wi=Cc(Ff.data.targets)),sj=Ef.select(Hf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),zf(Cc(Ff.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=pj.append("g").attr("clip-path",Gi).attr("class",f.grid),Vh&&d.append("g").attr("class",f.xgrids),Be(Xh)&&d.append("g").attr("class",f.xgridLines),bi&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Yh&&d.append("g").attr("class",f.ygrids),Be(Zh)&&d.append("g").attr("class",f.ygridLines),lh&&pj.append("g").attr("class",f.axisX).attr("clip-path",Hi).attr("transform",_i.x).append("text").attr("class",f.axisXLabel).attr("transform",kh?"rotate(-90)":"").style("text-anchor",zb),Dh&&pj.append("g").attr("class",f.axisY).attr("clip-path",Ii).attr("transform",_i.y).append("text").attr("class",f.axisYLabel).attr("transform",kh?"":"rotate(-90)").style("text-anchor",Ab),Mh&&pj.append("g").attr("class",f.axisY2).attr("transform",_i.y2).append("text").attr("class",f.axisY2Label).attr("transform",kh?"":"rotate(-90)").style("text-anchor",Bb),pj.append("g").attr("clip-path",Gi).attr("class",f.regions),pj.append("g").attr("clip-path",Gi).attr("class",f.chart),c=pj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Of?kh?"ns-resize":"ew-resize":null),pj.select("."+f.chart).append("g").attr("class",f.chartBars),pj.select("."+f.chart).append("g").attr("class",f.chartLines),pj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",_i.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),pj.select("."+f.chart).append("g").attr("class",f.chartTexts),Of&&pj.insert("rect",Qf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Zf).attr("height",_f).style("opacity",0).style("cursor",kh?"ns-resize":"ew-resize").call(mj).on("dblclick.zoom",null),Bh&&ij.extent("function"!=typeof Bh?Bh:Bh(_b())),qj.append("g").attr("clip-path",Gi).attr("class",f.chart),qj.select("."+f.chart).append("g").attr("class",f.chartBars),qj.select("."+f.chart).append("g").attr("class",f.chartLines),qj.append("g").attr("clip-path",Gi).attr("class",f.brush).call(ij).selectAll("rect").attr(kh?"width":"height",kh?$f:ag),qj.append("g").attr("class",f.axisX).attr("transform",_i.subx).attr("clip-path",kh?"":Hi),pf(Ff.data.targets),kh?pj.select("."+f.axisX).style("opacity",0).call(yg):(pj.select("."+f.axisY).style("opacity",0).call(zg),pj.select("."+f.axisY2).style("opacity",0).call(Ag)),n(),R(),nf(),m(!1),jf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Ai){if(Ji&&"string"==typeof Bi){for(Bi=we(Bi),e=0;eZf&&(Zf=0),0>_f&&(_f=0),$f=kh?Wf.left-fj-gj:Zf,ag=kh?_f:cg-Xf.top-Xf.bottom,0>$f&&($f=0),0>ag&&(ag=0),p(),aj&&he(Ff.data.targets)&&(Yf.left=Zf/2+eg)}function o(){pj.select("line."+f.xgridFocus).attr("x1",kh?0:-10).attr("x2",kh?Zf:-10).attr("y1",kh?-10:Wf.top).attr("y2",kh?-10:_f)}function p(){eg=_f/2,dg=.95*eg,fg=ge(Ff.data.targets)?.6*dg:0}function q(){var a=kh?f.axisX:f.axisY,b=pj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Ef.select(Hf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return If?If:x()}function s(){var a=Jf?Jf:y();return a>0?a:320}function t(){return he(Ff.data.targets)?0:Kf?Kf:kh?lh?v("x"):1:!Dh||Ih?1:v("y")}function u(){var a=1;return he(Ff.data.targets)?0:Lf?Lf:aj?P()+20+(Mh&&!kh?v("y2"):a):Mh?Rh||kh?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||lh?"x"===a&&Ah?Ah:"y"!==a||Dh?"y2"!==a||Mh?(jb(a).isInner?30:40)+("y2"===a?-10:0):hj:eh&&!aj?10:1:0}function x(){return+Ef.select(Hf).style("width").replace("px","")}function y(){return+Ef.select(Hf).style("height").replace("px","")}function z(a){return a?-5:-(Wf.left-1)}function A(a){return a?-20:-4}function B(){return z(!kh)}function C(){return A(!kh)}function D(){return z(kh)}function E(){return A(kh)}function F(a){return a?Zf+2+4:Wf.left+20}function G(a){return a?(Ah?Ah:0)+80:_f+8}function H(){return F(!kh)}function I(){return G(!kh)}function J(){return F(kh)}function K(){return G(kh)}function L(){var a,b,c,d,e,f=Ac(Ff.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=sg(b.x)-sg(a.x),0===c?kh?_f:Zf:(d=zc(),e=de(Ff.data.targets)?(d-(Ki?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function M(a){bj=a}function N(a){cj=a}function O(a){dj=a}function P(){return eh?aj?cj*(bj+1):bg:0}function Q(){return eh?aj?cg:dj*(bj+1):0}function R(){var a,b,c=!sg;kg=kh?1:0,lg=kh?_f:Zf,mg=kh?0:_f,ng=kh?Zf:1,og=kg,pg=lg,qg=kh?0:ag,rg=kh?$f:1,sg=T(kg,lg,c?void 0:sg.domain(),function(){return yg.tickOffset()}),tg=U(mg,ng,c?void 0:tg.domain()),ug=U(mg,ng,c?void 0:ug.domain()),vg=T(kg,lg,uj,function(a){return a%1?0:Bg.tickOffset()}),wg=U(qg,rg,c?void 0:wg.domain()),xg=U(qg,rg,c?void 0:xg.domain()),a=$(),b=vh?vh:c?void 0:yg.tickValues(),yg=X(sg,Xi,a,b),Bg=X(vg,$i,a,b),zg=Y(tg,Yi,Jh,Lh),Ag=Y(ug,Zi,Sh,Uh),c||(ij.scale(vg),Of&&mj.scale(sg)),S()}function S(){gg=Gb(),hg=Hb(),ig=Hb(.98)}function T(a,b,d,e){var f=(Ji?Ef.time.scale():Ef.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Ki){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=Ef.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?ug:tg}function W(a){return"y2"===Z(a)?xg:wg}function X(a,b,c,d){var e=(Ki?Eb():Ef.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Ki?(e.tickCentered(ph),Ae(rh)&&(rh=!1)):e.tickOffset=function(){var a=Bc(Ff.data.targets),b=sg(a[1])-sg(a[0]),c=b?b:kh?_f:Zf;return c/zc()/2},Ki&&e.categories(oh),e}function Y(a,b,c,d){return Ef.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Jg?Jg[a]:"y"}function $(){var a=Ji?Ui:Ki?Tc:function(a){return 0>a?a.toFixed(0):a};return qh&&("function"==typeof qh?a=qh:Ji&&(a=function(a){return a?Ti(qh)(a):""})),a}function _(a){var b;return"y"===a?b=Hh:"y2"===a?b=Qh:"x"===a&&(b=Ch),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Hh=b:"y2"===a?Qh=b:"x"===a&&(Ch=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(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 gb(){return fb("x",kh?"inner-top":"inner-right")}function hb(){return fb("y",kh?"inner-right":"inner-top")}function ib(){return fb("y2",kh?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Zf/2:Zf:b.isBottom?-_f:b.isMiddle?-_f/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!kh,gb())}function rb(){return nb(kh,hb())}function sb(){return nb(kh,ib())}function tb(){return ob(!kh,gb())}function ub(){return ob(kh,hb())}function vb(){return ob(kh,ib())}function wb(){var a=gb();return kh?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":Ah?Ah-10:"3em"}function xb(){var a=hb();return kh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return kh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!kh,gb())}function Ab(){return pb(kh,hb())}function Bb(){return pb(kh,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return Ef.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(a){var b=pj.select("."+f.axisX+" ."+f.axisXLabel),c=pj.select("."+f.axisY+" ."+f.axisYLabel),d=pj.select("."+f.axisY2+" ."+f.axisY2Label);(a?b.transition():b).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),(a?c.transition():c).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),(a?d.transition():d).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){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){return a0)for(g=Rc(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 Ef.min(Object.keys(i).map(function(a){return Ef.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(Ig.length>0)for(g=Sc(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 Ef.max(Object.keys(i).map(function(a){return Ef.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Oh:Fh,n="y2"===c?Nh:Eh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Ph:Gh,r=xd()&&kh;return 0===l.length?"y2"===c?ug.domain():tg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=yd(o,p),j=ac(tg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Kh&&(f=b(Kh.top)?Kh.top:e,g=b(Kh.bottom)?Kh.bottom:e),"y2"===c&&Th&&(f=b(Th.top)?Th.top:e,g=b(Th.bottom)?Th.bottom:e),de(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return yh?Ji?we(yh):yh:Ef.min(a,function(a){return Ef.min(a.values,function(a){return a.x})})}function Zb(a){return xh?Ji?we(xh):xh:Ef.max(a,function(a){return Ef.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Ki?d=0:de(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof zh&&Be(zh)?(e=b(zh.left)?zh.left:d,f=b(zh.right)?zh.right:d):e=f="number"==typeof zh?zh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return c-d!==0||Ki||(c=Ji?new Date(.5*c.getTime()):-.5,d=Ji?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Ji?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Ji?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?tg:ug;return b="y"===a.axis||"y2"===a.axis?kh?_f:"start"in a?d(a.start):_f:kh?"end"in a?sg(Ji?we(a.end):a.end):_f:_f,c>b?0:b-c}function ic(a){return Cg&&a===Cg||Be(Dg)&&Ce(Dg,a)}function jc(a){return!ic(a)}function kc(a){return Cg?Cg:Be(Dg)?Dg[a]:null}function lc(a,b){var c,d=b&&Be(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=Ff.data.xs[b])}),c}function mc(a,b){return a in Ff.data.xs&&Ff.data.xs[a]&&Ff.data.xs[a][b]?Ff.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){Dg[b]=a[b]})}function oc(a){return 1===Ef.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=Gg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),Ff.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=Ji?a?a instanceof Date?a:we(a):we(mc(c,d)):Li&&!Ki?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Ff.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Cg?(d=Object.keys(Ff.data.xs),Ff.data.xs[c]=d.length>0?Ff.data.xs[d[0]]:void 0):Be(Dg)&&(Ff.data.xs[c]=lc(f,Ff.data.targets)):Ff.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Ff.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Fg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Li&&Ki&&0===c&&g&&(0===e&&(oh=[]),oh.push(g)),("undefined"==typeof a[b]||Ff.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Kg&&be(Cc(c).filter(function(a){return!(a in Lg)}),Kg),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&Ff.data.targets[0].values[a-1]?Ff.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(Ff.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Ji?new Date(i):i);j.push(e)}return Ji||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Vi=Vi.concat(a)}function Mc(a){Vi=Vi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Wi=Wi.concat(a)}function Oc(a){Wi=Wi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Jd(a,f))),(a[g].x||0===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=De(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Nd(a,b){return Ef.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Od(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 Pd(){return Ng&&"desc"===Ng.toLowerCase()}function Qd(){return Ng&&"asc"===Ng.toLowerCase()}function Rd(a){var b=Qd(),c=Pd();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 Ng&&a.sort(Ng),a}function Sd(a,c){var d,e,f,g,h,i,j,k=he(Ff.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&wi&&(sj.html(zi(a,$(),zd(k),Si)).style("display","block"),d=sj.property("offsetWidth"),e=sj.property("offsetHeight"),k?(g=Zf/2+c[0],i=_f/2+c[1]+20):(kh?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=sg(l[0].x)+20):(f=q(),g=f+t()+sg(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),sj.style("top",i+"px").style("left",g+"px"))}function Td(){sj.style("display","none")}function Ud(a){var c=a.filter(function(a){return a&&b(a.value)});wi&&(ee(Ff.data.targets)||he(Ff.data.targets)||pj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(kh?"y1":"x1",Fd).attr(kh?"y2":"x2",Fd))}function Vd(){pj.select("line."+f.xgridFocus).style("visibility","hidden")}function Wd(a){return a.x||0===a.x?sg(a.x):null}function Xd(a){return V(a.id)(a.value)}function Yd(){var a,b,d={},e=0;return Ic(Fc(ke)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ae(a,b){return"number"==typeof gi?gi:b?2*a.tickOffset()*hi/b:0}function be(a,b){Dc(a).forEach(function(a){wj[a]=b===Lg[a],Lg[a]=b})}function ce(a,b){var c=!1;return a.forEach(function(a){Lg[a.id]===b&&(c=!0),a.id in Lg||"line"!==b||(c=!0)}),c}function de(a){return ce(a,"bar")}function ee(a){return ce(a,"scatter")}function fe(a){return ce(a,"pie")}function ge(a){return ce(a,"donut")}function he(a){return fe(a)||ge(a)}function ie(a){var b="string"==typeof a?a:a.id;return!(b in Lg)||"line"===Lg[b]||"spline"===Lg[b]||"area"===Lg[b]||"area-spline"===Lg[b]}function je(a){var b="string"==typeof a?a:a.id;return"spline"===Lg[b]||"area-spline"===Lg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"bar"===Lg[b]}function le(a){var b="string"==typeof a?a:a.id;return"scatter"===Lg[b]}function me(a){var b="string"==typeof a?a:a.id;return"pie"===Lg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"donut"===Lg[b]}function oe(a){return me(a)||ne(a)}function pe(a){return ie(a)?[a]:[]}function qe(a){return oe(a.data)?[a]:[]}function re(a){return ke(a)?a.values:[]}function se(a){return ie(a)||le(a)?a.values:[]}function te(a){return ke(a)||ie(a)?a.values:[]}function ue(a){return ne(a)&&qi||me(a)&&ki}function ve(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function we(b){var c;try{c=Eg?Ef.time.format(Eg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Eg)}return c}function xe(a,b){var c=Ef.mouse(a),d=Ef.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ce(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function De(a,b){var c="y"===Z(a.id)?tg:ug,d=kh?1:0,e=kh?0:1;return Math.pow(sg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ee(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Fe(a,b,c){Zg(b,a.node()),pj.select("."+f.selectedCircles+od(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",kh?Xd:Wd).attr("cy",kh?Wd:Xd).attr("stroke",function(){return Si(b)}).attr("r",1.4*Qe(b)).transition().duration(100).attr("r",Qe)}function Ge(a,b,c){$g(b,a.node()),pj.select("."+f.selectedCircles+od(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function He(a,b,c,d){a?Fe(b,c,d):Ge(b,c,d)}function Ie(a,b){Zg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ef.rgb(Si(b)).brighter(.75)})}function Je(a,b){$g(b,a.node()),a.transition().duration(100).style("fill",function(){return Si(b)})}function Ke(a,b,c,d){a?Ie(b,c,d):Je(b,c,d)}function Le(a,b,c,d){Ke(a,b,c.data,d)}function Me(a){return"circle"===a.nodeName?He:Ef.select(a).classed(f.bar)?Ke:Le}function Ne(a){return a.filter(function(a){return b(a.value)})}function Oe(a){return _h?"function"==typeof ai?ai(a):ai:0}function Pe(a){return ci?di?di:1.75*Oe(a):Oe(a)}function Qe(a){return ei?ei:4*Oe(a)}function Re(a,c){return(c?pj.selectAll("."+f.circles+od(c)):pj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Se(a,b){Re(a,b).classed(f.EXPANDED,!0).attr("r",Pe)}function Te(a){Re(a).filter(function(){return Ef.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oe)}function Ue(a){return pj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ve(a){Ue(a).classed(f.EXPANDED,!0)}function We(a){Ue(a).classed(f.EXPANDED,!1)}function Xe(a,b){var c=_e(a,b);return function(a,b){var d=c(a,b),e=kh?1:0,f=kh?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 Ye(a,b){var c=_e(a,!1),d=b?Ze:$e;return function(a,b){return d(c(a,b),a,this)}}function Ze(a,b){var c;return kh?(c=ke(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function $e(a,b,c){var d=c.getBoundingClientRect();return kh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ke(b)?-3:-6)}function _e(a,b){var c=a.__max__+1,d=ae(yg,c),e=Zd(d,c,a,!!b),f=$d(!!b),g=_d(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return kh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function af(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 bf(b){var c,d,e;if(tj=Ef.select(Hf),tj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(tj.html("").classed("c3",!0),Ff.data.xs={},Ff.data.targets=vc(b),Rg&&Lc(Rg===!0?Cc(Ff.data.targets):Rg),n(),R(),sg.domain(Ef.extent(_b(Ff.data.targets))),tg.domain(Xb(Ff.data.targets,"y")),ug.domain(Xb(Ff.data.targets,"y2")),vg.domain(sg.domain()),wg.domain(tg.domain()),xg.domain(ug.domain()),uj=sg.domain(),ij.scale(vg),Of&&mj.scale(sg),nj=tj.append("svg").on("mouseenter",Rf).on("mouseleave",Sf),oj=nj.append("defs"),oj.append("clipPath").attr("id",Di).append("rect"),oj.append("clipPath").attr("id",Ei).append("rect"),oj.append("clipPath").attr("id",Fi).append("rect"),nf(),pj=nj.append("g").attr("transform",_i.main),qj=nj.append("g").attr("transform",_i.context),rj=nj.append("g").attr("transform",_i.legend),bh||qj.style("visibility","hidden"),eh||(rj.style("visibility","hidden"),Wi=Cc(Ff.data.targets)),sj=Ef.select(Hf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),zf(Cc(Ff.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=pj.append("g").attr("clip-path",Gi).attr("class",f.grid),Vh&&d.append("g").attr("class",f.xgrids),Be(Xh)&&d.append("g").attr("class",f.xgridLines),bi&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Yh&&d.append("g").attr("class",f.ygrids),Be(Zh)&&d.append("g").attr("class",f.ygridLines),lh&&pj.append("g").attr("class",f.axisX).attr("clip-path",Hi).attr("transform",_i.x).append("text").attr("class",f.axisXLabel).attr("transform",kh?"rotate(-90)":"").style("text-anchor",zb),Dh&&pj.append("g").attr("class",f.axisY).attr("clip-path",Ii).attr("transform",_i.y).append("text").attr("class",f.axisYLabel).attr("transform",kh?"":"rotate(-90)").style("text-anchor",Ab),Mh&&pj.append("g").attr("class",f.axisY2).attr("transform",_i.y2).append("text").attr("class",f.axisY2Label).attr("transform",kh?"":"rotate(-90)").style("text-anchor",Bb),pj.append("g").attr("clip-path",Gi).attr("class",f.regions),pj.append("g").attr("clip-path",Gi).attr("class",f.chart),c=pj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Of?kh?"ns-resize":"ew-resize":null),pj.select("."+f.chart).append("g").attr("class",f.chartBars),pj.select("."+f.chart).append("g").attr("class",f.chartLines),pj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",_i.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),pj.select("."+f.chart).append("g").attr("class",f.chartTexts),Of&&pj.insert("rect",Qf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Zf).attr("height",_f).style("opacity",0).style("cursor",kh?"ns-resize":"ew-resize").call(mj).on("dblclick.zoom",null),Bh&&ij.extent("function"!=typeof Bh?Bh:Bh(_b())),qj.append("g").attr("clip-path",Gi).attr("class",f.chart),qj.select("."+f.chart).append("g").attr("class",f.chartBars),qj.select("."+f.chart).append("g").attr("class",f.chartLines),qj.append("g").attr("clip-path",Gi).attr("class",f.brush).call(ij).selectAll("rect").attr(kh?"width":"height",kh?$f:ag),qj.append("g").attr("class",f.axisX).attr("transform",_i.subx).attr("clip-path",kh?"":Hi),pf(Ff.data.targets),kh?pj.select("."+f.axisX).style("opacity",0).call(yg):(pj.select("."+f.axisY).style("opacity",0).call(zg),pj.select("."+f.axisY2).style("opacity",0).call(Ag)),n(),R(),nf(),m(!1),jf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Ai){if(Ji&&"string"==typeof Bi){for(Bi=we(Bi),e=0;e0){d=[];for(var g in Gg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Od(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ke,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 gf(a){he(Ff.data.targets)||Sg&&(Mi=a,pj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ni=!0,_g())}function hf(){he(Ff.data.targets)||Sg&&(pj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),pj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ni=!1,ah())}function jf(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z=Yd(),$=he(Ff.data.targets),_=Ic(Ff.data.targets);if(a=d(a)?a:{},E=d(a.withY)?a.withY:!0,F=d(a.withSubchart)?a.withSubchart:!0,G=d(a.withTransition)?a.withTransition:!0,J=d(a.withTransform)?a.withTransform:!1,K=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,M=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,N=d(a.withLegend)?a.withLegend:!1,H=d(a.withTransitionForExit)?a.withTransitionForExit:G,I=d(a.withTransitionForAxis)?a.withTransitionForAxis:G,T=G?Vf:0,U=H?T:0,V=I?T:0,c=pj.select("."+f.axisX).style("opacity",$?0:1),g=pj.select("."+f.axisY).style("opacity",$?0:1),h=pj.select("."+f.axisY2).style("opacity",$?0:1),e=qj.select("."+f.axisX).style("opacity",$?0:1),S={axisX:c.transition().duration(V),axisY:g.transition().duration(V),axisY2:h.transition().duration(V),axisSubX:e.transition().duration(V)},N&&eh&&zf(Cc(Ff.data.targets),a,S),Ki&&(0!==_.length&&M&&K||sg.domain([0,c.selectAll(".tick").size()])),_.length&&(M&&(sg.domain(Ef.extent(_b(_))),uj=sg.domain(),Of&&mj.scale(sg).updateScaleExtent(),vg.domain(sg.domain()),ij.scale(vg)),K&&(sg.domain(ij.empty()?uj:ij.extent()),Of&&mj.scale(sg).updateScaleExtent()),vh||!uh&&!th||(W=Kc(Jc(_),th),yg.tickValues(W),Bg.tickValues(W))),tg.domain(Xb(_,"y")),ug.domain(Xb(_,"y2")),S.axisX.call(yg),S.axisY.call(zg),S.axisY2.call(Ag),S.axisSubX.call(Bg),Db(G),K&&_.length)if(rh&&W){for(X=1;X=0&&Ef.select(this).style("display",b%Y?"none":"block")})}else nj.selectAll("."+f.axisX+" .tick text").style("display","block");if(!kh&&wh&&eb(c,S.axisX,wh),O=Xe(Z),Q=Ye(Z,!0),R=Ye(Z,!1),wg.domain(tg.domain()),xg.domain(ug.domain()),sj.style("display","none"),o(),pj.select("line."+f.xgridFocus).style("visibility","hidden"),Vh){if("year"===Wh){j=[];for(var ab=_b(),bb=ab[0].getFullYear(),cb=ab[1].getFullYear(),db=bb;cb>=db;db++)j.push(new Date(db+"-01-01 00:00:00"))}else j=sg.ticks(10);i=pj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",kh?0:function(a){return sg(a)-yg.tickOffset()}).attr("x2",kh?Zf:function(a){return sg(a)-yg.tickOffset()}).attr("y1",kh?function(a){return sg(a)-yg.tickOffset()}:Wf.top).attr("y2",kh?function(a){return sg(a)-yg.tickOffset()}:_f).style("opacity",function(){return+Ef.select(this).attr(kh?"y1":"x1")===(kh?_f:0)?0:1}),i.exit().remove()}Be(Xh)&&(k=pj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Xh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",kh?"":"rotate(-90)").attr("dx",kh?0:-Wf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",kh?0:Gd).attr("x2",kh?Zf:Gd).attr("y1",kh?Gd:Wf.top).attr("y2",kh?Gd:_f).style("opacity",1),k.select("text").transition().duration(T).attr("x",kh?Zf:0).attr("y",Gd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),E&&Yh&&(m=pj.select("."+f.ygrids).selectAll("."+f.ygrid).data(tg.ticks($h)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",kh?tg:0).attr("x2",kh?tg:Zf).attr("y1",kh?0:tg).attr("y2",kh?_f:tg),m.exit().remove()),E&&Be(Zh)&&(n=pj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Zh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",kh?"rotate(-90)":"").attr("dx",kh?0:-Wf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(T).attr("x1",kh?Hd:0).attr("x2",kh?Hd:Zf).attr("y1",kh?0:Hd).attr("y2",kh?_f:Hd).style("opacity",1),n.select("text").transition().duration(T).attr("x",kh?0:Zf).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(T).style("opacity",0).remove()),v=pj.select("."+f.regions).selectAll("."+f.region).data(vi),v.enter().append("g").attr("class",hd).append("rect").style("fill-opacity",0),v.selectAll("rect").attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(T).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),v.exit().transition().duration(T).style("fill-opacity",0).remove(),t=pj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),t.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Si),t.style("opacity",td).transition().duration(T).attr("d",O).style("fill",Si).style("opacity",1),t.exit().transition().duration(U).style("opacity",0).remove(),q=pj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),q.enter().append("path").attr("class",Zc).style("stroke",Si),q.style("opacity",td).transition().duration(T).attr("d",jj).style("stroke",Si).style("opacity",1),q.exit().transition().duration(U).style("opacity",0).remove(),r=pj.selectAll("."+f.areas).selectAll("."+f.area).data(pe),r.enter().append("path").attr("class",fd).style("fill",Si).style("opacity",function(){return vj=+Ef.select(this).style("opacity"),0}),r.style("opacity",0).transition().duration(T).attr("d",kj).style("fill",Si).style("opacity",vj),r.exit().transition().duration(U).style("opacity",0).remove(),s=pj.selectAll("."+f.circles).selectAll("."+f.circle).data(se),s.enter().append("circle").attr("class",_c).attr("r",Oe).style("fill",Si),s.style("opacity",td).transition().duration(T).style("opacity",vd).style("fill",Si).attr("cx",kh?Xd:Wd).attr("cy",kh?Wd:Xd),s.exit().remove(),w=pj.selectAll("."+f.texts).selectAll("."+f.text).data(te),w.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return kh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",Si).style("fill-opacity",0),w.text(function(a){return Ed(a.id)(a.value,a.id)}).style("fill-opacity",ud).transition().duration(T).attr("x",Q).attr("y",R).style("fill",Si).style("fill-opacity",wd),w.exit().transition().duration(U).style("fill-opacity",0).remove(),u=pj.selectAll("."+f.arcs).selectAll("."+f.arc).data(qe),u.enter().append("path").attr("class",dd).style("fill",function(a){return Si(a.data)}).style("cursor",function(a){return Ug(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Qi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),vf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Sd(d,Ef.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Qi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),wf(),Td(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();ef(this,a,b),e(d,b)}),u.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Qi=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Fb(a);return c?(b=Ef.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("fill",function(a){return Si(a.data)}).style("opacity",1).call(Ee,function(){Qi=!1}),u.exit().transition().duration(U).style("opacity",0).remove(),pj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(T).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&oe(a.data)?1:0}),pj.select("."+f.chartArcsTitle).style("opacity",ge(Ff.data.targets)?1:0),bh&&(null!==Ef.event&&"zoom"===Ef.event.type&&ij.extent(sg.orgDomain()).update(),F&&(!kh&&wh&&eb(e,S.axisSubX,wh),ij.empty()||ij.extent(sg.orgDomain()).update(),P=Xe(Z,!0),y=qj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),y.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Si),y.style("opacity",td).transition().duration(T).attr("d",P).style("opacity",1),y.exit().transition().duration(T).style("opacity",0).remove(),x=qj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),x.enter().append("path").attr("class",Zc).style("stroke",Si),x.style("opacity",td).transition().duration(T).attr("d",lj).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove())),pj.selectAll("."+f.selectedCircles).filter(function(a){return ke(a)}).selectAll("circle").remove(),pj.selectAll("."+f.selectedCircle).transition().duration(T).attr("cx",kh?Xd:Wd).attr("cy",kh?Wd:Xd),z=pj.select("."+f.eventRects),Be(Dg)&&!oc(Dg)?(z.classed(f.eventRectsMultiple)||z.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),A=pj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),df(A.enter()),A.attr("x",0).attr("y",0).attr("width",Zf).attr("height",_f)):(z.classed(f.eventRectsSingle)||z.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Li&&!Ki?(D=function(a,b){var c=xc(b),d=yc(b),e=Ff.data.xs[a.id][b];return(sg(d?d:e+50)-sg(c?c:e-50))/2},C=function(a,b){var c=xc(b),d=Ff.data.xs[a.id][b];return(sg(d)+sg(c?c:d-50))/2}):(D=L(),C=function(a){return sg(a.x)-D/2}),B=Ac(Ff.data.targets),pj.select("."+f.eventRects).datum(B?B.values:[]),A=pj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),cf(A.enter()),A.attr("class",id).attr("x",kh?0:C).attr("y",kh?C:0).attr("width",kh?Zf:D).attr("height",kh?D:_f),A.exit().remove()),Cc(Ff.data.targets).forEach(function(a){wj[a]=!0})}function kf(){jf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function lf(){return"mousemove"===Ef.event.sourceEvent.type&&mj.altDomain?(sg.domain(mj.altDomain),void mj.scale(sg).updateScaleExtent()):(Ki&&sg.orgDomain()[0]===uj[0]&&sg.domain([uj[0]-1e-10,sg.orgDomain()[1]]),jf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Ef.event.sourceEvent.type&&(Oi=!0)))}function mf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function nf(){nj.attr("width",bg).attr("height",cg),nj.select("#"+Di).select("rect").attr("width",Zf).attr("height",_f),nj.select("#"+Ei).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),nj.select("#"+Fi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),nj.select("."+f.zoomRect).attr("width",Zf).attr("height",_f),tj.style("max-height",cg+"px")}function of(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),nf(),m(a.withTransition),jf(a)}function pf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=pj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",kd),j=i.enter().append("g").attr("class",kd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc),e=pj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",md),d=e.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",cd).style("cursor",function(a){return Ug(a)?"pointer":null}),c=pj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",ld),b=c.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",$c),b.append("g").attr("class",gd),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",ad).style("cursor",function(a){return Ug(a)?"pointer":null}),a.forEach(function(a){pj.selectAll("."+f.selectedCircles+od(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=pj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(jg(a)).attr("class",nd),g=h.enter().append("g").attr("class",nd),g.append("g").attr("class",ed),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),bh&&(n=qj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",md),m=n.enter().append("g").style("opacity",0).attr("class",md),m.append("g").attr("class",cd),l=qj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",ld),k=l.enter().append("g").style("opacity",0).attr("class",ld),k.append("g").attr("class",$c)),nj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Vf).style("opacity",1)}function qf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?be(a.id,b.types[a.id]):be(a.id,b.type)}),Ff.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=aj?j:i,l=aj?Q():P();return d&&(w=0,C=0,t=0,u=0),eh&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=aj?u:t,void(jh?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=rj.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,aj?(g=function(a){return t*B[a]},j=function(a){return A[B[a]]+x[a]}):(g=function(a){return A[B[a]]+x[a]},j=function(a){return u*B[a]}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=rj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof gh?gh(a):Ff.toggle(a)}).on("mouseover",function(a){Ef.select(this).classed(f.legendItemFocused,!0),Qi||Ff.focus(a),"function"==typeof hh&&hh(a)}).on("mouseout",function(a){Ef.select(this).classed(f.legendItemFocused,!1),Qi||Ff.revert(),"function"==typeof ih&&ih(a)}),o.append("text").text(function(a){return d(Gg[a])?Gg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",aj?h:-200).attr("y",aj?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",aj?i:-200).attr("y",aj?-200:l),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",Si).attr("x",aj?h:-200).attr("y",aj?-200:j).attr("width",10).attr("height",10),rj.selectAll("text").data(a).text(function(a){return d(Gg[a])?Gg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),rj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}).attr("x",i).attr("y",l),rj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).style("fill",Si).attr("x",g).attr("y",j),rj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=Ef.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?tf(b):uf(b):ej}),N(t),O(u),M(C),n(),R(),nf(),m(q,c)}function Af(a){return Ec(Ff.data.targets,a.id)}function Bf(a){return"data"in a&&Ec(Ff.data.targets,a.data.id)}function Cf(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 Df(a,b,c){var d=!he(Ff.data.targets);Qi=!1,be(a,b),of(c||{withTransitionForAxis:d})}var Ef=a.d3?a.d3:a.require?a.require("d3"):void 0,Ff={data:{},axis:{},legend:{}},Gf={},Hf=h(["bindto"],"#chart"),If=h(["size","width"]),Jf=h(["size","height"]),Kf=h(["padding","left"],50),Lf=h(["padding","right"],0),Mf=h(["padding","top"],0),Nf=h(["padding","bottom"],0),Of=h(["zoom","enabled"],!1),Pf=h(["zoom","extent"]),Qf=h(["zoom","privileged"],!1),Rf=h(["onenter"],function(){}),Sf=h(["onleave"],function(){}),Tf=h(["onresize"],function(){}),Uf=h(["onresized"],function(){}),Vf=h(["transition","duration"],350);g("data","data is required in config");var Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg=h(["data","x"]),Dg=h(["data","xs"],{}),Eg=h(["data","x_format"]),Fg=h(["data","id_converter"],function(a){return a}),Gg=h(["data","names"],{}),Hg=h(["data","classes"],{}),Ig=h(["data","groups"],[]),Jg=h(["data","axes"],{}),Kg=h(["data","type"]),Lg=h(["data","types"],{}),Mg=h(["data","labels"],{}),Ng=h(["data","order"]),Og=h(["data","regions"],{}),Pg=h(["data","color"]),Qg=h(["data","colors"],{}),Rg=h(["data","hide"],!1),Sg=h(["data","selection","enabled"],!1),Tg=h(["data","selection","grouped"],!1),Ug=h(["data","selection","isselectable"],function(){return!0}),Vg=h(["data","selection","multiple"],!0),Wg=h(["data","onclick"],function(){}),Xg=h(["data","onenter"],function(){}),Yg=h(["data","onleave"],function(){}),Zg=h(["data","onselected"],function(){}),$g=h(["data","onunselected"],function(){}),_g=h(["data","ondragstart"],function(){}),ah=h(["data","ondragend"],function(){}),bh=h(["subchart","show"],!1),ch=h(["subchart","size","height"],60),dh=h(["color","pattern"],[]),eh=h(["legend","show"],!0),fh=h(["legend","position"],"bottom"),gh=h(["legend","item","onclick"]),hh=h(["legend","item","onmouseover"]),ih=h(["legend","item","onmouseout"]),jh=h(["legend","equally"],!1),kh=h(["axis","rotated"],!1),lh=h(["axis","x","show"],!0),mh=h(["axis","x","type"],"indexed"),nh=h(["axis","x","localtime"],!0),oh=h(["axis","x","categories"],[]),ph=h(["axis","x","tick","centered"],!1),qh=h(["axis","x","tick","format"]),rh=h(["axis","x","tick","culling"],{}),sh=h(["axis","x","tick","culling","max"],10),th=h(["axis","x","tick","count"]),uh=h(["axis","x","tick","fit"],!0),vh=h(["axis","x","tick","values"],null),wh=h(["axis","x","tick","rotate"]),xh=h(["axis","x","max"],null),yh=h(["axis","x","min"],null),zh=h(["axis","x","padding"],{}),Ah=h(["axis","x","height"]),Bh=h(["axis","x","default"]),Ch=h(["axis","x","label"],{}),Dh=h(["axis","y","show"],!0),Eh=h(["axis","y","max"]),Fh=h(["axis","y","min"]),Gh=h(["axis","y","center"]),Hh=h(["axis","y","label"],{}),Ih=h(["axis","y","inner"],!1),Jh=h(["axis","y","tick","format"]),Kh=h(["axis","y","padding"]),Lh=h(["axis","y","ticks"],10),Mh=h(["axis","y2","show"],!1),Nh=h(["axis","y2","max"]),Oh=h(["axis","y2","min"]),Ph=h(["axis","y2","center"]),Qh=h(["axis","y2","label"],{}),Rh=h(["axis","y2","inner"],!1),Sh=h(["axis","y2","tick","format"]),Th=h(["axis","y2","padding"]),Uh=h(["axis","y2","ticks"],10),Vh=h(["grid","x","show"],!1),Wh=h(["grid","x","type"],"tick"),Xh=h(["grid","x","lines"],[]),Yh=h(["grid","y","show"],!1),Zh=h(["grid","y","lines"],[]),$h=h(["grid","y","ticks"],10),_h=h(["point","show"],!0),ai=h(["point","r"],2.5),bi=h(["point","focus","line","enabled"],!0),ci=h(["point","focus","expand","enabled"],!0),di=h(["point","focus","expand","r"]),ei=h(["point","focus","select","r"]),fi=h(["line","connect_null"],!1),gi=h(["bar","width"]),hi=h(["bar","width","ratio"],.6),ii=h(["pie","label","show"],!0),ji=h(["pie","label","format"]),ki=h(["pie","expand"],!0),li=h(["pie","onclick"],function(){}),mi=h(["pie","onmouseover"],function(){}),ni=h(["pie","onmouseout"],function(){}),oi=h(["donut","label","show"],!0),pi=h(["donut","label","format"]),qi=h(["donut","expand"],!0),ri=h(["donut","title"],""),si=h(["donut","onclick"],function(){}),ti=h(["donut","onmouseover"],function(){}),ui=h(["donut","onmouseout"],function(){}),vi=h(["regions"],[]),wi=h(["tooltip","show"],!0),xi=h(["tooltip","format","title"]),yi=h(["tooltip","format","value"]),zi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=xi?xi:b,l=yi?yi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id,a[g].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Ai=h(["tooltip","init","show"],!1),Bi=h(["tooltip","init","x"],0),Ci=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Di=("string"==typeof Hf?Hf.replace("#",""):Hf.id)+"-clip",Ei=Di+"-xaxis",Fi=Di+"-yaxis",Gi=i(Di),Hi=i(Ei),Ii=i(Fi),Ji="timeseries"===mh,Ki="categorized"===mh,Li=!Ji&&(Cg||Be(Dg)),Mi=null,Ni=!1,Oi=!1,Pi=!1,Qi=!1,Ri=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Si=ve(Qg,Be(dh)?dh:Ri,Pg),Ti=nh?Ef.time.format:Ef.time.format.utc,Ui=function(){var a=[[Ti("%Y/%-m/%-d"),function(){return!0}],[Ti("%-m/%-d"),function(a){return a.getMonth()}],[Ti("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ti("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ti("%I %p"),function(a){return a.getHours()}],[Ti("%I:%M"),function(a){return a.getMinutes()}],[Ti(":%S"),function(a){return a.getSeconds()}],[Ti(".%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)}}(),Vi=[],Wi=[],Xi=kh?"left":"bottom",Yi=kh?Ih?"top":"bottom":Ih?"right":"left",Zi=kh?Rh?"bottom":"top":Rh?"left":"right",$i=kh?"left":"bottom",_i={main:function(){return"translate("+Wf.left+","+Wf.top+")"},context:function(){return"translate("+Xf.left+","+Xf.top+")"},legend:function(){return"translate("+Yf.left+","+Yf.top+")"},x:function(){return"translate(0,"+(kh?0:_f)+")"},y:function(){return"translate(0,"+(kh?_f:0)+")"},y2:function(){return"translate("+(kh?0:Zf)+","+(kh?1:0)+")"},subx:function(){return"translate(0,"+(kh?0:ag)+")"},arc:function(){return"translate("+Zf/2+","+_f/2+")"}},aj="right"===fh,bj=0,cj=0,dj=0,ej=.15,fj=30,gj=kh&&!lh?0:30,hj=5;jg=Ef.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var ij,jj=function(){var a=Ef.svg.line().x(kh?function(a){return V(a.id)(a.value)}:Fd).y(kh?Fd:function(a){return V(a.id)(a.value)});return fi||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=fi?Ne(b.values):b.values;return ie(b)?(a.interpolate(je(b)?"cardinal":"linear"),Og[b.id]?af(e,sg,V(b.id),Og[b.id]):a(e)):(c=e[0]?sg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,kh?"M "+d+" "+c:"M "+c+" "+d)}}(),kj=function(){var a;return a=kh?Ef.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Fd):Ef.svg.area().x(Fd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ne(b.values);return ce([b],"area")||ce([b],"area-spline")?(a.interpolate(je(b)?"cardinal":"linear"),a(e)):(c=e[0]?sg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,kh?"M "+d+" "+c:"M "+c+" "+d)}}(),lj=function(){var a=Ef.svg.line().x(kh?function(a){return W(a.id)(a.value)}:Id).y(kh?Id:function(a){return W(a.id)(a.value)});return function(b){var c=Ne(b.values);return ie(b)?a(c):"M "+vg(c[0].x)+" "+W(b.id)(c[0].value)}}(),mj=function(){};ij=Ef.svg.brush().on("brush",kf),ij.update=function(){return qj&&qj.select("."+f.brush).call(this),this},ij.scale=function(a){return kh?this.y(a):this.x(a)},Of&&(mj=Ef.behavior.zoom().on("zoomstart",function(){mj.altDomain=Ef.event.sourceEvent.altKey?sg.orgDomain():null}).on("zoom",Of?lf:null),mj.scale=function(a){return kh?this.y(a):this.x(a)},mj.orgScaleExtent=function(){var a=Pf?Pf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},mj.updateScaleExtent=function(){var a=ac(sg.orgDomain())/ac(uj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var nj,oj,pj,qj,rj,sj,tj,uj,vj,wj={};if(Ff.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=nj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);Ff.revert(),Ff.defocus(),b(d.classed(f.focused,!0)),b(e),he(Ff.data.targets)&&Nb(a,!0),vf(a,!0)},Ff.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=nj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);Ff.revert(),b(d.classed(f.focused,!1)),b(e),he(Ff.data.targets)&&Ob(a),vf(a,!1)},Ff.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=nj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);b(d.classed(f.focused,!1)),b(e),he(Ff.data.targets)&&Ob(a),wf()},Ff.show=function(a,b){a=Dc(a),b=b||{},Mc(a),nj.selectAll(qd(a)).transition().style("opacity",1),b.withLegend&&xf(a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ff.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),nj.selectAll(qd(a)).transition().style("opacity",0),b.withLegend&&yf(a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ff.toggle=function(a){Gc(a)?Ff.hide(a):Ff.show(a)},Ff.unzoom=function(){ij.clear().update(),jf({withUpdateXDomain:!0})},Ff.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Hg[b]=a.classes[b]}),"categories"in a&&Ki&&(oh=a.categories,yg.categories(oh)),"cacheIds"in a&&bc(a.cacheIds)?void qf(dc(a.cacheIds),a.done):void("unload"in a?sf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){rf(a)}):rf(a))},Ff.unload=function(a,b){sf(Dc(a),function(){jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Ff.selected=function(a){return Ef.merge(pj.selectAll("."+f.shapes+od(a)).selectAll("."+f.shape).filter(function(){return Ef.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Ff.select=function(a,b,c){Sg&&pj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=Ef.select(this),i=e.data?e.data.id:e.id,j=Me(this),k=Tg||!a||a.indexOf(i)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Ug(e)&&!m&&j(!0,h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(!1,h.classed(f.SELECTED,!1),e,g)})},Ff.unselect=function(a,b){Sg&&pj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=Ef.select(this),g=c.data?c.data.id:c.id,h=Me(this),i=Tg||!a||a.indexOf(g)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(f.SELECTED); i&&j&&Ug(c)&&k&&h(!1,e.classed(f.SELECTED,!1),c,d)})},Ff.toLine=function(a){Df(a,"line")},Ff.toSpline=function(a){Df(a,"spline")},Ff.toBar=function(a){Df(a,"bar")},Ff.toScatter=function(a){Df(a,"scatter")},Ff.toArea=function(a){Df(a,"area")},Ff.toAreaSpline=function(a){Df(a,"area-spline")},Ff.toPie=function(a){Df(a,"pie",{withTransform:!0})},Ff.toDonut=function(a){Df(a,"donut",{withTransform:!0})},Ff.groups=function(a){return c(a)?Ig:(Ig=a,jf(),Ig)},Ff.xgrids=function(a){return a?(Xh=a,jf(),Xh):Xh},Ff.xgrids.add=function(a){return a?Ff.xgrids(Xh.concat(a)):void 0},Ff.xgrids.remove=function(a){var b=Cf(a);return Ff.xgrids(Xh.filter(b))},Ff.ygrids=function(a){return a?(Zh=a,jf(),Zh):Zh},Ff.ygrids.add=function(a){return a?Ff.ygrids(Zh.concat(a)):void 0},Ff.ygrids.remove=function(a){var b=Cf(a);return Ff.ygrids(Zh.filter(b))},Ff.regions=function(a){return c(a)?vi:(vi=a,jf(),vi)},Ff.regions.add=function(a){return c(a)?vi:(vi=vi.concat(a),jf(),vi)},Ff.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;nj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),vi=vi.filter(function(b){return b.classes.indexOf(a)<0})}),vi},Ff.data.get=function(a){var b=Ff.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Ff.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},Ff.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Gg[b]=a[b]}),jf({withLegend:!0}),Gg):Gg},Ff.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Qg[b]=a[b]}),jf({withLegend:!0}),Qg):Qg},Ff.x=function(a){return arguments.length&&(qc(Ff.data.targets,a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ff.data.xs},Ff.xs=function(a){return arguments.length&&(rc(Ff.data.targets,a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ff.data.xs},Ff.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},Ff.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(xh=+a.x),b(a.y)&&(Eh=+a.y),b(a.y2)&&(Nh=+a.y2)):Eh=Nh=+a,jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Ff.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(yh=+a.x),b(a.y)&&(Fh=+a.y),b(a.y2)&&(Oh=+a.y2)):Fh=Oh=+a,jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Ff.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Ff.axis.max(a.max),"undefined"!=typeof a.min&&Ff.axis.min(a.min))},Ff.legend.show=function(a){xf(Dc(a)),jf({withLegend:!0})},Ff.legend.hide=function(a){yf(Dc(a)),jf({withLegend:!0})},Ff.resize=function(a){If=a?a.width:null,Jf=a?a.height:null,of({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Ff.destroy=function(){Ff.data.targets=void 0,Ff.data.xs={},tj.html(""),a.onresize=null},"url"in e.data)Ef.xhr(e.data.url,function(a,b){var c,d=Ef.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Ef.csv.parse(b.response),bf(c)});else if("rows"in e.data)bf(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");bf(uc(e.data.columns))}return Ff},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From c2f8cce4151965c6c5ea2f36c99af37425b502cb Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Mon, 5 May 2014 16:00:34 +0900 Subject: [PATCH 129/178] Fix grid lines - #204 --- c3.js | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/c3.js b/c3.js index e85eabb..915408c 100644 --- a/c3.js +++ b/c3.js @@ -1843,11 +1843,11 @@ return d ? x(d.x) : null; } function xv(d) { - return x(isTimeSeries ? parseDate(d.value) : d.value); + return Math.ceil(x(isTimeSeries ? parseDate(d.value) : d.value)); } function yv(d) { var yScale = d.axis && d.axis === 'y2' ? y2 : y; - return yScale(d.value); + return Math.ceil(yScale(d.value)); } function subxx(d) { return subX(d.x); @@ -2009,7 +2009,6 @@ .attr(__axis_rotated ? 'y1' : 'x1', xx) .attr(__axis_rotated ? 'y2' : 'x2', xx); smoothLines(focusEl, 'grid'); - } function hideXGridFocus() { main.select('line.' + CLASS.xgridFocus).style("visibility", "hidden"); @@ -3176,7 +3175,6 @@ } function redraw(options) { - var xaxis, subxaxis, yaxis, y2axis, xgrid, xgridData, xgridLines, xgridLine, ygrid, ygridLines, ygridLine; var mainLine, mainArea, mainCircle, mainBar, mainArc, mainRegion, mainText, contextLine, contextBar, eventRect, eventRectUpdate; var barIndices = getBarIndices(), maxDataCountTarget; @@ -3257,19 +3255,19 @@ smoothLines(d3.select(this), 'tick'); }); }); - + transitions.axisY.call(yAxis).each('end', function () { d3.select(this).selectAll('.tick').each(function () { smoothLines(d3.select(this), 'tick'); }); }); - + transitions.axisY2.call(y2Axis).each('end', function () { d3.select(this).selectAll('.tick').each(function () { smoothLines(d3.select(this), 'tick'); }); }); - + transitions.axisSubX.call(subXAxis).each('end', function () { d3.select(this).selectAll('.tick').each(function () { smoothLines(d3.select(this), 'tick'); @@ -3361,10 +3359,10 @@ // udpate xgridLines.select('line') .transition().duration(duration) - .attr("x1", __axis_rotated ? 0 : Math.ceil(xv)) - .attr("x2", __axis_rotated ? Math.ceil(width) : Math.ceil(xv)) - .attr("y1", __axis_rotated ? Math.ceil(xv) : Math.ceil(margin.top)) - .attr("y2", __axis_rotated ? Math.ceil(xv) : Math.ceil(height)) + .attr("x1", __axis_rotated ? 0 : xv) + .attr("x2", __axis_rotated ? Math.ceil(width) : xv) + .attr("y1", __axis_rotated ? xv : Math.ceil(margin.top)) + .attr("y2", __axis_rotated ? xv : Math.ceil(height)) .style("opacity", 1); xgridLines.select('text') .transition().duration(duration) @@ -3388,9 +3386,7 @@ .attr("y1", __axis_rotated ? 0 : y) .attr("y2", __axis_rotated ? height : y); ygrid.exit().remove(); - smoothLines(ygrid, 'grid'); - } if (withY && notEmpty(__grid_y_lines)) { ygridLines = main.select('.' + CLASS.ygridLines).selectAll('.' + CLASS.ygridLine) @@ -3409,10 +3405,10 @@ // update ygridLines.select('line') .transition().duration(duration) - .attr("x1", __axis_rotated ? Math.ceil(yv) : 0) - .attr("x2", __axis_rotated ? Math.ceil(yv) : Math.ceil(width)) - .attr("y1", __axis_rotated ? 0 : Math.ceil(yv)) - .attr("y2", __axis_rotated ? Math.ceil(height) : Math.ceil(yv)) + .attr("x1", __axis_rotated ? yv : 0) + .attr("x2", __axis_rotated ? yv : Math.ceil(width)) + .attr("y1", __axis_rotated ? 0 : yv) + .attr("y2", __axis_rotated ? Math.ceil(height) : yv) .style("opacity", 1); ygridLines.select('text') .transition().duration(duration) From aef3c573ac9120dfaf710b19ff5d8fdf2036dffd Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Mon, 5 May 2014 18:53:43 +0900 Subject: [PATCH 130/178] Introduce c3_axis - #204 --- c3.js | 361 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 180 insertions(+), 181 deletions(-) diff --git a/c3.js b/c3.js index 915408c..ae163ed 100644 --- a/c3.js +++ b/c3.js @@ -684,7 +684,7 @@ //-- Axes --// function getXAxis(scale, orient, tickFormat, tickValues) { - var axis = (isCategorized ? categoryAxis() : d3.svg.axis()).scale(scale).orient(orient); + var axis = c3_axis(isCategorized).scale(scale).orient(orient); // Set tick axis.tickFormat(tickFormat).tickValues(tickValues); @@ -907,186 +907,6 @@ .text(textForY2AxisLabel); } - function categoryAxis() { - var scale = d3.scale.linear(), orient = "bottom"; - var tickMajorSize = 6, /*tickMinorSize = 6,*/ tickEndSize = 6, tickPadding = 3, tickCentered = false, tickTextNum = 10, tickOffset = 0, tickFormat = null, tickCulling = true; - var categories = []; - function axisX(selection, x) { - selection.attr("transform", function (d) { - return "translate(" + (x(d) + tickOffset) + ", 0)"; - }); - } - function axisY(selection, y) { - selection.attr("transform", function (d) { - return "translate(0," + y(d) + ")"; - }); - } - function scaleExtent(domain) { - var start = domain[0], stop = domain[domain.length - 1]; - return start < stop ? [ start, stop ] : [ stop, start ]; - } - function generateTicks(domain) { - var ticks = []; - for (var i = Math.ceil(domain[0]); i < domain[1]; i++) { - ticks.push(i); - } - if (ticks.length > 0 && ticks[0] > 0) { - ticks.unshift(ticks[0] - (ticks[1] - ticks[0])); - } - return ticks; - } - function category(i) { - return i < categories.length ? categories[i] : i; - } - function formattedCategory(i) { - var c = category(i); - return tickFormat ? tickFormat(c) : c; - } - function copyScale() { - var newScale = scale.copy(), domain = scale.domain(); - newScale.domain([domain[0], domain[1] - 1]); - return newScale; - } - function axis(g) { - g.each(function () { - var g = d3.select(this); - var scale1 = copyScale(), scale0 = this.__chart__ || scale1; - var tick = g.selectAll(".tick.major").data(generateTicks(scale1.domain()), String), - tickEnter = tick.enter().insert("g", "path").attr("class", "tick major").style("opacity", 1e-6), - tickExit = d3.transition(tick.exit()).style("opacity", 1e-6).remove(), - tickUpdate = d3.transition(tick).style("opacity", 1), - tickTransform, - tickX; - var range = scale.rangeExtent ? scale.rangeExtent() : scaleExtent(scale.range()); - var path = g.selectAll(".domain").data([ 0 ]), pathUpdate; - var lineEnter, lineUpdate, text, textEnter, textUpdate; - - path.enter().append("path").attr("class", "domain"); - pathUpdate = d3.transition(path); - - tickEnter.append("line"); - tickEnter.append("text"); - - lineEnter = tickEnter.select("line"); - lineUpdate = tickUpdate.select("line"); - text = tick.select("text"); - textEnter = tickEnter.select("text"); - textUpdate = tickUpdate.select("text"); - - tickOffset = (scale1(1) - scale1(0)) / 2; - tickX = tickCentered ? 0 : tickOffset; - - this.__chart__ = scale1; - - switch (orient) { - case "bottom": - { - tickTransform = axisX; - lineEnter.attr("y2", Math.ceil(tickMajorSize)); - textEnter.attr("y", Math.ceil(Math.max(tickMajorSize, 0) + tickPadding)); - lineUpdate.attr("x1", Math.ceil(tickX)).attr("x2", Math.ceil(tickX)).attr("y2", Math.ceil(tickMajorSize)); - textUpdate.attr("x", 0).attr("y", Math.ceil(Math.max(tickMajorSize, 0) + tickPadding)); - text.attr("dy", ".71em").style("text-anchor", "middle"); - text.text(formattedCategory); - pathUpdate.attr("d", "M" + range[0] + "," + tickEndSize + "V0H" + range[1] + "V" + tickEndSize); - break; - } -/* TODO: implement - case "top": - { - tickTransform = axisX - lineEnter.attr("y2", -tickMajorSize) - textEnter.attr("y", -(Math.max(tickMajorSize, 0) + tickPadding)) - lineUpdate.attr("x2", 0).attr("y2", -tickMajorSize) - textUpdate.attr("x", 0).attr("y", -(Math.max(tickMajorSize, 0) + tickPadding)) - text.attr("dy", "0em").style("text-anchor", "middle") - pathUpdate.attr("d", "M" + range[0] + "," + -tickEndSize + "V0H" + range[1] + "V" + -tickEndSize) - break - } -*/ - case "left": - { - tickTransform = axisY; - lineEnter.attr("x2", -(Math.ceil(tickMajorSize))); - textEnter.attr("x", -(Math.ceil(Math.max(tickMajorSize, 0) + tickPadding))); - lineUpdate.attr("x2", -(Math.ceil(tickMajorSize))).attr("y2", 0); - textUpdate.attr("x", -(Math.ceil(Math.max(tickMajorSize, 0) + tickPadding))).attr("y", Math.ceil(tickOffset)); - text.attr("dy", ".32em").style("text-anchor", "end"); - text.text(formattedCategory); - pathUpdate.attr("d", "M" + -tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + -tickEndSize); - break; - } -/* - case "right": - { - tickTransform = axisY - lineEnter.attr("x2", tickMajorSize) - textEnter.attr("x", Math.max(tickMajorSize, 0) + tickPadding) - lineUpdate.attr("x2", tickMajorSize).attr("y2", 0) - textUpdate.attr("x", Math.max(tickMajorSize, 0) + tickPadding).attr("y", 0) - text.attr("dy", ".32em").style("text-anchor", "start") - pathUpdate.attr("d", "M" + tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + tickEndSize) - break - } -*/ - } - if (scale.ticks) { - tickEnter.call(tickTransform, scale0); - tickUpdate.call(tickTransform, scale1); - tickExit.call(tickTransform, scale1); - } else { - var dx = scale1.rangeBand() / 2, x = function (d) { - return scale1(d) + dx; - }; - tickEnter.call(tickTransform, x); - tickUpdate.call(tickTransform, x); - } - }); - } - axis.scale = function (x) { - if (!arguments.length) { return scale; } - scale = x; - return axis; - }; - axis.orient = function (x) { - if (!arguments.length) { return orient; } - orient = x in {top: 1, right: 1, bottom: 1, left: 1} ? x + "" : "bottom"; - return axis; - }; - axis.categories = function (x) { - if (!arguments.length) { return categories; } - categories = x; - return axis; - }; - axis.tickCentered = function (x) { - if (!arguments.length) { return tickCentered; } - tickCentered = x; - return axis; - }; - axis.tickFormat = function (format) { - if (!arguments.length) { return tickFormat; } - tickFormat = format; - return axis; - }; - axis.tickOffset = function () { - return tickOffset; - }; - axis.ticks = function (n) { - if (!arguments.length) { return tickTextNum; } - tickTextNum = n; - return axis; - }; - axis.tickCulling = function (culling) { - if (!arguments.length) { return tickCulling; } - tickCulling = culling; - return axis; - }; - axis.tickValues = function () { - // TODO: do something - }; - return axis; - } - //-- Arc --// pie = d3.layout.pie().value(function (d) { @@ -4655,4 +4475,183 @@ } // TODO: module.exports + function c3_axis(isCategory) { + var scale = d3.scale.linear(), orient = "bottom", innerTickSize = 6, outerTickSize = 6, tickPadding = 3, tickValues = null, tickFormat; + + var tickOffset = 0, tickTextNum = 10, tickCulling = true; + var categories = [], tickCentered; + + function axisX(selection, x) { + selection.attr("transform", function (d) { + return "translate(" + (x(d) + tickOffset) + ", 0)"; + }); + } + function axisY(selection, y) { + selection.attr("transform", function (d) { + return "translate(0," + y(d) + ")"; + }); + } + function scaleExtent(domain) { + var start = domain[0], stop = domain[domain.length - 1]; + return start < stop ? [ start, stop ] : [ stop, start ]; + } + function generateTicks(domain) { + var i, ticks = []; + for (i = Math.ceil(domain[0]); i < domain[1]; i++) { + ticks.push(i); + } + if (ticks.length > 0 && ticks[0] > 0) { + ticks.unshift(ticks[0] - (ticks[1] - ticks[0])); + } + return ticks; + } + function copyScale() { + var newScale = scale.copy(), domain; + if (isCategory) { + domain = scale.domain(); + newScale.domain([domain[0], domain[1] - 1]); + } + return newScale; + } + function textFormatted(i) { + var v = isCategory && i < categories.length ? categories[i] : i; + return tickFormat ? tickFormat(v) : v; + } + function axis(g) { + g.each(function() { + var g = d3.select(this); + var scale0 = this.__chart__ || scale, scale1 = this.__chart__ = copyScale(); + + var ticks = tickValues ? tickValues : generateTicks(scale1.domain()), + tick = g.selectAll(".tick").data(ticks, scale1), + tickEnter = tick.enter().insert("g", ".domain").attr("class", "tick").style("opacity", 1e-6), + tickExit = d3.transition(tick.exit()).style("opacity", 1e-6).remove(), + tickUpdate = d3.transition(tick).style("opacity", 1), + tickTransform, tickX; + + var range = scale.rangeExtent ? scale.rangeExtent() : scaleExtent(scale.range()), + path = g.selectAll(".domain").data([ 0 ]), + pathUpdate = (path.enter().append("path").attr("class", "domain"), d3.transition(path)); + tickEnter.append("line"); + tickEnter.append("text"); + + var lineEnter = tickEnter.select("line"), + lineUpdate = tickUpdate.select("line"), + text = tick.select("text").text(textFormatted), + textEnter = tickEnter.select("text"), + textUpdate = tickUpdate.select("text"); + + if (isCategory) { + tickOffset = (scale1(1) - scale1(0)) / 2; + tickX = tickCentered ? 0 : tickOffset; + } else { + tickOffset = tickX = 0; + } + + switch (orient) { + case "bottom": + { + tickTransform = axisX; + lineEnter.attr("y2", innerTickSize); + textEnter.attr("y", Math.max(innerTickSize, 0) + tickPadding); + lineUpdate.attr("x1", tickX).attr("x2", tickX).attr("y2", innerTickSize); + textUpdate.attr("x", 0).attr("y", Math.max(innerTickSize, 0) + tickPadding); + text.attr("dy", ".71em").style("text-anchor", "middle"); + pathUpdate.attr("d", "M" + range[0] + "," + outerTickSize + "V0H" + range[1] + "V" + outerTickSize); + break; + } + case "top": + { + tickTransform = axisX; + lineEnter.attr("y2", -innerTickSize); + textEnter.attr("y", -(Math.max(innerTickSize, 0) + tickPadding)); + lineUpdate.attr("x2", 0).attr("y2", -innerTickSize); + textUpdate.attr("x", 0).attr("y", -(Math.max(innerTickSize, 0) + tickPadding)); + text.attr("dy", "0em").style("text-anchor", "middle"); + pathUpdate.attr("d", "M" + range[0] + "," + -outerTickSize + "V0H" + range[1] + "V" + -outerTickSize); + break; + } + case "left": + { + tickTransform = axisY; + lineEnter.attr("x2", -innerTickSize); + textEnter.attr("x", -(Math.max(innerTickSize, 0) + tickPadding)); + lineUpdate.attr("x2", -innerTickSize).attr("y2", 0); + textUpdate.attr("x", -(Math.max(innerTickSize, 0) + tickPadding)).attr("y", tickOffset); + text.attr("dy", ".32em").style("text-anchor", "end"); + pathUpdate.attr("d", "M" + -outerTickSize + "," + range[0] + "H0V" + range[1] + "H" + -outerTickSize); + break; + } + case "right": + { + tickTransform = axisY; + lineEnter.attr("x2", innerTickSize); + textEnter.attr("x", Math.max(innerTickSize, 0) + tickPadding); + lineUpdate.attr("x2", innerTickSize).attr("y2", 0); + textUpdate.attr("x", Math.max(innerTickSize, 0) + tickPadding).attr("y", 0); + text.attr("dy", ".32em").style("text-anchor", "start"); + pathUpdate.attr("d", "M" + outerTickSize + "," + range[0] + "H0V" + range[1] + "H" + outerTickSize); + break; + } + } + if (scale1.rangeBand) { + var x = scale1, dx = x.rangeBand() / 2; + scale0 = scale1 = function(d) { + return x(d) + dx; + }; + } else if (scale0.rangeBand) { + scale0 = scale1; + } else { + tickExit.call(tickTransform, scale1); + } + tickEnter.call(tickTransform, scale0); + tickUpdate.call(tickTransform, scale1); + }); + } + axis.scale = function(x) { + if (!arguments.length) return scale; + scale = x; + return axis; + }; + axis.orient = function (x) { + if (!arguments.length) { return orient; } + orient = x in {top: 1, right: 1, bottom: 1, left: 1} ? x + "" : "bottom"; + return axis; + }; + axis.tickFormat = function (format) { + if (!arguments.length) { return tickFormat; } + tickFormat = format; + return axis; + }; + axis.tickCentered = function (isCentered) { + if (!arguments.length) { return tickCentered; } + tickCentered = isCentered; + return axis; + }; + axis.tickOffset = function () { + return tickOffset; + }; + axis.ticks = function (n) { + if (!arguments.length) { return tickTextNum; } + tickTextNum = n; + return axis; + }; + axis.tickCulling = function (culling) { + if (!arguments.length) { return tickCulling; } + tickCulling = culling; + return axis; + }; + axis.tickValues = function(x) { + if (!arguments.length) { return tickValues; } + tickValues = x; + return axis; + }; + axis.categories = function (x) { + if (!arguments.length) { return categories; } + categories = x; + return axis; + }; + return axis; + } + })(window); From 4b7aea96c011d8d9709c95da8502dfb409caa272 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Mon, 5 May 2014 20:58:24 +0900 Subject: [PATCH 131/178] Fix grid on smoothing - #204 --- c3.js | 152 ++++++++++++++++++++++++++++------------------------------ 1 file changed, 74 insertions(+), 78 deletions(-) diff --git a/c3.js b/c3.js index ae163ed..07b2873 100644 --- a/c3.js +++ b/c3.js @@ -643,21 +643,24 @@ svgArcExpandedSub = getSvgArcExpanded(0.98); } function getX(min, max, domain, offset) { - var scale = ((isTimeSeries) ? d3.time.scale() : d3.scale.linear()).range([min, max]); - // Set function and values for c3 - scale.orgDomain = function () { return scale.domain(); }; - if (domain) { scale.domain(domain); } - if (isUndefined(offset)) { offset = function () { return 0; }; } + var scale = (isTimeSeries ? d3.time.scale() : d3.scale.linear()).range([min, max]), + _scale = domain ? scale.domain(domain) : scale, key; // Define customized scale if categorized axis if (isCategorized) { - var _scale = scale, key; - scale = function (d) { return _scale(d) + offset(d); }; - for (key in _scale) { - scale[key] = _scale[key]; - } - scale.orgDomain = function () { - return _scale.domain(); - }; + offset = offset || function () { return 0; }; + scale = function (d) { return Math.ceil(_scale(d) + offset(d)); }; + } else { + scale = function (d) { return Math.ceil(_scale(d)); }; + } + // define functions + for (key in _scale) { + scale[key] = _scale[key]; + } + scale.orgDomain = function () { + return _scale.domain(); + }; + // define custom domain() for categorized axis + if (isCategorized) { scale.domain = function (domain) { if (!arguments.length) { domain = _scale.domain(); @@ -693,7 +696,9 @@ if (isEmpty(__axis_x_tick_culling)) { __axis_x_tick_culling = false; } + axis.categories(__axis_x_categories); } else { + // TODO: move this to c3_axis axis.tickOffset = function () { var edgeX = getEdgeX(c3.data.targets), diff = x(edgeX[1]) - x(edgeX[0]), base = diff ? diff : (__axis_rotated ? height : width); @@ -701,15 +706,10 @@ }; } - // Set categories - if (isCategorized) { - axis.categories(__axis_x_categories); - } - return axis; } function getYAxis(scale, orient, tickFormat, ticks) { - return d3.svg.axis().scale(scale).orient(orient).tickFormat(tickFormat).ticks(ticks).outerTickSize(0); + return c3_axis().scale(scale).orient(orient).tickFormat(tickFormat).ticks(ticks); } function getAxisId(id) { return id in __data_axes ? __data_axes[id] : 'y'; @@ -1833,6 +1833,20 @@ function hideXGridFocus() { main.select('line.' + CLASS.xgridFocus).style("visibility", "hidden"); } + function generateGridData(type, scale) { + var gridData = [], xDomain, firstYear, lastYear, i; + if (type === 'year') { + xDomain = getXDomain(); + firstYear = xDomain[0].getFullYear(); + lastYear = xDomain[1].getFullYear(); + for (i = firstYear; i <= lastYear; i++) { + gridData.push(new Date(i + '-01-01 00:00:00')); + } + } else { + gridData = scale.ticks(10); + } + return gridData; + } //-- Circle --// @@ -2972,12 +2986,7 @@ } function smoothLines(el, type) { - if (type === 'tick') { - var t = d3.transform(el.attr("transform")), - x = t.translate[0], - y = t.translate[1]; - el.attr("transform", "translate(" + Math.ceil(x) + "," + Math.ceil(y) + ")"); - } else if (type === 'grid') { + if (type === 'grid') { el.each(function () { var g = d3.select(this), x1 = g.attr('x1'), @@ -2995,9 +3004,9 @@ } function redraw(options) { - var xaxis, subxaxis, yaxis, y2axis, xgrid, xgridData, xgridLines, xgridLine, ygrid, ygridLines, ygridLine; + var xaxis, subxaxis, yaxis, y2axis, xgrid, xgridAttr, xgridData, xgridLines, xgridLine, ygrid, ygridLines, ygridLine; var mainLine, mainArea, mainCircle, mainBar, mainArc, mainRegion, mainText, contextLine, contextBar, eventRect, eventRectUpdate; - var barIndices = getBarIndices(), maxDataCountTarget; + var barIndices = getBarIndices(), maxDataCountTarget, tickOffset; var rectX, rectW; var withY, withSubchart, withTransition, withTransitionForExit, withTransitionForAxis, withTransform, withUpdateXDomain, withUpdateOrgXDomain, withLegend; var hideAxis = hasArcType(c3.data.targets); @@ -3070,29 +3079,10 @@ y2.domain(getYDomain(targetsToShow, 'y2')); // axes - transitions.axisX.call(xAxis).each('end', function () { - d3.select(this).selectAll('.tick').each(function () { - smoothLines(d3.select(this), 'tick'); - }); - }); - - transitions.axisY.call(yAxis).each('end', function () { - d3.select(this).selectAll('.tick').each(function () { - smoothLines(d3.select(this), 'tick'); - }); - }); - - transitions.axisY2.call(y2Axis).each('end', function () { - d3.select(this).selectAll('.tick').each(function () { - smoothLines(d3.select(this), 'tick'); - }); - }); - - transitions.axisSubX.call(subXAxis).each('end', function () { - d3.select(this).selectAll('.tick').each(function () { - smoothLines(d3.select(this), 'tick'); - }); - }); + transitions.axisX.call(xAxis); + transitions.axisY.call(yAxis); + transitions.axisY2.call(y2Axis); + transitions.axisSubX.call(subXAxis); // show/hide if manual culling needed if (withUpdateXDomain && targetsToShow.length) { @@ -3114,6 +3104,8 @@ } } + tickOffset = xAxis.tickOffset(); + // rotate tick text if needed if (!__axis_rotated && __axis_x_tick_rotate) { rotateTickText(xaxis, transitions.axisX, __axis_x_tick_rotate); @@ -3140,25 +3132,22 @@ // grid main.select('line.' + CLASS.xgridFocus).style("visibility", "hidden"); if (__grid_x_show) { - if (__grid_x_type === 'year') { - xgridData = []; - var xDomain = getXDomain(); - var firstYear = xDomain[0].getFullYear(); - var lastYear = xDomain[1].getFullYear(); - for (var year = firstYear; year <= lastYear; year++) { - xgridData.push(new Date(year + '-01-01 00:00:00')); - } - } else { - xgridData = x.ticks(10); - } - + xgridData = generateGridData(__grid_x_type, x); + xgridAttr = __axis_rotated ? { + 'x1': 0, + 'x2': Math.ceil(width), + 'y1': function (d) { return x(d) - tickOffset; }, + 'y2': function (d) { return x(d) - tickOffset; } + } : { + 'x1': function (d) { return x(d) + tickOffset; }, + 'x2': function (d) { return x(d) + tickOffset; }, + 'y1': Math.ceil(margin.top), + 'y2': Math.ceil(height) + }; xgrid = main.select('.' + CLASS.xgrids).selectAll('.' + CLASS.xgrid) .data(xgridData); xgrid.enter().append('line').attr("class", CLASS.xgrid); - xgrid.attr("x1", __axis_rotated ? 0 : function (d) { return Math.ceil(x(d) - xAxis.tickOffset()); }) - .attr("x2", __axis_rotated ? Math.ceil(width) : function (d) { return Math.ceil(x(d) - xAxis.tickOffset()); }) - .attr("y1", __axis_rotated ? function (d) { return Math.ceil(x(d) - xAxis.tickOffset()); } : Math.ceil(margin.top)) - .attr("y2", __axis_rotated ? function (d) { return Math.ceil(x(d) - xAxis.tickOffset()); } : Math.ceil(height)) + xgrid.attr(xgridAttr) .style("opacity", function () { return +d3.select(this).attr(__axis_rotated ? 'y1' : 'x1') === (__axis_rotated ? height : 0) ? 0 : 1; }); xgrid.exit().remove(); } @@ -4475,28 +4464,35 @@ } // TODO: module.exports + // Features: + // 1. category axis + // 2. ceil values of translate/x/y to int for half pixel antialiasing function c3_axis(isCategory) { - var scale = d3.scale.linear(), orient = "bottom", innerTickSize = 6, outerTickSize = 6, tickPadding = 3, tickValues = null, tickFormat; + var scale = d3.scale.linear(), orient = "bottom", innerTickSize = 6, outerTickSize = 6, tickPadding = 3, tickValues = null, tickFormat, tickArguments; - var tickOffset = 0, tickTextNum = 10, tickCulling = true; + var tickOffset = 0, tickCulling = true; var categories = [], tickCentered; function axisX(selection, x) { selection.attr("transform", function (d) { - return "translate(" + (x(d) + tickOffset) + ", 0)"; + return "translate(" + Math.ceil(x(d) + tickOffset) + ", 0)"; }); } function axisY(selection, y) { selection.attr("transform", function (d) { - return "translate(0," + y(d) + ")"; + return "translate(0," + Math.ceil(y(d)) + ")"; }); } function scaleExtent(domain) { var start = domain[0], stop = domain[domain.length - 1]; return start < stop ? [ start, stop ] : [ stop, start ]; } - function generateTicks(domain) { - var i, ticks = []; + function generateTicks(scale) { + var i, domain, ticks = []; + if (scale.ticks) { + return scale.ticks.apply(scale, tickArguments); + } + domain = scale.domain(); for (i = Math.ceil(domain[0]); i < domain[1]; i++) { ticks.push(i); } @@ -4522,7 +4518,7 @@ var g = d3.select(this); var scale0 = this.__chart__ || scale, scale1 = this.__chart__ = copyScale(); - var ticks = tickValues ? tickValues : generateTicks(scale1.domain()), + var ticks = tickValues ? tickValues : generateTicks(scale1), tick = g.selectAll(".tick").data(ticks, scale1), tickEnter = tick.enter().insert("g", ".domain").attr("class", "tick").style("opacity", 1e-6), tickExit = d3.transition(tick.exit()).style("opacity", 1e-6).remove(), @@ -4542,7 +4538,7 @@ textUpdate = tickUpdate.select("text"); if (isCategory) { - tickOffset = (scale1(1) - scale1(0)) / 2; + tickOffset = Math.ceil((scale1(1) - scale1(0)) / 2); tickX = tickCentered ? 0 : tickOffset; } else { tickOffset = tickX = 0; @@ -4628,12 +4624,12 @@ tickCentered = isCentered; return axis; }; - axis.tickOffset = function () { + axis.tickOffset = function () { // This will be overwritten when normal x axis return tickOffset; }; - axis.ticks = function (n) { - if (!arguments.length) { return tickTextNum; } - tickTextNum = n; + axis.ticks = function() { + if (!arguments.length) return tickArguments; + tickArguments = arguments; return axis; }; axis.tickCulling = function (culling) { From 76b44b33df50158dc655ee7b58d1e0b88a1bc26e Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Mon, 5 May 2014 21:20:25 +0900 Subject: [PATCH 132/178] Remove Math.ceil not needed - #204 --- c3.js | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/c3.js b/c3.js index 07b2873..2524177 100644 --- a/c3.js +++ b/c3.js @@ -334,13 +334,13 @@ subXOrient = __axis_rotated ? "left" : "bottom"; var translate = { - main : function () { return "translate(" + (Math.ceil(margin.left) + 0.5) + "," + (Math.ceil(margin.top) + 0.5) + ")"; }, - context : function () { return "translate(" + (Math.ceil(margin2.left) + 0.5) + "," + (Math.ceil(margin2.top) + 0.5) + ")"; }, + main : function () { return "translate(" + margin.left + "," + margin.top + ")"; }, + context : function () { return "translate(" + margin2.left + "," + margin2.top + ")"; }, legend : function () { return "translate(" + margin3.left + "," + margin3.top + ")"; }, x : function () { return "translate(0," + (__axis_rotated ? 0 : height) + ")"; }, y : function () { return "translate(0," + (__axis_rotated ? height : 0) + ")"; }, y2 : function () { return "translate(" + (__axis_rotated ? 0 : width) + "," + (__axis_rotated ? 1 : 0) + ")"; }, - subx : function () { return "translate(0," + (__axis_rotated ? 0 : Math.ceil(height2)) + ")"; }, + subx : function () { return "translate(0," + (__axis_rotated ? 0 : height2) + ")"; }, arc: function () { return "translate(" + width / 2 + "," + height / 2 + ")"; } }; @@ -404,6 +404,7 @@ // TODO: configurabale var rotated_padding_left = 30, rotated_padding_right = __axis_rotated && !__axis_x_show ? 0 : 30, rotated_padding_top = 5; + // MEMO: each value should be int to avoid disabling antialiasing function updateSizes() { var legendHeight = getLegendHeight(), legendWidth = getLegendWidth(), legendHeightForBottom = isLegendRight ? 0 : legendHeight, @@ -469,9 +470,9 @@ function updateXgridFocus() { main.select('line.' + CLASS.xgridFocus) .attr("x1", __axis_rotated ? 0 : -10) - .attr("x2", __axis_rotated ? Math.ceil(width) : -10) - .attr("y1", __axis_rotated ? -10 : Math.ceil(margin.top)) - .attr("y2", __axis_rotated ? -10 : Math.ceil(height)); + .attr("x2", __axis_rotated ? width : -10) + .attr("y1", __axis_rotated ? -10 : margin.top) + .attr("y2", __axis_rotated ? -10 : height); } function updateRadius() { radiusExpanded = height / 2; @@ -3135,14 +3136,14 @@ xgridData = generateGridData(__grid_x_type, x); xgridAttr = __axis_rotated ? { 'x1': 0, - 'x2': Math.ceil(width), + 'x2': width, 'y1': function (d) { return x(d) - tickOffset; }, 'y2': function (d) { return x(d) - tickOffset; } } : { 'x1': function (d) { return x(d) + tickOffset; }, 'x2': function (d) { return x(d) + tickOffset; }, - 'y1': Math.ceil(margin.top), - 'y2': Math.ceil(height) + 'y1': margin.top, + 'y2': height }; xgrid = main.select('.' + CLASS.xgrids).selectAll('.' + CLASS.xgrid) .data(xgridData); @@ -3169,9 +3170,9 @@ xgridLines.select('line') .transition().duration(duration) .attr("x1", __axis_rotated ? 0 : xv) - .attr("x2", __axis_rotated ? Math.ceil(width) : xv) - .attr("y1", __axis_rotated ? xv : Math.ceil(margin.top)) - .attr("y2", __axis_rotated ? xv : Math.ceil(height)) + .attr("x2", __axis_rotated ? width : xv) + .attr("y1", __axis_rotated ? xv : margin.top) + .attr("y2", __axis_rotated ? xv : height) .style("opacity", 1); xgridLines.select('text') .transition().duration(duration) @@ -3215,9 +3216,9 @@ ygridLines.select('line') .transition().duration(duration) .attr("x1", __axis_rotated ? yv : 0) - .attr("x2", __axis_rotated ? yv : Math.ceil(width)) + .attr("x2", __axis_rotated ? yv : width) .attr("y1", __axis_rotated ? 0 : yv) - .attr("y2", __axis_rotated ? Math.ceil(height) : yv) + .attr("y2", __axis_rotated ? height : yv) .style("opacity", 1); ygridLines.select('text') .transition().duration(duration) From ab486bbaea2eb9329c105efdc14dbb38cf9e66dc Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Mon, 5 May 2014 21:42:08 +0900 Subject: [PATCH 133/178] Update version to 0.1.35 --- bower.json | 2 +- c3.js | 2 +- c3.min.js | 2 +- package.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bower.json b/bower.json index a918d0e..0393434 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "c3", "main": "c3.min.js", - "version": "0.1.34", + "version": "0.1.35", "homepage": "https://github.com/masayuki0812/c3", "authors": [ "Masayuki Tanaka " diff --git a/c3.js b/c3.js index 8f921a2..3fe59eb 100644 --- a/c3.js +++ b/c3.js @@ -2,7 +2,7 @@ 'use strict'; var c3 = { - version: "0.1.34" + version: "0.1.35" }; var CLASS = { diff --git a/c3.min.js b/c3.min.js index 571f761..0307c5d 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.ceil(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.ceil(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&a_f&&(_f=0),0>bg&&(bg=0),ag=mh?Yf.left-hj-ij:_f,cg=mh?bg:eg-Zf.top-Zf.bottom,0>ag&&(ag=0),0>cg&&(cg=0),q(),cj&&ie(Hf.data.targets)&&($f.left=_f/2+gg)}function p(){rj.select("line."+g.xgridFocus).attr("x1",mh?0:-10).attr("x2",mh?_f:-10).attr("y1",mh?-10:Yf.top).attr("y2",mh?-10:bg)}function q(){gg=bg/2,fg=.95*gg,hg=he(Hf.data.targets)?.6*fg:0}function r(){var a=mh?g.axisX:g.axisY,b=rj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Gf.select(Jf).node().getBoundingClientRect(),e=c.right-d.left-u();return e>0?e:0}function s(){return Kf?Kf:y()}function t(){var a=Lf?Lf:z();return a>0?a:320}function u(){return ie(Hf.data.targets)?0:Mf?Mf:mh?nh?w("x"):1:!Fh||Kh?1:w("y")}function v(){var a=1;return ie(Hf.data.targets)?0:Nf?Nf:cj?Q()+20+(Oh&&!mh?w("y2"):a):Oh?Th||mh?a:w("y2"):a}function w(a){var b=kb(a);return b.isInner?20+Db(a):40+Db(a)}function x(a){return"x"!==a||nh?"x"===a&&Ch?Ch:"y"!==a||Fh?"y2"!==a||Oh?(kb(a).isInner?30:40)+("y2"===a?-10:0):jj:gh&&!cj?10:1:0}function y(){return+Gf.select(Jf).style("width").replace("px","")}function z(){return+Gf.select(Jf).style("height").replace("px","")}function A(a){return a?-5:-(Yf.left-1)}function B(a){return a?-20:-4}function C(){return A(!mh)}function D(){return B(!mh)}function E(){return A(mh)}function F(){return B(mh)}function G(a){return a?_f+2+4:Yf.left+20}function H(a){return a?(Ch?Ch:0)+80:bg+8}function I(){return G(!mh)}function J(){return H(!mh)}function K(){return G(mh)}function L(){return H(mh)}function M(){var a,b,c,d,e,f=Ac(Hf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ug(b.x)-ug(a.x),0===c?mh?bg:_f:(d=zc(),e=ee(Hf.data.targets)?(d-(Mi?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function N(a){dj=a}function O(a){ej=a}function P(a){fj=a}function Q(){return gh?cj?ej*(dj+1):dg:0}function R(){return gh?cj?eg:fj*(dj+1):0}function S(){var a,b,c=!ug;mg=mh?1:0,ng=mh?bg:_f,og=mh?0:bg,pg=mh?_f:1,qg=mg,rg=ng,sg=mh?0:cg,tg=mh?ag:1,ug=U(mg,ng,c?void 0:ug.domain(),function(){return Ag.tickOffset()}),vg=V(og,pg,c?void 0:vg.domain()),wg=V(og,pg,c?void 0:wg.domain()),xg=U(mg,ng,wj,function(a){return a%1?0:Dg.tickOffset()}),yg=V(sg,tg,c?void 0:yg.domain()),zg=V(sg,tg,c?void 0:zg.domain()),a=_(),b=xh?xh:c?void 0:Ag.tickValues(),Ag=Y(ug,Zi,a,b),Dg=Y(xg,aj,a,b),Bg=Z(vg,$i,Lh,Nh),Cg=Z(wg,_i,Uh,Wh),c||(kj.scale(xg),Qf&&oj.scale(ug)),T()}function T(){ig=Gb(),jg=Hb(),kg=Hb(.98)}function U(a,b,c,d){var e,f=(Li?Gf.time.scale():Gf.scale.linear()).range([a,b]),g=c?f.domain(c):f;Mi?(d=d||function(){return 0},f=function(a){return Math.ceil(g(a)+d(a))}):f=function(a){return Math.ceil(g(a))};for(e in g)f[e]=g[e];return f.orgDomain=function(){return g.domain()},Mi&&(f.domain=function(a){return arguments.length?(g.domain(a),f):(a=g.domain(),[a[0],a[1]+1])}),f}function V(a,b,c){var d=Gf.scale.linear().range([a,b]);return c&&d.domain(c),d}function W(a){return"y2"===$(a)?wg:vg}function X(a){return"y2"===$(a)?zg:yg}function Y(a,b,c,d){var f=e(Gf,Mi).scale(a).orient(b);return f.tickFormat(c).tickValues(d),Mi?(f.tickCentered(rh),Be(th)&&(th=!1),f.categories(qh)):f.tickOffset=function(){var a=Bc(Hf.data.targets),b=ug(a[1])-ug(a[0]),c=b?b:mh?bg:_f;return c/zc()/2},f}function Z(a,b,c,d){return e(Gf).scale(a).orient(b).tickFormat(c).ticks(d)}function $(a){return a in Lg?Lg[a]:"y"}function _(){var a=Li?Wi:Mi?Tc:function(a){return 0>a?a.toFixed(0):a};return sh&&("function"==typeof sh?a=sh:Li&&(a=function(a){return a?Vi(sh)(a):""})),a}function ab(a){var b;return"y"===a?b=Jh:"y2"===a?b=Sh:"x"===a&&(b=Eh),b}function bb(a){var b=ab(a);return"string"==typeof b?b:b?b.text:null}function cb(a,b){var c=ab(a);"string"==typeof c?"y"===a?Jh=b:"y2"===a?Sh=b:"x"===a&&(Eh=b):c&&(c.text=b)}function db(a){return 10*Math.sin(Math.PI*(a/180))}function eb(a){return 11.5-2.5*(a/15)}function fb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",eb(c)).attr("x",db(c)).attr("transform","rotate("+c+")")}function gb(a,b){var c=ab(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 hb(){return gb("x",mh?"inner-top":"inner-right")}function ib(){return gb("y",mh?"inner-right":"inner-top")}function jb(){return gb("y2",mh?"inner-right":"inner-top")}function kb(a){return"y2"===a?jb():"y"===a?ib():hb()}function lb(){return bb("x")}function mb(){return bb("y")}function nb(){return bb("y2")}function ob(a,b){return a?b.isLeft?0:b.isCenter?_f/2:_f:b.isBottom?-bg:b.isMiddle?-bg/2:0}function pb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function qb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function rb(){return ob(!mh,hb())}function sb(){return ob(mh,ib())}function tb(){return ob(mh,jb())}function ub(){return pb(!mh,hb())}function vb(){return pb(mh,ib())}function wb(){return pb(mh,jb())}function xb(){var a=hb();return mh?a.isInner?"1.2em":-25-Db("x"):a.isInner?"-0.5em":Ch?Ch-10:"3em"}function yb(){var a=ib();return mh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Db("y")}function zb(){var a=jb();return mh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Db("y2")}function Ab(){return qb(!mh,hb())}function Bb(){return qb(mh,ib())}function Cb(){return qb(mh,jb())}function Db(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Gf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Eb(a){var b=rj.select("."+g.axisX+" ."+g.axisXLabel),c=rj.select("."+g.axisY+" ."+g.axisYLabel),d=rj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",rb).attr("dx",ub).attr("dy",xb).text(lb),(a?c.transition():c).attr("x",sb).attr("dx",vb).attr("dy",yb).attr("dy",yb).text(mb),(a?d.transition():d).attr("x",tb).attr("dx",wb).attr("dy",zb).text(nb)}function Fb(a){var b=!1;return lg(Ic(Hf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Gb(){var a=Gf.svg.arc().outerRadius(fg).innerRadius(hg),b=function(b,c){var d;return c?a(b):(d=Fb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Hb(a){var b=Gf.svg.arc().outerRadius(gg*(a?a:1)).innerRadius(hg);return function(a){var c=Fb(a);return c?b(c):"M 0 0"}}function Ib(a,b){return pe(a.data)?ig(a,b):"M 0 0"}function Jb(a){var b,c,d,e,f=Fb(a),g="";return f&&(b=ig.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*fg*.8+","+d/e*fg*.8+")"),g}function Kb(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Lb(a){return pc({id:a.data.id,value:a.value,ratio:Kb(a)})}function Mb(a){var b,c,d,e;return Pb()?(b=Fb(a),c=b?b.value:null,d=Kb(b),e=Qb(),e?e(c,d):Dd(c,d)):""}function Nb(a,b){var c=pj.selectAll("."+g.chartArc+pd(a)),d=pj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});ve(a)&&c.selectAll("path").transition().duration(50).attr("d",jg).transition().duration(100).attr("d",kg).each(function(a){oe(a.data)}),b||d.style("opacity",.3)}function Ob(a){var b=pj.selectAll("."+g.chartArc+pd(a));b.selectAll("path").transition().duration(50).attr("d",ig),pj.selectAll("."+g.arc).style("opacity",1)}function Pb(){return he(Hf.data.targets)?qi:ki}function Qb(){return he(Hf.data.targets)?ri:li}function Rb(){return he(Hf.data.targets)?ti:""}function Sb(){var a=he(Hf.data.targets)?ui:ni;return"function"==typeof a?a:function(){}}function Tb(){var a=he(Hf.data.targets)?vi:oi;return"function"==typeof a?a:function(){}}function Ub(){var a=he(Hf.data.targets)?wi:pi;return"function"==typeof a?a:function(){}}function Vb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(Kg.length>0)for(g=Rc(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 Gf.min(Object.keys(i).map(function(a){return Gf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(Kg.length>0)for(g=Sc(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 Gf.max(Object.keys(i).map(function(a){return Gf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return $(a.id)===c}),m="y2"===c?Qh:Hh,n="y2"===c?Ph:Gh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Rh:Ih,r=xd()&&mh;return 0===l.length?"y2"===c?wg.domain():vg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=yd(o,p),j=ac(vg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Mh&&(f=b(Mh.top)?Mh.top:e,g=b(Mh.bottom)?Mh.bottom:e),"y2"===c&&Vh&&(f=b(Vh.top)?Vh.top:e,g=b(Vh.bottom)?Vh.bottom:e),ee(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return Ah?Li?xe(Ah):Ah:Gf.min(a,function(a){return Gf.min(a.values,function(a){return a.x})})}function Zb(a){return zh?Li?xe(zh):zh:Gf.max(a,function(a){return Gf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Mi?d=0:ee(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Bh&&Ce(Bh)?(e=b(Bh.left)?Bh.left:d,f=b(Bh.right)?Bh.right:d):e=f="number"==typeof Bh?Bh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return c-d!==0||Mi||(c=Li?new Date(.5*c.getTime()):-.5,d=Li?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Li?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Li?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?vg:wg;return b="y"===a.axis||"y2"===a.axis?mh?bg:"start"in a?d(a.start):bg:mh?"end"in a?ug(Li?xe(a.end):a.end):bg:bg,c>b?0:b-c}function ic(a){return Eg&&a===Eg||Ce(Fg)&&De(Fg,a)}function jc(a){return!ic(a)}function kc(a){return Eg?Eg:Ce(Fg)?Fg[a]:null}function lc(a,b){var c,d=b&&Ce(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=Hf.data.xs[b])}),c}function mc(a,b){return a in Hf.data.xs&&Hf.data.xs[a]&&Hf.data.xs[a][b]?Hf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){Fg[b]=a[b]})}function oc(a){return 1===Gf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=Ig[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),Hf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=Li?a?a instanceof Date?a:xe(a):xe(mc(c,d)):Ni&&!Mi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Hf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Eg?(d=Object.keys(Hf.data.xs),Hf.data.xs[c]=d.length>0?Hf.data.xs[d[0]]:void 0):Ce(Fg)&&(Hf.data.xs[c]=lc(f,Hf.data.targets)):Hf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Hf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Hg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ni&&Mi&&0===c&&g&&(0===e&&(qh=[]),qh.push(g)),("undefined"==typeof a[b]||Hf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Mg&&ce(Cc(c).filter(function(a){return!(a in Ng)}),Mg),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&Hf.data.targets[0].values[a-1]?Hf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(Hf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Li?new Date(i):i);j.push(e)}return Li||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Xi=Xi.concat(a)}function Mc(a){Xi=Xi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Yi=Yi.concat(a)}function Oc(a){Yi=Yi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Jd(a,f))),(a[g].x||0===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=Ee(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Nd(a,b){return Gf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Od(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 Pd(){return Pg&&"desc"===Pg.toLowerCase()}function Qd(){return Pg&&"asc"===Pg.toLowerCase()}function Rd(a){var b=Qd(),c=Pd();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 Pg&&a.sort(Pg),a}function Sd(a,c){var d,e,f,g,h,i,j,k=ie(Hf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&yi&&(uj.html(Bi(a,_(),zd(k),Ui)).style("display","block"),d=uj.property("offsetWidth"),e=uj.property("offsetHeight"),k?(g=_f/2+c[0],i=bg/2+c[1]+20):(mh?(f=r(),g=f+c[0]+100,h=g+d,j=s()-v(),i=ug(l[0].x)+20):(f=r(),g=f+u()+ug(l[0].x)+20,h=g+d,j=f+s()-v(),i=c[1]+15),h>j&&(g-=d+60),i+e>t()&&(i-=e+30)),uj.style("top",i+"px").style("left",g+"px"))}function Td(){uj.style("display","none")}function Ud(a){var c=a.filter(function(a){return a&&b(a.value)});if(yi&&!fe(Hf.data.targets)&&!ie(Hf.data.targets)){var d=rj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(mh?"y1":"x1",Fd).attr(mh?"y2":"x2",Fd),kf(d,"grid")}}function Vd(){rj.select("line."+g.xgridFocus).style("visibility","hidden")}function Wd(a,b){var c,d,e,f,g=[];if("year"===a)for(c=_b(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)g.push(new Date(f+"-01-01 00:00:00"));else g=b.ticks(10);return g}function Xd(a){return a.x||0===a.x?ug(a.x):null}function Yd(a){return W(a.id)(a.value)}function Zd(){var a,b,d={},e=0;return Ic(Fc(le)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function be(a,b){return"number"==typeof ii?ii:b?2*a.tickOffset()*ji/b:0}function ce(a,b){Dc(a).forEach(function(a){yj[a]=b===Ng[a],Ng[a]=b})}function de(a,b){var c=!1;return a.forEach(function(a){Ng[a.id]===b&&(c=!0),a.id in Ng||"line"!==b||(c=!0)}),c}function ee(a){return de(a,"bar")}function fe(a){return de(a,"scatter")}function ge(a){return de(a,"pie")}function he(a){return de(a,"donut")}function ie(a){return ge(a)||he(a)}function je(a){var b="string"==typeof a?a:a.id;return!(b in Ng)||"line"===Ng[b]||"spline"===Ng[b]||"area"===Ng[b]||"area-spline"===Ng[b]}function ke(a){var b="string"==typeof a?a:a.id;return"spline"===Ng[b]||"area-spline"===Ng[b]}function le(a){var b="string"==typeof a?a:a.id;return"bar"===Ng[b]}function me(a){var b="string"==typeof a?a:a.id;return"scatter"===Ng[b]}function ne(a){var b="string"==typeof a?a:a.id;return"pie"===Ng[b]}function oe(a){var b="string"==typeof a?a:a.id;return"donut"===Ng[b]}function pe(a){return ne(a)||oe(a)}function qe(a){return je(a)?[a]:[]}function re(a){return pe(a.data)?[a]:[]}function se(a){return le(a)?a.values:[]}function te(a){return je(a)||me(a)?a.values:[]}function ue(a){return le(a)||je(a)?a.values:[]}function ve(a){return oe(a)&&si||ne(a)&&mi}function we(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function xe(b){var c;try{c=Gg?Gf.time.format(Gg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Gg)}return c}function ye(a,b){var c=Gf.mouse(a),d=Gf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function De(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Ee(a,b){var c="y"===$(a.id)?vg:wg,d=mh?1:0,e=mh?0:1;return Math.pow(ug(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Fe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ge(a,b,c){_g(b,a.node()),rj.select("."+g.selectedCircles+od(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(g.selectedCircle,c)}).attr("cx",mh?Yd:Xd).attr("cy",mh?Xd:Yd).attr("stroke",function(){return Ui(b)}).attr("r",1.4*Re(b)).transition().duration(100).attr("r",Re)}function He(a,b,c){ah(b,a.node()),rj.select("."+g.selectedCircles+od(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ie(a,b,c,d){a?Ge(b,c,d):He(b,c,d)}function Je(a,b){_g(b,a.node()),a.transition().duration(100).style("fill",function(){return Gf.rgb(Ui(b)).brighter(.75)})}function Ke(a,b){ah(b,a.node()),a.transition().duration(100).style("fill",function(){return Ui(b)})}function Le(a,b,c,d){a?Je(b,c,d):Ke(b,c,d)}function Me(a,b,c,d){Le(a,b,c.data,d)}function Ne(a){return"circle"===a.nodeName?Ie:Gf.select(a).classed(g.bar)?Le:Me}function Oe(a){return a.filter(function(a){return b(a.value)})}function Pe(a){return bi?"function"==typeof ci?ci(a):ci:0}function Qe(a){return ei?fi?fi:1.75*Pe(a):Pe(a)}function Re(a){return gi?gi:4*Pe(a)}function Se(a,c){return(c?rj.selectAll("."+g.circles+od(c)):rj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Te(a,b){Se(a,b).classed(g.EXPANDED,!0).attr("r",Qe)}function Ue(a){Se(a).filter(function(){return Gf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Pe)}function Ve(a){return rj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function We(a){Ve(a).classed(g.EXPANDED,!0)}function Xe(a){Ve(a).classed(g.EXPANDED,!1)}function Ye(a,b){var c=af(a,b);return function(a,b){var d=c(a,b),e=mh?1:0,f=mh?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 Ze(a,b){var c=af(a,!1),d=b?$e:_e;return function(a,b){return d(c(a,b),a,this)}}function $e(a,b){var c;return mh?(c=le(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function _e(a,b,c){var d=c.getBoundingClientRect();return mh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:le(b)?-3:-6)}function af(a,b){var c=a.__max__+1,d=be(Ag,c),e=$d(d,c,a,!!b),f=_d(!!b),g=ae(a,!!b),h=b?X:W;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return mh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function bf(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;gb?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&a_f&&(_f=0),0>bg&&(bg=0),ag=mh?Yf.left-hj-ij:_f,cg=mh?bg:eg-Zf.top-Zf.bottom,0>ag&&(ag=0),0>cg&&(cg=0),q(),cj&&ie(Hf.data.targets)&&($f.left=_f/2+gg)}function p(){rj.select("line."+g.xgridFocus).attr("x1",mh?0:-10).attr("x2",mh?_f:-10).attr("y1",mh?-10:Yf.top).attr("y2",mh?-10:bg)}function q(){gg=bg/2,fg=.95*gg,hg=he(Hf.data.targets)?.6*fg:0}function r(){var a=mh?g.axisX:g.axisY,b=rj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Gf.select(Jf).node().getBoundingClientRect(),e=c.right-d.left-u();return e>0?e:0}function s(){return Kf?Kf:y()}function t(){var a=Lf?Lf:z();return a>0?a:320}function u(){return ie(Hf.data.targets)?0:Mf?Mf:mh?nh?w("x"):1:!Fh||Kh?1:w("y")}function v(){var a=1;return ie(Hf.data.targets)?0:Nf?Nf:cj?Q()+20+(Oh&&!mh?w("y2"):a):Oh?Th||mh?a:w("y2"):a}function w(a){var b=kb(a);return b.isInner?20+Db(a):40+Db(a)}function x(a){return"x"!==a||nh?"x"===a&&Ch?Ch:"y"!==a||Fh?"y2"!==a||Oh?(kb(a).isInner?30:40)+("y2"===a?-10:0):jj:gh&&!cj?10:1:0}function y(){return+Gf.select(Jf).style("width").replace("px","")}function z(){return+Gf.select(Jf).style("height").replace("px","")}function A(a){return a?-5:-(Yf.left-1)}function B(a){return a?-20:-4}function C(){return A(!mh)}function D(){return B(!mh)}function E(){return A(mh)}function F(){return B(mh)}function G(a){return a?_f+2+4:Yf.left+20}function H(a){return a?(Ch?Ch:0)+80:bg+8}function I(){return G(!mh)}function J(){return H(!mh)}function K(){return G(mh)}function L(){return H(mh)}function M(){var a,b,c,d,e,f=Ac(Hf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ug(b.x)-ug(a.x),0===c?mh?bg:_f:(d=zc(),e=ee(Hf.data.targets)?(d-(Mi?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function N(a){dj=a}function O(a){ej=a}function P(a){fj=a}function Q(){return gh?cj?ej*(dj+1):dg:0}function R(){return gh?cj?eg:fj*(dj+1):0}function S(){var a,b,c=!ug;mg=mh?1:0,ng=mh?bg:_f,og=mh?0:bg,pg=mh?_f:1,qg=mg,rg=ng,sg=mh?0:cg,tg=mh?ag:1,ug=U(mg,ng,c?void 0:ug.domain(),function(){return Ag.tickOffset()}),vg=V(og,pg,c?void 0:vg.domain()),wg=V(og,pg,c?void 0:wg.domain()),xg=U(mg,ng,wj,function(a){return a%1?0:Dg.tickOffset()}),yg=V(sg,tg,c?void 0:yg.domain()),zg=V(sg,tg,c?void 0:zg.domain()),a=_(),b=xh?xh:c?void 0:Ag.tickValues(),Ag=Y(ug,Zi,a,b),Dg=Y(xg,aj,a,b),Bg=Z(vg,$i,Lh,Nh),Cg=Z(wg,_i,Uh,Wh),c||(kj.scale(xg),Qf&&oj.scale(ug)),T()}function T(){ig=Gb(),jg=Hb(),kg=Hb(.98)}function U(a,b,c,d){var e,f=(Li?Gf.time.scale():Gf.scale.linear()).range([a,b]),g=c?f.domain(c):f;Mi?(d=d||function(){return 0},f=function(a){return Math.ceil(g(a)+d(a))}):f=function(a){return Math.ceil(g(a))};for(e in g)f[e]=g[e];return f.orgDomain=function(){return g.domain()},Mi&&(f.domain=function(a){return arguments.length?(g.domain(a),f):(a=g.domain(),[a[0],a[1]+1])}),f}function V(a,b,c){var d=Gf.scale.linear().range([a,b]);return c&&d.domain(c),d}function W(a){return"y2"===$(a)?wg:vg}function X(a){return"y2"===$(a)?zg:yg}function Y(a,b,c,d){var f=e(Gf,Mi).scale(a).orient(b);return f.tickFormat(c).tickValues(d),Mi?(f.tickCentered(rh),Be(th)&&(th=!1),f.categories(qh)):f.tickOffset=function(){var a=Bc(Hf.data.targets),b=ug(a[1])-ug(a[0]),c=b?b:mh?bg:_f;return c/zc()/2},f}function Z(a,b,c,d){return e(Gf).scale(a).orient(b).tickFormat(c).ticks(d)}function $(a){return a in Lg?Lg[a]:"y"}function _(){var a=Li?Wi:Mi?Tc:function(a){return 0>a?a.toFixed(0):a};return sh&&("function"==typeof sh?a=sh:Li&&(a=function(a){return a?Vi(sh)(a):""})),a}function ab(a){var b;return"y"===a?b=Jh:"y2"===a?b=Sh:"x"===a&&(b=Eh),b}function bb(a){var b=ab(a);return"string"==typeof b?b:b?b.text:null}function cb(a,b){var c=ab(a);"string"==typeof c?"y"===a?Jh=b:"y2"===a?Sh=b:"x"===a&&(Eh=b):c&&(c.text=b)}function db(a){return 10*Math.sin(Math.PI*(a/180))}function eb(a){return 11.5-2.5*(a/15)}function fb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",eb(c)).attr("x",db(c)).attr("transform","rotate("+c+")")}function gb(a,b){var c=ab(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 hb(){return gb("x",mh?"inner-top":"inner-right")}function ib(){return gb("y",mh?"inner-right":"inner-top")}function jb(){return gb("y2",mh?"inner-right":"inner-top")}function kb(a){return"y2"===a?jb():"y"===a?ib():hb()}function lb(){return bb("x")}function mb(){return bb("y")}function nb(){return bb("y2")}function ob(a,b){return a?b.isLeft?0:b.isCenter?_f/2:_f:b.isBottom?-bg:b.isMiddle?-bg/2:0}function pb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function qb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function rb(){return ob(!mh,hb())}function sb(){return ob(mh,ib())}function tb(){return ob(mh,jb())}function ub(){return pb(!mh,hb())}function vb(){return pb(mh,ib())}function wb(){return pb(mh,jb())}function xb(){var a=hb();return mh?a.isInner?"1.2em":-25-Db("x"):a.isInner?"-0.5em":Ch?Ch-10:"3em"}function yb(){var a=ib();return mh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Db("y")}function zb(){var a=jb();return mh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Db("y2")}function Ab(){return qb(!mh,hb())}function Bb(){return qb(mh,ib())}function Cb(){return qb(mh,jb())}function Db(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Gf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Eb(a){var b=rj.select("."+g.axisX+" ."+g.axisXLabel),c=rj.select("."+g.axisY+" ."+g.axisYLabel),d=rj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",rb).attr("dx",ub).attr("dy",xb).text(lb),(a?c.transition():c).attr("x",sb).attr("dx",vb).attr("dy",yb).attr("dy",yb).text(mb),(a?d.transition():d).attr("x",tb).attr("dx",wb).attr("dy",zb).text(nb)}function Fb(a){var b=!1;return lg(Ic(Hf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Gb(){var a=Gf.svg.arc().outerRadius(fg).innerRadius(hg),b=function(b,c){var d;return c?a(b):(d=Fb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Hb(a){var b=Gf.svg.arc().outerRadius(gg*(a?a:1)).innerRadius(hg);return function(a){var c=Fb(a);return c?b(c):"M 0 0"}}function Ib(a,b){return pe(a.data)?ig(a,b):"M 0 0"}function Jb(a){var b,c,d,e,f=Fb(a),g="";return f&&(b=ig.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*fg*.8+","+d/e*fg*.8+")"),g}function Kb(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Lb(a){return pc({id:a.data.id,value:a.value,ratio:Kb(a)})}function Mb(a){var b,c,d,e;return Pb()?(b=Fb(a),c=b?b.value:null,d=Kb(b),e=Qb(),e?e(c,d):Dd(c,d)):""}function Nb(a,b){var c=pj.selectAll("."+g.chartArc+pd(a)),d=pj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});ve(a)&&c.selectAll("path").transition().duration(50).attr("d",jg).transition().duration(100).attr("d",kg).each(function(a){oe(a.data)}),b||d.style("opacity",.3)}function Ob(a){var b=pj.selectAll("."+g.chartArc+pd(a));b.selectAll("path").transition().duration(50).attr("d",ig),pj.selectAll("."+g.arc).style("opacity",1)}function Pb(){return he(Hf.data.targets)?qi:ki}function Qb(){return he(Hf.data.targets)?ri:li}function Rb(){return he(Hf.data.targets)?ti:""}function Sb(){var a=he(Hf.data.targets)?ui:ni;return"function"==typeof a?a:function(){}}function Tb(){var a=he(Hf.data.targets)?vi:oi;return"function"==typeof a?a:function(){}}function Ub(){var a=he(Hf.data.targets)?wi:pi;return"function"==typeof a?a:function(){}}function Vb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(Kg.length>0)for(g=Rc(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 Gf.min(Object.keys(i).map(function(a){return Gf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(Kg.length>0)for(g=Sc(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 Gf.max(Object.keys(i).map(function(a){return Gf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return $(a.id)===c}),m="y2"===c?Qh:Hh,n="y2"===c?Ph:Gh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Rh:Ih,r=xd()&&mh;return 0===l.length?"y2"===c?wg.domain():vg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=yd(o,p),j=ac(vg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Mh&&(f=b(Mh.top)?Mh.top:e,g=b(Mh.bottom)?Mh.bottom:e),"y2"===c&&Vh&&(f=b(Vh.top)?Vh.top:e,g=b(Vh.bottom)?Vh.bottom:e),ee(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return Ah?Li?xe(Ah):Ah:Gf.min(a,function(a){return Gf.min(a.values,function(a){return a.x})})}function Zb(a){return zh?Li?xe(zh):zh:Gf.max(a,function(a){return Gf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Mi?d=0:ee(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Bh&&Ce(Bh)?(e=b(Bh.left)?Bh.left:d,f=b(Bh.right)?Bh.right:d):e=f="number"==typeof Bh?Bh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return c-d!==0||Mi||(c=Li?new Date(.5*c.getTime()):-.5,d=Li?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Li?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Li?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?vg:wg;return b="y"===a.axis||"y2"===a.axis?mh?bg:"start"in a?d(a.start):bg:mh?"end"in a?ug(Li?xe(a.end):a.end):bg:bg,c>b?0:b-c}function ic(a){return Eg&&a===Eg||Ce(Fg)&&De(Fg,a)}function jc(a){return!ic(a)}function kc(a){return Eg?Eg:Ce(Fg)?Fg[a]:null}function lc(a,b){var c,d=b&&Ce(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=Hf.data.xs[b])}),c}function mc(a,b){return a in Hf.data.xs&&Hf.data.xs[a]&&Hf.data.xs[a][b]?Hf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){Fg[b]=a[b]})}function oc(a){return 1===Gf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=Ig[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),Hf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=Li?a?a instanceof Date?a:xe(a):xe(mc(c,d)):Ni&&!Mi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Hf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Eg?(d=Object.keys(Hf.data.xs),Hf.data.xs[c]=d.length>0?Hf.data.xs[d[0]]:void 0):Ce(Fg)&&(Hf.data.xs[c]=lc(f,Hf.data.targets)):Hf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Hf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Hg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ni&&Mi&&0===c&&g&&(0===e&&(qh=[]),qh.push(g)),("undefined"==typeof a[b]||Hf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Mg&&ce(Cc(c).filter(function(a){return!(a in Ng)}),Mg),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&Hf.data.targets[0].values[a-1]?Hf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(Hf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Li?new Date(i):i);j.push(e)}return Li||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Xi=Xi.concat(a)}function Mc(a){Xi=Xi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Yi=Yi.concat(a)}function Oc(a){Yi=Yi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Jd(a,f))),(a[g].x||0===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=Ee(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Nd(a,b){return Gf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Od(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 Pd(){return Pg&&"desc"===Pg.toLowerCase()}function Qd(){return Pg&&"asc"===Pg.toLowerCase()}function Rd(a){var b=Qd(),c=Pd();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 Pg&&a.sort(Pg),a}function Sd(a,c){var d,e,f,g,h,i,j,k=ie(Hf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&yi&&(uj.html(Bi(a,_(),zd(k),Ui)).style("display","block"),d=uj.property("offsetWidth"),e=uj.property("offsetHeight"),k?(g=_f/2+c[0],i=bg/2+c[1]+20):(mh?(f=r(),g=f+c[0]+100,h=g+d,j=s()-v(),i=ug(l[0].x)+20):(f=r(),g=f+u()+ug(l[0].x)+20,h=g+d,j=f+s()-v(),i=c[1]+15),h>j&&(g-=d+60),i+e>t()&&(i-=e+30)),uj.style("top",i+"px").style("left",g+"px"))}function Td(){uj.style("display","none")}function Ud(a){var c=a.filter(function(a){return a&&b(a.value)});if(yi&&!fe(Hf.data.targets)&&!ie(Hf.data.targets)){var d=rj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(mh?"y1":"x1",Fd).attr(mh?"y2":"x2",Fd),kf(d,"grid")}}function Vd(){rj.select("line."+g.xgridFocus).style("visibility","hidden")}function Wd(a,b){var c,d,e,f,g=[];if("year"===a)for(c=_b(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)g.push(new Date(f+"-01-01 00:00:00"));else g=b.ticks(10);return g}function Xd(a){return a.x||0===a.x?ug(a.x):null}function Yd(a){return W(a.id)(a.value)}function Zd(){var a,b,d={},e=0;return Ic(Fc(le)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function be(a,b){return"number"==typeof ii?ii:b?2*a.tickOffset()*ji/b:0}function ce(a,b){Dc(a).forEach(function(a){yj[a]=b===Ng[a],Ng[a]=b})}function de(a,b){var c=!1;return a.forEach(function(a){Ng[a.id]===b&&(c=!0),a.id in Ng||"line"!==b||(c=!0)}),c}function ee(a){return de(a,"bar")}function fe(a){return de(a,"scatter")}function ge(a){return de(a,"pie")}function he(a){return de(a,"donut")}function ie(a){return ge(a)||he(a)}function je(a){var b="string"==typeof a?a:a.id;return!(b in Ng)||"line"===Ng[b]||"spline"===Ng[b]||"area"===Ng[b]||"area-spline"===Ng[b]}function ke(a){var b="string"==typeof a?a:a.id;return"spline"===Ng[b]||"area-spline"===Ng[b]}function le(a){var b="string"==typeof a?a:a.id;return"bar"===Ng[b]}function me(a){var b="string"==typeof a?a:a.id;return"scatter"===Ng[b]}function ne(a){var b="string"==typeof a?a:a.id;return"pie"===Ng[b]}function oe(a){var b="string"==typeof a?a:a.id;return"donut"===Ng[b]}function pe(a){return ne(a)||oe(a)}function qe(a){return je(a)?[a]:[]}function re(a){return pe(a.data)?[a]:[]}function se(a){return le(a)?a.values:[]}function te(a){return je(a)||me(a)?a.values:[]}function ue(a){return le(a)||je(a)?a.values:[]}function ve(a){return oe(a)&&si||ne(a)&&mi}function we(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function xe(b){var c;try{c=Gg?Gf.time.format(Gg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Gg)}return c}function ye(a,b){var c=Gf.mouse(a),d=Gf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function De(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Ee(a,b){var c="y"===$(a.id)?vg:wg,d=mh?1:0,e=mh?0:1;return Math.pow(ug(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Fe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ge(a,b,c){_g(b,a.node()),rj.select("."+g.selectedCircles+od(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(g.selectedCircle,c)}).attr("cx",mh?Yd:Xd).attr("cy",mh?Xd:Yd).attr("stroke",function(){return Ui(b)}).attr("r",1.4*Re(b)).transition().duration(100).attr("r",Re)}function He(a,b,c){ah(b,a.node()),rj.select("."+g.selectedCircles+od(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ie(a,b,c,d){a?Ge(b,c,d):He(b,c,d)}function Je(a,b){_g(b,a.node()),a.transition().duration(100).style("fill",function(){return Gf.rgb(Ui(b)).brighter(.75)})}function Ke(a,b){ah(b,a.node()),a.transition().duration(100).style("fill",function(){return Ui(b)})}function Le(a,b,c,d){a?Je(b,c,d):Ke(b,c,d)}function Me(a,b,c,d){Le(a,b,c.data,d)}function Ne(a){return"circle"===a.nodeName?Ie:Gf.select(a).classed(g.bar)?Le:Me}function Oe(a){return a.filter(function(a){return b(a.value)})}function Pe(a){return bi?"function"==typeof ci?ci(a):ci:0}function Qe(a){return ei?fi?fi:1.75*Pe(a):Pe(a)}function Re(a){return gi?gi:4*Pe(a)}function Se(a,c){return(c?rj.selectAll("."+g.circles+od(c)):rj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Te(a,b){Se(a,b).classed(g.EXPANDED,!0).attr("r",Qe)}function Ue(a){Se(a).filter(function(){return Gf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Pe)}function Ve(a){return rj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function We(a){Ve(a).classed(g.EXPANDED,!0)}function Xe(a){Ve(a).classed(g.EXPANDED,!1)}function Ye(a,b){var c=af(a,b);return function(a,b){var d=c(a,b),e=mh?1:0,f=mh?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 Ze(a,b){var c=af(a,!1),d=b?$e:_e;return function(a,b){return d(c(a,b),a,this)}}function $e(a,b){var c;return mh?(c=le(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function _e(a,b,c){var d=c.getBoundingClientRect();return mh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:le(b)?-3:-6)}function af(a,b){var c=a.__max__+1,d=be(Ag,c),e=$d(d,c,a,!!b),f=_d(!!b),g=ae(a,!!b),h=b?X:W;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return mh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function bf(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 cf(b){var c,d,e;if(vj=Gf.select(Jf),vj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(vj.html("").classed("c3",!0),Hf.data.xs={},Hf.data.targets=vc(b),Tg&&Lc(Tg===!0?Cc(Hf.data.targets):Tg),o(),S(),ug.domain(Gf.extent(_b(Hf.data.targets))),vg.domain(Xb(Hf.data.targets,"y")),wg.domain(Xb(Hf.data.targets,"y2")),xg.domain(ug.domain()),yg.domain(vg.domain()),zg.domain(wg.domain()),wj=ug.domain(),kj.scale(xg),Qf&&oj.scale(ug),pj=vj.append("svg").on("mouseenter",Tf).on("mouseleave",Uf),qj=pj.append("defs"),qj.append("clipPath").attr("id",Fi).append("rect"),qj.append("clipPath").attr("id",Gi).append("rect"),qj.append("clipPath").attr("id",Hi).append("rect"),pf(),rj=pj.append("g").attr("transform",bj.main),sj=pj.append("g").attr("transform",bj.context),tj=pj.append("g").attr("transform",bj.legend),dh||sj.style("visibility","hidden"),gh||(tj.style("visibility","hidden"),Yi=Cc(Hf.data.targets)),uj=Gf.select(Jf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Bf(Cc(Hf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=rj.append("g").attr("clip-path",Ii).attr("class",g.grid),Xh&&d.append("g").attr("class",g.xgrids),Ce(Zh)&&d.append("g").attr("class",g.xgridLines),di&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),$h&&d.append("g").attr("class",g.ygrids),Ce(_h)&&d.append("g").attr("class",g.ygridLines),nh&&rj.append("g").attr("class",g.axisX).attr("clip-path",Ji).attr("transform",bj.x).append("text").attr("class",g.axisXLabel).attr("transform",mh?"rotate(-90)":"").style("text-anchor",Ab),Fh&&rj.append("g").attr("class",g.axisY).attr("clip-path",Ki).attr("transform",bj.y).append("text").attr("class",g.axisYLabel).attr("transform",mh?"":"rotate(-90)").style("text-anchor",Bb),Oh&&rj.append("g").attr("class",g.axisY2).attr("transform",bj.y2).append("text").attr("class",g.axisY2Label).attr("transform",mh?"":"rotate(-90)").style("text-anchor",Cb),rj.append("g").attr("clip-path",Ii).attr("class",g.regions),rj.append("g").attr("clip-path",Ii).attr("class",g.chart),c=rj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Qf?mh?"ns-resize":"ew-resize":null),rj.select("."+g.chart).append("g").attr("class",g.chartBars),rj.select("."+g.chart).append("g").attr("class",g.chartLines),rj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",bj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Rb()),rj.select("."+g.chart).append("g").attr("class",g.chartTexts),Qf&&rj.insert("rect",Sf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",_f).attr("height",bg).style("opacity",0).style("cursor",mh?"ns-resize":"ew-resize").call(oj).on("dblclick.zoom",null),Dh&&kj.extent("function"!=typeof Dh?Dh:Dh(_b())),sj.append("g").attr("clip-path",Ii).attr("class",g.chart),sj.select("."+g.chart).append("g").attr("class",g.chartBars),sj.select("."+g.chart).append("g").attr("class",g.chartLines),sj.append("g").attr("clip-path",Ii).attr("class",g.brush).call(kj).selectAll("rect").attr(mh?"width":"height",mh?ag:cg),sj.append("g").attr("class",g.axisX).attr("transform",bj.subx).attr("clip-path",mh?"":Ji),rf(Hf.data.targets),mh?rj.select("."+g.axisX).style("opacity",0).call(Ag):(rj.select("."+g.axisY).style("opacity",0).call(Bg),rj.select("."+g.axisY2).style("opacity",0).call(Cg)),o(),S(),pf(),n(!1),lf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Ci){if(Li&&"string"==typeof Di){for(Di=xe(Di),e=0;e0){d=[];for(var f in Ig)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Od(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Le,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function hf(a){ie(Hf.data.targets)||Ug&&(Oi=a,rj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Pi=!0,bh())}function jf(){ie(Hf.data.targets)||Ug&&(rj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),rj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Pi=!1,ch())}function kf(a,b){"grid"===b&&a.each(function(){var a=Gf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function lf(a){var c,e,f,h,i,j,k,l,m,n,o,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,$,_=Zd(),ab=ie(Hf.data.targets),bb=Ic(Hf.data.targets);if(a=d(a)?a:{},G=d(a.withY)?a.withY:!0,H=d(a.withSubchart)?a.withSubchart:!0,I=d(a.withTransition)?a.withTransition:!0,L=d(a.withTransform)?a.withTransform:!1,N=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,O=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,P=d(a.withLegend)?a.withLegend:!1,J=d(a.withTransitionForExit)?a.withTransitionForExit:I,K=d(a.withTransitionForAxis)?a.withTransitionForAxis:I,V=I?Xf:0,W=J?V:0,X=K?V:0,c=rj.select("."+g.axisX).style("opacity",ab?0:1),f=rj.select("."+g.axisY).style("opacity",ab?0:1),h=rj.select("."+g.axisY2).style("opacity",ab?0:1),e=sj.select("."+g.axisX).style("opacity",ab?0:1),U={axisX:c.transition().duration(X),axisY:f.transition().duration(X),axisY2:h.transition().duration(X),axisSubX:e.transition().duration(X)},P&&gh&&Bf(Cc(Hf.data.targets),a,U),Mi&&(0!==bb.length&&O&&N||ug.domain([0,c.selectAll(".tick").size()])),bb.length&&(O&&(ug.domain(Gf.extent(_b(bb))),wj=ug.domain(),Qf&&oj.scale(ug).updateScaleExtent(),xg.domain(ug.domain()),kj.scale(xg)),N&&(ug.domain(kj.empty()?wj:kj.extent()),Qf&&oj.scale(ug).updateScaleExtent()),xh||!wh&&!vh||(Y=Kc(Jc(bb),vh),Ag.tickValues(Y),Dg.tickValues(Y))),vg.domain(Xb(bb,"y")),wg.domain(Xb(bb,"y2")),U.axisX.call(Ag),U.axisY.call(Bg),U.axisY2.call(Cg),U.axisSubX.call(Dg),Eb(I),N&&bb.length)if(th&&Y){for(Z=1;Z=0&&Gf.select(this).style("display",b%$?"none":"block")})}else pj.selectAll("."+g.axisX+" .tick text").style("display","block");D=Ag.tickOffset(),!mh&&yh&&fb(c,U.axisX,yh),Q=Ye(_),S=Ze(_,!0),T=Ze(_,!1),yg.domain(vg.domain()),zg.domain(wg.domain()),uj.style("display","none"),p(),rj.select("line."+g.xgridFocus).style("visibility","hidden"),Xh&&(k=Wd(Yh,ug),j=mh?{x1:0,x2:_f,y1:function(a){return ug(a)-D},y2:function(a){return ug(a)-D}}:{x1:function(a){return ug(a)+D},x2:function(a){return ug(a)+D},y1:Yf.top,y2:bg},i=rj.select("."+g.xgrids).selectAll("."+g.xgrid).data(k),i.enter().append("line").attr("class",g.xgrid),i.attr(j).style("opacity",function(){return+Gf.select(this).attr(mh?"y1":"x1")===(mh?bg:0)?0:1}),i.exit().remove()),Ce(Zh)&&(l=rj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(Zh),m=l.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",mh?"":"rotate(-90)").attr("dx",mh?0:-Yf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(V).attr("x1",mh?0:Gd).attr("x2",mh?_f:Gd).attr("y1",mh?Gd:Yf.top).attr("y2",mh?Gd:bg).style("opacity",1),l.select("text").transition().duration(V).attr("x",mh?_f:0).attr("y",Gd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(V).style("opacity",0).remove()),G&&$h&&(n=rj.select("."+g.ygrids).selectAll("."+g.ygrid).data(vg.ticks(ai)),n.enter().append("line").attr("class",g.ygrid),n.attr("x1",mh?vg:0).attr("x2",mh?vg:_f).attr("y1",mh?0:vg).attr("y2",mh?bg:vg),n.exit().remove(),kf(n,"grid")),G&&Ce(_h)&&(o=rj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(_h),q=o.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),q.append("line").style("opacity",0),q.append("text").attr("text-anchor","end").attr("transform",mh?"rotate(-90)":"").attr("dx",mh?0:-Yf.top).attr("dy",-5).style("opacity",0),o.select("line").transition().duration(V).attr("x1",mh?Hd:0).attr("x2",mh?Hd:_f).attr("y1",mh?0:Hd).attr("y2",mh?bg:Hd).style("opacity",1),o.select("text").transition().duration(V).attr("x",mh?0:_f).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),o.exit().transition().duration(V).style("opacity",0).remove()),w=rj.select("."+g.regions).selectAll("."+g.region).data(xi),w.enter().append("g").attr("class",hd).append("rect").style("fill-opacity",0),w.selectAll("rect").attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(V).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),w.exit().transition().duration(V).style("fill-opacity",0).remove(),u=rj.selectAll("."+g.bars).selectAll("."+g.bar).data(se),u.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Ui),u.style("opacity",td).transition().duration(V).attr("d",Q).style("fill",Ui).style("opacity",1),u.exit().transition().duration(W).style("opacity",0).remove(),r=rj.selectAll("."+g.lines).selectAll("."+g.line).data(qe),r.enter().append("path").attr("class",Zc).style("stroke",Ui),r.style("opacity",td).transition().duration(V).attr("d",lj).style("stroke",Ui).style("opacity",1),r.exit().transition().duration(W).style("opacity",0).remove(),s=rj.selectAll("."+g.areas).selectAll("."+g.area).data(qe),s.enter().append("path").attr("class",fd).style("fill",Ui).style("opacity",function(){return xj=+Gf.select(this).style("opacity"),0}),s.style("opacity",0).transition().duration(V).attr("d",mj).style("fill",Ui).style("opacity",xj),s.exit().transition().duration(W).style("opacity",0).remove(),t=rj.selectAll("."+g.circles).selectAll("."+g.circle).data(te),t.enter().append("circle").attr("class",_c).attr("r",Pe).style("fill",Ui),t.style("opacity",td).transition().duration(V).style("opacity",vd).style("fill",Ui).attr("cx",mh?Yd:Xd).attr("cy",mh?Xd:Yd),t.exit().remove(),x=rj.selectAll("."+g.texts).selectAll("."+g.text).data(ue),x.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return mh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",Ui).style("fill-opacity",0),x.text(function(a){return Ed(a.id)(a.value,a.id)}).style("fill-opacity",ud).transition().duration(V).attr("x",S).attr("y",T).style("fill",Ui).style("fill-opacity",wd),x.exit().transition().duration(W).style("fill-opacity",0).remove(),v=rj.selectAll("."+g.arcs).selectAll("."+g.arc).data(re),v.enter().append("path").attr("class",dd).style("fill",function(a){return Ui(a.data)}).style("cursor",function(a){return Wg(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Si||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),xf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Sd(d,Gf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Si||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),yf(),Td(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();ff(this,a,b),e(d,b)}),v.attr("transform",L?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Si=!0}).transition().duration(V).attrTween("d",function(a){var b,c=Fb(a);return c?(b=Gf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",L?"scale(1)":"").style("fill",function(a){return Ui(a.data)}).style("opacity",1).call(Fe,function(){Si=!1}),v.exit().transition().duration(W).style("opacity",0).remove(),rj.selectAll("."+g.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(V).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&pe(a.data)?1:0}),rj.select("."+g.chartArcsTitle).style("opacity",he(Hf.data.targets)?1:0),dh&&(null!==Gf.event&&"zoom"===Gf.event.type&&kj.extent(ug.orgDomain()).update(),H&&(!mh&&yh&&fb(e,U.axisSubX,yh),kj.empty()||kj.extent(ug.orgDomain()).update(),R=Ye(_,!0),z=sj.selectAll("."+g.bars).selectAll("."+g.bar).data(se),z.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Ui),z.style("opacity",td).transition().duration(V).attr("d",R).style("opacity",1),z.exit().transition().duration(V).style("opacity",0).remove(),y=sj.selectAll("."+g.lines).selectAll("."+g.line).data(qe),y.enter().append("path").attr("class",Zc).style("stroke",Ui),y.style("opacity",td).transition().duration(V).attr("d",nj).style("opacity",1),y.exit().transition().duration(V).style("opacity",0).remove())),rj.selectAll("."+g.selectedCircles).filter(function(a){return le(a)}).selectAll("circle").remove(),rj.selectAll("."+g.selectedCircle).transition().duration(V).attr("cx",mh?Yd:Xd).attr("cy",mh?Xd:Yd),A=rj.select("."+g.eventRects),Ce(Fg)&&!oc(Fg)?(A.classed(g.eventRectsMultiple)||A.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),B=rj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),ef(B.enter()),B.attr("x",0).attr("y",0).attr("width",_f).attr("height",bg)):(A.classed(g.eventRectsSingle)||A.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Ni&&!Mi?(F=function(a,b){var c=xc(b),d=yc(b),e=Hf.data.xs[a.id][b];return(ug(d?d:e+50)-ug(c?c:e-50))/2},E=function(a,b){var c=xc(b),d=Hf.data.xs[a.id][b];return(ug(d)+ug(c?c:d-50))/2}):(F=M(),E=function(a){return ug(a.x)-F/2}),C=Ac(Hf.data.targets),rj.select("."+g.eventRects).datum(C?C.values:[]),B=rj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),df(B.enter()),B.attr("class",id).attr("x",mh?0:E).attr("y",mh?E:0).attr("width",mh?_f:F).attr("height",mh?F:bg),B.exit().remove()),Cc(Hf.data.targets).forEach(function(a){yj[a]=!0})}function mf(){lf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function nf(){return"mousemove"===Gf.event.sourceEvent.type&&oj.altDomain?(ug.domain(oj.altDomain),void oj.scale(ug).updateScaleExtent()):(Mi&&ug.orgDomain()[0]===wj[0]&&ug.domain([wj[0]-1e-10,ug.orgDomain()[1]]),lf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Gf.event.sourceEvent.type&&(Qi=!0)))}function of(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function pf(){pj.attr("width",dg).attr("height",eg),pj.select("#"+Fi).select("rect").attr("width",_f).attr("height",bg),pj.select("#"+Gi).select("rect").attr("x",C).attr("y",D).attr("width",I).attr("height",J),pj.select("#"+Hi).select("rect").attr("x",E).attr("y",F).attr("width",K).attr("height",L),pj.select("."+g.zoomRect).attr("width",_f).attr("height",bg),vj.style("max-height",eg+"px")}function qf(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,o(),S(),pf(),n(a.withTransition),lf(a)}function rf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=rj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",kd),j=i.enter().append("g").attr("class",kd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc),e=rj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",md),d=e.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",cd).style("cursor",function(a){return Wg(a)?"pointer":null}),c=rj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",ld),b=c.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",$c),b.append("g").attr("class",gd),b.append("g").attr("class",function(a){return Uc(g.selectedCircles,a.id)}),b.append("g").attr("class",ad).style("cursor",function(a){return Wg(a)?"pointer":null}),a.forEach(function(a){rj.selectAll("."+g.selectedCircles+od(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=rj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(lg(a)).attr("class",nd),f=h.enter().append("g").attr("class",nd),f.append("g").attr("class",ed),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),dh&&(n=sj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",md),m=n.enter().append("g").style("opacity",0).attr("class",md),m.append("g").attr("class",cd),l=sj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",ld),k=l.enter().append("g").style("opacity",0).attr("class",ld),k.append("g").attr("class",$c)),pj.selectAll("."+g.target).filter(function(a){return Gc(a.id)}).transition().duration(Xf).style("opacity",1)}function sf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?ce(a.id,b.types[a.id]):ce(a.id,b.type)}),Hf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=cj?j:i,l=cj?R():Q();return d&&(w=0,C=0,t=0,u=0),gh&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=cj?u:t,void(lh?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=tj.selectAll("."+g.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,cj?(f=function(a){return t*B[a]},j=function(a){return A[B[a]]+x[a]}):(f=function(a){return A[B[a]]+x[a]},j=function(a){return u*B[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=tj.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(g.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof ih?ih(a):Hf.toggle(a)}).on("mouseover",function(a){Gf.select(this).classed(g.legendItemFocused,!0),Si||Hf.focus(a),"function"==typeof jh&&jh(a)}).on("mouseout",function(a){Gf.select(this).classed(g.legendItemFocused,!1),Si||Hf.revert(),"function"==typeof kh&&kh(a)}),m.append("text").text(function(a){return d(Ig[a])?Ig[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",cj?h:-200).attr("y",cj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",cj?i:-200).attr("y",cj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",Ui).attr("x",cj?h:-200).attr("y",cj?-200:j).attr("width",10).attr("height",10),tj.selectAll("text").data(a).text(function(a){return d(Ig[a])?Ig[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),tj.selectAll("rect."+g.legendItemEvent).data(a).transition().duration(p?250:0).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}).attr("x",i).attr("y",l),tj.selectAll("rect."+g.legendItemTile).data(a).transition().duration(p?250:0).style("fill",Ui).attr("x",f).attr("y",j),tj.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=Gf.select(this);return Gc(a)?!D||b.classed(g.legendItemFocused)?vf(b):wf(b):gj}),O(t),P(u),N(C),o(),S(),pf(),n(q,c)}function Cf(a){return Ec(Hf.data.targets,a.id)}function Df(a){return"data"in a&&Ec(Hf.data.targets,a.data.id)}function Ef(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 Ff(a,b,c){var d=!ie(Hf.data.targets);Si=!1,ce(a,b),qf(c||{withTransitionForAxis:d})}var Gf=a.d3?a.d3:a.require?a.require("d3"):void 0,Hf={data:{},axis:{},legend:{}},If={},Jf=i(["bindto"],"#chart"),Kf=i(["size","width"]),Lf=i(["size","height"]),Mf=i(["padding","left"],50),Nf=i(["padding","right"],0),Of=i(["padding","top"],0),Pf=i(["padding","bottom"],0),Qf=i(["zoom","enabled"],!1),Rf=i(["zoom","extent"]),Sf=i(["zoom","privileged"],!1),Tf=i(["onenter"],function(){}),Uf=i(["onleave"],function(){}),Vf=i(["onresize"],function(){}),Wf=i(["onresized"],function(){}),Xf=i(["transition","duration"],350);h("data","data is required in config");var Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg=i(["data","x"]),Fg=i(["data","xs"],{}),Gg=i(["data","x_format"]),Hg=i(["data","id_converter"],function(a){return a}),Ig=i(["data","names"],{}),Jg=i(["data","classes"],{}),Kg=i(["data","groups"],[]),Lg=i(["data","axes"],{}),Mg=i(["data","type"]),Ng=i(["data","types"],{}),Og=i(["data","labels"],{}),Pg=i(["data","order"]),Qg=i(["data","regions"],{}),Rg=i(["data","color"]),Sg=i(["data","colors"],{}),Tg=i(["data","hide"],!1),Ug=i(["data","selection","enabled"],!1),Vg=i(["data","selection","grouped"],!1),Wg=i(["data","selection","isselectable"],function(){return!0}),Xg=i(["data","selection","multiple"],!0),Yg=i(["data","onclick"],function(){}),Zg=i(["data","onenter"],function(){}),$g=i(["data","onleave"],function(){}),_g=i(["data","onselected"],function(){}),ah=i(["data","onunselected"],function(){}),bh=i(["data","ondragstart"],function(){}),ch=i(["data","ondragend"],function(){}),dh=i(["subchart","show"],!1),eh=i(["subchart","size","height"],60),fh=i(["color","pattern"],[]),gh=i(["legend","show"],!0),hh=i(["legend","position"],"bottom"),ih=i(["legend","item","onclick"]),jh=i(["legend","item","onmouseover"]),kh=i(["legend","item","onmouseout"]),lh=i(["legend","equally"],!1),mh=i(["axis","rotated"],!1),nh=i(["axis","x","show"],!0),oh=i(["axis","x","type"],"indexed"),ph=i(["axis","x","localtime"],!0),qh=i(["axis","x","categories"],[]),rh=i(["axis","x","tick","centered"],!1),sh=i(["axis","x","tick","format"]),th=i(["axis","x","tick","culling"],{}),uh=i(["axis","x","tick","culling","max"],10),vh=i(["axis","x","tick","count"]),wh=i(["axis","x","tick","fit"],!0),xh=i(["axis","x","tick","values"],null),yh=i(["axis","x","tick","rotate"]),zh=i(["axis","x","max"],null),Ah=i(["axis","x","min"],null),Bh=i(["axis","x","padding"],{}),Ch=i(["axis","x","height"]),Dh=i(["axis","x","default"]),Eh=i(["axis","x","label"],{}),Fh=i(["axis","y","show"],!0),Gh=i(["axis","y","max"]),Hh=i(["axis","y","min"]),Ih=i(["axis","y","center"]),Jh=i(["axis","y","label"],{}),Kh=i(["axis","y","inner"],!1),Lh=i(["axis","y","tick","format"]),Mh=i(["axis","y","padding"]),Nh=i(["axis","y","ticks"],10),Oh=i(["axis","y2","show"],!1),Ph=i(["axis","y2","max"]),Qh=i(["axis","y2","min"]),Rh=i(["axis","y2","center"]),Sh=i(["axis","y2","label"],{}),Th=i(["axis","y2","inner"],!1),Uh=i(["axis","y2","tick","format"]),Vh=i(["axis","y2","padding"]),Wh=i(["axis","y2","ticks"],10),Xh=i(["grid","x","show"],!1),Yh=i(["grid","x","type"],"tick"),Zh=i(["grid","x","lines"],[]),$h=i(["grid","y","show"],!1),_h=i(["grid","y","lines"],[]),ai=i(["grid","y","ticks"],10),bi=i(["point","show"],!0),ci=i(["point","r"],2.5),di=i(["point","focus","line","enabled"],!0),ei=i(["point","focus","expand","enabled"],!0),fi=i(["point","focus","expand","r"]),gi=i(["point","focus","select","r"]),hi=i(["line","connect_null"],!1),ii=i(["bar","width"]),ji=i(["bar","width","ratio"],.6),ki=i(["pie","label","show"],!0),li=i(["pie","label","format"]),mi=i(["pie","expand"],!0),ni=i(["pie","onclick"],function(){}),oi=i(["pie","onmouseover"],function(){}),pi=i(["pie","onmouseout"],function(){}),qi=i(["donut","label","show"],!0),ri=i(["donut","label","format"]),si=i(["donut","expand"],!0),ti=i(["donut","title"],""),ui=i(["donut","onclick"],function(){}),vi=i(["donut","onmouseover"],function(){}),wi=i(["donut","onmouseout"],function(){}),xi=i(["regions"],[]),yi=i(["tooltip","show"],!0),zi=i(["tooltip","format","title"]),Ai=i(["tooltip","format","value"]),Bi=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=zi?zi:b,l=Ai?Ai:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Ci=i(["tooltip","init","show"],!1),Di=i(["tooltip","init","x"],0),Ei=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Fi=("string"==typeof Jf?Jf.replace("#",""):Jf.id)+"-clip",Gi=Fi+"-xaxis",Hi=Fi+"-yaxis",Ii=j(Fi),Ji=j(Gi),Ki=j(Hi),Li="timeseries"===oh,Mi="categorized"===oh,Ni=!Li&&(Eg||Ce(Fg)),Oi=null,Pi=!1,Qi=!1,Ri=!1,Si=!1,Ti=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ui=we(Sg,Ce(fh)?fh:Ti,Rg),Vi=ph?Gf.time.format:Gf.time.format.utc,Wi=function(){var a=[[Vi("%Y/%-m/%-d"),function(){return!0}],[Vi("%-m/%-d"),function(a){return a.getMonth()}],[Vi("%-m/%-d"),function(a){return 1!==a.getDate()}],[Vi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Vi("%I %p"),function(a){return a.getHours()}],[Vi("%I:%M"),function(a){return a.getMinutes()}],[Vi(":%S"),function(a){return a.getSeconds()}],[Vi(".%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)}}(),Xi=[],Yi=[],Zi=mh?"left":"bottom",$i=mh?Kh?"top":"bottom":Kh?"right":"left",_i=mh?Th?"bottom":"top":Th?"left":"right",aj=mh?"left":"bottom",bj={main:function(){return"translate("+Yf.left+","+Yf.top+")"},context:function(){return"translate("+Zf.left+","+Zf.top+")"},legend:function(){return"translate("+$f.left+","+$f.top+")"},x:function(){return"translate(0,"+(mh?0:bg)+")"},y:function(){return"translate(0,"+(mh?bg:0)+")"},y2:function(){return"translate("+(mh?0:_f)+","+(mh?1:0)+")"},subx:function(){return"translate(0,"+(mh?0:cg)+")"},arc:function(){return"translate("+_f/2+","+bg/2+")"}},cj="right"===hh,dj=0,ej=0,fj=0,gj=.15,hj=30,ij=mh&&!nh?0:30,jj=5;lg=Gf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var kj,lj=function(){var a=Gf.svg.line().x(mh?function(a){return W(a.id)(a.value) }:Fd).y(mh?Fd:function(a){return W(a.id)(a.value)});return hi||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=hi?Oe(b.values):b.values;return je(b)?(a.interpolate(ke(b)?"cardinal":"linear"),Qg[b.id]?bf(e,ug,W(b.id),Qg[b.id]):a(e)):(c=e[0]?ug(e[0].x):0,d=e[0]?W(b.id)(e[0].value):0,mh?"M "+d+" "+c:"M "+c+" "+d)}}(),mj=function(){var a;return a=mh?Gf.svg.area().x0(function(a){return W(a.id)(0)}).x1(function(a){return W(a.id)(a.value)}).y(Fd):Gf.svg.area().x(Fd).y0(function(a){return W(a.id)(0)}).y1(function(a){return W(a.id)(a.value)}),function(b){var c,d,e=Oe(b.values);return de([b],"area")||de([b],"area-spline")?(a.interpolate(ke(b)?"cardinal":"linear"),a(e)):(c=e[0]?ug(e[0].x):0,d=e[0]?W(b.id)(e[0].value):0,mh?"M "+d+" "+c:"M "+c+" "+d)}}(),nj=function(){var a=Gf.svg.line().x(mh?function(a){return X(a.id)(a.value)}:Id).y(mh?Id:function(a){return X(a.id)(a.value)});return function(b){var c=Oe(b.values);return je(b)?a(c):"M "+xg(c[0].x)+" "+X(b.id)(c[0].value)}}(),oj=function(){};kj=Gf.svg.brush().on("brush",mf),kj.update=function(){return sj&&sj.select("."+g.brush).call(this),this},kj.scale=function(a){return mh?this.y(a):this.x(a)},Qf&&(oj=Gf.behavior.zoom().on("zoomstart",function(){oj.altDomain=Gf.event.sourceEvent.altKey?ug.orgDomain():null}).on("zoom",Qf?nf:null),oj.scale=function(a){return mh?this.y(a):this.x(a)},oj.orgScaleExtent=function(){var a=Rf?Rf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},oj.updateScaleExtent=function(){var a=ac(ug.orgDomain())/ac(wj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var pj,qj,rj,sj,tj,uj,vj,wj,xj,yj={};if(Hf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=pj.selectAll(pd(a)),d=c.filter(Cf),e=c.filter(Df);Hf.revert(),Hf.defocus(),b(d.classed(g.focused,!0)),b(e),ie(Hf.data.targets)&&Nb(a,!0),xf(a,!0)},Hf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=pj.selectAll(pd(a)),d=c.filter(Cf),e=c.filter(Df);Hf.revert(),b(d.classed(g.focused,!1)),b(e),ie(Hf.data.targets)&&Ob(a),xf(a,!1)},Hf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=pj.selectAll(pd(a)),d=c.filter(Cf),e=c.filter(Df);b(d.classed(g.focused,!1)),b(e),ie(Hf.data.targets)&&Ob(a),yf()},Hf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),pj.selectAll(qd(a)).transition().style("opacity",1),b.withLegend&&zf(a),lf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Hf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),pj.selectAll(qd(a)).transition().style("opacity",0),b.withLegend&&Af(a),lf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Hf.toggle=function(a){Gc(a)?Hf.hide(a):Hf.show(a)},Hf.unzoom=function(){kj.clear().update(),lf({withUpdateXDomain:!0})},Hf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Jg[b]=a.classes[b]}),"categories"in a&&Mi&&(qh=a.categories,Ag.categories(qh)),"cacheIds"in a&&bc(a.cacheIds)?void sf(dc(a.cacheIds),a.done):void("unload"in a?uf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){tf(a)}):tf(a))},Hf.unload=function(a,b){uf(Dc(a),function(){lf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Hf.selected=function(a){return Gf.merge(rj.selectAll("."+g.shapes+od(a)).selectAll("."+g.shape).filter(function(){return Gf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Hf.select=function(a,b,c){Ug&&rj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Gf.select(this),i=e.data?e.data.id:e.id,j=Ne(this),k=Vg||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);k&&l?Wg(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f)})},Hf.unselect=function(a,b){Ug&&rj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Gf.select(this),f=c.data?c.data.id:c.id,h=Ne(this),i=Vg||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);i&&j&&Wg(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Hf.toLine=function(a){Ff(a,"line")},Hf.toSpline=function(a){Ff(a,"spline")},Hf.toBar=function(a){Ff(a,"bar")},Hf.toScatter=function(a){Ff(a,"scatter")},Hf.toArea=function(a){Ff(a,"area")},Hf.toAreaSpline=function(a){Ff(a,"area-spline")},Hf.toPie=function(a){Ff(a,"pie",{withTransform:!0})},Hf.toDonut=function(a){Ff(a,"donut",{withTransform:!0})},Hf.groups=function(a){return c(a)?Kg:(Kg=a,lf(),Kg)},Hf.xgrids=function(a){return a?(Zh=a,lf(),Zh):Zh},Hf.xgrids.add=function(a){return a?Hf.xgrids(Zh.concat(a)):void 0},Hf.xgrids.remove=function(a){var b=Ef(a);return Hf.xgrids(Zh.filter(b))},Hf.ygrids=function(a){return a?(_h=a,lf(),_h):_h},Hf.ygrids.add=function(a){return a?Hf.ygrids(_h.concat(a)):void 0},Hf.ygrids.remove=function(a){var b=Ef(a);return Hf.ygrids(_h.filter(b))},Hf.regions=function(a){return c(a)?xi:(xi=a,lf(),xi)},Hf.regions.add=function(a){return c(a)?xi:(xi=xi.concat(a),lf(),xi)},Hf.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;pj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),xi=xi.filter(function(b){return b.classes.indexOf(a)<0})}),xi},Hf.data.get=function(a){var b=Hf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Hf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},Hf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Ig[b]=a[b]}),lf({withLegend:!0}),Ig):Ig},Hf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Sg[b]=a[b]}),lf({withLegend:!0}),Sg):Sg},Hf.x=function(a){return arguments.length&&(qc(Hf.data.targets,a),lf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Hf.data.xs},Hf.xs=function(a){return arguments.length&&(rc(Hf.data.targets,a),lf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Hf.data.xs},Hf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){cb(b,a[b])}),Eb())},Hf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(zh=+a.x),b(a.y)&&(Gh=+a.y),b(a.y2)&&(Ph=+a.y2)):Gh=Ph=+a,lf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Hf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Ah=+a.x),b(a.y)&&(Hh=+a.y),b(a.y2)&&(Qh=+a.y2)):Hh=Qh=+a,lf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Hf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Hf.axis.max(a.max),"undefined"!=typeof a.min&&Hf.axis.min(a.min))},Hf.legend.show=function(a){zf(Dc(a)),lf({withLegend:!0})},Hf.legend.hide=function(a){Af(Dc(a)),lf({withLegend:!0})},Hf.resize=function(a){Kf=a?a.width:null,Lf=a?a.height:null,qf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Hf.destroy=function(){Hf.data.targets=void 0,Hf.data.xs={},vj.html(""),a.onresize=null},"url"in f.data)Gf.xhr(f.data.url,function(a,b){var c,d=Gf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Gf.csv.parse(b.response),cf(c)});else if("rows"in f.data)cf(tc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");cf(uc(f.data.columns))}return Hf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(window); \ No newline at end of file diff --git a/package.json b/package.json index f43f502..f0d8bae 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "c3", - "version": "0.1.34", + "version": "0.1.35", "description": "D3-based reusable chart library", "main": "c3.js", "scripts": { From 2ba84ca43537379669467e6e72ba440de44ecddf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Go=CC=88bel?= Date: Mon, 5 May 2014 16:07:11 +0200 Subject: [PATCH 134/178] bring back sharp axes/grids (fix #204) --- c3.js | 7 ++++--- c3.min.js | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/c3.js b/c3.js index 3fe59eb..b5442ab 100644 --- a/c3.js +++ b/c3.js @@ -336,13 +336,14 @@ subXOrient = __axis_rotated ? "left" : "bottom"; var translate = { - main : function () { return "translate(" + margin.left + "," + margin.top + ")"; }, - context : function () { return "translate(" + margin2.left + "," + margin2.top + ")"; }, + + main : function () { return "translate(" + (Math.ceil(margin.left) + 0.5) + "," + (Math.ceil(margin.top) + 0.5) + ")"; }, + context : function () { return "translate(" + (Math.ceil(margin2.left) + 0.5) + "," + (Math.ceil(margin2.top) + 0.5) + ")"; }, legend : function () { return "translate(" + margin3.left + "," + margin3.top + ")"; }, x : function () { return "translate(0," + (__axis_rotated ? 0 : height) + ")"; }, y : function () { return "translate(0," + (__axis_rotated ? height : 0) + ")"; }, y2 : function () { return "translate(" + (__axis_rotated ? 0 : width) + "," + (__axis_rotated ? 1 : 0) + ")"; }, - subx : function () { return "translate(0," + (__axis_rotated ? 0 : height2) + ")"; }, + subx : function () { return "translate(0," + (__axis_rotated ? 0 : Math.ceil(height2)) + ")"; }, arc: function () { return "translate(" + width / 2 + "," + height / 2 + ")"; } }; diff --git a/c3.min.js b/c3.min.js index 0307c5d..64b326a 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.ceil(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.ceil(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&a_f&&(_f=0),0>bg&&(bg=0),ag=mh?Yf.left-hj-ij:_f,cg=mh?bg:eg-Zf.top-Zf.bottom,0>ag&&(ag=0),0>cg&&(cg=0),q(),cj&&ie(Hf.data.targets)&&($f.left=_f/2+gg)}function p(){rj.select("line."+g.xgridFocus).attr("x1",mh?0:-10).attr("x2",mh?_f:-10).attr("y1",mh?-10:Yf.top).attr("y2",mh?-10:bg)}function q(){gg=bg/2,fg=.95*gg,hg=he(Hf.data.targets)?.6*fg:0}function r(){var a=mh?g.axisX:g.axisY,b=rj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Gf.select(Jf).node().getBoundingClientRect(),e=c.right-d.left-u();return e>0?e:0}function s(){return Kf?Kf:y()}function t(){var a=Lf?Lf:z();return a>0?a:320}function u(){return ie(Hf.data.targets)?0:Mf?Mf:mh?nh?w("x"):1:!Fh||Kh?1:w("y")}function v(){var a=1;return ie(Hf.data.targets)?0:Nf?Nf:cj?Q()+20+(Oh&&!mh?w("y2"):a):Oh?Th||mh?a:w("y2"):a}function w(a){var b=kb(a);return b.isInner?20+Db(a):40+Db(a)}function x(a){return"x"!==a||nh?"x"===a&&Ch?Ch:"y"!==a||Fh?"y2"!==a||Oh?(kb(a).isInner?30:40)+("y2"===a?-10:0):jj:gh&&!cj?10:1:0}function y(){return+Gf.select(Jf).style("width").replace("px","")}function z(){return+Gf.select(Jf).style("height").replace("px","")}function A(a){return a?-5:-(Yf.left-1)}function B(a){return a?-20:-4}function C(){return A(!mh)}function D(){return B(!mh)}function E(){return A(mh)}function F(){return B(mh)}function G(a){return a?_f+2+4:Yf.left+20}function H(a){return a?(Ch?Ch:0)+80:bg+8}function I(){return G(!mh)}function J(){return H(!mh)}function K(){return G(mh)}function L(){return H(mh)}function M(){var a,b,c,d,e,f=Ac(Hf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ug(b.x)-ug(a.x),0===c?mh?bg:_f:(d=zc(),e=ee(Hf.data.targets)?(d-(Mi?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function N(a){dj=a}function O(a){ej=a}function P(a){fj=a}function Q(){return gh?cj?ej*(dj+1):dg:0}function R(){return gh?cj?eg:fj*(dj+1):0}function S(){var a,b,c=!ug;mg=mh?1:0,ng=mh?bg:_f,og=mh?0:bg,pg=mh?_f:1,qg=mg,rg=ng,sg=mh?0:cg,tg=mh?ag:1,ug=U(mg,ng,c?void 0:ug.domain(),function(){return Ag.tickOffset()}),vg=V(og,pg,c?void 0:vg.domain()),wg=V(og,pg,c?void 0:wg.domain()),xg=U(mg,ng,wj,function(a){return a%1?0:Dg.tickOffset()}),yg=V(sg,tg,c?void 0:yg.domain()),zg=V(sg,tg,c?void 0:zg.domain()),a=_(),b=xh?xh:c?void 0:Ag.tickValues(),Ag=Y(ug,Zi,a,b),Dg=Y(xg,aj,a,b),Bg=Z(vg,$i,Lh,Nh),Cg=Z(wg,_i,Uh,Wh),c||(kj.scale(xg),Qf&&oj.scale(ug)),T()}function T(){ig=Gb(),jg=Hb(),kg=Hb(.98)}function U(a,b,c,d){var e,f=(Li?Gf.time.scale():Gf.scale.linear()).range([a,b]),g=c?f.domain(c):f;Mi?(d=d||function(){return 0},f=function(a){return Math.ceil(g(a)+d(a))}):f=function(a){return Math.ceil(g(a))};for(e in g)f[e]=g[e];return f.orgDomain=function(){return g.domain()},Mi&&(f.domain=function(a){return arguments.length?(g.domain(a),f):(a=g.domain(),[a[0],a[1]+1])}),f}function V(a,b,c){var d=Gf.scale.linear().range([a,b]);return c&&d.domain(c),d}function W(a){return"y2"===$(a)?wg:vg}function X(a){return"y2"===$(a)?zg:yg}function Y(a,b,c,d){var f=e(Gf,Mi).scale(a).orient(b);return f.tickFormat(c).tickValues(d),Mi?(f.tickCentered(rh),Be(th)&&(th=!1),f.categories(qh)):f.tickOffset=function(){var a=Bc(Hf.data.targets),b=ug(a[1])-ug(a[0]),c=b?b:mh?bg:_f;return c/zc()/2},f}function Z(a,b,c,d){return e(Gf).scale(a).orient(b).tickFormat(c).ticks(d)}function $(a){return a in Lg?Lg[a]:"y"}function _(){var a=Li?Wi:Mi?Tc:function(a){return 0>a?a.toFixed(0):a};return sh&&("function"==typeof sh?a=sh:Li&&(a=function(a){return a?Vi(sh)(a):""})),a}function ab(a){var b;return"y"===a?b=Jh:"y2"===a?b=Sh:"x"===a&&(b=Eh),b}function bb(a){var b=ab(a);return"string"==typeof b?b:b?b.text:null}function cb(a,b){var c=ab(a);"string"==typeof c?"y"===a?Jh=b:"y2"===a?Sh=b:"x"===a&&(Eh=b):c&&(c.text=b)}function db(a){return 10*Math.sin(Math.PI*(a/180))}function eb(a){return 11.5-2.5*(a/15)}function fb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",eb(c)).attr("x",db(c)).attr("transform","rotate("+c+")")}function gb(a,b){var c=ab(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 hb(){return gb("x",mh?"inner-top":"inner-right")}function ib(){return gb("y",mh?"inner-right":"inner-top")}function jb(){return gb("y2",mh?"inner-right":"inner-top")}function kb(a){return"y2"===a?jb():"y"===a?ib():hb()}function lb(){return bb("x")}function mb(){return bb("y")}function nb(){return bb("y2")}function ob(a,b){return a?b.isLeft?0:b.isCenter?_f/2:_f:b.isBottom?-bg:b.isMiddle?-bg/2:0}function pb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function qb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function rb(){return ob(!mh,hb())}function sb(){return ob(mh,ib())}function tb(){return ob(mh,jb())}function ub(){return pb(!mh,hb())}function vb(){return pb(mh,ib())}function wb(){return pb(mh,jb())}function xb(){var a=hb();return mh?a.isInner?"1.2em":-25-Db("x"):a.isInner?"-0.5em":Ch?Ch-10:"3em"}function yb(){var a=ib();return mh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Db("y")}function zb(){var a=jb();return mh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Db("y2")}function Ab(){return qb(!mh,hb())}function Bb(){return qb(mh,ib())}function Cb(){return qb(mh,jb())}function Db(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Gf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Eb(a){var b=rj.select("."+g.axisX+" ."+g.axisXLabel),c=rj.select("."+g.axisY+" ."+g.axisYLabel),d=rj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",rb).attr("dx",ub).attr("dy",xb).text(lb),(a?c.transition():c).attr("x",sb).attr("dx",vb).attr("dy",yb).attr("dy",yb).text(mb),(a?d.transition():d).attr("x",tb).attr("dx",wb).attr("dy",zb).text(nb)}function Fb(a){var b=!1;return lg(Ic(Hf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Gb(){var a=Gf.svg.arc().outerRadius(fg).innerRadius(hg),b=function(b,c){var d;return c?a(b):(d=Fb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Hb(a){var b=Gf.svg.arc().outerRadius(gg*(a?a:1)).innerRadius(hg);return function(a){var c=Fb(a);return c?b(c):"M 0 0"}}function Ib(a,b){return pe(a.data)?ig(a,b):"M 0 0"}function Jb(a){var b,c,d,e,f=Fb(a),g="";return f&&(b=ig.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*fg*.8+","+d/e*fg*.8+")"),g}function Kb(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Lb(a){return pc({id:a.data.id,value:a.value,ratio:Kb(a)})}function Mb(a){var b,c,d,e;return Pb()?(b=Fb(a),c=b?b.value:null,d=Kb(b),e=Qb(),e?e(c,d):Dd(c,d)):""}function Nb(a,b){var c=pj.selectAll("."+g.chartArc+pd(a)),d=pj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});ve(a)&&c.selectAll("path").transition().duration(50).attr("d",jg).transition().duration(100).attr("d",kg).each(function(a){oe(a.data)}),b||d.style("opacity",.3)}function Ob(a){var b=pj.selectAll("."+g.chartArc+pd(a));b.selectAll("path").transition().duration(50).attr("d",ig),pj.selectAll("."+g.arc).style("opacity",1)}function Pb(){return he(Hf.data.targets)?qi:ki}function Qb(){return he(Hf.data.targets)?ri:li}function Rb(){return he(Hf.data.targets)?ti:""}function Sb(){var a=he(Hf.data.targets)?ui:ni;return"function"==typeof a?a:function(){}}function Tb(){var a=he(Hf.data.targets)?vi:oi;return"function"==typeof a?a:function(){}}function Ub(){var a=he(Hf.data.targets)?wi:pi;return"function"==typeof a?a:function(){}}function Vb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(Kg.length>0)for(g=Rc(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 Gf.min(Object.keys(i).map(function(a){return Gf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(Kg.length>0)for(g=Sc(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 Gf.max(Object.keys(i).map(function(a){return Gf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return $(a.id)===c}),m="y2"===c?Qh:Hh,n="y2"===c?Ph:Gh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Rh:Ih,r=xd()&&mh;return 0===l.length?"y2"===c?wg.domain():vg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=yd(o,p),j=ac(vg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Mh&&(f=b(Mh.top)?Mh.top:e,g=b(Mh.bottom)?Mh.bottom:e),"y2"===c&&Vh&&(f=b(Vh.top)?Vh.top:e,g=b(Vh.bottom)?Vh.bottom:e),ee(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return Ah?Li?xe(Ah):Ah:Gf.min(a,function(a){return Gf.min(a.values,function(a){return a.x})})}function Zb(a){return zh?Li?xe(zh):zh:Gf.max(a,function(a){return Gf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Mi?d=0:ee(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Bh&&Ce(Bh)?(e=b(Bh.left)?Bh.left:d,f=b(Bh.right)?Bh.right:d):e=f="number"==typeof Bh?Bh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return c-d!==0||Mi||(c=Li?new Date(.5*c.getTime()):-.5,d=Li?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Li?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Li?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?vg:wg;return b="y"===a.axis||"y2"===a.axis?mh?bg:"start"in a?d(a.start):bg:mh?"end"in a?ug(Li?xe(a.end):a.end):bg:bg,c>b?0:b-c}function ic(a){return Eg&&a===Eg||Ce(Fg)&&De(Fg,a)}function jc(a){return!ic(a)}function kc(a){return Eg?Eg:Ce(Fg)?Fg[a]:null}function lc(a,b){var c,d=b&&Ce(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=Hf.data.xs[b])}),c}function mc(a,b){return a in Hf.data.xs&&Hf.data.xs[a]&&Hf.data.xs[a][b]?Hf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){Fg[b]=a[b]})}function oc(a){return 1===Gf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=Ig[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),Hf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=Li?a?a instanceof Date?a:xe(a):xe(mc(c,d)):Ni&&!Mi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Hf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Eg?(d=Object.keys(Hf.data.xs),Hf.data.xs[c]=d.length>0?Hf.data.xs[d[0]]:void 0):Ce(Fg)&&(Hf.data.xs[c]=lc(f,Hf.data.targets)):Hf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Hf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Hg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ni&&Mi&&0===c&&g&&(0===e&&(qh=[]),qh.push(g)),("undefined"==typeof a[b]||Hf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Mg&&ce(Cc(c).filter(function(a){return!(a in Ng)}),Mg),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&Hf.data.targets[0].values[a-1]?Hf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(Hf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Li?new Date(i):i);j.push(e)}return Li||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Xi=Xi.concat(a)}function Mc(a){Xi=Xi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Yi=Yi.concat(a)}function Oc(a){Yi=Yi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Jd(a,f))),(a[g].x||0===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=Ee(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Nd(a,b){return Gf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Od(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 Pd(){return Pg&&"desc"===Pg.toLowerCase()}function Qd(){return Pg&&"asc"===Pg.toLowerCase()}function Rd(a){var b=Qd(),c=Pd();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 Pg&&a.sort(Pg),a}function Sd(a,c){var d,e,f,g,h,i,j,k=ie(Hf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&yi&&(uj.html(Bi(a,_(),zd(k),Ui)).style("display","block"),d=uj.property("offsetWidth"),e=uj.property("offsetHeight"),k?(g=_f/2+c[0],i=bg/2+c[1]+20):(mh?(f=r(),g=f+c[0]+100,h=g+d,j=s()-v(),i=ug(l[0].x)+20):(f=r(),g=f+u()+ug(l[0].x)+20,h=g+d,j=f+s()-v(),i=c[1]+15),h>j&&(g-=d+60),i+e>t()&&(i-=e+30)),uj.style("top",i+"px").style("left",g+"px"))}function Td(){uj.style("display","none")}function Ud(a){var c=a.filter(function(a){return a&&b(a.value)});if(yi&&!fe(Hf.data.targets)&&!ie(Hf.data.targets)){var d=rj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(mh?"y1":"x1",Fd).attr(mh?"y2":"x2",Fd),kf(d,"grid")}}function Vd(){rj.select("line."+g.xgridFocus).style("visibility","hidden")}function Wd(a,b){var c,d,e,f,g=[];if("year"===a)for(c=_b(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)g.push(new Date(f+"-01-01 00:00:00"));else g=b.ticks(10);return g}function Xd(a){return a.x||0===a.x?ug(a.x):null}function Yd(a){return W(a.id)(a.value)}function Zd(){var a,b,d={},e=0;return Ic(Fc(le)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function be(a,b){return"number"==typeof ii?ii:b?2*a.tickOffset()*ji/b:0}function ce(a,b){Dc(a).forEach(function(a){yj[a]=b===Ng[a],Ng[a]=b})}function de(a,b){var c=!1;return a.forEach(function(a){Ng[a.id]===b&&(c=!0),a.id in Ng||"line"!==b||(c=!0)}),c}function ee(a){return de(a,"bar")}function fe(a){return de(a,"scatter")}function ge(a){return de(a,"pie")}function he(a){return de(a,"donut")}function ie(a){return ge(a)||he(a)}function je(a){var b="string"==typeof a?a:a.id;return!(b in Ng)||"line"===Ng[b]||"spline"===Ng[b]||"area"===Ng[b]||"area-spline"===Ng[b]}function ke(a){var b="string"==typeof a?a:a.id;return"spline"===Ng[b]||"area-spline"===Ng[b]}function le(a){var b="string"==typeof a?a:a.id;return"bar"===Ng[b]}function me(a){var b="string"==typeof a?a:a.id;return"scatter"===Ng[b]}function ne(a){var b="string"==typeof a?a:a.id;return"pie"===Ng[b]}function oe(a){var b="string"==typeof a?a:a.id;return"donut"===Ng[b]}function pe(a){return ne(a)||oe(a)}function qe(a){return je(a)?[a]:[]}function re(a){return pe(a.data)?[a]:[]}function se(a){return le(a)?a.values:[]}function te(a){return je(a)||me(a)?a.values:[]}function ue(a){return le(a)||je(a)?a.values:[]}function ve(a){return oe(a)&&si||ne(a)&&mi}function we(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function xe(b){var c;try{c=Gg?Gf.time.format(Gg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Gg)}return c}function ye(a,b){var c=Gf.mouse(a),d=Gf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function De(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Ee(a,b){var c="y"===$(a.id)?vg:wg,d=mh?1:0,e=mh?0:1;return Math.pow(ug(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Fe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ge(a,b,c){_g(b,a.node()),rj.select("."+g.selectedCircles+od(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(g.selectedCircle,c)}).attr("cx",mh?Yd:Xd).attr("cy",mh?Xd:Yd).attr("stroke",function(){return Ui(b)}).attr("r",1.4*Re(b)).transition().duration(100).attr("r",Re)}function He(a,b,c){ah(b,a.node()),rj.select("."+g.selectedCircles+od(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ie(a,b,c,d){a?Ge(b,c,d):He(b,c,d)}function Je(a,b){_g(b,a.node()),a.transition().duration(100).style("fill",function(){return Gf.rgb(Ui(b)).brighter(.75)})}function Ke(a,b){ah(b,a.node()),a.transition().duration(100).style("fill",function(){return Ui(b)})}function Le(a,b,c,d){a?Je(b,c,d):Ke(b,c,d)}function Me(a,b,c,d){Le(a,b,c.data,d)}function Ne(a){return"circle"===a.nodeName?Ie:Gf.select(a).classed(g.bar)?Le:Me}function Oe(a){return a.filter(function(a){return b(a.value)})}function Pe(a){return bi?"function"==typeof ci?ci(a):ci:0}function Qe(a){return ei?fi?fi:1.75*Pe(a):Pe(a)}function Re(a){return gi?gi:4*Pe(a)}function Se(a,c){return(c?rj.selectAll("."+g.circles+od(c)):rj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Te(a,b){Se(a,b).classed(g.EXPANDED,!0).attr("r",Qe)}function Ue(a){Se(a).filter(function(){return Gf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Pe)}function Ve(a){return rj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function We(a){Ve(a).classed(g.EXPANDED,!0)}function Xe(a){Ve(a).classed(g.EXPANDED,!1)}function Ye(a,b){var c=af(a,b);return function(a,b){var d=c(a,b),e=mh?1:0,f=mh?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 Ze(a,b){var c=af(a,!1),d=b?$e:_e;return function(a,b){return d(c(a,b),a,this)}}function $e(a,b){var c;return mh?(c=le(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function _e(a,b,c){var d=c.getBoundingClientRect();return mh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:le(b)?-3:-6)}function af(a,b){var c=a.__max__+1,d=be(Ag,c),e=$d(d,c,a,!!b),f=_d(!!b),g=ae(a,!!b),h=b?X:W;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return mh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function bf(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 cf(b){var c,d,e;if(vj=Gf.select(Jf),vj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(vj.html("").classed("c3",!0),Hf.data.xs={},Hf.data.targets=vc(b),Tg&&Lc(Tg===!0?Cc(Hf.data.targets):Tg),o(),S(),ug.domain(Gf.extent(_b(Hf.data.targets))),vg.domain(Xb(Hf.data.targets,"y")),wg.domain(Xb(Hf.data.targets,"y2")),xg.domain(ug.domain()),yg.domain(vg.domain()),zg.domain(wg.domain()),wj=ug.domain(),kj.scale(xg),Qf&&oj.scale(ug),pj=vj.append("svg").on("mouseenter",Tf).on("mouseleave",Uf),qj=pj.append("defs"),qj.append("clipPath").attr("id",Fi).append("rect"),qj.append("clipPath").attr("id",Gi).append("rect"),qj.append("clipPath").attr("id",Hi).append("rect"),pf(),rj=pj.append("g").attr("transform",bj.main),sj=pj.append("g").attr("transform",bj.context),tj=pj.append("g").attr("transform",bj.legend),dh||sj.style("visibility","hidden"),gh||(tj.style("visibility","hidden"),Yi=Cc(Hf.data.targets)),uj=Gf.select(Jf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Bf(Cc(Hf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=rj.append("g").attr("clip-path",Ii).attr("class",g.grid),Xh&&d.append("g").attr("class",g.xgrids),Ce(Zh)&&d.append("g").attr("class",g.xgridLines),di&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),$h&&d.append("g").attr("class",g.ygrids),Ce(_h)&&d.append("g").attr("class",g.ygridLines),nh&&rj.append("g").attr("class",g.axisX).attr("clip-path",Ji).attr("transform",bj.x).append("text").attr("class",g.axisXLabel).attr("transform",mh?"rotate(-90)":"").style("text-anchor",Ab),Fh&&rj.append("g").attr("class",g.axisY).attr("clip-path",Ki).attr("transform",bj.y).append("text").attr("class",g.axisYLabel).attr("transform",mh?"":"rotate(-90)").style("text-anchor",Bb),Oh&&rj.append("g").attr("class",g.axisY2).attr("transform",bj.y2).append("text").attr("class",g.axisY2Label).attr("transform",mh?"":"rotate(-90)").style("text-anchor",Cb),rj.append("g").attr("clip-path",Ii).attr("class",g.regions),rj.append("g").attr("clip-path",Ii).attr("class",g.chart),c=rj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Qf?mh?"ns-resize":"ew-resize":null),rj.select("."+g.chart).append("g").attr("class",g.chartBars),rj.select("."+g.chart).append("g").attr("class",g.chartLines),rj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",bj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Rb()),rj.select("."+g.chart).append("g").attr("class",g.chartTexts),Qf&&rj.insert("rect",Sf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",_f).attr("height",bg).style("opacity",0).style("cursor",mh?"ns-resize":"ew-resize").call(oj).on("dblclick.zoom",null),Dh&&kj.extent("function"!=typeof Dh?Dh:Dh(_b())),sj.append("g").attr("clip-path",Ii).attr("class",g.chart),sj.select("."+g.chart).append("g").attr("class",g.chartBars),sj.select("."+g.chart).append("g").attr("class",g.chartLines),sj.append("g").attr("clip-path",Ii).attr("class",g.brush).call(kj).selectAll("rect").attr(mh?"width":"height",mh?ag:cg),sj.append("g").attr("class",g.axisX).attr("transform",bj.subx).attr("clip-path",mh?"":Ji),rf(Hf.data.targets),mh?rj.select("."+g.axisX).style("opacity",0).call(Ag):(rj.select("."+g.axisY).style("opacity",0).call(Bg),rj.select("."+g.axisY2).style("opacity",0).call(Cg)),o(),S(),pf(),n(!1),lf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Ci){if(Li&&"string"==typeof Di){for(Di=xe(Di),e=0;e0){d=[];for(var f in Ig)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Od(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Le,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function hf(a){ie(Hf.data.targets)||Ug&&(Oi=a,rj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Pi=!0,bh())}function jf(){ie(Hf.data.targets)||Ug&&(rj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),rj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Pi=!1,ch())}function kf(a,b){"grid"===b&&a.each(function(){var a=Gf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function lf(a){var c,e,f,h,i,j,k,l,m,n,o,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,$,_=Zd(),ab=ie(Hf.data.targets),bb=Ic(Hf.data.targets);if(a=d(a)?a:{},G=d(a.withY)?a.withY:!0,H=d(a.withSubchart)?a.withSubchart:!0,I=d(a.withTransition)?a.withTransition:!0,L=d(a.withTransform)?a.withTransform:!1,N=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,O=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,P=d(a.withLegend)?a.withLegend:!1,J=d(a.withTransitionForExit)?a.withTransitionForExit:I,K=d(a.withTransitionForAxis)?a.withTransitionForAxis:I,V=I?Xf:0,W=J?V:0,X=K?V:0,c=rj.select("."+g.axisX).style("opacity",ab?0:1),f=rj.select("."+g.axisY).style("opacity",ab?0:1),h=rj.select("."+g.axisY2).style("opacity",ab?0:1),e=sj.select("."+g.axisX).style("opacity",ab?0:1),U={axisX:c.transition().duration(X),axisY:f.transition().duration(X),axisY2:h.transition().duration(X),axisSubX:e.transition().duration(X)},P&&gh&&Bf(Cc(Hf.data.targets),a,U),Mi&&(0!==bb.length&&O&&N||ug.domain([0,c.selectAll(".tick").size()])),bb.length&&(O&&(ug.domain(Gf.extent(_b(bb))),wj=ug.domain(),Qf&&oj.scale(ug).updateScaleExtent(),xg.domain(ug.domain()),kj.scale(xg)),N&&(ug.domain(kj.empty()?wj:kj.extent()),Qf&&oj.scale(ug).updateScaleExtent()),xh||!wh&&!vh||(Y=Kc(Jc(bb),vh),Ag.tickValues(Y),Dg.tickValues(Y))),vg.domain(Xb(bb,"y")),wg.domain(Xb(bb,"y2")),U.axisX.call(Ag),U.axisY.call(Bg),U.axisY2.call(Cg),U.axisSubX.call(Dg),Eb(I),N&&bb.length)if(th&&Y){for(Z=1;Z=0&&Gf.select(this).style("display",b%$?"none":"block")})}else pj.selectAll("."+g.axisX+" .tick text").style("display","block");D=Ag.tickOffset(),!mh&&yh&&fb(c,U.axisX,yh),Q=Ye(_),S=Ze(_,!0),T=Ze(_,!1),yg.domain(vg.domain()),zg.domain(wg.domain()),uj.style("display","none"),p(),rj.select("line."+g.xgridFocus).style("visibility","hidden"),Xh&&(k=Wd(Yh,ug),j=mh?{x1:0,x2:_f,y1:function(a){return ug(a)-D},y2:function(a){return ug(a)-D}}:{x1:function(a){return ug(a)+D},x2:function(a){return ug(a)+D},y1:Yf.top,y2:bg},i=rj.select("."+g.xgrids).selectAll("."+g.xgrid).data(k),i.enter().append("line").attr("class",g.xgrid),i.attr(j).style("opacity",function(){return+Gf.select(this).attr(mh?"y1":"x1")===(mh?bg:0)?0:1}),i.exit().remove()),Ce(Zh)&&(l=rj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(Zh),m=l.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",mh?"":"rotate(-90)").attr("dx",mh?0:-Yf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(V).attr("x1",mh?0:Gd).attr("x2",mh?_f:Gd).attr("y1",mh?Gd:Yf.top).attr("y2",mh?Gd:bg).style("opacity",1),l.select("text").transition().duration(V).attr("x",mh?_f:0).attr("y",Gd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(V).style("opacity",0).remove()),G&&$h&&(n=rj.select("."+g.ygrids).selectAll("."+g.ygrid).data(vg.ticks(ai)),n.enter().append("line").attr("class",g.ygrid),n.attr("x1",mh?vg:0).attr("x2",mh?vg:_f).attr("y1",mh?0:vg).attr("y2",mh?bg:vg),n.exit().remove(),kf(n,"grid")),G&&Ce(_h)&&(o=rj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(_h),q=o.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),q.append("line").style("opacity",0),q.append("text").attr("text-anchor","end").attr("transform",mh?"rotate(-90)":"").attr("dx",mh?0:-Yf.top).attr("dy",-5).style("opacity",0),o.select("line").transition().duration(V).attr("x1",mh?Hd:0).attr("x2",mh?Hd:_f).attr("y1",mh?0:Hd).attr("y2",mh?bg:Hd).style("opacity",1),o.select("text").transition().duration(V).attr("x",mh?0:_f).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),o.exit().transition().duration(V).style("opacity",0).remove()),w=rj.select("."+g.regions).selectAll("."+g.region).data(xi),w.enter().append("g").attr("class",hd).append("rect").style("fill-opacity",0),w.selectAll("rect").attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(V).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),w.exit().transition().duration(V).style("fill-opacity",0).remove(),u=rj.selectAll("."+g.bars).selectAll("."+g.bar).data(se),u.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Ui),u.style("opacity",td).transition().duration(V).attr("d",Q).style("fill",Ui).style("opacity",1),u.exit().transition().duration(W).style("opacity",0).remove(),r=rj.selectAll("."+g.lines).selectAll("."+g.line).data(qe),r.enter().append("path").attr("class",Zc).style("stroke",Ui),r.style("opacity",td).transition().duration(V).attr("d",lj).style("stroke",Ui).style("opacity",1),r.exit().transition().duration(W).style("opacity",0).remove(),s=rj.selectAll("."+g.areas).selectAll("."+g.area).data(qe),s.enter().append("path").attr("class",fd).style("fill",Ui).style("opacity",function(){return xj=+Gf.select(this).style("opacity"),0}),s.style("opacity",0).transition().duration(V).attr("d",mj).style("fill",Ui).style("opacity",xj),s.exit().transition().duration(W).style("opacity",0).remove(),t=rj.selectAll("."+g.circles).selectAll("."+g.circle).data(te),t.enter().append("circle").attr("class",_c).attr("r",Pe).style("fill",Ui),t.style("opacity",td).transition().duration(V).style("opacity",vd).style("fill",Ui).attr("cx",mh?Yd:Xd).attr("cy",mh?Xd:Yd),t.exit().remove(),x=rj.selectAll("."+g.texts).selectAll("."+g.text).data(ue),x.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return mh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",Ui).style("fill-opacity",0),x.text(function(a){return Ed(a.id)(a.value,a.id)}).style("fill-opacity",ud).transition().duration(V).attr("x",S).attr("y",T).style("fill",Ui).style("fill-opacity",wd),x.exit().transition().duration(W).style("fill-opacity",0).remove(),v=rj.selectAll("."+g.arcs).selectAll("."+g.arc).data(re),v.enter().append("path").attr("class",dd).style("fill",function(a){return Ui(a.data)}).style("cursor",function(a){return Wg(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Si||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),xf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Sd(d,Gf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Si||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),yf(),Td(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();ff(this,a,b),e(d,b)}),v.attr("transform",L?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Si=!0}).transition().duration(V).attrTween("d",function(a){var b,c=Fb(a);return c?(b=Gf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",L?"scale(1)":"").style("fill",function(a){return Ui(a.data)}).style("opacity",1).call(Fe,function(){Si=!1}),v.exit().transition().duration(W).style("opacity",0).remove(),rj.selectAll("."+g.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(V).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&pe(a.data)?1:0}),rj.select("."+g.chartArcsTitle).style("opacity",he(Hf.data.targets)?1:0),dh&&(null!==Gf.event&&"zoom"===Gf.event.type&&kj.extent(ug.orgDomain()).update(),H&&(!mh&&yh&&fb(e,U.axisSubX,yh),kj.empty()||kj.extent(ug.orgDomain()).update(),R=Ye(_,!0),z=sj.selectAll("."+g.bars).selectAll("."+g.bar).data(se),z.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Ui),z.style("opacity",td).transition().duration(V).attr("d",R).style("opacity",1),z.exit().transition().duration(V).style("opacity",0).remove(),y=sj.selectAll("."+g.lines).selectAll("."+g.line).data(qe),y.enter().append("path").attr("class",Zc).style("stroke",Ui),y.style("opacity",td).transition().duration(V).attr("d",nj).style("opacity",1),y.exit().transition().duration(V).style("opacity",0).remove())),rj.selectAll("."+g.selectedCircles).filter(function(a){return le(a)}).selectAll("circle").remove(),rj.selectAll("."+g.selectedCircle).transition().duration(V).attr("cx",mh?Yd:Xd).attr("cy",mh?Xd:Yd),A=rj.select("."+g.eventRects),Ce(Fg)&&!oc(Fg)?(A.classed(g.eventRectsMultiple)||A.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),B=rj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),ef(B.enter()),B.attr("x",0).attr("y",0).attr("width",_f).attr("height",bg)):(A.classed(g.eventRectsSingle)||A.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Ni&&!Mi?(F=function(a,b){var c=xc(b),d=yc(b),e=Hf.data.xs[a.id][b];return(ug(d?d:e+50)-ug(c?c:e-50))/2},E=function(a,b){var c=xc(b),d=Hf.data.xs[a.id][b];return(ug(d)+ug(c?c:d-50))/2}):(F=M(),E=function(a){return ug(a.x)-F/2}),C=Ac(Hf.data.targets),rj.select("."+g.eventRects).datum(C?C.values:[]),B=rj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),df(B.enter()),B.attr("class",id).attr("x",mh?0:E).attr("y",mh?E:0).attr("width",mh?_f:F).attr("height",mh?F:bg),B.exit().remove()),Cc(Hf.data.targets).forEach(function(a){yj[a]=!0})}function mf(){lf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function nf(){return"mousemove"===Gf.event.sourceEvent.type&&oj.altDomain?(ug.domain(oj.altDomain),void oj.scale(ug).updateScaleExtent()):(Mi&&ug.orgDomain()[0]===wj[0]&&ug.domain([wj[0]-1e-10,ug.orgDomain()[1]]),lf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Gf.event.sourceEvent.type&&(Qi=!0)))}function of(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function pf(){pj.attr("width",dg).attr("height",eg),pj.select("#"+Fi).select("rect").attr("width",_f).attr("height",bg),pj.select("#"+Gi).select("rect").attr("x",C).attr("y",D).attr("width",I).attr("height",J),pj.select("#"+Hi).select("rect").attr("x",E).attr("y",F).attr("width",K).attr("height",L),pj.select("."+g.zoomRect).attr("width",_f).attr("height",bg),vj.style("max-height",eg+"px")}function qf(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,o(),S(),pf(),n(a.withTransition),lf(a)}function rf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=rj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",kd),j=i.enter().append("g").attr("class",kd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc),e=rj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",md),d=e.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",cd).style("cursor",function(a){return Wg(a)?"pointer":null}),c=rj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",ld),b=c.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",$c),b.append("g").attr("class",gd),b.append("g").attr("class",function(a){return Uc(g.selectedCircles,a.id)}),b.append("g").attr("class",ad).style("cursor",function(a){return Wg(a)?"pointer":null}),a.forEach(function(a){rj.selectAll("."+g.selectedCircles+od(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=rj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(lg(a)).attr("class",nd),f=h.enter().append("g").attr("class",nd),f.append("g").attr("class",ed),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),dh&&(n=sj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",md),m=n.enter().append("g").style("opacity",0).attr("class",md),m.append("g").attr("class",cd),l=sj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",ld),k=l.enter().append("g").style("opacity",0).attr("class",ld),k.append("g").attr("class",$c)),pj.selectAll("."+g.target).filter(function(a){return Gc(a.id)}).transition().duration(Xf).style("opacity",1)}function sf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?ce(a.id,b.types[a.id]):ce(a.id,b.type)}),Hf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=cj?j:i,l=cj?R():Q();return d&&(w=0,C=0,t=0,u=0),gh&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=cj?u:t,void(lh?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=tj.selectAll("."+g.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,cj?(f=function(a){return t*B[a]},j=function(a){return A[B[a]]+x[a]}):(f=function(a){return A[B[a]]+x[a]},j=function(a){return u*B[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=tj.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(g.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof ih?ih(a):Hf.toggle(a)}).on("mouseover",function(a){Gf.select(this).classed(g.legendItemFocused,!0),Si||Hf.focus(a),"function"==typeof jh&&jh(a)}).on("mouseout",function(a){Gf.select(this).classed(g.legendItemFocused,!1),Si||Hf.revert(),"function"==typeof kh&&kh(a)}),m.append("text").text(function(a){return d(Ig[a])?Ig[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",cj?h:-200).attr("y",cj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",cj?i:-200).attr("y",cj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",Ui).attr("x",cj?h:-200).attr("y",cj?-200:j).attr("width",10).attr("height",10),tj.selectAll("text").data(a).text(function(a){return d(Ig[a])?Ig[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),tj.selectAll("rect."+g.legendItemEvent).data(a).transition().duration(p?250:0).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}).attr("x",i).attr("y",l),tj.selectAll("rect."+g.legendItemTile).data(a).transition().duration(p?250:0).style("fill",Ui).attr("x",f).attr("y",j),tj.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=Gf.select(this);return Gc(a)?!D||b.classed(g.legendItemFocused)?vf(b):wf(b):gj}),O(t),P(u),N(C),o(),S(),pf(),n(q,c)}function Cf(a){return Ec(Hf.data.targets,a.id)}function Df(a){return"data"in a&&Ec(Hf.data.targets,a.data.id)}function Ef(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 Ff(a,b,c){var d=!ie(Hf.data.targets);Si=!1,ce(a,b),qf(c||{withTransitionForAxis:d})}var Gf=a.d3?a.d3:a.require?a.require("d3"):void 0,Hf={data:{},axis:{},legend:{}},If={},Jf=i(["bindto"],"#chart"),Kf=i(["size","width"]),Lf=i(["size","height"]),Mf=i(["padding","left"],50),Nf=i(["padding","right"],0),Of=i(["padding","top"],0),Pf=i(["padding","bottom"],0),Qf=i(["zoom","enabled"],!1),Rf=i(["zoom","extent"]),Sf=i(["zoom","privileged"],!1),Tf=i(["onenter"],function(){}),Uf=i(["onleave"],function(){}),Vf=i(["onresize"],function(){}),Wf=i(["onresized"],function(){}),Xf=i(["transition","duration"],350);h("data","data is required in config");var Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg=i(["data","x"]),Fg=i(["data","xs"],{}),Gg=i(["data","x_format"]),Hg=i(["data","id_converter"],function(a){return a}),Ig=i(["data","names"],{}),Jg=i(["data","classes"],{}),Kg=i(["data","groups"],[]),Lg=i(["data","axes"],{}),Mg=i(["data","type"]),Ng=i(["data","types"],{}),Og=i(["data","labels"],{}),Pg=i(["data","order"]),Qg=i(["data","regions"],{}),Rg=i(["data","color"]),Sg=i(["data","colors"],{}),Tg=i(["data","hide"],!1),Ug=i(["data","selection","enabled"],!1),Vg=i(["data","selection","grouped"],!1),Wg=i(["data","selection","isselectable"],function(){return!0}),Xg=i(["data","selection","multiple"],!0),Yg=i(["data","onclick"],function(){}),Zg=i(["data","onenter"],function(){}),$g=i(["data","onleave"],function(){}),_g=i(["data","onselected"],function(){}),ah=i(["data","onunselected"],function(){}),bh=i(["data","ondragstart"],function(){}),ch=i(["data","ondragend"],function(){}),dh=i(["subchart","show"],!1),eh=i(["subchart","size","height"],60),fh=i(["color","pattern"],[]),gh=i(["legend","show"],!0),hh=i(["legend","position"],"bottom"),ih=i(["legend","item","onclick"]),jh=i(["legend","item","onmouseover"]),kh=i(["legend","item","onmouseout"]),lh=i(["legend","equally"],!1),mh=i(["axis","rotated"],!1),nh=i(["axis","x","show"],!0),oh=i(["axis","x","type"],"indexed"),ph=i(["axis","x","localtime"],!0),qh=i(["axis","x","categories"],[]),rh=i(["axis","x","tick","centered"],!1),sh=i(["axis","x","tick","format"]),th=i(["axis","x","tick","culling"],{}),uh=i(["axis","x","tick","culling","max"],10),vh=i(["axis","x","tick","count"]),wh=i(["axis","x","tick","fit"],!0),xh=i(["axis","x","tick","values"],null),yh=i(["axis","x","tick","rotate"]),zh=i(["axis","x","max"],null),Ah=i(["axis","x","min"],null),Bh=i(["axis","x","padding"],{}),Ch=i(["axis","x","height"]),Dh=i(["axis","x","default"]),Eh=i(["axis","x","label"],{}),Fh=i(["axis","y","show"],!0),Gh=i(["axis","y","max"]),Hh=i(["axis","y","min"]),Ih=i(["axis","y","center"]),Jh=i(["axis","y","label"],{}),Kh=i(["axis","y","inner"],!1),Lh=i(["axis","y","tick","format"]),Mh=i(["axis","y","padding"]),Nh=i(["axis","y","ticks"],10),Oh=i(["axis","y2","show"],!1),Ph=i(["axis","y2","max"]),Qh=i(["axis","y2","min"]),Rh=i(["axis","y2","center"]),Sh=i(["axis","y2","label"],{}),Th=i(["axis","y2","inner"],!1),Uh=i(["axis","y2","tick","format"]),Vh=i(["axis","y2","padding"]),Wh=i(["axis","y2","ticks"],10),Xh=i(["grid","x","show"],!1),Yh=i(["grid","x","type"],"tick"),Zh=i(["grid","x","lines"],[]),$h=i(["grid","y","show"],!1),_h=i(["grid","y","lines"],[]),ai=i(["grid","y","ticks"],10),bi=i(["point","show"],!0),ci=i(["point","r"],2.5),di=i(["point","focus","line","enabled"],!0),ei=i(["point","focus","expand","enabled"],!0),fi=i(["point","focus","expand","r"]),gi=i(["point","focus","select","r"]),hi=i(["line","connect_null"],!1),ii=i(["bar","width"]),ji=i(["bar","width","ratio"],.6),ki=i(["pie","label","show"],!0),li=i(["pie","label","format"]),mi=i(["pie","expand"],!0),ni=i(["pie","onclick"],function(){}),oi=i(["pie","onmouseover"],function(){}),pi=i(["pie","onmouseout"],function(){}),qi=i(["donut","label","show"],!0),ri=i(["donut","label","format"]),si=i(["donut","expand"],!0),ti=i(["donut","title"],""),ui=i(["donut","onclick"],function(){}),vi=i(["donut","onmouseover"],function(){}),wi=i(["donut","onmouseout"],function(){}),xi=i(["regions"],[]),yi=i(["tooltip","show"],!0),zi=i(["tooltip","format","title"]),Ai=i(["tooltip","format","value"]),Bi=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=zi?zi:b,l=Ai?Ai:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Ci=i(["tooltip","init","show"],!1),Di=i(["tooltip","init","x"],0),Ei=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Fi=("string"==typeof Jf?Jf.replace("#",""):Jf.id)+"-clip",Gi=Fi+"-xaxis",Hi=Fi+"-yaxis",Ii=j(Fi),Ji=j(Gi),Ki=j(Hi),Li="timeseries"===oh,Mi="categorized"===oh,Ni=!Li&&(Eg||Ce(Fg)),Oi=null,Pi=!1,Qi=!1,Ri=!1,Si=!1,Ti=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ui=we(Sg,Ce(fh)?fh:Ti,Rg),Vi=ph?Gf.time.format:Gf.time.format.utc,Wi=function(){var a=[[Vi("%Y/%-m/%-d"),function(){return!0}],[Vi("%-m/%-d"),function(a){return a.getMonth()}],[Vi("%-m/%-d"),function(a){return 1!==a.getDate()}],[Vi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Vi("%I %p"),function(a){return a.getHours()}],[Vi("%I:%M"),function(a){return a.getMinutes()}],[Vi(":%S"),function(a){return a.getSeconds()}],[Vi(".%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)}}(),Xi=[],Yi=[],Zi=mh?"left":"bottom",$i=mh?Kh?"top":"bottom":Kh?"right":"left",_i=mh?Th?"bottom":"top":Th?"left":"right",aj=mh?"left":"bottom",bj={main:function(){return"translate("+Yf.left+","+Yf.top+")"},context:function(){return"translate("+Zf.left+","+Zf.top+")"},legend:function(){return"translate("+$f.left+","+$f.top+")"},x:function(){return"translate(0,"+(mh?0:bg)+")"},y:function(){return"translate(0,"+(mh?bg:0)+")"},y2:function(){return"translate("+(mh?0:_f)+","+(mh?1:0)+")"},subx:function(){return"translate(0,"+(mh?0:cg)+")"},arc:function(){return"translate("+_f/2+","+bg/2+")"}},cj="right"===hh,dj=0,ej=0,fj=0,gj=.15,hj=30,ij=mh&&!nh?0:30,jj=5;lg=Gf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var kj,lj=function(){var a=Gf.svg.line().x(mh?function(a){return W(a.id)(a.value) -}:Fd).y(mh?Fd:function(a){return W(a.id)(a.value)});return hi||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=hi?Oe(b.values):b.values;return je(b)?(a.interpolate(ke(b)?"cardinal":"linear"),Qg[b.id]?bf(e,ug,W(b.id),Qg[b.id]):a(e)):(c=e[0]?ug(e[0].x):0,d=e[0]?W(b.id)(e[0].value):0,mh?"M "+d+" "+c:"M "+c+" "+d)}}(),mj=function(){var a;return a=mh?Gf.svg.area().x0(function(a){return W(a.id)(0)}).x1(function(a){return W(a.id)(a.value)}).y(Fd):Gf.svg.area().x(Fd).y0(function(a){return W(a.id)(0)}).y1(function(a){return W(a.id)(a.value)}),function(b){var c,d,e=Oe(b.values);return de([b],"area")||de([b],"area-spline")?(a.interpolate(ke(b)?"cardinal":"linear"),a(e)):(c=e[0]?ug(e[0].x):0,d=e[0]?W(b.id)(e[0].value):0,mh?"M "+d+" "+c:"M "+c+" "+d)}}(),nj=function(){var a=Gf.svg.line().x(mh?function(a){return X(a.id)(a.value)}:Id).y(mh?Id:function(a){return X(a.id)(a.value)});return function(b){var c=Oe(b.values);return je(b)?a(c):"M "+xg(c[0].x)+" "+X(b.id)(c[0].value)}}(),oj=function(){};kj=Gf.svg.brush().on("brush",mf),kj.update=function(){return sj&&sj.select("."+g.brush).call(this),this},kj.scale=function(a){return mh?this.y(a):this.x(a)},Qf&&(oj=Gf.behavior.zoom().on("zoomstart",function(){oj.altDomain=Gf.event.sourceEvent.altKey?ug.orgDomain():null}).on("zoom",Qf?nf:null),oj.scale=function(a){return mh?this.y(a):this.x(a)},oj.orgScaleExtent=function(){var a=Rf?Rf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},oj.updateScaleExtent=function(){var a=ac(ug.orgDomain())/ac(wj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var pj,qj,rj,sj,tj,uj,vj,wj,xj,yj={};if(Hf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=pj.selectAll(pd(a)),d=c.filter(Cf),e=c.filter(Df);Hf.revert(),Hf.defocus(),b(d.classed(g.focused,!0)),b(e),ie(Hf.data.targets)&&Nb(a,!0),xf(a,!0)},Hf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=pj.selectAll(pd(a)),d=c.filter(Cf),e=c.filter(Df);Hf.revert(),b(d.classed(g.focused,!1)),b(e),ie(Hf.data.targets)&&Ob(a),xf(a,!1)},Hf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=pj.selectAll(pd(a)),d=c.filter(Cf),e=c.filter(Df);b(d.classed(g.focused,!1)),b(e),ie(Hf.data.targets)&&Ob(a),yf()},Hf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),pj.selectAll(qd(a)).transition().style("opacity",1),b.withLegend&&zf(a),lf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Hf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),pj.selectAll(qd(a)).transition().style("opacity",0),b.withLegend&&Af(a),lf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Hf.toggle=function(a){Gc(a)?Hf.hide(a):Hf.show(a)},Hf.unzoom=function(){kj.clear().update(),lf({withUpdateXDomain:!0})},Hf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Jg[b]=a.classes[b]}),"categories"in a&&Mi&&(qh=a.categories,Ag.categories(qh)),"cacheIds"in a&&bc(a.cacheIds)?void sf(dc(a.cacheIds),a.done):void("unload"in a?uf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){tf(a)}):tf(a))},Hf.unload=function(a,b){uf(Dc(a),function(){lf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Hf.selected=function(a){return Gf.merge(rj.selectAll("."+g.shapes+od(a)).selectAll("."+g.shape).filter(function(){return Gf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Hf.select=function(a,b,c){Ug&&rj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Gf.select(this),i=e.data?e.data.id:e.id,j=Ne(this),k=Vg||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);k&&l?Wg(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f)})},Hf.unselect=function(a,b){Ug&&rj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Gf.select(this),f=c.data?c.data.id:c.id,h=Ne(this),i=Vg||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);i&&j&&Wg(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Hf.toLine=function(a){Ff(a,"line")},Hf.toSpline=function(a){Ff(a,"spline")},Hf.toBar=function(a){Ff(a,"bar")},Hf.toScatter=function(a){Ff(a,"scatter")},Hf.toArea=function(a){Ff(a,"area")},Hf.toAreaSpline=function(a){Ff(a,"area-spline")},Hf.toPie=function(a){Ff(a,"pie",{withTransform:!0})},Hf.toDonut=function(a){Ff(a,"donut",{withTransform:!0})},Hf.groups=function(a){return c(a)?Kg:(Kg=a,lf(),Kg)},Hf.xgrids=function(a){return a?(Zh=a,lf(),Zh):Zh},Hf.xgrids.add=function(a){return a?Hf.xgrids(Zh.concat(a)):void 0},Hf.xgrids.remove=function(a){var b=Ef(a);return Hf.xgrids(Zh.filter(b))},Hf.ygrids=function(a){return a?(_h=a,lf(),_h):_h},Hf.ygrids.add=function(a){return a?Hf.ygrids(_h.concat(a)):void 0},Hf.ygrids.remove=function(a){var b=Ef(a);return Hf.ygrids(_h.filter(b))},Hf.regions=function(a){return c(a)?xi:(xi=a,lf(),xi)},Hf.regions.add=function(a){return c(a)?xi:(xi=xi.concat(a),lf(),xi)},Hf.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;pj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),xi=xi.filter(function(b){return b.classes.indexOf(a)<0})}),xi},Hf.data.get=function(a){var b=Hf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Hf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},Hf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Ig[b]=a[b]}),lf({withLegend:!0}),Ig):Ig},Hf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Sg[b]=a[b]}),lf({withLegend:!0}),Sg):Sg},Hf.x=function(a){return arguments.length&&(qc(Hf.data.targets,a),lf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Hf.data.xs},Hf.xs=function(a){return arguments.length&&(rc(Hf.data.targets,a),lf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Hf.data.xs},Hf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){cb(b,a[b])}),Eb())},Hf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(zh=+a.x),b(a.y)&&(Gh=+a.y),b(a.y2)&&(Ph=+a.y2)):Gh=Ph=+a,lf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Hf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Ah=+a.x),b(a.y)&&(Hh=+a.y),b(a.y2)&&(Qh=+a.y2)):Hh=Qh=+a,lf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Hf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Hf.axis.max(a.max),"undefined"!=typeof a.min&&Hf.axis.min(a.min))},Hf.legend.show=function(a){zf(Dc(a)),lf({withLegend:!0})},Hf.legend.hide=function(a){Af(Dc(a)),lf({withLegend:!0})},Hf.resize=function(a){Kf=a?a.width:null,Lf=a?a.height:null,qf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Hf.destroy=function(){Hf.data.targets=void 0,Hf.data.xs={},vj.html(""),a.onresize=null},"url"in f.data)Gf.xhr(f.data.url,function(a,b){var c,d=Gf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Gf.csv.parse(b.response),cf(c)});else if("rows"in f.data)cf(tc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");cf(uc(f.data.columns))}return Hf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(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}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.ceil(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.ceil(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&a_f&&(_f=0),0>bg&&(bg=0),ag=mh?Yf.left-hj-ij:_f,cg=mh?bg:eg-Zf.top-Zf.bottom,0>ag&&(ag=0),0>cg&&(cg=0),q(),cj&&ie(Hf.data.targets)&&($f.left=_f/2+gg)}function p(){rj.select("line."+g.xgridFocus).attr("x1",mh?0:-10).attr("x2",mh?_f:-10).attr("y1",mh?-10:Yf.top).attr("y2",mh?-10:bg)}function q(){gg=bg/2,fg=.95*gg,hg=he(Hf.data.targets)?.6*fg:0}function r(){var a=mh?g.axisX:g.axisY,b=rj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Gf.select(Jf).node().getBoundingClientRect(),e=c.right-d.left-u();return e>0?e:0}function s(){return Kf?Kf:y()}function t(){var a=Lf?Lf:z();return a>0?a:320}function u(){return ie(Hf.data.targets)?0:Mf?Mf:mh?nh?w("x"):1:!Fh||Kh?1:w("y")}function v(){var a=1;return ie(Hf.data.targets)?0:Nf?Nf:cj?Q()+20+(Oh&&!mh?w("y2"):a):Oh?Th||mh?a:w("y2"):a}function w(a){var b=kb(a);return b.isInner?20+Db(a):40+Db(a)}function x(a){return"x"!==a||nh?"x"===a&&Ch?Ch:"y"!==a||Fh?"y2"!==a||Oh?(kb(a).isInner?30:40)+("y2"===a?-10:0):jj:gh&&!cj?10:1:0}function y(){return+Gf.select(Jf).style("width").replace("px","")}function z(){return+Gf.select(Jf).style("height").replace("px","")}function A(a){return a?-5:-(Yf.left-1)}function B(a){return a?-20:-4}function C(){return A(!mh)}function D(){return B(!mh)}function E(){return A(mh)}function F(){return B(mh)}function G(a){return a?_f+2+4:Yf.left+20}function H(a){return a?(Ch?Ch:0)+80:bg+8}function I(){return G(!mh)}function J(){return H(!mh)}function K(){return G(mh)}function L(){return H(mh)}function M(){var a,b,c,d,e,f=Ac(Hf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ug(b.x)-ug(a.x),0===c?mh?bg:_f:(d=zc(),e=ee(Hf.data.targets)?(d-(Mi?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function N(a){dj=a}function O(a){ej=a}function P(a){fj=a}function Q(){return gh?cj?ej*(dj+1):dg:0}function R(){return gh?cj?eg:fj*(dj+1):0}function S(){var a,b,c=!ug;mg=mh?1:0,ng=mh?bg:_f,og=mh?0:bg,pg=mh?_f:1,qg=mg,rg=ng,sg=mh?0:cg,tg=mh?ag:1,ug=U(mg,ng,c?void 0:ug.domain(),function(){return Ag.tickOffset()}),vg=V(og,pg,c?void 0:vg.domain()),wg=V(og,pg,c?void 0:wg.domain()),xg=U(mg,ng,wj,function(a){return a%1?0:Dg.tickOffset()}),yg=V(sg,tg,c?void 0:yg.domain()),zg=V(sg,tg,c?void 0:zg.domain()),a=_(),b=xh?xh:c?void 0:Ag.tickValues(),Ag=Y(ug,Zi,a,b),Dg=Y(xg,aj,a,b),Bg=Z(vg,$i,Lh,Nh),Cg=Z(wg,_i,Uh,Wh),c||(kj.scale(xg),Qf&&oj.scale(ug)),T()}function T(){ig=Gb(),jg=Hb(),kg=Hb(.98)}function U(a,b,c,d){var e,f=(Li?Gf.time.scale():Gf.scale.linear()).range([a,b]),g=c?f.domain(c):f;Mi?(d=d||function(){return 0},f=function(a){return Math.ceil(g(a)+d(a))}):f=function(a){return Math.ceil(g(a))};for(e in g)f[e]=g[e];return f.orgDomain=function(){return g.domain()},Mi&&(f.domain=function(a){return arguments.length?(g.domain(a),f):(a=g.domain(),[a[0],a[1]+1])}),f}function V(a,b,c){var d=Gf.scale.linear().range([a,b]);return c&&d.domain(c),d}function W(a){return"y2"===$(a)?wg:vg}function X(a){return"y2"===$(a)?zg:yg}function Y(a,b,c,d){var f=e(Gf,Mi).scale(a).orient(b);return f.tickFormat(c).tickValues(d),Mi?(f.tickCentered(rh),Be(th)&&(th=!1),f.categories(qh)):f.tickOffset=function(){var a=Bc(Hf.data.targets),b=ug(a[1])-ug(a[0]),c=b?b:mh?bg:_f;return c/zc()/2},f}function Z(a,b,c,d){return e(Gf).scale(a).orient(b).tickFormat(c).ticks(d)}function $(a){return a in Lg?Lg[a]:"y"}function _(){var a=Li?Wi:Mi?Tc:function(a){return 0>a?a.toFixed(0):a};return sh&&("function"==typeof sh?a=sh:Li&&(a=function(a){return a?Vi(sh)(a):""})),a}function ab(a){var b;return"y"===a?b=Jh:"y2"===a?b=Sh:"x"===a&&(b=Eh),b}function bb(a){var b=ab(a);return"string"==typeof b?b:b?b.text:null}function cb(a,b){var c=ab(a);"string"==typeof c?"y"===a?Jh=b:"y2"===a?Sh=b:"x"===a&&(Eh=b):c&&(c.text=b)}function db(a){return 10*Math.sin(Math.PI*(a/180))}function eb(a){return 11.5-2.5*(a/15)}function fb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",eb(c)).attr("x",db(c)).attr("transform","rotate("+c+")")}function gb(a,b){var c=ab(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 hb(){return gb("x",mh?"inner-top":"inner-right")}function ib(){return gb("y",mh?"inner-right":"inner-top")}function jb(){return gb("y2",mh?"inner-right":"inner-top")}function kb(a){return"y2"===a?jb():"y"===a?ib():hb()}function lb(){return bb("x")}function mb(){return bb("y")}function nb(){return bb("y2")}function ob(a,b){return a?b.isLeft?0:b.isCenter?_f/2:_f:b.isBottom?-bg:b.isMiddle?-bg/2:0}function pb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function qb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function rb(){return ob(!mh,hb())}function sb(){return ob(mh,ib())}function tb(){return ob(mh,jb())}function ub(){return pb(!mh,hb())}function vb(){return pb(mh,ib())}function wb(){return pb(mh,jb())}function xb(){var a=hb();return mh?a.isInner?"1.2em":-25-Db("x"):a.isInner?"-0.5em":Ch?Ch-10:"3em"}function yb(){var a=ib();return mh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Db("y")}function zb(){var a=jb();return mh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Db("y2")}function Ab(){return qb(!mh,hb())}function Bb(){return qb(mh,ib())}function Cb(){return qb(mh,jb())}function Db(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Gf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Eb(a){var b=rj.select("."+g.axisX+" ."+g.axisXLabel),c=rj.select("."+g.axisY+" ."+g.axisYLabel),d=rj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",rb).attr("dx",ub).attr("dy",xb).text(lb),(a?c.transition():c).attr("x",sb).attr("dx",vb).attr("dy",yb).attr("dy",yb).text(mb),(a?d.transition():d).attr("x",tb).attr("dx",wb).attr("dy",zb).text(nb)}function Fb(a){var b=!1;return lg(Ic(Hf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Gb(){var a=Gf.svg.arc().outerRadius(fg).innerRadius(hg),b=function(b,c){var d;return c?a(b):(d=Fb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Hb(a){var b=Gf.svg.arc().outerRadius(gg*(a?a:1)).innerRadius(hg);return function(a){var c=Fb(a);return c?b(c):"M 0 0"}}function Ib(a,b){return pe(a.data)?ig(a,b):"M 0 0"}function Jb(a){var b,c,d,e,f=Fb(a),g="";return f&&(b=ig.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*fg*.8+","+d/e*fg*.8+")"),g}function Kb(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Lb(a){return pc({id:a.data.id,value:a.value,ratio:Kb(a)})}function Mb(a){var b,c,d,e;return Pb()?(b=Fb(a),c=b?b.value:null,d=Kb(b),e=Qb(),e?e(c,d):Dd(c,d)):""}function Nb(a,b){var c=pj.selectAll("."+g.chartArc+pd(a)),d=pj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});ve(a)&&c.selectAll("path").transition().duration(50).attr("d",jg).transition().duration(100).attr("d",kg).each(function(a){oe(a.data)}),b||d.style("opacity",.3)}function Ob(a){var b=pj.selectAll("."+g.chartArc+pd(a));b.selectAll("path").transition().duration(50).attr("d",ig),pj.selectAll("."+g.arc).style("opacity",1)}function Pb(){return he(Hf.data.targets)?qi:ki}function Qb(){return he(Hf.data.targets)?ri:li}function Rb(){return he(Hf.data.targets)?ti:""}function Sb(){var a=he(Hf.data.targets)?ui:ni;return"function"==typeof a?a:function(){}}function Tb(){var a=he(Hf.data.targets)?vi:oi;return"function"==typeof a?a:function(){}}function Ub(){var a=he(Hf.data.targets)?wi:pi;return"function"==typeof a?a:function(){}}function Vb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(Kg.length>0)for(g=Rc(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 Gf.min(Object.keys(i).map(function(a){return Gf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(Kg.length>0)for(g=Sc(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 Gf.max(Object.keys(i).map(function(a){return Gf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return $(a.id)===c}),m="y2"===c?Qh:Hh,n="y2"===c?Ph:Gh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Rh:Ih,r=xd()&&mh;return 0===l.length?"y2"===c?wg.domain():vg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=yd(o,p),j=ac(vg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Mh&&(f=b(Mh.top)?Mh.top:e,g=b(Mh.bottom)?Mh.bottom:e),"y2"===c&&Vh&&(f=b(Vh.top)?Vh.top:e,g=b(Vh.bottom)?Vh.bottom:e),ee(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return Ah?Li?xe(Ah):Ah:Gf.min(a,function(a){return Gf.min(a.values,function(a){return a.x})})}function Zb(a){return zh?Li?xe(zh):zh:Gf.max(a,function(a){return Gf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Mi?d=0:ee(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Bh&&Ce(Bh)?(e=b(Bh.left)?Bh.left:d,f=b(Bh.right)?Bh.right:d):e=f="number"==typeof Bh?Bh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return c-d!==0||Mi||(c=Li?new Date(.5*c.getTime()):-.5,d=Li?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Li?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Li?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?vg:wg;return b="y"===a.axis||"y2"===a.axis?mh?bg:"start"in a?d(a.start):bg:mh&&"end"in a?ug(Li?xe(a.end):a.end):bg,c>b?0:b-c}function ic(a){return Eg&&a===Eg||Ce(Fg)&&De(Fg,a)}function jc(a){return!ic(a)}function kc(a){return Eg?Eg:Ce(Fg)?Fg[a]:null}function lc(a,b){var c,d=b&&Ce(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=Hf.data.xs[b])}),c}function mc(a,b){return a in Hf.data.xs&&Hf.data.xs[a]&&Hf.data.xs[a][b]?Hf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){Fg[b]=a[b]})}function oc(a){return 1===Gf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=Ig[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),Hf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=Li?a?a instanceof Date?a:xe(a):xe(mc(c,d)):Ni&&!Mi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Hf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Eg?(d=Object.keys(Hf.data.xs),Hf.data.xs[c]=d.length>0?Hf.data.xs[d[0]]:void 0):Ce(Fg)&&(Hf.data.xs[c]=lc(f,Hf.data.targets)):Hf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Hf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Hg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ni&&Mi&&0===c&&g&&(0===e&&(qh=[]),qh.push(g)),("undefined"==typeof a[b]||Hf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Mg&&ce(Cc(c).filter(function(a){return!(a in Ng)}),Mg),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&Hf.data.targets[0].values[a-1]?Hf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(Hf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Li?new Date(i):i);j.push(e)}return Li||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Xi=Xi.concat(a)}function Mc(a){Xi=Xi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Yi=Yi.concat(a)}function Oc(a){Yi=Yi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Jd(a,f))),(a[g].x||0===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=Ee(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Nd(a,b){return Gf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Od(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 Pd(){return Pg&&"desc"===Pg.toLowerCase()}function Qd(){return Pg&&"asc"===Pg.toLowerCase()}function Rd(a){var b=Qd(),c=Pd();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 Pg&&a.sort(Pg),a}function Sd(a,c){var d,e,f,g,h,i,j,k=ie(Hf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&yi&&(uj.html(Bi(a,_(),zd(k),Ui)).style("display","block"),d=uj.property("offsetWidth"),e=uj.property("offsetHeight"),k?(g=_f/2+c[0],i=bg/2+c[1]+20):(mh?(f=r(),g=f+c[0]+100,h=g+d,j=s()-v(),i=ug(l[0].x)+20):(f=r(),g=f+u()+ug(l[0].x)+20,h=g+d,j=f+s()-v(),i=c[1]+15),h>j&&(g-=d+60),i+e>t()&&(i-=e+30)),uj.style("top",i+"px").style("left",g+"px"))}function Td(){uj.style("display","none")}function Ud(a){var c=a.filter(function(a){return a&&b(a.value)});if(yi&&!fe(Hf.data.targets)&&!ie(Hf.data.targets)){var d=rj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(mh?"y1":"x1",Fd).attr(mh?"y2":"x2",Fd),kf(d,"grid")}}function Vd(){rj.select("line."+g.xgridFocus).style("visibility","hidden")}function Wd(a,b){var c,d,e,f,g=[];if("year"===a)for(c=_b(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)g.push(new Date(f+"-01-01 00:00:00"));else g=b.ticks(10);return g}function Xd(a){return a.x||0===a.x?ug(a.x):null}function Yd(a){return W(a.id)(a.value)}function Zd(){var a,b,d={},e=0;return Ic(Fc(le)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function be(a,b){return"number"==typeof ii?ii:b?2*a.tickOffset()*ji/b:0}function ce(a,b){Dc(a).forEach(function(a){yj[a]=b===Ng[a],Ng[a]=b})}function de(a,b){var c=!1;return a.forEach(function(a){Ng[a.id]===b&&(c=!0),a.id in Ng||"line"!==b||(c=!0)}),c}function ee(a){return de(a,"bar")}function fe(a){return de(a,"scatter")}function ge(a){return de(a,"pie")}function he(a){return de(a,"donut")}function ie(a){return ge(a)||he(a)}function je(a){var b="string"==typeof a?a:a.id;return!(b in Ng)||"line"===Ng[b]||"spline"===Ng[b]||"area"===Ng[b]||"area-spline"===Ng[b]}function ke(a){var b="string"==typeof a?a:a.id;return"spline"===Ng[b]||"area-spline"===Ng[b]}function le(a){var b="string"==typeof a?a:a.id;return"bar"===Ng[b]}function me(a){var b="string"==typeof a?a:a.id;return"scatter"===Ng[b]}function ne(a){var b="string"==typeof a?a:a.id;return"pie"===Ng[b]}function oe(a){var b="string"==typeof a?a:a.id;return"donut"===Ng[b]}function pe(a){return ne(a)||oe(a)}function qe(a){return je(a)?[a]:[]}function re(a){return pe(a.data)?[a]:[]}function se(a){return le(a)?a.values:[]}function te(a){return je(a)||me(a)?a.values:[]}function ue(a){return le(a)||je(a)?a.values:[]}function ve(a){return oe(a)&&si||ne(a)&&mi}function we(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function xe(b){var c;try{c=Gg?Gf.time.format(Gg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Gg)}return c}function ye(a,b){var c=Gf.mouse(a),d=Gf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function De(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Ee(a,b){var c="y"===$(a.id)?vg:wg,d=mh?1:0,e=mh?0:1;return Math.pow(ug(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Fe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ge(a,b,c){_g(b,a.node()),rj.select("."+g.selectedCircles+od(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(g.selectedCircle,c)}).attr("cx",mh?Yd:Xd).attr("cy",mh?Xd:Yd).attr("stroke",function(){return Ui(b)}).attr("r",1.4*Re(b)).transition().duration(100).attr("r",Re)}function He(a,b,c){ah(b,a.node()),rj.select("."+g.selectedCircles+od(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ie(a,b,c,d){a?Ge(b,c,d):He(b,c,d)}function Je(a,b){_g(b,a.node()),a.transition().duration(100).style("fill",function(){return Gf.rgb(Ui(b)).brighter(.75)})}function Ke(a,b){ah(b,a.node()),a.transition().duration(100).style("fill",function(){return Ui(b)})}function Le(a,b,c,d){a?Je(b,c,d):Ke(b,c,d)}function Me(a,b,c,d){Le(a,b,c.data,d)}function Ne(a){return"circle"===a.nodeName?Ie:Gf.select(a).classed(g.bar)?Le:Me}function Oe(a){return a.filter(function(a){return b(a.value)})}function Pe(a){return bi?"function"==typeof ci?ci(a):ci:0}function Qe(a){return ei?fi?fi:1.75*Pe(a):Pe(a)}function Re(a){return gi?gi:4*Pe(a)}function Se(a,c){return(c?rj.selectAll("."+g.circles+od(c)):rj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Te(a,b){Se(a,b).classed(g.EXPANDED,!0).attr("r",Qe)}function Ue(a){Se(a).filter(function(){return Gf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Pe)}function Ve(a){return rj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function We(a){Ve(a).classed(g.EXPANDED,!0)}function Xe(a){Ve(a).classed(g.EXPANDED,!1)}function Ye(a,b){var c=af(a,b);return function(a,b){var d=c(a,b),e=mh?1:0,f=mh?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 Ze(a,b){var c=af(a,!1),d=b?$e:_e;return function(a,b){return d(c(a,b),a,this)}}function $e(a,b){var c;return mh?(c=le(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function _e(a,b,c){var d=c.getBoundingClientRect();return mh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:le(b)?-3:-6)}function af(a,b){var c=a.__max__+1,d=be(Ag,c),e=$d(d,c,a,!!b),f=_d(!!b),g=ae(a,!!b),h=b?X:W;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return mh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function bf(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 cf(b){var c,d,e;if(vj=Gf.select(Jf),vj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(vj.html("").classed("c3",!0),Hf.data.xs={},Hf.data.targets=vc(b),Tg&&Lc(Tg===!0?Cc(Hf.data.targets):Tg),o(),S(),ug.domain(Gf.extent(_b(Hf.data.targets))),vg.domain(Xb(Hf.data.targets,"y")),wg.domain(Xb(Hf.data.targets,"y2")),xg.domain(ug.domain()),yg.domain(vg.domain()),zg.domain(wg.domain()),wj=ug.domain(),kj.scale(xg),Qf&&oj.scale(ug),pj=vj.append("svg").on("mouseenter",Tf).on("mouseleave",Uf),qj=pj.append("defs"),qj.append("clipPath").attr("id",Fi).append("rect"),qj.append("clipPath").attr("id",Gi).append("rect"),qj.append("clipPath").attr("id",Hi).append("rect"),pf(),rj=pj.append("g").attr("transform",bj.main),sj=pj.append("g").attr("transform",bj.context),tj=pj.append("g").attr("transform",bj.legend),dh||sj.style("visibility","hidden"),gh||(tj.style("visibility","hidden"),Yi=Cc(Hf.data.targets)),uj=Gf.select(Jf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Bf(Cc(Hf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=rj.append("g").attr("clip-path",Ii).attr("class",g.grid),Xh&&d.append("g").attr("class",g.xgrids),Ce(Zh)&&d.append("g").attr("class",g.xgridLines),di&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),$h&&d.append("g").attr("class",g.ygrids),Ce(_h)&&d.append("g").attr("class",g.ygridLines),nh&&rj.append("g").attr("class",g.axisX).attr("clip-path",Ji).attr("transform",bj.x).append("text").attr("class",g.axisXLabel).attr("transform",mh?"rotate(-90)":"").style("text-anchor",Ab),Fh&&rj.append("g").attr("class",g.axisY).attr("clip-path",Ki).attr("transform",bj.y).append("text").attr("class",g.axisYLabel).attr("transform",mh?"":"rotate(-90)").style("text-anchor",Bb),Oh&&rj.append("g").attr("class",g.axisY2).attr("transform",bj.y2).append("text").attr("class",g.axisY2Label).attr("transform",mh?"":"rotate(-90)").style("text-anchor",Cb),rj.append("g").attr("clip-path",Ii).attr("class",g.regions),rj.append("g").attr("clip-path",Ii).attr("class",g.chart),c=rj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Qf?mh?"ns-resize":"ew-resize":null),rj.select("."+g.chart).append("g").attr("class",g.chartBars),rj.select("."+g.chart).append("g").attr("class",g.chartLines),rj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",bj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Rb()),rj.select("."+g.chart).append("g").attr("class",g.chartTexts),Qf&&rj.insert("rect",Sf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",_f).attr("height",bg).style("opacity",0).style("cursor",mh?"ns-resize":"ew-resize").call(oj).on("dblclick.zoom",null),Dh&&kj.extent("function"!=typeof Dh?Dh:Dh(_b())),sj.append("g").attr("clip-path",Ii).attr("class",g.chart),sj.select("."+g.chart).append("g").attr("class",g.chartBars),sj.select("."+g.chart).append("g").attr("class",g.chartLines),sj.append("g").attr("clip-path",Ii).attr("class",g.brush).call(kj).selectAll("rect").attr(mh?"width":"height",mh?ag:cg),sj.append("g").attr("class",g.axisX).attr("transform",bj.subx).attr("clip-path",mh?"":Ji),rf(Hf.data.targets),mh?rj.select("."+g.axisX).style("opacity",0).call(Ag):(rj.select("."+g.axisY).style("opacity",0).call(Bg),rj.select("."+g.axisY2).style("opacity",0).call(Cg)),o(),S(),pf(),n(!1),lf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Ci){if(Li&&"string"==typeof Di){for(Di=xe(Di),e=0;e0){d=[];for(var f in Ig)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Od(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Le,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function hf(a){ie(Hf.data.targets)||Ug&&(Oi=a,rj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Pi=!0,bh())}function jf(){ie(Hf.data.targets)||Ug&&(rj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),rj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Pi=!1,ch())}function kf(a,b){"grid"===b&&a.each(function(){var a=Gf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function lf(a){var c,e,f,h,i,j,k,l,m,n,o,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,$,_=Zd(),ab=ie(Hf.data.targets),bb=Ic(Hf.data.targets);if(a=d(a)?a:{},G=d(a.withY)?a.withY:!0,H=d(a.withSubchart)?a.withSubchart:!0,I=d(a.withTransition)?a.withTransition:!0,L=d(a.withTransform)?a.withTransform:!1,N=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,O=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,P=d(a.withLegend)?a.withLegend:!1,J=d(a.withTransitionForExit)?a.withTransitionForExit:I,K=d(a.withTransitionForAxis)?a.withTransitionForAxis:I,V=I?Xf:0,W=J?V:0,X=K?V:0,c=rj.select("."+g.axisX).style("opacity",ab?0:1),f=rj.select("."+g.axisY).style("opacity",ab?0:1),h=rj.select("."+g.axisY2).style("opacity",ab?0:1),e=sj.select("."+g.axisX).style("opacity",ab?0:1),U={axisX:c.transition().duration(X),axisY:f.transition().duration(X),axisY2:h.transition().duration(X),axisSubX:e.transition().duration(X)},P&&gh&&Bf(Cc(Hf.data.targets),a,U),Mi&&(0!==bb.length&&O&&N||ug.domain([0,c.selectAll(".tick").size()])),bb.length&&(O&&(ug.domain(Gf.extent(_b(bb))),wj=ug.domain(),Qf&&oj.scale(ug).updateScaleExtent(),xg.domain(ug.domain()),kj.scale(xg)),N&&(ug.domain(kj.empty()?wj:kj.extent()),Qf&&oj.scale(ug).updateScaleExtent()),xh||!wh&&!vh||(Y=Kc(Jc(bb),vh),Ag.tickValues(Y),Dg.tickValues(Y))),vg.domain(Xb(bb,"y")),wg.domain(Xb(bb,"y2")),U.axisX.call(Ag),U.axisY.call(Bg),U.axisY2.call(Cg),U.axisSubX.call(Dg),Eb(I),N&&bb.length)if(th&&Y){for(Z=1;Z=0&&Gf.select(this).style("display",b%$?"none":"block")})}else pj.selectAll("."+g.axisX+" .tick text").style("display","block");D=Ag.tickOffset(),!mh&&yh&&fb(c,U.axisX,yh),Q=Ye(_),S=Ze(_,!0),T=Ze(_,!1),yg.domain(vg.domain()),zg.domain(wg.domain()),uj.style("display","none"),p(),rj.select("line."+g.xgridFocus).style("visibility","hidden"),Xh&&(k=Wd(Yh,ug),j=mh?{x1:0,x2:_f,y1:function(a){return ug(a)-D},y2:function(a){return ug(a)-D}}:{x1:function(a){return ug(a)+D},x2:function(a){return ug(a)+D},y1:Yf.top,y2:bg},i=rj.select("."+g.xgrids).selectAll("."+g.xgrid).data(k),i.enter().append("line").attr("class",g.xgrid),i.attr(j).style("opacity",function(){return+Gf.select(this).attr(mh?"y1":"x1")===(mh?bg:0)?0:1}),i.exit().remove()),Ce(Zh)&&(l=rj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(Zh),m=l.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",mh?"":"rotate(-90)").attr("dx",mh?0:-Yf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(V).attr("x1",mh?0:Gd).attr("x2",mh?_f:Gd).attr("y1",mh?Gd:Yf.top).attr("y2",mh?Gd:bg).style("opacity",1),l.select("text").transition().duration(V).attr("x",mh?_f:0).attr("y",Gd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(V).style("opacity",0).remove()),G&&$h&&(n=rj.select("."+g.ygrids).selectAll("."+g.ygrid).data(vg.ticks(ai)),n.enter().append("line").attr("class",g.ygrid),n.attr("x1",mh?vg:0).attr("x2",mh?vg:_f).attr("y1",mh?0:vg).attr("y2",mh?bg:vg),n.exit().remove(),kf(n,"grid")),G&&Ce(_h)&&(o=rj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(_h),q=o.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),q.append("line").style("opacity",0),q.append("text").attr("text-anchor","end").attr("transform",mh?"rotate(-90)":"").attr("dx",mh?0:-Yf.top).attr("dy",-5).style("opacity",0),o.select("line").transition().duration(V).attr("x1",mh?Hd:0).attr("x2",mh?Hd:_f).attr("y1",mh?0:Hd).attr("y2",mh?bg:Hd).style("opacity",1),o.select("text").transition().duration(V).attr("x",mh?0:_f).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),o.exit().transition().duration(V).style("opacity",0).remove()),w=rj.select("."+g.regions).selectAll("."+g.region).data(xi),w.enter().append("g").attr("class",hd).append("rect").style("fill-opacity",0),w.selectAll("rect").attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(V).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),w.exit().transition().duration(V).style("fill-opacity",0).remove(),u=rj.selectAll("."+g.bars).selectAll("."+g.bar).data(se),u.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Ui),u.style("opacity",td).transition().duration(V).attr("d",Q).style("fill",Ui).style("opacity",1),u.exit().transition().duration(W).style("opacity",0).remove(),r=rj.selectAll("."+g.lines).selectAll("."+g.line).data(qe),r.enter().append("path").attr("class",Zc).style("stroke",Ui),r.style("opacity",td).transition().duration(V).attr("d",lj).style("stroke",Ui).style("opacity",1),r.exit().transition().duration(W).style("opacity",0).remove(),s=rj.selectAll("."+g.areas).selectAll("."+g.area).data(qe),s.enter().append("path").attr("class",fd).style("fill",Ui).style("opacity",function(){return xj=+Gf.select(this).style("opacity"),0}),s.style("opacity",0).transition().duration(V).attr("d",mj).style("fill",Ui).style("opacity",xj),s.exit().transition().duration(W).style("opacity",0).remove(),t=rj.selectAll("."+g.circles).selectAll("."+g.circle).data(te),t.enter().append("circle").attr("class",_c).attr("r",Pe).style("fill",Ui),t.style("opacity",td).transition().duration(V).style("opacity",vd).style("fill",Ui).attr("cx",mh?Yd:Xd).attr("cy",mh?Xd:Yd),t.exit().remove(),x=rj.selectAll("."+g.texts).selectAll("."+g.text).data(ue),x.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return mh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",Ui).style("fill-opacity",0),x.text(function(a){return Ed(a.id)(a.value,a.id)}).style("fill-opacity",ud).transition().duration(V).attr("x",S).attr("y",T).style("fill",Ui).style("fill-opacity",wd),x.exit().transition().duration(W).style("fill-opacity",0).remove(),v=rj.selectAll("."+g.arcs).selectAll("."+g.arc).data(re),v.enter().append("path").attr("class",dd).style("fill",function(a){return Ui(a.data)}).style("cursor",function(a){return Wg(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Si||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),xf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Sd(d,Gf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Si||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),yf(),Td(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();ff(this,a,b),e(d,b)}),v.attr("transform",L?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Si=!0}).transition().duration(V).attrTween("d",function(a){var b,c=Fb(a);return c?(b=Gf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",L?"scale(1)":"").style("fill",function(a){return Ui(a.data)}).style("opacity",1).call(Fe,function(){Si=!1}),v.exit().transition().duration(W).style("opacity",0).remove(),rj.selectAll("."+g.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(V).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&pe(a.data)?1:0}),rj.select("."+g.chartArcsTitle).style("opacity",he(Hf.data.targets)?1:0),dh&&(null!==Gf.event&&"zoom"===Gf.event.type&&kj.extent(ug.orgDomain()).update(),H&&(!mh&&yh&&fb(e,U.axisSubX,yh),kj.empty()||kj.extent(ug.orgDomain()).update(),R=Ye(_,!0),z=sj.selectAll("."+g.bars).selectAll("."+g.bar).data(se),z.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Ui),z.style("opacity",td).transition().duration(V).attr("d",R).style("opacity",1),z.exit().transition().duration(V).style("opacity",0).remove(),y=sj.selectAll("."+g.lines).selectAll("."+g.line).data(qe),y.enter().append("path").attr("class",Zc).style("stroke",Ui),y.style("opacity",td).transition().duration(V).attr("d",nj).style("opacity",1),y.exit().transition().duration(V).style("opacity",0).remove())),rj.selectAll("."+g.selectedCircles).filter(function(a){return le(a)}).selectAll("circle").remove(),rj.selectAll("."+g.selectedCircle).transition().duration(V).attr("cx",mh?Yd:Xd).attr("cy",mh?Xd:Yd),A=rj.select("."+g.eventRects),Ce(Fg)&&!oc(Fg)?(A.classed(g.eventRectsMultiple)||A.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),B=rj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),ef(B.enter()),B.attr("x",0).attr("y",0).attr("width",_f).attr("height",bg)):(A.classed(g.eventRectsSingle)||A.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Ni&&!Mi?(F=function(a,b){var c=xc(b),d=yc(b),e=Hf.data.xs[a.id][b];return(ug(d?d:e+50)-ug(c?c:e-50))/2},E=function(a,b){var c=xc(b),d=Hf.data.xs[a.id][b];return(ug(d)+ug(c?c:d-50))/2}):(F=M(),E=function(a){return ug(a.x)-F/2}),C=Ac(Hf.data.targets),rj.select("."+g.eventRects).datum(C?C.values:[]),B=rj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),df(B.enter()),B.attr("class",id).attr("x",mh?0:E).attr("y",mh?E:0).attr("width",mh?_f:F).attr("height",mh?F:bg),B.exit().remove()),Cc(Hf.data.targets).forEach(function(a){yj[a]=!0})}function mf(){lf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function nf(){return"mousemove"===Gf.event.sourceEvent.type&&oj.altDomain?(ug.domain(oj.altDomain),void oj.scale(ug).updateScaleExtent()):(Mi&&ug.orgDomain()[0]===wj[0]&&ug.domain([wj[0]-1e-10,ug.orgDomain()[1]]),lf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Gf.event.sourceEvent.type&&(Qi=!0)))}function of(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function pf(){pj.attr("width",dg).attr("height",eg),pj.select("#"+Fi).select("rect").attr("width",_f).attr("height",bg),pj.select("#"+Gi).select("rect").attr("x",C).attr("y",D).attr("width",I).attr("height",J),pj.select("#"+Hi).select("rect").attr("x",E).attr("y",F).attr("width",K).attr("height",L),pj.select("."+g.zoomRect).attr("width",_f).attr("height",bg),vj.style("max-height",eg+"px")}function qf(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,o(),S(),pf(),n(a.withTransition),lf(a)}function rf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=rj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",kd),j=i.enter().append("g").attr("class",kd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc),e=rj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",md),d=e.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",cd).style("cursor",function(a){return Wg(a)?"pointer":null}),c=rj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",ld),b=c.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",$c),b.append("g").attr("class",gd),b.append("g").attr("class",function(a){return Uc(g.selectedCircles,a.id)}),b.append("g").attr("class",ad).style("cursor",function(a){return Wg(a)?"pointer":null}),a.forEach(function(a){rj.selectAll("."+g.selectedCircles+od(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=rj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(lg(a)).attr("class",nd),f=h.enter().append("g").attr("class",nd),f.append("g").attr("class",ed),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),dh&&(n=sj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",md),m=n.enter().append("g").style("opacity",0).attr("class",md),m.append("g").attr("class",cd),l=sj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",ld),k=l.enter().append("g").style("opacity",0).attr("class",ld),k.append("g").attr("class",$c)),pj.selectAll("."+g.target).filter(function(a){return Gc(a.id)}).transition().duration(Xf).style("opacity",1)}function sf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?ce(a.id,b.types[a.id]):ce(a.id,b.type)}),Hf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=cj?j:i,l=cj?R():Q();return d&&(w=0,C=0,t=0,u=0),gh&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=cj?u:t,void(lh?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=tj.selectAll("."+g.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,cj?(f=function(a){return t*B[a]},j=function(a){return A[B[a]]+x[a]}):(f=function(a){return A[B[a]]+x[a]},j=function(a){return u*B[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=tj.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(g.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof ih?ih(a):Hf.toggle(a)}).on("mouseover",function(a){Gf.select(this).classed(g.legendItemFocused,!0),Si||Hf.focus(a),"function"==typeof jh&&jh(a)}).on("mouseout",function(a){Gf.select(this).classed(g.legendItemFocused,!1),Si||Hf.revert(),"function"==typeof kh&&kh(a)}),m.append("text").text(function(a){return d(Ig[a])?Ig[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",cj?h:-200).attr("y",cj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",cj?i:-200).attr("y",cj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",Ui).attr("x",cj?h:-200).attr("y",cj?-200:j).attr("width",10).attr("height",10),tj.selectAll("text").data(a).text(function(a){return d(Ig[a])?Ig[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),tj.selectAll("rect."+g.legendItemEvent).data(a).transition().duration(p?250:0).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}).attr("x",i).attr("y",l),tj.selectAll("rect."+g.legendItemTile).data(a).transition().duration(p?250:0).style("fill",Ui).attr("x",f).attr("y",j),tj.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=Gf.select(this);return Gc(a)?!D||b.classed(g.legendItemFocused)?vf(b):wf(b):gj}),O(t),P(u),N(C),o(),S(),pf(),n(q,c)}function Cf(a){return Ec(Hf.data.targets,a.id)}function Df(a){return"data"in a&&Ec(Hf.data.targets,a.data.id)}function Ef(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 Ff(a,b,c){var d=!ie(Hf.data.targets);Si=!1,ce(a,b),qf(c||{withTransitionForAxis:d})}var Gf=a.d3?a.d3:a.require?a.require("d3"):void 0,Hf={data:{},axis:{},legend:{}},If={},Jf=i(["bindto"],"#chart"),Kf=i(["size","width"]),Lf=i(["size","height"]),Mf=i(["padding","left"],50),Nf=i(["padding","right"],0),Of=i(["padding","top"],0),Pf=i(["padding","bottom"],0),Qf=i(["zoom","enabled"],!1),Rf=i(["zoom","extent"]),Sf=i(["zoom","privileged"],!1),Tf=i(["onenter"],function(){}),Uf=i(["onleave"],function(){}),Vf=i(["onresize"],function(){}),Wf=i(["onresized"],function(){}),Xf=i(["transition","duration"],350);h("data","data is required in config");var Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg=i(["data","x"]),Fg=i(["data","xs"],{}),Gg=i(["data","x_format"]),Hg=i(["data","id_converter"],function(a){return a}),Ig=i(["data","names"],{}),Jg=i(["data","classes"],{}),Kg=i(["data","groups"],[]),Lg=i(["data","axes"],{}),Mg=i(["data","type"]),Ng=i(["data","types"],{}),Og=i(["data","labels"],{}),Pg=i(["data","order"]),Qg=i(["data","regions"],{}),Rg=i(["data","color"]),Sg=i(["data","colors"],{}),Tg=i(["data","hide"],!1),Ug=i(["data","selection","enabled"],!1),Vg=i(["data","selection","grouped"],!1),Wg=i(["data","selection","isselectable"],function(){return!0}),Xg=i(["data","selection","multiple"],!0),Yg=i(["data","onclick"],function(){}),Zg=i(["data","onenter"],function(){}),$g=i(["data","onleave"],function(){}),_g=i(["data","onselected"],function(){}),ah=i(["data","onunselected"],function(){}),bh=i(["data","ondragstart"],function(){}),ch=i(["data","ondragend"],function(){}),dh=i(["subchart","show"],!1),eh=i(["subchart","size","height"],60),fh=i(["color","pattern"],[]),gh=i(["legend","show"],!0),hh=i(["legend","position"],"bottom"),ih=i(["legend","item","onclick"]),jh=i(["legend","item","onmouseover"]),kh=i(["legend","item","onmouseout"]),lh=i(["legend","equally"],!1),mh=i(["axis","rotated"],!1),nh=i(["axis","x","show"],!0),oh=i(["axis","x","type"],"indexed"),ph=i(["axis","x","localtime"],!0),qh=i(["axis","x","categories"],[]),rh=i(["axis","x","tick","centered"],!1),sh=i(["axis","x","tick","format"]),th=i(["axis","x","tick","culling"],{}),uh=i(["axis","x","tick","culling","max"],10),vh=i(["axis","x","tick","count"]),wh=i(["axis","x","tick","fit"],!0),xh=i(["axis","x","tick","values"],null),yh=i(["axis","x","tick","rotate"]),zh=i(["axis","x","max"],null),Ah=i(["axis","x","min"],null),Bh=i(["axis","x","padding"],{}),Ch=i(["axis","x","height"]),Dh=i(["axis","x","default"]),Eh=i(["axis","x","label"],{}),Fh=i(["axis","y","show"],!0),Gh=i(["axis","y","max"]),Hh=i(["axis","y","min"]),Ih=i(["axis","y","center"]),Jh=i(["axis","y","label"],{}),Kh=i(["axis","y","inner"],!1),Lh=i(["axis","y","tick","format"]),Mh=i(["axis","y","padding"]),Nh=i(["axis","y","ticks"],10),Oh=i(["axis","y2","show"],!1),Ph=i(["axis","y2","max"]),Qh=i(["axis","y2","min"]),Rh=i(["axis","y2","center"]),Sh=i(["axis","y2","label"],{}),Th=i(["axis","y2","inner"],!1),Uh=i(["axis","y2","tick","format"]),Vh=i(["axis","y2","padding"]),Wh=i(["axis","y2","ticks"],10),Xh=i(["grid","x","show"],!1),Yh=i(["grid","x","type"],"tick"),Zh=i(["grid","x","lines"],[]),$h=i(["grid","y","show"],!1),_h=i(["grid","y","lines"],[]),ai=i(["grid","y","ticks"],10),bi=i(["point","show"],!0),ci=i(["point","r"],2.5),di=i(["point","focus","line","enabled"],!0),ei=i(["point","focus","expand","enabled"],!0),fi=i(["point","focus","expand","r"]),gi=i(["point","focus","select","r"]),hi=i(["line","connect_null"],!1),ii=i(["bar","width"]),ji=i(["bar","width","ratio"],.6),ki=i(["pie","label","show"],!0),li=i(["pie","label","format"]),mi=i(["pie","expand"],!0),ni=i(["pie","onclick"],function(){}),oi=i(["pie","onmouseover"],function(){}),pi=i(["pie","onmouseout"],function(){}),qi=i(["donut","label","show"],!0),ri=i(["donut","label","format"]),si=i(["donut","expand"],!0),ti=i(["donut","title"],""),ui=i(["donut","onclick"],function(){}),vi=i(["donut","onmouseover"],function(){}),wi=i(["donut","onmouseout"],function(){}),xi=i(["regions"],[]),yi=i(["tooltip","show"],!0),zi=i(["tooltip","format","title"]),Ai=i(["tooltip","format","value"]),Bi=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=zi?zi:b,l=Ai?Ai:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Ci=i(["tooltip","init","show"],!1),Di=i(["tooltip","init","x"],0),Ei=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Fi=("string"==typeof Jf?Jf.replace("#",""):Jf.id)+"-clip",Gi=Fi+"-xaxis",Hi=Fi+"-yaxis",Ii=j(Fi),Ji=j(Gi),Ki=j(Hi),Li="timeseries"===oh,Mi="categorized"===oh,Ni=!Li&&(Eg||Ce(Fg)),Oi=null,Pi=!1,Qi=!1,Ri=!1,Si=!1,Ti=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ui=we(Sg,Ce(fh)?fh:Ti,Rg),Vi=ph?Gf.time.format:Gf.time.format.utc,Wi=function(){var a=[[Vi("%Y/%-m/%-d"),function(){return!0}],[Vi("%-m/%-d"),function(a){return a.getMonth()}],[Vi("%-m/%-d"),function(a){return 1!==a.getDate()}],[Vi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Vi("%I %p"),function(a){return a.getHours()}],[Vi("%I:%M"),function(a){return a.getMinutes()}],[Vi(":%S"),function(a){return a.getSeconds()}],[Vi(".%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)}}(),Xi=[],Yi=[],Zi=mh?"left":"bottom",$i=mh?Kh?"top":"bottom":Kh?"right":"left",_i=mh?Th?"bottom":"top":Th?"left":"right",aj=mh?"left":"bottom",bj={main:function(){return"translate("+(Math.ceil(Yf.left)+.5)+","+(Math.ceil(Yf.top)+.5)+")"},context:function(){return"translate("+(Math.ceil(Zf.left)+.5)+","+(Math.ceil(Zf.top)+.5)+")"},legend:function(){return"translate("+$f.left+","+$f.top+")"},x:function(){return"translate(0,"+(mh?0:bg)+")"},y:function(){return"translate(0,"+(mh?bg:0)+")"},y2:function(){return"translate("+(mh?0:_f)+","+(mh?1:0)+")"},subx:function(){return"translate(0,"+(mh?0:Math.ceil(cg))+")"},arc:function(){return"translate("+_f/2+","+bg/2+")"}},cj="right"===hh,dj=0,ej=0,fj=0,gj=.15,hj=30,ij=mh&&!nh?0:30,jj=5;lg=Gf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0) +});var kj,lj=function(){var a=Gf.svg.line().x(mh?function(a){return W(a.id)(a.value)}:Fd).y(mh?Fd:function(a){return W(a.id)(a.value)});return hi||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=hi?Oe(b.values):b.values;return je(b)?(a.interpolate(ke(b)?"cardinal":"linear"),Qg[b.id]?bf(e,ug,W(b.id),Qg[b.id]):a(e)):(c=e[0]?ug(e[0].x):0,d=e[0]?W(b.id)(e[0].value):0,mh?"M "+d+" "+c:"M "+c+" "+d)}}(),mj=function(){var a;return a=mh?Gf.svg.area().x0(function(a){return W(a.id)(0)}).x1(function(a){return W(a.id)(a.value)}).y(Fd):Gf.svg.area().x(Fd).y0(function(a){return W(a.id)(0)}).y1(function(a){return W(a.id)(a.value)}),function(b){var c,d,e=Oe(b.values);return de([b],"area")||de([b],"area-spline")?(a.interpolate(ke(b)?"cardinal":"linear"),a(e)):(c=e[0]?ug(e[0].x):0,d=e[0]?W(b.id)(e[0].value):0,mh?"M "+d+" "+c:"M "+c+" "+d)}}(),nj=function(){var a=Gf.svg.line().x(mh?function(a){return X(a.id)(a.value)}:Id).y(mh?Id:function(a){return X(a.id)(a.value)});return function(b){var c=Oe(b.values);return je(b)?a(c):"M "+xg(c[0].x)+" "+X(b.id)(c[0].value)}}(),oj=function(){};kj=Gf.svg.brush().on("brush",mf),kj.update=function(){return sj&&sj.select("."+g.brush).call(this),this},kj.scale=function(a){return mh?this.y(a):this.x(a)},Qf&&(oj=Gf.behavior.zoom().on("zoomstart",function(){oj.altDomain=Gf.event.sourceEvent.altKey?ug.orgDomain():null}).on("zoom",Qf?nf:null),oj.scale=function(a){return mh?this.y(a):this.x(a)},oj.orgScaleExtent=function(){var a=Rf?Rf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},oj.updateScaleExtent=function(){var a=ac(ug.orgDomain())/ac(wj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var pj,qj,rj,sj,tj,uj,vj,wj,xj,yj={};if(Hf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=pj.selectAll(pd(a)),d=c.filter(Cf),e=c.filter(Df);Hf.revert(),Hf.defocus(),b(d.classed(g.focused,!0)),b(e),ie(Hf.data.targets)&&Nb(a,!0),xf(a,!0)},Hf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=pj.selectAll(pd(a)),d=c.filter(Cf),e=c.filter(Df);Hf.revert(),b(d.classed(g.focused,!1)),b(e),ie(Hf.data.targets)&&Ob(a),xf(a,!1)},Hf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=pj.selectAll(pd(a)),d=c.filter(Cf),e=c.filter(Df);b(d.classed(g.focused,!1)),b(e),ie(Hf.data.targets)&&Ob(a),yf()},Hf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),pj.selectAll(qd(a)).transition().style("opacity",1),b.withLegend&&zf(a),lf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Hf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),pj.selectAll(qd(a)).transition().style("opacity",0),b.withLegend&&Af(a),lf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Hf.toggle=function(a){Gc(a)?Hf.hide(a):Hf.show(a)},Hf.unzoom=function(){kj.clear().update(),lf({withUpdateXDomain:!0})},Hf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Jg[b]=a.classes[b]}),"categories"in a&&Mi&&(qh=a.categories,Ag.categories(qh)),"cacheIds"in a&&bc(a.cacheIds)?void sf(dc(a.cacheIds),a.done):void("unload"in a?uf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){tf(a)}):tf(a))},Hf.unload=function(a,b){uf(Dc(a),function(){lf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Hf.selected=function(a){return Gf.merge(rj.selectAll("."+g.shapes+od(a)).selectAll("."+g.shape).filter(function(){return Gf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Hf.select=function(a,b,c){Ug&&rj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Gf.select(this),i=e.data?e.data.id:e.id,j=Ne(this),k=Vg||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);k&&l?Wg(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f)})},Hf.unselect=function(a,b){Ug&&rj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Gf.select(this),f=c.data?c.data.id:c.id,h=Ne(this),i=Vg||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);i&&j&&Wg(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Hf.toLine=function(a){Ff(a,"line")},Hf.toSpline=function(a){Ff(a,"spline")},Hf.toBar=function(a){Ff(a,"bar")},Hf.toScatter=function(a){Ff(a,"scatter")},Hf.toArea=function(a){Ff(a,"area")},Hf.toAreaSpline=function(a){Ff(a,"area-spline")},Hf.toPie=function(a){Ff(a,"pie",{withTransform:!0})},Hf.toDonut=function(a){Ff(a,"donut",{withTransform:!0})},Hf.groups=function(a){return c(a)?Kg:(Kg=a,lf(),Kg)},Hf.xgrids=function(a){return a?(Zh=a,lf(),Zh):Zh},Hf.xgrids.add=function(a){return a?Hf.xgrids(Zh.concat(a)):void 0},Hf.xgrids.remove=function(a){var b=Ef(a);return Hf.xgrids(Zh.filter(b))},Hf.ygrids=function(a){return a?(_h=a,lf(),_h):_h},Hf.ygrids.add=function(a){return a?Hf.ygrids(_h.concat(a)):void 0},Hf.ygrids.remove=function(a){var b=Ef(a);return Hf.ygrids(_h.filter(b))},Hf.regions=function(a){return c(a)?xi:(xi=a,lf(),xi)},Hf.regions.add=function(a){return c(a)?xi:(xi=xi.concat(a),lf(),xi)},Hf.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;pj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),xi=xi.filter(function(b){return b.classes.indexOf(a)<0})}),xi},Hf.data.get=function(a){var b=Hf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Hf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},Hf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Ig[b]=a[b]}),lf({withLegend:!0}),Ig):Ig},Hf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Sg[b]=a[b]}),lf({withLegend:!0}),Sg):Sg},Hf.x=function(a){return arguments.length&&(qc(Hf.data.targets,a),lf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Hf.data.xs},Hf.xs=function(a){return arguments.length&&(rc(Hf.data.targets,a),lf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Hf.data.xs},Hf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){cb(b,a[b])}),Eb())},Hf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(zh=+a.x),b(a.y)&&(Gh=+a.y),b(a.y2)&&(Ph=+a.y2)):Gh=Ph=+a,lf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Hf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Ah=+a.x),b(a.y)&&(Hh=+a.y),b(a.y2)&&(Qh=+a.y2)):Hh=Qh=+a,lf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Hf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Hf.axis.max(a.max),"undefined"!=typeof a.min&&Hf.axis.min(a.min))},Hf.legend.show=function(a){zf(Dc(a)),lf({withLegend:!0})},Hf.legend.hide=function(a){Af(Dc(a)),lf({withLegend:!0})},Hf.resize=function(a){Kf=a?a.width:null,Lf=a?a.height:null,qf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Hf.destroy=function(){Hf.data.targets=void 0,Hf.data.xs={},vj.html(""),a.onresize=null},"url"in f.data)Gf.xhr(f.data.url,function(a,b){var c,d=Gf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Gf.csv.parse(b.response),cf(c)});else if("rows"in f.data)cf(tc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");cf(uc(f.data.columns))}return Hf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(window); \ No newline at end of file From f1068b332d1cbd987234f2a198c16f24043a1bc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Go=CC=88bel?= Date: Mon, 5 May 2014 16:08:51 +0200 Subject: [PATCH 135/178] fixed mixed spaces & tabs --- c3.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/c3.js b/c3.js index b5442ab..ab48cf3 100644 --- a/c3.js +++ b/c3.js @@ -337,13 +337,13 @@ var translate = { - main : function () { return "translate(" + (Math.ceil(margin.left) + 0.5) + "," + (Math.ceil(margin.top) + 0.5) + ")"; }, - context : function () { return "translate(" + (Math.ceil(margin2.left) + 0.5) + "," + (Math.ceil(margin2.top) + 0.5) + ")"; }, + main : function () { return "translate(" + (Math.ceil(margin.left) + 0.5) + "," + (Math.ceil(margin.top) + 0.5) + ")"; }, + context : function () { return "translate(" + (Math.ceil(margin2.left) + 0.5) + "," + (Math.ceil(margin2.top) + 0.5) + ")"; }, legend : function () { return "translate(" + margin3.left + "," + margin3.top + ")"; }, x : function () { return "translate(0," + (__axis_rotated ? 0 : height) + ")"; }, y : function () { return "translate(0," + (__axis_rotated ? height : 0) + ")"; }, y2 : function () { return "translate(" + (__axis_rotated ? 0 : width) + "," + (__axis_rotated ? 1 : 0) + ")"; }, - subx : function () { return "translate(0," + (__axis_rotated ? 0 : Math.ceil(height2)) + ")"; }, + subx : function () { return "translate(0," + (__axis_rotated ? 0 : Math.ceil(height2)) + ")"; }, arc: function () { return "translate(" + width / 2 + "," + height / 2 + ")"; } }; From 7f1812809be3a8ec642429c8fa84c387c402236c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Go=CC=88bel?= Date: Mon, 5 May 2014 16:09:22 +0200 Subject: [PATCH 136/178] removed linebreak --- c3.js | 1 - 1 file changed, 1 deletion(-) diff --git a/c3.js b/c3.js index ab48cf3..9a9e7b4 100644 --- a/c3.js +++ b/c3.js @@ -336,7 +336,6 @@ subXOrient = __axis_rotated ? "left" : "bottom"; var translate = { - main : function () { return "translate(" + (Math.ceil(margin.left) + 0.5) + "," + (Math.ceil(margin.top) + 0.5) + ")"; }, context : function () { return "translate(" + (Math.ceil(margin2.left) + 0.5) + "," + (Math.ceil(margin2.top) + 0.5) + ")"; }, legend : function () { return "translate(" + margin3.left + "," + margin3.top + ")"; }, From b556645bfc4d10ffc573cb7c1b39d0d0c90dfde5 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Mon, 5 May 2014 23:29:48 +0900 Subject: [PATCH 137/178] Fix axis z-index --- c3.js | 68 +++++++++++++++++++++++++++++------------------------------ 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/c3.js b/c3.js index 3fe59eb..d5e372c 100644 --- a/c3.js +++ b/c3.js @@ -2522,40 +2522,6 @@ grid.append('g').attr('class', CLASS.ygridLines); } - // Add Axis - if (__axis_x_show) { - main.append("g") - .attr("class", CLASS.axisX) - .attr("clip-path", clipPathForXAxis) - .attr("transform", translate.x) - .append("text") - .attr("class", CLASS.axisXLabel) - .attr("transform", __axis_rotated ? "rotate(-90)" : "") - .style("text-anchor", textAnchorForXAxisLabel); - } - - if (__axis_y_show) { - main.append("g") - .attr("class", CLASS.axisY) - .attr("clip-path", clipPathForYAxis) - .attr("transform", translate.y) - .append("text") - .attr("class", CLASS.axisYLabel) - .attr("transform", __axis_rotated ? "" : "rotate(-90)") - .style("text-anchor", textAnchorForYAxisLabel); - } - - if (__axis_y2_show) { - main.append("g") - .attr("class", CLASS.axisY2) - // clip-path? - .attr("transform", translate.y2) - .append("text") - .attr("class", CLASS.axisY2Label) - .attr("transform", __axis_rotated ? "" : "rotate(-90)") - .style("text-anchor", textAnchorForY2AxisLabel); - } - // Regions main.append('g') .attr("clip-path", clipPath) @@ -2608,6 +2574,40 @@ brush.extent(typeof __axis_x_default !== 'function' ? __axis_x_default : __axis_x_default(getXDomain())); } + // Add Axis + if (__axis_x_show) { + main.append("g") + .attr("class", CLASS.axisX) + .attr("clip-path", clipPathForXAxis) + .attr("transform", translate.x) + .append("text") + .attr("class", CLASS.axisXLabel) + .attr("transform", __axis_rotated ? "rotate(-90)" : "") + .style("text-anchor", textAnchorForXAxisLabel); + } + + if (__axis_y_show) { + main.append("g") + .attr("class", CLASS.axisY) + .attr("clip-path", clipPathForYAxis) + .attr("transform", translate.y) + .append("text") + .attr("class", CLASS.axisYLabel) + .attr("transform", __axis_rotated ? "" : "rotate(-90)") + .style("text-anchor", textAnchorForYAxisLabel); + } + + if (__axis_y2_show) { + main.append("g") + .attr("class", CLASS.axisY2) + // clip-path? + .attr("transform", translate.y2) + .append("text") + .attr("class", CLASS.axisY2Label) + .attr("transform", __axis_rotated ? "" : "rotate(-90)") + .style("text-anchor", textAnchorForY2AxisLabel); + } + /*-- Context Region --*/ // Define g for chart area From 27038291c6a539a7b8cd0f053180677531744602 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Tue, 6 May 2014 10:19:42 +0900 Subject: [PATCH 138/178] Fix grids --- c3.js | 3 +-- c3.min.js | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/c3.js b/c3.js index d5e372c..a488075 100644 --- a/c3.js +++ b/c3.js @@ -3110,8 +3110,6 @@ } } - tickOffset = xAxis.tickOffset(); - // rotate tick text if needed if (!__axis_rotated && __axis_x_tick_rotate) { rotateTickText(xaxis, transitions.axisX, __axis_x_tick_rotate); @@ -3136,6 +3134,7 @@ main.select('line.' + CLASS.xgridFocus).style("visibility", "hidden"); if (__grid_x_show) { xgridData = generateGridData(__grid_x_type, x); + tickOffset = isCategorized ? xAxis.tickOffset() : 0; xgridAttr = __axis_rotated ? { 'x1': 0, 'x2': width, diff --git a/c3.min.js b/c3.min.js index 0307c5d..0f572a9 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ !function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.ceil(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.ceil(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&a_f&&(_f=0),0>bg&&(bg=0),ag=mh?Yf.left-hj-ij:_f,cg=mh?bg:eg-Zf.top-Zf.bottom,0>ag&&(ag=0),0>cg&&(cg=0),q(),cj&&ie(Hf.data.targets)&&($f.left=_f/2+gg)}function p(){rj.select("line."+g.xgridFocus).attr("x1",mh?0:-10).attr("x2",mh?_f:-10).attr("y1",mh?-10:Yf.top).attr("y2",mh?-10:bg)}function q(){gg=bg/2,fg=.95*gg,hg=he(Hf.data.targets)?.6*fg:0}function r(){var a=mh?g.axisX:g.axisY,b=rj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Gf.select(Jf).node().getBoundingClientRect(),e=c.right-d.left-u();return e>0?e:0}function s(){return Kf?Kf:y()}function t(){var a=Lf?Lf:z();return a>0?a:320}function u(){return ie(Hf.data.targets)?0:Mf?Mf:mh?nh?w("x"):1:!Fh||Kh?1:w("y")}function v(){var a=1;return ie(Hf.data.targets)?0:Nf?Nf:cj?Q()+20+(Oh&&!mh?w("y2"):a):Oh?Th||mh?a:w("y2"):a}function w(a){var b=kb(a);return b.isInner?20+Db(a):40+Db(a)}function x(a){return"x"!==a||nh?"x"===a&&Ch?Ch:"y"!==a||Fh?"y2"!==a||Oh?(kb(a).isInner?30:40)+("y2"===a?-10:0):jj:gh&&!cj?10:1:0}function y(){return+Gf.select(Jf).style("width").replace("px","")}function z(){return+Gf.select(Jf).style("height").replace("px","")}function A(a){return a?-5:-(Yf.left-1)}function B(a){return a?-20:-4}function C(){return A(!mh)}function D(){return B(!mh)}function E(){return A(mh)}function F(){return B(mh)}function G(a){return a?_f+2+4:Yf.left+20}function H(a){return a?(Ch?Ch:0)+80:bg+8}function I(){return G(!mh)}function J(){return H(!mh)}function K(){return G(mh)}function L(){return H(mh)}function M(){var a,b,c,d,e,f=Ac(Hf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ug(b.x)-ug(a.x),0===c?mh?bg:_f:(d=zc(),e=ee(Hf.data.targets)?(d-(Mi?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function N(a){dj=a}function O(a){ej=a}function P(a){fj=a}function Q(){return gh?cj?ej*(dj+1):dg:0}function R(){return gh?cj?eg:fj*(dj+1):0}function S(){var a,b,c=!ug;mg=mh?1:0,ng=mh?bg:_f,og=mh?0:bg,pg=mh?_f:1,qg=mg,rg=ng,sg=mh?0:cg,tg=mh?ag:1,ug=U(mg,ng,c?void 0:ug.domain(),function(){return Ag.tickOffset()}),vg=V(og,pg,c?void 0:vg.domain()),wg=V(og,pg,c?void 0:wg.domain()),xg=U(mg,ng,wj,function(a){return a%1?0:Dg.tickOffset()}),yg=V(sg,tg,c?void 0:yg.domain()),zg=V(sg,tg,c?void 0:zg.domain()),a=_(),b=xh?xh:c?void 0:Ag.tickValues(),Ag=Y(ug,Zi,a,b),Dg=Y(xg,aj,a,b),Bg=Z(vg,$i,Lh,Nh),Cg=Z(wg,_i,Uh,Wh),c||(kj.scale(xg),Qf&&oj.scale(ug)),T()}function T(){ig=Gb(),jg=Hb(),kg=Hb(.98)}function U(a,b,c,d){var e,f=(Li?Gf.time.scale():Gf.scale.linear()).range([a,b]),g=c?f.domain(c):f;Mi?(d=d||function(){return 0},f=function(a){return Math.ceil(g(a)+d(a))}):f=function(a){return Math.ceil(g(a))};for(e in g)f[e]=g[e];return f.orgDomain=function(){return g.domain()},Mi&&(f.domain=function(a){return arguments.length?(g.domain(a),f):(a=g.domain(),[a[0],a[1]+1])}),f}function V(a,b,c){var d=Gf.scale.linear().range([a,b]);return c&&d.domain(c),d}function W(a){return"y2"===$(a)?wg:vg}function X(a){return"y2"===$(a)?zg:yg}function Y(a,b,c,d){var f=e(Gf,Mi).scale(a).orient(b);return f.tickFormat(c).tickValues(d),Mi?(f.tickCentered(rh),Be(th)&&(th=!1),f.categories(qh)):f.tickOffset=function(){var a=Bc(Hf.data.targets),b=ug(a[1])-ug(a[0]),c=b?b:mh?bg:_f;return c/zc()/2},f}function Z(a,b,c,d){return e(Gf).scale(a).orient(b).tickFormat(c).ticks(d)}function $(a){return a in Lg?Lg[a]:"y"}function _(){var a=Li?Wi:Mi?Tc:function(a){return 0>a?a.toFixed(0):a};return sh&&("function"==typeof sh?a=sh:Li&&(a=function(a){return a?Vi(sh)(a):""})),a}function ab(a){var b;return"y"===a?b=Jh:"y2"===a?b=Sh:"x"===a&&(b=Eh),b}function bb(a){var b=ab(a);return"string"==typeof b?b:b?b.text:null}function cb(a,b){var c=ab(a);"string"==typeof c?"y"===a?Jh=b:"y2"===a?Sh=b:"x"===a&&(Eh=b):c&&(c.text=b)}function db(a){return 10*Math.sin(Math.PI*(a/180))}function eb(a){return 11.5-2.5*(a/15)}function fb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",eb(c)).attr("x",db(c)).attr("transform","rotate("+c+")")}function gb(a,b){var c=ab(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 hb(){return gb("x",mh?"inner-top":"inner-right")}function ib(){return gb("y",mh?"inner-right":"inner-top")}function jb(){return gb("y2",mh?"inner-right":"inner-top")}function kb(a){return"y2"===a?jb():"y"===a?ib():hb()}function lb(){return bb("x")}function mb(){return bb("y")}function nb(){return bb("y2")}function ob(a,b){return a?b.isLeft?0:b.isCenter?_f/2:_f:b.isBottom?-bg:b.isMiddle?-bg/2:0}function pb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function qb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function rb(){return ob(!mh,hb())}function sb(){return ob(mh,ib())}function tb(){return ob(mh,jb())}function ub(){return pb(!mh,hb())}function vb(){return pb(mh,ib())}function wb(){return pb(mh,jb())}function xb(){var a=hb();return mh?a.isInner?"1.2em":-25-Db("x"):a.isInner?"-0.5em":Ch?Ch-10:"3em"}function yb(){var a=ib();return mh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Db("y")}function zb(){var a=jb();return mh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Db("y2")}function Ab(){return qb(!mh,hb())}function Bb(){return qb(mh,ib())}function Cb(){return qb(mh,jb())}function Db(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Gf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Eb(a){var b=rj.select("."+g.axisX+" ."+g.axisXLabel),c=rj.select("."+g.axisY+" ."+g.axisYLabel),d=rj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",rb).attr("dx",ub).attr("dy",xb).text(lb),(a?c.transition():c).attr("x",sb).attr("dx",vb).attr("dy",yb).attr("dy",yb).text(mb),(a?d.transition():d).attr("x",tb).attr("dx",wb).attr("dy",zb).text(nb)}function Fb(a){var b=!1;return lg(Ic(Hf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Gb(){var a=Gf.svg.arc().outerRadius(fg).innerRadius(hg),b=function(b,c){var d;return c?a(b):(d=Fb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Hb(a){var b=Gf.svg.arc().outerRadius(gg*(a?a:1)).innerRadius(hg);return function(a){var c=Fb(a);return c?b(c):"M 0 0"}}function Ib(a,b){return pe(a.data)?ig(a,b):"M 0 0"}function Jb(a){var b,c,d,e,f=Fb(a),g="";return f&&(b=ig.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*fg*.8+","+d/e*fg*.8+")"),g}function Kb(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Lb(a){return pc({id:a.data.id,value:a.value,ratio:Kb(a)})}function Mb(a){var b,c,d,e;return Pb()?(b=Fb(a),c=b?b.value:null,d=Kb(b),e=Qb(),e?e(c,d):Dd(c,d)):""}function Nb(a,b){var c=pj.selectAll("."+g.chartArc+pd(a)),d=pj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});ve(a)&&c.selectAll("path").transition().duration(50).attr("d",jg).transition().duration(100).attr("d",kg).each(function(a){oe(a.data)}),b||d.style("opacity",.3)}function Ob(a){var b=pj.selectAll("."+g.chartArc+pd(a));b.selectAll("path").transition().duration(50).attr("d",ig),pj.selectAll("."+g.arc).style("opacity",1)}function Pb(){return he(Hf.data.targets)?qi:ki}function Qb(){return he(Hf.data.targets)?ri:li}function Rb(){return he(Hf.data.targets)?ti:""}function Sb(){var a=he(Hf.data.targets)?ui:ni;return"function"==typeof a?a:function(){}}function Tb(){var a=he(Hf.data.targets)?vi:oi;return"function"==typeof a?a:function(){}}function Ub(){var a=he(Hf.data.targets)?wi:pi;return"function"==typeof a?a:function(){}}function Vb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(Kg.length>0)for(g=Rc(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 Gf.min(Object.keys(i).map(function(a){return Gf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(Kg.length>0)for(g=Sc(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 Gf.max(Object.keys(i).map(function(a){return Gf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return $(a.id)===c}),m="y2"===c?Qh:Hh,n="y2"===c?Ph:Gh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Rh:Ih,r=xd()&&mh;return 0===l.length?"y2"===c?wg.domain():vg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=yd(o,p),j=ac(vg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Mh&&(f=b(Mh.top)?Mh.top:e,g=b(Mh.bottom)?Mh.bottom:e),"y2"===c&&Vh&&(f=b(Vh.top)?Vh.top:e,g=b(Vh.bottom)?Vh.bottom:e),ee(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return Ah?Li?xe(Ah):Ah:Gf.min(a,function(a){return Gf.min(a.values,function(a){return a.x})})}function Zb(a){return zh?Li?xe(zh):zh:Gf.max(a,function(a){return Gf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Mi?d=0:ee(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Bh&&Ce(Bh)?(e=b(Bh.left)?Bh.left:d,f=b(Bh.right)?Bh.right:d):e=f="number"==typeof Bh?Bh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return c-d!==0||Mi||(c=Li?new Date(.5*c.getTime()):-.5,d=Li?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Li?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Li?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?vg:wg;return b="y"===a.axis||"y2"===a.axis?mh?bg:"start"in a?d(a.start):bg:mh?"end"in a?ug(Li?xe(a.end):a.end):bg:bg,c>b?0:b-c}function ic(a){return Eg&&a===Eg||Ce(Fg)&&De(Fg,a)}function jc(a){return!ic(a)}function kc(a){return Eg?Eg:Ce(Fg)?Fg[a]:null}function lc(a,b){var c,d=b&&Ce(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=Hf.data.xs[b])}),c}function mc(a,b){return a in Hf.data.xs&&Hf.data.xs[a]&&Hf.data.xs[a][b]?Hf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){Fg[b]=a[b]})}function oc(a){return 1===Gf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=Ig[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),Hf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=Li?a?a instanceof Date?a:xe(a):xe(mc(c,d)):Ni&&!Mi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Hf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Eg?(d=Object.keys(Hf.data.xs),Hf.data.xs[c]=d.length>0?Hf.data.xs[d[0]]:void 0):Ce(Fg)&&(Hf.data.xs[c]=lc(f,Hf.data.targets)):Hf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Hf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Hg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ni&&Mi&&0===c&&g&&(0===e&&(qh=[]),qh.push(g)),("undefined"==typeof a[b]||Hf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Mg&&ce(Cc(c).filter(function(a){return!(a in Ng)}),Mg),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&Hf.data.targets[0].values[a-1]?Hf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(Hf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Li?new Date(i):i);j.push(e)}return Li||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Xi=Xi.concat(a)}function Mc(a){Xi=Xi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Yi=Yi.concat(a)}function Oc(a){Yi=Yi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Jd(a,f))),(a[g].x||0===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=Ee(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Nd(a,b){return Gf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Od(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 Pd(){return Pg&&"desc"===Pg.toLowerCase()}function Qd(){return Pg&&"asc"===Pg.toLowerCase()}function Rd(a){var b=Qd(),c=Pd();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 Pg&&a.sort(Pg),a}function Sd(a,c){var d,e,f,g,h,i,j,k=ie(Hf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&yi&&(uj.html(Bi(a,_(),zd(k),Ui)).style("display","block"),d=uj.property("offsetWidth"),e=uj.property("offsetHeight"),k?(g=_f/2+c[0],i=bg/2+c[1]+20):(mh?(f=r(),g=f+c[0]+100,h=g+d,j=s()-v(),i=ug(l[0].x)+20):(f=r(),g=f+u()+ug(l[0].x)+20,h=g+d,j=f+s()-v(),i=c[1]+15),h>j&&(g-=d+60),i+e>t()&&(i-=e+30)),uj.style("top",i+"px").style("left",g+"px"))}function Td(){uj.style("display","none")}function Ud(a){var c=a.filter(function(a){return a&&b(a.value)});if(yi&&!fe(Hf.data.targets)&&!ie(Hf.data.targets)){var d=rj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(mh?"y1":"x1",Fd).attr(mh?"y2":"x2",Fd),kf(d,"grid")}}function Vd(){rj.select("line."+g.xgridFocus).style("visibility","hidden")}function Wd(a,b){var c,d,e,f,g=[];if("year"===a)for(c=_b(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)g.push(new Date(f+"-01-01 00:00:00"));else g=b.ticks(10);return g}function Xd(a){return a.x||0===a.x?ug(a.x):null}function Yd(a){return W(a.id)(a.value)}function Zd(){var a,b,d={},e=0;return Ic(Fc(le)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function be(a,b){return"number"==typeof ii?ii:b?2*a.tickOffset()*ji/b:0}function ce(a,b){Dc(a).forEach(function(a){yj[a]=b===Ng[a],Ng[a]=b})}function de(a,b){var c=!1;return a.forEach(function(a){Ng[a.id]===b&&(c=!0),a.id in Ng||"line"!==b||(c=!0)}),c}function ee(a){return de(a,"bar")}function fe(a){return de(a,"scatter")}function ge(a){return de(a,"pie")}function he(a){return de(a,"donut")}function ie(a){return ge(a)||he(a)}function je(a){var b="string"==typeof a?a:a.id;return!(b in Ng)||"line"===Ng[b]||"spline"===Ng[b]||"area"===Ng[b]||"area-spline"===Ng[b]}function ke(a){var b="string"==typeof a?a:a.id;return"spline"===Ng[b]||"area-spline"===Ng[b]}function le(a){var b="string"==typeof a?a:a.id;return"bar"===Ng[b]}function me(a){var b="string"==typeof a?a:a.id;return"scatter"===Ng[b]}function ne(a){var b="string"==typeof a?a:a.id;return"pie"===Ng[b]}function oe(a){var b="string"==typeof a?a:a.id;return"donut"===Ng[b]}function pe(a){return ne(a)||oe(a)}function qe(a){return je(a)?[a]:[]}function re(a){return pe(a.data)?[a]:[]}function se(a){return le(a)?a.values:[]}function te(a){return je(a)||me(a)?a.values:[]}function ue(a){return le(a)||je(a)?a.values:[]}function ve(a){return oe(a)&&si||ne(a)&&mi}function we(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function xe(b){var c;try{c=Gg?Gf.time.format(Gg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Gg)}return c}function ye(a,b){var c=Gf.mouse(a),d=Gf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function De(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Ee(a,b){var c="y"===$(a.id)?vg:wg,d=mh?1:0,e=mh?0:1;return Math.pow(ug(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Fe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ge(a,b,c){_g(b,a.node()),rj.select("."+g.selectedCircles+od(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(g.selectedCircle,c)}).attr("cx",mh?Yd:Xd).attr("cy",mh?Xd:Yd).attr("stroke",function(){return Ui(b)}).attr("r",1.4*Re(b)).transition().duration(100).attr("r",Re)}function He(a,b,c){ah(b,a.node()),rj.select("."+g.selectedCircles+od(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ie(a,b,c,d){a?Ge(b,c,d):He(b,c,d)}function Je(a,b){_g(b,a.node()),a.transition().duration(100).style("fill",function(){return Gf.rgb(Ui(b)).brighter(.75)})}function Ke(a,b){ah(b,a.node()),a.transition().duration(100).style("fill",function(){return Ui(b)})}function Le(a,b,c,d){a?Je(b,c,d):Ke(b,c,d)}function Me(a,b,c,d){Le(a,b,c.data,d)}function Ne(a){return"circle"===a.nodeName?Ie:Gf.select(a).classed(g.bar)?Le:Me}function Oe(a){return a.filter(function(a){return b(a.value)})}function Pe(a){return bi?"function"==typeof ci?ci(a):ci:0}function Qe(a){return ei?fi?fi:1.75*Pe(a):Pe(a)}function Re(a){return gi?gi:4*Pe(a)}function Se(a,c){return(c?rj.selectAll("."+g.circles+od(c)):rj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Te(a,b){Se(a,b).classed(g.EXPANDED,!0).attr("r",Qe)}function Ue(a){Se(a).filter(function(){return Gf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Pe)}function Ve(a){return rj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function We(a){Ve(a).classed(g.EXPANDED,!0)}function Xe(a){Ve(a).classed(g.EXPANDED,!1)}function Ye(a,b){var c=af(a,b);return function(a,b){var d=c(a,b),e=mh?1:0,f=mh?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 Ze(a,b){var c=af(a,!1),d=b?$e:_e;return function(a,b){return d(c(a,b),a,this)}}function $e(a,b){var c;return mh?(c=le(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function _e(a,b,c){var d=c.getBoundingClientRect();return mh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:le(b)?-3:-6)}function af(a,b){var c=a.__max__+1,d=be(Ag,c),e=$d(d,c,a,!!b),f=_d(!!b),g=ae(a,!!b),h=b?X:W;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return mh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function bf(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 cf(b){var c,d,e;if(vj=Gf.select(Jf),vj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(vj.html("").classed("c3",!0),Hf.data.xs={},Hf.data.targets=vc(b),Tg&&Lc(Tg===!0?Cc(Hf.data.targets):Tg),o(),S(),ug.domain(Gf.extent(_b(Hf.data.targets))),vg.domain(Xb(Hf.data.targets,"y")),wg.domain(Xb(Hf.data.targets,"y2")),xg.domain(ug.domain()),yg.domain(vg.domain()),zg.domain(wg.domain()),wj=ug.domain(),kj.scale(xg),Qf&&oj.scale(ug),pj=vj.append("svg").on("mouseenter",Tf).on("mouseleave",Uf),qj=pj.append("defs"),qj.append("clipPath").attr("id",Fi).append("rect"),qj.append("clipPath").attr("id",Gi).append("rect"),qj.append("clipPath").attr("id",Hi).append("rect"),pf(),rj=pj.append("g").attr("transform",bj.main),sj=pj.append("g").attr("transform",bj.context),tj=pj.append("g").attr("transform",bj.legend),dh||sj.style("visibility","hidden"),gh||(tj.style("visibility","hidden"),Yi=Cc(Hf.data.targets)),uj=Gf.select(Jf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Bf(Cc(Hf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=rj.append("g").attr("clip-path",Ii).attr("class",g.grid),Xh&&d.append("g").attr("class",g.xgrids),Ce(Zh)&&d.append("g").attr("class",g.xgridLines),di&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),$h&&d.append("g").attr("class",g.ygrids),Ce(_h)&&d.append("g").attr("class",g.ygridLines),nh&&rj.append("g").attr("class",g.axisX).attr("clip-path",Ji).attr("transform",bj.x).append("text").attr("class",g.axisXLabel).attr("transform",mh?"rotate(-90)":"").style("text-anchor",Ab),Fh&&rj.append("g").attr("class",g.axisY).attr("clip-path",Ki).attr("transform",bj.y).append("text").attr("class",g.axisYLabel).attr("transform",mh?"":"rotate(-90)").style("text-anchor",Bb),Oh&&rj.append("g").attr("class",g.axisY2).attr("transform",bj.y2).append("text").attr("class",g.axisY2Label).attr("transform",mh?"":"rotate(-90)").style("text-anchor",Cb),rj.append("g").attr("clip-path",Ii).attr("class",g.regions),rj.append("g").attr("clip-path",Ii).attr("class",g.chart),c=rj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Qf?mh?"ns-resize":"ew-resize":null),rj.select("."+g.chart).append("g").attr("class",g.chartBars),rj.select("."+g.chart).append("g").attr("class",g.chartLines),rj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",bj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Rb()),rj.select("."+g.chart).append("g").attr("class",g.chartTexts),Qf&&rj.insert("rect",Sf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",_f).attr("height",bg).style("opacity",0).style("cursor",mh?"ns-resize":"ew-resize").call(oj).on("dblclick.zoom",null),Dh&&kj.extent("function"!=typeof Dh?Dh:Dh(_b())),sj.append("g").attr("clip-path",Ii).attr("class",g.chart),sj.select("."+g.chart).append("g").attr("class",g.chartBars),sj.select("."+g.chart).append("g").attr("class",g.chartLines),sj.append("g").attr("clip-path",Ii).attr("class",g.brush).call(kj).selectAll("rect").attr(mh?"width":"height",mh?ag:cg),sj.append("g").attr("class",g.axisX).attr("transform",bj.subx).attr("clip-path",mh?"":Ji),rf(Hf.data.targets),mh?rj.select("."+g.axisX).style("opacity",0).call(Ag):(rj.select("."+g.axisY).style("opacity",0).call(Bg),rj.select("."+g.axisY2).style("opacity",0).call(Cg)),o(),S(),pf(),n(!1),lf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Ci){if(Li&&"string"==typeof Di){for(Di=xe(Di),e=0;e0){d=[];for(var f in Ig)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Od(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Le,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function hf(a){ie(Hf.data.targets)||Ug&&(Oi=a,rj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Pi=!0,bh())}function jf(){ie(Hf.data.targets)||Ug&&(rj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),rj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Pi=!1,ch())}function kf(a,b){"grid"===b&&a.each(function(){var a=Gf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function lf(a){var c,e,f,h,i,j,k,l,m,n,o,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,$,_=Zd(),ab=ie(Hf.data.targets),bb=Ic(Hf.data.targets);if(a=d(a)?a:{},G=d(a.withY)?a.withY:!0,H=d(a.withSubchart)?a.withSubchart:!0,I=d(a.withTransition)?a.withTransition:!0,L=d(a.withTransform)?a.withTransform:!1,N=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,O=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,P=d(a.withLegend)?a.withLegend:!1,J=d(a.withTransitionForExit)?a.withTransitionForExit:I,K=d(a.withTransitionForAxis)?a.withTransitionForAxis:I,V=I?Xf:0,W=J?V:0,X=K?V:0,c=rj.select("."+g.axisX).style("opacity",ab?0:1),f=rj.select("."+g.axisY).style("opacity",ab?0:1),h=rj.select("."+g.axisY2).style("opacity",ab?0:1),e=sj.select("."+g.axisX).style("opacity",ab?0:1),U={axisX:c.transition().duration(X),axisY:f.transition().duration(X),axisY2:h.transition().duration(X),axisSubX:e.transition().duration(X)},P&&gh&&Bf(Cc(Hf.data.targets),a,U),Mi&&(0!==bb.length&&O&&N||ug.domain([0,c.selectAll(".tick").size()])),bb.length&&(O&&(ug.domain(Gf.extent(_b(bb))),wj=ug.domain(),Qf&&oj.scale(ug).updateScaleExtent(),xg.domain(ug.domain()),kj.scale(xg)),N&&(ug.domain(kj.empty()?wj:kj.extent()),Qf&&oj.scale(ug).updateScaleExtent()),xh||!wh&&!vh||(Y=Kc(Jc(bb),vh),Ag.tickValues(Y),Dg.tickValues(Y))),vg.domain(Xb(bb,"y")),wg.domain(Xb(bb,"y2")),U.axisX.call(Ag),U.axisY.call(Bg),U.axisY2.call(Cg),U.axisSubX.call(Dg),Eb(I),N&&bb.length)if(th&&Y){for(Z=1;Z=0&&Gf.select(this).style("display",b%$?"none":"block")})}else pj.selectAll("."+g.axisX+" .tick text").style("display","block");D=Ag.tickOffset(),!mh&&yh&&fb(c,U.axisX,yh),Q=Ye(_),S=Ze(_,!0),T=Ze(_,!1),yg.domain(vg.domain()),zg.domain(wg.domain()),uj.style("display","none"),p(),rj.select("line."+g.xgridFocus).style("visibility","hidden"),Xh&&(k=Wd(Yh,ug),j=mh?{x1:0,x2:_f,y1:function(a){return ug(a)-D},y2:function(a){return ug(a)-D}}:{x1:function(a){return ug(a)+D},x2:function(a){return ug(a)+D},y1:Yf.top,y2:bg},i=rj.select("."+g.xgrids).selectAll("."+g.xgrid).data(k),i.enter().append("line").attr("class",g.xgrid),i.attr(j).style("opacity",function(){return+Gf.select(this).attr(mh?"y1":"x1")===(mh?bg:0)?0:1}),i.exit().remove()),Ce(Zh)&&(l=rj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(Zh),m=l.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",mh?"":"rotate(-90)").attr("dx",mh?0:-Yf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(V).attr("x1",mh?0:Gd).attr("x2",mh?_f:Gd).attr("y1",mh?Gd:Yf.top).attr("y2",mh?Gd:bg).style("opacity",1),l.select("text").transition().duration(V).attr("x",mh?_f:0).attr("y",Gd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(V).style("opacity",0).remove()),G&&$h&&(n=rj.select("."+g.ygrids).selectAll("."+g.ygrid).data(vg.ticks(ai)),n.enter().append("line").attr("class",g.ygrid),n.attr("x1",mh?vg:0).attr("x2",mh?vg:_f).attr("y1",mh?0:vg).attr("y2",mh?bg:vg),n.exit().remove(),kf(n,"grid")),G&&Ce(_h)&&(o=rj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(_h),q=o.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),q.append("line").style("opacity",0),q.append("text").attr("text-anchor","end").attr("transform",mh?"rotate(-90)":"").attr("dx",mh?0:-Yf.top).attr("dy",-5).style("opacity",0),o.select("line").transition().duration(V).attr("x1",mh?Hd:0).attr("x2",mh?Hd:_f).attr("y1",mh?0:Hd).attr("y2",mh?bg:Hd).style("opacity",1),o.select("text").transition().duration(V).attr("x",mh?0:_f).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),o.exit().transition().duration(V).style("opacity",0).remove()),w=rj.select("."+g.regions).selectAll("."+g.region).data(xi),w.enter().append("g").attr("class",hd).append("rect").style("fill-opacity",0),w.selectAll("rect").attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(V).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),w.exit().transition().duration(V).style("fill-opacity",0).remove(),u=rj.selectAll("."+g.bars).selectAll("."+g.bar).data(se),u.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Ui),u.style("opacity",td).transition().duration(V).attr("d",Q).style("fill",Ui).style("opacity",1),u.exit().transition().duration(W).style("opacity",0).remove(),r=rj.selectAll("."+g.lines).selectAll("."+g.line).data(qe),r.enter().append("path").attr("class",Zc).style("stroke",Ui),r.style("opacity",td).transition().duration(V).attr("d",lj).style("stroke",Ui).style("opacity",1),r.exit().transition().duration(W).style("opacity",0).remove(),s=rj.selectAll("."+g.areas).selectAll("."+g.area).data(qe),s.enter().append("path").attr("class",fd).style("fill",Ui).style("opacity",function(){return xj=+Gf.select(this).style("opacity"),0}),s.style("opacity",0).transition().duration(V).attr("d",mj).style("fill",Ui).style("opacity",xj),s.exit().transition().duration(W).style("opacity",0).remove(),t=rj.selectAll("."+g.circles).selectAll("."+g.circle).data(te),t.enter().append("circle").attr("class",_c).attr("r",Pe).style("fill",Ui),t.style("opacity",td).transition().duration(V).style("opacity",vd).style("fill",Ui).attr("cx",mh?Yd:Xd).attr("cy",mh?Xd:Yd),t.exit().remove(),x=rj.selectAll("."+g.texts).selectAll("."+g.text).data(ue),x.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return mh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",Ui).style("fill-opacity",0),x.text(function(a){return Ed(a.id)(a.value,a.id)}).style("fill-opacity",ud).transition().duration(V).attr("x",S).attr("y",T).style("fill",Ui).style("fill-opacity",wd),x.exit().transition().duration(W).style("fill-opacity",0).remove(),v=rj.selectAll("."+g.arcs).selectAll("."+g.arc).data(re),v.enter().append("path").attr("class",dd).style("fill",function(a){return Ui(a.data)}).style("cursor",function(a){return Wg(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Si||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),xf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Sd(d,Gf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Si||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),yf(),Td(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();ff(this,a,b),e(d,b)}),v.attr("transform",L?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Si=!0}).transition().duration(V).attrTween("d",function(a){var b,c=Fb(a);return c?(b=Gf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",L?"scale(1)":"").style("fill",function(a){return Ui(a.data)}).style("opacity",1).call(Fe,function(){Si=!1}),v.exit().transition().duration(W).style("opacity",0).remove(),rj.selectAll("."+g.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(V).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&pe(a.data)?1:0}),rj.select("."+g.chartArcsTitle).style("opacity",he(Hf.data.targets)?1:0),dh&&(null!==Gf.event&&"zoom"===Gf.event.type&&kj.extent(ug.orgDomain()).update(),H&&(!mh&&yh&&fb(e,U.axisSubX,yh),kj.empty()||kj.extent(ug.orgDomain()).update(),R=Ye(_,!0),z=sj.selectAll("."+g.bars).selectAll("."+g.bar).data(se),z.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Ui),z.style("opacity",td).transition().duration(V).attr("d",R).style("opacity",1),z.exit().transition().duration(V).style("opacity",0).remove(),y=sj.selectAll("."+g.lines).selectAll("."+g.line).data(qe),y.enter().append("path").attr("class",Zc).style("stroke",Ui),y.style("opacity",td).transition().duration(V).attr("d",nj).style("opacity",1),y.exit().transition().duration(V).style("opacity",0).remove())),rj.selectAll("."+g.selectedCircles).filter(function(a){return le(a)}).selectAll("circle").remove(),rj.selectAll("."+g.selectedCircle).transition().duration(V).attr("cx",mh?Yd:Xd).attr("cy",mh?Xd:Yd),A=rj.select("."+g.eventRects),Ce(Fg)&&!oc(Fg)?(A.classed(g.eventRectsMultiple)||A.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),B=rj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),ef(B.enter()),B.attr("x",0).attr("y",0).attr("width",_f).attr("height",bg)):(A.classed(g.eventRectsSingle)||A.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Ni&&!Mi?(F=function(a,b){var c=xc(b),d=yc(b),e=Hf.data.xs[a.id][b];return(ug(d?d:e+50)-ug(c?c:e-50))/2},E=function(a,b){var c=xc(b),d=Hf.data.xs[a.id][b];return(ug(d)+ug(c?c:d-50))/2}):(F=M(),E=function(a){return ug(a.x)-F/2}),C=Ac(Hf.data.targets),rj.select("."+g.eventRects).datum(C?C.values:[]),B=rj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),df(B.enter()),B.attr("class",id).attr("x",mh?0:E).attr("y",mh?E:0).attr("width",mh?_f:F).attr("height",mh?F:bg),B.exit().remove()),Cc(Hf.data.targets).forEach(function(a){yj[a]=!0})}function mf(){lf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function nf(){return"mousemove"===Gf.event.sourceEvent.type&&oj.altDomain?(ug.domain(oj.altDomain),void oj.scale(ug).updateScaleExtent()):(Mi&&ug.orgDomain()[0]===wj[0]&&ug.domain([wj[0]-1e-10,ug.orgDomain()[1]]),lf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Gf.event.sourceEvent.type&&(Qi=!0)))}function of(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function pf(){pj.attr("width",dg).attr("height",eg),pj.select("#"+Fi).select("rect").attr("width",_f).attr("height",bg),pj.select("#"+Gi).select("rect").attr("x",C).attr("y",D).attr("width",I).attr("height",J),pj.select("#"+Hi).select("rect").attr("x",E).attr("y",F).attr("width",K).attr("height",L),pj.select("."+g.zoomRect).attr("width",_f).attr("height",bg),vj.style("max-height",eg+"px")}function qf(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,o(),S(),pf(),n(a.withTransition),lf(a)}function rf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=rj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",kd),j=i.enter().append("g").attr("class",kd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc),e=rj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",md),d=e.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",cd).style("cursor",function(a){return Wg(a)?"pointer":null}),c=rj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",ld),b=c.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",$c),b.append("g").attr("class",gd),b.append("g").attr("class",function(a){return Uc(g.selectedCircles,a.id)}),b.append("g").attr("class",ad).style("cursor",function(a){return Wg(a)?"pointer":null}),a.forEach(function(a){rj.selectAll("."+g.selectedCircles+od(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=rj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(lg(a)).attr("class",nd),f=h.enter().append("g").attr("class",nd),f.append("g").attr("class",ed),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),dh&&(n=sj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",md),m=n.enter().append("g").style("opacity",0).attr("class",md),m.append("g").attr("class",cd),l=sj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",ld),k=l.enter().append("g").style("opacity",0).attr("class",ld),k.append("g").attr("class",$c)),pj.selectAll("."+g.target).filter(function(a){return Gc(a.id)}).transition().duration(Xf).style("opacity",1)}function sf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?ce(a.id,b.types[a.id]):ce(a.id,b.type)}),Hf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=cj?j:i,l=cj?R():Q();return d&&(w=0,C=0,t=0,u=0),gh&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=cj?u:t,void(lh?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=tj.selectAll("."+g.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,cj?(f=function(a){return t*B[a]},j=function(a){return A[B[a]]+x[a]}):(f=function(a){return A[B[a]]+x[a]},j=function(a){return u*B[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=tj.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(g.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof ih?ih(a):Hf.toggle(a)}).on("mouseover",function(a){Gf.select(this).classed(g.legendItemFocused,!0),Si||Hf.focus(a),"function"==typeof jh&&jh(a)}).on("mouseout",function(a){Gf.select(this).classed(g.legendItemFocused,!1),Si||Hf.revert(),"function"==typeof kh&&kh(a)}),m.append("text").text(function(a){return d(Ig[a])?Ig[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",cj?h:-200).attr("y",cj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",cj?i:-200).attr("y",cj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",Ui).attr("x",cj?h:-200).attr("y",cj?-200:j).attr("width",10).attr("height",10),tj.selectAll("text").data(a).text(function(a){return d(Ig[a])?Ig[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),tj.selectAll("rect."+g.legendItemEvent).data(a).transition().duration(p?250:0).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}).attr("x",i).attr("y",l),tj.selectAll("rect."+g.legendItemTile).data(a).transition().duration(p?250:0).style("fill",Ui).attr("x",f).attr("y",j),tj.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=Gf.select(this);return Gc(a)?!D||b.classed(g.legendItemFocused)?vf(b):wf(b):gj}),O(t),P(u),N(C),o(),S(),pf(),n(q,c)}function Cf(a){return Ec(Hf.data.targets,a.id)}function Df(a){return"data"in a&&Ec(Hf.data.targets,a.data.id)}function Ef(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 Ff(a,b,c){var d=!ie(Hf.data.targets);Si=!1,ce(a,b),qf(c||{withTransitionForAxis:d})}var Gf=a.d3?a.d3:a.require?a.require("d3"):void 0,Hf={data:{},axis:{},legend:{}},If={},Jf=i(["bindto"],"#chart"),Kf=i(["size","width"]),Lf=i(["size","height"]),Mf=i(["padding","left"],50),Nf=i(["padding","right"],0),Of=i(["padding","top"],0),Pf=i(["padding","bottom"],0),Qf=i(["zoom","enabled"],!1),Rf=i(["zoom","extent"]),Sf=i(["zoom","privileged"],!1),Tf=i(["onenter"],function(){}),Uf=i(["onleave"],function(){}),Vf=i(["onresize"],function(){}),Wf=i(["onresized"],function(){}),Xf=i(["transition","duration"],350);h("data","data is required in config");var Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg=i(["data","x"]),Fg=i(["data","xs"],{}),Gg=i(["data","x_format"]),Hg=i(["data","id_converter"],function(a){return a}),Ig=i(["data","names"],{}),Jg=i(["data","classes"],{}),Kg=i(["data","groups"],[]),Lg=i(["data","axes"],{}),Mg=i(["data","type"]),Ng=i(["data","types"],{}),Og=i(["data","labels"],{}),Pg=i(["data","order"]),Qg=i(["data","regions"],{}),Rg=i(["data","color"]),Sg=i(["data","colors"],{}),Tg=i(["data","hide"],!1),Ug=i(["data","selection","enabled"],!1),Vg=i(["data","selection","grouped"],!1),Wg=i(["data","selection","isselectable"],function(){return!0}),Xg=i(["data","selection","multiple"],!0),Yg=i(["data","onclick"],function(){}),Zg=i(["data","onenter"],function(){}),$g=i(["data","onleave"],function(){}),_g=i(["data","onselected"],function(){}),ah=i(["data","onunselected"],function(){}),bh=i(["data","ondragstart"],function(){}),ch=i(["data","ondragend"],function(){}),dh=i(["subchart","show"],!1),eh=i(["subchart","size","height"],60),fh=i(["color","pattern"],[]),gh=i(["legend","show"],!0),hh=i(["legend","position"],"bottom"),ih=i(["legend","item","onclick"]),jh=i(["legend","item","onmouseover"]),kh=i(["legend","item","onmouseout"]),lh=i(["legend","equally"],!1),mh=i(["axis","rotated"],!1),nh=i(["axis","x","show"],!0),oh=i(["axis","x","type"],"indexed"),ph=i(["axis","x","localtime"],!0),qh=i(["axis","x","categories"],[]),rh=i(["axis","x","tick","centered"],!1),sh=i(["axis","x","tick","format"]),th=i(["axis","x","tick","culling"],{}),uh=i(["axis","x","tick","culling","max"],10),vh=i(["axis","x","tick","count"]),wh=i(["axis","x","tick","fit"],!0),xh=i(["axis","x","tick","values"],null),yh=i(["axis","x","tick","rotate"]),zh=i(["axis","x","max"],null),Ah=i(["axis","x","min"],null),Bh=i(["axis","x","padding"],{}),Ch=i(["axis","x","height"]),Dh=i(["axis","x","default"]),Eh=i(["axis","x","label"],{}),Fh=i(["axis","y","show"],!0),Gh=i(["axis","y","max"]),Hh=i(["axis","y","min"]),Ih=i(["axis","y","center"]),Jh=i(["axis","y","label"],{}),Kh=i(["axis","y","inner"],!1),Lh=i(["axis","y","tick","format"]),Mh=i(["axis","y","padding"]),Nh=i(["axis","y","ticks"],10),Oh=i(["axis","y2","show"],!1),Ph=i(["axis","y2","max"]),Qh=i(["axis","y2","min"]),Rh=i(["axis","y2","center"]),Sh=i(["axis","y2","label"],{}),Th=i(["axis","y2","inner"],!1),Uh=i(["axis","y2","tick","format"]),Vh=i(["axis","y2","padding"]),Wh=i(["axis","y2","ticks"],10),Xh=i(["grid","x","show"],!1),Yh=i(["grid","x","type"],"tick"),Zh=i(["grid","x","lines"],[]),$h=i(["grid","y","show"],!1),_h=i(["grid","y","lines"],[]),ai=i(["grid","y","ticks"],10),bi=i(["point","show"],!0),ci=i(["point","r"],2.5),di=i(["point","focus","line","enabled"],!0),ei=i(["point","focus","expand","enabled"],!0),fi=i(["point","focus","expand","r"]),gi=i(["point","focus","select","r"]),hi=i(["line","connect_null"],!1),ii=i(["bar","width"]),ji=i(["bar","width","ratio"],.6),ki=i(["pie","label","show"],!0),li=i(["pie","label","format"]),mi=i(["pie","expand"],!0),ni=i(["pie","onclick"],function(){}),oi=i(["pie","onmouseover"],function(){}),pi=i(["pie","onmouseout"],function(){}),qi=i(["donut","label","show"],!0),ri=i(["donut","label","format"]),si=i(["donut","expand"],!0),ti=i(["donut","title"],""),ui=i(["donut","onclick"],function(){}),vi=i(["donut","onmouseover"],function(){}),wi=i(["donut","onmouseout"],function(){}),xi=i(["regions"],[]),yi=i(["tooltip","show"],!0),zi=i(["tooltip","format","title"]),Ai=i(["tooltip","format","value"]),Bi=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=zi?zi:b,l=Ai?Ai:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Ci=i(["tooltip","init","show"],!1),Di=i(["tooltip","init","x"],0),Ei=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Fi=("string"==typeof Jf?Jf.replace("#",""):Jf.id)+"-clip",Gi=Fi+"-xaxis",Hi=Fi+"-yaxis",Ii=j(Fi),Ji=j(Gi),Ki=j(Hi),Li="timeseries"===oh,Mi="categorized"===oh,Ni=!Li&&(Eg||Ce(Fg)),Oi=null,Pi=!1,Qi=!1,Ri=!1,Si=!1,Ti=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ui=we(Sg,Ce(fh)?fh:Ti,Rg),Vi=ph?Gf.time.format:Gf.time.format.utc,Wi=function(){var a=[[Vi("%Y/%-m/%-d"),function(){return!0}],[Vi("%-m/%-d"),function(a){return a.getMonth()}],[Vi("%-m/%-d"),function(a){return 1!==a.getDate()}],[Vi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Vi("%I %p"),function(a){return a.getHours()}],[Vi("%I:%M"),function(a){return a.getMinutes()}],[Vi(":%S"),function(a){return a.getSeconds()}],[Vi(".%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)}}(),Xi=[],Yi=[],Zi=mh?"left":"bottom",$i=mh?Kh?"top":"bottom":Kh?"right":"left",_i=mh?Th?"bottom":"top":Th?"left":"right",aj=mh?"left":"bottom",bj={main:function(){return"translate("+Yf.left+","+Yf.top+")"},context:function(){return"translate("+Zf.left+","+Zf.top+")"},legend:function(){return"translate("+$f.left+","+$f.top+")"},x:function(){return"translate(0,"+(mh?0:bg)+")"},y:function(){return"translate(0,"+(mh?bg:0)+")"},y2:function(){return"translate("+(mh?0:_f)+","+(mh?1:0)+")"},subx:function(){return"translate(0,"+(mh?0:cg)+")"},arc:function(){return"translate("+_f/2+","+bg/2+")"}},cj="right"===hh,dj=0,ej=0,fj=0,gj=.15,hj=30,ij=mh&&!nh?0:30,jj=5;lg=Gf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var kj,lj=function(){var a=Gf.svg.line().x(mh?function(a){return W(a.id)(a.value) +var u=2*o;for(h=o;1>=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function cf(b){var c,d,e;if(vj=Gf.select(Jf),vj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(vj.html("").classed("c3",!0),Hf.data.xs={},Hf.data.targets=vc(b),Tg&&Lc(Tg===!0?Cc(Hf.data.targets):Tg),o(),S(),ug.domain(Gf.extent(_b(Hf.data.targets))),vg.domain(Xb(Hf.data.targets,"y")),wg.domain(Xb(Hf.data.targets,"y2")),xg.domain(ug.domain()),yg.domain(vg.domain()),zg.domain(wg.domain()),wj=ug.domain(),kj.scale(xg),Qf&&oj.scale(ug),pj=vj.append("svg").on("mouseenter",Tf).on("mouseleave",Uf),qj=pj.append("defs"),qj.append("clipPath").attr("id",Fi).append("rect"),qj.append("clipPath").attr("id",Gi).append("rect"),qj.append("clipPath").attr("id",Hi).append("rect"),pf(),rj=pj.append("g").attr("transform",bj.main),sj=pj.append("g").attr("transform",bj.context),tj=pj.append("g").attr("transform",bj.legend),dh||sj.style("visibility","hidden"),gh||(tj.style("visibility","hidden"),Yi=Cc(Hf.data.targets)),uj=Gf.select(Jf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Bf(Cc(Hf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=rj.append("g").attr("clip-path",Ii).attr("class",g.grid),Xh&&d.append("g").attr("class",g.xgrids),Ce(Zh)&&d.append("g").attr("class",g.xgridLines),di&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),$h&&d.append("g").attr("class",g.ygrids),Ce(_h)&&d.append("g").attr("class",g.ygridLines),rj.append("g").attr("clip-path",Ii).attr("class",g.regions),rj.append("g").attr("clip-path",Ii).attr("class",g.chart),c=rj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Qf?mh?"ns-resize":"ew-resize":null),rj.select("."+g.chart).append("g").attr("class",g.chartBars),rj.select("."+g.chart).append("g").attr("class",g.chartLines),rj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",bj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Rb()),rj.select("."+g.chart).append("g").attr("class",g.chartTexts),Qf&&rj.insert("rect",Sf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",_f).attr("height",bg).style("opacity",0).style("cursor",mh?"ns-resize":"ew-resize").call(oj).on("dblclick.zoom",null),Dh&&kj.extent("function"!=typeof Dh?Dh:Dh(_b())),nh&&rj.append("g").attr("class",g.axisX).attr("clip-path",Ji).attr("transform",bj.x).append("text").attr("class",g.axisXLabel).attr("transform",mh?"rotate(-90)":"").style("text-anchor",Ab),Fh&&rj.append("g").attr("class",g.axisY).attr("clip-path",Ki).attr("transform",bj.y).append("text").attr("class",g.axisYLabel).attr("transform",mh?"":"rotate(-90)").style("text-anchor",Bb),Oh&&rj.append("g").attr("class",g.axisY2).attr("transform",bj.y2).append("text").attr("class",g.axisY2Label).attr("transform",mh?"":"rotate(-90)").style("text-anchor",Cb),sj.append("g").attr("clip-path",Ii).attr("class",g.chart),sj.select("."+g.chart).append("g").attr("class",g.chartBars),sj.select("."+g.chart).append("g").attr("class",g.chartLines),sj.append("g").attr("clip-path",Ii).attr("class",g.brush).call(kj).selectAll("rect").attr(mh?"width":"height",mh?ag:cg),sj.append("g").attr("class",g.axisX).attr("transform",bj.subx).attr("clip-path",mh?"":Ji),rf(Hf.data.targets),mh?rj.select("."+g.axisX).style("opacity",0).call(Ag):(rj.select("."+g.axisY).style("opacity",0).call(Bg),rj.select("."+g.axisY2).style("opacity",0).call(Cg)),o(),S(),pf(),n(!1),lf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Ci){if(Li&&"string"==typeof Di){for(Di=xe(Di),e=0;e0){d=[];for(var f in Ig)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Od(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Le,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function hf(a){ie(Hf.data.targets)||Ug&&(Oi=a,rj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Pi=!0,bh())}function jf(){ie(Hf.data.targets)||Ug&&(rj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),rj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Pi=!1,ch())}function kf(a,b){"grid"===b&&a.each(function(){var a=Gf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function lf(a){var c,e,f,h,i,j,k,l,m,n,o,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,$,_=Zd(),ab=ie(Hf.data.targets),bb=Ic(Hf.data.targets);if(a=d(a)?a:{},G=d(a.withY)?a.withY:!0,H=d(a.withSubchart)?a.withSubchart:!0,I=d(a.withTransition)?a.withTransition:!0,L=d(a.withTransform)?a.withTransform:!1,N=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,O=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,P=d(a.withLegend)?a.withLegend:!1,J=d(a.withTransitionForExit)?a.withTransitionForExit:I,K=d(a.withTransitionForAxis)?a.withTransitionForAxis:I,V=I?Xf:0,W=J?V:0,X=K?V:0,c=rj.select("."+g.axisX).style("opacity",ab?0:1),f=rj.select("."+g.axisY).style("opacity",ab?0:1),h=rj.select("."+g.axisY2).style("opacity",ab?0:1),e=sj.select("."+g.axisX).style("opacity",ab?0:1),U={axisX:c.transition().duration(X),axisY:f.transition().duration(X),axisY2:h.transition().duration(X),axisSubX:e.transition().duration(X)},P&&gh&&Bf(Cc(Hf.data.targets),a,U),Mi&&(0!==bb.length&&O&&N||ug.domain([0,c.selectAll(".tick").size()])),bb.length&&(O&&(ug.domain(Gf.extent(_b(bb))),wj=ug.domain(),Qf&&oj.scale(ug).updateScaleExtent(),xg.domain(ug.domain()),kj.scale(xg)),N&&(ug.domain(kj.empty()?wj:kj.extent()),Qf&&oj.scale(ug).updateScaleExtent()),xh||!wh&&!vh||(Y=Kc(Jc(bb),vh),Ag.tickValues(Y),Dg.tickValues(Y))),vg.domain(Xb(bb,"y")),wg.domain(Xb(bb,"y2")),U.axisX.call(Ag),U.axisY.call(Bg),U.axisY2.call(Cg),U.axisSubX.call(Dg),Eb(I),N&&bb.length)if(th&&Y){for(Z=1;Z=0&&Gf.select(this).style("display",b%$?"none":"block")})}else pj.selectAll("."+g.axisX+" .tick text").style("display","block");!mh&&yh&&fb(c,U.axisX,yh),Q=Ye(_),S=Ze(_,!0),T=Ze(_,!1),yg.domain(vg.domain()),zg.domain(wg.domain()),uj.style("display","none"),p(),rj.select("line."+g.xgridFocus).style("visibility","hidden"),Xh&&(k=Wd(Yh,ug),D=Mi?Ag.tickOffset():0,j=mh?{x1:0,x2:_f,y1:function(a){return ug(a)-D},y2:function(a){return ug(a)-D}}:{x1:function(a){return ug(a)+D},x2:function(a){return ug(a)+D},y1:Yf.top,y2:bg},i=rj.select("."+g.xgrids).selectAll("."+g.xgrid).data(k),i.enter().append("line").attr("class",g.xgrid),i.attr(j).style("opacity",function(){return+Gf.select(this).attr(mh?"y1":"x1")===(mh?bg:0)?0:1}),i.exit().remove()),Ce(Zh)&&(l=rj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(Zh),m=l.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",mh?"":"rotate(-90)").attr("dx",mh?0:-Yf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(V).attr("x1",mh?0:Gd).attr("x2",mh?_f:Gd).attr("y1",mh?Gd:Yf.top).attr("y2",mh?Gd:bg).style("opacity",1),l.select("text").transition().duration(V).attr("x",mh?_f:0).attr("y",Gd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(V).style("opacity",0).remove()),G&&$h&&(n=rj.select("."+g.ygrids).selectAll("."+g.ygrid).data(vg.ticks(ai)),n.enter().append("line").attr("class",g.ygrid),n.attr("x1",mh?vg:0).attr("x2",mh?vg:_f).attr("y1",mh?0:vg).attr("y2",mh?bg:vg),n.exit().remove(),kf(n,"grid")),G&&Ce(_h)&&(o=rj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(_h),q=o.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),q.append("line").style("opacity",0),q.append("text").attr("text-anchor","end").attr("transform",mh?"rotate(-90)":"").attr("dx",mh?0:-Yf.top).attr("dy",-5).style("opacity",0),o.select("line").transition().duration(V).attr("x1",mh?Hd:0).attr("x2",mh?Hd:_f).attr("y1",mh?0:Hd).attr("y2",mh?bg:Hd).style("opacity",1),o.select("text").transition().duration(V).attr("x",mh?0:_f).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),o.exit().transition().duration(V).style("opacity",0).remove()),w=rj.select("."+g.regions).selectAll("."+g.region).data(xi),w.enter().append("g").attr("class",hd).append("rect").style("fill-opacity",0),w.selectAll("rect").attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(V).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),w.exit().transition().duration(V).style("fill-opacity",0).remove(),u=rj.selectAll("."+g.bars).selectAll("."+g.bar).data(se),u.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Ui),u.style("opacity",td).transition().duration(V).attr("d",Q).style("fill",Ui).style("opacity",1),u.exit().transition().duration(W).style("opacity",0).remove(),r=rj.selectAll("."+g.lines).selectAll("."+g.line).data(qe),r.enter().append("path").attr("class",Zc).style("stroke",Ui),r.style("opacity",td).transition().duration(V).attr("d",lj).style("stroke",Ui).style("opacity",1),r.exit().transition().duration(W).style("opacity",0).remove(),s=rj.selectAll("."+g.areas).selectAll("."+g.area).data(qe),s.enter().append("path").attr("class",fd).style("fill",Ui).style("opacity",function(){return xj=+Gf.select(this).style("opacity"),0}),s.style("opacity",0).transition().duration(V).attr("d",mj).style("fill",Ui).style("opacity",xj),s.exit().transition().duration(W).style("opacity",0).remove(),t=rj.selectAll("."+g.circles).selectAll("."+g.circle).data(te),t.enter().append("circle").attr("class",_c).attr("r",Pe).style("fill",Ui),t.style("opacity",td).transition().duration(V).style("opacity",vd).style("fill",Ui).attr("cx",mh?Yd:Xd).attr("cy",mh?Xd:Yd),t.exit().remove(),x=rj.selectAll("."+g.texts).selectAll("."+g.text).data(ue),x.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return mh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",Ui).style("fill-opacity",0),x.text(function(a){return Ed(a.id)(a.value,a.id)}).style("fill-opacity",ud).transition().duration(V).attr("x",S).attr("y",T).style("fill",Ui).style("fill-opacity",wd),x.exit().transition().duration(W).style("fill-opacity",0).remove(),v=rj.selectAll("."+g.arcs).selectAll("."+g.arc).data(re),v.enter().append("path").attr("class",dd).style("fill",function(a){return Ui(a.data)}).style("cursor",function(a){return Wg(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Si||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),xf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Sd(d,Gf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Si||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),yf(),Td(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();ff(this,a,b),e(d,b)}),v.attr("transform",L?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Si=!0}).transition().duration(V).attrTween("d",function(a){var b,c=Fb(a);return c?(b=Gf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",L?"scale(1)":"").style("fill",function(a){return Ui(a.data)}).style("opacity",1).call(Fe,function(){Si=!1}),v.exit().transition().duration(W).style("opacity",0).remove(),rj.selectAll("."+g.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(V).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&pe(a.data)?1:0}),rj.select("."+g.chartArcsTitle).style("opacity",he(Hf.data.targets)?1:0),dh&&(null!==Gf.event&&"zoom"===Gf.event.type&&kj.extent(ug.orgDomain()).update(),H&&(!mh&&yh&&fb(e,U.axisSubX,yh),kj.empty()||kj.extent(ug.orgDomain()).update(),R=Ye(_,!0),z=sj.selectAll("."+g.bars).selectAll("."+g.bar).data(se),z.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Ui),z.style("opacity",td).transition().duration(V).attr("d",R).style("opacity",1),z.exit().transition().duration(V).style("opacity",0).remove(),y=sj.selectAll("."+g.lines).selectAll("."+g.line).data(qe),y.enter().append("path").attr("class",Zc).style("stroke",Ui),y.style("opacity",td).transition().duration(V).attr("d",nj).style("opacity",1),y.exit().transition().duration(V).style("opacity",0).remove())),rj.selectAll("."+g.selectedCircles).filter(function(a){return le(a)}).selectAll("circle").remove(),rj.selectAll("."+g.selectedCircle).transition().duration(V).attr("cx",mh?Yd:Xd).attr("cy",mh?Xd:Yd),A=rj.select("."+g.eventRects),Ce(Fg)&&!oc(Fg)?(A.classed(g.eventRectsMultiple)||A.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),B=rj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),ef(B.enter()),B.attr("x",0).attr("y",0).attr("width",_f).attr("height",bg)):(A.classed(g.eventRectsSingle)||A.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Ni&&!Mi?(F=function(a,b){var c=xc(b),d=yc(b),e=Hf.data.xs[a.id][b];return(ug(d?d:e+50)-ug(c?c:e-50))/2},E=function(a,b){var c=xc(b),d=Hf.data.xs[a.id][b];return(ug(d)+ug(c?c:d-50))/2}):(F=M(),E=function(a){return ug(a.x)-F/2}),C=Ac(Hf.data.targets),rj.select("."+g.eventRects).datum(C?C.values:[]),B=rj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),df(B.enter()),B.attr("class",id).attr("x",mh?0:E).attr("y",mh?E:0).attr("width",mh?_f:F).attr("height",mh?F:bg),B.exit().remove()),Cc(Hf.data.targets).forEach(function(a){yj[a]=!0})}function mf(){lf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function nf(){return"mousemove"===Gf.event.sourceEvent.type&&oj.altDomain?(ug.domain(oj.altDomain),void oj.scale(ug).updateScaleExtent()):(Mi&&ug.orgDomain()[0]===wj[0]&&ug.domain([wj[0]-1e-10,ug.orgDomain()[1]]),lf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Gf.event.sourceEvent.type&&(Qi=!0)))}function of(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function pf(){pj.attr("width",dg).attr("height",eg),pj.select("#"+Fi).select("rect").attr("width",_f).attr("height",bg),pj.select("#"+Gi).select("rect").attr("x",C).attr("y",D).attr("width",I).attr("height",J),pj.select("#"+Hi).select("rect").attr("x",E).attr("y",F).attr("width",K).attr("height",L),pj.select("."+g.zoomRect).attr("width",_f).attr("height",bg),vj.style("max-height",eg+"px")}function qf(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,o(),S(),pf(),n(a.withTransition),lf(a)}function rf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=rj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",kd),j=i.enter().append("g").attr("class",kd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc),e=rj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",md),d=e.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",cd).style("cursor",function(a){return Wg(a)?"pointer":null}),c=rj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",ld),b=c.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",$c),b.append("g").attr("class",gd),b.append("g").attr("class",function(a){return Uc(g.selectedCircles,a.id)}),b.append("g").attr("class",ad).style("cursor",function(a){return Wg(a)?"pointer":null}),a.forEach(function(a){rj.selectAll("."+g.selectedCircles+od(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=rj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(lg(a)).attr("class",nd),f=h.enter().append("g").attr("class",nd),f.append("g").attr("class",ed),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),dh&&(n=sj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",md),m=n.enter().append("g").style("opacity",0).attr("class",md),m.append("g").attr("class",cd),l=sj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",ld),k=l.enter().append("g").style("opacity",0).attr("class",ld),k.append("g").attr("class",$c)),pj.selectAll("."+g.target).filter(function(a){return Gc(a.id)}).transition().duration(Xf).style("opacity",1)}function sf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?ce(a.id,b.types[a.id]):ce(a.id,b.type)}),Hf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=cj?j:i,l=cj?R():Q();return d&&(w=0,C=0,t=0,u=0),gh&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=cj?u:t,void(lh?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=tj.selectAll("."+g.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,cj?(f=function(a){return t*B[a]},j=function(a){return A[B[a]]+x[a]}):(f=function(a){return A[B[a]]+x[a]},j=function(a){return u*B[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=tj.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(g.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof ih?ih(a):Hf.toggle(a)}).on("mouseover",function(a){Gf.select(this).classed(g.legendItemFocused,!0),Si||Hf.focus(a),"function"==typeof jh&&jh(a)}).on("mouseout",function(a){Gf.select(this).classed(g.legendItemFocused,!1),Si||Hf.revert(),"function"==typeof kh&&kh(a)}),m.append("text").text(function(a){return d(Ig[a])?Ig[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",cj?h:-200).attr("y",cj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",cj?i:-200).attr("y",cj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",Ui).attr("x",cj?h:-200).attr("y",cj?-200:j).attr("width",10).attr("height",10),tj.selectAll("text").data(a).text(function(a){return d(Ig[a])?Ig[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),tj.selectAll("rect."+g.legendItemEvent).data(a).transition().duration(p?250:0).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}).attr("x",i).attr("y",l),tj.selectAll("rect."+g.legendItemTile).data(a).transition().duration(p?250:0).style("fill",Ui).attr("x",f).attr("y",j),tj.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=Gf.select(this);return Gc(a)?!D||b.classed(g.legendItemFocused)?vf(b):wf(b):gj}),O(t),P(u),N(C),o(),S(),pf(),n(q,c)}function Cf(a){return Ec(Hf.data.targets,a.id)}function Df(a){return"data"in a&&Ec(Hf.data.targets,a.data.id)}function Ef(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 Ff(a,b,c){var d=!ie(Hf.data.targets);Si=!1,ce(a,b),qf(c||{withTransitionForAxis:d})}var Gf=a.d3?a.d3:a.require?a.require("d3"):void 0,Hf={data:{},axis:{},legend:{}},If={},Jf=i(["bindto"],"#chart"),Kf=i(["size","width"]),Lf=i(["size","height"]),Mf=i(["padding","left"],50),Nf=i(["padding","right"],0),Of=i(["padding","top"],0),Pf=i(["padding","bottom"],0),Qf=i(["zoom","enabled"],!1),Rf=i(["zoom","extent"]),Sf=i(["zoom","privileged"],!1),Tf=i(["onenter"],function(){}),Uf=i(["onleave"],function(){}),Vf=i(["onresize"],function(){}),Wf=i(["onresized"],function(){}),Xf=i(["transition","duration"],350);h("data","data is required in config");var Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg=i(["data","x"]),Fg=i(["data","xs"],{}),Gg=i(["data","x_format"]),Hg=i(["data","id_converter"],function(a){return a}),Ig=i(["data","names"],{}),Jg=i(["data","classes"],{}),Kg=i(["data","groups"],[]),Lg=i(["data","axes"],{}),Mg=i(["data","type"]),Ng=i(["data","types"],{}),Og=i(["data","labels"],{}),Pg=i(["data","order"]),Qg=i(["data","regions"],{}),Rg=i(["data","color"]),Sg=i(["data","colors"],{}),Tg=i(["data","hide"],!1),Ug=i(["data","selection","enabled"],!1),Vg=i(["data","selection","grouped"],!1),Wg=i(["data","selection","isselectable"],function(){return!0}),Xg=i(["data","selection","multiple"],!0),Yg=i(["data","onclick"],function(){}),Zg=i(["data","onenter"],function(){}),$g=i(["data","onleave"],function(){}),_g=i(["data","onselected"],function(){}),ah=i(["data","onunselected"],function(){}),bh=i(["data","ondragstart"],function(){}),ch=i(["data","ondragend"],function(){}),dh=i(["subchart","show"],!1),eh=i(["subchart","size","height"],60),fh=i(["color","pattern"],[]),gh=i(["legend","show"],!0),hh=i(["legend","position"],"bottom"),ih=i(["legend","item","onclick"]),jh=i(["legend","item","onmouseover"]),kh=i(["legend","item","onmouseout"]),lh=i(["legend","equally"],!1),mh=i(["axis","rotated"],!1),nh=i(["axis","x","show"],!0),oh=i(["axis","x","type"],"indexed"),ph=i(["axis","x","localtime"],!0),qh=i(["axis","x","categories"],[]),rh=i(["axis","x","tick","centered"],!1),sh=i(["axis","x","tick","format"]),th=i(["axis","x","tick","culling"],{}),uh=i(["axis","x","tick","culling","max"],10),vh=i(["axis","x","tick","count"]),wh=i(["axis","x","tick","fit"],!0),xh=i(["axis","x","tick","values"],null),yh=i(["axis","x","tick","rotate"]),zh=i(["axis","x","max"],null),Ah=i(["axis","x","min"],null),Bh=i(["axis","x","padding"],{}),Ch=i(["axis","x","height"]),Dh=i(["axis","x","default"]),Eh=i(["axis","x","label"],{}),Fh=i(["axis","y","show"],!0),Gh=i(["axis","y","max"]),Hh=i(["axis","y","min"]),Ih=i(["axis","y","center"]),Jh=i(["axis","y","label"],{}),Kh=i(["axis","y","inner"],!1),Lh=i(["axis","y","tick","format"]),Mh=i(["axis","y","padding"]),Nh=i(["axis","y","ticks"],10),Oh=i(["axis","y2","show"],!1),Ph=i(["axis","y2","max"]),Qh=i(["axis","y2","min"]),Rh=i(["axis","y2","center"]),Sh=i(["axis","y2","label"],{}),Th=i(["axis","y2","inner"],!1),Uh=i(["axis","y2","tick","format"]),Vh=i(["axis","y2","padding"]),Wh=i(["axis","y2","ticks"],10),Xh=i(["grid","x","show"],!1),Yh=i(["grid","x","type"],"tick"),Zh=i(["grid","x","lines"],[]),$h=i(["grid","y","show"],!1),_h=i(["grid","y","lines"],[]),ai=i(["grid","y","ticks"],10),bi=i(["point","show"],!0),ci=i(["point","r"],2.5),di=i(["point","focus","line","enabled"],!0),ei=i(["point","focus","expand","enabled"],!0),fi=i(["point","focus","expand","r"]),gi=i(["point","focus","select","r"]),hi=i(["line","connect_null"],!1),ii=i(["bar","width"]),ji=i(["bar","width","ratio"],.6),ki=i(["pie","label","show"],!0),li=i(["pie","label","format"]),mi=i(["pie","expand"],!0),ni=i(["pie","onclick"],function(){}),oi=i(["pie","onmouseover"],function(){}),pi=i(["pie","onmouseout"],function(){}),qi=i(["donut","label","show"],!0),ri=i(["donut","label","format"]),si=i(["donut","expand"],!0),ti=i(["donut","title"],""),ui=i(["donut","onclick"],function(){}),vi=i(["donut","onmouseover"],function(){}),wi=i(["donut","onmouseout"],function(){}),xi=i(["regions"],[]),yi=i(["tooltip","show"],!0),zi=i(["tooltip","format","title"]),Ai=i(["tooltip","format","value"]),Bi=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=zi?zi:b,l=Ai?Ai:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Ci=i(["tooltip","init","show"],!1),Di=i(["tooltip","init","x"],0),Ei=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Fi=("string"==typeof Jf?Jf.replace("#",""):Jf.id)+"-clip",Gi=Fi+"-xaxis",Hi=Fi+"-yaxis",Ii=j(Fi),Ji=j(Gi),Ki=j(Hi),Li="timeseries"===oh,Mi="categorized"===oh,Ni=!Li&&(Eg||Ce(Fg)),Oi=null,Pi=!1,Qi=!1,Ri=!1,Si=!1,Ti=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ui=we(Sg,Ce(fh)?fh:Ti,Rg),Vi=ph?Gf.time.format:Gf.time.format.utc,Wi=function(){var a=[[Vi("%Y/%-m/%-d"),function(){return!0}],[Vi("%-m/%-d"),function(a){return a.getMonth()}],[Vi("%-m/%-d"),function(a){return 1!==a.getDate()}],[Vi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Vi("%I %p"),function(a){return a.getHours()}],[Vi("%I:%M"),function(a){return a.getMinutes()}],[Vi(":%S"),function(a){return a.getSeconds()}],[Vi(".%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)}}(),Xi=[],Yi=[],Zi=mh?"left":"bottom",$i=mh?Kh?"top":"bottom":Kh?"right":"left",_i=mh?Th?"bottom":"top":Th?"left":"right",aj=mh?"left":"bottom",bj={main:function(){return"translate("+Yf.left+","+Yf.top+")"},context:function(){return"translate("+Zf.left+","+Zf.top+")"},legend:function(){return"translate("+$f.left+","+$f.top+")"},x:function(){return"translate(0,"+(mh?0:bg)+")"},y:function(){return"translate(0,"+(mh?bg:0)+")"},y2:function(){return"translate("+(mh?0:_f)+","+(mh?1:0)+")"},subx:function(){return"translate(0,"+(mh?0:cg)+")"},arc:function(){return"translate("+_f/2+","+bg/2+")"}},cj="right"===hh,dj=0,ej=0,fj=0,gj=.15,hj=30,ij=mh&&!nh?0:30,jj=5;lg=Gf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var kj,lj=function(){var a=Gf.svg.line().x(mh?function(a){return W(a.id)(a.value) }:Fd).y(mh?Fd:function(a){return W(a.id)(a.value)});return hi||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=hi?Oe(b.values):b.values;return je(b)?(a.interpolate(ke(b)?"cardinal":"linear"),Qg[b.id]?bf(e,ug,W(b.id),Qg[b.id]):a(e)):(c=e[0]?ug(e[0].x):0,d=e[0]?W(b.id)(e[0].value):0,mh?"M "+d+" "+c:"M "+c+" "+d)}}(),mj=function(){var a;return a=mh?Gf.svg.area().x0(function(a){return W(a.id)(0)}).x1(function(a){return W(a.id)(a.value)}).y(Fd):Gf.svg.area().x(Fd).y0(function(a){return W(a.id)(0)}).y1(function(a){return W(a.id)(a.value)}),function(b){var c,d,e=Oe(b.values);return de([b],"area")||de([b],"area-spline")?(a.interpolate(ke(b)?"cardinal":"linear"),a(e)):(c=e[0]?ug(e[0].x):0,d=e[0]?W(b.id)(e[0].value):0,mh?"M "+d+" "+c:"M "+c+" "+d)}}(),nj=function(){var a=Gf.svg.line().x(mh?function(a){return X(a.id)(a.value)}:Id).y(mh?Id:function(a){return X(a.id)(a.value)});return function(b){var c=Oe(b.values);return je(b)?a(c):"M "+xg(c[0].x)+" "+X(b.id)(c[0].value)}}(),oj=function(){};kj=Gf.svg.brush().on("brush",mf),kj.update=function(){return sj&&sj.select("."+g.brush).call(this),this},kj.scale=function(a){return mh?this.y(a):this.x(a)},Qf&&(oj=Gf.behavior.zoom().on("zoomstart",function(){oj.altDomain=Gf.event.sourceEvent.altKey?ug.orgDomain():null}).on("zoom",Qf?nf:null),oj.scale=function(a){return mh?this.y(a):this.x(a)},oj.orgScaleExtent=function(){var a=Rf?Rf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},oj.updateScaleExtent=function(){var a=ac(ug.orgDomain())/ac(wj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var pj,qj,rj,sj,tj,uj,vj,wj,xj,yj={};if(Hf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=pj.selectAll(pd(a)),d=c.filter(Cf),e=c.filter(Df);Hf.revert(),Hf.defocus(),b(d.classed(g.focused,!0)),b(e),ie(Hf.data.targets)&&Nb(a,!0),xf(a,!0)},Hf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=pj.selectAll(pd(a)),d=c.filter(Cf),e=c.filter(Df);Hf.revert(),b(d.classed(g.focused,!1)),b(e),ie(Hf.data.targets)&&Ob(a),xf(a,!1)},Hf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=pj.selectAll(pd(a)),d=c.filter(Cf),e=c.filter(Df);b(d.classed(g.focused,!1)),b(e),ie(Hf.data.targets)&&Ob(a),yf()},Hf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),pj.selectAll(qd(a)).transition().style("opacity",1),b.withLegend&&zf(a),lf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Hf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),pj.selectAll(qd(a)).transition().style("opacity",0),b.withLegend&&Af(a),lf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Hf.toggle=function(a){Gc(a)?Hf.hide(a):Hf.show(a)},Hf.unzoom=function(){kj.clear().update(),lf({withUpdateXDomain:!0})},Hf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Jg[b]=a.classes[b]}),"categories"in a&&Mi&&(qh=a.categories,Ag.categories(qh)),"cacheIds"in a&&bc(a.cacheIds)?void sf(dc(a.cacheIds),a.done):void("unload"in a?uf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){tf(a)}):tf(a))},Hf.unload=function(a,b){uf(Dc(a),function(){lf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Hf.selected=function(a){return Gf.merge(rj.selectAll("."+g.shapes+od(a)).selectAll("."+g.shape).filter(function(){return Gf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Hf.select=function(a,b,c){Ug&&rj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Gf.select(this),i=e.data?e.data.id:e.id,j=Ne(this),k=Vg||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);k&&l?Wg(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f)})},Hf.unselect=function(a,b){Ug&&rj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Gf.select(this),f=c.data?c.data.id:c.id,h=Ne(this),i=Vg||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);i&&j&&Wg(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Hf.toLine=function(a){Ff(a,"line")},Hf.toSpline=function(a){Ff(a,"spline")},Hf.toBar=function(a){Ff(a,"bar")},Hf.toScatter=function(a){Ff(a,"scatter")},Hf.toArea=function(a){Ff(a,"area")},Hf.toAreaSpline=function(a){Ff(a,"area-spline")},Hf.toPie=function(a){Ff(a,"pie",{withTransform:!0})},Hf.toDonut=function(a){Ff(a,"donut",{withTransform:!0})},Hf.groups=function(a){return c(a)?Kg:(Kg=a,lf(),Kg)},Hf.xgrids=function(a){return a?(Zh=a,lf(),Zh):Zh},Hf.xgrids.add=function(a){return a?Hf.xgrids(Zh.concat(a)):void 0},Hf.xgrids.remove=function(a){var b=Ef(a);return Hf.xgrids(Zh.filter(b))},Hf.ygrids=function(a){return a?(_h=a,lf(),_h):_h},Hf.ygrids.add=function(a){return a?Hf.ygrids(_h.concat(a)):void 0},Hf.ygrids.remove=function(a){var b=Ef(a);return Hf.ygrids(_h.filter(b))},Hf.regions=function(a){return c(a)?xi:(xi=a,lf(),xi)},Hf.regions.add=function(a){return c(a)?xi:(xi=xi.concat(a),lf(),xi)},Hf.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;pj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),xi=xi.filter(function(b){return b.classes.indexOf(a)<0})}),xi},Hf.data.get=function(a){var b=Hf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Hf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},Hf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Ig[b]=a[b]}),lf({withLegend:!0}),Ig):Ig},Hf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Sg[b]=a[b]}),lf({withLegend:!0}),Sg):Sg},Hf.x=function(a){return arguments.length&&(qc(Hf.data.targets,a),lf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Hf.data.xs},Hf.xs=function(a){return arguments.length&&(rc(Hf.data.targets,a),lf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Hf.data.xs},Hf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){cb(b,a[b])}),Eb())},Hf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(zh=+a.x),b(a.y)&&(Gh=+a.y),b(a.y2)&&(Ph=+a.y2)):Gh=Ph=+a,lf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Hf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Ah=+a.x),b(a.y)&&(Hh=+a.y),b(a.y2)&&(Qh=+a.y2)):Hh=Qh=+a,lf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Hf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Hf.axis.max(a.max),"undefined"!=typeof a.min&&Hf.axis.min(a.min))},Hf.legend.show=function(a){zf(Dc(a)),lf({withLegend:!0})},Hf.legend.hide=function(a){Af(Dc(a)),lf({withLegend:!0})},Hf.resize=function(a){Kf=a?a.width:null,Lf=a?a.height:null,qf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Hf.destroy=function(){Hf.data.targets=void 0,Hf.data.xs={},vj.html(""),a.onresize=null},"url"in f.data)Gf.xhr(f.data.url,function(a,b){var c,d=Gf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Gf.csv.parse(b.response),cf(c)});else if("rows"in f.data)cf(tc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");cf(uc(f.data.columns))}return Hf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(window); \ No newline at end of file From 1e727864d016c72c90e9579ce5cf2b6df4bc2467 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Tue, 6 May 2014 22:12:38 +0900 Subject: [PATCH 139/178] Remove Math.ceil for height2 and define function for half pixel - #213 --- c3.js | 10 +++++++--- c3.min.js | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/c3.js b/c3.js index 5cde95e..066a8a0 100644 --- a/c3.js +++ b/c3.js @@ -336,13 +336,13 @@ subXOrient = __axis_rotated ? "left" : "bottom"; var translate = { - main : function () { return "translate(" + (Math.ceil(margin.left) + 0.5) + "," + (Math.ceil(margin.top) + 0.5) + ")"; }, - context : function () { return "translate(" + (Math.ceil(margin2.left) + 0.5) + "," + (Math.ceil(margin2.top) + 0.5) + ")"; }, + main : function () { return "translate(" + asHalfPixel(margin.left) + "," + asHalfPixel(margin.top) + ")"; }, + context : function () { return "translate(" + asHalfPixel(margin2.left) + "," + asHalfPixel(margin2.top) + ")"; }, legend : function () { return "translate(" + margin3.left + "," + margin3.top + ")"; }, x : function () { return "translate(0," + (__axis_rotated ? 0 : height) + ")"; }, y : function () { return "translate(0," + (__axis_rotated ? height : 0) + ")"; }, y2 : function () { return "translate(" + (__axis_rotated ? 0 : width) + "," + (__axis_rotated ? 1 : 0) + ")"; }, - subx : function () { return "translate(0," + (__axis_rotated ? 0 : Math.ceil(height2)) + ")"; }, + subx : function () { return "translate(0," + (__axis_rotated ? 0 : height2) + ")"; }, arc: function () { return "translate(" + width / 2 + "," + height / 2 + ")"; } }; @@ -355,6 +355,10 @@ return "url(" + document.URL.split('#')[0] + "#" + id + ")"; } + function asHalfPixel(n) { + return Math.ceil(n) + 0.5; + } + function transformMain(withTransition, transitions) { var xAxis, yAxis, y2Axis; if (transitions && transitions.axisX) { diff --git a/c3.min.js b/c3.min.js index 9465a89..316fe0e 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.ceil(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.ceil(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&aag&&(ag=0),0>cg&&(cg=0),bg=nh?Zf.left-ij-jj:ag,dg=nh?cg:fg-$f.top-$f.bottom,0>bg&&(bg=0),0>dg&&(dg=0),r(),dj&&je(If.data.targets)&&(_f.left=ag/2+hg)}function q(){sj.select("line."+g.xgridFocus).attr("x1",nh?0:-10).attr("x2",nh?ag:-10).attr("y1",nh?-10:Zf.top).attr("y2",nh?-10:cg)}function r(){hg=cg/2,gg=.95*hg,ig=ie(If.data.targets)?.6*gg:0}function s(){var a=nh?g.axisX:g.axisY,b=sj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Hf.select(Kf).node().getBoundingClientRect(),e=c.right-d.left-v();return e>0?e:0}function t(){return Lf?Lf:z()}function u(){var a=Mf?Mf:A();return a>0?a:320}function v(){return je(If.data.targets)?0:Nf?Nf:nh?oh?x("x"):1:!Gh||Lh?1:x("y")}function w(){var a=1;return je(If.data.targets)?0:Of?Of:dj?R()+20+(Ph&&!nh?x("y2"):a):Ph?Uh||nh?a:x("y2"):a}function x(a){var b=lb(a);return b.isInner?20+Eb(a):40+Eb(a)}function y(a){return"x"!==a||oh?"x"===a&&Dh?Dh:"y"!==a||Gh?"y2"!==a||Ph?(lb(a).isInner?30:40)+("y2"===a?-10:0):kj:hh&&!dj?10:1:0}function z(){return+Hf.select(Kf).style("width").replace("px","")}function A(){return+Hf.select(Kf).style("height").replace("px","")}function B(a){return a?-5:-(Zf.left-1)}function C(a){return a?-20:-4}function D(){return B(!nh)}function E(){return C(!nh)}function F(){return B(nh)}function G(){return C(nh)}function H(a){return a?ag+2+4:Zf.left+20}function I(a){return a?(Dh?Dh:0)+80:cg+8}function J(){return H(!nh)}function K(){return I(!nh)}function L(){return H(nh)}function M(){return I(nh)}function N(){var a,b,c,d,e,f=Bc(If.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=vg(b.x)-vg(a.x),0===c?nh?cg:ag:(d=Ac(),e=fe(If.data.targets)?(d-(Ni?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function O(a){ej=a}function P(a){fj=a}function Q(a){gj=a}function R(){return hh?dj?fj*(ej+1):eg:0}function S(){return hh?dj?fg:gj*(ej+1):0}function T(){var a,b,c=!vg;ng=nh?1:0,og=nh?cg:ag,pg=nh?0:cg,qg=nh?ag:1,rg=ng,sg=og,tg=nh?0:dg,ug=nh?bg:1,vg=V(ng,og,c?void 0:vg.domain(),function(){return Bg.tickOffset()}),wg=W(pg,qg,c?void 0:wg.domain()),xg=W(pg,qg,c?void 0:xg.domain()),yg=V(ng,og,xj,function(a){return a%1?0:Eg.tickOffset()}),zg=W(tg,ug,c?void 0:zg.domain()),Ag=W(tg,ug,c?void 0:Ag.domain()),a=ab(),b=yh?yh:c?void 0:Bg.tickValues(),Bg=Z(vg,$i,a,b),Eg=Z(yg,bj,a,b),Cg=$(wg,_i,Mh,Oh),Dg=$(xg,aj,Vh,Xh),c||(lj.scale(yg),Rf&&pj.scale(vg)),U()}function U(){jg=Hb(),kg=Ib(),lg=Ib(.98)}function V(a,b,c,d){var e,f=(Mi?Hf.time.scale():Hf.scale.linear()).range([a,b]),g=c?f.domain(c):f;Ni?(d=d||function(){return 0},f=function(a){return Math.ceil(g(a)+d(a))}):f=function(a){return Math.ceil(g(a))};for(e in g)f[e]=g[e];return f.orgDomain=function(){return g.domain()},Ni&&(f.domain=function(a){return arguments.length?(g.domain(a),f):(a=g.domain(),[a[0],a[1]+1])}),f}function W(a,b,c){var d=Hf.scale.linear().range([a,b]);return c&&d.domain(c),d}function X(a){return"y2"===_(a)?xg:wg}function Y(a){return"y2"===_(a)?Ag:zg}function Z(a,b,c,d){var f=e(Hf,Ni).scale(a).orient(b);return f.tickFormat(c).tickValues(d),Ni?(f.tickCentered(sh),Ce(uh)&&(uh=!1),f.categories(rh)):f.tickOffset=function(){var a=Cc(If.data.targets),b=vg(a[1])-vg(a[0]),c=b?b:nh?cg:ag;return c/Ac()/2},f}function $(a,b,c,d){return e(Hf).scale(a).orient(b).tickFormat(c).ticks(d)}function _(a){return a in Mg?Mg[a]:"y"}function ab(){var a=Mi?Xi:Ni?Uc:function(a){return 0>a?a.toFixed(0):a};return th&&("function"==typeof th?a=th:Mi&&(a=function(a){return a?Wi(th)(a):""})),a}function bb(a){var b;return"y"===a?b=Kh:"y2"===a?b=Th:"x"===a&&(b=Fh),b}function cb(a){var b=bb(a);return"string"==typeof b?b:b?b.text:null}function db(a,b){var c=bb(a);"string"==typeof c?"y"===a?Kh=b:"y2"===a?Th=b:"x"===a&&(Fh=b):c&&(c.text=b)}function eb(a){return 10*Math.sin(Math.PI*(a/180))}function fb(a){return 11.5-2.5*(a/15)}function gb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",fb(c)).attr("x",eb(c)).attr("transform","rotate("+c+")")}function hb(a,b){var c=bb(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 ib(){return hb("x",nh?"inner-top":"inner-right")}function jb(){return hb("y",nh?"inner-right":"inner-top")}function kb(){return hb("y2",nh?"inner-right":"inner-top")}function lb(a){return"y2"===a?kb():"y"===a?jb():ib()}function mb(){return cb("x")}function nb(){return cb("y")}function ob(){return cb("y2")}function pb(a,b){return a?b.isLeft?0:b.isCenter?ag/2:ag:b.isBottom?-cg:b.isMiddle?-cg/2:0}function qb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function rb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function sb(){return pb(!nh,ib())}function tb(){return pb(nh,jb())}function ub(){return pb(nh,kb())}function vb(){return qb(!nh,ib())}function wb(){return qb(nh,jb())}function xb(){return qb(nh,kb())}function yb(){var a=ib();return nh?a.isInner?"1.2em":-25-Eb("x"):a.isInner?"-0.5em":Dh?Dh-10:"3em"}function zb(){var a=jb();return nh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Eb("y")}function Ab(){var a=kb();return nh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Eb("y2")}function Bb(){return rb(!nh,ib())}function Cb(){return rb(nh,jb())}function Db(){return rb(nh,kb())}function Eb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Hf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Fb(a){var b=sj.select("."+g.axisX+" ."+g.axisXLabel),c=sj.select("."+g.axisY+" ."+g.axisYLabel),d=sj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb),(a?c.transition():c).attr("x",tb).attr("dx",wb).attr("dy",zb).attr("dy",zb).text(nb),(a?d.transition():d).attr("x",ub).attr("dx",xb).attr("dy",Ab).text(ob)}function Gb(a){var b=!1;return mg(Jc(If.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Hb(){var a=Hf.svg.arc().outerRadius(gg).innerRadius(ig),b=function(b,c){var d;return c?a(b):(d=Gb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Ib(a){var b=Hf.svg.arc().outerRadius(hg*(a?a:1)).innerRadius(ig);return function(a){var c=Gb(a);return c?b(c):"M 0 0"}}function Jb(a,b){return qe(a.data)?jg(a,b):"M 0 0"}function Kb(a){var b,c,d,e,f=Gb(a),g="";return f&&(b=jg.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*gg*.8+","+d/e*gg*.8+")"),g}function Lb(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Mb(a){return qc({id:a.data.id,value:a.value,ratio:Lb(a)})}function Nb(a){var b,c,d,e;return Qb()?(b=Gb(a),c=b?b.value:null,d=Lb(b),e=Rb(),e?e(c,d):Ed(c,d)):""}function Ob(a,b){var c=qj.selectAll("."+g.chartArc+qd(a)),d=qj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});we(a)&&c.selectAll("path").transition().duration(50).attr("d",kg).transition().duration(100).attr("d",lg).each(function(a){pe(a.data)}),b||d.style("opacity",.3)}function Pb(a){var b=qj.selectAll("."+g.chartArc+qd(a));b.selectAll("path").transition().duration(50).attr("d",jg),qj.selectAll("."+g.arc).style("opacity",1)}function Qb(){return ie(If.data.targets)?ri:li}function Rb(){return ie(If.data.targets)?si:mi}function Sb(){return ie(If.data.targets)?ui:""}function Tb(){var a=ie(If.data.targets)?vi:oi;return"function"==typeof a?a:function(){}}function Ub(){var a=ie(If.data.targets)?wi:pi;return"function"==typeof a?a:function(){}}function Vb(){var a=ie(If.data.targets)?xi:qi;return"function"==typeof a?a:function(){}}function Wb(a){var b,c,d,e,f,g,h=Dc(a),i=Qc(a);if(Lg.length>0)for(g=Sc(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 Hf.min(Object.keys(i).map(function(a){return Hf.min(i[a])}))}function Xb(a){var b,c,d,e,f,g,h=Dc(a),i=Qc(a);if(Lg.length>0)for(g=Tc(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 Hf.max(Object.keys(i).map(function(a){return Hf.max(i[a])}))}function Yb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return _(a.id)===c}),m="y2"===c?Rh:Ih,n="y2"===c?Qh:Hh,o=b(m)?m:Wb(l),p=b(n)?n:Xb(l),q="y2"===c?Sh:Jh,r=yd()&&nh;return 0===l.length?"y2"===c?xg.domain():wg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=zd(o,p),j=bc(wg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Nh&&(f=b(Nh.top)?Nh.top:e,g=b(Nh.bottom)?Nh.bottom:e),"y2"===c&&Wh&&(f=b(Wh.top)?Wh.top:e,g=b(Wh.bottom)?Wh.bottom:e),fe(l)&&!Sc(l)&&(g=o),[o-g,p+f])}function Zb(a){return Bh?Mi?ye(Bh):Bh:Hf.min(a,function(a){return Hf.min(a.values,function(a){return a.x})})}function $b(a){return Ah?Mi?ye(Ah):Ah:Hf.max(a,function(a){return Hf.max(a.values,function(a){return a.x})})}function _b(a){var c,d,e,f,g=Cc(a),h=g[1]-g[0];return Ni?d=0:fe(a)?(c=Ac(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Ch&&De(Ch)?(e=b(Ch.left)?Ch.left:d,f=b(Ch.right)?Ch.right:d):e=f="number"==typeof Ch?Ch:d,{left:e,right:f}}function ac(a){var b=[Zb(a),$b(a)],c=b[0],d=b[1],e=_b(a),f=0,g=0;return c-d!==0||Ni||(c=Mi?new Date(.5*c.getTime()):-.5,d=Mi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Mi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Mi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function bc(a){return a[1]-a[0]}function cc(a){for(var b=0;bb?0:b-c}function ic(a){var b,c=gc(a),d="y"===a.axis?wg:xg;return b="y"===a.axis||"y2"===a.axis?nh?cg:"start"in a?d(a.start):cg:nh?"end"in a?vg(Mi?ye(a.end):a.end):cg:cg,c>b?0:b-c}function jc(a){return Fg&&a===Fg||De(Gg)&&Ee(Gg,a)}function kc(a){return!jc(a)}function lc(a){return Fg?Fg:De(Gg)?Gg[a]:null}function mc(a,b){var c,d=b&&De(b)?Dc(b):[];return d.forEach(function(b){lc(b)===a&&(c=If.data.xs[b])}),c}function nc(a,b){return a in If.data.xs&&If.data.xs[a]&&If.data.xs[a][b]?If.data.xs[a][b]:b}function oc(a){Object.keys(a).forEach(function(b){Gg[b]=a[b]})}function pc(a){return 1===Hf.set(Object.keys(a).map(function(b){return a[b]})).size()}function qc(a){var b;return a&&(b=Jg[a.id],a.name=b?b:a.id),a}function rc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=tc(b[d],a.id,d)}),If.data.xs[a.id]=b})}function sc(a,b){a.forEach(function(a){b[a.id]&&rc([a],b[a.id])})}function tc(a,c,d){var e;return e=Mi?a?a instanceof Date?a:ye(a):ye(nc(c,d)):Oi&&!Ni?b(a)?+a:nc(c,d):d}function uc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?If.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Fg?(d=Object.keys(If.data.xs),If.data.xs[c]=d.length>0?If.data.xs[d[0]]:void 0):De(Gg)&&(If.data.xs[c]=mc(f,If.data.targets)):If.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!If.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Ig(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=lc(b),g=a[f],h=tc(g,b,e);return Oi&&Ni&&0===c&&g&&(0===e&&(rh=[]),rh.push(g)),("undefined"==typeof a[b]||If.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ng&&de(Dc(c).filter(function(a){return!(a in Og)}),Ng),c.forEach(function(a){dc(a.id_org,a)}),c}function xc(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 yc(a){return a>0&&If.data.targets[0].values[a-1]?If.data.targets[0].values[a-1].x:void 0}function zc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Cc(a){var b,c,d=Bc(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Dc(a){return a.map(function(a){return a.id})}function Ec(a){return a?"string"==typeof a?[a]:a:Dc(If.data.targets)}function Fc(a,b){var c,d=Dc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Mi?new Date(i):i);j.push(e)}return Mi||(j=j.sort(function(a,b){return a-b})),j}function Mc(a){Yi=Yi.concat(a)}function Nc(a){Yi=Yi.filter(function(b){return a.indexOf(b)<0})}function Oc(a){Zi=Zi.concat(a)}function Pc(a){Zi=Zi.filter(function(b){return a.indexOf(b)<0})}function Qc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Rc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Tc(a){return Rc(a,function(a){return a>0})}function Uc(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||0===a[f].x)&&(e=e.concat(Kd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Kd(a,g))),Nd(e,b)):Ld(a,b,f,g)}function Md(a,b){var c;return c=a.map(function(a){return Ld(a.values,b)}),Nd(c,b)}function Nd(a,b){var c,d;return a.forEach(function(a){var e=Fe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Od(a,b){return Hf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Pd(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 Qd(){return Qg&&"desc"===Qg.toLowerCase()}function Rd(){return Qg&&"asc"===Qg.toLowerCase()}function Sd(a){var b=Rd(),c=Qd();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 Qg&&a.sort(Qg),a}function Td(a,c){var d,e,f,g,h,i,j,k=je(If.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&zi&&(vj.html(Ci(a,ab(),Ad(k),Vi)).style("display","block"),d=vj.property("offsetWidth"),e=vj.property("offsetHeight"),k?(g=ag/2+c[0],i=cg/2+c[1]+20):(nh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-w(),i=vg(l[0].x)+20):(f=s(),g=f+v()+vg(l[0].x)+20,h=g+d,j=f+t()-w(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),vj.style("top",i+"px").style("left",g+"px"))}function Ud(){vj.style("display","none")}function Vd(a){var c=a.filter(function(a){return a&&b(a.value)});if(zi&&!ge(If.data.targets)&&!je(If.data.targets)){var d=sj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(nh?"y1":"x1",Gd).attr(nh?"y2":"x2",Gd),lf(d,"grid")}}function Wd(){sj.select("line."+g.xgridFocus).style("visibility","hidden")}function Xd(a,b){var c,d,e,f,g=[];if("year"===a)for(c=ac(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)g.push(new Date(f+"-01-01 00:00:00"));else g=b.ticks(10);return g}function Yd(a){return a.x||0===a.x?vg(a.x):null}function Zd(a){return X(a.id)(a.value)}function $d(){var a,b,d={},e=0;return Jc(Gc(me)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ce(a,b){return"number"==typeof ji?ji:b?2*a.tickOffset()*ki/b:0}function de(a,b){Ec(a).forEach(function(a){zj[a]=b===Og[a],Og[a]=b})}function ee(a,b){var c=!1;return a.forEach(function(a){Og[a.id]===b&&(c=!0),a.id in Og||"line"!==b||(c=!0)}),c}function fe(a){return ee(a,"bar")}function ge(a){return ee(a,"scatter")}function he(a){return ee(a,"pie")}function ie(a){return ee(a,"donut")}function je(a){return he(a)||ie(a)}function ke(a){var b="string"==typeof a?a:a.id;return!(b in Og)||"line"===Og[b]||"spline"===Og[b]||"area"===Og[b]||"area-spline"===Og[b]}function le(a){var b="string"==typeof a?a:a.id;return"spline"===Og[b]||"area-spline"===Og[b]}function me(a){var b="string"==typeof a?a:a.id;return"bar"===Og[b]}function ne(a){var b="string"==typeof a?a:a.id;return"scatter"===Og[b]}function oe(a){var b="string"==typeof a?a:a.id;return"pie"===Og[b]}function pe(a){var b="string"==typeof a?a:a.id;return"donut"===Og[b]}function qe(a){return oe(a)||pe(a)}function re(a){return ke(a)?[a]:[]}function se(a){return qe(a.data)?[a]:[]}function te(a){return me(a)?a.values:[]}function ue(a){return ke(a)||ne(a)?a.values:[]}function ve(a){return me(a)||ke(a)?a.values:[]}function we(a){return pe(a)&&ti||oe(a)&&ni}function xe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ye(b){var c;try{c=Hg?Hf.time.format(Hg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Hg)}return c}function ze(a,b){var c=Hf.mouse(a),d=Hf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ee(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Fe(a,b){var c="y"===_(a.id)?wg:xg,d=nh?1:0,e=nh?0:1;return Math.pow(vg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ge(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function He(a,b,c){ah(b,a.node()),sj.select("."+g.selectedCircles+pd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Vc(g.selectedCircle,c)}).attr("cx",nh?Zd:Yd).attr("cy",nh?Yd:Zd).attr("stroke",function(){return Vi(b)}).attr("r",1.4*Se(b)).transition().duration(100).attr("r",Se)}function Ie(a,b,c){bh(b,a.node()),sj.select("."+g.selectedCircles+pd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Je(a,b,c,d){a?He(b,c,d):Ie(b,c,d)}function Ke(a,b){ah(b,a.node()),a.transition().duration(100).style("fill",function(){return Hf.rgb(Vi(b)).brighter(.75)})}function Le(a,b){bh(b,a.node()),a.transition().duration(100).style("fill",function(){return Vi(b)})}function Me(a,b,c,d){a?Ke(b,c,d):Le(b,c,d)}function Ne(a,b,c,d){Me(a,b,c.data,d)}function Oe(a){return"circle"===a.nodeName?Je:Hf.select(a).classed(g.bar)?Me:Ne}function Pe(a){return a.filter(function(a){return b(a.value)})}function Qe(a){return ci?"function"==typeof di?di(a):di:0}function Re(a){return fi?gi?gi:1.75*Qe(a):Qe(a)}function Se(a){return hi?hi:4*Qe(a)}function Te(a,c){return(c?sj.selectAll("."+g.circles+pd(c)):sj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ue(a,b){Te(a,b).classed(g.EXPANDED,!0).attr("r",Re)}function Ve(a){Te(a).filter(function(){return Hf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Qe)}function We(a){return sj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function Xe(a){We(a).classed(g.EXPANDED,!0)}function Ye(a){We(a).classed(g.EXPANDED,!1)}function Ze(a,b){var c=bf(a,b);return function(a,b){var d=c(a,b),e=nh?1:0,f=nh?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 $e(a,b){var c=bf(a,!1),d=b?_e:af;return function(a,b){return d(c(a,b),a,this)}}function _e(a,b){var c;return nh?(c=me(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function af(a,b,c){var d=c.getBoundingClientRect();return nh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:me(b)?-3:-6)}function bf(a,b){var c=a.__max__+1,d=ce(Bg,c),e=_d(d,c,a,!!b),f=ae(!!b),g=be(a,!!b),h=b?Y:X;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return nh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function cf(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;gb?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&aag&&(ag=0),0>cg&&(cg=0),bg=nh?Zf.left-ij-jj:ag,dg=nh?cg:fg-$f.top-$f.bottom,0>bg&&(bg=0),0>dg&&(dg=0),r(),dj&&je(If.data.targets)&&(_f.left=ag/2+hg)}function q(){sj.select("line."+g.xgridFocus).attr("x1",nh?0:-10).attr("x2",nh?ag:-10).attr("y1",nh?-10:Zf.top).attr("y2",nh?-10:cg)}function r(){hg=cg/2,gg=.95*hg,ig=ie(If.data.targets)?.6*gg:0}function s(){var a=nh?g.axisX:g.axisY,b=sj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Hf.select(Kf).node().getBoundingClientRect(),e=c.right-d.left-v();return e>0?e:0}function t(){return Lf?Lf:z()}function u(){var a=Mf?Mf:A();return a>0?a:320}function v(){return je(If.data.targets)?0:Nf?Nf:nh?oh?x("x"):1:!Gh||Lh?1:x("y")}function w(){var a=1;return je(If.data.targets)?0:Of?Of:dj?R()+20+(Ph&&!nh?x("y2"):a):Ph?Uh||nh?a:x("y2"):a}function x(a){var b=lb(a);return b.isInner?20+Eb(a):40+Eb(a)}function y(a){return"x"!==a||oh?"x"===a&&Dh?Dh:"y"!==a||Gh?"y2"!==a||Ph?(lb(a).isInner?30:40)+("y2"===a?-10:0):kj:hh&&!dj?10:1:0}function z(){return+Hf.select(Kf).style("width").replace("px","")}function A(){return+Hf.select(Kf).style("height").replace("px","")}function B(a){return a?-5:-(Zf.left-1)}function C(a){return a?-20:-4}function D(){return B(!nh)}function E(){return C(!nh)}function F(){return B(nh)}function G(){return C(nh)}function H(a){return a?ag+2+4:Zf.left+20}function I(a){return a?(Dh?Dh:0)+80:cg+8}function J(){return H(!nh)}function K(){return I(!nh)}function L(){return H(nh)}function M(){return I(nh)}function N(){var a,b,c,d,e,f=Bc(If.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=vg(b.x)-vg(a.x),0===c?nh?cg:ag:(d=Ac(),e=fe(If.data.targets)?(d-(Ni?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function O(a){ej=a}function P(a){fj=a}function Q(a){gj=a}function R(){return hh?dj?fj*(ej+1):eg:0}function S(){return hh?dj?fg:gj*(ej+1):0}function T(){var a,b,c=!vg;ng=nh?1:0,og=nh?cg:ag,pg=nh?0:cg,qg=nh?ag:1,rg=ng,sg=og,tg=nh?0:dg,ug=nh?bg:1,vg=V(ng,og,c?void 0:vg.domain(),function(){return Bg.tickOffset()}),wg=W(pg,qg,c?void 0:wg.domain()),xg=W(pg,qg,c?void 0:xg.domain()),yg=V(ng,og,xj,function(a){return a%1?0:Eg.tickOffset()}),zg=W(tg,ug,c?void 0:zg.domain()),Ag=W(tg,ug,c?void 0:Ag.domain()),a=ab(),b=yh?yh:c?void 0:Bg.tickValues(),Bg=Z(vg,$i,a,b),Eg=Z(yg,bj,a,b),Cg=$(wg,_i,Mh,Oh),Dg=$(xg,aj,Vh,Xh),c||(lj.scale(yg),Rf&&pj.scale(vg)),U()}function U(){jg=Hb(),kg=Ib(),lg=Ib(.98)}function V(a,b,c,d){var e,f=(Mi?Hf.time.scale():Hf.scale.linear()).range([a,b]),g=c?f.domain(c):f;Ni?(d=d||function(){return 0},f=function(a){return Math.ceil(g(a)+d(a))}):f=function(a){return Math.ceil(g(a))};for(e in g)f[e]=g[e];return f.orgDomain=function(){return g.domain()},Ni&&(f.domain=function(a){return arguments.length?(g.domain(a),f):(a=g.domain(),[a[0],a[1]+1])}),f}function W(a,b,c){var d=Hf.scale.linear().range([a,b]);return c&&d.domain(c),d}function X(a){return"y2"===_(a)?xg:wg}function Y(a){return"y2"===_(a)?Ag:zg}function Z(a,b,c,d){var f=e(Hf,Ni).scale(a).orient(b);return f.tickFormat(c).tickValues(d),Ni?(f.tickCentered(sh),Ce(uh)&&(uh=!1),f.categories(rh)):f.tickOffset=function(){var a=Cc(If.data.targets),b=vg(a[1])-vg(a[0]),c=b?b:nh?cg:ag;return c/Ac()/2},f}function $(a,b,c,d){return e(Hf).scale(a).orient(b).tickFormat(c).ticks(d)}function _(a){return a in Mg?Mg[a]:"y"}function ab(){var a=Mi?Xi:Ni?Uc:function(a){return 0>a?a.toFixed(0):a};return th&&("function"==typeof th?a=th:Mi&&(a=function(a){return a?Wi(th)(a):""})),a}function bb(a){var b;return"y"===a?b=Kh:"y2"===a?b=Th:"x"===a&&(b=Fh),b}function cb(a){var b=bb(a);return"string"==typeof b?b:b?b.text:null}function db(a,b){var c=bb(a);"string"==typeof c?"y"===a?Kh=b:"y2"===a?Th=b:"x"===a&&(Fh=b):c&&(c.text=b)}function eb(a){return 10*Math.sin(Math.PI*(a/180))}function fb(a){return 11.5-2.5*(a/15)}function gb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",fb(c)).attr("x",eb(c)).attr("transform","rotate("+c+")")}function hb(a,b){var c=bb(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 ib(){return hb("x",nh?"inner-top":"inner-right")}function jb(){return hb("y",nh?"inner-right":"inner-top")}function kb(){return hb("y2",nh?"inner-right":"inner-top")}function lb(a){return"y2"===a?kb():"y"===a?jb():ib()}function mb(){return cb("x")}function nb(){return cb("y")}function ob(){return cb("y2")}function pb(a,b){return a?b.isLeft?0:b.isCenter?ag/2:ag:b.isBottom?-cg:b.isMiddle?-cg/2:0}function qb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function rb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function sb(){return pb(!nh,ib())}function tb(){return pb(nh,jb())}function ub(){return pb(nh,kb())}function vb(){return qb(!nh,ib())}function wb(){return qb(nh,jb())}function xb(){return qb(nh,kb())}function yb(){var a=ib();return nh?a.isInner?"1.2em":-25-Eb("x"):a.isInner?"-0.5em":Dh?Dh-10:"3em"}function zb(){var a=jb();return nh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Eb("y")}function Ab(){var a=kb();return nh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Eb("y2")}function Bb(){return rb(!nh,ib())}function Cb(){return rb(nh,jb())}function Db(){return rb(nh,kb())}function Eb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Hf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Fb(a){var b=sj.select("."+g.axisX+" ."+g.axisXLabel),c=sj.select("."+g.axisY+" ."+g.axisYLabel),d=sj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb),(a?c.transition():c).attr("x",tb).attr("dx",wb).attr("dy",zb).attr("dy",zb).text(nb),(a?d.transition():d).attr("x",ub).attr("dx",xb).attr("dy",Ab).text(ob)}function Gb(a){var b=!1;return mg(Jc(If.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Hb(){var a=Hf.svg.arc().outerRadius(gg).innerRadius(ig),b=function(b,c){var d;return c?a(b):(d=Gb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Ib(a){var b=Hf.svg.arc().outerRadius(hg*(a?a:1)).innerRadius(ig);return function(a){var c=Gb(a);return c?b(c):"M 0 0"}}function Jb(a,b){return qe(a.data)?jg(a,b):"M 0 0"}function Kb(a){var b,c,d,e,f=Gb(a),g="";return f&&(b=jg.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*gg*.8+","+d/e*gg*.8+")"),g}function Lb(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Mb(a){return qc({id:a.data.id,value:a.value,ratio:Lb(a)})}function Nb(a){var b,c,d,e;return Qb()?(b=Gb(a),c=b?b.value:null,d=Lb(b),e=Rb(),e?e(c,d):Ed(c,d)):""}function Ob(a,b){var c=qj.selectAll("."+g.chartArc+qd(a)),d=qj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});we(a)&&c.selectAll("path").transition().duration(50).attr("d",kg).transition().duration(100).attr("d",lg).each(function(a){pe(a.data)}),b||d.style("opacity",.3)}function Pb(a){var b=qj.selectAll("."+g.chartArc+qd(a));b.selectAll("path").transition().duration(50).attr("d",jg),qj.selectAll("."+g.arc).style("opacity",1)}function Qb(){return ie(If.data.targets)?ri:li}function Rb(){return ie(If.data.targets)?si:mi}function Sb(){return ie(If.data.targets)?ui:""}function Tb(){var a=ie(If.data.targets)?vi:oi;return"function"==typeof a?a:function(){}}function Ub(){var a=ie(If.data.targets)?wi:pi;return"function"==typeof a?a:function(){}}function Vb(){var a=ie(If.data.targets)?xi:qi;return"function"==typeof a?a:function(){}}function Wb(a){var b,c,d,e,f,g,h=Dc(a),i=Qc(a);if(Lg.length>0)for(g=Sc(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 Hf.min(Object.keys(i).map(function(a){return Hf.min(i[a])}))}function Xb(a){var b,c,d,e,f,g,h=Dc(a),i=Qc(a);if(Lg.length>0)for(g=Tc(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 Hf.max(Object.keys(i).map(function(a){return Hf.max(i[a])}))}function Yb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return _(a.id)===c}),m="y2"===c?Rh:Ih,n="y2"===c?Qh:Hh,o=b(m)?m:Wb(l),p=b(n)?n:Xb(l),q="y2"===c?Sh:Jh,r=yd()&&nh;return 0===l.length?"y2"===c?xg.domain():wg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=zd(o,p),j=bc(wg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Nh&&(f=b(Nh.top)?Nh.top:e,g=b(Nh.bottom)?Nh.bottom:e),"y2"===c&&Wh&&(f=b(Wh.top)?Wh.top:e,g=b(Wh.bottom)?Wh.bottom:e),fe(l)&&!Sc(l)&&(g=o),[o-g,p+f])}function Zb(a){return Bh?Mi?ye(Bh):Bh:Hf.min(a,function(a){return Hf.min(a.values,function(a){return a.x})})}function $b(a){return Ah?Mi?ye(Ah):Ah:Hf.max(a,function(a){return Hf.max(a.values,function(a){return a.x})})}function _b(a){var c,d,e,f,g=Cc(a),h=g[1]-g[0];return Ni?d=0:fe(a)?(c=Ac(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Ch&&De(Ch)?(e=b(Ch.left)?Ch.left:d,f=b(Ch.right)?Ch.right:d):e=f="number"==typeof Ch?Ch:d,{left:e,right:f}}function ac(a){var b=[Zb(a),$b(a)],c=b[0],d=b[1],e=_b(a),f=0,g=0;return c-d!==0||Ni||(c=Mi?new Date(.5*c.getTime()):-.5,d=Mi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Mi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Mi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function bc(a){return a[1]-a[0]}function cc(a){for(var b=0;bb?0:b-c}function ic(a){var b,c=gc(a),d="y"===a.axis?wg:xg;return b="y"===a.axis||"y2"===a.axis?nh?cg:"start"in a?d(a.start):cg:nh?"end"in a?vg(Mi?ye(a.end):a.end):cg:cg,c>b?0:b-c}function jc(a){return Fg&&a===Fg||De(Gg)&&Ee(Gg,a)}function kc(a){return!jc(a)}function lc(a){return Fg?Fg:De(Gg)?Gg[a]:null}function mc(a,b){var c,d=b&&De(b)?Dc(b):[];return d.forEach(function(b){lc(b)===a&&(c=If.data.xs[b])}),c}function nc(a,b){return a in If.data.xs&&If.data.xs[a]&&If.data.xs[a][b]?If.data.xs[a][b]:b}function oc(a){Object.keys(a).forEach(function(b){Gg[b]=a[b]})}function pc(a){return 1===Hf.set(Object.keys(a).map(function(b){return a[b]})).size()}function qc(a){var b;return a&&(b=Jg[a.id],a.name=b?b:a.id),a}function rc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=tc(b[d],a.id,d)}),If.data.xs[a.id]=b})}function sc(a,b){a.forEach(function(a){b[a.id]&&rc([a],b[a.id])})}function tc(a,c,d){var e;return e=Mi?a?a instanceof Date?a:ye(a):ye(nc(c,d)):Oi&&!Ni?b(a)?+a:nc(c,d):d}function uc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?If.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Fg?(d=Object.keys(If.data.xs),If.data.xs[c]=d.length>0?If.data.xs[d[0]]:void 0):De(Gg)&&(If.data.xs[c]=mc(f,If.data.targets)):If.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!If.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Ig(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=lc(b),g=a[f],h=tc(g,b,e);return Oi&&Ni&&0===c&&g&&(0===e&&(rh=[]),rh.push(g)),("undefined"==typeof a[b]||If.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ng&&de(Dc(c).filter(function(a){return!(a in Og)}),Ng),c.forEach(function(a){dc(a.id_org,a)}),c}function xc(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 yc(a){return a>0&&If.data.targets[0].values[a-1]?If.data.targets[0].values[a-1].x:void 0}function zc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Cc(a){var b,c,d=Bc(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Dc(a){return a.map(function(a){return a.id})}function Ec(a){return a?"string"==typeof a?[a]:a:Dc(If.data.targets)}function Fc(a,b){var c,d=Dc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Mi?new Date(i):i);j.push(e)}return Mi||(j=j.sort(function(a,b){return a-b})),j}function Mc(a){Yi=Yi.concat(a)}function Nc(a){Yi=Yi.filter(function(b){return a.indexOf(b)<0})}function Oc(a){Zi=Zi.concat(a)}function Pc(a){Zi=Zi.filter(function(b){return a.indexOf(b)<0})}function Qc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Rc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Tc(a){return Rc(a,function(a){return a>0})}function Uc(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||0===a[f].x)&&(e=e.concat(Kd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Kd(a,g))),Nd(e,b)):Ld(a,b,f,g)}function Md(a,b){var c;return c=a.map(function(a){return Ld(a.values,b)}),Nd(c,b)}function Nd(a,b){var c,d;return a.forEach(function(a){var e=Fe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Od(a,b){return Hf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Pd(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 Qd(){return Qg&&"desc"===Qg.toLowerCase()}function Rd(){return Qg&&"asc"===Qg.toLowerCase()}function Sd(a){var b=Rd(),c=Qd();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 Qg&&a.sort(Qg),a}function Td(a,c){var d,e,f,g,h,i,j,k=je(If.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&zi&&(vj.html(Ci(a,ab(),Ad(k),Vi)).style("display","block"),d=vj.property("offsetWidth"),e=vj.property("offsetHeight"),k?(g=ag/2+c[0],i=cg/2+c[1]+20):(nh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-w(),i=vg(l[0].x)+20):(f=s(),g=f+v()+vg(l[0].x)+20,h=g+d,j=f+t()-w(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),vj.style("top",i+"px").style("left",g+"px"))}function Ud(){vj.style("display","none")}function Vd(a){var c=a.filter(function(a){return a&&b(a.value)});if(zi&&!ge(If.data.targets)&&!je(If.data.targets)){var d=sj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(nh?"y1":"x1",Gd).attr(nh?"y2":"x2",Gd),lf(d,"grid")}}function Wd(){sj.select("line."+g.xgridFocus).style("visibility","hidden")}function Xd(a,b){var c,d,e,f,g=[];if("year"===a)for(c=ac(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)g.push(new Date(f+"-01-01 00:00:00"));else g=b.ticks(10);return g}function Yd(a){return a.x||0===a.x?vg(a.x):null}function Zd(a){return X(a.id)(a.value)}function $d(){var a,b,d={},e=0;return Jc(Gc(me)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ce(a,b){return"number"==typeof ji?ji:b?2*a.tickOffset()*ki/b:0}function de(a,b){Ec(a).forEach(function(a){zj[a]=b===Og[a],Og[a]=b})}function ee(a,b){var c=!1;return a.forEach(function(a){Og[a.id]===b&&(c=!0),a.id in Og||"line"!==b||(c=!0)}),c}function fe(a){return ee(a,"bar")}function ge(a){return ee(a,"scatter")}function he(a){return ee(a,"pie")}function ie(a){return ee(a,"donut")}function je(a){return he(a)||ie(a)}function ke(a){var b="string"==typeof a?a:a.id;return!(b in Og)||"line"===Og[b]||"spline"===Og[b]||"area"===Og[b]||"area-spline"===Og[b]}function le(a){var b="string"==typeof a?a:a.id;return"spline"===Og[b]||"area-spline"===Og[b]}function me(a){var b="string"==typeof a?a:a.id;return"bar"===Og[b]}function ne(a){var b="string"==typeof a?a:a.id;return"scatter"===Og[b]}function oe(a){var b="string"==typeof a?a:a.id;return"pie"===Og[b]}function pe(a){var b="string"==typeof a?a:a.id;return"donut"===Og[b]}function qe(a){return oe(a)||pe(a)}function re(a){return ke(a)?[a]:[]}function se(a){return qe(a.data)?[a]:[]}function te(a){return me(a)?a.values:[]}function ue(a){return ke(a)||ne(a)?a.values:[]}function ve(a){return me(a)||ke(a)?a.values:[]}function we(a){return pe(a)&&ti||oe(a)&&ni}function xe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ye(b){var c;try{c=Hg?Hf.time.format(Hg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Hg)}return c}function ze(a,b){var c=Hf.mouse(a),d=Hf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ee(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Fe(a,b){var c="y"===_(a.id)?wg:xg,d=nh?1:0,e=nh?0:1;return Math.pow(vg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ge(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function He(a,b,c){ah(b,a.node()),sj.select("."+g.selectedCircles+pd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Vc(g.selectedCircle,c)}).attr("cx",nh?Zd:Yd).attr("cy",nh?Yd:Zd).attr("stroke",function(){return Vi(b)}).attr("r",1.4*Se(b)).transition().duration(100).attr("r",Se)}function Ie(a,b,c){bh(b,a.node()),sj.select("."+g.selectedCircles+pd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Je(a,b,c,d){a?He(b,c,d):Ie(b,c,d)}function Ke(a,b){ah(b,a.node()),a.transition().duration(100).style("fill",function(){return Hf.rgb(Vi(b)).brighter(.75)})}function Le(a,b){bh(b,a.node()),a.transition().duration(100).style("fill",function(){return Vi(b)})}function Me(a,b,c,d){a?Ke(b,c,d):Le(b,c,d)}function Ne(a,b,c,d){Me(a,b,c.data,d)}function Oe(a){return"circle"===a.nodeName?Je:Hf.select(a).classed(g.bar)?Me:Ne}function Pe(a){return a.filter(function(a){return b(a.value)})}function Qe(a){return ci?"function"==typeof di?di(a):di:0}function Re(a){return fi?gi?gi:1.75*Qe(a):Qe(a)}function Se(a){return hi?hi:4*Qe(a)}function Te(a,c){return(c?sj.selectAll("."+g.circles+pd(c)):sj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ue(a,b){Te(a,b).classed(g.EXPANDED,!0).attr("r",Re)}function Ve(a){Te(a).filter(function(){return Hf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Qe)}function We(a){return sj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function Xe(a){We(a).classed(g.EXPANDED,!0)}function Ye(a){We(a).classed(g.EXPANDED,!1)}function Ze(a,b){var c=bf(a,b);return function(a,b){var d=c(a,b),e=nh?1:0,f=nh?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 $e(a,b){var c=bf(a,!1),d=b?_e:af;return function(a,b){return d(c(a,b),a,this)}}function _e(a,b){var c;return nh?(c=me(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function af(a,b,c){var d=c.getBoundingClientRect();return nh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:me(b)?-3:-6)}function bf(a,b){var c=a.__max__+1,d=ce(Bg,c),e=_d(d,c,a,!!b),f=ae(!!b),g=be(a,!!b),h=b?Y:X;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return nh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function cf(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 df(b){var c,d,e;if(wj=Hf.select(Kf),wj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(wj.html("").classed("c3",!0),If.data.xs={},If.data.targets=wc(b),Ug&&Mc(Ug===!0?Dc(If.data.targets):Ug),p(),T(),vg.domain(Hf.extent(ac(If.data.targets))),wg.domain(Yb(If.data.targets,"y")),xg.domain(Yb(If.data.targets,"y2")),yg.domain(vg.domain()),zg.domain(wg.domain()),Ag.domain(xg.domain()),xj=vg.domain(),lj.scale(yg),Rf&&pj.scale(vg),qj=wj.append("svg").on("mouseenter",Uf).on("mouseleave",Vf),rj=qj.append("defs"),rj.append("clipPath").attr("id",Gi).append("rect"),rj.append("clipPath").attr("id",Hi).append("rect"),rj.append("clipPath").attr("id",Ii).append("rect"),qf(),sj=qj.append("g").attr("transform",cj.main),tj=qj.append("g").attr("transform",cj.context),uj=qj.append("g").attr("transform",cj.legend),eh||tj.style("visibility","hidden"),hh||(uj.style("visibility","hidden"),Zi=Dc(If.data.targets)),vj=Hf.select(Kf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Cf(Dc(If.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=sj.append("g").attr("clip-path",Ji).attr("class",g.grid),Yh&&d.append("g").attr("class",g.xgrids),De($h)&&d.append("g").attr("class",g.xgridLines),ei&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),_h&&d.append("g").attr("class",g.ygrids),De(ai)&&d.append("g").attr("class",g.ygridLines),sj.append("g").attr("clip-path",Ji).attr("class",g.regions),sj.append("g").attr("clip-path",Ji).attr("class",g.chart),c=sj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Rf?nh?"ns-resize":"ew-resize":null),sj.select("."+g.chart).append("g").attr("class",g.chartBars),sj.select("."+g.chart).append("g").attr("class",g.chartLines),sj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",cj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Sb()),sj.select("."+g.chart).append("g").attr("class",g.chartTexts),Rf&&sj.insert("rect",Tf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",ag).attr("height",cg).style("opacity",0).style("cursor",nh?"ns-resize":"ew-resize").call(pj).on("dblclick.zoom",null),Eh&&lj.extent("function"!=typeof Eh?Eh:Eh(ac())),oh&&sj.append("g").attr("class",g.axisX).attr("clip-path",Ki).attr("transform",cj.x).append("text").attr("class",g.axisXLabel).attr("transform",nh?"rotate(-90)":"").style("text-anchor",Bb),Gh&&sj.append("g").attr("class",g.axisY).attr("clip-path",Li).attr("transform",cj.y).append("text").attr("class",g.axisYLabel).attr("transform",nh?"":"rotate(-90)").style("text-anchor",Cb),Ph&&sj.append("g").attr("class",g.axisY2).attr("transform",cj.y2).append("text").attr("class",g.axisY2Label).attr("transform",nh?"":"rotate(-90)").style("text-anchor",Db),tj.append("g").attr("clip-path",Ji).attr("class",g.chart),tj.select("."+g.chart).append("g").attr("class",g.chartBars),tj.select("."+g.chart).append("g").attr("class",g.chartLines),tj.append("g").attr("clip-path",Ji).attr("class",g.brush).call(lj).selectAll("rect").attr(nh?"width":"height",nh?bg:dg),tj.append("g").attr("class",g.axisX).attr("transform",cj.subx).attr("clip-path",nh?"":Ki),sf(If.data.targets),nh?sj.select("."+g.axisX).style("opacity",0).call(Bg):(sj.select("."+g.axisY).style("opacity",0).call(Cg),sj.select("."+g.axisY2).style("opacity",0).call(Dg)),p(),T(),qf(),o(!1),mf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Di){if(Mi&&"string"==typeof Ei){for(Ei=ye(Ei),e=0;e0){d=[];for(var f in Jg)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Pd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Me,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function jf(a){je(If.data.targets)||Vg&&(Pi=a,sj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Qi=!0,ch())}function kf(){je(If.data.targets)||Vg&&(sj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),sj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Qi=!1,dh())}function lf(a,b){"grid"===b&&a.each(function(){var a=Hf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function mf(a){var c,e,f,h,i,j,k,l,m,n,o,p,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,O,P,Q,R,S,T,U,V,W,X,Y,Z,$,_=$d(),ab=je(If.data.targets),bb=Jc(If.data.targets);if(a=d(a)?a:{},G=d(a.withY)?a.withY:!0,H=d(a.withSubchart)?a.withSubchart:!0,I=d(a.withTransition)?a.withTransition:!0,L=d(a.withTransform)?a.withTransform:!1,M=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,O=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,P=d(a.withLegend)?a.withLegend:!1,J=d(a.withTransitionForExit)?a.withTransitionForExit:I,K=d(a.withTransitionForAxis)?a.withTransitionForAxis:I,V=I?Yf:0,W=J?V:0,X=K?V:0,c=sj.select("."+g.axisX).style("opacity",ab?0:1),f=sj.select("."+g.axisY).style("opacity",ab?0:1),h=sj.select("."+g.axisY2).style("opacity",ab?0:1),e=tj.select("."+g.axisX).style("opacity",ab?0:1),U={axisX:c.transition().duration(X),axisY:f.transition().duration(X),axisY2:h.transition().duration(X),axisSubX:e.transition().duration(X)},P&&hh&&Cf(Dc(If.data.targets),a,U),Ni&&(0!==bb.length&&O&&M||vg.domain([0,c.selectAll(".tick").size()])),bb.length&&(O&&(vg.domain(Hf.extent(ac(bb))),xj=vg.domain(),Rf&&pj.scale(vg).updateScaleExtent(),yg.domain(vg.domain()),lj.scale(yg)),M&&(vg.domain(lj.empty()?xj:lj.extent()),Rf&&pj.scale(vg).updateScaleExtent()),yh||!xh&&!wh||(Y=Lc(Kc(bb),wh),Bg.tickValues(Y),Eg.tickValues(Y))),wg.domain(Yb(bb,"y")),xg.domain(Yb(bb,"y2")),U.axisX.call(Bg),U.axisY.call(Cg),U.axisY2.call(Dg),U.axisSubX.call(Eg),Fb(I),M&&bb.length)if(uh&&Y){for(Z=1;Z=0&&Hf.select(this).style("display",b%$?"none":"block")})}else qj.selectAll("."+g.axisX+" .tick text").style("display","block");!nh&&zh&&gb(c,U.axisX,zh),Q=Ze(_),S=$e(_,!0),T=$e(_,!1),zg.domain(wg.domain()),Ag.domain(xg.domain()),vj.style("display","none"),q(),sj.select("line."+g.xgridFocus).style("visibility","hidden"),Yh&&(k=Xd(Zh,vg),D=Ni?Bg.tickOffset():0,j=nh?{x1:0,x2:ag,y1:function(a){return vg(a)-D},y2:function(a){return vg(a)-D}}:{x1:function(a){return vg(a)+D},x2:function(a){return vg(a)+D},y1:Zf.top,y2:cg},i=sj.select("."+g.xgrids).selectAll("."+g.xgrid).data(k),i.enter().append("line").attr("class",g.xgrid),i.attr(j).style("opacity",function(){return+Hf.select(this).attr(nh?"y1":"x1")===(nh?cg:0)?0:1}),i.exit().remove()),De($h)&&(l=sj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data($h),m=l.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",nh?"":"rotate(-90)").attr("dx",nh?0:-Zf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(V).attr("x1",nh?0:Hd).attr("x2",nh?ag:Hd).attr("y1",nh?Hd:Zf.top).attr("y2",nh?Hd:cg).style("opacity",1),l.select("text").transition().duration(V).attr("x",nh?ag:0).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(V).style("opacity",0).remove()),G&&_h&&(n=sj.select("."+g.ygrids).selectAll("."+g.ygrid).data(wg.ticks(bi)),n.enter().append("line").attr("class",g.ygrid),n.attr("x1",nh?wg:0).attr("x2",nh?wg:ag).attr("y1",nh?0:wg).attr("y2",nh?cg:wg),n.exit().remove(),lf(n,"grid")),G&&De(ai)&&(o=sj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(ai),p=o.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",nh?"rotate(-90)":"").attr("dx",nh?0:-Zf.top).attr("dy",-5).style("opacity",0),o.select("line").transition().duration(V).attr("x1",nh?Id:0).attr("x2",nh?Id:ag).attr("y1",nh?0:Id).attr("y2",nh?cg:Id).style("opacity",1),o.select("text").transition().duration(V).attr("x",nh?0:ag).attr("y",Id).text(function(a){return a.text}).style("opacity",1),o.exit().transition().duration(V).style("opacity",0).remove()),w=sj.select("."+g.regions).selectAll("."+g.region).data(yi),w.enter().append("g").attr("class",id).append("rect").style("fill-opacity",0),w.selectAll("rect").attr("x",fc).attr("y",gc).attr("width",hc).attr("height",ic).transition().duration(V).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),w.exit().transition().duration(V).style("fill-opacity",0).remove(),u=sj.selectAll("."+g.bars).selectAll("."+g.bar).data(te),u.enter().append("path").attr("class",cd).style("stroke","none").style("fill",Vi),u.style("opacity",ud).transition().duration(V).attr("d",Q).style("fill",Vi).style("opacity",1),u.exit().transition().duration(W).style("opacity",0).remove(),r=sj.selectAll("."+g.lines).selectAll("."+g.line).data(re),r.enter().append("path").attr("class",$c).style("stroke",Vi),r.style("opacity",ud).transition().duration(V).attr("d",mj).style("stroke",Vi).style("opacity",1),r.exit().transition().duration(W).style("opacity",0).remove(),s=sj.selectAll("."+g.areas).selectAll("."+g.area).data(re),s.enter().append("path").attr("class",gd).style("fill",Vi).style("opacity",function(){return yj=+Hf.select(this).style("opacity"),0}),s.style("opacity",0).transition().duration(V).attr("d",nj).style("fill",Vi).style("opacity",yj),s.exit().transition().duration(W).style("opacity",0).remove(),t=sj.selectAll("."+g.circles).selectAll("."+g.circle).data(ue),t.enter().append("circle").attr("class",ad).attr("r",Qe).style("fill",Vi),t.style("opacity",ud).transition().duration(V).style("opacity",wd).style("fill",Vi).attr("cx",nh?Zd:Yd).attr("cy",nh?Yd:Zd),t.exit().remove(),x=sj.selectAll("."+g.texts).selectAll("."+g.text).data(ve),x.enter().append("text").attr("class",Wc).attr("text-anchor",function(a){return nh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",Vi).style("fill-opacity",0),x.text(function(a){return Fd(a.id)(a.value,a.id)}).style("fill-opacity",vd).transition().duration(V).attr("x",S).attr("y",T).style("fill",Vi).style("fill-opacity",xd),x.exit().transition().duration(W).style("fill-opacity",0).remove(),v=sj.selectAll("."+g.arcs).selectAll("."+g.arc).data(se),v.enter().append("path").attr("class",ed).style("fill",function(a){return Vi(a.data)}).style("cursor",function(a){return Xg(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Ti||(c=Gb(a),d=Mb(c),e=Ub(),Ob(c.data.id),yf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Gb(a),c=Mb(b),d=[c];Td(d,Hf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Ti||(c=Gb(a),d=Mb(c),e=Vb(),Pb(c.data.id),zf(),Ud(),e(d,b))}).on("click",function(a,b){var c=Gb(a),d=Mb(c),e=Tb();gf(this,a,b),e(d,b)}),v.attr("transform",L?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Ti=!0}).transition().duration(V).attrTween("d",function(a){var b,c=Gb(a);return c?(b=Hf.interpolate(this._current,c),this._current=b(0),function(a){return Jb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",L?"scale(1)":"").style("fill",function(a){return Vi(a.data)}).style("opacity",1).call(Ge,function(){Ti=!1}),v.exit().transition().duration(W).style("opacity",0).remove(),sj.selectAll("."+g.chartArc).select("text").attr("transform",Kb).style("opacity",0).transition().duration(V).text(Nb).style("opacity",function(a){return Hc(a.data.id)&&qe(a.data)?1:0}),sj.select("."+g.chartArcsTitle).style("opacity",ie(If.data.targets)?1:0),eh&&(null!==Hf.event&&"zoom"===Hf.event.type&&lj.extent(vg.orgDomain()).update(),H&&(!nh&&zh&&gb(e,U.axisSubX,zh),lj.empty()||lj.extent(vg.orgDomain()).update(),R=Ze(_,!0),z=tj.selectAll("."+g.bars).selectAll("."+g.bar).data(te),z.enter().append("path").attr("class",cd).style("stroke","none").style("fill",Vi),z.style("opacity",ud).transition().duration(V).attr("d",R).style("opacity",1),z.exit().transition().duration(V).style("opacity",0).remove(),y=tj.selectAll("."+g.lines).selectAll("."+g.line).data(re),y.enter().append("path").attr("class",$c).style("stroke",Vi),y.style("opacity",ud).transition().duration(V).attr("d",oj).style("opacity",1),y.exit().transition().duration(V).style("opacity",0).remove())),sj.selectAll("."+g.selectedCircles).filter(function(a){return me(a)}).selectAll("circle").remove(),sj.selectAll("."+g.selectedCircle).transition().duration(V).attr("cx",nh?Zd:Yd).attr("cy",nh?Yd:Zd),A=sj.select("."+g.eventRects),De(Gg)&&!pc(Gg)?(A.classed(g.eventRectsMultiple)||A.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),B=sj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),ff(B.enter()),B.attr("x",0).attr("y",0).attr("width",ag).attr("height",cg)):(A.classed(g.eventRectsSingle)||A.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Oi&&!Ni?(F=function(a,b){var c=yc(b),d=zc(b),e=If.data.xs[a.id][b];return(vg(d?d:e+50)-vg(c?c:e-50))/2},E=function(a,b){var c=yc(b),d=If.data.xs[a.id][b];return(vg(d)+vg(c?c:d-50))/2}):(F=N(),E=function(a){return vg(a.x)-F/2}),C=Bc(If.data.targets),sj.select("."+g.eventRects).datum(C?C.values:[]),B=sj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),ef(B.enter()),B.attr("class",jd).attr("x",nh?0:E).attr("y",nh?E:0).attr("width",nh?ag:F).attr("height",nh?F:cg),B.exit().remove()),Dc(If.data.targets).forEach(function(a){zj[a]=!0})}function nf(){mf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function of(){return"mousemove"===Hf.event.sourceEvent.type&&pj.altDomain?(vg.domain(pj.altDomain),void pj.scale(vg).updateScaleExtent()):(Ni&&vg.orgDomain()[0]===xj[0]&&vg.domain([xj[0]-1e-10,vg.orgDomain()[1]]),mf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Hf.event.sourceEvent.type&&(Ri=!0)))}function pf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function qf(){qj.attr("width",eg).attr("height",fg),qj.select("#"+Gi).select("rect").attr("width",ag).attr("height",cg),qj.select("#"+Hi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),qj.select("#"+Ii).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),qj.select("."+g.zoomRect).attr("width",ag).attr("height",cg),wj.style("max-height",fg+"px")}function rf(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,p(),T(),qf(),o(a.withTransition),mf(a)}function sf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=sj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",ld),j=i.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Xc),e=sj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",nd),d=e.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",dd).style("cursor",function(a){return Xg(a)?"pointer":null}),c=sj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",md),b=c.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",_c),b.append("g").attr("class",hd),b.append("g").attr("class",function(a){return Vc(g.selectedCircles,a.id)}),b.append("g").attr("class",bd).style("cursor",function(a){return Xg(a)?"pointer":null}),a.forEach(function(a){sj.selectAll("."+g.selectedCircles+pd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=sj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(mg(a)).attr("class",od),f=h.enter().append("g").attr("class",od),f.append("g").attr("class",fd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),eh&&(n=tj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",nd),m=n.enter().append("g").style("opacity",0).attr("class",nd),m.append("g").attr("class",dd),l=tj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",md),k=l.enter().append("g").style("opacity",0).attr("class",md),k.append("g").attr("class",_c)),qj.selectAll("."+g.target).filter(function(a){return Hc(a.id)}).transition().duration(Yf).style("opacity",1)}function tf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?de(a.id,b.types[a.id]):de(a.id,b.type)}),If.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=dj?j:i,l=dj?S():R();return d&&(w=0,C=0,t=0,u=0),hh&&!Ic(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=dj?u:t,void(mh?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=uj.selectAll("."+g.legendItemFocused).size();b=b||{},n=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,dj?(f=function(a){return t*B[a]},j=function(a){return A[B[a]]+x[a]}):(f=function(a){return A[B[a]]+x[a]},j=function(a){return u*B[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=uj.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Vc(g.legendItem,a)}).style("visibility",function(a){return Ic(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof jh?jh(a):If.toggle(a)}).on("mouseover",function(a){Hf.select(this).classed(g.legendItemFocused,!0),Ti||If.focus(a),"function"==typeof kh&&kh(a)}).on("mouseout",function(a){Hf.select(this).classed(g.legendItemFocused,!1),Ti||If.revert(),"function"==typeof lh&&lh(a)}),m.append("text").text(function(a){return d(Jg[a])?Jg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",dj?h:-200).attr("y",dj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",dj?i:-200).attr("y",dj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",Vi).attr("x",dj?h:-200).attr("y",dj?-200:j).attr("width",10).attr("height",10),uj.selectAll("text").data(a).text(function(a){return d(Jg[a])?Jg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(n?250:0).attr("x",h).attr("y",k),uj.selectAll("rect."+g.legendItemEvent).data(a).transition().duration(n?250:0).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}).attr("x",i).attr("y",l),uj.selectAll("rect."+g.legendItemTile).data(a).transition().duration(n?250:0).style("fill",Vi).attr("x",f).attr("y",j),uj.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Hc(a)}).transition().style("opacity",function(a){var b=Hf.select(this);return Hc(a)?!D||b.classed(g.legendItemFocused)?wf(b):xf(b):hj}),P(t),Q(u),O(C),p(),T(),qf(),o(q,c)}function Df(a){return Fc(If.data.targets,a.id)}function Ef(a){return"data"in a&&Fc(If.data.targets,a.data.id)}function Ff(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 Gf(a,b,c){var d=!je(If.data.targets);Ti=!1,de(a,b),rf(c||{withTransitionForAxis:d})}var Hf=a.d3?a.d3:a.require?a.require("d3"):void 0,If={data:{},axis:{},legend:{}},Jf={},Kf=i(["bindto"],"#chart"),Lf=i(["size","width"]),Mf=i(["size","height"]),Nf=i(["padding","left"],50),Of=i(["padding","right"],0),Pf=i(["padding","top"],0),Qf=i(["padding","bottom"],0),Rf=i(["zoom","enabled"],!1),Sf=i(["zoom","extent"]),Tf=i(["zoom","privileged"],!1),Uf=i(["onenter"],function(){}),Vf=i(["onleave"],function(){}),Wf=i(["onresize"],function(){}),Xf=i(["onresized"],function(){}),Yf=i(["transition","duration"],350);h("data","data is required in config");var Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg=i(["data","x"]),Gg=i(["data","xs"],{}),Hg=i(["data","x_format"]),Ig=i(["data","id_converter"],function(a){return a}),Jg=i(["data","names"],{}),Kg=i(["data","classes"],{}),Lg=i(["data","groups"],[]),Mg=i(["data","axes"],{}),Ng=i(["data","type"]),Og=i(["data","types"],{}),Pg=i(["data","labels"],{}),Qg=i(["data","order"]),Rg=i(["data","regions"],{}),Sg=i(["data","color"]),Tg=i(["data","colors"],{}),Ug=i(["data","hide"],!1),Vg=i(["data","selection","enabled"],!1),Wg=i(["data","selection","grouped"],!1),Xg=i(["data","selection","isselectable"],function(){return!0}),Yg=i(["data","selection","multiple"],!0),Zg=i(["data","onclick"],function(){}),$g=i(["data","onenter"],function(){}),_g=i(["data","onleave"],function(){}),ah=i(["data","onselected"],function(){}),bh=i(["data","onunselected"],function(){}),ch=i(["data","ondragstart"],function(){}),dh=i(["data","ondragend"],function(){}),eh=i(["subchart","show"],!1),fh=i(["subchart","size","height"],60),gh=i(["color","pattern"],[]),hh=i(["legend","show"],!0),ih=i(["legend","position"],"bottom"),jh=i(["legend","item","onclick"]),kh=i(["legend","item","onmouseover"]),lh=i(["legend","item","onmouseout"]),mh=i(["legend","equally"],!1),nh=i(["axis","rotated"],!1),oh=i(["axis","x","show"],!0),ph=i(["axis","x","type"],"indexed"),qh=i(["axis","x","localtime"],!0),rh=i(["axis","x","categories"],[]),sh=i(["axis","x","tick","centered"],!1),th=i(["axis","x","tick","format"]),uh=i(["axis","x","tick","culling"],{}),vh=i(["axis","x","tick","culling","max"],10),wh=i(["axis","x","tick","count"]),xh=i(["axis","x","tick","fit"],!0),yh=i(["axis","x","tick","values"],null),zh=i(["axis","x","tick","rotate"]),Ah=i(["axis","x","max"],null),Bh=i(["axis","x","min"],null),Ch=i(["axis","x","padding"],{}),Dh=i(["axis","x","height"]),Eh=i(["axis","x","default"]),Fh=i(["axis","x","label"],{}),Gh=i(["axis","y","show"],!0),Hh=i(["axis","y","max"]),Ih=i(["axis","y","min"]),Jh=i(["axis","y","center"]),Kh=i(["axis","y","label"],{}),Lh=i(["axis","y","inner"],!1),Mh=i(["axis","y","tick","format"]),Nh=i(["axis","y","padding"]),Oh=i(["axis","y","ticks"],10),Ph=i(["axis","y2","show"],!1),Qh=i(["axis","y2","max"]),Rh=i(["axis","y2","min"]),Sh=i(["axis","y2","center"]),Th=i(["axis","y2","label"],{}),Uh=i(["axis","y2","inner"],!1),Vh=i(["axis","y2","tick","format"]),Wh=i(["axis","y2","padding"]),Xh=i(["axis","y2","ticks"],10),Yh=i(["grid","x","show"],!1),Zh=i(["grid","x","type"],"tick"),$h=i(["grid","x","lines"],[]),_h=i(["grid","y","show"],!1),ai=i(["grid","y","lines"],[]),bi=i(["grid","y","ticks"],10),ci=i(["point","show"],!0),di=i(["point","r"],2.5),ei=i(["point","focus","line","enabled"],!0),fi=i(["point","focus","expand","enabled"],!0),gi=i(["point","focus","expand","r"]),hi=i(["point","focus","select","r"]),ii=i(["line","connect_null"],!1),ji=i(["bar","width"]),ki=i(["bar","width","ratio"],.6),li=i(["pie","label","show"],!0),mi=i(["pie","label","format"]),ni=i(["pie","expand"],!0),oi=i(["pie","onclick"],function(){}),pi=i(["pie","onmouseover"],function(){}),qi=i(["pie","onmouseout"],function(){}),ri=i(["donut","label","show"],!0),si=i(["donut","label","format"]),ti=i(["donut","expand"],!0),ui=i(["donut","title"],""),vi=i(["donut","onclick"],function(){}),wi=i(["donut","onmouseover"],function(){}),xi=i(["donut","onmouseout"],function(){}),yi=i(["regions"],[]),zi=i(["tooltip","show"],!0),Ai=i(["tooltip","format","title"]),Bi=i(["tooltip","format","value"]),Ci=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Ai?Ai:b,l=Bi?Bi:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Di=i(["tooltip","init","show"],!1),Ei=i(["tooltip","init","x"],0),Fi=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Gi=("string"==typeof Kf?Kf.replace("#",""):Kf.id)+"-clip",Hi=Gi+"-xaxis",Ii=Gi+"-yaxis",Ji=j(Gi),Ki=j(Hi),Li=j(Ii),Mi="timeseries"===ph,Ni="categorized"===ph,Oi=!Mi&&(Fg||De(Gg)),Pi=null,Qi=!1,Ri=!1,Si=!1,Ti=!1,Ui=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Vi=xe(Tg,De(gh)?gh:Ui,Sg),Wi=qh?Hf.time.format:Hf.time.format.utc,Xi=function(){var a=[[Wi("%Y/%-m/%-d"),function(){return!0}],[Wi("%-m/%-d"),function(a){return a.getMonth()}],[Wi("%-m/%-d"),function(a){return 1!==a.getDate()}],[Wi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Wi("%I %p"),function(a){return a.getHours()}],[Wi("%I:%M"),function(a){return a.getMinutes()}],[Wi(":%S"),function(a){return a.getSeconds()}],[Wi(".%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)}}(),Yi=[],Zi=[],$i=nh?"left":"bottom",_i=nh?Lh?"top":"bottom":Lh?"right":"left",aj=nh?Uh?"bottom":"top":Uh?"left":"right",bj=nh?"left":"bottom",cj={main:function(){return"translate("+k(Zf.left)+","+k(Zf.top)+")"},context:function(){return"translate("+k($f.left)+","+k($f.top)+")"},legend:function(){return"translate("+_f.left+","+_f.top+")"},x:function(){return"translate(0,"+(nh?0:cg)+")"},y:function(){return"translate(0,"+(nh?cg:0)+")"},y2:function(){return"translate("+(nh?0:ag)+","+(nh?1:0)+")"},subx:function(){return"translate(0,"+(nh?0:dg)+")"},arc:function(){return"translate("+ag/2+","+cg/2+")"}},dj="right"===ih,ej=0,fj=0,gj=0,hj=.15,ij=30,jj=nh&&!oh?0:30,kj=5;mg=Hf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var lj,mj=function(){var a=Hf.svg.line().x(nh?function(a){return X(a.id)(a.value) }:Gd).y(nh?Gd:function(a){return X(a.id)(a.value)});return ii||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ii?Pe(b.values):b.values;return ke(b)?(a.interpolate(le(b)?"cardinal":"linear"),Rg[b.id]?cf(e,vg,X(b.id),Rg[b.id]):a(e)):(c=e[0]?vg(e[0].x):0,d=e[0]?X(b.id)(e[0].value):0,nh?"M "+d+" "+c:"M "+c+" "+d)}}(),nj=function(){var a;return a=nh?Hf.svg.area().x0(function(a){return X(a.id)(0)}).x1(function(a){return X(a.id)(a.value)}).y(Gd):Hf.svg.area().x(Gd).y0(function(a){return X(a.id)(0)}).y1(function(a){return X(a.id)(a.value)}),function(b){var c,d,e=Pe(b.values);return ee([b],"area")||ee([b],"area-spline")?(a.interpolate(le(b)?"cardinal":"linear"),a(e)):(c=e[0]?vg(e[0].x):0,d=e[0]?X(b.id)(e[0].value):0,nh?"M "+d+" "+c:"M "+c+" "+d)}}(),oj=function(){var a=Hf.svg.line().x(nh?function(a){return Y(a.id)(a.value)}:Jd).y(nh?Jd:function(a){return Y(a.id)(a.value)});return function(b){var c=Pe(b.values);return ke(b)?a(c):"M "+yg(c[0].x)+" "+Y(b.id)(c[0].value)}}(),pj=function(){};lj=Hf.svg.brush().on("brush",nf),lj.update=function(){return tj&&tj.select("."+g.brush).call(this),this},lj.scale=function(a){return nh?this.y(a):this.x(a)},Rf&&(pj=Hf.behavior.zoom().on("zoomstart",function(){pj.altDomain=Hf.event.sourceEvent.altKey?vg.orgDomain():null}).on("zoom",Rf?of:null),pj.scale=function(a){return nh?this.y(a):this.x(a)},pj.orgScaleExtent=function(){var a=Sf?Sf:[1,10];return[a[0],Math.max(Ac()/a[1],a[1])]},pj.updateScaleExtent=function(){var a=bc(vg.orgDomain())/bc(xj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var qj,rj,sj,tj,uj,vj,wj,xj,yj,zj={};if(If.focus=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",1)}var c=qj.selectAll(qd(a)),d=c.filter(Df),e=c.filter(Ef);If.revert(),If.defocus(),b(d.classed(g.focused,!0)),b(e),je(If.data.targets)&&Ob(a,!0),yf(a,!0)},If.defocus=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",.3)}var c=qj.selectAll(qd(a)),d=c.filter(Df),e=c.filter(Ef);If.revert(),b(d.classed(g.focused,!1)),b(e),je(If.data.targets)&&Pb(a),yf(a,!1)},If.revert=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",1)}var c=qj.selectAll(qd(a)),d=c.filter(Df),e=c.filter(Ef);b(d.classed(g.focused,!1)),b(e),je(If.data.targets)&&Pb(a),zf()},If.show=function(a,b){a=Ec(a),b=b||{},Nc(a),qj.selectAll(rd(a)).transition().style("opacity",1),b.withLegend&&Af(a),mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},If.hide=function(a,b){a=Ec(a),b=b||{},Mc(a),qj.selectAll(rd(a)).transition().style("opacity",0),b.withLegend&&Bf(a),mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},If.toggle=function(a){Hc(a)?If.hide(a):If.show(a)},If.unzoom=function(){lj.clear().update(),mf({withUpdateXDomain:!0})},If.load=function(a){return a.xs&&oc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Kg[b]=a.classes[b]}),"categories"in a&&Ni&&(rh=a.categories,Bg.categories(rh)),"cacheIds"in a&&cc(a.cacheIds)?void tf(ec(a.cacheIds),a.done):void("unload"in a?vf(Ec("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){uf(a)}):uf(a))},If.unload=function(a,b){vf(Ec(a),function(){mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},If.selected=function(a){return Hf.merge(sj.selectAll("."+g.shapes+pd(a)).selectAll("."+g.shape).filter(function(){return Hf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},If.select=function(a,b,c){Vg&&sj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Hf.select(this),i=e.data?e.data.id:e.id,j=Oe(this),k=Wg||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);k&&l?Xg(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f)})},If.unselect=function(a,b){Vg&&sj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Hf.select(this),f=c.data?c.data.id:c.id,h=Oe(this),i=Wg||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);i&&j&&Xg(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},If.toLine=function(a){Gf(a,"line")},If.toSpline=function(a){Gf(a,"spline")},If.toBar=function(a){Gf(a,"bar")},If.toScatter=function(a){Gf(a,"scatter")},If.toArea=function(a){Gf(a,"area")},If.toAreaSpline=function(a){Gf(a,"area-spline")},If.toPie=function(a){Gf(a,"pie",{withTransform:!0})},If.toDonut=function(a){Gf(a,"donut",{withTransform:!0})},If.groups=function(a){return c(a)?Lg:(Lg=a,mf(),Lg)},If.xgrids=function(a){return a?($h=a,mf(),$h):$h},If.xgrids.add=function(a){return a?If.xgrids($h.concat(a)):void 0},If.xgrids.remove=function(a){var b=Ff(a);return If.xgrids($h.filter(b))},If.ygrids=function(a){return a?(ai=a,mf(),ai):ai},If.ygrids.add=function(a){return a?If.ygrids(ai.concat(a)):void 0},If.ygrids.remove=function(a){var b=Ff(a);return If.ygrids(ai.filter(b))},If.regions=function(a){return c(a)?yi:(yi=a,mf(),yi)},If.regions.add=function(a){return c(a)?yi:(yi=yi.concat(a),mf(),yi)},If.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;qj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),yi=yi.filter(function(b){return b.classes.indexOf(a)<0})}),yi},If.data.get=function(a){var b=If.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},If.data.getAsTarget=function(a){var b=Gc(function(b){return b.id===a});return b.length>0?b[0]:void 0},If.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Jg[b]=a[b]}),mf({withLegend:!0}),Jg):Jg},If.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Tg[b]=a[b]}),mf({withLegend:!0}),Tg):Tg},If.x=function(a){return arguments.length&&(rc(If.data.targets,a),mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),If.data.xs},If.xs=function(a){return arguments.length&&(sc(If.data.targets,a),mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),If.data.xs},If.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){db(b,a[b])}),Fb())},If.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Ah=+a.x),b(a.y)&&(Hh=+a.y),b(a.y2)&&(Qh=+a.y2)):Hh=Qh=+a,mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},If.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Bh=+a.x),b(a.y)&&(Ih=+a.y),b(a.y2)&&(Rh=+a.y2)):Ih=Rh=+a,mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},If.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&If.axis.max(a.max),"undefined"!=typeof a.min&&If.axis.min(a.min))},If.legend.show=function(a){Af(Ec(a)),mf({withLegend:!0})},If.legend.hide=function(a){Bf(Ec(a)),mf({withLegend:!0})},If.resize=function(a){Lf=a?a.width:null,Mf=a?a.height:null,rf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},If.destroy=function(){If.data.targets=void 0,If.data.xs={},wj.html(""),a.onresize=null},"url"in f.data)Hf.xhr(f.data.url,function(a,b){var c,d=Hf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Hf.csv.parse(b.response),df(c)});else if("rows"in f.data)df(uc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");df(vc(f.data.columns))}return If},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(window); \ No newline at end of file From fe6d127f369e81249853ee68908c07711908b3b4 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Tue, 6 May 2014 23:30:22 +0900 Subject: [PATCH 140/178] Fix transition for regions when data loaded --- c3.js | 2 +- c3.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/c3.js b/c3.js index a488075..15d73a5 100644 --- a/c3.js +++ b/c3.js @@ -3241,11 +3241,11 @@ .append('rect') .style("fill-opacity", 0); mainRegion.selectAll('rect') + .transition().duration(duration) .attr("x", regionX) .attr("y", regionY) .attr("width", regionWidth) .attr("height", regionHeight) - .transition().duration(duration) .style("fill-opacity", function (d) { return isValue(d.opacity) ? d.opacity : 0.1; }); mainRegion.exit().transition().duration(duration) .style("fill-opacity", 0) diff --git a/c3.min.js b/c3.min.js index 0f572a9..fdc4dc9 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ !function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.ceil(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.ceil(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&a_f&&(_f=0),0>bg&&(bg=0),ag=mh?Yf.left-hj-ij:_f,cg=mh?bg:eg-Zf.top-Zf.bottom,0>ag&&(ag=0),0>cg&&(cg=0),q(),cj&&ie(Hf.data.targets)&&($f.left=_f/2+gg)}function p(){rj.select("line."+g.xgridFocus).attr("x1",mh?0:-10).attr("x2",mh?_f:-10).attr("y1",mh?-10:Yf.top).attr("y2",mh?-10:bg)}function q(){gg=bg/2,fg=.95*gg,hg=he(Hf.data.targets)?.6*fg:0}function r(){var a=mh?g.axisX:g.axisY,b=rj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Gf.select(Jf).node().getBoundingClientRect(),e=c.right-d.left-u();return e>0?e:0}function s(){return Kf?Kf:y()}function t(){var a=Lf?Lf:z();return a>0?a:320}function u(){return ie(Hf.data.targets)?0:Mf?Mf:mh?nh?w("x"):1:!Fh||Kh?1:w("y")}function v(){var a=1;return ie(Hf.data.targets)?0:Nf?Nf:cj?Q()+20+(Oh&&!mh?w("y2"):a):Oh?Th||mh?a:w("y2"):a}function w(a){var b=kb(a);return b.isInner?20+Db(a):40+Db(a)}function x(a){return"x"!==a||nh?"x"===a&&Ch?Ch:"y"!==a||Fh?"y2"!==a||Oh?(kb(a).isInner?30:40)+("y2"===a?-10:0):jj:gh&&!cj?10:1:0}function y(){return+Gf.select(Jf).style("width").replace("px","")}function z(){return+Gf.select(Jf).style("height").replace("px","")}function A(a){return a?-5:-(Yf.left-1)}function B(a){return a?-20:-4}function C(){return A(!mh)}function D(){return B(!mh)}function E(){return A(mh)}function F(){return B(mh)}function G(a){return a?_f+2+4:Yf.left+20}function H(a){return a?(Ch?Ch:0)+80:bg+8}function I(){return G(!mh)}function J(){return H(!mh)}function K(){return G(mh)}function L(){return H(mh)}function M(){var a,b,c,d,e,f=Ac(Hf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ug(b.x)-ug(a.x),0===c?mh?bg:_f:(d=zc(),e=ee(Hf.data.targets)?(d-(Mi?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function N(a){dj=a}function O(a){ej=a}function P(a){fj=a}function Q(){return gh?cj?ej*(dj+1):dg:0}function R(){return gh?cj?eg:fj*(dj+1):0}function S(){var a,b,c=!ug;mg=mh?1:0,ng=mh?bg:_f,og=mh?0:bg,pg=mh?_f:1,qg=mg,rg=ng,sg=mh?0:cg,tg=mh?ag:1,ug=U(mg,ng,c?void 0:ug.domain(),function(){return Ag.tickOffset()}),vg=V(og,pg,c?void 0:vg.domain()),wg=V(og,pg,c?void 0:wg.domain()),xg=U(mg,ng,wj,function(a){return a%1?0:Dg.tickOffset()}),yg=V(sg,tg,c?void 0:yg.domain()),zg=V(sg,tg,c?void 0:zg.domain()),a=_(),b=xh?xh:c?void 0:Ag.tickValues(),Ag=Y(ug,Zi,a,b),Dg=Y(xg,aj,a,b),Bg=Z(vg,$i,Lh,Nh),Cg=Z(wg,_i,Uh,Wh),c||(kj.scale(xg),Qf&&oj.scale(ug)),T()}function T(){ig=Gb(),jg=Hb(),kg=Hb(.98)}function U(a,b,c,d){var e,f=(Li?Gf.time.scale():Gf.scale.linear()).range([a,b]),g=c?f.domain(c):f;Mi?(d=d||function(){return 0},f=function(a){return Math.ceil(g(a)+d(a))}):f=function(a){return Math.ceil(g(a))};for(e in g)f[e]=g[e];return f.orgDomain=function(){return g.domain()},Mi&&(f.domain=function(a){return arguments.length?(g.domain(a),f):(a=g.domain(),[a[0],a[1]+1])}),f}function V(a,b,c){var d=Gf.scale.linear().range([a,b]);return c&&d.domain(c),d}function W(a){return"y2"===$(a)?wg:vg}function X(a){return"y2"===$(a)?zg:yg}function Y(a,b,c,d){var f=e(Gf,Mi).scale(a).orient(b);return f.tickFormat(c).tickValues(d),Mi?(f.tickCentered(rh),Be(th)&&(th=!1),f.categories(qh)):f.tickOffset=function(){var a=Bc(Hf.data.targets),b=ug(a[1])-ug(a[0]),c=b?b:mh?bg:_f;return c/zc()/2},f}function Z(a,b,c,d){return e(Gf).scale(a).orient(b).tickFormat(c).ticks(d)}function $(a){return a in Lg?Lg[a]:"y"}function _(){var a=Li?Wi:Mi?Tc:function(a){return 0>a?a.toFixed(0):a};return sh&&("function"==typeof sh?a=sh:Li&&(a=function(a){return a?Vi(sh)(a):""})),a}function ab(a){var b;return"y"===a?b=Jh:"y2"===a?b=Sh:"x"===a&&(b=Eh),b}function bb(a){var b=ab(a);return"string"==typeof b?b:b?b.text:null}function cb(a,b){var c=ab(a);"string"==typeof c?"y"===a?Jh=b:"y2"===a?Sh=b:"x"===a&&(Eh=b):c&&(c.text=b)}function db(a){return 10*Math.sin(Math.PI*(a/180))}function eb(a){return 11.5-2.5*(a/15)}function fb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",eb(c)).attr("x",db(c)).attr("transform","rotate("+c+")")}function gb(a,b){var c=ab(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 hb(){return gb("x",mh?"inner-top":"inner-right")}function ib(){return gb("y",mh?"inner-right":"inner-top")}function jb(){return gb("y2",mh?"inner-right":"inner-top")}function kb(a){return"y2"===a?jb():"y"===a?ib():hb()}function lb(){return bb("x")}function mb(){return bb("y")}function nb(){return bb("y2")}function ob(a,b){return a?b.isLeft?0:b.isCenter?_f/2:_f:b.isBottom?-bg:b.isMiddle?-bg/2:0}function pb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function qb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function rb(){return ob(!mh,hb())}function sb(){return ob(mh,ib())}function tb(){return ob(mh,jb())}function ub(){return pb(!mh,hb())}function vb(){return pb(mh,ib())}function wb(){return pb(mh,jb())}function xb(){var a=hb();return mh?a.isInner?"1.2em":-25-Db("x"):a.isInner?"-0.5em":Ch?Ch-10:"3em"}function yb(){var a=ib();return mh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Db("y")}function zb(){var a=jb();return mh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Db("y2")}function Ab(){return qb(!mh,hb())}function Bb(){return qb(mh,ib())}function Cb(){return qb(mh,jb())}function Db(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Gf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Eb(a){var b=rj.select("."+g.axisX+" ."+g.axisXLabel),c=rj.select("."+g.axisY+" ."+g.axisYLabel),d=rj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",rb).attr("dx",ub).attr("dy",xb).text(lb),(a?c.transition():c).attr("x",sb).attr("dx",vb).attr("dy",yb).attr("dy",yb).text(mb),(a?d.transition():d).attr("x",tb).attr("dx",wb).attr("dy",zb).text(nb)}function Fb(a){var b=!1;return lg(Ic(Hf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Gb(){var a=Gf.svg.arc().outerRadius(fg).innerRadius(hg),b=function(b,c){var d;return c?a(b):(d=Fb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Hb(a){var b=Gf.svg.arc().outerRadius(gg*(a?a:1)).innerRadius(hg);return function(a){var c=Fb(a);return c?b(c):"M 0 0"}}function Ib(a,b){return pe(a.data)?ig(a,b):"M 0 0"}function Jb(a){var b,c,d,e,f=Fb(a),g="";return f&&(b=ig.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*fg*.8+","+d/e*fg*.8+")"),g}function Kb(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Lb(a){return pc({id:a.data.id,value:a.value,ratio:Kb(a)})}function Mb(a){var b,c,d,e;return Pb()?(b=Fb(a),c=b?b.value:null,d=Kb(b),e=Qb(),e?e(c,d):Dd(c,d)):""}function Nb(a,b){var c=pj.selectAll("."+g.chartArc+pd(a)),d=pj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});ve(a)&&c.selectAll("path").transition().duration(50).attr("d",jg).transition().duration(100).attr("d",kg).each(function(a){oe(a.data)}),b||d.style("opacity",.3)}function Ob(a){var b=pj.selectAll("."+g.chartArc+pd(a));b.selectAll("path").transition().duration(50).attr("d",ig),pj.selectAll("."+g.arc).style("opacity",1)}function Pb(){return he(Hf.data.targets)?qi:ki}function Qb(){return he(Hf.data.targets)?ri:li}function Rb(){return he(Hf.data.targets)?ti:""}function Sb(){var a=he(Hf.data.targets)?ui:ni;return"function"==typeof a?a:function(){}}function Tb(){var a=he(Hf.data.targets)?vi:oi;return"function"==typeof a?a:function(){}}function Ub(){var a=he(Hf.data.targets)?wi:pi;return"function"==typeof a?a:function(){}}function Vb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(Kg.length>0)for(g=Rc(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 Gf.min(Object.keys(i).map(function(a){return Gf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(Kg.length>0)for(g=Sc(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 Gf.max(Object.keys(i).map(function(a){return Gf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return $(a.id)===c}),m="y2"===c?Qh:Hh,n="y2"===c?Ph:Gh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Rh:Ih,r=xd()&&mh;return 0===l.length?"y2"===c?wg.domain():vg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=yd(o,p),j=ac(vg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Mh&&(f=b(Mh.top)?Mh.top:e,g=b(Mh.bottom)?Mh.bottom:e),"y2"===c&&Vh&&(f=b(Vh.top)?Vh.top:e,g=b(Vh.bottom)?Vh.bottom:e),ee(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return Ah?Li?xe(Ah):Ah:Gf.min(a,function(a){return Gf.min(a.values,function(a){return a.x})})}function Zb(a){return zh?Li?xe(zh):zh:Gf.max(a,function(a){return Gf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Mi?d=0:ee(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Bh&&Ce(Bh)?(e=b(Bh.left)?Bh.left:d,f=b(Bh.right)?Bh.right:d):e=f="number"==typeof Bh?Bh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return c-d!==0||Mi||(c=Li?new Date(.5*c.getTime()):-.5,d=Li?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Li?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Li?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?vg:wg;return b="y"===a.axis||"y2"===a.axis?mh?bg:"start"in a?d(a.start):bg:mh?"end"in a?ug(Li?xe(a.end):a.end):bg:bg,c>b?0:b-c}function ic(a){return Eg&&a===Eg||Ce(Fg)&&De(Fg,a)}function jc(a){return!ic(a)}function kc(a){return Eg?Eg:Ce(Fg)?Fg[a]:null}function lc(a,b){var c,d=b&&Ce(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=Hf.data.xs[b])}),c}function mc(a,b){return a in Hf.data.xs&&Hf.data.xs[a]&&Hf.data.xs[a][b]?Hf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){Fg[b]=a[b]})}function oc(a){return 1===Gf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=Ig[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),Hf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=Li?a?a instanceof Date?a:xe(a):xe(mc(c,d)):Ni&&!Mi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Hf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Eg?(d=Object.keys(Hf.data.xs),Hf.data.xs[c]=d.length>0?Hf.data.xs[d[0]]:void 0):Ce(Fg)&&(Hf.data.xs[c]=lc(f,Hf.data.targets)):Hf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Hf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Hg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ni&&Mi&&0===c&&g&&(0===e&&(qh=[]),qh.push(g)),("undefined"==typeof a[b]||Hf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Mg&&ce(Cc(c).filter(function(a){return!(a in Ng)}),Mg),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&Hf.data.targets[0].values[a-1]?Hf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(Hf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Li?new Date(i):i);j.push(e)}return Li||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Xi=Xi.concat(a)}function Mc(a){Xi=Xi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Yi=Yi.concat(a)}function Oc(a){Yi=Yi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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||0===a[f].x)&&(e=e.concat(Jd(a,f))),(a[g].x||0===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=Ee(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Nd(a,b){return Gf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Od(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 Pd(){return Pg&&"desc"===Pg.toLowerCase()}function Qd(){return Pg&&"asc"===Pg.toLowerCase()}function Rd(a){var b=Qd(),c=Pd();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 Pg&&a.sort(Pg),a}function Sd(a,c){var d,e,f,g,h,i,j,k=ie(Hf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&yi&&(uj.html(Bi(a,_(),zd(k),Ui)).style("display","block"),d=uj.property("offsetWidth"),e=uj.property("offsetHeight"),k?(g=_f/2+c[0],i=bg/2+c[1]+20):(mh?(f=r(),g=f+c[0]+100,h=g+d,j=s()-v(),i=ug(l[0].x)+20):(f=r(),g=f+u()+ug(l[0].x)+20,h=g+d,j=f+s()-v(),i=c[1]+15),h>j&&(g-=d+60),i+e>t()&&(i-=e+30)),uj.style("top",i+"px").style("left",g+"px"))}function Td(){uj.style("display","none")}function Ud(a){var c=a.filter(function(a){return a&&b(a.value)});if(yi&&!fe(Hf.data.targets)&&!ie(Hf.data.targets)){var d=rj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(mh?"y1":"x1",Fd).attr(mh?"y2":"x2",Fd),kf(d,"grid")}}function Vd(){rj.select("line."+g.xgridFocus).style("visibility","hidden")}function Wd(a,b){var c,d,e,f,g=[];if("year"===a)for(c=_b(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)g.push(new Date(f+"-01-01 00:00:00"));else g=b.ticks(10);return g}function Xd(a){return a.x||0===a.x?ug(a.x):null}function Yd(a){return W(a.id)(a.value)}function Zd(){var a,b,d={},e=0;return Ic(Fc(le)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function be(a,b){return"number"==typeof ii?ii:b?2*a.tickOffset()*ji/b:0}function ce(a,b){Dc(a).forEach(function(a){yj[a]=b===Ng[a],Ng[a]=b})}function de(a,b){var c=!1;return a.forEach(function(a){Ng[a.id]===b&&(c=!0),a.id in Ng||"line"!==b||(c=!0)}),c}function ee(a){return de(a,"bar")}function fe(a){return de(a,"scatter")}function ge(a){return de(a,"pie")}function he(a){return de(a,"donut")}function ie(a){return ge(a)||he(a)}function je(a){var b="string"==typeof a?a:a.id;return!(b in Ng)||"line"===Ng[b]||"spline"===Ng[b]||"area"===Ng[b]||"area-spline"===Ng[b]}function ke(a){var b="string"==typeof a?a:a.id;return"spline"===Ng[b]||"area-spline"===Ng[b]}function le(a){var b="string"==typeof a?a:a.id;return"bar"===Ng[b]}function me(a){var b="string"==typeof a?a:a.id;return"scatter"===Ng[b]}function ne(a){var b="string"==typeof a?a:a.id;return"pie"===Ng[b]}function oe(a){var b="string"==typeof a?a:a.id;return"donut"===Ng[b]}function pe(a){return ne(a)||oe(a)}function qe(a){return je(a)?[a]:[]}function re(a){return pe(a.data)?[a]:[]}function se(a){return le(a)?a.values:[]}function te(a){return je(a)||me(a)?a.values:[]}function ue(a){return le(a)||je(a)?a.values:[]}function ve(a){return oe(a)&&si||ne(a)&&mi}function we(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function xe(b){var c;try{c=Gg?Gf.time.format(Gg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Gg)}return c}function ye(a,b){var c=Gf.mouse(a),d=Gf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function De(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Ee(a,b){var c="y"===$(a.id)?vg:wg,d=mh?1:0,e=mh?0:1;return Math.pow(ug(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Fe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ge(a,b,c){_g(b,a.node()),rj.select("."+g.selectedCircles+od(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(g.selectedCircle,c)}).attr("cx",mh?Yd:Xd).attr("cy",mh?Xd:Yd).attr("stroke",function(){return Ui(b)}).attr("r",1.4*Re(b)).transition().duration(100).attr("r",Re)}function He(a,b,c){ah(b,a.node()),rj.select("."+g.selectedCircles+od(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ie(a,b,c,d){a?Ge(b,c,d):He(b,c,d)}function Je(a,b){_g(b,a.node()),a.transition().duration(100).style("fill",function(){return Gf.rgb(Ui(b)).brighter(.75)})}function Ke(a,b){ah(b,a.node()),a.transition().duration(100).style("fill",function(){return Ui(b)})}function Le(a,b,c,d){a?Je(b,c,d):Ke(b,c,d)}function Me(a,b,c,d){Le(a,b,c.data,d)}function Ne(a){return"circle"===a.nodeName?Ie:Gf.select(a).classed(g.bar)?Le:Me}function Oe(a){return a.filter(function(a){return b(a.value)})}function Pe(a){return bi?"function"==typeof ci?ci(a):ci:0}function Qe(a){return ei?fi?fi:1.75*Pe(a):Pe(a)}function Re(a){return gi?gi:4*Pe(a)}function Se(a,c){return(c?rj.selectAll("."+g.circles+od(c)):rj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Te(a,b){Se(a,b).classed(g.EXPANDED,!0).attr("r",Qe)}function Ue(a){Se(a).filter(function(){return Gf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Pe)}function Ve(a){return rj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function We(a){Ve(a).classed(g.EXPANDED,!0)}function Xe(a){Ve(a).classed(g.EXPANDED,!1)}function Ye(a,b){var c=af(a,b);return function(a,b){var d=c(a,b),e=mh?1:0,f=mh?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 Ze(a,b){var c=af(a,!1),d=b?$e:_e;return function(a,b){return d(c(a,b),a,this)}}function $e(a,b){var c;return mh?(c=le(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function _e(a,b,c){var d=c.getBoundingClientRect();return mh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:le(b)?-3:-6)}function af(a,b){var c=a.__max__+1,d=be(Ag,c),e=$d(d,c,a,!!b),f=_d(!!b),g=ae(a,!!b),h=b?X:W;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return mh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function bf(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 cf(b){var c,d,e;if(vj=Gf.select(Jf),vj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(vj.html("").classed("c3",!0),Hf.data.xs={},Hf.data.targets=vc(b),Tg&&Lc(Tg===!0?Cc(Hf.data.targets):Tg),o(),S(),ug.domain(Gf.extent(_b(Hf.data.targets))),vg.domain(Xb(Hf.data.targets,"y")),wg.domain(Xb(Hf.data.targets,"y2")),xg.domain(ug.domain()),yg.domain(vg.domain()),zg.domain(wg.domain()),wj=ug.domain(),kj.scale(xg),Qf&&oj.scale(ug),pj=vj.append("svg").on("mouseenter",Tf).on("mouseleave",Uf),qj=pj.append("defs"),qj.append("clipPath").attr("id",Fi).append("rect"),qj.append("clipPath").attr("id",Gi).append("rect"),qj.append("clipPath").attr("id",Hi).append("rect"),pf(),rj=pj.append("g").attr("transform",bj.main),sj=pj.append("g").attr("transform",bj.context),tj=pj.append("g").attr("transform",bj.legend),dh||sj.style("visibility","hidden"),gh||(tj.style("visibility","hidden"),Yi=Cc(Hf.data.targets)),uj=Gf.select(Jf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Bf(Cc(Hf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=rj.append("g").attr("clip-path",Ii).attr("class",g.grid),Xh&&d.append("g").attr("class",g.xgrids),Ce(Zh)&&d.append("g").attr("class",g.xgridLines),di&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),$h&&d.append("g").attr("class",g.ygrids),Ce(_h)&&d.append("g").attr("class",g.ygridLines),rj.append("g").attr("clip-path",Ii).attr("class",g.regions),rj.append("g").attr("clip-path",Ii).attr("class",g.chart),c=rj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Qf?mh?"ns-resize":"ew-resize":null),rj.select("."+g.chart).append("g").attr("class",g.chartBars),rj.select("."+g.chart).append("g").attr("class",g.chartLines),rj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",bj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Rb()),rj.select("."+g.chart).append("g").attr("class",g.chartTexts),Qf&&rj.insert("rect",Sf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",_f).attr("height",bg).style("opacity",0).style("cursor",mh?"ns-resize":"ew-resize").call(oj).on("dblclick.zoom",null),Dh&&kj.extent("function"!=typeof Dh?Dh:Dh(_b())),nh&&rj.append("g").attr("class",g.axisX).attr("clip-path",Ji).attr("transform",bj.x).append("text").attr("class",g.axisXLabel).attr("transform",mh?"rotate(-90)":"").style("text-anchor",Ab),Fh&&rj.append("g").attr("class",g.axisY).attr("clip-path",Ki).attr("transform",bj.y).append("text").attr("class",g.axisYLabel).attr("transform",mh?"":"rotate(-90)").style("text-anchor",Bb),Oh&&rj.append("g").attr("class",g.axisY2).attr("transform",bj.y2).append("text").attr("class",g.axisY2Label).attr("transform",mh?"":"rotate(-90)").style("text-anchor",Cb),sj.append("g").attr("clip-path",Ii).attr("class",g.chart),sj.select("."+g.chart).append("g").attr("class",g.chartBars),sj.select("."+g.chart).append("g").attr("class",g.chartLines),sj.append("g").attr("clip-path",Ii).attr("class",g.brush).call(kj).selectAll("rect").attr(mh?"width":"height",mh?ag:cg),sj.append("g").attr("class",g.axisX).attr("transform",bj.subx).attr("clip-path",mh?"":Ji),rf(Hf.data.targets),mh?rj.select("."+g.axisX).style("opacity",0).call(Ag):(rj.select("."+g.axisY).style("opacity",0).call(Bg),rj.select("."+g.axisY2).style("opacity",0).call(Cg)),o(),S(),pf(),n(!1),lf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Ci){if(Li&&"string"==typeof Di){for(Di=xe(Di),e=0;e0){d=[];for(var f in Ig)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Od(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Le,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function hf(a){ie(Hf.data.targets)||Ug&&(Oi=a,rj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Pi=!0,bh())}function jf(){ie(Hf.data.targets)||Ug&&(rj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),rj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Pi=!1,ch())}function kf(a,b){"grid"===b&&a.each(function(){var a=Gf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function lf(a){var c,e,f,h,i,j,k,l,m,n,o,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,$,_=Zd(),ab=ie(Hf.data.targets),bb=Ic(Hf.data.targets);if(a=d(a)?a:{},G=d(a.withY)?a.withY:!0,H=d(a.withSubchart)?a.withSubchart:!0,I=d(a.withTransition)?a.withTransition:!0,L=d(a.withTransform)?a.withTransform:!1,N=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,O=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,P=d(a.withLegend)?a.withLegend:!1,J=d(a.withTransitionForExit)?a.withTransitionForExit:I,K=d(a.withTransitionForAxis)?a.withTransitionForAxis:I,V=I?Xf:0,W=J?V:0,X=K?V:0,c=rj.select("."+g.axisX).style("opacity",ab?0:1),f=rj.select("."+g.axisY).style("opacity",ab?0:1),h=rj.select("."+g.axisY2).style("opacity",ab?0:1),e=sj.select("."+g.axisX).style("opacity",ab?0:1),U={axisX:c.transition().duration(X),axisY:f.transition().duration(X),axisY2:h.transition().duration(X),axisSubX:e.transition().duration(X)},P&&gh&&Bf(Cc(Hf.data.targets),a,U),Mi&&(0!==bb.length&&O&&N||ug.domain([0,c.selectAll(".tick").size()])),bb.length&&(O&&(ug.domain(Gf.extent(_b(bb))),wj=ug.domain(),Qf&&oj.scale(ug).updateScaleExtent(),xg.domain(ug.domain()),kj.scale(xg)),N&&(ug.domain(kj.empty()?wj:kj.extent()),Qf&&oj.scale(ug).updateScaleExtent()),xh||!wh&&!vh||(Y=Kc(Jc(bb),vh),Ag.tickValues(Y),Dg.tickValues(Y))),vg.domain(Xb(bb,"y")),wg.domain(Xb(bb,"y2")),U.axisX.call(Ag),U.axisY.call(Bg),U.axisY2.call(Cg),U.axisSubX.call(Dg),Eb(I),N&&bb.length)if(th&&Y){for(Z=1;Z=0&&Gf.select(this).style("display",b%$?"none":"block")})}else pj.selectAll("."+g.axisX+" .tick text").style("display","block");!mh&&yh&&fb(c,U.axisX,yh),Q=Ye(_),S=Ze(_,!0),T=Ze(_,!1),yg.domain(vg.domain()),zg.domain(wg.domain()),uj.style("display","none"),p(),rj.select("line."+g.xgridFocus).style("visibility","hidden"),Xh&&(k=Wd(Yh,ug),D=Mi?Ag.tickOffset():0,j=mh?{x1:0,x2:_f,y1:function(a){return ug(a)-D},y2:function(a){return ug(a)-D}}:{x1:function(a){return ug(a)+D},x2:function(a){return ug(a)+D},y1:Yf.top,y2:bg},i=rj.select("."+g.xgrids).selectAll("."+g.xgrid).data(k),i.enter().append("line").attr("class",g.xgrid),i.attr(j).style("opacity",function(){return+Gf.select(this).attr(mh?"y1":"x1")===(mh?bg:0)?0:1}),i.exit().remove()),Ce(Zh)&&(l=rj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(Zh),m=l.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",mh?"":"rotate(-90)").attr("dx",mh?0:-Yf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(V).attr("x1",mh?0:Gd).attr("x2",mh?_f:Gd).attr("y1",mh?Gd:Yf.top).attr("y2",mh?Gd:bg).style("opacity",1),l.select("text").transition().duration(V).attr("x",mh?_f:0).attr("y",Gd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(V).style("opacity",0).remove()),G&&$h&&(n=rj.select("."+g.ygrids).selectAll("."+g.ygrid).data(vg.ticks(ai)),n.enter().append("line").attr("class",g.ygrid),n.attr("x1",mh?vg:0).attr("x2",mh?vg:_f).attr("y1",mh?0:vg).attr("y2",mh?bg:vg),n.exit().remove(),kf(n,"grid")),G&&Ce(_h)&&(o=rj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(_h),q=o.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),q.append("line").style("opacity",0),q.append("text").attr("text-anchor","end").attr("transform",mh?"rotate(-90)":"").attr("dx",mh?0:-Yf.top).attr("dy",-5).style("opacity",0),o.select("line").transition().duration(V).attr("x1",mh?Hd:0).attr("x2",mh?Hd:_f).attr("y1",mh?0:Hd).attr("y2",mh?bg:Hd).style("opacity",1),o.select("text").transition().duration(V).attr("x",mh?0:_f).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),o.exit().transition().duration(V).style("opacity",0).remove()),w=rj.select("."+g.regions).selectAll("."+g.region).data(xi),w.enter().append("g").attr("class",hd).append("rect").style("fill-opacity",0),w.selectAll("rect").attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(V).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),w.exit().transition().duration(V).style("fill-opacity",0).remove(),u=rj.selectAll("."+g.bars).selectAll("."+g.bar).data(se),u.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Ui),u.style("opacity",td).transition().duration(V).attr("d",Q).style("fill",Ui).style("opacity",1),u.exit().transition().duration(W).style("opacity",0).remove(),r=rj.selectAll("."+g.lines).selectAll("."+g.line).data(qe),r.enter().append("path").attr("class",Zc).style("stroke",Ui),r.style("opacity",td).transition().duration(V).attr("d",lj).style("stroke",Ui).style("opacity",1),r.exit().transition().duration(W).style("opacity",0).remove(),s=rj.selectAll("."+g.areas).selectAll("."+g.area).data(qe),s.enter().append("path").attr("class",fd).style("fill",Ui).style("opacity",function(){return xj=+Gf.select(this).style("opacity"),0}),s.style("opacity",0).transition().duration(V).attr("d",mj).style("fill",Ui).style("opacity",xj),s.exit().transition().duration(W).style("opacity",0).remove(),t=rj.selectAll("."+g.circles).selectAll("."+g.circle).data(te),t.enter().append("circle").attr("class",_c).attr("r",Pe).style("fill",Ui),t.style("opacity",td).transition().duration(V).style("opacity",vd).style("fill",Ui).attr("cx",mh?Yd:Xd).attr("cy",mh?Xd:Yd),t.exit().remove(),x=rj.selectAll("."+g.texts).selectAll("."+g.text).data(ue),x.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return mh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",Ui).style("fill-opacity",0),x.text(function(a){return Ed(a.id)(a.value,a.id)}).style("fill-opacity",ud).transition().duration(V).attr("x",S).attr("y",T).style("fill",Ui).style("fill-opacity",wd),x.exit().transition().duration(W).style("fill-opacity",0).remove(),v=rj.selectAll("."+g.arcs).selectAll("."+g.arc).data(re),v.enter().append("path").attr("class",dd).style("fill",function(a){return Ui(a.data)}).style("cursor",function(a){return Wg(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Si||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),xf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Sd(d,Gf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Si||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),yf(),Td(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();ff(this,a,b),e(d,b)}),v.attr("transform",L?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Si=!0}).transition().duration(V).attrTween("d",function(a){var b,c=Fb(a);return c?(b=Gf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",L?"scale(1)":"").style("fill",function(a){return Ui(a.data)}).style("opacity",1).call(Fe,function(){Si=!1}),v.exit().transition().duration(W).style("opacity",0).remove(),rj.selectAll("."+g.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(V).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&pe(a.data)?1:0}),rj.select("."+g.chartArcsTitle).style("opacity",he(Hf.data.targets)?1:0),dh&&(null!==Gf.event&&"zoom"===Gf.event.type&&kj.extent(ug.orgDomain()).update(),H&&(!mh&&yh&&fb(e,U.axisSubX,yh),kj.empty()||kj.extent(ug.orgDomain()).update(),R=Ye(_,!0),z=sj.selectAll("."+g.bars).selectAll("."+g.bar).data(se),z.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Ui),z.style("opacity",td).transition().duration(V).attr("d",R).style("opacity",1),z.exit().transition().duration(V).style("opacity",0).remove(),y=sj.selectAll("."+g.lines).selectAll("."+g.line).data(qe),y.enter().append("path").attr("class",Zc).style("stroke",Ui),y.style("opacity",td).transition().duration(V).attr("d",nj).style("opacity",1),y.exit().transition().duration(V).style("opacity",0).remove())),rj.selectAll("."+g.selectedCircles).filter(function(a){return le(a)}).selectAll("circle").remove(),rj.selectAll("."+g.selectedCircle).transition().duration(V).attr("cx",mh?Yd:Xd).attr("cy",mh?Xd:Yd),A=rj.select("."+g.eventRects),Ce(Fg)&&!oc(Fg)?(A.classed(g.eventRectsMultiple)||A.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),B=rj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),ef(B.enter()),B.attr("x",0).attr("y",0).attr("width",_f).attr("height",bg)):(A.classed(g.eventRectsSingle)||A.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Ni&&!Mi?(F=function(a,b){var c=xc(b),d=yc(b),e=Hf.data.xs[a.id][b];return(ug(d?d:e+50)-ug(c?c:e-50))/2},E=function(a,b){var c=xc(b),d=Hf.data.xs[a.id][b];return(ug(d)+ug(c?c:d-50))/2}):(F=M(),E=function(a){return ug(a.x)-F/2}),C=Ac(Hf.data.targets),rj.select("."+g.eventRects).datum(C?C.values:[]),B=rj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),df(B.enter()),B.attr("class",id).attr("x",mh?0:E).attr("y",mh?E:0).attr("width",mh?_f:F).attr("height",mh?F:bg),B.exit().remove()),Cc(Hf.data.targets).forEach(function(a){yj[a]=!0})}function mf(){lf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function nf(){return"mousemove"===Gf.event.sourceEvent.type&&oj.altDomain?(ug.domain(oj.altDomain),void oj.scale(ug).updateScaleExtent()):(Mi&&ug.orgDomain()[0]===wj[0]&&ug.domain([wj[0]-1e-10,ug.orgDomain()[1]]),lf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Gf.event.sourceEvent.type&&(Qi=!0)))}function of(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function pf(){pj.attr("width",dg).attr("height",eg),pj.select("#"+Fi).select("rect").attr("width",_f).attr("height",bg),pj.select("#"+Gi).select("rect").attr("x",C).attr("y",D).attr("width",I).attr("height",J),pj.select("#"+Hi).select("rect").attr("x",E).attr("y",F).attr("width",K).attr("height",L),pj.select("."+g.zoomRect).attr("width",_f).attr("height",bg),vj.style("max-height",eg+"px")}function qf(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,o(),S(),pf(),n(a.withTransition),lf(a)}function rf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=rj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",kd),j=i.enter().append("g").attr("class",kd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc),e=rj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",md),d=e.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",cd).style("cursor",function(a){return Wg(a)?"pointer":null}),c=rj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",ld),b=c.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",$c),b.append("g").attr("class",gd),b.append("g").attr("class",function(a){return Uc(g.selectedCircles,a.id)}),b.append("g").attr("class",ad).style("cursor",function(a){return Wg(a)?"pointer":null}),a.forEach(function(a){rj.selectAll("."+g.selectedCircles+od(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=rj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(lg(a)).attr("class",nd),f=h.enter().append("g").attr("class",nd),f.append("g").attr("class",ed),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),dh&&(n=sj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",md),m=n.enter().append("g").style("opacity",0).attr("class",md),m.append("g").attr("class",cd),l=sj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",ld),k=l.enter().append("g").style("opacity",0).attr("class",ld),k.append("g").attr("class",$c)),pj.selectAll("."+g.target).filter(function(a){return Gc(a.id)}).transition().duration(Xf).style("opacity",1)}function sf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?ce(a.id,b.types[a.id]):ce(a.id,b.type)}),Hf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=cj?j:i,l=cj?R():Q();return d&&(w=0,C=0,t=0,u=0),gh&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=cj?u:t,void(lh?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=tj.selectAll("."+g.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,cj?(f=function(a){return t*B[a]},j=function(a){return A[B[a]]+x[a]}):(f=function(a){return A[B[a]]+x[a]},j=function(a){return u*B[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=tj.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(g.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof ih?ih(a):Hf.toggle(a)}).on("mouseover",function(a){Gf.select(this).classed(g.legendItemFocused,!0),Si||Hf.focus(a),"function"==typeof jh&&jh(a)}).on("mouseout",function(a){Gf.select(this).classed(g.legendItemFocused,!1),Si||Hf.revert(),"function"==typeof kh&&kh(a)}),m.append("text").text(function(a){return d(Ig[a])?Ig[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",cj?h:-200).attr("y",cj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",cj?i:-200).attr("y",cj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",Ui).attr("x",cj?h:-200).attr("y",cj?-200:j).attr("width",10).attr("height",10),tj.selectAll("text").data(a).text(function(a){return d(Ig[a])?Ig[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),tj.selectAll("rect."+g.legendItemEvent).data(a).transition().duration(p?250:0).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}).attr("x",i).attr("y",l),tj.selectAll("rect."+g.legendItemTile).data(a).transition().duration(p?250:0).style("fill",Ui).attr("x",f).attr("y",j),tj.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=Gf.select(this);return Gc(a)?!D||b.classed(g.legendItemFocused)?vf(b):wf(b):gj}),O(t),P(u),N(C),o(),S(),pf(),n(q,c)}function Cf(a){return Ec(Hf.data.targets,a.id)}function Df(a){return"data"in a&&Ec(Hf.data.targets,a.data.id)}function Ef(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 Ff(a,b,c){var d=!ie(Hf.data.targets);Si=!1,ce(a,b),qf(c||{withTransitionForAxis:d})}var Gf=a.d3?a.d3:a.require?a.require("d3"):void 0,Hf={data:{},axis:{},legend:{}},If={},Jf=i(["bindto"],"#chart"),Kf=i(["size","width"]),Lf=i(["size","height"]),Mf=i(["padding","left"],50),Nf=i(["padding","right"],0),Of=i(["padding","top"],0),Pf=i(["padding","bottom"],0),Qf=i(["zoom","enabled"],!1),Rf=i(["zoom","extent"]),Sf=i(["zoom","privileged"],!1),Tf=i(["onenter"],function(){}),Uf=i(["onleave"],function(){}),Vf=i(["onresize"],function(){}),Wf=i(["onresized"],function(){}),Xf=i(["transition","duration"],350);h("data","data is required in config");var Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg=i(["data","x"]),Fg=i(["data","xs"],{}),Gg=i(["data","x_format"]),Hg=i(["data","id_converter"],function(a){return a}),Ig=i(["data","names"],{}),Jg=i(["data","classes"],{}),Kg=i(["data","groups"],[]),Lg=i(["data","axes"],{}),Mg=i(["data","type"]),Ng=i(["data","types"],{}),Og=i(["data","labels"],{}),Pg=i(["data","order"]),Qg=i(["data","regions"],{}),Rg=i(["data","color"]),Sg=i(["data","colors"],{}),Tg=i(["data","hide"],!1),Ug=i(["data","selection","enabled"],!1),Vg=i(["data","selection","grouped"],!1),Wg=i(["data","selection","isselectable"],function(){return!0}),Xg=i(["data","selection","multiple"],!0),Yg=i(["data","onclick"],function(){}),Zg=i(["data","onenter"],function(){}),$g=i(["data","onleave"],function(){}),_g=i(["data","onselected"],function(){}),ah=i(["data","onunselected"],function(){}),bh=i(["data","ondragstart"],function(){}),ch=i(["data","ondragend"],function(){}),dh=i(["subchart","show"],!1),eh=i(["subchart","size","height"],60),fh=i(["color","pattern"],[]),gh=i(["legend","show"],!0),hh=i(["legend","position"],"bottom"),ih=i(["legend","item","onclick"]),jh=i(["legend","item","onmouseover"]),kh=i(["legend","item","onmouseout"]),lh=i(["legend","equally"],!1),mh=i(["axis","rotated"],!1),nh=i(["axis","x","show"],!0),oh=i(["axis","x","type"],"indexed"),ph=i(["axis","x","localtime"],!0),qh=i(["axis","x","categories"],[]),rh=i(["axis","x","tick","centered"],!1),sh=i(["axis","x","tick","format"]),th=i(["axis","x","tick","culling"],{}),uh=i(["axis","x","tick","culling","max"],10),vh=i(["axis","x","tick","count"]),wh=i(["axis","x","tick","fit"],!0),xh=i(["axis","x","tick","values"],null),yh=i(["axis","x","tick","rotate"]),zh=i(["axis","x","max"],null),Ah=i(["axis","x","min"],null),Bh=i(["axis","x","padding"],{}),Ch=i(["axis","x","height"]),Dh=i(["axis","x","default"]),Eh=i(["axis","x","label"],{}),Fh=i(["axis","y","show"],!0),Gh=i(["axis","y","max"]),Hh=i(["axis","y","min"]),Ih=i(["axis","y","center"]),Jh=i(["axis","y","label"],{}),Kh=i(["axis","y","inner"],!1),Lh=i(["axis","y","tick","format"]),Mh=i(["axis","y","padding"]),Nh=i(["axis","y","ticks"],10),Oh=i(["axis","y2","show"],!1),Ph=i(["axis","y2","max"]),Qh=i(["axis","y2","min"]),Rh=i(["axis","y2","center"]),Sh=i(["axis","y2","label"],{}),Th=i(["axis","y2","inner"],!1),Uh=i(["axis","y2","tick","format"]),Vh=i(["axis","y2","padding"]),Wh=i(["axis","y2","ticks"],10),Xh=i(["grid","x","show"],!1),Yh=i(["grid","x","type"],"tick"),Zh=i(["grid","x","lines"],[]),$h=i(["grid","y","show"],!1),_h=i(["grid","y","lines"],[]),ai=i(["grid","y","ticks"],10),bi=i(["point","show"],!0),ci=i(["point","r"],2.5),di=i(["point","focus","line","enabled"],!0),ei=i(["point","focus","expand","enabled"],!0),fi=i(["point","focus","expand","r"]),gi=i(["point","focus","select","r"]),hi=i(["line","connect_null"],!1),ii=i(["bar","width"]),ji=i(["bar","width","ratio"],.6),ki=i(["pie","label","show"],!0),li=i(["pie","label","format"]),mi=i(["pie","expand"],!0),ni=i(["pie","onclick"],function(){}),oi=i(["pie","onmouseover"],function(){}),pi=i(["pie","onmouseout"],function(){}),qi=i(["donut","label","show"],!0),ri=i(["donut","label","format"]),si=i(["donut","expand"],!0),ti=i(["donut","title"],""),ui=i(["donut","onclick"],function(){}),vi=i(["donut","onmouseover"],function(){}),wi=i(["donut","onmouseout"],function(){}),xi=i(["regions"],[]),yi=i(["tooltip","show"],!0),zi=i(["tooltip","format","title"]),Ai=i(["tooltip","format","value"]),Bi=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=zi?zi:b,l=Ai?Ai:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Ci=i(["tooltip","init","show"],!1),Di=i(["tooltip","init","x"],0),Ei=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Fi=("string"==typeof Jf?Jf.replace("#",""):Jf.id)+"-clip",Gi=Fi+"-xaxis",Hi=Fi+"-yaxis",Ii=j(Fi),Ji=j(Gi),Ki=j(Hi),Li="timeseries"===oh,Mi="categorized"===oh,Ni=!Li&&(Eg||Ce(Fg)),Oi=null,Pi=!1,Qi=!1,Ri=!1,Si=!1,Ti=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ui=we(Sg,Ce(fh)?fh:Ti,Rg),Vi=ph?Gf.time.format:Gf.time.format.utc,Wi=function(){var a=[[Vi("%Y/%-m/%-d"),function(){return!0}],[Vi("%-m/%-d"),function(a){return a.getMonth()}],[Vi("%-m/%-d"),function(a){return 1!==a.getDate()}],[Vi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Vi("%I %p"),function(a){return a.getHours()}],[Vi("%I:%M"),function(a){return a.getMinutes()}],[Vi(":%S"),function(a){return a.getSeconds()}],[Vi(".%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)}}(),Xi=[],Yi=[],Zi=mh?"left":"bottom",$i=mh?Kh?"top":"bottom":Kh?"right":"left",_i=mh?Th?"bottom":"top":Th?"left":"right",aj=mh?"left":"bottom",bj={main:function(){return"translate("+Yf.left+","+Yf.top+")"},context:function(){return"translate("+Zf.left+","+Zf.top+")"},legend:function(){return"translate("+$f.left+","+$f.top+")"},x:function(){return"translate(0,"+(mh?0:bg)+")"},y:function(){return"translate(0,"+(mh?bg:0)+")"},y2:function(){return"translate("+(mh?0:_f)+","+(mh?1:0)+")"},subx:function(){return"translate(0,"+(mh?0:cg)+")"},arc:function(){return"translate("+_f/2+","+bg/2+")"}},cj="right"===hh,dj=0,ej=0,fj=0,gj=.15,hj=30,ij=mh&&!nh?0:30,jj=5;lg=Gf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var kj,lj=function(){var a=Gf.svg.line().x(mh?function(a){return W(a.id)(a.value) +var u=2*o;for(h=o;1>=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function cf(b){var c,d,e;if(vj=Gf.select(Jf),vj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(vj.html("").classed("c3",!0),Hf.data.xs={},Hf.data.targets=vc(b),Tg&&Lc(Tg===!0?Cc(Hf.data.targets):Tg),o(),S(),ug.domain(Gf.extent(_b(Hf.data.targets))),vg.domain(Xb(Hf.data.targets,"y")),wg.domain(Xb(Hf.data.targets,"y2")),xg.domain(ug.domain()),yg.domain(vg.domain()),zg.domain(wg.domain()),wj=ug.domain(),kj.scale(xg),Qf&&oj.scale(ug),pj=vj.append("svg").on("mouseenter",Tf).on("mouseleave",Uf),qj=pj.append("defs"),qj.append("clipPath").attr("id",Fi).append("rect"),qj.append("clipPath").attr("id",Gi).append("rect"),qj.append("clipPath").attr("id",Hi).append("rect"),pf(),rj=pj.append("g").attr("transform",bj.main),sj=pj.append("g").attr("transform",bj.context),tj=pj.append("g").attr("transform",bj.legend),dh||sj.style("visibility","hidden"),gh||(tj.style("visibility","hidden"),Yi=Cc(Hf.data.targets)),uj=Gf.select(Jf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Bf(Cc(Hf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=rj.append("g").attr("clip-path",Ii).attr("class",g.grid),Xh&&d.append("g").attr("class",g.xgrids),Ce(Zh)&&d.append("g").attr("class",g.xgridLines),di&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),$h&&d.append("g").attr("class",g.ygrids),Ce(_h)&&d.append("g").attr("class",g.ygridLines),rj.append("g").attr("clip-path",Ii).attr("class",g.regions),rj.append("g").attr("clip-path",Ii).attr("class",g.chart),c=rj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Qf?mh?"ns-resize":"ew-resize":null),rj.select("."+g.chart).append("g").attr("class",g.chartBars),rj.select("."+g.chart).append("g").attr("class",g.chartLines),rj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",bj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Rb()),rj.select("."+g.chart).append("g").attr("class",g.chartTexts),Qf&&rj.insert("rect",Sf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",_f).attr("height",bg).style("opacity",0).style("cursor",mh?"ns-resize":"ew-resize").call(oj).on("dblclick.zoom",null),Dh&&kj.extent("function"!=typeof Dh?Dh:Dh(_b())),nh&&rj.append("g").attr("class",g.axisX).attr("clip-path",Ji).attr("transform",bj.x).append("text").attr("class",g.axisXLabel).attr("transform",mh?"rotate(-90)":"").style("text-anchor",Ab),Fh&&rj.append("g").attr("class",g.axisY).attr("clip-path",Ki).attr("transform",bj.y).append("text").attr("class",g.axisYLabel).attr("transform",mh?"":"rotate(-90)").style("text-anchor",Bb),Oh&&rj.append("g").attr("class",g.axisY2).attr("transform",bj.y2).append("text").attr("class",g.axisY2Label).attr("transform",mh?"":"rotate(-90)").style("text-anchor",Cb),sj.append("g").attr("clip-path",Ii).attr("class",g.chart),sj.select("."+g.chart).append("g").attr("class",g.chartBars),sj.select("."+g.chart).append("g").attr("class",g.chartLines),sj.append("g").attr("clip-path",Ii).attr("class",g.brush).call(kj).selectAll("rect").attr(mh?"width":"height",mh?ag:cg),sj.append("g").attr("class",g.axisX).attr("transform",bj.subx).attr("clip-path",mh?"":Ji),rf(Hf.data.targets),mh?rj.select("."+g.axisX).style("opacity",0).call(Ag):(rj.select("."+g.axisY).style("opacity",0).call(Bg),rj.select("."+g.axisY2).style("opacity",0).call(Cg)),o(),S(),pf(),n(!1),lf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Ci){if(Li&&"string"==typeof Di){for(Di=xe(Di),e=0;e0){d=[];for(var f in Ig)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Od(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Le,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function hf(a){ie(Hf.data.targets)||Ug&&(Oi=a,rj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Pi=!0,bh())}function jf(){ie(Hf.data.targets)||Ug&&(rj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),rj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Pi=!1,ch())}function kf(a,b){"grid"===b&&a.each(function(){var a=Gf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function lf(a){var c,e,f,h,i,j,k,l,m,n,o,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,$,_=Zd(),ab=ie(Hf.data.targets),bb=Ic(Hf.data.targets);if(a=d(a)?a:{},G=d(a.withY)?a.withY:!0,H=d(a.withSubchart)?a.withSubchart:!0,I=d(a.withTransition)?a.withTransition:!0,L=d(a.withTransform)?a.withTransform:!1,N=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,O=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,P=d(a.withLegend)?a.withLegend:!1,J=d(a.withTransitionForExit)?a.withTransitionForExit:I,K=d(a.withTransitionForAxis)?a.withTransitionForAxis:I,V=I?Xf:0,W=J?V:0,X=K?V:0,c=rj.select("."+g.axisX).style("opacity",ab?0:1),f=rj.select("."+g.axisY).style("opacity",ab?0:1),h=rj.select("."+g.axisY2).style("opacity",ab?0:1),e=sj.select("."+g.axisX).style("opacity",ab?0:1),U={axisX:c.transition().duration(X),axisY:f.transition().duration(X),axisY2:h.transition().duration(X),axisSubX:e.transition().duration(X)},P&&gh&&Bf(Cc(Hf.data.targets),a,U),Mi&&(0!==bb.length&&O&&N||ug.domain([0,c.selectAll(".tick").size()])),bb.length&&(O&&(ug.domain(Gf.extent(_b(bb))),wj=ug.domain(),Qf&&oj.scale(ug).updateScaleExtent(),xg.domain(ug.domain()),kj.scale(xg)),N&&(ug.domain(kj.empty()?wj:kj.extent()),Qf&&oj.scale(ug).updateScaleExtent()),xh||!wh&&!vh||(Y=Kc(Jc(bb),vh),Ag.tickValues(Y),Dg.tickValues(Y))),vg.domain(Xb(bb,"y")),wg.domain(Xb(bb,"y2")),U.axisX.call(Ag),U.axisY.call(Bg),U.axisY2.call(Cg),U.axisSubX.call(Dg),Eb(I),N&&bb.length)if(th&&Y){for(Z=1;Z=0&&Gf.select(this).style("display",b%$?"none":"block")})}else pj.selectAll("."+g.axisX+" .tick text").style("display","block");!mh&&yh&&fb(c,U.axisX,yh),Q=Ye(_),S=Ze(_,!0),T=Ze(_,!1),yg.domain(vg.domain()),zg.domain(wg.domain()),uj.style("display","none"),p(),rj.select("line."+g.xgridFocus).style("visibility","hidden"),Xh&&(k=Wd(Yh,ug),D=Mi?Ag.tickOffset():0,j=mh?{x1:0,x2:_f,y1:function(a){return ug(a)-D},y2:function(a){return ug(a)-D}}:{x1:function(a){return ug(a)+D},x2:function(a){return ug(a)+D},y1:Yf.top,y2:bg},i=rj.select("."+g.xgrids).selectAll("."+g.xgrid).data(k),i.enter().append("line").attr("class",g.xgrid),i.attr(j).style("opacity",function(){return+Gf.select(this).attr(mh?"y1":"x1")===(mh?bg:0)?0:1}),i.exit().remove()),Ce(Zh)&&(l=rj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(Zh),m=l.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",mh?"":"rotate(-90)").attr("dx",mh?0:-Yf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(V).attr("x1",mh?0:Gd).attr("x2",mh?_f:Gd).attr("y1",mh?Gd:Yf.top).attr("y2",mh?Gd:bg).style("opacity",1),l.select("text").transition().duration(V).attr("x",mh?_f:0).attr("y",Gd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(V).style("opacity",0).remove()),G&&$h&&(n=rj.select("."+g.ygrids).selectAll("."+g.ygrid).data(vg.ticks(ai)),n.enter().append("line").attr("class",g.ygrid),n.attr("x1",mh?vg:0).attr("x2",mh?vg:_f).attr("y1",mh?0:vg).attr("y2",mh?bg:vg),n.exit().remove(),kf(n,"grid")),G&&Ce(_h)&&(o=rj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(_h),q=o.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),q.append("line").style("opacity",0),q.append("text").attr("text-anchor","end").attr("transform",mh?"rotate(-90)":"").attr("dx",mh?0:-Yf.top).attr("dy",-5).style("opacity",0),o.select("line").transition().duration(V).attr("x1",mh?Hd:0).attr("x2",mh?Hd:_f).attr("y1",mh?0:Hd).attr("y2",mh?bg:Hd).style("opacity",1),o.select("text").transition().duration(V).attr("x",mh?0:_f).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),o.exit().transition().duration(V).style("opacity",0).remove()),w=rj.select("."+g.regions).selectAll("."+g.region).data(xi),w.enter().append("g").attr("class",hd).append("rect").style("fill-opacity",0),w.selectAll("rect").transition().duration(V).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),w.exit().transition().duration(V).style("fill-opacity",0).remove(),u=rj.selectAll("."+g.bars).selectAll("."+g.bar).data(se),u.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Ui),u.style("opacity",td).transition().duration(V).attr("d",Q).style("fill",Ui).style("opacity",1),u.exit().transition().duration(W).style("opacity",0).remove(),r=rj.selectAll("."+g.lines).selectAll("."+g.line).data(qe),r.enter().append("path").attr("class",Zc).style("stroke",Ui),r.style("opacity",td).transition().duration(V).attr("d",lj).style("stroke",Ui).style("opacity",1),r.exit().transition().duration(W).style("opacity",0).remove(),s=rj.selectAll("."+g.areas).selectAll("."+g.area).data(qe),s.enter().append("path").attr("class",fd).style("fill",Ui).style("opacity",function(){return xj=+Gf.select(this).style("opacity"),0}),s.style("opacity",0).transition().duration(V).attr("d",mj).style("fill",Ui).style("opacity",xj),s.exit().transition().duration(W).style("opacity",0).remove(),t=rj.selectAll("."+g.circles).selectAll("."+g.circle).data(te),t.enter().append("circle").attr("class",_c).attr("r",Pe).style("fill",Ui),t.style("opacity",td).transition().duration(V).style("opacity",vd).style("fill",Ui).attr("cx",mh?Yd:Xd).attr("cy",mh?Xd:Yd),t.exit().remove(),x=rj.selectAll("."+g.texts).selectAll("."+g.text).data(ue),x.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return mh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",Ui).style("fill-opacity",0),x.text(function(a){return Ed(a.id)(a.value,a.id)}).style("fill-opacity",ud).transition().duration(V).attr("x",S).attr("y",T).style("fill",Ui).style("fill-opacity",wd),x.exit().transition().duration(W).style("fill-opacity",0).remove(),v=rj.selectAll("."+g.arcs).selectAll("."+g.arc).data(re),v.enter().append("path").attr("class",dd).style("fill",function(a){return Ui(a.data)}).style("cursor",function(a){return Wg(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Si||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),xf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Sd(d,Gf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Si||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),yf(),Td(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();ff(this,a,b),e(d,b)}),v.attr("transform",L?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Si=!0}).transition().duration(V).attrTween("d",function(a){var b,c=Fb(a);return c?(b=Gf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",L?"scale(1)":"").style("fill",function(a){return Ui(a.data)}).style("opacity",1).call(Fe,function(){Si=!1}),v.exit().transition().duration(W).style("opacity",0).remove(),rj.selectAll("."+g.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(V).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&pe(a.data)?1:0}),rj.select("."+g.chartArcsTitle).style("opacity",he(Hf.data.targets)?1:0),dh&&(null!==Gf.event&&"zoom"===Gf.event.type&&kj.extent(ug.orgDomain()).update(),H&&(!mh&&yh&&fb(e,U.axisSubX,yh),kj.empty()||kj.extent(ug.orgDomain()).update(),R=Ye(_,!0),z=sj.selectAll("."+g.bars).selectAll("."+g.bar).data(se),z.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Ui),z.style("opacity",td).transition().duration(V).attr("d",R).style("opacity",1),z.exit().transition().duration(V).style("opacity",0).remove(),y=sj.selectAll("."+g.lines).selectAll("."+g.line).data(qe),y.enter().append("path").attr("class",Zc).style("stroke",Ui),y.style("opacity",td).transition().duration(V).attr("d",nj).style("opacity",1),y.exit().transition().duration(V).style("opacity",0).remove())),rj.selectAll("."+g.selectedCircles).filter(function(a){return le(a)}).selectAll("circle").remove(),rj.selectAll("."+g.selectedCircle).transition().duration(V).attr("cx",mh?Yd:Xd).attr("cy",mh?Xd:Yd),A=rj.select("."+g.eventRects),Ce(Fg)&&!oc(Fg)?(A.classed(g.eventRectsMultiple)||A.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),B=rj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),ef(B.enter()),B.attr("x",0).attr("y",0).attr("width",_f).attr("height",bg)):(A.classed(g.eventRectsSingle)||A.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Ni&&!Mi?(F=function(a,b){var c=xc(b),d=yc(b),e=Hf.data.xs[a.id][b];return(ug(d?d:e+50)-ug(c?c:e-50))/2},E=function(a,b){var c=xc(b),d=Hf.data.xs[a.id][b];return(ug(d)+ug(c?c:d-50))/2}):(F=M(),E=function(a){return ug(a.x)-F/2}),C=Ac(Hf.data.targets),rj.select("."+g.eventRects).datum(C?C.values:[]),B=rj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),df(B.enter()),B.attr("class",id).attr("x",mh?0:E).attr("y",mh?E:0).attr("width",mh?_f:F).attr("height",mh?F:bg),B.exit().remove()),Cc(Hf.data.targets).forEach(function(a){yj[a]=!0})}function mf(){lf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function nf(){return"mousemove"===Gf.event.sourceEvent.type&&oj.altDomain?(ug.domain(oj.altDomain),void oj.scale(ug).updateScaleExtent()):(Mi&&ug.orgDomain()[0]===wj[0]&&ug.domain([wj[0]-1e-10,ug.orgDomain()[1]]),lf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Gf.event.sourceEvent.type&&(Qi=!0)))}function of(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function pf(){pj.attr("width",dg).attr("height",eg),pj.select("#"+Fi).select("rect").attr("width",_f).attr("height",bg),pj.select("#"+Gi).select("rect").attr("x",C).attr("y",D).attr("width",I).attr("height",J),pj.select("#"+Hi).select("rect").attr("x",E).attr("y",F).attr("width",K).attr("height",L),pj.select("."+g.zoomRect).attr("width",_f).attr("height",bg),vj.style("max-height",eg+"px")}function qf(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,o(),S(),pf(),n(a.withTransition),lf(a)}function rf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=rj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",kd),j=i.enter().append("g").attr("class",kd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc),e=rj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",md),d=e.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",cd).style("cursor",function(a){return Wg(a)?"pointer":null}),c=rj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",ld),b=c.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",$c),b.append("g").attr("class",gd),b.append("g").attr("class",function(a){return Uc(g.selectedCircles,a.id)}),b.append("g").attr("class",ad).style("cursor",function(a){return Wg(a)?"pointer":null}),a.forEach(function(a){rj.selectAll("."+g.selectedCircles+od(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=rj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(lg(a)).attr("class",nd),f=h.enter().append("g").attr("class",nd),f.append("g").attr("class",ed),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),dh&&(n=sj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",md),m=n.enter().append("g").style("opacity",0).attr("class",md),m.append("g").attr("class",cd),l=sj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",ld),k=l.enter().append("g").style("opacity",0).attr("class",ld),k.append("g").attr("class",$c)),pj.selectAll("."+g.target).filter(function(a){return Gc(a.id)}).transition().duration(Xf).style("opacity",1)}function sf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?ce(a.id,b.types[a.id]):ce(a.id,b.type)}),Hf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=cj?j:i,l=cj?R():Q();return d&&(w=0,C=0,t=0,u=0),gh&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=cj?u:t,void(lh?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=tj.selectAll("."+g.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,cj?(f=function(a){return t*B[a]},j=function(a){return A[B[a]]+x[a]}):(f=function(a){return A[B[a]]+x[a]},j=function(a){return u*B[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=tj.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(g.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof ih?ih(a):Hf.toggle(a)}).on("mouseover",function(a){Gf.select(this).classed(g.legendItemFocused,!0),Si||Hf.focus(a),"function"==typeof jh&&jh(a)}).on("mouseout",function(a){Gf.select(this).classed(g.legendItemFocused,!1),Si||Hf.revert(),"function"==typeof kh&&kh(a)}),m.append("text").text(function(a){return d(Ig[a])?Ig[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",cj?h:-200).attr("y",cj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",cj?i:-200).attr("y",cj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",Ui).attr("x",cj?h:-200).attr("y",cj?-200:j).attr("width",10).attr("height",10),tj.selectAll("text").data(a).text(function(a){return d(Ig[a])?Ig[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),tj.selectAll("rect."+g.legendItemEvent).data(a).transition().duration(p?250:0).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}).attr("x",i).attr("y",l),tj.selectAll("rect."+g.legendItemTile).data(a).transition().duration(p?250:0).style("fill",Ui).attr("x",f).attr("y",j),tj.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=Gf.select(this);return Gc(a)?!D||b.classed(g.legendItemFocused)?vf(b):wf(b):gj}),O(t),P(u),N(C),o(),S(),pf(),n(q,c)}function Cf(a){return Ec(Hf.data.targets,a.id)}function Df(a){return"data"in a&&Ec(Hf.data.targets,a.data.id)}function Ef(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 Ff(a,b,c){var d=!ie(Hf.data.targets);Si=!1,ce(a,b),qf(c||{withTransitionForAxis:d})}var Gf=a.d3?a.d3:a.require?a.require("d3"):void 0,Hf={data:{},axis:{},legend:{}},If={},Jf=i(["bindto"],"#chart"),Kf=i(["size","width"]),Lf=i(["size","height"]),Mf=i(["padding","left"],50),Nf=i(["padding","right"],0),Of=i(["padding","top"],0),Pf=i(["padding","bottom"],0),Qf=i(["zoom","enabled"],!1),Rf=i(["zoom","extent"]),Sf=i(["zoom","privileged"],!1),Tf=i(["onenter"],function(){}),Uf=i(["onleave"],function(){}),Vf=i(["onresize"],function(){}),Wf=i(["onresized"],function(){}),Xf=i(["transition","duration"],350);h("data","data is required in config");var Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg=i(["data","x"]),Fg=i(["data","xs"],{}),Gg=i(["data","x_format"]),Hg=i(["data","id_converter"],function(a){return a}),Ig=i(["data","names"],{}),Jg=i(["data","classes"],{}),Kg=i(["data","groups"],[]),Lg=i(["data","axes"],{}),Mg=i(["data","type"]),Ng=i(["data","types"],{}),Og=i(["data","labels"],{}),Pg=i(["data","order"]),Qg=i(["data","regions"],{}),Rg=i(["data","color"]),Sg=i(["data","colors"],{}),Tg=i(["data","hide"],!1),Ug=i(["data","selection","enabled"],!1),Vg=i(["data","selection","grouped"],!1),Wg=i(["data","selection","isselectable"],function(){return!0}),Xg=i(["data","selection","multiple"],!0),Yg=i(["data","onclick"],function(){}),Zg=i(["data","onenter"],function(){}),$g=i(["data","onleave"],function(){}),_g=i(["data","onselected"],function(){}),ah=i(["data","onunselected"],function(){}),bh=i(["data","ondragstart"],function(){}),ch=i(["data","ondragend"],function(){}),dh=i(["subchart","show"],!1),eh=i(["subchart","size","height"],60),fh=i(["color","pattern"],[]),gh=i(["legend","show"],!0),hh=i(["legend","position"],"bottom"),ih=i(["legend","item","onclick"]),jh=i(["legend","item","onmouseover"]),kh=i(["legend","item","onmouseout"]),lh=i(["legend","equally"],!1),mh=i(["axis","rotated"],!1),nh=i(["axis","x","show"],!0),oh=i(["axis","x","type"],"indexed"),ph=i(["axis","x","localtime"],!0),qh=i(["axis","x","categories"],[]),rh=i(["axis","x","tick","centered"],!1),sh=i(["axis","x","tick","format"]),th=i(["axis","x","tick","culling"],{}),uh=i(["axis","x","tick","culling","max"],10),vh=i(["axis","x","tick","count"]),wh=i(["axis","x","tick","fit"],!0),xh=i(["axis","x","tick","values"],null),yh=i(["axis","x","tick","rotate"]),zh=i(["axis","x","max"],null),Ah=i(["axis","x","min"],null),Bh=i(["axis","x","padding"],{}),Ch=i(["axis","x","height"]),Dh=i(["axis","x","default"]),Eh=i(["axis","x","label"],{}),Fh=i(["axis","y","show"],!0),Gh=i(["axis","y","max"]),Hh=i(["axis","y","min"]),Ih=i(["axis","y","center"]),Jh=i(["axis","y","label"],{}),Kh=i(["axis","y","inner"],!1),Lh=i(["axis","y","tick","format"]),Mh=i(["axis","y","padding"]),Nh=i(["axis","y","ticks"],10),Oh=i(["axis","y2","show"],!1),Ph=i(["axis","y2","max"]),Qh=i(["axis","y2","min"]),Rh=i(["axis","y2","center"]),Sh=i(["axis","y2","label"],{}),Th=i(["axis","y2","inner"],!1),Uh=i(["axis","y2","tick","format"]),Vh=i(["axis","y2","padding"]),Wh=i(["axis","y2","ticks"],10),Xh=i(["grid","x","show"],!1),Yh=i(["grid","x","type"],"tick"),Zh=i(["grid","x","lines"],[]),$h=i(["grid","y","show"],!1),_h=i(["grid","y","lines"],[]),ai=i(["grid","y","ticks"],10),bi=i(["point","show"],!0),ci=i(["point","r"],2.5),di=i(["point","focus","line","enabled"],!0),ei=i(["point","focus","expand","enabled"],!0),fi=i(["point","focus","expand","r"]),gi=i(["point","focus","select","r"]),hi=i(["line","connect_null"],!1),ii=i(["bar","width"]),ji=i(["bar","width","ratio"],.6),ki=i(["pie","label","show"],!0),li=i(["pie","label","format"]),mi=i(["pie","expand"],!0),ni=i(["pie","onclick"],function(){}),oi=i(["pie","onmouseover"],function(){}),pi=i(["pie","onmouseout"],function(){}),qi=i(["donut","label","show"],!0),ri=i(["donut","label","format"]),si=i(["donut","expand"],!0),ti=i(["donut","title"],""),ui=i(["donut","onclick"],function(){}),vi=i(["donut","onmouseover"],function(){}),wi=i(["donut","onmouseout"],function(){}),xi=i(["regions"],[]),yi=i(["tooltip","show"],!0),zi=i(["tooltip","format","title"]),Ai=i(["tooltip","format","value"]),Bi=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=zi?zi:b,l=Ai?Ai:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Ci=i(["tooltip","init","show"],!1),Di=i(["tooltip","init","x"],0),Ei=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Fi=("string"==typeof Jf?Jf.replace("#",""):Jf.id)+"-clip",Gi=Fi+"-xaxis",Hi=Fi+"-yaxis",Ii=j(Fi),Ji=j(Gi),Ki=j(Hi),Li="timeseries"===oh,Mi="categorized"===oh,Ni=!Li&&(Eg||Ce(Fg)),Oi=null,Pi=!1,Qi=!1,Ri=!1,Si=!1,Ti=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ui=we(Sg,Ce(fh)?fh:Ti,Rg),Vi=ph?Gf.time.format:Gf.time.format.utc,Wi=function(){var a=[[Vi("%Y/%-m/%-d"),function(){return!0}],[Vi("%-m/%-d"),function(a){return a.getMonth()}],[Vi("%-m/%-d"),function(a){return 1!==a.getDate()}],[Vi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Vi("%I %p"),function(a){return a.getHours()}],[Vi("%I:%M"),function(a){return a.getMinutes()}],[Vi(":%S"),function(a){return a.getSeconds()}],[Vi(".%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)}}(),Xi=[],Yi=[],Zi=mh?"left":"bottom",$i=mh?Kh?"top":"bottom":Kh?"right":"left",_i=mh?Th?"bottom":"top":Th?"left":"right",aj=mh?"left":"bottom",bj={main:function(){return"translate("+Yf.left+","+Yf.top+")"},context:function(){return"translate("+Zf.left+","+Zf.top+")"},legend:function(){return"translate("+$f.left+","+$f.top+")"},x:function(){return"translate(0,"+(mh?0:bg)+")"},y:function(){return"translate(0,"+(mh?bg:0)+")"},y2:function(){return"translate("+(mh?0:_f)+","+(mh?1:0)+")"},subx:function(){return"translate(0,"+(mh?0:cg)+")"},arc:function(){return"translate("+_f/2+","+bg/2+")"}},cj="right"===hh,dj=0,ej=0,fj=0,gj=.15,hj=30,ij=mh&&!nh?0:30,jj=5;lg=Gf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var kj,lj=function(){var a=Gf.svg.line().x(mh?function(a){return W(a.id)(a.value) }:Fd).y(mh?Fd:function(a){return W(a.id)(a.value)});return hi||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=hi?Oe(b.values):b.values;return je(b)?(a.interpolate(ke(b)?"cardinal":"linear"),Qg[b.id]?bf(e,ug,W(b.id),Qg[b.id]):a(e)):(c=e[0]?ug(e[0].x):0,d=e[0]?W(b.id)(e[0].value):0,mh?"M "+d+" "+c:"M "+c+" "+d)}}(),mj=function(){var a;return a=mh?Gf.svg.area().x0(function(a){return W(a.id)(0)}).x1(function(a){return W(a.id)(a.value)}).y(Fd):Gf.svg.area().x(Fd).y0(function(a){return W(a.id)(0)}).y1(function(a){return W(a.id)(a.value)}),function(b){var c,d,e=Oe(b.values);return de([b],"area")||de([b],"area-spline")?(a.interpolate(ke(b)?"cardinal":"linear"),a(e)):(c=e[0]?ug(e[0].x):0,d=e[0]?W(b.id)(e[0].value):0,mh?"M "+d+" "+c:"M "+c+" "+d)}}(),nj=function(){var a=Gf.svg.line().x(mh?function(a){return X(a.id)(a.value)}:Id).y(mh?Id:function(a){return X(a.id)(a.value)});return function(b){var c=Oe(b.values);return je(b)?a(c):"M "+xg(c[0].x)+" "+X(b.id)(c[0].value)}}(),oj=function(){};kj=Gf.svg.brush().on("brush",mf),kj.update=function(){return sj&&sj.select("."+g.brush).call(this),this},kj.scale=function(a){return mh?this.y(a):this.x(a)},Qf&&(oj=Gf.behavior.zoom().on("zoomstart",function(){oj.altDomain=Gf.event.sourceEvent.altKey?ug.orgDomain():null}).on("zoom",Qf?nf:null),oj.scale=function(a){return mh?this.y(a):this.x(a)},oj.orgScaleExtent=function(){var a=Rf?Rf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},oj.updateScaleExtent=function(){var a=ac(ug.orgDomain())/ac(wj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var pj,qj,rj,sj,tj,uj,vj,wj,xj,yj={};if(Hf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=pj.selectAll(pd(a)),d=c.filter(Cf),e=c.filter(Df);Hf.revert(),Hf.defocus(),b(d.classed(g.focused,!0)),b(e),ie(Hf.data.targets)&&Nb(a,!0),xf(a,!0)},Hf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=pj.selectAll(pd(a)),d=c.filter(Cf),e=c.filter(Df);Hf.revert(),b(d.classed(g.focused,!1)),b(e),ie(Hf.data.targets)&&Ob(a),xf(a,!1)},Hf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=pj.selectAll(pd(a)),d=c.filter(Cf),e=c.filter(Df);b(d.classed(g.focused,!1)),b(e),ie(Hf.data.targets)&&Ob(a),yf()},Hf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),pj.selectAll(qd(a)).transition().style("opacity",1),b.withLegend&&zf(a),lf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Hf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),pj.selectAll(qd(a)).transition().style("opacity",0),b.withLegend&&Af(a),lf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Hf.toggle=function(a){Gc(a)?Hf.hide(a):Hf.show(a)},Hf.unzoom=function(){kj.clear().update(),lf({withUpdateXDomain:!0})},Hf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Jg[b]=a.classes[b]}),"categories"in a&&Mi&&(qh=a.categories,Ag.categories(qh)),"cacheIds"in a&&bc(a.cacheIds)?void sf(dc(a.cacheIds),a.done):void("unload"in a?uf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){tf(a)}):tf(a))},Hf.unload=function(a,b){uf(Dc(a),function(){lf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Hf.selected=function(a){return Gf.merge(rj.selectAll("."+g.shapes+od(a)).selectAll("."+g.shape).filter(function(){return Gf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Hf.select=function(a,b,c){Ug&&rj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Gf.select(this),i=e.data?e.data.id:e.id,j=Ne(this),k=Vg||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);k&&l?Wg(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f)})},Hf.unselect=function(a,b){Ug&&rj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Gf.select(this),f=c.data?c.data.id:c.id,h=Ne(this),i=Vg||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);i&&j&&Wg(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Hf.toLine=function(a){Ff(a,"line")},Hf.toSpline=function(a){Ff(a,"spline")},Hf.toBar=function(a){Ff(a,"bar")},Hf.toScatter=function(a){Ff(a,"scatter")},Hf.toArea=function(a){Ff(a,"area")},Hf.toAreaSpline=function(a){Ff(a,"area-spline")},Hf.toPie=function(a){Ff(a,"pie",{withTransform:!0})},Hf.toDonut=function(a){Ff(a,"donut",{withTransform:!0})},Hf.groups=function(a){return c(a)?Kg:(Kg=a,lf(),Kg)},Hf.xgrids=function(a){return a?(Zh=a,lf(),Zh):Zh},Hf.xgrids.add=function(a){return a?Hf.xgrids(Zh.concat(a)):void 0},Hf.xgrids.remove=function(a){var b=Ef(a);return Hf.xgrids(Zh.filter(b))},Hf.ygrids=function(a){return a?(_h=a,lf(),_h):_h},Hf.ygrids.add=function(a){return a?Hf.ygrids(_h.concat(a)):void 0},Hf.ygrids.remove=function(a){var b=Ef(a);return Hf.ygrids(_h.filter(b))},Hf.regions=function(a){return c(a)?xi:(xi=a,lf(),xi)},Hf.regions.add=function(a){return c(a)?xi:(xi=xi.concat(a),lf(),xi)},Hf.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;pj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),xi=xi.filter(function(b){return b.classes.indexOf(a)<0})}),xi},Hf.data.get=function(a){var b=Hf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Hf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},Hf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Ig[b]=a[b]}),lf({withLegend:!0}),Ig):Ig},Hf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Sg[b]=a[b]}),lf({withLegend:!0}),Sg):Sg},Hf.x=function(a){return arguments.length&&(qc(Hf.data.targets,a),lf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Hf.data.xs},Hf.xs=function(a){return arguments.length&&(rc(Hf.data.targets,a),lf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Hf.data.xs},Hf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){cb(b,a[b])}),Eb())},Hf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(zh=+a.x),b(a.y)&&(Gh=+a.y),b(a.y2)&&(Ph=+a.y2)):Gh=Ph=+a,lf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Hf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Ah=+a.x),b(a.y)&&(Hh=+a.y),b(a.y2)&&(Qh=+a.y2)):Hh=Qh=+a,lf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Hf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Hf.axis.max(a.max),"undefined"!=typeof a.min&&Hf.axis.min(a.min))},Hf.legend.show=function(a){zf(Dc(a)),lf({withLegend:!0})},Hf.legend.hide=function(a){Af(Dc(a)),lf({withLegend:!0})},Hf.resize=function(a){Kf=a?a.width:null,Lf=a?a.height:null,qf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Hf.destroy=function(){Hf.data.targets=void 0,Hf.data.xs={},vj.html(""),a.onresize=null},"url"in f.data)Gf.xhr(f.data.url,function(a,b){var c,d=Gf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Gf.csv.parse(b.response),cf(c)});else if("rows"in f.data)cf(tc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");cf(uc(f.data.columns))}return Hf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(window); \ No newline at end of file From f799ee7576f34562c9b815945ee9d827fa625d9e Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 7 May 2014 16:16:51 +0900 Subject: [PATCH 141/178] Fix zoom and grids on category axis --- c3.js | 26 ++++++++++++++++---------- c3.min.js | 6 +++--- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/c3.js b/c3.js index 574b94d..023d0a9 100644 --- a/c3.js +++ b/c3.js @@ -664,13 +664,17 @@ scale[key] = _scale[key]; } scale.orgDomain = function () { - return _scale.domain(); + var domain = _scale.domain(); + if (orgXDomain && orgXDomain[0] === domain[0] && orgXDomain[1] < domain[1]) { + domain[1] = orgXDomain[1]; + } + return domain; }; // define custom domain() for categorized axis if (isCategorized) { scale.domain = function (domain) { if (!arguments.length) { - domain = _scale.domain(); + domain = this.orgDomain(); return [domain[0], domain[1] + 1]; } _scale.domain(domain); @@ -1841,7 +1845,8 @@ main.select('line.' + CLASS.xgridFocus).style("visibility", "hidden"); } function generateGridData(type, scale) { - var gridData = [], xDomain, firstYear, lastYear, i; + var gridData = [], xDomain, firstYear, lastYear, i, + tickNum = main.select("." + CLASS.axisX).selectAll('.tick').size(); if (type === 'year') { xDomain = getXDomain(); firstYear = xDomain[0].getFullYear(); @@ -1852,7 +1857,7 @@ } else { gridData = scale.ticks(10); } - return gridData; + return gridData.slice(0, tickNum); } //-- Circle --// @@ -3054,11 +3059,9 @@ updateLegend(mapToIds(c3.data.targets), options, transitions); } - if (isCategorized) { - // ATTENTION: need to update domain with current domain when categoryAxis - if (targetsToShow.length === 0 || !withUpdateOrgXDomain || !withUpdateXDomain) { - x.domain([0, xaxis.selectAll('.tick').size()]); - } + // MEMO: needed for grids calculation + if (isCategorized && targetsToShow.length === 0) { + x.domain([0, xaxis.selectAll('.tick').size()]); } if (targetsToShow.length) { @@ -3428,7 +3431,7 @@ // subchart if (__subchart_show) { // reflect main chart to extent on subchart if zoomed - if (d3.event !== null && d3.event.type === 'zoom') { + if (d3.event && d3.event.type === 'zoom') { brush.extent(x.orgDomain()).update(); } // update subchart elements if needed @@ -3563,6 +3566,9 @@ }); } function redrawForZoom() { + if (filterTargetsToShow(c3.data.targets).length === 0) { + return; + } if (d3.event.sourceEvent.type === 'mousemove' && zoom.altDomain) { x.domain(zoom.altDomain); zoom.scale(x).updateScaleExtent(); diff --git a/c3.min.js b/c3.min.js index 71a6d3f..8a62a89 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.ceil(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.ceil(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&aag&&(ag=0),0>cg&&(cg=0),bg=nh?Zf.left-ij-jj:ag,dg=nh?cg:fg-$f.top-$f.bottom,0>bg&&(bg=0),0>dg&&(dg=0),r(),dj&&je(If.data.targets)&&(_f.left=ag/2+hg)}function q(){sj.select("line."+g.xgridFocus).attr("x1",nh?0:-10).attr("x2",nh?ag:-10).attr("y1",nh?-10:Zf.top).attr("y2",nh?-10:cg)}function r(){hg=cg/2,gg=.95*hg,ig=ie(If.data.targets)?.6*gg:0}function s(){var a=nh?g.axisX:g.axisY,b=sj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Hf.select(Kf).node().getBoundingClientRect(),e=c.right-d.left-v();return e>0?e:0}function t(){return Lf?Lf:z()}function u(){var a=Mf?Mf:A();return a>0?a:320}function v(){return je(If.data.targets)?0:Nf?Nf:nh?oh?x("x"):1:!Gh||Lh?1:x("y")}function w(){var a=1;return je(If.data.targets)?0:Of?Of:dj?R()+20+(Ph&&!nh?x("y2"):a):Ph?Uh||nh?a:x("y2"):a}function x(a){var b=lb(a);return b.isInner?20+Eb(a):40+Eb(a)}function y(a){return"x"!==a||oh?"x"===a&&Dh?Dh:"y"!==a||Gh?"y2"!==a||Ph?(lb(a).isInner?30:40)+("y2"===a?-10:0):kj:hh&&!dj?10:1:0}function z(){return+Hf.select(Kf).style("width").replace("px","")}function A(){return+Hf.select(Kf).style("height").replace("px","")}function B(a){return a?-5:-(Zf.left-1)}function C(a){return a?-20:-4}function D(){return B(!nh)}function E(){return C(!nh)}function F(){return B(nh)}function G(){return C(nh)}function H(a){return a?ag+2+4:Zf.left+20}function I(a){return a?(Dh?Dh:0)+80:cg+8}function J(){return H(!nh)}function K(){return I(!nh)}function L(){return H(nh)}function M(){return I(nh)}function N(){var a,b,c,d,e,f=Bc(If.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=vg(b.x)-vg(a.x),0===c?nh?cg:ag:(d=Ac(),e=fe(If.data.targets)?(d-(Ni?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function O(a){ej=a}function P(a){fj=a}function Q(a){gj=a}function R(){return hh?dj?fj*(ej+1):eg:0}function S(){return hh?dj?fg:gj*(ej+1):0}function T(){var a,b,c=!vg;ng=nh?1:0,og=nh?cg:ag,pg=nh?0:cg,qg=nh?ag:1,rg=ng,sg=og,tg=nh?0:dg,ug=nh?bg:1,vg=V(ng,og,c?void 0:vg.domain(),function(){return Bg.tickOffset()}),wg=W(pg,qg,c?void 0:wg.domain()),xg=W(pg,qg,c?void 0:xg.domain()),yg=V(ng,og,xj,function(a){return a%1?0:Eg.tickOffset()}),zg=W(tg,ug,c?void 0:zg.domain()),Ag=W(tg,ug,c?void 0:Ag.domain()),a=ab(),b=yh?yh:c?void 0:Bg.tickValues(),Bg=Z(vg,$i,a,b),Eg=Z(yg,bj,a,b),Cg=$(wg,_i,Mh,Oh),Dg=$(xg,aj,Vh,Xh),c||(lj.scale(yg),Rf&&pj.scale(vg)),U()}function U(){jg=Hb(),kg=Ib(),lg=Ib(.98)}function V(a,b,c,d){var e,f=(Mi?Hf.time.scale():Hf.scale.linear()).range([a,b]),g=c?f.domain(c):f;Ni?(d=d||function(){return 0},f=function(a){return Math.ceil(g(a)+d(a))}):f=function(a){return Math.ceil(g(a))};for(e in g)f[e]=g[e];return f.orgDomain=function(){return g.domain()},Ni&&(f.domain=function(a){return arguments.length?(g.domain(a),f):(a=g.domain(),[a[0],a[1]+1])}),f}function W(a,b,c){var d=Hf.scale.linear().range([a,b]);return c&&d.domain(c),d}function X(a){return"y2"===_(a)?xg:wg}function Y(a){return"y2"===_(a)?Ag:zg}function Z(a,b,c,d){var f=e(Hf,Ni).scale(a).orient(b);return f.tickFormat(c).tickValues(d),Ni?(f.tickCentered(sh),Ce(uh)&&(uh=!1),f.categories(rh)):f.tickOffset=function(){var a=Cc(If.data.targets),b=vg(a[1])-vg(a[0]),c=b?b:nh?cg:ag;return c/Ac()/2},f}function $(a,b,c,d){return e(Hf).scale(a).orient(b).tickFormat(c).ticks(d)}function _(a){return a in Mg?Mg[a]:"y"}function ab(){var a=Mi?Xi:Ni?Uc:function(a){return 0>a?a.toFixed(0):a};return th&&("function"==typeof th?a=th:Mi&&(a=function(a){return a?Wi(th)(a):""})),a}function bb(a){var b;return"y"===a?b=Kh:"y2"===a?b=Th:"x"===a&&(b=Fh),b}function cb(a){var b=bb(a);return"string"==typeof b?b:b?b.text:null}function db(a,b){var c=bb(a);"string"==typeof c?"y"===a?Kh=b:"y2"===a?Th=b:"x"===a&&(Fh=b):c&&(c.text=b)}function eb(a){return 10*Math.sin(Math.PI*(a/180))}function fb(a){return 11.5-2.5*(a/15)}function gb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",fb(c)).attr("x",eb(c)).attr("transform","rotate("+c+")")}function hb(a,b){var c=bb(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 ib(){return hb("x",nh?"inner-top":"inner-right")}function jb(){return hb("y",nh?"inner-right":"inner-top")}function kb(){return hb("y2",nh?"inner-right":"inner-top")}function lb(a){return"y2"===a?kb():"y"===a?jb():ib()}function mb(){return cb("x")}function nb(){return cb("y")}function ob(){return cb("y2")}function pb(a,b){return a?b.isLeft?0:b.isCenter?ag/2:ag:b.isBottom?-cg:b.isMiddle?-cg/2:0}function qb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function rb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function sb(){return pb(!nh,ib())}function tb(){return pb(nh,jb())}function ub(){return pb(nh,kb())}function vb(){return qb(!nh,ib())}function wb(){return qb(nh,jb())}function xb(){return qb(nh,kb())}function yb(){var a=ib();return nh?a.isInner?"1.2em":-25-Eb("x"):a.isInner?"-0.5em":Dh?Dh-10:"3em"}function zb(){var a=jb();return nh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Eb("y")}function Ab(){var a=kb();return nh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Eb("y2")}function Bb(){return rb(!nh,ib())}function Cb(){return rb(nh,jb())}function Db(){return rb(nh,kb())}function Eb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Hf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Fb(a){var b=sj.select("."+g.axisX+" ."+g.axisXLabel),c=sj.select("."+g.axisY+" ."+g.axisYLabel),d=sj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb),(a?c.transition():c).attr("x",tb).attr("dx",wb).attr("dy",zb).attr("dy",zb).text(nb),(a?d.transition():d).attr("x",ub).attr("dx",xb).attr("dy",Ab).text(ob)}function Gb(a){var b=!1;return mg(Jc(If.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Hb(){var a=Hf.svg.arc().outerRadius(gg).innerRadius(ig),b=function(b,c){var d;return c?a(b):(d=Gb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Ib(a){var b=Hf.svg.arc().outerRadius(hg*(a?a:1)).innerRadius(ig);return function(a){var c=Gb(a);return c?b(c):"M 0 0"}}function Jb(a,b){return qe(a.data)?jg(a,b):"M 0 0"}function Kb(a){var b,c,d,e,f=Gb(a),g="";return f&&(b=jg.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*gg*.8+","+d/e*gg*.8+")"),g}function Lb(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Mb(a){return qc({id:a.data.id,value:a.value,ratio:Lb(a)})}function Nb(a){var b,c,d,e;return Qb()?(b=Gb(a),c=b?b.value:null,d=Lb(b),e=Rb(),e?e(c,d):Ed(c,d)):""}function Ob(a,b){var c=qj.selectAll("."+g.chartArc+qd(a)),d=qj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});we(a)&&c.selectAll("path").transition().duration(50).attr("d",kg).transition().duration(100).attr("d",lg).each(function(a){pe(a.data)}),b||d.style("opacity",.3)}function Pb(a){var b=qj.selectAll("."+g.chartArc+qd(a));b.selectAll("path").transition().duration(50).attr("d",jg),qj.selectAll("."+g.arc).style("opacity",1)}function Qb(){return ie(If.data.targets)?ri:li}function Rb(){return ie(If.data.targets)?si:mi}function Sb(){return ie(If.data.targets)?ui:""}function Tb(){var a=ie(If.data.targets)?vi:oi;return"function"==typeof a?a:function(){}}function Ub(){var a=ie(If.data.targets)?wi:pi;return"function"==typeof a?a:function(){}}function Vb(){var a=ie(If.data.targets)?xi:qi;return"function"==typeof a?a:function(){}}function Wb(a){var b,c,d,e,f,g,h=Dc(a),i=Qc(a);if(Lg.length>0)for(g=Sc(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 Hf.min(Object.keys(i).map(function(a){return Hf.min(i[a])}))}function Xb(a){var b,c,d,e,f,g,h=Dc(a),i=Qc(a);if(Lg.length>0)for(g=Tc(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 Hf.max(Object.keys(i).map(function(a){return Hf.max(i[a])}))}function Yb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return _(a.id)===c}),m="y2"===c?Rh:Ih,n="y2"===c?Qh:Hh,o=b(m)?m:Wb(l),p=b(n)?n:Xb(l),q="y2"===c?Sh:Jh,r=yd()&&nh;return 0===l.length?"y2"===c?xg.domain():wg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=zd(o,p),j=bc(wg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Nh&&(f=b(Nh.top)?Nh.top:e,g=b(Nh.bottom)?Nh.bottom:e),"y2"===c&&Wh&&(f=b(Wh.top)?Wh.top:e,g=b(Wh.bottom)?Wh.bottom:e),fe(l)&&!Sc(l)&&(g=o),[o-g,p+f])}function Zb(a){return Bh?Mi?ye(Bh):Bh:Hf.min(a,function(a){return Hf.min(a.values,function(a){return a.x})})}function $b(a){return Ah?Mi?ye(Ah):Ah:Hf.max(a,function(a){return Hf.max(a.values,function(a){return a.x})})}function _b(a){var c,d,e,f,g=Cc(a),h=g[1]-g[0];return Ni?d=0:fe(a)?(c=Ac(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Ch&&De(Ch)?(e=b(Ch.left)?Ch.left:d,f=b(Ch.right)?Ch.right:d):e=f="number"==typeof Ch?Ch:d,{left:e,right:f}}function ac(a){var b=[Zb(a),$b(a)],c=b[0],d=b[1],e=_b(a),f=0,g=0;return c-d!==0||Ni||(c=Mi?new Date(.5*c.getTime()):-.5,d=Mi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Mi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Mi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function bc(a){return a[1]-a[0]}function cc(a){for(var b=0;bb?0:b-c}function ic(a){var b,c=gc(a),d="y"===a.axis?wg:xg;return b="y"===a.axis||"y2"===a.axis?nh?cg:"start"in a?d(a.start):cg:nh?"end"in a?vg(Mi?ye(a.end):a.end):cg:cg,c>b?0:b-c}function jc(a){return Fg&&a===Fg||De(Gg)&&Ee(Gg,a)}function kc(a){return!jc(a)}function lc(a){return Fg?Fg:De(Gg)?Gg[a]:null}function mc(a,b){var c,d=b&&De(b)?Dc(b):[];return d.forEach(function(b){lc(b)===a&&(c=If.data.xs[b])}),c}function nc(a,b){return a in If.data.xs&&If.data.xs[a]&&If.data.xs[a][b]?If.data.xs[a][b]:b}function oc(a){Object.keys(a).forEach(function(b){Gg[b]=a[b]})}function pc(a){return 1===Hf.set(Object.keys(a).map(function(b){return a[b]})).size()}function qc(a){var b;return a&&(b=Jg[a.id],a.name=b?b:a.id),a}function rc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=tc(b[d],a.id,d)}),If.data.xs[a.id]=b})}function sc(a,b){a.forEach(function(a){b[a.id]&&rc([a],b[a.id])})}function tc(a,c,d){var e;return e=Mi?a?a instanceof Date?a:ye(a):ye(nc(c,d)):Oi&&!Ni?b(a)?+a:nc(c,d):d}function uc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?If.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Fg?(d=Object.keys(If.data.xs),If.data.xs[c]=d.length>0?If.data.xs[d[0]]:void 0):De(Gg)&&(If.data.xs[c]=mc(f,If.data.targets)):If.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!If.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Ig(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=lc(b),g=a[f],h=tc(g,b,e);return Oi&&Ni&&0===c&&g&&(0===e&&(rh=[]),rh.push(g)),("undefined"==typeof a[b]||If.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ng&&de(Dc(c).filter(function(a){return!(a in Og)}),Ng),c.forEach(function(a){dc(a.id_org,a)}),c}function xc(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 yc(a){return a>0&&If.data.targets[0].values[a-1]?If.data.targets[0].values[a-1].x:void 0}function zc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Cc(a){var b,c,d=Bc(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Dc(a){return a.map(function(a){return a.id})}function Ec(a){return a?"string"==typeof a?[a]:a:Dc(If.data.targets)}function Fc(a,b){var c,d=Dc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Mi?new Date(i):i);j.push(e)}return Mi||(j=j.sort(function(a,b){return a-b})),j}function Mc(a){Yi=Yi.concat(a)}function Nc(a){Yi=Yi.filter(function(b){return a.indexOf(b)<0})}function Oc(a){Zi=Zi.concat(a)}function Pc(a){Zi=Zi.filter(function(b){return a.indexOf(b)<0})}function Qc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Rc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Tc(a){return Rc(a,function(a){return a>0})}function Uc(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||0===a[f].x)&&(e=e.concat(Kd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Kd(a,g))),Nd(e,b)):Ld(a,b,f,g)}function Md(a,b){var c;return c=a.map(function(a){return Ld(a.values,b)}),Nd(c,b)}function Nd(a,b){var c,d;return a.forEach(function(a){var e=Fe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Od(a,b){return Hf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Pd(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 Qd(){return Qg&&"desc"===Qg.toLowerCase()}function Rd(){return Qg&&"asc"===Qg.toLowerCase()}function Sd(a){var b=Rd(),c=Qd();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 Qg&&a.sort(Qg),a}function Td(a,c){var d,e,f,g,h,i,j,k=je(If.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&zi&&(vj.html(Ci(a,ab(),Ad(k),Vi)).style("display","block"),d=vj.property("offsetWidth"),e=vj.property("offsetHeight"),k?(g=ag/2+c[0],i=cg/2+c[1]+20):(nh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-w(),i=vg(l[0].x)+20):(f=s(),g=f+v()+vg(l[0].x)+20,h=g+d,j=f+t()-w(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),vj.style("top",i+"px").style("left",g+"px"))}function Ud(){vj.style("display","none")}function Vd(a){var c=a.filter(function(a){return a&&b(a.value)});if(zi&&!ge(If.data.targets)&&!je(If.data.targets)){var d=sj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(nh?"y1":"x1",Gd).attr(nh?"y2":"x2",Gd),lf(d,"grid")}}function Wd(){sj.select("line."+g.xgridFocus).style("visibility","hidden")}function Xd(a,b){var c,d,e,f,g=[];if("year"===a)for(c=ac(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)g.push(new Date(f+"-01-01 00:00:00"));else g=b.ticks(10);return g}function Yd(a){return a.x||0===a.x?vg(a.x):null}function Zd(a){return X(a.id)(a.value)}function $d(){var a,b,d={},e=0;return Jc(Gc(me)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ce(a,b){return"number"==typeof ji?ji:b?2*a.tickOffset()*ki/b:0}function de(a,b){Ec(a).forEach(function(a){zj[a]=b===Og[a],Og[a]=b})}function ee(a,b){var c=!1;return a.forEach(function(a){Og[a.id]===b&&(c=!0),a.id in Og||"line"!==b||(c=!0)}),c}function fe(a){return ee(a,"bar")}function ge(a){return ee(a,"scatter")}function he(a){return ee(a,"pie")}function ie(a){return ee(a,"donut")}function je(a){return he(a)||ie(a)}function ke(a){var b="string"==typeof a?a:a.id;return!(b in Og)||"line"===Og[b]||"spline"===Og[b]||"area"===Og[b]||"area-spline"===Og[b]}function le(a){var b="string"==typeof a?a:a.id;return"spline"===Og[b]||"area-spline"===Og[b]}function me(a){var b="string"==typeof a?a:a.id;return"bar"===Og[b]}function ne(a){var b="string"==typeof a?a:a.id;return"scatter"===Og[b]}function oe(a){var b="string"==typeof a?a:a.id;return"pie"===Og[b]}function pe(a){var b="string"==typeof a?a:a.id;return"donut"===Og[b]}function qe(a){return oe(a)||pe(a)}function re(a){return ke(a)?[a]:[]}function se(a){return qe(a.data)?[a]:[]}function te(a){return me(a)?a.values:[]}function ue(a){return ke(a)||ne(a)?a.values:[]}function ve(a){return me(a)||ke(a)?a.values:[]}function we(a){return pe(a)&&ti||oe(a)&&ni}function xe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ye(b){var c;try{c=Hg?Hf.time.format(Hg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Hg)}return c}function ze(a,b){var c=Hf.mouse(a),d=Hf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ee(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Fe(a,b){var c="y"===_(a.id)?wg:xg,d=nh?1:0,e=nh?0:1;return Math.pow(vg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ge(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function He(a,b,c){ah(b,a.node()),sj.select("."+g.selectedCircles+pd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Vc(g.selectedCircle,c)}).attr("cx",nh?Zd:Yd).attr("cy",nh?Yd:Zd).attr("stroke",function(){return Vi(b)}).attr("r",1.4*Se(b)).transition().duration(100).attr("r",Se)}function Ie(a,b,c){bh(b,a.node()),sj.select("."+g.selectedCircles+pd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Je(a,b,c,d){a?He(b,c,d):Ie(b,c,d)}function Ke(a,b){ah(b,a.node()),a.transition().duration(100).style("fill",function(){return Hf.rgb(Vi(b)).brighter(.75)})}function Le(a,b){bh(b,a.node()),a.transition().duration(100).style("fill",function(){return Vi(b)})}function Me(a,b,c,d){a?Ke(b,c,d):Le(b,c,d)}function Ne(a,b,c,d){Me(a,b,c.data,d)}function Oe(a){return"circle"===a.nodeName?Je:Hf.select(a).classed(g.bar)?Me:Ne}function Pe(a){return a.filter(function(a){return b(a.value)})}function Qe(a){return ci?"function"==typeof di?di(a):di:0}function Re(a){return fi?gi?gi:1.75*Qe(a):Qe(a)}function Se(a){return hi?hi:4*Qe(a)}function Te(a,c){return(c?sj.selectAll("."+g.circles+pd(c)):sj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ue(a,b){Te(a,b).classed(g.EXPANDED,!0).attr("r",Re)}function Ve(a){Te(a).filter(function(){return Hf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Qe)}function We(a){return sj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function Xe(a){We(a).classed(g.EXPANDED,!0)}function Ye(a){We(a).classed(g.EXPANDED,!1)}function Ze(a,b){var c=bf(a,b);return function(a,b){var d=c(a,b),e=nh?1:0,f=nh?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 $e(a,b){var c=bf(a,!1),d=b?_e:af;return function(a,b){return d(c(a,b),a,this)}}function _e(a,b){var c;return nh?(c=me(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function af(a,b,c){var d=c.getBoundingClientRect();return nh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:me(b)?-3:-6)}function bf(a,b){var c=a.__max__+1,d=ce(Bg,c),e=_d(d,c,a,!!b),f=ae(!!b),g=be(a,!!b),h=b?Y:X;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return nh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function cf(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 df(b){var c,d,e;if(wj=Hf.select(Kf),wj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(wj.html("").classed("c3",!0),If.data.xs={},If.data.targets=wc(b),Ug&&Mc(Ug===!0?Dc(If.data.targets):Ug),p(),T(),vg.domain(Hf.extent(ac(If.data.targets))),wg.domain(Yb(If.data.targets,"y")),xg.domain(Yb(If.data.targets,"y2")),yg.domain(vg.domain()),zg.domain(wg.domain()),Ag.domain(xg.domain()),xj=vg.domain(),lj.scale(yg),Rf&&pj.scale(vg),qj=wj.append("svg").on("mouseenter",Uf).on("mouseleave",Vf),rj=qj.append("defs"),rj.append("clipPath").attr("id",Gi).append("rect"),rj.append("clipPath").attr("id",Hi).append("rect"),rj.append("clipPath").attr("id",Ii).append("rect"),qf(),sj=qj.append("g").attr("transform",cj.main),tj=qj.append("g").attr("transform",cj.context),uj=qj.append("g").attr("transform",cj.legend),eh||tj.style("visibility","hidden"),hh||(uj.style("visibility","hidden"),Zi=Dc(If.data.targets)),vj=Hf.select(Kf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Cf(Dc(If.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=sj.append("g").attr("clip-path",Ji).attr("class",g.grid),Yh&&d.append("g").attr("class",g.xgrids),De($h)&&d.append("g").attr("class",g.xgridLines),ei&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),_h&&d.append("g").attr("class",g.ygrids),De(ai)&&d.append("g").attr("class",g.ygridLines),sj.append("g").attr("clip-path",Ji).attr("class",g.regions),sj.append("g").attr("clip-path",Ji).attr("class",g.chart),c=sj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Rf?nh?"ns-resize":"ew-resize":null),sj.select("."+g.chart).append("g").attr("class",g.chartBars),sj.select("."+g.chart).append("g").attr("class",g.chartLines),sj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",cj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Sb()),sj.select("."+g.chart).append("g").attr("class",g.chartTexts),Rf&&sj.insert("rect",Tf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",ag).attr("height",cg).style("opacity",0).style("cursor",nh?"ns-resize":"ew-resize").call(pj).on("dblclick.zoom",null),Eh&&lj.extent("function"!=typeof Eh?Eh:Eh(ac())),oh&&sj.append("g").attr("class",g.axisX).attr("clip-path",Ki).attr("transform",cj.x).append("text").attr("class",g.axisXLabel).attr("transform",nh?"rotate(-90)":"").style("text-anchor",Bb),Gh&&sj.append("g").attr("class",g.axisY).attr("clip-path",Li).attr("transform",cj.y).append("text").attr("class",g.axisYLabel).attr("transform",nh?"":"rotate(-90)").style("text-anchor",Cb),Ph&&sj.append("g").attr("class",g.axisY2).attr("transform",cj.y2).append("text").attr("class",g.axisY2Label).attr("transform",nh?"":"rotate(-90)").style("text-anchor",Db),tj.append("g").attr("clip-path",Ji).attr("class",g.chart),tj.select("."+g.chart).append("g").attr("class",g.chartBars),tj.select("."+g.chart).append("g").attr("class",g.chartLines),tj.append("g").attr("clip-path",Ji).attr("class",g.brush).call(lj).selectAll("rect").attr(nh?"width":"height",nh?bg:dg),tj.append("g").attr("class",g.axisX).attr("transform",cj.subx).attr("clip-path",nh?"":Ki),sf(If.data.targets),nh?sj.select("."+g.axisX).style("opacity",0).call(Bg):(sj.select("."+g.axisY).style("opacity",0).call(Cg),sj.select("."+g.axisY2).style("opacity",0).call(Dg)),p(),T(),qf(),o(!1),mf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Di){if(Mi&&"string"==typeof Ei){for(Ei=ye(Ei),e=0;e0){d=[];for(var f in Jg)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Pd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Me,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function jf(a){je(If.data.targets)||Vg&&(Pi=a,sj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Qi=!0,ch())}function kf(){je(If.data.targets)||Vg&&(sj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),sj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Qi=!1,dh())}function lf(a,b){"grid"===b&&a.each(function(){var a=Hf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function mf(a){var c,e,f,h,i,j,k,l,m,n,o,p,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,O,P,Q,R,S,T,U,V,W,X,Y,Z,$,_=$d(),ab=je(If.data.targets),bb=Jc(If.data.targets);if(a=d(a)?a:{},G=d(a.withY)?a.withY:!0,H=d(a.withSubchart)?a.withSubchart:!0,I=d(a.withTransition)?a.withTransition:!0,L=d(a.withTransform)?a.withTransform:!1,M=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,O=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,P=d(a.withLegend)?a.withLegend:!1,J=d(a.withTransitionForExit)?a.withTransitionForExit:I,K=d(a.withTransitionForAxis)?a.withTransitionForAxis:I,V=I?Yf:0,W=J?V:0,X=K?V:0,c=sj.select("."+g.axisX).style("opacity",ab?0:1),f=sj.select("."+g.axisY).style("opacity",ab?0:1),h=sj.select("."+g.axisY2).style("opacity",ab?0:1),e=tj.select("."+g.axisX).style("opacity",ab?0:1),U={axisX:c.transition().duration(X),axisY:f.transition().duration(X),axisY2:h.transition().duration(X),axisSubX:e.transition().duration(X)},P&&hh&&Cf(Dc(If.data.targets),a,U),Ni&&(0!==bb.length&&O&&M||vg.domain([0,c.selectAll(".tick").size()])),bb.length&&(O&&(vg.domain(Hf.extent(ac(bb))),xj=vg.domain(),Rf&&pj.scale(vg).updateScaleExtent(),yg.domain(vg.domain()),lj.scale(yg)),M&&(vg.domain(lj.empty()?xj:lj.extent()),Rf&&pj.scale(vg).updateScaleExtent()),yh||!xh&&!wh||(Y=Lc(Kc(bb),wh),Bg.tickValues(Y),Eg.tickValues(Y))),wg.domain(Yb(bb,"y")),xg.domain(Yb(bb,"y2")),U.axisX.call(Bg),U.axisY.call(Cg),U.axisY2.call(Dg),U.axisSubX.call(Eg),Fb(I),M&&bb.length)if(uh&&Y){for(Z=1;Z=0&&Hf.select(this).style("display",b%$?"none":"block")})}else qj.selectAll("."+g.axisX+" .tick text").style("display","block");!nh&&zh&&gb(c,U.axisX,zh),Q=Ze(_),S=$e(_,!0),T=$e(_,!1),zg.domain(wg.domain()),Ag.domain(xg.domain()),vj.style("display","none"),q(),sj.select("line."+g.xgridFocus).style("visibility","hidden"),Yh&&(k=Xd(Zh,vg),D=Ni?Bg.tickOffset():0,j=nh?{x1:0,x2:ag,y1:function(a){return vg(a)-D},y2:function(a){return vg(a)-D}}:{x1:function(a){return vg(a)+D},x2:function(a){return vg(a)+D},y1:Zf.top,y2:cg},i=sj.select("."+g.xgrids).selectAll("."+g.xgrid).data(k),i.enter().append("line").attr("class",g.xgrid),i.attr(j).style("opacity",function(){return+Hf.select(this).attr(nh?"y1":"x1")===(nh?cg:0)?0:1}),i.exit().remove()),De($h)&&(l=sj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data($h),m=l.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",nh?"":"rotate(-90)").attr("dx",nh?0:-Zf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(V).attr("x1",nh?0:Hd).attr("x2",nh?ag:Hd).attr("y1",nh?Hd:Zf.top).attr("y2",nh?Hd:cg).style("opacity",1),l.select("text").transition().duration(V).attr("x",nh?ag:0).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(V).style("opacity",0).remove()),G&&_h&&(n=sj.select("."+g.ygrids).selectAll("."+g.ygrid).data(wg.ticks(bi)),n.enter().append("line").attr("class",g.ygrid),n.attr("x1",nh?wg:0).attr("x2",nh?wg:ag).attr("y1",nh?0:wg).attr("y2",nh?cg:wg),n.exit().remove(),lf(n,"grid")),G&&De(ai)&&(o=sj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(ai),p=o.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",nh?"rotate(-90)":"").attr("dx",nh?0:-Zf.top).attr("dy",-5).style("opacity",0),o.select("line").transition().duration(V).attr("x1",nh?Id:0).attr("x2",nh?Id:ag).attr("y1",nh?0:Id).attr("y2",nh?cg:Id).style("opacity",1),o.select("text").transition().duration(V).attr("x",nh?0:ag).attr("y",Id).text(function(a){return a.text}).style("opacity",1),o.exit().transition().duration(V).style("opacity",0).remove()),w=sj.select("."+g.regions).selectAll("."+g.region).data(yi),w.enter().append("g").attr("class",id).append("rect").style("fill-opacity",0),w.selectAll("rect").transition().duration(V).attr("x",fc).attr("y",gc).attr("width",hc).attr("height",ic).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),w.exit().transition().duration(V).style("fill-opacity",0).remove(),u=sj.selectAll("."+g.bars).selectAll("."+g.bar).data(te),u.enter().append("path").attr("class",cd).style("stroke","none").style("fill",Vi),u.style("opacity",ud).transition().duration(V).attr("d",Q).style("fill",Vi).style("opacity",1),u.exit().transition().duration(W).style("opacity",0).remove(),r=sj.selectAll("."+g.lines).selectAll("."+g.line).data(re),r.enter().append("path").attr("class",$c).style("stroke",Vi),r.style("opacity",ud).transition().duration(V).attr("d",mj).style("stroke",Vi).style("opacity",1),r.exit().transition().duration(W).style("opacity",0).remove(),s=sj.selectAll("."+g.areas).selectAll("."+g.area).data(re),s.enter().append("path").attr("class",gd).style("fill",Vi).style("opacity",function(){return yj=+Hf.select(this).style("opacity"),0}),s.style("opacity",0).transition().duration(V).attr("d",nj).style("fill",Vi).style("opacity",yj),s.exit().transition().duration(W).style("opacity",0).remove(),t=sj.selectAll("."+g.circles).selectAll("."+g.circle).data(ue),t.enter().append("circle").attr("class",ad).attr("r",Qe).style("fill",Vi),t.style("opacity",ud).transition().duration(V).style("opacity",wd).style("fill",Vi).attr("cx",nh?Zd:Yd).attr("cy",nh?Yd:Zd),t.exit().remove(),x=sj.selectAll("."+g.texts).selectAll("."+g.text).data(ve),x.enter().append("text").attr("class",Wc).attr("text-anchor",function(a){return nh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",Vi).style("fill-opacity",0),x.text(function(a){return Fd(a.id)(a.value,a.id)}).style("fill-opacity",vd).transition().duration(V).attr("x",S).attr("y",T).style("fill",Vi).style("fill-opacity",xd),x.exit().transition().duration(W).style("fill-opacity",0).remove(),v=sj.selectAll("."+g.arcs).selectAll("."+g.arc).data(se),v.enter().append("path").attr("class",ed).style("fill",function(a){return Vi(a.data)}).style("cursor",function(a){return Xg(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Ti||(c=Gb(a),d=Mb(c),e=Ub(),Ob(c.data.id),yf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Gb(a),c=Mb(b),d=[c];Td(d,Hf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Ti||(c=Gb(a),d=Mb(c),e=Vb(),Pb(c.data.id),zf(),Ud(),e(d,b))}).on("click",function(a,b){var c=Gb(a),d=Mb(c),e=Tb();gf(this,a,b),e(d,b)}),v.attr("transform",L?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Ti=!0}).transition().duration(V).attrTween("d",function(a){var b,c=Gb(a);return c?(b=Hf.interpolate(this._current,c),this._current=b(0),function(a){return Jb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",L?"scale(1)":"").style("fill",function(a){return Vi(a.data)}).style("opacity",1).call(Ge,function(){Ti=!1}),v.exit().transition().duration(W).style("opacity",0).remove(),sj.selectAll("."+g.chartArc).select("text").attr("transform",Kb).style("opacity",0).transition().duration(V).text(Nb).style("opacity",function(a){return Hc(a.data.id)&&qe(a.data)?1:0}),sj.select("."+g.chartArcsTitle).style("opacity",ie(If.data.targets)?1:0),eh&&(null!==Hf.event&&"zoom"===Hf.event.type&&lj.extent(vg.orgDomain()).update(),H&&(!nh&&zh&&gb(e,U.axisSubX,zh),lj.empty()||lj.extent(vg.orgDomain()).update(),R=Ze(_,!0),z=tj.selectAll("."+g.bars).selectAll("."+g.bar).data(te),z.enter().append("path").attr("class",cd).style("stroke","none").style("fill",Vi),z.style("opacity",ud).transition().duration(V).attr("d",R).style("opacity",1),z.exit().transition().duration(V).style("opacity",0).remove(),y=tj.selectAll("."+g.lines).selectAll("."+g.line).data(re),y.enter().append("path").attr("class",$c).style("stroke",Vi),y.style("opacity",ud).transition().duration(V).attr("d",oj).style("opacity",1),y.exit().transition().duration(V).style("opacity",0).remove())),sj.selectAll("."+g.selectedCircles).filter(function(a){return me(a)}).selectAll("circle").remove(),sj.selectAll("."+g.selectedCircle).transition().duration(V).attr("cx",nh?Zd:Yd).attr("cy",nh?Yd:Zd),A=sj.select("."+g.eventRects),De(Gg)&&!pc(Gg)?(A.classed(g.eventRectsMultiple)||A.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),B=sj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),ff(B.enter()),B.attr("x",0).attr("y",0).attr("width",ag).attr("height",cg)):(A.classed(g.eventRectsSingle)||A.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Oi&&!Ni?(F=function(a,b){var c=yc(b),d=zc(b),e=If.data.xs[a.id][b];return(vg(d?d:e+50)-vg(c?c:e-50))/2},E=function(a,b){var c=yc(b),d=If.data.xs[a.id][b];return(vg(d)+vg(c?c:d-50))/2}):(F=N(),E=function(a){return vg(a.x)-F/2}),C=Bc(If.data.targets),sj.select("."+g.eventRects).datum(C?C.values:[]),B=sj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),ef(B.enter()),B.attr("class",jd).attr("x",nh?0:E).attr("y",nh?E:0).attr("width",nh?ag:F).attr("height",nh?F:cg),B.exit().remove()),Dc(If.data.targets).forEach(function(a){zj[a]=!0})}function nf(){mf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function of(){return"mousemove"===Hf.event.sourceEvent.type&&pj.altDomain?(vg.domain(pj.altDomain),void pj.scale(vg).updateScaleExtent()):(Ni&&vg.orgDomain()[0]===xj[0]&&vg.domain([xj[0]-1e-10,vg.orgDomain()[1]]),mf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Hf.event.sourceEvent.type&&(Ri=!0)))}function pf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function qf(){qj.attr("width",eg).attr("height",fg),qj.select("#"+Gi).select("rect").attr("width",ag).attr("height",cg),qj.select("#"+Hi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),qj.select("#"+Ii).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),qj.select("."+g.zoomRect).attr("width",ag).attr("height",cg),wj.style("max-height",fg+"px")}function rf(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,p(),T(),qf(),o(a.withTransition),mf(a)}function sf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=sj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",ld),j=i.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Xc),e=sj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",nd),d=e.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",dd).style("cursor",function(a){return Xg(a)?"pointer":null}),c=sj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",md),b=c.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",_c),b.append("g").attr("class",hd),b.append("g").attr("class",function(a){return Vc(g.selectedCircles,a.id)}),b.append("g").attr("class",bd).style("cursor",function(a){return Xg(a)?"pointer":null}),a.forEach(function(a){sj.selectAll("."+g.selectedCircles+pd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=sj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(mg(a)).attr("class",od),f=h.enter().append("g").attr("class",od),f.append("g").attr("class",fd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),eh&&(n=tj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",nd),m=n.enter().append("g").style("opacity",0).attr("class",nd),m.append("g").attr("class",dd),l=tj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",md),k=l.enter().append("g").style("opacity",0).attr("class",md),k.append("g").attr("class",_c)),qj.selectAll("."+g.target).filter(function(a){return Hc(a.id)}).transition().duration(Yf).style("opacity",1)}function tf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?de(a.id,b.types[a.id]):de(a.id,b.type)}),If.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=dj?j:i,l=dj?S():R();return d&&(w=0,C=0,t=0,u=0),hh&&!Ic(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=dj?u:t,void(mh?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=uj.selectAll("."+g.legendItemFocused).size();b=b||{},n=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,dj?(f=function(a){return t*B[a]},j=function(a){return A[B[a]]+x[a]}):(f=function(a){return A[B[a]]+x[a]},j=function(a){return u*B[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=uj.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Vc(g.legendItem,a)}).style("visibility",function(a){return Ic(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof jh?jh(a):If.toggle(a)}).on("mouseover",function(a){Hf.select(this).classed(g.legendItemFocused,!0),Ti||If.focus(a),"function"==typeof kh&&kh(a)}).on("mouseout",function(a){Hf.select(this).classed(g.legendItemFocused,!1),Ti||If.revert(),"function"==typeof lh&&lh(a)}),m.append("text").text(function(a){return d(Jg[a])?Jg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",dj?h:-200).attr("y",dj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",dj?i:-200).attr("y",dj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",Vi).attr("x",dj?h:-200).attr("y",dj?-200:j).attr("width",10).attr("height",10),uj.selectAll("text").data(a).text(function(a){return d(Jg[a])?Jg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(n?250:0).attr("x",h).attr("y",k),uj.selectAll("rect."+g.legendItemEvent).data(a).transition().duration(n?250:0).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}).attr("x",i).attr("y",l),uj.selectAll("rect."+g.legendItemTile).data(a).transition().duration(n?250:0).style("fill",Vi).attr("x",f).attr("y",j),uj.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Hc(a)}).transition().style("opacity",function(a){var b=Hf.select(this);return Hc(a)?!D||b.classed(g.legendItemFocused)?wf(b):xf(b):hj}),P(t),Q(u),O(C),p(),T(),qf(),o(q,c)}function Df(a){return Fc(If.data.targets,a.id)}function Ef(a){return"data"in a&&Fc(If.data.targets,a.data.id)}function Ff(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 Gf(a,b,c){var d=!je(If.data.targets);Ti=!1,de(a,b),rf(c||{withTransitionForAxis:d})}var Hf=a.d3?a.d3:a.require?a.require("d3"):void 0,If={data:{},axis:{},legend:{}},Jf={},Kf=i(["bindto"],"#chart"),Lf=i(["size","width"]),Mf=i(["size","height"]),Nf=i(["padding","left"],50),Of=i(["padding","right"],0),Pf=i(["padding","top"],0),Qf=i(["padding","bottom"],0),Rf=i(["zoom","enabled"],!1),Sf=i(["zoom","extent"]),Tf=i(["zoom","privileged"],!1),Uf=i(["onenter"],function(){}),Vf=i(["onleave"],function(){}),Wf=i(["onresize"],function(){}),Xf=i(["onresized"],function(){}),Yf=i(["transition","duration"],350);h("data","data is required in config");var Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg=i(["data","x"]),Gg=i(["data","xs"],{}),Hg=i(["data","x_format"]),Ig=i(["data","id_converter"],function(a){return a}),Jg=i(["data","names"],{}),Kg=i(["data","classes"],{}),Lg=i(["data","groups"],[]),Mg=i(["data","axes"],{}),Ng=i(["data","type"]),Og=i(["data","types"],{}),Pg=i(["data","labels"],{}),Qg=i(["data","order"]),Rg=i(["data","regions"],{}),Sg=i(["data","color"]),Tg=i(["data","colors"],{}),Ug=i(["data","hide"],!1),Vg=i(["data","selection","enabled"],!1),Wg=i(["data","selection","grouped"],!1),Xg=i(["data","selection","isselectable"],function(){return!0}),Yg=i(["data","selection","multiple"],!0),Zg=i(["data","onclick"],function(){}),$g=i(["data","onenter"],function(){}),_g=i(["data","onleave"],function(){}),ah=i(["data","onselected"],function(){}),bh=i(["data","onunselected"],function(){}),ch=i(["data","ondragstart"],function(){}),dh=i(["data","ondragend"],function(){}),eh=i(["subchart","show"],!1),fh=i(["subchart","size","height"],60),gh=i(["color","pattern"],[]),hh=i(["legend","show"],!0),ih=i(["legend","position"],"bottom"),jh=i(["legend","item","onclick"]),kh=i(["legend","item","onmouseover"]),lh=i(["legend","item","onmouseout"]),mh=i(["legend","equally"],!1),nh=i(["axis","rotated"],!1),oh=i(["axis","x","show"],!0),ph=i(["axis","x","type"],"indexed"),qh=i(["axis","x","localtime"],!0),rh=i(["axis","x","categories"],[]),sh=i(["axis","x","tick","centered"],!1),th=i(["axis","x","tick","format"]),uh=i(["axis","x","tick","culling"],{}),vh=i(["axis","x","tick","culling","max"],10),wh=i(["axis","x","tick","count"]),xh=i(["axis","x","tick","fit"],!0),yh=i(["axis","x","tick","values"],null),zh=i(["axis","x","tick","rotate"]),Ah=i(["axis","x","max"],null),Bh=i(["axis","x","min"],null),Ch=i(["axis","x","padding"],{}),Dh=i(["axis","x","height"]),Eh=i(["axis","x","default"]),Fh=i(["axis","x","label"],{}),Gh=i(["axis","y","show"],!0),Hh=i(["axis","y","max"]),Ih=i(["axis","y","min"]),Jh=i(["axis","y","center"]),Kh=i(["axis","y","label"],{}),Lh=i(["axis","y","inner"],!1),Mh=i(["axis","y","tick","format"]),Nh=i(["axis","y","padding"]),Oh=i(["axis","y","ticks"],10),Ph=i(["axis","y2","show"],!1),Qh=i(["axis","y2","max"]),Rh=i(["axis","y2","min"]),Sh=i(["axis","y2","center"]),Th=i(["axis","y2","label"],{}),Uh=i(["axis","y2","inner"],!1),Vh=i(["axis","y2","tick","format"]),Wh=i(["axis","y2","padding"]),Xh=i(["axis","y2","ticks"],10),Yh=i(["grid","x","show"],!1),Zh=i(["grid","x","type"],"tick"),$h=i(["grid","x","lines"],[]),_h=i(["grid","y","show"],!1),ai=i(["grid","y","lines"],[]),bi=i(["grid","y","ticks"],10),ci=i(["point","show"],!0),di=i(["point","r"],2.5),ei=i(["point","focus","line","enabled"],!0),fi=i(["point","focus","expand","enabled"],!0),gi=i(["point","focus","expand","r"]),hi=i(["point","focus","select","r"]),ii=i(["line","connect_null"],!1),ji=i(["bar","width"]),ki=i(["bar","width","ratio"],.6),li=i(["pie","label","show"],!0),mi=i(["pie","label","format"]),ni=i(["pie","expand"],!0),oi=i(["pie","onclick"],function(){}),pi=i(["pie","onmouseover"],function(){}),qi=i(["pie","onmouseout"],function(){}),ri=i(["donut","label","show"],!0),si=i(["donut","label","format"]),ti=i(["donut","expand"],!0),ui=i(["donut","title"],""),vi=i(["donut","onclick"],function(){}),wi=i(["donut","onmouseover"],function(){}),xi=i(["donut","onmouseout"],function(){}),yi=i(["regions"],[]),zi=i(["tooltip","show"],!0),Ai=i(["tooltip","format","title"]),Bi=i(["tooltip","format","value"]),Ci=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Ai?Ai:b,l=Bi?Bi:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Di=i(["tooltip","init","show"],!1),Ei=i(["tooltip","init","x"],0),Fi=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Gi=("string"==typeof Kf?Kf.replace("#",""):Kf.id)+"-clip",Hi=Gi+"-xaxis",Ii=Gi+"-yaxis",Ji=j(Gi),Ki=j(Hi),Li=j(Ii),Mi="timeseries"===ph,Ni="categorized"===ph,Oi=!Mi&&(Fg||De(Gg)),Pi=null,Qi=!1,Ri=!1,Si=!1,Ti=!1,Ui=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Vi=xe(Tg,De(gh)?gh:Ui,Sg),Wi=qh?Hf.time.format:Hf.time.format.utc,Xi=function(){var a=[[Wi("%Y/%-m/%-d"),function(){return!0}],[Wi("%-m/%-d"),function(a){return a.getMonth()}],[Wi("%-m/%-d"),function(a){return 1!==a.getDate()}],[Wi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Wi("%I %p"),function(a){return a.getHours()}],[Wi("%I:%M"),function(a){return a.getMinutes()}],[Wi(":%S"),function(a){return a.getSeconds()}],[Wi(".%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)}}(),Yi=[],Zi=[],$i=nh?"left":"bottom",_i=nh?Lh?"top":"bottom":Lh?"right":"left",aj=nh?Uh?"bottom":"top":Uh?"left":"right",bj=nh?"left":"bottom",cj={main:function(){return"translate("+k(Zf.left)+","+k(Zf.top)+")"},context:function(){return"translate("+k($f.left)+","+k($f.top)+")"},legend:function(){return"translate("+_f.left+","+_f.top+")"},x:function(){return"translate(0,"+(nh?0:cg)+")"},y:function(){return"translate(0,"+(nh?cg:0)+")"},y2:function(){return"translate("+(nh?0:ag)+","+(nh?1:0)+")"},subx:function(){return"translate(0,"+(nh?0:dg)+")"},arc:function(){return"translate("+ag/2+","+cg/2+")"}},dj="right"===ih,ej=0,fj=0,gj=0,hj=.15,ij=30,jj=nh&&!oh?0:30,kj=5;mg=Hf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var lj,mj=function(){var a=Hf.svg.line().x(nh?function(a){return X(a.id)(a.value) -}:Gd).y(nh?Gd:function(a){return X(a.id)(a.value)});return ii||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ii?Pe(b.values):b.values;return ke(b)?(a.interpolate(le(b)?"cardinal":"linear"),Rg[b.id]?cf(e,vg,X(b.id),Rg[b.id]):a(e)):(c=e[0]?vg(e[0].x):0,d=e[0]?X(b.id)(e[0].value):0,nh?"M "+d+" "+c:"M "+c+" "+d)}}(),nj=function(){var a;return a=nh?Hf.svg.area().x0(function(a){return X(a.id)(0)}).x1(function(a){return X(a.id)(a.value)}).y(Gd):Hf.svg.area().x(Gd).y0(function(a){return X(a.id)(0)}).y1(function(a){return X(a.id)(a.value)}),function(b){var c,d,e=Pe(b.values);return ee([b],"area")||ee([b],"area-spline")?(a.interpolate(le(b)?"cardinal":"linear"),a(e)):(c=e[0]?vg(e[0].x):0,d=e[0]?X(b.id)(e[0].value):0,nh?"M "+d+" "+c:"M "+c+" "+d)}}(),oj=function(){var a=Hf.svg.line().x(nh?function(a){return Y(a.id)(a.value)}:Jd).y(nh?Jd:function(a){return Y(a.id)(a.value)});return function(b){var c=Pe(b.values);return ke(b)?a(c):"M "+yg(c[0].x)+" "+Y(b.id)(c[0].value)}}(),pj=function(){};lj=Hf.svg.brush().on("brush",nf),lj.update=function(){return tj&&tj.select("."+g.brush).call(this),this},lj.scale=function(a){return nh?this.y(a):this.x(a)},Rf&&(pj=Hf.behavior.zoom().on("zoomstart",function(){pj.altDomain=Hf.event.sourceEvent.altKey?vg.orgDomain():null}).on("zoom",Rf?of:null),pj.scale=function(a){return nh?this.y(a):this.x(a)},pj.orgScaleExtent=function(){var a=Sf?Sf:[1,10];return[a[0],Math.max(Ac()/a[1],a[1])]},pj.updateScaleExtent=function(){var a=bc(vg.orgDomain())/bc(xj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var qj,rj,sj,tj,uj,vj,wj,xj,yj,zj={};if(If.focus=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",1)}var c=qj.selectAll(qd(a)),d=c.filter(Df),e=c.filter(Ef);If.revert(),If.defocus(),b(d.classed(g.focused,!0)),b(e),je(If.data.targets)&&Ob(a,!0),yf(a,!0)},If.defocus=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",.3)}var c=qj.selectAll(qd(a)),d=c.filter(Df),e=c.filter(Ef);If.revert(),b(d.classed(g.focused,!1)),b(e),je(If.data.targets)&&Pb(a),yf(a,!1)},If.revert=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",1)}var c=qj.selectAll(qd(a)),d=c.filter(Df),e=c.filter(Ef);b(d.classed(g.focused,!1)),b(e),je(If.data.targets)&&Pb(a),zf()},If.show=function(a,b){a=Ec(a),b=b||{},Nc(a),qj.selectAll(rd(a)).transition().style("opacity",1),b.withLegend&&Af(a),mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},If.hide=function(a,b){a=Ec(a),b=b||{},Mc(a),qj.selectAll(rd(a)).transition().style("opacity",0),b.withLegend&&Bf(a),mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},If.toggle=function(a){Hc(a)?If.hide(a):If.show(a)},If.unzoom=function(){lj.clear().update(),mf({withUpdateXDomain:!0})},If.load=function(a){return a.xs&&oc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Kg[b]=a.classes[b]}),"categories"in a&&Ni&&(rh=a.categories,Bg.categories(rh)),"cacheIds"in a&&cc(a.cacheIds)?void tf(ec(a.cacheIds),a.done):void("unload"in a?vf(Ec("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){uf(a)}):uf(a))},If.unload=function(a,b){vf(Ec(a),function(){mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},If.selected=function(a){return Hf.merge(sj.selectAll("."+g.shapes+pd(a)).selectAll("."+g.shape).filter(function(){return Hf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},If.select=function(a,b,c){Vg&&sj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Hf.select(this),i=e.data?e.data.id:e.id,j=Oe(this),k=Wg||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);k&&l?Xg(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f)})},If.unselect=function(a,b){Vg&&sj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Hf.select(this),f=c.data?c.data.id:c.id,h=Oe(this),i=Wg||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);i&&j&&Xg(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},If.toLine=function(a){Gf(a,"line")},If.toSpline=function(a){Gf(a,"spline")},If.toBar=function(a){Gf(a,"bar")},If.toScatter=function(a){Gf(a,"scatter")},If.toArea=function(a){Gf(a,"area")},If.toAreaSpline=function(a){Gf(a,"area-spline")},If.toPie=function(a){Gf(a,"pie",{withTransform:!0})},If.toDonut=function(a){Gf(a,"donut",{withTransform:!0})},If.groups=function(a){return c(a)?Lg:(Lg=a,mf(),Lg)},If.xgrids=function(a){return a?($h=a,mf(),$h):$h},If.xgrids.add=function(a){return a?If.xgrids($h.concat(a)):void 0},If.xgrids.remove=function(a){var b=Ff(a);return If.xgrids($h.filter(b))},If.ygrids=function(a){return a?(ai=a,mf(),ai):ai},If.ygrids.add=function(a){return a?If.ygrids(ai.concat(a)):void 0},If.ygrids.remove=function(a){var b=Ff(a);return If.ygrids(ai.filter(b))},If.regions=function(a){return c(a)?yi:(yi=a,mf(),yi)},If.regions.add=function(a){return c(a)?yi:(yi=yi.concat(a),mf(),yi)},If.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;qj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),yi=yi.filter(function(b){return b.classes.indexOf(a)<0})}),yi},If.data.get=function(a){var b=If.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},If.data.getAsTarget=function(a){var b=Gc(function(b){return b.id===a});return b.length>0?b[0]:void 0},If.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Jg[b]=a[b]}),mf({withLegend:!0}),Jg):Jg},If.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Tg[b]=a[b]}),mf({withLegend:!0}),Tg):Tg},If.x=function(a){return arguments.length&&(rc(If.data.targets,a),mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),If.data.xs},If.xs=function(a){return arguments.length&&(sc(If.data.targets,a),mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),If.data.xs},If.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){db(b,a[b])}),Fb())},If.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Ah=+a.x),b(a.y)&&(Hh=+a.y),b(a.y2)&&(Qh=+a.y2)):Hh=Qh=+a,mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},If.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Bh=+a.x),b(a.y)&&(Ih=+a.y),b(a.y2)&&(Rh=+a.y2)):Ih=Rh=+a,mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},If.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&If.axis.max(a.max),"undefined"!=typeof a.min&&If.axis.min(a.min))},If.legend.show=function(a){Af(Ec(a)),mf({withLegend:!0})},If.legend.hide=function(a){Bf(Ec(a)),mf({withLegend:!0})},If.resize=function(a){Lf=a?a.width:null,Mf=a?a.height:null,rf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},If.destroy=function(){If.data.targets=void 0,If.data.xs={},wj.html(""),a.onresize=null},"url"in f.data)Hf.xhr(f.data.url,function(a,b){var c,d=Hf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Hf.csv.parse(b.response),df(c)});else if("rows"in f.data)df(uc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");df(vc(f.data.columns))}return If},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(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}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.ceil(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.ceil(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&aag&&(ag=0),0>cg&&(cg=0),bg=nh?Zf.left-ij-jj:ag,dg=nh?cg:fg-$f.top-$f.bottom,0>bg&&(bg=0),0>dg&&(dg=0),r(),dj&&je(If.data.targets)&&(_f.left=ag/2+hg)}function q(){sj.select("line."+g.xgridFocus).attr("x1",nh?0:-10).attr("x2",nh?ag:-10).attr("y1",nh?-10:Zf.top).attr("y2",nh?-10:cg)}function r(){hg=cg/2,gg=.95*hg,ig=ie(If.data.targets)?.6*gg:0}function s(){var a=nh?g.axisX:g.axisY,b=sj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Hf.select(Kf).node().getBoundingClientRect(),e=c.right-d.left-v();return e>0?e:0}function t(){return Lf?Lf:z()}function u(){var a=Mf?Mf:A();return a>0?a:320}function v(){return je(If.data.targets)?0:Nf?Nf:nh?oh?x("x"):1:!Gh||Lh?1:x("y")}function w(){var a=1;return je(If.data.targets)?0:Of?Of:dj?R()+20+(Ph&&!nh?x("y2"):a):Ph?Uh||nh?a:x("y2"):a}function x(a){var b=lb(a);return b.isInner?20+Eb(a):40+Eb(a)}function y(a){return"x"!==a||oh?"x"===a&&Dh?Dh:"y"!==a||Gh?"y2"!==a||Ph?(lb(a).isInner?30:40)+("y2"===a?-10:0):kj:hh&&!dj?10:1:0}function z(){return+Hf.select(Kf).style("width").replace("px","")}function A(){return+Hf.select(Kf).style("height").replace("px","")}function B(a){return a?-5:-(Zf.left-1)}function C(a){return a?-20:-4}function D(){return B(!nh)}function E(){return C(!nh)}function F(){return B(nh)}function G(){return C(nh)}function H(a){return a?ag+2+4:Zf.left+20}function I(a){return a?(Dh?Dh:0)+80:cg+8}function J(){return H(!nh)}function K(){return I(!nh)}function L(){return H(nh)}function M(){return I(nh)}function N(){var a,b,c,d,e,f=Bc(If.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=vg(b.x)-vg(a.x),0===c?nh?cg:ag:(d=Ac(),e=fe(If.data.targets)?(d-(Ni?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function O(a){ej=a}function P(a){fj=a}function Q(a){gj=a}function R(){return hh?dj?fj*(ej+1):eg:0}function S(){return hh?dj?fg:gj*(ej+1):0}function T(){var a,b,c=!vg;ng=nh?1:0,og=nh?cg:ag,pg=nh?0:cg,qg=nh?ag:1,rg=ng,sg=og,tg=nh?0:dg,ug=nh?bg:1,vg=V(ng,og,c?void 0:vg.domain(),function(){return Bg.tickOffset()}),wg=W(pg,qg,c?void 0:wg.domain()),xg=W(pg,qg,c?void 0:xg.domain()),yg=V(ng,og,xj,function(a){return a%1?0:Eg.tickOffset()}),zg=W(tg,ug,c?void 0:zg.domain()),Ag=W(tg,ug,c?void 0:Ag.domain()),a=ab(),b=yh?yh:c?void 0:Bg.tickValues(),Bg=Z(vg,$i,a,b),Eg=Z(yg,bj,a,b),Cg=$(wg,_i,Mh,Oh),Dg=$(xg,aj,Vh,Xh),c||(lj.scale(yg),Rf&&pj.scale(vg)),U()}function U(){jg=Hb(),kg=Ib(),lg=Ib(.98)}function V(a,b,c,d){var e,f=(Mi?Hf.time.scale():Hf.scale.linear()).range([a,b]),g=c?f.domain(c):f;Ni?(d=d||function(){return 0},f=function(a){return Math.ceil(g(a)+d(a))}):f=function(a){return Math.ceil(g(a))};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return xj&&xj[0]===a[0]&&xj[1]a?a.toFixed(0):a};return th&&("function"==typeof th?a=th:Mi&&(a=function(a){return a?Wi(th)(a):""})),a}function bb(a){var b;return"y"===a?b=Kh:"y2"===a?b=Th:"x"===a&&(b=Fh),b}function cb(a){var b=bb(a);return"string"==typeof b?b:b?b.text:null}function db(a,b){var c=bb(a);"string"==typeof c?"y"===a?Kh=b:"y2"===a?Th=b:"x"===a&&(Fh=b):c&&(c.text=b)}function eb(a){return 10*Math.sin(Math.PI*(a/180))}function fb(a){return 11.5-2.5*(a/15)}function gb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",fb(c)).attr("x",eb(c)).attr("transform","rotate("+c+")")}function hb(a,b){var c=bb(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 ib(){return hb("x",nh?"inner-top":"inner-right")}function jb(){return hb("y",nh?"inner-right":"inner-top")}function kb(){return hb("y2",nh?"inner-right":"inner-top")}function lb(a){return"y2"===a?kb():"y"===a?jb():ib()}function mb(){return cb("x")}function nb(){return cb("y")}function ob(){return cb("y2")}function pb(a,b){return a?b.isLeft?0:b.isCenter?ag/2:ag:b.isBottom?-cg:b.isMiddle?-cg/2:0}function qb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function rb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function sb(){return pb(!nh,ib())}function tb(){return pb(nh,jb())}function ub(){return pb(nh,kb())}function vb(){return qb(!nh,ib())}function wb(){return qb(nh,jb())}function xb(){return qb(nh,kb())}function yb(){var a=ib();return nh?a.isInner?"1.2em":-25-Eb("x"):a.isInner?"-0.5em":Dh?Dh-10:"3em"}function zb(){var a=jb();return nh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Eb("y")}function Ab(){var a=kb();return nh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Eb("y2")}function Bb(){return rb(!nh,ib())}function Cb(){return rb(nh,jb())}function Db(){return rb(nh,kb())}function Eb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Hf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Fb(a){var b=sj.select("."+g.axisX+" ."+g.axisXLabel),c=sj.select("."+g.axisY+" ."+g.axisYLabel),d=sj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb),(a?c.transition():c).attr("x",tb).attr("dx",wb).attr("dy",zb).attr("dy",zb).text(nb),(a?d.transition():d).attr("x",ub).attr("dx",xb).attr("dy",Ab).text(ob)}function Gb(a){var b=!1;return mg(Jc(If.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Hb(){var a=Hf.svg.arc().outerRadius(gg).innerRadius(ig),b=function(b,c){var d;return c?a(b):(d=Gb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Ib(a){var b=Hf.svg.arc().outerRadius(hg*(a?a:1)).innerRadius(ig);return function(a){var c=Gb(a);return c?b(c):"M 0 0"}}function Jb(a,b){return qe(a.data)?jg(a,b):"M 0 0"}function Kb(a){var b,c,d,e,f=Gb(a),g="";return f&&(b=jg.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*gg*.8+","+d/e*gg*.8+")"),g}function Lb(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Mb(a){return qc({id:a.data.id,value:a.value,ratio:Lb(a)})}function Nb(a){var b,c,d,e;return Qb()?(b=Gb(a),c=b?b.value:null,d=Lb(b),e=Rb(),e?e(c,d):Ed(c,d)):""}function Ob(a,b){var c=qj.selectAll("."+g.chartArc+qd(a)),d=qj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});we(a)&&c.selectAll("path").transition().duration(50).attr("d",kg).transition().duration(100).attr("d",lg).each(function(a){pe(a.data)}),b||d.style("opacity",.3)}function Pb(a){var b=qj.selectAll("."+g.chartArc+qd(a));b.selectAll("path").transition().duration(50).attr("d",jg),qj.selectAll("."+g.arc).style("opacity",1)}function Qb(){return ie(If.data.targets)?ri:li}function Rb(){return ie(If.data.targets)?si:mi}function Sb(){return ie(If.data.targets)?ui:""}function Tb(){var a=ie(If.data.targets)?vi:oi;return"function"==typeof a?a:function(){}}function Ub(){var a=ie(If.data.targets)?wi:pi;return"function"==typeof a?a:function(){}}function Vb(){var a=ie(If.data.targets)?xi:qi;return"function"==typeof a?a:function(){}}function Wb(a){var b,c,d,e,f,g,h=Dc(a),i=Qc(a);if(Lg.length>0)for(g=Sc(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 Hf.min(Object.keys(i).map(function(a){return Hf.min(i[a])}))}function Xb(a){var b,c,d,e,f,g,h=Dc(a),i=Qc(a);if(Lg.length>0)for(g=Tc(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 Hf.max(Object.keys(i).map(function(a){return Hf.max(i[a])}))}function Yb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return _(a.id)===c}),m="y2"===c?Rh:Ih,n="y2"===c?Qh:Hh,o=b(m)?m:Wb(l),p=b(n)?n:Xb(l),q="y2"===c?Sh:Jh,r=yd()&&nh;return 0===l.length?"y2"===c?xg.domain():wg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=zd(o,p),j=bc(wg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Nh&&(f=b(Nh.top)?Nh.top:e,g=b(Nh.bottom)?Nh.bottom:e),"y2"===c&&Wh&&(f=b(Wh.top)?Wh.top:e,g=b(Wh.bottom)?Wh.bottom:e),fe(l)&&!Sc(l)&&(g=o),[o-g,p+f])}function Zb(a){return Bh?Mi?ye(Bh):Bh:Hf.min(a,function(a){return Hf.min(a.values,function(a){return a.x})})}function $b(a){return Ah?Mi?ye(Ah):Ah:Hf.max(a,function(a){return Hf.max(a.values,function(a){return a.x})})}function _b(a){var c,d,e,f,g=Cc(a),h=g[1]-g[0];return Ni?d=0:fe(a)?(c=Ac(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Ch&&De(Ch)?(e=b(Ch.left)?Ch.left:d,f=b(Ch.right)?Ch.right:d):e=f="number"==typeof Ch?Ch:d,{left:e,right:f}}function ac(a){var b=[Zb(a),$b(a)],c=b[0],d=b[1],e=_b(a),f=0,g=0;return c-d!==0||Ni||(c=Mi?new Date(.5*c.getTime()):-.5,d=Mi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Mi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Mi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function bc(a){return a[1]-a[0]}function cc(a){for(var b=0;bb?0:b-c}function ic(a){var b,c=gc(a),d="y"===a.axis?wg:xg;return b="y"===a.axis||"y2"===a.axis?nh?cg:"start"in a?d(a.start):cg:nh?"end"in a?vg(Mi?ye(a.end):a.end):cg:cg,c>b?0:b-c}function jc(a){return Fg&&a===Fg||De(Gg)&&Ee(Gg,a)}function kc(a){return!jc(a)}function lc(a){return Fg?Fg:De(Gg)?Gg[a]:null}function mc(a,b){var c,d=b&&De(b)?Dc(b):[];return d.forEach(function(b){lc(b)===a&&(c=If.data.xs[b])}),c}function nc(a,b){return a in If.data.xs&&If.data.xs[a]&&If.data.xs[a][b]?If.data.xs[a][b]:b}function oc(a){Object.keys(a).forEach(function(b){Gg[b]=a[b]})}function pc(a){return 1===Hf.set(Object.keys(a).map(function(b){return a[b]})).size()}function qc(a){var b;return a&&(b=Jg[a.id],a.name=b?b:a.id),a}function rc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=tc(b[d],a.id,d)}),If.data.xs[a.id]=b})}function sc(a,b){a.forEach(function(a){b[a.id]&&rc([a],b[a.id])})}function tc(a,c,d){var e;return e=Mi?a?a instanceof Date?a:ye(a):ye(nc(c,d)):Oi&&!Ni?b(a)?+a:nc(c,d):d}function uc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?If.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Fg?(d=Object.keys(If.data.xs),If.data.xs[c]=d.length>0?If.data.xs[d[0]]:void 0):De(Gg)&&(If.data.xs[c]=mc(f,If.data.targets)):If.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!If.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Ig(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=lc(b),g=a[f],h=tc(g,b,e);return Oi&&Ni&&0===c&&g&&(0===e&&(rh=[]),rh.push(g)),("undefined"==typeof a[b]||If.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ng&&de(Dc(c).filter(function(a){return!(a in Og)}),Ng),c.forEach(function(a){dc(a.id_org,a)}),c}function xc(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 yc(a){return a>0&&If.data.targets[0].values[a-1]?If.data.targets[0].values[a-1].x:void 0}function zc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Cc(a){var b,c,d=Bc(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Dc(a){return a.map(function(a){return a.id})}function Ec(a){return a?"string"==typeof a?[a]:a:Dc(If.data.targets)}function Fc(a,b){var c,d=Dc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Mi?new Date(i):i);j.push(e)}return Mi||(j=j.sort(function(a,b){return a-b})),j}function Mc(a){Yi=Yi.concat(a)}function Nc(a){Yi=Yi.filter(function(b){return a.indexOf(b)<0})}function Oc(a){Zi=Zi.concat(a)}function Pc(a){Zi=Zi.filter(function(b){return a.indexOf(b)<0})}function Qc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Rc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Tc(a){return Rc(a,function(a){return a>0})}function Uc(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||0===a[f].x)&&(e=e.concat(Kd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Kd(a,g))),Nd(e,b)):Ld(a,b,f,g)}function Md(a,b){var c;return c=a.map(function(a){return Ld(a.values,b)}),Nd(c,b)}function Nd(a,b){var c,d;return a.forEach(function(a){var e=Fe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Od(a,b){return Hf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Pd(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 Qd(){return Qg&&"desc"===Qg.toLowerCase()}function Rd(){return Qg&&"asc"===Qg.toLowerCase()}function Sd(a){var b=Rd(),c=Qd();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 Qg&&a.sort(Qg),a}function Td(a,c){var d,e,f,g,h,i,j,k=je(If.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&zi&&(vj.html(Ci(a,ab(),Ad(k),Vi)).style("display","block"),d=vj.property("offsetWidth"),e=vj.property("offsetHeight"),k?(g=ag/2+c[0],i=cg/2+c[1]+20):(nh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-w(),i=vg(l[0].x)+20):(f=s(),g=f+v()+vg(l[0].x)+20,h=g+d,j=f+t()-w(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),vj.style("top",i+"px").style("left",g+"px"))}function Ud(){vj.style("display","none")}function Vd(a){var c=a.filter(function(a){return a&&b(a.value)});if(zi&&!ge(If.data.targets)&&!je(If.data.targets)){var d=sj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(nh?"y1":"x1",Gd).attr(nh?"y2":"x2",Gd),lf(d,"grid")}}function Wd(){sj.select("line."+g.xgridFocus).style("visibility","hidden")}function Xd(a,b){var c,d,e,f,h=[],i=sj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=ac(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function Yd(a){return a.x||0===a.x?vg(a.x):null}function Zd(a){return X(a.id)(a.value)}function $d(){var a,b,d={},e=0;return Jc(Gc(me)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ce(a,b){return"number"==typeof ji?ji:b?2*a.tickOffset()*ki/b:0}function de(a,b){Ec(a).forEach(function(a){zj[a]=b===Og[a],Og[a]=b})}function ee(a,b){var c=!1;return a.forEach(function(a){Og[a.id]===b&&(c=!0),a.id in Og||"line"!==b||(c=!0)}),c}function fe(a){return ee(a,"bar")}function ge(a){return ee(a,"scatter")}function he(a){return ee(a,"pie")}function ie(a){return ee(a,"donut")}function je(a){return he(a)||ie(a)}function ke(a){var b="string"==typeof a?a:a.id;return!(b in Og)||"line"===Og[b]||"spline"===Og[b]||"area"===Og[b]||"area-spline"===Og[b]}function le(a){var b="string"==typeof a?a:a.id;return"spline"===Og[b]||"area-spline"===Og[b]}function me(a){var b="string"==typeof a?a:a.id;return"bar"===Og[b]}function ne(a){var b="string"==typeof a?a:a.id;return"scatter"===Og[b]}function oe(a){var b="string"==typeof a?a:a.id;return"pie"===Og[b]}function pe(a){var b="string"==typeof a?a:a.id;return"donut"===Og[b]}function qe(a){return oe(a)||pe(a)}function re(a){return ke(a)?[a]:[]}function se(a){return qe(a.data)?[a]:[]}function te(a){return me(a)?a.values:[]}function ue(a){return ke(a)||ne(a)?a.values:[]}function ve(a){return me(a)||ke(a)?a.values:[]}function we(a){return pe(a)&&ti||oe(a)&&ni}function xe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ye(b){var c;try{c=Hg?Hf.time.format(Hg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Hg)}return c}function ze(a,b){var c=Hf.mouse(a),d=Hf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ee(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Fe(a,b){var c="y"===_(a.id)?wg:xg,d=nh?1:0,e=nh?0:1;return Math.pow(vg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ge(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function He(a,b,c){ah(b,a.node()),sj.select("."+g.selectedCircles+pd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Vc(g.selectedCircle,c)}).attr("cx",nh?Zd:Yd).attr("cy",nh?Yd:Zd).attr("stroke",function(){return Vi(b)}).attr("r",1.4*Se(b)).transition().duration(100).attr("r",Se)}function Ie(a,b,c){bh(b,a.node()),sj.select("."+g.selectedCircles+pd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Je(a,b,c,d){a?He(b,c,d):Ie(b,c,d)}function Ke(a,b){ah(b,a.node()),a.transition().duration(100).style("fill",function(){return Hf.rgb(Vi(b)).brighter(.75)})}function Le(a,b){bh(b,a.node()),a.transition().duration(100).style("fill",function(){return Vi(b)})}function Me(a,b,c,d){a?Ke(b,c,d):Le(b,c,d)}function Ne(a,b,c,d){Me(a,b,c.data,d)}function Oe(a){return"circle"===a.nodeName?Je:Hf.select(a).classed(g.bar)?Me:Ne}function Pe(a){return a.filter(function(a){return b(a.value)})}function Qe(a){return ci?"function"==typeof di?di(a):di:0}function Re(a){return fi?gi?gi:1.75*Qe(a):Qe(a)}function Se(a){return hi?hi:4*Qe(a)}function Te(a,c){return(c?sj.selectAll("."+g.circles+pd(c)):sj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ue(a,b){Te(a,b).classed(g.EXPANDED,!0).attr("r",Re)}function Ve(a){Te(a).filter(function(){return Hf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Qe)}function We(a){return sj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function Xe(a){We(a).classed(g.EXPANDED,!0)}function Ye(a){We(a).classed(g.EXPANDED,!1)}function Ze(a,b){var c=bf(a,b);return function(a,b){var d=c(a,b),e=nh?1:0,f=nh?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 $e(a,b){var c=bf(a,!1),d=b?_e:af;return function(a,b){return d(c(a,b),a,this)}}function _e(a,b){var c;return nh?(c=me(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function af(a,b,c){var d=c.getBoundingClientRect();return nh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:me(b)?-3:-6)}function bf(a,b){var c=a.__max__+1,d=ce(Bg,c),e=_d(d,c,a,!!b),f=ae(!!b),g=be(a,!!b),h=b?Y:X;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return nh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function cf(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 df(b){var c,d,e;if(wj=Hf.select(Kf),wj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(wj.html("").classed("c3",!0),If.data.xs={},If.data.targets=wc(b),Ug&&Mc(Ug===!0?Dc(If.data.targets):Ug),p(),T(),vg.domain(Hf.extent(ac(If.data.targets))),wg.domain(Yb(If.data.targets,"y")),xg.domain(Yb(If.data.targets,"y2")),yg.domain(vg.domain()),zg.domain(wg.domain()),Ag.domain(xg.domain()),xj=vg.domain(),lj.scale(yg),Rf&&pj.scale(vg),qj=wj.append("svg").on("mouseenter",Uf).on("mouseleave",Vf),rj=qj.append("defs"),rj.append("clipPath").attr("id",Gi).append("rect"),rj.append("clipPath").attr("id",Hi).append("rect"),rj.append("clipPath").attr("id",Ii).append("rect"),qf(),sj=qj.append("g").attr("transform",cj.main),tj=qj.append("g").attr("transform",cj.context),uj=qj.append("g").attr("transform",cj.legend),eh||tj.style("visibility","hidden"),hh||(uj.style("visibility","hidden"),Zi=Dc(If.data.targets)),vj=Hf.select(Kf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Cf(Dc(If.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=sj.append("g").attr("clip-path",Ji).attr("class",g.grid),Yh&&d.append("g").attr("class",g.xgrids),De($h)&&d.append("g").attr("class",g.xgridLines),ei&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),_h&&d.append("g").attr("class",g.ygrids),De(ai)&&d.append("g").attr("class",g.ygridLines),sj.append("g").attr("clip-path",Ji).attr("class",g.regions),sj.append("g").attr("clip-path",Ji).attr("class",g.chart),c=sj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Rf?nh?"ns-resize":"ew-resize":null),sj.select("."+g.chart).append("g").attr("class",g.chartBars),sj.select("."+g.chart).append("g").attr("class",g.chartLines),sj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",cj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Sb()),sj.select("."+g.chart).append("g").attr("class",g.chartTexts),Rf&&sj.insert("rect",Tf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",ag).attr("height",cg).style("opacity",0).style("cursor",nh?"ns-resize":"ew-resize").call(pj).on("dblclick.zoom",null),Eh&&lj.extent("function"!=typeof Eh?Eh:Eh(ac())),oh&&sj.append("g").attr("class",g.axisX).attr("clip-path",Ki).attr("transform",cj.x).append("text").attr("class",g.axisXLabel).attr("transform",nh?"rotate(-90)":"").style("text-anchor",Bb),Gh&&sj.append("g").attr("class",g.axisY).attr("clip-path",Li).attr("transform",cj.y).append("text").attr("class",g.axisYLabel).attr("transform",nh?"":"rotate(-90)").style("text-anchor",Cb),Ph&&sj.append("g").attr("class",g.axisY2).attr("transform",cj.y2).append("text").attr("class",g.axisY2Label).attr("transform",nh?"":"rotate(-90)").style("text-anchor",Db),tj.append("g").attr("clip-path",Ji).attr("class",g.chart),tj.select("."+g.chart).append("g").attr("class",g.chartBars),tj.select("."+g.chart).append("g").attr("class",g.chartLines),tj.append("g").attr("clip-path",Ji).attr("class",g.brush).call(lj).selectAll("rect").attr(nh?"width":"height",nh?bg:dg),tj.append("g").attr("class",g.axisX).attr("transform",cj.subx).attr("clip-path",nh?"":Ki),sf(If.data.targets),nh?sj.select("."+g.axisX).style("opacity",0).call(Bg):(sj.select("."+g.axisY).style("opacity",0).call(Cg),sj.select("."+g.axisY2).style("opacity",0).call(Dg)),p(),T(),qf(),o(!1),mf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Di){if(Mi&&"string"==typeof Ei){for(Ei=ye(Ei),e=0;e0){d=[];for(var f in Jg)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Pd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Me,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function jf(a){je(If.data.targets)||Vg&&(Pi=a,sj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Qi=!0,ch())}function kf(){je(If.data.targets)||Vg&&(sj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),sj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Qi=!1,dh())}function lf(a,b){"grid"===b&&a.each(function(){var a=Hf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function mf(a){var c,e,f,h,i,j,k,l,m,n,o,p,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,O,P,Q,R,S,T,U,V,W,X,Y,Z,$,_=$d(),ab=je(If.data.targets),bb=Jc(If.data.targets);if(a=d(a)?a:{},G=d(a.withY)?a.withY:!0,H=d(a.withSubchart)?a.withSubchart:!0,I=d(a.withTransition)?a.withTransition:!0,L=d(a.withTransform)?a.withTransform:!1,M=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,O=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,P=d(a.withLegend)?a.withLegend:!1,J=d(a.withTransitionForExit)?a.withTransitionForExit:I,K=d(a.withTransitionForAxis)?a.withTransitionForAxis:I,V=I?Yf:0,W=J?V:0,X=K?V:0,c=sj.select("."+g.axisX).style("opacity",ab?0:1),f=sj.select("."+g.axisY).style("opacity",ab?0:1),h=sj.select("."+g.axisY2).style("opacity",ab?0:1),e=tj.select("."+g.axisX).style("opacity",ab?0:1),U={axisX:c.transition().duration(X),axisY:f.transition().duration(X),axisY2:h.transition().duration(X),axisSubX:e.transition().duration(X)},P&&hh&&Cf(Dc(If.data.targets),a,U),Ni&&0===bb.length&&vg.domain([0,c.selectAll(".tick").size()]),bb.length&&(O&&(vg.domain(Hf.extent(ac(bb))),xj=vg.domain(),Rf&&pj.scale(vg).updateScaleExtent(),yg.domain(vg.domain()),lj.scale(yg)),M&&(vg.domain(lj.empty()?xj:lj.extent()),Rf&&pj.scale(vg).updateScaleExtent()),yh||!xh&&!wh||(Y=Lc(Kc(bb),wh),Bg.tickValues(Y),Eg.tickValues(Y))),wg.domain(Yb(bb,"y")),xg.domain(Yb(bb,"y2")),U.axisX.call(Bg),U.axisY.call(Cg),U.axisY2.call(Dg),U.axisSubX.call(Eg),Fb(I),M&&bb.length)if(uh&&Y){for(Z=1;Z=0&&Hf.select(this).style("display",b%$?"none":"block")})}else qj.selectAll("."+g.axisX+" .tick text").style("display","block");!nh&&zh&&gb(c,U.axisX,zh),Q=Ze(_),S=$e(_,!0),T=$e(_,!1),zg.domain(wg.domain()),Ag.domain(xg.domain()),vj.style("display","none"),q(),sj.select("line."+g.xgridFocus).style("visibility","hidden"),Yh&&(k=Xd(Zh,vg),D=Ni?Bg.tickOffset():0,j=nh?{x1:0,x2:ag,y1:function(a){return vg(a)-D},y2:function(a){return vg(a)-D}}:{x1:function(a){return vg(a)+D},x2:function(a){return vg(a)+D},y1:Zf.top,y2:cg},i=sj.select("."+g.xgrids).selectAll("."+g.xgrid).data(k),i.enter().append("line").attr("class",g.xgrid),i.attr(j).style("opacity",function(){return+Hf.select(this).attr(nh?"y1":"x1")===(nh?cg:0)?0:1}),i.exit().remove()),De($h)&&(l=sj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data($h),m=l.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",nh?"":"rotate(-90)").attr("dx",nh?0:-Zf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(V).attr("x1",nh?0:Hd).attr("x2",nh?ag:Hd).attr("y1",nh?Hd:Zf.top).attr("y2",nh?Hd:cg).style("opacity",1),l.select("text").transition().duration(V).attr("x",nh?ag:0).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(V).style("opacity",0).remove()),G&&_h&&(n=sj.select("."+g.ygrids).selectAll("."+g.ygrid).data(wg.ticks(bi)),n.enter().append("line").attr("class",g.ygrid),n.attr("x1",nh?wg:0).attr("x2",nh?wg:ag).attr("y1",nh?0:wg).attr("y2",nh?cg:wg),n.exit().remove(),lf(n,"grid")),G&&De(ai)&&(o=sj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(ai),p=o.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",nh?"rotate(-90)":"").attr("dx",nh?0:-Zf.top).attr("dy",-5).style("opacity",0),o.select("line").transition().duration(V).attr("x1",nh?Id:0).attr("x2",nh?Id:ag).attr("y1",nh?0:Id).attr("y2",nh?cg:Id).style("opacity",1),o.select("text").transition().duration(V).attr("x",nh?0:ag).attr("y",Id).text(function(a){return a.text}).style("opacity",1),o.exit().transition().duration(V).style("opacity",0).remove()),w=sj.select("."+g.regions).selectAll("."+g.region).data(yi),w.enter().append("g").attr("class",id).append("rect").style("fill-opacity",0),w.selectAll("rect").transition().duration(V).attr("x",fc).attr("y",gc).attr("width",hc).attr("height",ic).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),w.exit().transition().duration(V).style("fill-opacity",0).remove(),u=sj.selectAll("."+g.bars).selectAll("."+g.bar).data(te),u.enter().append("path").attr("class",cd).style("stroke","none").style("fill",Vi),u.style("opacity",ud).transition().duration(V).attr("d",Q).style("fill",Vi).style("opacity",1),u.exit().transition().duration(W).style("opacity",0).remove(),r=sj.selectAll("."+g.lines).selectAll("."+g.line).data(re),r.enter().append("path").attr("class",$c).style("stroke",Vi),r.style("opacity",ud).transition().duration(V).attr("d",mj).style("stroke",Vi).style("opacity",1),r.exit().transition().duration(W).style("opacity",0).remove(),s=sj.selectAll("."+g.areas).selectAll("."+g.area).data(re),s.enter().append("path").attr("class",gd).style("fill",Vi).style("opacity",function(){return yj=+Hf.select(this).style("opacity"),0}),s.style("opacity",0).transition().duration(V).attr("d",nj).style("fill",Vi).style("opacity",yj),s.exit().transition().duration(W).style("opacity",0).remove(),t=sj.selectAll("."+g.circles).selectAll("."+g.circle).data(ue),t.enter().append("circle").attr("class",ad).attr("r",Qe).style("fill",Vi),t.style("opacity",ud).transition().duration(V).style("opacity",wd).style("fill",Vi).attr("cx",nh?Zd:Yd).attr("cy",nh?Yd:Zd),t.exit().remove(),x=sj.selectAll("."+g.texts).selectAll("."+g.text).data(ve),x.enter().append("text").attr("class",Wc).attr("text-anchor",function(a){return nh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",Vi).style("fill-opacity",0),x.text(function(a){return Fd(a.id)(a.value,a.id)}).style("fill-opacity",vd).transition().duration(V).attr("x",S).attr("y",T).style("fill",Vi).style("fill-opacity",xd),x.exit().transition().duration(W).style("fill-opacity",0).remove(),v=sj.selectAll("."+g.arcs).selectAll("."+g.arc).data(se),v.enter().append("path").attr("class",ed).style("fill",function(a){return Vi(a.data)}).style("cursor",function(a){return Xg(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Ti||(c=Gb(a),d=Mb(c),e=Ub(),Ob(c.data.id),yf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Gb(a),c=Mb(b),d=[c];Td(d,Hf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Ti||(c=Gb(a),d=Mb(c),e=Vb(),Pb(c.data.id),zf(),Ud(),e(d,b))}).on("click",function(a,b){var c=Gb(a),d=Mb(c),e=Tb();gf(this,a,b),e(d,b)}),v.attr("transform",L?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Ti=!0}).transition().duration(V).attrTween("d",function(a){var b,c=Gb(a);return c?(b=Hf.interpolate(this._current,c),this._current=b(0),function(a){return Jb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",L?"scale(1)":"").style("fill",function(a){return Vi(a.data)}).style("opacity",1).call(Ge,function(){Ti=!1}),v.exit().transition().duration(W).style("opacity",0).remove(),sj.selectAll("."+g.chartArc).select("text").attr("transform",Kb).style("opacity",0).transition().duration(V).text(Nb).style("opacity",function(a){return Hc(a.data.id)&&qe(a.data)?1:0}),sj.select("."+g.chartArcsTitle).style("opacity",ie(If.data.targets)?1:0),eh&&(Hf.event&&"zoom"===Hf.event.type&&lj.extent(vg.orgDomain()).update(),H&&(!nh&&zh&&gb(e,U.axisSubX,zh),lj.empty()||lj.extent(vg.orgDomain()).update(),R=Ze(_,!0),z=tj.selectAll("."+g.bars).selectAll("."+g.bar).data(te),z.enter().append("path").attr("class",cd).style("stroke","none").style("fill",Vi),z.style("opacity",ud).transition().duration(V).attr("d",R).style("opacity",1),z.exit().transition().duration(V).style("opacity",0).remove(),y=tj.selectAll("."+g.lines).selectAll("."+g.line).data(re),y.enter().append("path").attr("class",$c).style("stroke",Vi),y.style("opacity",ud).transition().duration(V).attr("d",oj).style("opacity",1),y.exit().transition().duration(V).style("opacity",0).remove())),sj.selectAll("."+g.selectedCircles).filter(function(a){return me(a)}).selectAll("circle").remove(),sj.selectAll("."+g.selectedCircle).transition().duration(V).attr("cx",nh?Zd:Yd).attr("cy",nh?Yd:Zd),A=sj.select("."+g.eventRects),De(Gg)&&!pc(Gg)?(A.classed(g.eventRectsMultiple)||A.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),B=sj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),ff(B.enter()),B.attr("x",0).attr("y",0).attr("width",ag).attr("height",cg)):(A.classed(g.eventRectsSingle)||A.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Oi&&!Ni?(F=function(a,b){var c=yc(b),d=zc(b),e=If.data.xs[a.id][b];return(vg(d?d:e+50)-vg(c?c:e-50))/2},E=function(a,b){var c=yc(b),d=If.data.xs[a.id][b];return(vg(d)+vg(c?c:d-50))/2}):(F=N(),E=function(a){return vg(a.x)-F/2}),C=Bc(If.data.targets),sj.select("."+g.eventRects).datum(C?C.values:[]),B=sj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),ef(B.enter()),B.attr("class",jd).attr("x",nh?0:E).attr("y",nh?E:0).attr("width",nh?ag:F).attr("height",nh?F:cg),B.exit().remove()),Dc(If.data.targets).forEach(function(a){zj[a]=!0})}function nf(){mf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function of(){if(0!==Jc(If.data.targets).length){if("mousemove"===Hf.event.sourceEvent.type&&pj.altDomain)return vg.domain(pj.altDomain),void pj.scale(vg).updateScaleExtent();Ni&&vg.orgDomain()[0]===xj[0]&&vg.domain([xj[0]-1e-10,vg.orgDomain()[1]]),mf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Hf.event.sourceEvent.type&&(Ri=!0)}}function pf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function qf(){qj.attr("width",eg).attr("height",fg),qj.select("#"+Gi).select("rect").attr("width",ag).attr("height",cg),qj.select("#"+Hi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),qj.select("#"+Ii).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),qj.select("."+g.zoomRect).attr("width",ag).attr("height",cg),wj.style("max-height",fg+"px")}function rf(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,p(),T(),qf(),o(a.withTransition),mf(a)}function sf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=sj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",ld),j=i.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Xc),e=sj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",nd),d=e.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",dd).style("cursor",function(a){return Xg(a)?"pointer":null}),c=sj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",md),b=c.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",_c),b.append("g").attr("class",hd),b.append("g").attr("class",function(a){return Vc(g.selectedCircles,a.id)}),b.append("g").attr("class",bd).style("cursor",function(a){return Xg(a)?"pointer":null}),a.forEach(function(a){sj.selectAll("."+g.selectedCircles+pd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=sj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(mg(a)).attr("class",od),f=h.enter().append("g").attr("class",od),f.append("g").attr("class",fd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),eh&&(n=tj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",nd),m=n.enter().append("g").style("opacity",0).attr("class",nd),m.append("g").attr("class",dd),l=tj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",md),k=l.enter().append("g").style("opacity",0).attr("class",md),k.append("g").attr("class",_c)),qj.selectAll("."+g.target).filter(function(a){return Hc(a.id)}).transition().duration(Yf).style("opacity",1)}function tf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?de(a.id,b.types[a.id]):de(a.id,b.type)}),If.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=dj?j:i,l=dj?S():R();return d&&(w=0,C=0,t=0,u=0),hh&&!Ic(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=dj?u:t,void(mh?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=uj.selectAll("."+g.legendItemFocused).size();b=b||{},n=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,dj?(f=function(a){return t*B[a]},j=function(a){return A[B[a]]+x[a]}):(f=function(a){return A[B[a]]+x[a]},j=function(a){return u*B[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=uj.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Vc(g.legendItem,a)}).style("visibility",function(a){return Ic(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof jh?jh(a):If.toggle(a)}).on("mouseover",function(a){Hf.select(this).classed(g.legendItemFocused,!0),Ti||If.focus(a),"function"==typeof kh&&kh(a)}).on("mouseout",function(a){Hf.select(this).classed(g.legendItemFocused,!1),Ti||If.revert(),"function"==typeof lh&&lh(a)}),m.append("text").text(function(a){return d(Jg[a])?Jg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",dj?h:-200).attr("y",dj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",dj?i:-200).attr("y",dj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",Vi).attr("x",dj?h:-200).attr("y",dj?-200:j).attr("width",10).attr("height",10),uj.selectAll("text").data(a).text(function(a){return d(Jg[a])?Jg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(n?250:0).attr("x",h).attr("y",k),uj.selectAll("rect."+g.legendItemEvent).data(a).transition().duration(n?250:0).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}).attr("x",i).attr("y",l),uj.selectAll("rect."+g.legendItemTile).data(a).transition().duration(n?250:0).style("fill",Vi).attr("x",f).attr("y",j),uj.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Hc(a)}).transition().style("opacity",function(a){var b=Hf.select(this);return Hc(a)?!D||b.classed(g.legendItemFocused)?wf(b):xf(b):hj}),P(t),Q(u),O(C),p(),T(),qf(),o(q,c)}function Df(a){return Fc(If.data.targets,a.id)}function Ef(a){return"data"in a&&Fc(If.data.targets,a.data.id)}function Ff(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 Gf(a,b,c){var d=!je(If.data.targets);Ti=!1,de(a,b),rf(c||{withTransitionForAxis:d})}var Hf=a.d3?a.d3:a.require?a.require("d3"):void 0,If={data:{},axis:{},legend:{}},Jf={},Kf=i(["bindto"],"#chart"),Lf=i(["size","width"]),Mf=i(["size","height"]),Nf=i(["padding","left"],50),Of=i(["padding","right"],0),Pf=i(["padding","top"],0),Qf=i(["padding","bottom"],0),Rf=i(["zoom","enabled"],!1),Sf=i(["zoom","extent"]),Tf=i(["zoom","privileged"],!1),Uf=i(["onenter"],function(){}),Vf=i(["onleave"],function(){}),Wf=i(["onresize"],function(){}),Xf=i(["onresized"],function(){}),Yf=i(["transition","duration"],350);h("data","data is required in config");var Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg=i(["data","x"]),Gg=i(["data","xs"],{}),Hg=i(["data","x_format"]),Ig=i(["data","id_converter"],function(a){return a}),Jg=i(["data","names"],{}),Kg=i(["data","classes"],{}),Lg=i(["data","groups"],[]),Mg=i(["data","axes"],{}),Ng=i(["data","type"]),Og=i(["data","types"],{}),Pg=i(["data","labels"],{}),Qg=i(["data","order"]),Rg=i(["data","regions"],{}),Sg=i(["data","color"]),Tg=i(["data","colors"],{}),Ug=i(["data","hide"],!1),Vg=i(["data","selection","enabled"],!1),Wg=i(["data","selection","grouped"],!1),Xg=i(["data","selection","isselectable"],function(){return!0}),Yg=i(["data","selection","multiple"],!0),Zg=i(["data","onclick"],function(){}),$g=i(["data","onenter"],function(){}),_g=i(["data","onleave"],function(){}),ah=i(["data","onselected"],function(){}),bh=i(["data","onunselected"],function(){}),ch=i(["data","ondragstart"],function(){}),dh=i(["data","ondragend"],function(){}),eh=i(["subchart","show"],!1),fh=i(["subchart","size","height"],60),gh=i(["color","pattern"],[]),hh=i(["legend","show"],!0),ih=i(["legend","position"],"bottom"),jh=i(["legend","item","onclick"]),kh=i(["legend","item","onmouseover"]),lh=i(["legend","item","onmouseout"]),mh=i(["legend","equally"],!1),nh=i(["axis","rotated"],!1),oh=i(["axis","x","show"],!0),ph=i(["axis","x","type"],"indexed"),qh=i(["axis","x","localtime"],!0),rh=i(["axis","x","categories"],[]),sh=i(["axis","x","tick","centered"],!1),th=i(["axis","x","tick","format"]),uh=i(["axis","x","tick","culling"],{}),vh=i(["axis","x","tick","culling","max"],10),wh=i(["axis","x","tick","count"]),xh=i(["axis","x","tick","fit"],!0),yh=i(["axis","x","tick","values"],null),zh=i(["axis","x","tick","rotate"]),Ah=i(["axis","x","max"],null),Bh=i(["axis","x","min"],null),Ch=i(["axis","x","padding"],{}),Dh=i(["axis","x","height"]),Eh=i(["axis","x","default"]),Fh=i(["axis","x","label"],{}),Gh=i(["axis","y","show"],!0),Hh=i(["axis","y","max"]),Ih=i(["axis","y","min"]),Jh=i(["axis","y","center"]),Kh=i(["axis","y","label"],{}),Lh=i(["axis","y","inner"],!1),Mh=i(["axis","y","tick","format"]),Nh=i(["axis","y","padding"]),Oh=i(["axis","y","ticks"],10),Ph=i(["axis","y2","show"],!1),Qh=i(["axis","y2","max"]),Rh=i(["axis","y2","min"]),Sh=i(["axis","y2","center"]),Th=i(["axis","y2","label"],{}),Uh=i(["axis","y2","inner"],!1),Vh=i(["axis","y2","tick","format"]),Wh=i(["axis","y2","padding"]),Xh=i(["axis","y2","ticks"],10),Yh=i(["grid","x","show"],!1),Zh=i(["grid","x","type"],"tick"),$h=i(["grid","x","lines"],[]),_h=i(["grid","y","show"],!1),ai=i(["grid","y","lines"],[]),bi=i(["grid","y","ticks"],10),ci=i(["point","show"],!0),di=i(["point","r"],2.5),ei=i(["point","focus","line","enabled"],!0),fi=i(["point","focus","expand","enabled"],!0),gi=i(["point","focus","expand","r"]),hi=i(["point","focus","select","r"]),ii=i(["line","connect_null"],!1),ji=i(["bar","width"]),ki=i(["bar","width","ratio"],.6),li=i(["pie","label","show"],!0),mi=i(["pie","label","format"]),ni=i(["pie","expand"],!0),oi=i(["pie","onclick"],function(){}),pi=i(["pie","onmouseover"],function(){}),qi=i(["pie","onmouseout"],function(){}),ri=i(["donut","label","show"],!0),si=i(["donut","label","format"]),ti=i(["donut","expand"],!0),ui=i(["donut","title"],""),vi=i(["donut","onclick"],function(){}),wi=i(["donut","onmouseover"],function(){}),xi=i(["donut","onmouseout"],function(){}),yi=i(["regions"],[]),zi=i(["tooltip","show"],!0),Ai=i(["tooltip","format","title"]),Bi=i(["tooltip","format","value"]),Ci=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Ai?Ai:b,l=Bi?Bi:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Di=i(["tooltip","init","show"],!1),Ei=i(["tooltip","init","x"],0),Fi=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Gi=("string"==typeof Kf?Kf.replace("#",""):Kf.id)+"-clip",Hi=Gi+"-xaxis",Ii=Gi+"-yaxis",Ji=j(Gi),Ki=j(Hi),Li=j(Ii),Mi="timeseries"===ph,Ni="categorized"===ph,Oi=!Mi&&(Fg||De(Gg)),Pi=null,Qi=!1,Ri=!1,Si=!1,Ti=!1,Ui=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Vi=xe(Tg,De(gh)?gh:Ui,Sg),Wi=qh?Hf.time.format:Hf.time.format.utc,Xi=function(){var a=[[Wi("%Y/%-m/%-d"),function(){return!0}],[Wi("%-m/%-d"),function(a){return a.getMonth()}],[Wi("%-m/%-d"),function(a){return 1!==a.getDate()}],[Wi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Wi("%I %p"),function(a){return a.getHours()}],[Wi("%I:%M"),function(a){return a.getMinutes()}],[Wi(":%S"),function(a){return a.getSeconds()}],[Wi(".%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)}}(),Yi=[],Zi=[],$i=nh?"left":"bottom",_i=nh?Lh?"top":"bottom":Lh?"right":"left",aj=nh?Uh?"bottom":"top":Uh?"left":"right",bj=nh?"left":"bottom",cj={main:function(){return"translate("+k(Zf.left)+","+k(Zf.top)+")"},context:function(){return"translate("+k($f.left)+","+k($f.top)+")"},legend:function(){return"translate("+_f.left+","+_f.top+")"},x:function(){return"translate(0,"+(nh?0:cg)+")"},y:function(){return"translate(0,"+(nh?cg:0)+")"},y2:function(){return"translate("+(nh?0:ag)+","+(nh?1:0)+")"},subx:function(){return"translate(0,"+(nh?0:dg)+")"},arc:function(){return"translate("+ag/2+","+cg/2+")" +}},dj="right"===ih,ej=0,fj=0,gj=0,hj=.15,ij=30,jj=nh&&!oh?0:30,kj=5;mg=Hf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var lj,mj=function(){var a=Hf.svg.line().x(nh?function(a){return X(a.id)(a.value)}:Gd).y(nh?Gd:function(a){return X(a.id)(a.value)});return ii||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ii?Pe(b.values):b.values;return ke(b)?(a.interpolate(le(b)?"cardinal":"linear"),Rg[b.id]?cf(e,vg,X(b.id),Rg[b.id]):a(e)):(c=e[0]?vg(e[0].x):0,d=e[0]?X(b.id)(e[0].value):0,nh?"M "+d+" "+c:"M "+c+" "+d)}}(),nj=function(){var a;return a=nh?Hf.svg.area().x0(function(a){return X(a.id)(0)}).x1(function(a){return X(a.id)(a.value)}).y(Gd):Hf.svg.area().x(Gd).y0(function(a){return X(a.id)(0)}).y1(function(a){return X(a.id)(a.value)}),function(b){var c,d,e=Pe(b.values);return ee([b],"area")||ee([b],"area-spline")?(a.interpolate(le(b)?"cardinal":"linear"),a(e)):(c=e[0]?vg(e[0].x):0,d=e[0]?X(b.id)(e[0].value):0,nh?"M "+d+" "+c:"M "+c+" "+d)}}(),oj=function(){var a=Hf.svg.line().x(nh?function(a){return Y(a.id)(a.value)}:Jd).y(nh?Jd:function(a){return Y(a.id)(a.value)});return function(b){var c=Pe(b.values);return ke(b)?a(c):"M "+yg(c[0].x)+" "+Y(b.id)(c[0].value)}}(),pj=function(){};lj=Hf.svg.brush().on("brush",nf),lj.update=function(){return tj&&tj.select("."+g.brush).call(this),this},lj.scale=function(a){return nh?this.y(a):this.x(a)},Rf&&(pj=Hf.behavior.zoom().on("zoomstart",function(){pj.altDomain=Hf.event.sourceEvent.altKey?vg.orgDomain():null}).on("zoom",Rf?of:null),pj.scale=function(a){return nh?this.y(a):this.x(a)},pj.orgScaleExtent=function(){var a=Sf?Sf:[1,10];return[a[0],Math.max(Ac()/a[1],a[1])]},pj.updateScaleExtent=function(){var a=bc(vg.orgDomain())/bc(xj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var qj,rj,sj,tj,uj,vj,wj,xj,yj,zj={};if(If.focus=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",1)}var c=qj.selectAll(qd(a)),d=c.filter(Df),e=c.filter(Ef);If.revert(),If.defocus(),b(d.classed(g.focused,!0)),b(e),je(If.data.targets)&&Ob(a,!0),yf(a,!0)},If.defocus=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",.3)}var c=qj.selectAll(qd(a)),d=c.filter(Df),e=c.filter(Ef);If.revert(),b(d.classed(g.focused,!1)),b(e),je(If.data.targets)&&Pb(a),yf(a,!1)},If.revert=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",1)}var c=qj.selectAll(qd(a)),d=c.filter(Df),e=c.filter(Ef);b(d.classed(g.focused,!1)),b(e),je(If.data.targets)&&Pb(a),zf()},If.show=function(a,b){a=Ec(a),b=b||{},Nc(a),qj.selectAll(rd(a)).transition().style("opacity",1),b.withLegend&&Af(a),mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},If.hide=function(a,b){a=Ec(a),b=b||{},Mc(a),qj.selectAll(rd(a)).transition().style("opacity",0),b.withLegend&&Bf(a),mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},If.toggle=function(a){Hc(a)?If.hide(a):If.show(a)},If.unzoom=function(){lj.clear().update(),mf({withUpdateXDomain:!0})},If.load=function(a){return a.xs&&oc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Kg[b]=a.classes[b]}),"categories"in a&&Ni&&(rh=a.categories,Bg.categories(rh)),"cacheIds"in a&&cc(a.cacheIds)?void tf(ec(a.cacheIds),a.done):void("unload"in a?vf(Ec("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){uf(a)}):uf(a))},If.unload=function(a,b){vf(Ec(a),function(){mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},If.selected=function(a){return Hf.merge(sj.selectAll("."+g.shapes+pd(a)).selectAll("."+g.shape).filter(function(){return Hf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},If.select=function(a,b,c){Vg&&sj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Hf.select(this),i=e.data?e.data.id:e.id,j=Oe(this),k=Wg||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);k&&l?Xg(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f)})},If.unselect=function(a,b){Vg&&sj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Hf.select(this),f=c.data?c.data.id:c.id,h=Oe(this),i=Wg||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);i&&j&&Xg(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},If.toLine=function(a){Gf(a,"line")},If.toSpline=function(a){Gf(a,"spline")},If.toBar=function(a){Gf(a,"bar")},If.toScatter=function(a){Gf(a,"scatter")},If.toArea=function(a){Gf(a,"area")},If.toAreaSpline=function(a){Gf(a,"area-spline")},If.toPie=function(a){Gf(a,"pie",{withTransform:!0})},If.toDonut=function(a){Gf(a,"donut",{withTransform:!0})},If.groups=function(a){return c(a)?Lg:(Lg=a,mf(),Lg)},If.xgrids=function(a){return a?($h=a,mf(),$h):$h},If.xgrids.add=function(a){return a?If.xgrids($h.concat(a)):void 0},If.xgrids.remove=function(a){var b=Ff(a);return If.xgrids($h.filter(b))},If.ygrids=function(a){return a?(ai=a,mf(),ai):ai},If.ygrids.add=function(a){return a?If.ygrids(ai.concat(a)):void 0},If.ygrids.remove=function(a){var b=Ff(a);return If.ygrids(ai.filter(b))},If.regions=function(a){return c(a)?yi:(yi=a,mf(),yi)},If.regions.add=function(a){return c(a)?yi:(yi=yi.concat(a),mf(),yi)},If.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;qj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),yi=yi.filter(function(b){return b.classes.indexOf(a)<0})}),yi},If.data.get=function(a){var b=If.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},If.data.getAsTarget=function(a){var b=Gc(function(b){return b.id===a});return b.length>0?b[0]:void 0},If.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Jg[b]=a[b]}),mf({withLegend:!0}),Jg):Jg},If.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Tg[b]=a[b]}),mf({withLegend:!0}),Tg):Tg},If.x=function(a){return arguments.length&&(rc(If.data.targets,a),mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),If.data.xs},If.xs=function(a){return arguments.length&&(sc(If.data.targets,a),mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),If.data.xs},If.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){db(b,a[b])}),Fb())},If.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Ah=+a.x),b(a.y)&&(Hh=+a.y),b(a.y2)&&(Qh=+a.y2)):Hh=Qh=+a,mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},If.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Bh=+a.x),b(a.y)&&(Ih=+a.y),b(a.y2)&&(Rh=+a.y2)):Ih=Rh=+a,mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},If.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&If.axis.max(a.max),"undefined"!=typeof a.min&&If.axis.min(a.min))},If.legend.show=function(a){Af(Ec(a)),mf({withLegend:!0})},If.legend.hide=function(a){Bf(Ec(a)),mf({withLegend:!0})},If.resize=function(a){Lf=a?a.width:null,Mf=a?a.height:null,rf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},If.destroy=function(){If.data.targets=void 0,If.data.xs={},wj.html(""),a.onresize=null},"url"in f.data)Hf.xhr(f.data.url,function(a,b){var c,d=Hf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Hf.csv.parse(b.response),df(c)});else if("rows"in f.data)df(uc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");df(vc(f.data.columns))}return If},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(window); \ No newline at end of file From e796a16fb5f2d8f00b1d022efba299372a184966 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 7 May 2014 16:44:07 +0900 Subject: [PATCH 142/178] Fix select/unselect API for index 0 data - #214 --- c3.js | 3 +++ c3.min.js | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/c3.js b/c3.js index 023d0a9..5967ed1 100644 --- a/c3.js +++ b/c3.js @@ -2140,6 +2140,7 @@ toggleBar(selected, target, d.data, i); } function getToggle(that) { + // path selection not supported yet return that.nodeName === 'circle' ? togglePoint : (d3.select(that).classed(CLASS.bar) ? toggleBar : toggleArc); } @@ -4218,6 +4219,7 @@ isTargetId = __data_selection_grouped || !ids || ids.indexOf(id) >= 0, isTargetIndex = !indices || indices.indexOf(i) >= 0, isSelected = shape.classed(CLASS.SELECTED); + if (this.nodeName === 'path') { return; } // path selection not supported yet if (isTargetId && isTargetIndex) { if (__data_selection_isselectable(d) && !isSelected) { toggle(true, shape.classed(CLASS.SELECTED, true), d, i); @@ -4237,6 +4239,7 @@ isTargetId = __data_selection_grouped || !ids || ids.indexOf(id) >= 0, isTargetIndex = !indices || indices.indexOf(i) >= 0, isSelected = shape.classed(CLASS.SELECTED); + if (this.nodeName === 'path') { return; } // path selection not supported yet if (isTargetId && isTargetIndex) { if (__data_selection_isselectable(d)) { if (isSelected) { diff --git a/c3.min.js b/c3.min.js index 8a62a89..27dc876 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ !function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.ceil(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.ceil(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&aag&&(ag=0),0>cg&&(cg=0),bg=nh?Zf.left-ij-jj:ag,dg=nh?cg:fg-$f.top-$f.bottom,0>bg&&(bg=0),0>dg&&(dg=0),r(),dj&&je(If.data.targets)&&(_f.left=ag/2+hg)}function q(){sj.select("line."+g.xgridFocus).attr("x1",nh?0:-10).attr("x2",nh?ag:-10).attr("y1",nh?-10:Zf.top).attr("y2",nh?-10:cg)}function r(){hg=cg/2,gg=.95*hg,ig=ie(If.data.targets)?.6*gg:0}function s(){var a=nh?g.axisX:g.axisY,b=sj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Hf.select(Kf).node().getBoundingClientRect(),e=c.right-d.left-v();return e>0?e:0}function t(){return Lf?Lf:z()}function u(){var a=Mf?Mf:A();return a>0?a:320}function v(){return je(If.data.targets)?0:Nf?Nf:nh?oh?x("x"):1:!Gh||Lh?1:x("y")}function w(){var a=1;return je(If.data.targets)?0:Of?Of:dj?R()+20+(Ph&&!nh?x("y2"):a):Ph?Uh||nh?a:x("y2"):a}function x(a){var b=lb(a);return b.isInner?20+Eb(a):40+Eb(a)}function y(a){return"x"!==a||oh?"x"===a&&Dh?Dh:"y"!==a||Gh?"y2"!==a||Ph?(lb(a).isInner?30:40)+("y2"===a?-10:0):kj:hh&&!dj?10:1:0}function z(){return+Hf.select(Kf).style("width").replace("px","")}function A(){return+Hf.select(Kf).style("height").replace("px","")}function B(a){return a?-5:-(Zf.left-1)}function C(a){return a?-20:-4}function D(){return B(!nh)}function E(){return C(!nh)}function F(){return B(nh)}function G(){return C(nh)}function H(a){return a?ag+2+4:Zf.left+20}function I(a){return a?(Dh?Dh:0)+80:cg+8}function J(){return H(!nh)}function K(){return I(!nh)}function L(){return H(nh)}function M(){return I(nh)}function N(){var a,b,c,d,e,f=Bc(If.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=vg(b.x)-vg(a.x),0===c?nh?cg:ag:(d=Ac(),e=fe(If.data.targets)?(d-(Ni?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function O(a){ej=a}function P(a){fj=a}function Q(a){gj=a}function R(){return hh?dj?fj*(ej+1):eg:0}function S(){return hh?dj?fg:gj*(ej+1):0}function T(){var a,b,c=!vg;ng=nh?1:0,og=nh?cg:ag,pg=nh?0:cg,qg=nh?ag:1,rg=ng,sg=og,tg=nh?0:dg,ug=nh?bg:1,vg=V(ng,og,c?void 0:vg.domain(),function(){return Bg.tickOffset()}),wg=W(pg,qg,c?void 0:wg.domain()),xg=W(pg,qg,c?void 0:xg.domain()),yg=V(ng,og,xj,function(a){return a%1?0:Eg.tickOffset()}),zg=W(tg,ug,c?void 0:zg.domain()),Ag=W(tg,ug,c?void 0:Ag.domain()),a=ab(),b=yh?yh:c?void 0:Bg.tickValues(),Bg=Z(vg,$i,a,b),Eg=Z(yg,bj,a,b),Cg=$(wg,_i,Mh,Oh),Dg=$(xg,aj,Vh,Xh),c||(lj.scale(yg),Rf&&pj.scale(vg)),U()}function U(){jg=Hb(),kg=Ib(),lg=Ib(.98)}function V(a,b,c,d){var e,f=(Mi?Hf.time.scale():Hf.scale.linear()).range([a,b]),g=c?f.domain(c):f;Ni?(d=d||function(){return 0},f=function(a){return Math.ceil(g(a)+d(a))}):f=function(a){return Math.ceil(g(a))};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return xj&&xj[0]===a[0]&&xj[1]a?a.toFixed(0):a};return th&&("function"==typeof th?a=th:Mi&&(a=function(a){return a?Wi(th)(a):""})),a}function bb(a){var b;return"y"===a?b=Kh:"y2"===a?b=Th:"x"===a&&(b=Fh),b}function cb(a){var b=bb(a);return"string"==typeof b?b:b?b.text:null}function db(a,b){var c=bb(a);"string"==typeof c?"y"===a?Kh=b:"y2"===a?Th=b:"x"===a&&(Fh=b):c&&(c.text=b)}function eb(a){return 10*Math.sin(Math.PI*(a/180))}function fb(a){return 11.5-2.5*(a/15)}function gb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",fb(c)).attr("x",eb(c)).attr("transform","rotate("+c+")")}function hb(a,b){var c=bb(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 ib(){return hb("x",nh?"inner-top":"inner-right")}function jb(){return hb("y",nh?"inner-right":"inner-top")}function kb(){return hb("y2",nh?"inner-right":"inner-top")}function lb(a){return"y2"===a?kb():"y"===a?jb():ib()}function mb(){return cb("x")}function nb(){return cb("y")}function ob(){return cb("y2")}function pb(a,b){return a?b.isLeft?0:b.isCenter?ag/2:ag:b.isBottom?-cg:b.isMiddle?-cg/2:0}function qb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function rb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function sb(){return pb(!nh,ib())}function tb(){return pb(nh,jb())}function ub(){return pb(nh,kb())}function vb(){return qb(!nh,ib())}function wb(){return qb(nh,jb())}function xb(){return qb(nh,kb())}function yb(){var a=ib();return nh?a.isInner?"1.2em":-25-Eb("x"):a.isInner?"-0.5em":Dh?Dh-10:"3em"}function zb(){var a=jb();return nh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Eb("y")}function Ab(){var a=kb();return nh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Eb("y2")}function Bb(){return rb(!nh,ib())}function Cb(){return rb(nh,jb())}function Db(){return rb(nh,kb())}function Eb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Hf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Fb(a){var b=sj.select("."+g.axisX+" ."+g.axisXLabel),c=sj.select("."+g.axisY+" ."+g.axisYLabel),d=sj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb),(a?c.transition():c).attr("x",tb).attr("dx",wb).attr("dy",zb).attr("dy",zb).text(nb),(a?d.transition():d).attr("x",ub).attr("dx",xb).attr("dy",Ab).text(ob)}function Gb(a){var b=!1;return mg(Jc(If.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Hb(){var a=Hf.svg.arc().outerRadius(gg).innerRadius(ig),b=function(b,c){var d;return c?a(b):(d=Gb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Ib(a){var b=Hf.svg.arc().outerRadius(hg*(a?a:1)).innerRadius(ig);return function(a){var c=Gb(a);return c?b(c):"M 0 0"}}function Jb(a,b){return qe(a.data)?jg(a,b):"M 0 0"}function Kb(a){var b,c,d,e,f=Gb(a),g="";return f&&(b=jg.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*gg*.8+","+d/e*gg*.8+")"),g}function Lb(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Mb(a){return qc({id:a.data.id,value:a.value,ratio:Lb(a)})}function Nb(a){var b,c,d,e;return Qb()?(b=Gb(a),c=b?b.value:null,d=Lb(b),e=Rb(),e?e(c,d):Ed(c,d)):""}function Ob(a,b){var c=qj.selectAll("."+g.chartArc+qd(a)),d=qj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});we(a)&&c.selectAll("path").transition().duration(50).attr("d",kg).transition().duration(100).attr("d",lg).each(function(a){pe(a.data)}),b||d.style("opacity",.3)}function Pb(a){var b=qj.selectAll("."+g.chartArc+qd(a));b.selectAll("path").transition().duration(50).attr("d",jg),qj.selectAll("."+g.arc).style("opacity",1)}function Qb(){return ie(If.data.targets)?ri:li}function Rb(){return ie(If.data.targets)?si:mi}function Sb(){return ie(If.data.targets)?ui:""}function Tb(){var a=ie(If.data.targets)?vi:oi;return"function"==typeof a?a:function(){}}function Ub(){var a=ie(If.data.targets)?wi:pi;return"function"==typeof a?a:function(){}}function Vb(){var a=ie(If.data.targets)?xi:qi;return"function"==typeof a?a:function(){}}function Wb(a){var b,c,d,e,f,g,h=Dc(a),i=Qc(a);if(Lg.length>0)for(g=Sc(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 Hf.min(Object.keys(i).map(function(a){return Hf.min(i[a])}))}function Xb(a){var b,c,d,e,f,g,h=Dc(a),i=Qc(a);if(Lg.length>0)for(g=Tc(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 Hf.max(Object.keys(i).map(function(a){return Hf.max(i[a])}))}function Yb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return _(a.id)===c}),m="y2"===c?Rh:Ih,n="y2"===c?Qh:Hh,o=b(m)?m:Wb(l),p=b(n)?n:Xb(l),q="y2"===c?Sh:Jh,r=yd()&&nh;return 0===l.length?"y2"===c?xg.domain():wg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=zd(o,p),j=bc(wg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Nh&&(f=b(Nh.top)?Nh.top:e,g=b(Nh.bottom)?Nh.bottom:e),"y2"===c&&Wh&&(f=b(Wh.top)?Wh.top:e,g=b(Wh.bottom)?Wh.bottom:e),fe(l)&&!Sc(l)&&(g=o),[o-g,p+f])}function Zb(a){return Bh?Mi?ye(Bh):Bh:Hf.min(a,function(a){return Hf.min(a.values,function(a){return a.x})})}function $b(a){return Ah?Mi?ye(Ah):Ah:Hf.max(a,function(a){return Hf.max(a.values,function(a){return a.x})})}function _b(a){var c,d,e,f,g=Cc(a),h=g[1]-g[0];return Ni?d=0:fe(a)?(c=Ac(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Ch&&De(Ch)?(e=b(Ch.left)?Ch.left:d,f=b(Ch.right)?Ch.right:d):e=f="number"==typeof Ch?Ch:d,{left:e,right:f}}function ac(a){var b=[Zb(a),$b(a)],c=b[0],d=b[1],e=_b(a),f=0,g=0;return c-d!==0||Ni||(c=Mi?new Date(.5*c.getTime()):-.5,d=Mi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Mi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Mi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function bc(a){return a[1]-a[0]}function cc(a){for(var b=0;bb?0:b-c}function ic(a){var b,c=gc(a),d="y"===a.axis?wg:xg;return b="y"===a.axis||"y2"===a.axis?nh?cg:"start"in a?d(a.start):cg:nh?"end"in a?vg(Mi?ye(a.end):a.end):cg:cg,c>b?0:b-c}function jc(a){return Fg&&a===Fg||De(Gg)&&Ee(Gg,a)}function kc(a){return!jc(a)}function lc(a){return Fg?Fg:De(Gg)?Gg[a]:null}function mc(a,b){var c,d=b&&De(b)?Dc(b):[];return d.forEach(function(b){lc(b)===a&&(c=If.data.xs[b])}),c}function nc(a,b){return a in If.data.xs&&If.data.xs[a]&&If.data.xs[a][b]?If.data.xs[a][b]:b}function oc(a){Object.keys(a).forEach(function(b){Gg[b]=a[b]})}function pc(a){return 1===Hf.set(Object.keys(a).map(function(b){return a[b]})).size()}function qc(a){var b;return a&&(b=Jg[a.id],a.name=b?b:a.id),a}function rc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=tc(b[d],a.id,d)}),If.data.xs[a.id]=b})}function sc(a,b){a.forEach(function(a){b[a.id]&&rc([a],b[a.id])})}function tc(a,c,d){var e;return e=Mi?a?a instanceof Date?a:ye(a):ye(nc(c,d)):Oi&&!Ni?b(a)?+a:nc(c,d):d}function uc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?If.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Fg?(d=Object.keys(If.data.xs),If.data.xs[c]=d.length>0?If.data.xs[d[0]]:void 0):De(Gg)&&(If.data.xs[c]=mc(f,If.data.targets)):If.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!If.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Ig(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=lc(b),g=a[f],h=tc(g,b,e);return Oi&&Ni&&0===c&&g&&(0===e&&(rh=[]),rh.push(g)),("undefined"==typeof a[b]||If.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ng&&de(Dc(c).filter(function(a){return!(a in Og)}),Ng),c.forEach(function(a){dc(a.id_org,a)}),c}function xc(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 yc(a){return a>0&&If.data.targets[0].values[a-1]?If.data.targets[0].values[a-1].x:void 0}function zc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Cc(a){var b,c,d=Bc(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Dc(a){return a.map(function(a){return a.id})}function Ec(a){return a?"string"==typeof a?[a]:a:Dc(If.data.targets)}function Fc(a,b){var c,d=Dc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Mi?new Date(i):i);j.push(e)}return Mi||(j=j.sort(function(a,b){return a-b})),j}function Mc(a){Yi=Yi.concat(a)}function Nc(a){Yi=Yi.filter(function(b){return a.indexOf(b)<0})}function Oc(a){Zi=Zi.concat(a)}function Pc(a){Zi=Zi.filter(function(b){return a.indexOf(b)<0})}function Qc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Rc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Tc(a){return Rc(a,function(a){return a>0})}function Uc(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||0===a[f].x)&&(e=e.concat(Kd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Kd(a,g))),Nd(e,b)):Ld(a,b,f,g)}function Md(a,b){var c;return c=a.map(function(a){return Ld(a.values,b)}),Nd(c,b)}function Nd(a,b){var c,d;return a.forEach(function(a){var e=Fe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Od(a,b){return Hf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Pd(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 Qd(){return Qg&&"desc"===Qg.toLowerCase()}function Rd(){return Qg&&"asc"===Qg.toLowerCase()}function Sd(a){var b=Rd(),c=Qd();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 Qg&&a.sort(Qg),a}function Td(a,c){var d,e,f,g,h,i,j,k=je(If.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&zi&&(vj.html(Ci(a,ab(),Ad(k),Vi)).style("display","block"),d=vj.property("offsetWidth"),e=vj.property("offsetHeight"),k?(g=ag/2+c[0],i=cg/2+c[1]+20):(nh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-w(),i=vg(l[0].x)+20):(f=s(),g=f+v()+vg(l[0].x)+20,h=g+d,j=f+t()-w(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),vj.style("top",i+"px").style("left",g+"px"))}function Ud(){vj.style("display","none")}function Vd(a){var c=a.filter(function(a){return a&&b(a.value)});if(zi&&!ge(If.data.targets)&&!je(If.data.targets)){var d=sj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(nh?"y1":"x1",Gd).attr(nh?"y2":"x2",Gd),lf(d,"grid")}}function Wd(){sj.select("line."+g.xgridFocus).style("visibility","hidden")}function Xd(a,b){var c,d,e,f,h=[],i=sj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=ac(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function Yd(a){return a.x||0===a.x?vg(a.x):null}function Zd(a){return X(a.id)(a.value)}function $d(){var a,b,d={},e=0;return Jc(Gc(me)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ce(a,b){return"number"==typeof ji?ji:b?2*a.tickOffset()*ki/b:0}function de(a,b){Ec(a).forEach(function(a){zj[a]=b===Og[a],Og[a]=b})}function ee(a,b){var c=!1;return a.forEach(function(a){Og[a.id]===b&&(c=!0),a.id in Og||"line"!==b||(c=!0)}),c}function fe(a){return ee(a,"bar")}function ge(a){return ee(a,"scatter")}function he(a){return ee(a,"pie")}function ie(a){return ee(a,"donut")}function je(a){return he(a)||ie(a)}function ke(a){var b="string"==typeof a?a:a.id;return!(b in Og)||"line"===Og[b]||"spline"===Og[b]||"area"===Og[b]||"area-spline"===Og[b]}function le(a){var b="string"==typeof a?a:a.id;return"spline"===Og[b]||"area-spline"===Og[b]}function me(a){var b="string"==typeof a?a:a.id;return"bar"===Og[b]}function ne(a){var b="string"==typeof a?a:a.id;return"scatter"===Og[b]}function oe(a){var b="string"==typeof a?a:a.id;return"pie"===Og[b]}function pe(a){var b="string"==typeof a?a:a.id;return"donut"===Og[b]}function qe(a){return oe(a)||pe(a)}function re(a){return ke(a)?[a]:[]}function se(a){return qe(a.data)?[a]:[]}function te(a){return me(a)?a.values:[]}function ue(a){return ke(a)||ne(a)?a.values:[]}function ve(a){return me(a)||ke(a)?a.values:[]}function we(a){return pe(a)&&ti||oe(a)&&ni}function xe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ye(b){var c;try{c=Hg?Hf.time.format(Hg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Hg)}return c}function ze(a,b){var c=Hf.mouse(a),d=Hf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ee(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Fe(a,b){var c="y"===_(a.id)?wg:xg,d=nh?1:0,e=nh?0:1;return Math.pow(vg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ge(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function He(a,b,c){ah(b,a.node()),sj.select("."+g.selectedCircles+pd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Vc(g.selectedCircle,c)}).attr("cx",nh?Zd:Yd).attr("cy",nh?Yd:Zd).attr("stroke",function(){return Vi(b)}).attr("r",1.4*Se(b)).transition().duration(100).attr("r",Se)}function Ie(a,b,c){bh(b,a.node()),sj.select("."+g.selectedCircles+pd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Je(a,b,c,d){a?He(b,c,d):Ie(b,c,d)}function Ke(a,b){ah(b,a.node()),a.transition().duration(100).style("fill",function(){return Hf.rgb(Vi(b)).brighter(.75)})}function Le(a,b){bh(b,a.node()),a.transition().duration(100).style("fill",function(){return Vi(b)})}function Me(a,b,c,d){a?Ke(b,c,d):Le(b,c,d)}function Ne(a,b,c,d){Me(a,b,c.data,d)}function Oe(a){return"circle"===a.nodeName?Je:Hf.select(a).classed(g.bar)?Me:Ne}function Pe(a){return a.filter(function(a){return b(a.value)})}function Qe(a){return ci?"function"==typeof di?di(a):di:0}function Re(a){return fi?gi?gi:1.75*Qe(a):Qe(a)}function Se(a){return hi?hi:4*Qe(a)}function Te(a,c){return(c?sj.selectAll("."+g.circles+pd(c)):sj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ue(a,b){Te(a,b).classed(g.EXPANDED,!0).attr("r",Re)}function Ve(a){Te(a).filter(function(){return Hf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Qe)}function We(a){return sj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function Xe(a){We(a).classed(g.EXPANDED,!0)}function Ye(a){We(a).classed(g.EXPANDED,!1)}function Ze(a,b){var c=bf(a,b);return function(a,b){var d=c(a,b),e=nh?1:0,f=nh?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 $e(a,b){var c=bf(a,!1),d=b?_e:af;return function(a,b){return d(c(a,b),a,this)}}function _e(a,b){var c;return nh?(c=me(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function af(a,b,c){var d=c.getBoundingClientRect();return nh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:me(b)?-3:-6)}function bf(a,b){var c=a.__max__+1,d=ce(Bg,c),e=_d(d,c,a,!!b),f=ae(!!b),g=be(a,!!b),h=b?Y:X;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return nh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function cf(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 df(b){var c,d,e;if(wj=Hf.select(Kf),wj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(wj.html("").classed("c3",!0),If.data.xs={},If.data.targets=wc(b),Ug&&Mc(Ug===!0?Dc(If.data.targets):Ug),p(),T(),vg.domain(Hf.extent(ac(If.data.targets))),wg.domain(Yb(If.data.targets,"y")),xg.domain(Yb(If.data.targets,"y2")),yg.domain(vg.domain()),zg.domain(wg.domain()),Ag.domain(xg.domain()),xj=vg.domain(),lj.scale(yg),Rf&&pj.scale(vg),qj=wj.append("svg").on("mouseenter",Uf).on("mouseleave",Vf),rj=qj.append("defs"),rj.append("clipPath").attr("id",Gi).append("rect"),rj.append("clipPath").attr("id",Hi).append("rect"),rj.append("clipPath").attr("id",Ii).append("rect"),qf(),sj=qj.append("g").attr("transform",cj.main),tj=qj.append("g").attr("transform",cj.context),uj=qj.append("g").attr("transform",cj.legend),eh||tj.style("visibility","hidden"),hh||(uj.style("visibility","hidden"),Zi=Dc(If.data.targets)),vj=Hf.select(Kf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Cf(Dc(If.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=sj.append("g").attr("clip-path",Ji).attr("class",g.grid),Yh&&d.append("g").attr("class",g.xgrids),De($h)&&d.append("g").attr("class",g.xgridLines),ei&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),_h&&d.append("g").attr("class",g.ygrids),De(ai)&&d.append("g").attr("class",g.ygridLines),sj.append("g").attr("clip-path",Ji).attr("class",g.regions),sj.append("g").attr("clip-path",Ji).attr("class",g.chart),c=sj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Rf?nh?"ns-resize":"ew-resize":null),sj.select("."+g.chart).append("g").attr("class",g.chartBars),sj.select("."+g.chart).append("g").attr("class",g.chartLines),sj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",cj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Sb()),sj.select("."+g.chart).append("g").attr("class",g.chartTexts),Rf&&sj.insert("rect",Tf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",ag).attr("height",cg).style("opacity",0).style("cursor",nh?"ns-resize":"ew-resize").call(pj).on("dblclick.zoom",null),Eh&&lj.extent("function"!=typeof Eh?Eh:Eh(ac())),oh&&sj.append("g").attr("class",g.axisX).attr("clip-path",Ki).attr("transform",cj.x).append("text").attr("class",g.axisXLabel).attr("transform",nh?"rotate(-90)":"").style("text-anchor",Bb),Gh&&sj.append("g").attr("class",g.axisY).attr("clip-path",Li).attr("transform",cj.y).append("text").attr("class",g.axisYLabel).attr("transform",nh?"":"rotate(-90)").style("text-anchor",Cb),Ph&&sj.append("g").attr("class",g.axisY2).attr("transform",cj.y2).append("text").attr("class",g.axisY2Label).attr("transform",nh?"":"rotate(-90)").style("text-anchor",Db),tj.append("g").attr("clip-path",Ji).attr("class",g.chart),tj.select("."+g.chart).append("g").attr("class",g.chartBars),tj.select("."+g.chart).append("g").attr("class",g.chartLines),tj.append("g").attr("clip-path",Ji).attr("class",g.brush).call(lj).selectAll("rect").attr(nh?"width":"height",nh?bg:dg),tj.append("g").attr("class",g.axisX).attr("transform",cj.subx).attr("clip-path",nh?"":Ki),sf(If.data.targets),nh?sj.select("."+g.axisX).style("opacity",0).call(Bg):(sj.select("."+g.axisY).style("opacity",0).call(Cg),sj.select("."+g.axisY2).style("opacity",0).call(Dg)),p(),T(),qf(),o(!1),mf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Di){if(Mi&&"string"==typeof Ei){for(Ei=ye(Ei),e=0;e0){d=[];for(var f in Jg)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Pd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Me,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function jf(a){je(If.data.targets)||Vg&&(Pi=a,sj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Qi=!0,ch())}function kf(){je(If.data.targets)||Vg&&(sj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),sj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Qi=!1,dh())}function lf(a,b){"grid"===b&&a.each(function(){var a=Hf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function mf(a){var c,e,f,h,i,j,k,l,m,n,o,p,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,O,P,Q,R,S,T,U,V,W,X,Y,Z,$,_=$d(),ab=je(If.data.targets),bb=Jc(If.data.targets);if(a=d(a)?a:{},G=d(a.withY)?a.withY:!0,H=d(a.withSubchart)?a.withSubchart:!0,I=d(a.withTransition)?a.withTransition:!0,L=d(a.withTransform)?a.withTransform:!1,M=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,O=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,P=d(a.withLegend)?a.withLegend:!1,J=d(a.withTransitionForExit)?a.withTransitionForExit:I,K=d(a.withTransitionForAxis)?a.withTransitionForAxis:I,V=I?Yf:0,W=J?V:0,X=K?V:0,c=sj.select("."+g.axisX).style("opacity",ab?0:1),f=sj.select("."+g.axisY).style("opacity",ab?0:1),h=sj.select("."+g.axisY2).style("opacity",ab?0:1),e=tj.select("."+g.axisX).style("opacity",ab?0:1),U={axisX:c.transition().duration(X),axisY:f.transition().duration(X),axisY2:h.transition().duration(X),axisSubX:e.transition().duration(X)},P&&hh&&Cf(Dc(If.data.targets),a,U),Ni&&0===bb.length&&vg.domain([0,c.selectAll(".tick").size()]),bb.length&&(O&&(vg.domain(Hf.extent(ac(bb))),xj=vg.domain(),Rf&&pj.scale(vg).updateScaleExtent(),yg.domain(vg.domain()),lj.scale(yg)),M&&(vg.domain(lj.empty()?xj:lj.extent()),Rf&&pj.scale(vg).updateScaleExtent()),yh||!xh&&!wh||(Y=Lc(Kc(bb),wh),Bg.tickValues(Y),Eg.tickValues(Y))),wg.domain(Yb(bb,"y")),xg.domain(Yb(bb,"y2")),U.axisX.call(Bg),U.axisY.call(Cg),U.axisY2.call(Dg),U.axisSubX.call(Eg),Fb(I),M&&bb.length)if(uh&&Y){for(Z=1;Z=0&&Hf.select(this).style("display",b%$?"none":"block")})}else qj.selectAll("."+g.axisX+" .tick text").style("display","block");!nh&&zh&&gb(c,U.axisX,zh),Q=Ze(_),S=$e(_,!0),T=$e(_,!1),zg.domain(wg.domain()),Ag.domain(xg.domain()),vj.style("display","none"),q(),sj.select("line."+g.xgridFocus).style("visibility","hidden"),Yh&&(k=Xd(Zh,vg),D=Ni?Bg.tickOffset():0,j=nh?{x1:0,x2:ag,y1:function(a){return vg(a)-D},y2:function(a){return vg(a)-D}}:{x1:function(a){return vg(a)+D},x2:function(a){return vg(a)+D},y1:Zf.top,y2:cg},i=sj.select("."+g.xgrids).selectAll("."+g.xgrid).data(k),i.enter().append("line").attr("class",g.xgrid),i.attr(j).style("opacity",function(){return+Hf.select(this).attr(nh?"y1":"x1")===(nh?cg:0)?0:1}),i.exit().remove()),De($h)&&(l=sj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data($h),m=l.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",nh?"":"rotate(-90)").attr("dx",nh?0:-Zf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(V).attr("x1",nh?0:Hd).attr("x2",nh?ag:Hd).attr("y1",nh?Hd:Zf.top).attr("y2",nh?Hd:cg).style("opacity",1),l.select("text").transition().duration(V).attr("x",nh?ag:0).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(V).style("opacity",0).remove()),G&&_h&&(n=sj.select("."+g.ygrids).selectAll("."+g.ygrid).data(wg.ticks(bi)),n.enter().append("line").attr("class",g.ygrid),n.attr("x1",nh?wg:0).attr("x2",nh?wg:ag).attr("y1",nh?0:wg).attr("y2",nh?cg:wg),n.exit().remove(),lf(n,"grid")),G&&De(ai)&&(o=sj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(ai),p=o.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",nh?"rotate(-90)":"").attr("dx",nh?0:-Zf.top).attr("dy",-5).style("opacity",0),o.select("line").transition().duration(V).attr("x1",nh?Id:0).attr("x2",nh?Id:ag).attr("y1",nh?0:Id).attr("y2",nh?cg:Id).style("opacity",1),o.select("text").transition().duration(V).attr("x",nh?0:ag).attr("y",Id).text(function(a){return a.text}).style("opacity",1),o.exit().transition().duration(V).style("opacity",0).remove()),w=sj.select("."+g.regions).selectAll("."+g.region).data(yi),w.enter().append("g").attr("class",id).append("rect").style("fill-opacity",0),w.selectAll("rect").transition().duration(V).attr("x",fc).attr("y",gc).attr("width",hc).attr("height",ic).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),w.exit().transition().duration(V).style("fill-opacity",0).remove(),u=sj.selectAll("."+g.bars).selectAll("."+g.bar).data(te),u.enter().append("path").attr("class",cd).style("stroke","none").style("fill",Vi),u.style("opacity",ud).transition().duration(V).attr("d",Q).style("fill",Vi).style("opacity",1),u.exit().transition().duration(W).style("opacity",0).remove(),r=sj.selectAll("."+g.lines).selectAll("."+g.line).data(re),r.enter().append("path").attr("class",$c).style("stroke",Vi),r.style("opacity",ud).transition().duration(V).attr("d",mj).style("stroke",Vi).style("opacity",1),r.exit().transition().duration(W).style("opacity",0).remove(),s=sj.selectAll("."+g.areas).selectAll("."+g.area).data(re),s.enter().append("path").attr("class",gd).style("fill",Vi).style("opacity",function(){return yj=+Hf.select(this).style("opacity"),0}),s.style("opacity",0).transition().duration(V).attr("d",nj).style("fill",Vi).style("opacity",yj),s.exit().transition().duration(W).style("opacity",0).remove(),t=sj.selectAll("."+g.circles).selectAll("."+g.circle).data(ue),t.enter().append("circle").attr("class",ad).attr("r",Qe).style("fill",Vi),t.style("opacity",ud).transition().duration(V).style("opacity",wd).style("fill",Vi).attr("cx",nh?Zd:Yd).attr("cy",nh?Yd:Zd),t.exit().remove(),x=sj.selectAll("."+g.texts).selectAll("."+g.text).data(ve),x.enter().append("text").attr("class",Wc).attr("text-anchor",function(a){return nh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",Vi).style("fill-opacity",0),x.text(function(a){return Fd(a.id)(a.value,a.id)}).style("fill-opacity",vd).transition().duration(V).attr("x",S).attr("y",T).style("fill",Vi).style("fill-opacity",xd),x.exit().transition().duration(W).style("fill-opacity",0).remove(),v=sj.selectAll("."+g.arcs).selectAll("."+g.arc).data(se),v.enter().append("path").attr("class",ed).style("fill",function(a){return Vi(a.data)}).style("cursor",function(a){return Xg(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Ti||(c=Gb(a),d=Mb(c),e=Ub(),Ob(c.data.id),yf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Gb(a),c=Mb(b),d=[c];Td(d,Hf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Ti||(c=Gb(a),d=Mb(c),e=Vb(),Pb(c.data.id),zf(),Ud(),e(d,b))}).on("click",function(a,b){var c=Gb(a),d=Mb(c),e=Tb();gf(this,a,b),e(d,b)}),v.attr("transform",L?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Ti=!0}).transition().duration(V).attrTween("d",function(a){var b,c=Gb(a);return c?(b=Hf.interpolate(this._current,c),this._current=b(0),function(a){return Jb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",L?"scale(1)":"").style("fill",function(a){return Vi(a.data)}).style("opacity",1).call(Ge,function(){Ti=!1}),v.exit().transition().duration(W).style("opacity",0).remove(),sj.selectAll("."+g.chartArc).select("text").attr("transform",Kb).style("opacity",0).transition().duration(V).text(Nb).style("opacity",function(a){return Hc(a.data.id)&&qe(a.data)?1:0}),sj.select("."+g.chartArcsTitle).style("opacity",ie(If.data.targets)?1:0),eh&&(Hf.event&&"zoom"===Hf.event.type&&lj.extent(vg.orgDomain()).update(),H&&(!nh&&zh&&gb(e,U.axisSubX,zh),lj.empty()||lj.extent(vg.orgDomain()).update(),R=Ze(_,!0),z=tj.selectAll("."+g.bars).selectAll("."+g.bar).data(te),z.enter().append("path").attr("class",cd).style("stroke","none").style("fill",Vi),z.style("opacity",ud).transition().duration(V).attr("d",R).style("opacity",1),z.exit().transition().duration(V).style("opacity",0).remove(),y=tj.selectAll("."+g.lines).selectAll("."+g.line).data(re),y.enter().append("path").attr("class",$c).style("stroke",Vi),y.style("opacity",ud).transition().duration(V).attr("d",oj).style("opacity",1),y.exit().transition().duration(V).style("opacity",0).remove())),sj.selectAll("."+g.selectedCircles).filter(function(a){return me(a)}).selectAll("circle").remove(),sj.selectAll("."+g.selectedCircle).transition().duration(V).attr("cx",nh?Zd:Yd).attr("cy",nh?Yd:Zd),A=sj.select("."+g.eventRects),De(Gg)&&!pc(Gg)?(A.classed(g.eventRectsMultiple)||A.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),B=sj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),ff(B.enter()),B.attr("x",0).attr("y",0).attr("width",ag).attr("height",cg)):(A.classed(g.eventRectsSingle)||A.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Oi&&!Ni?(F=function(a,b){var c=yc(b),d=zc(b),e=If.data.xs[a.id][b];return(vg(d?d:e+50)-vg(c?c:e-50))/2},E=function(a,b){var c=yc(b),d=If.data.xs[a.id][b];return(vg(d)+vg(c?c:d-50))/2}):(F=N(),E=function(a){return vg(a.x)-F/2}),C=Bc(If.data.targets),sj.select("."+g.eventRects).datum(C?C.values:[]),B=sj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),ef(B.enter()),B.attr("class",jd).attr("x",nh?0:E).attr("y",nh?E:0).attr("width",nh?ag:F).attr("height",nh?F:cg),B.exit().remove()),Dc(If.data.targets).forEach(function(a){zj[a]=!0})}function nf(){mf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function of(){if(0!==Jc(If.data.targets).length){if("mousemove"===Hf.event.sourceEvent.type&&pj.altDomain)return vg.domain(pj.altDomain),void pj.scale(vg).updateScaleExtent();Ni&&vg.orgDomain()[0]===xj[0]&&vg.domain([xj[0]-1e-10,vg.orgDomain()[1]]),mf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Hf.event.sourceEvent.type&&(Ri=!0)}}function pf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function qf(){qj.attr("width",eg).attr("height",fg),qj.select("#"+Gi).select("rect").attr("width",ag).attr("height",cg),qj.select("#"+Hi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),qj.select("#"+Ii).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),qj.select("."+g.zoomRect).attr("width",ag).attr("height",cg),wj.style("max-height",fg+"px")}function rf(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,p(),T(),qf(),o(a.withTransition),mf(a)}function sf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=sj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",ld),j=i.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Xc),e=sj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",nd),d=e.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",dd).style("cursor",function(a){return Xg(a)?"pointer":null}),c=sj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",md),b=c.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",_c),b.append("g").attr("class",hd),b.append("g").attr("class",function(a){return Vc(g.selectedCircles,a.id)}),b.append("g").attr("class",bd).style("cursor",function(a){return Xg(a)?"pointer":null}),a.forEach(function(a){sj.selectAll("."+g.selectedCircles+pd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=sj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(mg(a)).attr("class",od),f=h.enter().append("g").attr("class",od),f.append("g").attr("class",fd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),eh&&(n=tj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",nd),m=n.enter().append("g").style("opacity",0).attr("class",nd),m.append("g").attr("class",dd),l=tj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",md),k=l.enter().append("g").style("opacity",0).attr("class",md),k.append("g").attr("class",_c)),qj.selectAll("."+g.target).filter(function(a){return Hc(a.id)}).transition().duration(Yf).style("opacity",1)}function tf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?de(a.id,b.types[a.id]):de(a.id,b.type)}),If.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=dj?j:i,l=dj?S():R();return d&&(w=0,C=0,t=0,u=0),hh&&!Ic(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=dj?u:t,void(mh?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=uj.selectAll("."+g.legendItemFocused).size();b=b||{},n=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,dj?(f=function(a){return t*B[a]},j=function(a){return A[B[a]]+x[a]}):(f=function(a){return A[B[a]]+x[a]},j=function(a){return u*B[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=uj.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Vc(g.legendItem,a)}).style("visibility",function(a){return Ic(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof jh?jh(a):If.toggle(a)}).on("mouseover",function(a){Hf.select(this).classed(g.legendItemFocused,!0),Ti||If.focus(a),"function"==typeof kh&&kh(a)}).on("mouseout",function(a){Hf.select(this).classed(g.legendItemFocused,!1),Ti||If.revert(),"function"==typeof lh&&lh(a)}),m.append("text").text(function(a){return d(Jg[a])?Jg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",dj?h:-200).attr("y",dj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",dj?i:-200).attr("y",dj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",Vi).attr("x",dj?h:-200).attr("y",dj?-200:j).attr("width",10).attr("height",10),uj.selectAll("text").data(a).text(function(a){return d(Jg[a])?Jg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(n?250:0).attr("x",h).attr("y",k),uj.selectAll("rect."+g.legendItemEvent).data(a).transition().duration(n?250:0).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}).attr("x",i).attr("y",l),uj.selectAll("rect."+g.legendItemTile).data(a).transition().duration(n?250:0).style("fill",Vi).attr("x",f).attr("y",j),uj.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Hc(a)}).transition().style("opacity",function(a){var b=Hf.select(this);return Hc(a)?!D||b.classed(g.legendItemFocused)?wf(b):xf(b):hj}),P(t),Q(u),O(C),p(),T(),qf(),o(q,c)}function Df(a){return Fc(If.data.targets,a.id)}function Ef(a){return"data"in a&&Fc(If.data.targets,a.data.id)}function Ff(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 Gf(a,b,c){var d=!je(If.data.targets);Ti=!1,de(a,b),rf(c||{withTransitionForAxis:d})}var Hf=a.d3?a.d3:a.require?a.require("d3"):void 0,If={data:{},axis:{},legend:{}},Jf={},Kf=i(["bindto"],"#chart"),Lf=i(["size","width"]),Mf=i(["size","height"]),Nf=i(["padding","left"],50),Of=i(["padding","right"],0),Pf=i(["padding","top"],0),Qf=i(["padding","bottom"],0),Rf=i(["zoom","enabled"],!1),Sf=i(["zoom","extent"]),Tf=i(["zoom","privileged"],!1),Uf=i(["onenter"],function(){}),Vf=i(["onleave"],function(){}),Wf=i(["onresize"],function(){}),Xf=i(["onresized"],function(){}),Yf=i(["transition","duration"],350);h("data","data is required in config");var Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg=i(["data","x"]),Gg=i(["data","xs"],{}),Hg=i(["data","x_format"]),Ig=i(["data","id_converter"],function(a){return a}),Jg=i(["data","names"],{}),Kg=i(["data","classes"],{}),Lg=i(["data","groups"],[]),Mg=i(["data","axes"],{}),Ng=i(["data","type"]),Og=i(["data","types"],{}),Pg=i(["data","labels"],{}),Qg=i(["data","order"]),Rg=i(["data","regions"],{}),Sg=i(["data","color"]),Tg=i(["data","colors"],{}),Ug=i(["data","hide"],!1),Vg=i(["data","selection","enabled"],!1),Wg=i(["data","selection","grouped"],!1),Xg=i(["data","selection","isselectable"],function(){return!0}),Yg=i(["data","selection","multiple"],!0),Zg=i(["data","onclick"],function(){}),$g=i(["data","onenter"],function(){}),_g=i(["data","onleave"],function(){}),ah=i(["data","onselected"],function(){}),bh=i(["data","onunselected"],function(){}),ch=i(["data","ondragstart"],function(){}),dh=i(["data","ondragend"],function(){}),eh=i(["subchart","show"],!1),fh=i(["subchart","size","height"],60),gh=i(["color","pattern"],[]),hh=i(["legend","show"],!0),ih=i(["legend","position"],"bottom"),jh=i(["legend","item","onclick"]),kh=i(["legend","item","onmouseover"]),lh=i(["legend","item","onmouseout"]),mh=i(["legend","equally"],!1),nh=i(["axis","rotated"],!1),oh=i(["axis","x","show"],!0),ph=i(["axis","x","type"],"indexed"),qh=i(["axis","x","localtime"],!0),rh=i(["axis","x","categories"],[]),sh=i(["axis","x","tick","centered"],!1),th=i(["axis","x","tick","format"]),uh=i(["axis","x","tick","culling"],{}),vh=i(["axis","x","tick","culling","max"],10),wh=i(["axis","x","tick","count"]),xh=i(["axis","x","tick","fit"],!0),yh=i(["axis","x","tick","values"],null),zh=i(["axis","x","tick","rotate"]),Ah=i(["axis","x","max"],null),Bh=i(["axis","x","min"],null),Ch=i(["axis","x","padding"],{}),Dh=i(["axis","x","height"]),Eh=i(["axis","x","default"]),Fh=i(["axis","x","label"],{}),Gh=i(["axis","y","show"],!0),Hh=i(["axis","y","max"]),Ih=i(["axis","y","min"]),Jh=i(["axis","y","center"]),Kh=i(["axis","y","label"],{}),Lh=i(["axis","y","inner"],!1),Mh=i(["axis","y","tick","format"]),Nh=i(["axis","y","padding"]),Oh=i(["axis","y","ticks"],10),Ph=i(["axis","y2","show"],!1),Qh=i(["axis","y2","max"]),Rh=i(["axis","y2","min"]),Sh=i(["axis","y2","center"]),Th=i(["axis","y2","label"],{}),Uh=i(["axis","y2","inner"],!1),Vh=i(["axis","y2","tick","format"]),Wh=i(["axis","y2","padding"]),Xh=i(["axis","y2","ticks"],10),Yh=i(["grid","x","show"],!1),Zh=i(["grid","x","type"],"tick"),$h=i(["grid","x","lines"],[]),_h=i(["grid","y","show"],!1),ai=i(["grid","y","lines"],[]),bi=i(["grid","y","ticks"],10),ci=i(["point","show"],!0),di=i(["point","r"],2.5),ei=i(["point","focus","line","enabled"],!0),fi=i(["point","focus","expand","enabled"],!0),gi=i(["point","focus","expand","r"]),hi=i(["point","focus","select","r"]),ii=i(["line","connect_null"],!1),ji=i(["bar","width"]),ki=i(["bar","width","ratio"],.6),li=i(["pie","label","show"],!0),mi=i(["pie","label","format"]),ni=i(["pie","expand"],!0),oi=i(["pie","onclick"],function(){}),pi=i(["pie","onmouseover"],function(){}),qi=i(["pie","onmouseout"],function(){}),ri=i(["donut","label","show"],!0),si=i(["donut","label","format"]),ti=i(["donut","expand"],!0),ui=i(["donut","title"],""),vi=i(["donut","onclick"],function(){}),wi=i(["donut","onmouseover"],function(){}),xi=i(["donut","onmouseout"],function(){}),yi=i(["regions"],[]),zi=i(["tooltip","show"],!0),Ai=i(["tooltip","format","title"]),Bi=i(["tooltip","format","value"]),Ci=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Ai?Ai:b,l=Bi?Bi:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Di=i(["tooltip","init","show"],!1),Ei=i(["tooltip","init","x"],0),Fi=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Gi=("string"==typeof Kf?Kf.replace("#",""):Kf.id)+"-clip",Hi=Gi+"-xaxis",Ii=Gi+"-yaxis",Ji=j(Gi),Ki=j(Hi),Li=j(Ii),Mi="timeseries"===ph,Ni="categorized"===ph,Oi=!Mi&&(Fg||De(Gg)),Pi=null,Qi=!1,Ri=!1,Si=!1,Ti=!1,Ui=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Vi=xe(Tg,De(gh)?gh:Ui,Sg),Wi=qh?Hf.time.format:Hf.time.format.utc,Xi=function(){var a=[[Wi("%Y/%-m/%-d"),function(){return!0}],[Wi("%-m/%-d"),function(a){return a.getMonth()}],[Wi("%-m/%-d"),function(a){return 1!==a.getDate()}],[Wi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Wi("%I %p"),function(a){return a.getHours()}],[Wi("%I:%M"),function(a){return a.getMinutes()}],[Wi(":%S"),function(a){return a.getSeconds()}],[Wi(".%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)}}(),Yi=[],Zi=[],$i=nh?"left":"bottom",_i=nh?Lh?"top":"bottom":Lh?"right":"left",aj=nh?Uh?"bottom":"top":Uh?"left":"right",bj=nh?"left":"bottom",cj={main:function(){return"translate("+k(Zf.left)+","+k(Zf.top)+")"},context:function(){return"translate("+k($f.left)+","+k($f.top)+")"},legend:function(){return"translate("+_f.left+","+_f.top+")"},x:function(){return"translate(0,"+(nh?0:cg)+")"},y:function(){return"translate(0,"+(nh?cg:0)+")"},y2:function(){return"translate("+(nh?0:ag)+","+(nh?1:0)+")"},subx:function(){return"translate(0,"+(nh?0:dg)+")"},arc:function(){return"translate("+ag/2+","+cg/2+")" -}},dj="right"===ih,ej=0,fj=0,gj=0,hj=.15,ij=30,jj=nh&&!oh?0:30,kj=5;mg=Hf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var lj,mj=function(){var a=Hf.svg.line().x(nh?function(a){return X(a.id)(a.value)}:Gd).y(nh?Gd:function(a){return X(a.id)(a.value)});return ii||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ii?Pe(b.values):b.values;return ke(b)?(a.interpolate(le(b)?"cardinal":"linear"),Rg[b.id]?cf(e,vg,X(b.id),Rg[b.id]):a(e)):(c=e[0]?vg(e[0].x):0,d=e[0]?X(b.id)(e[0].value):0,nh?"M "+d+" "+c:"M "+c+" "+d)}}(),nj=function(){var a;return a=nh?Hf.svg.area().x0(function(a){return X(a.id)(0)}).x1(function(a){return X(a.id)(a.value)}).y(Gd):Hf.svg.area().x(Gd).y0(function(a){return X(a.id)(0)}).y1(function(a){return X(a.id)(a.value)}),function(b){var c,d,e=Pe(b.values);return ee([b],"area")||ee([b],"area-spline")?(a.interpolate(le(b)?"cardinal":"linear"),a(e)):(c=e[0]?vg(e[0].x):0,d=e[0]?X(b.id)(e[0].value):0,nh?"M "+d+" "+c:"M "+c+" "+d)}}(),oj=function(){var a=Hf.svg.line().x(nh?function(a){return Y(a.id)(a.value)}:Jd).y(nh?Jd:function(a){return Y(a.id)(a.value)});return function(b){var c=Pe(b.values);return ke(b)?a(c):"M "+yg(c[0].x)+" "+Y(b.id)(c[0].value)}}(),pj=function(){};lj=Hf.svg.brush().on("brush",nf),lj.update=function(){return tj&&tj.select("."+g.brush).call(this),this},lj.scale=function(a){return nh?this.y(a):this.x(a)},Rf&&(pj=Hf.behavior.zoom().on("zoomstart",function(){pj.altDomain=Hf.event.sourceEvent.altKey?vg.orgDomain():null}).on("zoom",Rf?of:null),pj.scale=function(a){return nh?this.y(a):this.x(a)},pj.orgScaleExtent=function(){var a=Sf?Sf:[1,10];return[a[0],Math.max(Ac()/a[1],a[1])]},pj.updateScaleExtent=function(){var a=bc(vg.orgDomain())/bc(xj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var qj,rj,sj,tj,uj,vj,wj,xj,yj,zj={};if(If.focus=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",1)}var c=qj.selectAll(qd(a)),d=c.filter(Df),e=c.filter(Ef);If.revert(),If.defocus(),b(d.classed(g.focused,!0)),b(e),je(If.data.targets)&&Ob(a,!0),yf(a,!0)},If.defocus=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",.3)}var c=qj.selectAll(qd(a)),d=c.filter(Df),e=c.filter(Ef);If.revert(),b(d.classed(g.focused,!1)),b(e),je(If.data.targets)&&Pb(a),yf(a,!1)},If.revert=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",1)}var c=qj.selectAll(qd(a)),d=c.filter(Df),e=c.filter(Ef);b(d.classed(g.focused,!1)),b(e),je(If.data.targets)&&Pb(a),zf()},If.show=function(a,b){a=Ec(a),b=b||{},Nc(a),qj.selectAll(rd(a)).transition().style("opacity",1),b.withLegend&&Af(a),mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},If.hide=function(a,b){a=Ec(a),b=b||{},Mc(a),qj.selectAll(rd(a)).transition().style("opacity",0),b.withLegend&&Bf(a),mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},If.toggle=function(a){Hc(a)?If.hide(a):If.show(a)},If.unzoom=function(){lj.clear().update(),mf({withUpdateXDomain:!0})},If.load=function(a){return a.xs&&oc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Kg[b]=a.classes[b]}),"categories"in a&&Ni&&(rh=a.categories,Bg.categories(rh)),"cacheIds"in a&&cc(a.cacheIds)?void tf(ec(a.cacheIds),a.done):void("unload"in a?vf(Ec("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){uf(a)}):uf(a))},If.unload=function(a,b){vf(Ec(a),function(){mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},If.selected=function(a){return Hf.merge(sj.selectAll("."+g.shapes+pd(a)).selectAll("."+g.shape).filter(function(){return Hf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},If.select=function(a,b,c){Vg&&sj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Hf.select(this),i=e.data?e.data.id:e.id,j=Oe(this),k=Wg||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);k&&l?Xg(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f)})},If.unselect=function(a,b){Vg&&sj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Hf.select(this),f=c.data?c.data.id:c.id,h=Oe(this),i=Wg||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);i&&j&&Xg(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},If.toLine=function(a){Gf(a,"line")},If.toSpline=function(a){Gf(a,"spline")},If.toBar=function(a){Gf(a,"bar")},If.toScatter=function(a){Gf(a,"scatter")},If.toArea=function(a){Gf(a,"area")},If.toAreaSpline=function(a){Gf(a,"area-spline")},If.toPie=function(a){Gf(a,"pie",{withTransform:!0})},If.toDonut=function(a){Gf(a,"donut",{withTransform:!0})},If.groups=function(a){return c(a)?Lg:(Lg=a,mf(),Lg)},If.xgrids=function(a){return a?($h=a,mf(),$h):$h},If.xgrids.add=function(a){return a?If.xgrids($h.concat(a)):void 0},If.xgrids.remove=function(a){var b=Ff(a);return If.xgrids($h.filter(b))},If.ygrids=function(a){return a?(ai=a,mf(),ai):ai},If.ygrids.add=function(a){return a?If.ygrids(ai.concat(a)):void 0},If.ygrids.remove=function(a){var b=Ff(a);return If.ygrids(ai.filter(b))},If.regions=function(a){return c(a)?yi:(yi=a,mf(),yi)},If.regions.add=function(a){return c(a)?yi:(yi=yi.concat(a),mf(),yi)},If.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;qj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),yi=yi.filter(function(b){return b.classes.indexOf(a)<0})}),yi},If.data.get=function(a){var b=If.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},If.data.getAsTarget=function(a){var b=Gc(function(b){return b.id===a});return b.length>0?b[0]:void 0},If.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Jg[b]=a[b]}),mf({withLegend:!0}),Jg):Jg},If.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Tg[b]=a[b]}),mf({withLegend:!0}),Tg):Tg},If.x=function(a){return arguments.length&&(rc(If.data.targets,a),mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),If.data.xs},If.xs=function(a){return arguments.length&&(sc(If.data.targets,a),mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),If.data.xs},If.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){db(b,a[b])}),Fb())},If.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Ah=+a.x),b(a.y)&&(Hh=+a.y),b(a.y2)&&(Qh=+a.y2)):Hh=Qh=+a,mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},If.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Bh=+a.x),b(a.y)&&(Ih=+a.y),b(a.y2)&&(Rh=+a.y2)):Ih=Rh=+a,mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},If.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&If.axis.max(a.max),"undefined"!=typeof a.min&&If.axis.min(a.min))},If.legend.show=function(a){Af(Ec(a)),mf({withLegend:!0})},If.legend.hide=function(a){Bf(Ec(a)),mf({withLegend:!0})},If.resize=function(a){Lf=a?a.width:null,Mf=a?a.height:null,rf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},If.destroy=function(){If.data.targets=void 0,If.data.xs={},wj.html(""),a.onresize=null},"url"in f.data)Hf.xhr(f.data.url,function(a,b){var c,d=Hf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Hf.csv.parse(b.response),df(c)});else if("rows"in f.data)df(uc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");df(vc(f.data.columns))}return If},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(window); \ No newline at end of file +}},dj="right"===ih,ej=0,fj=0,gj=0,hj=.15,ij=30,jj=nh&&!oh?0:30,kj=5;mg=Hf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var lj,mj=function(){var a=Hf.svg.line().x(nh?function(a){return X(a.id)(a.value)}:Gd).y(nh?Gd:function(a){return X(a.id)(a.value)});return ii||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ii?Pe(b.values):b.values;return ke(b)?(a.interpolate(le(b)?"cardinal":"linear"),Rg[b.id]?cf(e,vg,X(b.id),Rg[b.id]):a(e)):(c=e[0]?vg(e[0].x):0,d=e[0]?X(b.id)(e[0].value):0,nh?"M "+d+" "+c:"M "+c+" "+d)}}(),nj=function(){var a;return a=nh?Hf.svg.area().x0(function(a){return X(a.id)(0)}).x1(function(a){return X(a.id)(a.value)}).y(Gd):Hf.svg.area().x(Gd).y0(function(a){return X(a.id)(0)}).y1(function(a){return X(a.id)(a.value)}),function(b){var c,d,e=Pe(b.values);return ee([b],"area")||ee([b],"area-spline")?(a.interpolate(le(b)?"cardinal":"linear"),a(e)):(c=e[0]?vg(e[0].x):0,d=e[0]?X(b.id)(e[0].value):0,nh?"M "+d+" "+c:"M "+c+" "+d)}}(),oj=function(){var a=Hf.svg.line().x(nh?function(a){return Y(a.id)(a.value)}:Jd).y(nh?Jd:function(a){return Y(a.id)(a.value)});return function(b){var c=Pe(b.values);return ke(b)?a(c):"M "+yg(c[0].x)+" "+Y(b.id)(c[0].value)}}(),pj=function(){};lj=Hf.svg.brush().on("brush",nf),lj.update=function(){return tj&&tj.select("."+g.brush).call(this),this},lj.scale=function(a){return nh?this.y(a):this.x(a)},Rf&&(pj=Hf.behavior.zoom().on("zoomstart",function(){pj.altDomain=Hf.event.sourceEvent.altKey?vg.orgDomain():null}).on("zoom",Rf?of:null),pj.scale=function(a){return nh?this.y(a):this.x(a)},pj.orgScaleExtent=function(){var a=Sf?Sf:[1,10];return[a[0],Math.max(Ac()/a[1],a[1])]},pj.updateScaleExtent=function(){var a=bc(vg.orgDomain())/bc(xj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var qj,rj,sj,tj,uj,vj,wj,xj,yj,zj={};if(If.focus=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",1)}var c=qj.selectAll(qd(a)),d=c.filter(Df),e=c.filter(Ef);If.revert(),If.defocus(),b(d.classed(g.focused,!0)),b(e),je(If.data.targets)&&Ob(a,!0),yf(a,!0)},If.defocus=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",.3)}var c=qj.selectAll(qd(a)),d=c.filter(Df),e=c.filter(Ef);If.revert(),b(d.classed(g.focused,!1)),b(e),je(If.data.targets)&&Pb(a),yf(a,!1)},If.revert=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",1)}var c=qj.selectAll(qd(a)),d=c.filter(Df),e=c.filter(Ef);b(d.classed(g.focused,!1)),b(e),je(If.data.targets)&&Pb(a),zf()},If.show=function(a,b){a=Ec(a),b=b||{},Nc(a),qj.selectAll(rd(a)).transition().style("opacity",1),b.withLegend&&Af(a),mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},If.hide=function(a,b){a=Ec(a),b=b||{},Mc(a),qj.selectAll(rd(a)).transition().style("opacity",0),b.withLegend&&Bf(a),mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},If.toggle=function(a){Hc(a)?If.hide(a):If.show(a)},If.unzoom=function(){lj.clear().update(),mf({withUpdateXDomain:!0})},If.load=function(a){return a.xs&&oc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Kg[b]=a.classes[b]}),"categories"in a&&Ni&&(rh=a.categories,Bg.categories(rh)),"cacheIds"in a&&cc(a.cacheIds)?void tf(ec(a.cacheIds),a.done):void("unload"in a?vf(Ec("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){uf(a)}):uf(a))},If.unload=function(a,b){vf(Ec(a),function(){mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},If.selected=function(a){return Hf.merge(sj.selectAll("."+g.shapes+pd(a)).selectAll("."+g.shape).filter(function(){return Hf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},If.select=function(a,b,c){Vg&&sj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Hf.select(this),i=e.data?e.data.id:e.id,j=Oe(this),k=Wg||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);"path"!==this.nodeName&&(k&&l?Xg(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},If.unselect=function(a,b){Vg&&sj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Hf.select(this),f=c.data?c.data.id:c.id,h=Oe(this),i=Wg||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);"path"!==this.nodeName&&i&&j&&Xg(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},If.toLine=function(a){Gf(a,"line")},If.toSpline=function(a){Gf(a,"spline")},If.toBar=function(a){Gf(a,"bar")},If.toScatter=function(a){Gf(a,"scatter")},If.toArea=function(a){Gf(a,"area")},If.toAreaSpline=function(a){Gf(a,"area-spline")},If.toPie=function(a){Gf(a,"pie",{withTransform:!0})},If.toDonut=function(a){Gf(a,"donut",{withTransform:!0})},If.groups=function(a){return c(a)?Lg:(Lg=a,mf(),Lg)},If.xgrids=function(a){return a?($h=a,mf(),$h):$h},If.xgrids.add=function(a){return a?If.xgrids($h.concat(a)):void 0},If.xgrids.remove=function(a){var b=Ff(a);return If.xgrids($h.filter(b))},If.ygrids=function(a){return a?(ai=a,mf(),ai):ai},If.ygrids.add=function(a){return a?If.ygrids(ai.concat(a)):void 0},If.ygrids.remove=function(a){var b=Ff(a);return If.ygrids(ai.filter(b))},If.regions=function(a){return c(a)?yi:(yi=a,mf(),yi)},If.regions.add=function(a){return c(a)?yi:(yi=yi.concat(a),mf(),yi)},If.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;qj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),yi=yi.filter(function(b){return b.classes.indexOf(a)<0})}),yi},If.data.get=function(a){var b=If.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},If.data.getAsTarget=function(a){var b=Gc(function(b){return b.id===a});return b.length>0?b[0]:void 0},If.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Jg[b]=a[b]}),mf({withLegend:!0}),Jg):Jg},If.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Tg[b]=a[b]}),mf({withLegend:!0}),Tg):Tg},If.x=function(a){return arguments.length&&(rc(If.data.targets,a),mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),If.data.xs},If.xs=function(a){return arguments.length&&(sc(If.data.targets,a),mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),If.data.xs},If.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){db(b,a[b])}),Fb())},If.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Ah=+a.x),b(a.y)&&(Hh=+a.y),b(a.y2)&&(Qh=+a.y2)):Hh=Qh=+a,mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},If.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Bh=+a.x),b(a.y)&&(Ih=+a.y),b(a.y2)&&(Rh=+a.y2)):Ih=Rh=+a,mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},If.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&If.axis.max(a.max),"undefined"!=typeof a.min&&If.axis.min(a.min))},If.legend.show=function(a){Af(Ec(a)),mf({withLegend:!0})},If.legend.hide=function(a){Bf(Ec(a)),mf({withLegend:!0})},If.resize=function(a){Lf=a?a.width:null,Mf=a?a.height:null,rf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},If.destroy=function(){If.data.targets=void 0,If.data.xs={},wj.html(""),a.onresize=null},"url"in f.data)Hf.xhr(f.data.url,function(a,b){var c,d=Hf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Hf.csv.parse(b.response),df(c)});else if("rows"in f.data)df(uc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");df(vc(f.data.columns))}return If},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(window); \ No newline at end of file From 6d670cc7a0f9440e7a51a7430b71e4df717bbc55 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 7 May 2014 20:24:10 +0900 Subject: [PATCH 143/178] Fix horizontal axis clip - #211 --- c3.js | 6 ++++-- c3.min.js | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/c3.js b/c3.js index 5967ed1..c7f424b 100644 --- a/c3.js +++ b/c3.js @@ -543,7 +543,8 @@ return +d3.select(__bindto).style('height').replace('px', ''); // TODO: if rotated, use width } function getAxisClipX(forHorizontal) { - return forHorizontal ? -(1 + 4) : -(margin.left - 1); + // axis line width + padding for left + return forHorizontal ? -(1 + 30) : -(margin.left - 1); } function getAxisClipY(forHorizontal) { return forHorizontal ? -20 : -4; @@ -561,7 +562,8 @@ return getAxisClipY(__axis_rotated); } function getAxisClipWidth(forHorizontal) { - return forHorizontal ? width + 2 + 4 : margin.left + 20; + // width + axis line width + padding for left/right + return forHorizontal ? width + 2 + 30 + 30 : margin.left + 20; } function getAxisClipHeight(forHorizontal) { return forHorizontal ? (__axis_x_height ? __axis_x_height : 0) + 80 : height + 8; diff --git a/c3.min.js b/c3.min.js index 27dc876..217d99d 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.ceil(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.ceil(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&aag&&(ag=0),0>cg&&(cg=0),bg=nh?Zf.left-ij-jj:ag,dg=nh?cg:fg-$f.top-$f.bottom,0>bg&&(bg=0),0>dg&&(dg=0),r(),dj&&je(If.data.targets)&&(_f.left=ag/2+hg)}function q(){sj.select("line."+g.xgridFocus).attr("x1",nh?0:-10).attr("x2",nh?ag:-10).attr("y1",nh?-10:Zf.top).attr("y2",nh?-10:cg)}function r(){hg=cg/2,gg=.95*hg,ig=ie(If.data.targets)?.6*gg:0}function s(){var a=nh?g.axisX:g.axisY,b=sj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Hf.select(Kf).node().getBoundingClientRect(),e=c.right-d.left-v();return e>0?e:0}function t(){return Lf?Lf:z()}function u(){var a=Mf?Mf:A();return a>0?a:320}function v(){return je(If.data.targets)?0:Nf?Nf:nh?oh?x("x"):1:!Gh||Lh?1:x("y")}function w(){var a=1;return je(If.data.targets)?0:Of?Of:dj?R()+20+(Ph&&!nh?x("y2"):a):Ph?Uh||nh?a:x("y2"):a}function x(a){var b=lb(a);return b.isInner?20+Eb(a):40+Eb(a)}function y(a){return"x"!==a||oh?"x"===a&&Dh?Dh:"y"!==a||Gh?"y2"!==a||Ph?(lb(a).isInner?30:40)+("y2"===a?-10:0):kj:hh&&!dj?10:1:0}function z(){return+Hf.select(Kf).style("width").replace("px","")}function A(){return+Hf.select(Kf).style("height").replace("px","")}function B(a){return a?-5:-(Zf.left-1)}function C(a){return a?-20:-4}function D(){return B(!nh)}function E(){return C(!nh)}function F(){return B(nh)}function G(){return C(nh)}function H(a){return a?ag+2+4:Zf.left+20}function I(a){return a?(Dh?Dh:0)+80:cg+8}function J(){return H(!nh)}function K(){return I(!nh)}function L(){return H(nh)}function M(){return I(nh)}function N(){var a,b,c,d,e,f=Bc(If.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=vg(b.x)-vg(a.x),0===c?nh?cg:ag:(d=Ac(),e=fe(If.data.targets)?(d-(Ni?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function O(a){ej=a}function P(a){fj=a}function Q(a){gj=a}function R(){return hh?dj?fj*(ej+1):eg:0}function S(){return hh?dj?fg:gj*(ej+1):0}function T(){var a,b,c=!vg;ng=nh?1:0,og=nh?cg:ag,pg=nh?0:cg,qg=nh?ag:1,rg=ng,sg=og,tg=nh?0:dg,ug=nh?bg:1,vg=V(ng,og,c?void 0:vg.domain(),function(){return Bg.tickOffset()}),wg=W(pg,qg,c?void 0:wg.domain()),xg=W(pg,qg,c?void 0:xg.domain()),yg=V(ng,og,xj,function(a){return a%1?0:Eg.tickOffset()}),zg=W(tg,ug,c?void 0:zg.domain()),Ag=W(tg,ug,c?void 0:Ag.domain()),a=ab(),b=yh?yh:c?void 0:Bg.tickValues(),Bg=Z(vg,$i,a,b),Eg=Z(yg,bj,a,b),Cg=$(wg,_i,Mh,Oh),Dg=$(xg,aj,Vh,Xh),c||(lj.scale(yg),Rf&&pj.scale(vg)),U()}function U(){jg=Hb(),kg=Ib(),lg=Ib(.98)}function V(a,b,c,d){var e,f=(Mi?Hf.time.scale():Hf.scale.linear()).range([a,b]),g=c?f.domain(c):f;Ni?(d=d||function(){return 0},f=function(a){return Math.ceil(g(a)+d(a))}):f=function(a){return Math.ceil(g(a))};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return xj&&xj[0]===a[0]&&xj[1]a?a.toFixed(0):a};return th&&("function"==typeof th?a=th:Mi&&(a=function(a){return a?Wi(th)(a):""})),a}function bb(a){var b;return"y"===a?b=Kh:"y2"===a?b=Th:"x"===a&&(b=Fh),b}function cb(a){var b=bb(a);return"string"==typeof b?b:b?b.text:null}function db(a,b){var c=bb(a);"string"==typeof c?"y"===a?Kh=b:"y2"===a?Th=b:"x"===a&&(Fh=b):c&&(c.text=b)}function eb(a){return 10*Math.sin(Math.PI*(a/180))}function fb(a){return 11.5-2.5*(a/15)}function gb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",fb(c)).attr("x",eb(c)).attr("transform","rotate("+c+")")}function hb(a,b){var c=bb(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 ib(){return hb("x",nh?"inner-top":"inner-right")}function jb(){return hb("y",nh?"inner-right":"inner-top")}function kb(){return hb("y2",nh?"inner-right":"inner-top")}function lb(a){return"y2"===a?kb():"y"===a?jb():ib()}function mb(){return cb("x")}function nb(){return cb("y")}function ob(){return cb("y2")}function pb(a,b){return a?b.isLeft?0:b.isCenter?ag/2:ag:b.isBottom?-cg:b.isMiddle?-cg/2:0}function qb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function rb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function sb(){return pb(!nh,ib())}function tb(){return pb(nh,jb())}function ub(){return pb(nh,kb())}function vb(){return qb(!nh,ib())}function wb(){return qb(nh,jb())}function xb(){return qb(nh,kb())}function yb(){var a=ib();return nh?a.isInner?"1.2em":-25-Eb("x"):a.isInner?"-0.5em":Dh?Dh-10:"3em"}function zb(){var a=jb();return nh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Eb("y")}function Ab(){var a=kb();return nh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Eb("y2")}function Bb(){return rb(!nh,ib())}function Cb(){return rb(nh,jb())}function Db(){return rb(nh,kb())}function Eb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Hf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Fb(a){var b=sj.select("."+g.axisX+" ."+g.axisXLabel),c=sj.select("."+g.axisY+" ."+g.axisYLabel),d=sj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb),(a?c.transition():c).attr("x",tb).attr("dx",wb).attr("dy",zb).attr("dy",zb).text(nb),(a?d.transition():d).attr("x",ub).attr("dx",xb).attr("dy",Ab).text(ob)}function Gb(a){var b=!1;return mg(Jc(If.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Hb(){var a=Hf.svg.arc().outerRadius(gg).innerRadius(ig),b=function(b,c){var d;return c?a(b):(d=Gb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Ib(a){var b=Hf.svg.arc().outerRadius(hg*(a?a:1)).innerRadius(ig);return function(a){var c=Gb(a);return c?b(c):"M 0 0"}}function Jb(a,b){return qe(a.data)?jg(a,b):"M 0 0"}function Kb(a){var b,c,d,e,f=Gb(a),g="";return f&&(b=jg.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*gg*.8+","+d/e*gg*.8+")"),g}function Lb(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Mb(a){return qc({id:a.data.id,value:a.value,ratio:Lb(a)})}function Nb(a){var b,c,d,e;return Qb()?(b=Gb(a),c=b?b.value:null,d=Lb(b),e=Rb(),e?e(c,d):Ed(c,d)):""}function Ob(a,b){var c=qj.selectAll("."+g.chartArc+qd(a)),d=qj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});we(a)&&c.selectAll("path").transition().duration(50).attr("d",kg).transition().duration(100).attr("d",lg).each(function(a){pe(a.data)}),b||d.style("opacity",.3)}function Pb(a){var b=qj.selectAll("."+g.chartArc+qd(a));b.selectAll("path").transition().duration(50).attr("d",jg),qj.selectAll("."+g.arc).style("opacity",1)}function Qb(){return ie(If.data.targets)?ri:li}function Rb(){return ie(If.data.targets)?si:mi}function Sb(){return ie(If.data.targets)?ui:""}function Tb(){var a=ie(If.data.targets)?vi:oi;return"function"==typeof a?a:function(){}}function Ub(){var a=ie(If.data.targets)?wi:pi;return"function"==typeof a?a:function(){}}function Vb(){var a=ie(If.data.targets)?xi:qi;return"function"==typeof a?a:function(){}}function Wb(a){var b,c,d,e,f,g,h=Dc(a),i=Qc(a);if(Lg.length>0)for(g=Sc(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 Hf.min(Object.keys(i).map(function(a){return Hf.min(i[a])}))}function Xb(a){var b,c,d,e,f,g,h=Dc(a),i=Qc(a);if(Lg.length>0)for(g=Tc(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 Hf.max(Object.keys(i).map(function(a){return Hf.max(i[a])}))}function Yb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return _(a.id)===c}),m="y2"===c?Rh:Ih,n="y2"===c?Qh:Hh,o=b(m)?m:Wb(l),p=b(n)?n:Xb(l),q="y2"===c?Sh:Jh,r=yd()&&nh;return 0===l.length?"y2"===c?xg.domain():wg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=zd(o,p),j=bc(wg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Nh&&(f=b(Nh.top)?Nh.top:e,g=b(Nh.bottom)?Nh.bottom:e),"y2"===c&&Wh&&(f=b(Wh.top)?Wh.top:e,g=b(Wh.bottom)?Wh.bottom:e),fe(l)&&!Sc(l)&&(g=o),[o-g,p+f])}function Zb(a){return Bh?Mi?ye(Bh):Bh:Hf.min(a,function(a){return Hf.min(a.values,function(a){return a.x})})}function $b(a){return Ah?Mi?ye(Ah):Ah:Hf.max(a,function(a){return Hf.max(a.values,function(a){return a.x})})}function _b(a){var c,d,e,f,g=Cc(a),h=g[1]-g[0];return Ni?d=0:fe(a)?(c=Ac(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Ch&&De(Ch)?(e=b(Ch.left)?Ch.left:d,f=b(Ch.right)?Ch.right:d):e=f="number"==typeof Ch?Ch:d,{left:e,right:f}}function ac(a){var b=[Zb(a),$b(a)],c=b[0],d=b[1],e=_b(a),f=0,g=0;return c-d!==0||Ni||(c=Mi?new Date(.5*c.getTime()):-.5,d=Mi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Mi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Mi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function bc(a){return a[1]-a[0]}function cc(a){for(var b=0;bb?0:b-c}function ic(a){var b,c=gc(a),d="y"===a.axis?wg:xg;return b="y"===a.axis||"y2"===a.axis?nh?cg:"start"in a?d(a.start):cg:nh?"end"in a?vg(Mi?ye(a.end):a.end):cg:cg,c>b?0:b-c}function jc(a){return Fg&&a===Fg||De(Gg)&&Ee(Gg,a)}function kc(a){return!jc(a)}function lc(a){return Fg?Fg:De(Gg)?Gg[a]:null}function mc(a,b){var c,d=b&&De(b)?Dc(b):[];return d.forEach(function(b){lc(b)===a&&(c=If.data.xs[b])}),c}function nc(a,b){return a in If.data.xs&&If.data.xs[a]&&If.data.xs[a][b]?If.data.xs[a][b]:b}function oc(a){Object.keys(a).forEach(function(b){Gg[b]=a[b]})}function pc(a){return 1===Hf.set(Object.keys(a).map(function(b){return a[b]})).size()}function qc(a){var b;return a&&(b=Jg[a.id],a.name=b?b:a.id),a}function rc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=tc(b[d],a.id,d)}),If.data.xs[a.id]=b})}function sc(a,b){a.forEach(function(a){b[a.id]&&rc([a],b[a.id])})}function tc(a,c,d){var e;return e=Mi?a?a instanceof Date?a:ye(a):ye(nc(c,d)):Oi&&!Ni?b(a)?+a:nc(c,d):d}function uc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?If.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Fg?(d=Object.keys(If.data.xs),If.data.xs[c]=d.length>0?If.data.xs[d[0]]:void 0):De(Gg)&&(If.data.xs[c]=mc(f,If.data.targets)):If.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!If.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Ig(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=lc(b),g=a[f],h=tc(g,b,e);return Oi&&Ni&&0===c&&g&&(0===e&&(rh=[]),rh.push(g)),("undefined"==typeof a[b]||If.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ng&&de(Dc(c).filter(function(a){return!(a in Og)}),Ng),c.forEach(function(a){dc(a.id_org,a)}),c}function xc(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 yc(a){return a>0&&If.data.targets[0].values[a-1]?If.data.targets[0].values[a-1].x:void 0}function zc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Cc(a){var b,c,d=Bc(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Dc(a){return a.map(function(a){return a.id})}function Ec(a){return a?"string"==typeof a?[a]:a:Dc(If.data.targets)}function Fc(a,b){var c,d=Dc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Mi?new Date(i):i);j.push(e)}return Mi||(j=j.sort(function(a,b){return a-b})),j}function Mc(a){Yi=Yi.concat(a)}function Nc(a){Yi=Yi.filter(function(b){return a.indexOf(b)<0})}function Oc(a){Zi=Zi.concat(a)}function Pc(a){Zi=Zi.filter(function(b){return a.indexOf(b)<0})}function Qc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Rc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Tc(a){return Rc(a,function(a){return a>0})}function Uc(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||0===a[f].x)&&(e=e.concat(Kd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Kd(a,g))),Nd(e,b)):Ld(a,b,f,g)}function Md(a,b){var c;return c=a.map(function(a){return Ld(a.values,b)}),Nd(c,b)}function Nd(a,b){var c,d;return a.forEach(function(a){var e=Fe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Od(a,b){return Hf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Pd(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 Qd(){return Qg&&"desc"===Qg.toLowerCase()}function Rd(){return Qg&&"asc"===Qg.toLowerCase()}function Sd(a){var b=Rd(),c=Qd();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 Qg&&a.sort(Qg),a}function Td(a,c){var d,e,f,g,h,i,j,k=je(If.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&zi&&(vj.html(Ci(a,ab(),Ad(k),Vi)).style("display","block"),d=vj.property("offsetWidth"),e=vj.property("offsetHeight"),k?(g=ag/2+c[0],i=cg/2+c[1]+20):(nh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-w(),i=vg(l[0].x)+20):(f=s(),g=f+v()+vg(l[0].x)+20,h=g+d,j=f+t()-w(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),vj.style("top",i+"px").style("left",g+"px"))}function Ud(){vj.style("display","none")}function Vd(a){var c=a.filter(function(a){return a&&b(a.value)});if(zi&&!ge(If.data.targets)&&!je(If.data.targets)){var d=sj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(nh?"y1":"x1",Gd).attr(nh?"y2":"x2",Gd),lf(d,"grid")}}function Wd(){sj.select("line."+g.xgridFocus).style("visibility","hidden")}function Xd(a,b){var c,d,e,f,h=[],i=sj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=ac(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function Yd(a){return a.x||0===a.x?vg(a.x):null}function Zd(a){return X(a.id)(a.value)}function $d(){var a,b,d={},e=0;return Jc(Gc(me)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ce(a,b){return"number"==typeof ji?ji:b?2*a.tickOffset()*ki/b:0}function de(a,b){Ec(a).forEach(function(a){zj[a]=b===Og[a],Og[a]=b})}function ee(a,b){var c=!1;return a.forEach(function(a){Og[a.id]===b&&(c=!0),a.id in Og||"line"!==b||(c=!0)}),c}function fe(a){return ee(a,"bar")}function ge(a){return ee(a,"scatter")}function he(a){return ee(a,"pie")}function ie(a){return ee(a,"donut")}function je(a){return he(a)||ie(a)}function ke(a){var b="string"==typeof a?a:a.id;return!(b in Og)||"line"===Og[b]||"spline"===Og[b]||"area"===Og[b]||"area-spline"===Og[b]}function le(a){var b="string"==typeof a?a:a.id;return"spline"===Og[b]||"area-spline"===Og[b]}function me(a){var b="string"==typeof a?a:a.id;return"bar"===Og[b]}function ne(a){var b="string"==typeof a?a:a.id;return"scatter"===Og[b]}function oe(a){var b="string"==typeof a?a:a.id;return"pie"===Og[b]}function pe(a){var b="string"==typeof a?a:a.id;return"donut"===Og[b]}function qe(a){return oe(a)||pe(a)}function re(a){return ke(a)?[a]:[]}function se(a){return qe(a.data)?[a]:[]}function te(a){return me(a)?a.values:[]}function ue(a){return ke(a)||ne(a)?a.values:[]}function ve(a){return me(a)||ke(a)?a.values:[]}function we(a){return pe(a)&&ti||oe(a)&&ni}function xe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ye(b){var c;try{c=Hg?Hf.time.format(Hg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Hg)}return c}function ze(a,b){var c=Hf.mouse(a),d=Hf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ee(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Fe(a,b){var c="y"===_(a.id)?wg:xg,d=nh?1:0,e=nh?0:1;return Math.pow(vg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ge(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function He(a,b,c){ah(b,a.node()),sj.select("."+g.selectedCircles+pd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Vc(g.selectedCircle,c)}).attr("cx",nh?Zd:Yd).attr("cy",nh?Yd:Zd).attr("stroke",function(){return Vi(b)}).attr("r",1.4*Se(b)).transition().duration(100).attr("r",Se)}function Ie(a,b,c){bh(b,a.node()),sj.select("."+g.selectedCircles+pd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Je(a,b,c,d){a?He(b,c,d):Ie(b,c,d)}function Ke(a,b){ah(b,a.node()),a.transition().duration(100).style("fill",function(){return Hf.rgb(Vi(b)).brighter(.75)})}function Le(a,b){bh(b,a.node()),a.transition().duration(100).style("fill",function(){return Vi(b)})}function Me(a,b,c,d){a?Ke(b,c,d):Le(b,c,d)}function Ne(a,b,c,d){Me(a,b,c.data,d)}function Oe(a){return"circle"===a.nodeName?Je:Hf.select(a).classed(g.bar)?Me:Ne}function Pe(a){return a.filter(function(a){return b(a.value)})}function Qe(a){return ci?"function"==typeof di?di(a):di:0}function Re(a){return fi?gi?gi:1.75*Qe(a):Qe(a)}function Se(a){return hi?hi:4*Qe(a)}function Te(a,c){return(c?sj.selectAll("."+g.circles+pd(c)):sj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ue(a,b){Te(a,b).classed(g.EXPANDED,!0).attr("r",Re)}function Ve(a){Te(a).filter(function(){return Hf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Qe)}function We(a){return sj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function Xe(a){We(a).classed(g.EXPANDED,!0)}function Ye(a){We(a).classed(g.EXPANDED,!1)}function Ze(a,b){var c=bf(a,b);return function(a,b){var d=c(a,b),e=nh?1:0,f=nh?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 $e(a,b){var c=bf(a,!1),d=b?_e:af;return function(a,b){return d(c(a,b),a,this)}}function _e(a,b){var c;return nh?(c=me(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function af(a,b,c){var d=c.getBoundingClientRect();return nh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:me(b)?-3:-6)}function bf(a,b){var c=a.__max__+1,d=ce(Bg,c),e=_d(d,c,a,!!b),f=ae(!!b),g=be(a,!!b),h=b?Y:X;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return nh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function cf(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;gb?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&aag&&(ag=0),0>cg&&(cg=0),bg=nh?Zf.left-ij-jj:ag,dg=nh?cg:fg-$f.top-$f.bottom,0>bg&&(bg=0),0>dg&&(dg=0),r(),dj&&je(If.data.targets)&&(_f.left=ag/2+hg)}function q(){sj.select("line."+g.xgridFocus).attr("x1",nh?0:-10).attr("x2",nh?ag:-10).attr("y1",nh?-10:Zf.top).attr("y2",nh?-10:cg)}function r(){hg=cg/2,gg=.95*hg,ig=ie(If.data.targets)?.6*gg:0}function s(){var a=nh?g.axisX:g.axisY,b=sj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Hf.select(Kf).node().getBoundingClientRect(),e=c.right-d.left-v();return e>0?e:0}function t(){return Lf?Lf:z()}function u(){var a=Mf?Mf:A();return a>0?a:320}function v(){return je(If.data.targets)?0:Nf?Nf:nh?oh?x("x"):1:!Gh||Lh?1:x("y")}function w(){var a=1;return je(If.data.targets)?0:Of?Of:dj?R()+20+(Ph&&!nh?x("y2"):a):Ph?Uh||nh?a:x("y2"):a}function x(a){var b=lb(a);return b.isInner?20+Eb(a):40+Eb(a)}function y(a){return"x"!==a||oh?"x"===a&&Dh?Dh:"y"!==a||Gh?"y2"!==a||Ph?(lb(a).isInner?30:40)+("y2"===a?-10:0):kj:hh&&!dj?10:1:0}function z(){return+Hf.select(Kf).style("width").replace("px","")}function A(){return+Hf.select(Kf).style("height").replace("px","")}function B(a){return a?-31:-(Zf.left-1)}function C(a){return a?-20:-4}function D(){return B(!nh)}function E(){return C(!nh)}function F(){return B(nh)}function G(){return C(nh)}function H(a){return a?ag+2+30+30:Zf.left+20}function I(a){return a?(Dh?Dh:0)+80:cg+8}function J(){return H(!nh)}function K(){return I(!nh)}function L(){return H(nh)}function M(){return I(nh)}function N(){var a,b,c,d,e,f=Bc(If.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=vg(b.x)-vg(a.x),0===c?nh?cg:ag:(d=Ac(),e=fe(If.data.targets)?(d-(Ni?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function O(a){ej=a}function P(a){fj=a}function Q(a){gj=a}function R(){return hh?dj?fj*(ej+1):eg:0}function S(){return hh?dj?fg:gj*(ej+1):0}function T(){var a,b,c=!vg;ng=nh?1:0,og=nh?cg:ag,pg=nh?0:cg,qg=nh?ag:1,rg=ng,sg=og,tg=nh?0:dg,ug=nh?bg:1,vg=V(ng,og,c?void 0:vg.domain(),function(){return Bg.tickOffset()}),wg=W(pg,qg,c?void 0:wg.domain()),xg=W(pg,qg,c?void 0:xg.domain()),yg=V(ng,og,xj,function(a){return a%1?0:Eg.tickOffset()}),zg=W(tg,ug,c?void 0:zg.domain()),Ag=W(tg,ug,c?void 0:Ag.domain()),a=ab(),b=yh?yh:c?void 0:Bg.tickValues(),Bg=Z(vg,$i,a,b),Eg=Z(yg,bj,a,b),Cg=$(wg,_i,Mh,Oh),Dg=$(xg,aj,Vh,Xh),c||(lj.scale(yg),Rf&&pj.scale(vg)),U()}function U(){jg=Hb(),kg=Ib(),lg=Ib(.98)}function V(a,b,c,d){var e,f=(Mi?Hf.time.scale():Hf.scale.linear()).range([a,b]),g=c?f.domain(c):f;Ni?(d=d||function(){return 0},f=function(a){return Math.ceil(g(a)+d(a))}):f=function(a){return Math.ceil(g(a))};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return xj&&xj[0]===a[0]&&xj[1]a?a.toFixed(0):a};return th&&("function"==typeof th?a=th:Mi&&(a=function(a){return a?Wi(th)(a):""})),a}function bb(a){var b;return"y"===a?b=Kh:"y2"===a?b=Th:"x"===a&&(b=Fh),b}function cb(a){var b=bb(a);return"string"==typeof b?b:b?b.text:null}function db(a,b){var c=bb(a);"string"==typeof c?"y"===a?Kh=b:"y2"===a?Th=b:"x"===a&&(Fh=b):c&&(c.text=b)}function eb(a){return 10*Math.sin(Math.PI*(a/180))}function fb(a){return 11.5-2.5*(a/15)}function gb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",fb(c)).attr("x",eb(c)).attr("transform","rotate("+c+")")}function hb(a,b){var c=bb(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 ib(){return hb("x",nh?"inner-top":"inner-right")}function jb(){return hb("y",nh?"inner-right":"inner-top")}function kb(){return hb("y2",nh?"inner-right":"inner-top")}function lb(a){return"y2"===a?kb():"y"===a?jb():ib()}function mb(){return cb("x")}function nb(){return cb("y")}function ob(){return cb("y2")}function pb(a,b){return a?b.isLeft?0:b.isCenter?ag/2:ag:b.isBottom?-cg:b.isMiddle?-cg/2:0}function qb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function rb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function sb(){return pb(!nh,ib())}function tb(){return pb(nh,jb())}function ub(){return pb(nh,kb())}function vb(){return qb(!nh,ib())}function wb(){return qb(nh,jb())}function xb(){return qb(nh,kb())}function yb(){var a=ib();return nh?a.isInner?"1.2em":-25-Eb("x"):a.isInner?"-0.5em":Dh?Dh-10:"3em"}function zb(){var a=jb();return nh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Eb("y")}function Ab(){var a=kb();return nh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Eb("y2")}function Bb(){return rb(!nh,ib())}function Cb(){return rb(nh,jb())}function Db(){return rb(nh,kb())}function Eb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Hf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Fb(a){var b=sj.select("."+g.axisX+" ."+g.axisXLabel),c=sj.select("."+g.axisY+" ."+g.axisYLabel),d=sj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb),(a?c.transition():c).attr("x",tb).attr("dx",wb).attr("dy",zb).attr("dy",zb).text(nb),(a?d.transition():d).attr("x",ub).attr("dx",xb).attr("dy",Ab).text(ob)}function Gb(a){var b=!1;return mg(Jc(If.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Hb(){var a=Hf.svg.arc().outerRadius(gg).innerRadius(ig),b=function(b,c){var d;return c?a(b):(d=Gb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Ib(a){var b=Hf.svg.arc().outerRadius(hg*(a?a:1)).innerRadius(ig);return function(a){var c=Gb(a);return c?b(c):"M 0 0"}}function Jb(a,b){return qe(a.data)?jg(a,b):"M 0 0"}function Kb(a){var b,c,d,e,f=Gb(a),g="";return f&&(b=jg.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*gg*.8+","+d/e*gg*.8+")"),g}function Lb(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Mb(a){return qc({id:a.data.id,value:a.value,ratio:Lb(a)})}function Nb(a){var b,c,d,e;return Qb()?(b=Gb(a),c=b?b.value:null,d=Lb(b),e=Rb(),e?e(c,d):Ed(c,d)):""}function Ob(a,b){var c=qj.selectAll("."+g.chartArc+qd(a)),d=qj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});we(a)&&c.selectAll("path").transition().duration(50).attr("d",kg).transition().duration(100).attr("d",lg).each(function(a){pe(a.data)}),b||d.style("opacity",.3)}function Pb(a){var b=qj.selectAll("."+g.chartArc+qd(a));b.selectAll("path").transition().duration(50).attr("d",jg),qj.selectAll("."+g.arc).style("opacity",1)}function Qb(){return ie(If.data.targets)?ri:li}function Rb(){return ie(If.data.targets)?si:mi}function Sb(){return ie(If.data.targets)?ui:""}function Tb(){var a=ie(If.data.targets)?vi:oi;return"function"==typeof a?a:function(){}}function Ub(){var a=ie(If.data.targets)?wi:pi;return"function"==typeof a?a:function(){}}function Vb(){var a=ie(If.data.targets)?xi:qi;return"function"==typeof a?a:function(){}}function Wb(a){var b,c,d,e,f,g,h=Dc(a),i=Qc(a);if(Lg.length>0)for(g=Sc(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 Hf.min(Object.keys(i).map(function(a){return Hf.min(i[a])}))}function Xb(a){var b,c,d,e,f,g,h=Dc(a),i=Qc(a);if(Lg.length>0)for(g=Tc(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 Hf.max(Object.keys(i).map(function(a){return Hf.max(i[a])}))}function Yb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return _(a.id)===c}),m="y2"===c?Rh:Ih,n="y2"===c?Qh:Hh,o=b(m)?m:Wb(l),p=b(n)?n:Xb(l),q="y2"===c?Sh:Jh,r=yd()&&nh;return 0===l.length?"y2"===c?xg.domain():wg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=zd(o,p),j=bc(wg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Nh&&(f=b(Nh.top)?Nh.top:e,g=b(Nh.bottom)?Nh.bottom:e),"y2"===c&&Wh&&(f=b(Wh.top)?Wh.top:e,g=b(Wh.bottom)?Wh.bottom:e),fe(l)&&!Sc(l)&&(g=o),[o-g,p+f])}function Zb(a){return Bh?Mi?ye(Bh):Bh:Hf.min(a,function(a){return Hf.min(a.values,function(a){return a.x})})}function $b(a){return Ah?Mi?ye(Ah):Ah:Hf.max(a,function(a){return Hf.max(a.values,function(a){return a.x})})}function _b(a){var c,d,e,f,g=Cc(a),h=g[1]-g[0];return Ni?d=0:fe(a)?(c=Ac(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Ch&&De(Ch)?(e=b(Ch.left)?Ch.left:d,f=b(Ch.right)?Ch.right:d):e=f="number"==typeof Ch?Ch:d,{left:e,right:f}}function ac(a){var b=[Zb(a),$b(a)],c=b[0],d=b[1],e=_b(a),f=0,g=0;return c-d!==0||Ni||(c=Mi?new Date(.5*c.getTime()):-.5,d=Mi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Mi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Mi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function bc(a){return a[1]-a[0]}function cc(a){for(var b=0;bb?0:b-c}function ic(a){var b,c=gc(a),d="y"===a.axis?wg:xg;return b="y"===a.axis||"y2"===a.axis?nh?cg:"start"in a?d(a.start):cg:nh?"end"in a?vg(Mi?ye(a.end):a.end):cg:cg,c>b?0:b-c}function jc(a){return Fg&&a===Fg||De(Gg)&&Ee(Gg,a)}function kc(a){return!jc(a)}function lc(a){return Fg?Fg:De(Gg)?Gg[a]:null}function mc(a,b){var c,d=b&&De(b)?Dc(b):[];return d.forEach(function(b){lc(b)===a&&(c=If.data.xs[b])}),c}function nc(a,b){return a in If.data.xs&&If.data.xs[a]&&If.data.xs[a][b]?If.data.xs[a][b]:b}function oc(a){Object.keys(a).forEach(function(b){Gg[b]=a[b]})}function pc(a){return 1===Hf.set(Object.keys(a).map(function(b){return a[b]})).size()}function qc(a){var b;return a&&(b=Jg[a.id],a.name=b?b:a.id),a}function rc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=tc(b[d],a.id,d)}),If.data.xs[a.id]=b})}function sc(a,b){a.forEach(function(a){b[a.id]&&rc([a],b[a.id])})}function tc(a,c,d){var e;return e=Mi?a?a instanceof Date?a:ye(a):ye(nc(c,d)):Oi&&!Ni?b(a)?+a:nc(c,d):d}function uc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?If.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Fg?(d=Object.keys(If.data.xs),If.data.xs[c]=d.length>0?If.data.xs[d[0]]:void 0):De(Gg)&&(If.data.xs[c]=mc(f,If.data.targets)):If.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!If.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Ig(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=lc(b),g=a[f],h=tc(g,b,e);return Oi&&Ni&&0===c&&g&&(0===e&&(rh=[]),rh.push(g)),("undefined"==typeof a[b]||If.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ng&&de(Dc(c).filter(function(a){return!(a in Og)}),Ng),c.forEach(function(a){dc(a.id_org,a)}),c}function xc(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 yc(a){return a>0&&If.data.targets[0].values[a-1]?If.data.targets[0].values[a-1].x:void 0}function zc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Cc(a){var b,c,d=Bc(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Dc(a){return a.map(function(a){return a.id})}function Ec(a){return a?"string"==typeof a?[a]:a:Dc(If.data.targets)}function Fc(a,b){var c,d=Dc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Mi?new Date(i):i);j.push(e)}return Mi||(j=j.sort(function(a,b){return a-b})),j}function Mc(a){Yi=Yi.concat(a)}function Nc(a){Yi=Yi.filter(function(b){return a.indexOf(b)<0})}function Oc(a){Zi=Zi.concat(a)}function Pc(a){Zi=Zi.filter(function(b){return a.indexOf(b)<0})}function Qc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Rc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Tc(a){return Rc(a,function(a){return a>0})}function Uc(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||0===a[f].x)&&(e=e.concat(Kd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Kd(a,g))),Nd(e,b)):Ld(a,b,f,g)}function Md(a,b){var c;return c=a.map(function(a){return Ld(a.values,b)}),Nd(c,b)}function Nd(a,b){var c,d;return a.forEach(function(a){var e=Fe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Od(a,b){return Hf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Pd(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 Qd(){return Qg&&"desc"===Qg.toLowerCase()}function Rd(){return Qg&&"asc"===Qg.toLowerCase()}function Sd(a){var b=Rd(),c=Qd();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 Qg&&a.sort(Qg),a}function Td(a,c){var d,e,f,g,h,i,j,k=je(If.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&zi&&(vj.html(Ci(a,ab(),Ad(k),Vi)).style("display","block"),d=vj.property("offsetWidth"),e=vj.property("offsetHeight"),k?(g=ag/2+c[0],i=cg/2+c[1]+20):(nh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-w(),i=vg(l[0].x)+20):(f=s(),g=f+v()+vg(l[0].x)+20,h=g+d,j=f+t()-w(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),vj.style("top",i+"px").style("left",g+"px"))}function Ud(){vj.style("display","none")}function Vd(a){var c=a.filter(function(a){return a&&b(a.value)});if(zi&&!ge(If.data.targets)&&!je(If.data.targets)){var d=sj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(nh?"y1":"x1",Gd).attr(nh?"y2":"x2",Gd),lf(d,"grid")}}function Wd(){sj.select("line."+g.xgridFocus).style("visibility","hidden")}function Xd(a,b){var c,d,e,f,h=[],i=sj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=ac(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function Yd(a){return a.x||0===a.x?vg(a.x):null}function Zd(a){return X(a.id)(a.value)}function $d(){var a,b,d={},e=0;return Jc(Gc(me)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ce(a,b){return"number"==typeof ji?ji:b?2*a.tickOffset()*ki/b:0}function de(a,b){Ec(a).forEach(function(a){zj[a]=b===Og[a],Og[a]=b})}function ee(a,b){var c=!1;return a.forEach(function(a){Og[a.id]===b&&(c=!0),a.id in Og||"line"!==b||(c=!0)}),c}function fe(a){return ee(a,"bar")}function ge(a){return ee(a,"scatter")}function he(a){return ee(a,"pie")}function ie(a){return ee(a,"donut")}function je(a){return he(a)||ie(a)}function ke(a){var b="string"==typeof a?a:a.id;return!(b in Og)||"line"===Og[b]||"spline"===Og[b]||"area"===Og[b]||"area-spline"===Og[b]}function le(a){var b="string"==typeof a?a:a.id;return"spline"===Og[b]||"area-spline"===Og[b]}function me(a){var b="string"==typeof a?a:a.id;return"bar"===Og[b]}function ne(a){var b="string"==typeof a?a:a.id;return"scatter"===Og[b]}function oe(a){var b="string"==typeof a?a:a.id;return"pie"===Og[b]}function pe(a){var b="string"==typeof a?a:a.id;return"donut"===Og[b]}function qe(a){return oe(a)||pe(a)}function re(a){return ke(a)?[a]:[]}function se(a){return qe(a.data)?[a]:[]}function te(a){return me(a)?a.values:[]}function ue(a){return ke(a)||ne(a)?a.values:[]}function ve(a){return me(a)||ke(a)?a.values:[]}function we(a){return pe(a)&&ti||oe(a)&&ni}function xe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ye(b){var c;try{c=Hg?Hf.time.format(Hg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Hg)}return c}function ze(a,b){var c=Hf.mouse(a),d=Hf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ee(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Fe(a,b){var c="y"===_(a.id)?wg:xg,d=nh?1:0,e=nh?0:1;return Math.pow(vg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ge(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function He(a,b,c){ah(b,a.node()),sj.select("."+g.selectedCircles+pd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Vc(g.selectedCircle,c)}).attr("cx",nh?Zd:Yd).attr("cy",nh?Yd:Zd).attr("stroke",function(){return Vi(b)}).attr("r",1.4*Se(b)).transition().duration(100).attr("r",Se)}function Ie(a,b,c){bh(b,a.node()),sj.select("."+g.selectedCircles+pd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Je(a,b,c,d){a?He(b,c,d):Ie(b,c,d)}function Ke(a,b){ah(b,a.node()),a.transition().duration(100).style("fill",function(){return Hf.rgb(Vi(b)).brighter(.75)})}function Le(a,b){bh(b,a.node()),a.transition().duration(100).style("fill",function(){return Vi(b)})}function Me(a,b,c,d){a?Ke(b,c,d):Le(b,c,d)}function Ne(a,b,c,d){Me(a,b,c.data,d)}function Oe(a){return"circle"===a.nodeName?Je:Hf.select(a).classed(g.bar)?Me:Ne}function Pe(a){return a.filter(function(a){return b(a.value)})}function Qe(a){return ci?"function"==typeof di?di(a):di:0}function Re(a){return fi?gi?gi:1.75*Qe(a):Qe(a)}function Se(a){return hi?hi:4*Qe(a)}function Te(a,c){return(c?sj.selectAll("."+g.circles+pd(c)):sj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ue(a,b){Te(a,b).classed(g.EXPANDED,!0).attr("r",Re)}function Ve(a){Te(a).filter(function(){return Hf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Qe)}function We(a){return sj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function Xe(a){We(a).classed(g.EXPANDED,!0)}function Ye(a){We(a).classed(g.EXPANDED,!1)}function Ze(a,b){var c=bf(a,b);return function(a,b){var d=c(a,b),e=nh?1:0,f=nh?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 $e(a,b){var c=bf(a,!1),d=b?_e:af;return function(a,b){return d(c(a,b),a,this)}}function _e(a,b){var c;return nh?(c=me(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function af(a,b,c){var d=c.getBoundingClientRect();return nh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:me(b)?-3:-6)}function bf(a,b){var c=a.__max__+1,d=ce(Bg,c),e=_d(d,c,a,!!b),f=ae(!!b),g=be(a,!!b),h=b?Y:X;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return nh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function cf(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 df(b){var c,d,e;if(wj=Hf.select(Kf),wj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(wj.html("").classed("c3",!0),If.data.xs={},If.data.targets=wc(b),Ug&&Mc(Ug===!0?Dc(If.data.targets):Ug),p(),T(),vg.domain(Hf.extent(ac(If.data.targets))),wg.domain(Yb(If.data.targets,"y")),xg.domain(Yb(If.data.targets,"y2")),yg.domain(vg.domain()),zg.domain(wg.domain()),Ag.domain(xg.domain()),xj=vg.domain(),lj.scale(yg),Rf&&pj.scale(vg),qj=wj.append("svg").on("mouseenter",Uf).on("mouseleave",Vf),rj=qj.append("defs"),rj.append("clipPath").attr("id",Gi).append("rect"),rj.append("clipPath").attr("id",Hi).append("rect"),rj.append("clipPath").attr("id",Ii).append("rect"),qf(),sj=qj.append("g").attr("transform",cj.main),tj=qj.append("g").attr("transform",cj.context),uj=qj.append("g").attr("transform",cj.legend),eh||tj.style("visibility","hidden"),hh||(uj.style("visibility","hidden"),Zi=Dc(If.data.targets)),vj=Hf.select(Kf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Cf(Dc(If.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=sj.append("g").attr("clip-path",Ji).attr("class",g.grid),Yh&&d.append("g").attr("class",g.xgrids),De($h)&&d.append("g").attr("class",g.xgridLines),ei&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),_h&&d.append("g").attr("class",g.ygrids),De(ai)&&d.append("g").attr("class",g.ygridLines),sj.append("g").attr("clip-path",Ji).attr("class",g.regions),sj.append("g").attr("clip-path",Ji).attr("class",g.chart),c=sj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Rf?nh?"ns-resize":"ew-resize":null),sj.select("."+g.chart).append("g").attr("class",g.chartBars),sj.select("."+g.chart).append("g").attr("class",g.chartLines),sj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",cj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Sb()),sj.select("."+g.chart).append("g").attr("class",g.chartTexts),Rf&&sj.insert("rect",Tf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",ag).attr("height",cg).style("opacity",0).style("cursor",nh?"ns-resize":"ew-resize").call(pj).on("dblclick.zoom",null),Eh&&lj.extent("function"!=typeof Eh?Eh:Eh(ac())),oh&&sj.append("g").attr("class",g.axisX).attr("clip-path",Ki).attr("transform",cj.x).append("text").attr("class",g.axisXLabel).attr("transform",nh?"rotate(-90)":"").style("text-anchor",Bb),Gh&&sj.append("g").attr("class",g.axisY).attr("clip-path",Li).attr("transform",cj.y).append("text").attr("class",g.axisYLabel).attr("transform",nh?"":"rotate(-90)").style("text-anchor",Cb),Ph&&sj.append("g").attr("class",g.axisY2).attr("transform",cj.y2).append("text").attr("class",g.axisY2Label).attr("transform",nh?"":"rotate(-90)").style("text-anchor",Db),tj.append("g").attr("clip-path",Ji).attr("class",g.chart),tj.select("."+g.chart).append("g").attr("class",g.chartBars),tj.select("."+g.chart).append("g").attr("class",g.chartLines),tj.append("g").attr("clip-path",Ji).attr("class",g.brush).call(lj).selectAll("rect").attr(nh?"width":"height",nh?bg:dg),tj.append("g").attr("class",g.axisX).attr("transform",cj.subx).attr("clip-path",nh?"":Ki),sf(If.data.targets),nh?sj.select("."+g.axisX).style("opacity",0).call(Bg):(sj.select("."+g.axisY).style("opacity",0).call(Cg),sj.select("."+g.axisY2).style("opacity",0).call(Dg)),p(),T(),qf(),o(!1),mf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Di){if(Mi&&"string"==typeof Ei){for(Ei=ye(Ei),e=0;e0){d=[];for(var f in Jg)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Pd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Me,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function jf(a){je(If.data.targets)||Vg&&(Pi=a,sj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Qi=!0,ch())}function kf(){je(If.data.targets)||Vg&&(sj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),sj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Qi=!1,dh())}function lf(a,b){"grid"===b&&a.each(function(){var a=Hf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function mf(a){var c,e,f,h,i,j,k,l,m,n,o,p,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,O,P,Q,R,S,T,U,V,W,X,Y,Z,$,_=$d(),ab=je(If.data.targets),bb=Jc(If.data.targets);if(a=d(a)?a:{},G=d(a.withY)?a.withY:!0,H=d(a.withSubchart)?a.withSubchart:!0,I=d(a.withTransition)?a.withTransition:!0,L=d(a.withTransform)?a.withTransform:!1,M=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,O=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,P=d(a.withLegend)?a.withLegend:!1,J=d(a.withTransitionForExit)?a.withTransitionForExit:I,K=d(a.withTransitionForAxis)?a.withTransitionForAxis:I,V=I?Yf:0,W=J?V:0,X=K?V:0,c=sj.select("."+g.axisX).style("opacity",ab?0:1),f=sj.select("."+g.axisY).style("opacity",ab?0:1),h=sj.select("."+g.axisY2).style("opacity",ab?0:1),e=tj.select("."+g.axisX).style("opacity",ab?0:1),U={axisX:c.transition().duration(X),axisY:f.transition().duration(X),axisY2:h.transition().duration(X),axisSubX:e.transition().duration(X)},P&&hh&&Cf(Dc(If.data.targets),a,U),Ni&&0===bb.length&&vg.domain([0,c.selectAll(".tick").size()]),bb.length&&(O&&(vg.domain(Hf.extent(ac(bb))),xj=vg.domain(),Rf&&pj.scale(vg).updateScaleExtent(),yg.domain(vg.domain()),lj.scale(yg)),M&&(vg.domain(lj.empty()?xj:lj.extent()),Rf&&pj.scale(vg).updateScaleExtent()),yh||!xh&&!wh||(Y=Lc(Kc(bb),wh),Bg.tickValues(Y),Eg.tickValues(Y))),wg.domain(Yb(bb,"y")),xg.domain(Yb(bb,"y2")),U.axisX.call(Bg),U.axisY.call(Cg),U.axisY2.call(Dg),U.axisSubX.call(Eg),Fb(I),M&&bb.length)if(uh&&Y){for(Z=1;Z=0&&Hf.select(this).style("display",b%$?"none":"block")})}else qj.selectAll("."+g.axisX+" .tick text").style("display","block");!nh&&zh&&gb(c,U.axisX,zh),Q=Ze(_),S=$e(_,!0),T=$e(_,!1),zg.domain(wg.domain()),Ag.domain(xg.domain()),vj.style("display","none"),q(),sj.select("line."+g.xgridFocus).style("visibility","hidden"),Yh&&(k=Xd(Zh,vg),D=Ni?Bg.tickOffset():0,j=nh?{x1:0,x2:ag,y1:function(a){return vg(a)-D},y2:function(a){return vg(a)-D}}:{x1:function(a){return vg(a)+D},x2:function(a){return vg(a)+D},y1:Zf.top,y2:cg},i=sj.select("."+g.xgrids).selectAll("."+g.xgrid).data(k),i.enter().append("line").attr("class",g.xgrid),i.attr(j).style("opacity",function(){return+Hf.select(this).attr(nh?"y1":"x1")===(nh?cg:0)?0:1}),i.exit().remove()),De($h)&&(l=sj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data($h),m=l.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",nh?"":"rotate(-90)").attr("dx",nh?0:-Zf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(V).attr("x1",nh?0:Hd).attr("x2",nh?ag:Hd).attr("y1",nh?Hd:Zf.top).attr("y2",nh?Hd:cg).style("opacity",1),l.select("text").transition().duration(V).attr("x",nh?ag:0).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(V).style("opacity",0).remove()),G&&_h&&(n=sj.select("."+g.ygrids).selectAll("."+g.ygrid).data(wg.ticks(bi)),n.enter().append("line").attr("class",g.ygrid),n.attr("x1",nh?wg:0).attr("x2",nh?wg:ag).attr("y1",nh?0:wg).attr("y2",nh?cg:wg),n.exit().remove(),lf(n,"grid")),G&&De(ai)&&(o=sj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(ai),p=o.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",nh?"rotate(-90)":"").attr("dx",nh?0:-Zf.top).attr("dy",-5).style("opacity",0),o.select("line").transition().duration(V).attr("x1",nh?Id:0).attr("x2",nh?Id:ag).attr("y1",nh?0:Id).attr("y2",nh?cg:Id).style("opacity",1),o.select("text").transition().duration(V).attr("x",nh?0:ag).attr("y",Id).text(function(a){return a.text}).style("opacity",1),o.exit().transition().duration(V).style("opacity",0).remove()),w=sj.select("."+g.regions).selectAll("."+g.region).data(yi),w.enter().append("g").attr("class",id).append("rect").style("fill-opacity",0),w.selectAll("rect").transition().duration(V).attr("x",fc).attr("y",gc).attr("width",hc).attr("height",ic).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),w.exit().transition().duration(V).style("fill-opacity",0).remove(),u=sj.selectAll("."+g.bars).selectAll("."+g.bar).data(te),u.enter().append("path").attr("class",cd).style("stroke","none").style("fill",Vi),u.style("opacity",ud).transition().duration(V).attr("d",Q).style("fill",Vi).style("opacity",1),u.exit().transition().duration(W).style("opacity",0).remove(),r=sj.selectAll("."+g.lines).selectAll("."+g.line).data(re),r.enter().append("path").attr("class",$c).style("stroke",Vi),r.style("opacity",ud).transition().duration(V).attr("d",mj).style("stroke",Vi).style("opacity",1),r.exit().transition().duration(W).style("opacity",0).remove(),s=sj.selectAll("."+g.areas).selectAll("."+g.area).data(re),s.enter().append("path").attr("class",gd).style("fill",Vi).style("opacity",function(){return yj=+Hf.select(this).style("opacity"),0}),s.style("opacity",0).transition().duration(V).attr("d",nj).style("fill",Vi).style("opacity",yj),s.exit().transition().duration(W).style("opacity",0).remove(),t=sj.selectAll("."+g.circles).selectAll("."+g.circle).data(ue),t.enter().append("circle").attr("class",ad).attr("r",Qe).style("fill",Vi),t.style("opacity",ud).transition().duration(V).style("opacity",wd).style("fill",Vi).attr("cx",nh?Zd:Yd).attr("cy",nh?Yd:Zd),t.exit().remove(),x=sj.selectAll("."+g.texts).selectAll("."+g.text).data(ve),x.enter().append("text").attr("class",Wc).attr("text-anchor",function(a){return nh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",Vi).style("fill-opacity",0),x.text(function(a){return Fd(a.id)(a.value,a.id)}).style("fill-opacity",vd).transition().duration(V).attr("x",S).attr("y",T).style("fill",Vi).style("fill-opacity",xd),x.exit().transition().duration(W).style("fill-opacity",0).remove(),v=sj.selectAll("."+g.arcs).selectAll("."+g.arc).data(se),v.enter().append("path").attr("class",ed).style("fill",function(a){return Vi(a.data)}).style("cursor",function(a){return Xg(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Ti||(c=Gb(a),d=Mb(c),e=Ub(),Ob(c.data.id),yf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Gb(a),c=Mb(b),d=[c];Td(d,Hf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Ti||(c=Gb(a),d=Mb(c),e=Vb(),Pb(c.data.id),zf(),Ud(),e(d,b))}).on("click",function(a,b){var c=Gb(a),d=Mb(c),e=Tb();gf(this,a,b),e(d,b)}),v.attr("transform",L?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Ti=!0}).transition().duration(V).attrTween("d",function(a){var b,c=Gb(a);return c?(b=Hf.interpolate(this._current,c),this._current=b(0),function(a){return Jb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",L?"scale(1)":"").style("fill",function(a){return Vi(a.data)}).style("opacity",1).call(Ge,function(){Ti=!1}),v.exit().transition().duration(W).style("opacity",0).remove(),sj.selectAll("."+g.chartArc).select("text").attr("transform",Kb).style("opacity",0).transition().duration(V).text(Nb).style("opacity",function(a){return Hc(a.data.id)&&qe(a.data)?1:0}),sj.select("."+g.chartArcsTitle).style("opacity",ie(If.data.targets)?1:0),eh&&(Hf.event&&"zoom"===Hf.event.type&&lj.extent(vg.orgDomain()).update(),H&&(!nh&&zh&&gb(e,U.axisSubX,zh),lj.empty()||lj.extent(vg.orgDomain()).update(),R=Ze(_,!0),z=tj.selectAll("."+g.bars).selectAll("."+g.bar).data(te),z.enter().append("path").attr("class",cd).style("stroke","none").style("fill",Vi),z.style("opacity",ud).transition().duration(V).attr("d",R).style("opacity",1),z.exit().transition().duration(V).style("opacity",0).remove(),y=tj.selectAll("."+g.lines).selectAll("."+g.line).data(re),y.enter().append("path").attr("class",$c).style("stroke",Vi),y.style("opacity",ud).transition().duration(V).attr("d",oj).style("opacity",1),y.exit().transition().duration(V).style("opacity",0).remove())),sj.selectAll("."+g.selectedCircles).filter(function(a){return me(a)}).selectAll("circle").remove(),sj.selectAll("."+g.selectedCircle).transition().duration(V).attr("cx",nh?Zd:Yd).attr("cy",nh?Yd:Zd),A=sj.select("."+g.eventRects),De(Gg)&&!pc(Gg)?(A.classed(g.eventRectsMultiple)||A.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),B=sj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),ff(B.enter()),B.attr("x",0).attr("y",0).attr("width",ag).attr("height",cg)):(A.classed(g.eventRectsSingle)||A.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Oi&&!Ni?(F=function(a,b){var c=yc(b),d=zc(b),e=If.data.xs[a.id][b];return(vg(d?d:e+50)-vg(c?c:e-50))/2},E=function(a,b){var c=yc(b),d=If.data.xs[a.id][b];return(vg(d)+vg(c?c:d-50))/2}):(F=N(),E=function(a){return vg(a.x)-F/2}),C=Bc(If.data.targets),sj.select("."+g.eventRects).datum(C?C.values:[]),B=sj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),ef(B.enter()),B.attr("class",jd).attr("x",nh?0:E).attr("y",nh?E:0).attr("width",nh?ag:F).attr("height",nh?F:cg),B.exit().remove()),Dc(If.data.targets).forEach(function(a){zj[a]=!0})}function nf(){mf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function of(){if(0!==Jc(If.data.targets).length){if("mousemove"===Hf.event.sourceEvent.type&&pj.altDomain)return vg.domain(pj.altDomain),void pj.scale(vg).updateScaleExtent();Ni&&vg.orgDomain()[0]===xj[0]&&vg.domain([xj[0]-1e-10,vg.orgDomain()[1]]),mf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Hf.event.sourceEvent.type&&(Ri=!0)}}function pf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function qf(){qj.attr("width",eg).attr("height",fg),qj.select("#"+Gi).select("rect").attr("width",ag).attr("height",cg),qj.select("#"+Hi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),qj.select("#"+Ii).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),qj.select("."+g.zoomRect).attr("width",ag).attr("height",cg),wj.style("max-height",fg+"px")}function rf(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,p(),T(),qf(),o(a.withTransition),mf(a)}function sf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=sj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",ld),j=i.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Xc),e=sj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",nd),d=e.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",dd).style("cursor",function(a){return Xg(a)?"pointer":null}),c=sj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",md),b=c.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",_c),b.append("g").attr("class",hd),b.append("g").attr("class",function(a){return Vc(g.selectedCircles,a.id)}),b.append("g").attr("class",bd).style("cursor",function(a){return Xg(a)?"pointer":null}),a.forEach(function(a){sj.selectAll("."+g.selectedCircles+pd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=sj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(mg(a)).attr("class",od),f=h.enter().append("g").attr("class",od),f.append("g").attr("class",fd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),eh&&(n=tj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",nd),m=n.enter().append("g").style("opacity",0).attr("class",nd),m.append("g").attr("class",dd),l=tj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",md),k=l.enter().append("g").style("opacity",0).attr("class",md),k.append("g").attr("class",_c)),qj.selectAll("."+g.target).filter(function(a){return Hc(a.id)}).transition().duration(Yf).style("opacity",1)}function tf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?de(a.id,b.types[a.id]):de(a.id,b.type)}),If.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=dj?j:i,l=dj?S():R();return d&&(w=0,C=0,t=0,u=0),hh&&!Ic(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=dj?u:t,void(mh?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=uj.selectAll("."+g.legendItemFocused).size();b=b||{},n=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,dj?(f=function(a){return t*B[a]},j=function(a){return A[B[a]]+x[a]}):(f=function(a){return A[B[a]]+x[a]},j=function(a){return u*B[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=uj.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Vc(g.legendItem,a)}).style("visibility",function(a){return Ic(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof jh?jh(a):If.toggle(a)}).on("mouseover",function(a){Hf.select(this).classed(g.legendItemFocused,!0),Ti||If.focus(a),"function"==typeof kh&&kh(a)}).on("mouseout",function(a){Hf.select(this).classed(g.legendItemFocused,!1),Ti||If.revert(),"function"==typeof lh&&lh(a)}),m.append("text").text(function(a){return d(Jg[a])?Jg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",dj?h:-200).attr("y",dj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",dj?i:-200).attr("y",dj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",Vi).attr("x",dj?h:-200).attr("y",dj?-200:j).attr("width",10).attr("height",10),uj.selectAll("text").data(a).text(function(a){return d(Jg[a])?Jg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(n?250:0).attr("x",h).attr("y",k),uj.selectAll("rect."+g.legendItemEvent).data(a).transition().duration(n?250:0).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}).attr("x",i).attr("y",l),uj.selectAll("rect."+g.legendItemTile).data(a).transition().duration(n?250:0).style("fill",Vi).attr("x",f).attr("y",j),uj.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Hc(a)}).transition().style("opacity",function(a){var b=Hf.select(this);return Hc(a)?!D||b.classed(g.legendItemFocused)?wf(b):xf(b):hj}),P(t),Q(u),O(C),p(),T(),qf(),o(q,c)}function Df(a){return Fc(If.data.targets,a.id)}function Ef(a){return"data"in a&&Fc(If.data.targets,a.data.id)}function Ff(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 Gf(a,b,c){var d=!je(If.data.targets);Ti=!1,de(a,b),rf(c||{withTransitionForAxis:d})}var Hf=a.d3?a.d3:a.require?a.require("d3"):void 0,If={data:{},axis:{},legend:{}},Jf={},Kf=i(["bindto"],"#chart"),Lf=i(["size","width"]),Mf=i(["size","height"]),Nf=i(["padding","left"],50),Of=i(["padding","right"],0),Pf=i(["padding","top"],0),Qf=i(["padding","bottom"],0),Rf=i(["zoom","enabled"],!1),Sf=i(["zoom","extent"]),Tf=i(["zoom","privileged"],!1),Uf=i(["onenter"],function(){}),Vf=i(["onleave"],function(){}),Wf=i(["onresize"],function(){}),Xf=i(["onresized"],function(){}),Yf=i(["transition","duration"],350);h("data","data is required in config");var Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg=i(["data","x"]),Gg=i(["data","xs"],{}),Hg=i(["data","x_format"]),Ig=i(["data","id_converter"],function(a){return a}),Jg=i(["data","names"],{}),Kg=i(["data","classes"],{}),Lg=i(["data","groups"],[]),Mg=i(["data","axes"],{}),Ng=i(["data","type"]),Og=i(["data","types"],{}),Pg=i(["data","labels"],{}),Qg=i(["data","order"]),Rg=i(["data","regions"],{}),Sg=i(["data","color"]),Tg=i(["data","colors"],{}),Ug=i(["data","hide"],!1),Vg=i(["data","selection","enabled"],!1),Wg=i(["data","selection","grouped"],!1),Xg=i(["data","selection","isselectable"],function(){return!0}),Yg=i(["data","selection","multiple"],!0),Zg=i(["data","onclick"],function(){}),$g=i(["data","onenter"],function(){}),_g=i(["data","onleave"],function(){}),ah=i(["data","onselected"],function(){}),bh=i(["data","onunselected"],function(){}),ch=i(["data","ondragstart"],function(){}),dh=i(["data","ondragend"],function(){}),eh=i(["subchart","show"],!1),fh=i(["subchart","size","height"],60),gh=i(["color","pattern"],[]),hh=i(["legend","show"],!0),ih=i(["legend","position"],"bottom"),jh=i(["legend","item","onclick"]),kh=i(["legend","item","onmouseover"]),lh=i(["legend","item","onmouseout"]),mh=i(["legend","equally"],!1),nh=i(["axis","rotated"],!1),oh=i(["axis","x","show"],!0),ph=i(["axis","x","type"],"indexed"),qh=i(["axis","x","localtime"],!0),rh=i(["axis","x","categories"],[]),sh=i(["axis","x","tick","centered"],!1),th=i(["axis","x","tick","format"]),uh=i(["axis","x","tick","culling"],{}),vh=i(["axis","x","tick","culling","max"],10),wh=i(["axis","x","tick","count"]),xh=i(["axis","x","tick","fit"],!0),yh=i(["axis","x","tick","values"],null),zh=i(["axis","x","tick","rotate"]),Ah=i(["axis","x","max"],null),Bh=i(["axis","x","min"],null),Ch=i(["axis","x","padding"],{}),Dh=i(["axis","x","height"]),Eh=i(["axis","x","default"]),Fh=i(["axis","x","label"],{}),Gh=i(["axis","y","show"],!0),Hh=i(["axis","y","max"]),Ih=i(["axis","y","min"]),Jh=i(["axis","y","center"]),Kh=i(["axis","y","label"],{}),Lh=i(["axis","y","inner"],!1),Mh=i(["axis","y","tick","format"]),Nh=i(["axis","y","padding"]),Oh=i(["axis","y","ticks"],10),Ph=i(["axis","y2","show"],!1),Qh=i(["axis","y2","max"]),Rh=i(["axis","y2","min"]),Sh=i(["axis","y2","center"]),Th=i(["axis","y2","label"],{}),Uh=i(["axis","y2","inner"],!1),Vh=i(["axis","y2","tick","format"]),Wh=i(["axis","y2","padding"]),Xh=i(["axis","y2","ticks"],10),Yh=i(["grid","x","show"],!1),Zh=i(["grid","x","type"],"tick"),$h=i(["grid","x","lines"],[]),_h=i(["grid","y","show"],!1),ai=i(["grid","y","lines"],[]),bi=i(["grid","y","ticks"],10),ci=i(["point","show"],!0),di=i(["point","r"],2.5),ei=i(["point","focus","line","enabled"],!0),fi=i(["point","focus","expand","enabled"],!0),gi=i(["point","focus","expand","r"]),hi=i(["point","focus","select","r"]),ii=i(["line","connect_null"],!1),ji=i(["bar","width"]),ki=i(["bar","width","ratio"],.6),li=i(["pie","label","show"],!0),mi=i(["pie","label","format"]),ni=i(["pie","expand"],!0),oi=i(["pie","onclick"],function(){}),pi=i(["pie","onmouseover"],function(){}),qi=i(["pie","onmouseout"],function(){}),ri=i(["donut","label","show"],!0),si=i(["donut","label","format"]),ti=i(["donut","expand"],!0),ui=i(["donut","title"],""),vi=i(["donut","onclick"],function(){}),wi=i(["donut","onmouseover"],function(){}),xi=i(["donut","onmouseout"],function(){}),yi=i(["regions"],[]),zi=i(["tooltip","show"],!0),Ai=i(["tooltip","format","title"]),Bi=i(["tooltip","format","value"]),Ci=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Ai?Ai:b,l=Bi?Bi:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Di=i(["tooltip","init","show"],!1),Ei=i(["tooltip","init","x"],0),Fi=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Gi=("string"==typeof Kf?Kf.replace("#",""):Kf.id)+"-clip",Hi=Gi+"-xaxis",Ii=Gi+"-yaxis",Ji=j(Gi),Ki=j(Hi),Li=j(Ii),Mi="timeseries"===ph,Ni="categorized"===ph,Oi=!Mi&&(Fg||De(Gg)),Pi=null,Qi=!1,Ri=!1,Si=!1,Ti=!1,Ui=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Vi=xe(Tg,De(gh)?gh:Ui,Sg),Wi=qh?Hf.time.format:Hf.time.format.utc,Xi=function(){var a=[[Wi("%Y/%-m/%-d"),function(){return!0}],[Wi("%-m/%-d"),function(a){return a.getMonth()}],[Wi("%-m/%-d"),function(a){return 1!==a.getDate()}],[Wi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Wi("%I %p"),function(a){return a.getHours()}],[Wi("%I:%M"),function(a){return a.getMinutes()}],[Wi(":%S"),function(a){return a.getSeconds()}],[Wi(".%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)}}(),Yi=[],Zi=[],$i=nh?"left":"bottom",_i=nh?Lh?"top":"bottom":Lh?"right":"left",aj=nh?Uh?"bottom":"top":Uh?"left":"right",bj=nh?"left":"bottom",cj={main:function(){return"translate("+k(Zf.left)+","+k(Zf.top)+")"},context:function(){return"translate("+k($f.left)+","+k($f.top)+")"},legend:function(){return"translate("+_f.left+","+_f.top+")"},x:function(){return"translate(0,"+(nh?0:cg)+")"},y:function(){return"translate(0,"+(nh?cg:0)+")"},y2:function(){return"translate("+(nh?0:ag)+","+(nh?1:0)+")"},subx:function(){return"translate(0,"+(nh?0:dg)+")"},arc:function(){return"translate("+ag/2+","+cg/2+")" }},dj="right"===ih,ej=0,fj=0,gj=0,hj=.15,ij=30,jj=nh&&!oh?0:30,kj=5;mg=Hf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var lj,mj=function(){var a=Hf.svg.line().x(nh?function(a){return X(a.id)(a.value)}:Gd).y(nh?Gd:function(a){return X(a.id)(a.value)});return ii||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ii?Pe(b.values):b.values;return ke(b)?(a.interpolate(le(b)?"cardinal":"linear"),Rg[b.id]?cf(e,vg,X(b.id),Rg[b.id]):a(e)):(c=e[0]?vg(e[0].x):0,d=e[0]?X(b.id)(e[0].value):0,nh?"M "+d+" "+c:"M "+c+" "+d)}}(),nj=function(){var a;return a=nh?Hf.svg.area().x0(function(a){return X(a.id)(0)}).x1(function(a){return X(a.id)(a.value)}).y(Gd):Hf.svg.area().x(Gd).y0(function(a){return X(a.id)(0)}).y1(function(a){return X(a.id)(a.value)}),function(b){var c,d,e=Pe(b.values);return ee([b],"area")||ee([b],"area-spline")?(a.interpolate(le(b)?"cardinal":"linear"),a(e)):(c=e[0]?vg(e[0].x):0,d=e[0]?X(b.id)(e[0].value):0,nh?"M "+d+" "+c:"M "+c+" "+d)}}(),oj=function(){var a=Hf.svg.line().x(nh?function(a){return Y(a.id)(a.value)}:Jd).y(nh?Jd:function(a){return Y(a.id)(a.value)});return function(b){var c=Pe(b.values);return ke(b)?a(c):"M "+yg(c[0].x)+" "+Y(b.id)(c[0].value)}}(),pj=function(){};lj=Hf.svg.brush().on("brush",nf),lj.update=function(){return tj&&tj.select("."+g.brush).call(this),this},lj.scale=function(a){return nh?this.y(a):this.x(a)},Rf&&(pj=Hf.behavior.zoom().on("zoomstart",function(){pj.altDomain=Hf.event.sourceEvent.altKey?vg.orgDomain():null}).on("zoom",Rf?of:null),pj.scale=function(a){return nh?this.y(a):this.x(a)},pj.orgScaleExtent=function(){var a=Sf?Sf:[1,10];return[a[0],Math.max(Ac()/a[1],a[1])]},pj.updateScaleExtent=function(){var a=bc(vg.orgDomain())/bc(xj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var qj,rj,sj,tj,uj,vj,wj,xj,yj,zj={};if(If.focus=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",1)}var c=qj.selectAll(qd(a)),d=c.filter(Df),e=c.filter(Ef);If.revert(),If.defocus(),b(d.classed(g.focused,!0)),b(e),je(If.data.targets)&&Ob(a,!0),yf(a,!0)},If.defocus=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",.3)}var c=qj.selectAll(qd(a)),d=c.filter(Df),e=c.filter(Ef);If.revert(),b(d.classed(g.focused,!1)),b(e),je(If.data.targets)&&Pb(a),yf(a,!1)},If.revert=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",1)}var c=qj.selectAll(qd(a)),d=c.filter(Df),e=c.filter(Ef);b(d.classed(g.focused,!1)),b(e),je(If.data.targets)&&Pb(a),zf()},If.show=function(a,b){a=Ec(a),b=b||{},Nc(a),qj.selectAll(rd(a)).transition().style("opacity",1),b.withLegend&&Af(a),mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},If.hide=function(a,b){a=Ec(a),b=b||{},Mc(a),qj.selectAll(rd(a)).transition().style("opacity",0),b.withLegend&&Bf(a),mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},If.toggle=function(a){Hc(a)?If.hide(a):If.show(a)},If.unzoom=function(){lj.clear().update(),mf({withUpdateXDomain:!0})},If.load=function(a){return a.xs&&oc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Kg[b]=a.classes[b]}),"categories"in a&&Ni&&(rh=a.categories,Bg.categories(rh)),"cacheIds"in a&&cc(a.cacheIds)?void tf(ec(a.cacheIds),a.done):void("unload"in a?vf(Ec("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){uf(a)}):uf(a))},If.unload=function(a,b){vf(Ec(a),function(){mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},If.selected=function(a){return Hf.merge(sj.selectAll("."+g.shapes+pd(a)).selectAll("."+g.shape).filter(function(){return Hf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},If.select=function(a,b,c){Vg&&sj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Hf.select(this),i=e.data?e.data.id:e.id,j=Oe(this),k=Wg||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);"path"!==this.nodeName&&(k&&l?Xg(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},If.unselect=function(a,b){Vg&&sj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Hf.select(this),f=c.data?c.data.id:c.id,h=Oe(this),i=Wg||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);"path"!==this.nodeName&&i&&j&&Xg(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},If.toLine=function(a){Gf(a,"line")},If.toSpline=function(a){Gf(a,"spline")},If.toBar=function(a){Gf(a,"bar")},If.toScatter=function(a){Gf(a,"scatter")},If.toArea=function(a){Gf(a,"area")},If.toAreaSpline=function(a){Gf(a,"area-spline")},If.toPie=function(a){Gf(a,"pie",{withTransform:!0})},If.toDonut=function(a){Gf(a,"donut",{withTransform:!0})},If.groups=function(a){return c(a)?Lg:(Lg=a,mf(),Lg)},If.xgrids=function(a){return a?($h=a,mf(),$h):$h},If.xgrids.add=function(a){return a?If.xgrids($h.concat(a)):void 0},If.xgrids.remove=function(a){var b=Ff(a);return If.xgrids($h.filter(b))},If.ygrids=function(a){return a?(ai=a,mf(),ai):ai},If.ygrids.add=function(a){return a?If.ygrids(ai.concat(a)):void 0},If.ygrids.remove=function(a){var b=Ff(a);return If.ygrids(ai.filter(b))},If.regions=function(a){return c(a)?yi:(yi=a,mf(),yi)},If.regions.add=function(a){return c(a)?yi:(yi=yi.concat(a),mf(),yi)},If.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;qj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),yi=yi.filter(function(b){return b.classes.indexOf(a)<0})}),yi},If.data.get=function(a){var b=If.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},If.data.getAsTarget=function(a){var b=Gc(function(b){return b.id===a});return b.length>0?b[0]:void 0},If.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Jg[b]=a[b]}),mf({withLegend:!0}),Jg):Jg},If.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Tg[b]=a[b]}),mf({withLegend:!0}),Tg):Tg},If.x=function(a){return arguments.length&&(rc(If.data.targets,a),mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),If.data.xs},If.xs=function(a){return arguments.length&&(sc(If.data.targets,a),mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),If.data.xs},If.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){db(b,a[b])}),Fb())},If.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Ah=+a.x),b(a.y)&&(Hh=+a.y),b(a.y2)&&(Qh=+a.y2)):Hh=Qh=+a,mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},If.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Bh=+a.x),b(a.y)&&(Ih=+a.y),b(a.y2)&&(Rh=+a.y2)):Ih=Rh=+a,mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},If.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&If.axis.max(a.max),"undefined"!=typeof a.min&&If.axis.min(a.min))},If.legend.show=function(a){Af(Ec(a)),mf({withLegend:!0})},If.legend.hide=function(a){Bf(Ec(a)),mf({withLegend:!0})},If.resize=function(a){Lf=a?a.width:null,Mf=a?a.height:null,rf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},If.destroy=function(){If.data.targets=void 0,If.data.xs={},wj.html(""),a.onresize=null},"url"in f.data)Hf.xhr(f.data.url,function(a,b){var c,d=Hf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Hf.csv.parse(b.response),df(c)});else if("rows"in f.data)df(uc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");df(vc(f.data.columns))}return If},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(window); \ No newline at end of file From ef60246c1b856b408d9d6ecfff25de8cc832d663 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 7 May 2014 22:56:51 +0900 Subject: [PATCH 144/178] Update version 0.1.36 --- bower.json | 2 +- c3.js | 2 +- c3.min.js | 2 +- package.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bower.json b/bower.json index 0393434..3e73d61 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "c3", "main": "c3.min.js", - "version": "0.1.35", + "version": "0.1.36", "homepage": "https://github.com/masayuki0812/c3", "authors": [ "Masayuki Tanaka " diff --git a/c3.js b/c3.js index c7f424b..96230c6 100644 --- a/c3.js +++ b/c3.js @@ -2,7 +2,7 @@ 'use strict'; var c3 = { - version: "0.1.35" + version: "0.1.36" }; var CLASS = { diff --git a/c3.min.js b/c3.min.js index 217d99d..73e363d 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.ceil(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.ceil(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&aag&&(ag=0),0>cg&&(cg=0),bg=nh?Zf.left-ij-jj:ag,dg=nh?cg:fg-$f.top-$f.bottom,0>bg&&(bg=0),0>dg&&(dg=0),r(),dj&&je(If.data.targets)&&(_f.left=ag/2+hg)}function q(){sj.select("line."+g.xgridFocus).attr("x1",nh?0:-10).attr("x2",nh?ag:-10).attr("y1",nh?-10:Zf.top).attr("y2",nh?-10:cg)}function r(){hg=cg/2,gg=.95*hg,ig=ie(If.data.targets)?.6*gg:0}function s(){var a=nh?g.axisX:g.axisY,b=sj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Hf.select(Kf).node().getBoundingClientRect(),e=c.right-d.left-v();return e>0?e:0}function t(){return Lf?Lf:z()}function u(){var a=Mf?Mf:A();return a>0?a:320}function v(){return je(If.data.targets)?0:Nf?Nf:nh?oh?x("x"):1:!Gh||Lh?1:x("y")}function w(){var a=1;return je(If.data.targets)?0:Of?Of:dj?R()+20+(Ph&&!nh?x("y2"):a):Ph?Uh||nh?a:x("y2"):a}function x(a){var b=lb(a);return b.isInner?20+Eb(a):40+Eb(a)}function y(a){return"x"!==a||oh?"x"===a&&Dh?Dh:"y"!==a||Gh?"y2"!==a||Ph?(lb(a).isInner?30:40)+("y2"===a?-10:0):kj:hh&&!dj?10:1:0}function z(){return+Hf.select(Kf).style("width").replace("px","")}function A(){return+Hf.select(Kf).style("height").replace("px","")}function B(a){return a?-31:-(Zf.left-1)}function C(a){return a?-20:-4}function D(){return B(!nh)}function E(){return C(!nh)}function F(){return B(nh)}function G(){return C(nh)}function H(a){return a?ag+2+30+30:Zf.left+20}function I(a){return a?(Dh?Dh:0)+80:cg+8}function J(){return H(!nh)}function K(){return I(!nh)}function L(){return H(nh)}function M(){return I(nh)}function N(){var a,b,c,d,e,f=Bc(If.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=vg(b.x)-vg(a.x),0===c?nh?cg:ag:(d=Ac(),e=fe(If.data.targets)?(d-(Ni?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function O(a){ej=a}function P(a){fj=a}function Q(a){gj=a}function R(){return hh?dj?fj*(ej+1):eg:0}function S(){return hh?dj?fg:gj*(ej+1):0}function T(){var a,b,c=!vg;ng=nh?1:0,og=nh?cg:ag,pg=nh?0:cg,qg=nh?ag:1,rg=ng,sg=og,tg=nh?0:dg,ug=nh?bg:1,vg=V(ng,og,c?void 0:vg.domain(),function(){return Bg.tickOffset()}),wg=W(pg,qg,c?void 0:wg.domain()),xg=W(pg,qg,c?void 0:xg.domain()),yg=V(ng,og,xj,function(a){return a%1?0:Eg.tickOffset()}),zg=W(tg,ug,c?void 0:zg.domain()),Ag=W(tg,ug,c?void 0:Ag.domain()),a=ab(),b=yh?yh:c?void 0:Bg.tickValues(),Bg=Z(vg,$i,a,b),Eg=Z(yg,bj,a,b),Cg=$(wg,_i,Mh,Oh),Dg=$(xg,aj,Vh,Xh),c||(lj.scale(yg),Rf&&pj.scale(vg)),U()}function U(){jg=Hb(),kg=Ib(),lg=Ib(.98)}function V(a,b,c,d){var e,f=(Mi?Hf.time.scale():Hf.scale.linear()).range([a,b]),g=c?f.domain(c):f;Ni?(d=d||function(){return 0},f=function(a){return Math.ceil(g(a)+d(a))}):f=function(a){return Math.ceil(g(a))};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return xj&&xj[0]===a[0]&&xj[1]a?a.toFixed(0):a};return th&&("function"==typeof th?a=th:Mi&&(a=function(a){return a?Wi(th)(a):""})),a}function bb(a){var b;return"y"===a?b=Kh:"y2"===a?b=Th:"x"===a&&(b=Fh),b}function cb(a){var b=bb(a);return"string"==typeof b?b:b?b.text:null}function db(a,b){var c=bb(a);"string"==typeof c?"y"===a?Kh=b:"y2"===a?Th=b:"x"===a&&(Fh=b):c&&(c.text=b)}function eb(a){return 10*Math.sin(Math.PI*(a/180))}function fb(a){return 11.5-2.5*(a/15)}function gb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",fb(c)).attr("x",eb(c)).attr("transform","rotate("+c+")")}function hb(a,b){var c=bb(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 ib(){return hb("x",nh?"inner-top":"inner-right")}function jb(){return hb("y",nh?"inner-right":"inner-top")}function kb(){return hb("y2",nh?"inner-right":"inner-top")}function lb(a){return"y2"===a?kb():"y"===a?jb():ib()}function mb(){return cb("x")}function nb(){return cb("y")}function ob(){return cb("y2")}function pb(a,b){return a?b.isLeft?0:b.isCenter?ag/2:ag:b.isBottom?-cg:b.isMiddle?-cg/2:0}function qb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function rb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function sb(){return pb(!nh,ib())}function tb(){return pb(nh,jb())}function ub(){return pb(nh,kb())}function vb(){return qb(!nh,ib())}function wb(){return qb(nh,jb())}function xb(){return qb(nh,kb())}function yb(){var a=ib();return nh?a.isInner?"1.2em":-25-Eb("x"):a.isInner?"-0.5em":Dh?Dh-10:"3em"}function zb(){var a=jb();return nh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Eb("y")}function Ab(){var a=kb();return nh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Eb("y2")}function Bb(){return rb(!nh,ib())}function Cb(){return rb(nh,jb())}function Db(){return rb(nh,kb())}function Eb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Hf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Fb(a){var b=sj.select("."+g.axisX+" ."+g.axisXLabel),c=sj.select("."+g.axisY+" ."+g.axisYLabel),d=sj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb),(a?c.transition():c).attr("x",tb).attr("dx",wb).attr("dy",zb).attr("dy",zb).text(nb),(a?d.transition():d).attr("x",ub).attr("dx",xb).attr("dy",Ab).text(ob)}function Gb(a){var b=!1;return mg(Jc(If.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Hb(){var a=Hf.svg.arc().outerRadius(gg).innerRadius(ig),b=function(b,c){var d;return c?a(b):(d=Gb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Ib(a){var b=Hf.svg.arc().outerRadius(hg*(a?a:1)).innerRadius(ig);return function(a){var c=Gb(a);return c?b(c):"M 0 0"}}function Jb(a,b){return qe(a.data)?jg(a,b):"M 0 0"}function Kb(a){var b,c,d,e,f=Gb(a),g="";return f&&(b=jg.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*gg*.8+","+d/e*gg*.8+")"),g}function Lb(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Mb(a){return qc({id:a.data.id,value:a.value,ratio:Lb(a)})}function Nb(a){var b,c,d,e;return Qb()?(b=Gb(a),c=b?b.value:null,d=Lb(b),e=Rb(),e?e(c,d):Ed(c,d)):""}function Ob(a,b){var c=qj.selectAll("."+g.chartArc+qd(a)),d=qj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});we(a)&&c.selectAll("path").transition().duration(50).attr("d",kg).transition().duration(100).attr("d",lg).each(function(a){pe(a.data)}),b||d.style("opacity",.3)}function Pb(a){var b=qj.selectAll("."+g.chartArc+qd(a));b.selectAll("path").transition().duration(50).attr("d",jg),qj.selectAll("."+g.arc).style("opacity",1)}function Qb(){return ie(If.data.targets)?ri:li}function Rb(){return ie(If.data.targets)?si:mi}function Sb(){return ie(If.data.targets)?ui:""}function Tb(){var a=ie(If.data.targets)?vi:oi;return"function"==typeof a?a:function(){}}function Ub(){var a=ie(If.data.targets)?wi:pi;return"function"==typeof a?a:function(){}}function Vb(){var a=ie(If.data.targets)?xi:qi;return"function"==typeof a?a:function(){}}function Wb(a){var b,c,d,e,f,g,h=Dc(a),i=Qc(a);if(Lg.length>0)for(g=Sc(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 Hf.min(Object.keys(i).map(function(a){return Hf.min(i[a])}))}function Xb(a){var b,c,d,e,f,g,h=Dc(a),i=Qc(a);if(Lg.length>0)for(g=Tc(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 Hf.max(Object.keys(i).map(function(a){return Hf.max(i[a])}))}function Yb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return _(a.id)===c}),m="y2"===c?Rh:Ih,n="y2"===c?Qh:Hh,o=b(m)?m:Wb(l),p=b(n)?n:Xb(l),q="y2"===c?Sh:Jh,r=yd()&&nh;return 0===l.length?"y2"===c?xg.domain():wg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=zd(o,p),j=bc(wg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Nh&&(f=b(Nh.top)?Nh.top:e,g=b(Nh.bottom)?Nh.bottom:e),"y2"===c&&Wh&&(f=b(Wh.top)?Wh.top:e,g=b(Wh.bottom)?Wh.bottom:e),fe(l)&&!Sc(l)&&(g=o),[o-g,p+f])}function Zb(a){return Bh?Mi?ye(Bh):Bh:Hf.min(a,function(a){return Hf.min(a.values,function(a){return a.x})})}function $b(a){return Ah?Mi?ye(Ah):Ah:Hf.max(a,function(a){return Hf.max(a.values,function(a){return a.x})})}function _b(a){var c,d,e,f,g=Cc(a),h=g[1]-g[0];return Ni?d=0:fe(a)?(c=Ac(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Ch&&De(Ch)?(e=b(Ch.left)?Ch.left:d,f=b(Ch.right)?Ch.right:d):e=f="number"==typeof Ch?Ch:d,{left:e,right:f}}function ac(a){var b=[Zb(a),$b(a)],c=b[0],d=b[1],e=_b(a),f=0,g=0;return c-d!==0||Ni||(c=Mi?new Date(.5*c.getTime()):-.5,d=Mi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Mi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Mi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function bc(a){return a[1]-a[0]}function cc(a){for(var b=0;bb?0:b-c}function ic(a){var b,c=gc(a),d="y"===a.axis?wg:xg;return b="y"===a.axis||"y2"===a.axis?nh?cg:"start"in a?d(a.start):cg:nh?"end"in a?vg(Mi?ye(a.end):a.end):cg:cg,c>b?0:b-c}function jc(a){return Fg&&a===Fg||De(Gg)&&Ee(Gg,a)}function kc(a){return!jc(a)}function lc(a){return Fg?Fg:De(Gg)?Gg[a]:null}function mc(a,b){var c,d=b&&De(b)?Dc(b):[];return d.forEach(function(b){lc(b)===a&&(c=If.data.xs[b])}),c}function nc(a,b){return a in If.data.xs&&If.data.xs[a]&&If.data.xs[a][b]?If.data.xs[a][b]:b}function oc(a){Object.keys(a).forEach(function(b){Gg[b]=a[b]})}function pc(a){return 1===Hf.set(Object.keys(a).map(function(b){return a[b]})).size()}function qc(a){var b;return a&&(b=Jg[a.id],a.name=b?b:a.id),a}function rc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=tc(b[d],a.id,d)}),If.data.xs[a.id]=b})}function sc(a,b){a.forEach(function(a){b[a.id]&&rc([a],b[a.id])})}function tc(a,c,d){var e;return e=Mi?a?a instanceof Date?a:ye(a):ye(nc(c,d)):Oi&&!Ni?b(a)?+a:nc(c,d):d}function uc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?If.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Fg?(d=Object.keys(If.data.xs),If.data.xs[c]=d.length>0?If.data.xs[d[0]]:void 0):De(Gg)&&(If.data.xs[c]=mc(f,If.data.targets)):If.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!If.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Ig(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=lc(b),g=a[f],h=tc(g,b,e);return Oi&&Ni&&0===c&&g&&(0===e&&(rh=[]),rh.push(g)),("undefined"==typeof a[b]||If.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ng&&de(Dc(c).filter(function(a){return!(a in Og)}),Ng),c.forEach(function(a){dc(a.id_org,a)}),c}function xc(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 yc(a){return a>0&&If.data.targets[0].values[a-1]?If.data.targets[0].values[a-1].x:void 0}function zc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Cc(a){var b,c,d=Bc(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Dc(a){return a.map(function(a){return a.id})}function Ec(a){return a?"string"==typeof a?[a]:a:Dc(If.data.targets)}function Fc(a,b){var c,d=Dc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Mi?new Date(i):i);j.push(e)}return Mi||(j=j.sort(function(a,b){return a-b})),j}function Mc(a){Yi=Yi.concat(a)}function Nc(a){Yi=Yi.filter(function(b){return a.indexOf(b)<0})}function Oc(a){Zi=Zi.concat(a)}function Pc(a){Zi=Zi.filter(function(b){return a.indexOf(b)<0})}function Qc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Rc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Tc(a){return Rc(a,function(a){return a>0})}function Uc(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||0===a[f].x)&&(e=e.concat(Kd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Kd(a,g))),Nd(e,b)):Ld(a,b,f,g)}function Md(a,b){var c;return c=a.map(function(a){return Ld(a.values,b)}),Nd(c,b)}function Nd(a,b){var c,d;return a.forEach(function(a){var e=Fe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Od(a,b){return Hf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Pd(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 Qd(){return Qg&&"desc"===Qg.toLowerCase()}function Rd(){return Qg&&"asc"===Qg.toLowerCase()}function Sd(a){var b=Rd(),c=Qd();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 Qg&&a.sort(Qg),a}function Td(a,c){var d,e,f,g,h,i,j,k=je(If.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&zi&&(vj.html(Ci(a,ab(),Ad(k),Vi)).style("display","block"),d=vj.property("offsetWidth"),e=vj.property("offsetHeight"),k?(g=ag/2+c[0],i=cg/2+c[1]+20):(nh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-w(),i=vg(l[0].x)+20):(f=s(),g=f+v()+vg(l[0].x)+20,h=g+d,j=f+t()-w(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),vj.style("top",i+"px").style("left",g+"px"))}function Ud(){vj.style("display","none")}function Vd(a){var c=a.filter(function(a){return a&&b(a.value)});if(zi&&!ge(If.data.targets)&&!je(If.data.targets)){var d=sj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(nh?"y1":"x1",Gd).attr(nh?"y2":"x2",Gd),lf(d,"grid")}}function Wd(){sj.select("line."+g.xgridFocus).style("visibility","hidden")}function Xd(a,b){var c,d,e,f,h=[],i=sj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=ac(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function Yd(a){return a.x||0===a.x?vg(a.x):null}function Zd(a){return X(a.id)(a.value)}function $d(){var a,b,d={},e=0;return Jc(Gc(me)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ce(a,b){return"number"==typeof ji?ji:b?2*a.tickOffset()*ki/b:0}function de(a,b){Ec(a).forEach(function(a){zj[a]=b===Og[a],Og[a]=b})}function ee(a,b){var c=!1;return a.forEach(function(a){Og[a.id]===b&&(c=!0),a.id in Og||"line"!==b||(c=!0)}),c}function fe(a){return ee(a,"bar")}function ge(a){return ee(a,"scatter")}function he(a){return ee(a,"pie")}function ie(a){return ee(a,"donut")}function je(a){return he(a)||ie(a)}function ke(a){var b="string"==typeof a?a:a.id;return!(b in Og)||"line"===Og[b]||"spline"===Og[b]||"area"===Og[b]||"area-spline"===Og[b]}function le(a){var b="string"==typeof a?a:a.id;return"spline"===Og[b]||"area-spline"===Og[b]}function me(a){var b="string"==typeof a?a:a.id;return"bar"===Og[b]}function ne(a){var b="string"==typeof a?a:a.id;return"scatter"===Og[b]}function oe(a){var b="string"==typeof a?a:a.id;return"pie"===Og[b]}function pe(a){var b="string"==typeof a?a:a.id;return"donut"===Og[b]}function qe(a){return oe(a)||pe(a)}function re(a){return ke(a)?[a]:[]}function se(a){return qe(a.data)?[a]:[]}function te(a){return me(a)?a.values:[]}function ue(a){return ke(a)||ne(a)?a.values:[]}function ve(a){return me(a)||ke(a)?a.values:[]}function we(a){return pe(a)&&ti||oe(a)&&ni}function xe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ye(b){var c;try{c=Hg?Hf.time.format(Hg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Hg)}return c}function ze(a,b){var c=Hf.mouse(a),d=Hf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ee(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Fe(a,b){var c="y"===_(a.id)?wg:xg,d=nh?1:0,e=nh?0:1;return Math.pow(vg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ge(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function He(a,b,c){ah(b,a.node()),sj.select("."+g.selectedCircles+pd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Vc(g.selectedCircle,c)}).attr("cx",nh?Zd:Yd).attr("cy",nh?Yd:Zd).attr("stroke",function(){return Vi(b)}).attr("r",1.4*Se(b)).transition().duration(100).attr("r",Se)}function Ie(a,b,c){bh(b,a.node()),sj.select("."+g.selectedCircles+pd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Je(a,b,c,d){a?He(b,c,d):Ie(b,c,d)}function Ke(a,b){ah(b,a.node()),a.transition().duration(100).style("fill",function(){return Hf.rgb(Vi(b)).brighter(.75)})}function Le(a,b){bh(b,a.node()),a.transition().duration(100).style("fill",function(){return Vi(b)})}function Me(a,b,c,d){a?Ke(b,c,d):Le(b,c,d)}function Ne(a,b,c,d){Me(a,b,c.data,d)}function Oe(a){return"circle"===a.nodeName?Je:Hf.select(a).classed(g.bar)?Me:Ne}function Pe(a){return a.filter(function(a){return b(a.value)})}function Qe(a){return ci?"function"==typeof di?di(a):di:0}function Re(a){return fi?gi?gi:1.75*Qe(a):Qe(a)}function Se(a){return hi?hi:4*Qe(a)}function Te(a,c){return(c?sj.selectAll("."+g.circles+pd(c)):sj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ue(a,b){Te(a,b).classed(g.EXPANDED,!0).attr("r",Re)}function Ve(a){Te(a).filter(function(){return Hf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Qe)}function We(a){return sj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function Xe(a){We(a).classed(g.EXPANDED,!0)}function Ye(a){We(a).classed(g.EXPANDED,!1)}function Ze(a,b){var c=bf(a,b);return function(a,b){var d=c(a,b),e=nh?1:0,f=nh?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 $e(a,b){var c=bf(a,!1),d=b?_e:af;return function(a,b){return d(c(a,b),a,this)}}function _e(a,b){var c;return nh?(c=me(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function af(a,b,c){var d=c.getBoundingClientRect();return nh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:me(b)?-3:-6)}function bf(a,b){var c=a.__max__+1,d=ce(Bg,c),e=_d(d,c,a,!!b),f=ae(!!b),g=be(a,!!b),h=b?Y:X;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return nh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function cf(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;gb?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&aag&&(ag=0),0>cg&&(cg=0),bg=nh?Zf.left-ij-jj:ag,dg=nh?cg:fg-$f.top-$f.bottom,0>bg&&(bg=0),0>dg&&(dg=0),r(),dj&&je(If.data.targets)&&(_f.left=ag/2+hg)}function q(){sj.select("line."+g.xgridFocus).attr("x1",nh?0:-10).attr("x2",nh?ag:-10).attr("y1",nh?-10:Zf.top).attr("y2",nh?-10:cg)}function r(){hg=cg/2,gg=.95*hg,ig=ie(If.data.targets)?.6*gg:0}function s(){var a=nh?g.axisX:g.axisY,b=sj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Hf.select(Kf).node().getBoundingClientRect(),e=c.right-d.left-v();return e>0?e:0}function t(){return Lf?Lf:z()}function u(){var a=Mf?Mf:A();return a>0?a:320}function v(){return je(If.data.targets)?0:Nf?Nf:nh?oh?x("x"):1:!Gh||Lh?1:x("y")}function w(){var a=1;return je(If.data.targets)?0:Of?Of:dj?R()+20+(Ph&&!nh?x("y2"):a):Ph?Uh||nh?a:x("y2"):a}function x(a){var b=lb(a);return b.isInner?20+Eb(a):40+Eb(a)}function y(a){return"x"!==a||oh?"x"===a&&Dh?Dh:"y"!==a||Gh?"y2"!==a||Ph?(lb(a).isInner?30:40)+("y2"===a?-10:0):kj:hh&&!dj?10:1:0}function z(){return+Hf.select(Kf).style("width").replace("px","")}function A(){return+Hf.select(Kf).style("height").replace("px","")}function B(a){return a?-31:-(Zf.left-1)}function C(a){return a?-20:-4}function D(){return B(!nh)}function E(){return C(!nh)}function F(){return B(nh)}function G(){return C(nh)}function H(a){return a?ag+2+30+30:Zf.left+20}function I(a){return a?(Dh?Dh:0)+80:cg+8}function J(){return H(!nh)}function K(){return I(!nh)}function L(){return H(nh)}function M(){return I(nh)}function N(){var a,b,c,d,e,f=Bc(If.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=vg(b.x)-vg(a.x),0===c?nh?cg:ag:(d=Ac(),e=fe(If.data.targets)?(d-(Ni?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function O(a){ej=a}function P(a){fj=a}function Q(a){gj=a}function R(){return hh?dj?fj*(ej+1):eg:0}function S(){return hh?dj?fg:gj*(ej+1):0}function T(){var a,b,c=!vg;ng=nh?1:0,og=nh?cg:ag,pg=nh?0:cg,qg=nh?ag:1,rg=ng,sg=og,tg=nh?0:dg,ug=nh?bg:1,vg=V(ng,og,c?void 0:vg.domain(),function(){return Bg.tickOffset()}),wg=W(pg,qg,c?void 0:wg.domain()),xg=W(pg,qg,c?void 0:xg.domain()),yg=V(ng,og,xj,function(a){return a%1?0:Eg.tickOffset()}),zg=W(tg,ug,c?void 0:zg.domain()),Ag=W(tg,ug,c?void 0:Ag.domain()),a=ab(),b=yh?yh:c?void 0:Bg.tickValues(),Bg=Z(vg,$i,a,b),Eg=Z(yg,bj,a,b),Cg=$(wg,_i,Mh,Oh),Dg=$(xg,aj,Vh,Xh),c||(lj.scale(yg),Rf&&pj.scale(vg)),U()}function U(){jg=Hb(),kg=Ib(),lg=Ib(.98)}function V(a,b,c,d){var e,f=(Mi?Hf.time.scale():Hf.scale.linear()).range([a,b]),g=c?f.domain(c):f;Ni?(d=d||function(){return 0},f=function(a){return Math.ceil(g(a)+d(a))}):f=function(a){return Math.ceil(g(a))};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return xj&&xj[0]===a[0]&&xj[1]a?a.toFixed(0):a};return th&&("function"==typeof th?a=th:Mi&&(a=function(a){return a?Wi(th)(a):""})),a}function bb(a){var b;return"y"===a?b=Kh:"y2"===a?b=Th:"x"===a&&(b=Fh),b}function cb(a){var b=bb(a);return"string"==typeof b?b:b?b.text:null}function db(a,b){var c=bb(a);"string"==typeof c?"y"===a?Kh=b:"y2"===a?Th=b:"x"===a&&(Fh=b):c&&(c.text=b)}function eb(a){return 10*Math.sin(Math.PI*(a/180))}function fb(a){return 11.5-2.5*(a/15)}function gb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",fb(c)).attr("x",eb(c)).attr("transform","rotate("+c+")")}function hb(a,b){var c=bb(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 ib(){return hb("x",nh?"inner-top":"inner-right")}function jb(){return hb("y",nh?"inner-right":"inner-top")}function kb(){return hb("y2",nh?"inner-right":"inner-top")}function lb(a){return"y2"===a?kb():"y"===a?jb():ib()}function mb(){return cb("x")}function nb(){return cb("y")}function ob(){return cb("y2")}function pb(a,b){return a?b.isLeft?0:b.isCenter?ag/2:ag:b.isBottom?-cg:b.isMiddle?-cg/2:0}function qb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function rb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function sb(){return pb(!nh,ib())}function tb(){return pb(nh,jb())}function ub(){return pb(nh,kb())}function vb(){return qb(!nh,ib())}function wb(){return qb(nh,jb())}function xb(){return qb(nh,kb())}function yb(){var a=ib();return nh?a.isInner?"1.2em":-25-Eb("x"):a.isInner?"-0.5em":Dh?Dh-10:"3em"}function zb(){var a=jb();return nh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Eb("y")}function Ab(){var a=kb();return nh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Eb("y2")}function Bb(){return rb(!nh,ib())}function Cb(){return rb(nh,jb())}function Db(){return rb(nh,kb())}function Eb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Hf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Fb(a){var b=sj.select("."+g.axisX+" ."+g.axisXLabel),c=sj.select("."+g.axisY+" ."+g.axisYLabel),d=sj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb),(a?c.transition():c).attr("x",tb).attr("dx",wb).attr("dy",zb).attr("dy",zb).text(nb),(a?d.transition():d).attr("x",ub).attr("dx",xb).attr("dy",Ab).text(ob)}function Gb(a){var b=!1;return mg(Jc(If.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Hb(){var a=Hf.svg.arc().outerRadius(gg).innerRadius(ig),b=function(b,c){var d;return c?a(b):(d=Gb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Ib(a){var b=Hf.svg.arc().outerRadius(hg*(a?a:1)).innerRadius(ig);return function(a){var c=Gb(a);return c?b(c):"M 0 0"}}function Jb(a,b){return qe(a.data)?jg(a,b):"M 0 0"}function Kb(a){var b,c,d,e,f=Gb(a),g="";return f&&(b=jg.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*gg*.8+","+d/e*gg*.8+")"),g}function Lb(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Mb(a){return qc({id:a.data.id,value:a.value,ratio:Lb(a)})}function Nb(a){var b,c,d,e;return Qb()?(b=Gb(a),c=b?b.value:null,d=Lb(b),e=Rb(),e?e(c,d):Ed(c,d)):""}function Ob(a,b){var c=qj.selectAll("."+g.chartArc+qd(a)),d=qj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});we(a)&&c.selectAll("path").transition().duration(50).attr("d",kg).transition().duration(100).attr("d",lg).each(function(a){pe(a.data)}),b||d.style("opacity",.3)}function Pb(a){var b=qj.selectAll("."+g.chartArc+qd(a));b.selectAll("path").transition().duration(50).attr("d",jg),qj.selectAll("."+g.arc).style("opacity",1)}function Qb(){return ie(If.data.targets)?ri:li}function Rb(){return ie(If.data.targets)?si:mi}function Sb(){return ie(If.data.targets)?ui:""}function Tb(){var a=ie(If.data.targets)?vi:oi;return"function"==typeof a?a:function(){}}function Ub(){var a=ie(If.data.targets)?wi:pi;return"function"==typeof a?a:function(){}}function Vb(){var a=ie(If.data.targets)?xi:qi;return"function"==typeof a?a:function(){}}function Wb(a){var b,c,d,e,f,g,h=Dc(a),i=Qc(a);if(Lg.length>0)for(g=Sc(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 Hf.min(Object.keys(i).map(function(a){return Hf.min(i[a])}))}function Xb(a){var b,c,d,e,f,g,h=Dc(a),i=Qc(a);if(Lg.length>0)for(g=Tc(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 Hf.max(Object.keys(i).map(function(a){return Hf.max(i[a])}))}function Yb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return _(a.id)===c}),m="y2"===c?Rh:Ih,n="y2"===c?Qh:Hh,o=b(m)?m:Wb(l),p=b(n)?n:Xb(l),q="y2"===c?Sh:Jh,r=yd()&&nh;return 0===l.length?"y2"===c?xg.domain():wg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=zd(o,p),j=bc(wg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Nh&&(f=b(Nh.top)?Nh.top:e,g=b(Nh.bottom)?Nh.bottom:e),"y2"===c&&Wh&&(f=b(Wh.top)?Wh.top:e,g=b(Wh.bottom)?Wh.bottom:e),fe(l)&&!Sc(l)&&(g=o),[o-g,p+f])}function Zb(a){return Bh?Mi?ye(Bh):Bh:Hf.min(a,function(a){return Hf.min(a.values,function(a){return a.x})})}function $b(a){return Ah?Mi?ye(Ah):Ah:Hf.max(a,function(a){return Hf.max(a.values,function(a){return a.x})})}function _b(a){var c,d,e,f,g=Cc(a),h=g[1]-g[0];return Ni?d=0:fe(a)?(c=Ac(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Ch&&De(Ch)?(e=b(Ch.left)?Ch.left:d,f=b(Ch.right)?Ch.right:d):e=f="number"==typeof Ch?Ch:d,{left:e,right:f}}function ac(a){var b=[Zb(a),$b(a)],c=b[0],d=b[1],e=_b(a),f=0,g=0;return c-d!==0||Ni||(c=Mi?new Date(.5*c.getTime()):-.5,d=Mi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Mi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Mi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function bc(a){return a[1]-a[0]}function cc(a){for(var b=0;bb?0:b-c}function ic(a){var b,c=gc(a),d="y"===a.axis?wg:xg;return b="y"===a.axis||"y2"===a.axis?nh?cg:"start"in a?d(a.start):cg:nh?"end"in a?vg(Mi?ye(a.end):a.end):cg:cg,c>b?0:b-c}function jc(a){return Fg&&a===Fg||De(Gg)&&Ee(Gg,a)}function kc(a){return!jc(a)}function lc(a){return Fg?Fg:De(Gg)?Gg[a]:null}function mc(a,b){var c,d=b&&De(b)?Dc(b):[];return d.forEach(function(b){lc(b)===a&&(c=If.data.xs[b])}),c}function nc(a,b){return a in If.data.xs&&If.data.xs[a]&&If.data.xs[a][b]?If.data.xs[a][b]:b}function oc(a){Object.keys(a).forEach(function(b){Gg[b]=a[b]})}function pc(a){return 1===Hf.set(Object.keys(a).map(function(b){return a[b]})).size()}function qc(a){var b;return a&&(b=Jg[a.id],a.name=b?b:a.id),a}function rc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=tc(b[d],a.id,d)}),If.data.xs[a.id]=b})}function sc(a,b){a.forEach(function(a){b[a.id]&&rc([a],b[a.id])})}function tc(a,c,d){var e;return e=Mi?a?a instanceof Date?a:ye(a):ye(nc(c,d)):Oi&&!Ni?b(a)?+a:nc(c,d):d}function uc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?If.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Fg?(d=Object.keys(If.data.xs),If.data.xs[c]=d.length>0?If.data.xs[d[0]]:void 0):De(Gg)&&(If.data.xs[c]=mc(f,If.data.targets)):If.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!If.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Ig(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=lc(b),g=a[f],h=tc(g,b,e);return Oi&&Ni&&0===c&&g&&(0===e&&(rh=[]),rh.push(g)),("undefined"==typeof a[b]||If.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ng&&de(Dc(c).filter(function(a){return!(a in Og)}),Ng),c.forEach(function(a){dc(a.id_org,a)}),c}function xc(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 yc(a){return a>0&&If.data.targets[0].values[a-1]?If.data.targets[0].values[a-1].x:void 0}function zc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Cc(a){var b,c,d=Bc(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Dc(a){return a.map(function(a){return a.id})}function Ec(a){return a?"string"==typeof a?[a]:a:Dc(If.data.targets)}function Fc(a,b){var c,d=Dc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Mi?new Date(i):i);j.push(e)}return Mi||(j=j.sort(function(a,b){return a-b})),j}function Mc(a){Yi=Yi.concat(a)}function Nc(a){Yi=Yi.filter(function(b){return a.indexOf(b)<0})}function Oc(a){Zi=Zi.concat(a)}function Pc(a){Zi=Zi.filter(function(b){return a.indexOf(b)<0})}function Qc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Rc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Tc(a){return Rc(a,function(a){return a>0})}function Uc(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||0===a[f].x)&&(e=e.concat(Kd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Kd(a,g))),Nd(e,b)):Ld(a,b,f,g)}function Md(a,b){var c;return c=a.map(function(a){return Ld(a.values,b)}),Nd(c,b)}function Nd(a,b){var c,d;return a.forEach(function(a){var e=Fe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Od(a,b){return Hf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Pd(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 Qd(){return Qg&&"desc"===Qg.toLowerCase()}function Rd(){return Qg&&"asc"===Qg.toLowerCase()}function Sd(a){var b=Rd(),c=Qd();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 Qg&&a.sort(Qg),a}function Td(a,c){var d,e,f,g,h,i,j,k=je(If.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&zi&&(vj.html(Ci(a,ab(),Ad(k),Vi)).style("display","block"),d=vj.property("offsetWidth"),e=vj.property("offsetHeight"),k?(g=ag/2+c[0],i=cg/2+c[1]+20):(nh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-w(),i=vg(l[0].x)+20):(f=s(),g=f+v()+vg(l[0].x)+20,h=g+d,j=f+t()-w(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),vj.style("top",i+"px").style("left",g+"px"))}function Ud(){vj.style("display","none")}function Vd(a){var c=a.filter(function(a){return a&&b(a.value)});if(zi&&!ge(If.data.targets)&&!je(If.data.targets)){var d=sj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(nh?"y1":"x1",Gd).attr(nh?"y2":"x2",Gd),lf(d,"grid")}}function Wd(){sj.select("line."+g.xgridFocus).style("visibility","hidden")}function Xd(a,b){var c,d,e,f,h=[],i=sj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=ac(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function Yd(a){return a.x||0===a.x?vg(a.x):null}function Zd(a){return X(a.id)(a.value)}function $d(){var a,b,d={},e=0;return Jc(Gc(me)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ce(a,b){return"number"==typeof ji?ji:b?2*a.tickOffset()*ki/b:0}function de(a,b){Ec(a).forEach(function(a){zj[a]=b===Og[a],Og[a]=b})}function ee(a,b){var c=!1;return a.forEach(function(a){Og[a.id]===b&&(c=!0),a.id in Og||"line"!==b||(c=!0)}),c}function fe(a){return ee(a,"bar")}function ge(a){return ee(a,"scatter")}function he(a){return ee(a,"pie")}function ie(a){return ee(a,"donut")}function je(a){return he(a)||ie(a)}function ke(a){var b="string"==typeof a?a:a.id;return!(b in Og)||"line"===Og[b]||"spline"===Og[b]||"area"===Og[b]||"area-spline"===Og[b]}function le(a){var b="string"==typeof a?a:a.id;return"spline"===Og[b]||"area-spline"===Og[b]}function me(a){var b="string"==typeof a?a:a.id;return"bar"===Og[b]}function ne(a){var b="string"==typeof a?a:a.id;return"scatter"===Og[b]}function oe(a){var b="string"==typeof a?a:a.id;return"pie"===Og[b]}function pe(a){var b="string"==typeof a?a:a.id;return"donut"===Og[b]}function qe(a){return oe(a)||pe(a)}function re(a){return ke(a)?[a]:[]}function se(a){return qe(a.data)?[a]:[]}function te(a){return me(a)?a.values:[]}function ue(a){return ke(a)||ne(a)?a.values:[]}function ve(a){return me(a)||ke(a)?a.values:[]}function we(a){return pe(a)&&ti||oe(a)&&ni}function xe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ye(b){var c;try{c=Hg?Hf.time.format(Hg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Hg)}return c}function ze(a,b){var c=Hf.mouse(a),d=Hf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ee(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Fe(a,b){var c="y"===_(a.id)?wg:xg,d=nh?1:0,e=nh?0:1;return Math.pow(vg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ge(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function He(a,b,c){ah(b,a.node()),sj.select("."+g.selectedCircles+pd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Vc(g.selectedCircle,c)}).attr("cx",nh?Zd:Yd).attr("cy",nh?Yd:Zd).attr("stroke",function(){return Vi(b)}).attr("r",1.4*Se(b)).transition().duration(100).attr("r",Se)}function Ie(a,b,c){bh(b,a.node()),sj.select("."+g.selectedCircles+pd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Je(a,b,c,d){a?He(b,c,d):Ie(b,c,d)}function Ke(a,b){ah(b,a.node()),a.transition().duration(100).style("fill",function(){return Hf.rgb(Vi(b)).brighter(.75)})}function Le(a,b){bh(b,a.node()),a.transition().duration(100).style("fill",function(){return Vi(b)})}function Me(a,b,c,d){a?Ke(b,c,d):Le(b,c,d)}function Ne(a,b,c,d){Me(a,b,c.data,d)}function Oe(a){return"circle"===a.nodeName?Je:Hf.select(a).classed(g.bar)?Me:Ne}function Pe(a){return a.filter(function(a){return b(a.value)})}function Qe(a){return ci?"function"==typeof di?di(a):di:0}function Re(a){return fi?gi?gi:1.75*Qe(a):Qe(a)}function Se(a){return hi?hi:4*Qe(a)}function Te(a,c){return(c?sj.selectAll("."+g.circles+pd(c)):sj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ue(a,b){Te(a,b).classed(g.EXPANDED,!0).attr("r",Re)}function Ve(a){Te(a).filter(function(){return Hf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Qe)}function We(a){return sj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function Xe(a){We(a).classed(g.EXPANDED,!0)}function Ye(a){We(a).classed(g.EXPANDED,!1)}function Ze(a,b){var c=bf(a,b);return function(a,b){var d=c(a,b),e=nh?1:0,f=nh?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 $e(a,b){var c=bf(a,!1),d=b?_e:af;return function(a,b){return d(c(a,b),a,this)}}function _e(a,b){var c;return nh?(c=me(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function af(a,b,c){var d=c.getBoundingClientRect();return nh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:me(b)?-3:-6)}function bf(a,b){var c=a.__max__+1,d=ce(Bg,c),e=_d(d,c,a,!!b),f=ae(!!b),g=be(a,!!b),h=b?Y:X;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return nh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function cf(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 df(b){var c,d,e;if(wj=Hf.select(Kf),wj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(wj.html("").classed("c3",!0),If.data.xs={},If.data.targets=wc(b),Ug&&Mc(Ug===!0?Dc(If.data.targets):Ug),p(),T(),vg.domain(Hf.extent(ac(If.data.targets))),wg.domain(Yb(If.data.targets,"y")),xg.domain(Yb(If.data.targets,"y2")),yg.domain(vg.domain()),zg.domain(wg.domain()),Ag.domain(xg.domain()),xj=vg.domain(),lj.scale(yg),Rf&&pj.scale(vg),qj=wj.append("svg").on("mouseenter",Uf).on("mouseleave",Vf),rj=qj.append("defs"),rj.append("clipPath").attr("id",Gi).append("rect"),rj.append("clipPath").attr("id",Hi).append("rect"),rj.append("clipPath").attr("id",Ii).append("rect"),qf(),sj=qj.append("g").attr("transform",cj.main),tj=qj.append("g").attr("transform",cj.context),uj=qj.append("g").attr("transform",cj.legend),eh||tj.style("visibility","hidden"),hh||(uj.style("visibility","hidden"),Zi=Dc(If.data.targets)),vj=Hf.select(Kf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Cf(Dc(If.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=sj.append("g").attr("clip-path",Ji).attr("class",g.grid),Yh&&d.append("g").attr("class",g.xgrids),De($h)&&d.append("g").attr("class",g.xgridLines),ei&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),_h&&d.append("g").attr("class",g.ygrids),De(ai)&&d.append("g").attr("class",g.ygridLines),sj.append("g").attr("clip-path",Ji).attr("class",g.regions),sj.append("g").attr("clip-path",Ji).attr("class",g.chart),c=sj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Rf?nh?"ns-resize":"ew-resize":null),sj.select("."+g.chart).append("g").attr("class",g.chartBars),sj.select("."+g.chart).append("g").attr("class",g.chartLines),sj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",cj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Sb()),sj.select("."+g.chart).append("g").attr("class",g.chartTexts),Rf&&sj.insert("rect",Tf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",ag).attr("height",cg).style("opacity",0).style("cursor",nh?"ns-resize":"ew-resize").call(pj).on("dblclick.zoom",null),Eh&&lj.extent("function"!=typeof Eh?Eh:Eh(ac())),oh&&sj.append("g").attr("class",g.axisX).attr("clip-path",Ki).attr("transform",cj.x).append("text").attr("class",g.axisXLabel).attr("transform",nh?"rotate(-90)":"").style("text-anchor",Bb),Gh&&sj.append("g").attr("class",g.axisY).attr("clip-path",Li).attr("transform",cj.y).append("text").attr("class",g.axisYLabel).attr("transform",nh?"":"rotate(-90)").style("text-anchor",Cb),Ph&&sj.append("g").attr("class",g.axisY2).attr("transform",cj.y2).append("text").attr("class",g.axisY2Label).attr("transform",nh?"":"rotate(-90)").style("text-anchor",Db),tj.append("g").attr("clip-path",Ji).attr("class",g.chart),tj.select("."+g.chart).append("g").attr("class",g.chartBars),tj.select("."+g.chart).append("g").attr("class",g.chartLines),tj.append("g").attr("clip-path",Ji).attr("class",g.brush).call(lj).selectAll("rect").attr(nh?"width":"height",nh?bg:dg),tj.append("g").attr("class",g.axisX).attr("transform",cj.subx).attr("clip-path",nh?"":Ki),sf(If.data.targets),nh?sj.select("."+g.axisX).style("opacity",0).call(Bg):(sj.select("."+g.axisY).style("opacity",0).call(Cg),sj.select("."+g.axisY2).style("opacity",0).call(Dg)),p(),T(),qf(),o(!1),mf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Di){if(Mi&&"string"==typeof Ei){for(Ei=ye(Ei),e=0;e0){d=[];for(var f in Jg)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Pd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Me,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function jf(a){je(If.data.targets)||Vg&&(Pi=a,sj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Qi=!0,ch())}function kf(){je(If.data.targets)||Vg&&(sj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),sj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Qi=!1,dh())}function lf(a,b){"grid"===b&&a.each(function(){var a=Hf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function mf(a){var c,e,f,h,i,j,k,l,m,n,o,p,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,O,P,Q,R,S,T,U,V,W,X,Y,Z,$,_=$d(),ab=je(If.data.targets),bb=Jc(If.data.targets);if(a=d(a)?a:{},G=d(a.withY)?a.withY:!0,H=d(a.withSubchart)?a.withSubchart:!0,I=d(a.withTransition)?a.withTransition:!0,L=d(a.withTransform)?a.withTransform:!1,M=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,O=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,P=d(a.withLegend)?a.withLegend:!1,J=d(a.withTransitionForExit)?a.withTransitionForExit:I,K=d(a.withTransitionForAxis)?a.withTransitionForAxis:I,V=I?Yf:0,W=J?V:0,X=K?V:0,c=sj.select("."+g.axisX).style("opacity",ab?0:1),f=sj.select("."+g.axisY).style("opacity",ab?0:1),h=sj.select("."+g.axisY2).style("opacity",ab?0:1),e=tj.select("."+g.axisX).style("opacity",ab?0:1),U={axisX:c.transition().duration(X),axisY:f.transition().duration(X),axisY2:h.transition().duration(X),axisSubX:e.transition().duration(X)},P&&hh&&Cf(Dc(If.data.targets),a,U),Ni&&0===bb.length&&vg.domain([0,c.selectAll(".tick").size()]),bb.length&&(O&&(vg.domain(Hf.extent(ac(bb))),xj=vg.domain(),Rf&&pj.scale(vg).updateScaleExtent(),yg.domain(vg.domain()),lj.scale(yg)),M&&(vg.domain(lj.empty()?xj:lj.extent()),Rf&&pj.scale(vg).updateScaleExtent()),yh||!xh&&!wh||(Y=Lc(Kc(bb),wh),Bg.tickValues(Y),Eg.tickValues(Y))),wg.domain(Yb(bb,"y")),xg.domain(Yb(bb,"y2")),U.axisX.call(Bg),U.axisY.call(Cg),U.axisY2.call(Dg),U.axisSubX.call(Eg),Fb(I),M&&bb.length)if(uh&&Y){for(Z=1;Z=0&&Hf.select(this).style("display",b%$?"none":"block")})}else qj.selectAll("."+g.axisX+" .tick text").style("display","block");!nh&&zh&&gb(c,U.axisX,zh),Q=Ze(_),S=$e(_,!0),T=$e(_,!1),zg.domain(wg.domain()),Ag.domain(xg.domain()),vj.style("display","none"),q(),sj.select("line."+g.xgridFocus).style("visibility","hidden"),Yh&&(k=Xd(Zh,vg),D=Ni?Bg.tickOffset():0,j=nh?{x1:0,x2:ag,y1:function(a){return vg(a)-D},y2:function(a){return vg(a)-D}}:{x1:function(a){return vg(a)+D},x2:function(a){return vg(a)+D},y1:Zf.top,y2:cg},i=sj.select("."+g.xgrids).selectAll("."+g.xgrid).data(k),i.enter().append("line").attr("class",g.xgrid),i.attr(j).style("opacity",function(){return+Hf.select(this).attr(nh?"y1":"x1")===(nh?cg:0)?0:1}),i.exit().remove()),De($h)&&(l=sj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data($h),m=l.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",nh?"":"rotate(-90)").attr("dx",nh?0:-Zf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(V).attr("x1",nh?0:Hd).attr("x2",nh?ag:Hd).attr("y1",nh?Hd:Zf.top).attr("y2",nh?Hd:cg).style("opacity",1),l.select("text").transition().duration(V).attr("x",nh?ag:0).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(V).style("opacity",0).remove()),G&&_h&&(n=sj.select("."+g.ygrids).selectAll("."+g.ygrid).data(wg.ticks(bi)),n.enter().append("line").attr("class",g.ygrid),n.attr("x1",nh?wg:0).attr("x2",nh?wg:ag).attr("y1",nh?0:wg).attr("y2",nh?cg:wg),n.exit().remove(),lf(n,"grid")),G&&De(ai)&&(o=sj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(ai),p=o.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",nh?"rotate(-90)":"").attr("dx",nh?0:-Zf.top).attr("dy",-5).style("opacity",0),o.select("line").transition().duration(V).attr("x1",nh?Id:0).attr("x2",nh?Id:ag).attr("y1",nh?0:Id).attr("y2",nh?cg:Id).style("opacity",1),o.select("text").transition().duration(V).attr("x",nh?0:ag).attr("y",Id).text(function(a){return a.text}).style("opacity",1),o.exit().transition().duration(V).style("opacity",0).remove()),w=sj.select("."+g.regions).selectAll("."+g.region).data(yi),w.enter().append("g").attr("class",id).append("rect").style("fill-opacity",0),w.selectAll("rect").transition().duration(V).attr("x",fc).attr("y",gc).attr("width",hc).attr("height",ic).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),w.exit().transition().duration(V).style("fill-opacity",0).remove(),u=sj.selectAll("."+g.bars).selectAll("."+g.bar).data(te),u.enter().append("path").attr("class",cd).style("stroke","none").style("fill",Vi),u.style("opacity",ud).transition().duration(V).attr("d",Q).style("fill",Vi).style("opacity",1),u.exit().transition().duration(W).style("opacity",0).remove(),r=sj.selectAll("."+g.lines).selectAll("."+g.line).data(re),r.enter().append("path").attr("class",$c).style("stroke",Vi),r.style("opacity",ud).transition().duration(V).attr("d",mj).style("stroke",Vi).style("opacity",1),r.exit().transition().duration(W).style("opacity",0).remove(),s=sj.selectAll("."+g.areas).selectAll("."+g.area).data(re),s.enter().append("path").attr("class",gd).style("fill",Vi).style("opacity",function(){return yj=+Hf.select(this).style("opacity"),0}),s.style("opacity",0).transition().duration(V).attr("d",nj).style("fill",Vi).style("opacity",yj),s.exit().transition().duration(W).style("opacity",0).remove(),t=sj.selectAll("."+g.circles).selectAll("."+g.circle).data(ue),t.enter().append("circle").attr("class",ad).attr("r",Qe).style("fill",Vi),t.style("opacity",ud).transition().duration(V).style("opacity",wd).style("fill",Vi).attr("cx",nh?Zd:Yd).attr("cy",nh?Yd:Zd),t.exit().remove(),x=sj.selectAll("."+g.texts).selectAll("."+g.text).data(ve),x.enter().append("text").attr("class",Wc).attr("text-anchor",function(a){return nh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",Vi).style("fill-opacity",0),x.text(function(a){return Fd(a.id)(a.value,a.id)}).style("fill-opacity",vd).transition().duration(V).attr("x",S).attr("y",T).style("fill",Vi).style("fill-opacity",xd),x.exit().transition().duration(W).style("fill-opacity",0).remove(),v=sj.selectAll("."+g.arcs).selectAll("."+g.arc).data(se),v.enter().append("path").attr("class",ed).style("fill",function(a){return Vi(a.data)}).style("cursor",function(a){return Xg(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Ti||(c=Gb(a),d=Mb(c),e=Ub(),Ob(c.data.id),yf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Gb(a),c=Mb(b),d=[c];Td(d,Hf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Ti||(c=Gb(a),d=Mb(c),e=Vb(),Pb(c.data.id),zf(),Ud(),e(d,b))}).on("click",function(a,b){var c=Gb(a),d=Mb(c),e=Tb();gf(this,a,b),e(d,b)}),v.attr("transform",L?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Ti=!0}).transition().duration(V).attrTween("d",function(a){var b,c=Gb(a);return c?(b=Hf.interpolate(this._current,c),this._current=b(0),function(a){return Jb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",L?"scale(1)":"").style("fill",function(a){return Vi(a.data)}).style("opacity",1).call(Ge,function(){Ti=!1}),v.exit().transition().duration(W).style("opacity",0).remove(),sj.selectAll("."+g.chartArc).select("text").attr("transform",Kb).style("opacity",0).transition().duration(V).text(Nb).style("opacity",function(a){return Hc(a.data.id)&&qe(a.data)?1:0}),sj.select("."+g.chartArcsTitle).style("opacity",ie(If.data.targets)?1:0),eh&&(Hf.event&&"zoom"===Hf.event.type&&lj.extent(vg.orgDomain()).update(),H&&(!nh&&zh&&gb(e,U.axisSubX,zh),lj.empty()||lj.extent(vg.orgDomain()).update(),R=Ze(_,!0),z=tj.selectAll("."+g.bars).selectAll("."+g.bar).data(te),z.enter().append("path").attr("class",cd).style("stroke","none").style("fill",Vi),z.style("opacity",ud).transition().duration(V).attr("d",R).style("opacity",1),z.exit().transition().duration(V).style("opacity",0).remove(),y=tj.selectAll("."+g.lines).selectAll("."+g.line).data(re),y.enter().append("path").attr("class",$c).style("stroke",Vi),y.style("opacity",ud).transition().duration(V).attr("d",oj).style("opacity",1),y.exit().transition().duration(V).style("opacity",0).remove())),sj.selectAll("."+g.selectedCircles).filter(function(a){return me(a)}).selectAll("circle").remove(),sj.selectAll("."+g.selectedCircle).transition().duration(V).attr("cx",nh?Zd:Yd).attr("cy",nh?Yd:Zd),A=sj.select("."+g.eventRects),De(Gg)&&!pc(Gg)?(A.classed(g.eventRectsMultiple)||A.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),B=sj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),ff(B.enter()),B.attr("x",0).attr("y",0).attr("width",ag).attr("height",cg)):(A.classed(g.eventRectsSingle)||A.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Oi&&!Ni?(F=function(a,b){var c=yc(b),d=zc(b),e=If.data.xs[a.id][b];return(vg(d?d:e+50)-vg(c?c:e-50))/2},E=function(a,b){var c=yc(b),d=If.data.xs[a.id][b];return(vg(d)+vg(c?c:d-50))/2}):(F=N(),E=function(a){return vg(a.x)-F/2}),C=Bc(If.data.targets),sj.select("."+g.eventRects).datum(C?C.values:[]),B=sj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),ef(B.enter()),B.attr("class",jd).attr("x",nh?0:E).attr("y",nh?E:0).attr("width",nh?ag:F).attr("height",nh?F:cg),B.exit().remove()),Dc(If.data.targets).forEach(function(a){zj[a]=!0})}function nf(){mf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function of(){if(0!==Jc(If.data.targets).length){if("mousemove"===Hf.event.sourceEvent.type&&pj.altDomain)return vg.domain(pj.altDomain),void pj.scale(vg).updateScaleExtent();Ni&&vg.orgDomain()[0]===xj[0]&&vg.domain([xj[0]-1e-10,vg.orgDomain()[1]]),mf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Hf.event.sourceEvent.type&&(Ri=!0)}}function pf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function qf(){qj.attr("width",eg).attr("height",fg),qj.select("#"+Gi).select("rect").attr("width",ag).attr("height",cg),qj.select("#"+Hi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),qj.select("#"+Ii).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),qj.select("."+g.zoomRect).attr("width",ag).attr("height",cg),wj.style("max-height",fg+"px")}function rf(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,p(),T(),qf(),o(a.withTransition),mf(a)}function sf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=sj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",ld),j=i.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Xc),e=sj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",nd),d=e.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",dd).style("cursor",function(a){return Xg(a)?"pointer":null}),c=sj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",md),b=c.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",_c),b.append("g").attr("class",hd),b.append("g").attr("class",function(a){return Vc(g.selectedCircles,a.id)}),b.append("g").attr("class",bd).style("cursor",function(a){return Xg(a)?"pointer":null}),a.forEach(function(a){sj.selectAll("."+g.selectedCircles+pd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=sj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(mg(a)).attr("class",od),f=h.enter().append("g").attr("class",od),f.append("g").attr("class",fd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),eh&&(n=tj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",nd),m=n.enter().append("g").style("opacity",0).attr("class",nd),m.append("g").attr("class",dd),l=tj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",md),k=l.enter().append("g").style("opacity",0).attr("class",md),k.append("g").attr("class",_c)),qj.selectAll("."+g.target).filter(function(a){return Hc(a.id)}).transition().duration(Yf).style("opacity",1)}function tf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?de(a.id,b.types[a.id]):de(a.id,b.type)}),If.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=dj?j:i,l=dj?S():R();return d&&(w=0,C=0,t=0,u=0),hh&&!Ic(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=dj?u:t,void(mh?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=uj.selectAll("."+g.legendItemFocused).size();b=b||{},n=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,dj?(f=function(a){return t*B[a]},j=function(a){return A[B[a]]+x[a]}):(f=function(a){return A[B[a]]+x[a]},j=function(a){return u*B[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=uj.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Vc(g.legendItem,a)}).style("visibility",function(a){return Ic(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof jh?jh(a):If.toggle(a)}).on("mouseover",function(a){Hf.select(this).classed(g.legendItemFocused,!0),Ti||If.focus(a),"function"==typeof kh&&kh(a)}).on("mouseout",function(a){Hf.select(this).classed(g.legendItemFocused,!1),Ti||If.revert(),"function"==typeof lh&&lh(a)}),m.append("text").text(function(a){return d(Jg[a])?Jg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",dj?h:-200).attr("y",dj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",dj?i:-200).attr("y",dj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",Vi).attr("x",dj?h:-200).attr("y",dj?-200:j).attr("width",10).attr("height",10),uj.selectAll("text").data(a).text(function(a){return d(Jg[a])?Jg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(n?250:0).attr("x",h).attr("y",k),uj.selectAll("rect."+g.legendItemEvent).data(a).transition().duration(n?250:0).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}).attr("x",i).attr("y",l),uj.selectAll("rect."+g.legendItemTile).data(a).transition().duration(n?250:0).style("fill",Vi).attr("x",f).attr("y",j),uj.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Hc(a)}).transition().style("opacity",function(a){var b=Hf.select(this);return Hc(a)?!D||b.classed(g.legendItemFocused)?wf(b):xf(b):hj}),P(t),Q(u),O(C),p(),T(),qf(),o(q,c)}function Df(a){return Fc(If.data.targets,a.id)}function Ef(a){return"data"in a&&Fc(If.data.targets,a.data.id)}function Ff(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 Gf(a,b,c){var d=!je(If.data.targets);Ti=!1,de(a,b),rf(c||{withTransitionForAxis:d})}var Hf=a.d3?a.d3:a.require?a.require("d3"):void 0,If={data:{},axis:{},legend:{}},Jf={},Kf=i(["bindto"],"#chart"),Lf=i(["size","width"]),Mf=i(["size","height"]),Nf=i(["padding","left"],50),Of=i(["padding","right"],0),Pf=i(["padding","top"],0),Qf=i(["padding","bottom"],0),Rf=i(["zoom","enabled"],!1),Sf=i(["zoom","extent"]),Tf=i(["zoom","privileged"],!1),Uf=i(["onenter"],function(){}),Vf=i(["onleave"],function(){}),Wf=i(["onresize"],function(){}),Xf=i(["onresized"],function(){}),Yf=i(["transition","duration"],350);h("data","data is required in config");var Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg=i(["data","x"]),Gg=i(["data","xs"],{}),Hg=i(["data","x_format"]),Ig=i(["data","id_converter"],function(a){return a}),Jg=i(["data","names"],{}),Kg=i(["data","classes"],{}),Lg=i(["data","groups"],[]),Mg=i(["data","axes"],{}),Ng=i(["data","type"]),Og=i(["data","types"],{}),Pg=i(["data","labels"],{}),Qg=i(["data","order"]),Rg=i(["data","regions"],{}),Sg=i(["data","color"]),Tg=i(["data","colors"],{}),Ug=i(["data","hide"],!1),Vg=i(["data","selection","enabled"],!1),Wg=i(["data","selection","grouped"],!1),Xg=i(["data","selection","isselectable"],function(){return!0}),Yg=i(["data","selection","multiple"],!0),Zg=i(["data","onclick"],function(){}),$g=i(["data","onenter"],function(){}),_g=i(["data","onleave"],function(){}),ah=i(["data","onselected"],function(){}),bh=i(["data","onunselected"],function(){}),ch=i(["data","ondragstart"],function(){}),dh=i(["data","ondragend"],function(){}),eh=i(["subchart","show"],!1),fh=i(["subchart","size","height"],60),gh=i(["color","pattern"],[]),hh=i(["legend","show"],!0),ih=i(["legend","position"],"bottom"),jh=i(["legend","item","onclick"]),kh=i(["legend","item","onmouseover"]),lh=i(["legend","item","onmouseout"]),mh=i(["legend","equally"],!1),nh=i(["axis","rotated"],!1),oh=i(["axis","x","show"],!0),ph=i(["axis","x","type"],"indexed"),qh=i(["axis","x","localtime"],!0),rh=i(["axis","x","categories"],[]),sh=i(["axis","x","tick","centered"],!1),th=i(["axis","x","tick","format"]),uh=i(["axis","x","tick","culling"],{}),vh=i(["axis","x","tick","culling","max"],10),wh=i(["axis","x","tick","count"]),xh=i(["axis","x","tick","fit"],!0),yh=i(["axis","x","tick","values"],null),zh=i(["axis","x","tick","rotate"]),Ah=i(["axis","x","max"],null),Bh=i(["axis","x","min"],null),Ch=i(["axis","x","padding"],{}),Dh=i(["axis","x","height"]),Eh=i(["axis","x","default"]),Fh=i(["axis","x","label"],{}),Gh=i(["axis","y","show"],!0),Hh=i(["axis","y","max"]),Ih=i(["axis","y","min"]),Jh=i(["axis","y","center"]),Kh=i(["axis","y","label"],{}),Lh=i(["axis","y","inner"],!1),Mh=i(["axis","y","tick","format"]),Nh=i(["axis","y","padding"]),Oh=i(["axis","y","ticks"],10),Ph=i(["axis","y2","show"],!1),Qh=i(["axis","y2","max"]),Rh=i(["axis","y2","min"]),Sh=i(["axis","y2","center"]),Th=i(["axis","y2","label"],{}),Uh=i(["axis","y2","inner"],!1),Vh=i(["axis","y2","tick","format"]),Wh=i(["axis","y2","padding"]),Xh=i(["axis","y2","ticks"],10),Yh=i(["grid","x","show"],!1),Zh=i(["grid","x","type"],"tick"),$h=i(["grid","x","lines"],[]),_h=i(["grid","y","show"],!1),ai=i(["grid","y","lines"],[]),bi=i(["grid","y","ticks"],10),ci=i(["point","show"],!0),di=i(["point","r"],2.5),ei=i(["point","focus","line","enabled"],!0),fi=i(["point","focus","expand","enabled"],!0),gi=i(["point","focus","expand","r"]),hi=i(["point","focus","select","r"]),ii=i(["line","connect_null"],!1),ji=i(["bar","width"]),ki=i(["bar","width","ratio"],.6),li=i(["pie","label","show"],!0),mi=i(["pie","label","format"]),ni=i(["pie","expand"],!0),oi=i(["pie","onclick"],function(){}),pi=i(["pie","onmouseover"],function(){}),qi=i(["pie","onmouseout"],function(){}),ri=i(["donut","label","show"],!0),si=i(["donut","label","format"]),ti=i(["donut","expand"],!0),ui=i(["donut","title"],""),vi=i(["donut","onclick"],function(){}),wi=i(["donut","onmouseover"],function(){}),xi=i(["donut","onmouseout"],function(){}),yi=i(["regions"],[]),zi=i(["tooltip","show"],!0),Ai=i(["tooltip","format","title"]),Bi=i(["tooltip","format","value"]),Ci=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Ai?Ai:b,l=Bi?Bi:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Di=i(["tooltip","init","show"],!1),Ei=i(["tooltip","init","x"],0),Fi=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Gi=("string"==typeof Kf?Kf.replace("#",""):Kf.id)+"-clip",Hi=Gi+"-xaxis",Ii=Gi+"-yaxis",Ji=j(Gi),Ki=j(Hi),Li=j(Ii),Mi="timeseries"===ph,Ni="categorized"===ph,Oi=!Mi&&(Fg||De(Gg)),Pi=null,Qi=!1,Ri=!1,Si=!1,Ti=!1,Ui=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Vi=xe(Tg,De(gh)?gh:Ui,Sg),Wi=qh?Hf.time.format:Hf.time.format.utc,Xi=function(){var a=[[Wi("%Y/%-m/%-d"),function(){return!0}],[Wi("%-m/%-d"),function(a){return a.getMonth()}],[Wi("%-m/%-d"),function(a){return 1!==a.getDate()}],[Wi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Wi("%I %p"),function(a){return a.getHours()}],[Wi("%I:%M"),function(a){return a.getMinutes()}],[Wi(":%S"),function(a){return a.getSeconds()}],[Wi(".%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)}}(),Yi=[],Zi=[],$i=nh?"left":"bottom",_i=nh?Lh?"top":"bottom":Lh?"right":"left",aj=nh?Uh?"bottom":"top":Uh?"left":"right",bj=nh?"left":"bottom",cj={main:function(){return"translate("+k(Zf.left)+","+k(Zf.top)+")"},context:function(){return"translate("+k($f.left)+","+k($f.top)+")"},legend:function(){return"translate("+_f.left+","+_f.top+")"},x:function(){return"translate(0,"+(nh?0:cg)+")"},y:function(){return"translate(0,"+(nh?cg:0)+")"},y2:function(){return"translate("+(nh?0:ag)+","+(nh?1:0)+")"},subx:function(){return"translate(0,"+(nh?0:dg)+")"},arc:function(){return"translate("+ag/2+","+cg/2+")" }},dj="right"===ih,ej=0,fj=0,gj=0,hj=.15,ij=30,jj=nh&&!oh?0:30,kj=5;mg=Hf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var lj,mj=function(){var a=Hf.svg.line().x(nh?function(a){return X(a.id)(a.value)}:Gd).y(nh?Gd:function(a){return X(a.id)(a.value)});return ii||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ii?Pe(b.values):b.values;return ke(b)?(a.interpolate(le(b)?"cardinal":"linear"),Rg[b.id]?cf(e,vg,X(b.id),Rg[b.id]):a(e)):(c=e[0]?vg(e[0].x):0,d=e[0]?X(b.id)(e[0].value):0,nh?"M "+d+" "+c:"M "+c+" "+d)}}(),nj=function(){var a;return a=nh?Hf.svg.area().x0(function(a){return X(a.id)(0)}).x1(function(a){return X(a.id)(a.value)}).y(Gd):Hf.svg.area().x(Gd).y0(function(a){return X(a.id)(0)}).y1(function(a){return X(a.id)(a.value)}),function(b){var c,d,e=Pe(b.values);return ee([b],"area")||ee([b],"area-spline")?(a.interpolate(le(b)?"cardinal":"linear"),a(e)):(c=e[0]?vg(e[0].x):0,d=e[0]?X(b.id)(e[0].value):0,nh?"M "+d+" "+c:"M "+c+" "+d)}}(),oj=function(){var a=Hf.svg.line().x(nh?function(a){return Y(a.id)(a.value)}:Jd).y(nh?Jd:function(a){return Y(a.id)(a.value)});return function(b){var c=Pe(b.values);return ke(b)?a(c):"M "+yg(c[0].x)+" "+Y(b.id)(c[0].value)}}(),pj=function(){};lj=Hf.svg.brush().on("brush",nf),lj.update=function(){return tj&&tj.select("."+g.brush).call(this),this},lj.scale=function(a){return nh?this.y(a):this.x(a)},Rf&&(pj=Hf.behavior.zoom().on("zoomstart",function(){pj.altDomain=Hf.event.sourceEvent.altKey?vg.orgDomain():null}).on("zoom",Rf?of:null),pj.scale=function(a){return nh?this.y(a):this.x(a)},pj.orgScaleExtent=function(){var a=Sf?Sf:[1,10];return[a[0],Math.max(Ac()/a[1],a[1])]},pj.updateScaleExtent=function(){var a=bc(vg.orgDomain())/bc(xj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var qj,rj,sj,tj,uj,vj,wj,xj,yj,zj={};if(If.focus=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",1)}var c=qj.selectAll(qd(a)),d=c.filter(Df),e=c.filter(Ef);If.revert(),If.defocus(),b(d.classed(g.focused,!0)),b(e),je(If.data.targets)&&Ob(a,!0),yf(a,!0)},If.defocus=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",.3)}var c=qj.selectAll(qd(a)),d=c.filter(Df),e=c.filter(Ef);If.revert(),b(d.classed(g.focused,!1)),b(e),je(If.data.targets)&&Pb(a),yf(a,!1)},If.revert=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",1)}var c=qj.selectAll(qd(a)),d=c.filter(Df),e=c.filter(Ef);b(d.classed(g.focused,!1)),b(e),je(If.data.targets)&&Pb(a),zf()},If.show=function(a,b){a=Ec(a),b=b||{},Nc(a),qj.selectAll(rd(a)).transition().style("opacity",1),b.withLegend&&Af(a),mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},If.hide=function(a,b){a=Ec(a),b=b||{},Mc(a),qj.selectAll(rd(a)).transition().style("opacity",0),b.withLegend&&Bf(a),mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},If.toggle=function(a){Hc(a)?If.hide(a):If.show(a)},If.unzoom=function(){lj.clear().update(),mf({withUpdateXDomain:!0})},If.load=function(a){return a.xs&&oc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Kg[b]=a.classes[b]}),"categories"in a&&Ni&&(rh=a.categories,Bg.categories(rh)),"cacheIds"in a&&cc(a.cacheIds)?void tf(ec(a.cacheIds),a.done):void("unload"in a?vf(Ec("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){uf(a)}):uf(a))},If.unload=function(a,b){vf(Ec(a),function(){mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},If.selected=function(a){return Hf.merge(sj.selectAll("."+g.shapes+pd(a)).selectAll("."+g.shape).filter(function(){return Hf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},If.select=function(a,b,c){Vg&&sj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Hf.select(this),i=e.data?e.data.id:e.id,j=Oe(this),k=Wg||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);"path"!==this.nodeName&&(k&&l?Xg(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},If.unselect=function(a,b){Vg&&sj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Hf.select(this),f=c.data?c.data.id:c.id,h=Oe(this),i=Wg||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);"path"!==this.nodeName&&i&&j&&Xg(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},If.toLine=function(a){Gf(a,"line")},If.toSpline=function(a){Gf(a,"spline")},If.toBar=function(a){Gf(a,"bar")},If.toScatter=function(a){Gf(a,"scatter")},If.toArea=function(a){Gf(a,"area")},If.toAreaSpline=function(a){Gf(a,"area-spline")},If.toPie=function(a){Gf(a,"pie",{withTransform:!0})},If.toDonut=function(a){Gf(a,"donut",{withTransform:!0})},If.groups=function(a){return c(a)?Lg:(Lg=a,mf(),Lg)},If.xgrids=function(a){return a?($h=a,mf(),$h):$h},If.xgrids.add=function(a){return a?If.xgrids($h.concat(a)):void 0},If.xgrids.remove=function(a){var b=Ff(a);return If.xgrids($h.filter(b))},If.ygrids=function(a){return a?(ai=a,mf(),ai):ai},If.ygrids.add=function(a){return a?If.ygrids(ai.concat(a)):void 0},If.ygrids.remove=function(a){var b=Ff(a);return If.ygrids(ai.filter(b))},If.regions=function(a){return c(a)?yi:(yi=a,mf(),yi)},If.regions.add=function(a){return c(a)?yi:(yi=yi.concat(a),mf(),yi)},If.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;qj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),yi=yi.filter(function(b){return b.classes.indexOf(a)<0})}),yi},If.data.get=function(a){var b=If.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},If.data.getAsTarget=function(a){var b=Gc(function(b){return b.id===a});return b.length>0?b[0]:void 0},If.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Jg[b]=a[b]}),mf({withLegend:!0}),Jg):Jg},If.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Tg[b]=a[b]}),mf({withLegend:!0}),Tg):Tg},If.x=function(a){return arguments.length&&(rc(If.data.targets,a),mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),If.data.xs},If.xs=function(a){return arguments.length&&(sc(If.data.targets,a),mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),If.data.xs},If.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){db(b,a[b])}),Fb())},If.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Ah=+a.x),b(a.y)&&(Hh=+a.y),b(a.y2)&&(Qh=+a.y2)):Hh=Qh=+a,mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},If.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Bh=+a.x),b(a.y)&&(Ih=+a.y),b(a.y2)&&(Rh=+a.y2)):Ih=Rh=+a,mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},If.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&If.axis.max(a.max),"undefined"!=typeof a.min&&If.axis.min(a.min))},If.legend.show=function(a){Af(Ec(a)),mf({withLegend:!0})},If.legend.hide=function(a){Bf(Ec(a)),mf({withLegend:!0})},If.resize=function(a){Lf=a?a.width:null,Mf=a?a.height:null,rf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},If.destroy=function(){If.data.targets=void 0,If.data.xs={},wj.html(""),a.onresize=null},"url"in f.data)Hf.xhr(f.data.url,function(a,b){var c,d=Hf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Hf.csv.parse(b.response),df(c)});else if("rows"in f.data)df(uc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");df(vc(f.data.columns))}return If},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(window); \ No newline at end of file diff --git a/package.json b/package.json index f0d8bae..f4bc409 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "c3", - "version": "0.1.35", + "version": "0.1.36", "description": "D3-based reusable chart library", "main": "c3.js", "scripts": { From 7981ee67d25f4700286e6e0f0af495b139654757 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Thu, 8 May 2014 14:31:55 +0900 Subject: [PATCH 145/178] Update sample for requirejs --- htdocs/js/samples/requirejs.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/js/samples/requirejs.js b/htdocs/js/samples/requirejs.js index eb57fc2..95f5a7d 100644 --- a/htdocs/js/samples/requirejs.js +++ b/htdocs/js/samples/requirejs.js @@ -7,7 +7,7 @@ require.config({ require(["d3", "c3"], function(d3, c3) { - var chart = c3.generate({ + window.chart = c3.generate({ data: { columns: [ ['sample', 30, 200, 100, 400, 150, 250] @@ -15,4 +15,4 @@ require(["d3", "c3"], function(d3, c3) { } }); -}); \ No newline at end of file +}); From d2f6fbc5ed0810795b889d7efa0505543ef17ccd Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Thu, 8 May 2014 15:18:11 +0900 Subject: [PATCH 146/178] Refactor time format --- c3.js | 31 ++++++++++++------------------- c3.min.js | 4 ++-- 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/c3.js b/c3.js index 96230c6..c325d07 100644 --- a/c3.js +++ b/c3.js @@ -302,24 +302,17 @@ var defaultColorPattern = ['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd', '#8c564b', '#e377c2', '#7f7f7f', '#bcbd22', '#17becf'], //same as d3.scale.category10() color = generateColor(__data_colors, notEmpty(__color_pattern) ? __color_pattern : defaultColorPattern, __data_color); - var xTimeFormat = __axis_x_localtime ? d3.time.format : d3.time.format.utc, - defaultTimeFormat = (function () { - var formats = [ - [xTimeFormat("%Y/%-m/%-d"), function () { return true; }], - [xTimeFormat("%-m/%-d"), function (d) { return d.getMonth(); }], - [xTimeFormat("%-m/%-d"), function (d) { return d.getDate() !== 1; }], - [xTimeFormat("%-m/%-d"), function (d) { return d.getDay() && d.getDate() !== 1; }], - [xTimeFormat("%I %p"), function (d) { return d.getHours(); }], - [xTimeFormat("%I:%M"), function (d) { return d.getMinutes(); }], - [xTimeFormat(":%S"), function (d) { return d.getSeconds(); }], - [xTimeFormat(".%L"), function (d) { return d.getMilliseconds(); }] - ]; - return function (date) { - var i = formats.length - 1, f = formats[i]; - while (!f[1](date)) { f = formats[--i]; } - return f[0](date); - }; - })(); + var timeFormat = __axis_x_localtime ? d3.time.format : d3.time.format.utc, + defaultTimeFormat = timeFormat.multi([ + [".%L", function (d) { return d.getMilliseconds(); }], + [":%S", function (d) { return d.getSeconds(); }], + ["%I:%M", function (d) { return d.getMinutes(); }], + ["%I %p", function (d) { return d.getHours(); }], + ["%-m/%-d", function (d) { return d.getDay() && d.getDate() !== 1; }], + ["%-m/%-d", function (d) { return d.getDate() !== 1; }], + ["%-m/%-d", function (d) { return d.getMonth(); }], + ["%Y/%-m/%-d", function () { return true; }] + ]); var hiddenTargetIds = [], hiddenLegendIds = []; @@ -734,7 +727,7 @@ format = __axis_x_tick_format; } else if (isTimeSeries) { format = function (date) { - return date ? xTimeFormat(__axis_x_tick_format)(date) : ""; + return date ? timeFormat(__axis_x_tick_format)(date) : ""; }; } } diff --git a/c3.min.js b/c3.min.js index 73e363d..baa2ec8 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ !function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.ceil(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.ceil(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&aag&&(ag=0),0>cg&&(cg=0),bg=nh?Zf.left-ij-jj:ag,dg=nh?cg:fg-$f.top-$f.bottom,0>bg&&(bg=0),0>dg&&(dg=0),r(),dj&&je(If.data.targets)&&(_f.left=ag/2+hg)}function q(){sj.select("line."+g.xgridFocus).attr("x1",nh?0:-10).attr("x2",nh?ag:-10).attr("y1",nh?-10:Zf.top).attr("y2",nh?-10:cg)}function r(){hg=cg/2,gg=.95*hg,ig=ie(If.data.targets)?.6*gg:0}function s(){var a=nh?g.axisX:g.axisY,b=sj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Hf.select(Kf).node().getBoundingClientRect(),e=c.right-d.left-v();return e>0?e:0}function t(){return Lf?Lf:z()}function u(){var a=Mf?Mf:A();return a>0?a:320}function v(){return je(If.data.targets)?0:Nf?Nf:nh?oh?x("x"):1:!Gh||Lh?1:x("y")}function w(){var a=1;return je(If.data.targets)?0:Of?Of:dj?R()+20+(Ph&&!nh?x("y2"):a):Ph?Uh||nh?a:x("y2"):a}function x(a){var b=lb(a);return b.isInner?20+Eb(a):40+Eb(a)}function y(a){return"x"!==a||oh?"x"===a&&Dh?Dh:"y"!==a||Gh?"y2"!==a||Ph?(lb(a).isInner?30:40)+("y2"===a?-10:0):kj:hh&&!dj?10:1:0}function z(){return+Hf.select(Kf).style("width").replace("px","")}function A(){return+Hf.select(Kf).style("height").replace("px","")}function B(a){return a?-31:-(Zf.left-1)}function C(a){return a?-20:-4}function D(){return B(!nh)}function E(){return C(!nh)}function F(){return B(nh)}function G(){return C(nh)}function H(a){return a?ag+2+30+30:Zf.left+20}function I(a){return a?(Dh?Dh:0)+80:cg+8}function J(){return H(!nh)}function K(){return I(!nh)}function L(){return H(nh)}function M(){return I(nh)}function N(){var a,b,c,d,e,f=Bc(If.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=vg(b.x)-vg(a.x),0===c?nh?cg:ag:(d=Ac(),e=fe(If.data.targets)?(d-(Ni?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function O(a){ej=a}function P(a){fj=a}function Q(a){gj=a}function R(){return hh?dj?fj*(ej+1):eg:0}function S(){return hh?dj?fg:gj*(ej+1):0}function T(){var a,b,c=!vg;ng=nh?1:0,og=nh?cg:ag,pg=nh?0:cg,qg=nh?ag:1,rg=ng,sg=og,tg=nh?0:dg,ug=nh?bg:1,vg=V(ng,og,c?void 0:vg.domain(),function(){return Bg.tickOffset()}),wg=W(pg,qg,c?void 0:wg.domain()),xg=W(pg,qg,c?void 0:xg.domain()),yg=V(ng,og,xj,function(a){return a%1?0:Eg.tickOffset()}),zg=W(tg,ug,c?void 0:zg.domain()),Ag=W(tg,ug,c?void 0:Ag.domain()),a=ab(),b=yh?yh:c?void 0:Bg.tickValues(),Bg=Z(vg,$i,a,b),Eg=Z(yg,bj,a,b),Cg=$(wg,_i,Mh,Oh),Dg=$(xg,aj,Vh,Xh),c||(lj.scale(yg),Rf&&pj.scale(vg)),U()}function U(){jg=Hb(),kg=Ib(),lg=Ib(.98)}function V(a,b,c,d){var e,f=(Mi?Hf.time.scale():Hf.scale.linear()).range([a,b]),g=c?f.domain(c):f;Ni?(d=d||function(){return 0},f=function(a){return Math.ceil(g(a)+d(a))}):f=function(a){return Math.ceil(g(a))};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return xj&&xj[0]===a[0]&&xj[1]a?a.toFixed(0):a};return th&&("function"==typeof th?a=th:Mi&&(a=function(a){return a?Wi(th)(a):""})),a}function bb(a){var b;return"y"===a?b=Kh:"y2"===a?b=Th:"x"===a&&(b=Fh),b}function cb(a){var b=bb(a);return"string"==typeof b?b:b?b.text:null}function db(a,b){var c=bb(a);"string"==typeof c?"y"===a?Kh=b:"y2"===a?Th=b:"x"===a&&(Fh=b):c&&(c.text=b)}function eb(a){return 10*Math.sin(Math.PI*(a/180))}function fb(a){return 11.5-2.5*(a/15)}function gb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",fb(c)).attr("x",eb(c)).attr("transform","rotate("+c+")")}function hb(a,b){var c=bb(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 ib(){return hb("x",nh?"inner-top":"inner-right")}function jb(){return hb("y",nh?"inner-right":"inner-top")}function kb(){return hb("y2",nh?"inner-right":"inner-top")}function lb(a){return"y2"===a?kb():"y"===a?jb():ib()}function mb(){return cb("x")}function nb(){return cb("y")}function ob(){return cb("y2")}function pb(a,b){return a?b.isLeft?0:b.isCenter?ag/2:ag:b.isBottom?-cg:b.isMiddle?-cg/2:0}function qb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function rb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function sb(){return pb(!nh,ib())}function tb(){return pb(nh,jb())}function ub(){return pb(nh,kb())}function vb(){return qb(!nh,ib())}function wb(){return qb(nh,jb())}function xb(){return qb(nh,kb())}function yb(){var a=ib();return nh?a.isInner?"1.2em":-25-Eb("x"):a.isInner?"-0.5em":Dh?Dh-10:"3em"}function zb(){var a=jb();return nh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Eb("y")}function Ab(){var a=kb();return nh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Eb("y2")}function Bb(){return rb(!nh,ib())}function Cb(){return rb(nh,jb())}function Db(){return rb(nh,kb())}function Eb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Hf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Fb(a){var b=sj.select("."+g.axisX+" ."+g.axisXLabel),c=sj.select("."+g.axisY+" ."+g.axisYLabel),d=sj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb),(a?c.transition():c).attr("x",tb).attr("dx",wb).attr("dy",zb).attr("dy",zb).text(nb),(a?d.transition():d).attr("x",ub).attr("dx",xb).attr("dy",Ab).text(ob)}function Gb(a){var b=!1;return mg(Jc(If.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Hb(){var a=Hf.svg.arc().outerRadius(gg).innerRadius(ig),b=function(b,c){var d;return c?a(b):(d=Gb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Ib(a){var b=Hf.svg.arc().outerRadius(hg*(a?a:1)).innerRadius(ig);return function(a){var c=Gb(a);return c?b(c):"M 0 0"}}function Jb(a,b){return qe(a.data)?jg(a,b):"M 0 0"}function Kb(a){var b,c,d,e,f=Gb(a),g="";return f&&(b=jg.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*gg*.8+","+d/e*gg*.8+")"),g}function Lb(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Mb(a){return qc({id:a.data.id,value:a.value,ratio:Lb(a)})}function Nb(a){var b,c,d,e;return Qb()?(b=Gb(a),c=b?b.value:null,d=Lb(b),e=Rb(),e?e(c,d):Ed(c,d)):""}function Ob(a,b){var c=qj.selectAll("."+g.chartArc+qd(a)),d=qj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});we(a)&&c.selectAll("path").transition().duration(50).attr("d",kg).transition().duration(100).attr("d",lg).each(function(a){pe(a.data)}),b||d.style("opacity",.3)}function Pb(a){var b=qj.selectAll("."+g.chartArc+qd(a));b.selectAll("path").transition().duration(50).attr("d",jg),qj.selectAll("."+g.arc).style("opacity",1)}function Qb(){return ie(If.data.targets)?ri:li}function Rb(){return ie(If.data.targets)?si:mi}function Sb(){return ie(If.data.targets)?ui:""}function Tb(){var a=ie(If.data.targets)?vi:oi;return"function"==typeof a?a:function(){}}function Ub(){var a=ie(If.data.targets)?wi:pi;return"function"==typeof a?a:function(){}}function Vb(){var a=ie(If.data.targets)?xi:qi;return"function"==typeof a?a:function(){}}function Wb(a){var b,c,d,e,f,g,h=Dc(a),i=Qc(a);if(Lg.length>0)for(g=Sc(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 Hf.min(Object.keys(i).map(function(a){return Hf.min(i[a])}))}function Xb(a){var b,c,d,e,f,g,h=Dc(a),i=Qc(a);if(Lg.length>0)for(g=Tc(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 Hf.max(Object.keys(i).map(function(a){return Hf.max(i[a])}))}function Yb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return _(a.id)===c}),m="y2"===c?Rh:Ih,n="y2"===c?Qh:Hh,o=b(m)?m:Wb(l),p=b(n)?n:Xb(l),q="y2"===c?Sh:Jh,r=yd()&&nh;return 0===l.length?"y2"===c?xg.domain():wg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=zd(o,p),j=bc(wg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Nh&&(f=b(Nh.top)?Nh.top:e,g=b(Nh.bottom)?Nh.bottom:e),"y2"===c&&Wh&&(f=b(Wh.top)?Wh.top:e,g=b(Wh.bottom)?Wh.bottom:e),fe(l)&&!Sc(l)&&(g=o),[o-g,p+f])}function Zb(a){return Bh?Mi?ye(Bh):Bh:Hf.min(a,function(a){return Hf.min(a.values,function(a){return a.x})})}function $b(a){return Ah?Mi?ye(Ah):Ah:Hf.max(a,function(a){return Hf.max(a.values,function(a){return a.x})})}function _b(a){var c,d,e,f,g=Cc(a),h=g[1]-g[0];return Ni?d=0:fe(a)?(c=Ac(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Ch&&De(Ch)?(e=b(Ch.left)?Ch.left:d,f=b(Ch.right)?Ch.right:d):e=f="number"==typeof Ch?Ch:d,{left:e,right:f}}function ac(a){var b=[Zb(a),$b(a)],c=b[0],d=b[1],e=_b(a),f=0,g=0;return c-d!==0||Ni||(c=Mi?new Date(.5*c.getTime()):-.5,d=Mi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Mi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Mi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function bc(a){return a[1]-a[0]}function cc(a){for(var b=0;bb?0:b-c}function ic(a){var b,c=gc(a),d="y"===a.axis?wg:xg;return b="y"===a.axis||"y2"===a.axis?nh?cg:"start"in a?d(a.start):cg:nh?"end"in a?vg(Mi?ye(a.end):a.end):cg:cg,c>b?0:b-c}function jc(a){return Fg&&a===Fg||De(Gg)&&Ee(Gg,a)}function kc(a){return!jc(a)}function lc(a){return Fg?Fg:De(Gg)?Gg[a]:null}function mc(a,b){var c,d=b&&De(b)?Dc(b):[];return d.forEach(function(b){lc(b)===a&&(c=If.data.xs[b])}),c}function nc(a,b){return a in If.data.xs&&If.data.xs[a]&&If.data.xs[a][b]?If.data.xs[a][b]:b}function oc(a){Object.keys(a).forEach(function(b){Gg[b]=a[b]})}function pc(a){return 1===Hf.set(Object.keys(a).map(function(b){return a[b]})).size()}function qc(a){var b;return a&&(b=Jg[a.id],a.name=b?b:a.id),a}function rc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=tc(b[d],a.id,d)}),If.data.xs[a.id]=b})}function sc(a,b){a.forEach(function(a){b[a.id]&&rc([a],b[a.id])})}function tc(a,c,d){var e;return e=Mi?a?a instanceof Date?a:ye(a):ye(nc(c,d)):Oi&&!Ni?b(a)?+a:nc(c,d):d}function uc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?If.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Fg?(d=Object.keys(If.data.xs),If.data.xs[c]=d.length>0?If.data.xs[d[0]]:void 0):De(Gg)&&(If.data.xs[c]=mc(f,If.data.targets)):If.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!If.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Ig(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=lc(b),g=a[f],h=tc(g,b,e);return Oi&&Ni&&0===c&&g&&(0===e&&(rh=[]),rh.push(g)),("undefined"==typeof a[b]||If.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ng&&de(Dc(c).filter(function(a){return!(a in Og)}),Ng),c.forEach(function(a){dc(a.id_org,a)}),c}function xc(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 yc(a){return a>0&&If.data.targets[0].values[a-1]?If.data.targets[0].values[a-1].x:void 0}function zc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Cc(a){var b,c,d=Bc(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Dc(a){return a.map(function(a){return a.id})}function Ec(a){return a?"string"==typeof a?[a]:a:Dc(If.data.targets)}function Fc(a,b){var c,d=Dc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Mi?new Date(i):i);j.push(e)}return Mi||(j=j.sort(function(a,b){return a-b})),j}function Mc(a){Yi=Yi.concat(a)}function Nc(a){Yi=Yi.filter(function(b){return a.indexOf(b)<0})}function Oc(a){Zi=Zi.concat(a)}function Pc(a){Zi=Zi.filter(function(b){return a.indexOf(b)<0})}function Qc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Rc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Tc(a){return Rc(a,function(a){return a>0})}function Uc(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||0===a[f].x)&&(e=e.concat(Kd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Kd(a,g))),Nd(e,b)):Ld(a,b,f,g)}function Md(a,b){var c;return c=a.map(function(a){return Ld(a.values,b)}),Nd(c,b)}function Nd(a,b){var c,d;return a.forEach(function(a){var e=Fe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Od(a,b){return Hf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Pd(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 Qd(){return Qg&&"desc"===Qg.toLowerCase()}function Rd(){return Qg&&"asc"===Qg.toLowerCase()}function Sd(a){var b=Rd(),c=Qd();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 Qg&&a.sort(Qg),a}function Td(a,c){var d,e,f,g,h,i,j,k=je(If.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&zi&&(vj.html(Ci(a,ab(),Ad(k),Vi)).style("display","block"),d=vj.property("offsetWidth"),e=vj.property("offsetHeight"),k?(g=ag/2+c[0],i=cg/2+c[1]+20):(nh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-w(),i=vg(l[0].x)+20):(f=s(),g=f+v()+vg(l[0].x)+20,h=g+d,j=f+t()-w(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),vj.style("top",i+"px").style("left",g+"px"))}function Ud(){vj.style("display","none")}function Vd(a){var c=a.filter(function(a){return a&&b(a.value)});if(zi&&!ge(If.data.targets)&&!je(If.data.targets)){var d=sj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(nh?"y1":"x1",Gd).attr(nh?"y2":"x2",Gd),lf(d,"grid")}}function Wd(){sj.select("line."+g.xgridFocus).style("visibility","hidden")}function Xd(a,b){var c,d,e,f,h=[],i=sj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=ac(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function Yd(a){return a.x||0===a.x?vg(a.x):null}function Zd(a){return X(a.id)(a.value)}function $d(){var a,b,d={},e=0;return Jc(Gc(me)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ce(a,b){return"number"==typeof ji?ji:b?2*a.tickOffset()*ki/b:0}function de(a,b){Ec(a).forEach(function(a){zj[a]=b===Og[a],Og[a]=b})}function ee(a,b){var c=!1;return a.forEach(function(a){Og[a.id]===b&&(c=!0),a.id in Og||"line"!==b||(c=!0)}),c}function fe(a){return ee(a,"bar")}function ge(a){return ee(a,"scatter")}function he(a){return ee(a,"pie")}function ie(a){return ee(a,"donut")}function je(a){return he(a)||ie(a)}function ke(a){var b="string"==typeof a?a:a.id;return!(b in Og)||"line"===Og[b]||"spline"===Og[b]||"area"===Og[b]||"area-spline"===Og[b]}function le(a){var b="string"==typeof a?a:a.id;return"spline"===Og[b]||"area-spline"===Og[b]}function me(a){var b="string"==typeof a?a:a.id;return"bar"===Og[b]}function ne(a){var b="string"==typeof a?a:a.id;return"scatter"===Og[b]}function oe(a){var b="string"==typeof a?a:a.id;return"pie"===Og[b]}function pe(a){var b="string"==typeof a?a:a.id;return"donut"===Og[b]}function qe(a){return oe(a)||pe(a)}function re(a){return ke(a)?[a]:[]}function se(a){return qe(a.data)?[a]:[]}function te(a){return me(a)?a.values:[]}function ue(a){return ke(a)||ne(a)?a.values:[]}function ve(a){return me(a)||ke(a)?a.values:[]}function we(a){return pe(a)&&ti||oe(a)&&ni}function xe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ye(b){var c;try{c=Hg?Hf.time.format(Hg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Hg)}return c}function ze(a,b){var c=Hf.mouse(a),d=Hf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ee(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Fe(a,b){var c="y"===_(a.id)?wg:xg,d=nh?1:0,e=nh?0:1;return Math.pow(vg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ge(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function He(a,b,c){ah(b,a.node()),sj.select("."+g.selectedCircles+pd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Vc(g.selectedCircle,c)}).attr("cx",nh?Zd:Yd).attr("cy",nh?Yd:Zd).attr("stroke",function(){return Vi(b)}).attr("r",1.4*Se(b)).transition().duration(100).attr("r",Se)}function Ie(a,b,c){bh(b,a.node()),sj.select("."+g.selectedCircles+pd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Je(a,b,c,d){a?He(b,c,d):Ie(b,c,d)}function Ke(a,b){ah(b,a.node()),a.transition().duration(100).style("fill",function(){return Hf.rgb(Vi(b)).brighter(.75)})}function Le(a,b){bh(b,a.node()),a.transition().duration(100).style("fill",function(){return Vi(b)})}function Me(a,b,c,d){a?Ke(b,c,d):Le(b,c,d)}function Ne(a,b,c,d){Me(a,b,c.data,d)}function Oe(a){return"circle"===a.nodeName?Je:Hf.select(a).classed(g.bar)?Me:Ne}function Pe(a){return a.filter(function(a){return b(a.value)})}function Qe(a){return ci?"function"==typeof di?di(a):di:0}function Re(a){return fi?gi?gi:1.75*Qe(a):Qe(a)}function Se(a){return hi?hi:4*Qe(a)}function Te(a,c){return(c?sj.selectAll("."+g.circles+pd(c)):sj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ue(a,b){Te(a,b).classed(g.EXPANDED,!0).attr("r",Re)}function Ve(a){Te(a).filter(function(){return Hf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Qe)}function We(a){return sj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function Xe(a){We(a).classed(g.EXPANDED,!0)}function Ye(a){We(a).classed(g.EXPANDED,!1)}function Ze(a,b){var c=bf(a,b);return function(a,b){var d=c(a,b),e=nh?1:0,f=nh?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 $e(a,b){var c=bf(a,!1),d=b?_e:af;return function(a,b){return d(c(a,b),a,this)}}function _e(a,b){var c;return nh?(c=me(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function af(a,b,c){var d=c.getBoundingClientRect();return nh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:me(b)?-3:-6)}function bf(a,b){var c=a.__max__+1,d=ce(Bg,c),e=_d(d,c,a,!!b),f=ae(!!b),g=be(a,!!b),h=b?Y:X;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return nh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function cf(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 df(b){var c,d,e;if(wj=Hf.select(Kf),wj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(wj.html("").classed("c3",!0),If.data.xs={},If.data.targets=wc(b),Ug&&Mc(Ug===!0?Dc(If.data.targets):Ug),p(),T(),vg.domain(Hf.extent(ac(If.data.targets))),wg.domain(Yb(If.data.targets,"y")),xg.domain(Yb(If.data.targets,"y2")),yg.domain(vg.domain()),zg.domain(wg.domain()),Ag.domain(xg.domain()),xj=vg.domain(),lj.scale(yg),Rf&&pj.scale(vg),qj=wj.append("svg").on("mouseenter",Uf).on("mouseleave",Vf),rj=qj.append("defs"),rj.append("clipPath").attr("id",Gi).append("rect"),rj.append("clipPath").attr("id",Hi).append("rect"),rj.append("clipPath").attr("id",Ii).append("rect"),qf(),sj=qj.append("g").attr("transform",cj.main),tj=qj.append("g").attr("transform",cj.context),uj=qj.append("g").attr("transform",cj.legend),eh||tj.style("visibility","hidden"),hh||(uj.style("visibility","hidden"),Zi=Dc(If.data.targets)),vj=Hf.select(Kf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Cf(Dc(If.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=sj.append("g").attr("clip-path",Ji).attr("class",g.grid),Yh&&d.append("g").attr("class",g.xgrids),De($h)&&d.append("g").attr("class",g.xgridLines),ei&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),_h&&d.append("g").attr("class",g.ygrids),De(ai)&&d.append("g").attr("class",g.ygridLines),sj.append("g").attr("clip-path",Ji).attr("class",g.regions),sj.append("g").attr("clip-path",Ji).attr("class",g.chart),c=sj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Rf?nh?"ns-resize":"ew-resize":null),sj.select("."+g.chart).append("g").attr("class",g.chartBars),sj.select("."+g.chart).append("g").attr("class",g.chartLines),sj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",cj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Sb()),sj.select("."+g.chart).append("g").attr("class",g.chartTexts),Rf&&sj.insert("rect",Tf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",ag).attr("height",cg).style("opacity",0).style("cursor",nh?"ns-resize":"ew-resize").call(pj).on("dblclick.zoom",null),Eh&&lj.extent("function"!=typeof Eh?Eh:Eh(ac())),oh&&sj.append("g").attr("class",g.axisX).attr("clip-path",Ki).attr("transform",cj.x).append("text").attr("class",g.axisXLabel).attr("transform",nh?"rotate(-90)":"").style("text-anchor",Bb),Gh&&sj.append("g").attr("class",g.axisY).attr("clip-path",Li).attr("transform",cj.y).append("text").attr("class",g.axisYLabel).attr("transform",nh?"":"rotate(-90)").style("text-anchor",Cb),Ph&&sj.append("g").attr("class",g.axisY2).attr("transform",cj.y2).append("text").attr("class",g.axisY2Label).attr("transform",nh?"":"rotate(-90)").style("text-anchor",Db),tj.append("g").attr("clip-path",Ji).attr("class",g.chart),tj.select("."+g.chart).append("g").attr("class",g.chartBars),tj.select("."+g.chart).append("g").attr("class",g.chartLines),tj.append("g").attr("clip-path",Ji).attr("class",g.brush).call(lj).selectAll("rect").attr(nh?"width":"height",nh?bg:dg),tj.append("g").attr("class",g.axisX).attr("transform",cj.subx).attr("clip-path",nh?"":Ki),sf(If.data.targets),nh?sj.select("."+g.axisX).style("opacity",0).call(Bg):(sj.select("."+g.axisY).style("opacity",0).call(Cg),sj.select("."+g.axisY2).style("opacity",0).call(Dg)),p(),T(),qf(),o(!1),mf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Di){if(Mi&&"string"==typeof Ei){for(Ei=ye(Ei),e=0;e0){d=[];for(var f in Jg)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Pd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Me,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function jf(a){je(If.data.targets)||Vg&&(Pi=a,sj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Qi=!0,ch())}function kf(){je(If.data.targets)||Vg&&(sj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),sj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Qi=!1,dh())}function lf(a,b){"grid"===b&&a.each(function(){var a=Hf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function mf(a){var c,e,f,h,i,j,k,l,m,n,o,p,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,O,P,Q,R,S,T,U,V,W,X,Y,Z,$,_=$d(),ab=je(If.data.targets),bb=Jc(If.data.targets);if(a=d(a)?a:{},G=d(a.withY)?a.withY:!0,H=d(a.withSubchart)?a.withSubchart:!0,I=d(a.withTransition)?a.withTransition:!0,L=d(a.withTransform)?a.withTransform:!1,M=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,O=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,P=d(a.withLegend)?a.withLegend:!1,J=d(a.withTransitionForExit)?a.withTransitionForExit:I,K=d(a.withTransitionForAxis)?a.withTransitionForAxis:I,V=I?Yf:0,W=J?V:0,X=K?V:0,c=sj.select("."+g.axisX).style("opacity",ab?0:1),f=sj.select("."+g.axisY).style("opacity",ab?0:1),h=sj.select("."+g.axisY2).style("opacity",ab?0:1),e=tj.select("."+g.axisX).style("opacity",ab?0:1),U={axisX:c.transition().duration(X),axisY:f.transition().duration(X),axisY2:h.transition().duration(X),axisSubX:e.transition().duration(X)},P&&hh&&Cf(Dc(If.data.targets),a,U),Ni&&0===bb.length&&vg.domain([0,c.selectAll(".tick").size()]),bb.length&&(O&&(vg.domain(Hf.extent(ac(bb))),xj=vg.domain(),Rf&&pj.scale(vg).updateScaleExtent(),yg.domain(vg.domain()),lj.scale(yg)),M&&(vg.domain(lj.empty()?xj:lj.extent()),Rf&&pj.scale(vg).updateScaleExtent()),yh||!xh&&!wh||(Y=Lc(Kc(bb),wh),Bg.tickValues(Y),Eg.tickValues(Y))),wg.domain(Yb(bb,"y")),xg.domain(Yb(bb,"y2")),U.axisX.call(Bg),U.axisY.call(Cg),U.axisY2.call(Dg),U.axisSubX.call(Eg),Fb(I),M&&bb.length)if(uh&&Y){for(Z=1;Z=0&&Hf.select(this).style("display",b%$?"none":"block")})}else qj.selectAll("."+g.axisX+" .tick text").style("display","block");!nh&&zh&&gb(c,U.axisX,zh),Q=Ze(_),S=$e(_,!0),T=$e(_,!1),zg.domain(wg.domain()),Ag.domain(xg.domain()),vj.style("display","none"),q(),sj.select("line."+g.xgridFocus).style("visibility","hidden"),Yh&&(k=Xd(Zh,vg),D=Ni?Bg.tickOffset():0,j=nh?{x1:0,x2:ag,y1:function(a){return vg(a)-D},y2:function(a){return vg(a)-D}}:{x1:function(a){return vg(a)+D},x2:function(a){return vg(a)+D},y1:Zf.top,y2:cg},i=sj.select("."+g.xgrids).selectAll("."+g.xgrid).data(k),i.enter().append("line").attr("class",g.xgrid),i.attr(j).style("opacity",function(){return+Hf.select(this).attr(nh?"y1":"x1")===(nh?cg:0)?0:1}),i.exit().remove()),De($h)&&(l=sj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data($h),m=l.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",nh?"":"rotate(-90)").attr("dx",nh?0:-Zf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(V).attr("x1",nh?0:Hd).attr("x2",nh?ag:Hd).attr("y1",nh?Hd:Zf.top).attr("y2",nh?Hd:cg).style("opacity",1),l.select("text").transition().duration(V).attr("x",nh?ag:0).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(V).style("opacity",0).remove()),G&&_h&&(n=sj.select("."+g.ygrids).selectAll("."+g.ygrid).data(wg.ticks(bi)),n.enter().append("line").attr("class",g.ygrid),n.attr("x1",nh?wg:0).attr("x2",nh?wg:ag).attr("y1",nh?0:wg).attr("y2",nh?cg:wg),n.exit().remove(),lf(n,"grid")),G&&De(ai)&&(o=sj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(ai),p=o.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",nh?"rotate(-90)":"").attr("dx",nh?0:-Zf.top).attr("dy",-5).style("opacity",0),o.select("line").transition().duration(V).attr("x1",nh?Id:0).attr("x2",nh?Id:ag).attr("y1",nh?0:Id).attr("y2",nh?cg:Id).style("opacity",1),o.select("text").transition().duration(V).attr("x",nh?0:ag).attr("y",Id).text(function(a){return a.text}).style("opacity",1),o.exit().transition().duration(V).style("opacity",0).remove()),w=sj.select("."+g.regions).selectAll("."+g.region).data(yi),w.enter().append("g").attr("class",id).append("rect").style("fill-opacity",0),w.selectAll("rect").transition().duration(V).attr("x",fc).attr("y",gc).attr("width",hc).attr("height",ic).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),w.exit().transition().duration(V).style("fill-opacity",0).remove(),u=sj.selectAll("."+g.bars).selectAll("."+g.bar).data(te),u.enter().append("path").attr("class",cd).style("stroke","none").style("fill",Vi),u.style("opacity",ud).transition().duration(V).attr("d",Q).style("fill",Vi).style("opacity",1),u.exit().transition().duration(W).style("opacity",0).remove(),r=sj.selectAll("."+g.lines).selectAll("."+g.line).data(re),r.enter().append("path").attr("class",$c).style("stroke",Vi),r.style("opacity",ud).transition().duration(V).attr("d",mj).style("stroke",Vi).style("opacity",1),r.exit().transition().duration(W).style("opacity",0).remove(),s=sj.selectAll("."+g.areas).selectAll("."+g.area).data(re),s.enter().append("path").attr("class",gd).style("fill",Vi).style("opacity",function(){return yj=+Hf.select(this).style("opacity"),0}),s.style("opacity",0).transition().duration(V).attr("d",nj).style("fill",Vi).style("opacity",yj),s.exit().transition().duration(W).style("opacity",0).remove(),t=sj.selectAll("."+g.circles).selectAll("."+g.circle).data(ue),t.enter().append("circle").attr("class",ad).attr("r",Qe).style("fill",Vi),t.style("opacity",ud).transition().duration(V).style("opacity",wd).style("fill",Vi).attr("cx",nh?Zd:Yd).attr("cy",nh?Yd:Zd),t.exit().remove(),x=sj.selectAll("."+g.texts).selectAll("."+g.text).data(ve),x.enter().append("text").attr("class",Wc).attr("text-anchor",function(a){return nh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",Vi).style("fill-opacity",0),x.text(function(a){return Fd(a.id)(a.value,a.id)}).style("fill-opacity",vd).transition().duration(V).attr("x",S).attr("y",T).style("fill",Vi).style("fill-opacity",xd),x.exit().transition().duration(W).style("fill-opacity",0).remove(),v=sj.selectAll("."+g.arcs).selectAll("."+g.arc).data(se),v.enter().append("path").attr("class",ed).style("fill",function(a){return Vi(a.data)}).style("cursor",function(a){return Xg(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Ti||(c=Gb(a),d=Mb(c),e=Ub(),Ob(c.data.id),yf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Gb(a),c=Mb(b),d=[c];Td(d,Hf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Ti||(c=Gb(a),d=Mb(c),e=Vb(),Pb(c.data.id),zf(),Ud(),e(d,b))}).on("click",function(a,b){var c=Gb(a),d=Mb(c),e=Tb();gf(this,a,b),e(d,b)}),v.attr("transform",L?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Ti=!0}).transition().duration(V).attrTween("d",function(a){var b,c=Gb(a);return c?(b=Hf.interpolate(this._current,c),this._current=b(0),function(a){return Jb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",L?"scale(1)":"").style("fill",function(a){return Vi(a.data)}).style("opacity",1).call(Ge,function(){Ti=!1}),v.exit().transition().duration(W).style("opacity",0).remove(),sj.selectAll("."+g.chartArc).select("text").attr("transform",Kb).style("opacity",0).transition().duration(V).text(Nb).style("opacity",function(a){return Hc(a.data.id)&&qe(a.data)?1:0}),sj.select("."+g.chartArcsTitle).style("opacity",ie(If.data.targets)?1:0),eh&&(Hf.event&&"zoom"===Hf.event.type&&lj.extent(vg.orgDomain()).update(),H&&(!nh&&zh&&gb(e,U.axisSubX,zh),lj.empty()||lj.extent(vg.orgDomain()).update(),R=Ze(_,!0),z=tj.selectAll("."+g.bars).selectAll("."+g.bar).data(te),z.enter().append("path").attr("class",cd).style("stroke","none").style("fill",Vi),z.style("opacity",ud).transition().duration(V).attr("d",R).style("opacity",1),z.exit().transition().duration(V).style("opacity",0).remove(),y=tj.selectAll("."+g.lines).selectAll("."+g.line).data(re),y.enter().append("path").attr("class",$c).style("stroke",Vi),y.style("opacity",ud).transition().duration(V).attr("d",oj).style("opacity",1),y.exit().transition().duration(V).style("opacity",0).remove())),sj.selectAll("."+g.selectedCircles).filter(function(a){return me(a)}).selectAll("circle").remove(),sj.selectAll("."+g.selectedCircle).transition().duration(V).attr("cx",nh?Zd:Yd).attr("cy",nh?Yd:Zd),A=sj.select("."+g.eventRects),De(Gg)&&!pc(Gg)?(A.classed(g.eventRectsMultiple)||A.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),B=sj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),ff(B.enter()),B.attr("x",0).attr("y",0).attr("width",ag).attr("height",cg)):(A.classed(g.eventRectsSingle)||A.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Oi&&!Ni?(F=function(a,b){var c=yc(b),d=zc(b),e=If.data.xs[a.id][b];return(vg(d?d:e+50)-vg(c?c:e-50))/2},E=function(a,b){var c=yc(b),d=If.data.xs[a.id][b];return(vg(d)+vg(c?c:d-50))/2}):(F=N(),E=function(a){return vg(a.x)-F/2}),C=Bc(If.data.targets),sj.select("."+g.eventRects).datum(C?C.values:[]),B=sj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),ef(B.enter()),B.attr("class",jd).attr("x",nh?0:E).attr("y",nh?E:0).attr("width",nh?ag:F).attr("height",nh?F:cg),B.exit().remove()),Dc(If.data.targets).forEach(function(a){zj[a]=!0})}function nf(){mf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function of(){if(0!==Jc(If.data.targets).length){if("mousemove"===Hf.event.sourceEvent.type&&pj.altDomain)return vg.domain(pj.altDomain),void pj.scale(vg).updateScaleExtent();Ni&&vg.orgDomain()[0]===xj[0]&&vg.domain([xj[0]-1e-10,vg.orgDomain()[1]]),mf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Hf.event.sourceEvent.type&&(Ri=!0)}}function pf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function qf(){qj.attr("width",eg).attr("height",fg),qj.select("#"+Gi).select("rect").attr("width",ag).attr("height",cg),qj.select("#"+Hi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),qj.select("#"+Ii).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),qj.select("."+g.zoomRect).attr("width",ag).attr("height",cg),wj.style("max-height",fg+"px")}function rf(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,p(),T(),qf(),o(a.withTransition),mf(a)}function sf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=sj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",ld),j=i.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Xc),e=sj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",nd),d=e.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",dd).style("cursor",function(a){return Xg(a)?"pointer":null}),c=sj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",md),b=c.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",_c),b.append("g").attr("class",hd),b.append("g").attr("class",function(a){return Vc(g.selectedCircles,a.id)}),b.append("g").attr("class",bd).style("cursor",function(a){return Xg(a)?"pointer":null}),a.forEach(function(a){sj.selectAll("."+g.selectedCircles+pd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=sj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(mg(a)).attr("class",od),f=h.enter().append("g").attr("class",od),f.append("g").attr("class",fd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),eh&&(n=tj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",nd),m=n.enter().append("g").style("opacity",0).attr("class",nd),m.append("g").attr("class",dd),l=tj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",md),k=l.enter().append("g").style("opacity",0).attr("class",md),k.append("g").attr("class",_c)),qj.selectAll("."+g.target).filter(function(a){return Hc(a.id)}).transition().duration(Yf).style("opacity",1)}function tf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?de(a.id,b.types[a.id]):de(a.id,b.type)}),If.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=dj?j:i,l=dj?S():R();return d&&(w=0,C=0,t=0,u=0),hh&&!Ic(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=dj?u:t,void(mh?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=uj.selectAll("."+g.legendItemFocused).size();b=b||{},n=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,dj?(f=function(a){return t*B[a]},j=function(a){return A[B[a]]+x[a]}):(f=function(a){return A[B[a]]+x[a]},j=function(a){return u*B[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=uj.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Vc(g.legendItem,a)}).style("visibility",function(a){return Ic(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof jh?jh(a):If.toggle(a)}).on("mouseover",function(a){Hf.select(this).classed(g.legendItemFocused,!0),Ti||If.focus(a),"function"==typeof kh&&kh(a)}).on("mouseout",function(a){Hf.select(this).classed(g.legendItemFocused,!1),Ti||If.revert(),"function"==typeof lh&&lh(a)}),m.append("text").text(function(a){return d(Jg[a])?Jg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",dj?h:-200).attr("y",dj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",dj?i:-200).attr("y",dj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",Vi).attr("x",dj?h:-200).attr("y",dj?-200:j).attr("width",10).attr("height",10),uj.selectAll("text").data(a).text(function(a){return d(Jg[a])?Jg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(n?250:0).attr("x",h).attr("y",k),uj.selectAll("rect."+g.legendItemEvent).data(a).transition().duration(n?250:0).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}).attr("x",i).attr("y",l),uj.selectAll("rect."+g.legendItemTile).data(a).transition().duration(n?250:0).style("fill",Vi).attr("x",f).attr("y",j),uj.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Hc(a)}).transition().style("opacity",function(a){var b=Hf.select(this);return Hc(a)?!D||b.classed(g.legendItemFocused)?wf(b):xf(b):hj}),P(t),Q(u),O(C),p(),T(),qf(),o(q,c)}function Df(a){return Fc(If.data.targets,a.id)}function Ef(a){return"data"in a&&Fc(If.data.targets,a.data.id)}function Ff(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 Gf(a,b,c){var d=!je(If.data.targets);Ti=!1,de(a,b),rf(c||{withTransitionForAxis:d})}var Hf=a.d3?a.d3:a.require?a.require("d3"):void 0,If={data:{},axis:{},legend:{}},Jf={},Kf=i(["bindto"],"#chart"),Lf=i(["size","width"]),Mf=i(["size","height"]),Nf=i(["padding","left"],50),Of=i(["padding","right"],0),Pf=i(["padding","top"],0),Qf=i(["padding","bottom"],0),Rf=i(["zoom","enabled"],!1),Sf=i(["zoom","extent"]),Tf=i(["zoom","privileged"],!1),Uf=i(["onenter"],function(){}),Vf=i(["onleave"],function(){}),Wf=i(["onresize"],function(){}),Xf=i(["onresized"],function(){}),Yf=i(["transition","duration"],350);h("data","data is required in config");var Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg=i(["data","x"]),Gg=i(["data","xs"],{}),Hg=i(["data","x_format"]),Ig=i(["data","id_converter"],function(a){return a}),Jg=i(["data","names"],{}),Kg=i(["data","classes"],{}),Lg=i(["data","groups"],[]),Mg=i(["data","axes"],{}),Ng=i(["data","type"]),Og=i(["data","types"],{}),Pg=i(["data","labels"],{}),Qg=i(["data","order"]),Rg=i(["data","regions"],{}),Sg=i(["data","color"]),Tg=i(["data","colors"],{}),Ug=i(["data","hide"],!1),Vg=i(["data","selection","enabled"],!1),Wg=i(["data","selection","grouped"],!1),Xg=i(["data","selection","isselectable"],function(){return!0}),Yg=i(["data","selection","multiple"],!0),Zg=i(["data","onclick"],function(){}),$g=i(["data","onenter"],function(){}),_g=i(["data","onleave"],function(){}),ah=i(["data","onselected"],function(){}),bh=i(["data","onunselected"],function(){}),ch=i(["data","ondragstart"],function(){}),dh=i(["data","ondragend"],function(){}),eh=i(["subchart","show"],!1),fh=i(["subchart","size","height"],60),gh=i(["color","pattern"],[]),hh=i(["legend","show"],!0),ih=i(["legend","position"],"bottom"),jh=i(["legend","item","onclick"]),kh=i(["legend","item","onmouseover"]),lh=i(["legend","item","onmouseout"]),mh=i(["legend","equally"],!1),nh=i(["axis","rotated"],!1),oh=i(["axis","x","show"],!0),ph=i(["axis","x","type"],"indexed"),qh=i(["axis","x","localtime"],!0),rh=i(["axis","x","categories"],[]),sh=i(["axis","x","tick","centered"],!1),th=i(["axis","x","tick","format"]),uh=i(["axis","x","tick","culling"],{}),vh=i(["axis","x","tick","culling","max"],10),wh=i(["axis","x","tick","count"]),xh=i(["axis","x","tick","fit"],!0),yh=i(["axis","x","tick","values"],null),zh=i(["axis","x","tick","rotate"]),Ah=i(["axis","x","max"],null),Bh=i(["axis","x","min"],null),Ch=i(["axis","x","padding"],{}),Dh=i(["axis","x","height"]),Eh=i(["axis","x","default"]),Fh=i(["axis","x","label"],{}),Gh=i(["axis","y","show"],!0),Hh=i(["axis","y","max"]),Ih=i(["axis","y","min"]),Jh=i(["axis","y","center"]),Kh=i(["axis","y","label"],{}),Lh=i(["axis","y","inner"],!1),Mh=i(["axis","y","tick","format"]),Nh=i(["axis","y","padding"]),Oh=i(["axis","y","ticks"],10),Ph=i(["axis","y2","show"],!1),Qh=i(["axis","y2","max"]),Rh=i(["axis","y2","min"]),Sh=i(["axis","y2","center"]),Th=i(["axis","y2","label"],{}),Uh=i(["axis","y2","inner"],!1),Vh=i(["axis","y2","tick","format"]),Wh=i(["axis","y2","padding"]),Xh=i(["axis","y2","ticks"],10),Yh=i(["grid","x","show"],!1),Zh=i(["grid","x","type"],"tick"),$h=i(["grid","x","lines"],[]),_h=i(["grid","y","show"],!1),ai=i(["grid","y","lines"],[]),bi=i(["grid","y","ticks"],10),ci=i(["point","show"],!0),di=i(["point","r"],2.5),ei=i(["point","focus","line","enabled"],!0),fi=i(["point","focus","expand","enabled"],!0),gi=i(["point","focus","expand","r"]),hi=i(["point","focus","select","r"]),ii=i(["line","connect_null"],!1),ji=i(["bar","width"]),ki=i(["bar","width","ratio"],.6),li=i(["pie","label","show"],!0),mi=i(["pie","label","format"]),ni=i(["pie","expand"],!0),oi=i(["pie","onclick"],function(){}),pi=i(["pie","onmouseover"],function(){}),qi=i(["pie","onmouseout"],function(){}),ri=i(["donut","label","show"],!0),si=i(["donut","label","format"]),ti=i(["donut","expand"],!0),ui=i(["donut","title"],""),vi=i(["donut","onclick"],function(){}),wi=i(["donut","onmouseover"],function(){}),xi=i(["donut","onmouseout"],function(){}),yi=i(["regions"],[]),zi=i(["tooltip","show"],!0),Ai=i(["tooltip","format","title"]),Bi=i(["tooltip","format","value"]),Ci=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Ai?Ai:b,l=Bi?Bi:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Di=i(["tooltip","init","show"],!1),Ei=i(["tooltip","init","x"],0),Fi=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Gi=("string"==typeof Kf?Kf.replace("#",""):Kf.id)+"-clip",Hi=Gi+"-xaxis",Ii=Gi+"-yaxis",Ji=j(Gi),Ki=j(Hi),Li=j(Ii),Mi="timeseries"===ph,Ni="categorized"===ph,Oi=!Mi&&(Fg||De(Gg)),Pi=null,Qi=!1,Ri=!1,Si=!1,Ti=!1,Ui=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Vi=xe(Tg,De(gh)?gh:Ui,Sg),Wi=qh?Hf.time.format:Hf.time.format.utc,Xi=function(){var a=[[Wi("%Y/%-m/%-d"),function(){return!0}],[Wi("%-m/%-d"),function(a){return a.getMonth()}],[Wi("%-m/%-d"),function(a){return 1!==a.getDate()}],[Wi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Wi("%I %p"),function(a){return a.getHours()}],[Wi("%I:%M"),function(a){return a.getMinutes()}],[Wi(":%S"),function(a){return a.getSeconds()}],[Wi(".%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)}}(),Yi=[],Zi=[],$i=nh?"left":"bottom",_i=nh?Lh?"top":"bottom":Lh?"right":"left",aj=nh?Uh?"bottom":"top":Uh?"left":"right",bj=nh?"left":"bottom",cj={main:function(){return"translate("+k(Zf.left)+","+k(Zf.top)+")"},context:function(){return"translate("+k($f.left)+","+k($f.top)+")"},legend:function(){return"translate("+_f.left+","+_f.top+")"},x:function(){return"translate(0,"+(nh?0:cg)+")"},y:function(){return"translate(0,"+(nh?cg:0)+")"},y2:function(){return"translate("+(nh?0:ag)+","+(nh?1:0)+")"},subx:function(){return"translate(0,"+(nh?0:dg)+")"},arc:function(){return"translate("+ag/2+","+cg/2+")" -}},dj="right"===ih,ej=0,fj=0,gj=0,hj=.15,ij=30,jj=nh&&!oh?0:30,kj=5;mg=Hf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var lj,mj=function(){var a=Hf.svg.line().x(nh?function(a){return X(a.id)(a.value)}:Gd).y(nh?Gd:function(a){return X(a.id)(a.value)});return ii||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ii?Pe(b.values):b.values;return ke(b)?(a.interpolate(le(b)?"cardinal":"linear"),Rg[b.id]?cf(e,vg,X(b.id),Rg[b.id]):a(e)):(c=e[0]?vg(e[0].x):0,d=e[0]?X(b.id)(e[0].value):0,nh?"M "+d+" "+c:"M "+c+" "+d)}}(),nj=function(){var a;return a=nh?Hf.svg.area().x0(function(a){return X(a.id)(0)}).x1(function(a){return X(a.id)(a.value)}).y(Gd):Hf.svg.area().x(Gd).y0(function(a){return X(a.id)(0)}).y1(function(a){return X(a.id)(a.value)}),function(b){var c,d,e=Pe(b.values);return ee([b],"area")||ee([b],"area-spline")?(a.interpolate(le(b)?"cardinal":"linear"),a(e)):(c=e[0]?vg(e[0].x):0,d=e[0]?X(b.id)(e[0].value):0,nh?"M "+d+" "+c:"M "+c+" "+d)}}(),oj=function(){var a=Hf.svg.line().x(nh?function(a){return Y(a.id)(a.value)}:Jd).y(nh?Jd:function(a){return Y(a.id)(a.value)});return function(b){var c=Pe(b.values);return ke(b)?a(c):"M "+yg(c[0].x)+" "+Y(b.id)(c[0].value)}}(),pj=function(){};lj=Hf.svg.brush().on("brush",nf),lj.update=function(){return tj&&tj.select("."+g.brush).call(this),this},lj.scale=function(a){return nh?this.y(a):this.x(a)},Rf&&(pj=Hf.behavior.zoom().on("zoomstart",function(){pj.altDomain=Hf.event.sourceEvent.altKey?vg.orgDomain():null}).on("zoom",Rf?of:null),pj.scale=function(a){return nh?this.y(a):this.x(a)},pj.orgScaleExtent=function(){var a=Sf?Sf:[1,10];return[a[0],Math.max(Ac()/a[1],a[1])]},pj.updateScaleExtent=function(){var a=bc(vg.orgDomain())/bc(xj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var qj,rj,sj,tj,uj,vj,wj,xj,yj,zj={};if(If.focus=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",1)}var c=qj.selectAll(qd(a)),d=c.filter(Df),e=c.filter(Ef);If.revert(),If.defocus(),b(d.classed(g.focused,!0)),b(e),je(If.data.targets)&&Ob(a,!0),yf(a,!0)},If.defocus=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",.3)}var c=qj.selectAll(qd(a)),d=c.filter(Df),e=c.filter(Ef);If.revert(),b(d.classed(g.focused,!1)),b(e),je(If.data.targets)&&Pb(a),yf(a,!1)},If.revert=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",1)}var c=qj.selectAll(qd(a)),d=c.filter(Df),e=c.filter(Ef);b(d.classed(g.focused,!1)),b(e),je(If.data.targets)&&Pb(a),zf()},If.show=function(a,b){a=Ec(a),b=b||{},Nc(a),qj.selectAll(rd(a)).transition().style("opacity",1),b.withLegend&&Af(a),mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},If.hide=function(a,b){a=Ec(a),b=b||{},Mc(a),qj.selectAll(rd(a)).transition().style("opacity",0),b.withLegend&&Bf(a),mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},If.toggle=function(a){Hc(a)?If.hide(a):If.show(a)},If.unzoom=function(){lj.clear().update(),mf({withUpdateXDomain:!0})},If.load=function(a){return a.xs&&oc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Kg[b]=a.classes[b]}),"categories"in a&&Ni&&(rh=a.categories,Bg.categories(rh)),"cacheIds"in a&&cc(a.cacheIds)?void tf(ec(a.cacheIds),a.done):void("unload"in a?vf(Ec("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){uf(a)}):uf(a))},If.unload=function(a,b){vf(Ec(a),function(){mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},If.selected=function(a){return Hf.merge(sj.selectAll("."+g.shapes+pd(a)).selectAll("."+g.shape).filter(function(){return Hf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},If.select=function(a,b,c){Vg&&sj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Hf.select(this),i=e.data?e.data.id:e.id,j=Oe(this),k=Wg||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);"path"!==this.nodeName&&(k&&l?Xg(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},If.unselect=function(a,b){Vg&&sj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Hf.select(this),f=c.data?c.data.id:c.id,h=Oe(this),i=Wg||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);"path"!==this.nodeName&&i&&j&&Xg(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},If.toLine=function(a){Gf(a,"line")},If.toSpline=function(a){Gf(a,"spline")},If.toBar=function(a){Gf(a,"bar")},If.toScatter=function(a){Gf(a,"scatter")},If.toArea=function(a){Gf(a,"area")},If.toAreaSpline=function(a){Gf(a,"area-spline")},If.toPie=function(a){Gf(a,"pie",{withTransform:!0})},If.toDonut=function(a){Gf(a,"donut",{withTransform:!0})},If.groups=function(a){return c(a)?Lg:(Lg=a,mf(),Lg)},If.xgrids=function(a){return a?($h=a,mf(),$h):$h},If.xgrids.add=function(a){return a?If.xgrids($h.concat(a)):void 0},If.xgrids.remove=function(a){var b=Ff(a);return If.xgrids($h.filter(b))},If.ygrids=function(a){return a?(ai=a,mf(),ai):ai},If.ygrids.add=function(a){return a?If.ygrids(ai.concat(a)):void 0},If.ygrids.remove=function(a){var b=Ff(a);return If.ygrids(ai.filter(b))},If.regions=function(a){return c(a)?yi:(yi=a,mf(),yi)},If.regions.add=function(a){return c(a)?yi:(yi=yi.concat(a),mf(),yi)},If.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;qj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),yi=yi.filter(function(b){return b.classes.indexOf(a)<0})}),yi},If.data.get=function(a){var b=If.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},If.data.getAsTarget=function(a){var b=Gc(function(b){return b.id===a});return b.length>0?b[0]:void 0},If.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Jg[b]=a[b]}),mf({withLegend:!0}),Jg):Jg},If.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Tg[b]=a[b]}),mf({withLegend:!0}),Tg):Tg},If.x=function(a){return arguments.length&&(rc(If.data.targets,a),mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),If.data.xs},If.xs=function(a){return arguments.length&&(sc(If.data.targets,a),mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),If.data.xs},If.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){db(b,a[b])}),Fb())},If.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Ah=+a.x),b(a.y)&&(Hh=+a.y),b(a.y2)&&(Qh=+a.y2)):Hh=Qh=+a,mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},If.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Bh=+a.x),b(a.y)&&(Ih=+a.y),b(a.y2)&&(Rh=+a.y2)):Ih=Rh=+a,mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},If.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&If.axis.max(a.max),"undefined"!=typeof a.min&&If.axis.min(a.min))},If.legend.show=function(a){Af(Ec(a)),mf({withLegend:!0})},If.legend.hide=function(a){Bf(Ec(a)),mf({withLegend:!0})},If.resize=function(a){Lf=a?a.width:null,Mf=a?a.height:null,rf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},If.destroy=function(){If.data.targets=void 0,If.data.xs={},wj.html(""),a.onresize=null},"url"in f.data)Hf.xhr(f.data.url,function(a,b){var c,d=Hf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Hf.csv.parse(b.response),df(c)});else if("rows"in f.data)df(uc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");df(vc(f.data.columns))}return If},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(window); \ No newline at end of file +},g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function df(b){var c,d,e;if(wj=Hf.select(Kf),wj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(wj.html("").classed("c3",!0),If.data.xs={},If.data.targets=wc(b),Ug&&Mc(Ug===!0?Dc(If.data.targets):Ug),p(),T(),vg.domain(Hf.extent(ac(If.data.targets))),wg.domain(Yb(If.data.targets,"y")),xg.domain(Yb(If.data.targets,"y2")),yg.domain(vg.domain()),zg.domain(wg.domain()),Ag.domain(xg.domain()),xj=vg.domain(),lj.scale(yg),Rf&&pj.scale(vg),qj=wj.append("svg").on("mouseenter",Uf).on("mouseleave",Vf),rj=qj.append("defs"),rj.append("clipPath").attr("id",Gi).append("rect"),rj.append("clipPath").attr("id",Hi).append("rect"),rj.append("clipPath").attr("id",Ii).append("rect"),qf(),sj=qj.append("g").attr("transform",cj.main),tj=qj.append("g").attr("transform",cj.context),uj=qj.append("g").attr("transform",cj.legend),eh||tj.style("visibility","hidden"),hh||(uj.style("visibility","hidden"),Zi=Dc(If.data.targets)),vj=Hf.select(Kf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Cf(Dc(If.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=sj.append("g").attr("clip-path",Ji).attr("class",g.grid),Yh&&d.append("g").attr("class",g.xgrids),De($h)&&d.append("g").attr("class",g.xgridLines),ei&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),_h&&d.append("g").attr("class",g.ygrids),De(ai)&&d.append("g").attr("class",g.ygridLines),sj.append("g").attr("clip-path",Ji).attr("class",g.regions),sj.append("g").attr("clip-path",Ji).attr("class",g.chart),c=sj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Rf?nh?"ns-resize":"ew-resize":null),sj.select("."+g.chart).append("g").attr("class",g.chartBars),sj.select("."+g.chart).append("g").attr("class",g.chartLines),sj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",cj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Sb()),sj.select("."+g.chart).append("g").attr("class",g.chartTexts),Rf&&sj.insert("rect",Tf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",ag).attr("height",cg).style("opacity",0).style("cursor",nh?"ns-resize":"ew-resize").call(pj).on("dblclick.zoom",null),Eh&&lj.extent("function"!=typeof Eh?Eh:Eh(ac())),oh&&sj.append("g").attr("class",g.axisX).attr("clip-path",Ki).attr("transform",cj.x).append("text").attr("class",g.axisXLabel).attr("transform",nh?"rotate(-90)":"").style("text-anchor",Bb),Gh&&sj.append("g").attr("class",g.axisY).attr("clip-path",Li).attr("transform",cj.y).append("text").attr("class",g.axisYLabel).attr("transform",nh?"":"rotate(-90)").style("text-anchor",Cb),Ph&&sj.append("g").attr("class",g.axisY2).attr("transform",cj.y2).append("text").attr("class",g.axisY2Label).attr("transform",nh?"":"rotate(-90)").style("text-anchor",Db),tj.append("g").attr("clip-path",Ji).attr("class",g.chart),tj.select("."+g.chart).append("g").attr("class",g.chartBars),tj.select("."+g.chart).append("g").attr("class",g.chartLines),tj.append("g").attr("clip-path",Ji).attr("class",g.brush).call(lj).selectAll("rect").attr(nh?"width":"height",nh?bg:dg),tj.append("g").attr("class",g.axisX).attr("transform",cj.subx).attr("clip-path",nh?"":Ki),sf(If.data.targets),nh?sj.select("."+g.axisX).style("opacity",0).call(Bg):(sj.select("."+g.axisY).style("opacity",0).call(Cg),sj.select("."+g.axisY2).style("opacity",0).call(Dg)),p(),T(),qf(),o(!1),mf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Di){if(Mi&&"string"==typeof Ei){for(Ei=ye(Ei),e=0;e0){d=[];for(var f in Jg)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Pd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Me,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function jf(a){je(If.data.targets)||Vg&&(Pi=a,sj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Qi=!0,ch())}function kf(){je(If.data.targets)||Vg&&(sj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),sj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Qi=!1,dh())}function lf(a,b){"grid"===b&&a.each(function(){var a=Hf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function mf(a){var c,e,f,h,i,j,k,l,m,n,o,p,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,O,P,Q,R,S,T,U,V,W,X,Y,Z,$,_=$d(),ab=je(If.data.targets),bb=Jc(If.data.targets);if(a=d(a)?a:{},G=d(a.withY)?a.withY:!0,H=d(a.withSubchart)?a.withSubchart:!0,I=d(a.withTransition)?a.withTransition:!0,L=d(a.withTransform)?a.withTransform:!1,M=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,O=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,P=d(a.withLegend)?a.withLegend:!1,J=d(a.withTransitionForExit)?a.withTransitionForExit:I,K=d(a.withTransitionForAxis)?a.withTransitionForAxis:I,V=I?Yf:0,W=J?V:0,X=K?V:0,c=sj.select("."+g.axisX).style("opacity",ab?0:1),f=sj.select("."+g.axisY).style("opacity",ab?0:1),h=sj.select("."+g.axisY2).style("opacity",ab?0:1),e=tj.select("."+g.axisX).style("opacity",ab?0:1),U={axisX:c.transition().duration(X),axisY:f.transition().duration(X),axisY2:h.transition().duration(X),axisSubX:e.transition().duration(X)},P&&hh&&Cf(Dc(If.data.targets),a,U),Ni&&0===bb.length&&vg.domain([0,c.selectAll(".tick").size()]),bb.length&&(O&&(vg.domain(Hf.extent(ac(bb))),xj=vg.domain(),Rf&&pj.scale(vg).updateScaleExtent(),yg.domain(vg.domain()),lj.scale(yg)),M&&(vg.domain(lj.empty()?xj:lj.extent()),Rf&&pj.scale(vg).updateScaleExtent()),yh||!xh&&!wh||(Y=Lc(Kc(bb),wh),Bg.tickValues(Y),Eg.tickValues(Y))),wg.domain(Yb(bb,"y")),xg.domain(Yb(bb,"y2")),U.axisX.call(Bg),U.axisY.call(Cg),U.axisY2.call(Dg),U.axisSubX.call(Eg),Fb(I),M&&bb.length)if(uh&&Y){for(Z=1;Z=0&&Hf.select(this).style("display",b%$?"none":"block")})}else qj.selectAll("."+g.axisX+" .tick text").style("display","block");!nh&&zh&&gb(c,U.axisX,zh),Q=Ze(_),S=$e(_,!0),T=$e(_,!1),zg.domain(wg.domain()),Ag.domain(xg.domain()),vj.style("display","none"),q(),sj.select("line."+g.xgridFocus).style("visibility","hidden"),Yh&&(k=Xd(Zh,vg),D=Ni?Bg.tickOffset():0,j=nh?{x1:0,x2:ag,y1:function(a){return vg(a)-D},y2:function(a){return vg(a)-D}}:{x1:function(a){return vg(a)+D},x2:function(a){return vg(a)+D},y1:Zf.top,y2:cg},i=sj.select("."+g.xgrids).selectAll("."+g.xgrid).data(k),i.enter().append("line").attr("class",g.xgrid),i.attr(j).style("opacity",function(){return+Hf.select(this).attr(nh?"y1":"x1")===(nh?cg:0)?0:1}),i.exit().remove()),De($h)&&(l=sj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data($h),m=l.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",nh?"":"rotate(-90)").attr("dx",nh?0:-Zf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(V).attr("x1",nh?0:Hd).attr("x2",nh?ag:Hd).attr("y1",nh?Hd:Zf.top).attr("y2",nh?Hd:cg).style("opacity",1),l.select("text").transition().duration(V).attr("x",nh?ag:0).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(V).style("opacity",0).remove()),G&&_h&&(n=sj.select("."+g.ygrids).selectAll("."+g.ygrid).data(wg.ticks(bi)),n.enter().append("line").attr("class",g.ygrid),n.attr("x1",nh?wg:0).attr("x2",nh?wg:ag).attr("y1",nh?0:wg).attr("y2",nh?cg:wg),n.exit().remove(),lf(n,"grid")),G&&De(ai)&&(o=sj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(ai),p=o.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",nh?"rotate(-90)":"").attr("dx",nh?0:-Zf.top).attr("dy",-5).style("opacity",0),o.select("line").transition().duration(V).attr("x1",nh?Id:0).attr("x2",nh?Id:ag).attr("y1",nh?0:Id).attr("y2",nh?cg:Id).style("opacity",1),o.select("text").transition().duration(V).attr("x",nh?0:ag).attr("y",Id).text(function(a){return a.text}).style("opacity",1),o.exit().transition().duration(V).style("opacity",0).remove()),w=sj.select("."+g.regions).selectAll("."+g.region).data(yi),w.enter().append("g").attr("class",id).append("rect").style("fill-opacity",0),w.selectAll("rect").transition().duration(V).attr("x",fc).attr("y",gc).attr("width",hc).attr("height",ic).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),w.exit().transition().duration(V).style("fill-opacity",0).remove(),u=sj.selectAll("."+g.bars).selectAll("."+g.bar).data(te),u.enter().append("path").attr("class",cd).style("stroke","none").style("fill",Vi),u.style("opacity",ud).transition().duration(V).attr("d",Q).style("fill",Vi).style("opacity",1),u.exit().transition().duration(W).style("opacity",0).remove(),r=sj.selectAll("."+g.lines).selectAll("."+g.line).data(re),r.enter().append("path").attr("class",$c).style("stroke",Vi),r.style("opacity",ud).transition().duration(V).attr("d",mj).style("stroke",Vi).style("opacity",1),r.exit().transition().duration(W).style("opacity",0).remove(),s=sj.selectAll("."+g.areas).selectAll("."+g.area).data(re),s.enter().append("path").attr("class",gd).style("fill",Vi).style("opacity",function(){return yj=+Hf.select(this).style("opacity"),0}),s.style("opacity",0).transition().duration(V).attr("d",nj).style("fill",Vi).style("opacity",yj),s.exit().transition().duration(W).style("opacity",0).remove(),t=sj.selectAll("."+g.circles).selectAll("."+g.circle).data(ue),t.enter().append("circle").attr("class",ad).attr("r",Qe).style("fill",Vi),t.style("opacity",ud).transition().duration(V).style("opacity",wd).style("fill",Vi).attr("cx",nh?Zd:Yd).attr("cy",nh?Yd:Zd),t.exit().remove(),x=sj.selectAll("."+g.texts).selectAll("."+g.text).data(ve),x.enter().append("text").attr("class",Wc).attr("text-anchor",function(a){return nh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",Vi).style("fill-opacity",0),x.text(function(a){return Fd(a.id)(a.value,a.id)}).style("fill-opacity",vd).transition().duration(V).attr("x",S).attr("y",T).style("fill",Vi).style("fill-opacity",xd),x.exit().transition().duration(W).style("fill-opacity",0).remove(),v=sj.selectAll("."+g.arcs).selectAll("."+g.arc).data(se),v.enter().append("path").attr("class",ed).style("fill",function(a){return Vi(a.data)}).style("cursor",function(a){return Xg(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Ti||(c=Gb(a),d=Mb(c),e=Ub(),Ob(c.data.id),yf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Gb(a),c=Mb(b),d=[c];Td(d,Hf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Ti||(c=Gb(a),d=Mb(c),e=Vb(),Pb(c.data.id),zf(),Ud(),e(d,b))}).on("click",function(a,b){var c=Gb(a),d=Mb(c),e=Tb();gf(this,a,b),e(d,b)}),v.attr("transform",L?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Ti=!0}).transition().duration(V).attrTween("d",function(a){var b,c=Gb(a);return c?(b=Hf.interpolate(this._current,c),this._current=b(0),function(a){return Jb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",L?"scale(1)":"").style("fill",function(a){return Vi(a.data)}).style("opacity",1).call(Ge,function(){Ti=!1}),v.exit().transition().duration(W).style("opacity",0).remove(),sj.selectAll("."+g.chartArc).select("text").attr("transform",Kb).style("opacity",0).transition().duration(V).text(Nb).style("opacity",function(a){return Hc(a.data.id)&&qe(a.data)?1:0}),sj.select("."+g.chartArcsTitle).style("opacity",ie(If.data.targets)?1:0),eh&&(Hf.event&&"zoom"===Hf.event.type&&lj.extent(vg.orgDomain()).update(),H&&(!nh&&zh&&gb(e,U.axisSubX,zh),lj.empty()||lj.extent(vg.orgDomain()).update(),R=Ze(_,!0),z=tj.selectAll("."+g.bars).selectAll("."+g.bar).data(te),z.enter().append("path").attr("class",cd).style("stroke","none").style("fill",Vi),z.style("opacity",ud).transition().duration(V).attr("d",R).style("opacity",1),z.exit().transition().duration(V).style("opacity",0).remove(),y=tj.selectAll("."+g.lines).selectAll("."+g.line).data(re),y.enter().append("path").attr("class",$c).style("stroke",Vi),y.style("opacity",ud).transition().duration(V).attr("d",oj).style("opacity",1),y.exit().transition().duration(V).style("opacity",0).remove())),sj.selectAll("."+g.selectedCircles).filter(function(a){return me(a)}).selectAll("circle").remove(),sj.selectAll("."+g.selectedCircle).transition().duration(V).attr("cx",nh?Zd:Yd).attr("cy",nh?Yd:Zd),A=sj.select("."+g.eventRects),De(Gg)&&!pc(Gg)?(A.classed(g.eventRectsMultiple)||A.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),B=sj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),ff(B.enter()),B.attr("x",0).attr("y",0).attr("width",ag).attr("height",cg)):(A.classed(g.eventRectsSingle)||A.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Oi&&!Ni?(F=function(a,b){var c=yc(b),d=zc(b),e=If.data.xs[a.id][b];return(vg(d?d:e+50)-vg(c?c:e-50))/2},E=function(a,b){var c=yc(b),d=If.data.xs[a.id][b];return(vg(d)+vg(c?c:d-50))/2}):(F=N(),E=function(a){return vg(a.x)-F/2}),C=Bc(If.data.targets),sj.select("."+g.eventRects).datum(C?C.values:[]),B=sj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),ef(B.enter()),B.attr("class",jd).attr("x",nh?0:E).attr("y",nh?E:0).attr("width",nh?ag:F).attr("height",nh?F:cg),B.exit().remove()),Dc(If.data.targets).forEach(function(a){zj[a]=!0})}function nf(){mf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function of(){if(0!==Jc(If.data.targets).length){if("mousemove"===Hf.event.sourceEvent.type&&pj.altDomain)return vg.domain(pj.altDomain),void pj.scale(vg).updateScaleExtent();Ni&&vg.orgDomain()[0]===xj[0]&&vg.domain([xj[0]-1e-10,vg.orgDomain()[1]]),mf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Hf.event.sourceEvent.type&&(Ri=!0)}}function pf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function qf(){qj.attr("width",eg).attr("height",fg),qj.select("#"+Gi).select("rect").attr("width",ag).attr("height",cg),qj.select("#"+Hi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),qj.select("#"+Ii).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),qj.select("."+g.zoomRect).attr("width",ag).attr("height",cg),wj.style("max-height",fg+"px")}function rf(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,p(),T(),qf(),o(a.withTransition),mf(a)}function sf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=sj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",ld),j=i.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Xc),e=sj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",nd),d=e.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",dd).style("cursor",function(a){return Xg(a)?"pointer":null}),c=sj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",md),b=c.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",_c),b.append("g").attr("class",hd),b.append("g").attr("class",function(a){return Vc(g.selectedCircles,a.id)}),b.append("g").attr("class",bd).style("cursor",function(a){return Xg(a)?"pointer":null}),a.forEach(function(a){sj.selectAll("."+g.selectedCircles+pd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=sj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(mg(a)).attr("class",od),f=h.enter().append("g").attr("class",od),f.append("g").attr("class",fd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),eh&&(n=tj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",nd),m=n.enter().append("g").style("opacity",0).attr("class",nd),m.append("g").attr("class",dd),l=tj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",md),k=l.enter().append("g").style("opacity",0).attr("class",md),k.append("g").attr("class",_c)),qj.selectAll("."+g.target).filter(function(a){return Hc(a.id)}).transition().duration(Yf).style("opacity",1)}function tf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?de(a.id,b.types[a.id]):de(a.id,b.type)}),If.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=dj?j:i,l=dj?S():R();return d&&(w=0,C=0,t=0,u=0),hh&&!Ic(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=dj?u:t,void(mh?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=uj.selectAll("."+g.legendItemFocused).size();b=b||{},n=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,dj?(f=function(a){return t*B[a]},j=function(a){return A[B[a]]+x[a]}):(f=function(a){return A[B[a]]+x[a]},j=function(a){return u*B[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=uj.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Vc(g.legendItem,a)}).style("visibility",function(a){return Ic(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof jh?jh(a):If.toggle(a)}).on("mouseover",function(a){Hf.select(this).classed(g.legendItemFocused,!0),Ti||If.focus(a),"function"==typeof kh&&kh(a)}).on("mouseout",function(a){Hf.select(this).classed(g.legendItemFocused,!1),Ti||If.revert(),"function"==typeof lh&&lh(a)}),m.append("text").text(function(a){return d(Jg[a])?Jg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",dj?h:-200).attr("y",dj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",dj?i:-200).attr("y",dj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",Vi).attr("x",dj?h:-200).attr("y",dj?-200:j).attr("width",10).attr("height",10),uj.selectAll("text").data(a).text(function(a){return d(Jg[a])?Jg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(n?250:0).attr("x",h).attr("y",k),uj.selectAll("rect."+g.legendItemEvent).data(a).transition().duration(n?250:0).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}).attr("x",i).attr("y",l),uj.selectAll("rect."+g.legendItemTile).data(a).transition().duration(n?250:0).style("fill",Vi).attr("x",f).attr("y",j),uj.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Hc(a)}).transition().style("opacity",function(a){var b=Hf.select(this);return Hc(a)?!D||b.classed(g.legendItemFocused)?wf(b):xf(b):hj}),P(t),Q(u),O(C),p(),T(),qf(),o(q,c)}function Df(a){return Fc(If.data.targets,a.id)}function Ef(a){return"data"in a&&Fc(If.data.targets,a.data.id)}function Ff(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 Gf(a,b,c){var d=!je(If.data.targets);Ti=!1,de(a,b),rf(c||{withTransitionForAxis:d})}var Hf=a.d3?a.d3:a.require?a.require("d3"):void 0,If={data:{},axis:{},legend:{}},Jf={},Kf=i(["bindto"],"#chart"),Lf=i(["size","width"]),Mf=i(["size","height"]),Nf=i(["padding","left"],50),Of=i(["padding","right"],0),Pf=i(["padding","top"],0),Qf=i(["padding","bottom"],0),Rf=i(["zoom","enabled"],!1),Sf=i(["zoom","extent"]),Tf=i(["zoom","privileged"],!1),Uf=i(["onenter"],function(){}),Vf=i(["onleave"],function(){}),Wf=i(["onresize"],function(){}),Xf=i(["onresized"],function(){}),Yf=i(["transition","duration"],350);h("data","data is required in config");var Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg=i(["data","x"]),Gg=i(["data","xs"],{}),Hg=i(["data","x_format"]),Ig=i(["data","id_converter"],function(a){return a}),Jg=i(["data","names"],{}),Kg=i(["data","classes"],{}),Lg=i(["data","groups"],[]),Mg=i(["data","axes"],{}),Ng=i(["data","type"]),Og=i(["data","types"],{}),Pg=i(["data","labels"],{}),Qg=i(["data","order"]),Rg=i(["data","regions"],{}),Sg=i(["data","color"]),Tg=i(["data","colors"],{}),Ug=i(["data","hide"],!1),Vg=i(["data","selection","enabled"],!1),Wg=i(["data","selection","grouped"],!1),Xg=i(["data","selection","isselectable"],function(){return!0}),Yg=i(["data","selection","multiple"],!0),Zg=i(["data","onclick"],function(){}),$g=i(["data","onenter"],function(){}),_g=i(["data","onleave"],function(){}),ah=i(["data","onselected"],function(){}),bh=i(["data","onunselected"],function(){}),ch=i(["data","ondragstart"],function(){}),dh=i(["data","ondragend"],function(){}),eh=i(["subchart","show"],!1),fh=i(["subchart","size","height"],60),gh=i(["color","pattern"],[]),hh=i(["legend","show"],!0),ih=i(["legend","position"],"bottom"),jh=i(["legend","item","onclick"]),kh=i(["legend","item","onmouseover"]),lh=i(["legend","item","onmouseout"]),mh=i(["legend","equally"],!1),nh=i(["axis","rotated"],!1),oh=i(["axis","x","show"],!0),ph=i(["axis","x","type"],"indexed"),qh=i(["axis","x","localtime"],!0),rh=i(["axis","x","categories"],[]),sh=i(["axis","x","tick","centered"],!1),th=i(["axis","x","tick","format"]),uh=i(["axis","x","tick","culling"],{}),vh=i(["axis","x","tick","culling","max"],10),wh=i(["axis","x","tick","count"]),xh=i(["axis","x","tick","fit"],!0),yh=i(["axis","x","tick","values"],null),zh=i(["axis","x","tick","rotate"]),Ah=i(["axis","x","max"],null),Bh=i(["axis","x","min"],null),Ch=i(["axis","x","padding"],{}),Dh=i(["axis","x","height"]),Eh=i(["axis","x","default"]),Fh=i(["axis","x","label"],{}),Gh=i(["axis","y","show"],!0),Hh=i(["axis","y","max"]),Ih=i(["axis","y","min"]),Jh=i(["axis","y","center"]),Kh=i(["axis","y","label"],{}),Lh=i(["axis","y","inner"],!1),Mh=i(["axis","y","tick","format"]),Nh=i(["axis","y","padding"]),Oh=i(["axis","y","ticks"],10),Ph=i(["axis","y2","show"],!1),Qh=i(["axis","y2","max"]),Rh=i(["axis","y2","min"]),Sh=i(["axis","y2","center"]),Th=i(["axis","y2","label"],{}),Uh=i(["axis","y2","inner"],!1),Vh=i(["axis","y2","tick","format"]),Wh=i(["axis","y2","padding"]),Xh=i(["axis","y2","ticks"],10),Yh=i(["grid","x","show"],!1),Zh=i(["grid","x","type"],"tick"),$h=i(["grid","x","lines"],[]),_h=i(["grid","y","show"],!1),ai=i(["grid","y","lines"],[]),bi=i(["grid","y","ticks"],10),ci=i(["point","show"],!0),di=i(["point","r"],2.5),ei=i(["point","focus","line","enabled"],!0),fi=i(["point","focus","expand","enabled"],!0),gi=i(["point","focus","expand","r"]),hi=i(["point","focus","select","r"]),ii=i(["line","connect_null"],!1),ji=i(["bar","width"]),ki=i(["bar","width","ratio"],.6),li=i(["pie","label","show"],!0),mi=i(["pie","label","format"]),ni=i(["pie","expand"],!0),oi=i(["pie","onclick"],function(){}),pi=i(["pie","onmouseover"],function(){}),qi=i(["pie","onmouseout"],function(){}),ri=i(["donut","label","show"],!0),si=i(["donut","label","format"]),ti=i(["donut","expand"],!0),ui=i(["donut","title"],""),vi=i(["donut","onclick"],function(){}),wi=i(["donut","onmouseover"],function(){}),xi=i(["donut","onmouseout"],function(){}),yi=i(["regions"],[]),zi=i(["tooltip","show"],!0),Ai=i(["tooltip","format","title"]),Bi=i(["tooltip","format","value"]),Ci=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Ai?Ai:b,l=Bi?Bi:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Di=i(["tooltip","init","show"],!1),Ei=i(["tooltip","init","x"],0),Fi=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Gi=("string"==typeof Kf?Kf.replace("#",""):Kf.id)+"-clip",Hi=Gi+"-xaxis",Ii=Gi+"-yaxis",Ji=j(Gi),Ki=j(Hi),Li=j(Ii),Mi="timeseries"===ph,Ni="categorized"===ph,Oi=!Mi&&(Fg||De(Gg)),Pi=null,Qi=!1,Ri=!1,Si=!1,Ti=!1,Ui=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Vi=xe(Tg,De(gh)?gh:Ui,Sg),Wi=qh?Hf.time.format:Hf.time.format.utc,Xi=Wi.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),Yi=[],Zi=[],$i=nh?"left":"bottom",_i=nh?Lh?"top":"bottom":Lh?"right":"left",aj=nh?Uh?"bottom":"top":Uh?"left":"right",bj=nh?"left":"bottom",cj={main:function(){return"translate("+k(Zf.left)+","+k(Zf.top)+")"},context:function(){return"translate("+k($f.left)+","+k($f.top)+")"},legend:function(){return"translate("+_f.left+","+_f.top+")"},x:function(){return"translate(0,"+(nh?0:cg)+")"},y:function(){return"translate(0,"+(nh?cg:0)+")"},y2:function(){return"translate("+(nh?0:ag)+","+(nh?1:0)+")"},subx:function(){return"translate(0,"+(nh?0:dg)+")"},arc:function(){return"translate("+ag/2+","+cg/2+")"}},dj="right"===ih,ej=0,fj=0,gj=0,hj=.15,ij=30,jj=nh&&!oh?0:30,kj=5;mg=Hf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value +},0)});var lj,mj=function(){var a=Hf.svg.line().x(nh?function(a){return X(a.id)(a.value)}:Gd).y(nh?Gd:function(a){return X(a.id)(a.value)});return ii||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ii?Pe(b.values):b.values;return ke(b)?(a.interpolate(le(b)?"cardinal":"linear"),Rg[b.id]?cf(e,vg,X(b.id),Rg[b.id]):a(e)):(c=e[0]?vg(e[0].x):0,d=e[0]?X(b.id)(e[0].value):0,nh?"M "+d+" "+c:"M "+c+" "+d)}}(),nj=function(){var a;return a=nh?Hf.svg.area().x0(function(a){return X(a.id)(0)}).x1(function(a){return X(a.id)(a.value)}).y(Gd):Hf.svg.area().x(Gd).y0(function(a){return X(a.id)(0)}).y1(function(a){return X(a.id)(a.value)}),function(b){var c,d,e=Pe(b.values);return ee([b],"area")||ee([b],"area-spline")?(a.interpolate(le(b)?"cardinal":"linear"),a(e)):(c=e[0]?vg(e[0].x):0,d=e[0]?X(b.id)(e[0].value):0,nh?"M "+d+" "+c:"M "+c+" "+d)}}(),oj=function(){var a=Hf.svg.line().x(nh?function(a){return Y(a.id)(a.value)}:Jd).y(nh?Jd:function(a){return Y(a.id)(a.value)});return function(b){var c=Pe(b.values);return ke(b)?a(c):"M "+yg(c[0].x)+" "+Y(b.id)(c[0].value)}}(),pj=function(){};lj=Hf.svg.brush().on("brush",nf),lj.update=function(){return tj&&tj.select("."+g.brush).call(this),this},lj.scale=function(a){return nh?this.y(a):this.x(a)},Rf&&(pj=Hf.behavior.zoom().on("zoomstart",function(){pj.altDomain=Hf.event.sourceEvent.altKey?vg.orgDomain():null}).on("zoom",Rf?of:null),pj.scale=function(a){return nh?this.y(a):this.x(a)},pj.orgScaleExtent=function(){var a=Sf?Sf:[1,10];return[a[0],Math.max(Ac()/a[1],a[1])]},pj.updateScaleExtent=function(){var a=bc(vg.orgDomain())/bc(xj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var qj,rj,sj,tj,uj,vj,wj,xj,yj,zj={};if(If.focus=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",1)}var c=qj.selectAll(qd(a)),d=c.filter(Df),e=c.filter(Ef);If.revert(),If.defocus(),b(d.classed(g.focused,!0)),b(e),je(If.data.targets)&&Ob(a,!0),yf(a,!0)},If.defocus=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",.3)}var c=qj.selectAll(qd(a)),d=c.filter(Df),e=c.filter(Ef);If.revert(),b(d.classed(g.focused,!1)),b(e),je(If.data.targets)&&Pb(a),yf(a,!1)},If.revert=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",1)}var c=qj.selectAll(qd(a)),d=c.filter(Df),e=c.filter(Ef);b(d.classed(g.focused,!1)),b(e),je(If.data.targets)&&Pb(a),zf()},If.show=function(a,b){a=Ec(a),b=b||{},Nc(a),qj.selectAll(rd(a)).transition().style("opacity",1),b.withLegend&&Af(a),mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},If.hide=function(a,b){a=Ec(a),b=b||{},Mc(a),qj.selectAll(rd(a)).transition().style("opacity",0),b.withLegend&&Bf(a),mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},If.toggle=function(a){Hc(a)?If.hide(a):If.show(a)},If.unzoom=function(){lj.clear().update(),mf({withUpdateXDomain:!0})},If.load=function(a){return a.xs&&oc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Kg[b]=a.classes[b]}),"categories"in a&&Ni&&(rh=a.categories,Bg.categories(rh)),"cacheIds"in a&&cc(a.cacheIds)?void tf(ec(a.cacheIds),a.done):void("unload"in a?vf(Ec("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){uf(a)}):uf(a))},If.unload=function(a,b){vf(Ec(a),function(){mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},If.selected=function(a){return Hf.merge(sj.selectAll("."+g.shapes+pd(a)).selectAll("."+g.shape).filter(function(){return Hf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},If.select=function(a,b,c){Vg&&sj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Hf.select(this),i=e.data?e.data.id:e.id,j=Oe(this),k=Wg||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);"path"!==this.nodeName&&(k&&l?Xg(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},If.unselect=function(a,b){Vg&&sj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Hf.select(this),f=c.data?c.data.id:c.id,h=Oe(this),i=Wg||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);"path"!==this.nodeName&&i&&j&&Xg(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},If.toLine=function(a){Gf(a,"line")},If.toSpline=function(a){Gf(a,"spline")},If.toBar=function(a){Gf(a,"bar")},If.toScatter=function(a){Gf(a,"scatter")},If.toArea=function(a){Gf(a,"area")},If.toAreaSpline=function(a){Gf(a,"area-spline")},If.toPie=function(a){Gf(a,"pie",{withTransform:!0})},If.toDonut=function(a){Gf(a,"donut",{withTransform:!0})},If.groups=function(a){return c(a)?Lg:(Lg=a,mf(),Lg)},If.xgrids=function(a){return a?($h=a,mf(),$h):$h},If.xgrids.add=function(a){return a?If.xgrids($h.concat(a)):void 0},If.xgrids.remove=function(a){var b=Ff(a);return If.xgrids($h.filter(b))},If.ygrids=function(a){return a?(ai=a,mf(),ai):ai},If.ygrids.add=function(a){return a?If.ygrids(ai.concat(a)):void 0},If.ygrids.remove=function(a){var b=Ff(a);return If.ygrids(ai.filter(b))},If.regions=function(a){return c(a)?yi:(yi=a,mf(),yi)},If.regions.add=function(a){return c(a)?yi:(yi=yi.concat(a),mf(),yi)},If.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;qj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),yi=yi.filter(function(b){return b.classes.indexOf(a)<0})}),yi},If.data.get=function(a){var b=If.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},If.data.getAsTarget=function(a){var b=Gc(function(b){return b.id===a});return b.length>0?b[0]:void 0},If.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Jg[b]=a[b]}),mf({withLegend:!0}),Jg):Jg},If.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Tg[b]=a[b]}),mf({withLegend:!0}),Tg):Tg},If.x=function(a){return arguments.length&&(rc(If.data.targets,a),mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),If.data.xs},If.xs=function(a){return arguments.length&&(sc(If.data.targets,a),mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),If.data.xs},If.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){db(b,a[b])}),Fb())},If.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Ah=+a.x),b(a.y)&&(Hh=+a.y),b(a.y2)&&(Qh=+a.y2)):Hh=Qh=+a,mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},If.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Bh=+a.x),b(a.y)&&(Ih=+a.y),b(a.y2)&&(Rh=+a.y2)):Ih=Rh=+a,mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},If.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&If.axis.max(a.max),"undefined"!=typeof a.min&&If.axis.min(a.min))},If.legend.show=function(a){Af(Ec(a)),mf({withLegend:!0})},If.legend.hide=function(a){Bf(Ec(a)),mf({withLegend:!0})},If.resize=function(a){Lf=a?a.width:null,Mf=a?a.height:null,rf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},If.destroy=function(){If.data.targets=void 0,If.data.xs={},wj.html(""),a.onresize=null},"url"in f.data)Hf.xhr(f.data.url,function(a,b){var c,d=Hf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Hf.csv.parse(b.response),df(c)});else if("rows"in f.data)df(uc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");df(vc(f.data.columns))}return If},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(window); \ No newline at end of file From 04926b206f2e008d25f356374e1f9fa07ea640a7 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Thu, 8 May 2014 16:23:26 +0900 Subject: [PATCH 147/178] Fix region of data - #221 --- c3.js | 28 +++++++++++++++++++--------- c3.min.js | 6 +++--- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/c3.js b/c3.js index c325d07..375f59d 100644 --- a/c3.js +++ b/c3.js @@ -644,15 +644,24 @@ svgArcExpanded = getSvgArcExpanded(); svgArcExpandedSub = getSvgArcExpanded(0.98); } + function getScale(min, max, forTimeseries) { + return (forTimeseries ? d3.time.scale() : d3.scale.linear()).range([min, max]); + } function getX(min, max, domain, offset) { - var scale = (isTimeSeries ? d3.time.scale() : d3.scale.linear()).range([min, max]), + var scale = getScale(min, max, isTimeSeries),//(isTimeSeries ? d3.time.scale() : d3.scale.linear()).range([min, max]), _scale = domain ? scale.domain(domain) : scale, key; // Define customized scale if categorized axis if (isCategorized) { offset = offset || function () { return 0; }; - scale = function (d) { return Math.ceil(_scale(d) + offset(d)); }; + scale = function (d, raw) { + var v = _scale(d) + offset(d); + return raw ? v : Math.ceil(v); + }; } else { - scale = function (d) { return Math.ceil(_scale(d)); }; + scale = function (d, raw) { + var v = _scale(d); + return raw ? v : Math.ceil(v); + }; } // define functions for (key in _scale) { @@ -679,7 +688,7 @@ return scale; } function getY(min, max, domain) { - var scale = d3.scale.linear().range([min, max]); + var scale = getScale(min, max); if (domain) { scale.domain(domain); } return scale; } @@ -2312,7 +2321,7 @@ function lineWithRegions(d, x, y, _regions) { var prev = -1, i, j; var s = "M", sWithRegion; - var xp, yp, dx, dy, dd, diff; + var xp, yp, dx, dy, dd, diff, diffx2; var xValue, yValue; var regions = []; @@ -2347,26 +2356,27 @@ }; } else { sWithRegion = function (d0, d1, j, diff) { - return "M" + x(xp(j)) + " " + y(yp(j)) + " " + x(xp(j + diff)) + " " + y(yp(j + diff)); + return "M" + x(xp(j), true) + " " + y(yp(j)) + " " + x(xp(j + diff), true) + " " + y(yp(j + diff)); }; } // Generate for (i = 0; i < d.length; i++) { + // Draw as normal if (isUndefined(regions) || ! isWithinRegions(d[i].x, regions)) { s += " " + xValue(d[i]) + " " + yValue(d[i]); } // Draw with region // TODO: Fix for horizotal charts else { - xp = getX(d[i - 1].x, d[i].x); - yp = getY(d[i - 1].value, d[i].value); + xp = getScale(d[i - 1].x, d[i].x, isTimeSeries); + yp = getScale(d[i - 1].value, d[i].value); dx = x(d[i].x) - x(d[i - 1].x); dy = y(d[i].value) - y(d[i - 1].value); dd = Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2)); diff = 2 / dd; - var diffx2 = diff * 2; + diffx2 = diff * 2; for (j = diff; j <= 1; j += diffx2) { s += sWithRegion(d[i - 1], d[i], j, diff); diff --git a/c3.min.js b/c3.min.js index baa2ec8..6d87465 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.ceil(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.ceil(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&aag&&(ag=0),0>cg&&(cg=0),bg=nh?Zf.left-ij-jj:ag,dg=nh?cg:fg-$f.top-$f.bottom,0>bg&&(bg=0),0>dg&&(dg=0),r(),dj&&je(If.data.targets)&&(_f.left=ag/2+hg)}function q(){sj.select("line."+g.xgridFocus).attr("x1",nh?0:-10).attr("x2",nh?ag:-10).attr("y1",nh?-10:Zf.top).attr("y2",nh?-10:cg)}function r(){hg=cg/2,gg=.95*hg,ig=ie(If.data.targets)?.6*gg:0}function s(){var a=nh?g.axisX:g.axisY,b=sj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Hf.select(Kf).node().getBoundingClientRect(),e=c.right-d.left-v();return e>0?e:0}function t(){return Lf?Lf:z()}function u(){var a=Mf?Mf:A();return a>0?a:320}function v(){return je(If.data.targets)?0:Nf?Nf:nh?oh?x("x"):1:!Gh||Lh?1:x("y")}function w(){var a=1;return je(If.data.targets)?0:Of?Of:dj?R()+20+(Ph&&!nh?x("y2"):a):Ph?Uh||nh?a:x("y2"):a}function x(a){var b=lb(a);return b.isInner?20+Eb(a):40+Eb(a)}function y(a){return"x"!==a||oh?"x"===a&&Dh?Dh:"y"!==a||Gh?"y2"!==a||Ph?(lb(a).isInner?30:40)+("y2"===a?-10:0):kj:hh&&!dj?10:1:0}function z(){return+Hf.select(Kf).style("width").replace("px","")}function A(){return+Hf.select(Kf).style("height").replace("px","")}function B(a){return a?-31:-(Zf.left-1)}function C(a){return a?-20:-4}function D(){return B(!nh)}function E(){return C(!nh)}function F(){return B(nh)}function G(){return C(nh)}function H(a){return a?ag+2+30+30:Zf.left+20}function I(a){return a?(Dh?Dh:0)+80:cg+8}function J(){return H(!nh)}function K(){return I(!nh)}function L(){return H(nh)}function M(){return I(nh)}function N(){var a,b,c,d,e,f=Bc(If.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=vg(b.x)-vg(a.x),0===c?nh?cg:ag:(d=Ac(),e=fe(If.data.targets)?(d-(Ni?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function O(a){ej=a}function P(a){fj=a}function Q(a){gj=a}function R(){return hh?dj?fj*(ej+1):eg:0}function S(){return hh?dj?fg:gj*(ej+1):0}function T(){var a,b,c=!vg;ng=nh?1:0,og=nh?cg:ag,pg=nh?0:cg,qg=nh?ag:1,rg=ng,sg=og,tg=nh?0:dg,ug=nh?bg:1,vg=V(ng,og,c?void 0:vg.domain(),function(){return Bg.tickOffset()}),wg=W(pg,qg,c?void 0:wg.domain()),xg=W(pg,qg,c?void 0:xg.domain()),yg=V(ng,og,xj,function(a){return a%1?0:Eg.tickOffset()}),zg=W(tg,ug,c?void 0:zg.domain()),Ag=W(tg,ug,c?void 0:Ag.domain()),a=ab(),b=yh?yh:c?void 0:Bg.tickValues(),Bg=Z(vg,$i,a,b),Eg=Z(yg,bj,a,b),Cg=$(wg,_i,Mh,Oh),Dg=$(xg,aj,Vh,Xh),c||(lj.scale(yg),Rf&&pj.scale(vg)),U()}function U(){jg=Hb(),kg=Ib(),lg=Ib(.98)}function V(a,b,c,d){var e,f=(Mi?Hf.time.scale():Hf.scale.linear()).range([a,b]),g=c?f.domain(c):f;Ni?(d=d||function(){return 0},f=function(a){return Math.ceil(g(a)+d(a))}):f=function(a){return Math.ceil(g(a))};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return xj&&xj[0]===a[0]&&xj[1]a?a.toFixed(0):a};return th&&("function"==typeof th?a=th:Mi&&(a=function(a){return a?Wi(th)(a):""})),a}function bb(a){var b;return"y"===a?b=Kh:"y2"===a?b=Th:"x"===a&&(b=Fh),b}function cb(a){var b=bb(a);return"string"==typeof b?b:b?b.text:null}function db(a,b){var c=bb(a);"string"==typeof c?"y"===a?Kh=b:"y2"===a?Th=b:"x"===a&&(Fh=b):c&&(c.text=b)}function eb(a){return 10*Math.sin(Math.PI*(a/180))}function fb(a){return 11.5-2.5*(a/15)}function gb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",fb(c)).attr("x",eb(c)).attr("transform","rotate("+c+")")}function hb(a,b){var c=bb(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 ib(){return hb("x",nh?"inner-top":"inner-right")}function jb(){return hb("y",nh?"inner-right":"inner-top")}function kb(){return hb("y2",nh?"inner-right":"inner-top")}function lb(a){return"y2"===a?kb():"y"===a?jb():ib()}function mb(){return cb("x")}function nb(){return cb("y")}function ob(){return cb("y2")}function pb(a,b){return a?b.isLeft?0:b.isCenter?ag/2:ag:b.isBottom?-cg:b.isMiddle?-cg/2:0}function qb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function rb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function sb(){return pb(!nh,ib())}function tb(){return pb(nh,jb())}function ub(){return pb(nh,kb())}function vb(){return qb(!nh,ib())}function wb(){return qb(nh,jb())}function xb(){return qb(nh,kb())}function yb(){var a=ib();return nh?a.isInner?"1.2em":-25-Eb("x"):a.isInner?"-0.5em":Dh?Dh-10:"3em"}function zb(){var a=jb();return nh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Eb("y")}function Ab(){var a=kb();return nh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Eb("y2")}function Bb(){return rb(!nh,ib())}function Cb(){return rb(nh,jb())}function Db(){return rb(nh,kb())}function Eb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Hf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Fb(a){var b=sj.select("."+g.axisX+" ."+g.axisXLabel),c=sj.select("."+g.axisY+" ."+g.axisYLabel),d=sj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb),(a?c.transition():c).attr("x",tb).attr("dx",wb).attr("dy",zb).attr("dy",zb).text(nb),(a?d.transition():d).attr("x",ub).attr("dx",xb).attr("dy",Ab).text(ob)}function Gb(a){var b=!1;return mg(Jc(If.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Hb(){var a=Hf.svg.arc().outerRadius(gg).innerRadius(ig),b=function(b,c){var d;return c?a(b):(d=Gb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Ib(a){var b=Hf.svg.arc().outerRadius(hg*(a?a:1)).innerRadius(ig);return function(a){var c=Gb(a);return c?b(c):"M 0 0"}}function Jb(a,b){return qe(a.data)?jg(a,b):"M 0 0"}function Kb(a){var b,c,d,e,f=Gb(a),g="";return f&&(b=jg.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*gg*.8+","+d/e*gg*.8+")"),g}function Lb(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Mb(a){return qc({id:a.data.id,value:a.value,ratio:Lb(a)})}function Nb(a){var b,c,d,e;return Qb()?(b=Gb(a),c=b?b.value:null,d=Lb(b),e=Rb(),e?e(c,d):Ed(c,d)):""}function Ob(a,b){var c=qj.selectAll("."+g.chartArc+qd(a)),d=qj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});we(a)&&c.selectAll("path").transition().duration(50).attr("d",kg).transition().duration(100).attr("d",lg).each(function(a){pe(a.data)}),b||d.style("opacity",.3)}function Pb(a){var b=qj.selectAll("."+g.chartArc+qd(a));b.selectAll("path").transition().duration(50).attr("d",jg),qj.selectAll("."+g.arc).style("opacity",1)}function Qb(){return ie(If.data.targets)?ri:li}function Rb(){return ie(If.data.targets)?si:mi}function Sb(){return ie(If.data.targets)?ui:""}function Tb(){var a=ie(If.data.targets)?vi:oi;return"function"==typeof a?a:function(){}}function Ub(){var a=ie(If.data.targets)?wi:pi;return"function"==typeof a?a:function(){}}function Vb(){var a=ie(If.data.targets)?xi:qi;return"function"==typeof a?a:function(){}}function Wb(a){var b,c,d,e,f,g,h=Dc(a),i=Qc(a);if(Lg.length>0)for(g=Sc(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 Hf.min(Object.keys(i).map(function(a){return Hf.min(i[a])}))}function Xb(a){var b,c,d,e,f,g,h=Dc(a),i=Qc(a);if(Lg.length>0)for(g=Tc(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 Hf.max(Object.keys(i).map(function(a){return Hf.max(i[a])}))}function Yb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return _(a.id)===c}),m="y2"===c?Rh:Ih,n="y2"===c?Qh:Hh,o=b(m)?m:Wb(l),p=b(n)?n:Xb(l),q="y2"===c?Sh:Jh,r=yd()&&nh;return 0===l.length?"y2"===c?xg.domain():wg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=zd(o,p),j=bc(wg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Nh&&(f=b(Nh.top)?Nh.top:e,g=b(Nh.bottom)?Nh.bottom:e),"y2"===c&&Wh&&(f=b(Wh.top)?Wh.top:e,g=b(Wh.bottom)?Wh.bottom:e),fe(l)&&!Sc(l)&&(g=o),[o-g,p+f])}function Zb(a){return Bh?Mi?ye(Bh):Bh:Hf.min(a,function(a){return Hf.min(a.values,function(a){return a.x})})}function $b(a){return Ah?Mi?ye(Ah):Ah:Hf.max(a,function(a){return Hf.max(a.values,function(a){return a.x})})}function _b(a){var c,d,e,f,g=Cc(a),h=g[1]-g[0];return Ni?d=0:fe(a)?(c=Ac(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Ch&&De(Ch)?(e=b(Ch.left)?Ch.left:d,f=b(Ch.right)?Ch.right:d):e=f="number"==typeof Ch?Ch:d,{left:e,right:f}}function ac(a){var b=[Zb(a),$b(a)],c=b[0],d=b[1],e=_b(a),f=0,g=0;return c-d!==0||Ni||(c=Mi?new Date(.5*c.getTime()):-.5,d=Mi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Mi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Mi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function bc(a){return a[1]-a[0]}function cc(a){for(var b=0;bb?0:b-c}function ic(a){var b,c=gc(a),d="y"===a.axis?wg:xg;return b="y"===a.axis||"y2"===a.axis?nh?cg:"start"in a?d(a.start):cg:nh?"end"in a?vg(Mi?ye(a.end):a.end):cg:cg,c>b?0:b-c}function jc(a){return Fg&&a===Fg||De(Gg)&&Ee(Gg,a)}function kc(a){return!jc(a)}function lc(a){return Fg?Fg:De(Gg)?Gg[a]:null}function mc(a,b){var c,d=b&&De(b)?Dc(b):[];return d.forEach(function(b){lc(b)===a&&(c=If.data.xs[b])}),c}function nc(a,b){return a in If.data.xs&&If.data.xs[a]&&If.data.xs[a][b]?If.data.xs[a][b]:b}function oc(a){Object.keys(a).forEach(function(b){Gg[b]=a[b]})}function pc(a){return 1===Hf.set(Object.keys(a).map(function(b){return a[b]})).size()}function qc(a){var b;return a&&(b=Jg[a.id],a.name=b?b:a.id),a}function rc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=tc(b[d],a.id,d)}),If.data.xs[a.id]=b})}function sc(a,b){a.forEach(function(a){b[a.id]&&rc([a],b[a.id])})}function tc(a,c,d){var e;return e=Mi?a?a instanceof Date?a:ye(a):ye(nc(c,d)):Oi&&!Ni?b(a)?+a:nc(c,d):d}function uc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?If.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Fg?(d=Object.keys(If.data.xs),If.data.xs[c]=d.length>0?If.data.xs[d[0]]:void 0):De(Gg)&&(If.data.xs[c]=mc(f,If.data.targets)):If.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!If.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Ig(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=lc(b),g=a[f],h=tc(g,b,e);return Oi&&Ni&&0===c&&g&&(0===e&&(rh=[]),rh.push(g)),("undefined"==typeof a[b]||If.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Ng&&de(Dc(c).filter(function(a){return!(a in Og)}),Ng),c.forEach(function(a){dc(a.id_org,a)}),c}function xc(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 yc(a){return a>0&&If.data.targets[0].values[a-1]?If.data.targets[0].values[a-1].x:void 0}function zc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Cc(a){var b,c,d=Bc(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Dc(a){return a.map(function(a){return a.id})}function Ec(a){return a?"string"==typeof a?[a]:a:Dc(If.data.targets)}function Fc(a,b){var c,d=Dc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Mi?new Date(i):i);j.push(e)}return Mi||(j=j.sort(function(a,b){return a-b})),j}function Mc(a){Yi=Yi.concat(a)}function Nc(a){Yi=Yi.filter(function(b){return a.indexOf(b)<0})}function Oc(a){Zi=Zi.concat(a)}function Pc(a){Zi=Zi.filter(function(b){return a.indexOf(b)<0})}function Qc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Rc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Tc(a){return Rc(a,function(a){return a>0})}function Uc(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||0===a[f].x)&&(e=e.concat(Kd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Kd(a,g))),Nd(e,b)):Ld(a,b,f,g)}function Md(a,b){var c;return c=a.map(function(a){return Ld(a.values,b)}),Nd(c,b)}function Nd(a,b){var c,d;return a.forEach(function(a){var e=Fe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Od(a,b){return Hf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Pd(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 Qd(){return Qg&&"desc"===Qg.toLowerCase()}function Rd(){return Qg&&"asc"===Qg.toLowerCase()}function Sd(a){var b=Rd(),c=Qd();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 Qg&&a.sort(Qg),a}function Td(a,c){var d,e,f,g,h,i,j,k=je(If.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&zi&&(vj.html(Ci(a,ab(),Ad(k),Vi)).style("display","block"),d=vj.property("offsetWidth"),e=vj.property("offsetHeight"),k?(g=ag/2+c[0],i=cg/2+c[1]+20):(nh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-w(),i=vg(l[0].x)+20):(f=s(),g=f+v()+vg(l[0].x)+20,h=g+d,j=f+t()-w(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),vj.style("top",i+"px").style("left",g+"px"))}function Ud(){vj.style("display","none")}function Vd(a){var c=a.filter(function(a){return a&&b(a.value)});if(zi&&!ge(If.data.targets)&&!je(If.data.targets)){var d=sj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(nh?"y1":"x1",Gd).attr(nh?"y2":"x2",Gd),lf(d,"grid")}}function Wd(){sj.select("line."+g.xgridFocus).style("visibility","hidden")}function Xd(a,b){var c,d,e,f,h=[],i=sj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=ac(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function Yd(a){return a.x||0===a.x?vg(a.x):null}function Zd(a){return X(a.id)(a.value)}function $d(){var a,b,d={},e=0;return Jc(Gc(me)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ce(a,b){return"number"==typeof ji?ji:b?2*a.tickOffset()*ki/b:0}function de(a,b){Ec(a).forEach(function(a){zj[a]=b===Og[a],Og[a]=b})}function ee(a,b){var c=!1;return a.forEach(function(a){Og[a.id]===b&&(c=!0),a.id in Og||"line"!==b||(c=!0)}),c}function fe(a){return ee(a,"bar")}function ge(a){return ee(a,"scatter")}function he(a){return ee(a,"pie")}function ie(a){return ee(a,"donut")}function je(a){return he(a)||ie(a)}function ke(a){var b="string"==typeof a?a:a.id;return!(b in Og)||"line"===Og[b]||"spline"===Og[b]||"area"===Og[b]||"area-spline"===Og[b]}function le(a){var b="string"==typeof a?a:a.id;return"spline"===Og[b]||"area-spline"===Og[b]}function me(a){var b="string"==typeof a?a:a.id;return"bar"===Og[b]}function ne(a){var b="string"==typeof a?a:a.id;return"scatter"===Og[b]}function oe(a){var b="string"==typeof a?a:a.id;return"pie"===Og[b]}function pe(a){var b="string"==typeof a?a:a.id;return"donut"===Og[b]}function qe(a){return oe(a)||pe(a)}function re(a){return ke(a)?[a]:[]}function se(a){return qe(a.data)?[a]:[]}function te(a){return me(a)?a.values:[]}function ue(a){return ke(a)||ne(a)?a.values:[]}function ve(a){return me(a)||ke(a)?a.values:[]}function we(a){return pe(a)&&ti||oe(a)&&ni}function xe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ye(b){var c;try{c=Hg?Hf.time.format(Hg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Hg)}return c}function ze(a,b){var c=Hf.mouse(a),d=Hf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ee(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Fe(a,b){var c="y"===_(a.id)?wg:xg,d=nh?1:0,e=nh?0:1;return Math.pow(vg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ge(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function He(a,b,c){ah(b,a.node()),sj.select("."+g.selectedCircles+pd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Vc(g.selectedCircle,c)}).attr("cx",nh?Zd:Yd).attr("cy",nh?Yd:Zd).attr("stroke",function(){return Vi(b)}).attr("r",1.4*Se(b)).transition().duration(100).attr("r",Se)}function Ie(a,b,c){bh(b,a.node()),sj.select("."+g.selectedCircles+pd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Je(a,b,c,d){a?He(b,c,d):Ie(b,c,d)}function Ke(a,b){ah(b,a.node()),a.transition().duration(100).style("fill",function(){return Hf.rgb(Vi(b)).brighter(.75)})}function Le(a,b){bh(b,a.node()),a.transition().duration(100).style("fill",function(){return Vi(b)})}function Me(a,b,c,d){a?Ke(b,c,d):Le(b,c,d)}function Ne(a,b,c,d){Me(a,b,c.data,d)}function Oe(a){return"circle"===a.nodeName?Je:Hf.select(a).classed(g.bar)?Me:Ne}function Pe(a){return a.filter(function(a){return b(a.value)})}function Qe(a){return ci?"function"==typeof di?di(a):di:0}function Re(a){return fi?gi?gi:1.75*Qe(a):Qe(a)}function Se(a){return hi?hi:4*Qe(a)}function Te(a,c){return(c?sj.selectAll("."+g.circles+pd(c)):sj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ue(a,b){Te(a,b).classed(g.EXPANDED,!0).attr("r",Re)}function Ve(a){Te(a).filter(function(){return Hf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Qe)}function We(a){return sj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function Xe(a){We(a).classed(g.EXPANDED,!0)}function Ye(a){We(a).classed(g.EXPANDED,!1)}function Ze(a,b){var c=bf(a,b);return function(a,b){var d=c(a,b),e=nh?1:0,f=nh?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 $e(a,b){var c=bf(a,!1),d=b?_e:af;return function(a,b){return d(c(a,b),a,this)}}function _e(a,b){var c;return nh?(c=me(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function af(a,b,c){var d=c.getBoundingClientRect();return nh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:me(b)?-3:-6)}function bf(a,b){var c=a.__max__+1,d=ce(Bg,c),e=_d(d,c,a,!!b),f=ae(!!b),g=be(a,!!b),h=b?Y:X;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return nh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function cf(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 df(b){var c,d,e;if(wj=Hf.select(Kf),wj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(wj.html("").classed("c3",!0),If.data.xs={},If.data.targets=wc(b),Ug&&Mc(Ug===!0?Dc(If.data.targets):Ug),p(),T(),vg.domain(Hf.extent(ac(If.data.targets))),wg.domain(Yb(If.data.targets,"y")),xg.domain(Yb(If.data.targets,"y2")),yg.domain(vg.domain()),zg.domain(wg.domain()),Ag.domain(xg.domain()),xj=vg.domain(),lj.scale(yg),Rf&&pj.scale(vg),qj=wj.append("svg").on("mouseenter",Uf).on("mouseleave",Vf),rj=qj.append("defs"),rj.append("clipPath").attr("id",Gi).append("rect"),rj.append("clipPath").attr("id",Hi).append("rect"),rj.append("clipPath").attr("id",Ii).append("rect"),qf(),sj=qj.append("g").attr("transform",cj.main),tj=qj.append("g").attr("transform",cj.context),uj=qj.append("g").attr("transform",cj.legend),eh||tj.style("visibility","hidden"),hh||(uj.style("visibility","hidden"),Zi=Dc(If.data.targets)),vj=Hf.select(Kf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Cf(Dc(If.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=sj.append("g").attr("clip-path",Ji).attr("class",g.grid),Yh&&d.append("g").attr("class",g.xgrids),De($h)&&d.append("g").attr("class",g.xgridLines),ei&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),_h&&d.append("g").attr("class",g.ygrids),De(ai)&&d.append("g").attr("class",g.ygridLines),sj.append("g").attr("clip-path",Ji).attr("class",g.regions),sj.append("g").attr("clip-path",Ji).attr("class",g.chart),c=sj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Rf?nh?"ns-resize":"ew-resize":null),sj.select("."+g.chart).append("g").attr("class",g.chartBars),sj.select("."+g.chart).append("g").attr("class",g.chartLines),sj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",cj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Sb()),sj.select("."+g.chart).append("g").attr("class",g.chartTexts),Rf&&sj.insert("rect",Tf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",ag).attr("height",cg).style("opacity",0).style("cursor",nh?"ns-resize":"ew-resize").call(pj).on("dblclick.zoom",null),Eh&&lj.extent("function"!=typeof Eh?Eh:Eh(ac())),oh&&sj.append("g").attr("class",g.axisX).attr("clip-path",Ki).attr("transform",cj.x).append("text").attr("class",g.axisXLabel).attr("transform",nh?"rotate(-90)":"").style("text-anchor",Bb),Gh&&sj.append("g").attr("class",g.axisY).attr("clip-path",Li).attr("transform",cj.y).append("text").attr("class",g.axisYLabel).attr("transform",nh?"":"rotate(-90)").style("text-anchor",Cb),Ph&&sj.append("g").attr("class",g.axisY2).attr("transform",cj.y2).append("text").attr("class",g.axisY2Label).attr("transform",nh?"":"rotate(-90)").style("text-anchor",Db),tj.append("g").attr("clip-path",Ji).attr("class",g.chart),tj.select("."+g.chart).append("g").attr("class",g.chartBars),tj.select("."+g.chart).append("g").attr("class",g.chartLines),tj.append("g").attr("clip-path",Ji).attr("class",g.brush).call(lj).selectAll("rect").attr(nh?"width":"height",nh?bg:dg),tj.append("g").attr("class",g.axisX).attr("transform",cj.subx).attr("clip-path",nh?"":Ki),sf(If.data.targets),nh?sj.select("."+g.axisX).style("opacity",0).call(Bg):(sj.select("."+g.axisY).style("opacity",0).call(Cg),sj.select("."+g.axisY2).style("opacity",0).call(Dg)),p(),T(),qf(),o(!1),mf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Di){if(Mi&&"string"==typeof Ei){for(Ei=ye(Ei),e=0;e0){d=[];for(var f in Jg)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Pd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Me,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function jf(a){je(If.data.targets)||Vg&&(Pi=a,sj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Qi=!0,ch())}function kf(){je(If.data.targets)||Vg&&(sj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),sj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Qi=!1,dh())}function lf(a,b){"grid"===b&&a.each(function(){var a=Hf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function mf(a){var c,e,f,h,i,j,k,l,m,n,o,p,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,O,P,Q,R,S,T,U,V,W,X,Y,Z,$,_=$d(),ab=je(If.data.targets),bb=Jc(If.data.targets);if(a=d(a)?a:{},G=d(a.withY)?a.withY:!0,H=d(a.withSubchart)?a.withSubchart:!0,I=d(a.withTransition)?a.withTransition:!0,L=d(a.withTransform)?a.withTransform:!1,M=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,O=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,P=d(a.withLegend)?a.withLegend:!1,J=d(a.withTransitionForExit)?a.withTransitionForExit:I,K=d(a.withTransitionForAxis)?a.withTransitionForAxis:I,V=I?Yf:0,W=J?V:0,X=K?V:0,c=sj.select("."+g.axisX).style("opacity",ab?0:1),f=sj.select("."+g.axisY).style("opacity",ab?0:1),h=sj.select("."+g.axisY2).style("opacity",ab?0:1),e=tj.select("."+g.axisX).style("opacity",ab?0:1),U={axisX:c.transition().duration(X),axisY:f.transition().duration(X),axisY2:h.transition().duration(X),axisSubX:e.transition().duration(X)},P&&hh&&Cf(Dc(If.data.targets),a,U),Ni&&0===bb.length&&vg.domain([0,c.selectAll(".tick").size()]),bb.length&&(O&&(vg.domain(Hf.extent(ac(bb))),xj=vg.domain(),Rf&&pj.scale(vg).updateScaleExtent(),yg.domain(vg.domain()),lj.scale(yg)),M&&(vg.domain(lj.empty()?xj:lj.extent()),Rf&&pj.scale(vg).updateScaleExtent()),yh||!xh&&!wh||(Y=Lc(Kc(bb),wh),Bg.tickValues(Y),Eg.tickValues(Y))),wg.domain(Yb(bb,"y")),xg.domain(Yb(bb,"y2")),U.axisX.call(Bg),U.axisY.call(Cg),U.axisY2.call(Dg),U.axisSubX.call(Eg),Fb(I),M&&bb.length)if(uh&&Y){for(Z=1;Z=0&&Hf.select(this).style("display",b%$?"none":"block")})}else qj.selectAll("."+g.axisX+" .tick text").style("display","block");!nh&&zh&&gb(c,U.axisX,zh),Q=Ze(_),S=$e(_,!0),T=$e(_,!1),zg.domain(wg.domain()),Ag.domain(xg.domain()),vj.style("display","none"),q(),sj.select("line."+g.xgridFocus).style("visibility","hidden"),Yh&&(k=Xd(Zh,vg),D=Ni?Bg.tickOffset():0,j=nh?{x1:0,x2:ag,y1:function(a){return vg(a)-D},y2:function(a){return vg(a)-D}}:{x1:function(a){return vg(a)+D},x2:function(a){return vg(a)+D},y1:Zf.top,y2:cg},i=sj.select("."+g.xgrids).selectAll("."+g.xgrid).data(k),i.enter().append("line").attr("class",g.xgrid),i.attr(j).style("opacity",function(){return+Hf.select(this).attr(nh?"y1":"x1")===(nh?cg:0)?0:1}),i.exit().remove()),De($h)&&(l=sj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data($h),m=l.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",nh?"":"rotate(-90)").attr("dx",nh?0:-Zf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(V).attr("x1",nh?0:Hd).attr("x2",nh?ag:Hd).attr("y1",nh?Hd:Zf.top).attr("y2",nh?Hd:cg).style("opacity",1),l.select("text").transition().duration(V).attr("x",nh?ag:0).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(V).style("opacity",0).remove()),G&&_h&&(n=sj.select("."+g.ygrids).selectAll("."+g.ygrid).data(wg.ticks(bi)),n.enter().append("line").attr("class",g.ygrid),n.attr("x1",nh?wg:0).attr("x2",nh?wg:ag).attr("y1",nh?0:wg).attr("y2",nh?cg:wg),n.exit().remove(),lf(n,"grid")),G&&De(ai)&&(o=sj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(ai),p=o.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",nh?"rotate(-90)":"").attr("dx",nh?0:-Zf.top).attr("dy",-5).style("opacity",0),o.select("line").transition().duration(V).attr("x1",nh?Id:0).attr("x2",nh?Id:ag).attr("y1",nh?0:Id).attr("y2",nh?cg:Id).style("opacity",1),o.select("text").transition().duration(V).attr("x",nh?0:ag).attr("y",Id).text(function(a){return a.text}).style("opacity",1),o.exit().transition().duration(V).style("opacity",0).remove()),w=sj.select("."+g.regions).selectAll("."+g.region).data(yi),w.enter().append("g").attr("class",id).append("rect").style("fill-opacity",0),w.selectAll("rect").transition().duration(V).attr("x",fc).attr("y",gc).attr("width",hc).attr("height",ic).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),w.exit().transition().duration(V).style("fill-opacity",0).remove(),u=sj.selectAll("."+g.bars).selectAll("."+g.bar).data(te),u.enter().append("path").attr("class",cd).style("stroke","none").style("fill",Vi),u.style("opacity",ud).transition().duration(V).attr("d",Q).style("fill",Vi).style("opacity",1),u.exit().transition().duration(W).style("opacity",0).remove(),r=sj.selectAll("."+g.lines).selectAll("."+g.line).data(re),r.enter().append("path").attr("class",$c).style("stroke",Vi),r.style("opacity",ud).transition().duration(V).attr("d",mj).style("stroke",Vi).style("opacity",1),r.exit().transition().duration(W).style("opacity",0).remove(),s=sj.selectAll("."+g.areas).selectAll("."+g.area).data(re),s.enter().append("path").attr("class",gd).style("fill",Vi).style("opacity",function(){return yj=+Hf.select(this).style("opacity"),0}),s.style("opacity",0).transition().duration(V).attr("d",nj).style("fill",Vi).style("opacity",yj),s.exit().transition().duration(W).style("opacity",0).remove(),t=sj.selectAll("."+g.circles).selectAll("."+g.circle).data(ue),t.enter().append("circle").attr("class",ad).attr("r",Qe).style("fill",Vi),t.style("opacity",ud).transition().duration(V).style("opacity",wd).style("fill",Vi).attr("cx",nh?Zd:Yd).attr("cy",nh?Yd:Zd),t.exit().remove(),x=sj.selectAll("."+g.texts).selectAll("."+g.text).data(ve),x.enter().append("text").attr("class",Wc).attr("text-anchor",function(a){return nh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",Vi).style("fill-opacity",0),x.text(function(a){return Fd(a.id)(a.value,a.id)}).style("fill-opacity",vd).transition().duration(V).attr("x",S).attr("y",T).style("fill",Vi).style("fill-opacity",xd),x.exit().transition().duration(W).style("fill-opacity",0).remove(),v=sj.selectAll("."+g.arcs).selectAll("."+g.arc).data(se),v.enter().append("path").attr("class",ed).style("fill",function(a){return Vi(a.data)}).style("cursor",function(a){return Xg(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Ti||(c=Gb(a),d=Mb(c),e=Ub(),Ob(c.data.id),yf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Gb(a),c=Mb(b),d=[c];Td(d,Hf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Ti||(c=Gb(a),d=Mb(c),e=Vb(),Pb(c.data.id),zf(),Ud(),e(d,b))}).on("click",function(a,b){var c=Gb(a),d=Mb(c),e=Tb();gf(this,a,b),e(d,b)}),v.attr("transform",L?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Ti=!0}).transition().duration(V).attrTween("d",function(a){var b,c=Gb(a);return c?(b=Hf.interpolate(this._current,c),this._current=b(0),function(a){return Jb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",L?"scale(1)":"").style("fill",function(a){return Vi(a.data)}).style("opacity",1).call(Ge,function(){Ti=!1}),v.exit().transition().duration(W).style("opacity",0).remove(),sj.selectAll("."+g.chartArc).select("text").attr("transform",Kb).style("opacity",0).transition().duration(V).text(Nb).style("opacity",function(a){return Hc(a.data.id)&&qe(a.data)?1:0}),sj.select("."+g.chartArcsTitle).style("opacity",ie(If.data.targets)?1:0),eh&&(Hf.event&&"zoom"===Hf.event.type&&lj.extent(vg.orgDomain()).update(),H&&(!nh&&zh&&gb(e,U.axisSubX,zh),lj.empty()||lj.extent(vg.orgDomain()).update(),R=Ze(_,!0),z=tj.selectAll("."+g.bars).selectAll("."+g.bar).data(te),z.enter().append("path").attr("class",cd).style("stroke","none").style("fill",Vi),z.style("opacity",ud).transition().duration(V).attr("d",R).style("opacity",1),z.exit().transition().duration(V).style("opacity",0).remove(),y=tj.selectAll("."+g.lines).selectAll("."+g.line).data(re),y.enter().append("path").attr("class",$c).style("stroke",Vi),y.style("opacity",ud).transition().duration(V).attr("d",oj).style("opacity",1),y.exit().transition().duration(V).style("opacity",0).remove())),sj.selectAll("."+g.selectedCircles).filter(function(a){return me(a)}).selectAll("circle").remove(),sj.selectAll("."+g.selectedCircle).transition().duration(V).attr("cx",nh?Zd:Yd).attr("cy",nh?Yd:Zd),A=sj.select("."+g.eventRects),De(Gg)&&!pc(Gg)?(A.classed(g.eventRectsMultiple)||A.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),B=sj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),ff(B.enter()),B.attr("x",0).attr("y",0).attr("width",ag).attr("height",cg)):(A.classed(g.eventRectsSingle)||A.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Oi&&!Ni?(F=function(a,b){var c=yc(b),d=zc(b),e=If.data.xs[a.id][b];return(vg(d?d:e+50)-vg(c?c:e-50))/2},E=function(a,b){var c=yc(b),d=If.data.xs[a.id][b];return(vg(d)+vg(c?c:d-50))/2}):(F=N(),E=function(a){return vg(a.x)-F/2}),C=Bc(If.data.targets),sj.select("."+g.eventRects).datum(C?C.values:[]),B=sj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),ef(B.enter()),B.attr("class",jd).attr("x",nh?0:E).attr("y",nh?E:0).attr("width",nh?ag:F).attr("height",nh?F:cg),B.exit().remove()),Dc(If.data.targets).forEach(function(a){zj[a]=!0})}function nf(){mf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function of(){if(0!==Jc(If.data.targets).length){if("mousemove"===Hf.event.sourceEvent.type&&pj.altDomain)return vg.domain(pj.altDomain),void pj.scale(vg).updateScaleExtent();Ni&&vg.orgDomain()[0]===xj[0]&&vg.domain([xj[0]-1e-10,vg.orgDomain()[1]]),mf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Hf.event.sourceEvent.type&&(Ri=!0)}}function pf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function qf(){qj.attr("width",eg).attr("height",fg),qj.select("#"+Gi).select("rect").attr("width",ag).attr("height",cg),qj.select("#"+Hi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),qj.select("#"+Ii).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),qj.select("."+g.zoomRect).attr("width",ag).attr("height",cg),wj.style("max-height",fg+"px")}function rf(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,p(),T(),qf(),o(a.withTransition),mf(a)}function sf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=sj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",ld),j=i.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Xc),e=sj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",nd),d=e.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",dd).style("cursor",function(a){return Xg(a)?"pointer":null}),c=sj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",md),b=c.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",_c),b.append("g").attr("class",hd),b.append("g").attr("class",function(a){return Vc(g.selectedCircles,a.id)}),b.append("g").attr("class",bd).style("cursor",function(a){return Xg(a)?"pointer":null}),a.forEach(function(a){sj.selectAll("."+g.selectedCircles+pd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=sj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(mg(a)).attr("class",od),f=h.enter().append("g").attr("class",od),f.append("g").attr("class",fd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),eh&&(n=tj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",nd),m=n.enter().append("g").style("opacity",0).attr("class",nd),m.append("g").attr("class",dd),l=tj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",md),k=l.enter().append("g").style("opacity",0).attr("class",md),k.append("g").attr("class",_c)),qj.selectAll("."+g.target).filter(function(a){return Hc(a.id)}).transition().duration(Yf).style("opacity",1)}function tf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?de(a.id,b.types[a.id]):de(a.id,b.type)}),If.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=dj?j:i,l=dj?S():R();return d&&(w=0,C=0,t=0,u=0),hh&&!Ic(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=dj?u:t,void(mh?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=uj.selectAll("."+g.legendItemFocused).size();b=b||{},n=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,dj?(f=function(a){return t*B[a]},j=function(a){return A[B[a]]+x[a]}):(f=function(a){return A[B[a]]+x[a]},j=function(a){return u*B[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=uj.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Vc(g.legendItem,a)}).style("visibility",function(a){return Ic(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof jh?jh(a):If.toggle(a)}).on("mouseover",function(a){Hf.select(this).classed(g.legendItemFocused,!0),Ti||If.focus(a),"function"==typeof kh&&kh(a)}).on("mouseout",function(a){Hf.select(this).classed(g.legendItemFocused,!1),Ti||If.revert(),"function"==typeof lh&&lh(a)}),m.append("text").text(function(a){return d(Jg[a])?Jg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",dj?h:-200).attr("y",dj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",dj?i:-200).attr("y",dj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",Vi).attr("x",dj?h:-200).attr("y",dj?-200:j).attr("width",10).attr("height",10),uj.selectAll("text").data(a).text(function(a){return d(Jg[a])?Jg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(n?250:0).attr("x",h).attr("y",k),uj.selectAll("rect."+g.legendItemEvent).data(a).transition().duration(n?250:0).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}).attr("x",i).attr("y",l),uj.selectAll("rect."+g.legendItemTile).data(a).transition().duration(n?250:0).style("fill",Vi).attr("x",f).attr("y",j),uj.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Hc(a)}).transition().style("opacity",function(a){var b=Hf.select(this);return Hc(a)?!D||b.classed(g.legendItemFocused)?wf(b):xf(b):hj}),P(t),Q(u),O(C),p(),T(),qf(),o(q,c)}function Df(a){return Fc(If.data.targets,a.id)}function Ef(a){return"data"in a&&Fc(If.data.targets,a.data.id)}function Ff(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 Gf(a,b,c){var d=!je(If.data.targets);Ti=!1,de(a,b),rf(c||{withTransitionForAxis:d})}var Hf=a.d3?a.d3:a.require?a.require("d3"):void 0,If={data:{},axis:{},legend:{}},Jf={},Kf=i(["bindto"],"#chart"),Lf=i(["size","width"]),Mf=i(["size","height"]),Nf=i(["padding","left"],50),Of=i(["padding","right"],0),Pf=i(["padding","top"],0),Qf=i(["padding","bottom"],0),Rf=i(["zoom","enabled"],!1),Sf=i(["zoom","extent"]),Tf=i(["zoom","privileged"],!1),Uf=i(["onenter"],function(){}),Vf=i(["onleave"],function(){}),Wf=i(["onresize"],function(){}),Xf=i(["onresized"],function(){}),Yf=i(["transition","duration"],350);h("data","data is required in config");var Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg=i(["data","x"]),Gg=i(["data","xs"],{}),Hg=i(["data","x_format"]),Ig=i(["data","id_converter"],function(a){return a}),Jg=i(["data","names"],{}),Kg=i(["data","classes"],{}),Lg=i(["data","groups"],[]),Mg=i(["data","axes"],{}),Ng=i(["data","type"]),Og=i(["data","types"],{}),Pg=i(["data","labels"],{}),Qg=i(["data","order"]),Rg=i(["data","regions"],{}),Sg=i(["data","color"]),Tg=i(["data","colors"],{}),Ug=i(["data","hide"],!1),Vg=i(["data","selection","enabled"],!1),Wg=i(["data","selection","grouped"],!1),Xg=i(["data","selection","isselectable"],function(){return!0}),Yg=i(["data","selection","multiple"],!0),Zg=i(["data","onclick"],function(){}),$g=i(["data","onenter"],function(){}),_g=i(["data","onleave"],function(){}),ah=i(["data","onselected"],function(){}),bh=i(["data","onunselected"],function(){}),ch=i(["data","ondragstart"],function(){}),dh=i(["data","ondragend"],function(){}),eh=i(["subchart","show"],!1),fh=i(["subchart","size","height"],60),gh=i(["color","pattern"],[]),hh=i(["legend","show"],!0),ih=i(["legend","position"],"bottom"),jh=i(["legend","item","onclick"]),kh=i(["legend","item","onmouseover"]),lh=i(["legend","item","onmouseout"]),mh=i(["legend","equally"],!1),nh=i(["axis","rotated"],!1),oh=i(["axis","x","show"],!0),ph=i(["axis","x","type"],"indexed"),qh=i(["axis","x","localtime"],!0),rh=i(["axis","x","categories"],[]),sh=i(["axis","x","tick","centered"],!1),th=i(["axis","x","tick","format"]),uh=i(["axis","x","tick","culling"],{}),vh=i(["axis","x","tick","culling","max"],10),wh=i(["axis","x","tick","count"]),xh=i(["axis","x","tick","fit"],!0),yh=i(["axis","x","tick","values"],null),zh=i(["axis","x","tick","rotate"]),Ah=i(["axis","x","max"],null),Bh=i(["axis","x","min"],null),Ch=i(["axis","x","padding"],{}),Dh=i(["axis","x","height"]),Eh=i(["axis","x","default"]),Fh=i(["axis","x","label"],{}),Gh=i(["axis","y","show"],!0),Hh=i(["axis","y","max"]),Ih=i(["axis","y","min"]),Jh=i(["axis","y","center"]),Kh=i(["axis","y","label"],{}),Lh=i(["axis","y","inner"],!1),Mh=i(["axis","y","tick","format"]),Nh=i(["axis","y","padding"]),Oh=i(["axis","y","ticks"],10),Ph=i(["axis","y2","show"],!1),Qh=i(["axis","y2","max"]),Rh=i(["axis","y2","min"]),Sh=i(["axis","y2","center"]),Th=i(["axis","y2","label"],{}),Uh=i(["axis","y2","inner"],!1),Vh=i(["axis","y2","tick","format"]),Wh=i(["axis","y2","padding"]),Xh=i(["axis","y2","ticks"],10),Yh=i(["grid","x","show"],!1),Zh=i(["grid","x","type"],"tick"),$h=i(["grid","x","lines"],[]),_h=i(["grid","y","show"],!1),ai=i(["grid","y","lines"],[]),bi=i(["grid","y","ticks"],10),ci=i(["point","show"],!0),di=i(["point","r"],2.5),ei=i(["point","focus","line","enabled"],!0),fi=i(["point","focus","expand","enabled"],!0),gi=i(["point","focus","expand","r"]),hi=i(["point","focus","select","r"]),ii=i(["line","connect_null"],!1),ji=i(["bar","width"]),ki=i(["bar","width","ratio"],.6),li=i(["pie","label","show"],!0),mi=i(["pie","label","format"]),ni=i(["pie","expand"],!0),oi=i(["pie","onclick"],function(){}),pi=i(["pie","onmouseover"],function(){}),qi=i(["pie","onmouseout"],function(){}),ri=i(["donut","label","show"],!0),si=i(["donut","label","format"]),ti=i(["donut","expand"],!0),ui=i(["donut","title"],""),vi=i(["donut","onclick"],function(){}),wi=i(["donut","onmouseover"],function(){}),xi=i(["donut","onmouseout"],function(){}),yi=i(["regions"],[]),zi=i(["tooltip","show"],!0),Ai=i(["tooltip","format","title"]),Bi=i(["tooltip","format","value"]),Ci=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Ai?Ai:b,l=Bi?Bi:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Di=i(["tooltip","init","show"],!1),Ei=i(["tooltip","init","x"],0),Fi=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Gi=("string"==typeof Kf?Kf.replace("#",""):Kf.id)+"-clip",Hi=Gi+"-xaxis",Ii=Gi+"-yaxis",Ji=j(Gi),Ki=j(Hi),Li=j(Ii),Mi="timeseries"===ph,Ni="categorized"===ph,Oi=!Mi&&(Fg||De(Gg)),Pi=null,Qi=!1,Ri=!1,Si=!1,Ti=!1,Ui=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Vi=xe(Tg,De(gh)?gh:Ui,Sg),Wi=qh?Hf.time.format:Hf.time.format.utc,Xi=Wi.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),Yi=[],Zi=[],$i=nh?"left":"bottom",_i=nh?Lh?"top":"bottom":Lh?"right":"left",aj=nh?Uh?"bottom":"top":Uh?"left":"right",bj=nh?"left":"bottom",cj={main:function(){return"translate("+k(Zf.left)+","+k(Zf.top)+")"},context:function(){return"translate("+k($f.left)+","+k($f.top)+")"},legend:function(){return"translate("+_f.left+","+_f.top+")"},x:function(){return"translate(0,"+(nh?0:cg)+")"},y:function(){return"translate(0,"+(nh?cg:0)+")"},y2:function(){return"translate("+(nh?0:ag)+","+(nh?1:0)+")"},subx:function(){return"translate(0,"+(nh?0:dg)+")"},arc:function(){return"translate("+ag/2+","+cg/2+")"}},dj="right"===ih,ej=0,fj=0,gj=0,hj=.15,ij=30,jj=nh&&!oh?0:30,kj=5;mg=Hf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value -},0)});var lj,mj=function(){var a=Hf.svg.line().x(nh?function(a){return X(a.id)(a.value)}:Gd).y(nh?Gd:function(a){return X(a.id)(a.value)});return ii||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ii?Pe(b.values):b.values;return ke(b)?(a.interpolate(le(b)?"cardinal":"linear"),Rg[b.id]?cf(e,vg,X(b.id),Rg[b.id]):a(e)):(c=e[0]?vg(e[0].x):0,d=e[0]?X(b.id)(e[0].value):0,nh?"M "+d+" "+c:"M "+c+" "+d)}}(),nj=function(){var a;return a=nh?Hf.svg.area().x0(function(a){return X(a.id)(0)}).x1(function(a){return X(a.id)(a.value)}).y(Gd):Hf.svg.area().x(Gd).y0(function(a){return X(a.id)(0)}).y1(function(a){return X(a.id)(a.value)}),function(b){var c,d,e=Pe(b.values);return ee([b],"area")||ee([b],"area-spline")?(a.interpolate(le(b)?"cardinal":"linear"),a(e)):(c=e[0]?vg(e[0].x):0,d=e[0]?X(b.id)(e[0].value):0,nh?"M "+d+" "+c:"M "+c+" "+d)}}(),oj=function(){var a=Hf.svg.line().x(nh?function(a){return Y(a.id)(a.value)}:Jd).y(nh?Jd:function(a){return Y(a.id)(a.value)});return function(b){var c=Pe(b.values);return ke(b)?a(c):"M "+yg(c[0].x)+" "+Y(b.id)(c[0].value)}}(),pj=function(){};lj=Hf.svg.brush().on("brush",nf),lj.update=function(){return tj&&tj.select("."+g.brush).call(this),this},lj.scale=function(a){return nh?this.y(a):this.x(a)},Rf&&(pj=Hf.behavior.zoom().on("zoomstart",function(){pj.altDomain=Hf.event.sourceEvent.altKey?vg.orgDomain():null}).on("zoom",Rf?of:null),pj.scale=function(a){return nh?this.y(a):this.x(a)},pj.orgScaleExtent=function(){var a=Sf?Sf:[1,10];return[a[0],Math.max(Ac()/a[1],a[1])]},pj.updateScaleExtent=function(){var a=bc(vg.orgDomain())/bc(xj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var qj,rj,sj,tj,uj,vj,wj,xj,yj,zj={};if(If.focus=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",1)}var c=qj.selectAll(qd(a)),d=c.filter(Df),e=c.filter(Ef);If.revert(),If.defocus(),b(d.classed(g.focused,!0)),b(e),je(If.data.targets)&&Ob(a,!0),yf(a,!0)},If.defocus=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",.3)}var c=qj.selectAll(qd(a)),d=c.filter(Df),e=c.filter(Ef);If.revert(),b(d.classed(g.focused,!1)),b(e),je(If.data.targets)&&Pb(a),yf(a,!1)},If.revert=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",1)}var c=qj.selectAll(qd(a)),d=c.filter(Df),e=c.filter(Ef);b(d.classed(g.focused,!1)),b(e),je(If.data.targets)&&Pb(a),zf()},If.show=function(a,b){a=Ec(a),b=b||{},Nc(a),qj.selectAll(rd(a)).transition().style("opacity",1),b.withLegend&&Af(a),mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},If.hide=function(a,b){a=Ec(a),b=b||{},Mc(a),qj.selectAll(rd(a)).transition().style("opacity",0),b.withLegend&&Bf(a),mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},If.toggle=function(a){Hc(a)?If.hide(a):If.show(a)},If.unzoom=function(){lj.clear().update(),mf({withUpdateXDomain:!0})},If.load=function(a){return a.xs&&oc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Kg[b]=a.classes[b]}),"categories"in a&&Ni&&(rh=a.categories,Bg.categories(rh)),"cacheIds"in a&&cc(a.cacheIds)?void tf(ec(a.cacheIds),a.done):void("unload"in a?vf(Ec("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){uf(a)}):uf(a))},If.unload=function(a,b){vf(Ec(a),function(){mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},If.selected=function(a){return Hf.merge(sj.selectAll("."+g.shapes+pd(a)).selectAll("."+g.shape).filter(function(){return Hf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},If.select=function(a,b,c){Vg&&sj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Hf.select(this),i=e.data?e.data.id:e.id,j=Oe(this),k=Wg||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);"path"!==this.nodeName&&(k&&l?Xg(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},If.unselect=function(a,b){Vg&&sj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Hf.select(this),f=c.data?c.data.id:c.id,h=Oe(this),i=Wg||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);"path"!==this.nodeName&&i&&j&&Xg(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},If.toLine=function(a){Gf(a,"line")},If.toSpline=function(a){Gf(a,"spline")},If.toBar=function(a){Gf(a,"bar")},If.toScatter=function(a){Gf(a,"scatter")},If.toArea=function(a){Gf(a,"area")},If.toAreaSpline=function(a){Gf(a,"area-spline")},If.toPie=function(a){Gf(a,"pie",{withTransform:!0})},If.toDonut=function(a){Gf(a,"donut",{withTransform:!0})},If.groups=function(a){return c(a)?Lg:(Lg=a,mf(),Lg)},If.xgrids=function(a){return a?($h=a,mf(),$h):$h},If.xgrids.add=function(a){return a?If.xgrids($h.concat(a)):void 0},If.xgrids.remove=function(a){var b=Ff(a);return If.xgrids($h.filter(b))},If.ygrids=function(a){return a?(ai=a,mf(),ai):ai},If.ygrids.add=function(a){return a?If.ygrids(ai.concat(a)):void 0},If.ygrids.remove=function(a){var b=Ff(a);return If.ygrids(ai.filter(b))},If.regions=function(a){return c(a)?yi:(yi=a,mf(),yi)},If.regions.add=function(a){return c(a)?yi:(yi=yi.concat(a),mf(),yi)},If.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;qj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),yi=yi.filter(function(b){return b.classes.indexOf(a)<0})}),yi},If.data.get=function(a){var b=If.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},If.data.getAsTarget=function(a){var b=Gc(function(b){return b.id===a});return b.length>0?b[0]:void 0},If.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Jg[b]=a[b]}),mf({withLegend:!0}),Jg):Jg},If.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Tg[b]=a[b]}),mf({withLegend:!0}),Tg):Tg},If.x=function(a){return arguments.length&&(rc(If.data.targets,a),mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),If.data.xs},If.xs=function(a){return arguments.length&&(sc(If.data.targets,a),mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),If.data.xs},If.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){db(b,a[b])}),Fb())},If.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Ah=+a.x),b(a.y)&&(Hh=+a.y),b(a.y2)&&(Qh=+a.y2)):Hh=Qh=+a,mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},If.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Bh=+a.x),b(a.y)&&(Ih=+a.y),b(a.y2)&&(Rh=+a.y2)):Ih=Rh=+a,mf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},If.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&If.axis.max(a.max),"undefined"!=typeof a.min&&If.axis.min(a.min))},If.legend.show=function(a){Af(Ec(a)),mf({withLegend:!0})},If.legend.hide=function(a){Bf(Ec(a)),mf({withLegend:!0})},If.resize=function(a){Lf=a?a.width:null,Mf=a?a.height:null,rf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},If.destroy=function(){If.data.targets=void 0,If.data.xs={},wj.html(""),a.onresize=null},"url"in f.data)Hf.xhr(f.data.url,function(a,b){var c,d=Hf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Hf.csv.parse(b.response),df(c)});else if("rows"in f.data)df(uc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");df(vc(f.data.columns))}return If},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(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}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.ceil(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.ceil(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&abg&&(bg=0),0>dg&&(dg=0),cg=oh?$f.left-jj-kj:bg,eg=oh?dg:gg-_f.top-_f.bottom,0>cg&&(cg=0),0>eg&&(eg=0),r(),ej&&ke(Jf.data.targets)&&(ag.left=bg/2+ig)}function q(){tj.select("line."+g.xgridFocus).attr("x1",oh?0:-10).attr("x2",oh?bg:-10).attr("y1",oh?-10:$f.top).attr("y2",oh?-10:dg)}function r(){ig=dg/2,hg=.95*ig,jg=je(Jf.data.targets)?.6*hg:0}function s(){var a=oh?g.axisX:g.axisY,b=tj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=If.select(Lf).node().getBoundingClientRect(),e=c.right-d.left-v();return e>0?e:0}function t(){return Mf?Mf:z()}function u(){var a=Nf?Nf:A();return a>0?a:320}function v(){return ke(Jf.data.targets)?0:Of?Of:oh?ph?x("x"):1:!Hh||Mh?1:x("y")}function w(){var a=1;return ke(Jf.data.targets)?0:Pf?Pf:ej?R()+20+(Qh&&!oh?x("y2"):a):Qh?Vh||oh?a:x("y2"):a}function x(a){var b=mb(a);return b.isInner?20+Fb(a):40+Fb(a)}function y(a){return"x"!==a||ph?"x"===a&&Eh?Eh:"y"!==a||Hh?"y2"!==a||Qh?(mb(a).isInner?30:40)+("y2"===a?-10:0):lj:ih&&!ej?10:1:0}function z(){return+If.select(Lf).style("width").replace("px","")}function A(){return+If.select(Lf).style("height").replace("px","")}function B(a){return a?-31:-($f.left-1)}function C(a){return a?-20:-4}function D(){return B(!oh)}function E(){return C(!oh)}function F(){return B(oh)}function G(){return C(oh)}function H(a){return a?bg+2+30+30:$f.left+20}function I(a){return a?(Eh?Eh:0)+80:dg+8}function J(){return H(!oh)}function K(){return I(!oh)}function L(){return H(oh)}function M(){return I(oh)}function N(){var a,b,c,d,e,f=Cc(Jf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=wg(b.x)-wg(a.x),0===c?oh?dg:bg:(d=Bc(),e=ge(Jf.data.targets)?(d-(Oi?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function O(a){fj=a}function P(a){gj=a}function Q(a){hj=a}function R(){return ih?ej?gj*(fj+1):fg:0}function S(){return ih?ej?gg:hj*(fj+1):0}function T(){var a,b,c=!wg;og=oh?1:0,pg=oh?dg:bg,qg=oh?0:dg,rg=oh?bg:1,sg=og,tg=pg,ug=oh?0:eg,vg=oh?cg:1,wg=W(og,pg,c?void 0:wg.domain(),function(){return Cg.tickOffset()}),xg=X(qg,rg,c?void 0:xg.domain()),yg=X(qg,rg,c?void 0:yg.domain()),zg=W(og,pg,yj,function(a){return a%1?0:Fg.tickOffset()}),Ag=X(ug,vg,c?void 0:Ag.domain()),Bg=X(ug,vg,c?void 0:Bg.domain()),a=bb(),b=zh?zh:c?void 0:Cg.tickValues(),Cg=$(wg,_i,a,b),Fg=$(zg,cj,a,b),Dg=_(xg,aj,Nh,Ph),Eg=_(yg,bj,Wh,Yh),c||(mj.scale(zg),Sf&&qj.scale(wg)),U()}function U(){kg=Ib(),lg=Jb(),mg=Jb(.98)}function V(a,b,c){return(c?If.time.scale():If.scale.linear()).range([a,b])}function W(a,b,c,d){var e,f=V(a,b,Ni),g=c?f.domain(c):f;Oi?(d=d||function(){return 0},f=function(a,b){var c=g(a)+d(a);return b?c:Math.ceil(c)}):f=function(a,b){var c=g(a);return b?c:Math.ceil(c)};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return yj&&yj[0]===a[0]&&yj[1]a?a.toFixed(0):a};return uh&&("function"==typeof uh?a=uh:Ni&&(a=function(a){return a?Xi(uh)(a):""})),a}function cb(a){var b;return"y"===a?b=Lh:"y2"===a?b=Uh:"x"===a&&(b=Gh),b}function db(a){var b=cb(a);return"string"==typeof b?b:b?b.text:null}function eb(a,b){var c=cb(a);"string"==typeof c?"y"===a?Lh=b:"y2"===a?Uh=b:"x"===a&&(Gh=b):c&&(c.text=b)}function fb(a){return 10*Math.sin(Math.PI*(a/180))}function gb(a){return 11.5-2.5*(a/15)}function hb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",gb(c)).attr("x",fb(c)).attr("transform","rotate("+c+")")}function ib(a,b){var c=cb(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 jb(){return ib("x",oh?"inner-top":"inner-right")}function kb(){return ib("y",oh?"inner-right":"inner-top")}function lb(){return ib("y2",oh?"inner-right":"inner-top")}function mb(a){return"y2"===a?lb():"y"===a?kb():jb()}function nb(){return db("x")}function ob(){return db("y")}function pb(){return db("y2")}function qb(a,b){return a?b.isLeft?0:b.isCenter?bg/2:bg:b.isBottom?-dg:b.isMiddle?-dg/2:0}function rb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function sb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function tb(){return qb(!oh,jb())}function ub(){return qb(oh,kb())}function vb(){return qb(oh,lb())}function wb(){return rb(!oh,jb())}function xb(){return rb(oh,kb())}function yb(){return rb(oh,lb())}function zb(){var a=jb();return oh?a.isInner?"1.2em":-25-Fb("x"):a.isInner?"-0.5em":Eh?Eh-10:"3em"}function Ab(){var a=kb();return oh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Fb("y")}function Bb(){var a=lb();return oh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Fb("y2")}function Cb(){return sb(!oh,jb())}function Db(){return sb(oh,kb())}function Eb(){return sb(oh,lb())}function Fb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return If.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Gb(a){var b=tj.select("."+g.axisX+" ."+g.axisXLabel),c=tj.select("."+g.axisY+" ."+g.axisYLabel),d=tj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",tb).attr("dx",wb).attr("dy",zb).text(nb),(a?c.transition():c).attr("x",ub).attr("dx",xb).attr("dy",Ab).attr("dy",Ab).text(ob),(a?d.transition():d).attr("x",vb).attr("dx",yb).attr("dy",Bb).text(pb)}function Hb(a){var b=!1;return ng(Kc(Jf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Ib(){var a=If.svg.arc().outerRadius(hg).innerRadius(jg),b=function(b,c){var d;return c?a(b):(d=Hb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Jb(a){var b=If.svg.arc().outerRadius(ig*(a?a:1)).innerRadius(jg);return function(a){var c=Hb(a);return c?b(c):"M 0 0"}}function Kb(a,b){return re(a.data)?kg(a,b):"M 0 0"}function Lb(a){var b,c,d,e,f=Hb(a),g="";return f&&(b=kg.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*hg*.8+","+d/e*hg*.8+")"),g}function Mb(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Nb(a){return rc({id:a.data.id,value:a.value,ratio:Mb(a)})}function Ob(a){var b,c,d,e;return Rb()?(b=Hb(a),c=b?b.value:null,d=Mb(b),e=Sb(),e?e(c,d):Fd(c,d)):""}function Pb(a,b){var c=rj.selectAll("."+g.chartArc+rd(a)),d=rj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});xe(a)&&c.selectAll("path").transition().duration(50).attr("d",lg).transition().duration(100).attr("d",mg).each(function(a){qe(a.data)}),b||d.style("opacity",.3)}function Qb(a){var b=rj.selectAll("."+g.chartArc+rd(a));b.selectAll("path").transition().duration(50).attr("d",kg),rj.selectAll("."+g.arc).style("opacity",1)}function Rb(){return je(Jf.data.targets)?si:mi}function Sb(){return je(Jf.data.targets)?ti:ni}function Tb(){return je(Jf.data.targets)?vi:""}function Ub(){var a=je(Jf.data.targets)?wi:pi;return"function"==typeof a?a:function(){}}function Vb(){var a=je(Jf.data.targets)?xi:qi;return"function"==typeof a?a:function(){}}function Wb(){var a=je(Jf.data.targets)?yi:ri;return"function"==typeof a?a:function(){}}function Xb(a){var b,c,d,e,f,g,h=Ec(a),i=Rc(a);if(Mg.length>0)for(g=Tc(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 If.min(Object.keys(i).map(function(a){return If.min(i[a])}))}function Yb(a){var b,c,d,e,f,g,h=Ec(a),i=Rc(a);if(Mg.length>0)for(g=Uc(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 If.max(Object.keys(i).map(function(a){return If.max(i[a])}))}function Zb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return ab(a.id)===c}),m="y2"===c?Sh:Jh,n="y2"===c?Rh:Ih,o=b(m)?m:Xb(l),p=b(n)?n:Yb(l),q="y2"===c?Th:Kh,r=zd()&&oh;return 0===l.length?"y2"===c?yg.domain():xg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=Ad(o,p),j=cc(xg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Oh&&(f=b(Oh.top)?Oh.top:e,g=b(Oh.bottom)?Oh.bottom:e),"y2"===c&&Xh&&(f=b(Xh.top)?Xh.top:e,g=b(Xh.bottom)?Xh.bottom:e),ge(l)&&!Tc(l)&&(g=o),[o-g,p+f])}function $b(a){return Ch?Ni?ze(Ch):Ch:If.min(a,function(a){return If.min(a.values,function(a){return a.x})})}function _b(a){return Bh?Ni?ze(Bh):Bh:If.max(a,function(a){return If.max(a.values,function(a){return a.x})})}function ac(a){var c,d,e,f,g=Dc(a),h=g[1]-g[0];return Oi?d=0:ge(a)?(c=Bc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Dh&&Ee(Dh)?(e=b(Dh.left)?Dh.left:d,f=b(Dh.right)?Dh.right:d):e=f="number"==typeof Dh?Dh:d,{left:e,right:f}}function bc(a){var b=[$b(a),_b(a)],c=b[0],d=b[1],e=ac(a),f=0,g=0;return c-d!==0||Oi||(c=Ni?new Date(.5*c.getTime()):-.5,d=Ni?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Ni?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Ni?new Date(d.getTime()+e.right):d+e.right),[f,g]}function cc(a){return a[1]-a[0]}function dc(a){for(var b=0;bb?0:b-c}function jc(a){var b,c=hc(a),d="y"===a.axis?xg:yg;return b="y"===a.axis||"y2"===a.axis?oh?dg:"start"in a?d(a.start):dg:oh?"end"in a?wg(Ni?ze(a.end):a.end):dg:dg,c>b?0:b-c}function kc(a){return Gg&&a===Gg||Ee(Hg)&&Fe(Hg,a)}function lc(a){return!kc(a)}function mc(a){return Gg?Gg:Ee(Hg)?Hg[a]:null}function nc(a,b){var c,d=b&&Ee(b)?Ec(b):[];return d.forEach(function(b){mc(b)===a&&(c=Jf.data.xs[b])}),c}function oc(a,b){return a in Jf.data.xs&&Jf.data.xs[a]&&Jf.data.xs[a][b]?Jf.data.xs[a][b]:b}function pc(a){Object.keys(a).forEach(function(b){Hg[b]=a[b]})}function qc(a){return 1===If.set(Object.keys(a).map(function(b){return a[b]})).size()}function rc(a){var b;return a&&(b=Kg[a.id],a.name=b?b:a.id),a}function sc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=uc(b[d],a.id,d)}),Jf.data.xs[a.id]=b})}function tc(a,b){a.forEach(function(a){b[a.id]&&sc([a],b[a.id])})}function uc(a,c,d){var e;return e=Ni?a?a instanceof Date?a:ze(a):ze(oc(c,d)):Pi&&!Oi?b(a)?+a:oc(c,d):d}function vc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Jf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Gg?(d=Object.keys(Jf.data.xs),Jf.data.xs[c]=d.length>0?Jf.data.xs[d[0]]:void 0):Ee(Hg)&&(Jf.data.xs[c]=nc(f,Jf.data.targets)):Jf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Jf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Jg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=mc(b),g=a[f],h=uc(g,b,e);return Pi&&Oi&&0===c&&g&&(0===e&&(sh=[]),sh.push(g)),("undefined"==typeof a[b]||Jf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Og&&ee(Ec(c).filter(function(a){return!(a in Pg)}),Og),c.forEach(function(a){ec(a.id_org,a)}),c}function yc(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 zc(a){return a>0&&Jf.data.targets[0].values[a-1]?Jf.data.targets[0].values[a-1].x:void 0}function Ac(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Dc(a){var b,c,d=Cc(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Ec(a){return a.map(function(a){return a.id})}function Fc(a){return a?"string"==typeof a?[a]:a:Ec(Jf.data.targets)}function Gc(a,b){var c,d=Ec(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Ni?new Date(i):i);j.push(e)}return Ni||(j=j.sort(function(a,b){return a-b})),j}function Nc(a){Zi=Zi.concat(a)}function Oc(a){Zi=Zi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){$i=$i.concat(a)}function Qc(a){$i=$i.filter(function(b){return a.indexOf(b)<0})}function Rc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Sc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Uc(a){return Sc(a,function(a){return a>0})}function Vc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],(a[f].x||0===a[f].x)&&(e=e.concat(Ld(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Ld(a,g))),Od(e,b)):Md(a,b,f,g)}function Nd(a,b){var c;return c=a.map(function(a){return Md(a.values,b)}),Od(c,b)}function Od(a,b){var c,d;return a.forEach(function(a){var e=Ge(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Pd(a,b){return If.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Qd(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 Rd(){return Rg&&"desc"===Rg.toLowerCase()}function Sd(){return Rg&&"asc"===Rg.toLowerCase()}function Td(a){var b=Sd(),c=Rd();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof Rg&&a.sort(Rg),a}function Ud(a,c){var d,e,f,g,h,i,j,k=ke(Jf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&Ai&&(wj.html(Di(a,bb(),Bd(k),Wi)).style("display","block"),d=wj.property("offsetWidth"),e=wj.property("offsetHeight"),k?(g=bg/2+c[0],i=dg/2+c[1]+20):(oh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-w(),i=wg(l[0].x)+20):(f=s(),g=f+v()+wg(l[0].x)+20,h=g+d,j=f+t()-w(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),wj.style("top",i+"px").style("left",g+"px"))}function Vd(){wj.style("display","none")}function Wd(a){var c=a.filter(function(a){return a&&b(a.value)});if(Ai&&!he(Jf.data.targets)&&!ke(Jf.data.targets)){var d=tj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(oh?"y1":"x1",Hd).attr(oh?"y2":"x2",Hd),mf(d,"grid")}}function Xd(){tj.select("line."+g.xgridFocus).style("visibility","hidden")}function Yd(a,b){var c,d,e,f,h=[],i=tj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=bc(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function Zd(a){return a.x||0===a.x?wg(a.x):null}function $d(a){return Y(a.id)(a.value)}function _d(){var a,b,d={},e=0;return Kc(Hc(ne)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function de(a,b){return"number"==typeof ki?ki:b?2*a.tickOffset()*li/b:0}function ee(a,b){Fc(a).forEach(function(a){Aj[a]=b===Pg[a],Pg[a]=b})}function fe(a,b){var c=!1;return a.forEach(function(a){Pg[a.id]===b&&(c=!0),a.id in Pg||"line"!==b||(c=!0)}),c}function ge(a){return fe(a,"bar")}function he(a){return fe(a,"scatter")}function ie(a){return fe(a,"pie")}function je(a){return fe(a,"donut")}function ke(a){return ie(a)||je(a)}function le(a){var b="string"==typeof a?a:a.id;return!(b in Pg)||"line"===Pg[b]||"spline"===Pg[b]||"area"===Pg[b]||"area-spline"===Pg[b]}function me(a){var b="string"==typeof a?a:a.id;return"spline"===Pg[b]||"area-spline"===Pg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"bar"===Pg[b]}function oe(a){var b="string"==typeof a?a:a.id;return"scatter"===Pg[b]}function pe(a){var b="string"==typeof a?a:a.id;return"pie"===Pg[b]}function qe(a){var b="string"==typeof a?a:a.id;return"donut"===Pg[b]}function re(a){return pe(a)||qe(a)}function se(a){return le(a)?[a]:[]}function te(a){return re(a.data)?[a]:[]}function ue(a){return ne(a)?a.values:[]}function ve(a){return le(a)||oe(a)?a.values:[]}function we(a){return ne(a)||le(a)?a.values:[]}function xe(a){return qe(a)&&ui||pe(a)&&oi}function ye(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ze(b){var c;try{c=Ig?If.time.format(Ig).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Ig)}return c}function Ae(a,b){var c=If.mouse(a),d=If.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Fe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Ge(a,b){var c="y"===ab(a.id)?xg:yg,d=oh?1:0,e=oh?0:1;return Math.pow(wg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function He(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ie(a,b,c){bh(b,a.node()),tj.select("."+g.selectedCircles+qd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Wc(g.selectedCircle,c)}).attr("cx",oh?$d:Zd).attr("cy",oh?Zd:$d).attr("stroke",function(){return Wi(b)}).attr("r",1.4*Te(b)).transition().duration(100).attr("r",Te)}function Je(a,b,c){ch(b,a.node()),tj.select("."+g.selectedCircles+qd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ke(a,b,c,d){a?Ie(b,c,d):Je(b,c,d)}function Le(a,b){bh(b,a.node()),a.transition().duration(100).style("fill",function(){return If.rgb(Wi(b)).brighter(.75)})}function Me(a,b){ch(b,a.node()),a.transition().duration(100).style("fill",function(){return Wi(b)})}function Ne(a,b,c,d){a?Le(b,c,d):Me(b,c,d)}function Oe(a,b,c,d){Ne(a,b,c.data,d)}function Pe(a){return"circle"===a.nodeName?Ke:If.select(a).classed(g.bar)?Ne:Oe}function Qe(a){return a.filter(function(a){return b(a.value)})}function Re(a){return di?"function"==typeof ei?ei(a):ei:0}function Se(a){return gi?hi?hi:1.75*Re(a):Re(a)}function Te(a){return ii?ii:4*Re(a)}function Ue(a,c){return(c?tj.selectAll("."+g.circles+qd(c)):tj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ve(a,b){Ue(a,b).classed(g.EXPANDED,!0).attr("r",Se)}function We(a){Ue(a).filter(function(){return If.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Re)}function Xe(a){return tj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function Ye(a){Xe(a).classed(g.EXPANDED,!0)}function Ze(a){Xe(a).classed(g.EXPANDED,!1)}function $e(a,b){var c=cf(a,b);return function(a,b){var d=c(a,b),e=oh?1:0,f=oh?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 _e(a,b){var c=cf(a,!1),d=b?af:bf;return function(a,b){return d(c(a,b),a,this)}}function af(a,b){var c;return oh?(c=ne(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function bf(a,b,c){var d=c.getBoundingClientRect();return oh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ne(b)?-3:-6)}function cf(a,b){var c=a.__max__+1,d=de(Cg,c),e=ae(d,c,a,!!b),f=be(!!b),g=ce(a,!!b),h=b?Z:Y;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return oh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function df(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function ef(b){var c,d,e;if(xj=If.select(Lf),xj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(xj.html("").classed("c3",!0),Jf.data.xs={},Jf.data.targets=xc(b),Vg&&Nc(Vg===!0?Ec(Jf.data.targets):Vg),p(),T(),wg.domain(If.extent(bc(Jf.data.targets))),xg.domain(Zb(Jf.data.targets,"y")),yg.domain(Zb(Jf.data.targets,"y2")),zg.domain(wg.domain()),Ag.domain(xg.domain()),Bg.domain(yg.domain()),yj=wg.domain(),mj.scale(zg),Sf&&qj.scale(wg),rj=xj.append("svg").on("mouseenter",Vf).on("mouseleave",Wf),sj=rj.append("defs"),sj.append("clipPath").attr("id",Hi).append("rect"),sj.append("clipPath").attr("id",Ii).append("rect"),sj.append("clipPath").attr("id",Ji).append("rect"),rf(),tj=rj.append("g").attr("transform",dj.main),uj=rj.append("g").attr("transform",dj.context),vj=rj.append("g").attr("transform",dj.legend),fh||uj.style("visibility","hidden"),ih||(vj.style("visibility","hidden"),$i=Ec(Jf.data.targets)),wj=If.select(Lf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Df(Ec(Jf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=tj.append("g").attr("clip-path",Ki).attr("class",g.grid),Zh&&d.append("g").attr("class",g.xgrids),Ee(_h)&&d.append("g").attr("class",g.xgridLines),fi&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),ai&&d.append("g").attr("class",g.ygrids),Ee(bi)&&d.append("g").attr("class",g.ygridLines),tj.append("g").attr("clip-path",Ki).attr("class",g.regions),tj.append("g").attr("clip-path",Ki).attr("class",g.chart),c=tj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Sf?oh?"ns-resize":"ew-resize":null),tj.select("."+g.chart).append("g").attr("class",g.chartBars),tj.select("."+g.chart).append("g").attr("class",g.chartLines),tj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",dj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Tb()),tj.select("."+g.chart).append("g").attr("class",g.chartTexts),Sf&&tj.insert("rect",Uf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",bg).attr("height",dg).style("opacity",0).style("cursor",oh?"ns-resize":"ew-resize").call(qj).on("dblclick.zoom",null),Fh&&mj.extent("function"!=typeof Fh?Fh:Fh(bc())),ph&&tj.append("g").attr("class",g.axisX).attr("clip-path",Li).attr("transform",dj.x).append("text").attr("class",g.axisXLabel).attr("transform",oh?"rotate(-90)":"").style("text-anchor",Cb),Hh&&tj.append("g").attr("class",g.axisY).attr("clip-path",Mi).attr("transform",dj.y).append("text").attr("class",g.axisYLabel).attr("transform",oh?"":"rotate(-90)").style("text-anchor",Db),Qh&&tj.append("g").attr("class",g.axisY2).attr("transform",dj.y2).append("text").attr("class",g.axisY2Label).attr("transform",oh?"":"rotate(-90)").style("text-anchor",Eb),uj.append("g").attr("clip-path",Ki).attr("class",g.chart),uj.select("."+g.chart).append("g").attr("class",g.chartBars),uj.select("."+g.chart).append("g").attr("class",g.chartLines),uj.append("g").attr("clip-path",Ki).attr("class",g.brush).call(mj).selectAll("rect").attr(oh?"width":"height",oh?cg:eg),uj.append("g").attr("class",g.axisX).attr("transform",dj.subx).attr("clip-path",oh?"":Li),tf(Jf.data.targets),oh?tj.select("."+g.axisX).style("opacity",0).call(Cg):(tj.select("."+g.axisY).style("opacity",0).call(Dg),tj.select("."+g.axisY2).style("opacity",0).call(Eg)),p(),T(),rf(),o(!1),nf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Ei){if(Ni&&"string"==typeof Fi){for(Fi=ze(Fi),e=0;e0){d=[];for(var f in Kg)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Qd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ne,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function kf(a){ke(Jf.data.targets)||Wg&&(Qi=a,tj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Ri=!0,dh())}function lf(){ke(Jf.data.targets)||Wg&&(tj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),tj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Ri=!1,eh())}function mf(a,b){"grid"===b&&a.each(function(){var a=If.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function nf(a){var c,e,f,h,i,j,k,l,m,n,o,p,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,O,P,Q,R,S,T,U,V,W,X,Y,Z,$,_=_d(),ab=ke(Jf.data.targets),bb=Kc(Jf.data.targets);if(a=d(a)?a:{},G=d(a.withY)?a.withY:!0,H=d(a.withSubchart)?a.withSubchart:!0,I=d(a.withTransition)?a.withTransition:!0,L=d(a.withTransform)?a.withTransform:!1,M=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,O=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,P=d(a.withLegend)?a.withLegend:!1,J=d(a.withTransitionForExit)?a.withTransitionForExit:I,K=d(a.withTransitionForAxis)?a.withTransitionForAxis:I,V=I?Zf:0,W=J?V:0,X=K?V:0,c=tj.select("."+g.axisX).style("opacity",ab?0:1),f=tj.select("."+g.axisY).style("opacity",ab?0:1),h=tj.select("."+g.axisY2).style("opacity",ab?0:1),e=uj.select("."+g.axisX).style("opacity",ab?0:1),U={axisX:c.transition().duration(X),axisY:f.transition().duration(X),axisY2:h.transition().duration(X),axisSubX:e.transition().duration(X)},P&&ih&&Df(Ec(Jf.data.targets),a,U),Oi&&0===bb.length&&wg.domain([0,c.selectAll(".tick").size()]),bb.length&&(O&&(wg.domain(If.extent(bc(bb))),yj=wg.domain(),Sf&&qj.scale(wg).updateScaleExtent(),zg.domain(wg.domain()),mj.scale(zg)),M&&(wg.domain(mj.empty()?yj:mj.extent()),Sf&&qj.scale(wg).updateScaleExtent()),zh||!yh&&!xh||(Y=Mc(Lc(bb),xh),Cg.tickValues(Y),Fg.tickValues(Y))),xg.domain(Zb(bb,"y")),yg.domain(Zb(bb,"y2")),U.axisX.call(Cg),U.axisY.call(Dg),U.axisY2.call(Eg),U.axisSubX.call(Fg),Gb(I),M&&bb.length)if(vh&&Y){for(Z=1;Z=0&&If.select(this).style("display",b%$?"none":"block")})}else rj.selectAll("."+g.axisX+" .tick text").style("display","block");!oh&&Ah&&hb(c,U.axisX,Ah),Q=$e(_),S=_e(_,!0),T=_e(_,!1),Ag.domain(xg.domain()),Bg.domain(yg.domain()),wj.style("display","none"),q(),tj.select("line."+g.xgridFocus).style("visibility","hidden"),Zh&&(k=Yd($h,wg),D=Oi?Cg.tickOffset():0,j=oh?{x1:0,x2:bg,y1:function(a){return wg(a)-D},y2:function(a){return wg(a)-D}}:{x1:function(a){return wg(a)+D},x2:function(a){return wg(a)+D},y1:$f.top,y2:dg},i=tj.select("."+g.xgrids).selectAll("."+g.xgrid).data(k),i.enter().append("line").attr("class",g.xgrid),i.attr(j).style("opacity",function(){return+If.select(this).attr(oh?"y1":"x1")===(oh?dg:0)?0:1}),i.exit().remove()),Ee(_h)&&(l=tj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(_h),m=l.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",oh?"":"rotate(-90)").attr("dx",oh?0:-$f.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(V).attr("x1",oh?0:Id).attr("x2",oh?bg:Id).attr("y1",oh?Id:$f.top).attr("y2",oh?Id:dg).style("opacity",1),l.select("text").transition().duration(V).attr("x",oh?bg:0).attr("y",Id).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(V).style("opacity",0).remove()),G&&ai&&(n=tj.select("."+g.ygrids).selectAll("."+g.ygrid).data(xg.ticks(ci)),n.enter().append("line").attr("class",g.ygrid),n.attr("x1",oh?xg:0).attr("x2",oh?xg:bg).attr("y1",oh?0:xg).attr("y2",oh?dg:xg),n.exit().remove(),mf(n,"grid")),G&&Ee(bi)&&(o=tj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(bi),p=o.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",oh?"rotate(-90)":"").attr("dx",oh?0:-$f.top).attr("dy",-5).style("opacity",0),o.select("line").transition().duration(V).attr("x1",oh?Jd:0).attr("x2",oh?Jd:bg).attr("y1",oh?0:Jd).attr("y2",oh?dg:Jd).style("opacity",1),o.select("text").transition().duration(V).attr("x",oh?0:bg).attr("y",Jd).text(function(a){return a.text}).style("opacity",1),o.exit().transition().duration(V).style("opacity",0).remove()),w=tj.select("."+g.regions).selectAll("."+g.region).data(zi),w.enter().append("g").attr("class",jd).append("rect").style("fill-opacity",0),w.selectAll("rect").transition().duration(V).attr("x",gc).attr("y",hc).attr("width",ic).attr("height",jc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),w.exit().transition().duration(V).style("fill-opacity",0).remove(),u=tj.selectAll("."+g.bars).selectAll("."+g.bar).data(ue),u.enter().append("path").attr("class",dd).style("stroke","none").style("fill",Wi),u.style("opacity",vd).transition().duration(V).attr("d",Q).style("fill",Wi).style("opacity",1),u.exit().transition().duration(W).style("opacity",0).remove(),r=tj.selectAll("."+g.lines).selectAll("."+g.line).data(se),r.enter().append("path").attr("class",_c).style("stroke",Wi),r.style("opacity",vd).transition().duration(V).attr("d",nj).style("stroke",Wi).style("opacity",1),r.exit().transition().duration(W).style("opacity",0).remove(),s=tj.selectAll("."+g.areas).selectAll("."+g.area).data(se),s.enter().append("path").attr("class",hd).style("fill",Wi).style("opacity",function(){return zj=+If.select(this).style("opacity"),0}),s.style("opacity",0).transition().duration(V).attr("d",oj).style("fill",Wi).style("opacity",zj),s.exit().transition().duration(W).style("opacity",0).remove(),t=tj.selectAll("."+g.circles).selectAll("."+g.circle).data(ve),t.enter().append("circle").attr("class",bd).attr("r",Re).style("fill",Wi),t.style("opacity",vd).transition().duration(V).style("opacity",xd).style("fill",Wi).attr("cx",oh?$d:Zd).attr("cy",oh?Zd:$d),t.exit().remove(),x=tj.selectAll("."+g.texts).selectAll("."+g.text).data(we),x.enter().append("text").attr("class",Xc).attr("text-anchor",function(a){return oh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",Wi).style("fill-opacity",0),x.text(function(a){return Gd(a.id)(a.value,a.id)}).style("fill-opacity",wd).transition().duration(V).attr("x",S).attr("y",T).style("fill",Wi).style("fill-opacity",yd),x.exit().transition().duration(W).style("fill-opacity",0).remove(),v=tj.selectAll("."+g.arcs).selectAll("."+g.arc).data(te),v.enter().append("path").attr("class",fd).style("fill",function(a){return Wi(a.data)}).style("cursor",function(a){return Yg(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Ui||(c=Hb(a),d=Nb(c),e=Vb(),Pb(c.data.id),zf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Hb(a),c=Nb(b),d=[c];Ud(d,If.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Ui||(c=Hb(a),d=Nb(c),e=Wb(),Qb(c.data.id),Af(),Vd(),e(d,b))}).on("click",function(a,b){var c=Hb(a),d=Nb(c),e=Ub();hf(this,a,b),e(d,b)}),v.attr("transform",L?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Ui=!0}).transition().duration(V).attrTween("d",function(a){var b,c=Hb(a);return c?(b=If.interpolate(this._current,c),this._current=b(0),function(a){return Kb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",L?"scale(1)":"").style("fill",function(a){return Wi(a.data)}).style("opacity",1).call(He,function(){Ui=!1}),v.exit().transition().duration(W).style("opacity",0).remove(),tj.selectAll("."+g.chartArc).select("text").attr("transform",Lb).style("opacity",0).transition().duration(V).text(Ob).style("opacity",function(a){return Ic(a.data.id)&&re(a.data)?1:0}),tj.select("."+g.chartArcsTitle).style("opacity",je(Jf.data.targets)?1:0),fh&&(If.event&&"zoom"===If.event.type&&mj.extent(wg.orgDomain()).update(),H&&(!oh&&Ah&&hb(e,U.axisSubX,Ah),mj.empty()||mj.extent(wg.orgDomain()).update(),R=$e(_,!0),z=uj.selectAll("."+g.bars).selectAll("."+g.bar).data(ue),z.enter().append("path").attr("class",dd).style("stroke","none").style("fill",Wi),z.style("opacity",vd).transition().duration(V).attr("d",R).style("opacity",1),z.exit().transition().duration(V).style("opacity",0).remove(),y=uj.selectAll("."+g.lines).selectAll("."+g.line).data(se),y.enter().append("path").attr("class",_c).style("stroke",Wi),y.style("opacity",vd).transition().duration(V).attr("d",pj).style("opacity",1),y.exit().transition().duration(V).style("opacity",0).remove())),tj.selectAll("."+g.selectedCircles).filter(function(a){return ne(a)}).selectAll("circle").remove(),tj.selectAll("."+g.selectedCircle).transition().duration(V).attr("cx",oh?$d:Zd).attr("cy",oh?Zd:$d),A=tj.select("."+g.eventRects),Ee(Hg)&&!qc(Hg)?(A.classed(g.eventRectsMultiple)||A.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),B=tj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),gf(B.enter()),B.attr("x",0).attr("y",0).attr("width",bg).attr("height",dg)):(A.classed(g.eventRectsSingle)||A.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Pi&&!Oi?(F=function(a,b){var c=zc(b),d=Ac(b),e=Jf.data.xs[a.id][b];return(wg(d?d:e+50)-wg(c?c:e-50))/2},E=function(a,b){var c=zc(b),d=Jf.data.xs[a.id][b];return(wg(d)+wg(c?c:d-50))/2}):(F=N(),E=function(a){return wg(a.x)-F/2}),C=Cc(Jf.data.targets),tj.select("."+g.eventRects).datum(C?C.values:[]),B=tj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),ff(B.enter()),B.attr("class",kd).attr("x",oh?0:E).attr("y",oh?E:0).attr("width",oh?bg:F).attr("height",oh?F:dg),B.exit().remove()),Ec(Jf.data.targets).forEach(function(a){Aj[a]=!0})}function of(){nf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function pf(){if(0!==Kc(Jf.data.targets).length){if("mousemove"===If.event.sourceEvent.type&&qj.altDomain)return wg.domain(qj.altDomain),void qj.scale(wg).updateScaleExtent();Oi&&wg.orgDomain()[0]===yj[0]&&wg.domain([yj[0]-1e-10,wg.orgDomain()[1]]),nf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===If.event.sourceEvent.type&&(Si=!0)}}function qf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function rf(){rj.attr("width",fg).attr("height",gg),rj.select("#"+Hi).select("rect").attr("width",bg).attr("height",dg),rj.select("#"+Ii).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),rj.select("#"+Ji).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),rj.select("."+g.zoomRect).attr("width",bg).attr("height",dg),xj.style("max-height",gg+"px")}function sf(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,p(),T(),rf(),o(a.withTransition),nf(a)}function tf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=tj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",md),j=i.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Yc),e=tj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",od),d=e.enter().append("g").attr("class",od).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",ed).style("cursor",function(a){return Yg(a)?"pointer":null}),c=tj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",nd),b=c.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",ad),b.append("g").attr("class",id),b.append("g").attr("class",function(a){return Wc(g.selectedCircles,a.id)}),b.append("g").attr("class",cd).style("cursor",function(a){return Yg(a)?"pointer":null}),a.forEach(function(a){tj.selectAll("."+g.selectedCircles+qd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=tj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(ng(a)).attr("class",pd),f=h.enter().append("g").attr("class",pd),f.append("g").attr("class",gd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),fh&&(n=uj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",od),m=n.enter().append("g").style("opacity",0).attr("class",od),m.append("g").attr("class",ed),l=uj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",nd),k=l.enter().append("g").style("opacity",0).attr("class",nd),k.append("g").attr("class",ad)),rj.selectAll("."+g.target).filter(function(a){return Ic(a.id)}).transition().duration(Zf).style("opacity",1)}function uf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?ee(a.id,b.types[a.id]):ee(a.id,b.type)}),Jf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=ej?j:i,l=ej?S():R();return d&&(w=0,C=0,t=0,u=0),ih&&!Jc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=ej?u:t,void(nh?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=vj.selectAll("."+g.legendItemFocused).size();b=b||{},n=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,ej?(f=function(a){return t*B[a]},j=function(a){return A[B[a]]+x[a]}):(f=function(a){return A[B[a]]+x[a]},j=function(a){return u*B[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=vj.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Wc(g.legendItem,a)}).style("visibility",function(a){return Jc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof kh?kh(a):Jf.toggle(a)}).on("mouseover",function(a){If.select(this).classed(g.legendItemFocused,!0),Ui||Jf.focus(a),"function"==typeof lh&&lh(a)}).on("mouseout",function(a){If.select(this).classed(g.legendItemFocused,!1),Ui||Jf.revert(),"function"==typeof mh&&mh(a)}),m.append("text").text(function(a){return d(Kg[a])?Kg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",ej?h:-200).attr("y",ej?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",ej?i:-200).attr("y",ej?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",Wi).attr("x",ej?h:-200).attr("y",ej?-200:j).attr("width",10).attr("height",10),vj.selectAll("text").data(a).text(function(a){return d(Kg[a])?Kg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(n?250:0).attr("x",h).attr("y",k),vj.selectAll("rect."+g.legendItemEvent).data(a).transition().duration(n?250:0).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}).attr("x",i).attr("y",l),vj.selectAll("rect."+g.legendItemTile).data(a).transition().duration(n?250:0).style("fill",Wi).attr("x",f).attr("y",j),vj.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Ic(a)}).transition().style("opacity",function(a){var b=If.select(this);return Ic(a)?!D||b.classed(g.legendItemFocused)?xf(b):yf(b):ij}),P(t),Q(u),O(C),p(),T(),rf(),o(q,c)}function Ef(a){return Gc(Jf.data.targets,a.id)}function Ff(a){return"data"in a&&Gc(Jf.data.targets,a.data.id)}function Gf(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 Hf(a,b,c){var d=!ke(Jf.data.targets);Ui=!1,ee(a,b),sf(c||{withTransitionForAxis:d})}var If=a.d3?a.d3:a.require?a.require("d3"):void 0,Jf={data:{},axis:{},legend:{}},Kf={},Lf=i(["bindto"],"#chart"),Mf=i(["size","width"]),Nf=i(["size","height"]),Of=i(["padding","left"],50),Pf=i(["padding","right"],0),Qf=i(["padding","top"],0),Rf=i(["padding","bottom"],0),Sf=i(["zoom","enabled"],!1),Tf=i(["zoom","extent"]),Uf=i(["zoom","privileged"],!1),Vf=i(["onenter"],function(){}),Wf=i(["onleave"],function(){}),Xf=i(["onresize"],function(){}),Yf=i(["onresized"],function(){}),Zf=i(["transition","duration"],350);h("data","data is required in config");var $f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg=i(["data","x"]),Hg=i(["data","xs"],{}),Ig=i(["data","x_format"]),Jg=i(["data","id_converter"],function(a){return a}),Kg=i(["data","names"],{}),Lg=i(["data","classes"],{}),Mg=i(["data","groups"],[]),Ng=i(["data","axes"],{}),Og=i(["data","type"]),Pg=i(["data","types"],{}),Qg=i(["data","labels"],{}),Rg=i(["data","order"]),Sg=i(["data","regions"],{}),Tg=i(["data","color"]),Ug=i(["data","colors"],{}),Vg=i(["data","hide"],!1),Wg=i(["data","selection","enabled"],!1),Xg=i(["data","selection","grouped"],!1),Yg=i(["data","selection","isselectable"],function(){return!0}),Zg=i(["data","selection","multiple"],!0),$g=i(["data","onclick"],function(){}),_g=i(["data","onenter"],function(){}),ah=i(["data","onleave"],function(){}),bh=i(["data","onselected"],function(){}),ch=i(["data","onunselected"],function(){}),dh=i(["data","ondragstart"],function(){}),eh=i(["data","ondragend"],function(){}),fh=i(["subchart","show"],!1),gh=i(["subchart","size","height"],60),hh=i(["color","pattern"],[]),ih=i(["legend","show"],!0),jh=i(["legend","position"],"bottom"),kh=i(["legend","item","onclick"]),lh=i(["legend","item","onmouseover"]),mh=i(["legend","item","onmouseout"]),nh=i(["legend","equally"],!1),oh=i(["axis","rotated"],!1),ph=i(["axis","x","show"],!0),qh=i(["axis","x","type"],"indexed"),rh=i(["axis","x","localtime"],!0),sh=i(["axis","x","categories"],[]),th=i(["axis","x","tick","centered"],!1),uh=i(["axis","x","tick","format"]),vh=i(["axis","x","tick","culling"],{}),wh=i(["axis","x","tick","culling","max"],10),xh=i(["axis","x","tick","count"]),yh=i(["axis","x","tick","fit"],!0),zh=i(["axis","x","tick","values"],null),Ah=i(["axis","x","tick","rotate"]),Bh=i(["axis","x","max"],null),Ch=i(["axis","x","min"],null),Dh=i(["axis","x","padding"],{}),Eh=i(["axis","x","height"]),Fh=i(["axis","x","default"]),Gh=i(["axis","x","label"],{}),Hh=i(["axis","y","show"],!0),Ih=i(["axis","y","max"]),Jh=i(["axis","y","min"]),Kh=i(["axis","y","center"]),Lh=i(["axis","y","label"],{}),Mh=i(["axis","y","inner"],!1),Nh=i(["axis","y","tick","format"]),Oh=i(["axis","y","padding"]),Ph=i(["axis","y","ticks"],10),Qh=i(["axis","y2","show"],!1),Rh=i(["axis","y2","max"]),Sh=i(["axis","y2","min"]),Th=i(["axis","y2","center"]),Uh=i(["axis","y2","label"],{}),Vh=i(["axis","y2","inner"],!1),Wh=i(["axis","y2","tick","format"]),Xh=i(["axis","y2","padding"]),Yh=i(["axis","y2","ticks"],10),Zh=i(["grid","x","show"],!1),$h=i(["grid","x","type"],"tick"),_h=i(["grid","x","lines"],[]),ai=i(["grid","y","show"],!1),bi=i(["grid","y","lines"],[]),ci=i(["grid","y","ticks"],10),di=i(["point","show"],!0),ei=i(["point","r"],2.5),fi=i(["point","focus","line","enabled"],!0),gi=i(["point","focus","expand","enabled"],!0),hi=i(["point","focus","expand","r"]),ii=i(["point","focus","select","r"]),ji=i(["line","connect_null"],!1),ki=i(["bar","width"]),li=i(["bar","width","ratio"],.6),mi=i(["pie","label","show"],!0),ni=i(["pie","label","format"]),oi=i(["pie","expand"],!0),pi=i(["pie","onclick"],function(){}),qi=i(["pie","onmouseover"],function(){}),ri=i(["pie","onmouseout"],function(){}),si=i(["donut","label","show"],!0),ti=i(["donut","label","format"]),ui=i(["donut","expand"],!0),vi=i(["donut","title"],""),wi=i(["donut","onclick"],function(){}),xi=i(["donut","onmouseover"],function(){}),yi=i(["donut","onmouseout"],function(){}),zi=i(["regions"],[]),Ai=i(["tooltip","show"],!0),Bi=i(["tooltip","format","title"]),Ci=i(["tooltip","format","value"]),Di=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Bi?Bi:b,l=Ci?Ci:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Ei=i(["tooltip","init","show"],!1),Fi=i(["tooltip","init","x"],0),Gi=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Hi=("string"==typeof Lf?Lf.replace("#",""):Lf.id)+"-clip",Ii=Hi+"-xaxis",Ji=Hi+"-yaxis",Ki=j(Hi),Li=j(Ii),Mi=j(Ji),Ni="timeseries"===qh,Oi="categorized"===qh,Pi=!Ni&&(Gg||Ee(Hg)),Qi=null,Ri=!1,Si=!1,Ti=!1,Ui=!1,Vi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Wi=ye(Ug,Ee(hh)?hh:Vi,Tg),Xi=rh?If.time.format:If.time.format.utc,Yi=Xi.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),Zi=[],$i=[],_i=oh?"left":"bottom",aj=oh?Mh?"top":"bottom":Mh?"right":"left",bj=oh?Vh?"bottom":"top":Vh?"left":"right",cj=oh?"left":"bottom",dj={main:function(){return"translate("+k($f.left)+","+k($f.top)+")"},context:function(){return"translate("+k(_f.left)+","+k(_f.top)+")"},legend:function(){return"translate("+ag.left+","+ag.top+")"},x:function(){return"translate(0,"+(oh?0:dg)+")"},y:function(){return"translate(0,"+(oh?dg:0)+")"},y2:function(){return"translate("+(oh?0:bg)+","+(oh?1:0)+")"},subx:function(){return"translate(0,"+(oh?0:eg)+")"},arc:function(){return"translate("+bg/2+","+dg/2+")"}},ej="right"===jh,fj=0,gj=0,hj=0,ij=.15,jj=30,kj=oh&&!ph?0:30,lj=5;ng=If.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value +},0)});var mj,nj=function(){var a=If.svg.line().x(oh?function(a){return Y(a.id)(a.value)}:Hd).y(oh?Hd:function(a){return Y(a.id)(a.value)});return ji||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ji?Qe(b.values):b.values;return le(b)?(a.interpolate(me(b)?"cardinal":"linear"),Sg[b.id]?df(e,wg,Y(b.id),Sg[b.id]):a(e)):(c=e[0]?wg(e[0].x):0,d=e[0]?Y(b.id)(e[0].value):0,oh?"M "+d+" "+c:"M "+c+" "+d)}}(),oj=function(){var a;return a=oh?If.svg.area().x0(function(a){return Y(a.id)(0)}).x1(function(a){return Y(a.id)(a.value)}).y(Hd):If.svg.area().x(Hd).y0(function(a){return Y(a.id)(0)}).y1(function(a){return Y(a.id)(a.value)}),function(b){var c,d,e=Qe(b.values);return fe([b],"area")||fe([b],"area-spline")?(a.interpolate(me(b)?"cardinal":"linear"),a(e)):(c=e[0]?wg(e[0].x):0,d=e[0]?Y(b.id)(e[0].value):0,oh?"M "+d+" "+c:"M "+c+" "+d)}}(),pj=function(){var a=If.svg.line().x(oh?function(a){return Z(a.id)(a.value)}:Kd).y(oh?Kd:function(a){return Z(a.id)(a.value)});return function(b){var c=Qe(b.values);return le(b)?a(c):"M "+zg(c[0].x)+" "+Z(b.id)(c[0].value)}}(),qj=function(){};mj=If.svg.brush().on("brush",of),mj.update=function(){return uj&&uj.select("."+g.brush).call(this),this},mj.scale=function(a){return oh?this.y(a):this.x(a)},Sf&&(qj=If.behavior.zoom().on("zoomstart",function(){qj.altDomain=If.event.sourceEvent.altKey?wg.orgDomain():null}).on("zoom",Sf?pf:null),qj.scale=function(a){return oh?this.y(a):this.x(a)},qj.orgScaleExtent=function(){var a=Tf?Tf:[1,10];return[a[0],Math.max(Bc()/a[1],a[1])]},qj.updateScaleExtent=function(){var a=cc(wg.orgDomain())/cc(yj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var rj,sj,tj,uj,vj,wj,xj,yj,zj,Aj={};if(Jf.focus=function(a){function b(a){Kc(a).transition().duration(100).style("opacity",1)}var c=rj.selectAll(rd(a)),d=c.filter(Ef),e=c.filter(Ff);Jf.revert(),Jf.defocus(),b(d.classed(g.focused,!0)),b(e),ke(Jf.data.targets)&&Pb(a,!0),zf(a,!0)},Jf.defocus=function(a){function b(a){Kc(a).transition().duration(100).style("opacity",.3)}var c=rj.selectAll(rd(a)),d=c.filter(Ef),e=c.filter(Ff);Jf.revert(),b(d.classed(g.focused,!1)),b(e),ke(Jf.data.targets)&&Qb(a),zf(a,!1)},Jf.revert=function(a){function b(a){Kc(a).transition().duration(100).style("opacity",1)}var c=rj.selectAll(rd(a)),d=c.filter(Ef),e=c.filter(Ff);b(d.classed(g.focused,!1)),b(e),ke(Jf.data.targets)&&Qb(a),Af()},Jf.show=function(a,b){a=Fc(a),b=b||{},Oc(a),rj.selectAll(sd(a)).transition().style("opacity",1),b.withLegend&&Bf(a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Jf.hide=function(a,b){a=Fc(a),b=b||{},Nc(a),rj.selectAll(sd(a)).transition().style("opacity",0),b.withLegend&&Cf(a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Jf.toggle=function(a){Ic(a)?Jf.hide(a):Jf.show(a)},Jf.unzoom=function(){mj.clear().update(),nf({withUpdateXDomain:!0})},Jf.load=function(a){return a.xs&&pc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Lg[b]=a.classes[b]}),"categories"in a&&Oi&&(sh=a.categories,Cg.categories(sh)),"cacheIds"in a&&dc(a.cacheIds)?void uf(fc(a.cacheIds),a.done):void("unload"in a?wf(Fc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){vf(a)}):vf(a))},Jf.unload=function(a,b){wf(Fc(a),function(){nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Jf.selected=function(a){return If.merge(tj.selectAll("."+g.shapes+qd(a)).selectAll("."+g.shape).filter(function(){return If.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Jf.select=function(a,b,c){Wg&&tj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=If.select(this),i=e.data?e.data.id:e.id,j=Pe(this),k=Xg||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);"path"!==this.nodeName&&(k&&l?Yg(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},Jf.unselect=function(a,b){Wg&&tj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=If.select(this),f=c.data?c.data.id:c.id,h=Pe(this),i=Xg||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);"path"!==this.nodeName&&i&&j&&Yg(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Jf.toLine=function(a){Hf(a,"line")},Jf.toSpline=function(a){Hf(a,"spline")},Jf.toBar=function(a){Hf(a,"bar")},Jf.toScatter=function(a){Hf(a,"scatter")},Jf.toArea=function(a){Hf(a,"area")},Jf.toAreaSpline=function(a){Hf(a,"area-spline")},Jf.toPie=function(a){Hf(a,"pie",{withTransform:!0})},Jf.toDonut=function(a){Hf(a,"donut",{withTransform:!0})},Jf.groups=function(a){return c(a)?Mg:(Mg=a,nf(),Mg)},Jf.xgrids=function(a){return a?(_h=a,nf(),_h):_h},Jf.xgrids.add=function(a){return a?Jf.xgrids(_h.concat(a)):void 0},Jf.xgrids.remove=function(a){var b=Gf(a);return Jf.xgrids(_h.filter(b))},Jf.ygrids=function(a){return a?(bi=a,nf(),bi):bi},Jf.ygrids.add=function(a){return a?Jf.ygrids(bi.concat(a)):void 0},Jf.ygrids.remove=function(a){var b=Gf(a);return Jf.ygrids(bi.filter(b))},Jf.regions=function(a){return c(a)?zi:(zi=a,nf(),zi)},Jf.regions.add=function(a){return c(a)?zi:(zi=zi.concat(a),nf(),zi)},Jf.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;rj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),zi=zi.filter(function(b){return b.classes.indexOf(a)<0})}),zi},Jf.data.get=function(a){var b=Jf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Jf.data.getAsTarget=function(a){var b=Hc(function(b){return b.id===a});return b.length>0?b[0]:void 0},Jf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Kg[b]=a[b]}),nf({withLegend:!0}),Kg):Kg},Jf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Ug[b]=a[b]}),nf({withLegend:!0}),Ug):Ug},Jf.x=function(a){return arguments.length&&(sc(Jf.data.targets,a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Jf.data.xs},Jf.xs=function(a){return arguments.length&&(tc(Jf.data.targets,a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Jf.data.xs},Jf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){eb(b,a[b])}),Gb())},Jf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Bh=+a.x),b(a.y)&&(Ih=+a.y),b(a.y2)&&(Rh=+a.y2)):Ih=Rh=+a,nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Jf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Ch=+a.x),b(a.y)&&(Jh=+a.y),b(a.y2)&&(Sh=+a.y2)):Jh=Sh=+a,nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Jf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Jf.axis.max(a.max),"undefined"!=typeof a.min&&Jf.axis.min(a.min))},Jf.legend.show=function(a){Bf(Fc(a)),nf({withLegend:!0})},Jf.legend.hide=function(a){Cf(Fc(a)),nf({withLegend:!0})},Jf.resize=function(a){Mf=a?a.width:null,Nf=a?a.height:null,sf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Jf.destroy=function(){Jf.data.targets=void 0,Jf.data.xs={},xj.html(""),a.onresize=null},"url"in f.data)If.xhr(f.data.url,function(a,b){var c,d=If.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=If.csv.parse(b.response),ef(c)});else if("rows"in f.data)ef(vc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");ef(wc(f.data.columns))}return Jf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(window); \ No newline at end of file From 985975b913f490cbe840b10e54a6db8737a53b64 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Fri, 9 May 2014 09:57:13 +0900 Subject: [PATCH 148/178] Fix legend position when arc and right --- c3.js | 2 +- c3.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/c3.js b/c3.js index 375f59d..e8bbdf3 100644 --- a/c3.js +++ b/c3.js @@ -463,7 +463,7 @@ updateRadius(); if (isLegendRight && hasArcType(c3.data.targets)) { - margin3.left = width / 2 + radiusExpanded; + margin3.left = width / 2 + radiusExpanded * 1.1; } } function updateXgridFocus() { diff --git a/c3.min.js b/c3.min.js index 6d87465..2baa038 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.ceil(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.ceil(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&abg&&(bg=0),0>dg&&(dg=0),cg=oh?$f.left-jj-kj:bg,eg=oh?dg:gg-_f.top-_f.bottom,0>cg&&(cg=0),0>eg&&(eg=0),r(),ej&&ke(Jf.data.targets)&&(ag.left=bg/2+ig)}function q(){tj.select("line."+g.xgridFocus).attr("x1",oh?0:-10).attr("x2",oh?bg:-10).attr("y1",oh?-10:$f.top).attr("y2",oh?-10:dg)}function r(){ig=dg/2,hg=.95*ig,jg=je(Jf.data.targets)?.6*hg:0}function s(){var a=oh?g.axisX:g.axisY,b=tj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=If.select(Lf).node().getBoundingClientRect(),e=c.right-d.left-v();return e>0?e:0}function t(){return Mf?Mf:z()}function u(){var a=Nf?Nf:A();return a>0?a:320}function v(){return ke(Jf.data.targets)?0:Of?Of:oh?ph?x("x"):1:!Hh||Mh?1:x("y")}function w(){var a=1;return ke(Jf.data.targets)?0:Pf?Pf:ej?R()+20+(Qh&&!oh?x("y2"):a):Qh?Vh||oh?a:x("y2"):a}function x(a){var b=mb(a);return b.isInner?20+Fb(a):40+Fb(a)}function y(a){return"x"!==a||ph?"x"===a&&Eh?Eh:"y"!==a||Hh?"y2"!==a||Qh?(mb(a).isInner?30:40)+("y2"===a?-10:0):lj:ih&&!ej?10:1:0}function z(){return+If.select(Lf).style("width").replace("px","")}function A(){return+If.select(Lf).style("height").replace("px","")}function B(a){return a?-31:-($f.left-1)}function C(a){return a?-20:-4}function D(){return B(!oh)}function E(){return C(!oh)}function F(){return B(oh)}function G(){return C(oh)}function H(a){return a?bg+2+30+30:$f.left+20}function I(a){return a?(Eh?Eh:0)+80:dg+8}function J(){return H(!oh)}function K(){return I(!oh)}function L(){return H(oh)}function M(){return I(oh)}function N(){var a,b,c,d,e,f=Cc(Jf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=wg(b.x)-wg(a.x),0===c?oh?dg:bg:(d=Bc(),e=ge(Jf.data.targets)?(d-(Oi?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function O(a){fj=a}function P(a){gj=a}function Q(a){hj=a}function R(){return ih?ej?gj*(fj+1):fg:0}function S(){return ih?ej?gg:hj*(fj+1):0}function T(){var a,b,c=!wg;og=oh?1:0,pg=oh?dg:bg,qg=oh?0:dg,rg=oh?bg:1,sg=og,tg=pg,ug=oh?0:eg,vg=oh?cg:1,wg=W(og,pg,c?void 0:wg.domain(),function(){return Cg.tickOffset()}),xg=X(qg,rg,c?void 0:xg.domain()),yg=X(qg,rg,c?void 0:yg.domain()),zg=W(og,pg,yj,function(a){return a%1?0:Fg.tickOffset()}),Ag=X(ug,vg,c?void 0:Ag.domain()),Bg=X(ug,vg,c?void 0:Bg.domain()),a=bb(),b=zh?zh:c?void 0:Cg.tickValues(),Cg=$(wg,_i,a,b),Fg=$(zg,cj,a,b),Dg=_(xg,aj,Nh,Ph),Eg=_(yg,bj,Wh,Yh),c||(mj.scale(zg),Sf&&qj.scale(wg)),U()}function U(){kg=Ib(),lg=Jb(),mg=Jb(.98)}function V(a,b,c){return(c?If.time.scale():If.scale.linear()).range([a,b])}function W(a,b,c,d){var e,f=V(a,b,Ni),g=c?f.domain(c):f;Oi?(d=d||function(){return 0},f=function(a,b){var c=g(a)+d(a);return b?c:Math.ceil(c)}):f=function(a,b){var c=g(a);return b?c:Math.ceil(c)};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return yj&&yj[0]===a[0]&&yj[1]a?a.toFixed(0):a};return uh&&("function"==typeof uh?a=uh:Ni&&(a=function(a){return a?Xi(uh)(a):""})),a}function cb(a){var b;return"y"===a?b=Lh:"y2"===a?b=Uh:"x"===a&&(b=Gh),b}function db(a){var b=cb(a);return"string"==typeof b?b:b?b.text:null}function eb(a,b){var c=cb(a);"string"==typeof c?"y"===a?Lh=b:"y2"===a?Uh=b:"x"===a&&(Gh=b):c&&(c.text=b)}function fb(a){return 10*Math.sin(Math.PI*(a/180))}function gb(a){return 11.5-2.5*(a/15)}function hb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",gb(c)).attr("x",fb(c)).attr("transform","rotate("+c+")")}function ib(a,b){var c=cb(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 jb(){return ib("x",oh?"inner-top":"inner-right")}function kb(){return ib("y",oh?"inner-right":"inner-top")}function lb(){return ib("y2",oh?"inner-right":"inner-top")}function mb(a){return"y2"===a?lb():"y"===a?kb():jb()}function nb(){return db("x")}function ob(){return db("y")}function pb(){return db("y2")}function qb(a,b){return a?b.isLeft?0:b.isCenter?bg/2:bg:b.isBottom?-dg:b.isMiddle?-dg/2:0}function rb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function sb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function tb(){return qb(!oh,jb())}function ub(){return qb(oh,kb())}function vb(){return qb(oh,lb())}function wb(){return rb(!oh,jb())}function xb(){return rb(oh,kb())}function yb(){return rb(oh,lb())}function zb(){var a=jb();return oh?a.isInner?"1.2em":-25-Fb("x"):a.isInner?"-0.5em":Eh?Eh-10:"3em"}function Ab(){var a=kb();return oh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Fb("y")}function Bb(){var a=lb();return oh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Fb("y2")}function Cb(){return sb(!oh,jb())}function Db(){return sb(oh,kb())}function Eb(){return sb(oh,lb())}function Fb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return If.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Gb(a){var b=tj.select("."+g.axisX+" ."+g.axisXLabel),c=tj.select("."+g.axisY+" ."+g.axisYLabel),d=tj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",tb).attr("dx",wb).attr("dy",zb).text(nb),(a?c.transition():c).attr("x",ub).attr("dx",xb).attr("dy",Ab).attr("dy",Ab).text(ob),(a?d.transition():d).attr("x",vb).attr("dx",yb).attr("dy",Bb).text(pb)}function Hb(a){var b=!1;return ng(Kc(Jf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Ib(){var a=If.svg.arc().outerRadius(hg).innerRadius(jg),b=function(b,c){var d;return c?a(b):(d=Hb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Jb(a){var b=If.svg.arc().outerRadius(ig*(a?a:1)).innerRadius(jg);return function(a){var c=Hb(a);return c?b(c):"M 0 0"}}function Kb(a,b){return re(a.data)?kg(a,b):"M 0 0"}function Lb(a){var b,c,d,e,f=Hb(a),g="";return f&&(b=kg.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*hg*.8+","+d/e*hg*.8+")"),g}function Mb(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Nb(a){return rc({id:a.data.id,value:a.value,ratio:Mb(a)})}function Ob(a){var b,c,d,e;return Rb()?(b=Hb(a),c=b?b.value:null,d=Mb(b),e=Sb(),e?e(c,d):Fd(c,d)):""}function Pb(a,b){var c=rj.selectAll("."+g.chartArc+rd(a)),d=rj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});xe(a)&&c.selectAll("path").transition().duration(50).attr("d",lg).transition().duration(100).attr("d",mg).each(function(a){qe(a.data)}),b||d.style("opacity",.3)}function Qb(a){var b=rj.selectAll("."+g.chartArc+rd(a));b.selectAll("path").transition().duration(50).attr("d",kg),rj.selectAll("."+g.arc).style("opacity",1)}function Rb(){return je(Jf.data.targets)?si:mi}function Sb(){return je(Jf.data.targets)?ti:ni}function Tb(){return je(Jf.data.targets)?vi:""}function Ub(){var a=je(Jf.data.targets)?wi:pi;return"function"==typeof a?a:function(){}}function Vb(){var a=je(Jf.data.targets)?xi:qi;return"function"==typeof a?a:function(){}}function Wb(){var a=je(Jf.data.targets)?yi:ri;return"function"==typeof a?a:function(){}}function Xb(a){var b,c,d,e,f,g,h=Ec(a),i=Rc(a);if(Mg.length>0)for(g=Tc(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 If.min(Object.keys(i).map(function(a){return If.min(i[a])}))}function Yb(a){var b,c,d,e,f,g,h=Ec(a),i=Rc(a);if(Mg.length>0)for(g=Uc(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 If.max(Object.keys(i).map(function(a){return If.max(i[a])}))}function Zb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return ab(a.id)===c}),m="y2"===c?Sh:Jh,n="y2"===c?Rh:Ih,o=b(m)?m:Xb(l),p=b(n)?n:Yb(l),q="y2"===c?Th:Kh,r=zd()&&oh;return 0===l.length?"y2"===c?yg.domain():xg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=Ad(o,p),j=cc(xg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Oh&&(f=b(Oh.top)?Oh.top:e,g=b(Oh.bottom)?Oh.bottom:e),"y2"===c&&Xh&&(f=b(Xh.top)?Xh.top:e,g=b(Xh.bottom)?Xh.bottom:e),ge(l)&&!Tc(l)&&(g=o),[o-g,p+f])}function $b(a){return Ch?Ni?ze(Ch):Ch:If.min(a,function(a){return If.min(a.values,function(a){return a.x})})}function _b(a){return Bh?Ni?ze(Bh):Bh:If.max(a,function(a){return If.max(a.values,function(a){return a.x})})}function ac(a){var c,d,e,f,g=Dc(a),h=g[1]-g[0];return Oi?d=0:ge(a)?(c=Bc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Dh&&Ee(Dh)?(e=b(Dh.left)?Dh.left:d,f=b(Dh.right)?Dh.right:d):e=f="number"==typeof Dh?Dh:d,{left:e,right:f}}function bc(a){var b=[$b(a),_b(a)],c=b[0],d=b[1],e=ac(a),f=0,g=0;return c-d!==0||Oi||(c=Ni?new Date(.5*c.getTime()):-.5,d=Ni?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Ni?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Ni?new Date(d.getTime()+e.right):d+e.right),[f,g]}function cc(a){return a[1]-a[0]}function dc(a){for(var b=0;bb?0:b-c}function jc(a){var b,c=hc(a),d="y"===a.axis?xg:yg;return b="y"===a.axis||"y2"===a.axis?oh?dg:"start"in a?d(a.start):dg:oh?"end"in a?wg(Ni?ze(a.end):a.end):dg:dg,c>b?0:b-c}function kc(a){return Gg&&a===Gg||Ee(Hg)&&Fe(Hg,a)}function lc(a){return!kc(a)}function mc(a){return Gg?Gg:Ee(Hg)?Hg[a]:null}function nc(a,b){var c,d=b&&Ee(b)?Ec(b):[];return d.forEach(function(b){mc(b)===a&&(c=Jf.data.xs[b])}),c}function oc(a,b){return a in Jf.data.xs&&Jf.data.xs[a]&&Jf.data.xs[a][b]?Jf.data.xs[a][b]:b}function pc(a){Object.keys(a).forEach(function(b){Hg[b]=a[b]})}function qc(a){return 1===If.set(Object.keys(a).map(function(b){return a[b]})).size()}function rc(a){var b;return a&&(b=Kg[a.id],a.name=b?b:a.id),a}function sc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=uc(b[d],a.id,d)}),Jf.data.xs[a.id]=b})}function tc(a,b){a.forEach(function(a){b[a.id]&&sc([a],b[a.id])})}function uc(a,c,d){var e;return e=Ni?a?a instanceof Date?a:ze(a):ze(oc(c,d)):Pi&&!Oi?b(a)?+a:oc(c,d):d}function vc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Jf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Gg?(d=Object.keys(Jf.data.xs),Jf.data.xs[c]=d.length>0?Jf.data.xs[d[0]]:void 0):Ee(Hg)&&(Jf.data.xs[c]=nc(f,Jf.data.targets)):Jf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Jf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Jg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=mc(b),g=a[f],h=uc(g,b,e);return Pi&&Oi&&0===c&&g&&(0===e&&(sh=[]),sh.push(g)),("undefined"==typeof a[b]||Jf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Og&&ee(Ec(c).filter(function(a){return!(a in Pg)}),Og),c.forEach(function(a){ec(a.id_org,a)}),c}function yc(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 zc(a){return a>0&&Jf.data.targets[0].values[a-1]?Jf.data.targets[0].values[a-1].x:void 0}function Ac(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Dc(a){var b,c,d=Cc(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Ec(a){return a.map(function(a){return a.id})}function Fc(a){return a?"string"==typeof a?[a]:a:Ec(Jf.data.targets)}function Gc(a,b){var c,d=Ec(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Ni?new Date(i):i);j.push(e)}return Ni||(j=j.sort(function(a,b){return a-b})),j}function Nc(a){Zi=Zi.concat(a)}function Oc(a){Zi=Zi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){$i=$i.concat(a)}function Qc(a){$i=$i.filter(function(b){return a.indexOf(b)<0})}function Rc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Sc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Uc(a){return Sc(a,function(a){return a>0})}function Vc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],(a[f].x||0===a[f].x)&&(e=e.concat(Ld(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Ld(a,g))),Od(e,b)):Md(a,b,f,g)}function Nd(a,b){var c;return c=a.map(function(a){return Md(a.values,b)}),Od(c,b)}function Od(a,b){var c,d;return a.forEach(function(a){var e=Ge(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Pd(a,b){return If.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Qd(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 Rd(){return Rg&&"desc"===Rg.toLowerCase()}function Sd(){return Rg&&"asc"===Rg.toLowerCase()}function Td(a){var b=Sd(),c=Rd();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof Rg&&a.sort(Rg),a}function Ud(a,c){var d,e,f,g,h,i,j,k=ke(Jf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&Ai&&(wj.html(Di(a,bb(),Bd(k),Wi)).style("display","block"),d=wj.property("offsetWidth"),e=wj.property("offsetHeight"),k?(g=bg/2+c[0],i=dg/2+c[1]+20):(oh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-w(),i=wg(l[0].x)+20):(f=s(),g=f+v()+wg(l[0].x)+20,h=g+d,j=f+t()-w(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),wj.style("top",i+"px").style("left",g+"px"))}function Vd(){wj.style("display","none")}function Wd(a){var c=a.filter(function(a){return a&&b(a.value)});if(Ai&&!he(Jf.data.targets)&&!ke(Jf.data.targets)){var d=tj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(oh?"y1":"x1",Hd).attr(oh?"y2":"x2",Hd),mf(d,"grid")}}function Xd(){tj.select("line."+g.xgridFocus).style("visibility","hidden")}function Yd(a,b){var c,d,e,f,h=[],i=tj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=bc(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function Zd(a){return a.x||0===a.x?wg(a.x):null}function $d(a){return Y(a.id)(a.value)}function _d(){var a,b,d={},e=0;return Kc(Hc(ne)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function de(a,b){return"number"==typeof ki?ki:b?2*a.tickOffset()*li/b:0}function ee(a,b){Fc(a).forEach(function(a){Aj[a]=b===Pg[a],Pg[a]=b})}function fe(a,b){var c=!1;return a.forEach(function(a){Pg[a.id]===b&&(c=!0),a.id in Pg||"line"!==b||(c=!0)}),c}function ge(a){return fe(a,"bar")}function he(a){return fe(a,"scatter")}function ie(a){return fe(a,"pie")}function je(a){return fe(a,"donut")}function ke(a){return ie(a)||je(a)}function le(a){var b="string"==typeof a?a:a.id;return!(b in Pg)||"line"===Pg[b]||"spline"===Pg[b]||"area"===Pg[b]||"area-spline"===Pg[b]}function me(a){var b="string"==typeof a?a:a.id;return"spline"===Pg[b]||"area-spline"===Pg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"bar"===Pg[b]}function oe(a){var b="string"==typeof a?a:a.id;return"scatter"===Pg[b]}function pe(a){var b="string"==typeof a?a:a.id;return"pie"===Pg[b]}function qe(a){var b="string"==typeof a?a:a.id;return"donut"===Pg[b]}function re(a){return pe(a)||qe(a)}function se(a){return le(a)?[a]:[]}function te(a){return re(a.data)?[a]:[]}function ue(a){return ne(a)?a.values:[]}function ve(a){return le(a)||oe(a)?a.values:[]}function we(a){return ne(a)||le(a)?a.values:[]}function xe(a){return qe(a)&&ui||pe(a)&&oi}function ye(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ze(b){var c;try{c=Ig?If.time.format(Ig).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Ig)}return c}function Ae(a,b){var c=If.mouse(a),d=If.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Fe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Ge(a,b){var c="y"===ab(a.id)?xg:yg,d=oh?1:0,e=oh?0:1;return Math.pow(wg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function He(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ie(a,b,c){bh(b,a.node()),tj.select("."+g.selectedCircles+qd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Wc(g.selectedCircle,c)}).attr("cx",oh?$d:Zd).attr("cy",oh?Zd:$d).attr("stroke",function(){return Wi(b)}).attr("r",1.4*Te(b)).transition().duration(100).attr("r",Te)}function Je(a,b,c){ch(b,a.node()),tj.select("."+g.selectedCircles+qd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ke(a,b,c,d){a?Ie(b,c,d):Je(b,c,d)}function Le(a,b){bh(b,a.node()),a.transition().duration(100).style("fill",function(){return If.rgb(Wi(b)).brighter(.75)})}function Me(a,b){ch(b,a.node()),a.transition().duration(100).style("fill",function(){return Wi(b)})}function Ne(a,b,c,d){a?Le(b,c,d):Me(b,c,d)}function Oe(a,b,c,d){Ne(a,b,c.data,d)}function Pe(a){return"circle"===a.nodeName?Ke:If.select(a).classed(g.bar)?Ne:Oe}function Qe(a){return a.filter(function(a){return b(a.value)})}function Re(a){return di?"function"==typeof ei?ei(a):ei:0}function Se(a){return gi?hi?hi:1.75*Re(a):Re(a)}function Te(a){return ii?ii:4*Re(a)}function Ue(a,c){return(c?tj.selectAll("."+g.circles+qd(c)):tj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ve(a,b){Ue(a,b).classed(g.EXPANDED,!0).attr("r",Se)}function We(a){Ue(a).filter(function(){return If.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Re)}function Xe(a){return tj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function Ye(a){Xe(a).classed(g.EXPANDED,!0)}function Ze(a){Xe(a).classed(g.EXPANDED,!1)}function $e(a,b){var c=cf(a,b);return function(a,b){var d=c(a,b),e=oh?1:0,f=oh?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 _e(a,b){var c=cf(a,!1),d=b?af:bf;return function(a,b){return d(c(a,b),a,this)}}function af(a,b){var c;return oh?(c=ne(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function bf(a,b,c){var d=c.getBoundingClientRect();return oh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ne(b)?-3:-6)}function cf(a,b){var c=a.__max__+1,d=de(Cg,c),e=ae(d,c,a,!!b),f=be(!!b),g=ce(a,!!b),h=b?Z:Y;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return oh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function df(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;gb?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&abg&&(bg=0),0>dg&&(dg=0),cg=oh?$f.left-jj-kj:bg,eg=oh?dg:gg-_f.top-_f.bottom,0>cg&&(cg=0),0>eg&&(eg=0),r(),ej&&ke(Jf.data.targets)&&(ag.left=bg/2+1.1*ig)}function q(){tj.select("line."+g.xgridFocus).attr("x1",oh?0:-10).attr("x2",oh?bg:-10).attr("y1",oh?-10:$f.top).attr("y2",oh?-10:dg)}function r(){ig=dg/2,hg=.95*ig,jg=je(Jf.data.targets)?.6*hg:0}function s(){var a=oh?g.axisX:g.axisY,b=tj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=If.select(Lf).node().getBoundingClientRect(),e=c.right-d.left-v();return e>0?e:0}function t(){return Mf?Mf:z()}function u(){var a=Nf?Nf:A();return a>0?a:320}function v(){return ke(Jf.data.targets)?0:Of?Of:oh?ph?x("x"):1:!Hh||Mh?1:x("y")}function w(){var a=1;return ke(Jf.data.targets)?0:Pf?Pf:ej?R()+20+(Qh&&!oh?x("y2"):a):Qh?Vh||oh?a:x("y2"):a}function x(a){var b=mb(a);return b.isInner?20+Fb(a):40+Fb(a)}function y(a){return"x"!==a||ph?"x"===a&&Eh?Eh:"y"!==a||Hh?"y2"!==a||Qh?(mb(a).isInner?30:40)+("y2"===a?-10:0):lj:ih&&!ej?10:1:0}function z(){return+If.select(Lf).style("width").replace("px","")}function A(){return+If.select(Lf).style("height").replace("px","")}function B(a){return a?-31:-($f.left-1)}function C(a){return a?-20:-4}function D(){return B(!oh)}function E(){return C(!oh)}function F(){return B(oh)}function G(){return C(oh)}function H(a){return a?bg+2+30+30:$f.left+20}function I(a){return a?(Eh?Eh:0)+80:dg+8}function J(){return H(!oh)}function K(){return I(!oh)}function L(){return H(oh)}function M(){return I(oh)}function N(){var a,b,c,d,e,f=Cc(Jf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=wg(b.x)-wg(a.x),0===c?oh?dg:bg:(d=Bc(),e=ge(Jf.data.targets)?(d-(Oi?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function O(a){fj=a}function P(a){gj=a}function Q(a){hj=a}function R(){return ih?ej?gj*(fj+1):fg:0}function S(){return ih?ej?gg:hj*(fj+1):0}function T(){var a,b,c=!wg;og=oh?1:0,pg=oh?dg:bg,qg=oh?0:dg,rg=oh?bg:1,sg=og,tg=pg,ug=oh?0:eg,vg=oh?cg:1,wg=W(og,pg,c?void 0:wg.domain(),function(){return Cg.tickOffset()}),xg=X(qg,rg,c?void 0:xg.domain()),yg=X(qg,rg,c?void 0:yg.domain()),zg=W(og,pg,yj,function(a){return a%1?0:Fg.tickOffset()}),Ag=X(ug,vg,c?void 0:Ag.domain()),Bg=X(ug,vg,c?void 0:Bg.domain()),a=bb(),b=zh?zh:c?void 0:Cg.tickValues(),Cg=$(wg,_i,a,b),Fg=$(zg,cj,a,b),Dg=_(xg,aj,Nh,Ph),Eg=_(yg,bj,Wh,Yh),c||(mj.scale(zg),Sf&&qj.scale(wg)),U()}function U(){kg=Ib(),lg=Jb(),mg=Jb(.98)}function V(a,b,c){return(c?If.time.scale():If.scale.linear()).range([a,b])}function W(a,b,c,d){var e,f=V(a,b,Ni),g=c?f.domain(c):f;Oi?(d=d||function(){return 0},f=function(a,b){var c=g(a)+d(a);return b?c:Math.ceil(c)}):f=function(a,b){var c=g(a);return b?c:Math.ceil(c)};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return yj&&yj[0]===a[0]&&yj[1]a?a.toFixed(0):a};return uh&&("function"==typeof uh?a=uh:Ni&&(a=function(a){return a?Xi(uh)(a):""})),a}function cb(a){var b;return"y"===a?b=Lh:"y2"===a?b=Uh:"x"===a&&(b=Gh),b}function db(a){var b=cb(a);return"string"==typeof b?b:b?b.text:null}function eb(a,b){var c=cb(a);"string"==typeof c?"y"===a?Lh=b:"y2"===a?Uh=b:"x"===a&&(Gh=b):c&&(c.text=b)}function fb(a){return 10*Math.sin(Math.PI*(a/180))}function gb(a){return 11.5-2.5*(a/15)}function hb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",gb(c)).attr("x",fb(c)).attr("transform","rotate("+c+")")}function ib(a,b){var c=cb(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 jb(){return ib("x",oh?"inner-top":"inner-right")}function kb(){return ib("y",oh?"inner-right":"inner-top")}function lb(){return ib("y2",oh?"inner-right":"inner-top")}function mb(a){return"y2"===a?lb():"y"===a?kb():jb()}function nb(){return db("x")}function ob(){return db("y")}function pb(){return db("y2")}function qb(a,b){return a?b.isLeft?0:b.isCenter?bg/2:bg:b.isBottom?-dg:b.isMiddle?-dg/2:0}function rb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function sb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function tb(){return qb(!oh,jb())}function ub(){return qb(oh,kb())}function vb(){return qb(oh,lb())}function wb(){return rb(!oh,jb())}function xb(){return rb(oh,kb())}function yb(){return rb(oh,lb())}function zb(){var a=jb();return oh?a.isInner?"1.2em":-25-Fb("x"):a.isInner?"-0.5em":Eh?Eh-10:"3em"}function Ab(){var a=kb();return oh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Fb("y")}function Bb(){var a=lb();return oh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Fb("y2")}function Cb(){return sb(!oh,jb())}function Db(){return sb(oh,kb())}function Eb(){return sb(oh,lb())}function Fb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return If.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Gb(a){var b=tj.select("."+g.axisX+" ."+g.axisXLabel),c=tj.select("."+g.axisY+" ."+g.axisYLabel),d=tj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",tb).attr("dx",wb).attr("dy",zb).text(nb),(a?c.transition():c).attr("x",ub).attr("dx",xb).attr("dy",Ab).attr("dy",Ab).text(ob),(a?d.transition():d).attr("x",vb).attr("dx",yb).attr("dy",Bb).text(pb)}function Hb(a){var b=!1;return ng(Kc(Jf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Ib(){var a=If.svg.arc().outerRadius(hg).innerRadius(jg),b=function(b,c){var d;return c?a(b):(d=Hb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Jb(a){var b=If.svg.arc().outerRadius(ig*(a?a:1)).innerRadius(jg);return function(a){var c=Hb(a);return c?b(c):"M 0 0"}}function Kb(a,b){return re(a.data)?kg(a,b):"M 0 0"}function Lb(a){var b,c,d,e,f=Hb(a),g="";return f&&(b=kg.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*hg*.8+","+d/e*hg*.8+")"),g}function Mb(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Nb(a){return rc({id:a.data.id,value:a.value,ratio:Mb(a)})}function Ob(a){var b,c,d,e;return Rb()?(b=Hb(a),c=b?b.value:null,d=Mb(b),e=Sb(),e?e(c,d):Fd(c,d)):""}function Pb(a,b){var c=rj.selectAll("."+g.chartArc+rd(a)),d=rj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});xe(a)&&c.selectAll("path").transition().duration(50).attr("d",lg).transition().duration(100).attr("d",mg).each(function(a){qe(a.data)}),b||d.style("opacity",.3)}function Qb(a){var b=rj.selectAll("."+g.chartArc+rd(a));b.selectAll("path").transition().duration(50).attr("d",kg),rj.selectAll("."+g.arc).style("opacity",1)}function Rb(){return je(Jf.data.targets)?si:mi}function Sb(){return je(Jf.data.targets)?ti:ni}function Tb(){return je(Jf.data.targets)?vi:""}function Ub(){var a=je(Jf.data.targets)?wi:pi;return"function"==typeof a?a:function(){}}function Vb(){var a=je(Jf.data.targets)?xi:qi;return"function"==typeof a?a:function(){}}function Wb(){var a=je(Jf.data.targets)?yi:ri;return"function"==typeof a?a:function(){}}function Xb(a){var b,c,d,e,f,g,h=Ec(a),i=Rc(a);if(Mg.length>0)for(g=Tc(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 If.min(Object.keys(i).map(function(a){return If.min(i[a])}))}function Yb(a){var b,c,d,e,f,g,h=Ec(a),i=Rc(a);if(Mg.length>0)for(g=Uc(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 If.max(Object.keys(i).map(function(a){return If.max(i[a])}))}function Zb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return ab(a.id)===c}),m="y2"===c?Sh:Jh,n="y2"===c?Rh:Ih,o=b(m)?m:Xb(l),p=b(n)?n:Yb(l),q="y2"===c?Th:Kh,r=zd()&&oh;return 0===l.length?"y2"===c?yg.domain():xg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=Ad(o,p),j=cc(xg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Oh&&(f=b(Oh.top)?Oh.top:e,g=b(Oh.bottom)?Oh.bottom:e),"y2"===c&&Xh&&(f=b(Xh.top)?Xh.top:e,g=b(Xh.bottom)?Xh.bottom:e),ge(l)&&!Tc(l)&&(g=o),[o-g,p+f])}function $b(a){return Ch?Ni?ze(Ch):Ch:If.min(a,function(a){return If.min(a.values,function(a){return a.x})})}function _b(a){return Bh?Ni?ze(Bh):Bh:If.max(a,function(a){return If.max(a.values,function(a){return a.x})})}function ac(a){var c,d,e,f,g=Dc(a),h=g[1]-g[0];return Oi?d=0:ge(a)?(c=Bc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Dh&&Ee(Dh)?(e=b(Dh.left)?Dh.left:d,f=b(Dh.right)?Dh.right:d):e=f="number"==typeof Dh?Dh:d,{left:e,right:f}}function bc(a){var b=[$b(a),_b(a)],c=b[0],d=b[1],e=ac(a),f=0,g=0;return c-d!==0||Oi||(c=Ni?new Date(.5*c.getTime()):-.5,d=Ni?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Ni?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Ni?new Date(d.getTime()+e.right):d+e.right),[f,g]}function cc(a){return a[1]-a[0]}function dc(a){for(var b=0;bb?0:b-c}function jc(a){var b,c=hc(a),d="y"===a.axis?xg:yg;return b="y"===a.axis||"y2"===a.axis?oh?dg:"start"in a?d(a.start):dg:oh?"end"in a?wg(Ni?ze(a.end):a.end):dg:dg,c>b?0:b-c}function kc(a){return Gg&&a===Gg||Ee(Hg)&&Fe(Hg,a)}function lc(a){return!kc(a)}function mc(a){return Gg?Gg:Ee(Hg)?Hg[a]:null}function nc(a,b){var c,d=b&&Ee(b)?Ec(b):[];return d.forEach(function(b){mc(b)===a&&(c=Jf.data.xs[b])}),c}function oc(a,b){return a in Jf.data.xs&&Jf.data.xs[a]&&Jf.data.xs[a][b]?Jf.data.xs[a][b]:b}function pc(a){Object.keys(a).forEach(function(b){Hg[b]=a[b]})}function qc(a){return 1===If.set(Object.keys(a).map(function(b){return a[b]})).size()}function rc(a){var b;return a&&(b=Kg[a.id],a.name=b?b:a.id),a}function sc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=uc(b[d],a.id,d)}),Jf.data.xs[a.id]=b})}function tc(a,b){a.forEach(function(a){b[a.id]&&sc([a],b[a.id])})}function uc(a,c,d){var e;return e=Ni?a?a instanceof Date?a:ze(a):ze(oc(c,d)):Pi&&!Oi?b(a)?+a:oc(c,d):d}function vc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Jf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Gg?(d=Object.keys(Jf.data.xs),Jf.data.xs[c]=d.length>0?Jf.data.xs[d[0]]:void 0):Ee(Hg)&&(Jf.data.xs[c]=nc(f,Jf.data.targets)):Jf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Jf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Jg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=mc(b),g=a[f],h=uc(g,b,e);return Pi&&Oi&&0===c&&g&&(0===e&&(sh=[]),sh.push(g)),("undefined"==typeof a[b]||Jf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Og&&ee(Ec(c).filter(function(a){return!(a in Pg)}),Og),c.forEach(function(a){ec(a.id_org,a)}),c}function yc(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 zc(a){return a>0&&Jf.data.targets[0].values[a-1]?Jf.data.targets[0].values[a-1].x:void 0}function Ac(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Dc(a){var b,c,d=Cc(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Ec(a){return a.map(function(a){return a.id})}function Fc(a){return a?"string"==typeof a?[a]:a:Ec(Jf.data.targets)}function Gc(a,b){var c,d=Ec(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Ni?new Date(i):i);j.push(e)}return Ni||(j=j.sort(function(a,b){return a-b})),j}function Nc(a){Zi=Zi.concat(a)}function Oc(a){Zi=Zi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){$i=$i.concat(a)}function Qc(a){$i=$i.filter(function(b){return a.indexOf(b)<0})}function Rc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Sc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Uc(a){return Sc(a,function(a){return a>0})}function Vc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],(a[f].x||0===a[f].x)&&(e=e.concat(Ld(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Ld(a,g))),Od(e,b)):Md(a,b,f,g)}function Nd(a,b){var c;return c=a.map(function(a){return Md(a.values,b)}),Od(c,b)}function Od(a,b){var c,d;return a.forEach(function(a){var e=Ge(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Pd(a,b){return If.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Qd(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 Rd(){return Rg&&"desc"===Rg.toLowerCase()}function Sd(){return Rg&&"asc"===Rg.toLowerCase()}function Td(a){var b=Sd(),c=Rd();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof Rg&&a.sort(Rg),a}function Ud(a,c){var d,e,f,g,h,i,j,k=ke(Jf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&Ai&&(wj.html(Di(a,bb(),Bd(k),Wi)).style("display","block"),d=wj.property("offsetWidth"),e=wj.property("offsetHeight"),k?(g=bg/2+c[0],i=dg/2+c[1]+20):(oh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-w(),i=wg(l[0].x)+20):(f=s(),g=f+v()+wg(l[0].x)+20,h=g+d,j=f+t()-w(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),wj.style("top",i+"px").style("left",g+"px"))}function Vd(){wj.style("display","none")}function Wd(a){var c=a.filter(function(a){return a&&b(a.value)});if(Ai&&!he(Jf.data.targets)&&!ke(Jf.data.targets)){var d=tj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(oh?"y1":"x1",Hd).attr(oh?"y2":"x2",Hd),mf(d,"grid")}}function Xd(){tj.select("line."+g.xgridFocus).style("visibility","hidden")}function Yd(a,b){var c,d,e,f,h=[],i=tj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=bc(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function Zd(a){return a.x||0===a.x?wg(a.x):null}function $d(a){return Y(a.id)(a.value)}function _d(){var a,b,d={},e=0;return Kc(Hc(ne)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function de(a,b){return"number"==typeof ki?ki:b?2*a.tickOffset()*li/b:0}function ee(a,b){Fc(a).forEach(function(a){Aj[a]=b===Pg[a],Pg[a]=b})}function fe(a,b){var c=!1;return a.forEach(function(a){Pg[a.id]===b&&(c=!0),a.id in Pg||"line"!==b||(c=!0)}),c}function ge(a){return fe(a,"bar")}function he(a){return fe(a,"scatter")}function ie(a){return fe(a,"pie")}function je(a){return fe(a,"donut")}function ke(a){return ie(a)||je(a)}function le(a){var b="string"==typeof a?a:a.id;return!(b in Pg)||"line"===Pg[b]||"spline"===Pg[b]||"area"===Pg[b]||"area-spline"===Pg[b]}function me(a){var b="string"==typeof a?a:a.id;return"spline"===Pg[b]||"area-spline"===Pg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"bar"===Pg[b]}function oe(a){var b="string"==typeof a?a:a.id;return"scatter"===Pg[b]}function pe(a){var b="string"==typeof a?a:a.id;return"pie"===Pg[b]}function qe(a){var b="string"==typeof a?a:a.id;return"donut"===Pg[b]}function re(a){return pe(a)||qe(a)}function se(a){return le(a)?[a]:[]}function te(a){return re(a.data)?[a]:[]}function ue(a){return ne(a)?a.values:[]}function ve(a){return le(a)||oe(a)?a.values:[]}function we(a){return ne(a)||le(a)?a.values:[]}function xe(a){return qe(a)&&ui||pe(a)&&oi}function ye(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ze(b){var c;try{c=Ig?If.time.format(Ig).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Ig)}return c}function Ae(a,b){var c=If.mouse(a),d=If.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Fe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Ge(a,b){var c="y"===ab(a.id)?xg:yg,d=oh?1:0,e=oh?0:1;return Math.pow(wg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function He(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ie(a,b,c){bh(b,a.node()),tj.select("."+g.selectedCircles+qd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Wc(g.selectedCircle,c)}).attr("cx",oh?$d:Zd).attr("cy",oh?Zd:$d).attr("stroke",function(){return Wi(b)}).attr("r",1.4*Te(b)).transition().duration(100).attr("r",Te)}function Je(a,b,c){ch(b,a.node()),tj.select("."+g.selectedCircles+qd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ke(a,b,c,d){a?Ie(b,c,d):Je(b,c,d)}function Le(a,b){bh(b,a.node()),a.transition().duration(100).style("fill",function(){return If.rgb(Wi(b)).brighter(.75)})}function Me(a,b){ch(b,a.node()),a.transition().duration(100).style("fill",function(){return Wi(b)})}function Ne(a,b,c,d){a?Le(b,c,d):Me(b,c,d)}function Oe(a,b,c,d){Ne(a,b,c.data,d)}function Pe(a){return"circle"===a.nodeName?Ke:If.select(a).classed(g.bar)?Ne:Oe}function Qe(a){return a.filter(function(a){return b(a.value)})}function Re(a){return di?"function"==typeof ei?ei(a):ei:0}function Se(a){return gi?hi?hi:1.75*Re(a):Re(a)}function Te(a){return ii?ii:4*Re(a)}function Ue(a,c){return(c?tj.selectAll("."+g.circles+qd(c)):tj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ve(a,b){Ue(a,b).classed(g.EXPANDED,!0).attr("r",Se)}function We(a){Ue(a).filter(function(){return If.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Re)}function Xe(a){return tj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function Ye(a){Xe(a).classed(g.EXPANDED,!0)}function Ze(a){Xe(a).classed(g.EXPANDED,!1)}function $e(a,b){var c=cf(a,b);return function(a,b){var d=c(a,b),e=oh?1:0,f=oh?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 _e(a,b){var c=cf(a,!1),d=b?af:bf;return function(a,b){return d(c(a,b),a,this)}}function af(a,b){var c;return oh?(c=ne(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function bf(a,b,c){var d=c.getBoundingClientRect();return oh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ne(b)?-3:-6)}function cf(a,b){var c=a.__max__+1,d=de(Cg,c),e=ae(d,c,a,!!b),f=be(!!b),g=ce(a,!!b),h=b?Z:Y;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return oh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function df(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function ef(b){var c,d,e;if(xj=If.select(Lf),xj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(xj.html("").classed("c3",!0),Jf.data.xs={},Jf.data.targets=xc(b),Vg&&Nc(Vg===!0?Ec(Jf.data.targets):Vg),p(),T(),wg.domain(If.extent(bc(Jf.data.targets))),xg.domain(Zb(Jf.data.targets,"y")),yg.domain(Zb(Jf.data.targets,"y2")),zg.domain(wg.domain()),Ag.domain(xg.domain()),Bg.domain(yg.domain()),yj=wg.domain(),mj.scale(zg),Sf&&qj.scale(wg),rj=xj.append("svg").on("mouseenter",Vf).on("mouseleave",Wf),sj=rj.append("defs"),sj.append("clipPath").attr("id",Hi).append("rect"),sj.append("clipPath").attr("id",Ii).append("rect"),sj.append("clipPath").attr("id",Ji).append("rect"),rf(),tj=rj.append("g").attr("transform",dj.main),uj=rj.append("g").attr("transform",dj.context),vj=rj.append("g").attr("transform",dj.legend),fh||uj.style("visibility","hidden"),ih||(vj.style("visibility","hidden"),$i=Ec(Jf.data.targets)),wj=If.select(Lf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Df(Ec(Jf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=tj.append("g").attr("clip-path",Ki).attr("class",g.grid),Zh&&d.append("g").attr("class",g.xgrids),Ee(_h)&&d.append("g").attr("class",g.xgridLines),fi&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),ai&&d.append("g").attr("class",g.ygrids),Ee(bi)&&d.append("g").attr("class",g.ygridLines),tj.append("g").attr("clip-path",Ki).attr("class",g.regions),tj.append("g").attr("clip-path",Ki).attr("class",g.chart),c=tj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Sf?oh?"ns-resize":"ew-resize":null),tj.select("."+g.chart).append("g").attr("class",g.chartBars),tj.select("."+g.chart).append("g").attr("class",g.chartLines),tj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",dj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Tb()),tj.select("."+g.chart).append("g").attr("class",g.chartTexts),Sf&&tj.insert("rect",Uf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",bg).attr("height",dg).style("opacity",0).style("cursor",oh?"ns-resize":"ew-resize").call(qj).on("dblclick.zoom",null),Fh&&mj.extent("function"!=typeof Fh?Fh:Fh(bc())),ph&&tj.append("g").attr("class",g.axisX).attr("clip-path",Li).attr("transform",dj.x).append("text").attr("class",g.axisXLabel).attr("transform",oh?"rotate(-90)":"").style("text-anchor",Cb),Hh&&tj.append("g").attr("class",g.axisY).attr("clip-path",Mi).attr("transform",dj.y).append("text").attr("class",g.axisYLabel).attr("transform",oh?"":"rotate(-90)").style("text-anchor",Db),Qh&&tj.append("g").attr("class",g.axisY2).attr("transform",dj.y2).append("text").attr("class",g.axisY2Label).attr("transform",oh?"":"rotate(-90)").style("text-anchor",Eb),uj.append("g").attr("clip-path",Ki).attr("class",g.chart),uj.select("."+g.chart).append("g").attr("class",g.chartBars),uj.select("."+g.chart).append("g").attr("class",g.chartLines),uj.append("g").attr("clip-path",Ki).attr("class",g.brush).call(mj).selectAll("rect").attr(oh?"width":"height",oh?cg:eg),uj.append("g").attr("class",g.axisX).attr("transform",dj.subx).attr("clip-path",oh?"":Li),tf(Jf.data.targets),oh?tj.select("."+g.axisX).style("opacity",0).call(Cg):(tj.select("."+g.axisY).style("opacity",0).call(Dg),tj.select("."+g.axisY2).style("opacity",0).call(Eg)),p(),T(),rf(),o(!1),nf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Ei){if(Ni&&"string"==typeof Fi){for(Fi=ze(Fi),e=0;e0){d=[];for(var f in Kg)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Qd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ne,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function kf(a){ke(Jf.data.targets)||Wg&&(Qi=a,tj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Ri=!0,dh())}function lf(){ke(Jf.data.targets)||Wg&&(tj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),tj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Ri=!1,eh())}function mf(a,b){"grid"===b&&a.each(function(){var a=If.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function nf(a){var c,e,f,h,i,j,k,l,m,n,o,p,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,O,P,Q,R,S,T,U,V,W,X,Y,Z,$,_=_d(),ab=ke(Jf.data.targets),bb=Kc(Jf.data.targets);if(a=d(a)?a:{},G=d(a.withY)?a.withY:!0,H=d(a.withSubchart)?a.withSubchart:!0,I=d(a.withTransition)?a.withTransition:!0,L=d(a.withTransform)?a.withTransform:!1,M=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,O=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,P=d(a.withLegend)?a.withLegend:!1,J=d(a.withTransitionForExit)?a.withTransitionForExit:I,K=d(a.withTransitionForAxis)?a.withTransitionForAxis:I,V=I?Zf:0,W=J?V:0,X=K?V:0,c=tj.select("."+g.axisX).style("opacity",ab?0:1),f=tj.select("."+g.axisY).style("opacity",ab?0:1),h=tj.select("."+g.axisY2).style("opacity",ab?0:1),e=uj.select("."+g.axisX).style("opacity",ab?0:1),U={axisX:c.transition().duration(X),axisY:f.transition().duration(X),axisY2:h.transition().duration(X),axisSubX:e.transition().duration(X)},P&&ih&&Df(Ec(Jf.data.targets),a,U),Oi&&0===bb.length&&wg.domain([0,c.selectAll(".tick").size()]),bb.length&&(O&&(wg.domain(If.extent(bc(bb))),yj=wg.domain(),Sf&&qj.scale(wg).updateScaleExtent(),zg.domain(wg.domain()),mj.scale(zg)),M&&(wg.domain(mj.empty()?yj:mj.extent()),Sf&&qj.scale(wg).updateScaleExtent()),zh||!yh&&!xh||(Y=Mc(Lc(bb),xh),Cg.tickValues(Y),Fg.tickValues(Y))),xg.domain(Zb(bb,"y")),yg.domain(Zb(bb,"y2")),U.axisX.call(Cg),U.axisY.call(Dg),U.axisY2.call(Eg),U.axisSubX.call(Fg),Gb(I),M&&bb.length)if(vh&&Y){for(Z=1;Z=0&&If.select(this).style("display",b%$?"none":"block")})}else rj.selectAll("."+g.axisX+" .tick text").style("display","block");!oh&&Ah&&hb(c,U.axisX,Ah),Q=$e(_),S=_e(_,!0),T=_e(_,!1),Ag.domain(xg.domain()),Bg.domain(yg.domain()),wj.style("display","none"),q(),tj.select("line."+g.xgridFocus).style("visibility","hidden"),Zh&&(k=Yd($h,wg),D=Oi?Cg.tickOffset():0,j=oh?{x1:0,x2:bg,y1:function(a){return wg(a)-D},y2:function(a){return wg(a)-D}}:{x1:function(a){return wg(a)+D},x2:function(a){return wg(a)+D},y1:$f.top,y2:dg},i=tj.select("."+g.xgrids).selectAll("."+g.xgrid).data(k),i.enter().append("line").attr("class",g.xgrid),i.attr(j).style("opacity",function(){return+If.select(this).attr(oh?"y1":"x1")===(oh?dg:0)?0:1}),i.exit().remove()),Ee(_h)&&(l=tj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(_h),m=l.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",oh?"":"rotate(-90)").attr("dx",oh?0:-$f.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(V).attr("x1",oh?0:Id).attr("x2",oh?bg:Id).attr("y1",oh?Id:$f.top).attr("y2",oh?Id:dg).style("opacity",1),l.select("text").transition().duration(V).attr("x",oh?bg:0).attr("y",Id).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(V).style("opacity",0).remove()),G&&ai&&(n=tj.select("."+g.ygrids).selectAll("."+g.ygrid).data(xg.ticks(ci)),n.enter().append("line").attr("class",g.ygrid),n.attr("x1",oh?xg:0).attr("x2",oh?xg:bg).attr("y1",oh?0:xg).attr("y2",oh?dg:xg),n.exit().remove(),mf(n,"grid")),G&&Ee(bi)&&(o=tj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(bi),p=o.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",oh?"rotate(-90)":"").attr("dx",oh?0:-$f.top).attr("dy",-5).style("opacity",0),o.select("line").transition().duration(V).attr("x1",oh?Jd:0).attr("x2",oh?Jd:bg).attr("y1",oh?0:Jd).attr("y2",oh?dg:Jd).style("opacity",1),o.select("text").transition().duration(V).attr("x",oh?0:bg).attr("y",Jd).text(function(a){return a.text}).style("opacity",1),o.exit().transition().duration(V).style("opacity",0).remove()),w=tj.select("."+g.regions).selectAll("."+g.region).data(zi),w.enter().append("g").attr("class",jd).append("rect").style("fill-opacity",0),w.selectAll("rect").transition().duration(V).attr("x",gc).attr("y",hc).attr("width",ic).attr("height",jc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),w.exit().transition().duration(V).style("fill-opacity",0).remove(),u=tj.selectAll("."+g.bars).selectAll("."+g.bar).data(ue),u.enter().append("path").attr("class",dd).style("stroke","none").style("fill",Wi),u.style("opacity",vd).transition().duration(V).attr("d",Q).style("fill",Wi).style("opacity",1),u.exit().transition().duration(W).style("opacity",0).remove(),r=tj.selectAll("."+g.lines).selectAll("."+g.line).data(se),r.enter().append("path").attr("class",_c).style("stroke",Wi),r.style("opacity",vd).transition().duration(V).attr("d",nj).style("stroke",Wi).style("opacity",1),r.exit().transition().duration(W).style("opacity",0).remove(),s=tj.selectAll("."+g.areas).selectAll("."+g.area).data(se),s.enter().append("path").attr("class",hd).style("fill",Wi).style("opacity",function(){return zj=+If.select(this).style("opacity"),0}),s.style("opacity",0).transition().duration(V).attr("d",oj).style("fill",Wi).style("opacity",zj),s.exit().transition().duration(W).style("opacity",0).remove(),t=tj.selectAll("."+g.circles).selectAll("."+g.circle).data(ve),t.enter().append("circle").attr("class",bd).attr("r",Re).style("fill",Wi),t.style("opacity",vd).transition().duration(V).style("opacity",xd).style("fill",Wi).attr("cx",oh?$d:Zd).attr("cy",oh?Zd:$d),t.exit().remove(),x=tj.selectAll("."+g.texts).selectAll("."+g.text).data(we),x.enter().append("text").attr("class",Xc).attr("text-anchor",function(a){return oh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",Wi).style("fill-opacity",0),x.text(function(a){return Gd(a.id)(a.value,a.id)}).style("fill-opacity",wd).transition().duration(V).attr("x",S).attr("y",T).style("fill",Wi).style("fill-opacity",yd),x.exit().transition().duration(W).style("fill-opacity",0).remove(),v=tj.selectAll("."+g.arcs).selectAll("."+g.arc).data(te),v.enter().append("path").attr("class",fd).style("fill",function(a){return Wi(a.data)}).style("cursor",function(a){return Yg(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Ui||(c=Hb(a),d=Nb(c),e=Vb(),Pb(c.data.id),zf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Hb(a),c=Nb(b),d=[c];Ud(d,If.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Ui||(c=Hb(a),d=Nb(c),e=Wb(),Qb(c.data.id),Af(),Vd(),e(d,b))}).on("click",function(a,b){var c=Hb(a),d=Nb(c),e=Ub();hf(this,a,b),e(d,b)}),v.attr("transform",L?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Ui=!0}).transition().duration(V).attrTween("d",function(a){var b,c=Hb(a);return c?(b=If.interpolate(this._current,c),this._current=b(0),function(a){return Kb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",L?"scale(1)":"").style("fill",function(a){return Wi(a.data)}).style("opacity",1).call(He,function(){Ui=!1}),v.exit().transition().duration(W).style("opacity",0).remove(),tj.selectAll("."+g.chartArc).select("text").attr("transform",Lb).style("opacity",0).transition().duration(V).text(Ob).style("opacity",function(a){return Ic(a.data.id)&&re(a.data)?1:0}),tj.select("."+g.chartArcsTitle).style("opacity",je(Jf.data.targets)?1:0),fh&&(If.event&&"zoom"===If.event.type&&mj.extent(wg.orgDomain()).update(),H&&(!oh&&Ah&&hb(e,U.axisSubX,Ah),mj.empty()||mj.extent(wg.orgDomain()).update(),R=$e(_,!0),z=uj.selectAll("."+g.bars).selectAll("."+g.bar).data(ue),z.enter().append("path").attr("class",dd).style("stroke","none").style("fill",Wi),z.style("opacity",vd).transition().duration(V).attr("d",R).style("opacity",1),z.exit().transition().duration(V).style("opacity",0).remove(),y=uj.selectAll("."+g.lines).selectAll("."+g.line).data(se),y.enter().append("path").attr("class",_c).style("stroke",Wi),y.style("opacity",vd).transition().duration(V).attr("d",pj).style("opacity",1),y.exit().transition().duration(V).style("opacity",0).remove())),tj.selectAll("."+g.selectedCircles).filter(function(a){return ne(a)}).selectAll("circle").remove(),tj.selectAll("."+g.selectedCircle).transition().duration(V).attr("cx",oh?$d:Zd).attr("cy",oh?Zd:$d),A=tj.select("."+g.eventRects),Ee(Hg)&&!qc(Hg)?(A.classed(g.eventRectsMultiple)||A.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),B=tj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),gf(B.enter()),B.attr("x",0).attr("y",0).attr("width",bg).attr("height",dg)):(A.classed(g.eventRectsSingle)||A.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Pi&&!Oi?(F=function(a,b){var c=zc(b),d=Ac(b),e=Jf.data.xs[a.id][b];return(wg(d?d:e+50)-wg(c?c:e-50))/2},E=function(a,b){var c=zc(b),d=Jf.data.xs[a.id][b];return(wg(d)+wg(c?c:d-50))/2}):(F=N(),E=function(a){return wg(a.x)-F/2}),C=Cc(Jf.data.targets),tj.select("."+g.eventRects).datum(C?C.values:[]),B=tj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),ff(B.enter()),B.attr("class",kd).attr("x",oh?0:E).attr("y",oh?E:0).attr("width",oh?bg:F).attr("height",oh?F:dg),B.exit().remove()),Ec(Jf.data.targets).forEach(function(a){Aj[a]=!0})}function of(){nf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function pf(){if(0!==Kc(Jf.data.targets).length){if("mousemove"===If.event.sourceEvent.type&&qj.altDomain)return wg.domain(qj.altDomain),void qj.scale(wg).updateScaleExtent();Oi&&wg.orgDomain()[0]===yj[0]&&wg.domain([yj[0]-1e-10,wg.orgDomain()[1]]),nf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===If.event.sourceEvent.type&&(Si=!0)}}function qf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function rf(){rj.attr("width",fg).attr("height",gg),rj.select("#"+Hi).select("rect").attr("width",bg).attr("height",dg),rj.select("#"+Ii).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),rj.select("#"+Ji).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),rj.select("."+g.zoomRect).attr("width",bg).attr("height",dg),xj.style("max-height",gg+"px")}function sf(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,p(),T(),rf(),o(a.withTransition),nf(a)}function tf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=tj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",md),j=i.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Yc),e=tj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",od),d=e.enter().append("g").attr("class",od).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",ed).style("cursor",function(a){return Yg(a)?"pointer":null}),c=tj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",nd),b=c.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",ad),b.append("g").attr("class",id),b.append("g").attr("class",function(a){return Wc(g.selectedCircles,a.id)}),b.append("g").attr("class",cd).style("cursor",function(a){return Yg(a)?"pointer":null}),a.forEach(function(a){tj.selectAll("."+g.selectedCircles+qd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=tj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(ng(a)).attr("class",pd),f=h.enter().append("g").attr("class",pd),f.append("g").attr("class",gd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),fh&&(n=uj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",od),m=n.enter().append("g").style("opacity",0).attr("class",od),m.append("g").attr("class",ed),l=uj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",nd),k=l.enter().append("g").style("opacity",0).attr("class",nd),k.append("g").attr("class",ad)),rj.selectAll("."+g.target).filter(function(a){return Ic(a.id)}).transition().duration(Zf).style("opacity",1)}function uf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?ee(a.id,b.types[a.id]):ee(a.id,b.type)}),Jf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=ej?j:i,l=ej?S():R();return d&&(w=0,C=0,t=0,u=0),ih&&!Jc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=ej?u:t,void(nh?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=vj.selectAll("."+g.legendItemFocused).size();b=b||{},n=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,ej?(f=function(a){return t*B[a]},j=function(a){return A[B[a]]+x[a]}):(f=function(a){return A[B[a]]+x[a]},j=function(a){return u*B[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=vj.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Wc(g.legendItem,a)}).style("visibility",function(a){return Jc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof kh?kh(a):Jf.toggle(a)}).on("mouseover",function(a){If.select(this).classed(g.legendItemFocused,!0),Ui||Jf.focus(a),"function"==typeof lh&&lh(a)}).on("mouseout",function(a){If.select(this).classed(g.legendItemFocused,!1),Ui||Jf.revert(),"function"==typeof mh&&mh(a)}),m.append("text").text(function(a){return d(Kg[a])?Kg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",ej?h:-200).attr("y",ej?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",ej?i:-200).attr("y",ej?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",Wi).attr("x",ej?h:-200).attr("y",ej?-200:j).attr("width",10).attr("height",10),vj.selectAll("text").data(a).text(function(a){return d(Kg[a])?Kg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(n?250:0).attr("x",h).attr("y",k),vj.selectAll("rect."+g.legendItemEvent).data(a).transition().duration(n?250:0).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}).attr("x",i).attr("y",l),vj.selectAll("rect."+g.legendItemTile).data(a).transition().duration(n?250:0).style("fill",Wi).attr("x",f).attr("y",j),vj.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Ic(a)}).transition().style("opacity",function(a){var b=If.select(this);return Ic(a)?!D||b.classed(g.legendItemFocused)?xf(b):yf(b):ij}),P(t),Q(u),O(C),p(),T(),rf(),o(q,c)}function Ef(a){return Gc(Jf.data.targets,a.id)}function Ff(a){return"data"in a&&Gc(Jf.data.targets,a.data.id)}function Gf(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 Hf(a,b,c){var d=!ke(Jf.data.targets);Ui=!1,ee(a,b),sf(c||{withTransitionForAxis:d})}var If=a.d3?a.d3:a.require?a.require("d3"):void 0,Jf={data:{},axis:{},legend:{}},Kf={},Lf=i(["bindto"],"#chart"),Mf=i(["size","width"]),Nf=i(["size","height"]),Of=i(["padding","left"],50),Pf=i(["padding","right"],0),Qf=i(["padding","top"],0),Rf=i(["padding","bottom"],0),Sf=i(["zoom","enabled"],!1),Tf=i(["zoom","extent"]),Uf=i(["zoom","privileged"],!1),Vf=i(["onenter"],function(){}),Wf=i(["onleave"],function(){}),Xf=i(["onresize"],function(){}),Yf=i(["onresized"],function(){}),Zf=i(["transition","duration"],350);h("data","data is required in config");var $f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg=i(["data","x"]),Hg=i(["data","xs"],{}),Ig=i(["data","x_format"]),Jg=i(["data","id_converter"],function(a){return a}),Kg=i(["data","names"],{}),Lg=i(["data","classes"],{}),Mg=i(["data","groups"],[]),Ng=i(["data","axes"],{}),Og=i(["data","type"]),Pg=i(["data","types"],{}),Qg=i(["data","labels"],{}),Rg=i(["data","order"]),Sg=i(["data","regions"],{}),Tg=i(["data","color"]),Ug=i(["data","colors"],{}),Vg=i(["data","hide"],!1),Wg=i(["data","selection","enabled"],!1),Xg=i(["data","selection","grouped"],!1),Yg=i(["data","selection","isselectable"],function(){return!0}),Zg=i(["data","selection","multiple"],!0),$g=i(["data","onclick"],function(){}),_g=i(["data","onenter"],function(){}),ah=i(["data","onleave"],function(){}),bh=i(["data","onselected"],function(){}),ch=i(["data","onunselected"],function(){}),dh=i(["data","ondragstart"],function(){}),eh=i(["data","ondragend"],function(){}),fh=i(["subchart","show"],!1),gh=i(["subchart","size","height"],60),hh=i(["color","pattern"],[]),ih=i(["legend","show"],!0),jh=i(["legend","position"],"bottom"),kh=i(["legend","item","onclick"]),lh=i(["legend","item","onmouseover"]),mh=i(["legend","item","onmouseout"]),nh=i(["legend","equally"],!1),oh=i(["axis","rotated"],!1),ph=i(["axis","x","show"],!0),qh=i(["axis","x","type"],"indexed"),rh=i(["axis","x","localtime"],!0),sh=i(["axis","x","categories"],[]),th=i(["axis","x","tick","centered"],!1),uh=i(["axis","x","tick","format"]),vh=i(["axis","x","tick","culling"],{}),wh=i(["axis","x","tick","culling","max"],10),xh=i(["axis","x","tick","count"]),yh=i(["axis","x","tick","fit"],!0),zh=i(["axis","x","tick","values"],null),Ah=i(["axis","x","tick","rotate"]),Bh=i(["axis","x","max"],null),Ch=i(["axis","x","min"],null),Dh=i(["axis","x","padding"],{}),Eh=i(["axis","x","height"]),Fh=i(["axis","x","default"]),Gh=i(["axis","x","label"],{}),Hh=i(["axis","y","show"],!0),Ih=i(["axis","y","max"]),Jh=i(["axis","y","min"]),Kh=i(["axis","y","center"]),Lh=i(["axis","y","label"],{}),Mh=i(["axis","y","inner"],!1),Nh=i(["axis","y","tick","format"]),Oh=i(["axis","y","padding"]),Ph=i(["axis","y","ticks"],10),Qh=i(["axis","y2","show"],!1),Rh=i(["axis","y2","max"]),Sh=i(["axis","y2","min"]),Th=i(["axis","y2","center"]),Uh=i(["axis","y2","label"],{}),Vh=i(["axis","y2","inner"],!1),Wh=i(["axis","y2","tick","format"]),Xh=i(["axis","y2","padding"]),Yh=i(["axis","y2","ticks"],10),Zh=i(["grid","x","show"],!1),$h=i(["grid","x","type"],"tick"),_h=i(["grid","x","lines"],[]),ai=i(["grid","y","show"],!1),bi=i(["grid","y","lines"],[]),ci=i(["grid","y","ticks"],10),di=i(["point","show"],!0),ei=i(["point","r"],2.5),fi=i(["point","focus","line","enabled"],!0),gi=i(["point","focus","expand","enabled"],!0),hi=i(["point","focus","expand","r"]),ii=i(["point","focus","select","r"]),ji=i(["line","connect_null"],!1),ki=i(["bar","width"]),li=i(["bar","width","ratio"],.6),mi=i(["pie","label","show"],!0),ni=i(["pie","label","format"]),oi=i(["pie","expand"],!0),pi=i(["pie","onclick"],function(){}),qi=i(["pie","onmouseover"],function(){}),ri=i(["pie","onmouseout"],function(){}),si=i(["donut","label","show"],!0),ti=i(["donut","label","format"]),ui=i(["donut","expand"],!0),vi=i(["donut","title"],""),wi=i(["donut","onclick"],function(){}),xi=i(["donut","onmouseover"],function(){}),yi=i(["donut","onmouseout"],function(){}),zi=i(["regions"],[]),Ai=i(["tooltip","show"],!0),Bi=i(["tooltip","format","title"]),Ci=i(["tooltip","format","value"]),Di=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Bi?Bi:b,l=Ci?Ci:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Ei=i(["tooltip","init","show"],!1),Fi=i(["tooltip","init","x"],0),Gi=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Hi=("string"==typeof Lf?Lf.replace("#",""):Lf.id)+"-clip",Ii=Hi+"-xaxis",Ji=Hi+"-yaxis",Ki=j(Hi),Li=j(Ii),Mi=j(Ji),Ni="timeseries"===qh,Oi="categorized"===qh,Pi=!Ni&&(Gg||Ee(Hg)),Qi=null,Ri=!1,Si=!1,Ti=!1,Ui=!1,Vi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Wi=ye(Ug,Ee(hh)?hh:Vi,Tg),Xi=rh?If.time.format:If.time.format.utc,Yi=Xi.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),Zi=[],$i=[],_i=oh?"left":"bottom",aj=oh?Mh?"top":"bottom":Mh?"right":"left",bj=oh?Vh?"bottom":"top":Vh?"left":"right",cj=oh?"left":"bottom",dj={main:function(){return"translate("+k($f.left)+","+k($f.top)+")"},context:function(){return"translate("+k(_f.left)+","+k(_f.top)+")"},legend:function(){return"translate("+ag.left+","+ag.top+")"},x:function(){return"translate(0,"+(oh?0:dg)+")"},y:function(){return"translate(0,"+(oh?dg:0)+")"},y2:function(){return"translate("+(oh?0:bg)+","+(oh?1:0)+")"},subx:function(){return"translate(0,"+(oh?0:eg)+")"},arc:function(){return"translate("+bg/2+","+dg/2+")"}},ej="right"===jh,fj=0,gj=0,hj=0,ij=.15,jj=30,kj=oh&&!ph?0:30,lj=5;ng=If.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value },0)});var mj,nj=function(){var a=If.svg.line().x(oh?function(a){return Y(a.id)(a.value)}:Hd).y(oh?Hd:function(a){return Y(a.id)(a.value)});return ji||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ji?Qe(b.values):b.values;return le(b)?(a.interpolate(me(b)?"cardinal":"linear"),Sg[b.id]?df(e,wg,Y(b.id),Sg[b.id]):a(e)):(c=e[0]?wg(e[0].x):0,d=e[0]?Y(b.id)(e[0].value):0,oh?"M "+d+" "+c:"M "+c+" "+d)}}(),oj=function(){var a;return a=oh?If.svg.area().x0(function(a){return Y(a.id)(0)}).x1(function(a){return Y(a.id)(a.value)}).y(Hd):If.svg.area().x(Hd).y0(function(a){return Y(a.id)(0)}).y1(function(a){return Y(a.id)(a.value)}),function(b){var c,d,e=Qe(b.values);return fe([b],"area")||fe([b],"area-spline")?(a.interpolate(me(b)?"cardinal":"linear"),a(e)):(c=e[0]?wg(e[0].x):0,d=e[0]?Y(b.id)(e[0].value):0,oh?"M "+d+" "+c:"M "+c+" "+d)}}(),pj=function(){var a=If.svg.line().x(oh?function(a){return Z(a.id)(a.value)}:Kd).y(oh?Kd:function(a){return Z(a.id)(a.value)});return function(b){var c=Qe(b.values);return le(b)?a(c):"M "+zg(c[0].x)+" "+Z(b.id)(c[0].value)}}(),qj=function(){};mj=If.svg.brush().on("brush",of),mj.update=function(){return uj&&uj.select("."+g.brush).call(this),this},mj.scale=function(a){return oh?this.y(a):this.x(a)},Sf&&(qj=If.behavior.zoom().on("zoomstart",function(){qj.altDomain=If.event.sourceEvent.altKey?wg.orgDomain():null}).on("zoom",Sf?pf:null),qj.scale=function(a){return oh?this.y(a):this.x(a)},qj.orgScaleExtent=function(){var a=Tf?Tf:[1,10];return[a[0],Math.max(Bc()/a[1],a[1])]},qj.updateScaleExtent=function(){var a=cc(wg.orgDomain())/cc(yj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var rj,sj,tj,uj,vj,wj,xj,yj,zj,Aj={};if(Jf.focus=function(a){function b(a){Kc(a).transition().duration(100).style("opacity",1)}var c=rj.selectAll(rd(a)),d=c.filter(Ef),e=c.filter(Ff);Jf.revert(),Jf.defocus(),b(d.classed(g.focused,!0)),b(e),ke(Jf.data.targets)&&Pb(a,!0),zf(a,!0)},Jf.defocus=function(a){function b(a){Kc(a).transition().duration(100).style("opacity",.3)}var c=rj.selectAll(rd(a)),d=c.filter(Ef),e=c.filter(Ff);Jf.revert(),b(d.classed(g.focused,!1)),b(e),ke(Jf.data.targets)&&Qb(a),zf(a,!1)},Jf.revert=function(a){function b(a){Kc(a).transition().duration(100).style("opacity",1)}var c=rj.selectAll(rd(a)),d=c.filter(Ef),e=c.filter(Ff);b(d.classed(g.focused,!1)),b(e),ke(Jf.data.targets)&&Qb(a),Af()},Jf.show=function(a,b){a=Fc(a),b=b||{},Oc(a),rj.selectAll(sd(a)).transition().style("opacity",1),b.withLegend&&Bf(a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Jf.hide=function(a,b){a=Fc(a),b=b||{},Nc(a),rj.selectAll(sd(a)).transition().style("opacity",0),b.withLegend&&Cf(a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Jf.toggle=function(a){Ic(a)?Jf.hide(a):Jf.show(a)},Jf.unzoom=function(){mj.clear().update(),nf({withUpdateXDomain:!0})},Jf.load=function(a){return a.xs&&pc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Lg[b]=a.classes[b]}),"categories"in a&&Oi&&(sh=a.categories,Cg.categories(sh)),"cacheIds"in a&&dc(a.cacheIds)?void uf(fc(a.cacheIds),a.done):void("unload"in a?wf(Fc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){vf(a)}):vf(a))},Jf.unload=function(a,b){wf(Fc(a),function(){nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Jf.selected=function(a){return If.merge(tj.selectAll("."+g.shapes+qd(a)).selectAll("."+g.shape).filter(function(){return If.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Jf.select=function(a,b,c){Wg&&tj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=If.select(this),i=e.data?e.data.id:e.id,j=Pe(this),k=Xg||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);"path"!==this.nodeName&&(k&&l?Yg(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},Jf.unselect=function(a,b){Wg&&tj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=If.select(this),f=c.data?c.data.id:c.id,h=Pe(this),i=Xg||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);"path"!==this.nodeName&&i&&j&&Yg(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Jf.toLine=function(a){Hf(a,"line")},Jf.toSpline=function(a){Hf(a,"spline")},Jf.toBar=function(a){Hf(a,"bar")},Jf.toScatter=function(a){Hf(a,"scatter")},Jf.toArea=function(a){Hf(a,"area")},Jf.toAreaSpline=function(a){Hf(a,"area-spline")},Jf.toPie=function(a){Hf(a,"pie",{withTransform:!0})},Jf.toDonut=function(a){Hf(a,"donut",{withTransform:!0})},Jf.groups=function(a){return c(a)?Mg:(Mg=a,nf(),Mg)},Jf.xgrids=function(a){return a?(_h=a,nf(),_h):_h},Jf.xgrids.add=function(a){return a?Jf.xgrids(_h.concat(a)):void 0},Jf.xgrids.remove=function(a){var b=Gf(a);return Jf.xgrids(_h.filter(b))},Jf.ygrids=function(a){return a?(bi=a,nf(),bi):bi},Jf.ygrids.add=function(a){return a?Jf.ygrids(bi.concat(a)):void 0},Jf.ygrids.remove=function(a){var b=Gf(a);return Jf.ygrids(bi.filter(b))},Jf.regions=function(a){return c(a)?zi:(zi=a,nf(),zi)},Jf.regions.add=function(a){return c(a)?zi:(zi=zi.concat(a),nf(),zi)},Jf.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;rj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),zi=zi.filter(function(b){return b.classes.indexOf(a)<0})}),zi},Jf.data.get=function(a){var b=Jf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Jf.data.getAsTarget=function(a){var b=Hc(function(b){return b.id===a});return b.length>0?b[0]:void 0},Jf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Kg[b]=a[b]}),nf({withLegend:!0}),Kg):Kg},Jf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Ug[b]=a[b]}),nf({withLegend:!0}),Ug):Ug},Jf.x=function(a){return arguments.length&&(sc(Jf.data.targets,a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Jf.data.xs},Jf.xs=function(a){return arguments.length&&(tc(Jf.data.targets,a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Jf.data.xs},Jf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){eb(b,a[b])}),Gb())},Jf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Bh=+a.x),b(a.y)&&(Ih=+a.y),b(a.y2)&&(Rh=+a.y2)):Ih=Rh=+a,nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Jf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Ch=+a.x),b(a.y)&&(Jh=+a.y),b(a.y2)&&(Sh=+a.y2)):Jh=Sh=+a,nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Jf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Jf.axis.max(a.max),"undefined"!=typeof a.min&&Jf.axis.min(a.min))},Jf.legend.show=function(a){Bf(Fc(a)),nf({withLegend:!0})},Jf.legend.hide=function(a){Cf(Fc(a)),nf({withLegend:!0})},Jf.resize=function(a){Mf=a?a.width:null,Nf=a?a.height:null,sf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Jf.destroy=function(){Jf.data.targets=void 0,Jf.data.xs={},xj.html(""),a.onresize=null},"url"in f.data)If.xhr(f.data.url,function(a,b){var c,d=If.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=If.csv.parse(b.response),ef(c)});else if("rows"in f.data)ef(vc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");ef(wc(f.data.columns))}return Jf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(window); \ No newline at end of file From 79c0cbd9a150baec23a74023b5ac4935e1e98429 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Fri, 9 May 2014 11:52:10 +0900 Subject: [PATCH 149/178] Fix centering arc - #130 --- c3.js | 182 ++++++++++++++++++++++++++++-------------------------- c3.min.js | 6 +- 2 files changed, 98 insertions(+), 90 deletions(-) diff --git a/c3.js b/c3.js index e8bbdf3..381741f 100644 --- a/c3.js +++ b/c3.js @@ -319,9 +319,10 @@ /*-- Set Chart Params --*/ var margin, margin2, margin3, width, width2, height, height2, currentWidth, currentHeight; - var radius, radiusExpanded, innerRadius, svgArc, svgArcExpanded, svgArcExpandedSub, pie; + var radius, radiusExpanded, innerRadius, arcWidth, arcHeight, svgArc, svgArcExpanded, svgArcExpandedSub, pie; var xMin, xMax, yMin, yMax, subXMin, subXMax, subYMin, subYMax; var x, y, y2, subX, subY, subY2, xAxis, yAxis, y2Axis, subXAxis; + var axes = {}; var xOrient = __axis_rotated ? "left" : "bottom", yOrient = __axis_rotated ? (__axis_y_inner ? "top" : "bottom") : (__axis_y_inner ? "right" : "left"), @@ -336,7 +337,7 @@ y : function () { return "translate(0," + (__axis_rotated ? height : 0) + ")"; }, y2 : function () { return "translate(" + (__axis_rotated ? 0 : width) + "," + (__axis_rotated ? 1 : 0) + ")"; }, subx : function () { return "translate(0," + (__axis_rotated ? 0 : height2) + ")"; }, - arc: function () { return "translate(" + width / 2 + "," + height / 2 + ")"; } + arc: function () { return "translate(" + (arcWidth / 2) + "," + (arcHeight / 2) + ")"; } }; var isLegendRight = __legend_position === 'right'; @@ -407,8 +408,9 @@ function updateSizes() { var legendHeight = getLegendHeight(), legendWidth = getLegendWidth(), legendHeightForBottom = isLegendRight ? 0 : legendHeight, - xAxisHeight = __axis_rotated ? 0 : getHorizontalAxisHeight('x'), - subchartHeight = __subchart_show ? (__subchart_size_height + xAxisHeight) : 0; + hasArc = hasArcType(c3.data.targets), + xAxisHeight = __axis_rotated || hasArc ? 0 : getHorizontalAxisHeight('x'), + subchartHeight = __subchart_show && !hasArc ? (__subchart_size_height + xAxisHeight) : 0; currentWidth = getCurrentWidth(); currentHeight = getCurrentHeight(); @@ -417,9 +419,9 @@ if (__axis_rotated) { margin = { top: getHorizontalAxisHeight('y2') + __padding_top, - right: getCurrentPaddingRight(), + right: hasArc ? 0 : getCurrentPaddingRight(), bottom: getHorizontalAxisHeight('y') + legendHeightForBottom + __padding_bottom, - left: subchartHeight + getCurrentPaddingLeft() + left: subchartHeight + (hasArc ? 0 : getCurrentPaddingLeft()) }; margin2 = { top: margin.top, @@ -430,9 +432,9 @@ } else { margin = { top: 4 + __padding_top, // for top tick text - right: getCurrentPaddingRight(), + right: hasArc ? 0 : getCurrentPaddingRight(), bottom: xAxisHeight + subchartHeight + legendHeightForBottom + __padding_bottom, - left: getCurrentPaddingLeft() + left: hasArc ? 0 : getCurrentPaddingLeft() }; margin2 = { top: currentHeight - subchartHeight - legendHeightForBottom, @@ -460,10 +462,12 @@ if (height2 < 0) { height2 = 0; } // for arc + arcWidth = width - (isLegendRight ? legendWidth + 10 : 0); + arcHeight = height - (isLegendRight ? 0 : 10); updateRadius(); - if (isLegendRight && hasArcType(c3.data.targets)) { - margin3.left = width / 2 + radiusExpanded * 1.1; + if (isLegendRight && hasArc) { + margin3.left = arcWidth / 2 + radiusExpanded * 1.1; } } function updateXgridFocus() { @@ -474,7 +478,7 @@ .attr("y2", __axis_rotated ? -10 : height); } function updateRadius() { - radiusExpanded = height / 2; + radiusExpanded = Math.min(arcWidth, arcHeight) / 2; radius = radiusExpanded * 0.95; innerRadius = hasDonutType(c3.data.targets) ? radius * 0.6 : 0; } @@ -483,7 +487,8 @@ leftAxis = main.select('.' + leftAxisClass).node(), svgRect = leftAxis ? leftAxis.getBoundingClientRect() : {right: 0}, chartRect = d3.select(__bindto).node().getBoundingClientRect(), - svgLeft = svgRect.right - chartRect.left - getCurrentPaddingLeft(); + hasArc = hasArcType(c3.data.targets), + svgLeft = svgRect.right - chartRect.left - (hasArc ? 0 : getCurrentPaddingLeft()); return svgLeft > 0 ? svgLeft : 0; } function getCurrentWidth() { @@ -494,21 +499,18 @@ return h > 0 ? h : 320; } function getCurrentPaddingLeft() { - if (hasArcType(c3.data.targets)) { - return 0; - } else if (__padding_left) { + var defaultPadding = 1; + if (__padding_left) { return __padding_left; } else if (__axis_rotated) { - return !__axis_x_show ? 1 : getAxisWidthByAxisId('x'); + return !__axis_x_show ? defaultPadding : getAxisWidthByAxisId('x'); } else { - return !__axis_y_show || __axis_y_inner ? 1 : getAxisWidthByAxisId('y'); + return !__axis_y_show || __axis_y_inner ? defaultPadding : getAxisWidthByAxisId('y'); } } function getCurrentPaddingRight() { var defaultPadding = 1; - if (hasArcType(c3.data.targets)) { - return 0; - } else if (__padding_right) { + if (__padding_right) { return __padding_right; } else if (isLegendRight) { return getLegendWidth() + 20 + (__axis_y2_show && !__axis_rotated ? getAxisWidthByAxisId('y2') : defaultPadding); @@ -2590,38 +2592,35 @@ } // Add Axis - if (__axis_x_show) { - main.append("g") - .attr("class", CLASS.axisX) - .attr("clip-path", clipPathForXAxis) - .attr("transform", translate.x) - .append("text") - .attr("class", CLASS.axisXLabel) - .attr("transform", __axis_rotated ? "rotate(-90)" : "") - .style("text-anchor", textAnchorForXAxisLabel); - } - - if (__axis_y_show) { - main.append("g") - .attr("class", CLASS.axisY) - .attr("clip-path", clipPathForYAxis) - .attr("transform", translate.y) - .append("text") - .attr("class", CLASS.axisYLabel) - .attr("transform", __axis_rotated ? "" : "rotate(-90)") - .style("text-anchor", textAnchorForYAxisLabel); - } - - if (__axis_y2_show) { - main.append("g") - .attr("class", CLASS.axisY2) - // clip-path? - .attr("transform", translate.y2) - .append("text") - .attr("class", CLASS.axisY2Label) - .attr("transform", __axis_rotated ? "" : "rotate(-90)") - .style("text-anchor", textAnchorForY2AxisLabel); - } + axes.x = main.append("g") + .attr("class", CLASS.axisX) + .attr("clip-path", clipPathForXAxis) + .attr("transform", translate.x) + .style("visibility", __axis_x_show ? 'visible' : 'hidden'); + axes.x.append("text") + .attr("class", CLASS.axisXLabel) + .attr("transform", __axis_rotated ? "rotate(-90)" : "") + .style("text-anchor", textAnchorForXAxisLabel); + + axes.y = main.append("g") + .attr("class", CLASS.axisY) + .attr("clip-path", clipPathForYAxis) + .attr("transform", translate.y) + .style("visibility", __axis_y_show ? 'visible' : 'hidden'); + axes.y.append("text") + .attr("class", CLASS.axisYLabel) + .attr("transform", __axis_rotated ? "" : "rotate(-90)") + .style("text-anchor", textAnchorForYAxisLabel); + + axes.y2 = main.append("g") + .attr("class", CLASS.axisY2) + // clip-path? + .attr("transform", translate.y2) + .style("visibility", __axis_y2_show ? 'visible' : 'hidden'); + axes.y2.append("text") + .attr("class", CLASS.axisY2Label) + .attr("transform", __axis_rotated ? "" : "rotate(-90)") + .style("text-anchor", textAnchorForY2AxisLabel); /*-- Context Region --*/ @@ -2648,7 +2647,7 @@ // ATTENTION: This must be called AFTER chart added // Add Axis - context.append("g") + axes.subx = context.append("g") .attr("class", CLASS.axisX) .attr("transform", translate.subx) .attr("clip-path", __axis_rotated ? "" : clipPathForXAxis); @@ -3021,18 +3020,18 @@ } } - function redraw(options) { - var xaxis, subxaxis, yaxis, y2axis, xgrid, xgridAttr, xgridData, xgridLines, xgridLine, ygrid, ygridLines, ygridLine; + function redraw(options, transitions) { + var xgrid, xgridAttr, xgridData, xgridLines, xgridLine, ygrid, ygridLines, ygridLine; var mainLine, mainArea, mainCircle, mainBar, mainArc, mainRegion, mainText, contextLine, contextBar, eventRect, eventRectUpdate; var barIndices = getBarIndices(), maxDataCountTarget, tickOffset; var rectX, rectW; var withY, withSubchart, withTransition, withTransitionForExit, withTransitionForAxis, withTransform, withUpdateXDomain, withUpdateOrgXDomain, withLegend; var hideAxis = hasArcType(c3.data.targets); var drawBar, drawBarOnSub, xForText, yForText; - var transitions, duration, durationForExit, durationForAxis; + var duration, durationForExit, durationForAxis; var targetsToShow = filterTargetsToShow(c3.data.targets), tickValues, i, intervalForCulling; - options = isDefined(options) ? options : {}; + options = options || {}; withY = isDefined(options.withY) ? options.withY : true; withSubchart = isDefined(options.withSubchart) ? options.withSubchart : true; withTransition = isDefined(options.withTransition) ? options.withTransition : true; @@ -3048,17 +3047,7 @@ durationForExit = withTransitionForExit ? duration : 0; durationForAxis = withTransitionForAxis ? duration : 0; - xaxis = main.select('.' + CLASS.axisX).style("opacity", hideAxis ? 0 : 1); - yaxis = main.select('.' + CLASS.axisY).style("opacity", hideAxis ? 0 : 1); - y2axis = main.select('.' + CLASS.axisY2).style("opacity", hideAxis ? 0 : 1); - subxaxis = context.select('.' + CLASS.axisX).style("opacity", hideAxis ? 0 : 1); - - transitions = { - axisX: xaxis.transition().duration(durationForAxis), - axisY: yaxis.transition().duration(durationForAxis), - axisY2: y2axis.transition().duration(durationForAxis), - axisSubX: subxaxis.transition().duration(durationForAxis), - }; + transitions = transitions || generateAxisTransitions(durationForAxis); // update legend and transform each g if (withLegend && __legend_show) { @@ -3067,7 +3056,7 @@ // MEMO: needed for grids calculation if (isCategorized && targetsToShow.length === 0) { - x.domain([0, xaxis.selectAll('.tick').size()]); + x.domain([0, axes.x.selectAll('.tick').size()]); } if (targetsToShow.length) { @@ -3095,6 +3084,10 @@ y2.domain(getYDomain(targetsToShow, 'y2')); // axes + axes.x.style("opacity", hideAxis ? 0 : 1); + axes.y.style("opacity", hideAxis ? 0 : 1); + axes.y2.style("opacity", hideAxis ? 0 : 1); + axes.subx.style("opacity", hideAxis ? 0 : 1); transitions.axisX.call(xAxis); transitions.axisY.call(yAxis); transitions.axisY2.call(y2Axis); @@ -3125,7 +3118,7 @@ // rotate tick text if needed if (!__axis_rotated && __axis_x_tick_rotate) { - rotateTickText(xaxis, transitions.axisX, __axis_x_tick_rotate); + rotateTickText(axes.x, transitions.axisX, __axis_x_tick_rotate); } // setup drawer - MEMO: these must be called after axis updated @@ -3445,7 +3438,7 @@ // rotate tick text if needed if (!__axis_rotated && __axis_x_tick_rotate) { - rotateTickText(subxaxis, transitions.axisSubX, __axis_x_tick_rotate); + rotateTickText(axes.subx, transitions.axisSubX, __axis_x_tick_rotate); } // extent rect @@ -3628,7 +3621,17 @@ selectChart.style('max-height', currentHeight + "px"); } + function generateAxisTransitions(duration) { + return { + axisX: duration ? axes.x.transition().duration(duration) : axes.x, + axisY: duration ? axes.y.transition().duration(duration) : axes.y, + axisY2: duration ? axes.y2.transition().duration(duration) : axes.y2, + axisSubX: duration ? axes.subx.transition().duration(duration) : axes.subx, + }; + } + function updateAndRedraw(options) { + var transitions; options = options || {}; // same with redraw options.withTransition = isDefined(options.withTransition) ? options.withTransition : true; @@ -3638,14 +3641,18 @@ options.withUpdateXDomain = true; options.withUpdateOrgXDomain = true; options.withTransitionForExit = false; - // Update sizes and scales - updateSizes(); - updateScales(); - updateSvgSize(); - // Update g positions - transformAll(options.withTransition); + // MEMO: called in updateLegend in redraw if withLegend + if (!(options.withLegend && __legend_show)) { + transitions = generateAxisTransitions(options.withTransition ? __transition_duration : 0); + // Update sizes and scales + updateSizes(); + updateScales(); + updateSvgSize(); + // Update g positions + transformAll(options.withTransition, transitions); + } // Draw with new sizes & scales - redraw(options); + redraw(options, transitions); } function updateTargets(targets) { @@ -3888,6 +3895,7 @@ var l, totalLength = 0, offsets = {}, widths = {}, heights = {}, margins = [0], steps = {}, step = 0; var withTransition, withTransitionForTransform; var hasFocused = legend.selectAll('.' + CLASS.legendItemFocused).size(); + var texts, rects, tiles; options = options || {}; withTransition = isDefined(options.withTransition) ? options.withTransition : true; @@ -4013,25 +4021,25 @@ .attr('width', 10) .attr('height', 10); - legend.selectAll('text') + texts = legend.selectAll('text') .data(targetIds) .text(function (id) { return isDefined(__data_names[id]) ? __data_names[id] : id; }) // MEMO: needed for update - .each(function (id, i) { updatePositions(this, id, i === 0); }) - .transition().duration(withTransition ? 250 : 0) + .each(function (id, i) { updatePositions(this, id, i === 0); }); + (withTransition ? texts.transition() : texts) .attr('x', xForLegendText) .attr('y', yForLegendText); - legend.selectAll('rect.' + CLASS.legendItemEvent) - .data(targetIds) - .transition().duration(withTransition ? 250 : 0) + rects = legend.selectAll('rect.' + CLASS.legendItemEvent) + .data(targetIds); + (withTransition ? rects.transition() : rects) .attr('width', function (id) { return widths[id]; }) .attr('height', function (id) { return heights[id]; }) .attr('x', xForLegendRect) .attr('y', yForLegendRect); - legend.selectAll('rect.' + CLASS.legendItemTile) - .data(targetIds) - .transition().duration(withTransition ? 250 : 0) + tiles = legend.selectAll('rect.' + CLASS.legendItemTile) + .data(targetIds); + (withTransition ? tiles.transition() : tiles) .style('fill', color) .attr('x', xForLegend) .attr('y', yForLegend); diff --git a/c3.min.js b/c3.min.js index 2baa038..8677d30 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.ceil(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.ceil(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&abg&&(bg=0),0>dg&&(dg=0),cg=oh?$f.left-jj-kj:bg,eg=oh?dg:gg-_f.top-_f.bottom,0>cg&&(cg=0),0>eg&&(eg=0),r(),ej&&ke(Jf.data.targets)&&(ag.left=bg/2+1.1*ig)}function q(){tj.select("line."+g.xgridFocus).attr("x1",oh?0:-10).attr("x2",oh?bg:-10).attr("y1",oh?-10:$f.top).attr("y2",oh?-10:dg)}function r(){ig=dg/2,hg=.95*ig,jg=je(Jf.data.targets)?.6*hg:0}function s(){var a=oh?g.axisX:g.axisY,b=tj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=If.select(Lf).node().getBoundingClientRect(),e=c.right-d.left-v();return e>0?e:0}function t(){return Mf?Mf:z()}function u(){var a=Nf?Nf:A();return a>0?a:320}function v(){return ke(Jf.data.targets)?0:Of?Of:oh?ph?x("x"):1:!Hh||Mh?1:x("y")}function w(){var a=1;return ke(Jf.data.targets)?0:Pf?Pf:ej?R()+20+(Qh&&!oh?x("y2"):a):Qh?Vh||oh?a:x("y2"):a}function x(a){var b=mb(a);return b.isInner?20+Fb(a):40+Fb(a)}function y(a){return"x"!==a||ph?"x"===a&&Eh?Eh:"y"!==a||Hh?"y2"!==a||Qh?(mb(a).isInner?30:40)+("y2"===a?-10:0):lj:ih&&!ej?10:1:0}function z(){return+If.select(Lf).style("width").replace("px","")}function A(){return+If.select(Lf).style("height").replace("px","")}function B(a){return a?-31:-($f.left-1)}function C(a){return a?-20:-4}function D(){return B(!oh)}function E(){return C(!oh)}function F(){return B(oh)}function G(){return C(oh)}function H(a){return a?bg+2+30+30:$f.left+20}function I(a){return a?(Eh?Eh:0)+80:dg+8}function J(){return H(!oh)}function K(){return I(!oh)}function L(){return H(oh)}function M(){return I(oh)}function N(){var a,b,c,d,e,f=Cc(Jf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=wg(b.x)-wg(a.x),0===c?oh?dg:bg:(d=Bc(),e=ge(Jf.data.targets)?(d-(Oi?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function O(a){fj=a}function P(a){gj=a}function Q(a){hj=a}function R(){return ih?ej?gj*(fj+1):fg:0}function S(){return ih?ej?gg:hj*(fj+1):0}function T(){var a,b,c=!wg;og=oh?1:0,pg=oh?dg:bg,qg=oh?0:dg,rg=oh?bg:1,sg=og,tg=pg,ug=oh?0:eg,vg=oh?cg:1,wg=W(og,pg,c?void 0:wg.domain(),function(){return Cg.tickOffset()}),xg=X(qg,rg,c?void 0:xg.domain()),yg=X(qg,rg,c?void 0:yg.domain()),zg=W(og,pg,yj,function(a){return a%1?0:Fg.tickOffset()}),Ag=X(ug,vg,c?void 0:Ag.domain()),Bg=X(ug,vg,c?void 0:Bg.domain()),a=bb(),b=zh?zh:c?void 0:Cg.tickValues(),Cg=$(wg,_i,a,b),Fg=$(zg,cj,a,b),Dg=_(xg,aj,Nh,Ph),Eg=_(yg,bj,Wh,Yh),c||(mj.scale(zg),Sf&&qj.scale(wg)),U()}function U(){kg=Ib(),lg=Jb(),mg=Jb(.98)}function V(a,b,c){return(c?If.time.scale():If.scale.linear()).range([a,b])}function W(a,b,c,d){var e,f=V(a,b,Ni),g=c?f.domain(c):f;Oi?(d=d||function(){return 0},f=function(a,b){var c=g(a)+d(a);return b?c:Math.ceil(c)}):f=function(a,b){var c=g(a);return b?c:Math.ceil(c)};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return yj&&yj[0]===a[0]&&yj[1]a?a.toFixed(0):a};return uh&&("function"==typeof uh?a=uh:Ni&&(a=function(a){return a?Xi(uh)(a):""})),a}function cb(a){var b;return"y"===a?b=Lh:"y2"===a?b=Uh:"x"===a&&(b=Gh),b}function db(a){var b=cb(a);return"string"==typeof b?b:b?b.text:null}function eb(a,b){var c=cb(a);"string"==typeof c?"y"===a?Lh=b:"y2"===a?Uh=b:"x"===a&&(Gh=b):c&&(c.text=b)}function fb(a){return 10*Math.sin(Math.PI*(a/180))}function gb(a){return 11.5-2.5*(a/15)}function hb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",gb(c)).attr("x",fb(c)).attr("transform","rotate("+c+")")}function ib(a,b){var c=cb(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 jb(){return ib("x",oh?"inner-top":"inner-right")}function kb(){return ib("y",oh?"inner-right":"inner-top")}function lb(){return ib("y2",oh?"inner-right":"inner-top")}function mb(a){return"y2"===a?lb():"y"===a?kb():jb()}function nb(){return db("x")}function ob(){return db("y")}function pb(){return db("y2")}function qb(a,b){return a?b.isLeft?0:b.isCenter?bg/2:bg:b.isBottom?-dg:b.isMiddle?-dg/2:0}function rb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function sb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function tb(){return qb(!oh,jb())}function ub(){return qb(oh,kb())}function vb(){return qb(oh,lb())}function wb(){return rb(!oh,jb())}function xb(){return rb(oh,kb())}function yb(){return rb(oh,lb())}function zb(){var a=jb();return oh?a.isInner?"1.2em":-25-Fb("x"):a.isInner?"-0.5em":Eh?Eh-10:"3em"}function Ab(){var a=kb();return oh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Fb("y")}function Bb(){var a=lb();return oh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Fb("y2")}function Cb(){return sb(!oh,jb())}function Db(){return sb(oh,kb())}function Eb(){return sb(oh,lb())}function Fb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return If.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Gb(a){var b=tj.select("."+g.axisX+" ."+g.axisXLabel),c=tj.select("."+g.axisY+" ."+g.axisYLabel),d=tj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",tb).attr("dx",wb).attr("dy",zb).text(nb),(a?c.transition():c).attr("x",ub).attr("dx",xb).attr("dy",Ab).attr("dy",Ab).text(ob),(a?d.transition():d).attr("x",vb).attr("dx",yb).attr("dy",Bb).text(pb)}function Hb(a){var b=!1;return ng(Kc(Jf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Ib(){var a=If.svg.arc().outerRadius(hg).innerRadius(jg),b=function(b,c){var d;return c?a(b):(d=Hb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Jb(a){var b=If.svg.arc().outerRadius(ig*(a?a:1)).innerRadius(jg);return function(a){var c=Hb(a);return c?b(c):"M 0 0"}}function Kb(a,b){return re(a.data)?kg(a,b):"M 0 0"}function Lb(a){var b,c,d,e,f=Hb(a),g="";return f&&(b=kg.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*hg*.8+","+d/e*hg*.8+")"),g}function Mb(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Nb(a){return rc({id:a.data.id,value:a.value,ratio:Mb(a)})}function Ob(a){var b,c,d,e;return Rb()?(b=Hb(a),c=b?b.value:null,d=Mb(b),e=Sb(),e?e(c,d):Fd(c,d)):""}function Pb(a,b){var c=rj.selectAll("."+g.chartArc+rd(a)),d=rj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});xe(a)&&c.selectAll("path").transition().duration(50).attr("d",lg).transition().duration(100).attr("d",mg).each(function(a){qe(a.data)}),b||d.style("opacity",.3)}function Qb(a){var b=rj.selectAll("."+g.chartArc+rd(a));b.selectAll("path").transition().duration(50).attr("d",kg),rj.selectAll("."+g.arc).style("opacity",1)}function Rb(){return je(Jf.data.targets)?si:mi}function Sb(){return je(Jf.data.targets)?ti:ni}function Tb(){return je(Jf.data.targets)?vi:""}function Ub(){var a=je(Jf.data.targets)?wi:pi;return"function"==typeof a?a:function(){}}function Vb(){var a=je(Jf.data.targets)?xi:qi;return"function"==typeof a?a:function(){}}function Wb(){var a=je(Jf.data.targets)?yi:ri;return"function"==typeof a?a:function(){}}function Xb(a){var b,c,d,e,f,g,h=Ec(a),i=Rc(a);if(Mg.length>0)for(g=Tc(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 If.min(Object.keys(i).map(function(a){return If.min(i[a])}))}function Yb(a){var b,c,d,e,f,g,h=Ec(a),i=Rc(a);if(Mg.length>0)for(g=Uc(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 If.max(Object.keys(i).map(function(a){return If.max(i[a])}))}function Zb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return ab(a.id)===c}),m="y2"===c?Sh:Jh,n="y2"===c?Rh:Ih,o=b(m)?m:Xb(l),p=b(n)?n:Yb(l),q="y2"===c?Th:Kh,r=zd()&&oh;return 0===l.length?"y2"===c?yg.domain():xg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=Ad(o,p),j=cc(xg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Oh&&(f=b(Oh.top)?Oh.top:e,g=b(Oh.bottom)?Oh.bottom:e),"y2"===c&&Xh&&(f=b(Xh.top)?Xh.top:e,g=b(Xh.bottom)?Xh.bottom:e),ge(l)&&!Tc(l)&&(g=o),[o-g,p+f])}function $b(a){return Ch?Ni?ze(Ch):Ch:If.min(a,function(a){return If.min(a.values,function(a){return a.x})})}function _b(a){return Bh?Ni?ze(Bh):Bh:If.max(a,function(a){return If.max(a.values,function(a){return a.x})})}function ac(a){var c,d,e,f,g=Dc(a),h=g[1]-g[0];return Oi?d=0:ge(a)?(c=Bc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Dh&&Ee(Dh)?(e=b(Dh.left)?Dh.left:d,f=b(Dh.right)?Dh.right:d):e=f="number"==typeof Dh?Dh:d,{left:e,right:f}}function bc(a){var b=[$b(a),_b(a)],c=b[0],d=b[1],e=ac(a),f=0,g=0;return c-d!==0||Oi||(c=Ni?new Date(.5*c.getTime()):-.5,d=Ni?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Ni?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Ni?new Date(d.getTime()+e.right):d+e.right),[f,g]}function cc(a){return a[1]-a[0]}function dc(a){for(var b=0;bb?0:b-c}function jc(a){var b,c=hc(a),d="y"===a.axis?xg:yg;return b="y"===a.axis||"y2"===a.axis?oh?dg:"start"in a?d(a.start):dg:oh?"end"in a?wg(Ni?ze(a.end):a.end):dg:dg,c>b?0:b-c}function kc(a){return Gg&&a===Gg||Ee(Hg)&&Fe(Hg,a)}function lc(a){return!kc(a)}function mc(a){return Gg?Gg:Ee(Hg)?Hg[a]:null}function nc(a,b){var c,d=b&&Ee(b)?Ec(b):[];return d.forEach(function(b){mc(b)===a&&(c=Jf.data.xs[b])}),c}function oc(a,b){return a in Jf.data.xs&&Jf.data.xs[a]&&Jf.data.xs[a][b]?Jf.data.xs[a][b]:b}function pc(a){Object.keys(a).forEach(function(b){Hg[b]=a[b]})}function qc(a){return 1===If.set(Object.keys(a).map(function(b){return a[b]})).size()}function rc(a){var b;return a&&(b=Kg[a.id],a.name=b?b:a.id),a}function sc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=uc(b[d],a.id,d)}),Jf.data.xs[a.id]=b})}function tc(a,b){a.forEach(function(a){b[a.id]&&sc([a],b[a.id])})}function uc(a,c,d){var e;return e=Ni?a?a instanceof Date?a:ze(a):ze(oc(c,d)):Pi&&!Oi?b(a)?+a:oc(c,d):d}function vc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Jf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Gg?(d=Object.keys(Jf.data.xs),Jf.data.xs[c]=d.length>0?Jf.data.xs[d[0]]:void 0):Ee(Hg)&&(Jf.data.xs[c]=nc(f,Jf.data.targets)):Jf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Jf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Jg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=mc(b),g=a[f],h=uc(g,b,e);return Pi&&Oi&&0===c&&g&&(0===e&&(sh=[]),sh.push(g)),("undefined"==typeof a[b]||Jf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Og&&ee(Ec(c).filter(function(a){return!(a in Pg)}),Og),c.forEach(function(a){ec(a.id_org,a)}),c}function yc(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 zc(a){return a>0&&Jf.data.targets[0].values[a-1]?Jf.data.targets[0].values[a-1].x:void 0}function Ac(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Dc(a){var b,c,d=Cc(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Ec(a){return a.map(function(a){return a.id})}function Fc(a){return a?"string"==typeof a?[a]:a:Ec(Jf.data.targets)}function Gc(a,b){var c,d=Ec(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Ni?new Date(i):i);j.push(e)}return Ni||(j=j.sort(function(a,b){return a-b})),j}function Nc(a){Zi=Zi.concat(a)}function Oc(a){Zi=Zi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){$i=$i.concat(a)}function Qc(a){$i=$i.filter(function(b){return a.indexOf(b)<0})}function Rc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Sc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Uc(a){return Sc(a,function(a){return a>0})}function Vc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],(a[f].x||0===a[f].x)&&(e=e.concat(Ld(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Ld(a,g))),Od(e,b)):Md(a,b,f,g)}function Nd(a,b){var c;return c=a.map(function(a){return Md(a.values,b)}),Od(c,b)}function Od(a,b){var c,d;return a.forEach(function(a){var e=Ge(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Pd(a,b){return If.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Qd(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 Rd(){return Rg&&"desc"===Rg.toLowerCase()}function Sd(){return Rg&&"asc"===Rg.toLowerCase()}function Td(a){var b=Sd(),c=Rd();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof Rg&&a.sort(Rg),a}function Ud(a,c){var d,e,f,g,h,i,j,k=ke(Jf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&Ai&&(wj.html(Di(a,bb(),Bd(k),Wi)).style("display","block"),d=wj.property("offsetWidth"),e=wj.property("offsetHeight"),k?(g=bg/2+c[0],i=dg/2+c[1]+20):(oh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-w(),i=wg(l[0].x)+20):(f=s(),g=f+v()+wg(l[0].x)+20,h=g+d,j=f+t()-w(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),wj.style("top",i+"px").style("left",g+"px"))}function Vd(){wj.style("display","none")}function Wd(a){var c=a.filter(function(a){return a&&b(a.value)});if(Ai&&!he(Jf.data.targets)&&!ke(Jf.data.targets)){var d=tj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(oh?"y1":"x1",Hd).attr(oh?"y2":"x2",Hd),mf(d,"grid")}}function Xd(){tj.select("line."+g.xgridFocus).style("visibility","hidden")}function Yd(a,b){var c,d,e,f,h=[],i=tj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=bc(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function Zd(a){return a.x||0===a.x?wg(a.x):null}function $d(a){return Y(a.id)(a.value)}function _d(){var a,b,d={},e=0;return Kc(Hc(ne)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function de(a,b){return"number"==typeof ki?ki:b?2*a.tickOffset()*li/b:0}function ee(a,b){Fc(a).forEach(function(a){Aj[a]=b===Pg[a],Pg[a]=b})}function fe(a,b){var c=!1;return a.forEach(function(a){Pg[a.id]===b&&(c=!0),a.id in Pg||"line"!==b||(c=!0)}),c}function ge(a){return fe(a,"bar")}function he(a){return fe(a,"scatter")}function ie(a){return fe(a,"pie")}function je(a){return fe(a,"donut")}function ke(a){return ie(a)||je(a)}function le(a){var b="string"==typeof a?a:a.id;return!(b in Pg)||"line"===Pg[b]||"spline"===Pg[b]||"area"===Pg[b]||"area-spline"===Pg[b]}function me(a){var b="string"==typeof a?a:a.id;return"spline"===Pg[b]||"area-spline"===Pg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"bar"===Pg[b]}function oe(a){var b="string"==typeof a?a:a.id;return"scatter"===Pg[b]}function pe(a){var b="string"==typeof a?a:a.id;return"pie"===Pg[b]}function qe(a){var b="string"==typeof a?a:a.id;return"donut"===Pg[b]}function re(a){return pe(a)||qe(a)}function se(a){return le(a)?[a]:[]}function te(a){return re(a.data)?[a]:[]}function ue(a){return ne(a)?a.values:[]}function ve(a){return le(a)||oe(a)?a.values:[]}function we(a){return ne(a)||le(a)?a.values:[]}function xe(a){return qe(a)&&ui||pe(a)&&oi}function ye(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ze(b){var c;try{c=Ig?If.time.format(Ig).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Ig)}return c}function Ae(a,b){var c=If.mouse(a),d=If.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Fe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Ge(a,b){var c="y"===ab(a.id)?xg:yg,d=oh?1:0,e=oh?0:1;return Math.pow(wg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function He(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ie(a,b,c){bh(b,a.node()),tj.select("."+g.selectedCircles+qd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Wc(g.selectedCircle,c)}).attr("cx",oh?$d:Zd).attr("cy",oh?Zd:$d).attr("stroke",function(){return Wi(b)}).attr("r",1.4*Te(b)).transition().duration(100).attr("r",Te)}function Je(a,b,c){ch(b,a.node()),tj.select("."+g.selectedCircles+qd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ke(a,b,c,d){a?Ie(b,c,d):Je(b,c,d)}function Le(a,b){bh(b,a.node()),a.transition().duration(100).style("fill",function(){return If.rgb(Wi(b)).brighter(.75)})}function Me(a,b){ch(b,a.node()),a.transition().duration(100).style("fill",function(){return Wi(b)})}function Ne(a,b,c,d){a?Le(b,c,d):Me(b,c,d)}function Oe(a,b,c,d){Ne(a,b,c.data,d)}function Pe(a){return"circle"===a.nodeName?Ke:If.select(a).classed(g.bar)?Ne:Oe}function Qe(a){return a.filter(function(a){return b(a.value)})}function Re(a){return di?"function"==typeof ei?ei(a):ei:0}function Se(a){return gi?hi?hi:1.75*Re(a):Re(a)}function Te(a){return ii?ii:4*Re(a)}function Ue(a,c){return(c?tj.selectAll("."+g.circles+qd(c)):tj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ve(a,b){Ue(a,b).classed(g.EXPANDED,!0).attr("r",Se)}function We(a){Ue(a).filter(function(){return If.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Re)}function Xe(a){return tj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function Ye(a){Xe(a).classed(g.EXPANDED,!0)}function Ze(a){Xe(a).classed(g.EXPANDED,!1)}function $e(a,b){var c=cf(a,b);return function(a,b){var d=c(a,b),e=oh?1:0,f=oh?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 _e(a,b){var c=cf(a,!1),d=b?af:bf;return function(a,b){return d(c(a,b),a,this)}}function af(a,b){var c;return oh?(c=ne(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function bf(a,b,c){var d=c.getBoundingClientRect();return oh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ne(b)?-3:-6)}function cf(a,b){var c=a.__max__+1,d=de(Cg,c),e=ae(d,c,a,!!b),f=be(!!b),g=ce(a,!!b),h=b?Z:Y;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return oh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function df(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function ef(b){var c,d,e;if(xj=If.select(Lf),xj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(xj.html("").classed("c3",!0),Jf.data.xs={},Jf.data.targets=xc(b),Vg&&Nc(Vg===!0?Ec(Jf.data.targets):Vg),p(),T(),wg.domain(If.extent(bc(Jf.data.targets))),xg.domain(Zb(Jf.data.targets,"y")),yg.domain(Zb(Jf.data.targets,"y2")),zg.domain(wg.domain()),Ag.domain(xg.domain()),Bg.domain(yg.domain()),yj=wg.domain(),mj.scale(zg),Sf&&qj.scale(wg),rj=xj.append("svg").on("mouseenter",Vf).on("mouseleave",Wf),sj=rj.append("defs"),sj.append("clipPath").attr("id",Hi).append("rect"),sj.append("clipPath").attr("id",Ii).append("rect"),sj.append("clipPath").attr("id",Ji).append("rect"),rf(),tj=rj.append("g").attr("transform",dj.main),uj=rj.append("g").attr("transform",dj.context),vj=rj.append("g").attr("transform",dj.legend),fh||uj.style("visibility","hidden"),ih||(vj.style("visibility","hidden"),$i=Ec(Jf.data.targets)),wj=If.select(Lf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Df(Ec(Jf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=tj.append("g").attr("clip-path",Ki).attr("class",g.grid),Zh&&d.append("g").attr("class",g.xgrids),Ee(_h)&&d.append("g").attr("class",g.xgridLines),fi&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),ai&&d.append("g").attr("class",g.ygrids),Ee(bi)&&d.append("g").attr("class",g.ygridLines),tj.append("g").attr("clip-path",Ki).attr("class",g.regions),tj.append("g").attr("clip-path",Ki).attr("class",g.chart),c=tj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Sf?oh?"ns-resize":"ew-resize":null),tj.select("."+g.chart).append("g").attr("class",g.chartBars),tj.select("."+g.chart).append("g").attr("class",g.chartLines),tj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",dj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Tb()),tj.select("."+g.chart).append("g").attr("class",g.chartTexts),Sf&&tj.insert("rect",Uf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",bg).attr("height",dg).style("opacity",0).style("cursor",oh?"ns-resize":"ew-resize").call(qj).on("dblclick.zoom",null),Fh&&mj.extent("function"!=typeof Fh?Fh:Fh(bc())),ph&&tj.append("g").attr("class",g.axisX).attr("clip-path",Li).attr("transform",dj.x).append("text").attr("class",g.axisXLabel).attr("transform",oh?"rotate(-90)":"").style("text-anchor",Cb),Hh&&tj.append("g").attr("class",g.axisY).attr("clip-path",Mi).attr("transform",dj.y).append("text").attr("class",g.axisYLabel).attr("transform",oh?"":"rotate(-90)").style("text-anchor",Db),Qh&&tj.append("g").attr("class",g.axisY2).attr("transform",dj.y2).append("text").attr("class",g.axisY2Label).attr("transform",oh?"":"rotate(-90)").style("text-anchor",Eb),uj.append("g").attr("clip-path",Ki).attr("class",g.chart),uj.select("."+g.chart).append("g").attr("class",g.chartBars),uj.select("."+g.chart).append("g").attr("class",g.chartLines),uj.append("g").attr("clip-path",Ki).attr("class",g.brush).call(mj).selectAll("rect").attr(oh?"width":"height",oh?cg:eg),uj.append("g").attr("class",g.axisX).attr("transform",dj.subx).attr("clip-path",oh?"":Li),tf(Jf.data.targets),oh?tj.select("."+g.axisX).style("opacity",0).call(Cg):(tj.select("."+g.axisY).style("opacity",0).call(Dg),tj.select("."+g.axisY2).style("opacity",0).call(Eg)),p(),T(),rf(),o(!1),nf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Ei){if(Ni&&"string"==typeof Fi){for(Fi=ze(Fi),e=0;e0){d=[];for(var f in Kg)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Qd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ne,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function kf(a){ke(Jf.data.targets)||Wg&&(Qi=a,tj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Ri=!0,dh())}function lf(){ke(Jf.data.targets)||Wg&&(tj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),tj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Ri=!1,eh())}function mf(a,b){"grid"===b&&a.each(function(){var a=If.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function nf(a){var c,e,f,h,i,j,k,l,m,n,o,p,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,O,P,Q,R,S,T,U,V,W,X,Y,Z,$,_=_d(),ab=ke(Jf.data.targets),bb=Kc(Jf.data.targets);if(a=d(a)?a:{},G=d(a.withY)?a.withY:!0,H=d(a.withSubchart)?a.withSubchart:!0,I=d(a.withTransition)?a.withTransition:!0,L=d(a.withTransform)?a.withTransform:!1,M=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,O=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,P=d(a.withLegend)?a.withLegend:!1,J=d(a.withTransitionForExit)?a.withTransitionForExit:I,K=d(a.withTransitionForAxis)?a.withTransitionForAxis:I,V=I?Zf:0,W=J?V:0,X=K?V:0,c=tj.select("."+g.axisX).style("opacity",ab?0:1),f=tj.select("."+g.axisY).style("opacity",ab?0:1),h=tj.select("."+g.axisY2).style("opacity",ab?0:1),e=uj.select("."+g.axisX).style("opacity",ab?0:1),U={axisX:c.transition().duration(X),axisY:f.transition().duration(X),axisY2:h.transition().duration(X),axisSubX:e.transition().duration(X)},P&&ih&&Df(Ec(Jf.data.targets),a,U),Oi&&0===bb.length&&wg.domain([0,c.selectAll(".tick").size()]),bb.length&&(O&&(wg.domain(If.extent(bc(bb))),yj=wg.domain(),Sf&&qj.scale(wg).updateScaleExtent(),zg.domain(wg.domain()),mj.scale(zg)),M&&(wg.domain(mj.empty()?yj:mj.extent()),Sf&&qj.scale(wg).updateScaleExtent()),zh||!yh&&!xh||(Y=Mc(Lc(bb),xh),Cg.tickValues(Y),Fg.tickValues(Y))),xg.domain(Zb(bb,"y")),yg.domain(Zb(bb,"y2")),U.axisX.call(Cg),U.axisY.call(Dg),U.axisY2.call(Eg),U.axisSubX.call(Fg),Gb(I),M&&bb.length)if(vh&&Y){for(Z=1;Z=0&&If.select(this).style("display",b%$?"none":"block")})}else rj.selectAll("."+g.axisX+" .tick text").style("display","block");!oh&&Ah&&hb(c,U.axisX,Ah),Q=$e(_),S=_e(_,!0),T=_e(_,!1),Ag.domain(xg.domain()),Bg.domain(yg.domain()),wj.style("display","none"),q(),tj.select("line."+g.xgridFocus).style("visibility","hidden"),Zh&&(k=Yd($h,wg),D=Oi?Cg.tickOffset():0,j=oh?{x1:0,x2:bg,y1:function(a){return wg(a)-D},y2:function(a){return wg(a)-D}}:{x1:function(a){return wg(a)+D},x2:function(a){return wg(a)+D},y1:$f.top,y2:dg},i=tj.select("."+g.xgrids).selectAll("."+g.xgrid).data(k),i.enter().append("line").attr("class",g.xgrid),i.attr(j).style("opacity",function(){return+If.select(this).attr(oh?"y1":"x1")===(oh?dg:0)?0:1}),i.exit().remove()),Ee(_h)&&(l=tj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(_h),m=l.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",oh?"":"rotate(-90)").attr("dx",oh?0:-$f.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(V).attr("x1",oh?0:Id).attr("x2",oh?bg:Id).attr("y1",oh?Id:$f.top).attr("y2",oh?Id:dg).style("opacity",1),l.select("text").transition().duration(V).attr("x",oh?bg:0).attr("y",Id).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(V).style("opacity",0).remove()),G&&ai&&(n=tj.select("."+g.ygrids).selectAll("."+g.ygrid).data(xg.ticks(ci)),n.enter().append("line").attr("class",g.ygrid),n.attr("x1",oh?xg:0).attr("x2",oh?xg:bg).attr("y1",oh?0:xg).attr("y2",oh?dg:xg),n.exit().remove(),mf(n,"grid")),G&&Ee(bi)&&(o=tj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(bi),p=o.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",oh?"rotate(-90)":"").attr("dx",oh?0:-$f.top).attr("dy",-5).style("opacity",0),o.select("line").transition().duration(V).attr("x1",oh?Jd:0).attr("x2",oh?Jd:bg).attr("y1",oh?0:Jd).attr("y2",oh?dg:Jd).style("opacity",1),o.select("text").transition().duration(V).attr("x",oh?0:bg).attr("y",Jd).text(function(a){return a.text}).style("opacity",1),o.exit().transition().duration(V).style("opacity",0).remove()),w=tj.select("."+g.regions).selectAll("."+g.region).data(zi),w.enter().append("g").attr("class",jd).append("rect").style("fill-opacity",0),w.selectAll("rect").transition().duration(V).attr("x",gc).attr("y",hc).attr("width",ic).attr("height",jc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),w.exit().transition().duration(V).style("fill-opacity",0).remove(),u=tj.selectAll("."+g.bars).selectAll("."+g.bar).data(ue),u.enter().append("path").attr("class",dd).style("stroke","none").style("fill",Wi),u.style("opacity",vd).transition().duration(V).attr("d",Q).style("fill",Wi).style("opacity",1),u.exit().transition().duration(W).style("opacity",0).remove(),r=tj.selectAll("."+g.lines).selectAll("."+g.line).data(se),r.enter().append("path").attr("class",_c).style("stroke",Wi),r.style("opacity",vd).transition().duration(V).attr("d",nj).style("stroke",Wi).style("opacity",1),r.exit().transition().duration(W).style("opacity",0).remove(),s=tj.selectAll("."+g.areas).selectAll("."+g.area).data(se),s.enter().append("path").attr("class",hd).style("fill",Wi).style("opacity",function(){return zj=+If.select(this).style("opacity"),0}),s.style("opacity",0).transition().duration(V).attr("d",oj).style("fill",Wi).style("opacity",zj),s.exit().transition().duration(W).style("opacity",0).remove(),t=tj.selectAll("."+g.circles).selectAll("."+g.circle).data(ve),t.enter().append("circle").attr("class",bd).attr("r",Re).style("fill",Wi),t.style("opacity",vd).transition().duration(V).style("opacity",xd).style("fill",Wi).attr("cx",oh?$d:Zd).attr("cy",oh?Zd:$d),t.exit().remove(),x=tj.selectAll("."+g.texts).selectAll("."+g.text).data(we),x.enter().append("text").attr("class",Xc).attr("text-anchor",function(a){return oh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",Wi).style("fill-opacity",0),x.text(function(a){return Gd(a.id)(a.value,a.id)}).style("fill-opacity",wd).transition().duration(V).attr("x",S).attr("y",T).style("fill",Wi).style("fill-opacity",yd),x.exit().transition().duration(W).style("fill-opacity",0).remove(),v=tj.selectAll("."+g.arcs).selectAll("."+g.arc).data(te),v.enter().append("path").attr("class",fd).style("fill",function(a){return Wi(a.data)}).style("cursor",function(a){return Yg(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Ui||(c=Hb(a),d=Nb(c),e=Vb(),Pb(c.data.id),zf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Hb(a),c=Nb(b),d=[c];Ud(d,If.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Ui||(c=Hb(a),d=Nb(c),e=Wb(),Qb(c.data.id),Af(),Vd(),e(d,b))}).on("click",function(a,b){var c=Hb(a),d=Nb(c),e=Ub();hf(this,a,b),e(d,b)}),v.attr("transform",L?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Ui=!0}).transition().duration(V).attrTween("d",function(a){var b,c=Hb(a);return c?(b=If.interpolate(this._current,c),this._current=b(0),function(a){return Kb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",L?"scale(1)":"").style("fill",function(a){return Wi(a.data)}).style("opacity",1).call(He,function(){Ui=!1}),v.exit().transition().duration(W).style("opacity",0).remove(),tj.selectAll("."+g.chartArc).select("text").attr("transform",Lb).style("opacity",0).transition().duration(V).text(Ob).style("opacity",function(a){return Ic(a.data.id)&&re(a.data)?1:0}),tj.select("."+g.chartArcsTitle).style("opacity",je(Jf.data.targets)?1:0),fh&&(If.event&&"zoom"===If.event.type&&mj.extent(wg.orgDomain()).update(),H&&(!oh&&Ah&&hb(e,U.axisSubX,Ah),mj.empty()||mj.extent(wg.orgDomain()).update(),R=$e(_,!0),z=uj.selectAll("."+g.bars).selectAll("."+g.bar).data(ue),z.enter().append("path").attr("class",dd).style("stroke","none").style("fill",Wi),z.style("opacity",vd).transition().duration(V).attr("d",R).style("opacity",1),z.exit().transition().duration(V).style("opacity",0).remove(),y=uj.selectAll("."+g.lines).selectAll("."+g.line).data(se),y.enter().append("path").attr("class",_c).style("stroke",Wi),y.style("opacity",vd).transition().duration(V).attr("d",pj).style("opacity",1),y.exit().transition().duration(V).style("opacity",0).remove())),tj.selectAll("."+g.selectedCircles).filter(function(a){return ne(a)}).selectAll("circle").remove(),tj.selectAll("."+g.selectedCircle).transition().duration(V).attr("cx",oh?$d:Zd).attr("cy",oh?Zd:$d),A=tj.select("."+g.eventRects),Ee(Hg)&&!qc(Hg)?(A.classed(g.eventRectsMultiple)||A.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),B=tj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),gf(B.enter()),B.attr("x",0).attr("y",0).attr("width",bg).attr("height",dg)):(A.classed(g.eventRectsSingle)||A.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Pi&&!Oi?(F=function(a,b){var c=zc(b),d=Ac(b),e=Jf.data.xs[a.id][b];return(wg(d?d:e+50)-wg(c?c:e-50))/2},E=function(a,b){var c=zc(b),d=Jf.data.xs[a.id][b];return(wg(d)+wg(c?c:d-50))/2}):(F=N(),E=function(a){return wg(a.x)-F/2}),C=Cc(Jf.data.targets),tj.select("."+g.eventRects).datum(C?C.values:[]),B=tj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),ff(B.enter()),B.attr("class",kd).attr("x",oh?0:E).attr("y",oh?E:0).attr("width",oh?bg:F).attr("height",oh?F:dg),B.exit().remove()),Ec(Jf.data.targets).forEach(function(a){Aj[a]=!0})}function of(){nf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function pf(){if(0!==Kc(Jf.data.targets).length){if("mousemove"===If.event.sourceEvent.type&&qj.altDomain)return wg.domain(qj.altDomain),void qj.scale(wg).updateScaleExtent();Oi&&wg.orgDomain()[0]===yj[0]&&wg.domain([yj[0]-1e-10,wg.orgDomain()[1]]),nf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===If.event.sourceEvent.type&&(Si=!0)}}function qf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function rf(){rj.attr("width",fg).attr("height",gg),rj.select("#"+Hi).select("rect").attr("width",bg).attr("height",dg),rj.select("#"+Ii).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),rj.select("#"+Ji).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),rj.select("."+g.zoomRect).attr("width",bg).attr("height",dg),xj.style("max-height",gg+"px")}function sf(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,p(),T(),rf(),o(a.withTransition),nf(a)}function tf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=tj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",md),j=i.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Yc),e=tj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",od),d=e.enter().append("g").attr("class",od).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",ed).style("cursor",function(a){return Yg(a)?"pointer":null}),c=tj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",nd),b=c.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",ad),b.append("g").attr("class",id),b.append("g").attr("class",function(a){return Wc(g.selectedCircles,a.id)}),b.append("g").attr("class",cd).style("cursor",function(a){return Yg(a)?"pointer":null}),a.forEach(function(a){tj.selectAll("."+g.selectedCircles+qd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=tj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(ng(a)).attr("class",pd),f=h.enter().append("g").attr("class",pd),f.append("g").attr("class",gd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),fh&&(n=uj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",od),m=n.enter().append("g").style("opacity",0).attr("class",od),m.append("g").attr("class",ed),l=uj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",nd),k=l.enter().append("g").style("opacity",0).attr("class",nd),k.append("g").attr("class",ad)),rj.selectAll("."+g.target).filter(function(a){return Ic(a.id)}).transition().duration(Zf).style("opacity",1)}function uf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?ee(a.id,b.types[a.id]):ee(a.id,b.type)}),Jf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=ej?j:i,l=ej?S():R();return d&&(w=0,C=0,t=0,u=0),ih&&!Jc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=ej?u:t,void(nh?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=vj.selectAll("."+g.legendItemFocused).size();b=b||{},n=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,ej?(f=function(a){return t*B[a]},j=function(a){return A[B[a]]+x[a]}):(f=function(a){return A[B[a]]+x[a]},j=function(a){return u*B[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=vj.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Wc(g.legendItem,a)}).style("visibility",function(a){return Jc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof kh?kh(a):Jf.toggle(a)}).on("mouseover",function(a){If.select(this).classed(g.legendItemFocused,!0),Ui||Jf.focus(a),"function"==typeof lh&&lh(a)}).on("mouseout",function(a){If.select(this).classed(g.legendItemFocused,!1),Ui||Jf.revert(),"function"==typeof mh&&mh(a)}),m.append("text").text(function(a){return d(Kg[a])?Kg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",ej?h:-200).attr("y",ej?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",ej?i:-200).attr("y",ej?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",Wi).attr("x",ej?h:-200).attr("y",ej?-200:j).attr("width",10).attr("height",10),vj.selectAll("text").data(a).text(function(a){return d(Kg[a])?Kg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(n?250:0).attr("x",h).attr("y",k),vj.selectAll("rect."+g.legendItemEvent).data(a).transition().duration(n?250:0).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}).attr("x",i).attr("y",l),vj.selectAll("rect."+g.legendItemTile).data(a).transition().duration(n?250:0).style("fill",Wi).attr("x",f).attr("y",j),vj.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Ic(a)}).transition().style("opacity",function(a){var b=If.select(this);return Ic(a)?!D||b.classed(g.legendItemFocused)?xf(b):yf(b):ij}),P(t),Q(u),O(C),p(),T(),rf(),o(q,c)}function Ef(a){return Gc(Jf.data.targets,a.id)}function Ff(a){return"data"in a&&Gc(Jf.data.targets,a.data.id)}function Gf(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 Hf(a,b,c){var d=!ke(Jf.data.targets);Ui=!1,ee(a,b),sf(c||{withTransitionForAxis:d})}var If=a.d3?a.d3:a.require?a.require("d3"):void 0,Jf={data:{},axis:{},legend:{}},Kf={},Lf=i(["bindto"],"#chart"),Mf=i(["size","width"]),Nf=i(["size","height"]),Of=i(["padding","left"],50),Pf=i(["padding","right"],0),Qf=i(["padding","top"],0),Rf=i(["padding","bottom"],0),Sf=i(["zoom","enabled"],!1),Tf=i(["zoom","extent"]),Uf=i(["zoom","privileged"],!1),Vf=i(["onenter"],function(){}),Wf=i(["onleave"],function(){}),Xf=i(["onresize"],function(){}),Yf=i(["onresized"],function(){}),Zf=i(["transition","duration"],350);h("data","data is required in config");var $f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg=i(["data","x"]),Hg=i(["data","xs"],{}),Ig=i(["data","x_format"]),Jg=i(["data","id_converter"],function(a){return a}),Kg=i(["data","names"],{}),Lg=i(["data","classes"],{}),Mg=i(["data","groups"],[]),Ng=i(["data","axes"],{}),Og=i(["data","type"]),Pg=i(["data","types"],{}),Qg=i(["data","labels"],{}),Rg=i(["data","order"]),Sg=i(["data","regions"],{}),Tg=i(["data","color"]),Ug=i(["data","colors"],{}),Vg=i(["data","hide"],!1),Wg=i(["data","selection","enabled"],!1),Xg=i(["data","selection","grouped"],!1),Yg=i(["data","selection","isselectable"],function(){return!0}),Zg=i(["data","selection","multiple"],!0),$g=i(["data","onclick"],function(){}),_g=i(["data","onenter"],function(){}),ah=i(["data","onleave"],function(){}),bh=i(["data","onselected"],function(){}),ch=i(["data","onunselected"],function(){}),dh=i(["data","ondragstart"],function(){}),eh=i(["data","ondragend"],function(){}),fh=i(["subchart","show"],!1),gh=i(["subchart","size","height"],60),hh=i(["color","pattern"],[]),ih=i(["legend","show"],!0),jh=i(["legend","position"],"bottom"),kh=i(["legend","item","onclick"]),lh=i(["legend","item","onmouseover"]),mh=i(["legend","item","onmouseout"]),nh=i(["legend","equally"],!1),oh=i(["axis","rotated"],!1),ph=i(["axis","x","show"],!0),qh=i(["axis","x","type"],"indexed"),rh=i(["axis","x","localtime"],!0),sh=i(["axis","x","categories"],[]),th=i(["axis","x","tick","centered"],!1),uh=i(["axis","x","tick","format"]),vh=i(["axis","x","tick","culling"],{}),wh=i(["axis","x","tick","culling","max"],10),xh=i(["axis","x","tick","count"]),yh=i(["axis","x","tick","fit"],!0),zh=i(["axis","x","tick","values"],null),Ah=i(["axis","x","tick","rotate"]),Bh=i(["axis","x","max"],null),Ch=i(["axis","x","min"],null),Dh=i(["axis","x","padding"],{}),Eh=i(["axis","x","height"]),Fh=i(["axis","x","default"]),Gh=i(["axis","x","label"],{}),Hh=i(["axis","y","show"],!0),Ih=i(["axis","y","max"]),Jh=i(["axis","y","min"]),Kh=i(["axis","y","center"]),Lh=i(["axis","y","label"],{}),Mh=i(["axis","y","inner"],!1),Nh=i(["axis","y","tick","format"]),Oh=i(["axis","y","padding"]),Ph=i(["axis","y","ticks"],10),Qh=i(["axis","y2","show"],!1),Rh=i(["axis","y2","max"]),Sh=i(["axis","y2","min"]),Th=i(["axis","y2","center"]),Uh=i(["axis","y2","label"],{}),Vh=i(["axis","y2","inner"],!1),Wh=i(["axis","y2","tick","format"]),Xh=i(["axis","y2","padding"]),Yh=i(["axis","y2","ticks"],10),Zh=i(["grid","x","show"],!1),$h=i(["grid","x","type"],"tick"),_h=i(["grid","x","lines"],[]),ai=i(["grid","y","show"],!1),bi=i(["grid","y","lines"],[]),ci=i(["grid","y","ticks"],10),di=i(["point","show"],!0),ei=i(["point","r"],2.5),fi=i(["point","focus","line","enabled"],!0),gi=i(["point","focus","expand","enabled"],!0),hi=i(["point","focus","expand","r"]),ii=i(["point","focus","select","r"]),ji=i(["line","connect_null"],!1),ki=i(["bar","width"]),li=i(["bar","width","ratio"],.6),mi=i(["pie","label","show"],!0),ni=i(["pie","label","format"]),oi=i(["pie","expand"],!0),pi=i(["pie","onclick"],function(){}),qi=i(["pie","onmouseover"],function(){}),ri=i(["pie","onmouseout"],function(){}),si=i(["donut","label","show"],!0),ti=i(["donut","label","format"]),ui=i(["donut","expand"],!0),vi=i(["donut","title"],""),wi=i(["donut","onclick"],function(){}),xi=i(["donut","onmouseover"],function(){}),yi=i(["donut","onmouseout"],function(){}),zi=i(["regions"],[]),Ai=i(["tooltip","show"],!0),Bi=i(["tooltip","format","title"]),Ci=i(["tooltip","format","value"]),Di=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Bi?Bi:b,l=Ci?Ci:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Ei=i(["tooltip","init","show"],!1),Fi=i(["tooltip","init","x"],0),Gi=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Hi=("string"==typeof Lf?Lf.replace("#",""):Lf.id)+"-clip",Ii=Hi+"-xaxis",Ji=Hi+"-yaxis",Ki=j(Hi),Li=j(Ii),Mi=j(Ji),Ni="timeseries"===qh,Oi="categorized"===qh,Pi=!Ni&&(Gg||Ee(Hg)),Qi=null,Ri=!1,Si=!1,Ti=!1,Ui=!1,Vi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Wi=ye(Ug,Ee(hh)?hh:Vi,Tg),Xi=rh?If.time.format:If.time.format.utc,Yi=Xi.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),Zi=[],$i=[],_i=oh?"left":"bottom",aj=oh?Mh?"top":"bottom":Mh?"right":"left",bj=oh?Vh?"bottom":"top":Vh?"left":"right",cj=oh?"left":"bottom",dj={main:function(){return"translate("+k($f.left)+","+k($f.top)+")"},context:function(){return"translate("+k(_f.left)+","+k(_f.top)+")"},legend:function(){return"translate("+ag.left+","+ag.top+")"},x:function(){return"translate(0,"+(oh?0:dg)+")"},y:function(){return"translate(0,"+(oh?dg:0)+")"},y2:function(){return"translate("+(oh?0:bg)+","+(oh?1:0)+")"},subx:function(){return"translate(0,"+(oh?0:eg)+")"},arc:function(){return"translate("+bg/2+","+dg/2+")"}},ej="right"===jh,fj=0,gj=0,hj=0,ij=.15,jj=30,kj=oh&&!ph?0:30,lj=5;ng=If.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value -},0)});var mj,nj=function(){var a=If.svg.line().x(oh?function(a){return Y(a.id)(a.value)}:Hd).y(oh?Hd:function(a){return Y(a.id)(a.value)});return ji||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ji?Qe(b.values):b.values;return le(b)?(a.interpolate(me(b)?"cardinal":"linear"),Sg[b.id]?df(e,wg,Y(b.id),Sg[b.id]):a(e)):(c=e[0]?wg(e[0].x):0,d=e[0]?Y(b.id)(e[0].value):0,oh?"M "+d+" "+c:"M "+c+" "+d)}}(),oj=function(){var a;return a=oh?If.svg.area().x0(function(a){return Y(a.id)(0)}).x1(function(a){return Y(a.id)(a.value)}).y(Hd):If.svg.area().x(Hd).y0(function(a){return Y(a.id)(0)}).y1(function(a){return Y(a.id)(a.value)}),function(b){var c,d,e=Qe(b.values);return fe([b],"area")||fe([b],"area-spline")?(a.interpolate(me(b)?"cardinal":"linear"),a(e)):(c=e[0]?wg(e[0].x):0,d=e[0]?Y(b.id)(e[0].value):0,oh?"M "+d+" "+c:"M "+c+" "+d)}}(),pj=function(){var a=If.svg.line().x(oh?function(a){return Z(a.id)(a.value)}:Kd).y(oh?Kd:function(a){return Z(a.id)(a.value)});return function(b){var c=Qe(b.values);return le(b)?a(c):"M "+zg(c[0].x)+" "+Z(b.id)(c[0].value)}}(),qj=function(){};mj=If.svg.brush().on("brush",of),mj.update=function(){return uj&&uj.select("."+g.brush).call(this),this},mj.scale=function(a){return oh?this.y(a):this.x(a)},Sf&&(qj=If.behavior.zoom().on("zoomstart",function(){qj.altDomain=If.event.sourceEvent.altKey?wg.orgDomain():null}).on("zoom",Sf?pf:null),qj.scale=function(a){return oh?this.y(a):this.x(a)},qj.orgScaleExtent=function(){var a=Tf?Tf:[1,10];return[a[0],Math.max(Bc()/a[1],a[1])]},qj.updateScaleExtent=function(){var a=cc(wg.orgDomain())/cc(yj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var rj,sj,tj,uj,vj,wj,xj,yj,zj,Aj={};if(Jf.focus=function(a){function b(a){Kc(a).transition().duration(100).style("opacity",1)}var c=rj.selectAll(rd(a)),d=c.filter(Ef),e=c.filter(Ff);Jf.revert(),Jf.defocus(),b(d.classed(g.focused,!0)),b(e),ke(Jf.data.targets)&&Pb(a,!0),zf(a,!0)},Jf.defocus=function(a){function b(a){Kc(a).transition().duration(100).style("opacity",.3)}var c=rj.selectAll(rd(a)),d=c.filter(Ef),e=c.filter(Ff);Jf.revert(),b(d.classed(g.focused,!1)),b(e),ke(Jf.data.targets)&&Qb(a),zf(a,!1)},Jf.revert=function(a){function b(a){Kc(a).transition().duration(100).style("opacity",1)}var c=rj.selectAll(rd(a)),d=c.filter(Ef),e=c.filter(Ff);b(d.classed(g.focused,!1)),b(e),ke(Jf.data.targets)&&Qb(a),Af()},Jf.show=function(a,b){a=Fc(a),b=b||{},Oc(a),rj.selectAll(sd(a)).transition().style("opacity",1),b.withLegend&&Bf(a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Jf.hide=function(a,b){a=Fc(a),b=b||{},Nc(a),rj.selectAll(sd(a)).transition().style("opacity",0),b.withLegend&&Cf(a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Jf.toggle=function(a){Ic(a)?Jf.hide(a):Jf.show(a)},Jf.unzoom=function(){mj.clear().update(),nf({withUpdateXDomain:!0})},Jf.load=function(a){return a.xs&&pc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Lg[b]=a.classes[b]}),"categories"in a&&Oi&&(sh=a.categories,Cg.categories(sh)),"cacheIds"in a&&dc(a.cacheIds)?void uf(fc(a.cacheIds),a.done):void("unload"in a?wf(Fc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){vf(a)}):vf(a))},Jf.unload=function(a,b){wf(Fc(a),function(){nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Jf.selected=function(a){return If.merge(tj.selectAll("."+g.shapes+qd(a)).selectAll("."+g.shape).filter(function(){return If.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Jf.select=function(a,b,c){Wg&&tj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=If.select(this),i=e.data?e.data.id:e.id,j=Pe(this),k=Xg||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);"path"!==this.nodeName&&(k&&l?Yg(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},Jf.unselect=function(a,b){Wg&&tj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=If.select(this),f=c.data?c.data.id:c.id,h=Pe(this),i=Xg||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);"path"!==this.nodeName&&i&&j&&Yg(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Jf.toLine=function(a){Hf(a,"line")},Jf.toSpline=function(a){Hf(a,"spline")},Jf.toBar=function(a){Hf(a,"bar")},Jf.toScatter=function(a){Hf(a,"scatter")},Jf.toArea=function(a){Hf(a,"area")},Jf.toAreaSpline=function(a){Hf(a,"area-spline")},Jf.toPie=function(a){Hf(a,"pie",{withTransform:!0})},Jf.toDonut=function(a){Hf(a,"donut",{withTransform:!0})},Jf.groups=function(a){return c(a)?Mg:(Mg=a,nf(),Mg)},Jf.xgrids=function(a){return a?(_h=a,nf(),_h):_h},Jf.xgrids.add=function(a){return a?Jf.xgrids(_h.concat(a)):void 0},Jf.xgrids.remove=function(a){var b=Gf(a);return Jf.xgrids(_h.filter(b))},Jf.ygrids=function(a){return a?(bi=a,nf(),bi):bi},Jf.ygrids.add=function(a){return a?Jf.ygrids(bi.concat(a)):void 0},Jf.ygrids.remove=function(a){var b=Gf(a);return Jf.ygrids(bi.filter(b))},Jf.regions=function(a){return c(a)?zi:(zi=a,nf(),zi)},Jf.regions.add=function(a){return c(a)?zi:(zi=zi.concat(a),nf(),zi)},Jf.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;rj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),zi=zi.filter(function(b){return b.classes.indexOf(a)<0})}),zi},Jf.data.get=function(a){var b=Jf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Jf.data.getAsTarget=function(a){var b=Hc(function(b){return b.id===a});return b.length>0?b[0]:void 0},Jf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Kg[b]=a[b]}),nf({withLegend:!0}),Kg):Kg},Jf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Ug[b]=a[b]}),nf({withLegend:!0}),Ug):Ug},Jf.x=function(a){return arguments.length&&(sc(Jf.data.targets,a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Jf.data.xs},Jf.xs=function(a){return arguments.length&&(tc(Jf.data.targets,a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Jf.data.xs},Jf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){eb(b,a[b])}),Gb())},Jf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Bh=+a.x),b(a.y)&&(Ih=+a.y),b(a.y2)&&(Rh=+a.y2)):Ih=Rh=+a,nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Jf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Ch=+a.x),b(a.y)&&(Jh=+a.y),b(a.y2)&&(Sh=+a.y2)):Jh=Sh=+a,nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Jf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Jf.axis.max(a.max),"undefined"!=typeof a.min&&Jf.axis.min(a.min))},Jf.legend.show=function(a){Bf(Fc(a)),nf({withLegend:!0})},Jf.legend.hide=function(a){Cf(Fc(a)),nf({withLegend:!0})},Jf.resize=function(a){Mf=a?a.width:null,Nf=a?a.height:null,sf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Jf.destroy=function(){Jf.data.targets=void 0,Jf.data.xs={},xj.html(""),a.onresize=null},"url"in f.data)If.xhr(f.data.url,function(a,b){var c,d=If.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=If.csv.parse(b.response),ef(c)});else if("rows"in f.data)ef(vc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");ef(wc(f.data.columns))}return Jf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(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}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.ceil(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.ceil(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&acg&&(cg=0),0>eg&&(eg=0),dg=rh?_f.left-nj-oj:cg,fg=rh?eg:hg-ag.top-ag.bottom,0>dg&&(dg=0),0>fg&&(fg=0),lg=cg-(ij?b+10:0),mg=eg-(ij?0:10),r(),ij&&d&&(bg.left=lg/2+1.1*jg)}function q(){xj.select("line."+g.xgridFocus).attr("x1",rh?0:-10).attr("x2",rh?cg:-10).attr("y1",rh?-10:_f.top).attr("y2",rh?-10:eg)}function r(){jg=Math.min(lg,mg)/2,ig=.95*jg,kg=je(Kf.data.targets)?.6*ig:0}function s(){var a=rh?g.axisX:g.axisY,b=xj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Jf.select(Mf).node().getBoundingClientRect(),e=ke(Kf.data.targets),f=c.right-d.left-(e?0:v());return f>0?f:0}function t(){return Nf?Nf:z()}function u(){var a=Of?Of:A();return a>0?a:320}function v(){var a=1;return Pf?Pf:rh?sh?x("x"):a:!Kh||Ph?a:x("y")}function w(){var a=1;return Qf?Qf:ij?R()+20+(Th&&!rh?x("y2"):a):Th?Yh||rh?a:x("y2"):a}function x(a){var b=mb(a);return b.isInner?20+Fb(a):40+Fb(a)}function y(a){return"x"!==a||sh?"x"===a&&Hh?Hh:"y"!==a||Kh?"y2"!==a||Th?(mb(a).isInner?30:40)+("y2"===a?-10:0):pj:lh&&!ij?10:1:0}function z(){return+Jf.select(Mf).style("width").replace("px","")}function A(){return+Jf.select(Mf).style("height").replace("px","")}function B(a){return a?-31:-(_f.left-1)}function C(a){return a?-20:-4}function D(){return B(!rh)}function E(){return C(!rh)}function F(){return B(rh)}function G(){return C(rh)}function H(a){return a?cg+2+30+30:_f.left+20}function I(a){return a?(Hh?Hh:0)+80:eg+8}function J(){return H(!rh)}function K(){return I(!rh)}function L(){return H(rh)}function M(){return I(rh)}function N(){var a,b,c,d,e,f=Cc(Kf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=zg(b.x)-zg(a.x),0===c?rh?eg:cg:(d=Bc(),e=ge(Kf.data.targets)?(d-(Ri?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function O(a){jj=a}function P(a){kj=a}function Q(a){lj=a}function R(){return lh?ij?kj*(jj+1):gg:0}function S(){return lh?ij?hg:lj*(jj+1):0}function T(){var a,b,c=!zg;rg=rh?1:0,sg=rh?eg:cg,tg=rh?0:eg,ug=rh?cg:1,vg=rg,wg=sg,xg=rh?0:fg,yg=rh?dg:1,zg=W(rg,sg,c?void 0:zg.domain(),function(){return Fg.tickOffset()}),Ag=X(tg,ug,c?void 0:Ag.domain()),Bg=X(tg,ug,c?void 0:Bg.domain()),Cg=W(rg,sg,Cj,function(a){return a%1?0:Ig.tickOffset()}),Dg=X(xg,yg,c?void 0:Dg.domain()),Eg=X(xg,yg,c?void 0:Eg.domain()),a=bb(),b=Ch?Ch:c?void 0:Fg.tickValues(),Fg=$(zg,dj,a,b),Ig=$(Cg,gj,a,b),Gg=_(Ag,ej,Qh,Sh),Hg=_(Bg,fj,Zh,_h),c||(qj.scale(Cg),Tf&&uj.scale(zg)),U()}function U(){ng=Ib(),og=Jb(),pg=Jb(.98)}function V(a,b,c){return(c?Jf.time.scale():Jf.scale.linear()).range([a,b])}function W(a,b,c,d){var e,f=V(a,b,Qi),g=c?f.domain(c):f;Ri?(d=d||function(){return 0},f=function(a,b){var c=g(a)+d(a);return b?c:Math.ceil(c)}):f=function(a,b){var c=g(a);return b?c:Math.ceil(c)};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return Cj&&Cj[0]===a[0]&&Cj[1]a?a.toFixed(0):a};return xh&&("function"==typeof xh?a=xh:Qi&&(a=function(a){return a?$i(xh)(a):""})),a}function cb(a){var b;return"y"===a?b=Oh:"y2"===a?b=Xh:"x"===a&&(b=Jh),b}function db(a){var b=cb(a);return"string"==typeof b?b:b?b.text:null}function eb(a,b){var c=cb(a);"string"==typeof c?"y"===a?Oh=b:"y2"===a?Xh=b:"x"===a&&(Jh=b):c&&(c.text=b)}function fb(a){return 10*Math.sin(Math.PI*(a/180))}function gb(a){return 11.5-2.5*(a/15)}function hb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",gb(c)).attr("x",fb(c)).attr("transform","rotate("+c+")")}function ib(a,b){var c=cb(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 jb(){return ib("x",rh?"inner-top":"inner-right")}function kb(){return ib("y",rh?"inner-right":"inner-top")}function lb(){return ib("y2",rh?"inner-right":"inner-top")}function mb(a){return"y2"===a?lb():"y"===a?kb():jb()}function nb(){return db("x")}function ob(){return db("y")}function pb(){return db("y2")}function qb(a,b){return a?b.isLeft?0:b.isCenter?cg/2:cg:b.isBottom?-eg:b.isMiddle?-eg/2:0}function rb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function sb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function tb(){return qb(!rh,jb())}function ub(){return qb(rh,kb())}function vb(){return qb(rh,lb())}function wb(){return rb(!rh,jb())}function xb(){return rb(rh,kb())}function yb(){return rb(rh,lb())}function zb(){var a=jb();return rh?a.isInner?"1.2em":-25-Fb("x"):a.isInner?"-0.5em":Hh?Hh-10:"3em"}function Ab(){var a=kb();return rh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Fb("y")}function Bb(){var a=lb();return rh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Fb("y2")}function Cb(){return sb(!rh,jb())}function Db(){return sb(rh,kb())}function Eb(){return sb(rh,lb())}function Fb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Jf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Gb(a){var b=xj.select("."+g.axisX+" ."+g.axisXLabel),c=xj.select("."+g.axisY+" ."+g.axisYLabel),d=xj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",tb).attr("dx",wb).attr("dy",zb).text(nb),(a?c.transition():c).attr("x",ub).attr("dx",xb).attr("dy",Ab).attr("dy",Ab).text(ob),(a?d.transition():d).attr("x",vb).attr("dx",yb).attr("dy",Bb).text(pb)}function Hb(a){var b=!1;return qg(Kc(Kf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Ib(){var a=Jf.svg.arc().outerRadius(ig).innerRadius(kg),b=function(b,c){var d;return c?a(b):(d=Hb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Jb(a){var b=Jf.svg.arc().outerRadius(jg*(a?a:1)).innerRadius(kg);return function(a){var c=Hb(a);return c?b(c):"M 0 0"}}function Kb(a,b){return re(a.data)?ng(a,b):"M 0 0"}function Lb(a){var b,c,d,e,f=Hb(a),g="";return f&&(b=ng.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*ig*.8+","+d/e*ig*.8+")"),g}function Mb(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Nb(a){return rc({id:a.data.id,value:a.value,ratio:Mb(a)})}function Ob(a){var b,c,d,e;return Rb()?(b=Hb(a),c=b?b.value:null,d=Mb(b),e=Sb(),e?e(c,d):Fd(c,d)):""}function Pb(a,b){var c=vj.selectAll("."+g.chartArc+rd(a)),d=vj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});xe(a)&&c.selectAll("path").transition().duration(50).attr("d",og).transition().duration(100).attr("d",pg).each(function(a){qe(a.data)}),b||d.style("opacity",.3)}function Qb(a){var b=vj.selectAll("."+g.chartArc+rd(a));b.selectAll("path").transition().duration(50).attr("d",ng),vj.selectAll("."+g.arc).style("opacity",1)}function Rb(){return je(Kf.data.targets)?vi:pi}function Sb(){return je(Kf.data.targets)?wi:qi}function Tb(){return je(Kf.data.targets)?yi:""}function Ub(){var a=je(Kf.data.targets)?zi:si;return"function"==typeof a?a:function(){}}function Vb(){var a=je(Kf.data.targets)?Ai:ti;return"function"==typeof a?a:function(){}}function Wb(){var a=je(Kf.data.targets)?Bi:ui;return"function"==typeof a?a:function(){}}function Xb(a){var b,c,d,e,f,g,h=Ec(a),i=Rc(a);if(Pg.length>0)for(g=Tc(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 Jf.min(Object.keys(i).map(function(a){return Jf.min(i[a])}))}function Yb(a){var b,c,d,e,f,g,h=Ec(a),i=Rc(a);if(Pg.length>0)for(g=Uc(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 Jf.max(Object.keys(i).map(function(a){return Jf.max(i[a])}))}function Zb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return ab(a.id)===c}),m="y2"===c?Vh:Mh,n="y2"===c?Uh:Lh,o=b(m)?m:Xb(l),p=b(n)?n:Yb(l),q="y2"===c?Wh:Nh,r=zd()&&rh;return 0===l.length?"y2"===c?Bg.domain():Ag.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=Ad(o,p),j=cc(Ag.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Rh&&(f=b(Rh.top)?Rh.top:e,g=b(Rh.bottom)?Rh.bottom:e),"y2"===c&&$h&&(f=b($h.top)?$h.top:e,g=b($h.bottom)?$h.bottom:e),ge(l)&&!Tc(l)&&(g=o),[o-g,p+f])}function $b(a){return Fh?Qi?ze(Fh):Fh:Jf.min(a,function(a){return Jf.min(a.values,function(a){return a.x})})}function _b(a){return Eh?Qi?ze(Eh):Eh:Jf.max(a,function(a){return Jf.max(a.values,function(a){return a.x})})}function ac(a){var c,d,e,f,g=Dc(a),h=g[1]-g[0];return Ri?d=0:ge(a)?(c=Bc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Gh&&Ee(Gh)?(e=b(Gh.left)?Gh.left:d,f=b(Gh.right)?Gh.right:d):e=f="number"==typeof Gh?Gh:d,{left:e,right:f}}function bc(a){var b=[$b(a),_b(a)],c=b[0],d=b[1],e=ac(a),f=0,g=0;return c-d!==0||Ri||(c=Qi?new Date(.5*c.getTime()):-.5,d=Qi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Qi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Qi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function cc(a){return a[1]-a[0]}function dc(a){for(var b=0;bb?0:b-c}function jc(a){var b,c=hc(a),d="y"===a.axis?Ag:Bg;return b="y"===a.axis||"y2"===a.axis?rh?eg:"start"in a?d(a.start):eg:rh?"end"in a?zg(Qi?ze(a.end):a.end):eg:eg,c>b?0:b-c}function kc(a){return Jg&&a===Jg||Ee(Kg)&&Fe(Kg,a)}function lc(a){return!kc(a)}function mc(a){return Jg?Jg:Ee(Kg)?Kg[a]:null}function nc(a,b){var c,d=b&&Ee(b)?Ec(b):[];return d.forEach(function(b){mc(b)===a&&(c=Kf.data.xs[b])}),c}function oc(a,b){return a in Kf.data.xs&&Kf.data.xs[a]&&Kf.data.xs[a][b]?Kf.data.xs[a][b]:b}function pc(a){Object.keys(a).forEach(function(b){Kg[b]=a[b]})}function qc(a){return 1===Jf.set(Object.keys(a).map(function(b){return a[b]})).size()}function rc(a){var b;return a&&(b=Ng[a.id],a.name=b?b:a.id),a}function sc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=uc(b[d],a.id,d)}),Kf.data.xs[a.id]=b})}function tc(a,b){a.forEach(function(a){b[a.id]&&sc([a],b[a.id])})}function uc(a,c,d){var e;return e=Qi?a?a instanceof Date?a:ze(a):ze(oc(c,d)):Si&&!Ri?b(a)?+a:oc(c,d):d}function vc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Kf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Jg?(d=Object.keys(Kf.data.xs),Kf.data.xs[c]=d.length>0?Kf.data.xs[d[0]]:void 0):Ee(Kg)&&(Kf.data.xs[c]=nc(f,Kf.data.targets)):Kf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Kf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Mg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=mc(b),g=a[f],h=uc(g,b,e);return Si&&Ri&&0===c&&g&&(0===e&&(vh=[]),vh.push(g)),("undefined"==typeof a[b]||Kf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Rg&&ee(Ec(c).filter(function(a){return!(a in Sg)}),Rg),c.forEach(function(a){ec(a.id_org,a)}),c}function yc(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 zc(a){return a>0&&Kf.data.targets[0].values[a-1]?Kf.data.targets[0].values[a-1].x:void 0}function Ac(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Dc(a){var b,c,d=Cc(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Ec(a){return a.map(function(a){return a.id})}function Fc(a){return a?"string"==typeof a?[a]:a:Ec(Kf.data.targets)}function Gc(a,b){var c,d=Ec(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Qi?new Date(i):i);j.push(e)}return Qi||(j=j.sort(function(a,b){return a-b})),j}function Nc(a){aj=aj.concat(a)}function Oc(a){aj=aj.filter(function(b){return a.indexOf(b)<0})}function Pc(a){bj=bj.concat(a)}function Qc(a){bj=bj.filter(function(b){return a.indexOf(b)<0})}function Rc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Sc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Uc(a){return Sc(a,function(a){return a>0})}function Vc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],(a[f].x||0===a[f].x)&&(e=e.concat(Ld(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Ld(a,g))),Od(e,b)):Md(a,b,f,g)}function Nd(a,b){var c;return c=a.map(function(a){return Md(a.values,b)}),Od(c,b)}function Od(a,b){var c,d;return a.forEach(function(a){var e=Ge(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Pd(a,b){return Jf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Qd(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 Rd(){return Ug&&"desc"===Ug.toLowerCase()}function Sd(){return Ug&&"asc"===Ug.toLowerCase()}function Td(a){var b=Sd(),c=Rd();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 Ug&&a.sort(Ug),a}function Ud(a,c){var d,e,f,g,h,i,j,k=ke(Kf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&Di&&(Aj.html(Gi(a,bb(),Bd(k),Zi)).style("display","block"),d=Aj.property("offsetWidth"),e=Aj.property("offsetHeight"),k?(g=cg/2+c[0],i=eg/2+c[1]+20):(rh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-w(),i=zg(l[0].x)+20):(f=s(),g=f+v()+zg(l[0].x)+20,h=g+d,j=f+t()-w(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),Aj.style("top",i+"px").style("left",g+"px"))}function Vd(){Aj.style("display","none")}function Wd(a){var c=a.filter(function(a){return a&&b(a.value)});if(Di&&!he(Kf.data.targets)&&!ke(Kf.data.targets)){var d=xj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(rh?"y1":"x1",Hd).attr(rh?"y2":"x2",Hd),mf(d,"grid")}}function Xd(){xj.select("line."+g.xgridFocus).style("visibility","hidden")}function Yd(a,b){var c,d,e,f,h=[],i=xj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=bc(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function Zd(a){return a.x||0===a.x?zg(a.x):null}function $d(a){return Y(a.id)(a.value)}function _d(){var a,b,d={},e=0;return Kc(Hc(ne)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function de(a,b){return"number"==typeof ni?ni:b?2*a.tickOffset()*oi/b:0}function ee(a,b){Fc(a).forEach(function(a){Ej[a]=b===Sg[a],Sg[a]=b})}function fe(a,b){var c=!1;return a.forEach(function(a){Sg[a.id]===b&&(c=!0),a.id in Sg||"line"!==b||(c=!0)}),c}function ge(a){return fe(a,"bar")}function he(a){return fe(a,"scatter")}function ie(a){return fe(a,"pie")}function je(a){return fe(a,"donut")}function ke(a){return ie(a)||je(a)}function le(a){var b="string"==typeof a?a:a.id;return!(b in Sg)||"line"===Sg[b]||"spline"===Sg[b]||"area"===Sg[b]||"area-spline"===Sg[b]}function me(a){var b="string"==typeof a?a:a.id;return"spline"===Sg[b]||"area-spline"===Sg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"bar"===Sg[b]}function oe(a){var b="string"==typeof a?a:a.id;return"scatter"===Sg[b]}function pe(a){var b="string"==typeof a?a:a.id;return"pie"===Sg[b]}function qe(a){var b="string"==typeof a?a:a.id;return"donut"===Sg[b]}function re(a){return pe(a)||qe(a)}function se(a){return le(a)?[a]:[]}function te(a){return re(a.data)?[a]:[]}function ue(a){return ne(a)?a.values:[]}function ve(a){return le(a)||oe(a)?a.values:[]}function we(a){return ne(a)||le(a)?a.values:[]}function xe(a){return qe(a)&&xi||pe(a)&&ri}function ye(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ze(b){var c;try{c=Lg?Jf.time.format(Lg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Lg)}return c}function Ae(a,b){var c=Jf.mouse(a),d=Jf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Fe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Ge(a,b){var c="y"===ab(a.id)?Ag:Bg,d=rh?1:0,e=rh?0:1;return Math.pow(zg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function He(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ie(a,b,c){eh(b,a.node()),xj.select("."+g.selectedCircles+qd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Wc(g.selectedCircle,c)}).attr("cx",rh?$d:Zd).attr("cy",rh?Zd:$d).attr("stroke",function(){return Zi(b)}).attr("r",1.4*Te(b)).transition().duration(100).attr("r",Te)}function Je(a,b,c){fh(b,a.node()),xj.select("."+g.selectedCircles+qd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ke(a,b,c,d){a?Ie(b,c,d):Je(b,c,d)}function Le(a,b){eh(b,a.node()),a.transition().duration(100).style("fill",function(){return Jf.rgb(Zi(b)).brighter(.75)})}function Me(a,b){fh(b,a.node()),a.transition().duration(100).style("fill",function(){return Zi(b)})}function Ne(a,b,c,d){a?Le(b,c,d):Me(b,c,d)}function Oe(a,b,c,d){Ne(a,b,c.data,d)}function Pe(a){return"circle"===a.nodeName?Ke:Jf.select(a).classed(g.bar)?Ne:Oe}function Qe(a){return a.filter(function(a){return b(a.value)})}function Re(a){return gi?"function"==typeof hi?hi(a):hi:0}function Se(a){return ji?ki?ki:1.75*Re(a):Re(a)}function Te(a){return li?li:4*Re(a)}function Ue(a,c){return(c?xj.selectAll("."+g.circles+qd(c)):xj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ve(a,b){Ue(a,b).classed(g.EXPANDED,!0).attr("r",Se)}function We(a){Ue(a).filter(function(){return Jf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Re)}function Xe(a){return xj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function Ye(a){Xe(a).classed(g.EXPANDED,!0)}function Ze(a){Xe(a).classed(g.EXPANDED,!1)}function $e(a,b){var c=cf(a,b);return function(a,b){var d=c(a,b),e=rh?1:0,f=rh?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 _e(a,b){var c=cf(a,!1),d=b?af:bf;return function(a,b){return d(c(a,b),a,this)}}function af(a,b){var c;return rh?(c=ne(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function bf(a,b,c){var d=c.getBoundingClientRect();return rh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ne(b)?-3:-6)}function cf(a,b){var c=a.__max__+1,d=de(Fg,c),e=ae(d,c,a,!!b),f=be(!!b),g=ce(a,!!b),h=b?Z:Y;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return rh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function df(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function ef(b){var c,d,e;if(Bj=Jf.select(Mf),Bj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Bj.html("").classed("c3",!0),Kf.data.xs={},Kf.data.targets=xc(b),Yg&&Nc(Yg===!0?Ec(Kf.data.targets):Yg),p(),T(),zg.domain(Jf.extent(bc(Kf.data.targets))),Ag.domain(Zb(Kf.data.targets,"y")),Bg.domain(Zb(Kf.data.targets,"y2")),Cg.domain(zg.domain()),Dg.domain(Ag.domain()),Eg.domain(Bg.domain()),Cj=zg.domain(),qj.scale(Cg),Tf&&uj.scale(zg),vj=Bj.append("svg").on("mouseenter",Wf).on("mouseleave",Xf),wj=vj.append("defs"),wj.append("clipPath").attr("id",Ki).append("rect"),wj.append("clipPath").attr("id",Li).append("rect"),wj.append("clipPath").attr("id",Mi).append("rect"),rf(),xj=vj.append("g").attr("transform",hj.main),yj=vj.append("g").attr("transform",hj.context),zj=vj.append("g").attr("transform",hj.legend),ih||yj.style("visibility","hidden"),lh||(zj.style("visibility","hidden"),bj=Ec(Kf.data.targets)),Aj=Jf.select(Mf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Ef(Ec(Kf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=xj.append("g").attr("clip-path",Ni).attr("class",g.grid),ai&&d.append("g").attr("class",g.xgrids),Ee(ci)&&d.append("g").attr("class",g.xgridLines),ii&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),di&&d.append("g").attr("class",g.ygrids),Ee(ei)&&d.append("g").attr("class",g.ygridLines),xj.append("g").attr("clip-path",Ni).attr("class",g.regions),xj.append("g").attr("clip-path",Ni).attr("class",g.chart),c=xj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Tf?rh?"ns-resize":"ew-resize":null),xj.select("."+g.chart).append("g").attr("class",g.chartBars),xj.select("."+g.chart).append("g").attr("class",g.chartLines),xj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",hj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Tb()),xj.select("."+g.chart).append("g").attr("class",g.chartTexts),Tf&&xj.insert("rect",Vf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",cg).attr("height",eg).style("opacity",0).style("cursor",rh?"ns-resize":"ew-resize").call(uj).on("dblclick.zoom",null),Ih&&qj.extent("function"!=typeof Ih?Ih:Ih(bc())),cj.x=xj.append("g").attr("class",g.axisX).attr("clip-path",Oi).attr("transform",hj.x).style("visibility",sh?"visible":"hidden"),cj.x.append("text").attr("class",g.axisXLabel).attr("transform",rh?"rotate(-90)":"").style("text-anchor",Cb),cj.y=xj.append("g").attr("class",g.axisY).attr("clip-path",Pi).attr("transform",hj.y).style("visibility",Kh?"visible":"hidden"),cj.y.append("text").attr("class",g.axisYLabel).attr("transform",rh?"":"rotate(-90)").style("text-anchor",Db),cj.y2=xj.append("g").attr("class",g.axisY2).attr("transform",hj.y2).style("visibility",Th?"visible":"hidden"),cj.y2.append("text").attr("class",g.axisY2Label).attr("transform",rh?"":"rotate(-90)").style("text-anchor",Eb),yj.append("g").attr("clip-path",Ni).attr("class",g.chart),yj.select("."+g.chart).append("g").attr("class",g.chartBars),yj.select("."+g.chart).append("g").attr("class",g.chartLines),yj.append("g").attr("clip-path",Ni).attr("class",g.brush).call(qj).selectAll("rect").attr(rh?"width":"height",rh?dg:fg),cj.subx=yj.append("g").attr("class",g.axisX).attr("transform",hj.subx).attr("clip-path",rh?"":Oi),uf(Kf.data.targets),rh?xj.select("."+g.axisX).style("opacity",0).call(Fg):(xj.select("."+g.axisY).style("opacity",0).call(Gg),xj.select("."+g.axisY2).style("opacity",0).call(Hg)),p(),T(),rf(),o(!1),nf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Hi){if(Qi&&"string"==typeof Ii){for(Ii=ze(Ii),e=0;e0){d=[];for(var f in Ng)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Qd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ne,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function kf(a){ke(Kf.data.targets)||Zg&&(Ti=a,xj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Ui=!0,gh())}function lf(){ke(Kf.data.targets)||Zg&&(xj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),xj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Ui=!1,hh())}function mf(a,b){"grid"===b&&a.each(function(){var a=Jf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function nf(a,c){var e,f,h,i,j,k,l,m,n,o,p,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,O,P,Q,R,S,T,U,V,W,X=_d(),Y=ke(Kf.data.targets),Z=Kc(Kf.data.targets);if(a=a||{},D=d(a.withY)?a.withY:!0,E=d(a.withSubchart)?a.withSubchart:!0,F=d(a.withTransition)?a.withTransition:!0,I=d(a.withTransform)?a.withTransform:!1,J=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,K=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,L=d(a.withLegend)?a.withLegend:!1,G=d(a.withTransitionForExit)?a.withTransitionForExit:F,H=d(a.withTransitionForAxis)?a.withTransitionForAxis:F,R=F?$f:0,S=G?R:0,T=H?R:0,c=c||sf(T),L&&lh&&Ef(Ec(Kf.data.targets),a,c),Ri&&0===Z.length&&zg.domain([0,cj.x.selectAll(".tick").size()]),Z.length&&(K&&(zg.domain(Jf.extent(bc(Z))),Cj=zg.domain(),Tf&&uj.scale(zg).updateScaleExtent(),Cg.domain(zg.domain()),qj.scale(Cg)),J&&(zg.domain(qj.empty()?Cj:qj.extent()),Tf&&uj.scale(zg).updateScaleExtent()),Ch||!Bh&&!Ah||(U=Mc(Lc(Z),Ah),Fg.tickValues(U),Ig.tickValues(U))),Ag.domain(Zb(Z,"y")),Bg.domain(Zb(Z,"y2")),cj.x.style("opacity",Y?0:1),cj.y.style("opacity",Y?0:1),cj.y2.style("opacity",Y?0:1),cj.subx.style("opacity",Y?0:1),c.axisX.call(Fg),c.axisY.call(Gg),c.axisY2.call(Hg),c.axisSubX.call(Ig),Gb(F),J&&Z.length)if(yh&&U){for(V=1;V=0&&Jf.select(this).style("display",b%W?"none":"block")})}else vj.selectAll("."+g.axisX+" .tick text").style("display","block");!rh&&Dh&&hb(cj.x,c.axisX,Dh),M=$e(X),P=_e(X,!0),Q=_e(X,!1),Dg.domain(Ag.domain()),Eg.domain(Bg.domain()),Aj.style("display","none"),q(),xj.select("line."+g.xgridFocus).style("visibility","hidden"),ai&&(h=Yd(bi,zg),A=Ri?Fg.tickOffset():0,f=rh?{x1:0,x2:cg,y1:function(a){return zg(a)-A},y2:function(a){return zg(a)-A}}:{x1:function(a){return zg(a)+A},x2:function(a){return zg(a)+A},y1:_f.top,y2:eg},e=xj.select("."+g.xgrids).selectAll("."+g.xgrid).data(h),e.enter().append("line").attr("class",g.xgrid),e.attr(f).style("opacity",function(){return+Jf.select(this).attr(rh?"y1":"x1")===(rh?eg:0)?0:1}),e.exit().remove()),Ee(ci)&&(i=xj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(ci),j=i.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",rh?"":"rotate(-90)").attr("dx",rh?0:-_f.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(R).attr("x1",rh?0:Id).attr("x2",rh?cg:Id).attr("y1",rh?Id:_f.top).attr("y2",rh?Id:eg).style("opacity",1),i.select("text").transition().duration(R).attr("x",rh?cg:0).attr("y",Id).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(R).style("opacity",0).remove()),D&&di&&(k=xj.select("."+g.ygrids).selectAll("."+g.ygrid).data(Ag.ticks(fi)),k.enter().append("line").attr("class",g.ygrid),k.attr("x1",rh?Ag:0).attr("x2",rh?Ag:cg).attr("y1",rh?0:Ag).attr("y2",rh?eg:Ag),k.exit().remove(),mf(k,"grid")),D&&Ee(ei)&&(l=xj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(ei),m=l.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",rh?"rotate(-90)":"").attr("dx",rh?0:-_f.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(R).attr("x1",rh?Jd:0).attr("x2",rh?Jd:cg).attr("y1",rh?0:Jd).attr("y2",rh?eg:Jd).style("opacity",1),l.select("text").transition().duration(R).attr("x",rh?0:cg).attr("y",Jd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(R).style("opacity",0).remove()),t=xj.select("."+g.regions).selectAll("."+g.region).data(Ci),t.enter().append("g").attr("class",jd).append("rect").style("fill-opacity",0),t.selectAll("rect").transition().duration(R).attr("x",gc).attr("y",hc).attr("width",ic).attr("height",jc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),t.exit().transition().duration(R).style("fill-opacity",0).remove(),r=xj.selectAll("."+g.bars).selectAll("."+g.bar).data(ue),r.enter().append("path").attr("class",dd).style("stroke","none").style("fill",Zi),r.style("opacity",vd).transition().duration(R).attr("d",M).style("fill",Zi).style("opacity",1),r.exit().transition().duration(S).style("opacity",0).remove(),n=xj.selectAll("."+g.lines).selectAll("."+g.line).data(se),n.enter().append("path").attr("class",_c).style("stroke",Zi),n.style("opacity",vd).transition().duration(R).attr("d",rj).style("stroke",Zi).style("opacity",1),n.exit().transition().duration(S).style("opacity",0).remove(),o=xj.selectAll("."+g.areas).selectAll("."+g.area).data(se),o.enter().append("path").attr("class",hd).style("fill",Zi).style("opacity",function(){return Dj=+Jf.select(this).style("opacity"),0}),o.style("opacity",0).transition().duration(R).attr("d",sj).style("fill",Zi).style("opacity",Dj),o.exit().transition().duration(S).style("opacity",0).remove(),p=xj.selectAll("."+g.circles).selectAll("."+g.circle).data(ve),p.enter().append("circle").attr("class",bd).attr("r",Re).style("fill",Zi),p.style("opacity",vd).transition().duration(R).style("opacity",xd).style("fill",Zi).attr("cx",rh?$d:Zd).attr("cy",rh?Zd:$d),p.exit().remove(),u=xj.selectAll("."+g.texts).selectAll("."+g.text).data(we),u.enter().append("text").attr("class",Xc).attr("text-anchor",function(a){return rh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",Zi).style("fill-opacity",0),u.text(function(a){return Gd(a.id)(a.value,a.id)}).style("fill-opacity",wd).transition().duration(R).attr("x",P).attr("y",Q).style("fill",Zi).style("fill-opacity",yd),u.exit().transition().duration(S).style("fill-opacity",0).remove(),s=xj.selectAll("."+g.arcs).selectAll("."+g.arc).data(te),s.enter().append("path").attr("class",fd).style("fill",function(a){return Zi(a.data)}).style("cursor",function(a){return _g(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Xi||(c=Hb(a),d=Nb(c),e=Vb(),Pb(c.data.id),Af(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Hb(a),c=Nb(b),d=[c];Ud(d,Jf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Xi||(c=Hb(a),d=Nb(c),e=Wb(),Qb(c.data.id),Bf(),Vd(),e(d,b))}).on("click",function(a,b){var c=Hb(a),d=Nb(c),e=Ub();hf(this,a,b),e(d,b)}),s.attr("transform",I?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Xi=!0}).transition().duration(R).attrTween("d",function(a){var b,c=Hb(a);return c?(b=Jf.interpolate(this._current,c),this._current=b(0),function(a){return Kb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",I?"scale(1)":"").style("fill",function(a){return Zi(a.data)}).style("opacity",1).call(He,function(){Xi=!1}),s.exit().transition().duration(S).style("opacity",0).remove(),xj.selectAll("."+g.chartArc).select("text").attr("transform",Lb).style("opacity",0).transition().duration(R).text(Ob).style("opacity",function(a){return Ic(a.data.id)&&re(a.data)?1:0}),xj.select("."+g.chartArcsTitle).style("opacity",je(Kf.data.targets)?1:0),ih&&(Jf.event&&"zoom"===Jf.event.type&&qj.extent(zg.orgDomain()).update(),E&&(!rh&&Dh&&hb(cj.subx,c.axisSubX,Dh),qj.empty()||qj.extent(zg.orgDomain()).update(),O=$e(X,!0),w=yj.selectAll("."+g.bars).selectAll("."+g.bar).data(ue),w.enter().append("path").attr("class",dd).style("stroke","none").style("fill",Zi),w.style("opacity",vd).transition().duration(R).attr("d",O).style("opacity",1),w.exit().transition().duration(R).style("opacity",0).remove(),v=yj.selectAll("."+g.lines).selectAll("."+g.line).data(se),v.enter().append("path").attr("class",_c).style("stroke",Zi),v.style("opacity",vd).transition().duration(R).attr("d",tj).style("opacity",1),v.exit().transition().duration(R).style("opacity",0).remove())),xj.selectAll("."+g.selectedCircles).filter(function(a){return ne(a)}).selectAll("circle").remove(),xj.selectAll("."+g.selectedCircle).transition().duration(R).attr("cx",rh?$d:Zd).attr("cy",rh?Zd:$d),x=xj.select("."+g.eventRects),Ee(Kg)&&!qc(Kg)?(x.classed(g.eventRectsMultiple)||x.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),y=xj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),gf(y.enter()),y.attr("x",0).attr("y",0).attr("width",cg).attr("height",eg)):(x.classed(g.eventRectsSingle)||x.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Si&&!Ri?(C=function(a,b){var c=zc(b),d=Ac(b),e=Kf.data.xs[a.id][b];return(zg(d?d:e+50)-zg(c?c:e-50))/2},B=function(a,b){var c=zc(b),d=Kf.data.xs[a.id][b];return(zg(d)+zg(c?c:d-50))/2}):(C=N(),B=function(a){return zg(a.x)-C/2}),z=Cc(Kf.data.targets),xj.select("."+g.eventRects).datum(z?z.values:[]),y=xj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),ff(y.enter()),y.attr("class",kd).attr("x",rh?0:B).attr("y",rh?B:0).attr("width",rh?cg:C).attr("height",rh?C:eg),y.exit().remove()),Ec(Kf.data.targets).forEach(function(a){Ej[a]=!0})}function of(){nf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function pf(){if(0!==Kc(Kf.data.targets).length){if("mousemove"===Jf.event.sourceEvent.type&&uj.altDomain)return zg.domain(uj.altDomain),void uj.scale(zg).updateScaleExtent();Ri&&zg.orgDomain()[0]===Cj[0]&&zg.domain([Cj[0]-1e-10,zg.orgDomain()[1]]),nf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Jf.event.sourceEvent.type&&(Vi=!0)}}function qf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function rf(){vj.attr("width",gg).attr("height",hg),vj.select("#"+Ki).select("rect").attr("width",cg).attr("height",eg),vj.select("#"+Li).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),vj.select("#"+Mi).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),vj.select("."+g.zoomRect).attr("width",cg).attr("height",eg),Bj.style("max-height",hg+"px")}function sf(a){return{axisX:a?cj.x.transition().duration(a):cj.x,axisY:a?cj.y.transition().duration(a):cj.y,axisY2:a?cj.y2.transition().duration(a):cj.y2,axisSubX:a?cj.subx.transition().duration(a):cj.subx}}function tf(a){var b;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,a.withLegend&&lh||(b=sf(a.withTransition?$f:0),p(),T(),rf(),o(a.withTransition,b)),nf(a,b)}function uf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=xj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",md),j=i.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Yc),e=xj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",od),d=e.enter().append("g").attr("class",od).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",ed).style("cursor",function(a){return _g(a)?"pointer":null}),c=xj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",nd),b=c.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",ad),b.append("g").attr("class",id),b.append("g").attr("class",function(a){return Wc(g.selectedCircles,a.id)}),b.append("g").attr("class",cd).style("cursor",function(a){return _g(a)?"pointer":null}),a.forEach(function(a){xj.selectAll("."+g.selectedCircles+qd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=xj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(qg(a)).attr("class",pd),f=h.enter().append("g").attr("class",pd),f.append("g").attr("class",gd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),ih&&(n=yj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",od),m=n.enter().append("g").style("opacity",0).attr("class",od),m.append("g").attr("class",ed),l=yj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",nd),k=l.enter().append("g").style("opacity",0).attr("class",nd),k.append("g").attr("class",ad)),vj.selectAll("."+g.target).filter(function(a){return Ic(a.id)}).transition().duration($f).style("opacity",1)}function vf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?ee(a.id,b.types[a.id]):ee(a.id,b.type)}),Kf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,z=0,F++)),E[a]=F,D[F]=f,A[a]=z,z+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+v)/10),j=10*Math.ceil((h.height+u)/10),k=ij?j:i,l=ij?S():R();return d&&(z=0,F=0,w=0,x=0),lh&&!Jc(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=i,C[c]=j,(!w||i>=w)&&(w=i),(!x||j>=x)&&(x=j),g=ij?x:w,void(qh?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(l-g*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=26,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=zj.selectAll("."+g.legendItemFocused).size();b=b||{},n=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,ij?(f=function(a){return w*E[a]},j=function(a){return D[E[a]]+A[a]}):(f=function(a){return D[E[a]]+A[a]},j=function(a){return x*E[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=zj.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Wc(g.legendItem,a)}).style("visibility",function(a){return Jc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof nh?nh(a):Kf.toggle(a)}).on("mouseover",function(a){Jf.select(this).classed(g.legendItemFocused,!0),Xi||Kf.focus(a),"function"==typeof oh&&oh(a)}).on("mouseout",function(a){Jf.select(this).classed(g.legendItemFocused,!1),Xi||Kf.revert(),"function"==typeof ph&&ph(a)}),m.append("text").text(function(a){return d(Ng[a])?Ng[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",ij?h:-200).attr("y",ij?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",ij?i:-200).attr("y",ij?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",Zi).attr("x",ij?h:-200).attr("y",ij?-200:j).attr("width",10).attr("height",10),r=zj.selectAll("text").data(a).text(function(a){return d(Ng[a])?Ng[a]:a}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=zj.selectAll("rect."+g.legendItemEvent).data(a),(n?s.transition():s).attr("width",function(a){return B[a]}).attr("height",function(a){return C[a]}).attr("x",i).attr("y",l),t=zj.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",Zi).attr("x",f).attr("y",j),zj.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Ic(a)}).transition().style("opacity",function(a){var b=Jf.select(this);return Ic(a)?!G||b.classed(g.legendItemFocused)?yf(b):zf(b):mj}),P(w),Q(x),O(F),p(),T(),rf(),o(q,c)}function Ff(a){return Gc(Kf.data.targets,a.id)}function Gf(a){return"data"in a&&Gc(Kf.data.targets,a.data.id)}function Hf(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 If(a,b,c){var d=!ke(Kf.data.targets);Xi=!1,ee(a,b),tf(c||{withTransitionForAxis:d})}var Jf=a.d3?a.d3:a.require?a.require("d3"):void 0,Kf={data:{},axis:{},legend:{}},Lf={},Mf=i(["bindto"],"#chart"),Nf=i(["size","width"]),Of=i(["size","height"]),Pf=i(["padding","left"],50),Qf=i(["padding","right"],0),Rf=i(["padding","top"],0),Sf=i(["padding","bottom"],0),Tf=i(["zoom","enabled"],!1),Uf=i(["zoom","extent"]),Vf=i(["zoom","privileged"],!1),Wf=i(["onenter"],function(){}),Xf=i(["onleave"],function(){}),Yf=i(["onresize"],function(){}),Zf=i(["onresized"],function(){}),$f=i(["transition","duration"],350);h("data","data is required in config");var _f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg=i(["data","x"]),Kg=i(["data","xs"],{}),Lg=i(["data","x_format"]),Mg=i(["data","id_converter"],function(a){return a}),Ng=i(["data","names"],{}),Og=i(["data","classes"],{}),Pg=i(["data","groups"],[]),Qg=i(["data","axes"],{}),Rg=i(["data","type"]),Sg=i(["data","types"],{}),Tg=i(["data","labels"],{}),Ug=i(["data","order"]),Vg=i(["data","regions"],{}),Wg=i(["data","color"]),Xg=i(["data","colors"],{}),Yg=i(["data","hide"],!1),Zg=i(["data","selection","enabled"],!1),$g=i(["data","selection","grouped"],!1),_g=i(["data","selection","isselectable"],function(){return!0}),ah=i(["data","selection","multiple"],!0),bh=i(["data","onclick"],function(){}),ch=i(["data","onenter"],function(){}),dh=i(["data","onleave"],function(){}),eh=i(["data","onselected"],function(){}),fh=i(["data","onunselected"],function(){}),gh=i(["data","ondragstart"],function(){}),hh=i(["data","ondragend"],function(){}),ih=i(["subchart","show"],!1),jh=i(["subchart","size","height"],60),kh=i(["color","pattern"],[]),lh=i(["legend","show"],!0),mh=i(["legend","position"],"bottom"),nh=i(["legend","item","onclick"]),oh=i(["legend","item","onmouseover"]),ph=i(["legend","item","onmouseout"]),qh=i(["legend","equally"],!1),rh=i(["axis","rotated"],!1),sh=i(["axis","x","show"],!0),th=i(["axis","x","type"],"indexed"),uh=i(["axis","x","localtime"],!0),vh=i(["axis","x","categories"],[]),wh=i(["axis","x","tick","centered"],!1),xh=i(["axis","x","tick","format"]),yh=i(["axis","x","tick","culling"],{}),zh=i(["axis","x","tick","culling","max"],10),Ah=i(["axis","x","tick","count"]),Bh=i(["axis","x","tick","fit"],!0),Ch=i(["axis","x","tick","values"],null),Dh=i(["axis","x","tick","rotate"]),Eh=i(["axis","x","max"],null),Fh=i(["axis","x","min"],null),Gh=i(["axis","x","padding"],{}),Hh=i(["axis","x","height"]),Ih=i(["axis","x","default"]),Jh=i(["axis","x","label"],{}),Kh=i(["axis","y","show"],!0),Lh=i(["axis","y","max"]),Mh=i(["axis","y","min"]),Nh=i(["axis","y","center"]),Oh=i(["axis","y","label"],{}),Ph=i(["axis","y","inner"],!1),Qh=i(["axis","y","tick","format"]),Rh=i(["axis","y","padding"]),Sh=i(["axis","y","ticks"],10),Th=i(["axis","y2","show"],!1),Uh=i(["axis","y2","max"]),Vh=i(["axis","y2","min"]),Wh=i(["axis","y2","center"]),Xh=i(["axis","y2","label"],{}),Yh=i(["axis","y2","inner"],!1),Zh=i(["axis","y2","tick","format"]),$h=i(["axis","y2","padding"]),_h=i(["axis","y2","ticks"],10),ai=i(["grid","x","show"],!1),bi=i(["grid","x","type"],"tick"),ci=i(["grid","x","lines"],[]),di=i(["grid","y","show"],!1),ei=i(["grid","y","lines"],[]),fi=i(["grid","y","ticks"],10),gi=i(["point","show"],!0),hi=i(["point","r"],2.5),ii=i(["point","focus","line","enabled"],!0),ji=i(["point","focus","expand","enabled"],!0),ki=i(["point","focus","expand","r"]),li=i(["point","focus","select","r"]),mi=i(["line","connect_null"],!1),ni=i(["bar","width"]),oi=i(["bar","width","ratio"],.6),pi=i(["pie","label","show"],!0),qi=i(["pie","label","format"]),ri=i(["pie","expand"],!0),si=i(["pie","onclick"],function(){}),ti=i(["pie","onmouseover"],function(){}),ui=i(["pie","onmouseout"],function(){}),vi=i(["donut","label","show"],!0),wi=i(["donut","label","format"]),xi=i(["donut","expand"],!0),yi=i(["donut","title"],""),zi=i(["donut","onclick"],function(){}),Ai=i(["donut","onmouseover"],function(){}),Bi=i(["donut","onmouseout"],function(){}),Ci=i(["regions"],[]),Di=i(["tooltip","show"],!0),Ei=i(["tooltip","format","title"]),Fi=i(["tooltip","format","value"]),Gi=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Ei?Ei:b,l=Fi?Fi:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Hi=i(["tooltip","init","show"],!1),Ii=i(["tooltip","init","x"],0),Ji=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Ki=("string"==typeof Mf?Mf.replace("#",""):Mf.id)+"-clip",Li=Ki+"-xaxis",Mi=Ki+"-yaxis",Ni=j(Ki),Oi=j(Li),Pi=j(Mi),Qi="timeseries"===th,Ri="categorized"===th,Si=!Qi&&(Jg||Ee(Kg)),Ti=null,Ui=!1,Vi=!1,Wi=!1,Xi=!1,Yi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Zi=ye(Xg,Ee(kh)?kh:Yi,Wg),$i=uh?Jf.time.format:Jf.time.format.utc,_i=$i.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),aj=[],bj=[],cj={},dj=rh?"left":"bottom",ej=rh?Ph?"top":"bottom":Ph?"right":"left",fj=rh?Yh?"bottom":"top":Yh?"left":"right",gj=rh?"left":"bottom",hj={main:function(){return"translate("+k(_f.left)+","+k(_f.top)+")"},context:function(){return"translate("+k(ag.left)+","+k(ag.top)+")"},legend:function(){return"translate("+bg.left+","+bg.top+")"},x:function(){return"translate(0,"+(rh?0:eg)+")" +},y:function(){return"translate(0,"+(rh?eg:0)+")"},y2:function(){return"translate("+(rh?0:cg)+","+(rh?1:0)+")"},subx:function(){return"translate(0,"+(rh?0:fg)+")"},arc:function(){return"translate("+lg/2+","+mg/2+")"}},ij="right"===mh,jj=0,kj=0,lj=0,mj=.15,nj=30,oj=rh&&!sh?0:30,pj=5;qg=Jf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var qj,rj=function(){var a=Jf.svg.line().x(rh?function(a){return Y(a.id)(a.value)}:Hd).y(rh?Hd:function(a){return Y(a.id)(a.value)});return mi||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=mi?Qe(b.values):b.values;return le(b)?(a.interpolate(me(b)?"cardinal":"linear"),Vg[b.id]?df(e,zg,Y(b.id),Vg[b.id]):a(e)):(c=e[0]?zg(e[0].x):0,d=e[0]?Y(b.id)(e[0].value):0,rh?"M "+d+" "+c:"M "+c+" "+d)}}(),sj=function(){var a;return a=rh?Jf.svg.area().x0(function(a){return Y(a.id)(0)}).x1(function(a){return Y(a.id)(a.value)}).y(Hd):Jf.svg.area().x(Hd).y0(function(a){return Y(a.id)(0)}).y1(function(a){return Y(a.id)(a.value)}),function(b){var c,d,e=Qe(b.values);return fe([b],"area")||fe([b],"area-spline")?(a.interpolate(me(b)?"cardinal":"linear"),a(e)):(c=e[0]?zg(e[0].x):0,d=e[0]?Y(b.id)(e[0].value):0,rh?"M "+d+" "+c:"M "+c+" "+d)}}(),tj=function(){var a=Jf.svg.line().x(rh?function(a){return Z(a.id)(a.value)}:Kd).y(rh?Kd:function(a){return Z(a.id)(a.value)});return function(b){var c=Qe(b.values);return le(b)?a(c):"M "+Cg(c[0].x)+" "+Z(b.id)(c[0].value)}}(),uj=function(){};qj=Jf.svg.brush().on("brush",of),qj.update=function(){return yj&&yj.select("."+g.brush).call(this),this},qj.scale=function(a){return rh?this.y(a):this.x(a)},Tf&&(uj=Jf.behavior.zoom().on("zoomstart",function(){uj.altDomain=Jf.event.sourceEvent.altKey?zg.orgDomain():null}).on("zoom",Tf?pf:null),uj.scale=function(a){return rh?this.y(a):this.x(a)},uj.orgScaleExtent=function(){var a=Uf?Uf:[1,10];return[a[0],Math.max(Bc()/a[1],a[1])]},uj.updateScaleExtent=function(){var a=cc(zg.orgDomain())/cc(Cj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var vj,wj,xj,yj,zj,Aj,Bj,Cj,Dj,Ej={};if(Kf.focus=function(a){function b(a){Kc(a).transition().duration(100).style("opacity",1)}var c=vj.selectAll(rd(a)),d=c.filter(Ff),e=c.filter(Gf);Kf.revert(),Kf.defocus(),b(d.classed(g.focused,!0)),b(e),ke(Kf.data.targets)&&Pb(a,!0),Af(a,!0)},Kf.defocus=function(a){function b(a){Kc(a).transition().duration(100).style("opacity",.3)}var c=vj.selectAll(rd(a)),d=c.filter(Ff),e=c.filter(Gf);Kf.revert(),b(d.classed(g.focused,!1)),b(e),ke(Kf.data.targets)&&Qb(a),Af(a,!1)},Kf.revert=function(a){function b(a){Kc(a).transition().duration(100).style("opacity",1)}var c=vj.selectAll(rd(a)),d=c.filter(Ff),e=c.filter(Gf);b(d.classed(g.focused,!1)),b(e),ke(Kf.data.targets)&&Qb(a),Bf()},Kf.show=function(a,b){a=Fc(a),b=b||{},Oc(a),vj.selectAll(sd(a)).transition().style("opacity",1),b.withLegend&&Cf(a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Kf.hide=function(a,b){a=Fc(a),b=b||{},Nc(a),vj.selectAll(sd(a)).transition().style("opacity",0),b.withLegend&&Df(a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Kf.toggle=function(a){Ic(a)?Kf.hide(a):Kf.show(a)},Kf.unzoom=function(){qj.clear().update(),nf({withUpdateXDomain:!0})},Kf.load=function(a){return a.xs&&pc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Og[b]=a.classes[b]}),"categories"in a&&Ri&&(vh=a.categories,Fg.categories(vh)),"cacheIds"in a&&dc(a.cacheIds)?void vf(fc(a.cacheIds),a.done):void("unload"in a?xf(Fc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){wf(a)}):wf(a))},Kf.unload=function(a,b){xf(Fc(a),function(){nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Kf.selected=function(a){return Jf.merge(xj.selectAll("."+g.shapes+qd(a)).selectAll("."+g.shape).filter(function(){return Jf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Kf.select=function(a,b,c){Zg&&xj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Jf.select(this),i=e.data?e.data.id:e.id,j=Pe(this),k=$g||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);"path"!==this.nodeName&&(k&&l?_g(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},Kf.unselect=function(a,b){Zg&&xj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Jf.select(this),f=c.data?c.data.id:c.id,h=Pe(this),i=$g||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);"path"!==this.nodeName&&i&&j&&_g(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Kf.toLine=function(a){If(a,"line")},Kf.toSpline=function(a){If(a,"spline")},Kf.toBar=function(a){If(a,"bar")},Kf.toScatter=function(a){If(a,"scatter")},Kf.toArea=function(a){If(a,"area")},Kf.toAreaSpline=function(a){If(a,"area-spline")},Kf.toPie=function(a){If(a,"pie",{withTransform:!0})},Kf.toDonut=function(a){If(a,"donut",{withTransform:!0})},Kf.groups=function(a){return c(a)?Pg:(Pg=a,nf(),Pg)},Kf.xgrids=function(a){return a?(ci=a,nf(),ci):ci},Kf.xgrids.add=function(a){return a?Kf.xgrids(ci.concat(a)):void 0},Kf.xgrids.remove=function(a){var b=Hf(a);return Kf.xgrids(ci.filter(b))},Kf.ygrids=function(a){return a?(ei=a,nf(),ei):ei},Kf.ygrids.add=function(a){return a?Kf.ygrids(ei.concat(a)):void 0},Kf.ygrids.remove=function(a){var b=Hf(a);return Kf.ygrids(ei.filter(b))},Kf.regions=function(a){return c(a)?Ci:(Ci=a,nf(),Ci)},Kf.regions.add=function(a){return c(a)?Ci:(Ci=Ci.concat(a),nf(),Ci)},Kf.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;vj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Ci=Ci.filter(function(b){return b.classes.indexOf(a)<0})}),Ci},Kf.data.get=function(a){var b=Kf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Kf.data.getAsTarget=function(a){var b=Hc(function(b){return b.id===a});return b.length>0?b[0]:void 0},Kf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Ng[b]=a[b]}),nf({withLegend:!0}),Ng):Ng},Kf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Xg[b]=a[b]}),nf({withLegend:!0}),Xg):Xg},Kf.x=function(a){return arguments.length&&(sc(Kf.data.targets,a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Kf.data.xs},Kf.xs=function(a){return arguments.length&&(tc(Kf.data.targets,a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Kf.data.xs},Kf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){eb(b,a[b])}),Gb())},Kf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Eh=+a.x),b(a.y)&&(Lh=+a.y),b(a.y2)&&(Uh=+a.y2)):Lh=Uh=+a,nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Kf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Fh=+a.x),b(a.y)&&(Mh=+a.y),b(a.y2)&&(Vh=+a.y2)):Mh=Vh=+a,nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Kf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Kf.axis.max(a.max),"undefined"!=typeof a.min&&Kf.axis.min(a.min))},Kf.legend.show=function(a){Cf(Fc(a)),nf({withLegend:!0})},Kf.legend.hide=function(a){Df(Fc(a)),nf({withLegend:!0})},Kf.resize=function(a){Nf=a?a.width:null,Of=a?a.height:null,tf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Kf.destroy=function(){Kf.data.targets=void 0,Kf.data.xs={},Bj.html(""),a.onresize=null},"url"in f.data)Jf.xhr(f.data.url,function(a,b){var c,d=Jf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Jf.csv.parse(b.response),ef(c)});else if("rows"in f.data)ef(vc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");ef(wc(f.data.columns))}return Kf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(window); \ No newline at end of file From aa83d63b2e69e360961678db9fb9b36d55232419 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Fri, 9 May 2014 12:10:18 +0900 Subject: [PATCH 150/178] Refactor options --- c3.js | 33 ++++++++++++++++++--------------- c3.min.js | 6 +++--- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/c3.js b/c3.js index 381741f..f6fae28 100644 --- a/c3.js +++ b/c3.js @@ -2104,6 +2104,10 @@ }); } + function getOption(options, key, defaultValue) { + return isDefined(options[key]) ? options[key] : defaultValue; + } + //-- Selection --// function selectPoint(target, d, i) { @@ -3032,16 +3036,15 @@ var targetsToShow = filterTargetsToShow(c3.data.targets), tickValues, i, intervalForCulling; options = options || {}; - withY = isDefined(options.withY) ? options.withY : true; - withSubchart = isDefined(options.withSubchart) ? options.withSubchart : true; - withTransition = isDefined(options.withTransition) ? options.withTransition : true; - withTransform = isDefined(options.withTransform) ? options.withTransform : false; - withUpdateXDomain = isDefined(options.withUpdateXDomain) ? options.withUpdateXDomain : false; - 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; + withY = getOption(options, "withY", true); + withSubchart = getOption(options, "withSubchart", true); + withTransition = getOption(options, "withTransition", true); + withTransform = getOption(options, "withTransform", false); + withUpdateXDomain = getOption(options, "withUpdateXDomain", false); + withUpdateOrgXDomain = getOption(options, "withUpdateOrgXDomain", false); + withLegend = getOption(options, "withLegend", false); + withTransitionForExit = getOption(options, "withTransitionForExit", withTransition); + withTransitionForAxis = getOption(options, "withTransitionForAxis", withTransition); duration = withTransition ? __transition_duration : 0; durationForExit = withTransitionForExit ? duration : 0; @@ -3634,9 +3637,9 @@ var transitions; options = options || {}; // same with redraw - options.withTransition = isDefined(options.withTransition) ? options.withTransition : true; - options.withTransform = isDefined(options.withTransform) ? options.withTransform : false; - options.withLegend = isDefined(options.withLegend) ? options.withLegend : false; + options.withTransition = getOption(options, "withTransition", true); + options.withTransform = getOption(options, "withTransform", false); + options.withLegend = getOption(options, "withLegend", false); // NOT same with redraw options.withUpdateXDomain = true; options.withUpdateOrgXDomain = true; @@ -3898,8 +3901,8 @@ var texts, rects, tiles; options = options || {}; - withTransition = isDefined(options.withTransition) ? options.withTransition : true; - withTransitionForTransform = isDefined(options.withTransitionForTransform) ? options.withTransitionForTransform : true; + withTransition = getOption(options, "withTransition", true); + withTransitionForTransform = getOption(options, "withTransitionForTransform", true); function updatePositions(textElement, id, reset) { var box = textElement.getBoundingClientRect(), diff --git a/c3.min.js b/c3.min.js index 8677d30..d2e742a 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.ceil(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.ceil(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&acg&&(cg=0),0>eg&&(eg=0),dg=rh?_f.left-nj-oj:cg,fg=rh?eg:hg-ag.top-ag.bottom,0>dg&&(dg=0),0>fg&&(fg=0),lg=cg-(ij?b+10:0),mg=eg-(ij?0:10),r(),ij&&d&&(bg.left=lg/2+1.1*jg)}function q(){xj.select("line."+g.xgridFocus).attr("x1",rh?0:-10).attr("x2",rh?cg:-10).attr("y1",rh?-10:_f.top).attr("y2",rh?-10:eg)}function r(){jg=Math.min(lg,mg)/2,ig=.95*jg,kg=je(Kf.data.targets)?.6*ig:0}function s(){var a=rh?g.axisX:g.axisY,b=xj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Jf.select(Mf).node().getBoundingClientRect(),e=ke(Kf.data.targets),f=c.right-d.left-(e?0:v());return f>0?f:0}function t(){return Nf?Nf:z()}function u(){var a=Of?Of:A();return a>0?a:320}function v(){var a=1;return Pf?Pf:rh?sh?x("x"):a:!Kh||Ph?a:x("y")}function w(){var a=1;return Qf?Qf:ij?R()+20+(Th&&!rh?x("y2"):a):Th?Yh||rh?a:x("y2"):a}function x(a){var b=mb(a);return b.isInner?20+Fb(a):40+Fb(a)}function y(a){return"x"!==a||sh?"x"===a&&Hh?Hh:"y"!==a||Kh?"y2"!==a||Th?(mb(a).isInner?30:40)+("y2"===a?-10:0):pj:lh&&!ij?10:1:0}function z(){return+Jf.select(Mf).style("width").replace("px","")}function A(){return+Jf.select(Mf).style("height").replace("px","")}function B(a){return a?-31:-(_f.left-1)}function C(a){return a?-20:-4}function D(){return B(!rh)}function E(){return C(!rh)}function F(){return B(rh)}function G(){return C(rh)}function H(a){return a?cg+2+30+30:_f.left+20}function I(a){return a?(Hh?Hh:0)+80:eg+8}function J(){return H(!rh)}function K(){return I(!rh)}function L(){return H(rh)}function M(){return I(rh)}function N(){var a,b,c,d,e,f=Cc(Kf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=zg(b.x)-zg(a.x),0===c?rh?eg:cg:(d=Bc(),e=ge(Kf.data.targets)?(d-(Ri?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function O(a){jj=a}function P(a){kj=a}function Q(a){lj=a}function R(){return lh?ij?kj*(jj+1):gg:0}function S(){return lh?ij?hg:lj*(jj+1):0}function T(){var a,b,c=!zg;rg=rh?1:0,sg=rh?eg:cg,tg=rh?0:eg,ug=rh?cg:1,vg=rg,wg=sg,xg=rh?0:fg,yg=rh?dg:1,zg=W(rg,sg,c?void 0:zg.domain(),function(){return Fg.tickOffset()}),Ag=X(tg,ug,c?void 0:Ag.domain()),Bg=X(tg,ug,c?void 0:Bg.domain()),Cg=W(rg,sg,Cj,function(a){return a%1?0:Ig.tickOffset()}),Dg=X(xg,yg,c?void 0:Dg.domain()),Eg=X(xg,yg,c?void 0:Eg.domain()),a=bb(),b=Ch?Ch:c?void 0:Fg.tickValues(),Fg=$(zg,dj,a,b),Ig=$(Cg,gj,a,b),Gg=_(Ag,ej,Qh,Sh),Hg=_(Bg,fj,Zh,_h),c||(qj.scale(Cg),Tf&&uj.scale(zg)),U()}function U(){ng=Ib(),og=Jb(),pg=Jb(.98)}function V(a,b,c){return(c?Jf.time.scale():Jf.scale.linear()).range([a,b])}function W(a,b,c,d){var e,f=V(a,b,Qi),g=c?f.domain(c):f;Ri?(d=d||function(){return 0},f=function(a,b){var c=g(a)+d(a);return b?c:Math.ceil(c)}):f=function(a,b){var c=g(a);return b?c:Math.ceil(c)};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return Cj&&Cj[0]===a[0]&&Cj[1]a?a.toFixed(0):a};return xh&&("function"==typeof xh?a=xh:Qi&&(a=function(a){return a?$i(xh)(a):""})),a}function cb(a){var b;return"y"===a?b=Oh:"y2"===a?b=Xh:"x"===a&&(b=Jh),b}function db(a){var b=cb(a);return"string"==typeof b?b:b?b.text:null}function eb(a,b){var c=cb(a);"string"==typeof c?"y"===a?Oh=b:"y2"===a?Xh=b:"x"===a&&(Jh=b):c&&(c.text=b)}function fb(a){return 10*Math.sin(Math.PI*(a/180))}function gb(a){return 11.5-2.5*(a/15)}function hb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",gb(c)).attr("x",fb(c)).attr("transform","rotate("+c+")")}function ib(a,b){var c=cb(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 jb(){return ib("x",rh?"inner-top":"inner-right")}function kb(){return ib("y",rh?"inner-right":"inner-top")}function lb(){return ib("y2",rh?"inner-right":"inner-top")}function mb(a){return"y2"===a?lb():"y"===a?kb():jb()}function nb(){return db("x")}function ob(){return db("y")}function pb(){return db("y2")}function qb(a,b){return a?b.isLeft?0:b.isCenter?cg/2:cg:b.isBottom?-eg:b.isMiddle?-eg/2:0}function rb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function sb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function tb(){return qb(!rh,jb())}function ub(){return qb(rh,kb())}function vb(){return qb(rh,lb())}function wb(){return rb(!rh,jb())}function xb(){return rb(rh,kb())}function yb(){return rb(rh,lb())}function zb(){var a=jb();return rh?a.isInner?"1.2em":-25-Fb("x"):a.isInner?"-0.5em":Hh?Hh-10:"3em"}function Ab(){var a=kb();return rh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Fb("y")}function Bb(){var a=lb();return rh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Fb("y2")}function Cb(){return sb(!rh,jb())}function Db(){return sb(rh,kb())}function Eb(){return sb(rh,lb())}function Fb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Jf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Gb(a){var b=xj.select("."+g.axisX+" ."+g.axisXLabel),c=xj.select("."+g.axisY+" ."+g.axisYLabel),d=xj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",tb).attr("dx",wb).attr("dy",zb).text(nb),(a?c.transition():c).attr("x",ub).attr("dx",xb).attr("dy",Ab).attr("dy",Ab).text(ob),(a?d.transition():d).attr("x",vb).attr("dx",yb).attr("dy",Bb).text(pb)}function Hb(a){var b=!1;return qg(Kc(Kf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Ib(){var a=Jf.svg.arc().outerRadius(ig).innerRadius(kg),b=function(b,c){var d;return c?a(b):(d=Hb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Jb(a){var b=Jf.svg.arc().outerRadius(jg*(a?a:1)).innerRadius(kg);return function(a){var c=Hb(a);return c?b(c):"M 0 0"}}function Kb(a,b){return re(a.data)?ng(a,b):"M 0 0"}function Lb(a){var b,c,d,e,f=Hb(a),g="";return f&&(b=ng.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*ig*.8+","+d/e*ig*.8+")"),g}function Mb(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Nb(a){return rc({id:a.data.id,value:a.value,ratio:Mb(a)})}function Ob(a){var b,c,d,e;return Rb()?(b=Hb(a),c=b?b.value:null,d=Mb(b),e=Sb(),e?e(c,d):Fd(c,d)):""}function Pb(a,b){var c=vj.selectAll("."+g.chartArc+rd(a)),d=vj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});xe(a)&&c.selectAll("path").transition().duration(50).attr("d",og).transition().duration(100).attr("d",pg).each(function(a){qe(a.data)}),b||d.style("opacity",.3)}function Qb(a){var b=vj.selectAll("."+g.chartArc+rd(a));b.selectAll("path").transition().duration(50).attr("d",ng),vj.selectAll("."+g.arc).style("opacity",1)}function Rb(){return je(Kf.data.targets)?vi:pi}function Sb(){return je(Kf.data.targets)?wi:qi}function Tb(){return je(Kf.data.targets)?yi:""}function Ub(){var a=je(Kf.data.targets)?zi:si;return"function"==typeof a?a:function(){}}function Vb(){var a=je(Kf.data.targets)?Ai:ti;return"function"==typeof a?a:function(){}}function Wb(){var a=je(Kf.data.targets)?Bi:ui;return"function"==typeof a?a:function(){}}function Xb(a){var b,c,d,e,f,g,h=Ec(a),i=Rc(a);if(Pg.length>0)for(g=Tc(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 Jf.min(Object.keys(i).map(function(a){return Jf.min(i[a])}))}function Yb(a){var b,c,d,e,f,g,h=Ec(a),i=Rc(a);if(Pg.length>0)for(g=Uc(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 Jf.max(Object.keys(i).map(function(a){return Jf.max(i[a])}))}function Zb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return ab(a.id)===c}),m="y2"===c?Vh:Mh,n="y2"===c?Uh:Lh,o=b(m)?m:Xb(l),p=b(n)?n:Yb(l),q="y2"===c?Wh:Nh,r=zd()&&rh;return 0===l.length?"y2"===c?Bg.domain():Ag.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=Ad(o,p),j=cc(Ag.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Rh&&(f=b(Rh.top)?Rh.top:e,g=b(Rh.bottom)?Rh.bottom:e),"y2"===c&&$h&&(f=b($h.top)?$h.top:e,g=b($h.bottom)?$h.bottom:e),ge(l)&&!Tc(l)&&(g=o),[o-g,p+f])}function $b(a){return Fh?Qi?ze(Fh):Fh:Jf.min(a,function(a){return Jf.min(a.values,function(a){return a.x})})}function _b(a){return Eh?Qi?ze(Eh):Eh:Jf.max(a,function(a){return Jf.max(a.values,function(a){return a.x})})}function ac(a){var c,d,e,f,g=Dc(a),h=g[1]-g[0];return Ri?d=0:ge(a)?(c=Bc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Gh&&Ee(Gh)?(e=b(Gh.left)?Gh.left:d,f=b(Gh.right)?Gh.right:d):e=f="number"==typeof Gh?Gh:d,{left:e,right:f}}function bc(a){var b=[$b(a),_b(a)],c=b[0],d=b[1],e=ac(a),f=0,g=0;return c-d!==0||Ri||(c=Qi?new Date(.5*c.getTime()):-.5,d=Qi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Qi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Qi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function cc(a){return a[1]-a[0]}function dc(a){for(var b=0;bb?0:b-c}function jc(a){var b,c=hc(a),d="y"===a.axis?Ag:Bg;return b="y"===a.axis||"y2"===a.axis?rh?eg:"start"in a?d(a.start):eg:rh?"end"in a?zg(Qi?ze(a.end):a.end):eg:eg,c>b?0:b-c}function kc(a){return Jg&&a===Jg||Ee(Kg)&&Fe(Kg,a)}function lc(a){return!kc(a)}function mc(a){return Jg?Jg:Ee(Kg)?Kg[a]:null}function nc(a,b){var c,d=b&&Ee(b)?Ec(b):[];return d.forEach(function(b){mc(b)===a&&(c=Kf.data.xs[b])}),c}function oc(a,b){return a in Kf.data.xs&&Kf.data.xs[a]&&Kf.data.xs[a][b]?Kf.data.xs[a][b]:b}function pc(a){Object.keys(a).forEach(function(b){Kg[b]=a[b]})}function qc(a){return 1===Jf.set(Object.keys(a).map(function(b){return a[b]})).size()}function rc(a){var b;return a&&(b=Ng[a.id],a.name=b?b:a.id),a}function sc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=uc(b[d],a.id,d)}),Kf.data.xs[a.id]=b})}function tc(a,b){a.forEach(function(a){b[a.id]&&sc([a],b[a.id])})}function uc(a,c,d){var e;return e=Qi?a?a instanceof Date?a:ze(a):ze(oc(c,d)):Si&&!Ri?b(a)?+a:oc(c,d):d}function vc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Kf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Jg?(d=Object.keys(Kf.data.xs),Kf.data.xs[c]=d.length>0?Kf.data.xs[d[0]]:void 0):Ee(Kg)&&(Kf.data.xs[c]=nc(f,Kf.data.targets)):Kf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Kf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Mg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=mc(b),g=a[f],h=uc(g,b,e);return Si&&Ri&&0===c&&g&&(0===e&&(vh=[]),vh.push(g)),("undefined"==typeof a[b]||Kf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Rg&&ee(Ec(c).filter(function(a){return!(a in Sg)}),Rg),c.forEach(function(a){ec(a.id_org,a)}),c}function yc(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 zc(a){return a>0&&Kf.data.targets[0].values[a-1]?Kf.data.targets[0].values[a-1].x:void 0}function Ac(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Dc(a){var b,c,d=Cc(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Ec(a){return a.map(function(a){return a.id})}function Fc(a){return a?"string"==typeof a?[a]:a:Ec(Kf.data.targets)}function Gc(a,b){var c,d=Ec(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Qi?new Date(i):i);j.push(e)}return Qi||(j=j.sort(function(a,b){return a-b})),j}function Nc(a){aj=aj.concat(a)}function Oc(a){aj=aj.filter(function(b){return a.indexOf(b)<0})}function Pc(a){bj=bj.concat(a)}function Qc(a){bj=bj.filter(function(b){return a.indexOf(b)<0})}function Rc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Sc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Uc(a){return Sc(a,function(a){return a>0})}function Vc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],(a[f].x||0===a[f].x)&&(e=e.concat(Ld(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Ld(a,g))),Od(e,b)):Md(a,b,f,g)}function Nd(a,b){var c;return c=a.map(function(a){return Md(a.values,b)}),Od(c,b)}function Od(a,b){var c,d;return a.forEach(function(a){var e=Ge(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Pd(a,b){return Jf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Qd(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 Rd(){return Ug&&"desc"===Ug.toLowerCase()}function Sd(){return Ug&&"asc"===Ug.toLowerCase()}function Td(a){var b=Sd(),c=Rd();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 Ug&&a.sort(Ug),a}function Ud(a,c){var d,e,f,g,h,i,j,k=ke(Kf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&Di&&(Aj.html(Gi(a,bb(),Bd(k),Zi)).style("display","block"),d=Aj.property("offsetWidth"),e=Aj.property("offsetHeight"),k?(g=cg/2+c[0],i=eg/2+c[1]+20):(rh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-w(),i=zg(l[0].x)+20):(f=s(),g=f+v()+zg(l[0].x)+20,h=g+d,j=f+t()-w(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),Aj.style("top",i+"px").style("left",g+"px"))}function Vd(){Aj.style("display","none")}function Wd(a){var c=a.filter(function(a){return a&&b(a.value)});if(Di&&!he(Kf.data.targets)&&!ke(Kf.data.targets)){var d=xj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(rh?"y1":"x1",Hd).attr(rh?"y2":"x2",Hd),mf(d,"grid")}}function Xd(){xj.select("line."+g.xgridFocus).style("visibility","hidden")}function Yd(a,b){var c,d,e,f,h=[],i=xj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=bc(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function Zd(a){return a.x||0===a.x?zg(a.x):null}function $d(a){return Y(a.id)(a.value)}function _d(){var a,b,d={},e=0;return Kc(Hc(ne)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function de(a,b){return"number"==typeof ni?ni:b?2*a.tickOffset()*oi/b:0}function ee(a,b){Fc(a).forEach(function(a){Ej[a]=b===Sg[a],Sg[a]=b})}function fe(a,b){var c=!1;return a.forEach(function(a){Sg[a.id]===b&&(c=!0),a.id in Sg||"line"!==b||(c=!0)}),c}function ge(a){return fe(a,"bar")}function he(a){return fe(a,"scatter")}function ie(a){return fe(a,"pie")}function je(a){return fe(a,"donut")}function ke(a){return ie(a)||je(a)}function le(a){var b="string"==typeof a?a:a.id;return!(b in Sg)||"line"===Sg[b]||"spline"===Sg[b]||"area"===Sg[b]||"area-spline"===Sg[b]}function me(a){var b="string"==typeof a?a:a.id;return"spline"===Sg[b]||"area-spline"===Sg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"bar"===Sg[b]}function oe(a){var b="string"==typeof a?a:a.id;return"scatter"===Sg[b]}function pe(a){var b="string"==typeof a?a:a.id;return"pie"===Sg[b]}function qe(a){var b="string"==typeof a?a:a.id;return"donut"===Sg[b]}function re(a){return pe(a)||qe(a)}function se(a){return le(a)?[a]:[]}function te(a){return re(a.data)?[a]:[]}function ue(a){return ne(a)?a.values:[]}function ve(a){return le(a)||oe(a)?a.values:[]}function we(a){return ne(a)||le(a)?a.values:[]}function xe(a){return qe(a)&&xi||pe(a)&&ri}function ye(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ze(b){var c;try{c=Lg?Jf.time.format(Lg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Lg)}return c}function Ae(a,b){var c=Jf.mouse(a),d=Jf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Fe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Ge(a,b){var c="y"===ab(a.id)?Ag:Bg,d=rh?1:0,e=rh?0:1;return Math.pow(zg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function He(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ie(a,b,c){eh(b,a.node()),xj.select("."+g.selectedCircles+qd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Wc(g.selectedCircle,c)}).attr("cx",rh?$d:Zd).attr("cy",rh?Zd:$d).attr("stroke",function(){return Zi(b)}).attr("r",1.4*Te(b)).transition().duration(100).attr("r",Te)}function Je(a,b,c){fh(b,a.node()),xj.select("."+g.selectedCircles+qd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ke(a,b,c,d){a?Ie(b,c,d):Je(b,c,d)}function Le(a,b){eh(b,a.node()),a.transition().duration(100).style("fill",function(){return Jf.rgb(Zi(b)).brighter(.75)})}function Me(a,b){fh(b,a.node()),a.transition().duration(100).style("fill",function(){return Zi(b)})}function Ne(a,b,c,d){a?Le(b,c,d):Me(b,c,d)}function Oe(a,b,c,d){Ne(a,b,c.data,d)}function Pe(a){return"circle"===a.nodeName?Ke:Jf.select(a).classed(g.bar)?Ne:Oe}function Qe(a){return a.filter(function(a){return b(a.value)})}function Re(a){return gi?"function"==typeof hi?hi(a):hi:0}function Se(a){return ji?ki?ki:1.75*Re(a):Re(a)}function Te(a){return li?li:4*Re(a)}function Ue(a,c){return(c?xj.selectAll("."+g.circles+qd(c)):xj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ve(a,b){Ue(a,b).classed(g.EXPANDED,!0).attr("r",Se)}function We(a){Ue(a).filter(function(){return Jf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Re)}function Xe(a){return xj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function Ye(a){Xe(a).classed(g.EXPANDED,!0)}function Ze(a){Xe(a).classed(g.EXPANDED,!1)}function $e(a,b){var c=cf(a,b);return function(a,b){var d=c(a,b),e=rh?1:0,f=rh?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 _e(a,b){var c=cf(a,!1),d=b?af:bf;return function(a,b){return d(c(a,b),a,this)}}function af(a,b){var c;return rh?(c=ne(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function bf(a,b,c){var d=c.getBoundingClientRect();return rh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ne(b)?-3:-6)}function cf(a,b){var c=a.__max__+1,d=de(Fg,c),e=ae(d,c,a,!!b),f=be(!!b),g=ce(a,!!b),h=b?Z:Y;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return rh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function df(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function ef(b){var c,d,e;if(Bj=Jf.select(Mf),Bj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Bj.html("").classed("c3",!0),Kf.data.xs={},Kf.data.targets=xc(b),Yg&&Nc(Yg===!0?Ec(Kf.data.targets):Yg),p(),T(),zg.domain(Jf.extent(bc(Kf.data.targets))),Ag.domain(Zb(Kf.data.targets,"y")),Bg.domain(Zb(Kf.data.targets,"y2")),Cg.domain(zg.domain()),Dg.domain(Ag.domain()),Eg.domain(Bg.domain()),Cj=zg.domain(),qj.scale(Cg),Tf&&uj.scale(zg),vj=Bj.append("svg").on("mouseenter",Wf).on("mouseleave",Xf),wj=vj.append("defs"),wj.append("clipPath").attr("id",Ki).append("rect"),wj.append("clipPath").attr("id",Li).append("rect"),wj.append("clipPath").attr("id",Mi).append("rect"),rf(),xj=vj.append("g").attr("transform",hj.main),yj=vj.append("g").attr("transform",hj.context),zj=vj.append("g").attr("transform",hj.legend),ih||yj.style("visibility","hidden"),lh||(zj.style("visibility","hidden"),bj=Ec(Kf.data.targets)),Aj=Jf.select(Mf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Ef(Ec(Kf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=xj.append("g").attr("clip-path",Ni).attr("class",g.grid),ai&&d.append("g").attr("class",g.xgrids),Ee(ci)&&d.append("g").attr("class",g.xgridLines),ii&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),di&&d.append("g").attr("class",g.ygrids),Ee(ei)&&d.append("g").attr("class",g.ygridLines),xj.append("g").attr("clip-path",Ni).attr("class",g.regions),xj.append("g").attr("clip-path",Ni).attr("class",g.chart),c=xj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Tf?rh?"ns-resize":"ew-resize":null),xj.select("."+g.chart).append("g").attr("class",g.chartBars),xj.select("."+g.chart).append("g").attr("class",g.chartLines),xj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",hj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Tb()),xj.select("."+g.chart).append("g").attr("class",g.chartTexts),Tf&&xj.insert("rect",Vf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",cg).attr("height",eg).style("opacity",0).style("cursor",rh?"ns-resize":"ew-resize").call(uj).on("dblclick.zoom",null),Ih&&qj.extent("function"!=typeof Ih?Ih:Ih(bc())),cj.x=xj.append("g").attr("class",g.axisX).attr("clip-path",Oi).attr("transform",hj.x).style("visibility",sh?"visible":"hidden"),cj.x.append("text").attr("class",g.axisXLabel).attr("transform",rh?"rotate(-90)":"").style("text-anchor",Cb),cj.y=xj.append("g").attr("class",g.axisY).attr("clip-path",Pi).attr("transform",hj.y).style("visibility",Kh?"visible":"hidden"),cj.y.append("text").attr("class",g.axisYLabel).attr("transform",rh?"":"rotate(-90)").style("text-anchor",Db),cj.y2=xj.append("g").attr("class",g.axisY2).attr("transform",hj.y2).style("visibility",Th?"visible":"hidden"),cj.y2.append("text").attr("class",g.axisY2Label).attr("transform",rh?"":"rotate(-90)").style("text-anchor",Eb),yj.append("g").attr("clip-path",Ni).attr("class",g.chart),yj.select("."+g.chart).append("g").attr("class",g.chartBars),yj.select("."+g.chart).append("g").attr("class",g.chartLines),yj.append("g").attr("clip-path",Ni).attr("class",g.brush).call(qj).selectAll("rect").attr(rh?"width":"height",rh?dg:fg),cj.subx=yj.append("g").attr("class",g.axisX).attr("transform",hj.subx).attr("clip-path",rh?"":Oi),uf(Kf.data.targets),rh?xj.select("."+g.axisX).style("opacity",0).call(Fg):(xj.select("."+g.axisY).style("opacity",0).call(Gg),xj.select("."+g.axisY2).style("opacity",0).call(Hg)),p(),T(),rf(),o(!1),nf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Hi){if(Qi&&"string"==typeof Ii){for(Ii=ze(Ii),e=0;e0){d=[];for(var f in Ng)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Qd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ne,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function kf(a){ke(Kf.data.targets)||Zg&&(Ti=a,xj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Ui=!0,gh())}function lf(){ke(Kf.data.targets)||Zg&&(xj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),xj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Ui=!1,hh())}function mf(a,b){"grid"===b&&a.each(function(){var a=Jf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function nf(a,c){var e,f,h,i,j,k,l,m,n,o,p,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,O,P,Q,R,S,T,U,V,W,X=_d(),Y=ke(Kf.data.targets),Z=Kc(Kf.data.targets);if(a=a||{},D=d(a.withY)?a.withY:!0,E=d(a.withSubchart)?a.withSubchart:!0,F=d(a.withTransition)?a.withTransition:!0,I=d(a.withTransform)?a.withTransform:!1,J=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,K=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,L=d(a.withLegend)?a.withLegend:!1,G=d(a.withTransitionForExit)?a.withTransitionForExit:F,H=d(a.withTransitionForAxis)?a.withTransitionForAxis:F,R=F?$f:0,S=G?R:0,T=H?R:0,c=c||sf(T),L&&lh&&Ef(Ec(Kf.data.targets),a,c),Ri&&0===Z.length&&zg.domain([0,cj.x.selectAll(".tick").size()]),Z.length&&(K&&(zg.domain(Jf.extent(bc(Z))),Cj=zg.domain(),Tf&&uj.scale(zg).updateScaleExtent(),Cg.domain(zg.domain()),qj.scale(Cg)),J&&(zg.domain(qj.empty()?Cj:qj.extent()),Tf&&uj.scale(zg).updateScaleExtent()),Ch||!Bh&&!Ah||(U=Mc(Lc(Z),Ah),Fg.tickValues(U),Ig.tickValues(U))),Ag.domain(Zb(Z,"y")),Bg.domain(Zb(Z,"y2")),cj.x.style("opacity",Y?0:1),cj.y.style("opacity",Y?0:1),cj.y2.style("opacity",Y?0:1),cj.subx.style("opacity",Y?0:1),c.axisX.call(Fg),c.axisY.call(Gg),c.axisY2.call(Hg),c.axisSubX.call(Ig),Gb(F),J&&Z.length)if(yh&&U){for(V=1;V=0&&Jf.select(this).style("display",b%W?"none":"block")})}else vj.selectAll("."+g.axisX+" .tick text").style("display","block");!rh&&Dh&&hb(cj.x,c.axisX,Dh),M=$e(X),P=_e(X,!0),Q=_e(X,!1),Dg.domain(Ag.domain()),Eg.domain(Bg.domain()),Aj.style("display","none"),q(),xj.select("line."+g.xgridFocus).style("visibility","hidden"),ai&&(h=Yd(bi,zg),A=Ri?Fg.tickOffset():0,f=rh?{x1:0,x2:cg,y1:function(a){return zg(a)-A},y2:function(a){return zg(a)-A}}:{x1:function(a){return zg(a)+A},x2:function(a){return zg(a)+A},y1:_f.top,y2:eg},e=xj.select("."+g.xgrids).selectAll("."+g.xgrid).data(h),e.enter().append("line").attr("class",g.xgrid),e.attr(f).style("opacity",function(){return+Jf.select(this).attr(rh?"y1":"x1")===(rh?eg:0)?0:1}),e.exit().remove()),Ee(ci)&&(i=xj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(ci),j=i.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",rh?"":"rotate(-90)").attr("dx",rh?0:-_f.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(R).attr("x1",rh?0:Id).attr("x2",rh?cg:Id).attr("y1",rh?Id:_f.top).attr("y2",rh?Id:eg).style("opacity",1),i.select("text").transition().duration(R).attr("x",rh?cg:0).attr("y",Id).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(R).style("opacity",0).remove()),D&&di&&(k=xj.select("."+g.ygrids).selectAll("."+g.ygrid).data(Ag.ticks(fi)),k.enter().append("line").attr("class",g.ygrid),k.attr("x1",rh?Ag:0).attr("x2",rh?Ag:cg).attr("y1",rh?0:Ag).attr("y2",rh?eg:Ag),k.exit().remove(),mf(k,"grid")),D&&Ee(ei)&&(l=xj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(ei),m=l.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",rh?"rotate(-90)":"").attr("dx",rh?0:-_f.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(R).attr("x1",rh?Jd:0).attr("x2",rh?Jd:cg).attr("y1",rh?0:Jd).attr("y2",rh?eg:Jd).style("opacity",1),l.select("text").transition().duration(R).attr("x",rh?0:cg).attr("y",Jd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(R).style("opacity",0).remove()),t=xj.select("."+g.regions).selectAll("."+g.region).data(Ci),t.enter().append("g").attr("class",jd).append("rect").style("fill-opacity",0),t.selectAll("rect").transition().duration(R).attr("x",gc).attr("y",hc).attr("width",ic).attr("height",jc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),t.exit().transition().duration(R).style("fill-opacity",0).remove(),r=xj.selectAll("."+g.bars).selectAll("."+g.bar).data(ue),r.enter().append("path").attr("class",dd).style("stroke","none").style("fill",Zi),r.style("opacity",vd).transition().duration(R).attr("d",M).style("fill",Zi).style("opacity",1),r.exit().transition().duration(S).style("opacity",0).remove(),n=xj.selectAll("."+g.lines).selectAll("."+g.line).data(se),n.enter().append("path").attr("class",_c).style("stroke",Zi),n.style("opacity",vd).transition().duration(R).attr("d",rj).style("stroke",Zi).style("opacity",1),n.exit().transition().duration(S).style("opacity",0).remove(),o=xj.selectAll("."+g.areas).selectAll("."+g.area).data(se),o.enter().append("path").attr("class",hd).style("fill",Zi).style("opacity",function(){return Dj=+Jf.select(this).style("opacity"),0}),o.style("opacity",0).transition().duration(R).attr("d",sj).style("fill",Zi).style("opacity",Dj),o.exit().transition().duration(S).style("opacity",0).remove(),p=xj.selectAll("."+g.circles).selectAll("."+g.circle).data(ve),p.enter().append("circle").attr("class",bd).attr("r",Re).style("fill",Zi),p.style("opacity",vd).transition().duration(R).style("opacity",xd).style("fill",Zi).attr("cx",rh?$d:Zd).attr("cy",rh?Zd:$d),p.exit().remove(),u=xj.selectAll("."+g.texts).selectAll("."+g.text).data(we),u.enter().append("text").attr("class",Xc).attr("text-anchor",function(a){return rh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",Zi).style("fill-opacity",0),u.text(function(a){return Gd(a.id)(a.value,a.id)}).style("fill-opacity",wd).transition().duration(R).attr("x",P).attr("y",Q).style("fill",Zi).style("fill-opacity",yd),u.exit().transition().duration(S).style("fill-opacity",0).remove(),s=xj.selectAll("."+g.arcs).selectAll("."+g.arc).data(te),s.enter().append("path").attr("class",fd).style("fill",function(a){return Zi(a.data)}).style("cursor",function(a){return _g(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Xi||(c=Hb(a),d=Nb(c),e=Vb(),Pb(c.data.id),Af(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Hb(a),c=Nb(b),d=[c];Ud(d,Jf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Xi||(c=Hb(a),d=Nb(c),e=Wb(),Qb(c.data.id),Bf(),Vd(),e(d,b))}).on("click",function(a,b){var c=Hb(a),d=Nb(c),e=Ub();hf(this,a,b),e(d,b)}),s.attr("transform",I?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Xi=!0}).transition().duration(R).attrTween("d",function(a){var b,c=Hb(a);return c?(b=Jf.interpolate(this._current,c),this._current=b(0),function(a){return Kb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",I?"scale(1)":"").style("fill",function(a){return Zi(a.data)}).style("opacity",1).call(He,function(){Xi=!1}),s.exit().transition().duration(S).style("opacity",0).remove(),xj.selectAll("."+g.chartArc).select("text").attr("transform",Lb).style("opacity",0).transition().duration(R).text(Ob).style("opacity",function(a){return Ic(a.data.id)&&re(a.data)?1:0}),xj.select("."+g.chartArcsTitle).style("opacity",je(Kf.data.targets)?1:0),ih&&(Jf.event&&"zoom"===Jf.event.type&&qj.extent(zg.orgDomain()).update(),E&&(!rh&&Dh&&hb(cj.subx,c.axisSubX,Dh),qj.empty()||qj.extent(zg.orgDomain()).update(),O=$e(X,!0),w=yj.selectAll("."+g.bars).selectAll("."+g.bar).data(ue),w.enter().append("path").attr("class",dd).style("stroke","none").style("fill",Zi),w.style("opacity",vd).transition().duration(R).attr("d",O).style("opacity",1),w.exit().transition().duration(R).style("opacity",0).remove(),v=yj.selectAll("."+g.lines).selectAll("."+g.line).data(se),v.enter().append("path").attr("class",_c).style("stroke",Zi),v.style("opacity",vd).transition().duration(R).attr("d",tj).style("opacity",1),v.exit().transition().duration(R).style("opacity",0).remove())),xj.selectAll("."+g.selectedCircles).filter(function(a){return ne(a)}).selectAll("circle").remove(),xj.selectAll("."+g.selectedCircle).transition().duration(R).attr("cx",rh?$d:Zd).attr("cy",rh?Zd:$d),x=xj.select("."+g.eventRects),Ee(Kg)&&!qc(Kg)?(x.classed(g.eventRectsMultiple)||x.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),y=xj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),gf(y.enter()),y.attr("x",0).attr("y",0).attr("width",cg).attr("height",eg)):(x.classed(g.eventRectsSingle)||x.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Si&&!Ri?(C=function(a,b){var c=zc(b),d=Ac(b),e=Kf.data.xs[a.id][b];return(zg(d?d:e+50)-zg(c?c:e-50))/2},B=function(a,b){var c=zc(b),d=Kf.data.xs[a.id][b];return(zg(d)+zg(c?c:d-50))/2}):(C=N(),B=function(a){return zg(a.x)-C/2}),z=Cc(Kf.data.targets),xj.select("."+g.eventRects).datum(z?z.values:[]),y=xj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),ff(y.enter()),y.attr("class",kd).attr("x",rh?0:B).attr("y",rh?B:0).attr("width",rh?cg:C).attr("height",rh?C:eg),y.exit().remove()),Ec(Kf.data.targets).forEach(function(a){Ej[a]=!0})}function of(){nf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function pf(){if(0!==Kc(Kf.data.targets).length){if("mousemove"===Jf.event.sourceEvent.type&&uj.altDomain)return zg.domain(uj.altDomain),void uj.scale(zg).updateScaleExtent();Ri&&zg.orgDomain()[0]===Cj[0]&&zg.domain([Cj[0]-1e-10,zg.orgDomain()[1]]),nf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Jf.event.sourceEvent.type&&(Vi=!0)}}function qf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function rf(){vj.attr("width",gg).attr("height",hg),vj.select("#"+Ki).select("rect").attr("width",cg).attr("height",eg),vj.select("#"+Li).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),vj.select("#"+Mi).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),vj.select("."+g.zoomRect).attr("width",cg).attr("height",eg),Bj.style("max-height",hg+"px")}function sf(a){return{axisX:a?cj.x.transition().duration(a):cj.x,axisY:a?cj.y.transition().duration(a):cj.y,axisY2:a?cj.y2.transition().duration(a):cj.y2,axisSubX:a?cj.subx.transition().duration(a):cj.subx}}function tf(a){var b;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,a.withLegend&&lh||(b=sf(a.withTransition?$f:0),p(),T(),rf(),o(a.withTransition,b)),nf(a,b)}function uf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=xj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",md),j=i.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Yc),e=xj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",od),d=e.enter().append("g").attr("class",od).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",ed).style("cursor",function(a){return _g(a)?"pointer":null}),c=xj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",nd),b=c.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",ad),b.append("g").attr("class",id),b.append("g").attr("class",function(a){return Wc(g.selectedCircles,a.id)}),b.append("g").attr("class",cd).style("cursor",function(a){return _g(a)?"pointer":null}),a.forEach(function(a){xj.selectAll("."+g.selectedCircles+qd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=xj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(qg(a)).attr("class",pd),f=h.enter().append("g").attr("class",pd),f.append("g").attr("class",gd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),ih&&(n=yj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",od),m=n.enter().append("g").style("opacity",0).attr("class",od),m.append("g").attr("class",ed),l=yj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",nd),k=l.enter().append("g").style("opacity",0).attr("class",nd),k.append("g").attr("class",ad)),vj.selectAll("."+g.target).filter(function(a){return Ic(a.id)}).transition().duration($f).style("opacity",1)}function vf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?ee(a.id,b.types[a.id]):ee(a.id,b.type)}),Kf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,z=0,F++)),E[a]=F,D[F]=f,A[a]=z,z+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+v)/10),j=10*Math.ceil((h.height+u)/10),k=ij?j:i,l=ij?S():R();return d&&(z=0,F=0,w=0,x=0),lh&&!Jc(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=i,C[c]=j,(!w||i>=w)&&(w=i),(!x||j>=x)&&(x=j),g=ij?x:w,void(qh?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(l-g*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=26,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=zj.selectAll("."+g.legendItemFocused).size();b=b||{},n=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,ij?(f=function(a){return w*E[a]},j=function(a){return D[E[a]]+A[a]}):(f=function(a){return D[E[a]]+A[a]},j=function(a){return x*E[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=zj.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Wc(g.legendItem,a)}).style("visibility",function(a){return Jc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof nh?nh(a):Kf.toggle(a)}).on("mouseover",function(a){Jf.select(this).classed(g.legendItemFocused,!0),Xi||Kf.focus(a),"function"==typeof oh&&oh(a)}).on("mouseout",function(a){Jf.select(this).classed(g.legendItemFocused,!1),Xi||Kf.revert(),"function"==typeof ph&&ph(a)}),m.append("text").text(function(a){return d(Ng[a])?Ng[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",ij?h:-200).attr("y",ij?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",ij?i:-200).attr("y",ij?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",Zi).attr("x",ij?h:-200).attr("y",ij?-200:j).attr("width",10).attr("height",10),r=zj.selectAll("text").data(a).text(function(a){return d(Ng[a])?Ng[a]:a}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=zj.selectAll("rect."+g.legendItemEvent).data(a),(n?s.transition():s).attr("width",function(a){return B[a]}).attr("height",function(a){return C[a]}).attr("x",i).attr("y",l),t=zj.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",Zi).attr("x",f).attr("y",j),zj.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Ic(a)}).transition().style("opacity",function(a){var b=Jf.select(this);return Ic(a)?!G||b.classed(g.legendItemFocused)?yf(b):zf(b):mj}),P(w),Q(x),O(F),p(),T(),rf(),o(q,c)}function Ff(a){return Gc(Kf.data.targets,a.id)}function Gf(a){return"data"in a&&Gc(Kf.data.targets,a.data.id)}function Hf(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 If(a,b,c){var d=!ke(Kf.data.targets);Xi=!1,ee(a,b),tf(c||{withTransitionForAxis:d})}var Jf=a.d3?a.d3:a.require?a.require("d3"):void 0,Kf={data:{},axis:{},legend:{}},Lf={},Mf=i(["bindto"],"#chart"),Nf=i(["size","width"]),Of=i(["size","height"]),Pf=i(["padding","left"],50),Qf=i(["padding","right"],0),Rf=i(["padding","top"],0),Sf=i(["padding","bottom"],0),Tf=i(["zoom","enabled"],!1),Uf=i(["zoom","extent"]),Vf=i(["zoom","privileged"],!1),Wf=i(["onenter"],function(){}),Xf=i(["onleave"],function(){}),Yf=i(["onresize"],function(){}),Zf=i(["onresized"],function(){}),$f=i(["transition","duration"],350);h("data","data is required in config");var _f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg=i(["data","x"]),Kg=i(["data","xs"],{}),Lg=i(["data","x_format"]),Mg=i(["data","id_converter"],function(a){return a}),Ng=i(["data","names"],{}),Og=i(["data","classes"],{}),Pg=i(["data","groups"],[]),Qg=i(["data","axes"],{}),Rg=i(["data","type"]),Sg=i(["data","types"],{}),Tg=i(["data","labels"],{}),Ug=i(["data","order"]),Vg=i(["data","regions"],{}),Wg=i(["data","color"]),Xg=i(["data","colors"],{}),Yg=i(["data","hide"],!1),Zg=i(["data","selection","enabled"],!1),$g=i(["data","selection","grouped"],!1),_g=i(["data","selection","isselectable"],function(){return!0}),ah=i(["data","selection","multiple"],!0),bh=i(["data","onclick"],function(){}),ch=i(["data","onenter"],function(){}),dh=i(["data","onleave"],function(){}),eh=i(["data","onselected"],function(){}),fh=i(["data","onunselected"],function(){}),gh=i(["data","ondragstart"],function(){}),hh=i(["data","ondragend"],function(){}),ih=i(["subchart","show"],!1),jh=i(["subchart","size","height"],60),kh=i(["color","pattern"],[]),lh=i(["legend","show"],!0),mh=i(["legend","position"],"bottom"),nh=i(["legend","item","onclick"]),oh=i(["legend","item","onmouseover"]),ph=i(["legend","item","onmouseout"]),qh=i(["legend","equally"],!1),rh=i(["axis","rotated"],!1),sh=i(["axis","x","show"],!0),th=i(["axis","x","type"],"indexed"),uh=i(["axis","x","localtime"],!0),vh=i(["axis","x","categories"],[]),wh=i(["axis","x","tick","centered"],!1),xh=i(["axis","x","tick","format"]),yh=i(["axis","x","tick","culling"],{}),zh=i(["axis","x","tick","culling","max"],10),Ah=i(["axis","x","tick","count"]),Bh=i(["axis","x","tick","fit"],!0),Ch=i(["axis","x","tick","values"],null),Dh=i(["axis","x","tick","rotate"]),Eh=i(["axis","x","max"],null),Fh=i(["axis","x","min"],null),Gh=i(["axis","x","padding"],{}),Hh=i(["axis","x","height"]),Ih=i(["axis","x","default"]),Jh=i(["axis","x","label"],{}),Kh=i(["axis","y","show"],!0),Lh=i(["axis","y","max"]),Mh=i(["axis","y","min"]),Nh=i(["axis","y","center"]),Oh=i(["axis","y","label"],{}),Ph=i(["axis","y","inner"],!1),Qh=i(["axis","y","tick","format"]),Rh=i(["axis","y","padding"]),Sh=i(["axis","y","ticks"],10),Th=i(["axis","y2","show"],!1),Uh=i(["axis","y2","max"]),Vh=i(["axis","y2","min"]),Wh=i(["axis","y2","center"]),Xh=i(["axis","y2","label"],{}),Yh=i(["axis","y2","inner"],!1),Zh=i(["axis","y2","tick","format"]),$h=i(["axis","y2","padding"]),_h=i(["axis","y2","ticks"],10),ai=i(["grid","x","show"],!1),bi=i(["grid","x","type"],"tick"),ci=i(["grid","x","lines"],[]),di=i(["grid","y","show"],!1),ei=i(["grid","y","lines"],[]),fi=i(["grid","y","ticks"],10),gi=i(["point","show"],!0),hi=i(["point","r"],2.5),ii=i(["point","focus","line","enabled"],!0),ji=i(["point","focus","expand","enabled"],!0),ki=i(["point","focus","expand","r"]),li=i(["point","focus","select","r"]),mi=i(["line","connect_null"],!1),ni=i(["bar","width"]),oi=i(["bar","width","ratio"],.6),pi=i(["pie","label","show"],!0),qi=i(["pie","label","format"]),ri=i(["pie","expand"],!0),si=i(["pie","onclick"],function(){}),ti=i(["pie","onmouseover"],function(){}),ui=i(["pie","onmouseout"],function(){}),vi=i(["donut","label","show"],!0),wi=i(["donut","label","format"]),xi=i(["donut","expand"],!0),yi=i(["donut","title"],""),zi=i(["donut","onclick"],function(){}),Ai=i(["donut","onmouseover"],function(){}),Bi=i(["donut","onmouseout"],function(){}),Ci=i(["regions"],[]),Di=i(["tooltip","show"],!0),Ei=i(["tooltip","format","title"]),Fi=i(["tooltip","format","value"]),Gi=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Ei?Ei:b,l=Fi?Fi:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Hi=i(["tooltip","init","show"],!1),Ii=i(["tooltip","init","x"],0),Ji=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Ki=("string"==typeof Mf?Mf.replace("#",""):Mf.id)+"-clip",Li=Ki+"-xaxis",Mi=Ki+"-yaxis",Ni=j(Ki),Oi=j(Li),Pi=j(Mi),Qi="timeseries"===th,Ri="categorized"===th,Si=!Qi&&(Jg||Ee(Kg)),Ti=null,Ui=!1,Vi=!1,Wi=!1,Xi=!1,Yi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Zi=ye(Xg,Ee(kh)?kh:Yi,Wg),$i=uh?Jf.time.format:Jf.time.format.utc,_i=$i.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),aj=[],bj=[],cj={},dj=rh?"left":"bottom",ej=rh?Ph?"top":"bottom":Ph?"right":"left",fj=rh?Yh?"bottom":"top":Yh?"left":"right",gj=rh?"left":"bottom",hj={main:function(){return"translate("+k(_f.left)+","+k(_f.top)+")"},context:function(){return"translate("+k(ag.left)+","+k(ag.top)+")"},legend:function(){return"translate("+bg.left+","+bg.top+")"},x:function(){return"translate(0,"+(rh?0:eg)+")" -},y:function(){return"translate(0,"+(rh?eg:0)+")"},y2:function(){return"translate("+(rh?0:cg)+","+(rh?1:0)+")"},subx:function(){return"translate(0,"+(rh?0:fg)+")"},arc:function(){return"translate("+lg/2+","+mg/2+")"}},ij="right"===mh,jj=0,kj=0,lj=0,mj=.15,nj=30,oj=rh&&!sh?0:30,pj=5;qg=Jf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var qj,rj=function(){var a=Jf.svg.line().x(rh?function(a){return Y(a.id)(a.value)}:Hd).y(rh?Hd:function(a){return Y(a.id)(a.value)});return mi||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=mi?Qe(b.values):b.values;return le(b)?(a.interpolate(me(b)?"cardinal":"linear"),Vg[b.id]?df(e,zg,Y(b.id),Vg[b.id]):a(e)):(c=e[0]?zg(e[0].x):0,d=e[0]?Y(b.id)(e[0].value):0,rh?"M "+d+" "+c:"M "+c+" "+d)}}(),sj=function(){var a;return a=rh?Jf.svg.area().x0(function(a){return Y(a.id)(0)}).x1(function(a){return Y(a.id)(a.value)}).y(Hd):Jf.svg.area().x(Hd).y0(function(a){return Y(a.id)(0)}).y1(function(a){return Y(a.id)(a.value)}),function(b){var c,d,e=Qe(b.values);return fe([b],"area")||fe([b],"area-spline")?(a.interpolate(me(b)?"cardinal":"linear"),a(e)):(c=e[0]?zg(e[0].x):0,d=e[0]?Y(b.id)(e[0].value):0,rh?"M "+d+" "+c:"M "+c+" "+d)}}(),tj=function(){var a=Jf.svg.line().x(rh?function(a){return Z(a.id)(a.value)}:Kd).y(rh?Kd:function(a){return Z(a.id)(a.value)});return function(b){var c=Qe(b.values);return le(b)?a(c):"M "+Cg(c[0].x)+" "+Z(b.id)(c[0].value)}}(),uj=function(){};qj=Jf.svg.brush().on("brush",of),qj.update=function(){return yj&&yj.select("."+g.brush).call(this),this},qj.scale=function(a){return rh?this.y(a):this.x(a)},Tf&&(uj=Jf.behavior.zoom().on("zoomstart",function(){uj.altDomain=Jf.event.sourceEvent.altKey?zg.orgDomain():null}).on("zoom",Tf?pf:null),uj.scale=function(a){return rh?this.y(a):this.x(a)},uj.orgScaleExtent=function(){var a=Uf?Uf:[1,10];return[a[0],Math.max(Bc()/a[1],a[1])]},uj.updateScaleExtent=function(){var a=cc(zg.orgDomain())/cc(Cj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var vj,wj,xj,yj,zj,Aj,Bj,Cj,Dj,Ej={};if(Kf.focus=function(a){function b(a){Kc(a).transition().duration(100).style("opacity",1)}var c=vj.selectAll(rd(a)),d=c.filter(Ff),e=c.filter(Gf);Kf.revert(),Kf.defocus(),b(d.classed(g.focused,!0)),b(e),ke(Kf.data.targets)&&Pb(a,!0),Af(a,!0)},Kf.defocus=function(a){function b(a){Kc(a).transition().duration(100).style("opacity",.3)}var c=vj.selectAll(rd(a)),d=c.filter(Ff),e=c.filter(Gf);Kf.revert(),b(d.classed(g.focused,!1)),b(e),ke(Kf.data.targets)&&Qb(a),Af(a,!1)},Kf.revert=function(a){function b(a){Kc(a).transition().duration(100).style("opacity",1)}var c=vj.selectAll(rd(a)),d=c.filter(Ff),e=c.filter(Gf);b(d.classed(g.focused,!1)),b(e),ke(Kf.data.targets)&&Qb(a),Bf()},Kf.show=function(a,b){a=Fc(a),b=b||{},Oc(a),vj.selectAll(sd(a)).transition().style("opacity",1),b.withLegend&&Cf(a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Kf.hide=function(a,b){a=Fc(a),b=b||{},Nc(a),vj.selectAll(sd(a)).transition().style("opacity",0),b.withLegend&&Df(a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Kf.toggle=function(a){Ic(a)?Kf.hide(a):Kf.show(a)},Kf.unzoom=function(){qj.clear().update(),nf({withUpdateXDomain:!0})},Kf.load=function(a){return a.xs&&pc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Og[b]=a.classes[b]}),"categories"in a&&Ri&&(vh=a.categories,Fg.categories(vh)),"cacheIds"in a&&dc(a.cacheIds)?void vf(fc(a.cacheIds),a.done):void("unload"in a?xf(Fc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){wf(a)}):wf(a))},Kf.unload=function(a,b){xf(Fc(a),function(){nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Kf.selected=function(a){return Jf.merge(xj.selectAll("."+g.shapes+qd(a)).selectAll("."+g.shape).filter(function(){return Jf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Kf.select=function(a,b,c){Zg&&xj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Jf.select(this),i=e.data?e.data.id:e.id,j=Pe(this),k=$g||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);"path"!==this.nodeName&&(k&&l?_g(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},Kf.unselect=function(a,b){Zg&&xj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Jf.select(this),f=c.data?c.data.id:c.id,h=Pe(this),i=$g||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);"path"!==this.nodeName&&i&&j&&_g(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Kf.toLine=function(a){If(a,"line")},Kf.toSpline=function(a){If(a,"spline")},Kf.toBar=function(a){If(a,"bar")},Kf.toScatter=function(a){If(a,"scatter")},Kf.toArea=function(a){If(a,"area")},Kf.toAreaSpline=function(a){If(a,"area-spline")},Kf.toPie=function(a){If(a,"pie",{withTransform:!0})},Kf.toDonut=function(a){If(a,"donut",{withTransform:!0})},Kf.groups=function(a){return c(a)?Pg:(Pg=a,nf(),Pg)},Kf.xgrids=function(a){return a?(ci=a,nf(),ci):ci},Kf.xgrids.add=function(a){return a?Kf.xgrids(ci.concat(a)):void 0},Kf.xgrids.remove=function(a){var b=Hf(a);return Kf.xgrids(ci.filter(b))},Kf.ygrids=function(a){return a?(ei=a,nf(),ei):ei},Kf.ygrids.add=function(a){return a?Kf.ygrids(ei.concat(a)):void 0},Kf.ygrids.remove=function(a){var b=Hf(a);return Kf.ygrids(ei.filter(b))},Kf.regions=function(a){return c(a)?Ci:(Ci=a,nf(),Ci)},Kf.regions.add=function(a){return c(a)?Ci:(Ci=Ci.concat(a),nf(),Ci)},Kf.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;vj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Ci=Ci.filter(function(b){return b.classes.indexOf(a)<0})}),Ci},Kf.data.get=function(a){var b=Kf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Kf.data.getAsTarget=function(a){var b=Hc(function(b){return b.id===a});return b.length>0?b[0]:void 0},Kf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Ng[b]=a[b]}),nf({withLegend:!0}),Ng):Ng},Kf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Xg[b]=a[b]}),nf({withLegend:!0}),Xg):Xg},Kf.x=function(a){return arguments.length&&(sc(Kf.data.targets,a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Kf.data.xs},Kf.xs=function(a){return arguments.length&&(tc(Kf.data.targets,a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Kf.data.xs},Kf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){eb(b,a[b])}),Gb())},Kf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Eh=+a.x),b(a.y)&&(Lh=+a.y),b(a.y2)&&(Uh=+a.y2)):Lh=Uh=+a,nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Kf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Fh=+a.x),b(a.y)&&(Mh=+a.y),b(a.y2)&&(Vh=+a.y2)):Mh=Vh=+a,nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Kf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Kf.axis.max(a.max),"undefined"!=typeof a.min&&Kf.axis.min(a.min))},Kf.legend.show=function(a){Cf(Fc(a)),nf({withLegend:!0})},Kf.legend.hide=function(a){Df(Fc(a)),nf({withLegend:!0})},Kf.resize=function(a){Nf=a?a.width:null,Of=a?a.height:null,tf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Kf.destroy=function(){Kf.data.targets=void 0,Kf.data.xs={},Bj.html(""),a.onresize=null},"url"in f.data)Jf.xhr(f.data.url,function(a,b){var c,d=Jf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Jf.csv.parse(b.response),ef(c)});else if("rows"in f.data)ef(vc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");ef(wc(f.data.columns))}return Kf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(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}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.ceil(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.ceil(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&adg&&(dg=0),0>fg&&(fg=0),eg=sh?ag.left-oj-pj:dg,gg=sh?fg:ig-bg.top-bg.bottom,0>eg&&(eg=0),0>gg&&(gg=0),mg=dg-(jj?b+10:0),ng=fg-(jj?0:10),r(),jj&&d&&(cg.left=mg/2+1.1*kg)}function q(){yj.select("line."+g.xgridFocus).attr("x1",sh?0:-10).attr("x2",sh?dg:-10).attr("y1",sh?-10:ag.top).attr("y2",sh?-10:fg)}function r(){kg=Math.min(mg,ng)/2,jg=.95*kg,lg=je(Lf.data.targets)?.6*jg:0}function s(){var a=sh?g.axisX:g.axisY,b=yj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Kf.select(Nf).node().getBoundingClientRect(),e=ke(Lf.data.targets),f=c.right-d.left-(e?0:v());return f>0?f:0}function t(){return Of?Of:z()}function u(){var a=Pf?Pf:A();return a>0?a:320}function v(){var a=1;return Qf?Qf:sh?th?x("x"):a:!Lh||Qh?a:x("y")}function w(){var a=1;return Rf?Rf:jj?R()+20+(Uh&&!sh?x("y2"):a):Uh?Zh||sh?a:x("y2"):a}function x(a){var b=mb(a);return b.isInner?20+Fb(a):40+Fb(a)}function y(a){return"x"!==a||th?"x"===a&&Ih?Ih:"y"!==a||Lh?"y2"!==a||Uh?(mb(a).isInner?30:40)+("y2"===a?-10:0):qj:mh&&!jj?10:1:0}function z(){return+Kf.select(Nf).style("width").replace("px","")}function A(){return+Kf.select(Nf).style("height").replace("px","")}function B(a){return a?-31:-(ag.left-1)}function C(a){return a?-20:-4}function D(){return B(!sh)}function E(){return C(!sh)}function F(){return B(sh)}function G(){return C(sh)}function H(a){return a?dg+2+30+30:ag.left+20}function I(a){return a?(Ih?Ih:0)+80:fg+8}function J(){return H(!sh)}function K(){return I(!sh)}function L(){return H(sh)}function M(){return I(sh)}function N(){var a,b,c,d,e,f=Cc(Lf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=Ag(b.x)-Ag(a.x),0===c?sh?fg:dg:(d=Bc(),e=ge(Lf.data.targets)?(d-(Si?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function O(a){kj=a}function P(a){lj=a}function Q(a){mj=a}function R(){return mh?jj?lj*(kj+1):hg:0}function S(){return mh?jj?ig:mj*(kj+1):0}function T(){var a,b,c=!Ag;sg=sh?1:0,tg=sh?fg:dg,ug=sh?0:fg,vg=sh?dg:1,wg=sg,xg=tg,yg=sh?0:gg,zg=sh?eg:1,Ag=W(sg,tg,c?void 0:Ag.domain(),function(){return Gg.tickOffset()}),Bg=X(ug,vg,c?void 0:Bg.domain()),Cg=X(ug,vg,c?void 0:Cg.domain()),Dg=W(sg,tg,Dj,function(a){return a%1?0:Jg.tickOffset()}),Eg=X(yg,zg,c?void 0:Eg.domain()),Fg=X(yg,zg,c?void 0:Fg.domain()),a=bb(),b=Dh?Dh:c?void 0:Gg.tickValues(),Gg=$(Ag,ej,a,b),Jg=$(Dg,hj,a,b),Hg=_(Bg,fj,Rh,Th),Ig=_(Cg,gj,$h,ai),c||(rj.scale(Dg),Uf&&vj.scale(Ag)),U()}function U(){og=Ib(),pg=Jb(),qg=Jb(.98)}function V(a,b,c){return(c?Kf.time.scale():Kf.scale.linear()).range([a,b])}function W(a,b,c,d){var e,f=V(a,b,Ri),g=c?f.domain(c):f;Si?(d=d||function(){return 0},f=function(a,b){var c=g(a)+d(a);return b?c:Math.ceil(c)}):f=function(a,b){var c=g(a);return b?c:Math.ceil(c)};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return Dj&&Dj[0]===a[0]&&Dj[1]a?a.toFixed(0):a};return yh&&("function"==typeof yh?a=yh:Ri&&(a=function(a){return a?_i(yh)(a):""})),a}function cb(a){var b;return"y"===a?b=Ph:"y2"===a?b=Yh:"x"===a&&(b=Kh),b}function db(a){var b=cb(a);return"string"==typeof b?b:b?b.text:null}function eb(a,b){var c=cb(a);"string"==typeof c?"y"===a?Ph=b:"y2"===a?Yh=b:"x"===a&&(Kh=b):c&&(c.text=b)}function fb(a){return 10*Math.sin(Math.PI*(a/180))}function gb(a){return 11.5-2.5*(a/15)}function hb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",gb(c)).attr("x",fb(c)).attr("transform","rotate("+c+")")}function ib(a,b){var c=cb(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 jb(){return ib("x",sh?"inner-top":"inner-right")}function kb(){return ib("y",sh?"inner-right":"inner-top")}function lb(){return ib("y2",sh?"inner-right":"inner-top")}function mb(a){return"y2"===a?lb():"y"===a?kb():jb()}function nb(){return db("x")}function ob(){return db("y")}function pb(){return db("y2")}function qb(a,b){return a?b.isLeft?0:b.isCenter?dg/2:dg:b.isBottom?-fg:b.isMiddle?-fg/2:0}function rb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function sb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function tb(){return qb(!sh,jb())}function ub(){return qb(sh,kb())}function vb(){return qb(sh,lb())}function wb(){return rb(!sh,jb())}function xb(){return rb(sh,kb())}function yb(){return rb(sh,lb())}function zb(){var a=jb();return sh?a.isInner?"1.2em":-25-Fb("x"):a.isInner?"-0.5em":Ih?Ih-10:"3em"}function Ab(){var a=kb();return sh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Fb("y")}function Bb(){var a=lb();return sh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Fb("y2")}function Cb(){return sb(!sh,jb())}function Db(){return sb(sh,kb())}function Eb(){return sb(sh,lb())}function Fb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Kf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Gb(a){var b=yj.select("."+g.axisX+" ."+g.axisXLabel),c=yj.select("."+g.axisY+" ."+g.axisYLabel),d=yj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",tb).attr("dx",wb).attr("dy",zb).text(nb),(a?c.transition():c).attr("x",ub).attr("dx",xb).attr("dy",Ab).attr("dy",Ab).text(ob),(a?d.transition():d).attr("x",vb).attr("dx",yb).attr("dy",Bb).text(pb)}function Hb(a){var b=!1;return rg(Kc(Lf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Ib(){var a=Kf.svg.arc().outerRadius(jg).innerRadius(lg),b=function(b,c){var d;return c?a(b):(d=Hb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Jb(a){var b=Kf.svg.arc().outerRadius(kg*(a?a:1)).innerRadius(lg);return function(a){var c=Hb(a);return c?b(c):"M 0 0"}}function Kb(a,b){return re(a.data)?og(a,b):"M 0 0"}function Lb(a){var b,c,d,e,f=Hb(a),g="";return f&&(b=og.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*jg*.8+","+d/e*jg*.8+")"),g}function Mb(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Nb(a){return rc({id:a.data.id,value:a.value,ratio:Mb(a)})}function Ob(a){var b,c,d,e;return Rb()?(b=Hb(a),c=b?b.value:null,d=Mb(b),e=Sb(),e?e(c,d):Fd(c,d)):""}function Pb(a,b){var c=wj.selectAll("."+g.chartArc+rd(a)),d=wj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});xe(a)&&c.selectAll("path").transition().duration(50).attr("d",pg).transition().duration(100).attr("d",qg).each(function(a){qe(a.data)}),b||d.style("opacity",.3)}function Qb(a){var b=wj.selectAll("."+g.chartArc+rd(a));b.selectAll("path").transition().duration(50).attr("d",og),wj.selectAll("."+g.arc).style("opacity",1)}function Rb(){return je(Lf.data.targets)?wi:qi}function Sb(){return je(Lf.data.targets)?xi:ri}function Tb(){return je(Lf.data.targets)?zi:""}function Ub(){var a=je(Lf.data.targets)?Ai:ti;return"function"==typeof a?a:function(){}}function Vb(){var a=je(Lf.data.targets)?Bi:ui;return"function"==typeof a?a:function(){}}function Wb(){var a=je(Lf.data.targets)?Ci:vi;return"function"==typeof a?a:function(){}}function Xb(a){var b,c,d,e,f,g,h=Ec(a),i=Rc(a);if(Qg.length>0)for(g=Tc(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 Kf.min(Object.keys(i).map(function(a){return Kf.min(i[a])}))}function Yb(a){var b,c,d,e,f,g,h=Ec(a),i=Rc(a);if(Qg.length>0)for(g=Uc(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 Kf.max(Object.keys(i).map(function(a){return Kf.max(i[a])}))}function Zb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return ab(a.id)===c}),m="y2"===c?Wh:Nh,n="y2"===c?Vh:Mh,o=b(m)?m:Xb(l),p=b(n)?n:Yb(l),q="y2"===c?Xh:Oh,r=zd()&&sh;return 0===l.length?"y2"===c?Cg.domain():Bg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=Ad(o,p),j=cc(Bg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Sh&&(f=b(Sh.top)?Sh.top:e,g=b(Sh.bottom)?Sh.bottom:e),"y2"===c&&_h&&(f=b(_h.top)?_h.top:e,g=b(_h.bottom)?_h.bottom:e),ge(l)&&!Tc(l)&&(g=o),[o-g,p+f])}function $b(a){return Gh?Ri?ze(Gh):Gh:Kf.min(a,function(a){return Kf.min(a.values,function(a){return a.x})})}function _b(a){return Fh?Ri?ze(Fh):Fh:Kf.max(a,function(a){return Kf.max(a.values,function(a){return a.x})})}function ac(a){var c,d,e,f,g=Dc(a),h=g[1]-g[0];return Si?d=0:ge(a)?(c=Bc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Hh&&Ee(Hh)?(e=b(Hh.left)?Hh.left:d,f=b(Hh.right)?Hh.right:d):e=f="number"==typeof Hh?Hh:d,{left:e,right:f}}function bc(a){var b=[$b(a),_b(a)],c=b[0],d=b[1],e=ac(a),f=0,g=0;return c-d!==0||Si||(c=Ri?new Date(.5*c.getTime()):-.5,d=Ri?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Ri?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Ri?new Date(d.getTime()+e.right):d+e.right),[f,g]}function cc(a){return a[1]-a[0]}function dc(a){for(var b=0;bb?0:b-c}function jc(a){var b,c=hc(a),d="y"===a.axis?Bg:Cg;return b="y"===a.axis||"y2"===a.axis?sh?fg:"start"in a?d(a.start):fg:sh?"end"in a?Ag(Ri?ze(a.end):a.end):fg:fg,c>b?0:b-c}function kc(a){return Kg&&a===Kg||Ee(Lg)&&Fe(Lg,a)}function lc(a){return!kc(a)}function mc(a){return Kg?Kg:Ee(Lg)?Lg[a]:null}function nc(a,b){var c,d=b&&Ee(b)?Ec(b):[];return d.forEach(function(b){mc(b)===a&&(c=Lf.data.xs[b])}),c}function oc(a,b){return a in Lf.data.xs&&Lf.data.xs[a]&&Lf.data.xs[a][b]?Lf.data.xs[a][b]:b}function pc(a){Object.keys(a).forEach(function(b){Lg[b]=a[b]})}function qc(a){return 1===Kf.set(Object.keys(a).map(function(b){return a[b]})).size()}function rc(a){var b;return a&&(b=Og[a.id],a.name=b?b:a.id),a}function sc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=uc(b[d],a.id,d)}),Lf.data.xs[a.id]=b})}function tc(a,b){a.forEach(function(a){b[a.id]&&sc([a],b[a.id])})}function uc(a,c,d){var e;return e=Ri?a?a instanceof Date?a:ze(a):ze(oc(c,d)):Ti&&!Si?b(a)?+a:oc(c,d):d}function vc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Lf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Kg?(d=Object.keys(Lf.data.xs),Lf.data.xs[c]=d.length>0?Lf.data.xs[d[0]]:void 0):Ee(Lg)&&(Lf.data.xs[c]=nc(f,Lf.data.targets)):Lf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Lf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Ng(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=mc(b),g=a[f],h=uc(g,b,e);return Ti&&Si&&0===c&&g&&(0===e&&(wh=[]),wh.push(g)),("undefined"==typeof a[b]||Lf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Sg&&ee(Ec(c).filter(function(a){return!(a in Tg)}),Sg),c.forEach(function(a){ec(a.id_org,a)}),c}function yc(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 zc(a){return a>0&&Lf.data.targets[0].values[a-1]?Lf.data.targets[0].values[a-1].x:void 0}function Ac(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Dc(a){var b,c,d=Cc(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Ec(a){return a.map(function(a){return a.id})}function Fc(a){return a?"string"==typeof a?[a]:a:Ec(Lf.data.targets)}function Gc(a,b){var c,d=Ec(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Ri?new Date(i):i);j.push(e)}return Ri||(j=j.sort(function(a,b){return a-b})),j}function Nc(a){bj=bj.concat(a)}function Oc(a){bj=bj.filter(function(b){return a.indexOf(b)<0})}function Pc(a){cj=cj.concat(a)}function Qc(a){cj=cj.filter(function(b){return a.indexOf(b)<0})}function Rc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Sc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Uc(a){return Sc(a,function(a){return a>0})}function Vc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],(a[f].x||0===a[f].x)&&(e=e.concat(Ld(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Ld(a,g))),Od(e,b)):Md(a,b,f,g)}function Nd(a,b){var c;return c=a.map(function(a){return Md(a.values,b)}),Od(c,b)}function Od(a,b){var c,d;return a.forEach(function(a){var e=Ge(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Pd(a,b){return Kf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Qd(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 Rd(){return Vg&&"desc"===Vg.toLowerCase()}function Sd(){return Vg&&"asc"===Vg.toLowerCase()}function Td(a){var b=Sd(),c=Rd();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 Vg&&a.sort(Vg),a}function Ud(a,c){var d,e,f,g,h,i,j,k=ke(Lf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&Ei&&(Bj.html(Hi(a,bb(),Bd(k),$i)).style("display","block"),d=Bj.property("offsetWidth"),e=Bj.property("offsetHeight"),k?(g=dg/2+c[0],i=fg/2+c[1]+20):(sh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-w(),i=Ag(l[0].x)+20):(f=s(),g=f+v()+Ag(l[0].x)+20,h=g+d,j=f+t()-w(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),Bj.style("top",i+"px").style("left",g+"px"))}function Vd(){Bj.style("display","none")}function Wd(a){var c=a.filter(function(a){return a&&b(a.value)});if(Ei&&!he(Lf.data.targets)&&!ke(Lf.data.targets)){var d=yj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(sh?"y1":"x1",Hd).attr(sh?"y2":"x2",Hd),nf(d,"grid")}}function Xd(){yj.select("line."+g.xgridFocus).style("visibility","hidden")}function Yd(a,b){var c,d,e,f,h=[],i=yj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=bc(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function Zd(a){return a.x||0===a.x?Ag(a.x):null}function $d(a){return Y(a.id)(a.value)}function _d(){var a,b,d={},e=0;return Kc(Hc(ne)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function de(a,b){return"number"==typeof oi?oi:b?2*a.tickOffset()*pi/b:0}function ee(a,b){Fc(a).forEach(function(a){Fj[a]=b===Tg[a],Tg[a]=b})}function fe(a,b){var c=!1;return a.forEach(function(a){Tg[a.id]===b&&(c=!0),a.id in Tg||"line"!==b||(c=!0)}),c}function ge(a){return fe(a,"bar")}function he(a){return fe(a,"scatter")}function ie(a){return fe(a,"pie")}function je(a){return fe(a,"donut")}function ke(a){return ie(a)||je(a)}function le(a){var b="string"==typeof a?a:a.id;return!(b in Tg)||"line"===Tg[b]||"spline"===Tg[b]||"area"===Tg[b]||"area-spline"===Tg[b]}function me(a){var b="string"==typeof a?a:a.id;return"spline"===Tg[b]||"area-spline"===Tg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"bar"===Tg[b]}function oe(a){var b="string"==typeof a?a:a.id;return"scatter"===Tg[b]}function pe(a){var b="string"==typeof a?a:a.id;return"pie"===Tg[b]}function qe(a){var b="string"==typeof a?a:a.id;return"donut"===Tg[b]}function re(a){return pe(a)||qe(a)}function se(a){return le(a)?[a]:[]}function te(a){return re(a.data)?[a]:[]}function ue(a){return ne(a)?a.values:[]}function ve(a){return le(a)||oe(a)?a.values:[]}function we(a){return ne(a)||le(a)?a.values:[]}function xe(a){return qe(a)&&yi||pe(a)&&si}function ye(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ze(b){var c;try{c=Mg?Kf.time.format(Mg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Mg)}return c}function Ae(a,b){var c=Kf.mouse(a),d=Kf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Fe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Ge(a,b){var c="y"===ab(a.id)?Bg:Cg,d=sh?1:0,e=sh?0:1;return Math.pow(Ag(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function He(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ie(a,b,c){return d(a[b])?a[b]:c}function Je(a,b,c){fh(b,a.node()),yj.select("."+g.selectedCircles+qd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Wc(g.selectedCircle,c)}).attr("cx",sh?$d:Zd).attr("cy",sh?Zd:$d).attr("stroke",function(){return $i(b)}).attr("r",1.4*Ue(b)).transition().duration(100).attr("r",Ue)}function Ke(a,b,c){gh(b,a.node()),yj.select("."+g.selectedCircles+qd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Le(a,b,c,d){a?Je(b,c,d):Ke(b,c,d)}function Me(a,b){fh(b,a.node()),a.transition().duration(100).style("fill",function(){return Kf.rgb($i(b)).brighter(.75)})}function Ne(a,b){gh(b,a.node()),a.transition().duration(100).style("fill",function(){return $i(b)})}function Oe(a,b,c,d){a?Me(b,c,d):Ne(b,c,d)}function Pe(a,b,c,d){Oe(a,b,c.data,d)}function Qe(a){return"circle"===a.nodeName?Le:Kf.select(a).classed(g.bar)?Oe:Pe}function Re(a){return a.filter(function(a){return b(a.value)})}function Se(a){return hi?"function"==typeof ii?ii(a):ii:0}function Te(a){return ki?li?li:1.75*Se(a):Se(a)}function Ue(a){return mi?mi:4*Se(a)}function Ve(a,c){return(c?yj.selectAll("."+g.circles+qd(c)):yj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function We(a,b){Ve(a,b).classed(g.EXPANDED,!0).attr("r",Te)}function Xe(a){Ve(a).filter(function(){return Kf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Se)}function Ye(a){return yj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function Ze(a){Ye(a).classed(g.EXPANDED,!0)}function $e(a){Ye(a).classed(g.EXPANDED,!1)}function _e(a,b){var c=df(a,b);return function(a,b){var d=c(a,b),e=sh?1:0,f=sh?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 af(a,b){var c=df(a,!1),d=b?bf:cf;return function(a,b){return d(c(a,b),a,this)}}function bf(a,b){var c;return sh?(c=ne(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function cf(a,b,c){var d=c.getBoundingClientRect();return sh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ne(b)?-3:-6)}function df(a,b){var c=a.__max__+1,d=de(Gg,c),e=ae(d,c,a,!!b),f=be(!!b),g=ce(a,!!b),h=b?Z:Y;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return sh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function ef(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function ff(b){var c,d,e;if(Cj=Kf.select(Nf),Cj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Cj.html("").classed("c3",!0),Lf.data.xs={},Lf.data.targets=xc(b),Zg&&Nc(Zg===!0?Ec(Lf.data.targets):Zg),p(),T(),Ag.domain(Kf.extent(bc(Lf.data.targets))),Bg.domain(Zb(Lf.data.targets,"y")),Cg.domain(Zb(Lf.data.targets,"y2")),Dg.domain(Ag.domain()),Eg.domain(Bg.domain()),Fg.domain(Cg.domain()),Dj=Ag.domain(),rj.scale(Dg),Uf&&vj.scale(Ag),wj=Cj.append("svg").on("mouseenter",Xf).on("mouseleave",Yf),xj=wj.append("defs"),xj.append("clipPath").attr("id",Li).append("rect"),xj.append("clipPath").attr("id",Mi).append("rect"),xj.append("clipPath").attr("id",Ni).append("rect"),sf(),yj=wj.append("g").attr("transform",ij.main),zj=wj.append("g").attr("transform",ij.context),Aj=wj.append("g").attr("transform",ij.legend),jh||zj.style("visibility","hidden"),mh||(Aj.style("visibility","hidden"),cj=Ec(Lf.data.targets)),Bj=Kf.select(Nf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Ff(Ec(Lf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=yj.append("g").attr("clip-path",Oi).attr("class",g.grid),bi&&d.append("g").attr("class",g.xgrids),Ee(di)&&d.append("g").attr("class",g.xgridLines),ji&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),ei&&d.append("g").attr("class",g.ygrids),Ee(fi)&&d.append("g").attr("class",g.ygridLines),yj.append("g").attr("clip-path",Oi).attr("class",g.regions),yj.append("g").attr("clip-path",Oi).attr("class",g.chart),c=yj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Uf?sh?"ns-resize":"ew-resize":null),yj.select("."+g.chart).append("g").attr("class",g.chartBars),yj.select("."+g.chart).append("g").attr("class",g.chartLines),yj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",ij.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Tb()),yj.select("."+g.chart).append("g").attr("class",g.chartTexts),Uf&&yj.insert("rect",Wf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",dg).attr("height",fg).style("opacity",0).style("cursor",sh?"ns-resize":"ew-resize").call(vj).on("dblclick.zoom",null),Jh&&rj.extent("function"!=typeof Jh?Jh:Jh(bc())),dj.x=yj.append("g").attr("class",g.axisX).attr("clip-path",Pi).attr("transform",ij.x).style("visibility",th?"visible":"hidden"),dj.x.append("text").attr("class",g.axisXLabel).attr("transform",sh?"rotate(-90)":"").style("text-anchor",Cb),dj.y=yj.append("g").attr("class",g.axisY).attr("clip-path",Qi).attr("transform",ij.y).style("visibility",Lh?"visible":"hidden"),dj.y.append("text").attr("class",g.axisYLabel).attr("transform",sh?"":"rotate(-90)").style("text-anchor",Db),dj.y2=yj.append("g").attr("class",g.axisY2).attr("transform",ij.y2).style("visibility",Uh?"visible":"hidden"),dj.y2.append("text").attr("class",g.axisY2Label).attr("transform",sh?"":"rotate(-90)").style("text-anchor",Eb),zj.append("g").attr("clip-path",Oi).attr("class",g.chart),zj.select("."+g.chart).append("g").attr("class",g.chartBars),zj.select("."+g.chart).append("g").attr("class",g.chartLines),zj.append("g").attr("clip-path",Oi).attr("class",g.brush).call(rj).selectAll("rect").attr(sh?"width":"height",sh?eg:gg),dj.subx=zj.append("g").attr("class",g.axisX).attr("transform",ij.subx).attr("clip-path",sh?"":Pi),vf(Lf.data.targets),sh?yj.select("."+g.axisX).style("opacity",0).call(Gg):(yj.select("."+g.axisY).style("opacity",0).call(Hg),yj.select("."+g.axisY2).style("opacity",0).call(Ig)),p(),T(),sf(),o(!1),of({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Ii){if(Ri&&"string"==typeof Ji){for(Ji=ze(Ji),e=0;e0){d=[];for(var f in Og)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Qd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Oe,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function lf(a){ke(Lf.data.targets)||$g&&(Ui=a,yj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Vi=!0,hh())}function mf(){ke(Lf.data.targets)||$g&&(yj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),yj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Vi=!1,ih())}function nf(a,b){"grid"===b&&a.each(function(){var a=Kf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function of(a,c){var d,e,f,h,i,j,k,l,m,n,o,p,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,O,P,Q,R,S,T,U,V,W=_d(),X=ke(Lf.data.targets),Y=Kc(Lf.data.targets);if(a=a||{},C=Ie(a,"withY",!0),D=Ie(a,"withSubchart",!0),E=Ie(a,"withTransition",!0),H=Ie(a,"withTransform",!1),I=Ie(a,"withUpdateXDomain",!1),J=Ie(a,"withUpdateOrgXDomain",!1),K=Ie(a,"withLegend",!1),F=Ie(a,"withTransitionForExit",E),G=Ie(a,"withTransitionForAxis",E),Q=E?_f:0,R=F?Q:0,S=G?Q:0,c=c||tf(S),K&&mh&&Ff(Ec(Lf.data.targets),a,c),Si&&0===Y.length&&Ag.domain([0,dj.x.selectAll(".tick").size()]),Y.length&&(J&&(Ag.domain(Kf.extent(bc(Y))),Dj=Ag.domain(),Uf&&vj.scale(Ag).updateScaleExtent(),Dg.domain(Ag.domain()),rj.scale(Dg)),I&&(Ag.domain(rj.empty()?Dj:rj.extent()),Uf&&vj.scale(Ag).updateScaleExtent()),Dh||!Ch&&!Bh||(T=Mc(Lc(Y),Bh),Gg.tickValues(T),Jg.tickValues(T))),Bg.domain(Zb(Y,"y")),Cg.domain(Zb(Y,"y2")),dj.x.style("opacity",X?0:1),dj.y.style("opacity",X?0:1),dj.y2.style("opacity",X?0:1),dj.subx.style("opacity",X?0:1),c.axisX.call(Gg),c.axisY.call(Hg),c.axisY2.call(Ig),c.axisSubX.call(Jg),Gb(E),I&&Y.length)if(zh&&T){for(U=1;U=0&&Kf.select(this).style("display",b%V?"none":"block")})}else wj.selectAll("."+g.axisX+" .tick text").style("display","block");!sh&&Eh&&hb(dj.x,c.axisX,Eh),L=_e(W),O=af(W,!0),P=af(W,!1),Eg.domain(Bg.domain()),Fg.domain(Cg.domain()),Bj.style("display","none"),q(),yj.select("line."+g.xgridFocus).style("visibility","hidden"),bi&&(f=Yd(ci,Ag),z=Si?Gg.tickOffset():0,e=sh?{x1:0,x2:dg,y1:function(a){return Ag(a)-z},y2:function(a){return Ag(a)-z}}:{x1:function(a){return Ag(a)+z},x2:function(a){return Ag(a)+z},y1:ag.top,y2:fg},d=yj.select("."+g.xgrids).selectAll("."+g.xgrid).data(f),d.enter().append("line").attr("class",g.xgrid),d.attr(e).style("opacity",function(){return+Kf.select(this).attr(sh?"y1":"x1")===(sh?fg:0)?0:1}),d.exit().remove()),Ee(di)&&(h=yj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(di),i=h.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),i.append("line").style("opacity",0),i.append("text").attr("text-anchor","end").attr("transform",sh?"":"rotate(-90)").attr("dx",sh?0:-ag.top).attr("dy",-5).style("opacity",0),h.select("line").transition().duration(Q).attr("x1",sh?0:Id).attr("x2",sh?dg:Id).attr("y1",sh?Id:ag.top).attr("y2",sh?Id:fg).style("opacity",1),h.select("text").transition().duration(Q).attr("x",sh?dg:0).attr("y",Id).text(function(a){return a.text}).style("opacity",1),h.exit().transition().duration(Q).style("opacity",0).remove()),C&&ei&&(j=yj.select("."+g.ygrids).selectAll("."+g.ygrid).data(Bg.ticks(gi)),j.enter().append("line").attr("class",g.ygrid),j.attr("x1",sh?Bg:0).attr("x2",sh?Bg:dg).attr("y1",sh?0:Bg).attr("y2",sh?fg:Bg),j.exit().remove(),nf(j,"grid")),C&&Ee(fi)&&(k=yj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(fi),l=k.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",sh?"rotate(-90)":"").attr("dx",sh?0:-ag.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(Q).attr("x1",sh?Jd:0).attr("x2",sh?Jd:dg).attr("y1",sh?0:Jd).attr("y2",sh?fg:Jd).style("opacity",1),k.select("text").transition().duration(Q).attr("x",sh?0:dg).attr("y",Jd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(Q).style("opacity",0).remove()),s=yj.select("."+g.regions).selectAll("."+g.region).data(Di),s.enter().append("g").attr("class",jd).append("rect").style("fill-opacity",0),s.selectAll("rect").transition().duration(Q).attr("x",gc).attr("y",hc).attr("width",ic).attr("height",jc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(Q).style("fill-opacity",0).remove(),p=yj.selectAll("."+g.bars).selectAll("."+g.bar).data(ue),p.enter().append("path").attr("class",dd).style("stroke","none").style("fill",$i),p.style("opacity",vd).transition().duration(Q).attr("d",L).style("fill",$i).style("opacity",1),p.exit().transition().duration(R).style("opacity",0).remove(),m=yj.selectAll("."+g.lines).selectAll("."+g.line).data(se),m.enter().append("path").attr("class",_c).style("stroke",$i),m.style("opacity",vd).transition().duration(Q).attr("d",sj).style("stroke",$i).style("opacity",1),m.exit().transition().duration(R).style("opacity",0).remove(),n=yj.selectAll("."+g.areas).selectAll("."+g.area).data(se),n.enter().append("path").attr("class",hd).style("fill",$i).style("opacity",function(){return Ej=+Kf.select(this).style("opacity"),0}),n.style("opacity",0).transition().duration(Q).attr("d",tj).style("fill",$i).style("opacity",Ej),n.exit().transition().duration(R).style("opacity",0).remove(),o=yj.selectAll("."+g.circles).selectAll("."+g.circle).data(ve),o.enter().append("circle").attr("class",bd).attr("r",Se).style("fill",$i),o.style("opacity",vd).transition().duration(Q).style("opacity",xd).style("fill",$i).attr("cx",sh?$d:Zd).attr("cy",sh?Zd:$d),o.exit().remove(),t=yj.selectAll("."+g.texts).selectAll("."+g.text).data(we),t.enter().append("text").attr("class",Xc).attr("text-anchor",function(a){return sh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",$i).style("fill-opacity",0),t.text(function(a){return Gd(a.id)(a.value,a.id)}).style("fill-opacity",wd).transition().duration(Q).attr("x",O).attr("y",P).style("fill",$i).style("fill-opacity",yd),t.exit().transition().duration(R).style("fill-opacity",0).remove(),r=yj.selectAll("."+g.arcs).selectAll("."+g.arc).data(te),r.enter().append("path").attr("class",fd).style("fill",function(a){return $i(a.data)}).style("cursor",function(a){return ah(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Yi||(c=Hb(a),d=Nb(c),e=Vb(),Pb(c.data.id),Bf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Hb(a),c=Nb(b),d=[c];Ud(d,Kf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Yi||(c=Hb(a),d=Nb(c),e=Wb(),Qb(c.data.id),Cf(),Vd(),e(d,b))}).on("click",function(a,b){var c=Hb(a),d=Nb(c),e=Ub();jf(this,a,b),e(d,b)}),r.attr("transform",H?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Yi=!0}).transition().duration(Q).attrTween("d",function(a){var b,c=Hb(a);return c?(b=Kf.interpolate(this._current,c),this._current=b(0),function(a){return Kb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",H?"scale(1)":"").style("fill",function(a){return $i(a.data)}).style("opacity",1).call(He,function(){Yi=!1}),r.exit().transition().duration(R).style("opacity",0).remove(),yj.selectAll("."+g.chartArc).select("text").attr("transform",Lb).style("opacity",0).transition().duration(Q).text(Ob).style("opacity",function(a){return Ic(a.data.id)&&re(a.data)?1:0}),yj.select("."+g.chartArcsTitle).style("opacity",je(Lf.data.targets)?1:0),jh&&(Kf.event&&"zoom"===Kf.event.type&&rj.extent(Ag.orgDomain()).update(),D&&(!sh&&Eh&&hb(dj.subx,c.axisSubX,Eh),rj.empty()||rj.extent(Ag.orgDomain()).update(),M=_e(W,!0),v=zj.selectAll("."+g.bars).selectAll("."+g.bar).data(ue),v.enter().append("path").attr("class",dd).style("stroke","none").style("fill",$i),v.style("opacity",vd).transition().duration(Q).attr("d",M).style("opacity",1),v.exit().transition().duration(Q).style("opacity",0).remove(),u=zj.selectAll("."+g.lines).selectAll("."+g.line).data(se),u.enter().append("path").attr("class",_c).style("stroke",$i),u.style("opacity",vd).transition().duration(Q).attr("d",uj).style("opacity",1),u.exit().transition().duration(Q).style("opacity",0).remove())),yj.selectAll("."+g.selectedCircles).filter(function(a){return ne(a)}).selectAll("circle").remove(),yj.selectAll("."+g.selectedCircle).transition().duration(Q).attr("cx",sh?$d:Zd).attr("cy",sh?Zd:$d),w=yj.select("."+g.eventRects),Ee(Lg)&&!qc(Lg)?(w.classed(g.eventRectsMultiple)||w.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),x=yj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),hf(x.enter()),x.attr("x",0).attr("y",0).attr("width",dg).attr("height",fg)):(w.classed(g.eventRectsSingle)||w.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Ti&&!Si?(B=function(a,b){var c=zc(b),d=Ac(b),e=Lf.data.xs[a.id][b];return(Ag(d?d:e+50)-Ag(c?c:e-50))/2},A=function(a,b){var c=zc(b),d=Lf.data.xs[a.id][b];return(Ag(d)+Ag(c?c:d-50))/2}):(B=N(),A=function(a){return Ag(a.x)-B/2}),y=Cc(Lf.data.targets),yj.select("."+g.eventRects).datum(y?y.values:[]),x=yj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),gf(x.enter()),x.attr("class",kd).attr("x",sh?0:A).attr("y",sh?A:0).attr("width",sh?dg:B).attr("height",sh?B:fg),x.exit().remove()),Ec(Lf.data.targets).forEach(function(a){Fj[a]=!0})}function pf(){of({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function qf(){if(0!==Kc(Lf.data.targets).length){if("mousemove"===Kf.event.sourceEvent.type&&vj.altDomain)return Ag.domain(vj.altDomain),void vj.scale(Ag).updateScaleExtent();Si&&Ag.orgDomain()[0]===Dj[0]&&Ag.domain([Dj[0]-1e-10,Ag.orgDomain()[1]]),of({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Kf.event.sourceEvent.type&&(Wi=!0)}}function rf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function sf(){wj.attr("width",hg).attr("height",ig),wj.select("#"+Li).select("rect").attr("width",dg).attr("height",fg),wj.select("#"+Mi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),wj.select("#"+Ni).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),wj.select("."+g.zoomRect).attr("width",dg).attr("height",fg),Cj.style("max-height",ig+"px")}function tf(a){return{axisX:a?dj.x.transition().duration(a):dj.x,axisY:a?dj.y.transition().duration(a):dj.y,axisY2:a?dj.y2.transition().duration(a):dj.y2,axisSubX:a?dj.subx.transition().duration(a):dj.subx}}function uf(a){var b;a=a||{},a.withTransition=Ie(a,"withTransition",!0),a.withTransform=Ie(a,"withTransform",!1),a.withLegend=Ie(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withLegend&&mh||(b=tf(a.withTransition?_f:0),p(),T(),sf(),o(a.withTransition,b)),of(a,b)}function vf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=yj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",md),j=i.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Yc),e=yj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",od),d=e.enter().append("g").attr("class",od).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",ed).style("cursor",function(a){return ah(a)?"pointer":null}),c=yj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",nd),b=c.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",ad),b.append("g").attr("class",id),b.append("g").attr("class",function(a){return Wc(g.selectedCircles,a.id)}),b.append("g").attr("class",cd).style("cursor",function(a){return ah(a)?"pointer":null}),a.forEach(function(a){yj.selectAll("."+g.selectedCircles+qd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=yj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(rg(a)).attr("class",pd),f=h.enter().append("g").attr("class",pd),f.append("g").attr("class",gd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),jh&&(n=zj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",od),m=n.enter().append("g").style("opacity",0).attr("class",od),m.append("g").attr("class",ed),l=zj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",nd),k=l.enter().append("g").style("opacity",0).attr("class",nd),k.append("g").attr("class",ad)),wj.selectAll("."+g.target).filter(function(a){return Ic(a.id)}).transition().duration(_f).style("opacity",1)}function wf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?ee(a.id,b.types[a.id]):ee(a.id,b.type)}),Lf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,z=0,F++)),E[a]=F,D[F]=f,A[a]=z,z+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+v)/10),j=10*Math.ceil((h.height+u)/10),k=jj?j:i,l=jj?S():R();return d&&(z=0,F=0,w=0,x=0),mh&&!Jc(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=i,C[c]=j,(!w||i>=w)&&(w=i),(!x||j>=x)&&(x=j),g=jj?x:w,void(rh?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(l-g*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=26,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=Aj.selectAll("."+g.legendItemFocused).size();b=b||{},n=Ie(b,"withTransition",!0),q=Ie(b,"withTransitionForTransform",!0),jj?(f=function(a){return w*E[a]},j=function(a){return D[E[a]]+A[a]}):(f=function(a){return D[E[a]]+A[a]},j=function(a){return x*E[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=Aj.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Wc(g.legendItem,a)}).style("visibility",function(a){return Jc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof oh?oh(a):Lf.toggle(a)}).on("mouseover",function(a){Kf.select(this).classed(g.legendItemFocused,!0),Yi||Lf.focus(a),"function"==typeof ph&&ph(a)}).on("mouseout",function(a){Kf.select(this).classed(g.legendItemFocused,!1),Yi||Lf.revert(),"function"==typeof qh&&qh(a)}),m.append("text").text(function(a){return d(Og[a])?Og[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",jj?h:-200).attr("y",jj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",jj?i:-200).attr("y",jj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",$i).attr("x",jj?h:-200).attr("y",jj?-200:j).attr("width",10).attr("height",10),r=Aj.selectAll("text").data(a).text(function(a){return d(Og[a])?Og[a]:a}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=Aj.selectAll("rect."+g.legendItemEvent).data(a),(n?s.transition():s).attr("width",function(a){return B[a]}).attr("height",function(a){return C[a]}).attr("x",i).attr("y",l),t=Aj.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",$i).attr("x",f).attr("y",j),Aj.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Ic(a)}).transition().style("opacity",function(a){var b=Kf.select(this);return Ic(a)?!G||b.classed(g.legendItemFocused)?zf(b):Af(b):nj}),P(w),Q(x),O(F),p(),T(),sf(),o(q,c)}function Gf(a){return Gc(Lf.data.targets,a.id)}function Hf(a){return"data"in a&&Gc(Lf.data.targets,a.data.id)}function If(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 Jf(a,b,c){var d=!ke(Lf.data.targets);Yi=!1,ee(a,b),uf(c||{withTransitionForAxis:d})}var Kf=a.d3?a.d3:a.require?a.require("d3"):void 0,Lf={data:{},axis:{},legend:{}},Mf={},Nf=i(["bindto"],"#chart"),Of=i(["size","width"]),Pf=i(["size","height"]),Qf=i(["padding","left"],50),Rf=i(["padding","right"],0),Sf=i(["padding","top"],0),Tf=i(["padding","bottom"],0),Uf=i(["zoom","enabled"],!1),Vf=i(["zoom","extent"]),Wf=i(["zoom","privileged"],!1),Xf=i(["onenter"],function(){}),Yf=i(["onleave"],function(){}),Zf=i(["onresize"],function(){}),$f=i(["onresized"],function(){}),_f=i(["transition","duration"],350);h("data","data is required in config");var ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg,Kg=i(["data","x"]),Lg=i(["data","xs"],{}),Mg=i(["data","x_format"]),Ng=i(["data","id_converter"],function(a){return a}),Og=i(["data","names"],{}),Pg=i(["data","classes"],{}),Qg=i(["data","groups"],[]),Rg=i(["data","axes"],{}),Sg=i(["data","type"]),Tg=i(["data","types"],{}),Ug=i(["data","labels"],{}),Vg=i(["data","order"]),Wg=i(["data","regions"],{}),Xg=i(["data","color"]),Yg=i(["data","colors"],{}),Zg=i(["data","hide"],!1),$g=i(["data","selection","enabled"],!1),_g=i(["data","selection","grouped"],!1),ah=i(["data","selection","isselectable"],function(){return!0}),bh=i(["data","selection","multiple"],!0),ch=i(["data","onclick"],function(){}),dh=i(["data","onenter"],function(){}),eh=i(["data","onleave"],function(){}),fh=i(["data","onselected"],function(){}),gh=i(["data","onunselected"],function(){}),hh=i(["data","ondragstart"],function(){}),ih=i(["data","ondragend"],function(){}),jh=i(["subchart","show"],!1),kh=i(["subchart","size","height"],60),lh=i(["color","pattern"],[]),mh=i(["legend","show"],!0),nh=i(["legend","position"],"bottom"),oh=i(["legend","item","onclick"]),ph=i(["legend","item","onmouseover"]),qh=i(["legend","item","onmouseout"]),rh=i(["legend","equally"],!1),sh=i(["axis","rotated"],!1),th=i(["axis","x","show"],!0),uh=i(["axis","x","type"],"indexed"),vh=i(["axis","x","localtime"],!0),wh=i(["axis","x","categories"],[]),xh=i(["axis","x","tick","centered"],!1),yh=i(["axis","x","tick","format"]),zh=i(["axis","x","tick","culling"],{}),Ah=i(["axis","x","tick","culling","max"],10),Bh=i(["axis","x","tick","count"]),Ch=i(["axis","x","tick","fit"],!0),Dh=i(["axis","x","tick","values"],null),Eh=i(["axis","x","tick","rotate"]),Fh=i(["axis","x","max"],null),Gh=i(["axis","x","min"],null),Hh=i(["axis","x","padding"],{}),Ih=i(["axis","x","height"]),Jh=i(["axis","x","default"]),Kh=i(["axis","x","label"],{}),Lh=i(["axis","y","show"],!0),Mh=i(["axis","y","max"]),Nh=i(["axis","y","min"]),Oh=i(["axis","y","center"]),Ph=i(["axis","y","label"],{}),Qh=i(["axis","y","inner"],!1),Rh=i(["axis","y","tick","format"]),Sh=i(["axis","y","padding"]),Th=i(["axis","y","ticks"],10),Uh=i(["axis","y2","show"],!1),Vh=i(["axis","y2","max"]),Wh=i(["axis","y2","min"]),Xh=i(["axis","y2","center"]),Yh=i(["axis","y2","label"],{}),Zh=i(["axis","y2","inner"],!1),$h=i(["axis","y2","tick","format"]),_h=i(["axis","y2","padding"]),ai=i(["axis","y2","ticks"],10),bi=i(["grid","x","show"],!1),ci=i(["grid","x","type"],"tick"),di=i(["grid","x","lines"],[]),ei=i(["grid","y","show"],!1),fi=i(["grid","y","lines"],[]),gi=i(["grid","y","ticks"],10),hi=i(["point","show"],!0),ii=i(["point","r"],2.5),ji=i(["point","focus","line","enabled"],!0),ki=i(["point","focus","expand","enabled"],!0),li=i(["point","focus","expand","r"]),mi=i(["point","focus","select","r"]),ni=i(["line","connect_null"],!1),oi=i(["bar","width"]),pi=i(["bar","width","ratio"],.6),qi=i(["pie","label","show"],!0),ri=i(["pie","label","format"]),si=i(["pie","expand"],!0),ti=i(["pie","onclick"],function(){}),ui=i(["pie","onmouseover"],function(){}),vi=i(["pie","onmouseout"],function(){}),wi=i(["donut","label","show"],!0),xi=i(["donut","label","format"]),yi=i(["donut","expand"],!0),zi=i(["donut","title"],""),Ai=i(["donut","onclick"],function(){}),Bi=i(["donut","onmouseover"],function(){}),Ci=i(["donut","onmouseout"],function(){}),Di=i(["regions"],[]),Ei=i(["tooltip","show"],!0),Fi=i(["tooltip","format","title"]),Gi=i(["tooltip","format","value"]),Hi=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Fi?Fi:b,l=Gi?Gi:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Ii=i(["tooltip","init","show"],!1),Ji=i(["tooltip","init","x"],0),Ki=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Li=("string"==typeof Nf?Nf.replace("#",""):Nf.id)+"-clip",Mi=Li+"-xaxis",Ni=Li+"-yaxis",Oi=j(Li),Pi=j(Mi),Qi=j(Ni),Ri="timeseries"===uh,Si="categorized"===uh,Ti=!Ri&&(Kg||Ee(Lg)),Ui=null,Vi=!1,Wi=!1,Xi=!1,Yi=!1,Zi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],$i=ye(Yg,Ee(lh)?lh:Zi,Xg),_i=vh?Kf.time.format:Kf.time.format.utc,aj=_i.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),bj=[],cj=[],dj={},ej=sh?"left":"bottom",fj=sh?Qh?"top":"bottom":Qh?"right":"left",gj=sh?Zh?"bottom":"top":Zh?"left":"right",hj=sh?"left":"bottom",ij={main:function(){return"translate("+k(ag.left)+","+k(ag.top)+")"},context:function(){return"translate("+k(bg.left)+","+k(bg.top)+")"},legend:function(){return"translate("+cg.left+","+cg.top+")"},x:function(){return"translate(0,"+(sh?0:fg)+")"},y:function(){return"translate(0,"+(sh?fg:0)+")"},y2:function(){return"translate("+(sh?0:dg)+","+(sh?1:0)+")"},subx:function(){return"translate(0,"+(sh?0:gg)+")"},arc:function(){return"translate("+mg/2+","+ng/2+")" +}},jj="right"===nh,kj=0,lj=0,mj=0,nj=.15,oj=30,pj=sh&&!th?0:30,qj=5;rg=Kf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var rj,sj=function(){var a=Kf.svg.line().x(sh?function(a){return Y(a.id)(a.value)}:Hd).y(sh?Hd:function(a){return Y(a.id)(a.value)});return ni||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ni?Re(b.values):b.values;return le(b)?(a.interpolate(me(b)?"cardinal":"linear"),Wg[b.id]?ef(e,Ag,Y(b.id),Wg[b.id]):a(e)):(c=e[0]?Ag(e[0].x):0,d=e[0]?Y(b.id)(e[0].value):0,sh?"M "+d+" "+c:"M "+c+" "+d)}}(),tj=function(){var a;return a=sh?Kf.svg.area().x0(function(a){return Y(a.id)(0)}).x1(function(a){return Y(a.id)(a.value)}).y(Hd):Kf.svg.area().x(Hd).y0(function(a){return Y(a.id)(0)}).y1(function(a){return Y(a.id)(a.value)}),function(b){var c,d,e=Re(b.values);return fe([b],"area")||fe([b],"area-spline")?(a.interpolate(me(b)?"cardinal":"linear"),a(e)):(c=e[0]?Ag(e[0].x):0,d=e[0]?Y(b.id)(e[0].value):0,sh?"M "+d+" "+c:"M "+c+" "+d)}}(),uj=function(){var a=Kf.svg.line().x(sh?function(a){return Z(a.id)(a.value)}:Kd).y(sh?Kd:function(a){return Z(a.id)(a.value)});return function(b){var c=Re(b.values);return le(b)?a(c):"M "+Dg(c[0].x)+" "+Z(b.id)(c[0].value)}}(),vj=function(){};rj=Kf.svg.brush().on("brush",pf),rj.update=function(){return zj&&zj.select("."+g.brush).call(this),this},rj.scale=function(a){return sh?this.y(a):this.x(a)},Uf&&(vj=Kf.behavior.zoom().on("zoomstart",function(){vj.altDomain=Kf.event.sourceEvent.altKey?Ag.orgDomain():null}).on("zoom",Uf?qf:null),vj.scale=function(a){return sh?this.y(a):this.x(a)},vj.orgScaleExtent=function(){var a=Vf?Vf:[1,10];return[a[0],Math.max(Bc()/a[1],a[1])]},vj.updateScaleExtent=function(){var a=cc(Ag.orgDomain())/cc(Dj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var wj,xj,yj,zj,Aj,Bj,Cj,Dj,Ej,Fj={};if(Lf.focus=function(a){function b(a){Kc(a).transition().duration(100).style("opacity",1)}var c=wj.selectAll(rd(a)),d=c.filter(Gf),e=c.filter(Hf);Lf.revert(),Lf.defocus(),b(d.classed(g.focused,!0)),b(e),ke(Lf.data.targets)&&Pb(a,!0),Bf(a,!0)},Lf.defocus=function(a){function b(a){Kc(a).transition().duration(100).style("opacity",.3)}var c=wj.selectAll(rd(a)),d=c.filter(Gf),e=c.filter(Hf);Lf.revert(),b(d.classed(g.focused,!1)),b(e),ke(Lf.data.targets)&&Qb(a),Bf(a,!1)},Lf.revert=function(a){function b(a){Kc(a).transition().duration(100).style("opacity",1)}var c=wj.selectAll(rd(a)),d=c.filter(Gf),e=c.filter(Hf);b(d.classed(g.focused,!1)),b(e),ke(Lf.data.targets)&&Qb(a),Cf()},Lf.show=function(a,b){a=Fc(a),b=b||{},Oc(a),wj.selectAll(sd(a)).transition().style("opacity",1),b.withLegend&&Df(a),of({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Lf.hide=function(a,b){a=Fc(a),b=b||{},Nc(a),wj.selectAll(sd(a)).transition().style("opacity",0),b.withLegend&&Ef(a),of({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Lf.toggle=function(a){Ic(a)?Lf.hide(a):Lf.show(a)},Lf.unzoom=function(){rj.clear().update(),of({withUpdateXDomain:!0})},Lf.load=function(a){return a.xs&&pc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Pg[b]=a.classes[b]}),"categories"in a&&Si&&(wh=a.categories,Gg.categories(wh)),"cacheIds"in a&&dc(a.cacheIds)?void wf(fc(a.cacheIds),a.done):void("unload"in a?yf(Fc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){xf(a)}):xf(a))},Lf.unload=function(a,b){yf(Fc(a),function(){of({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Lf.selected=function(a){return Kf.merge(yj.selectAll("."+g.shapes+qd(a)).selectAll("."+g.shape).filter(function(){return Kf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Lf.select=function(a,b,c){$g&&yj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Kf.select(this),i=e.data?e.data.id:e.id,j=Qe(this),k=_g||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);"path"!==this.nodeName&&(k&&l?ah(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},Lf.unselect=function(a,b){$g&&yj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Kf.select(this),f=c.data?c.data.id:c.id,h=Qe(this),i=_g||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);"path"!==this.nodeName&&i&&j&&ah(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Lf.toLine=function(a){Jf(a,"line")},Lf.toSpline=function(a){Jf(a,"spline")},Lf.toBar=function(a){Jf(a,"bar")},Lf.toScatter=function(a){Jf(a,"scatter")},Lf.toArea=function(a){Jf(a,"area")},Lf.toAreaSpline=function(a){Jf(a,"area-spline")},Lf.toPie=function(a){Jf(a,"pie",{withTransform:!0})},Lf.toDonut=function(a){Jf(a,"donut",{withTransform:!0})},Lf.groups=function(a){return c(a)?Qg:(Qg=a,of(),Qg)},Lf.xgrids=function(a){return a?(di=a,of(),di):di},Lf.xgrids.add=function(a){return a?Lf.xgrids(di.concat(a)):void 0},Lf.xgrids.remove=function(a){var b=If(a);return Lf.xgrids(di.filter(b))},Lf.ygrids=function(a){return a?(fi=a,of(),fi):fi},Lf.ygrids.add=function(a){return a?Lf.ygrids(fi.concat(a)):void 0},Lf.ygrids.remove=function(a){var b=If(a);return Lf.ygrids(fi.filter(b))},Lf.regions=function(a){return c(a)?Di:(Di=a,of(),Di)},Lf.regions.add=function(a){return c(a)?Di:(Di=Di.concat(a),of(),Di)},Lf.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;wj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Di=Di.filter(function(b){return b.classes.indexOf(a)<0})}),Di},Lf.data.get=function(a){var b=Lf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Lf.data.getAsTarget=function(a){var b=Hc(function(b){return b.id===a});return b.length>0?b[0]:void 0},Lf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Og[b]=a[b]}),of({withLegend:!0}),Og):Og},Lf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Yg[b]=a[b]}),of({withLegend:!0}),Yg):Yg},Lf.x=function(a){return arguments.length&&(sc(Lf.data.targets,a),of({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Lf.data.xs},Lf.xs=function(a){return arguments.length&&(tc(Lf.data.targets,a),of({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Lf.data.xs},Lf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){eb(b,a[b])}),Gb())},Lf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Fh=+a.x),b(a.y)&&(Mh=+a.y),b(a.y2)&&(Vh=+a.y2)):Mh=Vh=+a,of({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Lf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Gh=+a.x),b(a.y)&&(Nh=+a.y),b(a.y2)&&(Wh=+a.y2)):Nh=Wh=+a,of({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Lf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Lf.axis.max(a.max),"undefined"!=typeof a.min&&Lf.axis.min(a.min))},Lf.legend.show=function(a){Df(Fc(a)),of({withLegend:!0})},Lf.legend.hide=function(a){Ef(Fc(a)),of({withLegend:!0})},Lf.resize=function(a){Of=a?a.width:null,Pf=a?a.height:null,uf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Lf.destroy=function(){Lf.data.targets=void 0,Lf.data.xs={},Cj.html(""),a.onresize=null},"url"in f.data)Kf.xhr(f.data.url,function(a,b){var c,d=Kf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Kf.csv.parse(b.response),ff(c)});else if("rows"in f.data)ff(vc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");ff(wc(f.data.columns))}return Lf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(window); \ No newline at end of file From eb7452fcefe34b5a7500c5c0b944f9df3abf616c Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Fri, 9 May 2014 12:35:05 +0900 Subject: [PATCH 151/178] Enable filter when loading data --- c3.js | 18 ++++++++++++------ c3.min.js | 6 +++--- htdocs/samples/data_load.html | 10 ++++++++-- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/c3.js b/c3.js index f6fae28..1bbb24a 100644 --- a/c3.js +++ b/c3.js @@ -144,6 +144,7 @@ __data_color = getConfig(['data', 'color']), __data_colors = getConfig(['data', 'colors'], {}), __data_hide = getConfig(['data', 'hide'], false), + __data_filter = getConfig(['data', 'filter']), __data_selection_enabled = getConfig(['data', 'selection', 'enabled'], false), __data_selection_grouped = getConfig(['data', 'selection', 'grouped'], false), __data_selection_isselectable = getConfig(['data', 'selection', 'isselectable'], function () { return true; }), @@ -1486,9 +1487,6 @@ } return false; } - function getTargets(filter) { - return isDefined(filter) ? c3.data.targets.filter(filter) : c3.data.targets; - } function isTargetToShow(targetId) { return hiddenTargetIds.indexOf(targetId) < 0; } @@ -1879,7 +1877,7 @@ function getBarIndices() { var indices = {}, i = 0, j, k; - filterTargetsToShow(getTargets(isBarType)).forEach(function (d) { + filterTargetsToShow(c3.data.targets.filter(isBarType)).forEach(function (d) { for (j = 0; j < __data_groups.length; j++) { if (__data_groups[j].indexOf(d.id) < 0) { continue; } for (k = 0; k < __data_groups[j].length; k++) { @@ -1908,7 +1906,7 @@ }; } function getBarOffset(barIndices, isSub) { - var targets = orderTargets(filterTargetsToShow(getTargets(isBarType))), + var targets = orderTargets(filterTargetsToShow(c3.data.targets.filter(isBarType))), targetIds = targets.map(function (t) { return t.id; }); return function (d, i) { var scale = isSub ? getSubYScale(d.id) : getYScale(d.id), @@ -2449,6 +2447,10 @@ c3.data.xs = {}; c3.data.targets = convertDataToTargets(data); + if (__data_filter) { + c3.data.targets = c3.data.targets.filter(__data_filter); + } + // Set targets to hide if needed if (__data_hide) { addHiddenTargetIds(__data_hide === true ? mapToIds(c3.data.targets) : __data_hide); @@ -3768,6 +3770,10 @@ } function load(targets, args) { + // filter loading targets if needed + if (args.filter) { + targets = targets.filter(args.filter); + } // set type if args.types || args.type specified if (args.type || args.types) { targets.forEach(function (t) { @@ -4368,7 +4374,7 @@ return isDefined(target) ? target.values.map(function (d) { return d.value; }) : undefined; }; c3.data.getAsTarget = function (targetId) { - var targets = getTargets(function (t) { return t.id === targetId; }); + var targets = c3.data.targets.filter(function (t) { return t.id === targetId; }); return targets.length > 0 ? targets[0] : undefined; }; c3.data.names = function (names) { diff --git a/c3.min.js b/c3.min.js index d2e742a..02b7796 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.ceil(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.ceil(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&adg&&(dg=0),0>fg&&(fg=0),eg=sh?ag.left-oj-pj:dg,gg=sh?fg:ig-bg.top-bg.bottom,0>eg&&(eg=0),0>gg&&(gg=0),mg=dg-(jj?b+10:0),ng=fg-(jj?0:10),r(),jj&&d&&(cg.left=mg/2+1.1*kg)}function q(){yj.select("line."+g.xgridFocus).attr("x1",sh?0:-10).attr("x2",sh?dg:-10).attr("y1",sh?-10:ag.top).attr("y2",sh?-10:fg)}function r(){kg=Math.min(mg,ng)/2,jg=.95*kg,lg=je(Lf.data.targets)?.6*jg:0}function s(){var a=sh?g.axisX:g.axisY,b=yj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Kf.select(Nf).node().getBoundingClientRect(),e=ke(Lf.data.targets),f=c.right-d.left-(e?0:v());return f>0?f:0}function t(){return Of?Of:z()}function u(){var a=Pf?Pf:A();return a>0?a:320}function v(){var a=1;return Qf?Qf:sh?th?x("x"):a:!Lh||Qh?a:x("y")}function w(){var a=1;return Rf?Rf:jj?R()+20+(Uh&&!sh?x("y2"):a):Uh?Zh||sh?a:x("y2"):a}function x(a){var b=mb(a);return b.isInner?20+Fb(a):40+Fb(a)}function y(a){return"x"!==a||th?"x"===a&&Ih?Ih:"y"!==a||Lh?"y2"!==a||Uh?(mb(a).isInner?30:40)+("y2"===a?-10:0):qj:mh&&!jj?10:1:0}function z(){return+Kf.select(Nf).style("width").replace("px","")}function A(){return+Kf.select(Nf).style("height").replace("px","")}function B(a){return a?-31:-(ag.left-1)}function C(a){return a?-20:-4}function D(){return B(!sh)}function E(){return C(!sh)}function F(){return B(sh)}function G(){return C(sh)}function H(a){return a?dg+2+30+30:ag.left+20}function I(a){return a?(Ih?Ih:0)+80:fg+8}function J(){return H(!sh)}function K(){return I(!sh)}function L(){return H(sh)}function M(){return I(sh)}function N(){var a,b,c,d,e,f=Cc(Lf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=Ag(b.x)-Ag(a.x),0===c?sh?fg:dg:(d=Bc(),e=ge(Lf.data.targets)?(d-(Si?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function O(a){kj=a}function P(a){lj=a}function Q(a){mj=a}function R(){return mh?jj?lj*(kj+1):hg:0}function S(){return mh?jj?ig:mj*(kj+1):0}function T(){var a,b,c=!Ag;sg=sh?1:0,tg=sh?fg:dg,ug=sh?0:fg,vg=sh?dg:1,wg=sg,xg=tg,yg=sh?0:gg,zg=sh?eg:1,Ag=W(sg,tg,c?void 0:Ag.domain(),function(){return Gg.tickOffset()}),Bg=X(ug,vg,c?void 0:Bg.domain()),Cg=X(ug,vg,c?void 0:Cg.domain()),Dg=W(sg,tg,Dj,function(a){return a%1?0:Jg.tickOffset()}),Eg=X(yg,zg,c?void 0:Eg.domain()),Fg=X(yg,zg,c?void 0:Fg.domain()),a=bb(),b=Dh?Dh:c?void 0:Gg.tickValues(),Gg=$(Ag,ej,a,b),Jg=$(Dg,hj,a,b),Hg=_(Bg,fj,Rh,Th),Ig=_(Cg,gj,$h,ai),c||(rj.scale(Dg),Uf&&vj.scale(Ag)),U()}function U(){og=Ib(),pg=Jb(),qg=Jb(.98)}function V(a,b,c){return(c?Kf.time.scale():Kf.scale.linear()).range([a,b])}function W(a,b,c,d){var e,f=V(a,b,Ri),g=c?f.domain(c):f;Si?(d=d||function(){return 0},f=function(a,b){var c=g(a)+d(a);return b?c:Math.ceil(c)}):f=function(a,b){var c=g(a);return b?c:Math.ceil(c)};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return Dj&&Dj[0]===a[0]&&Dj[1]a?a.toFixed(0):a};return yh&&("function"==typeof yh?a=yh:Ri&&(a=function(a){return a?_i(yh)(a):""})),a}function cb(a){var b;return"y"===a?b=Ph:"y2"===a?b=Yh:"x"===a&&(b=Kh),b}function db(a){var b=cb(a);return"string"==typeof b?b:b?b.text:null}function eb(a,b){var c=cb(a);"string"==typeof c?"y"===a?Ph=b:"y2"===a?Yh=b:"x"===a&&(Kh=b):c&&(c.text=b)}function fb(a){return 10*Math.sin(Math.PI*(a/180))}function gb(a){return 11.5-2.5*(a/15)}function hb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",gb(c)).attr("x",fb(c)).attr("transform","rotate("+c+")")}function ib(a,b){var c=cb(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 jb(){return ib("x",sh?"inner-top":"inner-right")}function kb(){return ib("y",sh?"inner-right":"inner-top")}function lb(){return ib("y2",sh?"inner-right":"inner-top")}function mb(a){return"y2"===a?lb():"y"===a?kb():jb()}function nb(){return db("x")}function ob(){return db("y")}function pb(){return db("y2")}function qb(a,b){return a?b.isLeft?0:b.isCenter?dg/2:dg:b.isBottom?-fg:b.isMiddle?-fg/2:0}function rb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function sb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function tb(){return qb(!sh,jb())}function ub(){return qb(sh,kb())}function vb(){return qb(sh,lb())}function wb(){return rb(!sh,jb())}function xb(){return rb(sh,kb())}function yb(){return rb(sh,lb())}function zb(){var a=jb();return sh?a.isInner?"1.2em":-25-Fb("x"):a.isInner?"-0.5em":Ih?Ih-10:"3em"}function Ab(){var a=kb();return sh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Fb("y")}function Bb(){var a=lb();return sh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Fb("y2")}function Cb(){return sb(!sh,jb())}function Db(){return sb(sh,kb())}function Eb(){return sb(sh,lb())}function Fb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Kf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Gb(a){var b=yj.select("."+g.axisX+" ."+g.axisXLabel),c=yj.select("."+g.axisY+" ."+g.axisYLabel),d=yj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",tb).attr("dx",wb).attr("dy",zb).text(nb),(a?c.transition():c).attr("x",ub).attr("dx",xb).attr("dy",Ab).attr("dy",Ab).text(ob),(a?d.transition():d).attr("x",vb).attr("dx",yb).attr("dy",Bb).text(pb)}function Hb(a){var b=!1;return rg(Kc(Lf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Ib(){var a=Kf.svg.arc().outerRadius(jg).innerRadius(lg),b=function(b,c){var d;return c?a(b):(d=Hb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Jb(a){var b=Kf.svg.arc().outerRadius(kg*(a?a:1)).innerRadius(lg);return function(a){var c=Hb(a);return c?b(c):"M 0 0"}}function Kb(a,b){return re(a.data)?og(a,b):"M 0 0"}function Lb(a){var b,c,d,e,f=Hb(a),g="";return f&&(b=og.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*jg*.8+","+d/e*jg*.8+")"),g}function Mb(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Nb(a){return rc({id:a.data.id,value:a.value,ratio:Mb(a)})}function Ob(a){var b,c,d,e;return Rb()?(b=Hb(a),c=b?b.value:null,d=Mb(b),e=Sb(),e?e(c,d):Fd(c,d)):""}function Pb(a,b){var c=wj.selectAll("."+g.chartArc+rd(a)),d=wj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});xe(a)&&c.selectAll("path").transition().duration(50).attr("d",pg).transition().duration(100).attr("d",qg).each(function(a){qe(a.data)}),b||d.style("opacity",.3)}function Qb(a){var b=wj.selectAll("."+g.chartArc+rd(a));b.selectAll("path").transition().duration(50).attr("d",og),wj.selectAll("."+g.arc).style("opacity",1)}function Rb(){return je(Lf.data.targets)?wi:qi}function Sb(){return je(Lf.data.targets)?xi:ri}function Tb(){return je(Lf.data.targets)?zi:""}function Ub(){var a=je(Lf.data.targets)?Ai:ti;return"function"==typeof a?a:function(){}}function Vb(){var a=je(Lf.data.targets)?Bi:ui;return"function"==typeof a?a:function(){}}function Wb(){var a=je(Lf.data.targets)?Ci:vi;return"function"==typeof a?a:function(){}}function Xb(a){var b,c,d,e,f,g,h=Ec(a),i=Rc(a);if(Qg.length>0)for(g=Tc(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 Kf.min(Object.keys(i).map(function(a){return Kf.min(i[a])}))}function Yb(a){var b,c,d,e,f,g,h=Ec(a),i=Rc(a);if(Qg.length>0)for(g=Uc(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 Kf.max(Object.keys(i).map(function(a){return Kf.max(i[a])}))}function Zb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return ab(a.id)===c}),m="y2"===c?Wh:Nh,n="y2"===c?Vh:Mh,o=b(m)?m:Xb(l),p=b(n)?n:Yb(l),q="y2"===c?Xh:Oh,r=zd()&&sh;return 0===l.length?"y2"===c?Cg.domain():Bg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=Ad(o,p),j=cc(Bg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Sh&&(f=b(Sh.top)?Sh.top:e,g=b(Sh.bottom)?Sh.bottom:e),"y2"===c&&_h&&(f=b(_h.top)?_h.top:e,g=b(_h.bottom)?_h.bottom:e),ge(l)&&!Tc(l)&&(g=o),[o-g,p+f])}function $b(a){return Gh?Ri?ze(Gh):Gh:Kf.min(a,function(a){return Kf.min(a.values,function(a){return a.x})})}function _b(a){return Fh?Ri?ze(Fh):Fh:Kf.max(a,function(a){return Kf.max(a.values,function(a){return a.x})})}function ac(a){var c,d,e,f,g=Dc(a),h=g[1]-g[0];return Si?d=0:ge(a)?(c=Bc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Hh&&Ee(Hh)?(e=b(Hh.left)?Hh.left:d,f=b(Hh.right)?Hh.right:d):e=f="number"==typeof Hh?Hh:d,{left:e,right:f}}function bc(a){var b=[$b(a),_b(a)],c=b[0],d=b[1],e=ac(a),f=0,g=0;return c-d!==0||Si||(c=Ri?new Date(.5*c.getTime()):-.5,d=Ri?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Ri?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Ri?new Date(d.getTime()+e.right):d+e.right),[f,g]}function cc(a){return a[1]-a[0]}function dc(a){for(var b=0;bb?0:b-c}function jc(a){var b,c=hc(a),d="y"===a.axis?Bg:Cg;return b="y"===a.axis||"y2"===a.axis?sh?fg:"start"in a?d(a.start):fg:sh?"end"in a?Ag(Ri?ze(a.end):a.end):fg:fg,c>b?0:b-c}function kc(a){return Kg&&a===Kg||Ee(Lg)&&Fe(Lg,a)}function lc(a){return!kc(a)}function mc(a){return Kg?Kg:Ee(Lg)?Lg[a]:null}function nc(a,b){var c,d=b&&Ee(b)?Ec(b):[];return d.forEach(function(b){mc(b)===a&&(c=Lf.data.xs[b])}),c}function oc(a,b){return a in Lf.data.xs&&Lf.data.xs[a]&&Lf.data.xs[a][b]?Lf.data.xs[a][b]:b}function pc(a){Object.keys(a).forEach(function(b){Lg[b]=a[b]})}function qc(a){return 1===Kf.set(Object.keys(a).map(function(b){return a[b]})).size()}function rc(a){var b;return a&&(b=Og[a.id],a.name=b?b:a.id),a}function sc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=uc(b[d],a.id,d)}),Lf.data.xs[a.id]=b})}function tc(a,b){a.forEach(function(a){b[a.id]&&sc([a],b[a.id])})}function uc(a,c,d){var e;return e=Ri?a?a instanceof Date?a:ze(a):ze(oc(c,d)):Ti&&!Si?b(a)?+a:oc(c,d):d}function vc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Lf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Kg?(d=Object.keys(Lf.data.xs),Lf.data.xs[c]=d.length>0?Lf.data.xs[d[0]]:void 0):Ee(Lg)&&(Lf.data.xs[c]=nc(f,Lf.data.targets)):Lf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Lf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Ng(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=mc(b),g=a[f],h=uc(g,b,e);return Ti&&Si&&0===c&&g&&(0===e&&(wh=[]),wh.push(g)),("undefined"==typeof a[b]||Lf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Sg&&ee(Ec(c).filter(function(a){return!(a in Tg)}),Sg),c.forEach(function(a){ec(a.id_org,a)}),c}function yc(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 zc(a){return a>0&&Lf.data.targets[0].values[a-1]?Lf.data.targets[0].values[a-1].x:void 0}function Ac(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Dc(a){var b,c,d=Cc(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Ec(a){return a.map(function(a){return a.id})}function Fc(a){return a?"string"==typeof a?[a]:a:Ec(Lf.data.targets)}function Gc(a,b){var c,d=Ec(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Ri?new Date(i):i);j.push(e)}return Ri||(j=j.sort(function(a,b){return a-b})),j}function Nc(a){bj=bj.concat(a)}function Oc(a){bj=bj.filter(function(b){return a.indexOf(b)<0})}function Pc(a){cj=cj.concat(a)}function Qc(a){cj=cj.filter(function(b){return a.indexOf(b)<0})}function Rc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Sc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Uc(a){return Sc(a,function(a){return a>0})}function Vc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],(a[f].x||0===a[f].x)&&(e=e.concat(Ld(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Ld(a,g))),Od(e,b)):Md(a,b,f,g)}function Nd(a,b){var c;return c=a.map(function(a){return Md(a.values,b)}),Od(c,b)}function Od(a,b){var c,d;return a.forEach(function(a){var e=Ge(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Pd(a,b){return Kf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Qd(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 Rd(){return Vg&&"desc"===Vg.toLowerCase()}function Sd(){return Vg&&"asc"===Vg.toLowerCase()}function Td(a){var b=Sd(),c=Rd();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 Vg&&a.sort(Vg),a}function Ud(a,c){var d,e,f,g,h,i,j,k=ke(Lf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&Ei&&(Bj.html(Hi(a,bb(),Bd(k),$i)).style("display","block"),d=Bj.property("offsetWidth"),e=Bj.property("offsetHeight"),k?(g=dg/2+c[0],i=fg/2+c[1]+20):(sh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-w(),i=Ag(l[0].x)+20):(f=s(),g=f+v()+Ag(l[0].x)+20,h=g+d,j=f+t()-w(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),Bj.style("top",i+"px").style("left",g+"px"))}function Vd(){Bj.style("display","none")}function Wd(a){var c=a.filter(function(a){return a&&b(a.value)});if(Ei&&!he(Lf.data.targets)&&!ke(Lf.data.targets)){var d=yj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(sh?"y1":"x1",Hd).attr(sh?"y2":"x2",Hd),nf(d,"grid")}}function Xd(){yj.select("line."+g.xgridFocus).style("visibility","hidden")}function Yd(a,b){var c,d,e,f,h=[],i=yj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=bc(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function Zd(a){return a.x||0===a.x?Ag(a.x):null}function $d(a){return Y(a.id)(a.value)}function _d(){var a,b,d={},e=0;return Kc(Hc(ne)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function de(a,b){return"number"==typeof oi?oi:b?2*a.tickOffset()*pi/b:0}function ee(a,b){Fc(a).forEach(function(a){Fj[a]=b===Tg[a],Tg[a]=b})}function fe(a,b){var c=!1;return a.forEach(function(a){Tg[a.id]===b&&(c=!0),a.id in Tg||"line"!==b||(c=!0)}),c}function ge(a){return fe(a,"bar")}function he(a){return fe(a,"scatter")}function ie(a){return fe(a,"pie")}function je(a){return fe(a,"donut")}function ke(a){return ie(a)||je(a)}function le(a){var b="string"==typeof a?a:a.id;return!(b in Tg)||"line"===Tg[b]||"spline"===Tg[b]||"area"===Tg[b]||"area-spline"===Tg[b]}function me(a){var b="string"==typeof a?a:a.id;return"spline"===Tg[b]||"area-spline"===Tg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"bar"===Tg[b]}function oe(a){var b="string"==typeof a?a:a.id;return"scatter"===Tg[b]}function pe(a){var b="string"==typeof a?a:a.id;return"pie"===Tg[b]}function qe(a){var b="string"==typeof a?a:a.id;return"donut"===Tg[b]}function re(a){return pe(a)||qe(a)}function se(a){return le(a)?[a]:[]}function te(a){return re(a.data)?[a]:[]}function ue(a){return ne(a)?a.values:[]}function ve(a){return le(a)||oe(a)?a.values:[]}function we(a){return ne(a)||le(a)?a.values:[]}function xe(a){return qe(a)&&yi||pe(a)&&si}function ye(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ze(b){var c;try{c=Mg?Kf.time.format(Mg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Mg)}return c}function Ae(a,b){var c=Kf.mouse(a),d=Kf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Fe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Ge(a,b){var c="y"===ab(a.id)?Bg:Cg,d=sh?1:0,e=sh?0:1;return Math.pow(Ag(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function He(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ie(a,b,c){return d(a[b])?a[b]:c}function Je(a,b,c){fh(b,a.node()),yj.select("."+g.selectedCircles+qd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Wc(g.selectedCircle,c)}).attr("cx",sh?$d:Zd).attr("cy",sh?Zd:$d).attr("stroke",function(){return $i(b)}).attr("r",1.4*Ue(b)).transition().duration(100).attr("r",Ue)}function Ke(a,b,c){gh(b,a.node()),yj.select("."+g.selectedCircles+qd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Le(a,b,c,d){a?Je(b,c,d):Ke(b,c,d)}function Me(a,b){fh(b,a.node()),a.transition().duration(100).style("fill",function(){return Kf.rgb($i(b)).brighter(.75)})}function Ne(a,b){gh(b,a.node()),a.transition().duration(100).style("fill",function(){return $i(b)})}function Oe(a,b,c,d){a?Me(b,c,d):Ne(b,c,d)}function Pe(a,b,c,d){Oe(a,b,c.data,d)}function Qe(a){return"circle"===a.nodeName?Le:Kf.select(a).classed(g.bar)?Oe:Pe}function Re(a){return a.filter(function(a){return b(a.value)})}function Se(a){return hi?"function"==typeof ii?ii(a):ii:0}function Te(a){return ki?li?li:1.75*Se(a):Se(a)}function Ue(a){return mi?mi:4*Se(a)}function Ve(a,c){return(c?yj.selectAll("."+g.circles+qd(c)):yj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function We(a,b){Ve(a,b).classed(g.EXPANDED,!0).attr("r",Te)}function Xe(a){Ve(a).filter(function(){return Kf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Se)}function Ye(a){return yj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function Ze(a){Ye(a).classed(g.EXPANDED,!0)}function $e(a){Ye(a).classed(g.EXPANDED,!1)}function _e(a,b){var c=df(a,b);return function(a,b){var d=c(a,b),e=sh?1:0,f=sh?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 af(a,b){var c=df(a,!1),d=b?bf:cf;return function(a,b){return d(c(a,b),a,this)}}function bf(a,b){var c;return sh?(c=ne(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function cf(a,b,c){var d=c.getBoundingClientRect();return sh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ne(b)?-3:-6)}function df(a,b){var c=a.__max__+1,d=de(Gg,c),e=ae(d,c,a,!!b),f=be(!!b),g=ce(a,!!b),h=b?Z:Y;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return sh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function ef(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function ff(b){var c,d,e;if(Cj=Kf.select(Nf),Cj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Cj.html("").classed("c3",!0),Lf.data.xs={},Lf.data.targets=xc(b),Zg&&Nc(Zg===!0?Ec(Lf.data.targets):Zg),p(),T(),Ag.domain(Kf.extent(bc(Lf.data.targets))),Bg.domain(Zb(Lf.data.targets,"y")),Cg.domain(Zb(Lf.data.targets,"y2")),Dg.domain(Ag.domain()),Eg.domain(Bg.domain()),Fg.domain(Cg.domain()),Dj=Ag.domain(),rj.scale(Dg),Uf&&vj.scale(Ag),wj=Cj.append("svg").on("mouseenter",Xf).on("mouseleave",Yf),xj=wj.append("defs"),xj.append("clipPath").attr("id",Li).append("rect"),xj.append("clipPath").attr("id",Mi).append("rect"),xj.append("clipPath").attr("id",Ni).append("rect"),sf(),yj=wj.append("g").attr("transform",ij.main),zj=wj.append("g").attr("transform",ij.context),Aj=wj.append("g").attr("transform",ij.legend),jh||zj.style("visibility","hidden"),mh||(Aj.style("visibility","hidden"),cj=Ec(Lf.data.targets)),Bj=Kf.select(Nf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Ff(Ec(Lf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=yj.append("g").attr("clip-path",Oi).attr("class",g.grid),bi&&d.append("g").attr("class",g.xgrids),Ee(di)&&d.append("g").attr("class",g.xgridLines),ji&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),ei&&d.append("g").attr("class",g.ygrids),Ee(fi)&&d.append("g").attr("class",g.ygridLines),yj.append("g").attr("clip-path",Oi).attr("class",g.regions),yj.append("g").attr("clip-path",Oi).attr("class",g.chart),c=yj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Uf?sh?"ns-resize":"ew-resize":null),yj.select("."+g.chart).append("g").attr("class",g.chartBars),yj.select("."+g.chart).append("g").attr("class",g.chartLines),yj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",ij.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Tb()),yj.select("."+g.chart).append("g").attr("class",g.chartTexts),Uf&&yj.insert("rect",Wf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",dg).attr("height",fg).style("opacity",0).style("cursor",sh?"ns-resize":"ew-resize").call(vj).on("dblclick.zoom",null),Jh&&rj.extent("function"!=typeof Jh?Jh:Jh(bc())),dj.x=yj.append("g").attr("class",g.axisX).attr("clip-path",Pi).attr("transform",ij.x).style("visibility",th?"visible":"hidden"),dj.x.append("text").attr("class",g.axisXLabel).attr("transform",sh?"rotate(-90)":"").style("text-anchor",Cb),dj.y=yj.append("g").attr("class",g.axisY).attr("clip-path",Qi).attr("transform",ij.y).style("visibility",Lh?"visible":"hidden"),dj.y.append("text").attr("class",g.axisYLabel).attr("transform",sh?"":"rotate(-90)").style("text-anchor",Db),dj.y2=yj.append("g").attr("class",g.axisY2).attr("transform",ij.y2).style("visibility",Uh?"visible":"hidden"),dj.y2.append("text").attr("class",g.axisY2Label).attr("transform",sh?"":"rotate(-90)").style("text-anchor",Eb),zj.append("g").attr("clip-path",Oi).attr("class",g.chart),zj.select("."+g.chart).append("g").attr("class",g.chartBars),zj.select("."+g.chart).append("g").attr("class",g.chartLines),zj.append("g").attr("clip-path",Oi).attr("class",g.brush).call(rj).selectAll("rect").attr(sh?"width":"height",sh?eg:gg),dj.subx=zj.append("g").attr("class",g.axisX).attr("transform",ij.subx).attr("clip-path",sh?"":Pi),vf(Lf.data.targets),sh?yj.select("."+g.axisX).style("opacity",0).call(Gg):(yj.select("."+g.axisY).style("opacity",0).call(Hg),yj.select("."+g.axisY2).style("opacity",0).call(Ig)),p(),T(),sf(),o(!1),of({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Ii){if(Ri&&"string"==typeof Ji){for(Ji=ze(Ji),e=0;e0){d=[];for(var f in Og)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Qd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Oe,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function lf(a){ke(Lf.data.targets)||$g&&(Ui=a,yj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Vi=!0,hh())}function mf(){ke(Lf.data.targets)||$g&&(yj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),yj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Vi=!1,ih())}function nf(a,b){"grid"===b&&a.each(function(){var a=Kf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function of(a,c){var d,e,f,h,i,j,k,l,m,n,o,p,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,O,P,Q,R,S,T,U,V,W=_d(),X=ke(Lf.data.targets),Y=Kc(Lf.data.targets);if(a=a||{},C=Ie(a,"withY",!0),D=Ie(a,"withSubchart",!0),E=Ie(a,"withTransition",!0),H=Ie(a,"withTransform",!1),I=Ie(a,"withUpdateXDomain",!1),J=Ie(a,"withUpdateOrgXDomain",!1),K=Ie(a,"withLegend",!1),F=Ie(a,"withTransitionForExit",E),G=Ie(a,"withTransitionForAxis",E),Q=E?_f:0,R=F?Q:0,S=G?Q:0,c=c||tf(S),K&&mh&&Ff(Ec(Lf.data.targets),a,c),Si&&0===Y.length&&Ag.domain([0,dj.x.selectAll(".tick").size()]),Y.length&&(J&&(Ag.domain(Kf.extent(bc(Y))),Dj=Ag.domain(),Uf&&vj.scale(Ag).updateScaleExtent(),Dg.domain(Ag.domain()),rj.scale(Dg)),I&&(Ag.domain(rj.empty()?Dj:rj.extent()),Uf&&vj.scale(Ag).updateScaleExtent()),Dh||!Ch&&!Bh||(T=Mc(Lc(Y),Bh),Gg.tickValues(T),Jg.tickValues(T))),Bg.domain(Zb(Y,"y")),Cg.domain(Zb(Y,"y2")),dj.x.style("opacity",X?0:1),dj.y.style("opacity",X?0:1),dj.y2.style("opacity",X?0:1),dj.subx.style("opacity",X?0:1),c.axisX.call(Gg),c.axisY.call(Hg),c.axisY2.call(Ig),c.axisSubX.call(Jg),Gb(E),I&&Y.length)if(zh&&T){for(U=1;U=0&&Kf.select(this).style("display",b%V?"none":"block")})}else wj.selectAll("."+g.axisX+" .tick text").style("display","block");!sh&&Eh&&hb(dj.x,c.axisX,Eh),L=_e(W),O=af(W,!0),P=af(W,!1),Eg.domain(Bg.domain()),Fg.domain(Cg.domain()),Bj.style("display","none"),q(),yj.select("line."+g.xgridFocus).style("visibility","hidden"),bi&&(f=Yd(ci,Ag),z=Si?Gg.tickOffset():0,e=sh?{x1:0,x2:dg,y1:function(a){return Ag(a)-z},y2:function(a){return Ag(a)-z}}:{x1:function(a){return Ag(a)+z},x2:function(a){return Ag(a)+z},y1:ag.top,y2:fg},d=yj.select("."+g.xgrids).selectAll("."+g.xgrid).data(f),d.enter().append("line").attr("class",g.xgrid),d.attr(e).style("opacity",function(){return+Kf.select(this).attr(sh?"y1":"x1")===(sh?fg:0)?0:1}),d.exit().remove()),Ee(di)&&(h=yj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(di),i=h.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),i.append("line").style("opacity",0),i.append("text").attr("text-anchor","end").attr("transform",sh?"":"rotate(-90)").attr("dx",sh?0:-ag.top).attr("dy",-5).style("opacity",0),h.select("line").transition().duration(Q).attr("x1",sh?0:Id).attr("x2",sh?dg:Id).attr("y1",sh?Id:ag.top).attr("y2",sh?Id:fg).style("opacity",1),h.select("text").transition().duration(Q).attr("x",sh?dg:0).attr("y",Id).text(function(a){return a.text}).style("opacity",1),h.exit().transition().duration(Q).style("opacity",0).remove()),C&&ei&&(j=yj.select("."+g.ygrids).selectAll("."+g.ygrid).data(Bg.ticks(gi)),j.enter().append("line").attr("class",g.ygrid),j.attr("x1",sh?Bg:0).attr("x2",sh?Bg:dg).attr("y1",sh?0:Bg).attr("y2",sh?fg:Bg),j.exit().remove(),nf(j,"grid")),C&&Ee(fi)&&(k=yj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(fi),l=k.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",sh?"rotate(-90)":"").attr("dx",sh?0:-ag.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(Q).attr("x1",sh?Jd:0).attr("x2",sh?Jd:dg).attr("y1",sh?0:Jd).attr("y2",sh?fg:Jd).style("opacity",1),k.select("text").transition().duration(Q).attr("x",sh?0:dg).attr("y",Jd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(Q).style("opacity",0).remove()),s=yj.select("."+g.regions).selectAll("."+g.region).data(Di),s.enter().append("g").attr("class",jd).append("rect").style("fill-opacity",0),s.selectAll("rect").transition().duration(Q).attr("x",gc).attr("y",hc).attr("width",ic).attr("height",jc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(Q).style("fill-opacity",0).remove(),p=yj.selectAll("."+g.bars).selectAll("."+g.bar).data(ue),p.enter().append("path").attr("class",dd).style("stroke","none").style("fill",$i),p.style("opacity",vd).transition().duration(Q).attr("d",L).style("fill",$i).style("opacity",1),p.exit().transition().duration(R).style("opacity",0).remove(),m=yj.selectAll("."+g.lines).selectAll("."+g.line).data(se),m.enter().append("path").attr("class",_c).style("stroke",$i),m.style("opacity",vd).transition().duration(Q).attr("d",sj).style("stroke",$i).style("opacity",1),m.exit().transition().duration(R).style("opacity",0).remove(),n=yj.selectAll("."+g.areas).selectAll("."+g.area).data(se),n.enter().append("path").attr("class",hd).style("fill",$i).style("opacity",function(){return Ej=+Kf.select(this).style("opacity"),0}),n.style("opacity",0).transition().duration(Q).attr("d",tj).style("fill",$i).style("opacity",Ej),n.exit().transition().duration(R).style("opacity",0).remove(),o=yj.selectAll("."+g.circles).selectAll("."+g.circle).data(ve),o.enter().append("circle").attr("class",bd).attr("r",Se).style("fill",$i),o.style("opacity",vd).transition().duration(Q).style("opacity",xd).style("fill",$i).attr("cx",sh?$d:Zd).attr("cy",sh?Zd:$d),o.exit().remove(),t=yj.selectAll("."+g.texts).selectAll("."+g.text).data(we),t.enter().append("text").attr("class",Xc).attr("text-anchor",function(a){return sh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",$i).style("fill-opacity",0),t.text(function(a){return Gd(a.id)(a.value,a.id)}).style("fill-opacity",wd).transition().duration(Q).attr("x",O).attr("y",P).style("fill",$i).style("fill-opacity",yd),t.exit().transition().duration(R).style("fill-opacity",0).remove(),r=yj.selectAll("."+g.arcs).selectAll("."+g.arc).data(te),r.enter().append("path").attr("class",fd).style("fill",function(a){return $i(a.data)}).style("cursor",function(a){return ah(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Yi||(c=Hb(a),d=Nb(c),e=Vb(),Pb(c.data.id),Bf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Hb(a),c=Nb(b),d=[c];Ud(d,Kf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Yi||(c=Hb(a),d=Nb(c),e=Wb(),Qb(c.data.id),Cf(),Vd(),e(d,b))}).on("click",function(a,b){var c=Hb(a),d=Nb(c),e=Ub();jf(this,a,b),e(d,b)}),r.attr("transform",H?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Yi=!0}).transition().duration(Q).attrTween("d",function(a){var b,c=Hb(a);return c?(b=Kf.interpolate(this._current,c),this._current=b(0),function(a){return Kb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",H?"scale(1)":"").style("fill",function(a){return $i(a.data)}).style("opacity",1).call(He,function(){Yi=!1}),r.exit().transition().duration(R).style("opacity",0).remove(),yj.selectAll("."+g.chartArc).select("text").attr("transform",Lb).style("opacity",0).transition().duration(Q).text(Ob).style("opacity",function(a){return Ic(a.data.id)&&re(a.data)?1:0}),yj.select("."+g.chartArcsTitle).style("opacity",je(Lf.data.targets)?1:0),jh&&(Kf.event&&"zoom"===Kf.event.type&&rj.extent(Ag.orgDomain()).update(),D&&(!sh&&Eh&&hb(dj.subx,c.axisSubX,Eh),rj.empty()||rj.extent(Ag.orgDomain()).update(),M=_e(W,!0),v=zj.selectAll("."+g.bars).selectAll("."+g.bar).data(ue),v.enter().append("path").attr("class",dd).style("stroke","none").style("fill",$i),v.style("opacity",vd).transition().duration(Q).attr("d",M).style("opacity",1),v.exit().transition().duration(Q).style("opacity",0).remove(),u=zj.selectAll("."+g.lines).selectAll("."+g.line).data(se),u.enter().append("path").attr("class",_c).style("stroke",$i),u.style("opacity",vd).transition().duration(Q).attr("d",uj).style("opacity",1),u.exit().transition().duration(Q).style("opacity",0).remove())),yj.selectAll("."+g.selectedCircles).filter(function(a){return ne(a)}).selectAll("circle").remove(),yj.selectAll("."+g.selectedCircle).transition().duration(Q).attr("cx",sh?$d:Zd).attr("cy",sh?Zd:$d),w=yj.select("."+g.eventRects),Ee(Lg)&&!qc(Lg)?(w.classed(g.eventRectsMultiple)||w.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),x=yj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),hf(x.enter()),x.attr("x",0).attr("y",0).attr("width",dg).attr("height",fg)):(w.classed(g.eventRectsSingle)||w.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Ti&&!Si?(B=function(a,b){var c=zc(b),d=Ac(b),e=Lf.data.xs[a.id][b];return(Ag(d?d:e+50)-Ag(c?c:e-50))/2},A=function(a,b){var c=zc(b),d=Lf.data.xs[a.id][b];return(Ag(d)+Ag(c?c:d-50))/2}):(B=N(),A=function(a){return Ag(a.x)-B/2}),y=Cc(Lf.data.targets),yj.select("."+g.eventRects).datum(y?y.values:[]),x=yj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),gf(x.enter()),x.attr("class",kd).attr("x",sh?0:A).attr("y",sh?A:0).attr("width",sh?dg:B).attr("height",sh?B:fg),x.exit().remove()),Ec(Lf.data.targets).forEach(function(a){Fj[a]=!0})}function pf(){of({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function qf(){if(0!==Kc(Lf.data.targets).length){if("mousemove"===Kf.event.sourceEvent.type&&vj.altDomain)return Ag.domain(vj.altDomain),void vj.scale(Ag).updateScaleExtent();Si&&Ag.orgDomain()[0]===Dj[0]&&Ag.domain([Dj[0]-1e-10,Ag.orgDomain()[1]]),of({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Kf.event.sourceEvent.type&&(Wi=!0)}}function rf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function sf(){wj.attr("width",hg).attr("height",ig),wj.select("#"+Li).select("rect").attr("width",dg).attr("height",fg),wj.select("#"+Mi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),wj.select("#"+Ni).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),wj.select("."+g.zoomRect).attr("width",dg).attr("height",fg),Cj.style("max-height",ig+"px")}function tf(a){return{axisX:a?dj.x.transition().duration(a):dj.x,axisY:a?dj.y.transition().duration(a):dj.y,axisY2:a?dj.y2.transition().duration(a):dj.y2,axisSubX:a?dj.subx.transition().duration(a):dj.subx}}function uf(a){var b;a=a||{},a.withTransition=Ie(a,"withTransition",!0),a.withTransform=Ie(a,"withTransform",!1),a.withLegend=Ie(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withLegend&&mh||(b=tf(a.withTransition?_f:0),p(),T(),sf(),o(a.withTransition,b)),of(a,b)}function vf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=yj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",md),j=i.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Yc),e=yj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",od),d=e.enter().append("g").attr("class",od).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",ed).style("cursor",function(a){return ah(a)?"pointer":null}),c=yj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",nd),b=c.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",ad),b.append("g").attr("class",id),b.append("g").attr("class",function(a){return Wc(g.selectedCircles,a.id)}),b.append("g").attr("class",cd).style("cursor",function(a){return ah(a)?"pointer":null}),a.forEach(function(a){yj.selectAll("."+g.selectedCircles+qd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=yj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(rg(a)).attr("class",pd),f=h.enter().append("g").attr("class",pd),f.append("g").attr("class",gd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),jh&&(n=zj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",od),m=n.enter().append("g").style("opacity",0).attr("class",od),m.append("g").attr("class",ed),l=zj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",nd),k=l.enter().append("g").style("opacity",0).attr("class",nd),k.append("g").attr("class",ad)),wj.selectAll("."+g.target).filter(function(a){return Ic(a.id)}).transition().duration(_f).style("opacity",1)}function wf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?ee(a.id,b.types[a.id]):ee(a.id,b.type)}),Lf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,z=0,F++)),E[a]=F,D[F]=f,A[a]=z,z+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+v)/10),j=10*Math.ceil((h.height+u)/10),k=jj?j:i,l=jj?S():R();return d&&(z=0,F=0,w=0,x=0),mh&&!Jc(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=i,C[c]=j,(!w||i>=w)&&(w=i),(!x||j>=x)&&(x=j),g=jj?x:w,void(rh?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(l-g*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=26,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=Aj.selectAll("."+g.legendItemFocused).size();b=b||{},n=Ie(b,"withTransition",!0),q=Ie(b,"withTransitionForTransform",!0),jj?(f=function(a){return w*E[a]},j=function(a){return D[E[a]]+A[a]}):(f=function(a){return D[E[a]]+A[a]},j=function(a){return x*E[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=Aj.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Wc(g.legendItem,a)}).style("visibility",function(a){return Jc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof oh?oh(a):Lf.toggle(a)}).on("mouseover",function(a){Kf.select(this).classed(g.legendItemFocused,!0),Yi||Lf.focus(a),"function"==typeof ph&&ph(a)}).on("mouseout",function(a){Kf.select(this).classed(g.legendItemFocused,!1),Yi||Lf.revert(),"function"==typeof qh&&qh(a)}),m.append("text").text(function(a){return d(Og[a])?Og[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",jj?h:-200).attr("y",jj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",jj?i:-200).attr("y",jj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",$i).attr("x",jj?h:-200).attr("y",jj?-200:j).attr("width",10).attr("height",10),r=Aj.selectAll("text").data(a).text(function(a){return d(Og[a])?Og[a]:a}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=Aj.selectAll("rect."+g.legendItemEvent).data(a),(n?s.transition():s).attr("width",function(a){return B[a]}).attr("height",function(a){return C[a]}).attr("x",i).attr("y",l),t=Aj.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",$i).attr("x",f).attr("y",j),Aj.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Ic(a)}).transition().style("opacity",function(a){var b=Kf.select(this);return Ic(a)?!G||b.classed(g.legendItemFocused)?zf(b):Af(b):nj}),P(w),Q(x),O(F),p(),T(),sf(),o(q,c)}function Gf(a){return Gc(Lf.data.targets,a.id)}function Hf(a){return"data"in a&&Gc(Lf.data.targets,a.data.id)}function If(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 Jf(a,b,c){var d=!ke(Lf.data.targets);Yi=!1,ee(a,b),uf(c||{withTransitionForAxis:d})}var Kf=a.d3?a.d3:a.require?a.require("d3"):void 0,Lf={data:{},axis:{},legend:{}},Mf={},Nf=i(["bindto"],"#chart"),Of=i(["size","width"]),Pf=i(["size","height"]),Qf=i(["padding","left"],50),Rf=i(["padding","right"],0),Sf=i(["padding","top"],0),Tf=i(["padding","bottom"],0),Uf=i(["zoom","enabled"],!1),Vf=i(["zoom","extent"]),Wf=i(["zoom","privileged"],!1),Xf=i(["onenter"],function(){}),Yf=i(["onleave"],function(){}),Zf=i(["onresize"],function(){}),$f=i(["onresized"],function(){}),_f=i(["transition","duration"],350);h("data","data is required in config");var ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg,Kg=i(["data","x"]),Lg=i(["data","xs"],{}),Mg=i(["data","x_format"]),Ng=i(["data","id_converter"],function(a){return a}),Og=i(["data","names"],{}),Pg=i(["data","classes"],{}),Qg=i(["data","groups"],[]),Rg=i(["data","axes"],{}),Sg=i(["data","type"]),Tg=i(["data","types"],{}),Ug=i(["data","labels"],{}),Vg=i(["data","order"]),Wg=i(["data","regions"],{}),Xg=i(["data","color"]),Yg=i(["data","colors"],{}),Zg=i(["data","hide"],!1),$g=i(["data","selection","enabled"],!1),_g=i(["data","selection","grouped"],!1),ah=i(["data","selection","isselectable"],function(){return!0}),bh=i(["data","selection","multiple"],!0),ch=i(["data","onclick"],function(){}),dh=i(["data","onenter"],function(){}),eh=i(["data","onleave"],function(){}),fh=i(["data","onselected"],function(){}),gh=i(["data","onunselected"],function(){}),hh=i(["data","ondragstart"],function(){}),ih=i(["data","ondragend"],function(){}),jh=i(["subchart","show"],!1),kh=i(["subchart","size","height"],60),lh=i(["color","pattern"],[]),mh=i(["legend","show"],!0),nh=i(["legend","position"],"bottom"),oh=i(["legend","item","onclick"]),ph=i(["legend","item","onmouseover"]),qh=i(["legend","item","onmouseout"]),rh=i(["legend","equally"],!1),sh=i(["axis","rotated"],!1),th=i(["axis","x","show"],!0),uh=i(["axis","x","type"],"indexed"),vh=i(["axis","x","localtime"],!0),wh=i(["axis","x","categories"],[]),xh=i(["axis","x","tick","centered"],!1),yh=i(["axis","x","tick","format"]),zh=i(["axis","x","tick","culling"],{}),Ah=i(["axis","x","tick","culling","max"],10),Bh=i(["axis","x","tick","count"]),Ch=i(["axis","x","tick","fit"],!0),Dh=i(["axis","x","tick","values"],null),Eh=i(["axis","x","tick","rotate"]),Fh=i(["axis","x","max"],null),Gh=i(["axis","x","min"],null),Hh=i(["axis","x","padding"],{}),Ih=i(["axis","x","height"]),Jh=i(["axis","x","default"]),Kh=i(["axis","x","label"],{}),Lh=i(["axis","y","show"],!0),Mh=i(["axis","y","max"]),Nh=i(["axis","y","min"]),Oh=i(["axis","y","center"]),Ph=i(["axis","y","label"],{}),Qh=i(["axis","y","inner"],!1),Rh=i(["axis","y","tick","format"]),Sh=i(["axis","y","padding"]),Th=i(["axis","y","ticks"],10),Uh=i(["axis","y2","show"],!1),Vh=i(["axis","y2","max"]),Wh=i(["axis","y2","min"]),Xh=i(["axis","y2","center"]),Yh=i(["axis","y2","label"],{}),Zh=i(["axis","y2","inner"],!1),$h=i(["axis","y2","tick","format"]),_h=i(["axis","y2","padding"]),ai=i(["axis","y2","ticks"],10),bi=i(["grid","x","show"],!1),ci=i(["grid","x","type"],"tick"),di=i(["grid","x","lines"],[]),ei=i(["grid","y","show"],!1),fi=i(["grid","y","lines"],[]),gi=i(["grid","y","ticks"],10),hi=i(["point","show"],!0),ii=i(["point","r"],2.5),ji=i(["point","focus","line","enabled"],!0),ki=i(["point","focus","expand","enabled"],!0),li=i(["point","focus","expand","r"]),mi=i(["point","focus","select","r"]),ni=i(["line","connect_null"],!1),oi=i(["bar","width"]),pi=i(["bar","width","ratio"],.6),qi=i(["pie","label","show"],!0),ri=i(["pie","label","format"]),si=i(["pie","expand"],!0),ti=i(["pie","onclick"],function(){}),ui=i(["pie","onmouseover"],function(){}),vi=i(["pie","onmouseout"],function(){}),wi=i(["donut","label","show"],!0),xi=i(["donut","label","format"]),yi=i(["donut","expand"],!0),zi=i(["donut","title"],""),Ai=i(["donut","onclick"],function(){}),Bi=i(["donut","onmouseover"],function(){}),Ci=i(["donut","onmouseout"],function(){}),Di=i(["regions"],[]),Ei=i(["tooltip","show"],!0),Fi=i(["tooltip","format","title"]),Gi=i(["tooltip","format","value"]),Hi=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Fi?Fi:b,l=Gi?Gi:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Ii=i(["tooltip","init","show"],!1),Ji=i(["tooltip","init","x"],0),Ki=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Li=("string"==typeof Nf?Nf.replace("#",""):Nf.id)+"-clip",Mi=Li+"-xaxis",Ni=Li+"-yaxis",Oi=j(Li),Pi=j(Mi),Qi=j(Ni),Ri="timeseries"===uh,Si="categorized"===uh,Ti=!Ri&&(Kg||Ee(Lg)),Ui=null,Vi=!1,Wi=!1,Xi=!1,Yi=!1,Zi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],$i=ye(Yg,Ee(lh)?lh:Zi,Xg),_i=vh?Kf.time.format:Kf.time.format.utc,aj=_i.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),bj=[],cj=[],dj={},ej=sh?"left":"bottom",fj=sh?Qh?"top":"bottom":Qh?"right":"left",gj=sh?Zh?"bottom":"top":Zh?"left":"right",hj=sh?"left":"bottom",ij={main:function(){return"translate("+k(ag.left)+","+k(ag.top)+")"},context:function(){return"translate("+k(bg.left)+","+k(bg.top)+")"},legend:function(){return"translate("+cg.left+","+cg.top+")"},x:function(){return"translate(0,"+(sh?0:fg)+")"},y:function(){return"translate(0,"+(sh?fg:0)+")"},y2:function(){return"translate("+(sh?0:dg)+","+(sh?1:0)+")"},subx:function(){return"translate(0,"+(sh?0:gg)+")"},arc:function(){return"translate("+mg/2+","+ng/2+")" -}},jj="right"===nh,kj=0,lj=0,mj=0,nj=.15,oj=30,pj=sh&&!th?0:30,qj=5;rg=Kf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var rj,sj=function(){var a=Kf.svg.line().x(sh?function(a){return Y(a.id)(a.value)}:Hd).y(sh?Hd:function(a){return Y(a.id)(a.value)});return ni||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ni?Re(b.values):b.values;return le(b)?(a.interpolate(me(b)?"cardinal":"linear"),Wg[b.id]?ef(e,Ag,Y(b.id),Wg[b.id]):a(e)):(c=e[0]?Ag(e[0].x):0,d=e[0]?Y(b.id)(e[0].value):0,sh?"M "+d+" "+c:"M "+c+" "+d)}}(),tj=function(){var a;return a=sh?Kf.svg.area().x0(function(a){return Y(a.id)(0)}).x1(function(a){return Y(a.id)(a.value)}).y(Hd):Kf.svg.area().x(Hd).y0(function(a){return Y(a.id)(0)}).y1(function(a){return Y(a.id)(a.value)}),function(b){var c,d,e=Re(b.values);return fe([b],"area")||fe([b],"area-spline")?(a.interpolate(me(b)?"cardinal":"linear"),a(e)):(c=e[0]?Ag(e[0].x):0,d=e[0]?Y(b.id)(e[0].value):0,sh?"M "+d+" "+c:"M "+c+" "+d)}}(),uj=function(){var a=Kf.svg.line().x(sh?function(a){return Z(a.id)(a.value)}:Kd).y(sh?Kd:function(a){return Z(a.id)(a.value)});return function(b){var c=Re(b.values);return le(b)?a(c):"M "+Dg(c[0].x)+" "+Z(b.id)(c[0].value)}}(),vj=function(){};rj=Kf.svg.brush().on("brush",pf),rj.update=function(){return zj&&zj.select("."+g.brush).call(this),this},rj.scale=function(a){return sh?this.y(a):this.x(a)},Uf&&(vj=Kf.behavior.zoom().on("zoomstart",function(){vj.altDomain=Kf.event.sourceEvent.altKey?Ag.orgDomain():null}).on("zoom",Uf?qf:null),vj.scale=function(a){return sh?this.y(a):this.x(a)},vj.orgScaleExtent=function(){var a=Vf?Vf:[1,10];return[a[0],Math.max(Bc()/a[1],a[1])]},vj.updateScaleExtent=function(){var a=cc(Ag.orgDomain())/cc(Dj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var wj,xj,yj,zj,Aj,Bj,Cj,Dj,Ej,Fj={};if(Lf.focus=function(a){function b(a){Kc(a).transition().duration(100).style("opacity",1)}var c=wj.selectAll(rd(a)),d=c.filter(Gf),e=c.filter(Hf);Lf.revert(),Lf.defocus(),b(d.classed(g.focused,!0)),b(e),ke(Lf.data.targets)&&Pb(a,!0),Bf(a,!0)},Lf.defocus=function(a){function b(a){Kc(a).transition().duration(100).style("opacity",.3)}var c=wj.selectAll(rd(a)),d=c.filter(Gf),e=c.filter(Hf);Lf.revert(),b(d.classed(g.focused,!1)),b(e),ke(Lf.data.targets)&&Qb(a),Bf(a,!1)},Lf.revert=function(a){function b(a){Kc(a).transition().duration(100).style("opacity",1)}var c=wj.selectAll(rd(a)),d=c.filter(Gf),e=c.filter(Hf);b(d.classed(g.focused,!1)),b(e),ke(Lf.data.targets)&&Qb(a),Cf()},Lf.show=function(a,b){a=Fc(a),b=b||{},Oc(a),wj.selectAll(sd(a)).transition().style("opacity",1),b.withLegend&&Df(a),of({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Lf.hide=function(a,b){a=Fc(a),b=b||{},Nc(a),wj.selectAll(sd(a)).transition().style("opacity",0),b.withLegend&&Ef(a),of({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Lf.toggle=function(a){Ic(a)?Lf.hide(a):Lf.show(a)},Lf.unzoom=function(){rj.clear().update(),of({withUpdateXDomain:!0})},Lf.load=function(a){return a.xs&&pc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Pg[b]=a.classes[b]}),"categories"in a&&Si&&(wh=a.categories,Gg.categories(wh)),"cacheIds"in a&&dc(a.cacheIds)?void wf(fc(a.cacheIds),a.done):void("unload"in a?yf(Fc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){xf(a)}):xf(a))},Lf.unload=function(a,b){yf(Fc(a),function(){of({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Lf.selected=function(a){return Kf.merge(yj.selectAll("."+g.shapes+qd(a)).selectAll("."+g.shape).filter(function(){return Kf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Lf.select=function(a,b,c){$g&&yj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Kf.select(this),i=e.data?e.data.id:e.id,j=Qe(this),k=_g||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);"path"!==this.nodeName&&(k&&l?ah(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},Lf.unselect=function(a,b){$g&&yj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Kf.select(this),f=c.data?c.data.id:c.id,h=Qe(this),i=_g||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);"path"!==this.nodeName&&i&&j&&ah(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Lf.toLine=function(a){Jf(a,"line")},Lf.toSpline=function(a){Jf(a,"spline")},Lf.toBar=function(a){Jf(a,"bar")},Lf.toScatter=function(a){Jf(a,"scatter")},Lf.toArea=function(a){Jf(a,"area")},Lf.toAreaSpline=function(a){Jf(a,"area-spline")},Lf.toPie=function(a){Jf(a,"pie",{withTransform:!0})},Lf.toDonut=function(a){Jf(a,"donut",{withTransform:!0})},Lf.groups=function(a){return c(a)?Qg:(Qg=a,of(),Qg)},Lf.xgrids=function(a){return a?(di=a,of(),di):di},Lf.xgrids.add=function(a){return a?Lf.xgrids(di.concat(a)):void 0},Lf.xgrids.remove=function(a){var b=If(a);return Lf.xgrids(di.filter(b))},Lf.ygrids=function(a){return a?(fi=a,of(),fi):fi},Lf.ygrids.add=function(a){return a?Lf.ygrids(fi.concat(a)):void 0},Lf.ygrids.remove=function(a){var b=If(a);return Lf.ygrids(fi.filter(b))},Lf.regions=function(a){return c(a)?Di:(Di=a,of(),Di)},Lf.regions.add=function(a){return c(a)?Di:(Di=Di.concat(a),of(),Di)},Lf.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;wj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Di=Di.filter(function(b){return b.classes.indexOf(a)<0})}),Di},Lf.data.get=function(a){var b=Lf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Lf.data.getAsTarget=function(a){var b=Hc(function(b){return b.id===a});return b.length>0?b[0]:void 0},Lf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Og[b]=a[b]}),of({withLegend:!0}),Og):Og},Lf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Yg[b]=a[b]}),of({withLegend:!0}),Yg):Yg},Lf.x=function(a){return arguments.length&&(sc(Lf.data.targets,a),of({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Lf.data.xs},Lf.xs=function(a){return arguments.length&&(tc(Lf.data.targets,a),of({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Lf.data.xs},Lf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){eb(b,a[b])}),Gb())},Lf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Fh=+a.x),b(a.y)&&(Mh=+a.y),b(a.y2)&&(Vh=+a.y2)):Mh=Vh=+a,of({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Lf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Gh=+a.x),b(a.y)&&(Nh=+a.y),b(a.y2)&&(Wh=+a.y2)):Nh=Wh=+a,of({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Lf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Lf.axis.max(a.max),"undefined"!=typeof a.min&&Lf.axis.min(a.min))},Lf.legend.show=function(a){Df(Fc(a)),of({withLegend:!0})},Lf.legend.hide=function(a){Ef(Fc(a)),of({withLegend:!0})},Lf.resize=function(a){Of=a?a.width:null,Pf=a?a.height:null,uf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Lf.destroy=function(){Lf.data.targets=void 0,Lf.data.xs={},Cj.html(""),a.onresize=null},"url"in f.data)Kf.xhr(f.data.url,function(a,b){var c,d=Kf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Kf.csv.parse(b.response),ff(c)});else if("rows"in f.data)ff(vc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");ff(wc(f.data.columns))}return Lf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(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}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.ceil(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.ceil(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&acg&&(cg=0),0>eg&&(eg=0),dg=sh?_f.left-oj-pj:cg,fg=sh?eg:hg-ag.top-ag.bottom,0>dg&&(dg=0),0>fg&&(fg=0),lg=cg-(jj?b+10:0),mg=eg-(jj?0:10),r(),jj&&d&&(bg.left=lg/2+1.1*jg)}function q(){yj.select("line."+g.xgridFocus).attr("x1",sh?0:-10).attr("x2",sh?cg:-10).attr("y1",sh?-10:_f.top).attr("y2",sh?-10:eg)}function r(){jg=Math.min(lg,mg)/2,ig=.95*jg,kg=ie(Kf.data.targets)?.6*ig:0}function s(){var a=sh?g.axisX:g.axisY,b=yj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Jf.select(Mf).node().getBoundingClientRect(),e=je(Kf.data.targets),f=c.right-d.left-(e?0:v());return f>0?f:0}function t(){return Nf?Nf:z()}function u(){var a=Of?Of:A();return a>0?a:320}function v(){var a=1;return Pf?Pf:sh?th?x("x"):a:!Lh||Qh?a:x("y")}function w(){var a=1;return Qf?Qf:jj?R()+20+(Uh&&!sh?x("y2"):a):Uh?Zh||sh?a:x("y2"):a}function x(a){var b=mb(a);return b.isInner?20+Fb(a):40+Fb(a)}function y(a){return"x"!==a||th?"x"===a&&Ih?Ih:"y"!==a||Lh?"y2"!==a||Uh?(mb(a).isInner?30:40)+("y2"===a?-10:0):qj:mh&&!jj?10:1:0}function z(){return+Jf.select(Mf).style("width").replace("px","")}function A(){return+Jf.select(Mf).style("height").replace("px","")}function B(a){return a?-31:-(_f.left-1)}function C(a){return a?-20:-4}function D(){return B(!sh)}function E(){return C(!sh)}function F(){return B(sh)}function G(){return C(sh)}function H(a){return a?cg+2+30+30:_f.left+20}function I(a){return a?(Ih?Ih:0)+80:eg+8}function J(){return H(!sh)}function K(){return I(!sh)}function L(){return H(sh)}function M(){return I(sh)}function N(){var a,b,c,d,e,f=Cc(Kf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=zg(b.x)-zg(a.x),0===c?sh?eg:cg:(d=Bc(),e=fe(Kf.data.targets)?(d-(Si?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function O(a){kj=a}function P(a){lj=a}function Q(a){mj=a}function R(){return mh?jj?lj*(kj+1):gg:0}function S(){return mh?jj?hg:mj*(kj+1):0}function T(){var a,b,c=!zg;rg=sh?1:0,sg=sh?eg:cg,tg=sh?0:eg,ug=sh?cg:1,vg=rg,wg=sg,xg=sh?0:fg,yg=sh?dg:1,zg=W(rg,sg,c?void 0:zg.domain(),function(){return Fg.tickOffset()}),Ag=X(tg,ug,c?void 0:Ag.domain()),Bg=X(tg,ug,c?void 0:Bg.domain()),Cg=W(rg,sg,Dj,function(a){return a%1?0:Ig.tickOffset()}),Dg=X(xg,yg,c?void 0:Dg.domain()),Eg=X(xg,yg,c?void 0:Eg.domain()),a=bb(),b=Dh?Dh:c?void 0:Fg.tickValues(),Fg=$(zg,ej,a,b),Ig=$(Cg,hj,a,b),Gg=_(Ag,fj,Rh,Th),Hg=_(Bg,gj,$h,ai),c||(rj.scale(Cg),Tf&&vj.scale(zg)),U()}function U(){ng=Ib(),og=Jb(),pg=Jb(.98)}function V(a,b,c){return(c?Jf.time.scale():Jf.scale.linear()).range([a,b])}function W(a,b,c,d){var e,f=V(a,b,Ri),g=c?f.domain(c):f;Si?(d=d||function(){return 0},f=function(a,b){var c=g(a)+d(a);return b?c:Math.ceil(c)}):f=function(a,b){var c=g(a);return b?c:Math.ceil(c)};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return Dj&&Dj[0]===a[0]&&Dj[1]a?a.toFixed(0):a};return yh&&("function"==typeof yh?a=yh:Ri&&(a=function(a){return a?_i(yh)(a):""})),a}function cb(a){var b;return"y"===a?b=Ph:"y2"===a?b=Yh:"x"===a&&(b=Kh),b}function db(a){var b=cb(a);return"string"==typeof b?b:b?b.text:null}function eb(a,b){var c=cb(a);"string"==typeof c?"y"===a?Ph=b:"y2"===a?Yh=b:"x"===a&&(Kh=b):c&&(c.text=b)}function fb(a){return 10*Math.sin(Math.PI*(a/180))}function gb(a){return 11.5-2.5*(a/15)}function hb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",gb(c)).attr("x",fb(c)).attr("transform","rotate("+c+")")}function ib(a,b){var c=cb(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 jb(){return ib("x",sh?"inner-top":"inner-right")}function kb(){return ib("y",sh?"inner-right":"inner-top")}function lb(){return ib("y2",sh?"inner-right":"inner-top")}function mb(a){return"y2"===a?lb():"y"===a?kb():jb()}function nb(){return db("x")}function ob(){return db("y")}function pb(){return db("y2")}function qb(a,b){return a?b.isLeft?0:b.isCenter?cg/2:cg:b.isBottom?-eg:b.isMiddle?-eg/2:0}function rb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function sb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function tb(){return qb(!sh,jb())}function ub(){return qb(sh,kb())}function vb(){return qb(sh,lb())}function wb(){return rb(!sh,jb())}function xb(){return rb(sh,kb())}function yb(){return rb(sh,lb())}function zb(){var a=jb();return sh?a.isInner?"1.2em":-25-Fb("x"):a.isInner?"-0.5em":Ih?Ih-10:"3em"}function Ab(){var a=kb();return sh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Fb("y")}function Bb(){var a=lb();return sh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Fb("y2")}function Cb(){return sb(!sh,jb())}function Db(){return sb(sh,kb())}function Eb(){return sb(sh,lb())}function Fb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Jf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Gb(a){var b=yj.select("."+g.axisX+" ."+g.axisXLabel),c=yj.select("."+g.axisY+" ."+g.axisYLabel),d=yj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",tb).attr("dx",wb).attr("dy",zb).text(nb),(a?c.transition():c).attr("x",ub).attr("dx",xb).attr("dy",Ab).attr("dy",Ab).text(ob),(a?d.transition():d).attr("x",vb).attr("dx",yb).attr("dy",Bb).text(pb)}function Hb(a){var b=!1;return qg(Jc(Kf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Ib(){var a=Jf.svg.arc().outerRadius(ig).innerRadius(kg),b=function(b,c){var d;return c?a(b):(d=Hb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Jb(a){var b=Jf.svg.arc().outerRadius(jg*(a?a:1)).innerRadius(kg);return function(a){var c=Hb(a);return c?b(c):"M 0 0"}}function Kb(a,b){return qe(a.data)?ng(a,b):"M 0 0"}function Lb(a){var b,c,d,e,f=Hb(a),g="";return f&&(b=ng.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*ig*.8+","+d/e*ig*.8+")"),g}function Mb(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Nb(a){return rc({id:a.data.id,value:a.value,ratio:Mb(a)})}function Ob(a){var b,c,d,e;return Rb()?(b=Hb(a),c=b?b.value:null,d=Mb(b),e=Sb(),e?e(c,d):Ed(c,d)):""}function Pb(a,b){var c=wj.selectAll("."+g.chartArc+qd(a)),d=wj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});we(a)&&c.selectAll("path").transition().duration(50).attr("d",og).transition().duration(100).attr("d",pg).each(function(a){pe(a.data)}),b||d.style("opacity",.3)}function Qb(a){var b=wj.selectAll("."+g.chartArc+qd(a));b.selectAll("path").transition().duration(50).attr("d",ng),wj.selectAll("."+g.arc).style("opacity",1)}function Rb(){return ie(Kf.data.targets)?wi:qi}function Sb(){return ie(Kf.data.targets)?xi:ri}function Tb(){return ie(Kf.data.targets)?zi:""}function Ub(){var a=ie(Kf.data.targets)?Ai:ti;return"function"==typeof a?a:function(){}}function Vb(){var a=ie(Kf.data.targets)?Bi:ui;return"function"==typeof a?a:function(){}}function Wb(){var a=ie(Kf.data.targets)?Ci:vi;return"function"==typeof a?a:function(){}}function Xb(a){var b,c,d,e,f,g,h=Ec(a),i=Qc(a);if(Pg.length>0)for(g=Sc(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 Jf.min(Object.keys(i).map(function(a){return Jf.min(i[a])}))}function Yb(a){var b,c,d,e,f,g,h=Ec(a),i=Qc(a);if(Pg.length>0)for(g=Tc(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 Jf.max(Object.keys(i).map(function(a){return Jf.max(i[a])}))}function Zb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return ab(a.id)===c}),m="y2"===c?Wh:Nh,n="y2"===c?Vh:Mh,o=b(m)?m:Xb(l),p=b(n)?n:Yb(l),q="y2"===c?Xh:Oh,r=yd()&&sh;return 0===l.length?"y2"===c?Bg.domain():Ag.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=zd(o,p),j=cc(Ag.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Sh&&(f=b(Sh.top)?Sh.top:e,g=b(Sh.bottom)?Sh.bottom:e),"y2"===c&&_h&&(f=b(_h.top)?_h.top:e,g=b(_h.bottom)?_h.bottom:e),fe(l)&&!Sc(l)&&(g=o),[o-g,p+f])}function $b(a){return Gh?Ri?ye(Gh):Gh:Jf.min(a,function(a){return Jf.min(a.values,function(a){return a.x})})}function _b(a){return Fh?Ri?ye(Fh):Fh:Jf.max(a,function(a){return Jf.max(a.values,function(a){return a.x})})}function ac(a){var c,d,e,f,g=Dc(a),h=g[1]-g[0];return Si?d=0:fe(a)?(c=Bc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Hh&&De(Hh)?(e=b(Hh.left)?Hh.left:d,f=b(Hh.right)?Hh.right:d):e=f="number"==typeof Hh?Hh:d,{left:e,right:f}}function bc(a){var b=[$b(a),_b(a)],c=b[0],d=b[1],e=ac(a),f=0,g=0;return c-d!==0||Si||(c=Ri?new Date(.5*c.getTime()):-.5,d=Ri?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Ri?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Ri?new Date(d.getTime()+e.right):d+e.right),[f,g]}function cc(a){return a[1]-a[0]}function dc(a){for(var b=0;bb?0:b-c}function jc(a){var b,c=hc(a),d="y"===a.axis?Ag:Bg;return b="y"===a.axis||"y2"===a.axis?sh?eg:"start"in a?d(a.start):eg:sh?"end"in a?zg(Ri?ye(a.end):a.end):eg:eg,c>b?0:b-c}function kc(a){return Jg&&a===Jg||De(Kg)&&Ee(Kg,a)}function lc(a){return!kc(a)}function mc(a){return Jg?Jg:De(Kg)?Kg[a]:null}function nc(a,b){var c,d=b&&De(b)?Ec(b):[];return d.forEach(function(b){mc(b)===a&&(c=Kf.data.xs[b])}),c}function oc(a,b){return a in Kf.data.xs&&Kf.data.xs[a]&&Kf.data.xs[a][b]?Kf.data.xs[a][b]:b}function pc(a){Object.keys(a).forEach(function(b){Kg[b]=a[b]})}function qc(a){return 1===Jf.set(Object.keys(a).map(function(b){return a[b]})).size()}function rc(a){var b;return a&&(b=Ng[a.id],a.name=b?b:a.id),a}function sc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=uc(b[d],a.id,d)}),Kf.data.xs[a.id]=b})}function tc(a,b){a.forEach(function(a){b[a.id]&&sc([a],b[a.id])})}function uc(a,c,d){var e;return e=Ri?a?a instanceof Date?a:ye(a):ye(oc(c,d)):Ti&&!Si?b(a)?+a:oc(c,d):d}function vc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Kf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Jg?(d=Object.keys(Kf.data.xs),Kf.data.xs[c]=d.length>0?Kf.data.xs[d[0]]:void 0):De(Kg)&&(Kf.data.xs[c]=nc(f,Kf.data.targets)):Kf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Kf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Mg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=mc(b),g=a[f],h=uc(g,b,e);return Ti&&Si&&0===c&&g&&(0===e&&(wh=[]),wh.push(g)),("undefined"==typeof a[b]||Kf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Rg&&de(Ec(c).filter(function(a){return!(a in Sg)}),Rg),c.forEach(function(a){ec(a.id_org,a)}),c}function yc(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 zc(a){return a>0&&Kf.data.targets[0].values[a-1]?Kf.data.targets[0].values[a-1].x:void 0}function Ac(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Dc(a){var b,c,d=Cc(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Ec(a){return a.map(function(a){return a.id})}function Fc(a){return a?"string"==typeof a?[a]:a:Ec(Kf.data.targets)}function Gc(a,b){var c,d=Ec(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Ri?new Date(i):i);j.push(e)}return Ri||(j=j.sort(function(a,b){return a-b})),j}function Mc(a){bj=bj.concat(a)}function Nc(a){bj=bj.filter(function(b){return a.indexOf(b)<0})}function Oc(a){cj=cj.concat(a)}function Pc(a){cj=cj.filter(function(b){return a.indexOf(b)<0})}function Qc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Rc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Tc(a){return Rc(a,function(a){return a>0})}function Uc(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||0===a[f].x)&&(e=e.concat(Kd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Kd(a,g))),Nd(e,b)):Ld(a,b,f,g)}function Md(a,b){var c;return c=a.map(function(a){return Ld(a.values,b)}),Nd(c,b)}function Nd(a,b){var c,d;return a.forEach(function(a){var e=Fe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Od(a,b){return Jf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Pd(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 Qd(){return Ug&&"desc"===Ug.toLowerCase()}function Rd(){return Ug&&"asc"===Ug.toLowerCase()}function Sd(a){var b=Rd(),c=Qd();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 Ug&&a.sort(Ug),a}function Td(a,c){var d,e,f,g,h,i,j,k=je(Kf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&Ei&&(Bj.html(Hi(a,bb(),Ad(k),$i)).style("display","block"),d=Bj.property("offsetWidth"),e=Bj.property("offsetHeight"),k?(g=cg/2+c[0],i=eg/2+c[1]+20):(sh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-w(),i=zg(l[0].x)+20):(f=s(),g=f+v()+zg(l[0].x)+20,h=g+d,j=f+t()-w(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),Bj.style("top",i+"px").style("left",g+"px"))}function Ud(){Bj.style("display","none")}function Vd(a){var c=a.filter(function(a){return a&&b(a.value)});if(Ei&&!ge(Kf.data.targets)&&!je(Kf.data.targets)){var d=yj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(sh?"y1":"x1",Gd).attr(sh?"y2":"x2",Gd),mf(d,"grid")}}function Wd(){yj.select("line."+g.xgridFocus).style("visibility","hidden")}function Xd(a,b){var c,d,e,f,h=[],i=yj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=bc(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function Yd(a){return a.x||0===a.x?zg(a.x):null}function Zd(a){return Y(a.id)(a.value)}function $d(){var a,b,d={},e=0;return Jc(Kf.data.targets.filter(me)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ce(a,b){return"number"==typeof oi?oi:b?2*a.tickOffset()*pi/b:0}function de(a,b){Fc(a).forEach(function(a){Fj[a]=b===Sg[a],Sg[a]=b})}function ee(a,b){var c=!1;return a.forEach(function(a){Sg[a.id]===b&&(c=!0),a.id in Sg||"line"!==b||(c=!0)}),c}function fe(a){return ee(a,"bar")}function ge(a){return ee(a,"scatter")}function he(a){return ee(a,"pie")}function ie(a){return ee(a,"donut")}function je(a){return he(a)||ie(a)}function ke(a){var b="string"==typeof a?a:a.id;return!(b in Sg)||"line"===Sg[b]||"spline"===Sg[b]||"area"===Sg[b]||"area-spline"===Sg[b]}function le(a){var b="string"==typeof a?a:a.id;return"spline"===Sg[b]||"area-spline"===Sg[b]}function me(a){var b="string"==typeof a?a:a.id;return"bar"===Sg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"scatter"===Sg[b]}function oe(a){var b="string"==typeof a?a:a.id;return"pie"===Sg[b]}function pe(a){var b="string"==typeof a?a:a.id;return"donut"===Sg[b]}function qe(a){return oe(a)||pe(a)}function re(a){return ke(a)?[a]:[]}function se(a){return qe(a.data)?[a]:[]}function te(a){return me(a)?a.values:[]}function ue(a){return ke(a)||ne(a)?a.values:[]}function ve(a){return me(a)||ke(a)?a.values:[]}function we(a){return pe(a)&&yi||oe(a)&&si}function xe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ye(b){var c;try{c=Lg?Jf.time.format(Lg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Lg)}return c}function ze(a,b){var c=Jf.mouse(a),d=Jf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ee(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Fe(a,b){var c="y"===ab(a.id)?Ag:Bg,d=sh?1:0,e=sh?0:1;return Math.pow(zg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ge(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function He(a,b,c){return d(a[b])?a[b]:c}function Ie(a,b,c){fh(b,a.node()),yj.select("."+g.selectedCircles+pd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Vc(g.selectedCircle,c)}).attr("cx",sh?Zd:Yd).attr("cy",sh?Yd:Zd).attr("stroke",function(){return $i(b)}).attr("r",1.4*Te(b)).transition().duration(100).attr("r",Te)}function Je(a,b,c){gh(b,a.node()),yj.select("."+g.selectedCircles+pd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ke(a,b,c,d){a?Ie(b,c,d):Je(b,c,d)}function Le(a,b){fh(b,a.node()),a.transition().duration(100).style("fill",function(){return Jf.rgb($i(b)).brighter(.75)})}function Me(a,b){gh(b,a.node()),a.transition().duration(100).style("fill",function(){return $i(b)})}function Ne(a,b,c,d){a?Le(b,c,d):Me(b,c,d)}function Oe(a,b,c,d){Ne(a,b,c.data,d)}function Pe(a){return"circle"===a.nodeName?Ke:Jf.select(a).classed(g.bar)?Ne:Oe}function Qe(a){return a.filter(function(a){return b(a.value)})}function Re(a){return hi?"function"==typeof ii?ii(a):ii:0}function Se(a){return ki?li?li:1.75*Re(a):Re(a)}function Te(a){return mi?mi:4*Re(a)}function Ue(a,c){return(c?yj.selectAll("."+g.circles+pd(c)):yj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ve(a,b){Ue(a,b).classed(g.EXPANDED,!0).attr("r",Se)}function We(a){Ue(a).filter(function(){return Jf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Re)}function Xe(a){return yj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function Ye(a){Xe(a).classed(g.EXPANDED,!0)}function Ze(a){Xe(a).classed(g.EXPANDED,!1)}function $e(a,b){var c=cf(a,b);return function(a,b){var d=c(a,b),e=sh?1:0,f=sh?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 _e(a,b){var c=cf(a,!1),d=b?af:bf;return function(a,b){return d(c(a,b),a,this)}}function af(a,b){var c;return sh?(c=me(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function bf(a,b,c){var d=c.getBoundingClientRect();return sh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:me(b)?-3:-6)}function cf(a,b){var c=a.__max__+1,d=ce(Fg,c),e=_d(d,c,a,!!b),f=ae(!!b),g=be(a,!!b),h=b?Z:Y;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return sh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function df(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function ef(b){var c,d,e;if(Cj=Jf.select(Mf),Cj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Cj.html("").classed("c3",!0),Kf.data.xs={},Kf.data.targets=xc(b),Zg&&(Kf.data.targets=Kf.data.targets.filter(Zg)),Yg&&Mc(Yg===!0?Ec(Kf.data.targets):Yg),p(),T(),zg.domain(Jf.extent(bc(Kf.data.targets))),Ag.domain(Zb(Kf.data.targets,"y")),Bg.domain(Zb(Kf.data.targets,"y2")),Cg.domain(zg.domain()),Dg.domain(Ag.domain()),Eg.domain(Bg.domain()),Dj=zg.domain(),rj.scale(Cg),Tf&&vj.scale(zg),wj=Cj.append("svg").on("mouseenter",Wf).on("mouseleave",Xf),xj=wj.append("defs"),xj.append("clipPath").attr("id",Li).append("rect"),xj.append("clipPath").attr("id",Mi).append("rect"),xj.append("clipPath").attr("id",Ni).append("rect"),rf(),yj=wj.append("g").attr("transform",ij.main),zj=wj.append("g").attr("transform",ij.context),Aj=wj.append("g").attr("transform",ij.legend),jh||zj.style("visibility","hidden"),mh||(Aj.style("visibility","hidden"),cj=Ec(Kf.data.targets)),Bj=Jf.select(Mf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Ef(Ec(Kf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=yj.append("g").attr("clip-path",Oi).attr("class",g.grid),bi&&d.append("g").attr("class",g.xgrids),De(di)&&d.append("g").attr("class",g.xgridLines),ji&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),ei&&d.append("g").attr("class",g.ygrids),De(fi)&&d.append("g").attr("class",g.ygridLines),yj.append("g").attr("clip-path",Oi).attr("class",g.regions),yj.append("g").attr("clip-path",Oi).attr("class",g.chart),c=yj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Tf?sh?"ns-resize":"ew-resize":null),yj.select("."+g.chart).append("g").attr("class",g.chartBars),yj.select("."+g.chart).append("g").attr("class",g.chartLines),yj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",ij.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Tb()),yj.select("."+g.chart).append("g").attr("class",g.chartTexts),Tf&&yj.insert("rect",Vf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",cg).attr("height",eg).style("opacity",0).style("cursor",sh?"ns-resize":"ew-resize").call(vj).on("dblclick.zoom",null),Jh&&rj.extent("function"!=typeof Jh?Jh:Jh(bc())),dj.x=yj.append("g").attr("class",g.axisX).attr("clip-path",Pi).attr("transform",ij.x).style("visibility",th?"visible":"hidden"),dj.x.append("text").attr("class",g.axisXLabel).attr("transform",sh?"rotate(-90)":"").style("text-anchor",Cb),dj.y=yj.append("g").attr("class",g.axisY).attr("clip-path",Qi).attr("transform",ij.y).style("visibility",Lh?"visible":"hidden"),dj.y.append("text").attr("class",g.axisYLabel).attr("transform",sh?"":"rotate(-90)").style("text-anchor",Db),dj.y2=yj.append("g").attr("class",g.axisY2).attr("transform",ij.y2).style("visibility",Uh?"visible":"hidden"),dj.y2.append("text").attr("class",g.axisY2Label).attr("transform",sh?"":"rotate(-90)").style("text-anchor",Eb),zj.append("g").attr("clip-path",Oi).attr("class",g.chart),zj.select("."+g.chart).append("g").attr("class",g.chartBars),zj.select("."+g.chart).append("g").attr("class",g.chartLines),zj.append("g").attr("clip-path",Oi).attr("class",g.brush).call(rj).selectAll("rect").attr(sh?"width":"height",sh?dg:fg),dj.subx=zj.append("g").attr("class",g.axisX).attr("transform",ij.subx).attr("clip-path",sh?"":Pi),uf(Kf.data.targets),sh?yj.select("."+g.axisX).style("opacity",0).call(Fg):(yj.select("."+g.axisY).style("opacity",0).call(Gg),yj.select("."+g.axisY2).style("opacity",0).call(Hg)),p(),T(),rf(),o(!1),nf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Ii){if(Ri&&"string"==typeof Ji){for(Ji=ye(Ji),e=0;e0){d=[];for(var f in Ng)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Pd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ne,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function kf(a){je(Kf.data.targets)||$g&&(Ui=a,yj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Vi=!0,hh())}function lf(){je(Kf.data.targets)||$g&&(yj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),yj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Vi=!1,ih())}function mf(a,b){"grid"===b&&a.each(function(){var a=Jf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function nf(a,c){var d,e,f,h,i,j,k,l,m,n,o,p,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,O,P,Q,R,S,T,U,V,W=$d(),X=je(Kf.data.targets),Y=Jc(Kf.data.targets);if(a=a||{},C=He(a,"withY",!0),D=He(a,"withSubchart",!0),E=He(a,"withTransition",!0),H=He(a,"withTransform",!1),I=He(a,"withUpdateXDomain",!1),J=He(a,"withUpdateOrgXDomain",!1),K=He(a,"withLegend",!1),F=He(a,"withTransitionForExit",E),G=He(a,"withTransitionForAxis",E),Q=E?$f:0,R=F?Q:0,S=G?Q:0,c=c||sf(S),K&&mh&&Ef(Ec(Kf.data.targets),a,c),Si&&0===Y.length&&zg.domain([0,dj.x.selectAll(".tick").size()]),Y.length&&(J&&(zg.domain(Jf.extent(bc(Y))),Dj=zg.domain(),Tf&&vj.scale(zg).updateScaleExtent(),Cg.domain(zg.domain()),rj.scale(Cg)),I&&(zg.domain(rj.empty()?Dj:rj.extent()),Tf&&vj.scale(zg).updateScaleExtent()),Dh||!Ch&&!Bh||(T=Lc(Kc(Y),Bh),Fg.tickValues(T),Ig.tickValues(T))),Ag.domain(Zb(Y,"y")),Bg.domain(Zb(Y,"y2")),dj.x.style("opacity",X?0:1),dj.y.style("opacity",X?0:1),dj.y2.style("opacity",X?0:1),dj.subx.style("opacity",X?0:1),c.axisX.call(Fg),c.axisY.call(Gg),c.axisY2.call(Hg),c.axisSubX.call(Ig),Gb(E),I&&Y.length)if(zh&&T){for(U=1;U=0&&Jf.select(this).style("display",b%V?"none":"block")})}else wj.selectAll("."+g.axisX+" .tick text").style("display","block");!sh&&Eh&&hb(dj.x,c.axisX,Eh),L=$e(W),O=_e(W,!0),P=_e(W,!1),Dg.domain(Ag.domain()),Eg.domain(Bg.domain()),Bj.style("display","none"),q(),yj.select("line."+g.xgridFocus).style("visibility","hidden"),bi&&(f=Xd(ci,zg),z=Si?Fg.tickOffset():0,e=sh?{x1:0,x2:cg,y1:function(a){return zg(a)-z},y2:function(a){return zg(a)-z}}:{x1:function(a){return zg(a)+z},x2:function(a){return zg(a)+z},y1:_f.top,y2:eg},d=yj.select("."+g.xgrids).selectAll("."+g.xgrid).data(f),d.enter().append("line").attr("class",g.xgrid),d.attr(e).style("opacity",function(){return+Jf.select(this).attr(sh?"y1":"x1")===(sh?eg:0)?0:1}),d.exit().remove()),De(di)&&(h=yj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(di),i=h.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),i.append("line").style("opacity",0),i.append("text").attr("text-anchor","end").attr("transform",sh?"":"rotate(-90)").attr("dx",sh?0:-_f.top).attr("dy",-5).style("opacity",0),h.select("line").transition().duration(Q).attr("x1",sh?0:Hd).attr("x2",sh?cg:Hd).attr("y1",sh?Hd:_f.top).attr("y2",sh?Hd:eg).style("opacity",1),h.select("text").transition().duration(Q).attr("x",sh?cg:0).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),h.exit().transition().duration(Q).style("opacity",0).remove()),C&&ei&&(j=yj.select("."+g.ygrids).selectAll("."+g.ygrid).data(Ag.ticks(gi)),j.enter().append("line").attr("class",g.ygrid),j.attr("x1",sh?Ag:0).attr("x2",sh?Ag:cg).attr("y1",sh?0:Ag).attr("y2",sh?eg:Ag),j.exit().remove(),mf(j,"grid")),C&&De(fi)&&(k=yj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(fi),l=k.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",sh?"rotate(-90)":"").attr("dx",sh?0:-_f.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(Q).attr("x1",sh?Id:0).attr("x2",sh?Id:cg).attr("y1",sh?0:Id).attr("y2",sh?eg:Id).style("opacity",1),k.select("text").transition().duration(Q).attr("x",sh?0:cg).attr("y",Id).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(Q).style("opacity",0).remove()),s=yj.select("."+g.regions).selectAll("."+g.region).data(Di),s.enter().append("g").attr("class",id).append("rect").style("fill-opacity",0),s.selectAll("rect").transition().duration(Q).attr("x",gc).attr("y",hc).attr("width",ic).attr("height",jc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(Q).style("fill-opacity",0).remove(),p=yj.selectAll("."+g.bars).selectAll("."+g.bar).data(te),p.enter().append("path").attr("class",cd).style("stroke","none").style("fill",$i),p.style("opacity",ud).transition().duration(Q).attr("d",L).style("fill",$i).style("opacity",1),p.exit().transition().duration(R).style("opacity",0).remove(),m=yj.selectAll("."+g.lines).selectAll("."+g.line).data(re),m.enter().append("path").attr("class",$c).style("stroke",$i),m.style("opacity",ud).transition().duration(Q).attr("d",sj).style("stroke",$i).style("opacity",1),m.exit().transition().duration(R).style("opacity",0).remove(),n=yj.selectAll("."+g.areas).selectAll("."+g.area).data(re),n.enter().append("path").attr("class",gd).style("fill",$i).style("opacity",function(){return Ej=+Jf.select(this).style("opacity"),0}),n.style("opacity",0).transition().duration(Q).attr("d",tj).style("fill",$i).style("opacity",Ej),n.exit().transition().duration(R).style("opacity",0).remove(),o=yj.selectAll("."+g.circles).selectAll("."+g.circle).data(ue),o.enter().append("circle").attr("class",ad).attr("r",Re).style("fill",$i),o.style("opacity",ud).transition().duration(Q).style("opacity",wd).style("fill",$i).attr("cx",sh?Zd:Yd).attr("cy",sh?Yd:Zd),o.exit().remove(),t=yj.selectAll("."+g.texts).selectAll("."+g.text).data(ve),t.enter().append("text").attr("class",Wc).attr("text-anchor",function(a){return sh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",$i).style("fill-opacity",0),t.text(function(a){return Fd(a.id)(a.value,a.id)}).style("fill-opacity",vd).transition().duration(Q).attr("x",O).attr("y",P).style("fill",$i).style("fill-opacity",xd),t.exit().transition().duration(R).style("fill-opacity",0).remove(),r=yj.selectAll("."+g.arcs).selectAll("."+g.arc).data(se),r.enter().append("path").attr("class",ed).style("fill",function(a){return $i(a.data)}).style("cursor",function(a){return ah(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Yi||(c=Hb(a),d=Nb(c),e=Vb(),Pb(c.data.id),Af(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Hb(a),c=Nb(b),d=[c];Td(d,Jf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Yi||(c=Hb(a),d=Nb(c),e=Wb(),Qb(c.data.id),Bf(),Ud(),e(d,b))}).on("click",function(a,b){var c=Hb(a),d=Nb(c),e=Ub();hf(this,a,b),e(d,b)}),r.attr("transform",H?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Yi=!0}).transition().duration(Q).attrTween("d",function(a){var b,c=Hb(a);return c?(b=Jf.interpolate(this._current,c),this._current=b(0),function(a){return Kb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",H?"scale(1)":"").style("fill",function(a){return $i(a.data)}).style("opacity",1).call(Ge,function(){Yi=!1}),r.exit().transition().duration(R).style("opacity",0).remove(),yj.selectAll("."+g.chartArc).select("text").attr("transform",Lb).style("opacity",0).transition().duration(Q).text(Ob).style("opacity",function(a){return Hc(a.data.id)&&qe(a.data)?1:0}),yj.select("."+g.chartArcsTitle).style("opacity",ie(Kf.data.targets)?1:0),jh&&(Jf.event&&"zoom"===Jf.event.type&&rj.extent(zg.orgDomain()).update(),D&&(!sh&&Eh&&hb(dj.subx,c.axisSubX,Eh),rj.empty()||rj.extent(zg.orgDomain()).update(),M=$e(W,!0),v=zj.selectAll("."+g.bars).selectAll("."+g.bar).data(te),v.enter().append("path").attr("class",cd).style("stroke","none").style("fill",$i),v.style("opacity",ud).transition().duration(Q).attr("d",M).style("opacity",1),v.exit().transition().duration(Q).style("opacity",0).remove(),u=zj.selectAll("."+g.lines).selectAll("."+g.line).data(re),u.enter().append("path").attr("class",$c).style("stroke",$i),u.style("opacity",ud).transition().duration(Q).attr("d",uj).style("opacity",1),u.exit().transition().duration(Q).style("opacity",0).remove())),yj.selectAll("."+g.selectedCircles).filter(function(a){return me(a)}).selectAll("circle").remove(),yj.selectAll("."+g.selectedCircle).transition().duration(Q).attr("cx",sh?Zd:Yd).attr("cy",sh?Yd:Zd),w=yj.select("."+g.eventRects),De(Kg)&&!qc(Kg)?(w.classed(g.eventRectsMultiple)||w.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),x=yj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),gf(x.enter()),x.attr("x",0).attr("y",0).attr("width",cg).attr("height",eg)):(w.classed(g.eventRectsSingle)||w.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Ti&&!Si?(B=function(a,b){var c=zc(b),d=Ac(b),e=Kf.data.xs[a.id][b];return(zg(d?d:e+50)-zg(c?c:e-50))/2},A=function(a,b){var c=zc(b),d=Kf.data.xs[a.id][b];return(zg(d)+zg(c?c:d-50))/2}):(B=N(),A=function(a){return zg(a.x)-B/2}),y=Cc(Kf.data.targets),yj.select("."+g.eventRects).datum(y?y.values:[]),x=yj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),ff(x.enter()),x.attr("class",jd).attr("x",sh?0:A).attr("y",sh?A:0).attr("width",sh?cg:B).attr("height",sh?B:eg),x.exit().remove()),Ec(Kf.data.targets).forEach(function(a){Fj[a]=!0})}function of(){nf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function pf(){if(0!==Jc(Kf.data.targets).length){if("mousemove"===Jf.event.sourceEvent.type&&vj.altDomain)return zg.domain(vj.altDomain),void vj.scale(zg).updateScaleExtent();Si&&zg.orgDomain()[0]===Dj[0]&&zg.domain([Dj[0]-1e-10,zg.orgDomain()[1]]),nf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Jf.event.sourceEvent.type&&(Wi=!0)}}function qf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function rf(){wj.attr("width",gg).attr("height",hg),wj.select("#"+Li).select("rect").attr("width",cg).attr("height",eg),wj.select("#"+Mi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),wj.select("#"+Ni).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),wj.select("."+g.zoomRect).attr("width",cg).attr("height",eg),Cj.style("max-height",hg+"px")}function sf(a){return{axisX:a?dj.x.transition().duration(a):dj.x,axisY:a?dj.y.transition().duration(a):dj.y,axisY2:a?dj.y2.transition().duration(a):dj.y2,axisSubX:a?dj.subx.transition().duration(a):dj.subx}}function tf(a){var b;a=a||{},a.withTransition=He(a,"withTransition",!0),a.withTransform=He(a,"withTransform",!1),a.withLegend=He(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withLegend&&mh||(b=sf(a.withTransition?$f:0),p(),T(),rf(),o(a.withTransition,b)),nf(a,b)}function uf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=yj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",ld),j=i.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Xc),e=yj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",nd),d=e.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",dd).style("cursor",function(a){return ah(a)?"pointer":null}),c=yj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",md),b=c.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",_c),b.append("g").attr("class",hd),b.append("g").attr("class",function(a){return Vc(g.selectedCircles,a.id)}),b.append("g").attr("class",bd).style("cursor",function(a){return ah(a)?"pointer":null}),a.forEach(function(a){yj.selectAll("."+g.selectedCircles+pd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=yj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(qg(a)).attr("class",od),f=h.enter().append("g").attr("class",od),f.append("g").attr("class",fd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),jh&&(n=zj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",nd),m=n.enter().append("g").style("opacity",0).attr("class",nd),m.append("g").attr("class",dd),l=zj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",md),k=l.enter().append("g").style("opacity",0).attr("class",md),k.append("g").attr("class",_c)),wj.selectAll("."+g.target).filter(function(a){return Hc(a.id)}).transition().duration($f).style("opacity",1)}function vf(a,b){b.filter&&(a=a.filter(b.filter)),(b.type||b.types)&&a.forEach(function(a){b.types?de(a.id,b.types[a.id]):de(a.id,b.type)}),Kf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,z=0,F++)),E[a]=F,D[F]=f,A[a]=z,z+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+v)/10),j=10*Math.ceil((h.height+u)/10),k=jj?j:i,l=jj?S():R();return d&&(z=0,F=0,w=0,x=0),mh&&!Ic(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=i,C[c]=j,(!w||i>=w)&&(w=i),(!x||j>=x)&&(x=j),g=jj?x:w,void(rh?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(l-g*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=26,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=Aj.selectAll("."+g.legendItemFocused).size();b=b||{},n=He(b,"withTransition",!0),q=He(b,"withTransitionForTransform",!0),jj?(f=function(a){return w*E[a]},j=function(a){return D[E[a]]+A[a]}):(f=function(a){return D[E[a]]+A[a]},j=function(a){return x*E[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=Aj.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Vc(g.legendItem,a)}).style("visibility",function(a){return Ic(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof oh?oh(a):Kf.toggle(a)}).on("mouseover",function(a){Jf.select(this).classed(g.legendItemFocused,!0),Yi||Kf.focus(a),"function"==typeof ph&&ph(a)}).on("mouseout",function(a){Jf.select(this).classed(g.legendItemFocused,!1),Yi||Kf.revert(),"function"==typeof qh&&qh(a)}),m.append("text").text(function(a){return d(Ng[a])?Ng[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",jj?h:-200).attr("y",jj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",jj?i:-200).attr("y",jj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",$i).attr("x",jj?h:-200).attr("y",jj?-200:j).attr("width",10).attr("height",10),r=Aj.selectAll("text").data(a).text(function(a){return d(Ng[a])?Ng[a]:a}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=Aj.selectAll("rect."+g.legendItemEvent).data(a),(n?s.transition():s).attr("width",function(a){return B[a]}).attr("height",function(a){return C[a]}).attr("x",i).attr("y",l),t=Aj.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",$i).attr("x",f).attr("y",j),Aj.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Hc(a)}).transition().style("opacity",function(a){var b=Jf.select(this);return Hc(a)?!G||b.classed(g.legendItemFocused)?yf(b):zf(b):nj}),P(w),Q(x),O(F),p(),T(),rf(),o(q,c)}function Ff(a){return Gc(Kf.data.targets,a.id)}function Gf(a){return"data"in a&&Gc(Kf.data.targets,a.data.id)}function Hf(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 If(a,b,c){var d=!je(Kf.data.targets);Yi=!1,de(a,b),tf(c||{withTransitionForAxis:d})}var Jf=a.d3?a.d3:a.require?a.require("d3"):void 0,Kf={data:{},axis:{},legend:{}},Lf={},Mf=i(["bindto"],"#chart"),Nf=i(["size","width"]),Of=i(["size","height"]),Pf=i(["padding","left"],50),Qf=i(["padding","right"],0),Rf=i(["padding","top"],0),Sf=i(["padding","bottom"],0),Tf=i(["zoom","enabled"],!1),Uf=i(["zoom","extent"]),Vf=i(["zoom","privileged"],!1),Wf=i(["onenter"],function(){}),Xf=i(["onleave"],function(){}),Yf=i(["onresize"],function(){}),Zf=i(["onresized"],function(){}),$f=i(["transition","duration"],350);h("data","data is required in config");var _f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg=i(["data","x"]),Kg=i(["data","xs"],{}),Lg=i(["data","x_format"]),Mg=i(["data","id_converter"],function(a){return a}),Ng=i(["data","names"],{}),Og=i(["data","classes"],{}),Pg=i(["data","groups"],[]),Qg=i(["data","axes"],{}),Rg=i(["data","type"]),Sg=i(["data","types"],{}),Tg=i(["data","labels"],{}),Ug=i(["data","order"]),Vg=i(["data","regions"],{}),Wg=i(["data","color"]),Xg=i(["data","colors"],{}),Yg=i(["data","hide"],!1),Zg=i(["data","filter"]),$g=i(["data","selection","enabled"],!1),_g=i(["data","selection","grouped"],!1),ah=i(["data","selection","isselectable"],function(){return!0}),bh=i(["data","selection","multiple"],!0),ch=i(["data","onclick"],function(){}),dh=i(["data","onenter"],function(){}),eh=i(["data","onleave"],function(){}),fh=i(["data","onselected"],function(){}),gh=i(["data","onunselected"],function(){}),hh=i(["data","ondragstart"],function(){}),ih=i(["data","ondragend"],function(){}),jh=i(["subchart","show"],!1),kh=i(["subchart","size","height"],60),lh=i(["color","pattern"],[]),mh=i(["legend","show"],!0),nh=i(["legend","position"],"bottom"),oh=i(["legend","item","onclick"]),ph=i(["legend","item","onmouseover"]),qh=i(["legend","item","onmouseout"]),rh=i(["legend","equally"],!1),sh=i(["axis","rotated"],!1),th=i(["axis","x","show"],!0),uh=i(["axis","x","type"],"indexed"),vh=i(["axis","x","localtime"],!0),wh=i(["axis","x","categories"],[]),xh=i(["axis","x","tick","centered"],!1),yh=i(["axis","x","tick","format"]),zh=i(["axis","x","tick","culling"],{}),Ah=i(["axis","x","tick","culling","max"],10),Bh=i(["axis","x","tick","count"]),Ch=i(["axis","x","tick","fit"],!0),Dh=i(["axis","x","tick","values"],null),Eh=i(["axis","x","tick","rotate"]),Fh=i(["axis","x","max"],null),Gh=i(["axis","x","min"],null),Hh=i(["axis","x","padding"],{}),Ih=i(["axis","x","height"]),Jh=i(["axis","x","default"]),Kh=i(["axis","x","label"],{}),Lh=i(["axis","y","show"],!0),Mh=i(["axis","y","max"]),Nh=i(["axis","y","min"]),Oh=i(["axis","y","center"]),Ph=i(["axis","y","label"],{}),Qh=i(["axis","y","inner"],!1),Rh=i(["axis","y","tick","format"]),Sh=i(["axis","y","padding"]),Th=i(["axis","y","ticks"],10),Uh=i(["axis","y2","show"],!1),Vh=i(["axis","y2","max"]),Wh=i(["axis","y2","min"]),Xh=i(["axis","y2","center"]),Yh=i(["axis","y2","label"],{}),Zh=i(["axis","y2","inner"],!1),$h=i(["axis","y2","tick","format"]),_h=i(["axis","y2","padding"]),ai=i(["axis","y2","ticks"],10),bi=i(["grid","x","show"],!1),ci=i(["grid","x","type"],"tick"),di=i(["grid","x","lines"],[]),ei=i(["grid","y","show"],!1),fi=i(["grid","y","lines"],[]),gi=i(["grid","y","ticks"],10),hi=i(["point","show"],!0),ii=i(["point","r"],2.5),ji=i(["point","focus","line","enabled"],!0),ki=i(["point","focus","expand","enabled"],!0),li=i(["point","focus","expand","r"]),mi=i(["point","focus","select","r"]),ni=i(["line","connect_null"],!1),oi=i(["bar","width"]),pi=i(["bar","width","ratio"],.6),qi=i(["pie","label","show"],!0),ri=i(["pie","label","format"]),si=i(["pie","expand"],!0),ti=i(["pie","onclick"],function(){}),ui=i(["pie","onmouseover"],function(){}),vi=i(["pie","onmouseout"],function(){}),wi=i(["donut","label","show"],!0),xi=i(["donut","label","format"]),yi=i(["donut","expand"],!0),zi=i(["donut","title"],""),Ai=i(["donut","onclick"],function(){}),Bi=i(["donut","onmouseover"],function(){}),Ci=i(["donut","onmouseout"],function(){}),Di=i(["regions"],[]),Ei=i(["tooltip","show"],!0),Fi=i(["tooltip","format","title"]),Gi=i(["tooltip","format","value"]),Hi=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Fi?Fi:b,l=Gi?Gi:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Ii=i(["tooltip","init","show"],!1),Ji=i(["tooltip","init","x"],0),Ki=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Li=("string"==typeof Mf?Mf.replace("#",""):Mf.id)+"-clip",Mi=Li+"-xaxis",Ni=Li+"-yaxis",Oi=j(Li),Pi=j(Mi),Qi=j(Ni),Ri="timeseries"===uh,Si="categorized"===uh,Ti=!Ri&&(Jg||De(Kg)),Ui=null,Vi=!1,Wi=!1,Xi=!1,Yi=!1,Zi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],$i=xe(Xg,De(lh)?lh:Zi,Wg),_i=vh?Jf.time.format:Jf.time.format.utc,aj=_i.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),bj=[],cj=[],dj={},ej=sh?"left":"bottom",fj=sh?Qh?"top":"bottom":Qh?"right":"left",gj=sh?Zh?"bottom":"top":Zh?"left":"right",hj=sh?"left":"bottom",ij={main:function(){return"translate("+k(_f.left)+","+k(_f.top)+")"},context:function(){return"translate("+k(ag.left)+","+k(ag.top)+")"},legend:function(){return"translate("+bg.left+","+bg.top+")"},x:function(){return"translate(0,"+(sh?0:eg)+")"},y:function(){return"translate(0,"+(sh?eg:0)+")"},y2:function(){return"translate("+(sh?0:cg)+","+(sh?1:0)+")" +},subx:function(){return"translate(0,"+(sh?0:fg)+")"},arc:function(){return"translate("+lg/2+","+mg/2+")"}},jj="right"===nh,kj=0,lj=0,mj=0,nj=.15,oj=30,pj=sh&&!th?0:30,qj=5;qg=Jf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var rj,sj=function(){var a=Jf.svg.line().x(sh?function(a){return Y(a.id)(a.value)}:Gd).y(sh?Gd:function(a){return Y(a.id)(a.value)});return ni||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ni?Qe(b.values):b.values;return ke(b)?(a.interpolate(le(b)?"cardinal":"linear"),Vg[b.id]?df(e,zg,Y(b.id),Vg[b.id]):a(e)):(c=e[0]?zg(e[0].x):0,d=e[0]?Y(b.id)(e[0].value):0,sh?"M "+d+" "+c:"M "+c+" "+d)}}(),tj=function(){var a;return a=sh?Jf.svg.area().x0(function(a){return Y(a.id)(0)}).x1(function(a){return Y(a.id)(a.value)}).y(Gd):Jf.svg.area().x(Gd).y0(function(a){return Y(a.id)(0)}).y1(function(a){return Y(a.id)(a.value)}),function(b){var c,d,e=Qe(b.values);return ee([b],"area")||ee([b],"area-spline")?(a.interpolate(le(b)?"cardinal":"linear"),a(e)):(c=e[0]?zg(e[0].x):0,d=e[0]?Y(b.id)(e[0].value):0,sh?"M "+d+" "+c:"M "+c+" "+d)}}(),uj=function(){var a=Jf.svg.line().x(sh?function(a){return Z(a.id)(a.value)}:Jd).y(sh?Jd:function(a){return Z(a.id)(a.value)});return function(b){var c=Qe(b.values);return ke(b)?a(c):"M "+Cg(c[0].x)+" "+Z(b.id)(c[0].value)}}(),vj=function(){};rj=Jf.svg.brush().on("brush",of),rj.update=function(){return zj&&zj.select("."+g.brush).call(this),this},rj.scale=function(a){return sh?this.y(a):this.x(a)},Tf&&(vj=Jf.behavior.zoom().on("zoomstart",function(){vj.altDomain=Jf.event.sourceEvent.altKey?zg.orgDomain():null}).on("zoom",Tf?pf:null),vj.scale=function(a){return sh?this.y(a):this.x(a)},vj.orgScaleExtent=function(){var a=Uf?Uf:[1,10];return[a[0],Math.max(Bc()/a[1],a[1])]},vj.updateScaleExtent=function(){var a=cc(zg.orgDomain())/cc(Dj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var wj,xj,yj,zj,Aj,Bj,Cj,Dj,Ej,Fj={};if(Kf.focus=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",1)}var c=wj.selectAll(qd(a)),d=c.filter(Ff),e=c.filter(Gf);Kf.revert(),Kf.defocus(),b(d.classed(g.focused,!0)),b(e),je(Kf.data.targets)&&Pb(a,!0),Af(a,!0)},Kf.defocus=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",.3)}var c=wj.selectAll(qd(a)),d=c.filter(Ff),e=c.filter(Gf);Kf.revert(),b(d.classed(g.focused,!1)),b(e),je(Kf.data.targets)&&Qb(a),Af(a,!1)},Kf.revert=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",1)}var c=wj.selectAll(qd(a)),d=c.filter(Ff),e=c.filter(Gf);b(d.classed(g.focused,!1)),b(e),je(Kf.data.targets)&&Qb(a),Bf()},Kf.show=function(a,b){a=Fc(a),b=b||{},Nc(a),wj.selectAll(rd(a)).transition().style("opacity",1),b.withLegend&&Cf(a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Kf.hide=function(a,b){a=Fc(a),b=b||{},Mc(a),wj.selectAll(rd(a)).transition().style("opacity",0),b.withLegend&&Df(a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Kf.toggle=function(a){Hc(a)?Kf.hide(a):Kf.show(a)},Kf.unzoom=function(){rj.clear().update(),nf({withUpdateXDomain:!0})},Kf.load=function(a){return a.xs&&pc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Og[b]=a.classes[b]}),"categories"in a&&Si&&(wh=a.categories,Fg.categories(wh)),"cacheIds"in a&&dc(a.cacheIds)?void vf(fc(a.cacheIds),a.done):void("unload"in a?xf(Fc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){wf(a)}):wf(a))},Kf.unload=function(a,b){xf(Fc(a),function(){nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Kf.selected=function(a){return Jf.merge(yj.selectAll("."+g.shapes+pd(a)).selectAll("."+g.shape).filter(function(){return Jf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Kf.select=function(a,b,c){$g&&yj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Jf.select(this),i=e.data?e.data.id:e.id,j=Pe(this),k=_g||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);"path"!==this.nodeName&&(k&&l?ah(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},Kf.unselect=function(a,b){$g&&yj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Jf.select(this),f=c.data?c.data.id:c.id,h=Pe(this),i=_g||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);"path"!==this.nodeName&&i&&j&&ah(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Kf.toLine=function(a){If(a,"line")},Kf.toSpline=function(a){If(a,"spline")},Kf.toBar=function(a){If(a,"bar")},Kf.toScatter=function(a){If(a,"scatter")},Kf.toArea=function(a){If(a,"area")},Kf.toAreaSpline=function(a){If(a,"area-spline")},Kf.toPie=function(a){If(a,"pie",{withTransform:!0})},Kf.toDonut=function(a){If(a,"donut",{withTransform:!0})},Kf.groups=function(a){return c(a)?Pg:(Pg=a,nf(),Pg)},Kf.xgrids=function(a){return a?(di=a,nf(),di):di},Kf.xgrids.add=function(a){return a?Kf.xgrids(di.concat(a)):void 0},Kf.xgrids.remove=function(a){var b=Hf(a);return Kf.xgrids(di.filter(b))},Kf.ygrids=function(a){return a?(fi=a,nf(),fi):fi},Kf.ygrids.add=function(a){return a?Kf.ygrids(fi.concat(a)):void 0},Kf.ygrids.remove=function(a){var b=Hf(a);return Kf.ygrids(fi.filter(b))},Kf.regions=function(a){return c(a)?Di:(Di=a,nf(),Di)},Kf.regions.add=function(a){return c(a)?Di:(Di=Di.concat(a),nf(),Di)},Kf.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;wj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Di=Di.filter(function(b){return b.classes.indexOf(a)<0})}),Di},Kf.data.get=function(a){var b=Kf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Kf.data.getAsTarget=function(a){var b=Kf.data.targets.filter(function(b){return b.id===a});return b.length>0?b[0]:void 0},Kf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Ng[b]=a[b]}),nf({withLegend:!0}),Ng):Ng},Kf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Xg[b]=a[b]}),nf({withLegend:!0}),Xg):Xg},Kf.x=function(a){return arguments.length&&(sc(Kf.data.targets,a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Kf.data.xs},Kf.xs=function(a){return arguments.length&&(tc(Kf.data.targets,a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Kf.data.xs},Kf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){eb(b,a[b])}),Gb())},Kf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Fh=+a.x),b(a.y)&&(Mh=+a.y),b(a.y2)&&(Vh=+a.y2)):Mh=Vh=+a,nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Kf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Gh=+a.x),b(a.y)&&(Nh=+a.y),b(a.y2)&&(Wh=+a.y2)):Nh=Wh=+a,nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Kf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Kf.axis.max(a.max),"undefined"!=typeof a.min&&Kf.axis.min(a.min))},Kf.legend.show=function(a){Cf(Fc(a)),nf({withLegend:!0})},Kf.legend.hide=function(a){Df(Fc(a)),nf({withLegend:!0})},Kf.resize=function(a){Nf=a?a.width:null,Of=a?a.height:null,tf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Kf.destroy=function(){Kf.data.targets=void 0,Kf.data.xs={},Cj.html(""),a.onresize=null},"url"in f.data)Jf.xhr(f.data.url,function(a,b){var c,d=Jf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Jf.csv.parse(b.response),ef(c)});else if("rows"in f.data)ef(vc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");ef(wc(f.data.columns))}return Kf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(window); \ No newline at end of file diff --git a/htdocs/samples/data_load.html b/htdocs/samples/data_load.html index 11da005..f82bd09 100644 --- a/htdocs/samples/data_load.html +++ b/htdocs/samples/data_load.html @@ -11,7 +11,10 @@ var chart = c3.generate({ data: { url: '/data/c3_test.csv', - labels: true + labels: true, + filter: function (t) { + return t.id !== 'data1'; + } }, subchart: { show: true @@ -26,7 +29,10 @@ setTimeout(function () { chart.load({ - url: '/data/c3_test2.csv' + url: '/data/c3_test2.csv', + filter: function (t) { + return t.id !== 'data1'; + } }); }, 1000); From cc913bc5e8a869fee528f47a8c243a6ebc74a546 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Fri, 9 May 2014 13:01:32 +0900 Subject: [PATCH 152/178] Fix region --- c3.js | 6 +++--- c3.min.js | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/c3.js b/c3.js index 1bbb24a..ef7273e 100644 --- a/c3.js +++ b/c3.js @@ -3259,7 +3259,7 @@ .attr("height", regionHeight) .style("fill-opacity", function (d) { return isValue(d.opacity) ? d.opacity : 0.1; }); mainRegion.exit().transition().duration(duration) - .style("fill-opacity", 0) + .style("opacity", 0) .remove(); // bars @@ -4342,13 +4342,13 @@ }; c3.regions = function (regions) { - if (isUndefined(regions)) { return __regions; } + if (!regions) { return __regions; } __regions = regions; redraw(); return __regions; }; c3.regions.add = function (regions) { - if (isUndefined(regions)) { return __regions; } + if (!regions) { return __regions; } __regions = __regions.concat(regions); redraw(); return __regions; diff --git a/c3.min.js b/c3.min.js index 02b7796..5c5da82 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ !function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.ceil(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.ceil(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&acg&&(cg=0),0>eg&&(eg=0),dg=sh?_f.left-oj-pj:cg,fg=sh?eg:hg-ag.top-ag.bottom,0>dg&&(dg=0),0>fg&&(fg=0),lg=cg-(jj?b+10:0),mg=eg-(jj?0:10),r(),jj&&d&&(bg.left=lg/2+1.1*jg)}function q(){yj.select("line."+g.xgridFocus).attr("x1",sh?0:-10).attr("x2",sh?cg:-10).attr("y1",sh?-10:_f.top).attr("y2",sh?-10:eg)}function r(){jg=Math.min(lg,mg)/2,ig=.95*jg,kg=ie(Kf.data.targets)?.6*ig:0}function s(){var a=sh?g.axisX:g.axisY,b=yj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Jf.select(Mf).node().getBoundingClientRect(),e=je(Kf.data.targets),f=c.right-d.left-(e?0:v());return f>0?f:0}function t(){return Nf?Nf:z()}function u(){var a=Of?Of:A();return a>0?a:320}function v(){var a=1;return Pf?Pf:sh?th?x("x"):a:!Lh||Qh?a:x("y")}function w(){var a=1;return Qf?Qf:jj?R()+20+(Uh&&!sh?x("y2"):a):Uh?Zh||sh?a:x("y2"):a}function x(a){var b=mb(a);return b.isInner?20+Fb(a):40+Fb(a)}function y(a){return"x"!==a||th?"x"===a&&Ih?Ih:"y"!==a||Lh?"y2"!==a||Uh?(mb(a).isInner?30:40)+("y2"===a?-10:0):qj:mh&&!jj?10:1:0}function z(){return+Jf.select(Mf).style("width").replace("px","")}function A(){return+Jf.select(Mf).style("height").replace("px","")}function B(a){return a?-31:-(_f.left-1)}function C(a){return a?-20:-4}function D(){return B(!sh)}function E(){return C(!sh)}function F(){return B(sh)}function G(){return C(sh)}function H(a){return a?cg+2+30+30:_f.left+20}function I(a){return a?(Ih?Ih:0)+80:eg+8}function J(){return H(!sh)}function K(){return I(!sh)}function L(){return H(sh)}function M(){return I(sh)}function N(){var a,b,c,d,e,f=Cc(Kf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=zg(b.x)-zg(a.x),0===c?sh?eg:cg:(d=Bc(),e=fe(Kf.data.targets)?(d-(Si?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function O(a){kj=a}function P(a){lj=a}function Q(a){mj=a}function R(){return mh?jj?lj*(kj+1):gg:0}function S(){return mh?jj?hg:mj*(kj+1):0}function T(){var a,b,c=!zg;rg=sh?1:0,sg=sh?eg:cg,tg=sh?0:eg,ug=sh?cg:1,vg=rg,wg=sg,xg=sh?0:fg,yg=sh?dg:1,zg=W(rg,sg,c?void 0:zg.domain(),function(){return Fg.tickOffset()}),Ag=X(tg,ug,c?void 0:Ag.domain()),Bg=X(tg,ug,c?void 0:Bg.domain()),Cg=W(rg,sg,Dj,function(a){return a%1?0:Ig.tickOffset()}),Dg=X(xg,yg,c?void 0:Dg.domain()),Eg=X(xg,yg,c?void 0:Eg.domain()),a=bb(),b=Dh?Dh:c?void 0:Fg.tickValues(),Fg=$(zg,ej,a,b),Ig=$(Cg,hj,a,b),Gg=_(Ag,fj,Rh,Th),Hg=_(Bg,gj,$h,ai),c||(rj.scale(Cg),Tf&&vj.scale(zg)),U()}function U(){ng=Ib(),og=Jb(),pg=Jb(.98)}function V(a,b,c){return(c?Jf.time.scale():Jf.scale.linear()).range([a,b])}function W(a,b,c,d){var e,f=V(a,b,Ri),g=c?f.domain(c):f;Si?(d=d||function(){return 0},f=function(a,b){var c=g(a)+d(a);return b?c:Math.ceil(c)}):f=function(a,b){var c=g(a);return b?c:Math.ceil(c)};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return Dj&&Dj[0]===a[0]&&Dj[1]a?a.toFixed(0):a};return yh&&("function"==typeof yh?a=yh:Ri&&(a=function(a){return a?_i(yh)(a):""})),a}function cb(a){var b;return"y"===a?b=Ph:"y2"===a?b=Yh:"x"===a&&(b=Kh),b}function db(a){var b=cb(a);return"string"==typeof b?b:b?b.text:null}function eb(a,b){var c=cb(a);"string"==typeof c?"y"===a?Ph=b:"y2"===a?Yh=b:"x"===a&&(Kh=b):c&&(c.text=b)}function fb(a){return 10*Math.sin(Math.PI*(a/180))}function gb(a){return 11.5-2.5*(a/15)}function hb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",gb(c)).attr("x",fb(c)).attr("transform","rotate("+c+")")}function ib(a,b){var c=cb(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 jb(){return ib("x",sh?"inner-top":"inner-right")}function kb(){return ib("y",sh?"inner-right":"inner-top")}function lb(){return ib("y2",sh?"inner-right":"inner-top")}function mb(a){return"y2"===a?lb():"y"===a?kb():jb()}function nb(){return db("x")}function ob(){return db("y")}function pb(){return db("y2")}function qb(a,b){return a?b.isLeft?0:b.isCenter?cg/2:cg:b.isBottom?-eg:b.isMiddle?-eg/2:0}function rb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function sb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function tb(){return qb(!sh,jb())}function ub(){return qb(sh,kb())}function vb(){return qb(sh,lb())}function wb(){return rb(!sh,jb())}function xb(){return rb(sh,kb())}function yb(){return rb(sh,lb())}function zb(){var a=jb();return sh?a.isInner?"1.2em":-25-Fb("x"):a.isInner?"-0.5em":Ih?Ih-10:"3em"}function Ab(){var a=kb();return sh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Fb("y")}function Bb(){var a=lb();return sh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Fb("y2")}function Cb(){return sb(!sh,jb())}function Db(){return sb(sh,kb())}function Eb(){return sb(sh,lb())}function Fb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Jf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Gb(a){var b=yj.select("."+g.axisX+" ."+g.axisXLabel),c=yj.select("."+g.axisY+" ."+g.axisYLabel),d=yj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",tb).attr("dx",wb).attr("dy",zb).text(nb),(a?c.transition():c).attr("x",ub).attr("dx",xb).attr("dy",Ab).attr("dy",Ab).text(ob),(a?d.transition():d).attr("x",vb).attr("dx",yb).attr("dy",Bb).text(pb)}function Hb(a){var b=!1;return qg(Jc(Kf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Ib(){var a=Jf.svg.arc().outerRadius(ig).innerRadius(kg),b=function(b,c){var d;return c?a(b):(d=Hb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Jb(a){var b=Jf.svg.arc().outerRadius(jg*(a?a:1)).innerRadius(kg);return function(a){var c=Hb(a);return c?b(c):"M 0 0"}}function Kb(a,b){return qe(a.data)?ng(a,b):"M 0 0"}function Lb(a){var b,c,d,e,f=Hb(a),g="";return f&&(b=ng.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*ig*.8+","+d/e*ig*.8+")"),g}function Mb(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Nb(a){return rc({id:a.data.id,value:a.value,ratio:Mb(a)})}function Ob(a){var b,c,d,e;return Rb()?(b=Hb(a),c=b?b.value:null,d=Mb(b),e=Sb(),e?e(c,d):Ed(c,d)):""}function Pb(a,b){var c=wj.selectAll("."+g.chartArc+qd(a)),d=wj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});we(a)&&c.selectAll("path").transition().duration(50).attr("d",og).transition().duration(100).attr("d",pg).each(function(a){pe(a.data)}),b||d.style("opacity",.3)}function Qb(a){var b=wj.selectAll("."+g.chartArc+qd(a));b.selectAll("path").transition().duration(50).attr("d",ng),wj.selectAll("."+g.arc).style("opacity",1)}function Rb(){return ie(Kf.data.targets)?wi:qi}function Sb(){return ie(Kf.data.targets)?xi:ri}function Tb(){return ie(Kf.data.targets)?zi:""}function Ub(){var a=ie(Kf.data.targets)?Ai:ti;return"function"==typeof a?a:function(){}}function Vb(){var a=ie(Kf.data.targets)?Bi:ui;return"function"==typeof a?a:function(){}}function Wb(){var a=ie(Kf.data.targets)?Ci:vi;return"function"==typeof a?a:function(){}}function Xb(a){var b,c,d,e,f,g,h=Ec(a),i=Qc(a);if(Pg.length>0)for(g=Sc(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 Jf.min(Object.keys(i).map(function(a){return Jf.min(i[a])}))}function Yb(a){var b,c,d,e,f,g,h=Ec(a),i=Qc(a);if(Pg.length>0)for(g=Tc(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 Jf.max(Object.keys(i).map(function(a){return Jf.max(i[a])}))}function Zb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return ab(a.id)===c}),m="y2"===c?Wh:Nh,n="y2"===c?Vh:Mh,o=b(m)?m:Xb(l),p=b(n)?n:Yb(l),q="y2"===c?Xh:Oh,r=yd()&&sh;return 0===l.length?"y2"===c?Bg.domain():Ag.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=zd(o,p),j=cc(Ag.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Sh&&(f=b(Sh.top)?Sh.top:e,g=b(Sh.bottom)?Sh.bottom:e),"y2"===c&&_h&&(f=b(_h.top)?_h.top:e,g=b(_h.bottom)?_h.bottom:e),fe(l)&&!Sc(l)&&(g=o),[o-g,p+f])}function $b(a){return Gh?Ri?ye(Gh):Gh:Jf.min(a,function(a){return Jf.min(a.values,function(a){return a.x})})}function _b(a){return Fh?Ri?ye(Fh):Fh:Jf.max(a,function(a){return Jf.max(a.values,function(a){return a.x})})}function ac(a){var c,d,e,f,g=Dc(a),h=g[1]-g[0];return Si?d=0:fe(a)?(c=Bc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Hh&&De(Hh)?(e=b(Hh.left)?Hh.left:d,f=b(Hh.right)?Hh.right:d):e=f="number"==typeof Hh?Hh:d,{left:e,right:f}}function bc(a){var b=[$b(a),_b(a)],c=b[0],d=b[1],e=ac(a),f=0,g=0;return c-d!==0||Si||(c=Ri?new Date(.5*c.getTime()):-.5,d=Ri?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Ri?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Ri?new Date(d.getTime()+e.right):d+e.right),[f,g]}function cc(a){return a[1]-a[0]}function dc(a){for(var b=0;bb?0:b-c}function jc(a){var b,c=hc(a),d="y"===a.axis?Ag:Bg;return b="y"===a.axis||"y2"===a.axis?sh?eg:"start"in a?d(a.start):eg:sh?"end"in a?zg(Ri?ye(a.end):a.end):eg:eg,c>b?0:b-c}function kc(a){return Jg&&a===Jg||De(Kg)&&Ee(Kg,a)}function lc(a){return!kc(a)}function mc(a){return Jg?Jg:De(Kg)?Kg[a]:null}function nc(a,b){var c,d=b&&De(b)?Ec(b):[];return d.forEach(function(b){mc(b)===a&&(c=Kf.data.xs[b])}),c}function oc(a,b){return a in Kf.data.xs&&Kf.data.xs[a]&&Kf.data.xs[a][b]?Kf.data.xs[a][b]:b}function pc(a){Object.keys(a).forEach(function(b){Kg[b]=a[b]})}function qc(a){return 1===Jf.set(Object.keys(a).map(function(b){return a[b]})).size()}function rc(a){var b;return a&&(b=Ng[a.id],a.name=b?b:a.id),a}function sc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=uc(b[d],a.id,d)}),Kf.data.xs[a.id]=b})}function tc(a,b){a.forEach(function(a){b[a.id]&&sc([a],b[a.id])})}function uc(a,c,d){var e;return e=Ri?a?a instanceof Date?a:ye(a):ye(oc(c,d)):Ti&&!Si?b(a)?+a:oc(c,d):d}function vc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Kf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Jg?(d=Object.keys(Kf.data.xs),Kf.data.xs[c]=d.length>0?Kf.data.xs[d[0]]:void 0):De(Kg)&&(Kf.data.xs[c]=nc(f,Kf.data.targets)):Kf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Kf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Mg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=mc(b),g=a[f],h=uc(g,b,e);return Ti&&Si&&0===c&&g&&(0===e&&(wh=[]),wh.push(g)),("undefined"==typeof a[b]||Kf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Rg&&de(Ec(c).filter(function(a){return!(a in Sg)}),Rg),c.forEach(function(a){ec(a.id_org,a)}),c}function yc(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 zc(a){return a>0&&Kf.data.targets[0].values[a-1]?Kf.data.targets[0].values[a-1].x:void 0}function Ac(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Dc(a){var b,c,d=Cc(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Ec(a){return a.map(function(a){return a.id})}function Fc(a){return a?"string"==typeof a?[a]:a:Ec(Kf.data.targets)}function Gc(a,b){var c,d=Ec(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Ri?new Date(i):i);j.push(e)}return Ri||(j=j.sort(function(a,b){return a-b})),j}function Mc(a){bj=bj.concat(a)}function Nc(a){bj=bj.filter(function(b){return a.indexOf(b)<0})}function Oc(a){cj=cj.concat(a)}function Pc(a){cj=cj.filter(function(b){return a.indexOf(b)<0})}function Qc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Rc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Tc(a){return Rc(a,function(a){return a>0})}function Uc(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||0===a[f].x)&&(e=e.concat(Kd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Kd(a,g))),Nd(e,b)):Ld(a,b,f,g)}function Md(a,b){var c;return c=a.map(function(a){return Ld(a.values,b)}),Nd(c,b)}function Nd(a,b){var c,d;return a.forEach(function(a){var e=Fe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Od(a,b){return Jf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Pd(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 Qd(){return Ug&&"desc"===Ug.toLowerCase()}function Rd(){return Ug&&"asc"===Ug.toLowerCase()}function Sd(a){var b=Rd(),c=Qd();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 Ug&&a.sort(Ug),a}function Td(a,c){var d,e,f,g,h,i,j,k=je(Kf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&Ei&&(Bj.html(Hi(a,bb(),Ad(k),$i)).style("display","block"),d=Bj.property("offsetWidth"),e=Bj.property("offsetHeight"),k?(g=cg/2+c[0],i=eg/2+c[1]+20):(sh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-w(),i=zg(l[0].x)+20):(f=s(),g=f+v()+zg(l[0].x)+20,h=g+d,j=f+t()-w(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),Bj.style("top",i+"px").style("left",g+"px"))}function Ud(){Bj.style("display","none")}function Vd(a){var c=a.filter(function(a){return a&&b(a.value)});if(Ei&&!ge(Kf.data.targets)&&!je(Kf.data.targets)){var d=yj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(sh?"y1":"x1",Gd).attr(sh?"y2":"x2",Gd),mf(d,"grid")}}function Wd(){yj.select("line."+g.xgridFocus).style("visibility","hidden")}function Xd(a,b){var c,d,e,f,h=[],i=yj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=bc(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function Yd(a){return a.x||0===a.x?zg(a.x):null}function Zd(a){return Y(a.id)(a.value)}function $d(){var a,b,d={},e=0;return Jc(Kf.data.targets.filter(me)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ce(a,b){return"number"==typeof oi?oi:b?2*a.tickOffset()*pi/b:0}function de(a,b){Fc(a).forEach(function(a){Fj[a]=b===Sg[a],Sg[a]=b})}function ee(a,b){var c=!1;return a.forEach(function(a){Sg[a.id]===b&&(c=!0),a.id in Sg||"line"!==b||(c=!0)}),c}function fe(a){return ee(a,"bar")}function ge(a){return ee(a,"scatter")}function he(a){return ee(a,"pie")}function ie(a){return ee(a,"donut")}function je(a){return he(a)||ie(a)}function ke(a){var b="string"==typeof a?a:a.id;return!(b in Sg)||"line"===Sg[b]||"spline"===Sg[b]||"area"===Sg[b]||"area-spline"===Sg[b]}function le(a){var b="string"==typeof a?a:a.id;return"spline"===Sg[b]||"area-spline"===Sg[b]}function me(a){var b="string"==typeof a?a:a.id;return"bar"===Sg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"scatter"===Sg[b]}function oe(a){var b="string"==typeof a?a:a.id;return"pie"===Sg[b]}function pe(a){var b="string"==typeof a?a:a.id;return"donut"===Sg[b]}function qe(a){return oe(a)||pe(a)}function re(a){return ke(a)?[a]:[]}function se(a){return qe(a.data)?[a]:[]}function te(a){return me(a)?a.values:[]}function ue(a){return ke(a)||ne(a)?a.values:[]}function ve(a){return me(a)||ke(a)?a.values:[]}function we(a){return pe(a)&&yi||oe(a)&&si}function xe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ye(b){var c;try{c=Lg?Jf.time.format(Lg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Lg)}return c}function ze(a,b){var c=Jf.mouse(a),d=Jf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ee(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Fe(a,b){var c="y"===ab(a.id)?Ag:Bg,d=sh?1:0,e=sh?0:1;return Math.pow(zg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ge(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function He(a,b,c){return d(a[b])?a[b]:c}function Ie(a,b,c){fh(b,a.node()),yj.select("."+g.selectedCircles+pd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Vc(g.selectedCircle,c)}).attr("cx",sh?Zd:Yd).attr("cy",sh?Yd:Zd).attr("stroke",function(){return $i(b)}).attr("r",1.4*Te(b)).transition().duration(100).attr("r",Te)}function Je(a,b,c){gh(b,a.node()),yj.select("."+g.selectedCircles+pd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ke(a,b,c,d){a?Ie(b,c,d):Je(b,c,d)}function Le(a,b){fh(b,a.node()),a.transition().duration(100).style("fill",function(){return Jf.rgb($i(b)).brighter(.75)})}function Me(a,b){gh(b,a.node()),a.transition().duration(100).style("fill",function(){return $i(b)})}function Ne(a,b,c,d){a?Le(b,c,d):Me(b,c,d)}function Oe(a,b,c,d){Ne(a,b,c.data,d)}function Pe(a){return"circle"===a.nodeName?Ke:Jf.select(a).classed(g.bar)?Ne:Oe}function Qe(a){return a.filter(function(a){return b(a.value)})}function Re(a){return hi?"function"==typeof ii?ii(a):ii:0}function Se(a){return ki?li?li:1.75*Re(a):Re(a)}function Te(a){return mi?mi:4*Re(a)}function Ue(a,c){return(c?yj.selectAll("."+g.circles+pd(c)):yj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ve(a,b){Ue(a,b).classed(g.EXPANDED,!0).attr("r",Se)}function We(a){Ue(a).filter(function(){return Jf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Re)}function Xe(a){return yj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function Ye(a){Xe(a).classed(g.EXPANDED,!0)}function Ze(a){Xe(a).classed(g.EXPANDED,!1)}function $e(a,b){var c=cf(a,b);return function(a,b){var d=c(a,b),e=sh?1:0,f=sh?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 _e(a,b){var c=cf(a,!1),d=b?af:bf;return function(a,b){return d(c(a,b),a,this)}}function af(a,b){var c;return sh?(c=me(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function bf(a,b,c){var d=c.getBoundingClientRect();return sh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:me(b)?-3:-6)}function cf(a,b){var c=a.__max__+1,d=ce(Fg,c),e=_d(d,c,a,!!b),f=ae(!!b),g=be(a,!!b),h=b?Z:Y;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return sh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function df(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function ef(b){var c,d,e;if(Cj=Jf.select(Mf),Cj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Cj.html("").classed("c3",!0),Kf.data.xs={},Kf.data.targets=xc(b),Zg&&(Kf.data.targets=Kf.data.targets.filter(Zg)),Yg&&Mc(Yg===!0?Ec(Kf.data.targets):Yg),p(),T(),zg.domain(Jf.extent(bc(Kf.data.targets))),Ag.domain(Zb(Kf.data.targets,"y")),Bg.domain(Zb(Kf.data.targets,"y2")),Cg.domain(zg.domain()),Dg.domain(Ag.domain()),Eg.domain(Bg.domain()),Dj=zg.domain(),rj.scale(Cg),Tf&&vj.scale(zg),wj=Cj.append("svg").on("mouseenter",Wf).on("mouseleave",Xf),xj=wj.append("defs"),xj.append("clipPath").attr("id",Li).append("rect"),xj.append("clipPath").attr("id",Mi).append("rect"),xj.append("clipPath").attr("id",Ni).append("rect"),rf(),yj=wj.append("g").attr("transform",ij.main),zj=wj.append("g").attr("transform",ij.context),Aj=wj.append("g").attr("transform",ij.legend),jh||zj.style("visibility","hidden"),mh||(Aj.style("visibility","hidden"),cj=Ec(Kf.data.targets)),Bj=Jf.select(Mf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Ef(Ec(Kf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=yj.append("g").attr("clip-path",Oi).attr("class",g.grid),bi&&d.append("g").attr("class",g.xgrids),De(di)&&d.append("g").attr("class",g.xgridLines),ji&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),ei&&d.append("g").attr("class",g.ygrids),De(fi)&&d.append("g").attr("class",g.ygridLines),yj.append("g").attr("clip-path",Oi).attr("class",g.regions),yj.append("g").attr("clip-path",Oi).attr("class",g.chart),c=yj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Tf?sh?"ns-resize":"ew-resize":null),yj.select("."+g.chart).append("g").attr("class",g.chartBars),yj.select("."+g.chart).append("g").attr("class",g.chartLines),yj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",ij.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Tb()),yj.select("."+g.chart).append("g").attr("class",g.chartTexts),Tf&&yj.insert("rect",Vf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",cg).attr("height",eg).style("opacity",0).style("cursor",sh?"ns-resize":"ew-resize").call(vj).on("dblclick.zoom",null),Jh&&rj.extent("function"!=typeof Jh?Jh:Jh(bc())),dj.x=yj.append("g").attr("class",g.axisX).attr("clip-path",Pi).attr("transform",ij.x).style("visibility",th?"visible":"hidden"),dj.x.append("text").attr("class",g.axisXLabel).attr("transform",sh?"rotate(-90)":"").style("text-anchor",Cb),dj.y=yj.append("g").attr("class",g.axisY).attr("clip-path",Qi).attr("transform",ij.y).style("visibility",Lh?"visible":"hidden"),dj.y.append("text").attr("class",g.axisYLabel).attr("transform",sh?"":"rotate(-90)").style("text-anchor",Db),dj.y2=yj.append("g").attr("class",g.axisY2).attr("transform",ij.y2).style("visibility",Uh?"visible":"hidden"),dj.y2.append("text").attr("class",g.axisY2Label).attr("transform",sh?"":"rotate(-90)").style("text-anchor",Eb),zj.append("g").attr("clip-path",Oi).attr("class",g.chart),zj.select("."+g.chart).append("g").attr("class",g.chartBars),zj.select("."+g.chart).append("g").attr("class",g.chartLines),zj.append("g").attr("clip-path",Oi).attr("class",g.brush).call(rj).selectAll("rect").attr(sh?"width":"height",sh?dg:fg),dj.subx=zj.append("g").attr("class",g.axisX).attr("transform",ij.subx).attr("clip-path",sh?"":Pi),uf(Kf.data.targets),sh?yj.select("."+g.axisX).style("opacity",0).call(Fg):(yj.select("."+g.axisY).style("opacity",0).call(Gg),yj.select("."+g.axisY2).style("opacity",0).call(Hg)),p(),T(),rf(),o(!1),nf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Ii){if(Ri&&"string"==typeof Ji){for(Ji=ye(Ji),e=0;e0){d=[];for(var f in Ng)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Pd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ne,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function kf(a){je(Kf.data.targets)||$g&&(Ui=a,yj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Vi=!0,hh())}function lf(){je(Kf.data.targets)||$g&&(yj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),yj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Vi=!1,ih())}function mf(a,b){"grid"===b&&a.each(function(){var a=Jf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function nf(a,c){var d,e,f,h,i,j,k,l,m,n,o,p,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,O,P,Q,R,S,T,U,V,W=$d(),X=je(Kf.data.targets),Y=Jc(Kf.data.targets);if(a=a||{},C=He(a,"withY",!0),D=He(a,"withSubchart",!0),E=He(a,"withTransition",!0),H=He(a,"withTransform",!1),I=He(a,"withUpdateXDomain",!1),J=He(a,"withUpdateOrgXDomain",!1),K=He(a,"withLegend",!1),F=He(a,"withTransitionForExit",E),G=He(a,"withTransitionForAxis",E),Q=E?$f:0,R=F?Q:0,S=G?Q:0,c=c||sf(S),K&&mh&&Ef(Ec(Kf.data.targets),a,c),Si&&0===Y.length&&zg.domain([0,dj.x.selectAll(".tick").size()]),Y.length&&(J&&(zg.domain(Jf.extent(bc(Y))),Dj=zg.domain(),Tf&&vj.scale(zg).updateScaleExtent(),Cg.domain(zg.domain()),rj.scale(Cg)),I&&(zg.domain(rj.empty()?Dj:rj.extent()),Tf&&vj.scale(zg).updateScaleExtent()),Dh||!Ch&&!Bh||(T=Lc(Kc(Y),Bh),Fg.tickValues(T),Ig.tickValues(T))),Ag.domain(Zb(Y,"y")),Bg.domain(Zb(Y,"y2")),dj.x.style("opacity",X?0:1),dj.y.style("opacity",X?0:1),dj.y2.style("opacity",X?0:1),dj.subx.style("opacity",X?0:1),c.axisX.call(Fg),c.axisY.call(Gg),c.axisY2.call(Hg),c.axisSubX.call(Ig),Gb(E),I&&Y.length)if(zh&&T){for(U=1;U=0&&Jf.select(this).style("display",b%V?"none":"block")})}else wj.selectAll("."+g.axisX+" .tick text").style("display","block");!sh&&Eh&&hb(dj.x,c.axisX,Eh),L=$e(W),O=_e(W,!0),P=_e(W,!1),Dg.domain(Ag.domain()),Eg.domain(Bg.domain()),Bj.style("display","none"),q(),yj.select("line."+g.xgridFocus).style("visibility","hidden"),bi&&(f=Xd(ci,zg),z=Si?Fg.tickOffset():0,e=sh?{x1:0,x2:cg,y1:function(a){return zg(a)-z},y2:function(a){return zg(a)-z}}:{x1:function(a){return zg(a)+z},x2:function(a){return zg(a)+z},y1:_f.top,y2:eg},d=yj.select("."+g.xgrids).selectAll("."+g.xgrid).data(f),d.enter().append("line").attr("class",g.xgrid),d.attr(e).style("opacity",function(){return+Jf.select(this).attr(sh?"y1":"x1")===(sh?eg:0)?0:1}),d.exit().remove()),De(di)&&(h=yj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(di),i=h.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),i.append("line").style("opacity",0),i.append("text").attr("text-anchor","end").attr("transform",sh?"":"rotate(-90)").attr("dx",sh?0:-_f.top).attr("dy",-5).style("opacity",0),h.select("line").transition().duration(Q).attr("x1",sh?0:Hd).attr("x2",sh?cg:Hd).attr("y1",sh?Hd:_f.top).attr("y2",sh?Hd:eg).style("opacity",1),h.select("text").transition().duration(Q).attr("x",sh?cg:0).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),h.exit().transition().duration(Q).style("opacity",0).remove()),C&&ei&&(j=yj.select("."+g.ygrids).selectAll("."+g.ygrid).data(Ag.ticks(gi)),j.enter().append("line").attr("class",g.ygrid),j.attr("x1",sh?Ag:0).attr("x2",sh?Ag:cg).attr("y1",sh?0:Ag).attr("y2",sh?eg:Ag),j.exit().remove(),mf(j,"grid")),C&&De(fi)&&(k=yj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(fi),l=k.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",sh?"rotate(-90)":"").attr("dx",sh?0:-_f.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(Q).attr("x1",sh?Id:0).attr("x2",sh?Id:cg).attr("y1",sh?0:Id).attr("y2",sh?eg:Id).style("opacity",1),k.select("text").transition().duration(Q).attr("x",sh?0:cg).attr("y",Id).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(Q).style("opacity",0).remove()),s=yj.select("."+g.regions).selectAll("."+g.region).data(Di),s.enter().append("g").attr("class",id).append("rect").style("fill-opacity",0),s.selectAll("rect").transition().duration(Q).attr("x",gc).attr("y",hc).attr("width",ic).attr("height",jc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(Q).style("fill-opacity",0).remove(),p=yj.selectAll("."+g.bars).selectAll("."+g.bar).data(te),p.enter().append("path").attr("class",cd).style("stroke","none").style("fill",$i),p.style("opacity",ud).transition().duration(Q).attr("d",L).style("fill",$i).style("opacity",1),p.exit().transition().duration(R).style("opacity",0).remove(),m=yj.selectAll("."+g.lines).selectAll("."+g.line).data(re),m.enter().append("path").attr("class",$c).style("stroke",$i),m.style("opacity",ud).transition().duration(Q).attr("d",sj).style("stroke",$i).style("opacity",1),m.exit().transition().duration(R).style("opacity",0).remove(),n=yj.selectAll("."+g.areas).selectAll("."+g.area).data(re),n.enter().append("path").attr("class",gd).style("fill",$i).style("opacity",function(){return Ej=+Jf.select(this).style("opacity"),0}),n.style("opacity",0).transition().duration(Q).attr("d",tj).style("fill",$i).style("opacity",Ej),n.exit().transition().duration(R).style("opacity",0).remove(),o=yj.selectAll("."+g.circles).selectAll("."+g.circle).data(ue),o.enter().append("circle").attr("class",ad).attr("r",Re).style("fill",$i),o.style("opacity",ud).transition().duration(Q).style("opacity",wd).style("fill",$i).attr("cx",sh?Zd:Yd).attr("cy",sh?Yd:Zd),o.exit().remove(),t=yj.selectAll("."+g.texts).selectAll("."+g.text).data(ve),t.enter().append("text").attr("class",Wc).attr("text-anchor",function(a){return sh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",$i).style("fill-opacity",0),t.text(function(a){return Fd(a.id)(a.value,a.id)}).style("fill-opacity",vd).transition().duration(Q).attr("x",O).attr("y",P).style("fill",$i).style("fill-opacity",xd),t.exit().transition().duration(R).style("fill-opacity",0).remove(),r=yj.selectAll("."+g.arcs).selectAll("."+g.arc).data(se),r.enter().append("path").attr("class",ed).style("fill",function(a){return $i(a.data)}).style("cursor",function(a){return ah(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Yi||(c=Hb(a),d=Nb(c),e=Vb(),Pb(c.data.id),Af(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Hb(a),c=Nb(b),d=[c];Td(d,Jf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Yi||(c=Hb(a),d=Nb(c),e=Wb(),Qb(c.data.id),Bf(),Ud(),e(d,b))}).on("click",function(a,b){var c=Hb(a),d=Nb(c),e=Ub();hf(this,a,b),e(d,b)}),r.attr("transform",H?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Yi=!0}).transition().duration(Q).attrTween("d",function(a){var b,c=Hb(a);return c?(b=Jf.interpolate(this._current,c),this._current=b(0),function(a){return Kb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",H?"scale(1)":"").style("fill",function(a){return $i(a.data)}).style("opacity",1).call(Ge,function(){Yi=!1}),r.exit().transition().duration(R).style("opacity",0).remove(),yj.selectAll("."+g.chartArc).select("text").attr("transform",Lb).style("opacity",0).transition().duration(Q).text(Ob).style("opacity",function(a){return Hc(a.data.id)&&qe(a.data)?1:0}),yj.select("."+g.chartArcsTitle).style("opacity",ie(Kf.data.targets)?1:0),jh&&(Jf.event&&"zoom"===Jf.event.type&&rj.extent(zg.orgDomain()).update(),D&&(!sh&&Eh&&hb(dj.subx,c.axisSubX,Eh),rj.empty()||rj.extent(zg.orgDomain()).update(),M=$e(W,!0),v=zj.selectAll("."+g.bars).selectAll("."+g.bar).data(te),v.enter().append("path").attr("class",cd).style("stroke","none").style("fill",$i),v.style("opacity",ud).transition().duration(Q).attr("d",M).style("opacity",1),v.exit().transition().duration(Q).style("opacity",0).remove(),u=zj.selectAll("."+g.lines).selectAll("."+g.line).data(re),u.enter().append("path").attr("class",$c).style("stroke",$i),u.style("opacity",ud).transition().duration(Q).attr("d",uj).style("opacity",1),u.exit().transition().duration(Q).style("opacity",0).remove())),yj.selectAll("."+g.selectedCircles).filter(function(a){return me(a)}).selectAll("circle").remove(),yj.selectAll("."+g.selectedCircle).transition().duration(Q).attr("cx",sh?Zd:Yd).attr("cy",sh?Yd:Zd),w=yj.select("."+g.eventRects),De(Kg)&&!qc(Kg)?(w.classed(g.eventRectsMultiple)||w.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),x=yj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),gf(x.enter()),x.attr("x",0).attr("y",0).attr("width",cg).attr("height",eg)):(w.classed(g.eventRectsSingle)||w.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Ti&&!Si?(B=function(a,b){var c=zc(b),d=Ac(b),e=Kf.data.xs[a.id][b];return(zg(d?d:e+50)-zg(c?c:e-50))/2},A=function(a,b){var c=zc(b),d=Kf.data.xs[a.id][b];return(zg(d)+zg(c?c:d-50))/2}):(B=N(),A=function(a){return zg(a.x)-B/2}),y=Cc(Kf.data.targets),yj.select("."+g.eventRects).datum(y?y.values:[]),x=yj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),ff(x.enter()),x.attr("class",jd).attr("x",sh?0:A).attr("y",sh?A:0).attr("width",sh?cg:B).attr("height",sh?B:eg),x.exit().remove()),Ec(Kf.data.targets).forEach(function(a){Fj[a]=!0})}function of(){nf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function pf(){if(0!==Jc(Kf.data.targets).length){if("mousemove"===Jf.event.sourceEvent.type&&vj.altDomain)return zg.domain(vj.altDomain),void vj.scale(zg).updateScaleExtent();Si&&zg.orgDomain()[0]===Dj[0]&&zg.domain([Dj[0]-1e-10,zg.orgDomain()[1]]),nf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Jf.event.sourceEvent.type&&(Wi=!0)}}function qf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function rf(){wj.attr("width",gg).attr("height",hg),wj.select("#"+Li).select("rect").attr("width",cg).attr("height",eg),wj.select("#"+Mi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),wj.select("#"+Ni).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),wj.select("."+g.zoomRect).attr("width",cg).attr("height",eg),Cj.style("max-height",hg+"px")}function sf(a){return{axisX:a?dj.x.transition().duration(a):dj.x,axisY:a?dj.y.transition().duration(a):dj.y,axisY2:a?dj.y2.transition().duration(a):dj.y2,axisSubX:a?dj.subx.transition().duration(a):dj.subx}}function tf(a){var b;a=a||{},a.withTransition=He(a,"withTransition",!0),a.withTransform=He(a,"withTransform",!1),a.withLegend=He(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withLegend&&mh||(b=sf(a.withTransition?$f:0),p(),T(),rf(),o(a.withTransition,b)),nf(a,b)}function uf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=yj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",ld),j=i.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Xc),e=yj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",nd),d=e.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",dd).style("cursor",function(a){return ah(a)?"pointer":null}),c=yj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",md),b=c.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",_c),b.append("g").attr("class",hd),b.append("g").attr("class",function(a){return Vc(g.selectedCircles,a.id)}),b.append("g").attr("class",bd).style("cursor",function(a){return ah(a)?"pointer":null}),a.forEach(function(a){yj.selectAll("."+g.selectedCircles+pd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=yj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(qg(a)).attr("class",od),f=h.enter().append("g").attr("class",od),f.append("g").attr("class",fd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),jh&&(n=zj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",nd),m=n.enter().append("g").style("opacity",0).attr("class",nd),m.append("g").attr("class",dd),l=zj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",md),k=l.enter().append("g").style("opacity",0).attr("class",md),k.append("g").attr("class",_c)),wj.selectAll("."+g.target).filter(function(a){return Hc(a.id)}).transition().duration($f).style("opacity",1)}function vf(a,b){b.filter&&(a=a.filter(b.filter)),(b.type||b.types)&&a.forEach(function(a){b.types?de(a.id,b.types[a.id]):de(a.id,b.type)}),Kf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,z=0,F++)),E[a]=F,D[F]=f,A[a]=z,z+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+v)/10),j=10*Math.ceil((h.height+u)/10),k=jj?j:i,l=jj?S():R();return d&&(z=0,F=0,w=0,x=0),mh&&!Ic(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=i,C[c]=j,(!w||i>=w)&&(w=i),(!x||j>=x)&&(x=j),g=jj?x:w,void(rh?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(l-g*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=26,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=Aj.selectAll("."+g.legendItemFocused).size();b=b||{},n=He(b,"withTransition",!0),q=He(b,"withTransitionForTransform",!0),jj?(f=function(a){return w*E[a]},j=function(a){return D[E[a]]+A[a]}):(f=function(a){return D[E[a]]+A[a]},j=function(a){return x*E[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=Aj.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Vc(g.legendItem,a)}).style("visibility",function(a){return Ic(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof oh?oh(a):Kf.toggle(a)}).on("mouseover",function(a){Jf.select(this).classed(g.legendItemFocused,!0),Yi||Kf.focus(a),"function"==typeof ph&&ph(a)}).on("mouseout",function(a){Jf.select(this).classed(g.legendItemFocused,!1),Yi||Kf.revert(),"function"==typeof qh&&qh(a)}),m.append("text").text(function(a){return d(Ng[a])?Ng[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",jj?h:-200).attr("y",jj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",jj?i:-200).attr("y",jj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",$i).attr("x",jj?h:-200).attr("y",jj?-200:j).attr("width",10).attr("height",10),r=Aj.selectAll("text").data(a).text(function(a){return d(Ng[a])?Ng[a]:a}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=Aj.selectAll("rect."+g.legendItemEvent).data(a),(n?s.transition():s).attr("width",function(a){return B[a]}).attr("height",function(a){return C[a]}).attr("x",i).attr("y",l),t=Aj.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",$i).attr("x",f).attr("y",j),Aj.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Hc(a)}).transition().style("opacity",function(a){var b=Jf.select(this);return Hc(a)?!G||b.classed(g.legendItemFocused)?yf(b):zf(b):nj}),P(w),Q(x),O(F),p(),T(),rf(),o(q,c)}function Ff(a){return Gc(Kf.data.targets,a.id)}function Gf(a){return"data"in a&&Gc(Kf.data.targets,a.data.id)}function Hf(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 If(a,b,c){var d=!je(Kf.data.targets);Yi=!1,de(a,b),tf(c||{withTransitionForAxis:d})}var Jf=a.d3?a.d3:a.require?a.require("d3"):void 0,Kf={data:{},axis:{},legend:{}},Lf={},Mf=i(["bindto"],"#chart"),Nf=i(["size","width"]),Of=i(["size","height"]),Pf=i(["padding","left"],50),Qf=i(["padding","right"],0),Rf=i(["padding","top"],0),Sf=i(["padding","bottom"],0),Tf=i(["zoom","enabled"],!1),Uf=i(["zoom","extent"]),Vf=i(["zoom","privileged"],!1),Wf=i(["onenter"],function(){}),Xf=i(["onleave"],function(){}),Yf=i(["onresize"],function(){}),Zf=i(["onresized"],function(){}),$f=i(["transition","duration"],350);h("data","data is required in config");var _f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg=i(["data","x"]),Kg=i(["data","xs"],{}),Lg=i(["data","x_format"]),Mg=i(["data","id_converter"],function(a){return a}),Ng=i(["data","names"],{}),Og=i(["data","classes"],{}),Pg=i(["data","groups"],[]),Qg=i(["data","axes"],{}),Rg=i(["data","type"]),Sg=i(["data","types"],{}),Tg=i(["data","labels"],{}),Ug=i(["data","order"]),Vg=i(["data","regions"],{}),Wg=i(["data","color"]),Xg=i(["data","colors"],{}),Yg=i(["data","hide"],!1),Zg=i(["data","filter"]),$g=i(["data","selection","enabled"],!1),_g=i(["data","selection","grouped"],!1),ah=i(["data","selection","isselectable"],function(){return!0}),bh=i(["data","selection","multiple"],!0),ch=i(["data","onclick"],function(){}),dh=i(["data","onenter"],function(){}),eh=i(["data","onleave"],function(){}),fh=i(["data","onselected"],function(){}),gh=i(["data","onunselected"],function(){}),hh=i(["data","ondragstart"],function(){}),ih=i(["data","ondragend"],function(){}),jh=i(["subchart","show"],!1),kh=i(["subchart","size","height"],60),lh=i(["color","pattern"],[]),mh=i(["legend","show"],!0),nh=i(["legend","position"],"bottom"),oh=i(["legend","item","onclick"]),ph=i(["legend","item","onmouseover"]),qh=i(["legend","item","onmouseout"]),rh=i(["legend","equally"],!1),sh=i(["axis","rotated"],!1),th=i(["axis","x","show"],!0),uh=i(["axis","x","type"],"indexed"),vh=i(["axis","x","localtime"],!0),wh=i(["axis","x","categories"],[]),xh=i(["axis","x","tick","centered"],!1),yh=i(["axis","x","tick","format"]),zh=i(["axis","x","tick","culling"],{}),Ah=i(["axis","x","tick","culling","max"],10),Bh=i(["axis","x","tick","count"]),Ch=i(["axis","x","tick","fit"],!0),Dh=i(["axis","x","tick","values"],null),Eh=i(["axis","x","tick","rotate"]),Fh=i(["axis","x","max"],null),Gh=i(["axis","x","min"],null),Hh=i(["axis","x","padding"],{}),Ih=i(["axis","x","height"]),Jh=i(["axis","x","default"]),Kh=i(["axis","x","label"],{}),Lh=i(["axis","y","show"],!0),Mh=i(["axis","y","max"]),Nh=i(["axis","y","min"]),Oh=i(["axis","y","center"]),Ph=i(["axis","y","label"],{}),Qh=i(["axis","y","inner"],!1),Rh=i(["axis","y","tick","format"]),Sh=i(["axis","y","padding"]),Th=i(["axis","y","ticks"],10),Uh=i(["axis","y2","show"],!1),Vh=i(["axis","y2","max"]),Wh=i(["axis","y2","min"]),Xh=i(["axis","y2","center"]),Yh=i(["axis","y2","label"],{}),Zh=i(["axis","y2","inner"],!1),$h=i(["axis","y2","tick","format"]),_h=i(["axis","y2","padding"]),ai=i(["axis","y2","ticks"],10),bi=i(["grid","x","show"],!1),ci=i(["grid","x","type"],"tick"),di=i(["grid","x","lines"],[]),ei=i(["grid","y","show"],!1),fi=i(["grid","y","lines"],[]),gi=i(["grid","y","ticks"],10),hi=i(["point","show"],!0),ii=i(["point","r"],2.5),ji=i(["point","focus","line","enabled"],!0),ki=i(["point","focus","expand","enabled"],!0),li=i(["point","focus","expand","r"]),mi=i(["point","focus","select","r"]),ni=i(["line","connect_null"],!1),oi=i(["bar","width"]),pi=i(["bar","width","ratio"],.6),qi=i(["pie","label","show"],!0),ri=i(["pie","label","format"]),si=i(["pie","expand"],!0),ti=i(["pie","onclick"],function(){}),ui=i(["pie","onmouseover"],function(){}),vi=i(["pie","onmouseout"],function(){}),wi=i(["donut","label","show"],!0),xi=i(["donut","label","format"]),yi=i(["donut","expand"],!0),zi=i(["donut","title"],""),Ai=i(["donut","onclick"],function(){}),Bi=i(["donut","onmouseover"],function(){}),Ci=i(["donut","onmouseout"],function(){}),Di=i(["regions"],[]),Ei=i(["tooltip","show"],!0),Fi=i(["tooltip","format","title"]),Gi=i(["tooltip","format","value"]),Hi=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Fi?Fi:b,l=Gi?Gi:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Ii=i(["tooltip","init","show"],!1),Ji=i(["tooltip","init","x"],0),Ki=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Li=("string"==typeof Mf?Mf.replace("#",""):Mf.id)+"-clip",Mi=Li+"-xaxis",Ni=Li+"-yaxis",Oi=j(Li),Pi=j(Mi),Qi=j(Ni),Ri="timeseries"===uh,Si="categorized"===uh,Ti=!Ri&&(Jg||De(Kg)),Ui=null,Vi=!1,Wi=!1,Xi=!1,Yi=!1,Zi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],$i=xe(Xg,De(lh)?lh:Zi,Wg),_i=vh?Jf.time.format:Jf.time.format.utc,aj=_i.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),bj=[],cj=[],dj={},ej=sh?"left":"bottom",fj=sh?Qh?"top":"bottom":Qh?"right":"left",gj=sh?Zh?"bottom":"top":Zh?"left":"right",hj=sh?"left":"bottom",ij={main:function(){return"translate("+k(_f.left)+","+k(_f.top)+")"},context:function(){return"translate("+k(ag.left)+","+k(ag.top)+")"},legend:function(){return"translate("+bg.left+","+bg.top+")"},x:function(){return"translate(0,"+(sh?0:eg)+")"},y:function(){return"translate(0,"+(sh?eg:0)+")"},y2:function(){return"translate("+(sh?0:cg)+","+(sh?1:0)+")" -},subx:function(){return"translate(0,"+(sh?0:fg)+")"},arc:function(){return"translate("+lg/2+","+mg/2+")"}},jj="right"===nh,kj=0,lj=0,mj=0,nj=.15,oj=30,pj=sh&&!th?0:30,qj=5;qg=Jf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var rj,sj=function(){var a=Jf.svg.line().x(sh?function(a){return Y(a.id)(a.value)}:Gd).y(sh?Gd:function(a){return Y(a.id)(a.value)});return ni||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ni?Qe(b.values):b.values;return ke(b)?(a.interpolate(le(b)?"cardinal":"linear"),Vg[b.id]?df(e,zg,Y(b.id),Vg[b.id]):a(e)):(c=e[0]?zg(e[0].x):0,d=e[0]?Y(b.id)(e[0].value):0,sh?"M "+d+" "+c:"M "+c+" "+d)}}(),tj=function(){var a;return a=sh?Jf.svg.area().x0(function(a){return Y(a.id)(0)}).x1(function(a){return Y(a.id)(a.value)}).y(Gd):Jf.svg.area().x(Gd).y0(function(a){return Y(a.id)(0)}).y1(function(a){return Y(a.id)(a.value)}),function(b){var c,d,e=Qe(b.values);return ee([b],"area")||ee([b],"area-spline")?(a.interpolate(le(b)?"cardinal":"linear"),a(e)):(c=e[0]?zg(e[0].x):0,d=e[0]?Y(b.id)(e[0].value):0,sh?"M "+d+" "+c:"M "+c+" "+d)}}(),uj=function(){var a=Jf.svg.line().x(sh?function(a){return Z(a.id)(a.value)}:Jd).y(sh?Jd:function(a){return Z(a.id)(a.value)});return function(b){var c=Qe(b.values);return ke(b)?a(c):"M "+Cg(c[0].x)+" "+Z(b.id)(c[0].value)}}(),vj=function(){};rj=Jf.svg.brush().on("brush",of),rj.update=function(){return zj&&zj.select("."+g.brush).call(this),this},rj.scale=function(a){return sh?this.y(a):this.x(a)},Tf&&(vj=Jf.behavior.zoom().on("zoomstart",function(){vj.altDomain=Jf.event.sourceEvent.altKey?zg.orgDomain():null}).on("zoom",Tf?pf:null),vj.scale=function(a){return sh?this.y(a):this.x(a)},vj.orgScaleExtent=function(){var a=Uf?Uf:[1,10];return[a[0],Math.max(Bc()/a[1],a[1])]},vj.updateScaleExtent=function(){var a=cc(zg.orgDomain())/cc(Dj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var wj,xj,yj,zj,Aj,Bj,Cj,Dj,Ej,Fj={};if(Kf.focus=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",1)}var c=wj.selectAll(qd(a)),d=c.filter(Ff),e=c.filter(Gf);Kf.revert(),Kf.defocus(),b(d.classed(g.focused,!0)),b(e),je(Kf.data.targets)&&Pb(a,!0),Af(a,!0)},Kf.defocus=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",.3)}var c=wj.selectAll(qd(a)),d=c.filter(Ff),e=c.filter(Gf);Kf.revert(),b(d.classed(g.focused,!1)),b(e),je(Kf.data.targets)&&Qb(a),Af(a,!1)},Kf.revert=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",1)}var c=wj.selectAll(qd(a)),d=c.filter(Ff),e=c.filter(Gf);b(d.classed(g.focused,!1)),b(e),je(Kf.data.targets)&&Qb(a),Bf()},Kf.show=function(a,b){a=Fc(a),b=b||{},Nc(a),wj.selectAll(rd(a)).transition().style("opacity",1),b.withLegend&&Cf(a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Kf.hide=function(a,b){a=Fc(a),b=b||{},Mc(a),wj.selectAll(rd(a)).transition().style("opacity",0),b.withLegend&&Df(a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Kf.toggle=function(a){Hc(a)?Kf.hide(a):Kf.show(a)},Kf.unzoom=function(){rj.clear().update(),nf({withUpdateXDomain:!0})},Kf.load=function(a){return a.xs&&pc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Og[b]=a.classes[b]}),"categories"in a&&Si&&(wh=a.categories,Fg.categories(wh)),"cacheIds"in a&&dc(a.cacheIds)?void vf(fc(a.cacheIds),a.done):void("unload"in a?xf(Fc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){wf(a)}):wf(a))},Kf.unload=function(a,b){xf(Fc(a),function(){nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Kf.selected=function(a){return Jf.merge(yj.selectAll("."+g.shapes+pd(a)).selectAll("."+g.shape).filter(function(){return Jf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Kf.select=function(a,b,c){$g&&yj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Jf.select(this),i=e.data?e.data.id:e.id,j=Pe(this),k=_g||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);"path"!==this.nodeName&&(k&&l?ah(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},Kf.unselect=function(a,b){$g&&yj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Jf.select(this),f=c.data?c.data.id:c.id,h=Pe(this),i=_g||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);"path"!==this.nodeName&&i&&j&&ah(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Kf.toLine=function(a){If(a,"line")},Kf.toSpline=function(a){If(a,"spline")},Kf.toBar=function(a){If(a,"bar")},Kf.toScatter=function(a){If(a,"scatter")},Kf.toArea=function(a){If(a,"area")},Kf.toAreaSpline=function(a){If(a,"area-spline")},Kf.toPie=function(a){If(a,"pie",{withTransform:!0})},Kf.toDonut=function(a){If(a,"donut",{withTransform:!0})},Kf.groups=function(a){return c(a)?Pg:(Pg=a,nf(),Pg)},Kf.xgrids=function(a){return a?(di=a,nf(),di):di},Kf.xgrids.add=function(a){return a?Kf.xgrids(di.concat(a)):void 0},Kf.xgrids.remove=function(a){var b=Hf(a);return Kf.xgrids(di.filter(b))},Kf.ygrids=function(a){return a?(fi=a,nf(),fi):fi},Kf.ygrids.add=function(a){return a?Kf.ygrids(fi.concat(a)):void 0},Kf.ygrids.remove=function(a){var b=Hf(a);return Kf.ygrids(fi.filter(b))},Kf.regions=function(a){return c(a)?Di:(Di=a,nf(),Di)},Kf.regions.add=function(a){return c(a)?Di:(Di=Di.concat(a),nf(),Di)},Kf.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;wj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Di=Di.filter(function(b){return b.classes.indexOf(a)<0})}),Di},Kf.data.get=function(a){var b=Kf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Kf.data.getAsTarget=function(a){var b=Kf.data.targets.filter(function(b){return b.id===a});return b.length>0?b[0]:void 0},Kf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Ng[b]=a[b]}),nf({withLegend:!0}),Ng):Ng},Kf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Xg[b]=a[b]}),nf({withLegend:!0}),Xg):Xg},Kf.x=function(a){return arguments.length&&(sc(Kf.data.targets,a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Kf.data.xs},Kf.xs=function(a){return arguments.length&&(tc(Kf.data.targets,a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Kf.data.xs},Kf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){eb(b,a[b])}),Gb())},Kf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Fh=+a.x),b(a.y)&&(Mh=+a.y),b(a.y2)&&(Vh=+a.y2)):Mh=Vh=+a,nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Kf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Gh=+a.x),b(a.y)&&(Nh=+a.y),b(a.y2)&&(Wh=+a.y2)):Nh=Wh=+a,nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Kf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Kf.axis.max(a.max),"undefined"!=typeof a.min&&Kf.axis.min(a.min))},Kf.legend.show=function(a){Cf(Fc(a)),nf({withLegend:!0})},Kf.legend.hide=function(a){Df(Fc(a)),nf({withLegend:!0})},Kf.resize=function(a){Nf=a?a.width:null,Of=a?a.height:null,tf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Kf.destroy=function(){Kf.data.targets=void 0,Kf.data.xs={},Cj.html(""),a.onresize=null},"url"in f.data)Jf.xhr(f.data.url,function(a,b){var c,d=Jf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Jf.csv.parse(b.response),ef(c)});else if("rows"in f.data)ef(vc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");ef(wc(f.data.columns))}return Kf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(window); \ No newline at end of file +return"M"+b(i)+" "+e(k(d))+" "+b(j)+" "+e(k(d+f))}:function(a,c,d,f){return"M"+b(j(d),!0)+" "+e(k(d))+" "+b(j(d+f),!0)+" "+e(k(d+f))},g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function ef(b){var c,d,e;if(Cj=Jf.select(Mf),Cj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Cj.html("").classed("c3",!0),Kf.data.xs={},Kf.data.targets=xc(b),Zg&&(Kf.data.targets=Kf.data.targets.filter(Zg)),Yg&&Mc(Yg===!0?Ec(Kf.data.targets):Yg),p(),T(),zg.domain(Jf.extent(bc(Kf.data.targets))),Ag.domain(Zb(Kf.data.targets,"y")),Bg.domain(Zb(Kf.data.targets,"y2")),Cg.domain(zg.domain()),Dg.domain(Ag.domain()),Eg.domain(Bg.domain()),Dj=zg.domain(),rj.scale(Cg),Tf&&vj.scale(zg),wj=Cj.append("svg").on("mouseenter",Wf).on("mouseleave",Xf),xj=wj.append("defs"),xj.append("clipPath").attr("id",Li).append("rect"),xj.append("clipPath").attr("id",Mi).append("rect"),xj.append("clipPath").attr("id",Ni).append("rect"),rf(),yj=wj.append("g").attr("transform",ij.main),zj=wj.append("g").attr("transform",ij.context),Aj=wj.append("g").attr("transform",ij.legend),jh||zj.style("visibility","hidden"),mh||(Aj.style("visibility","hidden"),cj=Ec(Kf.data.targets)),Bj=Jf.select(Mf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Ef(Ec(Kf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=yj.append("g").attr("clip-path",Oi).attr("class",g.grid),bi&&d.append("g").attr("class",g.xgrids),De(di)&&d.append("g").attr("class",g.xgridLines),ji&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),ei&&d.append("g").attr("class",g.ygrids),De(fi)&&d.append("g").attr("class",g.ygridLines),yj.append("g").attr("clip-path",Oi).attr("class",g.regions),yj.append("g").attr("clip-path",Oi).attr("class",g.chart),c=yj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Tf?sh?"ns-resize":"ew-resize":null),yj.select("."+g.chart).append("g").attr("class",g.chartBars),yj.select("."+g.chart).append("g").attr("class",g.chartLines),yj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",ij.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Tb()),yj.select("."+g.chart).append("g").attr("class",g.chartTexts),Tf&&yj.insert("rect",Vf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",cg).attr("height",eg).style("opacity",0).style("cursor",sh?"ns-resize":"ew-resize").call(vj).on("dblclick.zoom",null),Jh&&rj.extent("function"!=typeof Jh?Jh:Jh(bc())),dj.x=yj.append("g").attr("class",g.axisX).attr("clip-path",Pi).attr("transform",ij.x).style("visibility",th?"visible":"hidden"),dj.x.append("text").attr("class",g.axisXLabel).attr("transform",sh?"rotate(-90)":"").style("text-anchor",Cb),dj.y=yj.append("g").attr("class",g.axisY).attr("clip-path",Qi).attr("transform",ij.y).style("visibility",Lh?"visible":"hidden"),dj.y.append("text").attr("class",g.axisYLabel).attr("transform",sh?"":"rotate(-90)").style("text-anchor",Db),dj.y2=yj.append("g").attr("class",g.axisY2).attr("transform",ij.y2).style("visibility",Uh?"visible":"hidden"),dj.y2.append("text").attr("class",g.axisY2Label).attr("transform",sh?"":"rotate(-90)").style("text-anchor",Eb),zj.append("g").attr("clip-path",Oi).attr("class",g.chart),zj.select("."+g.chart).append("g").attr("class",g.chartBars),zj.select("."+g.chart).append("g").attr("class",g.chartLines),zj.append("g").attr("clip-path",Oi).attr("class",g.brush).call(rj).selectAll("rect").attr(sh?"width":"height",sh?dg:fg),dj.subx=zj.append("g").attr("class",g.axisX).attr("transform",ij.subx).attr("clip-path",sh?"":Pi),uf(Kf.data.targets),sh?yj.select("."+g.axisX).style("opacity",0).call(Fg):(yj.select("."+g.axisY).style("opacity",0).call(Gg),yj.select("."+g.axisY2).style("opacity",0).call(Hg)),p(),T(),rf(),o(!1),nf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Ii){if(Ri&&"string"==typeof Ji){for(Ji=ye(Ji),e=0;e0){d=[];for(var f in Ng)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Pd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ne,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function kf(a){je(Kf.data.targets)||$g&&(Ui=a,yj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Vi=!0,hh())}function lf(){je(Kf.data.targets)||$g&&(yj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),yj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Vi=!1,ih())}function mf(a,b){"grid"===b&&a.each(function(){var a=Jf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function nf(a,c){var d,e,f,h,i,j,k,l,m,n,o,p,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,O,P,Q,R,S,T,U,V,W=$d(),X=je(Kf.data.targets),Y=Jc(Kf.data.targets);if(a=a||{},C=He(a,"withY",!0),D=He(a,"withSubchart",!0),E=He(a,"withTransition",!0),H=He(a,"withTransform",!1),I=He(a,"withUpdateXDomain",!1),J=He(a,"withUpdateOrgXDomain",!1),K=He(a,"withLegend",!1),F=He(a,"withTransitionForExit",E),G=He(a,"withTransitionForAxis",E),Q=E?$f:0,R=F?Q:0,S=G?Q:0,c=c||sf(S),K&&mh&&Ef(Ec(Kf.data.targets),a,c),Si&&0===Y.length&&zg.domain([0,dj.x.selectAll(".tick").size()]),Y.length&&(J&&(zg.domain(Jf.extent(bc(Y))),Dj=zg.domain(),Tf&&vj.scale(zg).updateScaleExtent(),Cg.domain(zg.domain()),rj.scale(Cg)),I&&(zg.domain(rj.empty()?Dj:rj.extent()),Tf&&vj.scale(zg).updateScaleExtent()),Dh||!Ch&&!Bh||(T=Lc(Kc(Y),Bh),Fg.tickValues(T),Ig.tickValues(T))),Ag.domain(Zb(Y,"y")),Bg.domain(Zb(Y,"y2")),dj.x.style("opacity",X?0:1),dj.y.style("opacity",X?0:1),dj.y2.style("opacity",X?0:1),dj.subx.style("opacity",X?0:1),c.axisX.call(Fg),c.axisY.call(Gg),c.axisY2.call(Hg),c.axisSubX.call(Ig),Gb(E),I&&Y.length)if(zh&&T){for(U=1;U=0&&Jf.select(this).style("display",b%V?"none":"block")})}else wj.selectAll("."+g.axisX+" .tick text").style("display","block");!sh&&Eh&&hb(dj.x,c.axisX,Eh),L=$e(W),O=_e(W,!0),P=_e(W,!1),Dg.domain(Ag.domain()),Eg.domain(Bg.domain()),Bj.style("display","none"),q(),yj.select("line."+g.xgridFocus).style("visibility","hidden"),bi&&(f=Xd(ci,zg),z=Si?Fg.tickOffset():0,e=sh?{x1:0,x2:cg,y1:function(a){return zg(a)-z},y2:function(a){return zg(a)-z}}:{x1:function(a){return zg(a)+z},x2:function(a){return zg(a)+z},y1:_f.top,y2:eg},d=yj.select("."+g.xgrids).selectAll("."+g.xgrid).data(f),d.enter().append("line").attr("class",g.xgrid),d.attr(e).style("opacity",function(){return+Jf.select(this).attr(sh?"y1":"x1")===(sh?eg:0)?0:1}),d.exit().remove()),De(di)&&(h=yj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(di),i=h.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),i.append("line").style("opacity",0),i.append("text").attr("text-anchor","end").attr("transform",sh?"":"rotate(-90)").attr("dx",sh?0:-_f.top).attr("dy",-5).style("opacity",0),h.select("line").transition().duration(Q).attr("x1",sh?0:Hd).attr("x2",sh?cg:Hd).attr("y1",sh?Hd:_f.top).attr("y2",sh?Hd:eg).style("opacity",1),h.select("text").transition().duration(Q).attr("x",sh?cg:0).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),h.exit().transition().duration(Q).style("opacity",0).remove()),C&&ei&&(j=yj.select("."+g.ygrids).selectAll("."+g.ygrid).data(Ag.ticks(gi)),j.enter().append("line").attr("class",g.ygrid),j.attr("x1",sh?Ag:0).attr("x2",sh?Ag:cg).attr("y1",sh?0:Ag).attr("y2",sh?eg:Ag),j.exit().remove(),mf(j,"grid")),C&&De(fi)&&(k=yj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(fi),l=k.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",sh?"rotate(-90)":"").attr("dx",sh?0:-_f.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(Q).attr("x1",sh?Id:0).attr("x2",sh?Id:cg).attr("y1",sh?0:Id).attr("y2",sh?eg:Id).style("opacity",1),k.select("text").transition().duration(Q).attr("x",sh?0:cg).attr("y",Id).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(Q).style("opacity",0).remove()),s=yj.select("."+g.regions).selectAll("."+g.region).data(Di),s.enter().append("g").attr("class",id).append("rect").style("fill-opacity",0),s.selectAll("rect").transition().duration(Q).attr("x",gc).attr("y",hc).attr("width",ic).attr("height",jc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(Q).style("opacity",0).remove(),p=yj.selectAll("."+g.bars).selectAll("."+g.bar).data(te),p.enter().append("path").attr("class",cd).style("stroke","none").style("fill",$i),p.style("opacity",ud).transition().duration(Q).attr("d",L).style("fill",$i).style("opacity",1),p.exit().transition().duration(R).style("opacity",0).remove(),m=yj.selectAll("."+g.lines).selectAll("."+g.line).data(re),m.enter().append("path").attr("class",$c).style("stroke",$i),m.style("opacity",ud).transition().duration(Q).attr("d",sj).style("stroke",$i).style("opacity",1),m.exit().transition().duration(R).style("opacity",0).remove(),n=yj.selectAll("."+g.areas).selectAll("."+g.area).data(re),n.enter().append("path").attr("class",gd).style("fill",$i).style("opacity",function(){return Ej=+Jf.select(this).style("opacity"),0}),n.style("opacity",0).transition().duration(Q).attr("d",tj).style("fill",$i).style("opacity",Ej),n.exit().transition().duration(R).style("opacity",0).remove(),o=yj.selectAll("."+g.circles).selectAll("."+g.circle).data(ue),o.enter().append("circle").attr("class",ad).attr("r",Re).style("fill",$i),o.style("opacity",ud).transition().duration(Q).style("opacity",wd).style("fill",$i).attr("cx",sh?Zd:Yd).attr("cy",sh?Yd:Zd),o.exit().remove(),t=yj.selectAll("."+g.texts).selectAll("."+g.text).data(ve),t.enter().append("text").attr("class",Wc).attr("text-anchor",function(a){return sh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",$i).style("fill-opacity",0),t.text(function(a){return Fd(a.id)(a.value,a.id)}).style("fill-opacity",vd).transition().duration(Q).attr("x",O).attr("y",P).style("fill",$i).style("fill-opacity",xd),t.exit().transition().duration(R).style("fill-opacity",0).remove(),r=yj.selectAll("."+g.arcs).selectAll("."+g.arc).data(se),r.enter().append("path").attr("class",ed).style("fill",function(a){return $i(a.data)}).style("cursor",function(a){return ah(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Yi||(c=Hb(a),d=Nb(c),e=Vb(),Pb(c.data.id),Af(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Hb(a),c=Nb(b),d=[c];Td(d,Jf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Yi||(c=Hb(a),d=Nb(c),e=Wb(),Qb(c.data.id),Bf(),Ud(),e(d,b))}).on("click",function(a,b){var c=Hb(a),d=Nb(c),e=Ub();hf(this,a,b),e(d,b)}),r.attr("transform",H?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Yi=!0}).transition().duration(Q).attrTween("d",function(a){var b,c=Hb(a);return c?(b=Jf.interpolate(this._current,c),this._current=b(0),function(a){return Kb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",H?"scale(1)":"").style("fill",function(a){return $i(a.data)}).style("opacity",1).call(Ge,function(){Yi=!1}),r.exit().transition().duration(R).style("opacity",0).remove(),yj.selectAll("."+g.chartArc).select("text").attr("transform",Lb).style("opacity",0).transition().duration(Q).text(Ob).style("opacity",function(a){return Hc(a.data.id)&&qe(a.data)?1:0}),yj.select("."+g.chartArcsTitle).style("opacity",ie(Kf.data.targets)?1:0),jh&&(Jf.event&&"zoom"===Jf.event.type&&rj.extent(zg.orgDomain()).update(),D&&(!sh&&Eh&&hb(dj.subx,c.axisSubX,Eh),rj.empty()||rj.extent(zg.orgDomain()).update(),M=$e(W,!0),v=zj.selectAll("."+g.bars).selectAll("."+g.bar).data(te),v.enter().append("path").attr("class",cd).style("stroke","none").style("fill",$i),v.style("opacity",ud).transition().duration(Q).attr("d",M).style("opacity",1),v.exit().transition().duration(Q).style("opacity",0).remove(),u=zj.selectAll("."+g.lines).selectAll("."+g.line).data(re),u.enter().append("path").attr("class",$c).style("stroke",$i),u.style("opacity",ud).transition().duration(Q).attr("d",uj).style("opacity",1),u.exit().transition().duration(Q).style("opacity",0).remove())),yj.selectAll("."+g.selectedCircles).filter(function(a){return me(a)}).selectAll("circle").remove(),yj.selectAll("."+g.selectedCircle).transition().duration(Q).attr("cx",sh?Zd:Yd).attr("cy",sh?Yd:Zd),w=yj.select("."+g.eventRects),De(Kg)&&!qc(Kg)?(w.classed(g.eventRectsMultiple)||w.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),x=yj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),gf(x.enter()),x.attr("x",0).attr("y",0).attr("width",cg).attr("height",eg)):(w.classed(g.eventRectsSingle)||w.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Ti&&!Si?(B=function(a,b){var c=zc(b),d=Ac(b),e=Kf.data.xs[a.id][b];return(zg(d?d:e+50)-zg(c?c:e-50))/2},A=function(a,b){var c=zc(b),d=Kf.data.xs[a.id][b];return(zg(d)+zg(c?c:d-50))/2}):(B=N(),A=function(a){return zg(a.x)-B/2}),y=Cc(Kf.data.targets),yj.select("."+g.eventRects).datum(y?y.values:[]),x=yj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),ff(x.enter()),x.attr("class",jd).attr("x",sh?0:A).attr("y",sh?A:0).attr("width",sh?cg:B).attr("height",sh?B:eg),x.exit().remove()),Ec(Kf.data.targets).forEach(function(a){Fj[a]=!0})}function of(){nf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function pf(){if(0!==Jc(Kf.data.targets).length){if("mousemove"===Jf.event.sourceEvent.type&&vj.altDomain)return zg.domain(vj.altDomain),void vj.scale(zg).updateScaleExtent();Si&&zg.orgDomain()[0]===Dj[0]&&zg.domain([Dj[0]-1e-10,zg.orgDomain()[1]]),nf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Jf.event.sourceEvent.type&&(Wi=!0)}}function qf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function rf(){wj.attr("width",gg).attr("height",hg),wj.select("#"+Li).select("rect").attr("width",cg).attr("height",eg),wj.select("#"+Mi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),wj.select("#"+Ni).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),wj.select("."+g.zoomRect).attr("width",cg).attr("height",eg),Cj.style("max-height",hg+"px")}function sf(a){return{axisX:a?dj.x.transition().duration(a):dj.x,axisY:a?dj.y.transition().duration(a):dj.y,axisY2:a?dj.y2.transition().duration(a):dj.y2,axisSubX:a?dj.subx.transition().duration(a):dj.subx}}function tf(a){var b;a=a||{},a.withTransition=He(a,"withTransition",!0),a.withTransform=He(a,"withTransform",!1),a.withLegend=He(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withLegend&&mh||(b=sf(a.withTransition?$f:0),p(),T(),rf(),o(a.withTransition,b)),nf(a,b)}function uf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=yj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",ld),j=i.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Xc),e=yj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",nd),d=e.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",dd).style("cursor",function(a){return ah(a)?"pointer":null}),c=yj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",md),b=c.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",_c),b.append("g").attr("class",hd),b.append("g").attr("class",function(a){return Vc(g.selectedCircles,a.id)}),b.append("g").attr("class",bd).style("cursor",function(a){return ah(a)?"pointer":null}),a.forEach(function(a){yj.selectAll("."+g.selectedCircles+pd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=yj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(qg(a)).attr("class",od),f=h.enter().append("g").attr("class",od),f.append("g").attr("class",fd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),jh&&(n=zj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",nd),m=n.enter().append("g").style("opacity",0).attr("class",nd),m.append("g").attr("class",dd),l=zj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",md),k=l.enter().append("g").style("opacity",0).attr("class",md),k.append("g").attr("class",_c)),wj.selectAll("."+g.target).filter(function(a){return Hc(a.id)}).transition().duration($f).style("opacity",1)}function vf(a,b){b.filter&&(a=a.filter(b.filter)),(b.type||b.types)&&a.forEach(function(a){b.types?de(a.id,b.types[a.id]):de(a.id,b.type)}),Kf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,z=0,F++)),E[a]=F,D[F]=f,A[a]=z,z+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+v)/10),j=10*Math.ceil((h.height+u)/10),k=jj?j:i,l=jj?S():R();return d&&(z=0,F=0,w=0,x=0),mh&&!Ic(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=i,C[c]=j,(!w||i>=w)&&(w=i),(!x||j>=x)&&(x=j),g=jj?x:w,void(rh?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(l-g*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=26,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=Aj.selectAll("."+g.legendItemFocused).size();b=b||{},n=He(b,"withTransition",!0),q=He(b,"withTransitionForTransform",!0),jj?(f=function(a){return w*E[a]},j=function(a){return D[E[a]]+A[a]}):(f=function(a){return D[E[a]]+A[a]},j=function(a){return x*E[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=Aj.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Vc(g.legendItem,a)}).style("visibility",function(a){return Ic(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof oh?oh(a):Kf.toggle(a)}).on("mouseover",function(a){Jf.select(this).classed(g.legendItemFocused,!0),Yi||Kf.focus(a),"function"==typeof ph&&ph(a)}).on("mouseout",function(a){Jf.select(this).classed(g.legendItemFocused,!1),Yi||Kf.revert(),"function"==typeof qh&&qh(a)}),m.append("text").text(function(a){return d(Ng[a])?Ng[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",jj?h:-200).attr("y",jj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",jj?i:-200).attr("y",jj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",$i).attr("x",jj?h:-200).attr("y",jj?-200:j).attr("width",10).attr("height",10),r=Aj.selectAll("text").data(a).text(function(a){return d(Ng[a])?Ng[a]:a}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=Aj.selectAll("rect."+g.legendItemEvent).data(a),(n?s.transition():s).attr("width",function(a){return B[a]}).attr("height",function(a){return C[a]}).attr("x",i).attr("y",l),t=Aj.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",$i).attr("x",f).attr("y",j),Aj.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Hc(a)}).transition().style("opacity",function(a){var b=Jf.select(this);return Hc(a)?!G||b.classed(g.legendItemFocused)?yf(b):zf(b):nj}),P(w),Q(x),O(F),p(),T(),rf(),o(q,c)}function Ff(a){return Gc(Kf.data.targets,a.id)}function Gf(a){return"data"in a&&Gc(Kf.data.targets,a.data.id)}function Hf(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 If(a,b,c){var d=!je(Kf.data.targets);Yi=!1,de(a,b),tf(c||{withTransitionForAxis:d})}var Jf=a.d3?a.d3:a.require?a.require("d3"):void 0,Kf={data:{},axis:{},legend:{}},Lf={},Mf=i(["bindto"],"#chart"),Nf=i(["size","width"]),Of=i(["size","height"]),Pf=i(["padding","left"],50),Qf=i(["padding","right"],0),Rf=i(["padding","top"],0),Sf=i(["padding","bottom"],0),Tf=i(["zoom","enabled"],!1),Uf=i(["zoom","extent"]),Vf=i(["zoom","privileged"],!1),Wf=i(["onenter"],function(){}),Xf=i(["onleave"],function(){}),Yf=i(["onresize"],function(){}),Zf=i(["onresized"],function(){}),$f=i(["transition","duration"],350);h("data","data is required in config");var _f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg=i(["data","x"]),Kg=i(["data","xs"],{}),Lg=i(["data","x_format"]),Mg=i(["data","id_converter"],function(a){return a}),Ng=i(["data","names"],{}),Og=i(["data","classes"],{}),Pg=i(["data","groups"],[]),Qg=i(["data","axes"],{}),Rg=i(["data","type"]),Sg=i(["data","types"],{}),Tg=i(["data","labels"],{}),Ug=i(["data","order"]),Vg=i(["data","regions"],{}),Wg=i(["data","color"]),Xg=i(["data","colors"],{}),Yg=i(["data","hide"],!1),Zg=i(["data","filter"]),$g=i(["data","selection","enabled"],!1),_g=i(["data","selection","grouped"],!1),ah=i(["data","selection","isselectable"],function(){return!0}),bh=i(["data","selection","multiple"],!0),ch=i(["data","onclick"],function(){}),dh=i(["data","onenter"],function(){}),eh=i(["data","onleave"],function(){}),fh=i(["data","onselected"],function(){}),gh=i(["data","onunselected"],function(){}),hh=i(["data","ondragstart"],function(){}),ih=i(["data","ondragend"],function(){}),jh=i(["subchart","show"],!1),kh=i(["subchart","size","height"],60),lh=i(["color","pattern"],[]),mh=i(["legend","show"],!0),nh=i(["legend","position"],"bottom"),oh=i(["legend","item","onclick"]),ph=i(["legend","item","onmouseover"]),qh=i(["legend","item","onmouseout"]),rh=i(["legend","equally"],!1),sh=i(["axis","rotated"],!1),th=i(["axis","x","show"],!0),uh=i(["axis","x","type"],"indexed"),vh=i(["axis","x","localtime"],!0),wh=i(["axis","x","categories"],[]),xh=i(["axis","x","tick","centered"],!1),yh=i(["axis","x","tick","format"]),zh=i(["axis","x","tick","culling"],{}),Ah=i(["axis","x","tick","culling","max"],10),Bh=i(["axis","x","tick","count"]),Ch=i(["axis","x","tick","fit"],!0),Dh=i(["axis","x","tick","values"],null),Eh=i(["axis","x","tick","rotate"]),Fh=i(["axis","x","max"],null),Gh=i(["axis","x","min"],null),Hh=i(["axis","x","padding"],{}),Ih=i(["axis","x","height"]),Jh=i(["axis","x","default"]),Kh=i(["axis","x","label"],{}),Lh=i(["axis","y","show"],!0),Mh=i(["axis","y","max"]),Nh=i(["axis","y","min"]),Oh=i(["axis","y","center"]),Ph=i(["axis","y","label"],{}),Qh=i(["axis","y","inner"],!1),Rh=i(["axis","y","tick","format"]),Sh=i(["axis","y","padding"]),Th=i(["axis","y","ticks"],10),Uh=i(["axis","y2","show"],!1),Vh=i(["axis","y2","max"]),Wh=i(["axis","y2","min"]),Xh=i(["axis","y2","center"]),Yh=i(["axis","y2","label"],{}),Zh=i(["axis","y2","inner"],!1),$h=i(["axis","y2","tick","format"]),_h=i(["axis","y2","padding"]),ai=i(["axis","y2","ticks"],10),bi=i(["grid","x","show"],!1),ci=i(["grid","x","type"],"tick"),di=i(["grid","x","lines"],[]),ei=i(["grid","y","show"],!1),fi=i(["grid","y","lines"],[]),gi=i(["grid","y","ticks"],10),hi=i(["point","show"],!0),ii=i(["point","r"],2.5),ji=i(["point","focus","line","enabled"],!0),ki=i(["point","focus","expand","enabled"],!0),li=i(["point","focus","expand","r"]),mi=i(["point","focus","select","r"]),ni=i(["line","connect_null"],!1),oi=i(["bar","width"]),pi=i(["bar","width","ratio"],.6),qi=i(["pie","label","show"],!0),ri=i(["pie","label","format"]),si=i(["pie","expand"],!0),ti=i(["pie","onclick"],function(){}),ui=i(["pie","onmouseover"],function(){}),vi=i(["pie","onmouseout"],function(){}),wi=i(["donut","label","show"],!0),xi=i(["donut","label","format"]),yi=i(["donut","expand"],!0),zi=i(["donut","title"],""),Ai=i(["donut","onclick"],function(){}),Bi=i(["donut","onmouseover"],function(){}),Ci=i(["donut","onmouseout"],function(){}),Di=i(["regions"],[]),Ei=i(["tooltip","show"],!0),Fi=i(["tooltip","format","title"]),Gi=i(["tooltip","format","value"]),Hi=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Fi?Fi:b,l=Gi?Gi:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Ii=i(["tooltip","init","show"],!1),Ji=i(["tooltip","init","x"],0),Ki=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Li=("string"==typeof Mf?Mf.replace("#",""):Mf.id)+"-clip",Mi=Li+"-xaxis",Ni=Li+"-yaxis",Oi=j(Li),Pi=j(Mi),Qi=j(Ni),Ri="timeseries"===uh,Si="categorized"===uh,Ti=!Ri&&(Jg||De(Kg)),Ui=null,Vi=!1,Wi=!1,Xi=!1,Yi=!1,Zi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],$i=xe(Xg,De(lh)?lh:Zi,Wg),_i=vh?Jf.time.format:Jf.time.format.utc,aj=_i.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),bj=[],cj=[],dj={},ej=sh?"left":"bottom",fj=sh?Qh?"top":"bottom":Qh?"right":"left",gj=sh?Zh?"bottom":"top":Zh?"left":"right",hj=sh?"left":"bottom",ij={main:function(){return"translate("+k(_f.left)+","+k(_f.top)+")"},context:function(){return"translate("+k(ag.left)+","+k(ag.top)+")"},legend:function(){return"translate("+bg.left+","+bg.top+")"},x:function(){return"translate(0,"+(sh?0:eg)+")"},y:function(){return"translate(0,"+(sh?eg:0)+")"},y2:function(){return"translate("+(sh?0:cg)+","+(sh?1:0)+")" +},subx:function(){return"translate(0,"+(sh?0:fg)+")"},arc:function(){return"translate("+lg/2+","+mg/2+")"}},jj="right"===nh,kj=0,lj=0,mj=0,nj=.15,oj=30,pj=sh&&!th?0:30,qj=5;qg=Jf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var rj,sj=function(){var a=Jf.svg.line().x(sh?function(a){return Y(a.id)(a.value)}:Gd).y(sh?Gd:function(a){return Y(a.id)(a.value)});return ni||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ni?Qe(b.values):b.values;return ke(b)?(a.interpolate(le(b)?"cardinal":"linear"),Vg[b.id]?df(e,zg,Y(b.id),Vg[b.id]):a(e)):(c=e[0]?zg(e[0].x):0,d=e[0]?Y(b.id)(e[0].value):0,sh?"M "+d+" "+c:"M "+c+" "+d)}}(),tj=function(){var a;return a=sh?Jf.svg.area().x0(function(a){return Y(a.id)(0)}).x1(function(a){return Y(a.id)(a.value)}).y(Gd):Jf.svg.area().x(Gd).y0(function(a){return Y(a.id)(0)}).y1(function(a){return Y(a.id)(a.value)}),function(b){var c,d,e=Qe(b.values);return ee([b],"area")||ee([b],"area-spline")?(a.interpolate(le(b)?"cardinal":"linear"),a(e)):(c=e[0]?zg(e[0].x):0,d=e[0]?Y(b.id)(e[0].value):0,sh?"M "+d+" "+c:"M "+c+" "+d)}}(),uj=function(){var a=Jf.svg.line().x(sh?function(a){return Z(a.id)(a.value)}:Jd).y(sh?Jd:function(a){return Z(a.id)(a.value)});return function(b){var c=Qe(b.values);return ke(b)?a(c):"M "+Cg(c[0].x)+" "+Z(b.id)(c[0].value)}}(),vj=function(){};rj=Jf.svg.brush().on("brush",of),rj.update=function(){return zj&&zj.select("."+g.brush).call(this),this},rj.scale=function(a){return sh?this.y(a):this.x(a)},Tf&&(vj=Jf.behavior.zoom().on("zoomstart",function(){vj.altDomain=Jf.event.sourceEvent.altKey?zg.orgDomain():null}).on("zoom",Tf?pf:null),vj.scale=function(a){return sh?this.y(a):this.x(a)},vj.orgScaleExtent=function(){var a=Uf?Uf:[1,10];return[a[0],Math.max(Bc()/a[1],a[1])]},vj.updateScaleExtent=function(){var a=cc(zg.orgDomain())/cc(Dj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var wj,xj,yj,zj,Aj,Bj,Cj,Dj,Ej,Fj={};if(Kf.focus=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",1)}var c=wj.selectAll(qd(a)),d=c.filter(Ff),e=c.filter(Gf);Kf.revert(),Kf.defocus(),b(d.classed(g.focused,!0)),b(e),je(Kf.data.targets)&&Pb(a,!0),Af(a,!0)},Kf.defocus=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",.3)}var c=wj.selectAll(qd(a)),d=c.filter(Ff),e=c.filter(Gf);Kf.revert(),b(d.classed(g.focused,!1)),b(e),je(Kf.data.targets)&&Qb(a),Af(a,!1)},Kf.revert=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",1)}var c=wj.selectAll(qd(a)),d=c.filter(Ff),e=c.filter(Gf);b(d.classed(g.focused,!1)),b(e),je(Kf.data.targets)&&Qb(a),Bf()},Kf.show=function(a,b){a=Fc(a),b=b||{},Nc(a),wj.selectAll(rd(a)).transition().style("opacity",1),b.withLegend&&Cf(a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Kf.hide=function(a,b){a=Fc(a),b=b||{},Mc(a),wj.selectAll(rd(a)).transition().style("opacity",0),b.withLegend&&Df(a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Kf.toggle=function(a){Hc(a)?Kf.hide(a):Kf.show(a)},Kf.unzoom=function(){rj.clear().update(),nf({withUpdateXDomain:!0})},Kf.load=function(a){return a.xs&&pc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Og[b]=a.classes[b]}),"categories"in a&&Si&&(wh=a.categories,Fg.categories(wh)),"cacheIds"in a&&dc(a.cacheIds)?void vf(fc(a.cacheIds),a.done):void("unload"in a?xf(Fc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){wf(a)}):wf(a))},Kf.unload=function(a,b){xf(Fc(a),function(){nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Kf.selected=function(a){return Jf.merge(yj.selectAll("."+g.shapes+pd(a)).selectAll("."+g.shape).filter(function(){return Jf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Kf.select=function(a,b,c){$g&&yj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Jf.select(this),i=e.data?e.data.id:e.id,j=Pe(this),k=_g||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);"path"!==this.nodeName&&(k&&l?ah(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},Kf.unselect=function(a,b){$g&&yj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Jf.select(this),f=c.data?c.data.id:c.id,h=Pe(this),i=_g||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);"path"!==this.nodeName&&i&&j&&ah(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Kf.toLine=function(a){If(a,"line")},Kf.toSpline=function(a){If(a,"spline")},Kf.toBar=function(a){If(a,"bar")},Kf.toScatter=function(a){If(a,"scatter")},Kf.toArea=function(a){If(a,"area")},Kf.toAreaSpline=function(a){If(a,"area-spline")},Kf.toPie=function(a){If(a,"pie",{withTransform:!0})},Kf.toDonut=function(a){If(a,"donut",{withTransform:!0})},Kf.groups=function(a){return c(a)?Pg:(Pg=a,nf(),Pg)},Kf.xgrids=function(a){return a?(di=a,nf(),di):di},Kf.xgrids.add=function(a){return a?Kf.xgrids(di.concat(a)):void 0},Kf.xgrids.remove=function(a){var b=Hf(a);return Kf.xgrids(di.filter(b))},Kf.ygrids=function(a){return a?(fi=a,nf(),fi):fi},Kf.ygrids.add=function(a){return a?Kf.ygrids(fi.concat(a)):void 0},Kf.ygrids.remove=function(a){var b=Hf(a);return Kf.ygrids(fi.filter(b))},Kf.regions=function(a){return a?(Di=a,nf(),Di):Di},Kf.regions.add=function(a){return a?(Di=Di.concat(a),nf(),Di):Di},Kf.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;wj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Di=Di.filter(function(b){return b.classes.indexOf(a)<0})}),Di},Kf.data.get=function(a){var b=Kf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Kf.data.getAsTarget=function(a){var b=Kf.data.targets.filter(function(b){return b.id===a});return b.length>0?b[0]:void 0},Kf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Ng[b]=a[b]}),nf({withLegend:!0}),Ng):Ng},Kf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Xg[b]=a[b]}),nf({withLegend:!0}),Xg):Xg},Kf.x=function(a){return arguments.length&&(sc(Kf.data.targets,a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Kf.data.xs},Kf.xs=function(a){return arguments.length&&(tc(Kf.data.targets,a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Kf.data.xs},Kf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){eb(b,a[b])}),Gb())},Kf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Fh=+a.x),b(a.y)&&(Mh=+a.y),b(a.y2)&&(Vh=+a.y2)):Mh=Vh=+a,nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Kf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Gh=+a.x),b(a.y)&&(Nh=+a.y),b(a.y2)&&(Wh=+a.y2)):Nh=Wh=+a,nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Kf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Kf.axis.max(a.max),"undefined"!=typeof a.min&&Kf.axis.min(a.min))},Kf.legend.show=function(a){Cf(Fc(a)),nf({withLegend:!0})},Kf.legend.hide=function(a){Df(Fc(a)),nf({withLegend:!0})},Kf.resize=function(a){Nf=a?a.width:null,Of=a?a.height:null,tf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Kf.destroy=function(){Kf.data.targets=void 0,Kf.data.xs={},Cj.html(""),a.onresize=null},"url"in f.data)Jf.xhr(f.data.url,function(a,b){var c,d=Jf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Jf.csv.parse(b.response),ef(c)});else if("rows"in f.data)ef(vc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");ef(wc(f.data.columns))}return Kf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(window); \ No newline at end of file From 0a76177401cd84eb946e89d89000c21981ddcd5d Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Fri, 9 May 2014 13:19:59 +0900 Subject: [PATCH 153/178] Fix transition of transformTo --- c3.js | 2 +- c3.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/c3.js b/c3.js index ef7273e..457b939 100644 --- a/c3.js +++ b/c3.js @@ -3648,7 +3648,7 @@ options.withTransitionForExit = false; // MEMO: called in updateLegend in redraw if withLegend if (!(options.withLegend && __legend_show)) { - transitions = generateAxisTransitions(options.withTransition ? __transition_duration : 0); + transitions = generateAxisTransitions(options.withTransitionForAxis ? __transition_duration : 0); // Update sizes and scales updateSizes(); updateScales(); diff --git a/c3.min.js b/c3.min.js index 5c5da82..9d3346b 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ !function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.ceil(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.ceil(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&acg&&(cg=0),0>eg&&(eg=0),dg=sh?_f.left-oj-pj:cg,fg=sh?eg:hg-ag.top-ag.bottom,0>dg&&(dg=0),0>fg&&(fg=0),lg=cg-(jj?b+10:0),mg=eg-(jj?0:10),r(),jj&&d&&(bg.left=lg/2+1.1*jg)}function q(){yj.select("line."+g.xgridFocus).attr("x1",sh?0:-10).attr("x2",sh?cg:-10).attr("y1",sh?-10:_f.top).attr("y2",sh?-10:eg)}function r(){jg=Math.min(lg,mg)/2,ig=.95*jg,kg=ie(Kf.data.targets)?.6*ig:0}function s(){var a=sh?g.axisX:g.axisY,b=yj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Jf.select(Mf).node().getBoundingClientRect(),e=je(Kf.data.targets),f=c.right-d.left-(e?0:v());return f>0?f:0}function t(){return Nf?Nf:z()}function u(){var a=Of?Of:A();return a>0?a:320}function v(){var a=1;return Pf?Pf:sh?th?x("x"):a:!Lh||Qh?a:x("y")}function w(){var a=1;return Qf?Qf:jj?R()+20+(Uh&&!sh?x("y2"):a):Uh?Zh||sh?a:x("y2"):a}function x(a){var b=mb(a);return b.isInner?20+Fb(a):40+Fb(a)}function y(a){return"x"!==a||th?"x"===a&&Ih?Ih:"y"!==a||Lh?"y2"!==a||Uh?(mb(a).isInner?30:40)+("y2"===a?-10:0):qj:mh&&!jj?10:1:0}function z(){return+Jf.select(Mf).style("width").replace("px","")}function A(){return+Jf.select(Mf).style("height").replace("px","")}function B(a){return a?-31:-(_f.left-1)}function C(a){return a?-20:-4}function D(){return B(!sh)}function E(){return C(!sh)}function F(){return B(sh)}function G(){return C(sh)}function H(a){return a?cg+2+30+30:_f.left+20}function I(a){return a?(Ih?Ih:0)+80:eg+8}function J(){return H(!sh)}function K(){return I(!sh)}function L(){return H(sh)}function M(){return I(sh)}function N(){var a,b,c,d,e,f=Cc(Kf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=zg(b.x)-zg(a.x),0===c?sh?eg:cg:(d=Bc(),e=fe(Kf.data.targets)?(d-(Si?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function O(a){kj=a}function P(a){lj=a}function Q(a){mj=a}function R(){return mh?jj?lj*(kj+1):gg:0}function S(){return mh?jj?hg:mj*(kj+1):0}function T(){var a,b,c=!zg;rg=sh?1:0,sg=sh?eg:cg,tg=sh?0:eg,ug=sh?cg:1,vg=rg,wg=sg,xg=sh?0:fg,yg=sh?dg:1,zg=W(rg,sg,c?void 0:zg.domain(),function(){return Fg.tickOffset()}),Ag=X(tg,ug,c?void 0:Ag.domain()),Bg=X(tg,ug,c?void 0:Bg.domain()),Cg=W(rg,sg,Dj,function(a){return a%1?0:Ig.tickOffset()}),Dg=X(xg,yg,c?void 0:Dg.domain()),Eg=X(xg,yg,c?void 0:Eg.domain()),a=bb(),b=Dh?Dh:c?void 0:Fg.tickValues(),Fg=$(zg,ej,a,b),Ig=$(Cg,hj,a,b),Gg=_(Ag,fj,Rh,Th),Hg=_(Bg,gj,$h,ai),c||(rj.scale(Cg),Tf&&vj.scale(zg)),U()}function U(){ng=Ib(),og=Jb(),pg=Jb(.98)}function V(a,b,c){return(c?Jf.time.scale():Jf.scale.linear()).range([a,b])}function W(a,b,c,d){var e,f=V(a,b,Ri),g=c?f.domain(c):f;Si?(d=d||function(){return 0},f=function(a,b){var c=g(a)+d(a);return b?c:Math.ceil(c)}):f=function(a,b){var c=g(a);return b?c:Math.ceil(c)};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return Dj&&Dj[0]===a[0]&&Dj[1]a?a.toFixed(0):a};return yh&&("function"==typeof yh?a=yh:Ri&&(a=function(a){return a?_i(yh)(a):""})),a}function cb(a){var b;return"y"===a?b=Ph:"y2"===a?b=Yh:"x"===a&&(b=Kh),b}function db(a){var b=cb(a);return"string"==typeof b?b:b?b.text:null}function eb(a,b){var c=cb(a);"string"==typeof c?"y"===a?Ph=b:"y2"===a?Yh=b:"x"===a&&(Kh=b):c&&(c.text=b)}function fb(a){return 10*Math.sin(Math.PI*(a/180))}function gb(a){return 11.5-2.5*(a/15)}function hb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",gb(c)).attr("x",fb(c)).attr("transform","rotate("+c+")")}function ib(a,b){var c=cb(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 jb(){return ib("x",sh?"inner-top":"inner-right")}function kb(){return ib("y",sh?"inner-right":"inner-top")}function lb(){return ib("y2",sh?"inner-right":"inner-top")}function mb(a){return"y2"===a?lb():"y"===a?kb():jb()}function nb(){return db("x")}function ob(){return db("y")}function pb(){return db("y2")}function qb(a,b){return a?b.isLeft?0:b.isCenter?cg/2:cg:b.isBottom?-eg:b.isMiddle?-eg/2:0}function rb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function sb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function tb(){return qb(!sh,jb())}function ub(){return qb(sh,kb())}function vb(){return qb(sh,lb())}function wb(){return rb(!sh,jb())}function xb(){return rb(sh,kb())}function yb(){return rb(sh,lb())}function zb(){var a=jb();return sh?a.isInner?"1.2em":-25-Fb("x"):a.isInner?"-0.5em":Ih?Ih-10:"3em"}function Ab(){var a=kb();return sh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Fb("y")}function Bb(){var a=lb();return sh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Fb("y2")}function Cb(){return sb(!sh,jb())}function Db(){return sb(sh,kb())}function Eb(){return sb(sh,lb())}function Fb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Jf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Gb(a){var b=yj.select("."+g.axisX+" ."+g.axisXLabel),c=yj.select("."+g.axisY+" ."+g.axisYLabel),d=yj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",tb).attr("dx",wb).attr("dy",zb).text(nb),(a?c.transition():c).attr("x",ub).attr("dx",xb).attr("dy",Ab).attr("dy",Ab).text(ob),(a?d.transition():d).attr("x",vb).attr("dx",yb).attr("dy",Bb).text(pb)}function Hb(a){var b=!1;return qg(Jc(Kf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Ib(){var a=Jf.svg.arc().outerRadius(ig).innerRadius(kg),b=function(b,c){var d;return c?a(b):(d=Hb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Jb(a){var b=Jf.svg.arc().outerRadius(jg*(a?a:1)).innerRadius(kg);return function(a){var c=Hb(a);return c?b(c):"M 0 0"}}function Kb(a,b){return qe(a.data)?ng(a,b):"M 0 0"}function Lb(a){var b,c,d,e,f=Hb(a),g="";return f&&(b=ng.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*ig*.8+","+d/e*ig*.8+")"),g}function Mb(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Nb(a){return rc({id:a.data.id,value:a.value,ratio:Mb(a)})}function Ob(a){var b,c,d,e;return Rb()?(b=Hb(a),c=b?b.value:null,d=Mb(b),e=Sb(),e?e(c,d):Ed(c,d)):""}function Pb(a,b){var c=wj.selectAll("."+g.chartArc+qd(a)),d=wj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});we(a)&&c.selectAll("path").transition().duration(50).attr("d",og).transition().duration(100).attr("d",pg).each(function(a){pe(a.data)}),b||d.style("opacity",.3)}function Qb(a){var b=wj.selectAll("."+g.chartArc+qd(a));b.selectAll("path").transition().duration(50).attr("d",ng),wj.selectAll("."+g.arc).style("opacity",1)}function Rb(){return ie(Kf.data.targets)?wi:qi}function Sb(){return ie(Kf.data.targets)?xi:ri}function Tb(){return ie(Kf.data.targets)?zi:""}function Ub(){var a=ie(Kf.data.targets)?Ai:ti;return"function"==typeof a?a:function(){}}function Vb(){var a=ie(Kf.data.targets)?Bi:ui;return"function"==typeof a?a:function(){}}function Wb(){var a=ie(Kf.data.targets)?Ci:vi;return"function"==typeof a?a:function(){}}function Xb(a){var b,c,d,e,f,g,h=Ec(a),i=Qc(a);if(Pg.length>0)for(g=Sc(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 Jf.min(Object.keys(i).map(function(a){return Jf.min(i[a])}))}function Yb(a){var b,c,d,e,f,g,h=Ec(a),i=Qc(a);if(Pg.length>0)for(g=Tc(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 Jf.max(Object.keys(i).map(function(a){return Jf.max(i[a])}))}function Zb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return ab(a.id)===c}),m="y2"===c?Wh:Nh,n="y2"===c?Vh:Mh,o=b(m)?m:Xb(l),p=b(n)?n:Yb(l),q="y2"===c?Xh:Oh,r=yd()&&sh;return 0===l.length?"y2"===c?Bg.domain():Ag.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=zd(o,p),j=cc(Ag.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Sh&&(f=b(Sh.top)?Sh.top:e,g=b(Sh.bottom)?Sh.bottom:e),"y2"===c&&_h&&(f=b(_h.top)?_h.top:e,g=b(_h.bottom)?_h.bottom:e),fe(l)&&!Sc(l)&&(g=o),[o-g,p+f])}function $b(a){return Gh?Ri?ye(Gh):Gh:Jf.min(a,function(a){return Jf.min(a.values,function(a){return a.x})})}function _b(a){return Fh?Ri?ye(Fh):Fh:Jf.max(a,function(a){return Jf.max(a.values,function(a){return a.x})})}function ac(a){var c,d,e,f,g=Dc(a),h=g[1]-g[0];return Si?d=0:fe(a)?(c=Bc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Hh&&De(Hh)?(e=b(Hh.left)?Hh.left:d,f=b(Hh.right)?Hh.right:d):e=f="number"==typeof Hh?Hh:d,{left:e,right:f}}function bc(a){var b=[$b(a),_b(a)],c=b[0],d=b[1],e=ac(a),f=0,g=0;return c-d!==0||Si||(c=Ri?new Date(.5*c.getTime()):-.5,d=Ri?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Ri?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Ri?new Date(d.getTime()+e.right):d+e.right),[f,g]}function cc(a){return a[1]-a[0]}function dc(a){for(var b=0;bb?0:b-c}function jc(a){var b,c=hc(a),d="y"===a.axis?Ag:Bg;return b="y"===a.axis||"y2"===a.axis?sh?eg:"start"in a?d(a.start):eg:sh?"end"in a?zg(Ri?ye(a.end):a.end):eg:eg,c>b?0:b-c}function kc(a){return Jg&&a===Jg||De(Kg)&&Ee(Kg,a)}function lc(a){return!kc(a)}function mc(a){return Jg?Jg:De(Kg)?Kg[a]:null}function nc(a,b){var c,d=b&&De(b)?Ec(b):[];return d.forEach(function(b){mc(b)===a&&(c=Kf.data.xs[b])}),c}function oc(a,b){return a in Kf.data.xs&&Kf.data.xs[a]&&Kf.data.xs[a][b]?Kf.data.xs[a][b]:b}function pc(a){Object.keys(a).forEach(function(b){Kg[b]=a[b]})}function qc(a){return 1===Jf.set(Object.keys(a).map(function(b){return a[b]})).size()}function rc(a){var b;return a&&(b=Ng[a.id],a.name=b?b:a.id),a}function sc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=uc(b[d],a.id,d)}),Kf.data.xs[a.id]=b})}function tc(a,b){a.forEach(function(a){b[a.id]&&sc([a],b[a.id])})}function uc(a,c,d){var e;return e=Ri?a?a instanceof Date?a:ye(a):ye(oc(c,d)):Ti&&!Si?b(a)?+a:oc(c,d):d}function vc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Kf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Jg?(d=Object.keys(Kf.data.xs),Kf.data.xs[c]=d.length>0?Kf.data.xs[d[0]]:void 0):De(Kg)&&(Kf.data.xs[c]=nc(f,Kf.data.targets)):Kf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Kf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Mg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=mc(b),g=a[f],h=uc(g,b,e);return Ti&&Si&&0===c&&g&&(0===e&&(wh=[]),wh.push(g)),("undefined"==typeof a[b]||Kf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Rg&&de(Ec(c).filter(function(a){return!(a in Sg)}),Rg),c.forEach(function(a){ec(a.id_org,a)}),c}function yc(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 zc(a){return a>0&&Kf.data.targets[0].values[a-1]?Kf.data.targets[0].values[a-1].x:void 0}function Ac(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Dc(a){var b,c,d=Cc(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Ec(a){return a.map(function(a){return a.id})}function Fc(a){return a?"string"==typeof a?[a]:a:Ec(Kf.data.targets)}function Gc(a,b){var c,d=Ec(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Ri?new Date(i):i);j.push(e)}return Ri||(j=j.sort(function(a,b){return a-b})),j}function Mc(a){bj=bj.concat(a)}function Nc(a){bj=bj.filter(function(b){return a.indexOf(b)<0})}function Oc(a){cj=cj.concat(a)}function Pc(a){cj=cj.filter(function(b){return a.indexOf(b)<0})}function Qc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Rc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Tc(a){return Rc(a,function(a){return a>0})}function Uc(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||0===a[f].x)&&(e=e.concat(Kd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Kd(a,g))),Nd(e,b)):Ld(a,b,f,g)}function Md(a,b){var c;return c=a.map(function(a){return Ld(a.values,b)}),Nd(c,b)}function Nd(a,b){var c,d;return a.forEach(function(a){var e=Fe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Od(a,b){return Jf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Pd(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 Qd(){return Ug&&"desc"===Ug.toLowerCase()}function Rd(){return Ug&&"asc"===Ug.toLowerCase()}function Sd(a){var b=Rd(),c=Qd();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 Ug&&a.sort(Ug),a}function Td(a,c){var d,e,f,g,h,i,j,k=je(Kf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&Ei&&(Bj.html(Hi(a,bb(),Ad(k),$i)).style("display","block"),d=Bj.property("offsetWidth"),e=Bj.property("offsetHeight"),k?(g=cg/2+c[0],i=eg/2+c[1]+20):(sh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-w(),i=zg(l[0].x)+20):(f=s(),g=f+v()+zg(l[0].x)+20,h=g+d,j=f+t()-w(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),Bj.style("top",i+"px").style("left",g+"px"))}function Ud(){Bj.style("display","none")}function Vd(a){var c=a.filter(function(a){return a&&b(a.value)});if(Ei&&!ge(Kf.data.targets)&&!je(Kf.data.targets)){var d=yj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(sh?"y1":"x1",Gd).attr(sh?"y2":"x2",Gd),mf(d,"grid")}}function Wd(){yj.select("line."+g.xgridFocus).style("visibility","hidden")}function Xd(a,b){var c,d,e,f,h=[],i=yj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=bc(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function Yd(a){return a.x||0===a.x?zg(a.x):null}function Zd(a){return Y(a.id)(a.value)}function $d(){var a,b,d={},e=0;return Jc(Kf.data.targets.filter(me)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ce(a,b){return"number"==typeof oi?oi:b?2*a.tickOffset()*pi/b:0}function de(a,b){Fc(a).forEach(function(a){Fj[a]=b===Sg[a],Sg[a]=b})}function ee(a,b){var c=!1;return a.forEach(function(a){Sg[a.id]===b&&(c=!0),a.id in Sg||"line"!==b||(c=!0)}),c}function fe(a){return ee(a,"bar")}function ge(a){return ee(a,"scatter")}function he(a){return ee(a,"pie")}function ie(a){return ee(a,"donut")}function je(a){return he(a)||ie(a)}function ke(a){var b="string"==typeof a?a:a.id;return!(b in Sg)||"line"===Sg[b]||"spline"===Sg[b]||"area"===Sg[b]||"area-spline"===Sg[b]}function le(a){var b="string"==typeof a?a:a.id;return"spline"===Sg[b]||"area-spline"===Sg[b]}function me(a){var b="string"==typeof a?a:a.id;return"bar"===Sg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"scatter"===Sg[b]}function oe(a){var b="string"==typeof a?a:a.id;return"pie"===Sg[b]}function pe(a){var b="string"==typeof a?a:a.id;return"donut"===Sg[b]}function qe(a){return oe(a)||pe(a)}function re(a){return ke(a)?[a]:[]}function se(a){return qe(a.data)?[a]:[]}function te(a){return me(a)?a.values:[]}function ue(a){return ke(a)||ne(a)?a.values:[]}function ve(a){return me(a)||ke(a)?a.values:[]}function we(a){return pe(a)&&yi||oe(a)&&si}function xe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ye(b){var c;try{c=Lg?Jf.time.format(Lg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Lg)}return c}function ze(a,b){var c=Jf.mouse(a),d=Jf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ee(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Fe(a,b){var c="y"===ab(a.id)?Ag:Bg,d=sh?1:0,e=sh?0:1;return Math.pow(zg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ge(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function He(a,b,c){return d(a[b])?a[b]:c}function Ie(a,b,c){fh(b,a.node()),yj.select("."+g.selectedCircles+pd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Vc(g.selectedCircle,c)}).attr("cx",sh?Zd:Yd).attr("cy",sh?Yd:Zd).attr("stroke",function(){return $i(b)}).attr("r",1.4*Te(b)).transition().duration(100).attr("r",Te)}function Je(a,b,c){gh(b,a.node()),yj.select("."+g.selectedCircles+pd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ke(a,b,c,d){a?Ie(b,c,d):Je(b,c,d)}function Le(a,b){fh(b,a.node()),a.transition().duration(100).style("fill",function(){return Jf.rgb($i(b)).brighter(.75)})}function Me(a,b){gh(b,a.node()),a.transition().duration(100).style("fill",function(){return $i(b)})}function Ne(a,b,c,d){a?Le(b,c,d):Me(b,c,d)}function Oe(a,b,c,d){Ne(a,b,c.data,d)}function Pe(a){return"circle"===a.nodeName?Ke:Jf.select(a).classed(g.bar)?Ne:Oe}function Qe(a){return a.filter(function(a){return b(a.value)})}function Re(a){return hi?"function"==typeof ii?ii(a):ii:0}function Se(a){return ki?li?li:1.75*Re(a):Re(a)}function Te(a){return mi?mi:4*Re(a)}function Ue(a,c){return(c?yj.selectAll("."+g.circles+pd(c)):yj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ve(a,b){Ue(a,b).classed(g.EXPANDED,!0).attr("r",Se)}function We(a){Ue(a).filter(function(){return Jf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Re)}function Xe(a){return yj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function Ye(a){Xe(a).classed(g.EXPANDED,!0)}function Ze(a){Xe(a).classed(g.EXPANDED,!1)}function $e(a,b){var c=cf(a,b);return function(a,b){var d=c(a,b),e=sh?1:0,f=sh?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 _e(a,b){var c=cf(a,!1),d=b?af:bf;return function(a,b){return d(c(a,b),a,this)}}function af(a,b){var c;return sh?(c=me(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function bf(a,b,c){var d=c.getBoundingClientRect();return sh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:me(b)?-3:-6)}function cf(a,b){var c=a.__max__+1,d=ce(Fg,c),e=_d(d,c,a,!!b),f=ae(!!b),g=be(a,!!b),h=b?Z:Y;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return sh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function df(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function ef(b){var c,d,e;if(Cj=Jf.select(Mf),Cj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Cj.html("").classed("c3",!0),Kf.data.xs={},Kf.data.targets=xc(b),Zg&&(Kf.data.targets=Kf.data.targets.filter(Zg)),Yg&&Mc(Yg===!0?Ec(Kf.data.targets):Yg),p(),T(),zg.domain(Jf.extent(bc(Kf.data.targets))),Ag.domain(Zb(Kf.data.targets,"y")),Bg.domain(Zb(Kf.data.targets,"y2")),Cg.domain(zg.domain()),Dg.domain(Ag.domain()),Eg.domain(Bg.domain()),Dj=zg.domain(),rj.scale(Cg),Tf&&vj.scale(zg),wj=Cj.append("svg").on("mouseenter",Wf).on("mouseleave",Xf),xj=wj.append("defs"),xj.append("clipPath").attr("id",Li).append("rect"),xj.append("clipPath").attr("id",Mi).append("rect"),xj.append("clipPath").attr("id",Ni).append("rect"),rf(),yj=wj.append("g").attr("transform",ij.main),zj=wj.append("g").attr("transform",ij.context),Aj=wj.append("g").attr("transform",ij.legend),jh||zj.style("visibility","hidden"),mh||(Aj.style("visibility","hidden"),cj=Ec(Kf.data.targets)),Bj=Jf.select(Mf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Ef(Ec(Kf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=yj.append("g").attr("clip-path",Oi).attr("class",g.grid),bi&&d.append("g").attr("class",g.xgrids),De(di)&&d.append("g").attr("class",g.xgridLines),ji&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),ei&&d.append("g").attr("class",g.ygrids),De(fi)&&d.append("g").attr("class",g.ygridLines),yj.append("g").attr("clip-path",Oi).attr("class",g.regions),yj.append("g").attr("clip-path",Oi).attr("class",g.chart),c=yj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Tf?sh?"ns-resize":"ew-resize":null),yj.select("."+g.chart).append("g").attr("class",g.chartBars),yj.select("."+g.chart).append("g").attr("class",g.chartLines),yj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",ij.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Tb()),yj.select("."+g.chart).append("g").attr("class",g.chartTexts),Tf&&yj.insert("rect",Vf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",cg).attr("height",eg).style("opacity",0).style("cursor",sh?"ns-resize":"ew-resize").call(vj).on("dblclick.zoom",null),Jh&&rj.extent("function"!=typeof Jh?Jh:Jh(bc())),dj.x=yj.append("g").attr("class",g.axisX).attr("clip-path",Pi).attr("transform",ij.x).style("visibility",th?"visible":"hidden"),dj.x.append("text").attr("class",g.axisXLabel).attr("transform",sh?"rotate(-90)":"").style("text-anchor",Cb),dj.y=yj.append("g").attr("class",g.axisY).attr("clip-path",Qi).attr("transform",ij.y).style("visibility",Lh?"visible":"hidden"),dj.y.append("text").attr("class",g.axisYLabel).attr("transform",sh?"":"rotate(-90)").style("text-anchor",Db),dj.y2=yj.append("g").attr("class",g.axisY2).attr("transform",ij.y2).style("visibility",Uh?"visible":"hidden"),dj.y2.append("text").attr("class",g.axisY2Label).attr("transform",sh?"":"rotate(-90)").style("text-anchor",Eb),zj.append("g").attr("clip-path",Oi).attr("class",g.chart),zj.select("."+g.chart).append("g").attr("class",g.chartBars),zj.select("."+g.chart).append("g").attr("class",g.chartLines),zj.append("g").attr("clip-path",Oi).attr("class",g.brush).call(rj).selectAll("rect").attr(sh?"width":"height",sh?dg:fg),dj.subx=zj.append("g").attr("class",g.axisX).attr("transform",ij.subx).attr("clip-path",sh?"":Pi),uf(Kf.data.targets),sh?yj.select("."+g.axisX).style("opacity",0).call(Fg):(yj.select("."+g.axisY).style("opacity",0).call(Gg),yj.select("."+g.axisY2).style("opacity",0).call(Hg)),p(),T(),rf(),o(!1),nf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Ii){if(Ri&&"string"==typeof Ji){for(Ji=ye(Ji),e=0;e0){d=[];for(var f in Ng)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Pd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ne,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function kf(a){je(Kf.data.targets)||$g&&(Ui=a,yj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Vi=!0,hh())}function lf(){je(Kf.data.targets)||$g&&(yj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),yj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Vi=!1,ih())}function mf(a,b){"grid"===b&&a.each(function(){var a=Jf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function nf(a,c){var d,e,f,h,i,j,k,l,m,n,o,p,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,O,P,Q,R,S,T,U,V,W=$d(),X=je(Kf.data.targets),Y=Jc(Kf.data.targets);if(a=a||{},C=He(a,"withY",!0),D=He(a,"withSubchart",!0),E=He(a,"withTransition",!0),H=He(a,"withTransform",!1),I=He(a,"withUpdateXDomain",!1),J=He(a,"withUpdateOrgXDomain",!1),K=He(a,"withLegend",!1),F=He(a,"withTransitionForExit",E),G=He(a,"withTransitionForAxis",E),Q=E?$f:0,R=F?Q:0,S=G?Q:0,c=c||sf(S),K&&mh&&Ef(Ec(Kf.data.targets),a,c),Si&&0===Y.length&&zg.domain([0,dj.x.selectAll(".tick").size()]),Y.length&&(J&&(zg.domain(Jf.extent(bc(Y))),Dj=zg.domain(),Tf&&vj.scale(zg).updateScaleExtent(),Cg.domain(zg.domain()),rj.scale(Cg)),I&&(zg.domain(rj.empty()?Dj:rj.extent()),Tf&&vj.scale(zg).updateScaleExtent()),Dh||!Ch&&!Bh||(T=Lc(Kc(Y),Bh),Fg.tickValues(T),Ig.tickValues(T))),Ag.domain(Zb(Y,"y")),Bg.domain(Zb(Y,"y2")),dj.x.style("opacity",X?0:1),dj.y.style("opacity",X?0:1),dj.y2.style("opacity",X?0:1),dj.subx.style("opacity",X?0:1),c.axisX.call(Fg),c.axisY.call(Gg),c.axisY2.call(Hg),c.axisSubX.call(Ig),Gb(E),I&&Y.length)if(zh&&T){for(U=1;U=0&&Jf.select(this).style("display",b%V?"none":"block")})}else wj.selectAll("."+g.axisX+" .tick text").style("display","block");!sh&&Eh&&hb(dj.x,c.axisX,Eh),L=$e(W),O=_e(W,!0),P=_e(W,!1),Dg.domain(Ag.domain()),Eg.domain(Bg.domain()),Bj.style("display","none"),q(),yj.select("line."+g.xgridFocus).style("visibility","hidden"),bi&&(f=Xd(ci,zg),z=Si?Fg.tickOffset():0,e=sh?{x1:0,x2:cg,y1:function(a){return zg(a)-z},y2:function(a){return zg(a)-z}}:{x1:function(a){return zg(a)+z},x2:function(a){return zg(a)+z},y1:_f.top,y2:eg},d=yj.select("."+g.xgrids).selectAll("."+g.xgrid).data(f),d.enter().append("line").attr("class",g.xgrid),d.attr(e).style("opacity",function(){return+Jf.select(this).attr(sh?"y1":"x1")===(sh?eg:0)?0:1}),d.exit().remove()),De(di)&&(h=yj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(di),i=h.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),i.append("line").style("opacity",0),i.append("text").attr("text-anchor","end").attr("transform",sh?"":"rotate(-90)").attr("dx",sh?0:-_f.top).attr("dy",-5).style("opacity",0),h.select("line").transition().duration(Q).attr("x1",sh?0:Hd).attr("x2",sh?cg:Hd).attr("y1",sh?Hd:_f.top).attr("y2",sh?Hd:eg).style("opacity",1),h.select("text").transition().duration(Q).attr("x",sh?cg:0).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),h.exit().transition().duration(Q).style("opacity",0).remove()),C&&ei&&(j=yj.select("."+g.ygrids).selectAll("."+g.ygrid).data(Ag.ticks(gi)),j.enter().append("line").attr("class",g.ygrid),j.attr("x1",sh?Ag:0).attr("x2",sh?Ag:cg).attr("y1",sh?0:Ag).attr("y2",sh?eg:Ag),j.exit().remove(),mf(j,"grid")),C&&De(fi)&&(k=yj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(fi),l=k.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",sh?"rotate(-90)":"").attr("dx",sh?0:-_f.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(Q).attr("x1",sh?Id:0).attr("x2",sh?Id:cg).attr("y1",sh?0:Id).attr("y2",sh?eg:Id).style("opacity",1),k.select("text").transition().duration(Q).attr("x",sh?0:cg).attr("y",Id).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(Q).style("opacity",0).remove()),s=yj.select("."+g.regions).selectAll("."+g.region).data(Di),s.enter().append("g").attr("class",id).append("rect").style("fill-opacity",0),s.selectAll("rect").transition().duration(Q).attr("x",gc).attr("y",hc).attr("width",ic).attr("height",jc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(Q).style("opacity",0).remove(),p=yj.selectAll("."+g.bars).selectAll("."+g.bar).data(te),p.enter().append("path").attr("class",cd).style("stroke","none").style("fill",$i),p.style("opacity",ud).transition().duration(Q).attr("d",L).style("fill",$i).style("opacity",1),p.exit().transition().duration(R).style("opacity",0).remove(),m=yj.selectAll("."+g.lines).selectAll("."+g.line).data(re),m.enter().append("path").attr("class",$c).style("stroke",$i),m.style("opacity",ud).transition().duration(Q).attr("d",sj).style("stroke",$i).style("opacity",1),m.exit().transition().duration(R).style("opacity",0).remove(),n=yj.selectAll("."+g.areas).selectAll("."+g.area).data(re),n.enter().append("path").attr("class",gd).style("fill",$i).style("opacity",function(){return Ej=+Jf.select(this).style("opacity"),0}),n.style("opacity",0).transition().duration(Q).attr("d",tj).style("fill",$i).style("opacity",Ej),n.exit().transition().duration(R).style("opacity",0).remove(),o=yj.selectAll("."+g.circles).selectAll("."+g.circle).data(ue),o.enter().append("circle").attr("class",ad).attr("r",Re).style("fill",$i),o.style("opacity",ud).transition().duration(Q).style("opacity",wd).style("fill",$i).attr("cx",sh?Zd:Yd).attr("cy",sh?Yd:Zd),o.exit().remove(),t=yj.selectAll("."+g.texts).selectAll("."+g.text).data(ve),t.enter().append("text").attr("class",Wc).attr("text-anchor",function(a){return sh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",$i).style("fill-opacity",0),t.text(function(a){return Fd(a.id)(a.value,a.id)}).style("fill-opacity",vd).transition().duration(Q).attr("x",O).attr("y",P).style("fill",$i).style("fill-opacity",xd),t.exit().transition().duration(R).style("fill-opacity",0).remove(),r=yj.selectAll("."+g.arcs).selectAll("."+g.arc).data(se),r.enter().append("path").attr("class",ed).style("fill",function(a){return $i(a.data)}).style("cursor",function(a){return ah(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Yi||(c=Hb(a),d=Nb(c),e=Vb(),Pb(c.data.id),Af(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Hb(a),c=Nb(b),d=[c];Td(d,Jf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Yi||(c=Hb(a),d=Nb(c),e=Wb(),Qb(c.data.id),Bf(),Ud(),e(d,b))}).on("click",function(a,b){var c=Hb(a),d=Nb(c),e=Ub();hf(this,a,b),e(d,b)}),r.attr("transform",H?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Yi=!0}).transition().duration(Q).attrTween("d",function(a){var b,c=Hb(a);return c?(b=Jf.interpolate(this._current,c),this._current=b(0),function(a){return Kb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",H?"scale(1)":"").style("fill",function(a){return $i(a.data)}).style("opacity",1).call(Ge,function(){Yi=!1}),r.exit().transition().duration(R).style("opacity",0).remove(),yj.selectAll("."+g.chartArc).select("text").attr("transform",Lb).style("opacity",0).transition().duration(Q).text(Ob).style("opacity",function(a){return Hc(a.data.id)&&qe(a.data)?1:0}),yj.select("."+g.chartArcsTitle).style("opacity",ie(Kf.data.targets)?1:0),jh&&(Jf.event&&"zoom"===Jf.event.type&&rj.extent(zg.orgDomain()).update(),D&&(!sh&&Eh&&hb(dj.subx,c.axisSubX,Eh),rj.empty()||rj.extent(zg.orgDomain()).update(),M=$e(W,!0),v=zj.selectAll("."+g.bars).selectAll("."+g.bar).data(te),v.enter().append("path").attr("class",cd).style("stroke","none").style("fill",$i),v.style("opacity",ud).transition().duration(Q).attr("d",M).style("opacity",1),v.exit().transition().duration(Q).style("opacity",0).remove(),u=zj.selectAll("."+g.lines).selectAll("."+g.line).data(re),u.enter().append("path").attr("class",$c).style("stroke",$i),u.style("opacity",ud).transition().duration(Q).attr("d",uj).style("opacity",1),u.exit().transition().duration(Q).style("opacity",0).remove())),yj.selectAll("."+g.selectedCircles).filter(function(a){return me(a)}).selectAll("circle").remove(),yj.selectAll("."+g.selectedCircle).transition().duration(Q).attr("cx",sh?Zd:Yd).attr("cy",sh?Yd:Zd),w=yj.select("."+g.eventRects),De(Kg)&&!qc(Kg)?(w.classed(g.eventRectsMultiple)||w.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),x=yj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),gf(x.enter()),x.attr("x",0).attr("y",0).attr("width",cg).attr("height",eg)):(w.classed(g.eventRectsSingle)||w.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Ti&&!Si?(B=function(a,b){var c=zc(b),d=Ac(b),e=Kf.data.xs[a.id][b];return(zg(d?d:e+50)-zg(c?c:e-50))/2},A=function(a,b){var c=zc(b),d=Kf.data.xs[a.id][b];return(zg(d)+zg(c?c:d-50))/2}):(B=N(),A=function(a){return zg(a.x)-B/2}),y=Cc(Kf.data.targets),yj.select("."+g.eventRects).datum(y?y.values:[]),x=yj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),ff(x.enter()),x.attr("class",jd).attr("x",sh?0:A).attr("y",sh?A:0).attr("width",sh?cg:B).attr("height",sh?B:eg),x.exit().remove()),Ec(Kf.data.targets).forEach(function(a){Fj[a]=!0})}function of(){nf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function pf(){if(0!==Jc(Kf.data.targets).length){if("mousemove"===Jf.event.sourceEvent.type&&vj.altDomain)return zg.domain(vj.altDomain),void vj.scale(zg).updateScaleExtent();Si&&zg.orgDomain()[0]===Dj[0]&&zg.domain([Dj[0]-1e-10,zg.orgDomain()[1]]),nf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Jf.event.sourceEvent.type&&(Wi=!0)}}function qf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function rf(){wj.attr("width",gg).attr("height",hg),wj.select("#"+Li).select("rect").attr("width",cg).attr("height",eg),wj.select("#"+Mi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),wj.select("#"+Ni).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),wj.select("."+g.zoomRect).attr("width",cg).attr("height",eg),Cj.style("max-height",hg+"px")}function sf(a){return{axisX:a?dj.x.transition().duration(a):dj.x,axisY:a?dj.y.transition().duration(a):dj.y,axisY2:a?dj.y2.transition().duration(a):dj.y2,axisSubX:a?dj.subx.transition().duration(a):dj.subx}}function tf(a){var b;a=a||{},a.withTransition=He(a,"withTransition",!0),a.withTransform=He(a,"withTransform",!1),a.withLegend=He(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withLegend&&mh||(b=sf(a.withTransition?$f:0),p(),T(),rf(),o(a.withTransition,b)),nf(a,b)}function uf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=yj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",ld),j=i.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Xc),e=yj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",nd),d=e.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",dd).style("cursor",function(a){return ah(a)?"pointer":null}),c=yj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",md),b=c.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",_c),b.append("g").attr("class",hd),b.append("g").attr("class",function(a){return Vc(g.selectedCircles,a.id)}),b.append("g").attr("class",bd).style("cursor",function(a){return ah(a)?"pointer":null}),a.forEach(function(a){yj.selectAll("."+g.selectedCircles+pd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=yj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(qg(a)).attr("class",od),f=h.enter().append("g").attr("class",od),f.append("g").attr("class",fd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),jh&&(n=zj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",nd),m=n.enter().append("g").style("opacity",0).attr("class",nd),m.append("g").attr("class",dd),l=zj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",md),k=l.enter().append("g").style("opacity",0).attr("class",md),k.append("g").attr("class",_c)),wj.selectAll("."+g.target).filter(function(a){return Hc(a.id)}).transition().duration($f).style("opacity",1)}function vf(a,b){b.filter&&(a=a.filter(b.filter)),(b.type||b.types)&&a.forEach(function(a){b.types?de(a.id,b.types[a.id]):de(a.id,b.type)}),Kf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,z=0,F++)),E[a]=F,D[F]=f,A[a]=z,z+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+v)/10),j=10*Math.ceil((h.height+u)/10),k=jj?j:i,l=jj?S():R();return d&&(z=0,F=0,w=0,x=0),mh&&!Ic(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=i,C[c]=j,(!w||i>=w)&&(w=i),(!x||j>=x)&&(x=j),g=jj?x:w,void(rh?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(l-g*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=26,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=Aj.selectAll("."+g.legendItemFocused).size();b=b||{},n=He(b,"withTransition",!0),q=He(b,"withTransitionForTransform",!0),jj?(f=function(a){return w*E[a]},j=function(a){return D[E[a]]+A[a]}):(f=function(a){return D[E[a]]+A[a]},j=function(a){return x*E[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=Aj.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Vc(g.legendItem,a)}).style("visibility",function(a){return Ic(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof oh?oh(a):Kf.toggle(a)}).on("mouseover",function(a){Jf.select(this).classed(g.legendItemFocused,!0),Yi||Kf.focus(a),"function"==typeof ph&&ph(a)}).on("mouseout",function(a){Jf.select(this).classed(g.legendItemFocused,!1),Yi||Kf.revert(),"function"==typeof qh&&qh(a)}),m.append("text").text(function(a){return d(Ng[a])?Ng[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",jj?h:-200).attr("y",jj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",jj?i:-200).attr("y",jj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",$i).attr("x",jj?h:-200).attr("y",jj?-200:j).attr("width",10).attr("height",10),r=Aj.selectAll("text").data(a).text(function(a){return d(Ng[a])?Ng[a]:a}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=Aj.selectAll("rect."+g.legendItemEvent).data(a),(n?s.transition():s).attr("width",function(a){return B[a]}).attr("height",function(a){return C[a]}).attr("x",i).attr("y",l),t=Aj.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",$i).attr("x",f).attr("y",j),Aj.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Hc(a)}).transition().style("opacity",function(a){var b=Jf.select(this);return Hc(a)?!G||b.classed(g.legendItemFocused)?yf(b):zf(b):nj}),P(w),Q(x),O(F),p(),T(),rf(),o(q,c)}function Ff(a){return Gc(Kf.data.targets,a.id)}function Gf(a){return"data"in a&&Gc(Kf.data.targets,a.data.id)}function Hf(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 If(a,b,c){var d=!je(Kf.data.targets);Yi=!1,de(a,b),tf(c||{withTransitionForAxis:d})}var Jf=a.d3?a.d3:a.require?a.require("d3"):void 0,Kf={data:{},axis:{},legend:{}},Lf={},Mf=i(["bindto"],"#chart"),Nf=i(["size","width"]),Of=i(["size","height"]),Pf=i(["padding","left"],50),Qf=i(["padding","right"],0),Rf=i(["padding","top"],0),Sf=i(["padding","bottom"],0),Tf=i(["zoom","enabled"],!1),Uf=i(["zoom","extent"]),Vf=i(["zoom","privileged"],!1),Wf=i(["onenter"],function(){}),Xf=i(["onleave"],function(){}),Yf=i(["onresize"],function(){}),Zf=i(["onresized"],function(){}),$f=i(["transition","duration"],350);h("data","data is required in config");var _f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg=i(["data","x"]),Kg=i(["data","xs"],{}),Lg=i(["data","x_format"]),Mg=i(["data","id_converter"],function(a){return a}),Ng=i(["data","names"],{}),Og=i(["data","classes"],{}),Pg=i(["data","groups"],[]),Qg=i(["data","axes"],{}),Rg=i(["data","type"]),Sg=i(["data","types"],{}),Tg=i(["data","labels"],{}),Ug=i(["data","order"]),Vg=i(["data","regions"],{}),Wg=i(["data","color"]),Xg=i(["data","colors"],{}),Yg=i(["data","hide"],!1),Zg=i(["data","filter"]),$g=i(["data","selection","enabled"],!1),_g=i(["data","selection","grouped"],!1),ah=i(["data","selection","isselectable"],function(){return!0}),bh=i(["data","selection","multiple"],!0),ch=i(["data","onclick"],function(){}),dh=i(["data","onenter"],function(){}),eh=i(["data","onleave"],function(){}),fh=i(["data","onselected"],function(){}),gh=i(["data","onunselected"],function(){}),hh=i(["data","ondragstart"],function(){}),ih=i(["data","ondragend"],function(){}),jh=i(["subchart","show"],!1),kh=i(["subchart","size","height"],60),lh=i(["color","pattern"],[]),mh=i(["legend","show"],!0),nh=i(["legend","position"],"bottom"),oh=i(["legend","item","onclick"]),ph=i(["legend","item","onmouseover"]),qh=i(["legend","item","onmouseout"]),rh=i(["legend","equally"],!1),sh=i(["axis","rotated"],!1),th=i(["axis","x","show"],!0),uh=i(["axis","x","type"],"indexed"),vh=i(["axis","x","localtime"],!0),wh=i(["axis","x","categories"],[]),xh=i(["axis","x","tick","centered"],!1),yh=i(["axis","x","tick","format"]),zh=i(["axis","x","tick","culling"],{}),Ah=i(["axis","x","tick","culling","max"],10),Bh=i(["axis","x","tick","count"]),Ch=i(["axis","x","tick","fit"],!0),Dh=i(["axis","x","tick","values"],null),Eh=i(["axis","x","tick","rotate"]),Fh=i(["axis","x","max"],null),Gh=i(["axis","x","min"],null),Hh=i(["axis","x","padding"],{}),Ih=i(["axis","x","height"]),Jh=i(["axis","x","default"]),Kh=i(["axis","x","label"],{}),Lh=i(["axis","y","show"],!0),Mh=i(["axis","y","max"]),Nh=i(["axis","y","min"]),Oh=i(["axis","y","center"]),Ph=i(["axis","y","label"],{}),Qh=i(["axis","y","inner"],!1),Rh=i(["axis","y","tick","format"]),Sh=i(["axis","y","padding"]),Th=i(["axis","y","ticks"],10),Uh=i(["axis","y2","show"],!1),Vh=i(["axis","y2","max"]),Wh=i(["axis","y2","min"]),Xh=i(["axis","y2","center"]),Yh=i(["axis","y2","label"],{}),Zh=i(["axis","y2","inner"],!1),$h=i(["axis","y2","tick","format"]),_h=i(["axis","y2","padding"]),ai=i(["axis","y2","ticks"],10),bi=i(["grid","x","show"],!1),ci=i(["grid","x","type"],"tick"),di=i(["grid","x","lines"],[]),ei=i(["grid","y","show"],!1),fi=i(["grid","y","lines"],[]),gi=i(["grid","y","ticks"],10),hi=i(["point","show"],!0),ii=i(["point","r"],2.5),ji=i(["point","focus","line","enabled"],!0),ki=i(["point","focus","expand","enabled"],!0),li=i(["point","focus","expand","r"]),mi=i(["point","focus","select","r"]),ni=i(["line","connect_null"],!1),oi=i(["bar","width"]),pi=i(["bar","width","ratio"],.6),qi=i(["pie","label","show"],!0),ri=i(["pie","label","format"]),si=i(["pie","expand"],!0),ti=i(["pie","onclick"],function(){}),ui=i(["pie","onmouseover"],function(){}),vi=i(["pie","onmouseout"],function(){}),wi=i(["donut","label","show"],!0),xi=i(["donut","label","format"]),yi=i(["donut","expand"],!0),zi=i(["donut","title"],""),Ai=i(["donut","onclick"],function(){}),Bi=i(["donut","onmouseover"],function(){}),Ci=i(["donut","onmouseout"],function(){}),Di=i(["regions"],[]),Ei=i(["tooltip","show"],!0),Fi=i(["tooltip","format","title"]),Gi=i(["tooltip","format","value"]),Hi=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Fi?Fi:b,l=Gi?Gi:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Ii=i(["tooltip","init","show"],!1),Ji=i(["tooltip","init","x"],0),Ki=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Li=("string"==typeof Mf?Mf.replace("#",""):Mf.id)+"-clip",Mi=Li+"-xaxis",Ni=Li+"-yaxis",Oi=j(Li),Pi=j(Mi),Qi=j(Ni),Ri="timeseries"===uh,Si="categorized"===uh,Ti=!Ri&&(Jg||De(Kg)),Ui=null,Vi=!1,Wi=!1,Xi=!1,Yi=!1,Zi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],$i=xe(Xg,De(lh)?lh:Zi,Wg),_i=vh?Jf.time.format:Jf.time.format.utc,aj=_i.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),bj=[],cj=[],dj={},ej=sh?"left":"bottom",fj=sh?Qh?"top":"bottom":Qh?"right":"left",gj=sh?Zh?"bottom":"top":Zh?"left":"right",hj=sh?"left":"bottom",ij={main:function(){return"translate("+k(_f.left)+","+k(_f.top)+")"},context:function(){return"translate("+k(ag.left)+","+k(ag.top)+")"},legend:function(){return"translate("+bg.left+","+bg.top+")"},x:function(){return"translate(0,"+(sh?0:eg)+")"},y:function(){return"translate(0,"+(sh?eg:0)+")"},y2:function(){return"translate("+(sh?0:cg)+","+(sh?1:0)+")" +return"M"+b(i)+" "+e(k(d))+" "+b(j)+" "+e(k(d+f))}:function(a,c,d,f){return"M"+b(j(d),!0)+" "+e(k(d))+" "+b(j(d+f),!0)+" "+e(k(d+f))},g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function ef(b){var c,d,e;if(Cj=Jf.select(Mf),Cj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Cj.html("").classed("c3",!0),Kf.data.xs={},Kf.data.targets=xc(b),Zg&&(Kf.data.targets=Kf.data.targets.filter(Zg)),Yg&&Mc(Yg===!0?Ec(Kf.data.targets):Yg),p(),T(),zg.domain(Jf.extent(bc(Kf.data.targets))),Ag.domain(Zb(Kf.data.targets,"y")),Bg.domain(Zb(Kf.data.targets,"y2")),Cg.domain(zg.domain()),Dg.domain(Ag.domain()),Eg.domain(Bg.domain()),Dj=zg.domain(),rj.scale(Cg),Tf&&vj.scale(zg),wj=Cj.append("svg").on("mouseenter",Wf).on("mouseleave",Xf),xj=wj.append("defs"),xj.append("clipPath").attr("id",Li).append("rect"),xj.append("clipPath").attr("id",Mi).append("rect"),xj.append("clipPath").attr("id",Ni).append("rect"),rf(),yj=wj.append("g").attr("transform",ij.main),zj=wj.append("g").attr("transform",ij.context),Aj=wj.append("g").attr("transform",ij.legend),jh||zj.style("visibility","hidden"),mh||(Aj.style("visibility","hidden"),cj=Ec(Kf.data.targets)),Bj=Jf.select(Mf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Ef(Ec(Kf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=yj.append("g").attr("clip-path",Oi).attr("class",g.grid),bi&&d.append("g").attr("class",g.xgrids),De(di)&&d.append("g").attr("class",g.xgridLines),ji&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),ei&&d.append("g").attr("class",g.ygrids),De(fi)&&d.append("g").attr("class",g.ygridLines),yj.append("g").attr("clip-path",Oi).attr("class",g.regions),yj.append("g").attr("clip-path",Oi).attr("class",g.chart),c=yj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Tf?sh?"ns-resize":"ew-resize":null),yj.select("."+g.chart).append("g").attr("class",g.chartBars),yj.select("."+g.chart).append("g").attr("class",g.chartLines),yj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",ij.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Tb()),yj.select("."+g.chart).append("g").attr("class",g.chartTexts),Tf&&yj.insert("rect",Vf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",cg).attr("height",eg).style("opacity",0).style("cursor",sh?"ns-resize":"ew-resize").call(vj).on("dblclick.zoom",null),Jh&&rj.extent("function"!=typeof Jh?Jh:Jh(bc())),dj.x=yj.append("g").attr("class",g.axisX).attr("clip-path",Pi).attr("transform",ij.x).style("visibility",th?"visible":"hidden"),dj.x.append("text").attr("class",g.axisXLabel).attr("transform",sh?"rotate(-90)":"").style("text-anchor",Cb),dj.y=yj.append("g").attr("class",g.axisY).attr("clip-path",Qi).attr("transform",ij.y).style("visibility",Lh?"visible":"hidden"),dj.y.append("text").attr("class",g.axisYLabel).attr("transform",sh?"":"rotate(-90)").style("text-anchor",Db),dj.y2=yj.append("g").attr("class",g.axisY2).attr("transform",ij.y2).style("visibility",Uh?"visible":"hidden"),dj.y2.append("text").attr("class",g.axisY2Label).attr("transform",sh?"":"rotate(-90)").style("text-anchor",Eb),zj.append("g").attr("clip-path",Oi).attr("class",g.chart),zj.select("."+g.chart).append("g").attr("class",g.chartBars),zj.select("."+g.chart).append("g").attr("class",g.chartLines),zj.append("g").attr("clip-path",Oi).attr("class",g.brush).call(rj).selectAll("rect").attr(sh?"width":"height",sh?dg:fg),dj.subx=zj.append("g").attr("class",g.axisX).attr("transform",ij.subx).attr("clip-path",sh?"":Pi),uf(Kf.data.targets),sh?yj.select("."+g.axisX).style("opacity",0).call(Fg):(yj.select("."+g.axisY).style("opacity",0).call(Gg),yj.select("."+g.axisY2).style("opacity",0).call(Hg)),p(),T(),rf(),o(!1),nf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Ii){if(Ri&&"string"==typeof Ji){for(Ji=ye(Ji),e=0;e0){d=[];for(var f in Ng)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Pd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ne,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function kf(a){je(Kf.data.targets)||$g&&(Ui=a,yj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Vi=!0,hh())}function lf(){je(Kf.data.targets)||$g&&(yj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),yj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Vi=!1,ih())}function mf(a,b){"grid"===b&&a.each(function(){var a=Jf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function nf(a,c){var d,e,f,h,i,j,k,l,m,n,o,p,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,O,P,Q,R,S,T,U,V,W=$d(),X=je(Kf.data.targets),Y=Jc(Kf.data.targets);if(a=a||{},C=He(a,"withY",!0),D=He(a,"withSubchart",!0),E=He(a,"withTransition",!0),H=He(a,"withTransform",!1),I=He(a,"withUpdateXDomain",!1),J=He(a,"withUpdateOrgXDomain",!1),K=He(a,"withLegend",!1),F=He(a,"withTransitionForExit",E),G=He(a,"withTransitionForAxis",E),Q=E?$f:0,R=F?Q:0,S=G?Q:0,c=c||sf(S),K&&mh&&Ef(Ec(Kf.data.targets),a,c),Si&&0===Y.length&&zg.domain([0,dj.x.selectAll(".tick").size()]),Y.length&&(J&&(zg.domain(Jf.extent(bc(Y))),Dj=zg.domain(),Tf&&vj.scale(zg).updateScaleExtent(),Cg.domain(zg.domain()),rj.scale(Cg)),I&&(zg.domain(rj.empty()?Dj:rj.extent()),Tf&&vj.scale(zg).updateScaleExtent()),Dh||!Ch&&!Bh||(T=Lc(Kc(Y),Bh),Fg.tickValues(T),Ig.tickValues(T))),Ag.domain(Zb(Y,"y")),Bg.domain(Zb(Y,"y2")),dj.x.style("opacity",X?0:1),dj.y.style("opacity",X?0:1),dj.y2.style("opacity",X?0:1),dj.subx.style("opacity",X?0:1),c.axisX.call(Fg),c.axisY.call(Gg),c.axisY2.call(Hg),c.axisSubX.call(Ig),Gb(E),I&&Y.length)if(zh&&T){for(U=1;U=0&&Jf.select(this).style("display",b%V?"none":"block")})}else wj.selectAll("."+g.axisX+" .tick text").style("display","block");!sh&&Eh&&hb(dj.x,c.axisX,Eh),L=$e(W),O=_e(W,!0),P=_e(W,!1),Dg.domain(Ag.domain()),Eg.domain(Bg.domain()),Bj.style("display","none"),q(),yj.select("line."+g.xgridFocus).style("visibility","hidden"),bi&&(f=Xd(ci,zg),z=Si?Fg.tickOffset():0,e=sh?{x1:0,x2:cg,y1:function(a){return zg(a)-z},y2:function(a){return zg(a)-z}}:{x1:function(a){return zg(a)+z},x2:function(a){return zg(a)+z},y1:_f.top,y2:eg},d=yj.select("."+g.xgrids).selectAll("."+g.xgrid).data(f),d.enter().append("line").attr("class",g.xgrid),d.attr(e).style("opacity",function(){return+Jf.select(this).attr(sh?"y1":"x1")===(sh?eg:0)?0:1}),d.exit().remove()),De(di)&&(h=yj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(di),i=h.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),i.append("line").style("opacity",0),i.append("text").attr("text-anchor","end").attr("transform",sh?"":"rotate(-90)").attr("dx",sh?0:-_f.top).attr("dy",-5).style("opacity",0),h.select("line").transition().duration(Q).attr("x1",sh?0:Hd).attr("x2",sh?cg:Hd).attr("y1",sh?Hd:_f.top).attr("y2",sh?Hd:eg).style("opacity",1),h.select("text").transition().duration(Q).attr("x",sh?cg:0).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),h.exit().transition().duration(Q).style("opacity",0).remove()),C&&ei&&(j=yj.select("."+g.ygrids).selectAll("."+g.ygrid).data(Ag.ticks(gi)),j.enter().append("line").attr("class",g.ygrid),j.attr("x1",sh?Ag:0).attr("x2",sh?Ag:cg).attr("y1",sh?0:Ag).attr("y2",sh?eg:Ag),j.exit().remove(),mf(j,"grid")),C&&De(fi)&&(k=yj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(fi),l=k.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",sh?"rotate(-90)":"").attr("dx",sh?0:-_f.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(Q).attr("x1",sh?Id:0).attr("x2",sh?Id:cg).attr("y1",sh?0:Id).attr("y2",sh?eg:Id).style("opacity",1),k.select("text").transition().duration(Q).attr("x",sh?0:cg).attr("y",Id).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(Q).style("opacity",0).remove()),s=yj.select("."+g.regions).selectAll("."+g.region).data(Di),s.enter().append("g").attr("class",id).append("rect").style("fill-opacity",0),s.selectAll("rect").transition().duration(Q).attr("x",gc).attr("y",hc).attr("width",ic).attr("height",jc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(Q).style("opacity",0).remove(),p=yj.selectAll("."+g.bars).selectAll("."+g.bar).data(te),p.enter().append("path").attr("class",cd).style("stroke","none").style("fill",$i),p.style("opacity",ud).transition().duration(Q).attr("d",L).style("fill",$i).style("opacity",1),p.exit().transition().duration(R).style("opacity",0).remove(),m=yj.selectAll("."+g.lines).selectAll("."+g.line).data(re),m.enter().append("path").attr("class",$c).style("stroke",$i),m.style("opacity",ud).transition().duration(Q).attr("d",sj).style("stroke",$i).style("opacity",1),m.exit().transition().duration(R).style("opacity",0).remove(),n=yj.selectAll("."+g.areas).selectAll("."+g.area).data(re),n.enter().append("path").attr("class",gd).style("fill",$i).style("opacity",function(){return Ej=+Jf.select(this).style("opacity"),0}),n.style("opacity",0).transition().duration(Q).attr("d",tj).style("fill",$i).style("opacity",Ej),n.exit().transition().duration(R).style("opacity",0).remove(),o=yj.selectAll("."+g.circles).selectAll("."+g.circle).data(ue),o.enter().append("circle").attr("class",ad).attr("r",Re).style("fill",$i),o.style("opacity",ud).transition().duration(Q).style("opacity",wd).style("fill",$i).attr("cx",sh?Zd:Yd).attr("cy",sh?Yd:Zd),o.exit().remove(),t=yj.selectAll("."+g.texts).selectAll("."+g.text).data(ve),t.enter().append("text").attr("class",Wc).attr("text-anchor",function(a){return sh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",$i).style("fill-opacity",0),t.text(function(a){return Fd(a.id)(a.value,a.id)}).style("fill-opacity",vd).transition().duration(Q).attr("x",O).attr("y",P).style("fill",$i).style("fill-opacity",xd),t.exit().transition().duration(R).style("fill-opacity",0).remove(),r=yj.selectAll("."+g.arcs).selectAll("."+g.arc).data(se),r.enter().append("path").attr("class",ed).style("fill",function(a){return $i(a.data)}).style("cursor",function(a){return ah(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Yi||(c=Hb(a),d=Nb(c),e=Vb(),Pb(c.data.id),Af(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Hb(a),c=Nb(b),d=[c];Td(d,Jf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Yi||(c=Hb(a),d=Nb(c),e=Wb(),Qb(c.data.id),Bf(),Ud(),e(d,b))}).on("click",function(a,b){var c=Hb(a),d=Nb(c),e=Ub();hf(this,a,b),e(d,b)}),r.attr("transform",H?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Yi=!0}).transition().duration(Q).attrTween("d",function(a){var b,c=Hb(a);return c?(b=Jf.interpolate(this._current,c),this._current=b(0),function(a){return Kb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",H?"scale(1)":"").style("fill",function(a){return $i(a.data)}).style("opacity",1).call(Ge,function(){Yi=!1}),r.exit().transition().duration(R).style("opacity",0).remove(),yj.selectAll("."+g.chartArc).select("text").attr("transform",Lb).style("opacity",0).transition().duration(Q).text(Ob).style("opacity",function(a){return Hc(a.data.id)&&qe(a.data)?1:0}),yj.select("."+g.chartArcsTitle).style("opacity",ie(Kf.data.targets)?1:0),jh&&(Jf.event&&"zoom"===Jf.event.type&&rj.extent(zg.orgDomain()).update(),D&&(!sh&&Eh&&hb(dj.subx,c.axisSubX,Eh),rj.empty()||rj.extent(zg.orgDomain()).update(),M=$e(W,!0),v=zj.selectAll("."+g.bars).selectAll("."+g.bar).data(te),v.enter().append("path").attr("class",cd).style("stroke","none").style("fill",$i),v.style("opacity",ud).transition().duration(Q).attr("d",M).style("opacity",1),v.exit().transition().duration(Q).style("opacity",0).remove(),u=zj.selectAll("."+g.lines).selectAll("."+g.line).data(re),u.enter().append("path").attr("class",$c).style("stroke",$i),u.style("opacity",ud).transition().duration(Q).attr("d",uj).style("opacity",1),u.exit().transition().duration(Q).style("opacity",0).remove())),yj.selectAll("."+g.selectedCircles).filter(function(a){return me(a)}).selectAll("circle").remove(),yj.selectAll("."+g.selectedCircle).transition().duration(Q).attr("cx",sh?Zd:Yd).attr("cy",sh?Yd:Zd),w=yj.select("."+g.eventRects),De(Kg)&&!qc(Kg)?(w.classed(g.eventRectsMultiple)||w.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),x=yj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),gf(x.enter()),x.attr("x",0).attr("y",0).attr("width",cg).attr("height",eg)):(w.classed(g.eventRectsSingle)||w.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Ti&&!Si?(B=function(a,b){var c=zc(b),d=Ac(b),e=Kf.data.xs[a.id][b];return(zg(d?d:e+50)-zg(c?c:e-50))/2},A=function(a,b){var c=zc(b),d=Kf.data.xs[a.id][b];return(zg(d)+zg(c?c:d-50))/2}):(B=N(),A=function(a){return zg(a.x)-B/2}),y=Cc(Kf.data.targets),yj.select("."+g.eventRects).datum(y?y.values:[]),x=yj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),ff(x.enter()),x.attr("class",jd).attr("x",sh?0:A).attr("y",sh?A:0).attr("width",sh?cg:B).attr("height",sh?B:eg),x.exit().remove()),Ec(Kf.data.targets).forEach(function(a){Fj[a]=!0})}function of(){nf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function pf(){if(0!==Jc(Kf.data.targets).length){if("mousemove"===Jf.event.sourceEvent.type&&vj.altDomain)return zg.domain(vj.altDomain),void vj.scale(zg).updateScaleExtent();Si&&zg.orgDomain()[0]===Dj[0]&&zg.domain([Dj[0]-1e-10,zg.orgDomain()[1]]),nf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Jf.event.sourceEvent.type&&(Wi=!0)}}function qf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function rf(){wj.attr("width",gg).attr("height",hg),wj.select("#"+Li).select("rect").attr("width",cg).attr("height",eg),wj.select("#"+Mi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),wj.select("#"+Ni).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),wj.select("."+g.zoomRect).attr("width",cg).attr("height",eg),Cj.style("max-height",hg+"px")}function sf(a){return{axisX:a?dj.x.transition().duration(a):dj.x,axisY:a?dj.y.transition().duration(a):dj.y,axisY2:a?dj.y2.transition().duration(a):dj.y2,axisSubX:a?dj.subx.transition().duration(a):dj.subx}}function tf(a){var b;a=a||{},a.withTransition=He(a,"withTransition",!0),a.withTransform=He(a,"withTransform",!1),a.withLegend=He(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withLegend&&mh||(b=sf(a.withTransitionForAxis?$f:0),p(),T(),rf(),o(a.withTransition,b)),nf(a,b)}function uf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=yj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",ld),j=i.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Xc),e=yj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",nd),d=e.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",dd).style("cursor",function(a){return ah(a)?"pointer":null}),c=yj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",md),b=c.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",_c),b.append("g").attr("class",hd),b.append("g").attr("class",function(a){return Vc(g.selectedCircles,a.id)}),b.append("g").attr("class",bd).style("cursor",function(a){return ah(a)?"pointer":null}),a.forEach(function(a){yj.selectAll("."+g.selectedCircles+pd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=yj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(qg(a)).attr("class",od),f=h.enter().append("g").attr("class",od),f.append("g").attr("class",fd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),jh&&(n=zj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",nd),m=n.enter().append("g").style("opacity",0).attr("class",nd),m.append("g").attr("class",dd),l=zj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",md),k=l.enter().append("g").style("opacity",0).attr("class",md),k.append("g").attr("class",_c)),wj.selectAll("."+g.target).filter(function(a){return Hc(a.id)}).transition().duration($f).style("opacity",1)}function vf(a,b){b.filter&&(a=a.filter(b.filter)),(b.type||b.types)&&a.forEach(function(a){b.types?de(a.id,b.types[a.id]):de(a.id,b.type)}),Kf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,z=0,F++)),E[a]=F,D[F]=f,A[a]=z,z+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+v)/10),j=10*Math.ceil((h.height+u)/10),k=jj?j:i,l=jj?S():R();return d&&(z=0,F=0,w=0,x=0),mh&&!Ic(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=i,C[c]=j,(!w||i>=w)&&(w=i),(!x||j>=x)&&(x=j),g=jj?x:w,void(rh?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(l-g*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=26,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=Aj.selectAll("."+g.legendItemFocused).size();b=b||{},n=He(b,"withTransition",!0),q=He(b,"withTransitionForTransform",!0),jj?(f=function(a){return w*E[a]},j=function(a){return D[E[a]]+A[a]}):(f=function(a){return D[E[a]]+A[a]},j=function(a){return x*E[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=Aj.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Vc(g.legendItem,a)}).style("visibility",function(a){return Ic(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof oh?oh(a):Kf.toggle(a)}).on("mouseover",function(a){Jf.select(this).classed(g.legendItemFocused,!0),Yi||Kf.focus(a),"function"==typeof ph&&ph(a)}).on("mouseout",function(a){Jf.select(this).classed(g.legendItemFocused,!1),Yi||Kf.revert(),"function"==typeof qh&&qh(a)}),m.append("text").text(function(a){return d(Ng[a])?Ng[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",jj?h:-200).attr("y",jj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",jj?i:-200).attr("y",jj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",$i).attr("x",jj?h:-200).attr("y",jj?-200:j).attr("width",10).attr("height",10),r=Aj.selectAll("text").data(a).text(function(a){return d(Ng[a])?Ng[a]:a}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=Aj.selectAll("rect."+g.legendItemEvent).data(a),(n?s.transition():s).attr("width",function(a){return B[a]}).attr("height",function(a){return C[a]}).attr("x",i).attr("y",l),t=Aj.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",$i).attr("x",f).attr("y",j),Aj.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Hc(a)}).transition().style("opacity",function(a){var b=Jf.select(this);return Hc(a)?!G||b.classed(g.legendItemFocused)?yf(b):zf(b):nj}),P(w),Q(x),O(F),p(),T(),rf(),o(q,c)}function Ff(a){return Gc(Kf.data.targets,a.id)}function Gf(a){return"data"in a&&Gc(Kf.data.targets,a.data.id)}function Hf(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 If(a,b,c){var d=!je(Kf.data.targets);Yi=!1,de(a,b),tf(c||{withTransitionForAxis:d})}var Jf=a.d3?a.d3:a.require?a.require("d3"):void 0,Kf={data:{},axis:{},legend:{}},Lf={},Mf=i(["bindto"],"#chart"),Nf=i(["size","width"]),Of=i(["size","height"]),Pf=i(["padding","left"],50),Qf=i(["padding","right"],0),Rf=i(["padding","top"],0),Sf=i(["padding","bottom"],0),Tf=i(["zoom","enabled"],!1),Uf=i(["zoom","extent"]),Vf=i(["zoom","privileged"],!1),Wf=i(["onenter"],function(){}),Xf=i(["onleave"],function(){}),Yf=i(["onresize"],function(){}),Zf=i(["onresized"],function(){}),$f=i(["transition","duration"],350);h("data","data is required in config");var _f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg=i(["data","x"]),Kg=i(["data","xs"],{}),Lg=i(["data","x_format"]),Mg=i(["data","id_converter"],function(a){return a}),Ng=i(["data","names"],{}),Og=i(["data","classes"],{}),Pg=i(["data","groups"],[]),Qg=i(["data","axes"],{}),Rg=i(["data","type"]),Sg=i(["data","types"],{}),Tg=i(["data","labels"],{}),Ug=i(["data","order"]),Vg=i(["data","regions"],{}),Wg=i(["data","color"]),Xg=i(["data","colors"],{}),Yg=i(["data","hide"],!1),Zg=i(["data","filter"]),$g=i(["data","selection","enabled"],!1),_g=i(["data","selection","grouped"],!1),ah=i(["data","selection","isselectable"],function(){return!0}),bh=i(["data","selection","multiple"],!0),ch=i(["data","onclick"],function(){}),dh=i(["data","onenter"],function(){}),eh=i(["data","onleave"],function(){}),fh=i(["data","onselected"],function(){}),gh=i(["data","onunselected"],function(){}),hh=i(["data","ondragstart"],function(){}),ih=i(["data","ondragend"],function(){}),jh=i(["subchart","show"],!1),kh=i(["subchart","size","height"],60),lh=i(["color","pattern"],[]),mh=i(["legend","show"],!0),nh=i(["legend","position"],"bottom"),oh=i(["legend","item","onclick"]),ph=i(["legend","item","onmouseover"]),qh=i(["legend","item","onmouseout"]),rh=i(["legend","equally"],!1),sh=i(["axis","rotated"],!1),th=i(["axis","x","show"],!0),uh=i(["axis","x","type"],"indexed"),vh=i(["axis","x","localtime"],!0),wh=i(["axis","x","categories"],[]),xh=i(["axis","x","tick","centered"],!1),yh=i(["axis","x","tick","format"]),zh=i(["axis","x","tick","culling"],{}),Ah=i(["axis","x","tick","culling","max"],10),Bh=i(["axis","x","tick","count"]),Ch=i(["axis","x","tick","fit"],!0),Dh=i(["axis","x","tick","values"],null),Eh=i(["axis","x","tick","rotate"]),Fh=i(["axis","x","max"],null),Gh=i(["axis","x","min"],null),Hh=i(["axis","x","padding"],{}),Ih=i(["axis","x","height"]),Jh=i(["axis","x","default"]),Kh=i(["axis","x","label"],{}),Lh=i(["axis","y","show"],!0),Mh=i(["axis","y","max"]),Nh=i(["axis","y","min"]),Oh=i(["axis","y","center"]),Ph=i(["axis","y","label"],{}),Qh=i(["axis","y","inner"],!1),Rh=i(["axis","y","tick","format"]),Sh=i(["axis","y","padding"]),Th=i(["axis","y","ticks"],10),Uh=i(["axis","y2","show"],!1),Vh=i(["axis","y2","max"]),Wh=i(["axis","y2","min"]),Xh=i(["axis","y2","center"]),Yh=i(["axis","y2","label"],{}),Zh=i(["axis","y2","inner"],!1),$h=i(["axis","y2","tick","format"]),_h=i(["axis","y2","padding"]),ai=i(["axis","y2","ticks"],10),bi=i(["grid","x","show"],!1),ci=i(["grid","x","type"],"tick"),di=i(["grid","x","lines"],[]),ei=i(["grid","y","show"],!1),fi=i(["grid","y","lines"],[]),gi=i(["grid","y","ticks"],10),hi=i(["point","show"],!0),ii=i(["point","r"],2.5),ji=i(["point","focus","line","enabled"],!0),ki=i(["point","focus","expand","enabled"],!0),li=i(["point","focus","expand","r"]),mi=i(["point","focus","select","r"]),ni=i(["line","connect_null"],!1),oi=i(["bar","width"]),pi=i(["bar","width","ratio"],.6),qi=i(["pie","label","show"],!0),ri=i(["pie","label","format"]),si=i(["pie","expand"],!0),ti=i(["pie","onclick"],function(){}),ui=i(["pie","onmouseover"],function(){}),vi=i(["pie","onmouseout"],function(){}),wi=i(["donut","label","show"],!0),xi=i(["donut","label","format"]),yi=i(["donut","expand"],!0),zi=i(["donut","title"],""),Ai=i(["donut","onclick"],function(){}),Bi=i(["donut","onmouseover"],function(){}),Ci=i(["donut","onmouseout"],function(){}),Di=i(["regions"],[]),Ei=i(["tooltip","show"],!0),Fi=i(["tooltip","format","title"]),Gi=i(["tooltip","format","value"]),Hi=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Fi?Fi:b,l=Gi?Gi:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Ii=i(["tooltip","init","show"],!1),Ji=i(["tooltip","init","x"],0),Ki=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Li=("string"==typeof Mf?Mf.replace("#",""):Mf.id)+"-clip",Mi=Li+"-xaxis",Ni=Li+"-yaxis",Oi=j(Li),Pi=j(Mi),Qi=j(Ni),Ri="timeseries"===uh,Si="categorized"===uh,Ti=!Ri&&(Jg||De(Kg)),Ui=null,Vi=!1,Wi=!1,Xi=!1,Yi=!1,Zi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],$i=xe(Xg,De(lh)?lh:Zi,Wg),_i=vh?Jf.time.format:Jf.time.format.utc,aj=_i.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),bj=[],cj=[],dj={},ej=sh?"left":"bottom",fj=sh?Qh?"top":"bottom":Qh?"right":"left",gj=sh?Zh?"bottom":"top":Zh?"left":"right",hj=sh?"left":"bottom",ij={main:function(){return"translate("+k(_f.left)+","+k(_f.top)+")"},context:function(){return"translate("+k(ag.left)+","+k(ag.top)+")"},legend:function(){return"translate("+bg.left+","+bg.top+")"},x:function(){return"translate(0,"+(sh?0:eg)+")"},y:function(){return"translate(0,"+(sh?eg:0)+")"},y2:function(){return"translate("+(sh?0:cg)+","+(sh?1:0)+")" },subx:function(){return"translate(0,"+(sh?0:fg)+")"},arc:function(){return"translate("+lg/2+","+mg/2+")"}},jj="right"===nh,kj=0,lj=0,mj=0,nj=.15,oj=30,pj=sh&&!th?0:30,qj=5;qg=Jf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var rj,sj=function(){var a=Jf.svg.line().x(sh?function(a){return Y(a.id)(a.value)}:Gd).y(sh?Gd:function(a){return Y(a.id)(a.value)});return ni||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ni?Qe(b.values):b.values;return ke(b)?(a.interpolate(le(b)?"cardinal":"linear"),Vg[b.id]?df(e,zg,Y(b.id),Vg[b.id]):a(e)):(c=e[0]?zg(e[0].x):0,d=e[0]?Y(b.id)(e[0].value):0,sh?"M "+d+" "+c:"M "+c+" "+d)}}(),tj=function(){var a;return a=sh?Jf.svg.area().x0(function(a){return Y(a.id)(0)}).x1(function(a){return Y(a.id)(a.value)}).y(Gd):Jf.svg.area().x(Gd).y0(function(a){return Y(a.id)(0)}).y1(function(a){return Y(a.id)(a.value)}),function(b){var c,d,e=Qe(b.values);return ee([b],"area")||ee([b],"area-spline")?(a.interpolate(le(b)?"cardinal":"linear"),a(e)):(c=e[0]?zg(e[0].x):0,d=e[0]?Y(b.id)(e[0].value):0,sh?"M "+d+" "+c:"M "+c+" "+d)}}(),uj=function(){var a=Jf.svg.line().x(sh?function(a){return Z(a.id)(a.value)}:Jd).y(sh?Jd:function(a){return Z(a.id)(a.value)});return function(b){var c=Qe(b.values);return ke(b)?a(c):"M "+Cg(c[0].x)+" "+Z(b.id)(c[0].value)}}(),vj=function(){};rj=Jf.svg.brush().on("brush",of),rj.update=function(){return zj&&zj.select("."+g.brush).call(this),this},rj.scale=function(a){return sh?this.y(a):this.x(a)},Tf&&(vj=Jf.behavior.zoom().on("zoomstart",function(){vj.altDomain=Jf.event.sourceEvent.altKey?zg.orgDomain():null}).on("zoom",Tf?pf:null),vj.scale=function(a){return sh?this.y(a):this.x(a)},vj.orgScaleExtent=function(){var a=Uf?Uf:[1,10];return[a[0],Math.max(Bc()/a[1],a[1])]},vj.updateScaleExtent=function(){var a=cc(zg.orgDomain())/cc(Dj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var wj,xj,yj,zj,Aj,Bj,Cj,Dj,Ej,Fj={};if(Kf.focus=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",1)}var c=wj.selectAll(qd(a)),d=c.filter(Ff),e=c.filter(Gf);Kf.revert(),Kf.defocus(),b(d.classed(g.focused,!0)),b(e),je(Kf.data.targets)&&Pb(a,!0),Af(a,!0)},Kf.defocus=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",.3)}var c=wj.selectAll(qd(a)),d=c.filter(Ff),e=c.filter(Gf);Kf.revert(),b(d.classed(g.focused,!1)),b(e),je(Kf.data.targets)&&Qb(a),Af(a,!1)},Kf.revert=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",1)}var c=wj.selectAll(qd(a)),d=c.filter(Ff),e=c.filter(Gf);b(d.classed(g.focused,!1)),b(e),je(Kf.data.targets)&&Qb(a),Bf()},Kf.show=function(a,b){a=Fc(a),b=b||{},Nc(a),wj.selectAll(rd(a)).transition().style("opacity",1),b.withLegend&&Cf(a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Kf.hide=function(a,b){a=Fc(a),b=b||{},Mc(a),wj.selectAll(rd(a)).transition().style("opacity",0),b.withLegend&&Df(a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Kf.toggle=function(a){Hc(a)?Kf.hide(a):Kf.show(a)},Kf.unzoom=function(){rj.clear().update(),nf({withUpdateXDomain:!0})},Kf.load=function(a){return a.xs&&pc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Og[b]=a.classes[b]}),"categories"in a&&Si&&(wh=a.categories,Fg.categories(wh)),"cacheIds"in a&&dc(a.cacheIds)?void vf(fc(a.cacheIds),a.done):void("unload"in a?xf(Fc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){wf(a)}):wf(a))},Kf.unload=function(a,b){xf(Fc(a),function(){nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Kf.selected=function(a){return Jf.merge(yj.selectAll("."+g.shapes+pd(a)).selectAll("."+g.shape).filter(function(){return Jf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Kf.select=function(a,b,c){$g&&yj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Jf.select(this),i=e.data?e.data.id:e.id,j=Pe(this),k=_g||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);"path"!==this.nodeName&&(k&&l?ah(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},Kf.unselect=function(a,b){$g&&yj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Jf.select(this),f=c.data?c.data.id:c.id,h=Pe(this),i=_g||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);"path"!==this.nodeName&&i&&j&&ah(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Kf.toLine=function(a){If(a,"line")},Kf.toSpline=function(a){If(a,"spline")},Kf.toBar=function(a){If(a,"bar")},Kf.toScatter=function(a){If(a,"scatter")},Kf.toArea=function(a){If(a,"area")},Kf.toAreaSpline=function(a){If(a,"area-spline")},Kf.toPie=function(a){If(a,"pie",{withTransform:!0})},Kf.toDonut=function(a){If(a,"donut",{withTransform:!0})},Kf.groups=function(a){return c(a)?Pg:(Pg=a,nf(),Pg)},Kf.xgrids=function(a){return a?(di=a,nf(),di):di},Kf.xgrids.add=function(a){return a?Kf.xgrids(di.concat(a)):void 0},Kf.xgrids.remove=function(a){var b=Hf(a);return Kf.xgrids(di.filter(b))},Kf.ygrids=function(a){return a?(fi=a,nf(),fi):fi},Kf.ygrids.add=function(a){return a?Kf.ygrids(fi.concat(a)):void 0},Kf.ygrids.remove=function(a){var b=Hf(a);return Kf.ygrids(fi.filter(b))},Kf.regions=function(a){return a?(Di=a,nf(),Di):Di},Kf.regions.add=function(a){return a?(Di=Di.concat(a),nf(),Di):Di},Kf.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;wj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Di=Di.filter(function(b){return b.classes.indexOf(a)<0})}),Di},Kf.data.get=function(a){var b=Kf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Kf.data.getAsTarget=function(a){var b=Kf.data.targets.filter(function(b){return b.id===a});return b.length>0?b[0]:void 0},Kf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Ng[b]=a[b]}),nf({withLegend:!0}),Ng):Ng},Kf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Xg[b]=a[b]}),nf({withLegend:!0}),Xg):Xg},Kf.x=function(a){return arguments.length&&(sc(Kf.data.targets,a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Kf.data.xs},Kf.xs=function(a){return arguments.length&&(tc(Kf.data.targets,a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Kf.data.xs},Kf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){eb(b,a[b])}),Gb())},Kf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Fh=+a.x),b(a.y)&&(Mh=+a.y),b(a.y2)&&(Vh=+a.y2)):Mh=Vh=+a,nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Kf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Gh=+a.x),b(a.y)&&(Nh=+a.y),b(a.y2)&&(Wh=+a.y2)):Nh=Wh=+a,nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Kf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Kf.axis.max(a.max),"undefined"!=typeof a.min&&Kf.axis.min(a.min))},Kf.legend.show=function(a){Cf(Fc(a)),nf({withLegend:!0})},Kf.legend.hide=function(a){Df(Fc(a)),nf({withLegend:!0})},Kf.resize=function(a){Nf=a?a.width:null,Of=a?a.height:null,tf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Kf.destroy=function(){Kf.data.targets=void 0,Kf.data.xs={},Cj.html(""),a.onresize=null},"url"in f.data)Jf.xhr(f.data.url,function(a,b){var c,d=Jf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Jf.csv.parse(b.response),ef(c)});else if("rows"in f.data)ef(vc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");ef(wc(f.data.columns))}return Kf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(window); \ No newline at end of file From 124cd7dbaeab115081cd7e73a68616b08b2f0ee3 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Fri, 9 May 2014 13:22:44 +0900 Subject: [PATCH 154/178] Update sample for region --- htdocs/samples/regions.html | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/htdocs/samples/regions.html b/htdocs/samples/regions.html index 85c9745..27e6244 100644 --- a/htdocs/samples/regions.html +++ b/htdocs/samples/regions.html @@ -33,7 +33,6 @@ } }); -/* setTimeout(function () { chart.load({ columns: [ @@ -41,7 +40,20 @@ ] }); }, 1000); -*/ + + setTimeout(function () { + chart.regions([]); + }, 2000); + + setTimeout(function () { + chart.regions([{start:0.5,end:2.5}]); + }, 3000); + + setTimeout(function () { + chart.regions.add([{start:4.5}]); + }, 4000); + + From b5cc74f9655a24a6d083eaf48343f6ed96e3d092 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Fri, 9 May 2014 13:29:26 +0900 Subject: [PATCH 155/178] Update version to 0.1.37 --- bower.json | 2 +- c3.js | 2 +- c3.min.js | 2 +- package.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bower.json b/bower.json index 3e73d61..50a063b 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "c3", "main": "c3.min.js", - "version": "0.1.36", + "version": "0.1.37", "homepage": "https://github.com/masayuki0812/c3", "authors": [ "Masayuki Tanaka " diff --git a/c3.js b/c3.js index 457b939..0980d59 100644 --- a/c3.js +++ b/c3.js @@ -2,7 +2,7 @@ 'use strict'; var c3 = { - version: "0.1.36" + version: "0.1.37" }; var CLASS = { diff --git a/c3.min.js b/c3.min.js index 9d3346b..9ebcd27 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.ceil(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.ceil(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&acg&&(cg=0),0>eg&&(eg=0),dg=sh?_f.left-oj-pj:cg,fg=sh?eg:hg-ag.top-ag.bottom,0>dg&&(dg=0),0>fg&&(fg=0),lg=cg-(jj?b+10:0),mg=eg-(jj?0:10),r(),jj&&d&&(bg.left=lg/2+1.1*jg)}function q(){yj.select("line."+g.xgridFocus).attr("x1",sh?0:-10).attr("x2",sh?cg:-10).attr("y1",sh?-10:_f.top).attr("y2",sh?-10:eg)}function r(){jg=Math.min(lg,mg)/2,ig=.95*jg,kg=ie(Kf.data.targets)?.6*ig:0}function s(){var a=sh?g.axisX:g.axisY,b=yj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Jf.select(Mf).node().getBoundingClientRect(),e=je(Kf.data.targets),f=c.right-d.left-(e?0:v());return f>0?f:0}function t(){return Nf?Nf:z()}function u(){var a=Of?Of:A();return a>0?a:320}function v(){var a=1;return Pf?Pf:sh?th?x("x"):a:!Lh||Qh?a:x("y")}function w(){var a=1;return Qf?Qf:jj?R()+20+(Uh&&!sh?x("y2"):a):Uh?Zh||sh?a:x("y2"):a}function x(a){var b=mb(a);return b.isInner?20+Fb(a):40+Fb(a)}function y(a){return"x"!==a||th?"x"===a&&Ih?Ih:"y"!==a||Lh?"y2"!==a||Uh?(mb(a).isInner?30:40)+("y2"===a?-10:0):qj:mh&&!jj?10:1:0}function z(){return+Jf.select(Mf).style("width").replace("px","")}function A(){return+Jf.select(Mf).style("height").replace("px","")}function B(a){return a?-31:-(_f.left-1)}function C(a){return a?-20:-4}function D(){return B(!sh)}function E(){return C(!sh)}function F(){return B(sh)}function G(){return C(sh)}function H(a){return a?cg+2+30+30:_f.left+20}function I(a){return a?(Ih?Ih:0)+80:eg+8}function J(){return H(!sh)}function K(){return I(!sh)}function L(){return H(sh)}function M(){return I(sh)}function N(){var a,b,c,d,e,f=Cc(Kf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=zg(b.x)-zg(a.x),0===c?sh?eg:cg:(d=Bc(),e=fe(Kf.data.targets)?(d-(Si?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function O(a){kj=a}function P(a){lj=a}function Q(a){mj=a}function R(){return mh?jj?lj*(kj+1):gg:0}function S(){return mh?jj?hg:mj*(kj+1):0}function T(){var a,b,c=!zg;rg=sh?1:0,sg=sh?eg:cg,tg=sh?0:eg,ug=sh?cg:1,vg=rg,wg=sg,xg=sh?0:fg,yg=sh?dg:1,zg=W(rg,sg,c?void 0:zg.domain(),function(){return Fg.tickOffset()}),Ag=X(tg,ug,c?void 0:Ag.domain()),Bg=X(tg,ug,c?void 0:Bg.domain()),Cg=W(rg,sg,Dj,function(a){return a%1?0:Ig.tickOffset()}),Dg=X(xg,yg,c?void 0:Dg.domain()),Eg=X(xg,yg,c?void 0:Eg.domain()),a=bb(),b=Dh?Dh:c?void 0:Fg.tickValues(),Fg=$(zg,ej,a,b),Ig=$(Cg,hj,a,b),Gg=_(Ag,fj,Rh,Th),Hg=_(Bg,gj,$h,ai),c||(rj.scale(Cg),Tf&&vj.scale(zg)),U()}function U(){ng=Ib(),og=Jb(),pg=Jb(.98)}function V(a,b,c){return(c?Jf.time.scale():Jf.scale.linear()).range([a,b])}function W(a,b,c,d){var e,f=V(a,b,Ri),g=c?f.domain(c):f;Si?(d=d||function(){return 0},f=function(a,b){var c=g(a)+d(a);return b?c:Math.ceil(c)}):f=function(a,b){var c=g(a);return b?c:Math.ceil(c)};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return Dj&&Dj[0]===a[0]&&Dj[1]a?a.toFixed(0):a};return yh&&("function"==typeof yh?a=yh:Ri&&(a=function(a){return a?_i(yh)(a):""})),a}function cb(a){var b;return"y"===a?b=Ph:"y2"===a?b=Yh:"x"===a&&(b=Kh),b}function db(a){var b=cb(a);return"string"==typeof b?b:b?b.text:null}function eb(a,b){var c=cb(a);"string"==typeof c?"y"===a?Ph=b:"y2"===a?Yh=b:"x"===a&&(Kh=b):c&&(c.text=b)}function fb(a){return 10*Math.sin(Math.PI*(a/180))}function gb(a){return 11.5-2.5*(a/15)}function hb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",gb(c)).attr("x",fb(c)).attr("transform","rotate("+c+")")}function ib(a,b){var c=cb(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 jb(){return ib("x",sh?"inner-top":"inner-right")}function kb(){return ib("y",sh?"inner-right":"inner-top")}function lb(){return ib("y2",sh?"inner-right":"inner-top")}function mb(a){return"y2"===a?lb():"y"===a?kb():jb()}function nb(){return db("x")}function ob(){return db("y")}function pb(){return db("y2")}function qb(a,b){return a?b.isLeft?0:b.isCenter?cg/2:cg:b.isBottom?-eg:b.isMiddle?-eg/2:0}function rb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function sb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function tb(){return qb(!sh,jb())}function ub(){return qb(sh,kb())}function vb(){return qb(sh,lb())}function wb(){return rb(!sh,jb())}function xb(){return rb(sh,kb())}function yb(){return rb(sh,lb())}function zb(){var a=jb();return sh?a.isInner?"1.2em":-25-Fb("x"):a.isInner?"-0.5em":Ih?Ih-10:"3em"}function Ab(){var a=kb();return sh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Fb("y")}function Bb(){var a=lb();return sh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Fb("y2")}function Cb(){return sb(!sh,jb())}function Db(){return sb(sh,kb())}function Eb(){return sb(sh,lb())}function Fb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Jf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Gb(a){var b=yj.select("."+g.axisX+" ."+g.axisXLabel),c=yj.select("."+g.axisY+" ."+g.axisYLabel),d=yj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",tb).attr("dx",wb).attr("dy",zb).text(nb),(a?c.transition():c).attr("x",ub).attr("dx",xb).attr("dy",Ab).attr("dy",Ab).text(ob),(a?d.transition():d).attr("x",vb).attr("dx",yb).attr("dy",Bb).text(pb)}function Hb(a){var b=!1;return qg(Jc(Kf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Ib(){var a=Jf.svg.arc().outerRadius(ig).innerRadius(kg),b=function(b,c){var d;return c?a(b):(d=Hb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Jb(a){var b=Jf.svg.arc().outerRadius(jg*(a?a:1)).innerRadius(kg);return function(a){var c=Hb(a);return c?b(c):"M 0 0"}}function Kb(a,b){return qe(a.data)?ng(a,b):"M 0 0"}function Lb(a){var b,c,d,e,f=Hb(a),g="";return f&&(b=ng.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*ig*.8+","+d/e*ig*.8+")"),g}function Mb(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Nb(a){return rc({id:a.data.id,value:a.value,ratio:Mb(a)})}function Ob(a){var b,c,d,e;return Rb()?(b=Hb(a),c=b?b.value:null,d=Mb(b),e=Sb(),e?e(c,d):Ed(c,d)):""}function Pb(a,b){var c=wj.selectAll("."+g.chartArc+qd(a)),d=wj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});we(a)&&c.selectAll("path").transition().duration(50).attr("d",og).transition().duration(100).attr("d",pg).each(function(a){pe(a.data)}),b||d.style("opacity",.3)}function Qb(a){var b=wj.selectAll("."+g.chartArc+qd(a));b.selectAll("path").transition().duration(50).attr("d",ng),wj.selectAll("."+g.arc).style("opacity",1)}function Rb(){return ie(Kf.data.targets)?wi:qi}function Sb(){return ie(Kf.data.targets)?xi:ri}function Tb(){return ie(Kf.data.targets)?zi:""}function Ub(){var a=ie(Kf.data.targets)?Ai:ti;return"function"==typeof a?a:function(){}}function Vb(){var a=ie(Kf.data.targets)?Bi:ui;return"function"==typeof a?a:function(){}}function Wb(){var a=ie(Kf.data.targets)?Ci:vi;return"function"==typeof a?a:function(){}}function Xb(a){var b,c,d,e,f,g,h=Ec(a),i=Qc(a);if(Pg.length>0)for(g=Sc(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 Jf.min(Object.keys(i).map(function(a){return Jf.min(i[a])}))}function Yb(a){var b,c,d,e,f,g,h=Ec(a),i=Qc(a);if(Pg.length>0)for(g=Tc(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 Jf.max(Object.keys(i).map(function(a){return Jf.max(i[a])}))}function Zb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return ab(a.id)===c}),m="y2"===c?Wh:Nh,n="y2"===c?Vh:Mh,o=b(m)?m:Xb(l),p=b(n)?n:Yb(l),q="y2"===c?Xh:Oh,r=yd()&&sh;return 0===l.length?"y2"===c?Bg.domain():Ag.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=zd(o,p),j=cc(Ag.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Sh&&(f=b(Sh.top)?Sh.top:e,g=b(Sh.bottom)?Sh.bottom:e),"y2"===c&&_h&&(f=b(_h.top)?_h.top:e,g=b(_h.bottom)?_h.bottom:e),fe(l)&&!Sc(l)&&(g=o),[o-g,p+f])}function $b(a){return Gh?Ri?ye(Gh):Gh:Jf.min(a,function(a){return Jf.min(a.values,function(a){return a.x})})}function _b(a){return Fh?Ri?ye(Fh):Fh:Jf.max(a,function(a){return Jf.max(a.values,function(a){return a.x})})}function ac(a){var c,d,e,f,g=Dc(a),h=g[1]-g[0];return Si?d=0:fe(a)?(c=Bc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Hh&&De(Hh)?(e=b(Hh.left)?Hh.left:d,f=b(Hh.right)?Hh.right:d):e=f="number"==typeof Hh?Hh:d,{left:e,right:f}}function bc(a){var b=[$b(a),_b(a)],c=b[0],d=b[1],e=ac(a),f=0,g=0;return c-d!==0||Si||(c=Ri?new Date(.5*c.getTime()):-.5,d=Ri?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Ri?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Ri?new Date(d.getTime()+e.right):d+e.right),[f,g]}function cc(a){return a[1]-a[0]}function dc(a){for(var b=0;bb?0:b-c}function jc(a){var b,c=hc(a),d="y"===a.axis?Ag:Bg;return b="y"===a.axis||"y2"===a.axis?sh?eg:"start"in a?d(a.start):eg:sh?"end"in a?zg(Ri?ye(a.end):a.end):eg:eg,c>b?0:b-c}function kc(a){return Jg&&a===Jg||De(Kg)&&Ee(Kg,a)}function lc(a){return!kc(a)}function mc(a){return Jg?Jg:De(Kg)?Kg[a]:null}function nc(a,b){var c,d=b&&De(b)?Ec(b):[];return d.forEach(function(b){mc(b)===a&&(c=Kf.data.xs[b])}),c}function oc(a,b){return a in Kf.data.xs&&Kf.data.xs[a]&&Kf.data.xs[a][b]?Kf.data.xs[a][b]:b}function pc(a){Object.keys(a).forEach(function(b){Kg[b]=a[b]})}function qc(a){return 1===Jf.set(Object.keys(a).map(function(b){return a[b]})).size()}function rc(a){var b;return a&&(b=Ng[a.id],a.name=b?b:a.id),a}function sc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=uc(b[d],a.id,d)}),Kf.data.xs[a.id]=b})}function tc(a,b){a.forEach(function(a){b[a.id]&&sc([a],b[a.id])})}function uc(a,c,d){var e;return e=Ri?a?a instanceof Date?a:ye(a):ye(oc(c,d)):Ti&&!Si?b(a)?+a:oc(c,d):d}function vc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Kf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Jg?(d=Object.keys(Kf.data.xs),Kf.data.xs[c]=d.length>0?Kf.data.xs[d[0]]:void 0):De(Kg)&&(Kf.data.xs[c]=nc(f,Kf.data.targets)):Kf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Kf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Mg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=mc(b),g=a[f],h=uc(g,b,e);return Ti&&Si&&0===c&&g&&(0===e&&(wh=[]),wh.push(g)),("undefined"==typeof a[b]||Kf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Rg&&de(Ec(c).filter(function(a){return!(a in Sg)}),Rg),c.forEach(function(a){ec(a.id_org,a)}),c}function yc(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 zc(a){return a>0&&Kf.data.targets[0].values[a-1]?Kf.data.targets[0].values[a-1].x:void 0}function Ac(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Dc(a){var b,c,d=Cc(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Ec(a){return a.map(function(a){return a.id})}function Fc(a){return a?"string"==typeof a?[a]:a:Ec(Kf.data.targets)}function Gc(a,b){var c,d=Ec(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Ri?new Date(i):i);j.push(e)}return Ri||(j=j.sort(function(a,b){return a-b})),j}function Mc(a){bj=bj.concat(a)}function Nc(a){bj=bj.filter(function(b){return a.indexOf(b)<0})}function Oc(a){cj=cj.concat(a)}function Pc(a){cj=cj.filter(function(b){return a.indexOf(b)<0})}function Qc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Rc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Tc(a){return Rc(a,function(a){return a>0})}function Uc(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||0===a[f].x)&&(e=e.concat(Kd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Kd(a,g))),Nd(e,b)):Ld(a,b,f,g)}function Md(a,b){var c;return c=a.map(function(a){return Ld(a.values,b)}),Nd(c,b)}function Nd(a,b){var c,d;return a.forEach(function(a){var e=Fe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Od(a,b){return Jf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Pd(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 Qd(){return Ug&&"desc"===Ug.toLowerCase()}function Rd(){return Ug&&"asc"===Ug.toLowerCase()}function Sd(a){var b=Rd(),c=Qd();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 Ug&&a.sort(Ug),a}function Td(a,c){var d,e,f,g,h,i,j,k=je(Kf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&Ei&&(Bj.html(Hi(a,bb(),Ad(k),$i)).style("display","block"),d=Bj.property("offsetWidth"),e=Bj.property("offsetHeight"),k?(g=cg/2+c[0],i=eg/2+c[1]+20):(sh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-w(),i=zg(l[0].x)+20):(f=s(),g=f+v()+zg(l[0].x)+20,h=g+d,j=f+t()-w(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),Bj.style("top",i+"px").style("left",g+"px"))}function Ud(){Bj.style("display","none")}function Vd(a){var c=a.filter(function(a){return a&&b(a.value)});if(Ei&&!ge(Kf.data.targets)&&!je(Kf.data.targets)){var d=yj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(sh?"y1":"x1",Gd).attr(sh?"y2":"x2",Gd),mf(d,"grid")}}function Wd(){yj.select("line."+g.xgridFocus).style("visibility","hidden")}function Xd(a,b){var c,d,e,f,h=[],i=yj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=bc(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function Yd(a){return a.x||0===a.x?zg(a.x):null}function Zd(a){return Y(a.id)(a.value)}function $d(){var a,b,d={},e=0;return Jc(Kf.data.targets.filter(me)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ce(a,b){return"number"==typeof oi?oi:b?2*a.tickOffset()*pi/b:0}function de(a,b){Fc(a).forEach(function(a){Fj[a]=b===Sg[a],Sg[a]=b})}function ee(a,b){var c=!1;return a.forEach(function(a){Sg[a.id]===b&&(c=!0),a.id in Sg||"line"!==b||(c=!0)}),c}function fe(a){return ee(a,"bar")}function ge(a){return ee(a,"scatter")}function he(a){return ee(a,"pie")}function ie(a){return ee(a,"donut")}function je(a){return he(a)||ie(a)}function ke(a){var b="string"==typeof a?a:a.id;return!(b in Sg)||"line"===Sg[b]||"spline"===Sg[b]||"area"===Sg[b]||"area-spline"===Sg[b]}function le(a){var b="string"==typeof a?a:a.id;return"spline"===Sg[b]||"area-spline"===Sg[b]}function me(a){var b="string"==typeof a?a:a.id;return"bar"===Sg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"scatter"===Sg[b]}function oe(a){var b="string"==typeof a?a:a.id;return"pie"===Sg[b]}function pe(a){var b="string"==typeof a?a:a.id;return"donut"===Sg[b]}function qe(a){return oe(a)||pe(a)}function re(a){return ke(a)?[a]:[]}function se(a){return qe(a.data)?[a]:[]}function te(a){return me(a)?a.values:[]}function ue(a){return ke(a)||ne(a)?a.values:[]}function ve(a){return me(a)||ke(a)?a.values:[]}function we(a){return pe(a)&&yi||oe(a)&&si}function xe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ye(b){var c;try{c=Lg?Jf.time.format(Lg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Lg)}return c}function ze(a,b){var c=Jf.mouse(a),d=Jf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ee(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Fe(a,b){var c="y"===ab(a.id)?Ag:Bg,d=sh?1:0,e=sh?0:1;return Math.pow(zg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ge(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function He(a,b,c){return d(a[b])?a[b]:c}function Ie(a,b,c){fh(b,a.node()),yj.select("."+g.selectedCircles+pd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Vc(g.selectedCircle,c)}).attr("cx",sh?Zd:Yd).attr("cy",sh?Yd:Zd).attr("stroke",function(){return $i(b)}).attr("r",1.4*Te(b)).transition().duration(100).attr("r",Te)}function Je(a,b,c){gh(b,a.node()),yj.select("."+g.selectedCircles+pd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ke(a,b,c,d){a?Ie(b,c,d):Je(b,c,d)}function Le(a,b){fh(b,a.node()),a.transition().duration(100).style("fill",function(){return Jf.rgb($i(b)).brighter(.75)})}function Me(a,b){gh(b,a.node()),a.transition().duration(100).style("fill",function(){return $i(b)})}function Ne(a,b,c,d){a?Le(b,c,d):Me(b,c,d)}function Oe(a,b,c,d){Ne(a,b,c.data,d)}function Pe(a){return"circle"===a.nodeName?Ke:Jf.select(a).classed(g.bar)?Ne:Oe}function Qe(a){return a.filter(function(a){return b(a.value)})}function Re(a){return hi?"function"==typeof ii?ii(a):ii:0}function Se(a){return ki?li?li:1.75*Re(a):Re(a)}function Te(a){return mi?mi:4*Re(a)}function Ue(a,c){return(c?yj.selectAll("."+g.circles+pd(c)):yj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ve(a,b){Ue(a,b).classed(g.EXPANDED,!0).attr("r",Se)}function We(a){Ue(a).filter(function(){return Jf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Re)}function Xe(a){return yj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function Ye(a){Xe(a).classed(g.EXPANDED,!0)}function Ze(a){Xe(a).classed(g.EXPANDED,!1)}function $e(a,b){var c=cf(a,b);return function(a,b){var d=c(a,b),e=sh?1:0,f=sh?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 _e(a,b){var c=cf(a,!1),d=b?af:bf;return function(a,b){return d(c(a,b),a,this)}}function af(a,b){var c;return sh?(c=me(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function bf(a,b,c){var d=c.getBoundingClientRect();return sh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:me(b)?-3:-6)}function cf(a,b){var c=a.__max__+1,d=ce(Fg,c),e=_d(d,c,a,!!b),f=ae(!!b),g=be(a,!!b),h=b?Z:Y;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return sh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function df(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;gb?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&acg&&(cg=0),0>eg&&(eg=0),dg=sh?_f.left-oj-pj:cg,fg=sh?eg:hg-ag.top-ag.bottom,0>dg&&(dg=0),0>fg&&(fg=0),lg=cg-(jj?b+10:0),mg=eg-(jj?0:10),r(),jj&&d&&(bg.left=lg/2+1.1*jg)}function q(){yj.select("line."+g.xgridFocus).attr("x1",sh?0:-10).attr("x2",sh?cg:-10).attr("y1",sh?-10:_f.top).attr("y2",sh?-10:eg)}function r(){jg=Math.min(lg,mg)/2,ig=.95*jg,kg=ie(Kf.data.targets)?.6*ig:0}function s(){var a=sh?g.axisX:g.axisY,b=yj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Jf.select(Mf).node().getBoundingClientRect(),e=je(Kf.data.targets),f=c.right-d.left-(e?0:v());return f>0?f:0}function t(){return Nf?Nf:z()}function u(){var a=Of?Of:A();return a>0?a:320}function v(){var a=1;return Pf?Pf:sh?th?x("x"):a:!Lh||Qh?a:x("y")}function w(){var a=1;return Qf?Qf:jj?R()+20+(Uh&&!sh?x("y2"):a):Uh?Zh||sh?a:x("y2"):a}function x(a){var b=mb(a);return b.isInner?20+Fb(a):40+Fb(a)}function y(a){return"x"!==a||th?"x"===a&&Ih?Ih:"y"!==a||Lh?"y2"!==a||Uh?(mb(a).isInner?30:40)+("y2"===a?-10:0):qj:mh&&!jj?10:1:0}function z(){return+Jf.select(Mf).style("width").replace("px","")}function A(){return+Jf.select(Mf).style("height").replace("px","")}function B(a){return a?-31:-(_f.left-1)}function C(a){return a?-20:-4}function D(){return B(!sh)}function E(){return C(!sh)}function F(){return B(sh)}function G(){return C(sh)}function H(a){return a?cg+2+30+30:_f.left+20}function I(a){return a?(Ih?Ih:0)+80:eg+8}function J(){return H(!sh)}function K(){return I(!sh)}function L(){return H(sh)}function M(){return I(sh)}function N(){var a,b,c,d,e,f=Cc(Kf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=zg(b.x)-zg(a.x),0===c?sh?eg:cg:(d=Bc(),e=fe(Kf.data.targets)?(d-(Si?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function O(a){kj=a}function P(a){lj=a}function Q(a){mj=a}function R(){return mh?jj?lj*(kj+1):gg:0}function S(){return mh?jj?hg:mj*(kj+1):0}function T(){var a,b,c=!zg;rg=sh?1:0,sg=sh?eg:cg,tg=sh?0:eg,ug=sh?cg:1,vg=rg,wg=sg,xg=sh?0:fg,yg=sh?dg:1,zg=W(rg,sg,c?void 0:zg.domain(),function(){return Fg.tickOffset()}),Ag=X(tg,ug,c?void 0:Ag.domain()),Bg=X(tg,ug,c?void 0:Bg.domain()),Cg=W(rg,sg,Dj,function(a){return a%1?0:Ig.tickOffset()}),Dg=X(xg,yg,c?void 0:Dg.domain()),Eg=X(xg,yg,c?void 0:Eg.domain()),a=bb(),b=Dh?Dh:c?void 0:Fg.tickValues(),Fg=$(zg,ej,a,b),Ig=$(Cg,hj,a,b),Gg=_(Ag,fj,Rh,Th),Hg=_(Bg,gj,$h,ai),c||(rj.scale(Cg),Tf&&vj.scale(zg)),U()}function U(){ng=Ib(),og=Jb(),pg=Jb(.98)}function V(a,b,c){return(c?Jf.time.scale():Jf.scale.linear()).range([a,b])}function W(a,b,c,d){var e,f=V(a,b,Ri),g=c?f.domain(c):f;Si?(d=d||function(){return 0},f=function(a,b){var c=g(a)+d(a);return b?c:Math.ceil(c)}):f=function(a,b){var c=g(a);return b?c:Math.ceil(c)};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return Dj&&Dj[0]===a[0]&&Dj[1]a?a.toFixed(0):a};return yh&&("function"==typeof yh?a=yh:Ri&&(a=function(a){return a?_i(yh)(a):""})),a}function cb(a){var b;return"y"===a?b=Ph:"y2"===a?b=Yh:"x"===a&&(b=Kh),b}function db(a){var b=cb(a);return"string"==typeof b?b:b?b.text:null}function eb(a,b){var c=cb(a);"string"==typeof c?"y"===a?Ph=b:"y2"===a?Yh=b:"x"===a&&(Kh=b):c&&(c.text=b)}function fb(a){return 10*Math.sin(Math.PI*(a/180))}function gb(a){return 11.5-2.5*(a/15)}function hb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",gb(c)).attr("x",fb(c)).attr("transform","rotate("+c+")")}function ib(a,b){var c=cb(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 jb(){return ib("x",sh?"inner-top":"inner-right")}function kb(){return ib("y",sh?"inner-right":"inner-top")}function lb(){return ib("y2",sh?"inner-right":"inner-top")}function mb(a){return"y2"===a?lb():"y"===a?kb():jb()}function nb(){return db("x")}function ob(){return db("y")}function pb(){return db("y2")}function qb(a,b){return a?b.isLeft?0:b.isCenter?cg/2:cg:b.isBottom?-eg:b.isMiddle?-eg/2:0}function rb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function sb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function tb(){return qb(!sh,jb())}function ub(){return qb(sh,kb())}function vb(){return qb(sh,lb())}function wb(){return rb(!sh,jb())}function xb(){return rb(sh,kb())}function yb(){return rb(sh,lb())}function zb(){var a=jb();return sh?a.isInner?"1.2em":-25-Fb("x"):a.isInner?"-0.5em":Ih?Ih-10:"3em"}function Ab(){var a=kb();return sh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Fb("y")}function Bb(){var a=lb();return sh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Fb("y2")}function Cb(){return sb(!sh,jb())}function Db(){return sb(sh,kb())}function Eb(){return sb(sh,lb())}function Fb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Jf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Gb(a){var b=yj.select("."+g.axisX+" ."+g.axisXLabel),c=yj.select("."+g.axisY+" ."+g.axisYLabel),d=yj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",tb).attr("dx",wb).attr("dy",zb).text(nb),(a?c.transition():c).attr("x",ub).attr("dx",xb).attr("dy",Ab).attr("dy",Ab).text(ob),(a?d.transition():d).attr("x",vb).attr("dx",yb).attr("dy",Bb).text(pb)}function Hb(a){var b=!1;return qg(Jc(Kf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Ib(){var a=Jf.svg.arc().outerRadius(ig).innerRadius(kg),b=function(b,c){var d;return c?a(b):(d=Hb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Jb(a){var b=Jf.svg.arc().outerRadius(jg*(a?a:1)).innerRadius(kg);return function(a){var c=Hb(a);return c?b(c):"M 0 0"}}function Kb(a,b){return qe(a.data)?ng(a,b):"M 0 0"}function Lb(a){var b,c,d,e,f=Hb(a),g="";return f&&(b=ng.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*ig*.8+","+d/e*ig*.8+")"),g}function Mb(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Nb(a){return rc({id:a.data.id,value:a.value,ratio:Mb(a)})}function Ob(a){var b,c,d,e;return Rb()?(b=Hb(a),c=b?b.value:null,d=Mb(b),e=Sb(),e?e(c,d):Ed(c,d)):""}function Pb(a,b){var c=wj.selectAll("."+g.chartArc+qd(a)),d=wj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});we(a)&&c.selectAll("path").transition().duration(50).attr("d",og).transition().duration(100).attr("d",pg).each(function(a){pe(a.data)}),b||d.style("opacity",.3)}function Qb(a){var b=wj.selectAll("."+g.chartArc+qd(a));b.selectAll("path").transition().duration(50).attr("d",ng),wj.selectAll("."+g.arc).style("opacity",1)}function Rb(){return ie(Kf.data.targets)?wi:qi}function Sb(){return ie(Kf.data.targets)?xi:ri}function Tb(){return ie(Kf.data.targets)?zi:""}function Ub(){var a=ie(Kf.data.targets)?Ai:ti;return"function"==typeof a?a:function(){}}function Vb(){var a=ie(Kf.data.targets)?Bi:ui;return"function"==typeof a?a:function(){}}function Wb(){var a=ie(Kf.data.targets)?Ci:vi;return"function"==typeof a?a:function(){}}function Xb(a){var b,c,d,e,f,g,h=Ec(a),i=Qc(a);if(Pg.length>0)for(g=Sc(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 Jf.min(Object.keys(i).map(function(a){return Jf.min(i[a])}))}function Yb(a){var b,c,d,e,f,g,h=Ec(a),i=Qc(a);if(Pg.length>0)for(g=Tc(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 Jf.max(Object.keys(i).map(function(a){return Jf.max(i[a])}))}function Zb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return ab(a.id)===c}),m="y2"===c?Wh:Nh,n="y2"===c?Vh:Mh,o=b(m)?m:Xb(l),p=b(n)?n:Yb(l),q="y2"===c?Xh:Oh,r=yd()&&sh;return 0===l.length?"y2"===c?Bg.domain():Ag.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=zd(o,p),j=cc(Ag.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Sh&&(f=b(Sh.top)?Sh.top:e,g=b(Sh.bottom)?Sh.bottom:e),"y2"===c&&_h&&(f=b(_h.top)?_h.top:e,g=b(_h.bottom)?_h.bottom:e),fe(l)&&!Sc(l)&&(g=o),[o-g,p+f])}function $b(a){return Gh?Ri?ye(Gh):Gh:Jf.min(a,function(a){return Jf.min(a.values,function(a){return a.x})})}function _b(a){return Fh?Ri?ye(Fh):Fh:Jf.max(a,function(a){return Jf.max(a.values,function(a){return a.x})})}function ac(a){var c,d,e,f,g=Dc(a),h=g[1]-g[0];return Si?d=0:fe(a)?(c=Bc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Hh&&De(Hh)?(e=b(Hh.left)?Hh.left:d,f=b(Hh.right)?Hh.right:d):e=f="number"==typeof Hh?Hh:d,{left:e,right:f}}function bc(a){var b=[$b(a),_b(a)],c=b[0],d=b[1],e=ac(a),f=0,g=0;return c-d!==0||Si||(c=Ri?new Date(.5*c.getTime()):-.5,d=Ri?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Ri?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Ri?new Date(d.getTime()+e.right):d+e.right),[f,g]}function cc(a){return a[1]-a[0]}function dc(a){for(var b=0;bb?0:b-c}function jc(a){var b,c=hc(a),d="y"===a.axis?Ag:Bg;return b="y"===a.axis||"y2"===a.axis?sh?eg:"start"in a?d(a.start):eg:sh?"end"in a?zg(Ri?ye(a.end):a.end):eg:eg,c>b?0:b-c}function kc(a){return Jg&&a===Jg||De(Kg)&&Ee(Kg,a)}function lc(a){return!kc(a)}function mc(a){return Jg?Jg:De(Kg)?Kg[a]:null}function nc(a,b){var c,d=b&&De(b)?Ec(b):[];return d.forEach(function(b){mc(b)===a&&(c=Kf.data.xs[b])}),c}function oc(a,b){return a in Kf.data.xs&&Kf.data.xs[a]&&Kf.data.xs[a][b]?Kf.data.xs[a][b]:b}function pc(a){Object.keys(a).forEach(function(b){Kg[b]=a[b]})}function qc(a){return 1===Jf.set(Object.keys(a).map(function(b){return a[b]})).size()}function rc(a){var b;return a&&(b=Ng[a.id],a.name=b?b:a.id),a}function sc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=uc(b[d],a.id,d)}),Kf.data.xs[a.id]=b})}function tc(a,b){a.forEach(function(a){b[a.id]&&sc([a],b[a.id])})}function uc(a,c,d){var e;return e=Ri?a?a instanceof Date?a:ye(a):ye(oc(c,d)):Ti&&!Si?b(a)?+a:oc(c,d):d}function vc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Kf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Jg?(d=Object.keys(Kf.data.xs),Kf.data.xs[c]=d.length>0?Kf.data.xs[d[0]]:void 0):De(Kg)&&(Kf.data.xs[c]=nc(f,Kf.data.targets)):Kf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Kf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Mg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=mc(b),g=a[f],h=uc(g,b,e);return Ti&&Si&&0===c&&g&&(0===e&&(wh=[]),wh.push(g)),("undefined"==typeof a[b]||Kf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Rg&&de(Ec(c).filter(function(a){return!(a in Sg)}),Rg),c.forEach(function(a){ec(a.id_org,a)}),c}function yc(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 zc(a){return a>0&&Kf.data.targets[0].values[a-1]?Kf.data.targets[0].values[a-1].x:void 0}function Ac(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Dc(a){var b,c,d=Cc(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Ec(a){return a.map(function(a){return a.id})}function Fc(a){return a?"string"==typeof a?[a]:a:Ec(Kf.data.targets)}function Gc(a,b){var c,d=Ec(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Ri?new Date(i):i);j.push(e)}return Ri||(j=j.sort(function(a,b){return a-b})),j}function Mc(a){bj=bj.concat(a)}function Nc(a){bj=bj.filter(function(b){return a.indexOf(b)<0})}function Oc(a){cj=cj.concat(a)}function Pc(a){cj=cj.filter(function(b){return a.indexOf(b)<0})}function Qc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Rc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Tc(a){return Rc(a,function(a){return a>0})}function Uc(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||0===a[f].x)&&(e=e.concat(Kd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Kd(a,g))),Nd(e,b)):Ld(a,b,f,g)}function Md(a,b){var c;return c=a.map(function(a){return Ld(a.values,b)}),Nd(c,b)}function Nd(a,b){var c,d;return a.forEach(function(a){var e=Fe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Od(a,b){return Jf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Pd(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 Qd(){return Ug&&"desc"===Ug.toLowerCase()}function Rd(){return Ug&&"asc"===Ug.toLowerCase()}function Sd(a){var b=Rd(),c=Qd();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 Ug&&a.sort(Ug),a}function Td(a,c){var d,e,f,g,h,i,j,k=je(Kf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&Ei&&(Bj.html(Hi(a,bb(),Ad(k),$i)).style("display","block"),d=Bj.property("offsetWidth"),e=Bj.property("offsetHeight"),k?(g=cg/2+c[0],i=eg/2+c[1]+20):(sh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-w(),i=zg(l[0].x)+20):(f=s(),g=f+v()+zg(l[0].x)+20,h=g+d,j=f+t()-w(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),Bj.style("top",i+"px").style("left",g+"px"))}function Ud(){Bj.style("display","none")}function Vd(a){var c=a.filter(function(a){return a&&b(a.value)});if(Ei&&!ge(Kf.data.targets)&&!je(Kf.data.targets)){var d=yj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(sh?"y1":"x1",Gd).attr(sh?"y2":"x2",Gd),mf(d,"grid")}}function Wd(){yj.select("line."+g.xgridFocus).style("visibility","hidden")}function Xd(a,b){var c,d,e,f,h=[],i=yj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=bc(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function Yd(a){return a.x||0===a.x?zg(a.x):null}function Zd(a){return Y(a.id)(a.value)}function $d(){var a,b,d={},e=0;return Jc(Kf.data.targets.filter(me)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ce(a,b){return"number"==typeof oi?oi:b?2*a.tickOffset()*pi/b:0}function de(a,b){Fc(a).forEach(function(a){Fj[a]=b===Sg[a],Sg[a]=b})}function ee(a,b){var c=!1;return a.forEach(function(a){Sg[a.id]===b&&(c=!0),a.id in Sg||"line"!==b||(c=!0)}),c}function fe(a){return ee(a,"bar")}function ge(a){return ee(a,"scatter")}function he(a){return ee(a,"pie")}function ie(a){return ee(a,"donut")}function je(a){return he(a)||ie(a)}function ke(a){var b="string"==typeof a?a:a.id;return!(b in Sg)||"line"===Sg[b]||"spline"===Sg[b]||"area"===Sg[b]||"area-spline"===Sg[b]}function le(a){var b="string"==typeof a?a:a.id;return"spline"===Sg[b]||"area-spline"===Sg[b]}function me(a){var b="string"==typeof a?a:a.id;return"bar"===Sg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"scatter"===Sg[b]}function oe(a){var b="string"==typeof a?a:a.id;return"pie"===Sg[b]}function pe(a){var b="string"==typeof a?a:a.id;return"donut"===Sg[b]}function qe(a){return oe(a)||pe(a)}function re(a){return ke(a)?[a]:[]}function se(a){return qe(a.data)?[a]:[]}function te(a){return me(a)?a.values:[]}function ue(a){return ke(a)||ne(a)?a.values:[]}function ve(a){return me(a)||ke(a)?a.values:[]}function we(a){return pe(a)&&yi||oe(a)&&si}function xe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ye(b){var c;try{c=Lg?Jf.time.format(Lg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Lg)}return c}function ze(a,b){var c=Jf.mouse(a),d=Jf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ee(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Fe(a,b){var c="y"===ab(a.id)?Ag:Bg,d=sh?1:0,e=sh?0:1;return Math.pow(zg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ge(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function He(a,b,c){return d(a[b])?a[b]:c}function Ie(a,b,c){fh(b,a.node()),yj.select("."+g.selectedCircles+pd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Vc(g.selectedCircle,c)}).attr("cx",sh?Zd:Yd).attr("cy",sh?Yd:Zd).attr("stroke",function(){return $i(b)}).attr("r",1.4*Te(b)).transition().duration(100).attr("r",Te)}function Je(a,b,c){gh(b,a.node()),yj.select("."+g.selectedCircles+pd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ke(a,b,c,d){a?Ie(b,c,d):Je(b,c,d)}function Le(a,b){fh(b,a.node()),a.transition().duration(100).style("fill",function(){return Jf.rgb($i(b)).brighter(.75)})}function Me(a,b){gh(b,a.node()),a.transition().duration(100).style("fill",function(){return $i(b)})}function Ne(a,b,c,d){a?Le(b,c,d):Me(b,c,d)}function Oe(a,b,c,d){Ne(a,b,c.data,d)}function Pe(a){return"circle"===a.nodeName?Ke:Jf.select(a).classed(g.bar)?Ne:Oe}function Qe(a){return a.filter(function(a){return b(a.value)})}function Re(a){return hi?"function"==typeof ii?ii(a):ii:0}function Se(a){return ki?li?li:1.75*Re(a):Re(a)}function Te(a){return mi?mi:4*Re(a)}function Ue(a,c){return(c?yj.selectAll("."+g.circles+pd(c)):yj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ve(a,b){Ue(a,b).classed(g.EXPANDED,!0).attr("r",Se)}function We(a){Ue(a).filter(function(){return Jf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Re)}function Xe(a){return yj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function Ye(a){Xe(a).classed(g.EXPANDED,!0)}function Ze(a){Xe(a).classed(g.EXPANDED,!1)}function $e(a,b){var c=cf(a,b);return function(a,b){var d=c(a,b),e=sh?1:0,f=sh?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 _e(a,b){var c=cf(a,!1),d=b?af:bf;return function(a,b){return d(c(a,b),a,this)}}function af(a,b){var c;return sh?(c=me(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function bf(a,b,c){var d=c.getBoundingClientRect();return sh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:me(b)?-3:-6)}function cf(a,b){var c=a.__max__+1,d=ce(Fg,c),e=_d(d,c,a,!!b),f=ae(!!b),g=be(a,!!b),h=b?Z:Y;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return sh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function df(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function ef(b){var c,d,e;if(Cj=Jf.select(Mf),Cj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Cj.html("").classed("c3",!0),Kf.data.xs={},Kf.data.targets=xc(b),Zg&&(Kf.data.targets=Kf.data.targets.filter(Zg)),Yg&&Mc(Yg===!0?Ec(Kf.data.targets):Yg),p(),T(),zg.domain(Jf.extent(bc(Kf.data.targets))),Ag.domain(Zb(Kf.data.targets,"y")),Bg.domain(Zb(Kf.data.targets,"y2")),Cg.domain(zg.domain()),Dg.domain(Ag.domain()),Eg.domain(Bg.domain()),Dj=zg.domain(),rj.scale(Cg),Tf&&vj.scale(zg),wj=Cj.append("svg").on("mouseenter",Wf).on("mouseleave",Xf),xj=wj.append("defs"),xj.append("clipPath").attr("id",Li).append("rect"),xj.append("clipPath").attr("id",Mi).append("rect"),xj.append("clipPath").attr("id",Ni).append("rect"),rf(),yj=wj.append("g").attr("transform",ij.main),zj=wj.append("g").attr("transform",ij.context),Aj=wj.append("g").attr("transform",ij.legend),jh||zj.style("visibility","hidden"),mh||(Aj.style("visibility","hidden"),cj=Ec(Kf.data.targets)),Bj=Jf.select(Mf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Ef(Ec(Kf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=yj.append("g").attr("clip-path",Oi).attr("class",g.grid),bi&&d.append("g").attr("class",g.xgrids),De(di)&&d.append("g").attr("class",g.xgridLines),ji&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),ei&&d.append("g").attr("class",g.ygrids),De(fi)&&d.append("g").attr("class",g.ygridLines),yj.append("g").attr("clip-path",Oi).attr("class",g.regions),yj.append("g").attr("clip-path",Oi).attr("class",g.chart),c=yj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Tf?sh?"ns-resize":"ew-resize":null),yj.select("."+g.chart).append("g").attr("class",g.chartBars),yj.select("."+g.chart).append("g").attr("class",g.chartLines),yj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",ij.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Tb()),yj.select("."+g.chart).append("g").attr("class",g.chartTexts),Tf&&yj.insert("rect",Vf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",cg).attr("height",eg).style("opacity",0).style("cursor",sh?"ns-resize":"ew-resize").call(vj).on("dblclick.zoom",null),Jh&&rj.extent("function"!=typeof Jh?Jh:Jh(bc())),dj.x=yj.append("g").attr("class",g.axisX).attr("clip-path",Pi).attr("transform",ij.x).style("visibility",th?"visible":"hidden"),dj.x.append("text").attr("class",g.axisXLabel).attr("transform",sh?"rotate(-90)":"").style("text-anchor",Cb),dj.y=yj.append("g").attr("class",g.axisY).attr("clip-path",Qi).attr("transform",ij.y).style("visibility",Lh?"visible":"hidden"),dj.y.append("text").attr("class",g.axisYLabel).attr("transform",sh?"":"rotate(-90)").style("text-anchor",Db),dj.y2=yj.append("g").attr("class",g.axisY2).attr("transform",ij.y2).style("visibility",Uh?"visible":"hidden"),dj.y2.append("text").attr("class",g.axisY2Label).attr("transform",sh?"":"rotate(-90)").style("text-anchor",Eb),zj.append("g").attr("clip-path",Oi).attr("class",g.chart),zj.select("."+g.chart).append("g").attr("class",g.chartBars),zj.select("."+g.chart).append("g").attr("class",g.chartLines),zj.append("g").attr("clip-path",Oi).attr("class",g.brush).call(rj).selectAll("rect").attr(sh?"width":"height",sh?dg:fg),dj.subx=zj.append("g").attr("class",g.axisX).attr("transform",ij.subx).attr("clip-path",sh?"":Pi),uf(Kf.data.targets),sh?yj.select("."+g.axisX).style("opacity",0).call(Fg):(yj.select("."+g.axisY).style("opacity",0).call(Gg),yj.select("."+g.axisY2).style("opacity",0).call(Hg)),p(),T(),rf(),o(!1),nf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Ii){if(Ri&&"string"==typeof Ji){for(Ji=ye(Ji),e=0;e0){d=[];for(var f in Ng)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Pd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ne,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function kf(a){je(Kf.data.targets)||$g&&(Ui=a,yj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Vi=!0,hh())}function lf(){je(Kf.data.targets)||$g&&(yj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),yj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Vi=!1,ih())}function mf(a,b){"grid"===b&&a.each(function(){var a=Jf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function nf(a,c){var d,e,f,h,i,j,k,l,m,n,o,p,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,O,P,Q,R,S,T,U,V,W=$d(),X=je(Kf.data.targets),Y=Jc(Kf.data.targets);if(a=a||{},C=He(a,"withY",!0),D=He(a,"withSubchart",!0),E=He(a,"withTransition",!0),H=He(a,"withTransform",!1),I=He(a,"withUpdateXDomain",!1),J=He(a,"withUpdateOrgXDomain",!1),K=He(a,"withLegend",!1),F=He(a,"withTransitionForExit",E),G=He(a,"withTransitionForAxis",E),Q=E?$f:0,R=F?Q:0,S=G?Q:0,c=c||sf(S),K&&mh&&Ef(Ec(Kf.data.targets),a,c),Si&&0===Y.length&&zg.domain([0,dj.x.selectAll(".tick").size()]),Y.length&&(J&&(zg.domain(Jf.extent(bc(Y))),Dj=zg.domain(),Tf&&vj.scale(zg).updateScaleExtent(),Cg.domain(zg.domain()),rj.scale(Cg)),I&&(zg.domain(rj.empty()?Dj:rj.extent()),Tf&&vj.scale(zg).updateScaleExtent()),Dh||!Ch&&!Bh||(T=Lc(Kc(Y),Bh),Fg.tickValues(T),Ig.tickValues(T))),Ag.domain(Zb(Y,"y")),Bg.domain(Zb(Y,"y2")),dj.x.style("opacity",X?0:1),dj.y.style("opacity",X?0:1),dj.y2.style("opacity",X?0:1),dj.subx.style("opacity",X?0:1),c.axisX.call(Fg),c.axisY.call(Gg),c.axisY2.call(Hg),c.axisSubX.call(Ig),Gb(E),I&&Y.length)if(zh&&T){for(U=1;U=0&&Jf.select(this).style("display",b%V?"none":"block")})}else wj.selectAll("."+g.axisX+" .tick text").style("display","block");!sh&&Eh&&hb(dj.x,c.axisX,Eh),L=$e(W),O=_e(W,!0),P=_e(W,!1),Dg.domain(Ag.domain()),Eg.domain(Bg.domain()),Bj.style("display","none"),q(),yj.select("line."+g.xgridFocus).style("visibility","hidden"),bi&&(f=Xd(ci,zg),z=Si?Fg.tickOffset():0,e=sh?{x1:0,x2:cg,y1:function(a){return zg(a)-z},y2:function(a){return zg(a)-z}}:{x1:function(a){return zg(a)+z},x2:function(a){return zg(a)+z},y1:_f.top,y2:eg},d=yj.select("."+g.xgrids).selectAll("."+g.xgrid).data(f),d.enter().append("line").attr("class",g.xgrid),d.attr(e).style("opacity",function(){return+Jf.select(this).attr(sh?"y1":"x1")===(sh?eg:0)?0:1}),d.exit().remove()),De(di)&&(h=yj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(di),i=h.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),i.append("line").style("opacity",0),i.append("text").attr("text-anchor","end").attr("transform",sh?"":"rotate(-90)").attr("dx",sh?0:-_f.top).attr("dy",-5).style("opacity",0),h.select("line").transition().duration(Q).attr("x1",sh?0:Hd).attr("x2",sh?cg:Hd).attr("y1",sh?Hd:_f.top).attr("y2",sh?Hd:eg).style("opacity",1),h.select("text").transition().duration(Q).attr("x",sh?cg:0).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),h.exit().transition().duration(Q).style("opacity",0).remove()),C&&ei&&(j=yj.select("."+g.ygrids).selectAll("."+g.ygrid).data(Ag.ticks(gi)),j.enter().append("line").attr("class",g.ygrid),j.attr("x1",sh?Ag:0).attr("x2",sh?Ag:cg).attr("y1",sh?0:Ag).attr("y2",sh?eg:Ag),j.exit().remove(),mf(j,"grid")),C&&De(fi)&&(k=yj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(fi),l=k.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",sh?"rotate(-90)":"").attr("dx",sh?0:-_f.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(Q).attr("x1",sh?Id:0).attr("x2",sh?Id:cg).attr("y1",sh?0:Id).attr("y2",sh?eg:Id).style("opacity",1),k.select("text").transition().duration(Q).attr("x",sh?0:cg).attr("y",Id).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(Q).style("opacity",0).remove()),s=yj.select("."+g.regions).selectAll("."+g.region).data(Di),s.enter().append("g").attr("class",id).append("rect").style("fill-opacity",0),s.selectAll("rect").transition().duration(Q).attr("x",gc).attr("y",hc).attr("width",ic).attr("height",jc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(Q).style("opacity",0).remove(),p=yj.selectAll("."+g.bars).selectAll("."+g.bar).data(te),p.enter().append("path").attr("class",cd).style("stroke","none").style("fill",$i),p.style("opacity",ud).transition().duration(Q).attr("d",L).style("fill",$i).style("opacity",1),p.exit().transition().duration(R).style("opacity",0).remove(),m=yj.selectAll("."+g.lines).selectAll("."+g.line).data(re),m.enter().append("path").attr("class",$c).style("stroke",$i),m.style("opacity",ud).transition().duration(Q).attr("d",sj).style("stroke",$i).style("opacity",1),m.exit().transition().duration(R).style("opacity",0).remove(),n=yj.selectAll("."+g.areas).selectAll("."+g.area).data(re),n.enter().append("path").attr("class",gd).style("fill",$i).style("opacity",function(){return Ej=+Jf.select(this).style("opacity"),0}),n.style("opacity",0).transition().duration(Q).attr("d",tj).style("fill",$i).style("opacity",Ej),n.exit().transition().duration(R).style("opacity",0).remove(),o=yj.selectAll("."+g.circles).selectAll("."+g.circle).data(ue),o.enter().append("circle").attr("class",ad).attr("r",Re).style("fill",$i),o.style("opacity",ud).transition().duration(Q).style("opacity",wd).style("fill",$i).attr("cx",sh?Zd:Yd).attr("cy",sh?Yd:Zd),o.exit().remove(),t=yj.selectAll("."+g.texts).selectAll("."+g.text).data(ve),t.enter().append("text").attr("class",Wc).attr("text-anchor",function(a){return sh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",$i).style("fill-opacity",0),t.text(function(a){return Fd(a.id)(a.value,a.id)}).style("fill-opacity",vd).transition().duration(Q).attr("x",O).attr("y",P).style("fill",$i).style("fill-opacity",xd),t.exit().transition().duration(R).style("fill-opacity",0).remove(),r=yj.selectAll("."+g.arcs).selectAll("."+g.arc).data(se),r.enter().append("path").attr("class",ed).style("fill",function(a){return $i(a.data)}).style("cursor",function(a){return ah(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Yi||(c=Hb(a),d=Nb(c),e=Vb(),Pb(c.data.id),Af(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Hb(a),c=Nb(b),d=[c];Td(d,Jf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Yi||(c=Hb(a),d=Nb(c),e=Wb(),Qb(c.data.id),Bf(),Ud(),e(d,b))}).on("click",function(a,b){var c=Hb(a),d=Nb(c),e=Ub();hf(this,a,b),e(d,b)}),r.attr("transform",H?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Yi=!0}).transition().duration(Q).attrTween("d",function(a){var b,c=Hb(a);return c?(b=Jf.interpolate(this._current,c),this._current=b(0),function(a){return Kb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",H?"scale(1)":"").style("fill",function(a){return $i(a.data)}).style("opacity",1).call(Ge,function(){Yi=!1}),r.exit().transition().duration(R).style("opacity",0).remove(),yj.selectAll("."+g.chartArc).select("text").attr("transform",Lb).style("opacity",0).transition().duration(Q).text(Ob).style("opacity",function(a){return Hc(a.data.id)&&qe(a.data)?1:0}),yj.select("."+g.chartArcsTitle).style("opacity",ie(Kf.data.targets)?1:0),jh&&(Jf.event&&"zoom"===Jf.event.type&&rj.extent(zg.orgDomain()).update(),D&&(!sh&&Eh&&hb(dj.subx,c.axisSubX,Eh),rj.empty()||rj.extent(zg.orgDomain()).update(),M=$e(W,!0),v=zj.selectAll("."+g.bars).selectAll("."+g.bar).data(te),v.enter().append("path").attr("class",cd).style("stroke","none").style("fill",$i),v.style("opacity",ud).transition().duration(Q).attr("d",M).style("opacity",1),v.exit().transition().duration(Q).style("opacity",0).remove(),u=zj.selectAll("."+g.lines).selectAll("."+g.line).data(re),u.enter().append("path").attr("class",$c).style("stroke",$i),u.style("opacity",ud).transition().duration(Q).attr("d",uj).style("opacity",1),u.exit().transition().duration(Q).style("opacity",0).remove())),yj.selectAll("."+g.selectedCircles).filter(function(a){return me(a)}).selectAll("circle").remove(),yj.selectAll("."+g.selectedCircle).transition().duration(Q).attr("cx",sh?Zd:Yd).attr("cy",sh?Yd:Zd),w=yj.select("."+g.eventRects),De(Kg)&&!qc(Kg)?(w.classed(g.eventRectsMultiple)||w.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),x=yj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),gf(x.enter()),x.attr("x",0).attr("y",0).attr("width",cg).attr("height",eg)):(w.classed(g.eventRectsSingle)||w.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Ti&&!Si?(B=function(a,b){var c=zc(b),d=Ac(b),e=Kf.data.xs[a.id][b];return(zg(d?d:e+50)-zg(c?c:e-50))/2},A=function(a,b){var c=zc(b),d=Kf.data.xs[a.id][b];return(zg(d)+zg(c?c:d-50))/2}):(B=N(),A=function(a){return zg(a.x)-B/2}),y=Cc(Kf.data.targets),yj.select("."+g.eventRects).datum(y?y.values:[]),x=yj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),ff(x.enter()),x.attr("class",jd).attr("x",sh?0:A).attr("y",sh?A:0).attr("width",sh?cg:B).attr("height",sh?B:eg),x.exit().remove()),Ec(Kf.data.targets).forEach(function(a){Fj[a]=!0})}function of(){nf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function pf(){if(0!==Jc(Kf.data.targets).length){if("mousemove"===Jf.event.sourceEvent.type&&vj.altDomain)return zg.domain(vj.altDomain),void vj.scale(zg).updateScaleExtent();Si&&zg.orgDomain()[0]===Dj[0]&&zg.domain([Dj[0]-1e-10,zg.orgDomain()[1]]),nf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Jf.event.sourceEvent.type&&(Wi=!0)}}function qf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function rf(){wj.attr("width",gg).attr("height",hg),wj.select("#"+Li).select("rect").attr("width",cg).attr("height",eg),wj.select("#"+Mi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),wj.select("#"+Ni).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),wj.select("."+g.zoomRect).attr("width",cg).attr("height",eg),Cj.style("max-height",hg+"px")}function sf(a){return{axisX:a?dj.x.transition().duration(a):dj.x,axisY:a?dj.y.transition().duration(a):dj.y,axisY2:a?dj.y2.transition().duration(a):dj.y2,axisSubX:a?dj.subx.transition().duration(a):dj.subx}}function tf(a){var b;a=a||{},a.withTransition=He(a,"withTransition",!0),a.withTransform=He(a,"withTransform",!1),a.withLegend=He(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withLegend&&mh||(b=sf(a.withTransitionForAxis?$f:0),p(),T(),rf(),o(a.withTransition,b)),nf(a,b)}function uf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=yj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",ld),j=i.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Xc),e=yj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",nd),d=e.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",dd).style("cursor",function(a){return ah(a)?"pointer":null}),c=yj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",md),b=c.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",_c),b.append("g").attr("class",hd),b.append("g").attr("class",function(a){return Vc(g.selectedCircles,a.id)}),b.append("g").attr("class",bd).style("cursor",function(a){return ah(a)?"pointer":null}),a.forEach(function(a){yj.selectAll("."+g.selectedCircles+pd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=yj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(qg(a)).attr("class",od),f=h.enter().append("g").attr("class",od),f.append("g").attr("class",fd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),jh&&(n=zj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",nd),m=n.enter().append("g").style("opacity",0).attr("class",nd),m.append("g").attr("class",dd),l=zj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",md),k=l.enter().append("g").style("opacity",0).attr("class",md),k.append("g").attr("class",_c)),wj.selectAll("."+g.target).filter(function(a){return Hc(a.id)}).transition().duration($f).style("opacity",1)}function vf(a,b){b.filter&&(a=a.filter(b.filter)),(b.type||b.types)&&a.forEach(function(a){b.types?de(a.id,b.types[a.id]):de(a.id,b.type)}),Kf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,z=0,F++)),E[a]=F,D[F]=f,A[a]=z,z+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+v)/10),j=10*Math.ceil((h.height+u)/10),k=jj?j:i,l=jj?S():R();return d&&(z=0,F=0,w=0,x=0),mh&&!Ic(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=i,C[c]=j,(!w||i>=w)&&(w=i),(!x||j>=x)&&(x=j),g=jj?x:w,void(rh?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(l-g*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=26,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=Aj.selectAll("."+g.legendItemFocused).size();b=b||{},n=He(b,"withTransition",!0),q=He(b,"withTransitionForTransform",!0),jj?(f=function(a){return w*E[a]},j=function(a){return D[E[a]]+A[a]}):(f=function(a){return D[E[a]]+A[a]},j=function(a){return x*E[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=Aj.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Vc(g.legendItem,a)}).style("visibility",function(a){return Ic(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof oh?oh(a):Kf.toggle(a)}).on("mouseover",function(a){Jf.select(this).classed(g.legendItemFocused,!0),Yi||Kf.focus(a),"function"==typeof ph&&ph(a)}).on("mouseout",function(a){Jf.select(this).classed(g.legendItemFocused,!1),Yi||Kf.revert(),"function"==typeof qh&&qh(a)}),m.append("text").text(function(a){return d(Ng[a])?Ng[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",jj?h:-200).attr("y",jj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",jj?i:-200).attr("y",jj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",$i).attr("x",jj?h:-200).attr("y",jj?-200:j).attr("width",10).attr("height",10),r=Aj.selectAll("text").data(a).text(function(a){return d(Ng[a])?Ng[a]:a}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=Aj.selectAll("rect."+g.legendItemEvent).data(a),(n?s.transition():s).attr("width",function(a){return B[a]}).attr("height",function(a){return C[a]}).attr("x",i).attr("y",l),t=Aj.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",$i).attr("x",f).attr("y",j),Aj.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Hc(a)}).transition().style("opacity",function(a){var b=Jf.select(this);return Hc(a)?!G||b.classed(g.legendItemFocused)?yf(b):zf(b):nj}),P(w),Q(x),O(F),p(),T(),rf(),o(q,c)}function Ff(a){return Gc(Kf.data.targets,a.id)}function Gf(a){return"data"in a&&Gc(Kf.data.targets,a.data.id)}function Hf(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 If(a,b,c){var d=!je(Kf.data.targets);Yi=!1,de(a,b),tf(c||{withTransitionForAxis:d})}var Jf=a.d3?a.d3:a.require?a.require("d3"):void 0,Kf={data:{},axis:{},legend:{}},Lf={},Mf=i(["bindto"],"#chart"),Nf=i(["size","width"]),Of=i(["size","height"]),Pf=i(["padding","left"],50),Qf=i(["padding","right"],0),Rf=i(["padding","top"],0),Sf=i(["padding","bottom"],0),Tf=i(["zoom","enabled"],!1),Uf=i(["zoom","extent"]),Vf=i(["zoom","privileged"],!1),Wf=i(["onenter"],function(){}),Xf=i(["onleave"],function(){}),Yf=i(["onresize"],function(){}),Zf=i(["onresized"],function(){}),$f=i(["transition","duration"],350);h("data","data is required in config");var _f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg=i(["data","x"]),Kg=i(["data","xs"],{}),Lg=i(["data","x_format"]),Mg=i(["data","id_converter"],function(a){return a}),Ng=i(["data","names"],{}),Og=i(["data","classes"],{}),Pg=i(["data","groups"],[]),Qg=i(["data","axes"],{}),Rg=i(["data","type"]),Sg=i(["data","types"],{}),Tg=i(["data","labels"],{}),Ug=i(["data","order"]),Vg=i(["data","regions"],{}),Wg=i(["data","color"]),Xg=i(["data","colors"],{}),Yg=i(["data","hide"],!1),Zg=i(["data","filter"]),$g=i(["data","selection","enabled"],!1),_g=i(["data","selection","grouped"],!1),ah=i(["data","selection","isselectable"],function(){return!0}),bh=i(["data","selection","multiple"],!0),ch=i(["data","onclick"],function(){}),dh=i(["data","onenter"],function(){}),eh=i(["data","onleave"],function(){}),fh=i(["data","onselected"],function(){}),gh=i(["data","onunselected"],function(){}),hh=i(["data","ondragstart"],function(){}),ih=i(["data","ondragend"],function(){}),jh=i(["subchart","show"],!1),kh=i(["subchart","size","height"],60),lh=i(["color","pattern"],[]),mh=i(["legend","show"],!0),nh=i(["legend","position"],"bottom"),oh=i(["legend","item","onclick"]),ph=i(["legend","item","onmouseover"]),qh=i(["legend","item","onmouseout"]),rh=i(["legend","equally"],!1),sh=i(["axis","rotated"],!1),th=i(["axis","x","show"],!0),uh=i(["axis","x","type"],"indexed"),vh=i(["axis","x","localtime"],!0),wh=i(["axis","x","categories"],[]),xh=i(["axis","x","tick","centered"],!1),yh=i(["axis","x","tick","format"]),zh=i(["axis","x","tick","culling"],{}),Ah=i(["axis","x","tick","culling","max"],10),Bh=i(["axis","x","tick","count"]),Ch=i(["axis","x","tick","fit"],!0),Dh=i(["axis","x","tick","values"],null),Eh=i(["axis","x","tick","rotate"]),Fh=i(["axis","x","max"],null),Gh=i(["axis","x","min"],null),Hh=i(["axis","x","padding"],{}),Ih=i(["axis","x","height"]),Jh=i(["axis","x","default"]),Kh=i(["axis","x","label"],{}),Lh=i(["axis","y","show"],!0),Mh=i(["axis","y","max"]),Nh=i(["axis","y","min"]),Oh=i(["axis","y","center"]),Ph=i(["axis","y","label"],{}),Qh=i(["axis","y","inner"],!1),Rh=i(["axis","y","tick","format"]),Sh=i(["axis","y","padding"]),Th=i(["axis","y","ticks"],10),Uh=i(["axis","y2","show"],!1),Vh=i(["axis","y2","max"]),Wh=i(["axis","y2","min"]),Xh=i(["axis","y2","center"]),Yh=i(["axis","y2","label"],{}),Zh=i(["axis","y2","inner"],!1),$h=i(["axis","y2","tick","format"]),_h=i(["axis","y2","padding"]),ai=i(["axis","y2","ticks"],10),bi=i(["grid","x","show"],!1),ci=i(["grid","x","type"],"tick"),di=i(["grid","x","lines"],[]),ei=i(["grid","y","show"],!1),fi=i(["grid","y","lines"],[]),gi=i(["grid","y","ticks"],10),hi=i(["point","show"],!0),ii=i(["point","r"],2.5),ji=i(["point","focus","line","enabled"],!0),ki=i(["point","focus","expand","enabled"],!0),li=i(["point","focus","expand","r"]),mi=i(["point","focus","select","r"]),ni=i(["line","connect_null"],!1),oi=i(["bar","width"]),pi=i(["bar","width","ratio"],.6),qi=i(["pie","label","show"],!0),ri=i(["pie","label","format"]),si=i(["pie","expand"],!0),ti=i(["pie","onclick"],function(){}),ui=i(["pie","onmouseover"],function(){}),vi=i(["pie","onmouseout"],function(){}),wi=i(["donut","label","show"],!0),xi=i(["donut","label","format"]),yi=i(["donut","expand"],!0),zi=i(["donut","title"],""),Ai=i(["donut","onclick"],function(){}),Bi=i(["donut","onmouseover"],function(){}),Ci=i(["donut","onmouseout"],function(){}),Di=i(["regions"],[]),Ei=i(["tooltip","show"],!0),Fi=i(["tooltip","format","title"]),Gi=i(["tooltip","format","value"]),Hi=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Fi?Fi:b,l=Gi?Gi:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Ii=i(["tooltip","init","show"],!1),Ji=i(["tooltip","init","x"],0),Ki=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Li=("string"==typeof Mf?Mf.replace("#",""):Mf.id)+"-clip",Mi=Li+"-xaxis",Ni=Li+"-yaxis",Oi=j(Li),Pi=j(Mi),Qi=j(Ni),Ri="timeseries"===uh,Si="categorized"===uh,Ti=!Ri&&(Jg||De(Kg)),Ui=null,Vi=!1,Wi=!1,Xi=!1,Yi=!1,Zi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],$i=xe(Xg,De(lh)?lh:Zi,Wg),_i=vh?Jf.time.format:Jf.time.format.utc,aj=_i.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),bj=[],cj=[],dj={},ej=sh?"left":"bottom",fj=sh?Qh?"top":"bottom":Qh?"right":"left",gj=sh?Zh?"bottom":"top":Zh?"left":"right",hj=sh?"left":"bottom",ij={main:function(){return"translate("+k(_f.left)+","+k(_f.top)+")"},context:function(){return"translate("+k(ag.left)+","+k(ag.top)+")"},legend:function(){return"translate("+bg.left+","+bg.top+")"},x:function(){return"translate(0,"+(sh?0:eg)+")"},y:function(){return"translate(0,"+(sh?eg:0)+")"},y2:function(){return"translate("+(sh?0:cg)+","+(sh?1:0)+")" },subx:function(){return"translate(0,"+(sh?0:fg)+")"},arc:function(){return"translate("+lg/2+","+mg/2+")"}},jj="right"===nh,kj=0,lj=0,mj=0,nj=.15,oj=30,pj=sh&&!th?0:30,qj=5;qg=Jf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var rj,sj=function(){var a=Jf.svg.line().x(sh?function(a){return Y(a.id)(a.value)}:Gd).y(sh?Gd:function(a){return Y(a.id)(a.value)});return ni||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ni?Qe(b.values):b.values;return ke(b)?(a.interpolate(le(b)?"cardinal":"linear"),Vg[b.id]?df(e,zg,Y(b.id),Vg[b.id]):a(e)):(c=e[0]?zg(e[0].x):0,d=e[0]?Y(b.id)(e[0].value):0,sh?"M "+d+" "+c:"M "+c+" "+d)}}(),tj=function(){var a;return a=sh?Jf.svg.area().x0(function(a){return Y(a.id)(0)}).x1(function(a){return Y(a.id)(a.value)}).y(Gd):Jf.svg.area().x(Gd).y0(function(a){return Y(a.id)(0)}).y1(function(a){return Y(a.id)(a.value)}),function(b){var c,d,e=Qe(b.values);return ee([b],"area")||ee([b],"area-spline")?(a.interpolate(le(b)?"cardinal":"linear"),a(e)):(c=e[0]?zg(e[0].x):0,d=e[0]?Y(b.id)(e[0].value):0,sh?"M "+d+" "+c:"M "+c+" "+d)}}(),uj=function(){var a=Jf.svg.line().x(sh?function(a){return Z(a.id)(a.value)}:Jd).y(sh?Jd:function(a){return Z(a.id)(a.value)});return function(b){var c=Qe(b.values);return ke(b)?a(c):"M "+Cg(c[0].x)+" "+Z(b.id)(c[0].value)}}(),vj=function(){};rj=Jf.svg.brush().on("brush",of),rj.update=function(){return zj&&zj.select("."+g.brush).call(this),this},rj.scale=function(a){return sh?this.y(a):this.x(a)},Tf&&(vj=Jf.behavior.zoom().on("zoomstart",function(){vj.altDomain=Jf.event.sourceEvent.altKey?zg.orgDomain():null}).on("zoom",Tf?pf:null),vj.scale=function(a){return sh?this.y(a):this.x(a)},vj.orgScaleExtent=function(){var a=Uf?Uf:[1,10];return[a[0],Math.max(Bc()/a[1],a[1])]},vj.updateScaleExtent=function(){var a=cc(zg.orgDomain())/cc(Dj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var wj,xj,yj,zj,Aj,Bj,Cj,Dj,Ej,Fj={};if(Kf.focus=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",1)}var c=wj.selectAll(qd(a)),d=c.filter(Ff),e=c.filter(Gf);Kf.revert(),Kf.defocus(),b(d.classed(g.focused,!0)),b(e),je(Kf.data.targets)&&Pb(a,!0),Af(a,!0)},Kf.defocus=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",.3)}var c=wj.selectAll(qd(a)),d=c.filter(Ff),e=c.filter(Gf);Kf.revert(),b(d.classed(g.focused,!1)),b(e),je(Kf.data.targets)&&Qb(a),Af(a,!1)},Kf.revert=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",1)}var c=wj.selectAll(qd(a)),d=c.filter(Ff),e=c.filter(Gf);b(d.classed(g.focused,!1)),b(e),je(Kf.data.targets)&&Qb(a),Bf()},Kf.show=function(a,b){a=Fc(a),b=b||{},Nc(a),wj.selectAll(rd(a)).transition().style("opacity",1),b.withLegend&&Cf(a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Kf.hide=function(a,b){a=Fc(a),b=b||{},Mc(a),wj.selectAll(rd(a)).transition().style("opacity",0),b.withLegend&&Df(a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Kf.toggle=function(a){Hc(a)?Kf.hide(a):Kf.show(a)},Kf.unzoom=function(){rj.clear().update(),nf({withUpdateXDomain:!0})},Kf.load=function(a){return a.xs&&pc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Og[b]=a.classes[b]}),"categories"in a&&Si&&(wh=a.categories,Fg.categories(wh)),"cacheIds"in a&&dc(a.cacheIds)?void vf(fc(a.cacheIds),a.done):void("unload"in a?xf(Fc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){wf(a)}):wf(a))},Kf.unload=function(a,b){xf(Fc(a),function(){nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Kf.selected=function(a){return Jf.merge(yj.selectAll("."+g.shapes+pd(a)).selectAll("."+g.shape).filter(function(){return Jf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Kf.select=function(a,b,c){$g&&yj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Jf.select(this),i=e.data?e.data.id:e.id,j=Pe(this),k=_g||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);"path"!==this.nodeName&&(k&&l?ah(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},Kf.unselect=function(a,b){$g&&yj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Jf.select(this),f=c.data?c.data.id:c.id,h=Pe(this),i=_g||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);"path"!==this.nodeName&&i&&j&&ah(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Kf.toLine=function(a){If(a,"line")},Kf.toSpline=function(a){If(a,"spline")},Kf.toBar=function(a){If(a,"bar")},Kf.toScatter=function(a){If(a,"scatter")},Kf.toArea=function(a){If(a,"area")},Kf.toAreaSpline=function(a){If(a,"area-spline")},Kf.toPie=function(a){If(a,"pie",{withTransform:!0})},Kf.toDonut=function(a){If(a,"donut",{withTransform:!0})},Kf.groups=function(a){return c(a)?Pg:(Pg=a,nf(),Pg)},Kf.xgrids=function(a){return a?(di=a,nf(),di):di},Kf.xgrids.add=function(a){return a?Kf.xgrids(di.concat(a)):void 0},Kf.xgrids.remove=function(a){var b=Hf(a);return Kf.xgrids(di.filter(b))},Kf.ygrids=function(a){return a?(fi=a,nf(),fi):fi},Kf.ygrids.add=function(a){return a?Kf.ygrids(fi.concat(a)):void 0},Kf.ygrids.remove=function(a){var b=Hf(a);return Kf.ygrids(fi.filter(b))},Kf.regions=function(a){return a?(Di=a,nf(),Di):Di},Kf.regions.add=function(a){return a?(Di=Di.concat(a),nf(),Di):Di},Kf.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;wj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Di=Di.filter(function(b){return b.classes.indexOf(a)<0})}),Di},Kf.data.get=function(a){var b=Kf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Kf.data.getAsTarget=function(a){var b=Kf.data.targets.filter(function(b){return b.id===a});return b.length>0?b[0]:void 0},Kf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Ng[b]=a[b]}),nf({withLegend:!0}),Ng):Ng},Kf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Xg[b]=a[b]}),nf({withLegend:!0}),Xg):Xg},Kf.x=function(a){return arguments.length&&(sc(Kf.data.targets,a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Kf.data.xs},Kf.xs=function(a){return arguments.length&&(tc(Kf.data.targets,a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Kf.data.xs},Kf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){eb(b,a[b])}),Gb())},Kf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Fh=+a.x),b(a.y)&&(Mh=+a.y),b(a.y2)&&(Vh=+a.y2)):Mh=Vh=+a,nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Kf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Gh=+a.x),b(a.y)&&(Nh=+a.y),b(a.y2)&&(Wh=+a.y2)):Nh=Wh=+a,nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Kf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Kf.axis.max(a.max),"undefined"!=typeof a.min&&Kf.axis.min(a.min))},Kf.legend.show=function(a){Cf(Fc(a)),nf({withLegend:!0})},Kf.legend.hide=function(a){Df(Fc(a)),nf({withLegend:!0})},Kf.resize=function(a){Nf=a?a.width:null,Of=a?a.height:null,tf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Kf.destroy=function(){Kf.data.targets=void 0,Kf.data.xs={},Cj.html(""),a.onresize=null},"url"in f.data)Jf.xhr(f.data.url,function(a,b){var c,d=Jf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Jf.csv.parse(b.response),ef(c)});else if("rows"in f.data)ef(vc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");ef(wc(f.data.columns))}return Kf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(window); \ No newline at end of file diff --git a/package.json b/package.json index f4bc409..a8d1ac0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "c3", - "version": "0.1.36", + "version": "0.1.37", "description": "D3-based reusable chart library", "main": "c3.js", "scripts": { From 160d8bd591b9cfe0353f4b30a1b24852c84b80cc Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Fri, 9 May 2014 16:15:36 +0900 Subject: [PATCH 156/178] Modify region.remove API --- c3.js | 27 +++++++++++++++------------ c3.min.js | 2 +- htdocs/samples/regions.html | 8 ++++++++ 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/c3.js b/c3.js index 0980d59..ddde29a 100644 --- a/c3.js +++ b/c3.js @@ -4353,19 +4353,22 @@ redraw(); return __regions; }; - c3.regions.remove = function (classes, options) { - var regionClasses = [].concat(classes); - options = isDefined(options) ? options : {}; - regionClasses.forEach(function (cls) { - var duration = isValue(options.duration) ? options.duration : 0; - svg.selectAll('.' + cls) - .transition().duration(duration) - .style('fill-opacity', 0) - .remove(); - __regions = __regions.filter(function (region) { - return region.classes.indexOf(cls) < 0; - }); + c3.regions.remove = function (options) { + var duration, classes, regions; + + options = options || {}; + duration = getOption(options, "duration", __transition_duration); + classes = getOption(options, "classes", [CLASS.region]); + + regions = main.select('.' + CLASS.regions).selectAll(classes.map(function (c) { return '.' + c; })); + (duration ? regions.transition().duration(duration) : regions) + .style('opacity', 0) + .remove(); + + __regions = __regions.filter(function (region) { + return classes.indexOf(region.class) < 0; }); + return __regions; }; diff --git a/c3.min.js b/c3.min.js index 9ebcd27..f4f42db 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ !function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.ceil(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.ceil(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&acg&&(cg=0),0>eg&&(eg=0),dg=sh?_f.left-oj-pj:cg,fg=sh?eg:hg-ag.top-ag.bottom,0>dg&&(dg=0),0>fg&&(fg=0),lg=cg-(jj?b+10:0),mg=eg-(jj?0:10),r(),jj&&d&&(bg.left=lg/2+1.1*jg)}function q(){yj.select("line."+g.xgridFocus).attr("x1",sh?0:-10).attr("x2",sh?cg:-10).attr("y1",sh?-10:_f.top).attr("y2",sh?-10:eg)}function r(){jg=Math.min(lg,mg)/2,ig=.95*jg,kg=ie(Kf.data.targets)?.6*ig:0}function s(){var a=sh?g.axisX:g.axisY,b=yj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Jf.select(Mf).node().getBoundingClientRect(),e=je(Kf.data.targets),f=c.right-d.left-(e?0:v());return f>0?f:0}function t(){return Nf?Nf:z()}function u(){var a=Of?Of:A();return a>0?a:320}function v(){var a=1;return Pf?Pf:sh?th?x("x"):a:!Lh||Qh?a:x("y")}function w(){var a=1;return Qf?Qf:jj?R()+20+(Uh&&!sh?x("y2"):a):Uh?Zh||sh?a:x("y2"):a}function x(a){var b=mb(a);return b.isInner?20+Fb(a):40+Fb(a)}function y(a){return"x"!==a||th?"x"===a&&Ih?Ih:"y"!==a||Lh?"y2"!==a||Uh?(mb(a).isInner?30:40)+("y2"===a?-10:0):qj:mh&&!jj?10:1:0}function z(){return+Jf.select(Mf).style("width").replace("px","")}function A(){return+Jf.select(Mf).style("height").replace("px","")}function B(a){return a?-31:-(_f.left-1)}function C(a){return a?-20:-4}function D(){return B(!sh)}function E(){return C(!sh)}function F(){return B(sh)}function G(){return C(sh)}function H(a){return a?cg+2+30+30:_f.left+20}function I(a){return a?(Ih?Ih:0)+80:eg+8}function J(){return H(!sh)}function K(){return I(!sh)}function L(){return H(sh)}function M(){return I(sh)}function N(){var a,b,c,d,e,f=Cc(Kf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=zg(b.x)-zg(a.x),0===c?sh?eg:cg:(d=Bc(),e=fe(Kf.data.targets)?(d-(Si?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function O(a){kj=a}function P(a){lj=a}function Q(a){mj=a}function R(){return mh?jj?lj*(kj+1):gg:0}function S(){return mh?jj?hg:mj*(kj+1):0}function T(){var a,b,c=!zg;rg=sh?1:0,sg=sh?eg:cg,tg=sh?0:eg,ug=sh?cg:1,vg=rg,wg=sg,xg=sh?0:fg,yg=sh?dg:1,zg=W(rg,sg,c?void 0:zg.domain(),function(){return Fg.tickOffset()}),Ag=X(tg,ug,c?void 0:Ag.domain()),Bg=X(tg,ug,c?void 0:Bg.domain()),Cg=W(rg,sg,Dj,function(a){return a%1?0:Ig.tickOffset()}),Dg=X(xg,yg,c?void 0:Dg.domain()),Eg=X(xg,yg,c?void 0:Eg.domain()),a=bb(),b=Dh?Dh:c?void 0:Fg.tickValues(),Fg=$(zg,ej,a,b),Ig=$(Cg,hj,a,b),Gg=_(Ag,fj,Rh,Th),Hg=_(Bg,gj,$h,ai),c||(rj.scale(Cg),Tf&&vj.scale(zg)),U()}function U(){ng=Ib(),og=Jb(),pg=Jb(.98)}function V(a,b,c){return(c?Jf.time.scale():Jf.scale.linear()).range([a,b])}function W(a,b,c,d){var e,f=V(a,b,Ri),g=c?f.domain(c):f;Si?(d=d||function(){return 0},f=function(a,b){var c=g(a)+d(a);return b?c:Math.ceil(c)}):f=function(a,b){var c=g(a);return b?c:Math.ceil(c)};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return Dj&&Dj[0]===a[0]&&Dj[1]a?a.toFixed(0):a};return yh&&("function"==typeof yh?a=yh:Ri&&(a=function(a){return a?_i(yh)(a):""})),a}function cb(a){var b;return"y"===a?b=Ph:"y2"===a?b=Yh:"x"===a&&(b=Kh),b}function db(a){var b=cb(a);return"string"==typeof b?b:b?b.text:null}function eb(a,b){var c=cb(a);"string"==typeof c?"y"===a?Ph=b:"y2"===a?Yh=b:"x"===a&&(Kh=b):c&&(c.text=b)}function fb(a){return 10*Math.sin(Math.PI*(a/180))}function gb(a){return 11.5-2.5*(a/15)}function hb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",gb(c)).attr("x",fb(c)).attr("transform","rotate("+c+")")}function ib(a,b){var c=cb(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 jb(){return ib("x",sh?"inner-top":"inner-right")}function kb(){return ib("y",sh?"inner-right":"inner-top")}function lb(){return ib("y2",sh?"inner-right":"inner-top")}function mb(a){return"y2"===a?lb():"y"===a?kb():jb()}function nb(){return db("x")}function ob(){return db("y")}function pb(){return db("y2")}function qb(a,b){return a?b.isLeft?0:b.isCenter?cg/2:cg:b.isBottom?-eg:b.isMiddle?-eg/2:0}function rb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function sb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function tb(){return qb(!sh,jb())}function ub(){return qb(sh,kb())}function vb(){return qb(sh,lb())}function wb(){return rb(!sh,jb())}function xb(){return rb(sh,kb())}function yb(){return rb(sh,lb())}function zb(){var a=jb();return sh?a.isInner?"1.2em":-25-Fb("x"):a.isInner?"-0.5em":Ih?Ih-10:"3em"}function Ab(){var a=kb();return sh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Fb("y")}function Bb(){var a=lb();return sh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Fb("y2")}function Cb(){return sb(!sh,jb())}function Db(){return sb(sh,kb())}function Eb(){return sb(sh,lb())}function Fb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Jf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Gb(a){var b=yj.select("."+g.axisX+" ."+g.axisXLabel),c=yj.select("."+g.axisY+" ."+g.axisYLabel),d=yj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",tb).attr("dx",wb).attr("dy",zb).text(nb),(a?c.transition():c).attr("x",ub).attr("dx",xb).attr("dy",Ab).attr("dy",Ab).text(ob),(a?d.transition():d).attr("x",vb).attr("dx",yb).attr("dy",Bb).text(pb)}function Hb(a){var b=!1;return qg(Jc(Kf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Ib(){var a=Jf.svg.arc().outerRadius(ig).innerRadius(kg),b=function(b,c){var d;return c?a(b):(d=Hb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Jb(a){var b=Jf.svg.arc().outerRadius(jg*(a?a:1)).innerRadius(kg);return function(a){var c=Hb(a);return c?b(c):"M 0 0"}}function Kb(a,b){return qe(a.data)?ng(a,b):"M 0 0"}function Lb(a){var b,c,d,e,f=Hb(a),g="";return f&&(b=ng.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*ig*.8+","+d/e*ig*.8+")"),g}function Mb(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Nb(a){return rc({id:a.data.id,value:a.value,ratio:Mb(a)})}function Ob(a){var b,c,d,e;return Rb()?(b=Hb(a),c=b?b.value:null,d=Mb(b),e=Sb(),e?e(c,d):Ed(c,d)):""}function Pb(a,b){var c=wj.selectAll("."+g.chartArc+qd(a)),d=wj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});we(a)&&c.selectAll("path").transition().duration(50).attr("d",og).transition().duration(100).attr("d",pg).each(function(a){pe(a.data)}),b||d.style("opacity",.3)}function Qb(a){var b=wj.selectAll("."+g.chartArc+qd(a));b.selectAll("path").transition().duration(50).attr("d",ng),wj.selectAll("."+g.arc).style("opacity",1)}function Rb(){return ie(Kf.data.targets)?wi:qi}function Sb(){return ie(Kf.data.targets)?xi:ri}function Tb(){return ie(Kf.data.targets)?zi:""}function Ub(){var a=ie(Kf.data.targets)?Ai:ti;return"function"==typeof a?a:function(){}}function Vb(){var a=ie(Kf.data.targets)?Bi:ui;return"function"==typeof a?a:function(){}}function Wb(){var a=ie(Kf.data.targets)?Ci:vi;return"function"==typeof a?a:function(){}}function Xb(a){var b,c,d,e,f,g,h=Ec(a),i=Qc(a);if(Pg.length>0)for(g=Sc(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 Jf.min(Object.keys(i).map(function(a){return Jf.min(i[a])}))}function Yb(a){var b,c,d,e,f,g,h=Ec(a),i=Qc(a);if(Pg.length>0)for(g=Tc(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 Jf.max(Object.keys(i).map(function(a){return Jf.max(i[a])}))}function Zb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return ab(a.id)===c}),m="y2"===c?Wh:Nh,n="y2"===c?Vh:Mh,o=b(m)?m:Xb(l),p=b(n)?n:Yb(l),q="y2"===c?Xh:Oh,r=yd()&&sh;return 0===l.length?"y2"===c?Bg.domain():Ag.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=zd(o,p),j=cc(Ag.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Sh&&(f=b(Sh.top)?Sh.top:e,g=b(Sh.bottom)?Sh.bottom:e),"y2"===c&&_h&&(f=b(_h.top)?_h.top:e,g=b(_h.bottom)?_h.bottom:e),fe(l)&&!Sc(l)&&(g=o),[o-g,p+f])}function $b(a){return Gh?Ri?ye(Gh):Gh:Jf.min(a,function(a){return Jf.min(a.values,function(a){return a.x})})}function _b(a){return Fh?Ri?ye(Fh):Fh:Jf.max(a,function(a){return Jf.max(a.values,function(a){return a.x})})}function ac(a){var c,d,e,f,g=Dc(a),h=g[1]-g[0];return Si?d=0:fe(a)?(c=Bc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Hh&&De(Hh)?(e=b(Hh.left)?Hh.left:d,f=b(Hh.right)?Hh.right:d):e=f="number"==typeof Hh?Hh:d,{left:e,right:f}}function bc(a){var b=[$b(a),_b(a)],c=b[0],d=b[1],e=ac(a),f=0,g=0;return c-d!==0||Si||(c=Ri?new Date(.5*c.getTime()):-.5,d=Ri?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Ri?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Ri?new Date(d.getTime()+e.right):d+e.right),[f,g]}function cc(a){return a[1]-a[0]}function dc(a){for(var b=0;bb?0:b-c}function jc(a){var b,c=hc(a),d="y"===a.axis?Ag:Bg;return b="y"===a.axis||"y2"===a.axis?sh?eg:"start"in a?d(a.start):eg:sh?"end"in a?zg(Ri?ye(a.end):a.end):eg:eg,c>b?0:b-c}function kc(a){return Jg&&a===Jg||De(Kg)&&Ee(Kg,a)}function lc(a){return!kc(a)}function mc(a){return Jg?Jg:De(Kg)?Kg[a]:null}function nc(a,b){var c,d=b&&De(b)?Ec(b):[];return d.forEach(function(b){mc(b)===a&&(c=Kf.data.xs[b])}),c}function oc(a,b){return a in Kf.data.xs&&Kf.data.xs[a]&&Kf.data.xs[a][b]?Kf.data.xs[a][b]:b}function pc(a){Object.keys(a).forEach(function(b){Kg[b]=a[b]})}function qc(a){return 1===Jf.set(Object.keys(a).map(function(b){return a[b]})).size()}function rc(a){var b;return a&&(b=Ng[a.id],a.name=b?b:a.id),a}function sc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=uc(b[d],a.id,d)}),Kf.data.xs[a.id]=b})}function tc(a,b){a.forEach(function(a){b[a.id]&&sc([a],b[a.id])})}function uc(a,c,d){var e;return e=Ri?a?a instanceof Date?a:ye(a):ye(oc(c,d)):Ti&&!Si?b(a)?+a:oc(c,d):d}function vc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Kf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Jg?(d=Object.keys(Kf.data.xs),Kf.data.xs[c]=d.length>0?Kf.data.xs[d[0]]:void 0):De(Kg)&&(Kf.data.xs[c]=nc(f,Kf.data.targets)):Kf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Kf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Mg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=mc(b),g=a[f],h=uc(g,b,e);return Ti&&Si&&0===c&&g&&(0===e&&(wh=[]),wh.push(g)),("undefined"==typeof a[b]||Kf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Rg&&de(Ec(c).filter(function(a){return!(a in Sg)}),Rg),c.forEach(function(a){ec(a.id_org,a)}),c}function yc(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 zc(a){return a>0&&Kf.data.targets[0].values[a-1]?Kf.data.targets[0].values[a-1].x:void 0}function Ac(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Dc(a){var b,c,d=Cc(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Ec(a){return a.map(function(a){return a.id})}function Fc(a){return a?"string"==typeof a?[a]:a:Ec(Kf.data.targets)}function Gc(a,b){var c,d=Ec(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Ri?new Date(i):i);j.push(e)}return Ri||(j=j.sort(function(a,b){return a-b})),j}function Mc(a){bj=bj.concat(a)}function Nc(a){bj=bj.filter(function(b){return a.indexOf(b)<0})}function Oc(a){cj=cj.concat(a)}function Pc(a){cj=cj.filter(function(b){return a.indexOf(b)<0})}function Qc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Rc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Tc(a){return Rc(a,function(a){return a>0})}function Uc(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||0===a[f].x)&&(e=e.concat(Kd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Kd(a,g))),Nd(e,b)):Ld(a,b,f,g)}function Md(a,b){var c;return c=a.map(function(a){return Ld(a.values,b)}),Nd(c,b)}function Nd(a,b){var c,d;return a.forEach(function(a){var e=Fe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Od(a,b){return Jf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Pd(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 Qd(){return Ug&&"desc"===Ug.toLowerCase()}function Rd(){return Ug&&"asc"===Ug.toLowerCase()}function Sd(a){var b=Rd(),c=Qd();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 Ug&&a.sort(Ug),a}function Td(a,c){var d,e,f,g,h,i,j,k=je(Kf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&Ei&&(Bj.html(Hi(a,bb(),Ad(k),$i)).style("display","block"),d=Bj.property("offsetWidth"),e=Bj.property("offsetHeight"),k?(g=cg/2+c[0],i=eg/2+c[1]+20):(sh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-w(),i=zg(l[0].x)+20):(f=s(),g=f+v()+zg(l[0].x)+20,h=g+d,j=f+t()-w(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),Bj.style("top",i+"px").style("left",g+"px"))}function Ud(){Bj.style("display","none")}function Vd(a){var c=a.filter(function(a){return a&&b(a.value)});if(Ei&&!ge(Kf.data.targets)&&!je(Kf.data.targets)){var d=yj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(sh?"y1":"x1",Gd).attr(sh?"y2":"x2",Gd),mf(d,"grid")}}function Wd(){yj.select("line."+g.xgridFocus).style("visibility","hidden")}function Xd(a,b){var c,d,e,f,h=[],i=yj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=bc(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function Yd(a){return a.x||0===a.x?zg(a.x):null}function Zd(a){return Y(a.id)(a.value)}function $d(){var a,b,d={},e=0;return Jc(Kf.data.targets.filter(me)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ce(a,b){return"number"==typeof oi?oi:b?2*a.tickOffset()*pi/b:0}function de(a,b){Fc(a).forEach(function(a){Fj[a]=b===Sg[a],Sg[a]=b})}function ee(a,b){var c=!1;return a.forEach(function(a){Sg[a.id]===b&&(c=!0),a.id in Sg||"line"!==b||(c=!0)}),c}function fe(a){return ee(a,"bar")}function ge(a){return ee(a,"scatter")}function he(a){return ee(a,"pie")}function ie(a){return ee(a,"donut")}function je(a){return he(a)||ie(a)}function ke(a){var b="string"==typeof a?a:a.id;return!(b in Sg)||"line"===Sg[b]||"spline"===Sg[b]||"area"===Sg[b]||"area-spline"===Sg[b]}function le(a){var b="string"==typeof a?a:a.id;return"spline"===Sg[b]||"area-spline"===Sg[b]}function me(a){var b="string"==typeof a?a:a.id;return"bar"===Sg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"scatter"===Sg[b]}function oe(a){var b="string"==typeof a?a:a.id;return"pie"===Sg[b]}function pe(a){var b="string"==typeof a?a:a.id;return"donut"===Sg[b]}function qe(a){return oe(a)||pe(a)}function re(a){return ke(a)?[a]:[]}function se(a){return qe(a.data)?[a]:[]}function te(a){return me(a)?a.values:[]}function ue(a){return ke(a)||ne(a)?a.values:[]}function ve(a){return me(a)||ke(a)?a.values:[]}function we(a){return pe(a)&&yi||oe(a)&&si}function xe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ye(b){var c;try{c=Lg?Jf.time.format(Lg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Lg)}return c}function ze(a,b){var c=Jf.mouse(a),d=Jf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ee(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Fe(a,b){var c="y"===ab(a.id)?Ag:Bg,d=sh?1:0,e=sh?0:1;return Math.pow(zg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ge(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function He(a,b,c){return d(a[b])?a[b]:c}function Ie(a,b,c){fh(b,a.node()),yj.select("."+g.selectedCircles+pd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Vc(g.selectedCircle,c)}).attr("cx",sh?Zd:Yd).attr("cy",sh?Yd:Zd).attr("stroke",function(){return $i(b)}).attr("r",1.4*Te(b)).transition().duration(100).attr("r",Te)}function Je(a,b,c){gh(b,a.node()),yj.select("."+g.selectedCircles+pd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ke(a,b,c,d){a?Ie(b,c,d):Je(b,c,d)}function Le(a,b){fh(b,a.node()),a.transition().duration(100).style("fill",function(){return Jf.rgb($i(b)).brighter(.75)})}function Me(a,b){gh(b,a.node()),a.transition().duration(100).style("fill",function(){return $i(b)})}function Ne(a,b,c,d){a?Le(b,c,d):Me(b,c,d)}function Oe(a,b,c,d){Ne(a,b,c.data,d)}function Pe(a){return"circle"===a.nodeName?Ke:Jf.select(a).classed(g.bar)?Ne:Oe}function Qe(a){return a.filter(function(a){return b(a.value)})}function Re(a){return hi?"function"==typeof ii?ii(a):ii:0}function Se(a){return ki?li?li:1.75*Re(a):Re(a)}function Te(a){return mi?mi:4*Re(a)}function Ue(a,c){return(c?yj.selectAll("."+g.circles+pd(c)):yj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ve(a,b){Ue(a,b).classed(g.EXPANDED,!0).attr("r",Se)}function We(a){Ue(a).filter(function(){return Jf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Re)}function Xe(a){return yj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function Ye(a){Xe(a).classed(g.EXPANDED,!0)}function Ze(a){Xe(a).classed(g.EXPANDED,!1)}function $e(a,b){var c=cf(a,b);return function(a,b){var d=c(a,b),e=sh?1:0,f=sh?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 _e(a,b){var c=cf(a,!1),d=b?af:bf;return function(a,b){return d(c(a,b),a,this)}}function af(a,b){var c;return sh?(c=me(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function bf(a,b,c){var d=c.getBoundingClientRect();return sh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:me(b)?-3:-6)}function cf(a,b){var c=a.__max__+1,d=ce(Fg,c),e=_d(d,c,a,!!b),f=ae(!!b),g=be(a,!!b),h=b?Z:Y;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return sh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function df(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function ef(b){var c,d,e;if(Cj=Jf.select(Mf),Cj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Cj.html("").classed("c3",!0),Kf.data.xs={},Kf.data.targets=xc(b),Zg&&(Kf.data.targets=Kf.data.targets.filter(Zg)),Yg&&Mc(Yg===!0?Ec(Kf.data.targets):Yg),p(),T(),zg.domain(Jf.extent(bc(Kf.data.targets))),Ag.domain(Zb(Kf.data.targets,"y")),Bg.domain(Zb(Kf.data.targets,"y2")),Cg.domain(zg.domain()),Dg.domain(Ag.domain()),Eg.domain(Bg.domain()),Dj=zg.domain(),rj.scale(Cg),Tf&&vj.scale(zg),wj=Cj.append("svg").on("mouseenter",Wf).on("mouseleave",Xf),xj=wj.append("defs"),xj.append("clipPath").attr("id",Li).append("rect"),xj.append("clipPath").attr("id",Mi).append("rect"),xj.append("clipPath").attr("id",Ni).append("rect"),rf(),yj=wj.append("g").attr("transform",ij.main),zj=wj.append("g").attr("transform",ij.context),Aj=wj.append("g").attr("transform",ij.legend),jh||zj.style("visibility","hidden"),mh||(Aj.style("visibility","hidden"),cj=Ec(Kf.data.targets)),Bj=Jf.select(Mf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Ef(Ec(Kf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=yj.append("g").attr("clip-path",Oi).attr("class",g.grid),bi&&d.append("g").attr("class",g.xgrids),De(di)&&d.append("g").attr("class",g.xgridLines),ji&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),ei&&d.append("g").attr("class",g.ygrids),De(fi)&&d.append("g").attr("class",g.ygridLines),yj.append("g").attr("clip-path",Oi).attr("class",g.regions),yj.append("g").attr("clip-path",Oi).attr("class",g.chart),c=yj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Tf?sh?"ns-resize":"ew-resize":null),yj.select("."+g.chart).append("g").attr("class",g.chartBars),yj.select("."+g.chart).append("g").attr("class",g.chartLines),yj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",ij.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Tb()),yj.select("."+g.chart).append("g").attr("class",g.chartTexts),Tf&&yj.insert("rect",Vf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",cg).attr("height",eg).style("opacity",0).style("cursor",sh?"ns-resize":"ew-resize").call(vj).on("dblclick.zoom",null),Jh&&rj.extent("function"!=typeof Jh?Jh:Jh(bc())),dj.x=yj.append("g").attr("class",g.axisX).attr("clip-path",Pi).attr("transform",ij.x).style("visibility",th?"visible":"hidden"),dj.x.append("text").attr("class",g.axisXLabel).attr("transform",sh?"rotate(-90)":"").style("text-anchor",Cb),dj.y=yj.append("g").attr("class",g.axisY).attr("clip-path",Qi).attr("transform",ij.y).style("visibility",Lh?"visible":"hidden"),dj.y.append("text").attr("class",g.axisYLabel).attr("transform",sh?"":"rotate(-90)").style("text-anchor",Db),dj.y2=yj.append("g").attr("class",g.axisY2).attr("transform",ij.y2).style("visibility",Uh?"visible":"hidden"),dj.y2.append("text").attr("class",g.axisY2Label).attr("transform",sh?"":"rotate(-90)").style("text-anchor",Eb),zj.append("g").attr("clip-path",Oi).attr("class",g.chart),zj.select("."+g.chart).append("g").attr("class",g.chartBars),zj.select("."+g.chart).append("g").attr("class",g.chartLines),zj.append("g").attr("clip-path",Oi).attr("class",g.brush).call(rj).selectAll("rect").attr(sh?"width":"height",sh?dg:fg),dj.subx=zj.append("g").attr("class",g.axisX).attr("transform",ij.subx).attr("clip-path",sh?"":Pi),uf(Kf.data.targets),sh?yj.select("."+g.axisX).style("opacity",0).call(Fg):(yj.select("."+g.axisY).style("opacity",0).call(Gg),yj.select("."+g.axisY2).style("opacity",0).call(Hg)),p(),T(),rf(),o(!1),nf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Ii){if(Ri&&"string"==typeof Ji){for(Ji=ye(Ji),e=0;e0){d=[];for(var f in Ng)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Pd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ne,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function kf(a){je(Kf.data.targets)||$g&&(Ui=a,yj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Vi=!0,hh())}function lf(){je(Kf.data.targets)||$g&&(yj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),yj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Vi=!1,ih())}function mf(a,b){"grid"===b&&a.each(function(){var a=Jf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function nf(a,c){var d,e,f,h,i,j,k,l,m,n,o,p,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,O,P,Q,R,S,T,U,V,W=$d(),X=je(Kf.data.targets),Y=Jc(Kf.data.targets);if(a=a||{},C=He(a,"withY",!0),D=He(a,"withSubchart",!0),E=He(a,"withTransition",!0),H=He(a,"withTransform",!1),I=He(a,"withUpdateXDomain",!1),J=He(a,"withUpdateOrgXDomain",!1),K=He(a,"withLegend",!1),F=He(a,"withTransitionForExit",E),G=He(a,"withTransitionForAxis",E),Q=E?$f:0,R=F?Q:0,S=G?Q:0,c=c||sf(S),K&&mh&&Ef(Ec(Kf.data.targets),a,c),Si&&0===Y.length&&zg.domain([0,dj.x.selectAll(".tick").size()]),Y.length&&(J&&(zg.domain(Jf.extent(bc(Y))),Dj=zg.domain(),Tf&&vj.scale(zg).updateScaleExtent(),Cg.domain(zg.domain()),rj.scale(Cg)),I&&(zg.domain(rj.empty()?Dj:rj.extent()),Tf&&vj.scale(zg).updateScaleExtent()),Dh||!Ch&&!Bh||(T=Lc(Kc(Y),Bh),Fg.tickValues(T),Ig.tickValues(T))),Ag.domain(Zb(Y,"y")),Bg.domain(Zb(Y,"y2")),dj.x.style("opacity",X?0:1),dj.y.style("opacity",X?0:1),dj.y2.style("opacity",X?0:1),dj.subx.style("opacity",X?0:1),c.axisX.call(Fg),c.axisY.call(Gg),c.axisY2.call(Hg),c.axisSubX.call(Ig),Gb(E),I&&Y.length)if(zh&&T){for(U=1;U=0&&Jf.select(this).style("display",b%V?"none":"block")})}else wj.selectAll("."+g.axisX+" .tick text").style("display","block");!sh&&Eh&&hb(dj.x,c.axisX,Eh),L=$e(W),O=_e(W,!0),P=_e(W,!1),Dg.domain(Ag.domain()),Eg.domain(Bg.domain()),Bj.style("display","none"),q(),yj.select("line."+g.xgridFocus).style("visibility","hidden"),bi&&(f=Xd(ci,zg),z=Si?Fg.tickOffset():0,e=sh?{x1:0,x2:cg,y1:function(a){return zg(a)-z},y2:function(a){return zg(a)-z}}:{x1:function(a){return zg(a)+z},x2:function(a){return zg(a)+z},y1:_f.top,y2:eg},d=yj.select("."+g.xgrids).selectAll("."+g.xgrid).data(f),d.enter().append("line").attr("class",g.xgrid),d.attr(e).style("opacity",function(){return+Jf.select(this).attr(sh?"y1":"x1")===(sh?eg:0)?0:1}),d.exit().remove()),De(di)&&(h=yj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(di),i=h.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),i.append("line").style("opacity",0),i.append("text").attr("text-anchor","end").attr("transform",sh?"":"rotate(-90)").attr("dx",sh?0:-_f.top).attr("dy",-5).style("opacity",0),h.select("line").transition().duration(Q).attr("x1",sh?0:Hd).attr("x2",sh?cg:Hd).attr("y1",sh?Hd:_f.top).attr("y2",sh?Hd:eg).style("opacity",1),h.select("text").transition().duration(Q).attr("x",sh?cg:0).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),h.exit().transition().duration(Q).style("opacity",0).remove()),C&&ei&&(j=yj.select("."+g.ygrids).selectAll("."+g.ygrid).data(Ag.ticks(gi)),j.enter().append("line").attr("class",g.ygrid),j.attr("x1",sh?Ag:0).attr("x2",sh?Ag:cg).attr("y1",sh?0:Ag).attr("y2",sh?eg:Ag),j.exit().remove(),mf(j,"grid")),C&&De(fi)&&(k=yj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(fi),l=k.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",sh?"rotate(-90)":"").attr("dx",sh?0:-_f.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(Q).attr("x1",sh?Id:0).attr("x2",sh?Id:cg).attr("y1",sh?0:Id).attr("y2",sh?eg:Id).style("opacity",1),k.select("text").transition().duration(Q).attr("x",sh?0:cg).attr("y",Id).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(Q).style("opacity",0).remove()),s=yj.select("."+g.regions).selectAll("."+g.region).data(Di),s.enter().append("g").attr("class",id).append("rect").style("fill-opacity",0),s.selectAll("rect").transition().duration(Q).attr("x",gc).attr("y",hc).attr("width",ic).attr("height",jc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(Q).style("opacity",0).remove(),p=yj.selectAll("."+g.bars).selectAll("."+g.bar).data(te),p.enter().append("path").attr("class",cd).style("stroke","none").style("fill",$i),p.style("opacity",ud).transition().duration(Q).attr("d",L).style("fill",$i).style("opacity",1),p.exit().transition().duration(R).style("opacity",0).remove(),m=yj.selectAll("."+g.lines).selectAll("."+g.line).data(re),m.enter().append("path").attr("class",$c).style("stroke",$i),m.style("opacity",ud).transition().duration(Q).attr("d",sj).style("stroke",$i).style("opacity",1),m.exit().transition().duration(R).style("opacity",0).remove(),n=yj.selectAll("."+g.areas).selectAll("."+g.area).data(re),n.enter().append("path").attr("class",gd).style("fill",$i).style("opacity",function(){return Ej=+Jf.select(this).style("opacity"),0}),n.style("opacity",0).transition().duration(Q).attr("d",tj).style("fill",$i).style("opacity",Ej),n.exit().transition().duration(R).style("opacity",0).remove(),o=yj.selectAll("."+g.circles).selectAll("."+g.circle).data(ue),o.enter().append("circle").attr("class",ad).attr("r",Re).style("fill",$i),o.style("opacity",ud).transition().duration(Q).style("opacity",wd).style("fill",$i).attr("cx",sh?Zd:Yd).attr("cy",sh?Yd:Zd),o.exit().remove(),t=yj.selectAll("."+g.texts).selectAll("."+g.text).data(ve),t.enter().append("text").attr("class",Wc).attr("text-anchor",function(a){return sh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",$i).style("fill-opacity",0),t.text(function(a){return Fd(a.id)(a.value,a.id)}).style("fill-opacity",vd).transition().duration(Q).attr("x",O).attr("y",P).style("fill",$i).style("fill-opacity",xd),t.exit().transition().duration(R).style("fill-opacity",0).remove(),r=yj.selectAll("."+g.arcs).selectAll("."+g.arc).data(se),r.enter().append("path").attr("class",ed).style("fill",function(a){return $i(a.data)}).style("cursor",function(a){return ah(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Yi||(c=Hb(a),d=Nb(c),e=Vb(),Pb(c.data.id),Af(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Hb(a),c=Nb(b),d=[c];Td(d,Jf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Yi||(c=Hb(a),d=Nb(c),e=Wb(),Qb(c.data.id),Bf(),Ud(),e(d,b))}).on("click",function(a,b){var c=Hb(a),d=Nb(c),e=Ub();hf(this,a,b),e(d,b)}),r.attr("transform",H?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Yi=!0}).transition().duration(Q).attrTween("d",function(a){var b,c=Hb(a);return c?(b=Jf.interpolate(this._current,c),this._current=b(0),function(a){return Kb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",H?"scale(1)":"").style("fill",function(a){return $i(a.data)}).style("opacity",1).call(Ge,function(){Yi=!1}),r.exit().transition().duration(R).style("opacity",0).remove(),yj.selectAll("."+g.chartArc).select("text").attr("transform",Lb).style("opacity",0).transition().duration(Q).text(Ob).style("opacity",function(a){return Hc(a.data.id)&&qe(a.data)?1:0}),yj.select("."+g.chartArcsTitle).style("opacity",ie(Kf.data.targets)?1:0),jh&&(Jf.event&&"zoom"===Jf.event.type&&rj.extent(zg.orgDomain()).update(),D&&(!sh&&Eh&&hb(dj.subx,c.axisSubX,Eh),rj.empty()||rj.extent(zg.orgDomain()).update(),M=$e(W,!0),v=zj.selectAll("."+g.bars).selectAll("."+g.bar).data(te),v.enter().append("path").attr("class",cd).style("stroke","none").style("fill",$i),v.style("opacity",ud).transition().duration(Q).attr("d",M).style("opacity",1),v.exit().transition().duration(Q).style("opacity",0).remove(),u=zj.selectAll("."+g.lines).selectAll("."+g.line).data(re),u.enter().append("path").attr("class",$c).style("stroke",$i),u.style("opacity",ud).transition().duration(Q).attr("d",uj).style("opacity",1),u.exit().transition().duration(Q).style("opacity",0).remove())),yj.selectAll("."+g.selectedCircles).filter(function(a){return me(a)}).selectAll("circle").remove(),yj.selectAll("."+g.selectedCircle).transition().duration(Q).attr("cx",sh?Zd:Yd).attr("cy",sh?Yd:Zd),w=yj.select("."+g.eventRects),De(Kg)&&!qc(Kg)?(w.classed(g.eventRectsMultiple)||w.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),x=yj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),gf(x.enter()),x.attr("x",0).attr("y",0).attr("width",cg).attr("height",eg)):(w.classed(g.eventRectsSingle)||w.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Ti&&!Si?(B=function(a,b){var c=zc(b),d=Ac(b),e=Kf.data.xs[a.id][b];return(zg(d?d:e+50)-zg(c?c:e-50))/2},A=function(a,b){var c=zc(b),d=Kf.data.xs[a.id][b];return(zg(d)+zg(c?c:d-50))/2}):(B=N(),A=function(a){return zg(a.x)-B/2}),y=Cc(Kf.data.targets),yj.select("."+g.eventRects).datum(y?y.values:[]),x=yj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),ff(x.enter()),x.attr("class",jd).attr("x",sh?0:A).attr("y",sh?A:0).attr("width",sh?cg:B).attr("height",sh?B:eg),x.exit().remove()),Ec(Kf.data.targets).forEach(function(a){Fj[a]=!0})}function of(){nf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function pf(){if(0!==Jc(Kf.data.targets).length){if("mousemove"===Jf.event.sourceEvent.type&&vj.altDomain)return zg.domain(vj.altDomain),void vj.scale(zg).updateScaleExtent();Si&&zg.orgDomain()[0]===Dj[0]&&zg.domain([Dj[0]-1e-10,zg.orgDomain()[1]]),nf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Jf.event.sourceEvent.type&&(Wi=!0)}}function qf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function rf(){wj.attr("width",gg).attr("height",hg),wj.select("#"+Li).select("rect").attr("width",cg).attr("height",eg),wj.select("#"+Mi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),wj.select("#"+Ni).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),wj.select("."+g.zoomRect).attr("width",cg).attr("height",eg),Cj.style("max-height",hg+"px")}function sf(a){return{axisX:a?dj.x.transition().duration(a):dj.x,axisY:a?dj.y.transition().duration(a):dj.y,axisY2:a?dj.y2.transition().duration(a):dj.y2,axisSubX:a?dj.subx.transition().duration(a):dj.subx}}function tf(a){var b;a=a||{},a.withTransition=He(a,"withTransition",!0),a.withTransform=He(a,"withTransform",!1),a.withLegend=He(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withLegend&&mh||(b=sf(a.withTransitionForAxis?$f:0),p(),T(),rf(),o(a.withTransition,b)),nf(a,b)}function uf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=yj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",ld),j=i.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Xc),e=yj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",nd),d=e.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",dd).style("cursor",function(a){return ah(a)?"pointer":null}),c=yj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",md),b=c.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",_c),b.append("g").attr("class",hd),b.append("g").attr("class",function(a){return Vc(g.selectedCircles,a.id)}),b.append("g").attr("class",bd).style("cursor",function(a){return ah(a)?"pointer":null}),a.forEach(function(a){yj.selectAll("."+g.selectedCircles+pd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=yj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(qg(a)).attr("class",od),f=h.enter().append("g").attr("class",od),f.append("g").attr("class",fd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),jh&&(n=zj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",nd),m=n.enter().append("g").style("opacity",0).attr("class",nd),m.append("g").attr("class",dd),l=zj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",md),k=l.enter().append("g").style("opacity",0).attr("class",md),k.append("g").attr("class",_c)),wj.selectAll("."+g.target).filter(function(a){return Hc(a.id)}).transition().duration($f).style("opacity",1)}function vf(a,b){b.filter&&(a=a.filter(b.filter)),(b.type||b.types)&&a.forEach(function(a){b.types?de(a.id,b.types[a.id]):de(a.id,b.type)}),Kf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,z=0,F++)),E[a]=F,D[F]=f,A[a]=z,z+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+v)/10),j=10*Math.ceil((h.height+u)/10),k=jj?j:i,l=jj?S():R();return d&&(z=0,F=0,w=0,x=0),mh&&!Ic(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=i,C[c]=j,(!w||i>=w)&&(w=i),(!x||j>=x)&&(x=j),g=jj?x:w,void(rh?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(l-g*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=26,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=Aj.selectAll("."+g.legendItemFocused).size();b=b||{},n=He(b,"withTransition",!0),q=He(b,"withTransitionForTransform",!0),jj?(f=function(a){return w*E[a]},j=function(a){return D[E[a]]+A[a]}):(f=function(a){return D[E[a]]+A[a]},j=function(a){return x*E[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=Aj.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Vc(g.legendItem,a)}).style("visibility",function(a){return Ic(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof oh?oh(a):Kf.toggle(a)}).on("mouseover",function(a){Jf.select(this).classed(g.legendItemFocused,!0),Yi||Kf.focus(a),"function"==typeof ph&&ph(a)}).on("mouseout",function(a){Jf.select(this).classed(g.legendItemFocused,!1),Yi||Kf.revert(),"function"==typeof qh&&qh(a)}),m.append("text").text(function(a){return d(Ng[a])?Ng[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",jj?h:-200).attr("y",jj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",jj?i:-200).attr("y",jj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",$i).attr("x",jj?h:-200).attr("y",jj?-200:j).attr("width",10).attr("height",10),r=Aj.selectAll("text").data(a).text(function(a){return d(Ng[a])?Ng[a]:a}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=Aj.selectAll("rect."+g.legendItemEvent).data(a),(n?s.transition():s).attr("width",function(a){return B[a]}).attr("height",function(a){return C[a]}).attr("x",i).attr("y",l),t=Aj.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",$i).attr("x",f).attr("y",j),Aj.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Hc(a)}).transition().style("opacity",function(a){var b=Jf.select(this);return Hc(a)?!G||b.classed(g.legendItemFocused)?yf(b):zf(b):nj}),P(w),Q(x),O(F),p(),T(),rf(),o(q,c)}function Ff(a){return Gc(Kf.data.targets,a.id)}function Gf(a){return"data"in a&&Gc(Kf.data.targets,a.data.id)}function Hf(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 If(a,b,c){var d=!je(Kf.data.targets);Yi=!1,de(a,b),tf(c||{withTransitionForAxis:d})}var Jf=a.d3?a.d3:a.require?a.require("d3"):void 0,Kf={data:{},axis:{},legend:{}},Lf={},Mf=i(["bindto"],"#chart"),Nf=i(["size","width"]),Of=i(["size","height"]),Pf=i(["padding","left"],50),Qf=i(["padding","right"],0),Rf=i(["padding","top"],0),Sf=i(["padding","bottom"],0),Tf=i(["zoom","enabled"],!1),Uf=i(["zoom","extent"]),Vf=i(["zoom","privileged"],!1),Wf=i(["onenter"],function(){}),Xf=i(["onleave"],function(){}),Yf=i(["onresize"],function(){}),Zf=i(["onresized"],function(){}),$f=i(["transition","duration"],350);h("data","data is required in config");var _f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg=i(["data","x"]),Kg=i(["data","xs"],{}),Lg=i(["data","x_format"]),Mg=i(["data","id_converter"],function(a){return a}),Ng=i(["data","names"],{}),Og=i(["data","classes"],{}),Pg=i(["data","groups"],[]),Qg=i(["data","axes"],{}),Rg=i(["data","type"]),Sg=i(["data","types"],{}),Tg=i(["data","labels"],{}),Ug=i(["data","order"]),Vg=i(["data","regions"],{}),Wg=i(["data","color"]),Xg=i(["data","colors"],{}),Yg=i(["data","hide"],!1),Zg=i(["data","filter"]),$g=i(["data","selection","enabled"],!1),_g=i(["data","selection","grouped"],!1),ah=i(["data","selection","isselectable"],function(){return!0}),bh=i(["data","selection","multiple"],!0),ch=i(["data","onclick"],function(){}),dh=i(["data","onenter"],function(){}),eh=i(["data","onleave"],function(){}),fh=i(["data","onselected"],function(){}),gh=i(["data","onunselected"],function(){}),hh=i(["data","ondragstart"],function(){}),ih=i(["data","ondragend"],function(){}),jh=i(["subchart","show"],!1),kh=i(["subchart","size","height"],60),lh=i(["color","pattern"],[]),mh=i(["legend","show"],!0),nh=i(["legend","position"],"bottom"),oh=i(["legend","item","onclick"]),ph=i(["legend","item","onmouseover"]),qh=i(["legend","item","onmouseout"]),rh=i(["legend","equally"],!1),sh=i(["axis","rotated"],!1),th=i(["axis","x","show"],!0),uh=i(["axis","x","type"],"indexed"),vh=i(["axis","x","localtime"],!0),wh=i(["axis","x","categories"],[]),xh=i(["axis","x","tick","centered"],!1),yh=i(["axis","x","tick","format"]),zh=i(["axis","x","tick","culling"],{}),Ah=i(["axis","x","tick","culling","max"],10),Bh=i(["axis","x","tick","count"]),Ch=i(["axis","x","tick","fit"],!0),Dh=i(["axis","x","tick","values"],null),Eh=i(["axis","x","tick","rotate"]),Fh=i(["axis","x","max"],null),Gh=i(["axis","x","min"],null),Hh=i(["axis","x","padding"],{}),Ih=i(["axis","x","height"]),Jh=i(["axis","x","default"]),Kh=i(["axis","x","label"],{}),Lh=i(["axis","y","show"],!0),Mh=i(["axis","y","max"]),Nh=i(["axis","y","min"]),Oh=i(["axis","y","center"]),Ph=i(["axis","y","label"],{}),Qh=i(["axis","y","inner"],!1),Rh=i(["axis","y","tick","format"]),Sh=i(["axis","y","padding"]),Th=i(["axis","y","ticks"],10),Uh=i(["axis","y2","show"],!1),Vh=i(["axis","y2","max"]),Wh=i(["axis","y2","min"]),Xh=i(["axis","y2","center"]),Yh=i(["axis","y2","label"],{}),Zh=i(["axis","y2","inner"],!1),$h=i(["axis","y2","tick","format"]),_h=i(["axis","y2","padding"]),ai=i(["axis","y2","ticks"],10),bi=i(["grid","x","show"],!1),ci=i(["grid","x","type"],"tick"),di=i(["grid","x","lines"],[]),ei=i(["grid","y","show"],!1),fi=i(["grid","y","lines"],[]),gi=i(["grid","y","ticks"],10),hi=i(["point","show"],!0),ii=i(["point","r"],2.5),ji=i(["point","focus","line","enabled"],!0),ki=i(["point","focus","expand","enabled"],!0),li=i(["point","focus","expand","r"]),mi=i(["point","focus","select","r"]),ni=i(["line","connect_null"],!1),oi=i(["bar","width"]),pi=i(["bar","width","ratio"],.6),qi=i(["pie","label","show"],!0),ri=i(["pie","label","format"]),si=i(["pie","expand"],!0),ti=i(["pie","onclick"],function(){}),ui=i(["pie","onmouseover"],function(){}),vi=i(["pie","onmouseout"],function(){}),wi=i(["donut","label","show"],!0),xi=i(["donut","label","format"]),yi=i(["donut","expand"],!0),zi=i(["donut","title"],""),Ai=i(["donut","onclick"],function(){}),Bi=i(["donut","onmouseover"],function(){}),Ci=i(["donut","onmouseout"],function(){}),Di=i(["regions"],[]),Ei=i(["tooltip","show"],!0),Fi=i(["tooltip","format","title"]),Gi=i(["tooltip","format","value"]),Hi=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Fi?Fi:b,l=Gi?Gi:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Ii=i(["tooltip","init","show"],!1),Ji=i(["tooltip","init","x"],0),Ki=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Li=("string"==typeof Mf?Mf.replace("#",""):Mf.id)+"-clip",Mi=Li+"-xaxis",Ni=Li+"-yaxis",Oi=j(Li),Pi=j(Mi),Qi=j(Ni),Ri="timeseries"===uh,Si="categorized"===uh,Ti=!Ri&&(Jg||De(Kg)),Ui=null,Vi=!1,Wi=!1,Xi=!1,Yi=!1,Zi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],$i=xe(Xg,De(lh)?lh:Zi,Wg),_i=vh?Jf.time.format:Jf.time.format.utc,aj=_i.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),bj=[],cj=[],dj={},ej=sh?"left":"bottom",fj=sh?Qh?"top":"bottom":Qh?"right":"left",gj=sh?Zh?"bottom":"top":Zh?"left":"right",hj=sh?"left":"bottom",ij={main:function(){return"translate("+k(_f.left)+","+k(_f.top)+")"},context:function(){return"translate("+k(ag.left)+","+k(ag.top)+")"},legend:function(){return"translate("+bg.left+","+bg.top+")"},x:function(){return"translate(0,"+(sh?0:eg)+")"},y:function(){return"translate(0,"+(sh?eg:0)+")"},y2:function(){return"translate("+(sh?0:cg)+","+(sh?1:0)+")" -},subx:function(){return"translate(0,"+(sh?0:fg)+")"},arc:function(){return"translate("+lg/2+","+mg/2+")"}},jj="right"===nh,kj=0,lj=0,mj=0,nj=.15,oj=30,pj=sh&&!th?0:30,qj=5;qg=Jf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var rj,sj=function(){var a=Jf.svg.line().x(sh?function(a){return Y(a.id)(a.value)}:Gd).y(sh?Gd:function(a){return Y(a.id)(a.value)});return ni||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ni?Qe(b.values):b.values;return ke(b)?(a.interpolate(le(b)?"cardinal":"linear"),Vg[b.id]?df(e,zg,Y(b.id),Vg[b.id]):a(e)):(c=e[0]?zg(e[0].x):0,d=e[0]?Y(b.id)(e[0].value):0,sh?"M "+d+" "+c:"M "+c+" "+d)}}(),tj=function(){var a;return a=sh?Jf.svg.area().x0(function(a){return Y(a.id)(0)}).x1(function(a){return Y(a.id)(a.value)}).y(Gd):Jf.svg.area().x(Gd).y0(function(a){return Y(a.id)(0)}).y1(function(a){return Y(a.id)(a.value)}),function(b){var c,d,e=Qe(b.values);return ee([b],"area")||ee([b],"area-spline")?(a.interpolate(le(b)?"cardinal":"linear"),a(e)):(c=e[0]?zg(e[0].x):0,d=e[0]?Y(b.id)(e[0].value):0,sh?"M "+d+" "+c:"M "+c+" "+d)}}(),uj=function(){var a=Jf.svg.line().x(sh?function(a){return Z(a.id)(a.value)}:Jd).y(sh?Jd:function(a){return Z(a.id)(a.value)});return function(b){var c=Qe(b.values);return ke(b)?a(c):"M "+Cg(c[0].x)+" "+Z(b.id)(c[0].value)}}(),vj=function(){};rj=Jf.svg.brush().on("brush",of),rj.update=function(){return zj&&zj.select("."+g.brush).call(this),this},rj.scale=function(a){return sh?this.y(a):this.x(a)},Tf&&(vj=Jf.behavior.zoom().on("zoomstart",function(){vj.altDomain=Jf.event.sourceEvent.altKey?zg.orgDomain():null}).on("zoom",Tf?pf:null),vj.scale=function(a){return sh?this.y(a):this.x(a)},vj.orgScaleExtent=function(){var a=Uf?Uf:[1,10];return[a[0],Math.max(Bc()/a[1],a[1])]},vj.updateScaleExtent=function(){var a=cc(zg.orgDomain())/cc(Dj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var wj,xj,yj,zj,Aj,Bj,Cj,Dj,Ej,Fj={};if(Kf.focus=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",1)}var c=wj.selectAll(qd(a)),d=c.filter(Ff),e=c.filter(Gf);Kf.revert(),Kf.defocus(),b(d.classed(g.focused,!0)),b(e),je(Kf.data.targets)&&Pb(a,!0),Af(a,!0)},Kf.defocus=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",.3)}var c=wj.selectAll(qd(a)),d=c.filter(Ff),e=c.filter(Gf);Kf.revert(),b(d.classed(g.focused,!1)),b(e),je(Kf.data.targets)&&Qb(a),Af(a,!1)},Kf.revert=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",1)}var c=wj.selectAll(qd(a)),d=c.filter(Ff),e=c.filter(Gf);b(d.classed(g.focused,!1)),b(e),je(Kf.data.targets)&&Qb(a),Bf()},Kf.show=function(a,b){a=Fc(a),b=b||{},Nc(a),wj.selectAll(rd(a)).transition().style("opacity",1),b.withLegend&&Cf(a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Kf.hide=function(a,b){a=Fc(a),b=b||{},Mc(a),wj.selectAll(rd(a)).transition().style("opacity",0),b.withLegend&&Df(a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Kf.toggle=function(a){Hc(a)?Kf.hide(a):Kf.show(a)},Kf.unzoom=function(){rj.clear().update(),nf({withUpdateXDomain:!0})},Kf.load=function(a){return a.xs&&pc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Og[b]=a.classes[b]}),"categories"in a&&Si&&(wh=a.categories,Fg.categories(wh)),"cacheIds"in a&&dc(a.cacheIds)?void vf(fc(a.cacheIds),a.done):void("unload"in a?xf(Fc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){wf(a)}):wf(a))},Kf.unload=function(a,b){xf(Fc(a),function(){nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Kf.selected=function(a){return Jf.merge(yj.selectAll("."+g.shapes+pd(a)).selectAll("."+g.shape).filter(function(){return Jf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Kf.select=function(a,b,c){$g&&yj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Jf.select(this),i=e.data?e.data.id:e.id,j=Pe(this),k=_g||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);"path"!==this.nodeName&&(k&&l?ah(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},Kf.unselect=function(a,b){$g&&yj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Jf.select(this),f=c.data?c.data.id:c.id,h=Pe(this),i=_g||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);"path"!==this.nodeName&&i&&j&&ah(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Kf.toLine=function(a){If(a,"line")},Kf.toSpline=function(a){If(a,"spline")},Kf.toBar=function(a){If(a,"bar")},Kf.toScatter=function(a){If(a,"scatter")},Kf.toArea=function(a){If(a,"area")},Kf.toAreaSpline=function(a){If(a,"area-spline")},Kf.toPie=function(a){If(a,"pie",{withTransform:!0})},Kf.toDonut=function(a){If(a,"donut",{withTransform:!0})},Kf.groups=function(a){return c(a)?Pg:(Pg=a,nf(),Pg)},Kf.xgrids=function(a){return a?(di=a,nf(),di):di},Kf.xgrids.add=function(a){return a?Kf.xgrids(di.concat(a)):void 0},Kf.xgrids.remove=function(a){var b=Hf(a);return Kf.xgrids(di.filter(b))},Kf.ygrids=function(a){return a?(fi=a,nf(),fi):fi},Kf.ygrids.add=function(a){return a?Kf.ygrids(fi.concat(a)):void 0},Kf.ygrids.remove=function(a){var b=Hf(a);return Kf.ygrids(fi.filter(b))},Kf.regions=function(a){return a?(Di=a,nf(),Di):Di},Kf.regions.add=function(a){return a?(Di=Di.concat(a),nf(),Di):Di},Kf.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;wj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Di=Di.filter(function(b){return b.classes.indexOf(a)<0})}),Di},Kf.data.get=function(a){var b=Kf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Kf.data.getAsTarget=function(a){var b=Kf.data.targets.filter(function(b){return b.id===a});return b.length>0?b[0]:void 0},Kf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Ng[b]=a[b]}),nf({withLegend:!0}),Ng):Ng},Kf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Xg[b]=a[b]}),nf({withLegend:!0}),Xg):Xg},Kf.x=function(a){return arguments.length&&(sc(Kf.data.targets,a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Kf.data.xs},Kf.xs=function(a){return arguments.length&&(tc(Kf.data.targets,a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Kf.data.xs},Kf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){eb(b,a[b])}),Gb())},Kf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Fh=+a.x),b(a.y)&&(Mh=+a.y),b(a.y2)&&(Vh=+a.y2)):Mh=Vh=+a,nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Kf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Gh=+a.x),b(a.y)&&(Nh=+a.y),b(a.y2)&&(Wh=+a.y2)):Nh=Wh=+a,nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Kf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Kf.axis.max(a.max),"undefined"!=typeof a.min&&Kf.axis.min(a.min))},Kf.legend.show=function(a){Cf(Fc(a)),nf({withLegend:!0})},Kf.legend.hide=function(a){Df(Fc(a)),nf({withLegend:!0})},Kf.resize=function(a){Nf=a?a.width:null,Of=a?a.height:null,tf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Kf.destroy=function(){Kf.data.targets=void 0,Kf.data.xs={},Cj.html(""),a.onresize=null},"url"in f.data)Jf.xhr(f.data.url,function(a,b){var c,d=Jf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Jf.csv.parse(b.response),ef(c)});else if("rows"in f.data)ef(vc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");ef(wc(f.data.columns))}return Kf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(window); \ No newline at end of file +},subx:function(){return"translate(0,"+(sh?0:fg)+")"},arc:function(){return"translate("+lg/2+","+mg/2+")"}},jj="right"===nh,kj=0,lj=0,mj=0,nj=.15,oj=30,pj=sh&&!th?0:30,qj=5;qg=Jf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var rj,sj=function(){var a=Jf.svg.line().x(sh?function(a){return Y(a.id)(a.value)}:Gd).y(sh?Gd:function(a){return Y(a.id)(a.value)});return ni||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ni?Qe(b.values):b.values;return ke(b)?(a.interpolate(le(b)?"cardinal":"linear"),Vg[b.id]?df(e,zg,Y(b.id),Vg[b.id]):a(e)):(c=e[0]?zg(e[0].x):0,d=e[0]?Y(b.id)(e[0].value):0,sh?"M "+d+" "+c:"M "+c+" "+d)}}(),tj=function(){var a;return a=sh?Jf.svg.area().x0(function(a){return Y(a.id)(0)}).x1(function(a){return Y(a.id)(a.value)}).y(Gd):Jf.svg.area().x(Gd).y0(function(a){return Y(a.id)(0)}).y1(function(a){return Y(a.id)(a.value)}),function(b){var c,d,e=Qe(b.values);return ee([b],"area")||ee([b],"area-spline")?(a.interpolate(le(b)?"cardinal":"linear"),a(e)):(c=e[0]?zg(e[0].x):0,d=e[0]?Y(b.id)(e[0].value):0,sh?"M "+d+" "+c:"M "+c+" "+d)}}(),uj=function(){var a=Jf.svg.line().x(sh?function(a){return Z(a.id)(a.value)}:Jd).y(sh?Jd:function(a){return Z(a.id)(a.value)});return function(b){var c=Qe(b.values);return ke(b)?a(c):"M "+Cg(c[0].x)+" "+Z(b.id)(c[0].value)}}(),vj=function(){};rj=Jf.svg.brush().on("brush",of),rj.update=function(){return zj&&zj.select("."+g.brush).call(this),this},rj.scale=function(a){return sh?this.y(a):this.x(a)},Tf&&(vj=Jf.behavior.zoom().on("zoomstart",function(){vj.altDomain=Jf.event.sourceEvent.altKey?zg.orgDomain():null}).on("zoom",Tf?pf:null),vj.scale=function(a){return sh?this.y(a):this.x(a)},vj.orgScaleExtent=function(){var a=Uf?Uf:[1,10];return[a[0],Math.max(Bc()/a[1],a[1])]},vj.updateScaleExtent=function(){var a=cc(zg.orgDomain())/cc(Dj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var wj,xj,yj,zj,Aj,Bj,Cj,Dj,Ej,Fj={};if(Kf.focus=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",1)}var c=wj.selectAll(qd(a)),d=c.filter(Ff),e=c.filter(Gf);Kf.revert(),Kf.defocus(),b(d.classed(g.focused,!0)),b(e),je(Kf.data.targets)&&Pb(a,!0),Af(a,!0)},Kf.defocus=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",.3)}var c=wj.selectAll(qd(a)),d=c.filter(Ff),e=c.filter(Gf);Kf.revert(),b(d.classed(g.focused,!1)),b(e),je(Kf.data.targets)&&Qb(a),Af(a,!1)},Kf.revert=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",1)}var c=wj.selectAll(qd(a)),d=c.filter(Ff),e=c.filter(Gf);b(d.classed(g.focused,!1)),b(e),je(Kf.data.targets)&&Qb(a),Bf()},Kf.show=function(a,b){a=Fc(a),b=b||{},Nc(a),wj.selectAll(rd(a)).transition().style("opacity",1),b.withLegend&&Cf(a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Kf.hide=function(a,b){a=Fc(a),b=b||{},Mc(a),wj.selectAll(rd(a)).transition().style("opacity",0),b.withLegend&&Df(a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Kf.toggle=function(a){Hc(a)?Kf.hide(a):Kf.show(a)},Kf.unzoom=function(){rj.clear().update(),nf({withUpdateXDomain:!0})},Kf.load=function(a){return a.xs&&pc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Og[b]=a.classes[b]}),"categories"in a&&Si&&(wh=a.categories,Fg.categories(wh)),"cacheIds"in a&&dc(a.cacheIds)?void vf(fc(a.cacheIds),a.done):void("unload"in a?xf(Fc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){wf(a)}):wf(a))},Kf.unload=function(a,b){xf(Fc(a),function(){nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Kf.selected=function(a){return Jf.merge(yj.selectAll("."+g.shapes+pd(a)).selectAll("."+g.shape).filter(function(){return Jf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Kf.select=function(a,b,c){$g&&yj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Jf.select(this),i=e.data?e.data.id:e.id,j=Pe(this),k=_g||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);"path"!==this.nodeName&&(k&&l?ah(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},Kf.unselect=function(a,b){$g&&yj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Jf.select(this),f=c.data?c.data.id:c.id,h=Pe(this),i=_g||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);"path"!==this.nodeName&&i&&j&&ah(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Kf.toLine=function(a){If(a,"line")},Kf.toSpline=function(a){If(a,"spline")},Kf.toBar=function(a){If(a,"bar")},Kf.toScatter=function(a){If(a,"scatter")},Kf.toArea=function(a){If(a,"area")},Kf.toAreaSpline=function(a){If(a,"area-spline")},Kf.toPie=function(a){If(a,"pie",{withTransform:!0})},Kf.toDonut=function(a){If(a,"donut",{withTransform:!0})},Kf.groups=function(a){return c(a)?Pg:(Pg=a,nf(),Pg)},Kf.xgrids=function(a){return a?(di=a,nf(),di):di},Kf.xgrids.add=function(a){return a?Kf.xgrids(di.concat(a)):void 0},Kf.xgrids.remove=function(a){var b=Hf(a);return Kf.xgrids(di.filter(b))},Kf.ygrids=function(a){return a?(fi=a,nf(),fi):fi},Kf.ygrids.add=function(a){return a?Kf.ygrids(fi.concat(a)):void 0},Kf.ygrids.remove=function(a){var b=Hf(a);return Kf.ygrids(fi.filter(b))},Kf.regions=function(a){return a?(Di=a,nf(),Di):Di},Kf.regions.add=function(a){return a?(Di=Di.concat(a),nf(),Di):Di},Kf.regions.remove=function(a){var b,c,d;return a=a||{},b=He(a,"duration",$f),c=He(a,"classes",[g.region]),d=yj.select("."+g.regions).selectAll(c.map(function(a){return"."+a})),(b?d.transition().duration(b):d).style("opacity",0).remove(),Di=Di.filter(function(a){return c.indexOf(a.class)<0})},Kf.data.get=function(a){var b=Kf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Kf.data.getAsTarget=function(a){var b=Kf.data.targets.filter(function(b){return b.id===a});return b.length>0?b[0]:void 0},Kf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Ng[b]=a[b]}),nf({withLegend:!0}),Ng):Ng},Kf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Xg[b]=a[b]}),nf({withLegend:!0}),Xg):Xg},Kf.x=function(a){return arguments.length&&(sc(Kf.data.targets,a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Kf.data.xs},Kf.xs=function(a){return arguments.length&&(tc(Kf.data.targets,a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Kf.data.xs},Kf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){eb(b,a[b])}),Gb())},Kf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Fh=+a.x),b(a.y)&&(Mh=+a.y),b(a.y2)&&(Vh=+a.y2)):Mh=Vh=+a,nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Kf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Gh=+a.x),b(a.y)&&(Nh=+a.y),b(a.y2)&&(Wh=+a.y2)):Nh=Wh=+a,nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Kf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Kf.axis.max(a.max),"undefined"!=typeof a.min&&Kf.axis.min(a.min))},Kf.legend.show=function(a){Cf(Fc(a)),nf({withLegend:!0})},Kf.legend.hide=function(a){Df(Fc(a)),nf({withLegend:!0})},Kf.resize=function(a){Nf=a?a.width:null,Of=a?a.height:null,tf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Kf.destroy=function(){Kf.data.targets=void 0,Kf.data.xs={},Cj.html(""),a.onresize=null},"url"in f.data)Jf.xhr(f.data.url,function(a,b){var c,d=Jf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Jf.csv.parse(b.response),ef(c)});else if("rows"in f.data)ef(vc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");ef(wc(f.data.columns))}return Kf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(window); \ No newline at end of file diff --git a/htdocs/samples/regions.html b/htdocs/samples/regions.html index 27e6244..f7c4b1b 100644 --- a/htdocs/samples/regions.html +++ b/htdocs/samples/regions.html @@ -53,6 +53,14 @@ chart.regions.add([{start:4.5}]); }, 4000); + setTimeout(function () { + chart.regions.add([{start:3,end:3.5,class:"region1"}, {start:4,end:4.5,class:"region2"}]); + }, 4000); + + setTimeout(function () { + chart.regions.remove({classes:['region1', 'region2'], duration: 0}); + }, 5000); + From bafe707e95fb4cf3e699da57500d84a3515a5f4c Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Fri, 9 May 2014 16:32:45 +0900 Subject: [PATCH 157/178] Modify default padding.right --- c3.js | 2 +- c3.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/c3.js b/c3.js index ddde29a..c50fc46 100644 --- a/c3.js +++ b/c3.js @@ -110,7 +110,7 @@ __size_height = getConfig(['size', 'height']); var __padding_left = getConfig(['padding', 'left'], 50), - __padding_right = getConfig(['padding', 'right'], 0), + __padding_right = getConfig(['padding', 'right'], 10), __padding_top = getConfig(['padding', 'top'], 0), __padding_bottom = getConfig(['padding', 'bottom'], 0); diff --git a/c3.min.js b/c3.min.js index f4f42db..cf177de 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ !function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.ceil(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.ceil(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&acg&&(cg=0),0>eg&&(eg=0),dg=sh?_f.left-oj-pj:cg,fg=sh?eg:hg-ag.top-ag.bottom,0>dg&&(dg=0),0>fg&&(fg=0),lg=cg-(jj?b+10:0),mg=eg-(jj?0:10),r(),jj&&d&&(bg.left=lg/2+1.1*jg)}function q(){yj.select("line."+g.xgridFocus).attr("x1",sh?0:-10).attr("x2",sh?cg:-10).attr("y1",sh?-10:_f.top).attr("y2",sh?-10:eg)}function r(){jg=Math.min(lg,mg)/2,ig=.95*jg,kg=ie(Kf.data.targets)?.6*ig:0}function s(){var a=sh?g.axisX:g.axisY,b=yj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Jf.select(Mf).node().getBoundingClientRect(),e=je(Kf.data.targets),f=c.right-d.left-(e?0:v());return f>0?f:0}function t(){return Nf?Nf:z()}function u(){var a=Of?Of:A();return a>0?a:320}function v(){var a=1;return Pf?Pf:sh?th?x("x"):a:!Lh||Qh?a:x("y")}function w(){var a=1;return Qf?Qf:jj?R()+20+(Uh&&!sh?x("y2"):a):Uh?Zh||sh?a:x("y2"):a}function x(a){var b=mb(a);return b.isInner?20+Fb(a):40+Fb(a)}function y(a){return"x"!==a||th?"x"===a&&Ih?Ih:"y"!==a||Lh?"y2"!==a||Uh?(mb(a).isInner?30:40)+("y2"===a?-10:0):qj:mh&&!jj?10:1:0}function z(){return+Jf.select(Mf).style("width").replace("px","")}function A(){return+Jf.select(Mf).style("height").replace("px","")}function B(a){return a?-31:-(_f.left-1)}function C(a){return a?-20:-4}function D(){return B(!sh)}function E(){return C(!sh)}function F(){return B(sh)}function G(){return C(sh)}function H(a){return a?cg+2+30+30:_f.left+20}function I(a){return a?(Ih?Ih:0)+80:eg+8}function J(){return H(!sh)}function K(){return I(!sh)}function L(){return H(sh)}function M(){return I(sh)}function N(){var a,b,c,d,e,f=Cc(Kf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=zg(b.x)-zg(a.x),0===c?sh?eg:cg:(d=Bc(),e=fe(Kf.data.targets)?(d-(Si?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function O(a){kj=a}function P(a){lj=a}function Q(a){mj=a}function R(){return mh?jj?lj*(kj+1):gg:0}function S(){return mh?jj?hg:mj*(kj+1):0}function T(){var a,b,c=!zg;rg=sh?1:0,sg=sh?eg:cg,tg=sh?0:eg,ug=sh?cg:1,vg=rg,wg=sg,xg=sh?0:fg,yg=sh?dg:1,zg=W(rg,sg,c?void 0:zg.domain(),function(){return Fg.tickOffset()}),Ag=X(tg,ug,c?void 0:Ag.domain()),Bg=X(tg,ug,c?void 0:Bg.domain()),Cg=W(rg,sg,Dj,function(a){return a%1?0:Ig.tickOffset()}),Dg=X(xg,yg,c?void 0:Dg.domain()),Eg=X(xg,yg,c?void 0:Eg.domain()),a=bb(),b=Dh?Dh:c?void 0:Fg.tickValues(),Fg=$(zg,ej,a,b),Ig=$(Cg,hj,a,b),Gg=_(Ag,fj,Rh,Th),Hg=_(Bg,gj,$h,ai),c||(rj.scale(Cg),Tf&&vj.scale(zg)),U()}function U(){ng=Ib(),og=Jb(),pg=Jb(.98)}function V(a,b,c){return(c?Jf.time.scale():Jf.scale.linear()).range([a,b])}function W(a,b,c,d){var e,f=V(a,b,Ri),g=c?f.domain(c):f;Si?(d=d||function(){return 0},f=function(a,b){var c=g(a)+d(a);return b?c:Math.ceil(c)}):f=function(a,b){var c=g(a);return b?c:Math.ceil(c)};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return Dj&&Dj[0]===a[0]&&Dj[1]a?a.toFixed(0):a};return yh&&("function"==typeof yh?a=yh:Ri&&(a=function(a){return a?_i(yh)(a):""})),a}function cb(a){var b;return"y"===a?b=Ph:"y2"===a?b=Yh:"x"===a&&(b=Kh),b}function db(a){var b=cb(a);return"string"==typeof b?b:b?b.text:null}function eb(a,b){var c=cb(a);"string"==typeof c?"y"===a?Ph=b:"y2"===a?Yh=b:"x"===a&&(Kh=b):c&&(c.text=b)}function fb(a){return 10*Math.sin(Math.PI*(a/180))}function gb(a){return 11.5-2.5*(a/15)}function hb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",gb(c)).attr("x",fb(c)).attr("transform","rotate("+c+")")}function ib(a,b){var c=cb(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 jb(){return ib("x",sh?"inner-top":"inner-right")}function kb(){return ib("y",sh?"inner-right":"inner-top")}function lb(){return ib("y2",sh?"inner-right":"inner-top")}function mb(a){return"y2"===a?lb():"y"===a?kb():jb()}function nb(){return db("x")}function ob(){return db("y")}function pb(){return db("y2")}function qb(a,b){return a?b.isLeft?0:b.isCenter?cg/2:cg:b.isBottom?-eg:b.isMiddle?-eg/2:0}function rb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function sb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function tb(){return qb(!sh,jb())}function ub(){return qb(sh,kb())}function vb(){return qb(sh,lb())}function wb(){return rb(!sh,jb())}function xb(){return rb(sh,kb())}function yb(){return rb(sh,lb())}function zb(){var a=jb();return sh?a.isInner?"1.2em":-25-Fb("x"):a.isInner?"-0.5em":Ih?Ih-10:"3em"}function Ab(){var a=kb();return sh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Fb("y")}function Bb(){var a=lb();return sh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Fb("y2")}function Cb(){return sb(!sh,jb())}function Db(){return sb(sh,kb())}function Eb(){return sb(sh,lb())}function Fb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Jf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Gb(a){var b=yj.select("."+g.axisX+" ."+g.axisXLabel),c=yj.select("."+g.axisY+" ."+g.axisYLabel),d=yj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",tb).attr("dx",wb).attr("dy",zb).text(nb),(a?c.transition():c).attr("x",ub).attr("dx",xb).attr("dy",Ab).attr("dy",Ab).text(ob),(a?d.transition():d).attr("x",vb).attr("dx",yb).attr("dy",Bb).text(pb)}function Hb(a){var b=!1;return qg(Jc(Kf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Ib(){var a=Jf.svg.arc().outerRadius(ig).innerRadius(kg),b=function(b,c){var d;return c?a(b):(d=Hb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Jb(a){var b=Jf.svg.arc().outerRadius(jg*(a?a:1)).innerRadius(kg);return function(a){var c=Hb(a);return c?b(c):"M 0 0"}}function Kb(a,b){return qe(a.data)?ng(a,b):"M 0 0"}function Lb(a){var b,c,d,e,f=Hb(a),g="";return f&&(b=ng.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*ig*.8+","+d/e*ig*.8+")"),g}function Mb(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Nb(a){return rc({id:a.data.id,value:a.value,ratio:Mb(a)})}function Ob(a){var b,c,d,e;return Rb()?(b=Hb(a),c=b?b.value:null,d=Mb(b),e=Sb(),e?e(c,d):Ed(c,d)):""}function Pb(a,b){var c=wj.selectAll("."+g.chartArc+qd(a)),d=wj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});we(a)&&c.selectAll("path").transition().duration(50).attr("d",og).transition().duration(100).attr("d",pg).each(function(a){pe(a.data)}),b||d.style("opacity",.3)}function Qb(a){var b=wj.selectAll("."+g.chartArc+qd(a));b.selectAll("path").transition().duration(50).attr("d",ng),wj.selectAll("."+g.arc).style("opacity",1)}function Rb(){return ie(Kf.data.targets)?wi:qi}function Sb(){return ie(Kf.data.targets)?xi:ri}function Tb(){return ie(Kf.data.targets)?zi:""}function Ub(){var a=ie(Kf.data.targets)?Ai:ti;return"function"==typeof a?a:function(){}}function Vb(){var a=ie(Kf.data.targets)?Bi:ui;return"function"==typeof a?a:function(){}}function Wb(){var a=ie(Kf.data.targets)?Ci:vi;return"function"==typeof a?a:function(){}}function Xb(a){var b,c,d,e,f,g,h=Ec(a),i=Qc(a);if(Pg.length>0)for(g=Sc(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 Jf.min(Object.keys(i).map(function(a){return Jf.min(i[a])}))}function Yb(a){var b,c,d,e,f,g,h=Ec(a),i=Qc(a);if(Pg.length>0)for(g=Tc(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 Jf.max(Object.keys(i).map(function(a){return Jf.max(i[a])}))}function Zb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return ab(a.id)===c}),m="y2"===c?Wh:Nh,n="y2"===c?Vh:Mh,o=b(m)?m:Xb(l),p=b(n)?n:Yb(l),q="y2"===c?Xh:Oh,r=yd()&&sh;return 0===l.length?"y2"===c?Bg.domain():Ag.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=zd(o,p),j=cc(Ag.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Sh&&(f=b(Sh.top)?Sh.top:e,g=b(Sh.bottom)?Sh.bottom:e),"y2"===c&&_h&&(f=b(_h.top)?_h.top:e,g=b(_h.bottom)?_h.bottom:e),fe(l)&&!Sc(l)&&(g=o),[o-g,p+f])}function $b(a){return Gh?Ri?ye(Gh):Gh:Jf.min(a,function(a){return Jf.min(a.values,function(a){return a.x})})}function _b(a){return Fh?Ri?ye(Fh):Fh:Jf.max(a,function(a){return Jf.max(a.values,function(a){return a.x})})}function ac(a){var c,d,e,f,g=Dc(a),h=g[1]-g[0];return Si?d=0:fe(a)?(c=Bc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Hh&&De(Hh)?(e=b(Hh.left)?Hh.left:d,f=b(Hh.right)?Hh.right:d):e=f="number"==typeof Hh?Hh:d,{left:e,right:f}}function bc(a){var b=[$b(a),_b(a)],c=b[0],d=b[1],e=ac(a),f=0,g=0;return c-d!==0||Si||(c=Ri?new Date(.5*c.getTime()):-.5,d=Ri?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Ri?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Ri?new Date(d.getTime()+e.right):d+e.right),[f,g]}function cc(a){return a[1]-a[0]}function dc(a){for(var b=0;bb?0:b-c}function jc(a){var b,c=hc(a),d="y"===a.axis?Ag:Bg;return b="y"===a.axis||"y2"===a.axis?sh?eg:"start"in a?d(a.start):eg:sh?"end"in a?zg(Ri?ye(a.end):a.end):eg:eg,c>b?0:b-c}function kc(a){return Jg&&a===Jg||De(Kg)&&Ee(Kg,a)}function lc(a){return!kc(a)}function mc(a){return Jg?Jg:De(Kg)?Kg[a]:null}function nc(a,b){var c,d=b&&De(b)?Ec(b):[];return d.forEach(function(b){mc(b)===a&&(c=Kf.data.xs[b])}),c}function oc(a,b){return a in Kf.data.xs&&Kf.data.xs[a]&&Kf.data.xs[a][b]?Kf.data.xs[a][b]:b}function pc(a){Object.keys(a).forEach(function(b){Kg[b]=a[b]})}function qc(a){return 1===Jf.set(Object.keys(a).map(function(b){return a[b]})).size()}function rc(a){var b;return a&&(b=Ng[a.id],a.name=b?b:a.id),a}function sc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=uc(b[d],a.id,d)}),Kf.data.xs[a.id]=b})}function tc(a,b){a.forEach(function(a){b[a.id]&&sc([a],b[a.id])})}function uc(a,c,d){var e;return e=Ri?a?a instanceof Date?a:ye(a):ye(oc(c,d)):Ti&&!Si?b(a)?+a:oc(c,d):d}function vc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Kf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Jg?(d=Object.keys(Kf.data.xs),Kf.data.xs[c]=d.length>0?Kf.data.xs[d[0]]:void 0):De(Kg)&&(Kf.data.xs[c]=nc(f,Kf.data.targets)):Kf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Kf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Mg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=mc(b),g=a[f],h=uc(g,b,e);return Ti&&Si&&0===c&&g&&(0===e&&(wh=[]),wh.push(g)),("undefined"==typeof a[b]||Kf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Rg&&de(Ec(c).filter(function(a){return!(a in Sg)}),Rg),c.forEach(function(a){ec(a.id_org,a)}),c}function yc(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 zc(a){return a>0&&Kf.data.targets[0].values[a-1]?Kf.data.targets[0].values[a-1].x:void 0}function Ac(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Dc(a){var b,c,d=Cc(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Ec(a){return a.map(function(a){return a.id})}function Fc(a){return a?"string"==typeof a?[a]:a:Ec(Kf.data.targets)}function Gc(a,b){var c,d=Ec(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Ri?new Date(i):i);j.push(e)}return Ri||(j=j.sort(function(a,b){return a-b})),j}function Mc(a){bj=bj.concat(a)}function Nc(a){bj=bj.filter(function(b){return a.indexOf(b)<0})}function Oc(a){cj=cj.concat(a)}function Pc(a){cj=cj.filter(function(b){return a.indexOf(b)<0})}function Qc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Rc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Tc(a){return Rc(a,function(a){return a>0})}function Uc(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||0===a[f].x)&&(e=e.concat(Kd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Kd(a,g))),Nd(e,b)):Ld(a,b,f,g)}function Md(a,b){var c;return c=a.map(function(a){return Ld(a.values,b)}),Nd(c,b)}function Nd(a,b){var c,d;return a.forEach(function(a){var e=Fe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Od(a,b){return Jf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Pd(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 Qd(){return Ug&&"desc"===Ug.toLowerCase()}function Rd(){return Ug&&"asc"===Ug.toLowerCase()}function Sd(a){var b=Rd(),c=Qd();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 Ug&&a.sort(Ug),a}function Td(a,c){var d,e,f,g,h,i,j,k=je(Kf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&Ei&&(Bj.html(Hi(a,bb(),Ad(k),$i)).style("display","block"),d=Bj.property("offsetWidth"),e=Bj.property("offsetHeight"),k?(g=cg/2+c[0],i=eg/2+c[1]+20):(sh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-w(),i=zg(l[0].x)+20):(f=s(),g=f+v()+zg(l[0].x)+20,h=g+d,j=f+t()-w(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),Bj.style("top",i+"px").style("left",g+"px"))}function Ud(){Bj.style("display","none")}function Vd(a){var c=a.filter(function(a){return a&&b(a.value)});if(Ei&&!ge(Kf.data.targets)&&!je(Kf.data.targets)){var d=yj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(sh?"y1":"x1",Gd).attr(sh?"y2":"x2",Gd),mf(d,"grid")}}function Wd(){yj.select("line."+g.xgridFocus).style("visibility","hidden")}function Xd(a,b){var c,d,e,f,h=[],i=yj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=bc(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function Yd(a){return a.x||0===a.x?zg(a.x):null}function Zd(a){return Y(a.id)(a.value)}function $d(){var a,b,d={},e=0;return Jc(Kf.data.targets.filter(me)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ce(a,b){return"number"==typeof oi?oi:b?2*a.tickOffset()*pi/b:0}function de(a,b){Fc(a).forEach(function(a){Fj[a]=b===Sg[a],Sg[a]=b})}function ee(a,b){var c=!1;return a.forEach(function(a){Sg[a.id]===b&&(c=!0),a.id in Sg||"line"!==b||(c=!0)}),c}function fe(a){return ee(a,"bar")}function ge(a){return ee(a,"scatter")}function he(a){return ee(a,"pie")}function ie(a){return ee(a,"donut")}function je(a){return he(a)||ie(a)}function ke(a){var b="string"==typeof a?a:a.id;return!(b in Sg)||"line"===Sg[b]||"spline"===Sg[b]||"area"===Sg[b]||"area-spline"===Sg[b]}function le(a){var b="string"==typeof a?a:a.id;return"spline"===Sg[b]||"area-spline"===Sg[b]}function me(a){var b="string"==typeof a?a:a.id;return"bar"===Sg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"scatter"===Sg[b]}function oe(a){var b="string"==typeof a?a:a.id;return"pie"===Sg[b]}function pe(a){var b="string"==typeof a?a:a.id;return"donut"===Sg[b]}function qe(a){return oe(a)||pe(a)}function re(a){return ke(a)?[a]:[]}function se(a){return qe(a.data)?[a]:[]}function te(a){return me(a)?a.values:[]}function ue(a){return ke(a)||ne(a)?a.values:[]}function ve(a){return me(a)||ke(a)?a.values:[]}function we(a){return pe(a)&&yi||oe(a)&&si}function xe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ye(b){var c;try{c=Lg?Jf.time.format(Lg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Lg)}return c}function ze(a,b){var c=Jf.mouse(a),d=Jf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ee(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Fe(a,b){var c="y"===ab(a.id)?Ag:Bg,d=sh?1:0,e=sh?0:1;return Math.pow(zg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ge(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function He(a,b,c){return d(a[b])?a[b]:c}function Ie(a,b,c){fh(b,a.node()),yj.select("."+g.selectedCircles+pd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Vc(g.selectedCircle,c)}).attr("cx",sh?Zd:Yd).attr("cy",sh?Yd:Zd).attr("stroke",function(){return $i(b)}).attr("r",1.4*Te(b)).transition().duration(100).attr("r",Te)}function Je(a,b,c){gh(b,a.node()),yj.select("."+g.selectedCircles+pd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ke(a,b,c,d){a?Ie(b,c,d):Je(b,c,d)}function Le(a,b){fh(b,a.node()),a.transition().duration(100).style("fill",function(){return Jf.rgb($i(b)).brighter(.75)})}function Me(a,b){gh(b,a.node()),a.transition().duration(100).style("fill",function(){return $i(b)})}function Ne(a,b,c,d){a?Le(b,c,d):Me(b,c,d)}function Oe(a,b,c,d){Ne(a,b,c.data,d)}function Pe(a){return"circle"===a.nodeName?Ke:Jf.select(a).classed(g.bar)?Ne:Oe}function Qe(a){return a.filter(function(a){return b(a.value)})}function Re(a){return hi?"function"==typeof ii?ii(a):ii:0}function Se(a){return ki?li?li:1.75*Re(a):Re(a)}function Te(a){return mi?mi:4*Re(a)}function Ue(a,c){return(c?yj.selectAll("."+g.circles+pd(c)):yj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ve(a,b){Ue(a,b).classed(g.EXPANDED,!0).attr("r",Se)}function We(a){Ue(a).filter(function(){return Jf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Re)}function Xe(a){return yj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function Ye(a){Xe(a).classed(g.EXPANDED,!0)}function Ze(a){Xe(a).classed(g.EXPANDED,!1)}function $e(a,b){var c=cf(a,b);return function(a,b){var d=c(a,b),e=sh?1:0,f=sh?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 _e(a,b){var c=cf(a,!1),d=b?af:bf;return function(a,b){return d(c(a,b),a,this)}}function af(a,b){var c;return sh?(c=me(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function bf(a,b,c){var d=c.getBoundingClientRect();return sh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:me(b)?-3:-6)}function cf(a,b){var c=a.__max__+1,d=ce(Fg,c),e=_d(d,c,a,!!b),f=ae(!!b),g=be(a,!!b),h=b?Z:Y;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return sh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function df(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function ef(b){var c,d,e;if(Cj=Jf.select(Mf),Cj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Cj.html("").classed("c3",!0),Kf.data.xs={},Kf.data.targets=xc(b),Zg&&(Kf.data.targets=Kf.data.targets.filter(Zg)),Yg&&Mc(Yg===!0?Ec(Kf.data.targets):Yg),p(),T(),zg.domain(Jf.extent(bc(Kf.data.targets))),Ag.domain(Zb(Kf.data.targets,"y")),Bg.domain(Zb(Kf.data.targets,"y2")),Cg.domain(zg.domain()),Dg.domain(Ag.domain()),Eg.domain(Bg.domain()),Dj=zg.domain(),rj.scale(Cg),Tf&&vj.scale(zg),wj=Cj.append("svg").on("mouseenter",Wf).on("mouseleave",Xf),xj=wj.append("defs"),xj.append("clipPath").attr("id",Li).append("rect"),xj.append("clipPath").attr("id",Mi).append("rect"),xj.append("clipPath").attr("id",Ni).append("rect"),rf(),yj=wj.append("g").attr("transform",ij.main),zj=wj.append("g").attr("transform",ij.context),Aj=wj.append("g").attr("transform",ij.legend),jh||zj.style("visibility","hidden"),mh||(Aj.style("visibility","hidden"),cj=Ec(Kf.data.targets)),Bj=Jf.select(Mf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Ef(Ec(Kf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=yj.append("g").attr("clip-path",Oi).attr("class",g.grid),bi&&d.append("g").attr("class",g.xgrids),De(di)&&d.append("g").attr("class",g.xgridLines),ji&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),ei&&d.append("g").attr("class",g.ygrids),De(fi)&&d.append("g").attr("class",g.ygridLines),yj.append("g").attr("clip-path",Oi).attr("class",g.regions),yj.append("g").attr("clip-path",Oi).attr("class",g.chart),c=yj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Tf?sh?"ns-resize":"ew-resize":null),yj.select("."+g.chart).append("g").attr("class",g.chartBars),yj.select("."+g.chart).append("g").attr("class",g.chartLines),yj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",ij.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Tb()),yj.select("."+g.chart).append("g").attr("class",g.chartTexts),Tf&&yj.insert("rect",Vf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",cg).attr("height",eg).style("opacity",0).style("cursor",sh?"ns-resize":"ew-resize").call(vj).on("dblclick.zoom",null),Jh&&rj.extent("function"!=typeof Jh?Jh:Jh(bc())),dj.x=yj.append("g").attr("class",g.axisX).attr("clip-path",Pi).attr("transform",ij.x).style("visibility",th?"visible":"hidden"),dj.x.append("text").attr("class",g.axisXLabel).attr("transform",sh?"rotate(-90)":"").style("text-anchor",Cb),dj.y=yj.append("g").attr("class",g.axisY).attr("clip-path",Qi).attr("transform",ij.y).style("visibility",Lh?"visible":"hidden"),dj.y.append("text").attr("class",g.axisYLabel).attr("transform",sh?"":"rotate(-90)").style("text-anchor",Db),dj.y2=yj.append("g").attr("class",g.axisY2).attr("transform",ij.y2).style("visibility",Uh?"visible":"hidden"),dj.y2.append("text").attr("class",g.axisY2Label).attr("transform",sh?"":"rotate(-90)").style("text-anchor",Eb),zj.append("g").attr("clip-path",Oi).attr("class",g.chart),zj.select("."+g.chart).append("g").attr("class",g.chartBars),zj.select("."+g.chart).append("g").attr("class",g.chartLines),zj.append("g").attr("clip-path",Oi).attr("class",g.brush).call(rj).selectAll("rect").attr(sh?"width":"height",sh?dg:fg),dj.subx=zj.append("g").attr("class",g.axisX).attr("transform",ij.subx).attr("clip-path",sh?"":Pi),uf(Kf.data.targets),sh?yj.select("."+g.axisX).style("opacity",0).call(Fg):(yj.select("."+g.axisY).style("opacity",0).call(Gg),yj.select("."+g.axisY2).style("opacity",0).call(Hg)),p(),T(),rf(),o(!1),nf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Ii){if(Ri&&"string"==typeof Ji){for(Ji=ye(Ji),e=0;e0){d=[];for(var f in Ng)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Pd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ne,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function kf(a){je(Kf.data.targets)||$g&&(Ui=a,yj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Vi=!0,hh())}function lf(){je(Kf.data.targets)||$g&&(yj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),yj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Vi=!1,ih())}function mf(a,b){"grid"===b&&a.each(function(){var a=Jf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function nf(a,c){var d,e,f,h,i,j,k,l,m,n,o,p,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,O,P,Q,R,S,T,U,V,W=$d(),X=je(Kf.data.targets),Y=Jc(Kf.data.targets);if(a=a||{},C=He(a,"withY",!0),D=He(a,"withSubchart",!0),E=He(a,"withTransition",!0),H=He(a,"withTransform",!1),I=He(a,"withUpdateXDomain",!1),J=He(a,"withUpdateOrgXDomain",!1),K=He(a,"withLegend",!1),F=He(a,"withTransitionForExit",E),G=He(a,"withTransitionForAxis",E),Q=E?$f:0,R=F?Q:0,S=G?Q:0,c=c||sf(S),K&&mh&&Ef(Ec(Kf.data.targets),a,c),Si&&0===Y.length&&zg.domain([0,dj.x.selectAll(".tick").size()]),Y.length&&(J&&(zg.domain(Jf.extent(bc(Y))),Dj=zg.domain(),Tf&&vj.scale(zg).updateScaleExtent(),Cg.domain(zg.domain()),rj.scale(Cg)),I&&(zg.domain(rj.empty()?Dj:rj.extent()),Tf&&vj.scale(zg).updateScaleExtent()),Dh||!Ch&&!Bh||(T=Lc(Kc(Y),Bh),Fg.tickValues(T),Ig.tickValues(T))),Ag.domain(Zb(Y,"y")),Bg.domain(Zb(Y,"y2")),dj.x.style("opacity",X?0:1),dj.y.style("opacity",X?0:1),dj.y2.style("opacity",X?0:1),dj.subx.style("opacity",X?0:1),c.axisX.call(Fg),c.axisY.call(Gg),c.axisY2.call(Hg),c.axisSubX.call(Ig),Gb(E),I&&Y.length)if(zh&&T){for(U=1;U=0&&Jf.select(this).style("display",b%V?"none":"block")})}else wj.selectAll("."+g.axisX+" .tick text").style("display","block");!sh&&Eh&&hb(dj.x,c.axisX,Eh),L=$e(W),O=_e(W,!0),P=_e(W,!1),Dg.domain(Ag.domain()),Eg.domain(Bg.domain()),Bj.style("display","none"),q(),yj.select("line."+g.xgridFocus).style("visibility","hidden"),bi&&(f=Xd(ci,zg),z=Si?Fg.tickOffset():0,e=sh?{x1:0,x2:cg,y1:function(a){return zg(a)-z},y2:function(a){return zg(a)-z}}:{x1:function(a){return zg(a)+z},x2:function(a){return zg(a)+z},y1:_f.top,y2:eg},d=yj.select("."+g.xgrids).selectAll("."+g.xgrid).data(f),d.enter().append("line").attr("class",g.xgrid),d.attr(e).style("opacity",function(){return+Jf.select(this).attr(sh?"y1":"x1")===(sh?eg:0)?0:1}),d.exit().remove()),De(di)&&(h=yj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(di),i=h.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),i.append("line").style("opacity",0),i.append("text").attr("text-anchor","end").attr("transform",sh?"":"rotate(-90)").attr("dx",sh?0:-_f.top).attr("dy",-5).style("opacity",0),h.select("line").transition().duration(Q).attr("x1",sh?0:Hd).attr("x2",sh?cg:Hd).attr("y1",sh?Hd:_f.top).attr("y2",sh?Hd:eg).style("opacity",1),h.select("text").transition().duration(Q).attr("x",sh?cg:0).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),h.exit().transition().duration(Q).style("opacity",0).remove()),C&&ei&&(j=yj.select("."+g.ygrids).selectAll("."+g.ygrid).data(Ag.ticks(gi)),j.enter().append("line").attr("class",g.ygrid),j.attr("x1",sh?Ag:0).attr("x2",sh?Ag:cg).attr("y1",sh?0:Ag).attr("y2",sh?eg:Ag),j.exit().remove(),mf(j,"grid")),C&&De(fi)&&(k=yj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(fi),l=k.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",sh?"rotate(-90)":"").attr("dx",sh?0:-_f.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(Q).attr("x1",sh?Id:0).attr("x2",sh?Id:cg).attr("y1",sh?0:Id).attr("y2",sh?eg:Id).style("opacity",1),k.select("text").transition().duration(Q).attr("x",sh?0:cg).attr("y",Id).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(Q).style("opacity",0).remove()),s=yj.select("."+g.regions).selectAll("."+g.region).data(Di),s.enter().append("g").attr("class",id).append("rect").style("fill-opacity",0),s.selectAll("rect").transition().duration(Q).attr("x",gc).attr("y",hc).attr("width",ic).attr("height",jc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(Q).style("opacity",0).remove(),p=yj.selectAll("."+g.bars).selectAll("."+g.bar).data(te),p.enter().append("path").attr("class",cd).style("stroke","none").style("fill",$i),p.style("opacity",ud).transition().duration(Q).attr("d",L).style("fill",$i).style("opacity",1),p.exit().transition().duration(R).style("opacity",0).remove(),m=yj.selectAll("."+g.lines).selectAll("."+g.line).data(re),m.enter().append("path").attr("class",$c).style("stroke",$i),m.style("opacity",ud).transition().duration(Q).attr("d",sj).style("stroke",$i).style("opacity",1),m.exit().transition().duration(R).style("opacity",0).remove(),n=yj.selectAll("."+g.areas).selectAll("."+g.area).data(re),n.enter().append("path").attr("class",gd).style("fill",$i).style("opacity",function(){return Ej=+Jf.select(this).style("opacity"),0}),n.style("opacity",0).transition().duration(Q).attr("d",tj).style("fill",$i).style("opacity",Ej),n.exit().transition().duration(R).style("opacity",0).remove(),o=yj.selectAll("."+g.circles).selectAll("."+g.circle).data(ue),o.enter().append("circle").attr("class",ad).attr("r",Re).style("fill",$i),o.style("opacity",ud).transition().duration(Q).style("opacity",wd).style("fill",$i).attr("cx",sh?Zd:Yd).attr("cy",sh?Yd:Zd),o.exit().remove(),t=yj.selectAll("."+g.texts).selectAll("."+g.text).data(ve),t.enter().append("text").attr("class",Wc).attr("text-anchor",function(a){return sh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",$i).style("fill-opacity",0),t.text(function(a){return Fd(a.id)(a.value,a.id)}).style("fill-opacity",vd).transition().duration(Q).attr("x",O).attr("y",P).style("fill",$i).style("fill-opacity",xd),t.exit().transition().duration(R).style("fill-opacity",0).remove(),r=yj.selectAll("."+g.arcs).selectAll("."+g.arc).data(se),r.enter().append("path").attr("class",ed).style("fill",function(a){return $i(a.data)}).style("cursor",function(a){return ah(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Yi||(c=Hb(a),d=Nb(c),e=Vb(),Pb(c.data.id),Af(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Hb(a),c=Nb(b),d=[c];Td(d,Jf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Yi||(c=Hb(a),d=Nb(c),e=Wb(),Qb(c.data.id),Bf(),Ud(),e(d,b))}).on("click",function(a,b){var c=Hb(a),d=Nb(c),e=Ub();hf(this,a,b),e(d,b)}),r.attr("transform",H?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Yi=!0}).transition().duration(Q).attrTween("d",function(a){var b,c=Hb(a);return c?(b=Jf.interpolate(this._current,c),this._current=b(0),function(a){return Kb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",H?"scale(1)":"").style("fill",function(a){return $i(a.data)}).style("opacity",1).call(Ge,function(){Yi=!1}),r.exit().transition().duration(R).style("opacity",0).remove(),yj.selectAll("."+g.chartArc).select("text").attr("transform",Lb).style("opacity",0).transition().duration(Q).text(Ob).style("opacity",function(a){return Hc(a.data.id)&&qe(a.data)?1:0}),yj.select("."+g.chartArcsTitle).style("opacity",ie(Kf.data.targets)?1:0),jh&&(Jf.event&&"zoom"===Jf.event.type&&rj.extent(zg.orgDomain()).update(),D&&(!sh&&Eh&&hb(dj.subx,c.axisSubX,Eh),rj.empty()||rj.extent(zg.orgDomain()).update(),M=$e(W,!0),v=zj.selectAll("."+g.bars).selectAll("."+g.bar).data(te),v.enter().append("path").attr("class",cd).style("stroke","none").style("fill",$i),v.style("opacity",ud).transition().duration(Q).attr("d",M).style("opacity",1),v.exit().transition().duration(Q).style("opacity",0).remove(),u=zj.selectAll("."+g.lines).selectAll("."+g.line).data(re),u.enter().append("path").attr("class",$c).style("stroke",$i),u.style("opacity",ud).transition().duration(Q).attr("d",uj).style("opacity",1),u.exit().transition().duration(Q).style("opacity",0).remove())),yj.selectAll("."+g.selectedCircles).filter(function(a){return me(a)}).selectAll("circle").remove(),yj.selectAll("."+g.selectedCircle).transition().duration(Q).attr("cx",sh?Zd:Yd).attr("cy",sh?Yd:Zd),w=yj.select("."+g.eventRects),De(Kg)&&!qc(Kg)?(w.classed(g.eventRectsMultiple)||w.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),x=yj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),gf(x.enter()),x.attr("x",0).attr("y",0).attr("width",cg).attr("height",eg)):(w.classed(g.eventRectsSingle)||w.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Ti&&!Si?(B=function(a,b){var c=zc(b),d=Ac(b),e=Kf.data.xs[a.id][b];return(zg(d?d:e+50)-zg(c?c:e-50))/2},A=function(a,b){var c=zc(b),d=Kf.data.xs[a.id][b];return(zg(d)+zg(c?c:d-50))/2}):(B=N(),A=function(a){return zg(a.x)-B/2}),y=Cc(Kf.data.targets),yj.select("."+g.eventRects).datum(y?y.values:[]),x=yj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),ff(x.enter()),x.attr("class",jd).attr("x",sh?0:A).attr("y",sh?A:0).attr("width",sh?cg:B).attr("height",sh?B:eg),x.exit().remove()),Ec(Kf.data.targets).forEach(function(a){Fj[a]=!0})}function of(){nf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function pf(){if(0!==Jc(Kf.data.targets).length){if("mousemove"===Jf.event.sourceEvent.type&&vj.altDomain)return zg.domain(vj.altDomain),void vj.scale(zg).updateScaleExtent();Si&&zg.orgDomain()[0]===Dj[0]&&zg.domain([Dj[0]-1e-10,zg.orgDomain()[1]]),nf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Jf.event.sourceEvent.type&&(Wi=!0)}}function qf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function rf(){wj.attr("width",gg).attr("height",hg),wj.select("#"+Li).select("rect").attr("width",cg).attr("height",eg),wj.select("#"+Mi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),wj.select("#"+Ni).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),wj.select("."+g.zoomRect).attr("width",cg).attr("height",eg),Cj.style("max-height",hg+"px")}function sf(a){return{axisX:a?dj.x.transition().duration(a):dj.x,axisY:a?dj.y.transition().duration(a):dj.y,axisY2:a?dj.y2.transition().duration(a):dj.y2,axisSubX:a?dj.subx.transition().duration(a):dj.subx}}function tf(a){var b;a=a||{},a.withTransition=He(a,"withTransition",!0),a.withTransform=He(a,"withTransform",!1),a.withLegend=He(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withLegend&&mh||(b=sf(a.withTransitionForAxis?$f:0),p(),T(),rf(),o(a.withTransition,b)),nf(a,b)}function uf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=yj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",ld),j=i.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Xc),e=yj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",nd),d=e.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",dd).style("cursor",function(a){return ah(a)?"pointer":null}),c=yj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",md),b=c.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",_c),b.append("g").attr("class",hd),b.append("g").attr("class",function(a){return Vc(g.selectedCircles,a.id)}),b.append("g").attr("class",bd).style("cursor",function(a){return ah(a)?"pointer":null}),a.forEach(function(a){yj.selectAll("."+g.selectedCircles+pd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=yj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(qg(a)).attr("class",od),f=h.enter().append("g").attr("class",od),f.append("g").attr("class",fd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),jh&&(n=zj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",nd),m=n.enter().append("g").style("opacity",0).attr("class",nd),m.append("g").attr("class",dd),l=zj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",md),k=l.enter().append("g").style("opacity",0).attr("class",md),k.append("g").attr("class",_c)),wj.selectAll("."+g.target).filter(function(a){return Hc(a.id)}).transition().duration($f).style("opacity",1)}function vf(a,b){b.filter&&(a=a.filter(b.filter)),(b.type||b.types)&&a.forEach(function(a){b.types?de(a.id,b.types[a.id]):de(a.id,b.type)}),Kf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,z=0,F++)),E[a]=F,D[F]=f,A[a]=z,z+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+v)/10),j=10*Math.ceil((h.height+u)/10),k=jj?j:i,l=jj?S():R();return d&&(z=0,F=0,w=0,x=0),mh&&!Ic(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=i,C[c]=j,(!w||i>=w)&&(w=i),(!x||j>=x)&&(x=j),g=jj?x:w,void(rh?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(l-g*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=26,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=Aj.selectAll("."+g.legendItemFocused).size();b=b||{},n=He(b,"withTransition",!0),q=He(b,"withTransitionForTransform",!0),jj?(f=function(a){return w*E[a]},j=function(a){return D[E[a]]+A[a]}):(f=function(a){return D[E[a]]+A[a]},j=function(a){return x*E[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=Aj.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Vc(g.legendItem,a)}).style("visibility",function(a){return Ic(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof oh?oh(a):Kf.toggle(a)}).on("mouseover",function(a){Jf.select(this).classed(g.legendItemFocused,!0),Yi||Kf.focus(a),"function"==typeof ph&&ph(a)}).on("mouseout",function(a){Jf.select(this).classed(g.legendItemFocused,!1),Yi||Kf.revert(),"function"==typeof qh&&qh(a)}),m.append("text").text(function(a){return d(Ng[a])?Ng[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",jj?h:-200).attr("y",jj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",jj?i:-200).attr("y",jj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",$i).attr("x",jj?h:-200).attr("y",jj?-200:j).attr("width",10).attr("height",10),r=Aj.selectAll("text").data(a).text(function(a){return d(Ng[a])?Ng[a]:a}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=Aj.selectAll("rect."+g.legendItemEvent).data(a),(n?s.transition():s).attr("width",function(a){return B[a]}).attr("height",function(a){return C[a]}).attr("x",i).attr("y",l),t=Aj.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",$i).attr("x",f).attr("y",j),Aj.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Hc(a)}).transition().style("opacity",function(a){var b=Jf.select(this);return Hc(a)?!G||b.classed(g.legendItemFocused)?yf(b):zf(b):nj}),P(w),Q(x),O(F),p(),T(),rf(),o(q,c)}function Ff(a){return Gc(Kf.data.targets,a.id)}function Gf(a){return"data"in a&&Gc(Kf.data.targets,a.data.id)}function Hf(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 If(a,b,c){var d=!je(Kf.data.targets);Yi=!1,de(a,b),tf(c||{withTransitionForAxis:d})}var Jf=a.d3?a.d3:a.require?a.require("d3"):void 0,Kf={data:{},axis:{},legend:{}},Lf={},Mf=i(["bindto"],"#chart"),Nf=i(["size","width"]),Of=i(["size","height"]),Pf=i(["padding","left"],50),Qf=i(["padding","right"],0),Rf=i(["padding","top"],0),Sf=i(["padding","bottom"],0),Tf=i(["zoom","enabled"],!1),Uf=i(["zoom","extent"]),Vf=i(["zoom","privileged"],!1),Wf=i(["onenter"],function(){}),Xf=i(["onleave"],function(){}),Yf=i(["onresize"],function(){}),Zf=i(["onresized"],function(){}),$f=i(["transition","duration"],350);h("data","data is required in config");var _f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg=i(["data","x"]),Kg=i(["data","xs"],{}),Lg=i(["data","x_format"]),Mg=i(["data","id_converter"],function(a){return a}),Ng=i(["data","names"],{}),Og=i(["data","classes"],{}),Pg=i(["data","groups"],[]),Qg=i(["data","axes"],{}),Rg=i(["data","type"]),Sg=i(["data","types"],{}),Tg=i(["data","labels"],{}),Ug=i(["data","order"]),Vg=i(["data","regions"],{}),Wg=i(["data","color"]),Xg=i(["data","colors"],{}),Yg=i(["data","hide"],!1),Zg=i(["data","filter"]),$g=i(["data","selection","enabled"],!1),_g=i(["data","selection","grouped"],!1),ah=i(["data","selection","isselectable"],function(){return!0}),bh=i(["data","selection","multiple"],!0),ch=i(["data","onclick"],function(){}),dh=i(["data","onenter"],function(){}),eh=i(["data","onleave"],function(){}),fh=i(["data","onselected"],function(){}),gh=i(["data","onunselected"],function(){}),hh=i(["data","ondragstart"],function(){}),ih=i(["data","ondragend"],function(){}),jh=i(["subchart","show"],!1),kh=i(["subchart","size","height"],60),lh=i(["color","pattern"],[]),mh=i(["legend","show"],!0),nh=i(["legend","position"],"bottom"),oh=i(["legend","item","onclick"]),ph=i(["legend","item","onmouseover"]),qh=i(["legend","item","onmouseout"]),rh=i(["legend","equally"],!1),sh=i(["axis","rotated"],!1),th=i(["axis","x","show"],!0),uh=i(["axis","x","type"],"indexed"),vh=i(["axis","x","localtime"],!0),wh=i(["axis","x","categories"],[]),xh=i(["axis","x","tick","centered"],!1),yh=i(["axis","x","tick","format"]),zh=i(["axis","x","tick","culling"],{}),Ah=i(["axis","x","tick","culling","max"],10),Bh=i(["axis","x","tick","count"]),Ch=i(["axis","x","tick","fit"],!0),Dh=i(["axis","x","tick","values"],null),Eh=i(["axis","x","tick","rotate"]),Fh=i(["axis","x","max"],null),Gh=i(["axis","x","min"],null),Hh=i(["axis","x","padding"],{}),Ih=i(["axis","x","height"]),Jh=i(["axis","x","default"]),Kh=i(["axis","x","label"],{}),Lh=i(["axis","y","show"],!0),Mh=i(["axis","y","max"]),Nh=i(["axis","y","min"]),Oh=i(["axis","y","center"]),Ph=i(["axis","y","label"],{}),Qh=i(["axis","y","inner"],!1),Rh=i(["axis","y","tick","format"]),Sh=i(["axis","y","padding"]),Th=i(["axis","y","ticks"],10),Uh=i(["axis","y2","show"],!1),Vh=i(["axis","y2","max"]),Wh=i(["axis","y2","min"]),Xh=i(["axis","y2","center"]),Yh=i(["axis","y2","label"],{}),Zh=i(["axis","y2","inner"],!1),$h=i(["axis","y2","tick","format"]),_h=i(["axis","y2","padding"]),ai=i(["axis","y2","ticks"],10),bi=i(["grid","x","show"],!1),ci=i(["grid","x","type"],"tick"),di=i(["grid","x","lines"],[]),ei=i(["grid","y","show"],!1),fi=i(["grid","y","lines"],[]),gi=i(["grid","y","ticks"],10),hi=i(["point","show"],!0),ii=i(["point","r"],2.5),ji=i(["point","focus","line","enabled"],!0),ki=i(["point","focus","expand","enabled"],!0),li=i(["point","focus","expand","r"]),mi=i(["point","focus","select","r"]),ni=i(["line","connect_null"],!1),oi=i(["bar","width"]),pi=i(["bar","width","ratio"],.6),qi=i(["pie","label","show"],!0),ri=i(["pie","label","format"]),si=i(["pie","expand"],!0),ti=i(["pie","onclick"],function(){}),ui=i(["pie","onmouseover"],function(){}),vi=i(["pie","onmouseout"],function(){}),wi=i(["donut","label","show"],!0),xi=i(["donut","label","format"]),yi=i(["donut","expand"],!0),zi=i(["donut","title"],""),Ai=i(["donut","onclick"],function(){}),Bi=i(["donut","onmouseover"],function(){}),Ci=i(["donut","onmouseout"],function(){}),Di=i(["regions"],[]),Ei=i(["tooltip","show"],!0),Fi=i(["tooltip","format","title"]),Gi=i(["tooltip","format","value"]),Hi=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Fi?Fi:b,l=Gi?Gi:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Ii=i(["tooltip","init","show"],!1),Ji=i(["tooltip","init","x"],0),Ki=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Li=("string"==typeof Mf?Mf.replace("#",""):Mf.id)+"-clip",Mi=Li+"-xaxis",Ni=Li+"-yaxis",Oi=j(Li),Pi=j(Mi),Qi=j(Ni),Ri="timeseries"===uh,Si="categorized"===uh,Ti=!Ri&&(Jg||De(Kg)),Ui=null,Vi=!1,Wi=!1,Xi=!1,Yi=!1,Zi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],$i=xe(Xg,De(lh)?lh:Zi,Wg),_i=vh?Jf.time.format:Jf.time.format.utc,aj=_i.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),bj=[],cj=[],dj={},ej=sh?"left":"bottom",fj=sh?Qh?"top":"bottom":Qh?"right":"left",gj=sh?Zh?"bottom":"top":Zh?"left":"right",hj=sh?"left":"bottom",ij={main:function(){return"translate("+k(_f.left)+","+k(_f.top)+")"},context:function(){return"translate("+k(ag.left)+","+k(ag.top)+")"},legend:function(){return"translate("+bg.left+","+bg.top+")"},x:function(){return"translate(0,"+(sh?0:eg)+")"},y:function(){return"translate(0,"+(sh?eg:0)+")"},y2:function(){return"translate("+(sh?0:cg)+","+(sh?1:0)+")" +return"M"+b(i)+" "+e(k(d))+" "+b(j)+" "+e(k(d+f))}:function(a,c,d,f){return"M"+b(j(d),!0)+" "+e(k(d))+" "+b(j(d+f),!0)+" "+e(k(d+f))},g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function ef(b){var c,d,e;if(Cj=Jf.select(Mf),Cj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Cj.html("").classed("c3",!0),Kf.data.xs={},Kf.data.targets=xc(b),Zg&&(Kf.data.targets=Kf.data.targets.filter(Zg)),Yg&&Mc(Yg===!0?Ec(Kf.data.targets):Yg),p(),T(),zg.domain(Jf.extent(bc(Kf.data.targets))),Ag.domain(Zb(Kf.data.targets,"y")),Bg.domain(Zb(Kf.data.targets,"y2")),Cg.domain(zg.domain()),Dg.domain(Ag.domain()),Eg.domain(Bg.domain()),Dj=zg.domain(),rj.scale(Cg),Tf&&vj.scale(zg),wj=Cj.append("svg").on("mouseenter",Wf).on("mouseleave",Xf),xj=wj.append("defs"),xj.append("clipPath").attr("id",Li).append("rect"),xj.append("clipPath").attr("id",Mi).append("rect"),xj.append("clipPath").attr("id",Ni).append("rect"),rf(),yj=wj.append("g").attr("transform",ij.main),zj=wj.append("g").attr("transform",ij.context),Aj=wj.append("g").attr("transform",ij.legend),jh||zj.style("visibility","hidden"),mh||(Aj.style("visibility","hidden"),cj=Ec(Kf.data.targets)),Bj=Jf.select(Mf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Ef(Ec(Kf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=yj.append("g").attr("clip-path",Oi).attr("class",g.grid),bi&&d.append("g").attr("class",g.xgrids),De(di)&&d.append("g").attr("class",g.xgridLines),ji&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),ei&&d.append("g").attr("class",g.ygrids),De(fi)&&d.append("g").attr("class",g.ygridLines),yj.append("g").attr("clip-path",Oi).attr("class",g.regions),yj.append("g").attr("clip-path",Oi).attr("class",g.chart),c=yj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Tf?sh?"ns-resize":"ew-resize":null),yj.select("."+g.chart).append("g").attr("class",g.chartBars),yj.select("."+g.chart).append("g").attr("class",g.chartLines),yj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",ij.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Tb()),yj.select("."+g.chart).append("g").attr("class",g.chartTexts),Tf&&yj.insert("rect",Vf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",cg).attr("height",eg).style("opacity",0).style("cursor",sh?"ns-resize":"ew-resize").call(vj).on("dblclick.zoom",null),Jh&&rj.extent("function"!=typeof Jh?Jh:Jh(bc())),dj.x=yj.append("g").attr("class",g.axisX).attr("clip-path",Pi).attr("transform",ij.x).style("visibility",th?"visible":"hidden"),dj.x.append("text").attr("class",g.axisXLabel).attr("transform",sh?"rotate(-90)":"").style("text-anchor",Cb),dj.y=yj.append("g").attr("class",g.axisY).attr("clip-path",Qi).attr("transform",ij.y).style("visibility",Lh?"visible":"hidden"),dj.y.append("text").attr("class",g.axisYLabel).attr("transform",sh?"":"rotate(-90)").style("text-anchor",Db),dj.y2=yj.append("g").attr("class",g.axisY2).attr("transform",ij.y2).style("visibility",Uh?"visible":"hidden"),dj.y2.append("text").attr("class",g.axisY2Label).attr("transform",sh?"":"rotate(-90)").style("text-anchor",Eb),zj.append("g").attr("clip-path",Oi).attr("class",g.chart),zj.select("."+g.chart).append("g").attr("class",g.chartBars),zj.select("."+g.chart).append("g").attr("class",g.chartLines),zj.append("g").attr("clip-path",Oi).attr("class",g.brush).call(rj).selectAll("rect").attr(sh?"width":"height",sh?dg:fg),dj.subx=zj.append("g").attr("class",g.axisX).attr("transform",ij.subx).attr("clip-path",sh?"":Pi),uf(Kf.data.targets),sh?yj.select("."+g.axisX).style("opacity",0).call(Fg):(yj.select("."+g.axisY).style("opacity",0).call(Gg),yj.select("."+g.axisY2).style("opacity",0).call(Hg)),p(),T(),rf(),o(!1),nf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Ii){if(Ri&&"string"==typeof Ji){for(Ji=ye(Ji),e=0;e0){d=[];for(var f in Ng)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Pd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ne,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function kf(a){je(Kf.data.targets)||$g&&(Ui=a,yj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Vi=!0,hh())}function lf(){je(Kf.data.targets)||$g&&(yj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),yj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Vi=!1,ih())}function mf(a,b){"grid"===b&&a.each(function(){var a=Jf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function nf(a,c){var d,e,f,h,i,j,k,l,m,n,o,p,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,O,P,Q,R,S,T,U,V,W=$d(),X=je(Kf.data.targets),Y=Jc(Kf.data.targets);if(a=a||{},C=He(a,"withY",!0),D=He(a,"withSubchart",!0),E=He(a,"withTransition",!0),H=He(a,"withTransform",!1),I=He(a,"withUpdateXDomain",!1),J=He(a,"withUpdateOrgXDomain",!1),K=He(a,"withLegend",!1),F=He(a,"withTransitionForExit",E),G=He(a,"withTransitionForAxis",E),Q=E?$f:0,R=F?Q:0,S=G?Q:0,c=c||sf(S),K&&mh&&Ef(Ec(Kf.data.targets),a,c),Si&&0===Y.length&&zg.domain([0,dj.x.selectAll(".tick").size()]),Y.length&&(J&&(zg.domain(Jf.extent(bc(Y))),Dj=zg.domain(),Tf&&vj.scale(zg).updateScaleExtent(),Cg.domain(zg.domain()),rj.scale(Cg)),I&&(zg.domain(rj.empty()?Dj:rj.extent()),Tf&&vj.scale(zg).updateScaleExtent()),Dh||!Ch&&!Bh||(T=Lc(Kc(Y),Bh),Fg.tickValues(T),Ig.tickValues(T))),Ag.domain(Zb(Y,"y")),Bg.domain(Zb(Y,"y2")),dj.x.style("opacity",X?0:1),dj.y.style("opacity",X?0:1),dj.y2.style("opacity",X?0:1),dj.subx.style("opacity",X?0:1),c.axisX.call(Fg),c.axisY.call(Gg),c.axisY2.call(Hg),c.axisSubX.call(Ig),Gb(E),I&&Y.length)if(zh&&T){for(U=1;U=0&&Jf.select(this).style("display",b%V?"none":"block")})}else wj.selectAll("."+g.axisX+" .tick text").style("display","block");!sh&&Eh&&hb(dj.x,c.axisX,Eh),L=$e(W),O=_e(W,!0),P=_e(W,!1),Dg.domain(Ag.domain()),Eg.domain(Bg.domain()),Bj.style("display","none"),q(),yj.select("line."+g.xgridFocus).style("visibility","hidden"),bi&&(f=Xd(ci,zg),z=Si?Fg.tickOffset():0,e=sh?{x1:0,x2:cg,y1:function(a){return zg(a)-z},y2:function(a){return zg(a)-z}}:{x1:function(a){return zg(a)+z},x2:function(a){return zg(a)+z},y1:_f.top,y2:eg},d=yj.select("."+g.xgrids).selectAll("."+g.xgrid).data(f),d.enter().append("line").attr("class",g.xgrid),d.attr(e).style("opacity",function(){return+Jf.select(this).attr(sh?"y1":"x1")===(sh?eg:0)?0:1}),d.exit().remove()),De(di)&&(h=yj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(di),i=h.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),i.append("line").style("opacity",0),i.append("text").attr("text-anchor","end").attr("transform",sh?"":"rotate(-90)").attr("dx",sh?0:-_f.top).attr("dy",-5).style("opacity",0),h.select("line").transition().duration(Q).attr("x1",sh?0:Hd).attr("x2",sh?cg:Hd).attr("y1",sh?Hd:_f.top).attr("y2",sh?Hd:eg).style("opacity",1),h.select("text").transition().duration(Q).attr("x",sh?cg:0).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),h.exit().transition().duration(Q).style("opacity",0).remove()),C&&ei&&(j=yj.select("."+g.ygrids).selectAll("."+g.ygrid).data(Ag.ticks(gi)),j.enter().append("line").attr("class",g.ygrid),j.attr("x1",sh?Ag:0).attr("x2",sh?Ag:cg).attr("y1",sh?0:Ag).attr("y2",sh?eg:Ag),j.exit().remove(),mf(j,"grid")),C&&De(fi)&&(k=yj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(fi),l=k.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",sh?"rotate(-90)":"").attr("dx",sh?0:-_f.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(Q).attr("x1",sh?Id:0).attr("x2",sh?Id:cg).attr("y1",sh?0:Id).attr("y2",sh?eg:Id).style("opacity",1),k.select("text").transition().duration(Q).attr("x",sh?0:cg).attr("y",Id).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(Q).style("opacity",0).remove()),s=yj.select("."+g.regions).selectAll("."+g.region).data(Di),s.enter().append("g").attr("class",id).append("rect").style("fill-opacity",0),s.selectAll("rect").transition().duration(Q).attr("x",gc).attr("y",hc).attr("width",ic).attr("height",jc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(Q).style("opacity",0).remove(),p=yj.selectAll("."+g.bars).selectAll("."+g.bar).data(te),p.enter().append("path").attr("class",cd).style("stroke","none").style("fill",$i),p.style("opacity",ud).transition().duration(Q).attr("d",L).style("fill",$i).style("opacity",1),p.exit().transition().duration(R).style("opacity",0).remove(),m=yj.selectAll("."+g.lines).selectAll("."+g.line).data(re),m.enter().append("path").attr("class",$c).style("stroke",$i),m.style("opacity",ud).transition().duration(Q).attr("d",sj).style("stroke",$i).style("opacity",1),m.exit().transition().duration(R).style("opacity",0).remove(),n=yj.selectAll("."+g.areas).selectAll("."+g.area).data(re),n.enter().append("path").attr("class",gd).style("fill",$i).style("opacity",function(){return Ej=+Jf.select(this).style("opacity"),0}),n.style("opacity",0).transition().duration(Q).attr("d",tj).style("fill",$i).style("opacity",Ej),n.exit().transition().duration(R).style("opacity",0).remove(),o=yj.selectAll("."+g.circles).selectAll("."+g.circle).data(ue),o.enter().append("circle").attr("class",ad).attr("r",Re).style("fill",$i),o.style("opacity",ud).transition().duration(Q).style("opacity",wd).style("fill",$i).attr("cx",sh?Zd:Yd).attr("cy",sh?Yd:Zd),o.exit().remove(),t=yj.selectAll("."+g.texts).selectAll("."+g.text).data(ve),t.enter().append("text").attr("class",Wc).attr("text-anchor",function(a){return sh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",$i).style("fill-opacity",0),t.text(function(a){return Fd(a.id)(a.value,a.id)}).style("fill-opacity",vd).transition().duration(Q).attr("x",O).attr("y",P).style("fill",$i).style("fill-opacity",xd),t.exit().transition().duration(R).style("fill-opacity",0).remove(),r=yj.selectAll("."+g.arcs).selectAll("."+g.arc).data(se),r.enter().append("path").attr("class",ed).style("fill",function(a){return $i(a.data)}).style("cursor",function(a){return ah(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Yi||(c=Hb(a),d=Nb(c),e=Vb(),Pb(c.data.id),Af(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Hb(a),c=Nb(b),d=[c];Td(d,Jf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Yi||(c=Hb(a),d=Nb(c),e=Wb(),Qb(c.data.id),Bf(),Ud(),e(d,b))}).on("click",function(a,b){var c=Hb(a),d=Nb(c),e=Ub();hf(this,a,b),e(d,b)}),r.attr("transform",H?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Yi=!0}).transition().duration(Q).attrTween("d",function(a){var b,c=Hb(a);return c?(b=Jf.interpolate(this._current,c),this._current=b(0),function(a){return Kb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",H?"scale(1)":"").style("fill",function(a){return $i(a.data)}).style("opacity",1).call(Ge,function(){Yi=!1}),r.exit().transition().duration(R).style("opacity",0).remove(),yj.selectAll("."+g.chartArc).select("text").attr("transform",Lb).style("opacity",0).transition().duration(Q).text(Ob).style("opacity",function(a){return Hc(a.data.id)&&qe(a.data)?1:0}),yj.select("."+g.chartArcsTitle).style("opacity",ie(Kf.data.targets)?1:0),jh&&(Jf.event&&"zoom"===Jf.event.type&&rj.extent(zg.orgDomain()).update(),D&&(!sh&&Eh&&hb(dj.subx,c.axisSubX,Eh),rj.empty()||rj.extent(zg.orgDomain()).update(),M=$e(W,!0),v=zj.selectAll("."+g.bars).selectAll("."+g.bar).data(te),v.enter().append("path").attr("class",cd).style("stroke","none").style("fill",$i),v.style("opacity",ud).transition().duration(Q).attr("d",M).style("opacity",1),v.exit().transition().duration(Q).style("opacity",0).remove(),u=zj.selectAll("."+g.lines).selectAll("."+g.line).data(re),u.enter().append("path").attr("class",$c).style("stroke",$i),u.style("opacity",ud).transition().duration(Q).attr("d",uj).style("opacity",1),u.exit().transition().duration(Q).style("opacity",0).remove())),yj.selectAll("."+g.selectedCircles).filter(function(a){return me(a)}).selectAll("circle").remove(),yj.selectAll("."+g.selectedCircle).transition().duration(Q).attr("cx",sh?Zd:Yd).attr("cy",sh?Yd:Zd),w=yj.select("."+g.eventRects),De(Kg)&&!qc(Kg)?(w.classed(g.eventRectsMultiple)||w.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),x=yj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),gf(x.enter()),x.attr("x",0).attr("y",0).attr("width",cg).attr("height",eg)):(w.classed(g.eventRectsSingle)||w.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Ti&&!Si?(B=function(a,b){var c=zc(b),d=Ac(b),e=Kf.data.xs[a.id][b];return(zg(d?d:e+50)-zg(c?c:e-50))/2},A=function(a,b){var c=zc(b),d=Kf.data.xs[a.id][b];return(zg(d)+zg(c?c:d-50))/2}):(B=N(),A=function(a){return zg(a.x)-B/2}),y=Cc(Kf.data.targets),yj.select("."+g.eventRects).datum(y?y.values:[]),x=yj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),ff(x.enter()),x.attr("class",jd).attr("x",sh?0:A).attr("y",sh?A:0).attr("width",sh?cg:B).attr("height",sh?B:eg),x.exit().remove()),Ec(Kf.data.targets).forEach(function(a){Fj[a]=!0})}function of(){nf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function pf(){if(0!==Jc(Kf.data.targets).length){if("mousemove"===Jf.event.sourceEvent.type&&vj.altDomain)return zg.domain(vj.altDomain),void vj.scale(zg).updateScaleExtent();Si&&zg.orgDomain()[0]===Dj[0]&&zg.domain([Dj[0]-1e-10,zg.orgDomain()[1]]),nf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Jf.event.sourceEvent.type&&(Wi=!0)}}function qf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function rf(){wj.attr("width",gg).attr("height",hg),wj.select("#"+Li).select("rect").attr("width",cg).attr("height",eg),wj.select("#"+Mi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),wj.select("#"+Ni).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),wj.select("."+g.zoomRect).attr("width",cg).attr("height",eg),Cj.style("max-height",hg+"px")}function sf(a){return{axisX:a?dj.x.transition().duration(a):dj.x,axisY:a?dj.y.transition().duration(a):dj.y,axisY2:a?dj.y2.transition().duration(a):dj.y2,axisSubX:a?dj.subx.transition().duration(a):dj.subx}}function tf(a){var b;a=a||{},a.withTransition=He(a,"withTransition",!0),a.withTransform=He(a,"withTransform",!1),a.withLegend=He(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withLegend&&mh||(b=sf(a.withTransitionForAxis?$f:0),p(),T(),rf(),o(a.withTransition,b)),nf(a,b)}function uf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=yj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",ld),j=i.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Xc),e=yj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",nd),d=e.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",dd).style("cursor",function(a){return ah(a)?"pointer":null}),c=yj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",md),b=c.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",_c),b.append("g").attr("class",hd),b.append("g").attr("class",function(a){return Vc(g.selectedCircles,a.id)}),b.append("g").attr("class",bd).style("cursor",function(a){return ah(a)?"pointer":null}),a.forEach(function(a){yj.selectAll("."+g.selectedCircles+pd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=yj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(qg(a)).attr("class",od),f=h.enter().append("g").attr("class",od),f.append("g").attr("class",fd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),jh&&(n=zj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",nd),m=n.enter().append("g").style("opacity",0).attr("class",nd),m.append("g").attr("class",dd),l=zj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",md),k=l.enter().append("g").style("opacity",0).attr("class",md),k.append("g").attr("class",_c)),wj.selectAll("."+g.target).filter(function(a){return Hc(a.id)}).transition().duration($f).style("opacity",1)}function vf(a,b){b.filter&&(a=a.filter(b.filter)),(b.type||b.types)&&a.forEach(function(a){b.types?de(a.id,b.types[a.id]):de(a.id,b.type)}),Kf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,z=0,F++)),E[a]=F,D[F]=f,A[a]=z,z+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+v)/10),j=10*Math.ceil((h.height+u)/10),k=jj?j:i,l=jj?S():R();return d&&(z=0,F=0,w=0,x=0),mh&&!Ic(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=i,C[c]=j,(!w||i>=w)&&(w=i),(!x||j>=x)&&(x=j),g=jj?x:w,void(rh?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(l-g*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=26,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=Aj.selectAll("."+g.legendItemFocused).size();b=b||{},n=He(b,"withTransition",!0),q=He(b,"withTransitionForTransform",!0),jj?(f=function(a){return w*E[a]},j=function(a){return D[E[a]]+A[a]}):(f=function(a){return D[E[a]]+A[a]},j=function(a){return x*E[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=Aj.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Vc(g.legendItem,a)}).style("visibility",function(a){return Ic(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof oh?oh(a):Kf.toggle(a)}).on("mouseover",function(a){Jf.select(this).classed(g.legendItemFocused,!0),Yi||Kf.focus(a),"function"==typeof ph&&ph(a)}).on("mouseout",function(a){Jf.select(this).classed(g.legendItemFocused,!1),Yi||Kf.revert(),"function"==typeof qh&&qh(a)}),m.append("text").text(function(a){return d(Ng[a])?Ng[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",jj?h:-200).attr("y",jj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",jj?i:-200).attr("y",jj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",$i).attr("x",jj?h:-200).attr("y",jj?-200:j).attr("width",10).attr("height",10),r=Aj.selectAll("text").data(a).text(function(a){return d(Ng[a])?Ng[a]:a}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=Aj.selectAll("rect."+g.legendItemEvent).data(a),(n?s.transition():s).attr("width",function(a){return B[a]}).attr("height",function(a){return C[a]}).attr("x",i).attr("y",l),t=Aj.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",$i).attr("x",f).attr("y",j),Aj.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Hc(a)}).transition().style("opacity",function(a){var b=Jf.select(this);return Hc(a)?!G||b.classed(g.legendItemFocused)?yf(b):zf(b):nj}),P(w),Q(x),O(F),p(),T(),rf(),o(q,c)}function Ff(a){return Gc(Kf.data.targets,a.id)}function Gf(a){return"data"in a&&Gc(Kf.data.targets,a.data.id)}function Hf(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 If(a,b,c){var d=!je(Kf.data.targets);Yi=!1,de(a,b),tf(c||{withTransitionForAxis:d})}var Jf=a.d3?a.d3:a.require?a.require("d3"):void 0,Kf={data:{},axis:{},legend:{}},Lf={},Mf=i(["bindto"],"#chart"),Nf=i(["size","width"]),Of=i(["size","height"]),Pf=i(["padding","left"],50),Qf=i(["padding","right"],10),Rf=i(["padding","top"],0),Sf=i(["padding","bottom"],0),Tf=i(["zoom","enabled"],!1),Uf=i(["zoom","extent"]),Vf=i(["zoom","privileged"],!1),Wf=i(["onenter"],function(){}),Xf=i(["onleave"],function(){}),Yf=i(["onresize"],function(){}),Zf=i(["onresized"],function(){}),$f=i(["transition","duration"],350);h("data","data is required in config");var _f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg=i(["data","x"]),Kg=i(["data","xs"],{}),Lg=i(["data","x_format"]),Mg=i(["data","id_converter"],function(a){return a}),Ng=i(["data","names"],{}),Og=i(["data","classes"],{}),Pg=i(["data","groups"],[]),Qg=i(["data","axes"],{}),Rg=i(["data","type"]),Sg=i(["data","types"],{}),Tg=i(["data","labels"],{}),Ug=i(["data","order"]),Vg=i(["data","regions"],{}),Wg=i(["data","color"]),Xg=i(["data","colors"],{}),Yg=i(["data","hide"],!1),Zg=i(["data","filter"]),$g=i(["data","selection","enabled"],!1),_g=i(["data","selection","grouped"],!1),ah=i(["data","selection","isselectable"],function(){return!0}),bh=i(["data","selection","multiple"],!0),ch=i(["data","onclick"],function(){}),dh=i(["data","onenter"],function(){}),eh=i(["data","onleave"],function(){}),fh=i(["data","onselected"],function(){}),gh=i(["data","onunselected"],function(){}),hh=i(["data","ondragstart"],function(){}),ih=i(["data","ondragend"],function(){}),jh=i(["subchart","show"],!1),kh=i(["subchart","size","height"],60),lh=i(["color","pattern"],[]),mh=i(["legend","show"],!0),nh=i(["legend","position"],"bottom"),oh=i(["legend","item","onclick"]),ph=i(["legend","item","onmouseover"]),qh=i(["legend","item","onmouseout"]),rh=i(["legend","equally"],!1),sh=i(["axis","rotated"],!1),th=i(["axis","x","show"],!0),uh=i(["axis","x","type"],"indexed"),vh=i(["axis","x","localtime"],!0),wh=i(["axis","x","categories"],[]),xh=i(["axis","x","tick","centered"],!1),yh=i(["axis","x","tick","format"]),zh=i(["axis","x","tick","culling"],{}),Ah=i(["axis","x","tick","culling","max"],10),Bh=i(["axis","x","tick","count"]),Ch=i(["axis","x","tick","fit"],!0),Dh=i(["axis","x","tick","values"],null),Eh=i(["axis","x","tick","rotate"]),Fh=i(["axis","x","max"],null),Gh=i(["axis","x","min"],null),Hh=i(["axis","x","padding"],{}),Ih=i(["axis","x","height"]),Jh=i(["axis","x","default"]),Kh=i(["axis","x","label"],{}),Lh=i(["axis","y","show"],!0),Mh=i(["axis","y","max"]),Nh=i(["axis","y","min"]),Oh=i(["axis","y","center"]),Ph=i(["axis","y","label"],{}),Qh=i(["axis","y","inner"],!1),Rh=i(["axis","y","tick","format"]),Sh=i(["axis","y","padding"]),Th=i(["axis","y","ticks"],10),Uh=i(["axis","y2","show"],!1),Vh=i(["axis","y2","max"]),Wh=i(["axis","y2","min"]),Xh=i(["axis","y2","center"]),Yh=i(["axis","y2","label"],{}),Zh=i(["axis","y2","inner"],!1),$h=i(["axis","y2","tick","format"]),_h=i(["axis","y2","padding"]),ai=i(["axis","y2","ticks"],10),bi=i(["grid","x","show"],!1),ci=i(["grid","x","type"],"tick"),di=i(["grid","x","lines"],[]),ei=i(["grid","y","show"],!1),fi=i(["grid","y","lines"],[]),gi=i(["grid","y","ticks"],10),hi=i(["point","show"],!0),ii=i(["point","r"],2.5),ji=i(["point","focus","line","enabled"],!0),ki=i(["point","focus","expand","enabled"],!0),li=i(["point","focus","expand","r"]),mi=i(["point","focus","select","r"]),ni=i(["line","connect_null"],!1),oi=i(["bar","width"]),pi=i(["bar","width","ratio"],.6),qi=i(["pie","label","show"],!0),ri=i(["pie","label","format"]),si=i(["pie","expand"],!0),ti=i(["pie","onclick"],function(){}),ui=i(["pie","onmouseover"],function(){}),vi=i(["pie","onmouseout"],function(){}),wi=i(["donut","label","show"],!0),xi=i(["donut","label","format"]),yi=i(["donut","expand"],!0),zi=i(["donut","title"],""),Ai=i(["donut","onclick"],function(){}),Bi=i(["donut","onmouseover"],function(){}),Ci=i(["donut","onmouseout"],function(){}),Di=i(["regions"],[]),Ei=i(["tooltip","show"],!0),Fi=i(["tooltip","format","title"]),Gi=i(["tooltip","format","value"]),Hi=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Fi?Fi:b,l=Gi?Gi:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Ii=i(["tooltip","init","show"],!1),Ji=i(["tooltip","init","x"],0),Ki=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Li=("string"==typeof Mf?Mf.replace("#",""):Mf.id)+"-clip",Mi=Li+"-xaxis",Ni=Li+"-yaxis",Oi=j(Li),Pi=j(Mi),Qi=j(Ni),Ri="timeseries"===uh,Si="categorized"===uh,Ti=!Ri&&(Jg||De(Kg)),Ui=null,Vi=!1,Wi=!1,Xi=!1,Yi=!1,Zi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],$i=xe(Xg,De(lh)?lh:Zi,Wg),_i=vh?Jf.time.format:Jf.time.format.utc,aj=_i.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),bj=[],cj=[],dj={},ej=sh?"left":"bottom",fj=sh?Qh?"top":"bottom":Qh?"right":"left",gj=sh?Zh?"bottom":"top":Zh?"left":"right",hj=sh?"left":"bottom",ij={main:function(){return"translate("+k(_f.left)+","+k(_f.top)+")"},context:function(){return"translate("+k(ag.left)+","+k(ag.top)+")"},legend:function(){return"translate("+bg.left+","+bg.top+")"},x:function(){return"translate(0,"+(sh?0:eg)+")"},y:function(){return"translate(0,"+(sh?eg:0)+")"},y2:function(){return"translate("+(sh?0:cg)+","+(sh?1:0)+")" },subx:function(){return"translate(0,"+(sh?0:fg)+")"},arc:function(){return"translate("+lg/2+","+mg/2+")"}},jj="right"===nh,kj=0,lj=0,mj=0,nj=.15,oj=30,pj=sh&&!th?0:30,qj=5;qg=Jf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var rj,sj=function(){var a=Jf.svg.line().x(sh?function(a){return Y(a.id)(a.value)}:Gd).y(sh?Gd:function(a){return Y(a.id)(a.value)});return ni||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ni?Qe(b.values):b.values;return ke(b)?(a.interpolate(le(b)?"cardinal":"linear"),Vg[b.id]?df(e,zg,Y(b.id),Vg[b.id]):a(e)):(c=e[0]?zg(e[0].x):0,d=e[0]?Y(b.id)(e[0].value):0,sh?"M "+d+" "+c:"M "+c+" "+d)}}(),tj=function(){var a;return a=sh?Jf.svg.area().x0(function(a){return Y(a.id)(0)}).x1(function(a){return Y(a.id)(a.value)}).y(Gd):Jf.svg.area().x(Gd).y0(function(a){return Y(a.id)(0)}).y1(function(a){return Y(a.id)(a.value)}),function(b){var c,d,e=Qe(b.values);return ee([b],"area")||ee([b],"area-spline")?(a.interpolate(le(b)?"cardinal":"linear"),a(e)):(c=e[0]?zg(e[0].x):0,d=e[0]?Y(b.id)(e[0].value):0,sh?"M "+d+" "+c:"M "+c+" "+d)}}(),uj=function(){var a=Jf.svg.line().x(sh?function(a){return Z(a.id)(a.value)}:Jd).y(sh?Jd:function(a){return Z(a.id)(a.value)});return function(b){var c=Qe(b.values);return ke(b)?a(c):"M "+Cg(c[0].x)+" "+Z(b.id)(c[0].value)}}(),vj=function(){};rj=Jf.svg.brush().on("brush",of),rj.update=function(){return zj&&zj.select("."+g.brush).call(this),this},rj.scale=function(a){return sh?this.y(a):this.x(a)},Tf&&(vj=Jf.behavior.zoom().on("zoomstart",function(){vj.altDomain=Jf.event.sourceEvent.altKey?zg.orgDomain():null}).on("zoom",Tf?pf:null),vj.scale=function(a){return sh?this.y(a):this.x(a)},vj.orgScaleExtent=function(){var a=Uf?Uf:[1,10];return[a[0],Math.max(Bc()/a[1],a[1])]},vj.updateScaleExtent=function(){var a=cc(zg.orgDomain())/cc(Dj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var wj,xj,yj,zj,Aj,Bj,Cj,Dj,Ej,Fj={};if(Kf.focus=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",1)}var c=wj.selectAll(qd(a)),d=c.filter(Ff),e=c.filter(Gf);Kf.revert(),Kf.defocus(),b(d.classed(g.focused,!0)),b(e),je(Kf.data.targets)&&Pb(a,!0),Af(a,!0)},Kf.defocus=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",.3)}var c=wj.selectAll(qd(a)),d=c.filter(Ff),e=c.filter(Gf);Kf.revert(),b(d.classed(g.focused,!1)),b(e),je(Kf.data.targets)&&Qb(a),Af(a,!1)},Kf.revert=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",1)}var c=wj.selectAll(qd(a)),d=c.filter(Ff),e=c.filter(Gf);b(d.classed(g.focused,!1)),b(e),je(Kf.data.targets)&&Qb(a),Bf()},Kf.show=function(a,b){a=Fc(a),b=b||{},Nc(a),wj.selectAll(rd(a)).transition().style("opacity",1),b.withLegend&&Cf(a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Kf.hide=function(a,b){a=Fc(a),b=b||{},Mc(a),wj.selectAll(rd(a)).transition().style("opacity",0),b.withLegend&&Df(a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Kf.toggle=function(a){Hc(a)?Kf.hide(a):Kf.show(a)},Kf.unzoom=function(){rj.clear().update(),nf({withUpdateXDomain:!0})},Kf.load=function(a){return a.xs&&pc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Og[b]=a.classes[b]}),"categories"in a&&Si&&(wh=a.categories,Fg.categories(wh)),"cacheIds"in a&&dc(a.cacheIds)?void vf(fc(a.cacheIds),a.done):void("unload"in a?xf(Fc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){wf(a)}):wf(a))},Kf.unload=function(a,b){xf(Fc(a),function(){nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Kf.selected=function(a){return Jf.merge(yj.selectAll("."+g.shapes+pd(a)).selectAll("."+g.shape).filter(function(){return Jf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Kf.select=function(a,b,c){$g&&yj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Jf.select(this),i=e.data?e.data.id:e.id,j=Pe(this),k=_g||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);"path"!==this.nodeName&&(k&&l?ah(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},Kf.unselect=function(a,b){$g&&yj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Jf.select(this),f=c.data?c.data.id:c.id,h=Pe(this),i=_g||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);"path"!==this.nodeName&&i&&j&&ah(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Kf.toLine=function(a){If(a,"line")},Kf.toSpline=function(a){If(a,"spline")},Kf.toBar=function(a){If(a,"bar")},Kf.toScatter=function(a){If(a,"scatter")},Kf.toArea=function(a){If(a,"area")},Kf.toAreaSpline=function(a){If(a,"area-spline")},Kf.toPie=function(a){If(a,"pie",{withTransform:!0})},Kf.toDonut=function(a){If(a,"donut",{withTransform:!0})},Kf.groups=function(a){return c(a)?Pg:(Pg=a,nf(),Pg)},Kf.xgrids=function(a){return a?(di=a,nf(),di):di},Kf.xgrids.add=function(a){return a?Kf.xgrids(di.concat(a)):void 0},Kf.xgrids.remove=function(a){var b=Hf(a);return Kf.xgrids(di.filter(b))},Kf.ygrids=function(a){return a?(fi=a,nf(),fi):fi},Kf.ygrids.add=function(a){return a?Kf.ygrids(fi.concat(a)):void 0},Kf.ygrids.remove=function(a){var b=Hf(a);return Kf.ygrids(fi.filter(b))},Kf.regions=function(a){return a?(Di=a,nf(),Di):Di},Kf.regions.add=function(a){return a?(Di=Di.concat(a),nf(),Di):Di},Kf.regions.remove=function(a){var b,c,d;return a=a||{},b=He(a,"duration",$f),c=He(a,"classes",[g.region]),d=yj.select("."+g.regions).selectAll(c.map(function(a){return"."+a})),(b?d.transition().duration(b):d).style("opacity",0).remove(),Di=Di.filter(function(a){return c.indexOf(a.class)<0})},Kf.data.get=function(a){var b=Kf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Kf.data.getAsTarget=function(a){var b=Kf.data.targets.filter(function(b){return b.id===a});return b.length>0?b[0]:void 0},Kf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Ng[b]=a[b]}),nf({withLegend:!0}),Ng):Ng},Kf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Xg[b]=a[b]}),nf({withLegend:!0}),Xg):Xg},Kf.x=function(a){return arguments.length&&(sc(Kf.data.targets,a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Kf.data.xs},Kf.xs=function(a){return arguments.length&&(tc(Kf.data.targets,a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Kf.data.xs},Kf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){eb(b,a[b])}),Gb())},Kf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Fh=+a.x),b(a.y)&&(Mh=+a.y),b(a.y2)&&(Vh=+a.y2)):Mh=Vh=+a,nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Kf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Gh=+a.x),b(a.y)&&(Nh=+a.y),b(a.y2)&&(Wh=+a.y2)):Nh=Wh=+a,nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Kf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Kf.axis.max(a.max),"undefined"!=typeof a.min&&Kf.axis.min(a.min))},Kf.legend.show=function(a){Cf(Fc(a)),nf({withLegend:!0})},Kf.legend.hide=function(a){Df(Fc(a)),nf({withLegend:!0})},Kf.resize=function(a){Nf=a?a.width:null,Of=a?a.height:null,tf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Kf.destroy=function(){Kf.data.targets=void 0,Kf.data.xs={},Cj.html(""),a.onresize=null},"url"in f.data)Jf.xhr(f.data.url,function(a,b){var c,d=Jf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Jf.csv.parse(b.response),ef(c)});else if("rows"in f.data)ef(vc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");ef(wc(f.data.columns))}return Kf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(window); \ No newline at end of file From 7b65334454b925c858c543c9971f17352c28d69d Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Fri, 9 May 2014 17:16:36 +0900 Subject: [PATCH 158/178] Add interaction.enabled option - #215 --- c3.js | 114 ++++++++++++++++++++++++++++-------------------------- c3.min.js | 6 +-- 2 files changed, 62 insertions(+), 58 deletions(-) diff --git a/c3.js b/c3.js index c50fc46..5ae0fd4 100644 --- a/c3.js +++ b/c3.js @@ -118,6 +118,8 @@ __zoom_extent = getConfig(['zoom', 'extent']), __zoom_privileged = getConfig(['zoom', 'privileged'], false); + var __interaction_enabled = getConfig(['interaction', 'enabled'], true); + var __onenter = getConfig(['onenter'], function () {}), __onleave = getConfig(['onleave'], function () {}), __onresize = getConfig(['onresize'], function () {}), @@ -3494,66 +3496,68 @@ .attr("cx", __axis_rotated ? circleY : circleX) .attr("cy", __axis_rotated ? circleX : circleY); - // rect for mouseover - eventRect = main.select('.' + CLASS.eventRects); - if (notEmpty(__data_xs) && !isSingleX(__data_xs)) { + if (__interaction_enabled) { + // rect for mouseover + eventRect = main.select('.' + CLASS.eventRects); + if (notEmpty(__data_xs) && !isSingleX(__data_xs)) { - if (!eventRect.classed(CLASS.eventRectsMultiple)) { - eventRect.classed(CLASS.eventRectsMultiple, true).classed(CLASS.eventRectsSingle, false) - .selectAll('.' + CLASS.eventRect).remove(); - } + if (!eventRect.classed(CLASS.eventRectsMultiple)) { + eventRect.classed(CLASS.eventRectsMultiple, true).classed(CLASS.eventRectsSingle, false) + .selectAll('.' + CLASS.eventRect).remove(); + } - eventRectUpdate = main.select('.' + CLASS.eventRects).selectAll('.' + CLASS.eventRect) - .data([0]); - // enter : only one rect will be added - generateEventRectsForMultipleXs(eventRectUpdate.enter()); - // update - eventRectUpdate - .attr('x', 0) - .attr('y', 0) - .attr('width', width) - .attr('height', height); - // exit : not needed becuase always only one rect exists - } else { + eventRectUpdate = main.select('.' + CLASS.eventRects).selectAll('.' + CLASS.eventRect) + .data([0]); + // enter : only one rect will be added + generateEventRectsForMultipleXs(eventRectUpdate.enter()); + // update + eventRectUpdate + .attr('x', 0) + .attr('y', 0) + .attr('width', width) + .attr('height', height); + // exit : not needed becuase always only one rect exists + } else { - if (!eventRect.classed(CLASS.eventRectsSingle)) { - eventRect.classed(CLASS.eventRectsMultiple, false).classed(CLASS.eventRectsSingle, true) - .selectAll('.' + CLASS.eventRect).remove(); - } + if (!eventRect.classed(CLASS.eventRectsSingle)) { + eventRect.classed(CLASS.eventRectsMultiple, false).classed(CLASS.eventRectsSingle, true) + .selectAll('.' + CLASS.eventRect).remove(); + } - if (isCustomX && !isCategorized) { - rectW = function (d, i) { - var prevX = getPrevX(i), nextX = getNextX(i), dx = c3.data.xs[d.id][i]; - return (x(nextX ? nextX : dx + 50) - x(prevX ? prevX : dx - 50)) / 2; - }; - rectX = function (d, i) { - var prevX = getPrevX(i), dx = c3.data.xs[d.id][i]; - return (x(dx) + x(prevX ? prevX : dx - 50)) / 2; - }; - } else { - rectW = getEventRectWidth(); - rectX = function (d) { - return x(d.x) - (rectW / 2); - }; + if (isCustomX && !isCategorized) { + rectW = function (d, i) { + var prevX = getPrevX(i), nextX = getNextX(i), dx = c3.data.xs[d.id][i]; + return (x(nextX ? nextX : dx + 50) - x(prevX ? prevX : dx - 50)) / 2; + }; + rectX = function (d, i) { + var prevX = getPrevX(i), dx = c3.data.xs[d.id][i]; + return (x(dx) + x(prevX ? prevX : dx - 50)) / 2; + }; + } else { + rectW = getEventRectWidth(); + rectX = function (d) { + return x(d.x) - (rectW / 2); + }; + } + // Set data + maxDataCountTarget = getMaxDataCountTarget(c3.data.targets); + main.select('.' + CLASS.eventRects) + .datum(maxDataCountTarget ? maxDataCountTarget.values : []); + // Update rects + eventRectUpdate = main.select('.' + CLASS.eventRects).selectAll('.' + CLASS.eventRect) + .data(function (d) { return d; }); + // enter + generateEventRectsForSingleX(eventRectUpdate.enter()); + // update + eventRectUpdate + .attr('class', classEvent) + .attr("x", __axis_rotated ? 0 : rectX) + .attr("y", __axis_rotated ? rectX : 0) + .attr("width", __axis_rotated ? width : rectW) + .attr("height", __axis_rotated ? rectW : height); + // exit + eventRectUpdate.exit().remove(); } - // Set data - maxDataCountTarget = getMaxDataCountTarget(c3.data.targets); - main.select('.' + CLASS.eventRects) - .datum(maxDataCountTarget ? maxDataCountTarget.values : []); - // Update rects - eventRectUpdate = main.select('.' + CLASS.eventRects).selectAll('.' + CLASS.eventRect) - .data(function (d) { return d; }); - // enter - generateEventRectsForSingleX(eventRectUpdate.enter()); - // update - eventRectUpdate - .attr('class', classEvent) - .attr("x", __axis_rotated ? 0 : rectX) - .attr("y", __axis_rotated ? rectX : 0) - .attr("width", __axis_rotated ? width : rectW) - .attr("height", __axis_rotated ? rectW : height); - // exit - eventRectUpdate.exit().remove(); } // update fadein condition diff --git a/c3.min.js b/c3.min.js index cf177de..350f20b 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.ceil(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.ceil(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&acg&&(cg=0),0>eg&&(eg=0),dg=sh?_f.left-oj-pj:cg,fg=sh?eg:hg-ag.top-ag.bottom,0>dg&&(dg=0),0>fg&&(fg=0),lg=cg-(jj?b+10:0),mg=eg-(jj?0:10),r(),jj&&d&&(bg.left=lg/2+1.1*jg)}function q(){yj.select("line."+g.xgridFocus).attr("x1",sh?0:-10).attr("x2",sh?cg:-10).attr("y1",sh?-10:_f.top).attr("y2",sh?-10:eg)}function r(){jg=Math.min(lg,mg)/2,ig=.95*jg,kg=ie(Kf.data.targets)?.6*ig:0}function s(){var a=sh?g.axisX:g.axisY,b=yj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Jf.select(Mf).node().getBoundingClientRect(),e=je(Kf.data.targets),f=c.right-d.left-(e?0:v());return f>0?f:0}function t(){return Nf?Nf:z()}function u(){var a=Of?Of:A();return a>0?a:320}function v(){var a=1;return Pf?Pf:sh?th?x("x"):a:!Lh||Qh?a:x("y")}function w(){var a=1;return Qf?Qf:jj?R()+20+(Uh&&!sh?x("y2"):a):Uh?Zh||sh?a:x("y2"):a}function x(a){var b=mb(a);return b.isInner?20+Fb(a):40+Fb(a)}function y(a){return"x"!==a||th?"x"===a&&Ih?Ih:"y"!==a||Lh?"y2"!==a||Uh?(mb(a).isInner?30:40)+("y2"===a?-10:0):qj:mh&&!jj?10:1:0}function z(){return+Jf.select(Mf).style("width").replace("px","")}function A(){return+Jf.select(Mf).style("height").replace("px","")}function B(a){return a?-31:-(_f.left-1)}function C(a){return a?-20:-4}function D(){return B(!sh)}function E(){return C(!sh)}function F(){return B(sh)}function G(){return C(sh)}function H(a){return a?cg+2+30+30:_f.left+20}function I(a){return a?(Ih?Ih:0)+80:eg+8}function J(){return H(!sh)}function K(){return I(!sh)}function L(){return H(sh)}function M(){return I(sh)}function N(){var a,b,c,d,e,f=Cc(Kf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=zg(b.x)-zg(a.x),0===c?sh?eg:cg:(d=Bc(),e=fe(Kf.data.targets)?(d-(Si?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function O(a){kj=a}function P(a){lj=a}function Q(a){mj=a}function R(){return mh?jj?lj*(kj+1):gg:0}function S(){return mh?jj?hg:mj*(kj+1):0}function T(){var a,b,c=!zg;rg=sh?1:0,sg=sh?eg:cg,tg=sh?0:eg,ug=sh?cg:1,vg=rg,wg=sg,xg=sh?0:fg,yg=sh?dg:1,zg=W(rg,sg,c?void 0:zg.domain(),function(){return Fg.tickOffset()}),Ag=X(tg,ug,c?void 0:Ag.domain()),Bg=X(tg,ug,c?void 0:Bg.domain()),Cg=W(rg,sg,Dj,function(a){return a%1?0:Ig.tickOffset()}),Dg=X(xg,yg,c?void 0:Dg.domain()),Eg=X(xg,yg,c?void 0:Eg.domain()),a=bb(),b=Dh?Dh:c?void 0:Fg.tickValues(),Fg=$(zg,ej,a,b),Ig=$(Cg,hj,a,b),Gg=_(Ag,fj,Rh,Th),Hg=_(Bg,gj,$h,ai),c||(rj.scale(Cg),Tf&&vj.scale(zg)),U()}function U(){ng=Ib(),og=Jb(),pg=Jb(.98)}function V(a,b,c){return(c?Jf.time.scale():Jf.scale.linear()).range([a,b])}function W(a,b,c,d){var e,f=V(a,b,Ri),g=c?f.domain(c):f;Si?(d=d||function(){return 0},f=function(a,b){var c=g(a)+d(a);return b?c:Math.ceil(c)}):f=function(a,b){var c=g(a);return b?c:Math.ceil(c)};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return Dj&&Dj[0]===a[0]&&Dj[1]a?a.toFixed(0):a};return yh&&("function"==typeof yh?a=yh:Ri&&(a=function(a){return a?_i(yh)(a):""})),a}function cb(a){var b;return"y"===a?b=Ph:"y2"===a?b=Yh:"x"===a&&(b=Kh),b}function db(a){var b=cb(a);return"string"==typeof b?b:b?b.text:null}function eb(a,b){var c=cb(a);"string"==typeof c?"y"===a?Ph=b:"y2"===a?Yh=b:"x"===a&&(Kh=b):c&&(c.text=b)}function fb(a){return 10*Math.sin(Math.PI*(a/180))}function gb(a){return 11.5-2.5*(a/15)}function hb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",gb(c)).attr("x",fb(c)).attr("transform","rotate("+c+")")}function ib(a,b){var c=cb(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 jb(){return ib("x",sh?"inner-top":"inner-right")}function kb(){return ib("y",sh?"inner-right":"inner-top")}function lb(){return ib("y2",sh?"inner-right":"inner-top")}function mb(a){return"y2"===a?lb():"y"===a?kb():jb()}function nb(){return db("x")}function ob(){return db("y")}function pb(){return db("y2")}function qb(a,b){return a?b.isLeft?0:b.isCenter?cg/2:cg:b.isBottom?-eg:b.isMiddle?-eg/2:0}function rb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function sb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function tb(){return qb(!sh,jb())}function ub(){return qb(sh,kb())}function vb(){return qb(sh,lb())}function wb(){return rb(!sh,jb())}function xb(){return rb(sh,kb())}function yb(){return rb(sh,lb())}function zb(){var a=jb();return sh?a.isInner?"1.2em":-25-Fb("x"):a.isInner?"-0.5em":Ih?Ih-10:"3em"}function Ab(){var a=kb();return sh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Fb("y")}function Bb(){var a=lb();return sh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Fb("y2")}function Cb(){return sb(!sh,jb())}function Db(){return sb(sh,kb())}function Eb(){return sb(sh,lb())}function Fb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Jf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Gb(a){var b=yj.select("."+g.axisX+" ."+g.axisXLabel),c=yj.select("."+g.axisY+" ."+g.axisYLabel),d=yj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",tb).attr("dx",wb).attr("dy",zb).text(nb),(a?c.transition():c).attr("x",ub).attr("dx",xb).attr("dy",Ab).attr("dy",Ab).text(ob),(a?d.transition():d).attr("x",vb).attr("dx",yb).attr("dy",Bb).text(pb)}function Hb(a){var b=!1;return qg(Jc(Kf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Ib(){var a=Jf.svg.arc().outerRadius(ig).innerRadius(kg),b=function(b,c){var d;return c?a(b):(d=Hb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Jb(a){var b=Jf.svg.arc().outerRadius(jg*(a?a:1)).innerRadius(kg);return function(a){var c=Hb(a);return c?b(c):"M 0 0"}}function Kb(a,b){return qe(a.data)?ng(a,b):"M 0 0"}function Lb(a){var b,c,d,e,f=Hb(a),g="";return f&&(b=ng.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*ig*.8+","+d/e*ig*.8+")"),g}function Mb(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Nb(a){return rc({id:a.data.id,value:a.value,ratio:Mb(a)})}function Ob(a){var b,c,d,e;return Rb()?(b=Hb(a),c=b?b.value:null,d=Mb(b),e=Sb(),e?e(c,d):Ed(c,d)):""}function Pb(a,b){var c=wj.selectAll("."+g.chartArc+qd(a)),d=wj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});we(a)&&c.selectAll("path").transition().duration(50).attr("d",og).transition().duration(100).attr("d",pg).each(function(a){pe(a.data)}),b||d.style("opacity",.3)}function Qb(a){var b=wj.selectAll("."+g.chartArc+qd(a));b.selectAll("path").transition().duration(50).attr("d",ng),wj.selectAll("."+g.arc).style("opacity",1)}function Rb(){return ie(Kf.data.targets)?wi:qi}function Sb(){return ie(Kf.data.targets)?xi:ri}function Tb(){return ie(Kf.data.targets)?zi:""}function Ub(){var a=ie(Kf.data.targets)?Ai:ti;return"function"==typeof a?a:function(){}}function Vb(){var a=ie(Kf.data.targets)?Bi:ui;return"function"==typeof a?a:function(){}}function Wb(){var a=ie(Kf.data.targets)?Ci:vi;return"function"==typeof a?a:function(){}}function Xb(a){var b,c,d,e,f,g,h=Ec(a),i=Qc(a);if(Pg.length>0)for(g=Sc(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 Jf.min(Object.keys(i).map(function(a){return Jf.min(i[a])}))}function Yb(a){var b,c,d,e,f,g,h=Ec(a),i=Qc(a);if(Pg.length>0)for(g=Tc(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 Jf.max(Object.keys(i).map(function(a){return Jf.max(i[a])}))}function Zb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return ab(a.id)===c}),m="y2"===c?Wh:Nh,n="y2"===c?Vh:Mh,o=b(m)?m:Xb(l),p=b(n)?n:Yb(l),q="y2"===c?Xh:Oh,r=yd()&&sh;return 0===l.length?"y2"===c?Bg.domain():Ag.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=zd(o,p),j=cc(Ag.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Sh&&(f=b(Sh.top)?Sh.top:e,g=b(Sh.bottom)?Sh.bottom:e),"y2"===c&&_h&&(f=b(_h.top)?_h.top:e,g=b(_h.bottom)?_h.bottom:e),fe(l)&&!Sc(l)&&(g=o),[o-g,p+f])}function $b(a){return Gh?Ri?ye(Gh):Gh:Jf.min(a,function(a){return Jf.min(a.values,function(a){return a.x})})}function _b(a){return Fh?Ri?ye(Fh):Fh:Jf.max(a,function(a){return Jf.max(a.values,function(a){return a.x})})}function ac(a){var c,d,e,f,g=Dc(a),h=g[1]-g[0];return Si?d=0:fe(a)?(c=Bc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Hh&&De(Hh)?(e=b(Hh.left)?Hh.left:d,f=b(Hh.right)?Hh.right:d):e=f="number"==typeof Hh?Hh:d,{left:e,right:f}}function bc(a){var b=[$b(a),_b(a)],c=b[0],d=b[1],e=ac(a),f=0,g=0;return c-d!==0||Si||(c=Ri?new Date(.5*c.getTime()):-.5,d=Ri?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Ri?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Ri?new Date(d.getTime()+e.right):d+e.right),[f,g]}function cc(a){return a[1]-a[0]}function dc(a){for(var b=0;bb?0:b-c}function jc(a){var b,c=hc(a),d="y"===a.axis?Ag:Bg;return b="y"===a.axis||"y2"===a.axis?sh?eg:"start"in a?d(a.start):eg:sh?"end"in a?zg(Ri?ye(a.end):a.end):eg:eg,c>b?0:b-c}function kc(a){return Jg&&a===Jg||De(Kg)&&Ee(Kg,a)}function lc(a){return!kc(a)}function mc(a){return Jg?Jg:De(Kg)?Kg[a]:null}function nc(a,b){var c,d=b&&De(b)?Ec(b):[];return d.forEach(function(b){mc(b)===a&&(c=Kf.data.xs[b])}),c}function oc(a,b){return a in Kf.data.xs&&Kf.data.xs[a]&&Kf.data.xs[a][b]?Kf.data.xs[a][b]:b}function pc(a){Object.keys(a).forEach(function(b){Kg[b]=a[b]})}function qc(a){return 1===Jf.set(Object.keys(a).map(function(b){return a[b]})).size()}function rc(a){var b;return a&&(b=Ng[a.id],a.name=b?b:a.id),a}function sc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=uc(b[d],a.id,d)}),Kf.data.xs[a.id]=b})}function tc(a,b){a.forEach(function(a){b[a.id]&&sc([a],b[a.id])})}function uc(a,c,d){var e;return e=Ri?a?a instanceof Date?a:ye(a):ye(oc(c,d)):Ti&&!Si?b(a)?+a:oc(c,d):d}function vc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Kf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Jg?(d=Object.keys(Kf.data.xs),Kf.data.xs[c]=d.length>0?Kf.data.xs[d[0]]:void 0):De(Kg)&&(Kf.data.xs[c]=nc(f,Kf.data.targets)):Kf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Kf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Mg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=mc(b),g=a[f],h=uc(g,b,e);return Ti&&Si&&0===c&&g&&(0===e&&(wh=[]),wh.push(g)),("undefined"==typeof a[b]||Kf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Rg&&de(Ec(c).filter(function(a){return!(a in Sg)}),Rg),c.forEach(function(a){ec(a.id_org,a)}),c}function yc(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 zc(a){return a>0&&Kf.data.targets[0].values[a-1]?Kf.data.targets[0].values[a-1].x:void 0}function Ac(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Dc(a){var b,c,d=Cc(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Ec(a){return a.map(function(a){return a.id})}function Fc(a){return a?"string"==typeof a?[a]:a:Ec(Kf.data.targets)}function Gc(a,b){var c,d=Ec(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Ri?new Date(i):i);j.push(e)}return Ri||(j=j.sort(function(a,b){return a-b})),j}function Mc(a){bj=bj.concat(a)}function Nc(a){bj=bj.filter(function(b){return a.indexOf(b)<0})}function Oc(a){cj=cj.concat(a)}function Pc(a){cj=cj.filter(function(b){return a.indexOf(b)<0})}function Qc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Rc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Tc(a){return Rc(a,function(a){return a>0})}function Uc(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||0===a[f].x)&&(e=e.concat(Kd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Kd(a,g))),Nd(e,b)):Ld(a,b,f,g)}function Md(a,b){var c;return c=a.map(function(a){return Ld(a.values,b)}),Nd(c,b)}function Nd(a,b){var c,d;return a.forEach(function(a){var e=Fe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Od(a,b){return Jf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Pd(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 Qd(){return Ug&&"desc"===Ug.toLowerCase()}function Rd(){return Ug&&"asc"===Ug.toLowerCase()}function Sd(a){var b=Rd(),c=Qd();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 Ug&&a.sort(Ug),a}function Td(a,c){var d,e,f,g,h,i,j,k=je(Kf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&Ei&&(Bj.html(Hi(a,bb(),Ad(k),$i)).style("display","block"),d=Bj.property("offsetWidth"),e=Bj.property("offsetHeight"),k?(g=cg/2+c[0],i=eg/2+c[1]+20):(sh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-w(),i=zg(l[0].x)+20):(f=s(),g=f+v()+zg(l[0].x)+20,h=g+d,j=f+t()-w(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),Bj.style("top",i+"px").style("left",g+"px"))}function Ud(){Bj.style("display","none")}function Vd(a){var c=a.filter(function(a){return a&&b(a.value)});if(Ei&&!ge(Kf.data.targets)&&!je(Kf.data.targets)){var d=yj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(sh?"y1":"x1",Gd).attr(sh?"y2":"x2",Gd),mf(d,"grid")}}function Wd(){yj.select("line."+g.xgridFocus).style("visibility","hidden")}function Xd(a,b){var c,d,e,f,h=[],i=yj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=bc(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function Yd(a){return a.x||0===a.x?zg(a.x):null}function Zd(a){return Y(a.id)(a.value)}function $d(){var a,b,d={},e=0;return Jc(Kf.data.targets.filter(me)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ce(a,b){return"number"==typeof oi?oi:b?2*a.tickOffset()*pi/b:0}function de(a,b){Fc(a).forEach(function(a){Fj[a]=b===Sg[a],Sg[a]=b})}function ee(a,b){var c=!1;return a.forEach(function(a){Sg[a.id]===b&&(c=!0),a.id in Sg||"line"!==b||(c=!0)}),c}function fe(a){return ee(a,"bar")}function ge(a){return ee(a,"scatter")}function he(a){return ee(a,"pie")}function ie(a){return ee(a,"donut")}function je(a){return he(a)||ie(a)}function ke(a){var b="string"==typeof a?a:a.id;return!(b in Sg)||"line"===Sg[b]||"spline"===Sg[b]||"area"===Sg[b]||"area-spline"===Sg[b]}function le(a){var b="string"==typeof a?a:a.id;return"spline"===Sg[b]||"area-spline"===Sg[b]}function me(a){var b="string"==typeof a?a:a.id;return"bar"===Sg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"scatter"===Sg[b]}function oe(a){var b="string"==typeof a?a:a.id;return"pie"===Sg[b]}function pe(a){var b="string"==typeof a?a:a.id;return"donut"===Sg[b]}function qe(a){return oe(a)||pe(a)}function re(a){return ke(a)?[a]:[]}function se(a){return qe(a.data)?[a]:[]}function te(a){return me(a)?a.values:[]}function ue(a){return ke(a)||ne(a)?a.values:[]}function ve(a){return me(a)||ke(a)?a.values:[]}function we(a){return pe(a)&&yi||oe(a)&&si}function xe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ye(b){var c;try{c=Lg?Jf.time.format(Lg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Lg)}return c}function ze(a,b){var c=Jf.mouse(a),d=Jf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ee(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Fe(a,b){var c="y"===ab(a.id)?Ag:Bg,d=sh?1:0,e=sh?0:1;return Math.pow(zg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ge(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function He(a,b,c){return d(a[b])?a[b]:c}function Ie(a,b,c){fh(b,a.node()),yj.select("."+g.selectedCircles+pd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Vc(g.selectedCircle,c)}).attr("cx",sh?Zd:Yd).attr("cy",sh?Yd:Zd).attr("stroke",function(){return $i(b)}).attr("r",1.4*Te(b)).transition().duration(100).attr("r",Te)}function Je(a,b,c){gh(b,a.node()),yj.select("."+g.selectedCircles+pd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ke(a,b,c,d){a?Ie(b,c,d):Je(b,c,d)}function Le(a,b){fh(b,a.node()),a.transition().duration(100).style("fill",function(){return Jf.rgb($i(b)).brighter(.75)})}function Me(a,b){gh(b,a.node()),a.transition().duration(100).style("fill",function(){return $i(b)})}function Ne(a,b,c,d){a?Le(b,c,d):Me(b,c,d)}function Oe(a,b,c,d){Ne(a,b,c.data,d)}function Pe(a){return"circle"===a.nodeName?Ke:Jf.select(a).classed(g.bar)?Ne:Oe}function Qe(a){return a.filter(function(a){return b(a.value)})}function Re(a){return hi?"function"==typeof ii?ii(a):ii:0}function Se(a){return ki?li?li:1.75*Re(a):Re(a)}function Te(a){return mi?mi:4*Re(a)}function Ue(a,c){return(c?yj.selectAll("."+g.circles+pd(c)):yj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ve(a,b){Ue(a,b).classed(g.EXPANDED,!0).attr("r",Se)}function We(a){Ue(a).filter(function(){return Jf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Re)}function Xe(a){return yj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function Ye(a){Xe(a).classed(g.EXPANDED,!0)}function Ze(a){Xe(a).classed(g.EXPANDED,!1)}function $e(a,b){var c=cf(a,b);return function(a,b){var d=c(a,b),e=sh?1:0,f=sh?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 _e(a,b){var c=cf(a,!1),d=b?af:bf;return function(a,b){return d(c(a,b),a,this)}}function af(a,b){var c;return sh?(c=me(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function bf(a,b,c){var d=c.getBoundingClientRect();return sh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:me(b)?-3:-6)}function cf(a,b){var c=a.__max__+1,d=ce(Fg,c),e=_d(d,c,a,!!b),f=ae(!!b),g=be(a,!!b),h=b?Z:Y;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return sh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function df(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function ef(b){var c,d,e;if(Cj=Jf.select(Mf),Cj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Cj.html("").classed("c3",!0),Kf.data.xs={},Kf.data.targets=xc(b),Zg&&(Kf.data.targets=Kf.data.targets.filter(Zg)),Yg&&Mc(Yg===!0?Ec(Kf.data.targets):Yg),p(),T(),zg.domain(Jf.extent(bc(Kf.data.targets))),Ag.domain(Zb(Kf.data.targets,"y")),Bg.domain(Zb(Kf.data.targets,"y2")),Cg.domain(zg.domain()),Dg.domain(Ag.domain()),Eg.domain(Bg.domain()),Dj=zg.domain(),rj.scale(Cg),Tf&&vj.scale(zg),wj=Cj.append("svg").on("mouseenter",Wf).on("mouseleave",Xf),xj=wj.append("defs"),xj.append("clipPath").attr("id",Li).append("rect"),xj.append("clipPath").attr("id",Mi).append("rect"),xj.append("clipPath").attr("id",Ni).append("rect"),rf(),yj=wj.append("g").attr("transform",ij.main),zj=wj.append("g").attr("transform",ij.context),Aj=wj.append("g").attr("transform",ij.legend),jh||zj.style("visibility","hidden"),mh||(Aj.style("visibility","hidden"),cj=Ec(Kf.data.targets)),Bj=Jf.select(Mf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Ef(Ec(Kf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=yj.append("g").attr("clip-path",Oi).attr("class",g.grid),bi&&d.append("g").attr("class",g.xgrids),De(di)&&d.append("g").attr("class",g.xgridLines),ji&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),ei&&d.append("g").attr("class",g.ygrids),De(fi)&&d.append("g").attr("class",g.ygridLines),yj.append("g").attr("clip-path",Oi).attr("class",g.regions),yj.append("g").attr("clip-path",Oi).attr("class",g.chart),c=yj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Tf?sh?"ns-resize":"ew-resize":null),yj.select("."+g.chart).append("g").attr("class",g.chartBars),yj.select("."+g.chart).append("g").attr("class",g.chartLines),yj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",ij.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Tb()),yj.select("."+g.chart).append("g").attr("class",g.chartTexts),Tf&&yj.insert("rect",Vf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",cg).attr("height",eg).style("opacity",0).style("cursor",sh?"ns-resize":"ew-resize").call(vj).on("dblclick.zoom",null),Jh&&rj.extent("function"!=typeof Jh?Jh:Jh(bc())),dj.x=yj.append("g").attr("class",g.axisX).attr("clip-path",Pi).attr("transform",ij.x).style("visibility",th?"visible":"hidden"),dj.x.append("text").attr("class",g.axisXLabel).attr("transform",sh?"rotate(-90)":"").style("text-anchor",Cb),dj.y=yj.append("g").attr("class",g.axisY).attr("clip-path",Qi).attr("transform",ij.y).style("visibility",Lh?"visible":"hidden"),dj.y.append("text").attr("class",g.axisYLabel).attr("transform",sh?"":"rotate(-90)").style("text-anchor",Db),dj.y2=yj.append("g").attr("class",g.axisY2).attr("transform",ij.y2).style("visibility",Uh?"visible":"hidden"),dj.y2.append("text").attr("class",g.axisY2Label).attr("transform",sh?"":"rotate(-90)").style("text-anchor",Eb),zj.append("g").attr("clip-path",Oi).attr("class",g.chart),zj.select("."+g.chart).append("g").attr("class",g.chartBars),zj.select("."+g.chart).append("g").attr("class",g.chartLines),zj.append("g").attr("clip-path",Oi).attr("class",g.brush).call(rj).selectAll("rect").attr(sh?"width":"height",sh?dg:fg),dj.subx=zj.append("g").attr("class",g.axisX).attr("transform",ij.subx).attr("clip-path",sh?"":Pi),uf(Kf.data.targets),sh?yj.select("."+g.axisX).style("opacity",0).call(Fg):(yj.select("."+g.axisY).style("opacity",0).call(Gg),yj.select("."+g.axisY2).style("opacity",0).call(Hg)),p(),T(),rf(),o(!1),nf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Ii){if(Ri&&"string"==typeof Ji){for(Ji=ye(Ji),e=0;e0){d=[];for(var f in Ng)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Pd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ne,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function kf(a){je(Kf.data.targets)||$g&&(Ui=a,yj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Vi=!0,hh())}function lf(){je(Kf.data.targets)||$g&&(yj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),yj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Vi=!1,ih())}function mf(a,b){"grid"===b&&a.each(function(){var a=Jf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function nf(a,c){var d,e,f,h,i,j,k,l,m,n,o,p,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,O,P,Q,R,S,T,U,V,W=$d(),X=je(Kf.data.targets),Y=Jc(Kf.data.targets);if(a=a||{},C=He(a,"withY",!0),D=He(a,"withSubchart",!0),E=He(a,"withTransition",!0),H=He(a,"withTransform",!1),I=He(a,"withUpdateXDomain",!1),J=He(a,"withUpdateOrgXDomain",!1),K=He(a,"withLegend",!1),F=He(a,"withTransitionForExit",E),G=He(a,"withTransitionForAxis",E),Q=E?$f:0,R=F?Q:0,S=G?Q:0,c=c||sf(S),K&&mh&&Ef(Ec(Kf.data.targets),a,c),Si&&0===Y.length&&zg.domain([0,dj.x.selectAll(".tick").size()]),Y.length&&(J&&(zg.domain(Jf.extent(bc(Y))),Dj=zg.domain(),Tf&&vj.scale(zg).updateScaleExtent(),Cg.domain(zg.domain()),rj.scale(Cg)),I&&(zg.domain(rj.empty()?Dj:rj.extent()),Tf&&vj.scale(zg).updateScaleExtent()),Dh||!Ch&&!Bh||(T=Lc(Kc(Y),Bh),Fg.tickValues(T),Ig.tickValues(T))),Ag.domain(Zb(Y,"y")),Bg.domain(Zb(Y,"y2")),dj.x.style("opacity",X?0:1),dj.y.style("opacity",X?0:1),dj.y2.style("opacity",X?0:1),dj.subx.style("opacity",X?0:1),c.axisX.call(Fg),c.axisY.call(Gg),c.axisY2.call(Hg),c.axisSubX.call(Ig),Gb(E),I&&Y.length)if(zh&&T){for(U=1;U=0&&Jf.select(this).style("display",b%V?"none":"block")})}else wj.selectAll("."+g.axisX+" .tick text").style("display","block");!sh&&Eh&&hb(dj.x,c.axisX,Eh),L=$e(W),O=_e(W,!0),P=_e(W,!1),Dg.domain(Ag.domain()),Eg.domain(Bg.domain()),Bj.style("display","none"),q(),yj.select("line."+g.xgridFocus).style("visibility","hidden"),bi&&(f=Xd(ci,zg),z=Si?Fg.tickOffset():0,e=sh?{x1:0,x2:cg,y1:function(a){return zg(a)-z},y2:function(a){return zg(a)-z}}:{x1:function(a){return zg(a)+z},x2:function(a){return zg(a)+z},y1:_f.top,y2:eg},d=yj.select("."+g.xgrids).selectAll("."+g.xgrid).data(f),d.enter().append("line").attr("class",g.xgrid),d.attr(e).style("opacity",function(){return+Jf.select(this).attr(sh?"y1":"x1")===(sh?eg:0)?0:1}),d.exit().remove()),De(di)&&(h=yj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(di),i=h.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),i.append("line").style("opacity",0),i.append("text").attr("text-anchor","end").attr("transform",sh?"":"rotate(-90)").attr("dx",sh?0:-_f.top).attr("dy",-5).style("opacity",0),h.select("line").transition().duration(Q).attr("x1",sh?0:Hd).attr("x2",sh?cg:Hd).attr("y1",sh?Hd:_f.top).attr("y2",sh?Hd:eg).style("opacity",1),h.select("text").transition().duration(Q).attr("x",sh?cg:0).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),h.exit().transition().duration(Q).style("opacity",0).remove()),C&&ei&&(j=yj.select("."+g.ygrids).selectAll("."+g.ygrid).data(Ag.ticks(gi)),j.enter().append("line").attr("class",g.ygrid),j.attr("x1",sh?Ag:0).attr("x2",sh?Ag:cg).attr("y1",sh?0:Ag).attr("y2",sh?eg:Ag),j.exit().remove(),mf(j,"grid")),C&&De(fi)&&(k=yj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(fi),l=k.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",sh?"rotate(-90)":"").attr("dx",sh?0:-_f.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(Q).attr("x1",sh?Id:0).attr("x2",sh?Id:cg).attr("y1",sh?0:Id).attr("y2",sh?eg:Id).style("opacity",1),k.select("text").transition().duration(Q).attr("x",sh?0:cg).attr("y",Id).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(Q).style("opacity",0).remove()),s=yj.select("."+g.regions).selectAll("."+g.region).data(Di),s.enter().append("g").attr("class",id).append("rect").style("fill-opacity",0),s.selectAll("rect").transition().duration(Q).attr("x",gc).attr("y",hc).attr("width",ic).attr("height",jc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(Q).style("opacity",0).remove(),p=yj.selectAll("."+g.bars).selectAll("."+g.bar).data(te),p.enter().append("path").attr("class",cd).style("stroke","none").style("fill",$i),p.style("opacity",ud).transition().duration(Q).attr("d",L).style("fill",$i).style("opacity",1),p.exit().transition().duration(R).style("opacity",0).remove(),m=yj.selectAll("."+g.lines).selectAll("."+g.line).data(re),m.enter().append("path").attr("class",$c).style("stroke",$i),m.style("opacity",ud).transition().duration(Q).attr("d",sj).style("stroke",$i).style("opacity",1),m.exit().transition().duration(R).style("opacity",0).remove(),n=yj.selectAll("."+g.areas).selectAll("."+g.area).data(re),n.enter().append("path").attr("class",gd).style("fill",$i).style("opacity",function(){return Ej=+Jf.select(this).style("opacity"),0}),n.style("opacity",0).transition().duration(Q).attr("d",tj).style("fill",$i).style("opacity",Ej),n.exit().transition().duration(R).style("opacity",0).remove(),o=yj.selectAll("."+g.circles).selectAll("."+g.circle).data(ue),o.enter().append("circle").attr("class",ad).attr("r",Re).style("fill",$i),o.style("opacity",ud).transition().duration(Q).style("opacity",wd).style("fill",$i).attr("cx",sh?Zd:Yd).attr("cy",sh?Yd:Zd),o.exit().remove(),t=yj.selectAll("."+g.texts).selectAll("."+g.text).data(ve),t.enter().append("text").attr("class",Wc).attr("text-anchor",function(a){return sh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",$i).style("fill-opacity",0),t.text(function(a){return Fd(a.id)(a.value,a.id)}).style("fill-opacity",vd).transition().duration(Q).attr("x",O).attr("y",P).style("fill",$i).style("fill-opacity",xd),t.exit().transition().duration(R).style("fill-opacity",0).remove(),r=yj.selectAll("."+g.arcs).selectAll("."+g.arc).data(se),r.enter().append("path").attr("class",ed).style("fill",function(a){return $i(a.data)}).style("cursor",function(a){return ah(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Yi||(c=Hb(a),d=Nb(c),e=Vb(),Pb(c.data.id),Af(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Hb(a),c=Nb(b),d=[c];Td(d,Jf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Yi||(c=Hb(a),d=Nb(c),e=Wb(),Qb(c.data.id),Bf(),Ud(),e(d,b))}).on("click",function(a,b){var c=Hb(a),d=Nb(c),e=Ub();hf(this,a,b),e(d,b)}),r.attr("transform",H?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Yi=!0}).transition().duration(Q).attrTween("d",function(a){var b,c=Hb(a);return c?(b=Jf.interpolate(this._current,c),this._current=b(0),function(a){return Kb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",H?"scale(1)":"").style("fill",function(a){return $i(a.data)}).style("opacity",1).call(Ge,function(){Yi=!1}),r.exit().transition().duration(R).style("opacity",0).remove(),yj.selectAll("."+g.chartArc).select("text").attr("transform",Lb).style("opacity",0).transition().duration(Q).text(Ob).style("opacity",function(a){return Hc(a.data.id)&&qe(a.data)?1:0}),yj.select("."+g.chartArcsTitle).style("opacity",ie(Kf.data.targets)?1:0),jh&&(Jf.event&&"zoom"===Jf.event.type&&rj.extent(zg.orgDomain()).update(),D&&(!sh&&Eh&&hb(dj.subx,c.axisSubX,Eh),rj.empty()||rj.extent(zg.orgDomain()).update(),M=$e(W,!0),v=zj.selectAll("."+g.bars).selectAll("."+g.bar).data(te),v.enter().append("path").attr("class",cd).style("stroke","none").style("fill",$i),v.style("opacity",ud).transition().duration(Q).attr("d",M).style("opacity",1),v.exit().transition().duration(Q).style("opacity",0).remove(),u=zj.selectAll("."+g.lines).selectAll("."+g.line).data(re),u.enter().append("path").attr("class",$c).style("stroke",$i),u.style("opacity",ud).transition().duration(Q).attr("d",uj).style("opacity",1),u.exit().transition().duration(Q).style("opacity",0).remove())),yj.selectAll("."+g.selectedCircles).filter(function(a){return me(a)}).selectAll("circle").remove(),yj.selectAll("."+g.selectedCircle).transition().duration(Q).attr("cx",sh?Zd:Yd).attr("cy",sh?Yd:Zd),w=yj.select("."+g.eventRects),De(Kg)&&!qc(Kg)?(w.classed(g.eventRectsMultiple)||w.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),x=yj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),gf(x.enter()),x.attr("x",0).attr("y",0).attr("width",cg).attr("height",eg)):(w.classed(g.eventRectsSingle)||w.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Ti&&!Si?(B=function(a,b){var c=zc(b),d=Ac(b),e=Kf.data.xs[a.id][b];return(zg(d?d:e+50)-zg(c?c:e-50))/2},A=function(a,b){var c=zc(b),d=Kf.data.xs[a.id][b];return(zg(d)+zg(c?c:d-50))/2}):(B=N(),A=function(a){return zg(a.x)-B/2}),y=Cc(Kf.data.targets),yj.select("."+g.eventRects).datum(y?y.values:[]),x=yj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),ff(x.enter()),x.attr("class",jd).attr("x",sh?0:A).attr("y",sh?A:0).attr("width",sh?cg:B).attr("height",sh?B:eg),x.exit().remove()),Ec(Kf.data.targets).forEach(function(a){Fj[a]=!0})}function of(){nf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function pf(){if(0!==Jc(Kf.data.targets).length){if("mousemove"===Jf.event.sourceEvent.type&&vj.altDomain)return zg.domain(vj.altDomain),void vj.scale(zg).updateScaleExtent();Si&&zg.orgDomain()[0]===Dj[0]&&zg.domain([Dj[0]-1e-10,zg.orgDomain()[1]]),nf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Jf.event.sourceEvent.type&&(Wi=!0)}}function qf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function rf(){wj.attr("width",gg).attr("height",hg),wj.select("#"+Li).select("rect").attr("width",cg).attr("height",eg),wj.select("#"+Mi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),wj.select("#"+Ni).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),wj.select("."+g.zoomRect).attr("width",cg).attr("height",eg),Cj.style("max-height",hg+"px")}function sf(a){return{axisX:a?dj.x.transition().duration(a):dj.x,axisY:a?dj.y.transition().duration(a):dj.y,axisY2:a?dj.y2.transition().duration(a):dj.y2,axisSubX:a?dj.subx.transition().duration(a):dj.subx}}function tf(a){var b;a=a||{},a.withTransition=He(a,"withTransition",!0),a.withTransform=He(a,"withTransform",!1),a.withLegend=He(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withLegend&&mh||(b=sf(a.withTransitionForAxis?$f:0),p(),T(),rf(),o(a.withTransition,b)),nf(a,b)}function uf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=yj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",ld),j=i.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Xc),e=yj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",nd),d=e.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",dd).style("cursor",function(a){return ah(a)?"pointer":null}),c=yj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",md),b=c.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",_c),b.append("g").attr("class",hd),b.append("g").attr("class",function(a){return Vc(g.selectedCircles,a.id)}),b.append("g").attr("class",bd).style("cursor",function(a){return ah(a)?"pointer":null}),a.forEach(function(a){yj.selectAll("."+g.selectedCircles+pd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=yj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(qg(a)).attr("class",od),f=h.enter().append("g").attr("class",od),f.append("g").attr("class",fd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),jh&&(n=zj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",nd),m=n.enter().append("g").style("opacity",0).attr("class",nd),m.append("g").attr("class",dd),l=zj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",md),k=l.enter().append("g").style("opacity",0).attr("class",md),k.append("g").attr("class",_c)),wj.selectAll("."+g.target).filter(function(a){return Hc(a.id)}).transition().duration($f).style("opacity",1)}function vf(a,b){b.filter&&(a=a.filter(b.filter)),(b.type||b.types)&&a.forEach(function(a){b.types?de(a.id,b.types[a.id]):de(a.id,b.type)}),Kf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,z=0,F++)),E[a]=F,D[F]=f,A[a]=z,z+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+v)/10),j=10*Math.ceil((h.height+u)/10),k=jj?j:i,l=jj?S():R();return d&&(z=0,F=0,w=0,x=0),mh&&!Ic(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=i,C[c]=j,(!w||i>=w)&&(w=i),(!x||j>=x)&&(x=j),g=jj?x:w,void(rh?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(l-g*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=26,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=Aj.selectAll("."+g.legendItemFocused).size();b=b||{},n=He(b,"withTransition",!0),q=He(b,"withTransitionForTransform",!0),jj?(f=function(a){return w*E[a]},j=function(a){return D[E[a]]+A[a]}):(f=function(a){return D[E[a]]+A[a]},j=function(a){return x*E[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=Aj.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Vc(g.legendItem,a)}).style("visibility",function(a){return Ic(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof oh?oh(a):Kf.toggle(a)}).on("mouseover",function(a){Jf.select(this).classed(g.legendItemFocused,!0),Yi||Kf.focus(a),"function"==typeof ph&&ph(a)}).on("mouseout",function(a){Jf.select(this).classed(g.legendItemFocused,!1),Yi||Kf.revert(),"function"==typeof qh&&qh(a)}),m.append("text").text(function(a){return d(Ng[a])?Ng[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",jj?h:-200).attr("y",jj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",jj?i:-200).attr("y",jj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",$i).attr("x",jj?h:-200).attr("y",jj?-200:j).attr("width",10).attr("height",10),r=Aj.selectAll("text").data(a).text(function(a){return d(Ng[a])?Ng[a]:a}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=Aj.selectAll("rect."+g.legendItemEvent).data(a),(n?s.transition():s).attr("width",function(a){return B[a]}).attr("height",function(a){return C[a]}).attr("x",i).attr("y",l),t=Aj.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",$i).attr("x",f).attr("y",j),Aj.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Hc(a)}).transition().style("opacity",function(a){var b=Jf.select(this);return Hc(a)?!G||b.classed(g.legendItemFocused)?yf(b):zf(b):nj}),P(w),Q(x),O(F),p(),T(),rf(),o(q,c)}function Ff(a){return Gc(Kf.data.targets,a.id)}function Gf(a){return"data"in a&&Gc(Kf.data.targets,a.data.id)}function Hf(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 If(a,b,c){var d=!je(Kf.data.targets);Yi=!1,de(a,b),tf(c||{withTransitionForAxis:d})}var Jf=a.d3?a.d3:a.require?a.require("d3"):void 0,Kf={data:{},axis:{},legend:{}},Lf={},Mf=i(["bindto"],"#chart"),Nf=i(["size","width"]),Of=i(["size","height"]),Pf=i(["padding","left"],50),Qf=i(["padding","right"],10),Rf=i(["padding","top"],0),Sf=i(["padding","bottom"],0),Tf=i(["zoom","enabled"],!1),Uf=i(["zoom","extent"]),Vf=i(["zoom","privileged"],!1),Wf=i(["onenter"],function(){}),Xf=i(["onleave"],function(){}),Yf=i(["onresize"],function(){}),Zf=i(["onresized"],function(){}),$f=i(["transition","duration"],350);h("data","data is required in config");var _f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg=i(["data","x"]),Kg=i(["data","xs"],{}),Lg=i(["data","x_format"]),Mg=i(["data","id_converter"],function(a){return a}),Ng=i(["data","names"],{}),Og=i(["data","classes"],{}),Pg=i(["data","groups"],[]),Qg=i(["data","axes"],{}),Rg=i(["data","type"]),Sg=i(["data","types"],{}),Tg=i(["data","labels"],{}),Ug=i(["data","order"]),Vg=i(["data","regions"],{}),Wg=i(["data","color"]),Xg=i(["data","colors"],{}),Yg=i(["data","hide"],!1),Zg=i(["data","filter"]),$g=i(["data","selection","enabled"],!1),_g=i(["data","selection","grouped"],!1),ah=i(["data","selection","isselectable"],function(){return!0}),bh=i(["data","selection","multiple"],!0),ch=i(["data","onclick"],function(){}),dh=i(["data","onenter"],function(){}),eh=i(["data","onleave"],function(){}),fh=i(["data","onselected"],function(){}),gh=i(["data","onunselected"],function(){}),hh=i(["data","ondragstart"],function(){}),ih=i(["data","ondragend"],function(){}),jh=i(["subchart","show"],!1),kh=i(["subchart","size","height"],60),lh=i(["color","pattern"],[]),mh=i(["legend","show"],!0),nh=i(["legend","position"],"bottom"),oh=i(["legend","item","onclick"]),ph=i(["legend","item","onmouseover"]),qh=i(["legend","item","onmouseout"]),rh=i(["legend","equally"],!1),sh=i(["axis","rotated"],!1),th=i(["axis","x","show"],!0),uh=i(["axis","x","type"],"indexed"),vh=i(["axis","x","localtime"],!0),wh=i(["axis","x","categories"],[]),xh=i(["axis","x","tick","centered"],!1),yh=i(["axis","x","tick","format"]),zh=i(["axis","x","tick","culling"],{}),Ah=i(["axis","x","tick","culling","max"],10),Bh=i(["axis","x","tick","count"]),Ch=i(["axis","x","tick","fit"],!0),Dh=i(["axis","x","tick","values"],null),Eh=i(["axis","x","tick","rotate"]),Fh=i(["axis","x","max"],null),Gh=i(["axis","x","min"],null),Hh=i(["axis","x","padding"],{}),Ih=i(["axis","x","height"]),Jh=i(["axis","x","default"]),Kh=i(["axis","x","label"],{}),Lh=i(["axis","y","show"],!0),Mh=i(["axis","y","max"]),Nh=i(["axis","y","min"]),Oh=i(["axis","y","center"]),Ph=i(["axis","y","label"],{}),Qh=i(["axis","y","inner"],!1),Rh=i(["axis","y","tick","format"]),Sh=i(["axis","y","padding"]),Th=i(["axis","y","ticks"],10),Uh=i(["axis","y2","show"],!1),Vh=i(["axis","y2","max"]),Wh=i(["axis","y2","min"]),Xh=i(["axis","y2","center"]),Yh=i(["axis","y2","label"],{}),Zh=i(["axis","y2","inner"],!1),$h=i(["axis","y2","tick","format"]),_h=i(["axis","y2","padding"]),ai=i(["axis","y2","ticks"],10),bi=i(["grid","x","show"],!1),ci=i(["grid","x","type"],"tick"),di=i(["grid","x","lines"],[]),ei=i(["grid","y","show"],!1),fi=i(["grid","y","lines"],[]),gi=i(["grid","y","ticks"],10),hi=i(["point","show"],!0),ii=i(["point","r"],2.5),ji=i(["point","focus","line","enabled"],!0),ki=i(["point","focus","expand","enabled"],!0),li=i(["point","focus","expand","r"]),mi=i(["point","focus","select","r"]),ni=i(["line","connect_null"],!1),oi=i(["bar","width"]),pi=i(["bar","width","ratio"],.6),qi=i(["pie","label","show"],!0),ri=i(["pie","label","format"]),si=i(["pie","expand"],!0),ti=i(["pie","onclick"],function(){}),ui=i(["pie","onmouseover"],function(){}),vi=i(["pie","onmouseout"],function(){}),wi=i(["donut","label","show"],!0),xi=i(["donut","label","format"]),yi=i(["donut","expand"],!0),zi=i(["donut","title"],""),Ai=i(["donut","onclick"],function(){}),Bi=i(["donut","onmouseover"],function(){}),Ci=i(["donut","onmouseout"],function(){}),Di=i(["regions"],[]),Ei=i(["tooltip","show"],!0),Fi=i(["tooltip","format","title"]),Gi=i(["tooltip","format","value"]),Hi=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Fi?Fi:b,l=Gi?Gi:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Ii=i(["tooltip","init","show"],!1),Ji=i(["tooltip","init","x"],0),Ki=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Li=("string"==typeof Mf?Mf.replace("#",""):Mf.id)+"-clip",Mi=Li+"-xaxis",Ni=Li+"-yaxis",Oi=j(Li),Pi=j(Mi),Qi=j(Ni),Ri="timeseries"===uh,Si="categorized"===uh,Ti=!Ri&&(Jg||De(Kg)),Ui=null,Vi=!1,Wi=!1,Xi=!1,Yi=!1,Zi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],$i=xe(Xg,De(lh)?lh:Zi,Wg),_i=vh?Jf.time.format:Jf.time.format.utc,aj=_i.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),bj=[],cj=[],dj={},ej=sh?"left":"bottom",fj=sh?Qh?"top":"bottom":Qh?"right":"left",gj=sh?Zh?"bottom":"top":Zh?"left":"right",hj=sh?"left":"bottom",ij={main:function(){return"translate("+k(_f.left)+","+k(_f.top)+")"},context:function(){return"translate("+k(ag.left)+","+k(ag.top)+")"},legend:function(){return"translate("+bg.left+","+bg.top+")"},x:function(){return"translate(0,"+(sh?0:eg)+")"},y:function(){return"translate(0,"+(sh?eg:0)+")"},y2:function(){return"translate("+(sh?0:cg)+","+(sh?1:0)+")" -},subx:function(){return"translate(0,"+(sh?0:fg)+")"},arc:function(){return"translate("+lg/2+","+mg/2+")"}},jj="right"===nh,kj=0,lj=0,mj=0,nj=.15,oj=30,pj=sh&&!th?0:30,qj=5;qg=Jf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var rj,sj=function(){var a=Jf.svg.line().x(sh?function(a){return Y(a.id)(a.value)}:Gd).y(sh?Gd:function(a){return Y(a.id)(a.value)});return ni||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ni?Qe(b.values):b.values;return ke(b)?(a.interpolate(le(b)?"cardinal":"linear"),Vg[b.id]?df(e,zg,Y(b.id),Vg[b.id]):a(e)):(c=e[0]?zg(e[0].x):0,d=e[0]?Y(b.id)(e[0].value):0,sh?"M "+d+" "+c:"M "+c+" "+d)}}(),tj=function(){var a;return a=sh?Jf.svg.area().x0(function(a){return Y(a.id)(0)}).x1(function(a){return Y(a.id)(a.value)}).y(Gd):Jf.svg.area().x(Gd).y0(function(a){return Y(a.id)(0)}).y1(function(a){return Y(a.id)(a.value)}),function(b){var c,d,e=Qe(b.values);return ee([b],"area")||ee([b],"area-spline")?(a.interpolate(le(b)?"cardinal":"linear"),a(e)):(c=e[0]?zg(e[0].x):0,d=e[0]?Y(b.id)(e[0].value):0,sh?"M "+d+" "+c:"M "+c+" "+d)}}(),uj=function(){var a=Jf.svg.line().x(sh?function(a){return Z(a.id)(a.value)}:Jd).y(sh?Jd:function(a){return Z(a.id)(a.value)});return function(b){var c=Qe(b.values);return ke(b)?a(c):"M "+Cg(c[0].x)+" "+Z(b.id)(c[0].value)}}(),vj=function(){};rj=Jf.svg.brush().on("brush",of),rj.update=function(){return zj&&zj.select("."+g.brush).call(this),this},rj.scale=function(a){return sh?this.y(a):this.x(a)},Tf&&(vj=Jf.behavior.zoom().on("zoomstart",function(){vj.altDomain=Jf.event.sourceEvent.altKey?zg.orgDomain():null}).on("zoom",Tf?pf:null),vj.scale=function(a){return sh?this.y(a):this.x(a)},vj.orgScaleExtent=function(){var a=Uf?Uf:[1,10];return[a[0],Math.max(Bc()/a[1],a[1])]},vj.updateScaleExtent=function(){var a=cc(zg.orgDomain())/cc(Dj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var wj,xj,yj,zj,Aj,Bj,Cj,Dj,Ej,Fj={};if(Kf.focus=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",1)}var c=wj.selectAll(qd(a)),d=c.filter(Ff),e=c.filter(Gf);Kf.revert(),Kf.defocus(),b(d.classed(g.focused,!0)),b(e),je(Kf.data.targets)&&Pb(a,!0),Af(a,!0)},Kf.defocus=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",.3)}var c=wj.selectAll(qd(a)),d=c.filter(Ff),e=c.filter(Gf);Kf.revert(),b(d.classed(g.focused,!1)),b(e),je(Kf.data.targets)&&Qb(a),Af(a,!1)},Kf.revert=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",1)}var c=wj.selectAll(qd(a)),d=c.filter(Ff),e=c.filter(Gf);b(d.classed(g.focused,!1)),b(e),je(Kf.data.targets)&&Qb(a),Bf()},Kf.show=function(a,b){a=Fc(a),b=b||{},Nc(a),wj.selectAll(rd(a)).transition().style("opacity",1),b.withLegend&&Cf(a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Kf.hide=function(a,b){a=Fc(a),b=b||{},Mc(a),wj.selectAll(rd(a)).transition().style("opacity",0),b.withLegend&&Df(a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Kf.toggle=function(a){Hc(a)?Kf.hide(a):Kf.show(a)},Kf.unzoom=function(){rj.clear().update(),nf({withUpdateXDomain:!0})},Kf.load=function(a){return a.xs&&pc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Og[b]=a.classes[b]}),"categories"in a&&Si&&(wh=a.categories,Fg.categories(wh)),"cacheIds"in a&&dc(a.cacheIds)?void vf(fc(a.cacheIds),a.done):void("unload"in a?xf(Fc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){wf(a)}):wf(a))},Kf.unload=function(a,b){xf(Fc(a),function(){nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Kf.selected=function(a){return Jf.merge(yj.selectAll("."+g.shapes+pd(a)).selectAll("."+g.shape).filter(function(){return Jf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Kf.select=function(a,b,c){$g&&yj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Jf.select(this),i=e.data?e.data.id:e.id,j=Pe(this),k=_g||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);"path"!==this.nodeName&&(k&&l?ah(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},Kf.unselect=function(a,b){$g&&yj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Jf.select(this),f=c.data?c.data.id:c.id,h=Pe(this),i=_g||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);"path"!==this.nodeName&&i&&j&&ah(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Kf.toLine=function(a){If(a,"line")},Kf.toSpline=function(a){If(a,"spline")},Kf.toBar=function(a){If(a,"bar")},Kf.toScatter=function(a){If(a,"scatter")},Kf.toArea=function(a){If(a,"area")},Kf.toAreaSpline=function(a){If(a,"area-spline")},Kf.toPie=function(a){If(a,"pie",{withTransform:!0})},Kf.toDonut=function(a){If(a,"donut",{withTransform:!0})},Kf.groups=function(a){return c(a)?Pg:(Pg=a,nf(),Pg)},Kf.xgrids=function(a){return a?(di=a,nf(),di):di},Kf.xgrids.add=function(a){return a?Kf.xgrids(di.concat(a)):void 0},Kf.xgrids.remove=function(a){var b=Hf(a);return Kf.xgrids(di.filter(b))},Kf.ygrids=function(a){return a?(fi=a,nf(),fi):fi},Kf.ygrids.add=function(a){return a?Kf.ygrids(fi.concat(a)):void 0},Kf.ygrids.remove=function(a){var b=Hf(a);return Kf.ygrids(fi.filter(b))},Kf.regions=function(a){return a?(Di=a,nf(),Di):Di},Kf.regions.add=function(a){return a?(Di=Di.concat(a),nf(),Di):Di},Kf.regions.remove=function(a){var b,c,d;return a=a||{},b=He(a,"duration",$f),c=He(a,"classes",[g.region]),d=yj.select("."+g.regions).selectAll(c.map(function(a){return"."+a})),(b?d.transition().duration(b):d).style("opacity",0).remove(),Di=Di.filter(function(a){return c.indexOf(a.class)<0})},Kf.data.get=function(a){var b=Kf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Kf.data.getAsTarget=function(a){var b=Kf.data.targets.filter(function(b){return b.id===a});return b.length>0?b[0]:void 0},Kf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Ng[b]=a[b]}),nf({withLegend:!0}),Ng):Ng},Kf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Xg[b]=a[b]}),nf({withLegend:!0}),Xg):Xg},Kf.x=function(a){return arguments.length&&(sc(Kf.data.targets,a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Kf.data.xs},Kf.xs=function(a){return arguments.length&&(tc(Kf.data.targets,a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Kf.data.xs},Kf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){eb(b,a[b])}),Gb())},Kf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Fh=+a.x),b(a.y)&&(Mh=+a.y),b(a.y2)&&(Vh=+a.y2)):Mh=Vh=+a,nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Kf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Gh=+a.x),b(a.y)&&(Nh=+a.y),b(a.y2)&&(Wh=+a.y2)):Nh=Wh=+a,nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Kf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Kf.axis.max(a.max),"undefined"!=typeof a.min&&Kf.axis.min(a.min))},Kf.legend.show=function(a){Cf(Fc(a)),nf({withLegend:!0})},Kf.legend.hide=function(a){Df(Fc(a)),nf({withLegend:!0})},Kf.resize=function(a){Nf=a?a.width:null,Of=a?a.height:null,tf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Kf.destroy=function(){Kf.data.targets=void 0,Kf.data.xs={},Cj.html(""),a.onresize=null},"url"in f.data)Jf.xhr(f.data.url,function(a,b){var c,d=Jf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Jf.csv.parse(b.response),ef(c)});else if("rows"in f.data)ef(vc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");ef(wc(f.data.columns))}return Kf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(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}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.ceil(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.ceil(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&adg&&(dg=0),0>fg&&(fg=0),eg=th?ag.left-pj-qj:dg,gg=th?fg:ig-bg.top-bg.bottom,0>eg&&(eg=0),0>gg&&(gg=0),mg=dg-(kj?b+10:0),ng=fg-(kj?0:10),r(),kj&&d&&(cg.left=mg/2+1.1*kg)}function q(){zj.select("line."+g.xgridFocus).attr("x1",th?0:-10).attr("x2",th?dg:-10).attr("y1",th?-10:ag.top).attr("y2",th?-10:fg)}function r(){kg=Math.min(mg,ng)/2,jg=.95*kg,lg=ie(Kf.data.targets)?.6*jg:0}function s(){var a=th?g.axisX:g.axisY,b=zj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Jf.select(Mf).node().getBoundingClientRect(),e=je(Kf.data.targets),f=c.right-d.left-(e?0:v());return f>0?f:0}function t(){return Nf?Nf:z()}function u(){var a=Of?Of:A();return a>0?a:320}function v(){var a=1;return Pf?Pf:th?uh?x("x"):a:!Mh||Rh?a:x("y")}function w(){var a=1;return Qf?Qf:kj?R()+20+(Vh&&!th?x("y2"):a):Vh?$h||th?a:x("y2"):a}function x(a){var b=mb(a);return b.isInner?20+Fb(a):40+Fb(a)}function y(a){return"x"!==a||uh?"x"===a&&Jh?Jh:"y"!==a||Mh?"y2"!==a||Vh?(mb(a).isInner?30:40)+("y2"===a?-10:0):rj:nh&&!kj?10:1:0}function z(){return+Jf.select(Mf).style("width").replace("px","")}function A(){return+Jf.select(Mf).style("height").replace("px","")}function B(a){return a?-31:-(ag.left-1)}function C(a){return a?-20:-4}function D(){return B(!th)}function E(){return C(!th)}function F(){return B(th)}function G(){return C(th)}function H(a){return a?dg+2+30+30:ag.left+20}function I(a){return a?(Jh?Jh:0)+80:fg+8}function J(){return H(!th)}function K(){return I(!th)}function L(){return H(th)}function M(){return I(th)}function N(){var a,b,c,d,e,f=Cc(Kf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=Ag(b.x)-Ag(a.x),0===c?th?fg:dg:(d=Bc(),e=fe(Kf.data.targets)?(d-(Ti?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function O(a){lj=a}function P(a){mj=a}function Q(a){nj=a}function R(){return nh?kj?mj*(lj+1):hg:0}function S(){return nh?kj?ig:nj*(lj+1):0}function T(){var a,b,c=!Ag;sg=th?1:0,tg=th?fg:dg,ug=th?0:fg,vg=th?dg:1,wg=sg,xg=tg,yg=th?0:gg,zg=th?eg:1,Ag=W(sg,tg,c?void 0:Ag.domain(),function(){return Gg.tickOffset()}),Bg=X(ug,vg,c?void 0:Bg.domain()),Cg=X(ug,vg,c?void 0:Cg.domain()),Dg=W(sg,tg,Ej,function(a){return a%1?0:Jg.tickOffset()}),Eg=X(yg,zg,c?void 0:Eg.domain()),Fg=X(yg,zg,c?void 0:Fg.domain()),a=bb(),b=Eh?Eh:c?void 0:Gg.tickValues(),Gg=$(Ag,fj,a,b),Jg=$(Dg,ij,a,b),Hg=_(Bg,gj,Sh,Uh),Ig=_(Cg,hj,_h,bi),c||(sj.scale(Dg),Tf&&wj.scale(Ag)),U()}function U(){og=Ib(),pg=Jb(),qg=Jb(.98)}function V(a,b,c){return(c?Jf.time.scale():Jf.scale.linear()).range([a,b])}function W(a,b,c,d){var e,f=V(a,b,Si),g=c?f.domain(c):f;Ti?(d=d||function(){return 0},f=function(a,b){var c=g(a)+d(a);return b?c:Math.ceil(c)}):f=function(a,b){var c=g(a);return b?c:Math.ceil(c)};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return Ej&&Ej[0]===a[0]&&Ej[1]a?a.toFixed(0):a};return zh&&("function"==typeof zh?a=zh:Si&&(a=function(a){return a?aj(zh)(a):""})),a}function cb(a){var b;return"y"===a?b=Qh:"y2"===a?b=Zh:"x"===a&&(b=Lh),b}function db(a){var b=cb(a);return"string"==typeof b?b:b?b.text:null}function eb(a,b){var c=cb(a);"string"==typeof c?"y"===a?Qh=b:"y2"===a?Zh=b:"x"===a&&(Lh=b):c&&(c.text=b)}function fb(a){return 10*Math.sin(Math.PI*(a/180))}function gb(a){return 11.5-2.5*(a/15)}function hb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",gb(c)).attr("x",fb(c)).attr("transform","rotate("+c+")")}function ib(a,b){var c=cb(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 jb(){return ib("x",th?"inner-top":"inner-right")}function kb(){return ib("y",th?"inner-right":"inner-top")}function lb(){return ib("y2",th?"inner-right":"inner-top")}function mb(a){return"y2"===a?lb():"y"===a?kb():jb()}function nb(){return db("x")}function ob(){return db("y")}function pb(){return db("y2")}function qb(a,b){return a?b.isLeft?0:b.isCenter?dg/2:dg:b.isBottom?-fg:b.isMiddle?-fg/2:0}function rb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function sb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function tb(){return qb(!th,jb())}function ub(){return qb(th,kb())}function vb(){return qb(th,lb())}function wb(){return rb(!th,jb())}function xb(){return rb(th,kb())}function yb(){return rb(th,lb())}function zb(){var a=jb();return th?a.isInner?"1.2em":-25-Fb("x"):a.isInner?"-0.5em":Jh?Jh-10:"3em"}function Ab(){var a=kb();return th?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Fb("y")}function Bb(){var a=lb();return th?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Fb("y2")}function Cb(){return sb(!th,jb())}function Db(){return sb(th,kb())}function Eb(){return sb(th,lb())}function Fb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Jf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Gb(a){var b=zj.select("."+g.axisX+" ."+g.axisXLabel),c=zj.select("."+g.axisY+" ."+g.axisYLabel),d=zj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",tb).attr("dx",wb).attr("dy",zb).text(nb),(a?c.transition():c).attr("x",ub).attr("dx",xb).attr("dy",Ab).attr("dy",Ab).text(ob),(a?d.transition():d).attr("x",vb).attr("dx",yb).attr("dy",Bb).text(pb)}function Hb(a){var b=!1;return rg(Jc(Kf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Ib(){var a=Jf.svg.arc().outerRadius(jg).innerRadius(lg),b=function(b,c){var d;return c?a(b):(d=Hb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Jb(a){var b=Jf.svg.arc().outerRadius(kg*(a?a:1)).innerRadius(lg);return function(a){var c=Hb(a);return c?b(c):"M 0 0"}}function Kb(a,b){return qe(a.data)?og(a,b):"M 0 0"}function Lb(a){var b,c,d,e,f=Hb(a),g="";return f&&(b=og.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*jg*.8+","+d/e*jg*.8+")"),g}function Mb(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Nb(a){return rc({id:a.data.id,value:a.value,ratio:Mb(a)})}function Ob(a){var b,c,d,e;return Rb()?(b=Hb(a),c=b?b.value:null,d=Mb(b),e=Sb(),e?e(c,d):Ed(c,d)):""}function Pb(a,b){var c=xj.selectAll("."+g.chartArc+qd(a)),d=xj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});we(a)&&c.selectAll("path").transition().duration(50).attr("d",pg).transition().duration(100).attr("d",qg).each(function(a){pe(a.data)}),b||d.style("opacity",.3)}function Qb(a){var b=xj.selectAll("."+g.chartArc+qd(a));b.selectAll("path").transition().duration(50).attr("d",og),xj.selectAll("."+g.arc).style("opacity",1)}function Rb(){return ie(Kf.data.targets)?xi:ri}function Sb(){return ie(Kf.data.targets)?yi:si}function Tb(){return ie(Kf.data.targets)?Ai:""}function Ub(){var a=ie(Kf.data.targets)?Bi:ui;return"function"==typeof a?a:function(){}}function Vb(){var a=ie(Kf.data.targets)?Ci:vi;return"function"==typeof a?a:function(){}}function Wb(){var a=ie(Kf.data.targets)?Di:wi;return"function"==typeof a?a:function(){}}function Xb(a){var b,c,d,e,f,g,h=Ec(a),i=Qc(a);if(Qg.length>0)for(g=Sc(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 Jf.min(Object.keys(i).map(function(a){return Jf.min(i[a])}))}function Yb(a){var b,c,d,e,f,g,h=Ec(a),i=Qc(a);if(Qg.length>0)for(g=Tc(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 Jf.max(Object.keys(i).map(function(a){return Jf.max(i[a])}))}function Zb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return ab(a.id)===c}),m="y2"===c?Xh:Oh,n="y2"===c?Wh:Nh,o=b(m)?m:Xb(l),p=b(n)?n:Yb(l),q="y2"===c?Yh:Ph,r=yd()&&th;return 0===l.length?"y2"===c?Cg.domain():Bg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=zd(o,p),j=cc(Bg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Th&&(f=b(Th.top)?Th.top:e,g=b(Th.bottom)?Th.bottom:e),"y2"===c&&ai&&(f=b(ai.top)?ai.top:e,g=b(ai.bottom)?ai.bottom:e),fe(l)&&!Sc(l)&&(g=o),[o-g,p+f])}function $b(a){return Hh?Si?ye(Hh):Hh:Jf.min(a,function(a){return Jf.min(a.values,function(a){return a.x})})}function _b(a){return Gh?Si?ye(Gh):Gh:Jf.max(a,function(a){return Jf.max(a.values,function(a){return a.x})})}function ac(a){var c,d,e,f,g=Dc(a),h=g[1]-g[0];return Ti?d=0:fe(a)?(c=Bc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Ih&&De(Ih)?(e=b(Ih.left)?Ih.left:d,f=b(Ih.right)?Ih.right:d):e=f="number"==typeof Ih?Ih:d,{left:e,right:f}}function bc(a){var b=[$b(a),_b(a)],c=b[0],d=b[1],e=ac(a),f=0,g=0;return c-d!==0||Ti||(c=Si?new Date(.5*c.getTime()):-.5,d=Si?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Si?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Si?new Date(d.getTime()+e.right):d+e.right),[f,g]}function cc(a){return a[1]-a[0]}function dc(a){for(var b=0;bb?0:b-c}function jc(a){var b,c=hc(a),d="y"===a.axis?Bg:Cg;return b="y"===a.axis||"y2"===a.axis?th?fg:"start"in a?d(a.start):fg:th?"end"in a?Ag(Si?ye(a.end):a.end):fg:fg,c>b?0:b-c}function kc(a){return Kg&&a===Kg||De(Lg)&&Ee(Lg,a)}function lc(a){return!kc(a)}function mc(a){return Kg?Kg:De(Lg)?Lg[a]:null}function nc(a,b){var c,d=b&&De(b)?Ec(b):[];return d.forEach(function(b){mc(b)===a&&(c=Kf.data.xs[b])}),c}function oc(a,b){return a in Kf.data.xs&&Kf.data.xs[a]&&Kf.data.xs[a][b]?Kf.data.xs[a][b]:b}function pc(a){Object.keys(a).forEach(function(b){Lg[b]=a[b]})}function qc(a){return 1===Jf.set(Object.keys(a).map(function(b){return a[b]})).size()}function rc(a){var b;return a&&(b=Og[a.id],a.name=b?b:a.id),a}function sc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=uc(b[d],a.id,d)}),Kf.data.xs[a.id]=b})}function tc(a,b){a.forEach(function(a){b[a.id]&&sc([a],b[a.id])})}function uc(a,c,d){var e;return e=Si?a?a instanceof Date?a:ye(a):ye(oc(c,d)):Ui&&!Ti?b(a)?+a:oc(c,d):d}function vc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Kf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Kg?(d=Object.keys(Kf.data.xs),Kf.data.xs[c]=d.length>0?Kf.data.xs[d[0]]:void 0):De(Lg)&&(Kf.data.xs[c]=nc(f,Kf.data.targets)):Kf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Kf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Ng(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=mc(b),g=a[f],h=uc(g,b,e);return Ui&&Ti&&0===c&&g&&(0===e&&(xh=[]),xh.push(g)),("undefined"==typeof a[b]||Kf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Sg&&de(Ec(c).filter(function(a){return!(a in Tg)}),Sg),c.forEach(function(a){ec(a.id_org,a)}),c}function yc(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 zc(a){return a>0&&Kf.data.targets[0].values[a-1]?Kf.data.targets[0].values[a-1].x:void 0}function Ac(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Dc(a){var b,c,d=Cc(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Ec(a){return a.map(function(a){return a.id})}function Fc(a){return a?"string"==typeof a?[a]:a:Ec(Kf.data.targets)}function Gc(a,b){var c,d=Ec(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Si?new Date(i):i);j.push(e)}return Si||(j=j.sort(function(a,b){return a-b})),j}function Mc(a){cj=cj.concat(a)}function Nc(a){cj=cj.filter(function(b){return a.indexOf(b)<0})}function Oc(a){dj=dj.concat(a)}function Pc(a){dj=dj.filter(function(b){return a.indexOf(b)<0})}function Qc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Rc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Tc(a){return Rc(a,function(a){return a>0})}function Uc(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||0===a[f].x)&&(e=e.concat(Kd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Kd(a,g))),Nd(e,b)):Ld(a,b,f,g)}function Md(a,b){var c;return c=a.map(function(a){return Ld(a.values,b)}),Nd(c,b)}function Nd(a,b){var c,d;return a.forEach(function(a){var e=Fe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Od(a,b){return Jf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Pd(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 Qd(){return Vg&&"desc"===Vg.toLowerCase()}function Rd(){return Vg&&"asc"===Vg.toLowerCase()}function Sd(a){var b=Rd(),c=Qd();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 Vg&&a.sort(Vg),a}function Td(a,c){var d,e,f,g,h,i,j,k=je(Kf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&Fi&&(Cj.html(Ii(a,bb(),Ad(k),_i)).style("display","block"),d=Cj.property("offsetWidth"),e=Cj.property("offsetHeight"),k?(g=dg/2+c[0],i=fg/2+c[1]+20):(th?(f=s(),g=f+c[0]+100,h=g+d,j=t()-w(),i=Ag(l[0].x)+20):(f=s(),g=f+v()+Ag(l[0].x)+20,h=g+d,j=f+t()-w(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),Cj.style("top",i+"px").style("left",g+"px"))}function Ud(){Cj.style("display","none")}function Vd(a){var c=a.filter(function(a){return a&&b(a.value)});if(Fi&&!ge(Kf.data.targets)&&!je(Kf.data.targets)){var d=zj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(th?"y1":"x1",Gd).attr(th?"y2":"x2",Gd),mf(d,"grid")}}function Wd(){zj.select("line."+g.xgridFocus).style("visibility","hidden")}function Xd(a,b){var c,d,e,f,h=[],i=zj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=bc(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function Yd(a){return a.x||0===a.x?Ag(a.x):null}function Zd(a){return Y(a.id)(a.value)}function $d(){var a,b,d={},e=0;return Jc(Kf.data.targets.filter(me)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ce(a,b){return"number"==typeof pi?pi:b?2*a.tickOffset()*qi/b:0}function de(a,b){Fc(a).forEach(function(a){Gj[a]=b===Tg[a],Tg[a]=b})}function ee(a,b){var c=!1;return a.forEach(function(a){Tg[a.id]===b&&(c=!0),a.id in Tg||"line"!==b||(c=!0)}),c}function fe(a){return ee(a,"bar")}function ge(a){return ee(a,"scatter")}function he(a){return ee(a,"pie")}function ie(a){return ee(a,"donut")}function je(a){return he(a)||ie(a)}function ke(a){var b="string"==typeof a?a:a.id;return!(b in Tg)||"line"===Tg[b]||"spline"===Tg[b]||"area"===Tg[b]||"area-spline"===Tg[b]}function le(a){var b="string"==typeof a?a:a.id;return"spline"===Tg[b]||"area-spline"===Tg[b]}function me(a){var b="string"==typeof a?a:a.id;return"bar"===Tg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"scatter"===Tg[b]}function oe(a){var b="string"==typeof a?a:a.id;return"pie"===Tg[b]}function pe(a){var b="string"==typeof a?a:a.id;return"donut"===Tg[b]}function qe(a){return oe(a)||pe(a)}function re(a){return ke(a)?[a]:[]}function se(a){return qe(a.data)?[a]:[]}function te(a){return me(a)?a.values:[]}function ue(a){return ke(a)||ne(a)?a.values:[]}function ve(a){return me(a)||ke(a)?a.values:[]}function we(a){return pe(a)&&zi||oe(a)&&ti}function xe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ye(b){var c;try{c=Mg?Jf.time.format(Mg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Mg)}return c}function ze(a,b){var c=Jf.mouse(a),d=Jf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ee(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Fe(a,b){var c="y"===ab(a.id)?Bg:Cg,d=th?1:0,e=th?0:1;return Math.pow(Ag(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ge(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function He(a,b,c){return d(a[b])?a[b]:c}function Ie(a,b,c){gh(b,a.node()),zj.select("."+g.selectedCircles+pd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Vc(g.selectedCircle,c)}).attr("cx",th?Zd:Yd).attr("cy",th?Yd:Zd).attr("stroke",function(){return _i(b)}).attr("r",1.4*Te(b)).transition().duration(100).attr("r",Te)}function Je(a,b,c){hh(b,a.node()),zj.select("."+g.selectedCircles+pd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ke(a,b,c,d){a?Ie(b,c,d):Je(b,c,d)}function Le(a,b){gh(b,a.node()),a.transition().duration(100).style("fill",function(){return Jf.rgb(_i(b)).brighter(.75)})}function Me(a,b){hh(b,a.node()),a.transition().duration(100).style("fill",function(){return _i(b)})}function Ne(a,b,c,d){a?Le(b,c,d):Me(b,c,d)}function Oe(a,b,c,d){Ne(a,b,c.data,d)}function Pe(a){return"circle"===a.nodeName?Ke:Jf.select(a).classed(g.bar)?Ne:Oe}function Qe(a){return a.filter(function(a){return b(a.value)})}function Re(a){return ii?"function"==typeof ji?ji(a):ji:0}function Se(a){return li?mi?mi:1.75*Re(a):Re(a)}function Te(a){return ni?ni:4*Re(a)}function Ue(a,c){return(c?zj.selectAll("."+g.circles+pd(c)):zj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ve(a,b){Ue(a,b).classed(g.EXPANDED,!0).attr("r",Se)}function We(a){Ue(a).filter(function(){return Jf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Re)}function Xe(a){return zj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function Ye(a){Xe(a).classed(g.EXPANDED,!0)}function Ze(a){Xe(a).classed(g.EXPANDED,!1)}function $e(a,b){var c=cf(a,b);return function(a,b){var d=c(a,b),e=th?1:0,f=th?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 _e(a,b){var c=cf(a,!1),d=b?af:bf;return function(a,b){return d(c(a,b),a,this)}}function af(a,b){var c;return th?(c=me(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function bf(a,b,c){var d=c.getBoundingClientRect();return th?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:me(b)?-3:-6)}function cf(a,b){var c=a.__max__+1,d=ce(Gg,c),e=_d(d,c,a,!!b),f=ae(!!b),g=be(a,!!b),h=b?Z:Y;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return th&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function df(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function ef(b){var c,d,e;if(Dj=Jf.select(Mf),Dj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Dj.html("").classed("c3",!0),Kf.data.xs={},Kf.data.targets=xc(b),$g&&(Kf.data.targets=Kf.data.targets.filter($g)),Zg&&Mc(Zg===!0?Ec(Kf.data.targets):Zg),p(),T(),Ag.domain(Jf.extent(bc(Kf.data.targets))),Bg.domain(Zb(Kf.data.targets,"y")),Cg.domain(Zb(Kf.data.targets,"y2")),Dg.domain(Ag.domain()),Eg.domain(Bg.domain()),Fg.domain(Cg.domain()),Ej=Ag.domain(),sj.scale(Dg),Tf&&wj.scale(Ag),xj=Dj.append("svg").on("mouseenter",Xf).on("mouseleave",Yf),yj=xj.append("defs"),yj.append("clipPath").attr("id",Mi).append("rect"),yj.append("clipPath").attr("id",Ni).append("rect"),yj.append("clipPath").attr("id",Oi).append("rect"),rf(),zj=xj.append("g").attr("transform",jj.main),Aj=xj.append("g").attr("transform",jj.context),Bj=xj.append("g").attr("transform",jj.legend),kh||Aj.style("visibility","hidden"),nh||(Bj.style("visibility","hidden"),dj=Ec(Kf.data.targets)),Cj=Jf.select(Mf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Ef(Ec(Kf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=zj.append("g").attr("clip-path",Pi).attr("class",g.grid),ci&&d.append("g").attr("class",g.xgrids),De(ei)&&d.append("g").attr("class",g.xgridLines),ki&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),fi&&d.append("g").attr("class",g.ygrids),De(gi)&&d.append("g").attr("class",g.ygridLines),zj.append("g").attr("clip-path",Pi).attr("class",g.regions),zj.append("g").attr("clip-path",Pi).attr("class",g.chart),c=zj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Tf?th?"ns-resize":"ew-resize":null),zj.select("."+g.chart).append("g").attr("class",g.chartBars),zj.select("."+g.chart).append("g").attr("class",g.chartLines),zj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",jj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Tb()),zj.select("."+g.chart).append("g").attr("class",g.chartTexts),Tf&&zj.insert("rect",Vf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",dg).attr("height",fg).style("opacity",0).style("cursor",th?"ns-resize":"ew-resize").call(wj).on("dblclick.zoom",null),Kh&&sj.extent("function"!=typeof Kh?Kh:Kh(bc())),ej.x=zj.append("g").attr("class",g.axisX).attr("clip-path",Qi).attr("transform",jj.x).style("visibility",uh?"visible":"hidden"),ej.x.append("text").attr("class",g.axisXLabel).attr("transform",th?"rotate(-90)":"").style("text-anchor",Cb),ej.y=zj.append("g").attr("class",g.axisY).attr("clip-path",Ri).attr("transform",jj.y).style("visibility",Mh?"visible":"hidden"),ej.y.append("text").attr("class",g.axisYLabel).attr("transform",th?"":"rotate(-90)").style("text-anchor",Db),ej.y2=zj.append("g").attr("class",g.axisY2).attr("transform",jj.y2).style("visibility",Vh?"visible":"hidden"),ej.y2.append("text").attr("class",g.axisY2Label).attr("transform",th?"":"rotate(-90)").style("text-anchor",Eb),Aj.append("g").attr("clip-path",Pi).attr("class",g.chart),Aj.select("."+g.chart).append("g").attr("class",g.chartBars),Aj.select("."+g.chart).append("g").attr("class",g.chartLines),Aj.append("g").attr("clip-path",Pi).attr("class",g.brush).call(sj).selectAll("rect").attr(th?"width":"height",th?eg:gg),ej.subx=Aj.append("g").attr("class",g.axisX).attr("transform",jj.subx).attr("clip-path",th?"":Qi),uf(Kf.data.targets),th?zj.select("."+g.axisX).style("opacity",0).call(Gg):(zj.select("."+g.axisY).style("opacity",0).call(Hg),zj.select("."+g.axisY2).style("opacity",0).call(Ig)),p(),T(),rf(),o(!1),nf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Ji){if(Si&&"string"==typeof Ki){for(Ki=ye(Ki),e=0;e0){d=[];for(var f in Og)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Pd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ne,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function kf(a){je(Kf.data.targets)||_g&&(Vi=a,zj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Wi=!0,ih())}function lf(){je(Kf.data.targets)||_g&&(zj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),zj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Wi=!1,jh())}function mf(a,b){"grid"===b&&a.each(function(){var a=Jf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function nf(a,c){var d,e,f,h,i,j,k,l,m,n,o,p,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,O,P,Q,R,S,T,U,V,W=$d(),X=je(Kf.data.targets),Y=Jc(Kf.data.targets);if(a=a||{},C=He(a,"withY",!0),D=He(a,"withSubchart",!0),E=He(a,"withTransition",!0),H=He(a,"withTransform",!1),I=He(a,"withUpdateXDomain",!1),J=He(a,"withUpdateOrgXDomain",!1),K=He(a,"withLegend",!1),F=He(a,"withTransitionForExit",E),G=He(a,"withTransitionForAxis",E),Q=E?_f:0,R=F?Q:0,S=G?Q:0,c=c||sf(S),K&&nh&&Ef(Ec(Kf.data.targets),a,c),Ti&&0===Y.length&&Ag.domain([0,ej.x.selectAll(".tick").size()]),Y.length&&(J&&(Ag.domain(Jf.extent(bc(Y))),Ej=Ag.domain(),Tf&&wj.scale(Ag).updateScaleExtent(),Dg.domain(Ag.domain()),sj.scale(Dg)),I&&(Ag.domain(sj.empty()?Ej:sj.extent()),Tf&&wj.scale(Ag).updateScaleExtent()),Eh||!Dh&&!Ch||(T=Lc(Kc(Y),Ch),Gg.tickValues(T),Jg.tickValues(T))),Bg.domain(Zb(Y,"y")),Cg.domain(Zb(Y,"y2")),ej.x.style("opacity",X?0:1),ej.y.style("opacity",X?0:1),ej.y2.style("opacity",X?0:1),ej.subx.style("opacity",X?0:1),c.axisX.call(Gg),c.axisY.call(Hg),c.axisY2.call(Ig),c.axisSubX.call(Jg),Gb(E),I&&Y.length)if(Ah&&T){for(U=1;U=0&&Jf.select(this).style("display",b%V?"none":"block")})}else xj.selectAll("."+g.axisX+" .tick text").style("display","block");!th&&Fh&&hb(ej.x,c.axisX,Fh),L=$e(W),O=_e(W,!0),P=_e(W,!1),Eg.domain(Bg.domain()),Fg.domain(Cg.domain()),Cj.style("display","none"),q(),zj.select("line."+g.xgridFocus).style("visibility","hidden"),ci&&(f=Xd(di,Ag),z=Ti?Gg.tickOffset():0,e=th?{x1:0,x2:dg,y1:function(a){return Ag(a)-z},y2:function(a){return Ag(a)-z}}:{x1:function(a){return Ag(a)+z},x2:function(a){return Ag(a)+z},y1:ag.top,y2:fg},d=zj.select("."+g.xgrids).selectAll("."+g.xgrid).data(f),d.enter().append("line").attr("class",g.xgrid),d.attr(e).style("opacity",function(){return+Jf.select(this).attr(th?"y1":"x1")===(th?fg:0)?0:1}),d.exit().remove()),De(ei)&&(h=zj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(ei),i=h.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),i.append("line").style("opacity",0),i.append("text").attr("text-anchor","end").attr("transform",th?"":"rotate(-90)").attr("dx",th?0:-ag.top).attr("dy",-5).style("opacity",0),h.select("line").transition().duration(Q).attr("x1",th?0:Hd).attr("x2",th?dg:Hd).attr("y1",th?Hd:ag.top).attr("y2",th?Hd:fg).style("opacity",1),h.select("text").transition().duration(Q).attr("x",th?dg:0).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),h.exit().transition().duration(Q).style("opacity",0).remove()),C&&fi&&(j=zj.select("."+g.ygrids).selectAll("."+g.ygrid).data(Bg.ticks(hi)),j.enter().append("line").attr("class",g.ygrid),j.attr("x1",th?Bg:0).attr("x2",th?Bg:dg).attr("y1",th?0:Bg).attr("y2",th?fg:Bg),j.exit().remove(),mf(j,"grid")),C&&De(gi)&&(k=zj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(gi),l=k.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",th?"rotate(-90)":"").attr("dx",th?0:-ag.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(Q).attr("x1",th?Id:0).attr("x2",th?Id:dg).attr("y1",th?0:Id).attr("y2",th?fg:Id).style("opacity",1),k.select("text").transition().duration(Q).attr("x",th?0:dg).attr("y",Id).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(Q).style("opacity",0).remove()),s=zj.select("."+g.regions).selectAll("."+g.region).data(Ei),s.enter().append("g").attr("class",id).append("rect").style("fill-opacity",0),s.selectAll("rect").transition().duration(Q).attr("x",gc).attr("y",hc).attr("width",ic).attr("height",jc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(Q).style("opacity",0).remove(),p=zj.selectAll("."+g.bars).selectAll("."+g.bar).data(te),p.enter().append("path").attr("class",cd).style("stroke","none").style("fill",_i),p.style("opacity",ud).transition().duration(Q).attr("d",L).style("fill",_i).style("opacity",1),p.exit().transition().duration(R).style("opacity",0).remove(),m=zj.selectAll("."+g.lines).selectAll("."+g.line).data(re),m.enter().append("path").attr("class",$c).style("stroke",_i),m.style("opacity",ud).transition().duration(Q).attr("d",tj).style("stroke",_i).style("opacity",1),m.exit().transition().duration(R).style("opacity",0).remove(),n=zj.selectAll("."+g.areas).selectAll("."+g.area).data(re),n.enter().append("path").attr("class",gd).style("fill",_i).style("opacity",function(){return Fj=+Jf.select(this).style("opacity"),0}),n.style("opacity",0).transition().duration(Q).attr("d",uj).style("fill",_i).style("opacity",Fj),n.exit().transition().duration(R).style("opacity",0).remove(),o=zj.selectAll("."+g.circles).selectAll("."+g.circle).data(ue),o.enter().append("circle").attr("class",ad).attr("r",Re).style("fill",_i),o.style("opacity",ud).transition().duration(Q).style("opacity",wd).style("fill",_i).attr("cx",th?Zd:Yd).attr("cy",th?Yd:Zd),o.exit().remove(),t=zj.selectAll("."+g.texts).selectAll("."+g.text).data(ve),t.enter().append("text").attr("class",Wc).attr("text-anchor",function(a){return th?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",_i).style("fill-opacity",0),t.text(function(a){return Fd(a.id)(a.value,a.id)}).style("fill-opacity",vd).transition().duration(Q).attr("x",O).attr("y",P).style("fill",_i).style("fill-opacity",xd),t.exit().transition().duration(R).style("fill-opacity",0).remove(),r=zj.selectAll("."+g.arcs).selectAll("."+g.arc).data(se),r.enter().append("path").attr("class",ed).style("fill",function(a){return _i(a.data)}).style("cursor",function(a){return bh(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Zi||(c=Hb(a),d=Nb(c),e=Vb(),Pb(c.data.id),Af(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Hb(a),c=Nb(b),d=[c];Td(d,Jf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Zi||(c=Hb(a),d=Nb(c),e=Wb(),Qb(c.data.id),Bf(),Ud(),e(d,b))}).on("click",function(a,b){var c=Hb(a),d=Nb(c),e=Ub();hf(this,a,b),e(d,b)}),r.attr("transform",H?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Zi=!0}).transition().duration(Q).attrTween("d",function(a){var b,c=Hb(a);return c?(b=Jf.interpolate(this._current,c),this._current=b(0),function(a){return Kb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",H?"scale(1)":"").style("fill",function(a){return _i(a.data)}).style("opacity",1).call(Ge,function(){Zi=!1}),r.exit().transition().duration(R).style("opacity",0).remove(),zj.selectAll("."+g.chartArc).select("text").attr("transform",Lb).style("opacity",0).transition().duration(Q).text(Ob).style("opacity",function(a){return Hc(a.data.id)&&qe(a.data)?1:0}),zj.select("."+g.chartArcsTitle).style("opacity",ie(Kf.data.targets)?1:0),kh&&(Jf.event&&"zoom"===Jf.event.type&&sj.extent(Ag.orgDomain()).update(),D&&(!th&&Fh&&hb(ej.subx,c.axisSubX,Fh),sj.empty()||sj.extent(Ag.orgDomain()).update(),M=$e(W,!0),v=Aj.selectAll("."+g.bars).selectAll("."+g.bar).data(te),v.enter().append("path").attr("class",cd).style("stroke","none").style("fill",_i),v.style("opacity",ud).transition().duration(Q).attr("d",M).style("opacity",1),v.exit().transition().duration(Q).style("opacity",0).remove(),u=Aj.selectAll("."+g.lines).selectAll("."+g.line).data(re),u.enter().append("path").attr("class",$c).style("stroke",_i),u.style("opacity",ud).transition().duration(Q).attr("d",vj).style("opacity",1),u.exit().transition().duration(Q).style("opacity",0).remove())),zj.selectAll("."+g.selectedCircles).filter(function(a){return me(a)}).selectAll("circle").remove(),zj.selectAll("."+g.selectedCircle).transition().duration(Q).attr("cx",th?Zd:Yd).attr("cy",th?Yd:Zd),Wf&&(w=zj.select("."+g.eventRects),De(Lg)&&!qc(Lg)?(w.classed(g.eventRectsMultiple)||w.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),x=zj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),gf(x.enter()),x.attr("x",0).attr("y",0).attr("width",dg).attr("height",fg)):(w.classed(g.eventRectsSingle)||w.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Ui&&!Ti?(B=function(a,b){var c=zc(b),d=Ac(b),e=Kf.data.xs[a.id][b];return(Ag(d?d:e+50)-Ag(c?c:e-50))/2},A=function(a,b){var c=zc(b),d=Kf.data.xs[a.id][b];return(Ag(d)+Ag(c?c:d-50))/2}):(B=N(),A=function(a){return Ag(a.x)-B/2}),y=Cc(Kf.data.targets),zj.select("."+g.eventRects).datum(y?y.values:[]),x=zj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),ff(x.enter()),x.attr("class",jd).attr("x",th?0:A).attr("y",th?A:0).attr("width",th?dg:B).attr("height",th?B:fg),x.exit().remove())),Ec(Kf.data.targets).forEach(function(a){Gj[a]=!0})}function of(){nf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function pf(){if(0!==Jc(Kf.data.targets).length){if("mousemove"===Jf.event.sourceEvent.type&&wj.altDomain)return Ag.domain(wj.altDomain),void wj.scale(Ag).updateScaleExtent();Ti&&Ag.orgDomain()[0]===Ej[0]&&Ag.domain([Ej[0]-1e-10,Ag.orgDomain()[1]]),nf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Jf.event.sourceEvent.type&&(Xi=!0)}}function qf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function rf(){xj.attr("width",hg).attr("height",ig),xj.select("#"+Mi).select("rect").attr("width",dg).attr("height",fg),xj.select("#"+Ni).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),xj.select("#"+Oi).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),xj.select("."+g.zoomRect).attr("width",dg).attr("height",fg),Dj.style("max-height",ig+"px")}function sf(a){return{axisX:a?ej.x.transition().duration(a):ej.x,axisY:a?ej.y.transition().duration(a):ej.y,axisY2:a?ej.y2.transition().duration(a):ej.y2,axisSubX:a?ej.subx.transition().duration(a):ej.subx}}function tf(a){var b;a=a||{},a.withTransition=He(a,"withTransition",!0),a.withTransform=He(a,"withTransform",!1),a.withLegend=He(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withLegend&&nh||(b=sf(a.withTransitionForAxis?_f:0),p(),T(),rf(),o(a.withTransition,b)),nf(a,b)}function uf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=zj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",ld),j=i.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Xc),e=zj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",nd),d=e.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",dd).style("cursor",function(a){return bh(a)?"pointer":null}),c=zj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",md),b=c.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",_c),b.append("g").attr("class",hd),b.append("g").attr("class",function(a){return Vc(g.selectedCircles,a.id)}),b.append("g").attr("class",bd).style("cursor",function(a){return bh(a)?"pointer":null}),a.forEach(function(a){zj.selectAll("."+g.selectedCircles+pd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=zj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(rg(a)).attr("class",od),f=h.enter().append("g").attr("class",od),f.append("g").attr("class",fd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),kh&&(n=Aj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",nd),m=n.enter().append("g").style("opacity",0).attr("class",nd),m.append("g").attr("class",dd),l=Aj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",md),k=l.enter().append("g").style("opacity",0).attr("class",md),k.append("g").attr("class",_c)),xj.selectAll("."+g.target).filter(function(a){return Hc(a.id)}).transition().duration(_f).style("opacity",1)}function vf(a,b){b.filter&&(a=a.filter(b.filter)),(b.type||b.types)&&a.forEach(function(a){b.types?de(a.id,b.types[a.id]):de(a.id,b.type)}),Kf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,z=0,F++)),E[a]=F,D[F]=f,A[a]=z,z+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+v)/10),j=10*Math.ceil((h.height+u)/10),k=kj?j:i,l=kj?S():R();return d&&(z=0,F=0,w=0,x=0),nh&&!Ic(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=i,C[c]=j,(!w||i>=w)&&(w=i),(!x||j>=x)&&(x=j),g=kj?x:w,void(sh?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(l-g*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=26,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=Bj.selectAll("."+g.legendItemFocused).size();b=b||{},n=He(b,"withTransition",!0),q=He(b,"withTransitionForTransform",!0),kj?(f=function(a){return w*E[a]},j=function(a){return D[E[a]]+A[a]}):(f=function(a){return D[E[a]]+A[a]},j=function(a){return x*E[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=Bj.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Vc(g.legendItem,a)}).style("visibility",function(a){return Ic(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof ph?ph(a):Kf.toggle(a)}).on("mouseover",function(a){Jf.select(this).classed(g.legendItemFocused,!0),Zi||Kf.focus(a),"function"==typeof qh&&qh(a)}).on("mouseout",function(a){Jf.select(this).classed(g.legendItemFocused,!1),Zi||Kf.revert(),"function"==typeof rh&&rh(a)}),m.append("text").text(function(a){return d(Og[a])?Og[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",kj?h:-200).attr("y",kj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",kj?i:-200).attr("y",kj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",_i).attr("x",kj?h:-200).attr("y",kj?-200:j).attr("width",10).attr("height",10),r=Bj.selectAll("text").data(a).text(function(a){return d(Og[a])?Og[a]:a}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=Bj.selectAll("rect."+g.legendItemEvent).data(a),(n?s.transition():s).attr("width",function(a){return B[a]}).attr("height",function(a){return C[a]}).attr("x",i).attr("y",l),t=Bj.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",_i).attr("x",f).attr("y",j),Bj.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Hc(a)}).transition().style("opacity",function(a){var b=Jf.select(this);return Hc(a)?!G||b.classed(g.legendItemFocused)?yf(b):zf(b):oj}),P(w),Q(x),O(F),p(),T(),rf(),o(q,c)}function Ff(a){return Gc(Kf.data.targets,a.id)}function Gf(a){return"data"in a&&Gc(Kf.data.targets,a.data.id)}function Hf(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 If(a,b,c){var d=!je(Kf.data.targets);Zi=!1,de(a,b),tf(c||{withTransitionForAxis:d})}var Jf=a.d3?a.d3:a.require?a.require("d3"):void 0,Kf={data:{},axis:{},legend:{}},Lf={},Mf=i(["bindto"],"#chart"),Nf=i(["size","width"]),Of=i(["size","height"]),Pf=i(["padding","left"],50),Qf=i(["padding","right"],10),Rf=i(["padding","top"],0),Sf=i(["padding","bottom"],0),Tf=i(["zoom","enabled"],!1),Uf=i(["zoom","extent"]),Vf=i(["zoom","privileged"],!1),Wf=i(["interaction","enabled"],!0),Xf=i(["onenter"],function(){}),Yf=i(["onleave"],function(){}),Zf=i(["onresize"],function(){}),$f=i(["onresized"],function(){}),_f=i(["transition","duration"],350);h("data","data is required in config");var ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg,Kg=i(["data","x"]),Lg=i(["data","xs"],{}),Mg=i(["data","x_format"]),Ng=i(["data","id_converter"],function(a){return a}),Og=i(["data","names"],{}),Pg=i(["data","classes"],{}),Qg=i(["data","groups"],[]),Rg=i(["data","axes"],{}),Sg=i(["data","type"]),Tg=i(["data","types"],{}),Ug=i(["data","labels"],{}),Vg=i(["data","order"]),Wg=i(["data","regions"],{}),Xg=i(["data","color"]),Yg=i(["data","colors"],{}),Zg=i(["data","hide"],!1),$g=i(["data","filter"]),_g=i(["data","selection","enabled"],!1),ah=i(["data","selection","grouped"],!1),bh=i(["data","selection","isselectable"],function(){return!0}),ch=i(["data","selection","multiple"],!0),dh=i(["data","onclick"],function(){}),eh=i(["data","onenter"],function(){}),fh=i(["data","onleave"],function(){}),gh=i(["data","onselected"],function(){}),hh=i(["data","onunselected"],function(){}),ih=i(["data","ondragstart"],function(){}),jh=i(["data","ondragend"],function(){}),kh=i(["subchart","show"],!1),lh=i(["subchart","size","height"],60),mh=i(["color","pattern"],[]),nh=i(["legend","show"],!0),oh=i(["legend","position"],"bottom"),ph=i(["legend","item","onclick"]),qh=i(["legend","item","onmouseover"]),rh=i(["legend","item","onmouseout"]),sh=i(["legend","equally"],!1),th=i(["axis","rotated"],!1),uh=i(["axis","x","show"],!0),vh=i(["axis","x","type"],"indexed"),wh=i(["axis","x","localtime"],!0),xh=i(["axis","x","categories"],[]),yh=i(["axis","x","tick","centered"],!1),zh=i(["axis","x","tick","format"]),Ah=i(["axis","x","tick","culling"],{}),Bh=i(["axis","x","tick","culling","max"],10),Ch=i(["axis","x","tick","count"]),Dh=i(["axis","x","tick","fit"],!0),Eh=i(["axis","x","tick","values"],null),Fh=i(["axis","x","tick","rotate"]),Gh=i(["axis","x","max"],null),Hh=i(["axis","x","min"],null),Ih=i(["axis","x","padding"],{}),Jh=i(["axis","x","height"]),Kh=i(["axis","x","default"]),Lh=i(["axis","x","label"],{}),Mh=i(["axis","y","show"],!0),Nh=i(["axis","y","max"]),Oh=i(["axis","y","min"]),Ph=i(["axis","y","center"]),Qh=i(["axis","y","label"],{}),Rh=i(["axis","y","inner"],!1),Sh=i(["axis","y","tick","format"]),Th=i(["axis","y","padding"]),Uh=i(["axis","y","ticks"],10),Vh=i(["axis","y2","show"],!1),Wh=i(["axis","y2","max"]),Xh=i(["axis","y2","min"]),Yh=i(["axis","y2","center"]),Zh=i(["axis","y2","label"],{}),$h=i(["axis","y2","inner"],!1),_h=i(["axis","y2","tick","format"]),ai=i(["axis","y2","padding"]),bi=i(["axis","y2","ticks"],10),ci=i(["grid","x","show"],!1),di=i(["grid","x","type"],"tick"),ei=i(["grid","x","lines"],[]),fi=i(["grid","y","show"],!1),gi=i(["grid","y","lines"],[]),hi=i(["grid","y","ticks"],10),ii=i(["point","show"],!0),ji=i(["point","r"],2.5),ki=i(["point","focus","line","enabled"],!0),li=i(["point","focus","expand","enabled"],!0),mi=i(["point","focus","expand","r"]),ni=i(["point","focus","select","r"]),oi=i(["line","connect_null"],!1),pi=i(["bar","width"]),qi=i(["bar","width","ratio"],.6),ri=i(["pie","label","show"],!0),si=i(["pie","label","format"]),ti=i(["pie","expand"],!0),ui=i(["pie","onclick"],function(){}),vi=i(["pie","onmouseover"],function(){}),wi=i(["pie","onmouseout"],function(){}),xi=i(["donut","label","show"],!0),yi=i(["donut","label","format"]),zi=i(["donut","expand"],!0),Ai=i(["donut","title"],""),Bi=i(["donut","onclick"],function(){}),Ci=i(["donut","onmouseover"],function(){}),Di=i(["donut","onmouseout"],function(){}),Ei=i(["regions"],[]),Fi=i(["tooltip","show"],!0),Gi=i(["tooltip","format","title"]),Hi=i(["tooltip","format","value"]),Ii=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Gi?Gi:b,l=Hi?Hi:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Ji=i(["tooltip","init","show"],!1),Ki=i(["tooltip","init","x"],0),Li=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Mi=("string"==typeof Mf?Mf.replace("#",""):Mf.id)+"-clip",Ni=Mi+"-xaxis",Oi=Mi+"-yaxis",Pi=j(Mi),Qi=j(Ni),Ri=j(Oi),Si="timeseries"===vh,Ti="categorized"===vh,Ui=!Si&&(Kg||De(Lg)),Vi=null,Wi=!1,Xi=!1,Yi=!1,Zi=!1,$i=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],_i=xe(Yg,De(mh)?mh:$i,Xg),aj=wh?Jf.time.format:Jf.time.format.utc,bj=aj.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),cj=[],dj=[],ej={},fj=th?"left":"bottom",gj=th?Rh?"top":"bottom":Rh?"right":"left",hj=th?$h?"bottom":"top":$h?"left":"right",ij=th?"left":"bottom",jj={main:function(){return"translate("+k(ag.left)+","+k(ag.top)+")"},context:function(){return"translate("+k(bg.left)+","+k(bg.top)+")"},legend:function(){return"translate("+cg.left+","+cg.top+")"},x:function(){return"translate(0,"+(th?0:fg)+")"},y:function(){return"translate(0,"+(th?fg:0)+")" +},y2:function(){return"translate("+(th?0:dg)+","+(th?1:0)+")"},subx:function(){return"translate(0,"+(th?0:gg)+")"},arc:function(){return"translate("+mg/2+","+ng/2+")"}},kj="right"===oh,lj=0,mj=0,nj=0,oj=.15,pj=30,qj=th&&!uh?0:30,rj=5;rg=Jf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var sj,tj=function(){var a=Jf.svg.line().x(th?function(a){return Y(a.id)(a.value)}:Gd).y(th?Gd:function(a){return Y(a.id)(a.value)});return oi||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=oi?Qe(b.values):b.values;return ke(b)?(a.interpolate(le(b)?"cardinal":"linear"),Wg[b.id]?df(e,Ag,Y(b.id),Wg[b.id]):a(e)):(c=e[0]?Ag(e[0].x):0,d=e[0]?Y(b.id)(e[0].value):0,th?"M "+d+" "+c:"M "+c+" "+d)}}(),uj=function(){var a;return a=th?Jf.svg.area().x0(function(a){return Y(a.id)(0)}).x1(function(a){return Y(a.id)(a.value)}).y(Gd):Jf.svg.area().x(Gd).y0(function(a){return Y(a.id)(0)}).y1(function(a){return Y(a.id)(a.value)}),function(b){var c,d,e=Qe(b.values);return ee([b],"area")||ee([b],"area-spline")?(a.interpolate(le(b)?"cardinal":"linear"),a(e)):(c=e[0]?Ag(e[0].x):0,d=e[0]?Y(b.id)(e[0].value):0,th?"M "+d+" "+c:"M "+c+" "+d)}}(),vj=function(){var a=Jf.svg.line().x(th?function(a){return Z(a.id)(a.value)}:Jd).y(th?Jd:function(a){return Z(a.id)(a.value)});return function(b){var c=Qe(b.values);return ke(b)?a(c):"M "+Dg(c[0].x)+" "+Z(b.id)(c[0].value)}}(),wj=function(){};sj=Jf.svg.brush().on("brush",of),sj.update=function(){return Aj&&Aj.select("."+g.brush).call(this),this},sj.scale=function(a){return th?this.y(a):this.x(a)},Tf&&(wj=Jf.behavior.zoom().on("zoomstart",function(){wj.altDomain=Jf.event.sourceEvent.altKey?Ag.orgDomain():null}).on("zoom",Tf?pf:null),wj.scale=function(a){return th?this.y(a):this.x(a)},wj.orgScaleExtent=function(){var a=Uf?Uf:[1,10];return[a[0],Math.max(Bc()/a[1],a[1])]},wj.updateScaleExtent=function(){var a=cc(Ag.orgDomain())/cc(Ej),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var xj,yj,zj,Aj,Bj,Cj,Dj,Ej,Fj,Gj={};if(Kf.focus=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",1)}var c=xj.selectAll(qd(a)),d=c.filter(Ff),e=c.filter(Gf);Kf.revert(),Kf.defocus(),b(d.classed(g.focused,!0)),b(e),je(Kf.data.targets)&&Pb(a,!0),Af(a,!0)},Kf.defocus=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",.3)}var c=xj.selectAll(qd(a)),d=c.filter(Ff),e=c.filter(Gf);Kf.revert(),b(d.classed(g.focused,!1)),b(e),je(Kf.data.targets)&&Qb(a),Af(a,!1)},Kf.revert=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",1)}var c=xj.selectAll(qd(a)),d=c.filter(Ff),e=c.filter(Gf);b(d.classed(g.focused,!1)),b(e),je(Kf.data.targets)&&Qb(a),Bf()},Kf.show=function(a,b){a=Fc(a),b=b||{},Nc(a),xj.selectAll(rd(a)).transition().style("opacity",1),b.withLegend&&Cf(a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Kf.hide=function(a,b){a=Fc(a),b=b||{},Mc(a),xj.selectAll(rd(a)).transition().style("opacity",0),b.withLegend&&Df(a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Kf.toggle=function(a){Hc(a)?Kf.hide(a):Kf.show(a)},Kf.unzoom=function(){sj.clear().update(),nf({withUpdateXDomain:!0})},Kf.load=function(a){return a.xs&&pc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Pg[b]=a.classes[b]}),"categories"in a&&Ti&&(xh=a.categories,Gg.categories(xh)),"cacheIds"in a&&dc(a.cacheIds)?void vf(fc(a.cacheIds),a.done):void("unload"in a?xf(Fc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){wf(a)}):wf(a))},Kf.unload=function(a,b){xf(Fc(a),function(){nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Kf.selected=function(a){return Jf.merge(zj.selectAll("."+g.shapes+pd(a)).selectAll("."+g.shape).filter(function(){return Jf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Kf.select=function(a,b,c){_g&&zj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Jf.select(this),i=e.data?e.data.id:e.id,j=Pe(this),k=ah||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);"path"!==this.nodeName&&(k&&l?bh(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},Kf.unselect=function(a,b){_g&&zj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Jf.select(this),f=c.data?c.data.id:c.id,h=Pe(this),i=ah||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);"path"!==this.nodeName&&i&&j&&bh(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Kf.toLine=function(a){If(a,"line")},Kf.toSpline=function(a){If(a,"spline")},Kf.toBar=function(a){If(a,"bar")},Kf.toScatter=function(a){If(a,"scatter")},Kf.toArea=function(a){If(a,"area")},Kf.toAreaSpline=function(a){If(a,"area-spline")},Kf.toPie=function(a){If(a,"pie",{withTransform:!0})},Kf.toDonut=function(a){If(a,"donut",{withTransform:!0})},Kf.groups=function(a){return c(a)?Qg:(Qg=a,nf(),Qg)},Kf.xgrids=function(a){return a?(ei=a,nf(),ei):ei},Kf.xgrids.add=function(a){return a?Kf.xgrids(ei.concat(a)):void 0},Kf.xgrids.remove=function(a){var b=Hf(a);return Kf.xgrids(ei.filter(b))},Kf.ygrids=function(a){return a?(gi=a,nf(),gi):gi},Kf.ygrids.add=function(a){return a?Kf.ygrids(gi.concat(a)):void 0},Kf.ygrids.remove=function(a){var b=Hf(a);return Kf.ygrids(gi.filter(b))},Kf.regions=function(a){return a?(Ei=a,nf(),Ei):Ei},Kf.regions.add=function(a){return a?(Ei=Ei.concat(a),nf(),Ei):Ei},Kf.regions.remove=function(a){var b,c,d;return a=a||{},b=He(a,"duration",_f),c=He(a,"classes",[g.region]),d=zj.select("."+g.regions).selectAll(c.map(function(a){return"."+a})),(b?d.transition().duration(b):d).style("opacity",0).remove(),Ei=Ei.filter(function(a){return c.indexOf(a.class)<0})},Kf.data.get=function(a){var b=Kf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Kf.data.getAsTarget=function(a){var b=Kf.data.targets.filter(function(b){return b.id===a});return b.length>0?b[0]:void 0},Kf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Og[b]=a[b]}),nf({withLegend:!0}),Og):Og},Kf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Yg[b]=a[b]}),nf({withLegend:!0}),Yg):Yg},Kf.x=function(a){return arguments.length&&(sc(Kf.data.targets,a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Kf.data.xs},Kf.xs=function(a){return arguments.length&&(tc(Kf.data.targets,a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Kf.data.xs},Kf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){eb(b,a[b])}),Gb())},Kf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Gh=+a.x),b(a.y)&&(Nh=+a.y),b(a.y2)&&(Wh=+a.y2)):Nh=Wh=+a,nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Kf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Hh=+a.x),b(a.y)&&(Oh=+a.y),b(a.y2)&&(Xh=+a.y2)):Oh=Xh=+a,nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Kf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Kf.axis.max(a.max),"undefined"!=typeof a.min&&Kf.axis.min(a.min))},Kf.legend.show=function(a){Cf(Fc(a)),nf({withLegend:!0})},Kf.legend.hide=function(a){Df(Fc(a)),nf({withLegend:!0})},Kf.resize=function(a){Nf=a?a.width:null,Of=a?a.height:null,tf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Kf.destroy=function(){Kf.data.targets=void 0,Kf.data.xs={},Dj.html(""),a.onresize=null},"url"in f.data)Jf.xhr(f.data.url,function(a,b){var c,d=Jf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Jf.csv.parse(b.response),ef(c)});else if("rows"in f.data)ef(vc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");ef(wc(f.data.columns))}return Kf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(window); \ No newline at end of file From ed80b78a5fecb45f66eb3db361a3c63aa9616f70 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Fri, 9 May 2014 18:30:05 +0900 Subject: [PATCH 159/178] Fix padding - #129 #219 --- c3.js | 72 ++++++++++++++++++++++++++++--------------------------- c3.min.js | 6 ++--- 2 files changed, 40 insertions(+), 38 deletions(-) diff --git a/c3.js b/c3.js index 5ae0fd4..7fe0fa1 100644 --- a/c3.js +++ b/c3.js @@ -109,10 +109,10 @@ var __size_width = getConfig(['size', 'width']), __size_height = getConfig(['size', 'height']); - var __padding_left = getConfig(['padding', 'left'], 50), - __padding_right = getConfig(['padding', 'right'], 10), - __padding_top = getConfig(['padding', 'top'], 0), - __padding_bottom = getConfig(['padding', 'bottom'], 0); + var __padding_left = getConfig(['padding', 'left']), + __padding_right = getConfig(['padding', 'right']), + __padding_top = getConfig(['padding', 'top']), + __padding_bottom = getConfig(['padding', 'bottom']); var __zoom_enabled = getConfig(['zoom', 'enabled'], false), __zoom_extent = getConfig(['zoom', 'extent']), @@ -421,9 +421,9 @@ // for main, context if (__axis_rotated) { margin = { - top: getHorizontalAxisHeight('y2') + __padding_top, + top: getHorizontalAxisHeight('y2') + getCurrentPaddingTop(), right: hasArc ? 0 : getCurrentPaddingRight(), - bottom: getHorizontalAxisHeight('y') + legendHeightForBottom + __padding_bottom, + bottom: getHorizontalAxisHeight('y') + legendHeightForBottom + getCurrentPaddingBottom(), left: subchartHeight + (hasArc ? 0 : getCurrentPaddingLeft()) }; margin2 = { @@ -434,9 +434,9 @@ }; } else { margin = { - top: 4 + __padding_top, // for top tick text + top: 4 + getCurrentPaddingTop(), // for top tick text right: hasArc ? 0 : getCurrentPaddingRight(), - bottom: xAxisHeight + subchartHeight + legendHeightForBottom + __padding_bottom, + bottom: xAxisHeight + subchartHeight + legendHeightForBottom + getCurrentPaddingBottom(), left: hasArc ? 0 : getCurrentPaddingLeft() }; margin2 = { @@ -501,26 +501,29 @@ var h = __size_height ? __size_height : getParentHeight(); return h > 0 ? h : 320; } + function getCurrentPaddingTop() { + return __padding_top ? __padding_top : 0; + } + function getCurrentPaddingBottom() { + return __padding_bottom ? __padding_bottom : 0; + } function getCurrentPaddingLeft() { - var defaultPadding = 1; if (__padding_left) { return __padding_left; } else if (__axis_rotated) { - return !__axis_x_show ? defaultPadding : getAxisWidthByAxisId('x'); + return !__axis_x_show ? 1 : ceil10(getAxisWidthByAxisId('x')); } else { - return !__axis_y_show || __axis_y_inner ? defaultPadding : getAxisWidthByAxisId('y'); + return !__axis_y_show || __axis_y_inner ? 1 : ceil10(getAxisWidthByAxisId('y')); } } function getCurrentPaddingRight() { - var defaultPadding = 1; + var defaultPadding = 10, legendWidthOnRight = isLegendRight ? getLegendWidth() + 20 : 0; if (__padding_right) { return __padding_right; - } else if (isLegendRight) { - return getLegendWidth() + 20 + (__axis_y2_show && !__axis_rotated ? getAxisWidthByAxisId('y2') : defaultPadding); - } else if (__axis_y2_show) { - return __axis_y2_inner || __axis_rotated ? defaultPadding : getAxisWidthByAxisId('y2'); + } else if (__axis_rotated) { + return defaultPadding + legendWidthOnRight; } else { - return defaultPadding; + return (!__axis_y2_show || __axis_y2_inner ? defaultPadding : ceil10(getAxisWidthByAxisId('y2'))) + legendWidthOnRight; } } function getAxisWidthByAxisId(id) { @@ -2108,6 +2111,10 @@ return isDefined(options[key]) ? options[key] : defaultValue; } + function ceil10(v) { + return Math.ceil(v / 10) * 10; + } + //-- Selection --// function selectPoint(target, d, i) { @@ -2663,22 +2670,8 @@ // Set targets updateTargets(c3.data.targets); - // Update ticks for width calculation - if (__axis_rotated) { - main.select('.' + CLASS.axisX).style("opacity", 0).call(xAxis); - } else { - main.select('.' + CLASS.axisY).style("opacity", 0).call(yAxis); - main.select('.' + CLASS.axisY2).style("opacity", 0).call(y2Axis); - } - - // Update sizes according to tick width updated by above - updateSizes(); - updateScales(); - updateSvgSize(); - transformAll(false); - // Draw with targets - redraw({withTransform: true, withUpdateXDomain: true, withUpdateOrgXDomain: true, withTransitionForAxis: false}); + redraw({withUpdateTranslate: true, withTransform: true, withUpdateXDomain: true, withUpdateOrgXDomain: true, withTransitionForAxis: false}); // Show tooltip if needed if (__tooltip_init_show) { @@ -3033,7 +3026,7 @@ var mainLine, mainArea, mainCircle, mainBar, mainArc, mainRegion, mainText, contextLine, contextBar, eventRect, eventRectUpdate; var barIndices = getBarIndices(), maxDataCountTarget, tickOffset; var rectX, rectW; - var withY, withSubchart, withTransition, withTransitionForExit, withTransitionForAxis, withTransform, withUpdateXDomain, withUpdateOrgXDomain, withLegend; + var withY, withSubchart, withTransition, withTransitionForExit, withTransitionForAxis, withTransform, withUpdateXDomain, withUpdateOrgXDomain, withLegend, withUpdateTranslate; var hideAxis = hasArcType(c3.data.targets); var drawBar, drawBarOnSub, xForText, yForText; var duration, durationForExit, durationForAxis; @@ -3046,6 +3039,7 @@ withTransform = getOption(options, "withTransform", false); withUpdateXDomain = getOption(options, "withUpdateXDomain", false); withUpdateOrgXDomain = getOption(options, "withUpdateOrgXDomain", false); + withUpdateTranslate = getOption(options, "withUpdateTranslate", false); withLegend = getOption(options, "withLegend", false); withTransitionForExit = getOption(options, "withTransitionForExit", withTransition); withTransitionForAxis = getOption(options, "withTransitionForAxis", withTransition); @@ -3103,6 +3097,14 @@ // Update axis label updateAxisLabels(withTransition); + // MEMO: need to be called after axis updated because updated tick's width will be used + if (withUpdateTranslate) { + updateSizes(); + updateScales(); + updateSvgSize(); + transformAll(false); + } + // show/hide if manual culling needed if (withUpdateXDomain && targetsToShow.length) { if (__axis_x_tick_culling && tickValues) { @@ -4536,12 +4538,12 @@ function axisX(selection, x) { selection.attr("transform", function (d) { - return "translate(" + Math.ceil(x(d) + tickOffset) + ", 0)"; + return "translate(" + Math.round(x(d) + tickOffset) + ", 0)"; }); } function axisY(selection, y) { selection.attr("transform", function (d) { - return "translate(0," + Math.ceil(y(d)) + ")"; + return "translate(0," + Math.round(y(d)) + ")"; }); } function scaleExtent(domain) { diff --git a/c3.min.js b/c3.min.js index 350f20b..16f3db4 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.ceil(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.ceil(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&adg&&(dg=0),0>fg&&(fg=0),eg=th?ag.left-pj-qj:dg,gg=th?fg:ig-bg.top-bg.bottom,0>eg&&(eg=0),0>gg&&(gg=0),mg=dg-(kj?b+10:0),ng=fg-(kj?0:10),r(),kj&&d&&(cg.left=mg/2+1.1*kg)}function q(){zj.select("line."+g.xgridFocus).attr("x1",th?0:-10).attr("x2",th?dg:-10).attr("y1",th?-10:ag.top).attr("y2",th?-10:fg)}function r(){kg=Math.min(mg,ng)/2,jg=.95*kg,lg=ie(Kf.data.targets)?.6*jg:0}function s(){var a=th?g.axisX:g.axisY,b=zj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Jf.select(Mf).node().getBoundingClientRect(),e=je(Kf.data.targets),f=c.right-d.left-(e?0:v());return f>0?f:0}function t(){return Nf?Nf:z()}function u(){var a=Of?Of:A();return a>0?a:320}function v(){var a=1;return Pf?Pf:th?uh?x("x"):a:!Mh||Rh?a:x("y")}function w(){var a=1;return Qf?Qf:kj?R()+20+(Vh&&!th?x("y2"):a):Vh?$h||th?a:x("y2"):a}function x(a){var b=mb(a);return b.isInner?20+Fb(a):40+Fb(a)}function y(a){return"x"!==a||uh?"x"===a&&Jh?Jh:"y"!==a||Mh?"y2"!==a||Vh?(mb(a).isInner?30:40)+("y2"===a?-10:0):rj:nh&&!kj?10:1:0}function z(){return+Jf.select(Mf).style("width").replace("px","")}function A(){return+Jf.select(Mf).style("height").replace("px","")}function B(a){return a?-31:-(ag.left-1)}function C(a){return a?-20:-4}function D(){return B(!th)}function E(){return C(!th)}function F(){return B(th)}function G(){return C(th)}function H(a){return a?dg+2+30+30:ag.left+20}function I(a){return a?(Jh?Jh:0)+80:fg+8}function J(){return H(!th)}function K(){return I(!th)}function L(){return H(th)}function M(){return I(th)}function N(){var a,b,c,d,e,f=Cc(Kf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=Ag(b.x)-Ag(a.x),0===c?th?fg:dg:(d=Bc(),e=fe(Kf.data.targets)?(d-(Ti?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function O(a){lj=a}function P(a){mj=a}function Q(a){nj=a}function R(){return nh?kj?mj*(lj+1):hg:0}function S(){return nh?kj?ig:nj*(lj+1):0}function T(){var a,b,c=!Ag;sg=th?1:0,tg=th?fg:dg,ug=th?0:fg,vg=th?dg:1,wg=sg,xg=tg,yg=th?0:gg,zg=th?eg:1,Ag=W(sg,tg,c?void 0:Ag.domain(),function(){return Gg.tickOffset()}),Bg=X(ug,vg,c?void 0:Bg.domain()),Cg=X(ug,vg,c?void 0:Cg.domain()),Dg=W(sg,tg,Ej,function(a){return a%1?0:Jg.tickOffset()}),Eg=X(yg,zg,c?void 0:Eg.domain()),Fg=X(yg,zg,c?void 0:Fg.domain()),a=bb(),b=Eh?Eh:c?void 0:Gg.tickValues(),Gg=$(Ag,fj,a,b),Jg=$(Dg,ij,a,b),Hg=_(Bg,gj,Sh,Uh),Ig=_(Cg,hj,_h,bi),c||(sj.scale(Dg),Tf&&wj.scale(Ag)),U()}function U(){og=Ib(),pg=Jb(),qg=Jb(.98)}function V(a,b,c){return(c?Jf.time.scale():Jf.scale.linear()).range([a,b])}function W(a,b,c,d){var e,f=V(a,b,Si),g=c?f.domain(c):f;Ti?(d=d||function(){return 0},f=function(a,b){var c=g(a)+d(a);return b?c:Math.ceil(c)}):f=function(a,b){var c=g(a);return b?c:Math.ceil(c)};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return Ej&&Ej[0]===a[0]&&Ej[1]a?a.toFixed(0):a};return zh&&("function"==typeof zh?a=zh:Si&&(a=function(a){return a?aj(zh)(a):""})),a}function cb(a){var b;return"y"===a?b=Qh:"y2"===a?b=Zh:"x"===a&&(b=Lh),b}function db(a){var b=cb(a);return"string"==typeof b?b:b?b.text:null}function eb(a,b){var c=cb(a);"string"==typeof c?"y"===a?Qh=b:"y2"===a?Zh=b:"x"===a&&(Lh=b):c&&(c.text=b)}function fb(a){return 10*Math.sin(Math.PI*(a/180))}function gb(a){return 11.5-2.5*(a/15)}function hb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",gb(c)).attr("x",fb(c)).attr("transform","rotate("+c+")")}function ib(a,b){var c=cb(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 jb(){return ib("x",th?"inner-top":"inner-right")}function kb(){return ib("y",th?"inner-right":"inner-top")}function lb(){return ib("y2",th?"inner-right":"inner-top")}function mb(a){return"y2"===a?lb():"y"===a?kb():jb()}function nb(){return db("x")}function ob(){return db("y")}function pb(){return db("y2")}function qb(a,b){return a?b.isLeft?0:b.isCenter?dg/2:dg:b.isBottom?-fg:b.isMiddle?-fg/2:0}function rb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function sb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function tb(){return qb(!th,jb())}function ub(){return qb(th,kb())}function vb(){return qb(th,lb())}function wb(){return rb(!th,jb())}function xb(){return rb(th,kb())}function yb(){return rb(th,lb())}function zb(){var a=jb();return th?a.isInner?"1.2em":-25-Fb("x"):a.isInner?"-0.5em":Jh?Jh-10:"3em"}function Ab(){var a=kb();return th?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Fb("y")}function Bb(){var a=lb();return th?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Fb("y2")}function Cb(){return sb(!th,jb())}function Db(){return sb(th,kb())}function Eb(){return sb(th,lb())}function Fb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Jf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Gb(a){var b=zj.select("."+g.axisX+" ."+g.axisXLabel),c=zj.select("."+g.axisY+" ."+g.axisYLabel),d=zj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",tb).attr("dx",wb).attr("dy",zb).text(nb),(a?c.transition():c).attr("x",ub).attr("dx",xb).attr("dy",Ab).attr("dy",Ab).text(ob),(a?d.transition():d).attr("x",vb).attr("dx",yb).attr("dy",Bb).text(pb)}function Hb(a){var b=!1;return rg(Jc(Kf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Ib(){var a=Jf.svg.arc().outerRadius(jg).innerRadius(lg),b=function(b,c){var d;return c?a(b):(d=Hb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Jb(a){var b=Jf.svg.arc().outerRadius(kg*(a?a:1)).innerRadius(lg);return function(a){var c=Hb(a);return c?b(c):"M 0 0"}}function Kb(a,b){return qe(a.data)?og(a,b):"M 0 0"}function Lb(a){var b,c,d,e,f=Hb(a),g="";return f&&(b=og.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*jg*.8+","+d/e*jg*.8+")"),g}function Mb(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Nb(a){return rc({id:a.data.id,value:a.value,ratio:Mb(a)})}function Ob(a){var b,c,d,e;return Rb()?(b=Hb(a),c=b?b.value:null,d=Mb(b),e=Sb(),e?e(c,d):Ed(c,d)):""}function Pb(a,b){var c=xj.selectAll("."+g.chartArc+qd(a)),d=xj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});we(a)&&c.selectAll("path").transition().duration(50).attr("d",pg).transition().duration(100).attr("d",qg).each(function(a){pe(a.data)}),b||d.style("opacity",.3)}function Qb(a){var b=xj.selectAll("."+g.chartArc+qd(a));b.selectAll("path").transition().duration(50).attr("d",og),xj.selectAll("."+g.arc).style("opacity",1)}function Rb(){return ie(Kf.data.targets)?xi:ri}function Sb(){return ie(Kf.data.targets)?yi:si}function Tb(){return ie(Kf.data.targets)?Ai:""}function Ub(){var a=ie(Kf.data.targets)?Bi:ui;return"function"==typeof a?a:function(){}}function Vb(){var a=ie(Kf.data.targets)?Ci:vi;return"function"==typeof a?a:function(){}}function Wb(){var a=ie(Kf.data.targets)?Di:wi;return"function"==typeof a?a:function(){}}function Xb(a){var b,c,d,e,f,g,h=Ec(a),i=Qc(a);if(Qg.length>0)for(g=Sc(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 Jf.min(Object.keys(i).map(function(a){return Jf.min(i[a])}))}function Yb(a){var b,c,d,e,f,g,h=Ec(a),i=Qc(a);if(Qg.length>0)for(g=Tc(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 Jf.max(Object.keys(i).map(function(a){return Jf.max(i[a])}))}function Zb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return ab(a.id)===c}),m="y2"===c?Xh:Oh,n="y2"===c?Wh:Nh,o=b(m)?m:Xb(l),p=b(n)?n:Yb(l),q="y2"===c?Yh:Ph,r=yd()&&th;return 0===l.length?"y2"===c?Cg.domain():Bg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=zd(o,p),j=cc(Bg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Th&&(f=b(Th.top)?Th.top:e,g=b(Th.bottom)?Th.bottom:e),"y2"===c&&ai&&(f=b(ai.top)?ai.top:e,g=b(ai.bottom)?ai.bottom:e),fe(l)&&!Sc(l)&&(g=o),[o-g,p+f])}function $b(a){return Hh?Si?ye(Hh):Hh:Jf.min(a,function(a){return Jf.min(a.values,function(a){return a.x})})}function _b(a){return Gh?Si?ye(Gh):Gh:Jf.max(a,function(a){return Jf.max(a.values,function(a){return a.x})})}function ac(a){var c,d,e,f,g=Dc(a),h=g[1]-g[0];return Ti?d=0:fe(a)?(c=Bc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Ih&&De(Ih)?(e=b(Ih.left)?Ih.left:d,f=b(Ih.right)?Ih.right:d):e=f="number"==typeof Ih?Ih:d,{left:e,right:f}}function bc(a){var b=[$b(a),_b(a)],c=b[0],d=b[1],e=ac(a),f=0,g=0;return c-d!==0||Ti||(c=Si?new Date(.5*c.getTime()):-.5,d=Si?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Si?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Si?new Date(d.getTime()+e.right):d+e.right),[f,g]}function cc(a){return a[1]-a[0]}function dc(a){for(var b=0;bb?0:b-c}function jc(a){var b,c=hc(a),d="y"===a.axis?Bg:Cg;return b="y"===a.axis||"y2"===a.axis?th?fg:"start"in a?d(a.start):fg:th?"end"in a?Ag(Si?ye(a.end):a.end):fg:fg,c>b?0:b-c}function kc(a){return Kg&&a===Kg||De(Lg)&&Ee(Lg,a)}function lc(a){return!kc(a)}function mc(a){return Kg?Kg:De(Lg)?Lg[a]:null}function nc(a,b){var c,d=b&&De(b)?Ec(b):[];return d.forEach(function(b){mc(b)===a&&(c=Kf.data.xs[b])}),c}function oc(a,b){return a in Kf.data.xs&&Kf.data.xs[a]&&Kf.data.xs[a][b]?Kf.data.xs[a][b]:b}function pc(a){Object.keys(a).forEach(function(b){Lg[b]=a[b]})}function qc(a){return 1===Jf.set(Object.keys(a).map(function(b){return a[b]})).size()}function rc(a){var b;return a&&(b=Og[a.id],a.name=b?b:a.id),a}function sc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=uc(b[d],a.id,d)}),Kf.data.xs[a.id]=b})}function tc(a,b){a.forEach(function(a){b[a.id]&&sc([a],b[a.id])})}function uc(a,c,d){var e;return e=Si?a?a instanceof Date?a:ye(a):ye(oc(c,d)):Ui&&!Ti?b(a)?+a:oc(c,d):d}function vc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Kf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Kg?(d=Object.keys(Kf.data.xs),Kf.data.xs[c]=d.length>0?Kf.data.xs[d[0]]:void 0):De(Lg)&&(Kf.data.xs[c]=nc(f,Kf.data.targets)):Kf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Kf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Ng(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=mc(b),g=a[f],h=uc(g,b,e);return Ui&&Ti&&0===c&&g&&(0===e&&(xh=[]),xh.push(g)),("undefined"==typeof a[b]||Kf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Sg&&de(Ec(c).filter(function(a){return!(a in Tg)}),Sg),c.forEach(function(a){ec(a.id_org,a)}),c}function yc(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 zc(a){return a>0&&Kf.data.targets[0].values[a-1]?Kf.data.targets[0].values[a-1].x:void 0}function Ac(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Dc(a){var b,c,d=Cc(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Ec(a){return a.map(function(a){return a.id})}function Fc(a){return a?"string"==typeof a?[a]:a:Ec(Kf.data.targets)}function Gc(a,b){var c,d=Ec(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Si?new Date(i):i);j.push(e)}return Si||(j=j.sort(function(a,b){return a-b})),j}function Mc(a){cj=cj.concat(a)}function Nc(a){cj=cj.filter(function(b){return a.indexOf(b)<0})}function Oc(a){dj=dj.concat(a)}function Pc(a){dj=dj.filter(function(b){return a.indexOf(b)<0})}function Qc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Rc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Tc(a){return Rc(a,function(a){return a>0})}function Uc(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||0===a[f].x)&&(e=e.concat(Kd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Kd(a,g))),Nd(e,b)):Ld(a,b,f,g)}function Md(a,b){var c;return c=a.map(function(a){return Ld(a.values,b)}),Nd(c,b)}function Nd(a,b){var c,d;return a.forEach(function(a){var e=Fe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Od(a,b){return Jf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Pd(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 Qd(){return Vg&&"desc"===Vg.toLowerCase()}function Rd(){return Vg&&"asc"===Vg.toLowerCase()}function Sd(a){var b=Rd(),c=Qd();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 Vg&&a.sort(Vg),a}function Td(a,c){var d,e,f,g,h,i,j,k=je(Kf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&Fi&&(Cj.html(Ii(a,bb(),Ad(k),_i)).style("display","block"),d=Cj.property("offsetWidth"),e=Cj.property("offsetHeight"),k?(g=dg/2+c[0],i=fg/2+c[1]+20):(th?(f=s(),g=f+c[0]+100,h=g+d,j=t()-w(),i=Ag(l[0].x)+20):(f=s(),g=f+v()+Ag(l[0].x)+20,h=g+d,j=f+t()-w(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),Cj.style("top",i+"px").style("left",g+"px"))}function Ud(){Cj.style("display","none")}function Vd(a){var c=a.filter(function(a){return a&&b(a.value)});if(Fi&&!ge(Kf.data.targets)&&!je(Kf.data.targets)){var d=zj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(th?"y1":"x1",Gd).attr(th?"y2":"x2",Gd),mf(d,"grid")}}function Wd(){zj.select("line."+g.xgridFocus).style("visibility","hidden")}function Xd(a,b){var c,d,e,f,h=[],i=zj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=bc(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function Yd(a){return a.x||0===a.x?Ag(a.x):null}function Zd(a){return Y(a.id)(a.value)}function $d(){var a,b,d={},e=0;return Jc(Kf.data.targets.filter(me)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ce(a,b){return"number"==typeof pi?pi:b?2*a.tickOffset()*qi/b:0}function de(a,b){Fc(a).forEach(function(a){Gj[a]=b===Tg[a],Tg[a]=b})}function ee(a,b){var c=!1;return a.forEach(function(a){Tg[a.id]===b&&(c=!0),a.id in Tg||"line"!==b||(c=!0)}),c}function fe(a){return ee(a,"bar")}function ge(a){return ee(a,"scatter")}function he(a){return ee(a,"pie")}function ie(a){return ee(a,"donut")}function je(a){return he(a)||ie(a)}function ke(a){var b="string"==typeof a?a:a.id;return!(b in Tg)||"line"===Tg[b]||"spline"===Tg[b]||"area"===Tg[b]||"area-spline"===Tg[b]}function le(a){var b="string"==typeof a?a:a.id;return"spline"===Tg[b]||"area-spline"===Tg[b]}function me(a){var b="string"==typeof a?a:a.id;return"bar"===Tg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"scatter"===Tg[b]}function oe(a){var b="string"==typeof a?a:a.id;return"pie"===Tg[b]}function pe(a){var b="string"==typeof a?a:a.id;return"donut"===Tg[b]}function qe(a){return oe(a)||pe(a)}function re(a){return ke(a)?[a]:[]}function se(a){return qe(a.data)?[a]:[]}function te(a){return me(a)?a.values:[]}function ue(a){return ke(a)||ne(a)?a.values:[]}function ve(a){return me(a)||ke(a)?a.values:[]}function we(a){return pe(a)&&zi||oe(a)&&ti}function xe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ye(b){var c;try{c=Mg?Jf.time.format(Mg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Mg)}return c}function ze(a,b){var c=Jf.mouse(a),d=Jf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ee(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Fe(a,b){var c="y"===ab(a.id)?Bg:Cg,d=th?1:0,e=th?0:1;return Math.pow(Ag(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ge(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function He(a,b,c){return d(a[b])?a[b]:c}function Ie(a,b,c){gh(b,a.node()),zj.select("."+g.selectedCircles+pd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Vc(g.selectedCircle,c)}).attr("cx",th?Zd:Yd).attr("cy",th?Yd:Zd).attr("stroke",function(){return _i(b)}).attr("r",1.4*Te(b)).transition().duration(100).attr("r",Te)}function Je(a,b,c){hh(b,a.node()),zj.select("."+g.selectedCircles+pd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ke(a,b,c,d){a?Ie(b,c,d):Je(b,c,d)}function Le(a,b){gh(b,a.node()),a.transition().duration(100).style("fill",function(){return Jf.rgb(_i(b)).brighter(.75)})}function Me(a,b){hh(b,a.node()),a.transition().duration(100).style("fill",function(){return _i(b)})}function Ne(a,b,c,d){a?Le(b,c,d):Me(b,c,d)}function Oe(a,b,c,d){Ne(a,b,c.data,d)}function Pe(a){return"circle"===a.nodeName?Ke:Jf.select(a).classed(g.bar)?Ne:Oe}function Qe(a){return a.filter(function(a){return b(a.value)})}function Re(a){return ii?"function"==typeof ji?ji(a):ji:0}function Se(a){return li?mi?mi:1.75*Re(a):Re(a)}function Te(a){return ni?ni:4*Re(a)}function Ue(a,c){return(c?zj.selectAll("."+g.circles+pd(c)):zj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ve(a,b){Ue(a,b).classed(g.EXPANDED,!0).attr("r",Se)}function We(a){Ue(a).filter(function(){return Jf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Re)}function Xe(a){return zj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function Ye(a){Xe(a).classed(g.EXPANDED,!0)}function Ze(a){Xe(a).classed(g.EXPANDED,!1)}function $e(a,b){var c=cf(a,b);return function(a,b){var d=c(a,b),e=th?1:0,f=th?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 _e(a,b){var c=cf(a,!1),d=b?af:bf;return function(a,b){return d(c(a,b),a,this)}}function af(a,b){var c;return th?(c=me(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function bf(a,b,c){var d=c.getBoundingClientRect();return th?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:me(b)?-3:-6)}function cf(a,b){var c=a.__max__+1,d=ce(Gg,c),e=_d(d,c,a,!!b),f=ae(!!b),g=be(a,!!b),h=b?Z:Y;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return th&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function df(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function ef(b){var c,d,e;if(Dj=Jf.select(Mf),Dj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Dj.html("").classed("c3",!0),Kf.data.xs={},Kf.data.targets=xc(b),$g&&(Kf.data.targets=Kf.data.targets.filter($g)),Zg&&Mc(Zg===!0?Ec(Kf.data.targets):Zg),p(),T(),Ag.domain(Jf.extent(bc(Kf.data.targets))),Bg.domain(Zb(Kf.data.targets,"y")),Cg.domain(Zb(Kf.data.targets,"y2")),Dg.domain(Ag.domain()),Eg.domain(Bg.domain()),Fg.domain(Cg.domain()),Ej=Ag.domain(),sj.scale(Dg),Tf&&wj.scale(Ag),xj=Dj.append("svg").on("mouseenter",Xf).on("mouseleave",Yf),yj=xj.append("defs"),yj.append("clipPath").attr("id",Mi).append("rect"),yj.append("clipPath").attr("id",Ni).append("rect"),yj.append("clipPath").attr("id",Oi).append("rect"),rf(),zj=xj.append("g").attr("transform",jj.main),Aj=xj.append("g").attr("transform",jj.context),Bj=xj.append("g").attr("transform",jj.legend),kh||Aj.style("visibility","hidden"),nh||(Bj.style("visibility","hidden"),dj=Ec(Kf.data.targets)),Cj=Jf.select(Mf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Ef(Ec(Kf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=zj.append("g").attr("clip-path",Pi).attr("class",g.grid),ci&&d.append("g").attr("class",g.xgrids),De(ei)&&d.append("g").attr("class",g.xgridLines),ki&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),fi&&d.append("g").attr("class",g.ygrids),De(gi)&&d.append("g").attr("class",g.ygridLines),zj.append("g").attr("clip-path",Pi).attr("class",g.regions),zj.append("g").attr("clip-path",Pi).attr("class",g.chart),c=zj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Tf?th?"ns-resize":"ew-resize":null),zj.select("."+g.chart).append("g").attr("class",g.chartBars),zj.select("."+g.chart).append("g").attr("class",g.chartLines),zj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",jj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Tb()),zj.select("."+g.chart).append("g").attr("class",g.chartTexts),Tf&&zj.insert("rect",Vf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",dg).attr("height",fg).style("opacity",0).style("cursor",th?"ns-resize":"ew-resize").call(wj).on("dblclick.zoom",null),Kh&&sj.extent("function"!=typeof Kh?Kh:Kh(bc())),ej.x=zj.append("g").attr("class",g.axisX).attr("clip-path",Qi).attr("transform",jj.x).style("visibility",uh?"visible":"hidden"),ej.x.append("text").attr("class",g.axisXLabel).attr("transform",th?"rotate(-90)":"").style("text-anchor",Cb),ej.y=zj.append("g").attr("class",g.axisY).attr("clip-path",Ri).attr("transform",jj.y).style("visibility",Mh?"visible":"hidden"),ej.y.append("text").attr("class",g.axisYLabel).attr("transform",th?"":"rotate(-90)").style("text-anchor",Db),ej.y2=zj.append("g").attr("class",g.axisY2).attr("transform",jj.y2).style("visibility",Vh?"visible":"hidden"),ej.y2.append("text").attr("class",g.axisY2Label).attr("transform",th?"":"rotate(-90)").style("text-anchor",Eb),Aj.append("g").attr("clip-path",Pi).attr("class",g.chart),Aj.select("."+g.chart).append("g").attr("class",g.chartBars),Aj.select("."+g.chart).append("g").attr("class",g.chartLines),Aj.append("g").attr("clip-path",Pi).attr("class",g.brush).call(sj).selectAll("rect").attr(th?"width":"height",th?eg:gg),ej.subx=Aj.append("g").attr("class",g.axisX).attr("transform",jj.subx).attr("clip-path",th?"":Qi),uf(Kf.data.targets),th?zj.select("."+g.axisX).style("opacity",0).call(Gg):(zj.select("."+g.axisY).style("opacity",0).call(Hg),zj.select("."+g.axisY2).style("opacity",0).call(Ig)),p(),T(),rf(),o(!1),nf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Ji){if(Si&&"string"==typeof Ki){for(Ki=ye(Ki),e=0;e0){d=[];for(var f in Og)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Pd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ne,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function kf(a){je(Kf.data.targets)||_g&&(Vi=a,zj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Wi=!0,ih())}function lf(){je(Kf.data.targets)||_g&&(zj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),zj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Wi=!1,jh())}function mf(a,b){"grid"===b&&a.each(function(){var a=Jf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function nf(a,c){var d,e,f,h,i,j,k,l,m,n,o,p,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,O,P,Q,R,S,T,U,V,W=$d(),X=je(Kf.data.targets),Y=Jc(Kf.data.targets);if(a=a||{},C=He(a,"withY",!0),D=He(a,"withSubchart",!0),E=He(a,"withTransition",!0),H=He(a,"withTransform",!1),I=He(a,"withUpdateXDomain",!1),J=He(a,"withUpdateOrgXDomain",!1),K=He(a,"withLegend",!1),F=He(a,"withTransitionForExit",E),G=He(a,"withTransitionForAxis",E),Q=E?_f:0,R=F?Q:0,S=G?Q:0,c=c||sf(S),K&&nh&&Ef(Ec(Kf.data.targets),a,c),Ti&&0===Y.length&&Ag.domain([0,ej.x.selectAll(".tick").size()]),Y.length&&(J&&(Ag.domain(Jf.extent(bc(Y))),Ej=Ag.domain(),Tf&&wj.scale(Ag).updateScaleExtent(),Dg.domain(Ag.domain()),sj.scale(Dg)),I&&(Ag.domain(sj.empty()?Ej:sj.extent()),Tf&&wj.scale(Ag).updateScaleExtent()),Eh||!Dh&&!Ch||(T=Lc(Kc(Y),Ch),Gg.tickValues(T),Jg.tickValues(T))),Bg.domain(Zb(Y,"y")),Cg.domain(Zb(Y,"y2")),ej.x.style("opacity",X?0:1),ej.y.style("opacity",X?0:1),ej.y2.style("opacity",X?0:1),ej.subx.style("opacity",X?0:1),c.axisX.call(Gg),c.axisY.call(Hg),c.axisY2.call(Ig),c.axisSubX.call(Jg),Gb(E),I&&Y.length)if(Ah&&T){for(U=1;U=0&&Jf.select(this).style("display",b%V?"none":"block")})}else xj.selectAll("."+g.axisX+" .tick text").style("display","block");!th&&Fh&&hb(ej.x,c.axisX,Fh),L=$e(W),O=_e(W,!0),P=_e(W,!1),Eg.domain(Bg.domain()),Fg.domain(Cg.domain()),Cj.style("display","none"),q(),zj.select("line."+g.xgridFocus).style("visibility","hidden"),ci&&(f=Xd(di,Ag),z=Ti?Gg.tickOffset():0,e=th?{x1:0,x2:dg,y1:function(a){return Ag(a)-z},y2:function(a){return Ag(a)-z}}:{x1:function(a){return Ag(a)+z},x2:function(a){return Ag(a)+z},y1:ag.top,y2:fg},d=zj.select("."+g.xgrids).selectAll("."+g.xgrid).data(f),d.enter().append("line").attr("class",g.xgrid),d.attr(e).style("opacity",function(){return+Jf.select(this).attr(th?"y1":"x1")===(th?fg:0)?0:1}),d.exit().remove()),De(ei)&&(h=zj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(ei),i=h.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),i.append("line").style("opacity",0),i.append("text").attr("text-anchor","end").attr("transform",th?"":"rotate(-90)").attr("dx",th?0:-ag.top).attr("dy",-5).style("opacity",0),h.select("line").transition().duration(Q).attr("x1",th?0:Hd).attr("x2",th?dg:Hd).attr("y1",th?Hd:ag.top).attr("y2",th?Hd:fg).style("opacity",1),h.select("text").transition().duration(Q).attr("x",th?dg:0).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),h.exit().transition().duration(Q).style("opacity",0).remove()),C&&fi&&(j=zj.select("."+g.ygrids).selectAll("."+g.ygrid).data(Bg.ticks(hi)),j.enter().append("line").attr("class",g.ygrid),j.attr("x1",th?Bg:0).attr("x2",th?Bg:dg).attr("y1",th?0:Bg).attr("y2",th?fg:Bg),j.exit().remove(),mf(j,"grid")),C&&De(gi)&&(k=zj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(gi),l=k.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",th?"rotate(-90)":"").attr("dx",th?0:-ag.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(Q).attr("x1",th?Id:0).attr("x2",th?Id:dg).attr("y1",th?0:Id).attr("y2",th?fg:Id).style("opacity",1),k.select("text").transition().duration(Q).attr("x",th?0:dg).attr("y",Id).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(Q).style("opacity",0).remove()),s=zj.select("."+g.regions).selectAll("."+g.region).data(Ei),s.enter().append("g").attr("class",id).append("rect").style("fill-opacity",0),s.selectAll("rect").transition().duration(Q).attr("x",gc).attr("y",hc).attr("width",ic).attr("height",jc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(Q).style("opacity",0).remove(),p=zj.selectAll("."+g.bars).selectAll("."+g.bar).data(te),p.enter().append("path").attr("class",cd).style("stroke","none").style("fill",_i),p.style("opacity",ud).transition().duration(Q).attr("d",L).style("fill",_i).style("opacity",1),p.exit().transition().duration(R).style("opacity",0).remove(),m=zj.selectAll("."+g.lines).selectAll("."+g.line).data(re),m.enter().append("path").attr("class",$c).style("stroke",_i),m.style("opacity",ud).transition().duration(Q).attr("d",tj).style("stroke",_i).style("opacity",1),m.exit().transition().duration(R).style("opacity",0).remove(),n=zj.selectAll("."+g.areas).selectAll("."+g.area).data(re),n.enter().append("path").attr("class",gd).style("fill",_i).style("opacity",function(){return Fj=+Jf.select(this).style("opacity"),0}),n.style("opacity",0).transition().duration(Q).attr("d",uj).style("fill",_i).style("opacity",Fj),n.exit().transition().duration(R).style("opacity",0).remove(),o=zj.selectAll("."+g.circles).selectAll("."+g.circle).data(ue),o.enter().append("circle").attr("class",ad).attr("r",Re).style("fill",_i),o.style("opacity",ud).transition().duration(Q).style("opacity",wd).style("fill",_i).attr("cx",th?Zd:Yd).attr("cy",th?Yd:Zd),o.exit().remove(),t=zj.selectAll("."+g.texts).selectAll("."+g.text).data(ve),t.enter().append("text").attr("class",Wc).attr("text-anchor",function(a){return th?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",_i).style("fill-opacity",0),t.text(function(a){return Fd(a.id)(a.value,a.id)}).style("fill-opacity",vd).transition().duration(Q).attr("x",O).attr("y",P).style("fill",_i).style("fill-opacity",xd),t.exit().transition().duration(R).style("fill-opacity",0).remove(),r=zj.selectAll("."+g.arcs).selectAll("."+g.arc).data(se),r.enter().append("path").attr("class",ed).style("fill",function(a){return _i(a.data)}).style("cursor",function(a){return bh(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Zi||(c=Hb(a),d=Nb(c),e=Vb(),Pb(c.data.id),Af(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Hb(a),c=Nb(b),d=[c];Td(d,Jf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Zi||(c=Hb(a),d=Nb(c),e=Wb(),Qb(c.data.id),Bf(),Ud(),e(d,b))}).on("click",function(a,b){var c=Hb(a),d=Nb(c),e=Ub();hf(this,a,b),e(d,b)}),r.attr("transform",H?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Zi=!0}).transition().duration(Q).attrTween("d",function(a){var b,c=Hb(a);return c?(b=Jf.interpolate(this._current,c),this._current=b(0),function(a){return Kb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",H?"scale(1)":"").style("fill",function(a){return _i(a.data)}).style("opacity",1).call(Ge,function(){Zi=!1}),r.exit().transition().duration(R).style("opacity",0).remove(),zj.selectAll("."+g.chartArc).select("text").attr("transform",Lb).style("opacity",0).transition().duration(Q).text(Ob).style("opacity",function(a){return Hc(a.data.id)&&qe(a.data)?1:0}),zj.select("."+g.chartArcsTitle).style("opacity",ie(Kf.data.targets)?1:0),kh&&(Jf.event&&"zoom"===Jf.event.type&&sj.extent(Ag.orgDomain()).update(),D&&(!th&&Fh&&hb(ej.subx,c.axisSubX,Fh),sj.empty()||sj.extent(Ag.orgDomain()).update(),M=$e(W,!0),v=Aj.selectAll("."+g.bars).selectAll("."+g.bar).data(te),v.enter().append("path").attr("class",cd).style("stroke","none").style("fill",_i),v.style("opacity",ud).transition().duration(Q).attr("d",M).style("opacity",1),v.exit().transition().duration(Q).style("opacity",0).remove(),u=Aj.selectAll("."+g.lines).selectAll("."+g.line).data(re),u.enter().append("path").attr("class",$c).style("stroke",_i),u.style("opacity",ud).transition().duration(Q).attr("d",vj).style("opacity",1),u.exit().transition().duration(Q).style("opacity",0).remove())),zj.selectAll("."+g.selectedCircles).filter(function(a){return me(a)}).selectAll("circle").remove(),zj.selectAll("."+g.selectedCircle).transition().duration(Q).attr("cx",th?Zd:Yd).attr("cy",th?Yd:Zd),Wf&&(w=zj.select("."+g.eventRects),De(Lg)&&!qc(Lg)?(w.classed(g.eventRectsMultiple)||w.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),x=zj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),gf(x.enter()),x.attr("x",0).attr("y",0).attr("width",dg).attr("height",fg)):(w.classed(g.eventRectsSingle)||w.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Ui&&!Ti?(B=function(a,b){var c=zc(b),d=Ac(b),e=Kf.data.xs[a.id][b];return(Ag(d?d:e+50)-Ag(c?c:e-50))/2},A=function(a,b){var c=zc(b),d=Kf.data.xs[a.id][b];return(Ag(d)+Ag(c?c:d-50))/2}):(B=N(),A=function(a){return Ag(a.x)-B/2}),y=Cc(Kf.data.targets),zj.select("."+g.eventRects).datum(y?y.values:[]),x=zj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),ff(x.enter()),x.attr("class",jd).attr("x",th?0:A).attr("y",th?A:0).attr("width",th?dg:B).attr("height",th?B:fg),x.exit().remove())),Ec(Kf.data.targets).forEach(function(a){Gj[a]=!0})}function of(){nf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function pf(){if(0!==Jc(Kf.data.targets).length){if("mousemove"===Jf.event.sourceEvent.type&&wj.altDomain)return Ag.domain(wj.altDomain),void wj.scale(Ag).updateScaleExtent();Ti&&Ag.orgDomain()[0]===Ej[0]&&Ag.domain([Ej[0]-1e-10,Ag.orgDomain()[1]]),nf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Jf.event.sourceEvent.type&&(Xi=!0)}}function qf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function rf(){xj.attr("width",hg).attr("height",ig),xj.select("#"+Mi).select("rect").attr("width",dg).attr("height",fg),xj.select("#"+Ni).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),xj.select("#"+Oi).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),xj.select("."+g.zoomRect).attr("width",dg).attr("height",fg),Dj.style("max-height",ig+"px")}function sf(a){return{axisX:a?ej.x.transition().duration(a):ej.x,axisY:a?ej.y.transition().duration(a):ej.y,axisY2:a?ej.y2.transition().duration(a):ej.y2,axisSubX:a?ej.subx.transition().duration(a):ej.subx}}function tf(a){var b;a=a||{},a.withTransition=He(a,"withTransition",!0),a.withTransform=He(a,"withTransform",!1),a.withLegend=He(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withLegend&&nh||(b=sf(a.withTransitionForAxis?_f:0),p(),T(),rf(),o(a.withTransition,b)),nf(a,b)}function uf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=zj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",ld),j=i.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Xc),e=zj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",nd),d=e.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",dd).style("cursor",function(a){return bh(a)?"pointer":null}),c=zj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",md),b=c.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",_c),b.append("g").attr("class",hd),b.append("g").attr("class",function(a){return Vc(g.selectedCircles,a.id)}),b.append("g").attr("class",bd).style("cursor",function(a){return bh(a)?"pointer":null}),a.forEach(function(a){zj.selectAll("."+g.selectedCircles+pd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=zj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(rg(a)).attr("class",od),f=h.enter().append("g").attr("class",od),f.append("g").attr("class",fd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),kh&&(n=Aj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",nd),m=n.enter().append("g").style("opacity",0).attr("class",nd),m.append("g").attr("class",dd),l=Aj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",md),k=l.enter().append("g").style("opacity",0).attr("class",md),k.append("g").attr("class",_c)),xj.selectAll("."+g.target).filter(function(a){return Hc(a.id)}).transition().duration(_f).style("opacity",1)}function vf(a,b){b.filter&&(a=a.filter(b.filter)),(b.type||b.types)&&a.forEach(function(a){b.types?de(a.id,b.types[a.id]):de(a.id,b.type)}),Kf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,z=0,F++)),E[a]=F,D[F]=f,A[a]=z,z+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+v)/10),j=10*Math.ceil((h.height+u)/10),k=kj?j:i,l=kj?S():R();return d&&(z=0,F=0,w=0,x=0),nh&&!Ic(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=i,C[c]=j,(!w||i>=w)&&(w=i),(!x||j>=x)&&(x=j),g=kj?x:w,void(sh?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(l-g*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=26,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=Bj.selectAll("."+g.legendItemFocused).size();b=b||{},n=He(b,"withTransition",!0),q=He(b,"withTransitionForTransform",!0),kj?(f=function(a){return w*E[a]},j=function(a){return D[E[a]]+A[a]}):(f=function(a){return D[E[a]]+A[a]},j=function(a){return x*E[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=Bj.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Vc(g.legendItem,a)}).style("visibility",function(a){return Ic(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof ph?ph(a):Kf.toggle(a)}).on("mouseover",function(a){Jf.select(this).classed(g.legendItemFocused,!0),Zi||Kf.focus(a),"function"==typeof qh&&qh(a)}).on("mouseout",function(a){Jf.select(this).classed(g.legendItemFocused,!1),Zi||Kf.revert(),"function"==typeof rh&&rh(a)}),m.append("text").text(function(a){return d(Og[a])?Og[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",kj?h:-200).attr("y",kj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",kj?i:-200).attr("y",kj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",_i).attr("x",kj?h:-200).attr("y",kj?-200:j).attr("width",10).attr("height",10),r=Bj.selectAll("text").data(a).text(function(a){return d(Og[a])?Og[a]:a}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=Bj.selectAll("rect."+g.legendItemEvent).data(a),(n?s.transition():s).attr("width",function(a){return B[a]}).attr("height",function(a){return C[a]}).attr("x",i).attr("y",l),t=Bj.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",_i).attr("x",f).attr("y",j),Bj.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Hc(a)}).transition().style("opacity",function(a){var b=Jf.select(this);return Hc(a)?!G||b.classed(g.legendItemFocused)?yf(b):zf(b):oj}),P(w),Q(x),O(F),p(),T(),rf(),o(q,c)}function Ff(a){return Gc(Kf.data.targets,a.id)}function Gf(a){return"data"in a&&Gc(Kf.data.targets,a.data.id)}function Hf(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 If(a,b,c){var d=!je(Kf.data.targets);Zi=!1,de(a,b),tf(c||{withTransitionForAxis:d})}var Jf=a.d3?a.d3:a.require?a.require("d3"):void 0,Kf={data:{},axis:{},legend:{}},Lf={},Mf=i(["bindto"],"#chart"),Nf=i(["size","width"]),Of=i(["size","height"]),Pf=i(["padding","left"],50),Qf=i(["padding","right"],10),Rf=i(["padding","top"],0),Sf=i(["padding","bottom"],0),Tf=i(["zoom","enabled"],!1),Uf=i(["zoom","extent"]),Vf=i(["zoom","privileged"],!1),Wf=i(["interaction","enabled"],!0),Xf=i(["onenter"],function(){}),Yf=i(["onleave"],function(){}),Zf=i(["onresize"],function(){}),$f=i(["onresized"],function(){}),_f=i(["transition","duration"],350);h("data","data is required in config");var ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg,Kg=i(["data","x"]),Lg=i(["data","xs"],{}),Mg=i(["data","x_format"]),Ng=i(["data","id_converter"],function(a){return a}),Og=i(["data","names"],{}),Pg=i(["data","classes"],{}),Qg=i(["data","groups"],[]),Rg=i(["data","axes"],{}),Sg=i(["data","type"]),Tg=i(["data","types"],{}),Ug=i(["data","labels"],{}),Vg=i(["data","order"]),Wg=i(["data","regions"],{}),Xg=i(["data","color"]),Yg=i(["data","colors"],{}),Zg=i(["data","hide"],!1),$g=i(["data","filter"]),_g=i(["data","selection","enabled"],!1),ah=i(["data","selection","grouped"],!1),bh=i(["data","selection","isselectable"],function(){return!0}),ch=i(["data","selection","multiple"],!0),dh=i(["data","onclick"],function(){}),eh=i(["data","onenter"],function(){}),fh=i(["data","onleave"],function(){}),gh=i(["data","onselected"],function(){}),hh=i(["data","onunselected"],function(){}),ih=i(["data","ondragstart"],function(){}),jh=i(["data","ondragend"],function(){}),kh=i(["subchart","show"],!1),lh=i(["subchart","size","height"],60),mh=i(["color","pattern"],[]),nh=i(["legend","show"],!0),oh=i(["legend","position"],"bottom"),ph=i(["legend","item","onclick"]),qh=i(["legend","item","onmouseover"]),rh=i(["legend","item","onmouseout"]),sh=i(["legend","equally"],!1),th=i(["axis","rotated"],!1),uh=i(["axis","x","show"],!0),vh=i(["axis","x","type"],"indexed"),wh=i(["axis","x","localtime"],!0),xh=i(["axis","x","categories"],[]),yh=i(["axis","x","tick","centered"],!1),zh=i(["axis","x","tick","format"]),Ah=i(["axis","x","tick","culling"],{}),Bh=i(["axis","x","tick","culling","max"],10),Ch=i(["axis","x","tick","count"]),Dh=i(["axis","x","tick","fit"],!0),Eh=i(["axis","x","tick","values"],null),Fh=i(["axis","x","tick","rotate"]),Gh=i(["axis","x","max"],null),Hh=i(["axis","x","min"],null),Ih=i(["axis","x","padding"],{}),Jh=i(["axis","x","height"]),Kh=i(["axis","x","default"]),Lh=i(["axis","x","label"],{}),Mh=i(["axis","y","show"],!0),Nh=i(["axis","y","max"]),Oh=i(["axis","y","min"]),Ph=i(["axis","y","center"]),Qh=i(["axis","y","label"],{}),Rh=i(["axis","y","inner"],!1),Sh=i(["axis","y","tick","format"]),Th=i(["axis","y","padding"]),Uh=i(["axis","y","ticks"],10),Vh=i(["axis","y2","show"],!1),Wh=i(["axis","y2","max"]),Xh=i(["axis","y2","min"]),Yh=i(["axis","y2","center"]),Zh=i(["axis","y2","label"],{}),$h=i(["axis","y2","inner"],!1),_h=i(["axis","y2","tick","format"]),ai=i(["axis","y2","padding"]),bi=i(["axis","y2","ticks"],10),ci=i(["grid","x","show"],!1),di=i(["grid","x","type"],"tick"),ei=i(["grid","x","lines"],[]),fi=i(["grid","y","show"],!1),gi=i(["grid","y","lines"],[]),hi=i(["grid","y","ticks"],10),ii=i(["point","show"],!0),ji=i(["point","r"],2.5),ki=i(["point","focus","line","enabled"],!0),li=i(["point","focus","expand","enabled"],!0),mi=i(["point","focus","expand","r"]),ni=i(["point","focus","select","r"]),oi=i(["line","connect_null"],!1),pi=i(["bar","width"]),qi=i(["bar","width","ratio"],.6),ri=i(["pie","label","show"],!0),si=i(["pie","label","format"]),ti=i(["pie","expand"],!0),ui=i(["pie","onclick"],function(){}),vi=i(["pie","onmouseover"],function(){}),wi=i(["pie","onmouseout"],function(){}),xi=i(["donut","label","show"],!0),yi=i(["donut","label","format"]),zi=i(["donut","expand"],!0),Ai=i(["donut","title"],""),Bi=i(["donut","onclick"],function(){}),Ci=i(["donut","onmouseover"],function(){}),Di=i(["donut","onmouseout"],function(){}),Ei=i(["regions"],[]),Fi=i(["tooltip","show"],!0),Gi=i(["tooltip","format","title"]),Hi=i(["tooltip","format","value"]),Ii=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Gi?Gi:b,l=Hi?Hi:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Ji=i(["tooltip","init","show"],!1),Ki=i(["tooltip","init","x"],0),Li=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Mi=("string"==typeof Mf?Mf.replace("#",""):Mf.id)+"-clip",Ni=Mi+"-xaxis",Oi=Mi+"-yaxis",Pi=j(Mi),Qi=j(Ni),Ri=j(Oi),Si="timeseries"===vh,Ti="categorized"===vh,Ui=!Si&&(Kg||De(Lg)),Vi=null,Wi=!1,Xi=!1,Yi=!1,Zi=!1,$i=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],_i=xe(Yg,De(mh)?mh:$i,Xg),aj=wh?Jf.time.format:Jf.time.format.utc,bj=aj.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),cj=[],dj=[],ej={},fj=th?"left":"bottom",gj=th?Rh?"top":"bottom":Rh?"right":"left",hj=th?$h?"bottom":"top":$h?"left":"right",ij=th?"left":"bottom",jj={main:function(){return"translate("+k(ag.left)+","+k(ag.top)+")"},context:function(){return"translate("+k(bg.left)+","+k(bg.top)+")"},legend:function(){return"translate("+cg.left+","+cg.top+")"},x:function(){return"translate(0,"+(th?0:fg)+")"},y:function(){return"translate(0,"+(th?fg:0)+")" -},y2:function(){return"translate("+(th?0:dg)+","+(th?1:0)+")"},subx:function(){return"translate(0,"+(th?0:gg)+")"},arc:function(){return"translate("+mg/2+","+ng/2+")"}},kj="right"===oh,lj=0,mj=0,nj=0,oj=.15,pj=30,qj=th&&!uh?0:30,rj=5;rg=Jf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var sj,tj=function(){var a=Jf.svg.line().x(th?function(a){return Y(a.id)(a.value)}:Gd).y(th?Gd:function(a){return Y(a.id)(a.value)});return oi||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=oi?Qe(b.values):b.values;return ke(b)?(a.interpolate(le(b)?"cardinal":"linear"),Wg[b.id]?df(e,Ag,Y(b.id),Wg[b.id]):a(e)):(c=e[0]?Ag(e[0].x):0,d=e[0]?Y(b.id)(e[0].value):0,th?"M "+d+" "+c:"M "+c+" "+d)}}(),uj=function(){var a;return a=th?Jf.svg.area().x0(function(a){return Y(a.id)(0)}).x1(function(a){return Y(a.id)(a.value)}).y(Gd):Jf.svg.area().x(Gd).y0(function(a){return Y(a.id)(0)}).y1(function(a){return Y(a.id)(a.value)}),function(b){var c,d,e=Qe(b.values);return ee([b],"area")||ee([b],"area-spline")?(a.interpolate(le(b)?"cardinal":"linear"),a(e)):(c=e[0]?Ag(e[0].x):0,d=e[0]?Y(b.id)(e[0].value):0,th?"M "+d+" "+c:"M "+c+" "+d)}}(),vj=function(){var a=Jf.svg.line().x(th?function(a){return Z(a.id)(a.value)}:Jd).y(th?Jd:function(a){return Z(a.id)(a.value)});return function(b){var c=Qe(b.values);return ke(b)?a(c):"M "+Dg(c[0].x)+" "+Z(b.id)(c[0].value)}}(),wj=function(){};sj=Jf.svg.brush().on("brush",of),sj.update=function(){return Aj&&Aj.select("."+g.brush).call(this),this},sj.scale=function(a){return th?this.y(a):this.x(a)},Tf&&(wj=Jf.behavior.zoom().on("zoomstart",function(){wj.altDomain=Jf.event.sourceEvent.altKey?Ag.orgDomain():null}).on("zoom",Tf?pf:null),wj.scale=function(a){return th?this.y(a):this.x(a)},wj.orgScaleExtent=function(){var a=Uf?Uf:[1,10];return[a[0],Math.max(Bc()/a[1],a[1])]},wj.updateScaleExtent=function(){var a=cc(Ag.orgDomain())/cc(Ej),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var xj,yj,zj,Aj,Bj,Cj,Dj,Ej,Fj,Gj={};if(Kf.focus=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",1)}var c=xj.selectAll(qd(a)),d=c.filter(Ff),e=c.filter(Gf);Kf.revert(),Kf.defocus(),b(d.classed(g.focused,!0)),b(e),je(Kf.data.targets)&&Pb(a,!0),Af(a,!0)},Kf.defocus=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",.3)}var c=xj.selectAll(qd(a)),d=c.filter(Ff),e=c.filter(Gf);Kf.revert(),b(d.classed(g.focused,!1)),b(e),je(Kf.data.targets)&&Qb(a),Af(a,!1)},Kf.revert=function(a){function b(a){Jc(a).transition().duration(100).style("opacity",1)}var c=xj.selectAll(qd(a)),d=c.filter(Ff),e=c.filter(Gf);b(d.classed(g.focused,!1)),b(e),je(Kf.data.targets)&&Qb(a),Bf()},Kf.show=function(a,b){a=Fc(a),b=b||{},Nc(a),xj.selectAll(rd(a)).transition().style("opacity",1),b.withLegend&&Cf(a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Kf.hide=function(a,b){a=Fc(a),b=b||{},Mc(a),xj.selectAll(rd(a)).transition().style("opacity",0),b.withLegend&&Df(a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Kf.toggle=function(a){Hc(a)?Kf.hide(a):Kf.show(a)},Kf.unzoom=function(){sj.clear().update(),nf({withUpdateXDomain:!0})},Kf.load=function(a){return a.xs&&pc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Pg[b]=a.classes[b]}),"categories"in a&&Ti&&(xh=a.categories,Gg.categories(xh)),"cacheIds"in a&&dc(a.cacheIds)?void vf(fc(a.cacheIds),a.done):void("unload"in a?xf(Fc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){wf(a)}):wf(a))},Kf.unload=function(a,b){xf(Fc(a),function(){nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Kf.selected=function(a){return Jf.merge(zj.selectAll("."+g.shapes+pd(a)).selectAll("."+g.shape).filter(function(){return Jf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Kf.select=function(a,b,c){_g&&zj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Jf.select(this),i=e.data?e.data.id:e.id,j=Pe(this),k=ah||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);"path"!==this.nodeName&&(k&&l?bh(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},Kf.unselect=function(a,b){_g&&zj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Jf.select(this),f=c.data?c.data.id:c.id,h=Pe(this),i=ah||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);"path"!==this.nodeName&&i&&j&&bh(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Kf.toLine=function(a){If(a,"line")},Kf.toSpline=function(a){If(a,"spline")},Kf.toBar=function(a){If(a,"bar")},Kf.toScatter=function(a){If(a,"scatter")},Kf.toArea=function(a){If(a,"area")},Kf.toAreaSpline=function(a){If(a,"area-spline")},Kf.toPie=function(a){If(a,"pie",{withTransform:!0})},Kf.toDonut=function(a){If(a,"donut",{withTransform:!0})},Kf.groups=function(a){return c(a)?Qg:(Qg=a,nf(),Qg)},Kf.xgrids=function(a){return a?(ei=a,nf(),ei):ei},Kf.xgrids.add=function(a){return a?Kf.xgrids(ei.concat(a)):void 0},Kf.xgrids.remove=function(a){var b=Hf(a);return Kf.xgrids(ei.filter(b))},Kf.ygrids=function(a){return a?(gi=a,nf(),gi):gi},Kf.ygrids.add=function(a){return a?Kf.ygrids(gi.concat(a)):void 0},Kf.ygrids.remove=function(a){var b=Hf(a);return Kf.ygrids(gi.filter(b))},Kf.regions=function(a){return a?(Ei=a,nf(),Ei):Ei},Kf.regions.add=function(a){return a?(Ei=Ei.concat(a),nf(),Ei):Ei},Kf.regions.remove=function(a){var b,c,d;return a=a||{},b=He(a,"duration",_f),c=He(a,"classes",[g.region]),d=zj.select("."+g.regions).selectAll(c.map(function(a){return"."+a})),(b?d.transition().duration(b):d).style("opacity",0).remove(),Ei=Ei.filter(function(a){return c.indexOf(a.class)<0})},Kf.data.get=function(a){var b=Kf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Kf.data.getAsTarget=function(a){var b=Kf.data.targets.filter(function(b){return b.id===a});return b.length>0?b[0]:void 0},Kf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Og[b]=a[b]}),nf({withLegend:!0}),Og):Og},Kf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Yg[b]=a[b]}),nf({withLegend:!0}),Yg):Yg},Kf.x=function(a){return arguments.length&&(sc(Kf.data.targets,a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Kf.data.xs},Kf.xs=function(a){return arguments.length&&(tc(Kf.data.targets,a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Kf.data.xs},Kf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){eb(b,a[b])}),Gb())},Kf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Gh=+a.x),b(a.y)&&(Nh=+a.y),b(a.y2)&&(Wh=+a.y2)):Nh=Wh=+a,nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Kf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Hh=+a.x),b(a.y)&&(Oh=+a.y),b(a.y2)&&(Xh=+a.y2)):Oh=Xh=+a,nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Kf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Kf.axis.max(a.max),"undefined"!=typeof a.min&&Kf.axis.min(a.min))},Kf.legend.show=function(a){Cf(Fc(a)),nf({withLegend:!0})},Kf.legend.hide=function(a){Df(Fc(a)),nf({withLegend:!0})},Kf.resize=function(a){Nf=a?a.width:null,Of=a?a.height:null,tf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Kf.destroy=function(){Kf.data.targets=void 0,Kf.data.xs={},Dj.html(""),a.onresize=null},"url"in f.data)Jf.xhr(f.data.url,function(a,b){var c,d=Jf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Jf.csv.parse(b.response),ef(c)});else if("rows"in f.data)ef(vc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");ef(wc(f.data.columns))}return Kf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(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}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.round(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.round(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&agg&&(gg=0),0>ig&&(ig=0),hg=wh?dg.left-sj-tj:gg,jg=wh?ig:lg-eg.top-eg.bottom,0>hg&&(hg=0),0>jg&&(jg=0),pg=gg-(nj?b+10:0),qg=ig-(nj?0:10),r(),nj&&d&&(fg.left=pg/2+1.1*ng)}function q(){Cj.select("line."+g.xgridFocus).attr("x1",wh?0:-10).attr("x2",wh?gg:-10).attr("y1",wh?-10:dg.top).attr("y2",wh?-10:ig)}function r(){ng=Math.min(pg,qg)/2,mg=.95*ng,og=ke(Nf.data.targets)?.6*mg:0}function s(){var a=wh?g.axisX:g.axisY,b=Cj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Mf.select(Pf).node().getBoundingClientRect(),e=le(Nf.data.targets),f=c.right-d.left-(e?0:x());return f>0?f:0}function t(){return Qf?Qf:B()}function u(){var a=Rf?Rf:C();return a>0?a:320}function v(){return Uf?Uf:0}function w(){return Vf?Vf:0}function x(){return Sf?Sf:wh?xh?Ke(z("x")):1:!Ph||Uh?1:Ke(z("y"))}function y(){var a=10,b=nj?T()+20:0;return Tf?Tf:wh?a+b:(!Yh||bi?a:Ke(z("y2")))+b}function z(a){var b=ob(a);return b.isInner?20+Hb(a):40+Hb(a)}function A(a){return"x"!==a||xh?"x"===a&&Mh?Mh:"y"!==a||Ph?"y2"!==a||Yh?(ob(a).isInner?30:40)+("y2"===a?-10:0):uj:qh&&!nj?10:1:0}function B(){return+Mf.select(Pf).style("width").replace("px","")}function C(){return+Mf.select(Pf).style("height").replace("px","")}function D(a){return a?-31:-(dg.left-1)}function E(a){return a?-20:-4}function F(){return D(!wh)}function G(){return E(!wh)}function H(){return D(wh)}function I(){return E(wh)}function J(a){return a?gg+2+30+30:dg.left+20}function K(a){return a?(Mh?Mh:0)+80:ig+8}function L(){return J(!wh)}function M(){return K(!wh)}function N(){return J(wh)}function O(){return K(wh)}function P(){var a,b,c,d,e,f=Ec(Nf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=Dg(b.x)-Dg(a.x),0===c?wh?ig:gg:(d=Dc(),e=he(Nf.data.targets)?(d-(Wi?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function Q(a){oj=a}function R(a){pj=a}function S(a){qj=a}function T(){return qh?nj?pj*(oj+1):kg:0}function U(){return qh?nj?lg:qj*(oj+1):0}function V(){var a,b,c=!Dg;vg=wh?1:0,wg=wh?ig:gg,xg=wh?0:ig,yg=wh?gg:1,zg=vg,Ag=wg,Bg=wh?0:jg,Cg=wh?hg:1,Dg=Y(vg,wg,c?void 0:Dg.domain(),function(){return Jg.tickOffset()}),Eg=Z(xg,yg,c?void 0:Eg.domain()),Fg=Z(xg,yg,c?void 0:Fg.domain()),Gg=Y(vg,wg,Hj,function(a){return a%1?0:Mg.tickOffset()}),Hg=Z(Bg,Cg,c?void 0:Hg.domain()),Ig=Z(Bg,Cg,c?void 0:Ig.domain()),a=db(),b=Hh?Hh:c?void 0:Jg.tickValues(),Jg=ab(Dg,ij,a,b),Mg=ab(Gg,lj,a,b),Kg=bb(Eg,jj,Vh,Xh),Lg=bb(Fg,kj,ci,ei),c||(vj.scale(Gg),Wf&&zj.scale(Dg)),W()}function W(){rg=Kb(),sg=Lb(),tg=Lb(.98)}function X(a,b,c){return(c?Mf.time.scale():Mf.scale.linear()).range([a,b])}function Y(a,b,c,d){var e,f=X(a,b,Vi),g=c?f.domain(c):f;Wi?(d=d||function(){return 0},f=function(a,b){var c=g(a)+d(a);return b?c:Math.ceil(c)}):f=function(a,b){var c=g(a);return b?c:Math.ceil(c)};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return Hj&&Hj[0]===a[0]&&Hj[1]a?a.toFixed(0):a};return Ch&&("function"==typeof Ch?a=Ch:Vi&&(a=function(a){return a?dj(Ch)(a):""})),a}function eb(a){var b;return"y"===a?b=Th:"y2"===a?b=ai:"x"===a&&(b=Oh),b}function fb(a){var b=eb(a);return"string"==typeof b?b:b?b.text:null}function gb(a,b){var c=eb(a);"string"==typeof c?"y"===a?Th=b:"y2"===a?ai=b:"x"===a&&(Oh=b):c&&(c.text=b)}function hb(a){return 10*Math.sin(Math.PI*(a/180))}function ib(a){return 11.5-2.5*(a/15)}function jb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",ib(c)).attr("x",hb(c)).attr("transform","rotate("+c+")")}function kb(a,b){var c=eb(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 lb(){return kb("x",wh?"inner-top":"inner-right")}function mb(){return kb("y",wh?"inner-right":"inner-top")}function nb(){return kb("y2",wh?"inner-right":"inner-top")}function ob(a){return"y2"===a?nb():"y"===a?mb():lb()}function pb(){return fb("x")}function qb(){return fb("y")}function rb(){return fb("y2")}function sb(a,b){return a?b.isLeft?0:b.isCenter?gg/2:gg:b.isBottom?-ig:b.isMiddle?-ig/2:0}function tb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function ub(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function vb(){return sb(!wh,lb())}function wb(){return sb(wh,mb())}function xb(){return sb(wh,nb())}function yb(){return tb(!wh,lb())}function zb(){return tb(wh,mb())}function Ab(){return tb(wh,nb())}function Bb(){var a=lb();return wh?a.isInner?"1.2em":-25-Hb("x"):a.isInner?"-0.5em":Mh?Mh-10:"3em"}function Cb(){var a=mb();return wh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Hb("y")}function Db(){var a=nb();return wh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Hb("y2")}function Eb(){return ub(!wh,lb())}function Fb(){return ub(wh,mb())}function Gb(){return ub(wh,nb())}function Hb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Ib(a){var b=Cj.select("."+g.axisX+" ."+g.axisXLabel),c=Cj.select("."+g.axisY+" ."+g.axisYLabel),d=Cj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",vb).attr("dx",yb).attr("dy",Bb).text(pb),(a?c.transition():c).attr("x",wb).attr("dx",zb).attr("dy",Cb).attr("dy",Cb).text(qb),(a?d.transition():d).attr("x",xb).attr("dx",Ab).attr("dy",Db).text(rb)}function Jb(a){var b=!1;return ug(Lc(Nf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Kb(){var a=Mf.svg.arc().outerRadius(mg).innerRadius(og),b=function(b,c){var d;return c?a(b):(d=Jb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Lb(a){var b=Mf.svg.arc().outerRadius(ng*(a?a:1)).innerRadius(og);return function(a){var c=Jb(a);return c?b(c):"M 0 0"}}function Mb(a,b){return se(a.data)?rg(a,b):"M 0 0"}function Nb(a){var b,c,d,e,f=Jb(a),g="";return f&&(b=rg.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*mg*.8+","+d/e*mg*.8+")"),g}function Ob(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Pb(a){return tc({id:a.data.id,value:a.value,ratio:Ob(a)})}function Qb(a){var b,c,d,e;return Tb()?(b=Jb(a),c=b?b.value:null,d=Ob(b),e=Ub(),e?e(c,d):Gd(c,d)):""}function Rb(a,b){var c=Aj.selectAll("."+g.chartArc+sd(a)),d=Aj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});ye(a)&&c.selectAll("path").transition().duration(50).attr("d",sg).transition().duration(100).attr("d",tg).each(function(a){re(a.data)}),b||d.style("opacity",.3)}function Sb(a){var b=Aj.selectAll("."+g.chartArc+sd(a));b.selectAll("path").transition().duration(50).attr("d",rg),Aj.selectAll("."+g.arc).style("opacity",1)}function Tb(){return ke(Nf.data.targets)?Ai:ui}function Ub(){return ke(Nf.data.targets)?Bi:vi}function Vb(){return ke(Nf.data.targets)?Di:""}function Wb(){var a=ke(Nf.data.targets)?Ei:xi;return"function"==typeof a?a:function(){}}function Xb(){var a=ke(Nf.data.targets)?Fi:yi;return"function"==typeof a?a:function(){}}function Yb(){var a=ke(Nf.data.targets)?Gi:zi;return"function"==typeof a?a:function(){}}function Zb(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Tg.length>0)for(g=Uc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return Mf.min(Object.keys(i).map(function(a){return Mf.min(i[a])}))}function $b(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Tg.length>0)for(g=Vc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return Mf.max(Object.keys(i).map(function(a){return Mf.max(i[a])}))}function _b(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return cb(a.id)===c}),m="y2"===c?$h:Rh,n="y2"===c?Zh:Qh,o=b(m)?m:Zb(l),p=b(n)?n:$b(l),q="y2"===c?_h:Sh,r=Ad()&&wh;return 0===l.length?"y2"===c?Fg.domain():Eg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=Bd(o,p),j=ec(Eg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Wh&&(f=b(Wh.top)?Wh.top:e,g=b(Wh.bottom)?Wh.bottom:e),"y2"===c&&di&&(f=b(di.top)?di.top:e,g=b(di.bottom)?di.bottom:e),he(l)&&!Uc(l)&&(g=o),[o-g,p+f])}function ac(a){return Kh?Vi?Ae(Kh):Kh:Mf.min(a,function(a){return Mf.min(a.values,function(a){return a.x})})}function bc(a){return Jh?Vi?Ae(Jh):Jh:Mf.max(a,function(a){return Mf.max(a.values,function(a){return a.x})})}function cc(a){var c,d,e,f,g=Fc(a),h=g[1]-g[0];return Wi?d=0:he(a)?(c=Dc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Lh&&Fe(Lh)?(e=b(Lh.left)?Lh.left:d,f=b(Lh.right)?Lh.right:d):e=f="number"==typeof Lh?Lh:d,{left:e,right:f}}function dc(a){var b=[ac(a),bc(a)],c=b[0],d=b[1],e=cc(a),f=0,g=0;return c-d!==0||Wi||(c=Vi?new Date(.5*c.getTime()):-.5,d=Vi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ec(a){return a[1]-a[0]}function fc(a){for(var b=0;bb?0:b-c}function lc(a){var b,c=jc(a),d="y"===a.axis?Eg:Fg;return b="y"===a.axis||"y2"===a.axis?wh?ig:"start"in a?d(a.start):ig:wh?"end"in a?Dg(Vi?Ae(a.end):a.end):ig:ig,c>b?0:b-c}function mc(a){return Ng&&a===Ng||Fe(Og)&&Ge(Og,a)}function nc(a){return!mc(a)}function oc(a){return Ng?Ng:Fe(Og)?Og[a]:null}function pc(a,b){var c,d=b&&Fe(b)?Gc(b):[];return d.forEach(function(b){oc(b)===a&&(c=Nf.data.xs[b])}),c}function qc(a,b){return a in Nf.data.xs&&Nf.data.xs[a]&&Nf.data.xs[a][b]?Nf.data.xs[a][b]:b}function rc(a){Object.keys(a).forEach(function(b){Og[b]=a[b]})}function sc(a){return 1===Mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function tc(a){var b;return a&&(b=Rg[a.id],a.name=b?b:a.id),a}function uc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=wc(b[d],a.id,d)}),Nf.data.xs[a.id]=b})}function vc(a,b){a.forEach(function(a){b[a.id]&&uc([a],b[a.id])})}function wc(a,c,d){var e;return e=Vi?a?a instanceof Date?a:Ae(a):Ae(qc(c,d)):Xi&&!Wi?b(a)?+a:qc(c,d):d}function xc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Ng?(d=Object.keys(Nf.data.xs),Nf.data.xs[c]=d.length>0?Nf.data.xs[d[0]]:void 0):Fe(Og)&&(Nf.data.xs[c]=pc(f,Nf.data.targets)):Nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Qg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=oc(b),g=a[f],h=wc(g,b,e);return Xi&&Wi&&0===c&&g&&(0===e&&(Ah=[]),Ah.push(g)),("undefined"==typeof a[b]||Nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Vg&&fe(Gc(c).filter(function(a){return!(a in Wg)}),Vg),c.forEach(function(a){gc(a.id_org,a)}),c}function Ac(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 Bc(a){return a>0&&Nf.data.targets[0].values[a-1]?Nf.data.targets[0].values[a-1].x:void 0}function Cc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Fc(a){var b,c,d=Ec(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Gc(a){return a.map(function(a){return a.id})}function Hc(a){return a?"string"==typeof a?[a]:a:Gc(Nf.data.targets)}function Ic(a,b){var c,d=Gc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Vi?new Date(i):i);j.push(e)}return Vi||(j=j.sort(function(a,b){return a-b})),j}function Oc(a){fj=fj.concat(a)}function Pc(a){fj=fj.filter(function(b){return a.indexOf(b)<0})}function Qc(a){gj=gj.concat(a)}function Rc(a){gj=gj.filter(function(b){return a.indexOf(b)<0})}function Sc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Tc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Vc(a){return Tc(a,function(a){return a>0})}function Wc(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||0===a[f].x)&&(e=e.concat(Md(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Md(a,g))),Pd(e,b)):Nd(a,b,f,g)}function Od(a,b){var c;return c=a.map(function(a){return Nd(a.values,b)}),Pd(c,b)}function Pd(a,b){var c,d;return a.forEach(function(a){var e=He(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Qd(a,b){return Mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Rd(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 Sd(){return Yg&&"desc"===Yg.toLowerCase()}function Td(){return Yg&&"asc"===Yg.toLowerCase()}function Ud(a){var b=Td(),c=Sd();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 Yg&&a.sort(Yg),a}function Vd(a,c){var d,e,f,g,h,i,j,k=le(Nf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&Ii&&(Fj.html(Li(a,db(),Cd(k),cj)).style("display","block"),d=Fj.property("offsetWidth"),e=Fj.property("offsetHeight"),k?(g=gg/2+c[0],i=ig/2+c[1]+20):(wh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-y(),i=Dg(l[0].x)+20):(f=s(),g=f+x()+Dg(l[0].x)+20,h=g+d,j=f+t()-y(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),Fj.style("top",i+"px").style("left",g+"px"))}function Wd(){Fj.style("display","none")}function Xd(a){var c=a.filter(function(a){return a&&b(a.value)});if(Ii&&!ie(Nf.data.targets)&&!le(Nf.data.targets)){var d=Cj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(wh?"y1":"x1",Id).attr(wh?"y2":"x2",Id),pf(d,"grid")}}function Yd(){Cj.select("line."+g.xgridFocus).style("visibility","hidden")}function Zd(a,b){var c,d,e,f,h=[],i=Cj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=dc(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function $d(a){return a.x||0===a.x?Dg(a.x):null}function _d(a){return $(a.id)(a.value)}function ae(){var a,b,d={},e=0;return Lc(Nf.data.targets.filter(oe)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ee(a,b){return"number"==typeof si?si:b?2*a.tickOffset()*ti/b:0}function fe(a,b){Hc(a).forEach(function(a){Jj[a]=b===Wg[a],Wg[a]=b})}function ge(a,b){var c=!1;return a.forEach(function(a){Wg[a.id]===b&&(c=!0),a.id in Wg||"line"!==b||(c=!0)}),c}function he(a){return ge(a,"bar")}function ie(a){return ge(a,"scatter")}function je(a){return ge(a,"pie")}function ke(a){return ge(a,"donut")}function le(a){return je(a)||ke(a)}function me(a){var b="string"==typeof a?a:a.id;return!(b in Wg)||"line"===Wg[b]||"spline"===Wg[b]||"area"===Wg[b]||"area-spline"===Wg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"spline"===Wg[b]||"area-spline"===Wg[b]}function oe(a){var b="string"==typeof a?a:a.id;return"bar"===Wg[b]}function pe(a){var b="string"==typeof a?a:a.id;return"scatter"===Wg[b]}function qe(a){var b="string"==typeof a?a:a.id;return"pie"===Wg[b]}function re(a){var b="string"==typeof a?a:a.id;return"donut"===Wg[b]}function se(a){return qe(a)||re(a)}function te(a){return me(a)?[a]:[]}function ue(a){return se(a.data)?[a]:[]}function ve(a){return oe(a)?a.values:[]}function we(a){return me(a)||pe(a)?a.values:[]}function xe(a){return oe(a)||me(a)?a.values:[]}function ye(a){return re(a)&&Ci||qe(a)&&wi}function ze(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function Ae(b){var c;try{c=Pg?Mf.time.format(Pg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Pg)}return c}function Be(a,b){var c=Mf.mouse(a),d=Mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ge(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function He(a,b){var c="y"===cb(a.id)?Eg:Fg,d=wh?1:0,e=wh?0:1;return Math.pow(Dg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ie(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Je(a,b,c){return d(a[b])?a[b]:c}function Ke(a){return 10*Math.ceil(a/10)}function Le(a,b,c){jh(b,a.node()),Cj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Xc(g.selectedCircle,c)}).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d).attr("stroke",function(){return cj(b)}).attr("r",1.4*We(b)).transition().duration(100).attr("r",We)}function Me(a,b,c){kh(b,a.node()),Cj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ne(a,b,c,d){a?Le(b,c,d):Me(b,c,d)}function Oe(a,b){jh(b,a.node()),a.transition().duration(100).style("fill",function(){return Mf.rgb(cj(b)).brighter(.75)})}function Pe(a,b){kh(b,a.node()),a.transition().duration(100).style("fill",function(){return cj(b)})}function Qe(a,b,c,d){a?Oe(b,c,d):Pe(b,c,d)}function Re(a,b,c,d){Qe(a,b,c.data,d)}function Se(a){return"circle"===a.nodeName?Ne:Mf.select(a).classed(g.bar)?Qe:Re}function Te(a){return a.filter(function(a){return b(a.value)})}function Ue(a){return li?"function"==typeof mi?mi(a):mi:0}function Ve(a){return oi?pi?pi:1.75*Ue(a):Ue(a)}function We(a){return qi?qi:4*Ue(a)}function Xe(a,c){return(c?Cj.selectAll("."+g.circles+rd(c)):Cj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ye(a,b){Xe(a,b).classed(g.EXPANDED,!0).attr("r",Ve)}function Ze(a){Xe(a).filter(function(){return Mf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Ue)}function $e(a){return Cj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function _e(a){$e(a).classed(g.EXPANDED,!0)}function af(a){$e(a).classed(g.EXPANDED,!1)}function bf(a,b){var c=ff(a,b);return function(a,b){var d=c(a,b),e=wh?1:0,f=wh?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 cf(a,b){var c=ff(a,!1),d=b?df:ef;return function(a,b){return d(c(a,b),a,this)}}function df(a,b){var c;return wh?(c=oe(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function ef(a,b,c){var d=c.getBoundingClientRect();return wh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:oe(b)?-3:-6)}function ff(a,b){var c=a.__max__+1,d=ee(Jg,c),e=be(d,c,a,!!b),f=ce(!!b),g=de(a,!!b),h=b?_:$;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return wh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function gf(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function hf(b){var c,d,e;if(Gj=Mf.select(Pf),Gj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Gj.html("").classed("c3",!0),Nf.data.xs={},Nf.data.targets=zc(b),bh&&(Nf.data.targets=Nf.data.targets.filter(bh)),ah&&Oc(ah===!0?Gc(Nf.data.targets):ah),p(),V(),Dg.domain(Mf.extent(dc(Nf.data.targets))),Eg.domain(_b(Nf.data.targets,"y")),Fg.domain(_b(Nf.data.targets,"y2")),Gg.domain(Dg.domain()),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Hj=Dg.domain(),vj.scale(Gg),Wf&&zj.scale(Dg),Aj=Gj.append("svg").on("mouseenter",$f).on("mouseleave",_f),Bj=Aj.append("defs"),Bj.append("clipPath").attr("id",Pi).append("rect"),Bj.append("clipPath").attr("id",Qi).append("rect"),Bj.append("clipPath").attr("id",Ri).append("rect"),uf(),Cj=Aj.append("g").attr("transform",mj.main),Dj=Aj.append("g").attr("transform",mj.context),Ej=Aj.append("g").attr("transform",mj.legend),nh||Dj.style("visibility","hidden"),qh||(Ej.style("visibility","hidden"),gj=Gc(Nf.data.targets)),Fj=Mf.select(Pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Hf(Gc(Nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=Cj.append("g").attr("clip-path",Si).attr("class",g.grid),fi&&d.append("g").attr("class",g.xgrids),Fe(hi)&&d.append("g").attr("class",g.xgridLines),ni&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),ii&&d.append("g").attr("class",g.ygrids),Fe(ji)&&d.append("g").attr("class",g.ygridLines),Cj.append("g").attr("clip-path",Si).attr("class",g.regions),Cj.append("g").attr("clip-path",Si).attr("class",g.chart),c=Cj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Wf?wh?"ns-resize":"ew-resize":null),Cj.select("."+g.chart).append("g").attr("class",g.chartBars),Cj.select("."+g.chart).append("g").attr("class",g.chartLines),Cj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",mj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Vb()),Cj.select("."+g.chart).append("g").attr("class",g.chartTexts),Wf&&Cj.insert("rect",Yf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",gg).attr("height",ig).style("opacity",0).style("cursor",wh?"ns-resize":"ew-resize").call(zj).on("dblclick.zoom",null),Nh&&vj.extent("function"!=typeof Nh?Nh:Nh(dc())),hj.x=Cj.append("g").attr("class",g.axisX).attr("clip-path",Ti).attr("transform",mj.x).style("visibility",xh?"visible":"hidden"),hj.x.append("text").attr("class",g.axisXLabel).attr("transform",wh?"rotate(-90)":"").style("text-anchor",Eb),hj.y=Cj.append("g").attr("class",g.axisY).attr("clip-path",Ui).attr("transform",mj.y).style("visibility",Ph?"visible":"hidden"),hj.y.append("text").attr("class",g.axisYLabel).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Fb),hj.y2=Cj.append("g").attr("class",g.axisY2).attr("transform",mj.y2).style("visibility",Yh?"visible":"hidden"),hj.y2.append("text").attr("class",g.axisY2Label).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Gb),Dj.append("g").attr("clip-path",Si).attr("class",g.chart),Dj.select("."+g.chart).append("g").attr("class",g.chartBars),Dj.select("."+g.chart).append("g").attr("class",g.chartLines),Dj.append("g").attr("clip-path",Si).attr("class",g.brush).call(vj).selectAll("rect").attr(wh?"width":"height",wh?hg:jg),hj.subx=Dj.append("g").attr("class",g.axisX).attr("transform",mj.subx).attr("clip-path",wh?"":Ti),xf(Nf.data.targets),qf({withUpdateTranslate:!0,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Mi){if(Vi&&"string"==typeof Ni){for(Ni=Ae(Ni),e=0;e0){d=[];for(var f in Rg)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Rd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Qe,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function nf(a){le(Nf.data.targets)||ch&&(Yi=a,Cj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Zi=!0,lh())}function of(){le(Nf.data.targets)||ch&&(Cj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),Cj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Zi=!1,mh())}function pf(a,b){"grid"===b&&a.each(function(){var a=Mf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function qf(a,c){var d,e,f,h,i,j,k,l,m,n,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,Q,R,S,T,U,W,X,Y,Z,$=ae(),_=le(Nf.data.targets),ab=Lc(Nf.data.targets);if(a=a||{},E=Je(a,"withY",!0),F=Je(a,"withSubchart",!0),G=Je(a,"withTransition",!0),J=Je(a,"withTransform",!1),K=Je(a,"withUpdateXDomain",!1),L=Je(a,"withUpdateOrgXDomain",!1),N=Je(a,"withUpdateTranslate",!1),M=Je(a,"withLegend",!1),H=Je(a,"withTransitionForExit",G),I=Je(a,"withTransitionForAxis",G),T=G?cg:0,U=H?T:0,W=I?T:0,c=c||vf(W),M&&qh&&Hf(Gc(Nf.data.targets),a,c),Wi&&0===ab.length&&Dg.domain([0,hj.x.selectAll(".tick").size()]),ab.length&&(L&&(Dg.domain(Mf.extent(dc(ab))),Hj=Dg.domain(),Wf&&zj.scale(Dg).updateScaleExtent(),Gg.domain(Dg.domain()),vj.scale(Gg)),K&&(Dg.domain(vj.empty()?Hj:vj.extent()),Wf&&zj.scale(Dg).updateScaleExtent()),Hh||!Gh&&!Fh||(X=Nc(Mc(ab),Fh),Jg.tickValues(X),Mg.tickValues(X))),Eg.domain(_b(ab,"y")),Fg.domain(_b(ab,"y2")),hj.x.style("opacity",_?0:1),hj.y.style("opacity",_?0:1),hj.y2.style("opacity",_?0:1),hj.subx.style("opacity",_?0:1),c.axisX.call(Jg),c.axisY.call(Kg),c.axisY2.call(Lg),c.axisSubX.call(Mg),Ib(G),N&&(p(),V(),uf(),o(!1)),K&&ab.length)if(Dh&&X){for(Y=1;Y=0&&Mf.select(this).style("display",b%Z?"none":"block")})}else Aj.selectAll("."+g.axisX+" .tick text").style("display","block");!wh&&Ih&&jb(hj.x,c.axisX,Ih),O=bf($),R=cf($,!0),S=cf($,!1),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Fj.style("display","none"),q(),Cj.select("line."+g.xgridFocus).style("visibility","hidden"),fi&&(f=Zd(gi,Dg),B=Wi?Jg.tickOffset():0,e=wh?{x1:0,x2:gg,y1:function(a){return Dg(a)-B},y2:function(a){return Dg(a)-B}}:{x1:function(a){return Dg(a)+B},x2:function(a){return Dg(a)+B},y1:dg.top,y2:ig},d=Cj.select("."+g.xgrids).selectAll("."+g.xgrid).data(f),d.enter().append("line").attr("class",g.xgrid),d.attr(e).style("opacity",function(){return+Mf.select(this).attr(wh?"y1":"x1")===(wh?ig:0)?0:1}),d.exit().remove()),Fe(hi)&&(h=Cj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(hi),i=h.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),i.append("line").style("opacity",0),i.append("text").attr("text-anchor","end").attr("transform",wh?"":"rotate(-90)").attr("dx",wh?0:-dg.top).attr("dy",-5).style("opacity",0),h.select("line").transition().duration(T).attr("x1",wh?0:Jd).attr("x2",wh?gg:Jd).attr("y1",wh?Jd:dg.top).attr("y2",wh?Jd:ig).style("opacity",1),h.select("text").transition().duration(T).attr("x",wh?gg:0).attr("y",Jd).text(function(a){return a.text}).style("opacity",1),h.exit().transition().duration(T).style("opacity",0).remove()),E&&ii&&(j=Cj.select("."+g.ygrids).selectAll("."+g.ygrid).data(Eg.ticks(ki)),j.enter().append("line").attr("class",g.ygrid),j.attr("x1",wh?Eg:0).attr("x2",wh?Eg:gg).attr("y1",wh?0:Eg).attr("y2",wh?ig:Eg),j.exit().remove(),pf(j,"grid")),E&&Fe(ji)&&(k=Cj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(ji),l=k.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",wh?"rotate(-90)":"").attr("dx",wh?0:-dg.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",wh?Kd:0).attr("x2",wh?Kd:gg).attr("y1",wh?0:Kd).attr("y2",wh?ig:Kd).style("opacity",1),k.select("text").transition().duration(T).attr("x",wh?0:gg).attr("y",Kd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),u=Cj.select("."+g.regions).selectAll("."+g.region).data(Hi),u.enter().append("g").attr("class",kd).append("rect").style("fill-opacity",0),u.selectAll("rect").transition().duration(T).attr("x",ic).attr("y",jc).attr("width",kc).attr("height",lc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),u.exit().transition().duration(T).style("opacity",0).remove(),s=Cj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),s.enter().append("path").attr("class",ed).style("stroke","none").style("fill",cj),s.style("opacity",wd).transition().duration(T).attr("d",O).style("fill",cj).style("opacity",1),s.exit().transition().duration(U).style("opacity",0).remove(),m=Cj.selectAll("."+g.lines).selectAll("."+g.line).data(te),m.enter().append("path").attr("class",ad).style("stroke",cj),m.style("opacity",wd).transition().duration(T).attr("d",wj).style("stroke",cj).style("opacity",1),m.exit().transition().duration(U).style("opacity",0).remove(),n=Cj.selectAll("."+g.areas).selectAll("."+g.area).data(te),n.enter().append("path").attr("class",id).style("fill",cj).style("opacity",function(){return Ij=+Mf.select(this).style("opacity"),0}),n.style("opacity",0).transition().duration(T).attr("d",xj).style("fill",cj).style("opacity",Ij),n.exit().transition().duration(U).style("opacity",0).remove(),r=Cj.selectAll("."+g.circles).selectAll("."+g.circle).data(we),r.enter().append("circle").attr("class",cd).attr("r",Ue).style("fill",cj),r.style("opacity",wd).transition().duration(T).style("opacity",yd).style("fill",cj).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d),r.exit().remove(),v=Cj.selectAll("."+g.texts).selectAll("."+g.text).data(xe),v.enter().append("text").attr("class",Yc).attr("text-anchor",function(a){return wh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",cj).style("fill-opacity",0),v.text(function(a){return Hd(a.id)(a.value,a.id)}).style("fill-opacity",xd).transition().duration(T).attr("x",R).attr("y",S).style("fill",cj).style("fill-opacity",zd),v.exit().transition().duration(U).style("fill-opacity",0).remove(),t=Cj.selectAll("."+g.arcs).selectAll("."+g.arc).data(ue),t.enter().append("path").attr("class",gd).style("fill",function(a){return cj(a.data)}).style("cursor",function(a){return eh(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;aj||(c=Jb(a),d=Pb(c),e=Xb(),Rb(c.data.id),Df(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Jb(a),c=Pb(b),d=[c];Vd(d,Mf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;aj||(c=Jb(a),d=Pb(c),e=Yb(),Sb(c.data.id),Ef(),Wd(),e(d,b))}).on("click",function(a,b){var c=Jb(a),d=Pb(c),e=Wb();lf(this,a,b),e(d,b)}),t.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){aj=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Jb(a);return c?(b=Mf.interpolate(this._current,c),this._current=b(0),function(a){return Mb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("fill",function(a){return cj(a.data)}).style("opacity",1).call(Ie,function(){aj=!1}),t.exit().transition().duration(U).style("opacity",0).remove(),Cj.selectAll("."+g.chartArc).select("text").attr("transform",Nb).style("opacity",0).transition().duration(T).text(Qb).style("opacity",function(a){return Jc(a.data.id)&&se(a.data)?1:0}),Cj.select("."+g.chartArcsTitle).style("opacity",ke(Nf.data.targets)?1:0),nh&&(Mf.event&&"zoom"===Mf.event.type&&vj.extent(Dg.orgDomain()).update(),F&&(!wh&&Ih&&jb(hj.subx,c.axisSubX,Ih),vj.empty()||vj.extent(Dg.orgDomain()).update(),Q=bf($,!0),x=Dj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),x.enter().append("path").attr("class",ed).style("stroke","none").style("fill",cj),x.style("opacity",wd).transition().duration(T).attr("d",Q).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove(),w=Dj.selectAll("."+g.lines).selectAll("."+g.line).data(te),w.enter().append("path").attr("class",ad).style("stroke",cj),w.style("opacity",wd).transition().duration(T).attr("d",yj).style("opacity",1),w.exit().transition().duration(T).style("opacity",0).remove())),Cj.selectAll("."+g.selectedCircles).filter(function(a){return oe(a)}).selectAll("circle").remove(),Cj.selectAll("."+g.selectedCircle).transition().duration(T).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d),Zf&&(y=Cj.select("."+g.eventRects),Fe(Og)&&!sc(Og)?(y.classed(g.eventRectsMultiple)||y.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),z=Cj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),kf(z.enter()),z.attr("x",0).attr("y",0).attr("width",gg).attr("height",ig)):(y.classed(g.eventRectsSingle)||y.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Xi&&!Wi?(D=function(a,b){var c=Bc(b),d=Cc(b),e=Nf.data.xs[a.id][b];return(Dg(d?d:e+50)-Dg(c?c:e-50))/2},C=function(a,b){var c=Bc(b),d=Nf.data.xs[a.id][b];return(Dg(d)+Dg(c?c:d-50))/2}):(D=P(),C=function(a){return Dg(a.x)-D/2}),A=Ec(Nf.data.targets),Cj.select("."+g.eventRects).datum(A?A.values:[]),z=Cj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),jf(z.enter()),z.attr("class",ld).attr("x",wh?0:C).attr("y",wh?C:0).attr("width",wh?gg:D).attr("height",wh?D:ig),z.exit().remove())),Gc(Nf.data.targets).forEach(function(a){Jj[a]=!0})}function rf(){qf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function sf(){if(0!==Lc(Nf.data.targets).length){if("mousemove"===Mf.event.sourceEvent.type&&zj.altDomain)return Dg.domain(zj.altDomain),void zj.scale(Dg).updateScaleExtent();Wi&&Dg.orgDomain()[0]===Hj[0]&&Dg.domain([Hj[0]-1e-10,Dg.orgDomain()[1]]),qf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Mf.event.sourceEvent.type&&($i=!0)}}function tf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function uf(){Aj.attr("width",kg).attr("height",lg),Aj.select("#"+Pi).select("rect").attr("width",gg).attr("height",ig),Aj.select("#"+Qi).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),Aj.select("#"+Ri).select("rect").attr("x",H).attr("y",I).attr("width",N).attr("height",O),Aj.select("."+g.zoomRect).attr("width",gg).attr("height",ig),Gj.style("max-height",lg+"px")}function vf(a){return{axisX:a?hj.x.transition().duration(a):hj.x,axisY:a?hj.y.transition().duration(a):hj.y,axisY2:a?hj.y2.transition().duration(a):hj.y2,axisSubX:a?hj.subx.transition().duration(a):hj.subx}}function wf(a){var b;a=a||{},a.withTransition=Je(a,"withTransition",!0),a.withTransform=Je(a,"withTransform",!1),a.withLegend=Je(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withLegend&&qh||(b=vf(a.withTransitionForAxis?cg:0),p(),V(),uf(),o(a.withTransition,b)),qf(a,b)}function xf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=Cj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",nd),j=i.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Zc),e=Cj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),d=e.enter().append("g").attr("class",pd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",fd).style("cursor",function(a){return eh(a)?"pointer":null}),c=Cj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),b=c.enter().append("g").attr("class",od).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",bd),b.append("g").attr("class",jd),b.append("g").attr("class",function(a){return Xc(g.selectedCircles,a.id)}),b.append("g").attr("class",dd).style("cursor",function(a){return eh(a)?"pointer":null}),a.forEach(function(a){Cj.selectAll("."+g.selectedCircles+rd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Cj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(ug(a)).attr("class",qd),f=h.enter().append("g").attr("class",qd),f.append("g").attr("class",hd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),nh&&(n=Dj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),m=n.enter().append("g").style("opacity",0).attr("class",pd),m.append("g").attr("class",fd),l=Dj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),k=l.enter().append("g").style("opacity",0).attr("class",od),k.append("g").attr("class",bd)),Aj.selectAll("."+g.target).filter(function(a){return Jc(a.id)}).transition().duration(cg).style("opacity",1)}function yf(a,b){b.filter&&(a=a.filter(b.filter)),(b.type||b.types)&&a.forEach(function(a){b.types?fe(a.id,b.types[a.id]):fe(a.id,b.type)}),Nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,z=0,F++)),E[a]=F,D[F]=f,A[a]=z,z+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+v)/10),j=10*Math.ceil((h.height+u)/10),k=nj?j:i,l=nj?U():T();return d&&(z=0,F=0,w=0,x=0),qh&&!Kc(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=i,C[c]=j,(!w||i>=w)&&(w=i),(!x||j>=x)&&(x=j),g=nj?x:w,void(vh?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(l-g*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=26,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=Ej.selectAll("."+g.legendItemFocused).size();b=b||{},n=Je(b,"withTransition",!0),q=Je(b,"withTransitionForTransform",!0),nj?(f=function(a){return w*E[a]},j=function(a){return D[E[a]]+A[a]}):(f=function(a){return D[E[a]]+A[a]},j=function(a){return x*E[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=Ej.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Xc(g.legendItem,a)}).style("visibility",function(a){return Kc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof sh?sh(a):Nf.toggle(a)}).on("mouseover",function(a){Mf.select(this).classed(g.legendItemFocused,!0),aj||Nf.focus(a),"function"==typeof th&&th(a)}).on("mouseout",function(a){Mf.select(this).classed(g.legendItemFocused,!1),aj||Nf.revert(),"function"==typeof uh&&uh(a)}),m.append("text").text(function(a){return d(Rg[a])?Rg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",nj?h:-200).attr("y",nj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",nj?i:-200).attr("y",nj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",cj).attr("x",nj?h:-200).attr("y",nj?-200:j).attr("width",10).attr("height",10),r=Ej.selectAll("text").data(a).text(function(a){return d(Rg[a])?Rg[a]:a}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=Ej.selectAll("rect."+g.legendItemEvent).data(a),(n?s.transition():s).attr("width",function(a){return B[a]}).attr("height",function(a){return C[a]}).attr("x",i).attr("y",l),t=Ej.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",cj).attr("x",f).attr("y",j),Ej.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Jc(a)}).transition().style("opacity",function(a){var b=Mf.select(this);return Jc(a)?!G||b.classed(g.legendItemFocused)?Bf(b):Cf(b):rj}),R(w),S(x),Q(F),p(),V(),uf(),o(q,c)}function If(a){return Ic(Nf.data.targets,a.id)}function Jf(a){return"data"in a&&Ic(Nf.data.targets,a.data.id)}function Kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function Lf(a,b,c){var d=!le(Nf.data.targets);aj=!1,fe(a,b),wf(c||{withTransitionForAxis:d})}var Mf=a.d3?a.d3:a.require?a.require("d3"):void 0,Nf={data:{},axis:{},legend:{}},Of={},Pf=i(["bindto"],"#chart"),Qf=i(["size","width"]),Rf=i(["size","height"]),Sf=i(["padding","left"]),Tf=i(["padding","right"]),Uf=i(["padding","top"]),Vf=i(["padding","bottom"]),Wf=i(["zoom","enabled"],!1),Xf=i(["zoom","extent"]),Yf=i(["zoom","privileged"],!1),Zf=i(["interaction","enabled"],!0),$f=i(["onenter"],function(){}),_f=i(["onleave"],function(){}),ag=i(["onresize"],function(){}),bg=i(["onresized"],function(){}),cg=i(["transition","duration"],350);h("data","data is required in config");var dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg,Kg,Lg,Mg,Ng=i(["data","x"]),Og=i(["data","xs"],{}),Pg=i(["data","x_format"]),Qg=i(["data","id_converter"],function(a){return a}),Rg=i(["data","names"],{}),Sg=i(["data","classes"],{}),Tg=i(["data","groups"],[]),Ug=i(["data","axes"],{}),Vg=i(["data","type"]),Wg=i(["data","types"],{}),Xg=i(["data","labels"],{}),Yg=i(["data","order"]),Zg=i(["data","regions"],{}),$g=i(["data","color"]),_g=i(["data","colors"],{}),ah=i(["data","hide"],!1),bh=i(["data","filter"]),ch=i(["data","selection","enabled"],!1),dh=i(["data","selection","grouped"],!1),eh=i(["data","selection","isselectable"],function(){return!0}),fh=i(["data","selection","multiple"],!0),gh=i(["data","onclick"],function(){}),hh=i(["data","onenter"],function(){}),ih=i(["data","onleave"],function(){}),jh=i(["data","onselected"],function(){}),kh=i(["data","onunselected"],function(){}),lh=i(["data","ondragstart"],function(){}),mh=i(["data","ondragend"],function(){}),nh=i(["subchart","show"],!1),oh=i(["subchart","size","height"],60),ph=i(["color","pattern"],[]),qh=i(["legend","show"],!0),rh=i(["legend","position"],"bottom"),sh=i(["legend","item","onclick"]),th=i(["legend","item","onmouseover"]),uh=i(["legend","item","onmouseout"]),vh=i(["legend","equally"],!1),wh=i(["axis","rotated"],!1),xh=i(["axis","x","show"],!0),yh=i(["axis","x","type"],"indexed"),zh=i(["axis","x","localtime"],!0),Ah=i(["axis","x","categories"],[]),Bh=i(["axis","x","tick","centered"],!1),Ch=i(["axis","x","tick","format"]),Dh=i(["axis","x","tick","culling"],{}),Eh=i(["axis","x","tick","culling","max"],10),Fh=i(["axis","x","tick","count"]),Gh=i(["axis","x","tick","fit"],!0),Hh=i(["axis","x","tick","values"],null),Ih=i(["axis","x","tick","rotate"]),Jh=i(["axis","x","max"],null),Kh=i(["axis","x","min"],null),Lh=i(["axis","x","padding"],{}),Mh=i(["axis","x","height"]),Nh=i(["axis","x","default"]),Oh=i(["axis","x","label"],{}),Ph=i(["axis","y","show"],!0),Qh=i(["axis","y","max"]),Rh=i(["axis","y","min"]),Sh=i(["axis","y","center"]),Th=i(["axis","y","label"],{}),Uh=i(["axis","y","inner"],!1),Vh=i(["axis","y","tick","format"]),Wh=i(["axis","y","padding"]),Xh=i(["axis","y","ticks"],10),Yh=i(["axis","y2","show"],!1),Zh=i(["axis","y2","max"]),$h=i(["axis","y2","min"]),_h=i(["axis","y2","center"]),ai=i(["axis","y2","label"],{}),bi=i(["axis","y2","inner"],!1),ci=i(["axis","y2","tick","format"]),di=i(["axis","y2","padding"]),ei=i(["axis","y2","ticks"],10),fi=i(["grid","x","show"],!1),gi=i(["grid","x","type"],"tick"),hi=i(["grid","x","lines"],[]),ii=i(["grid","y","show"],!1),ji=i(["grid","y","lines"],[]),ki=i(["grid","y","ticks"],10),li=i(["point","show"],!0),mi=i(["point","r"],2.5),ni=i(["point","focus","line","enabled"],!0),oi=i(["point","focus","expand","enabled"],!0),pi=i(["point","focus","expand","r"]),qi=i(["point","focus","select","r"]),ri=i(["line","connect_null"],!1),si=i(["bar","width"]),ti=i(["bar","width","ratio"],.6),ui=i(["pie","label","show"],!0),vi=i(["pie","label","format"]),wi=i(["pie","expand"],!0),xi=i(["pie","onclick"],function(){}),yi=i(["pie","onmouseover"],function(){}),zi=i(["pie","onmouseout"],function(){}),Ai=i(["donut","label","show"],!0),Bi=i(["donut","label","format"]),Ci=i(["donut","expand"],!0),Di=i(["donut","title"],""),Ei=i(["donut","onclick"],function(){}),Fi=i(["donut","onmouseover"],function(){}),Gi=i(["donut","onmouseout"],function(){}),Hi=i(["regions"],[]),Ii=i(["tooltip","show"],!0),Ji=i(["tooltip","format","title"]),Ki=i(["tooltip","format","value"]),Li=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Ji?Ji:b,l=Ki?Ki:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Mi=i(["tooltip","init","show"],!1),Ni=i(["tooltip","init","x"],0),Oi=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Pi=("string"==typeof Pf?Pf.replace("#",""):Pf.id)+"-clip",Qi=Pi+"-xaxis",Ri=Pi+"-yaxis",Si=j(Pi),Ti=j(Qi),Ui=j(Ri),Vi="timeseries"===yh,Wi="categorized"===yh,Xi=!Vi&&(Ng||Fe(Og)),Yi=null,Zi=!1,$i=!1,_i=!1,aj=!1,bj=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],cj=ze(_g,Fe(ph)?ph:bj,$g),dj=zh?Mf.time.format:Mf.time.format.utc,ej=dj.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),fj=[],gj=[],hj={},ij=wh?"left":"bottom",jj=wh?Uh?"top":"bottom":Uh?"right":"left",kj=wh?bi?"bottom":"top":bi?"left":"right",lj=wh?"left":"bottom",mj={main:function(){return"translate("+k(dg.left)+","+k(dg.top)+")"},context:function(){return"translate("+k(eg.left)+","+k(eg.top)+")"},legend:function(){return"translate("+fg.left+","+fg.top+")"},x:function(){return"translate(0,"+(wh?0:ig)+")"},y:function(){return"translate(0,"+(wh?ig:0)+")" +},y2:function(){return"translate("+(wh?0:gg)+","+(wh?1:0)+")"},subx:function(){return"translate(0,"+(wh?0:jg)+")"},arc:function(){return"translate("+pg/2+","+qg/2+")"}},nj="right"===rh,oj=0,pj=0,qj=0,rj=.15,sj=30,tj=wh&&!xh?0:30,uj=5;ug=Mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var vj,wj=function(){var a=Mf.svg.line().x(wh?function(a){return $(a.id)(a.value)}:Id).y(wh?Id:function(a){return $(a.id)(a.value)});return ri||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ri?Te(b.values):b.values;return me(b)?(a.interpolate(ne(b)?"cardinal":"linear"),Zg[b.id]?gf(e,Dg,$(b.id),Zg[b.id]):a(e)):(c=e[0]?Dg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,wh?"M "+d+" "+c:"M "+c+" "+d)}}(),xj=function(){var a;return a=wh?Mf.svg.area().x0(function(a){return $(a.id)(0)}).x1(function(a){return $(a.id)(a.value)}).y(Id):Mf.svg.area().x(Id).y0(function(a){return $(a.id)(0)}).y1(function(a){return $(a.id)(a.value)}),function(b){var c,d,e=Te(b.values);return ge([b],"area")||ge([b],"area-spline")?(a.interpolate(ne(b)?"cardinal":"linear"),a(e)):(c=e[0]?Dg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,wh?"M "+d+" "+c:"M "+c+" "+d)}}(),yj=function(){var a=Mf.svg.line().x(wh?function(a){return _(a.id)(a.value)}:Ld).y(wh?Ld:function(a){return _(a.id)(a.value)});return function(b){var c=Te(b.values);return me(b)?a(c):"M "+Gg(c[0].x)+" "+_(b.id)(c[0].value)}}(),zj=function(){};vj=Mf.svg.brush().on("brush",rf),vj.update=function(){return Dj&&Dj.select("."+g.brush).call(this),this},vj.scale=function(a){return wh?this.y(a):this.x(a)},Wf&&(zj=Mf.behavior.zoom().on("zoomstart",function(){zj.altDomain=Mf.event.sourceEvent.altKey?Dg.orgDomain():null}).on("zoom",Wf?sf:null),zj.scale=function(a){return wh?this.y(a):this.x(a)},zj.orgScaleExtent=function(){var a=Xf?Xf:[1,10];return[a[0],Math.max(Dc()/a[1],a[1])]},zj.updateScaleExtent=function(){var a=ec(Dg.orgDomain())/ec(Hj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Aj,Bj,Cj,Dj,Ej,Fj,Gj,Hj,Ij,Jj={};if(Nf.focus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);Nf.revert(),Nf.defocus(),b(d.classed(g.focused,!0)),b(e),le(Nf.data.targets)&&Rb(a,!0),Df(a,!0)},Nf.defocus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",.3)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);Nf.revert(),b(d.classed(g.focused,!1)),b(e),le(Nf.data.targets)&&Sb(a),Df(a,!1)},Nf.revert=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);b(d.classed(g.focused,!1)),b(e),le(Nf.data.targets)&&Sb(a),Ef()},Nf.show=function(a,b){a=Hc(a),b=b||{},Pc(a),Aj.selectAll(td(a)).transition().style("opacity",1),b.withLegend&&Ff(a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Nf.hide=function(a,b){a=Hc(a),b=b||{},Oc(a),Aj.selectAll(td(a)).transition().style("opacity",0),b.withLegend&&Gf(a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Nf.toggle=function(a){Jc(a)?Nf.hide(a):Nf.show(a)},Nf.unzoom=function(){vj.clear().update(),qf({withUpdateXDomain:!0})},Nf.load=function(a){return a.xs&&rc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Sg[b]=a.classes[b]}),"categories"in a&&Wi&&(Ah=a.categories,Jg.categories(Ah)),"cacheIds"in a&&fc(a.cacheIds)?void yf(hc(a.cacheIds),a.done):void("unload"in a?Af(Hc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){zf(a)}):zf(a))},Nf.unload=function(a,b){Af(Hc(a),function(){qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Nf.selected=function(a){return Mf.merge(Cj.selectAll("."+g.shapes+rd(a)).selectAll("."+g.shape).filter(function(){return Mf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Nf.select=function(a,b,c){ch&&Cj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Mf.select(this),i=e.data?e.data.id:e.id,j=Se(this),k=dh||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);"path"!==this.nodeName&&(k&&l?eh(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},Nf.unselect=function(a,b){ch&&Cj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Mf.select(this),f=c.data?c.data.id:c.id,h=Se(this),i=dh||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);"path"!==this.nodeName&&i&&j&&eh(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Nf.toLine=function(a){Lf(a,"line")},Nf.toSpline=function(a){Lf(a,"spline")},Nf.toBar=function(a){Lf(a,"bar")},Nf.toScatter=function(a){Lf(a,"scatter")},Nf.toArea=function(a){Lf(a,"area")},Nf.toAreaSpline=function(a){Lf(a,"area-spline")},Nf.toPie=function(a){Lf(a,"pie",{withTransform:!0})},Nf.toDonut=function(a){Lf(a,"donut",{withTransform:!0})},Nf.groups=function(a){return c(a)?Tg:(Tg=a,qf(),Tg)},Nf.xgrids=function(a){return a?(hi=a,qf(),hi):hi},Nf.xgrids.add=function(a){return a?Nf.xgrids(hi.concat(a)):void 0},Nf.xgrids.remove=function(a){var b=Kf(a);return Nf.xgrids(hi.filter(b))},Nf.ygrids=function(a){return a?(ji=a,qf(),ji):ji},Nf.ygrids.add=function(a){return a?Nf.ygrids(ji.concat(a)):void 0},Nf.ygrids.remove=function(a){var b=Kf(a);return Nf.ygrids(ji.filter(b))},Nf.regions=function(a){return a?(Hi=a,qf(),Hi):Hi},Nf.regions.add=function(a){return a?(Hi=Hi.concat(a),qf(),Hi):Hi},Nf.regions.remove=function(a){var b,c,d;return a=a||{},b=Je(a,"duration",cg),c=Je(a,"classes",[g.region]),d=Cj.select("."+g.regions).selectAll(c.map(function(a){return"."+a})),(b?d.transition().duration(b):d).style("opacity",0).remove(),Hi=Hi.filter(function(a){return c.indexOf(a.class)<0})},Nf.data.get=function(a){var b=Nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Nf.data.getAsTarget=function(a){var b=Nf.data.targets.filter(function(b){return b.id===a});return b.length>0?b[0]:void 0},Nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Rg[b]=a[b]}),qf({withLegend:!0}),Rg):Rg},Nf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){_g[b]=a[b]}),qf({withLegend:!0}),_g):_g},Nf.x=function(a){return arguments.length&&(uc(Nf.data.targets,a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Nf.data.xs},Nf.xs=function(a){return arguments.length&&(vc(Nf.data.targets,a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Nf.data.xs},Nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){gb(b,a[b])}),Ib())},Nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Jh=+a.x),b(a.y)&&(Qh=+a.y),b(a.y2)&&(Zh=+a.y2)):Qh=Zh=+a,qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Kh=+a.x),b(a.y)&&(Rh=+a.y),b(a.y2)&&($h=+a.y2)):Rh=$h=+a,qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Nf.axis.max(a.max),"undefined"!=typeof a.min&&Nf.axis.min(a.min))},Nf.legend.show=function(a){Ff(Hc(a)),qf({withLegend:!0})},Nf.legend.hide=function(a){Gf(Hc(a)),qf({withLegend:!0})},Nf.resize=function(a){Qf=a?a.width:null,Rf=a?a.height:null,wf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Nf.destroy=function(){Nf.data.targets=void 0,Nf.data.xs={},Gj.html(""),a.onresize=null},"url"in f.data)Mf.xhr(f.data.url,function(a,b){var c,d=Mf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Mf.csv.parse(b.response),hf(c)});else if("rows"in f.data)hf(xc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");hf(yc(f.data.columns))}return Nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(window); \ No newline at end of file From 64af0b87f6b279a959efab2ab3d7dbc497068db3 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Fri, 9 May 2014 20:36:54 +0900 Subject: [PATCH 160/178] Fix axis when init --- c3.js | 5 +++++ c3.min.js | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/c3.js b/c3.js index 7fe0fa1..188fa78 100644 --- a/c3.js +++ b/c3.js @@ -3103,6 +3103,11 @@ updateScales(); updateSvgSize(); transformAll(false); + // update axis again + axes.x.call(xAxis); + axes.y.call(yAxis); + axes.y2.call(y2Axis); + axes.subx.call(subXAxis); } // show/hide if manual culling needed diff --git a/c3.min.js b/c3.min.js index 16f3db4..f666f9f 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ !function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.round(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.round(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&agg&&(gg=0),0>ig&&(ig=0),hg=wh?dg.left-sj-tj:gg,jg=wh?ig:lg-eg.top-eg.bottom,0>hg&&(hg=0),0>jg&&(jg=0),pg=gg-(nj?b+10:0),qg=ig-(nj?0:10),r(),nj&&d&&(fg.left=pg/2+1.1*ng)}function q(){Cj.select("line."+g.xgridFocus).attr("x1",wh?0:-10).attr("x2",wh?gg:-10).attr("y1",wh?-10:dg.top).attr("y2",wh?-10:ig)}function r(){ng=Math.min(pg,qg)/2,mg=.95*ng,og=ke(Nf.data.targets)?.6*mg:0}function s(){var a=wh?g.axisX:g.axisY,b=Cj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Mf.select(Pf).node().getBoundingClientRect(),e=le(Nf.data.targets),f=c.right-d.left-(e?0:x());return f>0?f:0}function t(){return Qf?Qf:B()}function u(){var a=Rf?Rf:C();return a>0?a:320}function v(){return Uf?Uf:0}function w(){return Vf?Vf:0}function x(){return Sf?Sf:wh?xh?Ke(z("x")):1:!Ph||Uh?1:Ke(z("y"))}function y(){var a=10,b=nj?T()+20:0;return Tf?Tf:wh?a+b:(!Yh||bi?a:Ke(z("y2")))+b}function z(a){var b=ob(a);return b.isInner?20+Hb(a):40+Hb(a)}function A(a){return"x"!==a||xh?"x"===a&&Mh?Mh:"y"!==a||Ph?"y2"!==a||Yh?(ob(a).isInner?30:40)+("y2"===a?-10:0):uj:qh&&!nj?10:1:0}function B(){return+Mf.select(Pf).style("width").replace("px","")}function C(){return+Mf.select(Pf).style("height").replace("px","")}function D(a){return a?-31:-(dg.left-1)}function E(a){return a?-20:-4}function F(){return D(!wh)}function G(){return E(!wh)}function H(){return D(wh)}function I(){return E(wh)}function J(a){return a?gg+2+30+30:dg.left+20}function K(a){return a?(Mh?Mh:0)+80:ig+8}function L(){return J(!wh)}function M(){return K(!wh)}function N(){return J(wh)}function O(){return K(wh)}function P(){var a,b,c,d,e,f=Ec(Nf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=Dg(b.x)-Dg(a.x),0===c?wh?ig:gg:(d=Dc(),e=he(Nf.data.targets)?(d-(Wi?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function Q(a){oj=a}function R(a){pj=a}function S(a){qj=a}function T(){return qh?nj?pj*(oj+1):kg:0}function U(){return qh?nj?lg:qj*(oj+1):0}function V(){var a,b,c=!Dg;vg=wh?1:0,wg=wh?ig:gg,xg=wh?0:ig,yg=wh?gg:1,zg=vg,Ag=wg,Bg=wh?0:jg,Cg=wh?hg:1,Dg=Y(vg,wg,c?void 0:Dg.domain(),function(){return Jg.tickOffset()}),Eg=Z(xg,yg,c?void 0:Eg.domain()),Fg=Z(xg,yg,c?void 0:Fg.domain()),Gg=Y(vg,wg,Hj,function(a){return a%1?0:Mg.tickOffset()}),Hg=Z(Bg,Cg,c?void 0:Hg.domain()),Ig=Z(Bg,Cg,c?void 0:Ig.domain()),a=db(),b=Hh?Hh:c?void 0:Jg.tickValues(),Jg=ab(Dg,ij,a,b),Mg=ab(Gg,lj,a,b),Kg=bb(Eg,jj,Vh,Xh),Lg=bb(Fg,kj,ci,ei),c||(vj.scale(Gg),Wf&&zj.scale(Dg)),W()}function W(){rg=Kb(),sg=Lb(),tg=Lb(.98)}function X(a,b,c){return(c?Mf.time.scale():Mf.scale.linear()).range([a,b])}function Y(a,b,c,d){var e,f=X(a,b,Vi),g=c?f.domain(c):f;Wi?(d=d||function(){return 0},f=function(a,b){var c=g(a)+d(a);return b?c:Math.ceil(c)}):f=function(a,b){var c=g(a);return b?c:Math.ceil(c)};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return Hj&&Hj[0]===a[0]&&Hj[1]a?a.toFixed(0):a};return Ch&&("function"==typeof Ch?a=Ch:Vi&&(a=function(a){return a?dj(Ch)(a):""})),a}function eb(a){var b;return"y"===a?b=Th:"y2"===a?b=ai:"x"===a&&(b=Oh),b}function fb(a){var b=eb(a);return"string"==typeof b?b:b?b.text:null}function gb(a,b){var c=eb(a);"string"==typeof c?"y"===a?Th=b:"y2"===a?ai=b:"x"===a&&(Oh=b):c&&(c.text=b)}function hb(a){return 10*Math.sin(Math.PI*(a/180))}function ib(a){return 11.5-2.5*(a/15)}function jb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",ib(c)).attr("x",hb(c)).attr("transform","rotate("+c+")")}function kb(a,b){var c=eb(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 lb(){return kb("x",wh?"inner-top":"inner-right")}function mb(){return kb("y",wh?"inner-right":"inner-top")}function nb(){return kb("y2",wh?"inner-right":"inner-top")}function ob(a){return"y2"===a?nb():"y"===a?mb():lb()}function pb(){return fb("x")}function qb(){return fb("y")}function rb(){return fb("y2")}function sb(a,b){return a?b.isLeft?0:b.isCenter?gg/2:gg:b.isBottom?-ig:b.isMiddle?-ig/2:0}function tb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function ub(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function vb(){return sb(!wh,lb())}function wb(){return sb(wh,mb())}function xb(){return sb(wh,nb())}function yb(){return tb(!wh,lb())}function zb(){return tb(wh,mb())}function Ab(){return tb(wh,nb())}function Bb(){var a=lb();return wh?a.isInner?"1.2em":-25-Hb("x"):a.isInner?"-0.5em":Mh?Mh-10:"3em"}function Cb(){var a=mb();return wh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Hb("y")}function Db(){var a=nb();return wh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Hb("y2")}function Eb(){return ub(!wh,lb())}function Fb(){return ub(wh,mb())}function Gb(){return ub(wh,nb())}function Hb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Ib(a){var b=Cj.select("."+g.axisX+" ."+g.axisXLabel),c=Cj.select("."+g.axisY+" ."+g.axisYLabel),d=Cj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",vb).attr("dx",yb).attr("dy",Bb).text(pb),(a?c.transition():c).attr("x",wb).attr("dx",zb).attr("dy",Cb).attr("dy",Cb).text(qb),(a?d.transition():d).attr("x",xb).attr("dx",Ab).attr("dy",Db).text(rb)}function Jb(a){var b=!1;return ug(Lc(Nf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Kb(){var a=Mf.svg.arc().outerRadius(mg).innerRadius(og),b=function(b,c){var d;return c?a(b):(d=Jb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Lb(a){var b=Mf.svg.arc().outerRadius(ng*(a?a:1)).innerRadius(og);return function(a){var c=Jb(a);return c?b(c):"M 0 0"}}function Mb(a,b){return se(a.data)?rg(a,b):"M 0 0"}function Nb(a){var b,c,d,e,f=Jb(a),g="";return f&&(b=rg.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*mg*.8+","+d/e*mg*.8+")"),g}function Ob(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Pb(a){return tc({id:a.data.id,value:a.value,ratio:Ob(a)})}function Qb(a){var b,c,d,e;return Tb()?(b=Jb(a),c=b?b.value:null,d=Ob(b),e=Ub(),e?e(c,d):Gd(c,d)):""}function Rb(a,b){var c=Aj.selectAll("."+g.chartArc+sd(a)),d=Aj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});ye(a)&&c.selectAll("path").transition().duration(50).attr("d",sg).transition().duration(100).attr("d",tg).each(function(a){re(a.data)}),b||d.style("opacity",.3)}function Sb(a){var b=Aj.selectAll("."+g.chartArc+sd(a));b.selectAll("path").transition().duration(50).attr("d",rg),Aj.selectAll("."+g.arc).style("opacity",1)}function Tb(){return ke(Nf.data.targets)?Ai:ui}function Ub(){return ke(Nf.data.targets)?Bi:vi}function Vb(){return ke(Nf.data.targets)?Di:""}function Wb(){var a=ke(Nf.data.targets)?Ei:xi;return"function"==typeof a?a:function(){}}function Xb(){var a=ke(Nf.data.targets)?Fi:yi;return"function"==typeof a?a:function(){}}function Yb(){var a=ke(Nf.data.targets)?Gi:zi;return"function"==typeof a?a:function(){}}function Zb(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Tg.length>0)for(g=Uc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return Mf.min(Object.keys(i).map(function(a){return Mf.min(i[a])}))}function $b(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Tg.length>0)for(g=Vc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return Mf.max(Object.keys(i).map(function(a){return Mf.max(i[a])}))}function _b(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return cb(a.id)===c}),m="y2"===c?$h:Rh,n="y2"===c?Zh:Qh,o=b(m)?m:Zb(l),p=b(n)?n:$b(l),q="y2"===c?_h:Sh,r=Ad()&&wh;return 0===l.length?"y2"===c?Fg.domain():Eg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=Bd(o,p),j=ec(Eg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Wh&&(f=b(Wh.top)?Wh.top:e,g=b(Wh.bottom)?Wh.bottom:e),"y2"===c&&di&&(f=b(di.top)?di.top:e,g=b(di.bottom)?di.bottom:e),he(l)&&!Uc(l)&&(g=o),[o-g,p+f])}function ac(a){return Kh?Vi?Ae(Kh):Kh:Mf.min(a,function(a){return Mf.min(a.values,function(a){return a.x})})}function bc(a){return Jh?Vi?Ae(Jh):Jh:Mf.max(a,function(a){return Mf.max(a.values,function(a){return a.x})})}function cc(a){var c,d,e,f,g=Fc(a),h=g[1]-g[0];return Wi?d=0:he(a)?(c=Dc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Lh&&Fe(Lh)?(e=b(Lh.left)?Lh.left:d,f=b(Lh.right)?Lh.right:d):e=f="number"==typeof Lh?Lh:d,{left:e,right:f}}function dc(a){var b=[ac(a),bc(a)],c=b[0],d=b[1],e=cc(a),f=0,g=0;return c-d!==0||Wi||(c=Vi?new Date(.5*c.getTime()):-.5,d=Vi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ec(a){return a[1]-a[0]}function fc(a){for(var b=0;bb?0:b-c}function lc(a){var b,c=jc(a),d="y"===a.axis?Eg:Fg;return b="y"===a.axis||"y2"===a.axis?wh?ig:"start"in a?d(a.start):ig:wh?"end"in a?Dg(Vi?Ae(a.end):a.end):ig:ig,c>b?0:b-c}function mc(a){return Ng&&a===Ng||Fe(Og)&&Ge(Og,a)}function nc(a){return!mc(a)}function oc(a){return Ng?Ng:Fe(Og)?Og[a]:null}function pc(a,b){var c,d=b&&Fe(b)?Gc(b):[];return d.forEach(function(b){oc(b)===a&&(c=Nf.data.xs[b])}),c}function qc(a,b){return a in Nf.data.xs&&Nf.data.xs[a]&&Nf.data.xs[a][b]?Nf.data.xs[a][b]:b}function rc(a){Object.keys(a).forEach(function(b){Og[b]=a[b]})}function sc(a){return 1===Mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function tc(a){var b;return a&&(b=Rg[a.id],a.name=b?b:a.id),a}function uc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=wc(b[d],a.id,d)}),Nf.data.xs[a.id]=b})}function vc(a,b){a.forEach(function(a){b[a.id]&&uc([a],b[a.id])})}function wc(a,c,d){var e;return e=Vi?a?a instanceof Date?a:Ae(a):Ae(qc(c,d)):Xi&&!Wi?b(a)?+a:qc(c,d):d}function xc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Ng?(d=Object.keys(Nf.data.xs),Nf.data.xs[c]=d.length>0?Nf.data.xs[d[0]]:void 0):Fe(Og)&&(Nf.data.xs[c]=pc(f,Nf.data.targets)):Nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Qg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=oc(b),g=a[f],h=wc(g,b,e);return Xi&&Wi&&0===c&&g&&(0===e&&(Ah=[]),Ah.push(g)),("undefined"==typeof a[b]||Nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Vg&&fe(Gc(c).filter(function(a){return!(a in Wg)}),Vg),c.forEach(function(a){gc(a.id_org,a)}),c}function Ac(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 Bc(a){return a>0&&Nf.data.targets[0].values[a-1]?Nf.data.targets[0].values[a-1].x:void 0}function Cc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Fc(a){var b,c,d=Ec(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Gc(a){return a.map(function(a){return a.id})}function Hc(a){return a?"string"==typeof a?[a]:a:Gc(Nf.data.targets)}function Ic(a,b){var c,d=Gc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Vi?new Date(i):i);j.push(e)}return Vi||(j=j.sort(function(a,b){return a-b})),j}function Oc(a){fj=fj.concat(a)}function Pc(a){fj=fj.filter(function(b){return a.indexOf(b)<0})}function Qc(a){gj=gj.concat(a)}function Rc(a){gj=gj.filter(function(b){return a.indexOf(b)<0})}function Sc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Tc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Vc(a){return Tc(a,function(a){return a>0})}function Wc(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||0===a[f].x)&&(e=e.concat(Md(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Md(a,g))),Pd(e,b)):Nd(a,b,f,g)}function Od(a,b){var c;return c=a.map(function(a){return Nd(a.values,b)}),Pd(c,b)}function Pd(a,b){var c,d;return a.forEach(function(a){var e=He(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Qd(a,b){return Mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Rd(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 Sd(){return Yg&&"desc"===Yg.toLowerCase()}function Td(){return Yg&&"asc"===Yg.toLowerCase()}function Ud(a){var b=Td(),c=Sd();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 Yg&&a.sort(Yg),a}function Vd(a,c){var d,e,f,g,h,i,j,k=le(Nf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&Ii&&(Fj.html(Li(a,db(),Cd(k),cj)).style("display","block"),d=Fj.property("offsetWidth"),e=Fj.property("offsetHeight"),k?(g=gg/2+c[0],i=ig/2+c[1]+20):(wh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-y(),i=Dg(l[0].x)+20):(f=s(),g=f+x()+Dg(l[0].x)+20,h=g+d,j=f+t()-y(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),Fj.style("top",i+"px").style("left",g+"px"))}function Wd(){Fj.style("display","none")}function Xd(a){var c=a.filter(function(a){return a&&b(a.value)});if(Ii&&!ie(Nf.data.targets)&&!le(Nf.data.targets)){var d=Cj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(wh?"y1":"x1",Id).attr(wh?"y2":"x2",Id),pf(d,"grid")}}function Yd(){Cj.select("line."+g.xgridFocus).style("visibility","hidden")}function Zd(a,b){var c,d,e,f,h=[],i=Cj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=dc(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function $d(a){return a.x||0===a.x?Dg(a.x):null}function _d(a){return $(a.id)(a.value)}function ae(){var a,b,d={},e=0;return Lc(Nf.data.targets.filter(oe)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ee(a,b){return"number"==typeof si?si:b?2*a.tickOffset()*ti/b:0}function fe(a,b){Hc(a).forEach(function(a){Jj[a]=b===Wg[a],Wg[a]=b})}function ge(a,b){var c=!1;return a.forEach(function(a){Wg[a.id]===b&&(c=!0),a.id in Wg||"line"!==b||(c=!0)}),c}function he(a){return ge(a,"bar")}function ie(a){return ge(a,"scatter")}function je(a){return ge(a,"pie")}function ke(a){return ge(a,"donut")}function le(a){return je(a)||ke(a)}function me(a){var b="string"==typeof a?a:a.id;return!(b in Wg)||"line"===Wg[b]||"spline"===Wg[b]||"area"===Wg[b]||"area-spline"===Wg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"spline"===Wg[b]||"area-spline"===Wg[b]}function oe(a){var b="string"==typeof a?a:a.id;return"bar"===Wg[b]}function pe(a){var b="string"==typeof a?a:a.id;return"scatter"===Wg[b]}function qe(a){var b="string"==typeof a?a:a.id;return"pie"===Wg[b]}function re(a){var b="string"==typeof a?a:a.id;return"donut"===Wg[b]}function se(a){return qe(a)||re(a)}function te(a){return me(a)?[a]:[]}function ue(a){return se(a.data)?[a]:[]}function ve(a){return oe(a)?a.values:[]}function we(a){return me(a)||pe(a)?a.values:[]}function xe(a){return oe(a)||me(a)?a.values:[]}function ye(a){return re(a)&&Ci||qe(a)&&wi}function ze(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function Ae(b){var c;try{c=Pg?Mf.time.format(Pg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Pg)}return c}function Be(a,b){var c=Mf.mouse(a),d=Mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ge(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function He(a,b){var c="y"===cb(a.id)?Eg:Fg,d=wh?1:0,e=wh?0:1;return Math.pow(Dg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ie(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Je(a,b,c){return d(a[b])?a[b]:c}function Ke(a){return 10*Math.ceil(a/10)}function Le(a,b,c){jh(b,a.node()),Cj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Xc(g.selectedCircle,c)}).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d).attr("stroke",function(){return cj(b)}).attr("r",1.4*We(b)).transition().duration(100).attr("r",We)}function Me(a,b,c){kh(b,a.node()),Cj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ne(a,b,c,d){a?Le(b,c,d):Me(b,c,d)}function Oe(a,b){jh(b,a.node()),a.transition().duration(100).style("fill",function(){return Mf.rgb(cj(b)).brighter(.75)})}function Pe(a,b){kh(b,a.node()),a.transition().duration(100).style("fill",function(){return cj(b)})}function Qe(a,b,c,d){a?Oe(b,c,d):Pe(b,c,d)}function Re(a,b,c,d){Qe(a,b,c.data,d)}function Se(a){return"circle"===a.nodeName?Ne:Mf.select(a).classed(g.bar)?Qe:Re}function Te(a){return a.filter(function(a){return b(a.value)})}function Ue(a){return li?"function"==typeof mi?mi(a):mi:0}function Ve(a){return oi?pi?pi:1.75*Ue(a):Ue(a)}function We(a){return qi?qi:4*Ue(a)}function Xe(a,c){return(c?Cj.selectAll("."+g.circles+rd(c)):Cj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ye(a,b){Xe(a,b).classed(g.EXPANDED,!0).attr("r",Ve)}function Ze(a){Xe(a).filter(function(){return Mf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Ue)}function $e(a){return Cj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function _e(a){$e(a).classed(g.EXPANDED,!0)}function af(a){$e(a).classed(g.EXPANDED,!1)}function bf(a,b){var c=ff(a,b);return function(a,b){var d=c(a,b),e=wh?1:0,f=wh?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 cf(a,b){var c=ff(a,!1),d=b?df:ef;return function(a,b){return d(c(a,b),a,this)}}function df(a,b){var c;return wh?(c=oe(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function ef(a,b,c){var d=c.getBoundingClientRect();return wh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:oe(b)?-3:-6)}function ff(a,b){var c=a.__max__+1,d=ee(Jg,c),e=be(d,c,a,!!b),f=ce(!!b),g=de(a,!!b),h=b?_:$;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return wh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function gf(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function hf(b){var c,d,e;if(Gj=Mf.select(Pf),Gj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Gj.html("").classed("c3",!0),Nf.data.xs={},Nf.data.targets=zc(b),bh&&(Nf.data.targets=Nf.data.targets.filter(bh)),ah&&Oc(ah===!0?Gc(Nf.data.targets):ah),p(),V(),Dg.domain(Mf.extent(dc(Nf.data.targets))),Eg.domain(_b(Nf.data.targets,"y")),Fg.domain(_b(Nf.data.targets,"y2")),Gg.domain(Dg.domain()),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Hj=Dg.domain(),vj.scale(Gg),Wf&&zj.scale(Dg),Aj=Gj.append("svg").on("mouseenter",$f).on("mouseleave",_f),Bj=Aj.append("defs"),Bj.append("clipPath").attr("id",Pi).append("rect"),Bj.append("clipPath").attr("id",Qi).append("rect"),Bj.append("clipPath").attr("id",Ri).append("rect"),uf(),Cj=Aj.append("g").attr("transform",mj.main),Dj=Aj.append("g").attr("transform",mj.context),Ej=Aj.append("g").attr("transform",mj.legend),nh||Dj.style("visibility","hidden"),qh||(Ej.style("visibility","hidden"),gj=Gc(Nf.data.targets)),Fj=Mf.select(Pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Hf(Gc(Nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=Cj.append("g").attr("clip-path",Si).attr("class",g.grid),fi&&d.append("g").attr("class",g.xgrids),Fe(hi)&&d.append("g").attr("class",g.xgridLines),ni&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),ii&&d.append("g").attr("class",g.ygrids),Fe(ji)&&d.append("g").attr("class",g.ygridLines),Cj.append("g").attr("clip-path",Si).attr("class",g.regions),Cj.append("g").attr("clip-path",Si).attr("class",g.chart),c=Cj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Wf?wh?"ns-resize":"ew-resize":null),Cj.select("."+g.chart).append("g").attr("class",g.chartBars),Cj.select("."+g.chart).append("g").attr("class",g.chartLines),Cj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",mj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Vb()),Cj.select("."+g.chart).append("g").attr("class",g.chartTexts),Wf&&Cj.insert("rect",Yf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",gg).attr("height",ig).style("opacity",0).style("cursor",wh?"ns-resize":"ew-resize").call(zj).on("dblclick.zoom",null),Nh&&vj.extent("function"!=typeof Nh?Nh:Nh(dc())),hj.x=Cj.append("g").attr("class",g.axisX).attr("clip-path",Ti).attr("transform",mj.x).style("visibility",xh?"visible":"hidden"),hj.x.append("text").attr("class",g.axisXLabel).attr("transform",wh?"rotate(-90)":"").style("text-anchor",Eb),hj.y=Cj.append("g").attr("class",g.axisY).attr("clip-path",Ui).attr("transform",mj.y).style("visibility",Ph?"visible":"hidden"),hj.y.append("text").attr("class",g.axisYLabel).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Fb),hj.y2=Cj.append("g").attr("class",g.axisY2).attr("transform",mj.y2).style("visibility",Yh?"visible":"hidden"),hj.y2.append("text").attr("class",g.axisY2Label).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Gb),Dj.append("g").attr("clip-path",Si).attr("class",g.chart),Dj.select("."+g.chart).append("g").attr("class",g.chartBars),Dj.select("."+g.chart).append("g").attr("class",g.chartLines),Dj.append("g").attr("clip-path",Si).attr("class",g.brush).call(vj).selectAll("rect").attr(wh?"width":"height",wh?hg:jg),hj.subx=Dj.append("g").attr("class",g.axisX).attr("transform",mj.subx).attr("clip-path",wh?"":Ti),xf(Nf.data.targets),qf({withUpdateTranslate:!0,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Mi){if(Vi&&"string"==typeof Ni){for(Ni=Ae(Ni),e=0;e0){d=[];for(var f in Rg)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Rd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Qe,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function nf(a){le(Nf.data.targets)||ch&&(Yi=a,Cj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Zi=!0,lh())}function of(){le(Nf.data.targets)||ch&&(Cj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),Cj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Zi=!1,mh())}function pf(a,b){"grid"===b&&a.each(function(){var a=Mf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function qf(a,c){var d,e,f,h,i,j,k,l,m,n,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,Q,R,S,T,U,W,X,Y,Z,$=ae(),_=le(Nf.data.targets),ab=Lc(Nf.data.targets);if(a=a||{},E=Je(a,"withY",!0),F=Je(a,"withSubchart",!0),G=Je(a,"withTransition",!0),J=Je(a,"withTransform",!1),K=Je(a,"withUpdateXDomain",!1),L=Je(a,"withUpdateOrgXDomain",!1),N=Je(a,"withUpdateTranslate",!1),M=Je(a,"withLegend",!1),H=Je(a,"withTransitionForExit",G),I=Je(a,"withTransitionForAxis",G),T=G?cg:0,U=H?T:0,W=I?T:0,c=c||vf(W),M&&qh&&Hf(Gc(Nf.data.targets),a,c),Wi&&0===ab.length&&Dg.domain([0,hj.x.selectAll(".tick").size()]),ab.length&&(L&&(Dg.domain(Mf.extent(dc(ab))),Hj=Dg.domain(),Wf&&zj.scale(Dg).updateScaleExtent(),Gg.domain(Dg.domain()),vj.scale(Gg)),K&&(Dg.domain(vj.empty()?Hj:vj.extent()),Wf&&zj.scale(Dg).updateScaleExtent()),Hh||!Gh&&!Fh||(X=Nc(Mc(ab),Fh),Jg.tickValues(X),Mg.tickValues(X))),Eg.domain(_b(ab,"y")),Fg.domain(_b(ab,"y2")),hj.x.style("opacity",_?0:1),hj.y.style("opacity",_?0:1),hj.y2.style("opacity",_?0:1),hj.subx.style("opacity",_?0:1),c.axisX.call(Jg),c.axisY.call(Kg),c.axisY2.call(Lg),c.axisSubX.call(Mg),Ib(G),N&&(p(),V(),uf(),o(!1)),K&&ab.length)if(Dh&&X){for(Y=1;Y=0&&Mf.select(this).style("display",b%Z?"none":"block")})}else Aj.selectAll("."+g.axisX+" .tick text").style("display","block");!wh&&Ih&&jb(hj.x,c.axisX,Ih),O=bf($),R=cf($,!0),S=cf($,!1),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Fj.style("display","none"),q(),Cj.select("line."+g.xgridFocus).style("visibility","hidden"),fi&&(f=Zd(gi,Dg),B=Wi?Jg.tickOffset():0,e=wh?{x1:0,x2:gg,y1:function(a){return Dg(a)-B},y2:function(a){return Dg(a)-B}}:{x1:function(a){return Dg(a)+B},x2:function(a){return Dg(a)+B},y1:dg.top,y2:ig},d=Cj.select("."+g.xgrids).selectAll("."+g.xgrid).data(f),d.enter().append("line").attr("class",g.xgrid),d.attr(e).style("opacity",function(){return+Mf.select(this).attr(wh?"y1":"x1")===(wh?ig:0)?0:1}),d.exit().remove()),Fe(hi)&&(h=Cj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(hi),i=h.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),i.append("line").style("opacity",0),i.append("text").attr("text-anchor","end").attr("transform",wh?"":"rotate(-90)").attr("dx",wh?0:-dg.top).attr("dy",-5).style("opacity",0),h.select("line").transition().duration(T).attr("x1",wh?0:Jd).attr("x2",wh?gg:Jd).attr("y1",wh?Jd:dg.top).attr("y2",wh?Jd:ig).style("opacity",1),h.select("text").transition().duration(T).attr("x",wh?gg:0).attr("y",Jd).text(function(a){return a.text}).style("opacity",1),h.exit().transition().duration(T).style("opacity",0).remove()),E&&ii&&(j=Cj.select("."+g.ygrids).selectAll("."+g.ygrid).data(Eg.ticks(ki)),j.enter().append("line").attr("class",g.ygrid),j.attr("x1",wh?Eg:0).attr("x2",wh?Eg:gg).attr("y1",wh?0:Eg).attr("y2",wh?ig:Eg),j.exit().remove(),pf(j,"grid")),E&&Fe(ji)&&(k=Cj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(ji),l=k.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",wh?"rotate(-90)":"").attr("dx",wh?0:-dg.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",wh?Kd:0).attr("x2",wh?Kd:gg).attr("y1",wh?0:Kd).attr("y2",wh?ig:Kd).style("opacity",1),k.select("text").transition().duration(T).attr("x",wh?0:gg).attr("y",Kd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),u=Cj.select("."+g.regions).selectAll("."+g.region).data(Hi),u.enter().append("g").attr("class",kd).append("rect").style("fill-opacity",0),u.selectAll("rect").transition().duration(T).attr("x",ic).attr("y",jc).attr("width",kc).attr("height",lc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),u.exit().transition().duration(T).style("opacity",0).remove(),s=Cj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),s.enter().append("path").attr("class",ed).style("stroke","none").style("fill",cj),s.style("opacity",wd).transition().duration(T).attr("d",O).style("fill",cj).style("opacity",1),s.exit().transition().duration(U).style("opacity",0).remove(),m=Cj.selectAll("."+g.lines).selectAll("."+g.line).data(te),m.enter().append("path").attr("class",ad).style("stroke",cj),m.style("opacity",wd).transition().duration(T).attr("d",wj).style("stroke",cj).style("opacity",1),m.exit().transition().duration(U).style("opacity",0).remove(),n=Cj.selectAll("."+g.areas).selectAll("."+g.area).data(te),n.enter().append("path").attr("class",id).style("fill",cj).style("opacity",function(){return Ij=+Mf.select(this).style("opacity"),0}),n.style("opacity",0).transition().duration(T).attr("d",xj).style("fill",cj).style("opacity",Ij),n.exit().transition().duration(U).style("opacity",0).remove(),r=Cj.selectAll("."+g.circles).selectAll("."+g.circle).data(we),r.enter().append("circle").attr("class",cd).attr("r",Ue).style("fill",cj),r.style("opacity",wd).transition().duration(T).style("opacity",yd).style("fill",cj).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d),r.exit().remove(),v=Cj.selectAll("."+g.texts).selectAll("."+g.text).data(xe),v.enter().append("text").attr("class",Yc).attr("text-anchor",function(a){return wh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",cj).style("fill-opacity",0),v.text(function(a){return Hd(a.id)(a.value,a.id)}).style("fill-opacity",xd).transition().duration(T).attr("x",R).attr("y",S).style("fill",cj).style("fill-opacity",zd),v.exit().transition().duration(U).style("fill-opacity",0).remove(),t=Cj.selectAll("."+g.arcs).selectAll("."+g.arc).data(ue),t.enter().append("path").attr("class",gd).style("fill",function(a){return cj(a.data)}).style("cursor",function(a){return eh(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;aj||(c=Jb(a),d=Pb(c),e=Xb(),Rb(c.data.id),Df(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Jb(a),c=Pb(b),d=[c];Vd(d,Mf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;aj||(c=Jb(a),d=Pb(c),e=Yb(),Sb(c.data.id),Ef(),Wd(),e(d,b))}).on("click",function(a,b){var c=Jb(a),d=Pb(c),e=Wb();lf(this,a,b),e(d,b)}),t.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){aj=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Jb(a);return c?(b=Mf.interpolate(this._current,c),this._current=b(0),function(a){return Mb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("fill",function(a){return cj(a.data)}).style("opacity",1).call(Ie,function(){aj=!1}),t.exit().transition().duration(U).style("opacity",0).remove(),Cj.selectAll("."+g.chartArc).select("text").attr("transform",Nb).style("opacity",0).transition().duration(T).text(Qb).style("opacity",function(a){return Jc(a.data.id)&&se(a.data)?1:0}),Cj.select("."+g.chartArcsTitle).style("opacity",ke(Nf.data.targets)?1:0),nh&&(Mf.event&&"zoom"===Mf.event.type&&vj.extent(Dg.orgDomain()).update(),F&&(!wh&&Ih&&jb(hj.subx,c.axisSubX,Ih),vj.empty()||vj.extent(Dg.orgDomain()).update(),Q=bf($,!0),x=Dj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),x.enter().append("path").attr("class",ed).style("stroke","none").style("fill",cj),x.style("opacity",wd).transition().duration(T).attr("d",Q).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove(),w=Dj.selectAll("."+g.lines).selectAll("."+g.line).data(te),w.enter().append("path").attr("class",ad).style("stroke",cj),w.style("opacity",wd).transition().duration(T).attr("d",yj).style("opacity",1),w.exit().transition().duration(T).style("opacity",0).remove())),Cj.selectAll("."+g.selectedCircles).filter(function(a){return oe(a)}).selectAll("circle").remove(),Cj.selectAll("."+g.selectedCircle).transition().duration(T).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d),Zf&&(y=Cj.select("."+g.eventRects),Fe(Og)&&!sc(Og)?(y.classed(g.eventRectsMultiple)||y.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),z=Cj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),kf(z.enter()),z.attr("x",0).attr("y",0).attr("width",gg).attr("height",ig)):(y.classed(g.eventRectsSingle)||y.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Xi&&!Wi?(D=function(a,b){var c=Bc(b),d=Cc(b),e=Nf.data.xs[a.id][b];return(Dg(d?d:e+50)-Dg(c?c:e-50))/2},C=function(a,b){var c=Bc(b),d=Nf.data.xs[a.id][b];return(Dg(d)+Dg(c?c:d-50))/2}):(D=P(),C=function(a){return Dg(a.x)-D/2}),A=Ec(Nf.data.targets),Cj.select("."+g.eventRects).datum(A?A.values:[]),z=Cj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),jf(z.enter()),z.attr("class",ld).attr("x",wh?0:C).attr("y",wh?C:0).attr("width",wh?gg:D).attr("height",wh?D:ig),z.exit().remove())),Gc(Nf.data.targets).forEach(function(a){Jj[a]=!0})}function rf(){qf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function sf(){if(0!==Lc(Nf.data.targets).length){if("mousemove"===Mf.event.sourceEvent.type&&zj.altDomain)return Dg.domain(zj.altDomain),void zj.scale(Dg).updateScaleExtent();Wi&&Dg.orgDomain()[0]===Hj[0]&&Dg.domain([Hj[0]-1e-10,Dg.orgDomain()[1]]),qf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Mf.event.sourceEvent.type&&($i=!0)}}function tf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function uf(){Aj.attr("width",kg).attr("height",lg),Aj.select("#"+Pi).select("rect").attr("width",gg).attr("height",ig),Aj.select("#"+Qi).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),Aj.select("#"+Ri).select("rect").attr("x",H).attr("y",I).attr("width",N).attr("height",O),Aj.select("."+g.zoomRect).attr("width",gg).attr("height",ig),Gj.style("max-height",lg+"px")}function vf(a){return{axisX:a?hj.x.transition().duration(a):hj.x,axisY:a?hj.y.transition().duration(a):hj.y,axisY2:a?hj.y2.transition().duration(a):hj.y2,axisSubX:a?hj.subx.transition().duration(a):hj.subx}}function wf(a){var b;a=a||{},a.withTransition=Je(a,"withTransition",!0),a.withTransform=Je(a,"withTransform",!1),a.withLegend=Je(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withLegend&&qh||(b=vf(a.withTransitionForAxis?cg:0),p(),V(),uf(),o(a.withTransition,b)),qf(a,b)}function xf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=Cj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",nd),j=i.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Zc),e=Cj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),d=e.enter().append("g").attr("class",pd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",fd).style("cursor",function(a){return eh(a)?"pointer":null}),c=Cj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),b=c.enter().append("g").attr("class",od).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",bd),b.append("g").attr("class",jd),b.append("g").attr("class",function(a){return Xc(g.selectedCircles,a.id)}),b.append("g").attr("class",dd).style("cursor",function(a){return eh(a)?"pointer":null}),a.forEach(function(a){Cj.selectAll("."+g.selectedCircles+rd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Cj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(ug(a)).attr("class",qd),f=h.enter().append("g").attr("class",qd),f.append("g").attr("class",hd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),nh&&(n=Dj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),m=n.enter().append("g").style("opacity",0).attr("class",pd),m.append("g").attr("class",fd),l=Dj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),k=l.enter().append("g").style("opacity",0).attr("class",od),k.append("g").attr("class",bd)),Aj.selectAll("."+g.target).filter(function(a){return Jc(a.id)}).transition().duration(cg).style("opacity",1)}function yf(a,b){b.filter&&(a=a.filter(b.filter)),(b.type||b.types)&&a.forEach(function(a){b.types?fe(a.id,b.types[a.id]):fe(a.id,b.type)}),Nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,z=0,F++)),E[a]=F,D[F]=f,A[a]=z,z+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+v)/10),j=10*Math.ceil((h.height+u)/10),k=nj?j:i,l=nj?U():T();return d&&(z=0,F=0,w=0,x=0),qh&&!Kc(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=i,C[c]=j,(!w||i>=w)&&(w=i),(!x||j>=x)&&(x=j),g=nj?x:w,void(vh?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(l-g*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=26,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=Ej.selectAll("."+g.legendItemFocused).size();b=b||{},n=Je(b,"withTransition",!0),q=Je(b,"withTransitionForTransform",!0),nj?(f=function(a){return w*E[a]},j=function(a){return D[E[a]]+A[a]}):(f=function(a){return D[E[a]]+A[a]},j=function(a){return x*E[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=Ej.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Xc(g.legendItem,a)}).style("visibility",function(a){return Kc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof sh?sh(a):Nf.toggle(a)}).on("mouseover",function(a){Mf.select(this).classed(g.legendItemFocused,!0),aj||Nf.focus(a),"function"==typeof th&&th(a)}).on("mouseout",function(a){Mf.select(this).classed(g.legendItemFocused,!1),aj||Nf.revert(),"function"==typeof uh&&uh(a)}),m.append("text").text(function(a){return d(Rg[a])?Rg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",nj?h:-200).attr("y",nj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",nj?i:-200).attr("y",nj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",cj).attr("x",nj?h:-200).attr("y",nj?-200:j).attr("width",10).attr("height",10),r=Ej.selectAll("text").data(a).text(function(a){return d(Rg[a])?Rg[a]:a}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=Ej.selectAll("rect."+g.legendItemEvent).data(a),(n?s.transition():s).attr("width",function(a){return B[a]}).attr("height",function(a){return C[a]}).attr("x",i).attr("y",l),t=Ej.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",cj).attr("x",f).attr("y",j),Ej.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Jc(a)}).transition().style("opacity",function(a){var b=Mf.select(this);return Jc(a)?!G||b.classed(g.legendItemFocused)?Bf(b):Cf(b):rj}),R(w),S(x),Q(F),p(),V(),uf(),o(q,c)}function If(a){return Ic(Nf.data.targets,a.id)}function Jf(a){return"data"in a&&Ic(Nf.data.targets,a.data.id)}function Kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function Lf(a,b,c){var d=!le(Nf.data.targets);aj=!1,fe(a,b),wf(c||{withTransitionForAxis:d})}var Mf=a.d3?a.d3:a.require?a.require("d3"):void 0,Nf={data:{},axis:{},legend:{}},Of={},Pf=i(["bindto"],"#chart"),Qf=i(["size","width"]),Rf=i(["size","height"]),Sf=i(["padding","left"]),Tf=i(["padding","right"]),Uf=i(["padding","top"]),Vf=i(["padding","bottom"]),Wf=i(["zoom","enabled"],!1),Xf=i(["zoom","extent"]),Yf=i(["zoom","privileged"],!1),Zf=i(["interaction","enabled"],!0),$f=i(["onenter"],function(){}),_f=i(["onleave"],function(){}),ag=i(["onresize"],function(){}),bg=i(["onresized"],function(){}),cg=i(["transition","duration"],350);h("data","data is required in config");var dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg,Kg,Lg,Mg,Ng=i(["data","x"]),Og=i(["data","xs"],{}),Pg=i(["data","x_format"]),Qg=i(["data","id_converter"],function(a){return a}),Rg=i(["data","names"],{}),Sg=i(["data","classes"],{}),Tg=i(["data","groups"],[]),Ug=i(["data","axes"],{}),Vg=i(["data","type"]),Wg=i(["data","types"],{}),Xg=i(["data","labels"],{}),Yg=i(["data","order"]),Zg=i(["data","regions"],{}),$g=i(["data","color"]),_g=i(["data","colors"],{}),ah=i(["data","hide"],!1),bh=i(["data","filter"]),ch=i(["data","selection","enabled"],!1),dh=i(["data","selection","grouped"],!1),eh=i(["data","selection","isselectable"],function(){return!0}),fh=i(["data","selection","multiple"],!0),gh=i(["data","onclick"],function(){}),hh=i(["data","onenter"],function(){}),ih=i(["data","onleave"],function(){}),jh=i(["data","onselected"],function(){}),kh=i(["data","onunselected"],function(){}),lh=i(["data","ondragstart"],function(){}),mh=i(["data","ondragend"],function(){}),nh=i(["subchart","show"],!1),oh=i(["subchart","size","height"],60),ph=i(["color","pattern"],[]),qh=i(["legend","show"],!0),rh=i(["legend","position"],"bottom"),sh=i(["legend","item","onclick"]),th=i(["legend","item","onmouseover"]),uh=i(["legend","item","onmouseout"]),vh=i(["legend","equally"],!1),wh=i(["axis","rotated"],!1),xh=i(["axis","x","show"],!0),yh=i(["axis","x","type"],"indexed"),zh=i(["axis","x","localtime"],!0),Ah=i(["axis","x","categories"],[]),Bh=i(["axis","x","tick","centered"],!1),Ch=i(["axis","x","tick","format"]),Dh=i(["axis","x","tick","culling"],{}),Eh=i(["axis","x","tick","culling","max"],10),Fh=i(["axis","x","tick","count"]),Gh=i(["axis","x","tick","fit"],!0),Hh=i(["axis","x","tick","values"],null),Ih=i(["axis","x","tick","rotate"]),Jh=i(["axis","x","max"],null),Kh=i(["axis","x","min"],null),Lh=i(["axis","x","padding"],{}),Mh=i(["axis","x","height"]),Nh=i(["axis","x","default"]),Oh=i(["axis","x","label"],{}),Ph=i(["axis","y","show"],!0),Qh=i(["axis","y","max"]),Rh=i(["axis","y","min"]),Sh=i(["axis","y","center"]),Th=i(["axis","y","label"],{}),Uh=i(["axis","y","inner"],!1),Vh=i(["axis","y","tick","format"]),Wh=i(["axis","y","padding"]),Xh=i(["axis","y","ticks"],10),Yh=i(["axis","y2","show"],!1),Zh=i(["axis","y2","max"]),$h=i(["axis","y2","min"]),_h=i(["axis","y2","center"]),ai=i(["axis","y2","label"],{}),bi=i(["axis","y2","inner"],!1),ci=i(["axis","y2","tick","format"]),di=i(["axis","y2","padding"]),ei=i(["axis","y2","ticks"],10),fi=i(["grid","x","show"],!1),gi=i(["grid","x","type"],"tick"),hi=i(["grid","x","lines"],[]),ii=i(["grid","y","show"],!1),ji=i(["grid","y","lines"],[]),ki=i(["grid","y","ticks"],10),li=i(["point","show"],!0),mi=i(["point","r"],2.5),ni=i(["point","focus","line","enabled"],!0),oi=i(["point","focus","expand","enabled"],!0),pi=i(["point","focus","expand","r"]),qi=i(["point","focus","select","r"]),ri=i(["line","connect_null"],!1),si=i(["bar","width"]),ti=i(["bar","width","ratio"],.6),ui=i(["pie","label","show"],!0),vi=i(["pie","label","format"]),wi=i(["pie","expand"],!0),xi=i(["pie","onclick"],function(){}),yi=i(["pie","onmouseover"],function(){}),zi=i(["pie","onmouseout"],function(){}),Ai=i(["donut","label","show"],!0),Bi=i(["donut","label","format"]),Ci=i(["donut","expand"],!0),Di=i(["donut","title"],""),Ei=i(["donut","onclick"],function(){}),Fi=i(["donut","onmouseover"],function(){}),Gi=i(["donut","onmouseout"],function(){}),Hi=i(["regions"],[]),Ii=i(["tooltip","show"],!0),Ji=i(["tooltip","format","title"]),Ki=i(["tooltip","format","value"]),Li=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Ji?Ji:b,l=Ki?Ki:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Mi=i(["tooltip","init","show"],!1),Ni=i(["tooltip","init","x"],0),Oi=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Pi=("string"==typeof Pf?Pf.replace("#",""):Pf.id)+"-clip",Qi=Pi+"-xaxis",Ri=Pi+"-yaxis",Si=j(Pi),Ti=j(Qi),Ui=j(Ri),Vi="timeseries"===yh,Wi="categorized"===yh,Xi=!Vi&&(Ng||Fe(Og)),Yi=null,Zi=!1,$i=!1,_i=!1,aj=!1,bj=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],cj=ze(_g,Fe(ph)?ph:bj,$g),dj=zh?Mf.time.format:Mf.time.format.utc,ej=dj.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),fj=[],gj=[],hj={},ij=wh?"left":"bottom",jj=wh?Uh?"top":"bottom":Uh?"right":"left",kj=wh?bi?"bottom":"top":bi?"left":"right",lj=wh?"left":"bottom",mj={main:function(){return"translate("+k(dg.left)+","+k(dg.top)+")"},context:function(){return"translate("+k(eg.left)+","+k(eg.top)+")"},legend:function(){return"translate("+fg.left+","+fg.top+")"},x:function(){return"translate(0,"+(wh?0:ig)+")"},y:function(){return"translate(0,"+(wh?ig:0)+")" -},y2:function(){return"translate("+(wh?0:gg)+","+(wh?1:0)+")"},subx:function(){return"translate(0,"+(wh?0:jg)+")"},arc:function(){return"translate("+pg/2+","+qg/2+")"}},nj="right"===rh,oj=0,pj=0,qj=0,rj=.15,sj=30,tj=wh&&!xh?0:30,uj=5;ug=Mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var vj,wj=function(){var a=Mf.svg.line().x(wh?function(a){return $(a.id)(a.value)}:Id).y(wh?Id:function(a){return $(a.id)(a.value)});return ri||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ri?Te(b.values):b.values;return me(b)?(a.interpolate(ne(b)?"cardinal":"linear"),Zg[b.id]?gf(e,Dg,$(b.id),Zg[b.id]):a(e)):(c=e[0]?Dg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,wh?"M "+d+" "+c:"M "+c+" "+d)}}(),xj=function(){var a;return a=wh?Mf.svg.area().x0(function(a){return $(a.id)(0)}).x1(function(a){return $(a.id)(a.value)}).y(Id):Mf.svg.area().x(Id).y0(function(a){return $(a.id)(0)}).y1(function(a){return $(a.id)(a.value)}),function(b){var c,d,e=Te(b.values);return ge([b],"area")||ge([b],"area-spline")?(a.interpolate(ne(b)?"cardinal":"linear"),a(e)):(c=e[0]?Dg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,wh?"M "+d+" "+c:"M "+c+" "+d)}}(),yj=function(){var a=Mf.svg.line().x(wh?function(a){return _(a.id)(a.value)}:Ld).y(wh?Ld:function(a){return _(a.id)(a.value)});return function(b){var c=Te(b.values);return me(b)?a(c):"M "+Gg(c[0].x)+" "+_(b.id)(c[0].value)}}(),zj=function(){};vj=Mf.svg.brush().on("brush",rf),vj.update=function(){return Dj&&Dj.select("."+g.brush).call(this),this},vj.scale=function(a){return wh?this.y(a):this.x(a)},Wf&&(zj=Mf.behavior.zoom().on("zoomstart",function(){zj.altDomain=Mf.event.sourceEvent.altKey?Dg.orgDomain():null}).on("zoom",Wf?sf:null),zj.scale=function(a){return wh?this.y(a):this.x(a)},zj.orgScaleExtent=function(){var a=Xf?Xf:[1,10];return[a[0],Math.max(Dc()/a[1],a[1])]},zj.updateScaleExtent=function(){var a=ec(Dg.orgDomain())/ec(Hj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Aj,Bj,Cj,Dj,Ej,Fj,Gj,Hj,Ij,Jj={};if(Nf.focus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);Nf.revert(),Nf.defocus(),b(d.classed(g.focused,!0)),b(e),le(Nf.data.targets)&&Rb(a,!0),Df(a,!0)},Nf.defocus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",.3)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);Nf.revert(),b(d.classed(g.focused,!1)),b(e),le(Nf.data.targets)&&Sb(a),Df(a,!1)},Nf.revert=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);b(d.classed(g.focused,!1)),b(e),le(Nf.data.targets)&&Sb(a),Ef()},Nf.show=function(a,b){a=Hc(a),b=b||{},Pc(a),Aj.selectAll(td(a)).transition().style("opacity",1),b.withLegend&&Ff(a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Nf.hide=function(a,b){a=Hc(a),b=b||{},Oc(a),Aj.selectAll(td(a)).transition().style("opacity",0),b.withLegend&&Gf(a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Nf.toggle=function(a){Jc(a)?Nf.hide(a):Nf.show(a)},Nf.unzoom=function(){vj.clear().update(),qf({withUpdateXDomain:!0})},Nf.load=function(a){return a.xs&&rc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Sg[b]=a.classes[b]}),"categories"in a&&Wi&&(Ah=a.categories,Jg.categories(Ah)),"cacheIds"in a&&fc(a.cacheIds)?void yf(hc(a.cacheIds),a.done):void("unload"in a?Af(Hc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){zf(a)}):zf(a))},Nf.unload=function(a,b){Af(Hc(a),function(){qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Nf.selected=function(a){return Mf.merge(Cj.selectAll("."+g.shapes+rd(a)).selectAll("."+g.shape).filter(function(){return Mf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Nf.select=function(a,b,c){ch&&Cj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Mf.select(this),i=e.data?e.data.id:e.id,j=Se(this),k=dh||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);"path"!==this.nodeName&&(k&&l?eh(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},Nf.unselect=function(a,b){ch&&Cj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Mf.select(this),f=c.data?c.data.id:c.id,h=Se(this),i=dh||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);"path"!==this.nodeName&&i&&j&&eh(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Nf.toLine=function(a){Lf(a,"line")},Nf.toSpline=function(a){Lf(a,"spline")},Nf.toBar=function(a){Lf(a,"bar")},Nf.toScatter=function(a){Lf(a,"scatter")},Nf.toArea=function(a){Lf(a,"area")},Nf.toAreaSpline=function(a){Lf(a,"area-spline")},Nf.toPie=function(a){Lf(a,"pie",{withTransform:!0})},Nf.toDonut=function(a){Lf(a,"donut",{withTransform:!0})},Nf.groups=function(a){return c(a)?Tg:(Tg=a,qf(),Tg)},Nf.xgrids=function(a){return a?(hi=a,qf(),hi):hi},Nf.xgrids.add=function(a){return a?Nf.xgrids(hi.concat(a)):void 0},Nf.xgrids.remove=function(a){var b=Kf(a);return Nf.xgrids(hi.filter(b))},Nf.ygrids=function(a){return a?(ji=a,qf(),ji):ji},Nf.ygrids.add=function(a){return a?Nf.ygrids(ji.concat(a)):void 0},Nf.ygrids.remove=function(a){var b=Kf(a);return Nf.ygrids(ji.filter(b))},Nf.regions=function(a){return a?(Hi=a,qf(),Hi):Hi},Nf.regions.add=function(a){return a?(Hi=Hi.concat(a),qf(),Hi):Hi},Nf.regions.remove=function(a){var b,c,d;return a=a||{},b=Je(a,"duration",cg),c=Je(a,"classes",[g.region]),d=Cj.select("."+g.regions).selectAll(c.map(function(a){return"."+a})),(b?d.transition().duration(b):d).style("opacity",0).remove(),Hi=Hi.filter(function(a){return c.indexOf(a.class)<0})},Nf.data.get=function(a){var b=Nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Nf.data.getAsTarget=function(a){var b=Nf.data.targets.filter(function(b){return b.id===a});return b.length>0?b[0]:void 0},Nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Rg[b]=a[b]}),qf({withLegend:!0}),Rg):Rg},Nf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){_g[b]=a[b]}),qf({withLegend:!0}),_g):_g},Nf.x=function(a){return arguments.length&&(uc(Nf.data.targets,a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Nf.data.xs},Nf.xs=function(a){return arguments.length&&(vc(Nf.data.targets,a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Nf.data.xs},Nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){gb(b,a[b])}),Ib())},Nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Jh=+a.x),b(a.y)&&(Qh=+a.y),b(a.y2)&&(Zh=+a.y2)):Qh=Zh=+a,qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Kh=+a.x),b(a.y)&&(Rh=+a.y),b(a.y2)&&($h=+a.y2)):Rh=$h=+a,qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Nf.axis.max(a.max),"undefined"!=typeof a.min&&Nf.axis.min(a.min))},Nf.legend.show=function(a){Ff(Hc(a)),qf({withLegend:!0})},Nf.legend.hide=function(a){Gf(Hc(a)),qf({withLegend:!0})},Nf.resize=function(a){Qf=a?a.width:null,Rf=a?a.height:null,wf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Nf.destroy=function(){Nf.data.targets=void 0,Nf.data.xs={},Gj.html(""),a.onresize=null},"url"in f.data)Mf.xhr(f.data.url,function(a,b){var c,d=Mf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Mf.csv.parse(b.response),hf(c)});else if("rows"in f.data)hf(xc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");hf(yc(f.data.columns))}return Nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(window); \ No newline at end of file +}:function(a){return e(a.value)},i=Vi?function(a,c,d,f){var g=a.x.getTime(),h=c.x-a.x,i=new Date(g+h*d),j=new Date(g+h*(d+f));return"M"+b(i)+" "+e(k(d))+" "+b(j)+" "+e(k(d+f))}:function(a,c,d,f){return"M"+b(j(d),!0)+" "+e(k(d))+" "+b(j(d+f),!0)+" "+e(k(d+f))},g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function hf(b){var c,d,e;if(Gj=Mf.select(Pf),Gj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Gj.html("").classed("c3",!0),Nf.data.xs={},Nf.data.targets=zc(b),bh&&(Nf.data.targets=Nf.data.targets.filter(bh)),ah&&Oc(ah===!0?Gc(Nf.data.targets):ah),p(),V(),Dg.domain(Mf.extent(dc(Nf.data.targets))),Eg.domain(_b(Nf.data.targets,"y")),Fg.domain(_b(Nf.data.targets,"y2")),Gg.domain(Dg.domain()),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Hj=Dg.domain(),vj.scale(Gg),Wf&&zj.scale(Dg),Aj=Gj.append("svg").on("mouseenter",$f).on("mouseleave",_f),Bj=Aj.append("defs"),Bj.append("clipPath").attr("id",Pi).append("rect"),Bj.append("clipPath").attr("id",Qi).append("rect"),Bj.append("clipPath").attr("id",Ri).append("rect"),uf(),Cj=Aj.append("g").attr("transform",mj.main),Dj=Aj.append("g").attr("transform",mj.context),Ej=Aj.append("g").attr("transform",mj.legend),nh||Dj.style("visibility","hidden"),qh||(Ej.style("visibility","hidden"),gj=Gc(Nf.data.targets)),Fj=Mf.select(Pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Hf(Gc(Nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=Cj.append("g").attr("clip-path",Si).attr("class",g.grid),fi&&d.append("g").attr("class",g.xgrids),Fe(hi)&&d.append("g").attr("class",g.xgridLines),ni&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),ii&&d.append("g").attr("class",g.ygrids),Fe(ji)&&d.append("g").attr("class",g.ygridLines),Cj.append("g").attr("clip-path",Si).attr("class",g.regions),Cj.append("g").attr("clip-path",Si).attr("class",g.chart),c=Cj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Wf?wh?"ns-resize":"ew-resize":null),Cj.select("."+g.chart).append("g").attr("class",g.chartBars),Cj.select("."+g.chart).append("g").attr("class",g.chartLines),Cj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",mj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Vb()),Cj.select("."+g.chart).append("g").attr("class",g.chartTexts),Wf&&Cj.insert("rect",Yf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",gg).attr("height",ig).style("opacity",0).style("cursor",wh?"ns-resize":"ew-resize").call(zj).on("dblclick.zoom",null),Nh&&vj.extent("function"!=typeof Nh?Nh:Nh(dc())),hj.x=Cj.append("g").attr("class",g.axisX).attr("clip-path",Ti).attr("transform",mj.x).style("visibility",xh?"visible":"hidden"),hj.x.append("text").attr("class",g.axisXLabel).attr("transform",wh?"rotate(-90)":"").style("text-anchor",Eb),hj.y=Cj.append("g").attr("class",g.axisY).attr("clip-path",Ui).attr("transform",mj.y).style("visibility",Ph?"visible":"hidden"),hj.y.append("text").attr("class",g.axisYLabel).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Fb),hj.y2=Cj.append("g").attr("class",g.axisY2).attr("transform",mj.y2).style("visibility",Yh?"visible":"hidden"),hj.y2.append("text").attr("class",g.axisY2Label).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Gb),Dj.append("g").attr("clip-path",Si).attr("class",g.chart),Dj.select("."+g.chart).append("g").attr("class",g.chartBars),Dj.select("."+g.chart).append("g").attr("class",g.chartLines),Dj.append("g").attr("clip-path",Si).attr("class",g.brush).call(vj).selectAll("rect").attr(wh?"width":"height",wh?hg:jg),hj.subx=Dj.append("g").attr("class",g.axisX).attr("transform",mj.subx).attr("clip-path",wh?"":Ti),xf(Nf.data.targets),qf({withUpdateTranslate:!0,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Mi){if(Vi&&"string"==typeof Ni){for(Ni=Ae(Ni),e=0;e0){d=[];for(var f in Rg)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Rd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Qe,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function nf(a){le(Nf.data.targets)||ch&&(Yi=a,Cj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Zi=!0,lh())}function of(){le(Nf.data.targets)||ch&&(Cj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),Cj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Zi=!1,mh())}function pf(a,b){"grid"===b&&a.each(function(){var a=Mf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function qf(a,c){var d,e,f,h,i,j,k,l,m,n,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,Q,R,S,T,U,W,X,Y,Z,$=ae(),_=le(Nf.data.targets),ab=Lc(Nf.data.targets);if(a=a||{},E=Je(a,"withY",!0),F=Je(a,"withSubchart",!0),G=Je(a,"withTransition",!0),J=Je(a,"withTransform",!1),K=Je(a,"withUpdateXDomain",!1),L=Je(a,"withUpdateOrgXDomain",!1),N=Je(a,"withUpdateTranslate",!1),M=Je(a,"withLegend",!1),H=Je(a,"withTransitionForExit",G),I=Je(a,"withTransitionForAxis",G),T=G?cg:0,U=H?T:0,W=I?T:0,c=c||vf(W),M&&qh&&Hf(Gc(Nf.data.targets),a,c),Wi&&0===ab.length&&Dg.domain([0,hj.x.selectAll(".tick").size()]),ab.length&&(L&&(Dg.domain(Mf.extent(dc(ab))),Hj=Dg.domain(),Wf&&zj.scale(Dg).updateScaleExtent(),Gg.domain(Dg.domain()),vj.scale(Gg)),K&&(Dg.domain(vj.empty()?Hj:vj.extent()),Wf&&zj.scale(Dg).updateScaleExtent()),Hh||!Gh&&!Fh||(X=Nc(Mc(ab),Fh),Jg.tickValues(X),Mg.tickValues(X))),Eg.domain(_b(ab,"y")),Fg.domain(_b(ab,"y2")),hj.x.style("opacity",_?0:1),hj.y.style("opacity",_?0:1),hj.y2.style("opacity",_?0:1),hj.subx.style("opacity",_?0:1),c.axisX.call(Jg),c.axisY.call(Kg),c.axisY2.call(Lg),c.axisSubX.call(Mg),Ib(G),N&&(p(),V(),uf(),o(!1),hj.x.call(Jg),hj.y.call(Kg),hj.y2.call(Lg),hj.subx.call(Mg)),K&&ab.length)if(Dh&&X){for(Y=1;Y=0&&Mf.select(this).style("display",b%Z?"none":"block")})}else Aj.selectAll("."+g.axisX+" .tick text").style("display","block");!wh&&Ih&&jb(hj.x,c.axisX,Ih),O=bf($),R=cf($,!0),S=cf($,!1),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Fj.style("display","none"),q(),Cj.select("line."+g.xgridFocus).style("visibility","hidden"),fi&&(f=Zd(gi,Dg),B=Wi?Jg.tickOffset():0,e=wh?{x1:0,x2:gg,y1:function(a){return Dg(a)-B},y2:function(a){return Dg(a)-B}}:{x1:function(a){return Dg(a)+B},x2:function(a){return Dg(a)+B},y1:dg.top,y2:ig},d=Cj.select("."+g.xgrids).selectAll("."+g.xgrid).data(f),d.enter().append("line").attr("class",g.xgrid),d.attr(e).style("opacity",function(){return+Mf.select(this).attr(wh?"y1":"x1")===(wh?ig:0)?0:1}),d.exit().remove()),Fe(hi)&&(h=Cj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(hi),i=h.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),i.append("line").style("opacity",0),i.append("text").attr("text-anchor","end").attr("transform",wh?"":"rotate(-90)").attr("dx",wh?0:-dg.top).attr("dy",-5).style("opacity",0),h.select("line").transition().duration(T).attr("x1",wh?0:Jd).attr("x2",wh?gg:Jd).attr("y1",wh?Jd:dg.top).attr("y2",wh?Jd:ig).style("opacity",1),h.select("text").transition().duration(T).attr("x",wh?gg:0).attr("y",Jd).text(function(a){return a.text}).style("opacity",1),h.exit().transition().duration(T).style("opacity",0).remove()),E&&ii&&(j=Cj.select("."+g.ygrids).selectAll("."+g.ygrid).data(Eg.ticks(ki)),j.enter().append("line").attr("class",g.ygrid),j.attr("x1",wh?Eg:0).attr("x2",wh?Eg:gg).attr("y1",wh?0:Eg).attr("y2",wh?ig:Eg),j.exit().remove(),pf(j,"grid")),E&&Fe(ji)&&(k=Cj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(ji),l=k.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",wh?"rotate(-90)":"").attr("dx",wh?0:-dg.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",wh?Kd:0).attr("x2",wh?Kd:gg).attr("y1",wh?0:Kd).attr("y2",wh?ig:Kd).style("opacity",1),k.select("text").transition().duration(T).attr("x",wh?0:gg).attr("y",Kd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),u=Cj.select("."+g.regions).selectAll("."+g.region).data(Hi),u.enter().append("g").attr("class",kd).append("rect").style("fill-opacity",0),u.selectAll("rect").transition().duration(T).attr("x",ic).attr("y",jc).attr("width",kc).attr("height",lc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),u.exit().transition().duration(T).style("opacity",0).remove(),s=Cj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),s.enter().append("path").attr("class",ed).style("stroke","none").style("fill",cj),s.style("opacity",wd).transition().duration(T).attr("d",O).style("fill",cj).style("opacity",1),s.exit().transition().duration(U).style("opacity",0).remove(),m=Cj.selectAll("."+g.lines).selectAll("."+g.line).data(te),m.enter().append("path").attr("class",ad).style("stroke",cj),m.style("opacity",wd).transition().duration(T).attr("d",wj).style("stroke",cj).style("opacity",1),m.exit().transition().duration(U).style("opacity",0).remove(),n=Cj.selectAll("."+g.areas).selectAll("."+g.area).data(te),n.enter().append("path").attr("class",id).style("fill",cj).style("opacity",function(){return Ij=+Mf.select(this).style("opacity"),0}),n.style("opacity",0).transition().duration(T).attr("d",xj).style("fill",cj).style("opacity",Ij),n.exit().transition().duration(U).style("opacity",0).remove(),r=Cj.selectAll("."+g.circles).selectAll("."+g.circle).data(we),r.enter().append("circle").attr("class",cd).attr("r",Ue).style("fill",cj),r.style("opacity",wd).transition().duration(T).style("opacity",yd).style("fill",cj).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d),r.exit().remove(),v=Cj.selectAll("."+g.texts).selectAll("."+g.text).data(xe),v.enter().append("text").attr("class",Yc).attr("text-anchor",function(a){return wh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",cj).style("fill-opacity",0),v.text(function(a){return Hd(a.id)(a.value,a.id)}).style("fill-opacity",xd).transition().duration(T).attr("x",R).attr("y",S).style("fill",cj).style("fill-opacity",zd),v.exit().transition().duration(U).style("fill-opacity",0).remove(),t=Cj.selectAll("."+g.arcs).selectAll("."+g.arc).data(ue),t.enter().append("path").attr("class",gd).style("fill",function(a){return cj(a.data)}).style("cursor",function(a){return eh(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;aj||(c=Jb(a),d=Pb(c),e=Xb(),Rb(c.data.id),Df(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Jb(a),c=Pb(b),d=[c];Vd(d,Mf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;aj||(c=Jb(a),d=Pb(c),e=Yb(),Sb(c.data.id),Ef(),Wd(),e(d,b))}).on("click",function(a,b){var c=Jb(a),d=Pb(c),e=Wb();lf(this,a,b),e(d,b)}),t.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){aj=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Jb(a);return c?(b=Mf.interpolate(this._current,c),this._current=b(0),function(a){return Mb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("fill",function(a){return cj(a.data)}).style("opacity",1).call(Ie,function(){aj=!1}),t.exit().transition().duration(U).style("opacity",0).remove(),Cj.selectAll("."+g.chartArc).select("text").attr("transform",Nb).style("opacity",0).transition().duration(T).text(Qb).style("opacity",function(a){return Jc(a.data.id)&&se(a.data)?1:0}),Cj.select("."+g.chartArcsTitle).style("opacity",ke(Nf.data.targets)?1:0),nh&&(Mf.event&&"zoom"===Mf.event.type&&vj.extent(Dg.orgDomain()).update(),F&&(!wh&&Ih&&jb(hj.subx,c.axisSubX,Ih),vj.empty()||vj.extent(Dg.orgDomain()).update(),Q=bf($,!0),x=Dj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),x.enter().append("path").attr("class",ed).style("stroke","none").style("fill",cj),x.style("opacity",wd).transition().duration(T).attr("d",Q).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove(),w=Dj.selectAll("."+g.lines).selectAll("."+g.line).data(te),w.enter().append("path").attr("class",ad).style("stroke",cj),w.style("opacity",wd).transition().duration(T).attr("d",yj).style("opacity",1),w.exit().transition().duration(T).style("opacity",0).remove())),Cj.selectAll("."+g.selectedCircles).filter(function(a){return oe(a)}).selectAll("circle").remove(),Cj.selectAll("."+g.selectedCircle).transition().duration(T).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d),Zf&&(y=Cj.select("."+g.eventRects),Fe(Og)&&!sc(Og)?(y.classed(g.eventRectsMultiple)||y.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),z=Cj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),kf(z.enter()),z.attr("x",0).attr("y",0).attr("width",gg).attr("height",ig)):(y.classed(g.eventRectsSingle)||y.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Xi&&!Wi?(D=function(a,b){var c=Bc(b),d=Cc(b),e=Nf.data.xs[a.id][b];return(Dg(d?d:e+50)-Dg(c?c:e-50))/2},C=function(a,b){var c=Bc(b),d=Nf.data.xs[a.id][b];return(Dg(d)+Dg(c?c:d-50))/2}):(D=P(),C=function(a){return Dg(a.x)-D/2}),A=Ec(Nf.data.targets),Cj.select("."+g.eventRects).datum(A?A.values:[]),z=Cj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),jf(z.enter()),z.attr("class",ld).attr("x",wh?0:C).attr("y",wh?C:0).attr("width",wh?gg:D).attr("height",wh?D:ig),z.exit().remove())),Gc(Nf.data.targets).forEach(function(a){Jj[a]=!0})}function rf(){qf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function sf(){if(0!==Lc(Nf.data.targets).length){if("mousemove"===Mf.event.sourceEvent.type&&zj.altDomain)return Dg.domain(zj.altDomain),void zj.scale(Dg).updateScaleExtent();Wi&&Dg.orgDomain()[0]===Hj[0]&&Dg.domain([Hj[0]-1e-10,Dg.orgDomain()[1]]),qf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Mf.event.sourceEvent.type&&($i=!0)}}function tf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function uf(){Aj.attr("width",kg).attr("height",lg),Aj.select("#"+Pi).select("rect").attr("width",gg).attr("height",ig),Aj.select("#"+Qi).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),Aj.select("#"+Ri).select("rect").attr("x",H).attr("y",I).attr("width",N).attr("height",O),Aj.select("."+g.zoomRect).attr("width",gg).attr("height",ig),Gj.style("max-height",lg+"px")}function vf(a){return{axisX:a?hj.x.transition().duration(a):hj.x,axisY:a?hj.y.transition().duration(a):hj.y,axisY2:a?hj.y2.transition().duration(a):hj.y2,axisSubX:a?hj.subx.transition().duration(a):hj.subx}}function wf(a){var b;a=a||{},a.withTransition=Je(a,"withTransition",!0),a.withTransform=Je(a,"withTransform",!1),a.withLegend=Je(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withLegend&&qh||(b=vf(a.withTransitionForAxis?cg:0),p(),V(),uf(),o(a.withTransition,b)),qf(a,b)}function xf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=Cj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",nd),j=i.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Zc),e=Cj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),d=e.enter().append("g").attr("class",pd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",fd).style("cursor",function(a){return eh(a)?"pointer":null}),c=Cj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),b=c.enter().append("g").attr("class",od).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",bd),b.append("g").attr("class",jd),b.append("g").attr("class",function(a){return Xc(g.selectedCircles,a.id)}),b.append("g").attr("class",dd).style("cursor",function(a){return eh(a)?"pointer":null}),a.forEach(function(a){Cj.selectAll("."+g.selectedCircles+rd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Cj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(ug(a)).attr("class",qd),f=h.enter().append("g").attr("class",qd),f.append("g").attr("class",hd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),nh&&(n=Dj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),m=n.enter().append("g").style("opacity",0).attr("class",pd),m.append("g").attr("class",fd),l=Dj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),k=l.enter().append("g").style("opacity",0).attr("class",od),k.append("g").attr("class",bd)),Aj.selectAll("."+g.target).filter(function(a){return Jc(a.id)}).transition().duration(cg).style("opacity",1)}function yf(a,b){b.filter&&(a=a.filter(b.filter)),(b.type||b.types)&&a.forEach(function(a){b.types?fe(a.id,b.types[a.id]):fe(a.id,b.type)}),Nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,z=0,F++)),E[a]=F,D[F]=f,A[a]=z,z+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+v)/10),j=10*Math.ceil((h.height+u)/10),k=nj?j:i,l=nj?U():T();return d&&(z=0,F=0,w=0,x=0),qh&&!Kc(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=i,C[c]=j,(!w||i>=w)&&(w=i),(!x||j>=x)&&(x=j),g=nj?x:w,void(vh?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(l-g*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=26,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=Ej.selectAll("."+g.legendItemFocused).size();b=b||{},n=Je(b,"withTransition",!0),q=Je(b,"withTransitionForTransform",!0),nj?(f=function(a){return w*E[a]},j=function(a){return D[E[a]]+A[a]}):(f=function(a){return D[E[a]]+A[a]},j=function(a){return x*E[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=Ej.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Xc(g.legendItem,a)}).style("visibility",function(a){return Kc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof sh?sh(a):Nf.toggle(a)}).on("mouseover",function(a){Mf.select(this).classed(g.legendItemFocused,!0),aj||Nf.focus(a),"function"==typeof th&&th(a)}).on("mouseout",function(a){Mf.select(this).classed(g.legendItemFocused,!1),aj||Nf.revert(),"function"==typeof uh&&uh(a)}),m.append("text").text(function(a){return d(Rg[a])?Rg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",nj?h:-200).attr("y",nj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",nj?i:-200).attr("y",nj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",cj).attr("x",nj?h:-200).attr("y",nj?-200:j).attr("width",10).attr("height",10),r=Ej.selectAll("text").data(a).text(function(a){return d(Rg[a])?Rg[a]:a}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=Ej.selectAll("rect."+g.legendItemEvent).data(a),(n?s.transition():s).attr("width",function(a){return B[a]}).attr("height",function(a){return C[a]}).attr("x",i).attr("y",l),t=Ej.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",cj).attr("x",f).attr("y",j),Ej.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Jc(a)}).transition().style("opacity",function(a){var b=Mf.select(this);return Jc(a)?!G||b.classed(g.legendItemFocused)?Bf(b):Cf(b):rj}),R(w),S(x),Q(F),p(),V(),uf(),o(q,c)}function If(a){return Ic(Nf.data.targets,a.id)}function Jf(a){return"data"in a&&Ic(Nf.data.targets,a.data.id)}function Kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function Lf(a,b,c){var d=!le(Nf.data.targets);aj=!1,fe(a,b),wf(c||{withTransitionForAxis:d})}var Mf=a.d3?a.d3:a.require?a.require("d3"):void 0,Nf={data:{},axis:{},legend:{}},Of={},Pf=i(["bindto"],"#chart"),Qf=i(["size","width"]),Rf=i(["size","height"]),Sf=i(["padding","left"]),Tf=i(["padding","right"]),Uf=i(["padding","top"]),Vf=i(["padding","bottom"]),Wf=i(["zoom","enabled"],!1),Xf=i(["zoom","extent"]),Yf=i(["zoom","privileged"],!1),Zf=i(["interaction","enabled"],!0),$f=i(["onenter"],function(){}),_f=i(["onleave"],function(){}),ag=i(["onresize"],function(){}),bg=i(["onresized"],function(){}),cg=i(["transition","duration"],350);h("data","data is required in config");var dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg,Kg,Lg,Mg,Ng=i(["data","x"]),Og=i(["data","xs"],{}),Pg=i(["data","x_format"]),Qg=i(["data","id_converter"],function(a){return a}),Rg=i(["data","names"],{}),Sg=i(["data","classes"],{}),Tg=i(["data","groups"],[]),Ug=i(["data","axes"],{}),Vg=i(["data","type"]),Wg=i(["data","types"],{}),Xg=i(["data","labels"],{}),Yg=i(["data","order"]),Zg=i(["data","regions"],{}),$g=i(["data","color"]),_g=i(["data","colors"],{}),ah=i(["data","hide"],!1),bh=i(["data","filter"]),ch=i(["data","selection","enabled"],!1),dh=i(["data","selection","grouped"],!1),eh=i(["data","selection","isselectable"],function(){return!0}),fh=i(["data","selection","multiple"],!0),gh=i(["data","onclick"],function(){}),hh=i(["data","onenter"],function(){}),ih=i(["data","onleave"],function(){}),jh=i(["data","onselected"],function(){}),kh=i(["data","onunselected"],function(){}),lh=i(["data","ondragstart"],function(){}),mh=i(["data","ondragend"],function(){}),nh=i(["subchart","show"],!1),oh=i(["subchart","size","height"],60),ph=i(["color","pattern"],[]),qh=i(["legend","show"],!0),rh=i(["legend","position"],"bottom"),sh=i(["legend","item","onclick"]),th=i(["legend","item","onmouseover"]),uh=i(["legend","item","onmouseout"]),vh=i(["legend","equally"],!1),wh=i(["axis","rotated"],!1),xh=i(["axis","x","show"],!0),yh=i(["axis","x","type"],"indexed"),zh=i(["axis","x","localtime"],!0),Ah=i(["axis","x","categories"],[]),Bh=i(["axis","x","tick","centered"],!1),Ch=i(["axis","x","tick","format"]),Dh=i(["axis","x","tick","culling"],{}),Eh=i(["axis","x","tick","culling","max"],10),Fh=i(["axis","x","tick","count"]),Gh=i(["axis","x","tick","fit"],!0),Hh=i(["axis","x","tick","values"],null),Ih=i(["axis","x","tick","rotate"]),Jh=i(["axis","x","max"],null),Kh=i(["axis","x","min"],null),Lh=i(["axis","x","padding"],{}),Mh=i(["axis","x","height"]),Nh=i(["axis","x","default"]),Oh=i(["axis","x","label"],{}),Ph=i(["axis","y","show"],!0),Qh=i(["axis","y","max"]),Rh=i(["axis","y","min"]),Sh=i(["axis","y","center"]),Th=i(["axis","y","label"],{}),Uh=i(["axis","y","inner"],!1),Vh=i(["axis","y","tick","format"]),Wh=i(["axis","y","padding"]),Xh=i(["axis","y","ticks"],10),Yh=i(["axis","y2","show"],!1),Zh=i(["axis","y2","max"]),$h=i(["axis","y2","min"]),_h=i(["axis","y2","center"]),ai=i(["axis","y2","label"],{}),bi=i(["axis","y2","inner"],!1),ci=i(["axis","y2","tick","format"]),di=i(["axis","y2","padding"]),ei=i(["axis","y2","ticks"],10),fi=i(["grid","x","show"],!1),gi=i(["grid","x","type"],"tick"),hi=i(["grid","x","lines"],[]),ii=i(["grid","y","show"],!1),ji=i(["grid","y","lines"],[]),ki=i(["grid","y","ticks"],10),li=i(["point","show"],!0),mi=i(["point","r"],2.5),ni=i(["point","focus","line","enabled"],!0),oi=i(["point","focus","expand","enabled"],!0),pi=i(["point","focus","expand","r"]),qi=i(["point","focus","select","r"]),ri=i(["line","connect_null"],!1),si=i(["bar","width"]),ti=i(["bar","width","ratio"],.6),ui=i(["pie","label","show"],!0),vi=i(["pie","label","format"]),wi=i(["pie","expand"],!0),xi=i(["pie","onclick"],function(){}),yi=i(["pie","onmouseover"],function(){}),zi=i(["pie","onmouseout"],function(){}),Ai=i(["donut","label","show"],!0),Bi=i(["donut","label","format"]),Ci=i(["donut","expand"],!0),Di=i(["donut","title"],""),Ei=i(["donut","onclick"],function(){}),Fi=i(["donut","onmouseover"],function(){}),Gi=i(["donut","onmouseout"],function(){}),Hi=i(["regions"],[]),Ii=i(["tooltip","show"],!0),Ji=i(["tooltip","format","title"]),Ki=i(["tooltip","format","value"]),Li=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Ji?Ji:b,l=Ki?Ki:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Mi=i(["tooltip","init","show"],!1),Ni=i(["tooltip","init","x"],0),Oi=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Pi=("string"==typeof Pf?Pf.replace("#",""):Pf.id)+"-clip",Qi=Pi+"-xaxis",Ri=Pi+"-yaxis",Si=j(Pi),Ti=j(Qi),Ui=j(Ri),Vi="timeseries"===yh,Wi="categorized"===yh,Xi=!Vi&&(Ng||Fe(Og)),Yi=null,Zi=!1,$i=!1,_i=!1,aj=!1,bj=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],cj=ze(_g,Fe(ph)?ph:bj,$g),dj=zh?Mf.time.format:Mf.time.format.utc,ej=dj.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),fj=[],gj=[],hj={},ij=wh?"left":"bottom",jj=wh?Uh?"top":"bottom":Uh?"right":"left",kj=wh?bi?"bottom":"top":bi?"left":"right",lj=wh?"left":"bottom",mj={main:function(){return"translate("+k(dg.left)+","+k(dg.top)+")"},context:function(){return"translate("+k(eg.left)+","+k(eg.top)+")"},legend:function(){return"translate("+fg.left+","+fg.top+")"},x:function(){return"translate(0,"+(wh?0:ig)+")" +},y:function(){return"translate(0,"+(wh?ig:0)+")"},y2:function(){return"translate("+(wh?0:gg)+","+(wh?1:0)+")"},subx:function(){return"translate(0,"+(wh?0:jg)+")"},arc:function(){return"translate("+pg/2+","+qg/2+")"}},nj="right"===rh,oj=0,pj=0,qj=0,rj=.15,sj=30,tj=wh&&!xh?0:30,uj=5;ug=Mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var vj,wj=function(){var a=Mf.svg.line().x(wh?function(a){return $(a.id)(a.value)}:Id).y(wh?Id:function(a){return $(a.id)(a.value)});return ri||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ri?Te(b.values):b.values;return me(b)?(a.interpolate(ne(b)?"cardinal":"linear"),Zg[b.id]?gf(e,Dg,$(b.id),Zg[b.id]):a(e)):(c=e[0]?Dg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,wh?"M "+d+" "+c:"M "+c+" "+d)}}(),xj=function(){var a;return a=wh?Mf.svg.area().x0(function(a){return $(a.id)(0)}).x1(function(a){return $(a.id)(a.value)}).y(Id):Mf.svg.area().x(Id).y0(function(a){return $(a.id)(0)}).y1(function(a){return $(a.id)(a.value)}),function(b){var c,d,e=Te(b.values);return ge([b],"area")||ge([b],"area-spline")?(a.interpolate(ne(b)?"cardinal":"linear"),a(e)):(c=e[0]?Dg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,wh?"M "+d+" "+c:"M "+c+" "+d)}}(),yj=function(){var a=Mf.svg.line().x(wh?function(a){return _(a.id)(a.value)}:Ld).y(wh?Ld:function(a){return _(a.id)(a.value)});return function(b){var c=Te(b.values);return me(b)?a(c):"M "+Gg(c[0].x)+" "+_(b.id)(c[0].value)}}(),zj=function(){};vj=Mf.svg.brush().on("brush",rf),vj.update=function(){return Dj&&Dj.select("."+g.brush).call(this),this},vj.scale=function(a){return wh?this.y(a):this.x(a)},Wf&&(zj=Mf.behavior.zoom().on("zoomstart",function(){zj.altDomain=Mf.event.sourceEvent.altKey?Dg.orgDomain():null}).on("zoom",Wf?sf:null),zj.scale=function(a){return wh?this.y(a):this.x(a)},zj.orgScaleExtent=function(){var a=Xf?Xf:[1,10];return[a[0],Math.max(Dc()/a[1],a[1])]},zj.updateScaleExtent=function(){var a=ec(Dg.orgDomain())/ec(Hj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Aj,Bj,Cj,Dj,Ej,Fj,Gj,Hj,Ij,Jj={};if(Nf.focus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);Nf.revert(),Nf.defocus(),b(d.classed(g.focused,!0)),b(e),le(Nf.data.targets)&&Rb(a,!0),Df(a,!0)},Nf.defocus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",.3)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);Nf.revert(),b(d.classed(g.focused,!1)),b(e),le(Nf.data.targets)&&Sb(a),Df(a,!1)},Nf.revert=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);b(d.classed(g.focused,!1)),b(e),le(Nf.data.targets)&&Sb(a),Ef()},Nf.show=function(a,b){a=Hc(a),b=b||{},Pc(a),Aj.selectAll(td(a)).transition().style("opacity",1),b.withLegend&&Ff(a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Nf.hide=function(a,b){a=Hc(a),b=b||{},Oc(a),Aj.selectAll(td(a)).transition().style("opacity",0),b.withLegend&&Gf(a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Nf.toggle=function(a){Jc(a)?Nf.hide(a):Nf.show(a)},Nf.unzoom=function(){vj.clear().update(),qf({withUpdateXDomain:!0})},Nf.load=function(a){return a.xs&&rc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Sg[b]=a.classes[b]}),"categories"in a&&Wi&&(Ah=a.categories,Jg.categories(Ah)),"cacheIds"in a&&fc(a.cacheIds)?void yf(hc(a.cacheIds),a.done):void("unload"in a?Af(Hc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){zf(a)}):zf(a))},Nf.unload=function(a,b){Af(Hc(a),function(){qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Nf.selected=function(a){return Mf.merge(Cj.selectAll("."+g.shapes+rd(a)).selectAll("."+g.shape).filter(function(){return Mf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Nf.select=function(a,b,c){ch&&Cj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Mf.select(this),i=e.data?e.data.id:e.id,j=Se(this),k=dh||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);"path"!==this.nodeName&&(k&&l?eh(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},Nf.unselect=function(a,b){ch&&Cj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Mf.select(this),f=c.data?c.data.id:c.id,h=Se(this),i=dh||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);"path"!==this.nodeName&&i&&j&&eh(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Nf.toLine=function(a){Lf(a,"line")},Nf.toSpline=function(a){Lf(a,"spline")},Nf.toBar=function(a){Lf(a,"bar")},Nf.toScatter=function(a){Lf(a,"scatter")},Nf.toArea=function(a){Lf(a,"area")},Nf.toAreaSpline=function(a){Lf(a,"area-spline")},Nf.toPie=function(a){Lf(a,"pie",{withTransform:!0})},Nf.toDonut=function(a){Lf(a,"donut",{withTransform:!0})},Nf.groups=function(a){return c(a)?Tg:(Tg=a,qf(),Tg)},Nf.xgrids=function(a){return a?(hi=a,qf(),hi):hi},Nf.xgrids.add=function(a){return a?Nf.xgrids(hi.concat(a)):void 0},Nf.xgrids.remove=function(a){var b=Kf(a);return Nf.xgrids(hi.filter(b))},Nf.ygrids=function(a){return a?(ji=a,qf(),ji):ji},Nf.ygrids.add=function(a){return a?Nf.ygrids(ji.concat(a)):void 0},Nf.ygrids.remove=function(a){var b=Kf(a);return Nf.ygrids(ji.filter(b))},Nf.regions=function(a){return a?(Hi=a,qf(),Hi):Hi},Nf.regions.add=function(a){return a?(Hi=Hi.concat(a),qf(),Hi):Hi},Nf.regions.remove=function(a){var b,c,d;return a=a||{},b=Je(a,"duration",cg),c=Je(a,"classes",[g.region]),d=Cj.select("."+g.regions).selectAll(c.map(function(a){return"."+a})),(b?d.transition().duration(b):d).style("opacity",0).remove(),Hi=Hi.filter(function(a){return c.indexOf(a.class)<0})},Nf.data.get=function(a){var b=Nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Nf.data.getAsTarget=function(a){var b=Nf.data.targets.filter(function(b){return b.id===a});return b.length>0?b[0]:void 0},Nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Rg[b]=a[b]}),qf({withLegend:!0}),Rg):Rg},Nf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){_g[b]=a[b]}),qf({withLegend:!0}),_g):_g},Nf.x=function(a){return arguments.length&&(uc(Nf.data.targets,a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Nf.data.xs},Nf.xs=function(a){return arguments.length&&(vc(Nf.data.targets,a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Nf.data.xs},Nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){gb(b,a[b])}),Ib())},Nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Jh=+a.x),b(a.y)&&(Qh=+a.y),b(a.y2)&&(Zh=+a.y2)):Qh=Zh=+a,qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Kh=+a.x),b(a.y)&&(Rh=+a.y),b(a.y2)&&($h=+a.y2)):Rh=$h=+a,qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Nf.axis.max(a.max),"undefined"!=typeof a.min&&Nf.axis.min(a.min))},Nf.legend.show=function(a){Ff(Hc(a)),qf({withLegend:!0})},Nf.legend.hide=function(a){Gf(Hc(a)),qf({withLegend:!0})},Nf.resize=function(a){Qf=a?a.width:null,Rf=a?a.height:null,wf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Nf.destroy=function(){Nf.data.targets=void 0,Nf.data.xs={},Gj.html(""),a.onresize=null},"url"in f.data)Mf.xhr(f.data.url,function(a,b){var c,d=Mf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Mf.csv.parse(b.response),hf(c)});else if("rows"in f.data)hf(xc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");hf(yc(f.data.columns))}return Nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(window); \ No newline at end of file From fdcb1ab83fcb982cb7a4cd3734ec5ac5c52ecb8c Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Fri, 9 May 2014 21:32:47 +0900 Subject: [PATCH 161/178] Fix bindto - #218 --- c3.js | 13 +++++++------ c3.min.js | 6 +++--- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/c3.js b/c3.js index 188fa78..ec7e3d8 100644 --- a/c3.js +++ b/c3.js @@ -289,7 +289,8 @@ /*-- Set Variables --*/ - var clipId = (typeof __bindto === "string" ? __bindto.replace('#', '') : __bindto.id) + '-clip', + // MEMO: clipId needs to be unique because it conflicts when multiple charts exist + var clipId = (typeof __bindto === "string" ? __bindto.replace(/[# .>~+]/g, '') : CLASS.chart + (+new Date())) + '-clip', clipIdForXAxis = clipId + '-xaxis', clipIdForYAxis = clipId + '-yaxis', clipPath = getClipPath(clipId), @@ -489,7 +490,7 @@ var leftAxisClass = __axis_rotated ? CLASS.axisX : CLASS.axisY, leftAxis = main.select('.' + leftAxisClass).node(), svgRect = leftAxis ? leftAxis.getBoundingClientRect() : {right: 0}, - chartRect = d3.select(__bindto).node().getBoundingClientRect(), + chartRect = selectChart.node().getBoundingClientRect(), hasArc = hasArcType(c3.data.targets), svgLeft = svgRect.right - chartRect.left - (hasArc ? 0 : getCurrentPaddingLeft()); return svgLeft > 0 ? svgLeft : 0; @@ -538,10 +539,10 @@ return (getAxisLabelPositionById(axisId).isInner ? 30 : 40) + (axisId === 'y2' ? -10 : 0); } function getParentWidth() { - return +d3.select(__bindto).style("width").replace('px', ''); // TODO: if rotated, use height + return +selectChart.style("width").replace('px', ''); // TODO: if rotated, use height } function getParentHeight() { - return +d3.select(__bindto).style('height').replace('px', ''); // TODO: if rotated, use width + return +selectChart.style('height').replace('px', ''); // TODO: if rotated, use width } function getAxisClipX(forHorizontal) { // axis line width + padding for left @@ -2448,7 +2449,7 @@ selectChart = d3.select(__bindto); if (selectChart.empty()) { - throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".'); + throw new Error('Element to bind not found'); } selectChart.html("").classed("c3", true); @@ -2513,7 +2514,7 @@ } // Define tooltip - tooltip = d3.select(__bindto) + tooltip = selectChart .style("position", "relative") .append("div") .style("position", "absolute") diff --git a/c3.min.js b/c3.min.js index f666f9f..602e805 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.round(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.round(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&agg&&(gg=0),0>ig&&(ig=0),hg=wh?dg.left-sj-tj:gg,jg=wh?ig:lg-eg.top-eg.bottom,0>hg&&(hg=0),0>jg&&(jg=0),pg=gg-(nj?b+10:0),qg=ig-(nj?0:10),r(),nj&&d&&(fg.left=pg/2+1.1*ng)}function q(){Cj.select("line."+g.xgridFocus).attr("x1",wh?0:-10).attr("x2",wh?gg:-10).attr("y1",wh?-10:dg.top).attr("y2",wh?-10:ig)}function r(){ng=Math.min(pg,qg)/2,mg=.95*ng,og=ke(Nf.data.targets)?.6*mg:0}function s(){var a=wh?g.axisX:g.axisY,b=Cj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Mf.select(Pf).node().getBoundingClientRect(),e=le(Nf.data.targets),f=c.right-d.left-(e?0:x());return f>0?f:0}function t(){return Qf?Qf:B()}function u(){var a=Rf?Rf:C();return a>0?a:320}function v(){return Uf?Uf:0}function w(){return Vf?Vf:0}function x(){return Sf?Sf:wh?xh?Ke(z("x")):1:!Ph||Uh?1:Ke(z("y"))}function y(){var a=10,b=nj?T()+20:0;return Tf?Tf:wh?a+b:(!Yh||bi?a:Ke(z("y2")))+b}function z(a){var b=ob(a);return b.isInner?20+Hb(a):40+Hb(a)}function A(a){return"x"!==a||xh?"x"===a&&Mh?Mh:"y"!==a||Ph?"y2"!==a||Yh?(ob(a).isInner?30:40)+("y2"===a?-10:0):uj:qh&&!nj?10:1:0}function B(){return+Mf.select(Pf).style("width").replace("px","")}function C(){return+Mf.select(Pf).style("height").replace("px","")}function D(a){return a?-31:-(dg.left-1)}function E(a){return a?-20:-4}function F(){return D(!wh)}function G(){return E(!wh)}function H(){return D(wh)}function I(){return E(wh)}function J(a){return a?gg+2+30+30:dg.left+20}function K(a){return a?(Mh?Mh:0)+80:ig+8}function L(){return J(!wh)}function M(){return K(!wh)}function N(){return J(wh)}function O(){return K(wh)}function P(){var a,b,c,d,e,f=Ec(Nf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=Dg(b.x)-Dg(a.x),0===c?wh?ig:gg:(d=Dc(),e=he(Nf.data.targets)?(d-(Wi?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function Q(a){oj=a}function R(a){pj=a}function S(a){qj=a}function T(){return qh?nj?pj*(oj+1):kg:0}function U(){return qh?nj?lg:qj*(oj+1):0}function V(){var a,b,c=!Dg;vg=wh?1:0,wg=wh?ig:gg,xg=wh?0:ig,yg=wh?gg:1,zg=vg,Ag=wg,Bg=wh?0:jg,Cg=wh?hg:1,Dg=Y(vg,wg,c?void 0:Dg.domain(),function(){return Jg.tickOffset()}),Eg=Z(xg,yg,c?void 0:Eg.domain()),Fg=Z(xg,yg,c?void 0:Fg.domain()),Gg=Y(vg,wg,Hj,function(a){return a%1?0:Mg.tickOffset()}),Hg=Z(Bg,Cg,c?void 0:Hg.domain()),Ig=Z(Bg,Cg,c?void 0:Ig.domain()),a=db(),b=Hh?Hh:c?void 0:Jg.tickValues(),Jg=ab(Dg,ij,a,b),Mg=ab(Gg,lj,a,b),Kg=bb(Eg,jj,Vh,Xh),Lg=bb(Fg,kj,ci,ei),c||(vj.scale(Gg),Wf&&zj.scale(Dg)),W()}function W(){rg=Kb(),sg=Lb(),tg=Lb(.98)}function X(a,b,c){return(c?Mf.time.scale():Mf.scale.linear()).range([a,b])}function Y(a,b,c,d){var e,f=X(a,b,Vi),g=c?f.domain(c):f;Wi?(d=d||function(){return 0},f=function(a,b){var c=g(a)+d(a);return b?c:Math.ceil(c)}):f=function(a,b){var c=g(a);return b?c:Math.ceil(c)};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return Hj&&Hj[0]===a[0]&&Hj[1]a?a.toFixed(0):a};return Ch&&("function"==typeof Ch?a=Ch:Vi&&(a=function(a){return a?dj(Ch)(a):""})),a}function eb(a){var b;return"y"===a?b=Th:"y2"===a?b=ai:"x"===a&&(b=Oh),b}function fb(a){var b=eb(a);return"string"==typeof b?b:b?b.text:null}function gb(a,b){var c=eb(a);"string"==typeof c?"y"===a?Th=b:"y2"===a?ai=b:"x"===a&&(Oh=b):c&&(c.text=b)}function hb(a){return 10*Math.sin(Math.PI*(a/180))}function ib(a){return 11.5-2.5*(a/15)}function jb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",ib(c)).attr("x",hb(c)).attr("transform","rotate("+c+")")}function kb(a,b){var c=eb(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 lb(){return kb("x",wh?"inner-top":"inner-right")}function mb(){return kb("y",wh?"inner-right":"inner-top")}function nb(){return kb("y2",wh?"inner-right":"inner-top")}function ob(a){return"y2"===a?nb():"y"===a?mb():lb()}function pb(){return fb("x")}function qb(){return fb("y")}function rb(){return fb("y2")}function sb(a,b){return a?b.isLeft?0:b.isCenter?gg/2:gg:b.isBottom?-ig:b.isMiddle?-ig/2:0}function tb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function ub(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function vb(){return sb(!wh,lb())}function wb(){return sb(wh,mb())}function xb(){return sb(wh,nb())}function yb(){return tb(!wh,lb())}function zb(){return tb(wh,mb())}function Ab(){return tb(wh,nb())}function Bb(){var a=lb();return wh?a.isInner?"1.2em":-25-Hb("x"):a.isInner?"-0.5em":Mh?Mh-10:"3em"}function Cb(){var a=mb();return wh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Hb("y")}function Db(){var a=nb();return wh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Hb("y2")}function Eb(){return ub(!wh,lb())}function Fb(){return ub(wh,mb())}function Gb(){return ub(wh,nb())}function Hb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Ib(a){var b=Cj.select("."+g.axisX+" ."+g.axisXLabel),c=Cj.select("."+g.axisY+" ."+g.axisYLabel),d=Cj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",vb).attr("dx",yb).attr("dy",Bb).text(pb),(a?c.transition():c).attr("x",wb).attr("dx",zb).attr("dy",Cb).attr("dy",Cb).text(qb),(a?d.transition():d).attr("x",xb).attr("dx",Ab).attr("dy",Db).text(rb)}function Jb(a){var b=!1;return ug(Lc(Nf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Kb(){var a=Mf.svg.arc().outerRadius(mg).innerRadius(og),b=function(b,c){var d;return c?a(b):(d=Jb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Lb(a){var b=Mf.svg.arc().outerRadius(ng*(a?a:1)).innerRadius(og);return function(a){var c=Jb(a);return c?b(c):"M 0 0"}}function Mb(a,b){return se(a.data)?rg(a,b):"M 0 0"}function Nb(a){var b,c,d,e,f=Jb(a),g="";return f&&(b=rg.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*mg*.8+","+d/e*mg*.8+")"),g}function Ob(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Pb(a){return tc({id:a.data.id,value:a.value,ratio:Ob(a)})}function Qb(a){var b,c,d,e;return Tb()?(b=Jb(a),c=b?b.value:null,d=Ob(b),e=Ub(),e?e(c,d):Gd(c,d)):""}function Rb(a,b){var c=Aj.selectAll("."+g.chartArc+sd(a)),d=Aj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});ye(a)&&c.selectAll("path").transition().duration(50).attr("d",sg).transition().duration(100).attr("d",tg).each(function(a){re(a.data)}),b||d.style("opacity",.3)}function Sb(a){var b=Aj.selectAll("."+g.chartArc+sd(a));b.selectAll("path").transition().duration(50).attr("d",rg),Aj.selectAll("."+g.arc).style("opacity",1)}function Tb(){return ke(Nf.data.targets)?Ai:ui}function Ub(){return ke(Nf.data.targets)?Bi:vi}function Vb(){return ke(Nf.data.targets)?Di:""}function Wb(){var a=ke(Nf.data.targets)?Ei:xi;return"function"==typeof a?a:function(){}}function Xb(){var a=ke(Nf.data.targets)?Fi:yi;return"function"==typeof a?a:function(){}}function Yb(){var a=ke(Nf.data.targets)?Gi:zi;return"function"==typeof a?a:function(){}}function Zb(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Tg.length>0)for(g=Uc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return Mf.min(Object.keys(i).map(function(a){return Mf.min(i[a])}))}function $b(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Tg.length>0)for(g=Vc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return Mf.max(Object.keys(i).map(function(a){return Mf.max(i[a])}))}function _b(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return cb(a.id)===c}),m="y2"===c?$h:Rh,n="y2"===c?Zh:Qh,o=b(m)?m:Zb(l),p=b(n)?n:$b(l),q="y2"===c?_h:Sh,r=Ad()&&wh;return 0===l.length?"y2"===c?Fg.domain():Eg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=Bd(o,p),j=ec(Eg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Wh&&(f=b(Wh.top)?Wh.top:e,g=b(Wh.bottom)?Wh.bottom:e),"y2"===c&&di&&(f=b(di.top)?di.top:e,g=b(di.bottom)?di.bottom:e),he(l)&&!Uc(l)&&(g=o),[o-g,p+f])}function ac(a){return Kh?Vi?Ae(Kh):Kh:Mf.min(a,function(a){return Mf.min(a.values,function(a){return a.x})})}function bc(a){return Jh?Vi?Ae(Jh):Jh:Mf.max(a,function(a){return Mf.max(a.values,function(a){return a.x})})}function cc(a){var c,d,e,f,g=Fc(a),h=g[1]-g[0];return Wi?d=0:he(a)?(c=Dc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Lh&&Fe(Lh)?(e=b(Lh.left)?Lh.left:d,f=b(Lh.right)?Lh.right:d):e=f="number"==typeof Lh?Lh:d,{left:e,right:f}}function dc(a){var b=[ac(a),bc(a)],c=b[0],d=b[1],e=cc(a),f=0,g=0;return c-d!==0||Wi||(c=Vi?new Date(.5*c.getTime()):-.5,d=Vi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ec(a){return a[1]-a[0]}function fc(a){for(var b=0;bb?0:b-c}function lc(a){var b,c=jc(a),d="y"===a.axis?Eg:Fg;return b="y"===a.axis||"y2"===a.axis?wh?ig:"start"in a?d(a.start):ig:wh?"end"in a?Dg(Vi?Ae(a.end):a.end):ig:ig,c>b?0:b-c}function mc(a){return Ng&&a===Ng||Fe(Og)&&Ge(Og,a)}function nc(a){return!mc(a)}function oc(a){return Ng?Ng:Fe(Og)?Og[a]:null}function pc(a,b){var c,d=b&&Fe(b)?Gc(b):[];return d.forEach(function(b){oc(b)===a&&(c=Nf.data.xs[b])}),c}function qc(a,b){return a in Nf.data.xs&&Nf.data.xs[a]&&Nf.data.xs[a][b]?Nf.data.xs[a][b]:b}function rc(a){Object.keys(a).forEach(function(b){Og[b]=a[b]})}function sc(a){return 1===Mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function tc(a){var b;return a&&(b=Rg[a.id],a.name=b?b:a.id),a}function uc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=wc(b[d],a.id,d)}),Nf.data.xs[a.id]=b})}function vc(a,b){a.forEach(function(a){b[a.id]&&uc([a],b[a.id])})}function wc(a,c,d){var e;return e=Vi?a?a instanceof Date?a:Ae(a):Ae(qc(c,d)):Xi&&!Wi?b(a)?+a:qc(c,d):d}function xc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Ng?(d=Object.keys(Nf.data.xs),Nf.data.xs[c]=d.length>0?Nf.data.xs[d[0]]:void 0):Fe(Og)&&(Nf.data.xs[c]=pc(f,Nf.data.targets)):Nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Qg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=oc(b),g=a[f],h=wc(g,b,e);return Xi&&Wi&&0===c&&g&&(0===e&&(Ah=[]),Ah.push(g)),("undefined"==typeof a[b]||Nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Vg&&fe(Gc(c).filter(function(a){return!(a in Wg)}),Vg),c.forEach(function(a){gc(a.id_org,a)}),c}function Ac(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 Bc(a){return a>0&&Nf.data.targets[0].values[a-1]?Nf.data.targets[0].values[a-1].x:void 0}function Cc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Fc(a){var b,c,d=Ec(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Gc(a){return a.map(function(a){return a.id})}function Hc(a){return a?"string"==typeof a?[a]:a:Gc(Nf.data.targets)}function Ic(a,b){var c,d=Gc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Vi?new Date(i):i);j.push(e)}return Vi||(j=j.sort(function(a,b){return a-b})),j}function Oc(a){fj=fj.concat(a)}function Pc(a){fj=fj.filter(function(b){return a.indexOf(b)<0})}function Qc(a){gj=gj.concat(a)}function Rc(a){gj=gj.filter(function(b){return a.indexOf(b)<0})}function Sc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Tc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Vc(a){return Tc(a,function(a){return a>0})}function Wc(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||0===a[f].x)&&(e=e.concat(Md(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Md(a,g))),Pd(e,b)):Nd(a,b,f,g)}function Od(a,b){var c;return c=a.map(function(a){return Nd(a.values,b)}),Pd(c,b)}function Pd(a,b){var c,d;return a.forEach(function(a){var e=He(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Qd(a,b){return Mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Rd(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 Sd(){return Yg&&"desc"===Yg.toLowerCase()}function Td(){return Yg&&"asc"===Yg.toLowerCase()}function Ud(a){var b=Td(),c=Sd();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 Yg&&a.sort(Yg),a}function Vd(a,c){var d,e,f,g,h,i,j,k=le(Nf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&Ii&&(Fj.html(Li(a,db(),Cd(k),cj)).style("display","block"),d=Fj.property("offsetWidth"),e=Fj.property("offsetHeight"),k?(g=gg/2+c[0],i=ig/2+c[1]+20):(wh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-y(),i=Dg(l[0].x)+20):(f=s(),g=f+x()+Dg(l[0].x)+20,h=g+d,j=f+t()-y(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),Fj.style("top",i+"px").style("left",g+"px"))}function Wd(){Fj.style("display","none")}function Xd(a){var c=a.filter(function(a){return a&&b(a.value)});if(Ii&&!ie(Nf.data.targets)&&!le(Nf.data.targets)){var d=Cj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(wh?"y1":"x1",Id).attr(wh?"y2":"x2",Id),pf(d,"grid")}}function Yd(){Cj.select("line."+g.xgridFocus).style("visibility","hidden")}function Zd(a,b){var c,d,e,f,h=[],i=Cj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=dc(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function $d(a){return a.x||0===a.x?Dg(a.x):null}function _d(a){return $(a.id)(a.value)}function ae(){var a,b,d={},e=0;return Lc(Nf.data.targets.filter(oe)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ee(a,b){return"number"==typeof si?si:b?2*a.tickOffset()*ti/b:0}function fe(a,b){Hc(a).forEach(function(a){Jj[a]=b===Wg[a],Wg[a]=b})}function ge(a,b){var c=!1;return a.forEach(function(a){Wg[a.id]===b&&(c=!0),a.id in Wg||"line"!==b||(c=!0)}),c}function he(a){return ge(a,"bar")}function ie(a){return ge(a,"scatter")}function je(a){return ge(a,"pie")}function ke(a){return ge(a,"donut")}function le(a){return je(a)||ke(a)}function me(a){var b="string"==typeof a?a:a.id;return!(b in Wg)||"line"===Wg[b]||"spline"===Wg[b]||"area"===Wg[b]||"area-spline"===Wg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"spline"===Wg[b]||"area-spline"===Wg[b]}function oe(a){var b="string"==typeof a?a:a.id;return"bar"===Wg[b]}function pe(a){var b="string"==typeof a?a:a.id;return"scatter"===Wg[b]}function qe(a){var b="string"==typeof a?a:a.id;return"pie"===Wg[b]}function re(a){var b="string"==typeof a?a:a.id;return"donut"===Wg[b]}function se(a){return qe(a)||re(a)}function te(a){return me(a)?[a]:[]}function ue(a){return se(a.data)?[a]:[]}function ve(a){return oe(a)?a.values:[]}function we(a){return me(a)||pe(a)?a.values:[]}function xe(a){return oe(a)||me(a)?a.values:[]}function ye(a){return re(a)&&Ci||qe(a)&&wi}function ze(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function Ae(b){var c;try{c=Pg?Mf.time.format(Pg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Pg)}return c}function Be(a,b){var c=Mf.mouse(a),d=Mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ge(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function He(a,b){var c="y"===cb(a.id)?Eg:Fg,d=wh?1:0,e=wh?0:1;return Math.pow(Dg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ie(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Je(a,b,c){return d(a[b])?a[b]:c}function Ke(a){return 10*Math.ceil(a/10)}function Le(a,b,c){jh(b,a.node()),Cj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Xc(g.selectedCircle,c)}).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d).attr("stroke",function(){return cj(b)}).attr("r",1.4*We(b)).transition().duration(100).attr("r",We)}function Me(a,b,c){kh(b,a.node()),Cj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ne(a,b,c,d){a?Le(b,c,d):Me(b,c,d)}function Oe(a,b){jh(b,a.node()),a.transition().duration(100).style("fill",function(){return Mf.rgb(cj(b)).brighter(.75)})}function Pe(a,b){kh(b,a.node()),a.transition().duration(100).style("fill",function(){return cj(b)})}function Qe(a,b,c,d){a?Oe(b,c,d):Pe(b,c,d)}function Re(a,b,c,d){Qe(a,b,c.data,d)}function Se(a){return"circle"===a.nodeName?Ne:Mf.select(a).classed(g.bar)?Qe:Re}function Te(a){return a.filter(function(a){return b(a.value)})}function Ue(a){return li?"function"==typeof mi?mi(a):mi:0}function Ve(a){return oi?pi?pi:1.75*Ue(a):Ue(a)}function We(a){return qi?qi:4*Ue(a)}function Xe(a,c){return(c?Cj.selectAll("."+g.circles+rd(c)):Cj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ye(a,b){Xe(a,b).classed(g.EXPANDED,!0).attr("r",Ve)}function Ze(a){Xe(a).filter(function(){return Mf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Ue)}function $e(a){return Cj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function _e(a){$e(a).classed(g.EXPANDED,!0)}function af(a){$e(a).classed(g.EXPANDED,!1)}function bf(a,b){var c=ff(a,b);return function(a,b){var d=c(a,b),e=wh?1:0,f=wh?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 cf(a,b){var c=ff(a,!1),d=b?df:ef;return function(a,b){return d(c(a,b),a,this)}}function df(a,b){var c;return wh?(c=oe(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function ef(a,b,c){var d=c.getBoundingClientRect();return wh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:oe(b)?-3:-6)}function ff(a,b){var c=a.__max__+1,d=ee(Jg,c),e=be(d,c,a,!!b),f=ce(!!b),g=de(a,!!b),h=b?_:$;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return wh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function gf(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function hf(b){var c,d,e;if(Gj=Mf.select(Pf),Gj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Gj.html("").classed("c3",!0),Nf.data.xs={},Nf.data.targets=zc(b),bh&&(Nf.data.targets=Nf.data.targets.filter(bh)),ah&&Oc(ah===!0?Gc(Nf.data.targets):ah),p(),V(),Dg.domain(Mf.extent(dc(Nf.data.targets))),Eg.domain(_b(Nf.data.targets,"y")),Fg.domain(_b(Nf.data.targets,"y2")),Gg.domain(Dg.domain()),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Hj=Dg.domain(),vj.scale(Gg),Wf&&zj.scale(Dg),Aj=Gj.append("svg").on("mouseenter",$f).on("mouseleave",_f),Bj=Aj.append("defs"),Bj.append("clipPath").attr("id",Pi).append("rect"),Bj.append("clipPath").attr("id",Qi).append("rect"),Bj.append("clipPath").attr("id",Ri).append("rect"),uf(),Cj=Aj.append("g").attr("transform",mj.main),Dj=Aj.append("g").attr("transform",mj.context),Ej=Aj.append("g").attr("transform",mj.legend),nh||Dj.style("visibility","hidden"),qh||(Ej.style("visibility","hidden"),gj=Gc(Nf.data.targets)),Fj=Mf.select(Pf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Hf(Gc(Nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=Cj.append("g").attr("clip-path",Si).attr("class",g.grid),fi&&d.append("g").attr("class",g.xgrids),Fe(hi)&&d.append("g").attr("class",g.xgridLines),ni&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),ii&&d.append("g").attr("class",g.ygrids),Fe(ji)&&d.append("g").attr("class",g.ygridLines),Cj.append("g").attr("clip-path",Si).attr("class",g.regions),Cj.append("g").attr("clip-path",Si).attr("class",g.chart),c=Cj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Wf?wh?"ns-resize":"ew-resize":null),Cj.select("."+g.chart).append("g").attr("class",g.chartBars),Cj.select("."+g.chart).append("g").attr("class",g.chartLines),Cj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",mj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Vb()),Cj.select("."+g.chart).append("g").attr("class",g.chartTexts),Wf&&Cj.insert("rect",Yf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",gg).attr("height",ig).style("opacity",0).style("cursor",wh?"ns-resize":"ew-resize").call(zj).on("dblclick.zoom",null),Nh&&vj.extent("function"!=typeof Nh?Nh:Nh(dc())),hj.x=Cj.append("g").attr("class",g.axisX).attr("clip-path",Ti).attr("transform",mj.x).style("visibility",xh?"visible":"hidden"),hj.x.append("text").attr("class",g.axisXLabel).attr("transform",wh?"rotate(-90)":"").style("text-anchor",Eb),hj.y=Cj.append("g").attr("class",g.axisY).attr("clip-path",Ui).attr("transform",mj.y).style("visibility",Ph?"visible":"hidden"),hj.y.append("text").attr("class",g.axisYLabel).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Fb),hj.y2=Cj.append("g").attr("class",g.axisY2).attr("transform",mj.y2).style("visibility",Yh?"visible":"hidden"),hj.y2.append("text").attr("class",g.axisY2Label).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Gb),Dj.append("g").attr("clip-path",Si).attr("class",g.chart),Dj.select("."+g.chart).append("g").attr("class",g.chartBars),Dj.select("."+g.chart).append("g").attr("class",g.chartLines),Dj.append("g").attr("clip-path",Si).attr("class",g.brush).call(vj).selectAll("rect").attr(wh?"width":"height",wh?hg:jg),hj.subx=Dj.append("g").attr("class",g.axisX).attr("transform",mj.subx).attr("clip-path",wh?"":Ti),xf(Nf.data.targets),qf({withUpdateTranslate:!0,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Mi){if(Vi&&"string"==typeof Ni){for(Ni=Ae(Ni),e=0;e0){d=[];for(var f in Rg)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Rd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Qe,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function nf(a){le(Nf.data.targets)||ch&&(Yi=a,Cj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Zi=!0,lh())}function of(){le(Nf.data.targets)||ch&&(Cj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),Cj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Zi=!1,mh())}function pf(a,b){"grid"===b&&a.each(function(){var a=Mf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function qf(a,c){var d,e,f,h,i,j,k,l,m,n,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,Q,R,S,T,U,W,X,Y,Z,$=ae(),_=le(Nf.data.targets),ab=Lc(Nf.data.targets);if(a=a||{},E=Je(a,"withY",!0),F=Je(a,"withSubchart",!0),G=Je(a,"withTransition",!0),J=Je(a,"withTransform",!1),K=Je(a,"withUpdateXDomain",!1),L=Je(a,"withUpdateOrgXDomain",!1),N=Je(a,"withUpdateTranslate",!1),M=Je(a,"withLegend",!1),H=Je(a,"withTransitionForExit",G),I=Je(a,"withTransitionForAxis",G),T=G?cg:0,U=H?T:0,W=I?T:0,c=c||vf(W),M&&qh&&Hf(Gc(Nf.data.targets),a,c),Wi&&0===ab.length&&Dg.domain([0,hj.x.selectAll(".tick").size()]),ab.length&&(L&&(Dg.domain(Mf.extent(dc(ab))),Hj=Dg.domain(),Wf&&zj.scale(Dg).updateScaleExtent(),Gg.domain(Dg.domain()),vj.scale(Gg)),K&&(Dg.domain(vj.empty()?Hj:vj.extent()),Wf&&zj.scale(Dg).updateScaleExtent()),Hh||!Gh&&!Fh||(X=Nc(Mc(ab),Fh),Jg.tickValues(X),Mg.tickValues(X))),Eg.domain(_b(ab,"y")),Fg.domain(_b(ab,"y2")),hj.x.style("opacity",_?0:1),hj.y.style("opacity",_?0:1),hj.y2.style("opacity",_?0:1),hj.subx.style("opacity",_?0:1),c.axisX.call(Jg),c.axisY.call(Kg),c.axisY2.call(Lg),c.axisSubX.call(Mg),Ib(G),N&&(p(),V(),uf(),o(!1),hj.x.call(Jg),hj.y.call(Kg),hj.y2.call(Lg),hj.subx.call(Mg)),K&&ab.length)if(Dh&&X){for(Y=1;Y=0&&Mf.select(this).style("display",b%Z?"none":"block")})}else Aj.selectAll("."+g.axisX+" .tick text").style("display","block");!wh&&Ih&&jb(hj.x,c.axisX,Ih),O=bf($),R=cf($,!0),S=cf($,!1),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Fj.style("display","none"),q(),Cj.select("line."+g.xgridFocus).style("visibility","hidden"),fi&&(f=Zd(gi,Dg),B=Wi?Jg.tickOffset():0,e=wh?{x1:0,x2:gg,y1:function(a){return Dg(a)-B},y2:function(a){return Dg(a)-B}}:{x1:function(a){return Dg(a)+B},x2:function(a){return Dg(a)+B},y1:dg.top,y2:ig},d=Cj.select("."+g.xgrids).selectAll("."+g.xgrid).data(f),d.enter().append("line").attr("class",g.xgrid),d.attr(e).style("opacity",function(){return+Mf.select(this).attr(wh?"y1":"x1")===(wh?ig:0)?0:1}),d.exit().remove()),Fe(hi)&&(h=Cj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(hi),i=h.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),i.append("line").style("opacity",0),i.append("text").attr("text-anchor","end").attr("transform",wh?"":"rotate(-90)").attr("dx",wh?0:-dg.top).attr("dy",-5).style("opacity",0),h.select("line").transition().duration(T).attr("x1",wh?0:Jd).attr("x2",wh?gg:Jd).attr("y1",wh?Jd:dg.top).attr("y2",wh?Jd:ig).style("opacity",1),h.select("text").transition().duration(T).attr("x",wh?gg:0).attr("y",Jd).text(function(a){return a.text}).style("opacity",1),h.exit().transition().duration(T).style("opacity",0).remove()),E&&ii&&(j=Cj.select("."+g.ygrids).selectAll("."+g.ygrid).data(Eg.ticks(ki)),j.enter().append("line").attr("class",g.ygrid),j.attr("x1",wh?Eg:0).attr("x2",wh?Eg:gg).attr("y1",wh?0:Eg).attr("y2",wh?ig:Eg),j.exit().remove(),pf(j,"grid")),E&&Fe(ji)&&(k=Cj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(ji),l=k.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",wh?"rotate(-90)":"").attr("dx",wh?0:-dg.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",wh?Kd:0).attr("x2",wh?Kd:gg).attr("y1",wh?0:Kd).attr("y2",wh?ig:Kd).style("opacity",1),k.select("text").transition().duration(T).attr("x",wh?0:gg).attr("y",Kd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),u=Cj.select("."+g.regions).selectAll("."+g.region).data(Hi),u.enter().append("g").attr("class",kd).append("rect").style("fill-opacity",0),u.selectAll("rect").transition().duration(T).attr("x",ic).attr("y",jc).attr("width",kc).attr("height",lc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),u.exit().transition().duration(T).style("opacity",0).remove(),s=Cj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),s.enter().append("path").attr("class",ed).style("stroke","none").style("fill",cj),s.style("opacity",wd).transition().duration(T).attr("d",O).style("fill",cj).style("opacity",1),s.exit().transition().duration(U).style("opacity",0).remove(),m=Cj.selectAll("."+g.lines).selectAll("."+g.line).data(te),m.enter().append("path").attr("class",ad).style("stroke",cj),m.style("opacity",wd).transition().duration(T).attr("d",wj).style("stroke",cj).style("opacity",1),m.exit().transition().duration(U).style("opacity",0).remove(),n=Cj.selectAll("."+g.areas).selectAll("."+g.area).data(te),n.enter().append("path").attr("class",id).style("fill",cj).style("opacity",function(){return Ij=+Mf.select(this).style("opacity"),0}),n.style("opacity",0).transition().duration(T).attr("d",xj).style("fill",cj).style("opacity",Ij),n.exit().transition().duration(U).style("opacity",0).remove(),r=Cj.selectAll("."+g.circles).selectAll("."+g.circle).data(we),r.enter().append("circle").attr("class",cd).attr("r",Ue).style("fill",cj),r.style("opacity",wd).transition().duration(T).style("opacity",yd).style("fill",cj).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d),r.exit().remove(),v=Cj.selectAll("."+g.texts).selectAll("."+g.text).data(xe),v.enter().append("text").attr("class",Yc).attr("text-anchor",function(a){return wh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",cj).style("fill-opacity",0),v.text(function(a){return Hd(a.id)(a.value,a.id)}).style("fill-opacity",xd).transition().duration(T).attr("x",R).attr("y",S).style("fill",cj).style("fill-opacity",zd),v.exit().transition().duration(U).style("fill-opacity",0).remove(),t=Cj.selectAll("."+g.arcs).selectAll("."+g.arc).data(ue),t.enter().append("path").attr("class",gd).style("fill",function(a){return cj(a.data)}).style("cursor",function(a){return eh(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;aj||(c=Jb(a),d=Pb(c),e=Xb(),Rb(c.data.id),Df(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Jb(a),c=Pb(b),d=[c];Vd(d,Mf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;aj||(c=Jb(a),d=Pb(c),e=Yb(),Sb(c.data.id),Ef(),Wd(),e(d,b))}).on("click",function(a,b){var c=Jb(a),d=Pb(c),e=Wb();lf(this,a,b),e(d,b)}),t.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){aj=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Jb(a);return c?(b=Mf.interpolate(this._current,c),this._current=b(0),function(a){return Mb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("fill",function(a){return cj(a.data)}).style("opacity",1).call(Ie,function(){aj=!1}),t.exit().transition().duration(U).style("opacity",0).remove(),Cj.selectAll("."+g.chartArc).select("text").attr("transform",Nb).style("opacity",0).transition().duration(T).text(Qb).style("opacity",function(a){return Jc(a.data.id)&&se(a.data)?1:0}),Cj.select("."+g.chartArcsTitle).style("opacity",ke(Nf.data.targets)?1:0),nh&&(Mf.event&&"zoom"===Mf.event.type&&vj.extent(Dg.orgDomain()).update(),F&&(!wh&&Ih&&jb(hj.subx,c.axisSubX,Ih),vj.empty()||vj.extent(Dg.orgDomain()).update(),Q=bf($,!0),x=Dj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),x.enter().append("path").attr("class",ed).style("stroke","none").style("fill",cj),x.style("opacity",wd).transition().duration(T).attr("d",Q).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove(),w=Dj.selectAll("."+g.lines).selectAll("."+g.line).data(te),w.enter().append("path").attr("class",ad).style("stroke",cj),w.style("opacity",wd).transition().duration(T).attr("d",yj).style("opacity",1),w.exit().transition().duration(T).style("opacity",0).remove())),Cj.selectAll("."+g.selectedCircles).filter(function(a){return oe(a)}).selectAll("circle").remove(),Cj.selectAll("."+g.selectedCircle).transition().duration(T).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d),Zf&&(y=Cj.select("."+g.eventRects),Fe(Og)&&!sc(Og)?(y.classed(g.eventRectsMultiple)||y.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),z=Cj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),kf(z.enter()),z.attr("x",0).attr("y",0).attr("width",gg).attr("height",ig)):(y.classed(g.eventRectsSingle)||y.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Xi&&!Wi?(D=function(a,b){var c=Bc(b),d=Cc(b),e=Nf.data.xs[a.id][b];return(Dg(d?d:e+50)-Dg(c?c:e-50))/2},C=function(a,b){var c=Bc(b),d=Nf.data.xs[a.id][b];return(Dg(d)+Dg(c?c:d-50))/2}):(D=P(),C=function(a){return Dg(a.x)-D/2}),A=Ec(Nf.data.targets),Cj.select("."+g.eventRects).datum(A?A.values:[]),z=Cj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),jf(z.enter()),z.attr("class",ld).attr("x",wh?0:C).attr("y",wh?C:0).attr("width",wh?gg:D).attr("height",wh?D:ig),z.exit().remove())),Gc(Nf.data.targets).forEach(function(a){Jj[a]=!0})}function rf(){qf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function sf(){if(0!==Lc(Nf.data.targets).length){if("mousemove"===Mf.event.sourceEvent.type&&zj.altDomain)return Dg.domain(zj.altDomain),void zj.scale(Dg).updateScaleExtent();Wi&&Dg.orgDomain()[0]===Hj[0]&&Dg.domain([Hj[0]-1e-10,Dg.orgDomain()[1]]),qf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Mf.event.sourceEvent.type&&($i=!0)}}function tf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function uf(){Aj.attr("width",kg).attr("height",lg),Aj.select("#"+Pi).select("rect").attr("width",gg).attr("height",ig),Aj.select("#"+Qi).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),Aj.select("#"+Ri).select("rect").attr("x",H).attr("y",I).attr("width",N).attr("height",O),Aj.select("."+g.zoomRect).attr("width",gg).attr("height",ig),Gj.style("max-height",lg+"px")}function vf(a){return{axisX:a?hj.x.transition().duration(a):hj.x,axisY:a?hj.y.transition().duration(a):hj.y,axisY2:a?hj.y2.transition().duration(a):hj.y2,axisSubX:a?hj.subx.transition().duration(a):hj.subx}}function wf(a){var b;a=a||{},a.withTransition=Je(a,"withTransition",!0),a.withTransform=Je(a,"withTransform",!1),a.withLegend=Je(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withLegend&&qh||(b=vf(a.withTransitionForAxis?cg:0),p(),V(),uf(),o(a.withTransition,b)),qf(a,b)}function xf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=Cj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",nd),j=i.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Zc),e=Cj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),d=e.enter().append("g").attr("class",pd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",fd).style("cursor",function(a){return eh(a)?"pointer":null}),c=Cj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),b=c.enter().append("g").attr("class",od).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",bd),b.append("g").attr("class",jd),b.append("g").attr("class",function(a){return Xc(g.selectedCircles,a.id)}),b.append("g").attr("class",dd).style("cursor",function(a){return eh(a)?"pointer":null}),a.forEach(function(a){Cj.selectAll("."+g.selectedCircles+rd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Cj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(ug(a)).attr("class",qd),f=h.enter().append("g").attr("class",qd),f.append("g").attr("class",hd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),nh&&(n=Dj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),m=n.enter().append("g").style("opacity",0).attr("class",pd),m.append("g").attr("class",fd),l=Dj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),k=l.enter().append("g").style("opacity",0).attr("class",od),k.append("g").attr("class",bd)),Aj.selectAll("."+g.target).filter(function(a){return Jc(a.id)}).transition().duration(cg).style("opacity",1)}function yf(a,b){b.filter&&(a=a.filter(b.filter)),(b.type||b.types)&&a.forEach(function(a){b.types?fe(a.id,b.types[a.id]):fe(a.id,b.type)}),Nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,z=0,F++)),E[a]=F,D[F]=f,A[a]=z,z+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+v)/10),j=10*Math.ceil((h.height+u)/10),k=nj?j:i,l=nj?U():T();return d&&(z=0,F=0,w=0,x=0),qh&&!Kc(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=i,C[c]=j,(!w||i>=w)&&(w=i),(!x||j>=x)&&(x=j),g=nj?x:w,void(vh?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(l-g*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=26,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=Ej.selectAll("."+g.legendItemFocused).size();b=b||{},n=Je(b,"withTransition",!0),q=Je(b,"withTransitionForTransform",!0),nj?(f=function(a){return w*E[a]},j=function(a){return D[E[a]]+A[a]}):(f=function(a){return D[E[a]]+A[a]},j=function(a){return x*E[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=Ej.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Xc(g.legendItem,a)}).style("visibility",function(a){return Kc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof sh?sh(a):Nf.toggle(a)}).on("mouseover",function(a){Mf.select(this).classed(g.legendItemFocused,!0),aj||Nf.focus(a),"function"==typeof th&&th(a)}).on("mouseout",function(a){Mf.select(this).classed(g.legendItemFocused,!1),aj||Nf.revert(),"function"==typeof uh&&uh(a)}),m.append("text").text(function(a){return d(Rg[a])?Rg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",nj?h:-200).attr("y",nj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",nj?i:-200).attr("y",nj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",cj).attr("x",nj?h:-200).attr("y",nj?-200:j).attr("width",10).attr("height",10),r=Ej.selectAll("text").data(a).text(function(a){return d(Rg[a])?Rg[a]:a}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=Ej.selectAll("rect."+g.legendItemEvent).data(a),(n?s.transition():s).attr("width",function(a){return B[a]}).attr("height",function(a){return C[a]}).attr("x",i).attr("y",l),t=Ej.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",cj).attr("x",f).attr("y",j),Ej.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Jc(a)}).transition().style("opacity",function(a){var b=Mf.select(this);return Jc(a)?!G||b.classed(g.legendItemFocused)?Bf(b):Cf(b):rj}),R(w),S(x),Q(F),p(),V(),uf(),o(q,c)}function If(a){return Ic(Nf.data.targets,a.id)}function Jf(a){return"data"in a&&Ic(Nf.data.targets,a.data.id)}function Kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function Lf(a,b,c){var d=!le(Nf.data.targets);aj=!1,fe(a,b),wf(c||{withTransitionForAxis:d})}var Mf=a.d3?a.d3:a.require?a.require("d3"):void 0,Nf={data:{},axis:{},legend:{}},Of={},Pf=i(["bindto"],"#chart"),Qf=i(["size","width"]),Rf=i(["size","height"]),Sf=i(["padding","left"]),Tf=i(["padding","right"]),Uf=i(["padding","top"]),Vf=i(["padding","bottom"]),Wf=i(["zoom","enabled"],!1),Xf=i(["zoom","extent"]),Yf=i(["zoom","privileged"],!1),Zf=i(["interaction","enabled"],!0),$f=i(["onenter"],function(){}),_f=i(["onleave"],function(){}),ag=i(["onresize"],function(){}),bg=i(["onresized"],function(){}),cg=i(["transition","duration"],350);h("data","data is required in config");var dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg,Kg,Lg,Mg,Ng=i(["data","x"]),Og=i(["data","xs"],{}),Pg=i(["data","x_format"]),Qg=i(["data","id_converter"],function(a){return a}),Rg=i(["data","names"],{}),Sg=i(["data","classes"],{}),Tg=i(["data","groups"],[]),Ug=i(["data","axes"],{}),Vg=i(["data","type"]),Wg=i(["data","types"],{}),Xg=i(["data","labels"],{}),Yg=i(["data","order"]),Zg=i(["data","regions"],{}),$g=i(["data","color"]),_g=i(["data","colors"],{}),ah=i(["data","hide"],!1),bh=i(["data","filter"]),ch=i(["data","selection","enabled"],!1),dh=i(["data","selection","grouped"],!1),eh=i(["data","selection","isselectable"],function(){return!0}),fh=i(["data","selection","multiple"],!0),gh=i(["data","onclick"],function(){}),hh=i(["data","onenter"],function(){}),ih=i(["data","onleave"],function(){}),jh=i(["data","onselected"],function(){}),kh=i(["data","onunselected"],function(){}),lh=i(["data","ondragstart"],function(){}),mh=i(["data","ondragend"],function(){}),nh=i(["subchart","show"],!1),oh=i(["subchart","size","height"],60),ph=i(["color","pattern"],[]),qh=i(["legend","show"],!0),rh=i(["legend","position"],"bottom"),sh=i(["legend","item","onclick"]),th=i(["legend","item","onmouseover"]),uh=i(["legend","item","onmouseout"]),vh=i(["legend","equally"],!1),wh=i(["axis","rotated"],!1),xh=i(["axis","x","show"],!0),yh=i(["axis","x","type"],"indexed"),zh=i(["axis","x","localtime"],!0),Ah=i(["axis","x","categories"],[]),Bh=i(["axis","x","tick","centered"],!1),Ch=i(["axis","x","tick","format"]),Dh=i(["axis","x","tick","culling"],{}),Eh=i(["axis","x","tick","culling","max"],10),Fh=i(["axis","x","tick","count"]),Gh=i(["axis","x","tick","fit"],!0),Hh=i(["axis","x","tick","values"],null),Ih=i(["axis","x","tick","rotate"]),Jh=i(["axis","x","max"],null),Kh=i(["axis","x","min"],null),Lh=i(["axis","x","padding"],{}),Mh=i(["axis","x","height"]),Nh=i(["axis","x","default"]),Oh=i(["axis","x","label"],{}),Ph=i(["axis","y","show"],!0),Qh=i(["axis","y","max"]),Rh=i(["axis","y","min"]),Sh=i(["axis","y","center"]),Th=i(["axis","y","label"],{}),Uh=i(["axis","y","inner"],!1),Vh=i(["axis","y","tick","format"]),Wh=i(["axis","y","padding"]),Xh=i(["axis","y","ticks"],10),Yh=i(["axis","y2","show"],!1),Zh=i(["axis","y2","max"]),$h=i(["axis","y2","min"]),_h=i(["axis","y2","center"]),ai=i(["axis","y2","label"],{}),bi=i(["axis","y2","inner"],!1),ci=i(["axis","y2","tick","format"]),di=i(["axis","y2","padding"]),ei=i(["axis","y2","ticks"],10),fi=i(["grid","x","show"],!1),gi=i(["grid","x","type"],"tick"),hi=i(["grid","x","lines"],[]),ii=i(["grid","y","show"],!1),ji=i(["grid","y","lines"],[]),ki=i(["grid","y","ticks"],10),li=i(["point","show"],!0),mi=i(["point","r"],2.5),ni=i(["point","focus","line","enabled"],!0),oi=i(["point","focus","expand","enabled"],!0),pi=i(["point","focus","expand","r"]),qi=i(["point","focus","select","r"]),ri=i(["line","connect_null"],!1),si=i(["bar","width"]),ti=i(["bar","width","ratio"],.6),ui=i(["pie","label","show"],!0),vi=i(["pie","label","format"]),wi=i(["pie","expand"],!0),xi=i(["pie","onclick"],function(){}),yi=i(["pie","onmouseover"],function(){}),zi=i(["pie","onmouseout"],function(){}),Ai=i(["donut","label","show"],!0),Bi=i(["donut","label","format"]),Ci=i(["donut","expand"],!0),Di=i(["donut","title"],""),Ei=i(["donut","onclick"],function(){}),Fi=i(["donut","onmouseover"],function(){}),Gi=i(["donut","onmouseout"],function(){}),Hi=i(["regions"],[]),Ii=i(["tooltip","show"],!0),Ji=i(["tooltip","format","title"]),Ki=i(["tooltip","format","value"]),Li=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Ji?Ji:b,l=Ki?Ki:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Mi=i(["tooltip","init","show"],!1),Ni=i(["tooltip","init","x"],0),Oi=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Pi=("string"==typeof Pf?Pf.replace("#",""):Pf.id)+"-clip",Qi=Pi+"-xaxis",Ri=Pi+"-yaxis",Si=j(Pi),Ti=j(Qi),Ui=j(Ri),Vi="timeseries"===yh,Wi="categorized"===yh,Xi=!Vi&&(Ng||Fe(Og)),Yi=null,Zi=!1,$i=!1,_i=!1,aj=!1,bj=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],cj=ze(_g,Fe(ph)?ph:bj,$g),dj=zh?Mf.time.format:Mf.time.format.utc,ej=dj.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),fj=[],gj=[],hj={},ij=wh?"left":"bottom",jj=wh?Uh?"top":"bottom":Uh?"right":"left",kj=wh?bi?"bottom":"top":bi?"left":"right",lj=wh?"left":"bottom",mj={main:function(){return"translate("+k(dg.left)+","+k(dg.top)+")"},context:function(){return"translate("+k(eg.left)+","+k(eg.top)+")"},legend:function(){return"translate("+fg.left+","+fg.top+")"},x:function(){return"translate(0,"+(wh?0:ig)+")" -},y:function(){return"translate(0,"+(wh?ig:0)+")"},y2:function(){return"translate("+(wh?0:gg)+","+(wh?1:0)+")"},subx:function(){return"translate(0,"+(wh?0:jg)+")"},arc:function(){return"translate("+pg/2+","+qg/2+")"}},nj="right"===rh,oj=0,pj=0,qj=0,rj=.15,sj=30,tj=wh&&!xh?0:30,uj=5;ug=Mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var vj,wj=function(){var a=Mf.svg.line().x(wh?function(a){return $(a.id)(a.value)}:Id).y(wh?Id:function(a){return $(a.id)(a.value)});return ri||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ri?Te(b.values):b.values;return me(b)?(a.interpolate(ne(b)?"cardinal":"linear"),Zg[b.id]?gf(e,Dg,$(b.id),Zg[b.id]):a(e)):(c=e[0]?Dg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,wh?"M "+d+" "+c:"M "+c+" "+d)}}(),xj=function(){var a;return a=wh?Mf.svg.area().x0(function(a){return $(a.id)(0)}).x1(function(a){return $(a.id)(a.value)}).y(Id):Mf.svg.area().x(Id).y0(function(a){return $(a.id)(0)}).y1(function(a){return $(a.id)(a.value)}),function(b){var c,d,e=Te(b.values);return ge([b],"area")||ge([b],"area-spline")?(a.interpolate(ne(b)?"cardinal":"linear"),a(e)):(c=e[0]?Dg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,wh?"M "+d+" "+c:"M "+c+" "+d)}}(),yj=function(){var a=Mf.svg.line().x(wh?function(a){return _(a.id)(a.value)}:Ld).y(wh?Ld:function(a){return _(a.id)(a.value)});return function(b){var c=Te(b.values);return me(b)?a(c):"M "+Gg(c[0].x)+" "+_(b.id)(c[0].value)}}(),zj=function(){};vj=Mf.svg.brush().on("brush",rf),vj.update=function(){return Dj&&Dj.select("."+g.brush).call(this),this},vj.scale=function(a){return wh?this.y(a):this.x(a)},Wf&&(zj=Mf.behavior.zoom().on("zoomstart",function(){zj.altDomain=Mf.event.sourceEvent.altKey?Dg.orgDomain():null}).on("zoom",Wf?sf:null),zj.scale=function(a){return wh?this.y(a):this.x(a)},zj.orgScaleExtent=function(){var a=Xf?Xf:[1,10];return[a[0],Math.max(Dc()/a[1],a[1])]},zj.updateScaleExtent=function(){var a=ec(Dg.orgDomain())/ec(Hj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Aj,Bj,Cj,Dj,Ej,Fj,Gj,Hj,Ij,Jj={};if(Nf.focus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);Nf.revert(),Nf.defocus(),b(d.classed(g.focused,!0)),b(e),le(Nf.data.targets)&&Rb(a,!0),Df(a,!0)},Nf.defocus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",.3)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);Nf.revert(),b(d.classed(g.focused,!1)),b(e),le(Nf.data.targets)&&Sb(a),Df(a,!1)},Nf.revert=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);b(d.classed(g.focused,!1)),b(e),le(Nf.data.targets)&&Sb(a),Ef()},Nf.show=function(a,b){a=Hc(a),b=b||{},Pc(a),Aj.selectAll(td(a)).transition().style("opacity",1),b.withLegend&&Ff(a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Nf.hide=function(a,b){a=Hc(a),b=b||{},Oc(a),Aj.selectAll(td(a)).transition().style("opacity",0),b.withLegend&&Gf(a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Nf.toggle=function(a){Jc(a)?Nf.hide(a):Nf.show(a)},Nf.unzoom=function(){vj.clear().update(),qf({withUpdateXDomain:!0})},Nf.load=function(a){return a.xs&&rc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Sg[b]=a.classes[b]}),"categories"in a&&Wi&&(Ah=a.categories,Jg.categories(Ah)),"cacheIds"in a&&fc(a.cacheIds)?void yf(hc(a.cacheIds),a.done):void("unload"in a?Af(Hc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){zf(a)}):zf(a))},Nf.unload=function(a,b){Af(Hc(a),function(){qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Nf.selected=function(a){return Mf.merge(Cj.selectAll("."+g.shapes+rd(a)).selectAll("."+g.shape).filter(function(){return Mf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Nf.select=function(a,b,c){ch&&Cj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Mf.select(this),i=e.data?e.data.id:e.id,j=Se(this),k=dh||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);"path"!==this.nodeName&&(k&&l?eh(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},Nf.unselect=function(a,b){ch&&Cj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Mf.select(this),f=c.data?c.data.id:c.id,h=Se(this),i=dh||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);"path"!==this.nodeName&&i&&j&&eh(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Nf.toLine=function(a){Lf(a,"line")},Nf.toSpline=function(a){Lf(a,"spline")},Nf.toBar=function(a){Lf(a,"bar")},Nf.toScatter=function(a){Lf(a,"scatter")},Nf.toArea=function(a){Lf(a,"area")},Nf.toAreaSpline=function(a){Lf(a,"area-spline")},Nf.toPie=function(a){Lf(a,"pie",{withTransform:!0})},Nf.toDonut=function(a){Lf(a,"donut",{withTransform:!0})},Nf.groups=function(a){return c(a)?Tg:(Tg=a,qf(),Tg)},Nf.xgrids=function(a){return a?(hi=a,qf(),hi):hi},Nf.xgrids.add=function(a){return a?Nf.xgrids(hi.concat(a)):void 0},Nf.xgrids.remove=function(a){var b=Kf(a);return Nf.xgrids(hi.filter(b))},Nf.ygrids=function(a){return a?(ji=a,qf(),ji):ji},Nf.ygrids.add=function(a){return a?Nf.ygrids(ji.concat(a)):void 0},Nf.ygrids.remove=function(a){var b=Kf(a);return Nf.ygrids(ji.filter(b))},Nf.regions=function(a){return a?(Hi=a,qf(),Hi):Hi},Nf.regions.add=function(a){return a?(Hi=Hi.concat(a),qf(),Hi):Hi},Nf.regions.remove=function(a){var b,c,d;return a=a||{},b=Je(a,"duration",cg),c=Je(a,"classes",[g.region]),d=Cj.select("."+g.regions).selectAll(c.map(function(a){return"."+a})),(b?d.transition().duration(b):d).style("opacity",0).remove(),Hi=Hi.filter(function(a){return c.indexOf(a.class)<0})},Nf.data.get=function(a){var b=Nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Nf.data.getAsTarget=function(a){var b=Nf.data.targets.filter(function(b){return b.id===a});return b.length>0?b[0]:void 0},Nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Rg[b]=a[b]}),qf({withLegend:!0}),Rg):Rg},Nf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){_g[b]=a[b]}),qf({withLegend:!0}),_g):_g},Nf.x=function(a){return arguments.length&&(uc(Nf.data.targets,a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Nf.data.xs},Nf.xs=function(a){return arguments.length&&(vc(Nf.data.targets,a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Nf.data.xs},Nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){gb(b,a[b])}),Ib())},Nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Jh=+a.x),b(a.y)&&(Qh=+a.y),b(a.y2)&&(Zh=+a.y2)):Qh=Zh=+a,qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Kh=+a.x),b(a.y)&&(Rh=+a.y),b(a.y2)&&($h=+a.y2)):Rh=$h=+a,qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Nf.axis.max(a.max),"undefined"!=typeof a.min&&Nf.axis.min(a.min))},Nf.legend.show=function(a){Ff(Hc(a)),qf({withLegend:!0})},Nf.legend.hide=function(a){Gf(Hc(a)),qf({withLegend:!0})},Nf.resize=function(a){Qf=a?a.width:null,Rf=a?a.height:null,wf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Nf.destroy=function(){Nf.data.targets=void 0,Nf.data.xs={},Gj.html(""),a.onresize=null},"url"in f.data)Mf.xhr(f.data.url,function(a,b){var c,d=Mf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Mf.csv.parse(b.response),hf(c)});else if("rows"in f.data)hf(xc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");hf(yc(f.data.columns))}return Nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(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}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.round(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.round(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&agg&&(gg=0),0>ig&&(ig=0),hg=wh?dg.left-sj-tj:gg,jg=wh?ig:lg-eg.top-eg.bottom,0>hg&&(hg=0),0>jg&&(jg=0),pg=gg-(nj?b+10:0),qg=ig-(nj?0:10),r(),nj&&d&&(fg.left=pg/2+1.1*ng)}function q(){Cj.select("line."+g.xgridFocus).attr("x1",wh?0:-10).attr("x2",wh?gg:-10).attr("y1",wh?-10:dg.top).attr("y2",wh?-10:ig)}function r(){ng=Math.min(pg,qg)/2,mg=.95*ng,og=ke(Nf.data.targets)?.6*mg:0}function s(){var a=wh?g.axisX:g.axisY,b=Cj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Gj.node().getBoundingClientRect(),e=le(Nf.data.targets),f=c.right-d.left-(e?0:x());return f>0?f:0}function t(){return Qf?Qf:B()}function u(){var a=Rf?Rf:C();return a>0?a:320}function v(){return Uf?Uf:0}function w(){return Vf?Vf:0}function x(){return Sf?Sf:wh?xh?Ke(z("x")):1:!Ph||Uh?1:Ke(z("y"))}function y(){var a=10,b=nj?T()+20:0;return Tf?Tf:wh?a+b:(!Yh||bi?a:Ke(z("y2")))+b}function z(a){var b=ob(a);return b.isInner?20+Hb(a):40+Hb(a)}function A(a){return"x"!==a||xh?"x"===a&&Mh?Mh:"y"!==a||Ph?"y2"!==a||Yh?(ob(a).isInner?30:40)+("y2"===a?-10:0):uj:qh&&!nj?10:1:0}function B(){return+Gj.style("width").replace("px","")}function C(){return+Gj.style("height").replace("px","")}function D(a){return a?-31:-(dg.left-1)}function E(a){return a?-20:-4}function F(){return D(!wh)}function G(){return E(!wh)}function H(){return D(wh)}function I(){return E(wh)}function J(a){return a?gg+2+30+30:dg.left+20}function K(a){return a?(Mh?Mh:0)+80:ig+8}function L(){return J(!wh)}function M(){return K(!wh)}function N(){return J(wh)}function O(){return K(wh)}function P(){var a,b,c,d,e,f=Ec(Nf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=Dg(b.x)-Dg(a.x),0===c?wh?ig:gg:(d=Dc(),e=he(Nf.data.targets)?(d-(Wi?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function Q(a){oj=a}function R(a){pj=a}function S(a){qj=a}function T(){return qh?nj?pj*(oj+1):kg:0}function U(){return qh?nj?lg:qj*(oj+1):0}function V(){var a,b,c=!Dg;vg=wh?1:0,wg=wh?ig:gg,xg=wh?0:ig,yg=wh?gg:1,zg=vg,Ag=wg,Bg=wh?0:jg,Cg=wh?hg:1,Dg=Y(vg,wg,c?void 0:Dg.domain(),function(){return Jg.tickOffset()}),Eg=Z(xg,yg,c?void 0:Eg.domain()),Fg=Z(xg,yg,c?void 0:Fg.domain()),Gg=Y(vg,wg,Hj,function(a){return a%1?0:Mg.tickOffset()}),Hg=Z(Bg,Cg,c?void 0:Hg.domain()),Ig=Z(Bg,Cg,c?void 0:Ig.domain()),a=db(),b=Hh?Hh:c?void 0:Jg.tickValues(),Jg=ab(Dg,ij,a,b),Mg=ab(Gg,lj,a,b),Kg=bb(Eg,jj,Vh,Xh),Lg=bb(Fg,kj,ci,ei),c||(vj.scale(Gg),Wf&&zj.scale(Dg)),W()}function W(){rg=Kb(),sg=Lb(),tg=Lb(.98)}function X(a,b,c){return(c?Mf.time.scale():Mf.scale.linear()).range([a,b])}function Y(a,b,c,d){var e,f=X(a,b,Vi),g=c?f.domain(c):f;Wi?(d=d||function(){return 0},f=function(a,b){var c=g(a)+d(a);return b?c:Math.ceil(c)}):f=function(a,b){var c=g(a);return b?c:Math.ceil(c)};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return Hj&&Hj[0]===a[0]&&Hj[1]a?a.toFixed(0):a};return Ch&&("function"==typeof Ch?a=Ch:Vi&&(a=function(a){return a?dj(Ch)(a):""})),a}function eb(a){var b;return"y"===a?b=Th:"y2"===a?b=ai:"x"===a&&(b=Oh),b}function fb(a){var b=eb(a);return"string"==typeof b?b:b?b.text:null}function gb(a,b){var c=eb(a);"string"==typeof c?"y"===a?Th=b:"y2"===a?ai=b:"x"===a&&(Oh=b):c&&(c.text=b)}function hb(a){return 10*Math.sin(Math.PI*(a/180))}function ib(a){return 11.5-2.5*(a/15)}function jb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",ib(c)).attr("x",hb(c)).attr("transform","rotate("+c+")")}function kb(a,b){var c=eb(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 lb(){return kb("x",wh?"inner-top":"inner-right")}function mb(){return kb("y",wh?"inner-right":"inner-top")}function nb(){return kb("y2",wh?"inner-right":"inner-top")}function ob(a){return"y2"===a?nb():"y"===a?mb():lb()}function pb(){return fb("x")}function qb(){return fb("y")}function rb(){return fb("y2")}function sb(a,b){return a?b.isLeft?0:b.isCenter?gg/2:gg:b.isBottom?-ig:b.isMiddle?-ig/2:0}function tb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function ub(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function vb(){return sb(!wh,lb())}function wb(){return sb(wh,mb())}function xb(){return sb(wh,nb())}function yb(){return tb(!wh,lb())}function zb(){return tb(wh,mb())}function Ab(){return tb(wh,nb())}function Bb(){var a=lb();return wh?a.isInner?"1.2em":-25-Hb("x"):a.isInner?"-0.5em":Mh?Mh-10:"3em"}function Cb(){var a=mb();return wh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Hb("y")}function Db(){var a=nb();return wh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Hb("y2")}function Eb(){return ub(!wh,lb())}function Fb(){return ub(wh,mb())}function Gb(){return ub(wh,nb())}function Hb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Ib(a){var b=Cj.select("."+g.axisX+" ."+g.axisXLabel),c=Cj.select("."+g.axisY+" ."+g.axisYLabel),d=Cj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",vb).attr("dx",yb).attr("dy",Bb).text(pb),(a?c.transition():c).attr("x",wb).attr("dx",zb).attr("dy",Cb).attr("dy",Cb).text(qb),(a?d.transition():d).attr("x",xb).attr("dx",Ab).attr("dy",Db).text(rb)}function Jb(a){var b=!1;return ug(Lc(Nf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Kb(){var a=Mf.svg.arc().outerRadius(mg).innerRadius(og),b=function(b,c){var d;return c?a(b):(d=Jb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Lb(a){var b=Mf.svg.arc().outerRadius(ng*(a?a:1)).innerRadius(og);return function(a){var c=Jb(a);return c?b(c):"M 0 0"}}function Mb(a,b){return se(a.data)?rg(a,b):"M 0 0"}function Nb(a){var b,c,d,e,f=Jb(a),g="";return f&&(b=rg.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*mg*.8+","+d/e*mg*.8+")"),g}function Ob(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Pb(a){return tc({id:a.data.id,value:a.value,ratio:Ob(a)})}function Qb(a){var b,c,d,e;return Tb()?(b=Jb(a),c=b?b.value:null,d=Ob(b),e=Ub(),e?e(c,d):Gd(c,d)):""}function Rb(a,b){var c=Aj.selectAll("."+g.chartArc+sd(a)),d=Aj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});ye(a)&&c.selectAll("path").transition().duration(50).attr("d",sg).transition().duration(100).attr("d",tg).each(function(a){re(a.data)}),b||d.style("opacity",.3)}function Sb(a){var b=Aj.selectAll("."+g.chartArc+sd(a));b.selectAll("path").transition().duration(50).attr("d",rg),Aj.selectAll("."+g.arc).style("opacity",1)}function Tb(){return ke(Nf.data.targets)?Ai:ui}function Ub(){return ke(Nf.data.targets)?Bi:vi}function Vb(){return ke(Nf.data.targets)?Di:""}function Wb(){var a=ke(Nf.data.targets)?Ei:xi;return"function"==typeof a?a:function(){}}function Xb(){var a=ke(Nf.data.targets)?Fi:yi;return"function"==typeof a?a:function(){}}function Yb(){var a=ke(Nf.data.targets)?Gi:zi;return"function"==typeof a?a:function(){}}function Zb(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Tg.length>0)for(g=Uc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return Mf.min(Object.keys(i).map(function(a){return Mf.min(i[a])}))}function $b(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Tg.length>0)for(g=Vc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return Mf.max(Object.keys(i).map(function(a){return Mf.max(i[a])}))}function _b(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return cb(a.id)===c}),m="y2"===c?$h:Rh,n="y2"===c?Zh:Qh,o=b(m)?m:Zb(l),p=b(n)?n:$b(l),q="y2"===c?_h:Sh,r=Ad()&&wh;return 0===l.length?"y2"===c?Fg.domain():Eg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=Bd(o,p),j=ec(Eg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Wh&&(f=b(Wh.top)?Wh.top:e,g=b(Wh.bottom)?Wh.bottom:e),"y2"===c&&di&&(f=b(di.top)?di.top:e,g=b(di.bottom)?di.bottom:e),he(l)&&!Uc(l)&&(g=o),[o-g,p+f])}function ac(a){return Kh?Vi?Ae(Kh):Kh:Mf.min(a,function(a){return Mf.min(a.values,function(a){return a.x})})}function bc(a){return Jh?Vi?Ae(Jh):Jh:Mf.max(a,function(a){return Mf.max(a.values,function(a){return a.x})})}function cc(a){var c,d,e,f,g=Fc(a),h=g[1]-g[0];return Wi?d=0:he(a)?(c=Dc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Lh&&Fe(Lh)?(e=b(Lh.left)?Lh.left:d,f=b(Lh.right)?Lh.right:d):e=f="number"==typeof Lh?Lh:d,{left:e,right:f}}function dc(a){var b=[ac(a),bc(a)],c=b[0],d=b[1],e=cc(a),f=0,g=0;return c-d!==0||Wi||(c=Vi?new Date(.5*c.getTime()):-.5,d=Vi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ec(a){return a[1]-a[0]}function fc(a){for(var b=0;bb?0:b-c}function lc(a){var b,c=jc(a),d="y"===a.axis?Eg:Fg;return b="y"===a.axis||"y2"===a.axis?wh?ig:"start"in a?d(a.start):ig:wh?"end"in a?Dg(Vi?Ae(a.end):a.end):ig:ig,c>b?0:b-c}function mc(a){return Ng&&a===Ng||Fe(Og)&&Ge(Og,a)}function nc(a){return!mc(a)}function oc(a){return Ng?Ng:Fe(Og)?Og[a]:null}function pc(a,b){var c,d=b&&Fe(b)?Gc(b):[];return d.forEach(function(b){oc(b)===a&&(c=Nf.data.xs[b])}),c}function qc(a,b){return a in Nf.data.xs&&Nf.data.xs[a]&&Nf.data.xs[a][b]?Nf.data.xs[a][b]:b}function rc(a){Object.keys(a).forEach(function(b){Og[b]=a[b]})}function sc(a){return 1===Mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function tc(a){var b;return a&&(b=Rg[a.id],a.name=b?b:a.id),a}function uc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=wc(b[d],a.id,d)}),Nf.data.xs[a.id]=b})}function vc(a,b){a.forEach(function(a){b[a.id]&&uc([a],b[a.id])})}function wc(a,c,d){var e;return e=Vi?a?a instanceof Date?a:Ae(a):Ae(qc(c,d)):Xi&&!Wi?b(a)?+a:qc(c,d):d}function xc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Ng?(d=Object.keys(Nf.data.xs),Nf.data.xs[c]=d.length>0?Nf.data.xs[d[0]]:void 0):Fe(Og)&&(Nf.data.xs[c]=pc(f,Nf.data.targets)):Nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Qg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=oc(b),g=a[f],h=wc(g,b,e);return Xi&&Wi&&0===c&&g&&(0===e&&(Ah=[]),Ah.push(g)),("undefined"==typeof a[b]||Nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Vg&&fe(Gc(c).filter(function(a){return!(a in Wg)}),Vg),c.forEach(function(a){gc(a.id_org,a)}),c}function Ac(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 Bc(a){return a>0&&Nf.data.targets[0].values[a-1]?Nf.data.targets[0].values[a-1].x:void 0}function Cc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Fc(a){var b,c,d=Ec(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Gc(a){return a.map(function(a){return a.id})}function Hc(a){return a?"string"==typeof a?[a]:a:Gc(Nf.data.targets)}function Ic(a,b){var c,d=Gc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Vi?new Date(i):i);j.push(e)}return Vi||(j=j.sort(function(a,b){return a-b})),j}function Oc(a){fj=fj.concat(a)}function Pc(a){fj=fj.filter(function(b){return a.indexOf(b)<0})}function Qc(a){gj=gj.concat(a)}function Rc(a){gj=gj.filter(function(b){return a.indexOf(b)<0})}function Sc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Tc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Vc(a){return Tc(a,function(a){return a>0})}function Wc(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||0===a[f].x)&&(e=e.concat(Md(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Md(a,g))),Pd(e,b)):Nd(a,b,f,g)}function Od(a,b){var c;return c=a.map(function(a){return Nd(a.values,b)}),Pd(c,b)}function Pd(a,b){var c,d;return a.forEach(function(a){var e=He(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Qd(a,b){return Mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Rd(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 Sd(){return Yg&&"desc"===Yg.toLowerCase()}function Td(){return Yg&&"asc"===Yg.toLowerCase()}function Ud(a){var b=Td(),c=Sd();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 Yg&&a.sort(Yg),a}function Vd(a,c){var d,e,f,g,h,i,j,k=le(Nf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&Ii&&(Fj.html(Li(a,db(),Cd(k),cj)).style("display","block"),d=Fj.property("offsetWidth"),e=Fj.property("offsetHeight"),k?(g=gg/2+c[0],i=ig/2+c[1]+20):(wh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-y(),i=Dg(l[0].x)+20):(f=s(),g=f+x()+Dg(l[0].x)+20,h=g+d,j=f+t()-y(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),Fj.style("top",i+"px").style("left",g+"px"))}function Wd(){Fj.style("display","none")}function Xd(a){var c=a.filter(function(a){return a&&b(a.value)});if(Ii&&!ie(Nf.data.targets)&&!le(Nf.data.targets)){var d=Cj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(wh?"y1":"x1",Id).attr(wh?"y2":"x2",Id),pf(d,"grid")}}function Yd(){Cj.select("line."+g.xgridFocus).style("visibility","hidden")}function Zd(a,b){var c,d,e,f,h=[],i=Cj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=dc(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function $d(a){return a.x||0===a.x?Dg(a.x):null}function _d(a){return $(a.id)(a.value)}function ae(){var a,b,d={},e=0;return Lc(Nf.data.targets.filter(oe)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ee(a,b){return"number"==typeof si?si:b?2*a.tickOffset()*ti/b:0}function fe(a,b){Hc(a).forEach(function(a){Jj[a]=b===Wg[a],Wg[a]=b})}function ge(a,b){var c=!1;return a.forEach(function(a){Wg[a.id]===b&&(c=!0),a.id in Wg||"line"!==b||(c=!0)}),c}function he(a){return ge(a,"bar")}function ie(a){return ge(a,"scatter")}function je(a){return ge(a,"pie")}function ke(a){return ge(a,"donut")}function le(a){return je(a)||ke(a)}function me(a){var b="string"==typeof a?a:a.id;return!(b in Wg)||"line"===Wg[b]||"spline"===Wg[b]||"area"===Wg[b]||"area-spline"===Wg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"spline"===Wg[b]||"area-spline"===Wg[b]}function oe(a){var b="string"==typeof a?a:a.id;return"bar"===Wg[b]}function pe(a){var b="string"==typeof a?a:a.id;return"scatter"===Wg[b]}function qe(a){var b="string"==typeof a?a:a.id;return"pie"===Wg[b]}function re(a){var b="string"==typeof a?a:a.id;return"donut"===Wg[b]}function se(a){return qe(a)||re(a)}function te(a){return me(a)?[a]:[]}function ue(a){return se(a.data)?[a]:[]}function ve(a){return oe(a)?a.values:[]}function we(a){return me(a)||pe(a)?a.values:[]}function xe(a){return oe(a)||me(a)?a.values:[]}function ye(a){return re(a)&&Ci||qe(a)&&wi}function ze(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function Ae(b){var c;try{c=Pg?Mf.time.format(Pg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Pg)}return c}function Be(a,b){var c=Mf.mouse(a),d=Mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ge(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function He(a,b){var c="y"===cb(a.id)?Eg:Fg,d=wh?1:0,e=wh?0:1;return Math.pow(Dg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ie(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Je(a,b,c){return d(a[b])?a[b]:c}function Ke(a){return 10*Math.ceil(a/10)}function Le(a,b,c){jh(b,a.node()),Cj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Xc(g.selectedCircle,c)}).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d).attr("stroke",function(){return cj(b)}).attr("r",1.4*We(b)).transition().duration(100).attr("r",We)}function Me(a,b,c){kh(b,a.node()),Cj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ne(a,b,c,d){a?Le(b,c,d):Me(b,c,d)}function Oe(a,b){jh(b,a.node()),a.transition().duration(100).style("fill",function(){return Mf.rgb(cj(b)).brighter(.75)})}function Pe(a,b){kh(b,a.node()),a.transition().duration(100).style("fill",function(){return cj(b)})}function Qe(a,b,c,d){a?Oe(b,c,d):Pe(b,c,d)}function Re(a,b,c,d){Qe(a,b,c.data,d)}function Se(a){return"circle"===a.nodeName?Ne:Mf.select(a).classed(g.bar)?Qe:Re}function Te(a){return a.filter(function(a){return b(a.value)})}function Ue(a){return li?"function"==typeof mi?mi(a):mi:0}function Ve(a){return oi?pi?pi:1.75*Ue(a):Ue(a)}function We(a){return qi?qi:4*Ue(a)}function Xe(a,c){return(c?Cj.selectAll("."+g.circles+rd(c)):Cj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ye(a,b){Xe(a,b).classed(g.EXPANDED,!0).attr("r",Ve)}function Ze(a){Xe(a).filter(function(){return Mf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Ue)}function $e(a){return Cj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function _e(a){$e(a).classed(g.EXPANDED,!0)}function af(a){$e(a).classed(g.EXPANDED,!1)}function bf(a,b){var c=ff(a,b);return function(a,b){var d=c(a,b),e=wh?1:0,f=wh?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 cf(a,b){var c=ff(a,!1),d=b?df:ef;return function(a,b){return d(c(a,b),a,this)}}function df(a,b){var c;return wh?(c=oe(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function ef(a,b,c){var d=c.getBoundingClientRect();return wh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:oe(b)?-3:-6)}function ff(a,b){var c=a.__max__+1,d=ee(Jg,c),e=be(d,c,a,!!b),f=ce(!!b),g=de(a,!!b),h=b?_:$;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return wh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function gf(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function hf(b){var c,d,e;if(Gj=Mf.select(Pf),Gj.empty())throw new Error("Element to bind not found");if(Gj.html("").classed("c3",!0),Nf.data.xs={},Nf.data.targets=zc(b),bh&&(Nf.data.targets=Nf.data.targets.filter(bh)),ah&&Oc(ah===!0?Gc(Nf.data.targets):ah),p(),V(),Dg.domain(Mf.extent(dc(Nf.data.targets))),Eg.domain(_b(Nf.data.targets,"y")),Fg.domain(_b(Nf.data.targets,"y2")),Gg.domain(Dg.domain()),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Hj=Dg.domain(),vj.scale(Gg),Wf&&zj.scale(Dg),Aj=Gj.append("svg").on("mouseenter",$f).on("mouseleave",_f),Bj=Aj.append("defs"),Bj.append("clipPath").attr("id",Pi).append("rect"),Bj.append("clipPath").attr("id",Qi).append("rect"),Bj.append("clipPath").attr("id",Ri).append("rect"),uf(),Cj=Aj.append("g").attr("transform",mj.main),Dj=Aj.append("g").attr("transform",mj.context),Ej=Aj.append("g").attr("transform",mj.legend),nh||Dj.style("visibility","hidden"),qh||(Ej.style("visibility","hidden"),gj=Gc(Nf.data.targets)),Fj=Gj.style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Hf(Gc(Nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=Cj.append("g").attr("clip-path",Si).attr("class",g.grid),fi&&d.append("g").attr("class",g.xgrids),Fe(hi)&&d.append("g").attr("class",g.xgridLines),ni&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),ii&&d.append("g").attr("class",g.ygrids),Fe(ji)&&d.append("g").attr("class",g.ygridLines),Cj.append("g").attr("clip-path",Si).attr("class",g.regions),Cj.append("g").attr("clip-path",Si).attr("class",g.chart),c=Cj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Wf?wh?"ns-resize":"ew-resize":null),Cj.select("."+g.chart).append("g").attr("class",g.chartBars),Cj.select("."+g.chart).append("g").attr("class",g.chartLines),Cj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",mj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Vb()),Cj.select("."+g.chart).append("g").attr("class",g.chartTexts),Wf&&Cj.insert("rect",Yf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",gg).attr("height",ig).style("opacity",0).style("cursor",wh?"ns-resize":"ew-resize").call(zj).on("dblclick.zoom",null),Nh&&vj.extent("function"!=typeof Nh?Nh:Nh(dc())),hj.x=Cj.append("g").attr("class",g.axisX).attr("clip-path",Ti).attr("transform",mj.x).style("visibility",xh?"visible":"hidden"),hj.x.append("text").attr("class",g.axisXLabel).attr("transform",wh?"rotate(-90)":"").style("text-anchor",Eb),hj.y=Cj.append("g").attr("class",g.axisY).attr("clip-path",Ui).attr("transform",mj.y).style("visibility",Ph?"visible":"hidden"),hj.y.append("text").attr("class",g.axisYLabel).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Fb),hj.y2=Cj.append("g").attr("class",g.axisY2).attr("transform",mj.y2).style("visibility",Yh?"visible":"hidden"),hj.y2.append("text").attr("class",g.axisY2Label).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Gb),Dj.append("g").attr("clip-path",Si).attr("class",g.chart),Dj.select("."+g.chart).append("g").attr("class",g.chartBars),Dj.select("."+g.chart).append("g").attr("class",g.chartLines),Dj.append("g").attr("clip-path",Si).attr("class",g.brush).call(vj).selectAll("rect").attr(wh?"width":"height",wh?hg:jg),hj.subx=Dj.append("g").attr("class",g.axisX).attr("transform",mj.subx).attr("clip-path",wh?"":Ti),xf(Nf.data.targets),qf({withUpdateTranslate:!0,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Mi){if(Vi&&"string"==typeof Ni){for(Ni=Ae(Ni),e=0;e0){d=[];for(var f in Rg)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Rd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Qe,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function nf(a){le(Nf.data.targets)||ch&&(Yi=a,Cj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Zi=!0,lh())}function of(){le(Nf.data.targets)||ch&&(Cj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),Cj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Zi=!1,mh())}function pf(a,b){"grid"===b&&a.each(function(){var a=Mf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function qf(a,c){var d,e,f,h,i,j,k,l,m,n,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,Q,R,S,T,U,W,X,Y,Z,$=ae(),_=le(Nf.data.targets),ab=Lc(Nf.data.targets);if(a=a||{},E=Je(a,"withY",!0),F=Je(a,"withSubchart",!0),G=Je(a,"withTransition",!0),J=Je(a,"withTransform",!1),K=Je(a,"withUpdateXDomain",!1),L=Je(a,"withUpdateOrgXDomain",!1),N=Je(a,"withUpdateTranslate",!1),M=Je(a,"withLegend",!1),H=Je(a,"withTransitionForExit",G),I=Je(a,"withTransitionForAxis",G),T=G?cg:0,U=H?T:0,W=I?T:0,c=c||vf(W),M&&qh&&Hf(Gc(Nf.data.targets),a,c),Wi&&0===ab.length&&Dg.domain([0,hj.x.selectAll(".tick").size()]),ab.length&&(L&&(Dg.domain(Mf.extent(dc(ab))),Hj=Dg.domain(),Wf&&zj.scale(Dg).updateScaleExtent(),Gg.domain(Dg.domain()),vj.scale(Gg)),K&&(Dg.domain(vj.empty()?Hj:vj.extent()),Wf&&zj.scale(Dg).updateScaleExtent()),Hh||!Gh&&!Fh||(X=Nc(Mc(ab),Fh),Jg.tickValues(X),Mg.tickValues(X))),Eg.domain(_b(ab,"y")),Fg.domain(_b(ab,"y2")),hj.x.style("opacity",_?0:1),hj.y.style("opacity",_?0:1),hj.y2.style("opacity",_?0:1),hj.subx.style("opacity",_?0:1),c.axisX.call(Jg),c.axisY.call(Kg),c.axisY2.call(Lg),c.axisSubX.call(Mg),Ib(G),N&&(p(),V(),uf(),o(!1),hj.x.call(Jg),hj.y.call(Kg),hj.y2.call(Lg),hj.subx.call(Mg)),K&&ab.length)if(Dh&&X){for(Y=1;Y=0&&Mf.select(this).style("display",b%Z?"none":"block")})}else Aj.selectAll("."+g.axisX+" .tick text").style("display","block");!wh&&Ih&&jb(hj.x,c.axisX,Ih),O=bf($),R=cf($,!0),S=cf($,!1),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Fj.style("display","none"),q(),Cj.select("line."+g.xgridFocus).style("visibility","hidden"),fi&&(f=Zd(gi,Dg),B=Wi?Jg.tickOffset():0,e=wh?{x1:0,x2:gg,y1:function(a){return Dg(a)-B},y2:function(a){return Dg(a)-B}}:{x1:function(a){return Dg(a)+B},x2:function(a){return Dg(a)+B},y1:dg.top,y2:ig},d=Cj.select("."+g.xgrids).selectAll("."+g.xgrid).data(f),d.enter().append("line").attr("class",g.xgrid),d.attr(e).style("opacity",function(){return+Mf.select(this).attr(wh?"y1":"x1")===(wh?ig:0)?0:1}),d.exit().remove()),Fe(hi)&&(h=Cj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(hi),i=h.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),i.append("line").style("opacity",0),i.append("text").attr("text-anchor","end").attr("transform",wh?"":"rotate(-90)").attr("dx",wh?0:-dg.top).attr("dy",-5).style("opacity",0),h.select("line").transition().duration(T).attr("x1",wh?0:Jd).attr("x2",wh?gg:Jd).attr("y1",wh?Jd:dg.top).attr("y2",wh?Jd:ig).style("opacity",1),h.select("text").transition().duration(T).attr("x",wh?gg:0).attr("y",Jd).text(function(a){return a.text}).style("opacity",1),h.exit().transition().duration(T).style("opacity",0).remove()),E&&ii&&(j=Cj.select("."+g.ygrids).selectAll("."+g.ygrid).data(Eg.ticks(ki)),j.enter().append("line").attr("class",g.ygrid),j.attr("x1",wh?Eg:0).attr("x2",wh?Eg:gg).attr("y1",wh?0:Eg).attr("y2",wh?ig:Eg),j.exit().remove(),pf(j,"grid")),E&&Fe(ji)&&(k=Cj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(ji),l=k.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",wh?"rotate(-90)":"").attr("dx",wh?0:-dg.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",wh?Kd:0).attr("x2",wh?Kd:gg).attr("y1",wh?0:Kd).attr("y2",wh?ig:Kd).style("opacity",1),k.select("text").transition().duration(T).attr("x",wh?0:gg).attr("y",Kd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),u=Cj.select("."+g.regions).selectAll("."+g.region).data(Hi),u.enter().append("g").attr("class",kd).append("rect").style("fill-opacity",0),u.selectAll("rect").transition().duration(T).attr("x",ic).attr("y",jc).attr("width",kc).attr("height",lc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),u.exit().transition().duration(T).style("opacity",0).remove(),s=Cj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),s.enter().append("path").attr("class",ed).style("stroke","none").style("fill",cj),s.style("opacity",wd).transition().duration(T).attr("d",O).style("fill",cj).style("opacity",1),s.exit().transition().duration(U).style("opacity",0).remove(),m=Cj.selectAll("."+g.lines).selectAll("."+g.line).data(te),m.enter().append("path").attr("class",ad).style("stroke",cj),m.style("opacity",wd).transition().duration(T).attr("d",wj).style("stroke",cj).style("opacity",1),m.exit().transition().duration(U).style("opacity",0).remove(),n=Cj.selectAll("."+g.areas).selectAll("."+g.area).data(te),n.enter().append("path").attr("class",id).style("fill",cj).style("opacity",function(){return Ij=+Mf.select(this).style("opacity"),0}),n.style("opacity",0).transition().duration(T).attr("d",xj).style("fill",cj).style("opacity",Ij),n.exit().transition().duration(U).style("opacity",0).remove(),r=Cj.selectAll("."+g.circles).selectAll("."+g.circle).data(we),r.enter().append("circle").attr("class",cd).attr("r",Ue).style("fill",cj),r.style("opacity",wd).transition().duration(T).style("opacity",yd).style("fill",cj).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d),r.exit().remove(),v=Cj.selectAll("."+g.texts).selectAll("."+g.text).data(xe),v.enter().append("text").attr("class",Yc).attr("text-anchor",function(a){return wh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",cj).style("fill-opacity",0),v.text(function(a){return Hd(a.id)(a.value,a.id)}).style("fill-opacity",xd).transition().duration(T).attr("x",R).attr("y",S).style("fill",cj).style("fill-opacity",zd),v.exit().transition().duration(U).style("fill-opacity",0).remove(),t=Cj.selectAll("."+g.arcs).selectAll("."+g.arc).data(ue),t.enter().append("path").attr("class",gd).style("fill",function(a){return cj(a.data)}).style("cursor",function(a){return eh(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;aj||(c=Jb(a),d=Pb(c),e=Xb(),Rb(c.data.id),Df(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Jb(a),c=Pb(b),d=[c];Vd(d,Mf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;aj||(c=Jb(a),d=Pb(c),e=Yb(),Sb(c.data.id),Ef(),Wd(),e(d,b))}).on("click",function(a,b){var c=Jb(a),d=Pb(c),e=Wb();lf(this,a,b),e(d,b)}),t.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){aj=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Jb(a);return c?(b=Mf.interpolate(this._current,c),this._current=b(0),function(a){return Mb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("fill",function(a){return cj(a.data)}).style("opacity",1).call(Ie,function(){aj=!1}),t.exit().transition().duration(U).style("opacity",0).remove(),Cj.selectAll("."+g.chartArc).select("text").attr("transform",Nb).style("opacity",0).transition().duration(T).text(Qb).style("opacity",function(a){return Jc(a.data.id)&&se(a.data)?1:0}),Cj.select("."+g.chartArcsTitle).style("opacity",ke(Nf.data.targets)?1:0),nh&&(Mf.event&&"zoom"===Mf.event.type&&vj.extent(Dg.orgDomain()).update(),F&&(!wh&&Ih&&jb(hj.subx,c.axisSubX,Ih),vj.empty()||vj.extent(Dg.orgDomain()).update(),Q=bf($,!0),x=Dj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),x.enter().append("path").attr("class",ed).style("stroke","none").style("fill",cj),x.style("opacity",wd).transition().duration(T).attr("d",Q).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove(),w=Dj.selectAll("."+g.lines).selectAll("."+g.line).data(te),w.enter().append("path").attr("class",ad).style("stroke",cj),w.style("opacity",wd).transition().duration(T).attr("d",yj).style("opacity",1),w.exit().transition().duration(T).style("opacity",0).remove())),Cj.selectAll("."+g.selectedCircles).filter(function(a){return oe(a)}).selectAll("circle").remove(),Cj.selectAll("."+g.selectedCircle).transition().duration(T).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d),Zf&&(y=Cj.select("."+g.eventRects),Fe(Og)&&!sc(Og)?(y.classed(g.eventRectsMultiple)||y.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),z=Cj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),kf(z.enter()),z.attr("x",0).attr("y",0).attr("width",gg).attr("height",ig)):(y.classed(g.eventRectsSingle)||y.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Xi&&!Wi?(D=function(a,b){var c=Bc(b),d=Cc(b),e=Nf.data.xs[a.id][b];return(Dg(d?d:e+50)-Dg(c?c:e-50))/2},C=function(a,b){var c=Bc(b),d=Nf.data.xs[a.id][b];return(Dg(d)+Dg(c?c:d-50))/2}):(D=P(),C=function(a){return Dg(a.x)-D/2}),A=Ec(Nf.data.targets),Cj.select("."+g.eventRects).datum(A?A.values:[]),z=Cj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),jf(z.enter()),z.attr("class",ld).attr("x",wh?0:C).attr("y",wh?C:0).attr("width",wh?gg:D).attr("height",wh?D:ig),z.exit().remove())),Gc(Nf.data.targets).forEach(function(a){Jj[a]=!0})}function rf(){qf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function sf(){if(0!==Lc(Nf.data.targets).length){if("mousemove"===Mf.event.sourceEvent.type&&zj.altDomain)return Dg.domain(zj.altDomain),void zj.scale(Dg).updateScaleExtent();Wi&&Dg.orgDomain()[0]===Hj[0]&&Dg.domain([Hj[0]-1e-10,Dg.orgDomain()[1]]),qf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Mf.event.sourceEvent.type&&($i=!0)}}function tf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function uf(){Aj.attr("width",kg).attr("height",lg),Aj.select("#"+Pi).select("rect").attr("width",gg).attr("height",ig),Aj.select("#"+Qi).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),Aj.select("#"+Ri).select("rect").attr("x",H).attr("y",I).attr("width",N).attr("height",O),Aj.select("."+g.zoomRect).attr("width",gg).attr("height",ig),Gj.style("max-height",lg+"px")}function vf(a){return{axisX:a?hj.x.transition().duration(a):hj.x,axisY:a?hj.y.transition().duration(a):hj.y,axisY2:a?hj.y2.transition().duration(a):hj.y2,axisSubX:a?hj.subx.transition().duration(a):hj.subx}}function wf(a){var b;a=a||{},a.withTransition=Je(a,"withTransition",!0),a.withTransform=Je(a,"withTransform",!1),a.withLegend=Je(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withLegend&&qh||(b=vf(a.withTransitionForAxis?cg:0),p(),V(),uf(),o(a.withTransition,b)),qf(a,b)}function xf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=Cj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",nd),j=i.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Zc),e=Cj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),d=e.enter().append("g").attr("class",pd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",fd).style("cursor",function(a){return eh(a)?"pointer":null}),c=Cj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),b=c.enter().append("g").attr("class",od).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",bd),b.append("g").attr("class",jd),b.append("g").attr("class",function(a){return Xc(g.selectedCircles,a.id)}),b.append("g").attr("class",dd).style("cursor",function(a){return eh(a)?"pointer":null}),a.forEach(function(a){Cj.selectAll("."+g.selectedCircles+rd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Cj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(ug(a)).attr("class",qd),f=h.enter().append("g").attr("class",qd),f.append("g").attr("class",hd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),nh&&(n=Dj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),m=n.enter().append("g").style("opacity",0).attr("class",pd),m.append("g").attr("class",fd),l=Dj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),k=l.enter().append("g").style("opacity",0).attr("class",od),k.append("g").attr("class",bd)),Aj.selectAll("."+g.target).filter(function(a){return Jc(a.id)}).transition().duration(cg).style("opacity",1)}function yf(a,b){b.filter&&(a=a.filter(b.filter)),(b.type||b.types)&&a.forEach(function(a){b.types?fe(a.id,b.types[a.id]):fe(a.id,b.type)}),Nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,z=0,F++)),E[a]=F,D[F]=f,A[a]=z,z+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+v)/10),j=10*Math.ceil((h.height+u)/10),k=nj?j:i,l=nj?U():T();return d&&(z=0,F=0,w=0,x=0),qh&&!Kc(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=i,C[c]=j,(!w||i>=w)&&(w=i),(!x||j>=x)&&(x=j),g=nj?x:w,void(vh?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(l-g*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=26,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=Ej.selectAll("."+g.legendItemFocused).size();b=b||{},n=Je(b,"withTransition",!0),q=Je(b,"withTransitionForTransform",!0),nj?(f=function(a){return w*E[a]},j=function(a){return D[E[a]]+A[a]}):(f=function(a){return D[E[a]]+A[a]},j=function(a){return x*E[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=Ej.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Xc(g.legendItem,a)}).style("visibility",function(a){return Kc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof sh?sh(a):Nf.toggle(a)}).on("mouseover",function(a){Mf.select(this).classed(g.legendItemFocused,!0),aj||Nf.focus(a),"function"==typeof th&&th(a)}).on("mouseout",function(a){Mf.select(this).classed(g.legendItemFocused,!1),aj||Nf.revert(),"function"==typeof uh&&uh(a)}),m.append("text").text(function(a){return d(Rg[a])?Rg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",nj?h:-200).attr("y",nj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",nj?i:-200).attr("y",nj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",cj).attr("x",nj?h:-200).attr("y",nj?-200:j).attr("width",10).attr("height",10),r=Ej.selectAll("text").data(a).text(function(a){return d(Rg[a])?Rg[a]:a}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=Ej.selectAll("rect."+g.legendItemEvent).data(a),(n?s.transition():s).attr("width",function(a){return B[a]}).attr("height",function(a){return C[a]}).attr("x",i).attr("y",l),t=Ej.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",cj).attr("x",f).attr("y",j),Ej.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Jc(a)}).transition().style("opacity",function(a){var b=Mf.select(this);return Jc(a)?!G||b.classed(g.legendItemFocused)?Bf(b):Cf(b):rj}),R(w),S(x),Q(F),p(),V(),uf(),o(q,c)}function If(a){return Ic(Nf.data.targets,a.id)}function Jf(a){return"data"in a&&Ic(Nf.data.targets,a.data.id)}function Kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function Lf(a,b,c){var d=!le(Nf.data.targets);aj=!1,fe(a,b),wf(c||{withTransitionForAxis:d})}var Mf=a.d3?a.d3:a.require?a.require("d3"):void 0,Nf={data:{},axis:{},legend:{}},Of={},Pf=i(["bindto"],"#chart"),Qf=i(["size","width"]),Rf=i(["size","height"]),Sf=i(["padding","left"]),Tf=i(["padding","right"]),Uf=i(["padding","top"]),Vf=i(["padding","bottom"]),Wf=i(["zoom","enabled"],!1),Xf=i(["zoom","extent"]),Yf=i(["zoom","privileged"],!1),Zf=i(["interaction","enabled"],!0),$f=i(["onenter"],function(){}),_f=i(["onleave"],function(){}),ag=i(["onresize"],function(){}),bg=i(["onresized"],function(){}),cg=i(["transition","duration"],350);h("data","data is required in config");var dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg,Kg,Lg,Mg,Ng=i(["data","x"]),Og=i(["data","xs"],{}),Pg=i(["data","x_format"]),Qg=i(["data","id_converter"],function(a){return a}),Rg=i(["data","names"],{}),Sg=i(["data","classes"],{}),Tg=i(["data","groups"],[]),Ug=i(["data","axes"],{}),Vg=i(["data","type"]),Wg=i(["data","types"],{}),Xg=i(["data","labels"],{}),Yg=i(["data","order"]),Zg=i(["data","regions"],{}),$g=i(["data","color"]),_g=i(["data","colors"],{}),ah=i(["data","hide"],!1),bh=i(["data","filter"]),ch=i(["data","selection","enabled"],!1),dh=i(["data","selection","grouped"],!1),eh=i(["data","selection","isselectable"],function(){return!0}),fh=i(["data","selection","multiple"],!0),gh=i(["data","onclick"],function(){}),hh=i(["data","onenter"],function(){}),ih=i(["data","onleave"],function(){}),jh=i(["data","onselected"],function(){}),kh=i(["data","onunselected"],function(){}),lh=i(["data","ondragstart"],function(){}),mh=i(["data","ondragend"],function(){}),nh=i(["subchart","show"],!1),oh=i(["subchart","size","height"],60),ph=i(["color","pattern"],[]),qh=i(["legend","show"],!0),rh=i(["legend","position"],"bottom"),sh=i(["legend","item","onclick"]),th=i(["legend","item","onmouseover"]),uh=i(["legend","item","onmouseout"]),vh=i(["legend","equally"],!1),wh=i(["axis","rotated"],!1),xh=i(["axis","x","show"],!0),yh=i(["axis","x","type"],"indexed"),zh=i(["axis","x","localtime"],!0),Ah=i(["axis","x","categories"],[]),Bh=i(["axis","x","tick","centered"],!1),Ch=i(["axis","x","tick","format"]),Dh=i(["axis","x","tick","culling"],{}),Eh=i(["axis","x","tick","culling","max"],10),Fh=i(["axis","x","tick","count"]),Gh=i(["axis","x","tick","fit"],!0),Hh=i(["axis","x","tick","values"],null),Ih=i(["axis","x","tick","rotate"]),Jh=i(["axis","x","max"],null),Kh=i(["axis","x","min"],null),Lh=i(["axis","x","padding"],{}),Mh=i(["axis","x","height"]),Nh=i(["axis","x","default"]),Oh=i(["axis","x","label"],{}),Ph=i(["axis","y","show"],!0),Qh=i(["axis","y","max"]),Rh=i(["axis","y","min"]),Sh=i(["axis","y","center"]),Th=i(["axis","y","label"],{}),Uh=i(["axis","y","inner"],!1),Vh=i(["axis","y","tick","format"]),Wh=i(["axis","y","padding"]),Xh=i(["axis","y","ticks"],10),Yh=i(["axis","y2","show"],!1),Zh=i(["axis","y2","max"]),$h=i(["axis","y2","min"]),_h=i(["axis","y2","center"]),ai=i(["axis","y2","label"],{}),bi=i(["axis","y2","inner"],!1),ci=i(["axis","y2","tick","format"]),di=i(["axis","y2","padding"]),ei=i(["axis","y2","ticks"],10),fi=i(["grid","x","show"],!1),gi=i(["grid","x","type"],"tick"),hi=i(["grid","x","lines"],[]),ii=i(["grid","y","show"],!1),ji=i(["grid","y","lines"],[]),ki=i(["grid","y","ticks"],10),li=i(["point","show"],!0),mi=i(["point","r"],2.5),ni=i(["point","focus","line","enabled"],!0),oi=i(["point","focus","expand","enabled"],!0),pi=i(["point","focus","expand","r"]),qi=i(["point","focus","select","r"]),ri=i(["line","connect_null"],!1),si=i(["bar","width"]),ti=i(["bar","width","ratio"],.6),ui=i(["pie","label","show"],!0),vi=i(["pie","label","format"]),wi=i(["pie","expand"],!0),xi=i(["pie","onclick"],function(){}),yi=i(["pie","onmouseover"],function(){}),zi=i(["pie","onmouseout"],function(){}),Ai=i(["donut","label","show"],!0),Bi=i(["donut","label","format"]),Ci=i(["donut","expand"],!0),Di=i(["donut","title"],""),Ei=i(["donut","onclick"],function(){}),Fi=i(["donut","onmouseover"],function(){}),Gi=i(["donut","onmouseout"],function(){}),Hi=i(["regions"],[]),Ii=i(["tooltip","show"],!0),Ji=i(["tooltip","format","title"]),Ki=i(["tooltip","format","value"]),Li=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Ji?Ji:b,l=Ki?Ki:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Mi=i(["tooltip","init","show"],!1),Ni=i(["tooltip","init","x"],0),Oi=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Pi=("string"==typeof Pf?Pf.replace(/[# .>~+]/g,""):g.chart+ +new Date)+"-clip",Qi=Pi+"-xaxis",Ri=Pi+"-yaxis",Si=j(Pi),Ti=j(Qi),Ui=j(Ri),Vi="timeseries"===yh,Wi="categorized"===yh,Xi=!Vi&&(Ng||Fe(Og)),Yi=null,Zi=!1,$i=!1,_i=!1,aj=!1,bj=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],cj=ze(_g,Fe(ph)?ph:bj,$g),dj=zh?Mf.time.format:Mf.time.format.utc,ej=dj.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),fj=[],gj=[],hj={},ij=wh?"left":"bottom",jj=wh?Uh?"top":"bottom":Uh?"right":"left",kj=wh?bi?"bottom":"top":bi?"left":"right",lj=wh?"left":"bottom",mj={main:function(){return"translate("+k(dg.left)+","+k(dg.top)+")"},context:function(){return"translate("+k(eg.left)+","+k(eg.top)+")"},legend:function(){return"translate("+fg.left+","+fg.top+")"},x:function(){return"translate(0,"+(wh?0:ig)+")"},y:function(){return"translate(0,"+(wh?ig:0)+")"},y2:function(){return"translate("+(wh?0:gg)+","+(wh?1:0)+")" +},subx:function(){return"translate(0,"+(wh?0:jg)+")"},arc:function(){return"translate("+pg/2+","+qg/2+")"}},nj="right"===rh,oj=0,pj=0,qj=0,rj=.15,sj=30,tj=wh&&!xh?0:30,uj=5;ug=Mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var vj,wj=function(){var a=Mf.svg.line().x(wh?function(a){return $(a.id)(a.value)}:Id).y(wh?Id:function(a){return $(a.id)(a.value)});return ri||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ri?Te(b.values):b.values;return me(b)?(a.interpolate(ne(b)?"cardinal":"linear"),Zg[b.id]?gf(e,Dg,$(b.id),Zg[b.id]):a(e)):(c=e[0]?Dg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,wh?"M "+d+" "+c:"M "+c+" "+d)}}(),xj=function(){var a;return a=wh?Mf.svg.area().x0(function(a){return $(a.id)(0)}).x1(function(a){return $(a.id)(a.value)}).y(Id):Mf.svg.area().x(Id).y0(function(a){return $(a.id)(0)}).y1(function(a){return $(a.id)(a.value)}),function(b){var c,d,e=Te(b.values);return ge([b],"area")||ge([b],"area-spline")?(a.interpolate(ne(b)?"cardinal":"linear"),a(e)):(c=e[0]?Dg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,wh?"M "+d+" "+c:"M "+c+" "+d)}}(),yj=function(){var a=Mf.svg.line().x(wh?function(a){return _(a.id)(a.value)}:Ld).y(wh?Ld:function(a){return _(a.id)(a.value)});return function(b){var c=Te(b.values);return me(b)?a(c):"M "+Gg(c[0].x)+" "+_(b.id)(c[0].value)}}(),zj=function(){};vj=Mf.svg.brush().on("brush",rf),vj.update=function(){return Dj&&Dj.select("."+g.brush).call(this),this},vj.scale=function(a){return wh?this.y(a):this.x(a)},Wf&&(zj=Mf.behavior.zoom().on("zoomstart",function(){zj.altDomain=Mf.event.sourceEvent.altKey?Dg.orgDomain():null}).on("zoom",Wf?sf:null),zj.scale=function(a){return wh?this.y(a):this.x(a)},zj.orgScaleExtent=function(){var a=Xf?Xf:[1,10];return[a[0],Math.max(Dc()/a[1],a[1])]},zj.updateScaleExtent=function(){var a=ec(Dg.orgDomain())/ec(Hj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Aj,Bj,Cj,Dj,Ej,Fj,Gj,Hj,Ij,Jj={};if(Nf.focus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);Nf.revert(),Nf.defocus(),b(d.classed(g.focused,!0)),b(e),le(Nf.data.targets)&&Rb(a,!0),Df(a,!0)},Nf.defocus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",.3)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);Nf.revert(),b(d.classed(g.focused,!1)),b(e),le(Nf.data.targets)&&Sb(a),Df(a,!1)},Nf.revert=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);b(d.classed(g.focused,!1)),b(e),le(Nf.data.targets)&&Sb(a),Ef()},Nf.show=function(a,b){a=Hc(a),b=b||{},Pc(a),Aj.selectAll(td(a)).transition().style("opacity",1),b.withLegend&&Ff(a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Nf.hide=function(a,b){a=Hc(a),b=b||{},Oc(a),Aj.selectAll(td(a)).transition().style("opacity",0),b.withLegend&&Gf(a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Nf.toggle=function(a){Jc(a)?Nf.hide(a):Nf.show(a)},Nf.unzoom=function(){vj.clear().update(),qf({withUpdateXDomain:!0})},Nf.load=function(a){return a.xs&&rc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Sg[b]=a.classes[b]}),"categories"in a&&Wi&&(Ah=a.categories,Jg.categories(Ah)),"cacheIds"in a&&fc(a.cacheIds)?void yf(hc(a.cacheIds),a.done):void("unload"in a?Af(Hc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){zf(a)}):zf(a))},Nf.unload=function(a,b){Af(Hc(a),function(){qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Nf.selected=function(a){return Mf.merge(Cj.selectAll("."+g.shapes+rd(a)).selectAll("."+g.shape).filter(function(){return Mf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Nf.select=function(a,b,c){ch&&Cj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Mf.select(this),i=e.data?e.data.id:e.id,j=Se(this),k=dh||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);"path"!==this.nodeName&&(k&&l?eh(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},Nf.unselect=function(a,b){ch&&Cj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Mf.select(this),f=c.data?c.data.id:c.id,h=Se(this),i=dh||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);"path"!==this.nodeName&&i&&j&&eh(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Nf.toLine=function(a){Lf(a,"line")},Nf.toSpline=function(a){Lf(a,"spline")},Nf.toBar=function(a){Lf(a,"bar")},Nf.toScatter=function(a){Lf(a,"scatter")},Nf.toArea=function(a){Lf(a,"area")},Nf.toAreaSpline=function(a){Lf(a,"area-spline")},Nf.toPie=function(a){Lf(a,"pie",{withTransform:!0})},Nf.toDonut=function(a){Lf(a,"donut",{withTransform:!0})},Nf.groups=function(a){return c(a)?Tg:(Tg=a,qf(),Tg)},Nf.xgrids=function(a){return a?(hi=a,qf(),hi):hi},Nf.xgrids.add=function(a){return a?Nf.xgrids(hi.concat(a)):void 0},Nf.xgrids.remove=function(a){var b=Kf(a);return Nf.xgrids(hi.filter(b))},Nf.ygrids=function(a){return a?(ji=a,qf(),ji):ji},Nf.ygrids.add=function(a){return a?Nf.ygrids(ji.concat(a)):void 0},Nf.ygrids.remove=function(a){var b=Kf(a);return Nf.ygrids(ji.filter(b))},Nf.regions=function(a){return a?(Hi=a,qf(),Hi):Hi},Nf.regions.add=function(a){return a?(Hi=Hi.concat(a),qf(),Hi):Hi},Nf.regions.remove=function(a){var b,c,d;return a=a||{},b=Je(a,"duration",cg),c=Je(a,"classes",[g.region]),d=Cj.select("."+g.regions).selectAll(c.map(function(a){return"."+a})),(b?d.transition().duration(b):d).style("opacity",0).remove(),Hi=Hi.filter(function(a){return c.indexOf(a.class)<0})},Nf.data.get=function(a){var b=Nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Nf.data.getAsTarget=function(a){var b=Nf.data.targets.filter(function(b){return b.id===a});return b.length>0?b[0]:void 0},Nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Rg[b]=a[b]}),qf({withLegend:!0}),Rg):Rg},Nf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){_g[b]=a[b]}),qf({withLegend:!0}),_g):_g},Nf.x=function(a){return arguments.length&&(uc(Nf.data.targets,a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Nf.data.xs},Nf.xs=function(a){return arguments.length&&(vc(Nf.data.targets,a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Nf.data.xs},Nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){gb(b,a[b])}),Ib())},Nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Jh=+a.x),b(a.y)&&(Qh=+a.y),b(a.y2)&&(Zh=+a.y2)):Qh=Zh=+a,qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Kh=+a.x),b(a.y)&&(Rh=+a.y),b(a.y2)&&($h=+a.y2)):Rh=$h=+a,qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Nf.axis.max(a.max),"undefined"!=typeof a.min&&Nf.axis.min(a.min))},Nf.legend.show=function(a){Ff(Hc(a)),qf({withLegend:!0})},Nf.legend.hide=function(a){Gf(Hc(a)),qf({withLegend:!0})},Nf.resize=function(a){Qf=a?a.width:null,Rf=a?a.height:null,wf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Nf.destroy=function(){Nf.data.targets=void 0,Nf.data.xs={},Gj.html(""),a.onresize=null},"url"in f.data)Mf.xhr(f.data.url,function(a,b){var c,d=Mf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Mf.csv.parse(b.response),hf(c)});else if("rows"in f.data)hf(xc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");hf(yc(f.data.columns))}return Nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(window); \ No newline at end of file From 262672f992fbf53da6a2e98b9dae83403cd2b8e0 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Sat, 10 May 2014 10:20:53 +0900 Subject: [PATCH 162/178] Fix clip on ie9 - #134 --- c3.js | 3 ++- c3.min.js | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/c3.js b/c3.js index ec7e3d8..da36b3c 100644 --- a/c3.js +++ b/c3.js @@ -350,7 +350,8 @@ /*-- Define Functions --*/ function getClipPath(id) { - return "url(" + document.URL.split('#')[0] + "#" + id + ")"; + var isIE9 = window.navigator.appVersion.toLowerCase().indexOf("msie 9.") >= 0; + return "url(" + (isIE9 ? "" : document.URL.split('#')[0]) + "#" + id + ")"; } function asHalfPixel(n) { diff --git a/c3.min.js b/c3.min.js index 602e805..6a08423 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.round(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.round(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&agg&&(gg=0),0>ig&&(ig=0),hg=wh?dg.left-sj-tj:gg,jg=wh?ig:lg-eg.top-eg.bottom,0>hg&&(hg=0),0>jg&&(jg=0),pg=gg-(nj?b+10:0),qg=ig-(nj?0:10),r(),nj&&d&&(fg.left=pg/2+1.1*ng)}function q(){Cj.select("line."+g.xgridFocus).attr("x1",wh?0:-10).attr("x2",wh?gg:-10).attr("y1",wh?-10:dg.top).attr("y2",wh?-10:ig)}function r(){ng=Math.min(pg,qg)/2,mg=.95*ng,og=ke(Nf.data.targets)?.6*mg:0}function s(){var a=wh?g.axisX:g.axisY,b=Cj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Gj.node().getBoundingClientRect(),e=le(Nf.data.targets),f=c.right-d.left-(e?0:x());return f>0?f:0}function t(){return Qf?Qf:B()}function u(){var a=Rf?Rf:C();return a>0?a:320}function v(){return Uf?Uf:0}function w(){return Vf?Vf:0}function x(){return Sf?Sf:wh?xh?Ke(z("x")):1:!Ph||Uh?1:Ke(z("y"))}function y(){var a=10,b=nj?T()+20:0;return Tf?Tf:wh?a+b:(!Yh||bi?a:Ke(z("y2")))+b}function z(a){var b=ob(a);return b.isInner?20+Hb(a):40+Hb(a)}function A(a){return"x"!==a||xh?"x"===a&&Mh?Mh:"y"!==a||Ph?"y2"!==a||Yh?(ob(a).isInner?30:40)+("y2"===a?-10:0):uj:qh&&!nj?10:1:0}function B(){return+Gj.style("width").replace("px","")}function C(){return+Gj.style("height").replace("px","")}function D(a){return a?-31:-(dg.left-1)}function E(a){return a?-20:-4}function F(){return D(!wh)}function G(){return E(!wh)}function H(){return D(wh)}function I(){return E(wh)}function J(a){return a?gg+2+30+30:dg.left+20}function K(a){return a?(Mh?Mh:0)+80:ig+8}function L(){return J(!wh)}function M(){return K(!wh)}function N(){return J(wh)}function O(){return K(wh)}function P(){var a,b,c,d,e,f=Ec(Nf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=Dg(b.x)-Dg(a.x),0===c?wh?ig:gg:(d=Dc(),e=he(Nf.data.targets)?(d-(Wi?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function Q(a){oj=a}function R(a){pj=a}function S(a){qj=a}function T(){return qh?nj?pj*(oj+1):kg:0}function U(){return qh?nj?lg:qj*(oj+1):0}function V(){var a,b,c=!Dg;vg=wh?1:0,wg=wh?ig:gg,xg=wh?0:ig,yg=wh?gg:1,zg=vg,Ag=wg,Bg=wh?0:jg,Cg=wh?hg:1,Dg=Y(vg,wg,c?void 0:Dg.domain(),function(){return Jg.tickOffset()}),Eg=Z(xg,yg,c?void 0:Eg.domain()),Fg=Z(xg,yg,c?void 0:Fg.domain()),Gg=Y(vg,wg,Hj,function(a){return a%1?0:Mg.tickOffset()}),Hg=Z(Bg,Cg,c?void 0:Hg.domain()),Ig=Z(Bg,Cg,c?void 0:Ig.domain()),a=db(),b=Hh?Hh:c?void 0:Jg.tickValues(),Jg=ab(Dg,ij,a,b),Mg=ab(Gg,lj,a,b),Kg=bb(Eg,jj,Vh,Xh),Lg=bb(Fg,kj,ci,ei),c||(vj.scale(Gg),Wf&&zj.scale(Dg)),W()}function W(){rg=Kb(),sg=Lb(),tg=Lb(.98)}function X(a,b,c){return(c?Mf.time.scale():Mf.scale.linear()).range([a,b])}function Y(a,b,c,d){var e,f=X(a,b,Vi),g=c?f.domain(c):f;Wi?(d=d||function(){return 0},f=function(a,b){var c=g(a)+d(a);return b?c:Math.ceil(c)}):f=function(a,b){var c=g(a);return b?c:Math.ceil(c)};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return Hj&&Hj[0]===a[0]&&Hj[1]a?a.toFixed(0):a};return Ch&&("function"==typeof Ch?a=Ch:Vi&&(a=function(a){return a?dj(Ch)(a):""})),a}function eb(a){var b;return"y"===a?b=Th:"y2"===a?b=ai:"x"===a&&(b=Oh),b}function fb(a){var b=eb(a);return"string"==typeof b?b:b?b.text:null}function gb(a,b){var c=eb(a);"string"==typeof c?"y"===a?Th=b:"y2"===a?ai=b:"x"===a&&(Oh=b):c&&(c.text=b)}function hb(a){return 10*Math.sin(Math.PI*(a/180))}function ib(a){return 11.5-2.5*(a/15)}function jb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",ib(c)).attr("x",hb(c)).attr("transform","rotate("+c+")")}function kb(a,b){var c=eb(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 lb(){return kb("x",wh?"inner-top":"inner-right")}function mb(){return kb("y",wh?"inner-right":"inner-top")}function nb(){return kb("y2",wh?"inner-right":"inner-top")}function ob(a){return"y2"===a?nb():"y"===a?mb():lb()}function pb(){return fb("x")}function qb(){return fb("y")}function rb(){return fb("y2")}function sb(a,b){return a?b.isLeft?0:b.isCenter?gg/2:gg:b.isBottom?-ig:b.isMiddle?-ig/2:0}function tb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function ub(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function vb(){return sb(!wh,lb())}function wb(){return sb(wh,mb())}function xb(){return sb(wh,nb())}function yb(){return tb(!wh,lb())}function zb(){return tb(wh,mb())}function Ab(){return tb(wh,nb())}function Bb(){var a=lb();return wh?a.isInner?"1.2em":-25-Hb("x"):a.isInner?"-0.5em":Mh?Mh-10:"3em"}function Cb(){var a=mb();return wh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Hb("y")}function Db(){var a=nb();return wh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Hb("y2")}function Eb(){return ub(!wh,lb())}function Fb(){return ub(wh,mb())}function Gb(){return ub(wh,nb())}function Hb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Ib(a){var b=Cj.select("."+g.axisX+" ."+g.axisXLabel),c=Cj.select("."+g.axisY+" ."+g.axisYLabel),d=Cj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",vb).attr("dx",yb).attr("dy",Bb).text(pb),(a?c.transition():c).attr("x",wb).attr("dx",zb).attr("dy",Cb).attr("dy",Cb).text(qb),(a?d.transition():d).attr("x",xb).attr("dx",Ab).attr("dy",Db).text(rb)}function Jb(a){var b=!1;return ug(Lc(Nf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Kb(){var a=Mf.svg.arc().outerRadius(mg).innerRadius(og),b=function(b,c){var d;return c?a(b):(d=Jb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Lb(a){var b=Mf.svg.arc().outerRadius(ng*(a?a:1)).innerRadius(og);return function(a){var c=Jb(a);return c?b(c):"M 0 0"}}function Mb(a,b){return se(a.data)?rg(a,b):"M 0 0"}function Nb(a){var b,c,d,e,f=Jb(a),g="";return f&&(b=rg.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*mg*.8+","+d/e*mg*.8+")"),g}function Ob(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Pb(a){return tc({id:a.data.id,value:a.value,ratio:Ob(a)})}function Qb(a){var b,c,d,e;return Tb()?(b=Jb(a),c=b?b.value:null,d=Ob(b),e=Ub(),e?e(c,d):Gd(c,d)):""}function Rb(a,b){var c=Aj.selectAll("."+g.chartArc+sd(a)),d=Aj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});ye(a)&&c.selectAll("path").transition().duration(50).attr("d",sg).transition().duration(100).attr("d",tg).each(function(a){re(a.data)}),b||d.style("opacity",.3)}function Sb(a){var b=Aj.selectAll("."+g.chartArc+sd(a));b.selectAll("path").transition().duration(50).attr("d",rg),Aj.selectAll("."+g.arc).style("opacity",1)}function Tb(){return ke(Nf.data.targets)?Ai:ui}function Ub(){return ke(Nf.data.targets)?Bi:vi}function Vb(){return ke(Nf.data.targets)?Di:""}function Wb(){var a=ke(Nf.data.targets)?Ei:xi;return"function"==typeof a?a:function(){}}function Xb(){var a=ke(Nf.data.targets)?Fi:yi;return"function"==typeof a?a:function(){}}function Yb(){var a=ke(Nf.data.targets)?Gi:zi;return"function"==typeof a?a:function(){}}function Zb(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Tg.length>0)for(g=Uc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return Mf.min(Object.keys(i).map(function(a){return Mf.min(i[a])}))}function $b(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Tg.length>0)for(g=Vc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return Mf.max(Object.keys(i).map(function(a){return Mf.max(i[a])}))}function _b(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return cb(a.id)===c}),m="y2"===c?$h:Rh,n="y2"===c?Zh:Qh,o=b(m)?m:Zb(l),p=b(n)?n:$b(l),q="y2"===c?_h:Sh,r=Ad()&&wh;return 0===l.length?"y2"===c?Fg.domain():Eg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=Bd(o,p),j=ec(Eg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Wh&&(f=b(Wh.top)?Wh.top:e,g=b(Wh.bottom)?Wh.bottom:e),"y2"===c&&di&&(f=b(di.top)?di.top:e,g=b(di.bottom)?di.bottom:e),he(l)&&!Uc(l)&&(g=o),[o-g,p+f])}function ac(a){return Kh?Vi?Ae(Kh):Kh:Mf.min(a,function(a){return Mf.min(a.values,function(a){return a.x})})}function bc(a){return Jh?Vi?Ae(Jh):Jh:Mf.max(a,function(a){return Mf.max(a.values,function(a){return a.x})})}function cc(a){var c,d,e,f,g=Fc(a),h=g[1]-g[0];return Wi?d=0:he(a)?(c=Dc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Lh&&Fe(Lh)?(e=b(Lh.left)?Lh.left:d,f=b(Lh.right)?Lh.right:d):e=f="number"==typeof Lh?Lh:d,{left:e,right:f}}function dc(a){var b=[ac(a),bc(a)],c=b[0],d=b[1],e=cc(a),f=0,g=0;return c-d!==0||Wi||(c=Vi?new Date(.5*c.getTime()):-.5,d=Vi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ec(a){return a[1]-a[0]}function fc(a){for(var b=0;bb?0:b-c}function lc(a){var b,c=jc(a),d="y"===a.axis?Eg:Fg;return b="y"===a.axis||"y2"===a.axis?wh?ig:"start"in a?d(a.start):ig:wh?"end"in a?Dg(Vi?Ae(a.end):a.end):ig:ig,c>b?0:b-c}function mc(a){return Ng&&a===Ng||Fe(Og)&&Ge(Og,a)}function nc(a){return!mc(a)}function oc(a){return Ng?Ng:Fe(Og)?Og[a]:null}function pc(a,b){var c,d=b&&Fe(b)?Gc(b):[];return d.forEach(function(b){oc(b)===a&&(c=Nf.data.xs[b])}),c}function qc(a,b){return a in Nf.data.xs&&Nf.data.xs[a]&&Nf.data.xs[a][b]?Nf.data.xs[a][b]:b}function rc(a){Object.keys(a).forEach(function(b){Og[b]=a[b]})}function sc(a){return 1===Mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function tc(a){var b;return a&&(b=Rg[a.id],a.name=b?b:a.id),a}function uc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=wc(b[d],a.id,d)}),Nf.data.xs[a.id]=b})}function vc(a,b){a.forEach(function(a){b[a.id]&&uc([a],b[a.id])})}function wc(a,c,d){var e;return e=Vi?a?a instanceof Date?a:Ae(a):Ae(qc(c,d)):Xi&&!Wi?b(a)?+a:qc(c,d):d}function xc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Ng?(d=Object.keys(Nf.data.xs),Nf.data.xs[c]=d.length>0?Nf.data.xs[d[0]]:void 0):Fe(Og)&&(Nf.data.xs[c]=pc(f,Nf.data.targets)):Nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Qg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=oc(b),g=a[f],h=wc(g,b,e);return Xi&&Wi&&0===c&&g&&(0===e&&(Ah=[]),Ah.push(g)),("undefined"==typeof a[b]||Nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Vg&&fe(Gc(c).filter(function(a){return!(a in Wg)}),Vg),c.forEach(function(a){gc(a.id_org,a)}),c}function Ac(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 Bc(a){return a>0&&Nf.data.targets[0].values[a-1]?Nf.data.targets[0].values[a-1].x:void 0}function Cc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Fc(a){var b,c,d=Ec(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Gc(a){return a.map(function(a){return a.id})}function Hc(a){return a?"string"==typeof a?[a]:a:Gc(Nf.data.targets)}function Ic(a,b){var c,d=Gc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Vi?new Date(i):i);j.push(e)}return Vi||(j=j.sort(function(a,b){return a-b})),j}function Oc(a){fj=fj.concat(a)}function Pc(a){fj=fj.filter(function(b){return a.indexOf(b)<0})}function Qc(a){gj=gj.concat(a)}function Rc(a){gj=gj.filter(function(b){return a.indexOf(b)<0})}function Sc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Tc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Vc(a){return Tc(a,function(a){return a>0})}function Wc(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||0===a[f].x)&&(e=e.concat(Md(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Md(a,g))),Pd(e,b)):Nd(a,b,f,g)}function Od(a,b){var c;return c=a.map(function(a){return Nd(a.values,b)}),Pd(c,b)}function Pd(a,b){var c,d;return a.forEach(function(a){var e=He(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Qd(a,b){return Mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Rd(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 Sd(){return Yg&&"desc"===Yg.toLowerCase()}function Td(){return Yg&&"asc"===Yg.toLowerCase()}function Ud(a){var b=Td(),c=Sd();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 Yg&&a.sort(Yg),a}function Vd(a,c){var d,e,f,g,h,i,j,k=le(Nf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&Ii&&(Fj.html(Li(a,db(),Cd(k),cj)).style("display","block"),d=Fj.property("offsetWidth"),e=Fj.property("offsetHeight"),k?(g=gg/2+c[0],i=ig/2+c[1]+20):(wh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-y(),i=Dg(l[0].x)+20):(f=s(),g=f+x()+Dg(l[0].x)+20,h=g+d,j=f+t()-y(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),Fj.style("top",i+"px").style("left",g+"px"))}function Wd(){Fj.style("display","none")}function Xd(a){var c=a.filter(function(a){return a&&b(a.value)});if(Ii&&!ie(Nf.data.targets)&&!le(Nf.data.targets)){var d=Cj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(wh?"y1":"x1",Id).attr(wh?"y2":"x2",Id),pf(d,"grid")}}function Yd(){Cj.select("line."+g.xgridFocus).style("visibility","hidden")}function Zd(a,b){var c,d,e,f,h=[],i=Cj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=dc(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function $d(a){return a.x||0===a.x?Dg(a.x):null}function _d(a){return $(a.id)(a.value)}function ae(){var a,b,d={},e=0;return Lc(Nf.data.targets.filter(oe)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ee(a,b){return"number"==typeof si?si:b?2*a.tickOffset()*ti/b:0}function fe(a,b){Hc(a).forEach(function(a){Jj[a]=b===Wg[a],Wg[a]=b})}function ge(a,b){var c=!1;return a.forEach(function(a){Wg[a.id]===b&&(c=!0),a.id in Wg||"line"!==b||(c=!0)}),c}function he(a){return ge(a,"bar")}function ie(a){return ge(a,"scatter")}function je(a){return ge(a,"pie")}function ke(a){return ge(a,"donut")}function le(a){return je(a)||ke(a)}function me(a){var b="string"==typeof a?a:a.id;return!(b in Wg)||"line"===Wg[b]||"spline"===Wg[b]||"area"===Wg[b]||"area-spline"===Wg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"spline"===Wg[b]||"area-spline"===Wg[b]}function oe(a){var b="string"==typeof a?a:a.id;return"bar"===Wg[b]}function pe(a){var b="string"==typeof a?a:a.id;return"scatter"===Wg[b]}function qe(a){var b="string"==typeof a?a:a.id;return"pie"===Wg[b]}function re(a){var b="string"==typeof a?a:a.id;return"donut"===Wg[b]}function se(a){return qe(a)||re(a)}function te(a){return me(a)?[a]:[]}function ue(a){return se(a.data)?[a]:[]}function ve(a){return oe(a)?a.values:[]}function we(a){return me(a)||pe(a)?a.values:[]}function xe(a){return oe(a)||me(a)?a.values:[]}function ye(a){return re(a)&&Ci||qe(a)&&wi}function ze(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function Ae(b){var c;try{c=Pg?Mf.time.format(Pg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Pg)}return c}function Be(a,b){var c=Mf.mouse(a),d=Mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ge(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function He(a,b){var c="y"===cb(a.id)?Eg:Fg,d=wh?1:0,e=wh?0:1;return Math.pow(Dg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ie(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Je(a,b,c){return d(a[b])?a[b]:c}function Ke(a){return 10*Math.ceil(a/10)}function Le(a,b,c){jh(b,a.node()),Cj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Xc(g.selectedCircle,c)}).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d).attr("stroke",function(){return cj(b)}).attr("r",1.4*We(b)).transition().duration(100).attr("r",We)}function Me(a,b,c){kh(b,a.node()),Cj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ne(a,b,c,d){a?Le(b,c,d):Me(b,c,d)}function Oe(a,b){jh(b,a.node()),a.transition().duration(100).style("fill",function(){return Mf.rgb(cj(b)).brighter(.75)})}function Pe(a,b){kh(b,a.node()),a.transition().duration(100).style("fill",function(){return cj(b)})}function Qe(a,b,c,d){a?Oe(b,c,d):Pe(b,c,d)}function Re(a,b,c,d){Qe(a,b,c.data,d)}function Se(a){return"circle"===a.nodeName?Ne:Mf.select(a).classed(g.bar)?Qe:Re}function Te(a){return a.filter(function(a){return b(a.value)})}function Ue(a){return li?"function"==typeof mi?mi(a):mi:0}function Ve(a){return oi?pi?pi:1.75*Ue(a):Ue(a)}function We(a){return qi?qi:4*Ue(a)}function Xe(a,c){return(c?Cj.selectAll("."+g.circles+rd(c)):Cj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ye(a,b){Xe(a,b).classed(g.EXPANDED,!0).attr("r",Ve)}function Ze(a){Xe(a).filter(function(){return Mf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Ue)}function $e(a){return Cj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function _e(a){$e(a).classed(g.EXPANDED,!0)}function af(a){$e(a).classed(g.EXPANDED,!1)}function bf(a,b){var c=ff(a,b);return function(a,b){var d=c(a,b),e=wh?1:0,f=wh?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 cf(a,b){var c=ff(a,!1),d=b?df:ef;return function(a,b){return d(c(a,b),a,this)}}function df(a,b){var c;return wh?(c=oe(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function ef(a,b,c){var d=c.getBoundingClientRect();return wh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:oe(b)?-3:-6)}function ff(a,b){var c=a.__max__+1,d=ee(Jg,c),e=be(d,c,a,!!b),f=ce(!!b),g=de(a,!!b),h=b?_:$;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return wh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function gf(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function hf(b){var c,d,e;if(Gj=Mf.select(Pf),Gj.empty())throw new Error("Element to bind not found");if(Gj.html("").classed("c3",!0),Nf.data.xs={},Nf.data.targets=zc(b),bh&&(Nf.data.targets=Nf.data.targets.filter(bh)),ah&&Oc(ah===!0?Gc(Nf.data.targets):ah),p(),V(),Dg.domain(Mf.extent(dc(Nf.data.targets))),Eg.domain(_b(Nf.data.targets,"y")),Fg.domain(_b(Nf.data.targets,"y2")),Gg.domain(Dg.domain()),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Hj=Dg.domain(),vj.scale(Gg),Wf&&zj.scale(Dg),Aj=Gj.append("svg").on("mouseenter",$f).on("mouseleave",_f),Bj=Aj.append("defs"),Bj.append("clipPath").attr("id",Pi).append("rect"),Bj.append("clipPath").attr("id",Qi).append("rect"),Bj.append("clipPath").attr("id",Ri).append("rect"),uf(),Cj=Aj.append("g").attr("transform",mj.main),Dj=Aj.append("g").attr("transform",mj.context),Ej=Aj.append("g").attr("transform",mj.legend),nh||Dj.style("visibility","hidden"),qh||(Ej.style("visibility","hidden"),gj=Gc(Nf.data.targets)),Fj=Gj.style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Hf(Gc(Nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=Cj.append("g").attr("clip-path",Si).attr("class",g.grid),fi&&d.append("g").attr("class",g.xgrids),Fe(hi)&&d.append("g").attr("class",g.xgridLines),ni&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),ii&&d.append("g").attr("class",g.ygrids),Fe(ji)&&d.append("g").attr("class",g.ygridLines),Cj.append("g").attr("clip-path",Si).attr("class",g.regions),Cj.append("g").attr("clip-path",Si).attr("class",g.chart),c=Cj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Wf?wh?"ns-resize":"ew-resize":null),Cj.select("."+g.chart).append("g").attr("class",g.chartBars),Cj.select("."+g.chart).append("g").attr("class",g.chartLines),Cj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",mj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Vb()),Cj.select("."+g.chart).append("g").attr("class",g.chartTexts),Wf&&Cj.insert("rect",Yf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",gg).attr("height",ig).style("opacity",0).style("cursor",wh?"ns-resize":"ew-resize").call(zj).on("dblclick.zoom",null),Nh&&vj.extent("function"!=typeof Nh?Nh:Nh(dc())),hj.x=Cj.append("g").attr("class",g.axisX).attr("clip-path",Ti).attr("transform",mj.x).style("visibility",xh?"visible":"hidden"),hj.x.append("text").attr("class",g.axisXLabel).attr("transform",wh?"rotate(-90)":"").style("text-anchor",Eb),hj.y=Cj.append("g").attr("class",g.axisY).attr("clip-path",Ui).attr("transform",mj.y).style("visibility",Ph?"visible":"hidden"),hj.y.append("text").attr("class",g.axisYLabel).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Fb),hj.y2=Cj.append("g").attr("class",g.axisY2).attr("transform",mj.y2).style("visibility",Yh?"visible":"hidden"),hj.y2.append("text").attr("class",g.axisY2Label).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Gb),Dj.append("g").attr("clip-path",Si).attr("class",g.chart),Dj.select("."+g.chart).append("g").attr("class",g.chartBars),Dj.select("."+g.chart).append("g").attr("class",g.chartLines),Dj.append("g").attr("clip-path",Si).attr("class",g.brush).call(vj).selectAll("rect").attr(wh?"width":"height",wh?hg:jg),hj.subx=Dj.append("g").attr("class",g.axisX).attr("transform",mj.subx).attr("clip-path",wh?"":Ti),xf(Nf.data.targets),qf({withUpdateTranslate:!0,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Mi){if(Vi&&"string"==typeof Ni){for(Ni=Ae(Ni),e=0;e0){d=[];for(var f in Rg)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Rd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Qe,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function nf(a){le(Nf.data.targets)||ch&&(Yi=a,Cj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Zi=!0,lh())}function of(){le(Nf.data.targets)||ch&&(Cj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),Cj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Zi=!1,mh())}function pf(a,b){"grid"===b&&a.each(function(){var a=Mf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function qf(a,c){var d,e,f,h,i,j,k,l,m,n,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,Q,R,S,T,U,W,X,Y,Z,$=ae(),_=le(Nf.data.targets),ab=Lc(Nf.data.targets);if(a=a||{},E=Je(a,"withY",!0),F=Je(a,"withSubchart",!0),G=Je(a,"withTransition",!0),J=Je(a,"withTransform",!1),K=Je(a,"withUpdateXDomain",!1),L=Je(a,"withUpdateOrgXDomain",!1),N=Je(a,"withUpdateTranslate",!1),M=Je(a,"withLegend",!1),H=Je(a,"withTransitionForExit",G),I=Je(a,"withTransitionForAxis",G),T=G?cg:0,U=H?T:0,W=I?T:0,c=c||vf(W),M&&qh&&Hf(Gc(Nf.data.targets),a,c),Wi&&0===ab.length&&Dg.domain([0,hj.x.selectAll(".tick").size()]),ab.length&&(L&&(Dg.domain(Mf.extent(dc(ab))),Hj=Dg.domain(),Wf&&zj.scale(Dg).updateScaleExtent(),Gg.domain(Dg.domain()),vj.scale(Gg)),K&&(Dg.domain(vj.empty()?Hj:vj.extent()),Wf&&zj.scale(Dg).updateScaleExtent()),Hh||!Gh&&!Fh||(X=Nc(Mc(ab),Fh),Jg.tickValues(X),Mg.tickValues(X))),Eg.domain(_b(ab,"y")),Fg.domain(_b(ab,"y2")),hj.x.style("opacity",_?0:1),hj.y.style("opacity",_?0:1),hj.y2.style("opacity",_?0:1),hj.subx.style("opacity",_?0:1),c.axisX.call(Jg),c.axisY.call(Kg),c.axisY2.call(Lg),c.axisSubX.call(Mg),Ib(G),N&&(p(),V(),uf(),o(!1),hj.x.call(Jg),hj.y.call(Kg),hj.y2.call(Lg),hj.subx.call(Mg)),K&&ab.length)if(Dh&&X){for(Y=1;Y=0&&Mf.select(this).style("display",b%Z?"none":"block")})}else Aj.selectAll("."+g.axisX+" .tick text").style("display","block");!wh&&Ih&&jb(hj.x,c.axisX,Ih),O=bf($),R=cf($,!0),S=cf($,!1),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Fj.style("display","none"),q(),Cj.select("line."+g.xgridFocus).style("visibility","hidden"),fi&&(f=Zd(gi,Dg),B=Wi?Jg.tickOffset():0,e=wh?{x1:0,x2:gg,y1:function(a){return Dg(a)-B},y2:function(a){return Dg(a)-B}}:{x1:function(a){return Dg(a)+B},x2:function(a){return Dg(a)+B},y1:dg.top,y2:ig},d=Cj.select("."+g.xgrids).selectAll("."+g.xgrid).data(f),d.enter().append("line").attr("class",g.xgrid),d.attr(e).style("opacity",function(){return+Mf.select(this).attr(wh?"y1":"x1")===(wh?ig:0)?0:1}),d.exit().remove()),Fe(hi)&&(h=Cj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(hi),i=h.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),i.append("line").style("opacity",0),i.append("text").attr("text-anchor","end").attr("transform",wh?"":"rotate(-90)").attr("dx",wh?0:-dg.top).attr("dy",-5).style("opacity",0),h.select("line").transition().duration(T).attr("x1",wh?0:Jd).attr("x2",wh?gg:Jd).attr("y1",wh?Jd:dg.top).attr("y2",wh?Jd:ig).style("opacity",1),h.select("text").transition().duration(T).attr("x",wh?gg:0).attr("y",Jd).text(function(a){return a.text}).style("opacity",1),h.exit().transition().duration(T).style("opacity",0).remove()),E&&ii&&(j=Cj.select("."+g.ygrids).selectAll("."+g.ygrid).data(Eg.ticks(ki)),j.enter().append("line").attr("class",g.ygrid),j.attr("x1",wh?Eg:0).attr("x2",wh?Eg:gg).attr("y1",wh?0:Eg).attr("y2",wh?ig:Eg),j.exit().remove(),pf(j,"grid")),E&&Fe(ji)&&(k=Cj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(ji),l=k.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",wh?"rotate(-90)":"").attr("dx",wh?0:-dg.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",wh?Kd:0).attr("x2",wh?Kd:gg).attr("y1",wh?0:Kd).attr("y2",wh?ig:Kd).style("opacity",1),k.select("text").transition().duration(T).attr("x",wh?0:gg).attr("y",Kd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),u=Cj.select("."+g.regions).selectAll("."+g.region).data(Hi),u.enter().append("g").attr("class",kd).append("rect").style("fill-opacity",0),u.selectAll("rect").transition().duration(T).attr("x",ic).attr("y",jc).attr("width",kc).attr("height",lc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),u.exit().transition().duration(T).style("opacity",0).remove(),s=Cj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),s.enter().append("path").attr("class",ed).style("stroke","none").style("fill",cj),s.style("opacity",wd).transition().duration(T).attr("d",O).style("fill",cj).style("opacity",1),s.exit().transition().duration(U).style("opacity",0).remove(),m=Cj.selectAll("."+g.lines).selectAll("."+g.line).data(te),m.enter().append("path").attr("class",ad).style("stroke",cj),m.style("opacity",wd).transition().duration(T).attr("d",wj).style("stroke",cj).style("opacity",1),m.exit().transition().duration(U).style("opacity",0).remove(),n=Cj.selectAll("."+g.areas).selectAll("."+g.area).data(te),n.enter().append("path").attr("class",id).style("fill",cj).style("opacity",function(){return Ij=+Mf.select(this).style("opacity"),0}),n.style("opacity",0).transition().duration(T).attr("d",xj).style("fill",cj).style("opacity",Ij),n.exit().transition().duration(U).style("opacity",0).remove(),r=Cj.selectAll("."+g.circles).selectAll("."+g.circle).data(we),r.enter().append("circle").attr("class",cd).attr("r",Ue).style("fill",cj),r.style("opacity",wd).transition().duration(T).style("opacity",yd).style("fill",cj).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d),r.exit().remove(),v=Cj.selectAll("."+g.texts).selectAll("."+g.text).data(xe),v.enter().append("text").attr("class",Yc).attr("text-anchor",function(a){return wh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",cj).style("fill-opacity",0),v.text(function(a){return Hd(a.id)(a.value,a.id)}).style("fill-opacity",xd).transition().duration(T).attr("x",R).attr("y",S).style("fill",cj).style("fill-opacity",zd),v.exit().transition().duration(U).style("fill-opacity",0).remove(),t=Cj.selectAll("."+g.arcs).selectAll("."+g.arc).data(ue),t.enter().append("path").attr("class",gd).style("fill",function(a){return cj(a.data)}).style("cursor",function(a){return eh(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;aj||(c=Jb(a),d=Pb(c),e=Xb(),Rb(c.data.id),Df(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Jb(a),c=Pb(b),d=[c];Vd(d,Mf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;aj||(c=Jb(a),d=Pb(c),e=Yb(),Sb(c.data.id),Ef(),Wd(),e(d,b))}).on("click",function(a,b){var c=Jb(a),d=Pb(c),e=Wb();lf(this,a,b),e(d,b)}),t.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){aj=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Jb(a);return c?(b=Mf.interpolate(this._current,c),this._current=b(0),function(a){return Mb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("fill",function(a){return cj(a.data)}).style("opacity",1).call(Ie,function(){aj=!1}),t.exit().transition().duration(U).style("opacity",0).remove(),Cj.selectAll("."+g.chartArc).select("text").attr("transform",Nb).style("opacity",0).transition().duration(T).text(Qb).style("opacity",function(a){return Jc(a.data.id)&&se(a.data)?1:0}),Cj.select("."+g.chartArcsTitle).style("opacity",ke(Nf.data.targets)?1:0),nh&&(Mf.event&&"zoom"===Mf.event.type&&vj.extent(Dg.orgDomain()).update(),F&&(!wh&&Ih&&jb(hj.subx,c.axisSubX,Ih),vj.empty()||vj.extent(Dg.orgDomain()).update(),Q=bf($,!0),x=Dj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),x.enter().append("path").attr("class",ed).style("stroke","none").style("fill",cj),x.style("opacity",wd).transition().duration(T).attr("d",Q).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove(),w=Dj.selectAll("."+g.lines).selectAll("."+g.line).data(te),w.enter().append("path").attr("class",ad).style("stroke",cj),w.style("opacity",wd).transition().duration(T).attr("d",yj).style("opacity",1),w.exit().transition().duration(T).style("opacity",0).remove())),Cj.selectAll("."+g.selectedCircles).filter(function(a){return oe(a)}).selectAll("circle").remove(),Cj.selectAll("."+g.selectedCircle).transition().duration(T).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d),Zf&&(y=Cj.select("."+g.eventRects),Fe(Og)&&!sc(Og)?(y.classed(g.eventRectsMultiple)||y.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),z=Cj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),kf(z.enter()),z.attr("x",0).attr("y",0).attr("width",gg).attr("height",ig)):(y.classed(g.eventRectsSingle)||y.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Xi&&!Wi?(D=function(a,b){var c=Bc(b),d=Cc(b),e=Nf.data.xs[a.id][b];return(Dg(d?d:e+50)-Dg(c?c:e-50))/2},C=function(a,b){var c=Bc(b),d=Nf.data.xs[a.id][b];return(Dg(d)+Dg(c?c:d-50))/2}):(D=P(),C=function(a){return Dg(a.x)-D/2}),A=Ec(Nf.data.targets),Cj.select("."+g.eventRects).datum(A?A.values:[]),z=Cj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),jf(z.enter()),z.attr("class",ld).attr("x",wh?0:C).attr("y",wh?C:0).attr("width",wh?gg:D).attr("height",wh?D:ig),z.exit().remove())),Gc(Nf.data.targets).forEach(function(a){Jj[a]=!0})}function rf(){qf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function sf(){if(0!==Lc(Nf.data.targets).length){if("mousemove"===Mf.event.sourceEvent.type&&zj.altDomain)return Dg.domain(zj.altDomain),void zj.scale(Dg).updateScaleExtent();Wi&&Dg.orgDomain()[0]===Hj[0]&&Dg.domain([Hj[0]-1e-10,Dg.orgDomain()[1]]),qf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Mf.event.sourceEvent.type&&($i=!0)}}function tf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function uf(){Aj.attr("width",kg).attr("height",lg),Aj.select("#"+Pi).select("rect").attr("width",gg).attr("height",ig),Aj.select("#"+Qi).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),Aj.select("#"+Ri).select("rect").attr("x",H).attr("y",I).attr("width",N).attr("height",O),Aj.select("."+g.zoomRect).attr("width",gg).attr("height",ig),Gj.style("max-height",lg+"px")}function vf(a){return{axisX:a?hj.x.transition().duration(a):hj.x,axisY:a?hj.y.transition().duration(a):hj.y,axisY2:a?hj.y2.transition().duration(a):hj.y2,axisSubX:a?hj.subx.transition().duration(a):hj.subx}}function wf(a){var b;a=a||{},a.withTransition=Je(a,"withTransition",!0),a.withTransform=Je(a,"withTransform",!1),a.withLegend=Je(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withLegend&&qh||(b=vf(a.withTransitionForAxis?cg:0),p(),V(),uf(),o(a.withTransition,b)),qf(a,b)}function xf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=Cj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",nd),j=i.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Zc),e=Cj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),d=e.enter().append("g").attr("class",pd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",fd).style("cursor",function(a){return eh(a)?"pointer":null}),c=Cj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),b=c.enter().append("g").attr("class",od).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",bd),b.append("g").attr("class",jd),b.append("g").attr("class",function(a){return Xc(g.selectedCircles,a.id)}),b.append("g").attr("class",dd).style("cursor",function(a){return eh(a)?"pointer":null}),a.forEach(function(a){Cj.selectAll("."+g.selectedCircles+rd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Cj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(ug(a)).attr("class",qd),f=h.enter().append("g").attr("class",qd),f.append("g").attr("class",hd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),nh&&(n=Dj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),m=n.enter().append("g").style("opacity",0).attr("class",pd),m.append("g").attr("class",fd),l=Dj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),k=l.enter().append("g").style("opacity",0).attr("class",od),k.append("g").attr("class",bd)),Aj.selectAll("."+g.target).filter(function(a){return Jc(a.id)}).transition().duration(cg).style("opacity",1)}function yf(a,b){b.filter&&(a=a.filter(b.filter)),(b.type||b.types)&&a.forEach(function(a){b.types?fe(a.id,b.types[a.id]):fe(a.id,b.type)}),Nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,z=0,F++)),E[a]=F,D[F]=f,A[a]=z,z+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+v)/10),j=10*Math.ceil((h.height+u)/10),k=nj?j:i,l=nj?U():T();return d&&(z=0,F=0,w=0,x=0),qh&&!Kc(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=i,C[c]=j,(!w||i>=w)&&(w=i),(!x||j>=x)&&(x=j),g=nj?x:w,void(vh?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(l-g*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=26,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=Ej.selectAll("."+g.legendItemFocused).size();b=b||{},n=Je(b,"withTransition",!0),q=Je(b,"withTransitionForTransform",!0),nj?(f=function(a){return w*E[a]},j=function(a){return D[E[a]]+A[a]}):(f=function(a){return D[E[a]]+A[a]},j=function(a){return x*E[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=Ej.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Xc(g.legendItem,a)}).style("visibility",function(a){return Kc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof sh?sh(a):Nf.toggle(a)}).on("mouseover",function(a){Mf.select(this).classed(g.legendItemFocused,!0),aj||Nf.focus(a),"function"==typeof th&&th(a)}).on("mouseout",function(a){Mf.select(this).classed(g.legendItemFocused,!1),aj||Nf.revert(),"function"==typeof uh&&uh(a)}),m.append("text").text(function(a){return d(Rg[a])?Rg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",nj?h:-200).attr("y",nj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",nj?i:-200).attr("y",nj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",cj).attr("x",nj?h:-200).attr("y",nj?-200:j).attr("width",10).attr("height",10),r=Ej.selectAll("text").data(a).text(function(a){return d(Rg[a])?Rg[a]:a}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=Ej.selectAll("rect."+g.legendItemEvent).data(a),(n?s.transition():s).attr("width",function(a){return B[a]}).attr("height",function(a){return C[a]}).attr("x",i).attr("y",l),t=Ej.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",cj).attr("x",f).attr("y",j),Ej.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Jc(a)}).transition().style("opacity",function(a){var b=Mf.select(this);return Jc(a)?!G||b.classed(g.legendItemFocused)?Bf(b):Cf(b):rj}),R(w),S(x),Q(F),p(),V(),uf(),o(q,c)}function If(a){return Ic(Nf.data.targets,a.id)}function Jf(a){return"data"in a&&Ic(Nf.data.targets,a.data.id)}function Kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function Lf(a,b,c){var d=!le(Nf.data.targets);aj=!1,fe(a,b),wf(c||{withTransitionForAxis:d})}var Mf=a.d3?a.d3:a.require?a.require("d3"):void 0,Nf={data:{},axis:{},legend:{}},Of={},Pf=i(["bindto"],"#chart"),Qf=i(["size","width"]),Rf=i(["size","height"]),Sf=i(["padding","left"]),Tf=i(["padding","right"]),Uf=i(["padding","top"]),Vf=i(["padding","bottom"]),Wf=i(["zoom","enabled"],!1),Xf=i(["zoom","extent"]),Yf=i(["zoom","privileged"],!1),Zf=i(["interaction","enabled"],!0),$f=i(["onenter"],function(){}),_f=i(["onleave"],function(){}),ag=i(["onresize"],function(){}),bg=i(["onresized"],function(){}),cg=i(["transition","duration"],350);h("data","data is required in config");var dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg,Kg,Lg,Mg,Ng=i(["data","x"]),Og=i(["data","xs"],{}),Pg=i(["data","x_format"]),Qg=i(["data","id_converter"],function(a){return a}),Rg=i(["data","names"],{}),Sg=i(["data","classes"],{}),Tg=i(["data","groups"],[]),Ug=i(["data","axes"],{}),Vg=i(["data","type"]),Wg=i(["data","types"],{}),Xg=i(["data","labels"],{}),Yg=i(["data","order"]),Zg=i(["data","regions"],{}),$g=i(["data","color"]),_g=i(["data","colors"],{}),ah=i(["data","hide"],!1),bh=i(["data","filter"]),ch=i(["data","selection","enabled"],!1),dh=i(["data","selection","grouped"],!1),eh=i(["data","selection","isselectable"],function(){return!0}),fh=i(["data","selection","multiple"],!0),gh=i(["data","onclick"],function(){}),hh=i(["data","onenter"],function(){}),ih=i(["data","onleave"],function(){}),jh=i(["data","onselected"],function(){}),kh=i(["data","onunselected"],function(){}),lh=i(["data","ondragstart"],function(){}),mh=i(["data","ondragend"],function(){}),nh=i(["subchart","show"],!1),oh=i(["subchart","size","height"],60),ph=i(["color","pattern"],[]),qh=i(["legend","show"],!0),rh=i(["legend","position"],"bottom"),sh=i(["legend","item","onclick"]),th=i(["legend","item","onmouseover"]),uh=i(["legend","item","onmouseout"]),vh=i(["legend","equally"],!1),wh=i(["axis","rotated"],!1),xh=i(["axis","x","show"],!0),yh=i(["axis","x","type"],"indexed"),zh=i(["axis","x","localtime"],!0),Ah=i(["axis","x","categories"],[]),Bh=i(["axis","x","tick","centered"],!1),Ch=i(["axis","x","tick","format"]),Dh=i(["axis","x","tick","culling"],{}),Eh=i(["axis","x","tick","culling","max"],10),Fh=i(["axis","x","tick","count"]),Gh=i(["axis","x","tick","fit"],!0),Hh=i(["axis","x","tick","values"],null),Ih=i(["axis","x","tick","rotate"]),Jh=i(["axis","x","max"],null),Kh=i(["axis","x","min"],null),Lh=i(["axis","x","padding"],{}),Mh=i(["axis","x","height"]),Nh=i(["axis","x","default"]),Oh=i(["axis","x","label"],{}),Ph=i(["axis","y","show"],!0),Qh=i(["axis","y","max"]),Rh=i(["axis","y","min"]),Sh=i(["axis","y","center"]),Th=i(["axis","y","label"],{}),Uh=i(["axis","y","inner"],!1),Vh=i(["axis","y","tick","format"]),Wh=i(["axis","y","padding"]),Xh=i(["axis","y","ticks"],10),Yh=i(["axis","y2","show"],!1),Zh=i(["axis","y2","max"]),$h=i(["axis","y2","min"]),_h=i(["axis","y2","center"]),ai=i(["axis","y2","label"],{}),bi=i(["axis","y2","inner"],!1),ci=i(["axis","y2","tick","format"]),di=i(["axis","y2","padding"]),ei=i(["axis","y2","ticks"],10),fi=i(["grid","x","show"],!1),gi=i(["grid","x","type"],"tick"),hi=i(["grid","x","lines"],[]),ii=i(["grid","y","show"],!1),ji=i(["grid","y","lines"],[]),ki=i(["grid","y","ticks"],10),li=i(["point","show"],!0),mi=i(["point","r"],2.5),ni=i(["point","focus","line","enabled"],!0),oi=i(["point","focus","expand","enabled"],!0),pi=i(["point","focus","expand","r"]),qi=i(["point","focus","select","r"]),ri=i(["line","connect_null"],!1),si=i(["bar","width"]),ti=i(["bar","width","ratio"],.6),ui=i(["pie","label","show"],!0),vi=i(["pie","label","format"]),wi=i(["pie","expand"],!0),xi=i(["pie","onclick"],function(){}),yi=i(["pie","onmouseover"],function(){}),zi=i(["pie","onmouseout"],function(){}),Ai=i(["donut","label","show"],!0),Bi=i(["donut","label","format"]),Ci=i(["donut","expand"],!0),Di=i(["donut","title"],""),Ei=i(["donut","onclick"],function(){}),Fi=i(["donut","onmouseover"],function(){}),Gi=i(["donut","onmouseout"],function(){}),Hi=i(["regions"],[]),Ii=i(["tooltip","show"],!0),Ji=i(["tooltip","format","title"]),Ki=i(["tooltip","format","value"]),Li=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Ji?Ji:b,l=Ki?Ki:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Mi=i(["tooltip","init","show"],!1),Ni=i(["tooltip","init","x"],0),Oi=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Pi=("string"==typeof Pf?Pf.replace(/[# .>~+]/g,""):g.chart+ +new Date)+"-clip",Qi=Pi+"-xaxis",Ri=Pi+"-yaxis",Si=j(Pi),Ti=j(Qi),Ui=j(Ri),Vi="timeseries"===yh,Wi="categorized"===yh,Xi=!Vi&&(Ng||Fe(Og)),Yi=null,Zi=!1,$i=!1,_i=!1,aj=!1,bj=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],cj=ze(_g,Fe(ph)?ph:bj,$g),dj=zh?Mf.time.format:Mf.time.format.utc,ej=dj.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),fj=[],gj=[],hj={},ij=wh?"left":"bottom",jj=wh?Uh?"top":"bottom":Uh?"right":"left",kj=wh?bi?"bottom":"top":bi?"left":"right",lj=wh?"left":"bottom",mj={main:function(){return"translate("+k(dg.left)+","+k(dg.top)+")"},context:function(){return"translate("+k(eg.left)+","+k(eg.top)+")"},legend:function(){return"translate("+fg.left+","+fg.top+")"},x:function(){return"translate(0,"+(wh?0:ig)+")"},y:function(){return"translate(0,"+(wh?ig:0)+")"},y2:function(){return"translate("+(wh?0:gg)+","+(wh?1:0)+")" -},subx:function(){return"translate(0,"+(wh?0:jg)+")"},arc:function(){return"translate("+pg/2+","+qg/2+")"}},nj="right"===rh,oj=0,pj=0,qj=0,rj=.15,sj=30,tj=wh&&!xh?0:30,uj=5;ug=Mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var vj,wj=function(){var a=Mf.svg.line().x(wh?function(a){return $(a.id)(a.value)}:Id).y(wh?Id:function(a){return $(a.id)(a.value)});return ri||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ri?Te(b.values):b.values;return me(b)?(a.interpolate(ne(b)?"cardinal":"linear"),Zg[b.id]?gf(e,Dg,$(b.id),Zg[b.id]):a(e)):(c=e[0]?Dg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,wh?"M "+d+" "+c:"M "+c+" "+d)}}(),xj=function(){var a;return a=wh?Mf.svg.area().x0(function(a){return $(a.id)(0)}).x1(function(a){return $(a.id)(a.value)}).y(Id):Mf.svg.area().x(Id).y0(function(a){return $(a.id)(0)}).y1(function(a){return $(a.id)(a.value)}),function(b){var c,d,e=Te(b.values);return ge([b],"area")||ge([b],"area-spline")?(a.interpolate(ne(b)?"cardinal":"linear"),a(e)):(c=e[0]?Dg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,wh?"M "+d+" "+c:"M "+c+" "+d)}}(),yj=function(){var a=Mf.svg.line().x(wh?function(a){return _(a.id)(a.value)}:Ld).y(wh?Ld:function(a){return _(a.id)(a.value)});return function(b){var c=Te(b.values);return me(b)?a(c):"M "+Gg(c[0].x)+" "+_(b.id)(c[0].value)}}(),zj=function(){};vj=Mf.svg.brush().on("brush",rf),vj.update=function(){return Dj&&Dj.select("."+g.brush).call(this),this},vj.scale=function(a){return wh?this.y(a):this.x(a)},Wf&&(zj=Mf.behavior.zoom().on("zoomstart",function(){zj.altDomain=Mf.event.sourceEvent.altKey?Dg.orgDomain():null}).on("zoom",Wf?sf:null),zj.scale=function(a){return wh?this.y(a):this.x(a)},zj.orgScaleExtent=function(){var a=Xf?Xf:[1,10];return[a[0],Math.max(Dc()/a[1],a[1])]},zj.updateScaleExtent=function(){var a=ec(Dg.orgDomain())/ec(Hj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Aj,Bj,Cj,Dj,Ej,Fj,Gj,Hj,Ij,Jj={};if(Nf.focus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);Nf.revert(),Nf.defocus(),b(d.classed(g.focused,!0)),b(e),le(Nf.data.targets)&&Rb(a,!0),Df(a,!0)},Nf.defocus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",.3)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);Nf.revert(),b(d.classed(g.focused,!1)),b(e),le(Nf.data.targets)&&Sb(a),Df(a,!1)},Nf.revert=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);b(d.classed(g.focused,!1)),b(e),le(Nf.data.targets)&&Sb(a),Ef()},Nf.show=function(a,b){a=Hc(a),b=b||{},Pc(a),Aj.selectAll(td(a)).transition().style("opacity",1),b.withLegend&&Ff(a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Nf.hide=function(a,b){a=Hc(a),b=b||{},Oc(a),Aj.selectAll(td(a)).transition().style("opacity",0),b.withLegend&&Gf(a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Nf.toggle=function(a){Jc(a)?Nf.hide(a):Nf.show(a)},Nf.unzoom=function(){vj.clear().update(),qf({withUpdateXDomain:!0})},Nf.load=function(a){return a.xs&&rc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Sg[b]=a.classes[b]}),"categories"in a&&Wi&&(Ah=a.categories,Jg.categories(Ah)),"cacheIds"in a&&fc(a.cacheIds)?void yf(hc(a.cacheIds),a.done):void("unload"in a?Af(Hc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){zf(a)}):zf(a))},Nf.unload=function(a,b){Af(Hc(a),function(){qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Nf.selected=function(a){return Mf.merge(Cj.selectAll("."+g.shapes+rd(a)).selectAll("."+g.shape).filter(function(){return Mf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Nf.select=function(a,b,c){ch&&Cj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Mf.select(this),i=e.data?e.data.id:e.id,j=Se(this),k=dh||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);"path"!==this.nodeName&&(k&&l?eh(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},Nf.unselect=function(a,b){ch&&Cj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Mf.select(this),f=c.data?c.data.id:c.id,h=Se(this),i=dh||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);"path"!==this.nodeName&&i&&j&&eh(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Nf.toLine=function(a){Lf(a,"line")},Nf.toSpline=function(a){Lf(a,"spline")},Nf.toBar=function(a){Lf(a,"bar")},Nf.toScatter=function(a){Lf(a,"scatter")},Nf.toArea=function(a){Lf(a,"area")},Nf.toAreaSpline=function(a){Lf(a,"area-spline")},Nf.toPie=function(a){Lf(a,"pie",{withTransform:!0})},Nf.toDonut=function(a){Lf(a,"donut",{withTransform:!0})},Nf.groups=function(a){return c(a)?Tg:(Tg=a,qf(),Tg)},Nf.xgrids=function(a){return a?(hi=a,qf(),hi):hi},Nf.xgrids.add=function(a){return a?Nf.xgrids(hi.concat(a)):void 0},Nf.xgrids.remove=function(a){var b=Kf(a);return Nf.xgrids(hi.filter(b))},Nf.ygrids=function(a){return a?(ji=a,qf(),ji):ji},Nf.ygrids.add=function(a){return a?Nf.ygrids(ji.concat(a)):void 0},Nf.ygrids.remove=function(a){var b=Kf(a);return Nf.ygrids(ji.filter(b))},Nf.regions=function(a){return a?(Hi=a,qf(),Hi):Hi},Nf.regions.add=function(a){return a?(Hi=Hi.concat(a),qf(),Hi):Hi},Nf.regions.remove=function(a){var b,c,d;return a=a||{},b=Je(a,"duration",cg),c=Je(a,"classes",[g.region]),d=Cj.select("."+g.regions).selectAll(c.map(function(a){return"."+a})),(b?d.transition().duration(b):d).style("opacity",0).remove(),Hi=Hi.filter(function(a){return c.indexOf(a.class)<0})},Nf.data.get=function(a){var b=Nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Nf.data.getAsTarget=function(a){var b=Nf.data.targets.filter(function(b){return b.id===a});return b.length>0?b[0]:void 0},Nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Rg[b]=a[b]}),qf({withLegend:!0}),Rg):Rg},Nf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){_g[b]=a[b]}),qf({withLegend:!0}),_g):_g},Nf.x=function(a){return arguments.length&&(uc(Nf.data.targets,a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Nf.data.xs},Nf.xs=function(a){return arguments.length&&(vc(Nf.data.targets,a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Nf.data.xs},Nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){gb(b,a[b])}),Ib())},Nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Jh=+a.x),b(a.y)&&(Qh=+a.y),b(a.y2)&&(Zh=+a.y2)):Qh=Zh=+a,qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Kh=+a.x),b(a.y)&&(Rh=+a.y),b(a.y2)&&($h=+a.y2)):Rh=$h=+a,qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Nf.axis.max(a.max),"undefined"!=typeof a.min&&Nf.axis.min(a.min))},Nf.legend.show=function(a){Ff(Hc(a)),qf({withLegend:!0})},Nf.legend.hide=function(a){Gf(Hc(a)),qf({withLegend:!0})},Nf.resize=function(a){Qf=a?a.width:null,Rf=a?a.height:null,wf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Nf.destroy=function(){Nf.data.targets=void 0,Nf.data.xs={},Gj.html(""),a.onresize=null},"url"in f.data)Mf.xhr(f.data.url,function(a,b){var c,d=Mf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Mf.csv.parse(b.response),hf(c)});else if("rows"in f.data)hf(xc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");hf(yc(f.data.columns))}return Nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(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}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.round(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.round(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&a=0;return"url("+(c?"":document.URL.split("#")[0])+"#"+b+")"}function k(a){return Math.ceil(a)+.5}function l(a,b){var c,d,e;b&&b.axisX?c=b.axisX:(c=Cj.select("."+g.axisX),a&&(c=c.transition())),b&&b.axisY?d=b.axisY:(d=Cj.select("."+g.axisY),a&&(d=d.transition())),b&&b.axisY2?e=b.axisY2:(e=Cj.select("."+g.axisY2),a&&(e=e.transition())),Cj.attr("transform",mj.main),c.attr("transform",mj.x),d.attr("transform",mj.y),e.attr("transform",mj.y2),Cj.select("."+g.chartArcs).attr("transform",mj.arc)}function m(a,b){var c;b&&b.axisSubX?c=b.axisSubX:(c=Dj.select("."+g.axisX),a&&(c=c.transition())),Dj.attr("transform",mj.context),c.attr("transform",mj.subx)}function n(a){(a?Ej.transition():Ej).attr("transform",mj.legend)}function o(a,b){l(a,b),nh&&m(a,b),n(a)}function p(){var a=U(),b=T(),c=nj?0:a,d=le(Nf.data.targets),e=wh||d?0:A("x"),f=nh&&!d?oh+e:0;kg=t(),lg=u(),wh?(dg={top:A("y2")+v(),right:d?0:y(),bottom:A("y")+c+w(),left:f+(d?0:x())},eg={top:dg.top,right:0/0,bottom:20+c,left:sj}):(dg={top:4+v(),right:d?0:y(),bottom:e+f+c+w(),left:d?0:x()},eg={top:lg-f-c,right:0/0,bottom:e+c,left:dg.left}),fg={top:nj?0:lg-a,right:0/0,bottom:0,left:nj?kg-b:0},gg=kg-dg.left-dg.right,ig=lg-dg.top-dg.bottom,0>gg&&(gg=0),0>ig&&(ig=0),hg=wh?dg.left-sj-tj:gg,jg=wh?ig:lg-eg.top-eg.bottom,0>hg&&(hg=0),0>jg&&(jg=0),pg=gg-(nj?b+10:0),qg=ig-(nj?0:10),r(),nj&&d&&(fg.left=pg/2+1.1*ng)}function q(){Cj.select("line."+g.xgridFocus).attr("x1",wh?0:-10).attr("x2",wh?gg:-10).attr("y1",wh?-10:dg.top).attr("y2",wh?-10:ig)}function r(){ng=Math.min(pg,qg)/2,mg=.95*ng,og=ke(Nf.data.targets)?.6*mg:0}function s(){var a=wh?g.axisX:g.axisY,b=Cj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Gj.node().getBoundingClientRect(),e=le(Nf.data.targets),f=c.right-d.left-(e?0:x());return f>0?f:0}function t(){return Qf?Qf:B()}function u(){var a=Rf?Rf:C();return a>0?a:320}function v(){return Uf?Uf:0}function w(){return Vf?Vf:0}function x(){return Sf?Sf:wh?xh?Ke(z("x")):1:!Ph||Uh?1:Ke(z("y"))}function y(){var a=10,b=nj?T()+20:0;return Tf?Tf:wh?a+b:(!Yh||bi?a:Ke(z("y2")))+b}function z(a){var b=ob(a);return b.isInner?20+Hb(a):40+Hb(a)}function A(a){return"x"!==a||xh?"x"===a&&Mh?Mh:"y"!==a||Ph?"y2"!==a||Yh?(ob(a).isInner?30:40)+("y2"===a?-10:0):uj:qh&&!nj?10:1:0}function B(){return+Gj.style("width").replace("px","")}function C(){return+Gj.style("height").replace("px","")}function D(a){return a?-31:-(dg.left-1)}function E(a){return a?-20:-4}function F(){return D(!wh)}function G(){return E(!wh)}function H(){return D(wh)}function I(){return E(wh)}function J(a){return a?gg+2+30+30:dg.left+20}function K(a){return a?(Mh?Mh:0)+80:ig+8}function L(){return J(!wh)}function M(){return K(!wh)}function N(){return J(wh)}function O(){return K(wh)}function P(){var a,b,c,d,e,f=Ec(Nf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=Dg(b.x)-Dg(a.x),0===c?wh?ig:gg:(d=Dc(),e=he(Nf.data.targets)?(d-(Wi?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function Q(a){oj=a}function R(a){pj=a}function S(a){qj=a}function T(){return qh?nj?pj*(oj+1):kg:0}function U(){return qh?nj?lg:qj*(oj+1):0}function V(){var a,b,c=!Dg;vg=wh?1:0,wg=wh?ig:gg,xg=wh?0:ig,yg=wh?gg:1,zg=vg,Ag=wg,Bg=wh?0:jg,Cg=wh?hg:1,Dg=Y(vg,wg,c?void 0:Dg.domain(),function(){return Jg.tickOffset()}),Eg=Z(xg,yg,c?void 0:Eg.domain()),Fg=Z(xg,yg,c?void 0:Fg.domain()),Gg=Y(vg,wg,Hj,function(a){return a%1?0:Mg.tickOffset()}),Hg=Z(Bg,Cg,c?void 0:Hg.domain()),Ig=Z(Bg,Cg,c?void 0:Ig.domain()),a=db(),b=Hh?Hh:c?void 0:Jg.tickValues(),Jg=ab(Dg,ij,a,b),Mg=ab(Gg,lj,a,b),Kg=bb(Eg,jj,Vh,Xh),Lg=bb(Fg,kj,ci,ei),c||(vj.scale(Gg),Wf&&zj.scale(Dg)),W()}function W(){rg=Kb(),sg=Lb(),tg=Lb(.98)}function X(a,b,c){return(c?Mf.time.scale():Mf.scale.linear()).range([a,b])}function Y(a,b,c,d){var e,f=X(a,b,Vi),g=c?f.domain(c):f;Wi?(d=d||function(){return 0},f=function(a,b){var c=g(a)+d(a);return b?c:Math.ceil(c)}):f=function(a,b){var c=g(a);return b?c:Math.ceil(c)};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return Hj&&Hj[0]===a[0]&&Hj[1]a?a.toFixed(0):a};return Ch&&("function"==typeof Ch?a=Ch:Vi&&(a=function(a){return a?dj(Ch)(a):""})),a}function eb(a){var b;return"y"===a?b=Th:"y2"===a?b=ai:"x"===a&&(b=Oh),b}function fb(a){var b=eb(a);return"string"==typeof b?b:b?b.text:null}function gb(a,b){var c=eb(a);"string"==typeof c?"y"===a?Th=b:"y2"===a?ai=b:"x"===a&&(Oh=b):c&&(c.text=b)}function hb(a){return 10*Math.sin(Math.PI*(a/180))}function ib(a){return 11.5-2.5*(a/15)}function jb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",ib(c)).attr("x",hb(c)).attr("transform","rotate("+c+")")}function kb(a,b){var c=eb(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 lb(){return kb("x",wh?"inner-top":"inner-right")}function mb(){return kb("y",wh?"inner-right":"inner-top")}function nb(){return kb("y2",wh?"inner-right":"inner-top")}function ob(a){return"y2"===a?nb():"y"===a?mb():lb()}function pb(){return fb("x")}function qb(){return fb("y")}function rb(){return fb("y2")}function sb(a,b){return a?b.isLeft?0:b.isCenter?gg/2:gg:b.isBottom?-ig:b.isMiddle?-ig/2:0}function tb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function ub(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function vb(){return sb(!wh,lb())}function wb(){return sb(wh,mb())}function xb(){return sb(wh,nb())}function yb(){return tb(!wh,lb())}function zb(){return tb(wh,mb())}function Ab(){return tb(wh,nb())}function Bb(){var a=lb();return wh?a.isInner?"1.2em":-25-Hb("x"):a.isInner?"-0.5em":Mh?Mh-10:"3em"}function Cb(){var a=mb();return wh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Hb("y")}function Db(){var a=nb();return wh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Hb("y2")}function Eb(){return ub(!wh,lb())}function Fb(){return ub(wh,mb())}function Gb(){return ub(wh,nb())}function Hb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Ib(a){var b=Cj.select("."+g.axisX+" ."+g.axisXLabel),c=Cj.select("."+g.axisY+" ."+g.axisYLabel),d=Cj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",vb).attr("dx",yb).attr("dy",Bb).text(pb),(a?c.transition():c).attr("x",wb).attr("dx",zb).attr("dy",Cb).attr("dy",Cb).text(qb),(a?d.transition():d).attr("x",xb).attr("dx",Ab).attr("dy",Db).text(rb)}function Jb(a){var b=!1;return ug(Lc(Nf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Kb(){var a=Mf.svg.arc().outerRadius(mg).innerRadius(og),b=function(b,c){var d;return c?a(b):(d=Jb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Lb(a){var b=Mf.svg.arc().outerRadius(ng*(a?a:1)).innerRadius(og);return function(a){var c=Jb(a);return c?b(c):"M 0 0"}}function Mb(a,b){return se(a.data)?rg(a,b):"M 0 0"}function Nb(a){var b,c,d,e,f=Jb(a),g="";return f&&(b=rg.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*mg*.8+","+d/e*mg*.8+")"),g}function Ob(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Pb(a){return tc({id:a.data.id,value:a.value,ratio:Ob(a)})}function Qb(a){var b,c,d,e;return Tb()?(b=Jb(a),c=b?b.value:null,d=Ob(b),e=Ub(),e?e(c,d):Gd(c,d)):""}function Rb(a,b){var c=Aj.selectAll("."+g.chartArc+sd(a)),d=Aj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});ye(a)&&c.selectAll("path").transition().duration(50).attr("d",sg).transition().duration(100).attr("d",tg).each(function(a){re(a.data)}),b||d.style("opacity",.3)}function Sb(a){var b=Aj.selectAll("."+g.chartArc+sd(a));b.selectAll("path").transition().duration(50).attr("d",rg),Aj.selectAll("."+g.arc).style("opacity",1)}function Tb(){return ke(Nf.data.targets)?Ai:ui}function Ub(){return ke(Nf.data.targets)?Bi:vi}function Vb(){return ke(Nf.data.targets)?Di:""}function Wb(){var a=ke(Nf.data.targets)?Ei:xi;return"function"==typeof a?a:function(){}}function Xb(){var a=ke(Nf.data.targets)?Fi:yi;return"function"==typeof a?a:function(){}}function Yb(){var a=ke(Nf.data.targets)?Gi:zi;return"function"==typeof a?a:function(){}}function Zb(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Tg.length>0)for(g=Uc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return Mf.min(Object.keys(i).map(function(a){return Mf.min(i[a])}))}function $b(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Tg.length>0)for(g=Vc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return Mf.max(Object.keys(i).map(function(a){return Mf.max(i[a])}))}function _b(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return cb(a.id)===c}),m="y2"===c?$h:Rh,n="y2"===c?Zh:Qh,o=b(m)?m:Zb(l),p=b(n)?n:$b(l),q="y2"===c?_h:Sh,r=Ad()&&wh;return 0===l.length?"y2"===c?Fg.domain():Eg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=Bd(o,p),j=ec(Eg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Wh&&(f=b(Wh.top)?Wh.top:e,g=b(Wh.bottom)?Wh.bottom:e),"y2"===c&&di&&(f=b(di.top)?di.top:e,g=b(di.bottom)?di.bottom:e),he(l)&&!Uc(l)&&(g=o),[o-g,p+f])}function ac(a){return Kh?Vi?Ae(Kh):Kh:Mf.min(a,function(a){return Mf.min(a.values,function(a){return a.x})})}function bc(a){return Jh?Vi?Ae(Jh):Jh:Mf.max(a,function(a){return Mf.max(a.values,function(a){return a.x})})}function cc(a){var c,d,e,f,g=Fc(a),h=g[1]-g[0];return Wi?d=0:he(a)?(c=Dc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Lh&&Fe(Lh)?(e=b(Lh.left)?Lh.left:d,f=b(Lh.right)?Lh.right:d):e=f="number"==typeof Lh?Lh:d,{left:e,right:f}}function dc(a){var b=[ac(a),bc(a)],c=b[0],d=b[1],e=cc(a),f=0,g=0;return c-d!==0||Wi||(c=Vi?new Date(.5*c.getTime()):-.5,d=Vi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ec(a){return a[1]-a[0]}function fc(a){for(var b=0;bb?0:b-c}function lc(a){var b,c=jc(a),d="y"===a.axis?Eg:Fg;return b="y"===a.axis||"y2"===a.axis?wh?ig:"start"in a?d(a.start):ig:wh?"end"in a?Dg(Vi?Ae(a.end):a.end):ig:ig,c>b?0:b-c}function mc(a){return Ng&&a===Ng||Fe(Og)&&Ge(Og,a)}function nc(a){return!mc(a)}function oc(a){return Ng?Ng:Fe(Og)?Og[a]:null}function pc(a,b){var c,d=b&&Fe(b)?Gc(b):[];return d.forEach(function(b){oc(b)===a&&(c=Nf.data.xs[b])}),c}function qc(a,b){return a in Nf.data.xs&&Nf.data.xs[a]&&Nf.data.xs[a][b]?Nf.data.xs[a][b]:b}function rc(a){Object.keys(a).forEach(function(b){Og[b]=a[b]})}function sc(a){return 1===Mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function tc(a){var b;return a&&(b=Rg[a.id],a.name=b?b:a.id),a}function uc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=wc(b[d],a.id,d)}),Nf.data.xs[a.id]=b})}function vc(a,b){a.forEach(function(a){b[a.id]&&uc([a],b[a.id])})}function wc(a,c,d){var e;return e=Vi?a?a instanceof Date?a:Ae(a):Ae(qc(c,d)):Xi&&!Wi?b(a)?+a:qc(c,d):d}function xc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Ng?(d=Object.keys(Nf.data.xs),Nf.data.xs[c]=d.length>0?Nf.data.xs[d[0]]:void 0):Fe(Og)&&(Nf.data.xs[c]=pc(f,Nf.data.targets)):Nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Qg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=oc(b),g=a[f],h=wc(g,b,e);return Xi&&Wi&&0===c&&g&&(0===e&&(Ah=[]),Ah.push(g)),("undefined"==typeof a[b]||Nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Vg&&fe(Gc(c).filter(function(a){return!(a in Wg)}),Vg),c.forEach(function(a){gc(a.id_org,a)}),c}function Ac(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 Bc(a){return a>0&&Nf.data.targets[0].values[a-1]?Nf.data.targets[0].values[a-1].x:void 0}function Cc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Fc(a){var b,c,d=Ec(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Gc(a){return a.map(function(a){return a.id})}function Hc(a){return a?"string"==typeof a?[a]:a:Gc(Nf.data.targets)}function Ic(a,b){var c,d=Gc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Vi?new Date(i):i);j.push(e)}return Vi||(j=j.sort(function(a,b){return a-b})),j}function Oc(a){fj=fj.concat(a)}function Pc(a){fj=fj.filter(function(b){return a.indexOf(b)<0})}function Qc(a){gj=gj.concat(a)}function Rc(a){gj=gj.filter(function(b){return a.indexOf(b)<0})}function Sc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Tc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Vc(a){return Tc(a,function(a){return a>0})}function Wc(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||0===a[f].x)&&(e=e.concat(Md(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Md(a,g))),Pd(e,b)):Nd(a,b,f,g)}function Od(a,b){var c;return c=a.map(function(a){return Nd(a.values,b)}),Pd(c,b)}function Pd(a,b){var c,d;return a.forEach(function(a){var e=He(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Qd(a,b){return Mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Rd(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 Sd(){return Yg&&"desc"===Yg.toLowerCase()}function Td(){return Yg&&"asc"===Yg.toLowerCase()}function Ud(a){var b=Td(),c=Sd();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 Yg&&a.sort(Yg),a}function Vd(a,c){var d,e,f,g,h,i,j,k=le(Nf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&Ii&&(Fj.html(Li(a,db(),Cd(k),cj)).style("display","block"),d=Fj.property("offsetWidth"),e=Fj.property("offsetHeight"),k?(g=gg/2+c[0],i=ig/2+c[1]+20):(wh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-y(),i=Dg(l[0].x)+20):(f=s(),g=f+x()+Dg(l[0].x)+20,h=g+d,j=f+t()-y(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),Fj.style("top",i+"px").style("left",g+"px"))}function Wd(){Fj.style("display","none")}function Xd(a){var c=a.filter(function(a){return a&&b(a.value)});if(Ii&&!ie(Nf.data.targets)&&!le(Nf.data.targets)){var d=Cj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(wh?"y1":"x1",Id).attr(wh?"y2":"x2",Id),pf(d,"grid")}}function Yd(){Cj.select("line."+g.xgridFocus).style("visibility","hidden")}function Zd(a,b){var c,d,e,f,h=[],i=Cj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=dc(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function $d(a){return a.x||0===a.x?Dg(a.x):null}function _d(a){return $(a.id)(a.value)}function ae(){var a,b,d={},e=0;return Lc(Nf.data.targets.filter(oe)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ee(a,b){return"number"==typeof si?si:b?2*a.tickOffset()*ti/b:0}function fe(a,b){Hc(a).forEach(function(a){Jj[a]=b===Wg[a],Wg[a]=b})}function ge(a,b){var c=!1;return a.forEach(function(a){Wg[a.id]===b&&(c=!0),a.id in Wg||"line"!==b||(c=!0)}),c}function he(a){return ge(a,"bar")}function ie(a){return ge(a,"scatter")}function je(a){return ge(a,"pie")}function ke(a){return ge(a,"donut")}function le(a){return je(a)||ke(a)}function me(a){var b="string"==typeof a?a:a.id;return!(b in Wg)||"line"===Wg[b]||"spline"===Wg[b]||"area"===Wg[b]||"area-spline"===Wg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"spline"===Wg[b]||"area-spline"===Wg[b]}function oe(a){var b="string"==typeof a?a:a.id;return"bar"===Wg[b]}function pe(a){var b="string"==typeof a?a:a.id;return"scatter"===Wg[b]}function qe(a){var b="string"==typeof a?a:a.id;return"pie"===Wg[b]}function re(a){var b="string"==typeof a?a:a.id;return"donut"===Wg[b]}function se(a){return qe(a)||re(a)}function te(a){return me(a)?[a]:[]}function ue(a){return se(a.data)?[a]:[]}function ve(a){return oe(a)?a.values:[]}function we(a){return me(a)||pe(a)?a.values:[]}function xe(a){return oe(a)||me(a)?a.values:[]}function ye(a){return re(a)&&Ci||qe(a)&&wi}function ze(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function Ae(b){var c;try{c=Pg?Mf.time.format(Pg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Pg)}return c}function Be(a,b){var c=Mf.mouse(a),d=Mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ge(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function He(a,b){var c="y"===cb(a.id)?Eg:Fg,d=wh?1:0,e=wh?0:1;return Math.pow(Dg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ie(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Je(a,b,c){return d(a[b])?a[b]:c}function Ke(a){return 10*Math.ceil(a/10)}function Le(a,b,c){jh(b,a.node()),Cj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Xc(g.selectedCircle,c)}).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d).attr("stroke",function(){return cj(b)}).attr("r",1.4*We(b)).transition().duration(100).attr("r",We)}function Me(a,b,c){kh(b,a.node()),Cj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ne(a,b,c,d){a?Le(b,c,d):Me(b,c,d)}function Oe(a,b){jh(b,a.node()),a.transition().duration(100).style("fill",function(){return Mf.rgb(cj(b)).brighter(.75)})}function Pe(a,b){kh(b,a.node()),a.transition().duration(100).style("fill",function(){return cj(b)})}function Qe(a,b,c,d){a?Oe(b,c,d):Pe(b,c,d)}function Re(a,b,c,d){Qe(a,b,c.data,d)}function Se(a){return"circle"===a.nodeName?Ne:Mf.select(a).classed(g.bar)?Qe:Re}function Te(a){return a.filter(function(a){return b(a.value)})}function Ue(a){return li?"function"==typeof mi?mi(a):mi:0}function Ve(a){return oi?pi?pi:1.75*Ue(a):Ue(a)}function We(a){return qi?qi:4*Ue(a)}function Xe(a,c){return(c?Cj.selectAll("."+g.circles+rd(c)):Cj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ye(a,b){Xe(a,b).classed(g.EXPANDED,!0).attr("r",Ve)}function Ze(a){Xe(a).filter(function(){return Mf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Ue)}function $e(a){return Cj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function _e(a){$e(a).classed(g.EXPANDED,!0)}function af(a){$e(a).classed(g.EXPANDED,!1)}function bf(a,b){var c=ff(a,b);return function(a,b){var d=c(a,b),e=wh?1:0,f=wh?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 cf(a,b){var c=ff(a,!1),d=b?df:ef;return function(a,b){return d(c(a,b),a,this)}}function df(a,b){var c;return wh?(c=oe(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function ef(a,b,c){var d=c.getBoundingClientRect();return wh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:oe(b)?-3:-6)}function ff(a,b){var c=a.__max__+1,d=ee(Jg,c),e=be(d,c,a,!!b),f=ce(!!b),g=de(a,!!b),h=b?_:$;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return wh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function gf(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function hf(b){var c,d,e;if(Gj=Mf.select(Pf),Gj.empty())throw new Error("Element to bind not found");if(Gj.html("").classed("c3",!0),Nf.data.xs={},Nf.data.targets=zc(b),bh&&(Nf.data.targets=Nf.data.targets.filter(bh)),ah&&Oc(ah===!0?Gc(Nf.data.targets):ah),p(),V(),Dg.domain(Mf.extent(dc(Nf.data.targets))),Eg.domain(_b(Nf.data.targets,"y")),Fg.domain(_b(Nf.data.targets,"y2")),Gg.domain(Dg.domain()),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Hj=Dg.domain(),vj.scale(Gg),Wf&&zj.scale(Dg),Aj=Gj.append("svg").on("mouseenter",$f).on("mouseleave",_f),Bj=Aj.append("defs"),Bj.append("clipPath").attr("id",Pi).append("rect"),Bj.append("clipPath").attr("id",Qi).append("rect"),Bj.append("clipPath").attr("id",Ri).append("rect"),uf(),Cj=Aj.append("g").attr("transform",mj.main),Dj=Aj.append("g").attr("transform",mj.context),Ej=Aj.append("g").attr("transform",mj.legend),nh||Dj.style("visibility","hidden"),qh||(Ej.style("visibility","hidden"),gj=Gc(Nf.data.targets)),Fj=Gj.style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Hf(Gc(Nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=Cj.append("g").attr("clip-path",Si).attr("class",g.grid),fi&&d.append("g").attr("class",g.xgrids),Fe(hi)&&d.append("g").attr("class",g.xgridLines),ni&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),ii&&d.append("g").attr("class",g.ygrids),Fe(ji)&&d.append("g").attr("class",g.ygridLines),Cj.append("g").attr("clip-path",Si).attr("class",g.regions),Cj.append("g").attr("clip-path",Si).attr("class",g.chart),c=Cj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Wf?wh?"ns-resize":"ew-resize":null),Cj.select("."+g.chart).append("g").attr("class",g.chartBars),Cj.select("."+g.chart).append("g").attr("class",g.chartLines),Cj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",mj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Vb()),Cj.select("."+g.chart).append("g").attr("class",g.chartTexts),Wf&&Cj.insert("rect",Yf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",gg).attr("height",ig).style("opacity",0).style("cursor",wh?"ns-resize":"ew-resize").call(zj).on("dblclick.zoom",null),Nh&&vj.extent("function"!=typeof Nh?Nh:Nh(dc())),hj.x=Cj.append("g").attr("class",g.axisX).attr("clip-path",Ti).attr("transform",mj.x).style("visibility",xh?"visible":"hidden"),hj.x.append("text").attr("class",g.axisXLabel).attr("transform",wh?"rotate(-90)":"").style("text-anchor",Eb),hj.y=Cj.append("g").attr("class",g.axisY).attr("clip-path",Ui).attr("transform",mj.y).style("visibility",Ph?"visible":"hidden"),hj.y.append("text").attr("class",g.axisYLabel).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Fb),hj.y2=Cj.append("g").attr("class",g.axisY2).attr("transform",mj.y2).style("visibility",Yh?"visible":"hidden"),hj.y2.append("text").attr("class",g.axisY2Label).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Gb),Dj.append("g").attr("clip-path",Si).attr("class",g.chart),Dj.select("."+g.chart).append("g").attr("class",g.chartBars),Dj.select("."+g.chart).append("g").attr("class",g.chartLines),Dj.append("g").attr("clip-path",Si).attr("class",g.brush).call(vj).selectAll("rect").attr(wh?"width":"height",wh?hg:jg),hj.subx=Dj.append("g").attr("class",g.axisX).attr("transform",mj.subx).attr("clip-path",wh?"":Ti),xf(Nf.data.targets),qf({withUpdateTranslate:!0,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Mi){if(Vi&&"string"==typeof Ni){for(Ni=Ae(Ni),e=0;e0){d=[];for(var f in Rg)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Rd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Qe,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function nf(a){le(Nf.data.targets)||ch&&(Yi=a,Cj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Zi=!0,lh())}function of(){le(Nf.data.targets)||ch&&(Cj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),Cj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Zi=!1,mh())}function pf(a,b){"grid"===b&&a.each(function(){var a=Mf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function qf(a,c){var d,e,f,h,i,j,k,l,m,n,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,Q,R,S,T,U,W,X,Y,Z,$=ae(),_=le(Nf.data.targets),ab=Lc(Nf.data.targets);if(a=a||{},E=Je(a,"withY",!0),F=Je(a,"withSubchart",!0),G=Je(a,"withTransition",!0),J=Je(a,"withTransform",!1),K=Je(a,"withUpdateXDomain",!1),L=Je(a,"withUpdateOrgXDomain",!1),N=Je(a,"withUpdateTranslate",!1),M=Je(a,"withLegend",!1),H=Je(a,"withTransitionForExit",G),I=Je(a,"withTransitionForAxis",G),T=G?cg:0,U=H?T:0,W=I?T:0,c=c||vf(W),M&&qh&&Hf(Gc(Nf.data.targets),a,c),Wi&&0===ab.length&&Dg.domain([0,hj.x.selectAll(".tick").size()]),ab.length&&(L&&(Dg.domain(Mf.extent(dc(ab))),Hj=Dg.domain(),Wf&&zj.scale(Dg).updateScaleExtent(),Gg.domain(Dg.domain()),vj.scale(Gg)),K&&(Dg.domain(vj.empty()?Hj:vj.extent()),Wf&&zj.scale(Dg).updateScaleExtent()),Hh||!Gh&&!Fh||(X=Nc(Mc(ab),Fh),Jg.tickValues(X),Mg.tickValues(X))),Eg.domain(_b(ab,"y")),Fg.domain(_b(ab,"y2")),hj.x.style("opacity",_?0:1),hj.y.style("opacity",_?0:1),hj.y2.style("opacity",_?0:1),hj.subx.style("opacity",_?0:1),c.axisX.call(Jg),c.axisY.call(Kg),c.axisY2.call(Lg),c.axisSubX.call(Mg),Ib(G),N&&(p(),V(),uf(),o(!1),hj.x.call(Jg),hj.y.call(Kg),hj.y2.call(Lg),hj.subx.call(Mg)),K&&ab.length)if(Dh&&X){for(Y=1;Y=0&&Mf.select(this).style("display",b%Z?"none":"block")})}else Aj.selectAll("."+g.axisX+" .tick text").style("display","block");!wh&&Ih&&jb(hj.x,c.axisX,Ih),O=bf($),R=cf($,!0),S=cf($,!1),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Fj.style("display","none"),q(),Cj.select("line."+g.xgridFocus).style("visibility","hidden"),fi&&(f=Zd(gi,Dg),B=Wi?Jg.tickOffset():0,e=wh?{x1:0,x2:gg,y1:function(a){return Dg(a)-B},y2:function(a){return Dg(a)-B}}:{x1:function(a){return Dg(a)+B},x2:function(a){return Dg(a)+B},y1:dg.top,y2:ig},d=Cj.select("."+g.xgrids).selectAll("."+g.xgrid).data(f),d.enter().append("line").attr("class",g.xgrid),d.attr(e).style("opacity",function(){return+Mf.select(this).attr(wh?"y1":"x1")===(wh?ig:0)?0:1}),d.exit().remove()),Fe(hi)&&(h=Cj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(hi),i=h.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),i.append("line").style("opacity",0),i.append("text").attr("text-anchor","end").attr("transform",wh?"":"rotate(-90)").attr("dx",wh?0:-dg.top).attr("dy",-5).style("opacity",0),h.select("line").transition().duration(T).attr("x1",wh?0:Jd).attr("x2",wh?gg:Jd).attr("y1",wh?Jd:dg.top).attr("y2",wh?Jd:ig).style("opacity",1),h.select("text").transition().duration(T).attr("x",wh?gg:0).attr("y",Jd).text(function(a){return a.text}).style("opacity",1),h.exit().transition().duration(T).style("opacity",0).remove()),E&&ii&&(j=Cj.select("."+g.ygrids).selectAll("."+g.ygrid).data(Eg.ticks(ki)),j.enter().append("line").attr("class",g.ygrid),j.attr("x1",wh?Eg:0).attr("x2",wh?Eg:gg).attr("y1",wh?0:Eg).attr("y2",wh?ig:Eg),j.exit().remove(),pf(j,"grid")),E&&Fe(ji)&&(k=Cj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(ji),l=k.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",wh?"rotate(-90)":"").attr("dx",wh?0:-dg.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",wh?Kd:0).attr("x2",wh?Kd:gg).attr("y1",wh?0:Kd).attr("y2",wh?ig:Kd).style("opacity",1),k.select("text").transition().duration(T).attr("x",wh?0:gg).attr("y",Kd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),u=Cj.select("."+g.regions).selectAll("."+g.region).data(Hi),u.enter().append("g").attr("class",kd).append("rect").style("fill-opacity",0),u.selectAll("rect").transition().duration(T).attr("x",ic).attr("y",jc).attr("width",kc).attr("height",lc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),u.exit().transition().duration(T).style("opacity",0).remove(),s=Cj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),s.enter().append("path").attr("class",ed).style("stroke","none").style("fill",cj),s.style("opacity",wd).transition().duration(T).attr("d",O).style("fill",cj).style("opacity",1),s.exit().transition().duration(U).style("opacity",0).remove(),m=Cj.selectAll("."+g.lines).selectAll("."+g.line).data(te),m.enter().append("path").attr("class",ad).style("stroke",cj),m.style("opacity",wd).transition().duration(T).attr("d",wj).style("stroke",cj).style("opacity",1),m.exit().transition().duration(U).style("opacity",0).remove(),n=Cj.selectAll("."+g.areas).selectAll("."+g.area).data(te),n.enter().append("path").attr("class",id).style("fill",cj).style("opacity",function(){return Ij=+Mf.select(this).style("opacity"),0}),n.style("opacity",0).transition().duration(T).attr("d",xj).style("fill",cj).style("opacity",Ij),n.exit().transition().duration(U).style("opacity",0).remove(),r=Cj.selectAll("."+g.circles).selectAll("."+g.circle).data(we),r.enter().append("circle").attr("class",cd).attr("r",Ue).style("fill",cj),r.style("opacity",wd).transition().duration(T).style("opacity",yd).style("fill",cj).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d),r.exit().remove(),v=Cj.selectAll("."+g.texts).selectAll("."+g.text).data(xe),v.enter().append("text").attr("class",Yc).attr("text-anchor",function(a){return wh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",cj).style("fill-opacity",0),v.text(function(a){return Hd(a.id)(a.value,a.id)}).style("fill-opacity",xd).transition().duration(T).attr("x",R).attr("y",S).style("fill",cj).style("fill-opacity",zd),v.exit().transition().duration(U).style("fill-opacity",0).remove(),t=Cj.selectAll("."+g.arcs).selectAll("."+g.arc).data(ue),t.enter().append("path").attr("class",gd).style("fill",function(a){return cj(a.data)}).style("cursor",function(a){return eh(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;aj||(c=Jb(a),d=Pb(c),e=Xb(),Rb(c.data.id),Df(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Jb(a),c=Pb(b),d=[c];Vd(d,Mf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;aj||(c=Jb(a),d=Pb(c),e=Yb(),Sb(c.data.id),Ef(),Wd(),e(d,b))}).on("click",function(a,b){var c=Jb(a),d=Pb(c),e=Wb();lf(this,a,b),e(d,b)}),t.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){aj=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Jb(a);return c?(b=Mf.interpolate(this._current,c),this._current=b(0),function(a){return Mb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("fill",function(a){return cj(a.data)}).style("opacity",1).call(Ie,function(){aj=!1}),t.exit().transition().duration(U).style("opacity",0).remove(),Cj.selectAll("."+g.chartArc).select("text").attr("transform",Nb).style("opacity",0).transition().duration(T).text(Qb).style("opacity",function(a){return Jc(a.data.id)&&se(a.data)?1:0}),Cj.select("."+g.chartArcsTitle).style("opacity",ke(Nf.data.targets)?1:0),nh&&(Mf.event&&"zoom"===Mf.event.type&&vj.extent(Dg.orgDomain()).update(),F&&(!wh&&Ih&&jb(hj.subx,c.axisSubX,Ih),vj.empty()||vj.extent(Dg.orgDomain()).update(),Q=bf($,!0),x=Dj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),x.enter().append("path").attr("class",ed).style("stroke","none").style("fill",cj),x.style("opacity",wd).transition().duration(T).attr("d",Q).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove(),w=Dj.selectAll("."+g.lines).selectAll("."+g.line).data(te),w.enter().append("path").attr("class",ad).style("stroke",cj),w.style("opacity",wd).transition().duration(T).attr("d",yj).style("opacity",1),w.exit().transition().duration(T).style("opacity",0).remove())),Cj.selectAll("."+g.selectedCircles).filter(function(a){return oe(a)}).selectAll("circle").remove(),Cj.selectAll("."+g.selectedCircle).transition().duration(T).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d),Zf&&(y=Cj.select("."+g.eventRects),Fe(Og)&&!sc(Og)?(y.classed(g.eventRectsMultiple)||y.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),z=Cj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),kf(z.enter()),z.attr("x",0).attr("y",0).attr("width",gg).attr("height",ig)):(y.classed(g.eventRectsSingle)||y.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Xi&&!Wi?(D=function(a,b){var c=Bc(b),d=Cc(b),e=Nf.data.xs[a.id][b];return(Dg(d?d:e+50)-Dg(c?c:e-50))/2},C=function(a,b){var c=Bc(b),d=Nf.data.xs[a.id][b];return(Dg(d)+Dg(c?c:d-50))/2}):(D=P(),C=function(a){return Dg(a.x)-D/2}),A=Ec(Nf.data.targets),Cj.select("."+g.eventRects).datum(A?A.values:[]),z=Cj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),jf(z.enter()),z.attr("class",ld).attr("x",wh?0:C).attr("y",wh?C:0).attr("width",wh?gg:D).attr("height",wh?D:ig),z.exit().remove())),Gc(Nf.data.targets).forEach(function(a){Jj[a]=!0})}function rf(){qf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function sf(){if(0!==Lc(Nf.data.targets).length){if("mousemove"===Mf.event.sourceEvent.type&&zj.altDomain)return Dg.domain(zj.altDomain),void zj.scale(Dg).updateScaleExtent();Wi&&Dg.orgDomain()[0]===Hj[0]&&Dg.domain([Hj[0]-1e-10,Dg.orgDomain()[1]]),qf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Mf.event.sourceEvent.type&&($i=!0)}}function tf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function uf(){Aj.attr("width",kg).attr("height",lg),Aj.select("#"+Pi).select("rect").attr("width",gg).attr("height",ig),Aj.select("#"+Qi).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),Aj.select("#"+Ri).select("rect").attr("x",H).attr("y",I).attr("width",N).attr("height",O),Aj.select("."+g.zoomRect).attr("width",gg).attr("height",ig),Gj.style("max-height",lg+"px")}function vf(a){return{axisX:a?hj.x.transition().duration(a):hj.x,axisY:a?hj.y.transition().duration(a):hj.y,axisY2:a?hj.y2.transition().duration(a):hj.y2,axisSubX:a?hj.subx.transition().duration(a):hj.subx}}function wf(a){var b;a=a||{},a.withTransition=Je(a,"withTransition",!0),a.withTransform=Je(a,"withTransform",!1),a.withLegend=Je(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withLegend&&qh||(b=vf(a.withTransitionForAxis?cg:0),p(),V(),uf(),o(a.withTransition,b)),qf(a,b)}function xf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=Cj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",nd),j=i.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Zc),e=Cj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),d=e.enter().append("g").attr("class",pd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",fd).style("cursor",function(a){return eh(a)?"pointer":null}),c=Cj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),b=c.enter().append("g").attr("class",od).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",bd),b.append("g").attr("class",jd),b.append("g").attr("class",function(a){return Xc(g.selectedCircles,a.id)}),b.append("g").attr("class",dd).style("cursor",function(a){return eh(a)?"pointer":null}),a.forEach(function(a){Cj.selectAll("."+g.selectedCircles+rd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Cj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(ug(a)).attr("class",qd),f=h.enter().append("g").attr("class",qd),f.append("g").attr("class",hd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),nh&&(n=Dj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),m=n.enter().append("g").style("opacity",0).attr("class",pd),m.append("g").attr("class",fd),l=Dj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),k=l.enter().append("g").style("opacity",0).attr("class",od),k.append("g").attr("class",bd)),Aj.selectAll("."+g.target).filter(function(a){return Jc(a.id)}).transition().duration(cg).style("opacity",1)}function yf(a,b){b.filter&&(a=a.filter(b.filter)),(b.type||b.types)&&a.forEach(function(a){b.types?fe(a.id,b.types[a.id]):fe(a.id,b.type)}),Nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,z=0,F++)),E[a]=F,D[F]=f,A[a]=z,z+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+v)/10),j=10*Math.ceil((h.height+u)/10),k=nj?j:i,l=nj?U():T();return d&&(z=0,F=0,w=0,x=0),qh&&!Kc(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=i,C[c]=j,(!w||i>=w)&&(w=i),(!x||j>=x)&&(x=j),g=nj?x:w,void(vh?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(l-g*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=26,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=Ej.selectAll("."+g.legendItemFocused).size();b=b||{},n=Je(b,"withTransition",!0),q=Je(b,"withTransitionForTransform",!0),nj?(f=function(a){return w*E[a]},j=function(a){return D[E[a]]+A[a]}):(f=function(a){return D[E[a]]+A[a]},j=function(a){return x*E[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=Ej.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Xc(g.legendItem,a)}).style("visibility",function(a){return Kc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof sh?sh(a):Nf.toggle(a)}).on("mouseover",function(a){Mf.select(this).classed(g.legendItemFocused,!0),aj||Nf.focus(a),"function"==typeof th&&th(a)}).on("mouseout",function(a){Mf.select(this).classed(g.legendItemFocused,!1),aj||Nf.revert(),"function"==typeof uh&&uh(a)}),m.append("text").text(function(a){return d(Rg[a])?Rg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",nj?h:-200).attr("y",nj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",nj?i:-200).attr("y",nj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",cj).attr("x",nj?h:-200).attr("y",nj?-200:j).attr("width",10).attr("height",10),r=Ej.selectAll("text").data(a).text(function(a){return d(Rg[a])?Rg[a]:a}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=Ej.selectAll("rect."+g.legendItemEvent).data(a),(n?s.transition():s).attr("width",function(a){return B[a]}).attr("height",function(a){return C[a]}).attr("x",i).attr("y",l),t=Ej.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",cj).attr("x",f).attr("y",j),Ej.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Jc(a)}).transition().style("opacity",function(a){var b=Mf.select(this);return Jc(a)?!G||b.classed(g.legendItemFocused)?Bf(b):Cf(b):rj}),R(w),S(x),Q(F),p(),V(),uf(),o(q,c)}function If(a){return Ic(Nf.data.targets,a.id)}function Jf(a){return"data"in a&&Ic(Nf.data.targets,a.data.id)}function Kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function Lf(a,b,c){var d=!le(Nf.data.targets);aj=!1,fe(a,b),wf(c||{withTransitionForAxis:d})}var Mf=a.d3?a.d3:a.require?a.require("d3"):void 0,Nf={data:{},axis:{},legend:{}},Of={},Pf=i(["bindto"],"#chart"),Qf=i(["size","width"]),Rf=i(["size","height"]),Sf=i(["padding","left"]),Tf=i(["padding","right"]),Uf=i(["padding","top"]),Vf=i(["padding","bottom"]),Wf=i(["zoom","enabled"],!1),Xf=i(["zoom","extent"]),Yf=i(["zoom","privileged"],!1),Zf=i(["interaction","enabled"],!0),$f=i(["onenter"],function(){}),_f=i(["onleave"],function(){}),ag=i(["onresize"],function(){}),bg=i(["onresized"],function(){}),cg=i(["transition","duration"],350);h("data","data is required in config");var dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg,Kg,Lg,Mg,Ng=i(["data","x"]),Og=i(["data","xs"],{}),Pg=i(["data","x_format"]),Qg=i(["data","id_converter"],function(a){return a}),Rg=i(["data","names"],{}),Sg=i(["data","classes"],{}),Tg=i(["data","groups"],[]),Ug=i(["data","axes"],{}),Vg=i(["data","type"]),Wg=i(["data","types"],{}),Xg=i(["data","labels"],{}),Yg=i(["data","order"]),Zg=i(["data","regions"],{}),$g=i(["data","color"]),_g=i(["data","colors"],{}),ah=i(["data","hide"],!1),bh=i(["data","filter"]),ch=i(["data","selection","enabled"],!1),dh=i(["data","selection","grouped"],!1),eh=i(["data","selection","isselectable"],function(){return!0}),fh=i(["data","selection","multiple"],!0),gh=i(["data","onclick"],function(){}),hh=i(["data","onenter"],function(){}),ih=i(["data","onleave"],function(){}),jh=i(["data","onselected"],function(){}),kh=i(["data","onunselected"],function(){}),lh=i(["data","ondragstart"],function(){}),mh=i(["data","ondragend"],function(){}),nh=i(["subchart","show"],!1),oh=i(["subchart","size","height"],60),ph=i(["color","pattern"],[]),qh=i(["legend","show"],!0),rh=i(["legend","position"],"bottom"),sh=i(["legend","item","onclick"]),th=i(["legend","item","onmouseover"]),uh=i(["legend","item","onmouseout"]),vh=i(["legend","equally"],!1),wh=i(["axis","rotated"],!1),xh=i(["axis","x","show"],!0),yh=i(["axis","x","type"],"indexed"),zh=i(["axis","x","localtime"],!0),Ah=i(["axis","x","categories"],[]),Bh=i(["axis","x","tick","centered"],!1),Ch=i(["axis","x","tick","format"]),Dh=i(["axis","x","tick","culling"],{}),Eh=i(["axis","x","tick","culling","max"],10),Fh=i(["axis","x","tick","count"]),Gh=i(["axis","x","tick","fit"],!0),Hh=i(["axis","x","tick","values"],null),Ih=i(["axis","x","tick","rotate"]),Jh=i(["axis","x","max"],null),Kh=i(["axis","x","min"],null),Lh=i(["axis","x","padding"],{}),Mh=i(["axis","x","height"]),Nh=i(["axis","x","default"]),Oh=i(["axis","x","label"],{}),Ph=i(["axis","y","show"],!0),Qh=i(["axis","y","max"]),Rh=i(["axis","y","min"]),Sh=i(["axis","y","center"]),Th=i(["axis","y","label"],{}),Uh=i(["axis","y","inner"],!1),Vh=i(["axis","y","tick","format"]),Wh=i(["axis","y","padding"]),Xh=i(["axis","y","ticks"],10),Yh=i(["axis","y2","show"],!1),Zh=i(["axis","y2","max"]),$h=i(["axis","y2","min"]),_h=i(["axis","y2","center"]),ai=i(["axis","y2","label"],{}),bi=i(["axis","y2","inner"],!1),ci=i(["axis","y2","tick","format"]),di=i(["axis","y2","padding"]),ei=i(["axis","y2","ticks"],10),fi=i(["grid","x","show"],!1),gi=i(["grid","x","type"],"tick"),hi=i(["grid","x","lines"],[]),ii=i(["grid","y","show"],!1),ji=i(["grid","y","lines"],[]),ki=i(["grid","y","ticks"],10),li=i(["point","show"],!0),mi=i(["point","r"],2.5),ni=i(["point","focus","line","enabled"],!0),oi=i(["point","focus","expand","enabled"],!0),pi=i(["point","focus","expand","r"]),qi=i(["point","focus","select","r"]),ri=i(["line","connect_null"],!1),si=i(["bar","width"]),ti=i(["bar","width","ratio"],.6),ui=i(["pie","label","show"],!0),vi=i(["pie","label","format"]),wi=i(["pie","expand"],!0),xi=i(["pie","onclick"],function(){}),yi=i(["pie","onmouseover"],function(){}),zi=i(["pie","onmouseout"],function(){}),Ai=i(["donut","label","show"],!0),Bi=i(["donut","label","format"]),Ci=i(["donut","expand"],!0),Di=i(["donut","title"],""),Ei=i(["donut","onclick"],function(){}),Fi=i(["donut","onmouseover"],function(){}),Gi=i(["donut","onmouseout"],function(){}),Hi=i(["regions"],[]),Ii=i(["tooltip","show"],!0),Ji=i(["tooltip","format","title"]),Ki=i(["tooltip","format","value"]),Li=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Ji?Ji:b,l=Ki?Ki:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Mi=i(["tooltip","init","show"],!1),Ni=i(["tooltip","init","x"],0),Oi=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Pi=("string"==typeof Pf?Pf.replace(/[# .>~+]/g,""):g.chart+ +new Date)+"-clip",Qi=Pi+"-xaxis",Ri=Pi+"-yaxis",Si=j(Pi),Ti=j(Qi),Ui=j(Ri),Vi="timeseries"===yh,Wi="categorized"===yh,Xi=!Vi&&(Ng||Fe(Og)),Yi=null,Zi=!1,$i=!1,_i=!1,aj=!1,bj=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],cj=ze(_g,Fe(ph)?ph:bj,$g),dj=zh?Mf.time.format:Mf.time.format.utc,ej=dj.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),fj=[],gj=[],hj={},ij=wh?"left":"bottom",jj=wh?Uh?"top":"bottom":Uh?"right":"left",kj=wh?bi?"bottom":"top":bi?"left":"right",lj=wh?"left":"bottom",mj={main:function(){return"translate("+k(dg.left)+","+k(dg.top)+")"},context:function(){return"translate("+k(eg.left)+","+k(eg.top)+")"},legend:function(){return"translate("+fg.left+","+fg.top+")"},x:function(){return"translate(0,"+(wh?0:ig)+")"},y:function(){return"translate(0,"+(wh?ig:0)+")" +},y2:function(){return"translate("+(wh?0:gg)+","+(wh?1:0)+")"},subx:function(){return"translate(0,"+(wh?0:jg)+")"},arc:function(){return"translate("+pg/2+","+qg/2+")"}},nj="right"===rh,oj=0,pj=0,qj=0,rj=.15,sj=30,tj=wh&&!xh?0:30,uj=5;ug=Mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var vj,wj=function(){var a=Mf.svg.line().x(wh?function(a){return $(a.id)(a.value)}:Id).y(wh?Id:function(a){return $(a.id)(a.value)});return ri||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ri?Te(b.values):b.values;return me(b)?(a.interpolate(ne(b)?"cardinal":"linear"),Zg[b.id]?gf(e,Dg,$(b.id),Zg[b.id]):a(e)):(c=e[0]?Dg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,wh?"M "+d+" "+c:"M "+c+" "+d)}}(),xj=function(){var a;return a=wh?Mf.svg.area().x0(function(a){return $(a.id)(0)}).x1(function(a){return $(a.id)(a.value)}).y(Id):Mf.svg.area().x(Id).y0(function(a){return $(a.id)(0)}).y1(function(a){return $(a.id)(a.value)}),function(b){var c,d,e=Te(b.values);return ge([b],"area")||ge([b],"area-spline")?(a.interpolate(ne(b)?"cardinal":"linear"),a(e)):(c=e[0]?Dg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,wh?"M "+d+" "+c:"M "+c+" "+d)}}(),yj=function(){var a=Mf.svg.line().x(wh?function(a){return _(a.id)(a.value)}:Ld).y(wh?Ld:function(a){return _(a.id)(a.value)});return function(b){var c=Te(b.values);return me(b)?a(c):"M "+Gg(c[0].x)+" "+_(b.id)(c[0].value)}}(),zj=function(){};vj=Mf.svg.brush().on("brush",rf),vj.update=function(){return Dj&&Dj.select("."+g.brush).call(this),this},vj.scale=function(a){return wh?this.y(a):this.x(a)},Wf&&(zj=Mf.behavior.zoom().on("zoomstart",function(){zj.altDomain=Mf.event.sourceEvent.altKey?Dg.orgDomain():null}).on("zoom",Wf?sf:null),zj.scale=function(a){return wh?this.y(a):this.x(a)},zj.orgScaleExtent=function(){var a=Xf?Xf:[1,10];return[a[0],Math.max(Dc()/a[1],a[1])]},zj.updateScaleExtent=function(){var a=ec(Dg.orgDomain())/ec(Hj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Aj,Bj,Cj,Dj,Ej,Fj,Gj,Hj,Ij,Jj={};if(Nf.focus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);Nf.revert(),Nf.defocus(),b(d.classed(g.focused,!0)),b(e),le(Nf.data.targets)&&Rb(a,!0),Df(a,!0)},Nf.defocus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",.3)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);Nf.revert(),b(d.classed(g.focused,!1)),b(e),le(Nf.data.targets)&&Sb(a),Df(a,!1)},Nf.revert=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);b(d.classed(g.focused,!1)),b(e),le(Nf.data.targets)&&Sb(a),Ef()},Nf.show=function(a,b){a=Hc(a),b=b||{},Pc(a),Aj.selectAll(td(a)).transition().style("opacity",1),b.withLegend&&Ff(a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Nf.hide=function(a,b){a=Hc(a),b=b||{},Oc(a),Aj.selectAll(td(a)).transition().style("opacity",0),b.withLegend&&Gf(a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Nf.toggle=function(a){Jc(a)?Nf.hide(a):Nf.show(a)},Nf.unzoom=function(){vj.clear().update(),qf({withUpdateXDomain:!0})},Nf.load=function(a){return a.xs&&rc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Sg[b]=a.classes[b]}),"categories"in a&&Wi&&(Ah=a.categories,Jg.categories(Ah)),"cacheIds"in a&&fc(a.cacheIds)?void yf(hc(a.cacheIds),a.done):void("unload"in a?Af(Hc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){zf(a)}):zf(a))},Nf.unload=function(a,b){Af(Hc(a),function(){qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Nf.selected=function(a){return Mf.merge(Cj.selectAll("."+g.shapes+rd(a)).selectAll("."+g.shape).filter(function(){return Mf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Nf.select=function(a,b,c){ch&&Cj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Mf.select(this),i=e.data?e.data.id:e.id,j=Se(this),k=dh||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);"path"!==this.nodeName&&(k&&l?eh(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},Nf.unselect=function(a,b){ch&&Cj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Mf.select(this),f=c.data?c.data.id:c.id,h=Se(this),i=dh||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);"path"!==this.nodeName&&i&&j&&eh(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Nf.toLine=function(a){Lf(a,"line")},Nf.toSpline=function(a){Lf(a,"spline")},Nf.toBar=function(a){Lf(a,"bar")},Nf.toScatter=function(a){Lf(a,"scatter")},Nf.toArea=function(a){Lf(a,"area")},Nf.toAreaSpline=function(a){Lf(a,"area-spline")},Nf.toPie=function(a){Lf(a,"pie",{withTransform:!0})},Nf.toDonut=function(a){Lf(a,"donut",{withTransform:!0})},Nf.groups=function(a){return c(a)?Tg:(Tg=a,qf(),Tg)},Nf.xgrids=function(a){return a?(hi=a,qf(),hi):hi},Nf.xgrids.add=function(a){return a?Nf.xgrids(hi.concat(a)):void 0},Nf.xgrids.remove=function(a){var b=Kf(a);return Nf.xgrids(hi.filter(b))},Nf.ygrids=function(a){return a?(ji=a,qf(),ji):ji},Nf.ygrids.add=function(a){return a?Nf.ygrids(ji.concat(a)):void 0},Nf.ygrids.remove=function(a){var b=Kf(a);return Nf.ygrids(ji.filter(b))},Nf.regions=function(a){return a?(Hi=a,qf(),Hi):Hi},Nf.regions.add=function(a){return a?(Hi=Hi.concat(a),qf(),Hi):Hi},Nf.regions.remove=function(a){var b,c,d;return a=a||{},b=Je(a,"duration",cg),c=Je(a,"classes",[g.region]),d=Cj.select("."+g.regions).selectAll(c.map(function(a){return"."+a})),(b?d.transition().duration(b):d).style("opacity",0).remove(),Hi=Hi.filter(function(a){return c.indexOf(a.class)<0})},Nf.data.get=function(a){var b=Nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Nf.data.getAsTarget=function(a){var b=Nf.data.targets.filter(function(b){return b.id===a});return b.length>0?b[0]:void 0},Nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Rg[b]=a[b]}),qf({withLegend:!0}),Rg):Rg},Nf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){_g[b]=a[b]}),qf({withLegend:!0}),_g):_g},Nf.x=function(a){return arguments.length&&(uc(Nf.data.targets,a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Nf.data.xs},Nf.xs=function(a){return arguments.length&&(vc(Nf.data.targets,a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Nf.data.xs},Nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){gb(b,a[b])}),Ib())},Nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Jh=+a.x),b(a.y)&&(Qh=+a.y),b(a.y2)&&(Zh=+a.y2)):Qh=Zh=+a,qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Kh=+a.x),b(a.y)&&(Rh=+a.y),b(a.y2)&&($h=+a.y2)):Rh=$h=+a,qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Nf.axis.max(a.max),"undefined"!=typeof a.min&&Nf.axis.min(a.min))},Nf.legend.show=function(a){Ff(Hc(a)),qf({withLegend:!0})},Nf.legend.hide=function(a){Gf(Hc(a)),qf({withLegend:!0})},Nf.resize=function(a){Qf=a?a.width:null,Rf=a?a.height:null,wf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Nf.destroy=function(){Nf.data.targets=void 0,Nf.data.xs={},Gj.html(""),a.onresize=null},"url"in f.data)Mf.xhr(f.data.url,function(a,b){var c,d=Mf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Mf.csv.parse(b.response),hf(c)});else if("rows"in f.data)hf(xc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");hf(yc(f.data.columns))}return Nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(window); \ No newline at end of file From a4bb085b4d3dbdea72bba3987339c0bc9fa9d337 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Sat, 10 May 2014 10:21:41 +0900 Subject: [PATCH 163/178] Fix overflow when chart slide on ie9/10 --- c3.js | 1 + c3.min.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/c3.js b/c3.js index da36b3c..98ed71d 100644 --- a/c3.js +++ b/c3.js @@ -2490,6 +2490,7 @@ // Define svgs svg = selectChart.append("svg") + .style("overflow", "hidden") .on('mouseenter', __onenter) .on('mouseleave', __onleave); diff --git a/c3.min.js b/c3.min.js index 6a08423..ad8b689 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ !function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.round(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.round(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&a=0;return"url("+(c?"":document.URL.split("#")[0])+"#"+b+")"}function k(a){return Math.ceil(a)+.5}function l(a,b){var c,d,e;b&&b.axisX?c=b.axisX:(c=Cj.select("."+g.axisX),a&&(c=c.transition())),b&&b.axisY?d=b.axisY:(d=Cj.select("."+g.axisY),a&&(d=d.transition())),b&&b.axisY2?e=b.axisY2:(e=Cj.select("."+g.axisY2),a&&(e=e.transition())),Cj.attr("transform",mj.main),c.attr("transform",mj.x),d.attr("transform",mj.y),e.attr("transform",mj.y2),Cj.select("."+g.chartArcs).attr("transform",mj.arc)}function m(a,b){var c;b&&b.axisSubX?c=b.axisSubX:(c=Dj.select("."+g.axisX),a&&(c=c.transition())),Dj.attr("transform",mj.context),c.attr("transform",mj.subx)}function n(a){(a?Ej.transition():Ej).attr("transform",mj.legend)}function o(a,b){l(a,b),nh&&m(a,b),n(a)}function p(){var a=U(),b=T(),c=nj?0:a,d=le(Nf.data.targets),e=wh||d?0:A("x"),f=nh&&!d?oh+e:0;kg=t(),lg=u(),wh?(dg={top:A("y2")+v(),right:d?0:y(),bottom:A("y")+c+w(),left:f+(d?0:x())},eg={top:dg.top,right:0/0,bottom:20+c,left:sj}):(dg={top:4+v(),right:d?0:y(),bottom:e+f+c+w(),left:d?0:x()},eg={top:lg-f-c,right:0/0,bottom:e+c,left:dg.left}),fg={top:nj?0:lg-a,right:0/0,bottom:0,left:nj?kg-b:0},gg=kg-dg.left-dg.right,ig=lg-dg.top-dg.bottom,0>gg&&(gg=0),0>ig&&(ig=0),hg=wh?dg.left-sj-tj:gg,jg=wh?ig:lg-eg.top-eg.bottom,0>hg&&(hg=0),0>jg&&(jg=0),pg=gg-(nj?b+10:0),qg=ig-(nj?0:10),r(),nj&&d&&(fg.left=pg/2+1.1*ng)}function q(){Cj.select("line."+g.xgridFocus).attr("x1",wh?0:-10).attr("x2",wh?gg:-10).attr("y1",wh?-10:dg.top).attr("y2",wh?-10:ig)}function r(){ng=Math.min(pg,qg)/2,mg=.95*ng,og=ke(Nf.data.targets)?.6*mg:0}function s(){var a=wh?g.axisX:g.axisY,b=Cj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Gj.node().getBoundingClientRect(),e=le(Nf.data.targets),f=c.right-d.left-(e?0:x());return f>0?f:0}function t(){return Qf?Qf:B()}function u(){var a=Rf?Rf:C();return a>0?a:320}function v(){return Uf?Uf:0}function w(){return Vf?Vf:0}function x(){return Sf?Sf:wh?xh?Ke(z("x")):1:!Ph||Uh?1:Ke(z("y"))}function y(){var a=10,b=nj?T()+20:0;return Tf?Tf:wh?a+b:(!Yh||bi?a:Ke(z("y2")))+b}function z(a){var b=ob(a);return b.isInner?20+Hb(a):40+Hb(a)}function A(a){return"x"!==a||xh?"x"===a&&Mh?Mh:"y"!==a||Ph?"y2"!==a||Yh?(ob(a).isInner?30:40)+("y2"===a?-10:0):uj:qh&&!nj?10:1:0}function B(){return+Gj.style("width").replace("px","")}function C(){return+Gj.style("height").replace("px","")}function D(a){return a?-31:-(dg.left-1)}function E(a){return a?-20:-4}function F(){return D(!wh)}function G(){return E(!wh)}function H(){return D(wh)}function I(){return E(wh)}function J(a){return a?gg+2+30+30:dg.left+20}function K(a){return a?(Mh?Mh:0)+80:ig+8}function L(){return J(!wh)}function M(){return K(!wh)}function N(){return J(wh)}function O(){return K(wh)}function P(){var a,b,c,d,e,f=Ec(Nf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=Dg(b.x)-Dg(a.x),0===c?wh?ig:gg:(d=Dc(),e=he(Nf.data.targets)?(d-(Wi?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function Q(a){oj=a}function R(a){pj=a}function S(a){qj=a}function T(){return qh?nj?pj*(oj+1):kg:0}function U(){return qh?nj?lg:qj*(oj+1):0}function V(){var a,b,c=!Dg;vg=wh?1:0,wg=wh?ig:gg,xg=wh?0:ig,yg=wh?gg:1,zg=vg,Ag=wg,Bg=wh?0:jg,Cg=wh?hg:1,Dg=Y(vg,wg,c?void 0:Dg.domain(),function(){return Jg.tickOffset()}),Eg=Z(xg,yg,c?void 0:Eg.domain()),Fg=Z(xg,yg,c?void 0:Fg.domain()),Gg=Y(vg,wg,Hj,function(a){return a%1?0:Mg.tickOffset()}),Hg=Z(Bg,Cg,c?void 0:Hg.domain()),Ig=Z(Bg,Cg,c?void 0:Ig.domain()),a=db(),b=Hh?Hh:c?void 0:Jg.tickValues(),Jg=ab(Dg,ij,a,b),Mg=ab(Gg,lj,a,b),Kg=bb(Eg,jj,Vh,Xh),Lg=bb(Fg,kj,ci,ei),c||(vj.scale(Gg),Wf&&zj.scale(Dg)),W()}function W(){rg=Kb(),sg=Lb(),tg=Lb(.98)}function X(a,b,c){return(c?Mf.time.scale():Mf.scale.linear()).range([a,b])}function Y(a,b,c,d){var e,f=X(a,b,Vi),g=c?f.domain(c):f;Wi?(d=d||function(){return 0},f=function(a,b){var c=g(a)+d(a);return b?c:Math.ceil(c)}):f=function(a,b){var c=g(a);return b?c:Math.ceil(c)};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return Hj&&Hj[0]===a[0]&&Hj[1]a?a.toFixed(0):a};return Ch&&("function"==typeof Ch?a=Ch:Vi&&(a=function(a){return a?dj(Ch)(a):""})),a}function eb(a){var b;return"y"===a?b=Th:"y2"===a?b=ai:"x"===a&&(b=Oh),b}function fb(a){var b=eb(a);return"string"==typeof b?b:b?b.text:null}function gb(a,b){var c=eb(a);"string"==typeof c?"y"===a?Th=b:"y2"===a?ai=b:"x"===a&&(Oh=b):c&&(c.text=b)}function hb(a){return 10*Math.sin(Math.PI*(a/180))}function ib(a){return 11.5-2.5*(a/15)}function jb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",ib(c)).attr("x",hb(c)).attr("transform","rotate("+c+")")}function kb(a,b){var c=eb(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 lb(){return kb("x",wh?"inner-top":"inner-right")}function mb(){return kb("y",wh?"inner-right":"inner-top")}function nb(){return kb("y2",wh?"inner-right":"inner-top")}function ob(a){return"y2"===a?nb():"y"===a?mb():lb()}function pb(){return fb("x")}function qb(){return fb("y")}function rb(){return fb("y2")}function sb(a,b){return a?b.isLeft?0:b.isCenter?gg/2:gg:b.isBottom?-ig:b.isMiddle?-ig/2:0}function tb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function ub(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function vb(){return sb(!wh,lb())}function wb(){return sb(wh,mb())}function xb(){return sb(wh,nb())}function yb(){return tb(!wh,lb())}function zb(){return tb(wh,mb())}function Ab(){return tb(wh,nb())}function Bb(){var a=lb();return wh?a.isInner?"1.2em":-25-Hb("x"):a.isInner?"-0.5em":Mh?Mh-10:"3em"}function Cb(){var a=mb();return wh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Hb("y")}function Db(){var a=nb();return wh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Hb("y2")}function Eb(){return ub(!wh,lb())}function Fb(){return ub(wh,mb())}function Gb(){return ub(wh,nb())}function Hb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Ib(a){var b=Cj.select("."+g.axisX+" ."+g.axisXLabel),c=Cj.select("."+g.axisY+" ."+g.axisYLabel),d=Cj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",vb).attr("dx",yb).attr("dy",Bb).text(pb),(a?c.transition():c).attr("x",wb).attr("dx",zb).attr("dy",Cb).attr("dy",Cb).text(qb),(a?d.transition():d).attr("x",xb).attr("dx",Ab).attr("dy",Db).text(rb)}function Jb(a){var b=!1;return ug(Lc(Nf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Kb(){var a=Mf.svg.arc().outerRadius(mg).innerRadius(og),b=function(b,c){var d;return c?a(b):(d=Jb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Lb(a){var b=Mf.svg.arc().outerRadius(ng*(a?a:1)).innerRadius(og);return function(a){var c=Jb(a);return c?b(c):"M 0 0"}}function Mb(a,b){return se(a.data)?rg(a,b):"M 0 0"}function Nb(a){var b,c,d,e,f=Jb(a),g="";return f&&(b=rg.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*mg*.8+","+d/e*mg*.8+")"),g}function Ob(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Pb(a){return tc({id:a.data.id,value:a.value,ratio:Ob(a)})}function Qb(a){var b,c,d,e;return Tb()?(b=Jb(a),c=b?b.value:null,d=Ob(b),e=Ub(),e?e(c,d):Gd(c,d)):""}function Rb(a,b){var c=Aj.selectAll("."+g.chartArc+sd(a)),d=Aj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});ye(a)&&c.selectAll("path").transition().duration(50).attr("d",sg).transition().duration(100).attr("d",tg).each(function(a){re(a.data)}),b||d.style("opacity",.3)}function Sb(a){var b=Aj.selectAll("."+g.chartArc+sd(a));b.selectAll("path").transition().duration(50).attr("d",rg),Aj.selectAll("."+g.arc).style("opacity",1)}function Tb(){return ke(Nf.data.targets)?Ai:ui}function Ub(){return ke(Nf.data.targets)?Bi:vi}function Vb(){return ke(Nf.data.targets)?Di:""}function Wb(){var a=ke(Nf.data.targets)?Ei:xi;return"function"==typeof a?a:function(){}}function Xb(){var a=ke(Nf.data.targets)?Fi:yi;return"function"==typeof a?a:function(){}}function Yb(){var a=ke(Nf.data.targets)?Gi:zi;return"function"==typeof a?a:function(){}}function Zb(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Tg.length>0)for(g=Uc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return Mf.min(Object.keys(i).map(function(a){return Mf.min(i[a])}))}function $b(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Tg.length>0)for(g=Vc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return Mf.max(Object.keys(i).map(function(a){return Mf.max(i[a])}))}function _b(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return cb(a.id)===c}),m="y2"===c?$h:Rh,n="y2"===c?Zh:Qh,o=b(m)?m:Zb(l),p=b(n)?n:$b(l),q="y2"===c?_h:Sh,r=Ad()&&wh;return 0===l.length?"y2"===c?Fg.domain():Eg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=Bd(o,p),j=ec(Eg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Wh&&(f=b(Wh.top)?Wh.top:e,g=b(Wh.bottom)?Wh.bottom:e),"y2"===c&&di&&(f=b(di.top)?di.top:e,g=b(di.bottom)?di.bottom:e),he(l)&&!Uc(l)&&(g=o),[o-g,p+f])}function ac(a){return Kh?Vi?Ae(Kh):Kh:Mf.min(a,function(a){return Mf.min(a.values,function(a){return a.x})})}function bc(a){return Jh?Vi?Ae(Jh):Jh:Mf.max(a,function(a){return Mf.max(a.values,function(a){return a.x})})}function cc(a){var c,d,e,f,g=Fc(a),h=g[1]-g[0];return Wi?d=0:he(a)?(c=Dc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Lh&&Fe(Lh)?(e=b(Lh.left)?Lh.left:d,f=b(Lh.right)?Lh.right:d):e=f="number"==typeof Lh?Lh:d,{left:e,right:f}}function dc(a){var b=[ac(a),bc(a)],c=b[0],d=b[1],e=cc(a),f=0,g=0;return c-d!==0||Wi||(c=Vi?new Date(.5*c.getTime()):-.5,d=Vi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ec(a){return a[1]-a[0]}function fc(a){for(var b=0;bb?0:b-c}function lc(a){var b,c=jc(a),d="y"===a.axis?Eg:Fg;return b="y"===a.axis||"y2"===a.axis?wh?ig:"start"in a?d(a.start):ig:wh?"end"in a?Dg(Vi?Ae(a.end):a.end):ig:ig,c>b?0:b-c}function mc(a){return Ng&&a===Ng||Fe(Og)&&Ge(Og,a)}function nc(a){return!mc(a)}function oc(a){return Ng?Ng:Fe(Og)?Og[a]:null}function pc(a,b){var c,d=b&&Fe(b)?Gc(b):[];return d.forEach(function(b){oc(b)===a&&(c=Nf.data.xs[b])}),c}function qc(a,b){return a in Nf.data.xs&&Nf.data.xs[a]&&Nf.data.xs[a][b]?Nf.data.xs[a][b]:b}function rc(a){Object.keys(a).forEach(function(b){Og[b]=a[b]})}function sc(a){return 1===Mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function tc(a){var b;return a&&(b=Rg[a.id],a.name=b?b:a.id),a}function uc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=wc(b[d],a.id,d)}),Nf.data.xs[a.id]=b})}function vc(a,b){a.forEach(function(a){b[a.id]&&uc([a],b[a.id])})}function wc(a,c,d){var e;return e=Vi?a?a instanceof Date?a:Ae(a):Ae(qc(c,d)):Xi&&!Wi?b(a)?+a:qc(c,d):d}function xc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Ng?(d=Object.keys(Nf.data.xs),Nf.data.xs[c]=d.length>0?Nf.data.xs[d[0]]:void 0):Fe(Og)&&(Nf.data.xs[c]=pc(f,Nf.data.targets)):Nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Qg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=oc(b),g=a[f],h=wc(g,b,e);return Xi&&Wi&&0===c&&g&&(0===e&&(Ah=[]),Ah.push(g)),("undefined"==typeof a[b]||Nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Vg&&fe(Gc(c).filter(function(a){return!(a in Wg)}),Vg),c.forEach(function(a){gc(a.id_org,a)}),c}function Ac(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 Bc(a){return a>0&&Nf.data.targets[0].values[a-1]?Nf.data.targets[0].values[a-1].x:void 0}function Cc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Fc(a){var b,c,d=Ec(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Gc(a){return a.map(function(a){return a.id})}function Hc(a){return a?"string"==typeof a?[a]:a:Gc(Nf.data.targets)}function Ic(a,b){var c,d=Gc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Vi?new Date(i):i);j.push(e)}return Vi||(j=j.sort(function(a,b){return a-b})),j}function Oc(a){fj=fj.concat(a)}function Pc(a){fj=fj.filter(function(b){return a.indexOf(b)<0})}function Qc(a){gj=gj.concat(a)}function Rc(a){gj=gj.filter(function(b){return a.indexOf(b)<0})}function Sc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Tc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Vc(a){return Tc(a,function(a){return a>0})}function Wc(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||0===a[f].x)&&(e=e.concat(Md(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Md(a,g))),Pd(e,b)):Nd(a,b,f,g)}function Od(a,b){var c;return c=a.map(function(a){return Nd(a.values,b)}),Pd(c,b)}function Pd(a,b){var c,d;return a.forEach(function(a){var e=He(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Qd(a,b){return Mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Rd(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 Sd(){return Yg&&"desc"===Yg.toLowerCase()}function Td(){return Yg&&"asc"===Yg.toLowerCase()}function Ud(a){var b=Td(),c=Sd();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 Yg&&a.sort(Yg),a}function Vd(a,c){var d,e,f,g,h,i,j,k=le(Nf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&Ii&&(Fj.html(Li(a,db(),Cd(k),cj)).style("display","block"),d=Fj.property("offsetWidth"),e=Fj.property("offsetHeight"),k?(g=gg/2+c[0],i=ig/2+c[1]+20):(wh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-y(),i=Dg(l[0].x)+20):(f=s(),g=f+x()+Dg(l[0].x)+20,h=g+d,j=f+t()-y(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),Fj.style("top",i+"px").style("left",g+"px"))}function Wd(){Fj.style("display","none")}function Xd(a){var c=a.filter(function(a){return a&&b(a.value)});if(Ii&&!ie(Nf.data.targets)&&!le(Nf.data.targets)){var d=Cj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(wh?"y1":"x1",Id).attr(wh?"y2":"x2",Id),pf(d,"grid")}}function Yd(){Cj.select("line."+g.xgridFocus).style("visibility","hidden")}function Zd(a,b){var c,d,e,f,h=[],i=Cj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=dc(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function $d(a){return a.x||0===a.x?Dg(a.x):null}function _d(a){return $(a.id)(a.value)}function ae(){var a,b,d={},e=0;return Lc(Nf.data.targets.filter(oe)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ee(a,b){return"number"==typeof si?si:b?2*a.tickOffset()*ti/b:0}function fe(a,b){Hc(a).forEach(function(a){Jj[a]=b===Wg[a],Wg[a]=b})}function ge(a,b){var c=!1;return a.forEach(function(a){Wg[a.id]===b&&(c=!0),a.id in Wg||"line"!==b||(c=!0)}),c}function he(a){return ge(a,"bar")}function ie(a){return ge(a,"scatter")}function je(a){return ge(a,"pie")}function ke(a){return ge(a,"donut")}function le(a){return je(a)||ke(a)}function me(a){var b="string"==typeof a?a:a.id;return!(b in Wg)||"line"===Wg[b]||"spline"===Wg[b]||"area"===Wg[b]||"area-spline"===Wg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"spline"===Wg[b]||"area-spline"===Wg[b]}function oe(a){var b="string"==typeof a?a:a.id;return"bar"===Wg[b]}function pe(a){var b="string"==typeof a?a:a.id;return"scatter"===Wg[b]}function qe(a){var b="string"==typeof a?a:a.id;return"pie"===Wg[b]}function re(a){var b="string"==typeof a?a:a.id;return"donut"===Wg[b]}function se(a){return qe(a)||re(a)}function te(a){return me(a)?[a]:[]}function ue(a){return se(a.data)?[a]:[]}function ve(a){return oe(a)?a.values:[]}function we(a){return me(a)||pe(a)?a.values:[]}function xe(a){return oe(a)||me(a)?a.values:[]}function ye(a){return re(a)&&Ci||qe(a)&&wi}function ze(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function Ae(b){var c;try{c=Pg?Mf.time.format(Pg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Pg)}return c}function Be(a,b){var c=Mf.mouse(a),d=Mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ge(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function He(a,b){var c="y"===cb(a.id)?Eg:Fg,d=wh?1:0,e=wh?0:1;return Math.pow(Dg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ie(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Je(a,b,c){return d(a[b])?a[b]:c}function Ke(a){return 10*Math.ceil(a/10)}function Le(a,b,c){jh(b,a.node()),Cj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Xc(g.selectedCircle,c)}).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d).attr("stroke",function(){return cj(b)}).attr("r",1.4*We(b)).transition().duration(100).attr("r",We)}function Me(a,b,c){kh(b,a.node()),Cj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ne(a,b,c,d){a?Le(b,c,d):Me(b,c,d)}function Oe(a,b){jh(b,a.node()),a.transition().duration(100).style("fill",function(){return Mf.rgb(cj(b)).brighter(.75)})}function Pe(a,b){kh(b,a.node()),a.transition().duration(100).style("fill",function(){return cj(b)})}function Qe(a,b,c,d){a?Oe(b,c,d):Pe(b,c,d)}function Re(a,b,c,d){Qe(a,b,c.data,d)}function Se(a){return"circle"===a.nodeName?Ne:Mf.select(a).classed(g.bar)?Qe:Re}function Te(a){return a.filter(function(a){return b(a.value)})}function Ue(a){return li?"function"==typeof mi?mi(a):mi:0}function Ve(a){return oi?pi?pi:1.75*Ue(a):Ue(a)}function We(a){return qi?qi:4*Ue(a)}function Xe(a,c){return(c?Cj.selectAll("."+g.circles+rd(c)):Cj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ye(a,b){Xe(a,b).classed(g.EXPANDED,!0).attr("r",Ve)}function Ze(a){Xe(a).filter(function(){return Mf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Ue)}function $e(a){return Cj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function _e(a){$e(a).classed(g.EXPANDED,!0)}function af(a){$e(a).classed(g.EXPANDED,!1)}function bf(a,b){var c=ff(a,b);return function(a,b){var d=c(a,b),e=wh?1:0,f=wh?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 cf(a,b){var c=ff(a,!1),d=b?df:ef;return function(a,b){return d(c(a,b),a,this)}}function df(a,b){var c;return wh?(c=oe(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function ef(a,b,c){var d=c.getBoundingClientRect();return wh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:oe(b)?-3:-6)}function ff(a,b){var c=a.__max__+1,d=ee(Jg,c),e=be(d,c,a,!!b),f=ce(!!b),g=de(a,!!b),h=b?_:$;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return wh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function gf(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function hf(b){var c,d,e;if(Gj=Mf.select(Pf),Gj.empty())throw new Error("Element to bind not found");if(Gj.html("").classed("c3",!0),Nf.data.xs={},Nf.data.targets=zc(b),bh&&(Nf.data.targets=Nf.data.targets.filter(bh)),ah&&Oc(ah===!0?Gc(Nf.data.targets):ah),p(),V(),Dg.domain(Mf.extent(dc(Nf.data.targets))),Eg.domain(_b(Nf.data.targets,"y")),Fg.domain(_b(Nf.data.targets,"y2")),Gg.domain(Dg.domain()),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Hj=Dg.domain(),vj.scale(Gg),Wf&&zj.scale(Dg),Aj=Gj.append("svg").on("mouseenter",$f).on("mouseleave",_f),Bj=Aj.append("defs"),Bj.append("clipPath").attr("id",Pi).append("rect"),Bj.append("clipPath").attr("id",Qi).append("rect"),Bj.append("clipPath").attr("id",Ri).append("rect"),uf(),Cj=Aj.append("g").attr("transform",mj.main),Dj=Aj.append("g").attr("transform",mj.context),Ej=Aj.append("g").attr("transform",mj.legend),nh||Dj.style("visibility","hidden"),qh||(Ej.style("visibility","hidden"),gj=Gc(Nf.data.targets)),Fj=Gj.style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Hf(Gc(Nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=Cj.append("g").attr("clip-path",Si).attr("class",g.grid),fi&&d.append("g").attr("class",g.xgrids),Fe(hi)&&d.append("g").attr("class",g.xgridLines),ni&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),ii&&d.append("g").attr("class",g.ygrids),Fe(ji)&&d.append("g").attr("class",g.ygridLines),Cj.append("g").attr("clip-path",Si).attr("class",g.regions),Cj.append("g").attr("clip-path",Si).attr("class",g.chart),c=Cj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Wf?wh?"ns-resize":"ew-resize":null),Cj.select("."+g.chart).append("g").attr("class",g.chartBars),Cj.select("."+g.chart).append("g").attr("class",g.chartLines),Cj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",mj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Vb()),Cj.select("."+g.chart).append("g").attr("class",g.chartTexts),Wf&&Cj.insert("rect",Yf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",gg).attr("height",ig).style("opacity",0).style("cursor",wh?"ns-resize":"ew-resize").call(zj).on("dblclick.zoom",null),Nh&&vj.extent("function"!=typeof Nh?Nh:Nh(dc())),hj.x=Cj.append("g").attr("class",g.axisX).attr("clip-path",Ti).attr("transform",mj.x).style("visibility",xh?"visible":"hidden"),hj.x.append("text").attr("class",g.axisXLabel).attr("transform",wh?"rotate(-90)":"").style("text-anchor",Eb),hj.y=Cj.append("g").attr("class",g.axisY).attr("clip-path",Ui).attr("transform",mj.y).style("visibility",Ph?"visible":"hidden"),hj.y.append("text").attr("class",g.axisYLabel).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Fb),hj.y2=Cj.append("g").attr("class",g.axisY2).attr("transform",mj.y2).style("visibility",Yh?"visible":"hidden"),hj.y2.append("text").attr("class",g.axisY2Label).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Gb),Dj.append("g").attr("clip-path",Si).attr("class",g.chart),Dj.select("."+g.chart).append("g").attr("class",g.chartBars),Dj.select("."+g.chart).append("g").attr("class",g.chartLines),Dj.append("g").attr("clip-path",Si).attr("class",g.brush).call(vj).selectAll("rect").attr(wh?"width":"height",wh?hg:jg),hj.subx=Dj.append("g").attr("class",g.axisX).attr("transform",mj.subx).attr("clip-path",wh?"":Ti),xf(Nf.data.targets),qf({withUpdateTranslate:!0,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Mi){if(Vi&&"string"==typeof Ni){for(Ni=Ae(Ni),e=0;e0){d=[];for(var f in Rg)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Rd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Qe,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function nf(a){le(Nf.data.targets)||ch&&(Yi=a,Cj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Zi=!0,lh())}function of(){le(Nf.data.targets)||ch&&(Cj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),Cj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Zi=!1,mh())}function pf(a,b){"grid"===b&&a.each(function(){var a=Mf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function qf(a,c){var d,e,f,h,i,j,k,l,m,n,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,Q,R,S,T,U,W,X,Y,Z,$=ae(),_=le(Nf.data.targets),ab=Lc(Nf.data.targets);if(a=a||{},E=Je(a,"withY",!0),F=Je(a,"withSubchart",!0),G=Je(a,"withTransition",!0),J=Je(a,"withTransform",!1),K=Je(a,"withUpdateXDomain",!1),L=Je(a,"withUpdateOrgXDomain",!1),N=Je(a,"withUpdateTranslate",!1),M=Je(a,"withLegend",!1),H=Je(a,"withTransitionForExit",G),I=Je(a,"withTransitionForAxis",G),T=G?cg:0,U=H?T:0,W=I?T:0,c=c||vf(W),M&&qh&&Hf(Gc(Nf.data.targets),a,c),Wi&&0===ab.length&&Dg.domain([0,hj.x.selectAll(".tick").size()]),ab.length&&(L&&(Dg.domain(Mf.extent(dc(ab))),Hj=Dg.domain(),Wf&&zj.scale(Dg).updateScaleExtent(),Gg.domain(Dg.domain()),vj.scale(Gg)),K&&(Dg.domain(vj.empty()?Hj:vj.extent()),Wf&&zj.scale(Dg).updateScaleExtent()),Hh||!Gh&&!Fh||(X=Nc(Mc(ab),Fh),Jg.tickValues(X),Mg.tickValues(X))),Eg.domain(_b(ab,"y")),Fg.domain(_b(ab,"y2")),hj.x.style("opacity",_?0:1),hj.y.style("opacity",_?0:1),hj.y2.style("opacity",_?0:1),hj.subx.style("opacity",_?0:1),c.axisX.call(Jg),c.axisY.call(Kg),c.axisY2.call(Lg),c.axisSubX.call(Mg),Ib(G),N&&(p(),V(),uf(),o(!1),hj.x.call(Jg),hj.y.call(Kg),hj.y2.call(Lg),hj.subx.call(Mg)),K&&ab.length)if(Dh&&X){for(Y=1;Y=0&&Mf.select(this).style("display",b%Z?"none":"block")})}else Aj.selectAll("."+g.axisX+" .tick text").style("display","block");!wh&&Ih&&jb(hj.x,c.axisX,Ih),O=bf($),R=cf($,!0),S=cf($,!1),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Fj.style("display","none"),q(),Cj.select("line."+g.xgridFocus).style("visibility","hidden"),fi&&(f=Zd(gi,Dg),B=Wi?Jg.tickOffset():0,e=wh?{x1:0,x2:gg,y1:function(a){return Dg(a)-B},y2:function(a){return Dg(a)-B}}:{x1:function(a){return Dg(a)+B},x2:function(a){return Dg(a)+B},y1:dg.top,y2:ig},d=Cj.select("."+g.xgrids).selectAll("."+g.xgrid).data(f),d.enter().append("line").attr("class",g.xgrid),d.attr(e).style("opacity",function(){return+Mf.select(this).attr(wh?"y1":"x1")===(wh?ig:0)?0:1}),d.exit().remove()),Fe(hi)&&(h=Cj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(hi),i=h.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),i.append("line").style("opacity",0),i.append("text").attr("text-anchor","end").attr("transform",wh?"":"rotate(-90)").attr("dx",wh?0:-dg.top).attr("dy",-5).style("opacity",0),h.select("line").transition().duration(T).attr("x1",wh?0:Jd).attr("x2",wh?gg:Jd).attr("y1",wh?Jd:dg.top).attr("y2",wh?Jd:ig).style("opacity",1),h.select("text").transition().duration(T).attr("x",wh?gg:0).attr("y",Jd).text(function(a){return a.text}).style("opacity",1),h.exit().transition().duration(T).style("opacity",0).remove()),E&&ii&&(j=Cj.select("."+g.ygrids).selectAll("."+g.ygrid).data(Eg.ticks(ki)),j.enter().append("line").attr("class",g.ygrid),j.attr("x1",wh?Eg:0).attr("x2",wh?Eg:gg).attr("y1",wh?0:Eg).attr("y2",wh?ig:Eg),j.exit().remove(),pf(j,"grid")),E&&Fe(ji)&&(k=Cj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(ji),l=k.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",wh?"rotate(-90)":"").attr("dx",wh?0:-dg.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",wh?Kd:0).attr("x2",wh?Kd:gg).attr("y1",wh?0:Kd).attr("y2",wh?ig:Kd).style("opacity",1),k.select("text").transition().duration(T).attr("x",wh?0:gg).attr("y",Kd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),u=Cj.select("."+g.regions).selectAll("."+g.region).data(Hi),u.enter().append("g").attr("class",kd).append("rect").style("fill-opacity",0),u.selectAll("rect").transition().duration(T).attr("x",ic).attr("y",jc).attr("width",kc).attr("height",lc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),u.exit().transition().duration(T).style("opacity",0).remove(),s=Cj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),s.enter().append("path").attr("class",ed).style("stroke","none").style("fill",cj),s.style("opacity",wd).transition().duration(T).attr("d",O).style("fill",cj).style("opacity",1),s.exit().transition().duration(U).style("opacity",0).remove(),m=Cj.selectAll("."+g.lines).selectAll("."+g.line).data(te),m.enter().append("path").attr("class",ad).style("stroke",cj),m.style("opacity",wd).transition().duration(T).attr("d",wj).style("stroke",cj).style("opacity",1),m.exit().transition().duration(U).style("opacity",0).remove(),n=Cj.selectAll("."+g.areas).selectAll("."+g.area).data(te),n.enter().append("path").attr("class",id).style("fill",cj).style("opacity",function(){return Ij=+Mf.select(this).style("opacity"),0}),n.style("opacity",0).transition().duration(T).attr("d",xj).style("fill",cj).style("opacity",Ij),n.exit().transition().duration(U).style("opacity",0).remove(),r=Cj.selectAll("."+g.circles).selectAll("."+g.circle).data(we),r.enter().append("circle").attr("class",cd).attr("r",Ue).style("fill",cj),r.style("opacity",wd).transition().duration(T).style("opacity",yd).style("fill",cj).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d),r.exit().remove(),v=Cj.selectAll("."+g.texts).selectAll("."+g.text).data(xe),v.enter().append("text").attr("class",Yc).attr("text-anchor",function(a){return wh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",cj).style("fill-opacity",0),v.text(function(a){return Hd(a.id)(a.value,a.id)}).style("fill-opacity",xd).transition().duration(T).attr("x",R).attr("y",S).style("fill",cj).style("fill-opacity",zd),v.exit().transition().duration(U).style("fill-opacity",0).remove(),t=Cj.selectAll("."+g.arcs).selectAll("."+g.arc).data(ue),t.enter().append("path").attr("class",gd).style("fill",function(a){return cj(a.data)}).style("cursor",function(a){return eh(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;aj||(c=Jb(a),d=Pb(c),e=Xb(),Rb(c.data.id),Df(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Jb(a),c=Pb(b),d=[c];Vd(d,Mf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;aj||(c=Jb(a),d=Pb(c),e=Yb(),Sb(c.data.id),Ef(),Wd(),e(d,b))}).on("click",function(a,b){var c=Jb(a),d=Pb(c),e=Wb();lf(this,a,b),e(d,b)}),t.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){aj=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Jb(a);return c?(b=Mf.interpolate(this._current,c),this._current=b(0),function(a){return Mb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("fill",function(a){return cj(a.data)}).style("opacity",1).call(Ie,function(){aj=!1}),t.exit().transition().duration(U).style("opacity",0).remove(),Cj.selectAll("."+g.chartArc).select("text").attr("transform",Nb).style("opacity",0).transition().duration(T).text(Qb).style("opacity",function(a){return Jc(a.data.id)&&se(a.data)?1:0}),Cj.select("."+g.chartArcsTitle).style("opacity",ke(Nf.data.targets)?1:0),nh&&(Mf.event&&"zoom"===Mf.event.type&&vj.extent(Dg.orgDomain()).update(),F&&(!wh&&Ih&&jb(hj.subx,c.axisSubX,Ih),vj.empty()||vj.extent(Dg.orgDomain()).update(),Q=bf($,!0),x=Dj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),x.enter().append("path").attr("class",ed).style("stroke","none").style("fill",cj),x.style("opacity",wd).transition().duration(T).attr("d",Q).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove(),w=Dj.selectAll("."+g.lines).selectAll("."+g.line).data(te),w.enter().append("path").attr("class",ad).style("stroke",cj),w.style("opacity",wd).transition().duration(T).attr("d",yj).style("opacity",1),w.exit().transition().duration(T).style("opacity",0).remove())),Cj.selectAll("."+g.selectedCircles).filter(function(a){return oe(a)}).selectAll("circle").remove(),Cj.selectAll("."+g.selectedCircle).transition().duration(T).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d),Zf&&(y=Cj.select("."+g.eventRects),Fe(Og)&&!sc(Og)?(y.classed(g.eventRectsMultiple)||y.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),z=Cj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),kf(z.enter()),z.attr("x",0).attr("y",0).attr("width",gg).attr("height",ig)):(y.classed(g.eventRectsSingle)||y.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Xi&&!Wi?(D=function(a,b){var c=Bc(b),d=Cc(b),e=Nf.data.xs[a.id][b];return(Dg(d?d:e+50)-Dg(c?c:e-50))/2},C=function(a,b){var c=Bc(b),d=Nf.data.xs[a.id][b];return(Dg(d)+Dg(c?c:d-50))/2}):(D=P(),C=function(a){return Dg(a.x)-D/2}),A=Ec(Nf.data.targets),Cj.select("."+g.eventRects).datum(A?A.values:[]),z=Cj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),jf(z.enter()),z.attr("class",ld).attr("x",wh?0:C).attr("y",wh?C:0).attr("width",wh?gg:D).attr("height",wh?D:ig),z.exit().remove())),Gc(Nf.data.targets).forEach(function(a){Jj[a]=!0})}function rf(){qf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function sf(){if(0!==Lc(Nf.data.targets).length){if("mousemove"===Mf.event.sourceEvent.type&&zj.altDomain)return Dg.domain(zj.altDomain),void zj.scale(Dg).updateScaleExtent();Wi&&Dg.orgDomain()[0]===Hj[0]&&Dg.domain([Hj[0]-1e-10,Dg.orgDomain()[1]]),qf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Mf.event.sourceEvent.type&&($i=!0)}}function tf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function uf(){Aj.attr("width",kg).attr("height",lg),Aj.select("#"+Pi).select("rect").attr("width",gg).attr("height",ig),Aj.select("#"+Qi).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),Aj.select("#"+Ri).select("rect").attr("x",H).attr("y",I).attr("width",N).attr("height",O),Aj.select("."+g.zoomRect).attr("width",gg).attr("height",ig),Gj.style("max-height",lg+"px")}function vf(a){return{axisX:a?hj.x.transition().duration(a):hj.x,axisY:a?hj.y.transition().duration(a):hj.y,axisY2:a?hj.y2.transition().duration(a):hj.y2,axisSubX:a?hj.subx.transition().duration(a):hj.subx}}function wf(a){var b;a=a||{},a.withTransition=Je(a,"withTransition",!0),a.withTransform=Je(a,"withTransform",!1),a.withLegend=Je(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withLegend&&qh||(b=vf(a.withTransitionForAxis?cg:0),p(),V(),uf(),o(a.withTransition,b)),qf(a,b)}function xf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=Cj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",nd),j=i.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Zc),e=Cj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),d=e.enter().append("g").attr("class",pd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",fd).style("cursor",function(a){return eh(a)?"pointer":null}),c=Cj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),b=c.enter().append("g").attr("class",od).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",bd),b.append("g").attr("class",jd),b.append("g").attr("class",function(a){return Xc(g.selectedCircles,a.id)}),b.append("g").attr("class",dd).style("cursor",function(a){return eh(a)?"pointer":null}),a.forEach(function(a){Cj.selectAll("."+g.selectedCircles+rd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Cj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(ug(a)).attr("class",qd),f=h.enter().append("g").attr("class",qd),f.append("g").attr("class",hd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),nh&&(n=Dj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),m=n.enter().append("g").style("opacity",0).attr("class",pd),m.append("g").attr("class",fd),l=Dj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),k=l.enter().append("g").style("opacity",0).attr("class",od),k.append("g").attr("class",bd)),Aj.selectAll("."+g.target).filter(function(a){return Jc(a.id)}).transition().duration(cg).style("opacity",1)}function yf(a,b){b.filter&&(a=a.filter(b.filter)),(b.type||b.types)&&a.forEach(function(a){b.types?fe(a.id,b.types[a.id]):fe(a.id,b.type)}),Nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,z=0,F++)),E[a]=F,D[F]=f,A[a]=z,z+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+v)/10),j=10*Math.ceil((h.height+u)/10),k=nj?j:i,l=nj?U():T();return d&&(z=0,F=0,w=0,x=0),qh&&!Kc(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=i,C[c]=j,(!w||i>=w)&&(w=i),(!x||j>=x)&&(x=j),g=nj?x:w,void(vh?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(l-g*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=26,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=Ej.selectAll("."+g.legendItemFocused).size();b=b||{},n=Je(b,"withTransition",!0),q=Je(b,"withTransitionForTransform",!0),nj?(f=function(a){return w*E[a]},j=function(a){return D[E[a]]+A[a]}):(f=function(a){return D[E[a]]+A[a]},j=function(a){return x*E[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=Ej.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Xc(g.legendItem,a)}).style("visibility",function(a){return Kc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof sh?sh(a):Nf.toggle(a)}).on("mouseover",function(a){Mf.select(this).classed(g.legendItemFocused,!0),aj||Nf.focus(a),"function"==typeof th&&th(a)}).on("mouseout",function(a){Mf.select(this).classed(g.legendItemFocused,!1),aj||Nf.revert(),"function"==typeof uh&&uh(a)}),m.append("text").text(function(a){return d(Rg[a])?Rg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",nj?h:-200).attr("y",nj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",nj?i:-200).attr("y",nj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",cj).attr("x",nj?h:-200).attr("y",nj?-200:j).attr("width",10).attr("height",10),r=Ej.selectAll("text").data(a).text(function(a){return d(Rg[a])?Rg[a]:a}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=Ej.selectAll("rect."+g.legendItemEvent).data(a),(n?s.transition():s).attr("width",function(a){return B[a]}).attr("height",function(a){return C[a]}).attr("x",i).attr("y",l),t=Ej.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",cj).attr("x",f).attr("y",j),Ej.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Jc(a)}).transition().style("opacity",function(a){var b=Mf.select(this);return Jc(a)?!G||b.classed(g.legendItemFocused)?Bf(b):Cf(b):rj}),R(w),S(x),Q(F),p(),V(),uf(),o(q,c)}function If(a){return Ic(Nf.data.targets,a.id)}function Jf(a){return"data"in a&&Ic(Nf.data.targets,a.data.id)}function Kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function Lf(a,b,c){var d=!le(Nf.data.targets);aj=!1,fe(a,b),wf(c||{withTransitionForAxis:d})}var Mf=a.d3?a.d3:a.require?a.require("d3"):void 0,Nf={data:{},axis:{},legend:{}},Of={},Pf=i(["bindto"],"#chart"),Qf=i(["size","width"]),Rf=i(["size","height"]),Sf=i(["padding","left"]),Tf=i(["padding","right"]),Uf=i(["padding","top"]),Vf=i(["padding","bottom"]),Wf=i(["zoom","enabled"],!1),Xf=i(["zoom","extent"]),Yf=i(["zoom","privileged"],!1),Zf=i(["interaction","enabled"],!0),$f=i(["onenter"],function(){}),_f=i(["onleave"],function(){}),ag=i(["onresize"],function(){}),bg=i(["onresized"],function(){}),cg=i(["transition","duration"],350);h("data","data is required in config");var dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg,Kg,Lg,Mg,Ng=i(["data","x"]),Og=i(["data","xs"],{}),Pg=i(["data","x_format"]),Qg=i(["data","id_converter"],function(a){return a}),Rg=i(["data","names"],{}),Sg=i(["data","classes"],{}),Tg=i(["data","groups"],[]),Ug=i(["data","axes"],{}),Vg=i(["data","type"]),Wg=i(["data","types"],{}),Xg=i(["data","labels"],{}),Yg=i(["data","order"]),Zg=i(["data","regions"],{}),$g=i(["data","color"]),_g=i(["data","colors"],{}),ah=i(["data","hide"],!1),bh=i(["data","filter"]),ch=i(["data","selection","enabled"],!1),dh=i(["data","selection","grouped"],!1),eh=i(["data","selection","isselectable"],function(){return!0}),fh=i(["data","selection","multiple"],!0),gh=i(["data","onclick"],function(){}),hh=i(["data","onenter"],function(){}),ih=i(["data","onleave"],function(){}),jh=i(["data","onselected"],function(){}),kh=i(["data","onunselected"],function(){}),lh=i(["data","ondragstart"],function(){}),mh=i(["data","ondragend"],function(){}),nh=i(["subchart","show"],!1),oh=i(["subchart","size","height"],60),ph=i(["color","pattern"],[]),qh=i(["legend","show"],!0),rh=i(["legend","position"],"bottom"),sh=i(["legend","item","onclick"]),th=i(["legend","item","onmouseover"]),uh=i(["legend","item","onmouseout"]),vh=i(["legend","equally"],!1),wh=i(["axis","rotated"],!1),xh=i(["axis","x","show"],!0),yh=i(["axis","x","type"],"indexed"),zh=i(["axis","x","localtime"],!0),Ah=i(["axis","x","categories"],[]),Bh=i(["axis","x","tick","centered"],!1),Ch=i(["axis","x","tick","format"]),Dh=i(["axis","x","tick","culling"],{}),Eh=i(["axis","x","tick","culling","max"],10),Fh=i(["axis","x","tick","count"]),Gh=i(["axis","x","tick","fit"],!0),Hh=i(["axis","x","tick","values"],null),Ih=i(["axis","x","tick","rotate"]),Jh=i(["axis","x","max"],null),Kh=i(["axis","x","min"],null),Lh=i(["axis","x","padding"],{}),Mh=i(["axis","x","height"]),Nh=i(["axis","x","default"]),Oh=i(["axis","x","label"],{}),Ph=i(["axis","y","show"],!0),Qh=i(["axis","y","max"]),Rh=i(["axis","y","min"]),Sh=i(["axis","y","center"]),Th=i(["axis","y","label"],{}),Uh=i(["axis","y","inner"],!1),Vh=i(["axis","y","tick","format"]),Wh=i(["axis","y","padding"]),Xh=i(["axis","y","ticks"],10),Yh=i(["axis","y2","show"],!1),Zh=i(["axis","y2","max"]),$h=i(["axis","y2","min"]),_h=i(["axis","y2","center"]),ai=i(["axis","y2","label"],{}),bi=i(["axis","y2","inner"],!1),ci=i(["axis","y2","tick","format"]),di=i(["axis","y2","padding"]),ei=i(["axis","y2","ticks"],10),fi=i(["grid","x","show"],!1),gi=i(["grid","x","type"],"tick"),hi=i(["grid","x","lines"],[]),ii=i(["grid","y","show"],!1),ji=i(["grid","y","lines"],[]),ki=i(["grid","y","ticks"],10),li=i(["point","show"],!0),mi=i(["point","r"],2.5),ni=i(["point","focus","line","enabled"],!0),oi=i(["point","focus","expand","enabled"],!0),pi=i(["point","focus","expand","r"]),qi=i(["point","focus","select","r"]),ri=i(["line","connect_null"],!1),si=i(["bar","width"]),ti=i(["bar","width","ratio"],.6),ui=i(["pie","label","show"],!0),vi=i(["pie","label","format"]),wi=i(["pie","expand"],!0),xi=i(["pie","onclick"],function(){}),yi=i(["pie","onmouseover"],function(){}),zi=i(["pie","onmouseout"],function(){}),Ai=i(["donut","label","show"],!0),Bi=i(["donut","label","format"]),Ci=i(["donut","expand"],!0),Di=i(["donut","title"],""),Ei=i(["donut","onclick"],function(){}),Fi=i(["donut","onmouseover"],function(){}),Gi=i(["donut","onmouseout"],function(){}),Hi=i(["regions"],[]),Ii=i(["tooltip","show"],!0),Ji=i(["tooltip","format","title"]),Ki=i(["tooltip","format","value"]),Li=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Ji?Ji:b,l=Ki?Ki:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Mi=i(["tooltip","init","show"],!1),Ni=i(["tooltip","init","x"],0),Oi=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Pi=("string"==typeof Pf?Pf.replace(/[# .>~+]/g,""):g.chart+ +new Date)+"-clip",Qi=Pi+"-xaxis",Ri=Pi+"-yaxis",Si=j(Pi),Ti=j(Qi),Ui=j(Ri),Vi="timeseries"===yh,Wi="categorized"===yh,Xi=!Vi&&(Ng||Fe(Og)),Yi=null,Zi=!1,$i=!1,_i=!1,aj=!1,bj=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],cj=ze(_g,Fe(ph)?ph:bj,$g),dj=zh?Mf.time.format:Mf.time.format.utc,ej=dj.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),fj=[],gj=[],hj={},ij=wh?"left":"bottom",jj=wh?Uh?"top":"bottom":Uh?"right":"left",kj=wh?bi?"bottom":"top":bi?"left":"right",lj=wh?"left":"bottom",mj={main:function(){return"translate("+k(dg.left)+","+k(dg.top)+")"},context:function(){return"translate("+k(eg.left)+","+k(eg.top)+")"},legend:function(){return"translate("+fg.left+","+fg.top+")"},x:function(){return"translate(0,"+(wh?0:ig)+")"},y:function(){return"translate(0,"+(wh?ig:0)+")" -},y2:function(){return"translate("+(wh?0:gg)+","+(wh?1:0)+")"},subx:function(){return"translate(0,"+(wh?0:jg)+")"},arc:function(){return"translate("+pg/2+","+qg/2+")"}},nj="right"===rh,oj=0,pj=0,qj=0,rj=.15,sj=30,tj=wh&&!xh?0:30,uj=5;ug=Mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var vj,wj=function(){var a=Mf.svg.line().x(wh?function(a){return $(a.id)(a.value)}:Id).y(wh?Id:function(a){return $(a.id)(a.value)});return ri||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ri?Te(b.values):b.values;return me(b)?(a.interpolate(ne(b)?"cardinal":"linear"),Zg[b.id]?gf(e,Dg,$(b.id),Zg[b.id]):a(e)):(c=e[0]?Dg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,wh?"M "+d+" "+c:"M "+c+" "+d)}}(),xj=function(){var a;return a=wh?Mf.svg.area().x0(function(a){return $(a.id)(0)}).x1(function(a){return $(a.id)(a.value)}).y(Id):Mf.svg.area().x(Id).y0(function(a){return $(a.id)(0)}).y1(function(a){return $(a.id)(a.value)}),function(b){var c,d,e=Te(b.values);return ge([b],"area")||ge([b],"area-spline")?(a.interpolate(ne(b)?"cardinal":"linear"),a(e)):(c=e[0]?Dg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,wh?"M "+d+" "+c:"M "+c+" "+d)}}(),yj=function(){var a=Mf.svg.line().x(wh?function(a){return _(a.id)(a.value)}:Ld).y(wh?Ld:function(a){return _(a.id)(a.value)});return function(b){var c=Te(b.values);return me(b)?a(c):"M "+Gg(c[0].x)+" "+_(b.id)(c[0].value)}}(),zj=function(){};vj=Mf.svg.brush().on("brush",rf),vj.update=function(){return Dj&&Dj.select("."+g.brush).call(this),this},vj.scale=function(a){return wh?this.y(a):this.x(a)},Wf&&(zj=Mf.behavior.zoom().on("zoomstart",function(){zj.altDomain=Mf.event.sourceEvent.altKey?Dg.orgDomain():null}).on("zoom",Wf?sf:null),zj.scale=function(a){return wh?this.y(a):this.x(a)},zj.orgScaleExtent=function(){var a=Xf?Xf:[1,10];return[a[0],Math.max(Dc()/a[1],a[1])]},zj.updateScaleExtent=function(){var a=ec(Dg.orgDomain())/ec(Hj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Aj,Bj,Cj,Dj,Ej,Fj,Gj,Hj,Ij,Jj={};if(Nf.focus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);Nf.revert(),Nf.defocus(),b(d.classed(g.focused,!0)),b(e),le(Nf.data.targets)&&Rb(a,!0),Df(a,!0)},Nf.defocus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",.3)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);Nf.revert(),b(d.classed(g.focused,!1)),b(e),le(Nf.data.targets)&&Sb(a),Df(a,!1)},Nf.revert=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);b(d.classed(g.focused,!1)),b(e),le(Nf.data.targets)&&Sb(a),Ef()},Nf.show=function(a,b){a=Hc(a),b=b||{},Pc(a),Aj.selectAll(td(a)).transition().style("opacity",1),b.withLegend&&Ff(a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Nf.hide=function(a,b){a=Hc(a),b=b||{},Oc(a),Aj.selectAll(td(a)).transition().style("opacity",0),b.withLegend&&Gf(a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Nf.toggle=function(a){Jc(a)?Nf.hide(a):Nf.show(a)},Nf.unzoom=function(){vj.clear().update(),qf({withUpdateXDomain:!0})},Nf.load=function(a){return a.xs&&rc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Sg[b]=a.classes[b]}),"categories"in a&&Wi&&(Ah=a.categories,Jg.categories(Ah)),"cacheIds"in a&&fc(a.cacheIds)?void yf(hc(a.cacheIds),a.done):void("unload"in a?Af(Hc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){zf(a)}):zf(a))},Nf.unload=function(a,b){Af(Hc(a),function(){qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Nf.selected=function(a){return Mf.merge(Cj.selectAll("."+g.shapes+rd(a)).selectAll("."+g.shape).filter(function(){return Mf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Nf.select=function(a,b,c){ch&&Cj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Mf.select(this),i=e.data?e.data.id:e.id,j=Se(this),k=dh||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);"path"!==this.nodeName&&(k&&l?eh(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},Nf.unselect=function(a,b){ch&&Cj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Mf.select(this),f=c.data?c.data.id:c.id,h=Se(this),i=dh||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);"path"!==this.nodeName&&i&&j&&eh(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Nf.toLine=function(a){Lf(a,"line")},Nf.toSpline=function(a){Lf(a,"spline")},Nf.toBar=function(a){Lf(a,"bar")},Nf.toScatter=function(a){Lf(a,"scatter")},Nf.toArea=function(a){Lf(a,"area")},Nf.toAreaSpline=function(a){Lf(a,"area-spline")},Nf.toPie=function(a){Lf(a,"pie",{withTransform:!0})},Nf.toDonut=function(a){Lf(a,"donut",{withTransform:!0})},Nf.groups=function(a){return c(a)?Tg:(Tg=a,qf(),Tg)},Nf.xgrids=function(a){return a?(hi=a,qf(),hi):hi},Nf.xgrids.add=function(a){return a?Nf.xgrids(hi.concat(a)):void 0},Nf.xgrids.remove=function(a){var b=Kf(a);return Nf.xgrids(hi.filter(b))},Nf.ygrids=function(a){return a?(ji=a,qf(),ji):ji},Nf.ygrids.add=function(a){return a?Nf.ygrids(ji.concat(a)):void 0},Nf.ygrids.remove=function(a){var b=Kf(a);return Nf.ygrids(ji.filter(b))},Nf.regions=function(a){return a?(Hi=a,qf(),Hi):Hi},Nf.regions.add=function(a){return a?(Hi=Hi.concat(a),qf(),Hi):Hi},Nf.regions.remove=function(a){var b,c,d;return a=a||{},b=Je(a,"duration",cg),c=Je(a,"classes",[g.region]),d=Cj.select("."+g.regions).selectAll(c.map(function(a){return"."+a})),(b?d.transition().duration(b):d).style("opacity",0).remove(),Hi=Hi.filter(function(a){return c.indexOf(a.class)<0})},Nf.data.get=function(a){var b=Nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Nf.data.getAsTarget=function(a){var b=Nf.data.targets.filter(function(b){return b.id===a});return b.length>0?b[0]:void 0},Nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Rg[b]=a[b]}),qf({withLegend:!0}),Rg):Rg},Nf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){_g[b]=a[b]}),qf({withLegend:!0}),_g):_g},Nf.x=function(a){return arguments.length&&(uc(Nf.data.targets,a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Nf.data.xs},Nf.xs=function(a){return arguments.length&&(vc(Nf.data.targets,a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Nf.data.xs},Nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){gb(b,a[b])}),Ib())},Nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Jh=+a.x),b(a.y)&&(Qh=+a.y),b(a.y2)&&(Zh=+a.y2)):Qh=Zh=+a,qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Kh=+a.x),b(a.y)&&(Rh=+a.y),b(a.y2)&&($h=+a.y2)):Rh=$h=+a,qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Nf.axis.max(a.max),"undefined"!=typeof a.min&&Nf.axis.min(a.min))},Nf.legend.show=function(a){Ff(Hc(a)),qf({withLegend:!0})},Nf.legend.hide=function(a){Gf(Hc(a)),qf({withLegend:!0})},Nf.resize=function(a){Qf=a?a.width:null,Rf=a?a.height:null,wf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Nf.destroy=function(){Nf.data.targets=void 0,Nf.data.xs={},Gj.html(""),a.onresize=null},"url"in f.data)Mf.xhr(f.data.url,function(a,b){var c,d=Mf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Mf.csv.parse(b.response),hf(c)});else if("rows"in f.data)hf(xc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");hf(yc(f.data.columns))}return Nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(window); \ No newline at end of file +},r=wh?function(a){return b(a.x)}:function(a){return e(a.value)},i=Vi?function(a,c,d,f){var g=a.x.getTime(),h=c.x-a.x,i=new Date(g+h*d),j=new Date(g+h*(d+f));return"M"+b(i)+" "+e(k(d))+" "+b(j)+" "+e(k(d+f))}:function(a,c,d,f){return"M"+b(j(d),!0)+" "+e(k(d))+" "+b(j(d+f),!0)+" "+e(k(d+f))},g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function hf(b){var c,d,e;if(Gj=Mf.select(Pf),Gj.empty())throw new Error("Element to bind not found");if(Gj.html("").classed("c3",!0),Nf.data.xs={},Nf.data.targets=zc(b),bh&&(Nf.data.targets=Nf.data.targets.filter(bh)),ah&&Oc(ah===!0?Gc(Nf.data.targets):ah),p(),V(),Dg.domain(Mf.extent(dc(Nf.data.targets))),Eg.domain(_b(Nf.data.targets,"y")),Fg.domain(_b(Nf.data.targets,"y2")),Gg.domain(Dg.domain()),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Hj=Dg.domain(),vj.scale(Gg),Wf&&zj.scale(Dg),Aj=Gj.append("svg").style("overflow","hidden").on("mouseenter",$f).on("mouseleave",_f),Bj=Aj.append("defs"),Bj.append("clipPath").attr("id",Pi).append("rect"),Bj.append("clipPath").attr("id",Qi).append("rect"),Bj.append("clipPath").attr("id",Ri).append("rect"),uf(),Cj=Aj.append("g").attr("transform",mj.main),Dj=Aj.append("g").attr("transform",mj.context),Ej=Aj.append("g").attr("transform",mj.legend),nh||Dj.style("visibility","hidden"),qh||(Ej.style("visibility","hidden"),gj=Gc(Nf.data.targets)),Fj=Gj.style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Hf(Gc(Nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=Cj.append("g").attr("clip-path",Si).attr("class",g.grid),fi&&d.append("g").attr("class",g.xgrids),Fe(hi)&&d.append("g").attr("class",g.xgridLines),ni&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),ii&&d.append("g").attr("class",g.ygrids),Fe(ji)&&d.append("g").attr("class",g.ygridLines),Cj.append("g").attr("clip-path",Si).attr("class",g.regions),Cj.append("g").attr("clip-path",Si).attr("class",g.chart),c=Cj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Wf?wh?"ns-resize":"ew-resize":null),Cj.select("."+g.chart).append("g").attr("class",g.chartBars),Cj.select("."+g.chart).append("g").attr("class",g.chartLines),Cj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",mj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Vb()),Cj.select("."+g.chart).append("g").attr("class",g.chartTexts),Wf&&Cj.insert("rect",Yf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",gg).attr("height",ig).style("opacity",0).style("cursor",wh?"ns-resize":"ew-resize").call(zj).on("dblclick.zoom",null),Nh&&vj.extent("function"!=typeof Nh?Nh:Nh(dc())),hj.x=Cj.append("g").attr("class",g.axisX).attr("clip-path",Ti).attr("transform",mj.x).style("visibility",xh?"visible":"hidden"),hj.x.append("text").attr("class",g.axisXLabel).attr("transform",wh?"rotate(-90)":"").style("text-anchor",Eb),hj.y=Cj.append("g").attr("class",g.axisY).attr("clip-path",Ui).attr("transform",mj.y).style("visibility",Ph?"visible":"hidden"),hj.y.append("text").attr("class",g.axisYLabel).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Fb),hj.y2=Cj.append("g").attr("class",g.axisY2).attr("transform",mj.y2).style("visibility",Yh?"visible":"hidden"),hj.y2.append("text").attr("class",g.axisY2Label).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Gb),Dj.append("g").attr("clip-path",Si).attr("class",g.chart),Dj.select("."+g.chart).append("g").attr("class",g.chartBars),Dj.select("."+g.chart).append("g").attr("class",g.chartLines),Dj.append("g").attr("clip-path",Si).attr("class",g.brush).call(vj).selectAll("rect").attr(wh?"width":"height",wh?hg:jg),hj.subx=Dj.append("g").attr("class",g.axisX).attr("transform",mj.subx).attr("clip-path",wh?"":Ti),xf(Nf.data.targets),qf({withUpdateTranslate:!0,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Mi){if(Vi&&"string"==typeof Ni){for(Ni=Ae(Ni),e=0;e0){d=[];for(var f in Rg)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Rd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Qe,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function nf(a){le(Nf.data.targets)||ch&&(Yi=a,Cj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Zi=!0,lh())}function of(){le(Nf.data.targets)||ch&&(Cj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),Cj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Zi=!1,mh())}function pf(a,b){"grid"===b&&a.each(function(){var a=Mf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function qf(a,c){var d,e,f,h,i,j,k,l,m,n,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,Q,R,S,T,U,W,X,Y,Z,$=ae(),_=le(Nf.data.targets),ab=Lc(Nf.data.targets);if(a=a||{},E=Je(a,"withY",!0),F=Je(a,"withSubchart",!0),G=Je(a,"withTransition",!0),J=Je(a,"withTransform",!1),K=Je(a,"withUpdateXDomain",!1),L=Je(a,"withUpdateOrgXDomain",!1),N=Je(a,"withUpdateTranslate",!1),M=Je(a,"withLegend",!1),H=Je(a,"withTransitionForExit",G),I=Je(a,"withTransitionForAxis",G),T=G?cg:0,U=H?T:0,W=I?T:0,c=c||vf(W),M&&qh&&Hf(Gc(Nf.data.targets),a,c),Wi&&0===ab.length&&Dg.domain([0,hj.x.selectAll(".tick").size()]),ab.length&&(L&&(Dg.domain(Mf.extent(dc(ab))),Hj=Dg.domain(),Wf&&zj.scale(Dg).updateScaleExtent(),Gg.domain(Dg.domain()),vj.scale(Gg)),K&&(Dg.domain(vj.empty()?Hj:vj.extent()),Wf&&zj.scale(Dg).updateScaleExtent()),Hh||!Gh&&!Fh||(X=Nc(Mc(ab),Fh),Jg.tickValues(X),Mg.tickValues(X))),Eg.domain(_b(ab,"y")),Fg.domain(_b(ab,"y2")),hj.x.style("opacity",_?0:1),hj.y.style("opacity",_?0:1),hj.y2.style("opacity",_?0:1),hj.subx.style("opacity",_?0:1),c.axisX.call(Jg),c.axisY.call(Kg),c.axisY2.call(Lg),c.axisSubX.call(Mg),Ib(G),N&&(p(),V(),uf(),o(!1),hj.x.call(Jg),hj.y.call(Kg),hj.y2.call(Lg),hj.subx.call(Mg)),K&&ab.length)if(Dh&&X){for(Y=1;Y=0&&Mf.select(this).style("display",b%Z?"none":"block")})}else Aj.selectAll("."+g.axisX+" .tick text").style("display","block");!wh&&Ih&&jb(hj.x,c.axisX,Ih),O=bf($),R=cf($,!0),S=cf($,!1),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Fj.style("display","none"),q(),Cj.select("line."+g.xgridFocus).style("visibility","hidden"),fi&&(f=Zd(gi,Dg),B=Wi?Jg.tickOffset():0,e=wh?{x1:0,x2:gg,y1:function(a){return Dg(a)-B},y2:function(a){return Dg(a)-B}}:{x1:function(a){return Dg(a)+B},x2:function(a){return Dg(a)+B},y1:dg.top,y2:ig},d=Cj.select("."+g.xgrids).selectAll("."+g.xgrid).data(f),d.enter().append("line").attr("class",g.xgrid),d.attr(e).style("opacity",function(){return+Mf.select(this).attr(wh?"y1":"x1")===(wh?ig:0)?0:1}),d.exit().remove()),Fe(hi)&&(h=Cj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(hi),i=h.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),i.append("line").style("opacity",0),i.append("text").attr("text-anchor","end").attr("transform",wh?"":"rotate(-90)").attr("dx",wh?0:-dg.top).attr("dy",-5).style("opacity",0),h.select("line").transition().duration(T).attr("x1",wh?0:Jd).attr("x2",wh?gg:Jd).attr("y1",wh?Jd:dg.top).attr("y2",wh?Jd:ig).style("opacity",1),h.select("text").transition().duration(T).attr("x",wh?gg:0).attr("y",Jd).text(function(a){return a.text}).style("opacity",1),h.exit().transition().duration(T).style("opacity",0).remove()),E&&ii&&(j=Cj.select("."+g.ygrids).selectAll("."+g.ygrid).data(Eg.ticks(ki)),j.enter().append("line").attr("class",g.ygrid),j.attr("x1",wh?Eg:0).attr("x2",wh?Eg:gg).attr("y1",wh?0:Eg).attr("y2",wh?ig:Eg),j.exit().remove(),pf(j,"grid")),E&&Fe(ji)&&(k=Cj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(ji),l=k.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",wh?"rotate(-90)":"").attr("dx",wh?0:-dg.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",wh?Kd:0).attr("x2",wh?Kd:gg).attr("y1",wh?0:Kd).attr("y2",wh?ig:Kd).style("opacity",1),k.select("text").transition().duration(T).attr("x",wh?0:gg).attr("y",Kd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),u=Cj.select("."+g.regions).selectAll("."+g.region).data(Hi),u.enter().append("g").attr("class",kd).append("rect").style("fill-opacity",0),u.selectAll("rect").transition().duration(T).attr("x",ic).attr("y",jc).attr("width",kc).attr("height",lc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),u.exit().transition().duration(T).style("opacity",0).remove(),s=Cj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),s.enter().append("path").attr("class",ed).style("stroke","none").style("fill",cj),s.style("opacity",wd).transition().duration(T).attr("d",O).style("fill",cj).style("opacity",1),s.exit().transition().duration(U).style("opacity",0).remove(),m=Cj.selectAll("."+g.lines).selectAll("."+g.line).data(te),m.enter().append("path").attr("class",ad).style("stroke",cj),m.style("opacity",wd).transition().duration(T).attr("d",wj).style("stroke",cj).style("opacity",1),m.exit().transition().duration(U).style("opacity",0).remove(),n=Cj.selectAll("."+g.areas).selectAll("."+g.area).data(te),n.enter().append("path").attr("class",id).style("fill",cj).style("opacity",function(){return Ij=+Mf.select(this).style("opacity"),0}),n.style("opacity",0).transition().duration(T).attr("d",xj).style("fill",cj).style("opacity",Ij),n.exit().transition().duration(U).style("opacity",0).remove(),r=Cj.selectAll("."+g.circles).selectAll("."+g.circle).data(we),r.enter().append("circle").attr("class",cd).attr("r",Ue).style("fill",cj),r.style("opacity",wd).transition().duration(T).style("opacity",yd).style("fill",cj).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d),r.exit().remove(),v=Cj.selectAll("."+g.texts).selectAll("."+g.text).data(xe),v.enter().append("text").attr("class",Yc).attr("text-anchor",function(a){return wh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",cj).style("fill-opacity",0),v.text(function(a){return Hd(a.id)(a.value,a.id)}).style("fill-opacity",xd).transition().duration(T).attr("x",R).attr("y",S).style("fill",cj).style("fill-opacity",zd),v.exit().transition().duration(U).style("fill-opacity",0).remove(),t=Cj.selectAll("."+g.arcs).selectAll("."+g.arc).data(ue),t.enter().append("path").attr("class",gd).style("fill",function(a){return cj(a.data)}).style("cursor",function(a){return eh(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;aj||(c=Jb(a),d=Pb(c),e=Xb(),Rb(c.data.id),Df(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Jb(a),c=Pb(b),d=[c];Vd(d,Mf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;aj||(c=Jb(a),d=Pb(c),e=Yb(),Sb(c.data.id),Ef(),Wd(),e(d,b))}).on("click",function(a,b){var c=Jb(a),d=Pb(c),e=Wb();lf(this,a,b),e(d,b)}),t.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){aj=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Jb(a);return c?(b=Mf.interpolate(this._current,c),this._current=b(0),function(a){return Mb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("fill",function(a){return cj(a.data)}).style("opacity",1).call(Ie,function(){aj=!1}),t.exit().transition().duration(U).style("opacity",0).remove(),Cj.selectAll("."+g.chartArc).select("text").attr("transform",Nb).style("opacity",0).transition().duration(T).text(Qb).style("opacity",function(a){return Jc(a.data.id)&&se(a.data)?1:0}),Cj.select("."+g.chartArcsTitle).style("opacity",ke(Nf.data.targets)?1:0),nh&&(Mf.event&&"zoom"===Mf.event.type&&vj.extent(Dg.orgDomain()).update(),F&&(!wh&&Ih&&jb(hj.subx,c.axisSubX,Ih),vj.empty()||vj.extent(Dg.orgDomain()).update(),Q=bf($,!0),x=Dj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),x.enter().append("path").attr("class",ed).style("stroke","none").style("fill",cj),x.style("opacity",wd).transition().duration(T).attr("d",Q).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove(),w=Dj.selectAll("."+g.lines).selectAll("."+g.line).data(te),w.enter().append("path").attr("class",ad).style("stroke",cj),w.style("opacity",wd).transition().duration(T).attr("d",yj).style("opacity",1),w.exit().transition().duration(T).style("opacity",0).remove())),Cj.selectAll("."+g.selectedCircles).filter(function(a){return oe(a)}).selectAll("circle").remove(),Cj.selectAll("."+g.selectedCircle).transition().duration(T).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d),Zf&&(y=Cj.select("."+g.eventRects),Fe(Og)&&!sc(Og)?(y.classed(g.eventRectsMultiple)||y.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),z=Cj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),kf(z.enter()),z.attr("x",0).attr("y",0).attr("width",gg).attr("height",ig)):(y.classed(g.eventRectsSingle)||y.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Xi&&!Wi?(D=function(a,b){var c=Bc(b),d=Cc(b),e=Nf.data.xs[a.id][b];return(Dg(d?d:e+50)-Dg(c?c:e-50))/2},C=function(a,b){var c=Bc(b),d=Nf.data.xs[a.id][b];return(Dg(d)+Dg(c?c:d-50))/2}):(D=P(),C=function(a){return Dg(a.x)-D/2}),A=Ec(Nf.data.targets),Cj.select("."+g.eventRects).datum(A?A.values:[]),z=Cj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),jf(z.enter()),z.attr("class",ld).attr("x",wh?0:C).attr("y",wh?C:0).attr("width",wh?gg:D).attr("height",wh?D:ig),z.exit().remove())),Gc(Nf.data.targets).forEach(function(a){Jj[a]=!0})}function rf(){qf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function sf(){if(0!==Lc(Nf.data.targets).length){if("mousemove"===Mf.event.sourceEvent.type&&zj.altDomain)return Dg.domain(zj.altDomain),void zj.scale(Dg).updateScaleExtent();Wi&&Dg.orgDomain()[0]===Hj[0]&&Dg.domain([Hj[0]-1e-10,Dg.orgDomain()[1]]),qf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Mf.event.sourceEvent.type&&($i=!0)}}function tf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function uf(){Aj.attr("width",kg).attr("height",lg),Aj.select("#"+Pi).select("rect").attr("width",gg).attr("height",ig),Aj.select("#"+Qi).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),Aj.select("#"+Ri).select("rect").attr("x",H).attr("y",I).attr("width",N).attr("height",O),Aj.select("."+g.zoomRect).attr("width",gg).attr("height",ig),Gj.style("max-height",lg+"px")}function vf(a){return{axisX:a?hj.x.transition().duration(a):hj.x,axisY:a?hj.y.transition().duration(a):hj.y,axisY2:a?hj.y2.transition().duration(a):hj.y2,axisSubX:a?hj.subx.transition().duration(a):hj.subx}}function wf(a){var b;a=a||{},a.withTransition=Je(a,"withTransition",!0),a.withTransform=Je(a,"withTransform",!1),a.withLegend=Je(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withLegend&&qh||(b=vf(a.withTransitionForAxis?cg:0),p(),V(),uf(),o(a.withTransition,b)),qf(a,b)}function xf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=Cj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",nd),j=i.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Zc),e=Cj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),d=e.enter().append("g").attr("class",pd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",fd).style("cursor",function(a){return eh(a)?"pointer":null}),c=Cj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),b=c.enter().append("g").attr("class",od).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",bd),b.append("g").attr("class",jd),b.append("g").attr("class",function(a){return Xc(g.selectedCircles,a.id)}),b.append("g").attr("class",dd).style("cursor",function(a){return eh(a)?"pointer":null}),a.forEach(function(a){Cj.selectAll("."+g.selectedCircles+rd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Cj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(ug(a)).attr("class",qd),f=h.enter().append("g").attr("class",qd),f.append("g").attr("class",hd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),nh&&(n=Dj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),m=n.enter().append("g").style("opacity",0).attr("class",pd),m.append("g").attr("class",fd),l=Dj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),k=l.enter().append("g").style("opacity",0).attr("class",od),k.append("g").attr("class",bd)),Aj.selectAll("."+g.target).filter(function(a){return Jc(a.id)}).transition().duration(cg).style("opacity",1)}function yf(a,b){b.filter&&(a=a.filter(b.filter)),(b.type||b.types)&&a.forEach(function(a){b.types?fe(a.id,b.types[a.id]):fe(a.id,b.type)}),Nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,z=0,F++)),E[a]=F,D[F]=f,A[a]=z,z+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+v)/10),j=10*Math.ceil((h.height+u)/10),k=nj?j:i,l=nj?U():T();return d&&(z=0,F=0,w=0,x=0),qh&&!Kc(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=i,C[c]=j,(!w||i>=w)&&(w=i),(!x||j>=x)&&(x=j),g=nj?x:w,void(vh?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(l-g*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=26,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=Ej.selectAll("."+g.legendItemFocused).size();b=b||{},n=Je(b,"withTransition",!0),q=Je(b,"withTransitionForTransform",!0),nj?(f=function(a){return w*E[a]},j=function(a){return D[E[a]]+A[a]}):(f=function(a){return D[E[a]]+A[a]},j=function(a){return x*E[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=Ej.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Xc(g.legendItem,a)}).style("visibility",function(a){return Kc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof sh?sh(a):Nf.toggle(a)}).on("mouseover",function(a){Mf.select(this).classed(g.legendItemFocused,!0),aj||Nf.focus(a),"function"==typeof th&&th(a)}).on("mouseout",function(a){Mf.select(this).classed(g.legendItemFocused,!1),aj||Nf.revert(),"function"==typeof uh&&uh(a)}),m.append("text").text(function(a){return d(Rg[a])?Rg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",nj?h:-200).attr("y",nj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",nj?i:-200).attr("y",nj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",cj).attr("x",nj?h:-200).attr("y",nj?-200:j).attr("width",10).attr("height",10),r=Ej.selectAll("text").data(a).text(function(a){return d(Rg[a])?Rg[a]:a}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=Ej.selectAll("rect."+g.legendItemEvent).data(a),(n?s.transition():s).attr("width",function(a){return B[a]}).attr("height",function(a){return C[a]}).attr("x",i).attr("y",l),t=Ej.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",cj).attr("x",f).attr("y",j),Ej.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Jc(a)}).transition().style("opacity",function(a){var b=Mf.select(this);return Jc(a)?!G||b.classed(g.legendItemFocused)?Bf(b):Cf(b):rj}),R(w),S(x),Q(F),p(),V(),uf(),o(q,c)}function If(a){return Ic(Nf.data.targets,a.id)}function Jf(a){return"data"in a&&Ic(Nf.data.targets,a.data.id)}function Kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function Lf(a,b,c){var d=!le(Nf.data.targets);aj=!1,fe(a,b),wf(c||{withTransitionForAxis:d})}var Mf=a.d3?a.d3:a.require?a.require("d3"):void 0,Nf={data:{},axis:{},legend:{}},Of={},Pf=i(["bindto"],"#chart"),Qf=i(["size","width"]),Rf=i(["size","height"]),Sf=i(["padding","left"]),Tf=i(["padding","right"]),Uf=i(["padding","top"]),Vf=i(["padding","bottom"]),Wf=i(["zoom","enabled"],!1),Xf=i(["zoom","extent"]),Yf=i(["zoom","privileged"],!1),Zf=i(["interaction","enabled"],!0),$f=i(["onenter"],function(){}),_f=i(["onleave"],function(){}),ag=i(["onresize"],function(){}),bg=i(["onresized"],function(){}),cg=i(["transition","duration"],350);h("data","data is required in config");var dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg,Kg,Lg,Mg,Ng=i(["data","x"]),Og=i(["data","xs"],{}),Pg=i(["data","x_format"]),Qg=i(["data","id_converter"],function(a){return a}),Rg=i(["data","names"],{}),Sg=i(["data","classes"],{}),Tg=i(["data","groups"],[]),Ug=i(["data","axes"],{}),Vg=i(["data","type"]),Wg=i(["data","types"],{}),Xg=i(["data","labels"],{}),Yg=i(["data","order"]),Zg=i(["data","regions"],{}),$g=i(["data","color"]),_g=i(["data","colors"],{}),ah=i(["data","hide"],!1),bh=i(["data","filter"]),ch=i(["data","selection","enabled"],!1),dh=i(["data","selection","grouped"],!1),eh=i(["data","selection","isselectable"],function(){return!0}),fh=i(["data","selection","multiple"],!0),gh=i(["data","onclick"],function(){}),hh=i(["data","onenter"],function(){}),ih=i(["data","onleave"],function(){}),jh=i(["data","onselected"],function(){}),kh=i(["data","onunselected"],function(){}),lh=i(["data","ondragstart"],function(){}),mh=i(["data","ondragend"],function(){}),nh=i(["subchart","show"],!1),oh=i(["subchart","size","height"],60),ph=i(["color","pattern"],[]),qh=i(["legend","show"],!0),rh=i(["legend","position"],"bottom"),sh=i(["legend","item","onclick"]),th=i(["legend","item","onmouseover"]),uh=i(["legend","item","onmouseout"]),vh=i(["legend","equally"],!1),wh=i(["axis","rotated"],!1),xh=i(["axis","x","show"],!0),yh=i(["axis","x","type"],"indexed"),zh=i(["axis","x","localtime"],!0),Ah=i(["axis","x","categories"],[]),Bh=i(["axis","x","tick","centered"],!1),Ch=i(["axis","x","tick","format"]),Dh=i(["axis","x","tick","culling"],{}),Eh=i(["axis","x","tick","culling","max"],10),Fh=i(["axis","x","tick","count"]),Gh=i(["axis","x","tick","fit"],!0),Hh=i(["axis","x","tick","values"],null),Ih=i(["axis","x","tick","rotate"]),Jh=i(["axis","x","max"],null),Kh=i(["axis","x","min"],null),Lh=i(["axis","x","padding"],{}),Mh=i(["axis","x","height"]),Nh=i(["axis","x","default"]),Oh=i(["axis","x","label"],{}),Ph=i(["axis","y","show"],!0),Qh=i(["axis","y","max"]),Rh=i(["axis","y","min"]),Sh=i(["axis","y","center"]),Th=i(["axis","y","label"],{}),Uh=i(["axis","y","inner"],!1),Vh=i(["axis","y","tick","format"]),Wh=i(["axis","y","padding"]),Xh=i(["axis","y","ticks"],10),Yh=i(["axis","y2","show"],!1),Zh=i(["axis","y2","max"]),$h=i(["axis","y2","min"]),_h=i(["axis","y2","center"]),ai=i(["axis","y2","label"],{}),bi=i(["axis","y2","inner"],!1),ci=i(["axis","y2","tick","format"]),di=i(["axis","y2","padding"]),ei=i(["axis","y2","ticks"],10),fi=i(["grid","x","show"],!1),gi=i(["grid","x","type"],"tick"),hi=i(["grid","x","lines"],[]),ii=i(["grid","y","show"],!1),ji=i(["grid","y","lines"],[]),ki=i(["grid","y","ticks"],10),li=i(["point","show"],!0),mi=i(["point","r"],2.5),ni=i(["point","focus","line","enabled"],!0),oi=i(["point","focus","expand","enabled"],!0),pi=i(["point","focus","expand","r"]),qi=i(["point","focus","select","r"]),ri=i(["line","connect_null"],!1),si=i(["bar","width"]),ti=i(["bar","width","ratio"],.6),ui=i(["pie","label","show"],!0),vi=i(["pie","label","format"]),wi=i(["pie","expand"],!0),xi=i(["pie","onclick"],function(){}),yi=i(["pie","onmouseover"],function(){}),zi=i(["pie","onmouseout"],function(){}),Ai=i(["donut","label","show"],!0),Bi=i(["donut","label","format"]),Ci=i(["donut","expand"],!0),Di=i(["donut","title"],""),Ei=i(["donut","onclick"],function(){}),Fi=i(["donut","onmouseover"],function(){}),Gi=i(["donut","onmouseout"],function(){}),Hi=i(["regions"],[]),Ii=i(["tooltip","show"],!0),Ji=i(["tooltip","format","title"]),Ki=i(["tooltip","format","value"]),Li=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Ji?Ji:b,l=Ki?Ki:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Mi=i(["tooltip","init","show"],!1),Ni=i(["tooltip","init","x"],0),Oi=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Pi=("string"==typeof Pf?Pf.replace(/[# .>~+]/g,""):g.chart+ +new Date)+"-clip",Qi=Pi+"-xaxis",Ri=Pi+"-yaxis",Si=j(Pi),Ti=j(Qi),Ui=j(Ri),Vi="timeseries"===yh,Wi="categorized"===yh,Xi=!Vi&&(Ng||Fe(Og)),Yi=null,Zi=!1,$i=!1,_i=!1,aj=!1,bj=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],cj=ze(_g,Fe(ph)?ph:bj,$g),dj=zh?Mf.time.format:Mf.time.format.utc,ej=dj.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),fj=[],gj=[],hj={},ij=wh?"left":"bottom",jj=wh?Uh?"top":"bottom":Uh?"right":"left",kj=wh?bi?"bottom":"top":bi?"left":"right",lj=wh?"left":"bottom",mj={main:function(){return"translate("+k(dg.left)+","+k(dg.top)+")"},context:function(){return"translate("+k(eg.left)+","+k(eg.top)+")"},legend:function(){return"translate("+fg.left+","+fg.top+")"},x:function(){return"translate(0,"+(wh?0:ig)+")" +},y:function(){return"translate(0,"+(wh?ig:0)+")"},y2:function(){return"translate("+(wh?0:gg)+","+(wh?1:0)+")"},subx:function(){return"translate(0,"+(wh?0:jg)+")"},arc:function(){return"translate("+pg/2+","+qg/2+")"}},nj="right"===rh,oj=0,pj=0,qj=0,rj=.15,sj=30,tj=wh&&!xh?0:30,uj=5;ug=Mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var vj,wj=function(){var a=Mf.svg.line().x(wh?function(a){return $(a.id)(a.value)}:Id).y(wh?Id:function(a){return $(a.id)(a.value)});return ri||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ri?Te(b.values):b.values;return me(b)?(a.interpolate(ne(b)?"cardinal":"linear"),Zg[b.id]?gf(e,Dg,$(b.id),Zg[b.id]):a(e)):(c=e[0]?Dg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,wh?"M "+d+" "+c:"M "+c+" "+d)}}(),xj=function(){var a;return a=wh?Mf.svg.area().x0(function(a){return $(a.id)(0)}).x1(function(a){return $(a.id)(a.value)}).y(Id):Mf.svg.area().x(Id).y0(function(a){return $(a.id)(0)}).y1(function(a){return $(a.id)(a.value)}),function(b){var c,d,e=Te(b.values);return ge([b],"area")||ge([b],"area-spline")?(a.interpolate(ne(b)?"cardinal":"linear"),a(e)):(c=e[0]?Dg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,wh?"M "+d+" "+c:"M "+c+" "+d)}}(),yj=function(){var a=Mf.svg.line().x(wh?function(a){return _(a.id)(a.value)}:Ld).y(wh?Ld:function(a){return _(a.id)(a.value)});return function(b){var c=Te(b.values);return me(b)?a(c):"M "+Gg(c[0].x)+" "+_(b.id)(c[0].value)}}(),zj=function(){};vj=Mf.svg.brush().on("brush",rf),vj.update=function(){return Dj&&Dj.select("."+g.brush).call(this),this},vj.scale=function(a){return wh?this.y(a):this.x(a)},Wf&&(zj=Mf.behavior.zoom().on("zoomstart",function(){zj.altDomain=Mf.event.sourceEvent.altKey?Dg.orgDomain():null}).on("zoom",Wf?sf:null),zj.scale=function(a){return wh?this.y(a):this.x(a)},zj.orgScaleExtent=function(){var a=Xf?Xf:[1,10];return[a[0],Math.max(Dc()/a[1],a[1])]},zj.updateScaleExtent=function(){var a=ec(Dg.orgDomain())/ec(Hj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Aj,Bj,Cj,Dj,Ej,Fj,Gj,Hj,Ij,Jj={};if(Nf.focus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);Nf.revert(),Nf.defocus(),b(d.classed(g.focused,!0)),b(e),le(Nf.data.targets)&&Rb(a,!0),Df(a,!0)},Nf.defocus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",.3)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);Nf.revert(),b(d.classed(g.focused,!1)),b(e),le(Nf.data.targets)&&Sb(a),Df(a,!1)},Nf.revert=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);b(d.classed(g.focused,!1)),b(e),le(Nf.data.targets)&&Sb(a),Ef()},Nf.show=function(a,b){a=Hc(a),b=b||{},Pc(a),Aj.selectAll(td(a)).transition().style("opacity",1),b.withLegend&&Ff(a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Nf.hide=function(a,b){a=Hc(a),b=b||{},Oc(a),Aj.selectAll(td(a)).transition().style("opacity",0),b.withLegend&&Gf(a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Nf.toggle=function(a){Jc(a)?Nf.hide(a):Nf.show(a)},Nf.unzoom=function(){vj.clear().update(),qf({withUpdateXDomain:!0})},Nf.load=function(a){return a.xs&&rc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Sg[b]=a.classes[b]}),"categories"in a&&Wi&&(Ah=a.categories,Jg.categories(Ah)),"cacheIds"in a&&fc(a.cacheIds)?void yf(hc(a.cacheIds),a.done):void("unload"in a?Af(Hc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){zf(a)}):zf(a))},Nf.unload=function(a,b){Af(Hc(a),function(){qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Nf.selected=function(a){return Mf.merge(Cj.selectAll("."+g.shapes+rd(a)).selectAll("."+g.shape).filter(function(){return Mf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Nf.select=function(a,b,c){ch&&Cj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Mf.select(this),i=e.data?e.data.id:e.id,j=Se(this),k=dh||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);"path"!==this.nodeName&&(k&&l?eh(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},Nf.unselect=function(a,b){ch&&Cj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Mf.select(this),f=c.data?c.data.id:c.id,h=Se(this),i=dh||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);"path"!==this.nodeName&&i&&j&&eh(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Nf.toLine=function(a){Lf(a,"line")},Nf.toSpline=function(a){Lf(a,"spline")},Nf.toBar=function(a){Lf(a,"bar")},Nf.toScatter=function(a){Lf(a,"scatter")},Nf.toArea=function(a){Lf(a,"area")},Nf.toAreaSpline=function(a){Lf(a,"area-spline")},Nf.toPie=function(a){Lf(a,"pie",{withTransform:!0})},Nf.toDonut=function(a){Lf(a,"donut",{withTransform:!0})},Nf.groups=function(a){return c(a)?Tg:(Tg=a,qf(),Tg)},Nf.xgrids=function(a){return a?(hi=a,qf(),hi):hi},Nf.xgrids.add=function(a){return a?Nf.xgrids(hi.concat(a)):void 0},Nf.xgrids.remove=function(a){var b=Kf(a);return Nf.xgrids(hi.filter(b))},Nf.ygrids=function(a){return a?(ji=a,qf(),ji):ji},Nf.ygrids.add=function(a){return a?Nf.ygrids(ji.concat(a)):void 0},Nf.ygrids.remove=function(a){var b=Kf(a);return Nf.ygrids(ji.filter(b))},Nf.regions=function(a){return a?(Hi=a,qf(),Hi):Hi},Nf.regions.add=function(a){return a?(Hi=Hi.concat(a),qf(),Hi):Hi},Nf.regions.remove=function(a){var b,c,d;return a=a||{},b=Je(a,"duration",cg),c=Je(a,"classes",[g.region]),d=Cj.select("."+g.regions).selectAll(c.map(function(a){return"."+a})),(b?d.transition().duration(b):d).style("opacity",0).remove(),Hi=Hi.filter(function(a){return c.indexOf(a.class)<0})},Nf.data.get=function(a){var b=Nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Nf.data.getAsTarget=function(a){var b=Nf.data.targets.filter(function(b){return b.id===a});return b.length>0?b[0]:void 0},Nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Rg[b]=a[b]}),qf({withLegend:!0}),Rg):Rg},Nf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){_g[b]=a[b]}),qf({withLegend:!0}),_g):_g},Nf.x=function(a){return arguments.length&&(uc(Nf.data.targets,a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Nf.data.xs},Nf.xs=function(a){return arguments.length&&(vc(Nf.data.targets,a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Nf.data.xs},Nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){gb(b,a[b])}),Ib())},Nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Jh=+a.x),b(a.y)&&(Qh=+a.y),b(a.y2)&&(Zh=+a.y2)):Qh=Zh=+a,qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Kh=+a.x),b(a.y)&&(Rh=+a.y),b(a.y2)&&($h=+a.y2)):Rh=$h=+a,qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Nf.axis.max(a.max),"undefined"!=typeof a.min&&Nf.axis.min(a.min))},Nf.legend.show=function(a){Ff(Hc(a)),qf({withLegend:!0})},Nf.legend.hide=function(a){Gf(Hc(a)),qf({withLegend:!0})},Nf.resize=function(a){Qf=a?a.width:null,Rf=a?a.height:null,wf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Nf.destroy=function(){Nf.data.targets=void 0,Nf.data.xs={},Gj.html(""),a.onresize=null},"url"in f.data)Mf.xhr(f.data.url,function(a,b){var c,d=Mf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Mf.csv.parse(b.response),hf(c)});else if("rows"in f.data)hf(xc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");hf(yc(f.data.columns))}return Nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(window); \ No newline at end of file From b678c157bee0e9f77a5a0082ca8d257474415a0f Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Sat, 10 May 2014 11:14:46 +0900 Subject: [PATCH 164/178] Fix category axis when init --- c3.js | 30 ++++++++++++++++-------------- c3.min.js | 4 ++-- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/c3.js b/c3.js index 98ed71d..f16f9ed 100644 --- a/c3.js +++ b/c3.js @@ -3053,6 +3053,21 @@ transitions = transitions || generateAxisTransitions(durationForAxis); + // MEMO: call axis to generate ticks and get those length, then update translate with them + if (withUpdateTranslate) { + if (__axis_rotated) { + axes.x.call(xAxis); + axes.subx.call(subXAxis); + } else { + axes.y.call(yAxis); + axes.y2.call(y2Axis); + } + updateSizes(); + updateScales(); + updateSvgSize(); + transformAll(false); + } + // update legend and transform each g if (withLegend && __legend_show) { updateLegend(mapToIds(c3.data.targets), options, transitions); @@ -3100,19 +3115,6 @@ // Update axis label updateAxisLabels(withTransition); - // MEMO: need to be called after axis updated because updated tick's width will be used - if (withUpdateTranslate) { - updateSizes(); - updateScales(); - updateSvgSize(); - transformAll(false); - // update axis again - axes.x.call(xAxis); - axes.y.call(yAxis); - axes.y2.call(y2Axis); - axes.subx.call(subXAxis); - } - // show/hide if manual culling needed if (withUpdateXDomain && targetsToShow.length) { if (__axis_x_tick_culling && tickValues) { @@ -4609,7 +4611,7 @@ textUpdate = tickUpdate.select("text"); if (isCategory) { - tickOffset = Math.ceil((scale1(1) - scale1(0)) / 2); + tickOffset = Math.round((scale1(1) - scale1(0)) / 2); tickX = tickCentered ? 0 : tickOffset; } else { tickOffset = tickX = 0; diff --git a/c3.min.js b/c3.min.js index ad8b689..070f487 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.round(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.round(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&a=0;return"url("+(c?"":document.URL.split("#")[0])+"#"+b+")"}function k(a){return Math.ceil(a)+.5}function l(a,b){var c,d,e;b&&b.axisX?c=b.axisX:(c=Cj.select("."+g.axisX),a&&(c=c.transition())),b&&b.axisY?d=b.axisY:(d=Cj.select("."+g.axisY),a&&(d=d.transition())),b&&b.axisY2?e=b.axisY2:(e=Cj.select("."+g.axisY2),a&&(e=e.transition())),Cj.attr("transform",mj.main),c.attr("transform",mj.x),d.attr("transform",mj.y),e.attr("transform",mj.y2),Cj.select("."+g.chartArcs).attr("transform",mj.arc)}function m(a,b){var c;b&&b.axisSubX?c=b.axisSubX:(c=Dj.select("."+g.axisX),a&&(c=c.transition())),Dj.attr("transform",mj.context),c.attr("transform",mj.subx)}function n(a){(a?Ej.transition():Ej).attr("transform",mj.legend)}function o(a,b){l(a,b),nh&&m(a,b),n(a)}function p(){var a=U(),b=T(),c=nj?0:a,d=le(Nf.data.targets),e=wh||d?0:A("x"),f=nh&&!d?oh+e:0;kg=t(),lg=u(),wh?(dg={top:A("y2")+v(),right:d?0:y(),bottom:A("y")+c+w(),left:f+(d?0:x())},eg={top:dg.top,right:0/0,bottom:20+c,left:sj}):(dg={top:4+v(),right:d?0:y(),bottom:e+f+c+w(),left:d?0:x()},eg={top:lg-f-c,right:0/0,bottom:e+c,left:dg.left}),fg={top:nj?0:lg-a,right:0/0,bottom:0,left:nj?kg-b:0},gg=kg-dg.left-dg.right,ig=lg-dg.top-dg.bottom,0>gg&&(gg=0),0>ig&&(ig=0),hg=wh?dg.left-sj-tj:gg,jg=wh?ig:lg-eg.top-eg.bottom,0>hg&&(hg=0),0>jg&&(jg=0),pg=gg-(nj?b+10:0),qg=ig-(nj?0:10),r(),nj&&d&&(fg.left=pg/2+1.1*ng)}function q(){Cj.select("line."+g.xgridFocus).attr("x1",wh?0:-10).attr("x2",wh?gg:-10).attr("y1",wh?-10:dg.top).attr("y2",wh?-10:ig)}function r(){ng=Math.min(pg,qg)/2,mg=.95*ng,og=ke(Nf.data.targets)?.6*mg:0}function s(){var a=wh?g.axisX:g.axisY,b=Cj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Gj.node().getBoundingClientRect(),e=le(Nf.data.targets),f=c.right-d.left-(e?0:x());return f>0?f:0}function t(){return Qf?Qf:B()}function u(){var a=Rf?Rf:C();return a>0?a:320}function v(){return Uf?Uf:0}function w(){return Vf?Vf:0}function x(){return Sf?Sf:wh?xh?Ke(z("x")):1:!Ph||Uh?1:Ke(z("y"))}function y(){var a=10,b=nj?T()+20:0;return Tf?Tf:wh?a+b:(!Yh||bi?a:Ke(z("y2")))+b}function z(a){var b=ob(a);return b.isInner?20+Hb(a):40+Hb(a)}function A(a){return"x"!==a||xh?"x"===a&&Mh?Mh:"y"!==a||Ph?"y2"!==a||Yh?(ob(a).isInner?30:40)+("y2"===a?-10:0):uj:qh&&!nj?10:1:0}function B(){return+Gj.style("width").replace("px","")}function C(){return+Gj.style("height").replace("px","")}function D(a){return a?-31:-(dg.left-1)}function E(a){return a?-20:-4}function F(){return D(!wh)}function G(){return E(!wh)}function H(){return D(wh)}function I(){return E(wh)}function J(a){return a?gg+2+30+30:dg.left+20}function K(a){return a?(Mh?Mh:0)+80:ig+8}function L(){return J(!wh)}function M(){return K(!wh)}function N(){return J(wh)}function O(){return K(wh)}function P(){var a,b,c,d,e,f=Ec(Nf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=Dg(b.x)-Dg(a.x),0===c?wh?ig:gg:(d=Dc(),e=he(Nf.data.targets)?(d-(Wi?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function Q(a){oj=a}function R(a){pj=a}function S(a){qj=a}function T(){return qh?nj?pj*(oj+1):kg:0}function U(){return qh?nj?lg:qj*(oj+1):0}function V(){var a,b,c=!Dg;vg=wh?1:0,wg=wh?ig:gg,xg=wh?0:ig,yg=wh?gg:1,zg=vg,Ag=wg,Bg=wh?0:jg,Cg=wh?hg:1,Dg=Y(vg,wg,c?void 0:Dg.domain(),function(){return Jg.tickOffset()}),Eg=Z(xg,yg,c?void 0:Eg.domain()),Fg=Z(xg,yg,c?void 0:Fg.domain()),Gg=Y(vg,wg,Hj,function(a){return a%1?0:Mg.tickOffset()}),Hg=Z(Bg,Cg,c?void 0:Hg.domain()),Ig=Z(Bg,Cg,c?void 0:Ig.domain()),a=db(),b=Hh?Hh:c?void 0:Jg.tickValues(),Jg=ab(Dg,ij,a,b),Mg=ab(Gg,lj,a,b),Kg=bb(Eg,jj,Vh,Xh),Lg=bb(Fg,kj,ci,ei),c||(vj.scale(Gg),Wf&&zj.scale(Dg)),W()}function W(){rg=Kb(),sg=Lb(),tg=Lb(.98)}function X(a,b,c){return(c?Mf.time.scale():Mf.scale.linear()).range([a,b])}function Y(a,b,c,d){var e,f=X(a,b,Vi),g=c?f.domain(c):f;Wi?(d=d||function(){return 0},f=function(a,b){var c=g(a)+d(a);return b?c:Math.ceil(c)}):f=function(a,b){var c=g(a);return b?c:Math.ceil(c)};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return Hj&&Hj[0]===a[0]&&Hj[1]a?a.toFixed(0):a};return Ch&&("function"==typeof Ch?a=Ch:Vi&&(a=function(a){return a?dj(Ch)(a):""})),a}function eb(a){var b;return"y"===a?b=Th:"y2"===a?b=ai:"x"===a&&(b=Oh),b}function fb(a){var b=eb(a);return"string"==typeof b?b:b?b.text:null}function gb(a,b){var c=eb(a);"string"==typeof c?"y"===a?Th=b:"y2"===a?ai=b:"x"===a&&(Oh=b):c&&(c.text=b)}function hb(a){return 10*Math.sin(Math.PI*(a/180))}function ib(a){return 11.5-2.5*(a/15)}function jb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",ib(c)).attr("x",hb(c)).attr("transform","rotate("+c+")")}function kb(a,b){var c=eb(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 lb(){return kb("x",wh?"inner-top":"inner-right")}function mb(){return kb("y",wh?"inner-right":"inner-top")}function nb(){return kb("y2",wh?"inner-right":"inner-top")}function ob(a){return"y2"===a?nb():"y"===a?mb():lb()}function pb(){return fb("x")}function qb(){return fb("y")}function rb(){return fb("y2")}function sb(a,b){return a?b.isLeft?0:b.isCenter?gg/2:gg:b.isBottom?-ig:b.isMiddle?-ig/2:0}function tb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function ub(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function vb(){return sb(!wh,lb())}function wb(){return sb(wh,mb())}function xb(){return sb(wh,nb())}function yb(){return tb(!wh,lb())}function zb(){return tb(wh,mb())}function Ab(){return tb(wh,nb())}function Bb(){var a=lb();return wh?a.isInner?"1.2em":-25-Hb("x"):a.isInner?"-0.5em":Mh?Mh-10:"3em"}function Cb(){var a=mb();return wh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Hb("y")}function Db(){var a=nb();return wh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Hb("y2")}function Eb(){return ub(!wh,lb())}function Fb(){return ub(wh,mb())}function Gb(){return ub(wh,nb())}function Hb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Ib(a){var b=Cj.select("."+g.axisX+" ."+g.axisXLabel),c=Cj.select("."+g.axisY+" ."+g.axisYLabel),d=Cj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",vb).attr("dx",yb).attr("dy",Bb).text(pb),(a?c.transition():c).attr("x",wb).attr("dx",zb).attr("dy",Cb).attr("dy",Cb).text(qb),(a?d.transition():d).attr("x",xb).attr("dx",Ab).attr("dy",Db).text(rb)}function Jb(a){var b=!1;return ug(Lc(Nf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Kb(){var a=Mf.svg.arc().outerRadius(mg).innerRadius(og),b=function(b,c){var d;return c?a(b):(d=Jb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Lb(a){var b=Mf.svg.arc().outerRadius(ng*(a?a:1)).innerRadius(og);return function(a){var c=Jb(a);return c?b(c):"M 0 0"}}function Mb(a,b){return se(a.data)?rg(a,b):"M 0 0"}function Nb(a){var b,c,d,e,f=Jb(a),g="";return f&&(b=rg.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*mg*.8+","+d/e*mg*.8+")"),g}function Ob(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Pb(a){return tc({id:a.data.id,value:a.value,ratio:Ob(a)})}function Qb(a){var b,c,d,e;return Tb()?(b=Jb(a),c=b?b.value:null,d=Ob(b),e=Ub(),e?e(c,d):Gd(c,d)):""}function Rb(a,b){var c=Aj.selectAll("."+g.chartArc+sd(a)),d=Aj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});ye(a)&&c.selectAll("path").transition().duration(50).attr("d",sg).transition().duration(100).attr("d",tg).each(function(a){re(a.data)}),b||d.style("opacity",.3)}function Sb(a){var b=Aj.selectAll("."+g.chartArc+sd(a));b.selectAll("path").transition().duration(50).attr("d",rg),Aj.selectAll("."+g.arc).style("opacity",1)}function Tb(){return ke(Nf.data.targets)?Ai:ui}function Ub(){return ke(Nf.data.targets)?Bi:vi}function Vb(){return ke(Nf.data.targets)?Di:""}function Wb(){var a=ke(Nf.data.targets)?Ei:xi;return"function"==typeof a?a:function(){}}function Xb(){var a=ke(Nf.data.targets)?Fi:yi;return"function"==typeof a?a:function(){}}function Yb(){var a=ke(Nf.data.targets)?Gi:zi;return"function"==typeof a?a:function(){}}function Zb(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Tg.length>0)for(g=Uc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return Mf.min(Object.keys(i).map(function(a){return Mf.min(i[a])}))}function $b(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Tg.length>0)for(g=Vc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return Mf.max(Object.keys(i).map(function(a){return Mf.max(i[a])}))}function _b(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return cb(a.id)===c}),m="y2"===c?$h:Rh,n="y2"===c?Zh:Qh,o=b(m)?m:Zb(l),p=b(n)?n:$b(l),q="y2"===c?_h:Sh,r=Ad()&&wh;return 0===l.length?"y2"===c?Fg.domain():Eg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=Bd(o,p),j=ec(Eg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Wh&&(f=b(Wh.top)?Wh.top:e,g=b(Wh.bottom)?Wh.bottom:e),"y2"===c&&di&&(f=b(di.top)?di.top:e,g=b(di.bottom)?di.bottom:e),he(l)&&!Uc(l)&&(g=o),[o-g,p+f])}function ac(a){return Kh?Vi?Ae(Kh):Kh:Mf.min(a,function(a){return Mf.min(a.values,function(a){return a.x})})}function bc(a){return Jh?Vi?Ae(Jh):Jh:Mf.max(a,function(a){return Mf.max(a.values,function(a){return a.x})})}function cc(a){var c,d,e,f,g=Fc(a),h=g[1]-g[0];return Wi?d=0:he(a)?(c=Dc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Lh&&Fe(Lh)?(e=b(Lh.left)?Lh.left:d,f=b(Lh.right)?Lh.right:d):e=f="number"==typeof Lh?Lh:d,{left:e,right:f}}function dc(a){var b=[ac(a),bc(a)],c=b[0],d=b[1],e=cc(a),f=0,g=0;return c-d!==0||Wi||(c=Vi?new Date(.5*c.getTime()):-.5,d=Vi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ec(a){return a[1]-a[0]}function fc(a){for(var b=0;bb?0:b-c}function lc(a){var b,c=jc(a),d="y"===a.axis?Eg:Fg;return b="y"===a.axis||"y2"===a.axis?wh?ig:"start"in a?d(a.start):ig:wh?"end"in a?Dg(Vi?Ae(a.end):a.end):ig:ig,c>b?0:b-c}function mc(a){return Ng&&a===Ng||Fe(Og)&&Ge(Og,a)}function nc(a){return!mc(a)}function oc(a){return Ng?Ng:Fe(Og)?Og[a]:null}function pc(a,b){var c,d=b&&Fe(b)?Gc(b):[];return d.forEach(function(b){oc(b)===a&&(c=Nf.data.xs[b])}),c}function qc(a,b){return a in Nf.data.xs&&Nf.data.xs[a]&&Nf.data.xs[a][b]?Nf.data.xs[a][b]:b}function rc(a){Object.keys(a).forEach(function(b){Og[b]=a[b]})}function sc(a){return 1===Mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function tc(a){var b;return a&&(b=Rg[a.id],a.name=b?b:a.id),a}function uc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=wc(b[d],a.id,d)}),Nf.data.xs[a.id]=b})}function vc(a,b){a.forEach(function(a){b[a.id]&&uc([a],b[a.id])})}function wc(a,c,d){var e;return e=Vi?a?a instanceof Date?a:Ae(a):Ae(qc(c,d)):Xi&&!Wi?b(a)?+a:qc(c,d):d}function xc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Ng?(d=Object.keys(Nf.data.xs),Nf.data.xs[c]=d.length>0?Nf.data.xs[d[0]]:void 0):Fe(Og)&&(Nf.data.xs[c]=pc(f,Nf.data.targets)):Nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Qg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=oc(b),g=a[f],h=wc(g,b,e);return Xi&&Wi&&0===c&&g&&(0===e&&(Ah=[]),Ah.push(g)),("undefined"==typeof a[b]||Nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Vg&&fe(Gc(c).filter(function(a){return!(a in Wg)}),Vg),c.forEach(function(a){gc(a.id_org,a)}),c}function Ac(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 Bc(a){return a>0&&Nf.data.targets[0].values[a-1]?Nf.data.targets[0].values[a-1].x:void 0}function Cc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Fc(a){var b,c,d=Ec(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Gc(a){return a.map(function(a){return a.id})}function Hc(a){return a?"string"==typeof a?[a]:a:Gc(Nf.data.targets)}function Ic(a,b){var c,d=Gc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Vi?new Date(i):i);j.push(e)}return Vi||(j=j.sort(function(a,b){return a-b})),j}function Oc(a){fj=fj.concat(a)}function Pc(a){fj=fj.filter(function(b){return a.indexOf(b)<0})}function Qc(a){gj=gj.concat(a)}function Rc(a){gj=gj.filter(function(b){return a.indexOf(b)<0})}function Sc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Tc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Vc(a){return Tc(a,function(a){return a>0})}function Wc(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||0===a[f].x)&&(e=e.concat(Md(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Md(a,g))),Pd(e,b)):Nd(a,b,f,g)}function Od(a,b){var c;return c=a.map(function(a){return Nd(a.values,b)}),Pd(c,b)}function Pd(a,b){var c,d;return a.forEach(function(a){var e=He(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Qd(a,b){return Mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Rd(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 Sd(){return Yg&&"desc"===Yg.toLowerCase()}function Td(){return Yg&&"asc"===Yg.toLowerCase()}function Ud(a){var b=Td(),c=Sd();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 Yg&&a.sort(Yg),a}function Vd(a,c){var d,e,f,g,h,i,j,k=le(Nf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&Ii&&(Fj.html(Li(a,db(),Cd(k),cj)).style("display","block"),d=Fj.property("offsetWidth"),e=Fj.property("offsetHeight"),k?(g=gg/2+c[0],i=ig/2+c[1]+20):(wh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-y(),i=Dg(l[0].x)+20):(f=s(),g=f+x()+Dg(l[0].x)+20,h=g+d,j=f+t()-y(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),Fj.style("top",i+"px").style("left",g+"px"))}function Wd(){Fj.style("display","none")}function Xd(a){var c=a.filter(function(a){return a&&b(a.value)});if(Ii&&!ie(Nf.data.targets)&&!le(Nf.data.targets)){var d=Cj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(wh?"y1":"x1",Id).attr(wh?"y2":"x2",Id),pf(d,"grid")}}function Yd(){Cj.select("line."+g.xgridFocus).style("visibility","hidden")}function Zd(a,b){var c,d,e,f,h=[],i=Cj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=dc(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function $d(a){return a.x||0===a.x?Dg(a.x):null}function _d(a){return $(a.id)(a.value)}function ae(){var a,b,d={},e=0;return Lc(Nf.data.targets.filter(oe)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ee(a,b){return"number"==typeof si?si:b?2*a.tickOffset()*ti/b:0}function fe(a,b){Hc(a).forEach(function(a){Jj[a]=b===Wg[a],Wg[a]=b})}function ge(a,b){var c=!1;return a.forEach(function(a){Wg[a.id]===b&&(c=!0),a.id in Wg||"line"!==b||(c=!0)}),c}function he(a){return ge(a,"bar")}function ie(a){return ge(a,"scatter")}function je(a){return ge(a,"pie")}function ke(a){return ge(a,"donut")}function le(a){return je(a)||ke(a)}function me(a){var b="string"==typeof a?a:a.id;return!(b in Wg)||"line"===Wg[b]||"spline"===Wg[b]||"area"===Wg[b]||"area-spline"===Wg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"spline"===Wg[b]||"area-spline"===Wg[b]}function oe(a){var b="string"==typeof a?a:a.id;return"bar"===Wg[b]}function pe(a){var b="string"==typeof a?a:a.id;return"scatter"===Wg[b]}function qe(a){var b="string"==typeof a?a:a.id;return"pie"===Wg[b]}function re(a){var b="string"==typeof a?a:a.id;return"donut"===Wg[b]}function se(a){return qe(a)||re(a)}function te(a){return me(a)?[a]:[]}function ue(a){return se(a.data)?[a]:[]}function ve(a){return oe(a)?a.values:[]}function we(a){return me(a)||pe(a)?a.values:[]}function xe(a){return oe(a)||me(a)?a.values:[]}function ye(a){return re(a)&&Ci||qe(a)&&wi}function ze(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function Ae(b){var c;try{c=Pg?Mf.time.format(Pg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Pg)}return c}function Be(a,b){var c=Mf.mouse(a),d=Mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ge(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function He(a,b){var c="y"===cb(a.id)?Eg:Fg,d=wh?1:0,e=wh?0:1;return Math.pow(Dg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ie(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Je(a,b,c){return d(a[b])?a[b]:c}function Ke(a){return 10*Math.ceil(a/10)}function Le(a,b,c){jh(b,a.node()),Cj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Xc(g.selectedCircle,c)}).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d).attr("stroke",function(){return cj(b)}).attr("r",1.4*We(b)).transition().duration(100).attr("r",We)}function Me(a,b,c){kh(b,a.node()),Cj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ne(a,b,c,d){a?Le(b,c,d):Me(b,c,d)}function Oe(a,b){jh(b,a.node()),a.transition().duration(100).style("fill",function(){return Mf.rgb(cj(b)).brighter(.75)})}function Pe(a,b){kh(b,a.node()),a.transition().duration(100).style("fill",function(){return cj(b)})}function Qe(a,b,c,d){a?Oe(b,c,d):Pe(b,c,d)}function Re(a,b,c,d){Qe(a,b,c.data,d)}function Se(a){return"circle"===a.nodeName?Ne:Mf.select(a).classed(g.bar)?Qe:Re}function Te(a){return a.filter(function(a){return b(a.value)})}function Ue(a){return li?"function"==typeof mi?mi(a):mi:0}function Ve(a){return oi?pi?pi:1.75*Ue(a):Ue(a)}function We(a){return qi?qi:4*Ue(a)}function Xe(a,c){return(c?Cj.selectAll("."+g.circles+rd(c)):Cj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ye(a,b){Xe(a,b).classed(g.EXPANDED,!0).attr("r",Ve)}function Ze(a){Xe(a).filter(function(){return Mf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Ue)}function $e(a){return Cj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function _e(a){$e(a).classed(g.EXPANDED,!0)}function af(a){$e(a).classed(g.EXPANDED,!1)}function bf(a,b){var c=ff(a,b);return function(a,b){var d=c(a,b),e=wh?1:0,f=wh?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 cf(a,b){var c=ff(a,!1),d=b?df:ef;return function(a,b){return d(c(a,b),a,this)}}function df(a,b){var c;return wh?(c=oe(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function ef(a,b,c){var d=c.getBoundingClientRect();return wh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:oe(b)?-3:-6)}function ff(a,b){var c=a.__max__+1,d=ee(Jg,c),e=be(d,c,a,!!b),f=ce(!!b),g=de(a,!!b),h=b?_:$;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return wh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function gf(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function hf(b){var c,d,e;if(Gj=Mf.select(Pf),Gj.empty())throw new Error("Element to bind not found");if(Gj.html("").classed("c3",!0),Nf.data.xs={},Nf.data.targets=zc(b),bh&&(Nf.data.targets=Nf.data.targets.filter(bh)),ah&&Oc(ah===!0?Gc(Nf.data.targets):ah),p(),V(),Dg.domain(Mf.extent(dc(Nf.data.targets))),Eg.domain(_b(Nf.data.targets,"y")),Fg.domain(_b(Nf.data.targets,"y2")),Gg.domain(Dg.domain()),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Hj=Dg.domain(),vj.scale(Gg),Wf&&zj.scale(Dg),Aj=Gj.append("svg").style("overflow","hidden").on("mouseenter",$f).on("mouseleave",_f),Bj=Aj.append("defs"),Bj.append("clipPath").attr("id",Pi).append("rect"),Bj.append("clipPath").attr("id",Qi).append("rect"),Bj.append("clipPath").attr("id",Ri).append("rect"),uf(),Cj=Aj.append("g").attr("transform",mj.main),Dj=Aj.append("g").attr("transform",mj.context),Ej=Aj.append("g").attr("transform",mj.legend),nh||Dj.style("visibility","hidden"),qh||(Ej.style("visibility","hidden"),gj=Gc(Nf.data.targets)),Fj=Gj.style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Hf(Gc(Nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=Cj.append("g").attr("clip-path",Si).attr("class",g.grid),fi&&d.append("g").attr("class",g.xgrids),Fe(hi)&&d.append("g").attr("class",g.xgridLines),ni&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),ii&&d.append("g").attr("class",g.ygrids),Fe(ji)&&d.append("g").attr("class",g.ygridLines),Cj.append("g").attr("clip-path",Si).attr("class",g.regions),Cj.append("g").attr("clip-path",Si).attr("class",g.chart),c=Cj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Wf?wh?"ns-resize":"ew-resize":null),Cj.select("."+g.chart).append("g").attr("class",g.chartBars),Cj.select("."+g.chart).append("g").attr("class",g.chartLines),Cj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",mj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Vb()),Cj.select("."+g.chart).append("g").attr("class",g.chartTexts),Wf&&Cj.insert("rect",Yf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",gg).attr("height",ig).style("opacity",0).style("cursor",wh?"ns-resize":"ew-resize").call(zj).on("dblclick.zoom",null),Nh&&vj.extent("function"!=typeof Nh?Nh:Nh(dc())),hj.x=Cj.append("g").attr("class",g.axisX).attr("clip-path",Ti).attr("transform",mj.x).style("visibility",xh?"visible":"hidden"),hj.x.append("text").attr("class",g.axisXLabel).attr("transform",wh?"rotate(-90)":"").style("text-anchor",Eb),hj.y=Cj.append("g").attr("class",g.axisY).attr("clip-path",Ui).attr("transform",mj.y).style("visibility",Ph?"visible":"hidden"),hj.y.append("text").attr("class",g.axisYLabel).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Fb),hj.y2=Cj.append("g").attr("class",g.axisY2).attr("transform",mj.y2).style("visibility",Yh?"visible":"hidden"),hj.y2.append("text").attr("class",g.axisY2Label).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Gb),Dj.append("g").attr("clip-path",Si).attr("class",g.chart),Dj.select("."+g.chart).append("g").attr("class",g.chartBars),Dj.select("."+g.chart).append("g").attr("class",g.chartLines),Dj.append("g").attr("clip-path",Si).attr("class",g.brush).call(vj).selectAll("rect").attr(wh?"width":"height",wh?hg:jg),hj.subx=Dj.append("g").attr("class",g.axisX).attr("transform",mj.subx).attr("clip-path",wh?"":Ti),xf(Nf.data.targets),qf({withUpdateTranslate:!0,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Mi){if(Vi&&"string"==typeof Ni){for(Ni=Ae(Ni),e=0;e0){d=[];for(var f in Rg)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Rd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Qe,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function nf(a){le(Nf.data.targets)||ch&&(Yi=a,Cj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Zi=!0,lh())}function of(){le(Nf.data.targets)||ch&&(Cj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),Cj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Zi=!1,mh())}function pf(a,b){"grid"===b&&a.each(function(){var a=Mf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function qf(a,c){var d,e,f,h,i,j,k,l,m,n,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,Q,R,S,T,U,W,X,Y,Z,$=ae(),_=le(Nf.data.targets),ab=Lc(Nf.data.targets);if(a=a||{},E=Je(a,"withY",!0),F=Je(a,"withSubchart",!0),G=Je(a,"withTransition",!0),J=Je(a,"withTransform",!1),K=Je(a,"withUpdateXDomain",!1),L=Je(a,"withUpdateOrgXDomain",!1),N=Je(a,"withUpdateTranslate",!1),M=Je(a,"withLegend",!1),H=Je(a,"withTransitionForExit",G),I=Je(a,"withTransitionForAxis",G),T=G?cg:0,U=H?T:0,W=I?T:0,c=c||vf(W),M&&qh&&Hf(Gc(Nf.data.targets),a,c),Wi&&0===ab.length&&Dg.domain([0,hj.x.selectAll(".tick").size()]),ab.length&&(L&&(Dg.domain(Mf.extent(dc(ab))),Hj=Dg.domain(),Wf&&zj.scale(Dg).updateScaleExtent(),Gg.domain(Dg.domain()),vj.scale(Gg)),K&&(Dg.domain(vj.empty()?Hj:vj.extent()),Wf&&zj.scale(Dg).updateScaleExtent()),Hh||!Gh&&!Fh||(X=Nc(Mc(ab),Fh),Jg.tickValues(X),Mg.tickValues(X))),Eg.domain(_b(ab,"y")),Fg.domain(_b(ab,"y2")),hj.x.style("opacity",_?0:1),hj.y.style("opacity",_?0:1),hj.y2.style("opacity",_?0:1),hj.subx.style("opacity",_?0:1),c.axisX.call(Jg),c.axisY.call(Kg),c.axisY2.call(Lg),c.axisSubX.call(Mg),Ib(G),N&&(p(),V(),uf(),o(!1),hj.x.call(Jg),hj.y.call(Kg),hj.y2.call(Lg),hj.subx.call(Mg)),K&&ab.length)if(Dh&&X){for(Y=1;Y=0&&Mf.select(this).style("display",b%Z?"none":"block")})}else Aj.selectAll("."+g.axisX+" .tick text").style("display","block");!wh&&Ih&&jb(hj.x,c.axisX,Ih),O=bf($),R=cf($,!0),S=cf($,!1),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Fj.style("display","none"),q(),Cj.select("line."+g.xgridFocus).style("visibility","hidden"),fi&&(f=Zd(gi,Dg),B=Wi?Jg.tickOffset():0,e=wh?{x1:0,x2:gg,y1:function(a){return Dg(a)-B},y2:function(a){return Dg(a)-B}}:{x1:function(a){return Dg(a)+B},x2:function(a){return Dg(a)+B},y1:dg.top,y2:ig},d=Cj.select("."+g.xgrids).selectAll("."+g.xgrid).data(f),d.enter().append("line").attr("class",g.xgrid),d.attr(e).style("opacity",function(){return+Mf.select(this).attr(wh?"y1":"x1")===(wh?ig:0)?0:1}),d.exit().remove()),Fe(hi)&&(h=Cj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(hi),i=h.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),i.append("line").style("opacity",0),i.append("text").attr("text-anchor","end").attr("transform",wh?"":"rotate(-90)").attr("dx",wh?0:-dg.top).attr("dy",-5).style("opacity",0),h.select("line").transition().duration(T).attr("x1",wh?0:Jd).attr("x2",wh?gg:Jd).attr("y1",wh?Jd:dg.top).attr("y2",wh?Jd:ig).style("opacity",1),h.select("text").transition().duration(T).attr("x",wh?gg:0).attr("y",Jd).text(function(a){return a.text}).style("opacity",1),h.exit().transition().duration(T).style("opacity",0).remove()),E&&ii&&(j=Cj.select("."+g.ygrids).selectAll("."+g.ygrid).data(Eg.ticks(ki)),j.enter().append("line").attr("class",g.ygrid),j.attr("x1",wh?Eg:0).attr("x2",wh?Eg:gg).attr("y1",wh?0:Eg).attr("y2",wh?ig:Eg),j.exit().remove(),pf(j,"grid")),E&&Fe(ji)&&(k=Cj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(ji),l=k.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",wh?"rotate(-90)":"").attr("dx",wh?0:-dg.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",wh?Kd:0).attr("x2",wh?Kd:gg).attr("y1",wh?0:Kd).attr("y2",wh?ig:Kd).style("opacity",1),k.select("text").transition().duration(T).attr("x",wh?0:gg).attr("y",Kd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),u=Cj.select("."+g.regions).selectAll("."+g.region).data(Hi),u.enter().append("g").attr("class",kd).append("rect").style("fill-opacity",0),u.selectAll("rect").transition().duration(T).attr("x",ic).attr("y",jc).attr("width",kc).attr("height",lc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),u.exit().transition().duration(T).style("opacity",0).remove(),s=Cj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),s.enter().append("path").attr("class",ed).style("stroke","none").style("fill",cj),s.style("opacity",wd).transition().duration(T).attr("d",O).style("fill",cj).style("opacity",1),s.exit().transition().duration(U).style("opacity",0).remove(),m=Cj.selectAll("."+g.lines).selectAll("."+g.line).data(te),m.enter().append("path").attr("class",ad).style("stroke",cj),m.style("opacity",wd).transition().duration(T).attr("d",wj).style("stroke",cj).style("opacity",1),m.exit().transition().duration(U).style("opacity",0).remove(),n=Cj.selectAll("."+g.areas).selectAll("."+g.area).data(te),n.enter().append("path").attr("class",id).style("fill",cj).style("opacity",function(){return Ij=+Mf.select(this).style("opacity"),0}),n.style("opacity",0).transition().duration(T).attr("d",xj).style("fill",cj).style("opacity",Ij),n.exit().transition().duration(U).style("opacity",0).remove(),r=Cj.selectAll("."+g.circles).selectAll("."+g.circle).data(we),r.enter().append("circle").attr("class",cd).attr("r",Ue).style("fill",cj),r.style("opacity",wd).transition().duration(T).style("opacity",yd).style("fill",cj).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d),r.exit().remove(),v=Cj.selectAll("."+g.texts).selectAll("."+g.text).data(xe),v.enter().append("text").attr("class",Yc).attr("text-anchor",function(a){return wh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",cj).style("fill-opacity",0),v.text(function(a){return Hd(a.id)(a.value,a.id)}).style("fill-opacity",xd).transition().duration(T).attr("x",R).attr("y",S).style("fill",cj).style("fill-opacity",zd),v.exit().transition().duration(U).style("fill-opacity",0).remove(),t=Cj.selectAll("."+g.arcs).selectAll("."+g.arc).data(ue),t.enter().append("path").attr("class",gd).style("fill",function(a){return cj(a.data)}).style("cursor",function(a){return eh(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;aj||(c=Jb(a),d=Pb(c),e=Xb(),Rb(c.data.id),Df(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Jb(a),c=Pb(b),d=[c];Vd(d,Mf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;aj||(c=Jb(a),d=Pb(c),e=Yb(),Sb(c.data.id),Ef(),Wd(),e(d,b))}).on("click",function(a,b){var c=Jb(a),d=Pb(c),e=Wb();lf(this,a,b),e(d,b)}),t.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){aj=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Jb(a);return c?(b=Mf.interpolate(this._current,c),this._current=b(0),function(a){return Mb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("fill",function(a){return cj(a.data)}).style("opacity",1).call(Ie,function(){aj=!1}),t.exit().transition().duration(U).style("opacity",0).remove(),Cj.selectAll("."+g.chartArc).select("text").attr("transform",Nb).style("opacity",0).transition().duration(T).text(Qb).style("opacity",function(a){return Jc(a.data.id)&&se(a.data)?1:0}),Cj.select("."+g.chartArcsTitle).style("opacity",ke(Nf.data.targets)?1:0),nh&&(Mf.event&&"zoom"===Mf.event.type&&vj.extent(Dg.orgDomain()).update(),F&&(!wh&&Ih&&jb(hj.subx,c.axisSubX,Ih),vj.empty()||vj.extent(Dg.orgDomain()).update(),Q=bf($,!0),x=Dj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),x.enter().append("path").attr("class",ed).style("stroke","none").style("fill",cj),x.style("opacity",wd).transition().duration(T).attr("d",Q).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove(),w=Dj.selectAll("."+g.lines).selectAll("."+g.line).data(te),w.enter().append("path").attr("class",ad).style("stroke",cj),w.style("opacity",wd).transition().duration(T).attr("d",yj).style("opacity",1),w.exit().transition().duration(T).style("opacity",0).remove())),Cj.selectAll("."+g.selectedCircles).filter(function(a){return oe(a)}).selectAll("circle").remove(),Cj.selectAll("."+g.selectedCircle).transition().duration(T).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d),Zf&&(y=Cj.select("."+g.eventRects),Fe(Og)&&!sc(Og)?(y.classed(g.eventRectsMultiple)||y.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),z=Cj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),kf(z.enter()),z.attr("x",0).attr("y",0).attr("width",gg).attr("height",ig)):(y.classed(g.eventRectsSingle)||y.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Xi&&!Wi?(D=function(a,b){var c=Bc(b),d=Cc(b),e=Nf.data.xs[a.id][b];return(Dg(d?d:e+50)-Dg(c?c:e-50))/2},C=function(a,b){var c=Bc(b),d=Nf.data.xs[a.id][b];return(Dg(d)+Dg(c?c:d-50))/2}):(D=P(),C=function(a){return Dg(a.x)-D/2}),A=Ec(Nf.data.targets),Cj.select("."+g.eventRects).datum(A?A.values:[]),z=Cj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),jf(z.enter()),z.attr("class",ld).attr("x",wh?0:C).attr("y",wh?C:0).attr("width",wh?gg:D).attr("height",wh?D:ig),z.exit().remove())),Gc(Nf.data.targets).forEach(function(a){Jj[a]=!0})}function rf(){qf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function sf(){if(0!==Lc(Nf.data.targets).length){if("mousemove"===Mf.event.sourceEvent.type&&zj.altDomain)return Dg.domain(zj.altDomain),void zj.scale(Dg).updateScaleExtent();Wi&&Dg.orgDomain()[0]===Hj[0]&&Dg.domain([Hj[0]-1e-10,Dg.orgDomain()[1]]),qf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Mf.event.sourceEvent.type&&($i=!0)}}function tf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function uf(){Aj.attr("width",kg).attr("height",lg),Aj.select("#"+Pi).select("rect").attr("width",gg).attr("height",ig),Aj.select("#"+Qi).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),Aj.select("#"+Ri).select("rect").attr("x",H).attr("y",I).attr("width",N).attr("height",O),Aj.select("."+g.zoomRect).attr("width",gg).attr("height",ig),Gj.style("max-height",lg+"px")}function vf(a){return{axisX:a?hj.x.transition().duration(a):hj.x,axisY:a?hj.y.transition().duration(a):hj.y,axisY2:a?hj.y2.transition().duration(a):hj.y2,axisSubX:a?hj.subx.transition().duration(a):hj.subx}}function wf(a){var b;a=a||{},a.withTransition=Je(a,"withTransition",!0),a.withTransform=Je(a,"withTransform",!1),a.withLegend=Je(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withLegend&&qh||(b=vf(a.withTransitionForAxis?cg:0),p(),V(),uf(),o(a.withTransition,b)),qf(a,b)}function xf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=Cj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",nd),j=i.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Zc),e=Cj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),d=e.enter().append("g").attr("class",pd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",fd).style("cursor",function(a){return eh(a)?"pointer":null}),c=Cj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),b=c.enter().append("g").attr("class",od).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",bd),b.append("g").attr("class",jd),b.append("g").attr("class",function(a){return Xc(g.selectedCircles,a.id)}),b.append("g").attr("class",dd).style("cursor",function(a){return eh(a)?"pointer":null}),a.forEach(function(a){Cj.selectAll("."+g.selectedCircles+rd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Cj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(ug(a)).attr("class",qd),f=h.enter().append("g").attr("class",qd),f.append("g").attr("class",hd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),nh&&(n=Dj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),m=n.enter().append("g").style("opacity",0).attr("class",pd),m.append("g").attr("class",fd),l=Dj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),k=l.enter().append("g").style("opacity",0).attr("class",od),k.append("g").attr("class",bd)),Aj.selectAll("."+g.target).filter(function(a){return Jc(a.id)}).transition().duration(cg).style("opacity",1)}function yf(a,b){b.filter&&(a=a.filter(b.filter)),(b.type||b.types)&&a.forEach(function(a){b.types?fe(a.id,b.types[a.id]):fe(a.id,b.type)}),Nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,z=0,F++)),E[a]=F,D[F]=f,A[a]=z,z+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+v)/10),j=10*Math.ceil((h.height+u)/10),k=nj?j:i,l=nj?U():T();return d&&(z=0,F=0,w=0,x=0),qh&&!Kc(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=i,C[c]=j,(!w||i>=w)&&(w=i),(!x||j>=x)&&(x=j),g=nj?x:w,void(vh?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(l-g*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=26,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=Ej.selectAll("."+g.legendItemFocused).size();b=b||{},n=Je(b,"withTransition",!0),q=Je(b,"withTransitionForTransform",!0),nj?(f=function(a){return w*E[a]},j=function(a){return D[E[a]]+A[a]}):(f=function(a){return D[E[a]]+A[a]},j=function(a){return x*E[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=Ej.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Xc(g.legendItem,a)}).style("visibility",function(a){return Kc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof sh?sh(a):Nf.toggle(a)}).on("mouseover",function(a){Mf.select(this).classed(g.legendItemFocused,!0),aj||Nf.focus(a),"function"==typeof th&&th(a)}).on("mouseout",function(a){Mf.select(this).classed(g.legendItemFocused,!1),aj||Nf.revert(),"function"==typeof uh&&uh(a)}),m.append("text").text(function(a){return d(Rg[a])?Rg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",nj?h:-200).attr("y",nj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",nj?i:-200).attr("y",nj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",cj).attr("x",nj?h:-200).attr("y",nj?-200:j).attr("width",10).attr("height",10),r=Ej.selectAll("text").data(a).text(function(a){return d(Rg[a])?Rg[a]:a}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=Ej.selectAll("rect."+g.legendItemEvent).data(a),(n?s.transition():s).attr("width",function(a){return B[a]}).attr("height",function(a){return C[a]}).attr("x",i).attr("y",l),t=Ej.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",cj).attr("x",f).attr("y",j),Ej.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Jc(a)}).transition().style("opacity",function(a){var b=Mf.select(this);return Jc(a)?!G||b.classed(g.legendItemFocused)?Bf(b):Cf(b):rj}),R(w),S(x),Q(F),p(),V(),uf(),o(q,c)}function If(a){return Ic(Nf.data.targets,a.id)}function Jf(a){return"data"in a&&Ic(Nf.data.targets,a.data.id)}function Kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function Lf(a,b,c){var d=!le(Nf.data.targets);aj=!1,fe(a,b),wf(c||{withTransitionForAxis:d})}var Mf=a.d3?a.d3:a.require?a.require("d3"):void 0,Nf={data:{},axis:{},legend:{}},Of={},Pf=i(["bindto"],"#chart"),Qf=i(["size","width"]),Rf=i(["size","height"]),Sf=i(["padding","left"]),Tf=i(["padding","right"]),Uf=i(["padding","top"]),Vf=i(["padding","bottom"]),Wf=i(["zoom","enabled"],!1),Xf=i(["zoom","extent"]),Yf=i(["zoom","privileged"],!1),Zf=i(["interaction","enabled"],!0),$f=i(["onenter"],function(){}),_f=i(["onleave"],function(){}),ag=i(["onresize"],function(){}),bg=i(["onresized"],function(){}),cg=i(["transition","duration"],350);h("data","data is required in config");var dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg,Kg,Lg,Mg,Ng=i(["data","x"]),Og=i(["data","xs"],{}),Pg=i(["data","x_format"]),Qg=i(["data","id_converter"],function(a){return a}),Rg=i(["data","names"],{}),Sg=i(["data","classes"],{}),Tg=i(["data","groups"],[]),Ug=i(["data","axes"],{}),Vg=i(["data","type"]),Wg=i(["data","types"],{}),Xg=i(["data","labels"],{}),Yg=i(["data","order"]),Zg=i(["data","regions"],{}),$g=i(["data","color"]),_g=i(["data","colors"],{}),ah=i(["data","hide"],!1),bh=i(["data","filter"]),ch=i(["data","selection","enabled"],!1),dh=i(["data","selection","grouped"],!1),eh=i(["data","selection","isselectable"],function(){return!0}),fh=i(["data","selection","multiple"],!0),gh=i(["data","onclick"],function(){}),hh=i(["data","onenter"],function(){}),ih=i(["data","onleave"],function(){}),jh=i(["data","onselected"],function(){}),kh=i(["data","onunselected"],function(){}),lh=i(["data","ondragstart"],function(){}),mh=i(["data","ondragend"],function(){}),nh=i(["subchart","show"],!1),oh=i(["subchart","size","height"],60),ph=i(["color","pattern"],[]),qh=i(["legend","show"],!0),rh=i(["legend","position"],"bottom"),sh=i(["legend","item","onclick"]),th=i(["legend","item","onmouseover"]),uh=i(["legend","item","onmouseout"]),vh=i(["legend","equally"],!1),wh=i(["axis","rotated"],!1),xh=i(["axis","x","show"],!0),yh=i(["axis","x","type"],"indexed"),zh=i(["axis","x","localtime"],!0),Ah=i(["axis","x","categories"],[]),Bh=i(["axis","x","tick","centered"],!1),Ch=i(["axis","x","tick","format"]),Dh=i(["axis","x","tick","culling"],{}),Eh=i(["axis","x","tick","culling","max"],10),Fh=i(["axis","x","tick","count"]),Gh=i(["axis","x","tick","fit"],!0),Hh=i(["axis","x","tick","values"],null),Ih=i(["axis","x","tick","rotate"]),Jh=i(["axis","x","max"],null),Kh=i(["axis","x","min"],null),Lh=i(["axis","x","padding"],{}),Mh=i(["axis","x","height"]),Nh=i(["axis","x","default"]),Oh=i(["axis","x","label"],{}),Ph=i(["axis","y","show"],!0),Qh=i(["axis","y","max"]),Rh=i(["axis","y","min"]),Sh=i(["axis","y","center"]),Th=i(["axis","y","label"],{}),Uh=i(["axis","y","inner"],!1),Vh=i(["axis","y","tick","format"]),Wh=i(["axis","y","padding"]),Xh=i(["axis","y","ticks"],10),Yh=i(["axis","y2","show"],!1),Zh=i(["axis","y2","max"]),$h=i(["axis","y2","min"]),_h=i(["axis","y2","center"]),ai=i(["axis","y2","label"],{}),bi=i(["axis","y2","inner"],!1),ci=i(["axis","y2","tick","format"]),di=i(["axis","y2","padding"]),ei=i(["axis","y2","ticks"],10),fi=i(["grid","x","show"],!1),gi=i(["grid","x","type"],"tick"),hi=i(["grid","x","lines"],[]),ii=i(["grid","y","show"],!1),ji=i(["grid","y","lines"],[]),ki=i(["grid","y","ticks"],10),li=i(["point","show"],!0),mi=i(["point","r"],2.5),ni=i(["point","focus","line","enabled"],!0),oi=i(["point","focus","expand","enabled"],!0),pi=i(["point","focus","expand","r"]),qi=i(["point","focus","select","r"]),ri=i(["line","connect_null"],!1),si=i(["bar","width"]),ti=i(["bar","width","ratio"],.6),ui=i(["pie","label","show"],!0),vi=i(["pie","label","format"]),wi=i(["pie","expand"],!0),xi=i(["pie","onclick"],function(){}),yi=i(["pie","onmouseover"],function(){}),zi=i(["pie","onmouseout"],function(){}),Ai=i(["donut","label","show"],!0),Bi=i(["donut","label","format"]),Ci=i(["donut","expand"],!0),Di=i(["donut","title"],""),Ei=i(["donut","onclick"],function(){}),Fi=i(["donut","onmouseover"],function(){}),Gi=i(["donut","onmouseout"],function(){}),Hi=i(["regions"],[]),Ii=i(["tooltip","show"],!0),Ji=i(["tooltip","format","title"]),Ki=i(["tooltip","format","value"]),Li=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Ji?Ji:b,l=Ki?Ki:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Mi=i(["tooltip","init","show"],!1),Ni=i(["tooltip","init","x"],0),Oi=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Pi=("string"==typeof Pf?Pf.replace(/[# .>~+]/g,""):g.chart+ +new Date)+"-clip",Qi=Pi+"-xaxis",Ri=Pi+"-yaxis",Si=j(Pi),Ti=j(Qi),Ui=j(Ri),Vi="timeseries"===yh,Wi="categorized"===yh,Xi=!Vi&&(Ng||Fe(Og)),Yi=null,Zi=!1,$i=!1,_i=!1,aj=!1,bj=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],cj=ze(_g,Fe(ph)?ph:bj,$g),dj=zh?Mf.time.format:Mf.time.format.utc,ej=dj.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),fj=[],gj=[],hj={},ij=wh?"left":"bottom",jj=wh?Uh?"top":"bottom":Uh?"right":"left",kj=wh?bi?"bottom":"top":bi?"left":"right",lj=wh?"left":"bottom",mj={main:function(){return"translate("+k(dg.left)+","+k(dg.top)+")"},context:function(){return"translate("+k(eg.left)+","+k(eg.top)+")"},legend:function(){return"translate("+fg.left+","+fg.top+")"},x:function(){return"translate(0,"+(wh?0:ig)+")" +!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}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.round(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.round(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&a=0;return"url("+(c?"":document.URL.split("#")[0])+"#"+b+")"}function k(a){return Math.ceil(a)+.5}function l(a,b){var c,d,e;b&&b.axisX?c=b.axisX:(c=Cj.select("."+g.axisX),a&&(c=c.transition())),b&&b.axisY?d=b.axisY:(d=Cj.select("."+g.axisY),a&&(d=d.transition())),b&&b.axisY2?e=b.axisY2:(e=Cj.select("."+g.axisY2),a&&(e=e.transition())),Cj.attr("transform",mj.main),c.attr("transform",mj.x),d.attr("transform",mj.y),e.attr("transform",mj.y2),Cj.select("."+g.chartArcs).attr("transform",mj.arc)}function m(a,b){var c;b&&b.axisSubX?c=b.axisSubX:(c=Dj.select("."+g.axisX),a&&(c=c.transition())),Dj.attr("transform",mj.context),c.attr("transform",mj.subx)}function n(a){(a?Ej.transition():Ej).attr("transform",mj.legend)}function o(a,b){l(a,b),nh&&m(a,b),n(a)}function p(){var a=U(),b=T(),c=nj?0:a,d=le(Nf.data.targets),e=wh||d?0:A("x"),f=nh&&!d?oh+e:0;kg=t(),lg=u(),wh?(dg={top:A("y2")+v(),right:d?0:y(),bottom:A("y")+c+w(),left:f+(d?0:x())},eg={top:dg.top,right:0/0,bottom:20+c,left:sj}):(dg={top:4+v(),right:d?0:y(),bottom:e+f+c+w(),left:d?0:x()},eg={top:lg-f-c,right:0/0,bottom:e+c,left:dg.left}),fg={top:nj?0:lg-a,right:0/0,bottom:0,left:nj?kg-b:0},gg=kg-dg.left-dg.right,ig=lg-dg.top-dg.bottom,0>gg&&(gg=0),0>ig&&(ig=0),hg=wh?dg.left-sj-tj:gg,jg=wh?ig:lg-eg.top-eg.bottom,0>hg&&(hg=0),0>jg&&(jg=0),pg=gg-(nj?b+10:0),qg=ig-(nj?0:10),r(),nj&&d&&(fg.left=pg/2+1.1*ng)}function q(){Cj.select("line."+g.xgridFocus).attr("x1",wh?0:-10).attr("x2",wh?gg:-10).attr("y1",wh?-10:dg.top).attr("y2",wh?-10:ig)}function r(){ng=Math.min(pg,qg)/2,mg=.95*ng,og=ke(Nf.data.targets)?.6*mg:0}function s(){var a=wh?g.axisX:g.axisY,b=Cj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Gj.node().getBoundingClientRect(),e=le(Nf.data.targets),f=c.right-d.left-(e?0:x());return f>0?f:0}function t(){return Qf?Qf:B()}function u(){var a=Rf?Rf:C();return a>0?a:320}function v(){return Uf?Uf:0}function w(){return Vf?Vf:0}function x(){return Sf?Sf:wh?xh?Ke(z("x")):1:!Ph||Uh?1:Ke(z("y"))}function y(){var a=10,b=nj?T()+20:0;return Tf?Tf:wh?a+b:(!Yh||bi?a:Ke(z("y2")))+b}function z(a){var b=ob(a);return b.isInner?20+Hb(a):40+Hb(a)}function A(a){return"x"!==a||xh?"x"===a&&Mh?Mh:"y"!==a||Ph?"y2"!==a||Yh?(ob(a).isInner?30:40)+("y2"===a?-10:0):uj:qh&&!nj?10:1:0}function B(){return+Gj.style("width").replace("px","")}function C(){return+Gj.style("height").replace("px","")}function D(a){return a?-31:-(dg.left-1)}function E(a){return a?-20:-4}function F(){return D(!wh)}function G(){return E(!wh)}function H(){return D(wh)}function I(){return E(wh)}function J(a){return a?gg+2+30+30:dg.left+20}function K(a){return a?(Mh?Mh:0)+80:ig+8}function L(){return J(!wh)}function M(){return K(!wh)}function N(){return J(wh)}function O(){return K(wh)}function P(){var a,b,c,d,e,f=Ec(Nf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=Dg(b.x)-Dg(a.x),0===c?wh?ig:gg:(d=Dc(),e=he(Nf.data.targets)?(d-(Wi?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function Q(a){oj=a}function R(a){pj=a}function S(a){qj=a}function T(){return qh?nj?pj*(oj+1):kg:0}function U(){return qh?nj?lg:qj*(oj+1):0}function V(){var a,b,c=!Dg;vg=wh?1:0,wg=wh?ig:gg,xg=wh?0:ig,yg=wh?gg:1,zg=vg,Ag=wg,Bg=wh?0:jg,Cg=wh?hg:1,Dg=Y(vg,wg,c?void 0:Dg.domain(),function(){return Jg.tickOffset()}),Eg=Z(xg,yg,c?void 0:Eg.domain()),Fg=Z(xg,yg,c?void 0:Fg.domain()),Gg=Y(vg,wg,Hj,function(a){return a%1?0:Mg.tickOffset()}),Hg=Z(Bg,Cg,c?void 0:Hg.domain()),Ig=Z(Bg,Cg,c?void 0:Ig.domain()),a=db(),b=Hh?Hh:c?void 0:Jg.tickValues(),Jg=ab(Dg,ij,a,b),Mg=ab(Gg,lj,a,b),Kg=bb(Eg,jj,Vh,Xh),Lg=bb(Fg,kj,ci,ei),c||(vj.scale(Gg),Wf&&zj.scale(Dg)),W()}function W(){rg=Kb(),sg=Lb(),tg=Lb(.98)}function X(a,b,c){return(c?Mf.time.scale():Mf.scale.linear()).range([a,b])}function Y(a,b,c,d){var e,f=X(a,b,Vi),g=c?f.domain(c):f;Wi?(d=d||function(){return 0},f=function(a,b){var c=g(a)+d(a);return b?c:Math.ceil(c)}):f=function(a,b){var c=g(a);return b?c:Math.ceil(c)};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return Hj&&Hj[0]===a[0]&&Hj[1]a?a.toFixed(0):a};return Ch&&("function"==typeof Ch?a=Ch:Vi&&(a=function(a){return a?dj(Ch)(a):""})),a}function eb(a){var b;return"y"===a?b=Th:"y2"===a?b=ai:"x"===a&&(b=Oh),b}function fb(a){var b=eb(a);return"string"==typeof b?b:b?b.text:null}function gb(a,b){var c=eb(a);"string"==typeof c?"y"===a?Th=b:"y2"===a?ai=b:"x"===a&&(Oh=b):c&&(c.text=b)}function hb(a){return 10*Math.sin(Math.PI*(a/180))}function ib(a){return 11.5-2.5*(a/15)}function jb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",ib(c)).attr("x",hb(c)).attr("transform","rotate("+c+")")}function kb(a,b){var c=eb(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 lb(){return kb("x",wh?"inner-top":"inner-right")}function mb(){return kb("y",wh?"inner-right":"inner-top")}function nb(){return kb("y2",wh?"inner-right":"inner-top")}function ob(a){return"y2"===a?nb():"y"===a?mb():lb()}function pb(){return fb("x")}function qb(){return fb("y")}function rb(){return fb("y2")}function sb(a,b){return a?b.isLeft?0:b.isCenter?gg/2:gg:b.isBottom?-ig:b.isMiddle?-ig/2:0}function tb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function ub(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function vb(){return sb(!wh,lb())}function wb(){return sb(wh,mb())}function xb(){return sb(wh,nb())}function yb(){return tb(!wh,lb())}function zb(){return tb(wh,mb())}function Ab(){return tb(wh,nb())}function Bb(){var a=lb();return wh?a.isInner?"1.2em":-25-Hb("x"):a.isInner?"-0.5em":Mh?Mh-10:"3em"}function Cb(){var a=mb();return wh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Hb("y")}function Db(){var a=nb();return wh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Hb("y2")}function Eb(){return ub(!wh,lb())}function Fb(){return ub(wh,mb())}function Gb(){return ub(wh,nb())}function Hb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Ib(a){var b=Cj.select("."+g.axisX+" ."+g.axisXLabel),c=Cj.select("."+g.axisY+" ."+g.axisYLabel),d=Cj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",vb).attr("dx",yb).attr("dy",Bb).text(pb),(a?c.transition():c).attr("x",wb).attr("dx",zb).attr("dy",Cb).attr("dy",Cb).text(qb),(a?d.transition():d).attr("x",xb).attr("dx",Ab).attr("dy",Db).text(rb)}function Jb(a){var b=!1;return ug(Lc(Nf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Kb(){var a=Mf.svg.arc().outerRadius(mg).innerRadius(og),b=function(b,c){var d;return c?a(b):(d=Jb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Lb(a){var b=Mf.svg.arc().outerRadius(ng*(a?a:1)).innerRadius(og);return function(a){var c=Jb(a);return c?b(c):"M 0 0"}}function Mb(a,b){return se(a.data)?rg(a,b):"M 0 0"}function Nb(a){var b,c,d,e,f=Jb(a),g="";return f&&(b=rg.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*mg*.8+","+d/e*mg*.8+")"),g}function Ob(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Pb(a){return tc({id:a.data.id,value:a.value,ratio:Ob(a)})}function Qb(a){var b,c,d,e;return Tb()?(b=Jb(a),c=b?b.value:null,d=Ob(b),e=Ub(),e?e(c,d):Gd(c,d)):""}function Rb(a,b){var c=Aj.selectAll("."+g.chartArc+sd(a)),d=Aj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});ye(a)&&c.selectAll("path").transition().duration(50).attr("d",sg).transition().duration(100).attr("d",tg).each(function(a){re(a.data)}),b||d.style("opacity",.3)}function Sb(a){var b=Aj.selectAll("."+g.chartArc+sd(a));b.selectAll("path").transition().duration(50).attr("d",rg),Aj.selectAll("."+g.arc).style("opacity",1)}function Tb(){return ke(Nf.data.targets)?Ai:ui}function Ub(){return ke(Nf.data.targets)?Bi:vi}function Vb(){return ke(Nf.data.targets)?Di:""}function Wb(){var a=ke(Nf.data.targets)?Ei:xi;return"function"==typeof a?a:function(){}}function Xb(){var a=ke(Nf.data.targets)?Fi:yi;return"function"==typeof a?a:function(){}}function Yb(){var a=ke(Nf.data.targets)?Gi:zi;return"function"==typeof a?a:function(){}}function Zb(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Tg.length>0)for(g=Uc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return Mf.min(Object.keys(i).map(function(a){return Mf.min(i[a])}))}function $b(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Tg.length>0)for(g=Vc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return Mf.max(Object.keys(i).map(function(a){return Mf.max(i[a])}))}function _b(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return cb(a.id)===c}),m="y2"===c?$h:Rh,n="y2"===c?Zh:Qh,o=b(m)?m:Zb(l),p=b(n)?n:$b(l),q="y2"===c?_h:Sh,r=Ad()&&wh;return 0===l.length?"y2"===c?Fg.domain():Eg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=Bd(o,p),j=ec(Eg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Wh&&(f=b(Wh.top)?Wh.top:e,g=b(Wh.bottom)?Wh.bottom:e),"y2"===c&&di&&(f=b(di.top)?di.top:e,g=b(di.bottom)?di.bottom:e),he(l)&&!Uc(l)&&(g=o),[o-g,p+f])}function ac(a){return Kh?Vi?Ae(Kh):Kh:Mf.min(a,function(a){return Mf.min(a.values,function(a){return a.x})})}function bc(a){return Jh?Vi?Ae(Jh):Jh:Mf.max(a,function(a){return Mf.max(a.values,function(a){return a.x})})}function cc(a){var c,d,e,f,g=Fc(a),h=g[1]-g[0];return Wi?d=0:he(a)?(c=Dc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Lh&&Fe(Lh)?(e=b(Lh.left)?Lh.left:d,f=b(Lh.right)?Lh.right:d):e=f="number"==typeof Lh?Lh:d,{left:e,right:f}}function dc(a){var b=[ac(a),bc(a)],c=b[0],d=b[1],e=cc(a),f=0,g=0;return c-d!==0||Wi||(c=Vi?new Date(.5*c.getTime()):-.5,d=Vi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ec(a){return a[1]-a[0]}function fc(a){for(var b=0;bb?0:b-c}function lc(a){var b,c=jc(a),d="y"===a.axis?Eg:Fg;return b="y"===a.axis||"y2"===a.axis?wh?ig:"start"in a?d(a.start):ig:wh?"end"in a?Dg(Vi?Ae(a.end):a.end):ig:ig,c>b?0:b-c}function mc(a){return Ng&&a===Ng||Fe(Og)&&Ge(Og,a)}function nc(a){return!mc(a)}function oc(a){return Ng?Ng:Fe(Og)?Og[a]:null}function pc(a,b){var c,d=b&&Fe(b)?Gc(b):[];return d.forEach(function(b){oc(b)===a&&(c=Nf.data.xs[b])}),c}function qc(a,b){return a in Nf.data.xs&&Nf.data.xs[a]&&Nf.data.xs[a][b]?Nf.data.xs[a][b]:b}function rc(a){Object.keys(a).forEach(function(b){Og[b]=a[b]})}function sc(a){return 1===Mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function tc(a){var b;return a&&(b=Rg[a.id],a.name=b?b:a.id),a}function uc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=wc(b[d],a.id,d)}),Nf.data.xs[a.id]=b})}function vc(a,b){a.forEach(function(a){b[a.id]&&uc([a],b[a.id])})}function wc(a,c,d){var e;return e=Vi?a?a instanceof Date?a:Ae(a):Ae(qc(c,d)):Xi&&!Wi?b(a)?+a:qc(c,d):d}function xc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Ng?(d=Object.keys(Nf.data.xs),Nf.data.xs[c]=d.length>0?Nf.data.xs[d[0]]:void 0):Fe(Og)&&(Nf.data.xs[c]=pc(f,Nf.data.targets)):Nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Qg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=oc(b),g=a[f],h=wc(g,b,e);return Xi&&Wi&&0===c&&g&&(0===e&&(Ah=[]),Ah.push(g)),("undefined"==typeof a[b]||Nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Vg&&fe(Gc(c).filter(function(a){return!(a in Wg)}),Vg),c.forEach(function(a){gc(a.id_org,a)}),c}function Ac(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 Bc(a){return a>0&&Nf.data.targets[0].values[a-1]?Nf.data.targets[0].values[a-1].x:void 0}function Cc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Fc(a){var b,c,d=Ec(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Gc(a){return a.map(function(a){return a.id})}function Hc(a){return a?"string"==typeof a?[a]:a:Gc(Nf.data.targets)}function Ic(a,b){var c,d=Gc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Vi?new Date(i):i);j.push(e)}return Vi||(j=j.sort(function(a,b){return a-b})),j}function Oc(a){fj=fj.concat(a)}function Pc(a){fj=fj.filter(function(b){return a.indexOf(b)<0})}function Qc(a){gj=gj.concat(a)}function Rc(a){gj=gj.filter(function(b){return a.indexOf(b)<0})}function Sc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Tc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Vc(a){return Tc(a,function(a){return a>0})}function Wc(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||0===a[f].x)&&(e=e.concat(Md(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Md(a,g))),Pd(e,b)):Nd(a,b,f,g)}function Od(a,b){var c;return c=a.map(function(a){return Nd(a.values,b)}),Pd(c,b)}function Pd(a,b){var c,d;return a.forEach(function(a){var e=He(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Qd(a,b){return Mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Rd(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 Sd(){return Yg&&"desc"===Yg.toLowerCase()}function Td(){return Yg&&"asc"===Yg.toLowerCase()}function Ud(a){var b=Td(),c=Sd();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 Yg&&a.sort(Yg),a}function Vd(a,c){var d,e,f,g,h,i,j,k=le(Nf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&Ii&&(Fj.html(Li(a,db(),Cd(k),cj)).style("display","block"),d=Fj.property("offsetWidth"),e=Fj.property("offsetHeight"),k?(g=gg/2+c[0],i=ig/2+c[1]+20):(wh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-y(),i=Dg(l[0].x)+20):(f=s(),g=f+x()+Dg(l[0].x)+20,h=g+d,j=f+t()-y(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),Fj.style("top",i+"px").style("left",g+"px"))}function Wd(){Fj.style("display","none")}function Xd(a){var c=a.filter(function(a){return a&&b(a.value)});if(Ii&&!ie(Nf.data.targets)&&!le(Nf.data.targets)){var d=Cj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(wh?"y1":"x1",Id).attr(wh?"y2":"x2",Id),pf(d,"grid")}}function Yd(){Cj.select("line."+g.xgridFocus).style("visibility","hidden")}function Zd(a,b){var c,d,e,f,h=[],i=Cj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=dc(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function $d(a){return a.x||0===a.x?Dg(a.x):null}function _d(a){return $(a.id)(a.value)}function ae(){var a,b,d={},e=0;return Lc(Nf.data.targets.filter(oe)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ee(a,b){return"number"==typeof si?si:b?2*a.tickOffset()*ti/b:0}function fe(a,b){Hc(a).forEach(function(a){Jj[a]=b===Wg[a],Wg[a]=b})}function ge(a,b){var c=!1;return a.forEach(function(a){Wg[a.id]===b&&(c=!0),a.id in Wg||"line"!==b||(c=!0)}),c}function he(a){return ge(a,"bar")}function ie(a){return ge(a,"scatter")}function je(a){return ge(a,"pie")}function ke(a){return ge(a,"donut")}function le(a){return je(a)||ke(a)}function me(a){var b="string"==typeof a?a:a.id;return!(b in Wg)||"line"===Wg[b]||"spline"===Wg[b]||"area"===Wg[b]||"area-spline"===Wg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"spline"===Wg[b]||"area-spline"===Wg[b]}function oe(a){var b="string"==typeof a?a:a.id;return"bar"===Wg[b]}function pe(a){var b="string"==typeof a?a:a.id;return"scatter"===Wg[b]}function qe(a){var b="string"==typeof a?a:a.id;return"pie"===Wg[b]}function re(a){var b="string"==typeof a?a:a.id;return"donut"===Wg[b]}function se(a){return qe(a)||re(a)}function te(a){return me(a)?[a]:[]}function ue(a){return se(a.data)?[a]:[]}function ve(a){return oe(a)?a.values:[]}function we(a){return me(a)||pe(a)?a.values:[]}function xe(a){return oe(a)||me(a)?a.values:[]}function ye(a){return re(a)&&Ci||qe(a)&&wi}function ze(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function Ae(b){var c;try{c=Pg?Mf.time.format(Pg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Pg)}return c}function Be(a,b){var c=Mf.mouse(a),d=Mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ge(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function He(a,b){var c="y"===cb(a.id)?Eg:Fg,d=wh?1:0,e=wh?0:1;return Math.pow(Dg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ie(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Je(a,b,c){return d(a[b])?a[b]:c}function Ke(a){return 10*Math.ceil(a/10)}function Le(a,b,c){jh(b,a.node()),Cj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Xc(g.selectedCircle,c)}).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d).attr("stroke",function(){return cj(b)}).attr("r",1.4*We(b)).transition().duration(100).attr("r",We)}function Me(a,b,c){kh(b,a.node()),Cj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ne(a,b,c,d){a?Le(b,c,d):Me(b,c,d)}function Oe(a,b){jh(b,a.node()),a.transition().duration(100).style("fill",function(){return Mf.rgb(cj(b)).brighter(.75)})}function Pe(a,b){kh(b,a.node()),a.transition().duration(100).style("fill",function(){return cj(b)})}function Qe(a,b,c,d){a?Oe(b,c,d):Pe(b,c,d)}function Re(a,b,c,d){Qe(a,b,c.data,d)}function Se(a){return"circle"===a.nodeName?Ne:Mf.select(a).classed(g.bar)?Qe:Re}function Te(a){return a.filter(function(a){return b(a.value)})}function Ue(a){return li?"function"==typeof mi?mi(a):mi:0}function Ve(a){return oi?pi?pi:1.75*Ue(a):Ue(a)}function We(a){return qi?qi:4*Ue(a)}function Xe(a,c){return(c?Cj.selectAll("."+g.circles+rd(c)):Cj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ye(a,b){Xe(a,b).classed(g.EXPANDED,!0).attr("r",Ve)}function Ze(a){Xe(a).filter(function(){return Mf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Ue)}function $e(a){return Cj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function _e(a){$e(a).classed(g.EXPANDED,!0)}function af(a){$e(a).classed(g.EXPANDED,!1)}function bf(a,b){var c=ff(a,b);return function(a,b){var d=c(a,b),e=wh?1:0,f=wh?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 cf(a,b){var c=ff(a,!1),d=b?df:ef;return function(a,b){return d(c(a,b),a,this)}}function df(a,b){var c;return wh?(c=oe(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function ef(a,b,c){var d=c.getBoundingClientRect();return wh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:oe(b)?-3:-6)}function ff(a,b){var c=a.__max__+1,d=ee(Jg,c),e=be(d,c,a,!!b),f=ce(!!b),g=de(a,!!b),h=b?_:$;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return wh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function gf(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function hf(b){var c,d,e;if(Gj=Mf.select(Pf),Gj.empty())throw new Error("Element to bind not found");if(Gj.html("").classed("c3",!0),Nf.data.xs={},Nf.data.targets=zc(b),bh&&(Nf.data.targets=Nf.data.targets.filter(bh)),ah&&Oc(ah===!0?Gc(Nf.data.targets):ah),p(),V(),Dg.domain(Mf.extent(dc(Nf.data.targets))),Eg.domain(_b(Nf.data.targets,"y")),Fg.domain(_b(Nf.data.targets,"y2")),Gg.domain(Dg.domain()),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Hj=Dg.domain(),vj.scale(Gg),Wf&&zj.scale(Dg),Aj=Gj.append("svg").style("overflow","hidden").on("mouseenter",$f).on("mouseleave",_f),Bj=Aj.append("defs"),Bj.append("clipPath").attr("id",Pi).append("rect"),Bj.append("clipPath").attr("id",Qi).append("rect"),Bj.append("clipPath").attr("id",Ri).append("rect"),uf(),Cj=Aj.append("g").attr("transform",mj.main),Dj=Aj.append("g").attr("transform",mj.context),Ej=Aj.append("g").attr("transform",mj.legend),nh||Dj.style("visibility","hidden"),qh||(Ej.style("visibility","hidden"),gj=Gc(Nf.data.targets)),Fj=Gj.style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Hf(Gc(Nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=Cj.append("g").attr("clip-path",Si).attr("class",g.grid),fi&&d.append("g").attr("class",g.xgrids),Fe(hi)&&d.append("g").attr("class",g.xgridLines),ni&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),ii&&d.append("g").attr("class",g.ygrids),Fe(ji)&&d.append("g").attr("class",g.ygridLines),Cj.append("g").attr("clip-path",Si).attr("class",g.regions),Cj.append("g").attr("clip-path",Si).attr("class",g.chart),c=Cj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Wf?wh?"ns-resize":"ew-resize":null),Cj.select("."+g.chart).append("g").attr("class",g.chartBars),Cj.select("."+g.chart).append("g").attr("class",g.chartLines),Cj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",mj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Vb()),Cj.select("."+g.chart).append("g").attr("class",g.chartTexts),Wf&&Cj.insert("rect",Yf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",gg).attr("height",ig).style("opacity",0).style("cursor",wh?"ns-resize":"ew-resize").call(zj).on("dblclick.zoom",null),Nh&&vj.extent("function"!=typeof Nh?Nh:Nh(dc())),hj.x=Cj.append("g").attr("class",g.axisX).attr("clip-path",Ti).attr("transform",mj.x).style("visibility",xh?"visible":"hidden"),hj.x.append("text").attr("class",g.axisXLabel).attr("transform",wh?"rotate(-90)":"").style("text-anchor",Eb),hj.y=Cj.append("g").attr("class",g.axisY).attr("clip-path",Ui).attr("transform",mj.y).style("visibility",Ph?"visible":"hidden"),hj.y.append("text").attr("class",g.axisYLabel).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Fb),hj.y2=Cj.append("g").attr("class",g.axisY2).attr("transform",mj.y2).style("visibility",Yh?"visible":"hidden"),hj.y2.append("text").attr("class",g.axisY2Label).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Gb),Dj.append("g").attr("clip-path",Si).attr("class",g.chart),Dj.select("."+g.chart).append("g").attr("class",g.chartBars),Dj.select("."+g.chart).append("g").attr("class",g.chartLines),Dj.append("g").attr("clip-path",Si).attr("class",g.brush).call(vj).selectAll("rect").attr(wh?"width":"height",wh?hg:jg),hj.subx=Dj.append("g").attr("class",g.axisX).attr("transform",mj.subx).attr("clip-path",wh?"":Ti),xf(Nf.data.targets),qf({withUpdateTranslate:!0,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Mi){if(Vi&&"string"==typeof Ni){for(Ni=Ae(Ni),e=0;e0){d=[];for(var f in Rg)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Rd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Qe,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function nf(a){le(Nf.data.targets)||ch&&(Yi=a,Cj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Zi=!0,lh())}function of(){le(Nf.data.targets)||ch&&(Cj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),Cj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Zi=!1,mh())}function pf(a,b){"grid"===b&&a.each(function(){var a=Mf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function qf(a,c){var d,e,f,h,i,j,k,l,m,n,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,Q,R,S,T,U,W,X,Y,Z,$=ae(),_=le(Nf.data.targets),ab=Lc(Nf.data.targets);if(a=a||{},E=Je(a,"withY",!0),F=Je(a,"withSubchart",!0),G=Je(a,"withTransition",!0),J=Je(a,"withTransform",!1),K=Je(a,"withUpdateXDomain",!1),L=Je(a,"withUpdateOrgXDomain",!1),N=Je(a,"withUpdateTranslate",!1),M=Je(a,"withLegend",!1),H=Je(a,"withTransitionForExit",G),I=Je(a,"withTransitionForAxis",G),T=G?cg:0,U=H?T:0,W=I?T:0,c=c||vf(W),N&&(wh?(hj.x.call(Jg),hj.subx.call(Mg)):(hj.y.call(Kg),hj.y2.call(Lg)),p(),V(),uf(),o(!1)),M&&qh&&Hf(Gc(Nf.data.targets),a,c),Wi&&0===ab.length&&Dg.domain([0,hj.x.selectAll(".tick").size()]),ab.length&&(L&&(Dg.domain(Mf.extent(dc(ab))),Hj=Dg.domain(),Wf&&zj.scale(Dg).updateScaleExtent(),Gg.domain(Dg.domain()),vj.scale(Gg)),K&&(Dg.domain(vj.empty()?Hj:vj.extent()),Wf&&zj.scale(Dg).updateScaleExtent()),Hh||!Gh&&!Fh||(X=Nc(Mc(ab),Fh),Jg.tickValues(X),Mg.tickValues(X))),Eg.domain(_b(ab,"y")),Fg.domain(_b(ab,"y2")),hj.x.style("opacity",_?0:1),hj.y.style("opacity",_?0:1),hj.y2.style("opacity",_?0:1),hj.subx.style("opacity",_?0:1),c.axisX.call(Jg),c.axisY.call(Kg),c.axisY2.call(Lg),c.axisSubX.call(Mg),Ib(G),K&&ab.length)if(Dh&&X){for(Y=1;Y=0&&Mf.select(this).style("display",b%Z?"none":"block")})}else Aj.selectAll("."+g.axisX+" .tick text").style("display","block");!wh&&Ih&&jb(hj.x,c.axisX,Ih),O=bf($),R=cf($,!0),S=cf($,!1),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Fj.style("display","none"),q(),Cj.select("line."+g.xgridFocus).style("visibility","hidden"),fi&&(f=Zd(gi,Dg),B=Wi?Jg.tickOffset():0,e=wh?{x1:0,x2:gg,y1:function(a){return Dg(a)-B},y2:function(a){return Dg(a)-B}}:{x1:function(a){return Dg(a)+B},x2:function(a){return Dg(a)+B},y1:dg.top,y2:ig},d=Cj.select("."+g.xgrids).selectAll("."+g.xgrid).data(f),d.enter().append("line").attr("class",g.xgrid),d.attr(e).style("opacity",function(){return+Mf.select(this).attr(wh?"y1":"x1")===(wh?ig:0)?0:1}),d.exit().remove()),Fe(hi)&&(h=Cj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(hi),i=h.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),i.append("line").style("opacity",0),i.append("text").attr("text-anchor","end").attr("transform",wh?"":"rotate(-90)").attr("dx",wh?0:-dg.top).attr("dy",-5).style("opacity",0),h.select("line").transition().duration(T).attr("x1",wh?0:Jd).attr("x2",wh?gg:Jd).attr("y1",wh?Jd:dg.top).attr("y2",wh?Jd:ig).style("opacity",1),h.select("text").transition().duration(T).attr("x",wh?gg:0).attr("y",Jd).text(function(a){return a.text}).style("opacity",1),h.exit().transition().duration(T).style("opacity",0).remove()),E&&ii&&(j=Cj.select("."+g.ygrids).selectAll("."+g.ygrid).data(Eg.ticks(ki)),j.enter().append("line").attr("class",g.ygrid),j.attr("x1",wh?Eg:0).attr("x2",wh?Eg:gg).attr("y1",wh?0:Eg).attr("y2",wh?ig:Eg),j.exit().remove(),pf(j,"grid")),E&&Fe(ji)&&(k=Cj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(ji),l=k.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",wh?"rotate(-90)":"").attr("dx",wh?0:-dg.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",wh?Kd:0).attr("x2",wh?Kd:gg).attr("y1",wh?0:Kd).attr("y2",wh?ig:Kd).style("opacity",1),k.select("text").transition().duration(T).attr("x",wh?0:gg).attr("y",Kd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),u=Cj.select("."+g.regions).selectAll("."+g.region).data(Hi),u.enter().append("g").attr("class",kd).append("rect").style("fill-opacity",0),u.selectAll("rect").transition().duration(T).attr("x",ic).attr("y",jc).attr("width",kc).attr("height",lc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),u.exit().transition().duration(T).style("opacity",0).remove(),s=Cj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),s.enter().append("path").attr("class",ed).style("stroke","none").style("fill",cj),s.style("opacity",wd).transition().duration(T).attr("d",O).style("fill",cj).style("opacity",1),s.exit().transition().duration(U).style("opacity",0).remove(),m=Cj.selectAll("."+g.lines).selectAll("."+g.line).data(te),m.enter().append("path").attr("class",ad).style("stroke",cj),m.style("opacity",wd).transition().duration(T).attr("d",wj).style("stroke",cj).style("opacity",1),m.exit().transition().duration(U).style("opacity",0).remove(),n=Cj.selectAll("."+g.areas).selectAll("."+g.area).data(te),n.enter().append("path").attr("class",id).style("fill",cj).style("opacity",function(){return Ij=+Mf.select(this).style("opacity"),0}),n.style("opacity",0).transition().duration(T).attr("d",xj).style("fill",cj).style("opacity",Ij),n.exit().transition().duration(U).style("opacity",0).remove(),r=Cj.selectAll("."+g.circles).selectAll("."+g.circle).data(we),r.enter().append("circle").attr("class",cd).attr("r",Ue).style("fill",cj),r.style("opacity",wd).transition().duration(T).style("opacity",yd).style("fill",cj).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d),r.exit().remove(),v=Cj.selectAll("."+g.texts).selectAll("."+g.text).data(xe),v.enter().append("text").attr("class",Yc).attr("text-anchor",function(a){return wh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",cj).style("fill-opacity",0),v.text(function(a){return Hd(a.id)(a.value,a.id)}).style("fill-opacity",xd).transition().duration(T).attr("x",R).attr("y",S).style("fill",cj).style("fill-opacity",zd),v.exit().transition().duration(U).style("fill-opacity",0).remove(),t=Cj.selectAll("."+g.arcs).selectAll("."+g.arc).data(ue),t.enter().append("path").attr("class",gd).style("fill",function(a){return cj(a.data)}).style("cursor",function(a){return eh(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;aj||(c=Jb(a),d=Pb(c),e=Xb(),Rb(c.data.id),Df(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Jb(a),c=Pb(b),d=[c];Vd(d,Mf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;aj||(c=Jb(a),d=Pb(c),e=Yb(),Sb(c.data.id),Ef(),Wd(),e(d,b))}).on("click",function(a,b){var c=Jb(a),d=Pb(c),e=Wb();lf(this,a,b),e(d,b)}),t.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){aj=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Jb(a);return c?(b=Mf.interpolate(this._current,c),this._current=b(0),function(a){return Mb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("fill",function(a){return cj(a.data)}).style("opacity",1).call(Ie,function(){aj=!1}),t.exit().transition().duration(U).style("opacity",0).remove(),Cj.selectAll("."+g.chartArc).select("text").attr("transform",Nb).style("opacity",0).transition().duration(T).text(Qb).style("opacity",function(a){return Jc(a.data.id)&&se(a.data)?1:0}),Cj.select("."+g.chartArcsTitle).style("opacity",ke(Nf.data.targets)?1:0),nh&&(Mf.event&&"zoom"===Mf.event.type&&vj.extent(Dg.orgDomain()).update(),F&&(!wh&&Ih&&jb(hj.subx,c.axisSubX,Ih),vj.empty()||vj.extent(Dg.orgDomain()).update(),Q=bf($,!0),x=Dj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),x.enter().append("path").attr("class",ed).style("stroke","none").style("fill",cj),x.style("opacity",wd).transition().duration(T).attr("d",Q).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove(),w=Dj.selectAll("."+g.lines).selectAll("."+g.line).data(te),w.enter().append("path").attr("class",ad).style("stroke",cj),w.style("opacity",wd).transition().duration(T).attr("d",yj).style("opacity",1),w.exit().transition().duration(T).style("opacity",0).remove())),Cj.selectAll("."+g.selectedCircles).filter(function(a){return oe(a)}).selectAll("circle").remove(),Cj.selectAll("."+g.selectedCircle).transition().duration(T).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d),Zf&&(y=Cj.select("."+g.eventRects),Fe(Og)&&!sc(Og)?(y.classed(g.eventRectsMultiple)||y.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),z=Cj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),kf(z.enter()),z.attr("x",0).attr("y",0).attr("width",gg).attr("height",ig)):(y.classed(g.eventRectsSingle)||y.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Xi&&!Wi?(D=function(a,b){var c=Bc(b),d=Cc(b),e=Nf.data.xs[a.id][b];return(Dg(d?d:e+50)-Dg(c?c:e-50))/2},C=function(a,b){var c=Bc(b),d=Nf.data.xs[a.id][b];return(Dg(d)+Dg(c?c:d-50))/2}):(D=P(),C=function(a){return Dg(a.x)-D/2}),A=Ec(Nf.data.targets),Cj.select("."+g.eventRects).datum(A?A.values:[]),z=Cj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),jf(z.enter()),z.attr("class",ld).attr("x",wh?0:C).attr("y",wh?C:0).attr("width",wh?gg:D).attr("height",wh?D:ig),z.exit().remove())),Gc(Nf.data.targets).forEach(function(a){Jj[a]=!0})}function rf(){qf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function sf(){if(0!==Lc(Nf.data.targets).length){if("mousemove"===Mf.event.sourceEvent.type&&zj.altDomain)return Dg.domain(zj.altDomain),void zj.scale(Dg).updateScaleExtent();Wi&&Dg.orgDomain()[0]===Hj[0]&&Dg.domain([Hj[0]-1e-10,Dg.orgDomain()[1]]),qf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Mf.event.sourceEvent.type&&($i=!0)}}function tf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function uf(){Aj.attr("width",kg).attr("height",lg),Aj.select("#"+Pi).select("rect").attr("width",gg).attr("height",ig),Aj.select("#"+Qi).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),Aj.select("#"+Ri).select("rect").attr("x",H).attr("y",I).attr("width",N).attr("height",O),Aj.select("."+g.zoomRect).attr("width",gg).attr("height",ig),Gj.style("max-height",lg+"px")}function vf(a){return{axisX:a?hj.x.transition().duration(a):hj.x,axisY:a?hj.y.transition().duration(a):hj.y,axisY2:a?hj.y2.transition().duration(a):hj.y2,axisSubX:a?hj.subx.transition().duration(a):hj.subx}}function wf(a){var b;a=a||{},a.withTransition=Je(a,"withTransition",!0),a.withTransform=Je(a,"withTransform",!1),a.withLegend=Je(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withLegend&&qh||(b=vf(a.withTransitionForAxis?cg:0),p(),V(),uf(),o(a.withTransition,b)),qf(a,b)}function xf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=Cj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",nd),j=i.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Zc),e=Cj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),d=e.enter().append("g").attr("class",pd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",fd).style("cursor",function(a){return eh(a)?"pointer":null}),c=Cj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),b=c.enter().append("g").attr("class",od).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",bd),b.append("g").attr("class",jd),b.append("g").attr("class",function(a){return Xc(g.selectedCircles,a.id)}),b.append("g").attr("class",dd).style("cursor",function(a){return eh(a)?"pointer":null}),a.forEach(function(a){Cj.selectAll("."+g.selectedCircles+rd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Cj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(ug(a)).attr("class",qd),f=h.enter().append("g").attr("class",qd),f.append("g").attr("class",hd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),nh&&(n=Dj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),m=n.enter().append("g").style("opacity",0).attr("class",pd),m.append("g").attr("class",fd),l=Dj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),k=l.enter().append("g").style("opacity",0).attr("class",od),k.append("g").attr("class",bd)),Aj.selectAll("."+g.target).filter(function(a){return Jc(a.id)}).transition().duration(cg).style("opacity",1)}function yf(a,b){b.filter&&(a=a.filter(b.filter)),(b.type||b.types)&&a.forEach(function(a){b.types?fe(a.id,b.types[a.id]):fe(a.id,b.type)}),Nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,z=0,F++)),E[a]=F,D[F]=f,A[a]=z,z+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+v)/10),j=10*Math.ceil((h.height+u)/10),k=nj?j:i,l=nj?U():T();return d&&(z=0,F=0,w=0,x=0),qh&&!Kc(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=i,C[c]=j,(!w||i>=w)&&(w=i),(!x||j>=x)&&(x=j),g=nj?x:w,void(vh?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(l-g*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=26,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=Ej.selectAll("."+g.legendItemFocused).size();b=b||{},n=Je(b,"withTransition",!0),q=Je(b,"withTransitionForTransform",!0),nj?(f=function(a){return w*E[a]},j=function(a){return D[E[a]]+A[a]}):(f=function(a){return D[E[a]]+A[a]},j=function(a){return x*E[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=Ej.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Xc(g.legendItem,a)}).style("visibility",function(a){return Kc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof sh?sh(a):Nf.toggle(a)}).on("mouseover",function(a){Mf.select(this).classed(g.legendItemFocused,!0),aj||Nf.focus(a),"function"==typeof th&&th(a)}).on("mouseout",function(a){Mf.select(this).classed(g.legendItemFocused,!1),aj||Nf.revert(),"function"==typeof uh&&uh(a)}),m.append("text").text(function(a){return d(Rg[a])?Rg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",nj?h:-200).attr("y",nj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",nj?i:-200).attr("y",nj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",cj).attr("x",nj?h:-200).attr("y",nj?-200:j).attr("width",10).attr("height",10),r=Ej.selectAll("text").data(a).text(function(a){return d(Rg[a])?Rg[a]:a}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=Ej.selectAll("rect."+g.legendItemEvent).data(a),(n?s.transition():s).attr("width",function(a){return B[a]}).attr("height",function(a){return C[a]}).attr("x",i).attr("y",l),t=Ej.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",cj).attr("x",f).attr("y",j),Ej.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Jc(a)}).transition().style("opacity",function(a){var b=Mf.select(this);return Jc(a)?!G||b.classed(g.legendItemFocused)?Bf(b):Cf(b):rj}),R(w),S(x),Q(F),p(),V(),uf(),o(q,c)}function If(a){return Ic(Nf.data.targets,a.id)}function Jf(a){return"data"in a&&Ic(Nf.data.targets,a.data.id)}function Kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function Lf(a,b,c){var d=!le(Nf.data.targets);aj=!1,fe(a,b),wf(c||{withTransitionForAxis:d})}var Mf=a.d3?a.d3:a.require?a.require("d3"):void 0,Nf={data:{},axis:{},legend:{}},Of={},Pf=i(["bindto"],"#chart"),Qf=i(["size","width"]),Rf=i(["size","height"]),Sf=i(["padding","left"]),Tf=i(["padding","right"]),Uf=i(["padding","top"]),Vf=i(["padding","bottom"]),Wf=i(["zoom","enabled"],!1),Xf=i(["zoom","extent"]),Yf=i(["zoom","privileged"],!1),Zf=i(["interaction","enabled"],!0),$f=i(["onenter"],function(){}),_f=i(["onleave"],function(){}),ag=i(["onresize"],function(){}),bg=i(["onresized"],function(){}),cg=i(["transition","duration"],350);h("data","data is required in config");var dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg,Kg,Lg,Mg,Ng=i(["data","x"]),Og=i(["data","xs"],{}),Pg=i(["data","x_format"]),Qg=i(["data","id_converter"],function(a){return a}),Rg=i(["data","names"],{}),Sg=i(["data","classes"],{}),Tg=i(["data","groups"],[]),Ug=i(["data","axes"],{}),Vg=i(["data","type"]),Wg=i(["data","types"],{}),Xg=i(["data","labels"],{}),Yg=i(["data","order"]),Zg=i(["data","regions"],{}),$g=i(["data","color"]),_g=i(["data","colors"],{}),ah=i(["data","hide"],!1),bh=i(["data","filter"]),ch=i(["data","selection","enabled"],!1),dh=i(["data","selection","grouped"],!1),eh=i(["data","selection","isselectable"],function(){return!0}),fh=i(["data","selection","multiple"],!0),gh=i(["data","onclick"],function(){}),hh=i(["data","onenter"],function(){}),ih=i(["data","onleave"],function(){}),jh=i(["data","onselected"],function(){}),kh=i(["data","onunselected"],function(){}),lh=i(["data","ondragstart"],function(){}),mh=i(["data","ondragend"],function(){}),nh=i(["subchart","show"],!1),oh=i(["subchart","size","height"],60),ph=i(["color","pattern"],[]),qh=i(["legend","show"],!0),rh=i(["legend","position"],"bottom"),sh=i(["legend","item","onclick"]),th=i(["legend","item","onmouseover"]),uh=i(["legend","item","onmouseout"]),vh=i(["legend","equally"],!1),wh=i(["axis","rotated"],!1),xh=i(["axis","x","show"],!0),yh=i(["axis","x","type"],"indexed"),zh=i(["axis","x","localtime"],!0),Ah=i(["axis","x","categories"],[]),Bh=i(["axis","x","tick","centered"],!1),Ch=i(["axis","x","tick","format"]),Dh=i(["axis","x","tick","culling"],{}),Eh=i(["axis","x","tick","culling","max"],10),Fh=i(["axis","x","tick","count"]),Gh=i(["axis","x","tick","fit"],!0),Hh=i(["axis","x","tick","values"],null),Ih=i(["axis","x","tick","rotate"]),Jh=i(["axis","x","max"],null),Kh=i(["axis","x","min"],null),Lh=i(["axis","x","padding"],{}),Mh=i(["axis","x","height"]),Nh=i(["axis","x","default"]),Oh=i(["axis","x","label"],{}),Ph=i(["axis","y","show"],!0),Qh=i(["axis","y","max"]),Rh=i(["axis","y","min"]),Sh=i(["axis","y","center"]),Th=i(["axis","y","label"],{}),Uh=i(["axis","y","inner"],!1),Vh=i(["axis","y","tick","format"]),Wh=i(["axis","y","padding"]),Xh=i(["axis","y","ticks"],10),Yh=i(["axis","y2","show"],!1),Zh=i(["axis","y2","max"]),$h=i(["axis","y2","min"]),_h=i(["axis","y2","center"]),ai=i(["axis","y2","label"],{}),bi=i(["axis","y2","inner"],!1),ci=i(["axis","y2","tick","format"]),di=i(["axis","y2","padding"]),ei=i(["axis","y2","ticks"],10),fi=i(["grid","x","show"],!1),gi=i(["grid","x","type"],"tick"),hi=i(["grid","x","lines"],[]),ii=i(["grid","y","show"],!1),ji=i(["grid","y","lines"],[]),ki=i(["grid","y","ticks"],10),li=i(["point","show"],!0),mi=i(["point","r"],2.5),ni=i(["point","focus","line","enabled"],!0),oi=i(["point","focus","expand","enabled"],!0),pi=i(["point","focus","expand","r"]),qi=i(["point","focus","select","r"]),ri=i(["line","connect_null"],!1),si=i(["bar","width"]),ti=i(["bar","width","ratio"],.6),ui=i(["pie","label","show"],!0),vi=i(["pie","label","format"]),wi=i(["pie","expand"],!0),xi=i(["pie","onclick"],function(){}),yi=i(["pie","onmouseover"],function(){}),zi=i(["pie","onmouseout"],function(){}),Ai=i(["donut","label","show"],!0),Bi=i(["donut","label","format"]),Ci=i(["donut","expand"],!0),Di=i(["donut","title"],""),Ei=i(["donut","onclick"],function(){}),Fi=i(["donut","onmouseover"],function(){}),Gi=i(["donut","onmouseout"],function(){}),Hi=i(["regions"],[]),Ii=i(["tooltip","show"],!0),Ji=i(["tooltip","format","title"]),Ki=i(["tooltip","format","value"]),Li=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Ji?Ji:b,l=Ki?Ki:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Mi=i(["tooltip","init","show"],!1),Ni=i(["tooltip","init","x"],0),Oi=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Pi=("string"==typeof Pf?Pf.replace(/[# .>~+]/g,""):g.chart+ +new Date)+"-clip",Qi=Pi+"-xaxis",Ri=Pi+"-yaxis",Si=j(Pi),Ti=j(Qi),Ui=j(Ri),Vi="timeseries"===yh,Wi="categorized"===yh,Xi=!Vi&&(Ng||Fe(Og)),Yi=null,Zi=!1,$i=!1,_i=!1,aj=!1,bj=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],cj=ze(_g,Fe(ph)?ph:bj,$g),dj=zh?Mf.time.format:Mf.time.format.utc,ej=dj.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),fj=[],gj=[],hj={},ij=wh?"left":"bottom",jj=wh?Uh?"top":"bottom":Uh?"right":"left",kj=wh?bi?"bottom":"top":bi?"left":"right",lj=wh?"left":"bottom",mj={main:function(){return"translate("+k(dg.left)+","+k(dg.top)+")"},context:function(){return"translate("+k(eg.left)+","+k(eg.top)+")"},legend:function(){return"translate("+fg.left+","+fg.top+")"},x:function(){return"translate(0,"+(wh?0:ig)+")" },y:function(){return"translate(0,"+(wh?ig:0)+")"},y2:function(){return"translate("+(wh?0:gg)+","+(wh?1:0)+")"},subx:function(){return"translate(0,"+(wh?0:jg)+")"},arc:function(){return"translate("+pg/2+","+qg/2+")"}},nj="right"===rh,oj=0,pj=0,qj=0,rj=.15,sj=30,tj=wh&&!xh?0:30,uj=5;ug=Mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var vj,wj=function(){var a=Mf.svg.line().x(wh?function(a){return $(a.id)(a.value)}:Id).y(wh?Id:function(a){return $(a.id)(a.value)});return ri||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ri?Te(b.values):b.values;return me(b)?(a.interpolate(ne(b)?"cardinal":"linear"),Zg[b.id]?gf(e,Dg,$(b.id),Zg[b.id]):a(e)):(c=e[0]?Dg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,wh?"M "+d+" "+c:"M "+c+" "+d)}}(),xj=function(){var a;return a=wh?Mf.svg.area().x0(function(a){return $(a.id)(0)}).x1(function(a){return $(a.id)(a.value)}).y(Id):Mf.svg.area().x(Id).y0(function(a){return $(a.id)(0)}).y1(function(a){return $(a.id)(a.value)}),function(b){var c,d,e=Te(b.values);return ge([b],"area")||ge([b],"area-spline")?(a.interpolate(ne(b)?"cardinal":"linear"),a(e)):(c=e[0]?Dg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,wh?"M "+d+" "+c:"M "+c+" "+d)}}(),yj=function(){var a=Mf.svg.line().x(wh?function(a){return _(a.id)(a.value)}:Ld).y(wh?Ld:function(a){return _(a.id)(a.value)});return function(b){var c=Te(b.values);return me(b)?a(c):"M "+Gg(c[0].x)+" "+_(b.id)(c[0].value)}}(),zj=function(){};vj=Mf.svg.brush().on("brush",rf),vj.update=function(){return Dj&&Dj.select("."+g.brush).call(this),this},vj.scale=function(a){return wh?this.y(a):this.x(a)},Wf&&(zj=Mf.behavior.zoom().on("zoomstart",function(){zj.altDomain=Mf.event.sourceEvent.altKey?Dg.orgDomain():null}).on("zoom",Wf?sf:null),zj.scale=function(a){return wh?this.y(a):this.x(a)},zj.orgScaleExtent=function(){var a=Xf?Xf:[1,10];return[a[0],Math.max(Dc()/a[1],a[1])]},zj.updateScaleExtent=function(){var a=ec(Dg.orgDomain())/ec(Hj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Aj,Bj,Cj,Dj,Ej,Fj,Gj,Hj,Ij,Jj={};if(Nf.focus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);Nf.revert(),Nf.defocus(),b(d.classed(g.focused,!0)),b(e),le(Nf.data.targets)&&Rb(a,!0),Df(a,!0)},Nf.defocus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",.3)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);Nf.revert(),b(d.classed(g.focused,!1)),b(e),le(Nf.data.targets)&&Sb(a),Df(a,!1)},Nf.revert=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);b(d.classed(g.focused,!1)),b(e),le(Nf.data.targets)&&Sb(a),Ef()},Nf.show=function(a,b){a=Hc(a),b=b||{},Pc(a),Aj.selectAll(td(a)).transition().style("opacity",1),b.withLegend&&Ff(a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Nf.hide=function(a,b){a=Hc(a),b=b||{},Oc(a),Aj.selectAll(td(a)).transition().style("opacity",0),b.withLegend&&Gf(a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Nf.toggle=function(a){Jc(a)?Nf.hide(a):Nf.show(a)},Nf.unzoom=function(){vj.clear().update(),qf({withUpdateXDomain:!0})},Nf.load=function(a){return a.xs&&rc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Sg[b]=a.classes[b]}),"categories"in a&&Wi&&(Ah=a.categories,Jg.categories(Ah)),"cacheIds"in a&&fc(a.cacheIds)?void yf(hc(a.cacheIds),a.done):void("unload"in a?Af(Hc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){zf(a)}):zf(a))},Nf.unload=function(a,b){Af(Hc(a),function(){qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Nf.selected=function(a){return Mf.merge(Cj.selectAll("."+g.shapes+rd(a)).selectAll("."+g.shape).filter(function(){return Mf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Nf.select=function(a,b,c){ch&&Cj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Mf.select(this),i=e.data?e.data.id:e.id,j=Se(this),k=dh||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);"path"!==this.nodeName&&(k&&l?eh(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},Nf.unselect=function(a,b){ch&&Cj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Mf.select(this),f=c.data?c.data.id:c.id,h=Se(this),i=dh||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);"path"!==this.nodeName&&i&&j&&eh(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Nf.toLine=function(a){Lf(a,"line")},Nf.toSpline=function(a){Lf(a,"spline")},Nf.toBar=function(a){Lf(a,"bar")},Nf.toScatter=function(a){Lf(a,"scatter")},Nf.toArea=function(a){Lf(a,"area")},Nf.toAreaSpline=function(a){Lf(a,"area-spline")},Nf.toPie=function(a){Lf(a,"pie",{withTransform:!0})},Nf.toDonut=function(a){Lf(a,"donut",{withTransform:!0})},Nf.groups=function(a){return c(a)?Tg:(Tg=a,qf(),Tg)},Nf.xgrids=function(a){return a?(hi=a,qf(),hi):hi},Nf.xgrids.add=function(a){return a?Nf.xgrids(hi.concat(a)):void 0},Nf.xgrids.remove=function(a){var b=Kf(a);return Nf.xgrids(hi.filter(b))},Nf.ygrids=function(a){return a?(ji=a,qf(),ji):ji},Nf.ygrids.add=function(a){return a?Nf.ygrids(ji.concat(a)):void 0},Nf.ygrids.remove=function(a){var b=Kf(a);return Nf.ygrids(ji.filter(b))},Nf.regions=function(a){return a?(Hi=a,qf(),Hi):Hi},Nf.regions.add=function(a){return a?(Hi=Hi.concat(a),qf(),Hi):Hi},Nf.regions.remove=function(a){var b,c,d;return a=a||{},b=Je(a,"duration",cg),c=Je(a,"classes",[g.region]),d=Cj.select("."+g.regions).selectAll(c.map(function(a){return"."+a})),(b?d.transition().duration(b):d).style("opacity",0).remove(),Hi=Hi.filter(function(a){return c.indexOf(a.class)<0})},Nf.data.get=function(a){var b=Nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Nf.data.getAsTarget=function(a){var b=Nf.data.targets.filter(function(b){return b.id===a});return b.length>0?b[0]:void 0},Nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Rg[b]=a[b]}),qf({withLegend:!0}),Rg):Rg},Nf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){_g[b]=a[b]}),qf({withLegend:!0}),_g):_g},Nf.x=function(a){return arguments.length&&(uc(Nf.data.targets,a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Nf.data.xs},Nf.xs=function(a){return arguments.length&&(vc(Nf.data.targets,a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Nf.data.xs},Nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){gb(b,a[b])}),Ib())},Nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Jh=+a.x),b(a.y)&&(Qh=+a.y),b(a.y2)&&(Zh=+a.y2)):Qh=Zh=+a,qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Kh=+a.x),b(a.y)&&(Rh=+a.y),b(a.y2)&&($h=+a.y2)):Rh=$h=+a,qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Nf.axis.max(a.max),"undefined"!=typeof a.min&&Nf.axis.min(a.min))},Nf.legend.show=function(a){Ff(Hc(a)),qf({withLegend:!0})},Nf.legend.hide=function(a){Gf(Hc(a)),qf({withLegend:!0})},Nf.resize=function(a){Qf=a?a.width:null,Rf=a?a.height:null,wf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Nf.destroy=function(){Nf.data.targets=void 0,Nf.data.xs={},Gj.html(""),a.onresize=null},"url"in f.data)Mf.xhr(f.data.url,function(a,b){var c,d=Mf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Mf.csv.parse(b.response),hf(c)});else if("rows"in f.data)hf(xc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");hf(yc(f.data.columns))}return Nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(window); \ No newline at end of file From 1bdc159f69155598f22e66ae6ac0069f7859446b Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Sat, 10 May 2014 21:57:34 +0900 Subject: [PATCH 165/178] Fix tick overflow --- c3.js | 7 ++++++- c3.min.js | 6 +++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/c3.js b/c3.js index f16f9ed..e3d0681 100644 --- a/c3.js +++ b/c3.js @@ -4617,13 +4617,18 @@ tickOffset = tickX = 0; } + function tickSize(d) { + var tickPosition = scale(d) + tickOffset; + return range[0] < tickPosition && tickPosition < range[1] ? innerTickSize : 0; + } + switch (orient) { case "bottom": { tickTransform = axisX; lineEnter.attr("y2", innerTickSize); textEnter.attr("y", Math.max(innerTickSize, 0) + tickPadding); - lineUpdate.attr("x1", tickX).attr("x2", tickX).attr("y2", innerTickSize); + lineUpdate.attr("x1", tickX).attr("x2", tickX).attr("y2", tickSize); textUpdate.attr("x", 0).attr("y", Math.max(innerTickSize, 0) + tickPadding); text.attr("dy", ".71em").style("text-anchor", "middle"); pathUpdate.attr("d", "M" + range[0] + "," + outerTickSize + "V0H" + range[1] + "V" + outerTickSize); diff --git a/c3.min.js b/c3.min.js index 070f487..5b358eb 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.round(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.round(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&a=0;return"url("+(c?"":document.URL.split("#")[0])+"#"+b+")"}function k(a){return Math.ceil(a)+.5}function l(a,b){var c,d,e;b&&b.axisX?c=b.axisX:(c=Cj.select("."+g.axisX),a&&(c=c.transition())),b&&b.axisY?d=b.axisY:(d=Cj.select("."+g.axisY),a&&(d=d.transition())),b&&b.axisY2?e=b.axisY2:(e=Cj.select("."+g.axisY2),a&&(e=e.transition())),Cj.attr("transform",mj.main),c.attr("transform",mj.x),d.attr("transform",mj.y),e.attr("transform",mj.y2),Cj.select("."+g.chartArcs).attr("transform",mj.arc)}function m(a,b){var c;b&&b.axisSubX?c=b.axisSubX:(c=Dj.select("."+g.axisX),a&&(c=c.transition())),Dj.attr("transform",mj.context),c.attr("transform",mj.subx)}function n(a){(a?Ej.transition():Ej).attr("transform",mj.legend)}function o(a,b){l(a,b),nh&&m(a,b),n(a)}function p(){var a=U(),b=T(),c=nj?0:a,d=le(Nf.data.targets),e=wh||d?0:A("x"),f=nh&&!d?oh+e:0;kg=t(),lg=u(),wh?(dg={top:A("y2")+v(),right:d?0:y(),bottom:A("y")+c+w(),left:f+(d?0:x())},eg={top:dg.top,right:0/0,bottom:20+c,left:sj}):(dg={top:4+v(),right:d?0:y(),bottom:e+f+c+w(),left:d?0:x()},eg={top:lg-f-c,right:0/0,bottom:e+c,left:dg.left}),fg={top:nj?0:lg-a,right:0/0,bottom:0,left:nj?kg-b:0},gg=kg-dg.left-dg.right,ig=lg-dg.top-dg.bottom,0>gg&&(gg=0),0>ig&&(ig=0),hg=wh?dg.left-sj-tj:gg,jg=wh?ig:lg-eg.top-eg.bottom,0>hg&&(hg=0),0>jg&&(jg=0),pg=gg-(nj?b+10:0),qg=ig-(nj?0:10),r(),nj&&d&&(fg.left=pg/2+1.1*ng)}function q(){Cj.select("line."+g.xgridFocus).attr("x1",wh?0:-10).attr("x2",wh?gg:-10).attr("y1",wh?-10:dg.top).attr("y2",wh?-10:ig)}function r(){ng=Math.min(pg,qg)/2,mg=.95*ng,og=ke(Nf.data.targets)?.6*mg:0}function s(){var a=wh?g.axisX:g.axisY,b=Cj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Gj.node().getBoundingClientRect(),e=le(Nf.data.targets),f=c.right-d.left-(e?0:x());return f>0?f:0}function t(){return Qf?Qf:B()}function u(){var a=Rf?Rf:C();return a>0?a:320}function v(){return Uf?Uf:0}function w(){return Vf?Vf:0}function x(){return Sf?Sf:wh?xh?Ke(z("x")):1:!Ph||Uh?1:Ke(z("y"))}function y(){var a=10,b=nj?T()+20:0;return Tf?Tf:wh?a+b:(!Yh||bi?a:Ke(z("y2")))+b}function z(a){var b=ob(a);return b.isInner?20+Hb(a):40+Hb(a)}function A(a){return"x"!==a||xh?"x"===a&&Mh?Mh:"y"!==a||Ph?"y2"!==a||Yh?(ob(a).isInner?30:40)+("y2"===a?-10:0):uj:qh&&!nj?10:1:0}function B(){return+Gj.style("width").replace("px","")}function C(){return+Gj.style("height").replace("px","")}function D(a){return a?-31:-(dg.left-1)}function E(a){return a?-20:-4}function F(){return D(!wh)}function G(){return E(!wh)}function H(){return D(wh)}function I(){return E(wh)}function J(a){return a?gg+2+30+30:dg.left+20}function K(a){return a?(Mh?Mh:0)+80:ig+8}function L(){return J(!wh)}function M(){return K(!wh)}function N(){return J(wh)}function O(){return K(wh)}function P(){var a,b,c,d,e,f=Ec(Nf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=Dg(b.x)-Dg(a.x),0===c?wh?ig:gg:(d=Dc(),e=he(Nf.data.targets)?(d-(Wi?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function Q(a){oj=a}function R(a){pj=a}function S(a){qj=a}function T(){return qh?nj?pj*(oj+1):kg:0}function U(){return qh?nj?lg:qj*(oj+1):0}function V(){var a,b,c=!Dg;vg=wh?1:0,wg=wh?ig:gg,xg=wh?0:ig,yg=wh?gg:1,zg=vg,Ag=wg,Bg=wh?0:jg,Cg=wh?hg:1,Dg=Y(vg,wg,c?void 0:Dg.domain(),function(){return Jg.tickOffset()}),Eg=Z(xg,yg,c?void 0:Eg.domain()),Fg=Z(xg,yg,c?void 0:Fg.domain()),Gg=Y(vg,wg,Hj,function(a){return a%1?0:Mg.tickOffset()}),Hg=Z(Bg,Cg,c?void 0:Hg.domain()),Ig=Z(Bg,Cg,c?void 0:Ig.domain()),a=db(),b=Hh?Hh:c?void 0:Jg.tickValues(),Jg=ab(Dg,ij,a,b),Mg=ab(Gg,lj,a,b),Kg=bb(Eg,jj,Vh,Xh),Lg=bb(Fg,kj,ci,ei),c||(vj.scale(Gg),Wf&&zj.scale(Dg)),W()}function W(){rg=Kb(),sg=Lb(),tg=Lb(.98)}function X(a,b,c){return(c?Mf.time.scale():Mf.scale.linear()).range([a,b])}function Y(a,b,c,d){var e,f=X(a,b,Vi),g=c?f.domain(c):f;Wi?(d=d||function(){return 0},f=function(a,b){var c=g(a)+d(a);return b?c:Math.ceil(c)}):f=function(a,b){var c=g(a);return b?c:Math.ceil(c)};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return Hj&&Hj[0]===a[0]&&Hj[1]a?a.toFixed(0):a};return Ch&&("function"==typeof Ch?a=Ch:Vi&&(a=function(a){return a?dj(Ch)(a):""})),a}function eb(a){var b;return"y"===a?b=Th:"y2"===a?b=ai:"x"===a&&(b=Oh),b}function fb(a){var b=eb(a);return"string"==typeof b?b:b?b.text:null}function gb(a,b){var c=eb(a);"string"==typeof c?"y"===a?Th=b:"y2"===a?ai=b:"x"===a&&(Oh=b):c&&(c.text=b)}function hb(a){return 10*Math.sin(Math.PI*(a/180))}function ib(a){return 11.5-2.5*(a/15)}function jb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",ib(c)).attr("x",hb(c)).attr("transform","rotate("+c+")")}function kb(a,b){var c=eb(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 lb(){return kb("x",wh?"inner-top":"inner-right")}function mb(){return kb("y",wh?"inner-right":"inner-top")}function nb(){return kb("y2",wh?"inner-right":"inner-top")}function ob(a){return"y2"===a?nb():"y"===a?mb():lb()}function pb(){return fb("x")}function qb(){return fb("y")}function rb(){return fb("y2")}function sb(a,b){return a?b.isLeft?0:b.isCenter?gg/2:gg:b.isBottom?-ig:b.isMiddle?-ig/2:0}function tb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function ub(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function vb(){return sb(!wh,lb())}function wb(){return sb(wh,mb())}function xb(){return sb(wh,nb())}function yb(){return tb(!wh,lb())}function zb(){return tb(wh,mb())}function Ab(){return tb(wh,nb())}function Bb(){var a=lb();return wh?a.isInner?"1.2em":-25-Hb("x"):a.isInner?"-0.5em":Mh?Mh-10:"3em"}function Cb(){var a=mb();return wh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Hb("y")}function Db(){var a=nb();return wh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Hb("y2")}function Eb(){return ub(!wh,lb())}function Fb(){return ub(wh,mb())}function Gb(){return ub(wh,nb())}function Hb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Ib(a){var b=Cj.select("."+g.axisX+" ."+g.axisXLabel),c=Cj.select("."+g.axisY+" ."+g.axisYLabel),d=Cj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",vb).attr("dx",yb).attr("dy",Bb).text(pb),(a?c.transition():c).attr("x",wb).attr("dx",zb).attr("dy",Cb).attr("dy",Cb).text(qb),(a?d.transition():d).attr("x",xb).attr("dx",Ab).attr("dy",Db).text(rb)}function Jb(a){var b=!1;return ug(Lc(Nf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Kb(){var a=Mf.svg.arc().outerRadius(mg).innerRadius(og),b=function(b,c){var d;return c?a(b):(d=Jb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Lb(a){var b=Mf.svg.arc().outerRadius(ng*(a?a:1)).innerRadius(og);return function(a){var c=Jb(a);return c?b(c):"M 0 0"}}function Mb(a,b){return se(a.data)?rg(a,b):"M 0 0"}function Nb(a){var b,c,d,e,f=Jb(a),g="";return f&&(b=rg.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*mg*.8+","+d/e*mg*.8+")"),g}function Ob(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Pb(a){return tc({id:a.data.id,value:a.value,ratio:Ob(a)})}function Qb(a){var b,c,d,e;return Tb()?(b=Jb(a),c=b?b.value:null,d=Ob(b),e=Ub(),e?e(c,d):Gd(c,d)):""}function Rb(a,b){var c=Aj.selectAll("."+g.chartArc+sd(a)),d=Aj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});ye(a)&&c.selectAll("path").transition().duration(50).attr("d",sg).transition().duration(100).attr("d",tg).each(function(a){re(a.data)}),b||d.style("opacity",.3)}function Sb(a){var b=Aj.selectAll("."+g.chartArc+sd(a));b.selectAll("path").transition().duration(50).attr("d",rg),Aj.selectAll("."+g.arc).style("opacity",1)}function Tb(){return ke(Nf.data.targets)?Ai:ui}function Ub(){return ke(Nf.data.targets)?Bi:vi}function Vb(){return ke(Nf.data.targets)?Di:""}function Wb(){var a=ke(Nf.data.targets)?Ei:xi;return"function"==typeof a?a:function(){}}function Xb(){var a=ke(Nf.data.targets)?Fi:yi;return"function"==typeof a?a:function(){}}function Yb(){var a=ke(Nf.data.targets)?Gi:zi;return"function"==typeof a?a:function(){}}function Zb(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Tg.length>0)for(g=Uc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return Mf.min(Object.keys(i).map(function(a){return Mf.min(i[a])}))}function $b(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Tg.length>0)for(g=Vc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return Mf.max(Object.keys(i).map(function(a){return Mf.max(i[a])}))}function _b(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return cb(a.id)===c}),m="y2"===c?$h:Rh,n="y2"===c?Zh:Qh,o=b(m)?m:Zb(l),p=b(n)?n:$b(l),q="y2"===c?_h:Sh,r=Ad()&&wh;return 0===l.length?"y2"===c?Fg.domain():Eg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=Bd(o,p),j=ec(Eg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Wh&&(f=b(Wh.top)?Wh.top:e,g=b(Wh.bottom)?Wh.bottom:e),"y2"===c&&di&&(f=b(di.top)?di.top:e,g=b(di.bottom)?di.bottom:e),he(l)&&!Uc(l)&&(g=o),[o-g,p+f])}function ac(a){return Kh?Vi?Ae(Kh):Kh:Mf.min(a,function(a){return Mf.min(a.values,function(a){return a.x})})}function bc(a){return Jh?Vi?Ae(Jh):Jh:Mf.max(a,function(a){return Mf.max(a.values,function(a){return a.x})})}function cc(a){var c,d,e,f,g=Fc(a),h=g[1]-g[0];return Wi?d=0:he(a)?(c=Dc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Lh&&Fe(Lh)?(e=b(Lh.left)?Lh.left:d,f=b(Lh.right)?Lh.right:d):e=f="number"==typeof Lh?Lh:d,{left:e,right:f}}function dc(a){var b=[ac(a),bc(a)],c=b[0],d=b[1],e=cc(a),f=0,g=0;return c-d!==0||Wi||(c=Vi?new Date(.5*c.getTime()):-.5,d=Vi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ec(a){return a[1]-a[0]}function fc(a){for(var b=0;bb?0:b-c}function lc(a){var b,c=jc(a),d="y"===a.axis?Eg:Fg;return b="y"===a.axis||"y2"===a.axis?wh?ig:"start"in a?d(a.start):ig:wh?"end"in a?Dg(Vi?Ae(a.end):a.end):ig:ig,c>b?0:b-c}function mc(a){return Ng&&a===Ng||Fe(Og)&&Ge(Og,a)}function nc(a){return!mc(a)}function oc(a){return Ng?Ng:Fe(Og)?Og[a]:null}function pc(a,b){var c,d=b&&Fe(b)?Gc(b):[];return d.forEach(function(b){oc(b)===a&&(c=Nf.data.xs[b])}),c}function qc(a,b){return a in Nf.data.xs&&Nf.data.xs[a]&&Nf.data.xs[a][b]?Nf.data.xs[a][b]:b}function rc(a){Object.keys(a).forEach(function(b){Og[b]=a[b]})}function sc(a){return 1===Mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function tc(a){var b;return a&&(b=Rg[a.id],a.name=b?b:a.id),a}function uc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=wc(b[d],a.id,d)}),Nf.data.xs[a.id]=b})}function vc(a,b){a.forEach(function(a){b[a.id]&&uc([a],b[a.id])})}function wc(a,c,d){var e;return e=Vi?a?a instanceof Date?a:Ae(a):Ae(qc(c,d)):Xi&&!Wi?b(a)?+a:qc(c,d):d}function xc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Ng?(d=Object.keys(Nf.data.xs),Nf.data.xs[c]=d.length>0?Nf.data.xs[d[0]]:void 0):Fe(Og)&&(Nf.data.xs[c]=pc(f,Nf.data.targets)):Nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Qg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=oc(b),g=a[f],h=wc(g,b,e);return Xi&&Wi&&0===c&&g&&(0===e&&(Ah=[]),Ah.push(g)),("undefined"==typeof a[b]||Nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Vg&&fe(Gc(c).filter(function(a){return!(a in Wg)}),Vg),c.forEach(function(a){gc(a.id_org,a)}),c}function Ac(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 Bc(a){return a>0&&Nf.data.targets[0].values[a-1]?Nf.data.targets[0].values[a-1].x:void 0}function Cc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Fc(a){var b,c,d=Ec(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Gc(a){return a.map(function(a){return a.id})}function Hc(a){return a?"string"==typeof a?[a]:a:Gc(Nf.data.targets)}function Ic(a,b){var c,d=Gc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Vi?new Date(i):i);j.push(e)}return Vi||(j=j.sort(function(a,b){return a-b})),j}function Oc(a){fj=fj.concat(a)}function Pc(a){fj=fj.filter(function(b){return a.indexOf(b)<0})}function Qc(a){gj=gj.concat(a)}function Rc(a){gj=gj.filter(function(b){return a.indexOf(b)<0})}function Sc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Tc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Vc(a){return Tc(a,function(a){return a>0})}function Wc(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||0===a[f].x)&&(e=e.concat(Md(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Md(a,g))),Pd(e,b)):Nd(a,b,f,g)}function Od(a,b){var c;return c=a.map(function(a){return Nd(a.values,b)}),Pd(c,b)}function Pd(a,b){var c,d;return a.forEach(function(a){var e=He(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Qd(a,b){return Mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Rd(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 Sd(){return Yg&&"desc"===Yg.toLowerCase()}function Td(){return Yg&&"asc"===Yg.toLowerCase()}function Ud(a){var b=Td(),c=Sd();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 Yg&&a.sort(Yg),a}function Vd(a,c){var d,e,f,g,h,i,j,k=le(Nf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&Ii&&(Fj.html(Li(a,db(),Cd(k),cj)).style("display","block"),d=Fj.property("offsetWidth"),e=Fj.property("offsetHeight"),k?(g=gg/2+c[0],i=ig/2+c[1]+20):(wh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-y(),i=Dg(l[0].x)+20):(f=s(),g=f+x()+Dg(l[0].x)+20,h=g+d,j=f+t()-y(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),Fj.style("top",i+"px").style("left",g+"px"))}function Wd(){Fj.style("display","none")}function Xd(a){var c=a.filter(function(a){return a&&b(a.value)});if(Ii&&!ie(Nf.data.targets)&&!le(Nf.data.targets)){var d=Cj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(wh?"y1":"x1",Id).attr(wh?"y2":"x2",Id),pf(d,"grid")}}function Yd(){Cj.select("line."+g.xgridFocus).style("visibility","hidden")}function Zd(a,b){var c,d,e,f,h=[],i=Cj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=dc(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function $d(a){return a.x||0===a.x?Dg(a.x):null}function _d(a){return $(a.id)(a.value)}function ae(){var a,b,d={},e=0;return Lc(Nf.data.targets.filter(oe)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ee(a,b){return"number"==typeof si?si:b?2*a.tickOffset()*ti/b:0}function fe(a,b){Hc(a).forEach(function(a){Jj[a]=b===Wg[a],Wg[a]=b})}function ge(a,b){var c=!1;return a.forEach(function(a){Wg[a.id]===b&&(c=!0),a.id in Wg||"line"!==b||(c=!0)}),c}function he(a){return ge(a,"bar")}function ie(a){return ge(a,"scatter")}function je(a){return ge(a,"pie")}function ke(a){return ge(a,"donut")}function le(a){return je(a)||ke(a)}function me(a){var b="string"==typeof a?a:a.id;return!(b in Wg)||"line"===Wg[b]||"spline"===Wg[b]||"area"===Wg[b]||"area-spline"===Wg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"spline"===Wg[b]||"area-spline"===Wg[b]}function oe(a){var b="string"==typeof a?a:a.id;return"bar"===Wg[b]}function pe(a){var b="string"==typeof a?a:a.id;return"scatter"===Wg[b]}function qe(a){var b="string"==typeof a?a:a.id;return"pie"===Wg[b]}function re(a){var b="string"==typeof a?a:a.id;return"donut"===Wg[b]}function se(a){return qe(a)||re(a)}function te(a){return me(a)?[a]:[]}function ue(a){return se(a.data)?[a]:[]}function ve(a){return oe(a)?a.values:[]}function we(a){return me(a)||pe(a)?a.values:[]}function xe(a){return oe(a)||me(a)?a.values:[]}function ye(a){return re(a)&&Ci||qe(a)&&wi}function ze(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function Ae(b){var c;try{c=Pg?Mf.time.format(Pg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Pg)}return c}function Be(a,b){var c=Mf.mouse(a),d=Mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ge(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function He(a,b){var c="y"===cb(a.id)?Eg:Fg,d=wh?1:0,e=wh?0:1;return Math.pow(Dg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ie(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Je(a,b,c){return d(a[b])?a[b]:c}function Ke(a){return 10*Math.ceil(a/10)}function Le(a,b,c){jh(b,a.node()),Cj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Xc(g.selectedCircle,c)}).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d).attr("stroke",function(){return cj(b)}).attr("r",1.4*We(b)).transition().duration(100).attr("r",We)}function Me(a,b,c){kh(b,a.node()),Cj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ne(a,b,c,d){a?Le(b,c,d):Me(b,c,d)}function Oe(a,b){jh(b,a.node()),a.transition().duration(100).style("fill",function(){return Mf.rgb(cj(b)).brighter(.75)})}function Pe(a,b){kh(b,a.node()),a.transition().duration(100).style("fill",function(){return cj(b)})}function Qe(a,b,c,d){a?Oe(b,c,d):Pe(b,c,d)}function Re(a,b,c,d){Qe(a,b,c.data,d)}function Se(a){return"circle"===a.nodeName?Ne:Mf.select(a).classed(g.bar)?Qe:Re}function Te(a){return a.filter(function(a){return b(a.value)})}function Ue(a){return li?"function"==typeof mi?mi(a):mi:0}function Ve(a){return oi?pi?pi:1.75*Ue(a):Ue(a)}function We(a){return qi?qi:4*Ue(a)}function Xe(a,c){return(c?Cj.selectAll("."+g.circles+rd(c)):Cj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ye(a,b){Xe(a,b).classed(g.EXPANDED,!0).attr("r",Ve)}function Ze(a){Xe(a).filter(function(){return Mf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Ue)}function $e(a){return Cj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function _e(a){$e(a).classed(g.EXPANDED,!0)}function af(a){$e(a).classed(g.EXPANDED,!1)}function bf(a,b){var c=ff(a,b);return function(a,b){var d=c(a,b),e=wh?1:0,f=wh?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 cf(a,b){var c=ff(a,!1),d=b?df:ef;return function(a,b){return d(c(a,b),a,this)}}function df(a,b){var c;return wh?(c=oe(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function ef(a,b,c){var d=c.getBoundingClientRect();return wh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:oe(b)?-3:-6)}function ff(a,b){var c=a.__max__+1,d=ee(Jg,c),e=be(d,c,a,!!b),f=ce(!!b),g=de(a,!!b),h=b?_:$;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return wh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function gf(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function hf(b){var c,d,e;if(Gj=Mf.select(Pf),Gj.empty())throw new Error("Element to bind not found");if(Gj.html("").classed("c3",!0),Nf.data.xs={},Nf.data.targets=zc(b),bh&&(Nf.data.targets=Nf.data.targets.filter(bh)),ah&&Oc(ah===!0?Gc(Nf.data.targets):ah),p(),V(),Dg.domain(Mf.extent(dc(Nf.data.targets))),Eg.domain(_b(Nf.data.targets,"y")),Fg.domain(_b(Nf.data.targets,"y2")),Gg.domain(Dg.domain()),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Hj=Dg.domain(),vj.scale(Gg),Wf&&zj.scale(Dg),Aj=Gj.append("svg").style("overflow","hidden").on("mouseenter",$f).on("mouseleave",_f),Bj=Aj.append("defs"),Bj.append("clipPath").attr("id",Pi).append("rect"),Bj.append("clipPath").attr("id",Qi).append("rect"),Bj.append("clipPath").attr("id",Ri).append("rect"),uf(),Cj=Aj.append("g").attr("transform",mj.main),Dj=Aj.append("g").attr("transform",mj.context),Ej=Aj.append("g").attr("transform",mj.legend),nh||Dj.style("visibility","hidden"),qh||(Ej.style("visibility","hidden"),gj=Gc(Nf.data.targets)),Fj=Gj.style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Hf(Gc(Nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=Cj.append("g").attr("clip-path",Si).attr("class",g.grid),fi&&d.append("g").attr("class",g.xgrids),Fe(hi)&&d.append("g").attr("class",g.xgridLines),ni&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),ii&&d.append("g").attr("class",g.ygrids),Fe(ji)&&d.append("g").attr("class",g.ygridLines),Cj.append("g").attr("clip-path",Si).attr("class",g.regions),Cj.append("g").attr("clip-path",Si).attr("class",g.chart),c=Cj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Wf?wh?"ns-resize":"ew-resize":null),Cj.select("."+g.chart).append("g").attr("class",g.chartBars),Cj.select("."+g.chart).append("g").attr("class",g.chartLines),Cj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",mj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Vb()),Cj.select("."+g.chart).append("g").attr("class",g.chartTexts),Wf&&Cj.insert("rect",Yf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",gg).attr("height",ig).style("opacity",0).style("cursor",wh?"ns-resize":"ew-resize").call(zj).on("dblclick.zoom",null),Nh&&vj.extent("function"!=typeof Nh?Nh:Nh(dc())),hj.x=Cj.append("g").attr("class",g.axisX).attr("clip-path",Ti).attr("transform",mj.x).style("visibility",xh?"visible":"hidden"),hj.x.append("text").attr("class",g.axisXLabel).attr("transform",wh?"rotate(-90)":"").style("text-anchor",Eb),hj.y=Cj.append("g").attr("class",g.axisY).attr("clip-path",Ui).attr("transform",mj.y).style("visibility",Ph?"visible":"hidden"),hj.y.append("text").attr("class",g.axisYLabel).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Fb),hj.y2=Cj.append("g").attr("class",g.axisY2).attr("transform",mj.y2).style("visibility",Yh?"visible":"hidden"),hj.y2.append("text").attr("class",g.axisY2Label).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Gb),Dj.append("g").attr("clip-path",Si).attr("class",g.chart),Dj.select("."+g.chart).append("g").attr("class",g.chartBars),Dj.select("."+g.chart).append("g").attr("class",g.chartLines),Dj.append("g").attr("clip-path",Si).attr("class",g.brush).call(vj).selectAll("rect").attr(wh?"width":"height",wh?hg:jg),hj.subx=Dj.append("g").attr("class",g.axisX).attr("transform",mj.subx).attr("clip-path",wh?"":Ti),xf(Nf.data.targets),qf({withUpdateTranslate:!0,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Mi){if(Vi&&"string"==typeof Ni){for(Ni=Ae(Ni),e=0;e0){d=[];for(var f in Rg)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Rd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Qe,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function nf(a){le(Nf.data.targets)||ch&&(Yi=a,Cj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Zi=!0,lh())}function of(){le(Nf.data.targets)||ch&&(Cj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),Cj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Zi=!1,mh())}function pf(a,b){"grid"===b&&a.each(function(){var a=Mf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function qf(a,c){var d,e,f,h,i,j,k,l,m,n,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,Q,R,S,T,U,W,X,Y,Z,$=ae(),_=le(Nf.data.targets),ab=Lc(Nf.data.targets);if(a=a||{},E=Je(a,"withY",!0),F=Je(a,"withSubchart",!0),G=Je(a,"withTransition",!0),J=Je(a,"withTransform",!1),K=Je(a,"withUpdateXDomain",!1),L=Je(a,"withUpdateOrgXDomain",!1),N=Je(a,"withUpdateTranslate",!1),M=Je(a,"withLegend",!1),H=Je(a,"withTransitionForExit",G),I=Je(a,"withTransitionForAxis",G),T=G?cg:0,U=H?T:0,W=I?T:0,c=c||vf(W),N&&(wh?(hj.x.call(Jg),hj.subx.call(Mg)):(hj.y.call(Kg),hj.y2.call(Lg)),p(),V(),uf(),o(!1)),M&&qh&&Hf(Gc(Nf.data.targets),a,c),Wi&&0===ab.length&&Dg.domain([0,hj.x.selectAll(".tick").size()]),ab.length&&(L&&(Dg.domain(Mf.extent(dc(ab))),Hj=Dg.domain(),Wf&&zj.scale(Dg).updateScaleExtent(),Gg.domain(Dg.domain()),vj.scale(Gg)),K&&(Dg.domain(vj.empty()?Hj:vj.extent()),Wf&&zj.scale(Dg).updateScaleExtent()),Hh||!Gh&&!Fh||(X=Nc(Mc(ab),Fh),Jg.tickValues(X),Mg.tickValues(X))),Eg.domain(_b(ab,"y")),Fg.domain(_b(ab,"y2")),hj.x.style("opacity",_?0:1),hj.y.style("opacity",_?0:1),hj.y2.style("opacity",_?0:1),hj.subx.style("opacity",_?0:1),c.axisX.call(Jg),c.axisY.call(Kg),c.axisY2.call(Lg),c.axisSubX.call(Mg),Ib(G),K&&ab.length)if(Dh&&X){for(Y=1;Y=0&&Mf.select(this).style("display",b%Z?"none":"block")})}else Aj.selectAll("."+g.axisX+" .tick text").style("display","block");!wh&&Ih&&jb(hj.x,c.axisX,Ih),O=bf($),R=cf($,!0),S=cf($,!1),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Fj.style("display","none"),q(),Cj.select("line."+g.xgridFocus).style("visibility","hidden"),fi&&(f=Zd(gi,Dg),B=Wi?Jg.tickOffset():0,e=wh?{x1:0,x2:gg,y1:function(a){return Dg(a)-B},y2:function(a){return Dg(a)-B}}:{x1:function(a){return Dg(a)+B},x2:function(a){return Dg(a)+B},y1:dg.top,y2:ig},d=Cj.select("."+g.xgrids).selectAll("."+g.xgrid).data(f),d.enter().append("line").attr("class",g.xgrid),d.attr(e).style("opacity",function(){return+Mf.select(this).attr(wh?"y1":"x1")===(wh?ig:0)?0:1}),d.exit().remove()),Fe(hi)&&(h=Cj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(hi),i=h.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),i.append("line").style("opacity",0),i.append("text").attr("text-anchor","end").attr("transform",wh?"":"rotate(-90)").attr("dx",wh?0:-dg.top).attr("dy",-5).style("opacity",0),h.select("line").transition().duration(T).attr("x1",wh?0:Jd).attr("x2",wh?gg:Jd).attr("y1",wh?Jd:dg.top).attr("y2",wh?Jd:ig).style("opacity",1),h.select("text").transition().duration(T).attr("x",wh?gg:0).attr("y",Jd).text(function(a){return a.text}).style("opacity",1),h.exit().transition().duration(T).style("opacity",0).remove()),E&&ii&&(j=Cj.select("."+g.ygrids).selectAll("."+g.ygrid).data(Eg.ticks(ki)),j.enter().append("line").attr("class",g.ygrid),j.attr("x1",wh?Eg:0).attr("x2",wh?Eg:gg).attr("y1",wh?0:Eg).attr("y2",wh?ig:Eg),j.exit().remove(),pf(j,"grid")),E&&Fe(ji)&&(k=Cj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(ji),l=k.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",wh?"rotate(-90)":"").attr("dx",wh?0:-dg.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",wh?Kd:0).attr("x2",wh?Kd:gg).attr("y1",wh?0:Kd).attr("y2",wh?ig:Kd).style("opacity",1),k.select("text").transition().duration(T).attr("x",wh?0:gg).attr("y",Kd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),u=Cj.select("."+g.regions).selectAll("."+g.region).data(Hi),u.enter().append("g").attr("class",kd).append("rect").style("fill-opacity",0),u.selectAll("rect").transition().duration(T).attr("x",ic).attr("y",jc).attr("width",kc).attr("height",lc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),u.exit().transition().duration(T).style("opacity",0).remove(),s=Cj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),s.enter().append("path").attr("class",ed).style("stroke","none").style("fill",cj),s.style("opacity",wd).transition().duration(T).attr("d",O).style("fill",cj).style("opacity",1),s.exit().transition().duration(U).style("opacity",0).remove(),m=Cj.selectAll("."+g.lines).selectAll("."+g.line).data(te),m.enter().append("path").attr("class",ad).style("stroke",cj),m.style("opacity",wd).transition().duration(T).attr("d",wj).style("stroke",cj).style("opacity",1),m.exit().transition().duration(U).style("opacity",0).remove(),n=Cj.selectAll("."+g.areas).selectAll("."+g.area).data(te),n.enter().append("path").attr("class",id).style("fill",cj).style("opacity",function(){return Ij=+Mf.select(this).style("opacity"),0}),n.style("opacity",0).transition().duration(T).attr("d",xj).style("fill",cj).style("opacity",Ij),n.exit().transition().duration(U).style("opacity",0).remove(),r=Cj.selectAll("."+g.circles).selectAll("."+g.circle).data(we),r.enter().append("circle").attr("class",cd).attr("r",Ue).style("fill",cj),r.style("opacity",wd).transition().duration(T).style("opacity",yd).style("fill",cj).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d),r.exit().remove(),v=Cj.selectAll("."+g.texts).selectAll("."+g.text).data(xe),v.enter().append("text").attr("class",Yc).attr("text-anchor",function(a){return wh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",cj).style("fill-opacity",0),v.text(function(a){return Hd(a.id)(a.value,a.id)}).style("fill-opacity",xd).transition().duration(T).attr("x",R).attr("y",S).style("fill",cj).style("fill-opacity",zd),v.exit().transition().duration(U).style("fill-opacity",0).remove(),t=Cj.selectAll("."+g.arcs).selectAll("."+g.arc).data(ue),t.enter().append("path").attr("class",gd).style("fill",function(a){return cj(a.data)}).style("cursor",function(a){return eh(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;aj||(c=Jb(a),d=Pb(c),e=Xb(),Rb(c.data.id),Df(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Jb(a),c=Pb(b),d=[c];Vd(d,Mf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;aj||(c=Jb(a),d=Pb(c),e=Yb(),Sb(c.data.id),Ef(),Wd(),e(d,b))}).on("click",function(a,b){var c=Jb(a),d=Pb(c),e=Wb();lf(this,a,b),e(d,b)}),t.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){aj=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Jb(a);return c?(b=Mf.interpolate(this._current,c),this._current=b(0),function(a){return Mb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("fill",function(a){return cj(a.data)}).style("opacity",1).call(Ie,function(){aj=!1}),t.exit().transition().duration(U).style("opacity",0).remove(),Cj.selectAll("."+g.chartArc).select("text").attr("transform",Nb).style("opacity",0).transition().duration(T).text(Qb).style("opacity",function(a){return Jc(a.data.id)&&se(a.data)?1:0}),Cj.select("."+g.chartArcsTitle).style("opacity",ke(Nf.data.targets)?1:0),nh&&(Mf.event&&"zoom"===Mf.event.type&&vj.extent(Dg.orgDomain()).update(),F&&(!wh&&Ih&&jb(hj.subx,c.axisSubX,Ih),vj.empty()||vj.extent(Dg.orgDomain()).update(),Q=bf($,!0),x=Dj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),x.enter().append("path").attr("class",ed).style("stroke","none").style("fill",cj),x.style("opacity",wd).transition().duration(T).attr("d",Q).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove(),w=Dj.selectAll("."+g.lines).selectAll("."+g.line).data(te),w.enter().append("path").attr("class",ad).style("stroke",cj),w.style("opacity",wd).transition().duration(T).attr("d",yj).style("opacity",1),w.exit().transition().duration(T).style("opacity",0).remove())),Cj.selectAll("."+g.selectedCircles).filter(function(a){return oe(a)}).selectAll("circle").remove(),Cj.selectAll("."+g.selectedCircle).transition().duration(T).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d),Zf&&(y=Cj.select("."+g.eventRects),Fe(Og)&&!sc(Og)?(y.classed(g.eventRectsMultiple)||y.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),z=Cj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),kf(z.enter()),z.attr("x",0).attr("y",0).attr("width",gg).attr("height",ig)):(y.classed(g.eventRectsSingle)||y.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Xi&&!Wi?(D=function(a,b){var c=Bc(b),d=Cc(b),e=Nf.data.xs[a.id][b];return(Dg(d?d:e+50)-Dg(c?c:e-50))/2},C=function(a,b){var c=Bc(b),d=Nf.data.xs[a.id][b];return(Dg(d)+Dg(c?c:d-50))/2}):(D=P(),C=function(a){return Dg(a.x)-D/2}),A=Ec(Nf.data.targets),Cj.select("."+g.eventRects).datum(A?A.values:[]),z=Cj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),jf(z.enter()),z.attr("class",ld).attr("x",wh?0:C).attr("y",wh?C:0).attr("width",wh?gg:D).attr("height",wh?D:ig),z.exit().remove())),Gc(Nf.data.targets).forEach(function(a){Jj[a]=!0})}function rf(){qf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function sf(){if(0!==Lc(Nf.data.targets).length){if("mousemove"===Mf.event.sourceEvent.type&&zj.altDomain)return Dg.domain(zj.altDomain),void zj.scale(Dg).updateScaleExtent();Wi&&Dg.orgDomain()[0]===Hj[0]&&Dg.domain([Hj[0]-1e-10,Dg.orgDomain()[1]]),qf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Mf.event.sourceEvent.type&&($i=!0)}}function tf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function uf(){Aj.attr("width",kg).attr("height",lg),Aj.select("#"+Pi).select("rect").attr("width",gg).attr("height",ig),Aj.select("#"+Qi).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),Aj.select("#"+Ri).select("rect").attr("x",H).attr("y",I).attr("width",N).attr("height",O),Aj.select("."+g.zoomRect).attr("width",gg).attr("height",ig),Gj.style("max-height",lg+"px")}function vf(a){return{axisX:a?hj.x.transition().duration(a):hj.x,axisY:a?hj.y.transition().duration(a):hj.y,axisY2:a?hj.y2.transition().duration(a):hj.y2,axisSubX:a?hj.subx.transition().duration(a):hj.subx}}function wf(a){var b;a=a||{},a.withTransition=Je(a,"withTransition",!0),a.withTransform=Je(a,"withTransform",!1),a.withLegend=Je(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withLegend&&qh||(b=vf(a.withTransitionForAxis?cg:0),p(),V(),uf(),o(a.withTransition,b)),qf(a,b)}function xf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=Cj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",nd),j=i.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Zc),e=Cj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),d=e.enter().append("g").attr("class",pd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",fd).style("cursor",function(a){return eh(a)?"pointer":null}),c=Cj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),b=c.enter().append("g").attr("class",od).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",bd),b.append("g").attr("class",jd),b.append("g").attr("class",function(a){return Xc(g.selectedCircles,a.id)}),b.append("g").attr("class",dd).style("cursor",function(a){return eh(a)?"pointer":null}),a.forEach(function(a){Cj.selectAll("."+g.selectedCircles+rd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Cj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(ug(a)).attr("class",qd),f=h.enter().append("g").attr("class",qd),f.append("g").attr("class",hd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),nh&&(n=Dj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),m=n.enter().append("g").style("opacity",0).attr("class",pd),m.append("g").attr("class",fd),l=Dj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),k=l.enter().append("g").style("opacity",0).attr("class",od),k.append("g").attr("class",bd)),Aj.selectAll("."+g.target).filter(function(a){return Jc(a.id)}).transition().duration(cg).style("opacity",1)}function yf(a,b){b.filter&&(a=a.filter(b.filter)),(b.type||b.types)&&a.forEach(function(a){b.types?fe(a.id,b.types[a.id]):fe(a.id,b.type)}),Nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,z=0,F++)),E[a]=F,D[F]=f,A[a]=z,z+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+v)/10),j=10*Math.ceil((h.height+u)/10),k=nj?j:i,l=nj?U():T();return d&&(z=0,F=0,w=0,x=0),qh&&!Kc(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=i,C[c]=j,(!w||i>=w)&&(w=i),(!x||j>=x)&&(x=j),g=nj?x:w,void(vh?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(l-g*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=26,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=Ej.selectAll("."+g.legendItemFocused).size();b=b||{},n=Je(b,"withTransition",!0),q=Je(b,"withTransitionForTransform",!0),nj?(f=function(a){return w*E[a]},j=function(a){return D[E[a]]+A[a]}):(f=function(a){return D[E[a]]+A[a]},j=function(a){return x*E[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=Ej.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Xc(g.legendItem,a)}).style("visibility",function(a){return Kc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof sh?sh(a):Nf.toggle(a)}).on("mouseover",function(a){Mf.select(this).classed(g.legendItemFocused,!0),aj||Nf.focus(a),"function"==typeof th&&th(a)}).on("mouseout",function(a){Mf.select(this).classed(g.legendItemFocused,!1),aj||Nf.revert(),"function"==typeof uh&&uh(a)}),m.append("text").text(function(a){return d(Rg[a])?Rg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",nj?h:-200).attr("y",nj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",nj?i:-200).attr("y",nj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",cj).attr("x",nj?h:-200).attr("y",nj?-200:j).attr("width",10).attr("height",10),r=Ej.selectAll("text").data(a).text(function(a){return d(Rg[a])?Rg[a]:a}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=Ej.selectAll("rect."+g.legendItemEvent).data(a),(n?s.transition():s).attr("width",function(a){return B[a]}).attr("height",function(a){return C[a]}).attr("x",i).attr("y",l),t=Ej.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",cj).attr("x",f).attr("y",j),Ej.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Jc(a)}).transition().style("opacity",function(a){var b=Mf.select(this);return Jc(a)?!G||b.classed(g.legendItemFocused)?Bf(b):Cf(b):rj}),R(w),S(x),Q(F),p(),V(),uf(),o(q,c)}function If(a){return Ic(Nf.data.targets,a.id)}function Jf(a){return"data"in a&&Ic(Nf.data.targets,a.data.id)}function Kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function Lf(a,b,c){var d=!le(Nf.data.targets);aj=!1,fe(a,b),wf(c||{withTransitionForAxis:d})}var Mf=a.d3?a.d3:a.require?a.require("d3"):void 0,Nf={data:{},axis:{},legend:{}},Of={},Pf=i(["bindto"],"#chart"),Qf=i(["size","width"]),Rf=i(["size","height"]),Sf=i(["padding","left"]),Tf=i(["padding","right"]),Uf=i(["padding","top"]),Vf=i(["padding","bottom"]),Wf=i(["zoom","enabled"],!1),Xf=i(["zoom","extent"]),Yf=i(["zoom","privileged"],!1),Zf=i(["interaction","enabled"],!0),$f=i(["onenter"],function(){}),_f=i(["onleave"],function(){}),ag=i(["onresize"],function(){}),bg=i(["onresized"],function(){}),cg=i(["transition","duration"],350);h("data","data is required in config");var dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg,Kg,Lg,Mg,Ng=i(["data","x"]),Og=i(["data","xs"],{}),Pg=i(["data","x_format"]),Qg=i(["data","id_converter"],function(a){return a}),Rg=i(["data","names"],{}),Sg=i(["data","classes"],{}),Tg=i(["data","groups"],[]),Ug=i(["data","axes"],{}),Vg=i(["data","type"]),Wg=i(["data","types"],{}),Xg=i(["data","labels"],{}),Yg=i(["data","order"]),Zg=i(["data","regions"],{}),$g=i(["data","color"]),_g=i(["data","colors"],{}),ah=i(["data","hide"],!1),bh=i(["data","filter"]),ch=i(["data","selection","enabled"],!1),dh=i(["data","selection","grouped"],!1),eh=i(["data","selection","isselectable"],function(){return!0}),fh=i(["data","selection","multiple"],!0),gh=i(["data","onclick"],function(){}),hh=i(["data","onenter"],function(){}),ih=i(["data","onleave"],function(){}),jh=i(["data","onselected"],function(){}),kh=i(["data","onunselected"],function(){}),lh=i(["data","ondragstart"],function(){}),mh=i(["data","ondragend"],function(){}),nh=i(["subchart","show"],!1),oh=i(["subchart","size","height"],60),ph=i(["color","pattern"],[]),qh=i(["legend","show"],!0),rh=i(["legend","position"],"bottom"),sh=i(["legend","item","onclick"]),th=i(["legend","item","onmouseover"]),uh=i(["legend","item","onmouseout"]),vh=i(["legend","equally"],!1),wh=i(["axis","rotated"],!1),xh=i(["axis","x","show"],!0),yh=i(["axis","x","type"],"indexed"),zh=i(["axis","x","localtime"],!0),Ah=i(["axis","x","categories"],[]),Bh=i(["axis","x","tick","centered"],!1),Ch=i(["axis","x","tick","format"]),Dh=i(["axis","x","tick","culling"],{}),Eh=i(["axis","x","tick","culling","max"],10),Fh=i(["axis","x","tick","count"]),Gh=i(["axis","x","tick","fit"],!0),Hh=i(["axis","x","tick","values"],null),Ih=i(["axis","x","tick","rotate"]),Jh=i(["axis","x","max"],null),Kh=i(["axis","x","min"],null),Lh=i(["axis","x","padding"],{}),Mh=i(["axis","x","height"]),Nh=i(["axis","x","default"]),Oh=i(["axis","x","label"],{}),Ph=i(["axis","y","show"],!0),Qh=i(["axis","y","max"]),Rh=i(["axis","y","min"]),Sh=i(["axis","y","center"]),Th=i(["axis","y","label"],{}),Uh=i(["axis","y","inner"],!1),Vh=i(["axis","y","tick","format"]),Wh=i(["axis","y","padding"]),Xh=i(["axis","y","ticks"],10),Yh=i(["axis","y2","show"],!1),Zh=i(["axis","y2","max"]),$h=i(["axis","y2","min"]),_h=i(["axis","y2","center"]),ai=i(["axis","y2","label"],{}),bi=i(["axis","y2","inner"],!1),ci=i(["axis","y2","tick","format"]),di=i(["axis","y2","padding"]),ei=i(["axis","y2","ticks"],10),fi=i(["grid","x","show"],!1),gi=i(["grid","x","type"],"tick"),hi=i(["grid","x","lines"],[]),ii=i(["grid","y","show"],!1),ji=i(["grid","y","lines"],[]),ki=i(["grid","y","ticks"],10),li=i(["point","show"],!0),mi=i(["point","r"],2.5),ni=i(["point","focus","line","enabled"],!0),oi=i(["point","focus","expand","enabled"],!0),pi=i(["point","focus","expand","r"]),qi=i(["point","focus","select","r"]),ri=i(["line","connect_null"],!1),si=i(["bar","width"]),ti=i(["bar","width","ratio"],.6),ui=i(["pie","label","show"],!0),vi=i(["pie","label","format"]),wi=i(["pie","expand"],!0),xi=i(["pie","onclick"],function(){}),yi=i(["pie","onmouseover"],function(){}),zi=i(["pie","onmouseout"],function(){}),Ai=i(["donut","label","show"],!0),Bi=i(["donut","label","format"]),Ci=i(["donut","expand"],!0),Di=i(["donut","title"],""),Ei=i(["donut","onclick"],function(){}),Fi=i(["donut","onmouseover"],function(){}),Gi=i(["donut","onmouseout"],function(){}),Hi=i(["regions"],[]),Ii=i(["tooltip","show"],!0),Ji=i(["tooltip","format","title"]),Ki=i(["tooltip","format","value"]),Li=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Ji?Ji:b,l=Ki?Ki:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Mi=i(["tooltip","init","show"],!1),Ni=i(["tooltip","init","x"],0),Oi=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Pi=("string"==typeof Pf?Pf.replace(/[# .>~+]/g,""):g.chart+ +new Date)+"-clip",Qi=Pi+"-xaxis",Ri=Pi+"-yaxis",Si=j(Pi),Ti=j(Qi),Ui=j(Ri),Vi="timeseries"===yh,Wi="categorized"===yh,Xi=!Vi&&(Ng||Fe(Og)),Yi=null,Zi=!1,$i=!1,_i=!1,aj=!1,bj=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],cj=ze(_g,Fe(ph)?ph:bj,$g),dj=zh?Mf.time.format:Mf.time.format.utc,ej=dj.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),fj=[],gj=[],hj={},ij=wh?"left":"bottom",jj=wh?Uh?"top":"bottom":Uh?"right":"left",kj=wh?bi?"bottom":"top":bi?"left":"right",lj=wh?"left":"bottom",mj={main:function(){return"translate("+k(dg.left)+","+k(dg.top)+")"},context:function(){return"translate("+k(eg.left)+","+k(eg.top)+")"},legend:function(){return"translate("+fg.left+","+fg.top+")"},x:function(){return"translate(0,"+(wh?0:ig)+")" -},y:function(){return"translate(0,"+(wh?ig:0)+")"},y2:function(){return"translate("+(wh?0:gg)+","+(wh?1:0)+")"},subx:function(){return"translate(0,"+(wh?0:jg)+")"},arc:function(){return"translate("+pg/2+","+qg/2+")"}},nj="right"===rh,oj=0,pj=0,qj=0,rj=.15,sj=30,tj=wh&&!xh?0:30,uj=5;ug=Mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var vj,wj=function(){var a=Mf.svg.line().x(wh?function(a){return $(a.id)(a.value)}:Id).y(wh?Id:function(a){return $(a.id)(a.value)});return ri||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ri?Te(b.values):b.values;return me(b)?(a.interpolate(ne(b)?"cardinal":"linear"),Zg[b.id]?gf(e,Dg,$(b.id),Zg[b.id]):a(e)):(c=e[0]?Dg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,wh?"M "+d+" "+c:"M "+c+" "+d)}}(),xj=function(){var a;return a=wh?Mf.svg.area().x0(function(a){return $(a.id)(0)}).x1(function(a){return $(a.id)(a.value)}).y(Id):Mf.svg.area().x(Id).y0(function(a){return $(a.id)(0)}).y1(function(a){return $(a.id)(a.value)}),function(b){var c,d,e=Te(b.values);return ge([b],"area")||ge([b],"area-spline")?(a.interpolate(ne(b)?"cardinal":"linear"),a(e)):(c=e[0]?Dg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,wh?"M "+d+" "+c:"M "+c+" "+d)}}(),yj=function(){var a=Mf.svg.line().x(wh?function(a){return _(a.id)(a.value)}:Ld).y(wh?Ld:function(a){return _(a.id)(a.value)});return function(b){var c=Te(b.values);return me(b)?a(c):"M "+Gg(c[0].x)+" "+_(b.id)(c[0].value)}}(),zj=function(){};vj=Mf.svg.brush().on("brush",rf),vj.update=function(){return Dj&&Dj.select("."+g.brush).call(this),this},vj.scale=function(a){return wh?this.y(a):this.x(a)},Wf&&(zj=Mf.behavior.zoom().on("zoomstart",function(){zj.altDomain=Mf.event.sourceEvent.altKey?Dg.orgDomain():null}).on("zoom",Wf?sf:null),zj.scale=function(a){return wh?this.y(a):this.x(a)},zj.orgScaleExtent=function(){var a=Xf?Xf:[1,10];return[a[0],Math.max(Dc()/a[1],a[1])]},zj.updateScaleExtent=function(){var a=ec(Dg.orgDomain())/ec(Hj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Aj,Bj,Cj,Dj,Ej,Fj,Gj,Hj,Ij,Jj={};if(Nf.focus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);Nf.revert(),Nf.defocus(),b(d.classed(g.focused,!0)),b(e),le(Nf.data.targets)&&Rb(a,!0),Df(a,!0)},Nf.defocus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",.3)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);Nf.revert(),b(d.classed(g.focused,!1)),b(e),le(Nf.data.targets)&&Sb(a),Df(a,!1)},Nf.revert=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);b(d.classed(g.focused,!1)),b(e),le(Nf.data.targets)&&Sb(a),Ef()},Nf.show=function(a,b){a=Hc(a),b=b||{},Pc(a),Aj.selectAll(td(a)).transition().style("opacity",1),b.withLegend&&Ff(a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Nf.hide=function(a,b){a=Hc(a),b=b||{},Oc(a),Aj.selectAll(td(a)).transition().style("opacity",0),b.withLegend&&Gf(a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Nf.toggle=function(a){Jc(a)?Nf.hide(a):Nf.show(a)},Nf.unzoom=function(){vj.clear().update(),qf({withUpdateXDomain:!0})},Nf.load=function(a){return a.xs&&rc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Sg[b]=a.classes[b]}),"categories"in a&&Wi&&(Ah=a.categories,Jg.categories(Ah)),"cacheIds"in a&&fc(a.cacheIds)?void yf(hc(a.cacheIds),a.done):void("unload"in a?Af(Hc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){zf(a)}):zf(a))},Nf.unload=function(a,b){Af(Hc(a),function(){qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Nf.selected=function(a){return Mf.merge(Cj.selectAll("."+g.shapes+rd(a)).selectAll("."+g.shape).filter(function(){return Mf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Nf.select=function(a,b,c){ch&&Cj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Mf.select(this),i=e.data?e.data.id:e.id,j=Se(this),k=dh||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);"path"!==this.nodeName&&(k&&l?eh(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},Nf.unselect=function(a,b){ch&&Cj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Mf.select(this),f=c.data?c.data.id:c.id,h=Se(this),i=dh||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);"path"!==this.nodeName&&i&&j&&eh(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Nf.toLine=function(a){Lf(a,"line")},Nf.toSpline=function(a){Lf(a,"spline")},Nf.toBar=function(a){Lf(a,"bar")},Nf.toScatter=function(a){Lf(a,"scatter")},Nf.toArea=function(a){Lf(a,"area")},Nf.toAreaSpline=function(a){Lf(a,"area-spline")},Nf.toPie=function(a){Lf(a,"pie",{withTransform:!0})},Nf.toDonut=function(a){Lf(a,"donut",{withTransform:!0})},Nf.groups=function(a){return c(a)?Tg:(Tg=a,qf(),Tg)},Nf.xgrids=function(a){return a?(hi=a,qf(),hi):hi},Nf.xgrids.add=function(a){return a?Nf.xgrids(hi.concat(a)):void 0},Nf.xgrids.remove=function(a){var b=Kf(a);return Nf.xgrids(hi.filter(b))},Nf.ygrids=function(a){return a?(ji=a,qf(),ji):ji},Nf.ygrids.add=function(a){return a?Nf.ygrids(ji.concat(a)):void 0},Nf.ygrids.remove=function(a){var b=Kf(a);return Nf.ygrids(ji.filter(b))},Nf.regions=function(a){return a?(Hi=a,qf(),Hi):Hi},Nf.regions.add=function(a){return a?(Hi=Hi.concat(a),qf(),Hi):Hi},Nf.regions.remove=function(a){var b,c,d;return a=a||{},b=Je(a,"duration",cg),c=Je(a,"classes",[g.region]),d=Cj.select("."+g.regions).selectAll(c.map(function(a){return"."+a})),(b?d.transition().duration(b):d).style("opacity",0).remove(),Hi=Hi.filter(function(a){return c.indexOf(a.class)<0})},Nf.data.get=function(a){var b=Nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Nf.data.getAsTarget=function(a){var b=Nf.data.targets.filter(function(b){return b.id===a});return b.length>0?b[0]:void 0},Nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Rg[b]=a[b]}),qf({withLegend:!0}),Rg):Rg},Nf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){_g[b]=a[b]}),qf({withLegend:!0}),_g):_g},Nf.x=function(a){return arguments.length&&(uc(Nf.data.targets,a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Nf.data.xs},Nf.xs=function(a){return arguments.length&&(vc(Nf.data.targets,a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Nf.data.xs},Nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){gb(b,a[b])}),Ib())},Nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Jh=+a.x),b(a.y)&&(Qh=+a.y),b(a.y2)&&(Zh=+a.y2)):Qh=Zh=+a,qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Kh=+a.x),b(a.y)&&(Rh=+a.y),b(a.y2)&&($h=+a.y2)):Rh=$h=+a,qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Nf.axis.max(a.max),"undefined"!=typeof a.min&&Nf.axis.min(a.min))},Nf.legend.show=function(a){Ff(Hc(a)),qf({withLegend:!0})},Nf.legend.hide=function(a){Gf(Hc(a)),qf({withLegend:!0})},Nf.resize=function(a){Qf=a?a.width:null,Rf=a?a.height:null,wf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Nf.destroy=function(){Nf.data.targets=void 0,Nf.data.xs={},Gj.html(""),a.onresize=null},"url"in f.data)Mf.xhr(f.data.url,function(a,b){var c,d=Mf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Mf.csv.parse(b.response),hf(c)});else if("rows"in f.data)hf(xc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");hf(yc(f.data.columns))}return Nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(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}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.round(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.round(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&a=0;return"url("+(c?"":document.URL.split("#")[0])+"#"+b+")"}function k(a){return Math.ceil(a)+.5}function l(a,b){var c,d,e;b&&b.axisX?c=b.axisX:(c=Cj.select("."+g.axisX),a&&(c=c.transition())),b&&b.axisY?d=b.axisY:(d=Cj.select("."+g.axisY),a&&(d=d.transition())),b&&b.axisY2?e=b.axisY2:(e=Cj.select("."+g.axisY2),a&&(e=e.transition())),Cj.attr("transform",mj.main),c.attr("transform",mj.x),d.attr("transform",mj.y),e.attr("transform",mj.y2),Cj.select("."+g.chartArcs).attr("transform",mj.arc)}function m(a,b){var c;b&&b.axisSubX?c=b.axisSubX:(c=Dj.select("."+g.axisX),a&&(c=c.transition())),Dj.attr("transform",mj.context),c.attr("transform",mj.subx)}function n(a){(a?Ej.transition():Ej).attr("transform",mj.legend)}function o(a,b){l(a,b),nh&&m(a,b),n(a)}function p(){var a=U(),b=T(),c=nj?0:a,d=le(Nf.data.targets),e=wh||d?0:A("x"),f=nh&&!d?oh+e:0;kg=t(),lg=u(),wh?(dg={top:A("y2")+v(),right:d?0:y(),bottom:A("y")+c+w(),left:f+(d?0:x())},eg={top:dg.top,right:0/0,bottom:20+c,left:sj}):(dg={top:4+v(),right:d?0:y(),bottom:e+f+c+w(),left:d?0:x()},eg={top:lg-f-c,right:0/0,bottom:e+c,left:dg.left}),fg={top:nj?0:lg-a,right:0/0,bottom:0,left:nj?kg-b:0},gg=kg-dg.left-dg.right,ig=lg-dg.top-dg.bottom,0>gg&&(gg=0),0>ig&&(ig=0),hg=wh?dg.left-sj-tj:gg,jg=wh?ig:lg-eg.top-eg.bottom,0>hg&&(hg=0),0>jg&&(jg=0),pg=gg-(nj?b+10:0),qg=ig-(nj?0:10),r(),nj&&d&&(fg.left=pg/2+1.1*ng)}function q(){Cj.select("line."+g.xgridFocus).attr("x1",wh?0:-10).attr("x2",wh?gg:-10).attr("y1",wh?-10:dg.top).attr("y2",wh?-10:ig)}function r(){ng=Math.min(pg,qg)/2,mg=.95*ng,og=ke(Nf.data.targets)?.6*mg:0}function s(){var a=wh?g.axisX:g.axisY,b=Cj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Gj.node().getBoundingClientRect(),e=le(Nf.data.targets),f=c.right-d.left-(e?0:x());return f>0?f:0}function t(){return Qf?Qf:B()}function u(){var a=Rf?Rf:C();return a>0?a:320}function v(){return Uf?Uf:0}function w(){return Vf?Vf:0}function x(){return Sf?Sf:wh?xh?Ke(z("x")):1:!Ph||Uh?1:Ke(z("y"))}function y(){var a=10,b=nj?T()+20:0;return Tf?Tf:wh?a+b:(!Yh||bi?a:Ke(z("y2")))+b}function z(a){var b=ob(a);return b.isInner?20+Hb(a):40+Hb(a)}function A(a){return"x"!==a||xh?"x"===a&&Mh?Mh:"y"!==a||Ph?"y2"!==a||Yh?(ob(a).isInner?30:40)+("y2"===a?-10:0):uj:qh&&!nj?10:1:0}function B(){return+Gj.style("width").replace("px","")}function C(){return+Gj.style("height").replace("px","")}function D(a){return a?-31:-(dg.left-1)}function E(a){return a?-20:-4}function F(){return D(!wh)}function G(){return E(!wh)}function H(){return D(wh)}function I(){return E(wh)}function J(a){return a?gg+2+30+30:dg.left+20}function K(a){return a?(Mh?Mh:0)+80:ig+8}function L(){return J(!wh)}function M(){return K(!wh)}function N(){return J(wh)}function O(){return K(wh)}function P(){var a,b,c,d,e,f=Ec(Nf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=Dg(b.x)-Dg(a.x),0===c?wh?ig:gg:(d=Dc(),e=he(Nf.data.targets)?(d-(Wi?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function Q(a){oj=a}function R(a){pj=a}function S(a){qj=a}function T(){return qh?nj?pj*(oj+1):kg:0}function U(){return qh?nj?lg:qj*(oj+1):0}function V(){var a,b,c=!Dg;vg=wh?1:0,wg=wh?ig:gg,xg=wh?0:ig,yg=wh?gg:1,zg=vg,Ag=wg,Bg=wh?0:jg,Cg=wh?hg:1,Dg=Y(vg,wg,c?void 0:Dg.domain(),function(){return Jg.tickOffset()}),Eg=Z(xg,yg,c?void 0:Eg.domain()),Fg=Z(xg,yg,c?void 0:Fg.domain()),Gg=Y(vg,wg,Hj,function(a){return a%1?0:Mg.tickOffset()}),Hg=Z(Bg,Cg,c?void 0:Hg.domain()),Ig=Z(Bg,Cg,c?void 0:Ig.domain()),a=db(),b=Hh?Hh:c?void 0:Jg.tickValues(),Jg=ab(Dg,ij,a,b),Mg=ab(Gg,lj,a,b),Kg=bb(Eg,jj,Vh,Xh),Lg=bb(Fg,kj,ci,ei),c||(vj.scale(Gg),Wf&&zj.scale(Dg)),W()}function W(){rg=Kb(),sg=Lb(),tg=Lb(.98)}function X(a,b,c){return(c?Mf.time.scale():Mf.scale.linear()).range([a,b])}function Y(a,b,c,d){var e,f=X(a,b,Vi),g=c?f.domain(c):f;Wi?(d=d||function(){return 0},f=function(a,b){var c=g(a)+d(a);return b?c:Math.ceil(c)}):f=function(a,b){var c=g(a);return b?c:Math.ceil(c)};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return Hj&&Hj[0]===a[0]&&Hj[1]a?a.toFixed(0):a};return Ch&&("function"==typeof Ch?a=Ch:Vi&&(a=function(a){return a?dj(Ch)(a):""})),a}function eb(a){var b;return"y"===a?b=Th:"y2"===a?b=ai:"x"===a&&(b=Oh),b}function fb(a){var b=eb(a);return"string"==typeof b?b:b?b.text:null}function gb(a,b){var c=eb(a);"string"==typeof c?"y"===a?Th=b:"y2"===a?ai=b:"x"===a&&(Oh=b):c&&(c.text=b)}function hb(a){return 10*Math.sin(Math.PI*(a/180))}function ib(a){return 11.5-2.5*(a/15)}function jb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",ib(c)).attr("x",hb(c)).attr("transform","rotate("+c+")")}function kb(a,b){var c=eb(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 lb(){return kb("x",wh?"inner-top":"inner-right")}function mb(){return kb("y",wh?"inner-right":"inner-top")}function nb(){return kb("y2",wh?"inner-right":"inner-top")}function ob(a){return"y2"===a?nb():"y"===a?mb():lb()}function pb(){return fb("x")}function qb(){return fb("y")}function rb(){return fb("y2")}function sb(a,b){return a?b.isLeft?0:b.isCenter?gg/2:gg:b.isBottom?-ig:b.isMiddle?-ig/2:0}function tb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function ub(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function vb(){return sb(!wh,lb())}function wb(){return sb(wh,mb())}function xb(){return sb(wh,nb())}function yb(){return tb(!wh,lb())}function zb(){return tb(wh,mb())}function Ab(){return tb(wh,nb())}function Bb(){var a=lb();return wh?a.isInner?"1.2em":-25-Hb("x"):a.isInner?"-0.5em":Mh?Mh-10:"3em"}function Cb(){var a=mb();return wh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Hb("y")}function Db(){var a=nb();return wh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Hb("y2")}function Eb(){return ub(!wh,lb())}function Fb(){return ub(wh,mb())}function Gb(){return ub(wh,nb())}function Hb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Ib(a){var b=Cj.select("."+g.axisX+" ."+g.axisXLabel),c=Cj.select("."+g.axisY+" ."+g.axisYLabel),d=Cj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",vb).attr("dx",yb).attr("dy",Bb).text(pb),(a?c.transition():c).attr("x",wb).attr("dx",zb).attr("dy",Cb).attr("dy",Cb).text(qb),(a?d.transition():d).attr("x",xb).attr("dx",Ab).attr("dy",Db).text(rb)}function Jb(a){var b=!1;return ug(Lc(Nf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Kb(){var a=Mf.svg.arc().outerRadius(mg).innerRadius(og),b=function(b,c){var d;return c?a(b):(d=Jb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Lb(a){var b=Mf.svg.arc().outerRadius(ng*(a?a:1)).innerRadius(og);return function(a){var c=Jb(a);return c?b(c):"M 0 0"}}function Mb(a,b){return se(a.data)?rg(a,b):"M 0 0"}function Nb(a){var b,c,d,e,f=Jb(a),g="";return f&&(b=rg.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*mg*.8+","+d/e*mg*.8+")"),g}function Ob(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Pb(a){return tc({id:a.data.id,value:a.value,ratio:Ob(a)})}function Qb(a){var b,c,d,e;return Tb()?(b=Jb(a),c=b?b.value:null,d=Ob(b),e=Ub(),e?e(c,d):Gd(c,d)):""}function Rb(a,b){var c=Aj.selectAll("."+g.chartArc+sd(a)),d=Aj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});ye(a)&&c.selectAll("path").transition().duration(50).attr("d",sg).transition().duration(100).attr("d",tg).each(function(a){re(a.data)}),b||d.style("opacity",.3)}function Sb(a){var b=Aj.selectAll("."+g.chartArc+sd(a));b.selectAll("path").transition().duration(50).attr("d",rg),Aj.selectAll("."+g.arc).style("opacity",1)}function Tb(){return ke(Nf.data.targets)?Ai:ui}function Ub(){return ke(Nf.data.targets)?Bi:vi}function Vb(){return ke(Nf.data.targets)?Di:""}function Wb(){var a=ke(Nf.data.targets)?Ei:xi;return"function"==typeof a?a:function(){}}function Xb(){var a=ke(Nf.data.targets)?Fi:yi;return"function"==typeof a?a:function(){}}function Yb(){var a=ke(Nf.data.targets)?Gi:zi;return"function"==typeof a?a:function(){}}function Zb(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Tg.length>0)for(g=Uc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return Mf.min(Object.keys(i).map(function(a){return Mf.min(i[a])}))}function $b(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Tg.length>0)for(g=Vc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return Mf.max(Object.keys(i).map(function(a){return Mf.max(i[a])}))}function _b(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return cb(a.id)===c}),m="y2"===c?$h:Rh,n="y2"===c?Zh:Qh,o=b(m)?m:Zb(l),p=b(n)?n:$b(l),q="y2"===c?_h:Sh,r=Ad()&&wh;return 0===l.length?"y2"===c?Fg.domain():Eg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=Bd(o,p),j=ec(Eg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Wh&&(f=b(Wh.top)?Wh.top:e,g=b(Wh.bottom)?Wh.bottom:e),"y2"===c&&di&&(f=b(di.top)?di.top:e,g=b(di.bottom)?di.bottom:e),he(l)&&!Uc(l)&&(g=o),[o-g,p+f])}function ac(a){return Kh?Vi?Ae(Kh):Kh:Mf.min(a,function(a){return Mf.min(a.values,function(a){return a.x})})}function bc(a){return Jh?Vi?Ae(Jh):Jh:Mf.max(a,function(a){return Mf.max(a.values,function(a){return a.x})})}function cc(a){var c,d,e,f,g=Fc(a),h=g[1]-g[0];return Wi?d=0:he(a)?(c=Dc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Lh&&Fe(Lh)?(e=b(Lh.left)?Lh.left:d,f=b(Lh.right)?Lh.right:d):e=f="number"==typeof Lh?Lh:d,{left:e,right:f}}function dc(a){var b=[ac(a),bc(a)],c=b[0],d=b[1],e=cc(a),f=0,g=0;return c-d!==0||Wi||(c=Vi?new Date(.5*c.getTime()):-.5,d=Vi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ec(a){return a[1]-a[0]}function fc(a){for(var b=0;bb?0:b-c}function lc(a){var b,c=jc(a),d="y"===a.axis?Eg:Fg;return b="y"===a.axis||"y2"===a.axis?wh?ig:"start"in a?d(a.start):ig:wh?"end"in a?Dg(Vi?Ae(a.end):a.end):ig:ig,c>b?0:b-c}function mc(a){return Ng&&a===Ng||Fe(Og)&&Ge(Og,a)}function nc(a){return!mc(a)}function oc(a){return Ng?Ng:Fe(Og)?Og[a]:null}function pc(a,b){var c,d=b&&Fe(b)?Gc(b):[];return d.forEach(function(b){oc(b)===a&&(c=Nf.data.xs[b])}),c}function qc(a,b){return a in Nf.data.xs&&Nf.data.xs[a]&&Nf.data.xs[a][b]?Nf.data.xs[a][b]:b}function rc(a){Object.keys(a).forEach(function(b){Og[b]=a[b]})}function sc(a){return 1===Mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function tc(a){var b;return a&&(b=Rg[a.id],a.name=b?b:a.id),a}function uc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=wc(b[d],a.id,d)}),Nf.data.xs[a.id]=b})}function vc(a,b){a.forEach(function(a){b[a.id]&&uc([a],b[a.id])})}function wc(a,c,d){var e;return e=Vi?a?a instanceof Date?a:Ae(a):Ae(qc(c,d)):Xi&&!Wi?b(a)?+a:qc(c,d):d}function xc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Ng?(d=Object.keys(Nf.data.xs),Nf.data.xs[c]=d.length>0?Nf.data.xs[d[0]]:void 0):Fe(Og)&&(Nf.data.xs[c]=pc(f,Nf.data.targets)):Nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Qg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=oc(b),g=a[f],h=wc(g,b,e);return Xi&&Wi&&0===c&&g&&(0===e&&(Ah=[]),Ah.push(g)),("undefined"==typeof a[b]||Nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Vg&&fe(Gc(c).filter(function(a){return!(a in Wg)}),Vg),c.forEach(function(a){gc(a.id_org,a)}),c}function Ac(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 Bc(a){return a>0&&Nf.data.targets[0].values[a-1]?Nf.data.targets[0].values[a-1].x:void 0}function Cc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Fc(a){var b,c,d=Ec(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Gc(a){return a.map(function(a){return a.id})}function Hc(a){return a?"string"==typeof a?[a]:a:Gc(Nf.data.targets)}function Ic(a,b){var c,d=Gc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Vi?new Date(i):i);j.push(e)}return Vi||(j=j.sort(function(a,b){return a-b})),j}function Oc(a){fj=fj.concat(a)}function Pc(a){fj=fj.filter(function(b){return a.indexOf(b)<0})}function Qc(a){gj=gj.concat(a)}function Rc(a){gj=gj.filter(function(b){return a.indexOf(b)<0})}function Sc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Tc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Vc(a){return Tc(a,function(a){return a>0})}function Wc(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||0===a[f].x)&&(e=e.concat(Md(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Md(a,g))),Pd(e,b)):Nd(a,b,f,g)}function Od(a,b){var c;return c=a.map(function(a){return Nd(a.values,b)}),Pd(c,b)}function Pd(a,b){var c,d;return a.forEach(function(a){var e=He(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Qd(a,b){return Mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Rd(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 Sd(){return Yg&&"desc"===Yg.toLowerCase()}function Td(){return Yg&&"asc"===Yg.toLowerCase()}function Ud(a){var b=Td(),c=Sd();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 Yg&&a.sort(Yg),a}function Vd(a,c){var d,e,f,g,h,i,j,k=le(Nf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&Ii&&(Fj.html(Li(a,db(),Cd(k),cj)).style("display","block"),d=Fj.property("offsetWidth"),e=Fj.property("offsetHeight"),k?(g=gg/2+c[0],i=ig/2+c[1]+20):(wh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-y(),i=Dg(l[0].x)+20):(f=s(),g=f+x()+Dg(l[0].x)+20,h=g+d,j=f+t()-y(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),Fj.style("top",i+"px").style("left",g+"px"))}function Wd(){Fj.style("display","none")}function Xd(a){var c=a.filter(function(a){return a&&b(a.value)});if(Ii&&!ie(Nf.data.targets)&&!le(Nf.data.targets)){var d=Cj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(wh?"y1":"x1",Id).attr(wh?"y2":"x2",Id),pf(d,"grid")}}function Yd(){Cj.select("line."+g.xgridFocus).style("visibility","hidden")}function Zd(a,b){var c,d,e,f,h=[],i=Cj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=dc(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function $d(a){return a.x||0===a.x?Dg(a.x):null}function _d(a){return $(a.id)(a.value)}function ae(){var a,b,d={},e=0;return Lc(Nf.data.targets.filter(oe)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ee(a,b){return"number"==typeof si?si:b?2*a.tickOffset()*ti/b:0}function fe(a,b){Hc(a).forEach(function(a){Jj[a]=b===Wg[a],Wg[a]=b})}function ge(a,b){var c=!1;return a.forEach(function(a){Wg[a.id]===b&&(c=!0),a.id in Wg||"line"!==b||(c=!0)}),c}function he(a){return ge(a,"bar")}function ie(a){return ge(a,"scatter")}function je(a){return ge(a,"pie")}function ke(a){return ge(a,"donut")}function le(a){return je(a)||ke(a)}function me(a){var b="string"==typeof a?a:a.id;return!(b in Wg)||"line"===Wg[b]||"spline"===Wg[b]||"area"===Wg[b]||"area-spline"===Wg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"spline"===Wg[b]||"area-spline"===Wg[b]}function oe(a){var b="string"==typeof a?a:a.id;return"bar"===Wg[b]}function pe(a){var b="string"==typeof a?a:a.id;return"scatter"===Wg[b]}function qe(a){var b="string"==typeof a?a:a.id;return"pie"===Wg[b]}function re(a){var b="string"==typeof a?a:a.id;return"donut"===Wg[b]}function se(a){return qe(a)||re(a)}function te(a){return me(a)?[a]:[]}function ue(a){return se(a.data)?[a]:[]}function ve(a){return oe(a)?a.values:[]}function we(a){return me(a)||pe(a)?a.values:[]}function xe(a){return oe(a)||me(a)?a.values:[]}function ye(a){return re(a)&&Ci||qe(a)&&wi}function ze(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function Ae(b){var c;try{c=Pg?Mf.time.format(Pg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Pg)}return c}function Be(a,b){var c=Mf.mouse(a),d=Mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ge(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function He(a,b){var c="y"===cb(a.id)?Eg:Fg,d=wh?1:0,e=wh?0:1;return Math.pow(Dg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ie(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Je(a,b,c){return d(a[b])?a[b]:c}function Ke(a){return 10*Math.ceil(a/10)}function Le(a,b,c){jh(b,a.node()),Cj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Xc(g.selectedCircle,c)}).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d).attr("stroke",function(){return cj(b)}).attr("r",1.4*We(b)).transition().duration(100).attr("r",We)}function Me(a,b,c){kh(b,a.node()),Cj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ne(a,b,c,d){a?Le(b,c,d):Me(b,c,d)}function Oe(a,b){jh(b,a.node()),a.transition().duration(100).style("fill",function(){return Mf.rgb(cj(b)).brighter(.75)})}function Pe(a,b){kh(b,a.node()),a.transition().duration(100).style("fill",function(){return cj(b)})}function Qe(a,b,c,d){a?Oe(b,c,d):Pe(b,c,d)}function Re(a,b,c,d){Qe(a,b,c.data,d)}function Se(a){return"circle"===a.nodeName?Ne:Mf.select(a).classed(g.bar)?Qe:Re}function Te(a){return a.filter(function(a){return b(a.value)})}function Ue(a){return li?"function"==typeof mi?mi(a):mi:0}function Ve(a){return oi?pi?pi:1.75*Ue(a):Ue(a)}function We(a){return qi?qi:4*Ue(a)}function Xe(a,c){return(c?Cj.selectAll("."+g.circles+rd(c)):Cj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ye(a,b){Xe(a,b).classed(g.EXPANDED,!0).attr("r",Ve)}function Ze(a){Xe(a).filter(function(){return Mf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Ue)}function $e(a){return Cj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function _e(a){$e(a).classed(g.EXPANDED,!0)}function af(a){$e(a).classed(g.EXPANDED,!1)}function bf(a,b){var c=ff(a,b);return function(a,b){var d=c(a,b),e=wh?1:0,f=wh?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 cf(a,b){var c=ff(a,!1),d=b?df:ef;return function(a,b){return d(c(a,b),a,this)}}function df(a,b){var c;return wh?(c=oe(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function ef(a,b,c){var d=c.getBoundingClientRect();return wh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:oe(b)?-3:-6)}function ff(a,b){var c=a.__max__+1,d=ee(Jg,c),e=be(d,c,a,!!b),f=ce(!!b),g=de(a,!!b),h=b?_:$;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return wh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function gf(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function hf(b){var c,d,e;if(Gj=Mf.select(Pf),Gj.empty())throw new Error("Element to bind not found");if(Gj.html("").classed("c3",!0),Nf.data.xs={},Nf.data.targets=zc(b),bh&&(Nf.data.targets=Nf.data.targets.filter(bh)),ah&&Oc(ah===!0?Gc(Nf.data.targets):ah),p(),V(),Dg.domain(Mf.extent(dc(Nf.data.targets))),Eg.domain(_b(Nf.data.targets,"y")),Fg.domain(_b(Nf.data.targets,"y2")),Gg.domain(Dg.domain()),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Hj=Dg.domain(),vj.scale(Gg),Wf&&zj.scale(Dg),Aj=Gj.append("svg").style("overflow","hidden").on("mouseenter",$f).on("mouseleave",_f),Bj=Aj.append("defs"),Bj.append("clipPath").attr("id",Pi).append("rect"),Bj.append("clipPath").attr("id",Qi).append("rect"),Bj.append("clipPath").attr("id",Ri).append("rect"),uf(),Cj=Aj.append("g").attr("transform",mj.main),Dj=Aj.append("g").attr("transform",mj.context),Ej=Aj.append("g").attr("transform",mj.legend),nh||Dj.style("visibility","hidden"),qh||(Ej.style("visibility","hidden"),gj=Gc(Nf.data.targets)),Fj=Gj.style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Hf(Gc(Nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=Cj.append("g").attr("clip-path",Si).attr("class",g.grid),fi&&d.append("g").attr("class",g.xgrids),Fe(hi)&&d.append("g").attr("class",g.xgridLines),ni&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),ii&&d.append("g").attr("class",g.ygrids),Fe(ji)&&d.append("g").attr("class",g.ygridLines),Cj.append("g").attr("clip-path",Si).attr("class",g.regions),Cj.append("g").attr("clip-path",Si).attr("class",g.chart),c=Cj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Wf?wh?"ns-resize":"ew-resize":null),Cj.select("."+g.chart).append("g").attr("class",g.chartBars),Cj.select("."+g.chart).append("g").attr("class",g.chartLines),Cj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",mj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Vb()),Cj.select("."+g.chart).append("g").attr("class",g.chartTexts),Wf&&Cj.insert("rect",Yf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",gg).attr("height",ig).style("opacity",0).style("cursor",wh?"ns-resize":"ew-resize").call(zj).on("dblclick.zoom",null),Nh&&vj.extent("function"!=typeof Nh?Nh:Nh(dc())),hj.x=Cj.append("g").attr("class",g.axisX).attr("clip-path",Ti).attr("transform",mj.x).style("visibility",xh?"visible":"hidden"),hj.x.append("text").attr("class",g.axisXLabel).attr("transform",wh?"rotate(-90)":"").style("text-anchor",Eb),hj.y=Cj.append("g").attr("class",g.axisY).attr("clip-path",Ui).attr("transform",mj.y).style("visibility",Ph?"visible":"hidden"),hj.y.append("text").attr("class",g.axisYLabel).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Fb),hj.y2=Cj.append("g").attr("class",g.axisY2).attr("transform",mj.y2).style("visibility",Yh?"visible":"hidden"),hj.y2.append("text").attr("class",g.axisY2Label).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Gb),Dj.append("g").attr("clip-path",Si).attr("class",g.chart),Dj.select("."+g.chart).append("g").attr("class",g.chartBars),Dj.select("."+g.chart).append("g").attr("class",g.chartLines),Dj.append("g").attr("clip-path",Si).attr("class",g.brush).call(vj).selectAll("rect").attr(wh?"width":"height",wh?hg:jg),hj.subx=Dj.append("g").attr("class",g.axisX).attr("transform",mj.subx).attr("clip-path",wh?"":Ti),xf(Nf.data.targets),qf({withUpdateTranslate:!0,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Mi){if(Vi&&"string"==typeof Ni){for(Ni=Ae(Ni),e=0;e0){d=[];for(var f in Rg)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Rd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Qe,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function nf(a){le(Nf.data.targets)||ch&&(Yi=a,Cj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Zi=!0,lh())}function of(){le(Nf.data.targets)||ch&&(Cj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),Cj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Zi=!1,mh())}function pf(a,b){"grid"===b&&a.each(function(){var a=Mf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function qf(a,c){var d,e,f,h,i,j,k,l,m,n,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,Q,R,S,T,U,W,X,Y,Z,$=ae(),_=le(Nf.data.targets),ab=Lc(Nf.data.targets);if(a=a||{},E=Je(a,"withY",!0),F=Je(a,"withSubchart",!0),G=Je(a,"withTransition",!0),J=Je(a,"withTransform",!1),K=Je(a,"withUpdateXDomain",!1),L=Je(a,"withUpdateOrgXDomain",!1),N=Je(a,"withUpdateTranslate",!1),M=Je(a,"withLegend",!1),H=Je(a,"withTransitionForExit",G),I=Je(a,"withTransitionForAxis",G),T=G?cg:0,U=H?T:0,W=I?T:0,c=c||vf(W),N&&(wh?(hj.x.call(Jg),hj.subx.call(Mg)):(hj.y.call(Kg),hj.y2.call(Lg)),p(),V(),uf(),o(!1)),M&&qh&&Hf(Gc(Nf.data.targets),a,c),Wi&&0===ab.length&&Dg.domain([0,hj.x.selectAll(".tick").size()]),ab.length&&(L&&(Dg.domain(Mf.extent(dc(ab))),Hj=Dg.domain(),Wf&&zj.scale(Dg).updateScaleExtent(),Gg.domain(Dg.domain()),vj.scale(Gg)),K&&(Dg.domain(vj.empty()?Hj:vj.extent()),Wf&&zj.scale(Dg).updateScaleExtent()),Hh||!Gh&&!Fh||(X=Nc(Mc(ab),Fh),Jg.tickValues(X),Mg.tickValues(X))),Eg.domain(_b(ab,"y")),Fg.domain(_b(ab,"y2")),hj.x.style("opacity",_?0:1),hj.y.style("opacity",_?0:1),hj.y2.style("opacity",_?0:1),hj.subx.style("opacity",_?0:1),c.axisX.call(Jg),c.axisY.call(Kg),c.axisY2.call(Lg),c.axisSubX.call(Mg),Ib(G),K&&ab.length)if(Dh&&X){for(Y=1;Y=0&&Mf.select(this).style("display",b%Z?"none":"block")})}else Aj.selectAll("."+g.axisX+" .tick text").style("display","block");!wh&&Ih&&jb(hj.x,c.axisX,Ih),O=bf($),R=cf($,!0),S=cf($,!1),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Fj.style("display","none"),q(),Cj.select("line."+g.xgridFocus).style("visibility","hidden"),fi&&(f=Zd(gi,Dg),B=Wi?Jg.tickOffset():0,e=wh?{x1:0,x2:gg,y1:function(a){return Dg(a)-B},y2:function(a){return Dg(a)-B}}:{x1:function(a){return Dg(a)+B},x2:function(a){return Dg(a)+B},y1:dg.top,y2:ig},d=Cj.select("."+g.xgrids).selectAll("."+g.xgrid).data(f),d.enter().append("line").attr("class",g.xgrid),d.attr(e).style("opacity",function(){return+Mf.select(this).attr(wh?"y1":"x1")===(wh?ig:0)?0:1}),d.exit().remove()),Fe(hi)&&(h=Cj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(hi),i=h.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),i.append("line").style("opacity",0),i.append("text").attr("text-anchor","end").attr("transform",wh?"":"rotate(-90)").attr("dx",wh?0:-dg.top).attr("dy",-5).style("opacity",0),h.select("line").transition().duration(T).attr("x1",wh?0:Jd).attr("x2",wh?gg:Jd).attr("y1",wh?Jd:dg.top).attr("y2",wh?Jd:ig).style("opacity",1),h.select("text").transition().duration(T).attr("x",wh?gg:0).attr("y",Jd).text(function(a){return a.text}).style("opacity",1),h.exit().transition().duration(T).style("opacity",0).remove()),E&&ii&&(j=Cj.select("."+g.ygrids).selectAll("."+g.ygrid).data(Eg.ticks(ki)),j.enter().append("line").attr("class",g.ygrid),j.attr("x1",wh?Eg:0).attr("x2",wh?Eg:gg).attr("y1",wh?0:Eg).attr("y2",wh?ig:Eg),j.exit().remove(),pf(j,"grid")),E&&Fe(ji)&&(k=Cj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(ji),l=k.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",wh?"rotate(-90)":"").attr("dx",wh?0:-dg.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",wh?Kd:0).attr("x2",wh?Kd:gg).attr("y1",wh?0:Kd).attr("y2",wh?ig:Kd).style("opacity",1),k.select("text").transition().duration(T).attr("x",wh?0:gg).attr("y",Kd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),u=Cj.select("."+g.regions).selectAll("."+g.region).data(Hi),u.enter().append("g").attr("class",kd).append("rect").style("fill-opacity",0),u.selectAll("rect").transition().duration(T).attr("x",ic).attr("y",jc).attr("width",kc).attr("height",lc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),u.exit().transition().duration(T).style("opacity",0).remove(),s=Cj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),s.enter().append("path").attr("class",ed).style("stroke","none").style("fill",cj),s.style("opacity",wd).transition().duration(T).attr("d",O).style("fill",cj).style("opacity",1),s.exit().transition().duration(U).style("opacity",0).remove(),m=Cj.selectAll("."+g.lines).selectAll("."+g.line).data(te),m.enter().append("path").attr("class",ad).style("stroke",cj),m.style("opacity",wd).transition().duration(T).attr("d",wj).style("stroke",cj).style("opacity",1),m.exit().transition().duration(U).style("opacity",0).remove(),n=Cj.selectAll("."+g.areas).selectAll("."+g.area).data(te),n.enter().append("path").attr("class",id).style("fill",cj).style("opacity",function(){return Ij=+Mf.select(this).style("opacity"),0}),n.style("opacity",0).transition().duration(T).attr("d",xj).style("fill",cj).style("opacity",Ij),n.exit().transition().duration(U).style("opacity",0).remove(),r=Cj.selectAll("."+g.circles).selectAll("."+g.circle).data(we),r.enter().append("circle").attr("class",cd).attr("r",Ue).style("fill",cj),r.style("opacity",wd).transition().duration(T).style("opacity",yd).style("fill",cj).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d),r.exit().remove(),v=Cj.selectAll("."+g.texts).selectAll("."+g.text).data(xe),v.enter().append("text").attr("class",Yc).attr("text-anchor",function(a){return wh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",cj).style("fill-opacity",0),v.text(function(a){return Hd(a.id)(a.value,a.id)}).style("fill-opacity",xd).transition().duration(T).attr("x",R).attr("y",S).style("fill",cj).style("fill-opacity",zd),v.exit().transition().duration(U).style("fill-opacity",0).remove(),t=Cj.selectAll("."+g.arcs).selectAll("."+g.arc).data(ue),t.enter().append("path").attr("class",gd).style("fill",function(a){return cj(a.data)}).style("cursor",function(a){return eh(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;aj||(c=Jb(a),d=Pb(c),e=Xb(),Rb(c.data.id),Df(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Jb(a),c=Pb(b),d=[c];Vd(d,Mf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;aj||(c=Jb(a),d=Pb(c),e=Yb(),Sb(c.data.id),Ef(),Wd(),e(d,b))}).on("click",function(a,b){var c=Jb(a),d=Pb(c),e=Wb();lf(this,a,b),e(d,b)}),t.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){aj=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Jb(a);return c?(b=Mf.interpolate(this._current,c),this._current=b(0),function(a){return Mb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("fill",function(a){return cj(a.data)}).style("opacity",1).call(Ie,function(){aj=!1}),t.exit().transition().duration(U).style("opacity",0).remove(),Cj.selectAll("."+g.chartArc).select("text").attr("transform",Nb).style("opacity",0).transition().duration(T).text(Qb).style("opacity",function(a){return Jc(a.data.id)&&se(a.data)?1:0}),Cj.select("."+g.chartArcsTitle).style("opacity",ke(Nf.data.targets)?1:0),nh&&(Mf.event&&"zoom"===Mf.event.type&&vj.extent(Dg.orgDomain()).update(),F&&(!wh&&Ih&&jb(hj.subx,c.axisSubX,Ih),vj.empty()||vj.extent(Dg.orgDomain()).update(),Q=bf($,!0),x=Dj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),x.enter().append("path").attr("class",ed).style("stroke","none").style("fill",cj),x.style("opacity",wd).transition().duration(T).attr("d",Q).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove(),w=Dj.selectAll("."+g.lines).selectAll("."+g.line).data(te),w.enter().append("path").attr("class",ad).style("stroke",cj),w.style("opacity",wd).transition().duration(T).attr("d",yj).style("opacity",1),w.exit().transition().duration(T).style("opacity",0).remove())),Cj.selectAll("."+g.selectedCircles).filter(function(a){return oe(a)}).selectAll("circle").remove(),Cj.selectAll("."+g.selectedCircle).transition().duration(T).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d),Zf&&(y=Cj.select("."+g.eventRects),Fe(Og)&&!sc(Og)?(y.classed(g.eventRectsMultiple)||y.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),z=Cj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),kf(z.enter()),z.attr("x",0).attr("y",0).attr("width",gg).attr("height",ig)):(y.classed(g.eventRectsSingle)||y.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Xi&&!Wi?(D=function(a,b){var c=Bc(b),d=Cc(b),e=Nf.data.xs[a.id][b];return(Dg(d?d:e+50)-Dg(c?c:e-50))/2},C=function(a,b){var c=Bc(b),d=Nf.data.xs[a.id][b];return(Dg(d)+Dg(c?c:d-50))/2}):(D=P(),C=function(a){return Dg(a.x)-D/2}),A=Ec(Nf.data.targets),Cj.select("."+g.eventRects).datum(A?A.values:[]),z=Cj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),jf(z.enter()),z.attr("class",ld).attr("x",wh?0:C).attr("y",wh?C:0).attr("width",wh?gg:D).attr("height",wh?D:ig),z.exit().remove())),Gc(Nf.data.targets).forEach(function(a){Jj[a]=!0})}function rf(){qf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function sf(){if(0!==Lc(Nf.data.targets).length){if("mousemove"===Mf.event.sourceEvent.type&&zj.altDomain)return Dg.domain(zj.altDomain),void zj.scale(Dg).updateScaleExtent();Wi&&Dg.orgDomain()[0]===Hj[0]&&Dg.domain([Hj[0]-1e-10,Dg.orgDomain()[1]]),qf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Mf.event.sourceEvent.type&&($i=!0)}}function tf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function uf(){Aj.attr("width",kg).attr("height",lg),Aj.select("#"+Pi).select("rect").attr("width",gg).attr("height",ig),Aj.select("#"+Qi).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),Aj.select("#"+Ri).select("rect").attr("x",H).attr("y",I).attr("width",N).attr("height",O),Aj.select("."+g.zoomRect).attr("width",gg).attr("height",ig),Gj.style("max-height",lg+"px")}function vf(a){return{axisX:a?hj.x.transition().duration(a):hj.x,axisY:a?hj.y.transition().duration(a):hj.y,axisY2:a?hj.y2.transition().duration(a):hj.y2,axisSubX:a?hj.subx.transition().duration(a):hj.subx}}function wf(a){var b;a=a||{},a.withTransition=Je(a,"withTransition",!0),a.withTransform=Je(a,"withTransform",!1),a.withLegend=Je(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withLegend&&qh||(b=vf(a.withTransitionForAxis?cg:0),p(),V(),uf(),o(a.withTransition,b)),qf(a,b)}function xf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=Cj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",nd),j=i.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Zc),e=Cj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),d=e.enter().append("g").attr("class",pd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",fd).style("cursor",function(a){return eh(a)?"pointer":null}),c=Cj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),b=c.enter().append("g").attr("class",od).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",bd),b.append("g").attr("class",jd),b.append("g").attr("class",function(a){return Xc(g.selectedCircles,a.id)}),b.append("g").attr("class",dd).style("cursor",function(a){return eh(a)?"pointer":null}),a.forEach(function(a){Cj.selectAll("."+g.selectedCircles+rd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Cj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(ug(a)).attr("class",qd),f=h.enter().append("g").attr("class",qd),f.append("g").attr("class",hd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),nh&&(n=Dj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),m=n.enter().append("g").style("opacity",0).attr("class",pd),m.append("g").attr("class",fd),l=Dj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),k=l.enter().append("g").style("opacity",0).attr("class",od),k.append("g").attr("class",bd)),Aj.selectAll("."+g.target).filter(function(a){return Jc(a.id)}).transition().duration(cg).style("opacity",1)}function yf(a,b){b.filter&&(a=a.filter(b.filter)),(b.type||b.types)&&a.forEach(function(a){b.types?fe(a.id,b.types[a.id]):fe(a.id,b.type)}),Nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,z=0,F++)),E[a]=F,D[F]=f,A[a]=z,z+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+v)/10),j=10*Math.ceil((h.height+u)/10),k=nj?j:i,l=nj?U():T();return d&&(z=0,F=0,w=0,x=0),qh&&!Kc(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=i,C[c]=j,(!w||i>=w)&&(w=i),(!x||j>=x)&&(x=j),g=nj?x:w,void(vh?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(l-g*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=26,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=Ej.selectAll("."+g.legendItemFocused).size();b=b||{},n=Je(b,"withTransition",!0),q=Je(b,"withTransitionForTransform",!0),nj?(f=function(a){return w*E[a]},j=function(a){return D[E[a]]+A[a]}):(f=function(a){return D[E[a]]+A[a]},j=function(a){return x*E[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=Ej.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Xc(g.legendItem,a)}).style("visibility",function(a){return Kc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof sh?sh(a):Nf.toggle(a)}).on("mouseover",function(a){Mf.select(this).classed(g.legendItemFocused,!0),aj||Nf.focus(a),"function"==typeof th&&th(a)}).on("mouseout",function(a){Mf.select(this).classed(g.legendItemFocused,!1),aj||Nf.revert(),"function"==typeof uh&&uh(a)}),m.append("text").text(function(a){return d(Rg[a])?Rg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",nj?h:-200).attr("y",nj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",nj?i:-200).attr("y",nj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",cj).attr("x",nj?h:-200).attr("y",nj?-200:j).attr("width",10).attr("height",10),r=Ej.selectAll("text").data(a).text(function(a){return d(Rg[a])?Rg[a]:a}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=Ej.selectAll("rect."+g.legendItemEvent).data(a),(n?s.transition():s).attr("width",function(a){return B[a]}).attr("height",function(a){return C[a]}).attr("x",i).attr("y",l),t=Ej.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",cj).attr("x",f).attr("y",j),Ej.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Jc(a)}).transition().style("opacity",function(a){var b=Mf.select(this);return Jc(a)?!G||b.classed(g.legendItemFocused)?Bf(b):Cf(b):rj}),R(w),S(x),Q(F),p(),V(),uf(),o(q,c)}function If(a){return Ic(Nf.data.targets,a.id)}function Jf(a){return"data"in a&&Ic(Nf.data.targets,a.data.id)}function Kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function Lf(a,b,c){var d=!le(Nf.data.targets);aj=!1,fe(a,b),wf(c||{withTransitionForAxis:d})}var Mf=a.d3?a.d3:a.require?a.require("d3"):void 0,Nf={data:{},axis:{},legend:{}},Of={},Pf=i(["bindto"],"#chart"),Qf=i(["size","width"]),Rf=i(["size","height"]),Sf=i(["padding","left"]),Tf=i(["padding","right"]),Uf=i(["padding","top"]),Vf=i(["padding","bottom"]),Wf=i(["zoom","enabled"],!1),Xf=i(["zoom","extent"]),Yf=i(["zoom","privileged"],!1),Zf=i(["interaction","enabled"],!0),$f=i(["onenter"],function(){}),_f=i(["onleave"],function(){}),ag=i(["onresize"],function(){}),bg=i(["onresized"],function(){}),cg=i(["transition","duration"],350);h("data","data is required in config");var dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg,Kg,Lg,Mg,Ng=i(["data","x"]),Og=i(["data","xs"],{}),Pg=i(["data","x_format"]),Qg=i(["data","id_converter"],function(a){return a}),Rg=i(["data","names"],{}),Sg=i(["data","classes"],{}),Tg=i(["data","groups"],[]),Ug=i(["data","axes"],{}),Vg=i(["data","type"]),Wg=i(["data","types"],{}),Xg=i(["data","labels"],{}),Yg=i(["data","order"]),Zg=i(["data","regions"],{}),$g=i(["data","color"]),_g=i(["data","colors"],{}),ah=i(["data","hide"],!1),bh=i(["data","filter"]),ch=i(["data","selection","enabled"],!1),dh=i(["data","selection","grouped"],!1),eh=i(["data","selection","isselectable"],function(){return!0}),fh=i(["data","selection","multiple"],!0),gh=i(["data","onclick"],function(){}),hh=i(["data","onenter"],function(){}),ih=i(["data","onleave"],function(){}),jh=i(["data","onselected"],function(){}),kh=i(["data","onunselected"],function(){}),lh=i(["data","ondragstart"],function(){}),mh=i(["data","ondragend"],function(){}),nh=i(["subchart","show"],!1),oh=i(["subchart","size","height"],60),ph=i(["color","pattern"],[]),qh=i(["legend","show"],!0),rh=i(["legend","position"],"bottom"),sh=i(["legend","item","onclick"]),th=i(["legend","item","onmouseover"]),uh=i(["legend","item","onmouseout"]),vh=i(["legend","equally"],!1),wh=i(["axis","rotated"],!1),xh=i(["axis","x","show"],!0),yh=i(["axis","x","type"],"indexed"),zh=i(["axis","x","localtime"],!0),Ah=i(["axis","x","categories"],[]),Bh=i(["axis","x","tick","centered"],!1),Ch=i(["axis","x","tick","format"]),Dh=i(["axis","x","tick","culling"],{}),Eh=i(["axis","x","tick","culling","max"],10),Fh=i(["axis","x","tick","count"]),Gh=i(["axis","x","tick","fit"],!0),Hh=i(["axis","x","tick","values"],null),Ih=i(["axis","x","tick","rotate"]),Jh=i(["axis","x","max"],null),Kh=i(["axis","x","min"],null),Lh=i(["axis","x","padding"],{}),Mh=i(["axis","x","height"]),Nh=i(["axis","x","default"]),Oh=i(["axis","x","label"],{}),Ph=i(["axis","y","show"],!0),Qh=i(["axis","y","max"]),Rh=i(["axis","y","min"]),Sh=i(["axis","y","center"]),Th=i(["axis","y","label"],{}),Uh=i(["axis","y","inner"],!1),Vh=i(["axis","y","tick","format"]),Wh=i(["axis","y","padding"]),Xh=i(["axis","y","ticks"],10),Yh=i(["axis","y2","show"],!1),Zh=i(["axis","y2","max"]),$h=i(["axis","y2","min"]),_h=i(["axis","y2","center"]),ai=i(["axis","y2","label"],{}),bi=i(["axis","y2","inner"],!1),ci=i(["axis","y2","tick","format"]),di=i(["axis","y2","padding"]),ei=i(["axis","y2","ticks"],10),fi=i(["grid","x","show"],!1),gi=i(["grid","x","type"],"tick"),hi=i(["grid","x","lines"],[]),ii=i(["grid","y","show"],!1),ji=i(["grid","y","lines"],[]),ki=i(["grid","y","ticks"],10),li=i(["point","show"],!0),mi=i(["point","r"],2.5),ni=i(["point","focus","line","enabled"],!0),oi=i(["point","focus","expand","enabled"],!0),pi=i(["point","focus","expand","r"]),qi=i(["point","focus","select","r"]),ri=i(["line","connect_null"],!1),si=i(["bar","width"]),ti=i(["bar","width","ratio"],.6),ui=i(["pie","label","show"],!0),vi=i(["pie","label","format"]),wi=i(["pie","expand"],!0),xi=i(["pie","onclick"],function(){}),yi=i(["pie","onmouseover"],function(){}),zi=i(["pie","onmouseout"],function(){}),Ai=i(["donut","label","show"],!0),Bi=i(["donut","label","format"]),Ci=i(["donut","expand"],!0),Di=i(["donut","title"],""),Ei=i(["donut","onclick"],function(){}),Fi=i(["donut","onmouseover"],function(){}),Gi=i(["donut","onmouseout"],function(){}),Hi=i(["regions"],[]),Ii=i(["tooltip","show"],!0),Ji=i(["tooltip","format","title"]),Ki=i(["tooltip","format","value"]),Li=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Ji?Ji:b,l=Ki?Ki:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Mi=i(["tooltip","init","show"],!1),Ni=i(["tooltip","init","x"],0),Oi=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Pi=("string"==typeof Pf?Pf.replace(/[# .>~+]/g,""):g.chart+ +new Date)+"-clip",Qi=Pi+"-xaxis",Ri=Pi+"-yaxis",Si=j(Pi),Ti=j(Qi),Ui=j(Ri),Vi="timeseries"===yh,Wi="categorized"===yh,Xi=!Vi&&(Ng||Fe(Og)),Yi=null,Zi=!1,$i=!1,_i=!1,aj=!1,bj=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],cj=ze(_g,Fe(ph)?ph:bj,$g),dj=zh?Mf.time.format:Mf.time.format.utc,ej=dj.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),fj=[],gj=[],hj={},ij=wh?"left":"bottom",jj=wh?Uh?"top":"bottom":Uh?"right":"left",kj=wh?bi?"bottom":"top":bi?"left":"right",lj=wh?"left":"bottom",mj={main:function(){return"translate("+k(dg.left)+","+k(dg.top)+")"},context:function(){return"translate("+k(eg.left)+","+k(eg.top)+")"},legend:function(){return"translate("+fg.left+","+fg.top+")" +},x:function(){return"translate(0,"+(wh?0:ig)+")"},y:function(){return"translate(0,"+(wh?ig:0)+")"},y2:function(){return"translate("+(wh?0:gg)+","+(wh?1:0)+")"},subx:function(){return"translate(0,"+(wh?0:jg)+")"},arc:function(){return"translate("+pg/2+","+qg/2+")"}},nj="right"===rh,oj=0,pj=0,qj=0,rj=.15,sj=30,tj=wh&&!xh?0:30,uj=5;ug=Mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var vj,wj=function(){var a=Mf.svg.line().x(wh?function(a){return $(a.id)(a.value)}:Id).y(wh?Id:function(a){return $(a.id)(a.value)});return ri||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ri?Te(b.values):b.values;return me(b)?(a.interpolate(ne(b)?"cardinal":"linear"),Zg[b.id]?gf(e,Dg,$(b.id),Zg[b.id]):a(e)):(c=e[0]?Dg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,wh?"M "+d+" "+c:"M "+c+" "+d)}}(),xj=function(){var a;return a=wh?Mf.svg.area().x0(function(a){return $(a.id)(0)}).x1(function(a){return $(a.id)(a.value)}).y(Id):Mf.svg.area().x(Id).y0(function(a){return $(a.id)(0)}).y1(function(a){return $(a.id)(a.value)}),function(b){var c,d,e=Te(b.values);return ge([b],"area")||ge([b],"area-spline")?(a.interpolate(ne(b)?"cardinal":"linear"),a(e)):(c=e[0]?Dg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,wh?"M "+d+" "+c:"M "+c+" "+d)}}(),yj=function(){var a=Mf.svg.line().x(wh?function(a){return _(a.id)(a.value)}:Ld).y(wh?Ld:function(a){return _(a.id)(a.value)});return function(b){var c=Te(b.values);return me(b)?a(c):"M "+Gg(c[0].x)+" "+_(b.id)(c[0].value)}}(),zj=function(){};vj=Mf.svg.brush().on("brush",rf),vj.update=function(){return Dj&&Dj.select("."+g.brush).call(this),this},vj.scale=function(a){return wh?this.y(a):this.x(a)},Wf&&(zj=Mf.behavior.zoom().on("zoomstart",function(){zj.altDomain=Mf.event.sourceEvent.altKey?Dg.orgDomain():null}).on("zoom",Wf?sf:null),zj.scale=function(a){return wh?this.y(a):this.x(a)},zj.orgScaleExtent=function(){var a=Xf?Xf:[1,10];return[a[0],Math.max(Dc()/a[1],a[1])]},zj.updateScaleExtent=function(){var a=ec(Dg.orgDomain())/ec(Hj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Aj,Bj,Cj,Dj,Ej,Fj,Gj,Hj,Ij,Jj={};if(Nf.focus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);Nf.revert(),Nf.defocus(),b(d.classed(g.focused,!0)),b(e),le(Nf.data.targets)&&Rb(a,!0),Df(a,!0)},Nf.defocus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",.3)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);Nf.revert(),b(d.classed(g.focused,!1)),b(e),le(Nf.data.targets)&&Sb(a),Df(a,!1)},Nf.revert=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);b(d.classed(g.focused,!1)),b(e),le(Nf.data.targets)&&Sb(a),Ef()},Nf.show=function(a,b){a=Hc(a),b=b||{},Pc(a),Aj.selectAll(td(a)).transition().style("opacity",1),b.withLegend&&Ff(a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Nf.hide=function(a,b){a=Hc(a),b=b||{},Oc(a),Aj.selectAll(td(a)).transition().style("opacity",0),b.withLegend&&Gf(a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Nf.toggle=function(a){Jc(a)?Nf.hide(a):Nf.show(a)},Nf.unzoom=function(){vj.clear().update(),qf({withUpdateXDomain:!0})},Nf.load=function(a){return a.xs&&rc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Sg[b]=a.classes[b]}),"categories"in a&&Wi&&(Ah=a.categories,Jg.categories(Ah)),"cacheIds"in a&&fc(a.cacheIds)?void yf(hc(a.cacheIds),a.done):void("unload"in a?Af(Hc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){zf(a)}):zf(a))},Nf.unload=function(a,b){Af(Hc(a),function(){qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Nf.selected=function(a){return Mf.merge(Cj.selectAll("."+g.shapes+rd(a)).selectAll("."+g.shape).filter(function(){return Mf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Nf.select=function(a,b,c){ch&&Cj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Mf.select(this),i=e.data?e.data.id:e.id,j=Se(this),k=dh||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);"path"!==this.nodeName&&(k&&l?eh(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},Nf.unselect=function(a,b){ch&&Cj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Mf.select(this),f=c.data?c.data.id:c.id,h=Se(this),i=dh||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);"path"!==this.nodeName&&i&&j&&eh(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Nf.toLine=function(a){Lf(a,"line")},Nf.toSpline=function(a){Lf(a,"spline")},Nf.toBar=function(a){Lf(a,"bar")},Nf.toScatter=function(a){Lf(a,"scatter")},Nf.toArea=function(a){Lf(a,"area")},Nf.toAreaSpline=function(a){Lf(a,"area-spline")},Nf.toPie=function(a){Lf(a,"pie",{withTransform:!0})},Nf.toDonut=function(a){Lf(a,"donut",{withTransform:!0})},Nf.groups=function(a){return c(a)?Tg:(Tg=a,qf(),Tg)},Nf.xgrids=function(a){return a?(hi=a,qf(),hi):hi},Nf.xgrids.add=function(a){return a?Nf.xgrids(hi.concat(a)):void 0},Nf.xgrids.remove=function(a){var b=Kf(a);return Nf.xgrids(hi.filter(b))},Nf.ygrids=function(a){return a?(ji=a,qf(),ji):ji},Nf.ygrids.add=function(a){return a?Nf.ygrids(ji.concat(a)):void 0},Nf.ygrids.remove=function(a){var b=Kf(a);return Nf.ygrids(ji.filter(b))},Nf.regions=function(a){return a?(Hi=a,qf(),Hi):Hi},Nf.regions.add=function(a){return a?(Hi=Hi.concat(a),qf(),Hi):Hi},Nf.regions.remove=function(a){var b,c,d;return a=a||{},b=Je(a,"duration",cg),c=Je(a,"classes",[g.region]),d=Cj.select("."+g.regions).selectAll(c.map(function(a){return"."+a})),(b?d.transition().duration(b):d).style("opacity",0).remove(),Hi=Hi.filter(function(a){return c.indexOf(a.class)<0})},Nf.data.get=function(a){var b=Nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Nf.data.getAsTarget=function(a){var b=Nf.data.targets.filter(function(b){return b.id===a});return b.length>0?b[0]:void 0},Nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Rg[b]=a[b]}),qf({withLegend:!0}),Rg):Rg},Nf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){_g[b]=a[b]}),qf({withLegend:!0}),_g):_g},Nf.x=function(a){return arguments.length&&(uc(Nf.data.targets,a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Nf.data.xs},Nf.xs=function(a){return arguments.length&&(vc(Nf.data.targets,a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Nf.data.xs},Nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){gb(b,a[b])}),Ib())},Nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Jh=+a.x),b(a.y)&&(Qh=+a.y),b(a.y2)&&(Zh=+a.y2)):Qh=Zh=+a,qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Kh=+a.x),b(a.y)&&(Rh=+a.y),b(a.y2)&&($h=+a.y2)):Rh=$h=+a,qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Nf.axis.max(a.max),"undefined"!=typeof a.min&&Nf.axis.min(a.min))},Nf.legend.show=function(a){Ff(Hc(a)),qf({withLegend:!0})},Nf.legend.hide=function(a){Gf(Hc(a)),qf({withLegend:!0})},Nf.resize=function(a){Qf=a?a.width:null,Rf=a?a.height:null,wf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Nf.destroy=function(){Nf.data.targets=void 0,Nf.data.xs={},Gj.html(""),a.onresize=null},"url"in f.data)Mf.xhr(f.data.url,function(a,b){var c,d=Mf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Mf.csv.parse(b.response),hf(c)});else if("rows"in f.data)hf(xc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");hf(yc(f.data.columns))}return Nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(window); \ No newline at end of file From 102c9ab1d721418ecb9fc3afe4b17a31c156c19d Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Sat, 10 May 2014 22:34:15 +0900 Subject: [PATCH 166/178] Fix select/unselect API for path --- c3.js | 10 ++++++++-- c3.min.js | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/c3.js b/c3.js index e3d0681..8b0f5fe 100644 --- a/c3.js +++ b/c3.js @@ -4257,7 +4257,10 @@ isTargetId = __data_selection_grouped || !ids || ids.indexOf(id) >= 0, isTargetIndex = !indices || indices.indexOf(i) >= 0, isSelected = shape.classed(CLASS.SELECTED); - if (this.nodeName === 'path') { return; } // path selection not supported yet + // line/area selection not supported yet + if (shape.classed(CLASS.line) || shape.classed(CLASS.area)) { + return; + } if (isTargetId && isTargetIndex) { if (__data_selection_isselectable(d) && !isSelected) { toggle(true, shape.classed(CLASS.SELECTED, true), d, i); @@ -4277,7 +4280,10 @@ isTargetId = __data_selection_grouped || !ids || ids.indexOf(id) >= 0, isTargetIndex = !indices || indices.indexOf(i) >= 0, isSelected = shape.classed(CLASS.SELECTED); - if (this.nodeName === 'path') { return; } // path selection not supported yet + // line/area selection not supported yet + if (shape.classed(CLASS.line) || shape.classed(CLASS.area)) { + return; + } if (isTargetId && isTargetIndex) { if (__data_selection_isselectable(d)) { if (isSelected) { diff --git a/c3.min.js b/c3.min.js index 5b358eb..ba6351b 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ !function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.round(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.round(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&a=0;return"url("+(c?"":document.URL.split("#")[0])+"#"+b+")"}function k(a){return Math.ceil(a)+.5}function l(a,b){var c,d,e;b&&b.axisX?c=b.axisX:(c=Cj.select("."+g.axisX),a&&(c=c.transition())),b&&b.axisY?d=b.axisY:(d=Cj.select("."+g.axisY),a&&(d=d.transition())),b&&b.axisY2?e=b.axisY2:(e=Cj.select("."+g.axisY2),a&&(e=e.transition())),Cj.attr("transform",mj.main),c.attr("transform",mj.x),d.attr("transform",mj.y),e.attr("transform",mj.y2),Cj.select("."+g.chartArcs).attr("transform",mj.arc)}function m(a,b){var c;b&&b.axisSubX?c=b.axisSubX:(c=Dj.select("."+g.axisX),a&&(c=c.transition())),Dj.attr("transform",mj.context),c.attr("transform",mj.subx)}function n(a){(a?Ej.transition():Ej).attr("transform",mj.legend)}function o(a,b){l(a,b),nh&&m(a,b),n(a)}function p(){var a=U(),b=T(),c=nj?0:a,d=le(Nf.data.targets),e=wh||d?0:A("x"),f=nh&&!d?oh+e:0;kg=t(),lg=u(),wh?(dg={top:A("y2")+v(),right:d?0:y(),bottom:A("y")+c+w(),left:f+(d?0:x())},eg={top:dg.top,right:0/0,bottom:20+c,left:sj}):(dg={top:4+v(),right:d?0:y(),bottom:e+f+c+w(),left:d?0:x()},eg={top:lg-f-c,right:0/0,bottom:e+c,left:dg.left}),fg={top:nj?0:lg-a,right:0/0,bottom:0,left:nj?kg-b:0},gg=kg-dg.left-dg.right,ig=lg-dg.top-dg.bottom,0>gg&&(gg=0),0>ig&&(ig=0),hg=wh?dg.left-sj-tj:gg,jg=wh?ig:lg-eg.top-eg.bottom,0>hg&&(hg=0),0>jg&&(jg=0),pg=gg-(nj?b+10:0),qg=ig-(nj?0:10),r(),nj&&d&&(fg.left=pg/2+1.1*ng)}function q(){Cj.select("line."+g.xgridFocus).attr("x1",wh?0:-10).attr("x2",wh?gg:-10).attr("y1",wh?-10:dg.top).attr("y2",wh?-10:ig)}function r(){ng=Math.min(pg,qg)/2,mg=.95*ng,og=ke(Nf.data.targets)?.6*mg:0}function s(){var a=wh?g.axisX:g.axisY,b=Cj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Gj.node().getBoundingClientRect(),e=le(Nf.data.targets),f=c.right-d.left-(e?0:x());return f>0?f:0}function t(){return Qf?Qf:B()}function u(){var a=Rf?Rf:C();return a>0?a:320}function v(){return Uf?Uf:0}function w(){return Vf?Vf:0}function x(){return Sf?Sf:wh?xh?Ke(z("x")):1:!Ph||Uh?1:Ke(z("y"))}function y(){var a=10,b=nj?T()+20:0;return Tf?Tf:wh?a+b:(!Yh||bi?a:Ke(z("y2")))+b}function z(a){var b=ob(a);return b.isInner?20+Hb(a):40+Hb(a)}function A(a){return"x"!==a||xh?"x"===a&&Mh?Mh:"y"!==a||Ph?"y2"!==a||Yh?(ob(a).isInner?30:40)+("y2"===a?-10:0):uj:qh&&!nj?10:1:0}function B(){return+Gj.style("width").replace("px","")}function C(){return+Gj.style("height").replace("px","")}function D(a){return a?-31:-(dg.left-1)}function E(a){return a?-20:-4}function F(){return D(!wh)}function G(){return E(!wh)}function H(){return D(wh)}function I(){return E(wh)}function J(a){return a?gg+2+30+30:dg.left+20}function K(a){return a?(Mh?Mh:0)+80:ig+8}function L(){return J(!wh)}function M(){return K(!wh)}function N(){return J(wh)}function O(){return K(wh)}function P(){var a,b,c,d,e,f=Ec(Nf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=Dg(b.x)-Dg(a.x),0===c?wh?ig:gg:(d=Dc(),e=he(Nf.data.targets)?(d-(Wi?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function Q(a){oj=a}function R(a){pj=a}function S(a){qj=a}function T(){return qh?nj?pj*(oj+1):kg:0}function U(){return qh?nj?lg:qj*(oj+1):0}function V(){var a,b,c=!Dg;vg=wh?1:0,wg=wh?ig:gg,xg=wh?0:ig,yg=wh?gg:1,zg=vg,Ag=wg,Bg=wh?0:jg,Cg=wh?hg:1,Dg=Y(vg,wg,c?void 0:Dg.domain(),function(){return Jg.tickOffset()}),Eg=Z(xg,yg,c?void 0:Eg.domain()),Fg=Z(xg,yg,c?void 0:Fg.domain()),Gg=Y(vg,wg,Hj,function(a){return a%1?0:Mg.tickOffset()}),Hg=Z(Bg,Cg,c?void 0:Hg.domain()),Ig=Z(Bg,Cg,c?void 0:Ig.domain()),a=db(),b=Hh?Hh:c?void 0:Jg.tickValues(),Jg=ab(Dg,ij,a,b),Mg=ab(Gg,lj,a,b),Kg=bb(Eg,jj,Vh,Xh),Lg=bb(Fg,kj,ci,ei),c||(vj.scale(Gg),Wf&&zj.scale(Dg)),W()}function W(){rg=Kb(),sg=Lb(),tg=Lb(.98)}function X(a,b,c){return(c?Mf.time.scale():Mf.scale.linear()).range([a,b])}function Y(a,b,c,d){var e,f=X(a,b,Vi),g=c?f.domain(c):f;Wi?(d=d||function(){return 0},f=function(a,b){var c=g(a)+d(a);return b?c:Math.ceil(c)}):f=function(a,b){var c=g(a);return b?c:Math.ceil(c)};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return Hj&&Hj[0]===a[0]&&Hj[1]a?a.toFixed(0):a};return Ch&&("function"==typeof Ch?a=Ch:Vi&&(a=function(a){return a?dj(Ch)(a):""})),a}function eb(a){var b;return"y"===a?b=Th:"y2"===a?b=ai:"x"===a&&(b=Oh),b}function fb(a){var b=eb(a);return"string"==typeof b?b:b?b.text:null}function gb(a,b){var c=eb(a);"string"==typeof c?"y"===a?Th=b:"y2"===a?ai=b:"x"===a&&(Oh=b):c&&(c.text=b)}function hb(a){return 10*Math.sin(Math.PI*(a/180))}function ib(a){return 11.5-2.5*(a/15)}function jb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",ib(c)).attr("x",hb(c)).attr("transform","rotate("+c+")")}function kb(a,b){var c=eb(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 lb(){return kb("x",wh?"inner-top":"inner-right")}function mb(){return kb("y",wh?"inner-right":"inner-top")}function nb(){return kb("y2",wh?"inner-right":"inner-top")}function ob(a){return"y2"===a?nb():"y"===a?mb():lb()}function pb(){return fb("x")}function qb(){return fb("y")}function rb(){return fb("y2")}function sb(a,b){return a?b.isLeft?0:b.isCenter?gg/2:gg:b.isBottom?-ig:b.isMiddle?-ig/2:0}function tb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function ub(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function vb(){return sb(!wh,lb())}function wb(){return sb(wh,mb())}function xb(){return sb(wh,nb())}function yb(){return tb(!wh,lb())}function zb(){return tb(wh,mb())}function Ab(){return tb(wh,nb())}function Bb(){var a=lb();return wh?a.isInner?"1.2em":-25-Hb("x"):a.isInner?"-0.5em":Mh?Mh-10:"3em"}function Cb(){var a=mb();return wh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Hb("y")}function Db(){var a=nb();return wh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Hb("y2")}function Eb(){return ub(!wh,lb())}function Fb(){return ub(wh,mb())}function Gb(){return ub(wh,nb())}function Hb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Ib(a){var b=Cj.select("."+g.axisX+" ."+g.axisXLabel),c=Cj.select("."+g.axisY+" ."+g.axisYLabel),d=Cj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",vb).attr("dx",yb).attr("dy",Bb).text(pb),(a?c.transition():c).attr("x",wb).attr("dx",zb).attr("dy",Cb).attr("dy",Cb).text(qb),(a?d.transition():d).attr("x",xb).attr("dx",Ab).attr("dy",Db).text(rb)}function Jb(a){var b=!1;return ug(Lc(Nf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Kb(){var a=Mf.svg.arc().outerRadius(mg).innerRadius(og),b=function(b,c){var d;return c?a(b):(d=Jb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Lb(a){var b=Mf.svg.arc().outerRadius(ng*(a?a:1)).innerRadius(og);return function(a){var c=Jb(a);return c?b(c):"M 0 0"}}function Mb(a,b){return se(a.data)?rg(a,b):"M 0 0"}function Nb(a){var b,c,d,e,f=Jb(a),g="";return f&&(b=rg.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*mg*.8+","+d/e*mg*.8+")"),g}function Ob(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Pb(a){return tc({id:a.data.id,value:a.value,ratio:Ob(a)})}function Qb(a){var b,c,d,e;return Tb()?(b=Jb(a),c=b?b.value:null,d=Ob(b),e=Ub(),e?e(c,d):Gd(c,d)):""}function Rb(a,b){var c=Aj.selectAll("."+g.chartArc+sd(a)),d=Aj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});ye(a)&&c.selectAll("path").transition().duration(50).attr("d",sg).transition().duration(100).attr("d",tg).each(function(a){re(a.data)}),b||d.style("opacity",.3)}function Sb(a){var b=Aj.selectAll("."+g.chartArc+sd(a));b.selectAll("path").transition().duration(50).attr("d",rg),Aj.selectAll("."+g.arc).style("opacity",1)}function Tb(){return ke(Nf.data.targets)?Ai:ui}function Ub(){return ke(Nf.data.targets)?Bi:vi}function Vb(){return ke(Nf.data.targets)?Di:""}function Wb(){var a=ke(Nf.data.targets)?Ei:xi;return"function"==typeof a?a:function(){}}function Xb(){var a=ke(Nf.data.targets)?Fi:yi;return"function"==typeof a?a:function(){}}function Yb(){var a=ke(Nf.data.targets)?Gi:zi;return"function"==typeof a?a:function(){}}function Zb(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Tg.length>0)for(g=Uc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return Mf.min(Object.keys(i).map(function(a){return Mf.min(i[a])}))}function $b(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Tg.length>0)for(g=Vc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return Mf.max(Object.keys(i).map(function(a){return Mf.max(i[a])}))}function _b(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return cb(a.id)===c}),m="y2"===c?$h:Rh,n="y2"===c?Zh:Qh,o=b(m)?m:Zb(l),p=b(n)?n:$b(l),q="y2"===c?_h:Sh,r=Ad()&&wh;return 0===l.length?"y2"===c?Fg.domain():Eg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=Bd(o,p),j=ec(Eg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Wh&&(f=b(Wh.top)?Wh.top:e,g=b(Wh.bottom)?Wh.bottom:e),"y2"===c&&di&&(f=b(di.top)?di.top:e,g=b(di.bottom)?di.bottom:e),he(l)&&!Uc(l)&&(g=o),[o-g,p+f])}function ac(a){return Kh?Vi?Ae(Kh):Kh:Mf.min(a,function(a){return Mf.min(a.values,function(a){return a.x})})}function bc(a){return Jh?Vi?Ae(Jh):Jh:Mf.max(a,function(a){return Mf.max(a.values,function(a){return a.x})})}function cc(a){var c,d,e,f,g=Fc(a),h=g[1]-g[0];return Wi?d=0:he(a)?(c=Dc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Lh&&Fe(Lh)?(e=b(Lh.left)?Lh.left:d,f=b(Lh.right)?Lh.right:d):e=f="number"==typeof Lh?Lh:d,{left:e,right:f}}function dc(a){var b=[ac(a),bc(a)],c=b[0],d=b[1],e=cc(a),f=0,g=0;return c-d!==0||Wi||(c=Vi?new Date(.5*c.getTime()):-.5,d=Vi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ec(a){return a[1]-a[0]}function fc(a){for(var b=0;bb?0:b-c}function lc(a){var b,c=jc(a),d="y"===a.axis?Eg:Fg;return b="y"===a.axis||"y2"===a.axis?wh?ig:"start"in a?d(a.start):ig:wh?"end"in a?Dg(Vi?Ae(a.end):a.end):ig:ig,c>b?0:b-c}function mc(a){return Ng&&a===Ng||Fe(Og)&&Ge(Og,a)}function nc(a){return!mc(a)}function oc(a){return Ng?Ng:Fe(Og)?Og[a]:null}function pc(a,b){var c,d=b&&Fe(b)?Gc(b):[];return d.forEach(function(b){oc(b)===a&&(c=Nf.data.xs[b])}),c}function qc(a,b){return a in Nf.data.xs&&Nf.data.xs[a]&&Nf.data.xs[a][b]?Nf.data.xs[a][b]:b}function rc(a){Object.keys(a).forEach(function(b){Og[b]=a[b]})}function sc(a){return 1===Mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function tc(a){var b;return a&&(b=Rg[a.id],a.name=b?b:a.id),a}function uc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=wc(b[d],a.id,d)}),Nf.data.xs[a.id]=b})}function vc(a,b){a.forEach(function(a){b[a.id]&&uc([a],b[a.id])})}function wc(a,c,d){var e;return e=Vi?a?a instanceof Date?a:Ae(a):Ae(qc(c,d)):Xi&&!Wi?b(a)?+a:qc(c,d):d}function xc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Ng?(d=Object.keys(Nf.data.xs),Nf.data.xs[c]=d.length>0?Nf.data.xs[d[0]]:void 0):Fe(Og)&&(Nf.data.xs[c]=pc(f,Nf.data.targets)):Nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Qg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=oc(b),g=a[f],h=wc(g,b,e);return Xi&&Wi&&0===c&&g&&(0===e&&(Ah=[]),Ah.push(g)),("undefined"==typeof a[b]||Nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Vg&&fe(Gc(c).filter(function(a){return!(a in Wg)}),Vg),c.forEach(function(a){gc(a.id_org,a)}),c}function Ac(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 Bc(a){return a>0&&Nf.data.targets[0].values[a-1]?Nf.data.targets[0].values[a-1].x:void 0}function Cc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Fc(a){var b,c,d=Ec(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Gc(a){return a.map(function(a){return a.id})}function Hc(a){return a?"string"==typeof a?[a]:a:Gc(Nf.data.targets)}function Ic(a,b){var c,d=Gc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Vi?new Date(i):i);j.push(e)}return Vi||(j=j.sort(function(a,b){return a-b})),j}function Oc(a){fj=fj.concat(a)}function Pc(a){fj=fj.filter(function(b){return a.indexOf(b)<0})}function Qc(a){gj=gj.concat(a)}function Rc(a){gj=gj.filter(function(b){return a.indexOf(b)<0})}function Sc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Tc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Vc(a){return Tc(a,function(a){return a>0})}function Wc(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||0===a[f].x)&&(e=e.concat(Md(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Md(a,g))),Pd(e,b)):Nd(a,b,f,g)}function Od(a,b){var c;return c=a.map(function(a){return Nd(a.values,b)}),Pd(c,b)}function Pd(a,b){var c,d;return a.forEach(function(a){var e=He(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Qd(a,b){return Mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Rd(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 Sd(){return Yg&&"desc"===Yg.toLowerCase()}function Td(){return Yg&&"asc"===Yg.toLowerCase()}function Ud(a){var b=Td(),c=Sd();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 Yg&&a.sort(Yg),a}function Vd(a,c){var d,e,f,g,h,i,j,k=le(Nf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&Ii&&(Fj.html(Li(a,db(),Cd(k),cj)).style("display","block"),d=Fj.property("offsetWidth"),e=Fj.property("offsetHeight"),k?(g=gg/2+c[0],i=ig/2+c[1]+20):(wh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-y(),i=Dg(l[0].x)+20):(f=s(),g=f+x()+Dg(l[0].x)+20,h=g+d,j=f+t()-y(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),Fj.style("top",i+"px").style("left",g+"px"))}function Wd(){Fj.style("display","none")}function Xd(a){var c=a.filter(function(a){return a&&b(a.value)});if(Ii&&!ie(Nf.data.targets)&&!le(Nf.data.targets)){var d=Cj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(wh?"y1":"x1",Id).attr(wh?"y2":"x2",Id),pf(d,"grid")}}function Yd(){Cj.select("line."+g.xgridFocus).style("visibility","hidden")}function Zd(a,b){var c,d,e,f,h=[],i=Cj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=dc(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function $d(a){return a.x||0===a.x?Dg(a.x):null}function _d(a){return $(a.id)(a.value)}function ae(){var a,b,d={},e=0;return Lc(Nf.data.targets.filter(oe)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ee(a,b){return"number"==typeof si?si:b?2*a.tickOffset()*ti/b:0}function fe(a,b){Hc(a).forEach(function(a){Jj[a]=b===Wg[a],Wg[a]=b})}function ge(a,b){var c=!1;return a.forEach(function(a){Wg[a.id]===b&&(c=!0),a.id in Wg||"line"!==b||(c=!0)}),c}function he(a){return ge(a,"bar")}function ie(a){return ge(a,"scatter")}function je(a){return ge(a,"pie")}function ke(a){return ge(a,"donut")}function le(a){return je(a)||ke(a)}function me(a){var b="string"==typeof a?a:a.id;return!(b in Wg)||"line"===Wg[b]||"spline"===Wg[b]||"area"===Wg[b]||"area-spline"===Wg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"spline"===Wg[b]||"area-spline"===Wg[b]}function oe(a){var b="string"==typeof a?a:a.id;return"bar"===Wg[b]}function pe(a){var b="string"==typeof a?a:a.id;return"scatter"===Wg[b]}function qe(a){var b="string"==typeof a?a:a.id;return"pie"===Wg[b]}function re(a){var b="string"==typeof a?a:a.id;return"donut"===Wg[b]}function se(a){return qe(a)||re(a)}function te(a){return me(a)?[a]:[]}function ue(a){return se(a.data)?[a]:[]}function ve(a){return oe(a)?a.values:[]}function we(a){return me(a)||pe(a)?a.values:[]}function xe(a){return oe(a)||me(a)?a.values:[]}function ye(a){return re(a)&&Ci||qe(a)&&wi}function ze(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function Ae(b){var c;try{c=Pg?Mf.time.format(Pg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Pg)}return c}function Be(a,b){var c=Mf.mouse(a),d=Mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ge(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function He(a,b){var c="y"===cb(a.id)?Eg:Fg,d=wh?1:0,e=wh?0:1;return Math.pow(Dg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ie(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Je(a,b,c){return d(a[b])?a[b]:c}function Ke(a){return 10*Math.ceil(a/10)}function Le(a,b,c){jh(b,a.node()),Cj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Xc(g.selectedCircle,c)}).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d).attr("stroke",function(){return cj(b)}).attr("r",1.4*We(b)).transition().duration(100).attr("r",We)}function Me(a,b,c){kh(b,a.node()),Cj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ne(a,b,c,d){a?Le(b,c,d):Me(b,c,d)}function Oe(a,b){jh(b,a.node()),a.transition().duration(100).style("fill",function(){return Mf.rgb(cj(b)).brighter(.75)})}function Pe(a,b){kh(b,a.node()),a.transition().duration(100).style("fill",function(){return cj(b)})}function Qe(a,b,c,d){a?Oe(b,c,d):Pe(b,c,d)}function Re(a,b,c,d){Qe(a,b,c.data,d)}function Se(a){return"circle"===a.nodeName?Ne:Mf.select(a).classed(g.bar)?Qe:Re}function Te(a){return a.filter(function(a){return b(a.value)})}function Ue(a){return li?"function"==typeof mi?mi(a):mi:0}function Ve(a){return oi?pi?pi:1.75*Ue(a):Ue(a)}function We(a){return qi?qi:4*Ue(a)}function Xe(a,c){return(c?Cj.selectAll("."+g.circles+rd(c)):Cj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ye(a,b){Xe(a,b).classed(g.EXPANDED,!0).attr("r",Ve)}function Ze(a){Xe(a).filter(function(){return Mf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Ue)}function $e(a){return Cj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function _e(a){$e(a).classed(g.EXPANDED,!0)}function af(a){$e(a).classed(g.EXPANDED,!1)}function bf(a,b){var c=ff(a,b);return function(a,b){var d=c(a,b),e=wh?1:0,f=wh?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 cf(a,b){var c=ff(a,!1),d=b?df:ef;return function(a,b){return d(c(a,b),a,this)}}function df(a,b){var c;return wh?(c=oe(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function ef(a,b,c){var d=c.getBoundingClientRect();return wh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:oe(b)?-3:-6)}function ff(a,b){var c=a.__max__+1,d=ee(Jg,c),e=be(d,c,a,!!b),f=ce(!!b),g=de(a,!!b),h=b?_:$;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return wh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function gf(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function hf(b){var c,d,e;if(Gj=Mf.select(Pf),Gj.empty())throw new Error("Element to bind not found");if(Gj.html("").classed("c3",!0),Nf.data.xs={},Nf.data.targets=zc(b),bh&&(Nf.data.targets=Nf.data.targets.filter(bh)),ah&&Oc(ah===!0?Gc(Nf.data.targets):ah),p(),V(),Dg.domain(Mf.extent(dc(Nf.data.targets))),Eg.domain(_b(Nf.data.targets,"y")),Fg.domain(_b(Nf.data.targets,"y2")),Gg.domain(Dg.domain()),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Hj=Dg.domain(),vj.scale(Gg),Wf&&zj.scale(Dg),Aj=Gj.append("svg").style("overflow","hidden").on("mouseenter",$f).on("mouseleave",_f),Bj=Aj.append("defs"),Bj.append("clipPath").attr("id",Pi).append("rect"),Bj.append("clipPath").attr("id",Qi).append("rect"),Bj.append("clipPath").attr("id",Ri).append("rect"),uf(),Cj=Aj.append("g").attr("transform",mj.main),Dj=Aj.append("g").attr("transform",mj.context),Ej=Aj.append("g").attr("transform",mj.legend),nh||Dj.style("visibility","hidden"),qh||(Ej.style("visibility","hidden"),gj=Gc(Nf.data.targets)),Fj=Gj.style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Hf(Gc(Nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=Cj.append("g").attr("clip-path",Si).attr("class",g.grid),fi&&d.append("g").attr("class",g.xgrids),Fe(hi)&&d.append("g").attr("class",g.xgridLines),ni&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),ii&&d.append("g").attr("class",g.ygrids),Fe(ji)&&d.append("g").attr("class",g.ygridLines),Cj.append("g").attr("clip-path",Si).attr("class",g.regions),Cj.append("g").attr("clip-path",Si).attr("class",g.chart),c=Cj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Wf?wh?"ns-resize":"ew-resize":null),Cj.select("."+g.chart).append("g").attr("class",g.chartBars),Cj.select("."+g.chart).append("g").attr("class",g.chartLines),Cj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",mj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Vb()),Cj.select("."+g.chart).append("g").attr("class",g.chartTexts),Wf&&Cj.insert("rect",Yf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",gg).attr("height",ig).style("opacity",0).style("cursor",wh?"ns-resize":"ew-resize").call(zj).on("dblclick.zoom",null),Nh&&vj.extent("function"!=typeof Nh?Nh:Nh(dc())),hj.x=Cj.append("g").attr("class",g.axisX).attr("clip-path",Ti).attr("transform",mj.x).style("visibility",xh?"visible":"hidden"),hj.x.append("text").attr("class",g.axisXLabel).attr("transform",wh?"rotate(-90)":"").style("text-anchor",Eb),hj.y=Cj.append("g").attr("class",g.axisY).attr("clip-path",Ui).attr("transform",mj.y).style("visibility",Ph?"visible":"hidden"),hj.y.append("text").attr("class",g.axisYLabel).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Fb),hj.y2=Cj.append("g").attr("class",g.axisY2).attr("transform",mj.y2).style("visibility",Yh?"visible":"hidden"),hj.y2.append("text").attr("class",g.axisY2Label).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Gb),Dj.append("g").attr("clip-path",Si).attr("class",g.chart),Dj.select("."+g.chart).append("g").attr("class",g.chartBars),Dj.select("."+g.chart).append("g").attr("class",g.chartLines),Dj.append("g").attr("clip-path",Si).attr("class",g.brush).call(vj).selectAll("rect").attr(wh?"width":"height",wh?hg:jg),hj.subx=Dj.append("g").attr("class",g.axisX).attr("transform",mj.subx).attr("clip-path",wh?"":Ti),xf(Nf.data.targets),qf({withUpdateTranslate:!0,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Mi){if(Vi&&"string"==typeof Ni){for(Ni=Ae(Ni),e=0;e0){d=[];for(var f in Rg)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Rd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Qe,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function nf(a){le(Nf.data.targets)||ch&&(Yi=a,Cj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Zi=!0,lh())}function of(){le(Nf.data.targets)||ch&&(Cj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),Cj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Zi=!1,mh())}function pf(a,b){"grid"===b&&a.each(function(){var a=Mf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function qf(a,c){var d,e,f,h,i,j,k,l,m,n,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,Q,R,S,T,U,W,X,Y,Z,$=ae(),_=le(Nf.data.targets),ab=Lc(Nf.data.targets);if(a=a||{},E=Je(a,"withY",!0),F=Je(a,"withSubchart",!0),G=Je(a,"withTransition",!0),J=Je(a,"withTransform",!1),K=Je(a,"withUpdateXDomain",!1),L=Je(a,"withUpdateOrgXDomain",!1),N=Je(a,"withUpdateTranslate",!1),M=Je(a,"withLegend",!1),H=Je(a,"withTransitionForExit",G),I=Je(a,"withTransitionForAxis",G),T=G?cg:0,U=H?T:0,W=I?T:0,c=c||vf(W),N&&(wh?(hj.x.call(Jg),hj.subx.call(Mg)):(hj.y.call(Kg),hj.y2.call(Lg)),p(),V(),uf(),o(!1)),M&&qh&&Hf(Gc(Nf.data.targets),a,c),Wi&&0===ab.length&&Dg.domain([0,hj.x.selectAll(".tick").size()]),ab.length&&(L&&(Dg.domain(Mf.extent(dc(ab))),Hj=Dg.domain(),Wf&&zj.scale(Dg).updateScaleExtent(),Gg.domain(Dg.domain()),vj.scale(Gg)),K&&(Dg.domain(vj.empty()?Hj:vj.extent()),Wf&&zj.scale(Dg).updateScaleExtent()),Hh||!Gh&&!Fh||(X=Nc(Mc(ab),Fh),Jg.tickValues(X),Mg.tickValues(X))),Eg.domain(_b(ab,"y")),Fg.domain(_b(ab,"y2")),hj.x.style("opacity",_?0:1),hj.y.style("opacity",_?0:1),hj.y2.style("opacity",_?0:1),hj.subx.style("opacity",_?0:1),c.axisX.call(Jg),c.axisY.call(Kg),c.axisY2.call(Lg),c.axisSubX.call(Mg),Ib(G),K&&ab.length)if(Dh&&X){for(Y=1;Y=0&&Mf.select(this).style("display",b%Z?"none":"block")})}else Aj.selectAll("."+g.axisX+" .tick text").style("display","block");!wh&&Ih&&jb(hj.x,c.axisX,Ih),O=bf($),R=cf($,!0),S=cf($,!1),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Fj.style("display","none"),q(),Cj.select("line."+g.xgridFocus).style("visibility","hidden"),fi&&(f=Zd(gi,Dg),B=Wi?Jg.tickOffset():0,e=wh?{x1:0,x2:gg,y1:function(a){return Dg(a)-B},y2:function(a){return Dg(a)-B}}:{x1:function(a){return Dg(a)+B},x2:function(a){return Dg(a)+B},y1:dg.top,y2:ig},d=Cj.select("."+g.xgrids).selectAll("."+g.xgrid).data(f),d.enter().append("line").attr("class",g.xgrid),d.attr(e).style("opacity",function(){return+Mf.select(this).attr(wh?"y1":"x1")===(wh?ig:0)?0:1}),d.exit().remove()),Fe(hi)&&(h=Cj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(hi),i=h.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),i.append("line").style("opacity",0),i.append("text").attr("text-anchor","end").attr("transform",wh?"":"rotate(-90)").attr("dx",wh?0:-dg.top).attr("dy",-5).style("opacity",0),h.select("line").transition().duration(T).attr("x1",wh?0:Jd).attr("x2",wh?gg:Jd).attr("y1",wh?Jd:dg.top).attr("y2",wh?Jd:ig).style("opacity",1),h.select("text").transition().duration(T).attr("x",wh?gg:0).attr("y",Jd).text(function(a){return a.text}).style("opacity",1),h.exit().transition().duration(T).style("opacity",0).remove()),E&&ii&&(j=Cj.select("."+g.ygrids).selectAll("."+g.ygrid).data(Eg.ticks(ki)),j.enter().append("line").attr("class",g.ygrid),j.attr("x1",wh?Eg:0).attr("x2",wh?Eg:gg).attr("y1",wh?0:Eg).attr("y2",wh?ig:Eg),j.exit().remove(),pf(j,"grid")),E&&Fe(ji)&&(k=Cj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(ji),l=k.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",wh?"rotate(-90)":"").attr("dx",wh?0:-dg.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",wh?Kd:0).attr("x2",wh?Kd:gg).attr("y1",wh?0:Kd).attr("y2",wh?ig:Kd).style("opacity",1),k.select("text").transition().duration(T).attr("x",wh?0:gg).attr("y",Kd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),u=Cj.select("."+g.regions).selectAll("."+g.region).data(Hi),u.enter().append("g").attr("class",kd).append("rect").style("fill-opacity",0),u.selectAll("rect").transition().duration(T).attr("x",ic).attr("y",jc).attr("width",kc).attr("height",lc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),u.exit().transition().duration(T).style("opacity",0).remove(),s=Cj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),s.enter().append("path").attr("class",ed).style("stroke","none").style("fill",cj),s.style("opacity",wd).transition().duration(T).attr("d",O).style("fill",cj).style("opacity",1),s.exit().transition().duration(U).style("opacity",0).remove(),m=Cj.selectAll("."+g.lines).selectAll("."+g.line).data(te),m.enter().append("path").attr("class",ad).style("stroke",cj),m.style("opacity",wd).transition().duration(T).attr("d",wj).style("stroke",cj).style("opacity",1),m.exit().transition().duration(U).style("opacity",0).remove(),n=Cj.selectAll("."+g.areas).selectAll("."+g.area).data(te),n.enter().append("path").attr("class",id).style("fill",cj).style("opacity",function(){return Ij=+Mf.select(this).style("opacity"),0}),n.style("opacity",0).transition().duration(T).attr("d",xj).style("fill",cj).style("opacity",Ij),n.exit().transition().duration(U).style("opacity",0).remove(),r=Cj.selectAll("."+g.circles).selectAll("."+g.circle).data(we),r.enter().append("circle").attr("class",cd).attr("r",Ue).style("fill",cj),r.style("opacity",wd).transition().duration(T).style("opacity",yd).style("fill",cj).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d),r.exit().remove(),v=Cj.selectAll("."+g.texts).selectAll("."+g.text).data(xe),v.enter().append("text").attr("class",Yc).attr("text-anchor",function(a){return wh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",cj).style("fill-opacity",0),v.text(function(a){return Hd(a.id)(a.value,a.id)}).style("fill-opacity",xd).transition().duration(T).attr("x",R).attr("y",S).style("fill",cj).style("fill-opacity",zd),v.exit().transition().duration(U).style("fill-opacity",0).remove(),t=Cj.selectAll("."+g.arcs).selectAll("."+g.arc).data(ue),t.enter().append("path").attr("class",gd).style("fill",function(a){return cj(a.data)}).style("cursor",function(a){return eh(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;aj||(c=Jb(a),d=Pb(c),e=Xb(),Rb(c.data.id),Df(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Jb(a),c=Pb(b),d=[c];Vd(d,Mf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;aj||(c=Jb(a),d=Pb(c),e=Yb(),Sb(c.data.id),Ef(),Wd(),e(d,b))}).on("click",function(a,b){var c=Jb(a),d=Pb(c),e=Wb();lf(this,a,b),e(d,b)}),t.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){aj=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Jb(a);return c?(b=Mf.interpolate(this._current,c),this._current=b(0),function(a){return Mb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("fill",function(a){return cj(a.data)}).style("opacity",1).call(Ie,function(){aj=!1}),t.exit().transition().duration(U).style("opacity",0).remove(),Cj.selectAll("."+g.chartArc).select("text").attr("transform",Nb).style("opacity",0).transition().duration(T).text(Qb).style("opacity",function(a){return Jc(a.data.id)&&se(a.data)?1:0}),Cj.select("."+g.chartArcsTitle).style("opacity",ke(Nf.data.targets)?1:0),nh&&(Mf.event&&"zoom"===Mf.event.type&&vj.extent(Dg.orgDomain()).update(),F&&(!wh&&Ih&&jb(hj.subx,c.axisSubX,Ih),vj.empty()||vj.extent(Dg.orgDomain()).update(),Q=bf($,!0),x=Dj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),x.enter().append("path").attr("class",ed).style("stroke","none").style("fill",cj),x.style("opacity",wd).transition().duration(T).attr("d",Q).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove(),w=Dj.selectAll("."+g.lines).selectAll("."+g.line).data(te),w.enter().append("path").attr("class",ad).style("stroke",cj),w.style("opacity",wd).transition().duration(T).attr("d",yj).style("opacity",1),w.exit().transition().duration(T).style("opacity",0).remove())),Cj.selectAll("."+g.selectedCircles).filter(function(a){return oe(a)}).selectAll("circle").remove(),Cj.selectAll("."+g.selectedCircle).transition().duration(T).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d),Zf&&(y=Cj.select("."+g.eventRects),Fe(Og)&&!sc(Og)?(y.classed(g.eventRectsMultiple)||y.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),z=Cj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),kf(z.enter()),z.attr("x",0).attr("y",0).attr("width",gg).attr("height",ig)):(y.classed(g.eventRectsSingle)||y.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Xi&&!Wi?(D=function(a,b){var c=Bc(b),d=Cc(b),e=Nf.data.xs[a.id][b];return(Dg(d?d:e+50)-Dg(c?c:e-50))/2},C=function(a,b){var c=Bc(b),d=Nf.data.xs[a.id][b];return(Dg(d)+Dg(c?c:d-50))/2}):(D=P(),C=function(a){return Dg(a.x)-D/2}),A=Ec(Nf.data.targets),Cj.select("."+g.eventRects).datum(A?A.values:[]),z=Cj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),jf(z.enter()),z.attr("class",ld).attr("x",wh?0:C).attr("y",wh?C:0).attr("width",wh?gg:D).attr("height",wh?D:ig),z.exit().remove())),Gc(Nf.data.targets).forEach(function(a){Jj[a]=!0})}function rf(){qf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function sf(){if(0!==Lc(Nf.data.targets).length){if("mousemove"===Mf.event.sourceEvent.type&&zj.altDomain)return Dg.domain(zj.altDomain),void zj.scale(Dg).updateScaleExtent();Wi&&Dg.orgDomain()[0]===Hj[0]&&Dg.domain([Hj[0]-1e-10,Dg.orgDomain()[1]]),qf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Mf.event.sourceEvent.type&&($i=!0)}}function tf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function uf(){Aj.attr("width",kg).attr("height",lg),Aj.select("#"+Pi).select("rect").attr("width",gg).attr("height",ig),Aj.select("#"+Qi).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),Aj.select("#"+Ri).select("rect").attr("x",H).attr("y",I).attr("width",N).attr("height",O),Aj.select("."+g.zoomRect).attr("width",gg).attr("height",ig),Gj.style("max-height",lg+"px")}function vf(a){return{axisX:a?hj.x.transition().duration(a):hj.x,axisY:a?hj.y.transition().duration(a):hj.y,axisY2:a?hj.y2.transition().duration(a):hj.y2,axisSubX:a?hj.subx.transition().duration(a):hj.subx}}function wf(a){var b;a=a||{},a.withTransition=Je(a,"withTransition",!0),a.withTransform=Je(a,"withTransform",!1),a.withLegend=Je(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withLegend&&qh||(b=vf(a.withTransitionForAxis?cg:0),p(),V(),uf(),o(a.withTransition,b)),qf(a,b)}function xf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=Cj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",nd),j=i.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Zc),e=Cj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),d=e.enter().append("g").attr("class",pd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",fd).style("cursor",function(a){return eh(a)?"pointer":null}),c=Cj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),b=c.enter().append("g").attr("class",od).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",bd),b.append("g").attr("class",jd),b.append("g").attr("class",function(a){return Xc(g.selectedCircles,a.id)}),b.append("g").attr("class",dd).style("cursor",function(a){return eh(a)?"pointer":null}),a.forEach(function(a){Cj.selectAll("."+g.selectedCircles+rd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Cj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(ug(a)).attr("class",qd),f=h.enter().append("g").attr("class",qd),f.append("g").attr("class",hd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),nh&&(n=Dj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),m=n.enter().append("g").style("opacity",0).attr("class",pd),m.append("g").attr("class",fd),l=Dj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),k=l.enter().append("g").style("opacity",0).attr("class",od),k.append("g").attr("class",bd)),Aj.selectAll("."+g.target).filter(function(a){return Jc(a.id)}).transition().duration(cg).style("opacity",1)}function yf(a,b){b.filter&&(a=a.filter(b.filter)),(b.type||b.types)&&a.forEach(function(a){b.types?fe(a.id,b.types[a.id]):fe(a.id,b.type)}),Nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,z=0,F++)),E[a]=F,D[F]=f,A[a]=z,z+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+v)/10),j=10*Math.ceil((h.height+u)/10),k=nj?j:i,l=nj?U():T();return d&&(z=0,F=0,w=0,x=0),qh&&!Kc(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=i,C[c]=j,(!w||i>=w)&&(w=i),(!x||j>=x)&&(x=j),g=nj?x:w,void(vh?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(l-g*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=26,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=Ej.selectAll("."+g.legendItemFocused).size();b=b||{},n=Je(b,"withTransition",!0),q=Je(b,"withTransitionForTransform",!0),nj?(f=function(a){return w*E[a]},j=function(a){return D[E[a]]+A[a]}):(f=function(a){return D[E[a]]+A[a]},j=function(a){return x*E[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=Ej.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Xc(g.legendItem,a)}).style("visibility",function(a){return Kc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof sh?sh(a):Nf.toggle(a)}).on("mouseover",function(a){Mf.select(this).classed(g.legendItemFocused,!0),aj||Nf.focus(a),"function"==typeof th&&th(a)}).on("mouseout",function(a){Mf.select(this).classed(g.legendItemFocused,!1),aj||Nf.revert(),"function"==typeof uh&&uh(a)}),m.append("text").text(function(a){return d(Rg[a])?Rg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",nj?h:-200).attr("y",nj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",nj?i:-200).attr("y",nj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",cj).attr("x",nj?h:-200).attr("y",nj?-200:j).attr("width",10).attr("height",10),r=Ej.selectAll("text").data(a).text(function(a){return d(Rg[a])?Rg[a]:a}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=Ej.selectAll("rect."+g.legendItemEvent).data(a),(n?s.transition():s).attr("width",function(a){return B[a]}).attr("height",function(a){return C[a]}).attr("x",i).attr("y",l),t=Ej.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",cj).attr("x",f).attr("y",j),Ej.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Jc(a)}).transition().style("opacity",function(a){var b=Mf.select(this);return Jc(a)?!G||b.classed(g.legendItemFocused)?Bf(b):Cf(b):rj}),R(w),S(x),Q(F),p(),V(),uf(),o(q,c)}function If(a){return Ic(Nf.data.targets,a.id)}function Jf(a){return"data"in a&&Ic(Nf.data.targets,a.data.id)}function Kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function Lf(a,b,c){var d=!le(Nf.data.targets);aj=!1,fe(a,b),wf(c||{withTransitionForAxis:d})}var Mf=a.d3?a.d3:a.require?a.require("d3"):void 0,Nf={data:{},axis:{},legend:{}},Of={},Pf=i(["bindto"],"#chart"),Qf=i(["size","width"]),Rf=i(["size","height"]),Sf=i(["padding","left"]),Tf=i(["padding","right"]),Uf=i(["padding","top"]),Vf=i(["padding","bottom"]),Wf=i(["zoom","enabled"],!1),Xf=i(["zoom","extent"]),Yf=i(["zoom","privileged"],!1),Zf=i(["interaction","enabled"],!0),$f=i(["onenter"],function(){}),_f=i(["onleave"],function(){}),ag=i(["onresize"],function(){}),bg=i(["onresized"],function(){}),cg=i(["transition","duration"],350);h("data","data is required in config");var dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg,Kg,Lg,Mg,Ng=i(["data","x"]),Og=i(["data","xs"],{}),Pg=i(["data","x_format"]),Qg=i(["data","id_converter"],function(a){return a}),Rg=i(["data","names"],{}),Sg=i(["data","classes"],{}),Tg=i(["data","groups"],[]),Ug=i(["data","axes"],{}),Vg=i(["data","type"]),Wg=i(["data","types"],{}),Xg=i(["data","labels"],{}),Yg=i(["data","order"]),Zg=i(["data","regions"],{}),$g=i(["data","color"]),_g=i(["data","colors"],{}),ah=i(["data","hide"],!1),bh=i(["data","filter"]),ch=i(["data","selection","enabled"],!1),dh=i(["data","selection","grouped"],!1),eh=i(["data","selection","isselectable"],function(){return!0}),fh=i(["data","selection","multiple"],!0),gh=i(["data","onclick"],function(){}),hh=i(["data","onenter"],function(){}),ih=i(["data","onleave"],function(){}),jh=i(["data","onselected"],function(){}),kh=i(["data","onunselected"],function(){}),lh=i(["data","ondragstart"],function(){}),mh=i(["data","ondragend"],function(){}),nh=i(["subchart","show"],!1),oh=i(["subchart","size","height"],60),ph=i(["color","pattern"],[]),qh=i(["legend","show"],!0),rh=i(["legend","position"],"bottom"),sh=i(["legend","item","onclick"]),th=i(["legend","item","onmouseover"]),uh=i(["legend","item","onmouseout"]),vh=i(["legend","equally"],!1),wh=i(["axis","rotated"],!1),xh=i(["axis","x","show"],!0),yh=i(["axis","x","type"],"indexed"),zh=i(["axis","x","localtime"],!0),Ah=i(["axis","x","categories"],[]),Bh=i(["axis","x","tick","centered"],!1),Ch=i(["axis","x","tick","format"]),Dh=i(["axis","x","tick","culling"],{}),Eh=i(["axis","x","tick","culling","max"],10),Fh=i(["axis","x","tick","count"]),Gh=i(["axis","x","tick","fit"],!0),Hh=i(["axis","x","tick","values"],null),Ih=i(["axis","x","tick","rotate"]),Jh=i(["axis","x","max"],null),Kh=i(["axis","x","min"],null),Lh=i(["axis","x","padding"],{}),Mh=i(["axis","x","height"]),Nh=i(["axis","x","default"]),Oh=i(["axis","x","label"],{}),Ph=i(["axis","y","show"],!0),Qh=i(["axis","y","max"]),Rh=i(["axis","y","min"]),Sh=i(["axis","y","center"]),Th=i(["axis","y","label"],{}),Uh=i(["axis","y","inner"],!1),Vh=i(["axis","y","tick","format"]),Wh=i(["axis","y","padding"]),Xh=i(["axis","y","ticks"],10),Yh=i(["axis","y2","show"],!1),Zh=i(["axis","y2","max"]),$h=i(["axis","y2","min"]),_h=i(["axis","y2","center"]),ai=i(["axis","y2","label"],{}),bi=i(["axis","y2","inner"],!1),ci=i(["axis","y2","tick","format"]),di=i(["axis","y2","padding"]),ei=i(["axis","y2","ticks"],10),fi=i(["grid","x","show"],!1),gi=i(["grid","x","type"],"tick"),hi=i(["grid","x","lines"],[]),ii=i(["grid","y","show"],!1),ji=i(["grid","y","lines"],[]),ki=i(["grid","y","ticks"],10),li=i(["point","show"],!0),mi=i(["point","r"],2.5),ni=i(["point","focus","line","enabled"],!0),oi=i(["point","focus","expand","enabled"],!0),pi=i(["point","focus","expand","r"]),qi=i(["point","focus","select","r"]),ri=i(["line","connect_null"],!1),si=i(["bar","width"]),ti=i(["bar","width","ratio"],.6),ui=i(["pie","label","show"],!0),vi=i(["pie","label","format"]),wi=i(["pie","expand"],!0),xi=i(["pie","onclick"],function(){}),yi=i(["pie","onmouseover"],function(){}),zi=i(["pie","onmouseout"],function(){}),Ai=i(["donut","label","show"],!0),Bi=i(["donut","label","format"]),Ci=i(["donut","expand"],!0),Di=i(["donut","title"],""),Ei=i(["donut","onclick"],function(){}),Fi=i(["donut","onmouseover"],function(){}),Gi=i(["donut","onmouseout"],function(){}),Hi=i(["regions"],[]),Ii=i(["tooltip","show"],!0),Ji=i(["tooltip","format","title"]),Ki=i(["tooltip","format","value"]),Li=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Ji?Ji:b,l=Ki?Ki:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Mi=i(["tooltip","init","show"],!1),Ni=i(["tooltip","init","x"],0),Oi=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Pi=("string"==typeof Pf?Pf.replace(/[# .>~+]/g,""):g.chart+ +new Date)+"-clip",Qi=Pi+"-xaxis",Ri=Pi+"-yaxis",Si=j(Pi),Ti=j(Qi),Ui=j(Ri),Vi="timeseries"===yh,Wi="categorized"===yh,Xi=!Vi&&(Ng||Fe(Og)),Yi=null,Zi=!1,$i=!1,_i=!1,aj=!1,bj=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],cj=ze(_g,Fe(ph)?ph:bj,$g),dj=zh?Mf.time.format:Mf.time.format.utc,ej=dj.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),fj=[],gj=[],hj={},ij=wh?"left":"bottom",jj=wh?Uh?"top":"bottom":Uh?"right":"left",kj=wh?bi?"bottom":"top":bi?"left":"right",lj=wh?"left":"bottom",mj={main:function(){return"translate("+k(dg.left)+","+k(dg.top)+")"},context:function(){return"translate("+k(eg.left)+","+k(eg.top)+")"},legend:function(){return"translate("+fg.left+","+fg.top+")" -},x:function(){return"translate(0,"+(wh?0:ig)+")"},y:function(){return"translate(0,"+(wh?ig:0)+")"},y2:function(){return"translate("+(wh?0:gg)+","+(wh?1:0)+")"},subx:function(){return"translate(0,"+(wh?0:jg)+")"},arc:function(){return"translate("+pg/2+","+qg/2+")"}},nj="right"===rh,oj=0,pj=0,qj=0,rj=.15,sj=30,tj=wh&&!xh?0:30,uj=5;ug=Mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var vj,wj=function(){var a=Mf.svg.line().x(wh?function(a){return $(a.id)(a.value)}:Id).y(wh?Id:function(a){return $(a.id)(a.value)});return ri||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ri?Te(b.values):b.values;return me(b)?(a.interpolate(ne(b)?"cardinal":"linear"),Zg[b.id]?gf(e,Dg,$(b.id),Zg[b.id]):a(e)):(c=e[0]?Dg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,wh?"M "+d+" "+c:"M "+c+" "+d)}}(),xj=function(){var a;return a=wh?Mf.svg.area().x0(function(a){return $(a.id)(0)}).x1(function(a){return $(a.id)(a.value)}).y(Id):Mf.svg.area().x(Id).y0(function(a){return $(a.id)(0)}).y1(function(a){return $(a.id)(a.value)}),function(b){var c,d,e=Te(b.values);return ge([b],"area")||ge([b],"area-spline")?(a.interpolate(ne(b)?"cardinal":"linear"),a(e)):(c=e[0]?Dg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,wh?"M "+d+" "+c:"M "+c+" "+d)}}(),yj=function(){var a=Mf.svg.line().x(wh?function(a){return _(a.id)(a.value)}:Ld).y(wh?Ld:function(a){return _(a.id)(a.value)});return function(b){var c=Te(b.values);return me(b)?a(c):"M "+Gg(c[0].x)+" "+_(b.id)(c[0].value)}}(),zj=function(){};vj=Mf.svg.brush().on("brush",rf),vj.update=function(){return Dj&&Dj.select("."+g.brush).call(this),this},vj.scale=function(a){return wh?this.y(a):this.x(a)},Wf&&(zj=Mf.behavior.zoom().on("zoomstart",function(){zj.altDomain=Mf.event.sourceEvent.altKey?Dg.orgDomain():null}).on("zoom",Wf?sf:null),zj.scale=function(a){return wh?this.y(a):this.x(a)},zj.orgScaleExtent=function(){var a=Xf?Xf:[1,10];return[a[0],Math.max(Dc()/a[1],a[1])]},zj.updateScaleExtent=function(){var a=ec(Dg.orgDomain())/ec(Hj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Aj,Bj,Cj,Dj,Ej,Fj,Gj,Hj,Ij,Jj={};if(Nf.focus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);Nf.revert(),Nf.defocus(),b(d.classed(g.focused,!0)),b(e),le(Nf.data.targets)&&Rb(a,!0),Df(a,!0)},Nf.defocus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",.3)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);Nf.revert(),b(d.classed(g.focused,!1)),b(e),le(Nf.data.targets)&&Sb(a),Df(a,!1)},Nf.revert=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);b(d.classed(g.focused,!1)),b(e),le(Nf.data.targets)&&Sb(a),Ef()},Nf.show=function(a,b){a=Hc(a),b=b||{},Pc(a),Aj.selectAll(td(a)).transition().style("opacity",1),b.withLegend&&Ff(a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Nf.hide=function(a,b){a=Hc(a),b=b||{},Oc(a),Aj.selectAll(td(a)).transition().style("opacity",0),b.withLegend&&Gf(a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Nf.toggle=function(a){Jc(a)?Nf.hide(a):Nf.show(a)},Nf.unzoom=function(){vj.clear().update(),qf({withUpdateXDomain:!0})},Nf.load=function(a){return a.xs&&rc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Sg[b]=a.classes[b]}),"categories"in a&&Wi&&(Ah=a.categories,Jg.categories(Ah)),"cacheIds"in a&&fc(a.cacheIds)?void yf(hc(a.cacheIds),a.done):void("unload"in a?Af(Hc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){zf(a)}):zf(a))},Nf.unload=function(a,b){Af(Hc(a),function(){qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Nf.selected=function(a){return Mf.merge(Cj.selectAll("."+g.shapes+rd(a)).selectAll("."+g.shape).filter(function(){return Mf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Nf.select=function(a,b,c){ch&&Cj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Mf.select(this),i=e.data?e.data.id:e.id,j=Se(this),k=dh||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);"path"!==this.nodeName&&(k&&l?eh(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},Nf.unselect=function(a,b){ch&&Cj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Mf.select(this),f=c.data?c.data.id:c.id,h=Se(this),i=dh||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);"path"!==this.nodeName&&i&&j&&eh(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Nf.toLine=function(a){Lf(a,"line")},Nf.toSpline=function(a){Lf(a,"spline")},Nf.toBar=function(a){Lf(a,"bar")},Nf.toScatter=function(a){Lf(a,"scatter")},Nf.toArea=function(a){Lf(a,"area")},Nf.toAreaSpline=function(a){Lf(a,"area-spline")},Nf.toPie=function(a){Lf(a,"pie",{withTransform:!0})},Nf.toDonut=function(a){Lf(a,"donut",{withTransform:!0})},Nf.groups=function(a){return c(a)?Tg:(Tg=a,qf(),Tg)},Nf.xgrids=function(a){return a?(hi=a,qf(),hi):hi},Nf.xgrids.add=function(a){return a?Nf.xgrids(hi.concat(a)):void 0},Nf.xgrids.remove=function(a){var b=Kf(a);return Nf.xgrids(hi.filter(b))},Nf.ygrids=function(a){return a?(ji=a,qf(),ji):ji},Nf.ygrids.add=function(a){return a?Nf.ygrids(ji.concat(a)):void 0},Nf.ygrids.remove=function(a){var b=Kf(a);return Nf.ygrids(ji.filter(b))},Nf.regions=function(a){return a?(Hi=a,qf(),Hi):Hi},Nf.regions.add=function(a){return a?(Hi=Hi.concat(a),qf(),Hi):Hi},Nf.regions.remove=function(a){var b,c,d;return a=a||{},b=Je(a,"duration",cg),c=Je(a,"classes",[g.region]),d=Cj.select("."+g.regions).selectAll(c.map(function(a){return"."+a})),(b?d.transition().duration(b):d).style("opacity",0).remove(),Hi=Hi.filter(function(a){return c.indexOf(a.class)<0})},Nf.data.get=function(a){var b=Nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Nf.data.getAsTarget=function(a){var b=Nf.data.targets.filter(function(b){return b.id===a});return b.length>0?b[0]:void 0},Nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Rg[b]=a[b]}),qf({withLegend:!0}),Rg):Rg},Nf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){_g[b]=a[b]}),qf({withLegend:!0}),_g):_g},Nf.x=function(a){return arguments.length&&(uc(Nf.data.targets,a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Nf.data.xs},Nf.xs=function(a){return arguments.length&&(vc(Nf.data.targets,a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Nf.data.xs},Nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){gb(b,a[b])}),Ib())},Nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Jh=+a.x),b(a.y)&&(Qh=+a.y),b(a.y2)&&(Zh=+a.y2)):Qh=Zh=+a,qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Kh=+a.x),b(a.y)&&(Rh=+a.y),b(a.y2)&&($h=+a.y2)):Rh=$h=+a,qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Nf.axis.max(a.max),"undefined"!=typeof a.min&&Nf.axis.min(a.min))},Nf.legend.show=function(a){Ff(Hc(a)),qf({withLegend:!0})},Nf.legend.hide=function(a){Gf(Hc(a)),qf({withLegend:!0})},Nf.resize=function(a){Qf=a?a.width:null,Rf=a?a.height:null,wf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Nf.destroy=function(){Nf.data.targets=void 0,Nf.data.xs={},Gj.html(""),a.onresize=null},"url"in f.data)Mf.xhr(f.data.url,function(a,b){var c,d=Mf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Mf.csv.parse(b.response),hf(c)});else if("rows"in f.data)hf(xc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");hf(yc(f.data.columns))}return Nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(window); \ No newline at end of file +},x:function(){return"translate(0,"+(wh?0:ig)+")"},y:function(){return"translate(0,"+(wh?ig:0)+")"},y2:function(){return"translate("+(wh?0:gg)+","+(wh?1:0)+")"},subx:function(){return"translate(0,"+(wh?0:jg)+")"},arc:function(){return"translate("+pg/2+","+qg/2+")"}},nj="right"===rh,oj=0,pj=0,qj=0,rj=.15,sj=30,tj=wh&&!xh?0:30,uj=5;ug=Mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var vj,wj=function(){var a=Mf.svg.line().x(wh?function(a){return $(a.id)(a.value)}:Id).y(wh?Id:function(a){return $(a.id)(a.value)});return ri||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ri?Te(b.values):b.values;return me(b)?(a.interpolate(ne(b)?"cardinal":"linear"),Zg[b.id]?gf(e,Dg,$(b.id),Zg[b.id]):a(e)):(c=e[0]?Dg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,wh?"M "+d+" "+c:"M "+c+" "+d)}}(),xj=function(){var a;return a=wh?Mf.svg.area().x0(function(a){return $(a.id)(0)}).x1(function(a){return $(a.id)(a.value)}).y(Id):Mf.svg.area().x(Id).y0(function(a){return $(a.id)(0)}).y1(function(a){return $(a.id)(a.value)}),function(b){var c,d,e=Te(b.values);return ge([b],"area")||ge([b],"area-spline")?(a.interpolate(ne(b)?"cardinal":"linear"),a(e)):(c=e[0]?Dg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,wh?"M "+d+" "+c:"M "+c+" "+d)}}(),yj=function(){var a=Mf.svg.line().x(wh?function(a){return _(a.id)(a.value)}:Ld).y(wh?Ld:function(a){return _(a.id)(a.value)});return function(b){var c=Te(b.values);return me(b)?a(c):"M "+Gg(c[0].x)+" "+_(b.id)(c[0].value)}}(),zj=function(){};vj=Mf.svg.brush().on("brush",rf),vj.update=function(){return Dj&&Dj.select("."+g.brush).call(this),this},vj.scale=function(a){return wh?this.y(a):this.x(a)},Wf&&(zj=Mf.behavior.zoom().on("zoomstart",function(){zj.altDomain=Mf.event.sourceEvent.altKey?Dg.orgDomain():null}).on("zoom",Wf?sf:null),zj.scale=function(a){return wh?this.y(a):this.x(a)},zj.orgScaleExtent=function(){var a=Xf?Xf:[1,10];return[a[0],Math.max(Dc()/a[1],a[1])]},zj.updateScaleExtent=function(){var a=ec(Dg.orgDomain())/ec(Hj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Aj,Bj,Cj,Dj,Ej,Fj,Gj,Hj,Ij,Jj={};if(Nf.focus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);Nf.revert(),Nf.defocus(),b(d.classed(g.focused,!0)),b(e),le(Nf.data.targets)&&Rb(a,!0),Df(a,!0)},Nf.defocus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",.3)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);Nf.revert(),b(d.classed(g.focused,!1)),b(e),le(Nf.data.targets)&&Sb(a),Df(a,!1)},Nf.revert=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);b(d.classed(g.focused,!1)),b(e),le(Nf.data.targets)&&Sb(a),Ef()},Nf.show=function(a,b){a=Hc(a),b=b||{},Pc(a),Aj.selectAll(td(a)).transition().style("opacity",1),b.withLegend&&Ff(a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Nf.hide=function(a,b){a=Hc(a),b=b||{},Oc(a),Aj.selectAll(td(a)).transition().style("opacity",0),b.withLegend&&Gf(a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Nf.toggle=function(a){Jc(a)?Nf.hide(a):Nf.show(a)},Nf.unzoom=function(){vj.clear().update(),qf({withUpdateXDomain:!0})},Nf.load=function(a){return a.xs&&rc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Sg[b]=a.classes[b]}),"categories"in a&&Wi&&(Ah=a.categories,Jg.categories(Ah)),"cacheIds"in a&&fc(a.cacheIds)?void yf(hc(a.cacheIds),a.done):void("unload"in a?Af(Hc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){zf(a)}):zf(a))},Nf.unload=function(a,b){Af(Hc(a),function(){qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Nf.selected=function(a){return Mf.merge(Cj.selectAll("."+g.shapes+rd(a)).selectAll("."+g.shape).filter(function(){return Mf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Nf.select=function(a,b,c){ch&&Cj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Mf.select(this),i=e.data?e.data.id:e.id,j=Se(this),k=dh||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);h.classed(g.line)||h.classed(g.area)||(k&&l?eh(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},Nf.unselect=function(a,b){ch&&Cj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Mf.select(this),f=c.data?c.data.id:c.id,h=Se(this),i=dh||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);e.classed(g.line)||e.classed(g.area)||i&&j&&eh(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Nf.toLine=function(a){Lf(a,"line")},Nf.toSpline=function(a){Lf(a,"spline")},Nf.toBar=function(a){Lf(a,"bar")},Nf.toScatter=function(a){Lf(a,"scatter")},Nf.toArea=function(a){Lf(a,"area")},Nf.toAreaSpline=function(a){Lf(a,"area-spline")},Nf.toPie=function(a){Lf(a,"pie",{withTransform:!0})},Nf.toDonut=function(a){Lf(a,"donut",{withTransform:!0})},Nf.groups=function(a){return c(a)?Tg:(Tg=a,qf(),Tg)},Nf.xgrids=function(a){return a?(hi=a,qf(),hi):hi},Nf.xgrids.add=function(a){return a?Nf.xgrids(hi.concat(a)):void 0},Nf.xgrids.remove=function(a){var b=Kf(a);return Nf.xgrids(hi.filter(b))},Nf.ygrids=function(a){return a?(ji=a,qf(),ji):ji},Nf.ygrids.add=function(a){return a?Nf.ygrids(ji.concat(a)):void 0},Nf.ygrids.remove=function(a){var b=Kf(a);return Nf.ygrids(ji.filter(b))},Nf.regions=function(a){return a?(Hi=a,qf(),Hi):Hi},Nf.regions.add=function(a){return a?(Hi=Hi.concat(a),qf(),Hi):Hi},Nf.regions.remove=function(a){var b,c,d;return a=a||{},b=Je(a,"duration",cg),c=Je(a,"classes",[g.region]),d=Cj.select("."+g.regions).selectAll(c.map(function(a){return"."+a})),(b?d.transition().duration(b):d).style("opacity",0).remove(),Hi=Hi.filter(function(a){return c.indexOf(a.class)<0})},Nf.data.get=function(a){var b=Nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Nf.data.getAsTarget=function(a){var b=Nf.data.targets.filter(function(b){return b.id===a});return b.length>0?b[0]:void 0},Nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Rg[b]=a[b]}),qf({withLegend:!0}),Rg):Rg},Nf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){_g[b]=a[b]}),qf({withLegend:!0}),_g):_g},Nf.x=function(a){return arguments.length&&(uc(Nf.data.targets,a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Nf.data.xs},Nf.xs=function(a){return arguments.length&&(vc(Nf.data.targets,a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Nf.data.xs},Nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){gb(b,a[b])}),Ib())},Nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Jh=+a.x),b(a.y)&&(Qh=+a.y),b(a.y2)&&(Zh=+a.y2)):Qh=Zh=+a,qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Kh=+a.x),b(a.y)&&(Rh=+a.y),b(a.y2)&&($h=+a.y2)):Rh=$h=+a,qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Nf.axis.max(a.max),"undefined"!=typeof a.min&&Nf.axis.min(a.min))},Nf.legend.show=function(a){Ff(Hc(a)),qf({withLegend:!0})},Nf.legend.hide=function(a){Gf(Hc(a)),qf({withLegend:!0})},Nf.resize=function(a){Qf=a?a.width:null,Rf=a?a.height:null,wf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Nf.destroy=function(){Nf.data.targets=void 0,Nf.data.xs={},Gj.html(""),a.onresize=null},"url"in f.data)Mf.xhr(f.data.url,function(a,b){var c,d=Mf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Mf.csv.parse(b.response),hf(c)});else if("rows"in f.data)hf(xc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");hf(yc(f.data.columns))}return Nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(window); \ No newline at end of file From 358bd15640643bc6578b60aa02142adb92a26edf Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Sat, 10 May 2014 22:38:57 +0900 Subject: [PATCH 167/178] Fix selection by drag --- c3.js | 23 +++++++++++++---------- c3.min.js | 2 +- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/c3.js b/c3.js index 8b0f5fe..3ce1bda 100644 --- a/c3.js +++ b/c3.js @@ -2954,17 +2954,17 @@ main.selectAll('.' + CLASS.shapes).selectAll('.' + CLASS.shape) .filter(function (d) { return __data_selection_isselectable(d); }) .each(function (d, i) { - var _this = d3.select(this), - isSelected = _this.classed(CLASS.SELECTED), - isIncluded = _this.classed(CLASS.INCLUDED), + var shape = d3.select(this), + isSelected = shape.classed(CLASS.SELECTED), + isIncluded = shape.classed(CLASS.INCLUDED), _x, _y, _w, _h, toggle, isWithin = false, box; - if (this.nodeName === 'circle') { - _x = _this.attr("cx") * 1; - _y = _this.attr("cy") * 1; + if (shape.classed(CLASS.circle)) { + _x = shape.attr("cx") * 1; + _y = shape.attr("cy") * 1; toggle = togglePoint; isWithin = minX < _x && _x < maxX && minY < _y && _y < maxY; } - else if (this.nodeName === 'path') { + else if (shape.classed(CLASS.bar)) { box = getPathBox(this); _x = box.x; _y = box.y; @@ -2972,12 +2972,15 @@ _h = box.height; toggle = toggleBar; isWithin = !(maxX < _x || _x + _w < minX) && !(maxY < _y || _y + _h < minY); + } else { + // line/area selection not supported yet + return; } if (isWithin ^ isIncluded) { - _this.classed(CLASS.INCLUDED, !isIncluded); + shape.classed(CLASS.INCLUDED, !isIncluded); // TODO: included/unincluded callback here - _this.classed(CLASS.SELECTED, !isSelected); - toggle(!isSelected, _this, d, i); + shape.classed(CLASS.SELECTED, !isSelected); + toggle(!isSelected, shape, d, i); } }); } diff --git a/c3.min.js b/c3.min.js index ba6351b..cc4318a 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ !function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.round(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.round(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&a=0;return"url("+(c?"":document.URL.split("#")[0])+"#"+b+")"}function k(a){return Math.ceil(a)+.5}function l(a,b){var c,d,e;b&&b.axisX?c=b.axisX:(c=Cj.select("."+g.axisX),a&&(c=c.transition())),b&&b.axisY?d=b.axisY:(d=Cj.select("."+g.axisY),a&&(d=d.transition())),b&&b.axisY2?e=b.axisY2:(e=Cj.select("."+g.axisY2),a&&(e=e.transition())),Cj.attr("transform",mj.main),c.attr("transform",mj.x),d.attr("transform",mj.y),e.attr("transform",mj.y2),Cj.select("."+g.chartArcs).attr("transform",mj.arc)}function m(a,b){var c;b&&b.axisSubX?c=b.axisSubX:(c=Dj.select("."+g.axisX),a&&(c=c.transition())),Dj.attr("transform",mj.context),c.attr("transform",mj.subx)}function n(a){(a?Ej.transition():Ej).attr("transform",mj.legend)}function o(a,b){l(a,b),nh&&m(a,b),n(a)}function p(){var a=U(),b=T(),c=nj?0:a,d=le(Nf.data.targets),e=wh||d?0:A("x"),f=nh&&!d?oh+e:0;kg=t(),lg=u(),wh?(dg={top:A("y2")+v(),right:d?0:y(),bottom:A("y")+c+w(),left:f+(d?0:x())},eg={top:dg.top,right:0/0,bottom:20+c,left:sj}):(dg={top:4+v(),right:d?0:y(),bottom:e+f+c+w(),left:d?0:x()},eg={top:lg-f-c,right:0/0,bottom:e+c,left:dg.left}),fg={top:nj?0:lg-a,right:0/0,bottom:0,left:nj?kg-b:0},gg=kg-dg.left-dg.right,ig=lg-dg.top-dg.bottom,0>gg&&(gg=0),0>ig&&(ig=0),hg=wh?dg.left-sj-tj:gg,jg=wh?ig:lg-eg.top-eg.bottom,0>hg&&(hg=0),0>jg&&(jg=0),pg=gg-(nj?b+10:0),qg=ig-(nj?0:10),r(),nj&&d&&(fg.left=pg/2+1.1*ng)}function q(){Cj.select("line."+g.xgridFocus).attr("x1",wh?0:-10).attr("x2",wh?gg:-10).attr("y1",wh?-10:dg.top).attr("y2",wh?-10:ig)}function r(){ng=Math.min(pg,qg)/2,mg=.95*ng,og=ke(Nf.data.targets)?.6*mg:0}function s(){var a=wh?g.axisX:g.axisY,b=Cj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Gj.node().getBoundingClientRect(),e=le(Nf.data.targets),f=c.right-d.left-(e?0:x());return f>0?f:0}function t(){return Qf?Qf:B()}function u(){var a=Rf?Rf:C();return a>0?a:320}function v(){return Uf?Uf:0}function w(){return Vf?Vf:0}function x(){return Sf?Sf:wh?xh?Ke(z("x")):1:!Ph||Uh?1:Ke(z("y"))}function y(){var a=10,b=nj?T()+20:0;return Tf?Tf:wh?a+b:(!Yh||bi?a:Ke(z("y2")))+b}function z(a){var b=ob(a);return b.isInner?20+Hb(a):40+Hb(a)}function A(a){return"x"!==a||xh?"x"===a&&Mh?Mh:"y"!==a||Ph?"y2"!==a||Yh?(ob(a).isInner?30:40)+("y2"===a?-10:0):uj:qh&&!nj?10:1:0}function B(){return+Gj.style("width").replace("px","")}function C(){return+Gj.style("height").replace("px","")}function D(a){return a?-31:-(dg.left-1)}function E(a){return a?-20:-4}function F(){return D(!wh)}function G(){return E(!wh)}function H(){return D(wh)}function I(){return E(wh)}function J(a){return a?gg+2+30+30:dg.left+20}function K(a){return a?(Mh?Mh:0)+80:ig+8}function L(){return J(!wh)}function M(){return K(!wh)}function N(){return J(wh)}function O(){return K(wh)}function P(){var a,b,c,d,e,f=Ec(Nf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=Dg(b.x)-Dg(a.x),0===c?wh?ig:gg:(d=Dc(),e=he(Nf.data.targets)?(d-(Wi?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function Q(a){oj=a}function R(a){pj=a}function S(a){qj=a}function T(){return qh?nj?pj*(oj+1):kg:0}function U(){return qh?nj?lg:qj*(oj+1):0}function V(){var a,b,c=!Dg;vg=wh?1:0,wg=wh?ig:gg,xg=wh?0:ig,yg=wh?gg:1,zg=vg,Ag=wg,Bg=wh?0:jg,Cg=wh?hg:1,Dg=Y(vg,wg,c?void 0:Dg.domain(),function(){return Jg.tickOffset()}),Eg=Z(xg,yg,c?void 0:Eg.domain()),Fg=Z(xg,yg,c?void 0:Fg.domain()),Gg=Y(vg,wg,Hj,function(a){return a%1?0:Mg.tickOffset()}),Hg=Z(Bg,Cg,c?void 0:Hg.domain()),Ig=Z(Bg,Cg,c?void 0:Ig.domain()),a=db(),b=Hh?Hh:c?void 0:Jg.tickValues(),Jg=ab(Dg,ij,a,b),Mg=ab(Gg,lj,a,b),Kg=bb(Eg,jj,Vh,Xh),Lg=bb(Fg,kj,ci,ei),c||(vj.scale(Gg),Wf&&zj.scale(Dg)),W()}function W(){rg=Kb(),sg=Lb(),tg=Lb(.98)}function X(a,b,c){return(c?Mf.time.scale():Mf.scale.linear()).range([a,b])}function Y(a,b,c,d){var e,f=X(a,b,Vi),g=c?f.domain(c):f;Wi?(d=d||function(){return 0},f=function(a,b){var c=g(a)+d(a);return b?c:Math.ceil(c)}):f=function(a,b){var c=g(a);return b?c:Math.ceil(c)};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return Hj&&Hj[0]===a[0]&&Hj[1]a?a.toFixed(0):a};return Ch&&("function"==typeof Ch?a=Ch:Vi&&(a=function(a){return a?dj(Ch)(a):""})),a}function eb(a){var b;return"y"===a?b=Th:"y2"===a?b=ai:"x"===a&&(b=Oh),b}function fb(a){var b=eb(a);return"string"==typeof b?b:b?b.text:null}function gb(a,b){var c=eb(a);"string"==typeof c?"y"===a?Th=b:"y2"===a?ai=b:"x"===a&&(Oh=b):c&&(c.text=b)}function hb(a){return 10*Math.sin(Math.PI*(a/180))}function ib(a){return 11.5-2.5*(a/15)}function jb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",ib(c)).attr("x",hb(c)).attr("transform","rotate("+c+")")}function kb(a,b){var c=eb(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 lb(){return kb("x",wh?"inner-top":"inner-right")}function mb(){return kb("y",wh?"inner-right":"inner-top")}function nb(){return kb("y2",wh?"inner-right":"inner-top")}function ob(a){return"y2"===a?nb():"y"===a?mb():lb()}function pb(){return fb("x")}function qb(){return fb("y")}function rb(){return fb("y2")}function sb(a,b){return a?b.isLeft?0:b.isCenter?gg/2:gg:b.isBottom?-ig:b.isMiddle?-ig/2:0}function tb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function ub(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function vb(){return sb(!wh,lb())}function wb(){return sb(wh,mb())}function xb(){return sb(wh,nb())}function yb(){return tb(!wh,lb())}function zb(){return tb(wh,mb())}function Ab(){return tb(wh,nb())}function Bb(){var a=lb();return wh?a.isInner?"1.2em":-25-Hb("x"):a.isInner?"-0.5em":Mh?Mh-10:"3em"}function Cb(){var a=mb();return wh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Hb("y")}function Db(){var a=nb();return wh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Hb("y2")}function Eb(){return ub(!wh,lb())}function Fb(){return ub(wh,mb())}function Gb(){return ub(wh,nb())}function Hb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Ib(a){var b=Cj.select("."+g.axisX+" ."+g.axisXLabel),c=Cj.select("."+g.axisY+" ."+g.axisYLabel),d=Cj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",vb).attr("dx",yb).attr("dy",Bb).text(pb),(a?c.transition():c).attr("x",wb).attr("dx",zb).attr("dy",Cb).attr("dy",Cb).text(qb),(a?d.transition():d).attr("x",xb).attr("dx",Ab).attr("dy",Db).text(rb)}function Jb(a){var b=!1;return ug(Lc(Nf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Kb(){var a=Mf.svg.arc().outerRadius(mg).innerRadius(og),b=function(b,c){var d;return c?a(b):(d=Jb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Lb(a){var b=Mf.svg.arc().outerRadius(ng*(a?a:1)).innerRadius(og);return function(a){var c=Jb(a);return c?b(c):"M 0 0"}}function Mb(a,b){return se(a.data)?rg(a,b):"M 0 0"}function Nb(a){var b,c,d,e,f=Jb(a),g="";return f&&(b=rg.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*mg*.8+","+d/e*mg*.8+")"),g}function Ob(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Pb(a){return tc({id:a.data.id,value:a.value,ratio:Ob(a)})}function Qb(a){var b,c,d,e;return Tb()?(b=Jb(a),c=b?b.value:null,d=Ob(b),e=Ub(),e?e(c,d):Gd(c,d)):""}function Rb(a,b){var c=Aj.selectAll("."+g.chartArc+sd(a)),d=Aj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});ye(a)&&c.selectAll("path").transition().duration(50).attr("d",sg).transition().duration(100).attr("d",tg).each(function(a){re(a.data)}),b||d.style("opacity",.3)}function Sb(a){var b=Aj.selectAll("."+g.chartArc+sd(a));b.selectAll("path").transition().duration(50).attr("d",rg),Aj.selectAll("."+g.arc).style("opacity",1)}function Tb(){return ke(Nf.data.targets)?Ai:ui}function Ub(){return ke(Nf.data.targets)?Bi:vi}function Vb(){return ke(Nf.data.targets)?Di:""}function Wb(){var a=ke(Nf.data.targets)?Ei:xi;return"function"==typeof a?a:function(){}}function Xb(){var a=ke(Nf.data.targets)?Fi:yi;return"function"==typeof a?a:function(){}}function Yb(){var a=ke(Nf.data.targets)?Gi:zi;return"function"==typeof a?a:function(){}}function Zb(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Tg.length>0)for(g=Uc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return Mf.min(Object.keys(i).map(function(a){return Mf.min(i[a])}))}function $b(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Tg.length>0)for(g=Vc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return Mf.max(Object.keys(i).map(function(a){return Mf.max(i[a])}))}function _b(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return cb(a.id)===c}),m="y2"===c?$h:Rh,n="y2"===c?Zh:Qh,o=b(m)?m:Zb(l),p=b(n)?n:$b(l),q="y2"===c?_h:Sh,r=Ad()&&wh;return 0===l.length?"y2"===c?Fg.domain():Eg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=Bd(o,p),j=ec(Eg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Wh&&(f=b(Wh.top)?Wh.top:e,g=b(Wh.bottom)?Wh.bottom:e),"y2"===c&&di&&(f=b(di.top)?di.top:e,g=b(di.bottom)?di.bottom:e),he(l)&&!Uc(l)&&(g=o),[o-g,p+f])}function ac(a){return Kh?Vi?Ae(Kh):Kh:Mf.min(a,function(a){return Mf.min(a.values,function(a){return a.x})})}function bc(a){return Jh?Vi?Ae(Jh):Jh:Mf.max(a,function(a){return Mf.max(a.values,function(a){return a.x})})}function cc(a){var c,d,e,f,g=Fc(a),h=g[1]-g[0];return Wi?d=0:he(a)?(c=Dc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Lh&&Fe(Lh)?(e=b(Lh.left)?Lh.left:d,f=b(Lh.right)?Lh.right:d):e=f="number"==typeof Lh?Lh:d,{left:e,right:f}}function dc(a){var b=[ac(a),bc(a)],c=b[0],d=b[1],e=cc(a),f=0,g=0;return c-d!==0||Wi||(c=Vi?new Date(.5*c.getTime()):-.5,d=Vi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ec(a){return a[1]-a[0]}function fc(a){for(var b=0;bb?0:b-c}function lc(a){var b,c=jc(a),d="y"===a.axis?Eg:Fg;return b="y"===a.axis||"y2"===a.axis?wh?ig:"start"in a?d(a.start):ig:wh?"end"in a?Dg(Vi?Ae(a.end):a.end):ig:ig,c>b?0:b-c}function mc(a){return Ng&&a===Ng||Fe(Og)&&Ge(Og,a)}function nc(a){return!mc(a)}function oc(a){return Ng?Ng:Fe(Og)?Og[a]:null}function pc(a,b){var c,d=b&&Fe(b)?Gc(b):[];return d.forEach(function(b){oc(b)===a&&(c=Nf.data.xs[b])}),c}function qc(a,b){return a in Nf.data.xs&&Nf.data.xs[a]&&Nf.data.xs[a][b]?Nf.data.xs[a][b]:b}function rc(a){Object.keys(a).forEach(function(b){Og[b]=a[b]})}function sc(a){return 1===Mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function tc(a){var b;return a&&(b=Rg[a.id],a.name=b?b:a.id),a}function uc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=wc(b[d],a.id,d)}),Nf.data.xs[a.id]=b})}function vc(a,b){a.forEach(function(a){b[a.id]&&uc([a],b[a.id])})}function wc(a,c,d){var e;return e=Vi?a?a instanceof Date?a:Ae(a):Ae(qc(c,d)):Xi&&!Wi?b(a)?+a:qc(c,d):d}function xc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Ng?(d=Object.keys(Nf.data.xs),Nf.data.xs[c]=d.length>0?Nf.data.xs[d[0]]:void 0):Fe(Og)&&(Nf.data.xs[c]=pc(f,Nf.data.targets)):Nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Qg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=oc(b),g=a[f],h=wc(g,b,e);return Xi&&Wi&&0===c&&g&&(0===e&&(Ah=[]),Ah.push(g)),("undefined"==typeof a[b]||Nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Vg&&fe(Gc(c).filter(function(a){return!(a in Wg)}),Vg),c.forEach(function(a){gc(a.id_org,a)}),c}function Ac(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 Bc(a){return a>0&&Nf.data.targets[0].values[a-1]?Nf.data.targets[0].values[a-1].x:void 0}function Cc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Fc(a){var b,c,d=Ec(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Gc(a){return a.map(function(a){return a.id})}function Hc(a){return a?"string"==typeof a?[a]:a:Gc(Nf.data.targets)}function Ic(a,b){var c,d=Gc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Vi?new Date(i):i);j.push(e)}return Vi||(j=j.sort(function(a,b){return a-b})),j}function Oc(a){fj=fj.concat(a)}function Pc(a){fj=fj.filter(function(b){return a.indexOf(b)<0})}function Qc(a){gj=gj.concat(a)}function Rc(a){gj=gj.filter(function(b){return a.indexOf(b)<0})}function Sc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Tc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Vc(a){return Tc(a,function(a){return a>0})}function Wc(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||0===a[f].x)&&(e=e.concat(Md(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Md(a,g))),Pd(e,b)):Nd(a,b,f,g)}function Od(a,b){var c;return c=a.map(function(a){return Nd(a.values,b)}),Pd(c,b)}function Pd(a,b){var c,d;return a.forEach(function(a){var e=He(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Qd(a,b){return Mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Rd(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 Sd(){return Yg&&"desc"===Yg.toLowerCase()}function Td(){return Yg&&"asc"===Yg.toLowerCase()}function Ud(a){var b=Td(),c=Sd();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 Yg&&a.sort(Yg),a}function Vd(a,c){var d,e,f,g,h,i,j,k=le(Nf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&Ii&&(Fj.html(Li(a,db(),Cd(k),cj)).style("display","block"),d=Fj.property("offsetWidth"),e=Fj.property("offsetHeight"),k?(g=gg/2+c[0],i=ig/2+c[1]+20):(wh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-y(),i=Dg(l[0].x)+20):(f=s(),g=f+x()+Dg(l[0].x)+20,h=g+d,j=f+t()-y(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),Fj.style("top",i+"px").style("left",g+"px"))}function Wd(){Fj.style("display","none")}function Xd(a){var c=a.filter(function(a){return a&&b(a.value)});if(Ii&&!ie(Nf.data.targets)&&!le(Nf.data.targets)){var d=Cj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(wh?"y1":"x1",Id).attr(wh?"y2":"x2",Id),pf(d,"grid")}}function Yd(){Cj.select("line."+g.xgridFocus).style("visibility","hidden")}function Zd(a,b){var c,d,e,f,h=[],i=Cj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=dc(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function $d(a){return a.x||0===a.x?Dg(a.x):null}function _d(a){return $(a.id)(a.value)}function ae(){var a,b,d={},e=0;return Lc(Nf.data.targets.filter(oe)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ee(a,b){return"number"==typeof si?si:b?2*a.tickOffset()*ti/b:0}function fe(a,b){Hc(a).forEach(function(a){Jj[a]=b===Wg[a],Wg[a]=b})}function ge(a,b){var c=!1;return a.forEach(function(a){Wg[a.id]===b&&(c=!0),a.id in Wg||"line"!==b||(c=!0)}),c}function he(a){return ge(a,"bar")}function ie(a){return ge(a,"scatter")}function je(a){return ge(a,"pie")}function ke(a){return ge(a,"donut")}function le(a){return je(a)||ke(a)}function me(a){var b="string"==typeof a?a:a.id;return!(b in Wg)||"line"===Wg[b]||"spline"===Wg[b]||"area"===Wg[b]||"area-spline"===Wg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"spline"===Wg[b]||"area-spline"===Wg[b]}function oe(a){var b="string"==typeof a?a:a.id;return"bar"===Wg[b]}function pe(a){var b="string"==typeof a?a:a.id;return"scatter"===Wg[b]}function qe(a){var b="string"==typeof a?a:a.id;return"pie"===Wg[b]}function re(a){var b="string"==typeof a?a:a.id;return"donut"===Wg[b]}function se(a){return qe(a)||re(a)}function te(a){return me(a)?[a]:[]}function ue(a){return se(a.data)?[a]:[]}function ve(a){return oe(a)?a.values:[]}function we(a){return me(a)||pe(a)?a.values:[]}function xe(a){return oe(a)||me(a)?a.values:[]}function ye(a){return re(a)&&Ci||qe(a)&&wi}function ze(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function Ae(b){var c;try{c=Pg?Mf.time.format(Pg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Pg)}return c}function Be(a,b){var c=Mf.mouse(a),d=Mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ge(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function He(a,b){var c="y"===cb(a.id)?Eg:Fg,d=wh?1:0,e=wh?0:1;return Math.pow(Dg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ie(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Je(a,b,c){return d(a[b])?a[b]:c}function Ke(a){return 10*Math.ceil(a/10)}function Le(a,b,c){jh(b,a.node()),Cj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Xc(g.selectedCircle,c)}).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d).attr("stroke",function(){return cj(b)}).attr("r",1.4*We(b)).transition().duration(100).attr("r",We)}function Me(a,b,c){kh(b,a.node()),Cj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ne(a,b,c,d){a?Le(b,c,d):Me(b,c,d)}function Oe(a,b){jh(b,a.node()),a.transition().duration(100).style("fill",function(){return Mf.rgb(cj(b)).brighter(.75)})}function Pe(a,b){kh(b,a.node()),a.transition().duration(100).style("fill",function(){return cj(b)})}function Qe(a,b,c,d){a?Oe(b,c,d):Pe(b,c,d)}function Re(a,b,c,d){Qe(a,b,c.data,d)}function Se(a){return"circle"===a.nodeName?Ne:Mf.select(a).classed(g.bar)?Qe:Re}function Te(a){return a.filter(function(a){return b(a.value)})}function Ue(a){return li?"function"==typeof mi?mi(a):mi:0}function Ve(a){return oi?pi?pi:1.75*Ue(a):Ue(a)}function We(a){return qi?qi:4*Ue(a)}function Xe(a,c){return(c?Cj.selectAll("."+g.circles+rd(c)):Cj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ye(a,b){Xe(a,b).classed(g.EXPANDED,!0).attr("r",Ve)}function Ze(a){Xe(a).filter(function(){return Mf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Ue)}function $e(a){return Cj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function _e(a){$e(a).classed(g.EXPANDED,!0)}function af(a){$e(a).classed(g.EXPANDED,!1)}function bf(a,b){var c=ff(a,b);return function(a,b){var d=c(a,b),e=wh?1:0,f=wh?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 cf(a,b){var c=ff(a,!1),d=b?df:ef;return function(a,b){return d(c(a,b),a,this)}}function df(a,b){var c;return wh?(c=oe(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function ef(a,b,c){var d=c.getBoundingClientRect();return wh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:oe(b)?-3:-6)}function ff(a,b){var c=a.__max__+1,d=ee(Jg,c),e=be(d,c,a,!!b),f=ce(!!b),g=de(a,!!b),h=b?_:$;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return wh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function gf(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function hf(b){var c,d,e;if(Gj=Mf.select(Pf),Gj.empty())throw new Error("Element to bind not found");if(Gj.html("").classed("c3",!0),Nf.data.xs={},Nf.data.targets=zc(b),bh&&(Nf.data.targets=Nf.data.targets.filter(bh)),ah&&Oc(ah===!0?Gc(Nf.data.targets):ah),p(),V(),Dg.domain(Mf.extent(dc(Nf.data.targets))),Eg.domain(_b(Nf.data.targets,"y")),Fg.domain(_b(Nf.data.targets,"y2")),Gg.domain(Dg.domain()),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Hj=Dg.domain(),vj.scale(Gg),Wf&&zj.scale(Dg),Aj=Gj.append("svg").style("overflow","hidden").on("mouseenter",$f).on("mouseleave",_f),Bj=Aj.append("defs"),Bj.append("clipPath").attr("id",Pi).append("rect"),Bj.append("clipPath").attr("id",Qi).append("rect"),Bj.append("clipPath").attr("id",Ri).append("rect"),uf(),Cj=Aj.append("g").attr("transform",mj.main),Dj=Aj.append("g").attr("transform",mj.context),Ej=Aj.append("g").attr("transform",mj.legend),nh||Dj.style("visibility","hidden"),qh||(Ej.style("visibility","hidden"),gj=Gc(Nf.data.targets)),Fj=Gj.style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Hf(Gc(Nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=Cj.append("g").attr("clip-path",Si).attr("class",g.grid),fi&&d.append("g").attr("class",g.xgrids),Fe(hi)&&d.append("g").attr("class",g.xgridLines),ni&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),ii&&d.append("g").attr("class",g.ygrids),Fe(ji)&&d.append("g").attr("class",g.ygridLines),Cj.append("g").attr("clip-path",Si).attr("class",g.regions),Cj.append("g").attr("clip-path",Si).attr("class",g.chart),c=Cj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Wf?wh?"ns-resize":"ew-resize":null),Cj.select("."+g.chart).append("g").attr("class",g.chartBars),Cj.select("."+g.chart).append("g").attr("class",g.chartLines),Cj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",mj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Vb()),Cj.select("."+g.chart).append("g").attr("class",g.chartTexts),Wf&&Cj.insert("rect",Yf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",gg).attr("height",ig).style("opacity",0).style("cursor",wh?"ns-resize":"ew-resize").call(zj).on("dblclick.zoom",null),Nh&&vj.extent("function"!=typeof Nh?Nh:Nh(dc())),hj.x=Cj.append("g").attr("class",g.axisX).attr("clip-path",Ti).attr("transform",mj.x).style("visibility",xh?"visible":"hidden"),hj.x.append("text").attr("class",g.axisXLabel).attr("transform",wh?"rotate(-90)":"").style("text-anchor",Eb),hj.y=Cj.append("g").attr("class",g.axisY).attr("clip-path",Ui).attr("transform",mj.y).style("visibility",Ph?"visible":"hidden"),hj.y.append("text").attr("class",g.axisYLabel).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Fb),hj.y2=Cj.append("g").attr("class",g.axisY2).attr("transform",mj.y2).style("visibility",Yh?"visible":"hidden"),hj.y2.append("text").attr("class",g.axisY2Label).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Gb),Dj.append("g").attr("clip-path",Si).attr("class",g.chart),Dj.select("."+g.chart).append("g").attr("class",g.chartBars),Dj.select("."+g.chart).append("g").attr("class",g.chartLines),Dj.append("g").attr("clip-path",Si).attr("class",g.brush).call(vj).selectAll("rect").attr(wh?"width":"height",wh?hg:jg),hj.subx=Dj.append("g").attr("class",g.axisX).attr("transform",mj.subx).attr("clip-path",wh?"":Ti),xf(Nf.data.targets),qf({withUpdateTranslate:!0,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Mi){if(Vi&&"string"==typeof Ni){for(Ni=Ae(Ni),e=0;e0){d=[];for(var f in Rg)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Rd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Qe,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function nf(a){le(Nf.data.targets)||ch&&(Yi=a,Cj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Zi=!0,lh())}function of(){le(Nf.data.targets)||ch&&(Cj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),Cj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Zi=!1,mh())}function pf(a,b){"grid"===b&&a.each(function(){var a=Mf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function qf(a,c){var d,e,f,h,i,j,k,l,m,n,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,Q,R,S,T,U,W,X,Y,Z,$=ae(),_=le(Nf.data.targets),ab=Lc(Nf.data.targets);if(a=a||{},E=Je(a,"withY",!0),F=Je(a,"withSubchart",!0),G=Je(a,"withTransition",!0),J=Je(a,"withTransform",!1),K=Je(a,"withUpdateXDomain",!1),L=Je(a,"withUpdateOrgXDomain",!1),N=Je(a,"withUpdateTranslate",!1),M=Je(a,"withLegend",!1),H=Je(a,"withTransitionForExit",G),I=Je(a,"withTransitionForAxis",G),T=G?cg:0,U=H?T:0,W=I?T:0,c=c||vf(W),N&&(wh?(hj.x.call(Jg),hj.subx.call(Mg)):(hj.y.call(Kg),hj.y2.call(Lg)),p(),V(),uf(),o(!1)),M&&qh&&Hf(Gc(Nf.data.targets),a,c),Wi&&0===ab.length&&Dg.domain([0,hj.x.selectAll(".tick").size()]),ab.length&&(L&&(Dg.domain(Mf.extent(dc(ab))),Hj=Dg.domain(),Wf&&zj.scale(Dg).updateScaleExtent(),Gg.domain(Dg.domain()),vj.scale(Gg)),K&&(Dg.domain(vj.empty()?Hj:vj.extent()),Wf&&zj.scale(Dg).updateScaleExtent()),Hh||!Gh&&!Fh||(X=Nc(Mc(ab),Fh),Jg.tickValues(X),Mg.tickValues(X))),Eg.domain(_b(ab,"y")),Fg.domain(_b(ab,"y2")),hj.x.style("opacity",_?0:1),hj.y.style("opacity",_?0:1),hj.y2.style("opacity",_?0:1),hj.subx.style("opacity",_?0:1),c.axisX.call(Jg),c.axisY.call(Kg),c.axisY2.call(Lg),c.axisSubX.call(Mg),Ib(G),K&&ab.length)if(Dh&&X){for(Y=1;Y=0&&Mf.select(this).style("display",b%Z?"none":"block")})}else Aj.selectAll("."+g.axisX+" .tick text").style("display","block");!wh&&Ih&&jb(hj.x,c.axisX,Ih),O=bf($),R=cf($,!0),S=cf($,!1),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Fj.style("display","none"),q(),Cj.select("line."+g.xgridFocus).style("visibility","hidden"),fi&&(f=Zd(gi,Dg),B=Wi?Jg.tickOffset():0,e=wh?{x1:0,x2:gg,y1:function(a){return Dg(a)-B},y2:function(a){return Dg(a)-B}}:{x1:function(a){return Dg(a)+B},x2:function(a){return Dg(a)+B},y1:dg.top,y2:ig},d=Cj.select("."+g.xgrids).selectAll("."+g.xgrid).data(f),d.enter().append("line").attr("class",g.xgrid),d.attr(e).style("opacity",function(){return+Mf.select(this).attr(wh?"y1":"x1")===(wh?ig:0)?0:1}),d.exit().remove()),Fe(hi)&&(h=Cj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(hi),i=h.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),i.append("line").style("opacity",0),i.append("text").attr("text-anchor","end").attr("transform",wh?"":"rotate(-90)").attr("dx",wh?0:-dg.top).attr("dy",-5).style("opacity",0),h.select("line").transition().duration(T).attr("x1",wh?0:Jd).attr("x2",wh?gg:Jd).attr("y1",wh?Jd:dg.top).attr("y2",wh?Jd:ig).style("opacity",1),h.select("text").transition().duration(T).attr("x",wh?gg:0).attr("y",Jd).text(function(a){return a.text}).style("opacity",1),h.exit().transition().duration(T).style("opacity",0).remove()),E&&ii&&(j=Cj.select("."+g.ygrids).selectAll("."+g.ygrid).data(Eg.ticks(ki)),j.enter().append("line").attr("class",g.ygrid),j.attr("x1",wh?Eg:0).attr("x2",wh?Eg:gg).attr("y1",wh?0:Eg).attr("y2",wh?ig:Eg),j.exit().remove(),pf(j,"grid")),E&&Fe(ji)&&(k=Cj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(ji),l=k.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",wh?"rotate(-90)":"").attr("dx",wh?0:-dg.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",wh?Kd:0).attr("x2",wh?Kd:gg).attr("y1",wh?0:Kd).attr("y2",wh?ig:Kd).style("opacity",1),k.select("text").transition().duration(T).attr("x",wh?0:gg).attr("y",Kd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),u=Cj.select("."+g.regions).selectAll("."+g.region).data(Hi),u.enter().append("g").attr("class",kd).append("rect").style("fill-opacity",0),u.selectAll("rect").transition().duration(T).attr("x",ic).attr("y",jc).attr("width",kc).attr("height",lc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),u.exit().transition().duration(T).style("opacity",0).remove(),s=Cj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),s.enter().append("path").attr("class",ed).style("stroke","none").style("fill",cj),s.style("opacity",wd).transition().duration(T).attr("d",O).style("fill",cj).style("opacity",1),s.exit().transition().duration(U).style("opacity",0).remove(),m=Cj.selectAll("."+g.lines).selectAll("."+g.line).data(te),m.enter().append("path").attr("class",ad).style("stroke",cj),m.style("opacity",wd).transition().duration(T).attr("d",wj).style("stroke",cj).style("opacity",1),m.exit().transition().duration(U).style("opacity",0).remove(),n=Cj.selectAll("."+g.areas).selectAll("."+g.area).data(te),n.enter().append("path").attr("class",id).style("fill",cj).style("opacity",function(){return Ij=+Mf.select(this).style("opacity"),0}),n.style("opacity",0).transition().duration(T).attr("d",xj).style("fill",cj).style("opacity",Ij),n.exit().transition().duration(U).style("opacity",0).remove(),r=Cj.selectAll("."+g.circles).selectAll("."+g.circle).data(we),r.enter().append("circle").attr("class",cd).attr("r",Ue).style("fill",cj),r.style("opacity",wd).transition().duration(T).style("opacity",yd).style("fill",cj).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d),r.exit().remove(),v=Cj.selectAll("."+g.texts).selectAll("."+g.text).data(xe),v.enter().append("text").attr("class",Yc).attr("text-anchor",function(a){return wh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",cj).style("fill-opacity",0),v.text(function(a){return Hd(a.id)(a.value,a.id)}).style("fill-opacity",xd).transition().duration(T).attr("x",R).attr("y",S).style("fill",cj).style("fill-opacity",zd),v.exit().transition().duration(U).style("fill-opacity",0).remove(),t=Cj.selectAll("."+g.arcs).selectAll("."+g.arc).data(ue),t.enter().append("path").attr("class",gd).style("fill",function(a){return cj(a.data)}).style("cursor",function(a){return eh(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;aj||(c=Jb(a),d=Pb(c),e=Xb(),Rb(c.data.id),Df(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Jb(a),c=Pb(b),d=[c];Vd(d,Mf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;aj||(c=Jb(a),d=Pb(c),e=Yb(),Sb(c.data.id),Ef(),Wd(),e(d,b))}).on("click",function(a,b){var c=Jb(a),d=Pb(c),e=Wb();lf(this,a,b),e(d,b)}),t.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){aj=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Jb(a);return c?(b=Mf.interpolate(this._current,c),this._current=b(0),function(a){return Mb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("fill",function(a){return cj(a.data)}).style("opacity",1).call(Ie,function(){aj=!1}),t.exit().transition().duration(U).style("opacity",0).remove(),Cj.selectAll("."+g.chartArc).select("text").attr("transform",Nb).style("opacity",0).transition().duration(T).text(Qb).style("opacity",function(a){return Jc(a.data.id)&&se(a.data)?1:0}),Cj.select("."+g.chartArcsTitle).style("opacity",ke(Nf.data.targets)?1:0),nh&&(Mf.event&&"zoom"===Mf.event.type&&vj.extent(Dg.orgDomain()).update(),F&&(!wh&&Ih&&jb(hj.subx,c.axisSubX,Ih),vj.empty()||vj.extent(Dg.orgDomain()).update(),Q=bf($,!0),x=Dj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),x.enter().append("path").attr("class",ed).style("stroke","none").style("fill",cj),x.style("opacity",wd).transition().duration(T).attr("d",Q).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove(),w=Dj.selectAll("."+g.lines).selectAll("."+g.line).data(te),w.enter().append("path").attr("class",ad).style("stroke",cj),w.style("opacity",wd).transition().duration(T).attr("d",yj).style("opacity",1),w.exit().transition().duration(T).style("opacity",0).remove())),Cj.selectAll("."+g.selectedCircles).filter(function(a){return oe(a)}).selectAll("circle").remove(),Cj.selectAll("."+g.selectedCircle).transition().duration(T).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d),Zf&&(y=Cj.select("."+g.eventRects),Fe(Og)&&!sc(Og)?(y.classed(g.eventRectsMultiple)||y.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),z=Cj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),kf(z.enter()),z.attr("x",0).attr("y",0).attr("width",gg).attr("height",ig)):(y.classed(g.eventRectsSingle)||y.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Xi&&!Wi?(D=function(a,b){var c=Bc(b),d=Cc(b),e=Nf.data.xs[a.id][b];return(Dg(d?d:e+50)-Dg(c?c:e-50))/2},C=function(a,b){var c=Bc(b),d=Nf.data.xs[a.id][b];return(Dg(d)+Dg(c?c:d-50))/2}):(D=P(),C=function(a){return Dg(a.x)-D/2}),A=Ec(Nf.data.targets),Cj.select("."+g.eventRects).datum(A?A.values:[]),z=Cj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),jf(z.enter()),z.attr("class",ld).attr("x",wh?0:C).attr("y",wh?C:0).attr("width",wh?gg:D).attr("height",wh?D:ig),z.exit().remove())),Gc(Nf.data.targets).forEach(function(a){Jj[a]=!0})}function rf(){qf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function sf(){if(0!==Lc(Nf.data.targets).length){if("mousemove"===Mf.event.sourceEvent.type&&zj.altDomain)return Dg.domain(zj.altDomain),void zj.scale(Dg).updateScaleExtent();Wi&&Dg.orgDomain()[0]===Hj[0]&&Dg.domain([Hj[0]-1e-10,Dg.orgDomain()[1]]),qf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Mf.event.sourceEvent.type&&($i=!0)}}function tf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function uf(){Aj.attr("width",kg).attr("height",lg),Aj.select("#"+Pi).select("rect").attr("width",gg).attr("height",ig),Aj.select("#"+Qi).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),Aj.select("#"+Ri).select("rect").attr("x",H).attr("y",I).attr("width",N).attr("height",O),Aj.select("."+g.zoomRect).attr("width",gg).attr("height",ig),Gj.style("max-height",lg+"px")}function vf(a){return{axisX:a?hj.x.transition().duration(a):hj.x,axisY:a?hj.y.transition().duration(a):hj.y,axisY2:a?hj.y2.transition().duration(a):hj.y2,axisSubX:a?hj.subx.transition().duration(a):hj.subx}}function wf(a){var b;a=a||{},a.withTransition=Je(a,"withTransition",!0),a.withTransform=Je(a,"withTransform",!1),a.withLegend=Je(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withLegend&&qh||(b=vf(a.withTransitionForAxis?cg:0),p(),V(),uf(),o(a.withTransition,b)),qf(a,b)}function xf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=Cj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",nd),j=i.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Zc),e=Cj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),d=e.enter().append("g").attr("class",pd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",fd).style("cursor",function(a){return eh(a)?"pointer":null}),c=Cj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),b=c.enter().append("g").attr("class",od).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",bd),b.append("g").attr("class",jd),b.append("g").attr("class",function(a){return Xc(g.selectedCircles,a.id)}),b.append("g").attr("class",dd).style("cursor",function(a){return eh(a)?"pointer":null}),a.forEach(function(a){Cj.selectAll("."+g.selectedCircles+rd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Cj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(ug(a)).attr("class",qd),f=h.enter().append("g").attr("class",qd),f.append("g").attr("class",hd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),nh&&(n=Dj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),m=n.enter().append("g").style("opacity",0).attr("class",pd),m.append("g").attr("class",fd),l=Dj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),k=l.enter().append("g").style("opacity",0).attr("class",od),k.append("g").attr("class",bd)),Aj.selectAll("."+g.target).filter(function(a){return Jc(a.id)}).transition().duration(cg).style("opacity",1)}function yf(a,b){b.filter&&(a=a.filter(b.filter)),(b.type||b.types)&&a.forEach(function(a){b.types?fe(a.id,b.types[a.id]):fe(a.id,b.type)}),Nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,z=0,F++)),E[a]=F,D[F]=f,A[a]=z,z+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+v)/10),j=10*Math.ceil((h.height+u)/10),k=nj?j:i,l=nj?U():T();return d&&(z=0,F=0,w=0,x=0),qh&&!Kc(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=i,C[c]=j,(!w||i>=w)&&(w=i),(!x||j>=x)&&(x=j),g=nj?x:w,void(vh?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(l-g*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=26,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=Ej.selectAll("."+g.legendItemFocused).size();b=b||{},n=Je(b,"withTransition",!0),q=Je(b,"withTransitionForTransform",!0),nj?(f=function(a){return w*E[a]},j=function(a){return D[E[a]]+A[a]}):(f=function(a){return D[E[a]]+A[a]},j=function(a){return x*E[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=Ej.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Xc(g.legendItem,a)}).style("visibility",function(a){return Kc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof sh?sh(a):Nf.toggle(a)}).on("mouseover",function(a){Mf.select(this).classed(g.legendItemFocused,!0),aj||Nf.focus(a),"function"==typeof th&&th(a)}).on("mouseout",function(a){Mf.select(this).classed(g.legendItemFocused,!1),aj||Nf.revert(),"function"==typeof uh&&uh(a)}),m.append("text").text(function(a){return d(Rg[a])?Rg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",nj?h:-200).attr("y",nj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",nj?i:-200).attr("y",nj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",cj).attr("x",nj?h:-200).attr("y",nj?-200:j).attr("width",10).attr("height",10),r=Ej.selectAll("text").data(a).text(function(a){return d(Rg[a])?Rg[a]:a}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=Ej.selectAll("rect."+g.legendItemEvent).data(a),(n?s.transition():s).attr("width",function(a){return B[a]}).attr("height",function(a){return C[a]}).attr("x",i).attr("y",l),t=Ej.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",cj).attr("x",f).attr("y",j),Ej.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Jc(a)}).transition().style("opacity",function(a){var b=Mf.select(this);return Jc(a)?!G||b.classed(g.legendItemFocused)?Bf(b):Cf(b):rj}),R(w),S(x),Q(F),p(),V(),uf(),o(q,c)}function If(a){return Ic(Nf.data.targets,a.id)}function Jf(a){return"data"in a&&Ic(Nf.data.targets,a.data.id)}function Kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function Lf(a,b,c){var d=!le(Nf.data.targets);aj=!1,fe(a,b),wf(c||{withTransitionForAxis:d})}var Mf=a.d3?a.d3:a.require?a.require("d3"):void 0,Nf={data:{},axis:{},legend:{}},Of={},Pf=i(["bindto"],"#chart"),Qf=i(["size","width"]),Rf=i(["size","height"]),Sf=i(["padding","left"]),Tf=i(["padding","right"]),Uf=i(["padding","top"]),Vf=i(["padding","bottom"]),Wf=i(["zoom","enabled"],!1),Xf=i(["zoom","extent"]),Yf=i(["zoom","privileged"],!1),Zf=i(["interaction","enabled"],!0),$f=i(["onenter"],function(){}),_f=i(["onleave"],function(){}),ag=i(["onresize"],function(){}),bg=i(["onresized"],function(){}),cg=i(["transition","duration"],350);h("data","data is required in config");var dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg,Kg,Lg,Mg,Ng=i(["data","x"]),Og=i(["data","xs"],{}),Pg=i(["data","x_format"]),Qg=i(["data","id_converter"],function(a){return a}),Rg=i(["data","names"],{}),Sg=i(["data","classes"],{}),Tg=i(["data","groups"],[]),Ug=i(["data","axes"],{}),Vg=i(["data","type"]),Wg=i(["data","types"],{}),Xg=i(["data","labels"],{}),Yg=i(["data","order"]),Zg=i(["data","regions"],{}),$g=i(["data","color"]),_g=i(["data","colors"],{}),ah=i(["data","hide"],!1),bh=i(["data","filter"]),ch=i(["data","selection","enabled"],!1),dh=i(["data","selection","grouped"],!1),eh=i(["data","selection","isselectable"],function(){return!0}),fh=i(["data","selection","multiple"],!0),gh=i(["data","onclick"],function(){}),hh=i(["data","onenter"],function(){}),ih=i(["data","onleave"],function(){}),jh=i(["data","onselected"],function(){}),kh=i(["data","onunselected"],function(){}),lh=i(["data","ondragstart"],function(){}),mh=i(["data","ondragend"],function(){}),nh=i(["subchart","show"],!1),oh=i(["subchart","size","height"],60),ph=i(["color","pattern"],[]),qh=i(["legend","show"],!0),rh=i(["legend","position"],"bottom"),sh=i(["legend","item","onclick"]),th=i(["legend","item","onmouseover"]),uh=i(["legend","item","onmouseout"]),vh=i(["legend","equally"],!1),wh=i(["axis","rotated"],!1),xh=i(["axis","x","show"],!0),yh=i(["axis","x","type"],"indexed"),zh=i(["axis","x","localtime"],!0),Ah=i(["axis","x","categories"],[]),Bh=i(["axis","x","tick","centered"],!1),Ch=i(["axis","x","tick","format"]),Dh=i(["axis","x","tick","culling"],{}),Eh=i(["axis","x","tick","culling","max"],10),Fh=i(["axis","x","tick","count"]),Gh=i(["axis","x","tick","fit"],!0),Hh=i(["axis","x","tick","values"],null),Ih=i(["axis","x","tick","rotate"]),Jh=i(["axis","x","max"],null),Kh=i(["axis","x","min"],null),Lh=i(["axis","x","padding"],{}),Mh=i(["axis","x","height"]),Nh=i(["axis","x","default"]),Oh=i(["axis","x","label"],{}),Ph=i(["axis","y","show"],!0),Qh=i(["axis","y","max"]),Rh=i(["axis","y","min"]),Sh=i(["axis","y","center"]),Th=i(["axis","y","label"],{}),Uh=i(["axis","y","inner"],!1),Vh=i(["axis","y","tick","format"]),Wh=i(["axis","y","padding"]),Xh=i(["axis","y","ticks"],10),Yh=i(["axis","y2","show"],!1),Zh=i(["axis","y2","max"]),$h=i(["axis","y2","min"]),_h=i(["axis","y2","center"]),ai=i(["axis","y2","label"],{}),bi=i(["axis","y2","inner"],!1),ci=i(["axis","y2","tick","format"]),di=i(["axis","y2","padding"]),ei=i(["axis","y2","ticks"],10),fi=i(["grid","x","show"],!1),gi=i(["grid","x","type"],"tick"),hi=i(["grid","x","lines"],[]),ii=i(["grid","y","show"],!1),ji=i(["grid","y","lines"],[]),ki=i(["grid","y","ticks"],10),li=i(["point","show"],!0),mi=i(["point","r"],2.5),ni=i(["point","focus","line","enabled"],!0),oi=i(["point","focus","expand","enabled"],!0),pi=i(["point","focus","expand","r"]),qi=i(["point","focus","select","r"]),ri=i(["line","connect_null"],!1),si=i(["bar","width"]),ti=i(["bar","width","ratio"],.6),ui=i(["pie","label","show"],!0),vi=i(["pie","label","format"]),wi=i(["pie","expand"],!0),xi=i(["pie","onclick"],function(){}),yi=i(["pie","onmouseover"],function(){}),zi=i(["pie","onmouseout"],function(){}),Ai=i(["donut","label","show"],!0),Bi=i(["donut","label","format"]),Ci=i(["donut","expand"],!0),Di=i(["donut","title"],""),Ei=i(["donut","onclick"],function(){}),Fi=i(["donut","onmouseover"],function(){}),Gi=i(["donut","onmouseout"],function(){}),Hi=i(["regions"],[]),Ii=i(["tooltip","show"],!0),Ji=i(["tooltip","format","title"]),Ki=i(["tooltip","format","value"]),Li=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Ji?Ji:b,l=Ki?Ki:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Mi=i(["tooltip","init","show"],!1),Ni=i(["tooltip","init","x"],0),Oi=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Pi=("string"==typeof Pf?Pf.replace(/[# .>~+]/g,""):g.chart+ +new Date)+"-clip",Qi=Pi+"-xaxis",Ri=Pi+"-yaxis",Si=j(Pi),Ti=j(Qi),Ui=j(Ri),Vi="timeseries"===yh,Wi="categorized"===yh,Xi=!Vi&&(Ng||Fe(Og)),Yi=null,Zi=!1,$i=!1,_i=!1,aj=!1,bj=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],cj=ze(_g,Fe(ph)?ph:bj,$g),dj=zh?Mf.time.format:Mf.time.format.utc,ej=dj.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),fj=[],gj=[],hj={},ij=wh?"left":"bottom",jj=wh?Uh?"top":"bottom":Uh?"right":"left",kj=wh?bi?"bottom":"top":bi?"left":"right",lj=wh?"left":"bottom",mj={main:function(){return"translate("+k(dg.left)+","+k(dg.top)+")"},context:function(){return"translate("+k(eg.left)+","+k(eg.top)+")"},legend:function(){return"translate("+fg.left+","+fg.top+")" +for(q=wh?function(a){return e(a.value)}:function(a){return b(a.x)},r=wh?function(a){return b(a.x)}:function(a){return e(a.value)},i=Vi?function(a,c,d,f){var g=a.x.getTime(),h=c.x-a.x,i=new Date(g+h*d),j=new Date(g+h*(d+f));return"M"+b(i)+" "+e(k(d))+" "+b(j)+" "+e(k(d+f))}:function(a,c,d,f){return"M"+b(j(d),!0)+" "+e(k(d))+" "+b(j(d+f),!0)+" "+e(k(d+f))},g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function hf(b){var c,d,e;if(Gj=Mf.select(Pf),Gj.empty())throw new Error("Element to bind not found");if(Gj.html("").classed("c3",!0),Nf.data.xs={},Nf.data.targets=zc(b),bh&&(Nf.data.targets=Nf.data.targets.filter(bh)),ah&&Oc(ah===!0?Gc(Nf.data.targets):ah),p(),V(),Dg.domain(Mf.extent(dc(Nf.data.targets))),Eg.domain(_b(Nf.data.targets,"y")),Fg.domain(_b(Nf.data.targets,"y2")),Gg.domain(Dg.domain()),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Hj=Dg.domain(),vj.scale(Gg),Wf&&zj.scale(Dg),Aj=Gj.append("svg").style("overflow","hidden").on("mouseenter",$f).on("mouseleave",_f),Bj=Aj.append("defs"),Bj.append("clipPath").attr("id",Pi).append("rect"),Bj.append("clipPath").attr("id",Qi).append("rect"),Bj.append("clipPath").attr("id",Ri).append("rect"),uf(),Cj=Aj.append("g").attr("transform",mj.main),Dj=Aj.append("g").attr("transform",mj.context),Ej=Aj.append("g").attr("transform",mj.legend),nh||Dj.style("visibility","hidden"),qh||(Ej.style("visibility","hidden"),gj=Gc(Nf.data.targets)),Fj=Gj.style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Hf(Gc(Nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=Cj.append("g").attr("clip-path",Si).attr("class",g.grid),fi&&d.append("g").attr("class",g.xgrids),Fe(hi)&&d.append("g").attr("class",g.xgridLines),ni&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),ii&&d.append("g").attr("class",g.ygrids),Fe(ji)&&d.append("g").attr("class",g.ygridLines),Cj.append("g").attr("clip-path",Si).attr("class",g.regions),Cj.append("g").attr("clip-path",Si).attr("class",g.chart),c=Cj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Wf?wh?"ns-resize":"ew-resize":null),Cj.select("."+g.chart).append("g").attr("class",g.chartBars),Cj.select("."+g.chart).append("g").attr("class",g.chartLines),Cj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",mj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Vb()),Cj.select("."+g.chart).append("g").attr("class",g.chartTexts),Wf&&Cj.insert("rect",Yf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",gg).attr("height",ig).style("opacity",0).style("cursor",wh?"ns-resize":"ew-resize").call(zj).on("dblclick.zoom",null),Nh&&vj.extent("function"!=typeof Nh?Nh:Nh(dc())),hj.x=Cj.append("g").attr("class",g.axisX).attr("clip-path",Ti).attr("transform",mj.x).style("visibility",xh?"visible":"hidden"),hj.x.append("text").attr("class",g.axisXLabel).attr("transform",wh?"rotate(-90)":"").style("text-anchor",Eb),hj.y=Cj.append("g").attr("class",g.axisY).attr("clip-path",Ui).attr("transform",mj.y).style("visibility",Ph?"visible":"hidden"),hj.y.append("text").attr("class",g.axisYLabel).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Fb),hj.y2=Cj.append("g").attr("class",g.axisY2).attr("transform",mj.y2).style("visibility",Yh?"visible":"hidden"),hj.y2.append("text").attr("class",g.axisY2Label).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Gb),Dj.append("g").attr("clip-path",Si).attr("class",g.chart),Dj.select("."+g.chart).append("g").attr("class",g.chartBars),Dj.select("."+g.chart).append("g").attr("class",g.chartLines),Dj.append("g").attr("clip-path",Si).attr("class",g.brush).call(vj).selectAll("rect").attr(wh?"width":"height",wh?hg:jg),hj.subx=Dj.append("g").attr("class",g.axisX).attr("transform",mj.subx).attr("clip-path",wh?"":Ti),xf(Nf.data.targets),qf({withUpdateTranslate:!0,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Mi){if(Vi&&"string"==typeof Ni){for(Ni=Ae(Ni),e=0;e0){d=[];for(var f in Rg)for(c=0;cf&&h>c&&d>i&&j>d;else{if(!n.classed(g.bar))return;m=Rd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Qe,q=!(c>h||f>c+e||d>j||i>d+k)}q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function nf(a){le(Nf.data.targets)||ch&&(Yi=a,Cj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Zi=!0,lh())}function of(){le(Nf.data.targets)||ch&&(Cj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),Cj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Zi=!1,mh())}function pf(a,b){"grid"===b&&a.each(function(){var a=Mf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function qf(a,c){var d,e,f,h,i,j,k,l,m,n,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,Q,R,S,T,U,W,X,Y,Z,$=ae(),_=le(Nf.data.targets),ab=Lc(Nf.data.targets);if(a=a||{},E=Je(a,"withY",!0),F=Je(a,"withSubchart",!0),G=Je(a,"withTransition",!0),J=Je(a,"withTransform",!1),K=Je(a,"withUpdateXDomain",!1),L=Je(a,"withUpdateOrgXDomain",!1),N=Je(a,"withUpdateTranslate",!1),M=Je(a,"withLegend",!1),H=Je(a,"withTransitionForExit",G),I=Je(a,"withTransitionForAxis",G),T=G?cg:0,U=H?T:0,W=I?T:0,c=c||vf(W),N&&(wh?(hj.x.call(Jg),hj.subx.call(Mg)):(hj.y.call(Kg),hj.y2.call(Lg)),p(),V(),uf(),o(!1)),M&&qh&&Hf(Gc(Nf.data.targets),a,c),Wi&&0===ab.length&&Dg.domain([0,hj.x.selectAll(".tick").size()]),ab.length&&(L&&(Dg.domain(Mf.extent(dc(ab))),Hj=Dg.domain(),Wf&&zj.scale(Dg).updateScaleExtent(),Gg.domain(Dg.domain()),vj.scale(Gg)),K&&(Dg.domain(vj.empty()?Hj:vj.extent()),Wf&&zj.scale(Dg).updateScaleExtent()),Hh||!Gh&&!Fh||(X=Nc(Mc(ab),Fh),Jg.tickValues(X),Mg.tickValues(X))),Eg.domain(_b(ab,"y")),Fg.domain(_b(ab,"y2")),hj.x.style("opacity",_?0:1),hj.y.style("opacity",_?0:1),hj.y2.style("opacity",_?0:1),hj.subx.style("opacity",_?0:1),c.axisX.call(Jg),c.axisY.call(Kg),c.axisY2.call(Lg),c.axisSubX.call(Mg),Ib(G),K&&ab.length)if(Dh&&X){for(Y=1;Y=0&&Mf.select(this).style("display",b%Z?"none":"block")})}else Aj.selectAll("."+g.axisX+" .tick text").style("display","block");!wh&&Ih&&jb(hj.x,c.axisX,Ih),O=bf($),R=cf($,!0),S=cf($,!1),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Fj.style("display","none"),q(),Cj.select("line."+g.xgridFocus).style("visibility","hidden"),fi&&(f=Zd(gi,Dg),B=Wi?Jg.tickOffset():0,e=wh?{x1:0,x2:gg,y1:function(a){return Dg(a)-B},y2:function(a){return Dg(a)-B}}:{x1:function(a){return Dg(a)+B},x2:function(a){return Dg(a)+B},y1:dg.top,y2:ig},d=Cj.select("."+g.xgrids).selectAll("."+g.xgrid).data(f),d.enter().append("line").attr("class",g.xgrid),d.attr(e).style("opacity",function(){return+Mf.select(this).attr(wh?"y1":"x1")===(wh?ig:0)?0:1}),d.exit().remove()),Fe(hi)&&(h=Cj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(hi),i=h.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),i.append("line").style("opacity",0),i.append("text").attr("text-anchor","end").attr("transform",wh?"":"rotate(-90)").attr("dx",wh?0:-dg.top).attr("dy",-5).style("opacity",0),h.select("line").transition().duration(T).attr("x1",wh?0:Jd).attr("x2",wh?gg:Jd).attr("y1",wh?Jd:dg.top).attr("y2",wh?Jd:ig).style("opacity",1),h.select("text").transition().duration(T).attr("x",wh?gg:0).attr("y",Jd).text(function(a){return a.text}).style("opacity",1),h.exit().transition().duration(T).style("opacity",0).remove()),E&&ii&&(j=Cj.select("."+g.ygrids).selectAll("."+g.ygrid).data(Eg.ticks(ki)),j.enter().append("line").attr("class",g.ygrid),j.attr("x1",wh?Eg:0).attr("x2",wh?Eg:gg).attr("y1",wh?0:Eg).attr("y2",wh?ig:Eg),j.exit().remove(),pf(j,"grid")),E&&Fe(ji)&&(k=Cj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(ji),l=k.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",wh?"rotate(-90)":"").attr("dx",wh?0:-dg.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",wh?Kd:0).attr("x2",wh?Kd:gg).attr("y1",wh?0:Kd).attr("y2",wh?ig:Kd).style("opacity",1),k.select("text").transition().duration(T).attr("x",wh?0:gg).attr("y",Kd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),u=Cj.select("."+g.regions).selectAll("."+g.region).data(Hi),u.enter().append("g").attr("class",kd).append("rect").style("fill-opacity",0),u.selectAll("rect").transition().duration(T).attr("x",ic).attr("y",jc).attr("width",kc).attr("height",lc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),u.exit().transition().duration(T).style("opacity",0).remove(),s=Cj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),s.enter().append("path").attr("class",ed).style("stroke","none").style("fill",cj),s.style("opacity",wd).transition().duration(T).attr("d",O).style("fill",cj).style("opacity",1),s.exit().transition().duration(U).style("opacity",0).remove(),m=Cj.selectAll("."+g.lines).selectAll("."+g.line).data(te),m.enter().append("path").attr("class",ad).style("stroke",cj),m.style("opacity",wd).transition().duration(T).attr("d",wj).style("stroke",cj).style("opacity",1),m.exit().transition().duration(U).style("opacity",0).remove(),n=Cj.selectAll("."+g.areas).selectAll("."+g.area).data(te),n.enter().append("path").attr("class",id).style("fill",cj).style("opacity",function(){return Ij=+Mf.select(this).style("opacity"),0}),n.style("opacity",0).transition().duration(T).attr("d",xj).style("fill",cj).style("opacity",Ij),n.exit().transition().duration(U).style("opacity",0).remove(),r=Cj.selectAll("."+g.circles).selectAll("."+g.circle).data(we),r.enter().append("circle").attr("class",cd).attr("r",Ue).style("fill",cj),r.style("opacity",wd).transition().duration(T).style("opacity",yd).style("fill",cj).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d),r.exit().remove(),v=Cj.selectAll("."+g.texts).selectAll("."+g.text).data(xe),v.enter().append("text").attr("class",Yc).attr("text-anchor",function(a){return wh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",cj).style("fill-opacity",0),v.text(function(a){return Hd(a.id)(a.value,a.id)}).style("fill-opacity",xd).transition().duration(T).attr("x",R).attr("y",S).style("fill",cj).style("fill-opacity",zd),v.exit().transition().duration(U).style("fill-opacity",0).remove(),t=Cj.selectAll("."+g.arcs).selectAll("."+g.arc).data(ue),t.enter().append("path").attr("class",gd).style("fill",function(a){return cj(a.data)}).style("cursor",function(a){return eh(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;aj||(c=Jb(a),d=Pb(c),e=Xb(),Rb(c.data.id),Df(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Jb(a),c=Pb(b),d=[c];Vd(d,Mf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;aj||(c=Jb(a),d=Pb(c),e=Yb(),Sb(c.data.id),Ef(),Wd(),e(d,b))}).on("click",function(a,b){var c=Jb(a),d=Pb(c),e=Wb();lf(this,a,b),e(d,b)}),t.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){aj=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Jb(a);return c?(b=Mf.interpolate(this._current,c),this._current=b(0),function(a){return Mb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("fill",function(a){return cj(a.data)}).style("opacity",1).call(Ie,function(){aj=!1}),t.exit().transition().duration(U).style("opacity",0).remove(),Cj.selectAll("."+g.chartArc).select("text").attr("transform",Nb).style("opacity",0).transition().duration(T).text(Qb).style("opacity",function(a){return Jc(a.data.id)&&se(a.data)?1:0}),Cj.select("."+g.chartArcsTitle).style("opacity",ke(Nf.data.targets)?1:0),nh&&(Mf.event&&"zoom"===Mf.event.type&&vj.extent(Dg.orgDomain()).update(),F&&(!wh&&Ih&&jb(hj.subx,c.axisSubX,Ih),vj.empty()||vj.extent(Dg.orgDomain()).update(),Q=bf($,!0),x=Dj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),x.enter().append("path").attr("class",ed).style("stroke","none").style("fill",cj),x.style("opacity",wd).transition().duration(T).attr("d",Q).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove(),w=Dj.selectAll("."+g.lines).selectAll("."+g.line).data(te),w.enter().append("path").attr("class",ad).style("stroke",cj),w.style("opacity",wd).transition().duration(T).attr("d",yj).style("opacity",1),w.exit().transition().duration(T).style("opacity",0).remove())),Cj.selectAll("."+g.selectedCircles).filter(function(a){return oe(a)}).selectAll("circle").remove(),Cj.selectAll("."+g.selectedCircle).transition().duration(T).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d),Zf&&(y=Cj.select("."+g.eventRects),Fe(Og)&&!sc(Og)?(y.classed(g.eventRectsMultiple)||y.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),z=Cj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),kf(z.enter()),z.attr("x",0).attr("y",0).attr("width",gg).attr("height",ig)):(y.classed(g.eventRectsSingle)||y.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Xi&&!Wi?(D=function(a,b){var c=Bc(b),d=Cc(b),e=Nf.data.xs[a.id][b];return(Dg(d?d:e+50)-Dg(c?c:e-50))/2},C=function(a,b){var c=Bc(b),d=Nf.data.xs[a.id][b];return(Dg(d)+Dg(c?c:d-50))/2}):(D=P(),C=function(a){return Dg(a.x)-D/2}),A=Ec(Nf.data.targets),Cj.select("."+g.eventRects).datum(A?A.values:[]),z=Cj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),jf(z.enter()),z.attr("class",ld).attr("x",wh?0:C).attr("y",wh?C:0).attr("width",wh?gg:D).attr("height",wh?D:ig),z.exit().remove())),Gc(Nf.data.targets).forEach(function(a){Jj[a]=!0})}function rf(){qf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function sf(){if(0!==Lc(Nf.data.targets).length){if("mousemove"===Mf.event.sourceEvent.type&&zj.altDomain)return Dg.domain(zj.altDomain),void zj.scale(Dg).updateScaleExtent();Wi&&Dg.orgDomain()[0]===Hj[0]&&Dg.domain([Hj[0]-1e-10,Dg.orgDomain()[1]]),qf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Mf.event.sourceEvent.type&&($i=!0)}}function tf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function uf(){Aj.attr("width",kg).attr("height",lg),Aj.select("#"+Pi).select("rect").attr("width",gg).attr("height",ig),Aj.select("#"+Qi).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),Aj.select("#"+Ri).select("rect").attr("x",H).attr("y",I).attr("width",N).attr("height",O),Aj.select("."+g.zoomRect).attr("width",gg).attr("height",ig),Gj.style("max-height",lg+"px")}function vf(a){return{axisX:a?hj.x.transition().duration(a):hj.x,axisY:a?hj.y.transition().duration(a):hj.y,axisY2:a?hj.y2.transition().duration(a):hj.y2,axisSubX:a?hj.subx.transition().duration(a):hj.subx}}function wf(a){var b;a=a||{},a.withTransition=Je(a,"withTransition",!0),a.withTransform=Je(a,"withTransform",!1),a.withLegend=Je(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withLegend&&qh||(b=vf(a.withTransitionForAxis?cg:0),p(),V(),uf(),o(a.withTransition,b)),qf(a,b)}function xf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=Cj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",nd),j=i.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Zc),e=Cj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),d=e.enter().append("g").attr("class",pd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",fd).style("cursor",function(a){return eh(a)?"pointer":null}),c=Cj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),b=c.enter().append("g").attr("class",od).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",bd),b.append("g").attr("class",jd),b.append("g").attr("class",function(a){return Xc(g.selectedCircles,a.id)}),b.append("g").attr("class",dd).style("cursor",function(a){return eh(a)?"pointer":null}),a.forEach(function(a){Cj.selectAll("."+g.selectedCircles+rd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Cj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(ug(a)).attr("class",qd),f=h.enter().append("g").attr("class",qd),f.append("g").attr("class",hd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),nh&&(n=Dj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),m=n.enter().append("g").style("opacity",0).attr("class",pd),m.append("g").attr("class",fd),l=Dj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),k=l.enter().append("g").style("opacity",0).attr("class",od),k.append("g").attr("class",bd)),Aj.selectAll("."+g.target).filter(function(a){return Jc(a.id)}).transition().duration(cg).style("opacity",1)}function yf(a,b){b.filter&&(a=a.filter(b.filter)),(b.type||b.types)&&a.forEach(function(a){b.types?fe(a.id,b.types[a.id]):fe(a.id,b.type)}),Nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,z=0,F++)),E[a]=F,D[F]=f,A[a]=z,z+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+v)/10),j=10*Math.ceil((h.height+u)/10),k=nj?j:i,l=nj?U():T();return d&&(z=0,F=0,w=0,x=0),qh&&!Kc(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=i,C[c]=j,(!w||i>=w)&&(w=i),(!x||j>=x)&&(x=j),g=nj?x:w,void(vh?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(l-g*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=26,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=Ej.selectAll("."+g.legendItemFocused).size();b=b||{},n=Je(b,"withTransition",!0),q=Je(b,"withTransitionForTransform",!0),nj?(f=function(a){return w*E[a]},j=function(a){return D[E[a]]+A[a]}):(f=function(a){return D[E[a]]+A[a]},j=function(a){return x*E[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=Ej.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Xc(g.legendItem,a)}).style("visibility",function(a){return Kc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof sh?sh(a):Nf.toggle(a)}).on("mouseover",function(a){Mf.select(this).classed(g.legendItemFocused,!0),aj||Nf.focus(a),"function"==typeof th&&th(a)}).on("mouseout",function(a){Mf.select(this).classed(g.legendItemFocused,!1),aj||Nf.revert(),"function"==typeof uh&&uh(a)}),m.append("text").text(function(a){return d(Rg[a])?Rg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",nj?h:-200).attr("y",nj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",nj?i:-200).attr("y",nj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",cj).attr("x",nj?h:-200).attr("y",nj?-200:j).attr("width",10).attr("height",10),r=Ej.selectAll("text").data(a).text(function(a){return d(Rg[a])?Rg[a]:a}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=Ej.selectAll("rect."+g.legendItemEvent).data(a),(n?s.transition():s).attr("width",function(a){return B[a]}).attr("height",function(a){return C[a]}).attr("x",i).attr("y",l),t=Ej.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",cj).attr("x",f).attr("y",j),Ej.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Jc(a)}).transition().style("opacity",function(a){var b=Mf.select(this);return Jc(a)?!G||b.classed(g.legendItemFocused)?Bf(b):Cf(b):rj}),R(w),S(x),Q(F),p(),V(),uf(),o(q,c)}function If(a){return Ic(Nf.data.targets,a.id)}function Jf(a){return"data"in a&&Ic(Nf.data.targets,a.data.id)}function Kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function Lf(a,b,c){var d=!le(Nf.data.targets);aj=!1,fe(a,b),wf(c||{withTransitionForAxis:d})}var Mf=a.d3?a.d3:a.require?a.require("d3"):void 0,Nf={data:{},axis:{},legend:{}},Of={},Pf=i(["bindto"],"#chart"),Qf=i(["size","width"]),Rf=i(["size","height"]),Sf=i(["padding","left"]),Tf=i(["padding","right"]),Uf=i(["padding","top"]),Vf=i(["padding","bottom"]),Wf=i(["zoom","enabled"],!1),Xf=i(["zoom","extent"]),Yf=i(["zoom","privileged"],!1),Zf=i(["interaction","enabled"],!0),$f=i(["onenter"],function(){}),_f=i(["onleave"],function(){}),ag=i(["onresize"],function(){}),bg=i(["onresized"],function(){}),cg=i(["transition","duration"],350);h("data","data is required in config");var dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg,Kg,Lg,Mg,Ng=i(["data","x"]),Og=i(["data","xs"],{}),Pg=i(["data","x_format"]),Qg=i(["data","id_converter"],function(a){return a}),Rg=i(["data","names"],{}),Sg=i(["data","classes"],{}),Tg=i(["data","groups"],[]),Ug=i(["data","axes"],{}),Vg=i(["data","type"]),Wg=i(["data","types"],{}),Xg=i(["data","labels"],{}),Yg=i(["data","order"]),Zg=i(["data","regions"],{}),$g=i(["data","color"]),_g=i(["data","colors"],{}),ah=i(["data","hide"],!1),bh=i(["data","filter"]),ch=i(["data","selection","enabled"],!1),dh=i(["data","selection","grouped"],!1),eh=i(["data","selection","isselectable"],function(){return!0}),fh=i(["data","selection","multiple"],!0),gh=i(["data","onclick"],function(){}),hh=i(["data","onenter"],function(){}),ih=i(["data","onleave"],function(){}),jh=i(["data","onselected"],function(){}),kh=i(["data","onunselected"],function(){}),lh=i(["data","ondragstart"],function(){}),mh=i(["data","ondragend"],function(){}),nh=i(["subchart","show"],!1),oh=i(["subchart","size","height"],60),ph=i(["color","pattern"],[]),qh=i(["legend","show"],!0),rh=i(["legend","position"],"bottom"),sh=i(["legend","item","onclick"]),th=i(["legend","item","onmouseover"]),uh=i(["legend","item","onmouseout"]),vh=i(["legend","equally"],!1),wh=i(["axis","rotated"],!1),xh=i(["axis","x","show"],!0),yh=i(["axis","x","type"],"indexed"),zh=i(["axis","x","localtime"],!0),Ah=i(["axis","x","categories"],[]),Bh=i(["axis","x","tick","centered"],!1),Ch=i(["axis","x","tick","format"]),Dh=i(["axis","x","tick","culling"],{}),Eh=i(["axis","x","tick","culling","max"],10),Fh=i(["axis","x","tick","count"]),Gh=i(["axis","x","tick","fit"],!0),Hh=i(["axis","x","tick","values"],null),Ih=i(["axis","x","tick","rotate"]),Jh=i(["axis","x","max"],null),Kh=i(["axis","x","min"],null),Lh=i(["axis","x","padding"],{}),Mh=i(["axis","x","height"]),Nh=i(["axis","x","default"]),Oh=i(["axis","x","label"],{}),Ph=i(["axis","y","show"],!0),Qh=i(["axis","y","max"]),Rh=i(["axis","y","min"]),Sh=i(["axis","y","center"]),Th=i(["axis","y","label"],{}),Uh=i(["axis","y","inner"],!1),Vh=i(["axis","y","tick","format"]),Wh=i(["axis","y","padding"]),Xh=i(["axis","y","ticks"],10),Yh=i(["axis","y2","show"],!1),Zh=i(["axis","y2","max"]),$h=i(["axis","y2","min"]),_h=i(["axis","y2","center"]),ai=i(["axis","y2","label"],{}),bi=i(["axis","y2","inner"],!1),ci=i(["axis","y2","tick","format"]),di=i(["axis","y2","padding"]),ei=i(["axis","y2","ticks"],10),fi=i(["grid","x","show"],!1),gi=i(["grid","x","type"],"tick"),hi=i(["grid","x","lines"],[]),ii=i(["grid","y","show"],!1),ji=i(["grid","y","lines"],[]),ki=i(["grid","y","ticks"],10),li=i(["point","show"],!0),mi=i(["point","r"],2.5),ni=i(["point","focus","line","enabled"],!0),oi=i(["point","focus","expand","enabled"],!0),pi=i(["point","focus","expand","r"]),qi=i(["point","focus","select","r"]),ri=i(["line","connect_null"],!1),si=i(["bar","width"]),ti=i(["bar","width","ratio"],.6),ui=i(["pie","label","show"],!0),vi=i(["pie","label","format"]),wi=i(["pie","expand"],!0),xi=i(["pie","onclick"],function(){}),yi=i(["pie","onmouseover"],function(){}),zi=i(["pie","onmouseout"],function(){}),Ai=i(["donut","label","show"],!0),Bi=i(["donut","label","format"]),Ci=i(["donut","expand"],!0),Di=i(["donut","title"],""),Ei=i(["donut","onclick"],function(){}),Fi=i(["donut","onmouseover"],function(){}),Gi=i(["donut","onmouseout"],function(){}),Hi=i(["regions"],[]),Ii=i(["tooltip","show"],!0),Ji=i(["tooltip","format","title"]),Ki=i(["tooltip","format","value"]),Li=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Ji?Ji:b,l=Ki?Ki:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Mi=i(["tooltip","init","show"],!1),Ni=i(["tooltip","init","x"],0),Oi=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Pi=("string"==typeof Pf?Pf.replace(/[# .>~+]/g,""):g.chart+ +new Date)+"-clip",Qi=Pi+"-xaxis",Ri=Pi+"-yaxis",Si=j(Pi),Ti=j(Qi),Ui=j(Ri),Vi="timeseries"===yh,Wi="categorized"===yh,Xi=!Vi&&(Ng||Fe(Og)),Yi=null,Zi=!1,$i=!1,_i=!1,aj=!1,bj=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],cj=ze(_g,Fe(ph)?ph:bj,$g),dj=zh?Mf.time.format:Mf.time.format.utc,ej=dj.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),fj=[],gj=[],hj={},ij=wh?"left":"bottom",jj=wh?Uh?"top":"bottom":Uh?"right":"left",kj=wh?bi?"bottom":"top":bi?"left":"right",lj=wh?"left":"bottom",mj={main:function(){return"translate("+k(dg.left)+","+k(dg.top)+")"},context:function(){return"translate("+k(eg.left)+","+k(eg.top)+")"},legend:function(){return"translate("+fg.left+","+fg.top+")" },x:function(){return"translate(0,"+(wh?0:ig)+")"},y:function(){return"translate(0,"+(wh?ig:0)+")"},y2:function(){return"translate("+(wh?0:gg)+","+(wh?1:0)+")"},subx:function(){return"translate(0,"+(wh?0:jg)+")"},arc:function(){return"translate("+pg/2+","+qg/2+")"}},nj="right"===rh,oj=0,pj=0,qj=0,rj=.15,sj=30,tj=wh&&!xh?0:30,uj=5;ug=Mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var vj,wj=function(){var a=Mf.svg.line().x(wh?function(a){return $(a.id)(a.value)}:Id).y(wh?Id:function(a){return $(a.id)(a.value)});return ri||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ri?Te(b.values):b.values;return me(b)?(a.interpolate(ne(b)?"cardinal":"linear"),Zg[b.id]?gf(e,Dg,$(b.id),Zg[b.id]):a(e)):(c=e[0]?Dg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,wh?"M "+d+" "+c:"M "+c+" "+d)}}(),xj=function(){var a;return a=wh?Mf.svg.area().x0(function(a){return $(a.id)(0)}).x1(function(a){return $(a.id)(a.value)}).y(Id):Mf.svg.area().x(Id).y0(function(a){return $(a.id)(0)}).y1(function(a){return $(a.id)(a.value)}),function(b){var c,d,e=Te(b.values);return ge([b],"area")||ge([b],"area-spline")?(a.interpolate(ne(b)?"cardinal":"linear"),a(e)):(c=e[0]?Dg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,wh?"M "+d+" "+c:"M "+c+" "+d)}}(),yj=function(){var a=Mf.svg.line().x(wh?function(a){return _(a.id)(a.value)}:Ld).y(wh?Ld:function(a){return _(a.id)(a.value)});return function(b){var c=Te(b.values);return me(b)?a(c):"M "+Gg(c[0].x)+" "+_(b.id)(c[0].value)}}(),zj=function(){};vj=Mf.svg.brush().on("brush",rf),vj.update=function(){return Dj&&Dj.select("."+g.brush).call(this),this},vj.scale=function(a){return wh?this.y(a):this.x(a)},Wf&&(zj=Mf.behavior.zoom().on("zoomstart",function(){zj.altDomain=Mf.event.sourceEvent.altKey?Dg.orgDomain():null}).on("zoom",Wf?sf:null),zj.scale=function(a){return wh?this.y(a):this.x(a)},zj.orgScaleExtent=function(){var a=Xf?Xf:[1,10];return[a[0],Math.max(Dc()/a[1],a[1])]},zj.updateScaleExtent=function(){var a=ec(Dg.orgDomain())/ec(Hj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Aj,Bj,Cj,Dj,Ej,Fj,Gj,Hj,Ij,Jj={};if(Nf.focus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);Nf.revert(),Nf.defocus(),b(d.classed(g.focused,!0)),b(e),le(Nf.data.targets)&&Rb(a,!0),Df(a,!0)},Nf.defocus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",.3)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);Nf.revert(),b(d.classed(g.focused,!1)),b(e),le(Nf.data.targets)&&Sb(a),Df(a,!1)},Nf.revert=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);b(d.classed(g.focused,!1)),b(e),le(Nf.data.targets)&&Sb(a),Ef()},Nf.show=function(a,b){a=Hc(a),b=b||{},Pc(a),Aj.selectAll(td(a)).transition().style("opacity",1),b.withLegend&&Ff(a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Nf.hide=function(a,b){a=Hc(a),b=b||{},Oc(a),Aj.selectAll(td(a)).transition().style("opacity",0),b.withLegend&&Gf(a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Nf.toggle=function(a){Jc(a)?Nf.hide(a):Nf.show(a)},Nf.unzoom=function(){vj.clear().update(),qf({withUpdateXDomain:!0})},Nf.load=function(a){return a.xs&&rc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Sg[b]=a.classes[b]}),"categories"in a&&Wi&&(Ah=a.categories,Jg.categories(Ah)),"cacheIds"in a&&fc(a.cacheIds)?void yf(hc(a.cacheIds),a.done):void("unload"in a?Af(Hc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){zf(a)}):zf(a))},Nf.unload=function(a,b){Af(Hc(a),function(){qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Nf.selected=function(a){return Mf.merge(Cj.selectAll("."+g.shapes+rd(a)).selectAll("."+g.shape).filter(function(){return Mf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Nf.select=function(a,b,c){ch&&Cj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Mf.select(this),i=e.data?e.data.id:e.id,j=Se(this),k=dh||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);h.classed(g.line)||h.classed(g.area)||(k&&l?eh(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},Nf.unselect=function(a,b){ch&&Cj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Mf.select(this),f=c.data?c.data.id:c.id,h=Se(this),i=dh||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);e.classed(g.line)||e.classed(g.area)||i&&j&&eh(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Nf.toLine=function(a){Lf(a,"line")},Nf.toSpline=function(a){Lf(a,"spline")},Nf.toBar=function(a){Lf(a,"bar")},Nf.toScatter=function(a){Lf(a,"scatter")},Nf.toArea=function(a){Lf(a,"area")},Nf.toAreaSpline=function(a){Lf(a,"area-spline")},Nf.toPie=function(a){Lf(a,"pie",{withTransform:!0})},Nf.toDonut=function(a){Lf(a,"donut",{withTransform:!0})},Nf.groups=function(a){return c(a)?Tg:(Tg=a,qf(),Tg)},Nf.xgrids=function(a){return a?(hi=a,qf(),hi):hi},Nf.xgrids.add=function(a){return a?Nf.xgrids(hi.concat(a)):void 0},Nf.xgrids.remove=function(a){var b=Kf(a);return Nf.xgrids(hi.filter(b))},Nf.ygrids=function(a){return a?(ji=a,qf(),ji):ji},Nf.ygrids.add=function(a){return a?Nf.ygrids(ji.concat(a)):void 0},Nf.ygrids.remove=function(a){var b=Kf(a);return Nf.ygrids(ji.filter(b))},Nf.regions=function(a){return a?(Hi=a,qf(),Hi):Hi},Nf.regions.add=function(a){return a?(Hi=Hi.concat(a),qf(),Hi):Hi},Nf.regions.remove=function(a){var b,c,d;return a=a||{},b=Je(a,"duration",cg),c=Je(a,"classes",[g.region]),d=Cj.select("."+g.regions).selectAll(c.map(function(a){return"."+a})),(b?d.transition().duration(b):d).style("opacity",0).remove(),Hi=Hi.filter(function(a){return c.indexOf(a.class)<0})},Nf.data.get=function(a){var b=Nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Nf.data.getAsTarget=function(a){var b=Nf.data.targets.filter(function(b){return b.id===a});return b.length>0?b[0]:void 0},Nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Rg[b]=a[b]}),qf({withLegend:!0}),Rg):Rg},Nf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){_g[b]=a[b]}),qf({withLegend:!0}),_g):_g},Nf.x=function(a){return arguments.length&&(uc(Nf.data.targets,a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Nf.data.xs},Nf.xs=function(a){return arguments.length&&(vc(Nf.data.targets,a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Nf.data.xs},Nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){gb(b,a[b])}),Ib())},Nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Jh=+a.x),b(a.y)&&(Qh=+a.y),b(a.y2)&&(Zh=+a.y2)):Qh=Zh=+a,qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Kh=+a.x),b(a.y)&&(Rh=+a.y),b(a.y2)&&($h=+a.y2)):Rh=$h=+a,qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Nf.axis.max(a.max),"undefined"!=typeof a.min&&Nf.axis.min(a.min))},Nf.legend.show=function(a){Ff(Hc(a)),qf({withLegend:!0})},Nf.legend.hide=function(a){Gf(Hc(a)),qf({withLegend:!0})},Nf.resize=function(a){Qf=a?a.width:null,Rf=a?a.height:null,wf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Nf.destroy=function(){Nf.data.targets=void 0,Nf.data.xs={},Gj.html(""),a.onresize=null},"url"in f.data)Mf.xhr(f.data.url,function(a,b){var c,d=Mf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Mf.csv.parse(b.response),hf(c)});else if("rows"in f.data)hf(xc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");hf(yc(f.data.columns))}return Nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(window); \ No newline at end of file From a8798cd620f356e9de3b7f91c1e160e47ab192f1 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Sat, 10 May 2014 22:45:01 +0900 Subject: [PATCH 168/178] Update version to 0.1.38 --- bower.json | 2 +- c3.js | 2 +- c3.min.js | 2 +- package.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bower.json b/bower.json index 50a063b..0f80bb4 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "c3", "main": "c3.min.js", - "version": "0.1.37", + "version": "0.1.38", "homepage": "https://github.com/masayuki0812/c3", "authors": [ "Masayuki Tanaka " diff --git a/c3.js b/c3.js index 3ce1bda..e9566f9 100644 --- a/c3.js +++ b/c3.js @@ -2,7 +2,7 @@ 'use strict'; var c3 = { - version: "0.1.37" + version: "0.1.38" }; var CLASS = { diff --git a/c3.min.js b/c3.min.js index cc4318a..c22c987 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.round(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.round(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&a=0;return"url("+(c?"":document.URL.split("#")[0])+"#"+b+")"}function k(a){return Math.ceil(a)+.5}function l(a,b){var c,d,e;b&&b.axisX?c=b.axisX:(c=Cj.select("."+g.axisX),a&&(c=c.transition())),b&&b.axisY?d=b.axisY:(d=Cj.select("."+g.axisY),a&&(d=d.transition())),b&&b.axisY2?e=b.axisY2:(e=Cj.select("."+g.axisY2),a&&(e=e.transition())),Cj.attr("transform",mj.main),c.attr("transform",mj.x),d.attr("transform",mj.y),e.attr("transform",mj.y2),Cj.select("."+g.chartArcs).attr("transform",mj.arc)}function m(a,b){var c;b&&b.axisSubX?c=b.axisSubX:(c=Dj.select("."+g.axisX),a&&(c=c.transition())),Dj.attr("transform",mj.context),c.attr("transform",mj.subx)}function n(a){(a?Ej.transition():Ej).attr("transform",mj.legend)}function o(a,b){l(a,b),nh&&m(a,b),n(a)}function p(){var a=U(),b=T(),c=nj?0:a,d=le(Nf.data.targets),e=wh||d?0:A("x"),f=nh&&!d?oh+e:0;kg=t(),lg=u(),wh?(dg={top:A("y2")+v(),right:d?0:y(),bottom:A("y")+c+w(),left:f+(d?0:x())},eg={top:dg.top,right:0/0,bottom:20+c,left:sj}):(dg={top:4+v(),right:d?0:y(),bottom:e+f+c+w(),left:d?0:x()},eg={top:lg-f-c,right:0/0,bottom:e+c,left:dg.left}),fg={top:nj?0:lg-a,right:0/0,bottom:0,left:nj?kg-b:0},gg=kg-dg.left-dg.right,ig=lg-dg.top-dg.bottom,0>gg&&(gg=0),0>ig&&(ig=0),hg=wh?dg.left-sj-tj:gg,jg=wh?ig:lg-eg.top-eg.bottom,0>hg&&(hg=0),0>jg&&(jg=0),pg=gg-(nj?b+10:0),qg=ig-(nj?0:10),r(),nj&&d&&(fg.left=pg/2+1.1*ng)}function q(){Cj.select("line."+g.xgridFocus).attr("x1",wh?0:-10).attr("x2",wh?gg:-10).attr("y1",wh?-10:dg.top).attr("y2",wh?-10:ig)}function r(){ng=Math.min(pg,qg)/2,mg=.95*ng,og=ke(Nf.data.targets)?.6*mg:0}function s(){var a=wh?g.axisX:g.axisY,b=Cj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Gj.node().getBoundingClientRect(),e=le(Nf.data.targets),f=c.right-d.left-(e?0:x());return f>0?f:0}function t(){return Qf?Qf:B()}function u(){var a=Rf?Rf:C();return a>0?a:320}function v(){return Uf?Uf:0}function w(){return Vf?Vf:0}function x(){return Sf?Sf:wh?xh?Ke(z("x")):1:!Ph||Uh?1:Ke(z("y"))}function y(){var a=10,b=nj?T()+20:0;return Tf?Tf:wh?a+b:(!Yh||bi?a:Ke(z("y2")))+b}function z(a){var b=ob(a);return b.isInner?20+Hb(a):40+Hb(a)}function A(a){return"x"!==a||xh?"x"===a&&Mh?Mh:"y"!==a||Ph?"y2"!==a||Yh?(ob(a).isInner?30:40)+("y2"===a?-10:0):uj:qh&&!nj?10:1:0}function B(){return+Gj.style("width").replace("px","")}function C(){return+Gj.style("height").replace("px","")}function D(a){return a?-31:-(dg.left-1)}function E(a){return a?-20:-4}function F(){return D(!wh)}function G(){return E(!wh)}function H(){return D(wh)}function I(){return E(wh)}function J(a){return a?gg+2+30+30:dg.left+20}function K(a){return a?(Mh?Mh:0)+80:ig+8}function L(){return J(!wh)}function M(){return K(!wh)}function N(){return J(wh)}function O(){return K(wh)}function P(){var a,b,c,d,e,f=Ec(Nf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=Dg(b.x)-Dg(a.x),0===c?wh?ig:gg:(d=Dc(),e=he(Nf.data.targets)?(d-(Wi?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function Q(a){oj=a}function R(a){pj=a}function S(a){qj=a}function T(){return qh?nj?pj*(oj+1):kg:0}function U(){return qh?nj?lg:qj*(oj+1):0}function V(){var a,b,c=!Dg;vg=wh?1:0,wg=wh?ig:gg,xg=wh?0:ig,yg=wh?gg:1,zg=vg,Ag=wg,Bg=wh?0:jg,Cg=wh?hg:1,Dg=Y(vg,wg,c?void 0:Dg.domain(),function(){return Jg.tickOffset()}),Eg=Z(xg,yg,c?void 0:Eg.domain()),Fg=Z(xg,yg,c?void 0:Fg.domain()),Gg=Y(vg,wg,Hj,function(a){return a%1?0:Mg.tickOffset()}),Hg=Z(Bg,Cg,c?void 0:Hg.domain()),Ig=Z(Bg,Cg,c?void 0:Ig.domain()),a=db(),b=Hh?Hh:c?void 0:Jg.tickValues(),Jg=ab(Dg,ij,a,b),Mg=ab(Gg,lj,a,b),Kg=bb(Eg,jj,Vh,Xh),Lg=bb(Fg,kj,ci,ei),c||(vj.scale(Gg),Wf&&zj.scale(Dg)),W()}function W(){rg=Kb(),sg=Lb(),tg=Lb(.98)}function X(a,b,c){return(c?Mf.time.scale():Mf.scale.linear()).range([a,b])}function Y(a,b,c,d){var e,f=X(a,b,Vi),g=c?f.domain(c):f;Wi?(d=d||function(){return 0},f=function(a,b){var c=g(a)+d(a);return b?c:Math.ceil(c)}):f=function(a,b){var c=g(a);return b?c:Math.ceil(c)};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return Hj&&Hj[0]===a[0]&&Hj[1]a?a.toFixed(0):a};return Ch&&("function"==typeof Ch?a=Ch:Vi&&(a=function(a){return a?dj(Ch)(a):""})),a}function eb(a){var b;return"y"===a?b=Th:"y2"===a?b=ai:"x"===a&&(b=Oh),b}function fb(a){var b=eb(a);return"string"==typeof b?b:b?b.text:null}function gb(a,b){var c=eb(a);"string"==typeof c?"y"===a?Th=b:"y2"===a?ai=b:"x"===a&&(Oh=b):c&&(c.text=b)}function hb(a){return 10*Math.sin(Math.PI*(a/180))}function ib(a){return 11.5-2.5*(a/15)}function jb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",ib(c)).attr("x",hb(c)).attr("transform","rotate("+c+")")}function kb(a,b){var c=eb(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 lb(){return kb("x",wh?"inner-top":"inner-right")}function mb(){return kb("y",wh?"inner-right":"inner-top")}function nb(){return kb("y2",wh?"inner-right":"inner-top")}function ob(a){return"y2"===a?nb():"y"===a?mb():lb()}function pb(){return fb("x")}function qb(){return fb("y")}function rb(){return fb("y2")}function sb(a,b){return a?b.isLeft?0:b.isCenter?gg/2:gg:b.isBottom?-ig:b.isMiddle?-ig/2:0}function tb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function ub(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function vb(){return sb(!wh,lb())}function wb(){return sb(wh,mb())}function xb(){return sb(wh,nb())}function yb(){return tb(!wh,lb())}function zb(){return tb(wh,mb())}function Ab(){return tb(wh,nb())}function Bb(){var a=lb();return wh?a.isInner?"1.2em":-25-Hb("x"):a.isInner?"-0.5em":Mh?Mh-10:"3em"}function Cb(){var a=mb();return wh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Hb("y")}function Db(){var a=nb();return wh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Hb("y2")}function Eb(){return ub(!wh,lb())}function Fb(){return ub(wh,mb())}function Gb(){return ub(wh,nb())}function Hb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Ib(a){var b=Cj.select("."+g.axisX+" ."+g.axisXLabel),c=Cj.select("."+g.axisY+" ."+g.axisYLabel),d=Cj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",vb).attr("dx",yb).attr("dy",Bb).text(pb),(a?c.transition():c).attr("x",wb).attr("dx",zb).attr("dy",Cb).attr("dy",Cb).text(qb),(a?d.transition():d).attr("x",xb).attr("dx",Ab).attr("dy",Db).text(rb)}function Jb(a){var b=!1;return ug(Lc(Nf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Kb(){var a=Mf.svg.arc().outerRadius(mg).innerRadius(og),b=function(b,c){var d;return c?a(b):(d=Jb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Lb(a){var b=Mf.svg.arc().outerRadius(ng*(a?a:1)).innerRadius(og);return function(a){var c=Jb(a);return c?b(c):"M 0 0"}}function Mb(a,b){return se(a.data)?rg(a,b):"M 0 0"}function Nb(a){var b,c,d,e,f=Jb(a),g="";return f&&(b=rg.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*mg*.8+","+d/e*mg*.8+")"),g}function Ob(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Pb(a){return tc({id:a.data.id,value:a.value,ratio:Ob(a)})}function Qb(a){var b,c,d,e;return Tb()?(b=Jb(a),c=b?b.value:null,d=Ob(b),e=Ub(),e?e(c,d):Gd(c,d)):""}function Rb(a,b){var c=Aj.selectAll("."+g.chartArc+sd(a)),d=Aj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});ye(a)&&c.selectAll("path").transition().duration(50).attr("d",sg).transition().duration(100).attr("d",tg).each(function(a){re(a.data)}),b||d.style("opacity",.3)}function Sb(a){var b=Aj.selectAll("."+g.chartArc+sd(a));b.selectAll("path").transition().duration(50).attr("d",rg),Aj.selectAll("."+g.arc).style("opacity",1)}function Tb(){return ke(Nf.data.targets)?Ai:ui}function Ub(){return ke(Nf.data.targets)?Bi:vi}function Vb(){return ke(Nf.data.targets)?Di:""}function Wb(){var a=ke(Nf.data.targets)?Ei:xi;return"function"==typeof a?a:function(){}}function Xb(){var a=ke(Nf.data.targets)?Fi:yi;return"function"==typeof a?a:function(){}}function Yb(){var a=ke(Nf.data.targets)?Gi:zi;return"function"==typeof a?a:function(){}}function Zb(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Tg.length>0)for(g=Uc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return Mf.min(Object.keys(i).map(function(a){return Mf.min(i[a])}))}function $b(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Tg.length>0)for(g=Vc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return Mf.max(Object.keys(i).map(function(a){return Mf.max(i[a])}))}function _b(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return cb(a.id)===c}),m="y2"===c?$h:Rh,n="y2"===c?Zh:Qh,o=b(m)?m:Zb(l),p=b(n)?n:$b(l),q="y2"===c?_h:Sh,r=Ad()&&wh;return 0===l.length?"y2"===c?Fg.domain():Eg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=Bd(o,p),j=ec(Eg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Wh&&(f=b(Wh.top)?Wh.top:e,g=b(Wh.bottom)?Wh.bottom:e),"y2"===c&&di&&(f=b(di.top)?di.top:e,g=b(di.bottom)?di.bottom:e),he(l)&&!Uc(l)&&(g=o),[o-g,p+f])}function ac(a){return Kh?Vi?Ae(Kh):Kh:Mf.min(a,function(a){return Mf.min(a.values,function(a){return a.x})})}function bc(a){return Jh?Vi?Ae(Jh):Jh:Mf.max(a,function(a){return Mf.max(a.values,function(a){return a.x})})}function cc(a){var c,d,e,f,g=Fc(a),h=g[1]-g[0];return Wi?d=0:he(a)?(c=Dc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Lh&&Fe(Lh)?(e=b(Lh.left)?Lh.left:d,f=b(Lh.right)?Lh.right:d):e=f="number"==typeof Lh?Lh:d,{left:e,right:f}}function dc(a){var b=[ac(a),bc(a)],c=b[0],d=b[1],e=cc(a),f=0,g=0;return c-d!==0||Wi||(c=Vi?new Date(.5*c.getTime()):-.5,d=Vi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ec(a){return a[1]-a[0]}function fc(a){for(var b=0;bb?0:b-c}function lc(a){var b,c=jc(a),d="y"===a.axis?Eg:Fg;return b="y"===a.axis||"y2"===a.axis?wh?ig:"start"in a?d(a.start):ig:wh?"end"in a?Dg(Vi?Ae(a.end):a.end):ig:ig,c>b?0:b-c}function mc(a){return Ng&&a===Ng||Fe(Og)&&Ge(Og,a)}function nc(a){return!mc(a)}function oc(a){return Ng?Ng:Fe(Og)?Og[a]:null}function pc(a,b){var c,d=b&&Fe(b)?Gc(b):[];return d.forEach(function(b){oc(b)===a&&(c=Nf.data.xs[b])}),c}function qc(a,b){return a in Nf.data.xs&&Nf.data.xs[a]&&Nf.data.xs[a][b]?Nf.data.xs[a][b]:b}function rc(a){Object.keys(a).forEach(function(b){Og[b]=a[b]})}function sc(a){return 1===Mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function tc(a){var b;return a&&(b=Rg[a.id],a.name=b?b:a.id),a}function uc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=wc(b[d],a.id,d)}),Nf.data.xs[a.id]=b})}function vc(a,b){a.forEach(function(a){b[a.id]&&uc([a],b[a.id])})}function wc(a,c,d){var e;return e=Vi?a?a instanceof Date?a:Ae(a):Ae(qc(c,d)):Xi&&!Wi?b(a)?+a:qc(c,d):d}function xc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Ng?(d=Object.keys(Nf.data.xs),Nf.data.xs[c]=d.length>0?Nf.data.xs[d[0]]:void 0):Fe(Og)&&(Nf.data.xs[c]=pc(f,Nf.data.targets)):Nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Qg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=oc(b),g=a[f],h=wc(g,b,e);return Xi&&Wi&&0===c&&g&&(0===e&&(Ah=[]),Ah.push(g)),("undefined"==typeof a[b]||Nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Vg&&fe(Gc(c).filter(function(a){return!(a in Wg)}),Vg),c.forEach(function(a){gc(a.id_org,a)}),c}function Ac(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 Bc(a){return a>0&&Nf.data.targets[0].values[a-1]?Nf.data.targets[0].values[a-1].x:void 0}function Cc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Fc(a){var b,c,d=Ec(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Gc(a){return a.map(function(a){return a.id})}function Hc(a){return a?"string"==typeof a?[a]:a:Gc(Nf.data.targets)}function Ic(a,b){var c,d=Gc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Vi?new Date(i):i);j.push(e)}return Vi||(j=j.sort(function(a,b){return a-b})),j}function Oc(a){fj=fj.concat(a)}function Pc(a){fj=fj.filter(function(b){return a.indexOf(b)<0})}function Qc(a){gj=gj.concat(a)}function Rc(a){gj=gj.filter(function(b){return a.indexOf(b)<0})}function Sc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Tc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Vc(a){return Tc(a,function(a){return a>0})}function Wc(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||0===a[f].x)&&(e=e.concat(Md(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Md(a,g))),Pd(e,b)):Nd(a,b,f,g)}function Od(a,b){var c;return c=a.map(function(a){return Nd(a.values,b)}),Pd(c,b)}function Pd(a,b){var c,d;return a.forEach(function(a){var e=He(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Qd(a,b){return Mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Rd(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 Sd(){return Yg&&"desc"===Yg.toLowerCase()}function Td(){return Yg&&"asc"===Yg.toLowerCase()}function Ud(a){var b=Td(),c=Sd();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 Yg&&a.sort(Yg),a}function Vd(a,c){var d,e,f,g,h,i,j,k=le(Nf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&Ii&&(Fj.html(Li(a,db(),Cd(k),cj)).style("display","block"),d=Fj.property("offsetWidth"),e=Fj.property("offsetHeight"),k?(g=gg/2+c[0],i=ig/2+c[1]+20):(wh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-y(),i=Dg(l[0].x)+20):(f=s(),g=f+x()+Dg(l[0].x)+20,h=g+d,j=f+t()-y(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),Fj.style("top",i+"px").style("left",g+"px"))}function Wd(){Fj.style("display","none")}function Xd(a){var c=a.filter(function(a){return a&&b(a.value)});if(Ii&&!ie(Nf.data.targets)&&!le(Nf.data.targets)){var d=Cj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(wh?"y1":"x1",Id).attr(wh?"y2":"x2",Id),pf(d,"grid")}}function Yd(){Cj.select("line."+g.xgridFocus).style("visibility","hidden")}function Zd(a,b){var c,d,e,f,h=[],i=Cj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=dc(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function $d(a){return a.x||0===a.x?Dg(a.x):null}function _d(a){return $(a.id)(a.value)}function ae(){var a,b,d={},e=0;return Lc(Nf.data.targets.filter(oe)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ee(a,b){return"number"==typeof si?si:b?2*a.tickOffset()*ti/b:0}function fe(a,b){Hc(a).forEach(function(a){Jj[a]=b===Wg[a],Wg[a]=b})}function ge(a,b){var c=!1;return a.forEach(function(a){Wg[a.id]===b&&(c=!0),a.id in Wg||"line"!==b||(c=!0)}),c}function he(a){return ge(a,"bar")}function ie(a){return ge(a,"scatter")}function je(a){return ge(a,"pie")}function ke(a){return ge(a,"donut")}function le(a){return je(a)||ke(a)}function me(a){var b="string"==typeof a?a:a.id;return!(b in Wg)||"line"===Wg[b]||"spline"===Wg[b]||"area"===Wg[b]||"area-spline"===Wg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"spline"===Wg[b]||"area-spline"===Wg[b]}function oe(a){var b="string"==typeof a?a:a.id;return"bar"===Wg[b]}function pe(a){var b="string"==typeof a?a:a.id;return"scatter"===Wg[b]}function qe(a){var b="string"==typeof a?a:a.id;return"pie"===Wg[b]}function re(a){var b="string"==typeof a?a:a.id;return"donut"===Wg[b]}function se(a){return qe(a)||re(a)}function te(a){return me(a)?[a]:[]}function ue(a){return se(a.data)?[a]:[]}function ve(a){return oe(a)?a.values:[]}function we(a){return me(a)||pe(a)?a.values:[]}function xe(a){return oe(a)||me(a)?a.values:[]}function ye(a){return re(a)&&Ci||qe(a)&&wi}function ze(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function Ae(b){var c;try{c=Pg?Mf.time.format(Pg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Pg)}return c}function Be(a,b){var c=Mf.mouse(a),d=Mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ge(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function He(a,b){var c="y"===cb(a.id)?Eg:Fg,d=wh?1:0,e=wh?0:1;return Math.pow(Dg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ie(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Je(a,b,c){return d(a[b])?a[b]:c}function Ke(a){return 10*Math.ceil(a/10)}function Le(a,b,c){jh(b,a.node()),Cj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Xc(g.selectedCircle,c)}).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d).attr("stroke",function(){return cj(b)}).attr("r",1.4*We(b)).transition().duration(100).attr("r",We)}function Me(a,b,c){kh(b,a.node()),Cj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ne(a,b,c,d){a?Le(b,c,d):Me(b,c,d)}function Oe(a,b){jh(b,a.node()),a.transition().duration(100).style("fill",function(){return Mf.rgb(cj(b)).brighter(.75)})}function Pe(a,b){kh(b,a.node()),a.transition().duration(100).style("fill",function(){return cj(b)})}function Qe(a,b,c,d){a?Oe(b,c,d):Pe(b,c,d)}function Re(a,b,c,d){Qe(a,b,c.data,d)}function Se(a){return"circle"===a.nodeName?Ne:Mf.select(a).classed(g.bar)?Qe:Re}function Te(a){return a.filter(function(a){return b(a.value)})}function Ue(a){return li?"function"==typeof mi?mi(a):mi:0}function Ve(a){return oi?pi?pi:1.75*Ue(a):Ue(a)}function We(a){return qi?qi:4*Ue(a)}function Xe(a,c){return(c?Cj.selectAll("."+g.circles+rd(c)):Cj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ye(a,b){Xe(a,b).classed(g.EXPANDED,!0).attr("r",Ve)}function Ze(a){Xe(a).filter(function(){return Mf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Ue)}function $e(a){return Cj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function _e(a){$e(a).classed(g.EXPANDED,!0)}function af(a){$e(a).classed(g.EXPANDED,!1)}function bf(a,b){var c=ff(a,b);return function(a,b){var d=c(a,b),e=wh?1:0,f=wh?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 cf(a,b){var c=ff(a,!1),d=b?df:ef;return function(a,b){return d(c(a,b),a,this)}}function df(a,b){var c;return wh?(c=oe(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function ef(a,b,c){var d=c.getBoundingClientRect();return wh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:oe(b)?-3:-6)}function ff(a,b){var c=a.__max__+1,d=ee(Jg,c),e=be(d,c,a,!!b),f=ce(!!b),g=de(a,!!b),h=b?_:$;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return wh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function gf(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;gb?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&a=0;return"url("+(c?"":document.URL.split("#")[0])+"#"+b+")"}function k(a){return Math.ceil(a)+.5}function l(a,b){var c,d,e;b&&b.axisX?c=b.axisX:(c=Cj.select("."+g.axisX),a&&(c=c.transition())),b&&b.axisY?d=b.axisY:(d=Cj.select("."+g.axisY),a&&(d=d.transition())),b&&b.axisY2?e=b.axisY2:(e=Cj.select("."+g.axisY2),a&&(e=e.transition())),Cj.attr("transform",mj.main),c.attr("transform",mj.x),d.attr("transform",mj.y),e.attr("transform",mj.y2),Cj.select("."+g.chartArcs).attr("transform",mj.arc)}function m(a,b){var c;b&&b.axisSubX?c=b.axisSubX:(c=Dj.select("."+g.axisX),a&&(c=c.transition())),Dj.attr("transform",mj.context),c.attr("transform",mj.subx)}function n(a){(a?Ej.transition():Ej).attr("transform",mj.legend)}function o(a,b){l(a,b),nh&&m(a,b),n(a)}function p(){var a=U(),b=T(),c=nj?0:a,d=le(Nf.data.targets),e=wh||d?0:A("x"),f=nh&&!d?oh+e:0;kg=t(),lg=u(),wh?(dg={top:A("y2")+v(),right:d?0:y(),bottom:A("y")+c+w(),left:f+(d?0:x())},eg={top:dg.top,right:0/0,bottom:20+c,left:sj}):(dg={top:4+v(),right:d?0:y(),bottom:e+f+c+w(),left:d?0:x()},eg={top:lg-f-c,right:0/0,bottom:e+c,left:dg.left}),fg={top:nj?0:lg-a,right:0/0,bottom:0,left:nj?kg-b:0},gg=kg-dg.left-dg.right,ig=lg-dg.top-dg.bottom,0>gg&&(gg=0),0>ig&&(ig=0),hg=wh?dg.left-sj-tj:gg,jg=wh?ig:lg-eg.top-eg.bottom,0>hg&&(hg=0),0>jg&&(jg=0),pg=gg-(nj?b+10:0),qg=ig-(nj?0:10),r(),nj&&d&&(fg.left=pg/2+1.1*ng)}function q(){Cj.select("line."+g.xgridFocus).attr("x1",wh?0:-10).attr("x2",wh?gg:-10).attr("y1",wh?-10:dg.top).attr("y2",wh?-10:ig)}function r(){ng=Math.min(pg,qg)/2,mg=.95*ng,og=ke(Nf.data.targets)?.6*mg:0}function s(){var a=wh?g.axisX:g.axisY,b=Cj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Gj.node().getBoundingClientRect(),e=le(Nf.data.targets),f=c.right-d.left-(e?0:x());return f>0?f:0}function t(){return Qf?Qf:B()}function u(){var a=Rf?Rf:C();return a>0?a:320}function v(){return Uf?Uf:0}function w(){return Vf?Vf:0}function x(){return Sf?Sf:wh?xh?Ke(z("x")):1:!Ph||Uh?1:Ke(z("y"))}function y(){var a=10,b=nj?T()+20:0;return Tf?Tf:wh?a+b:(!Yh||bi?a:Ke(z("y2")))+b}function z(a){var b=ob(a);return b.isInner?20+Hb(a):40+Hb(a)}function A(a){return"x"!==a||xh?"x"===a&&Mh?Mh:"y"!==a||Ph?"y2"!==a||Yh?(ob(a).isInner?30:40)+("y2"===a?-10:0):uj:qh&&!nj?10:1:0}function B(){return+Gj.style("width").replace("px","")}function C(){return+Gj.style("height").replace("px","")}function D(a){return a?-31:-(dg.left-1)}function E(a){return a?-20:-4}function F(){return D(!wh)}function G(){return E(!wh)}function H(){return D(wh)}function I(){return E(wh)}function J(a){return a?gg+2+30+30:dg.left+20}function K(a){return a?(Mh?Mh:0)+80:ig+8}function L(){return J(!wh)}function M(){return K(!wh)}function N(){return J(wh)}function O(){return K(wh)}function P(){var a,b,c,d,e,f=Ec(Nf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=Dg(b.x)-Dg(a.x),0===c?wh?ig:gg:(d=Dc(),e=he(Nf.data.targets)?(d-(Wi?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function Q(a){oj=a}function R(a){pj=a}function S(a){qj=a}function T(){return qh?nj?pj*(oj+1):kg:0}function U(){return qh?nj?lg:qj*(oj+1):0}function V(){var a,b,c=!Dg;vg=wh?1:0,wg=wh?ig:gg,xg=wh?0:ig,yg=wh?gg:1,zg=vg,Ag=wg,Bg=wh?0:jg,Cg=wh?hg:1,Dg=Y(vg,wg,c?void 0:Dg.domain(),function(){return Jg.tickOffset()}),Eg=Z(xg,yg,c?void 0:Eg.domain()),Fg=Z(xg,yg,c?void 0:Fg.domain()),Gg=Y(vg,wg,Hj,function(a){return a%1?0:Mg.tickOffset()}),Hg=Z(Bg,Cg,c?void 0:Hg.domain()),Ig=Z(Bg,Cg,c?void 0:Ig.domain()),a=db(),b=Hh?Hh:c?void 0:Jg.tickValues(),Jg=ab(Dg,ij,a,b),Mg=ab(Gg,lj,a,b),Kg=bb(Eg,jj,Vh,Xh),Lg=bb(Fg,kj,ci,ei),c||(vj.scale(Gg),Wf&&zj.scale(Dg)),W()}function W(){rg=Kb(),sg=Lb(),tg=Lb(.98)}function X(a,b,c){return(c?Mf.time.scale():Mf.scale.linear()).range([a,b])}function Y(a,b,c,d){var e,f=X(a,b,Vi),g=c?f.domain(c):f;Wi?(d=d||function(){return 0},f=function(a,b){var c=g(a)+d(a);return b?c:Math.ceil(c)}):f=function(a,b){var c=g(a);return b?c:Math.ceil(c)};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return Hj&&Hj[0]===a[0]&&Hj[1]a?a.toFixed(0):a};return Ch&&("function"==typeof Ch?a=Ch:Vi&&(a=function(a){return a?dj(Ch)(a):""})),a}function eb(a){var b;return"y"===a?b=Th:"y2"===a?b=ai:"x"===a&&(b=Oh),b}function fb(a){var b=eb(a);return"string"==typeof b?b:b?b.text:null}function gb(a,b){var c=eb(a);"string"==typeof c?"y"===a?Th=b:"y2"===a?ai=b:"x"===a&&(Oh=b):c&&(c.text=b)}function hb(a){return 10*Math.sin(Math.PI*(a/180))}function ib(a){return 11.5-2.5*(a/15)}function jb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",ib(c)).attr("x",hb(c)).attr("transform","rotate("+c+")")}function kb(a,b){var c=eb(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 lb(){return kb("x",wh?"inner-top":"inner-right")}function mb(){return kb("y",wh?"inner-right":"inner-top")}function nb(){return kb("y2",wh?"inner-right":"inner-top")}function ob(a){return"y2"===a?nb():"y"===a?mb():lb()}function pb(){return fb("x")}function qb(){return fb("y")}function rb(){return fb("y2")}function sb(a,b){return a?b.isLeft?0:b.isCenter?gg/2:gg:b.isBottom?-ig:b.isMiddle?-ig/2:0}function tb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function ub(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function vb(){return sb(!wh,lb())}function wb(){return sb(wh,mb())}function xb(){return sb(wh,nb())}function yb(){return tb(!wh,lb())}function zb(){return tb(wh,mb())}function Ab(){return tb(wh,nb())}function Bb(){var a=lb();return wh?a.isInner?"1.2em":-25-Hb("x"):a.isInner?"-0.5em":Mh?Mh-10:"3em"}function Cb(){var a=mb();return wh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Hb("y")}function Db(){var a=nb();return wh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Hb("y2")}function Eb(){return ub(!wh,lb())}function Fb(){return ub(wh,mb())}function Gb(){return ub(wh,nb())}function Hb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Ib(a){var b=Cj.select("."+g.axisX+" ."+g.axisXLabel),c=Cj.select("."+g.axisY+" ."+g.axisYLabel),d=Cj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",vb).attr("dx",yb).attr("dy",Bb).text(pb),(a?c.transition():c).attr("x",wb).attr("dx",zb).attr("dy",Cb).attr("dy",Cb).text(qb),(a?d.transition():d).attr("x",xb).attr("dx",Ab).attr("dy",Db).text(rb)}function Jb(a){var b=!1;return ug(Lc(Nf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Kb(){var a=Mf.svg.arc().outerRadius(mg).innerRadius(og),b=function(b,c){var d;return c?a(b):(d=Jb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Lb(a){var b=Mf.svg.arc().outerRadius(ng*(a?a:1)).innerRadius(og);return function(a){var c=Jb(a);return c?b(c):"M 0 0"}}function Mb(a,b){return se(a.data)?rg(a,b):"M 0 0"}function Nb(a){var b,c,d,e,f=Jb(a),g="";return f&&(b=rg.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*mg*.8+","+d/e*mg*.8+")"),g}function Ob(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Pb(a){return tc({id:a.data.id,value:a.value,ratio:Ob(a)})}function Qb(a){var b,c,d,e;return Tb()?(b=Jb(a),c=b?b.value:null,d=Ob(b),e=Ub(),e?e(c,d):Gd(c,d)):""}function Rb(a,b){var c=Aj.selectAll("."+g.chartArc+sd(a)),d=Aj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});ye(a)&&c.selectAll("path").transition().duration(50).attr("d",sg).transition().duration(100).attr("d",tg).each(function(a){re(a.data)}),b||d.style("opacity",.3)}function Sb(a){var b=Aj.selectAll("."+g.chartArc+sd(a));b.selectAll("path").transition().duration(50).attr("d",rg),Aj.selectAll("."+g.arc).style("opacity",1)}function Tb(){return ke(Nf.data.targets)?Ai:ui}function Ub(){return ke(Nf.data.targets)?Bi:vi}function Vb(){return ke(Nf.data.targets)?Di:""}function Wb(){var a=ke(Nf.data.targets)?Ei:xi;return"function"==typeof a?a:function(){}}function Xb(){var a=ke(Nf.data.targets)?Fi:yi;return"function"==typeof a?a:function(){}}function Yb(){var a=ke(Nf.data.targets)?Gi:zi;return"function"==typeof a?a:function(){}}function Zb(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Tg.length>0)for(g=Uc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return Mf.min(Object.keys(i).map(function(a){return Mf.min(i[a])}))}function $b(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Tg.length>0)for(g=Vc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return Mf.max(Object.keys(i).map(function(a){return Mf.max(i[a])}))}function _b(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return cb(a.id)===c}),m="y2"===c?$h:Rh,n="y2"===c?Zh:Qh,o=b(m)?m:Zb(l),p=b(n)?n:$b(l),q="y2"===c?_h:Sh,r=Ad()&&wh;return 0===l.length?"y2"===c?Fg.domain():Eg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=Bd(o,p),j=ec(Eg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Wh&&(f=b(Wh.top)?Wh.top:e,g=b(Wh.bottom)?Wh.bottom:e),"y2"===c&&di&&(f=b(di.top)?di.top:e,g=b(di.bottom)?di.bottom:e),he(l)&&!Uc(l)&&(g=o),[o-g,p+f])}function ac(a){return Kh?Vi?Ae(Kh):Kh:Mf.min(a,function(a){return Mf.min(a.values,function(a){return a.x})})}function bc(a){return Jh?Vi?Ae(Jh):Jh:Mf.max(a,function(a){return Mf.max(a.values,function(a){return a.x})})}function cc(a){var c,d,e,f,g=Fc(a),h=g[1]-g[0];return Wi?d=0:he(a)?(c=Dc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Lh&&Fe(Lh)?(e=b(Lh.left)?Lh.left:d,f=b(Lh.right)?Lh.right:d):e=f="number"==typeof Lh?Lh:d,{left:e,right:f}}function dc(a){var b=[ac(a),bc(a)],c=b[0],d=b[1],e=cc(a),f=0,g=0;return c-d!==0||Wi||(c=Vi?new Date(.5*c.getTime()):-.5,d=Vi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ec(a){return a[1]-a[0]}function fc(a){for(var b=0;bb?0:b-c}function lc(a){var b,c=jc(a),d="y"===a.axis?Eg:Fg;return b="y"===a.axis||"y2"===a.axis?wh?ig:"start"in a?d(a.start):ig:wh?"end"in a?Dg(Vi?Ae(a.end):a.end):ig:ig,c>b?0:b-c}function mc(a){return Ng&&a===Ng||Fe(Og)&&Ge(Og,a)}function nc(a){return!mc(a)}function oc(a){return Ng?Ng:Fe(Og)?Og[a]:null}function pc(a,b){var c,d=b&&Fe(b)?Gc(b):[];return d.forEach(function(b){oc(b)===a&&(c=Nf.data.xs[b])}),c}function qc(a,b){return a in Nf.data.xs&&Nf.data.xs[a]&&Nf.data.xs[a][b]?Nf.data.xs[a][b]:b}function rc(a){Object.keys(a).forEach(function(b){Og[b]=a[b]})}function sc(a){return 1===Mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function tc(a){var b;return a&&(b=Rg[a.id],a.name=b?b:a.id),a}function uc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=wc(b[d],a.id,d)}),Nf.data.xs[a.id]=b})}function vc(a,b){a.forEach(function(a){b[a.id]&&uc([a],b[a.id])})}function wc(a,c,d){var e;return e=Vi?a?a instanceof Date?a:Ae(a):Ae(qc(c,d)):Xi&&!Wi?b(a)?+a:qc(c,d):d}function xc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Ng?(d=Object.keys(Nf.data.xs),Nf.data.xs[c]=d.length>0?Nf.data.xs[d[0]]:void 0):Fe(Og)&&(Nf.data.xs[c]=pc(f,Nf.data.targets)):Nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Qg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=oc(b),g=a[f],h=wc(g,b,e);return Xi&&Wi&&0===c&&g&&(0===e&&(Ah=[]),Ah.push(g)),("undefined"==typeof a[b]||Nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Vg&&fe(Gc(c).filter(function(a){return!(a in Wg)}),Vg),c.forEach(function(a){gc(a.id_org,a)}),c}function Ac(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 Bc(a){return a>0&&Nf.data.targets[0].values[a-1]?Nf.data.targets[0].values[a-1].x:void 0}function Cc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Fc(a){var b,c,d=Ec(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Gc(a){return a.map(function(a){return a.id})}function Hc(a){return a?"string"==typeof a?[a]:a:Gc(Nf.data.targets)}function Ic(a,b){var c,d=Gc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Vi?new Date(i):i);j.push(e)}return Vi||(j=j.sort(function(a,b){return a-b})),j}function Oc(a){fj=fj.concat(a)}function Pc(a){fj=fj.filter(function(b){return a.indexOf(b)<0})}function Qc(a){gj=gj.concat(a)}function Rc(a){gj=gj.filter(function(b){return a.indexOf(b)<0})}function Sc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Tc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Vc(a){return Tc(a,function(a){return a>0})}function Wc(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||0===a[f].x)&&(e=e.concat(Md(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Md(a,g))),Pd(e,b)):Nd(a,b,f,g)}function Od(a,b){var c;return c=a.map(function(a){return Nd(a.values,b)}),Pd(c,b)}function Pd(a,b){var c,d;return a.forEach(function(a){var e=He(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Qd(a,b){return Mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Rd(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 Sd(){return Yg&&"desc"===Yg.toLowerCase()}function Td(){return Yg&&"asc"===Yg.toLowerCase()}function Ud(a){var b=Td(),c=Sd();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 Yg&&a.sort(Yg),a}function Vd(a,c){var d,e,f,g,h,i,j,k=le(Nf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&Ii&&(Fj.html(Li(a,db(),Cd(k),cj)).style("display","block"),d=Fj.property("offsetWidth"),e=Fj.property("offsetHeight"),k?(g=gg/2+c[0],i=ig/2+c[1]+20):(wh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-y(),i=Dg(l[0].x)+20):(f=s(),g=f+x()+Dg(l[0].x)+20,h=g+d,j=f+t()-y(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),Fj.style("top",i+"px").style("left",g+"px"))}function Wd(){Fj.style("display","none")}function Xd(a){var c=a.filter(function(a){return a&&b(a.value)});if(Ii&&!ie(Nf.data.targets)&&!le(Nf.data.targets)){var d=Cj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(wh?"y1":"x1",Id).attr(wh?"y2":"x2",Id),pf(d,"grid")}}function Yd(){Cj.select("line."+g.xgridFocus).style("visibility","hidden")}function Zd(a,b){var c,d,e,f,h=[],i=Cj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=dc(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function $d(a){return a.x||0===a.x?Dg(a.x):null}function _d(a){return $(a.id)(a.value)}function ae(){var a,b,d={},e=0;return Lc(Nf.data.targets.filter(oe)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ee(a,b){return"number"==typeof si?si:b?2*a.tickOffset()*ti/b:0}function fe(a,b){Hc(a).forEach(function(a){Jj[a]=b===Wg[a],Wg[a]=b})}function ge(a,b){var c=!1;return a.forEach(function(a){Wg[a.id]===b&&(c=!0),a.id in Wg||"line"!==b||(c=!0)}),c}function he(a){return ge(a,"bar")}function ie(a){return ge(a,"scatter")}function je(a){return ge(a,"pie")}function ke(a){return ge(a,"donut")}function le(a){return je(a)||ke(a)}function me(a){var b="string"==typeof a?a:a.id;return!(b in Wg)||"line"===Wg[b]||"spline"===Wg[b]||"area"===Wg[b]||"area-spline"===Wg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"spline"===Wg[b]||"area-spline"===Wg[b]}function oe(a){var b="string"==typeof a?a:a.id;return"bar"===Wg[b]}function pe(a){var b="string"==typeof a?a:a.id;return"scatter"===Wg[b]}function qe(a){var b="string"==typeof a?a:a.id;return"pie"===Wg[b]}function re(a){var b="string"==typeof a?a:a.id;return"donut"===Wg[b]}function se(a){return qe(a)||re(a)}function te(a){return me(a)?[a]:[]}function ue(a){return se(a.data)?[a]:[]}function ve(a){return oe(a)?a.values:[]}function we(a){return me(a)||pe(a)?a.values:[]}function xe(a){return oe(a)||me(a)?a.values:[]}function ye(a){return re(a)&&Ci||qe(a)&&wi}function ze(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function Ae(b){var c;try{c=Pg?Mf.time.format(Pg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Pg)}return c}function Be(a,b){var c=Mf.mouse(a),d=Mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ge(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function He(a,b){var c="y"===cb(a.id)?Eg:Fg,d=wh?1:0,e=wh?0:1;return Math.pow(Dg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ie(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Je(a,b,c){return d(a[b])?a[b]:c}function Ke(a){return 10*Math.ceil(a/10)}function Le(a,b,c){jh(b,a.node()),Cj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Xc(g.selectedCircle,c)}).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d).attr("stroke",function(){return cj(b)}).attr("r",1.4*We(b)).transition().duration(100).attr("r",We)}function Me(a,b,c){kh(b,a.node()),Cj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ne(a,b,c,d){a?Le(b,c,d):Me(b,c,d)}function Oe(a,b){jh(b,a.node()),a.transition().duration(100).style("fill",function(){return Mf.rgb(cj(b)).brighter(.75)})}function Pe(a,b){kh(b,a.node()),a.transition().duration(100).style("fill",function(){return cj(b)})}function Qe(a,b,c,d){a?Oe(b,c,d):Pe(b,c,d)}function Re(a,b,c,d){Qe(a,b,c.data,d)}function Se(a){return"circle"===a.nodeName?Ne:Mf.select(a).classed(g.bar)?Qe:Re}function Te(a){return a.filter(function(a){return b(a.value)})}function Ue(a){return li?"function"==typeof mi?mi(a):mi:0}function Ve(a){return oi?pi?pi:1.75*Ue(a):Ue(a)}function We(a){return qi?qi:4*Ue(a)}function Xe(a,c){return(c?Cj.selectAll("."+g.circles+rd(c)):Cj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ye(a,b){Xe(a,b).classed(g.EXPANDED,!0).attr("r",Ve)}function Ze(a){Xe(a).filter(function(){return Mf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Ue)}function $e(a){return Cj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function _e(a){$e(a).classed(g.EXPANDED,!0)}function af(a){$e(a).classed(g.EXPANDED,!1)}function bf(a,b){var c=ff(a,b);return function(a,b){var d=c(a,b),e=wh?1:0,f=wh?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 cf(a,b){var c=ff(a,!1),d=b?df:ef;return function(a,b){return d(c(a,b),a,this)}}function df(a,b){var c;return wh?(c=oe(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function ef(a,b,c){var d=c.getBoundingClientRect();return wh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:oe(b)?-3:-6)}function ff(a,b){var c=a.__max__+1,d=ee(Jg,c),e=be(d,c,a,!!b),f=ce(!!b),g=de(a,!!b),h=b?_:$;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return wh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function gf(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function hf(b){var c,d,e;if(Gj=Mf.select(Pf),Gj.empty())throw new Error("Element to bind not found");if(Gj.html("").classed("c3",!0),Nf.data.xs={},Nf.data.targets=zc(b),bh&&(Nf.data.targets=Nf.data.targets.filter(bh)),ah&&Oc(ah===!0?Gc(Nf.data.targets):ah),p(),V(),Dg.domain(Mf.extent(dc(Nf.data.targets))),Eg.domain(_b(Nf.data.targets,"y")),Fg.domain(_b(Nf.data.targets,"y2")),Gg.domain(Dg.domain()),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Hj=Dg.domain(),vj.scale(Gg),Wf&&zj.scale(Dg),Aj=Gj.append("svg").style("overflow","hidden").on("mouseenter",$f).on("mouseleave",_f),Bj=Aj.append("defs"),Bj.append("clipPath").attr("id",Pi).append("rect"),Bj.append("clipPath").attr("id",Qi).append("rect"),Bj.append("clipPath").attr("id",Ri).append("rect"),uf(),Cj=Aj.append("g").attr("transform",mj.main),Dj=Aj.append("g").attr("transform",mj.context),Ej=Aj.append("g").attr("transform",mj.legend),nh||Dj.style("visibility","hidden"),qh||(Ej.style("visibility","hidden"),gj=Gc(Nf.data.targets)),Fj=Gj.style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Hf(Gc(Nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=Cj.append("g").attr("clip-path",Si).attr("class",g.grid),fi&&d.append("g").attr("class",g.xgrids),Fe(hi)&&d.append("g").attr("class",g.xgridLines),ni&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),ii&&d.append("g").attr("class",g.ygrids),Fe(ji)&&d.append("g").attr("class",g.ygridLines),Cj.append("g").attr("clip-path",Si).attr("class",g.regions),Cj.append("g").attr("clip-path",Si).attr("class",g.chart),c=Cj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Wf?wh?"ns-resize":"ew-resize":null),Cj.select("."+g.chart).append("g").attr("class",g.chartBars),Cj.select("."+g.chart).append("g").attr("class",g.chartLines),Cj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",mj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Vb()),Cj.select("."+g.chart).append("g").attr("class",g.chartTexts),Wf&&Cj.insert("rect",Yf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",gg).attr("height",ig).style("opacity",0).style("cursor",wh?"ns-resize":"ew-resize").call(zj).on("dblclick.zoom",null),Nh&&vj.extent("function"!=typeof Nh?Nh:Nh(dc())),hj.x=Cj.append("g").attr("class",g.axisX).attr("clip-path",Ti).attr("transform",mj.x).style("visibility",xh?"visible":"hidden"),hj.x.append("text").attr("class",g.axisXLabel).attr("transform",wh?"rotate(-90)":"").style("text-anchor",Eb),hj.y=Cj.append("g").attr("class",g.axisY).attr("clip-path",Ui).attr("transform",mj.y).style("visibility",Ph?"visible":"hidden"),hj.y.append("text").attr("class",g.axisYLabel).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Fb),hj.y2=Cj.append("g").attr("class",g.axisY2).attr("transform",mj.y2).style("visibility",Yh?"visible":"hidden"),hj.y2.append("text").attr("class",g.axisY2Label).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Gb),Dj.append("g").attr("clip-path",Si).attr("class",g.chart),Dj.select("."+g.chart).append("g").attr("class",g.chartBars),Dj.select("."+g.chart).append("g").attr("class",g.chartLines),Dj.append("g").attr("clip-path",Si).attr("class",g.brush).call(vj).selectAll("rect").attr(wh?"width":"height",wh?hg:jg),hj.subx=Dj.append("g").attr("class",g.axisX).attr("transform",mj.subx).attr("clip-path",wh?"":Ti),xf(Nf.data.targets),qf({withUpdateTranslate:!0,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Mi){if(Vi&&"string"==typeof Ni){for(Ni=Ae(Ni),e=0;e0){d=[];for(var f in Rg)for(c=0;cf&&h>c&&d>i&&j>d;else{if(!n.classed(g.bar))return;m=Rd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Qe,q=!(c>h||f>c+e||d>j||i>d+k)}q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function nf(a){le(Nf.data.targets)||ch&&(Yi=a,Cj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Zi=!0,lh())}function of(){le(Nf.data.targets)||ch&&(Cj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),Cj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Zi=!1,mh())}function pf(a,b){"grid"===b&&a.each(function(){var a=Mf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function qf(a,c){var d,e,f,h,i,j,k,l,m,n,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,Q,R,S,T,U,W,X,Y,Z,$=ae(),_=le(Nf.data.targets),ab=Lc(Nf.data.targets);if(a=a||{},E=Je(a,"withY",!0),F=Je(a,"withSubchart",!0),G=Je(a,"withTransition",!0),J=Je(a,"withTransform",!1),K=Je(a,"withUpdateXDomain",!1),L=Je(a,"withUpdateOrgXDomain",!1),N=Je(a,"withUpdateTranslate",!1),M=Je(a,"withLegend",!1),H=Je(a,"withTransitionForExit",G),I=Je(a,"withTransitionForAxis",G),T=G?cg:0,U=H?T:0,W=I?T:0,c=c||vf(W),N&&(wh?(hj.x.call(Jg),hj.subx.call(Mg)):(hj.y.call(Kg),hj.y2.call(Lg)),p(),V(),uf(),o(!1)),M&&qh&&Hf(Gc(Nf.data.targets),a,c),Wi&&0===ab.length&&Dg.domain([0,hj.x.selectAll(".tick").size()]),ab.length&&(L&&(Dg.domain(Mf.extent(dc(ab))),Hj=Dg.domain(),Wf&&zj.scale(Dg).updateScaleExtent(),Gg.domain(Dg.domain()),vj.scale(Gg)),K&&(Dg.domain(vj.empty()?Hj:vj.extent()),Wf&&zj.scale(Dg).updateScaleExtent()),Hh||!Gh&&!Fh||(X=Nc(Mc(ab),Fh),Jg.tickValues(X),Mg.tickValues(X))),Eg.domain(_b(ab,"y")),Fg.domain(_b(ab,"y2")),hj.x.style("opacity",_?0:1),hj.y.style("opacity",_?0:1),hj.y2.style("opacity",_?0:1),hj.subx.style("opacity",_?0:1),c.axisX.call(Jg),c.axisY.call(Kg),c.axisY2.call(Lg),c.axisSubX.call(Mg),Ib(G),K&&ab.length)if(Dh&&X){for(Y=1;Y=0&&Mf.select(this).style("display",b%Z?"none":"block")})}else Aj.selectAll("."+g.axisX+" .tick text").style("display","block");!wh&&Ih&&jb(hj.x,c.axisX,Ih),O=bf($),R=cf($,!0),S=cf($,!1),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Fj.style("display","none"),q(),Cj.select("line."+g.xgridFocus).style("visibility","hidden"),fi&&(f=Zd(gi,Dg),B=Wi?Jg.tickOffset():0,e=wh?{x1:0,x2:gg,y1:function(a){return Dg(a)-B},y2:function(a){return Dg(a)-B}}:{x1:function(a){return Dg(a)+B},x2:function(a){return Dg(a)+B},y1:dg.top,y2:ig},d=Cj.select("."+g.xgrids).selectAll("."+g.xgrid).data(f),d.enter().append("line").attr("class",g.xgrid),d.attr(e).style("opacity",function(){return+Mf.select(this).attr(wh?"y1":"x1")===(wh?ig:0)?0:1}),d.exit().remove()),Fe(hi)&&(h=Cj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(hi),i=h.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),i.append("line").style("opacity",0),i.append("text").attr("text-anchor","end").attr("transform",wh?"":"rotate(-90)").attr("dx",wh?0:-dg.top).attr("dy",-5).style("opacity",0),h.select("line").transition().duration(T).attr("x1",wh?0:Jd).attr("x2",wh?gg:Jd).attr("y1",wh?Jd:dg.top).attr("y2",wh?Jd:ig).style("opacity",1),h.select("text").transition().duration(T).attr("x",wh?gg:0).attr("y",Jd).text(function(a){return a.text}).style("opacity",1),h.exit().transition().duration(T).style("opacity",0).remove()),E&&ii&&(j=Cj.select("."+g.ygrids).selectAll("."+g.ygrid).data(Eg.ticks(ki)),j.enter().append("line").attr("class",g.ygrid),j.attr("x1",wh?Eg:0).attr("x2",wh?Eg:gg).attr("y1",wh?0:Eg).attr("y2",wh?ig:Eg),j.exit().remove(),pf(j,"grid")),E&&Fe(ji)&&(k=Cj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(ji),l=k.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",wh?"rotate(-90)":"").attr("dx",wh?0:-dg.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",wh?Kd:0).attr("x2",wh?Kd:gg).attr("y1",wh?0:Kd).attr("y2",wh?ig:Kd).style("opacity",1),k.select("text").transition().duration(T).attr("x",wh?0:gg).attr("y",Kd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),u=Cj.select("."+g.regions).selectAll("."+g.region).data(Hi),u.enter().append("g").attr("class",kd).append("rect").style("fill-opacity",0),u.selectAll("rect").transition().duration(T).attr("x",ic).attr("y",jc).attr("width",kc).attr("height",lc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),u.exit().transition().duration(T).style("opacity",0).remove(),s=Cj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),s.enter().append("path").attr("class",ed).style("stroke","none").style("fill",cj),s.style("opacity",wd).transition().duration(T).attr("d",O).style("fill",cj).style("opacity",1),s.exit().transition().duration(U).style("opacity",0).remove(),m=Cj.selectAll("."+g.lines).selectAll("."+g.line).data(te),m.enter().append("path").attr("class",ad).style("stroke",cj),m.style("opacity",wd).transition().duration(T).attr("d",wj).style("stroke",cj).style("opacity",1),m.exit().transition().duration(U).style("opacity",0).remove(),n=Cj.selectAll("."+g.areas).selectAll("."+g.area).data(te),n.enter().append("path").attr("class",id).style("fill",cj).style("opacity",function(){return Ij=+Mf.select(this).style("opacity"),0}),n.style("opacity",0).transition().duration(T).attr("d",xj).style("fill",cj).style("opacity",Ij),n.exit().transition().duration(U).style("opacity",0).remove(),r=Cj.selectAll("."+g.circles).selectAll("."+g.circle).data(we),r.enter().append("circle").attr("class",cd).attr("r",Ue).style("fill",cj),r.style("opacity",wd).transition().duration(T).style("opacity",yd).style("fill",cj).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d),r.exit().remove(),v=Cj.selectAll("."+g.texts).selectAll("."+g.text).data(xe),v.enter().append("text").attr("class",Yc).attr("text-anchor",function(a){return wh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",cj).style("fill-opacity",0),v.text(function(a){return Hd(a.id)(a.value,a.id)}).style("fill-opacity",xd).transition().duration(T).attr("x",R).attr("y",S).style("fill",cj).style("fill-opacity",zd),v.exit().transition().duration(U).style("fill-opacity",0).remove(),t=Cj.selectAll("."+g.arcs).selectAll("."+g.arc).data(ue),t.enter().append("path").attr("class",gd).style("fill",function(a){return cj(a.data)}).style("cursor",function(a){return eh(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;aj||(c=Jb(a),d=Pb(c),e=Xb(),Rb(c.data.id),Df(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Jb(a),c=Pb(b),d=[c];Vd(d,Mf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;aj||(c=Jb(a),d=Pb(c),e=Yb(),Sb(c.data.id),Ef(),Wd(),e(d,b))}).on("click",function(a,b){var c=Jb(a),d=Pb(c),e=Wb();lf(this,a,b),e(d,b)}),t.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){aj=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Jb(a);return c?(b=Mf.interpolate(this._current,c),this._current=b(0),function(a){return Mb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("fill",function(a){return cj(a.data)}).style("opacity",1).call(Ie,function(){aj=!1}),t.exit().transition().duration(U).style("opacity",0).remove(),Cj.selectAll("."+g.chartArc).select("text").attr("transform",Nb).style("opacity",0).transition().duration(T).text(Qb).style("opacity",function(a){return Jc(a.data.id)&&se(a.data)?1:0}),Cj.select("."+g.chartArcsTitle).style("opacity",ke(Nf.data.targets)?1:0),nh&&(Mf.event&&"zoom"===Mf.event.type&&vj.extent(Dg.orgDomain()).update(),F&&(!wh&&Ih&&jb(hj.subx,c.axisSubX,Ih),vj.empty()||vj.extent(Dg.orgDomain()).update(),Q=bf($,!0),x=Dj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),x.enter().append("path").attr("class",ed).style("stroke","none").style("fill",cj),x.style("opacity",wd).transition().duration(T).attr("d",Q).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove(),w=Dj.selectAll("."+g.lines).selectAll("."+g.line).data(te),w.enter().append("path").attr("class",ad).style("stroke",cj),w.style("opacity",wd).transition().duration(T).attr("d",yj).style("opacity",1),w.exit().transition().duration(T).style("opacity",0).remove())),Cj.selectAll("."+g.selectedCircles).filter(function(a){return oe(a)}).selectAll("circle").remove(),Cj.selectAll("."+g.selectedCircle).transition().duration(T).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d),Zf&&(y=Cj.select("."+g.eventRects),Fe(Og)&&!sc(Og)?(y.classed(g.eventRectsMultiple)||y.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),z=Cj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),kf(z.enter()),z.attr("x",0).attr("y",0).attr("width",gg).attr("height",ig)):(y.classed(g.eventRectsSingle)||y.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Xi&&!Wi?(D=function(a,b){var c=Bc(b),d=Cc(b),e=Nf.data.xs[a.id][b];return(Dg(d?d:e+50)-Dg(c?c:e-50))/2},C=function(a,b){var c=Bc(b),d=Nf.data.xs[a.id][b];return(Dg(d)+Dg(c?c:d-50))/2}):(D=P(),C=function(a){return Dg(a.x)-D/2}),A=Ec(Nf.data.targets),Cj.select("."+g.eventRects).datum(A?A.values:[]),z=Cj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),jf(z.enter()),z.attr("class",ld).attr("x",wh?0:C).attr("y",wh?C:0).attr("width",wh?gg:D).attr("height",wh?D:ig),z.exit().remove())),Gc(Nf.data.targets).forEach(function(a){Jj[a]=!0})}function rf(){qf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function sf(){if(0!==Lc(Nf.data.targets).length){if("mousemove"===Mf.event.sourceEvent.type&&zj.altDomain)return Dg.domain(zj.altDomain),void zj.scale(Dg).updateScaleExtent();Wi&&Dg.orgDomain()[0]===Hj[0]&&Dg.domain([Hj[0]-1e-10,Dg.orgDomain()[1]]),qf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Mf.event.sourceEvent.type&&($i=!0)}}function tf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function uf(){Aj.attr("width",kg).attr("height",lg),Aj.select("#"+Pi).select("rect").attr("width",gg).attr("height",ig),Aj.select("#"+Qi).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),Aj.select("#"+Ri).select("rect").attr("x",H).attr("y",I).attr("width",N).attr("height",O),Aj.select("."+g.zoomRect).attr("width",gg).attr("height",ig),Gj.style("max-height",lg+"px")}function vf(a){return{axisX:a?hj.x.transition().duration(a):hj.x,axisY:a?hj.y.transition().duration(a):hj.y,axisY2:a?hj.y2.transition().duration(a):hj.y2,axisSubX:a?hj.subx.transition().duration(a):hj.subx}}function wf(a){var b;a=a||{},a.withTransition=Je(a,"withTransition",!0),a.withTransform=Je(a,"withTransform",!1),a.withLegend=Je(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withLegend&&qh||(b=vf(a.withTransitionForAxis?cg:0),p(),V(),uf(),o(a.withTransition,b)),qf(a,b)}function xf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=Cj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",nd),j=i.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Zc),e=Cj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),d=e.enter().append("g").attr("class",pd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",fd).style("cursor",function(a){return eh(a)?"pointer":null}),c=Cj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),b=c.enter().append("g").attr("class",od).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",bd),b.append("g").attr("class",jd),b.append("g").attr("class",function(a){return Xc(g.selectedCircles,a.id)}),b.append("g").attr("class",dd).style("cursor",function(a){return eh(a)?"pointer":null}),a.forEach(function(a){Cj.selectAll("."+g.selectedCircles+rd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Cj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(ug(a)).attr("class",qd),f=h.enter().append("g").attr("class",qd),f.append("g").attr("class",hd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),nh&&(n=Dj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),m=n.enter().append("g").style("opacity",0).attr("class",pd),m.append("g").attr("class",fd),l=Dj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),k=l.enter().append("g").style("opacity",0).attr("class",od),k.append("g").attr("class",bd)),Aj.selectAll("."+g.target).filter(function(a){return Jc(a.id)}).transition().duration(cg).style("opacity",1)}function yf(a,b){b.filter&&(a=a.filter(b.filter)),(b.type||b.types)&&a.forEach(function(a){b.types?fe(a.id,b.types[a.id]):fe(a.id,b.type)}),Nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,z=0,F++)),E[a]=F,D[F]=f,A[a]=z,z+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+v)/10),j=10*Math.ceil((h.height+u)/10),k=nj?j:i,l=nj?U():T();return d&&(z=0,F=0,w=0,x=0),qh&&!Kc(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=i,C[c]=j,(!w||i>=w)&&(w=i),(!x||j>=x)&&(x=j),g=nj?x:w,void(vh?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(l-g*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=26,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=Ej.selectAll("."+g.legendItemFocused).size();b=b||{},n=Je(b,"withTransition",!0),q=Je(b,"withTransitionForTransform",!0),nj?(f=function(a){return w*E[a]},j=function(a){return D[E[a]]+A[a]}):(f=function(a){return D[E[a]]+A[a]},j=function(a){return x*E[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=Ej.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Xc(g.legendItem,a)}).style("visibility",function(a){return Kc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof sh?sh(a):Nf.toggle(a)}).on("mouseover",function(a){Mf.select(this).classed(g.legendItemFocused,!0),aj||Nf.focus(a),"function"==typeof th&&th(a)}).on("mouseout",function(a){Mf.select(this).classed(g.legendItemFocused,!1),aj||Nf.revert(),"function"==typeof uh&&uh(a)}),m.append("text").text(function(a){return d(Rg[a])?Rg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",nj?h:-200).attr("y",nj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",nj?i:-200).attr("y",nj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",cj).attr("x",nj?h:-200).attr("y",nj?-200:j).attr("width",10).attr("height",10),r=Ej.selectAll("text").data(a).text(function(a){return d(Rg[a])?Rg[a]:a}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=Ej.selectAll("rect."+g.legendItemEvent).data(a),(n?s.transition():s).attr("width",function(a){return B[a]}).attr("height",function(a){return C[a]}).attr("x",i).attr("y",l),t=Ej.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",cj).attr("x",f).attr("y",j),Ej.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Jc(a)}).transition().style("opacity",function(a){var b=Mf.select(this);return Jc(a)?!G||b.classed(g.legendItemFocused)?Bf(b):Cf(b):rj}),R(w),S(x),Q(F),p(),V(),uf(),o(q,c)}function If(a){return Ic(Nf.data.targets,a.id)}function Jf(a){return"data"in a&&Ic(Nf.data.targets,a.data.id)}function Kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function Lf(a,b,c){var d=!le(Nf.data.targets);aj=!1,fe(a,b),wf(c||{withTransitionForAxis:d})}var Mf=a.d3?a.d3:a.require?a.require("d3"):void 0,Nf={data:{},axis:{},legend:{}},Of={},Pf=i(["bindto"],"#chart"),Qf=i(["size","width"]),Rf=i(["size","height"]),Sf=i(["padding","left"]),Tf=i(["padding","right"]),Uf=i(["padding","top"]),Vf=i(["padding","bottom"]),Wf=i(["zoom","enabled"],!1),Xf=i(["zoom","extent"]),Yf=i(["zoom","privileged"],!1),Zf=i(["interaction","enabled"],!0),$f=i(["onenter"],function(){}),_f=i(["onleave"],function(){}),ag=i(["onresize"],function(){}),bg=i(["onresized"],function(){}),cg=i(["transition","duration"],350);h("data","data is required in config");var dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg,Kg,Lg,Mg,Ng=i(["data","x"]),Og=i(["data","xs"],{}),Pg=i(["data","x_format"]),Qg=i(["data","id_converter"],function(a){return a}),Rg=i(["data","names"],{}),Sg=i(["data","classes"],{}),Tg=i(["data","groups"],[]),Ug=i(["data","axes"],{}),Vg=i(["data","type"]),Wg=i(["data","types"],{}),Xg=i(["data","labels"],{}),Yg=i(["data","order"]),Zg=i(["data","regions"],{}),$g=i(["data","color"]),_g=i(["data","colors"],{}),ah=i(["data","hide"],!1),bh=i(["data","filter"]),ch=i(["data","selection","enabled"],!1),dh=i(["data","selection","grouped"],!1),eh=i(["data","selection","isselectable"],function(){return!0}),fh=i(["data","selection","multiple"],!0),gh=i(["data","onclick"],function(){}),hh=i(["data","onenter"],function(){}),ih=i(["data","onleave"],function(){}),jh=i(["data","onselected"],function(){}),kh=i(["data","onunselected"],function(){}),lh=i(["data","ondragstart"],function(){}),mh=i(["data","ondragend"],function(){}),nh=i(["subchart","show"],!1),oh=i(["subchart","size","height"],60),ph=i(["color","pattern"],[]),qh=i(["legend","show"],!0),rh=i(["legend","position"],"bottom"),sh=i(["legend","item","onclick"]),th=i(["legend","item","onmouseover"]),uh=i(["legend","item","onmouseout"]),vh=i(["legend","equally"],!1),wh=i(["axis","rotated"],!1),xh=i(["axis","x","show"],!0),yh=i(["axis","x","type"],"indexed"),zh=i(["axis","x","localtime"],!0),Ah=i(["axis","x","categories"],[]),Bh=i(["axis","x","tick","centered"],!1),Ch=i(["axis","x","tick","format"]),Dh=i(["axis","x","tick","culling"],{}),Eh=i(["axis","x","tick","culling","max"],10),Fh=i(["axis","x","tick","count"]),Gh=i(["axis","x","tick","fit"],!0),Hh=i(["axis","x","tick","values"],null),Ih=i(["axis","x","tick","rotate"]),Jh=i(["axis","x","max"],null),Kh=i(["axis","x","min"],null),Lh=i(["axis","x","padding"],{}),Mh=i(["axis","x","height"]),Nh=i(["axis","x","default"]),Oh=i(["axis","x","label"],{}),Ph=i(["axis","y","show"],!0),Qh=i(["axis","y","max"]),Rh=i(["axis","y","min"]),Sh=i(["axis","y","center"]),Th=i(["axis","y","label"],{}),Uh=i(["axis","y","inner"],!1),Vh=i(["axis","y","tick","format"]),Wh=i(["axis","y","padding"]),Xh=i(["axis","y","ticks"],10),Yh=i(["axis","y2","show"],!1),Zh=i(["axis","y2","max"]),$h=i(["axis","y2","min"]),_h=i(["axis","y2","center"]),ai=i(["axis","y2","label"],{}),bi=i(["axis","y2","inner"],!1),ci=i(["axis","y2","tick","format"]),di=i(["axis","y2","padding"]),ei=i(["axis","y2","ticks"],10),fi=i(["grid","x","show"],!1),gi=i(["grid","x","type"],"tick"),hi=i(["grid","x","lines"],[]),ii=i(["grid","y","show"],!1),ji=i(["grid","y","lines"],[]),ki=i(["grid","y","ticks"],10),li=i(["point","show"],!0),mi=i(["point","r"],2.5),ni=i(["point","focus","line","enabled"],!0),oi=i(["point","focus","expand","enabled"],!0),pi=i(["point","focus","expand","r"]),qi=i(["point","focus","select","r"]),ri=i(["line","connect_null"],!1),si=i(["bar","width"]),ti=i(["bar","width","ratio"],.6),ui=i(["pie","label","show"],!0),vi=i(["pie","label","format"]),wi=i(["pie","expand"],!0),xi=i(["pie","onclick"],function(){}),yi=i(["pie","onmouseover"],function(){}),zi=i(["pie","onmouseout"],function(){}),Ai=i(["donut","label","show"],!0),Bi=i(["donut","label","format"]),Ci=i(["donut","expand"],!0),Di=i(["donut","title"],""),Ei=i(["donut","onclick"],function(){}),Fi=i(["donut","onmouseover"],function(){}),Gi=i(["donut","onmouseout"],function(){}),Hi=i(["regions"],[]),Ii=i(["tooltip","show"],!0),Ji=i(["tooltip","format","title"]),Ki=i(["tooltip","format","value"]),Li=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Ji?Ji:b,l=Ki?Ki:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Mi=i(["tooltip","init","show"],!1),Ni=i(["tooltip","init","x"],0),Oi=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Pi=("string"==typeof Pf?Pf.replace(/[# .>~+]/g,""):g.chart+ +new Date)+"-clip",Qi=Pi+"-xaxis",Ri=Pi+"-yaxis",Si=j(Pi),Ti=j(Qi),Ui=j(Ri),Vi="timeseries"===yh,Wi="categorized"===yh,Xi=!Vi&&(Ng||Fe(Og)),Yi=null,Zi=!1,$i=!1,_i=!1,aj=!1,bj=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],cj=ze(_g,Fe(ph)?ph:bj,$g),dj=zh?Mf.time.format:Mf.time.format.utc,ej=dj.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),fj=[],gj=[],hj={},ij=wh?"left":"bottom",jj=wh?Uh?"top":"bottom":Uh?"right":"left",kj=wh?bi?"bottom":"top":bi?"left":"right",lj=wh?"left":"bottom",mj={main:function(){return"translate("+k(dg.left)+","+k(dg.top)+")"},context:function(){return"translate("+k(eg.left)+","+k(eg.top)+")"},legend:function(){return"translate("+fg.left+","+fg.top+")" },x:function(){return"translate(0,"+(wh?0:ig)+")"},y:function(){return"translate(0,"+(wh?ig:0)+")"},y2:function(){return"translate("+(wh?0:gg)+","+(wh?1:0)+")"},subx:function(){return"translate(0,"+(wh?0:jg)+")"},arc:function(){return"translate("+pg/2+","+qg/2+")"}},nj="right"===rh,oj=0,pj=0,qj=0,rj=.15,sj=30,tj=wh&&!xh?0:30,uj=5;ug=Mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var vj,wj=function(){var a=Mf.svg.line().x(wh?function(a){return $(a.id)(a.value)}:Id).y(wh?Id:function(a){return $(a.id)(a.value)});return ri||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ri?Te(b.values):b.values;return me(b)?(a.interpolate(ne(b)?"cardinal":"linear"),Zg[b.id]?gf(e,Dg,$(b.id),Zg[b.id]):a(e)):(c=e[0]?Dg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,wh?"M "+d+" "+c:"M "+c+" "+d)}}(),xj=function(){var a;return a=wh?Mf.svg.area().x0(function(a){return $(a.id)(0)}).x1(function(a){return $(a.id)(a.value)}).y(Id):Mf.svg.area().x(Id).y0(function(a){return $(a.id)(0)}).y1(function(a){return $(a.id)(a.value)}),function(b){var c,d,e=Te(b.values);return ge([b],"area")||ge([b],"area-spline")?(a.interpolate(ne(b)?"cardinal":"linear"),a(e)):(c=e[0]?Dg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,wh?"M "+d+" "+c:"M "+c+" "+d)}}(),yj=function(){var a=Mf.svg.line().x(wh?function(a){return _(a.id)(a.value)}:Ld).y(wh?Ld:function(a){return _(a.id)(a.value)});return function(b){var c=Te(b.values);return me(b)?a(c):"M "+Gg(c[0].x)+" "+_(b.id)(c[0].value)}}(),zj=function(){};vj=Mf.svg.brush().on("brush",rf),vj.update=function(){return Dj&&Dj.select("."+g.brush).call(this),this},vj.scale=function(a){return wh?this.y(a):this.x(a)},Wf&&(zj=Mf.behavior.zoom().on("zoomstart",function(){zj.altDomain=Mf.event.sourceEvent.altKey?Dg.orgDomain():null}).on("zoom",Wf?sf:null),zj.scale=function(a){return wh?this.y(a):this.x(a)},zj.orgScaleExtent=function(){var a=Xf?Xf:[1,10];return[a[0],Math.max(Dc()/a[1],a[1])]},zj.updateScaleExtent=function(){var a=ec(Dg.orgDomain())/ec(Hj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Aj,Bj,Cj,Dj,Ej,Fj,Gj,Hj,Ij,Jj={};if(Nf.focus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);Nf.revert(),Nf.defocus(),b(d.classed(g.focused,!0)),b(e),le(Nf.data.targets)&&Rb(a,!0),Df(a,!0)},Nf.defocus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",.3)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);Nf.revert(),b(d.classed(g.focused,!1)),b(e),le(Nf.data.targets)&&Sb(a),Df(a,!1)},Nf.revert=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);b(d.classed(g.focused,!1)),b(e),le(Nf.data.targets)&&Sb(a),Ef()},Nf.show=function(a,b){a=Hc(a),b=b||{},Pc(a),Aj.selectAll(td(a)).transition().style("opacity",1),b.withLegend&&Ff(a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Nf.hide=function(a,b){a=Hc(a),b=b||{},Oc(a),Aj.selectAll(td(a)).transition().style("opacity",0),b.withLegend&&Gf(a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Nf.toggle=function(a){Jc(a)?Nf.hide(a):Nf.show(a)},Nf.unzoom=function(){vj.clear().update(),qf({withUpdateXDomain:!0})},Nf.load=function(a){return a.xs&&rc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Sg[b]=a.classes[b]}),"categories"in a&&Wi&&(Ah=a.categories,Jg.categories(Ah)),"cacheIds"in a&&fc(a.cacheIds)?void yf(hc(a.cacheIds),a.done):void("unload"in a?Af(Hc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){zf(a)}):zf(a))},Nf.unload=function(a,b){Af(Hc(a),function(){qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Nf.selected=function(a){return Mf.merge(Cj.selectAll("."+g.shapes+rd(a)).selectAll("."+g.shape).filter(function(){return Mf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Nf.select=function(a,b,c){ch&&Cj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Mf.select(this),i=e.data?e.data.id:e.id,j=Se(this),k=dh||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);h.classed(g.line)||h.classed(g.area)||(k&&l?eh(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},Nf.unselect=function(a,b){ch&&Cj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Mf.select(this),f=c.data?c.data.id:c.id,h=Se(this),i=dh||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);e.classed(g.line)||e.classed(g.area)||i&&j&&eh(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Nf.toLine=function(a){Lf(a,"line")},Nf.toSpline=function(a){Lf(a,"spline")},Nf.toBar=function(a){Lf(a,"bar")},Nf.toScatter=function(a){Lf(a,"scatter")},Nf.toArea=function(a){Lf(a,"area")},Nf.toAreaSpline=function(a){Lf(a,"area-spline")},Nf.toPie=function(a){Lf(a,"pie",{withTransform:!0})},Nf.toDonut=function(a){Lf(a,"donut",{withTransform:!0})},Nf.groups=function(a){return c(a)?Tg:(Tg=a,qf(),Tg)},Nf.xgrids=function(a){return a?(hi=a,qf(),hi):hi},Nf.xgrids.add=function(a){return a?Nf.xgrids(hi.concat(a)):void 0},Nf.xgrids.remove=function(a){var b=Kf(a);return Nf.xgrids(hi.filter(b))},Nf.ygrids=function(a){return a?(ji=a,qf(),ji):ji},Nf.ygrids.add=function(a){return a?Nf.ygrids(ji.concat(a)):void 0},Nf.ygrids.remove=function(a){var b=Kf(a);return Nf.ygrids(ji.filter(b))},Nf.regions=function(a){return a?(Hi=a,qf(),Hi):Hi},Nf.regions.add=function(a){return a?(Hi=Hi.concat(a),qf(),Hi):Hi},Nf.regions.remove=function(a){var b,c,d;return a=a||{},b=Je(a,"duration",cg),c=Je(a,"classes",[g.region]),d=Cj.select("."+g.regions).selectAll(c.map(function(a){return"."+a})),(b?d.transition().duration(b):d).style("opacity",0).remove(),Hi=Hi.filter(function(a){return c.indexOf(a.class)<0})},Nf.data.get=function(a){var b=Nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Nf.data.getAsTarget=function(a){var b=Nf.data.targets.filter(function(b){return b.id===a});return b.length>0?b[0]:void 0},Nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Rg[b]=a[b]}),qf({withLegend:!0}),Rg):Rg},Nf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){_g[b]=a[b]}),qf({withLegend:!0}),_g):_g},Nf.x=function(a){return arguments.length&&(uc(Nf.data.targets,a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Nf.data.xs},Nf.xs=function(a){return arguments.length&&(vc(Nf.data.targets,a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Nf.data.xs},Nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){gb(b,a[b])}),Ib())},Nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Jh=+a.x),b(a.y)&&(Qh=+a.y),b(a.y2)&&(Zh=+a.y2)):Qh=Zh=+a,qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Kh=+a.x),b(a.y)&&(Rh=+a.y),b(a.y2)&&($h=+a.y2)):Rh=$h=+a,qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Nf.axis.max(a.max),"undefined"!=typeof a.min&&Nf.axis.min(a.min))},Nf.legend.show=function(a){Ff(Hc(a)),qf({withLegend:!0})},Nf.legend.hide=function(a){Gf(Hc(a)),qf({withLegend:!0})},Nf.resize=function(a){Qf=a?a.width:null,Rf=a?a.height:null,wf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Nf.destroy=function(){Nf.data.targets=void 0,Nf.data.xs={},Gj.html(""),a.onresize=null},"url"in f.data)Mf.xhr(f.data.url,function(a,b){var c,d=Mf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Mf.csv.parse(b.response),hf(c)});else if("rows"in f.data)hf(xc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");hf(yc(f.data.columns))}return Nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(window); \ No newline at end of file diff --git a/package.json b/package.json index a8d1ac0..7674540 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "c3", - "version": "0.1.37", + "version": "0.1.38", "description": "D3-based reusable chart library", "main": "c3.js", "scripts": { From b2650a39e4556eca124d97afa9d6a0953852ba94 Mon Sep 17 00:00:00 2001 From: Olivier Melcher Date: Mon, 12 May 2014 21:53:41 -0400 Subject: [PATCH 169/178] c8 --- c3.js | 3 ++- component.json | 6 ++++-- package.json | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/c3.js b/c3.js index e9566f9..7c68cc9 100644 --- a/c3.js +++ b/c3.js @@ -4541,10 +4541,11 @@ if (typeof window.define === "function" && window.define.amd) { window.define("c3", ["d3"], c3); + } else if ('undefined' !== typeof exports && 'undefined' !== typeof module){ + module.exports = c3; } else { window.c3 = c3; } - // TODO: module.exports // Features: // 1. category axis diff --git a/component.json b/component.json index abf09d2..2eea38a 100644 --- a/component.json +++ b/component.json @@ -2,9 +2,11 @@ "name": "c3", "repo": "masayuki0812/c3", "description": "A D3-based reusable chart library", - "version": "0.0.1", + "version": "0.1.39", "keywords": [], - "dependencies": {}, + "dependencies": { + "mbostock/d3": "*" + }, "development": {}, "license": "MIT", "main": "c3.js", diff --git a/package.json b/package.json index 7674540..cc6b837 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "c3", - "version": "0.1.38", + "version": "0.1.39", "description": "D3-based reusable chart library", "main": "c3.js", "scripts": { From 00af5fc2118908e2205ddcc3945047b335a52ca0 Mon Sep 17 00:00:00 2001 From: Olivier Melcher Date: Tue, 13 May 2014 14:27:56 -0400 Subject: [PATCH 170/178] require d3 --- c3.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c3.js b/c3.js index 7c68cc9..d1362fe 100644 --- a/c3.js +++ b/c3.js @@ -76,7 +76,7 @@ */ c3.generate = function (config) { - var d3 = window.d3 ? window.d3 : window.require ? window.require("d3") : undefined; + var d3 = window.d3 ? window.d3 : 'undefined' != typeof require ? require("d3") : undefined; var c3 = { data : {}, axis: {}, legend: {} }, cache = {}; From 0e60ad131a610e39f7d1661e4f67c0c89bc13085 Mon Sep 17 00:00:00 2001 From: Olivier Melcher Date: Tue, 13 May 2014 14:28:53 -0400 Subject: [PATCH 171/178] bump version --- component.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/component.json b/component.json index 2eea38a..f0b4e6c 100644 --- a/component.json +++ b/component.json @@ -2,7 +2,7 @@ "name": "c3", "repo": "masayuki0812/c3", "description": "A D3-based reusable chart library", - "version": "0.1.39", + "version": "0.1.40", "keywords": [], "dependencies": { "mbostock/d3": "*" diff --git a/package.json b/package.json index cc6b837..909d33c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "c3", - "version": "0.1.39", + "version": "0.1.40", "description": "D3-based reusable chart library", "main": "c3.js", "scripts": { From 6f3389dba7e56d4b226cd7d55bb082e18cbde7a7 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 14 May 2014 12:16:38 +0900 Subject: [PATCH 172/178] Fix jshint - #209 #232 --- c3.js | 10 ++++++---- c3.min.js | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/c3.js b/c3.js index d1362fe..1e798b5 100644 --- a/c3.js +++ b/c3.js @@ -1,6 +1,8 @@ (function (window) { 'use strict'; + /*global define, module, exports, require */ + var c3 = { version: "0.1.38" }; @@ -76,7 +78,7 @@ */ c3.generate = function (config) { - var d3 = window.d3 ? window.d3 : 'undefined' != typeof require ? require("d3") : undefined; + var d3 = window.d3 ? window.d3 : 'undefined' !== typeof require ? require("d3") : undefined; var c3 = { data : {}, axis: {}, legend: {} }, cache = {}; @@ -4539,9 +4541,9 @@ return typeof v !== 'undefined'; } - if (typeof window.define === "function" && window.define.amd) { - window.define("c3", ["d3"], c3); - } else if ('undefined' !== typeof exports && 'undefined' !== typeof module){ + if (typeof define === "function" && define.amd) { + define("c3", ["d3"], c3); + } else if ('undefined' !== typeof exports && 'undefined' !== typeof module) { module.exports = c3; } else { window.c3 = c3; diff --git a/c3.min.js b/c3.min.js index c22c987..4382f50 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ !function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.round(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.round(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&a=0;return"url("+(c?"":document.URL.split("#")[0])+"#"+b+")"}function k(a){return Math.ceil(a)+.5}function l(a,b){var c,d,e;b&&b.axisX?c=b.axisX:(c=Cj.select("."+g.axisX),a&&(c=c.transition())),b&&b.axisY?d=b.axisY:(d=Cj.select("."+g.axisY),a&&(d=d.transition())),b&&b.axisY2?e=b.axisY2:(e=Cj.select("."+g.axisY2),a&&(e=e.transition())),Cj.attr("transform",mj.main),c.attr("transform",mj.x),d.attr("transform",mj.y),e.attr("transform",mj.y2),Cj.select("."+g.chartArcs).attr("transform",mj.arc)}function m(a,b){var c;b&&b.axisSubX?c=b.axisSubX:(c=Dj.select("."+g.axisX),a&&(c=c.transition())),Dj.attr("transform",mj.context),c.attr("transform",mj.subx)}function n(a){(a?Ej.transition():Ej).attr("transform",mj.legend)}function o(a,b){l(a,b),nh&&m(a,b),n(a)}function p(){var a=U(),b=T(),c=nj?0:a,d=le(Nf.data.targets),e=wh||d?0:A("x"),f=nh&&!d?oh+e:0;kg=t(),lg=u(),wh?(dg={top:A("y2")+v(),right:d?0:y(),bottom:A("y")+c+w(),left:f+(d?0:x())},eg={top:dg.top,right:0/0,bottom:20+c,left:sj}):(dg={top:4+v(),right:d?0:y(),bottom:e+f+c+w(),left:d?0:x()},eg={top:lg-f-c,right:0/0,bottom:e+c,left:dg.left}),fg={top:nj?0:lg-a,right:0/0,bottom:0,left:nj?kg-b:0},gg=kg-dg.left-dg.right,ig=lg-dg.top-dg.bottom,0>gg&&(gg=0),0>ig&&(ig=0),hg=wh?dg.left-sj-tj:gg,jg=wh?ig:lg-eg.top-eg.bottom,0>hg&&(hg=0),0>jg&&(jg=0),pg=gg-(nj?b+10:0),qg=ig-(nj?0:10),r(),nj&&d&&(fg.left=pg/2+1.1*ng)}function q(){Cj.select("line."+g.xgridFocus).attr("x1",wh?0:-10).attr("x2",wh?gg:-10).attr("y1",wh?-10:dg.top).attr("y2",wh?-10:ig)}function r(){ng=Math.min(pg,qg)/2,mg=.95*ng,og=ke(Nf.data.targets)?.6*mg:0}function s(){var a=wh?g.axisX:g.axisY,b=Cj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Gj.node().getBoundingClientRect(),e=le(Nf.data.targets),f=c.right-d.left-(e?0:x());return f>0?f:0}function t(){return Qf?Qf:B()}function u(){var a=Rf?Rf:C();return a>0?a:320}function v(){return Uf?Uf:0}function w(){return Vf?Vf:0}function x(){return Sf?Sf:wh?xh?Ke(z("x")):1:!Ph||Uh?1:Ke(z("y"))}function y(){var a=10,b=nj?T()+20:0;return Tf?Tf:wh?a+b:(!Yh||bi?a:Ke(z("y2")))+b}function z(a){var b=ob(a);return b.isInner?20+Hb(a):40+Hb(a)}function A(a){return"x"!==a||xh?"x"===a&&Mh?Mh:"y"!==a||Ph?"y2"!==a||Yh?(ob(a).isInner?30:40)+("y2"===a?-10:0):uj:qh&&!nj?10:1:0}function B(){return+Gj.style("width").replace("px","")}function C(){return+Gj.style("height").replace("px","")}function D(a){return a?-31:-(dg.left-1)}function E(a){return a?-20:-4}function F(){return D(!wh)}function G(){return E(!wh)}function H(){return D(wh)}function I(){return E(wh)}function J(a){return a?gg+2+30+30:dg.left+20}function K(a){return a?(Mh?Mh:0)+80:ig+8}function L(){return J(!wh)}function M(){return K(!wh)}function N(){return J(wh)}function O(){return K(wh)}function P(){var a,b,c,d,e,f=Ec(Nf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=Dg(b.x)-Dg(a.x),0===c?wh?ig:gg:(d=Dc(),e=he(Nf.data.targets)?(d-(Wi?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function Q(a){oj=a}function R(a){pj=a}function S(a){qj=a}function T(){return qh?nj?pj*(oj+1):kg:0}function U(){return qh?nj?lg:qj*(oj+1):0}function V(){var a,b,c=!Dg;vg=wh?1:0,wg=wh?ig:gg,xg=wh?0:ig,yg=wh?gg:1,zg=vg,Ag=wg,Bg=wh?0:jg,Cg=wh?hg:1,Dg=Y(vg,wg,c?void 0:Dg.domain(),function(){return Jg.tickOffset()}),Eg=Z(xg,yg,c?void 0:Eg.domain()),Fg=Z(xg,yg,c?void 0:Fg.domain()),Gg=Y(vg,wg,Hj,function(a){return a%1?0:Mg.tickOffset()}),Hg=Z(Bg,Cg,c?void 0:Hg.domain()),Ig=Z(Bg,Cg,c?void 0:Ig.domain()),a=db(),b=Hh?Hh:c?void 0:Jg.tickValues(),Jg=ab(Dg,ij,a,b),Mg=ab(Gg,lj,a,b),Kg=bb(Eg,jj,Vh,Xh),Lg=bb(Fg,kj,ci,ei),c||(vj.scale(Gg),Wf&&zj.scale(Dg)),W()}function W(){rg=Kb(),sg=Lb(),tg=Lb(.98)}function X(a,b,c){return(c?Mf.time.scale():Mf.scale.linear()).range([a,b])}function Y(a,b,c,d){var e,f=X(a,b,Vi),g=c?f.domain(c):f;Wi?(d=d||function(){return 0},f=function(a,b){var c=g(a)+d(a);return b?c:Math.ceil(c)}):f=function(a,b){var c=g(a);return b?c:Math.ceil(c)};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return Hj&&Hj[0]===a[0]&&Hj[1]a?a.toFixed(0):a};return Ch&&("function"==typeof Ch?a=Ch:Vi&&(a=function(a){return a?dj(Ch)(a):""})),a}function eb(a){var b;return"y"===a?b=Th:"y2"===a?b=ai:"x"===a&&(b=Oh),b}function fb(a){var b=eb(a);return"string"==typeof b?b:b?b.text:null}function gb(a,b){var c=eb(a);"string"==typeof c?"y"===a?Th=b:"y2"===a?ai=b:"x"===a&&(Oh=b):c&&(c.text=b)}function hb(a){return 10*Math.sin(Math.PI*(a/180))}function ib(a){return 11.5-2.5*(a/15)}function jb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",ib(c)).attr("x",hb(c)).attr("transform","rotate("+c+")")}function kb(a,b){var c=eb(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 lb(){return kb("x",wh?"inner-top":"inner-right")}function mb(){return kb("y",wh?"inner-right":"inner-top")}function nb(){return kb("y2",wh?"inner-right":"inner-top")}function ob(a){return"y2"===a?nb():"y"===a?mb():lb()}function pb(){return fb("x")}function qb(){return fb("y")}function rb(){return fb("y2")}function sb(a,b){return a?b.isLeft?0:b.isCenter?gg/2:gg:b.isBottom?-ig:b.isMiddle?-ig/2:0}function tb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function ub(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function vb(){return sb(!wh,lb())}function wb(){return sb(wh,mb())}function xb(){return sb(wh,nb())}function yb(){return tb(!wh,lb())}function zb(){return tb(wh,mb())}function Ab(){return tb(wh,nb())}function Bb(){var a=lb();return wh?a.isInner?"1.2em":-25-Hb("x"):a.isInner?"-0.5em":Mh?Mh-10:"3em"}function Cb(){var a=mb();return wh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Hb("y")}function Db(){var a=nb();return wh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Hb("y2")}function Eb(){return ub(!wh,lb())}function Fb(){return ub(wh,mb())}function Gb(){return ub(wh,nb())}function Hb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Ib(a){var b=Cj.select("."+g.axisX+" ."+g.axisXLabel),c=Cj.select("."+g.axisY+" ."+g.axisYLabel),d=Cj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",vb).attr("dx",yb).attr("dy",Bb).text(pb),(a?c.transition():c).attr("x",wb).attr("dx",zb).attr("dy",Cb).attr("dy",Cb).text(qb),(a?d.transition():d).attr("x",xb).attr("dx",Ab).attr("dy",Db).text(rb)}function Jb(a){var b=!1;return ug(Lc(Nf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Kb(){var a=Mf.svg.arc().outerRadius(mg).innerRadius(og),b=function(b,c){var d;return c?a(b):(d=Jb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Lb(a){var b=Mf.svg.arc().outerRadius(ng*(a?a:1)).innerRadius(og);return function(a){var c=Jb(a);return c?b(c):"M 0 0"}}function Mb(a,b){return se(a.data)?rg(a,b):"M 0 0"}function Nb(a){var b,c,d,e,f=Jb(a),g="";return f&&(b=rg.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*mg*.8+","+d/e*mg*.8+")"),g}function Ob(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Pb(a){return tc({id:a.data.id,value:a.value,ratio:Ob(a)})}function Qb(a){var b,c,d,e;return Tb()?(b=Jb(a),c=b?b.value:null,d=Ob(b),e=Ub(),e?e(c,d):Gd(c,d)):""}function Rb(a,b){var c=Aj.selectAll("."+g.chartArc+sd(a)),d=Aj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});ye(a)&&c.selectAll("path").transition().duration(50).attr("d",sg).transition().duration(100).attr("d",tg).each(function(a){re(a.data)}),b||d.style("opacity",.3)}function Sb(a){var b=Aj.selectAll("."+g.chartArc+sd(a));b.selectAll("path").transition().duration(50).attr("d",rg),Aj.selectAll("."+g.arc).style("opacity",1)}function Tb(){return ke(Nf.data.targets)?Ai:ui}function Ub(){return ke(Nf.data.targets)?Bi:vi}function Vb(){return ke(Nf.data.targets)?Di:""}function Wb(){var a=ke(Nf.data.targets)?Ei:xi;return"function"==typeof a?a:function(){}}function Xb(){var a=ke(Nf.data.targets)?Fi:yi;return"function"==typeof a?a:function(){}}function Yb(){var a=ke(Nf.data.targets)?Gi:zi;return"function"==typeof a?a:function(){}}function Zb(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Tg.length>0)for(g=Uc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return Mf.min(Object.keys(i).map(function(a){return Mf.min(i[a])}))}function $b(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Tg.length>0)for(g=Vc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return Mf.max(Object.keys(i).map(function(a){return Mf.max(i[a])}))}function _b(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return cb(a.id)===c}),m="y2"===c?$h:Rh,n="y2"===c?Zh:Qh,o=b(m)?m:Zb(l),p=b(n)?n:$b(l),q="y2"===c?_h:Sh,r=Ad()&&wh;return 0===l.length?"y2"===c?Fg.domain():Eg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=Bd(o,p),j=ec(Eg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Wh&&(f=b(Wh.top)?Wh.top:e,g=b(Wh.bottom)?Wh.bottom:e),"y2"===c&&di&&(f=b(di.top)?di.top:e,g=b(di.bottom)?di.bottom:e),he(l)&&!Uc(l)&&(g=o),[o-g,p+f])}function ac(a){return Kh?Vi?Ae(Kh):Kh:Mf.min(a,function(a){return Mf.min(a.values,function(a){return a.x})})}function bc(a){return Jh?Vi?Ae(Jh):Jh:Mf.max(a,function(a){return Mf.max(a.values,function(a){return a.x})})}function cc(a){var c,d,e,f,g=Fc(a),h=g[1]-g[0];return Wi?d=0:he(a)?(c=Dc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Lh&&Fe(Lh)?(e=b(Lh.left)?Lh.left:d,f=b(Lh.right)?Lh.right:d):e=f="number"==typeof Lh?Lh:d,{left:e,right:f}}function dc(a){var b=[ac(a),bc(a)],c=b[0],d=b[1],e=cc(a),f=0,g=0;return c-d!==0||Wi||(c=Vi?new Date(.5*c.getTime()):-.5,d=Vi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ec(a){return a[1]-a[0]}function fc(a){for(var b=0;bb?0:b-c}function lc(a){var b,c=jc(a),d="y"===a.axis?Eg:Fg;return b="y"===a.axis||"y2"===a.axis?wh?ig:"start"in a?d(a.start):ig:wh?"end"in a?Dg(Vi?Ae(a.end):a.end):ig:ig,c>b?0:b-c}function mc(a){return Ng&&a===Ng||Fe(Og)&&Ge(Og,a)}function nc(a){return!mc(a)}function oc(a){return Ng?Ng:Fe(Og)?Og[a]:null}function pc(a,b){var c,d=b&&Fe(b)?Gc(b):[];return d.forEach(function(b){oc(b)===a&&(c=Nf.data.xs[b])}),c}function qc(a,b){return a in Nf.data.xs&&Nf.data.xs[a]&&Nf.data.xs[a][b]?Nf.data.xs[a][b]:b}function rc(a){Object.keys(a).forEach(function(b){Og[b]=a[b]})}function sc(a){return 1===Mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function tc(a){var b;return a&&(b=Rg[a.id],a.name=b?b:a.id),a}function uc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=wc(b[d],a.id,d)}),Nf.data.xs[a.id]=b})}function vc(a,b){a.forEach(function(a){b[a.id]&&uc([a],b[a.id])})}function wc(a,c,d){var e;return e=Vi?a?a instanceof Date?a:Ae(a):Ae(qc(c,d)):Xi&&!Wi?b(a)?+a:qc(c,d):d}function xc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Ng?(d=Object.keys(Nf.data.xs),Nf.data.xs[c]=d.length>0?Nf.data.xs[d[0]]:void 0):Fe(Og)&&(Nf.data.xs[c]=pc(f,Nf.data.targets)):Nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Qg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=oc(b),g=a[f],h=wc(g,b,e);return Xi&&Wi&&0===c&&g&&(0===e&&(Ah=[]),Ah.push(g)),("undefined"==typeof a[b]||Nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Vg&&fe(Gc(c).filter(function(a){return!(a in Wg)}),Vg),c.forEach(function(a){gc(a.id_org,a)}),c}function Ac(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 Bc(a){return a>0&&Nf.data.targets[0].values[a-1]?Nf.data.targets[0].values[a-1].x:void 0}function Cc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Fc(a){var b,c,d=Ec(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Gc(a){return a.map(function(a){return a.id})}function Hc(a){return a?"string"==typeof a?[a]:a:Gc(Nf.data.targets)}function Ic(a,b){var c,d=Gc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Vi?new Date(i):i);j.push(e)}return Vi||(j=j.sort(function(a,b){return a-b})),j}function Oc(a){fj=fj.concat(a)}function Pc(a){fj=fj.filter(function(b){return a.indexOf(b)<0})}function Qc(a){gj=gj.concat(a)}function Rc(a){gj=gj.filter(function(b){return a.indexOf(b)<0})}function Sc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Tc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Vc(a){return Tc(a,function(a){return a>0})}function Wc(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||0===a[f].x)&&(e=e.concat(Md(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Md(a,g))),Pd(e,b)):Nd(a,b,f,g)}function Od(a,b){var c;return c=a.map(function(a){return Nd(a.values,b)}),Pd(c,b)}function Pd(a,b){var c,d;return a.forEach(function(a){var e=He(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Qd(a,b){return Mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Rd(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 Sd(){return Yg&&"desc"===Yg.toLowerCase()}function Td(){return Yg&&"asc"===Yg.toLowerCase()}function Ud(a){var b=Td(),c=Sd();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 Yg&&a.sort(Yg),a}function Vd(a,c){var d,e,f,g,h,i,j,k=le(Nf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&Ii&&(Fj.html(Li(a,db(),Cd(k),cj)).style("display","block"),d=Fj.property("offsetWidth"),e=Fj.property("offsetHeight"),k?(g=gg/2+c[0],i=ig/2+c[1]+20):(wh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-y(),i=Dg(l[0].x)+20):(f=s(),g=f+x()+Dg(l[0].x)+20,h=g+d,j=f+t()-y(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),Fj.style("top",i+"px").style("left",g+"px"))}function Wd(){Fj.style("display","none")}function Xd(a){var c=a.filter(function(a){return a&&b(a.value)});if(Ii&&!ie(Nf.data.targets)&&!le(Nf.data.targets)){var d=Cj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(wh?"y1":"x1",Id).attr(wh?"y2":"x2",Id),pf(d,"grid")}}function Yd(){Cj.select("line."+g.xgridFocus).style("visibility","hidden")}function Zd(a,b){var c,d,e,f,h=[],i=Cj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=dc(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function $d(a){return a.x||0===a.x?Dg(a.x):null}function _d(a){return $(a.id)(a.value)}function ae(){var a,b,d={},e=0;return Lc(Nf.data.targets.filter(oe)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ee(a,b){return"number"==typeof si?si:b?2*a.tickOffset()*ti/b:0}function fe(a,b){Hc(a).forEach(function(a){Jj[a]=b===Wg[a],Wg[a]=b})}function ge(a,b){var c=!1;return a.forEach(function(a){Wg[a.id]===b&&(c=!0),a.id in Wg||"line"!==b||(c=!0)}),c}function he(a){return ge(a,"bar")}function ie(a){return ge(a,"scatter")}function je(a){return ge(a,"pie")}function ke(a){return ge(a,"donut")}function le(a){return je(a)||ke(a)}function me(a){var b="string"==typeof a?a:a.id;return!(b in Wg)||"line"===Wg[b]||"spline"===Wg[b]||"area"===Wg[b]||"area-spline"===Wg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"spline"===Wg[b]||"area-spline"===Wg[b]}function oe(a){var b="string"==typeof a?a:a.id;return"bar"===Wg[b]}function pe(a){var b="string"==typeof a?a:a.id;return"scatter"===Wg[b]}function qe(a){var b="string"==typeof a?a:a.id;return"pie"===Wg[b]}function re(a){var b="string"==typeof a?a:a.id;return"donut"===Wg[b]}function se(a){return qe(a)||re(a)}function te(a){return me(a)?[a]:[]}function ue(a){return se(a.data)?[a]:[]}function ve(a){return oe(a)?a.values:[]}function we(a){return me(a)||pe(a)?a.values:[]}function xe(a){return oe(a)||me(a)?a.values:[]}function ye(a){return re(a)&&Ci||qe(a)&&wi}function ze(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function Ae(b){var c;try{c=Pg?Mf.time.format(Pg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Pg)}return c}function Be(a,b){var c=Mf.mouse(a),d=Mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ge(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function He(a,b){var c="y"===cb(a.id)?Eg:Fg,d=wh?1:0,e=wh?0:1;return Math.pow(Dg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ie(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Je(a,b,c){return d(a[b])?a[b]:c}function Ke(a){return 10*Math.ceil(a/10)}function Le(a,b,c){jh(b,a.node()),Cj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Xc(g.selectedCircle,c)}).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d).attr("stroke",function(){return cj(b)}).attr("r",1.4*We(b)).transition().duration(100).attr("r",We)}function Me(a,b,c){kh(b,a.node()),Cj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ne(a,b,c,d){a?Le(b,c,d):Me(b,c,d)}function Oe(a,b){jh(b,a.node()),a.transition().duration(100).style("fill",function(){return Mf.rgb(cj(b)).brighter(.75)})}function Pe(a,b){kh(b,a.node()),a.transition().duration(100).style("fill",function(){return cj(b)})}function Qe(a,b,c,d){a?Oe(b,c,d):Pe(b,c,d)}function Re(a,b,c,d){Qe(a,b,c.data,d)}function Se(a){return"circle"===a.nodeName?Ne:Mf.select(a).classed(g.bar)?Qe:Re}function Te(a){return a.filter(function(a){return b(a.value)})}function Ue(a){return li?"function"==typeof mi?mi(a):mi:0}function Ve(a){return oi?pi?pi:1.75*Ue(a):Ue(a)}function We(a){return qi?qi:4*Ue(a)}function Xe(a,c){return(c?Cj.selectAll("."+g.circles+rd(c)):Cj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ye(a,b){Xe(a,b).classed(g.EXPANDED,!0).attr("r",Ve)}function Ze(a){Xe(a).filter(function(){return Mf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Ue)}function $e(a){return Cj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function _e(a){$e(a).classed(g.EXPANDED,!0)}function af(a){$e(a).classed(g.EXPANDED,!1)}function bf(a,b){var c=ff(a,b);return function(a,b){var d=c(a,b),e=wh?1:0,f=wh?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 cf(a,b){var c=ff(a,!1),d=b?df:ef;return function(a,b){return d(c(a,b),a,this)}}function df(a,b){var c;return wh?(c=oe(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function ef(a,b,c){var d=c.getBoundingClientRect();return wh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:oe(b)?-3:-6)}function ff(a,b){var c=a.__max__+1,d=ee(Jg,c),e=be(d,c,a,!!b),f=ce(!!b),g=de(a,!!b),h=b?_:$;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return wh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function gf(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function hf(b){var c,d,e;if(Gj=Mf.select(Pf),Gj.empty())throw new Error("Element to bind not found");if(Gj.html("").classed("c3",!0),Nf.data.xs={},Nf.data.targets=zc(b),bh&&(Nf.data.targets=Nf.data.targets.filter(bh)),ah&&Oc(ah===!0?Gc(Nf.data.targets):ah),p(),V(),Dg.domain(Mf.extent(dc(Nf.data.targets))),Eg.domain(_b(Nf.data.targets,"y")),Fg.domain(_b(Nf.data.targets,"y2")),Gg.domain(Dg.domain()),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Hj=Dg.domain(),vj.scale(Gg),Wf&&zj.scale(Dg),Aj=Gj.append("svg").style("overflow","hidden").on("mouseenter",$f).on("mouseleave",_f),Bj=Aj.append("defs"),Bj.append("clipPath").attr("id",Pi).append("rect"),Bj.append("clipPath").attr("id",Qi).append("rect"),Bj.append("clipPath").attr("id",Ri).append("rect"),uf(),Cj=Aj.append("g").attr("transform",mj.main),Dj=Aj.append("g").attr("transform",mj.context),Ej=Aj.append("g").attr("transform",mj.legend),nh||Dj.style("visibility","hidden"),qh||(Ej.style("visibility","hidden"),gj=Gc(Nf.data.targets)),Fj=Gj.style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Hf(Gc(Nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=Cj.append("g").attr("clip-path",Si).attr("class",g.grid),fi&&d.append("g").attr("class",g.xgrids),Fe(hi)&&d.append("g").attr("class",g.xgridLines),ni&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),ii&&d.append("g").attr("class",g.ygrids),Fe(ji)&&d.append("g").attr("class",g.ygridLines),Cj.append("g").attr("clip-path",Si).attr("class",g.regions),Cj.append("g").attr("clip-path",Si).attr("class",g.chart),c=Cj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Wf?wh?"ns-resize":"ew-resize":null),Cj.select("."+g.chart).append("g").attr("class",g.chartBars),Cj.select("."+g.chart).append("g").attr("class",g.chartLines),Cj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",mj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Vb()),Cj.select("."+g.chart).append("g").attr("class",g.chartTexts),Wf&&Cj.insert("rect",Yf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",gg).attr("height",ig).style("opacity",0).style("cursor",wh?"ns-resize":"ew-resize").call(zj).on("dblclick.zoom",null),Nh&&vj.extent("function"!=typeof Nh?Nh:Nh(dc())),hj.x=Cj.append("g").attr("class",g.axisX).attr("clip-path",Ti).attr("transform",mj.x).style("visibility",xh?"visible":"hidden"),hj.x.append("text").attr("class",g.axisXLabel).attr("transform",wh?"rotate(-90)":"").style("text-anchor",Eb),hj.y=Cj.append("g").attr("class",g.axisY).attr("clip-path",Ui).attr("transform",mj.y).style("visibility",Ph?"visible":"hidden"),hj.y.append("text").attr("class",g.axisYLabel).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Fb),hj.y2=Cj.append("g").attr("class",g.axisY2).attr("transform",mj.y2).style("visibility",Yh?"visible":"hidden"),hj.y2.append("text").attr("class",g.axisY2Label).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Gb),Dj.append("g").attr("clip-path",Si).attr("class",g.chart),Dj.select("."+g.chart).append("g").attr("class",g.chartBars),Dj.select("."+g.chart).append("g").attr("class",g.chartLines),Dj.append("g").attr("clip-path",Si).attr("class",g.brush).call(vj).selectAll("rect").attr(wh?"width":"height",wh?hg:jg),hj.subx=Dj.append("g").attr("class",g.axisX).attr("transform",mj.subx).attr("clip-path",wh?"":Ti),xf(Nf.data.targets),qf({withUpdateTranslate:!0,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Mi){if(Vi&&"string"==typeof Ni){for(Ni=Ae(Ni),e=0;e0){d=[];for(var f in Rg)for(c=0;cf&&h>c&&d>i&&j>d;else{if(!n.classed(g.bar))return;m=Rd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Qe,q=!(c>h||f>c+e||d>j||i>d+k)}q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function nf(a){le(Nf.data.targets)||ch&&(Yi=a,Cj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Zi=!0,lh())}function of(){le(Nf.data.targets)||ch&&(Cj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),Cj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Zi=!1,mh())}function pf(a,b){"grid"===b&&a.each(function(){var a=Mf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function qf(a,c){var d,e,f,h,i,j,k,l,m,n,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,Q,R,S,T,U,W,X,Y,Z,$=ae(),_=le(Nf.data.targets),ab=Lc(Nf.data.targets);if(a=a||{},E=Je(a,"withY",!0),F=Je(a,"withSubchart",!0),G=Je(a,"withTransition",!0),J=Je(a,"withTransform",!1),K=Je(a,"withUpdateXDomain",!1),L=Je(a,"withUpdateOrgXDomain",!1),N=Je(a,"withUpdateTranslate",!1),M=Je(a,"withLegend",!1),H=Je(a,"withTransitionForExit",G),I=Je(a,"withTransitionForAxis",G),T=G?cg:0,U=H?T:0,W=I?T:0,c=c||vf(W),N&&(wh?(hj.x.call(Jg),hj.subx.call(Mg)):(hj.y.call(Kg),hj.y2.call(Lg)),p(),V(),uf(),o(!1)),M&&qh&&Hf(Gc(Nf.data.targets),a,c),Wi&&0===ab.length&&Dg.domain([0,hj.x.selectAll(".tick").size()]),ab.length&&(L&&(Dg.domain(Mf.extent(dc(ab))),Hj=Dg.domain(),Wf&&zj.scale(Dg).updateScaleExtent(),Gg.domain(Dg.domain()),vj.scale(Gg)),K&&(Dg.domain(vj.empty()?Hj:vj.extent()),Wf&&zj.scale(Dg).updateScaleExtent()),Hh||!Gh&&!Fh||(X=Nc(Mc(ab),Fh),Jg.tickValues(X),Mg.tickValues(X))),Eg.domain(_b(ab,"y")),Fg.domain(_b(ab,"y2")),hj.x.style("opacity",_?0:1),hj.y.style("opacity",_?0:1),hj.y2.style("opacity",_?0:1),hj.subx.style("opacity",_?0:1),c.axisX.call(Jg),c.axisY.call(Kg),c.axisY2.call(Lg),c.axisSubX.call(Mg),Ib(G),K&&ab.length)if(Dh&&X){for(Y=1;Y=0&&Mf.select(this).style("display",b%Z?"none":"block")})}else Aj.selectAll("."+g.axisX+" .tick text").style("display","block");!wh&&Ih&&jb(hj.x,c.axisX,Ih),O=bf($),R=cf($,!0),S=cf($,!1),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Fj.style("display","none"),q(),Cj.select("line."+g.xgridFocus).style("visibility","hidden"),fi&&(f=Zd(gi,Dg),B=Wi?Jg.tickOffset():0,e=wh?{x1:0,x2:gg,y1:function(a){return Dg(a)-B},y2:function(a){return Dg(a)-B}}:{x1:function(a){return Dg(a)+B},x2:function(a){return Dg(a)+B},y1:dg.top,y2:ig},d=Cj.select("."+g.xgrids).selectAll("."+g.xgrid).data(f),d.enter().append("line").attr("class",g.xgrid),d.attr(e).style("opacity",function(){return+Mf.select(this).attr(wh?"y1":"x1")===(wh?ig:0)?0:1}),d.exit().remove()),Fe(hi)&&(h=Cj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(hi),i=h.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),i.append("line").style("opacity",0),i.append("text").attr("text-anchor","end").attr("transform",wh?"":"rotate(-90)").attr("dx",wh?0:-dg.top).attr("dy",-5).style("opacity",0),h.select("line").transition().duration(T).attr("x1",wh?0:Jd).attr("x2",wh?gg:Jd).attr("y1",wh?Jd:dg.top).attr("y2",wh?Jd:ig).style("opacity",1),h.select("text").transition().duration(T).attr("x",wh?gg:0).attr("y",Jd).text(function(a){return a.text}).style("opacity",1),h.exit().transition().duration(T).style("opacity",0).remove()),E&&ii&&(j=Cj.select("."+g.ygrids).selectAll("."+g.ygrid).data(Eg.ticks(ki)),j.enter().append("line").attr("class",g.ygrid),j.attr("x1",wh?Eg:0).attr("x2",wh?Eg:gg).attr("y1",wh?0:Eg).attr("y2",wh?ig:Eg),j.exit().remove(),pf(j,"grid")),E&&Fe(ji)&&(k=Cj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(ji),l=k.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",wh?"rotate(-90)":"").attr("dx",wh?0:-dg.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",wh?Kd:0).attr("x2",wh?Kd:gg).attr("y1",wh?0:Kd).attr("y2",wh?ig:Kd).style("opacity",1),k.select("text").transition().duration(T).attr("x",wh?0:gg).attr("y",Kd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),u=Cj.select("."+g.regions).selectAll("."+g.region).data(Hi),u.enter().append("g").attr("class",kd).append("rect").style("fill-opacity",0),u.selectAll("rect").transition().duration(T).attr("x",ic).attr("y",jc).attr("width",kc).attr("height",lc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),u.exit().transition().duration(T).style("opacity",0).remove(),s=Cj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),s.enter().append("path").attr("class",ed).style("stroke","none").style("fill",cj),s.style("opacity",wd).transition().duration(T).attr("d",O).style("fill",cj).style("opacity",1),s.exit().transition().duration(U).style("opacity",0).remove(),m=Cj.selectAll("."+g.lines).selectAll("."+g.line).data(te),m.enter().append("path").attr("class",ad).style("stroke",cj),m.style("opacity",wd).transition().duration(T).attr("d",wj).style("stroke",cj).style("opacity",1),m.exit().transition().duration(U).style("opacity",0).remove(),n=Cj.selectAll("."+g.areas).selectAll("."+g.area).data(te),n.enter().append("path").attr("class",id).style("fill",cj).style("opacity",function(){return Ij=+Mf.select(this).style("opacity"),0}),n.style("opacity",0).transition().duration(T).attr("d",xj).style("fill",cj).style("opacity",Ij),n.exit().transition().duration(U).style("opacity",0).remove(),r=Cj.selectAll("."+g.circles).selectAll("."+g.circle).data(we),r.enter().append("circle").attr("class",cd).attr("r",Ue).style("fill",cj),r.style("opacity",wd).transition().duration(T).style("opacity",yd).style("fill",cj).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d),r.exit().remove(),v=Cj.selectAll("."+g.texts).selectAll("."+g.text).data(xe),v.enter().append("text").attr("class",Yc).attr("text-anchor",function(a){return wh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",cj).style("fill-opacity",0),v.text(function(a){return Hd(a.id)(a.value,a.id)}).style("fill-opacity",xd).transition().duration(T).attr("x",R).attr("y",S).style("fill",cj).style("fill-opacity",zd),v.exit().transition().duration(U).style("fill-opacity",0).remove(),t=Cj.selectAll("."+g.arcs).selectAll("."+g.arc).data(ue),t.enter().append("path").attr("class",gd).style("fill",function(a){return cj(a.data)}).style("cursor",function(a){return eh(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;aj||(c=Jb(a),d=Pb(c),e=Xb(),Rb(c.data.id),Df(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Jb(a),c=Pb(b),d=[c];Vd(d,Mf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;aj||(c=Jb(a),d=Pb(c),e=Yb(),Sb(c.data.id),Ef(),Wd(),e(d,b))}).on("click",function(a,b){var c=Jb(a),d=Pb(c),e=Wb();lf(this,a,b),e(d,b)}),t.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){aj=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Jb(a);return c?(b=Mf.interpolate(this._current,c),this._current=b(0),function(a){return Mb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("fill",function(a){return cj(a.data)}).style("opacity",1).call(Ie,function(){aj=!1}),t.exit().transition().duration(U).style("opacity",0).remove(),Cj.selectAll("."+g.chartArc).select("text").attr("transform",Nb).style("opacity",0).transition().duration(T).text(Qb).style("opacity",function(a){return Jc(a.data.id)&&se(a.data)?1:0}),Cj.select("."+g.chartArcsTitle).style("opacity",ke(Nf.data.targets)?1:0),nh&&(Mf.event&&"zoom"===Mf.event.type&&vj.extent(Dg.orgDomain()).update(),F&&(!wh&&Ih&&jb(hj.subx,c.axisSubX,Ih),vj.empty()||vj.extent(Dg.orgDomain()).update(),Q=bf($,!0),x=Dj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),x.enter().append("path").attr("class",ed).style("stroke","none").style("fill",cj),x.style("opacity",wd).transition().duration(T).attr("d",Q).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove(),w=Dj.selectAll("."+g.lines).selectAll("."+g.line).data(te),w.enter().append("path").attr("class",ad).style("stroke",cj),w.style("opacity",wd).transition().duration(T).attr("d",yj).style("opacity",1),w.exit().transition().duration(T).style("opacity",0).remove())),Cj.selectAll("."+g.selectedCircles).filter(function(a){return oe(a)}).selectAll("circle").remove(),Cj.selectAll("."+g.selectedCircle).transition().duration(T).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d),Zf&&(y=Cj.select("."+g.eventRects),Fe(Og)&&!sc(Og)?(y.classed(g.eventRectsMultiple)||y.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),z=Cj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),kf(z.enter()),z.attr("x",0).attr("y",0).attr("width",gg).attr("height",ig)):(y.classed(g.eventRectsSingle)||y.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Xi&&!Wi?(D=function(a,b){var c=Bc(b),d=Cc(b),e=Nf.data.xs[a.id][b];return(Dg(d?d:e+50)-Dg(c?c:e-50))/2},C=function(a,b){var c=Bc(b),d=Nf.data.xs[a.id][b];return(Dg(d)+Dg(c?c:d-50))/2}):(D=P(),C=function(a){return Dg(a.x)-D/2}),A=Ec(Nf.data.targets),Cj.select("."+g.eventRects).datum(A?A.values:[]),z=Cj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),jf(z.enter()),z.attr("class",ld).attr("x",wh?0:C).attr("y",wh?C:0).attr("width",wh?gg:D).attr("height",wh?D:ig),z.exit().remove())),Gc(Nf.data.targets).forEach(function(a){Jj[a]=!0})}function rf(){qf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function sf(){if(0!==Lc(Nf.data.targets).length){if("mousemove"===Mf.event.sourceEvent.type&&zj.altDomain)return Dg.domain(zj.altDomain),void zj.scale(Dg).updateScaleExtent();Wi&&Dg.orgDomain()[0]===Hj[0]&&Dg.domain([Hj[0]-1e-10,Dg.orgDomain()[1]]),qf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Mf.event.sourceEvent.type&&($i=!0)}}function tf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function uf(){Aj.attr("width",kg).attr("height",lg),Aj.select("#"+Pi).select("rect").attr("width",gg).attr("height",ig),Aj.select("#"+Qi).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),Aj.select("#"+Ri).select("rect").attr("x",H).attr("y",I).attr("width",N).attr("height",O),Aj.select("."+g.zoomRect).attr("width",gg).attr("height",ig),Gj.style("max-height",lg+"px")}function vf(a){return{axisX:a?hj.x.transition().duration(a):hj.x,axisY:a?hj.y.transition().duration(a):hj.y,axisY2:a?hj.y2.transition().duration(a):hj.y2,axisSubX:a?hj.subx.transition().duration(a):hj.subx}}function wf(a){var b;a=a||{},a.withTransition=Je(a,"withTransition",!0),a.withTransform=Je(a,"withTransform",!1),a.withLegend=Je(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withLegend&&qh||(b=vf(a.withTransitionForAxis?cg:0),p(),V(),uf(),o(a.withTransition,b)),qf(a,b)}function xf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=Cj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",nd),j=i.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Zc),e=Cj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),d=e.enter().append("g").attr("class",pd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",fd).style("cursor",function(a){return eh(a)?"pointer":null}),c=Cj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),b=c.enter().append("g").attr("class",od).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",bd),b.append("g").attr("class",jd),b.append("g").attr("class",function(a){return Xc(g.selectedCircles,a.id)}),b.append("g").attr("class",dd).style("cursor",function(a){return eh(a)?"pointer":null}),a.forEach(function(a){Cj.selectAll("."+g.selectedCircles+rd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Cj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(ug(a)).attr("class",qd),f=h.enter().append("g").attr("class",qd),f.append("g").attr("class",hd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),nh&&(n=Dj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),m=n.enter().append("g").style("opacity",0).attr("class",pd),m.append("g").attr("class",fd),l=Dj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),k=l.enter().append("g").style("opacity",0).attr("class",od),k.append("g").attr("class",bd)),Aj.selectAll("."+g.target).filter(function(a){return Jc(a.id)}).transition().duration(cg).style("opacity",1)}function yf(a,b){b.filter&&(a=a.filter(b.filter)),(b.type||b.types)&&a.forEach(function(a){b.types?fe(a.id,b.types[a.id]):fe(a.id,b.type)}),Nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,z=0,F++)),E[a]=F,D[F]=f,A[a]=z,z+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+v)/10),j=10*Math.ceil((h.height+u)/10),k=nj?j:i,l=nj?U():T();return d&&(z=0,F=0,w=0,x=0),qh&&!Kc(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=i,C[c]=j,(!w||i>=w)&&(w=i),(!x||j>=x)&&(x=j),g=nj?x:w,void(vh?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(l-g*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=26,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=Ej.selectAll("."+g.legendItemFocused).size();b=b||{},n=Je(b,"withTransition",!0),q=Je(b,"withTransitionForTransform",!0),nj?(f=function(a){return w*E[a]},j=function(a){return D[E[a]]+A[a]}):(f=function(a){return D[E[a]]+A[a]},j=function(a){return x*E[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=Ej.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Xc(g.legendItem,a)}).style("visibility",function(a){return Kc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof sh?sh(a):Nf.toggle(a)}).on("mouseover",function(a){Mf.select(this).classed(g.legendItemFocused,!0),aj||Nf.focus(a),"function"==typeof th&&th(a)}).on("mouseout",function(a){Mf.select(this).classed(g.legendItemFocused,!1),aj||Nf.revert(),"function"==typeof uh&&uh(a)}),m.append("text").text(function(a){return d(Rg[a])?Rg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",nj?h:-200).attr("y",nj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",nj?i:-200).attr("y",nj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",cj).attr("x",nj?h:-200).attr("y",nj?-200:j).attr("width",10).attr("height",10),r=Ej.selectAll("text").data(a).text(function(a){return d(Rg[a])?Rg[a]:a}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=Ej.selectAll("rect."+g.legendItemEvent).data(a),(n?s.transition():s).attr("width",function(a){return B[a]}).attr("height",function(a){return C[a]}).attr("x",i).attr("y",l),t=Ej.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",cj).attr("x",f).attr("y",j),Ej.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Jc(a)}).transition().style("opacity",function(a){var b=Mf.select(this);return Jc(a)?!G||b.classed(g.legendItemFocused)?Bf(b):Cf(b):rj}),R(w),S(x),Q(F),p(),V(),uf(),o(q,c)}function If(a){return Ic(Nf.data.targets,a.id)}function Jf(a){return"data"in a&&Ic(Nf.data.targets,a.data.id)}function Kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function Lf(a,b,c){var d=!le(Nf.data.targets);aj=!1,fe(a,b),wf(c||{withTransitionForAxis:d})}var Mf=a.d3?a.d3:a.require?a.require("d3"):void 0,Nf={data:{},axis:{},legend:{}},Of={},Pf=i(["bindto"],"#chart"),Qf=i(["size","width"]),Rf=i(["size","height"]),Sf=i(["padding","left"]),Tf=i(["padding","right"]),Uf=i(["padding","top"]),Vf=i(["padding","bottom"]),Wf=i(["zoom","enabled"],!1),Xf=i(["zoom","extent"]),Yf=i(["zoom","privileged"],!1),Zf=i(["interaction","enabled"],!0),$f=i(["onenter"],function(){}),_f=i(["onleave"],function(){}),ag=i(["onresize"],function(){}),bg=i(["onresized"],function(){}),cg=i(["transition","duration"],350);h("data","data is required in config");var dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg,Kg,Lg,Mg,Ng=i(["data","x"]),Og=i(["data","xs"],{}),Pg=i(["data","x_format"]),Qg=i(["data","id_converter"],function(a){return a}),Rg=i(["data","names"],{}),Sg=i(["data","classes"],{}),Tg=i(["data","groups"],[]),Ug=i(["data","axes"],{}),Vg=i(["data","type"]),Wg=i(["data","types"],{}),Xg=i(["data","labels"],{}),Yg=i(["data","order"]),Zg=i(["data","regions"],{}),$g=i(["data","color"]),_g=i(["data","colors"],{}),ah=i(["data","hide"],!1),bh=i(["data","filter"]),ch=i(["data","selection","enabled"],!1),dh=i(["data","selection","grouped"],!1),eh=i(["data","selection","isselectable"],function(){return!0}),fh=i(["data","selection","multiple"],!0),gh=i(["data","onclick"],function(){}),hh=i(["data","onenter"],function(){}),ih=i(["data","onleave"],function(){}),jh=i(["data","onselected"],function(){}),kh=i(["data","onunselected"],function(){}),lh=i(["data","ondragstart"],function(){}),mh=i(["data","ondragend"],function(){}),nh=i(["subchart","show"],!1),oh=i(["subchart","size","height"],60),ph=i(["color","pattern"],[]),qh=i(["legend","show"],!0),rh=i(["legend","position"],"bottom"),sh=i(["legend","item","onclick"]),th=i(["legend","item","onmouseover"]),uh=i(["legend","item","onmouseout"]),vh=i(["legend","equally"],!1),wh=i(["axis","rotated"],!1),xh=i(["axis","x","show"],!0),yh=i(["axis","x","type"],"indexed"),zh=i(["axis","x","localtime"],!0),Ah=i(["axis","x","categories"],[]),Bh=i(["axis","x","tick","centered"],!1),Ch=i(["axis","x","tick","format"]),Dh=i(["axis","x","tick","culling"],{}),Eh=i(["axis","x","tick","culling","max"],10),Fh=i(["axis","x","tick","count"]),Gh=i(["axis","x","tick","fit"],!0),Hh=i(["axis","x","tick","values"],null),Ih=i(["axis","x","tick","rotate"]),Jh=i(["axis","x","max"],null),Kh=i(["axis","x","min"],null),Lh=i(["axis","x","padding"],{}),Mh=i(["axis","x","height"]),Nh=i(["axis","x","default"]),Oh=i(["axis","x","label"],{}),Ph=i(["axis","y","show"],!0),Qh=i(["axis","y","max"]),Rh=i(["axis","y","min"]),Sh=i(["axis","y","center"]),Th=i(["axis","y","label"],{}),Uh=i(["axis","y","inner"],!1),Vh=i(["axis","y","tick","format"]),Wh=i(["axis","y","padding"]),Xh=i(["axis","y","ticks"],10),Yh=i(["axis","y2","show"],!1),Zh=i(["axis","y2","max"]),$h=i(["axis","y2","min"]),_h=i(["axis","y2","center"]),ai=i(["axis","y2","label"],{}),bi=i(["axis","y2","inner"],!1),ci=i(["axis","y2","tick","format"]),di=i(["axis","y2","padding"]),ei=i(["axis","y2","ticks"],10),fi=i(["grid","x","show"],!1),gi=i(["grid","x","type"],"tick"),hi=i(["grid","x","lines"],[]),ii=i(["grid","y","show"],!1),ji=i(["grid","y","lines"],[]),ki=i(["grid","y","ticks"],10),li=i(["point","show"],!0),mi=i(["point","r"],2.5),ni=i(["point","focus","line","enabled"],!0),oi=i(["point","focus","expand","enabled"],!0),pi=i(["point","focus","expand","r"]),qi=i(["point","focus","select","r"]),ri=i(["line","connect_null"],!1),si=i(["bar","width"]),ti=i(["bar","width","ratio"],.6),ui=i(["pie","label","show"],!0),vi=i(["pie","label","format"]),wi=i(["pie","expand"],!0),xi=i(["pie","onclick"],function(){}),yi=i(["pie","onmouseover"],function(){}),zi=i(["pie","onmouseout"],function(){}),Ai=i(["donut","label","show"],!0),Bi=i(["donut","label","format"]),Ci=i(["donut","expand"],!0),Di=i(["donut","title"],""),Ei=i(["donut","onclick"],function(){}),Fi=i(["donut","onmouseover"],function(){}),Gi=i(["donut","onmouseout"],function(){}),Hi=i(["regions"],[]),Ii=i(["tooltip","show"],!0),Ji=i(["tooltip","format","title"]),Ki=i(["tooltip","format","value"]),Li=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Ji?Ji:b,l=Ki?Ki:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Mi=i(["tooltip","init","show"],!1),Ni=i(["tooltip","init","x"],0),Oi=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Pi=("string"==typeof Pf?Pf.replace(/[# .>~+]/g,""):g.chart+ +new Date)+"-clip",Qi=Pi+"-xaxis",Ri=Pi+"-yaxis",Si=j(Pi),Ti=j(Qi),Ui=j(Ri),Vi="timeseries"===yh,Wi="categorized"===yh,Xi=!Vi&&(Ng||Fe(Og)),Yi=null,Zi=!1,$i=!1,_i=!1,aj=!1,bj=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],cj=ze(_g,Fe(ph)?ph:bj,$g),dj=zh?Mf.time.format:Mf.time.format.utc,ej=dj.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),fj=[],gj=[],hj={},ij=wh?"left":"bottom",jj=wh?Uh?"top":"bottom":Uh?"right":"left",kj=wh?bi?"bottom":"top":bi?"left":"right",lj=wh?"left":"bottom",mj={main:function(){return"translate("+k(dg.left)+","+k(dg.top)+")"},context:function(){return"translate("+k(eg.left)+","+k(eg.top)+")"},legend:function(){return"translate("+fg.left+","+fg.top+")" -},x:function(){return"translate(0,"+(wh?0:ig)+")"},y:function(){return"translate(0,"+(wh?ig:0)+")"},y2:function(){return"translate("+(wh?0:gg)+","+(wh?1:0)+")"},subx:function(){return"translate(0,"+(wh?0:jg)+")"},arc:function(){return"translate("+pg/2+","+qg/2+")"}},nj="right"===rh,oj=0,pj=0,qj=0,rj=.15,sj=30,tj=wh&&!xh?0:30,uj=5;ug=Mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var vj,wj=function(){var a=Mf.svg.line().x(wh?function(a){return $(a.id)(a.value)}:Id).y(wh?Id:function(a){return $(a.id)(a.value)});return ri||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ri?Te(b.values):b.values;return me(b)?(a.interpolate(ne(b)?"cardinal":"linear"),Zg[b.id]?gf(e,Dg,$(b.id),Zg[b.id]):a(e)):(c=e[0]?Dg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,wh?"M "+d+" "+c:"M "+c+" "+d)}}(),xj=function(){var a;return a=wh?Mf.svg.area().x0(function(a){return $(a.id)(0)}).x1(function(a){return $(a.id)(a.value)}).y(Id):Mf.svg.area().x(Id).y0(function(a){return $(a.id)(0)}).y1(function(a){return $(a.id)(a.value)}),function(b){var c,d,e=Te(b.values);return ge([b],"area")||ge([b],"area-spline")?(a.interpolate(ne(b)?"cardinal":"linear"),a(e)):(c=e[0]?Dg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,wh?"M "+d+" "+c:"M "+c+" "+d)}}(),yj=function(){var a=Mf.svg.line().x(wh?function(a){return _(a.id)(a.value)}:Ld).y(wh?Ld:function(a){return _(a.id)(a.value)});return function(b){var c=Te(b.values);return me(b)?a(c):"M "+Gg(c[0].x)+" "+_(b.id)(c[0].value)}}(),zj=function(){};vj=Mf.svg.brush().on("brush",rf),vj.update=function(){return Dj&&Dj.select("."+g.brush).call(this),this},vj.scale=function(a){return wh?this.y(a):this.x(a)},Wf&&(zj=Mf.behavior.zoom().on("zoomstart",function(){zj.altDomain=Mf.event.sourceEvent.altKey?Dg.orgDomain():null}).on("zoom",Wf?sf:null),zj.scale=function(a){return wh?this.y(a):this.x(a)},zj.orgScaleExtent=function(){var a=Xf?Xf:[1,10];return[a[0],Math.max(Dc()/a[1],a[1])]},zj.updateScaleExtent=function(){var a=ec(Dg.orgDomain())/ec(Hj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Aj,Bj,Cj,Dj,Ej,Fj,Gj,Hj,Ij,Jj={};if(Nf.focus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);Nf.revert(),Nf.defocus(),b(d.classed(g.focused,!0)),b(e),le(Nf.data.targets)&&Rb(a,!0),Df(a,!0)},Nf.defocus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",.3)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);Nf.revert(),b(d.classed(g.focused,!1)),b(e),le(Nf.data.targets)&&Sb(a),Df(a,!1)},Nf.revert=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);b(d.classed(g.focused,!1)),b(e),le(Nf.data.targets)&&Sb(a),Ef()},Nf.show=function(a,b){a=Hc(a),b=b||{},Pc(a),Aj.selectAll(td(a)).transition().style("opacity",1),b.withLegend&&Ff(a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Nf.hide=function(a,b){a=Hc(a),b=b||{},Oc(a),Aj.selectAll(td(a)).transition().style("opacity",0),b.withLegend&&Gf(a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Nf.toggle=function(a){Jc(a)?Nf.hide(a):Nf.show(a)},Nf.unzoom=function(){vj.clear().update(),qf({withUpdateXDomain:!0})},Nf.load=function(a){return a.xs&&rc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Sg[b]=a.classes[b]}),"categories"in a&&Wi&&(Ah=a.categories,Jg.categories(Ah)),"cacheIds"in a&&fc(a.cacheIds)?void yf(hc(a.cacheIds),a.done):void("unload"in a?Af(Hc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){zf(a)}):zf(a))},Nf.unload=function(a,b){Af(Hc(a),function(){qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Nf.selected=function(a){return Mf.merge(Cj.selectAll("."+g.shapes+rd(a)).selectAll("."+g.shape).filter(function(){return Mf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Nf.select=function(a,b,c){ch&&Cj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Mf.select(this),i=e.data?e.data.id:e.id,j=Se(this),k=dh||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);h.classed(g.line)||h.classed(g.area)||(k&&l?eh(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},Nf.unselect=function(a,b){ch&&Cj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Mf.select(this),f=c.data?c.data.id:c.id,h=Se(this),i=dh||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);e.classed(g.line)||e.classed(g.area)||i&&j&&eh(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Nf.toLine=function(a){Lf(a,"line")},Nf.toSpline=function(a){Lf(a,"spline")},Nf.toBar=function(a){Lf(a,"bar")},Nf.toScatter=function(a){Lf(a,"scatter")},Nf.toArea=function(a){Lf(a,"area")},Nf.toAreaSpline=function(a){Lf(a,"area-spline")},Nf.toPie=function(a){Lf(a,"pie",{withTransform:!0})},Nf.toDonut=function(a){Lf(a,"donut",{withTransform:!0})},Nf.groups=function(a){return c(a)?Tg:(Tg=a,qf(),Tg)},Nf.xgrids=function(a){return a?(hi=a,qf(),hi):hi},Nf.xgrids.add=function(a){return a?Nf.xgrids(hi.concat(a)):void 0},Nf.xgrids.remove=function(a){var b=Kf(a);return Nf.xgrids(hi.filter(b))},Nf.ygrids=function(a){return a?(ji=a,qf(),ji):ji},Nf.ygrids.add=function(a){return a?Nf.ygrids(ji.concat(a)):void 0},Nf.ygrids.remove=function(a){var b=Kf(a);return Nf.ygrids(ji.filter(b))},Nf.regions=function(a){return a?(Hi=a,qf(),Hi):Hi},Nf.regions.add=function(a){return a?(Hi=Hi.concat(a),qf(),Hi):Hi},Nf.regions.remove=function(a){var b,c,d;return a=a||{},b=Je(a,"duration",cg),c=Je(a,"classes",[g.region]),d=Cj.select("."+g.regions).selectAll(c.map(function(a){return"."+a})),(b?d.transition().duration(b):d).style("opacity",0).remove(),Hi=Hi.filter(function(a){return c.indexOf(a.class)<0})},Nf.data.get=function(a){var b=Nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Nf.data.getAsTarget=function(a){var b=Nf.data.targets.filter(function(b){return b.id===a});return b.length>0?b[0]:void 0},Nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Rg[b]=a[b]}),qf({withLegend:!0}),Rg):Rg},Nf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){_g[b]=a[b]}),qf({withLegend:!0}),_g):_g},Nf.x=function(a){return arguments.length&&(uc(Nf.data.targets,a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Nf.data.xs},Nf.xs=function(a){return arguments.length&&(vc(Nf.data.targets,a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Nf.data.xs},Nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){gb(b,a[b])}),Ib())},Nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Jh=+a.x),b(a.y)&&(Qh=+a.y),b(a.y2)&&(Zh=+a.y2)):Qh=Zh=+a,qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Kh=+a.x),b(a.y)&&(Rh=+a.y),b(a.y2)&&($h=+a.y2)):Rh=$h=+a,qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Nf.axis.max(a.max),"undefined"!=typeof a.min&&Nf.axis.min(a.min))},Nf.legend.show=function(a){Ff(Hc(a)),qf({withLegend:!0})},Nf.legend.hide=function(a){Gf(Hc(a)),qf({withLegend:!0})},Nf.resize=function(a){Qf=a?a.width:null,Rf=a?a.height:null,wf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Nf.destroy=function(){Nf.data.targets=void 0,Nf.data.xs={},Gj.html(""),a.onresize=null},"url"in f.data)Mf.xhr(f.data.url,function(a,b){var c,d=Mf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Mf.csv.parse(b.response),hf(c)});else if("rows"in f.data)hf(xc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");hf(yc(f.data.columns))}return Nf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(window); \ No newline at end of file +for(q=wh?function(a){return e(a.value)}:function(a){return b(a.x)},r=wh?function(a){return b(a.x)}:function(a){return e(a.value)},i=Vi?function(a,c,d,f){var g=a.x.getTime(),h=c.x-a.x,i=new Date(g+h*d),j=new Date(g+h*(d+f));return"M"+b(i)+" "+e(k(d))+" "+b(j)+" "+e(k(d+f))}:function(a,c,d,f){return"M"+b(j(d),!0)+" "+e(k(d))+" "+b(j(d+f),!0)+" "+e(k(d+f))},g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function hf(b){var c,d,e;if(Gj=Mf.select(Pf),Gj.empty())throw new Error("Element to bind not found");if(Gj.html("").classed("c3",!0),Nf.data.xs={},Nf.data.targets=zc(b),bh&&(Nf.data.targets=Nf.data.targets.filter(bh)),ah&&Oc(ah===!0?Gc(Nf.data.targets):ah),p(),V(),Dg.domain(Mf.extent(dc(Nf.data.targets))),Eg.domain(_b(Nf.data.targets,"y")),Fg.domain(_b(Nf.data.targets,"y2")),Gg.domain(Dg.domain()),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Hj=Dg.domain(),vj.scale(Gg),Wf&&zj.scale(Dg),Aj=Gj.append("svg").style("overflow","hidden").on("mouseenter",$f).on("mouseleave",_f),Bj=Aj.append("defs"),Bj.append("clipPath").attr("id",Pi).append("rect"),Bj.append("clipPath").attr("id",Qi).append("rect"),Bj.append("clipPath").attr("id",Ri).append("rect"),uf(),Cj=Aj.append("g").attr("transform",mj.main),Dj=Aj.append("g").attr("transform",mj.context),Ej=Aj.append("g").attr("transform",mj.legend),nh||Dj.style("visibility","hidden"),qh||(Ej.style("visibility","hidden"),gj=Gc(Nf.data.targets)),Fj=Gj.style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Hf(Gc(Nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=Cj.append("g").attr("clip-path",Si).attr("class",g.grid),fi&&d.append("g").attr("class",g.xgrids),Fe(hi)&&d.append("g").attr("class",g.xgridLines),ni&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),ii&&d.append("g").attr("class",g.ygrids),Fe(ji)&&d.append("g").attr("class",g.ygridLines),Cj.append("g").attr("clip-path",Si).attr("class",g.regions),Cj.append("g").attr("clip-path",Si).attr("class",g.chart),c=Cj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Wf?wh?"ns-resize":"ew-resize":null),Cj.select("."+g.chart).append("g").attr("class",g.chartBars),Cj.select("."+g.chart).append("g").attr("class",g.chartLines),Cj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",mj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Vb()),Cj.select("."+g.chart).append("g").attr("class",g.chartTexts),Wf&&Cj.insert("rect",Yf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",gg).attr("height",ig).style("opacity",0).style("cursor",wh?"ns-resize":"ew-resize").call(zj).on("dblclick.zoom",null),Nh&&vj.extent("function"!=typeof Nh?Nh:Nh(dc())),hj.x=Cj.append("g").attr("class",g.axisX).attr("clip-path",Ti).attr("transform",mj.x).style("visibility",xh?"visible":"hidden"),hj.x.append("text").attr("class",g.axisXLabel).attr("transform",wh?"rotate(-90)":"").style("text-anchor",Eb),hj.y=Cj.append("g").attr("class",g.axisY).attr("clip-path",Ui).attr("transform",mj.y).style("visibility",Ph?"visible":"hidden"),hj.y.append("text").attr("class",g.axisYLabel).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Fb),hj.y2=Cj.append("g").attr("class",g.axisY2).attr("transform",mj.y2).style("visibility",Yh?"visible":"hidden"),hj.y2.append("text").attr("class",g.axisY2Label).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Gb),Dj.append("g").attr("clip-path",Si).attr("class",g.chart),Dj.select("."+g.chart).append("g").attr("class",g.chartBars),Dj.select("."+g.chart).append("g").attr("class",g.chartLines),Dj.append("g").attr("clip-path",Si).attr("class",g.brush).call(vj).selectAll("rect").attr(wh?"width":"height",wh?hg:jg),hj.subx=Dj.append("g").attr("class",g.axisX).attr("transform",mj.subx).attr("clip-path",wh?"":Ti),xf(Nf.data.targets),qf({withUpdateTranslate:!0,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Mi){if(Vi&&"string"==typeof Ni){for(Ni=Ae(Ni),e=0;e0){d=[];for(var f in Rg)for(c=0;cf&&h>c&&d>i&&j>d;else{if(!n.classed(g.bar))return;m=Rd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Qe,q=!(c>h||f>c+e||d>j||i>d+k)}q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function nf(a){le(Nf.data.targets)||ch&&(Yi=a,Cj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Zi=!0,lh())}function of(){le(Nf.data.targets)||ch&&(Cj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),Cj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Zi=!1,mh())}function pf(a,b){"grid"===b&&a.each(function(){var a=Mf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function qf(a,c){var d,e,f,h,i,j,k,l,m,n,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,Q,R,S,T,U,W,X,Y,Z,$=ae(),_=le(Nf.data.targets),ab=Lc(Nf.data.targets);if(a=a||{},E=Je(a,"withY",!0),F=Je(a,"withSubchart",!0),G=Je(a,"withTransition",!0),J=Je(a,"withTransform",!1),K=Je(a,"withUpdateXDomain",!1),L=Je(a,"withUpdateOrgXDomain",!1),N=Je(a,"withUpdateTranslate",!1),M=Je(a,"withLegend",!1),H=Je(a,"withTransitionForExit",G),I=Je(a,"withTransitionForAxis",G),T=G?cg:0,U=H?T:0,W=I?T:0,c=c||vf(W),N&&(wh?(hj.x.call(Jg),hj.subx.call(Mg)):(hj.y.call(Kg),hj.y2.call(Lg)),p(),V(),uf(),o(!1)),M&&qh&&Hf(Gc(Nf.data.targets),a,c),Wi&&0===ab.length&&Dg.domain([0,hj.x.selectAll(".tick").size()]),ab.length&&(L&&(Dg.domain(Mf.extent(dc(ab))),Hj=Dg.domain(),Wf&&zj.scale(Dg).updateScaleExtent(),Gg.domain(Dg.domain()),vj.scale(Gg)),K&&(Dg.domain(vj.empty()?Hj:vj.extent()),Wf&&zj.scale(Dg).updateScaleExtent()),Hh||!Gh&&!Fh||(X=Nc(Mc(ab),Fh),Jg.tickValues(X),Mg.tickValues(X))),Eg.domain(_b(ab,"y")),Fg.domain(_b(ab,"y2")),hj.x.style("opacity",_?0:1),hj.y.style("opacity",_?0:1),hj.y2.style("opacity",_?0:1),hj.subx.style("opacity",_?0:1),c.axisX.call(Jg),c.axisY.call(Kg),c.axisY2.call(Lg),c.axisSubX.call(Mg),Ib(G),K&&ab.length)if(Dh&&X){for(Y=1;Y=0&&Mf.select(this).style("display",b%Z?"none":"block")})}else Aj.selectAll("."+g.axisX+" .tick text").style("display","block");!wh&&Ih&&jb(hj.x,c.axisX,Ih),O=bf($),R=cf($,!0),S=cf($,!1),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Fj.style("display","none"),q(),Cj.select("line."+g.xgridFocus).style("visibility","hidden"),fi&&(f=Zd(gi,Dg),B=Wi?Jg.tickOffset():0,e=wh?{x1:0,x2:gg,y1:function(a){return Dg(a)-B},y2:function(a){return Dg(a)-B}}:{x1:function(a){return Dg(a)+B},x2:function(a){return Dg(a)+B},y1:dg.top,y2:ig},d=Cj.select("."+g.xgrids).selectAll("."+g.xgrid).data(f),d.enter().append("line").attr("class",g.xgrid),d.attr(e).style("opacity",function(){return+Mf.select(this).attr(wh?"y1":"x1")===(wh?ig:0)?0:1}),d.exit().remove()),Fe(hi)&&(h=Cj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(hi),i=h.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),i.append("line").style("opacity",0),i.append("text").attr("text-anchor","end").attr("transform",wh?"":"rotate(-90)").attr("dx",wh?0:-dg.top).attr("dy",-5).style("opacity",0),h.select("line").transition().duration(T).attr("x1",wh?0:Jd).attr("x2",wh?gg:Jd).attr("y1",wh?Jd:dg.top).attr("y2",wh?Jd:ig).style("opacity",1),h.select("text").transition().duration(T).attr("x",wh?gg:0).attr("y",Jd).text(function(a){return a.text}).style("opacity",1),h.exit().transition().duration(T).style("opacity",0).remove()),E&&ii&&(j=Cj.select("."+g.ygrids).selectAll("."+g.ygrid).data(Eg.ticks(ki)),j.enter().append("line").attr("class",g.ygrid),j.attr("x1",wh?Eg:0).attr("x2",wh?Eg:gg).attr("y1",wh?0:Eg).attr("y2",wh?ig:Eg),j.exit().remove(),pf(j,"grid")),E&&Fe(ji)&&(k=Cj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(ji),l=k.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",wh?"rotate(-90)":"").attr("dx",wh?0:-dg.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",wh?Kd:0).attr("x2",wh?Kd:gg).attr("y1",wh?0:Kd).attr("y2",wh?ig:Kd).style("opacity",1),k.select("text").transition().duration(T).attr("x",wh?0:gg).attr("y",Kd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),u=Cj.select("."+g.regions).selectAll("."+g.region).data(Hi),u.enter().append("g").attr("class",kd).append("rect").style("fill-opacity",0),u.selectAll("rect").transition().duration(T).attr("x",ic).attr("y",jc).attr("width",kc).attr("height",lc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),u.exit().transition().duration(T).style("opacity",0).remove(),s=Cj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),s.enter().append("path").attr("class",ed).style("stroke","none").style("fill",cj),s.style("opacity",wd).transition().duration(T).attr("d",O).style("fill",cj).style("opacity",1),s.exit().transition().duration(U).style("opacity",0).remove(),m=Cj.selectAll("."+g.lines).selectAll("."+g.line).data(te),m.enter().append("path").attr("class",ad).style("stroke",cj),m.style("opacity",wd).transition().duration(T).attr("d",wj).style("stroke",cj).style("opacity",1),m.exit().transition().duration(U).style("opacity",0).remove(),n=Cj.selectAll("."+g.areas).selectAll("."+g.area).data(te),n.enter().append("path").attr("class",id).style("fill",cj).style("opacity",function(){return Ij=+Mf.select(this).style("opacity"),0}),n.style("opacity",0).transition().duration(T).attr("d",xj).style("fill",cj).style("opacity",Ij),n.exit().transition().duration(U).style("opacity",0).remove(),r=Cj.selectAll("."+g.circles).selectAll("."+g.circle).data(we),r.enter().append("circle").attr("class",cd).attr("r",Ue).style("fill",cj),r.style("opacity",wd).transition().duration(T).style("opacity",yd).style("fill",cj).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d),r.exit().remove(),v=Cj.selectAll("."+g.texts).selectAll("."+g.text).data(xe),v.enter().append("text").attr("class",Yc).attr("text-anchor",function(a){return wh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",cj).style("fill-opacity",0),v.text(function(a){return Hd(a.id)(a.value,a.id)}).style("fill-opacity",xd).transition().duration(T).attr("x",R).attr("y",S).style("fill",cj).style("fill-opacity",zd),v.exit().transition().duration(U).style("fill-opacity",0).remove(),t=Cj.selectAll("."+g.arcs).selectAll("."+g.arc).data(ue),t.enter().append("path").attr("class",gd).style("fill",function(a){return cj(a.data)}).style("cursor",function(a){return eh(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;aj||(c=Jb(a),d=Pb(c),e=Xb(),Rb(c.data.id),Df(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Jb(a),c=Pb(b),d=[c];Vd(d,Mf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;aj||(c=Jb(a),d=Pb(c),e=Yb(),Sb(c.data.id),Ef(),Wd(),e(d,b))}).on("click",function(a,b){var c=Jb(a),d=Pb(c),e=Wb();lf(this,a,b),e(d,b)}),t.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){aj=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Jb(a);return c?(b=Mf.interpolate(this._current,c),this._current=b(0),function(a){return Mb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("fill",function(a){return cj(a.data)}).style("opacity",1).call(Ie,function(){aj=!1}),t.exit().transition().duration(U).style("opacity",0).remove(),Cj.selectAll("."+g.chartArc).select("text").attr("transform",Nb).style("opacity",0).transition().duration(T).text(Qb).style("opacity",function(a){return Jc(a.data.id)&&se(a.data)?1:0}),Cj.select("."+g.chartArcsTitle).style("opacity",ke(Nf.data.targets)?1:0),nh&&(Mf.event&&"zoom"===Mf.event.type&&vj.extent(Dg.orgDomain()).update(),F&&(!wh&&Ih&&jb(hj.subx,c.axisSubX,Ih),vj.empty()||vj.extent(Dg.orgDomain()).update(),Q=bf($,!0),x=Dj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),x.enter().append("path").attr("class",ed).style("stroke","none").style("fill",cj),x.style("opacity",wd).transition().duration(T).attr("d",Q).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove(),w=Dj.selectAll("."+g.lines).selectAll("."+g.line).data(te),w.enter().append("path").attr("class",ad).style("stroke",cj),w.style("opacity",wd).transition().duration(T).attr("d",yj).style("opacity",1),w.exit().transition().duration(T).style("opacity",0).remove())),Cj.selectAll("."+g.selectedCircles).filter(function(a){return oe(a)}).selectAll("circle").remove(),Cj.selectAll("."+g.selectedCircle).transition().duration(T).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d),Zf&&(y=Cj.select("."+g.eventRects),Fe(Og)&&!sc(Og)?(y.classed(g.eventRectsMultiple)||y.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),z=Cj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),kf(z.enter()),z.attr("x",0).attr("y",0).attr("width",gg).attr("height",ig)):(y.classed(g.eventRectsSingle)||y.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Xi&&!Wi?(D=function(a,b){var c=Bc(b),d=Cc(b),e=Nf.data.xs[a.id][b];return(Dg(d?d:e+50)-Dg(c?c:e-50))/2},C=function(a,b){var c=Bc(b),d=Nf.data.xs[a.id][b];return(Dg(d)+Dg(c?c:d-50))/2}):(D=P(),C=function(a){return Dg(a.x)-D/2}),A=Ec(Nf.data.targets),Cj.select("."+g.eventRects).datum(A?A.values:[]),z=Cj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),jf(z.enter()),z.attr("class",ld).attr("x",wh?0:C).attr("y",wh?C:0).attr("width",wh?gg:D).attr("height",wh?D:ig),z.exit().remove())),Gc(Nf.data.targets).forEach(function(a){Jj[a]=!0})}function rf(){qf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function sf(){if(0!==Lc(Nf.data.targets).length){if("mousemove"===Mf.event.sourceEvent.type&&zj.altDomain)return Dg.domain(zj.altDomain),void zj.scale(Dg).updateScaleExtent();Wi&&Dg.orgDomain()[0]===Hj[0]&&Dg.domain([Hj[0]-1e-10,Dg.orgDomain()[1]]),qf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Mf.event.sourceEvent.type&&($i=!0)}}function tf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function uf(){Aj.attr("width",kg).attr("height",lg),Aj.select("#"+Pi).select("rect").attr("width",gg).attr("height",ig),Aj.select("#"+Qi).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),Aj.select("#"+Ri).select("rect").attr("x",H).attr("y",I).attr("width",N).attr("height",O),Aj.select("."+g.zoomRect).attr("width",gg).attr("height",ig),Gj.style("max-height",lg+"px")}function vf(a){return{axisX:a?hj.x.transition().duration(a):hj.x,axisY:a?hj.y.transition().duration(a):hj.y,axisY2:a?hj.y2.transition().duration(a):hj.y2,axisSubX:a?hj.subx.transition().duration(a):hj.subx}}function wf(a){var b;a=a||{},a.withTransition=Je(a,"withTransition",!0),a.withTransform=Je(a,"withTransform",!1),a.withLegend=Je(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withLegend&&qh||(b=vf(a.withTransitionForAxis?cg:0),p(),V(),uf(),o(a.withTransition,b)),qf(a,b)}function xf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=Cj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",nd),j=i.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Zc),e=Cj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),d=e.enter().append("g").attr("class",pd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",fd).style("cursor",function(a){return eh(a)?"pointer":null}),c=Cj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),b=c.enter().append("g").attr("class",od).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",bd),b.append("g").attr("class",jd),b.append("g").attr("class",function(a){return Xc(g.selectedCircles,a.id)}),b.append("g").attr("class",dd).style("cursor",function(a){return eh(a)?"pointer":null}),a.forEach(function(a){Cj.selectAll("."+g.selectedCircles+rd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Cj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(ug(a)).attr("class",qd),f=h.enter().append("g").attr("class",qd),f.append("g").attr("class",hd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),nh&&(n=Dj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),m=n.enter().append("g").style("opacity",0).attr("class",pd),m.append("g").attr("class",fd),l=Dj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),k=l.enter().append("g").style("opacity",0).attr("class",od),k.append("g").attr("class",bd)),Aj.selectAll("."+g.target).filter(function(a){return Jc(a.id)}).transition().duration(cg).style("opacity",1)}function yf(a,b){b.filter&&(a=a.filter(b.filter)),(b.type||b.types)&&a.forEach(function(a){b.types?fe(a.id,b.types[a.id]):fe(a.id,b.type)}),Nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,z=0,F++)),E[a]=F,D[F]=f,A[a]=z,z+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+v)/10),j=10*Math.ceil((h.height+u)/10),k=nj?j:i,l=nj?U():T();return d&&(z=0,F=0,w=0,x=0),qh&&!Kc(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=i,C[c]=j,(!w||i>=w)&&(w=i),(!x||j>=x)&&(x=j),g=nj?x:w,void(vh?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(l-g*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=26,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=Ej.selectAll("."+g.legendItemFocused).size();b=b||{},n=Je(b,"withTransition",!0),q=Je(b,"withTransitionForTransform",!0),nj?(f=function(a){return w*E[a]},j=function(a){return D[E[a]]+A[a]}):(f=function(a){return D[E[a]]+A[a]},j=function(a){return x*E[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=Ej.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Xc(g.legendItem,a)}).style("visibility",function(a){return Kc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof sh?sh(a):Nf.toggle(a)}).on("mouseover",function(a){Mf.select(this).classed(g.legendItemFocused,!0),aj||Nf.focus(a),"function"==typeof th&&th(a)}).on("mouseout",function(a){Mf.select(this).classed(g.legendItemFocused,!1),aj||Nf.revert(),"function"==typeof uh&&uh(a)}),m.append("text").text(function(a){return d(Rg[a])?Rg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",nj?h:-200).attr("y",nj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",nj?i:-200).attr("y",nj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",cj).attr("x",nj?h:-200).attr("y",nj?-200:j).attr("width",10).attr("height",10),r=Ej.selectAll("text").data(a).text(function(a){return d(Rg[a])?Rg[a]:a}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=Ej.selectAll("rect."+g.legendItemEvent).data(a),(n?s.transition():s).attr("width",function(a){return B[a]}).attr("height",function(a){return C[a]}).attr("x",i).attr("y",l),t=Ej.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",cj).attr("x",f).attr("y",j),Ej.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Jc(a)}).transition().style("opacity",function(a){var b=Mf.select(this);return Jc(a)?!G||b.classed(g.legendItemFocused)?Bf(b):Cf(b):rj}),R(w),S(x),Q(F),p(),V(),uf(),o(q,c)}function If(a){return Ic(Nf.data.targets,a.id)}function Jf(a){return"data"in a&&Ic(Nf.data.targets,a.data.id)}function Kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function Lf(a,b,c){var d=!le(Nf.data.targets);aj=!1,fe(a,b),wf(c||{withTransitionForAxis:d})}var Mf=a.d3?a.d3:"undefined"!=typeof require?require("d3"):void 0,Nf={data:{},axis:{},legend:{}},Of={},Pf=i(["bindto"],"#chart"),Qf=i(["size","width"]),Rf=i(["size","height"]),Sf=i(["padding","left"]),Tf=i(["padding","right"]),Uf=i(["padding","top"]),Vf=i(["padding","bottom"]),Wf=i(["zoom","enabled"],!1),Xf=i(["zoom","extent"]),Yf=i(["zoom","privileged"],!1),Zf=i(["interaction","enabled"],!0),$f=i(["onenter"],function(){}),_f=i(["onleave"],function(){}),ag=i(["onresize"],function(){}),bg=i(["onresized"],function(){}),cg=i(["transition","duration"],350);h("data","data is required in config");var dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg,Kg,Lg,Mg,Ng=i(["data","x"]),Og=i(["data","xs"],{}),Pg=i(["data","x_format"]),Qg=i(["data","id_converter"],function(a){return a}),Rg=i(["data","names"],{}),Sg=i(["data","classes"],{}),Tg=i(["data","groups"],[]),Ug=i(["data","axes"],{}),Vg=i(["data","type"]),Wg=i(["data","types"],{}),Xg=i(["data","labels"],{}),Yg=i(["data","order"]),Zg=i(["data","regions"],{}),$g=i(["data","color"]),_g=i(["data","colors"],{}),ah=i(["data","hide"],!1),bh=i(["data","filter"]),ch=i(["data","selection","enabled"],!1),dh=i(["data","selection","grouped"],!1),eh=i(["data","selection","isselectable"],function(){return!0}),fh=i(["data","selection","multiple"],!0),gh=i(["data","onclick"],function(){}),hh=i(["data","onenter"],function(){}),ih=i(["data","onleave"],function(){}),jh=i(["data","onselected"],function(){}),kh=i(["data","onunselected"],function(){}),lh=i(["data","ondragstart"],function(){}),mh=i(["data","ondragend"],function(){}),nh=i(["subchart","show"],!1),oh=i(["subchart","size","height"],60),ph=i(["color","pattern"],[]),qh=i(["legend","show"],!0),rh=i(["legend","position"],"bottom"),sh=i(["legend","item","onclick"]),th=i(["legend","item","onmouseover"]),uh=i(["legend","item","onmouseout"]),vh=i(["legend","equally"],!1),wh=i(["axis","rotated"],!1),xh=i(["axis","x","show"],!0),yh=i(["axis","x","type"],"indexed"),zh=i(["axis","x","localtime"],!0),Ah=i(["axis","x","categories"],[]),Bh=i(["axis","x","tick","centered"],!1),Ch=i(["axis","x","tick","format"]),Dh=i(["axis","x","tick","culling"],{}),Eh=i(["axis","x","tick","culling","max"],10),Fh=i(["axis","x","tick","count"]),Gh=i(["axis","x","tick","fit"],!0),Hh=i(["axis","x","tick","values"],null),Ih=i(["axis","x","tick","rotate"]),Jh=i(["axis","x","max"],null),Kh=i(["axis","x","min"],null),Lh=i(["axis","x","padding"],{}),Mh=i(["axis","x","height"]),Nh=i(["axis","x","default"]),Oh=i(["axis","x","label"],{}),Ph=i(["axis","y","show"],!0),Qh=i(["axis","y","max"]),Rh=i(["axis","y","min"]),Sh=i(["axis","y","center"]),Th=i(["axis","y","label"],{}),Uh=i(["axis","y","inner"],!1),Vh=i(["axis","y","tick","format"]),Wh=i(["axis","y","padding"]),Xh=i(["axis","y","ticks"],10),Yh=i(["axis","y2","show"],!1),Zh=i(["axis","y2","max"]),$h=i(["axis","y2","min"]),_h=i(["axis","y2","center"]),ai=i(["axis","y2","label"],{}),bi=i(["axis","y2","inner"],!1),ci=i(["axis","y2","tick","format"]),di=i(["axis","y2","padding"]),ei=i(["axis","y2","ticks"],10),fi=i(["grid","x","show"],!1),gi=i(["grid","x","type"],"tick"),hi=i(["grid","x","lines"],[]),ii=i(["grid","y","show"],!1),ji=i(["grid","y","lines"],[]),ki=i(["grid","y","ticks"],10),li=i(["point","show"],!0),mi=i(["point","r"],2.5),ni=i(["point","focus","line","enabled"],!0),oi=i(["point","focus","expand","enabled"],!0),pi=i(["point","focus","expand","r"]),qi=i(["point","focus","select","r"]),ri=i(["line","connect_null"],!1),si=i(["bar","width"]),ti=i(["bar","width","ratio"],.6),ui=i(["pie","label","show"],!0),vi=i(["pie","label","format"]),wi=i(["pie","expand"],!0),xi=i(["pie","onclick"],function(){}),yi=i(["pie","onmouseover"],function(){}),zi=i(["pie","onmouseout"],function(){}),Ai=i(["donut","label","show"],!0),Bi=i(["donut","label","format"]),Ci=i(["donut","expand"],!0),Di=i(["donut","title"],""),Ei=i(["donut","onclick"],function(){}),Fi=i(["donut","onmouseover"],function(){}),Gi=i(["donut","onmouseout"],function(){}),Hi=i(["regions"],[]),Ii=i(["tooltip","show"],!0),Ji=i(["tooltip","format","title"]),Ki=i(["tooltip","format","value"]),Li=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Ji?Ji:b,l=Ki?Ki:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Mi=i(["tooltip","init","show"],!1),Ni=i(["tooltip","init","x"],0),Oi=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Pi=("string"==typeof Pf?Pf.replace(/[# .>~+]/g,""):g.chart+ +new Date)+"-clip",Qi=Pi+"-xaxis",Ri=Pi+"-yaxis",Si=j(Pi),Ti=j(Qi),Ui=j(Ri),Vi="timeseries"===yh,Wi="categorized"===yh,Xi=!Vi&&(Ng||Fe(Og)),Yi=null,Zi=!1,$i=!1,_i=!1,aj=!1,bj=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],cj=ze(_g,Fe(ph)?ph:bj,$g),dj=zh?Mf.time.format:Mf.time.format.utc,ej=dj.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),fj=[],gj=[],hj={},ij=wh?"left":"bottom",jj=wh?Uh?"top":"bottom":Uh?"right":"left",kj=wh?bi?"bottom":"top":bi?"left":"right",lj=wh?"left":"bottom",mj={main:function(){return"translate("+k(dg.left)+","+k(dg.top)+")"},context:function(){return"translate("+k(eg.left)+","+k(eg.top)+")"},legend:function(){return"translate("+fg.left+","+fg.top+")" +},x:function(){return"translate(0,"+(wh?0:ig)+")"},y:function(){return"translate(0,"+(wh?ig:0)+")"},y2:function(){return"translate("+(wh?0:gg)+","+(wh?1:0)+")"},subx:function(){return"translate(0,"+(wh?0:jg)+")"},arc:function(){return"translate("+pg/2+","+qg/2+")"}},nj="right"===rh,oj=0,pj=0,qj=0,rj=.15,sj=30,tj=wh&&!xh?0:30,uj=5;ug=Mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var vj,wj=function(){var a=Mf.svg.line().x(wh?function(a){return $(a.id)(a.value)}:Id).y(wh?Id:function(a){return $(a.id)(a.value)});return ri||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ri?Te(b.values):b.values;return me(b)?(a.interpolate(ne(b)?"cardinal":"linear"),Zg[b.id]?gf(e,Dg,$(b.id),Zg[b.id]):a(e)):(c=e[0]?Dg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,wh?"M "+d+" "+c:"M "+c+" "+d)}}(),xj=function(){var a;return a=wh?Mf.svg.area().x0(function(a){return $(a.id)(0)}).x1(function(a){return $(a.id)(a.value)}).y(Id):Mf.svg.area().x(Id).y0(function(a){return $(a.id)(0)}).y1(function(a){return $(a.id)(a.value)}),function(b){var c,d,e=Te(b.values);return ge([b],"area")||ge([b],"area-spline")?(a.interpolate(ne(b)?"cardinal":"linear"),a(e)):(c=e[0]?Dg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,wh?"M "+d+" "+c:"M "+c+" "+d)}}(),yj=function(){var a=Mf.svg.line().x(wh?function(a){return _(a.id)(a.value)}:Ld).y(wh?Ld:function(a){return _(a.id)(a.value)});return function(b){var c=Te(b.values);return me(b)?a(c):"M "+Gg(c[0].x)+" "+_(b.id)(c[0].value)}}(),zj=function(){};vj=Mf.svg.brush().on("brush",rf),vj.update=function(){return Dj&&Dj.select("."+g.brush).call(this),this},vj.scale=function(a){return wh?this.y(a):this.x(a)},Wf&&(zj=Mf.behavior.zoom().on("zoomstart",function(){zj.altDomain=Mf.event.sourceEvent.altKey?Dg.orgDomain():null}).on("zoom",Wf?sf:null),zj.scale=function(a){return wh?this.y(a):this.x(a)},zj.orgScaleExtent=function(){var a=Xf?Xf:[1,10];return[a[0],Math.max(Dc()/a[1],a[1])]},zj.updateScaleExtent=function(){var a=ec(Dg.orgDomain())/ec(Hj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Aj,Bj,Cj,Dj,Ej,Fj,Gj,Hj,Ij,Jj={};if(Nf.focus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);Nf.revert(),Nf.defocus(),b(d.classed(g.focused,!0)),b(e),le(Nf.data.targets)&&Rb(a,!0),Df(a,!0)},Nf.defocus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",.3)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);Nf.revert(),b(d.classed(g.focused,!1)),b(e),le(Nf.data.targets)&&Sb(a),Df(a,!1)},Nf.revert=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);b(d.classed(g.focused,!1)),b(e),le(Nf.data.targets)&&Sb(a),Ef()},Nf.show=function(a,b){a=Hc(a),b=b||{},Pc(a),Aj.selectAll(td(a)).transition().style("opacity",1),b.withLegend&&Ff(a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Nf.hide=function(a,b){a=Hc(a),b=b||{},Oc(a),Aj.selectAll(td(a)).transition().style("opacity",0),b.withLegend&&Gf(a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Nf.toggle=function(a){Jc(a)?Nf.hide(a):Nf.show(a)},Nf.unzoom=function(){vj.clear().update(),qf({withUpdateXDomain:!0})},Nf.load=function(a){return a.xs&&rc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Sg[b]=a.classes[b]}),"categories"in a&&Wi&&(Ah=a.categories,Jg.categories(Ah)),"cacheIds"in a&&fc(a.cacheIds)?void yf(hc(a.cacheIds),a.done):void("unload"in a?Af(Hc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){zf(a)}):zf(a))},Nf.unload=function(a,b){Af(Hc(a),function(){qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Nf.selected=function(a){return Mf.merge(Cj.selectAll("."+g.shapes+rd(a)).selectAll("."+g.shape).filter(function(){return Mf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Nf.select=function(a,b,c){ch&&Cj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Mf.select(this),i=e.data?e.data.id:e.id,j=Se(this),k=dh||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);h.classed(g.line)||h.classed(g.area)||(k&&l?eh(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},Nf.unselect=function(a,b){ch&&Cj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Mf.select(this),f=c.data?c.data.id:c.id,h=Se(this),i=dh||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);e.classed(g.line)||e.classed(g.area)||i&&j&&eh(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Nf.toLine=function(a){Lf(a,"line")},Nf.toSpline=function(a){Lf(a,"spline")},Nf.toBar=function(a){Lf(a,"bar")},Nf.toScatter=function(a){Lf(a,"scatter")},Nf.toArea=function(a){Lf(a,"area")},Nf.toAreaSpline=function(a){Lf(a,"area-spline")},Nf.toPie=function(a){Lf(a,"pie",{withTransform:!0})},Nf.toDonut=function(a){Lf(a,"donut",{withTransform:!0})},Nf.groups=function(a){return c(a)?Tg:(Tg=a,qf(),Tg)},Nf.xgrids=function(a){return a?(hi=a,qf(),hi):hi},Nf.xgrids.add=function(a){return a?Nf.xgrids(hi.concat(a)):void 0},Nf.xgrids.remove=function(a){var b=Kf(a);return Nf.xgrids(hi.filter(b))},Nf.ygrids=function(a){return a?(ji=a,qf(),ji):ji},Nf.ygrids.add=function(a){return a?Nf.ygrids(ji.concat(a)):void 0},Nf.ygrids.remove=function(a){var b=Kf(a);return Nf.ygrids(ji.filter(b))},Nf.regions=function(a){return a?(Hi=a,qf(),Hi):Hi},Nf.regions.add=function(a){return a?(Hi=Hi.concat(a),qf(),Hi):Hi},Nf.regions.remove=function(a){var b,c,d;return a=a||{},b=Je(a,"duration",cg),c=Je(a,"classes",[g.region]),d=Cj.select("."+g.regions).selectAll(c.map(function(a){return"."+a})),(b?d.transition().duration(b):d).style("opacity",0).remove(),Hi=Hi.filter(function(a){return c.indexOf(a.class)<0})},Nf.data.get=function(a){var b=Nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Nf.data.getAsTarget=function(a){var b=Nf.data.targets.filter(function(b){return b.id===a});return b.length>0?b[0]:void 0},Nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Rg[b]=a[b]}),qf({withLegend:!0}),Rg):Rg},Nf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){_g[b]=a[b]}),qf({withLegend:!0}),_g):_g},Nf.x=function(a){return arguments.length&&(uc(Nf.data.targets,a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Nf.data.xs},Nf.xs=function(a){return arguments.length&&(vc(Nf.data.targets,a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Nf.data.xs},Nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){gb(b,a[b])}),Ib())},Nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Jh=+a.x),b(a.y)&&(Qh=+a.y),b(a.y2)&&(Zh=+a.y2)):Qh=Zh=+a,qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Kh=+a.x),b(a.y)&&(Rh=+a.y),b(a.y2)&&($h=+a.y2)):Rh=$h=+a,qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Nf.axis.max(a.max),"undefined"!=typeof a.min&&Nf.axis.min(a.min))},Nf.legend.show=function(a){Ff(Hc(a)),qf({withLegend:!0})},Nf.legend.hide=function(a){Gf(Hc(a)),qf({withLegend:!0})},Nf.resize=function(a){Qf=a?a.width:null,Rf=a?a.height:null,wf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Nf.destroy=function(){Nf.data.targets=void 0,Nf.data.xs={},Gj.html(""),a.onresize=null},"url"in f.data)Mf.xhr(f.data.url,function(a,b){var c,d=Mf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Mf.csv.parse(b.response),hf(c)});else if("rows"in f.data)hf(xc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");hf(yc(f.data.columns))}return Nf},"function"==typeof define&&define.amd?define("c3",["d3"],f):"undefined"!=typeof exports&&"undefined"!=typeof module?module.exports=f:a.c3=f}(window); \ No newline at end of file From f56929968048b5d0d0c99d7cfc257e8e42087434 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 14 May 2014 12:22:02 +0900 Subject: [PATCH 173/178] Release 0.1.40 --- bower.json | 2 +- c3.js | 2 +- c3.min.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bower.json b/bower.json index 0f80bb4..75c466c 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "c3", "main": "c3.min.js", - "version": "0.1.38", + "version": "0.1.40", "homepage": "https://github.com/masayuki0812/c3", "authors": [ "Masayuki Tanaka " diff --git a/c3.js b/c3.js index 1e798b5..2bbdaa1 100644 --- a/c3.js +++ b/c3.js @@ -4,7 +4,7 @@ /*global define, module, exports, require */ var c3 = { - version: "0.1.38" + version: "0.1.40" }; var CLASS = { diff --git a/c3.min.js b/c3.min.js index 4382f50..8b831b7 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.round(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.round(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&a=0;return"url("+(c?"":document.URL.split("#")[0])+"#"+b+")"}function k(a){return Math.ceil(a)+.5}function l(a,b){var c,d,e;b&&b.axisX?c=b.axisX:(c=Cj.select("."+g.axisX),a&&(c=c.transition())),b&&b.axisY?d=b.axisY:(d=Cj.select("."+g.axisY),a&&(d=d.transition())),b&&b.axisY2?e=b.axisY2:(e=Cj.select("."+g.axisY2),a&&(e=e.transition())),Cj.attr("transform",mj.main),c.attr("transform",mj.x),d.attr("transform",mj.y),e.attr("transform",mj.y2),Cj.select("."+g.chartArcs).attr("transform",mj.arc)}function m(a,b){var c;b&&b.axisSubX?c=b.axisSubX:(c=Dj.select("."+g.axisX),a&&(c=c.transition())),Dj.attr("transform",mj.context),c.attr("transform",mj.subx)}function n(a){(a?Ej.transition():Ej).attr("transform",mj.legend)}function o(a,b){l(a,b),nh&&m(a,b),n(a)}function p(){var a=U(),b=T(),c=nj?0:a,d=le(Nf.data.targets),e=wh||d?0:A("x"),f=nh&&!d?oh+e:0;kg=t(),lg=u(),wh?(dg={top:A("y2")+v(),right:d?0:y(),bottom:A("y")+c+w(),left:f+(d?0:x())},eg={top:dg.top,right:0/0,bottom:20+c,left:sj}):(dg={top:4+v(),right:d?0:y(),bottom:e+f+c+w(),left:d?0:x()},eg={top:lg-f-c,right:0/0,bottom:e+c,left:dg.left}),fg={top:nj?0:lg-a,right:0/0,bottom:0,left:nj?kg-b:0},gg=kg-dg.left-dg.right,ig=lg-dg.top-dg.bottom,0>gg&&(gg=0),0>ig&&(ig=0),hg=wh?dg.left-sj-tj:gg,jg=wh?ig:lg-eg.top-eg.bottom,0>hg&&(hg=0),0>jg&&(jg=0),pg=gg-(nj?b+10:0),qg=ig-(nj?0:10),r(),nj&&d&&(fg.left=pg/2+1.1*ng)}function q(){Cj.select("line."+g.xgridFocus).attr("x1",wh?0:-10).attr("x2",wh?gg:-10).attr("y1",wh?-10:dg.top).attr("y2",wh?-10:ig)}function r(){ng=Math.min(pg,qg)/2,mg=.95*ng,og=ke(Nf.data.targets)?.6*mg:0}function s(){var a=wh?g.axisX:g.axisY,b=Cj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Gj.node().getBoundingClientRect(),e=le(Nf.data.targets),f=c.right-d.left-(e?0:x());return f>0?f:0}function t(){return Qf?Qf:B()}function u(){var a=Rf?Rf:C();return a>0?a:320}function v(){return Uf?Uf:0}function w(){return Vf?Vf:0}function x(){return Sf?Sf:wh?xh?Ke(z("x")):1:!Ph||Uh?1:Ke(z("y"))}function y(){var a=10,b=nj?T()+20:0;return Tf?Tf:wh?a+b:(!Yh||bi?a:Ke(z("y2")))+b}function z(a){var b=ob(a);return b.isInner?20+Hb(a):40+Hb(a)}function A(a){return"x"!==a||xh?"x"===a&&Mh?Mh:"y"!==a||Ph?"y2"!==a||Yh?(ob(a).isInner?30:40)+("y2"===a?-10:0):uj:qh&&!nj?10:1:0}function B(){return+Gj.style("width").replace("px","")}function C(){return+Gj.style("height").replace("px","")}function D(a){return a?-31:-(dg.left-1)}function E(a){return a?-20:-4}function F(){return D(!wh)}function G(){return E(!wh)}function H(){return D(wh)}function I(){return E(wh)}function J(a){return a?gg+2+30+30:dg.left+20}function K(a){return a?(Mh?Mh:0)+80:ig+8}function L(){return J(!wh)}function M(){return K(!wh)}function N(){return J(wh)}function O(){return K(wh)}function P(){var a,b,c,d,e,f=Ec(Nf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=Dg(b.x)-Dg(a.x),0===c?wh?ig:gg:(d=Dc(),e=he(Nf.data.targets)?(d-(Wi?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function Q(a){oj=a}function R(a){pj=a}function S(a){qj=a}function T(){return qh?nj?pj*(oj+1):kg:0}function U(){return qh?nj?lg:qj*(oj+1):0}function V(){var a,b,c=!Dg;vg=wh?1:0,wg=wh?ig:gg,xg=wh?0:ig,yg=wh?gg:1,zg=vg,Ag=wg,Bg=wh?0:jg,Cg=wh?hg:1,Dg=Y(vg,wg,c?void 0:Dg.domain(),function(){return Jg.tickOffset()}),Eg=Z(xg,yg,c?void 0:Eg.domain()),Fg=Z(xg,yg,c?void 0:Fg.domain()),Gg=Y(vg,wg,Hj,function(a){return a%1?0:Mg.tickOffset()}),Hg=Z(Bg,Cg,c?void 0:Hg.domain()),Ig=Z(Bg,Cg,c?void 0:Ig.domain()),a=db(),b=Hh?Hh:c?void 0:Jg.tickValues(),Jg=ab(Dg,ij,a,b),Mg=ab(Gg,lj,a,b),Kg=bb(Eg,jj,Vh,Xh),Lg=bb(Fg,kj,ci,ei),c||(vj.scale(Gg),Wf&&zj.scale(Dg)),W()}function W(){rg=Kb(),sg=Lb(),tg=Lb(.98)}function X(a,b,c){return(c?Mf.time.scale():Mf.scale.linear()).range([a,b])}function Y(a,b,c,d){var e,f=X(a,b,Vi),g=c?f.domain(c):f;Wi?(d=d||function(){return 0},f=function(a,b){var c=g(a)+d(a);return b?c:Math.ceil(c)}):f=function(a,b){var c=g(a);return b?c:Math.ceil(c)};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return Hj&&Hj[0]===a[0]&&Hj[1]a?a.toFixed(0):a};return Ch&&("function"==typeof Ch?a=Ch:Vi&&(a=function(a){return a?dj(Ch)(a):""})),a}function eb(a){var b;return"y"===a?b=Th:"y2"===a?b=ai:"x"===a&&(b=Oh),b}function fb(a){var b=eb(a);return"string"==typeof b?b:b?b.text:null}function gb(a,b){var c=eb(a);"string"==typeof c?"y"===a?Th=b:"y2"===a?ai=b:"x"===a&&(Oh=b):c&&(c.text=b)}function hb(a){return 10*Math.sin(Math.PI*(a/180))}function ib(a){return 11.5-2.5*(a/15)}function jb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",ib(c)).attr("x",hb(c)).attr("transform","rotate("+c+")")}function kb(a,b){var c=eb(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 lb(){return kb("x",wh?"inner-top":"inner-right")}function mb(){return kb("y",wh?"inner-right":"inner-top")}function nb(){return kb("y2",wh?"inner-right":"inner-top")}function ob(a){return"y2"===a?nb():"y"===a?mb():lb()}function pb(){return fb("x")}function qb(){return fb("y")}function rb(){return fb("y2")}function sb(a,b){return a?b.isLeft?0:b.isCenter?gg/2:gg:b.isBottom?-ig:b.isMiddle?-ig/2:0}function tb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function ub(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function vb(){return sb(!wh,lb())}function wb(){return sb(wh,mb())}function xb(){return sb(wh,nb())}function yb(){return tb(!wh,lb())}function zb(){return tb(wh,mb())}function Ab(){return tb(wh,nb())}function Bb(){var a=lb();return wh?a.isInner?"1.2em":-25-Hb("x"):a.isInner?"-0.5em":Mh?Mh-10:"3em"}function Cb(){var a=mb();return wh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Hb("y")}function Db(){var a=nb();return wh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Hb("y2")}function Eb(){return ub(!wh,lb())}function Fb(){return ub(wh,mb())}function Gb(){return ub(wh,nb())}function Hb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Ib(a){var b=Cj.select("."+g.axisX+" ."+g.axisXLabel),c=Cj.select("."+g.axisY+" ."+g.axisYLabel),d=Cj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",vb).attr("dx",yb).attr("dy",Bb).text(pb),(a?c.transition():c).attr("x",wb).attr("dx",zb).attr("dy",Cb).attr("dy",Cb).text(qb),(a?d.transition():d).attr("x",xb).attr("dx",Ab).attr("dy",Db).text(rb)}function Jb(a){var b=!1;return ug(Lc(Nf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Kb(){var a=Mf.svg.arc().outerRadius(mg).innerRadius(og),b=function(b,c){var d;return c?a(b):(d=Jb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Lb(a){var b=Mf.svg.arc().outerRadius(ng*(a?a:1)).innerRadius(og);return function(a){var c=Jb(a);return c?b(c):"M 0 0"}}function Mb(a,b){return se(a.data)?rg(a,b):"M 0 0"}function Nb(a){var b,c,d,e,f=Jb(a),g="";return f&&(b=rg.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*mg*.8+","+d/e*mg*.8+")"),g}function Ob(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Pb(a){return tc({id:a.data.id,value:a.value,ratio:Ob(a)})}function Qb(a){var b,c,d,e;return Tb()?(b=Jb(a),c=b?b.value:null,d=Ob(b),e=Ub(),e?e(c,d):Gd(c,d)):""}function Rb(a,b){var c=Aj.selectAll("."+g.chartArc+sd(a)),d=Aj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});ye(a)&&c.selectAll("path").transition().duration(50).attr("d",sg).transition().duration(100).attr("d",tg).each(function(a){re(a.data)}),b||d.style("opacity",.3)}function Sb(a){var b=Aj.selectAll("."+g.chartArc+sd(a));b.selectAll("path").transition().duration(50).attr("d",rg),Aj.selectAll("."+g.arc).style("opacity",1)}function Tb(){return ke(Nf.data.targets)?Ai:ui}function Ub(){return ke(Nf.data.targets)?Bi:vi}function Vb(){return ke(Nf.data.targets)?Di:""}function Wb(){var a=ke(Nf.data.targets)?Ei:xi;return"function"==typeof a?a:function(){}}function Xb(){var a=ke(Nf.data.targets)?Fi:yi;return"function"==typeof a?a:function(){}}function Yb(){var a=ke(Nf.data.targets)?Gi:zi;return"function"==typeof a?a:function(){}}function Zb(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Tg.length>0)for(g=Uc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return Mf.min(Object.keys(i).map(function(a){return Mf.min(i[a])}))}function $b(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Tg.length>0)for(g=Vc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return Mf.max(Object.keys(i).map(function(a){return Mf.max(i[a])}))}function _b(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return cb(a.id)===c}),m="y2"===c?$h:Rh,n="y2"===c?Zh:Qh,o=b(m)?m:Zb(l),p=b(n)?n:$b(l),q="y2"===c?_h:Sh,r=Ad()&&wh;return 0===l.length?"y2"===c?Fg.domain():Eg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=Bd(o,p),j=ec(Eg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Wh&&(f=b(Wh.top)?Wh.top:e,g=b(Wh.bottom)?Wh.bottom:e),"y2"===c&&di&&(f=b(di.top)?di.top:e,g=b(di.bottom)?di.bottom:e),he(l)&&!Uc(l)&&(g=o),[o-g,p+f])}function ac(a){return Kh?Vi?Ae(Kh):Kh:Mf.min(a,function(a){return Mf.min(a.values,function(a){return a.x})})}function bc(a){return Jh?Vi?Ae(Jh):Jh:Mf.max(a,function(a){return Mf.max(a.values,function(a){return a.x})})}function cc(a){var c,d,e,f,g=Fc(a),h=g[1]-g[0];return Wi?d=0:he(a)?(c=Dc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Lh&&Fe(Lh)?(e=b(Lh.left)?Lh.left:d,f=b(Lh.right)?Lh.right:d):e=f="number"==typeof Lh?Lh:d,{left:e,right:f}}function dc(a){var b=[ac(a),bc(a)],c=b[0],d=b[1],e=cc(a),f=0,g=0;return c-d!==0||Wi||(c=Vi?new Date(.5*c.getTime()):-.5,d=Vi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ec(a){return a[1]-a[0]}function fc(a){for(var b=0;bb?0:b-c}function lc(a){var b,c=jc(a),d="y"===a.axis?Eg:Fg;return b="y"===a.axis||"y2"===a.axis?wh?ig:"start"in a?d(a.start):ig:wh?"end"in a?Dg(Vi?Ae(a.end):a.end):ig:ig,c>b?0:b-c}function mc(a){return Ng&&a===Ng||Fe(Og)&&Ge(Og,a)}function nc(a){return!mc(a)}function oc(a){return Ng?Ng:Fe(Og)?Og[a]:null}function pc(a,b){var c,d=b&&Fe(b)?Gc(b):[];return d.forEach(function(b){oc(b)===a&&(c=Nf.data.xs[b])}),c}function qc(a,b){return a in Nf.data.xs&&Nf.data.xs[a]&&Nf.data.xs[a][b]?Nf.data.xs[a][b]:b}function rc(a){Object.keys(a).forEach(function(b){Og[b]=a[b]})}function sc(a){return 1===Mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function tc(a){var b;return a&&(b=Rg[a.id],a.name=b?b:a.id),a}function uc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=wc(b[d],a.id,d)}),Nf.data.xs[a.id]=b})}function vc(a,b){a.forEach(function(a){b[a.id]&&uc([a],b[a.id])})}function wc(a,c,d){var e;return e=Vi?a?a instanceof Date?a:Ae(a):Ae(qc(c,d)):Xi&&!Wi?b(a)?+a:qc(c,d):d}function xc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Ng?(d=Object.keys(Nf.data.xs),Nf.data.xs[c]=d.length>0?Nf.data.xs[d[0]]:void 0):Fe(Og)&&(Nf.data.xs[c]=pc(f,Nf.data.targets)):Nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Qg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=oc(b),g=a[f],h=wc(g,b,e);return Xi&&Wi&&0===c&&g&&(0===e&&(Ah=[]),Ah.push(g)),("undefined"==typeof a[b]||Nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Vg&&fe(Gc(c).filter(function(a){return!(a in Wg)}),Vg),c.forEach(function(a){gc(a.id_org,a)}),c}function Ac(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 Bc(a){return a>0&&Nf.data.targets[0].values[a-1]?Nf.data.targets[0].values[a-1].x:void 0}function Cc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Fc(a){var b,c,d=Ec(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Gc(a){return a.map(function(a){return a.id})}function Hc(a){return a?"string"==typeof a?[a]:a:Gc(Nf.data.targets)}function Ic(a,b){var c,d=Gc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Vi?new Date(i):i);j.push(e)}return Vi||(j=j.sort(function(a,b){return a-b})),j}function Oc(a){fj=fj.concat(a)}function Pc(a){fj=fj.filter(function(b){return a.indexOf(b)<0})}function Qc(a){gj=gj.concat(a)}function Rc(a){gj=gj.filter(function(b){return a.indexOf(b)<0})}function Sc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Tc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Vc(a){return Tc(a,function(a){return a>0})}function Wc(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||0===a[f].x)&&(e=e.concat(Md(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Md(a,g))),Pd(e,b)):Nd(a,b,f,g)}function Od(a,b){var c;return c=a.map(function(a){return Nd(a.values,b)}),Pd(c,b)}function Pd(a,b){var c,d;return a.forEach(function(a){var e=He(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Qd(a,b){return Mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Rd(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 Sd(){return Yg&&"desc"===Yg.toLowerCase()}function Td(){return Yg&&"asc"===Yg.toLowerCase()}function Ud(a){var b=Td(),c=Sd();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 Yg&&a.sort(Yg),a}function Vd(a,c){var d,e,f,g,h,i,j,k=le(Nf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&Ii&&(Fj.html(Li(a,db(),Cd(k),cj)).style("display","block"),d=Fj.property("offsetWidth"),e=Fj.property("offsetHeight"),k?(g=gg/2+c[0],i=ig/2+c[1]+20):(wh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-y(),i=Dg(l[0].x)+20):(f=s(),g=f+x()+Dg(l[0].x)+20,h=g+d,j=f+t()-y(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),Fj.style("top",i+"px").style("left",g+"px"))}function Wd(){Fj.style("display","none")}function Xd(a){var c=a.filter(function(a){return a&&b(a.value)});if(Ii&&!ie(Nf.data.targets)&&!le(Nf.data.targets)){var d=Cj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(wh?"y1":"x1",Id).attr(wh?"y2":"x2",Id),pf(d,"grid")}}function Yd(){Cj.select("line."+g.xgridFocus).style("visibility","hidden")}function Zd(a,b){var c,d,e,f,h=[],i=Cj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=dc(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function $d(a){return a.x||0===a.x?Dg(a.x):null}function _d(a){return $(a.id)(a.value)}function ae(){var a,b,d={},e=0;return Lc(Nf.data.targets.filter(oe)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ee(a,b){return"number"==typeof si?si:b?2*a.tickOffset()*ti/b:0}function fe(a,b){Hc(a).forEach(function(a){Jj[a]=b===Wg[a],Wg[a]=b})}function ge(a,b){var c=!1;return a.forEach(function(a){Wg[a.id]===b&&(c=!0),a.id in Wg||"line"!==b||(c=!0)}),c}function he(a){return ge(a,"bar")}function ie(a){return ge(a,"scatter")}function je(a){return ge(a,"pie")}function ke(a){return ge(a,"donut")}function le(a){return je(a)||ke(a)}function me(a){var b="string"==typeof a?a:a.id;return!(b in Wg)||"line"===Wg[b]||"spline"===Wg[b]||"area"===Wg[b]||"area-spline"===Wg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"spline"===Wg[b]||"area-spline"===Wg[b]}function oe(a){var b="string"==typeof a?a:a.id;return"bar"===Wg[b]}function pe(a){var b="string"==typeof a?a:a.id;return"scatter"===Wg[b]}function qe(a){var b="string"==typeof a?a:a.id;return"pie"===Wg[b]}function re(a){var b="string"==typeof a?a:a.id;return"donut"===Wg[b]}function se(a){return qe(a)||re(a)}function te(a){return me(a)?[a]:[]}function ue(a){return se(a.data)?[a]:[]}function ve(a){return oe(a)?a.values:[]}function we(a){return me(a)||pe(a)?a.values:[]}function xe(a){return oe(a)||me(a)?a.values:[]}function ye(a){return re(a)&&Ci||qe(a)&&wi}function ze(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function Ae(b){var c;try{c=Pg?Mf.time.format(Pg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Pg)}return c}function Be(a,b){var c=Mf.mouse(a),d=Mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ge(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function He(a,b){var c="y"===cb(a.id)?Eg:Fg,d=wh?1:0,e=wh?0:1;return Math.pow(Dg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ie(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Je(a,b,c){return d(a[b])?a[b]:c}function Ke(a){return 10*Math.ceil(a/10)}function Le(a,b,c){jh(b,a.node()),Cj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Xc(g.selectedCircle,c)}).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d).attr("stroke",function(){return cj(b)}).attr("r",1.4*We(b)).transition().duration(100).attr("r",We)}function Me(a,b,c){kh(b,a.node()),Cj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ne(a,b,c,d){a?Le(b,c,d):Me(b,c,d)}function Oe(a,b){jh(b,a.node()),a.transition().duration(100).style("fill",function(){return Mf.rgb(cj(b)).brighter(.75)})}function Pe(a,b){kh(b,a.node()),a.transition().duration(100).style("fill",function(){return cj(b)})}function Qe(a,b,c,d){a?Oe(b,c,d):Pe(b,c,d)}function Re(a,b,c,d){Qe(a,b,c.data,d)}function Se(a){return"circle"===a.nodeName?Ne:Mf.select(a).classed(g.bar)?Qe:Re}function Te(a){return a.filter(function(a){return b(a.value)})}function Ue(a){return li?"function"==typeof mi?mi(a):mi:0}function Ve(a){return oi?pi?pi:1.75*Ue(a):Ue(a)}function We(a){return qi?qi:4*Ue(a)}function Xe(a,c){return(c?Cj.selectAll("."+g.circles+rd(c)):Cj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ye(a,b){Xe(a,b).classed(g.EXPANDED,!0).attr("r",Ve)}function Ze(a){Xe(a).filter(function(){return Mf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Ue)}function $e(a){return Cj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function _e(a){$e(a).classed(g.EXPANDED,!0)}function af(a){$e(a).classed(g.EXPANDED,!1)}function bf(a,b){var c=ff(a,b);return function(a,b){var d=c(a,b),e=wh?1:0,f=wh?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 cf(a,b){var c=ff(a,!1),d=b?df:ef;return function(a,b){return d(c(a,b),a,this)}}function df(a,b){var c;return wh?(c=oe(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function ef(a,b,c){var d=c.getBoundingClientRect();return wh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:oe(b)?-3:-6)}function ff(a,b){var c=a.__max__+1,d=ee(Jg,c),e=be(d,c,a,!!b),f=ce(!!b),g=de(a,!!b),h=b?_:$;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return wh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function gf(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;gb?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&a=0;return"url("+(c?"":document.URL.split("#")[0])+"#"+b+")"}function k(a){return Math.ceil(a)+.5}function l(a,b){var c,d,e;b&&b.axisX?c=b.axisX:(c=Cj.select("."+g.axisX),a&&(c=c.transition())),b&&b.axisY?d=b.axisY:(d=Cj.select("."+g.axisY),a&&(d=d.transition())),b&&b.axisY2?e=b.axisY2:(e=Cj.select("."+g.axisY2),a&&(e=e.transition())),Cj.attr("transform",mj.main),c.attr("transform",mj.x),d.attr("transform",mj.y),e.attr("transform",mj.y2),Cj.select("."+g.chartArcs).attr("transform",mj.arc)}function m(a,b){var c;b&&b.axisSubX?c=b.axisSubX:(c=Dj.select("."+g.axisX),a&&(c=c.transition())),Dj.attr("transform",mj.context),c.attr("transform",mj.subx)}function n(a){(a?Ej.transition():Ej).attr("transform",mj.legend)}function o(a,b){l(a,b),nh&&m(a,b),n(a)}function p(){var a=U(),b=T(),c=nj?0:a,d=le(Nf.data.targets),e=wh||d?0:A("x"),f=nh&&!d?oh+e:0;kg=t(),lg=u(),wh?(dg={top:A("y2")+v(),right:d?0:y(),bottom:A("y")+c+w(),left:f+(d?0:x())},eg={top:dg.top,right:0/0,bottom:20+c,left:sj}):(dg={top:4+v(),right:d?0:y(),bottom:e+f+c+w(),left:d?0:x()},eg={top:lg-f-c,right:0/0,bottom:e+c,left:dg.left}),fg={top:nj?0:lg-a,right:0/0,bottom:0,left:nj?kg-b:0},gg=kg-dg.left-dg.right,ig=lg-dg.top-dg.bottom,0>gg&&(gg=0),0>ig&&(ig=0),hg=wh?dg.left-sj-tj:gg,jg=wh?ig:lg-eg.top-eg.bottom,0>hg&&(hg=0),0>jg&&(jg=0),pg=gg-(nj?b+10:0),qg=ig-(nj?0:10),r(),nj&&d&&(fg.left=pg/2+1.1*ng)}function q(){Cj.select("line."+g.xgridFocus).attr("x1",wh?0:-10).attr("x2",wh?gg:-10).attr("y1",wh?-10:dg.top).attr("y2",wh?-10:ig)}function r(){ng=Math.min(pg,qg)/2,mg=.95*ng,og=ke(Nf.data.targets)?.6*mg:0}function s(){var a=wh?g.axisX:g.axisY,b=Cj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Gj.node().getBoundingClientRect(),e=le(Nf.data.targets),f=c.right-d.left-(e?0:x());return f>0?f:0}function t(){return Qf?Qf:B()}function u(){var a=Rf?Rf:C();return a>0?a:320}function v(){return Uf?Uf:0}function w(){return Vf?Vf:0}function x(){return Sf?Sf:wh?xh?Ke(z("x")):1:!Ph||Uh?1:Ke(z("y"))}function y(){var a=10,b=nj?T()+20:0;return Tf?Tf:wh?a+b:(!Yh||bi?a:Ke(z("y2")))+b}function z(a){var b=ob(a);return b.isInner?20+Hb(a):40+Hb(a)}function A(a){return"x"!==a||xh?"x"===a&&Mh?Mh:"y"!==a||Ph?"y2"!==a||Yh?(ob(a).isInner?30:40)+("y2"===a?-10:0):uj:qh&&!nj?10:1:0}function B(){return+Gj.style("width").replace("px","")}function C(){return+Gj.style("height").replace("px","")}function D(a){return a?-31:-(dg.left-1)}function E(a){return a?-20:-4}function F(){return D(!wh)}function G(){return E(!wh)}function H(){return D(wh)}function I(){return E(wh)}function J(a){return a?gg+2+30+30:dg.left+20}function K(a){return a?(Mh?Mh:0)+80:ig+8}function L(){return J(!wh)}function M(){return K(!wh)}function N(){return J(wh)}function O(){return K(wh)}function P(){var a,b,c,d,e,f=Ec(Nf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=Dg(b.x)-Dg(a.x),0===c?wh?ig:gg:(d=Dc(),e=he(Nf.data.targets)?(d-(Wi?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function Q(a){oj=a}function R(a){pj=a}function S(a){qj=a}function T(){return qh?nj?pj*(oj+1):kg:0}function U(){return qh?nj?lg:qj*(oj+1):0}function V(){var a,b,c=!Dg;vg=wh?1:0,wg=wh?ig:gg,xg=wh?0:ig,yg=wh?gg:1,zg=vg,Ag=wg,Bg=wh?0:jg,Cg=wh?hg:1,Dg=Y(vg,wg,c?void 0:Dg.domain(),function(){return Jg.tickOffset()}),Eg=Z(xg,yg,c?void 0:Eg.domain()),Fg=Z(xg,yg,c?void 0:Fg.domain()),Gg=Y(vg,wg,Hj,function(a){return a%1?0:Mg.tickOffset()}),Hg=Z(Bg,Cg,c?void 0:Hg.domain()),Ig=Z(Bg,Cg,c?void 0:Ig.domain()),a=db(),b=Hh?Hh:c?void 0:Jg.tickValues(),Jg=ab(Dg,ij,a,b),Mg=ab(Gg,lj,a,b),Kg=bb(Eg,jj,Vh,Xh),Lg=bb(Fg,kj,ci,ei),c||(vj.scale(Gg),Wf&&zj.scale(Dg)),W()}function W(){rg=Kb(),sg=Lb(),tg=Lb(.98)}function X(a,b,c){return(c?Mf.time.scale():Mf.scale.linear()).range([a,b])}function Y(a,b,c,d){var e,f=X(a,b,Vi),g=c?f.domain(c):f;Wi?(d=d||function(){return 0},f=function(a,b){var c=g(a)+d(a);return b?c:Math.ceil(c)}):f=function(a,b){var c=g(a);return b?c:Math.ceil(c)};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return Hj&&Hj[0]===a[0]&&Hj[1]a?a.toFixed(0):a};return Ch&&("function"==typeof Ch?a=Ch:Vi&&(a=function(a){return a?dj(Ch)(a):""})),a}function eb(a){var b;return"y"===a?b=Th:"y2"===a?b=ai:"x"===a&&(b=Oh),b}function fb(a){var b=eb(a);return"string"==typeof b?b:b?b.text:null}function gb(a,b){var c=eb(a);"string"==typeof c?"y"===a?Th=b:"y2"===a?ai=b:"x"===a&&(Oh=b):c&&(c.text=b)}function hb(a){return 10*Math.sin(Math.PI*(a/180))}function ib(a){return 11.5-2.5*(a/15)}function jb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",ib(c)).attr("x",hb(c)).attr("transform","rotate("+c+")")}function kb(a,b){var c=eb(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 lb(){return kb("x",wh?"inner-top":"inner-right")}function mb(){return kb("y",wh?"inner-right":"inner-top")}function nb(){return kb("y2",wh?"inner-right":"inner-top")}function ob(a){return"y2"===a?nb():"y"===a?mb():lb()}function pb(){return fb("x")}function qb(){return fb("y")}function rb(){return fb("y2")}function sb(a,b){return a?b.isLeft?0:b.isCenter?gg/2:gg:b.isBottom?-ig:b.isMiddle?-ig/2:0}function tb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function ub(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function vb(){return sb(!wh,lb())}function wb(){return sb(wh,mb())}function xb(){return sb(wh,nb())}function yb(){return tb(!wh,lb())}function zb(){return tb(wh,mb())}function Ab(){return tb(wh,nb())}function Bb(){var a=lb();return wh?a.isInner?"1.2em":-25-Hb("x"):a.isInner?"-0.5em":Mh?Mh-10:"3em"}function Cb(){var a=mb();return wh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Hb("y")}function Db(){var a=nb();return wh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Hb("y2")}function Eb(){return ub(!wh,lb())}function Fb(){return ub(wh,mb())}function Gb(){return ub(wh,nb())}function Hb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Ib(a){var b=Cj.select("."+g.axisX+" ."+g.axisXLabel),c=Cj.select("."+g.axisY+" ."+g.axisYLabel),d=Cj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",vb).attr("dx",yb).attr("dy",Bb).text(pb),(a?c.transition():c).attr("x",wb).attr("dx",zb).attr("dy",Cb).attr("dy",Cb).text(qb),(a?d.transition():d).attr("x",xb).attr("dx",Ab).attr("dy",Db).text(rb)}function Jb(a){var b=!1;return ug(Lc(Nf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Kb(){var a=Mf.svg.arc().outerRadius(mg).innerRadius(og),b=function(b,c){var d;return c?a(b):(d=Jb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Lb(a){var b=Mf.svg.arc().outerRadius(ng*(a?a:1)).innerRadius(og);return function(a){var c=Jb(a);return c?b(c):"M 0 0"}}function Mb(a,b){return se(a.data)?rg(a,b):"M 0 0"}function Nb(a){var b,c,d,e,f=Jb(a),g="";return f&&(b=rg.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*mg*.8+","+d/e*mg*.8+")"),g}function Ob(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Pb(a){return tc({id:a.data.id,value:a.value,ratio:Ob(a)})}function Qb(a){var b,c,d,e;return Tb()?(b=Jb(a),c=b?b.value:null,d=Ob(b),e=Ub(),e?e(c,d):Gd(c,d)):""}function Rb(a,b){var c=Aj.selectAll("."+g.chartArc+sd(a)),d=Aj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});ye(a)&&c.selectAll("path").transition().duration(50).attr("d",sg).transition().duration(100).attr("d",tg).each(function(a){re(a.data)}),b||d.style("opacity",.3)}function Sb(a){var b=Aj.selectAll("."+g.chartArc+sd(a));b.selectAll("path").transition().duration(50).attr("d",rg),Aj.selectAll("."+g.arc).style("opacity",1)}function Tb(){return ke(Nf.data.targets)?Ai:ui}function Ub(){return ke(Nf.data.targets)?Bi:vi}function Vb(){return ke(Nf.data.targets)?Di:""}function Wb(){var a=ke(Nf.data.targets)?Ei:xi;return"function"==typeof a?a:function(){}}function Xb(){var a=ke(Nf.data.targets)?Fi:yi;return"function"==typeof a?a:function(){}}function Yb(){var a=ke(Nf.data.targets)?Gi:zi;return"function"==typeof a?a:function(){}}function Zb(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Tg.length>0)for(g=Uc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return Mf.min(Object.keys(i).map(function(a){return Mf.min(i[a])}))}function $b(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Tg.length>0)for(g=Vc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return Mf.max(Object.keys(i).map(function(a){return Mf.max(i[a])}))}function _b(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return cb(a.id)===c}),m="y2"===c?$h:Rh,n="y2"===c?Zh:Qh,o=b(m)?m:Zb(l),p=b(n)?n:$b(l),q="y2"===c?_h:Sh,r=Ad()&&wh;return 0===l.length?"y2"===c?Fg.domain():Eg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=Bd(o,p),j=ec(Eg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Wh&&(f=b(Wh.top)?Wh.top:e,g=b(Wh.bottom)?Wh.bottom:e),"y2"===c&&di&&(f=b(di.top)?di.top:e,g=b(di.bottom)?di.bottom:e),he(l)&&!Uc(l)&&(g=o),[o-g,p+f])}function ac(a){return Kh?Vi?Ae(Kh):Kh:Mf.min(a,function(a){return Mf.min(a.values,function(a){return a.x})})}function bc(a){return Jh?Vi?Ae(Jh):Jh:Mf.max(a,function(a){return Mf.max(a.values,function(a){return a.x})})}function cc(a){var c,d,e,f,g=Fc(a),h=g[1]-g[0];return Wi?d=0:he(a)?(c=Dc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Lh&&Fe(Lh)?(e=b(Lh.left)?Lh.left:d,f=b(Lh.right)?Lh.right:d):e=f="number"==typeof Lh?Lh:d,{left:e,right:f}}function dc(a){var b=[ac(a),bc(a)],c=b[0],d=b[1],e=cc(a),f=0,g=0;return c-d!==0||Wi||(c=Vi?new Date(.5*c.getTime()):-.5,d=Vi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ec(a){return a[1]-a[0]}function fc(a){for(var b=0;bb?0:b-c}function lc(a){var b,c=jc(a),d="y"===a.axis?Eg:Fg;return b="y"===a.axis||"y2"===a.axis?wh?ig:"start"in a?d(a.start):ig:wh?"end"in a?Dg(Vi?Ae(a.end):a.end):ig:ig,c>b?0:b-c}function mc(a){return Ng&&a===Ng||Fe(Og)&&Ge(Og,a)}function nc(a){return!mc(a)}function oc(a){return Ng?Ng:Fe(Og)?Og[a]:null}function pc(a,b){var c,d=b&&Fe(b)?Gc(b):[];return d.forEach(function(b){oc(b)===a&&(c=Nf.data.xs[b])}),c}function qc(a,b){return a in Nf.data.xs&&Nf.data.xs[a]&&Nf.data.xs[a][b]?Nf.data.xs[a][b]:b}function rc(a){Object.keys(a).forEach(function(b){Og[b]=a[b]})}function sc(a){return 1===Mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function tc(a){var b;return a&&(b=Rg[a.id],a.name=b?b:a.id),a}function uc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=wc(b[d],a.id,d)}),Nf.data.xs[a.id]=b})}function vc(a,b){a.forEach(function(a){b[a.id]&&uc([a],b[a.id])})}function wc(a,c,d){var e;return e=Vi?a?a instanceof Date?a:Ae(a):Ae(qc(c,d)):Xi&&!Wi?b(a)?+a:qc(c,d):d}function xc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Ng?(d=Object.keys(Nf.data.xs),Nf.data.xs[c]=d.length>0?Nf.data.xs[d[0]]:void 0):Fe(Og)&&(Nf.data.xs[c]=pc(f,Nf.data.targets)):Nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Qg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=oc(b),g=a[f],h=wc(g,b,e);return Xi&&Wi&&0===c&&g&&(0===e&&(Ah=[]),Ah.push(g)),("undefined"==typeof a[b]||Nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Vg&&fe(Gc(c).filter(function(a){return!(a in Wg)}),Vg),c.forEach(function(a){gc(a.id_org,a)}),c}function Ac(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 Bc(a){return a>0&&Nf.data.targets[0].values[a-1]?Nf.data.targets[0].values[a-1].x:void 0}function Cc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Fc(a){var b,c,d=Ec(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Gc(a){return a.map(function(a){return a.id})}function Hc(a){return a?"string"==typeof a?[a]:a:Gc(Nf.data.targets)}function Ic(a,b){var c,d=Gc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Vi?new Date(i):i);j.push(e)}return Vi||(j=j.sort(function(a,b){return a-b})),j}function Oc(a){fj=fj.concat(a)}function Pc(a){fj=fj.filter(function(b){return a.indexOf(b)<0})}function Qc(a){gj=gj.concat(a)}function Rc(a){gj=gj.filter(function(b){return a.indexOf(b)<0})}function Sc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Tc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Vc(a){return Tc(a,function(a){return a>0})}function Wc(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||0===a[f].x)&&(e=e.concat(Md(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Md(a,g))),Pd(e,b)):Nd(a,b,f,g)}function Od(a,b){var c;return c=a.map(function(a){return Nd(a.values,b)}),Pd(c,b)}function Pd(a,b){var c,d;return a.forEach(function(a){var e=He(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Qd(a,b){return Mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Rd(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 Sd(){return Yg&&"desc"===Yg.toLowerCase()}function Td(){return Yg&&"asc"===Yg.toLowerCase()}function Ud(a){var b=Td(),c=Sd();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 Yg&&a.sort(Yg),a}function Vd(a,c){var d,e,f,g,h,i,j,k=le(Nf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&Ii&&(Fj.html(Li(a,db(),Cd(k),cj)).style("display","block"),d=Fj.property("offsetWidth"),e=Fj.property("offsetHeight"),k?(g=gg/2+c[0],i=ig/2+c[1]+20):(wh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-y(),i=Dg(l[0].x)+20):(f=s(),g=f+x()+Dg(l[0].x)+20,h=g+d,j=f+t()-y(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),Fj.style("top",i+"px").style("left",g+"px"))}function Wd(){Fj.style("display","none")}function Xd(a){var c=a.filter(function(a){return a&&b(a.value)});if(Ii&&!ie(Nf.data.targets)&&!le(Nf.data.targets)){var d=Cj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(wh?"y1":"x1",Id).attr(wh?"y2":"x2",Id),pf(d,"grid")}}function Yd(){Cj.select("line."+g.xgridFocus).style("visibility","hidden")}function Zd(a,b){var c,d,e,f,h=[],i=Cj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=dc(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function $d(a){return a.x||0===a.x?Dg(a.x):null}function _d(a){return $(a.id)(a.value)}function ae(){var a,b,d={},e=0;return Lc(Nf.data.targets.filter(oe)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ee(a,b){return"number"==typeof si?si:b?2*a.tickOffset()*ti/b:0}function fe(a,b){Hc(a).forEach(function(a){Jj[a]=b===Wg[a],Wg[a]=b})}function ge(a,b){var c=!1;return a.forEach(function(a){Wg[a.id]===b&&(c=!0),a.id in Wg||"line"!==b||(c=!0)}),c}function he(a){return ge(a,"bar")}function ie(a){return ge(a,"scatter")}function je(a){return ge(a,"pie")}function ke(a){return ge(a,"donut")}function le(a){return je(a)||ke(a)}function me(a){var b="string"==typeof a?a:a.id;return!(b in Wg)||"line"===Wg[b]||"spline"===Wg[b]||"area"===Wg[b]||"area-spline"===Wg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"spline"===Wg[b]||"area-spline"===Wg[b]}function oe(a){var b="string"==typeof a?a:a.id;return"bar"===Wg[b]}function pe(a){var b="string"==typeof a?a:a.id;return"scatter"===Wg[b]}function qe(a){var b="string"==typeof a?a:a.id;return"pie"===Wg[b]}function re(a){var b="string"==typeof a?a:a.id;return"donut"===Wg[b]}function se(a){return qe(a)||re(a)}function te(a){return me(a)?[a]:[]}function ue(a){return se(a.data)?[a]:[]}function ve(a){return oe(a)?a.values:[]}function we(a){return me(a)||pe(a)?a.values:[]}function xe(a){return oe(a)||me(a)?a.values:[]}function ye(a){return re(a)&&Ci||qe(a)&&wi}function ze(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function Ae(b){var c;try{c=Pg?Mf.time.format(Pg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Pg)}return c}function Be(a,b){var c=Mf.mouse(a),d=Mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ge(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function He(a,b){var c="y"===cb(a.id)?Eg:Fg,d=wh?1:0,e=wh?0:1;return Math.pow(Dg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ie(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Je(a,b,c){return d(a[b])?a[b]:c}function Ke(a){return 10*Math.ceil(a/10)}function Le(a,b,c){jh(b,a.node()),Cj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Xc(g.selectedCircle,c)}).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d).attr("stroke",function(){return cj(b)}).attr("r",1.4*We(b)).transition().duration(100).attr("r",We)}function Me(a,b,c){kh(b,a.node()),Cj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ne(a,b,c,d){a?Le(b,c,d):Me(b,c,d)}function Oe(a,b){jh(b,a.node()),a.transition().duration(100).style("fill",function(){return Mf.rgb(cj(b)).brighter(.75)})}function Pe(a,b){kh(b,a.node()),a.transition().duration(100).style("fill",function(){return cj(b)})}function Qe(a,b,c,d){a?Oe(b,c,d):Pe(b,c,d)}function Re(a,b,c,d){Qe(a,b,c.data,d)}function Se(a){return"circle"===a.nodeName?Ne:Mf.select(a).classed(g.bar)?Qe:Re}function Te(a){return a.filter(function(a){return b(a.value)})}function Ue(a){return li?"function"==typeof mi?mi(a):mi:0}function Ve(a){return oi?pi?pi:1.75*Ue(a):Ue(a)}function We(a){return qi?qi:4*Ue(a)}function Xe(a,c){return(c?Cj.selectAll("."+g.circles+rd(c)):Cj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ye(a,b){Xe(a,b).classed(g.EXPANDED,!0).attr("r",Ve)}function Ze(a){Xe(a).filter(function(){return Mf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Ue)}function $e(a){return Cj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function _e(a){$e(a).classed(g.EXPANDED,!0)}function af(a){$e(a).classed(g.EXPANDED,!1)}function bf(a,b){var c=ff(a,b);return function(a,b){var d=c(a,b),e=wh?1:0,f=wh?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 cf(a,b){var c=ff(a,!1),d=b?df:ef;return function(a,b){return d(c(a,b),a,this)}}function df(a,b){var c;return wh?(c=oe(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function ef(a,b,c){var d=c.getBoundingClientRect();return wh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:oe(b)?-3:-6)}function ff(a,b){var c=a.__max__+1,d=ee(Jg,c),e=be(d,c,a,!!b),f=ce(!!b),g=de(a,!!b),h=b?_:$;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return wh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function gf(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function hf(b){var c,d,e;if(Gj=Mf.select(Pf),Gj.empty())throw new Error("Element to bind not found");if(Gj.html("").classed("c3",!0),Nf.data.xs={},Nf.data.targets=zc(b),bh&&(Nf.data.targets=Nf.data.targets.filter(bh)),ah&&Oc(ah===!0?Gc(Nf.data.targets):ah),p(),V(),Dg.domain(Mf.extent(dc(Nf.data.targets))),Eg.domain(_b(Nf.data.targets,"y")),Fg.domain(_b(Nf.data.targets,"y2")),Gg.domain(Dg.domain()),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Hj=Dg.domain(),vj.scale(Gg),Wf&&zj.scale(Dg),Aj=Gj.append("svg").style("overflow","hidden").on("mouseenter",$f).on("mouseleave",_f),Bj=Aj.append("defs"),Bj.append("clipPath").attr("id",Pi).append("rect"),Bj.append("clipPath").attr("id",Qi).append("rect"),Bj.append("clipPath").attr("id",Ri).append("rect"),uf(),Cj=Aj.append("g").attr("transform",mj.main),Dj=Aj.append("g").attr("transform",mj.context),Ej=Aj.append("g").attr("transform",mj.legend),nh||Dj.style("visibility","hidden"),qh||(Ej.style("visibility","hidden"),gj=Gc(Nf.data.targets)),Fj=Gj.style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Hf(Gc(Nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=Cj.append("g").attr("clip-path",Si).attr("class",g.grid),fi&&d.append("g").attr("class",g.xgrids),Fe(hi)&&d.append("g").attr("class",g.xgridLines),ni&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),ii&&d.append("g").attr("class",g.ygrids),Fe(ji)&&d.append("g").attr("class",g.ygridLines),Cj.append("g").attr("clip-path",Si).attr("class",g.regions),Cj.append("g").attr("clip-path",Si).attr("class",g.chart),c=Cj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Wf?wh?"ns-resize":"ew-resize":null),Cj.select("."+g.chart).append("g").attr("class",g.chartBars),Cj.select("."+g.chart).append("g").attr("class",g.chartLines),Cj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",mj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Vb()),Cj.select("."+g.chart).append("g").attr("class",g.chartTexts),Wf&&Cj.insert("rect",Yf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",gg).attr("height",ig).style("opacity",0).style("cursor",wh?"ns-resize":"ew-resize").call(zj).on("dblclick.zoom",null),Nh&&vj.extent("function"!=typeof Nh?Nh:Nh(dc())),hj.x=Cj.append("g").attr("class",g.axisX).attr("clip-path",Ti).attr("transform",mj.x).style("visibility",xh?"visible":"hidden"),hj.x.append("text").attr("class",g.axisXLabel).attr("transform",wh?"rotate(-90)":"").style("text-anchor",Eb),hj.y=Cj.append("g").attr("class",g.axisY).attr("clip-path",Ui).attr("transform",mj.y).style("visibility",Ph?"visible":"hidden"),hj.y.append("text").attr("class",g.axisYLabel).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Fb),hj.y2=Cj.append("g").attr("class",g.axisY2).attr("transform",mj.y2).style("visibility",Yh?"visible":"hidden"),hj.y2.append("text").attr("class",g.axisY2Label).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Gb),Dj.append("g").attr("clip-path",Si).attr("class",g.chart),Dj.select("."+g.chart).append("g").attr("class",g.chartBars),Dj.select("."+g.chart).append("g").attr("class",g.chartLines),Dj.append("g").attr("clip-path",Si).attr("class",g.brush).call(vj).selectAll("rect").attr(wh?"width":"height",wh?hg:jg),hj.subx=Dj.append("g").attr("class",g.axisX).attr("transform",mj.subx).attr("clip-path",wh?"":Ti),xf(Nf.data.targets),qf({withUpdateTranslate:!0,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Mi){if(Vi&&"string"==typeof Ni){for(Ni=Ae(Ni),e=0;e0){d=[];for(var f in Rg)for(c=0;cf&&h>c&&d>i&&j>d;else{if(!n.classed(g.bar))return;m=Rd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Qe,q=!(c>h||f>c+e||d>j||i>d+k)}q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function nf(a){le(Nf.data.targets)||ch&&(Yi=a,Cj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Zi=!0,lh())}function of(){le(Nf.data.targets)||ch&&(Cj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),Cj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Zi=!1,mh())}function pf(a,b){"grid"===b&&a.each(function(){var a=Mf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function qf(a,c){var d,e,f,h,i,j,k,l,m,n,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,Q,R,S,T,U,W,X,Y,Z,$=ae(),_=le(Nf.data.targets),ab=Lc(Nf.data.targets);if(a=a||{},E=Je(a,"withY",!0),F=Je(a,"withSubchart",!0),G=Je(a,"withTransition",!0),J=Je(a,"withTransform",!1),K=Je(a,"withUpdateXDomain",!1),L=Je(a,"withUpdateOrgXDomain",!1),N=Je(a,"withUpdateTranslate",!1),M=Je(a,"withLegend",!1),H=Je(a,"withTransitionForExit",G),I=Je(a,"withTransitionForAxis",G),T=G?cg:0,U=H?T:0,W=I?T:0,c=c||vf(W),N&&(wh?(hj.x.call(Jg),hj.subx.call(Mg)):(hj.y.call(Kg),hj.y2.call(Lg)),p(),V(),uf(),o(!1)),M&&qh&&Hf(Gc(Nf.data.targets),a,c),Wi&&0===ab.length&&Dg.domain([0,hj.x.selectAll(".tick").size()]),ab.length&&(L&&(Dg.domain(Mf.extent(dc(ab))),Hj=Dg.domain(),Wf&&zj.scale(Dg).updateScaleExtent(),Gg.domain(Dg.domain()),vj.scale(Gg)),K&&(Dg.domain(vj.empty()?Hj:vj.extent()),Wf&&zj.scale(Dg).updateScaleExtent()),Hh||!Gh&&!Fh||(X=Nc(Mc(ab),Fh),Jg.tickValues(X),Mg.tickValues(X))),Eg.domain(_b(ab,"y")),Fg.domain(_b(ab,"y2")),hj.x.style("opacity",_?0:1),hj.y.style("opacity",_?0:1),hj.y2.style("opacity",_?0:1),hj.subx.style("opacity",_?0:1),c.axisX.call(Jg),c.axisY.call(Kg),c.axisY2.call(Lg),c.axisSubX.call(Mg),Ib(G),K&&ab.length)if(Dh&&X){for(Y=1;Y=0&&Mf.select(this).style("display",b%Z?"none":"block")})}else Aj.selectAll("."+g.axisX+" .tick text").style("display","block");!wh&&Ih&&jb(hj.x,c.axisX,Ih),O=bf($),R=cf($,!0),S=cf($,!1),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Fj.style("display","none"),q(),Cj.select("line."+g.xgridFocus).style("visibility","hidden"),fi&&(f=Zd(gi,Dg),B=Wi?Jg.tickOffset():0,e=wh?{x1:0,x2:gg,y1:function(a){return Dg(a)-B},y2:function(a){return Dg(a)-B}}:{x1:function(a){return Dg(a)+B},x2:function(a){return Dg(a)+B},y1:dg.top,y2:ig},d=Cj.select("."+g.xgrids).selectAll("."+g.xgrid).data(f),d.enter().append("line").attr("class",g.xgrid),d.attr(e).style("opacity",function(){return+Mf.select(this).attr(wh?"y1":"x1")===(wh?ig:0)?0:1}),d.exit().remove()),Fe(hi)&&(h=Cj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(hi),i=h.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),i.append("line").style("opacity",0),i.append("text").attr("text-anchor","end").attr("transform",wh?"":"rotate(-90)").attr("dx",wh?0:-dg.top).attr("dy",-5).style("opacity",0),h.select("line").transition().duration(T).attr("x1",wh?0:Jd).attr("x2",wh?gg:Jd).attr("y1",wh?Jd:dg.top).attr("y2",wh?Jd:ig).style("opacity",1),h.select("text").transition().duration(T).attr("x",wh?gg:0).attr("y",Jd).text(function(a){return a.text}).style("opacity",1),h.exit().transition().duration(T).style("opacity",0).remove()),E&&ii&&(j=Cj.select("."+g.ygrids).selectAll("."+g.ygrid).data(Eg.ticks(ki)),j.enter().append("line").attr("class",g.ygrid),j.attr("x1",wh?Eg:0).attr("x2",wh?Eg:gg).attr("y1",wh?0:Eg).attr("y2",wh?ig:Eg),j.exit().remove(),pf(j,"grid")),E&&Fe(ji)&&(k=Cj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(ji),l=k.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",wh?"rotate(-90)":"").attr("dx",wh?0:-dg.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",wh?Kd:0).attr("x2",wh?Kd:gg).attr("y1",wh?0:Kd).attr("y2",wh?ig:Kd).style("opacity",1),k.select("text").transition().duration(T).attr("x",wh?0:gg).attr("y",Kd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),u=Cj.select("."+g.regions).selectAll("."+g.region).data(Hi),u.enter().append("g").attr("class",kd).append("rect").style("fill-opacity",0),u.selectAll("rect").transition().duration(T).attr("x",ic).attr("y",jc).attr("width",kc).attr("height",lc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),u.exit().transition().duration(T).style("opacity",0).remove(),s=Cj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),s.enter().append("path").attr("class",ed).style("stroke","none").style("fill",cj),s.style("opacity",wd).transition().duration(T).attr("d",O).style("fill",cj).style("opacity",1),s.exit().transition().duration(U).style("opacity",0).remove(),m=Cj.selectAll("."+g.lines).selectAll("."+g.line).data(te),m.enter().append("path").attr("class",ad).style("stroke",cj),m.style("opacity",wd).transition().duration(T).attr("d",wj).style("stroke",cj).style("opacity",1),m.exit().transition().duration(U).style("opacity",0).remove(),n=Cj.selectAll("."+g.areas).selectAll("."+g.area).data(te),n.enter().append("path").attr("class",id).style("fill",cj).style("opacity",function(){return Ij=+Mf.select(this).style("opacity"),0}),n.style("opacity",0).transition().duration(T).attr("d",xj).style("fill",cj).style("opacity",Ij),n.exit().transition().duration(U).style("opacity",0).remove(),r=Cj.selectAll("."+g.circles).selectAll("."+g.circle).data(we),r.enter().append("circle").attr("class",cd).attr("r",Ue).style("fill",cj),r.style("opacity",wd).transition().duration(T).style("opacity",yd).style("fill",cj).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d),r.exit().remove(),v=Cj.selectAll("."+g.texts).selectAll("."+g.text).data(xe),v.enter().append("text").attr("class",Yc).attr("text-anchor",function(a){return wh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",cj).style("fill-opacity",0),v.text(function(a){return Hd(a.id)(a.value,a.id)}).style("fill-opacity",xd).transition().duration(T).attr("x",R).attr("y",S).style("fill",cj).style("fill-opacity",zd),v.exit().transition().duration(U).style("fill-opacity",0).remove(),t=Cj.selectAll("."+g.arcs).selectAll("."+g.arc).data(ue),t.enter().append("path").attr("class",gd).style("fill",function(a){return cj(a.data)}).style("cursor",function(a){return eh(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;aj||(c=Jb(a),d=Pb(c),e=Xb(),Rb(c.data.id),Df(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Jb(a),c=Pb(b),d=[c];Vd(d,Mf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;aj||(c=Jb(a),d=Pb(c),e=Yb(),Sb(c.data.id),Ef(),Wd(),e(d,b))}).on("click",function(a,b){var c=Jb(a),d=Pb(c),e=Wb();lf(this,a,b),e(d,b)}),t.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){aj=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Jb(a);return c?(b=Mf.interpolate(this._current,c),this._current=b(0),function(a){return Mb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("fill",function(a){return cj(a.data)}).style("opacity",1).call(Ie,function(){aj=!1}),t.exit().transition().duration(U).style("opacity",0).remove(),Cj.selectAll("."+g.chartArc).select("text").attr("transform",Nb).style("opacity",0).transition().duration(T).text(Qb).style("opacity",function(a){return Jc(a.data.id)&&se(a.data)?1:0}),Cj.select("."+g.chartArcsTitle).style("opacity",ke(Nf.data.targets)?1:0),nh&&(Mf.event&&"zoom"===Mf.event.type&&vj.extent(Dg.orgDomain()).update(),F&&(!wh&&Ih&&jb(hj.subx,c.axisSubX,Ih),vj.empty()||vj.extent(Dg.orgDomain()).update(),Q=bf($,!0),x=Dj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),x.enter().append("path").attr("class",ed).style("stroke","none").style("fill",cj),x.style("opacity",wd).transition().duration(T).attr("d",Q).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove(),w=Dj.selectAll("."+g.lines).selectAll("."+g.line).data(te),w.enter().append("path").attr("class",ad).style("stroke",cj),w.style("opacity",wd).transition().duration(T).attr("d",yj).style("opacity",1),w.exit().transition().duration(T).style("opacity",0).remove())),Cj.selectAll("."+g.selectedCircles).filter(function(a){return oe(a)}).selectAll("circle").remove(),Cj.selectAll("."+g.selectedCircle).transition().duration(T).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d),Zf&&(y=Cj.select("."+g.eventRects),Fe(Og)&&!sc(Og)?(y.classed(g.eventRectsMultiple)||y.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),z=Cj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),kf(z.enter()),z.attr("x",0).attr("y",0).attr("width",gg).attr("height",ig)):(y.classed(g.eventRectsSingle)||y.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Xi&&!Wi?(D=function(a,b){var c=Bc(b),d=Cc(b),e=Nf.data.xs[a.id][b];return(Dg(d?d:e+50)-Dg(c?c:e-50))/2},C=function(a,b){var c=Bc(b),d=Nf.data.xs[a.id][b];return(Dg(d)+Dg(c?c:d-50))/2}):(D=P(),C=function(a){return Dg(a.x)-D/2}),A=Ec(Nf.data.targets),Cj.select("."+g.eventRects).datum(A?A.values:[]),z=Cj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),jf(z.enter()),z.attr("class",ld).attr("x",wh?0:C).attr("y",wh?C:0).attr("width",wh?gg:D).attr("height",wh?D:ig),z.exit().remove())),Gc(Nf.data.targets).forEach(function(a){Jj[a]=!0})}function rf(){qf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function sf(){if(0!==Lc(Nf.data.targets).length){if("mousemove"===Mf.event.sourceEvent.type&&zj.altDomain)return Dg.domain(zj.altDomain),void zj.scale(Dg).updateScaleExtent();Wi&&Dg.orgDomain()[0]===Hj[0]&&Dg.domain([Hj[0]-1e-10,Dg.orgDomain()[1]]),qf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Mf.event.sourceEvent.type&&($i=!0)}}function tf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function uf(){Aj.attr("width",kg).attr("height",lg),Aj.select("#"+Pi).select("rect").attr("width",gg).attr("height",ig),Aj.select("#"+Qi).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),Aj.select("#"+Ri).select("rect").attr("x",H).attr("y",I).attr("width",N).attr("height",O),Aj.select("."+g.zoomRect).attr("width",gg).attr("height",ig),Gj.style("max-height",lg+"px")}function vf(a){return{axisX:a?hj.x.transition().duration(a):hj.x,axisY:a?hj.y.transition().duration(a):hj.y,axisY2:a?hj.y2.transition().duration(a):hj.y2,axisSubX:a?hj.subx.transition().duration(a):hj.subx}}function wf(a){var b;a=a||{},a.withTransition=Je(a,"withTransition",!0),a.withTransform=Je(a,"withTransform",!1),a.withLegend=Je(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withLegend&&qh||(b=vf(a.withTransitionForAxis?cg:0),p(),V(),uf(),o(a.withTransition,b)),qf(a,b)}function xf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=Cj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",nd),j=i.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Zc),e=Cj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),d=e.enter().append("g").attr("class",pd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",fd).style("cursor",function(a){return eh(a)?"pointer":null}),c=Cj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),b=c.enter().append("g").attr("class",od).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",bd),b.append("g").attr("class",jd),b.append("g").attr("class",function(a){return Xc(g.selectedCircles,a.id)}),b.append("g").attr("class",dd).style("cursor",function(a){return eh(a)?"pointer":null}),a.forEach(function(a){Cj.selectAll("."+g.selectedCircles+rd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Cj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(ug(a)).attr("class",qd),f=h.enter().append("g").attr("class",qd),f.append("g").attr("class",hd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),nh&&(n=Dj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),m=n.enter().append("g").style("opacity",0).attr("class",pd),m.append("g").attr("class",fd),l=Dj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),k=l.enter().append("g").style("opacity",0).attr("class",od),k.append("g").attr("class",bd)),Aj.selectAll("."+g.target).filter(function(a){return Jc(a.id)}).transition().duration(cg).style("opacity",1)}function yf(a,b){b.filter&&(a=a.filter(b.filter)),(b.type||b.types)&&a.forEach(function(a){b.types?fe(a.id,b.types[a.id]):fe(a.id,b.type)}),Nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,z=0,F++)),E[a]=F,D[F]=f,A[a]=z,z+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+v)/10),j=10*Math.ceil((h.height+u)/10),k=nj?j:i,l=nj?U():T();return d&&(z=0,F=0,w=0,x=0),qh&&!Kc(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=i,C[c]=j,(!w||i>=w)&&(w=i),(!x||j>=x)&&(x=j),g=nj?x:w,void(vh?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(l-g*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=26,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=Ej.selectAll("."+g.legendItemFocused).size();b=b||{},n=Je(b,"withTransition",!0),q=Je(b,"withTransitionForTransform",!0),nj?(f=function(a){return w*E[a]},j=function(a){return D[E[a]]+A[a]}):(f=function(a){return D[E[a]]+A[a]},j=function(a){return x*E[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=Ej.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Xc(g.legendItem,a)}).style("visibility",function(a){return Kc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof sh?sh(a):Nf.toggle(a)}).on("mouseover",function(a){Mf.select(this).classed(g.legendItemFocused,!0),aj||Nf.focus(a),"function"==typeof th&&th(a)}).on("mouseout",function(a){Mf.select(this).classed(g.legendItemFocused,!1),aj||Nf.revert(),"function"==typeof uh&&uh(a)}),m.append("text").text(function(a){return d(Rg[a])?Rg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",nj?h:-200).attr("y",nj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",nj?i:-200).attr("y",nj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",cj).attr("x",nj?h:-200).attr("y",nj?-200:j).attr("width",10).attr("height",10),r=Ej.selectAll("text").data(a).text(function(a){return d(Rg[a])?Rg[a]:a}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=Ej.selectAll("rect."+g.legendItemEvent).data(a),(n?s.transition():s).attr("width",function(a){return B[a]}).attr("height",function(a){return C[a]}).attr("x",i).attr("y",l),t=Ej.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",cj).attr("x",f).attr("y",j),Ej.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Jc(a)}).transition().style("opacity",function(a){var b=Mf.select(this);return Jc(a)?!G||b.classed(g.legendItemFocused)?Bf(b):Cf(b):rj}),R(w),S(x),Q(F),p(),V(),uf(),o(q,c)}function If(a){return Ic(Nf.data.targets,a.id)}function Jf(a){return"data"in a&&Ic(Nf.data.targets,a.data.id)}function Kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function Lf(a,b,c){var d=!le(Nf.data.targets);aj=!1,fe(a,b),wf(c||{withTransitionForAxis:d})}var Mf=a.d3?a.d3:"undefined"!=typeof require?require("d3"):void 0,Nf={data:{},axis:{},legend:{}},Of={},Pf=i(["bindto"],"#chart"),Qf=i(["size","width"]),Rf=i(["size","height"]),Sf=i(["padding","left"]),Tf=i(["padding","right"]),Uf=i(["padding","top"]),Vf=i(["padding","bottom"]),Wf=i(["zoom","enabled"],!1),Xf=i(["zoom","extent"]),Yf=i(["zoom","privileged"],!1),Zf=i(["interaction","enabled"],!0),$f=i(["onenter"],function(){}),_f=i(["onleave"],function(){}),ag=i(["onresize"],function(){}),bg=i(["onresized"],function(){}),cg=i(["transition","duration"],350);h("data","data is required in config");var dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg,Kg,Lg,Mg,Ng=i(["data","x"]),Og=i(["data","xs"],{}),Pg=i(["data","x_format"]),Qg=i(["data","id_converter"],function(a){return a}),Rg=i(["data","names"],{}),Sg=i(["data","classes"],{}),Tg=i(["data","groups"],[]),Ug=i(["data","axes"],{}),Vg=i(["data","type"]),Wg=i(["data","types"],{}),Xg=i(["data","labels"],{}),Yg=i(["data","order"]),Zg=i(["data","regions"],{}),$g=i(["data","color"]),_g=i(["data","colors"],{}),ah=i(["data","hide"],!1),bh=i(["data","filter"]),ch=i(["data","selection","enabled"],!1),dh=i(["data","selection","grouped"],!1),eh=i(["data","selection","isselectable"],function(){return!0}),fh=i(["data","selection","multiple"],!0),gh=i(["data","onclick"],function(){}),hh=i(["data","onenter"],function(){}),ih=i(["data","onleave"],function(){}),jh=i(["data","onselected"],function(){}),kh=i(["data","onunselected"],function(){}),lh=i(["data","ondragstart"],function(){}),mh=i(["data","ondragend"],function(){}),nh=i(["subchart","show"],!1),oh=i(["subchart","size","height"],60),ph=i(["color","pattern"],[]),qh=i(["legend","show"],!0),rh=i(["legend","position"],"bottom"),sh=i(["legend","item","onclick"]),th=i(["legend","item","onmouseover"]),uh=i(["legend","item","onmouseout"]),vh=i(["legend","equally"],!1),wh=i(["axis","rotated"],!1),xh=i(["axis","x","show"],!0),yh=i(["axis","x","type"],"indexed"),zh=i(["axis","x","localtime"],!0),Ah=i(["axis","x","categories"],[]),Bh=i(["axis","x","tick","centered"],!1),Ch=i(["axis","x","tick","format"]),Dh=i(["axis","x","tick","culling"],{}),Eh=i(["axis","x","tick","culling","max"],10),Fh=i(["axis","x","tick","count"]),Gh=i(["axis","x","tick","fit"],!0),Hh=i(["axis","x","tick","values"],null),Ih=i(["axis","x","tick","rotate"]),Jh=i(["axis","x","max"],null),Kh=i(["axis","x","min"],null),Lh=i(["axis","x","padding"],{}),Mh=i(["axis","x","height"]),Nh=i(["axis","x","default"]),Oh=i(["axis","x","label"],{}),Ph=i(["axis","y","show"],!0),Qh=i(["axis","y","max"]),Rh=i(["axis","y","min"]),Sh=i(["axis","y","center"]),Th=i(["axis","y","label"],{}),Uh=i(["axis","y","inner"],!1),Vh=i(["axis","y","tick","format"]),Wh=i(["axis","y","padding"]),Xh=i(["axis","y","ticks"],10),Yh=i(["axis","y2","show"],!1),Zh=i(["axis","y2","max"]),$h=i(["axis","y2","min"]),_h=i(["axis","y2","center"]),ai=i(["axis","y2","label"],{}),bi=i(["axis","y2","inner"],!1),ci=i(["axis","y2","tick","format"]),di=i(["axis","y2","padding"]),ei=i(["axis","y2","ticks"],10),fi=i(["grid","x","show"],!1),gi=i(["grid","x","type"],"tick"),hi=i(["grid","x","lines"],[]),ii=i(["grid","y","show"],!1),ji=i(["grid","y","lines"],[]),ki=i(["grid","y","ticks"],10),li=i(["point","show"],!0),mi=i(["point","r"],2.5),ni=i(["point","focus","line","enabled"],!0),oi=i(["point","focus","expand","enabled"],!0),pi=i(["point","focus","expand","r"]),qi=i(["point","focus","select","r"]),ri=i(["line","connect_null"],!1),si=i(["bar","width"]),ti=i(["bar","width","ratio"],.6),ui=i(["pie","label","show"],!0),vi=i(["pie","label","format"]),wi=i(["pie","expand"],!0),xi=i(["pie","onclick"],function(){}),yi=i(["pie","onmouseover"],function(){}),zi=i(["pie","onmouseout"],function(){}),Ai=i(["donut","label","show"],!0),Bi=i(["donut","label","format"]),Ci=i(["donut","expand"],!0),Di=i(["donut","title"],""),Ei=i(["donut","onclick"],function(){}),Fi=i(["donut","onmouseover"],function(){}),Gi=i(["donut","onmouseout"],function(){}),Hi=i(["regions"],[]),Ii=i(["tooltip","show"],!0),Ji=i(["tooltip","format","title"]),Ki=i(["tooltip","format","value"]),Li=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Ji?Ji:b,l=Ki?Ki:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Mi=i(["tooltip","init","show"],!1),Ni=i(["tooltip","init","x"],0),Oi=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Pi=("string"==typeof Pf?Pf.replace(/[# .>~+]/g,""):g.chart+ +new Date)+"-clip",Qi=Pi+"-xaxis",Ri=Pi+"-yaxis",Si=j(Pi),Ti=j(Qi),Ui=j(Ri),Vi="timeseries"===yh,Wi="categorized"===yh,Xi=!Vi&&(Ng||Fe(Og)),Yi=null,Zi=!1,$i=!1,_i=!1,aj=!1,bj=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],cj=ze(_g,Fe(ph)?ph:bj,$g),dj=zh?Mf.time.format:Mf.time.format.utc,ej=dj.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),fj=[],gj=[],hj={},ij=wh?"left":"bottom",jj=wh?Uh?"top":"bottom":Uh?"right":"left",kj=wh?bi?"bottom":"top":bi?"left":"right",lj=wh?"left":"bottom",mj={main:function(){return"translate("+k(dg.left)+","+k(dg.top)+")"},context:function(){return"translate("+k(eg.left)+","+k(eg.top)+")"},legend:function(){return"translate("+fg.left+","+fg.top+")" },x:function(){return"translate(0,"+(wh?0:ig)+")"},y:function(){return"translate(0,"+(wh?ig:0)+")"},y2:function(){return"translate("+(wh?0:gg)+","+(wh?1:0)+")"},subx:function(){return"translate(0,"+(wh?0:jg)+")"},arc:function(){return"translate("+pg/2+","+qg/2+")"}},nj="right"===rh,oj=0,pj=0,qj=0,rj=.15,sj=30,tj=wh&&!xh?0:30,uj=5;ug=Mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var vj,wj=function(){var a=Mf.svg.line().x(wh?function(a){return $(a.id)(a.value)}:Id).y(wh?Id:function(a){return $(a.id)(a.value)});return ri||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ri?Te(b.values):b.values;return me(b)?(a.interpolate(ne(b)?"cardinal":"linear"),Zg[b.id]?gf(e,Dg,$(b.id),Zg[b.id]):a(e)):(c=e[0]?Dg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,wh?"M "+d+" "+c:"M "+c+" "+d)}}(),xj=function(){var a;return a=wh?Mf.svg.area().x0(function(a){return $(a.id)(0)}).x1(function(a){return $(a.id)(a.value)}).y(Id):Mf.svg.area().x(Id).y0(function(a){return $(a.id)(0)}).y1(function(a){return $(a.id)(a.value)}),function(b){var c,d,e=Te(b.values);return ge([b],"area")||ge([b],"area-spline")?(a.interpolate(ne(b)?"cardinal":"linear"),a(e)):(c=e[0]?Dg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,wh?"M "+d+" "+c:"M "+c+" "+d)}}(),yj=function(){var a=Mf.svg.line().x(wh?function(a){return _(a.id)(a.value)}:Ld).y(wh?Ld:function(a){return _(a.id)(a.value)});return function(b){var c=Te(b.values);return me(b)?a(c):"M "+Gg(c[0].x)+" "+_(b.id)(c[0].value)}}(),zj=function(){};vj=Mf.svg.brush().on("brush",rf),vj.update=function(){return Dj&&Dj.select("."+g.brush).call(this),this},vj.scale=function(a){return wh?this.y(a):this.x(a)},Wf&&(zj=Mf.behavior.zoom().on("zoomstart",function(){zj.altDomain=Mf.event.sourceEvent.altKey?Dg.orgDomain():null}).on("zoom",Wf?sf:null),zj.scale=function(a){return wh?this.y(a):this.x(a)},zj.orgScaleExtent=function(){var a=Xf?Xf:[1,10];return[a[0],Math.max(Dc()/a[1],a[1])]},zj.updateScaleExtent=function(){var a=ec(Dg.orgDomain())/ec(Hj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Aj,Bj,Cj,Dj,Ej,Fj,Gj,Hj,Ij,Jj={};if(Nf.focus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);Nf.revert(),Nf.defocus(),b(d.classed(g.focused,!0)),b(e),le(Nf.data.targets)&&Rb(a,!0),Df(a,!0)},Nf.defocus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",.3)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);Nf.revert(),b(d.classed(g.focused,!1)),b(e),le(Nf.data.targets)&&Sb(a),Df(a,!1)},Nf.revert=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);b(d.classed(g.focused,!1)),b(e),le(Nf.data.targets)&&Sb(a),Ef()},Nf.show=function(a,b){a=Hc(a),b=b||{},Pc(a),Aj.selectAll(td(a)).transition().style("opacity",1),b.withLegend&&Ff(a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Nf.hide=function(a,b){a=Hc(a),b=b||{},Oc(a),Aj.selectAll(td(a)).transition().style("opacity",0),b.withLegend&&Gf(a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Nf.toggle=function(a){Jc(a)?Nf.hide(a):Nf.show(a)},Nf.unzoom=function(){vj.clear().update(),qf({withUpdateXDomain:!0})},Nf.load=function(a){return a.xs&&rc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Sg[b]=a.classes[b]}),"categories"in a&&Wi&&(Ah=a.categories,Jg.categories(Ah)),"cacheIds"in a&&fc(a.cacheIds)?void yf(hc(a.cacheIds),a.done):void("unload"in a?Af(Hc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){zf(a)}):zf(a))},Nf.unload=function(a,b){Af(Hc(a),function(){qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Nf.selected=function(a){return Mf.merge(Cj.selectAll("."+g.shapes+rd(a)).selectAll("."+g.shape).filter(function(){return Mf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Nf.select=function(a,b,c){ch&&Cj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Mf.select(this),i=e.data?e.data.id:e.id,j=Se(this),k=dh||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);h.classed(g.line)||h.classed(g.area)||(k&&l?eh(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},Nf.unselect=function(a,b){ch&&Cj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Mf.select(this),f=c.data?c.data.id:c.id,h=Se(this),i=dh||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);e.classed(g.line)||e.classed(g.area)||i&&j&&eh(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Nf.toLine=function(a){Lf(a,"line")},Nf.toSpline=function(a){Lf(a,"spline")},Nf.toBar=function(a){Lf(a,"bar")},Nf.toScatter=function(a){Lf(a,"scatter")},Nf.toArea=function(a){Lf(a,"area")},Nf.toAreaSpline=function(a){Lf(a,"area-spline")},Nf.toPie=function(a){Lf(a,"pie",{withTransform:!0})},Nf.toDonut=function(a){Lf(a,"donut",{withTransform:!0})},Nf.groups=function(a){return c(a)?Tg:(Tg=a,qf(),Tg)},Nf.xgrids=function(a){return a?(hi=a,qf(),hi):hi},Nf.xgrids.add=function(a){return a?Nf.xgrids(hi.concat(a)):void 0},Nf.xgrids.remove=function(a){var b=Kf(a);return Nf.xgrids(hi.filter(b))},Nf.ygrids=function(a){return a?(ji=a,qf(),ji):ji},Nf.ygrids.add=function(a){return a?Nf.ygrids(ji.concat(a)):void 0},Nf.ygrids.remove=function(a){var b=Kf(a);return Nf.ygrids(ji.filter(b))},Nf.regions=function(a){return a?(Hi=a,qf(),Hi):Hi},Nf.regions.add=function(a){return a?(Hi=Hi.concat(a),qf(),Hi):Hi},Nf.regions.remove=function(a){var b,c,d;return a=a||{},b=Je(a,"duration",cg),c=Je(a,"classes",[g.region]),d=Cj.select("."+g.regions).selectAll(c.map(function(a){return"."+a})),(b?d.transition().duration(b):d).style("opacity",0).remove(),Hi=Hi.filter(function(a){return c.indexOf(a.class)<0})},Nf.data.get=function(a){var b=Nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Nf.data.getAsTarget=function(a){var b=Nf.data.targets.filter(function(b){return b.id===a});return b.length>0?b[0]:void 0},Nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Rg[b]=a[b]}),qf({withLegend:!0}),Rg):Rg},Nf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){_g[b]=a[b]}),qf({withLegend:!0}),_g):_g},Nf.x=function(a){return arguments.length&&(uc(Nf.data.targets,a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Nf.data.xs},Nf.xs=function(a){return arguments.length&&(vc(Nf.data.targets,a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Nf.data.xs},Nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){gb(b,a[b])}),Ib())},Nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Jh=+a.x),b(a.y)&&(Qh=+a.y),b(a.y2)&&(Zh=+a.y2)):Qh=Zh=+a,qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Kh=+a.x),b(a.y)&&(Rh=+a.y),b(a.y2)&&($h=+a.y2)):Rh=$h=+a,qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Nf.axis.max(a.max),"undefined"!=typeof a.min&&Nf.axis.min(a.min))},Nf.legend.show=function(a){Ff(Hc(a)),qf({withLegend:!0})},Nf.legend.hide=function(a){Gf(Hc(a)),qf({withLegend:!0})},Nf.resize=function(a){Qf=a?a.width:null,Rf=a?a.height:null,wf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Nf.destroy=function(){Nf.data.targets=void 0,Nf.data.xs={},Gj.html(""),a.onresize=null},"url"in f.data)Mf.xhr(f.data.url,function(a,b){var c,d=Mf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Mf.csv.parse(b.response),hf(c)});else if("rows"in f.data)hf(xc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");hf(yc(f.data.columns))}return Nf},"function"==typeof define&&define.amd?define("c3",["d3"],f):"undefined"!=typeof exports&&"undefined"!=typeof module?module.exports=f:a.c3=f}(window); \ No newline at end of file From a3bbdb33abfac6c9d9089eaff8011184018e9590 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 14 May 2014 12:33:05 +0900 Subject: [PATCH 174/178] Fix min of padding left when axis rotated --- c3.js | 2 +- c3.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/c3.js b/c3.js index 2bbdaa1..3dcb34d 100644 --- a/c3.js +++ b/c3.js @@ -515,7 +515,7 @@ if (__padding_left) { return __padding_left; } else if (__axis_rotated) { - return !__axis_x_show ? 1 : ceil10(getAxisWidthByAxisId('x')); + return !__axis_x_show ? 1 : Math.max(ceil10(getAxisWidthByAxisId('x')), 40); } else { return !__axis_y_show || __axis_y_inner ? 1 : ceil10(getAxisWidthByAxisId('y')); } diff --git a/c3.min.js b/c3.min.js index 8b831b7..c023fb1 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.round(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.round(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&a=0;return"url("+(c?"":document.URL.split("#")[0])+"#"+b+")"}function k(a){return Math.ceil(a)+.5}function l(a,b){var c,d,e;b&&b.axisX?c=b.axisX:(c=Cj.select("."+g.axisX),a&&(c=c.transition())),b&&b.axisY?d=b.axisY:(d=Cj.select("."+g.axisY),a&&(d=d.transition())),b&&b.axisY2?e=b.axisY2:(e=Cj.select("."+g.axisY2),a&&(e=e.transition())),Cj.attr("transform",mj.main),c.attr("transform",mj.x),d.attr("transform",mj.y),e.attr("transform",mj.y2),Cj.select("."+g.chartArcs).attr("transform",mj.arc)}function m(a,b){var c;b&&b.axisSubX?c=b.axisSubX:(c=Dj.select("."+g.axisX),a&&(c=c.transition())),Dj.attr("transform",mj.context),c.attr("transform",mj.subx)}function n(a){(a?Ej.transition():Ej).attr("transform",mj.legend)}function o(a,b){l(a,b),nh&&m(a,b),n(a)}function p(){var a=U(),b=T(),c=nj?0:a,d=le(Nf.data.targets),e=wh||d?0:A("x"),f=nh&&!d?oh+e:0;kg=t(),lg=u(),wh?(dg={top:A("y2")+v(),right:d?0:y(),bottom:A("y")+c+w(),left:f+(d?0:x())},eg={top:dg.top,right:0/0,bottom:20+c,left:sj}):(dg={top:4+v(),right:d?0:y(),bottom:e+f+c+w(),left:d?0:x()},eg={top:lg-f-c,right:0/0,bottom:e+c,left:dg.left}),fg={top:nj?0:lg-a,right:0/0,bottom:0,left:nj?kg-b:0},gg=kg-dg.left-dg.right,ig=lg-dg.top-dg.bottom,0>gg&&(gg=0),0>ig&&(ig=0),hg=wh?dg.left-sj-tj:gg,jg=wh?ig:lg-eg.top-eg.bottom,0>hg&&(hg=0),0>jg&&(jg=0),pg=gg-(nj?b+10:0),qg=ig-(nj?0:10),r(),nj&&d&&(fg.left=pg/2+1.1*ng)}function q(){Cj.select("line."+g.xgridFocus).attr("x1",wh?0:-10).attr("x2",wh?gg:-10).attr("y1",wh?-10:dg.top).attr("y2",wh?-10:ig)}function r(){ng=Math.min(pg,qg)/2,mg=.95*ng,og=ke(Nf.data.targets)?.6*mg:0}function s(){var a=wh?g.axisX:g.axisY,b=Cj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Gj.node().getBoundingClientRect(),e=le(Nf.data.targets),f=c.right-d.left-(e?0:x());return f>0?f:0}function t(){return Qf?Qf:B()}function u(){var a=Rf?Rf:C();return a>0?a:320}function v(){return Uf?Uf:0}function w(){return Vf?Vf:0}function x(){return Sf?Sf:wh?xh?Ke(z("x")):1:!Ph||Uh?1:Ke(z("y"))}function y(){var a=10,b=nj?T()+20:0;return Tf?Tf:wh?a+b:(!Yh||bi?a:Ke(z("y2")))+b}function z(a){var b=ob(a);return b.isInner?20+Hb(a):40+Hb(a)}function A(a){return"x"!==a||xh?"x"===a&&Mh?Mh:"y"!==a||Ph?"y2"!==a||Yh?(ob(a).isInner?30:40)+("y2"===a?-10:0):uj:qh&&!nj?10:1:0}function B(){return+Gj.style("width").replace("px","")}function C(){return+Gj.style("height").replace("px","")}function D(a){return a?-31:-(dg.left-1)}function E(a){return a?-20:-4}function F(){return D(!wh)}function G(){return E(!wh)}function H(){return D(wh)}function I(){return E(wh)}function J(a){return a?gg+2+30+30:dg.left+20}function K(a){return a?(Mh?Mh:0)+80:ig+8}function L(){return J(!wh)}function M(){return K(!wh)}function N(){return J(wh)}function O(){return K(wh)}function P(){var a,b,c,d,e,f=Ec(Nf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=Dg(b.x)-Dg(a.x),0===c?wh?ig:gg:(d=Dc(),e=he(Nf.data.targets)?(d-(Wi?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function Q(a){oj=a}function R(a){pj=a}function S(a){qj=a}function T(){return qh?nj?pj*(oj+1):kg:0}function U(){return qh?nj?lg:qj*(oj+1):0}function V(){var a,b,c=!Dg;vg=wh?1:0,wg=wh?ig:gg,xg=wh?0:ig,yg=wh?gg:1,zg=vg,Ag=wg,Bg=wh?0:jg,Cg=wh?hg:1,Dg=Y(vg,wg,c?void 0:Dg.domain(),function(){return Jg.tickOffset()}),Eg=Z(xg,yg,c?void 0:Eg.domain()),Fg=Z(xg,yg,c?void 0:Fg.domain()),Gg=Y(vg,wg,Hj,function(a){return a%1?0:Mg.tickOffset()}),Hg=Z(Bg,Cg,c?void 0:Hg.domain()),Ig=Z(Bg,Cg,c?void 0:Ig.domain()),a=db(),b=Hh?Hh:c?void 0:Jg.tickValues(),Jg=ab(Dg,ij,a,b),Mg=ab(Gg,lj,a,b),Kg=bb(Eg,jj,Vh,Xh),Lg=bb(Fg,kj,ci,ei),c||(vj.scale(Gg),Wf&&zj.scale(Dg)),W()}function W(){rg=Kb(),sg=Lb(),tg=Lb(.98)}function X(a,b,c){return(c?Mf.time.scale():Mf.scale.linear()).range([a,b])}function Y(a,b,c,d){var e,f=X(a,b,Vi),g=c?f.domain(c):f;Wi?(d=d||function(){return 0},f=function(a,b){var c=g(a)+d(a);return b?c:Math.ceil(c)}):f=function(a,b){var c=g(a);return b?c:Math.ceil(c)};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return Hj&&Hj[0]===a[0]&&Hj[1]a?a.toFixed(0):a};return Ch&&("function"==typeof Ch?a=Ch:Vi&&(a=function(a){return a?dj(Ch)(a):""})),a}function eb(a){var b;return"y"===a?b=Th:"y2"===a?b=ai:"x"===a&&(b=Oh),b}function fb(a){var b=eb(a);return"string"==typeof b?b:b?b.text:null}function gb(a,b){var c=eb(a);"string"==typeof c?"y"===a?Th=b:"y2"===a?ai=b:"x"===a&&(Oh=b):c&&(c.text=b)}function hb(a){return 10*Math.sin(Math.PI*(a/180))}function ib(a){return 11.5-2.5*(a/15)}function jb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",ib(c)).attr("x",hb(c)).attr("transform","rotate("+c+")")}function kb(a,b){var c=eb(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 lb(){return kb("x",wh?"inner-top":"inner-right")}function mb(){return kb("y",wh?"inner-right":"inner-top")}function nb(){return kb("y2",wh?"inner-right":"inner-top")}function ob(a){return"y2"===a?nb():"y"===a?mb():lb()}function pb(){return fb("x")}function qb(){return fb("y")}function rb(){return fb("y2")}function sb(a,b){return a?b.isLeft?0:b.isCenter?gg/2:gg:b.isBottom?-ig:b.isMiddle?-ig/2:0}function tb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function ub(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function vb(){return sb(!wh,lb())}function wb(){return sb(wh,mb())}function xb(){return sb(wh,nb())}function yb(){return tb(!wh,lb())}function zb(){return tb(wh,mb())}function Ab(){return tb(wh,nb())}function Bb(){var a=lb();return wh?a.isInner?"1.2em":-25-Hb("x"):a.isInner?"-0.5em":Mh?Mh-10:"3em"}function Cb(){var a=mb();return wh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Hb("y")}function Db(){var a=nb();return wh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Hb("y2")}function Eb(){return ub(!wh,lb())}function Fb(){return ub(wh,mb())}function Gb(){return ub(wh,nb())}function Hb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Ib(a){var b=Cj.select("."+g.axisX+" ."+g.axisXLabel),c=Cj.select("."+g.axisY+" ."+g.axisYLabel),d=Cj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",vb).attr("dx",yb).attr("dy",Bb).text(pb),(a?c.transition():c).attr("x",wb).attr("dx",zb).attr("dy",Cb).attr("dy",Cb).text(qb),(a?d.transition():d).attr("x",xb).attr("dx",Ab).attr("dy",Db).text(rb)}function Jb(a){var b=!1;return ug(Lc(Nf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Kb(){var a=Mf.svg.arc().outerRadius(mg).innerRadius(og),b=function(b,c){var d;return c?a(b):(d=Jb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Lb(a){var b=Mf.svg.arc().outerRadius(ng*(a?a:1)).innerRadius(og);return function(a){var c=Jb(a);return c?b(c):"M 0 0"}}function Mb(a,b){return se(a.data)?rg(a,b):"M 0 0"}function Nb(a){var b,c,d,e,f=Jb(a),g="";return f&&(b=rg.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*mg*.8+","+d/e*mg*.8+")"),g}function Ob(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Pb(a){return tc({id:a.data.id,value:a.value,ratio:Ob(a)})}function Qb(a){var b,c,d,e;return Tb()?(b=Jb(a),c=b?b.value:null,d=Ob(b),e=Ub(),e?e(c,d):Gd(c,d)):""}function Rb(a,b){var c=Aj.selectAll("."+g.chartArc+sd(a)),d=Aj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});ye(a)&&c.selectAll("path").transition().duration(50).attr("d",sg).transition().duration(100).attr("d",tg).each(function(a){re(a.data)}),b||d.style("opacity",.3)}function Sb(a){var b=Aj.selectAll("."+g.chartArc+sd(a));b.selectAll("path").transition().duration(50).attr("d",rg),Aj.selectAll("."+g.arc).style("opacity",1)}function Tb(){return ke(Nf.data.targets)?Ai:ui}function Ub(){return ke(Nf.data.targets)?Bi:vi}function Vb(){return ke(Nf.data.targets)?Di:""}function Wb(){var a=ke(Nf.data.targets)?Ei:xi;return"function"==typeof a?a:function(){}}function Xb(){var a=ke(Nf.data.targets)?Fi:yi;return"function"==typeof a?a:function(){}}function Yb(){var a=ke(Nf.data.targets)?Gi:zi;return"function"==typeof a?a:function(){}}function Zb(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Tg.length>0)for(g=Uc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return Mf.min(Object.keys(i).map(function(a){return Mf.min(i[a])}))}function $b(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Tg.length>0)for(g=Vc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return Mf.max(Object.keys(i).map(function(a){return Mf.max(i[a])}))}function _b(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return cb(a.id)===c}),m="y2"===c?$h:Rh,n="y2"===c?Zh:Qh,o=b(m)?m:Zb(l),p=b(n)?n:$b(l),q="y2"===c?_h:Sh,r=Ad()&&wh;return 0===l.length?"y2"===c?Fg.domain():Eg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=Bd(o,p),j=ec(Eg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Wh&&(f=b(Wh.top)?Wh.top:e,g=b(Wh.bottom)?Wh.bottom:e),"y2"===c&&di&&(f=b(di.top)?di.top:e,g=b(di.bottom)?di.bottom:e),he(l)&&!Uc(l)&&(g=o),[o-g,p+f])}function ac(a){return Kh?Vi?Ae(Kh):Kh:Mf.min(a,function(a){return Mf.min(a.values,function(a){return a.x})})}function bc(a){return Jh?Vi?Ae(Jh):Jh:Mf.max(a,function(a){return Mf.max(a.values,function(a){return a.x})})}function cc(a){var c,d,e,f,g=Fc(a),h=g[1]-g[0];return Wi?d=0:he(a)?(c=Dc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Lh&&Fe(Lh)?(e=b(Lh.left)?Lh.left:d,f=b(Lh.right)?Lh.right:d):e=f="number"==typeof Lh?Lh:d,{left:e,right:f}}function dc(a){var b=[ac(a),bc(a)],c=b[0],d=b[1],e=cc(a),f=0,g=0;return c-d!==0||Wi||(c=Vi?new Date(.5*c.getTime()):-.5,d=Vi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ec(a){return a[1]-a[0]}function fc(a){for(var b=0;bb?0:b-c}function lc(a){var b,c=jc(a),d="y"===a.axis?Eg:Fg;return b="y"===a.axis||"y2"===a.axis?wh?ig:"start"in a?d(a.start):ig:wh?"end"in a?Dg(Vi?Ae(a.end):a.end):ig:ig,c>b?0:b-c}function mc(a){return Ng&&a===Ng||Fe(Og)&&Ge(Og,a)}function nc(a){return!mc(a)}function oc(a){return Ng?Ng:Fe(Og)?Og[a]:null}function pc(a,b){var c,d=b&&Fe(b)?Gc(b):[];return d.forEach(function(b){oc(b)===a&&(c=Nf.data.xs[b])}),c}function qc(a,b){return a in Nf.data.xs&&Nf.data.xs[a]&&Nf.data.xs[a][b]?Nf.data.xs[a][b]:b}function rc(a){Object.keys(a).forEach(function(b){Og[b]=a[b]})}function sc(a){return 1===Mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function tc(a){var b;return a&&(b=Rg[a.id],a.name=b?b:a.id),a}function uc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=wc(b[d],a.id,d)}),Nf.data.xs[a.id]=b})}function vc(a,b){a.forEach(function(a){b[a.id]&&uc([a],b[a.id])})}function wc(a,c,d){var e;return e=Vi?a?a instanceof Date?a:Ae(a):Ae(qc(c,d)):Xi&&!Wi?b(a)?+a:qc(c,d):d}function xc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Ng?(d=Object.keys(Nf.data.xs),Nf.data.xs[c]=d.length>0?Nf.data.xs[d[0]]:void 0):Fe(Og)&&(Nf.data.xs[c]=pc(f,Nf.data.targets)):Nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Qg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=oc(b),g=a[f],h=wc(g,b,e);return Xi&&Wi&&0===c&&g&&(0===e&&(Ah=[]),Ah.push(g)),("undefined"==typeof a[b]||Nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Vg&&fe(Gc(c).filter(function(a){return!(a in Wg)}),Vg),c.forEach(function(a){gc(a.id_org,a)}),c}function Ac(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 Bc(a){return a>0&&Nf.data.targets[0].values[a-1]?Nf.data.targets[0].values[a-1].x:void 0}function Cc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Fc(a){var b,c,d=Ec(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Gc(a){return a.map(function(a){return a.id})}function Hc(a){return a?"string"==typeof a?[a]:a:Gc(Nf.data.targets)}function Ic(a,b){var c,d=Gc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Vi?new Date(i):i);j.push(e)}return Vi||(j=j.sort(function(a,b){return a-b})),j}function Oc(a){fj=fj.concat(a)}function Pc(a){fj=fj.filter(function(b){return a.indexOf(b)<0})}function Qc(a){gj=gj.concat(a)}function Rc(a){gj=gj.filter(function(b){return a.indexOf(b)<0})}function Sc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Tc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Vc(a){return Tc(a,function(a){return a>0})}function Wc(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||0===a[f].x)&&(e=e.concat(Md(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Md(a,g))),Pd(e,b)):Nd(a,b,f,g)}function Od(a,b){var c;return c=a.map(function(a){return Nd(a.values,b)}),Pd(c,b)}function Pd(a,b){var c,d;return a.forEach(function(a){var e=He(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Qd(a,b){return Mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Rd(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 Sd(){return Yg&&"desc"===Yg.toLowerCase()}function Td(){return Yg&&"asc"===Yg.toLowerCase()}function Ud(a){var b=Td(),c=Sd();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 Yg&&a.sort(Yg),a}function Vd(a,c){var d,e,f,g,h,i,j,k=le(Nf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&Ii&&(Fj.html(Li(a,db(),Cd(k),cj)).style("display","block"),d=Fj.property("offsetWidth"),e=Fj.property("offsetHeight"),k?(g=gg/2+c[0],i=ig/2+c[1]+20):(wh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-y(),i=Dg(l[0].x)+20):(f=s(),g=f+x()+Dg(l[0].x)+20,h=g+d,j=f+t()-y(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),Fj.style("top",i+"px").style("left",g+"px"))}function Wd(){Fj.style("display","none")}function Xd(a){var c=a.filter(function(a){return a&&b(a.value)});if(Ii&&!ie(Nf.data.targets)&&!le(Nf.data.targets)){var d=Cj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(wh?"y1":"x1",Id).attr(wh?"y2":"x2",Id),pf(d,"grid")}}function Yd(){Cj.select("line."+g.xgridFocus).style("visibility","hidden")}function Zd(a,b){var c,d,e,f,h=[],i=Cj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=dc(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function $d(a){return a.x||0===a.x?Dg(a.x):null}function _d(a){return $(a.id)(a.value)}function ae(){var a,b,d={},e=0;return Lc(Nf.data.targets.filter(oe)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ee(a,b){return"number"==typeof si?si:b?2*a.tickOffset()*ti/b:0}function fe(a,b){Hc(a).forEach(function(a){Jj[a]=b===Wg[a],Wg[a]=b})}function ge(a,b){var c=!1;return a.forEach(function(a){Wg[a.id]===b&&(c=!0),a.id in Wg||"line"!==b||(c=!0)}),c}function he(a){return ge(a,"bar")}function ie(a){return ge(a,"scatter")}function je(a){return ge(a,"pie")}function ke(a){return ge(a,"donut")}function le(a){return je(a)||ke(a)}function me(a){var b="string"==typeof a?a:a.id;return!(b in Wg)||"line"===Wg[b]||"spline"===Wg[b]||"area"===Wg[b]||"area-spline"===Wg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"spline"===Wg[b]||"area-spline"===Wg[b]}function oe(a){var b="string"==typeof a?a:a.id;return"bar"===Wg[b]}function pe(a){var b="string"==typeof a?a:a.id;return"scatter"===Wg[b]}function qe(a){var b="string"==typeof a?a:a.id;return"pie"===Wg[b]}function re(a){var b="string"==typeof a?a:a.id;return"donut"===Wg[b]}function se(a){return qe(a)||re(a)}function te(a){return me(a)?[a]:[]}function ue(a){return se(a.data)?[a]:[]}function ve(a){return oe(a)?a.values:[]}function we(a){return me(a)||pe(a)?a.values:[]}function xe(a){return oe(a)||me(a)?a.values:[]}function ye(a){return re(a)&&Ci||qe(a)&&wi}function ze(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function Ae(b){var c;try{c=Pg?Mf.time.format(Pg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Pg)}return c}function Be(a,b){var c=Mf.mouse(a),d=Mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ge(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function He(a,b){var c="y"===cb(a.id)?Eg:Fg,d=wh?1:0,e=wh?0:1;return Math.pow(Dg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ie(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Je(a,b,c){return d(a[b])?a[b]:c}function Ke(a){return 10*Math.ceil(a/10)}function Le(a,b,c){jh(b,a.node()),Cj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Xc(g.selectedCircle,c)}).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d).attr("stroke",function(){return cj(b)}).attr("r",1.4*We(b)).transition().duration(100).attr("r",We)}function Me(a,b,c){kh(b,a.node()),Cj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ne(a,b,c,d){a?Le(b,c,d):Me(b,c,d)}function Oe(a,b){jh(b,a.node()),a.transition().duration(100).style("fill",function(){return Mf.rgb(cj(b)).brighter(.75)})}function Pe(a,b){kh(b,a.node()),a.transition().duration(100).style("fill",function(){return cj(b)})}function Qe(a,b,c,d){a?Oe(b,c,d):Pe(b,c,d)}function Re(a,b,c,d){Qe(a,b,c.data,d)}function Se(a){return"circle"===a.nodeName?Ne:Mf.select(a).classed(g.bar)?Qe:Re}function Te(a){return a.filter(function(a){return b(a.value)})}function Ue(a){return li?"function"==typeof mi?mi(a):mi:0}function Ve(a){return oi?pi?pi:1.75*Ue(a):Ue(a)}function We(a){return qi?qi:4*Ue(a)}function Xe(a,c){return(c?Cj.selectAll("."+g.circles+rd(c)):Cj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ye(a,b){Xe(a,b).classed(g.EXPANDED,!0).attr("r",Ve)}function Ze(a){Xe(a).filter(function(){return Mf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Ue)}function $e(a){return Cj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function _e(a){$e(a).classed(g.EXPANDED,!0)}function af(a){$e(a).classed(g.EXPANDED,!1)}function bf(a,b){var c=ff(a,b);return function(a,b){var d=c(a,b),e=wh?1:0,f=wh?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 cf(a,b){var c=ff(a,!1),d=b?df:ef;return function(a,b){return d(c(a,b),a,this)}}function df(a,b){var c;return wh?(c=oe(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function ef(a,b,c){var d=c.getBoundingClientRect();return wh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:oe(b)?-3:-6)}function ff(a,b){var c=a.__max__+1,d=ee(Jg,c),e=be(d,c,a,!!b),f=ce(!!b),g=de(a,!!b),h=b?_:$;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return wh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function gf(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;gb?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&a=0;return"url("+(c?"":document.URL.split("#")[0])+"#"+b+")"}function k(a){return Math.ceil(a)+.5}function l(a,b){var c,d,e;b&&b.axisX?c=b.axisX:(c=Cj.select("."+g.axisX),a&&(c=c.transition())),b&&b.axisY?d=b.axisY:(d=Cj.select("."+g.axisY),a&&(d=d.transition())),b&&b.axisY2?e=b.axisY2:(e=Cj.select("."+g.axisY2),a&&(e=e.transition())),Cj.attr("transform",mj.main),c.attr("transform",mj.x),d.attr("transform",mj.y),e.attr("transform",mj.y2),Cj.select("."+g.chartArcs).attr("transform",mj.arc)}function m(a,b){var c;b&&b.axisSubX?c=b.axisSubX:(c=Dj.select("."+g.axisX),a&&(c=c.transition())),Dj.attr("transform",mj.context),c.attr("transform",mj.subx)}function n(a){(a?Ej.transition():Ej).attr("transform",mj.legend)}function o(a,b){l(a,b),nh&&m(a,b),n(a)}function p(){var a=U(),b=T(),c=nj?0:a,d=le(Nf.data.targets),e=wh||d?0:A("x"),f=nh&&!d?oh+e:0;kg=t(),lg=u(),wh?(dg={top:A("y2")+v(),right:d?0:y(),bottom:A("y")+c+w(),left:f+(d?0:x())},eg={top:dg.top,right:0/0,bottom:20+c,left:sj}):(dg={top:4+v(),right:d?0:y(),bottom:e+f+c+w(),left:d?0:x()},eg={top:lg-f-c,right:0/0,bottom:e+c,left:dg.left}),fg={top:nj?0:lg-a,right:0/0,bottom:0,left:nj?kg-b:0},gg=kg-dg.left-dg.right,ig=lg-dg.top-dg.bottom,0>gg&&(gg=0),0>ig&&(ig=0),hg=wh?dg.left-sj-tj:gg,jg=wh?ig:lg-eg.top-eg.bottom,0>hg&&(hg=0),0>jg&&(jg=0),pg=gg-(nj?b+10:0),qg=ig-(nj?0:10),r(),nj&&d&&(fg.left=pg/2+1.1*ng)}function q(){Cj.select("line."+g.xgridFocus).attr("x1",wh?0:-10).attr("x2",wh?gg:-10).attr("y1",wh?-10:dg.top).attr("y2",wh?-10:ig)}function r(){ng=Math.min(pg,qg)/2,mg=.95*ng,og=ke(Nf.data.targets)?.6*mg:0}function s(){var a=wh?g.axisX:g.axisY,b=Cj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Gj.node().getBoundingClientRect(),e=le(Nf.data.targets),f=c.right-d.left-(e?0:x());return f>0?f:0}function t(){return Qf?Qf:B()}function u(){var a=Rf?Rf:C();return a>0?a:320}function v(){return Uf?Uf:0}function w(){return Vf?Vf:0}function x(){return Sf?Sf:wh?xh?Math.max(Ke(z("x")),40):1:!Ph||Uh?1:Ke(z("y"))}function y(){var a=10,b=nj?T()+20:0;return Tf?Tf:wh?a+b:(!Yh||bi?a:Ke(z("y2")))+b}function z(a){var b=ob(a);return b.isInner?20+Hb(a):40+Hb(a)}function A(a){return"x"!==a||xh?"x"===a&&Mh?Mh:"y"!==a||Ph?"y2"!==a||Yh?(ob(a).isInner?30:40)+("y2"===a?-10:0):uj:qh&&!nj?10:1:0}function B(){return+Gj.style("width").replace("px","")}function C(){return+Gj.style("height").replace("px","")}function D(a){return a?-31:-(dg.left-1)}function E(a){return a?-20:-4}function F(){return D(!wh)}function G(){return E(!wh)}function H(){return D(wh)}function I(){return E(wh)}function J(a){return a?gg+2+30+30:dg.left+20}function K(a){return a?(Mh?Mh:0)+80:ig+8}function L(){return J(!wh)}function M(){return K(!wh)}function N(){return J(wh)}function O(){return K(wh)}function P(){var a,b,c,d,e,f=Ec(Nf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=Dg(b.x)-Dg(a.x),0===c?wh?ig:gg:(d=Dc(),e=he(Nf.data.targets)?(d-(Wi?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function Q(a){oj=a}function R(a){pj=a}function S(a){qj=a}function T(){return qh?nj?pj*(oj+1):kg:0}function U(){return qh?nj?lg:qj*(oj+1):0}function V(){var a,b,c=!Dg;vg=wh?1:0,wg=wh?ig:gg,xg=wh?0:ig,yg=wh?gg:1,zg=vg,Ag=wg,Bg=wh?0:jg,Cg=wh?hg:1,Dg=Y(vg,wg,c?void 0:Dg.domain(),function(){return Jg.tickOffset()}),Eg=Z(xg,yg,c?void 0:Eg.domain()),Fg=Z(xg,yg,c?void 0:Fg.domain()),Gg=Y(vg,wg,Hj,function(a){return a%1?0:Mg.tickOffset()}),Hg=Z(Bg,Cg,c?void 0:Hg.domain()),Ig=Z(Bg,Cg,c?void 0:Ig.domain()),a=db(),b=Hh?Hh:c?void 0:Jg.tickValues(),Jg=ab(Dg,ij,a,b),Mg=ab(Gg,lj,a,b),Kg=bb(Eg,jj,Vh,Xh),Lg=bb(Fg,kj,ci,ei),c||(vj.scale(Gg),Wf&&zj.scale(Dg)),W()}function W(){rg=Kb(),sg=Lb(),tg=Lb(.98)}function X(a,b,c){return(c?Mf.time.scale():Mf.scale.linear()).range([a,b])}function Y(a,b,c,d){var e,f=X(a,b,Vi),g=c?f.domain(c):f;Wi?(d=d||function(){return 0},f=function(a,b){var c=g(a)+d(a);return b?c:Math.ceil(c)}):f=function(a,b){var c=g(a);return b?c:Math.ceil(c)};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return Hj&&Hj[0]===a[0]&&Hj[1]a?a.toFixed(0):a};return Ch&&("function"==typeof Ch?a=Ch:Vi&&(a=function(a){return a?dj(Ch)(a):""})),a}function eb(a){var b;return"y"===a?b=Th:"y2"===a?b=ai:"x"===a&&(b=Oh),b}function fb(a){var b=eb(a);return"string"==typeof b?b:b?b.text:null}function gb(a,b){var c=eb(a);"string"==typeof c?"y"===a?Th=b:"y2"===a?ai=b:"x"===a&&(Oh=b):c&&(c.text=b)}function hb(a){return 10*Math.sin(Math.PI*(a/180))}function ib(a){return 11.5-2.5*(a/15)}function jb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",ib(c)).attr("x",hb(c)).attr("transform","rotate("+c+")")}function kb(a,b){var c=eb(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 lb(){return kb("x",wh?"inner-top":"inner-right")}function mb(){return kb("y",wh?"inner-right":"inner-top")}function nb(){return kb("y2",wh?"inner-right":"inner-top")}function ob(a){return"y2"===a?nb():"y"===a?mb():lb()}function pb(){return fb("x")}function qb(){return fb("y")}function rb(){return fb("y2")}function sb(a,b){return a?b.isLeft?0:b.isCenter?gg/2:gg:b.isBottom?-ig:b.isMiddle?-ig/2:0}function tb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function ub(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function vb(){return sb(!wh,lb())}function wb(){return sb(wh,mb())}function xb(){return sb(wh,nb())}function yb(){return tb(!wh,lb())}function zb(){return tb(wh,mb())}function Ab(){return tb(wh,nb())}function Bb(){var a=lb();return wh?a.isInner?"1.2em":-25-Hb("x"):a.isInner?"-0.5em":Mh?Mh-10:"3em"}function Cb(){var a=mb();return wh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Hb("y")}function Db(){var a=nb();return wh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Hb("y2")}function Eb(){return ub(!wh,lb())}function Fb(){return ub(wh,mb())}function Gb(){return ub(wh,nb())}function Hb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Ib(a){var b=Cj.select("."+g.axisX+" ."+g.axisXLabel),c=Cj.select("."+g.axisY+" ."+g.axisYLabel),d=Cj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",vb).attr("dx",yb).attr("dy",Bb).text(pb),(a?c.transition():c).attr("x",wb).attr("dx",zb).attr("dy",Cb).attr("dy",Cb).text(qb),(a?d.transition():d).attr("x",xb).attr("dx",Ab).attr("dy",Db).text(rb)}function Jb(a){var b=!1;return ug(Lc(Nf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Kb(){var a=Mf.svg.arc().outerRadius(mg).innerRadius(og),b=function(b,c){var d;return c?a(b):(d=Jb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Lb(a){var b=Mf.svg.arc().outerRadius(ng*(a?a:1)).innerRadius(og);return function(a){var c=Jb(a);return c?b(c):"M 0 0"}}function Mb(a,b){return se(a.data)?rg(a,b):"M 0 0"}function Nb(a){var b,c,d,e,f=Jb(a),g="";return f&&(b=rg.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*mg*.8+","+d/e*mg*.8+")"),g}function Ob(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Pb(a){return tc({id:a.data.id,value:a.value,ratio:Ob(a)})}function Qb(a){var b,c,d,e;return Tb()?(b=Jb(a),c=b?b.value:null,d=Ob(b),e=Ub(),e?e(c,d):Gd(c,d)):""}function Rb(a,b){var c=Aj.selectAll("."+g.chartArc+sd(a)),d=Aj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});ye(a)&&c.selectAll("path").transition().duration(50).attr("d",sg).transition().duration(100).attr("d",tg).each(function(a){re(a.data)}),b||d.style("opacity",.3)}function Sb(a){var b=Aj.selectAll("."+g.chartArc+sd(a));b.selectAll("path").transition().duration(50).attr("d",rg),Aj.selectAll("."+g.arc).style("opacity",1)}function Tb(){return ke(Nf.data.targets)?Ai:ui}function Ub(){return ke(Nf.data.targets)?Bi:vi}function Vb(){return ke(Nf.data.targets)?Di:""}function Wb(){var a=ke(Nf.data.targets)?Ei:xi;return"function"==typeof a?a:function(){}}function Xb(){var a=ke(Nf.data.targets)?Fi:yi;return"function"==typeof a?a:function(){}}function Yb(){var a=ke(Nf.data.targets)?Gi:zi;return"function"==typeof a?a:function(){}}function Zb(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Tg.length>0)for(g=Uc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return Mf.min(Object.keys(i).map(function(a){return Mf.min(i[a])}))}function $b(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Tg.length>0)for(g=Vc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return Mf.max(Object.keys(i).map(function(a){return Mf.max(i[a])}))}function _b(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return cb(a.id)===c}),m="y2"===c?$h:Rh,n="y2"===c?Zh:Qh,o=b(m)?m:Zb(l),p=b(n)?n:$b(l),q="y2"===c?_h:Sh,r=Ad()&&wh;return 0===l.length?"y2"===c?Fg.domain():Eg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=Bd(o,p),j=ec(Eg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Wh&&(f=b(Wh.top)?Wh.top:e,g=b(Wh.bottom)?Wh.bottom:e),"y2"===c&&di&&(f=b(di.top)?di.top:e,g=b(di.bottom)?di.bottom:e),he(l)&&!Uc(l)&&(g=o),[o-g,p+f])}function ac(a){return Kh?Vi?Ae(Kh):Kh:Mf.min(a,function(a){return Mf.min(a.values,function(a){return a.x})})}function bc(a){return Jh?Vi?Ae(Jh):Jh:Mf.max(a,function(a){return Mf.max(a.values,function(a){return a.x})})}function cc(a){var c,d,e,f,g=Fc(a),h=g[1]-g[0];return Wi?d=0:he(a)?(c=Dc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Lh&&Fe(Lh)?(e=b(Lh.left)?Lh.left:d,f=b(Lh.right)?Lh.right:d):e=f="number"==typeof Lh?Lh:d,{left:e,right:f}}function dc(a){var b=[ac(a),bc(a)],c=b[0],d=b[1],e=cc(a),f=0,g=0;return c-d!==0||Wi||(c=Vi?new Date(.5*c.getTime()):-.5,d=Vi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ec(a){return a[1]-a[0]}function fc(a){for(var b=0;bb?0:b-c}function lc(a){var b,c=jc(a),d="y"===a.axis?Eg:Fg;return b="y"===a.axis||"y2"===a.axis?wh?ig:"start"in a?d(a.start):ig:wh?"end"in a?Dg(Vi?Ae(a.end):a.end):ig:ig,c>b?0:b-c}function mc(a){return Ng&&a===Ng||Fe(Og)&&Ge(Og,a)}function nc(a){return!mc(a)}function oc(a){return Ng?Ng:Fe(Og)?Og[a]:null}function pc(a,b){var c,d=b&&Fe(b)?Gc(b):[];return d.forEach(function(b){oc(b)===a&&(c=Nf.data.xs[b])}),c}function qc(a,b){return a in Nf.data.xs&&Nf.data.xs[a]&&Nf.data.xs[a][b]?Nf.data.xs[a][b]:b}function rc(a){Object.keys(a).forEach(function(b){Og[b]=a[b]})}function sc(a){return 1===Mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function tc(a){var b;return a&&(b=Rg[a.id],a.name=b?b:a.id),a}function uc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=wc(b[d],a.id,d)}),Nf.data.xs[a.id]=b})}function vc(a,b){a.forEach(function(a){b[a.id]&&uc([a],b[a.id])})}function wc(a,c,d){var e;return e=Vi?a?a instanceof Date?a:Ae(a):Ae(qc(c,d)):Xi&&!Wi?b(a)?+a:qc(c,d):d}function xc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Ng?(d=Object.keys(Nf.data.xs),Nf.data.xs[c]=d.length>0?Nf.data.xs[d[0]]:void 0):Fe(Og)&&(Nf.data.xs[c]=pc(f,Nf.data.targets)):Nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Qg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=oc(b),g=a[f],h=wc(g,b,e);return Xi&&Wi&&0===c&&g&&(0===e&&(Ah=[]),Ah.push(g)),("undefined"==typeof a[b]||Nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Vg&&fe(Gc(c).filter(function(a){return!(a in Wg)}),Vg),c.forEach(function(a){gc(a.id_org,a)}),c}function Ac(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 Bc(a){return a>0&&Nf.data.targets[0].values[a-1]?Nf.data.targets[0].values[a-1].x:void 0}function Cc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Fc(a){var b,c,d=Ec(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Gc(a){return a.map(function(a){return a.id})}function Hc(a){return a?"string"==typeof a?[a]:a:Gc(Nf.data.targets)}function Ic(a,b){var c,d=Gc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Vi?new Date(i):i);j.push(e)}return Vi||(j=j.sort(function(a,b){return a-b})),j}function Oc(a){fj=fj.concat(a)}function Pc(a){fj=fj.filter(function(b){return a.indexOf(b)<0})}function Qc(a){gj=gj.concat(a)}function Rc(a){gj=gj.filter(function(b){return a.indexOf(b)<0})}function Sc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Tc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Vc(a){return Tc(a,function(a){return a>0})}function Wc(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||0===a[f].x)&&(e=e.concat(Md(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Md(a,g))),Pd(e,b)):Nd(a,b,f,g)}function Od(a,b){var c;return c=a.map(function(a){return Nd(a.values,b)}),Pd(c,b)}function Pd(a,b){var c,d;return a.forEach(function(a){var e=He(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Qd(a,b){return Mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Rd(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 Sd(){return Yg&&"desc"===Yg.toLowerCase()}function Td(){return Yg&&"asc"===Yg.toLowerCase()}function Ud(a){var b=Td(),c=Sd();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 Yg&&a.sort(Yg),a}function Vd(a,c){var d,e,f,g,h,i,j,k=le(Nf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&Ii&&(Fj.html(Li(a,db(),Cd(k),cj)).style("display","block"),d=Fj.property("offsetWidth"),e=Fj.property("offsetHeight"),k?(g=gg/2+c[0],i=ig/2+c[1]+20):(wh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-y(),i=Dg(l[0].x)+20):(f=s(),g=f+x()+Dg(l[0].x)+20,h=g+d,j=f+t()-y(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),Fj.style("top",i+"px").style("left",g+"px"))}function Wd(){Fj.style("display","none")}function Xd(a){var c=a.filter(function(a){return a&&b(a.value)});if(Ii&&!ie(Nf.data.targets)&&!le(Nf.data.targets)){var d=Cj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(wh?"y1":"x1",Id).attr(wh?"y2":"x2",Id),pf(d,"grid")}}function Yd(){Cj.select("line."+g.xgridFocus).style("visibility","hidden")}function Zd(a,b){var c,d,e,f,h=[],i=Cj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=dc(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function $d(a){return a.x||0===a.x?Dg(a.x):null}function _d(a){return $(a.id)(a.value)}function ae(){var a,b,d={},e=0;return Lc(Nf.data.targets.filter(oe)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ee(a,b){return"number"==typeof si?si:b?2*a.tickOffset()*ti/b:0}function fe(a,b){Hc(a).forEach(function(a){Jj[a]=b===Wg[a],Wg[a]=b})}function ge(a,b){var c=!1;return a.forEach(function(a){Wg[a.id]===b&&(c=!0),a.id in Wg||"line"!==b||(c=!0)}),c}function he(a){return ge(a,"bar")}function ie(a){return ge(a,"scatter")}function je(a){return ge(a,"pie")}function ke(a){return ge(a,"donut")}function le(a){return je(a)||ke(a)}function me(a){var b="string"==typeof a?a:a.id;return!(b in Wg)||"line"===Wg[b]||"spline"===Wg[b]||"area"===Wg[b]||"area-spline"===Wg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"spline"===Wg[b]||"area-spline"===Wg[b]}function oe(a){var b="string"==typeof a?a:a.id;return"bar"===Wg[b]}function pe(a){var b="string"==typeof a?a:a.id;return"scatter"===Wg[b]}function qe(a){var b="string"==typeof a?a:a.id;return"pie"===Wg[b]}function re(a){var b="string"==typeof a?a:a.id;return"donut"===Wg[b]}function se(a){return qe(a)||re(a)}function te(a){return me(a)?[a]:[]}function ue(a){return se(a.data)?[a]:[]}function ve(a){return oe(a)?a.values:[]}function we(a){return me(a)||pe(a)?a.values:[]}function xe(a){return oe(a)||me(a)?a.values:[]}function ye(a){return re(a)&&Ci||qe(a)&&wi}function ze(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function Ae(b){var c;try{c=Pg?Mf.time.format(Pg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Pg)}return c}function Be(a,b){var c=Mf.mouse(a),d=Mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ge(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function He(a,b){var c="y"===cb(a.id)?Eg:Fg,d=wh?1:0,e=wh?0:1;return Math.pow(Dg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ie(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Je(a,b,c){return d(a[b])?a[b]:c}function Ke(a){return 10*Math.ceil(a/10)}function Le(a,b,c){jh(b,a.node()),Cj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Xc(g.selectedCircle,c)}).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d).attr("stroke",function(){return cj(b)}).attr("r",1.4*We(b)).transition().duration(100).attr("r",We)}function Me(a,b,c){kh(b,a.node()),Cj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ne(a,b,c,d){a?Le(b,c,d):Me(b,c,d)}function Oe(a,b){jh(b,a.node()),a.transition().duration(100).style("fill",function(){return Mf.rgb(cj(b)).brighter(.75)})}function Pe(a,b){kh(b,a.node()),a.transition().duration(100).style("fill",function(){return cj(b)})}function Qe(a,b,c,d){a?Oe(b,c,d):Pe(b,c,d)}function Re(a,b,c,d){Qe(a,b,c.data,d)}function Se(a){return"circle"===a.nodeName?Ne:Mf.select(a).classed(g.bar)?Qe:Re}function Te(a){return a.filter(function(a){return b(a.value)})}function Ue(a){return li?"function"==typeof mi?mi(a):mi:0}function Ve(a){return oi?pi?pi:1.75*Ue(a):Ue(a)}function We(a){return qi?qi:4*Ue(a)}function Xe(a,c){return(c?Cj.selectAll("."+g.circles+rd(c)):Cj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ye(a,b){Xe(a,b).classed(g.EXPANDED,!0).attr("r",Ve)}function Ze(a){Xe(a).filter(function(){return Mf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Ue)}function $e(a){return Cj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function _e(a){$e(a).classed(g.EXPANDED,!0)}function af(a){$e(a).classed(g.EXPANDED,!1)}function bf(a,b){var c=ff(a,b);return function(a,b){var d=c(a,b),e=wh?1:0,f=wh?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 cf(a,b){var c=ff(a,!1),d=b?df:ef;return function(a,b){return d(c(a,b),a,this)}}function df(a,b){var c;return wh?(c=oe(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function ef(a,b,c){var d=c.getBoundingClientRect();return wh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:oe(b)?-3:-6)}function ff(a,b){var c=a.__max__+1,d=ee(Jg,c),e=be(d,c,a,!!b),f=ce(!!b),g=de(a,!!b),h=b?_:$;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return wh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function gf(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function hf(b){var c,d,e;if(Gj=Mf.select(Pf),Gj.empty())throw new Error("Element to bind not found");if(Gj.html("").classed("c3",!0),Nf.data.xs={},Nf.data.targets=zc(b),bh&&(Nf.data.targets=Nf.data.targets.filter(bh)),ah&&Oc(ah===!0?Gc(Nf.data.targets):ah),p(),V(),Dg.domain(Mf.extent(dc(Nf.data.targets))),Eg.domain(_b(Nf.data.targets,"y")),Fg.domain(_b(Nf.data.targets,"y2")),Gg.domain(Dg.domain()),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Hj=Dg.domain(),vj.scale(Gg),Wf&&zj.scale(Dg),Aj=Gj.append("svg").style("overflow","hidden").on("mouseenter",$f).on("mouseleave",_f),Bj=Aj.append("defs"),Bj.append("clipPath").attr("id",Pi).append("rect"),Bj.append("clipPath").attr("id",Qi).append("rect"),Bj.append("clipPath").attr("id",Ri).append("rect"),uf(),Cj=Aj.append("g").attr("transform",mj.main),Dj=Aj.append("g").attr("transform",mj.context),Ej=Aj.append("g").attr("transform",mj.legend),nh||Dj.style("visibility","hidden"),qh||(Ej.style("visibility","hidden"),gj=Gc(Nf.data.targets)),Fj=Gj.style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Hf(Gc(Nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=Cj.append("g").attr("clip-path",Si).attr("class",g.grid),fi&&d.append("g").attr("class",g.xgrids),Fe(hi)&&d.append("g").attr("class",g.xgridLines),ni&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),ii&&d.append("g").attr("class",g.ygrids),Fe(ji)&&d.append("g").attr("class",g.ygridLines),Cj.append("g").attr("clip-path",Si).attr("class",g.regions),Cj.append("g").attr("clip-path",Si).attr("class",g.chart),c=Cj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Wf?wh?"ns-resize":"ew-resize":null),Cj.select("."+g.chart).append("g").attr("class",g.chartBars),Cj.select("."+g.chart).append("g").attr("class",g.chartLines),Cj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",mj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Vb()),Cj.select("."+g.chart).append("g").attr("class",g.chartTexts),Wf&&Cj.insert("rect",Yf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",gg).attr("height",ig).style("opacity",0).style("cursor",wh?"ns-resize":"ew-resize").call(zj).on("dblclick.zoom",null),Nh&&vj.extent("function"!=typeof Nh?Nh:Nh(dc())),hj.x=Cj.append("g").attr("class",g.axisX).attr("clip-path",Ti).attr("transform",mj.x).style("visibility",xh?"visible":"hidden"),hj.x.append("text").attr("class",g.axisXLabel).attr("transform",wh?"rotate(-90)":"").style("text-anchor",Eb),hj.y=Cj.append("g").attr("class",g.axisY).attr("clip-path",Ui).attr("transform",mj.y).style("visibility",Ph?"visible":"hidden"),hj.y.append("text").attr("class",g.axisYLabel).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Fb),hj.y2=Cj.append("g").attr("class",g.axisY2).attr("transform",mj.y2).style("visibility",Yh?"visible":"hidden"),hj.y2.append("text").attr("class",g.axisY2Label).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Gb),Dj.append("g").attr("clip-path",Si).attr("class",g.chart),Dj.select("."+g.chart).append("g").attr("class",g.chartBars),Dj.select("."+g.chart).append("g").attr("class",g.chartLines),Dj.append("g").attr("clip-path",Si).attr("class",g.brush).call(vj).selectAll("rect").attr(wh?"width":"height",wh?hg:jg),hj.subx=Dj.append("g").attr("class",g.axisX).attr("transform",mj.subx).attr("clip-path",wh?"":Ti),xf(Nf.data.targets),qf({withUpdateTranslate:!0,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Mi){if(Vi&&"string"==typeof Ni){for(Ni=Ae(Ni),e=0;e0){d=[];for(var f in Rg)for(c=0;cf&&h>c&&d>i&&j>d;else{if(!n.classed(g.bar))return;m=Rd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Qe,q=!(c>h||f>c+e||d>j||i>d+k)}q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function nf(a){le(Nf.data.targets)||ch&&(Yi=a,Cj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Zi=!0,lh())}function of(){le(Nf.data.targets)||ch&&(Cj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),Cj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Zi=!1,mh())}function pf(a,b){"grid"===b&&a.each(function(){var a=Mf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function qf(a,c){var d,e,f,h,i,j,k,l,m,n,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,Q,R,S,T,U,W,X,Y,Z,$=ae(),_=le(Nf.data.targets),ab=Lc(Nf.data.targets);if(a=a||{},E=Je(a,"withY",!0),F=Je(a,"withSubchart",!0),G=Je(a,"withTransition",!0),J=Je(a,"withTransform",!1),K=Je(a,"withUpdateXDomain",!1),L=Je(a,"withUpdateOrgXDomain",!1),N=Je(a,"withUpdateTranslate",!1),M=Je(a,"withLegend",!1),H=Je(a,"withTransitionForExit",G),I=Je(a,"withTransitionForAxis",G),T=G?cg:0,U=H?T:0,W=I?T:0,c=c||vf(W),N&&(wh?(hj.x.call(Jg),hj.subx.call(Mg)):(hj.y.call(Kg),hj.y2.call(Lg)),p(),V(),uf(),o(!1)),M&&qh&&Hf(Gc(Nf.data.targets),a,c),Wi&&0===ab.length&&Dg.domain([0,hj.x.selectAll(".tick").size()]),ab.length&&(L&&(Dg.domain(Mf.extent(dc(ab))),Hj=Dg.domain(),Wf&&zj.scale(Dg).updateScaleExtent(),Gg.domain(Dg.domain()),vj.scale(Gg)),K&&(Dg.domain(vj.empty()?Hj:vj.extent()),Wf&&zj.scale(Dg).updateScaleExtent()),Hh||!Gh&&!Fh||(X=Nc(Mc(ab),Fh),Jg.tickValues(X),Mg.tickValues(X))),Eg.domain(_b(ab,"y")),Fg.domain(_b(ab,"y2")),hj.x.style("opacity",_?0:1),hj.y.style("opacity",_?0:1),hj.y2.style("opacity",_?0:1),hj.subx.style("opacity",_?0:1),c.axisX.call(Jg),c.axisY.call(Kg),c.axisY2.call(Lg),c.axisSubX.call(Mg),Ib(G),K&&ab.length)if(Dh&&X){for(Y=1;Y=0&&Mf.select(this).style("display",b%Z?"none":"block")})}else Aj.selectAll("."+g.axisX+" .tick text").style("display","block");!wh&&Ih&&jb(hj.x,c.axisX,Ih),O=bf($),R=cf($,!0),S=cf($,!1),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Fj.style("display","none"),q(),Cj.select("line."+g.xgridFocus).style("visibility","hidden"),fi&&(f=Zd(gi,Dg),B=Wi?Jg.tickOffset():0,e=wh?{x1:0,x2:gg,y1:function(a){return Dg(a)-B},y2:function(a){return Dg(a)-B}}:{x1:function(a){return Dg(a)+B},x2:function(a){return Dg(a)+B},y1:dg.top,y2:ig},d=Cj.select("."+g.xgrids).selectAll("."+g.xgrid).data(f),d.enter().append("line").attr("class",g.xgrid),d.attr(e).style("opacity",function(){return+Mf.select(this).attr(wh?"y1":"x1")===(wh?ig:0)?0:1}),d.exit().remove()),Fe(hi)&&(h=Cj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(hi),i=h.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),i.append("line").style("opacity",0),i.append("text").attr("text-anchor","end").attr("transform",wh?"":"rotate(-90)").attr("dx",wh?0:-dg.top).attr("dy",-5).style("opacity",0),h.select("line").transition().duration(T).attr("x1",wh?0:Jd).attr("x2",wh?gg:Jd).attr("y1",wh?Jd:dg.top).attr("y2",wh?Jd:ig).style("opacity",1),h.select("text").transition().duration(T).attr("x",wh?gg:0).attr("y",Jd).text(function(a){return a.text}).style("opacity",1),h.exit().transition().duration(T).style("opacity",0).remove()),E&&ii&&(j=Cj.select("."+g.ygrids).selectAll("."+g.ygrid).data(Eg.ticks(ki)),j.enter().append("line").attr("class",g.ygrid),j.attr("x1",wh?Eg:0).attr("x2",wh?Eg:gg).attr("y1",wh?0:Eg).attr("y2",wh?ig:Eg),j.exit().remove(),pf(j,"grid")),E&&Fe(ji)&&(k=Cj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(ji),l=k.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",wh?"rotate(-90)":"").attr("dx",wh?0:-dg.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",wh?Kd:0).attr("x2",wh?Kd:gg).attr("y1",wh?0:Kd).attr("y2",wh?ig:Kd).style("opacity",1),k.select("text").transition().duration(T).attr("x",wh?0:gg).attr("y",Kd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),u=Cj.select("."+g.regions).selectAll("."+g.region).data(Hi),u.enter().append("g").attr("class",kd).append("rect").style("fill-opacity",0),u.selectAll("rect").transition().duration(T).attr("x",ic).attr("y",jc).attr("width",kc).attr("height",lc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),u.exit().transition().duration(T).style("opacity",0).remove(),s=Cj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),s.enter().append("path").attr("class",ed).style("stroke","none").style("fill",cj),s.style("opacity",wd).transition().duration(T).attr("d",O).style("fill",cj).style("opacity",1),s.exit().transition().duration(U).style("opacity",0).remove(),m=Cj.selectAll("."+g.lines).selectAll("."+g.line).data(te),m.enter().append("path").attr("class",ad).style("stroke",cj),m.style("opacity",wd).transition().duration(T).attr("d",wj).style("stroke",cj).style("opacity",1),m.exit().transition().duration(U).style("opacity",0).remove(),n=Cj.selectAll("."+g.areas).selectAll("."+g.area).data(te),n.enter().append("path").attr("class",id).style("fill",cj).style("opacity",function(){return Ij=+Mf.select(this).style("opacity"),0}),n.style("opacity",0).transition().duration(T).attr("d",xj).style("fill",cj).style("opacity",Ij),n.exit().transition().duration(U).style("opacity",0).remove(),r=Cj.selectAll("."+g.circles).selectAll("."+g.circle).data(we),r.enter().append("circle").attr("class",cd).attr("r",Ue).style("fill",cj),r.style("opacity",wd).transition().duration(T).style("opacity",yd).style("fill",cj).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d),r.exit().remove(),v=Cj.selectAll("."+g.texts).selectAll("."+g.text).data(xe),v.enter().append("text").attr("class",Yc).attr("text-anchor",function(a){return wh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",cj).style("fill-opacity",0),v.text(function(a){return Hd(a.id)(a.value,a.id)}).style("fill-opacity",xd).transition().duration(T).attr("x",R).attr("y",S).style("fill",cj).style("fill-opacity",zd),v.exit().transition().duration(U).style("fill-opacity",0).remove(),t=Cj.selectAll("."+g.arcs).selectAll("."+g.arc).data(ue),t.enter().append("path").attr("class",gd).style("fill",function(a){return cj(a.data)}).style("cursor",function(a){return eh(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;aj||(c=Jb(a),d=Pb(c),e=Xb(),Rb(c.data.id),Df(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Jb(a),c=Pb(b),d=[c];Vd(d,Mf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;aj||(c=Jb(a),d=Pb(c),e=Yb(),Sb(c.data.id),Ef(),Wd(),e(d,b))}).on("click",function(a,b){var c=Jb(a),d=Pb(c),e=Wb();lf(this,a,b),e(d,b)}),t.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){aj=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Jb(a);return c?(b=Mf.interpolate(this._current,c),this._current=b(0),function(a){return Mb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("fill",function(a){return cj(a.data)}).style("opacity",1).call(Ie,function(){aj=!1}),t.exit().transition().duration(U).style("opacity",0).remove(),Cj.selectAll("."+g.chartArc).select("text").attr("transform",Nb).style("opacity",0).transition().duration(T).text(Qb).style("opacity",function(a){return Jc(a.data.id)&&se(a.data)?1:0}),Cj.select("."+g.chartArcsTitle).style("opacity",ke(Nf.data.targets)?1:0),nh&&(Mf.event&&"zoom"===Mf.event.type&&vj.extent(Dg.orgDomain()).update(),F&&(!wh&&Ih&&jb(hj.subx,c.axisSubX,Ih),vj.empty()||vj.extent(Dg.orgDomain()).update(),Q=bf($,!0),x=Dj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),x.enter().append("path").attr("class",ed).style("stroke","none").style("fill",cj),x.style("opacity",wd).transition().duration(T).attr("d",Q).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove(),w=Dj.selectAll("."+g.lines).selectAll("."+g.line).data(te),w.enter().append("path").attr("class",ad).style("stroke",cj),w.style("opacity",wd).transition().duration(T).attr("d",yj).style("opacity",1),w.exit().transition().duration(T).style("opacity",0).remove())),Cj.selectAll("."+g.selectedCircles).filter(function(a){return oe(a)}).selectAll("circle").remove(),Cj.selectAll("."+g.selectedCircle).transition().duration(T).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d),Zf&&(y=Cj.select("."+g.eventRects),Fe(Og)&&!sc(Og)?(y.classed(g.eventRectsMultiple)||y.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),z=Cj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),kf(z.enter()),z.attr("x",0).attr("y",0).attr("width",gg).attr("height",ig)):(y.classed(g.eventRectsSingle)||y.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Xi&&!Wi?(D=function(a,b){var c=Bc(b),d=Cc(b),e=Nf.data.xs[a.id][b];return(Dg(d?d:e+50)-Dg(c?c:e-50))/2},C=function(a,b){var c=Bc(b),d=Nf.data.xs[a.id][b];return(Dg(d)+Dg(c?c:d-50))/2}):(D=P(),C=function(a){return Dg(a.x)-D/2}),A=Ec(Nf.data.targets),Cj.select("."+g.eventRects).datum(A?A.values:[]),z=Cj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),jf(z.enter()),z.attr("class",ld).attr("x",wh?0:C).attr("y",wh?C:0).attr("width",wh?gg:D).attr("height",wh?D:ig),z.exit().remove())),Gc(Nf.data.targets).forEach(function(a){Jj[a]=!0})}function rf(){qf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function sf(){if(0!==Lc(Nf.data.targets).length){if("mousemove"===Mf.event.sourceEvent.type&&zj.altDomain)return Dg.domain(zj.altDomain),void zj.scale(Dg).updateScaleExtent();Wi&&Dg.orgDomain()[0]===Hj[0]&&Dg.domain([Hj[0]-1e-10,Dg.orgDomain()[1]]),qf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Mf.event.sourceEvent.type&&($i=!0)}}function tf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function uf(){Aj.attr("width",kg).attr("height",lg),Aj.select("#"+Pi).select("rect").attr("width",gg).attr("height",ig),Aj.select("#"+Qi).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),Aj.select("#"+Ri).select("rect").attr("x",H).attr("y",I).attr("width",N).attr("height",O),Aj.select("."+g.zoomRect).attr("width",gg).attr("height",ig),Gj.style("max-height",lg+"px")}function vf(a){return{axisX:a?hj.x.transition().duration(a):hj.x,axisY:a?hj.y.transition().duration(a):hj.y,axisY2:a?hj.y2.transition().duration(a):hj.y2,axisSubX:a?hj.subx.transition().duration(a):hj.subx}}function wf(a){var b;a=a||{},a.withTransition=Je(a,"withTransition",!0),a.withTransform=Je(a,"withTransform",!1),a.withLegend=Je(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withLegend&&qh||(b=vf(a.withTransitionForAxis?cg:0),p(),V(),uf(),o(a.withTransition,b)),qf(a,b)}function xf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=Cj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",nd),j=i.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Zc),e=Cj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),d=e.enter().append("g").attr("class",pd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",fd).style("cursor",function(a){return eh(a)?"pointer":null}),c=Cj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),b=c.enter().append("g").attr("class",od).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",bd),b.append("g").attr("class",jd),b.append("g").attr("class",function(a){return Xc(g.selectedCircles,a.id)}),b.append("g").attr("class",dd).style("cursor",function(a){return eh(a)?"pointer":null}),a.forEach(function(a){Cj.selectAll("."+g.selectedCircles+rd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Cj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(ug(a)).attr("class",qd),f=h.enter().append("g").attr("class",qd),f.append("g").attr("class",hd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),nh&&(n=Dj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),m=n.enter().append("g").style("opacity",0).attr("class",pd),m.append("g").attr("class",fd),l=Dj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),k=l.enter().append("g").style("opacity",0).attr("class",od),k.append("g").attr("class",bd)),Aj.selectAll("."+g.target).filter(function(a){return Jc(a.id)}).transition().duration(cg).style("opacity",1)}function yf(a,b){b.filter&&(a=a.filter(b.filter)),(b.type||b.types)&&a.forEach(function(a){b.types?fe(a.id,b.types[a.id]):fe(a.id,b.type)}),Nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,z=0,F++)),E[a]=F,D[F]=f,A[a]=z,z+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+v)/10),j=10*Math.ceil((h.height+u)/10),k=nj?j:i,l=nj?U():T();return d&&(z=0,F=0,w=0,x=0),qh&&!Kc(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=i,C[c]=j,(!w||i>=w)&&(w=i),(!x||j>=x)&&(x=j),g=nj?x:w,void(vh?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(l-g*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=26,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=Ej.selectAll("."+g.legendItemFocused).size();b=b||{},n=Je(b,"withTransition",!0),q=Je(b,"withTransitionForTransform",!0),nj?(f=function(a){return w*E[a]},j=function(a){return D[E[a]]+A[a]}):(f=function(a){return D[E[a]]+A[a]},j=function(a){return x*E[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=Ej.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Xc(g.legendItem,a)}).style("visibility",function(a){return Kc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof sh?sh(a):Nf.toggle(a)}).on("mouseover",function(a){Mf.select(this).classed(g.legendItemFocused,!0),aj||Nf.focus(a),"function"==typeof th&&th(a)}).on("mouseout",function(a){Mf.select(this).classed(g.legendItemFocused,!1),aj||Nf.revert(),"function"==typeof uh&&uh(a)}),m.append("text").text(function(a){return d(Rg[a])?Rg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",nj?h:-200).attr("y",nj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",nj?i:-200).attr("y",nj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",cj).attr("x",nj?h:-200).attr("y",nj?-200:j).attr("width",10).attr("height",10),r=Ej.selectAll("text").data(a).text(function(a){return d(Rg[a])?Rg[a]:a}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=Ej.selectAll("rect."+g.legendItemEvent).data(a),(n?s.transition():s).attr("width",function(a){return B[a]}).attr("height",function(a){return C[a]}).attr("x",i).attr("y",l),t=Ej.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",cj).attr("x",f).attr("y",j),Ej.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Jc(a)}).transition().style("opacity",function(a){var b=Mf.select(this);return Jc(a)?!G||b.classed(g.legendItemFocused)?Bf(b):Cf(b):rj}),R(w),S(x),Q(F),p(),V(),uf(),o(q,c)}function If(a){return Ic(Nf.data.targets,a.id)}function Jf(a){return"data"in a&&Ic(Nf.data.targets,a.data.id)}function Kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function Lf(a,b,c){var d=!le(Nf.data.targets);aj=!1,fe(a,b),wf(c||{withTransitionForAxis:d})}var Mf=a.d3?a.d3:"undefined"!=typeof require?require("d3"):void 0,Nf={data:{},axis:{},legend:{}},Of={},Pf=i(["bindto"],"#chart"),Qf=i(["size","width"]),Rf=i(["size","height"]),Sf=i(["padding","left"]),Tf=i(["padding","right"]),Uf=i(["padding","top"]),Vf=i(["padding","bottom"]),Wf=i(["zoom","enabled"],!1),Xf=i(["zoom","extent"]),Yf=i(["zoom","privileged"],!1),Zf=i(["interaction","enabled"],!0),$f=i(["onenter"],function(){}),_f=i(["onleave"],function(){}),ag=i(["onresize"],function(){}),bg=i(["onresized"],function(){}),cg=i(["transition","duration"],350);h("data","data is required in config");var dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg,Kg,Lg,Mg,Ng=i(["data","x"]),Og=i(["data","xs"],{}),Pg=i(["data","x_format"]),Qg=i(["data","id_converter"],function(a){return a}),Rg=i(["data","names"],{}),Sg=i(["data","classes"],{}),Tg=i(["data","groups"],[]),Ug=i(["data","axes"],{}),Vg=i(["data","type"]),Wg=i(["data","types"],{}),Xg=i(["data","labels"],{}),Yg=i(["data","order"]),Zg=i(["data","regions"],{}),$g=i(["data","color"]),_g=i(["data","colors"],{}),ah=i(["data","hide"],!1),bh=i(["data","filter"]),ch=i(["data","selection","enabled"],!1),dh=i(["data","selection","grouped"],!1),eh=i(["data","selection","isselectable"],function(){return!0}),fh=i(["data","selection","multiple"],!0),gh=i(["data","onclick"],function(){}),hh=i(["data","onenter"],function(){}),ih=i(["data","onleave"],function(){}),jh=i(["data","onselected"],function(){}),kh=i(["data","onunselected"],function(){}),lh=i(["data","ondragstart"],function(){}),mh=i(["data","ondragend"],function(){}),nh=i(["subchart","show"],!1),oh=i(["subchart","size","height"],60),ph=i(["color","pattern"],[]),qh=i(["legend","show"],!0),rh=i(["legend","position"],"bottom"),sh=i(["legend","item","onclick"]),th=i(["legend","item","onmouseover"]),uh=i(["legend","item","onmouseout"]),vh=i(["legend","equally"],!1),wh=i(["axis","rotated"],!1),xh=i(["axis","x","show"],!0),yh=i(["axis","x","type"],"indexed"),zh=i(["axis","x","localtime"],!0),Ah=i(["axis","x","categories"],[]),Bh=i(["axis","x","tick","centered"],!1),Ch=i(["axis","x","tick","format"]),Dh=i(["axis","x","tick","culling"],{}),Eh=i(["axis","x","tick","culling","max"],10),Fh=i(["axis","x","tick","count"]),Gh=i(["axis","x","tick","fit"],!0),Hh=i(["axis","x","tick","values"],null),Ih=i(["axis","x","tick","rotate"]),Jh=i(["axis","x","max"],null),Kh=i(["axis","x","min"],null),Lh=i(["axis","x","padding"],{}),Mh=i(["axis","x","height"]),Nh=i(["axis","x","default"]),Oh=i(["axis","x","label"],{}),Ph=i(["axis","y","show"],!0),Qh=i(["axis","y","max"]),Rh=i(["axis","y","min"]),Sh=i(["axis","y","center"]),Th=i(["axis","y","label"],{}),Uh=i(["axis","y","inner"],!1),Vh=i(["axis","y","tick","format"]),Wh=i(["axis","y","padding"]),Xh=i(["axis","y","ticks"],10),Yh=i(["axis","y2","show"],!1),Zh=i(["axis","y2","max"]),$h=i(["axis","y2","min"]),_h=i(["axis","y2","center"]),ai=i(["axis","y2","label"],{}),bi=i(["axis","y2","inner"],!1),ci=i(["axis","y2","tick","format"]),di=i(["axis","y2","padding"]),ei=i(["axis","y2","ticks"],10),fi=i(["grid","x","show"],!1),gi=i(["grid","x","type"],"tick"),hi=i(["grid","x","lines"],[]),ii=i(["grid","y","show"],!1),ji=i(["grid","y","lines"],[]),ki=i(["grid","y","ticks"],10),li=i(["point","show"],!0),mi=i(["point","r"],2.5),ni=i(["point","focus","line","enabled"],!0),oi=i(["point","focus","expand","enabled"],!0),pi=i(["point","focus","expand","r"]),qi=i(["point","focus","select","r"]),ri=i(["line","connect_null"],!1),si=i(["bar","width"]),ti=i(["bar","width","ratio"],.6),ui=i(["pie","label","show"],!0),vi=i(["pie","label","format"]),wi=i(["pie","expand"],!0),xi=i(["pie","onclick"],function(){}),yi=i(["pie","onmouseover"],function(){}),zi=i(["pie","onmouseout"],function(){}),Ai=i(["donut","label","show"],!0),Bi=i(["donut","label","format"]),Ci=i(["donut","expand"],!0),Di=i(["donut","title"],""),Ei=i(["donut","onclick"],function(){}),Fi=i(["donut","onmouseover"],function(){}),Gi=i(["donut","onmouseout"],function(){}),Hi=i(["regions"],[]),Ii=i(["tooltip","show"],!0),Ji=i(["tooltip","format","title"]),Ki=i(["tooltip","format","value"]),Li=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Ji?Ji:b,l=Ki?Ki:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Mi=i(["tooltip","init","show"],!1),Ni=i(["tooltip","init","x"],0),Oi=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Pi=("string"==typeof Pf?Pf.replace(/[# .>~+]/g,""):g.chart+ +new Date)+"-clip",Qi=Pi+"-xaxis",Ri=Pi+"-yaxis",Si=j(Pi),Ti=j(Qi),Ui=j(Ri),Vi="timeseries"===yh,Wi="categorized"===yh,Xi=!Vi&&(Ng||Fe(Og)),Yi=null,Zi=!1,$i=!1,_i=!1,aj=!1,bj=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],cj=ze(_g,Fe(ph)?ph:bj,$g),dj=zh?Mf.time.format:Mf.time.format.utc,ej=dj.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),fj=[],gj=[],hj={},ij=wh?"left":"bottom",jj=wh?Uh?"top":"bottom":Uh?"right":"left",kj=wh?bi?"bottom":"top":bi?"left":"right",lj=wh?"left":"bottom",mj={main:function(){return"translate("+k(dg.left)+","+k(dg.top)+")"},context:function(){return"translate("+k(eg.left)+","+k(eg.top)+")"},legend:function(){return"translate("+fg.left+","+fg.top+")" },x:function(){return"translate(0,"+(wh?0:ig)+")"},y:function(){return"translate(0,"+(wh?ig:0)+")"},y2:function(){return"translate("+(wh?0:gg)+","+(wh?1:0)+")"},subx:function(){return"translate(0,"+(wh?0:jg)+")"},arc:function(){return"translate("+pg/2+","+qg/2+")"}},nj="right"===rh,oj=0,pj=0,qj=0,rj=.15,sj=30,tj=wh&&!xh?0:30,uj=5;ug=Mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var vj,wj=function(){var a=Mf.svg.line().x(wh?function(a){return $(a.id)(a.value)}:Id).y(wh?Id:function(a){return $(a.id)(a.value)});return ri||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ri?Te(b.values):b.values;return me(b)?(a.interpolate(ne(b)?"cardinal":"linear"),Zg[b.id]?gf(e,Dg,$(b.id),Zg[b.id]):a(e)):(c=e[0]?Dg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,wh?"M "+d+" "+c:"M "+c+" "+d)}}(),xj=function(){var a;return a=wh?Mf.svg.area().x0(function(a){return $(a.id)(0)}).x1(function(a){return $(a.id)(a.value)}).y(Id):Mf.svg.area().x(Id).y0(function(a){return $(a.id)(0)}).y1(function(a){return $(a.id)(a.value)}),function(b){var c,d,e=Te(b.values);return ge([b],"area")||ge([b],"area-spline")?(a.interpolate(ne(b)?"cardinal":"linear"),a(e)):(c=e[0]?Dg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,wh?"M "+d+" "+c:"M "+c+" "+d)}}(),yj=function(){var a=Mf.svg.line().x(wh?function(a){return _(a.id)(a.value)}:Ld).y(wh?Ld:function(a){return _(a.id)(a.value)});return function(b){var c=Te(b.values);return me(b)?a(c):"M "+Gg(c[0].x)+" "+_(b.id)(c[0].value)}}(),zj=function(){};vj=Mf.svg.brush().on("brush",rf),vj.update=function(){return Dj&&Dj.select("."+g.brush).call(this),this},vj.scale=function(a){return wh?this.y(a):this.x(a)},Wf&&(zj=Mf.behavior.zoom().on("zoomstart",function(){zj.altDomain=Mf.event.sourceEvent.altKey?Dg.orgDomain():null}).on("zoom",Wf?sf:null),zj.scale=function(a){return wh?this.y(a):this.x(a)},zj.orgScaleExtent=function(){var a=Xf?Xf:[1,10];return[a[0],Math.max(Dc()/a[1],a[1])]},zj.updateScaleExtent=function(){var a=ec(Dg.orgDomain())/ec(Hj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Aj,Bj,Cj,Dj,Ej,Fj,Gj,Hj,Ij,Jj={};if(Nf.focus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);Nf.revert(),Nf.defocus(),b(d.classed(g.focused,!0)),b(e),le(Nf.data.targets)&&Rb(a,!0),Df(a,!0)},Nf.defocus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",.3)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);Nf.revert(),b(d.classed(g.focused,!1)),b(e),le(Nf.data.targets)&&Sb(a),Df(a,!1)},Nf.revert=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);b(d.classed(g.focused,!1)),b(e),le(Nf.data.targets)&&Sb(a),Ef()},Nf.show=function(a,b){a=Hc(a),b=b||{},Pc(a),Aj.selectAll(td(a)).transition().style("opacity",1),b.withLegend&&Ff(a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Nf.hide=function(a,b){a=Hc(a),b=b||{},Oc(a),Aj.selectAll(td(a)).transition().style("opacity",0),b.withLegend&&Gf(a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Nf.toggle=function(a){Jc(a)?Nf.hide(a):Nf.show(a)},Nf.unzoom=function(){vj.clear().update(),qf({withUpdateXDomain:!0})},Nf.load=function(a){return a.xs&&rc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Sg[b]=a.classes[b]}),"categories"in a&&Wi&&(Ah=a.categories,Jg.categories(Ah)),"cacheIds"in a&&fc(a.cacheIds)?void yf(hc(a.cacheIds),a.done):void("unload"in a?Af(Hc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){zf(a)}):zf(a))},Nf.unload=function(a,b){Af(Hc(a),function(){qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Nf.selected=function(a){return Mf.merge(Cj.selectAll("."+g.shapes+rd(a)).selectAll("."+g.shape).filter(function(){return Mf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Nf.select=function(a,b,c){ch&&Cj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Mf.select(this),i=e.data?e.data.id:e.id,j=Se(this),k=dh||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);h.classed(g.line)||h.classed(g.area)||(k&&l?eh(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},Nf.unselect=function(a,b){ch&&Cj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Mf.select(this),f=c.data?c.data.id:c.id,h=Se(this),i=dh||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);e.classed(g.line)||e.classed(g.area)||i&&j&&eh(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Nf.toLine=function(a){Lf(a,"line")},Nf.toSpline=function(a){Lf(a,"spline")},Nf.toBar=function(a){Lf(a,"bar")},Nf.toScatter=function(a){Lf(a,"scatter")},Nf.toArea=function(a){Lf(a,"area")},Nf.toAreaSpline=function(a){Lf(a,"area-spline")},Nf.toPie=function(a){Lf(a,"pie",{withTransform:!0})},Nf.toDonut=function(a){Lf(a,"donut",{withTransform:!0})},Nf.groups=function(a){return c(a)?Tg:(Tg=a,qf(),Tg)},Nf.xgrids=function(a){return a?(hi=a,qf(),hi):hi},Nf.xgrids.add=function(a){return a?Nf.xgrids(hi.concat(a)):void 0},Nf.xgrids.remove=function(a){var b=Kf(a);return Nf.xgrids(hi.filter(b))},Nf.ygrids=function(a){return a?(ji=a,qf(),ji):ji},Nf.ygrids.add=function(a){return a?Nf.ygrids(ji.concat(a)):void 0},Nf.ygrids.remove=function(a){var b=Kf(a);return Nf.ygrids(ji.filter(b))},Nf.regions=function(a){return a?(Hi=a,qf(),Hi):Hi},Nf.regions.add=function(a){return a?(Hi=Hi.concat(a),qf(),Hi):Hi},Nf.regions.remove=function(a){var b,c,d;return a=a||{},b=Je(a,"duration",cg),c=Je(a,"classes",[g.region]),d=Cj.select("."+g.regions).selectAll(c.map(function(a){return"."+a})),(b?d.transition().duration(b):d).style("opacity",0).remove(),Hi=Hi.filter(function(a){return c.indexOf(a.class)<0})},Nf.data.get=function(a){var b=Nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Nf.data.getAsTarget=function(a){var b=Nf.data.targets.filter(function(b){return b.id===a});return b.length>0?b[0]:void 0},Nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Rg[b]=a[b]}),qf({withLegend:!0}),Rg):Rg},Nf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){_g[b]=a[b]}),qf({withLegend:!0}),_g):_g},Nf.x=function(a){return arguments.length&&(uc(Nf.data.targets,a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Nf.data.xs},Nf.xs=function(a){return arguments.length&&(vc(Nf.data.targets,a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Nf.data.xs},Nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){gb(b,a[b])}),Ib())},Nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Jh=+a.x),b(a.y)&&(Qh=+a.y),b(a.y2)&&(Zh=+a.y2)):Qh=Zh=+a,qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Kh=+a.x),b(a.y)&&(Rh=+a.y),b(a.y2)&&($h=+a.y2)):Rh=$h=+a,qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Nf.axis.max(a.max),"undefined"!=typeof a.min&&Nf.axis.min(a.min))},Nf.legend.show=function(a){Ff(Hc(a)),qf({withLegend:!0})},Nf.legend.hide=function(a){Gf(Hc(a)),qf({withLegend:!0})},Nf.resize=function(a){Qf=a?a.width:null,Rf=a?a.height:null,wf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Nf.destroy=function(){Nf.data.targets=void 0,Nf.data.xs={},Gj.html(""),a.onresize=null},"url"in f.data)Mf.xhr(f.data.url,function(a,b){var c,d=Mf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Mf.csv.parse(b.response),hf(c)});else if("rows"in f.data)hf(xc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");hf(yc(f.data.columns))}return Nf},"function"==typeof define&&define.amd?define("c3",["d3"],f):"undefined"!=typeof exports&&"undefined"!=typeof module?module.exports=f:a.c3=f}(window); \ No newline at end of file From 4a9448922679c07f4180331523d34c21faf52288 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 14 May 2014 12:52:28 +0900 Subject: [PATCH 175/178] Fix regions.remove class logic --- c3.js | 9 ++++++++- c3.min.js | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/c3.js b/c3.js index 3dcb34d..8cd8399 100644 --- a/c3.js +++ b/c3.js @@ -4393,7 +4393,14 @@ .remove(); __regions = __regions.filter(function (region) { - return classes.indexOf(region.class) < 0; + var found = false; + if (!region.class) { + return true; + } + region.class.split(' ').forEach(function (c) { + if (classes.indexOf(c) >= 0) { found = true; } + }); + return !found; }); return __regions; diff --git a/c3.min.js b/c3.min.js index c023fb1..a756266 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ !function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.round(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.round(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&a=0;return"url("+(c?"":document.URL.split("#")[0])+"#"+b+")"}function k(a){return Math.ceil(a)+.5}function l(a,b){var c,d,e;b&&b.axisX?c=b.axisX:(c=Cj.select("."+g.axisX),a&&(c=c.transition())),b&&b.axisY?d=b.axisY:(d=Cj.select("."+g.axisY),a&&(d=d.transition())),b&&b.axisY2?e=b.axisY2:(e=Cj.select("."+g.axisY2),a&&(e=e.transition())),Cj.attr("transform",mj.main),c.attr("transform",mj.x),d.attr("transform",mj.y),e.attr("transform",mj.y2),Cj.select("."+g.chartArcs).attr("transform",mj.arc)}function m(a,b){var c;b&&b.axisSubX?c=b.axisSubX:(c=Dj.select("."+g.axisX),a&&(c=c.transition())),Dj.attr("transform",mj.context),c.attr("transform",mj.subx)}function n(a){(a?Ej.transition():Ej).attr("transform",mj.legend)}function o(a,b){l(a,b),nh&&m(a,b),n(a)}function p(){var a=U(),b=T(),c=nj?0:a,d=le(Nf.data.targets),e=wh||d?0:A("x"),f=nh&&!d?oh+e:0;kg=t(),lg=u(),wh?(dg={top:A("y2")+v(),right:d?0:y(),bottom:A("y")+c+w(),left:f+(d?0:x())},eg={top:dg.top,right:0/0,bottom:20+c,left:sj}):(dg={top:4+v(),right:d?0:y(),bottom:e+f+c+w(),left:d?0:x()},eg={top:lg-f-c,right:0/0,bottom:e+c,left:dg.left}),fg={top:nj?0:lg-a,right:0/0,bottom:0,left:nj?kg-b:0},gg=kg-dg.left-dg.right,ig=lg-dg.top-dg.bottom,0>gg&&(gg=0),0>ig&&(ig=0),hg=wh?dg.left-sj-tj:gg,jg=wh?ig:lg-eg.top-eg.bottom,0>hg&&(hg=0),0>jg&&(jg=0),pg=gg-(nj?b+10:0),qg=ig-(nj?0:10),r(),nj&&d&&(fg.left=pg/2+1.1*ng)}function q(){Cj.select("line."+g.xgridFocus).attr("x1",wh?0:-10).attr("x2",wh?gg:-10).attr("y1",wh?-10:dg.top).attr("y2",wh?-10:ig)}function r(){ng=Math.min(pg,qg)/2,mg=.95*ng,og=ke(Nf.data.targets)?.6*mg:0}function s(){var a=wh?g.axisX:g.axisY,b=Cj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Gj.node().getBoundingClientRect(),e=le(Nf.data.targets),f=c.right-d.left-(e?0:x());return f>0?f:0}function t(){return Qf?Qf:B()}function u(){var a=Rf?Rf:C();return a>0?a:320}function v(){return Uf?Uf:0}function w(){return Vf?Vf:0}function x(){return Sf?Sf:wh?xh?Math.max(Ke(z("x")),40):1:!Ph||Uh?1:Ke(z("y"))}function y(){var a=10,b=nj?T()+20:0;return Tf?Tf:wh?a+b:(!Yh||bi?a:Ke(z("y2")))+b}function z(a){var b=ob(a);return b.isInner?20+Hb(a):40+Hb(a)}function A(a){return"x"!==a||xh?"x"===a&&Mh?Mh:"y"!==a||Ph?"y2"!==a||Yh?(ob(a).isInner?30:40)+("y2"===a?-10:0):uj:qh&&!nj?10:1:0}function B(){return+Gj.style("width").replace("px","")}function C(){return+Gj.style("height").replace("px","")}function D(a){return a?-31:-(dg.left-1)}function E(a){return a?-20:-4}function F(){return D(!wh)}function G(){return E(!wh)}function H(){return D(wh)}function I(){return E(wh)}function J(a){return a?gg+2+30+30:dg.left+20}function K(a){return a?(Mh?Mh:0)+80:ig+8}function L(){return J(!wh)}function M(){return K(!wh)}function N(){return J(wh)}function O(){return K(wh)}function P(){var a,b,c,d,e,f=Ec(Nf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=Dg(b.x)-Dg(a.x),0===c?wh?ig:gg:(d=Dc(),e=he(Nf.data.targets)?(d-(Wi?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function Q(a){oj=a}function R(a){pj=a}function S(a){qj=a}function T(){return qh?nj?pj*(oj+1):kg:0}function U(){return qh?nj?lg:qj*(oj+1):0}function V(){var a,b,c=!Dg;vg=wh?1:0,wg=wh?ig:gg,xg=wh?0:ig,yg=wh?gg:1,zg=vg,Ag=wg,Bg=wh?0:jg,Cg=wh?hg:1,Dg=Y(vg,wg,c?void 0:Dg.domain(),function(){return Jg.tickOffset()}),Eg=Z(xg,yg,c?void 0:Eg.domain()),Fg=Z(xg,yg,c?void 0:Fg.domain()),Gg=Y(vg,wg,Hj,function(a){return a%1?0:Mg.tickOffset()}),Hg=Z(Bg,Cg,c?void 0:Hg.domain()),Ig=Z(Bg,Cg,c?void 0:Ig.domain()),a=db(),b=Hh?Hh:c?void 0:Jg.tickValues(),Jg=ab(Dg,ij,a,b),Mg=ab(Gg,lj,a,b),Kg=bb(Eg,jj,Vh,Xh),Lg=bb(Fg,kj,ci,ei),c||(vj.scale(Gg),Wf&&zj.scale(Dg)),W()}function W(){rg=Kb(),sg=Lb(),tg=Lb(.98)}function X(a,b,c){return(c?Mf.time.scale():Mf.scale.linear()).range([a,b])}function Y(a,b,c,d){var e,f=X(a,b,Vi),g=c?f.domain(c):f;Wi?(d=d||function(){return 0},f=function(a,b){var c=g(a)+d(a);return b?c:Math.ceil(c)}):f=function(a,b){var c=g(a);return b?c:Math.ceil(c)};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return Hj&&Hj[0]===a[0]&&Hj[1]a?a.toFixed(0):a};return Ch&&("function"==typeof Ch?a=Ch:Vi&&(a=function(a){return a?dj(Ch)(a):""})),a}function eb(a){var b;return"y"===a?b=Th:"y2"===a?b=ai:"x"===a&&(b=Oh),b}function fb(a){var b=eb(a);return"string"==typeof b?b:b?b.text:null}function gb(a,b){var c=eb(a);"string"==typeof c?"y"===a?Th=b:"y2"===a?ai=b:"x"===a&&(Oh=b):c&&(c.text=b)}function hb(a){return 10*Math.sin(Math.PI*(a/180))}function ib(a){return 11.5-2.5*(a/15)}function jb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",ib(c)).attr("x",hb(c)).attr("transform","rotate("+c+")")}function kb(a,b){var c=eb(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 lb(){return kb("x",wh?"inner-top":"inner-right")}function mb(){return kb("y",wh?"inner-right":"inner-top")}function nb(){return kb("y2",wh?"inner-right":"inner-top")}function ob(a){return"y2"===a?nb():"y"===a?mb():lb()}function pb(){return fb("x")}function qb(){return fb("y")}function rb(){return fb("y2")}function sb(a,b){return a?b.isLeft?0:b.isCenter?gg/2:gg:b.isBottom?-ig:b.isMiddle?-ig/2:0}function tb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function ub(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function vb(){return sb(!wh,lb())}function wb(){return sb(wh,mb())}function xb(){return sb(wh,nb())}function yb(){return tb(!wh,lb())}function zb(){return tb(wh,mb())}function Ab(){return tb(wh,nb())}function Bb(){var a=lb();return wh?a.isInner?"1.2em":-25-Hb("x"):a.isInner?"-0.5em":Mh?Mh-10:"3em"}function Cb(){var a=mb();return wh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Hb("y")}function Db(){var a=nb();return wh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Hb("y2")}function Eb(){return ub(!wh,lb())}function Fb(){return ub(wh,mb())}function Gb(){return ub(wh,nb())}function Hb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Ib(a){var b=Cj.select("."+g.axisX+" ."+g.axisXLabel),c=Cj.select("."+g.axisY+" ."+g.axisYLabel),d=Cj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",vb).attr("dx",yb).attr("dy",Bb).text(pb),(a?c.transition():c).attr("x",wb).attr("dx",zb).attr("dy",Cb).attr("dy",Cb).text(qb),(a?d.transition():d).attr("x",xb).attr("dx",Ab).attr("dy",Db).text(rb)}function Jb(a){var b=!1;return ug(Lc(Nf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Kb(){var a=Mf.svg.arc().outerRadius(mg).innerRadius(og),b=function(b,c){var d;return c?a(b):(d=Jb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Lb(a){var b=Mf.svg.arc().outerRadius(ng*(a?a:1)).innerRadius(og);return function(a){var c=Jb(a);return c?b(c):"M 0 0"}}function Mb(a,b){return se(a.data)?rg(a,b):"M 0 0"}function Nb(a){var b,c,d,e,f=Jb(a),g="";return f&&(b=rg.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*mg*.8+","+d/e*mg*.8+")"),g}function Ob(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Pb(a){return tc({id:a.data.id,value:a.value,ratio:Ob(a)})}function Qb(a){var b,c,d,e;return Tb()?(b=Jb(a),c=b?b.value:null,d=Ob(b),e=Ub(),e?e(c,d):Gd(c,d)):""}function Rb(a,b){var c=Aj.selectAll("."+g.chartArc+sd(a)),d=Aj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});ye(a)&&c.selectAll("path").transition().duration(50).attr("d",sg).transition().duration(100).attr("d",tg).each(function(a){re(a.data)}),b||d.style("opacity",.3)}function Sb(a){var b=Aj.selectAll("."+g.chartArc+sd(a));b.selectAll("path").transition().duration(50).attr("d",rg),Aj.selectAll("."+g.arc).style("opacity",1)}function Tb(){return ke(Nf.data.targets)?Ai:ui}function Ub(){return ke(Nf.data.targets)?Bi:vi}function Vb(){return ke(Nf.data.targets)?Di:""}function Wb(){var a=ke(Nf.data.targets)?Ei:xi;return"function"==typeof a?a:function(){}}function Xb(){var a=ke(Nf.data.targets)?Fi:yi;return"function"==typeof a?a:function(){}}function Yb(){var a=ke(Nf.data.targets)?Gi:zi;return"function"==typeof a?a:function(){}}function Zb(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Tg.length>0)for(g=Uc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return Mf.min(Object.keys(i).map(function(a){return Mf.min(i[a])}))}function $b(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Tg.length>0)for(g=Vc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return Mf.max(Object.keys(i).map(function(a){return Mf.max(i[a])}))}function _b(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return cb(a.id)===c}),m="y2"===c?$h:Rh,n="y2"===c?Zh:Qh,o=b(m)?m:Zb(l),p=b(n)?n:$b(l),q="y2"===c?_h:Sh,r=Ad()&&wh;return 0===l.length?"y2"===c?Fg.domain():Eg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=Bd(o,p),j=ec(Eg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Wh&&(f=b(Wh.top)?Wh.top:e,g=b(Wh.bottom)?Wh.bottom:e),"y2"===c&&di&&(f=b(di.top)?di.top:e,g=b(di.bottom)?di.bottom:e),he(l)&&!Uc(l)&&(g=o),[o-g,p+f])}function ac(a){return Kh?Vi?Ae(Kh):Kh:Mf.min(a,function(a){return Mf.min(a.values,function(a){return a.x})})}function bc(a){return Jh?Vi?Ae(Jh):Jh:Mf.max(a,function(a){return Mf.max(a.values,function(a){return a.x})})}function cc(a){var c,d,e,f,g=Fc(a),h=g[1]-g[0];return Wi?d=0:he(a)?(c=Dc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Lh&&Fe(Lh)?(e=b(Lh.left)?Lh.left:d,f=b(Lh.right)?Lh.right:d):e=f="number"==typeof Lh?Lh:d,{left:e,right:f}}function dc(a){var b=[ac(a),bc(a)],c=b[0],d=b[1],e=cc(a),f=0,g=0;return c-d!==0||Wi||(c=Vi?new Date(.5*c.getTime()):-.5,d=Vi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ec(a){return a[1]-a[0]}function fc(a){for(var b=0;bb?0:b-c}function lc(a){var b,c=jc(a),d="y"===a.axis?Eg:Fg;return b="y"===a.axis||"y2"===a.axis?wh?ig:"start"in a?d(a.start):ig:wh?"end"in a?Dg(Vi?Ae(a.end):a.end):ig:ig,c>b?0:b-c}function mc(a){return Ng&&a===Ng||Fe(Og)&&Ge(Og,a)}function nc(a){return!mc(a)}function oc(a){return Ng?Ng:Fe(Og)?Og[a]:null}function pc(a,b){var c,d=b&&Fe(b)?Gc(b):[];return d.forEach(function(b){oc(b)===a&&(c=Nf.data.xs[b])}),c}function qc(a,b){return a in Nf.data.xs&&Nf.data.xs[a]&&Nf.data.xs[a][b]?Nf.data.xs[a][b]:b}function rc(a){Object.keys(a).forEach(function(b){Og[b]=a[b]})}function sc(a){return 1===Mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function tc(a){var b;return a&&(b=Rg[a.id],a.name=b?b:a.id),a}function uc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=wc(b[d],a.id,d)}),Nf.data.xs[a.id]=b})}function vc(a,b){a.forEach(function(a){b[a.id]&&uc([a],b[a.id])})}function wc(a,c,d){var e;return e=Vi?a?a instanceof Date?a:Ae(a):Ae(qc(c,d)):Xi&&!Wi?b(a)?+a:qc(c,d):d}function xc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Ng?(d=Object.keys(Nf.data.xs),Nf.data.xs[c]=d.length>0?Nf.data.xs[d[0]]:void 0):Fe(Og)&&(Nf.data.xs[c]=pc(f,Nf.data.targets)):Nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Qg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=oc(b),g=a[f],h=wc(g,b,e);return Xi&&Wi&&0===c&&g&&(0===e&&(Ah=[]),Ah.push(g)),("undefined"==typeof a[b]||Nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Vg&&fe(Gc(c).filter(function(a){return!(a in Wg)}),Vg),c.forEach(function(a){gc(a.id_org,a)}),c}function Ac(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 Bc(a){return a>0&&Nf.data.targets[0].values[a-1]?Nf.data.targets[0].values[a-1].x:void 0}function Cc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Fc(a){var b,c,d=Ec(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Gc(a){return a.map(function(a){return a.id})}function Hc(a){return a?"string"==typeof a?[a]:a:Gc(Nf.data.targets)}function Ic(a,b){var c,d=Gc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Vi?new Date(i):i);j.push(e)}return Vi||(j=j.sort(function(a,b){return a-b})),j}function Oc(a){fj=fj.concat(a)}function Pc(a){fj=fj.filter(function(b){return a.indexOf(b)<0})}function Qc(a){gj=gj.concat(a)}function Rc(a){gj=gj.filter(function(b){return a.indexOf(b)<0})}function Sc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Tc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Vc(a){return Tc(a,function(a){return a>0})}function Wc(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||0===a[f].x)&&(e=e.concat(Md(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Md(a,g))),Pd(e,b)):Nd(a,b,f,g)}function Od(a,b){var c;return c=a.map(function(a){return Nd(a.values,b)}),Pd(c,b)}function Pd(a,b){var c,d;return a.forEach(function(a){var e=He(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Qd(a,b){return Mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Rd(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 Sd(){return Yg&&"desc"===Yg.toLowerCase()}function Td(){return Yg&&"asc"===Yg.toLowerCase()}function Ud(a){var b=Td(),c=Sd();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 Yg&&a.sort(Yg),a}function Vd(a,c){var d,e,f,g,h,i,j,k=le(Nf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&Ii&&(Fj.html(Li(a,db(),Cd(k),cj)).style("display","block"),d=Fj.property("offsetWidth"),e=Fj.property("offsetHeight"),k?(g=gg/2+c[0],i=ig/2+c[1]+20):(wh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-y(),i=Dg(l[0].x)+20):(f=s(),g=f+x()+Dg(l[0].x)+20,h=g+d,j=f+t()-y(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),Fj.style("top",i+"px").style("left",g+"px"))}function Wd(){Fj.style("display","none")}function Xd(a){var c=a.filter(function(a){return a&&b(a.value)});if(Ii&&!ie(Nf.data.targets)&&!le(Nf.data.targets)){var d=Cj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(wh?"y1":"x1",Id).attr(wh?"y2":"x2",Id),pf(d,"grid")}}function Yd(){Cj.select("line."+g.xgridFocus).style("visibility","hidden")}function Zd(a,b){var c,d,e,f,h=[],i=Cj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=dc(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function $d(a){return a.x||0===a.x?Dg(a.x):null}function _d(a){return $(a.id)(a.value)}function ae(){var a,b,d={},e=0;return Lc(Nf.data.targets.filter(oe)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ee(a,b){return"number"==typeof si?si:b?2*a.tickOffset()*ti/b:0}function fe(a,b){Hc(a).forEach(function(a){Jj[a]=b===Wg[a],Wg[a]=b})}function ge(a,b){var c=!1;return a.forEach(function(a){Wg[a.id]===b&&(c=!0),a.id in Wg||"line"!==b||(c=!0)}),c}function he(a){return ge(a,"bar")}function ie(a){return ge(a,"scatter")}function je(a){return ge(a,"pie")}function ke(a){return ge(a,"donut")}function le(a){return je(a)||ke(a)}function me(a){var b="string"==typeof a?a:a.id;return!(b in Wg)||"line"===Wg[b]||"spline"===Wg[b]||"area"===Wg[b]||"area-spline"===Wg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"spline"===Wg[b]||"area-spline"===Wg[b]}function oe(a){var b="string"==typeof a?a:a.id;return"bar"===Wg[b]}function pe(a){var b="string"==typeof a?a:a.id;return"scatter"===Wg[b]}function qe(a){var b="string"==typeof a?a:a.id;return"pie"===Wg[b]}function re(a){var b="string"==typeof a?a:a.id;return"donut"===Wg[b]}function se(a){return qe(a)||re(a)}function te(a){return me(a)?[a]:[]}function ue(a){return se(a.data)?[a]:[]}function ve(a){return oe(a)?a.values:[]}function we(a){return me(a)||pe(a)?a.values:[]}function xe(a){return oe(a)||me(a)?a.values:[]}function ye(a){return re(a)&&Ci||qe(a)&&wi}function ze(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function Ae(b){var c;try{c=Pg?Mf.time.format(Pg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Pg)}return c}function Be(a,b){var c=Mf.mouse(a),d=Mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ge(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function He(a,b){var c="y"===cb(a.id)?Eg:Fg,d=wh?1:0,e=wh?0:1;return Math.pow(Dg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ie(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Je(a,b,c){return d(a[b])?a[b]:c}function Ke(a){return 10*Math.ceil(a/10)}function Le(a,b,c){jh(b,a.node()),Cj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Xc(g.selectedCircle,c)}).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d).attr("stroke",function(){return cj(b)}).attr("r",1.4*We(b)).transition().duration(100).attr("r",We)}function Me(a,b,c){kh(b,a.node()),Cj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ne(a,b,c,d){a?Le(b,c,d):Me(b,c,d)}function Oe(a,b){jh(b,a.node()),a.transition().duration(100).style("fill",function(){return Mf.rgb(cj(b)).brighter(.75)})}function Pe(a,b){kh(b,a.node()),a.transition().duration(100).style("fill",function(){return cj(b)})}function Qe(a,b,c,d){a?Oe(b,c,d):Pe(b,c,d)}function Re(a,b,c,d){Qe(a,b,c.data,d)}function Se(a){return"circle"===a.nodeName?Ne:Mf.select(a).classed(g.bar)?Qe:Re}function Te(a){return a.filter(function(a){return b(a.value)})}function Ue(a){return li?"function"==typeof mi?mi(a):mi:0}function Ve(a){return oi?pi?pi:1.75*Ue(a):Ue(a)}function We(a){return qi?qi:4*Ue(a)}function Xe(a,c){return(c?Cj.selectAll("."+g.circles+rd(c)):Cj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ye(a,b){Xe(a,b).classed(g.EXPANDED,!0).attr("r",Ve)}function Ze(a){Xe(a).filter(function(){return Mf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Ue)}function $e(a){return Cj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function _e(a){$e(a).classed(g.EXPANDED,!0)}function af(a){$e(a).classed(g.EXPANDED,!1)}function bf(a,b){var c=ff(a,b);return function(a,b){var d=c(a,b),e=wh?1:0,f=wh?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 cf(a,b){var c=ff(a,!1),d=b?df:ef;return function(a,b){return d(c(a,b),a,this)}}function df(a,b){var c;return wh?(c=oe(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function ef(a,b,c){var d=c.getBoundingClientRect();return wh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:oe(b)?-3:-6)}function ff(a,b){var c=a.__max__+1,d=ee(Jg,c),e=be(d,c,a,!!b),f=ce(!!b),g=de(a,!!b),h=b?_:$;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return wh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function gf(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function hf(b){var c,d,e;if(Gj=Mf.select(Pf),Gj.empty())throw new Error("Element to bind not found");if(Gj.html("").classed("c3",!0),Nf.data.xs={},Nf.data.targets=zc(b),bh&&(Nf.data.targets=Nf.data.targets.filter(bh)),ah&&Oc(ah===!0?Gc(Nf.data.targets):ah),p(),V(),Dg.domain(Mf.extent(dc(Nf.data.targets))),Eg.domain(_b(Nf.data.targets,"y")),Fg.domain(_b(Nf.data.targets,"y2")),Gg.domain(Dg.domain()),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Hj=Dg.domain(),vj.scale(Gg),Wf&&zj.scale(Dg),Aj=Gj.append("svg").style("overflow","hidden").on("mouseenter",$f).on("mouseleave",_f),Bj=Aj.append("defs"),Bj.append("clipPath").attr("id",Pi).append("rect"),Bj.append("clipPath").attr("id",Qi).append("rect"),Bj.append("clipPath").attr("id",Ri).append("rect"),uf(),Cj=Aj.append("g").attr("transform",mj.main),Dj=Aj.append("g").attr("transform",mj.context),Ej=Aj.append("g").attr("transform",mj.legend),nh||Dj.style("visibility","hidden"),qh||(Ej.style("visibility","hidden"),gj=Gc(Nf.data.targets)),Fj=Gj.style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Hf(Gc(Nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=Cj.append("g").attr("clip-path",Si).attr("class",g.grid),fi&&d.append("g").attr("class",g.xgrids),Fe(hi)&&d.append("g").attr("class",g.xgridLines),ni&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),ii&&d.append("g").attr("class",g.ygrids),Fe(ji)&&d.append("g").attr("class",g.ygridLines),Cj.append("g").attr("clip-path",Si).attr("class",g.regions),Cj.append("g").attr("clip-path",Si).attr("class",g.chart),c=Cj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Wf?wh?"ns-resize":"ew-resize":null),Cj.select("."+g.chart).append("g").attr("class",g.chartBars),Cj.select("."+g.chart).append("g").attr("class",g.chartLines),Cj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",mj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Vb()),Cj.select("."+g.chart).append("g").attr("class",g.chartTexts),Wf&&Cj.insert("rect",Yf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",gg).attr("height",ig).style("opacity",0).style("cursor",wh?"ns-resize":"ew-resize").call(zj).on("dblclick.zoom",null),Nh&&vj.extent("function"!=typeof Nh?Nh:Nh(dc())),hj.x=Cj.append("g").attr("class",g.axisX).attr("clip-path",Ti).attr("transform",mj.x).style("visibility",xh?"visible":"hidden"),hj.x.append("text").attr("class",g.axisXLabel).attr("transform",wh?"rotate(-90)":"").style("text-anchor",Eb),hj.y=Cj.append("g").attr("class",g.axisY).attr("clip-path",Ui).attr("transform",mj.y).style("visibility",Ph?"visible":"hidden"),hj.y.append("text").attr("class",g.axisYLabel).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Fb),hj.y2=Cj.append("g").attr("class",g.axisY2).attr("transform",mj.y2).style("visibility",Yh?"visible":"hidden"),hj.y2.append("text").attr("class",g.axisY2Label).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Gb),Dj.append("g").attr("clip-path",Si).attr("class",g.chart),Dj.select("."+g.chart).append("g").attr("class",g.chartBars),Dj.select("."+g.chart).append("g").attr("class",g.chartLines),Dj.append("g").attr("clip-path",Si).attr("class",g.brush).call(vj).selectAll("rect").attr(wh?"width":"height",wh?hg:jg),hj.subx=Dj.append("g").attr("class",g.axisX).attr("transform",mj.subx).attr("clip-path",wh?"":Ti),xf(Nf.data.targets),qf({withUpdateTranslate:!0,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Mi){if(Vi&&"string"==typeof Ni){for(Ni=Ae(Ni),e=0;e0){d=[];for(var f in Rg)for(c=0;cf&&h>c&&d>i&&j>d;else{if(!n.classed(g.bar))return;m=Rd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Qe,q=!(c>h||f>c+e||d>j||i>d+k)}q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function nf(a){le(Nf.data.targets)||ch&&(Yi=a,Cj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Zi=!0,lh())}function of(){le(Nf.data.targets)||ch&&(Cj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),Cj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Zi=!1,mh())}function pf(a,b){"grid"===b&&a.each(function(){var a=Mf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function qf(a,c){var d,e,f,h,i,j,k,l,m,n,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,Q,R,S,T,U,W,X,Y,Z,$=ae(),_=le(Nf.data.targets),ab=Lc(Nf.data.targets);if(a=a||{},E=Je(a,"withY",!0),F=Je(a,"withSubchart",!0),G=Je(a,"withTransition",!0),J=Je(a,"withTransform",!1),K=Je(a,"withUpdateXDomain",!1),L=Je(a,"withUpdateOrgXDomain",!1),N=Je(a,"withUpdateTranslate",!1),M=Je(a,"withLegend",!1),H=Je(a,"withTransitionForExit",G),I=Je(a,"withTransitionForAxis",G),T=G?cg:0,U=H?T:0,W=I?T:0,c=c||vf(W),N&&(wh?(hj.x.call(Jg),hj.subx.call(Mg)):(hj.y.call(Kg),hj.y2.call(Lg)),p(),V(),uf(),o(!1)),M&&qh&&Hf(Gc(Nf.data.targets),a,c),Wi&&0===ab.length&&Dg.domain([0,hj.x.selectAll(".tick").size()]),ab.length&&(L&&(Dg.domain(Mf.extent(dc(ab))),Hj=Dg.domain(),Wf&&zj.scale(Dg).updateScaleExtent(),Gg.domain(Dg.domain()),vj.scale(Gg)),K&&(Dg.domain(vj.empty()?Hj:vj.extent()),Wf&&zj.scale(Dg).updateScaleExtent()),Hh||!Gh&&!Fh||(X=Nc(Mc(ab),Fh),Jg.tickValues(X),Mg.tickValues(X))),Eg.domain(_b(ab,"y")),Fg.domain(_b(ab,"y2")),hj.x.style("opacity",_?0:1),hj.y.style("opacity",_?0:1),hj.y2.style("opacity",_?0:1),hj.subx.style("opacity",_?0:1),c.axisX.call(Jg),c.axisY.call(Kg),c.axisY2.call(Lg),c.axisSubX.call(Mg),Ib(G),K&&ab.length)if(Dh&&X){for(Y=1;Y=0&&Mf.select(this).style("display",b%Z?"none":"block")})}else Aj.selectAll("."+g.axisX+" .tick text").style("display","block");!wh&&Ih&&jb(hj.x,c.axisX,Ih),O=bf($),R=cf($,!0),S=cf($,!1),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Fj.style("display","none"),q(),Cj.select("line."+g.xgridFocus).style("visibility","hidden"),fi&&(f=Zd(gi,Dg),B=Wi?Jg.tickOffset():0,e=wh?{x1:0,x2:gg,y1:function(a){return Dg(a)-B},y2:function(a){return Dg(a)-B}}:{x1:function(a){return Dg(a)+B},x2:function(a){return Dg(a)+B},y1:dg.top,y2:ig},d=Cj.select("."+g.xgrids).selectAll("."+g.xgrid).data(f),d.enter().append("line").attr("class",g.xgrid),d.attr(e).style("opacity",function(){return+Mf.select(this).attr(wh?"y1":"x1")===(wh?ig:0)?0:1}),d.exit().remove()),Fe(hi)&&(h=Cj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(hi),i=h.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),i.append("line").style("opacity",0),i.append("text").attr("text-anchor","end").attr("transform",wh?"":"rotate(-90)").attr("dx",wh?0:-dg.top).attr("dy",-5).style("opacity",0),h.select("line").transition().duration(T).attr("x1",wh?0:Jd).attr("x2",wh?gg:Jd).attr("y1",wh?Jd:dg.top).attr("y2",wh?Jd:ig).style("opacity",1),h.select("text").transition().duration(T).attr("x",wh?gg:0).attr("y",Jd).text(function(a){return a.text}).style("opacity",1),h.exit().transition().duration(T).style("opacity",0).remove()),E&&ii&&(j=Cj.select("."+g.ygrids).selectAll("."+g.ygrid).data(Eg.ticks(ki)),j.enter().append("line").attr("class",g.ygrid),j.attr("x1",wh?Eg:0).attr("x2",wh?Eg:gg).attr("y1",wh?0:Eg).attr("y2",wh?ig:Eg),j.exit().remove(),pf(j,"grid")),E&&Fe(ji)&&(k=Cj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(ji),l=k.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",wh?"rotate(-90)":"").attr("dx",wh?0:-dg.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",wh?Kd:0).attr("x2",wh?Kd:gg).attr("y1",wh?0:Kd).attr("y2",wh?ig:Kd).style("opacity",1),k.select("text").transition().duration(T).attr("x",wh?0:gg).attr("y",Kd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),u=Cj.select("."+g.regions).selectAll("."+g.region).data(Hi),u.enter().append("g").attr("class",kd).append("rect").style("fill-opacity",0),u.selectAll("rect").transition().duration(T).attr("x",ic).attr("y",jc).attr("width",kc).attr("height",lc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),u.exit().transition().duration(T).style("opacity",0).remove(),s=Cj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),s.enter().append("path").attr("class",ed).style("stroke","none").style("fill",cj),s.style("opacity",wd).transition().duration(T).attr("d",O).style("fill",cj).style("opacity",1),s.exit().transition().duration(U).style("opacity",0).remove(),m=Cj.selectAll("."+g.lines).selectAll("."+g.line).data(te),m.enter().append("path").attr("class",ad).style("stroke",cj),m.style("opacity",wd).transition().duration(T).attr("d",wj).style("stroke",cj).style("opacity",1),m.exit().transition().duration(U).style("opacity",0).remove(),n=Cj.selectAll("."+g.areas).selectAll("."+g.area).data(te),n.enter().append("path").attr("class",id).style("fill",cj).style("opacity",function(){return Ij=+Mf.select(this).style("opacity"),0}),n.style("opacity",0).transition().duration(T).attr("d",xj).style("fill",cj).style("opacity",Ij),n.exit().transition().duration(U).style("opacity",0).remove(),r=Cj.selectAll("."+g.circles).selectAll("."+g.circle).data(we),r.enter().append("circle").attr("class",cd).attr("r",Ue).style("fill",cj),r.style("opacity",wd).transition().duration(T).style("opacity",yd).style("fill",cj).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d),r.exit().remove(),v=Cj.selectAll("."+g.texts).selectAll("."+g.text).data(xe),v.enter().append("text").attr("class",Yc).attr("text-anchor",function(a){return wh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",cj).style("fill-opacity",0),v.text(function(a){return Hd(a.id)(a.value,a.id)}).style("fill-opacity",xd).transition().duration(T).attr("x",R).attr("y",S).style("fill",cj).style("fill-opacity",zd),v.exit().transition().duration(U).style("fill-opacity",0).remove(),t=Cj.selectAll("."+g.arcs).selectAll("."+g.arc).data(ue),t.enter().append("path").attr("class",gd).style("fill",function(a){return cj(a.data)}).style("cursor",function(a){return eh(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;aj||(c=Jb(a),d=Pb(c),e=Xb(),Rb(c.data.id),Df(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Jb(a),c=Pb(b),d=[c];Vd(d,Mf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;aj||(c=Jb(a),d=Pb(c),e=Yb(),Sb(c.data.id),Ef(),Wd(),e(d,b))}).on("click",function(a,b){var c=Jb(a),d=Pb(c),e=Wb();lf(this,a,b),e(d,b)}),t.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){aj=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Jb(a);return c?(b=Mf.interpolate(this._current,c),this._current=b(0),function(a){return Mb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("fill",function(a){return cj(a.data)}).style("opacity",1).call(Ie,function(){aj=!1}),t.exit().transition().duration(U).style("opacity",0).remove(),Cj.selectAll("."+g.chartArc).select("text").attr("transform",Nb).style("opacity",0).transition().duration(T).text(Qb).style("opacity",function(a){return Jc(a.data.id)&&se(a.data)?1:0}),Cj.select("."+g.chartArcsTitle).style("opacity",ke(Nf.data.targets)?1:0),nh&&(Mf.event&&"zoom"===Mf.event.type&&vj.extent(Dg.orgDomain()).update(),F&&(!wh&&Ih&&jb(hj.subx,c.axisSubX,Ih),vj.empty()||vj.extent(Dg.orgDomain()).update(),Q=bf($,!0),x=Dj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),x.enter().append("path").attr("class",ed).style("stroke","none").style("fill",cj),x.style("opacity",wd).transition().duration(T).attr("d",Q).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove(),w=Dj.selectAll("."+g.lines).selectAll("."+g.line).data(te),w.enter().append("path").attr("class",ad).style("stroke",cj),w.style("opacity",wd).transition().duration(T).attr("d",yj).style("opacity",1),w.exit().transition().duration(T).style("opacity",0).remove())),Cj.selectAll("."+g.selectedCircles).filter(function(a){return oe(a)}).selectAll("circle").remove(),Cj.selectAll("."+g.selectedCircle).transition().duration(T).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d),Zf&&(y=Cj.select("."+g.eventRects),Fe(Og)&&!sc(Og)?(y.classed(g.eventRectsMultiple)||y.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),z=Cj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),kf(z.enter()),z.attr("x",0).attr("y",0).attr("width",gg).attr("height",ig)):(y.classed(g.eventRectsSingle)||y.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Xi&&!Wi?(D=function(a,b){var c=Bc(b),d=Cc(b),e=Nf.data.xs[a.id][b];return(Dg(d?d:e+50)-Dg(c?c:e-50))/2},C=function(a,b){var c=Bc(b),d=Nf.data.xs[a.id][b];return(Dg(d)+Dg(c?c:d-50))/2}):(D=P(),C=function(a){return Dg(a.x)-D/2}),A=Ec(Nf.data.targets),Cj.select("."+g.eventRects).datum(A?A.values:[]),z=Cj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),jf(z.enter()),z.attr("class",ld).attr("x",wh?0:C).attr("y",wh?C:0).attr("width",wh?gg:D).attr("height",wh?D:ig),z.exit().remove())),Gc(Nf.data.targets).forEach(function(a){Jj[a]=!0})}function rf(){qf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function sf(){if(0!==Lc(Nf.data.targets).length){if("mousemove"===Mf.event.sourceEvent.type&&zj.altDomain)return Dg.domain(zj.altDomain),void zj.scale(Dg).updateScaleExtent();Wi&&Dg.orgDomain()[0]===Hj[0]&&Dg.domain([Hj[0]-1e-10,Dg.orgDomain()[1]]),qf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Mf.event.sourceEvent.type&&($i=!0)}}function tf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function uf(){Aj.attr("width",kg).attr("height",lg),Aj.select("#"+Pi).select("rect").attr("width",gg).attr("height",ig),Aj.select("#"+Qi).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),Aj.select("#"+Ri).select("rect").attr("x",H).attr("y",I).attr("width",N).attr("height",O),Aj.select("."+g.zoomRect).attr("width",gg).attr("height",ig),Gj.style("max-height",lg+"px")}function vf(a){return{axisX:a?hj.x.transition().duration(a):hj.x,axisY:a?hj.y.transition().duration(a):hj.y,axisY2:a?hj.y2.transition().duration(a):hj.y2,axisSubX:a?hj.subx.transition().duration(a):hj.subx}}function wf(a){var b;a=a||{},a.withTransition=Je(a,"withTransition",!0),a.withTransform=Je(a,"withTransform",!1),a.withLegend=Je(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withLegend&&qh||(b=vf(a.withTransitionForAxis?cg:0),p(),V(),uf(),o(a.withTransition,b)),qf(a,b)}function xf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=Cj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",nd),j=i.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Zc),e=Cj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),d=e.enter().append("g").attr("class",pd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",fd).style("cursor",function(a){return eh(a)?"pointer":null}),c=Cj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),b=c.enter().append("g").attr("class",od).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",bd),b.append("g").attr("class",jd),b.append("g").attr("class",function(a){return Xc(g.selectedCircles,a.id)}),b.append("g").attr("class",dd).style("cursor",function(a){return eh(a)?"pointer":null}),a.forEach(function(a){Cj.selectAll("."+g.selectedCircles+rd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Cj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(ug(a)).attr("class",qd),f=h.enter().append("g").attr("class",qd),f.append("g").attr("class",hd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),nh&&(n=Dj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),m=n.enter().append("g").style("opacity",0).attr("class",pd),m.append("g").attr("class",fd),l=Dj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),k=l.enter().append("g").style("opacity",0).attr("class",od),k.append("g").attr("class",bd)),Aj.selectAll("."+g.target).filter(function(a){return Jc(a.id)}).transition().duration(cg).style("opacity",1)}function yf(a,b){b.filter&&(a=a.filter(b.filter)),(b.type||b.types)&&a.forEach(function(a){b.types?fe(a.id,b.types[a.id]):fe(a.id,b.type)}),Nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,z=0,F++)),E[a]=F,D[F]=f,A[a]=z,z+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+v)/10),j=10*Math.ceil((h.height+u)/10),k=nj?j:i,l=nj?U():T();return d&&(z=0,F=0,w=0,x=0),qh&&!Kc(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=i,C[c]=j,(!w||i>=w)&&(w=i),(!x||j>=x)&&(x=j),g=nj?x:w,void(vh?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(l-g*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=26,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=Ej.selectAll("."+g.legendItemFocused).size();b=b||{},n=Je(b,"withTransition",!0),q=Je(b,"withTransitionForTransform",!0),nj?(f=function(a){return w*E[a]},j=function(a){return D[E[a]]+A[a]}):(f=function(a){return D[E[a]]+A[a]},j=function(a){return x*E[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=Ej.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Xc(g.legendItem,a)}).style("visibility",function(a){return Kc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof sh?sh(a):Nf.toggle(a)}).on("mouseover",function(a){Mf.select(this).classed(g.legendItemFocused,!0),aj||Nf.focus(a),"function"==typeof th&&th(a)}).on("mouseout",function(a){Mf.select(this).classed(g.legendItemFocused,!1),aj||Nf.revert(),"function"==typeof uh&&uh(a)}),m.append("text").text(function(a){return d(Rg[a])?Rg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",nj?h:-200).attr("y",nj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",nj?i:-200).attr("y",nj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",cj).attr("x",nj?h:-200).attr("y",nj?-200:j).attr("width",10).attr("height",10),r=Ej.selectAll("text").data(a).text(function(a){return d(Rg[a])?Rg[a]:a}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=Ej.selectAll("rect."+g.legendItemEvent).data(a),(n?s.transition():s).attr("width",function(a){return B[a]}).attr("height",function(a){return C[a]}).attr("x",i).attr("y",l),t=Ej.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",cj).attr("x",f).attr("y",j),Ej.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Jc(a)}).transition().style("opacity",function(a){var b=Mf.select(this);return Jc(a)?!G||b.classed(g.legendItemFocused)?Bf(b):Cf(b):rj}),R(w),S(x),Q(F),p(),V(),uf(),o(q,c)}function If(a){return Ic(Nf.data.targets,a.id)}function Jf(a){return"data"in a&&Ic(Nf.data.targets,a.data.id)}function Kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function Lf(a,b,c){var d=!le(Nf.data.targets);aj=!1,fe(a,b),wf(c||{withTransitionForAxis:d})}var Mf=a.d3?a.d3:"undefined"!=typeof require?require("d3"):void 0,Nf={data:{},axis:{},legend:{}},Of={},Pf=i(["bindto"],"#chart"),Qf=i(["size","width"]),Rf=i(["size","height"]),Sf=i(["padding","left"]),Tf=i(["padding","right"]),Uf=i(["padding","top"]),Vf=i(["padding","bottom"]),Wf=i(["zoom","enabled"],!1),Xf=i(["zoom","extent"]),Yf=i(["zoom","privileged"],!1),Zf=i(["interaction","enabled"],!0),$f=i(["onenter"],function(){}),_f=i(["onleave"],function(){}),ag=i(["onresize"],function(){}),bg=i(["onresized"],function(){}),cg=i(["transition","duration"],350);h("data","data is required in config");var dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg,Kg,Lg,Mg,Ng=i(["data","x"]),Og=i(["data","xs"],{}),Pg=i(["data","x_format"]),Qg=i(["data","id_converter"],function(a){return a}),Rg=i(["data","names"],{}),Sg=i(["data","classes"],{}),Tg=i(["data","groups"],[]),Ug=i(["data","axes"],{}),Vg=i(["data","type"]),Wg=i(["data","types"],{}),Xg=i(["data","labels"],{}),Yg=i(["data","order"]),Zg=i(["data","regions"],{}),$g=i(["data","color"]),_g=i(["data","colors"],{}),ah=i(["data","hide"],!1),bh=i(["data","filter"]),ch=i(["data","selection","enabled"],!1),dh=i(["data","selection","grouped"],!1),eh=i(["data","selection","isselectable"],function(){return!0}),fh=i(["data","selection","multiple"],!0),gh=i(["data","onclick"],function(){}),hh=i(["data","onenter"],function(){}),ih=i(["data","onleave"],function(){}),jh=i(["data","onselected"],function(){}),kh=i(["data","onunselected"],function(){}),lh=i(["data","ondragstart"],function(){}),mh=i(["data","ondragend"],function(){}),nh=i(["subchart","show"],!1),oh=i(["subchart","size","height"],60),ph=i(["color","pattern"],[]),qh=i(["legend","show"],!0),rh=i(["legend","position"],"bottom"),sh=i(["legend","item","onclick"]),th=i(["legend","item","onmouseover"]),uh=i(["legend","item","onmouseout"]),vh=i(["legend","equally"],!1),wh=i(["axis","rotated"],!1),xh=i(["axis","x","show"],!0),yh=i(["axis","x","type"],"indexed"),zh=i(["axis","x","localtime"],!0),Ah=i(["axis","x","categories"],[]),Bh=i(["axis","x","tick","centered"],!1),Ch=i(["axis","x","tick","format"]),Dh=i(["axis","x","tick","culling"],{}),Eh=i(["axis","x","tick","culling","max"],10),Fh=i(["axis","x","tick","count"]),Gh=i(["axis","x","tick","fit"],!0),Hh=i(["axis","x","tick","values"],null),Ih=i(["axis","x","tick","rotate"]),Jh=i(["axis","x","max"],null),Kh=i(["axis","x","min"],null),Lh=i(["axis","x","padding"],{}),Mh=i(["axis","x","height"]),Nh=i(["axis","x","default"]),Oh=i(["axis","x","label"],{}),Ph=i(["axis","y","show"],!0),Qh=i(["axis","y","max"]),Rh=i(["axis","y","min"]),Sh=i(["axis","y","center"]),Th=i(["axis","y","label"],{}),Uh=i(["axis","y","inner"],!1),Vh=i(["axis","y","tick","format"]),Wh=i(["axis","y","padding"]),Xh=i(["axis","y","ticks"],10),Yh=i(["axis","y2","show"],!1),Zh=i(["axis","y2","max"]),$h=i(["axis","y2","min"]),_h=i(["axis","y2","center"]),ai=i(["axis","y2","label"],{}),bi=i(["axis","y2","inner"],!1),ci=i(["axis","y2","tick","format"]),di=i(["axis","y2","padding"]),ei=i(["axis","y2","ticks"],10),fi=i(["grid","x","show"],!1),gi=i(["grid","x","type"],"tick"),hi=i(["grid","x","lines"],[]),ii=i(["grid","y","show"],!1),ji=i(["grid","y","lines"],[]),ki=i(["grid","y","ticks"],10),li=i(["point","show"],!0),mi=i(["point","r"],2.5),ni=i(["point","focus","line","enabled"],!0),oi=i(["point","focus","expand","enabled"],!0),pi=i(["point","focus","expand","r"]),qi=i(["point","focus","select","r"]),ri=i(["line","connect_null"],!1),si=i(["bar","width"]),ti=i(["bar","width","ratio"],.6),ui=i(["pie","label","show"],!0),vi=i(["pie","label","format"]),wi=i(["pie","expand"],!0),xi=i(["pie","onclick"],function(){}),yi=i(["pie","onmouseover"],function(){}),zi=i(["pie","onmouseout"],function(){}),Ai=i(["donut","label","show"],!0),Bi=i(["donut","label","format"]),Ci=i(["donut","expand"],!0),Di=i(["donut","title"],""),Ei=i(["donut","onclick"],function(){}),Fi=i(["donut","onmouseover"],function(){}),Gi=i(["donut","onmouseout"],function(){}),Hi=i(["regions"],[]),Ii=i(["tooltip","show"],!0),Ji=i(["tooltip","format","title"]),Ki=i(["tooltip","format","value"]),Li=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Ji?Ji:b,l=Ki?Ki:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Mi=i(["tooltip","init","show"],!1),Ni=i(["tooltip","init","x"],0),Oi=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Pi=("string"==typeof Pf?Pf.replace(/[# .>~+]/g,""):g.chart+ +new Date)+"-clip",Qi=Pi+"-xaxis",Ri=Pi+"-yaxis",Si=j(Pi),Ti=j(Qi),Ui=j(Ri),Vi="timeseries"===yh,Wi="categorized"===yh,Xi=!Vi&&(Ng||Fe(Og)),Yi=null,Zi=!1,$i=!1,_i=!1,aj=!1,bj=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],cj=ze(_g,Fe(ph)?ph:bj,$g),dj=zh?Mf.time.format:Mf.time.format.utc,ej=dj.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),fj=[],gj=[],hj={},ij=wh?"left":"bottom",jj=wh?Uh?"top":"bottom":Uh?"right":"left",kj=wh?bi?"bottom":"top":bi?"left":"right",lj=wh?"left":"bottom",mj={main:function(){return"translate("+k(dg.left)+","+k(dg.top)+")"},context:function(){return"translate("+k(eg.left)+","+k(eg.top)+")"},legend:function(){return"translate("+fg.left+","+fg.top+")" -},x:function(){return"translate(0,"+(wh?0:ig)+")"},y:function(){return"translate(0,"+(wh?ig:0)+")"},y2:function(){return"translate("+(wh?0:gg)+","+(wh?1:0)+")"},subx:function(){return"translate(0,"+(wh?0:jg)+")"},arc:function(){return"translate("+pg/2+","+qg/2+")"}},nj="right"===rh,oj=0,pj=0,qj=0,rj=.15,sj=30,tj=wh&&!xh?0:30,uj=5;ug=Mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var vj,wj=function(){var a=Mf.svg.line().x(wh?function(a){return $(a.id)(a.value)}:Id).y(wh?Id:function(a){return $(a.id)(a.value)});return ri||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ri?Te(b.values):b.values;return me(b)?(a.interpolate(ne(b)?"cardinal":"linear"),Zg[b.id]?gf(e,Dg,$(b.id),Zg[b.id]):a(e)):(c=e[0]?Dg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,wh?"M "+d+" "+c:"M "+c+" "+d)}}(),xj=function(){var a;return a=wh?Mf.svg.area().x0(function(a){return $(a.id)(0)}).x1(function(a){return $(a.id)(a.value)}).y(Id):Mf.svg.area().x(Id).y0(function(a){return $(a.id)(0)}).y1(function(a){return $(a.id)(a.value)}),function(b){var c,d,e=Te(b.values);return ge([b],"area")||ge([b],"area-spline")?(a.interpolate(ne(b)?"cardinal":"linear"),a(e)):(c=e[0]?Dg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,wh?"M "+d+" "+c:"M "+c+" "+d)}}(),yj=function(){var a=Mf.svg.line().x(wh?function(a){return _(a.id)(a.value)}:Ld).y(wh?Ld:function(a){return _(a.id)(a.value)});return function(b){var c=Te(b.values);return me(b)?a(c):"M "+Gg(c[0].x)+" "+_(b.id)(c[0].value)}}(),zj=function(){};vj=Mf.svg.brush().on("brush",rf),vj.update=function(){return Dj&&Dj.select("."+g.brush).call(this),this},vj.scale=function(a){return wh?this.y(a):this.x(a)},Wf&&(zj=Mf.behavior.zoom().on("zoomstart",function(){zj.altDomain=Mf.event.sourceEvent.altKey?Dg.orgDomain():null}).on("zoom",Wf?sf:null),zj.scale=function(a){return wh?this.y(a):this.x(a)},zj.orgScaleExtent=function(){var a=Xf?Xf:[1,10];return[a[0],Math.max(Dc()/a[1],a[1])]},zj.updateScaleExtent=function(){var a=ec(Dg.orgDomain())/ec(Hj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Aj,Bj,Cj,Dj,Ej,Fj,Gj,Hj,Ij,Jj={};if(Nf.focus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);Nf.revert(),Nf.defocus(),b(d.classed(g.focused,!0)),b(e),le(Nf.data.targets)&&Rb(a,!0),Df(a,!0)},Nf.defocus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",.3)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);Nf.revert(),b(d.classed(g.focused,!1)),b(e),le(Nf.data.targets)&&Sb(a),Df(a,!1)},Nf.revert=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);b(d.classed(g.focused,!1)),b(e),le(Nf.data.targets)&&Sb(a),Ef()},Nf.show=function(a,b){a=Hc(a),b=b||{},Pc(a),Aj.selectAll(td(a)).transition().style("opacity",1),b.withLegend&&Ff(a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Nf.hide=function(a,b){a=Hc(a),b=b||{},Oc(a),Aj.selectAll(td(a)).transition().style("opacity",0),b.withLegend&&Gf(a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Nf.toggle=function(a){Jc(a)?Nf.hide(a):Nf.show(a)},Nf.unzoom=function(){vj.clear().update(),qf({withUpdateXDomain:!0})},Nf.load=function(a){return a.xs&&rc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Sg[b]=a.classes[b]}),"categories"in a&&Wi&&(Ah=a.categories,Jg.categories(Ah)),"cacheIds"in a&&fc(a.cacheIds)?void yf(hc(a.cacheIds),a.done):void("unload"in a?Af(Hc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){zf(a)}):zf(a))},Nf.unload=function(a,b){Af(Hc(a),function(){qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Nf.selected=function(a){return Mf.merge(Cj.selectAll("."+g.shapes+rd(a)).selectAll("."+g.shape).filter(function(){return Mf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Nf.select=function(a,b,c){ch&&Cj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Mf.select(this),i=e.data?e.data.id:e.id,j=Se(this),k=dh||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);h.classed(g.line)||h.classed(g.area)||(k&&l?eh(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},Nf.unselect=function(a,b){ch&&Cj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Mf.select(this),f=c.data?c.data.id:c.id,h=Se(this),i=dh||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);e.classed(g.line)||e.classed(g.area)||i&&j&&eh(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Nf.toLine=function(a){Lf(a,"line")},Nf.toSpline=function(a){Lf(a,"spline")},Nf.toBar=function(a){Lf(a,"bar")},Nf.toScatter=function(a){Lf(a,"scatter")},Nf.toArea=function(a){Lf(a,"area")},Nf.toAreaSpline=function(a){Lf(a,"area-spline")},Nf.toPie=function(a){Lf(a,"pie",{withTransform:!0})},Nf.toDonut=function(a){Lf(a,"donut",{withTransform:!0})},Nf.groups=function(a){return c(a)?Tg:(Tg=a,qf(),Tg)},Nf.xgrids=function(a){return a?(hi=a,qf(),hi):hi},Nf.xgrids.add=function(a){return a?Nf.xgrids(hi.concat(a)):void 0},Nf.xgrids.remove=function(a){var b=Kf(a);return Nf.xgrids(hi.filter(b))},Nf.ygrids=function(a){return a?(ji=a,qf(),ji):ji},Nf.ygrids.add=function(a){return a?Nf.ygrids(ji.concat(a)):void 0},Nf.ygrids.remove=function(a){var b=Kf(a);return Nf.ygrids(ji.filter(b))},Nf.regions=function(a){return a?(Hi=a,qf(),Hi):Hi},Nf.regions.add=function(a){return a?(Hi=Hi.concat(a),qf(),Hi):Hi},Nf.regions.remove=function(a){var b,c,d;return a=a||{},b=Je(a,"duration",cg),c=Je(a,"classes",[g.region]),d=Cj.select("."+g.regions).selectAll(c.map(function(a){return"."+a})),(b?d.transition().duration(b):d).style("opacity",0).remove(),Hi=Hi.filter(function(a){return c.indexOf(a.class)<0})},Nf.data.get=function(a){var b=Nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Nf.data.getAsTarget=function(a){var b=Nf.data.targets.filter(function(b){return b.id===a});return b.length>0?b[0]:void 0},Nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Rg[b]=a[b]}),qf({withLegend:!0}),Rg):Rg},Nf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){_g[b]=a[b]}),qf({withLegend:!0}),_g):_g},Nf.x=function(a){return arguments.length&&(uc(Nf.data.targets,a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Nf.data.xs},Nf.xs=function(a){return arguments.length&&(vc(Nf.data.targets,a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Nf.data.xs},Nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){gb(b,a[b])}),Ib())},Nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Jh=+a.x),b(a.y)&&(Qh=+a.y),b(a.y2)&&(Zh=+a.y2)):Qh=Zh=+a,qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Kh=+a.x),b(a.y)&&(Rh=+a.y),b(a.y2)&&($h=+a.y2)):Rh=$h=+a,qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Nf.axis.max(a.max),"undefined"!=typeof a.min&&Nf.axis.min(a.min))},Nf.legend.show=function(a){Ff(Hc(a)),qf({withLegend:!0})},Nf.legend.hide=function(a){Gf(Hc(a)),qf({withLegend:!0})},Nf.resize=function(a){Qf=a?a.width:null,Rf=a?a.height:null,wf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Nf.destroy=function(){Nf.data.targets=void 0,Nf.data.xs={},Gj.html(""),a.onresize=null},"url"in f.data)Mf.xhr(f.data.url,function(a,b){var c,d=Mf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Mf.csv.parse(b.response),hf(c)});else if("rows"in f.data)hf(xc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");hf(yc(f.data.columns))}return Nf},"function"==typeof define&&define.amd?define("c3",["d3"],f):"undefined"!=typeof exports&&"undefined"!=typeof module?module.exports=f:a.c3=f}(window); \ No newline at end of file +},x:function(){return"translate(0,"+(wh?0:ig)+")"},y:function(){return"translate(0,"+(wh?ig:0)+")"},y2:function(){return"translate("+(wh?0:gg)+","+(wh?1:0)+")"},subx:function(){return"translate(0,"+(wh?0:jg)+")"},arc:function(){return"translate("+pg/2+","+qg/2+")"}},nj="right"===rh,oj=0,pj=0,qj=0,rj=.15,sj=30,tj=wh&&!xh?0:30,uj=5;ug=Mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var vj,wj=function(){var a=Mf.svg.line().x(wh?function(a){return $(a.id)(a.value)}:Id).y(wh?Id:function(a){return $(a.id)(a.value)});return ri||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ri?Te(b.values):b.values;return me(b)?(a.interpolate(ne(b)?"cardinal":"linear"),Zg[b.id]?gf(e,Dg,$(b.id),Zg[b.id]):a(e)):(c=e[0]?Dg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,wh?"M "+d+" "+c:"M "+c+" "+d)}}(),xj=function(){var a;return a=wh?Mf.svg.area().x0(function(a){return $(a.id)(0)}).x1(function(a){return $(a.id)(a.value)}).y(Id):Mf.svg.area().x(Id).y0(function(a){return $(a.id)(0)}).y1(function(a){return $(a.id)(a.value)}),function(b){var c,d,e=Te(b.values);return ge([b],"area")||ge([b],"area-spline")?(a.interpolate(ne(b)?"cardinal":"linear"),a(e)):(c=e[0]?Dg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,wh?"M "+d+" "+c:"M "+c+" "+d)}}(),yj=function(){var a=Mf.svg.line().x(wh?function(a){return _(a.id)(a.value)}:Ld).y(wh?Ld:function(a){return _(a.id)(a.value)});return function(b){var c=Te(b.values);return me(b)?a(c):"M "+Gg(c[0].x)+" "+_(b.id)(c[0].value)}}(),zj=function(){};vj=Mf.svg.brush().on("brush",rf),vj.update=function(){return Dj&&Dj.select("."+g.brush).call(this),this},vj.scale=function(a){return wh?this.y(a):this.x(a)},Wf&&(zj=Mf.behavior.zoom().on("zoomstart",function(){zj.altDomain=Mf.event.sourceEvent.altKey?Dg.orgDomain():null}).on("zoom",Wf?sf:null),zj.scale=function(a){return wh?this.y(a):this.x(a)},zj.orgScaleExtent=function(){var a=Xf?Xf:[1,10];return[a[0],Math.max(Dc()/a[1],a[1])]},zj.updateScaleExtent=function(){var a=ec(Dg.orgDomain())/ec(Hj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Aj,Bj,Cj,Dj,Ej,Fj,Gj,Hj,Ij,Jj={};if(Nf.focus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);Nf.revert(),Nf.defocus(),b(d.classed(g.focused,!0)),b(e),le(Nf.data.targets)&&Rb(a,!0),Df(a,!0)},Nf.defocus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",.3)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);Nf.revert(),b(d.classed(g.focused,!1)),b(e),le(Nf.data.targets)&&Sb(a),Df(a,!1)},Nf.revert=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);b(d.classed(g.focused,!1)),b(e),le(Nf.data.targets)&&Sb(a),Ef()},Nf.show=function(a,b){a=Hc(a),b=b||{},Pc(a),Aj.selectAll(td(a)).transition().style("opacity",1),b.withLegend&&Ff(a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Nf.hide=function(a,b){a=Hc(a),b=b||{},Oc(a),Aj.selectAll(td(a)).transition().style("opacity",0),b.withLegend&&Gf(a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Nf.toggle=function(a){Jc(a)?Nf.hide(a):Nf.show(a)},Nf.unzoom=function(){vj.clear().update(),qf({withUpdateXDomain:!0})},Nf.load=function(a){return a.xs&&rc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Sg[b]=a.classes[b]}),"categories"in a&&Wi&&(Ah=a.categories,Jg.categories(Ah)),"cacheIds"in a&&fc(a.cacheIds)?void yf(hc(a.cacheIds),a.done):void("unload"in a?Af(Hc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){zf(a)}):zf(a))},Nf.unload=function(a,b){Af(Hc(a),function(){qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Nf.selected=function(a){return Mf.merge(Cj.selectAll("."+g.shapes+rd(a)).selectAll("."+g.shape).filter(function(){return Mf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Nf.select=function(a,b,c){ch&&Cj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Mf.select(this),i=e.data?e.data.id:e.id,j=Se(this),k=dh||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);h.classed(g.line)||h.classed(g.area)||(k&&l?eh(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},Nf.unselect=function(a,b){ch&&Cj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Mf.select(this),f=c.data?c.data.id:c.id,h=Se(this),i=dh||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);e.classed(g.line)||e.classed(g.area)||i&&j&&eh(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Nf.toLine=function(a){Lf(a,"line")},Nf.toSpline=function(a){Lf(a,"spline")},Nf.toBar=function(a){Lf(a,"bar")},Nf.toScatter=function(a){Lf(a,"scatter")},Nf.toArea=function(a){Lf(a,"area")},Nf.toAreaSpline=function(a){Lf(a,"area-spline")},Nf.toPie=function(a){Lf(a,"pie",{withTransform:!0})},Nf.toDonut=function(a){Lf(a,"donut",{withTransform:!0})},Nf.groups=function(a){return c(a)?Tg:(Tg=a,qf(),Tg)},Nf.xgrids=function(a){return a?(hi=a,qf(),hi):hi},Nf.xgrids.add=function(a){return a?Nf.xgrids(hi.concat(a)):void 0},Nf.xgrids.remove=function(a){var b=Kf(a);return Nf.xgrids(hi.filter(b))},Nf.ygrids=function(a){return a?(ji=a,qf(),ji):ji},Nf.ygrids.add=function(a){return a?Nf.ygrids(ji.concat(a)):void 0},Nf.ygrids.remove=function(a){var b=Kf(a);return Nf.ygrids(ji.filter(b))},Nf.regions=function(a){return a?(Hi=a,qf(),Hi):Hi},Nf.regions.add=function(a){return a?(Hi=Hi.concat(a),qf(),Hi):Hi},Nf.regions.remove=function(a){var b,c,d;return a=a||{},b=Je(a,"duration",cg),c=Je(a,"classes",[g.region]),d=Cj.select("."+g.regions).selectAll(c.map(function(a){return"."+a})),(b?d.transition().duration(b):d).style("opacity",0).remove(),Hi=Hi.filter(function(a){var b=!1;return a.class?(a.class.split(" ").forEach(function(a){c.indexOf(a)>=0&&(b=!0)}),!b):!0})},Nf.data.get=function(a){var b=Nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Nf.data.getAsTarget=function(a){var b=Nf.data.targets.filter(function(b){return b.id===a});return b.length>0?b[0]:void 0},Nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Rg[b]=a[b]}),qf({withLegend:!0}),Rg):Rg},Nf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){_g[b]=a[b]}),qf({withLegend:!0}),_g):_g},Nf.x=function(a){return arguments.length&&(uc(Nf.data.targets,a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Nf.data.xs},Nf.xs=function(a){return arguments.length&&(vc(Nf.data.targets,a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Nf.data.xs},Nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){gb(b,a[b])}),Ib())},Nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Jh=+a.x),b(a.y)&&(Qh=+a.y),b(a.y2)&&(Zh=+a.y2)):Qh=Zh=+a,qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Kh=+a.x),b(a.y)&&(Rh=+a.y),b(a.y2)&&($h=+a.y2)):Rh=$h=+a,qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Nf.axis.max(a.max),"undefined"!=typeof a.min&&Nf.axis.min(a.min))},Nf.legend.show=function(a){Ff(Hc(a)),qf({withLegend:!0})},Nf.legend.hide=function(a){Gf(Hc(a)),qf({withLegend:!0})},Nf.resize=function(a){Qf=a?a.width:null,Rf=a?a.height:null,wf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Nf.destroy=function(){Nf.data.targets=void 0,Nf.data.xs={},Gj.html(""),a.onresize=null},"url"in f.data)Mf.xhr(f.data.url,function(a,b){var c,d=Mf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Mf.csv.parse(b.response),hf(c)});else if("rows"in f.data)hf(xc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");hf(yc(f.data.columns))}return Nf},"function"==typeof define&&define.amd?define("c3",["d3"],f):"undefined"!=typeof exports&&"undefined"!=typeof module?module.exports=f:a.c3=f}(window); \ No newline at end of file From 7ba8288ad2b1935084244e0514f23fece15508c4 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 14 May 2014 13:04:20 +0900 Subject: [PATCH 176/178] Fix selected circle update --- c3.js | 4 ++-- c3.min.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/c3.js b/c3.js index 8cd8399..05b66a4 100644 --- a/c3.js +++ b/c3.js @@ -3733,8 +3733,8 @@ .style("cursor", function (d) { return __data_selection_isselectable(d) ? "pointer" : null; }); // Update date for selected circles targets.forEach(function (t) { - main.selectAll('.' + CLASS.selectedCircles + getTargetSelectorSuffix(t.id)).selectAll('.' + CLASS.selectedCircle).each(function (d, i) { - d.value = t.values[i].value; + main.selectAll('.' + CLASS.selectedCircles + getTargetSelectorSuffix(t.id)).selectAll('.' + CLASS.selectedCircle).each(function (d) { + d.value = t.values[d.index].value; }); }); // MEMO: can not keep same color... diff --git a/c3.min.js b/c3.min.js index a756266..0f47ab1 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ !function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.round(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.round(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&a=0;return"url("+(c?"":document.URL.split("#")[0])+"#"+b+")"}function k(a){return Math.ceil(a)+.5}function l(a,b){var c,d,e;b&&b.axisX?c=b.axisX:(c=Cj.select("."+g.axisX),a&&(c=c.transition())),b&&b.axisY?d=b.axisY:(d=Cj.select("."+g.axisY),a&&(d=d.transition())),b&&b.axisY2?e=b.axisY2:(e=Cj.select("."+g.axisY2),a&&(e=e.transition())),Cj.attr("transform",mj.main),c.attr("transform",mj.x),d.attr("transform",mj.y),e.attr("transform",mj.y2),Cj.select("."+g.chartArcs).attr("transform",mj.arc)}function m(a,b){var c;b&&b.axisSubX?c=b.axisSubX:(c=Dj.select("."+g.axisX),a&&(c=c.transition())),Dj.attr("transform",mj.context),c.attr("transform",mj.subx)}function n(a){(a?Ej.transition():Ej).attr("transform",mj.legend)}function o(a,b){l(a,b),nh&&m(a,b),n(a)}function p(){var a=U(),b=T(),c=nj?0:a,d=le(Nf.data.targets),e=wh||d?0:A("x"),f=nh&&!d?oh+e:0;kg=t(),lg=u(),wh?(dg={top:A("y2")+v(),right:d?0:y(),bottom:A("y")+c+w(),left:f+(d?0:x())},eg={top:dg.top,right:0/0,bottom:20+c,left:sj}):(dg={top:4+v(),right:d?0:y(),bottom:e+f+c+w(),left:d?0:x()},eg={top:lg-f-c,right:0/0,bottom:e+c,left:dg.left}),fg={top:nj?0:lg-a,right:0/0,bottom:0,left:nj?kg-b:0},gg=kg-dg.left-dg.right,ig=lg-dg.top-dg.bottom,0>gg&&(gg=0),0>ig&&(ig=0),hg=wh?dg.left-sj-tj:gg,jg=wh?ig:lg-eg.top-eg.bottom,0>hg&&(hg=0),0>jg&&(jg=0),pg=gg-(nj?b+10:0),qg=ig-(nj?0:10),r(),nj&&d&&(fg.left=pg/2+1.1*ng)}function q(){Cj.select("line."+g.xgridFocus).attr("x1",wh?0:-10).attr("x2",wh?gg:-10).attr("y1",wh?-10:dg.top).attr("y2",wh?-10:ig)}function r(){ng=Math.min(pg,qg)/2,mg=.95*ng,og=ke(Nf.data.targets)?.6*mg:0}function s(){var a=wh?g.axisX:g.axisY,b=Cj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Gj.node().getBoundingClientRect(),e=le(Nf.data.targets),f=c.right-d.left-(e?0:x());return f>0?f:0}function t(){return Qf?Qf:B()}function u(){var a=Rf?Rf:C();return a>0?a:320}function v(){return Uf?Uf:0}function w(){return Vf?Vf:0}function x(){return Sf?Sf:wh?xh?Math.max(Ke(z("x")),40):1:!Ph||Uh?1:Ke(z("y"))}function y(){var a=10,b=nj?T()+20:0;return Tf?Tf:wh?a+b:(!Yh||bi?a:Ke(z("y2")))+b}function z(a){var b=ob(a);return b.isInner?20+Hb(a):40+Hb(a)}function A(a){return"x"!==a||xh?"x"===a&&Mh?Mh:"y"!==a||Ph?"y2"!==a||Yh?(ob(a).isInner?30:40)+("y2"===a?-10:0):uj:qh&&!nj?10:1:0}function B(){return+Gj.style("width").replace("px","")}function C(){return+Gj.style("height").replace("px","")}function D(a){return a?-31:-(dg.left-1)}function E(a){return a?-20:-4}function F(){return D(!wh)}function G(){return E(!wh)}function H(){return D(wh)}function I(){return E(wh)}function J(a){return a?gg+2+30+30:dg.left+20}function K(a){return a?(Mh?Mh:0)+80:ig+8}function L(){return J(!wh)}function M(){return K(!wh)}function N(){return J(wh)}function O(){return K(wh)}function P(){var a,b,c,d,e,f=Ec(Nf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=Dg(b.x)-Dg(a.x),0===c?wh?ig:gg:(d=Dc(),e=he(Nf.data.targets)?(d-(Wi?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function Q(a){oj=a}function R(a){pj=a}function S(a){qj=a}function T(){return qh?nj?pj*(oj+1):kg:0}function U(){return qh?nj?lg:qj*(oj+1):0}function V(){var a,b,c=!Dg;vg=wh?1:0,wg=wh?ig:gg,xg=wh?0:ig,yg=wh?gg:1,zg=vg,Ag=wg,Bg=wh?0:jg,Cg=wh?hg:1,Dg=Y(vg,wg,c?void 0:Dg.domain(),function(){return Jg.tickOffset()}),Eg=Z(xg,yg,c?void 0:Eg.domain()),Fg=Z(xg,yg,c?void 0:Fg.domain()),Gg=Y(vg,wg,Hj,function(a){return a%1?0:Mg.tickOffset()}),Hg=Z(Bg,Cg,c?void 0:Hg.domain()),Ig=Z(Bg,Cg,c?void 0:Ig.domain()),a=db(),b=Hh?Hh:c?void 0:Jg.tickValues(),Jg=ab(Dg,ij,a,b),Mg=ab(Gg,lj,a,b),Kg=bb(Eg,jj,Vh,Xh),Lg=bb(Fg,kj,ci,ei),c||(vj.scale(Gg),Wf&&zj.scale(Dg)),W()}function W(){rg=Kb(),sg=Lb(),tg=Lb(.98)}function X(a,b,c){return(c?Mf.time.scale():Mf.scale.linear()).range([a,b])}function Y(a,b,c,d){var e,f=X(a,b,Vi),g=c?f.domain(c):f;Wi?(d=d||function(){return 0},f=function(a,b){var c=g(a)+d(a);return b?c:Math.ceil(c)}):f=function(a,b){var c=g(a);return b?c:Math.ceil(c)};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return Hj&&Hj[0]===a[0]&&Hj[1]a?a.toFixed(0):a};return Ch&&("function"==typeof Ch?a=Ch:Vi&&(a=function(a){return a?dj(Ch)(a):""})),a}function eb(a){var b;return"y"===a?b=Th:"y2"===a?b=ai:"x"===a&&(b=Oh),b}function fb(a){var b=eb(a);return"string"==typeof b?b:b?b.text:null}function gb(a,b){var c=eb(a);"string"==typeof c?"y"===a?Th=b:"y2"===a?ai=b:"x"===a&&(Oh=b):c&&(c.text=b)}function hb(a){return 10*Math.sin(Math.PI*(a/180))}function ib(a){return 11.5-2.5*(a/15)}function jb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",ib(c)).attr("x",hb(c)).attr("transform","rotate("+c+")")}function kb(a,b){var c=eb(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 lb(){return kb("x",wh?"inner-top":"inner-right")}function mb(){return kb("y",wh?"inner-right":"inner-top")}function nb(){return kb("y2",wh?"inner-right":"inner-top")}function ob(a){return"y2"===a?nb():"y"===a?mb():lb()}function pb(){return fb("x")}function qb(){return fb("y")}function rb(){return fb("y2")}function sb(a,b){return a?b.isLeft?0:b.isCenter?gg/2:gg:b.isBottom?-ig:b.isMiddle?-ig/2:0}function tb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function ub(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function vb(){return sb(!wh,lb())}function wb(){return sb(wh,mb())}function xb(){return sb(wh,nb())}function yb(){return tb(!wh,lb())}function zb(){return tb(wh,mb())}function Ab(){return tb(wh,nb())}function Bb(){var a=lb();return wh?a.isInner?"1.2em":-25-Hb("x"):a.isInner?"-0.5em":Mh?Mh-10:"3em"}function Cb(){var a=mb();return wh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Hb("y")}function Db(){var a=nb();return wh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Hb("y2")}function Eb(){return ub(!wh,lb())}function Fb(){return ub(wh,mb())}function Gb(){return ub(wh,nb())}function Hb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Ib(a){var b=Cj.select("."+g.axisX+" ."+g.axisXLabel),c=Cj.select("."+g.axisY+" ."+g.axisYLabel),d=Cj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",vb).attr("dx",yb).attr("dy",Bb).text(pb),(a?c.transition():c).attr("x",wb).attr("dx",zb).attr("dy",Cb).attr("dy",Cb).text(qb),(a?d.transition():d).attr("x",xb).attr("dx",Ab).attr("dy",Db).text(rb)}function Jb(a){var b=!1;return ug(Lc(Nf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Kb(){var a=Mf.svg.arc().outerRadius(mg).innerRadius(og),b=function(b,c){var d;return c?a(b):(d=Jb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Lb(a){var b=Mf.svg.arc().outerRadius(ng*(a?a:1)).innerRadius(og);return function(a){var c=Jb(a);return c?b(c):"M 0 0"}}function Mb(a,b){return se(a.data)?rg(a,b):"M 0 0"}function Nb(a){var b,c,d,e,f=Jb(a),g="";return f&&(b=rg.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*mg*.8+","+d/e*mg*.8+")"),g}function Ob(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Pb(a){return tc({id:a.data.id,value:a.value,ratio:Ob(a)})}function Qb(a){var b,c,d,e;return Tb()?(b=Jb(a),c=b?b.value:null,d=Ob(b),e=Ub(),e?e(c,d):Gd(c,d)):""}function Rb(a,b){var c=Aj.selectAll("."+g.chartArc+sd(a)),d=Aj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});ye(a)&&c.selectAll("path").transition().duration(50).attr("d",sg).transition().duration(100).attr("d",tg).each(function(a){re(a.data)}),b||d.style("opacity",.3)}function Sb(a){var b=Aj.selectAll("."+g.chartArc+sd(a));b.selectAll("path").transition().duration(50).attr("d",rg),Aj.selectAll("."+g.arc).style("opacity",1)}function Tb(){return ke(Nf.data.targets)?Ai:ui}function Ub(){return ke(Nf.data.targets)?Bi:vi}function Vb(){return ke(Nf.data.targets)?Di:""}function Wb(){var a=ke(Nf.data.targets)?Ei:xi;return"function"==typeof a?a:function(){}}function Xb(){var a=ke(Nf.data.targets)?Fi:yi;return"function"==typeof a?a:function(){}}function Yb(){var a=ke(Nf.data.targets)?Gi:zi;return"function"==typeof a?a:function(){}}function Zb(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Tg.length>0)for(g=Uc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return Mf.min(Object.keys(i).map(function(a){return Mf.min(i[a])}))}function $b(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Tg.length>0)for(g=Vc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return Mf.max(Object.keys(i).map(function(a){return Mf.max(i[a])}))}function _b(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return cb(a.id)===c}),m="y2"===c?$h:Rh,n="y2"===c?Zh:Qh,o=b(m)?m:Zb(l),p=b(n)?n:$b(l),q="y2"===c?_h:Sh,r=Ad()&&wh;return 0===l.length?"y2"===c?Fg.domain():Eg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=Bd(o,p),j=ec(Eg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Wh&&(f=b(Wh.top)?Wh.top:e,g=b(Wh.bottom)?Wh.bottom:e),"y2"===c&&di&&(f=b(di.top)?di.top:e,g=b(di.bottom)?di.bottom:e),he(l)&&!Uc(l)&&(g=o),[o-g,p+f])}function ac(a){return Kh?Vi?Ae(Kh):Kh:Mf.min(a,function(a){return Mf.min(a.values,function(a){return a.x})})}function bc(a){return Jh?Vi?Ae(Jh):Jh:Mf.max(a,function(a){return Mf.max(a.values,function(a){return a.x})})}function cc(a){var c,d,e,f,g=Fc(a),h=g[1]-g[0];return Wi?d=0:he(a)?(c=Dc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Lh&&Fe(Lh)?(e=b(Lh.left)?Lh.left:d,f=b(Lh.right)?Lh.right:d):e=f="number"==typeof Lh?Lh:d,{left:e,right:f}}function dc(a){var b=[ac(a),bc(a)],c=b[0],d=b[1],e=cc(a),f=0,g=0;return c-d!==0||Wi||(c=Vi?new Date(.5*c.getTime()):-.5,d=Vi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ec(a){return a[1]-a[0]}function fc(a){for(var b=0;bb?0:b-c}function lc(a){var b,c=jc(a),d="y"===a.axis?Eg:Fg;return b="y"===a.axis||"y2"===a.axis?wh?ig:"start"in a?d(a.start):ig:wh?"end"in a?Dg(Vi?Ae(a.end):a.end):ig:ig,c>b?0:b-c}function mc(a){return Ng&&a===Ng||Fe(Og)&&Ge(Og,a)}function nc(a){return!mc(a)}function oc(a){return Ng?Ng:Fe(Og)?Og[a]:null}function pc(a,b){var c,d=b&&Fe(b)?Gc(b):[];return d.forEach(function(b){oc(b)===a&&(c=Nf.data.xs[b])}),c}function qc(a,b){return a in Nf.data.xs&&Nf.data.xs[a]&&Nf.data.xs[a][b]?Nf.data.xs[a][b]:b}function rc(a){Object.keys(a).forEach(function(b){Og[b]=a[b]})}function sc(a){return 1===Mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function tc(a){var b;return a&&(b=Rg[a.id],a.name=b?b:a.id),a}function uc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=wc(b[d],a.id,d)}),Nf.data.xs[a.id]=b})}function vc(a,b){a.forEach(function(a){b[a.id]&&uc([a],b[a.id])})}function wc(a,c,d){var e;return e=Vi?a?a instanceof Date?a:Ae(a):Ae(qc(c,d)):Xi&&!Wi?b(a)?+a:qc(c,d):d}function xc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Ng?(d=Object.keys(Nf.data.xs),Nf.data.xs[c]=d.length>0?Nf.data.xs[d[0]]:void 0):Fe(Og)&&(Nf.data.xs[c]=pc(f,Nf.data.targets)):Nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Qg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=oc(b),g=a[f],h=wc(g,b,e);return Xi&&Wi&&0===c&&g&&(0===e&&(Ah=[]),Ah.push(g)),("undefined"==typeof a[b]||Nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Vg&&fe(Gc(c).filter(function(a){return!(a in Wg)}),Vg),c.forEach(function(a){gc(a.id_org,a)}),c}function Ac(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 Bc(a){return a>0&&Nf.data.targets[0].values[a-1]?Nf.data.targets[0].values[a-1].x:void 0}function Cc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Fc(a){var b,c,d=Ec(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Gc(a){return a.map(function(a){return a.id})}function Hc(a){return a?"string"==typeof a?[a]:a:Gc(Nf.data.targets)}function Ic(a,b){var c,d=Gc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Vi?new Date(i):i);j.push(e)}return Vi||(j=j.sort(function(a,b){return a-b})),j}function Oc(a){fj=fj.concat(a)}function Pc(a){fj=fj.filter(function(b){return a.indexOf(b)<0})}function Qc(a){gj=gj.concat(a)}function Rc(a){gj=gj.filter(function(b){return a.indexOf(b)<0})}function Sc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Tc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Vc(a){return Tc(a,function(a){return a>0})}function Wc(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||0===a[f].x)&&(e=e.concat(Md(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Md(a,g))),Pd(e,b)):Nd(a,b,f,g)}function Od(a,b){var c;return c=a.map(function(a){return Nd(a.values,b)}),Pd(c,b)}function Pd(a,b){var c,d;return a.forEach(function(a){var e=He(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Qd(a,b){return Mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Rd(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 Sd(){return Yg&&"desc"===Yg.toLowerCase()}function Td(){return Yg&&"asc"===Yg.toLowerCase()}function Ud(a){var b=Td(),c=Sd();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 Yg&&a.sort(Yg),a}function Vd(a,c){var d,e,f,g,h,i,j,k=le(Nf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&Ii&&(Fj.html(Li(a,db(),Cd(k),cj)).style("display","block"),d=Fj.property("offsetWidth"),e=Fj.property("offsetHeight"),k?(g=gg/2+c[0],i=ig/2+c[1]+20):(wh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-y(),i=Dg(l[0].x)+20):(f=s(),g=f+x()+Dg(l[0].x)+20,h=g+d,j=f+t()-y(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),Fj.style("top",i+"px").style("left",g+"px"))}function Wd(){Fj.style("display","none")}function Xd(a){var c=a.filter(function(a){return a&&b(a.value)});if(Ii&&!ie(Nf.data.targets)&&!le(Nf.data.targets)){var d=Cj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(wh?"y1":"x1",Id).attr(wh?"y2":"x2",Id),pf(d,"grid")}}function Yd(){Cj.select("line."+g.xgridFocus).style("visibility","hidden")}function Zd(a,b){var c,d,e,f,h=[],i=Cj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=dc(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function $d(a){return a.x||0===a.x?Dg(a.x):null}function _d(a){return $(a.id)(a.value)}function ae(){var a,b,d={},e=0;return Lc(Nf.data.targets.filter(oe)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ee(a,b){return"number"==typeof si?si:b?2*a.tickOffset()*ti/b:0}function fe(a,b){Hc(a).forEach(function(a){Jj[a]=b===Wg[a],Wg[a]=b})}function ge(a,b){var c=!1;return a.forEach(function(a){Wg[a.id]===b&&(c=!0),a.id in Wg||"line"!==b||(c=!0)}),c}function he(a){return ge(a,"bar")}function ie(a){return ge(a,"scatter")}function je(a){return ge(a,"pie")}function ke(a){return ge(a,"donut")}function le(a){return je(a)||ke(a)}function me(a){var b="string"==typeof a?a:a.id;return!(b in Wg)||"line"===Wg[b]||"spline"===Wg[b]||"area"===Wg[b]||"area-spline"===Wg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"spline"===Wg[b]||"area-spline"===Wg[b]}function oe(a){var b="string"==typeof a?a:a.id;return"bar"===Wg[b]}function pe(a){var b="string"==typeof a?a:a.id;return"scatter"===Wg[b]}function qe(a){var b="string"==typeof a?a:a.id;return"pie"===Wg[b]}function re(a){var b="string"==typeof a?a:a.id;return"donut"===Wg[b]}function se(a){return qe(a)||re(a)}function te(a){return me(a)?[a]:[]}function ue(a){return se(a.data)?[a]:[]}function ve(a){return oe(a)?a.values:[]}function we(a){return me(a)||pe(a)?a.values:[]}function xe(a){return oe(a)||me(a)?a.values:[]}function ye(a){return re(a)&&Ci||qe(a)&&wi}function ze(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function Ae(b){var c;try{c=Pg?Mf.time.format(Pg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Pg)}return c}function Be(a,b){var c=Mf.mouse(a),d=Mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ge(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function He(a,b){var c="y"===cb(a.id)?Eg:Fg,d=wh?1:0,e=wh?0:1;return Math.pow(Dg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ie(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Je(a,b,c){return d(a[b])?a[b]:c}function Ke(a){return 10*Math.ceil(a/10)}function Le(a,b,c){jh(b,a.node()),Cj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Xc(g.selectedCircle,c)}).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d).attr("stroke",function(){return cj(b)}).attr("r",1.4*We(b)).transition().duration(100).attr("r",We)}function Me(a,b,c){kh(b,a.node()),Cj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ne(a,b,c,d){a?Le(b,c,d):Me(b,c,d)}function Oe(a,b){jh(b,a.node()),a.transition().duration(100).style("fill",function(){return Mf.rgb(cj(b)).brighter(.75)})}function Pe(a,b){kh(b,a.node()),a.transition().duration(100).style("fill",function(){return cj(b)})}function Qe(a,b,c,d){a?Oe(b,c,d):Pe(b,c,d)}function Re(a,b,c,d){Qe(a,b,c.data,d)}function Se(a){return"circle"===a.nodeName?Ne:Mf.select(a).classed(g.bar)?Qe:Re}function Te(a){return a.filter(function(a){return b(a.value)})}function Ue(a){return li?"function"==typeof mi?mi(a):mi:0}function Ve(a){return oi?pi?pi:1.75*Ue(a):Ue(a)}function We(a){return qi?qi:4*Ue(a)}function Xe(a,c){return(c?Cj.selectAll("."+g.circles+rd(c)):Cj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ye(a,b){Xe(a,b).classed(g.EXPANDED,!0).attr("r",Ve)}function Ze(a){Xe(a).filter(function(){return Mf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Ue)}function $e(a){return Cj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function _e(a){$e(a).classed(g.EXPANDED,!0)}function af(a){$e(a).classed(g.EXPANDED,!1)}function bf(a,b){var c=ff(a,b);return function(a,b){var d=c(a,b),e=wh?1:0,f=wh?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 cf(a,b){var c=ff(a,!1),d=b?df:ef;return function(a,b){return d(c(a,b),a,this)}}function df(a,b){var c;return wh?(c=oe(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function ef(a,b,c){var d=c.getBoundingClientRect();return wh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:oe(b)?-3:-6)}function ff(a,b){var c=a.__max__+1,d=ee(Jg,c),e=be(d,c,a,!!b),f=ce(!!b),g=de(a,!!b),h=b?_:$;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return wh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function gf(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function hf(b){var c,d,e;if(Gj=Mf.select(Pf),Gj.empty())throw new Error("Element to bind not found");if(Gj.html("").classed("c3",!0),Nf.data.xs={},Nf.data.targets=zc(b),bh&&(Nf.data.targets=Nf.data.targets.filter(bh)),ah&&Oc(ah===!0?Gc(Nf.data.targets):ah),p(),V(),Dg.domain(Mf.extent(dc(Nf.data.targets))),Eg.domain(_b(Nf.data.targets,"y")),Fg.domain(_b(Nf.data.targets,"y2")),Gg.domain(Dg.domain()),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Hj=Dg.domain(),vj.scale(Gg),Wf&&zj.scale(Dg),Aj=Gj.append("svg").style("overflow","hidden").on("mouseenter",$f).on("mouseleave",_f),Bj=Aj.append("defs"),Bj.append("clipPath").attr("id",Pi).append("rect"),Bj.append("clipPath").attr("id",Qi).append("rect"),Bj.append("clipPath").attr("id",Ri).append("rect"),uf(),Cj=Aj.append("g").attr("transform",mj.main),Dj=Aj.append("g").attr("transform",mj.context),Ej=Aj.append("g").attr("transform",mj.legend),nh||Dj.style("visibility","hidden"),qh||(Ej.style("visibility","hidden"),gj=Gc(Nf.data.targets)),Fj=Gj.style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Hf(Gc(Nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=Cj.append("g").attr("clip-path",Si).attr("class",g.grid),fi&&d.append("g").attr("class",g.xgrids),Fe(hi)&&d.append("g").attr("class",g.xgridLines),ni&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),ii&&d.append("g").attr("class",g.ygrids),Fe(ji)&&d.append("g").attr("class",g.ygridLines),Cj.append("g").attr("clip-path",Si).attr("class",g.regions),Cj.append("g").attr("clip-path",Si).attr("class",g.chart),c=Cj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Wf?wh?"ns-resize":"ew-resize":null),Cj.select("."+g.chart).append("g").attr("class",g.chartBars),Cj.select("."+g.chart).append("g").attr("class",g.chartLines),Cj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",mj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Vb()),Cj.select("."+g.chart).append("g").attr("class",g.chartTexts),Wf&&Cj.insert("rect",Yf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",gg).attr("height",ig).style("opacity",0).style("cursor",wh?"ns-resize":"ew-resize").call(zj).on("dblclick.zoom",null),Nh&&vj.extent("function"!=typeof Nh?Nh:Nh(dc())),hj.x=Cj.append("g").attr("class",g.axisX).attr("clip-path",Ti).attr("transform",mj.x).style("visibility",xh?"visible":"hidden"),hj.x.append("text").attr("class",g.axisXLabel).attr("transform",wh?"rotate(-90)":"").style("text-anchor",Eb),hj.y=Cj.append("g").attr("class",g.axisY).attr("clip-path",Ui).attr("transform",mj.y).style("visibility",Ph?"visible":"hidden"),hj.y.append("text").attr("class",g.axisYLabel).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Fb),hj.y2=Cj.append("g").attr("class",g.axisY2).attr("transform",mj.y2).style("visibility",Yh?"visible":"hidden"),hj.y2.append("text").attr("class",g.axisY2Label).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Gb),Dj.append("g").attr("clip-path",Si).attr("class",g.chart),Dj.select("."+g.chart).append("g").attr("class",g.chartBars),Dj.select("."+g.chart).append("g").attr("class",g.chartLines),Dj.append("g").attr("clip-path",Si).attr("class",g.brush).call(vj).selectAll("rect").attr(wh?"width":"height",wh?hg:jg),hj.subx=Dj.append("g").attr("class",g.axisX).attr("transform",mj.subx).attr("clip-path",wh?"":Ti),xf(Nf.data.targets),qf({withUpdateTranslate:!0,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Mi){if(Vi&&"string"==typeof Ni){for(Ni=Ae(Ni),e=0;e0){d=[];for(var f in Rg)for(c=0;cf&&h>c&&d>i&&j>d;else{if(!n.classed(g.bar))return;m=Rd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Qe,q=!(c>h||f>c+e||d>j||i>d+k)}q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function nf(a){le(Nf.data.targets)||ch&&(Yi=a,Cj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Zi=!0,lh())}function of(){le(Nf.data.targets)||ch&&(Cj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),Cj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Zi=!1,mh())}function pf(a,b){"grid"===b&&a.each(function(){var a=Mf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function qf(a,c){var d,e,f,h,i,j,k,l,m,n,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,Q,R,S,T,U,W,X,Y,Z,$=ae(),_=le(Nf.data.targets),ab=Lc(Nf.data.targets);if(a=a||{},E=Je(a,"withY",!0),F=Je(a,"withSubchart",!0),G=Je(a,"withTransition",!0),J=Je(a,"withTransform",!1),K=Je(a,"withUpdateXDomain",!1),L=Je(a,"withUpdateOrgXDomain",!1),N=Je(a,"withUpdateTranslate",!1),M=Je(a,"withLegend",!1),H=Je(a,"withTransitionForExit",G),I=Je(a,"withTransitionForAxis",G),T=G?cg:0,U=H?T:0,W=I?T:0,c=c||vf(W),N&&(wh?(hj.x.call(Jg),hj.subx.call(Mg)):(hj.y.call(Kg),hj.y2.call(Lg)),p(),V(),uf(),o(!1)),M&&qh&&Hf(Gc(Nf.data.targets),a,c),Wi&&0===ab.length&&Dg.domain([0,hj.x.selectAll(".tick").size()]),ab.length&&(L&&(Dg.domain(Mf.extent(dc(ab))),Hj=Dg.domain(),Wf&&zj.scale(Dg).updateScaleExtent(),Gg.domain(Dg.domain()),vj.scale(Gg)),K&&(Dg.domain(vj.empty()?Hj:vj.extent()),Wf&&zj.scale(Dg).updateScaleExtent()),Hh||!Gh&&!Fh||(X=Nc(Mc(ab),Fh),Jg.tickValues(X),Mg.tickValues(X))),Eg.domain(_b(ab,"y")),Fg.domain(_b(ab,"y2")),hj.x.style("opacity",_?0:1),hj.y.style("opacity",_?0:1),hj.y2.style("opacity",_?0:1),hj.subx.style("opacity",_?0:1),c.axisX.call(Jg),c.axisY.call(Kg),c.axisY2.call(Lg),c.axisSubX.call(Mg),Ib(G),K&&ab.length)if(Dh&&X){for(Y=1;Y=0&&Mf.select(this).style("display",b%Z?"none":"block")})}else Aj.selectAll("."+g.axisX+" .tick text").style("display","block");!wh&&Ih&&jb(hj.x,c.axisX,Ih),O=bf($),R=cf($,!0),S=cf($,!1),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Fj.style("display","none"),q(),Cj.select("line."+g.xgridFocus).style("visibility","hidden"),fi&&(f=Zd(gi,Dg),B=Wi?Jg.tickOffset():0,e=wh?{x1:0,x2:gg,y1:function(a){return Dg(a)-B},y2:function(a){return Dg(a)-B}}:{x1:function(a){return Dg(a)+B},x2:function(a){return Dg(a)+B},y1:dg.top,y2:ig},d=Cj.select("."+g.xgrids).selectAll("."+g.xgrid).data(f),d.enter().append("line").attr("class",g.xgrid),d.attr(e).style("opacity",function(){return+Mf.select(this).attr(wh?"y1":"x1")===(wh?ig:0)?0:1}),d.exit().remove()),Fe(hi)&&(h=Cj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(hi),i=h.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),i.append("line").style("opacity",0),i.append("text").attr("text-anchor","end").attr("transform",wh?"":"rotate(-90)").attr("dx",wh?0:-dg.top).attr("dy",-5).style("opacity",0),h.select("line").transition().duration(T).attr("x1",wh?0:Jd).attr("x2",wh?gg:Jd).attr("y1",wh?Jd:dg.top).attr("y2",wh?Jd:ig).style("opacity",1),h.select("text").transition().duration(T).attr("x",wh?gg:0).attr("y",Jd).text(function(a){return a.text}).style("opacity",1),h.exit().transition().duration(T).style("opacity",0).remove()),E&&ii&&(j=Cj.select("."+g.ygrids).selectAll("."+g.ygrid).data(Eg.ticks(ki)),j.enter().append("line").attr("class",g.ygrid),j.attr("x1",wh?Eg:0).attr("x2",wh?Eg:gg).attr("y1",wh?0:Eg).attr("y2",wh?ig:Eg),j.exit().remove(),pf(j,"grid")),E&&Fe(ji)&&(k=Cj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(ji),l=k.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",wh?"rotate(-90)":"").attr("dx",wh?0:-dg.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",wh?Kd:0).attr("x2",wh?Kd:gg).attr("y1",wh?0:Kd).attr("y2",wh?ig:Kd).style("opacity",1),k.select("text").transition().duration(T).attr("x",wh?0:gg).attr("y",Kd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),u=Cj.select("."+g.regions).selectAll("."+g.region).data(Hi),u.enter().append("g").attr("class",kd).append("rect").style("fill-opacity",0),u.selectAll("rect").transition().duration(T).attr("x",ic).attr("y",jc).attr("width",kc).attr("height",lc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),u.exit().transition().duration(T).style("opacity",0).remove(),s=Cj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),s.enter().append("path").attr("class",ed).style("stroke","none").style("fill",cj),s.style("opacity",wd).transition().duration(T).attr("d",O).style("fill",cj).style("opacity",1),s.exit().transition().duration(U).style("opacity",0).remove(),m=Cj.selectAll("."+g.lines).selectAll("."+g.line).data(te),m.enter().append("path").attr("class",ad).style("stroke",cj),m.style("opacity",wd).transition().duration(T).attr("d",wj).style("stroke",cj).style("opacity",1),m.exit().transition().duration(U).style("opacity",0).remove(),n=Cj.selectAll("."+g.areas).selectAll("."+g.area).data(te),n.enter().append("path").attr("class",id).style("fill",cj).style("opacity",function(){return Ij=+Mf.select(this).style("opacity"),0}),n.style("opacity",0).transition().duration(T).attr("d",xj).style("fill",cj).style("opacity",Ij),n.exit().transition().duration(U).style("opacity",0).remove(),r=Cj.selectAll("."+g.circles).selectAll("."+g.circle).data(we),r.enter().append("circle").attr("class",cd).attr("r",Ue).style("fill",cj),r.style("opacity",wd).transition().duration(T).style("opacity",yd).style("fill",cj).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d),r.exit().remove(),v=Cj.selectAll("."+g.texts).selectAll("."+g.text).data(xe),v.enter().append("text").attr("class",Yc).attr("text-anchor",function(a){return wh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",cj).style("fill-opacity",0),v.text(function(a){return Hd(a.id)(a.value,a.id)}).style("fill-opacity",xd).transition().duration(T).attr("x",R).attr("y",S).style("fill",cj).style("fill-opacity",zd),v.exit().transition().duration(U).style("fill-opacity",0).remove(),t=Cj.selectAll("."+g.arcs).selectAll("."+g.arc).data(ue),t.enter().append("path").attr("class",gd).style("fill",function(a){return cj(a.data)}).style("cursor",function(a){return eh(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;aj||(c=Jb(a),d=Pb(c),e=Xb(),Rb(c.data.id),Df(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Jb(a),c=Pb(b),d=[c];Vd(d,Mf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;aj||(c=Jb(a),d=Pb(c),e=Yb(),Sb(c.data.id),Ef(),Wd(),e(d,b))}).on("click",function(a,b){var c=Jb(a),d=Pb(c),e=Wb();lf(this,a,b),e(d,b)}),t.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){aj=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Jb(a);return c?(b=Mf.interpolate(this._current,c),this._current=b(0),function(a){return Mb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("fill",function(a){return cj(a.data)}).style("opacity",1).call(Ie,function(){aj=!1}),t.exit().transition().duration(U).style("opacity",0).remove(),Cj.selectAll("."+g.chartArc).select("text").attr("transform",Nb).style("opacity",0).transition().duration(T).text(Qb).style("opacity",function(a){return Jc(a.data.id)&&se(a.data)?1:0}),Cj.select("."+g.chartArcsTitle).style("opacity",ke(Nf.data.targets)?1:0),nh&&(Mf.event&&"zoom"===Mf.event.type&&vj.extent(Dg.orgDomain()).update(),F&&(!wh&&Ih&&jb(hj.subx,c.axisSubX,Ih),vj.empty()||vj.extent(Dg.orgDomain()).update(),Q=bf($,!0),x=Dj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),x.enter().append("path").attr("class",ed).style("stroke","none").style("fill",cj),x.style("opacity",wd).transition().duration(T).attr("d",Q).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove(),w=Dj.selectAll("."+g.lines).selectAll("."+g.line).data(te),w.enter().append("path").attr("class",ad).style("stroke",cj),w.style("opacity",wd).transition().duration(T).attr("d",yj).style("opacity",1),w.exit().transition().duration(T).style("opacity",0).remove())),Cj.selectAll("."+g.selectedCircles).filter(function(a){return oe(a)}).selectAll("circle").remove(),Cj.selectAll("."+g.selectedCircle).transition().duration(T).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d),Zf&&(y=Cj.select("."+g.eventRects),Fe(Og)&&!sc(Og)?(y.classed(g.eventRectsMultiple)||y.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),z=Cj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),kf(z.enter()),z.attr("x",0).attr("y",0).attr("width",gg).attr("height",ig)):(y.classed(g.eventRectsSingle)||y.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Xi&&!Wi?(D=function(a,b){var c=Bc(b),d=Cc(b),e=Nf.data.xs[a.id][b];return(Dg(d?d:e+50)-Dg(c?c:e-50))/2},C=function(a,b){var c=Bc(b),d=Nf.data.xs[a.id][b];return(Dg(d)+Dg(c?c:d-50))/2}):(D=P(),C=function(a){return Dg(a.x)-D/2}),A=Ec(Nf.data.targets),Cj.select("."+g.eventRects).datum(A?A.values:[]),z=Cj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),jf(z.enter()),z.attr("class",ld).attr("x",wh?0:C).attr("y",wh?C:0).attr("width",wh?gg:D).attr("height",wh?D:ig),z.exit().remove())),Gc(Nf.data.targets).forEach(function(a){Jj[a]=!0})}function rf(){qf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function sf(){if(0!==Lc(Nf.data.targets).length){if("mousemove"===Mf.event.sourceEvent.type&&zj.altDomain)return Dg.domain(zj.altDomain),void zj.scale(Dg).updateScaleExtent();Wi&&Dg.orgDomain()[0]===Hj[0]&&Dg.domain([Hj[0]-1e-10,Dg.orgDomain()[1]]),qf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Mf.event.sourceEvent.type&&($i=!0)}}function tf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function uf(){Aj.attr("width",kg).attr("height",lg),Aj.select("#"+Pi).select("rect").attr("width",gg).attr("height",ig),Aj.select("#"+Qi).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),Aj.select("#"+Ri).select("rect").attr("x",H).attr("y",I).attr("width",N).attr("height",O),Aj.select("."+g.zoomRect).attr("width",gg).attr("height",ig),Gj.style("max-height",lg+"px")}function vf(a){return{axisX:a?hj.x.transition().duration(a):hj.x,axisY:a?hj.y.transition().duration(a):hj.y,axisY2:a?hj.y2.transition().duration(a):hj.y2,axisSubX:a?hj.subx.transition().duration(a):hj.subx}}function wf(a){var b;a=a||{},a.withTransition=Je(a,"withTransition",!0),a.withTransform=Je(a,"withTransform",!1),a.withLegend=Je(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withLegend&&qh||(b=vf(a.withTransitionForAxis?cg:0),p(),V(),uf(),o(a.withTransition,b)),qf(a,b)}function xf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=Cj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",nd),j=i.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Zc),e=Cj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),d=e.enter().append("g").attr("class",pd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",fd).style("cursor",function(a){return eh(a)?"pointer":null}),c=Cj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),b=c.enter().append("g").attr("class",od).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",bd),b.append("g").attr("class",jd),b.append("g").attr("class",function(a){return Xc(g.selectedCircles,a.id)}),b.append("g").attr("class",dd).style("cursor",function(a){return eh(a)?"pointer":null}),a.forEach(function(a){Cj.selectAll("."+g.selectedCircles+rd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=Cj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(ug(a)).attr("class",qd),f=h.enter().append("g").attr("class",qd),f.append("g").attr("class",hd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),nh&&(n=Dj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),m=n.enter().append("g").style("opacity",0).attr("class",pd),m.append("g").attr("class",fd),l=Dj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),k=l.enter().append("g").style("opacity",0).attr("class",od),k.append("g").attr("class",bd)),Aj.selectAll("."+g.target).filter(function(a){return Jc(a.id)}).transition().duration(cg).style("opacity",1)}function yf(a,b){b.filter&&(a=a.filter(b.filter)),(b.type||b.types)&&a.forEach(function(a){b.types?fe(a.id,b.types[a.id]):fe(a.id,b.type)}),Nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,z=0,F++)),E[a]=F,D[F]=f,A[a]=z,z+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+v)/10),j=10*Math.ceil((h.height+u)/10),k=nj?j:i,l=nj?U():T();return d&&(z=0,F=0,w=0,x=0),qh&&!Kc(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=i,C[c]=j,(!w||i>=w)&&(w=i),(!x||j>=x)&&(x=j),g=nj?x:w,void(vh?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(l-g*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=26,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=Ej.selectAll("."+g.legendItemFocused).size();b=b||{},n=Je(b,"withTransition",!0),q=Je(b,"withTransitionForTransform",!0),nj?(f=function(a){return w*E[a]},j=function(a){return D[E[a]]+A[a]}):(f=function(a){return D[E[a]]+A[a]},j=function(a){return x*E[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=Ej.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Xc(g.legendItem,a)}).style("visibility",function(a){return Kc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof sh?sh(a):Nf.toggle(a)}).on("mouseover",function(a){Mf.select(this).classed(g.legendItemFocused,!0),aj||Nf.focus(a),"function"==typeof th&&th(a)}).on("mouseout",function(a){Mf.select(this).classed(g.legendItemFocused,!1),aj||Nf.revert(),"function"==typeof uh&&uh(a)}),m.append("text").text(function(a){return d(Rg[a])?Rg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",nj?h:-200).attr("y",nj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",nj?i:-200).attr("y",nj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",cj).attr("x",nj?h:-200).attr("y",nj?-200:j).attr("width",10).attr("height",10),r=Ej.selectAll("text").data(a).text(function(a){return d(Rg[a])?Rg[a]:a}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=Ej.selectAll("rect."+g.legendItemEvent).data(a),(n?s.transition():s).attr("width",function(a){return B[a]}).attr("height",function(a){return C[a]}).attr("x",i).attr("y",l),t=Ej.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",cj).attr("x",f).attr("y",j),Ej.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Jc(a)}).transition().style("opacity",function(a){var b=Mf.select(this);return Jc(a)?!G||b.classed(g.legendItemFocused)?Bf(b):Cf(b):rj}),R(w),S(x),Q(F),p(),V(),uf(),o(q,c)}function If(a){return Ic(Nf.data.targets,a.id)}function Jf(a){return"data"in a&&Ic(Nf.data.targets,a.data.id)}function Kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function Lf(a,b,c){var d=!le(Nf.data.targets);aj=!1,fe(a,b),wf(c||{withTransitionForAxis:d})}var Mf=a.d3?a.d3:"undefined"!=typeof require?require("d3"):void 0,Nf={data:{},axis:{},legend:{}},Of={},Pf=i(["bindto"],"#chart"),Qf=i(["size","width"]),Rf=i(["size","height"]),Sf=i(["padding","left"]),Tf=i(["padding","right"]),Uf=i(["padding","top"]),Vf=i(["padding","bottom"]),Wf=i(["zoom","enabled"],!1),Xf=i(["zoom","extent"]),Yf=i(["zoom","privileged"],!1),Zf=i(["interaction","enabled"],!0),$f=i(["onenter"],function(){}),_f=i(["onleave"],function(){}),ag=i(["onresize"],function(){}),bg=i(["onresized"],function(){}),cg=i(["transition","duration"],350);h("data","data is required in config");var dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg,Kg,Lg,Mg,Ng=i(["data","x"]),Og=i(["data","xs"],{}),Pg=i(["data","x_format"]),Qg=i(["data","id_converter"],function(a){return a}),Rg=i(["data","names"],{}),Sg=i(["data","classes"],{}),Tg=i(["data","groups"],[]),Ug=i(["data","axes"],{}),Vg=i(["data","type"]),Wg=i(["data","types"],{}),Xg=i(["data","labels"],{}),Yg=i(["data","order"]),Zg=i(["data","regions"],{}),$g=i(["data","color"]),_g=i(["data","colors"],{}),ah=i(["data","hide"],!1),bh=i(["data","filter"]),ch=i(["data","selection","enabled"],!1),dh=i(["data","selection","grouped"],!1),eh=i(["data","selection","isselectable"],function(){return!0}),fh=i(["data","selection","multiple"],!0),gh=i(["data","onclick"],function(){}),hh=i(["data","onenter"],function(){}),ih=i(["data","onleave"],function(){}),jh=i(["data","onselected"],function(){}),kh=i(["data","onunselected"],function(){}),lh=i(["data","ondragstart"],function(){}),mh=i(["data","ondragend"],function(){}),nh=i(["subchart","show"],!1),oh=i(["subchart","size","height"],60),ph=i(["color","pattern"],[]),qh=i(["legend","show"],!0),rh=i(["legend","position"],"bottom"),sh=i(["legend","item","onclick"]),th=i(["legend","item","onmouseover"]),uh=i(["legend","item","onmouseout"]),vh=i(["legend","equally"],!1),wh=i(["axis","rotated"],!1),xh=i(["axis","x","show"],!0),yh=i(["axis","x","type"],"indexed"),zh=i(["axis","x","localtime"],!0),Ah=i(["axis","x","categories"],[]),Bh=i(["axis","x","tick","centered"],!1),Ch=i(["axis","x","tick","format"]),Dh=i(["axis","x","tick","culling"],{}),Eh=i(["axis","x","tick","culling","max"],10),Fh=i(["axis","x","tick","count"]),Gh=i(["axis","x","tick","fit"],!0),Hh=i(["axis","x","tick","values"],null),Ih=i(["axis","x","tick","rotate"]),Jh=i(["axis","x","max"],null),Kh=i(["axis","x","min"],null),Lh=i(["axis","x","padding"],{}),Mh=i(["axis","x","height"]),Nh=i(["axis","x","default"]),Oh=i(["axis","x","label"],{}),Ph=i(["axis","y","show"],!0),Qh=i(["axis","y","max"]),Rh=i(["axis","y","min"]),Sh=i(["axis","y","center"]),Th=i(["axis","y","label"],{}),Uh=i(["axis","y","inner"],!1),Vh=i(["axis","y","tick","format"]),Wh=i(["axis","y","padding"]),Xh=i(["axis","y","ticks"],10),Yh=i(["axis","y2","show"],!1),Zh=i(["axis","y2","max"]),$h=i(["axis","y2","min"]),_h=i(["axis","y2","center"]),ai=i(["axis","y2","label"],{}),bi=i(["axis","y2","inner"],!1),ci=i(["axis","y2","tick","format"]),di=i(["axis","y2","padding"]),ei=i(["axis","y2","ticks"],10),fi=i(["grid","x","show"],!1),gi=i(["grid","x","type"],"tick"),hi=i(["grid","x","lines"],[]),ii=i(["grid","y","show"],!1),ji=i(["grid","y","lines"],[]),ki=i(["grid","y","ticks"],10),li=i(["point","show"],!0),mi=i(["point","r"],2.5),ni=i(["point","focus","line","enabled"],!0),oi=i(["point","focus","expand","enabled"],!0),pi=i(["point","focus","expand","r"]),qi=i(["point","focus","select","r"]),ri=i(["line","connect_null"],!1),si=i(["bar","width"]),ti=i(["bar","width","ratio"],.6),ui=i(["pie","label","show"],!0),vi=i(["pie","label","format"]),wi=i(["pie","expand"],!0),xi=i(["pie","onclick"],function(){}),yi=i(["pie","onmouseover"],function(){}),zi=i(["pie","onmouseout"],function(){}),Ai=i(["donut","label","show"],!0),Bi=i(["donut","label","format"]),Ci=i(["donut","expand"],!0),Di=i(["donut","title"],""),Ei=i(["donut","onclick"],function(){}),Fi=i(["donut","onmouseover"],function(){}),Gi=i(["donut","onmouseout"],function(){}),Hi=i(["regions"],[]),Ii=i(["tooltip","show"],!0),Ji=i(["tooltip","format","title"]),Ki=i(["tooltip","format","value"]),Li=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Ji?Ji:b,l=Ki?Ki:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Mi=i(["tooltip","init","show"],!1),Ni=i(["tooltip","init","x"],0),Oi=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Pi=("string"==typeof Pf?Pf.replace(/[# .>~+]/g,""):g.chart+ +new Date)+"-clip",Qi=Pi+"-xaxis",Ri=Pi+"-yaxis",Si=j(Pi),Ti=j(Qi),Ui=j(Ri),Vi="timeseries"===yh,Wi="categorized"===yh,Xi=!Vi&&(Ng||Fe(Og)),Yi=null,Zi=!1,$i=!1,_i=!1,aj=!1,bj=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],cj=ze(_g,Fe(ph)?ph:bj,$g),dj=zh?Mf.time.format:Mf.time.format.utc,ej=dj.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),fj=[],gj=[],hj={},ij=wh?"left":"bottom",jj=wh?Uh?"top":"bottom":Uh?"right":"left",kj=wh?bi?"bottom":"top":bi?"left":"right",lj=wh?"left":"bottom",mj={main:function(){return"translate("+k(dg.left)+","+k(dg.top)+")"},context:function(){return"translate("+k(eg.left)+","+k(eg.top)+")"},legend:function(){return"translate("+fg.left+","+fg.top+")" +for(q=wh?function(a){return e(a.value)}:function(a){return b(a.x)},r=wh?function(a){return b(a.x)}:function(a){return e(a.value)},i=Vi?function(a,c,d,f){var g=a.x.getTime(),h=c.x-a.x,i=new Date(g+h*d),j=new Date(g+h*(d+f));return"M"+b(i)+" "+e(k(d))+" "+b(j)+" "+e(k(d+f))}:function(a,c,d,f){return"M"+b(j(d),!0)+" "+e(k(d))+" "+b(j(d+f),!0)+" "+e(k(d+f))},g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function hf(b){var c,d,e;if(Gj=Mf.select(Pf),Gj.empty())throw new Error("Element to bind not found");if(Gj.html("").classed("c3",!0),Nf.data.xs={},Nf.data.targets=zc(b),bh&&(Nf.data.targets=Nf.data.targets.filter(bh)),ah&&Oc(ah===!0?Gc(Nf.data.targets):ah),p(),V(),Dg.domain(Mf.extent(dc(Nf.data.targets))),Eg.domain(_b(Nf.data.targets,"y")),Fg.domain(_b(Nf.data.targets,"y2")),Gg.domain(Dg.domain()),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Hj=Dg.domain(),vj.scale(Gg),Wf&&zj.scale(Dg),Aj=Gj.append("svg").style("overflow","hidden").on("mouseenter",$f).on("mouseleave",_f),Bj=Aj.append("defs"),Bj.append("clipPath").attr("id",Pi).append("rect"),Bj.append("clipPath").attr("id",Qi).append("rect"),Bj.append("clipPath").attr("id",Ri).append("rect"),uf(),Cj=Aj.append("g").attr("transform",mj.main),Dj=Aj.append("g").attr("transform",mj.context),Ej=Aj.append("g").attr("transform",mj.legend),nh||Dj.style("visibility","hidden"),qh||(Ej.style("visibility","hidden"),gj=Gc(Nf.data.targets)),Fj=Gj.style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Hf(Gc(Nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=Cj.append("g").attr("clip-path",Si).attr("class",g.grid),fi&&d.append("g").attr("class",g.xgrids),Fe(hi)&&d.append("g").attr("class",g.xgridLines),ni&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),ii&&d.append("g").attr("class",g.ygrids),Fe(ji)&&d.append("g").attr("class",g.ygridLines),Cj.append("g").attr("clip-path",Si).attr("class",g.regions),Cj.append("g").attr("clip-path",Si).attr("class",g.chart),c=Cj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Wf?wh?"ns-resize":"ew-resize":null),Cj.select("."+g.chart).append("g").attr("class",g.chartBars),Cj.select("."+g.chart).append("g").attr("class",g.chartLines),Cj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",mj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Vb()),Cj.select("."+g.chart).append("g").attr("class",g.chartTexts),Wf&&Cj.insert("rect",Yf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",gg).attr("height",ig).style("opacity",0).style("cursor",wh?"ns-resize":"ew-resize").call(zj).on("dblclick.zoom",null),Nh&&vj.extent("function"!=typeof Nh?Nh:Nh(dc())),hj.x=Cj.append("g").attr("class",g.axisX).attr("clip-path",Ti).attr("transform",mj.x).style("visibility",xh?"visible":"hidden"),hj.x.append("text").attr("class",g.axisXLabel).attr("transform",wh?"rotate(-90)":"").style("text-anchor",Eb),hj.y=Cj.append("g").attr("class",g.axisY).attr("clip-path",Ui).attr("transform",mj.y).style("visibility",Ph?"visible":"hidden"),hj.y.append("text").attr("class",g.axisYLabel).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Fb),hj.y2=Cj.append("g").attr("class",g.axisY2).attr("transform",mj.y2).style("visibility",Yh?"visible":"hidden"),hj.y2.append("text").attr("class",g.axisY2Label).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Gb),Dj.append("g").attr("clip-path",Si).attr("class",g.chart),Dj.select("."+g.chart).append("g").attr("class",g.chartBars),Dj.select("."+g.chart).append("g").attr("class",g.chartLines),Dj.append("g").attr("clip-path",Si).attr("class",g.brush).call(vj).selectAll("rect").attr(wh?"width":"height",wh?hg:jg),hj.subx=Dj.append("g").attr("class",g.axisX).attr("transform",mj.subx).attr("clip-path",wh?"":Ti),xf(Nf.data.targets),qf({withUpdateTranslate:!0,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Mi){if(Vi&&"string"==typeof Ni){for(Ni=Ae(Ni),e=0;e0){d=[];for(var f in Rg)for(c=0;cf&&h>c&&d>i&&j>d;else{if(!n.classed(g.bar))return;m=Rd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Qe,q=!(c>h||f>c+e||d>j||i>d+k)}q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function nf(a){le(Nf.data.targets)||ch&&(Yi=a,Cj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Zi=!0,lh())}function of(){le(Nf.data.targets)||ch&&(Cj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),Cj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Zi=!1,mh())}function pf(a,b){"grid"===b&&a.each(function(){var a=Mf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function qf(a,c){var d,e,f,h,i,j,k,l,m,n,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,Q,R,S,T,U,W,X,Y,Z,$=ae(),_=le(Nf.data.targets),ab=Lc(Nf.data.targets);if(a=a||{},E=Je(a,"withY",!0),F=Je(a,"withSubchart",!0),G=Je(a,"withTransition",!0),J=Je(a,"withTransform",!1),K=Je(a,"withUpdateXDomain",!1),L=Je(a,"withUpdateOrgXDomain",!1),N=Je(a,"withUpdateTranslate",!1),M=Je(a,"withLegend",!1),H=Je(a,"withTransitionForExit",G),I=Je(a,"withTransitionForAxis",G),T=G?cg:0,U=H?T:0,W=I?T:0,c=c||vf(W),N&&(wh?(hj.x.call(Jg),hj.subx.call(Mg)):(hj.y.call(Kg),hj.y2.call(Lg)),p(),V(),uf(),o(!1)),M&&qh&&Hf(Gc(Nf.data.targets),a,c),Wi&&0===ab.length&&Dg.domain([0,hj.x.selectAll(".tick").size()]),ab.length&&(L&&(Dg.domain(Mf.extent(dc(ab))),Hj=Dg.domain(),Wf&&zj.scale(Dg).updateScaleExtent(),Gg.domain(Dg.domain()),vj.scale(Gg)),K&&(Dg.domain(vj.empty()?Hj:vj.extent()),Wf&&zj.scale(Dg).updateScaleExtent()),Hh||!Gh&&!Fh||(X=Nc(Mc(ab),Fh),Jg.tickValues(X),Mg.tickValues(X))),Eg.domain(_b(ab,"y")),Fg.domain(_b(ab,"y2")),hj.x.style("opacity",_?0:1),hj.y.style("opacity",_?0:1),hj.y2.style("opacity",_?0:1),hj.subx.style("opacity",_?0:1),c.axisX.call(Jg),c.axisY.call(Kg),c.axisY2.call(Lg),c.axisSubX.call(Mg),Ib(G),K&&ab.length)if(Dh&&X){for(Y=1;Y=0&&Mf.select(this).style("display",b%Z?"none":"block")})}else Aj.selectAll("."+g.axisX+" .tick text").style("display","block");!wh&&Ih&&jb(hj.x,c.axisX,Ih),O=bf($),R=cf($,!0),S=cf($,!1),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Fj.style("display","none"),q(),Cj.select("line."+g.xgridFocus).style("visibility","hidden"),fi&&(f=Zd(gi,Dg),B=Wi?Jg.tickOffset():0,e=wh?{x1:0,x2:gg,y1:function(a){return Dg(a)-B},y2:function(a){return Dg(a)-B}}:{x1:function(a){return Dg(a)+B},x2:function(a){return Dg(a)+B},y1:dg.top,y2:ig},d=Cj.select("."+g.xgrids).selectAll("."+g.xgrid).data(f),d.enter().append("line").attr("class",g.xgrid),d.attr(e).style("opacity",function(){return+Mf.select(this).attr(wh?"y1":"x1")===(wh?ig:0)?0:1}),d.exit().remove()),Fe(hi)&&(h=Cj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(hi),i=h.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),i.append("line").style("opacity",0),i.append("text").attr("text-anchor","end").attr("transform",wh?"":"rotate(-90)").attr("dx",wh?0:-dg.top).attr("dy",-5).style("opacity",0),h.select("line").transition().duration(T).attr("x1",wh?0:Jd).attr("x2",wh?gg:Jd).attr("y1",wh?Jd:dg.top).attr("y2",wh?Jd:ig).style("opacity",1),h.select("text").transition().duration(T).attr("x",wh?gg:0).attr("y",Jd).text(function(a){return a.text}).style("opacity",1),h.exit().transition().duration(T).style("opacity",0).remove()),E&&ii&&(j=Cj.select("."+g.ygrids).selectAll("."+g.ygrid).data(Eg.ticks(ki)),j.enter().append("line").attr("class",g.ygrid),j.attr("x1",wh?Eg:0).attr("x2",wh?Eg:gg).attr("y1",wh?0:Eg).attr("y2",wh?ig:Eg),j.exit().remove(),pf(j,"grid")),E&&Fe(ji)&&(k=Cj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(ji),l=k.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",wh?"rotate(-90)":"").attr("dx",wh?0:-dg.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",wh?Kd:0).attr("x2",wh?Kd:gg).attr("y1",wh?0:Kd).attr("y2",wh?ig:Kd).style("opacity",1),k.select("text").transition().duration(T).attr("x",wh?0:gg).attr("y",Kd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),u=Cj.select("."+g.regions).selectAll("."+g.region).data(Hi),u.enter().append("g").attr("class",kd).append("rect").style("fill-opacity",0),u.selectAll("rect").transition().duration(T).attr("x",ic).attr("y",jc).attr("width",kc).attr("height",lc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),u.exit().transition().duration(T).style("opacity",0).remove(),s=Cj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),s.enter().append("path").attr("class",ed).style("stroke","none").style("fill",cj),s.style("opacity",wd).transition().duration(T).attr("d",O).style("fill",cj).style("opacity",1),s.exit().transition().duration(U).style("opacity",0).remove(),m=Cj.selectAll("."+g.lines).selectAll("."+g.line).data(te),m.enter().append("path").attr("class",ad).style("stroke",cj),m.style("opacity",wd).transition().duration(T).attr("d",wj).style("stroke",cj).style("opacity",1),m.exit().transition().duration(U).style("opacity",0).remove(),n=Cj.selectAll("."+g.areas).selectAll("."+g.area).data(te),n.enter().append("path").attr("class",id).style("fill",cj).style("opacity",function(){return Ij=+Mf.select(this).style("opacity"),0}),n.style("opacity",0).transition().duration(T).attr("d",xj).style("fill",cj).style("opacity",Ij),n.exit().transition().duration(U).style("opacity",0).remove(),r=Cj.selectAll("."+g.circles).selectAll("."+g.circle).data(we),r.enter().append("circle").attr("class",cd).attr("r",Ue).style("fill",cj),r.style("opacity",wd).transition().duration(T).style("opacity",yd).style("fill",cj).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d),r.exit().remove(),v=Cj.selectAll("."+g.texts).selectAll("."+g.text).data(xe),v.enter().append("text").attr("class",Yc).attr("text-anchor",function(a){return wh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",cj).style("fill-opacity",0),v.text(function(a){return Hd(a.id)(a.value,a.id)}).style("fill-opacity",xd).transition().duration(T).attr("x",R).attr("y",S).style("fill",cj).style("fill-opacity",zd),v.exit().transition().duration(U).style("fill-opacity",0).remove(),t=Cj.selectAll("."+g.arcs).selectAll("."+g.arc).data(ue),t.enter().append("path").attr("class",gd).style("fill",function(a){return cj(a.data)}).style("cursor",function(a){return eh(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;aj||(c=Jb(a),d=Pb(c),e=Xb(),Rb(c.data.id),Df(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Jb(a),c=Pb(b),d=[c];Vd(d,Mf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;aj||(c=Jb(a),d=Pb(c),e=Yb(),Sb(c.data.id),Ef(),Wd(),e(d,b))}).on("click",function(a,b){var c=Jb(a),d=Pb(c),e=Wb();lf(this,a,b),e(d,b)}),t.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){aj=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Jb(a);return c?(b=Mf.interpolate(this._current,c),this._current=b(0),function(a){return Mb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("fill",function(a){return cj(a.data)}).style("opacity",1).call(Ie,function(){aj=!1}),t.exit().transition().duration(U).style("opacity",0).remove(),Cj.selectAll("."+g.chartArc).select("text").attr("transform",Nb).style("opacity",0).transition().duration(T).text(Qb).style("opacity",function(a){return Jc(a.data.id)&&se(a.data)?1:0}),Cj.select("."+g.chartArcsTitle).style("opacity",ke(Nf.data.targets)?1:0),nh&&(Mf.event&&"zoom"===Mf.event.type&&vj.extent(Dg.orgDomain()).update(),F&&(!wh&&Ih&&jb(hj.subx,c.axisSubX,Ih),vj.empty()||vj.extent(Dg.orgDomain()).update(),Q=bf($,!0),x=Dj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),x.enter().append("path").attr("class",ed).style("stroke","none").style("fill",cj),x.style("opacity",wd).transition().duration(T).attr("d",Q).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove(),w=Dj.selectAll("."+g.lines).selectAll("."+g.line).data(te),w.enter().append("path").attr("class",ad).style("stroke",cj),w.style("opacity",wd).transition().duration(T).attr("d",yj).style("opacity",1),w.exit().transition().duration(T).style("opacity",0).remove())),Cj.selectAll("."+g.selectedCircles).filter(function(a){return oe(a)}).selectAll("circle").remove(),Cj.selectAll("."+g.selectedCircle).transition().duration(T).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d),Zf&&(y=Cj.select("."+g.eventRects),Fe(Og)&&!sc(Og)?(y.classed(g.eventRectsMultiple)||y.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),z=Cj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),kf(z.enter()),z.attr("x",0).attr("y",0).attr("width",gg).attr("height",ig)):(y.classed(g.eventRectsSingle)||y.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Xi&&!Wi?(D=function(a,b){var c=Bc(b),d=Cc(b),e=Nf.data.xs[a.id][b];return(Dg(d?d:e+50)-Dg(c?c:e-50))/2},C=function(a,b){var c=Bc(b),d=Nf.data.xs[a.id][b];return(Dg(d)+Dg(c?c:d-50))/2}):(D=P(),C=function(a){return Dg(a.x)-D/2}),A=Ec(Nf.data.targets),Cj.select("."+g.eventRects).datum(A?A.values:[]),z=Cj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),jf(z.enter()),z.attr("class",ld).attr("x",wh?0:C).attr("y",wh?C:0).attr("width",wh?gg:D).attr("height",wh?D:ig),z.exit().remove())),Gc(Nf.data.targets).forEach(function(a){Jj[a]=!0})}function rf(){qf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function sf(){if(0!==Lc(Nf.data.targets).length){if("mousemove"===Mf.event.sourceEvent.type&&zj.altDomain)return Dg.domain(zj.altDomain),void zj.scale(Dg).updateScaleExtent();Wi&&Dg.orgDomain()[0]===Hj[0]&&Dg.domain([Hj[0]-1e-10,Dg.orgDomain()[1]]),qf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Mf.event.sourceEvent.type&&($i=!0)}}function tf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function uf(){Aj.attr("width",kg).attr("height",lg),Aj.select("#"+Pi).select("rect").attr("width",gg).attr("height",ig),Aj.select("#"+Qi).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),Aj.select("#"+Ri).select("rect").attr("x",H).attr("y",I).attr("width",N).attr("height",O),Aj.select("."+g.zoomRect).attr("width",gg).attr("height",ig),Gj.style("max-height",lg+"px")}function vf(a){return{axisX:a?hj.x.transition().duration(a):hj.x,axisY:a?hj.y.transition().duration(a):hj.y,axisY2:a?hj.y2.transition().duration(a):hj.y2,axisSubX:a?hj.subx.transition().duration(a):hj.subx}}function wf(a){var b;a=a||{},a.withTransition=Je(a,"withTransition",!0),a.withTransform=Je(a,"withTransform",!1),a.withLegend=Je(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withLegend&&qh||(b=vf(a.withTransitionForAxis?cg:0),p(),V(),uf(),o(a.withTransition,b)),qf(a,b)}function xf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=Cj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",nd),j=i.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Zc),e=Cj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),d=e.enter().append("g").attr("class",pd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",fd).style("cursor",function(a){return eh(a)?"pointer":null}),c=Cj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),b=c.enter().append("g").attr("class",od).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",bd),b.append("g").attr("class",jd),b.append("g").attr("class",function(a){return Xc(g.selectedCircles,a.id)}),b.append("g").attr("class",dd).style("cursor",function(a){return eh(a)?"pointer":null}),a.forEach(function(a){Cj.selectAll("."+g.selectedCircles+rd(a.id)).selectAll("."+g.selectedCircle).each(function(b){b.value=a.values[b.index].value})}),h=Cj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(ug(a)).attr("class",qd),f=h.enter().append("g").attr("class",qd),f.append("g").attr("class",hd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),nh&&(n=Dj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),m=n.enter().append("g").style("opacity",0).attr("class",pd),m.append("g").attr("class",fd),l=Dj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),k=l.enter().append("g").style("opacity",0).attr("class",od),k.append("g").attr("class",bd)),Aj.selectAll("."+g.target).filter(function(a){return Jc(a.id)}).transition().duration(cg).style("opacity",1)}function yf(a,b){b.filter&&(a=a.filter(b.filter)),(b.type||b.types)&&a.forEach(function(a){b.types?fe(a.id,b.types[a.id]):fe(a.id,b.type)}),Nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,z=0,F++)),E[a]=F,D[F]=f,A[a]=z,z+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+v)/10),j=10*Math.ceil((h.height+u)/10),k=nj?j:i,l=nj?U():T();return d&&(z=0,F=0,w=0,x=0),qh&&!Kc(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=i,C[c]=j,(!w||i>=w)&&(w=i),(!x||j>=x)&&(x=j),g=nj?x:w,void(vh?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(l-g*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=26,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=Ej.selectAll("."+g.legendItemFocused).size();b=b||{},n=Je(b,"withTransition",!0),q=Je(b,"withTransitionForTransform",!0),nj?(f=function(a){return w*E[a]},j=function(a){return D[E[a]]+A[a]}):(f=function(a){return D[E[a]]+A[a]},j=function(a){return x*E[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=Ej.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Xc(g.legendItem,a)}).style("visibility",function(a){return Kc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof sh?sh(a):Nf.toggle(a)}).on("mouseover",function(a){Mf.select(this).classed(g.legendItemFocused,!0),aj||Nf.focus(a),"function"==typeof th&&th(a)}).on("mouseout",function(a){Mf.select(this).classed(g.legendItemFocused,!1),aj||Nf.revert(),"function"==typeof uh&&uh(a)}),m.append("text").text(function(a){return d(Rg[a])?Rg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",nj?h:-200).attr("y",nj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",nj?i:-200).attr("y",nj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",cj).attr("x",nj?h:-200).attr("y",nj?-200:j).attr("width",10).attr("height",10),r=Ej.selectAll("text").data(a).text(function(a){return d(Rg[a])?Rg[a]:a}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=Ej.selectAll("rect."+g.legendItemEvent).data(a),(n?s.transition():s).attr("width",function(a){return B[a]}).attr("height",function(a){return C[a]}).attr("x",i).attr("y",l),t=Ej.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",cj).attr("x",f).attr("y",j),Ej.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Jc(a)}).transition().style("opacity",function(a){var b=Mf.select(this);return Jc(a)?!G||b.classed(g.legendItemFocused)?Bf(b):Cf(b):rj}),R(w),S(x),Q(F),p(),V(),uf(),o(q,c)}function If(a){return Ic(Nf.data.targets,a.id)}function Jf(a){return"data"in a&&Ic(Nf.data.targets,a.data.id)}function Kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function Lf(a,b,c){var d=!le(Nf.data.targets);aj=!1,fe(a,b),wf(c||{withTransitionForAxis:d})}var Mf=a.d3?a.d3:"undefined"!=typeof require?require("d3"):void 0,Nf={data:{},axis:{},legend:{}},Of={},Pf=i(["bindto"],"#chart"),Qf=i(["size","width"]),Rf=i(["size","height"]),Sf=i(["padding","left"]),Tf=i(["padding","right"]),Uf=i(["padding","top"]),Vf=i(["padding","bottom"]),Wf=i(["zoom","enabled"],!1),Xf=i(["zoom","extent"]),Yf=i(["zoom","privileged"],!1),Zf=i(["interaction","enabled"],!0),$f=i(["onenter"],function(){}),_f=i(["onleave"],function(){}),ag=i(["onresize"],function(){}),bg=i(["onresized"],function(){}),cg=i(["transition","duration"],350);h("data","data is required in config");var dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg,Kg,Lg,Mg,Ng=i(["data","x"]),Og=i(["data","xs"],{}),Pg=i(["data","x_format"]),Qg=i(["data","id_converter"],function(a){return a}),Rg=i(["data","names"],{}),Sg=i(["data","classes"],{}),Tg=i(["data","groups"],[]),Ug=i(["data","axes"],{}),Vg=i(["data","type"]),Wg=i(["data","types"],{}),Xg=i(["data","labels"],{}),Yg=i(["data","order"]),Zg=i(["data","regions"],{}),$g=i(["data","color"]),_g=i(["data","colors"],{}),ah=i(["data","hide"],!1),bh=i(["data","filter"]),ch=i(["data","selection","enabled"],!1),dh=i(["data","selection","grouped"],!1),eh=i(["data","selection","isselectable"],function(){return!0}),fh=i(["data","selection","multiple"],!0),gh=i(["data","onclick"],function(){}),hh=i(["data","onenter"],function(){}),ih=i(["data","onleave"],function(){}),jh=i(["data","onselected"],function(){}),kh=i(["data","onunselected"],function(){}),lh=i(["data","ondragstart"],function(){}),mh=i(["data","ondragend"],function(){}),nh=i(["subchart","show"],!1),oh=i(["subchart","size","height"],60),ph=i(["color","pattern"],[]),qh=i(["legend","show"],!0),rh=i(["legend","position"],"bottom"),sh=i(["legend","item","onclick"]),th=i(["legend","item","onmouseover"]),uh=i(["legend","item","onmouseout"]),vh=i(["legend","equally"],!1),wh=i(["axis","rotated"],!1),xh=i(["axis","x","show"],!0),yh=i(["axis","x","type"],"indexed"),zh=i(["axis","x","localtime"],!0),Ah=i(["axis","x","categories"],[]),Bh=i(["axis","x","tick","centered"],!1),Ch=i(["axis","x","tick","format"]),Dh=i(["axis","x","tick","culling"],{}),Eh=i(["axis","x","tick","culling","max"],10),Fh=i(["axis","x","tick","count"]),Gh=i(["axis","x","tick","fit"],!0),Hh=i(["axis","x","tick","values"],null),Ih=i(["axis","x","tick","rotate"]),Jh=i(["axis","x","max"],null),Kh=i(["axis","x","min"],null),Lh=i(["axis","x","padding"],{}),Mh=i(["axis","x","height"]),Nh=i(["axis","x","default"]),Oh=i(["axis","x","label"],{}),Ph=i(["axis","y","show"],!0),Qh=i(["axis","y","max"]),Rh=i(["axis","y","min"]),Sh=i(["axis","y","center"]),Th=i(["axis","y","label"],{}),Uh=i(["axis","y","inner"],!1),Vh=i(["axis","y","tick","format"]),Wh=i(["axis","y","padding"]),Xh=i(["axis","y","ticks"],10),Yh=i(["axis","y2","show"],!1),Zh=i(["axis","y2","max"]),$h=i(["axis","y2","min"]),_h=i(["axis","y2","center"]),ai=i(["axis","y2","label"],{}),bi=i(["axis","y2","inner"],!1),ci=i(["axis","y2","tick","format"]),di=i(["axis","y2","padding"]),ei=i(["axis","y2","ticks"],10),fi=i(["grid","x","show"],!1),gi=i(["grid","x","type"],"tick"),hi=i(["grid","x","lines"],[]),ii=i(["grid","y","show"],!1),ji=i(["grid","y","lines"],[]),ki=i(["grid","y","ticks"],10),li=i(["point","show"],!0),mi=i(["point","r"],2.5),ni=i(["point","focus","line","enabled"],!0),oi=i(["point","focus","expand","enabled"],!0),pi=i(["point","focus","expand","r"]),qi=i(["point","focus","select","r"]),ri=i(["line","connect_null"],!1),si=i(["bar","width"]),ti=i(["bar","width","ratio"],.6),ui=i(["pie","label","show"],!0),vi=i(["pie","label","format"]),wi=i(["pie","expand"],!0),xi=i(["pie","onclick"],function(){}),yi=i(["pie","onmouseover"],function(){}),zi=i(["pie","onmouseout"],function(){}),Ai=i(["donut","label","show"],!0),Bi=i(["donut","label","format"]),Ci=i(["donut","expand"],!0),Di=i(["donut","title"],""),Ei=i(["donut","onclick"],function(){}),Fi=i(["donut","onmouseover"],function(){}),Gi=i(["donut","onmouseout"],function(){}),Hi=i(["regions"],[]),Ii=i(["tooltip","show"],!0),Ji=i(["tooltip","format","title"]),Ki=i(["tooltip","format","value"]),Li=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Ji?Ji:b,l=Ki?Ki:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Mi=i(["tooltip","init","show"],!1),Ni=i(["tooltip","init","x"],0),Oi=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Pi=("string"==typeof Pf?Pf.replace(/[# .>~+]/g,""):g.chart+ +new Date)+"-clip",Qi=Pi+"-xaxis",Ri=Pi+"-yaxis",Si=j(Pi),Ti=j(Qi),Ui=j(Ri),Vi="timeseries"===yh,Wi="categorized"===yh,Xi=!Vi&&(Ng||Fe(Og)),Yi=null,Zi=!1,$i=!1,_i=!1,aj=!1,bj=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],cj=ze(_g,Fe(ph)?ph:bj,$g),dj=zh?Mf.time.format:Mf.time.format.utc,ej=dj.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),fj=[],gj=[],hj={},ij=wh?"left":"bottom",jj=wh?Uh?"top":"bottom":Uh?"right":"left",kj=wh?bi?"bottom":"top":bi?"left":"right",lj=wh?"left":"bottom",mj={main:function(){return"translate("+k(dg.left)+","+k(dg.top)+")"},context:function(){return"translate("+k(eg.left)+","+k(eg.top)+")"},legend:function(){return"translate("+fg.left+","+fg.top+")" },x:function(){return"translate(0,"+(wh?0:ig)+")"},y:function(){return"translate(0,"+(wh?ig:0)+")"},y2:function(){return"translate("+(wh?0:gg)+","+(wh?1:0)+")"},subx:function(){return"translate(0,"+(wh?0:jg)+")"},arc:function(){return"translate("+pg/2+","+qg/2+")"}},nj="right"===rh,oj=0,pj=0,qj=0,rj=.15,sj=30,tj=wh&&!xh?0:30,uj=5;ug=Mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var vj,wj=function(){var a=Mf.svg.line().x(wh?function(a){return $(a.id)(a.value)}:Id).y(wh?Id:function(a){return $(a.id)(a.value)});return ri||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ri?Te(b.values):b.values;return me(b)?(a.interpolate(ne(b)?"cardinal":"linear"),Zg[b.id]?gf(e,Dg,$(b.id),Zg[b.id]):a(e)):(c=e[0]?Dg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,wh?"M "+d+" "+c:"M "+c+" "+d)}}(),xj=function(){var a;return a=wh?Mf.svg.area().x0(function(a){return $(a.id)(0)}).x1(function(a){return $(a.id)(a.value)}).y(Id):Mf.svg.area().x(Id).y0(function(a){return $(a.id)(0)}).y1(function(a){return $(a.id)(a.value)}),function(b){var c,d,e=Te(b.values);return ge([b],"area")||ge([b],"area-spline")?(a.interpolate(ne(b)?"cardinal":"linear"),a(e)):(c=e[0]?Dg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,wh?"M "+d+" "+c:"M "+c+" "+d)}}(),yj=function(){var a=Mf.svg.line().x(wh?function(a){return _(a.id)(a.value)}:Ld).y(wh?Ld:function(a){return _(a.id)(a.value)});return function(b){var c=Te(b.values);return me(b)?a(c):"M "+Gg(c[0].x)+" "+_(b.id)(c[0].value)}}(),zj=function(){};vj=Mf.svg.brush().on("brush",rf),vj.update=function(){return Dj&&Dj.select("."+g.brush).call(this),this},vj.scale=function(a){return wh?this.y(a):this.x(a)},Wf&&(zj=Mf.behavior.zoom().on("zoomstart",function(){zj.altDomain=Mf.event.sourceEvent.altKey?Dg.orgDomain():null}).on("zoom",Wf?sf:null),zj.scale=function(a){return wh?this.y(a):this.x(a)},zj.orgScaleExtent=function(){var a=Xf?Xf:[1,10];return[a[0],Math.max(Dc()/a[1],a[1])]},zj.updateScaleExtent=function(){var a=ec(Dg.orgDomain())/ec(Hj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Aj,Bj,Cj,Dj,Ej,Fj,Gj,Hj,Ij,Jj={};if(Nf.focus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);Nf.revert(),Nf.defocus(),b(d.classed(g.focused,!0)),b(e),le(Nf.data.targets)&&Rb(a,!0),Df(a,!0)},Nf.defocus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",.3)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);Nf.revert(),b(d.classed(g.focused,!1)),b(e),le(Nf.data.targets)&&Sb(a),Df(a,!1)},Nf.revert=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);b(d.classed(g.focused,!1)),b(e),le(Nf.data.targets)&&Sb(a),Ef()},Nf.show=function(a,b){a=Hc(a),b=b||{},Pc(a),Aj.selectAll(td(a)).transition().style("opacity",1),b.withLegend&&Ff(a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Nf.hide=function(a,b){a=Hc(a),b=b||{},Oc(a),Aj.selectAll(td(a)).transition().style("opacity",0),b.withLegend&&Gf(a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Nf.toggle=function(a){Jc(a)?Nf.hide(a):Nf.show(a)},Nf.unzoom=function(){vj.clear().update(),qf({withUpdateXDomain:!0})},Nf.load=function(a){return a.xs&&rc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Sg[b]=a.classes[b]}),"categories"in a&&Wi&&(Ah=a.categories,Jg.categories(Ah)),"cacheIds"in a&&fc(a.cacheIds)?void yf(hc(a.cacheIds),a.done):void("unload"in a?Af(Hc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){zf(a)}):zf(a))},Nf.unload=function(a,b){Af(Hc(a),function(){qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Nf.selected=function(a){return Mf.merge(Cj.selectAll("."+g.shapes+rd(a)).selectAll("."+g.shape).filter(function(){return Mf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Nf.select=function(a,b,c){ch&&Cj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Mf.select(this),i=e.data?e.data.id:e.id,j=Se(this),k=dh||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);h.classed(g.line)||h.classed(g.area)||(k&&l?eh(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},Nf.unselect=function(a,b){ch&&Cj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Mf.select(this),f=c.data?c.data.id:c.id,h=Se(this),i=dh||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);e.classed(g.line)||e.classed(g.area)||i&&j&&eh(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Nf.toLine=function(a){Lf(a,"line")},Nf.toSpline=function(a){Lf(a,"spline")},Nf.toBar=function(a){Lf(a,"bar")},Nf.toScatter=function(a){Lf(a,"scatter")},Nf.toArea=function(a){Lf(a,"area")},Nf.toAreaSpline=function(a){Lf(a,"area-spline")},Nf.toPie=function(a){Lf(a,"pie",{withTransform:!0})},Nf.toDonut=function(a){Lf(a,"donut",{withTransform:!0})},Nf.groups=function(a){return c(a)?Tg:(Tg=a,qf(),Tg)},Nf.xgrids=function(a){return a?(hi=a,qf(),hi):hi},Nf.xgrids.add=function(a){return a?Nf.xgrids(hi.concat(a)):void 0},Nf.xgrids.remove=function(a){var b=Kf(a);return Nf.xgrids(hi.filter(b))},Nf.ygrids=function(a){return a?(ji=a,qf(),ji):ji},Nf.ygrids.add=function(a){return a?Nf.ygrids(ji.concat(a)):void 0},Nf.ygrids.remove=function(a){var b=Kf(a);return Nf.ygrids(ji.filter(b))},Nf.regions=function(a){return a?(Hi=a,qf(),Hi):Hi},Nf.regions.add=function(a){return a?(Hi=Hi.concat(a),qf(),Hi):Hi},Nf.regions.remove=function(a){var b,c,d;return a=a||{},b=Je(a,"duration",cg),c=Je(a,"classes",[g.region]),d=Cj.select("."+g.regions).selectAll(c.map(function(a){return"."+a})),(b?d.transition().duration(b):d).style("opacity",0).remove(),Hi=Hi.filter(function(a){var b=!1;return a.class?(a.class.split(" ").forEach(function(a){c.indexOf(a)>=0&&(b=!0)}),!b):!0})},Nf.data.get=function(a){var b=Nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Nf.data.getAsTarget=function(a){var b=Nf.data.targets.filter(function(b){return b.id===a});return b.length>0?b[0]:void 0},Nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Rg[b]=a[b]}),qf({withLegend:!0}),Rg):Rg},Nf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){_g[b]=a[b]}),qf({withLegend:!0}),_g):_g},Nf.x=function(a){return arguments.length&&(uc(Nf.data.targets,a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Nf.data.xs},Nf.xs=function(a){return arguments.length&&(vc(Nf.data.targets,a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Nf.data.xs},Nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){gb(b,a[b])}),Ib())},Nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Jh=+a.x),b(a.y)&&(Qh=+a.y),b(a.y2)&&(Zh=+a.y2)):Qh=Zh=+a,qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Kh=+a.x),b(a.y)&&(Rh=+a.y),b(a.y2)&&($h=+a.y2)):Rh=$h=+a,qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Nf.axis.max(a.max),"undefined"!=typeof a.min&&Nf.axis.min(a.min))},Nf.legend.show=function(a){Ff(Hc(a)),qf({withLegend:!0})},Nf.legend.hide=function(a){Gf(Hc(a)),qf({withLegend:!0})},Nf.resize=function(a){Qf=a?a.width:null,Rf=a?a.height:null,wf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Nf.destroy=function(){Nf.data.targets=void 0,Nf.data.xs={},Gj.html(""),a.onresize=null},"url"in f.data)Mf.xhr(f.data.url,function(a,b){var c,d=Mf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Mf.csv.parse(b.response),hf(c)});else if("rows"in f.data)hf(xc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");hf(yc(f.data.columns))}return Nf},"function"==typeof define&&define.amd?define("c3",["d3"],f):"undefined"!=typeof exports&&"undefined"!=typeof module?module.exports=f:a.c3=f}(window); \ No newline at end of file From a538d898066a4a4a5c77921f59232c0984580b47 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 14 May 2014 13:07:17 +0900 Subject: [PATCH 177/178] Release 0.1.41 --- bower.json | 2 +- c3.js | 2 +- c3.min.js | 2 +- component.json | 2 +- package.json | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bower.json b/bower.json index 75c466c..738ed9b 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "c3", "main": "c3.min.js", - "version": "0.1.40", + "version": "0.1.41", "homepage": "https://github.com/masayuki0812/c3", "authors": [ "Masayuki Tanaka " diff --git a/c3.js b/c3.js index 05b66a4..8ebaeaf 100644 --- a/c3.js +++ b/c3.js @@ -4,7 +4,7 @@ /*global define, module, exports, require */ var c3 = { - version: "0.1.40" + version: "0.1.41" }; var CLASS = { diff --git a/c3.min.js b/c3.min.js index 0f47ab1..6a3002c 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.round(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.round(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&a=0;return"url("+(c?"":document.URL.split("#")[0])+"#"+b+")"}function k(a){return Math.ceil(a)+.5}function l(a,b){var c,d,e;b&&b.axisX?c=b.axisX:(c=Cj.select("."+g.axisX),a&&(c=c.transition())),b&&b.axisY?d=b.axisY:(d=Cj.select("."+g.axisY),a&&(d=d.transition())),b&&b.axisY2?e=b.axisY2:(e=Cj.select("."+g.axisY2),a&&(e=e.transition())),Cj.attr("transform",mj.main),c.attr("transform",mj.x),d.attr("transform",mj.y),e.attr("transform",mj.y2),Cj.select("."+g.chartArcs).attr("transform",mj.arc)}function m(a,b){var c;b&&b.axisSubX?c=b.axisSubX:(c=Dj.select("."+g.axisX),a&&(c=c.transition())),Dj.attr("transform",mj.context),c.attr("transform",mj.subx)}function n(a){(a?Ej.transition():Ej).attr("transform",mj.legend)}function o(a,b){l(a,b),nh&&m(a,b),n(a)}function p(){var a=U(),b=T(),c=nj?0:a,d=le(Nf.data.targets),e=wh||d?0:A("x"),f=nh&&!d?oh+e:0;kg=t(),lg=u(),wh?(dg={top:A("y2")+v(),right:d?0:y(),bottom:A("y")+c+w(),left:f+(d?0:x())},eg={top:dg.top,right:0/0,bottom:20+c,left:sj}):(dg={top:4+v(),right:d?0:y(),bottom:e+f+c+w(),left:d?0:x()},eg={top:lg-f-c,right:0/0,bottom:e+c,left:dg.left}),fg={top:nj?0:lg-a,right:0/0,bottom:0,left:nj?kg-b:0},gg=kg-dg.left-dg.right,ig=lg-dg.top-dg.bottom,0>gg&&(gg=0),0>ig&&(ig=0),hg=wh?dg.left-sj-tj:gg,jg=wh?ig:lg-eg.top-eg.bottom,0>hg&&(hg=0),0>jg&&(jg=0),pg=gg-(nj?b+10:0),qg=ig-(nj?0:10),r(),nj&&d&&(fg.left=pg/2+1.1*ng)}function q(){Cj.select("line."+g.xgridFocus).attr("x1",wh?0:-10).attr("x2",wh?gg:-10).attr("y1",wh?-10:dg.top).attr("y2",wh?-10:ig)}function r(){ng=Math.min(pg,qg)/2,mg=.95*ng,og=ke(Nf.data.targets)?.6*mg:0}function s(){var a=wh?g.axisX:g.axisY,b=Cj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Gj.node().getBoundingClientRect(),e=le(Nf.data.targets),f=c.right-d.left-(e?0:x());return f>0?f:0}function t(){return Qf?Qf:B()}function u(){var a=Rf?Rf:C();return a>0?a:320}function v(){return Uf?Uf:0}function w(){return Vf?Vf:0}function x(){return Sf?Sf:wh?xh?Math.max(Ke(z("x")),40):1:!Ph||Uh?1:Ke(z("y"))}function y(){var a=10,b=nj?T()+20:0;return Tf?Tf:wh?a+b:(!Yh||bi?a:Ke(z("y2")))+b}function z(a){var b=ob(a);return b.isInner?20+Hb(a):40+Hb(a)}function A(a){return"x"!==a||xh?"x"===a&&Mh?Mh:"y"!==a||Ph?"y2"!==a||Yh?(ob(a).isInner?30:40)+("y2"===a?-10:0):uj:qh&&!nj?10:1:0}function B(){return+Gj.style("width").replace("px","")}function C(){return+Gj.style("height").replace("px","")}function D(a){return a?-31:-(dg.left-1)}function E(a){return a?-20:-4}function F(){return D(!wh)}function G(){return E(!wh)}function H(){return D(wh)}function I(){return E(wh)}function J(a){return a?gg+2+30+30:dg.left+20}function K(a){return a?(Mh?Mh:0)+80:ig+8}function L(){return J(!wh)}function M(){return K(!wh)}function N(){return J(wh)}function O(){return K(wh)}function P(){var a,b,c,d,e,f=Ec(Nf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=Dg(b.x)-Dg(a.x),0===c?wh?ig:gg:(d=Dc(),e=he(Nf.data.targets)?(d-(Wi?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function Q(a){oj=a}function R(a){pj=a}function S(a){qj=a}function T(){return qh?nj?pj*(oj+1):kg:0}function U(){return qh?nj?lg:qj*(oj+1):0}function V(){var a,b,c=!Dg;vg=wh?1:0,wg=wh?ig:gg,xg=wh?0:ig,yg=wh?gg:1,zg=vg,Ag=wg,Bg=wh?0:jg,Cg=wh?hg:1,Dg=Y(vg,wg,c?void 0:Dg.domain(),function(){return Jg.tickOffset()}),Eg=Z(xg,yg,c?void 0:Eg.domain()),Fg=Z(xg,yg,c?void 0:Fg.domain()),Gg=Y(vg,wg,Hj,function(a){return a%1?0:Mg.tickOffset()}),Hg=Z(Bg,Cg,c?void 0:Hg.domain()),Ig=Z(Bg,Cg,c?void 0:Ig.domain()),a=db(),b=Hh?Hh:c?void 0:Jg.tickValues(),Jg=ab(Dg,ij,a,b),Mg=ab(Gg,lj,a,b),Kg=bb(Eg,jj,Vh,Xh),Lg=bb(Fg,kj,ci,ei),c||(vj.scale(Gg),Wf&&zj.scale(Dg)),W()}function W(){rg=Kb(),sg=Lb(),tg=Lb(.98)}function X(a,b,c){return(c?Mf.time.scale():Mf.scale.linear()).range([a,b])}function Y(a,b,c,d){var e,f=X(a,b,Vi),g=c?f.domain(c):f;Wi?(d=d||function(){return 0},f=function(a,b){var c=g(a)+d(a);return b?c:Math.ceil(c)}):f=function(a,b){var c=g(a);return b?c:Math.ceil(c)};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return Hj&&Hj[0]===a[0]&&Hj[1]a?a.toFixed(0):a};return Ch&&("function"==typeof Ch?a=Ch:Vi&&(a=function(a){return a?dj(Ch)(a):""})),a}function eb(a){var b;return"y"===a?b=Th:"y2"===a?b=ai:"x"===a&&(b=Oh),b}function fb(a){var b=eb(a);return"string"==typeof b?b:b?b.text:null}function gb(a,b){var c=eb(a);"string"==typeof c?"y"===a?Th=b:"y2"===a?ai=b:"x"===a&&(Oh=b):c&&(c.text=b)}function hb(a){return 10*Math.sin(Math.PI*(a/180))}function ib(a){return 11.5-2.5*(a/15)}function jb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",ib(c)).attr("x",hb(c)).attr("transform","rotate("+c+")")}function kb(a,b){var c=eb(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 lb(){return kb("x",wh?"inner-top":"inner-right")}function mb(){return kb("y",wh?"inner-right":"inner-top")}function nb(){return kb("y2",wh?"inner-right":"inner-top")}function ob(a){return"y2"===a?nb():"y"===a?mb():lb()}function pb(){return fb("x")}function qb(){return fb("y")}function rb(){return fb("y2")}function sb(a,b){return a?b.isLeft?0:b.isCenter?gg/2:gg:b.isBottom?-ig:b.isMiddle?-ig/2:0}function tb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function ub(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function vb(){return sb(!wh,lb())}function wb(){return sb(wh,mb())}function xb(){return sb(wh,nb())}function yb(){return tb(!wh,lb())}function zb(){return tb(wh,mb())}function Ab(){return tb(wh,nb())}function Bb(){var a=lb();return wh?a.isInner?"1.2em":-25-Hb("x"):a.isInner?"-0.5em":Mh?Mh-10:"3em"}function Cb(){var a=mb();return wh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Hb("y")}function Db(){var a=nb();return wh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Hb("y2")}function Eb(){return ub(!wh,lb())}function Fb(){return ub(wh,mb())}function Gb(){return ub(wh,nb())}function Hb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Ib(a){var b=Cj.select("."+g.axisX+" ."+g.axisXLabel),c=Cj.select("."+g.axisY+" ."+g.axisYLabel),d=Cj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",vb).attr("dx",yb).attr("dy",Bb).text(pb),(a?c.transition():c).attr("x",wb).attr("dx",zb).attr("dy",Cb).attr("dy",Cb).text(qb),(a?d.transition():d).attr("x",xb).attr("dx",Ab).attr("dy",Db).text(rb)}function Jb(a){var b=!1;return ug(Lc(Nf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Kb(){var a=Mf.svg.arc().outerRadius(mg).innerRadius(og),b=function(b,c){var d;return c?a(b):(d=Jb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Lb(a){var b=Mf.svg.arc().outerRadius(ng*(a?a:1)).innerRadius(og);return function(a){var c=Jb(a);return c?b(c):"M 0 0"}}function Mb(a,b){return se(a.data)?rg(a,b):"M 0 0"}function Nb(a){var b,c,d,e,f=Jb(a),g="";return f&&(b=rg.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*mg*.8+","+d/e*mg*.8+")"),g}function Ob(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Pb(a){return tc({id:a.data.id,value:a.value,ratio:Ob(a)})}function Qb(a){var b,c,d,e;return Tb()?(b=Jb(a),c=b?b.value:null,d=Ob(b),e=Ub(),e?e(c,d):Gd(c,d)):""}function Rb(a,b){var c=Aj.selectAll("."+g.chartArc+sd(a)),d=Aj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});ye(a)&&c.selectAll("path").transition().duration(50).attr("d",sg).transition().duration(100).attr("d",tg).each(function(a){re(a.data)}),b||d.style("opacity",.3)}function Sb(a){var b=Aj.selectAll("."+g.chartArc+sd(a));b.selectAll("path").transition().duration(50).attr("d",rg),Aj.selectAll("."+g.arc).style("opacity",1)}function Tb(){return ke(Nf.data.targets)?Ai:ui}function Ub(){return ke(Nf.data.targets)?Bi:vi}function Vb(){return ke(Nf.data.targets)?Di:""}function Wb(){var a=ke(Nf.data.targets)?Ei:xi;return"function"==typeof a?a:function(){}}function Xb(){var a=ke(Nf.data.targets)?Fi:yi;return"function"==typeof a?a:function(){}}function Yb(){var a=ke(Nf.data.targets)?Gi:zi;return"function"==typeof a?a:function(){}}function Zb(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Tg.length>0)for(g=Uc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return Mf.min(Object.keys(i).map(function(a){return Mf.min(i[a])}))}function $b(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Tg.length>0)for(g=Vc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return Mf.max(Object.keys(i).map(function(a){return Mf.max(i[a])}))}function _b(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return cb(a.id)===c}),m="y2"===c?$h:Rh,n="y2"===c?Zh:Qh,o=b(m)?m:Zb(l),p=b(n)?n:$b(l),q="y2"===c?_h:Sh,r=Ad()&&wh;return 0===l.length?"y2"===c?Fg.domain():Eg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=Bd(o,p),j=ec(Eg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Wh&&(f=b(Wh.top)?Wh.top:e,g=b(Wh.bottom)?Wh.bottom:e),"y2"===c&&di&&(f=b(di.top)?di.top:e,g=b(di.bottom)?di.bottom:e),he(l)&&!Uc(l)&&(g=o),[o-g,p+f])}function ac(a){return Kh?Vi?Ae(Kh):Kh:Mf.min(a,function(a){return Mf.min(a.values,function(a){return a.x})})}function bc(a){return Jh?Vi?Ae(Jh):Jh:Mf.max(a,function(a){return Mf.max(a.values,function(a){return a.x})})}function cc(a){var c,d,e,f,g=Fc(a),h=g[1]-g[0];return Wi?d=0:he(a)?(c=Dc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Lh&&Fe(Lh)?(e=b(Lh.left)?Lh.left:d,f=b(Lh.right)?Lh.right:d):e=f="number"==typeof Lh?Lh:d,{left:e,right:f}}function dc(a){var b=[ac(a),bc(a)],c=b[0],d=b[1],e=cc(a),f=0,g=0;return c-d!==0||Wi||(c=Vi?new Date(.5*c.getTime()):-.5,d=Vi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ec(a){return a[1]-a[0]}function fc(a){for(var b=0;bb?0:b-c}function lc(a){var b,c=jc(a),d="y"===a.axis?Eg:Fg;return b="y"===a.axis||"y2"===a.axis?wh?ig:"start"in a?d(a.start):ig:wh?"end"in a?Dg(Vi?Ae(a.end):a.end):ig:ig,c>b?0:b-c}function mc(a){return Ng&&a===Ng||Fe(Og)&&Ge(Og,a)}function nc(a){return!mc(a)}function oc(a){return Ng?Ng:Fe(Og)?Og[a]:null}function pc(a,b){var c,d=b&&Fe(b)?Gc(b):[];return d.forEach(function(b){oc(b)===a&&(c=Nf.data.xs[b])}),c}function qc(a,b){return a in Nf.data.xs&&Nf.data.xs[a]&&Nf.data.xs[a][b]?Nf.data.xs[a][b]:b}function rc(a){Object.keys(a).forEach(function(b){Og[b]=a[b]})}function sc(a){return 1===Mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function tc(a){var b;return a&&(b=Rg[a.id],a.name=b?b:a.id),a}function uc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=wc(b[d],a.id,d)}),Nf.data.xs[a.id]=b})}function vc(a,b){a.forEach(function(a){b[a.id]&&uc([a],b[a.id])})}function wc(a,c,d){var e;return e=Vi?a?a instanceof Date?a:Ae(a):Ae(qc(c,d)):Xi&&!Wi?b(a)?+a:qc(c,d):d}function xc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Ng?(d=Object.keys(Nf.data.xs),Nf.data.xs[c]=d.length>0?Nf.data.xs[d[0]]:void 0):Fe(Og)&&(Nf.data.xs[c]=pc(f,Nf.data.targets)):Nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Qg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=oc(b),g=a[f],h=wc(g,b,e);return Xi&&Wi&&0===c&&g&&(0===e&&(Ah=[]),Ah.push(g)),("undefined"==typeof a[b]||Nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Vg&&fe(Gc(c).filter(function(a){return!(a in Wg)}),Vg),c.forEach(function(a){gc(a.id_org,a)}),c}function Ac(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 Bc(a){return a>0&&Nf.data.targets[0].values[a-1]?Nf.data.targets[0].values[a-1].x:void 0}function Cc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Fc(a){var b,c,d=Ec(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Gc(a){return a.map(function(a){return a.id})}function Hc(a){return a?"string"==typeof a?[a]:a:Gc(Nf.data.targets)}function Ic(a,b){var c,d=Gc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Vi?new Date(i):i);j.push(e)}return Vi||(j=j.sort(function(a,b){return a-b})),j}function Oc(a){fj=fj.concat(a)}function Pc(a){fj=fj.filter(function(b){return a.indexOf(b)<0})}function Qc(a){gj=gj.concat(a)}function Rc(a){gj=gj.filter(function(b){return a.indexOf(b)<0})}function Sc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Tc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Vc(a){return Tc(a,function(a){return a>0})}function Wc(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||0===a[f].x)&&(e=e.concat(Md(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Md(a,g))),Pd(e,b)):Nd(a,b,f,g)}function Od(a,b){var c;return c=a.map(function(a){return Nd(a.values,b)}),Pd(c,b)}function Pd(a,b){var c,d;return a.forEach(function(a){var e=He(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Qd(a,b){return Mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Rd(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 Sd(){return Yg&&"desc"===Yg.toLowerCase()}function Td(){return Yg&&"asc"===Yg.toLowerCase()}function Ud(a){var b=Td(),c=Sd();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 Yg&&a.sort(Yg),a}function Vd(a,c){var d,e,f,g,h,i,j,k=le(Nf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&Ii&&(Fj.html(Li(a,db(),Cd(k),cj)).style("display","block"),d=Fj.property("offsetWidth"),e=Fj.property("offsetHeight"),k?(g=gg/2+c[0],i=ig/2+c[1]+20):(wh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-y(),i=Dg(l[0].x)+20):(f=s(),g=f+x()+Dg(l[0].x)+20,h=g+d,j=f+t()-y(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),Fj.style("top",i+"px").style("left",g+"px"))}function Wd(){Fj.style("display","none")}function Xd(a){var c=a.filter(function(a){return a&&b(a.value)});if(Ii&&!ie(Nf.data.targets)&&!le(Nf.data.targets)){var d=Cj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(wh?"y1":"x1",Id).attr(wh?"y2":"x2",Id),pf(d,"grid")}}function Yd(){Cj.select("line."+g.xgridFocus).style("visibility","hidden")}function Zd(a,b){var c,d,e,f,h=[],i=Cj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=dc(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function $d(a){return a.x||0===a.x?Dg(a.x):null}function _d(a){return $(a.id)(a.value)}function ae(){var a,b,d={},e=0;return Lc(Nf.data.targets.filter(oe)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ee(a,b){return"number"==typeof si?si:b?2*a.tickOffset()*ti/b:0}function fe(a,b){Hc(a).forEach(function(a){Jj[a]=b===Wg[a],Wg[a]=b})}function ge(a,b){var c=!1;return a.forEach(function(a){Wg[a.id]===b&&(c=!0),a.id in Wg||"line"!==b||(c=!0)}),c}function he(a){return ge(a,"bar")}function ie(a){return ge(a,"scatter")}function je(a){return ge(a,"pie")}function ke(a){return ge(a,"donut")}function le(a){return je(a)||ke(a)}function me(a){var b="string"==typeof a?a:a.id;return!(b in Wg)||"line"===Wg[b]||"spline"===Wg[b]||"area"===Wg[b]||"area-spline"===Wg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"spline"===Wg[b]||"area-spline"===Wg[b]}function oe(a){var b="string"==typeof a?a:a.id;return"bar"===Wg[b]}function pe(a){var b="string"==typeof a?a:a.id;return"scatter"===Wg[b]}function qe(a){var b="string"==typeof a?a:a.id;return"pie"===Wg[b]}function re(a){var b="string"==typeof a?a:a.id;return"donut"===Wg[b]}function se(a){return qe(a)||re(a)}function te(a){return me(a)?[a]:[]}function ue(a){return se(a.data)?[a]:[]}function ve(a){return oe(a)?a.values:[]}function we(a){return me(a)||pe(a)?a.values:[]}function xe(a){return oe(a)||me(a)?a.values:[]}function ye(a){return re(a)&&Ci||qe(a)&&wi}function ze(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function Ae(b){var c;try{c=Pg?Mf.time.format(Pg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Pg)}return c}function Be(a,b){var c=Mf.mouse(a),d=Mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ge(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function He(a,b){var c="y"===cb(a.id)?Eg:Fg,d=wh?1:0,e=wh?0:1;return Math.pow(Dg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ie(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Je(a,b,c){return d(a[b])?a[b]:c}function Ke(a){return 10*Math.ceil(a/10)}function Le(a,b,c){jh(b,a.node()),Cj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Xc(g.selectedCircle,c)}).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d).attr("stroke",function(){return cj(b)}).attr("r",1.4*We(b)).transition().duration(100).attr("r",We)}function Me(a,b,c){kh(b,a.node()),Cj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ne(a,b,c,d){a?Le(b,c,d):Me(b,c,d)}function Oe(a,b){jh(b,a.node()),a.transition().duration(100).style("fill",function(){return Mf.rgb(cj(b)).brighter(.75)})}function Pe(a,b){kh(b,a.node()),a.transition().duration(100).style("fill",function(){return cj(b)})}function Qe(a,b,c,d){a?Oe(b,c,d):Pe(b,c,d)}function Re(a,b,c,d){Qe(a,b,c.data,d)}function Se(a){return"circle"===a.nodeName?Ne:Mf.select(a).classed(g.bar)?Qe:Re}function Te(a){return a.filter(function(a){return b(a.value)})}function Ue(a){return li?"function"==typeof mi?mi(a):mi:0}function Ve(a){return oi?pi?pi:1.75*Ue(a):Ue(a)}function We(a){return qi?qi:4*Ue(a)}function Xe(a,c){return(c?Cj.selectAll("."+g.circles+rd(c)):Cj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ye(a,b){Xe(a,b).classed(g.EXPANDED,!0).attr("r",Ve)}function Ze(a){Xe(a).filter(function(){return Mf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Ue)}function $e(a){return Cj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function _e(a){$e(a).classed(g.EXPANDED,!0)}function af(a){$e(a).classed(g.EXPANDED,!1)}function bf(a,b){var c=ff(a,b);return function(a,b){var d=c(a,b),e=wh?1:0,f=wh?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 cf(a,b){var c=ff(a,!1),d=b?df:ef;return function(a,b){return d(c(a,b),a,this)}}function df(a,b){var c;return wh?(c=oe(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function ef(a,b,c){var d=c.getBoundingClientRect();return wh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:oe(b)?-3:-6)}function ff(a,b){var c=a.__max__+1,d=ee(Jg,c),e=be(d,c,a,!!b),f=ce(!!b),g=de(a,!!b),h=b?_:$;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return wh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function gf(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;gb?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&a=0;return"url("+(c?"":document.URL.split("#")[0])+"#"+b+")"}function k(a){return Math.ceil(a)+.5}function l(a,b){var c,d,e;b&&b.axisX?c=b.axisX:(c=Cj.select("."+g.axisX),a&&(c=c.transition())),b&&b.axisY?d=b.axisY:(d=Cj.select("."+g.axisY),a&&(d=d.transition())),b&&b.axisY2?e=b.axisY2:(e=Cj.select("."+g.axisY2),a&&(e=e.transition())),Cj.attr("transform",mj.main),c.attr("transform",mj.x),d.attr("transform",mj.y),e.attr("transform",mj.y2),Cj.select("."+g.chartArcs).attr("transform",mj.arc)}function m(a,b){var c;b&&b.axisSubX?c=b.axisSubX:(c=Dj.select("."+g.axisX),a&&(c=c.transition())),Dj.attr("transform",mj.context),c.attr("transform",mj.subx)}function n(a){(a?Ej.transition():Ej).attr("transform",mj.legend)}function o(a,b){l(a,b),nh&&m(a,b),n(a)}function p(){var a=U(),b=T(),c=nj?0:a,d=le(Nf.data.targets),e=wh||d?0:A("x"),f=nh&&!d?oh+e:0;kg=t(),lg=u(),wh?(dg={top:A("y2")+v(),right:d?0:y(),bottom:A("y")+c+w(),left:f+(d?0:x())},eg={top:dg.top,right:0/0,bottom:20+c,left:sj}):(dg={top:4+v(),right:d?0:y(),bottom:e+f+c+w(),left:d?0:x()},eg={top:lg-f-c,right:0/0,bottom:e+c,left:dg.left}),fg={top:nj?0:lg-a,right:0/0,bottom:0,left:nj?kg-b:0},gg=kg-dg.left-dg.right,ig=lg-dg.top-dg.bottom,0>gg&&(gg=0),0>ig&&(ig=0),hg=wh?dg.left-sj-tj:gg,jg=wh?ig:lg-eg.top-eg.bottom,0>hg&&(hg=0),0>jg&&(jg=0),pg=gg-(nj?b+10:0),qg=ig-(nj?0:10),r(),nj&&d&&(fg.left=pg/2+1.1*ng)}function q(){Cj.select("line."+g.xgridFocus).attr("x1",wh?0:-10).attr("x2",wh?gg:-10).attr("y1",wh?-10:dg.top).attr("y2",wh?-10:ig)}function r(){ng=Math.min(pg,qg)/2,mg=.95*ng,og=ke(Nf.data.targets)?.6*mg:0}function s(){var a=wh?g.axisX:g.axisY,b=Cj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Gj.node().getBoundingClientRect(),e=le(Nf.data.targets),f=c.right-d.left-(e?0:x());return f>0?f:0}function t(){return Qf?Qf:B()}function u(){var a=Rf?Rf:C();return a>0?a:320}function v(){return Uf?Uf:0}function w(){return Vf?Vf:0}function x(){return Sf?Sf:wh?xh?Math.max(Ke(z("x")),40):1:!Ph||Uh?1:Ke(z("y"))}function y(){var a=10,b=nj?T()+20:0;return Tf?Tf:wh?a+b:(!Yh||bi?a:Ke(z("y2")))+b}function z(a){var b=ob(a);return b.isInner?20+Hb(a):40+Hb(a)}function A(a){return"x"!==a||xh?"x"===a&&Mh?Mh:"y"!==a||Ph?"y2"!==a||Yh?(ob(a).isInner?30:40)+("y2"===a?-10:0):uj:qh&&!nj?10:1:0}function B(){return+Gj.style("width").replace("px","")}function C(){return+Gj.style("height").replace("px","")}function D(a){return a?-31:-(dg.left-1)}function E(a){return a?-20:-4}function F(){return D(!wh)}function G(){return E(!wh)}function H(){return D(wh)}function I(){return E(wh)}function J(a){return a?gg+2+30+30:dg.left+20}function K(a){return a?(Mh?Mh:0)+80:ig+8}function L(){return J(!wh)}function M(){return K(!wh)}function N(){return J(wh)}function O(){return K(wh)}function P(){var a,b,c,d,e,f=Ec(Nf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=Dg(b.x)-Dg(a.x),0===c?wh?ig:gg:(d=Dc(),e=he(Nf.data.targets)?(d-(Wi?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function Q(a){oj=a}function R(a){pj=a}function S(a){qj=a}function T(){return qh?nj?pj*(oj+1):kg:0}function U(){return qh?nj?lg:qj*(oj+1):0}function V(){var a,b,c=!Dg;vg=wh?1:0,wg=wh?ig:gg,xg=wh?0:ig,yg=wh?gg:1,zg=vg,Ag=wg,Bg=wh?0:jg,Cg=wh?hg:1,Dg=Y(vg,wg,c?void 0:Dg.domain(),function(){return Jg.tickOffset()}),Eg=Z(xg,yg,c?void 0:Eg.domain()),Fg=Z(xg,yg,c?void 0:Fg.domain()),Gg=Y(vg,wg,Hj,function(a){return a%1?0:Mg.tickOffset()}),Hg=Z(Bg,Cg,c?void 0:Hg.domain()),Ig=Z(Bg,Cg,c?void 0:Ig.domain()),a=db(),b=Hh?Hh:c?void 0:Jg.tickValues(),Jg=ab(Dg,ij,a,b),Mg=ab(Gg,lj,a,b),Kg=bb(Eg,jj,Vh,Xh),Lg=bb(Fg,kj,ci,ei),c||(vj.scale(Gg),Wf&&zj.scale(Dg)),W()}function W(){rg=Kb(),sg=Lb(),tg=Lb(.98)}function X(a,b,c){return(c?Mf.time.scale():Mf.scale.linear()).range([a,b])}function Y(a,b,c,d){var e,f=X(a,b,Vi),g=c?f.domain(c):f;Wi?(d=d||function(){return 0},f=function(a,b){var c=g(a)+d(a);return b?c:Math.ceil(c)}):f=function(a,b){var c=g(a);return b?c:Math.ceil(c)};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return Hj&&Hj[0]===a[0]&&Hj[1]a?a.toFixed(0):a};return Ch&&("function"==typeof Ch?a=Ch:Vi&&(a=function(a){return a?dj(Ch)(a):""})),a}function eb(a){var b;return"y"===a?b=Th:"y2"===a?b=ai:"x"===a&&(b=Oh),b}function fb(a){var b=eb(a);return"string"==typeof b?b:b?b.text:null}function gb(a,b){var c=eb(a);"string"==typeof c?"y"===a?Th=b:"y2"===a?ai=b:"x"===a&&(Oh=b):c&&(c.text=b)}function hb(a){return 10*Math.sin(Math.PI*(a/180))}function ib(a){return 11.5-2.5*(a/15)}function jb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",ib(c)).attr("x",hb(c)).attr("transform","rotate("+c+")")}function kb(a,b){var c=eb(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 lb(){return kb("x",wh?"inner-top":"inner-right")}function mb(){return kb("y",wh?"inner-right":"inner-top")}function nb(){return kb("y2",wh?"inner-right":"inner-top")}function ob(a){return"y2"===a?nb():"y"===a?mb():lb()}function pb(){return fb("x")}function qb(){return fb("y")}function rb(){return fb("y2")}function sb(a,b){return a?b.isLeft?0:b.isCenter?gg/2:gg:b.isBottom?-ig:b.isMiddle?-ig/2:0}function tb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function ub(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function vb(){return sb(!wh,lb())}function wb(){return sb(wh,mb())}function xb(){return sb(wh,nb())}function yb(){return tb(!wh,lb())}function zb(){return tb(wh,mb())}function Ab(){return tb(wh,nb())}function Bb(){var a=lb();return wh?a.isInner?"1.2em":-25-Hb("x"):a.isInner?"-0.5em":Mh?Mh-10:"3em"}function Cb(){var a=mb();return wh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Hb("y")}function Db(){var a=nb();return wh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Hb("y2")}function Eb(){return ub(!wh,lb())}function Fb(){return ub(wh,mb())}function Gb(){return ub(wh,nb())}function Hb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Mf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Ib(a){var b=Cj.select("."+g.axisX+" ."+g.axisXLabel),c=Cj.select("."+g.axisY+" ."+g.axisYLabel),d=Cj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",vb).attr("dx",yb).attr("dy",Bb).text(pb),(a?c.transition():c).attr("x",wb).attr("dx",zb).attr("dy",Cb).attr("dy",Cb).text(qb),(a?d.transition():d).attr("x",xb).attr("dx",Ab).attr("dy",Db).text(rb)}function Jb(a){var b=!1;return ug(Lc(Nf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Kb(){var a=Mf.svg.arc().outerRadius(mg).innerRadius(og),b=function(b,c){var d;return c?a(b):(d=Jb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Lb(a){var b=Mf.svg.arc().outerRadius(ng*(a?a:1)).innerRadius(og);return function(a){var c=Jb(a);return c?b(c):"M 0 0"}}function Mb(a,b){return se(a.data)?rg(a,b):"M 0 0"}function Nb(a){var b,c,d,e,f=Jb(a),g="";return f&&(b=rg.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*mg*.8+","+d/e*mg*.8+")"),g}function Ob(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Pb(a){return tc({id:a.data.id,value:a.value,ratio:Ob(a)})}function Qb(a){var b,c,d,e;return Tb()?(b=Jb(a),c=b?b.value:null,d=Ob(b),e=Ub(),e?e(c,d):Gd(c,d)):""}function Rb(a,b){var c=Aj.selectAll("."+g.chartArc+sd(a)),d=Aj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});ye(a)&&c.selectAll("path").transition().duration(50).attr("d",sg).transition().duration(100).attr("d",tg).each(function(a){re(a.data)}),b||d.style("opacity",.3)}function Sb(a){var b=Aj.selectAll("."+g.chartArc+sd(a));b.selectAll("path").transition().duration(50).attr("d",rg),Aj.selectAll("."+g.arc).style("opacity",1)}function Tb(){return ke(Nf.data.targets)?Ai:ui}function Ub(){return ke(Nf.data.targets)?Bi:vi}function Vb(){return ke(Nf.data.targets)?Di:""}function Wb(){var a=ke(Nf.data.targets)?Ei:xi;return"function"==typeof a?a:function(){}}function Xb(){var a=ke(Nf.data.targets)?Fi:yi;return"function"==typeof a?a:function(){}}function Yb(){var a=ke(Nf.data.targets)?Gi:zi;return"function"==typeof a?a:function(){}}function Zb(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Tg.length>0)for(g=Uc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return Mf.min(Object.keys(i).map(function(a){return Mf.min(i[a])}))}function $b(a){var b,c,d,e,f,g,h=Gc(a),i=Sc(a);if(Tg.length>0)for(g=Vc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return Mf.max(Object.keys(i).map(function(a){return Mf.max(i[a])}))}function _b(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return cb(a.id)===c}),m="y2"===c?$h:Rh,n="y2"===c?Zh:Qh,o=b(m)?m:Zb(l),p=b(n)?n:$b(l),q="y2"===c?_h:Sh,r=Ad()&&wh;return 0===l.length?"y2"===c?Fg.domain():Eg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=Bd(o,p),j=ec(Eg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Wh&&(f=b(Wh.top)?Wh.top:e,g=b(Wh.bottom)?Wh.bottom:e),"y2"===c&&di&&(f=b(di.top)?di.top:e,g=b(di.bottom)?di.bottom:e),he(l)&&!Uc(l)&&(g=o),[o-g,p+f])}function ac(a){return Kh?Vi?Ae(Kh):Kh:Mf.min(a,function(a){return Mf.min(a.values,function(a){return a.x})})}function bc(a){return Jh?Vi?Ae(Jh):Jh:Mf.max(a,function(a){return Mf.max(a.values,function(a){return a.x})})}function cc(a){var c,d,e,f,g=Fc(a),h=g[1]-g[0];return Wi?d=0:he(a)?(c=Dc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Lh&&Fe(Lh)?(e=b(Lh.left)?Lh.left:d,f=b(Lh.right)?Lh.right:d):e=f="number"==typeof Lh?Lh:d,{left:e,right:f}}function dc(a){var b=[ac(a),bc(a)],c=b[0],d=b[1],e=cc(a),f=0,g=0;return c-d!==0||Wi||(c=Vi?new Date(.5*c.getTime()):-.5,d=Vi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ec(a){return a[1]-a[0]}function fc(a){for(var b=0;bb?0:b-c}function lc(a){var b,c=jc(a),d="y"===a.axis?Eg:Fg;return b="y"===a.axis||"y2"===a.axis?wh?ig:"start"in a?d(a.start):ig:wh?"end"in a?Dg(Vi?Ae(a.end):a.end):ig:ig,c>b?0:b-c}function mc(a){return Ng&&a===Ng||Fe(Og)&&Ge(Og,a)}function nc(a){return!mc(a)}function oc(a){return Ng?Ng:Fe(Og)?Og[a]:null}function pc(a,b){var c,d=b&&Fe(b)?Gc(b):[];return d.forEach(function(b){oc(b)===a&&(c=Nf.data.xs[b])}),c}function qc(a,b){return a in Nf.data.xs&&Nf.data.xs[a]&&Nf.data.xs[a][b]?Nf.data.xs[a][b]:b}function rc(a){Object.keys(a).forEach(function(b){Og[b]=a[b]})}function sc(a){return 1===Mf.set(Object.keys(a).map(function(b){return a[b]})).size()}function tc(a){var b;return a&&(b=Rg[a.id],a.name=b?b:a.id),a}function uc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=wc(b[d],a.id,d)}),Nf.data.xs[a.id]=b})}function vc(a,b){a.forEach(function(a){b[a.id]&&uc([a],b[a.id])})}function wc(a,c,d){var e;return e=Vi?a?a instanceof Date?a:Ae(a):Ae(qc(c,d)):Xi&&!Wi?b(a)?+a:qc(c,d):d}function xc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Nf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Ng?(d=Object.keys(Nf.data.xs),Nf.data.xs[c]=d.length>0?Nf.data.xs[d[0]]:void 0):Fe(Og)&&(Nf.data.xs[c]=pc(f,Nf.data.targets)):Nf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Nf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Qg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=oc(b),g=a[f],h=wc(g,b,e);return Xi&&Wi&&0===c&&g&&(0===e&&(Ah=[]),Ah.push(g)),("undefined"==typeof a[b]||Nf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Vg&&fe(Gc(c).filter(function(a){return!(a in Wg)}),Vg),c.forEach(function(a){gc(a.id_org,a)}),c}function Ac(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 Bc(a){return a>0&&Nf.data.targets[0].values[a-1]?Nf.data.targets[0].values[a-1].x:void 0}function Cc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Fc(a){var b,c,d=Ec(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Gc(a){return a.map(function(a){return a.id})}function Hc(a){return a?"string"==typeof a?[a]:a:Gc(Nf.data.targets)}function Ic(a,b){var c,d=Gc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Vi?new Date(i):i);j.push(e)}return Vi||(j=j.sort(function(a,b){return a-b})),j}function Oc(a){fj=fj.concat(a)}function Pc(a){fj=fj.filter(function(b){return a.indexOf(b)<0})}function Qc(a){gj=gj.concat(a)}function Rc(a){gj=gj.filter(function(b){return a.indexOf(b)<0})}function Sc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Tc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Vc(a){return Tc(a,function(a){return a>0})}function Wc(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||0===a[f].x)&&(e=e.concat(Md(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Md(a,g))),Pd(e,b)):Nd(a,b,f,g)}function Od(a,b){var c;return c=a.map(function(a){return Nd(a.values,b)}),Pd(c,b)}function Pd(a,b){var c,d;return a.forEach(function(a){var e=He(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Qd(a,b){return Mf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Rd(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 Sd(){return Yg&&"desc"===Yg.toLowerCase()}function Td(){return Yg&&"asc"===Yg.toLowerCase()}function Ud(a){var b=Td(),c=Sd();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 Yg&&a.sort(Yg),a}function Vd(a,c){var d,e,f,g,h,i,j,k=le(Nf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&Ii&&(Fj.html(Li(a,db(),Cd(k),cj)).style("display","block"),d=Fj.property("offsetWidth"),e=Fj.property("offsetHeight"),k?(g=gg/2+c[0],i=ig/2+c[1]+20):(wh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-y(),i=Dg(l[0].x)+20):(f=s(),g=f+x()+Dg(l[0].x)+20,h=g+d,j=f+t()-y(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),Fj.style("top",i+"px").style("left",g+"px"))}function Wd(){Fj.style("display","none")}function Xd(a){var c=a.filter(function(a){return a&&b(a.value)});if(Ii&&!ie(Nf.data.targets)&&!le(Nf.data.targets)){var d=Cj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(wh?"y1":"x1",Id).attr(wh?"y2":"x2",Id),pf(d,"grid")}}function Yd(){Cj.select("line."+g.xgridFocus).style("visibility","hidden")}function Zd(a,b){var c,d,e,f,h=[],i=Cj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=dc(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function $d(a){return a.x||0===a.x?Dg(a.x):null}function _d(a){return $(a.id)(a.value)}function ae(){var a,b,d={},e=0;return Lc(Nf.data.targets.filter(oe)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ee(a,b){return"number"==typeof si?si:b?2*a.tickOffset()*ti/b:0}function fe(a,b){Hc(a).forEach(function(a){Jj[a]=b===Wg[a],Wg[a]=b})}function ge(a,b){var c=!1;return a.forEach(function(a){Wg[a.id]===b&&(c=!0),a.id in Wg||"line"!==b||(c=!0)}),c}function he(a){return ge(a,"bar")}function ie(a){return ge(a,"scatter")}function je(a){return ge(a,"pie")}function ke(a){return ge(a,"donut")}function le(a){return je(a)||ke(a)}function me(a){var b="string"==typeof a?a:a.id;return!(b in Wg)||"line"===Wg[b]||"spline"===Wg[b]||"area"===Wg[b]||"area-spline"===Wg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"spline"===Wg[b]||"area-spline"===Wg[b]}function oe(a){var b="string"==typeof a?a:a.id;return"bar"===Wg[b]}function pe(a){var b="string"==typeof a?a:a.id;return"scatter"===Wg[b]}function qe(a){var b="string"==typeof a?a:a.id;return"pie"===Wg[b]}function re(a){var b="string"==typeof a?a:a.id;return"donut"===Wg[b]}function se(a){return qe(a)||re(a)}function te(a){return me(a)?[a]:[]}function ue(a){return se(a.data)?[a]:[]}function ve(a){return oe(a)?a.values:[]}function we(a){return me(a)||pe(a)?a.values:[]}function xe(a){return oe(a)||me(a)?a.values:[]}function ye(a){return re(a)&&Ci||qe(a)&&wi}function ze(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function Ae(b){var c;try{c=Pg?Mf.time.format(Pg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Pg)}return c}function Be(a,b){var c=Mf.mouse(a),d=Mf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ge(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function He(a,b){var c="y"===cb(a.id)?Eg:Fg,d=wh?1:0,e=wh?0:1;return Math.pow(Dg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ie(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Je(a,b,c){return d(a[b])?a[b]:c}function Ke(a){return 10*Math.ceil(a/10)}function Le(a,b,c){jh(b,a.node()),Cj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Xc(g.selectedCircle,c)}).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d).attr("stroke",function(){return cj(b)}).attr("r",1.4*We(b)).transition().duration(100).attr("r",We)}function Me(a,b,c){kh(b,a.node()),Cj.select("."+g.selectedCircles+rd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ne(a,b,c,d){a?Le(b,c,d):Me(b,c,d)}function Oe(a,b){jh(b,a.node()),a.transition().duration(100).style("fill",function(){return Mf.rgb(cj(b)).brighter(.75)})}function Pe(a,b){kh(b,a.node()),a.transition().duration(100).style("fill",function(){return cj(b)})}function Qe(a,b,c,d){a?Oe(b,c,d):Pe(b,c,d)}function Re(a,b,c,d){Qe(a,b,c.data,d)}function Se(a){return"circle"===a.nodeName?Ne:Mf.select(a).classed(g.bar)?Qe:Re}function Te(a){return a.filter(function(a){return b(a.value)})}function Ue(a){return li?"function"==typeof mi?mi(a):mi:0}function Ve(a){return oi?pi?pi:1.75*Ue(a):Ue(a)}function We(a){return qi?qi:4*Ue(a)}function Xe(a,c){return(c?Cj.selectAll("."+g.circles+rd(c)):Cj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ye(a,b){Xe(a,b).classed(g.EXPANDED,!0).attr("r",Ve)}function Ze(a){Xe(a).filter(function(){return Mf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Ue)}function $e(a){return Cj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function _e(a){$e(a).classed(g.EXPANDED,!0)}function af(a){$e(a).classed(g.EXPANDED,!1)}function bf(a,b){var c=ff(a,b);return function(a,b){var d=c(a,b),e=wh?1:0,f=wh?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 cf(a,b){var c=ff(a,!1),d=b?df:ef;return function(a,b){return d(c(a,b),a,this)}}function df(a,b){var c;return wh?(c=oe(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function ef(a,b,c){var d=c.getBoundingClientRect();return wh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:oe(b)?-3:-6)}function ff(a,b){var c=a.__max__+1,d=ee(Jg,c),e=be(d,c,a,!!b),f=ce(!!b),g=de(a,!!b),h=b?_:$;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return wh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function gf(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function hf(b){var c,d,e;if(Gj=Mf.select(Pf),Gj.empty())throw new Error("Element to bind not found");if(Gj.html("").classed("c3",!0),Nf.data.xs={},Nf.data.targets=zc(b),bh&&(Nf.data.targets=Nf.data.targets.filter(bh)),ah&&Oc(ah===!0?Gc(Nf.data.targets):ah),p(),V(),Dg.domain(Mf.extent(dc(Nf.data.targets))),Eg.domain(_b(Nf.data.targets,"y")),Fg.domain(_b(Nf.data.targets,"y2")),Gg.domain(Dg.domain()),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Hj=Dg.domain(),vj.scale(Gg),Wf&&zj.scale(Dg),Aj=Gj.append("svg").style("overflow","hidden").on("mouseenter",$f).on("mouseleave",_f),Bj=Aj.append("defs"),Bj.append("clipPath").attr("id",Pi).append("rect"),Bj.append("clipPath").attr("id",Qi).append("rect"),Bj.append("clipPath").attr("id",Ri).append("rect"),uf(),Cj=Aj.append("g").attr("transform",mj.main),Dj=Aj.append("g").attr("transform",mj.context),Ej=Aj.append("g").attr("transform",mj.legend),nh||Dj.style("visibility","hidden"),qh||(Ej.style("visibility","hidden"),gj=Gc(Nf.data.targets)),Fj=Gj.style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Hf(Gc(Nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=Cj.append("g").attr("clip-path",Si).attr("class",g.grid),fi&&d.append("g").attr("class",g.xgrids),Fe(hi)&&d.append("g").attr("class",g.xgridLines),ni&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),ii&&d.append("g").attr("class",g.ygrids),Fe(ji)&&d.append("g").attr("class",g.ygridLines),Cj.append("g").attr("clip-path",Si).attr("class",g.regions),Cj.append("g").attr("clip-path",Si).attr("class",g.chart),c=Cj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Wf?wh?"ns-resize":"ew-resize":null),Cj.select("."+g.chart).append("g").attr("class",g.chartBars),Cj.select("."+g.chart).append("g").attr("class",g.chartLines),Cj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",mj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Vb()),Cj.select("."+g.chart).append("g").attr("class",g.chartTexts),Wf&&Cj.insert("rect",Yf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",gg).attr("height",ig).style("opacity",0).style("cursor",wh?"ns-resize":"ew-resize").call(zj).on("dblclick.zoom",null),Nh&&vj.extent("function"!=typeof Nh?Nh:Nh(dc())),hj.x=Cj.append("g").attr("class",g.axisX).attr("clip-path",Ti).attr("transform",mj.x).style("visibility",xh?"visible":"hidden"),hj.x.append("text").attr("class",g.axisXLabel).attr("transform",wh?"rotate(-90)":"").style("text-anchor",Eb),hj.y=Cj.append("g").attr("class",g.axisY).attr("clip-path",Ui).attr("transform",mj.y).style("visibility",Ph?"visible":"hidden"),hj.y.append("text").attr("class",g.axisYLabel).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Fb),hj.y2=Cj.append("g").attr("class",g.axisY2).attr("transform",mj.y2).style("visibility",Yh?"visible":"hidden"),hj.y2.append("text").attr("class",g.axisY2Label).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Gb),Dj.append("g").attr("clip-path",Si).attr("class",g.chart),Dj.select("."+g.chart).append("g").attr("class",g.chartBars),Dj.select("."+g.chart).append("g").attr("class",g.chartLines),Dj.append("g").attr("clip-path",Si).attr("class",g.brush).call(vj).selectAll("rect").attr(wh?"width":"height",wh?hg:jg),hj.subx=Dj.append("g").attr("class",g.axisX).attr("transform",mj.subx).attr("clip-path",wh?"":Ti),xf(Nf.data.targets),qf({withUpdateTranslate:!0,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Mi){if(Vi&&"string"==typeof Ni){for(Ni=Ae(Ni),e=0;e0){d=[];for(var f in Rg)for(c=0;cf&&h>c&&d>i&&j>d;else{if(!n.classed(g.bar))return;m=Rd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Qe,q=!(c>h||f>c+e||d>j||i>d+k)}q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function nf(a){le(Nf.data.targets)||ch&&(Yi=a,Cj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Zi=!0,lh())}function of(){le(Nf.data.targets)||ch&&(Cj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),Cj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Zi=!1,mh())}function pf(a,b){"grid"===b&&a.each(function(){var a=Mf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function qf(a,c){var d,e,f,h,i,j,k,l,m,n,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,Q,R,S,T,U,W,X,Y,Z,$=ae(),_=le(Nf.data.targets),ab=Lc(Nf.data.targets);if(a=a||{},E=Je(a,"withY",!0),F=Je(a,"withSubchart",!0),G=Je(a,"withTransition",!0),J=Je(a,"withTransform",!1),K=Je(a,"withUpdateXDomain",!1),L=Je(a,"withUpdateOrgXDomain",!1),N=Je(a,"withUpdateTranslate",!1),M=Je(a,"withLegend",!1),H=Je(a,"withTransitionForExit",G),I=Je(a,"withTransitionForAxis",G),T=G?cg:0,U=H?T:0,W=I?T:0,c=c||vf(W),N&&(wh?(hj.x.call(Jg),hj.subx.call(Mg)):(hj.y.call(Kg),hj.y2.call(Lg)),p(),V(),uf(),o(!1)),M&&qh&&Hf(Gc(Nf.data.targets),a,c),Wi&&0===ab.length&&Dg.domain([0,hj.x.selectAll(".tick").size()]),ab.length&&(L&&(Dg.domain(Mf.extent(dc(ab))),Hj=Dg.domain(),Wf&&zj.scale(Dg).updateScaleExtent(),Gg.domain(Dg.domain()),vj.scale(Gg)),K&&(Dg.domain(vj.empty()?Hj:vj.extent()),Wf&&zj.scale(Dg).updateScaleExtent()),Hh||!Gh&&!Fh||(X=Nc(Mc(ab),Fh),Jg.tickValues(X),Mg.tickValues(X))),Eg.domain(_b(ab,"y")),Fg.domain(_b(ab,"y2")),hj.x.style("opacity",_?0:1),hj.y.style("opacity",_?0:1),hj.y2.style("opacity",_?0:1),hj.subx.style("opacity",_?0:1),c.axisX.call(Jg),c.axisY.call(Kg),c.axisY2.call(Lg),c.axisSubX.call(Mg),Ib(G),K&&ab.length)if(Dh&&X){for(Y=1;Y=0&&Mf.select(this).style("display",b%Z?"none":"block")})}else Aj.selectAll("."+g.axisX+" .tick text").style("display","block");!wh&&Ih&&jb(hj.x,c.axisX,Ih),O=bf($),R=cf($,!0),S=cf($,!1),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Fj.style("display","none"),q(),Cj.select("line."+g.xgridFocus).style("visibility","hidden"),fi&&(f=Zd(gi,Dg),B=Wi?Jg.tickOffset():0,e=wh?{x1:0,x2:gg,y1:function(a){return Dg(a)-B},y2:function(a){return Dg(a)-B}}:{x1:function(a){return Dg(a)+B},x2:function(a){return Dg(a)+B},y1:dg.top,y2:ig},d=Cj.select("."+g.xgrids).selectAll("."+g.xgrid).data(f),d.enter().append("line").attr("class",g.xgrid),d.attr(e).style("opacity",function(){return+Mf.select(this).attr(wh?"y1":"x1")===(wh?ig:0)?0:1}),d.exit().remove()),Fe(hi)&&(h=Cj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(hi),i=h.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),i.append("line").style("opacity",0),i.append("text").attr("text-anchor","end").attr("transform",wh?"":"rotate(-90)").attr("dx",wh?0:-dg.top).attr("dy",-5).style("opacity",0),h.select("line").transition().duration(T).attr("x1",wh?0:Jd).attr("x2",wh?gg:Jd).attr("y1",wh?Jd:dg.top).attr("y2",wh?Jd:ig).style("opacity",1),h.select("text").transition().duration(T).attr("x",wh?gg:0).attr("y",Jd).text(function(a){return a.text}).style("opacity",1),h.exit().transition().duration(T).style("opacity",0).remove()),E&&ii&&(j=Cj.select("."+g.ygrids).selectAll("."+g.ygrid).data(Eg.ticks(ki)),j.enter().append("line").attr("class",g.ygrid),j.attr("x1",wh?Eg:0).attr("x2",wh?Eg:gg).attr("y1",wh?0:Eg).attr("y2",wh?ig:Eg),j.exit().remove(),pf(j,"grid")),E&&Fe(ji)&&(k=Cj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(ji),l=k.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",wh?"rotate(-90)":"").attr("dx",wh?0:-dg.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",wh?Kd:0).attr("x2",wh?Kd:gg).attr("y1",wh?0:Kd).attr("y2",wh?ig:Kd).style("opacity",1),k.select("text").transition().duration(T).attr("x",wh?0:gg).attr("y",Kd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),u=Cj.select("."+g.regions).selectAll("."+g.region).data(Hi),u.enter().append("g").attr("class",kd).append("rect").style("fill-opacity",0),u.selectAll("rect").transition().duration(T).attr("x",ic).attr("y",jc).attr("width",kc).attr("height",lc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),u.exit().transition().duration(T).style("opacity",0).remove(),s=Cj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),s.enter().append("path").attr("class",ed).style("stroke","none").style("fill",cj),s.style("opacity",wd).transition().duration(T).attr("d",O).style("fill",cj).style("opacity",1),s.exit().transition().duration(U).style("opacity",0).remove(),m=Cj.selectAll("."+g.lines).selectAll("."+g.line).data(te),m.enter().append("path").attr("class",ad).style("stroke",cj),m.style("opacity",wd).transition().duration(T).attr("d",wj).style("stroke",cj).style("opacity",1),m.exit().transition().duration(U).style("opacity",0).remove(),n=Cj.selectAll("."+g.areas).selectAll("."+g.area).data(te),n.enter().append("path").attr("class",id).style("fill",cj).style("opacity",function(){return Ij=+Mf.select(this).style("opacity"),0}),n.style("opacity",0).transition().duration(T).attr("d",xj).style("fill",cj).style("opacity",Ij),n.exit().transition().duration(U).style("opacity",0).remove(),r=Cj.selectAll("."+g.circles).selectAll("."+g.circle).data(we),r.enter().append("circle").attr("class",cd).attr("r",Ue).style("fill",cj),r.style("opacity",wd).transition().duration(T).style("opacity",yd).style("fill",cj).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d),r.exit().remove(),v=Cj.selectAll("."+g.texts).selectAll("."+g.text).data(xe),v.enter().append("text").attr("class",Yc).attr("text-anchor",function(a){return wh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",cj).style("fill-opacity",0),v.text(function(a){return Hd(a.id)(a.value,a.id)}).style("fill-opacity",xd).transition().duration(T).attr("x",R).attr("y",S).style("fill",cj).style("fill-opacity",zd),v.exit().transition().duration(U).style("fill-opacity",0).remove(),t=Cj.selectAll("."+g.arcs).selectAll("."+g.arc).data(ue),t.enter().append("path").attr("class",gd).style("fill",function(a){return cj(a.data)}).style("cursor",function(a){return eh(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;aj||(c=Jb(a),d=Pb(c),e=Xb(),Rb(c.data.id),Df(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Jb(a),c=Pb(b),d=[c];Vd(d,Mf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;aj||(c=Jb(a),d=Pb(c),e=Yb(),Sb(c.data.id),Ef(),Wd(),e(d,b))}).on("click",function(a,b){var c=Jb(a),d=Pb(c),e=Wb();lf(this,a,b),e(d,b)}),t.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){aj=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Jb(a);return c?(b=Mf.interpolate(this._current,c),this._current=b(0),function(a){return Mb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("fill",function(a){return cj(a.data)}).style("opacity",1).call(Ie,function(){aj=!1}),t.exit().transition().duration(U).style("opacity",0).remove(),Cj.selectAll("."+g.chartArc).select("text").attr("transform",Nb).style("opacity",0).transition().duration(T).text(Qb).style("opacity",function(a){return Jc(a.data.id)&&se(a.data)?1:0}),Cj.select("."+g.chartArcsTitle).style("opacity",ke(Nf.data.targets)?1:0),nh&&(Mf.event&&"zoom"===Mf.event.type&&vj.extent(Dg.orgDomain()).update(),F&&(!wh&&Ih&&jb(hj.subx,c.axisSubX,Ih),vj.empty()||vj.extent(Dg.orgDomain()).update(),Q=bf($,!0),x=Dj.selectAll("."+g.bars).selectAll("."+g.bar).data(ve),x.enter().append("path").attr("class",ed).style("stroke","none").style("fill",cj),x.style("opacity",wd).transition().duration(T).attr("d",Q).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove(),w=Dj.selectAll("."+g.lines).selectAll("."+g.line).data(te),w.enter().append("path").attr("class",ad).style("stroke",cj),w.style("opacity",wd).transition().duration(T).attr("d",yj).style("opacity",1),w.exit().transition().duration(T).style("opacity",0).remove())),Cj.selectAll("."+g.selectedCircles).filter(function(a){return oe(a)}).selectAll("circle").remove(),Cj.selectAll("."+g.selectedCircle).transition().duration(T).attr("cx",wh?_d:$d).attr("cy",wh?$d:_d),Zf&&(y=Cj.select("."+g.eventRects),Fe(Og)&&!sc(Og)?(y.classed(g.eventRectsMultiple)||y.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),z=Cj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),kf(z.enter()),z.attr("x",0).attr("y",0).attr("width",gg).attr("height",ig)):(y.classed(g.eventRectsSingle)||y.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Xi&&!Wi?(D=function(a,b){var c=Bc(b),d=Cc(b),e=Nf.data.xs[a.id][b];return(Dg(d?d:e+50)-Dg(c?c:e-50))/2},C=function(a,b){var c=Bc(b),d=Nf.data.xs[a.id][b];return(Dg(d)+Dg(c?c:d-50))/2}):(D=P(),C=function(a){return Dg(a.x)-D/2}),A=Ec(Nf.data.targets),Cj.select("."+g.eventRects).datum(A?A.values:[]),z=Cj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),jf(z.enter()),z.attr("class",ld).attr("x",wh?0:C).attr("y",wh?C:0).attr("width",wh?gg:D).attr("height",wh?D:ig),z.exit().remove())),Gc(Nf.data.targets).forEach(function(a){Jj[a]=!0})}function rf(){qf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function sf(){if(0!==Lc(Nf.data.targets).length){if("mousemove"===Mf.event.sourceEvent.type&&zj.altDomain)return Dg.domain(zj.altDomain),void zj.scale(Dg).updateScaleExtent();Wi&&Dg.orgDomain()[0]===Hj[0]&&Dg.domain([Hj[0]-1e-10,Dg.orgDomain()[1]]),qf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Mf.event.sourceEvent.type&&($i=!0)}}function tf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function uf(){Aj.attr("width",kg).attr("height",lg),Aj.select("#"+Pi).select("rect").attr("width",gg).attr("height",ig),Aj.select("#"+Qi).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),Aj.select("#"+Ri).select("rect").attr("x",H).attr("y",I).attr("width",N).attr("height",O),Aj.select("."+g.zoomRect).attr("width",gg).attr("height",ig),Gj.style("max-height",lg+"px")}function vf(a){return{axisX:a?hj.x.transition().duration(a):hj.x,axisY:a?hj.y.transition().duration(a):hj.y,axisY2:a?hj.y2.transition().duration(a):hj.y2,axisSubX:a?hj.subx.transition().duration(a):hj.subx}}function wf(a){var b;a=a||{},a.withTransition=Je(a,"withTransition",!0),a.withTransform=Je(a,"withTransform",!1),a.withLegend=Je(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withLegend&&qh||(b=vf(a.withTransitionForAxis?cg:0),p(),V(),uf(),o(a.withTransition,b)),qf(a,b)}function xf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=Cj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",nd),j=i.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Zc),e=Cj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),d=e.enter().append("g").attr("class",pd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",fd).style("cursor",function(a){return eh(a)?"pointer":null}),c=Cj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),b=c.enter().append("g").attr("class",od).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",bd),b.append("g").attr("class",jd),b.append("g").attr("class",function(a){return Xc(g.selectedCircles,a.id)}),b.append("g").attr("class",dd).style("cursor",function(a){return eh(a)?"pointer":null}),a.forEach(function(a){Cj.selectAll("."+g.selectedCircles+rd(a.id)).selectAll("."+g.selectedCircle).each(function(b){b.value=a.values[b.index].value})}),h=Cj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(ug(a)).attr("class",qd),f=h.enter().append("g").attr("class",qd),f.append("g").attr("class",hd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),nh&&(n=Dj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",pd),m=n.enter().append("g").style("opacity",0).attr("class",pd),m.append("g").attr("class",fd),l=Dj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",od),k=l.enter().append("g").style("opacity",0).attr("class",od),k.append("g").attr("class",bd)),Aj.selectAll("."+g.target).filter(function(a){return Jc(a.id)}).transition().duration(cg).style("opacity",1)}function yf(a,b){b.filter&&(a=a.filter(b.filter)),(b.type||b.types)&&a.forEach(function(a){b.types?fe(a.id,b.types[a.id]):fe(a.id,b.type)}),Nf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,z=0,F++)),E[a]=F,D[F]=f,A[a]=z,z+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+v)/10),j=10*Math.ceil((h.height+u)/10),k=nj?j:i,l=nj?U():T();return d&&(z=0,F=0,w=0,x=0),qh&&!Kc(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=i,C[c]=j,(!w||i>=w)&&(w=i),(!x||j>=x)&&(x=j),g=nj?x:w,void(vh?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(l-g*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=26,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=Ej.selectAll("."+g.legendItemFocused).size();b=b||{},n=Je(b,"withTransition",!0),q=Je(b,"withTransitionForTransform",!0),nj?(f=function(a){return w*E[a]},j=function(a){return D[E[a]]+A[a]}):(f=function(a){return D[E[a]]+A[a]},j=function(a){return x*E[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=Ej.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Xc(g.legendItem,a)}).style("visibility",function(a){return Kc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof sh?sh(a):Nf.toggle(a)}).on("mouseover",function(a){Mf.select(this).classed(g.legendItemFocused,!0),aj||Nf.focus(a),"function"==typeof th&&th(a)}).on("mouseout",function(a){Mf.select(this).classed(g.legendItemFocused,!1),aj||Nf.revert(),"function"==typeof uh&&uh(a)}),m.append("text").text(function(a){return d(Rg[a])?Rg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",nj?h:-200).attr("y",nj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",nj?i:-200).attr("y",nj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",cj).attr("x",nj?h:-200).attr("y",nj?-200:j).attr("width",10).attr("height",10),r=Ej.selectAll("text").data(a).text(function(a){return d(Rg[a])?Rg[a]:a}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=Ej.selectAll("rect."+g.legendItemEvent).data(a),(n?s.transition():s).attr("width",function(a){return B[a]}).attr("height",function(a){return C[a]}).attr("x",i).attr("y",l),t=Ej.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",cj).attr("x",f).attr("y",j),Ej.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Jc(a)}).transition().style("opacity",function(a){var b=Mf.select(this);return Jc(a)?!G||b.classed(g.legendItemFocused)?Bf(b):Cf(b):rj}),R(w),S(x),Q(F),p(),V(),uf(),o(q,c)}function If(a){return Ic(Nf.data.targets,a.id)}function Jf(a){return"data"in a&&Ic(Nf.data.targets,a.data.id)}function Kf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function Lf(a,b,c){var d=!le(Nf.data.targets);aj=!1,fe(a,b),wf(c||{withTransitionForAxis:d})}var Mf=a.d3?a.d3:"undefined"!=typeof require?require("d3"):void 0,Nf={data:{},axis:{},legend:{}},Of={},Pf=i(["bindto"],"#chart"),Qf=i(["size","width"]),Rf=i(["size","height"]),Sf=i(["padding","left"]),Tf=i(["padding","right"]),Uf=i(["padding","top"]),Vf=i(["padding","bottom"]),Wf=i(["zoom","enabled"],!1),Xf=i(["zoom","extent"]),Yf=i(["zoom","privileged"],!1),Zf=i(["interaction","enabled"],!0),$f=i(["onenter"],function(){}),_f=i(["onleave"],function(){}),ag=i(["onresize"],function(){}),bg=i(["onresized"],function(){}),cg=i(["transition","duration"],350);h("data","data is required in config");var dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg,Kg,Lg,Mg,Ng=i(["data","x"]),Og=i(["data","xs"],{}),Pg=i(["data","x_format"]),Qg=i(["data","id_converter"],function(a){return a}),Rg=i(["data","names"],{}),Sg=i(["data","classes"],{}),Tg=i(["data","groups"],[]),Ug=i(["data","axes"],{}),Vg=i(["data","type"]),Wg=i(["data","types"],{}),Xg=i(["data","labels"],{}),Yg=i(["data","order"]),Zg=i(["data","regions"],{}),$g=i(["data","color"]),_g=i(["data","colors"],{}),ah=i(["data","hide"],!1),bh=i(["data","filter"]),ch=i(["data","selection","enabled"],!1),dh=i(["data","selection","grouped"],!1),eh=i(["data","selection","isselectable"],function(){return!0}),fh=i(["data","selection","multiple"],!0),gh=i(["data","onclick"],function(){}),hh=i(["data","onenter"],function(){}),ih=i(["data","onleave"],function(){}),jh=i(["data","onselected"],function(){}),kh=i(["data","onunselected"],function(){}),lh=i(["data","ondragstart"],function(){}),mh=i(["data","ondragend"],function(){}),nh=i(["subchart","show"],!1),oh=i(["subchart","size","height"],60),ph=i(["color","pattern"],[]),qh=i(["legend","show"],!0),rh=i(["legend","position"],"bottom"),sh=i(["legend","item","onclick"]),th=i(["legend","item","onmouseover"]),uh=i(["legend","item","onmouseout"]),vh=i(["legend","equally"],!1),wh=i(["axis","rotated"],!1),xh=i(["axis","x","show"],!0),yh=i(["axis","x","type"],"indexed"),zh=i(["axis","x","localtime"],!0),Ah=i(["axis","x","categories"],[]),Bh=i(["axis","x","tick","centered"],!1),Ch=i(["axis","x","tick","format"]),Dh=i(["axis","x","tick","culling"],{}),Eh=i(["axis","x","tick","culling","max"],10),Fh=i(["axis","x","tick","count"]),Gh=i(["axis","x","tick","fit"],!0),Hh=i(["axis","x","tick","values"],null),Ih=i(["axis","x","tick","rotate"]),Jh=i(["axis","x","max"],null),Kh=i(["axis","x","min"],null),Lh=i(["axis","x","padding"],{}),Mh=i(["axis","x","height"]),Nh=i(["axis","x","default"]),Oh=i(["axis","x","label"],{}),Ph=i(["axis","y","show"],!0),Qh=i(["axis","y","max"]),Rh=i(["axis","y","min"]),Sh=i(["axis","y","center"]),Th=i(["axis","y","label"],{}),Uh=i(["axis","y","inner"],!1),Vh=i(["axis","y","tick","format"]),Wh=i(["axis","y","padding"]),Xh=i(["axis","y","ticks"],10),Yh=i(["axis","y2","show"],!1),Zh=i(["axis","y2","max"]),$h=i(["axis","y2","min"]),_h=i(["axis","y2","center"]),ai=i(["axis","y2","label"],{}),bi=i(["axis","y2","inner"],!1),ci=i(["axis","y2","tick","format"]),di=i(["axis","y2","padding"]),ei=i(["axis","y2","ticks"],10),fi=i(["grid","x","show"],!1),gi=i(["grid","x","type"],"tick"),hi=i(["grid","x","lines"],[]),ii=i(["grid","y","show"],!1),ji=i(["grid","y","lines"],[]),ki=i(["grid","y","ticks"],10),li=i(["point","show"],!0),mi=i(["point","r"],2.5),ni=i(["point","focus","line","enabled"],!0),oi=i(["point","focus","expand","enabled"],!0),pi=i(["point","focus","expand","r"]),qi=i(["point","focus","select","r"]),ri=i(["line","connect_null"],!1),si=i(["bar","width"]),ti=i(["bar","width","ratio"],.6),ui=i(["pie","label","show"],!0),vi=i(["pie","label","format"]),wi=i(["pie","expand"],!0),xi=i(["pie","onclick"],function(){}),yi=i(["pie","onmouseover"],function(){}),zi=i(["pie","onmouseout"],function(){}),Ai=i(["donut","label","show"],!0),Bi=i(["donut","label","format"]),Ci=i(["donut","expand"],!0),Di=i(["donut","title"],""),Ei=i(["donut","onclick"],function(){}),Fi=i(["donut","onmouseover"],function(){}),Gi=i(["donut","onmouseout"],function(){}),Hi=i(["regions"],[]),Ii=i(["tooltip","show"],!0),Ji=i(["tooltip","format","title"]),Ki=i(["tooltip","format","value"]),Li=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Ji?Ji:b,l=Ki?Ki:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Mi=i(["tooltip","init","show"],!1),Ni=i(["tooltip","init","x"],0),Oi=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Pi=("string"==typeof Pf?Pf.replace(/[# .>~+]/g,""):g.chart+ +new Date)+"-clip",Qi=Pi+"-xaxis",Ri=Pi+"-yaxis",Si=j(Pi),Ti=j(Qi),Ui=j(Ri),Vi="timeseries"===yh,Wi="categorized"===yh,Xi=!Vi&&(Ng||Fe(Og)),Yi=null,Zi=!1,$i=!1,_i=!1,aj=!1,bj=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],cj=ze(_g,Fe(ph)?ph:bj,$g),dj=zh?Mf.time.format:Mf.time.format.utc,ej=dj.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),fj=[],gj=[],hj={},ij=wh?"left":"bottom",jj=wh?Uh?"top":"bottom":Uh?"right":"left",kj=wh?bi?"bottom":"top":bi?"left":"right",lj=wh?"left":"bottom",mj={main:function(){return"translate("+k(dg.left)+","+k(dg.top)+")"},context:function(){return"translate("+k(eg.left)+","+k(eg.top)+")"},legend:function(){return"translate("+fg.left+","+fg.top+")" },x:function(){return"translate(0,"+(wh?0:ig)+")"},y:function(){return"translate(0,"+(wh?ig:0)+")"},y2:function(){return"translate("+(wh?0:gg)+","+(wh?1:0)+")"},subx:function(){return"translate(0,"+(wh?0:jg)+")"},arc:function(){return"translate("+pg/2+","+qg/2+")"}},nj="right"===rh,oj=0,pj=0,qj=0,rj=.15,sj=30,tj=wh&&!xh?0:30,uj=5;ug=Mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var vj,wj=function(){var a=Mf.svg.line().x(wh?function(a){return $(a.id)(a.value)}:Id).y(wh?Id:function(a){return $(a.id)(a.value)});return ri||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ri?Te(b.values):b.values;return me(b)?(a.interpolate(ne(b)?"cardinal":"linear"),Zg[b.id]?gf(e,Dg,$(b.id),Zg[b.id]):a(e)):(c=e[0]?Dg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,wh?"M "+d+" "+c:"M "+c+" "+d)}}(),xj=function(){var a;return a=wh?Mf.svg.area().x0(function(a){return $(a.id)(0)}).x1(function(a){return $(a.id)(a.value)}).y(Id):Mf.svg.area().x(Id).y0(function(a){return $(a.id)(0)}).y1(function(a){return $(a.id)(a.value)}),function(b){var c,d,e=Te(b.values);return ge([b],"area")||ge([b],"area-spline")?(a.interpolate(ne(b)?"cardinal":"linear"),a(e)):(c=e[0]?Dg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,wh?"M "+d+" "+c:"M "+c+" "+d)}}(),yj=function(){var a=Mf.svg.line().x(wh?function(a){return _(a.id)(a.value)}:Ld).y(wh?Ld:function(a){return _(a.id)(a.value)});return function(b){var c=Te(b.values);return me(b)?a(c):"M "+Gg(c[0].x)+" "+_(b.id)(c[0].value)}}(),zj=function(){};vj=Mf.svg.brush().on("brush",rf),vj.update=function(){return Dj&&Dj.select("."+g.brush).call(this),this},vj.scale=function(a){return wh?this.y(a):this.x(a)},Wf&&(zj=Mf.behavior.zoom().on("zoomstart",function(){zj.altDomain=Mf.event.sourceEvent.altKey?Dg.orgDomain():null}).on("zoom",Wf?sf:null),zj.scale=function(a){return wh?this.y(a):this.x(a)},zj.orgScaleExtent=function(){var a=Xf?Xf:[1,10];return[a[0],Math.max(Dc()/a[1],a[1])]},zj.updateScaleExtent=function(){var a=ec(Dg.orgDomain())/ec(Hj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Aj,Bj,Cj,Dj,Ej,Fj,Gj,Hj,Ij,Jj={};if(Nf.focus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);Nf.revert(),Nf.defocus(),b(d.classed(g.focused,!0)),b(e),le(Nf.data.targets)&&Rb(a,!0),Df(a,!0)},Nf.defocus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",.3)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);Nf.revert(),b(d.classed(g.focused,!1)),b(e),le(Nf.data.targets)&&Sb(a),Df(a,!1)},Nf.revert=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);b(d.classed(g.focused,!1)),b(e),le(Nf.data.targets)&&Sb(a),Ef()},Nf.show=function(a,b){a=Hc(a),b=b||{},Pc(a),Aj.selectAll(td(a)).transition().style("opacity",1),b.withLegend&&Ff(a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Nf.hide=function(a,b){a=Hc(a),b=b||{},Oc(a),Aj.selectAll(td(a)).transition().style("opacity",0),b.withLegend&&Gf(a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Nf.toggle=function(a){Jc(a)?Nf.hide(a):Nf.show(a)},Nf.unzoom=function(){vj.clear().update(),qf({withUpdateXDomain:!0})},Nf.load=function(a){return a.xs&&rc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Sg[b]=a.classes[b]}),"categories"in a&&Wi&&(Ah=a.categories,Jg.categories(Ah)),"cacheIds"in a&&fc(a.cacheIds)?void yf(hc(a.cacheIds),a.done):void("unload"in a?Af(Hc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){zf(a)}):zf(a))},Nf.unload=function(a,b){Af(Hc(a),function(){qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Nf.selected=function(a){return Mf.merge(Cj.selectAll("."+g.shapes+rd(a)).selectAll("."+g.shape).filter(function(){return Mf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Nf.select=function(a,b,c){ch&&Cj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Mf.select(this),i=e.data?e.data.id:e.id,j=Se(this),k=dh||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);h.classed(g.line)||h.classed(g.area)||(k&&l?eh(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},Nf.unselect=function(a,b){ch&&Cj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Mf.select(this),f=c.data?c.data.id:c.id,h=Se(this),i=dh||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);e.classed(g.line)||e.classed(g.area)||i&&j&&eh(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Nf.toLine=function(a){Lf(a,"line")},Nf.toSpline=function(a){Lf(a,"spline")},Nf.toBar=function(a){Lf(a,"bar")},Nf.toScatter=function(a){Lf(a,"scatter")},Nf.toArea=function(a){Lf(a,"area")},Nf.toAreaSpline=function(a){Lf(a,"area-spline")},Nf.toPie=function(a){Lf(a,"pie",{withTransform:!0})},Nf.toDonut=function(a){Lf(a,"donut",{withTransform:!0})},Nf.groups=function(a){return c(a)?Tg:(Tg=a,qf(),Tg)},Nf.xgrids=function(a){return a?(hi=a,qf(),hi):hi},Nf.xgrids.add=function(a){return a?Nf.xgrids(hi.concat(a)):void 0},Nf.xgrids.remove=function(a){var b=Kf(a);return Nf.xgrids(hi.filter(b))},Nf.ygrids=function(a){return a?(ji=a,qf(),ji):ji},Nf.ygrids.add=function(a){return a?Nf.ygrids(ji.concat(a)):void 0},Nf.ygrids.remove=function(a){var b=Kf(a);return Nf.ygrids(ji.filter(b))},Nf.regions=function(a){return a?(Hi=a,qf(),Hi):Hi},Nf.regions.add=function(a){return a?(Hi=Hi.concat(a),qf(),Hi):Hi},Nf.regions.remove=function(a){var b,c,d;return a=a||{},b=Je(a,"duration",cg),c=Je(a,"classes",[g.region]),d=Cj.select("."+g.regions).selectAll(c.map(function(a){return"."+a})),(b?d.transition().duration(b):d).style("opacity",0).remove(),Hi=Hi.filter(function(a){var b=!1;return a.class?(a.class.split(" ").forEach(function(a){c.indexOf(a)>=0&&(b=!0)}),!b):!0})},Nf.data.get=function(a){var b=Nf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Nf.data.getAsTarget=function(a){var b=Nf.data.targets.filter(function(b){return b.id===a});return b.length>0?b[0]:void 0},Nf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Rg[b]=a[b]}),qf({withLegend:!0}),Rg):Rg},Nf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){_g[b]=a[b]}),qf({withLegend:!0}),_g):_g},Nf.x=function(a){return arguments.length&&(uc(Nf.data.targets,a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Nf.data.xs},Nf.xs=function(a){return arguments.length&&(vc(Nf.data.targets,a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Nf.data.xs},Nf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){gb(b,a[b])}),Ib())},Nf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Jh=+a.x),b(a.y)&&(Qh=+a.y),b(a.y2)&&(Zh=+a.y2)):Qh=Zh=+a,qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Nf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Kh=+a.x),b(a.y)&&(Rh=+a.y),b(a.y2)&&($h=+a.y2)):Rh=$h=+a,qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Nf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Nf.axis.max(a.max),"undefined"!=typeof a.min&&Nf.axis.min(a.min))},Nf.legend.show=function(a){Ff(Hc(a)),qf({withLegend:!0})},Nf.legend.hide=function(a){Gf(Hc(a)),qf({withLegend:!0})},Nf.resize=function(a){Qf=a?a.width:null,Rf=a?a.height:null,wf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Nf.destroy=function(){Nf.data.targets=void 0,Nf.data.xs={},Gj.html(""),a.onresize=null},"url"in f.data)Mf.xhr(f.data.url,function(a,b){var c,d=Mf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Mf.csv.parse(b.response),hf(c)});else if("rows"in f.data)hf(xc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");hf(yc(f.data.columns))}return Nf},"function"==typeof define&&define.amd?define("c3",["d3"],f):"undefined"!=typeof exports&&"undefined"!=typeof module?module.exports=f:a.c3=f}(window); \ No newline at end of file diff --git a/component.json b/component.json index f0b4e6c..b0cbf11 100644 --- a/component.json +++ b/component.json @@ -2,7 +2,7 @@ "name": "c3", "repo": "masayuki0812/c3", "description": "A D3-based reusable chart library", - "version": "0.1.40", + "version": "0.1.41", "keywords": [], "dependencies": { "mbostock/d3": "*" diff --git a/package.json b/package.json index 909d33c..cf3e9cc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "c3", - "version": "0.1.40", + "version": "0.1.41", "description": "D3-based reusable chart library", "main": "c3.js", "scripts": { From fdb755c49f7d44d35e2beacbf8eeec78ac1ed82b Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Thu, 15 May 2014 17:42:34 +0900 Subject: [PATCH 178/178] Update README.md --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8e5dc33..1323f52 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@ c3 [![Build Status](https://travis-ci.org/masayuki0812/c3.png?branch=master)](https://travis-ci.org/masayuki0812/c3) == -c3 is a D3-based chart library that allows you to integrate charts into web applications more deeply. +c3 is a D3-based reusable chart library that enables deeper integration of charts into web applications. -More information in [the wiki](https://github.com/masayuki0812/c3/wiki). - -Samples in [c3js.org](http://c3js.org/#basic) +More information is here: [http://c3js.org](http://c3js.org/)